From 6ee4c5c90f88523bd433b4a9660d0262bc0261f3 Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 29 Jan 2015 15:01:24 +0300 Subject: [PATCH] Issue #378: Take into account sub-objects of composite feature in ModuleBase_Operation::hasObject --- src/ModuleBase/ModuleBase_Operation.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/ModuleBase/ModuleBase_Operation.cpp b/src/ModuleBase/ModuleBase_Operation.cpp index 96060b463..3b799f668 100644 --- a/src/ModuleBase/ModuleBase_Operation.cpp +++ b/src/ModuleBase/ModuleBase_Operation.cpp @@ -131,6 +131,20 @@ bool ModuleBase_Operation::hasObject(ObjectPtr theObj) const if (theObj == (*aIt)) return true; } + CompositeFeaturePtr aCompFeature = std::dynamic_pointer_cast(aFeature); + if (aCompFeature.get() != NULL) { + for (int i = 0; i < aCompFeature->numberOfSubs(); i++) { + FeaturePtr aSubFeature = aCompFeature->subFeature(i); + std::list aResults = aSubFeature->results(); + std::list::const_iterator aIt; + for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) { + if (theObj == (*aIt)) + return true; + } + if (aSubFeature == theObj) + return true; + } + } } return false; } -- 2.39.2