]> git.tdb.fi Git - r2c2.git/blob - source/3d/catalogue.h
Add basic support for signals
[r2c2.git] / source / 3d / catalogue.h
1 #ifndef R2C2_3D_CATALOGUE_H_
2 #define R2C2_3D_CATALOGUE_H_
3
4 #include <msp/datafile/collection.h>
5 #include <msp/fs/path.h>
6 #include <msp/gl/material.h>
7 #include <msp/gl/mesh.h>
8 #include "libr2c2/catalogue.h"
9
10 namespace R2C2 {
11
12 class SignalType3D;
13 class TrackType3D;
14 class VehicleType3D;
15
16 class Catalogue3D: public Msp::DataFile::Collection
17 {
18 private:
19         Catalogue &catalogue;
20         std::map<const TrackType *, TrackType3D *> tracks;
21         std::map<const VehicleType *, VehicleType3D *> vehicles;
22         std::map<const SignalType *, SignalType3D *> signals;
23         Msp::GL::Mesh endpoint_mesh;
24
25 public:
26         Catalogue3D(Catalogue &);
27         ~Catalogue3D();
28
29         const Catalogue &get_catalogue() const { return catalogue; }
30         const TrackType3D &get_track(const TrackType &) const;
31         const VehicleType3D &get_vehicle(const VehicleType &) const;
32         const SignalType3D &get_signal(const SignalType &) const;
33         const Msp::GL::Mesh &get_endpoint_mesh() const { return endpoint_mesh; }
34 private:
35         void track_added(const TrackType &);
36         void vehicle_added(const VehicleType &);
37         void signal_added(const SignalType &);
38         void build_endpoint_mesh();
39
40         Msp::FS::Path locate_file(const std::string &);
41
42         template<typename T>
43         T *create(const std::string &);
44
45         template<typename T>
46         T *create2(const std::string &);
47 };
48
49 }
50
51 #endif