/* $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
*/
#define LIBMARKLIN_TRACKTYPE_H_
#include <msp/datafile/loader.h>
-#include "endpoint.h"
+#include "geometry.h"
#include "trackpart.h"
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<TrackType>
+ {
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<TrackPart> parts;
std::vector<Endpoint> endpoints;
+ bool double_address;
+ unsigned autofit_preference;
public:
TrackType(unsigned);
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; }
+ unsigned get_autofit_preference() const { return autofit_preference; }
const std::vector<TrackPart> &get_parts() const { return parts; }
- const std::vector<Endpoint> &get_endpoints() const { return endpoints; }
+ const std::vector<Endpoint> &get_endpoints() const { return endpoints; }
+ TrackPoint get_point(unsigned, unsigned, float) const;
private:
- void collect_endpoints();
+ void collect_endpoints();
};
} // namespace Marklin