]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/tracktype.cpp
Convert Catalogue to a Collection
[r2c2.git] / source / libr2c2 / tracktype.cpp
index 59b8f9ca275b4fe508b94fe77c32ec220ab83472..c2740f1d39b33ccfe10f819863ea26da220544f8 100644 (file)
@@ -1,5 +1,6 @@
 #include <cmath>
 #include <msp/geometry/union.h>
+#include "trackappearance.h"
 #include "tracktype.h"
 
 using namespace std;
@@ -7,13 +8,25 @@ using namespace Msp;
 
 namespace R2C2 {
 
-TrackType::TrackType(const ArticleNumber &an, const TrackAppearance &ta):
+TrackType::TrackType(const ArticleNumber &an, const TrackAppearance *ta):
        ObjectType(an),
        appearance(ta),
        state_bits(0),
        autofit_preference(1)
 { }
 
+const TrackAppearance &TrackType::get_appearance() const
+{
+       if(!appearance)
+               throw logic_error("no appearance");
+       return *appearance;
+}
+
+float TrackType::get_gauge() const
+{
+       return get_appearance().get_gauge();
+}
+
 float TrackType::get_total_length() const
 {
        return get_path_length(-1);