From: dbv Date: Fri, 30 Oct 2015 10:26:39 +0000 (+0300) Subject: Fix for solids color changing after sketch modification X-Git-Tag: V_2.0.0_alfa1~61 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=506a83727ca8f8297fc1dcdf4ea40d7865c35450;p=modules%2Fshaper.git Fix for solids color changing after sketch modification --- diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp index 39b06f927..3a4f577ac 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp @@ -24,6 +24,7 @@ #include #include #include +#include //================================================================================================= @@ -148,10 +149,13 @@ void GeomAlgoAPI_ShapeTools::combineShapes(const std::shared_ptr TopoDS_CompSolid aCSolid; TopoDS_Builder aBuilder; theType == GeomAPI_Shape::COMPSOLID ? aBuilder.MakeCompSolid(aCSolid) : aBuilder.MakeShell(aShell); - const NCollection_Map& aShapesMap = anIter.Value(); - for(NCollection_Map::Iterator aShIter(aShapesMap); aShIter.More(); aShIter.Next()) { - const TopoDS_Shape& aShape = aShIter.Value(); - theType == GeomAPI_Shape::COMPSOLID ? aBuilder.Add(aCSolid, aShape) : aBuilder.Add(aShell, aShape); + NCollection_Map& aShapesMap = anIter.ChangeValue(); + for(TopExp_Explorer anExp(aShapesComp, aTA); anExp.More(); anExp.Next()) { + const TopoDS_Shape& aShape = anExp.Current(); + if(aShapesMap.Contains(aShape)) { + theType == GeomAPI_Shape::COMPSOLID ? aBuilder.Add(aCSolid, aShape) : aBuilder.Add(aShell, aShape); + aShapesMap.Remove(aShape); + } } std::shared_ptr aGeomShape(new GeomAPI_Shape); TopoDS_Shape* aSh = theType == GeomAPI_Shape::COMPSOLID ? new TopoDS_Shape(aCSolid) : new TopoDS_Shape(aShell); @@ -160,11 +164,13 @@ void GeomAlgoAPI_ShapeTools::combineShapes(const std::shared_ptr } // Adding free shapes. - for(NCollection_Map::Iterator aShIter(aFreeShapes); aShIter.More(); aShIter.Next()) { - const TopoDS_Shape& aShape = aShIter.Value(); - std::shared_ptr aGeomShape(new GeomAPI_Shape); - aGeomShape->setImpl(new TopoDS_Shape(aShape)); - theFreeShapes.push_back(aGeomShape); + for(TopExp_Explorer anExp(aShapesComp, aTA); anExp.More(); anExp.Next()) { + const TopoDS_Shape& aShape = anExp.Current(); + if(aFreeShapes.Contains(aShape)) { + std::shared_ptr aGeomShape(new GeomAPI_Shape); + aGeomShape->setImpl(new TopoDS_Shape(aShape)); + theFreeShapes.push_back(aGeomShape); + } } }