X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Ftracktype.h;h=da0df71428f3514129f953f404133da3b6526dc8;hb=dda1e6c8716b6ac70d63a3f6ff95474a8b8b7336;hp=f285036f905b236c8ac894e6022d1961e195ca5f;hpb=f8a7788cee0261babfc4c804a58515aad6dfbc3d;p=r2c2.git diff --git a/source/libr2c2/tracktype.h b/source/libr2c2/tracktype.h index f285036..da0df71 100644 --- a/source/libr2c2/tracktype.h +++ b/source/libr2c2/tracktype.h @@ -1,33 +1,30 @@ -/* $Id$ - -This file is part of R²C² -Copyright © 2006-2010 Mikkosoft Productions, Mikko Rasa -Distributed under the GPL -*/ - #ifndef LIBR2C2_TRACKTYPE_H_ #define LIBR2C2_TRACKTYPE_H_ -#include +#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; @@ -42,8 +39,6 @@ public: }; private: - ArticleNumber art_nr; - std::string description; std::vector parts; std::vector endpoints; unsigned state_bits; @@ -53,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; @@ -68,6 +61,7 @@ public: const std::vector &get_endpoints() const { return endpoints; } const Endpoint &get_endpoint(unsigned) const; TrackPoint get_point(unsigned, unsigned, float) const; + TrackPoint get_nearest_point(const Vector &) const; private: void collect_endpoints();