///! Returns true if parametric updater need to execute feature on recomputartion
///! On abort, undo or redo it is not necessary: results in document are updated automatically
- bool& executeFeatures() {return myExecuteFeatures;}
+ bool executeFeatures() {return myExecuteFeatures;}
+
+ ///! On abort, undo or redo it is not necessary: results in document are updated automatically
+ void setExecuteFeatures(const bool theFlag);
//! Registers the name of the shape for the topological naming needs
void addNamingName(const TDF_Label theLabel, std::string theName);
myDoc = theDoc;
// update all fields and recreate features and result objects if needed
TDF_LabelList aNoUpdated;
- synchronizeFeatures(aNoUpdated, true, true, true, true);
+ synchronizeFeatures(aNoUpdated, true, false, true, true);
myHistory.clear();
}
myHistory.clear();
}
- if (theExecuteFeatures)
- anOwner->executeFeatures() = false;
+ if (!theExecuteFeatures)
+ anOwner->setExecuteFeatures(false);
aLoop->activateFlushes(isActive);
if (theFlush) {
aLoop->flush(aRedispEvent);
aLoop->flush(aToHideEvent);
}
- if (theExecuteFeatures)
- anOwner->executeFeatures() = true;
+ if (!theExecuteFeatures)
+ anOwner->setExecuteFeatures(true);
}
/// synchronises back references for the given object basing on the collected data
bool isNotExecuted = theFeature->isPersistentResult() &&
!std::dynamic_pointer_cast<Model_Document>((theFeature)->document())->executeFeatures();
if (isNotExecuted) {
+ redisplayWithResults(theFeature, ModelAPI_StateNothing, false); // redisplay even not executed
if (!theReason.get()) // no reason => no construction reason
return false;
if (myNotPersistentRefs.find(theFeature) == myNotPersistentRefs.end()) {
// update arguments for "apply button" state change
if ((!theFeature->isPreviewNeeded() && !myIsFinish) || myIsPreviewBlocked) {
- myProcessOnFinish.insert(theFeature);
+ if (theReason.get())
+ myProcessOnFinish[theFeature].insert(theReason);
+ else if (myProcessOnFinish.find(theFeature) == myProcessOnFinish.end())
+ myProcessOnFinish[theFeature] = std::set<std::shared_ptr<ModelAPI_Feature> >();
#ifdef DEB_UPDATE
std::cout<<"*** Add process on finish "<<theFeature->name()<<std::endl;
#endif
if (theMessage->eventID() == kOpFinishEvent) {
myIsFinish = true;
// add features that wait for finish as modified
- std::set<std::shared_ptr<ModelAPI_Feature> >::iterator aFeature = myProcessOnFinish.begin();
- for(; aFeature != myProcessOnFinish.end(); aFeature++)
- if ((*aFeature)->data()->isValid()) // there may be already removed wait for features
- addModified(*aFeature, FeaturePtr());
+ std::map<std::shared_ptr<ModelAPI_Feature>, std::set<std::shared_ptr<ModelAPI_Feature> > >::
+ iterator aFeature = myProcessOnFinish.begin();
+ for(; aFeature != myProcessOnFinish.end(); aFeature++) {
+ if (aFeature->first->data()->isValid()) {// there may be already removed while wait
+ if (aFeature->second.empty()) {
+ addModified(aFeature->first, FeaturePtr());
+ continue;
+ }
+ std::set<std::shared_ptr<ModelAPI_Feature> >::iterator aReasons;
+ for(aReasons = aFeature->second.begin(); aReasons != aFeature->second.end(); aReasons++) {
+ addModified(aFeature->first, *aReasons);
+ }
+ }
+ }
myIsFinish = false;
}
// processed features must be only on finish, so clear anyway (to avoid reimport on load)
return true;
}
-void Model_Update::redisplayWithResults(FeaturePtr theFeature, const ModelAPI_ExecState theState)
+void Model_Update::redisplayWithResults(
+ FeaturePtr theFeature, const ModelAPI_ExecState theState, bool theUpdateState)
{
// make updated and redisplay all results
static Events_ID EVENT_DISP = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
if (!aRes->isDisabled()) {
// update state only for enabled results
// (Placement Result Part may make the original Part Result as invalid)
- aRes->data()->execState(theState);
+ if (theUpdateState)
+ aRes->data()->execState(theState);
}
if (theFeature->data()->updateID() > aRes->data()->updateID()) {
aRes->data()->setUpdateID(theFeature->data()->updateID());
}
// to redisplay "presentable" feature (for ex. distance constraint)
ModelAPI_EventCreator::get()->sendUpdated(theFeature, EVENT_DISP);
- theFeature->data()->execState(theState);
+ if (theUpdateState)
+ theFeature->data()->execState(theState);
}
/// Updates the state by the referenced object: if something bad with it, set state for this one
bool myIsFinish;
/// try if processing is currently performed
bool myIsProcessed;
- /// set that contains features that must be executed only on finish of the operation
- std::set<std::shared_ptr<ModelAPI_Feature> > myProcessOnFinish;
+ /// map that contains features that must be executed only on finish of the operation
+ /// the value in map is the set of reasons
+ std::map<std::shared_ptr<ModelAPI_Feature>, std::set<std::shared_ptr<ModelAPI_Feature> > >
+ myProcessOnFinish;
/// to avoid infinitive cycling: feature -> count of the processing periods during this update
std::map<std::shared_ptr<ModelAPI_Feature>, int > myProcessed;
/// if preview in hte property panel is blocked and
/// Sends the redisplay events for feature and results, updates the updated status
void redisplayWithResults(std::shared_ptr<ModelAPI_Feature> theFeature,
- const ModelAPI_ExecState theState);
+ const ModelAPI_ExecState theState, bool theUpdateState = true);
/// On operation start/end/abort the "Just" fileds must be cleared and processed in the right way
//! \param theFlushRedisplay a boolean value if the redisplay signal should be flushed