update bounding box if the placement of a geometry changes

This commit is contained in:
wmayer
2019-07-02 13:30:52 +02:00
parent 4dff5bb403
commit db28dfbfb1

View File

@@ -185,12 +185,21 @@ void ViewProviderGeometryObject::attach(App::DocumentObject *pcObj)
void ViewProviderGeometryObject::updateData(const App::Property* prop)
{
if (prop->isDerivedFrom(App::PropertyComplexGeoData::getClassTypeId())) {
// Note: When the placement of non-parametric objects changes there is currently no update
// of the bounding box information.
Base::BoundBox3d box = static_cast<const App::PropertyComplexGeoData*>(prop)->getBoundingBox();
pcBoundingBox->minBounds.setValue(box.MinX, box.MinY, box.MinZ);
pcBoundingBox->maxBounds.setValue(box.MaxX, box.MaxY, box.MaxZ);
}
else if (prop->isDerivedFrom(App::PropertyPlacement::getClassTypeId())) {
App::GeoFeature* geometry = dynamic_cast<App::GeoFeature*>(getObject());
if (geometry && prop == &geometry->Placement) {
const App::PropertyComplexGeoData* data = geometry->getPropertyOfGeometry();
if (data) {
Base::BoundBox3d box = data->getBoundingBox();
pcBoundingBox->minBounds.setValue(box.MinX, box.MinY, box.MinZ);
pcBoundingBox->maxBounds.setValue(box.MaxX, box.MaxY, box.MaxZ);
}
}
}
ViewProviderDragger::updateData(prop);
}