From f293cf2b3b2fcce78c08776075d2e84787ab2af6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Tr=C3=B6ger?= Date: Wed, 9 Aug 2017 19:27:32 +0200 Subject: [PATCH] Ensure finding the correct parent GeoFeatureGroup --- src/App/GeoFeatureGroupExtension.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/App/GeoFeatureGroupExtension.cpp b/src/App/GeoFeatureGroupExtension.cpp index 6622f4a183..667a910e72 100644 --- a/src/App/GeoFeatureGroupExtension.cpp +++ b/src/App/GeoFeatureGroupExtension.cpp @@ -95,12 +95,15 @@ DocumentObject* GeoFeatureGroupExtension::getGroupOfObject(const DocumentObject* //like OriginGroup. That is needed as we use this function to get all local coordinate systems. Also there //is no reason to distinguish between GeoFeatuerGroups, there is only between group/geofeaturegroup auto list = obj->getInList(); - for (auto obj : list) { - if(obj->hasExtension(App::GeoFeatureGroupExtension::getExtensionClassTypeId())) { - - //TODO: There may be links to geofeaturegroups to objects not inside that group. We need to - //check that! - return obj; + for (auto inObj : list) { + + //There is a chance that a derived geofeaturegroup links with a local link and hence is not + //the parent group even though it links to the object. We use hasObject as one and only truth + //if it has the object within the group + if(inObj->hasExtension(App::GeoFeatureGroupExtension::getExtensionClassTypeId()) && + inObj->getExtensionByType()->hasObject(obj)) { + + return inObj; } }