From: vsv Date: Fri, 25 Jul 2014 07:37:11 +0000 (+0400) Subject: Editing of a sketcher result X-Git-Tag: V_0.4.4~148^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=82c210aaef021cf21d5ab7b318eaa7282acebddf;p=modules%2Fshaper.git Editing of a sketcher result --- diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index e3f4117e6..ba88c8251 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -346,28 +346,28 @@ void PartSet_Module::onCloseLocalContext() void PartSet_Module::onFeatureConstructed(ObjectPtr theFeature, int theMode) { -// bool isDisplay = theMode != PartSet_OperationSketchBase::FM_Hide; -// if (isDisplay) { - ModuleBase_Operation* aCurOperation = myWorkshop->operationMgr()->currentOperation(); - PartSet_OperationSketchBase* aPrevOp = dynamic_cast(aCurOperation); - if (aPrevOp) { - std::list aList = aPrevOp->subFeatures(); - XGUI_Displayer* aDisplayer = myWorkshop->displayer(); - std::list aModes = aPrevOp->getSelectionModes(aPrevOp->feature()); - std::list::iterator aSFIt; - for (aSFIt = aList.begin(); aSFIt != aList.end(); ++aSFIt) { - std::list aResults = (*aSFIt)->results(); - std::list::iterator aIt; - for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) { + bool isDisplay = theMode != PartSet_OperationSketchBase::FM_Hide; + ModuleBase_Operation* aCurOperation = myWorkshop->operationMgr()->currentOperation(); + PartSet_OperationSketchBase* aPrevOp = dynamic_cast(aCurOperation); + if (aPrevOp) { + std::list aList = aPrevOp->subFeatures(); + XGUI_Displayer* aDisplayer = myWorkshop->displayer(); + std::list aModes = aPrevOp->getSelectionModes(aPrevOp->feature()); + std::list::iterator aSFIt; + for (aSFIt = aList.begin(); aSFIt != aList.end(); ++aSFIt) { + std::list aResults = (*aSFIt)->results(); + std::list::iterator aIt; + for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) { + if (isDisplay) aDisplayer->activateInLocalContext((*aIt), aModes, false); - } + else + aDisplayer->erase((*aIt), false); } } + } + if (isDisplay) ModelAPI_EventCreator::get()->sendUpdated(theFeature, Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)); -// } -// else -// ->erase(theFeature->firstResult(), true); /* bool isDisplay = theMode != PartSet_OperationSketchBase::FM_Hide; // TODO visualizePreview(theFeature, isDisplay, false); if (!isDisplay) { @@ -543,8 +543,13 @@ void PartSet_Module::updateCurrentPreview(const std::string& theCmdId) boost::dynamic_pointer_cast(*anIt); if (!aSPFeature) continue; - //visualizePreview((*anIt), true, false); - aDisplayer->activateInLocalContext((*anIt), aModes, false); + std::list aResults = aSPFeature->results(); + std::list::const_iterator aRIt; + for (aRIt = aResults.cbegin(); aRIt != aResults.cend(); ++aRIt) { + aDisplayer->display((*aRIt), false); + aDisplayer->activateInLocalContext((*aRIt), aModes, false); + } + aDisplayer->display(aSPFeature, false); } aDisplayer->updateViewer(); } diff --git a/src/PartSet/PartSet_OperationSketch.cpp b/src/PartSet/PartSet_OperationSketch.cpp index 5adc7e035..81ba69a07 100644 --- a/src/PartSet/PartSet_OperationSketch.cpp +++ b/src/PartSet/PartSet_OperationSketch.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -21,6 +22,7 @@ #include #include +#include #include #include @@ -163,6 +165,16 @@ void PartSet_OperationSketch::stopOperation() PartSet_OperationSketchBase::stopOperation(); emit featureConstructed(feature(), FM_Hide); emit closeLocalContext(); + + FeaturePtr aFeature = feature(); + std::list aResults = aFeature->results(); + std::list::const_iterator aIt; + for (aIt = aResults.cbegin(); aIt != aResults.cend(); ++aIt) { + ModelAPI_EventCreator::get()->sendUpdated(*aIt, + Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)); + } + //ModelAPI_EventCreator::get()->sendUpdated(aFeature, + // Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)); } bool PartSet_OperationSketch::isNestedOperationsEnabled() const diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index 38f6181fc..f51afd3a9 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -89,7 +89,7 @@ void XGUI_Displayer::erase(ObjectPtr theObject, const bool isUpdateViewer) if (anObject) { Handle(AIS_InteractiveObject) anAIS = anObject->impl(); if (!anAIS.IsNull()) { - aContext->Erase(anAIS, isUpdateViewer); + aContext->Remove(anAIS, isUpdateViewer); } } myResult2AISObjectMap.erase(theObject); @@ -299,7 +299,7 @@ void XGUI_Displayer::eraseDeletedResults(const bool isUpdateViewer) if (!anObj) continue; Handle(AIS_InteractiveObject) anAIS = anObj->impl(); if (!anAIS.IsNull()) { - aContext->Erase(anAIS, false); + aContext->Remove(anAIS, false); aRemoved.push_back(aFeature); } }