]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Make parts of compsolids unselectable if whole compsolid is selected
authordbv <dbv@opencascade.com>
Tue, 1 Sep 2015 13:07:08 +0000 (16:07 +0300)
committerdbv <dbv@opencascade.com>
Tue, 1 Sep 2015 13:07:08 +0000 (16:07 +0300)
src/PartSet/PartSet_Validators.cpp

index 613e41f3bf855d887194767f89e6ed4ed20e363f..6aac447811b27f04442305154d3ddb5068ef5fee 100755 (executable)
@@ -24,6 +24,7 @@
 #include <ModelAPI_AttributeRefList.h>
 #include <ModelAPI_Object.h>
 #include <ModelAPI_Session.h>
+#include <ModelAPI_Tools.h>
 
 #include <SketchPlugin_Sketch.h>
 #include <SketchPlugin_ConstraintCoincidence.h>
@@ -284,9 +285,25 @@ bool PartSet_DifferentObjectsValidator::isValid(const AttributePtr& theAttribute
             std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(*anAttrItr);
           for(int i = 0; i < aCurSelList->size(); i++) {
             std::shared_ptr<ModelAPI_AttributeSelection> aCurSel = aCurSelList->value(i);
+            ResultPtr aCurSelContext = aCurSel->context();
+            ResultCompSolidPtr aCurSelCompSolidPtr = ModelAPI_Tools::compSolidOwner(aCurSelContext);
+            std::shared_ptr<GeomAPI_Shape> aCurSelCompSolid;
+            if(aCurSelCompSolidPtr.get()) {
+              aCurSelCompSolid = aCurSelCompSolidPtr->shape();
+            }
             for(int j = 0; j < aRefSelList->size(); j++) {
               std::shared_ptr<ModelAPI_AttributeSelection> aRefSel = aRefSelList->value(j);
-              if(aCurSel->context() == aRefSel->context()) {
+              ResultPtr aRefSelContext = aRefSel->context();
+              ResultCompSolidPtr aRefSelCompSolidPtr = ModelAPI_Tools::compSolidOwner(aRefSelContext);
+              std::shared_ptr<GeomAPI_Shape> aRefSelCompSolid;
+              if(aRefSelCompSolidPtr.get()) {
+                aRefSelCompSolid = aRefSelCompSolidPtr->shape();
+              }
+              if((aCurSelCompSolid.get() && aCurSelCompSolid->isEqual(aRefSel->value()))
+                || (aRefSelCompSolid.get() && aRefSelCompSolid->isEqual(aCurSel->value()))) {
+                  return false;
+              }
+              if(aCurSelContext == aRefSelContext) {
                 if(aCurSel->value().get() == NULL || aRefSel->value().get() == NULL
                   || aCurSel->value()->isEqual(aRefSel->value())) {
                     return false;