From: nds Date: Thu, 22 May 2014 11:49:33 +0000 (+0400) Subject: Implementation of mechanism of grouping of messages X-Git-Tag: V_0.2~26^2~1^2^2~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=aa741c627dfec4625f6fd560eb3b3711ed7a9c3c;p=modules%2Fshaper.git Implementation of mechanism of grouping of messages Compillation correction --- diff --git a/src/Model/Model_Events.h b/src/Model/Model_Events.h index 0e750f5a6..4423238e0 100644 --- a/src/Model/Model_Events.h +++ b/src/Model/Model_Events.h @@ -22,7 +22,7 @@ static const char * EVENT_FEATURE_UPDATED = "FeatureUpdated"; /// Event ID that data of feature is deleted (comes with Model_FeatureDeletedMessage) static const char * EVENT_FEATURE_DELETED = "FeatureDeleted"; /// Event ID that data of feature is updated (comes with Model_FeaturesMovedMessage) -static const char * EVENT_FEATURES_MOVED = "FeaturesMoved"; +static const char * EVENT_FEATURE_MOVED = "FeaturesMoved"; /// Message that feature was changed (used for Object Browser update): moved, updated and deleted class Model_FeatureUpdatedMessage : public Events_MessageGroup { diff --git a/src/PartSet/PartSet_Listener.cpp b/src/PartSet/PartSet_Listener.cpp index 06af416d2..355142a31 100644 --- a/src/PartSet/PartSet_Listener.cpp +++ b/src/PartSet/PartSet_Listener.cpp @@ -37,24 +37,34 @@ void PartSet_Listener::processEvent(const Events_Message* theMessage) if (aType == EVENT_FEATURE_UPDATED || aType == EVENT_FEATURE_CREATED) { - const Model_FeatureUpdatedMessage* aUpdMsg = dynamic_cast(theMessage); - boost::shared_ptr aFeature = aUpdMsg->feature(); - if (myModule->workshop()->displayer()->IsVisible(aFeature) || - aType == EVENT_FEATURE_CREATED) { - myModule->visualizePreview(aFeature, true, false); - myModule->activateFeature(aFeature, true); - myModule->workshop()->displayer()->UpdateViewer(); + const Model_FeatureUpdatedMessage* aUpdMsg = dynamic_cast + (theMessage); + std::set > aFeatures = aUpdMsg->features(); + std::set >::const_iterator anIt = aFeatures.begin(), + aLast = aFeatures.end(); + for (; anIt != aLast; anIt++) { + boost::shared_ptr aFeature = *anIt; + if (myModule->workshop()->displayer()->IsVisible(aFeature) || + aType == EVENT_FEATURE_CREATED) { + myModule->visualizePreview(aFeature, true, false); + myModule->activateFeature(aFeature, true); + } } + myModule->workshop()->displayer()->UpdateViewer(); } if (aType == EVENT_FEATURE_DELETED) { const Model_FeatureDeletedMessage* aDelMsg = dynamic_cast(theMessage); boost::shared_ptr aDoc = aDelMsg->document(); - std::string aGroup = aDelMsg->group(); - if (aDelMsg->group().compare("Sketch") == 0) { // Update only Sketch group - myModule->workshop()->displayer()->EraseDeletedFeatures(); - myModule->updateCurrentPreview(aGroup); + std::set aGroups = aDelMsg->groups(); + std::set::const_iterator anIt = aGroups.begin(), aLast = aGroups.end(); + for (; anIt != aLast; anIt++) { + std::string aGroup = *anIt; + if (aGroup.compare("Sketch") == 0) { // Update only Sketch group + myModule->workshop()->displayer()->EraseDeletedFeatures(); + myModule->updateCurrentPreview(aGroup); + } } } } diff --git a/src/PartSet/PartSet_OperationEditLine.cpp b/src/PartSet/PartSet_OperationEditLine.cpp index 7b37976e8..c66f38f35 100644 --- a/src/PartSet/PartSet_OperationEditLine.cpp +++ b/src/PartSet/PartSet_OperationEditLine.cpp @@ -7,6 +7,7 @@ #include #include +#include #include @@ -171,17 +172,18 @@ void PartSet_OperationEditLine::moveLinePoint(boost::shared_ptr > aFeatures; std::list::const_iterator anIt = myFeatures.begin(), aLast = myFeatures.end(); for (; anIt != aLast; anIt++) { boost::shared_ptr aFeature = (*anIt).feature(); if (!aFeature || aFeature == feature()) continue; - } - static Events_ID aModuleEvent = Events_Loop::eventByName("PartSetEditEvent"); - Model_FeaturesMovedMessage aMessage; - aMessage.setFeatures(aFeatures); - Events_Loop::loop()->send(aMessage); + Model_FeatureUpdatedMessage aMessage(aFeature, anEvent); + Events_Loop::loop()->send(aMessage); + } + Events_Loop::loop()->flush(anEvent); } diff --git a/src/SketchSolver/SketchSolver_ConstraintManager.cpp b/src/SketchSolver/SketchSolver_ConstraintManager.cpp index 4a47879fa..ab6786fa7 100644 --- a/src/SketchSolver/SketchSolver_ConstraintManager.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintManager.cpp @@ -61,7 +61,7 @@ SketchSolver_ConstraintManager::SketchSolver_ConstraintManager() Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(EVENT_FEATURE_CREATED)); Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(EVENT_FEATURE_UPDATED)); Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(EVENT_FEATURE_DELETED)); - Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(EVENT_FEATURES_MOVED)); + Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(EVENT_FEATURE_MOVED)); } SketchSolver_ConstraintManager::~SketchSolver_ConstraintManager() @@ -118,7 +118,7 @@ void SketchSolver_ConstraintManager::processEvent(const Events_Message* theMessa } } } - else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURES_MOVED)) + else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURE_MOVED)) { // Solve the set of constraints resolveConstraints();