- }
- // update results of the features (after features created because they may be connected, like sketch and sub elements)
- std::list<FeaturePtr> aComposites; // composites must be updated after their subs (issue 360)
- TDF_ChildIDIterator aLabIter2(featuresLabel(), TDataStd_Comment::GetID());
- for (; aLabIter2.More(); aLabIter2.Next()) {
- TDF_Label aFeatureLabel = aLabIter2.Value()->Label();
- if (myObjs.IsBound(aFeatureLabel)) { // a new feature is inserted
- FeaturePtr aFeature = myObjs.Find(aFeatureLabel);
- if (std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aFeature).get())
- aComposites.push_back(aFeature);
- updateResults(aFeature);
- }
- }
- std::list<FeaturePtr>::iterator aComposite = aComposites.begin();
- for(; aComposite != aComposites.end(); aComposite++) {
- updateResults(*aComposite);
- }
-
- // check all features are checked: if not => it was removed
- NCollection_DataMap<TDF_Label, FeaturePtr>::Iterator aFIter(myObjs);
- while (aFIter.More()) {
- if (aKeptFeatures.find(aFIter.Value()) == aKeptFeatures.end()
- && aNewFeatures.find(aFIter.Value()) == aNewFeatures.end()) {
- FeaturePtr aFeature = aFIter.Value();
- // event: model is updated
- //if (aFeature->isInHistory()) {
- ModelAPI_EventCreator::get()->sendDeleted(aThis, ModelAPI_Feature::group());
- //}
- // results of this feature must be redisplayed (hided)
- // redisplay also removed feature (used for sketch and AISObject)
- ModelAPI_EventCreator::get()->sendUpdated(aFeature, aRedispEvent);
- aFeature->erase();
- // unbind after the "erase" call: on abort sketch is removes sub-objects that corrupts aFIter
- myObjs.UnBind(aFIter.Key());
- // reinitialize iterator because unbind may corrupt the previous order in the map
- aFIter.Initialize(myObjs);
- } else
- aFIter.Next();
- }
-
- if (theUpdateReferences) {
- synchronizeBackRefs();
- }
-
- myExecuteFeatures = false;
- aLoop->activateFlushes(true);
-
- if (theFlush) {
- aLoop->flush(aCreateEvent);
- aLoop->flush(aDeleteEvent);
- aLoop->flush(anUpdateEvent);
- aLoop->flush(aRedispEvent);
- aLoop->flush(aToHideEvent);
- }
- myExecuteFeatures = true;
-}