X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibmarklin%2Ftracktype.h;h=902a2f6ddd561df38ecb1c84dbdfbb0fb3d2c79b;hb=45ec6f645ff2c303700711e96421c75acf33db1a;hp=df6ba022caf6addea2cc3ad511c4153bb98fcffc;hpb=25b79ab38c2be2e5c89b8240504f641fd9c4899c;p=r2c2.git diff --git a/source/libmarklin/tracktype.h b/source/libmarklin/tracktype.h index df6ba02..902a2f6 100644 --- a/source/libmarklin/tracktype.h +++ b/source/libmarklin/tracktype.h @@ -1,8 +1,15 @@ +/* $Id$ + +This file is part of the MSP Märklin suite +Copyright © 2006-2010 Mikkosoft Productions, Mikko Rasa +Distributed under the GPL +*/ + #ifndef LIBMARKLIN_TRACKTYPE_H_ #define LIBMARKLIN_TRACKTYPE_H_ #include -#include "endpoint.h" +#include "geometry.h" #include "trackpart.h" namespace Marklin { @@ -10,26 +17,31 @@ namespace Marklin { class TrackType { public: - class Loader: public Msp::DataFile::Loader + struct Endpoint { - private: - TrackType &ttype; + Point pos; + float dir; // Direction outwards from the endpoint + unsigned paths; + Endpoint(float, float, float, unsigned); + }; + + class Loader: public Msp::DataFile::BasicLoader + { public: Loader(TrackType &); - TrackType &get_object() { return ttype; } private: virtual void finish(); - void part(); void position(float, float, float); }; private: - unsigned art_nr; - std::string description; + unsigned art_nr; + std::string description; std::vector parts; std::vector endpoints; + bool double_address; public: TrackType(unsigned); @@ -37,13 +49,18 @@ public: unsigned get_article_number() const { return art_nr; } const std::string &get_description() const { return description; } float get_total_length() const; - float get_route_length(int) const; - unsigned get_n_routes() const; + float get_path_length(int) const; + unsigned get_paths() const; + unsigned get_n_paths() const; + bool is_turnout() const; + bool is_dead_end() const; + bool is_double_address() const { return double_address; } const std::vector &get_parts() const { return parts; } - const std::vector &get_endpoints() const { return endpoints; } + const std::vector &get_endpoints() const { return endpoints; } + TrackPoint get_point(unsigned, unsigned, float) const; private: - void collect_endpoints(); + void collect_endpoints(); }; } // namespace Marklin