X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_Translation.cpp;h=27af5311f05f1879307097b5998bbe444c3fcd26;hb=3205d0f18200948632155bbe7b640bc1e482243d;hp=8f505072fcd30199867814a90207a4089014cff4;hpb=98ab1b11edf389663aef6057f0bdd7ac2d82ec71;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Translation.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Translation.cpp index 8f505072f..27af5311f 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Translation.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Translation.cpp @@ -4,21 +4,15 @@ // Created: 8 June 2015 // Author: Dmitry Bobylev -#include - -#include +#include "GeomAlgoAPI_Translation.h" #include -#include #include -#include -#include //================================================================================================= GeomAlgoAPI_Translation::GeomAlgoAPI_Translation(std::shared_ptr theSourceShape, std::shared_ptr theAxis, double theDistance) -: myDone(false) { build(theSourceShape, theAxis, theDistance); } @@ -41,71 +35,22 @@ void GeomAlgoAPI_Translation::build(std::shared_ptr theSourceShap gp_Trsf* aTrsf = new gp_Trsf(); aTrsf->SetTranslation(gp_Vec(anAxis.Direction()) * theDistance); - myTrsf.reset(new GeomAPI_Trsf(aTrsf)); // Transform the shape with copying it. BRepBuilderAPI_Transform* aBuilder = new BRepBuilderAPI_Transform(aSourceShape, *aTrsf, true); if(!aBuilder) { return; } - myMkShape.reset(new GeomAlgoAPI_MakeShape(aBuilder)); - - myDone = aBuilder->IsDone() == Standard_True; + this->setImpl(aBuilder); + this->setBuilderType(OCCT_BRepBuilderAPI_MakeShape); - if(!myDone) { + if(aBuilder->IsDone() != Standard_True) { return; } - TopoDS_Shape aResult = aBuilder->Shape(); - // Fill data map to keep correct orientation of sub-shapes. - myMap.reset(new GeomAPI_DataMapOfShapeShape()); - 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.reset(new GeomAPI_Shape()); - myShape->setImpl(new TopoDS_Shape(aResult)); -} - -//================================================================================================= -const bool GeomAlgoAPI_Translation::isValid() const -{ - BRepCheck_Analyzer aChecker(myShape->impl()); - return (aChecker.IsValid() == Standard_True); -} - -//================================================================================================= -const bool GeomAlgoAPI_Translation::hasVolume() const -{ - bool hasVolume(false); - if(isValid() && (GeomAlgoAPI_ShapeTools::volume(myShape) > Precision::Confusion())) { - hasVolume = true; - } - return hasVolume; -} -//================================================================================================= -const std::shared_ptr& GeomAlgoAPI_Translation::shape() const -{ - return myShape; -} - -//================================================================================================= -std::shared_ptr GeomAlgoAPI_Translation::mapOfShapes() const -{ - return myMap; -} - -//================================================================================================= -std::shared_ptr GeomAlgoAPI_Translation::makeShape() const -{ - return myMkShape; -} - -//================================================================================================= -std::shared_ptr GeomAlgoAPI_Translation::transformation() const -{ - return myTrsf; + std::shared_ptr aShape(new GeomAPI_Shape()); + aShape->setImpl(new TopoDS_Shape(aResult)); + this->setShape(aShape); + this->setDone(true); }