X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Ftrack.h;h=883fb5eda506ab04a0614bbbebf1333560bbe41f;hb=f950f5a77714a155e57c868101911e181a617818;hp=4dbfa2db87eabd56c12616f759adebdef1f4ca2c;hpb=05afa986fa3d923a0ee239bb9200bdec7c6f1b5f;p=r2c2.git diff --git a/source/libr2c2/track.h b/source/libr2c2/track.h index 4dbfa2d..883fb5e 100644 --- a/source/libr2c2/track.h +++ b/source/libr2c2/track.h @@ -6,14 +6,15 @@ #include #include #include "geometry.h" +#include "object.h" +#include "tracktype.h" namespace R2C2 { class Block; class Layout; -class TrackType; -class Track: public sigc::trackable +class Track: public Object, public sigc::trackable { public: class Loader: public Msp::DataFile::ObjectLoader @@ -22,6 +23,7 @@ public: Loader(Track &); private: void position(float, float, float); + void rotation(float); void sensor_id(unsigned); void turnout_id(unsigned); }; @@ -30,11 +32,8 @@ public: sigc::signal signal_path_changed; private: - Layout &layout; const TrackType &type; Block *block; - Vector pos; - float rot; float slope; bool flex; unsigned turnout_id; @@ -49,17 +48,15 @@ public: Track(Layout &, const TrackType &); ~Track(); - Layout &get_layout() const { return layout; } - const TrackType &get_type() const { return type; } + virtual Track *clone(Layout * = 0) const; + virtual const TrackType &get_type() const { return type; } void set_block(Block *); Block &get_block() const; - void set_position(const Vector &); - void set_rotation(float); + virtual void set_position(const Vector &); + virtual void set_rotation(float); void set_slope(float); void set_flex(bool); - const Vector &get_position() const { return pos; } - float get_rotation() const { return rot; } float get_slope() const { return slope; } bool get_flex() const { return flex; } void check_slope(); @@ -85,7 +82,7 @@ public: TrackPoint get_point(unsigned, float) const; TrackPoint get_nearest_point(const Vector &) const; - bool collide_ray(const Vector &, const Vector &); + virtual bool collide_ray(const Vector &, const Vector &) const; void save(std::list &) const; private: