3 This file is part of the MSP Märklin suite
4 Copyright © 2010 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
8 #ifndef LIBMARKLIN_VEHICLE_H_
9 #define LIBMARKLIN_VEHICLE_H_
39 TrackPosition(Track *, unsigned, float);
41 TrackPoint get_point() const;
45 const VehicleType &type;
48 TrackPosition track_pos;
51 std::vector<float> bogie_dirs;
54 Vehicle(Layout &, const VehicleType &);
57 const VehicleType &get_type() const { return type; }
59 void attach_back(Vehicle &);
60 void attach_front(Vehicle &);
63 Vehicle *get_next() const { return next; }
64 Vehicle *get_previous() const { return prev; }
66 void place(Track *, unsigned, float, PlaceMode = CENTER);
68 Track *get_track() const { return track_pos.track; }
69 unsigned get_entry() const { return track_pos.ep; }
70 float get_offset() const { return track_pos.offs; }
71 const Point &get_position() const { return position; }
72 float get_direction() const { return direction; }
73 float get_bogie_direction(unsigned) const;
75 void update_position();
76 void update_position_from(const Vehicle &);
77 void propagate_position();
78 void propagate_forward();
79 void propagate_backward();
81 void adjust_for_distance(TrackPosition &, TrackPosition &, float, float = 0.5) const;
82 TrackPoint get_point(const Point &, const Point &, float = 0.5) const;
83 TrackPoint get_point(const TrackPosition &, float, float = 0.5) const;
86 } // namespace Marklin