Salome HOME
Issue #2429 Regression : the preselection of a sketch is not taken into account
authornds <nds@opencascade.com>
Thu, 1 Feb 2018 08:19:22 +0000 (11:19 +0300)
committernds <nds@opencascade.com>
Thu, 1 Feb 2018 08:19:22 +0000 (11:19 +0300)
src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp

index 2edc3bc50a2131f7e39134156534afa17fa15974..b1bb3b048cfd35e3b84953795e9e507672479cc1 100755 (executable)
@@ -929,8 +929,13 @@ bool ModuleBase_WidgetMultiSelector::findInSelection(const ObjectPtr& theObject,
     return true;
 
   bool aFound = false;
-  GeomShapePtr anEmptyShape(new GeomAPI_Shape());
-  GeomShapePtr aShape = theShape.get() ? theShape : anEmptyShape;
+  GeomShapePtr aShape = theShape;
+  if (!aShape.get()) {
+    // #2429 (the preselection of a sketch is not taken into account)
+    ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
+    if (aResult.get())
+      aShape = aResult->shape();
+  }
   if (theGeomSelection.find(theObject) != theGeomSelection.end()) {// found
     const std::set<GeomShapePtr>& aShapes = theGeomSelection.at(theObject);
     std::set<GeomShapePtr>::const_iterator anIt = aShapes.begin(), aLast = aShapes.end();