1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ModelAPI_Tools.cpp
4 // Created: 06 Aug 2014
5 // Author: Vitaly Smetannikov
7 #include "ModelAPI_Tools.h"
8 #include <ModelAPI_Session.h>
9 #include <ModelAPI_Document.h>
10 #include <ModelAPI_Object.h>
11 #include <ModelAPI_AttributeDouble.h>
12 #include <ModelAPI_ResultParameter.h>
13 #include <ModelAPI_ResultPart.h>
14 #include <ModelAPI_AttributeDocRef.h>
19 #include <Events_Loop.h>
20 #include <ModelAPI_Events.h>
22 #define RECURSE_TOP_LEVEL 50
24 //#define DEBUG_REMOVE_FEATURES
25 //#define DEBUG_REMOVE_FEATURES_RECURSE
26 //#define DEBUG_CYCLING_1550
28 #ifdef DEBUG_REMOVE_FEATURES_RECURSE
30 std::string getFeatureInfo(FeaturePtr theFeature)
32 if (!theFeature.get())
34 //std::ostringstream aPtrStr;
35 //aPtrStr << "[" << theFeature.get() << "] ";
36 std::string aFeatureInfo = /*aPtrStr.str() + */theFeature->name();
37 CompositeFeaturePtr aComposite = ModelAPI_Tools::compositeOwner(theFeature);
38 if (aComposite.get()) {
39 aFeatureInfo = aFeatureInfo + "[in " + aComposite->name() + "]";
45 #ifdef DEBUG_REMOVE_FEATURES
46 void printMapInfo(const std::map<FeaturePtr, std::set<FeaturePtr> >& theMainList,
47 const std::string& thePrefix)
49 std::map<FeaturePtr, std::set<FeaturePtr> >::const_iterator aMainIt = theMainList.begin(),
50 aMainLast = theMainList.end();
52 for (; aMainIt != aMainLast; aMainIt++) {
53 FeaturePtr aMainListFeature = aMainIt->first;
54 std::set<FeaturePtr> aMainRefList = aMainIt->second;
55 std::set<FeaturePtr>::const_iterator anIt = aMainRefList.begin(), aLast = aMainRefList.end();
56 std::string aRefsInfo;
57 for (; anIt != aLast; anIt++) {
58 aRefsInfo += (*anIt)->name().c_str();
62 if (!aRefsInfo.empty()) {
63 anInfo = anInfo + aMainListFeature->name().c_str() + ": " + aRefsInfo + "\n";
66 std::cout << thePrefix.c_str() << " [feature: references to]: \n" << anInfo.c_str() << std::endl;
69 void printListInfo(const std::set<FeaturePtr>& theMainList,
70 const std::string& thePrefix)
72 std::set<FeaturePtr>::const_iterator aMainIt = theMainList.begin(),
73 aMainLast = theMainList.end();
75 for (; aMainIt != aMainLast; aMainIt++) {
76 FeaturePtr aRefFeature = *aMainIt;
77 anInfo += aRefFeature->name().c_str();
78 if (aMainIt != aMainLast)
81 std::cout << thePrefix.c_str() << ": " << anInfo.c_str() << std::endl;
85 namespace ModelAPI_Tools {
87 std::shared_ptr<GeomAPI_Shape> shape(const ResultPtr& theResult)
89 return theResult->shape();
92 const char* toString(ModelAPI_ExecState theExecState)
94 #define TO_STRING(__NAME__) case __NAME__: return #__NAME__;
95 switch (theExecState) {
96 TO_STRING(ModelAPI_StateDone)
97 TO_STRING(ModelAPI_StateMustBeUpdated)
98 TO_STRING(ModelAPI_StateExecFailed)
99 TO_STRING(ModelAPI_StateInvalidArgument)
100 TO_STRING(ModelAPI_StateNothing)
101 default: return "Unknown ExecState.";
106 std::string getFeatureError(const FeaturePtr& theFeature)
109 if (!theFeature.get() || !theFeature->data()->isValid() || theFeature->isAction())
112 // to be removed later, this error should be got from the feature
113 if (theFeature->data()->execState() == ModelAPI_StateDone ||
114 theFeature->data()->execState() == ModelAPI_StateMustBeUpdated)
117 // set error indication
118 anError = theFeature->error();
119 if (anError.empty()) {
120 bool isDone = ( theFeature->data()->execState() == ModelAPI_StateDone
121 || theFeature->data()->execState() == ModelAPI_StateMustBeUpdated );
123 anError = toString(theFeature->data()->execState());
124 // If the feature is Composite and error is StateInvalidArgument,
125 // error text should include error of first invalid sub-feature. Otherwise
126 // it is not clear what is the reason of the invalid argument.
127 if (theFeature->data()->execState() == ModelAPI_StateInvalidArgument) {
128 CompositeFeaturePtr aComposite =
129 std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(theFeature);
131 for (int i = 0, aSize = aComposite->numberOfSubs(); i < aSize; i++) {
132 FeaturePtr aSubFeature = aComposite->subFeature(i);
133 std::string aSubFeatureError = getFeatureError(aSubFeature);
134 if (!aSubFeatureError.empty()) {
135 anError = anError + " in " + aSubFeature->getKind() + ".\n" + aSubFeatureError;
147 ObjectPtr objectByName(const DocumentPtr& theDocument, const std::string& theGroup, const std::string& theName)
149 for (int anIndex = 0; anIndex < theDocument->size(theGroup); ++anIndex) {
150 ObjectPtr anObject = theDocument->object(theGroup, anIndex);
151 if (anObject->data()->name() == theName)
158 bool findVariable(const DocumentPtr& theDocument, FeaturePtr theSearcher,
159 const std::string& theName, double& outValue, ResultParameterPtr& theParam)
161 ObjectPtr aParamObj = objectByName(theDocument, ModelAPI_ResultParameter::group(), theName);
162 theParam = std::dynamic_pointer_cast<ModelAPI_ResultParameter>(aParamObj);
165 // avoid usage of parameters created later than the initial parameter
166 if (theSearcher.get() && theDocument->isLater(theDocument->feature(theParam), theSearcher))
168 AttributeDoublePtr aValueAttribute = theParam->data()->real(ModelAPI_ResultParameter::VALUE());
169 outValue = aValueAttribute->value();
173 bool findVariable(FeaturePtr theSearcher, const std::string& theName, double& outValue, ResultParameterPtr& theParam,
174 const DocumentPtr& theDocument)
176 SessionPtr aSession = ModelAPI_Session::get();
177 std::list<DocumentPtr> aDocList;
178 DocumentPtr aDocument = theDocument.get() ? theDocument : aSession->activeDocument();
179 if (findVariable(aDocument, theSearcher, theName, outValue, theParam))
181 DocumentPtr aRootDocument = aSession->moduleDocument();
182 if (aDocument != aRootDocument) {
183 // any parameters in PartSet is okindependently on the Part position (issu #1504)
184 if (findVariable(aRootDocument, FeaturePtr(), theName, outValue, theParam))
190 static std::map<int, std::vector<int> > myColorMap;
192 void appendValues(std::vector<int>& theRGB, const int theRed, const int theGreen, const int theBlue)
194 theRGB.push_back(theRed);
195 theRGB.push_back(theGreen);
196 theRGB.push_back(theBlue);
199 bool containsValues(std::map<int, std::vector<int> >& theColorMap, std::vector<int>& theValues)
201 std::map<int, std::vector<int> >::const_iterator anIt = theColorMap.begin(), aLast = theColorMap.end();
202 bool isFound = false;
203 for (; anIt != aLast && !isFound; anIt++) {
204 std::vector<int> aValues = anIt->second;
205 isFound = aValues[0] == theValues[0] &&
206 aValues[1] == theValues[1] &&
207 aValues[2] == theValues[2];
212 std::vector<int> HSVtoRGB(int theH, int theS, int theV)
214 std::vector<int> aRGB;
215 if (theH < 0 || theH > 360 ||
216 theS < 0 || theS > 100 ||
217 theV < 0 || theV > 100)
220 int aHi = (int)theH/60;
223 double aVmin = (100 - theS)*theV/100;
225 double anA = (theV - aVmin)* (theH % 60) / 60;
227 double aVinc = aVmin + anA;
228 double aVdec = theV - anA;
230 double aPercentToValue = 255./100;
231 int aV_int = (int)(aV*aPercentToValue);
232 int aVinc_int = (int)(aVinc*aPercentToValue);
233 int aVmin_int = (int)(aVmin*aPercentToValue);
234 int aVdec_int = (int)(aVdec*aPercentToValue);
237 case 0: appendValues(aRGB, aV_int, aVinc_int, aVmin_int); break;
238 case 1: appendValues(aRGB, aVdec_int, aV_int, aVmin_int); break;
239 case 2: appendValues(aRGB, aVmin_int, aV_int, aVinc_int); break;
240 case 3: appendValues(aRGB, aVmin_int, aVdec_int, aV_int); break;
241 case 4: appendValues(aRGB, aVinc_int, aVmin_int, aV_int); break;
242 case 5: appendValues(aRGB, aV_int, aVmin_int, aVdec_int); break;
251 if (!myColorMap.empty())
255 for (int s = 100; s > 0; s = s - 50)
257 for (int v = 100; v >= 40; v = v - 20)
259 for (int h = 0; h < 359 ; h = h + 60)
261 std::vector<int> aColor = HSVtoRGB(h, s, v);
262 if (containsValues(myColorMap, aColor))
264 myColorMap[i] = aColor;
271 void findRandomColor(std::vector<int>& theValues)
274 if (myColorMap.empty()) {
278 size_t aSize = myColorMap.size();
279 int anIndex = rand() % aSize;
280 if (myColorMap.find(anIndex) != myColorMap.end()) {
281 theValues = myColorMap.at(anIndex);
285 ResultPtr findPartResult(const DocumentPtr& theMain, const DocumentPtr& theSub)
287 if (theMain != theSub) { // to optimize and avoid of crash on partset document close (don't touch the sub-document structure)
288 for (int a = theMain->size(ModelAPI_ResultPart::group()) - 1; a >= 0; a--) {
289 ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(
290 theMain->object(ModelAPI_ResultPart::group(), a));
291 if (aPart && aPart->data()->document(ModelAPI_ResultPart::DOC_REF())->value() == theSub) {
299 FeaturePtr findPartFeature(const DocumentPtr& theMain, const DocumentPtr& theSub)
301 if (theMain != theSub) { // to optimize and avoid of crash on partset document close (don't touch the sub-document structure)
302 for (int a = theMain->size(ModelAPI_Feature::group()) - 1; a >= 0; a--) {
303 FeaturePtr aPartFeat = std::dynamic_pointer_cast<ModelAPI_Feature>(
304 theMain->object(ModelAPI_Feature::group(), a));
305 if (aPartFeat.get()) {
306 const std::list<std::shared_ptr<ModelAPI_Result> >& aResList = aPartFeat->results();
307 std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRes = aResList.begin();
308 for(; aRes != aResList.end(); aRes++) {
309 ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aRes);
311 if (aPart->isActivated() && aPart->partDoc() == theSub)
313 } else break; // if the first is not Part, others are also not
321 CompositeFeaturePtr compositeOwner(const FeaturePtr& theFeature)
323 if (theFeature.get() && theFeature->data()->isValid()) {
324 const std::set<std::shared_ptr<ModelAPI_Attribute> >& aRefs = theFeature->data()->refsToMe();
325 std::set<std::shared_ptr<ModelAPI_Attribute> >::const_iterator aRefIter = aRefs.begin();
326 for(; aRefIter != aRefs.end(); aRefIter++) {
327 CompositeFeaturePtr aComp = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>
328 ((*aRefIter)->owner());
329 if (aComp.get() && aComp->data()->isValid() && aComp->isSub(theFeature))
333 return CompositeFeaturePtr(); // not found
336 ResultCompSolidPtr compSolidOwner(const ResultPtr& theSub)
338 ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(theSub);
340 FeaturePtr aFeatureOwner = aBody->document()->feature(aBody);
341 if (aFeatureOwner.get()) {
342 std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aResIter =
343 aFeatureOwner->results().cbegin();
344 for(; aResIter != aFeatureOwner->results().cend(); aResIter++) {
345 ResultCompSolidPtr aComp = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(*aResIter);
346 if (aComp && aComp->isSub(aBody))
351 return ResultCompSolidPtr(); // not found
354 bool hasSubResults(const ResultPtr& theResult)
356 ResultCompSolidPtr aCompSolid = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(theResult);
357 return aCompSolid.get() && aCompSolid->numberOfSubs() > 0;
360 void allResults(const FeaturePtr& theFeature, std::list<ResultPtr>& theResults)
362 if (!theFeature.get()) // safety: for empty feature no results
364 const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = theFeature->results();
365 std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
366 for (; aRIter != aResults.cend(); aRIter++) {
367 theResults.push_back(*aRIter);
368 // iterate sub-bodies of compsolid
369 ResultCompSolidPtr aComp = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(*aRIter);
371 int aNumSub = aComp->numberOfSubs();
372 for(int a = 0; a < aNumSub; a++) {
373 theResults.push_back(aComp->subResult(a));
379 //******************************************************************
380 bool allDocumentsActivated(std::string& theNotActivatedNames)
382 theNotActivatedNames = "";
383 bool anAllPartActivated = true;
385 DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
386 int aSize = aRootDoc->size(ModelAPI_ResultPart::group());
387 for (int i = 0; i < aSize; i++) {
388 ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultPart::group(), i);
389 ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
390 if (!aPart->isActivated()) {
391 anAllPartActivated = false;
392 if (!theNotActivatedNames.empty())
393 theNotActivatedNames += ", ";
394 theNotActivatedNames += aObject->data()->name().c_str();
397 return anAllPartActivated;
400 bool removeFeaturesAndReferences(const std::set<FeaturePtr>& theFeatures,
401 const bool theFlushRedisplay,
402 const bool theUseComposite,
403 const bool theUseRecursion)
405 #ifdef DEBUG_REMOVE_FEATURES
406 printListInfo(theFeatures, "selection: ");
409 std::map<FeaturePtr, std::set<FeaturePtr> > aReferences;
410 ModelAPI_Tools::findAllReferences(theFeatures, aReferences, theUseComposite, theUseRecursion);
411 #ifdef DEBUG_REMOVE_FEATURES
412 printMapInfo(aReferences, "allDependencies: ");
415 std::set<FeaturePtr> aFeaturesRefsTo;
416 ModelAPI_Tools::findRefsToFeatures(theFeatures, aReferences, aFeaturesRefsTo);
417 #ifdef DEBUG_REMOVE_FEATURES
418 printListInfo(aFeaturesRefsTo, "references: ");
421 std::set<FeaturePtr> aFeatures = theFeatures;
422 if (!aFeaturesRefsTo.empty())
423 aFeatures.insert(aFeaturesRefsTo.begin(), aFeaturesRefsTo.end());
424 #ifdef DEBUG_REMOVE_FEATURES
425 printListInfo(aFeatures, "removeFeatures: ");
428 return ModelAPI_Tools::removeFeatures(aFeatures, false);
431 bool removeFeatures(const std::set<FeaturePtr>& theFeatures,
432 const bool theFlushRedisplay)
435 std::set<FeaturePtr>::const_iterator anIt = theFeatures.begin(),
436 aLast = theFeatures.end();
437 for (; anIt != aLast; anIt++) {
438 FeaturePtr aFeature = *anIt;
439 if (aFeature.get()) {
440 DocumentPtr aDoc = aFeature->document();
441 // flush REDISPLAY signal after remove feature
442 aDoc->removeFeature(aFeature);
446 if (isDone && theFlushRedisplay) {
447 // the redisplay signal should be flushed in order to erase the feature presentation in the viewer
448 // if should be done after removeFeature() of document
449 Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
454 // Fills the references list by all references of the feature from the references map.
455 // This is a recusive method to find references by next found feature in the map of references.
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 addRefsToFeature(const FeaturePtr& theFeature,
460 const std::map<FeaturePtr, std::set<FeaturePtr> >& theReferencesMap,
461 std::map<FeaturePtr, std::set<FeaturePtr> >& theProcessedReferences,
463 std::set<FeaturePtr>& theReferences)
465 if (theRecLevel > RECURSE_TOP_LEVEL)
469 // if the feature is already processed, get the ready references from the map
470 if (theProcessedReferences.find(theFeature) != theProcessedReferences.end()) {
471 std::set<FeaturePtr> aReferences = theProcessedReferences.at(theFeature);
472 theReferences.insert(aReferences.begin(), aReferences.end());
476 if (theReferencesMap.find(theFeature) == theReferencesMap.end())
477 return; // this feature is not in the selection list, so exists without references to it
478 std::set<FeaturePtr> aMainReferences = theReferencesMap.at(theFeature);
480 std::set<FeaturePtr>::const_iterator anIt = aMainReferences.begin(),
481 aLast = aMainReferences.end();
482 #ifdef DEBUG_REMOVE_FEATURES_RECURSE
483 std::string aSpacing;
484 for (int i = 0; i < theRecLevel; i++)
485 aSpacing.append(" ");
488 for (; anIt != aLast; anIt++) {
489 FeaturePtr aRefFeature = *anIt;
490 #ifdef DEBUG_REMOVE_FEATURES_RECURSE
491 std::cout << aSpacing << " Ref: " << getFeatureInfo(aRefFeature) << std::endl;
493 if (theReferences.find(aRefFeature) == theReferences.end())
494 theReferences.insert(aRefFeature);
495 addRefsToFeature(aRefFeature, theReferencesMap, theProcessedReferences, theRecLevel, theReferences);
499 // For each feature from the feature list it searches references to the feature and append them
500 // to the references map. This is a recusive method.
501 // \param theFeature a feature to find references
502 // \param theReferencesMap a map of references
503 // \param theReferences an out container of references
504 void findReferences(const std::set<FeaturePtr>& theFeatures,
505 std::map<FeaturePtr, std::set<FeaturePtr> >& theReferences,
506 const bool theUseComposite, const bool theUseRecursion, int theRecLevel)
508 if (theRecLevel > RECURSE_TOP_LEVEL)
511 std::set<FeaturePtr>::const_iterator anIt = theFeatures.begin(),
512 aLast = theFeatures.end();
513 for (; anIt != aLast; anIt++) {
514 FeaturePtr aFeature = *anIt;
515 if (aFeature.get() && theReferences.find(aFeature) == theReferences.end()) {
516 DocumentPtr aSelFeatureDoc = aFeature->document();
517 std::set<FeaturePtr> aSelRefFeatures;
518 aSelFeatureDoc->refsToFeature(aFeature, aSelRefFeatures, false/*do not emit signals*/);
519 if (theUseComposite) { // do not filter selection
520 theReferences[aFeature] = aSelRefFeatures;
522 else { // filter references to skip composition features of the current feature
523 std::set<FeaturePtr> aFilteredFeatures;
524 std::set<FeaturePtr>::const_iterator anIt = aSelRefFeatures.begin(),
525 aLast = aSelRefFeatures.end();
526 for (; anIt != aLast; anIt++) {
527 FeaturePtr aCFeature = *anIt;
528 CompositeFeaturePtr aComposite = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aCFeature);
529 if (aComposite.get() && aComposite->isSub(aFeature))
530 continue; /// composite of the current feature should be skipped
531 aFilteredFeatures.insert(aCFeature);
533 theReferences[aFeature] = aFilteredFeatures;
535 if (theUseRecursion) {
536 #ifdef DEBUG_CYCLING_1550
537 findReferences(aSelRefFeatures, theReferences, theUseComposite, theUseRecursion, theRecLevel);
539 findReferences(theReferences[aFeature], theReferences, theUseComposite, theUseRecursion,
547 void findAllReferences(const std::set<FeaturePtr>& theFeatures,
548 std::map<FeaturePtr, std::set<FeaturePtr> >& theReferences,
549 const bool theUseComposite,
550 const bool theUseRecursion)
552 // For dependencies, find main_list:
553 // sk_1(ext_1, vertex_1)
554 // ext_1(bool_1, sk_3)
559 // Information: bool_1 is not selected, ext_2(bool_2) exists
560 // find all referenced features
561 std::map<FeaturePtr, std::set<FeaturePtr> > aMainList;
563 findReferences(theFeatures, aMainList, theUseComposite, theUseRecursion, aRecLevel);
565 #ifdef DEBUG_REMOVE_FEATURES
566 printMapInfo(aMainList, "firstDependencies");
568 // find all dependencies for each object:
569 // sk_1(ext_1, vertex_1) + (sk_3, bool_1)
570 // ext_1(bool_1, sk_3)
572 // sk_2(ext_2) + (bool_1)
575 std::map<FeaturePtr, std::set<FeaturePtr> >::const_iterator aMainIt = aMainList.begin(),
576 aMainLast = aMainList.end();
577 for (; aMainIt != aMainLast; aMainIt++) {
578 FeaturePtr aMainListFeature = aMainIt->first;
580 //std::string aName = aMainListFeature->name();
581 std::set<FeaturePtr> aMainRefList = aMainIt->second;
583 #ifdef DEBUG_REMOVE_FEATURES_RECURSE
585 int n = sprintf(aBuf, "%d", aMainRefList.size());
586 std::string aSize(aBuf);
587 std::cout << "_findAllReferences for the Feature: " << getFeatureInfo(aMainListFeature)
588 << ", references size = " << aSize << std::endl;
590 std::set<FeaturePtr>::const_iterator anIt = aMainRefList.begin(),
591 aLast = aMainRefList.end();
592 std::set<FeaturePtr> aResultRefList;
593 aResultRefList.insert(aMainRefList.begin(), aMainRefList.end());
594 for (; anIt != aLast; anIt++) {
595 FeaturePtr aFeature = *anIt;
597 #ifdef DEBUG_REMOVE_FEATURES_RECURSE
598 std::cout << " Ref: " << getFeatureInfo(aFeature) << std::endl;
601 addRefsToFeature(aFeature, aMainList, theReferences, aRecLevel, aResultRefList/*aMainRefList*/);
603 theReferences[aMainListFeature] = aResultRefList;
605 #ifdef DEBUG_REMOVE_FEATURES_RECURSE
606 std::cout << std::endl;
609 #ifdef DEBUG_REMOVE_FEATURES
610 printMapInfo(theReferences, "allDependencies");
614 void findRefsToFeatures(const std::set<FeaturePtr>& theFeatures,
615 const std::map<FeaturePtr, std::set<FeaturePtr> >& theReferences,
616 std::set<FeaturePtr>& theFeaturesRefsTo)
618 std::set<FeaturePtr>::const_iterator anIt = theFeatures.begin(),
619 aLast = theFeatures.end();
620 for (; anIt != aLast; anIt++) {
621 FeaturePtr aFeature = *anIt;
622 if (theReferences.find(aFeature) == theReferences.end())
624 std::set<FeaturePtr> aRefList = theReferences.at(aFeature);
625 std::set<FeaturePtr>::const_iterator aRefIt = aRefList.begin(), aRefLast = aRefList.end();
626 for (; aRefIt != aRefLast; aRefIt++) {
627 FeaturePtr aRefFeature = *aRefIt;
628 CompositeFeaturePtr aComposite = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aRefFeature);
629 if (aComposite.get() && aComposite->isSub(aFeature))
630 continue; /// composite of the current feature should not be removed
632 if (theFeatures.find(aRefFeature) == theFeatures.end() && // it is not selected
633 theFeaturesRefsTo.find(aRefFeature) == theFeaturesRefsTo.end()) // it is not added
634 theFeaturesRefsTo.insert(aRefFeature);
639 } // namespace ModelAPI_Tools