Salome HOME
Make the movement, placement and rotation 3D features may be applied to the Part...
[modules/shaper.git] / src / Model / Model_Update.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        Model_Update.cxx
4 // Created:     25 Jun 2014
5 // Author:      Mikhail PONIKAROV
6
7 #include <Model_Update.h>
8 #include <Model_Document.h>
9 #include <Model_Data.h>
10 #include <Model_Objects.h>
11 #include <ModelAPI_Feature.h>
12 #include <ModelAPI_Data.h>
13 #include <ModelAPI_Document.h>
14 #include <ModelAPI_Events.h>
15 #include <ModelAPI_AttributeReference.h>
16 #include <ModelAPI_AttributeRefList.h>
17 #include <ModelAPI_AttributeRefAttr.h>
18 #include <ModelAPI_AttributeSelection.h>
19 #include <ModelAPI_AttributeSelectionList.h>
20 #include <ModelAPI_Result.h>
21 #include <ModelAPI_ResultPart.h>
22 #include <ModelAPI_Validator.h>
23 #include <ModelAPI_CompositeFeature.h>
24 #include <ModelAPI_Session.h>
25 #include <ModelAPI_Tools.h>
26 #include <GeomDataAPI_Point.h>
27 #include <GeomDataAPI_Point2D.h>
28 #include <Events_Loop.h>
29 #include <Events_LongOp.h>
30 #include <Events_Error.h>
31 #include <Config_PropManager.h>
32
33 using namespace std;
34
35 Model_Update MY_UPDATER_INSTANCE;  /// the only one instance initialized on load of the library
36
37 Model_Update::Model_Update()
38 {
39   Events_Loop* aLoop = Events_Loop::loop();
40   static const Events_ID kChangedEvent = aLoop->eventByName("PreferenceChanged");
41   aLoop->registerListener(this, kChangedEvent);
42   static const Events_ID kRebuildEvent = aLoop->eventByName("Rebuild");
43   aLoop->registerListener(this, kRebuildEvent);
44   static const Events_ID kCreatedEvent = Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED);
45   aLoop->registerListener(this, kCreatedEvent);
46   static const Events_ID kUpdatedEvent = Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED);
47   aLoop->registerListener(this, kUpdatedEvent);
48   static const Events_ID kMovedEvent = Events_Loop::loop()->eventByName(EVENT_OBJECT_MOVED);
49   aLoop->registerListener(this, kMovedEvent);
50   static const Events_ID kOpFinishEvent = aLoop->eventByName("FinishOperation");
51   aLoop->registerListener(this, kOpFinishEvent);
52   static const Events_ID kOpAbortEvent = aLoop->eventByName("AbortOperation");
53   aLoop->registerListener(this, kOpAbortEvent);
54   static const Events_ID kOpStartEvent = aLoop->eventByName("StartOperation");
55   aLoop->registerListener(this, kOpStartEvent);
56
57   Config_PropManager::registerProp("Model update", "automatic_rebuild", "Rebuild immediately",
58                                    Config_Prop::Boolean, "false");
59   myIsAutomatic =
60     Config_PropManager::findProp("Model update", "automatic_rebuild")->value() == "true";
61   myIsParamUpdated = false;
62   myIsFinish = false;
63 }
64
65 void Model_Update::processEvent(const std::shared_ptr<Events_Message>& theMessage)
66 {
67   static Events_Loop* aLoop = Events_Loop::loop();
68   static const Events_ID kChangedEvent = aLoop->eventByName("PreferenceChanged");
69   static const Events_ID kRebuildEvent = aLoop->eventByName("Rebuild");
70   static const Events_ID kCreatedEvent = aLoop->eventByName(EVENT_OBJECT_CREATED);
71   static const Events_ID kUpdatedEvent = aLoop->eventByName(EVENT_OBJECT_UPDATED);
72   static const Events_ID kMovedEvent = Events_Loop::loop()->eventByName(EVENT_OBJECT_MOVED);
73   static const Events_ID kOpFinishEvent = aLoop->eventByName("FinishOperation");
74   static const Events_ID kOpAbortEvent = aLoop->eventByName("AbortOperation");
75   static const Events_ID kOpStartEvent = aLoop->eventByName("StartOperation");
76   if (theMessage->eventID() == kChangedEvent) { // automatic and manual rebuild flag is changed
77     bool aPropVal =
78       Config_PropManager::findProp("Model update", "automatic_rebuild")->value() == "true";
79     if (aPropVal != myIsAutomatic) { // something is changed
80       myIsAutomatic = aPropVal;
81       if (myIsAutomatic) // higher level of automatization => to rebuild
82         processOperation(false);
83     }
84   } else if (theMessage->eventID() == kRebuildEvent) { // the rebuild command
85     processOperation(true);
86   } else if (theMessage->eventID() == kCreatedEvent || theMessage->eventID() == kUpdatedEvent ||
87              theMessage->eventID() == kMovedEvent) {
88     std::shared_ptr<ModelAPI_ObjectUpdatedMessage> aMsg =
89         std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
90     const std::set<ObjectPtr>& anObjs = aMsg->objects();
91     std::set<ObjectPtr>::const_iterator anObjIter = anObjs.cbegin();
92     bool isOnlyResults = true; // check that only results were changed: only redisplay is needed
93     for(; anObjIter != anObjs.cend(); anObjIter++) {
94       if (!std::dynamic_pointer_cast<ModelAPI_Result>(*anObjIter).get()) {
95         isOnlyResults = false;
96       }
97       if ((*anObjIter)->groupName() == ModelAPI_ResultParameter::group()) {
98         myIsParamUpdated = true;
99       }
100       // created objects are always must be up to date (python box feature)
101       // and updated not in internal uptation chain
102       myJustUpdated.insert(*anObjIter);
103     }
104     // this event is for solver update, not here, do not react immideately
105     if (!isOnlyResults && !(theMessage->eventID() == kMovedEvent))
106       processOperation(false);
107   } else if (theMessage->eventID() == kOpFinishEvent || theMessage->eventID() == kOpAbortEvent ||
108       theMessage->eventID() == kOpStartEvent) {
109     myIsParamUpdated = false;
110
111     if (!(theMessage->eventID() == kOpStartEvent)) {
112       myIsFinish = true;
113       processOperation(true, theMessage->eventID() == kOpFinishEvent);
114       myIsFinish = false;
115     }
116     // remove all macros before clearing all created
117     std::set<ObjectPtr>::iterator anUpdatedIter = myWaitForFinish.begin();
118     while(anUpdatedIter != myWaitForFinish.end()) {
119       FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(*anUpdatedIter);
120       if (aFeature.get()) {
121         // remove macro on finish
122         if (aFeature->isMacro()) {
123           aFeature->document()->removeFeature(aFeature);
124           myWaitForFinish.erase(aFeature);
125         }
126         // to avoid the map update problems on "remove"
127         if (myWaitForFinish.find(aFeature) == myWaitForFinish.end()) {
128           anUpdatedIter = myWaitForFinish.begin();
129         } else {
130           anUpdatedIter++;
131         }
132       } else {
133         anUpdatedIter++;
134       }
135     }
136     // in the end of transaction everything is updated, so clear the old objects (the only one
137     // place where results are cleared)
138     myJustUpdated.clear();
139     myWaitForFinish.clear();
140   }
141 }
142
143 void Model_Update::processOperation(const bool theTotalUpdate, const bool theFinish)
144 {
145   if (theFinish) {
146     // the hardcode (DBC asked): hide the sketch referenced by extrusion on apply
147     std::set<std::shared_ptr<ModelAPI_Object> >::iterator aFIter;
148     for(aFIter = myWaitForFinish.begin(); aFIter != myWaitForFinish.end(); aFIter++)
149     {
150       FeaturePtr aF = std::dynamic_pointer_cast<ModelAPI_Feature>(*aFIter);
151       if (aF && aF->data()->isValid() && aF->getKind() == "Extrusion") {
152         AttributeSelectionListPtr aBase = aF->selectionList("base");
153         if (aBase.get()) {
154           for(int a = aBase->size() - 1; a >= 0; a--) {
155             ResultPtr aSketchRes = aBase->value(a)->context();
156             if (aSketchRes) {
157               aSketchRes->setDisplayed(false);
158             }
159           }
160         }
161       }
162     }
163   }
164   // perform update of everything if needed
165   if (!myIsExecuted) {
166     myIsExecuted = true;
167
168     bool isAutomaticChanged = false;
169
170     if (theTotalUpdate && !myIsAutomatic) { // Apply button now works as "Rebuild"
171       isAutomaticChanged = true;
172       myIsAutomatic = true;
173     }
174
175     // iterate all features in the root document to update each
176     DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
177     Model_Objects* anObjs = std::dynamic_pointer_cast<Model_Document>(aRootDoc)->objects();
178     if (!anObjs) return;
179     FeaturePtr aFeatureIter = anObjs->firstFeature();
180     std::set<FeaturePtr> aProcessedFeatures; // to avoid processing twice
181     for (; aFeatureIter.get(); aFeatureIter = anObjs->nextFeature(aFeatureIter)) {
182       updateFeature(aFeatureIter, aProcessedFeatures);
183     }
184
185     if (isAutomaticChanged) myIsAutomatic = false;
186     myIsExecuted = false;
187
188     // flush to update display
189     static Events_Loop* aLoop = Events_Loop::loop();
190     static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
191     aLoop->flush(EVENT_DISP);
192   }
193 }
194
195 void Model_Update::updateFeature(FeaturePtr theFeature, std::set<FeaturePtr>& theProcessed)
196 {
197   // check all features this feature depended on (recursive call of updateFeature)
198   static ModelAPI_ValidatorsFactory* aFactory = ModelAPI_Session::get()->validators();
199
200   if (theProcessed.find(theFeature) != theProcessed.end())
201     return;
202   theProcessed.insert(theFeature);
203   if (theFeature->isDisabled())
204     return;
205
206   CompositeFeaturePtr aCompos = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(theFeature);
207   // If automatice update is not needed and feature attributes were not updated right now,
208   // do not execute it and do not update arguments.
209   if (!myIsAutomatic && myJustUpdated.find(theFeature) == myJustUpdated.end() && !aCompos.get()) {
210     // execute will be performed later, but some features may have not-result 
211     // presentations, so call update for them (like coincidence in the sketcher)
212     static Events_ID EVENT_DISP = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
213     ModelAPI_EventCreator::get()->sendUpdated(theFeature, EVENT_DISP);
214     return;
215   }
216
217   // Update selection and parameters attributes first, before sub-features analysis (sketch plane).
218   updateArguments(theFeature);
219
220   // composite feature must be executed after sub-features execution
221   if (aCompos) {
222     // number of subs can be changed in execution: like fillet
223     for(int a = 0; a < aCompos->numberOfSubs(); a++) {
224       FeaturePtr aSub = aCompos->subFeature(a);
225       updateFeature(aSub, theProcessed);
226     }
227   }
228   // this checking must be after the composite feature sub-elements processing:
229   // composite feature status may depend on it's subelements
230   if (theFeature->data()->execState() == ModelAPI_StateInvalidArgument) {
231     theFeature->eraseResults();
232     redisplayWithResults(theFeature, ModelAPI_StateInvalidArgument); // result also must be updated
233     return;
234   }
235
236   bool aJustUpdated = myJustUpdated.find(theFeature) != myJustUpdated.end();
237
238   if (myIsAutomatic && theFeature->data()->execState() == ModelAPI_StateMustBeUpdated)
239     aJustUpdated = true;
240
241   // On abort, undo or redo execute is not needed: results in document are updated automatically
242   // But redisplay is needed: results are updated, must be also updated in the viewer.
243   if (aJustUpdated && 
244       !std::dynamic_pointer_cast<Model_Document>(theFeature->document())->executeFeatures()) {
245     if (!theFeature->isPersistentResult()) { // not persistent must be re-executed on abort, etc.
246       ModelAPI_ExecState aState = theFeature->data()->execState();
247       if (aFactory->validate(theFeature)) {
248         executeFeature(theFeature);
249       } else {
250         theFeature->eraseResults();
251         redisplayWithResults(theFeature, ModelAPI_StateInvalidArgument); // result also must be updated
252       }
253     } else {
254       redisplayWithResults(theFeature, ModelAPI_StateNothing);
255       if (theFeature->data()->execState() == ModelAPI_StateMustBeUpdated) { // it is done (in the tree)
256         theFeature->data()->execState(ModelAPI_StateDone);
257       }
258     }
259     return;
260   }
261
262   // execute feature if it must be updated
263   if (theFeature->isPreviewNeeded() || myIsFinish) {
264     if (aJustUpdated) {
265       ModelAPI_ExecState aState = theFeature->data()->execState();
266       if (aFactory->validate(theFeature)) {
267         executeFeature(theFeature);
268       } else {
269         theFeature->eraseResults();
270         redisplayWithResults(theFeature, ModelAPI_StateInvalidArgument); // result also must be updated
271       }
272     }
273   } else { // preview is not needed => make state Done
274     if (theFeature->data()->execState() == ModelAPI_StateMustBeUpdated) {
275       theFeature->data()->execState(ModelAPI_StateDone);
276       if (aJustUpdated) // store that it must be updated on finish
277         myJustUpdated.insert(theFeature);
278     }
279   }
280 }
281
282 void Model_Update::redisplayWithResults(FeaturePtr theFeature, const ModelAPI_ExecState theState) 
283 {
284   // make updated and redisplay all results
285   static Events_ID EVENT_DISP = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
286   const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = theFeature->results();
287   std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
288   for (; aRIter != aResults.cend(); aRIter++) {
289     std::shared_ptr<ModelAPI_Result> aRes = *aRIter;
290     aRes->data()->execState(theState);
291     if (theFeature->data()->updateID() > aRes->data()->updateID()) {
292       aRes->data()->setUpdateID(theFeature->data()->updateID());
293     }
294     ModelAPI_EventCreator::get()->sendUpdated(aRes, EVENT_DISP);
295   }
296   // to redisplay "presentable" feature (for ex. distance constraint)
297   ModelAPI_EventCreator::get()->sendUpdated(theFeature, EVENT_DISP);
298   theFeature->data()->execState(theState);
299 }
300
301 /// Updates the state by the referenced object: if something bad with it, set state for this one
302 ModelAPI_ExecState stateByReference(ObjectPtr theTarget, const ModelAPI_ExecState theCurrent)
303 {
304   if (theTarget) {
305     ModelAPI_ExecState aRefState = theTarget->data()->execState();
306     if (aRefState == ModelAPI_StateMustBeUpdated) {
307       if (theCurrent == ModelAPI_StateDone)
308         return ModelAPI_StateMustBeUpdated;
309     } else if (aRefState != ModelAPI_StateDone) {
310       return ModelAPI_StateInvalidArgument;
311     }
312   }
313   return theCurrent;
314 }
315
316 void Model_Update::updateArguments(FeaturePtr theFeature) {
317   // perform this method also for disabled features: to make "not done" state for
318   // featuers referenced to the active and modified features
319
320   static ModelAPI_ValidatorsFactory* aFactory = ModelAPI_Session::get()->validators();
321
322   ModelAPI_ExecState aState = theFeature->data()->execState();
323   if (aState == ModelAPI_StateExecFailed) { // try again failed feature: issue 577
324     aState = ModelAPI_StateMustBeUpdated;
325   }
326   if (aState == ModelAPI_StateInvalidArgument) // a chance to be corrected
327     aState = ModelAPI_StateMustBeUpdated;
328   // check the parameters state
329   // Double
330   std::list<AttributePtr> aDoubles =
331     theFeature->data()->attributes(ModelAPI_AttributeDouble::typeId());
332   std::list<AttributePtr>::iterator aDoubleIter = aDoubles.begin();
333   for(; aDoubleIter != aDoubles.end(); aDoubleIter++) {
334     AttributeDoublePtr aDouble =
335       std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(*aDoubleIter);
336     if (aDouble.get() && !aDouble->text().empty()) {
337       if (myIsParamUpdated) {
338         ModelAPI_AttributeEvalMessage::send(aDouble, this);
339       }
340       if (aDouble->expressionInvalid()) {
341         aState = ModelAPI_StateInvalidArgument;
342       }
343     }
344   }
345   // Point
346   {
347     std::list<AttributePtr> anAttributes =
348       theFeature->data()->attributes(GeomDataAPI_Point::typeId());
349     std::list<AttributePtr>::iterator anIter = anAttributes.begin();
350     for(; anIter != anAttributes.end(); anIter++) {
351       AttributePointPtr aPointAttribute =
352         std::dynamic_pointer_cast<GeomDataAPI_Point>(*anIter);
353       if (aPointAttribute.get()) {
354         if (myIsParamUpdated) {
355           ModelAPI_AttributeEvalMessage::send(aPointAttribute, this);
356         }
357         if ((!aPointAttribute->textX().empty() && aPointAttribute->expressionInvalid(0)) ||
358           (!aPointAttribute->textY().empty() && aPointAttribute->expressionInvalid(1)) ||
359           (!aPointAttribute->textZ().empty() && aPointAttribute->expressionInvalid(2)))
360           aState = ModelAPI_StateInvalidArgument;
361       }
362     }
363   }
364   // Point2D
365   {
366     std::list<AttributePtr> anAttributes =
367       theFeature->data()->attributes(GeomDataAPI_Point2D::typeId());
368     std::list<AttributePtr>::iterator anIter = anAttributes.begin();
369     for(; anIter != anAttributes.end(); anIter++) {
370       AttributePoint2DPtr aPoint2DAttribute =
371         std::dynamic_pointer_cast<GeomDataAPI_Point2D>(*anIter);
372       if (aPoint2DAttribute.get()) {
373         if (myIsParamUpdated) {
374           ModelAPI_AttributeEvalMessage::send(aPoint2DAttribute, this);
375         }
376         if ((!aPoint2DAttribute->textX().empty() && aPoint2DAttribute->expressionInvalid(0)) ||
377           (!aPoint2DAttribute->textY().empty() && aPoint2DAttribute->expressionInvalid(1)))
378           aState = ModelAPI_StateInvalidArgument;
379       }
380     }
381   }
382
383   //if (aState == ModelAPI_StateDone) {// all referenced objects are ready to be used
384   //std::cout<<"Execute feature "<<theFeature->getKind()<<std::endl;
385   // before execution update the selection attributes if any
386   list<AttributePtr> aRefs = 
387     theFeature->data()->attributes(ModelAPI_AttributeSelection::typeId());
388   list<AttributePtr>::iterator aRefsIter = aRefs.begin();
389   for (; aRefsIter != aRefs.end(); aRefsIter++) {
390     std::shared_ptr<ModelAPI_AttributeSelection> aSel =
391       std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(*aRefsIter);
392     ObjectPtr aContext = aSel->context();
393     // update argument onlt if the referenced object is changed
394     if (aContext.get() && !aContext->isDisabled() && 
395       aContext->data()->updateID() > theFeature->data()->updateID()) {
396         if (aState == ModelAPI_StateDone)
397           aState = ModelAPI_StateMustBeUpdated;
398         if (!aSel->update()) { // this must be done on execution since it may be long operation
399           if (!aFactory->isNotObligatory(theFeature->getKind(), theFeature->data()->id(aSel)) &&
400             aFactory->isCase(theFeature, theFeature->data()->id(aSel)))
401             aState = ModelAPI_StateInvalidArgument;
402         }
403     }
404   }
405   aRefs = theFeature->data()->attributes(ModelAPI_AttributeSelectionList::typeId());
406   for (aRefsIter = aRefs.begin(); aRefsIter != aRefs.end(); aRefsIter++) {
407     std::shared_ptr<ModelAPI_AttributeSelectionList> aSel =
408       std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(*aRefsIter);
409     for(int a = aSel->size() - 1; a >= 0; a--) {
410       std::shared_ptr<ModelAPI_AttributeSelection> aSelAttr =
411         std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(aSel->value(a));
412       if (aSelAttr) {
413         ObjectPtr aContext = aSelAttr->context();
414         // update argument onlt if the referenced object is changed
415         if (aContext.get() && !aContext->isDisabled() &&
416           aContext->data()->updateID() > theFeature->data()->updateID()) {
417             if (aState == ModelAPI_StateDone)
418               aState = ModelAPI_StateMustBeUpdated;
419             if (!aSelAttr->update()) {
420               if (!aFactory->isNotObligatory(
421                 theFeature->getKind(), theFeature->data()->id(aSel)) &&
422                 aFactory->isCase(theFeature, theFeature->data()->id(aSel)))
423                 aState = ModelAPI_StateInvalidArgument;
424             }
425         }
426       }
427     }
428   }
429   // check all references: if referenced objects are updated, this object also must be updated
430   // also check state of referenced objects: if they are not ready, inherit corresponding state
431   std::list<std::pair<std::string, std::list<ObjectPtr> > > aRefsObj;
432   std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(theFeature->data());
433   aData->referencesToObjects(aRefsObj);
434   std::list<std::pair<std::string, std::list<ObjectPtr> > >::iterator aRef = aRefsObj.begin();
435   for(; aRef != aRefsObj.end(); aRef++) {
436     std::list<ObjectPtr>::iterator aRefObj = aRef->second.begin();
437     for(; aRefObj != aRef->second.end(); aRefObj++) {
438       // if reference is null, it may mean that this reference is to other document
439       // the does not supported by RefList: parameters may be recomputed
440       if (!aRefObj->get() && theFeature->firstResult().get() && 
441                theFeature->firstResult()->groupName() == ModelAPI_ResultParameter::group()) {
442           if (aState == ModelAPI_StateDone)
443             aState = ModelAPI_StateMustBeUpdated;
444       } else if (myJustUpdated.find(*aRefObj) != myJustUpdated.end() || 
445              (aRefObj->get() && (*aRefObj)->data()->updateID() > theFeature->data()->updateID())) {
446           if (aState == ModelAPI_StateDone)
447             aState = ModelAPI_StateMustBeUpdated;
448       }
449       aState = stateByReference(*aRefObj, aState);
450     }
451   }
452   // composites sub-elements
453   CompositeFeaturePtr aCompos = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(theFeature);
454   // composite feature must be executed after sub-features execution
455   if (aCompos) {
456     // number of subs can be changed in execution: like fillet
457     for(int a = 0; a < aCompos->numberOfSubs(); a++) {
458       FeaturePtr aSub = aCompos->subFeature(a);
459       if (myJustUpdated.find(aSub) != myJustUpdated.end() || 
460              (aSub.get() && aSub->data()->updateID() > theFeature->data()->updateID())) {
461           if (aState == ModelAPI_StateDone)
462             aState = ModelAPI_StateMustBeUpdated;
463       }
464     }
465   }
466
467
468   if (aState != ModelAPI_StateDone)
469     theFeature->data()->execState(aState);
470 }
471
472 void Model_Update::executeFeature(FeaturePtr theFeature)
473 {
474   // execute in try-catch to avoid internal problems of the feature
475   ModelAPI_ExecState aState = ModelAPI_StateDone;
476   theFeature->data()->execState(ModelAPI_StateDone);
477   try {
478     theFeature->execute();
479     myJustUpdated.erase(theFeature);
480     if (theFeature->data()->execState() != ModelAPI_StateDone) {
481       aState = ModelAPI_StateExecFailed;
482     } else {
483       aState = ModelAPI_StateDone;
484       myWaitForFinish.insert(theFeature);
485     }
486   } catch(...) {
487     aState = ModelAPI_StateExecFailed;
488     Events_Error::send(
489       "Feature " + theFeature->getKind() + " has failed during the execution");
490   }
491   if (aState != ModelAPI_StateDone) {
492     theFeature->eraseResults();
493   }
494   theFeature->data()->setUpdateID(ModelAPI_Session::get()->transactionID());
495   redisplayWithResults(theFeature, aState);
496 }