1 #ifndef LIBR2C2_TRACKTYPE_H_
2 #define LIBR2C2_TRACKTYPE_H_
4 #include <msp/datafile/objectloader.h>
5 #include "articlenumber.h"
17 float dir; // Direction outwards from the endpoint
20 Endpoint(float, float, float, unsigned);
23 class Loader: public Msp::DataFile::ObjectLoader<TrackType>
31 virtual void finish();
33 void position(float, float, float);
34 void state_bits(unsigned);
39 std::string description;
40 std::vector<TrackPart> parts;
41 std::vector<Endpoint> endpoints;
43 unsigned autofit_preference;
47 TrackType(const ArticleNumber &);
49 const ArticleNumber &get_article_number() const { return art_nr; }
50 const std::string &get_description() const { return description; }
51 float get_total_length() const;
52 float get_path_length(int) const;
53 unsigned get_paths() const;
54 unsigned get_n_paths() const;
55 unsigned get_state_bits() const { return state_bits; }
56 bool is_turnout() const;
57 bool is_dead_end() const;
58 unsigned get_autofit_preference() const { return autofit_preference; }
59 const std::string &get_object() const { return object; }
60 const std::vector<TrackPart> &get_parts() const { return parts; }
61 const std::vector<Endpoint> &get_endpoints() const { return endpoints; }
62 const Endpoint &get_endpoint(unsigned) const;
63 TrackPoint get_point(unsigned, unsigned, float) const;
64 TrackPoint get_nearest_point(const Vector &) const;
65 bool collide_ray(const Vector &, const Vector &, float) const;
68 void collect_endpoints();