From: mpv Date: Thu, 20 Aug 2015 08:19:16 +0000 (+0300) Subject: Make concealment of results working on compsolids: if at least one sub-body is concea... X-Git-Tag: V_1.4.0_beta4~327 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=74e9ba33303efc2282db1261706e904efa36b255;p=modules%2Fshaper.git Make concealment of results working on compsolids: if at least one sub-body is concealed, the whole compsolid is concealed --- diff --git a/src/Model/Model_Objects.cpp b/src/Model/Model_Objects.cpp index 49e922a80..8e1354f36 100644 --- a/src/Model/Model_Objects.cpp +++ b/src/Model/Model_Objects.cpp @@ -688,10 +688,24 @@ void Model_Objects::synchronizeBackRefs() for (; aRIter != aResults.cend(); aRIter++) { std::shared_ptr aResData = std::dynamic_pointer_cast((*aRIter)->data()); - if (aResData) { + if (aResData.get()) { aConcealed.push_back(std::pair(*aRIter, (*aRIter)->isConcealed())); aResData->eraseBackReferences(); } + // iterate sub-bodies of compsolid + ResultCompSolidPtr aComp = std::dynamic_pointer_cast(*aRIter); + if (aComp.get()) { + int aNumSub = aComp->numberOfSubs(); + for(int a = 0; a < aNumSub; a++) { + ResultPtr aSub = aComp->subResult(a); + std::shared_ptr aResData = + std::dynamic_pointer_cast(aSub->data()); + if (aResData.get()) { + aConcealed.push_back(std::pair(aSub, aSub->isConcealed())); + aResData->eraseBackReferences(); + } + } + } } } diff --git a/src/Model/Model_ResultCompSolid.cpp b/src/Model/Model_ResultCompSolid.cpp index 577bf7074..45dc68ae5 100755 --- a/src/Model/Model_ResultCompSolid.cpp +++ b/src/Model/Model_ResultCompSolid.cpp @@ -96,6 +96,17 @@ bool Model_ResultCompSolid::setDisabled(std::shared_ptr theThis return aChanged; } +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; +} + void Model_ResultCompSolid::updateSubs(const std::shared_ptr& theThisShape) { // iterate all sub-solids of compsolid to make sub-results synchronized with them diff --git a/src/Model/Model_ResultCompSolid.h b/src/Model/Model_ResultCompSolid.h index 355be5721..152ef4bba 100755 --- a/src/Model/Model_ResultCompSolid.h +++ b/src/Model/Model_ResultCompSolid.h @@ -60,6 +60,8 @@ public: MODEL_EXPORT virtual bool setDisabled(std::shared_ptr theThis, const bool theFlag); + /// The compsolid is concealed if at least one of the sub is concealed + MODEL_EXPORT virtual bool isConcealed(); protected: /// Makes a body on the given feature Model_ResultCompSolid();