]> git.tdb.fi Git - r2c2.git/blob - source/libr2c2/trackappearance.cpp
Further improve lead route generation
[r2c2.git] / source / libr2c2 / trackappearance.cpp
1 #include "trackappearance.h"
2
3 using namespace std;
4 using namespace Msp;
5
6 namespace R2C2 {
7
8 TrackAppearance::TrackAppearance():
9         gauge(1.524),
10         tie_length(0),
11         tie_spacing(1)
12 { }
13
14 float TrackAppearance::get_rail_elevation() const
15 {
16         return ballast_profile.get_height()+rail_profile.get_height();
17 }
18
19
20 TrackAppearance::Loader::Loader(TrackAppearance &a):
21         ObjectLoader<TrackAppearance>(a)
22 {
23         add("ballast_profile", &Loader::ballast_profile);
24         add("gauge", &Loader::gauge);
25         add("rail_profile", &Loader::rail_profile);
26         add("technique", &TrackAppearance::technique);
27         add("tie_length", &Loader::tie_length);
28         add("tie_profile", &Loader::tie_profile);
29         add("tie_spacing", &Loader::tie_spacing);
30 }
31
32 void TrackAppearance::Loader::ballast_profile()
33 {
34         load_sub(obj.ballast_profile);
35 }
36
37 void TrackAppearance::Loader::gauge(float g)
38 {
39         obj.gauge = g/1000;
40 }
41
42 void TrackAppearance::Loader::rail_profile()
43 {
44         load_sub(obj.rail_profile);
45 }
46
47 void TrackAppearance::Loader::tie_length(float l)
48 {
49         obj.tie_length = l/1000;
50 }
51
52 void TrackAppearance::Loader::tie_profile()
53 {
54         load_sub(obj.tie_profile);
55 }
56
57 void TrackAppearance::Loader::tie_spacing(float s)
58 {
59         obj.tie_spacing = s/1000;
60 }
61
62 } // namespace R2C2