Moved some methods from PartDesign::Body to Part::BodyBase so the SketchObjects will be removed cleanly from the Body when deleted

This commit is contained in:
jrheinlaender
2013-05-04 10:52:54 +04:30
committed by Stefan Tröger
parent 5b3d5e6bd8
commit 02dfb8551d
13 changed files with 77 additions and 62 deletions

View File

@@ -165,12 +165,6 @@ App::DocumentObject* Body::getNextSolidFeature(App::DocumentObject *start, const
return *it;
}
const bool Body::hasFeature(const App::DocumentObject* f) const
{
const std::vector<App::DocumentObject*> features = Model.getValues();
return std::find(features.begin(), features.end(), f) != features.end();
}
const bool Body::isAfterTip(const App::DocumentObject *f) {
std::vector<App::DocumentObject*> features = Model.getValues();
std::vector<App::DocumentObject*>::const_iterator it = std::find(features.begin(), features.end(), f);
@@ -196,21 +190,6 @@ const bool Body::isAllowed(const App::DocumentObject* f)
f->getTypeId().isDerivedFrom(Part::Part2DObject::getClassTypeId()));
}
Body* Body::findBodyOf(const App::DocumentObject* f)
{
App::Document* doc = App::GetApplication().getActiveDocument();
if (doc != NULL) {
std::vector<App::DocumentObject*> bodies = doc->getObjectsOfType(PartDesign::Body::getClassTypeId());
for (std::vector<App::DocumentObject*>::const_iterator b = bodies.begin(); b != bodies.end(); b++) {
PartDesign::Body* body = static_cast<PartDesign::Body*>(*b);
if (body->hasFeature(f))
return body;
}
}
return NULL;
}
void Body::addFeature(App::DocumentObject *feature)
{
// Set the BaseFeature property