Salome HOME
Fix selection of non-visible features. V9_4_0a2
authorvsv <vsv@opencascade.com>
Wed, 9 Oct 2019 09:06:30 +0000 (12:06 +0300)
committervsv <vsv@opencascade.com>
Wed, 9 Oct 2019 09:06:30 +0000 (12:06 +0300)
src/ModuleBase/ModuleBase_ISelection.cpp
src/ModuleBase/ModuleBase_WidgetValidated.cpp

index 73999c6011f5549c3cdab609edfd8b749720be8c..635991721be9e7b932cd8e82097bb06b396416fe 100644 (file)
@@ -20,6 +20,7 @@
 #include "ModuleBase_ISelection.h"
 
 #include "ModuleBase_ViewerPrs.h"
+#include "ModelAPI_Feature.h"
 
 #include <StdSelect_BRepOwner.hxx>
 #include <TopoDS_Vertex.hxx>
@@ -53,8 +54,16 @@ ResultPtr ModuleBase_ISelection::getResult(const ModuleBase_ViewerPrsPtr& thePrs
 {
   ResultPtr aResult;
 
-  if (thePrs->object().get())
-    aResult = std::dynamic_pointer_cast<ModelAPI_Result>(thePrs->object());
+  if (thePrs->object().get()) {
+    ObjectPtr aObject = thePrs->object();
+    aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aObject);
+    if (!aResult.get()) {
+      FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObject);
+      if (aFeature.get()) {
+        aResult = aFeature->firstResult();
+      }
+    }
+  }
   else if (!thePrs->owner().IsNull()) {
     ObjectPtr anObject = getSelectableObject(thePrs->owner());
     aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
index a11c8c2018417011425d6a5c871609c4785f6ac3..bd9cdbd76b9a019995b20b451caf0bcbdcfa4767 100644 (file)
@@ -107,7 +107,7 @@ bool ModuleBase_WidgetValidated::isValidInFilters(const ModuleBase_ViewerPrsPtr&
 
   // if an owner is null, the selection happens in the Object browser.
   // creates a selection owner on the base of object shape and the object AIS object
-  if ((aOwnersList.Size() > 0) && thePrs->object().get()) {
+  if ((aOwnersList.Size() == 0) && thePrs->object().get()) {
     ResultPtr aResult = myWorkshop->selection()->getResult(thePrs);
     GeomShapePtr aShape = aResult.get() ? aResult->shape() : GeomShapePtr();
     // some results have no shape, e.g. the parameter one. So, they should not be validated