X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_Rotation.cpp;h=c5244788b8949eab1b51c3e828023111ce93e93e;hb=4d6bb9de0e54f09a9bbacc94a058cb7cd437d535;hp=f165e5aa829efb4b484528408610e9266418b905;hpb=64e9d01b48f8c4e6e22919ebceeed715d613485e;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Rotation.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Rotation.cpp index f165e5aa8..c5244788b 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Rotation.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Rotation.cpp @@ -4,21 +4,14 @@ // Created: 12 May 2015 // Author: Dmitry Bobylev -#include - -#include +#include "GeomAlgoAPI_Rotation.h" #include -#include -#include -#include //================================================================================================= GeomAlgoAPI_Rotation::GeomAlgoAPI_Rotation(std::shared_ptr theSourceShape, std::shared_ptr theAxis, double theAngle) -: myDone(false), - myShape(new GeomAPI_Shape()) { build(theSourceShape, theAxis, theAngle); } @@ -39,73 +32,24 @@ void GeomAlgoAPI_Rotation::build(std::shared_ptr theSourceShape, return; } - gp_Trsf aTrsf; - aTrsf.SetRotation(anAxis, theAngle / 180.0 * M_PI); + gp_Trsf* aTrsf = new gp_Trsf(); + aTrsf->SetRotation(anAxis, theAngle / 180.0 * M_PI); // Transform the shape with copying it. - BRepBuilderAPI_Transform* aBuilder = new BRepBuilderAPI_Transform(aSourceShape, aTrsf, true); + BRepBuilderAPI_Transform* aBuilder = new BRepBuilderAPI_Transform(aSourceShape, *aTrsf, true); if(!aBuilder) { return; } + this->setImpl(aBuilder); + this->setBuilderType(OCCT_BRepBuilderAPI_MakeShape); - setImpl(aBuilder); - myDone = aBuilder->IsDone() == Standard_True; - - if(!myDone) { + if(aBuilder->IsDone() != Standard_True) { return; } - TopoDS_Shape aResult = aBuilder->Shape(); - // Fill data map to keep correct orientation of sub-shapes. - for(TopExp_Explorer anExp(aResult, TopAbs_FACE); anExp.More(); anExp.Next()) { - std::shared_ptr aCurrentShape(new GeomAPI_Shape()); - aCurrentShape->setImpl(new TopoDS_Shape(anExp.Current())); - myMap.bind(aCurrentShape, aCurrentShape); - } - - myShape->setImpl(new TopoDS_Shape(aResult)); - myMkShape = new GeomAlgoAPI_MakeShape(aBuilder); -} - -//================================================================================================= -const bool GeomAlgoAPI_Rotation::isValid() const -{ - BRepCheck_Analyzer aChecker(myShape->impl()); - return (aChecker.IsValid() == Standard_True); -} - -//================================================================================================= -const bool GeomAlgoAPI_Rotation::hasVolume() const -{ - bool hasVolume(false); - if(isValid() && (GeomAlgoAPI_ShapeProps::volume(myShape) > Precision::Confusion())) { - hasVolume = true; - } - return hasVolume; -} -//================================================================================================= -const std::shared_ptr& GeomAlgoAPI_Rotation::shape() const -{ - return myShape; -} - -//================================================================================================= -void GeomAlgoAPI_Rotation::mapOfShapes(GeomAPI_DataMapOfShapeShape& theMap) const -{ - theMap = myMap; -} - -//================================================================================================= -GeomAlgoAPI_MakeShape* GeomAlgoAPI_Rotation::makeShape() const -{ - return myMkShape; -} - -//================================================================================================= -GeomAlgoAPI_Rotation::~GeomAlgoAPI_Rotation() -{ - if (myImpl) { - myMap.clear(); - } + std::shared_ptr aShape(new GeomAPI_Shape()); + aShape->setImpl(new TopoDS_Shape(aResult)); + this->setShape(aShape); + this->setDone(true); }