]> git.tdb.fi Git - r2c2.git/blob - source/libmarklin/trackpart.h
Attempt to estimate the exact positions of trains from measured speed data
[r2c2.git] / source / libmarklin / trackpart.h
1 /* $Id$
2
3 This file is part of the MSP Märklin suite
4 Copyright © 2006-2009 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #ifndef MARKLIN_TRACKPART_H_
9 #define MARKLIN_TRACKPART_H_
10
11 #include <msp/datafile/loader.h>
12 #include "endpoint.h"
13 #include "geometry.h"
14
15 namespace Marklin {
16
17 struct TrackPart
18 {
19         class Loader: public Msp::DataFile::Loader
20         {
21         private:
22                 TrackPart &part;
23
24         public:
25                 Loader(TrackPart &);
26                 TrackPart &get_object() { return part; }
27         private:
28                 virtual void finish();
29
30                 void start(float, float, float);
31         };
32
33         Point    pos;
34         float    dir;
35         float    length;
36         float    radius;
37         unsigned route;
38         bool     dead_end;
39
40         TrackPart();
41
42         void collect_endpoints(std::vector<Endpoint> &) const;
43         Point get_point(float) const;
44 };
45
46 } // namespace Marklin
47
48 #endif