]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix for solids color changing after sketch modification
authordbv <dbv@opencascade.com>
Fri, 30 Oct 2015 10:26:39 +0000 (13:26 +0300)
committerdbv <dbv@opencascade.com>
Fri, 30 Oct 2015 10:26:58 +0000 (13:26 +0300)
src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp

index 39b06f92723b9cfe1ed4c8082a617234fd75ce5d..3a4f577ac27be670f7974e4f6a8d88c477b5c35f 100644 (file)
@@ -24,6 +24,7 @@
 #include <TopoDS_Shape.hxx>
 #include <TopoDS_Shell.hxx>
 #include <TopoDS.hxx>
+#include <TopExp_Explorer.hxx>
 
 
 //=================================================================================================
@@ -148,10 +149,13 @@ void GeomAlgoAPI_ShapeTools::combineShapes(const std::shared_ptr<GeomAPI_Shape>
     TopoDS_CompSolid aCSolid;
     TopoDS_Builder aBuilder;
     theType == GeomAPI_Shape::COMPSOLID ? aBuilder.MakeCompSolid(aCSolid) : aBuilder.MakeShell(aShell);
-    const NCollection_Map<TopoDS_Shape>& aShapesMap = anIter.Value();
-    for(NCollection_Map<TopoDS_Shape>::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<TopoDS_Shape>& 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<GeomAPI_Shape> 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<GeomAPI_Shape>
   }
 
   // Adding free shapes.
-  for(NCollection_Map<TopoDS_Shape>::Iterator aShIter(aFreeShapes); aShIter.More(); aShIter.Next()) {
-    const TopoDS_Shape& aShape = aShIter.Value();
-    std::shared_ptr<GeomAPI_Shape> aGeomShape(new GeomAPI_Shape);
-    aGeomShape->setImpl<TopoDS_Shape>(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<GeomAPI_Shape> aGeomShape(new GeomAPI_Shape);
+      aGeomShape->setImpl<TopoDS_Shape>(new TopoDS_Shape(aShape));
+      theFreeShapes.push_back(aGeomShape);
+    }
   }
 }