Groups: Handle add and remove object correctly

This commit is contained in:
Stefan Tröger
2017-02-09 19:52:44 +01:00
committed by wmayer
parent 53ff196c2e
commit aa0d25f54f
9 changed files with 32 additions and 187 deletions

View File

@@ -133,6 +133,22 @@ void GeoFeatureGroupExtension::addObject(App::DocumentObject* object) {
Group.setValues(grp);
}
void GeoFeatureGroupExtension::removeObject(App::DocumentObject* object) {
//cross CoordinateSystem links are not allowed, so we need to remove the whole link group
auto links = getCSRelevantLinks(object);
links.push_back(object);
//remove all links out of group
std::vector<DocumentObject*> grp = Group.getValues();
for(auto link : links)
grp.erase(std::remove(grp.begin(), grp.end(), link), grp.end());
Group.setValues(grp);
}
std::vector< DocumentObject* > GeoFeatureGroupExtension::getObjectsFromLinks(DocumentObject* obj) {
//we get all linked objects. We can't use outList() as this includes the links from expressions