From: vsv Date: Mon, 9 Jun 2014 11:08:22 +0000 (+0400) Subject: Redisplay object on data modifications X-Git-Tag: V_0.4.4~302 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1fa6dbd795c151e4a78361f67b1b33e0ad4284fa;p=modules%2Fshaper.git Redisplay object on data modifications --- diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index fee4e4230..e588367b8 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -180,6 +180,21 @@ bool XGUI_Displayer::redisplay(FeaturePtr theFeature, return isCreated; } +void XGUI_Displayer::redisplay(FeaturePtr theFeature, bool isUpdateViewer) +{ + FeaturePtr aFeature = XGUI_Tools::realFeature(theFeature); + if (!isVisible(aFeature)) + return; + + Handle(AIS_InteractiveObject) aAISObj = getAISObject(aFeature); + boost::shared_ptr aShapePtr = aFeature->data()->shape(); + + Handle(AIS_Shape) aAISShape = Handle(AIS_Shape)::DownCast(aAISObj); + aAISShape->Set(aShapePtr->impl()); + + AISContext()->Redisplay(aAISShape); +} + void XGUI_Displayer::activateInLocalContext(FeaturePtr theFeature, const std::list& theModes, const bool isUpdateViewer) { diff --git a/src/XGUI/XGUI_Displayer.h b/src/XGUI/XGUI_Displayer.h index fdb8c7600..7ca8150ae 100644 --- a/src/XGUI/XGUI_Displayer.h +++ b/src/XGUI/XGUI_Displayer.h @@ -84,6 +84,12 @@ public: Handle(AIS_InteractiveObject) theAIS, const int theSelectionMode, const bool isUpdateViewer = true); + /** Redisplay the shape if it was displayed + * \param theFeature a feature instance + * \param isUpdateViewer the parameter whether the viewer should be update immediatelly + */ + void redisplay(FeaturePtr theFeature, bool isUpdateViewer = true); + /// Redisplay the shape and activate selection of sub-shapes /// \param theFeature a feature instance /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 0cbafb045..f038d3133 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -232,9 +232,12 @@ void XGUI_Workshop::processEvent(const Events_Message* theMessage) FeaturePtr aFeature = (*aIt); if (aFeature->getKind() == PARTSET_PART_KIND) { aHasPart = true; - break; + //break; + } else { + myDisplayer->display(aFeature, false); } } + myDisplayer->updateViewer(); if (aHasPart) { //The created part will be created in Object Browser later and we have to activate it // only when it is created everywere @@ -245,21 +248,31 @@ void XGUI_Workshop::processEvent(const Events_Message* theMessage) //Update property panel on corresponding message. If there is no current operation (no //property panel), or received message has different feature to the current - do nothing. static Events_ID aFeatureUpdatedId = Events_Loop::loop()->eventByName(EVENT_FEATURE_UPDATED); - if (theMessage->eventID() == aFeatureUpdatedId && myOperationMgr->hasOperation()) - { + if (theMessage->eventID() == aFeatureUpdatedId) { const Model_FeatureUpdatedMessage* anUpdateMsg = dynamic_cast(theMessage); - std::set aFeatures = anUpdateMsg->features(); - FeaturePtr aCurrentFeature = myOperationMgr->currentOperation()->feature(); + std::set aFeatures = anUpdateMsg->features(); + if (myOperationMgr->hasOperation()) + { + FeaturePtr aCurrentFeature = myOperationMgr->currentOperation()->feature(); + std::set::const_iterator aIt; + for (aIt = aFeatures.begin(); aIt != aFeatures.end(); ++aIt) { + FeaturePtr aNewFeature = (*aIt); + if(aNewFeature == aCurrentFeature) { + myPropertyPanel->updateContentWidget(aCurrentFeature); + break; + } + } + } + // Redisplay feature if it is modified std::set::const_iterator aIt; for (aIt = aFeatures.begin(); aIt != aFeatures.end(); ++aIt) { - FeaturePtr aNewFeature = (*aIt); - if(aNewFeature == aCurrentFeature) { - myPropertyPanel->updateContentWidget(aCurrentFeature); - break; - } + FeaturePtr aFeature = (*aIt); + if (aFeature->getKind() != PARTSET_PART_KIND) + myDisplayer->redisplay(aFeature, false); } + myDisplayer->updateViewer(); } //An operation passed by message. Start it, process and commit. const Config_PointerMessage* aPartSetMsg = dynamic_cast(theMessage);