/// 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 {
if (aType == EVENT_FEATURE_UPDATED ||
aType == EVENT_FEATURE_CREATED)
{
- const Model_FeatureUpdatedMessage* aUpdMsg = dynamic_cast<const Model_FeatureUpdatedMessage*>(theMessage);
- boost::shared_ptr<ModelAPI_Feature> 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<const Model_FeatureUpdatedMessage*>
+ (theMessage);
+ std::set<boost::shared_ptr<ModelAPI_Feature> > aFeatures = aUpdMsg->features();
+ std::set<boost::shared_ptr<ModelAPI_Feature> >::const_iterator anIt = aFeatures.begin(),
+ aLast = aFeatures.end();
+ for (; anIt != aLast; anIt++) {
+ boost::shared_ptr<ModelAPI_Feature> 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<const Model_FeatureDeletedMessage*>(theMessage);
boost::shared_ptr<ModelAPI_Document> 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<std::string> aGroups = aDelMsg->groups();
+ std::set<std::string>::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);
+ }
}
}
}
#include <PartSet_OperationSketch.h>
#include <ModuleBase_OperationDescription.h>
+#include <Model_Events.h>
#include <XGUI_ViewerPrs.h>
void PartSet_OperationEditLine::sendFeatures()
{
+ static Events_ID anEvent = Events_Loop::eventByName(EVENT_FEATURE_MOVED);
+
std::list<boost::shared_ptr<ModelAPI_Feature> > aFeatures;
std::list<XGUI_ViewerPrs>::const_iterator anIt = myFeatures.begin(), aLast = myFeatures.end();
for (; anIt != aLast; anIt++) {
boost::shared_ptr<ModelAPI_Feature> 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);
}
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()
}
}
}
- 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();