X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_Pipe.cpp;h=067a249bd592d27e11cf924b8923f6dcee1b48d2;hb=09365c927ebe8d881de2eda7f96bc33a2d9511c8;hp=b0a693cebbea4a10e5e1bccfaeaa90be2a26594c;hpb=c4eab94a20a0d93100549a210582d46409fec1cc;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.cpp index b0a693ceb..067a249bd 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -96,7 +97,12 @@ void GeomAlgoAPI_Pipe::build(const GeomShapePtr theBaseShape, if(!getPath(aPathWire, thePathShape)) { return; } + GeomShapePtr anOldPath(new GeomAPI_Shape), aNewPath(new GeomAPI_Shape); + anOldPath->setImpl(new TopoDS_Shape(aPathWire)); aPathWire.Move(getPathToBaseTranslation(aBaseShape, aPathWire)); + aNewPath->setImpl(new TopoDS_Shape(aPathWire)); + if (!anOldPath->isSame(aNewPath)) + addMovedPath(anOldPath, aNewPath); // Making pipe. BRepOffsetAPI_MakePipe* aPipeBuilder = new BRepOffsetAPI_MakePipe(aPathWire, aBaseShape); @@ -140,7 +146,12 @@ void GeomAlgoAPI_Pipe::build(const GeomShapePtr theBaseShape, return; } + GeomShapePtr anOldPath(new GeomAPI_Shape), aNewPath(new GeomAPI_Shape); + anOldPath->setImpl(new TopoDS_Shape(aPathWire)); aPathWire.Move(getPathToBaseTranslation(theBaseShape->impl(), aPathWire)); + aNewPath->setImpl(new TopoDS_Shape(aPathWire)); + if (!anOldPath->isSame(aNewPath)) + addMovedPath(anOldPath, aNewPath); // Getting Bi-Normal. TopoDS_Shape aBiNormalShape = theBiNormal->impl(); @@ -211,7 +222,13 @@ void GeomAlgoAPI_Pipe::build(const ListOfShape& theBaseShapes, TopoDS_Shape aReallyBase = theBaseShapes.front()->impl(); gp_Trsf aTrsf = getPathToBaseTranslation(aReallyBase, aPathWire); + + GeomShapePtr anOldPath(new GeomAPI_Shape), aNewPath(new GeomAPI_Shape); + anOldPath->setImpl(new TopoDS_Shape(aPathWire)); aPathWire.Move(aTrsf); + aNewPath->setImpl(new TopoDS_Shape(aPathWire)); + if (!anOldPath->isSame(aNewPath)) + addMovedPath(anOldPath, aNewPath); // Get locations after moving path shape. std::list aLocations; @@ -329,7 +346,10 @@ void GeomAlgoAPI_Pipe::build(const ListOfShape& theBaseShapes, void GeomAlgoAPI_Pipe::generated(const GeomShapePtr theShape, ListOfShape& theHistory) { - GeomAlgoAPI_MakeShape::generated(theShape, theHistory); + if (myMovedPath.isBound(theShape)) + GeomAlgoAPI_MakeShape::generated(myMovedPath.find(theShape), theHistory); + else + GeomAlgoAPI_MakeShape::generated(theShape, theHistory); } // Auxilary functions: @@ -440,3 +460,14 @@ ListOfShape getListFromShape(const TopoDS_Shape& theShape) return aList; } + +//================================================================================================== +void GeomAlgoAPI_Pipe::addMovedPath(GeomShapePtr thePath, GeomShapePtr theMoved) +{ + myMovedPath.clear(); + GeomAPI_ShapeExplorer anOldExp(thePath, GeomAPI_Shape::EDGE); + GeomAPI_ShapeExplorer aNewExp(theMoved, GeomAPI_Shape::EDGE); + for(; anOldExp.more(); anOldExp.next(), aNewExp.next()) { + myMovedPath.bind(anOldExp.current(), aNewExp.current()); + } +}