- struct Endpoint
- {
- Point pos;
- float rot;
- Track *link;
- unsigned routes;
-
- Endpoint(const Point &p, float r, unsigned o): pos(p), rot(r), link(0), routes(o) { }
- };
- typedef std::list<Endpoint> EndpointSeq;
-
- struct Part
- {
- class Loader: public Msp::Parser::Loader
- {
- public:
- Loader(Part &);
- Part &get_object() { return part; }
- ~Loader();
- private:
- Part ∂
-
- void start(float, float, float);
- };
-
- float x,y;
- float dir;
- float length;
- float radius;
- unsigned route;
- bool dead_end;
-
- Part();
- void collect_endpoints(EndpointSeq &);
- };
- typedef std::list<Part> PartSeq;
-
- Track(unsigned);
- ~Track();
- void set_position(const Point &);
- void set_rotation(float);
- void set_slope(float);
- void set_flex(bool f) { flex=f; }
- void set_turnout_id(unsigned i) { turnout_id=i; }
- void set_sensor_id(unsigned i) { sensor_id=i; }
- const Point &get_position() const { return pos; }
- float get_rotation() const { return rot; }
- unsigned get_article_number() const { return art_nr; }
- const PartSeq &get_parts() const { return parts; }
- const EndpointSeq &get_endpoints() const { return endpoints; }
- const Endpoint *get_endpoint_by_link(Track *) const;
- const std::string &get_description() const { return description; }
- float get_slope() const { return slope; }
- bool get_flex() const { return flex; }
- float get_length() const;
- float get_total_length() const;
- unsigned get_turnout_id() const { return turnout_id; }
- unsigned get_sensor_id() const { return sensor_id; }
- unsigned get_n_routes() const;
- bool snap_to(Track &, bool);
- bool snap(Point &, float &) const;
- void break_link(Track &);
- void break_links();
- void check_slope();
- const Endpoint *traverse(const Endpoint *, unsigned) const;
-
- /**
- Creates a copy of the track. The new track will be almost identical, but
- won't have any links to other tracks, nor a turnout or sensor id.
- */
- Track *copy() const;