]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/trackappearance.cpp
Move track appearance properties into a separate class
[r2c2.git] / source / libr2c2 / trackappearance.cpp
diff --git a/source/libr2c2/trackappearance.cpp b/source/libr2c2/trackappearance.cpp
new file mode 100644 (file)
index 0000000..b97d696
--- /dev/null
@@ -0,0 +1,32 @@
+#include "trackappearance.h"
+
+using namespace std;
+using namespace Msp;
+
+namespace R2C2 {
+
+float TrackAppearance::get_rail_elevation() const
+{
+       return ballast_profile.get_height()+rail_profile.get_height();
+}
+
+
+TrackAppearance::Loader::Loader(TrackAppearance &a):
+       ObjectLoader<TrackAppearance>(a)
+{
+       add("ballast_profile", &Loader::ballast_profile);
+       add("rail_profile", &Loader::rail_profile);
+       add("technique", &TrackAppearance::technique);
+}
+
+void TrackAppearance::Loader::ballast_profile()
+{
+       load_sub(obj.ballast_profile);
+}
+
+void TrackAppearance::Loader::rail_profile()
+{
+       load_sub(obj.rail_profile);
+}
+
+} // namespace R2C2