X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Ftracktype.h;h=181cb21d4f8be4cf70559329df53c081807e4872;hb=59b3cebecfd8f1462c95bab447be70dfb5f38e92;hp=1b1c78ce998de86b736d252774643bce2346bfba;hpb=64340dad429ba4040538fc06b6882aabdb489925;p=r2c2.git diff --git a/source/libr2c2/tracktype.h b/source/libr2c2/tracktype.h index 1b1c78c..181cb21 100644 --- a/source/libr2c2/tracktype.h +++ b/source/libr2c2/tracktype.h @@ -4,23 +4,27 @@ #include #include "articlenumber.h" #include "geometry.h" +#include "objecttype.h" #include "trackpart.h" namespace R2C2 { -class TrackType +class TrackType: public ObjectType { public: struct Endpoint { Vector pos; - float dir; // Direction outwards from the endpoint + Angle dir; // Direction outwards from the endpoint unsigned paths; - Endpoint(float, float, float, unsigned); + Endpoint(float, float, const Angle &, unsigned); + + bool has_path(unsigned p) const { return paths&(1< + class Loader: public Msp::DataFile::DerivedObjectLoader { private: bool state_bits_set; @@ -35,8 +39,6 @@ public: }; private: - ArticleNumber art_nr; - std::string description; std::vector parts; std::vector endpoints; unsigned state_bits; @@ -46,8 +48,6 @@ private: public: TrackType(const ArticleNumber &); - const ArticleNumber &get_article_number() const { return art_nr; } - const std::string &get_description() const { return description; } float get_total_length() const; float get_path_length(int) const; unsigned get_paths() const; @@ -60,8 +60,8 @@ public: const std::vector &get_parts() const { return parts; } const std::vector &get_endpoints() const { return endpoints; } const Endpoint &get_endpoint(unsigned) const; - TrackPoint get_point(unsigned, unsigned, float) const; - bool collide_ray(const Vector &, const Vector &, float) const; + OrientedPoint get_point(unsigned, unsigned, float) const; + OrientedPoint get_nearest_point(const Vector &) const; private: void collect_endpoints();