X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FFeaturesPlugin%2FFeaturesPlugin_Pipe.cpp;h=be47490ad99760318c70c71c917308dae3719e51;hb=1dfcab3d738e427bea678317e167c587dfbff195;hp=cd6c8781fd3af762360ae3b84edea67165994f70;hpb=97917d3698f5a2f7fc9596e7c755ff8f6751e373;p=modules%2Fshaper.git diff --git a/src/FeaturesPlugin/FeaturesPlugin_Pipe.cpp b/src/FeaturesPlugin/FeaturesPlugin_Pipe.cpp index cd6c8781f..be47490ad 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Pipe.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Pipe.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2019 CEA/DEN, EDF R&D +// Copyright (C) 2014-2020 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 @@ -238,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 aPipeAlgo(new GeomAlgoAPI_Pipe(aBaseShapesList, @@ -251,7 +251,7 @@ void FeaturesPlugin_Pipe::execute() return; } - storeResult(aBaseShapesList, aPipeAlgo, aResultIndex++); + storeResult(aBaseShapesList, aPathShape, aPipeAlgo, aResultIndex++); } else { setError("Error: Wrong creation method."); return; @@ -262,6 +262,7 @@ void FeaturesPlugin_Pipe::execute() //================================================================================================== void FeaturesPlugin_Pipe::storeResult(const std::shared_ptr theBaseShape, + const std::shared_ptr thePathShape, const std::shared_ptr thePipeAlgo, const int theResultIndex) { @@ -273,7 +274,7 @@ void FeaturesPlugin_Pipe::storeResult(const std::shared_ptr theBa // Store generated edges/faces. GeomAPI_Shape::ShapeType aBaseShapeType = theBaseShape->shapeType(); - GeomAPI_Shape::ShapeType aShapeTypeToExplode; + GeomAPI_Shape::ShapeType aShapeTypeToExplode = GeomAPI_Shape::SHAPE; switch(aBaseShapeType) { case GeomAPI_Shape::VERTEX: { @@ -302,6 +303,8 @@ void FeaturesPlugin_Pipe::storeResult(const std::shared_ptr theBa case GeomAPI_Shape::COMPOUND: { aShapeTypeToExplode = GeomAPI_Shape::COMPOUND; } + default: + return; // unsupported type of shape } if(aShapeTypeToExplode == GeomAPI_Shape::VERTEX || @@ -312,6 +315,8 @@ void FeaturesPlugin_Pipe::storeResult(const std::shared_ptr 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_"); @@ -324,6 +329,7 @@ void FeaturesPlugin_Pipe::storeResult(const std::shared_ptr theBa //================================================================================================== void FeaturesPlugin_Pipe::storeResult(const ListOfShape& theBaseShapes, + const std::shared_ptr thePathShape, const std::shared_ptr thePipeAlgo, const int theResultIndex) { @@ -340,7 +346,7 @@ void FeaturesPlugin_Pipe::storeResult(const ListOfShape& theBaseShapes, { GeomShapePtr aBaseShape = *anIter; GeomAPI_Shape::ShapeType aBaseShapeType = aBaseShape->shapeType(); - GeomAPI_Shape::ShapeType aShapeTypeToExplode; + GeomAPI_Shape::ShapeType aShapeTypeToExplode = GeomAPI_Shape::SHAPE; switch(aBaseShapeType) { case GeomAPI_Shape::VERTEX: { aShapeTypeToExplode = GeomAPI_Shape::VERTEX; @@ -353,18 +359,25 @@ void FeaturesPlugin_Pipe::storeResult(const ListOfShape& theBaseShapes, ListOfShape aV1History, aV2History; thePipeAlgo->generated(aV1, aV1History); thePipeAlgo->generated(aV2, aV2History); - aResultBody->generated(aV1, aV1History.front()); - aResultBody->generated(aV2, aV2History.front()); + if (!aV1History.empty()) + aResultBody->generated(aV1, aV1History.front()); + if (!aV2History.empty()) + aResultBody->generated(aV2, aV2History.front()); } case GeomAPI_Shape::FACE: case GeomAPI_Shape::SHELL: { aShapeTypeToExplode = GeomAPI_Shape::EDGE; break; } + default: + return; // unsupported type of shape } 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_"); @@ -405,6 +418,8 @@ void FeaturesPlugin_Pipe::storeShapes(ResultBodyPtr theResultBody, aShapeTypeToExplore = GeomAPI_Shape::COMPOUND; break; } + default: + return; // unsupported type of shape } // Store shapes.