1 // Copyright (C) 2014-2017 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #include "ModelAPI_Tools.h"
22 #include <ModelAPI_Session.h>
23 #include <ModelAPI_CompositeFeature.h>
24 #include <ModelAPI_Document.h>
25 #include <ModelAPI_Object.h>
26 #include <ModelAPI_AttributeDouble.h>
27 #include <ModelAPI_ResultCompSolid.h>
28 #include <ModelAPI_ResultParameter.h>
29 #include <ModelAPI_ResultPart.h>
30 #include <ModelAPI_AttributeDocRef.h>
31 #include <ModelAPI_Validator.h>
36 #include <Events_Loop.h>
37 #include <ModelAPI_Events.h>
39 #define RECURSE_TOP_LEVEL 50
41 //#define DEBUG_REMOVE_FEATURES
42 //#define DEBUG_REMOVE_FEATURES_RECURSE
43 //#define DEBUG_CYCLING_1550
45 #ifdef DEBUG_REMOVE_FEATURES_RECURSE
47 std::string getFeatureInfo(FeaturePtr theFeature)
49 if (!theFeature.get())
51 //std::ostringstream aPtrStr;
52 //aPtrStr << "[" << theFeature.get() << "] ";
53 std::string aFeatureInfo = /*aPtrStr.str() + */theFeature->name();
54 CompositeFeaturePtr aComposite = ModelAPI_Tools::compositeOwner(theFeature);
55 if (aComposite.get()) {
56 aFeatureInfo = aFeatureInfo + "[in " + aComposite->name() + "]";
62 #ifdef DEBUG_REMOVE_FEATURES
63 void printMapInfo(const std::map<FeaturePtr, std::set<FeaturePtr> >& theMainList,
64 const std::string& thePrefix)
66 std::map<FeaturePtr, std::set<FeaturePtr> >::const_iterator aMainIt = theMainList.begin(),
67 aMainLast = theMainList.end();
69 for (; aMainIt != aMainLast; aMainIt++) {
70 FeaturePtr aMainListFeature = aMainIt->first;
71 std::set<FeaturePtr> aMainRefList = aMainIt->second;
72 std::set<FeaturePtr>::const_iterator anIt = aMainRefList.begin(), aLast = aMainRefList.end();
73 std::string aRefsInfo;
74 for (; anIt != aLast; anIt++) {
75 aRefsInfo += (*anIt)->name().c_str();
79 if (!aRefsInfo.empty()) {
80 anInfo = anInfo + aMainListFeature->name().c_str() + ": " + aRefsInfo + "\n";
83 std::cout << thePrefix.c_str() << " [feature: references to]: \n" << anInfo.c_str() << std::endl;
86 void printListInfo(const std::set<FeaturePtr>& theMainList,
87 const std::string& thePrefix)
89 std::set<FeaturePtr>::const_iterator aMainIt = theMainList.begin(),
90 aMainLast = theMainList.end();
92 for (; aMainIt != aMainLast; aMainIt++) {
93 FeaturePtr aRefFeature = *aMainIt;
94 anInfo += aRefFeature->name().c_str();
95 if (aMainIt != aMainLast)
98 std::cout << thePrefix.c_str() << ": " << anInfo.c_str() << std::endl;
102 namespace ModelAPI_Tools {
104 std::shared_ptr<GeomAPI_Shape> shape(const ResultPtr& theResult)
106 return theResult->shape();
109 const char* toString(ModelAPI_ExecState theExecState)
111 #define TO_STRING(__NAME__) case __NAME__: return #__NAME__;
112 switch (theExecState) {
113 TO_STRING(ModelAPI_StateDone)
114 TO_STRING(ModelAPI_StateMustBeUpdated)
115 TO_STRING(ModelAPI_StateExecFailed)
116 TO_STRING(ModelAPI_StateInvalidArgument)
117 TO_STRING(ModelAPI_StateNothing)
118 default: return "Unknown ExecState.";
123 std::string getFeatureError(const FeaturePtr& theFeature)
126 if (!theFeature.get() || !theFeature->data()->isValid() || theFeature->isAction())
129 // to be removed later, this error should be got from the feature
130 if (theFeature->data()->execState() == ModelAPI_StateDone ||
131 theFeature->data()->execState() == ModelAPI_StateMustBeUpdated)
134 // set error indication
135 anError = theFeature->error();
136 if (anError.empty()) {
137 bool isDone = ( theFeature->data()->execState() == ModelAPI_StateDone
138 || theFeature->data()->execState() == ModelAPI_StateMustBeUpdated );
140 anError = toString(theFeature->data()->execState());
141 // If the feature is Composite and error is StateInvalidArgument,
142 // error text should include error of first invalid sub-feature. Otherwise
143 // it is not clear what is the reason of the invalid argument.
144 if (theFeature->data()->execState() == ModelAPI_StateInvalidArgument) {
145 CompositeFeaturePtr aComposite =
146 std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(theFeature);
148 for (int i = 0, aSize = aComposite->numberOfSubs(); i < aSize; i++) {
149 FeaturePtr aSubFeature = aComposite->subFeature(i);
150 std::string aSubFeatureError = getFeatureError(aSubFeature);
151 if (!aSubFeatureError.empty()) {
152 anError = anError + " in " + aSubFeature->getKind() + ".\n" + aSubFeatureError;
164 ObjectPtr objectByName(const DocumentPtr& theDocument, const std::string& theGroup,
165 const std::string& theName)
167 for (int anIndex = 0; anIndex < theDocument->size(theGroup); ++anIndex) {
168 ObjectPtr anObject = theDocument->object(theGroup, anIndex);
169 if (anObject->data()->name() == theName)
176 bool findVariable(const DocumentPtr& theDocument, FeaturePtr theSearcher,
177 const std::string& theName, double& outValue, ResultParameterPtr& theParam)
179 ObjectPtr aParamObj = objectByName(theDocument, ModelAPI_ResultParameter::group(), theName);
180 theParam = std::dynamic_pointer_cast<ModelAPI_ResultParameter>(aParamObj);
183 // avoid usage of parameters created later than the initial parameter
185 if (theSearcher.get()) {
186 FeaturePtr aParamFeat = theDocument->feature(theParam);
187 if (aParamFeat == theSearcher || theDocument->isLater(aParamFeat, theSearcher))
190 AttributeDoublePtr aValueAttribute = theParam->data()->real(ModelAPI_ResultParameter::VALUE());
191 outValue = aValueAttribute->value();
195 bool findVariable(FeaturePtr theSearcher, const std::string& theName, double& outValue,
196 ResultParameterPtr& theParam, const DocumentPtr& theDocument)
198 SessionPtr aSession = ModelAPI_Session::get();
199 std::list<DocumentPtr> aDocList;
200 DocumentPtr aDocument = theDocument.get() ? theDocument : aSession->activeDocument();
201 if (findVariable(aDocument, theSearcher, theName, outValue, theParam))
203 DocumentPtr aRootDocument = aSession->moduleDocument();
204 if (aDocument != aRootDocument) {
205 // any parameters in PartSet is okindependently on the Part position (issu #1504)
206 if (findVariable(aRootDocument, FeaturePtr(), theName, outValue, theParam))
212 ResultPtr findPartResult(const DocumentPtr& theMain, const DocumentPtr& theSub)
214 // to optimize and avoid of crash on partset document close
215 // (don't touch the sub-document structure)
216 if (theMain != theSub) {
217 for (int a = theMain->size(ModelAPI_ResultPart::group()) - 1; a >= 0; a--) {
218 ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(
219 theMain->object(ModelAPI_ResultPart::group(), a));
220 if (aPart && aPart->data()->document(ModelAPI_ResultPart::DOC_REF())->value() == theSub) {
228 FeaturePtr findPartFeature(const DocumentPtr& theMain, const DocumentPtr& theSub)
230 // to optimize and avoid of crash on partset document close
231 // (don't touch the sub-document structure)
232 if (theMain != theSub) {
233 // iteration from top to bottom to avoid finding the movement documents before the original
234 int aSize = theMain->size(ModelAPI_Feature::group());
235 for (int a = 0; a < aSize; a++) {
236 FeaturePtr aPartFeat = std::dynamic_pointer_cast<ModelAPI_Feature>(
237 theMain->object(ModelAPI_Feature::group(), a));
238 if (aPartFeat.get()) {
239 const std::list<std::shared_ptr<ModelAPI_Result> >& aResList = aPartFeat->results();
240 std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRes = aResList.begin();
241 for(; aRes != aResList.end(); aRes++) {
242 ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aRes);
244 if (aPart->isActivated() && aPart->partDoc() == theSub)
246 } else break; // if the first is not Part, others are also not
254 CompositeFeaturePtr compositeOwner(const FeaturePtr& theFeature)
256 if (theFeature.get() && theFeature->data()->isValid()) {
257 const std::set<std::shared_ptr<ModelAPI_Attribute> >& aRefs = theFeature->data()->refsToMe();
258 std::set<std::shared_ptr<ModelAPI_Attribute> >::const_iterator aRefIter = aRefs.begin();
259 for(; aRefIter != aRefs.end(); aRefIter++) {
260 CompositeFeaturePtr aComp = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>
261 ((*aRefIter)->owner());
262 if (aComp.get() && aComp->data()->isValid() && aComp->isSub(theFeature))
266 return CompositeFeaturePtr(); // not found
269 ResultCompSolidPtr compSolidOwner(const ResultPtr& theSub)
272 ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(theSub);
274 FeaturePtr aFeatureOwner = aBody->document()->feature(aBody);
275 if (aFeatureOwner.get()) {
276 std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aResIter =
277 aFeatureOwner->results().cbegin();
278 for(; aResIter != aFeatureOwner->results().cend(); aResIter++) {
279 ResultCompSolidPtr aComp = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(*aResIter);
280 if (aComp && aComp->isSub(aBody, anIndex))
285 return ResultCompSolidPtr(); // not found
288 int compSolidIndex(const ResultPtr& theSub)
291 ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(theSub);
293 FeaturePtr aFeatureOwner = aBody->document()->feature(aBody);
294 if (aFeatureOwner.get()) {
295 std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aResIter =
296 aFeatureOwner->results().cbegin();
297 for(; aResIter != aFeatureOwner->results().cend(); aResIter++) {
298 ResultCompSolidPtr aComp = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(*aResIter);
299 if (aComp && aComp->isSub(aBody, anIndex))
304 return anIndex; // not found
307 bool hasSubResults(const ResultPtr& theResult)
309 ResultCompSolidPtr aCompSolid = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(theResult);
310 return aCompSolid.get() && aCompSolid->numberOfSubs() > 0;
313 void allResults(const FeaturePtr& theFeature, std::list<ResultPtr>& theResults)
315 if (!theFeature.get()) // safety: for empty feature no results
317 const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = theFeature->results();
318 std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
319 for (; aRIter != aResults.cend(); aRIter++) {
320 theResults.push_back(*aRIter);
321 // iterate sub-bodies of compsolid
322 ResultCompSolidPtr aComp = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(*aRIter);
324 int aNumSub = aComp->numberOfSubs();
325 for(int a = 0; a < aNumSub; a++) {
326 theResults.push_back(aComp->subResult(a));
332 //******************************************************************
333 bool allDocumentsActivated(std::string& theNotActivatedNames)
335 theNotActivatedNames = "";
336 bool anAllPartActivated = true;
338 DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
339 int aSize = aRootDoc->size(ModelAPI_ResultPart::group());
340 for (int i = 0; i < aSize; i++) {
341 ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultPart::group(), i);
342 ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
343 if (!aPart->isActivated()) {
344 anAllPartActivated = false;
345 if (!theNotActivatedNames.empty())
346 theNotActivatedNames += ", ";
347 theNotActivatedNames += aObject->data()->name().c_str();
350 return anAllPartActivated;
353 bool removeFeaturesAndReferences(const std::set<FeaturePtr>& theFeatures,
354 const bool theFlushRedisplay,
355 const bool theUseComposite,
356 const bool theUseRecursion)
358 #ifdef DEBUG_REMOVE_FEATURES
359 printListInfo(theFeatures, "selection: ");
362 std::map<FeaturePtr, std::set<FeaturePtr> > aReferences;
363 ModelAPI_Tools::findAllReferences(theFeatures, aReferences, theUseComposite, theUseRecursion);
364 #ifdef DEBUG_REMOVE_FEATURES
365 printMapInfo(aReferences, "allDependencies: ");
368 std::set<FeaturePtr> aFeaturesRefsTo;
369 ModelAPI_Tools::findRefsToFeatures(theFeatures, aReferences, aFeaturesRefsTo);
370 #ifdef DEBUG_REMOVE_FEATURES
371 printListInfo(aFeaturesRefsTo, "references: ");
374 std::set<FeaturePtr> aFeatures = theFeatures;
375 if (!aFeaturesRefsTo.empty())
376 aFeatures.insert(aFeaturesRefsTo.begin(), aFeaturesRefsTo.end());
377 #ifdef DEBUG_REMOVE_FEATURES
378 printListInfo(aFeatures, "removeFeatures: ");
381 return ModelAPI_Tools::removeFeatures(aFeatures, false);
384 bool removeFeatures(const std::set<FeaturePtr>& theFeatures,
385 const bool theFlushRedisplay)
388 std::set<FeaturePtr>::const_iterator anIt = theFeatures.begin(),
389 aLast = theFeatures.end();
390 for (; anIt != aLast; anIt++) {
391 FeaturePtr aFeature = *anIt;
392 if (aFeature.get()) {
393 DocumentPtr aDoc = aFeature->document();
394 // flush REDISPLAY signal after remove feature
395 aDoc->removeFeature(aFeature);
399 if (isDone && theFlushRedisplay) {
400 // the redisplay signal should be flushed in order to erase
401 // the feature presentation in the viewer
402 // if should be done after removeFeature() of document
403 Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
408 // Fills the references list by all references of the feature from the references map.
409 // This is a recusive method to find references by next found feature in the map of references.
410 // \param theFeature a feature to find references
411 // \param theReferencesMap a map of references
412 // \param theReferences an out container of references
413 void addRefsToFeature(const FeaturePtr& theFeature,
414 const std::map<FeaturePtr, std::set<FeaturePtr> >& theReferencesMap,
415 std::map<FeaturePtr, std::set<FeaturePtr> >& theProcessedReferences,
417 std::set<FeaturePtr>& theReferences)
419 if (theRecLevel > RECURSE_TOP_LEVEL)
423 // if the feature is already processed, get the ready references from the map
424 if (theProcessedReferences.find(theFeature) != theProcessedReferences.end()) {
425 std::set<FeaturePtr> aReferences = theProcessedReferences.at(theFeature);
426 theReferences.insert(aReferences.begin(), aReferences.end());
430 if (theReferencesMap.find(theFeature) == theReferencesMap.end())
431 return; // this feature is not in the selection list, so exists without references to it
432 std::set<FeaturePtr> aMainReferences = theReferencesMap.at(theFeature);
434 std::set<FeaturePtr>::const_iterator anIt = aMainReferences.begin(),
435 aLast = aMainReferences.end();
436 #ifdef DEBUG_REMOVE_FEATURES_RECURSE
437 std::string aSpacing;
438 for (int i = 0; i < theRecLevel; i++)
439 aSpacing.append(" ");
442 for (; anIt != aLast; anIt++) {
443 FeaturePtr aRefFeature = *anIt;
444 #ifdef DEBUG_REMOVE_FEATURES_RECURSE
445 std::cout << aSpacing << " Ref: " << getFeatureInfo(aRefFeature) << std::endl;
447 if (theReferences.find(aRefFeature) == theReferences.end())
448 theReferences.insert(aRefFeature);
449 addRefsToFeature(aRefFeature, theReferencesMap, theProcessedReferences,
450 theRecLevel, theReferences);
454 // For each feature from the feature list it searches references to the feature and append them
455 // to the references map. This is a recusive method.
456 // \param theFeature a feature to find references
457 // \param theReferencesMap a map of references
458 // \param theReferences an out container of references
459 void findReferences(const std::set<FeaturePtr>& theFeatures,
460 std::map<FeaturePtr, std::set<FeaturePtr> >& theReferences,
461 const bool theUseComposite, const bool theUseRecursion, int theRecLevel)
463 if (theRecLevel > RECURSE_TOP_LEVEL)
466 std::set<FeaturePtr>::const_iterator anIt = theFeatures.begin(),
467 aLast = theFeatures.end();
468 for (; anIt != aLast; anIt++) {
469 FeaturePtr aFeature = *anIt;
470 if (aFeature.get() && theReferences.find(aFeature) == theReferences.end()) {
471 DocumentPtr aSelFeatureDoc = aFeature->document();
472 std::set<FeaturePtr> aSelRefFeatures;
473 aSelFeatureDoc->refsToFeature(aFeature, aSelRefFeatures, false/*do not emit signals*/);
474 if (theUseComposite) { // do not filter selection
475 theReferences[aFeature] = aSelRefFeatures;
477 else { // filter references to skip composition features of the current feature
478 std::set<FeaturePtr> aFilteredFeatures;
479 std::set<FeaturePtr>::const_iterator anIt = aSelRefFeatures.begin(),
480 aLast = aSelRefFeatures.end();
481 for (; anIt != aLast; anIt++) {
482 FeaturePtr aCFeature = *anIt;
483 CompositeFeaturePtr aComposite =
484 std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aCFeature);
485 if (aComposite.get() && aComposite->isSub(aFeature))
486 continue; /// composite of the current feature should be skipped
487 aFilteredFeatures.insert(aCFeature);
489 theReferences[aFeature] = aFilteredFeatures;
491 if (theUseRecursion) {
492 #ifdef DEBUG_CYCLING_1550
493 findReferences(aSelRefFeatures, theReferences, theUseComposite,
494 theUseRecursion, theRecLevel);
496 findReferences(theReferences[aFeature], theReferences, theUseComposite, theUseRecursion,
504 void findAllReferences(const std::set<FeaturePtr>& theFeatures,
505 std::map<FeaturePtr, std::set<FeaturePtr> >& theReferences,
506 const bool theUseComposite,
507 const bool theUseRecursion)
509 // For dependencies, find main_list:
510 // sk_1(ext_1, vertex_1)
511 // ext_1(bool_1, sk_3)
516 // Information: bool_1 is not selected, ext_2(bool_2) exists
517 // find all referenced features
518 std::map<FeaturePtr, std::set<FeaturePtr> > aMainList;
520 findReferences(theFeatures, aMainList, theUseComposite, theUseRecursion, aRecLevel);
522 #ifdef DEBUG_REMOVE_FEATURES
523 printMapInfo(aMainList, "firstDependencies");
525 // find all dependencies for each object:
526 // sk_1(ext_1, vertex_1) + (sk_3, bool_1)
527 // ext_1(bool_1, sk_3)
529 // sk_2(ext_2) + (bool_1)
532 std::map<FeaturePtr, std::set<FeaturePtr> >::const_iterator aMainIt = aMainList.begin(),
533 aMainLast = aMainList.end();
534 for (; aMainIt != aMainLast; aMainIt++) {
535 FeaturePtr aMainListFeature = aMainIt->first;
537 //std::string aName = aMainListFeature->name();
538 std::set<FeaturePtr> aMainRefList = aMainIt->second;
540 #ifdef DEBUG_REMOVE_FEATURES_RECURSE
542 int n = sprintf(aBuf, "%d", aMainRefList.size());
543 std::string aSize(aBuf);
544 std::cout << "_findAllReferences for the Feature: " << getFeatureInfo(aMainListFeature)
545 << ", references size = " << aSize << std::endl;
547 std::set<FeaturePtr>::const_iterator anIt = aMainRefList.begin(),
548 aLast = aMainRefList.end();
549 std::set<FeaturePtr> aResultRefList;
550 aResultRefList.insert(aMainRefList.begin(), aMainRefList.end());
551 for (; anIt != aLast; anIt++) {
552 FeaturePtr aFeature = *anIt;
554 #ifdef DEBUG_REMOVE_FEATURES_RECURSE
555 std::cout << " Ref: " << getFeatureInfo(aFeature) << std::endl;
558 addRefsToFeature(aFeature, aMainList, theReferences,
559 aRecLevel, aResultRefList/*aMainRefList*/);
561 theReferences[aMainListFeature] = aResultRefList;
563 #ifdef DEBUG_REMOVE_FEATURES_RECURSE
564 std::cout << std::endl;
567 #ifdef DEBUG_REMOVE_FEATURES
568 printMapInfo(theReferences, "allDependencies");
572 void findRefsToFeatures(const std::set<FeaturePtr>& theFeatures,
573 const std::map<FeaturePtr, std::set<FeaturePtr> >& theReferences,
574 std::set<FeaturePtr>& theFeaturesRefsTo)
576 std::set<FeaturePtr>::const_iterator anIt = theFeatures.begin(),
577 aLast = theFeatures.end();
578 for (; anIt != aLast; anIt++) {
579 FeaturePtr aFeature = *anIt;
580 if (theReferences.find(aFeature) == theReferences.end())
582 std::set<FeaturePtr> aRefList = theReferences.at(aFeature);
583 std::set<FeaturePtr>::const_iterator aRefIt = aRefList.begin(), aRefLast = aRefList.end();
584 for (; aRefIt != aRefLast; aRefIt++) {
585 FeaturePtr aRefFeature = *aRefIt;
586 CompositeFeaturePtr aComposite =
587 std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aRefFeature);
588 if (aComposite.get() && aComposite->isSub(aFeature))
589 continue; /// composite of the current feature should not be removed
591 if (theFeatures.find(aRefFeature) == theFeatures.end() && // it is not selected
592 theFeaturesRefsTo.find(aRefFeature) == theFeaturesRefsTo.end()) // it is not added
593 theFeaturesRefsTo.insert(aRefFeature);
598 void getConcealedResults(const FeaturePtr& theFeature,
599 std::list<std::shared_ptr<ModelAPI_Result> >& theResults)
601 SessionPtr aSession = ModelAPI_Session::get();
603 std::list<std::pair<std::string, std::list<std::shared_ptr<ModelAPI_Object> > > > aRefs;
604 theFeature->data()->referencesToObjects(aRefs);
605 std::list<std::pair<std::string, std::list<ObjectPtr> > >::const_iterator
606 anIt = aRefs.begin(), aLast = aRefs.end();
607 std::set<ResultPtr> alreadyThere; // to avoid duplications
608 for (; anIt != aLast; anIt++) {
609 if (!aSession->validators()->isConcealed(theFeature->getKind(), anIt->first))
610 continue; // use only concealed attributes
611 std::list<ObjectPtr> anObjects = (*anIt).second;
612 std::list<ObjectPtr>::const_iterator anOIt = anObjects.begin(), anOLast = anObjects.end();
613 for (; anOIt != anOLast; anOIt++) {
614 ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(*anOIt);
615 if (aResult && aResult->isConcealed()) {
616 if (alreadyThere.find(aResult) == alreadyThere.end()) // issue 1712, avoid duplicates
617 alreadyThere.insert(aResult);
619 theResults.push_back(aResult);
625 } // namespace ModelAPI_Tools