X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSet%2FPartSet_Listener.cpp;h=24c78b60faf03b8beb774960c21bfedaa1be99d0;hb=43780ffac779af7f061513b0f6243f2edb73602c;hp=f66ac66b4d4c9b85bf70c37870dbe73d5b2ecc92;hpb=2833d61c7ee9a9d8b3f212e8b06fbd5375197c0a;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_Listener.cpp b/src/PartSet/PartSet_Listener.cpp index f66ac66b4..24c78b60f 100644 --- a/src/PartSet/PartSet_Listener.cpp +++ b/src/PartSet/PartSet_Listener.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -16,6 +17,7 @@ #include #include +#include #ifdef _DEBUG #include @@ -39,12 +41,12 @@ PartSet_Listener::~PartSet_Listener() //****************************************************** void PartSet_Listener::processEvent(const boost::shared_ptr& theMessage) { - ModuleBase_Operation* anOperation = myModule->workshop()->operationMgr()->currentOperation(); + ModuleBase_Operation* anOperation = myModule->xWorkshop()->operationMgr()->currentOperation(); PartSet_OperationSketchBase* aSketchOp = dynamic_cast(anOperation); if (!aSketchOp) return; - XGUI_Displayer* aDisplayer = myModule->workshop()->displayer(); + XGUI_Displayer* aDisplayer = myModule->xWorkshop()->displayer(); QString aType = QString(theMessage->eventID().eventText()); if (aType == EVENT_OBJECT_CREATED) { boost::shared_ptr aUpdMsg = @@ -52,27 +54,41 @@ void PartSet_Listener::processEvent(const boost::shared_ptr& the std::set aFeatures = aUpdMsg->objects(); PartSet_OperationSketch* aSketchOp = - dynamic_cast(myModule->workshop()->operationMgr()->currentOperation()); + dynamic_cast(myModule->xWorkshop()->operationMgr()->currentOperation()); std::set::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end(); for (; anIt != aLast; anIt++) { ObjectPtr aObj = (*anIt); - aDisplayer->deactivate(aObj); - boost::shared_ptr aFeature = - boost::dynamic_pointer_cast(aObj); - if (aFeature && (aFeature->getKind() == "Sketch")) // Activate sketcher for planes selection - myModule->activateFeature(aFeature, false); // If current operation is Sketch then there is no active sketching operation - // and possible the object was created by Redo operatgion - else if (aSketchOp) { - XGUI_Displayer* aDisplayer = myModule->workshop()->displayer(); + // and possible the object was created by Redo operation + if (aSketchOp) { + XGUI_Displayer* aDisplayer = myModule->xWorkshop()->displayer(); // Very possible it is not displayed aDisplayer->display(aObj, false); - std::list aModes = aSketchOp->getSelectionModes(aObj); - aDisplayer->activateInLocalContext(aObj, aModes, false); } } + } else if (aType == EVENT_OBJECT_TO_REDISPLAY) { + PartSet_OperationFeatureCreate* aCreationOp = + dynamic_cast + (myModule->xWorkshop()->operationMgr()->currentOperation()); + if (aCreationOp) { + // Deactivate currently creating objects for selection + XGUI_Displayer* aDisplayer = myModule->xWorkshop()->displayer(); + FeaturePtr aFeature = aCreationOp->feature(); + const std::list& aResults = aFeature->results(); + boost::shared_ptr aUpdMsg = + boost::dynamic_pointer_cast(theMessage); + std::set aFeatures = aUpdMsg->objects(); + std::set::const_iterator aObjIt, aNoObj = aFeatures.cend(); + std::list::const_iterator anIt = aResults.begin(), aLast = aResults.end(); + for (; anIt != aLast; anIt++) { + aObjIt = aFeatures.find(*anIt); + if (aObjIt != aNoObj) { + aDisplayer->deactivate(*aObjIt); + } + } + } } else if (aType == EVENT_OBJECT_DELETED) { boost::shared_ptr aDelMsg = boost::dynamic_pointer_cast(theMessage); @@ -83,7 +99,7 @@ void PartSet_Listener::processEvent(const boost::shared_ptr& the for (; anIt != aLast; anIt++) { std::string aGroup = *anIt; if (aGroup.compare(SketchPlugin_Sketch::ID()) == 0) { // Update only Sketch group - myModule->workshop()->displayer()->eraseDeletedResults(); + myModule->xWorkshop()->displayer()->eraseDeletedResults(); myModule->updateCurrentPreview(aGroup); } }