]> git.tdb.fi Git - r2c2.git/commitdiff
Forgot to add the new files
authorMikko Rasa <tdb@tdb.fi>
Sun, 7 Mar 2010 10:33:15 +0000 (10:33 +0000)
committerMikko Rasa <tdb@tdb.fi>
Sun, 7 Mar 2010 10:33:15 +0000 (10:33 +0000)
source/3d/object.h [new file with mode: 0644]
source/3d/train.cpp [new file with mode: 0644]
source/3d/train.h [new file with mode: 0644]

diff --git a/source/3d/object.h b/source/3d/object.h
new file mode 100644 (file)
index 0000000..8b9353d
--- /dev/null
@@ -0,0 +1,27 @@
+/* $Id$
+
+This file is part of the MSP Märklin suite
+Copyright © 2010  Mikkosoft Productions, Mikko Rasa
+Distributed under the GPL
+*/
+
+#ifndef MARKLIN3D_OBJECT_H_
+#define MARKLIN3D_OBJECT_H_
+
+#include "libmarklin/geometry.h"
+
+namespace Marklin {
+
+class Object3D
+{
+protected:
+       Object3D() { }
+public:
+       virtual ~Object3D() { }
+
+       virtual Point get_node() const = 0;
+};
+
+} // namespace Marklin
+
+#endif
diff --git a/source/3d/train.cpp b/source/3d/train.cpp
new file mode 100644 (file)
index 0000000..d14225e
--- /dev/null
@@ -0,0 +1,31 @@
+/* $Id$
+
+This file is part of the MSP Märklin suite
+Copyright © 2010  Mikkosoft Productions, Mikko Rasa
+Distributed under the GPL
+*/
+
+#include "layout.h"
+#include "train.h"
+
+namespace Marklin {
+
+Train3D::Train3D(Layout3D &l, const Train &t):
+       layout(l),
+       train(t)
+{
+       layout.add_train(*this);
+}
+
+Train3D::~Train3D()
+{
+       layout.remove_train(*this);
+}
+
+Point Train3D::get_node() const
+{
+       const Point &pos = train.get_position();
+       return Point(pos.x, pos.y, pos.z+0.02);
+}
+
+} // namespace Marklin
diff --git a/source/3d/train.h b/source/3d/train.h
new file mode 100644 (file)
index 0000000..098d344
--- /dev/null
@@ -0,0 +1,35 @@
+/* $Id$
+
+This file is part of the MSP Märklin suite
+Copyright © 2010  Mikkosoft Productions, Mikko Rasa
+Distributed under the GPL
+*/
+
+#ifndef MARKLIN3D_TRAIN_H_
+#define MARKLIN3D_TRAIN_H_
+
+#include "libmarklin/train.h"
+#include "object.h"
+
+namespace Marklin {
+
+class Layout3D;
+
+class Train3D: public Object3D
+{
+private:
+       Layout3D &layout;
+       const Train &train;
+
+public:
+       Train3D(Layout3D &, const Train &);
+       ~Train3D();
+
+       const Train &get_train() const { return train; }
+
+       virtual Point get_node() const;
+};
+
+} // namespace Marklin
+
+#endif