]> git.tdb.fi Git - r2c2.git/blobdiff - source/designer/trackwrap.h
Separate track wrap to its own class
[r2c2.git] / source / designer / trackwrap.h
diff --git a/source/designer/trackwrap.h b/source/designer/trackwrap.h
new file mode 100644 (file)
index 0000000..09bacda
--- /dev/null
@@ -0,0 +1,42 @@
+/* $Id$
+
+This file is part of the MSP Märklin suite
+Copyright © 2010  Mikkosoft Productions, Mikko Rasa
+Distributed under the GPL
+*/
+
+#ifndef TRACKWRAP_H_
+#define TRACKWRAP_H_
+
+#include <msp/gl/mesh.h>
+#include <msp/gl/renderable.h>
+#include "libmarklin/track.h"
+
+class Designer;
+class Selection;
+
+class TrackWrap: public Msp::GL::Renderable
+{
+private:
+       struct Wrap
+       {
+               Marklin::Track *track;
+               Msp::GL::Mesh *mesh;
+       };
+
+       Designer &designer;
+       Selection &selection;
+       std::map<const Marklin::TrackType *, Msp::GL::Mesh *> meshes;
+       std::list<Wrap> wraps;
+
+public:
+       TrackWrap(Designer &, Selection &);
+
+       virtual void render(const Msp::GL::Tag &) const;
+
+private:
+       void selection_changed();
+       Msp::GL::Mesh &get_mesh(const Marklin::TrackType &);
+};
+
+#endif