From: vsv Date: Tue, 19 May 2015 14:10:50 +0000 (+0300) Subject: Using of isDisplayed status of object X-Git-Tag: V_1.2.0~140^2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=557572119d8a95349c9a3895a3b972b426e4684a;p=modules%2Fshaper.git Using of isDisplayed status of object --- diff --git a/src/ModelAPI/ModelAPI_Object.h b/src/ModelAPI/ModelAPI_Object.h index e755f532d..9d1d04c39 100644 --- a/src/ModelAPI/ModelAPI_Object.h +++ b/src/ModelAPI/ModelAPI_Object.h @@ -66,6 +66,15 @@ class ModelAPI_Object /// To use virtuality for destructors MODELAPI_EXPORT virtual ~ModelAPI_Object(); + /// Returns true if object must be displayed in the viewer: flag is stored in the + /// data model, so on undo/redo, open/save or recreation of object by history-playing it keeps + /// the original state i nthe current transaction. + MODELAPI_EXPORT virtual bool isDisplayed(); + + /// Sets the displayed/hidden state of the object. If it is changed, sends the "redisplay" + /// signal. + MODELAPI_EXPORT virtual void setDisplayed(const bool theDisplay); + protected: /// Sets the data manager of an object (document does) MODELAPI_EXPORT virtual void setData(std::shared_ptr theData); @@ -76,15 +85,6 @@ class ModelAPI_Object /// removes all fields from this feature MODELAPI_EXPORT virtual void erase(); - /// Returns true if object must be displayed in the viewer: flag is stored in the - /// data model, so on undo/redo, open/save or recreation of object by history-playing it keeps - /// the original state i nthe current transaction. - MODELAPI_EXPORT virtual bool isDisplayed(); - - /// Sets the displayed/hidden state of the object. If it is changed, sends the "redisplay" - /// signal. - MODELAPI_EXPORT virtual void setDisplayed(const bool theDisplay); - friend class Model_Objects; }; diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 81604d8aa..f1b617d85 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -466,7 +466,8 @@ void XGUI_Workshop::onFeatureRedisplayMsg(const std::shared_ptrdata() || !aObj->data()->isValid() || aObj->isDisabled(); + bool aHide = !aObj->data() || !aObj->data()->isValid() || + aObj->isDisabled() || (!aObj->isDisplayed()); if (!aHide) { // check that this is not hidden result ResultPtr aRes = std::dynamic_pointer_cast(aObj); aHide = aRes && aRes->isConcealed(); @@ -494,14 +495,14 @@ void XGUI_Workshop::onFeatureRedisplayMsg(const std::shared_ptrdeactivate(aObj); } } else { // display object if the current operation has it - ModuleBase_Operation* aOperation = myOperationMgr->currentOperation(); - if (aOperation && aOperation->hasObject(aObj)) { + if (displayObject(aObj)) { ModuleBase_Operation* aOperation = myOperationMgr->currentOperation(); - #ifdef DEBUG_FEATURE_REDISPLAY - QString anObjInfo = ModuleBase_Tools::objectInfo((aObj)); - qDebug(QString(" display object = %1").arg(anObjInfo).toStdString().c_str()); - #endif - if (displayObject(aObj)) { + if (aOperation && aOperation->hasObject(aObj)) { + ModuleBase_Operation* aOperation = myOperationMgr->currentOperation(); + #ifdef DEBUG_FEATURE_REDISPLAY + QString anObjInfo = ModuleBase_Tools::objectInfo((aObj)); + qDebug(QString(" display object = %1").arg(anObjInfo).toStdString().c_str()); + #endif // Deactivate object of current operation from selection if (myDisplayer->isActive(aObj)) myDisplayer->deactivate(aObj); @@ -1507,15 +1508,17 @@ void XGUI_Workshop::changeColor(const QObjectPtrList& theObjects) //************************************************************** void XGUI_Workshop::showObjects(const QObjectPtrList& theList, bool isVisible) { - foreach (ObjectPtr aObj, theList) - { + foreach (ObjectPtr aObj, theList) { if (isVisible) { - displayObject(aObj); + aObj->setDisplayed(true); + //displayObject(aObj); } else { - myDisplayer->erase(aObj, false); + aObj->setDisplayed(false); + //myDisplayer->erase(aObj, false); } } - myDisplayer->updateViewer(); + Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + //myDisplayer->updateViewer(); } //************************************************************** @@ -1558,8 +1561,10 @@ void XGUI_Workshop::displayDocumentResults(DocumentPtr theDoc) //************************************************************** void XGUI_Workshop::displayGroupResults(DocumentPtr theDoc, std::string theGroup) { - for (int i = 0; i < theDoc->size(theGroup); i++) - displayObject(theDoc->object(theGroup, i)); + for (int i = 0; i < theDoc->size(theGroup); i++) + theDoc->object(theGroup, i)->setDisplayed(true); + //displayObject(theDoc->object(theGroup, i)); + Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); } //**************************************************************