3 This file is part of R²C²
4 Copyright © 2006-2010 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
8 #ifndef LIBR2C2_TRACKTYPE_H_
9 #define LIBR2C2_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>
38 virtual void finish();
40 void position(float, float, float);
41 void state_bits(unsigned);
46 std::string description;
47 std::vector<TrackPart> parts;
48 std::vector<Endpoint> endpoints;
50 unsigned autofit_preference;
53 TrackType(const ArticleNumber &);
55 const ArticleNumber &get_article_number() const { return art_nr; }
56 const std::string &get_description() const { return description; }
57 float get_total_length() const;
58 float get_path_length(int) const;
59 unsigned get_paths() const;
60 unsigned get_n_paths() const;
61 unsigned get_state_bits() const { return state_bits; }
62 bool is_turnout() const;
63 bool is_dead_end() const;
64 unsigned get_autofit_preference() const { return autofit_preference; }
65 const std::vector<TrackPart> &get_parts() const { return parts; }
66 const std::vector<Endpoint> &get_endpoints() const { return endpoints; }
67 const Endpoint &get_endpoint(unsigned) const;
68 TrackPoint get_point(unsigned, unsigned, float) const;
71 void collect_endpoints();