Salome HOME
Improve translations to French
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_Pipe.cpp
index b81823597a4224558ff4409e4d5e505b32b6f3ba..c3a38788782385f5fa00772b093daaa95fefc2fb 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2019  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
 //
 // 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 "FeaturesPlugin_Pipe.h"
@@ -147,14 +146,9 @@ void FeaturesPlugin_Pipe::execute()
 
   // Searching faces with common edges.
   if(aCreationMethod == CREATION_METHOD_SIMPLE()) {
-    ListOfShape aShells;
-    ListOfShape aFreeFaces;
     std::shared_ptr<GeomAPI_Shape> aFacesCompound =
       GeomAlgoAPI_CompoundBuilder::compound(aBaseFacesList);
-    GeomAlgoAPI_ShapeTools::combineShapes(aFacesCompound, GeomAPI_Shape::SHELL,
-                                          aShells, aFreeFaces);
-    aBaseShapesList.insert(aBaseShapesList.end(), aFreeFaces.begin(), aFreeFaces.end());
-    aBaseShapesList.insert(aBaseShapesList.end(), aShells.begin(), aShells.end());
+    GeomAlgoAPI_ShapeTools::combineShapes(aFacesCompound, GeomAPI_Shape::SHELL, aBaseShapesList);
   } else {
     aBaseShapesList.insert(aBaseShapesList.end(), aBaseFacesList.begin(), aBaseFacesList.end());
   }
@@ -168,7 +162,7 @@ void FeaturesPlugin_Pipe::execute()
   std::shared_ptr<GeomAPI_Shape> aPathShape =
     std::dynamic_pointer_cast<GeomAPI_Shape>(aPathSelection->value());
   if(!aPathShape.get() && aPathSelection->context().get()) {
-    // Probaply it is a construction.
+    // Probably it is a construction.
     aPathShape = aPathSelection->context()->shape();
   }
   if(!aPathShape.get() || aPathShape->isNull()) {
@@ -244,7 +238,7 @@ void FeaturesPlugin_Pipe::execute()
         break;
       }
 
-      storeResult(aBaseShape, aPipeAlgo, aResultIndex++);
+      storeResult(aBaseShape, aPathShape, aPipeAlgo, aResultIndex++);
     }
   } else if(aCreationMethod == CREATION_METHOD_LOCATIONS()) {
     std::shared_ptr<GeomAlgoAPI_Pipe> aPipeAlgo(new GeomAlgoAPI_Pipe(aBaseShapesList,
@@ -257,7 +251,7 @@ void FeaturesPlugin_Pipe::execute()
       return;
     }
 
-    storeResult(aBaseShapesList, aPipeAlgo, aResultIndex++);
+    storeResult(aBaseShapesList, aPathShape, aPipeAlgo, aResultIndex++);
   } else {
     setError("Error: Wrong creation method.");
     return;
@@ -268,6 +262,7 @@ void FeaturesPlugin_Pipe::execute()
 
 //==================================================================================================
 void FeaturesPlugin_Pipe::storeResult(const std::shared_ptr<GeomAPI_Shape> theBaseShape,
+                                      const std::shared_ptr<GeomAPI_Shape> thePathShape,
                                       const std::shared_ptr<GeomAlgoAPI_Pipe> thePipeAlgo,
                                       const int theResultIndex)
 {
@@ -318,6 +313,8 @@ void FeaturesPlugin_Pipe::storeResult(const std::shared_ptr<GeomAPI_Shape> theBa
       aShapeTypeToExplode == GeomAPI_Shape::COMPOUND) {
     aResultBody->loadGeneratedShapes(thePipeAlgo, theBaseShape, GeomAPI_Shape::EDGE);
   }
+  if (thePathShape.get())
+    aResultBody->loadGeneratedShapes(thePipeAlgo, thePathShape, GeomAPI_Shape::EDGE);
 
   // Store from shapes.
   storeShapes(aResultBody, aBaseShapeType, thePipeAlgo->fromShapes(), "From_");
@@ -330,6 +327,7 @@ void FeaturesPlugin_Pipe::storeResult(const std::shared_ptr<GeomAPI_Shape> theBa
 
 //==================================================================================================
 void FeaturesPlugin_Pipe::storeResult(const ListOfShape& theBaseShapes,
+                                      const std::shared_ptr<GeomAPI_Shape> thePathShape,
                                       const std::shared_ptr<GeomAlgoAPI_Pipe> thePipeAlgo,
                                       const int theResultIndex)
 {
@@ -371,6 +369,9 @@ void FeaturesPlugin_Pipe::storeResult(const ListOfShape& theBaseShapes,
     aResultBody->loadGeneratedShapes(thePipeAlgo, aBaseShape, aShapeTypeToExplode);
   }
 
+  if (thePathShape.get())
+    aResultBody->loadGeneratedShapes(thePipeAlgo, thePathShape, GeomAPI_Shape::EDGE);
+
   // Store from shapes.
   storeShapes(aResultBody, theBaseShapes.front()->shapeType(), thePipeAlgo->fromShapes(), "From_");