From: nds Date: Fri, 21 Aug 2015 14:19:02 +0000 (+0300) Subject: Result compsolid should change the display flag of sub-results itself. X-Git-Tag: V_1.4.0_beta4~288 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1152a6ea27665deb0564e72c6c47ac10de91e5d9;p=modules%2Fshaper.git Result compsolid should change the display flag of sub-results itself. WorkshopListener in displayObject() should ignore the compsolid result and wait when sub-solid results comes in selection. onFeatureCreateMsg moving rows: 1.canBeDisplayed before setDisplayed, displayObject - this is a previous version. It is more correctly firstly change display state of the object and after try to display it in the viewer. It is possible that flag is switch on, but the object will be visualized during redisplay. --- diff --git a/src/ModelAPI/ModelAPI_ResultCompSolid.cpp b/src/ModelAPI/ModelAPI_ResultCompSolid.cpp index dc82ef393..68ba72f54 100755 --- a/src/ModelAPI/ModelAPI_ResultCompSolid.cpp +++ b/src/ModelAPI/ModelAPI_ResultCompSolid.cpp @@ -9,3 +9,10 @@ ModelAPI_ResultCompSolid::~ModelAPI_ResultCompSolid() { } + +void ModelAPI_ResultCompSolid::setDisplayed(const bool theDisplay) +{ + ModelAPI_ResultBody::setDisplayed(theDisplay); + for (int i = 0; i < numberOfSubs(); i++) + subResult(i)->setDisplayed(theDisplay); +} diff --git a/src/ModelAPI/ModelAPI_ResultCompSolid.h b/src/ModelAPI/ModelAPI_ResultCompSolid.h index 7f82615bc..678594277 100755 --- a/src/ModelAPI/ModelAPI_ResultCompSolid.h +++ b/src/ModelAPI/ModelAPI_ResultCompSolid.h @@ -33,6 +33,10 @@ public: /// Returns true if feature or reuslt belong to this composite feature as subs virtual bool isSub(ObjectPtr theObject) const = 0; + /// Set displayed flag to the result and all sub results + /// \param theDisplay a boolean value + MODELAPI_EXPORT virtual void setDisplayed(const bool theDisplay); + protected: }; diff --git a/src/ModuleBase/ModuleBase_Tools.cpp b/src/ModuleBase/ModuleBase_Tools.cpp index cf6f70d9b..e1b25b884 100755 --- a/src/ModuleBase/ModuleBase_Tools.cpp +++ b/src/ModuleBase/ModuleBase_Tools.cpp @@ -159,6 +159,8 @@ QString objectInfo(const ObjectPtr& theObj, const bool isUseAttributesInfo) aFeatureStr.append("[disabled]"); if (aRes->isConcealed()) aFeatureStr.append("[concealed]"); + if (ModelAPI_Tools::hasSubResults(aRes)) + aFeatureStr.append("[hasSubResults]"); aFeature = ModelAPI_Feature::feature(aRes); } diff --git a/src/XGUI/XGUI_ContextMenuMgr.cpp b/src/XGUI/XGUI_ContextMenuMgr.cpp index f3625a1f8..28bafc37e 100644 --- a/src/XGUI/XGUI_ContextMenuMgr.cpp +++ b/src/XGUI/XGUI_ContextMenuMgr.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -179,12 +180,19 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu() action("SHADING_CMD")->setEnabled(true); } if (!hasFeature) { - if (aObject->isDisplayed()) { + bool aHasSubResults = ModelAPI_Tools::hasSubResults( + std::dynamic_pointer_cast(aObject)); + if (aHasSubResults) { action("HIDE_CMD")->setEnabled(true); - } else if (hasResult && (!hasParameter)) { action("SHOW_CMD")->setEnabled(true); } - + else { + if (aObject->isDisplayed()) { + action("HIDE_CMD")->setEnabled(true); + } else if (hasResult && (!hasParameter)) { + action("SHOW_CMD")->setEnabled(true); + } + } if (!(hasParameter || hasFeature)) action("SHOW_ONLY_CMD")->setEnabled(true); } diff --git a/src/XGUI/XGUI_WorkshopListener.cpp b/src/XGUI/XGUI_WorkshopListener.cpp index 982765299..685961c46 100755 --- a/src/XGUI/XGUI_WorkshopListener.cpp +++ b/src/XGUI/XGUI_WorkshopListener.cpp @@ -225,7 +225,7 @@ void XGUI_WorkshopListener::onFeatureRedisplayMsg(const std::shared_ptrisVisible(aObj); #ifdef DEBUG_FEATURE_REDISPLAY QString anObjInfo = ModuleBase_Tools::objectInfo((aObj)); - qDebug(QString("visible=%1 : display= %2").arg(isVisibleObject).arg(anObjInfo).toStdString().c_str()); + //qDebug(QString("visible=%1 : display= %2").arg(isVisibleObject).arg(anObjInfo).toStdString().c_str()); /*FeaturePtr aFeature = std::dynamic_pointer_cast(aObj); if (aFeature.get()) { std::string aKind = aFeature->getKind(); @@ -298,7 +298,7 @@ void XGUI_WorkshopListener::onFeatureCreatedMsg(const std::shared_ptrmodule()->canDisplayObject(anObject)) { anObject->setDisplayed(true); + isDisplayed = displayObject(*aIt); } else anObject->setDisplayed(false); } @@ -429,8 +430,9 @@ void XGUI_WorkshopListener::addFeature(const std::shared_ptr(theObj)) || - !aWorkshop->module()->canDisplayObject(theObj)) + // do not display the object if it has sub objects. They should be displayed separately. + if (!aWorkshop->module()->canDisplayObject(theObj) || + ModelAPI_Tools::hasSubResults(std::dynamic_pointer_cast(theObj))) return false; XGUI_Displayer* aDisplayer = aWorkshop->displayer();