*/
#include <msp/gl/meshbuilder.h>
+#include "libmarklin/locotype.h"
#include "catalogue.h"
#include "tracktype.h"
+#include "vehicletype.h"
using namespace std;
using namespace Msp;
endpoint_mesh((GL::NORMAL3, GL::VERTEX3))
{
catalogue.signal_track_added.connect(sigc::mem_fun(this, &Catalogue3D::track_added));
+ catalogue.signal_loco_added.connect(sigc::mem_fun(this, &Catalogue3D::loco_added));
const map<unsigned, TrackType *> &trks = catalogue.get_tracks();
for(map<unsigned, TrackType *>::const_iterator i=trks.begin(); i!=trks.end(); ++i)
return *i->second;
}
+const VehicleType3D &Catalogue3D::get_vehicle(const VehicleType &vt) const
+{
+ map<const VehicleType *, VehicleType3D *>::const_iterator i = vehicles.find(&vt);
+ if(i==vehicles.end())
+ throw KeyError("Unknown vehicle type");
+
+ return *i->second;
+}
+
void Catalogue3D::track_added(const TrackType &track)
{
tracks[&track] = new TrackType3D(*this, track);
}
+void Catalogue3D::loco_added(const LocoType &loco)
+{
+ vehicles[&loco] = new VehicleType3D(*this, loco);
+}
+
void Catalogue3D::build_endpoint_mesh()
{
const Profile &ballast_profile = catalogue.get_ballast_profile();