]> git.tdb.fi Git - r2c2.git/blob - source/libr2c2/catalogue.h
Render tracks through GL::Objects
[r2c2.git] / source / libr2c2 / catalogue.h
1 /* $Id$
2
3 This file is part of R²C²
4 Copyright © 2006-2010  Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #ifndef LIBR2C2_CATALOGUE_H_
9 #define LIBR2C2_CATALOGUE_H_
10
11 #include <map>
12 #include <msp/datafile/loader.h>
13 #include "articlenumber.h"
14 #include "layout.h"
15 #include "profile.h"
16
17 namespace R2C2 {
18
19 class TrackType;
20 class VehicleType;
21
22 class Catalogue
23 {
24 public:
25         class Loader: public Msp::DataFile::BasicLoader<Catalogue>
26         {
27         public:
28                 Loader(Catalogue &);
29         private:
30                 void ballast_profile();
31                 void gauge(float);
32                 void layout();
33                 void rail_profile();
34                 void scale(float, float);
35                 void track(unsigned);
36                 void track(ArticleNumber);
37                 void vehicle(unsigned);
38                 void vehicle(ArticleNumber);
39         };
40
41         typedef std::map<ArticleNumber, TrackType *> TrackMap;
42         typedef std::map<ArticleNumber, VehicleType *> VehicleMap;
43
44         sigc::signal<void, const TrackType &> signal_track_added;
45         sigc::signal<void, const VehicleType &> signal_vehicle_added;
46
47 private:
48         float scale;
49         float gauge;
50         Profile rail_profile;
51         Profile ballast_profile;
52         Profile path_profile;
53         std::string track_technique;
54         TrackMap tracks;
55         VehicleMap vehicles;
56         Layout layout;
57
58 public:
59         Catalogue();
60         ~Catalogue();
61
62         float get_scale() const { return scale; }
63         float get_gauge() const { return gauge; }
64         float get_rail_elevation() const;
65         const Profile &get_rail_profile() const { return rail_profile; }
66         const Profile &get_ballast_profile() const { return ballast_profile; }
67         const Profile &get_path_profile() const { return path_profile; }
68         const std::string &get_track_technique() const { return track_technique; }
69
70         void add_track(TrackType &);
71         const TrackType &get_track(const ArticleNumber &) const;
72         const TrackMap &get_tracks() const { return tracks; }
73
74         void add_vehicle(VehicleType &);
75         const VehicleType &get_vehicle(const ArticleNumber &) const;
76         const VehicleMap &get_vehicles() const { return vehicles; }
77
78         Layout &get_layout() { return layout; }
79 };
80
81 } // namespace R2C2
82
83 #endif