]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #3005: Accept whole result for selection
authorvsv <vsv@opencascade.com>
Wed, 11 Sep 2019 09:09:11 +0000 (12:09 +0300)
committervsv <vsv@opencascade.com>
Wed, 11 Sep 2019 09:09:11 +0000 (12:09 +0300)
src/ModuleBase/ModuleBase_WidgetSelector.cpp
src/ModuleBase/ModuleBase_WidgetSelector.h

index 7d701aaf55616c5e93f9c54a17a02be658caf427..59e836e47229cbfd0d4da1051a68ad8d2b53e37b 100644 (file)
@@ -209,7 +209,9 @@ bool ModuleBase_WidgetSelector::isValidSelectionCustom(const ModuleBase_ViewerPr
 {
   GeomShapePtr aShape = myWorkshop->selection()->getShape(thePrs);
   ResultPtr aResult = myWorkshop->selection()->getResult(thePrs);
-  bool aValid = acceptSubShape(aShape, aResult);
+  bool aValid = aResult.get();
+  if (!isWholeResultAllowed())
+    aValid = acceptSubShape(aShape, aResult);
 
   if (aValid) {
     // In order to avoid selection of the same object
@@ -252,3 +254,16 @@ void ModuleBase_WidgetSelector::deactivate()
     aSelectAttr->removeTemporaryValues();
   }
 }
+
+//********************************************************************
+bool ModuleBase_WidgetSelector::isWholeResultAllowed() const
+{
+  AttributePtr anAttribute = attribute();
+  if (anAttribute.get()) {
+    AttributeSelectionListPtr aSelAttr =
+      std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(anAttribute);
+    if (aSelAttr.get())
+      return aSelAttr->isWholeResultAllowed();
+  }
+  return false;
+}
index 904647f760a65d72f33e831b3830b28d7739a801..b8e8816347ce46138291dd9a84a3efc861a78a05 100644 (file)
@@ -81,6 +81,8 @@ Q_OBJECT
   /// a shape. If the attribute do not uses the shape, it is empty
   virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>> getAttributeSelection() const;
 
+  virtual bool isWholeResultAllowed() const;
+
 protected:
   /// Returns true if envent is processed. The default implementation is empty, returns false.
   virtual bool processSelection();