3 This file is part of the MSP Märklin suite
4 Copyright © 2006-2010 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
8 #ifndef LIBMARKLIN_TRACKTYPE_H_
9 #define LIBMARKLIN_TRACKTYPE_H_
11 #include <msp/datafile/loader.h>
12 #include "articlenumber.h"
14 #include "trackpart.h"
24 float dir; // Direction outwards from the endpoint
27 Endpoint(float, float, float, unsigned);
30 class Loader: public Msp::DataFile::BasicLoader<TrackType>
35 virtual void finish();
37 void position(float, float, float);
42 std::string description;
43 std::vector<TrackPart> parts;
44 std::vector<Endpoint> endpoints;
46 unsigned autofit_preference;
49 TrackType(const ArticleNumber &);
51 const ArticleNumber &get_article_number() const { return art_nr; }
52 const std::string &get_description() const { return description; }
53 float get_total_length() const;
54 float get_path_length(int) const;
55 unsigned get_paths() const;
56 unsigned get_n_paths() const;
57 bool is_turnout() const;
58 bool is_dead_end() const;
59 bool is_double_address() const { return double_address; }
60 unsigned get_autofit_preference() const { return autofit_preference; }
61 const std::vector<TrackPart> &get_parts() const { return parts; }
62 const std::vector<Endpoint> &get_endpoints() const { return endpoints; }
63 const Endpoint &get_endpoint(unsigned) const;
64 TrackPoint get_point(unsigned, unsigned, float) const;
67 void collect_endpoints();
70 } // namespace Marklin