]> git.tdb.fi Git - r2c2.git/blob - source/3d/layout.h
Make Route hold non-const Tracks to match Block
[r2c2.git] / source / 3d / layout.h
1 /* $Id$
2
3 This file is part of the MSP Märklin suite
4 Copyright © 2006-2010 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #ifndef MARKLIN3D_LAYOUT_H_
9 #define MARKLIN3D_LAYOUT_H_
10
11 #include <sigc++/trackable.h>
12 #include <msp/gl/scene.h>
13 #include "libmarklin/layout.h"
14 #include "catalogue.h"
15
16 namespace Marklin {
17
18 class Track3D;
19 class Vehicle3D;
20
21 class Layout3D: public sigc::trackable
22 {
23 private:
24         Layout &layout;
25         Catalogue3D catalogue;
26         std::list<Track3D *> tracks;
27         std::list<Vehicle3D *> vehicles;
28         Msp::GL::Scene scene;
29         Msp::GL::Scene ep_scene;
30         Msp::GL::Scene path_scene;
31
32 public:
33         Layout3D(Layout &);
34         ~Layout3D();
35
36         const Catalogue3D &get_catalogue() const { return catalogue; }
37
38         void add_track(Track3D &);
39         void remove_track(Track3D &);
40         const std::list<Track3D *> &get_tracks() const { return tracks; }
41         Track3D &get_track(Track &) const;
42         Track3D *pick_track(float, float, float) const;
43
44         void add_vehicle(Vehicle3D &);
45         void remove_vehicle(Vehicle3D &);
46         Vehicle3D &get_vehicle(const Vehicle &) const;
47
48         Msp::GL::Scene &get_scene() { return scene; }
49         Msp::GL::Scene &get_endpoint_scene() { return ep_scene; }
50         Msp::GL::Scene &get_path_scene() { return path_scene; }
51
52 private:
53         void track_added(Track &);
54         void track_removed(Track &);
55         void vehicle_added(Vehicle &);
56 };
57
58 } // namespace Marklin
59
60 #endif
61