From 533efb98132f0cf04c6765a456ec1025bb65bdd6 Mon Sep 17 00:00:00 2001 From: mpv Date: Tue, 21 Jun 2016 11:59:43 +0300 Subject: [PATCH] Make sub-group features presented correctly in he tree --- .../ExchangePlugin_ImportFeature.cpp | 7 +------ src/Model/Model_Objects.cpp | 14 ++++++++------ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp b/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp index e212bf40d..bdbbce4b4 100644 --- a/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp @@ -209,7 +209,7 @@ std::shared_ptr ExchangePlugin_ImportFeature::addFeature( if (aNew) data()->reflist(FEATURES_ID())->append(aNew); // set as current also after it becomes sub to set correctly enabled for other subs - document()->setCurrentFeature(aNew, false); + //document()->setCurrentFeature(aNew, false); return aNew; } @@ -231,17 +231,12 @@ void ExchangePlugin_ImportFeature::removeFeature( int ExchangePlugin_ImportFeature::numberOfSubs(bool forTree) const { - if (forTree) - return 0; return data()->reflist(FEATURES_ID())->size(false); } std::shared_ptr ExchangePlugin_ImportFeature::subFeature( const int theIndex, bool forTree) { - if (forTree) - return FeaturePtr(); - ObjectPtr anObj = data()->reflist(FEATURES_ID())->object(theIndex, false); FeaturePtr aRes = std::dynamic_pointer_cast(anObj); return aRes; diff --git a/src/Model/Model_Objects.cpp b/src/Model/Model_Objects.cpp index 2351c9835..bafe2f8f8 100644 --- a/src/Model/Model_Objects.cpp +++ b/src/Model/Model_Objects.cpp @@ -352,12 +352,14 @@ void Model_Objects::createHistory(const std::string& theGroupID) FeaturePtr aFeature = feature(aRefs->Value(a)); if (aFeature.get()) { // if feature is in sub-component, remove it from history: it is in sub-tree of sub-component - if (!ModelAPI_Tools::compositeOwner(aFeature).get()) { - if (isFeature) { // here may be also disabled features - if (aFeature->isInHistory()) { - aResult.push_back(aFeature); - } - } else if (!aFeature->isDisabled()) { // iterate all results of not-disabled feature + bool isSub = ModelAPI_Tools::compositeOwner(aFeature).get() != NULL; + if (isFeature) { // here may be also disabled features + if (!isSub && aFeature->isInHistory()) { + aResult.push_back(aFeature); + } + } else if (!aFeature->isDisabled()) { // iterate all results of not-disabled feature + // construction results of sub-features should not be in the tree + if (!isSub || theGroupID != ModelAPI_ResultConstruction::group()) { // do not use reference to the list here since results can be changed by "isConcealed" const std::list > aResults = aFeature->results(); std::list >::const_iterator aRIter = aResults.begin(); -- 2.39.2