From ca72bdeeb3bd0540c61897f34fbdf91172684f2a Mon Sep 17 00:00:00 2001 From: mpv Date: Tue, 21 Mar 2017 16:47:11 +0300 Subject: [PATCH 1/1] Fix the problem of color overwriting --- src/Model/Model_ResultConstruction.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/Model/Model_ResultConstruction.cpp b/src/Model/Model_ResultConstruction.cpp index 4826c9e09..a9781e1f4 100644 --- a/src/Model/Model_ResultConstruction.cpp +++ b/src/Model/Model_ResultConstruction.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -253,16 +252,10 @@ int Model_ResultConstruction::select(const std::shared_ptr& theSu // empty NS TNaming_Builder aBuilder(aLab); // store all sub-faces naming since faces may be used for extrusion, where all edges are needed + Handle(TDataStd_IntPackedMap) anIndices = TDataStd_IntPackedMap::Set(aLab); std::list aFacesIndexes; for(int a = 0; a < facesNum(); a++) { - aFacesIndexes.push_back(select(face(a), theExtDoc, -1)); - } - if (aFacesIndexes.size()) { - Handle(TDataStd_IntegerArray) anArray = - TDataStd_IntegerArray::Set(aLab, 0, int(aFacesIndexes.size() - 1)); - std::list::iterator anIter = aFacesIndexes.begin(); - for(int anArrayIndex = 0; anIter != aFacesIndexes.end(); anArrayIndex++, anIter++) - anArray->SetValue(anArrayIndex, *anIter); + anIndices->Add(select(face(a), theExtDoc, -1)); } return anIndex - 1; } @@ -457,10 +450,11 @@ bool Model_ResultConstruction::update(const int theIndex, if (!isInfinite()) { // update all faces named by the whole result bool aRes = true; - Handle(TDataStd_IntegerArray) anArray; - if (aLab.FindAttribute(TDataStd_IntegerArray::GetID(), anArray)) { - for(int anIndex = 0; anIndex <= anArray->Upper(); anIndex++) { - if (!update(anArray->Value(anIndex), theExtDoc, theModified)) + Handle(TDataStd_IntPackedMap) anIndices; + if (aLab.FindAttribute(TDataStd_IntPackedMap::GetID(), anIndices)) { + TColStd_MapIteratorOfPackedMapOfInteger anIndexIter(anIndices->GetMap()); + for(; anIndexIter.More(); anIndexIter.Next()) { + if (!update(anIndexIter.Key(), theExtDoc, theModified)) aRes = false; } } -- 2.30.2