]> git.tdb.fi Git - r2c2.git/blob - source/libr2c2/trackpart.h
Also check if the clock is stopped
[r2c2.git] / source / libr2c2 / trackpart.h
1 #ifndef LIBR2C2_TRACKPART_H_
2 #define LIBR2C2_TRACKPART_H_
3
4 #include <msp/datafile/objectloader.h>
5 #include "geometry.h"
6
7 namespace R2C2 {
8
9 class TrackPart
10 {
11 public:
12         class Loader: public Msp::DataFile::ObjectLoader<TrackPart>
13         {
14         public:
15                 Loader(TrackPart &);
16         private:
17                 virtual void finish();
18                 void start(float, float, float);
19         };
20
21 private:
22         Vector pos;
23         Angle dir;
24         float length;
25         float radius;
26         unsigned path;
27         bool dead_end;
28         TrackPart *links[2];
29         Shape *shape;
30         Transform transform;
31
32 public:
33         TrackPart();
34         ~TrackPart();
35
36         float get_length() const;
37         bool is_curved() const { return radius; }
38         OrientedPoint get_point(float) const;
39         OrientedPoint get_nearest_point(const Vector &) const;
40         unsigned get_path() const { return path; }
41         bool is_dead_end() const { return dead_end; }
42         void check_link(TrackPart &);
43         TrackPart *get_link(unsigned) const;
44         void create_shape();
45         const Shape &get_shape() const { return *shape; }
46 };
47
48 } // namespace R2C2
49
50 #endif