X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fdesigner%2Fmanipulator.cpp;h=2ee967679428ebdf1595b74669128a194b31291a;hb=51d3c122fb489f9e3f00060f885f00c1fae7ceb5;hp=8620fe7af8a6a53e8c0a43fd960d509805fa736f;hpb=7a36d396eded897c421424905b2c938d770df341;p=r2c2.git diff --git a/source/designer/manipulator.cpp b/source/designer/manipulator.cpp index 8620fe7..2ee9676 100644 --- a/source/designer/manipulator.cpp +++ b/source/designer/manipulator.cpp @@ -504,38 +504,12 @@ void Manipulator::selection_changed() void Manipulator::update_objects() { - Vector minp, maxp; + Geometry::BoundingBox bbox; for(vector::iterator i=objects.begin(); i!=objects.end(); ++i) - { - // XXX Use generic bounding box when it is implemented - if(Track *track = dynamic_cast(i->object)) - { - unsigned n_endpoints = track->get_type().get_endpoints().size(); - for(unsigned j=0; jget_snap_node(j).position; - if(i==objects.begin() && j==0) - minp = maxp = p; - else - { - minp.x = min(minp.x, p.x); - maxp.x = max(maxp.x, p.x); - minp.y = min(minp.y, p.y); - maxp.y = max(maxp.y, p.y); - minp.z = min(minp.z, p.z); - } - } - } - else - { - const Vector &p = i->object->get_position(); - minp.x = min(minp.x, p.x); - maxp.x = max(maxp.x, p.x); - minp.y = min(minp.y, p.y); - maxp.y = max(maxp.y, p.y); - minp.z = min(minp.z, p.z); - } - } + bbox = bbox|i->object->get_bounding_box(); + + const Vector &minp = bbox.get_minimum_point(); + const Vector &maxp = bbox.get_maximum_point(); center = (minp+maxp)/2.0f; center.z = minp.z;