From: vsv Date: Thu, 22 May 2014 11:36:04 +0000 (+0400) Subject: Fix compilation problems X-Git-Tag: V_0.2~26^2~1^2^2~6^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d11077e1913014203590ae892c4dc529a5812a14;p=modules%2Fshaper.git Fix compilation problems --- diff --git a/src/XGUI/XGUI_DocumentDataModel.cpp b/src/XGUI/XGUI_DocumentDataModel.cpp index 8b42208ae..d1ca2c2ed 100644 --- a/src/XGUI/XGUI_DocumentDataModel.cpp +++ b/src/XGUI/XGUI_DocumentDataModel.cpp @@ -49,73 +49,80 @@ void XGUI_DocumentDataModel::processEvent(const Events_Message* theMessage) // Created object event ******************* if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURE_CREATED)) { const Model_FeatureUpdatedMessage* aUpdMsg = dynamic_cast(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::const_iterator aIt; - for (aIt = myPartModels.constBegin(); aIt != myPartModels.constEnd(); ++aIt) { - if ((*aIt)->hasDocument(aDoc)) { - aPartModel = (*aIt); - break; + std::set aFeatures = aUpdMsg->features(); + + std::set::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::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(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::const_iterator aIt; - for (aIt = myPartModels.constBegin(); aIt != myPartModels.constEnd(); ++aIt) { - if ((*aIt)->hasDocument(aDoc)) { - aPartModel = (*aIt); - break; + std::set aGroups = aUpdMsg->groups(); + + std::set::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::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(theMessage); diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 65450b189..7551bcfee 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -210,8 +210,18 @@ void XGUI_Workshop::processEvent(const Events_Message* theMessage) // Process creation of Part if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURE_CREATED)) { const Model_FeatureUpdatedMessage* aUpdMsg = dynamic_cast(theMessage); - FeaturePtr aFeature = aUpdMsg->feature(); - if (aFeature->getKind() == "Part") { + std::set aFeatures = aUpdMsg->features(); + + std::set::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())); @@ -232,10 +242,16 @@ void XGUI_Workshop::processEvent(const Events_Message* theMessage) { const Model_FeatureUpdatedMessage* anUpdateMsg = dynamic_cast(theMessage); - FeaturePtr aNewFeature = anUpdateMsg->feature(); + std::set aFeatures = anUpdateMsg->features(); + FeaturePtr aCurrentFeature = myOperationMgr->currentOperation()->feature(); - if(aNewFeature == aCurrentFeature) { - myPropertyPanel->updateContentWidget(aCurrentFeature); + std::set::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.