]> git.tdb.fi Git - r2c2.git/blob - source/3d/layout.h
Add basic support for signals
[r2c2.git] / source / 3d / layout.h
1 #ifndef R2C2_3D_LAYOUT_H_
2 #define R2C2_3D_LAYOUT_H_
3
4 #include <sigc++/trackable.h>
5 #include <msp/gl/instancescene.h>
6 #include <msp/gl/light.h>
7 #include <msp/gl/lighting.h>
8 #include <msp/gl/simplescene.h>
9 #include "libr2c2/layout.h"
10 #include "catalogue.h"
11
12 namespace R2C2 {
13
14 class Signal3D;
15 class Track3D;
16 class Vehicle3D;
17
18 class Layout3D: public sigc::trackable
19 {
20 public:
21         typedef std::map<Track *, Track3D *> TrackMap;
22         typedef std::map<Vehicle *, Vehicle3D *> VehicleMap;
23         typedef std::map<Signal *, Signal3D *> SignalMap;
24
25 private:
26         Layout &layout;
27         Catalogue3D catalogue;
28         TrackMap tracks;
29         VehicleMap vehicles;
30         SignalMap signals;
31         Msp::GL::InstanceScene scene;
32         Msp::GL::SimpleScene ep_scene;
33         Msp::GL::InstanceScene path_scene;
34         Msp::GL::Light sun;
35         Msp::GL::Lighting lighting;
36
37 public:
38         Layout3D(Layout &);
39         ~Layout3D();
40
41         Layout &get_layout() const { return layout; }
42         const Catalogue3D &get_catalogue() const { return catalogue; }
43         void get_bounds(Vector &, Vector &) const;
44
45         void add_track(Track3D &);
46         void remove_track(Track3D &);
47         const TrackMap &get_tracks() const { return tracks; }
48         Track3D &get_track(Track &) const;
49
50         void add_vehicle(Vehicle3D &);
51         void remove_vehicle(Vehicle3D &);
52         Vehicle3D &get_vehicle(Vehicle &) const;
53
54         void add_signal(Signal3D &);
55         void remove_signal(Signal3D &);
56         Signal3D &get_signal(Signal &) const;
57
58         Msp::GL::Scene &get_scene() { return scene; }
59         Msp::GL::Scene &get_endpoint_scene() { return ep_scene; }
60         Msp::GL::Scene &get_path_scene() { return path_scene; }
61         const Msp::GL::Lighting &get_lighting() const { return lighting; }
62
63 private:
64         void track_added(Track &);
65         void track_removed(Track &);
66         void vehicle_added(Vehicle &);
67         void vehicle_removed(Vehicle &);
68         void signal_added(Signal &);
69         void signal_removed(Signal &);
70 };
71
72 } // namespace R2C2
73
74 #endif
75