Salome HOME
Make extrusions features correctly eat as a base a whole sketch feature selection.
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_Tools.cpp
index 22431b98b62ab11c899b6abfff20a81dfc290b86..07709d1ed7fa2a2056346f9e0f0c28ebed31b07e 100644 (file)
@@ -1,8 +1,22 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        FeaturesPlugin_Tools.cpp
-// Created:     17 November 2016
-// Author:      Dmitry Bobylev
+// Copyright (C) 2014-2017  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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
 
 #include "FeaturesPlugin_Tools.h"
 
@@ -13,7 +27,9 @@
 void FeaturesPlugin_Tools::storeModifiedShapes(GeomAlgoAPI_MakeShape& theAlgo,
                                                std::shared_ptr<ModelAPI_ResultBody> theResultBody,
                                                std::shared_ptr<GeomAPI_Shape> theBaseShape,
-                                               int& theTag,
+                                               const int theFaceTag,
+                                               const int theEdgeTag,
+                                               const int theVertexTag,
                                                const std::string theName,
                                                GeomAPI_DataMapOfShapeShape& theSubShapes)
 {
@@ -21,8 +37,14 @@ void FeaturesPlugin_Tools::storeModifiedShapes(GeomAlgoAPI_MakeShape& theAlgo,
     case GeomAPI_Shape::COMPOUND: {
       for(GeomAPI_ShapeIterator anIt(theBaseShape); anIt.more(); anIt.next())
       {
-        storeModifiedShapes(theAlgo, theResultBody, theBaseShape, theTag, theName, theSubShapes);
-        theTag++;
+        storeModifiedShapes(theAlgo,
+                            theResultBody,
+                            anIt.current(),
+                            theFaceTag,
+                            theEdgeTag,
+                            theVertexTag,
+                            theName,
+                            theSubShapes);
       }
       break;
     }
@@ -31,20 +53,18 @@ void FeaturesPlugin_Tools::storeModifiedShapes(GeomAlgoAPI_MakeShape& theAlgo,
     case GeomAPI_Shape::SHELL: {
       theResultBody->loadAndOrientModifiedShapes(&theAlgo,
                                 theBaseShape, GeomAPI_Shape::FACE,
-                                theTag, theName + "_Face", theSubShapes);
-      if (theBaseShape->shapeType() == GeomAPI_Shape::COMPSOLID
-          || theBaseShape->shapeType() == GeomAPI_Shape::SOLID) {
-        break;
-      }
+                                theFaceTag, theName + "_Face", theSubShapes, false, true);
     }
     case GeomAPI_Shape::FACE:
-    case GeomAPI_Shape::WIRE:
+    case GeomAPI_Shape::WIRE: {
       theResultBody->loadAndOrientModifiedShapes(&theAlgo,
                                 theBaseShape, GeomAPI_Shape::EDGE,
-                                ++theTag, theName + "_Edge", theSubShapes);
-    case GeomAPI_Shape::EDGE:
+                                theEdgeTag, theName + "_Edge", theSubShapes, false, true);
+    }
+    case GeomAPI_Shape::EDGE: {
       theResultBody->loadAndOrientModifiedShapes(&theAlgo,
                               theBaseShape, GeomAPI_Shape::VERTEX,
-                              ++theTag, theName + "_Vertex", theSubShapes);
+                              theVertexTag, theName + "_Vertex", theSubShapes, false, true);
+    }
   }
 }