add_type<SignalType>();
add_type<VehicleType>();
add_type<TerrainType>();
+ add_type<TrackAppearance>().keyword("track_appearance");
}
add("signal", &Loader::signal);
add("terrain", &Loader::terrain);
add("track", &Loader::track);
- add("track_appearance", &Loader::track_appearance);
add("vehicle", &Loader::vehicle);
}
void Catalogue::Loader::track(const string &n)
{
- RefPtr<TrackType> trk = new TrackType(n, &cat.appearance);
- load_sub(*trk);
+ RefPtr<TrackType> trk = new TrackType(n);
+ load_sub(*trk, cat);
cat.add(n, trk.get());
trk.release();
}
-void Catalogue::Loader::track_appearance()
-{
- load_sub(cat.appearance);
-}
-
void Catalogue::Loader::vehicle(const string &n)
{
RefPtr<VehicleType> veh = new VehicleType(n);
#include <cmath>
+#include <msp/datafile/collection.h>
#include <msp/geometry/union.h>
#include "trackappearance.h"
#include "tracktype.h"
namespace R2C2 {
-TrackType::TrackType(const ArticleNumber &an, const TrackAppearance *ta):
+TrackType::TrackType(const ArticleNumber &an):
ObjectType(an),
- appearance(ta),
+ appearance(0),
state_bits(0),
autofit_preference(1)
{ }
{ }
-TrackType::Loader::Loader(TrackType &t):
+TrackType::Loader::Loader(TrackType &t, Collection &c):
DataFile::DerivedObjectLoader<TrackType, ObjectType::Loader>(t),
+ coll(c),
state_bits_set(false)
{
+ add("appearance", &TrackType::appearance);
add("autofit_preference", &TrackType::autofit_preference);
add("object", &TrackType::object);
add("state_bits", &Loader::state_bits);
class Loader: public Msp::DataFile::DerivedObjectLoader<TrackType, ObjectType::Loader>
{
+ public:
+ typedef Msp::DataFile::Collection Collection;
+
private:
+ Collection &coll;
bool state_bits_set;
public:
- Loader(TrackType &);
+ Loader(TrackType &, Collection &);
+
+ virtual Collection &get_collection() const { return coll; }
private:
virtual void finish();
+ void appearance(const std::string &);
void part();
void position(float, float, float);
void state_bits(unsigned);
std::string object;
public:
- TrackType(const ArticleNumber & = ArticleNumber(), const TrackAppearance * = 0);
+ TrackType(const ArticleNumber & = ArticleNumber());
const TrackAppearance &get_appearance() const;
float get_gauge() const;
scale 1 87;
-track_appearance
+track_appearance "C"
{
gauge 16.5;
rail_profile
track "24064"
{
+ appearance "C";
description "Straight, 64.3mm (R3-R4-R5)";
part
{
track "24071"
{
+ appearance "C";
description "Straight, 70.8mm (for slim turnouts)";
part
{
track "24077"
{
+ appearance "C";
description "Straight, 77.5mm (R1-R2-R3)";
part
{
track "24094"
{
+ appearance "C";
description "Straight, 94.2mm";
part
{
track "24172"
{
+ appearance "C";
description "Straight, 171.7mm";
part
{
track "24188"
{
+ appearance "C";
description "Straight, 188.3mm (turnout length)";
part
{
track "24229"
{
+ appearance "C";
description "Straight, 229.3mm";
part
{
track "24236"
{
+ appearance "C";
description "Straight, 236.1mm (slim turnout length)";
part
{
track "24360"
{
+ appearance "C";
description "Straight, 360mm";
part
{
track "24107"
{
+ appearance "C";
description "Curve, R1 = 360mm, 7.5°";
part
{
track "24115"
{
+ appearance "C";
description "Curve, R1 = 360mm, 15°";
part
{
track "24130"
{
+ appearance "C";
description "Curve, R1 = 360mm, 30°";
part
{
track "24206"
{
+ appearance "C";
description "Curve, R2 = 437.5mm, 5.7° (turnout to 30°)";
part
{
track "24207"
{
+ appearance "C";
description "Curve, R2 = 437.5mm, 7.5°";
part
{
track "24215"
{
+ appearance "C";
description "Curve, R2 = 437.5mm, 15°";
part
{
track "24224"
{
+ appearance "C";
description "Curve, R2 = 437.5mm, 24.3° (turnout)";
part
{
track "24230"
{
+ appearance "C";
description "Curve, R2 = 437.5mm, 30°";
part
{
track "24330"
{
+ appearance "C";
description "Curve, R3 = 515mm, 30°";
part
{
track "24430"
{
+ appearance "C";
description "Curve, R4 = 579.3mm, 30°";
part
{
track "24530"
{
+ appearance "C";
description "Curve, R5 = 643.6mm, 30°";
part
{
track "24912"
{
+ appearance "C";
description "Curve, R = 1114.6mm, 12.1° (slim turnout)";
part
{
track "24671"
{
+ appearance "C";
description "Curved turnout, left";
part
{
track "24672"
{
+ appearance "C";
description "Curved turnout, right";
part
{
track "24611"
{
+ appearance "C";
description "Turnout, left";
part
{
track "24612"
{
+ appearance "C";
description "Turnout, right";
part
{
track "24630"
{
+ appearance "C";
description "Turnout, 3-way";
part
{
track "24624"
{
+ appearance "C";
description "Turnout, double slip";
state_bits 1;
part
track "24711"
{
+ appearance "C";
description "Slim turnout, left";
part
{
track "24712"
{
+ appearance "C";
description "Slim turnout, right";
part
{
track "24640"
{
+ appearance "C";
description "Crossing, 24.3°";
part
{
track "24649"
{
+ appearance "C";
description "Crossing, 48.6°";
part
{
track "24740"
{
+ appearance "C";
description "Slim crossing, 12.1°";
part
{
track "24977"
{
+ appearance "C";
description "Bumper";
object "bumper.object";
part