X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibmarklin%2Ftrackpart.h;h=13e0f38528c86e94046e7dc2b03d8f71857e5931;hb=f4ffb776aa0d4f51c058d27fb0f51449c05302c3;hp=5aa4b0c8b0a487084ba310c37341a21ed34b0c6c;hpb=3e9c210ddc036cd015228504cc0803c909e27f84;p=r2c2.git diff --git a/source/libmarklin/trackpart.h b/source/libmarklin/trackpart.h index 5aa4b0c..13e0f38 100644 --- a/source/libmarklin/trackpart.h +++ b/source/libmarklin/trackpart.h @@ -1,7 +1,7 @@ /* $Id$ This file is part of the MSP Märklin suite -Copyright © 2006-2008 Mikkosoft Productions, Mikko Rasa +Copyright © 2006-2010 Mikkosoft Productions, Mikko Rasa Distributed under the GPL */ @@ -9,36 +9,41 @@ Distributed under the GPL #define MARKLIN_TRACKPART_H_ #include -#include "endpoint.h" +#include "geometry.h" namespace Marklin { -struct TrackPart +class TrackPart { - class Loader: public Msp::DataFile::Loader +public: + class Loader: public Msp::DataFile::BasicLoader { - private: - TrackPart ∂ - public: Loader(TrackPart &); - TrackPart &get_object() { return part; } private: virtual void finish(); - void start(float, float, float); }; - float x, y; - float dir; - float length; - float radius; - unsigned route; - bool dead_end; +private: + Point pos; + float dir; + float length; + float radius; + unsigned path; + bool dead_end; + TrackPart *links[2]; +public: TrackPart(); - void collect_endpoints(std::vector &); + float get_length() const; + bool is_curved() const { return radius; } + TrackPoint get_point(float) const; + unsigned get_path() const { return path; } + bool is_dead_end() const { return dead_end; } + void check_link(TrackPart &); + TrackPart *get_link(unsigned) const; }; } // namespace Marklin