X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Ftrackpart.h;h=97e76349d138e769c96f23d34cf0dd268121f8a2;hb=5ec71ac8d091bb70e70528138bba9edaccc7f55d;hp=0a07b4d0df857fabb90679e45f0582a05f4fb74d;hpb=1ff06c5bc46a677fa389ef86c6b26664368f1653;p=r2c2.git diff --git a/source/libr2c2/trackpart.h b/source/libr2c2/trackpart.h index 0a07b4d..97e7634 100644 --- a/source/libr2c2/trackpart.h +++ b/source/libr2c2/trackpart.h @@ -1,14 +1,7 @@ -/* $Id$ - -This file is part of R²C² -Copyright © 2006-2010 Mikkosoft Productions, Mikko Rasa -Distributed under the GPL -*/ - #ifndef LIBR2C2_TRACKPART_H_ #define LIBR2C2_TRACKPART_H_ -#include +#include #include "geometry.h" namespace R2C2 { @@ -16,7 +9,7 @@ namespace R2C2 { class TrackPart { public: - class Loader: public Msp::DataFile::BasicLoader + class Loader: public Msp::DataFile::ObjectLoader { public: Loader(TrackPart &); @@ -26,24 +19,30 @@ public: }; private: - Point pos; - float dir; + Vector pos; + Angle dir; float length; float radius; unsigned path; bool dead_end; TrackPart *links[2]; + Shape *shape; + Transform transform; public: TrackPart(); + ~TrackPart(); float get_length() const; bool is_curved() const { return radius; } - TrackPoint get_point(float) const; + OrientedPoint get_point(float) const; + OrientedPoint get_nearest_point(const Vector &) const; unsigned get_path() const { return path; } bool is_dead_end() const { return dead_end; } void check_link(TrackPart &); TrackPart *get_link(unsigned) const; + void create_shape(); + const Shape &get_shape() const { return *shape; } }; } // namespace R2C2