X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FModelAPI%2FModelAPI_Feature.cpp;h=9edfefa4c8f69ed57c5128ecadbc25342d675016;hb=dd95011fbb229596148cdbec3f091ac59866790c;hp=3ba486be3b2ba2c4fb1f15fc8f614b8a67e541bd;hpb=562a00537e3e5ce72fc4e49a5ab2e20ef4022ae6;p=modules%2Fshaper.git diff --git a/src/ModelAPI/ModelAPI_Feature.cpp b/src/ModelAPI/ModelAPI_Feature.cpp index 3ba486be3..9edfefa4c 100644 --- a/src/ModelAPI/ModelAPI_Feature.cpp +++ b/src/ModelAPI/ModelAPI_Feature.cpp @@ -17,7 +17,7 @@ const std::list >& ModelAPI_Feature::results() return myResults; } -std::shared_ptr ModelAPI_Feature::firstResult() +std::shared_ptr ModelAPI_Feature::firstResult() const { return myResults.empty() ? std::shared_ptr() : *(myResults.begin()); } @@ -79,13 +79,14 @@ void ModelAPI_Feature::eraseResultFromList(const std::shared_ptrgroupName(); + aRes->setDisabled(aRes, true); // for complex results to disable all subs aRes->data()->erase(); myResults.erase(aResIter); static Events_Loop* aLoop = Events_Loop::loop(); static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get(); - ModelAPI_EventCreator::get()->sendDeleted(document(), aGroup); + aECreator->sendDeleted(document(), aGroup); aECreator->sendUpdated(aRes, EVENT_DISP); break; } @@ -103,12 +104,12 @@ void ModelAPI_Feature::removeResults(const int theSinceIndex, const bool theFlus while( aNextIter != myResults.end()) { aGroup = (*aNextIter)->groupName(); // remove previously erased results: to enable later if needed only actual (of history change) - if (theSinceIndex == 0 && (*aNextIter)->isDisabled()) { - aNextIter = myResults.erase(aNextIter); - } else { + //if (theSinceIndex == 0 && (*aNextIter)->isDisabled()) { + // aNextIter = myResults.erase(aNextIter); + //} else { (*aNextIter)->setDisabled(*aNextIter, true); // just disable results aNextIter++; - } + //} } if (!aGroup.empty() && theFlush) { // flush visualisation changes @@ -146,7 +147,8 @@ void ModelAPI_Feature::erase() while (!myResults.empty()) { // remove one by one with messages std::shared_ptr aRes = *(myResults.begin()); aRes->setDisabled(aRes, true); // to avoid activation of the Part result - myResults.erase(myResults.begin()); + if (!myResults.empty()) // disabling result may erase the list (on undo of Part, issue 665) + myResults.erase(myResults.begin()); } ModelAPI_Object::erase(); } @@ -192,7 +194,7 @@ bool ModelAPI_Feature::setDisabled(const bool theFlag) return false; } -bool ModelAPI_Feature::isDisabled() const +bool ModelAPI_Feature::isDisabled() { return myIsDisabled; } @@ -201,3 +203,8 @@ bool ModelAPI_Feature::isPreviewNeeded() const { return true; } + +void ModelAPI_Feature::init() +{ + myIsDisabled = false; +}