From 653f7d9f3745f697bc75410cf0780cf0c7a82714 Mon Sep 17 00:00:00 2001 From: mpv Date: Tue, 15 Jul 2014 16:23:46 +0400 Subject: [PATCH] Parts results debug --- src/Model/Model_Document.cpp | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index 79406ba8c..c6fe4e3c0 100644 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -485,11 +485,19 @@ boost::shared_ptr Model_Document::subDocument(std::string the ObjectPtr Model_Document::object(const std::string& theGroupID, const int theIndex) { if (theGroupID == ModelAPI_Feature::group()) { - std::map >::iterator aFind = myObjs.find(theGroupID); + // features may be not in history but in the myObjs, so, iterate all + int anIndex = 0; + std::map >::iterator aFind = + myObjs.find(ModelAPI_Feature::group()); if (aFind != myObjs.end()) { - int aSize = aFind->second.size(); - if (theIndex >= 0 && theIndex < aSize) - return aFind->second[theIndex]; + std::vector::iterator aFIter = aFind->second.begin(); + for(; aFIter != aFind->second.end(); aFIter++) { + if ((*aFIter)->isInHistory()) { + if (theIndex == anIndex) + return *aFIter; + anIndex++; + } + } } } else { // iterate all features in order to find the needed result @@ -519,9 +527,16 @@ int Model_Document::size(const std::string& theGroupID) { int aResult = 0; if (theGroupID == ModelAPI_Feature::group()) { - std::map >::iterator aFind = myObjs.find(theGroupID); + // features may be not in history but in the myObjs, so, iterate all + std::map >::iterator aFind = + myObjs.find(ModelAPI_Feature::group()); if (aFind != myObjs.end()) { - aResult = aFind->second.size(); + std::vector::iterator aFIter = aFind->second.begin(); + for(; aFIter != aFind->second.end(); aFIter++) { + if ((*aFIter)->isInHistory()) { + aResult++; + } + } } } else { // iterate all features in order to find the needed result -- 2.30.2