]> git.tdb.fi Git - r2c2.git/blobdiff - source/libmarklin/tracktype.h
Add a feature to autofit straight runs of track
[r2c2.git] / source / libmarklin / tracktype.h
index 582f77ae25b1a506bbd49b28c6fec8cfea3f57e7..b44374018239060f0dd62be2dbbae4cefc7701c3 100644 (file)
@@ -9,7 +9,7 @@ Distributed under the GPL
 #define LIBMARKLIN_TRACKTYPE_H_
 
 #include <msp/datafile/loader.h>
-#include "endpoint.h"
+#include "geometry.h"
 #include "trackpart.h"
 
 namespace Marklin {
@@ -17,6 +17,15 @@ namespace Marklin {
 class TrackType
 {
 public:
+       struct Endpoint
+       {
+               Point pos;
+               float dir;  // Direction outwards from the endpoint
+               unsigned paths;
+
+               Endpoint(float, float, float, unsigned);
+       };
+
        class Loader: public Msp::DataFile::BasicLoader<TrackType>
        {
        public:
@@ -33,6 +42,7 @@ private:
        std::vector<TrackPart> parts;
        std::vector<Endpoint> endpoints;
        bool double_address;
+       unsigned autofit_preference;
 
 public:
        TrackType(unsigned);
@@ -44,7 +54,9 @@ public:
        unsigned get_paths() const;
        unsigned get_n_paths() const;
        bool is_turnout() const;
+       bool is_dead_end() const;
        bool is_double_address() const { return double_address; }
+       unsigned get_autofit_preference() const { return autofit_preference; }
        const std::vector<TrackPart> &get_parts() const { return parts; }
        const std::vector<Endpoint> &get_endpoints() const { return endpoints; }
        TrackPoint get_point(unsigned, unsigned, float) const;