]> git.tdb.fi Git - r2c2.git/blobdiff - source/3d/layout.h
New approach for displaying track state
[r2c2.git] / source / 3d / layout.h
index 1e189bd1ce0eedd88a0541672e9d58f60e6f6efc..d5aad2634fbbe2343f4f2d38027347b531957f2b 100644 (file)
 
 namespace R2C2 {
 
-class Signal3D;
-class Track3D;
-class Vehicle3D;
+class Object3D;
+class Utility3D;
 
 class Layout3D: public sigc::trackable
 {
 public:
-       typedef std::map<Track *, Track3D *> TrackMap;
-       typedef std::map<Vehicle *, Vehicle3D *> VehicleMap;
-       typedef std::map<Signal *, Signal3D *> SignalMap;
+       typedef std::map<Object *, Object3D *> ObjectMap;
 
 private:
        Layout &layout;
        Catalogue3D catalogue;
-       TrackMap tracks;
-       VehicleMap vehicles;
-       SignalMap signals;
+       ObjectMap objects;
+       std::set<Utility3D *> utilities;
        Msp::GL::InstanceScene scene;
        Msp::GL::SimpleScene ep_scene;
        Msp::GL::InstanceScene path_scene;
@@ -39,21 +35,21 @@ public:
        ~Layout3D();
 
        Layout &get_layout() const { return layout; }
+       Catalogue3D &get_catalogue() { return catalogue; }
        const Catalogue3D &get_catalogue() const { return catalogue; }
        void get_bounds(Vector &, Vector &) const;
 
-       void add_track(Track3D &);
-       void remove_track(Track3D &);
-       const TrackMap &get_tracks() const { return tracks; }
-       Track3D &get_track(Track &) const;
+       void add(Object3D &);
+       Object3D &get(Object &) const;
+       const ObjectMap &get_all() const { return objects; }
+       void remove(Object3D &);
 
-       void add_vehicle(Vehicle3D &);
-       void remove_vehicle(Vehicle3D &);
-       Vehicle3D &get_vehicle(Vehicle &) const;
+       template<typename T>
+       T &get(Object &o) const
+       { return dynamic_cast<T &>(get(o)); }
 
-       void add_signal(Signal3D &);
-       void remove_signal(Signal3D &);
-       Signal3D &get_signal(Signal &) const;
+       void add(Utility3D &);
+       void remove(Utility3D &);
 
        Msp::GL::Scene &get_scene() { return scene; }
        Msp::GL::Scene &get_endpoint_scene() { return ep_scene; }
@@ -61,12 +57,8 @@ public:
        const Msp::GL::Lighting &get_lighting() const { return lighting; }
 
 private:
-       void track_added(Track &);
-       void track_removed(Track &);
-       void vehicle_added(Vehicle &);
-       void vehicle_removed(Vehicle &);
-       void signal_added(Signal &);
-       void signal_removed(Signal &);
+       void object_added(Object &);
+       void object_removed(Object &);
 };
 
 } // namespace R2C2