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