X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Fdesigner%2Ftrackwrap.cpp;h=1f620f3ff6be452e5c1ac617ab2e0fe06b64039a;hb=d15ac13f2e170f155b4bbd124df48400c339b644;hp=febeadee4412c0b64db6cdee9078aef4fbe9c9bb;hpb=897f9bae5f647bae43e9786796eb9ea18325ec17;p=r2c2.git diff --git a/source/designer/trackwrap.cpp b/source/designer/trackwrap.cpp index febeade..1f620f3 100644 --- a/source/designer/trackwrap.cpp +++ b/source/designer/trackwrap.cpp @@ -1,34 +1,32 @@ -/* $Id$ - -This file is part of the MSP Märklin suite -Copyright © 2010 Mikkosoft Productions, Mikko Rasa -Distributed under the GPL -*/ - #include #include #include "3d/tracktype.h" -#include "designer.h" #include "selection.h" #include "trackwrap.h" using namespace std; using namespace Msp; -using namespace Marklin; +using namespace R2C2; -TrackWrap::TrackWrap(Designer &d, Selection &s): - designer(d), +TrackWrap::TrackWrap(Layout3D &l, Selection &s): + layout(l), selection(s) { selection.signal_changed.connect(sigc::mem_fun(this, &TrackWrap::selection_changed)); } +TrackWrap::~TrackWrap() +{ + for(map::iterator i=meshes.begin(); i!=meshes.end(); ++i) + delete i->second; +} + void TrackWrap::render(const GL::Tag &) const { for(list::const_iterator i=wraps.begin(); i!=wraps.end(); ++i) { GL::PushMatrix _pushm; - const Point &pos = i->track->get_position(); + const Vector &pos = i->track->get_position(); GL::translate(pos.x, pos.y, pos.z); GL::rotate(i->track->get_rotation()*180/M_PI, 0, 0, 1); i->mesh->draw(); @@ -54,16 +52,16 @@ GL::Mesh &TrackWrap::get_mesh(const TrackType &type) if(j!=meshes.end()) return *j->second; - const TrackType3D &type3d = designer.get_layout_3d()->get_catalogue().get_track(type); + const TrackType3D &type3d = layout.get_catalogue().get_track(type); float min_area = -1; - float angle; - Point center; - float width; - float height; + float angle = 0; + Vector center; + float width = 0; + float height = 0; for(float a=0; a