From: mpv Date: Fri, 24 Mar 2017 14:56:24 +0000 (+0300) Subject: Fix for the issue #2052 : correct update of selection of the whole sketch if the... X-Git-Tag: V_2.7.0~195 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f127a007a7ab9b148ddf98b6848b1dfb8ef733db;p=modules%2Fshaper.git Fix for the issue #2052 : correct update of selection of the whole sketch if the number of faces is reduced. --- diff --git a/src/Model/Model_ResultConstruction.cpp b/src/Model/Model_ResultConstruction.cpp index a9781e1f4..f41b2ba3d 100644 --- a/src/Model/Model_ResultConstruction.cpp +++ b/src/Model/Model_ResultConstruction.cpp @@ -452,11 +452,33 @@ bool Model_ResultConstruction::update(const int theIndex, bool aRes = true; Handle(TDataStd_IntPackedMap) anIndices; if (aLab.FindAttribute(TDataStd_IntPackedMap::GetID(), anIndices)) { + NCollection_Map aFaces; // collect faces, updated in the tree TColStd_MapIteratorOfPackedMapOfInteger anIndexIter(anIndices->GetMap()); + Handle(TColStd_HPackedMapOfInteger) aNewPackedMap = + new TColStd_HPackedMapOfInteger; // with only faces that are ok + // iterate to find existing faces, updated for(; anIndexIter.More(); anIndexIter.Next()) { - if (!update(anIndexIter.Key(), theExtDoc, theModified)) - aRes = false; + if (update(anIndexIter.Key(), theExtDoc, theModified)) { + GeomShapePtr aFace = shape(anIndexIter.Key(), theExtDoc); + if (!aFaces.Contains(aFace->impl())) { + aNewPackedMap->ChangeMap().Add(anIndexIter.Key()); + aFaces.Add(aFace->impl()); + } + } + } + // then iterate all existing faces to find new faces + int aCurrentFacesNum = facesNum(); + for(int a = 0; a < aCurrentFacesNum; a++) { + GeomShapePtr aFace = face(a); + if (!aFaces.Contains(aFace->impl())) { + // add this one + int aNewFaceIndex = select(aFace, theExtDoc, -1); + if (aNewFaceIndex > 0) { + aNewPackedMap->ChangeMap().Add(aNewFaceIndex); + } + } } + anIndices->ChangeMap(aNewPackedMap); } return aRes; } else {