if (aFeatureOwner.get()) {
aEraseResults = !aFeatureOwner->results().empty();
if (aEraseResults) // erase results without flash deleted and redisplay: do it after Select
- aFeatureOwner->removeResults(0, false);
+ aFeatureOwner->removeResults(0, false, false);
}
aSel.Select(aNewSub, aNewContext);
ModelAPI_EventCreator::get()->sendDeleted(myDoc, ModelAPI_Feature::group());
ModelAPI_EventCreator::get()->sendUpdated(aFeature, EVENT_DISP);
aFeature->removeResults(0, false);
- //aFeature->eraseResults();
aFeature->erase();
myFeatures.UnBind(aFeaturesIter.Key());
}
#ifdef DEB_UPDATE
std::cout<<"Invalid args "<<theFeature->name()<<std::endl;
#endif
- theFeature->eraseResults();
+ theFeature->eraseResults(false);
redisplayWithResults(theFeature, ModelAPI_StateInvalidArgument); // result also must be updated
return true; // so, feature is modified (results are erased)
}
#ifdef DEB_UPDATE
std::cout<<"Feature is not valid, erase results "<<theFeature->name()<<std::endl;
#endif
- theFeature->eraseResults();
+ theFeature->eraseResults(false);
redisplayWithResults(theFeature, ModelAPI_StateInvalidArgument); // result also must be updated
}
return true;
// The macro feature has to be deleted in any case even its execution is failed
myWaitForFinish.insert(theFeature);
if (aState != ModelAPI_StateDone) {
- theFeature->eraseResults();
+ theFeature->eraseResults(false);
}
theFeature->data()->setUpdateID(ModelAPI_Session::get()->transactionID());
redisplayWithResults(theFeature, aState);
}
}
-void ModelAPI_Feature::removeResults(const int theSinceIndex, const bool theFlush)
+void ModelAPI_Feature::removeResults(
+ const int theSinceIndex, const bool theForever, const bool theFlush)
{
std::list<std::shared_ptr<ModelAPI_Result> >::iterator aResIter = myResults.begin();
for(int anIndex = 0; anIndex < theSinceIndex && aResIter != myResults.end(); anIndex++)
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 {
- (*aNextIter)->setDisabled(*aNextIter, true); // just disable results
+ (*aNextIter)->setDisabled(*aNextIter, true); // just disable results
+ if (theForever) {
+ aNextIter = myResults.erase(aNextIter);
+ } else {
aNextIter++;
- //}
+ }
}
if (!aGroup.empty() && theFlush) {
// flush visualisation changes
}
}
-void ModelAPI_Feature::eraseResults()
+void ModelAPI_Feature::eraseResults(const bool theForever)
{
- removeResults(0);
+ removeResults(0, theForever, true);
}
const std::string& ModelAPI_Feature::documentToAdd()
if (myIsDisabled != theFlag) {
myIsDisabled = theFlag;
if (myIsDisabled) {
- removeResults(0, false); // flush will be in setCurrentFeature
+ removeResults(0, false, false); // flush will be in setCurrentFeature
} else {
// enable all disabled previously results
std::list<std::shared_ptr<ModelAPI_Result> >::iterator aResIter = myResults.begin();
MODELAPI_EXPORT void removeResult(const std::shared_ptr<ModelAPI_Result>& theResult);
/// removes all results starting from the given index (zero-based)
/// \param theSinceIndex - index of the deleted result and all after also will be deleted
+ /// \param theForever - removes results for long period (not just because of feature disabling)
/// \param theFlush - if it is false, REDISPLAY message is not flushed
- MODELAPI_EXPORT void removeResults(const int theSinceIndex, const bool theFlush = true);
+ MODELAPI_EXPORT void removeResults(const int theSinceIndex,
+ const bool theForever = true, const bool theFlush = true);
/// removes all results from the feature
- MODELAPI_EXPORT void eraseResults();
+ MODELAPI_EXPORT void eraseResults(const bool theForever = true);
/// removes all fields from this feature: results, data, etc
MODELAPI_EXPORT virtual void erase();
/// removes the result from the list of feature (not doing in disabled): normally this