#include <Events_Loop.h>
#include <Model_Events.h>
+#include <SketchPlugin_Sketch.h>
+
#ifdef _DEBUG
#include <QDebug>
#endif
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);
+ 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);
+ //if (aType == EVENT_FEATURE_CREATED)
+ 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->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_KIND) == 0) { // Update only Sketch group
+ myModule->workshop()->displayer()->eraseDeletedFeatures();
+ myModule->updateCurrentPreview(aGroup);
+ }
}
}
}