// Created object event *******************
if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURE_CREATED)) {
const Model_FeatureUpdatedMessage* aUpdMsg = dynamic_cast<const Model_FeatureUpdatedMessage*>(theMessage);
- FeaturePtr aFeature = aUpdMsg->feature();
- DocumentPtr aDoc = aFeature->document();
-
- if (aDoc == myDocument) { // If root objects
- if (aFeature->getGroup().compare(PARTS_GROUP) == 0) { // Update only Parts group
- // Add a new part
- int aStart = myPartModels.size() + 1;
- XGUI_PartDataModel* aModel = new XGUI_PartDataModel(myDocument, this);
- aModel->setPartId(myPartModels.count());
- myPartModels.append(aModel);
- insertRow(aStart, partFolderNode());
- } else { // Update top groups (other except parts
- QModelIndex aIndex = myModel->findParent(aFeature);
- int aStart = myModel->rowCount(aIndex) - 1;
- aIndex = createIndex(aIndex.row(), aIndex.column(), (void*)getModelIndex(aIndex));
- insertRow(aStart, aIndex);
- }
- } else { // if sub-objects of first level nodes
- XGUI_PartModel* aPartModel = 0;
- QList<XGUI_PartModel*>::const_iterator aIt;
- for (aIt = myPartModels.constBegin(); aIt != myPartModels.constEnd(); ++aIt) {
- if ((*aIt)->hasDocument(aDoc)) {
- aPartModel = (*aIt);
- break;
+ std::set<FeaturePtr> aFeatures = aUpdMsg->features();
+
+ std::set<FeaturePtr>::const_iterator aIt;
+ for (aIt = aFeatures.begin(); aIt != aFeatures.end(); ++aIt) {
+ FeaturePtr aFeature = (*aIt);
+ DocumentPtr aDoc = aFeature->document();
+ if (aDoc == myDocument) { // If root objects
+ if (aFeature->getGroup().compare(PARTS_GROUP) == 0) { // Update only Parts group
+ // Add a new part
+ int aStart = myPartModels.size() + 1;
+ XGUI_PartDataModel* aModel = new XGUI_PartDataModel(myDocument, this);
+ aModel->setPartId(myPartModels.count());
+ myPartModels.append(aModel);
+ insertRow(aStart, partFolderNode());
+ } else { // Update top groups (other except parts
+ QModelIndex aIndex = myModel->findParent(aFeature);
+ int aStart = myModel->rowCount(aIndex) - 1;
+ aIndex = createIndex(aIndex.row(), aIndex.column(), (void*)getModelIndex(aIndex));
+ insertRow(aStart, aIndex);
+ }
+ } else { // if sub-objects of first level nodes
+ XGUI_PartModel* aPartModel = 0;
+ QList<XGUI_PartModel*>::const_iterator aIt;
+ for (aIt = myPartModels.constBegin(); aIt != myPartModels.constEnd(); ++aIt) {
+ if ((*aIt)->hasDocument(aDoc)) {
+ aPartModel = (*aIt);
+ break;
+ }
+ }
+ if (aPartModel) {
+ QModelIndex aIndex = aPartModel->findParent(aFeature);
+ int aStart = aPartModel->rowCount(aIndex) - 1;
+ aIndex = createIndex(aIndex.row(), aIndex.column(), (void*)getModelIndex(aIndex));
+ insertRow(aStart, aIndex);
}
- }
- if (aPartModel) {
- QModelIndex aIndex = aPartModel->findParent(aFeature);
- int aStart = aPartModel->rowCount(aIndex) - 1;
- aIndex = createIndex(aIndex.row(), aIndex.column(), (void*)getModelIndex(aIndex));
- insertRow(aStart, aIndex);
}
}
-
// Deleted object event ***********************
} else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURE_DELETED)) {
const Model_FeatureDeletedMessage* aUpdMsg = dynamic_cast<const Model_FeatureDeletedMessage*>(theMessage);
DocumentPtr aDoc = aUpdMsg->document();
-
- if (aDoc == myDocument) { // If root objects
- if (aUpdMsg->group().compare(PARTS_GROUP) == 0) { // Updsate only Parts group
- int aStart = myPartModels.size() - 1;
- removeSubModel(aStart);
- removeRow(aStart, partFolderNode());
- } else { // Update top groups (other except parts
- QModelIndex aIndex = myModel->findGroup(aUpdMsg->group());
- int aStart = myModel->rowCount(aIndex);
- aIndex = createIndex(aIndex.row(), aIndex.column(), (void*)getModelIndex(aIndex));
- removeRow(aStart, aIndex);
- }
- } else {
- XGUI_PartModel* aPartModel = 0;
- QList<XGUI_PartModel*>::const_iterator aIt;
- for (aIt = myPartModels.constBegin(); aIt != myPartModels.constEnd(); ++aIt) {
- if ((*aIt)->hasDocument(aDoc)) {
- aPartModel = (*aIt);
- break;
+ std::set<std::string> aGroups = aUpdMsg->groups();
+
+ std::set<std::string>::const_iterator aIt;
+ for (aIt = aGroups.begin(); aIt != aGroups.end(); ++aIt) {
+ std::string aGroup = (*aIt);
+ if (aDoc == myDocument) { // If root objects
+ if (aGroup.compare(PARTS_GROUP) == 0) { // Updsate only Parts group
+ int aStart = myPartModels.size() - 1;
+ removeSubModel(aStart);
+ removeRow(aStart, partFolderNode());
+ } else { // Update top groups (other except parts
+ QModelIndex aIndex = myModel->findGroup(aGroup);
+ int aStart = myModel->rowCount(aIndex);
+ aIndex = createIndex(aIndex.row(), aIndex.column(), (void*)getModelIndex(aIndex));
+ removeRow(aStart, aIndex);
+ }
+ } else {
+ XGUI_PartModel* aPartModel = 0;
+ QList<XGUI_PartModel*>::const_iterator aIt;
+ for (aIt = myPartModels.constBegin(); aIt != myPartModels.constEnd(); ++aIt) {
+ if ((*aIt)->hasDocument(aDoc)) {
+ aPartModel = (*aIt);
+ break;
+ }
+ }
+ if (aPartModel) {
+ QModelIndex aIndex = aPartModel->findGroup(aGroup);
+ int aStart = aPartModel->rowCount(aIndex);
+ aIndex = createIndex(aIndex.row(), aIndex.column(), (void*)getModelIndex(aIndex));
+ removeRow(aStart, aIndex);
}
- }
- if (aPartModel) {
- QModelIndex aIndex = aPartModel->findGroup(aUpdMsg->group());
- int aStart = aPartModel->rowCount(aIndex);
- aIndex = createIndex(aIndex.row(), aIndex.column(), (void*)getModelIndex(aIndex));
- removeRow(aStart, aIndex);
}
}
-
// Deleted object event ***********************
} else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURE_UPDATED)) {
//const Model_FeatureUpdatedMessage* aUpdMsg = dynamic_cast<const Model_FeatureUpdatedMessage*>(theMessage);
// Process creation of Part
if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURE_CREATED)) {
const Model_FeatureUpdatedMessage* aUpdMsg = dynamic_cast<const Model_FeatureUpdatedMessage*>(theMessage);
- FeaturePtr aFeature = aUpdMsg->feature();
- if (aFeature->getKind() == "Part") {
+ std::set<FeaturePtr> aFeatures = aUpdMsg->features();
+
+ std::set<FeaturePtr>::const_iterator aIt;
+ bool aHasPart = false;
+ for (aIt = aFeatures.begin(); aIt != aFeatures.end(); ++aIt) {
+ FeaturePtr aFeature = (*aIt);
+ if (aFeature->getKind() == "Part") {
+ aHasPart = true;
+ break;
+ }
+ }
+ if (aHasPart) {
//The created part will be created in Object Browser later and we have to activate it
// only when it is created everywere
QTimer::singleShot(50, this, SLOT(activateLastPart()));
{
const Model_FeatureUpdatedMessage* anUpdateMsg =
dynamic_cast<const Model_FeatureUpdatedMessage*>(theMessage);
- FeaturePtr aNewFeature = anUpdateMsg->feature();
+ std::set<FeaturePtr> aFeatures = anUpdateMsg->features();
+
FeaturePtr aCurrentFeature = myOperationMgr->currentOperation()->feature();
- if(aNewFeature == aCurrentFeature) {
- myPropertyPanel->updateContentWidget(aCurrentFeature);
+ std::set<FeaturePtr>::const_iterator aIt;
+ for (aIt = aFeatures.begin(); aIt != aFeatures.end(); ++aIt) {
+ FeaturePtr aNewFeature = (*aIt);
+ if(aNewFeature == aCurrentFeature) {
+ myPropertyPanel->updateContentWidget(aCurrentFeature);
+ break;
+ }
}
}
//An operation passed by message. Start it, process and commit.