- const map<unsigned, TrackType *> &trks = catalogue.get_tracks();
- for(map<unsigned, TrackType *>::const_iterator i=trks.begin(); i!=trks.end(); ++i)
- tracks[i->second] = new TrackType3D(*this, *i->second);
+ const list<DataFile::CollectionSource *> &src = catalogue.get_sources();
+ for(list<DataFile::CollectionSource *>::const_iterator i=src.begin(); i!=src.end(); ++i)
+ add_source(**i);
+ catalogue.signal_source_added.connect(sigc::mem_fun(static_cast<DataFile::Collection *>(this), &Catalogue3D::add_source));
+
+ set_srgb_conversion(true);
+}
+
+Catalogue3D::~Catalogue3D()
+{
+ for(map<const ObjectType *, ObjectType3D *>::iterator i=objects.begin(); i!=objects.end(); ++i)
+ delete i->second;
+}
+
+const ObjectType3D &Catalogue3D::get_3d(const ObjectType &ot)
+{
+ ObjectMap::iterator i = objects.find(&ot);
+ if(i!=objects.end())
+ return *i->second;
+
+ ObjectType3D *ot3d = 0;
+ if(const TrackType *tt = dynamic_cast<const TrackType *>(&ot))
+ ot3d = new TrackType3D(*this, *tt);
+ else if(const SignalType *st = dynamic_cast<const SignalType *>(&ot))
+ ot3d = new SignalType3D(*this, *st);
+ else if(const VehicleType *vt = dynamic_cast<const VehicleType *>(&ot))
+ ot3d = new VehicleType3D(*this, *vt);
+ else
+ throw key_error(&ot);
+
+ objects[&ot] = ot3d;
+ return *ot3d;
+}
+
+const ObjectType3D &Catalogue3D::get_3d(const ObjectType &ot) const
+{
+ return *get_item(objects, &ot);