]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2515 : optimization of working with folders from the Object Browser
authormpv <mpv@opencascade.com>
Fri, 13 Jul 2018 16:06:34 +0000 (19:06 +0300)
committermpv <mpv@opencascade.com>
Fri, 13 Jul 2018 16:06:34 +0000 (19:06 +0300)
src/Model/Model_Objects.cpp

index fe5ac904f254f5bce53f846db0e43d68b0a48841..ea15cc5df381011502c27c81cd1a217e58dadaee 100644 (file)
@@ -1732,14 +1732,25 @@ FolderPtr Model_Objects::findContainingFolder(const FeaturePtr& theFeature, int&
 
   for (int aRefIndex = aRefs->Lower(); aRefIndex <= aRefs->Upper(); ++aRefIndex) {
     TDF_Label aCurLabel = aRefs->Value(aRefIndex);
-    if (isSkippedFeature(feature(aCurLabel)))
-      continue;
 
     if (aFoundFolder)
       ++theIndexInFolder;
 
-    if (aCurLabel == aLabelToFind) // the feature is reached
+    if (aCurLabel == aLabelToFind) { // the feature is reached
+      if (aFoundFolder) {
+        if (isSkippedFeature(theFeature)) {
+          theIndexInFolder = -1;
+          return false;
+        }
+        // decrease the index of the feature in the folder by the number of skipped features
+        for (int anIndex = theIndexInFolder - 1; anIndex > 0; anIndex--) {
+          aCurLabel = aRefs->Value(aRefIndex - anIndex);
+          if (isSkippedFeature(feature(aCurLabel)))
+            theIndexInFolder--;
+        }
+      }
       return aFoundFolder;
+    }
 
     if (!aFoundFolder) {
       // if the current label refers to a folder, feel all necessary data