#define LIBMARKLIN_TRACKTYPE_H_
#include <msp/datafile/loader.h>
-#include "endpoint.h"
+#include "geometry.h"
#include "trackpart.h"
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:
std::string description;
std::vector<TrackPart> parts;
std::vector<Endpoint> endpoints;
+ bool double_address;
+ unsigned autofit_preference;
public:
TrackType(unsigned);
unsigned get_paths() const;
unsigned get_n_paths() const;
bool is_turnout() const;
- bool is_double_address() 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;