for (; aRIter != aResults.cend(); aRIter++) {
std::shared_ptr<Model_Data> aResData =
std::dynamic_pointer_cast<Model_Data>((*aRIter)->data());
- if (aResData) {
+ if (aResData.get()) {
aConcealed.push_back(std::pair<ResultPtr, bool>(*aRIter, (*aRIter)->isConcealed()));
aResData->eraseBackReferences();
}
+ // iterate sub-bodies of compsolid
+ ResultCompSolidPtr aComp = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(*aRIter);
+ if (aComp.get()) {
+ int aNumSub = aComp->numberOfSubs();
+ for(int a = 0; a < aNumSub; a++) {
+ ResultPtr aSub = aComp->subResult(a);
+ std::shared_ptr<Model_Data> aResData =
+ std::dynamic_pointer_cast<Model_Data>(aSub->data());
+ if (aResData.get()) {
+ aConcealed.push_back(std::pair<ResultPtr, bool>(aSub, aSub->isConcealed()));
+ aResData->eraseBackReferences();
+ }
+ }
+ }
}
}
return aChanged;
}
+bool Model_ResultCompSolid::isConcealed()
+{
+ if (ModelAPI_ResultCompSolid::isConcealed())
+ return true;
+ std::vector<std::shared_ptr<ModelAPI_ResultBody> >::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<GeomAPI_Shape>& theThisShape)
{
// iterate all sub-solids of compsolid to make sub-results synchronized with them
MODEL_EXPORT virtual bool setDisabled(std::shared_ptr<ModelAPI_Result> 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();