Gui: [skip ci] add method to get bounding boxes of the fixed and movable groups of manual alignment

This commit is contained in:
wmayer
2020-01-17 23:00:26 +01:00
parent 298b1d49ac
commit fbd51918ff
2 changed files with 31 additions and 0 deletions

View File

@@ -244,6 +244,21 @@ int AlignmentGroup::count() const
return this->_views.size();
}
Base::BoundBox3d AlignmentGroup::getBoundingBox() const
{
Base::BoundBox3d box;
std::vector<Gui::ViewProviderDocumentObject*>::const_iterator it;
for (it = this->_views.begin(); it != this->_views.end(); ++it) {
if ((*it)->isDerivedFrom(Gui::ViewProviderGeometryObject::getClassTypeId())) {
App::GeoFeature* geo = static_cast<App::GeoFeature*>((*it)->getObject());
const App::PropertyComplexGeoData* prop = geo->getPropertyOfGeometry();
if (prop)
box.Add(prop->getBoundingBox());
}
}
return box;
}
// ------------------------------------------------------------------
MovableGroup::MovableGroup()
@@ -334,6 +349,16 @@ const MovableGroup& MovableGroupModel::getGroup(int i) const
return this->_groups[i];
}
Base::BoundBox3d MovableGroupModel::getBoundingBox() const
{
Base::BoundBox3d box;
std::vector<MovableGroup>::const_iterator it;
for (it = this->_groups.begin(); it != this->_groups.end(); ++it) {
box.Add(it->getBoundingBox());
}
return box;
}
// ------------------------------------------------------------------
namespace Gui {