Salome HOME
bos #30182 Fix compilation problem
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Sewing.cpp
index 24ed0ad6586f5a2628f21f307eda5a078cb8a1b1..3d9630ecf05164ac581e4f03dfffae614b862ef9 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2022  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -12,9 +12,9 @@
 //
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "GeomAlgoAPI_Sewing.h"
@@ -79,10 +79,11 @@ void GeomAlgoAPI_Sewing::build(const ListOfShape& theShapes)
 }
 
 //==================================================================================================
+#include <GeomAPI_ShapeIterator.h>
+
 void GeomAlgoAPI_Sewing::modified(const std::shared_ptr<GeomAPI_Shape> theShape,
                                   ListOfShape& theHistory)
 {
-  static int anIndex = 0;
   if(!theShape.get()) {
     return;
   }
@@ -100,4 +101,21 @@ void GeomAlgoAPI_Sewing::modified(const std::shared_ptr<GeomAPI_Shape> theShape,
     aGeomShape->setImpl(new TopoDS_Shape(anExp.Current()));
     theHistory.push_back(aGeomShape);
   }
+
+  if (theShape->shapeType() < GeomAPI_Shape::FACE) {
+    ListOfShape aNewShapes;
+    // collect faces and parent shapes, if it is not done yet
+    if (!isNewShapesCollected(theShape, GeomAPI_Shape::FACE))
+      collectNewShapes(theShape, GeomAPI_Shape::FACE);
+
+    for (GeomAPI_ShapeIterator anIt(shape()); anIt.more(); anIt.next()) {
+      GeomShapePtr anOldShapesCompound =
+          oldShapesForNew(theShape, anIt.current(), GeomAPI_Shape::FACE);
+      if (!anOldShapesCompound->isNull())
+        aNewShapes.push_back(anIt.current());
+    }
+
+    if (!aNewShapes.empty())
+      theHistory = aNewShapes;
+  }
 }