ModelAPI_EventCreator::get()->sendUpdated(theFeature, anEvent);
theFeature->setDisabled(false); // by default created feature is enabled
updateHistory(ModelAPI_Feature::group());
+ } else { // make feature has not-null data anyway
+ theFeature->setData(Model_Data::invalidData());
+ theFeature->setDoc(myDoc);
}
}
aComposite->removeFeature(theFeature);
}
}
+ // this must be before erase since theFeature erasing removes all information about
+ // the feature results and groups of results
+ // To reproduce: create sketch, extrusion, remove sketch => constructions tree is not updated
+ clearHistory(theFeature);
// erase fields
theFeature->erase();
if (myFeatures.IsBound(aFeatureLabel))
myFeatures.UnBind(aFeatureLabel);
- clearHistory(theFeature);
-
static Events_ID EVENT_DISP = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
ModelAPI_EventCreator::get()->sendUpdated(theFeature, EVENT_DISP);
// erase all attributes under the label of feature
myHistory.erase(aHIter); // erase from map => this means that it is not synchronized
if (theObj->groupName() == ModelAPI_Feature::group()) { // clear results group of the feature
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theObj);
- if (aFeature->firstResult().get())
- clearHistory(aFeature->firstResult());
+ std::string aResultGroup = featureResultGroup(aFeature);
+ if (!aResultGroup.empty()) {
+ std::map<std::string, std::vector<ObjectPtr> >::iterator aHIter =
+ myHistory.find(aResultGroup);
+ if (aHIter != myHistory.end())
+ myHistory.erase(aHIter); // erase from map => this means that it is not synchronized
+ }
}
}
}
ObjectPtr Model_Objects::object(const std::string& theGroupID, const int theIndex)
{
createHistory(theGroupID);
+ //TODO: mpv stabilization hotfix
+ if (myHistory[theGroupID].size() <= theIndex)
+ return ObjectPtr();
return myHistory[theGroupID][theIndex];
}
return FeaturePtr();
}
+std::string Model_Objects::featureResultGroup(FeaturePtr theFeature)
+{
+ if (theFeature->data()->isValid()) {
+ TDF_ChildIterator aLabIter(resultLabel(theFeature->data(), 0).Father());
+ if (aLabIter.More()) {
+ TDF_Label anArgLab = aLabIter.Value();
+ Handle(TDataStd_Comment) aGroup;
+ if (aLabIter.Value().FindAttribute(TDataStd_Comment::GetID(), aGroup)) {
+ return TCollection_AsciiString(aGroup->Get()).ToCString();
+ }
+ }
+ }
+ static std::string anEmpty;
+ return anEmpty; // not found
+}
+
void Model_Objects::updateResults(FeaturePtr theFeature)
{
// for not persistent is will be done by parametric updater automatically