3 This file is part of R²C²
4 Copyright © 2006-2011 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;
54 TrackType(const ArticleNumber &);
56 const ArticleNumber &get_article_number() const { return art_nr; }
57 const std::string &get_description() const { return description; }
58 float get_total_length() const;
59 float get_path_length(int) const;
60 unsigned get_paths() const;
61 unsigned get_n_paths() const;
62 unsigned get_state_bits() const { return state_bits; }
63 bool is_turnout() const;
64 bool is_dead_end() const;
65 unsigned get_autofit_preference() const { return autofit_preference; }
66 const std::string &get_object() const { return object; }
67 const std::vector<TrackPart> &get_parts() const { return parts; }
68 const std::vector<Endpoint> &get_endpoints() const { return endpoints; }
69 const Endpoint &get_endpoint(unsigned) const;
70 TrackPoint get_point(unsigned, unsigned, float) const;
71 bool collide_ray(const Vector &, const Vector &, float) const;
74 void collect_endpoints();