From: mpv Date: Thu, 27 Aug 2015 09:11:13 +0000 (+0300) Subject: Fix for the problem that selection of sub-elements of compsolids for concealment... X-Git-Tag: V_1.4.0_beta4~228^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=600b4ff382e080655a45b175a288e131eb9bc350;p=modules%2Fshaper.git Fix for the problem that selection of sub-elements of compsolids for concealment operation not erased the other sub-solids in the viewer --- diff --git a/src/Model/Model_ResultCompSolid.cpp b/src/Model/Model_ResultCompSolid.cpp index 16fda2569..633e8cd08 100755 --- a/src/Model/Model_ResultCompSolid.cpp +++ b/src/Model/Model_ResultCompSolid.cpp @@ -23,7 +23,8 @@ Model_ResultCompSolid::Model_ResultCompSolid() { myBuilder = new Model_BodyBuilder(this); - setIsConcealed(false); + myLastConcealed = false; + setIsConcealed(myLastConcealed); myIsDisabled = true; // by default it is not initialized and false to be after created updateSubs(shape()); // in case of open, etc. } @@ -99,13 +100,20 @@ bool Model_ResultCompSolid::setDisabled(std::shared_ptr theThis bool Model_ResultCompSolid::isConcealed() { - if (ModelAPI_ResultCompSolid::isConcealed()) - return true; - std::vector >::const_iterator aSubIter = mySubs.cbegin(); - for(; aSubIter != mySubs.cend(); aSubIter++) - if ((*aSubIter)->isConcealed()) - return true; - return false; + bool aResult = false;; + if (ModelAPI_ResultCompSolid::isConcealed()) { + aResult = true; + } else { + std::vector >::const_iterator aSubIter = mySubs.cbegin(); + for(; aSubIter != mySubs.cend(); aSubIter++) + if ((*aSubIter)->isConcealed()) + aResult = true; + } + if (myLastConcealed != aResult) { + myLastConcealed = aResult; + setIsConcealed(aResult); // set for all subs the same result + } + return aResult; } void Model_ResultCompSolid::setIsConcealed(const bool theValue) @@ -160,6 +168,7 @@ void Model_ResultCompSolid::updateSubs(const std::shared_ptr& the aECreator->sendUpdated(aSub, EVENT_UPD); } aSub->setDisabled(aSub, isDisabled()); + aSub->setIsConcealed(myLastConcealed); } // erase left, unused results while(mySubs.size() > aSubIndex) { diff --git a/src/Model/Model_ResultCompSolid.h b/src/Model/Model_ResultCompSolid.h index 3f228b388..21fb163b9 100755 --- a/src/Model/Model_ResultCompSolid.h +++ b/src/Model/Model_ResultCompSolid.h @@ -21,6 +21,10 @@ class Model_ResultCompSolid : public ModelAPI_ResultCompSolid { /// Sub-bodies if this is compsolid: zero base index to subs std::vector > mySubs; + /// Flag that stores the previous state of "concealed": if it is changed, + /// The event must be generated to redisplay this and all subs. + bool myLastConcealed; + public: