- // the validity of the data should be checked here in order to avoid display of the objects,
- // which were created, then deleted, but flush for the creation event happens after that
- // we should not display disabled objects
- bool aHide = !anObject->data()->isValid() ||
- anObject->isDisabled() ||
- !anObject->isDisplayed();
- if (!aHide) { // check that this is not hidden result
- ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
- bool isConcealed = aRes && aRes->isConcealed();
- aHide = aRes && aRes->isConcealed();
- // Hide the presentation with an empty shape. But isDisplayed state of the object should not
- // be changed to the object becomes visible when the shape becomes not empty
- if (!aHide && aRes.get())
- aHide = !aRes->shape().get() || aRes->shape()->isNull();
- }
- if (!aHide) {
- // setDisplayed has to be called in order to synchronize internal state of the object
- // with list of displayed objects
- if (myWorkshop->module()->canDisplayObject(anObject)) {
- anObject->setDisplayed(true);
- aDisplayed = displayObject(anObject);
- if (aDisplayed)
- aDoFitAll = aDoFitAll || neededFitAll(anObject, aNbOfShownObjects);
-
- // workaround for #1750: sub results should be sent here to be displayed
- FeaturePtr anObjectFeature = ModelAPI_Feature::feature(anObject);
- if (anObjectFeature.get() && anObjectFeature->getKind() == "Partition") {
- XGUI_OperationMgr* anOperationMgr = workshop()->operationMgr();
- if (anOperationMgr->hasOperation()) {
- ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
- (anOperationMgr->currentOperation());
- if (aFOperation && aFOperation->isEditOperation() &&
- aFOperation->id() == "Remove_SubShapes") {
- ResultCompSolidPtr aCompsolidResult =
- std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(anObject);
- if (aCompsolidResult.get() != NULL) { // display all sub results
- for(int i = 0; i < aCompsolidResult->numberOfSubs(); i++) {
- ObjectPtr aSubObject = aCompsolidResult->subResult(i);
- aSubObject->setDisplayed(true);
- aDisplayed = displayObject(aSubObject);
- if (aDisplayed)
- aDoFitAll = aDoFitAll || neededFitAll(aSubObject, aNbOfShownObjects);
- }
- }
- }
- }
- }
- } else
- anObject->setDisplayed(false);
- }
+
+ ResultBodyPtr aRes = std::dynamic_pointer_cast<ModelAPI_ResultBody>(anObject);
+ if (aRes.get() && aRes->numberOfSubs() > 0)
+ for (int anIndex = 0; anIndex < aRes->numberOfSubs(); ++anIndex)
+ setDisplayed(aRes->subResult(anIndex), isLoadedScript, aDisplayed);
+ else
+ setDisplayed(anObject, isLoadedScript, aDisplayed);