From: dbv Date: Tue, 1 Sep 2015 13:07:08 +0000 (+0300) Subject: Make parts of compsolids unselectable if whole compsolid is selected X-Git-Tag: V_1.4.0_beta4~171 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d0642bd09b1add976c42787aed1513f599b40aab;p=modules%2Fshaper.git Make parts of compsolids unselectable if whole compsolid is selected --- diff --git a/src/PartSet/PartSet_Validators.cpp b/src/PartSet/PartSet_Validators.cpp index 613e41f3b..6aac44781 100755 --- a/src/PartSet/PartSet_Validators.cpp +++ b/src/PartSet/PartSet_Validators.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -284,9 +285,25 @@ bool PartSet_DifferentObjectsValidator::isValid(const AttributePtr& theAttribute std::dynamic_pointer_cast(*anAttrItr); for(int i = 0; i < aCurSelList->size(); i++) { std::shared_ptr aCurSel = aCurSelList->value(i); + ResultPtr aCurSelContext = aCurSel->context(); + ResultCompSolidPtr aCurSelCompSolidPtr = ModelAPI_Tools::compSolidOwner(aCurSelContext); + std::shared_ptr aCurSelCompSolid; + if(aCurSelCompSolidPtr.get()) { + aCurSelCompSolid = aCurSelCompSolidPtr->shape(); + } for(int j = 0; j < aRefSelList->size(); j++) { std::shared_ptr aRefSel = aRefSelList->value(j); - if(aCurSel->context() == aRefSel->context()) { + ResultPtr aRefSelContext = aRefSel->context(); + ResultCompSolidPtr aRefSelCompSolidPtr = ModelAPI_Tools::compSolidOwner(aRefSelContext); + std::shared_ptr 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;