]> git.tdb.fi Git - r2c2.git/blob - source/3d/layout.h
New approach for displaying track state
[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 Object3D;
15 class Utility3D;
16
17 class Layout3D: public sigc::trackable
18 {
19 public:
20         typedef std::map<Object *, Object3D *> ObjectMap;
21
22 private:
23         Layout &layout;
24         Catalogue3D catalogue;
25         ObjectMap objects;
26         std::set<Utility3D *> utilities;
27         Msp::GL::InstanceScene scene;
28         Msp::GL::SimpleScene ep_scene;
29         Msp::GL::InstanceScene path_scene;
30         Msp::GL::Light sun;
31         Msp::GL::Lighting lighting;
32
33 public:
34         Layout3D(Layout &);
35         ~Layout3D();
36
37         Layout &get_layout() const { return layout; }
38         Catalogue3D &get_catalogue() { return catalogue; }
39         const Catalogue3D &get_catalogue() const { return catalogue; }
40         void get_bounds(Vector &, Vector &) const;
41
42         void add(Object3D &);
43         Object3D &get(Object &) const;
44         const ObjectMap &get_all() const { return objects; }
45         void remove(Object3D &);
46
47         template<typename T>
48         T &get(Object &o) const
49         { return dynamic_cast<T &>(get(o)); }
50
51         void add(Utility3D &);
52         void remove(Utility3D &);
53
54         Msp::GL::Scene &get_scene() { return scene; }
55         Msp::GL::Scene &get_endpoint_scene() { return ep_scene; }
56         Msp::GL::Scene &get_path_scene() { return path_scene; }
57         const Msp::GL::Lighting &get_lighting() const { return lighting; }
58
59 private:
60         void object_added(Object &);
61         void object_removed(Object &);
62 };
63
64 } // namespace R2C2
65
66 #endif
67