X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Fcatalogue.h;fp=source%2Flibr2c2%2Fcatalogue.h;h=c8b006ab42820b8b7b786e3ca494292fed7874a3;hb=1ff06c5bc46a677fa389ef86c6b26664368f1653;hp=0000000000000000000000000000000000000000;hpb=9b05c573a38639827697fe393d55b7c76f5bde45;p=r2c2.git diff --git a/source/libr2c2/catalogue.h b/source/libr2c2/catalogue.h new file mode 100644 index 0000000..c8b006a --- /dev/null +++ b/source/libr2c2/catalogue.h @@ -0,0 +1,81 @@ +/* $Id$ + +This file is part of R²C² +Copyright © 2006-2010 Mikkosoft Productions, Mikko Rasa +Distributed under the GPL +*/ + +#ifndef LIBR2C2_CATALOGUE_H_ +#define LIBR2C2_CATALOGUE_H_ + +#include +#include +#include "articlenumber.h" +#include "layout.h" +#include "profile.h" + +namespace R2C2 { + +class TrackType; +class VehicleType; + +class Catalogue +{ +public: + class Loader: public Msp::DataFile::BasicLoader + { + public: + Loader(Catalogue &); + private: + void ballast_profile(); + void gauge(float); + void layout(); + void rail_profile(); + void scale(float, float); + void track(unsigned); + void track(ArticleNumber); + void vehicle(unsigned); + void vehicle(ArticleNumber); + }; + + typedef std::map TrackMap; + typedef std::map VehicleMap; + + sigc::signal signal_track_added; + sigc::signal signal_vehicle_added; + +private: + float scale; + float gauge; + Profile rail_profile; + Profile ballast_profile; + Profile path_profile; + TrackMap tracks; + VehicleMap vehicles; + Layout layout; + +public: + Catalogue(); + ~Catalogue(); + + float get_scale() const { return scale; } + float get_gauge() const { return gauge; } + float get_rail_elevation() const; + const Profile &get_rail_profile() const { return rail_profile; } + const Profile &get_ballast_profile() const { return ballast_profile; } + const Profile &get_path_profile() const { return path_profile; } + + void add_track(TrackType &); + const TrackType &get_track(const ArticleNumber &) const; + const TrackMap &get_tracks() const { return tracks; } + + void add_vehicle(VehicleType &); + const VehicleType &get_vehicle(const ArticleNumber &) const; + const VehicleMap &get_vehicles() const { return vehicles; } + + Layout &get_layout() { return layout; } +}; + +} // namespace R2C2 + +#endif