}
}
}
- // 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 (myFeatures.IsBound(aFeatureLabel)) { // a new feature is inserted
- FeaturePtr aFeature = myFeatures.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(myFeatures);
aFIter.Next();
}
+ if (theUpdateReferences) {
+ synchronizeBackRefs();
+ }
+ // update results of the features (after features created because they may be connected, like sketch and sub elements)
+ // After synchronisation of back references because sketch must be set in sub-elements before "execute" by updateResults
+ 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 (myFeatures.IsBound(aFeatureLabel)) { // a new feature is inserted
+ FeaturePtr aFeature = myFeatures.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);
+ }
+
+ // the synchronize should be done after updateResults in order to correct back references of updated results
if (theUpdateReferences) {
synchronizeBackRefs();
}
QWidget* theParent,
const bool theAskAboutDeleteReferences)
{
+#ifdef DEBUG_DELETE
+ QStringList aDInfo;
+ QObjectPtrList::const_iterator aDIt = theList.begin(), aDLast = theList.end();
+ for (; aDIt != aDLast; ++aDIt) {
+ aDInfo.append(ModuleBase_Tools::objectInfo((*aDIt)));
+ }
+ QString anInfoStr = aDInfo.join(", ");
+ qDebug(QString("deleteFeatures: %1, %2").arg(theList.size()).arg(anInfoStr).toStdString().c_str());
+#endif
+
// 1. find all referenced features
std::set<FeaturePtr> aRefFeatures;
foreach (ObjectPtr aDeletedObj, theList) {
DocumentPtr aDoc = aObj->document();
if (theIgnoredFeatures.find(aFeature) == theIgnoredFeatures.end()) {
- aDoc->removeFeature(aFeature);
#ifdef DEBUG_DELETE
QString anInfoStr = ModuleBase_Tools::objectInfo(aFeature);
anInfo.append(anInfoStr);
qDebug(QString("remove feature :%1").arg(anInfoStr).toStdString().c_str());
#endif
+ aDoc->removeFeature(aFeature);
}
}
}