From 0b5646d3d6db37d5e17db76aec12db185c4b24a0 Mon Sep 17 00:00:00 2001 From: dbv Date: Mon, 24 Aug 2015 14:55:16 +0300 Subject: [PATCH] Compsolids creation fix --- src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp | 32 +++++++++++++++------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp index 6955720e2..54835f857 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp @@ -88,16 +88,22 @@ void GeomAlgoAPI_ShapeTools::combineShapes(const std::shared_ptr continue; } else if(aListOfShape.Size() == 1) { - aFreeShapes.Add(aListOfShape.First()); + const TopoDS_Shape& aF = aListOfShape.First(); + aFreeShapes.Add(aF); aListOfShape.Clear(); } else { + NCollection_List aTempList; NCollection_Map aTempMap; - aTempMap.Add(aListOfShape.First()); - aTempMap.Add(aListOfShape.Last()); - aFreeShapes.Remove(aListOfShape.First()); - aFreeShapes.Remove(aListOfShape.Last()); + const TopoDS_Shape& aF = aListOfShape.First(); + const TopoDS_Shape& aL = aListOfShape.Last(); + aTempList.Append(aF); + aTempList.Append(aL); + aTempMap.Add(aF); + aTempMap.Add(aL); + aFreeShapes.Remove(aF); + aFreeShapes.Remove(aL); aListOfShape.Clear(); - for(NCollection_Map::Iterator aTempIter(aTempMap); aTempIter.More(); aTempIter.Next()) { + for(NCollection_List::Iterator aTempIter(aTempList); aTempIter.More(); aTempIter.Next()) { const TopoDS_Shape& aTempShape = aTempIter.Value(); for(BOPCol_IndexedDataMapOfShapeListOfShape::Iterator anIter(aMapEF); anIter.More(); anIter.Next()) { BOPCol_ListOfShape& aTempListOfShape = anIter.ChangeValue(); @@ -107,12 +113,18 @@ void GeomAlgoAPI_ShapeTools::combineShapes(const std::shared_ptr aTempListOfShape.Clear(); } else if(aTempListOfShape.Size() > 1) { if(aTempListOfShape.First() == aTempShape) { - aTempMap.Add(aTempListOfShape.Last()); - aFreeShapes.Remove(aTempListOfShape.Last()); + const TopoDS_Shape& aTL = aTempListOfShape.Last(); + if(aTempMap.Add(aTL)) { + aTempList.Append(aTL); + aFreeShapes.Remove(aTL); + } aTempListOfShape.Clear(); } else if(aTempListOfShape.Last() == aTempShape) { - aTempMap.Add(aTempListOfShape.First()); - aFreeShapes.Remove(aTempListOfShape.First()); + const TopoDS_Shape& aTF = aTempListOfShape.First(); + if(aTempMap.Add(aTF)) { + aTempList.Append(aTF); + aFreeShapes.Remove(aTF); + } aTempListOfShape.Clear(); } } -- 2.39.2