From: vsv Date: Wed, 23 Jul 2014 08:47:22 +0000 (+0400) Subject: Bug fixing in sketcher X-Git-Tag: V_0.4.4~159 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3d00b7684133645b3022a459106100f59adb3459;p=modules%2Fshaper.git Bug fixing in sketcher --- diff --git a/src/ModelAPI/ModelAPI_Feature.cpp b/src/ModelAPI/ModelAPI_Feature.cpp index de34edd0a..fa4651408 100644 --- a/src/ModelAPI/ModelAPI_Feature.cpp +++ b/src/ModelAPI/ModelAPI_Feature.cpp @@ -33,7 +33,8 @@ void ModelAPI_Feature::setResult(const boost::shared_ptr& theRe myResults.push_back(theResult); static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_CREATED); ModelAPI_EventCreator::get()->sendUpdated(theResult, anEvent); - //TODO VSV:Create event for first Feature Events_Loop::loop()->flush(anEvent); + // Create event for first Feature + Events_Loop::loop()->flush(anEvent); } boost::shared_ptr ModelAPI_Feature::documentToAdd() diff --git a/src/PartSet/PartSet_Listener.cpp b/src/PartSet/PartSet_Listener.cpp index 7cef128b1..0f60b0c80 100644 --- a/src/PartSet/PartSet_Listener.cpp +++ b/src/PartSet/PartSet_Listener.cpp @@ -5,9 +5,13 @@ #include #include +#include #include #include +#include + +#include #include #include @@ -24,7 +28,7 @@ PartSet_Listener::PartSet_Listener(PartSet_Module* theModule) : myModule(theModule) { Events_Loop* aLoop = Events_Loop::loop(); - aLoop->registerListener(this, aLoop->eventByName(EVENT_OBJECT_UPDATED)); + //aLoop->registerListener(this, aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY)); aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_CREATED)); aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_DELETED)); } @@ -36,28 +40,26 @@ PartSet_Listener::~PartSet_Listener() //****************************************************** void PartSet_Listener::processEvent(const Events_Message* theMessage) { + ModuleBase_Operation* anOperation = myModule->workshop()->operationMgr()->currentOperation(); + PartSet_OperationSketchBase* aSketchOp = dynamic_cast(anOperation); + if (!aSketchOp) + return; + + XGUI_Displayer* aDisplayer = myModule->workshop()->displayer(); QString aType = QString(theMessage->eventID().eventText()); - if (aType == EVENT_OBJECT_UPDATED || - aType == EVENT_OBJECT_CREATED) - { + if (aType == EVENT_OBJECT_CREATED) { const ModelAPI_ObjectUpdatedMessage* aUpdMsg = dynamic_cast(theMessage); std::set aFeatures = aUpdMsg->objects(); std::set::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end(); for (; anIt != aLast; anIt++) { - ObjectPtr aObject = *anIt; - FeaturePtr aFeature = boost::dynamic_pointer_cast(aObject); - if (aFeature) { - if (myModule->workshop()->displayer()->isVisible(aFeature->firstResult()) || - aType == EVENT_OBJECT_CREATED) { - myModule->activateFeature(aFeature, true); - // TODO myModule->visualizePreview(aFeature, true, false); - } - } + aDisplayer->deactivate(*anIt, false); + FeaturePtr aFeature = boost::dynamic_pointer_cast(*anIt); + if (aFeature) + myModule->activateFeature(aFeature, false); } - myModule->workshop()->displayer()->updateViewer(); - } - if (aType == EVENT_OBJECT_DELETED) { + + } else if (aType == EVENT_OBJECT_DELETED) { const ModelAPI_ObjectDeletedMessage* aDelMsg = dynamic_cast(theMessage); boost::shared_ptr aDoc = aDelMsg->document(); diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 91cb98096..99d36b0ad 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -360,7 +360,8 @@ void PartSet_Module::onFeatureConstructed(FeaturePtr theFeature, int theMode) aDisplayer->activateInLocalContext((*aIt), aModes, false); } } - FeaturePtr aFeature = aPrevOp->feature(); + } +/* FeaturePtr aFeature = aPrevOp->feature(); if (aFeature) { std::list aResList = aFeature->results(); std::list::iterator aIt; @@ -368,7 +369,7 @@ void PartSet_Module::onFeatureConstructed(FeaturePtr theFeature, int theMode) aDisplayer->deactivate((*aIt), false); } } - } + }*/ ModelAPI_EventCreator::get()->sendUpdated(theFeature, Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)); // } @@ -519,8 +520,8 @@ void PartSet_Module::activateFeature(ObjectPtr theFeature, const bool isUpdateVi PartSet_OperationSketchBase* aPreviewOp = dynamic_cast(anOperation); if (aPreviewOp) { XGUI_Displayer* aDisplayer = myWorkshop->displayer(); - aDisplayer->activateInLocalContext(theFeature, aPreviewOp->getSelectionModes(theFeature), - isUpdateViewer); + std::list aModes = aPreviewOp->getSelectionModes(theFeature); + aDisplayer->activateInLocalContext(theFeature, aModes, isUpdateViewer); } } diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index 704d5b2de..38f6181fc 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -183,6 +183,7 @@ void XGUI_Displayer::activateInLocalContext(ObjectPtr theResult, // Activate selection of objects from prs if (!anAIS.IsNull()) { aContext->ClearSelected(false); // ToCheck + //aContext->upClearSelected(false); // ToCheck aContext->Load(anAIS, -1, true/*allow decomposition*/); aContext->Deactivate(anAIS);