Salome HOME
Issue #2422 Filling: selection with Shift clears selection attribute
authornds <nds@opencascade.com>
Wed, 24 Jan 2018 12:48:52 +0000 (15:48 +0300)
committernds <nds@opencascade.com>
Wed, 24 Jan 2018 12:49:20 +0000 (15:49 +0300)
src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp

index 6336f5f3e672b725dcb2ee8a3b372e221fec2271..2edc3bc50a2131f7e39134156534afa17fa15974 100755 (executable)
@@ -929,12 +929,6 @@ bool ModuleBase_WidgetMultiSelector::findInSelection(const ObjectPtr& theObject,
     return true;
 
   bool aFound = false;
-  if (theShape.get()) { // treat shape equal to context as null: 2219, keep order of shapes in list
-    const ResultPtr aContext = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
-    if (aContext.get() && aContext->shape()->isEqual(theShape))
-      theShape.reset();
-  }
-
   GeomShapePtr anEmptyShape(new GeomAPI_Shape());
   GeomShapePtr aShape = theShape.get() ? theShape : anEmptyShape;
   if (theGeomSelection.find(theObject) != theGeomSelection.end()) {// found
@@ -943,7 +937,16 @@ bool ModuleBase_WidgetMultiSelector::findInSelection(const ObjectPtr& theObject,
     for (; anIt != aLast && !aFound; anIt++) {
       GeomShapePtr aCShape = *anIt;
       if (aCShape.get())
+      {
+        // treat shape equal to context as null: 2219, keep order of shapes in list
+        if (aCShape->isNull()) { // in selection, shape of result is equal to selected shape
+          // if so, here we need to check shape of result
+          ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
+          if (aResult.get())
+            aCShape = aResult->shape();
+        }
         aFound = aCShape->isSame(aShape);
+      }
     }
   }