From: mpv Date: Tue, 15 Jul 2014 12:23:46 +0000 (+0400) Subject: Parts results debug X-Git-Tag: V_0.4.4~187^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=653f7d9f3745f697bc75410cf0780cf0c7a82714;p=modules%2Fshaper.git Parts results debug --- 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