X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Ftrack.h;h=f169c0a92671c7ac9a458aca9a36ae327986da3b;hb=bc9e941447da48905295192289bc09483a678180;hp=168ac37eb669bffe2f15a8457152feb068c1fe77;hpb=bde934f7d5ba07a9442a305192e10024820d13ed;p=r2c2.git diff --git a/source/libr2c2/track.h b/source/libr2c2/track.h index 168ac37..f169c0a 100644 --- a/source/libr2c2/track.h +++ b/source/libr2c2/track.h @@ -13,6 +13,7 @@ namespace R2C2 { class Block; class Layout; +class TrackAttachment; class Track: public Object, public sigc::trackable { @@ -25,10 +26,15 @@ public: void position(float, float, float); void rotation(float); void sensor_id(unsigned); + void slope(float); + void tilt(float); void turnout_id(unsigned); }; + typedef std::list AttachmentList; + sigc::signal signal_link_changed; + sigc::signal signal_path_changing; sigc::signal signal_path_changed; private: @@ -41,6 +47,7 @@ private: std::vector links; unsigned active_path; bool path_changing; + AttachmentList attachments; Track(const Track &); Track &operator=(const Track &); @@ -55,11 +62,11 @@ public: Block &get_block() const; virtual void set_position(const Vector &); virtual void set_rotation(const Angle &); - void set_slope(float); + virtual void set_tilt(const Angle &); void set_flex(bool); - float get_slope() const { return slope; } bool get_flex() const { return flex; } private: + void propagate_slope(); void check_slope(); public: @@ -71,8 +78,8 @@ public: unsigned get_active_path() const { return active_path; } bool is_path_changing() const { return path_changing; } - TrackPoint get_point(unsigned, unsigned, float) const; - TrackPoint get_point(unsigned, float) const; + OrientedPoint get_point(unsigned, unsigned, float) const; + OrientedPoint get_point(unsigned, float) const; virtual unsigned get_n_snap_nodes() const; virtual Snap get_snap_node(unsigned) const; @@ -89,6 +96,11 @@ public: using Object::break_link; virtual bool break_link(unsigned); + void add_attachment(TrackAttachment &); + void remove_attachment(TrackAttachment &); + const AttachmentList &get_attachments() const { return attachments; } + AttachmentList get_attachments_ordered(unsigned) const; + void save(std::list &) const; private: void turnout_event(unsigned, unsigned);