1 #ifndef LIBR2C2_TRACK_H_
2 #define LIBR2C2_TRACK_H_
6 #include <sigc++/trackable.h>
7 #include <msp/datafile/objectloader.h>
10 #include "tracktype.h"
17 class Track: public Object, public sigc::trackable
20 class Loader: public Msp::DataFile::ObjectLoader<Track>
25 void position(float, float, float);
27 void sensor_id(unsigned);
30 void turnout_id(unsigned);
33 sigc::signal<void, unsigned, Track *> signal_link_changed;
34 sigc::signal<void, unsigned> signal_path_changing;
35 sigc::signal<void, unsigned> signal_path_changed;
38 const TrackType &type;
44 std::vector<Track *> links;
49 Track &operator=(const Track &);
51 Track(Layout &, const TrackType &);
54 virtual Track *clone(Layout * = 0) const;
55 virtual const TrackType &get_type() const { return type; }
57 void set_block(Block *);
58 Block &get_block() const;
59 virtual void set_position(const Vector &);
60 virtual void set_rotation(const Angle &);
61 virtual void set_tilt(const Angle &);
63 bool get_flex() const { return flex; }
65 void propagate_slope();
69 void set_turnout_id(unsigned);
70 void set_sensor_id(unsigned);
71 unsigned get_turnout_id() const { return turnout_id; }
72 unsigned get_sensor_id() const { return sensor_id; }
73 void set_active_path(unsigned);
74 unsigned get_active_path() const { return active_path; }
75 bool is_path_changing() const { return path_changing; }
77 TrackPoint get_point(unsigned, unsigned, float) const;
78 TrackPoint get_point(unsigned, float) const;
80 virtual unsigned get_n_snap_nodes() const;
81 virtual Snap get_snap_node(unsigned) const;
82 virtual bool snap(Snap &, float, SnapType = SNAP_DEFAULT) const;
84 virtual SnapType get_default_snap_type_to(const Object &) const;
87 virtual unsigned get_n_link_slots() const;
88 virtual Track *get_link(unsigned) const;
89 const std::vector<Track *> &get_links() const { return links; }
90 virtual int get_link_slot(const Object &) const;
91 virtual bool link_to(Object &);
92 using Object::break_link;
93 virtual bool break_link(unsigned);
95 void save(std::list<Msp::DataFile::Statement> &) const;
97 void turnout_event(unsigned, unsigned);