From c45761be52fed120c7e9a90eb2095cdc6cfb4334 Mon Sep 17 00:00:00 2001 From: azv Date: Fri, 14 Feb 2020 11:30:27 +0300 Subject: [PATCH] Refactor the transformation algorithms --- .../ConstructionPlugin_Plane.cpp | 15 +- .../FeaturesPlugin_MultiRotation.cpp | 7 - .../FeaturesPlugin_MultiTranslation.cpp | 14 -- .../FeaturesPlugin_Rotation.cpp | 17 +- src/FeaturesPlugin/FeaturesPlugin_Scale.cpp | 14 -- .../FeaturesPlugin_Symmetry.cpp | 23 +- .../FeaturesPlugin_Translation.cpp | 23 +- src/GeomAPI/GeomAPI_Trsf.cpp | 7 + src/GeomAPI/GeomAPI_Trsf.h | 7 + src/GeomAlgoAPI/GeomAlgoAPI_Rotation.cpp | 198 ++++++------------ src/GeomAlgoAPI/GeomAlgoAPI_Rotation.h | 29 +-- src/GeomAlgoAPI/GeomAlgoAPI_Scale.cpp | 141 +++---------- src/GeomAlgoAPI/GeomAlgoAPI_Scale.h | 34 +-- src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.cpp | 135 +++--------- src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.h | 30 +-- src/GeomAlgoAPI/GeomAlgoAPI_Transform.cpp | 29 ++- src/GeomAlgoAPI/GeomAlgoAPI_Transform.h | 9 +- src/GeomAlgoAPI/GeomAlgoAPI_Translation.cpp | 139 +++--------- src/GeomAlgoAPI/GeomAlgoAPI_Translation.h | 32 +-- 19 files changed, 208 insertions(+), 695 deletions(-) diff --git a/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp b/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp index 5b4338a98..d1dbb1924 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -399,18 +400,16 @@ std::shared_ptr ConstructionPlugin_Plane::createByRotation() // Getting angle. double anAngle = real(ANGLE())->value(); - GeomAlgoAPI_Rotation aRotationAlgo(aFace, anAxis, anAngle); - if (!aRotationAlgo.check()) { - setError(aRotationAlgo.getError()); - return GeomShapePtr(); - } - aRotationAlgo.build(); - if (!aRotationAlgo.isDone()) { + std::shared_ptr aRotationAlgo( + new GeomAlgoAPI_Rotation(aFace, anAxis, anAngle)); + // Checking that the algorithm worked properly. + std::string anError; + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aRotationAlgo, getKind(), anError)) { setError("Error: Failed to rotate plane"); return GeomShapePtr(); } - std::shared_ptr aRes(new GeomAPI_Face(aRotationAlgo.shape())); + std::shared_ptr aRes(new GeomAPI_Face(aRotationAlgo->shape())); return aRes; } diff --git a/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp b/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp index a11fc4af1..68151d9c6 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp @@ -202,13 +202,6 @@ void FeaturesPlugin_MultiRotation::performRotation1D() std::shared_ptr aRotationnAlgo( new GeomAlgoAPI_Rotation(aBaseShape, anAxis, i*anAngle)); - if (!aRotationnAlgo->check()) { - setError(aRotationnAlgo->getError()); - break; - } - - aRotationnAlgo->build(); - // Checking that the algorithm worked properly. if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aRotationnAlgo, getKind(), anError)) { setError(anError); diff --git a/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.cpp b/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.cpp index 9f311df13..51e96cd4a 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.cpp @@ -179,13 +179,6 @@ void FeaturesPlugin_MultiTranslation::performOneDirection() std::shared_ptr aTranslationAlgo( new GeomAlgoAPI_Translation(aBaseShape, anAxis, i*aStep)); - if (!aTranslationAlgo->check()) { - setError(aTranslationAlgo->getError()); - break; - } - - aTranslationAlgo->build(); - // Checking that the algorithm worked properly. if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed( aTranslationAlgo, getKind(), anError)) { @@ -379,13 +372,6 @@ void FeaturesPlugin_MultiTranslation::performTwoDirection() std::shared_ptr aTranslationAlgo( new GeomAlgoAPI_Translation(aBaseShape, dx, dy, dz)); - if (!aTranslationAlgo->check()) { - setError(aTranslationAlgo->getError()); - break; - } - - aTranslationAlgo->build(); - // Checking that the algorithm worked properly. if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed( aTranslationAlgo, getKind(), anError)) { diff --git a/src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp b/src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp index 7ef1d86b8..eee97cad3 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -157,14 +158,6 @@ void FeaturesPlugin_Rotation::performTranslationByAxisAndAngle() std::shared_ptr aRotationAlgo(new GeomAlgoAPI_Rotation(aBaseShape, anAxis, anAngle)); - - if (!aRotationAlgo->check()) { - setError(aRotationAlgo->getError()); - return; - } - - aRotationAlgo->build(); - // Checking that the algorithm worked properly. if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aRotationAlgo, getKind(), anError)) { setError(anError); @@ -263,14 +256,6 @@ void FeaturesPlugin_Rotation::performTranslationByThreePoints() aCenterPoint, aStartPoint, anEndPoint)); - - if (!aRotationAlgo->check()) { - setError(aRotationAlgo->getError()); - return; - } - - aRotationAlgo->build(); - // Checking that the algorithm worked properly. if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aRotationAlgo, getKind(), anError)) { setError(anError); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Scale.cpp b/src/FeaturesPlugin/FeaturesPlugin_Scale.cpp index bdb4cdd52..cb7a85686 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Scale.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Scale.cpp @@ -123,13 +123,6 @@ void FeaturesPlugin_Scale::performScaleByFactor() std::shared_ptr aScaleAlgo( new GeomAlgoAPI_Scale(aBaseShape, aCenterPoint, aScaleFactor)); - if (!aScaleAlgo->check()) { - setError(aScaleAlgo->getError()); - return; - } - - aScaleAlgo->build(); - // Checking that the algorithm worked properly. if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aScaleAlgo, getKind(), anError)) { setError(anError); @@ -208,13 +201,6 @@ void FeaturesPlugin_Scale::performScaleByDimensions() aScaleFactorY, aScaleFactorZ)); - if (!aScaleAlgo->check()) { - setError(aScaleAlgo->getError()); - return; - } - - aScaleAlgo->build(); - // Checking that the algorithm worked properly. if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aScaleAlgo, getKind(), anError)) { setError(anError); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp b/src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp index 38b50f393..74acd252a 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp @@ -26,6 +26,8 @@ #include #include +#include +#include #include #include #include @@ -153,13 +155,6 @@ void FeaturesPlugin_Symmetry::performSymmetryByPoint() std::shared_ptr aSymmetryAlgo( new GeomAlgoAPI_Symmetry(aBaseShape, aPoint)); - if (!aSymmetryAlgo->check()) { - setError(aSymmetryAlgo->getError()); - return; - } - - aSymmetryAlgo->build(); - // Checking that the algorithm worked properly. if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aSymmetryAlgo, getKind(), anError)) { setError(anError); @@ -239,13 +234,6 @@ void FeaturesPlugin_Symmetry::performSymmetryByAxis() std::shared_ptr aSymmetryAlgo( new GeomAlgoAPI_Symmetry(aBaseShape, anAxis)); - if (!aSymmetryAlgo->check()) { - setError(aSymmetryAlgo->getError()); - return; - } - - aSymmetryAlgo->build(); - // Checking that the algorithm worked properly. if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aSymmetryAlgo, getKind(), anError)) { setError(anError); @@ -324,13 +312,6 @@ void FeaturesPlugin_Symmetry::performSymmetryByPlane() std::shared_ptr aSymmetryAlgo( new GeomAlgoAPI_Symmetry(aBaseShape, aPlane)); - if (!aSymmetryAlgo->check()) { - setError(aSymmetryAlgo->getError()); - return; - } - - aSymmetryAlgo->build(); - // Checking that the algorithm worked properly. if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aSymmetryAlgo, getKind(), anError)) { setError(anError); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Translation.cpp b/src/FeaturesPlugin/FeaturesPlugin_Translation.cpp index eff54dc68..9894901e4 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Translation.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Translation.cpp @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -169,14 +170,6 @@ void FeaturesPlugin_Translation::performTranslationByAxisAndDistance() } else { std::shared_ptr aTranslationAlgo( new GeomAlgoAPI_Translation(aBaseShape, anAxis, aDistance)); - - if (!aTranslationAlgo->check()) { - setError(aTranslationAlgo->getError()); - return; - } - - aTranslationAlgo->build(); - // Checking that the algorithm worked properly. if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aTranslationAlgo, getKind(), anError)) { setError(anError); @@ -250,13 +243,6 @@ void FeaturesPlugin_Translation::performTranslationByDimensions() std::shared_ptr aTranslationAlgo( new GeomAlgoAPI_Translation(aBaseShape, aDX, aDY, aDZ)); - if (!aTranslationAlgo->check()) { - setError(aTranslationAlgo->getError()); - return; - } - - aTranslationAlgo->build(); - // Checking that the algorithm worked properly. if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aTranslationAlgo, getKind(), anError)) { setError(anError); @@ -343,13 +329,6 @@ void FeaturesPlugin_Translation::performTranslationByTwoPoints() std::shared_ptr aTranslationAlgo( new GeomAlgoAPI_Translation(aBaseShape, aFirstPoint, aSecondPoint)); - if (!aTranslationAlgo->check()) { - setError(aTranslationAlgo->getError()); - return; - } - - aTranslationAlgo->build(); - // Checking that the algorithm worked properly. if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aTranslationAlgo, getKind(), anError)) { setError(anError); diff --git a/src/GeomAPI/GeomAPI_Trsf.cpp b/src/GeomAPI/GeomAPI_Trsf.cpp index b2df2368d..2a9d8fdd9 100644 --- a/src/GeomAPI/GeomAPI_Trsf.cpp +++ b/src/GeomAPI/GeomAPI_Trsf.cpp @@ -106,3 +106,10 @@ void GeomAPI_Trsf::setSymmetry(const std::shared_ptr thePlane) { MY_TRSF->SetMirror(thePlane->impl()); } + +//================================================================================================= +void GeomAPI_Trsf::setScale(const std::shared_ptr& theCenter, + const double theScale) +{ + MY_TRSF->SetScale(theCenter->impl(), theScale); +} diff --git a/src/GeomAPI/GeomAPI_Trsf.h b/src/GeomAPI/GeomAPI_Trsf.h index 84539eca6..f00a09a80 100644 --- a/src/GeomAPI/GeomAPI_Trsf.h +++ b/src/GeomAPI/GeomAPI_Trsf.h @@ -93,6 +93,13 @@ class GeomAPI_Trsf : public GeomAPI_Interface * \param[in] thePlane symmetry plane. */ GEOMAPI_EXPORT void setSymmetry(const std::shared_ptr thePlane); + + /** \brief Sets the scaling transformation. + * \param[in] theCenter scaling origin. + * \param[in] theScale scaling factor. + */ + GEOMAPI_EXPORT void setScale(const std::shared_ptr& theCenter, + const double theScale); }; //! Pointer on the object diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Rotation.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Rotation.cpp index cea4cc57e..35411e405 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Rotation.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Rotation.cpp @@ -17,27 +17,34 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include "GeomAlgoAPI_Rotation.h" +#include +#include +#include #include -#include - -#include -#include -#include - #include +// Verify points are applicable to build the rotation transformation +static bool checkPoints(GeomPointPtr theCenterPoint, + GeomPointPtr theStartPoint, + GeomPointPtr theEndPoint, + std::string& theError); + //================================================================================================= GeomAlgoAPI_Rotation::GeomAlgoAPI_Rotation(std::shared_ptr theSourceShape, std::shared_ptr theAxis, double theAngle) { - myMethodType = BY_ANGLE; - mySourceShape = theSourceShape; - myAxis = theAxis; - myAngle = theAngle; + if (!theAxis) { + myError = "Rotation builder :: axis is not valid."; + return; + } + + GeomTrsfPtr aTrsf(new GeomAPI_Trsf); + aTrsf->setRotation(theAxis, theAngle / 180.0 * M_PI); + + build(theSourceShape, aTrsf); } @@ -47,139 +54,58 @@ GeomAlgoAPI_Rotation::GeomAlgoAPI_Rotation(std::shared_ptr theSou std::shared_ptr theStartPoint, std::shared_ptr theEndPoint) { - myMethodType = BY_POINTS; - mySourceShape = theSourceShape; - myCenterPoint = theCenterPoint; - myStartPoint = theStartPoint; - myEndPoint = theEndPoint; -} + if (!checkPoints(theCenterPoint, theStartPoint, theEndPoint, myError)) + return; -//================================================================================================= -bool GeomAlgoAPI_Rotation::check() -{ - switch (myMethodType) { - case BY_ANGLE: { - if (!myAxis) { - myError = "Rotation builder :: axis is not valid."; - return false; - } - if (!mySourceShape) { - myError = "Rotation builder :: source shape is not valid."; - return false; - } - return true; - } - case BY_POINTS: { - if (!myCenterPoint) { - myError = "Rotation builder :: center point is not valid."; - return false; - } - if (!myStartPoint) { - myError = "Rotation builder :: start point is not valid."; - return false; - } - if (!myEndPoint) { - myError = "Rotation builder :: end point is not valid."; - return false; - } - if (!mySourceShape) { - myError = "Rotation builder :: source shape is not valid."; - return false; - } - if(myCenterPoint->distance(myStartPoint) < Precision::Confusion()) { - myError = "Rotation builder :: center point and start point coincide."; - return false; - } - if(myCenterPoint->distance(myEndPoint) < Precision::Confusion()) { - myError = "Rotation builder :: center point and end point coincide."; - return false; - } - if(myStartPoint->distance(myEndPoint) < Precision::Confusion()) { - myError = "Rotation builder :: start point and end point coincide."; - return false; - } - std::shared_ptr aCenterPointXYZ = myCenterPoint->xyz(); - std::shared_ptr aStartPointXYZ = myStartPoint->xyz(); - std::shared_ptr aEndPointXYZ = myEndPoint->xyz(); - std::shared_ptr vectCenterPointStartPoint = - aStartPointXYZ->decreased(aCenterPointXYZ); - std::shared_ptr vectCenterPointEndPoint = - aEndPointXYZ->decreased(aCenterPointXYZ); - std::shared_ptr crossProduct = - vectCenterPointStartPoint->cross(vectCenterPointEndPoint); - std::shared_ptr aOriginPnt = - std::shared_ptr(new GeomAPI_Pnt(0.,0.,0.)); - std::shared_ptr aOriginXYZ = aOriginPnt->xyz(); + GeomTrsfPtr aTrsf(new GeomAPI_Trsf); + aTrsf->setRotation(theCenterPoint, theStartPoint, theEndPoint); - if (crossProduct->distance(aOriginXYZ) < Precision::Confusion()) { - myError = "Rotation builder :: center point, start point and end point are on a line."; - return false; - } - return true; - } - default: { - myError = "Rotation builder :: method not implemented."; - return false; - } - } + build(theSourceShape, aTrsf); } //================================================================================================= -void GeomAlgoAPI_Rotation::build() +bool checkPoints(GeomPointPtr theCenterPoint, + GeomPointPtr theStartPoint, + GeomPointPtr theEndPoint, + std::string& theError) { - gp_Trsf* aTrsf = new gp_Trsf(); - - switch (myMethodType) { - case BY_ANGLE: { - const gp_Ax1& anAxis = myAxis->impl(); - aTrsf->SetRotation(anAxis, myAngle/180.0*M_PI); - break; - } - case BY_POINTS: { - const gp_Pnt& aCenterPoint = myCenterPoint->impl(); - const gp_Pnt& aStartPoint = myStartPoint->impl(); - const gp_Pnt& aEndPoint = myEndPoint->impl(); - gp_Vec aVec1(aCenterPoint, aStartPoint); - gp_Vec aVec2(aCenterPoint, aEndPoint); - gp_Dir aDir(aVec1^aVec2); - gp_Ax1 anAxis(aCenterPoint, aDir); - double anAngle = aVec1.Angle(aVec2); - if (fabs(anAngle) < Precision::Angular()) anAngle += 2.*M_PI; - aTrsf->SetRotation(anAxis, anAngle); - break; - } - default: { - myError = "Rotation builder :: method not supported"; - return; - } + if (!theCenterPoint) { + theError = "Rotation builder :: center point is not valid."; + return false; } - - const TopoDS_Shape& aSourceShape = mySourceShape->impl(); - - if(aSourceShape.IsNull()) { - myError = "Rotation builder :: source shape does not contain any actual shape."; - return; + if (!theStartPoint) { + theError = "Rotation builder :: start point is not valid."; + return false; } - - // Transform the shape while copying it. - BRepBuilderAPI_Transform* aBuilder = new BRepBuilderAPI_Transform(aSourceShape, *aTrsf, true); - if(!aBuilder) { - myError = "Rotation builder :: transform initialization failed."; - return; + if (!theEndPoint) { + theError = "Rotation builder :: end point is not valid."; + return false; } - - setImpl(aBuilder); - setBuilderType(OCCT_BRepBuilderAPI_MakeShape); - - if(!aBuilder->IsDone()) { - myError = "Rotation builder :: algorithm failed."; - return; + if (theCenterPoint->distance(theStartPoint) < Precision::Confusion()) { + theError = "Rotation builder :: center point and start point coincide."; + return false; } - - TopoDS_Shape aResult = aBuilder->Shape(); - - std::shared_ptr aShape(new GeomAPI_Shape()); - aShape->setImpl(new TopoDS_Shape(aResult)); - setShape(aShape); - setDone(true); + if (theCenterPoint->distance(theEndPoint) < Precision::Confusion()) { + theError = "Rotation builder :: center point and end point coincide."; + return false; + } + if (theStartPoint->distance(theEndPoint) < Precision::Confusion()) { + theError = "Rotation builder :: start point and end point coincide."; + return false; + } + std::shared_ptr aCenterPointXYZ = theCenterPoint->xyz(); + std::shared_ptr aStartPointXYZ = theStartPoint->xyz(); + std::shared_ptr aEndPointXYZ = theEndPoint->xyz(); + std::shared_ptr vectCenterPointStartPoint = + aStartPointXYZ->decreased(aCenterPointXYZ); + std::shared_ptr vectCenterPointEndPoint = + aEndPointXYZ->decreased(aCenterPointXYZ); + std::shared_ptr crossProduct = + vectCenterPointStartPoint->cross(vectCenterPointEndPoint); + + if (crossProduct->squareModulus() < Precision::SquareConfusion()) { + theError = "Rotation builder :: center point, start point and end point are on a line."; + return false; + } + return true; } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Rotation.h b/src/GeomAlgoAPI/GeomAlgoAPI_Rotation.h index 4a884451d..cc18518aa 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Rotation.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Rotation.h @@ -21,23 +21,17 @@ #define GeomAlgoAPI_Rotation_H_ #include -#include +#include -#include -#include +class GeomAPI_Ax1; +class GeomAPI_Pnt; /// \class GeomAlgoAPI_Rotation /// \ingroup DataAlgo /// \brief Creates a copy of the object by rotating it around the axis. -class GeomAlgoAPI_Rotation : public GeomAlgoAPI_MakeShape +class GeomAlgoAPI_Rotation : public GeomAlgoAPI_Transform { public: - /// Type of rotation operation - enum MethodType { - BY_ANGLE, ///< Rotation by axis and an angle - BY_POINTS ///< Rotation by a center and two points - }; - /// \brief Creates an object which is obtained from current object by rotating it around the axis /// with the angle. /// \param[in] theSourceShape a shape to be rotated. @@ -57,21 +51,6 @@ public: std::shared_ptr theCenterPoint, std::shared_ptr theStartPoint, std::shared_ptr theEndPoint); - - /// Checks if data for the translation execution is OK. - GEOMALGOAPI_EXPORT bool check(); - - /// Execute the translation. - GEOMALGOAPI_EXPORT void build(); - -private: - MethodType myMethodType; /// Type of method used. - std::shared_ptr mySourceShape; /// Shape to be rotated. - std::shared_ptr myAxis; /// Rotation axis. - double myAngle; /// Rotation angle. - std::shared_ptr myCenterPoint; /// Rotation center point. - std::shared_ptr myStartPoint; /// Rotation start point. - std::shared_ptr myEndPoint; /// Rotation end point. }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Scale.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Scale.cpp index 3165c0227..bde61cc26 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Scale.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Scale.cpp @@ -17,9 +17,10 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include "GeomAlgoAPI_Scale.h" +#include + +#include -#include #include //================================================================================================= @@ -27,10 +28,15 @@ GeomAlgoAPI_Scale::GeomAlgoAPI_Scale(std::shared_ptr theSourceSha std::shared_ptr theCenterPoint, double theScaleFactor) { - myMethodType = BY_FACTOR; - mySourceShape = theSourceShape; - myCenterPoint = theCenterPoint; - myScaleFactor = theScaleFactor; + if (fabs(theScaleFactor) < Precision::Confusion()) { + myError = "Scale builder :: the scale factor is null."; + return; + } + + GeomTrsfPtr aTrsf(new GeomAPI_Trsf); + aTrsf->setScale(theCenterPoint, theScaleFactor); + + build(theSourceShape, aTrsf); } //================================================================================================= @@ -40,133 +46,48 @@ GeomAlgoAPI_Scale::GeomAlgoAPI_Scale(std::shared_ptr theSourceSha double theScaleFactorY, double theScaleFactorZ) { - myMethodType = BY_DIMENSIONS; - mySourceShape = theSourceShape; - myCenterPoint = theCenterPoint; - myScaleFactorX = theScaleFactorX; - myScaleFactorY = theScaleFactorY; - myScaleFactorZ = theScaleFactorZ; -} - -//================================================================================================= -bool GeomAlgoAPI_Scale::check() -{ - if (!mySourceShape) { - myError = "Scale builder :: source shape is not valid."; - return false; - } - if (!myCenterPoint) { - myError = "Scale builder :: center point is not valid."; - return false; - } - switch (myMethodType) { - case BY_FACTOR: { - if (fabs(myScaleFactor) < Precision::Confusion()) { - myError = "Scale builder :: the scale factor is null."; - return false; - } - return true; - } - case BY_DIMENSIONS: { - if (fabs(myScaleFactorX) < Precision::Confusion()) { - myError = "Scale builder :: the scale factor in X is null."; - return false; - } - if (fabs(myScaleFactorY) < Precision::Confusion()) { - myError = "Scale builder :: the scale factor in Y is null."; - return false; - } - if (fabs(myScaleFactorZ) < Precision::Confusion()) { - myError = "Scale builder :: the scale factor in Z is null."; - return false; - } - return true; - } - default: { - myError = "Scale builder :: method not implemented."; - return false; - } - } -} - -//================================================================================================= -void GeomAlgoAPI_Scale::build() -{ - switch (myMethodType) { - case BY_FACTOR : { - buildByFactor(); - break; - } - case BY_DIMENSIONS : { - buildByDimensions(); - break; - } - default : { - myError = "Scale builder :: method not yet implemented"; - return; - } - } -} - -//================================================================================================= -void GeomAlgoAPI_Scale::buildByFactor() -{ - const gp_Pnt& aCenterPoint = myCenterPoint->impl(); - gp_Trsf* aTrsf = new gp_Trsf(); - aTrsf->SetScale(aCenterPoint, myScaleFactor); - - const TopoDS_Shape& aSourceShape = mySourceShape->impl(); - - if(aSourceShape.IsNull()) { - myError = "Scale builder :: source shape does not contain any actual shape."; + if (fabs(theScaleFactorX) < Precision::Confusion()) { + myError = "Scale builder :: the scale factor in X is null."; return; } - - // Transform the shape while copying it. - BRepBuilderAPI_Transform* aBuilder = new BRepBuilderAPI_Transform(aSourceShape, *aTrsf, true); - if(!aBuilder) { - myError = "Scale builder :: transform initialization failed."; + if (fabs(theScaleFactorY) < Precision::Confusion()) { + myError = "Scale builder :: the scale factor in Y is null."; return; } - - setImpl(aBuilder); - setBuilderType(OCCT_BRepBuilderAPI_MakeShape); - - if(!aBuilder->IsDone()) { - myError = "Scale builder :: algorithm failed."; + if (fabs(theScaleFactorZ) < Precision::Confusion()) { + myError = "Scale builder :: the scale factor in Z is null."; return; } - TopoDS_Shape aResult = aBuilder->Shape(); - - std::shared_ptr aShape(new GeomAPI_Shape()); - aShape->setImpl(new TopoDS_Shape(aResult)); - setShape(aShape); - setDone(true); + buildByDimensions(theSourceShape, theCenterPoint, + theScaleFactorX, theScaleFactorY, theScaleFactorZ); } //================================================================================================= -void GeomAlgoAPI_Scale::buildByDimensions() +void GeomAlgoAPI_Scale::buildByDimensions(std::shared_ptr theSourceShape, + std::shared_ptr theCenterPoint, + double theScaleFactorX, + double theScaleFactorY, + double theScaleFactorZ) { - const gp_Pnt& aCenterPoint = myCenterPoint->impl(); + const gp_Pnt& aCenterPoint = theCenterPoint->impl(); // Perform the rotation matrix - gp_Mat aMatRot(myScaleFactorX, 0., 0., - 0., myScaleFactorY, 0., - 0., 0., myScaleFactorZ); + gp_Mat aMatRot(theScaleFactorX, 0., 0., + 0., theScaleFactorY, 0., + 0., 0., theScaleFactorZ); // Perform the tranformation - gp_Pnt anOriginPnt(0., 0., 0.); gp_GTrsf aGTrsf; gp_GTrsf aGTrsfP0; gp_GTrsf aGTrsf0P; - aGTrsfP0.SetTranslationPart(anOriginPnt.XYZ() - aCenterPoint.XYZ()); + aGTrsfP0.SetTranslationPart(gp::Origin().XYZ() - aCenterPoint.XYZ()); aGTrsf0P.SetTranslationPart(aCenterPoint.XYZ()); aGTrsf.SetVectorialPart(aMatRot); aGTrsf = aGTrsf0P.Multiplied(aGTrsf); aGTrsf = aGTrsf.Multiplied(aGTrsfP0); - const TopoDS_Shape& aSourceShape = mySourceShape->impl(); + const TopoDS_Shape& aSourceShape = theSourceShape->impl(); if(aSourceShape.IsNull()) { myError = "Scale builder :: source shape does not contain any actual shape."; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Scale.h b/src/GeomAlgoAPI/GeomAlgoAPI_Scale.h index 583fd7501..158e0c5ab 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Scale.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Scale.h @@ -20,23 +20,18 @@ #ifndef GEOMALGOAPI_SCALE_H_ #define GEOMALGOAPI_SCALE_H_ -#include +#include +#include -#include +class GeomAPI_Pnt; /// \class GeomAlgoAPI_Scale /// \ingroup DataAlgo /// \brief Creates a copy of the object by performing a scale operation by a factor or /// by dimensions. -class GeomAlgoAPI_Scale : public GeomAlgoAPI_MakeShape +class GeomAlgoAPI_Scale : public GeomAlgoAPI_Transform { public: - /// Type of scale operation - enum MethodType { - BY_FACTOR, ///< Scale by factor. - BY_DIMENSIONS, ///< Scale by dimensions. - }; - /// \brief Creates an object which is obtained from current object by performing /// a scale operation by a factor. /// \param[in] theSourceShape the shape to be moved. @@ -59,23 +54,12 @@ public: double theScaleFactorY, double theScaleFactorZ); - /// Checks if data for the scale transform is OK. - GEOMALGOAPI_EXPORT bool check(); - - /// Execute the scale transform. - GEOMALGOAPI_EXPORT void build(); - private: - MethodType myMethodType; /// Type of method used. - std::shared_ptr mySourceShape; /// Shape to be moved. - std::shared_ptr myCenterPoint; /// Center point. - double myScaleFactor; /// Scale factor. - double myScaleFactorX; /// Scale factor in X. - double myScaleFactorY; /// Scale factor in Y. - double myScaleFactorZ; /// Scale factor in Z. - - void buildByFactor(); - void buildByDimensions(); + void buildByDimensions(std::shared_ptr theSourceShape, + std::shared_ptr theCenterPoint, + double theScaleFactorX, + double theScaleFactorY, + double theScaleFactorZ); }; #endif // GEOMALGOAPI_SCALE_H_ \ No newline at end of file diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.cpp index 3497664ff..3f47db999 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.cpp @@ -17,134 +17,53 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include "GeomAlgoAPI_Symmetry.h" +#include -#include +#include +#include +#include //================================================================================================= GeomAlgoAPI_Symmetry::GeomAlgoAPI_Symmetry(std::shared_ptr theSourceShape, std::shared_ptr thePoint) { - myMethodType = BY_POINT; - mySourceShape = theSourceShape; - myPoint = thePoint; + if (!thePoint) { + myError = "Symmetry builder :: point is not valid."; + return; + } + + GeomTrsfPtr aTrsf(new GeomAPI_Trsf); + aTrsf->setSymmetry(thePoint); + + build(theSourceShape, aTrsf); } //================================================================================================= GeomAlgoAPI_Symmetry::GeomAlgoAPI_Symmetry(std::shared_ptr theSourceShape, std::shared_ptr theAxis) { - myMethodType = BY_AXIS; - mySourceShape = theSourceShape; - myAxis = theAxis; -} + if (!theAxis) { + myError = "Symmetry builder :: axis is not valid."; + return; + } -//================================================================================================= -GeomAlgoAPI_Symmetry::GeomAlgoAPI_Symmetry(std::shared_ptr theSourceShape, - std::shared_ptr thePlane) -{ - myMethodType = BY_PLANE; - mySourceShape = theSourceShape; - myPlane = thePlane; -} + GeomTrsfPtr aTrsf(new GeomAPI_Trsf); + aTrsf->setSymmetry(theAxis); -//================================================================================================= -bool GeomAlgoAPI_Symmetry::check() -{ - switch (myMethodType) { - case BY_POINT: { - if (!myPoint) { - myError = "Symmetry builder :: point is not valid."; - return false; - } - if (!mySourceShape) { - myError = "Symmetry builder :: source shape is not valid."; - return false; - } - return true; - } - case BY_AXIS: { - if (!myAxis) { - myError = "Symmetry builder :: axis is not valid."; - return false; - } - if (!mySourceShape) { - myError = "Symmetry builder :: source shape is not valid."; - return false; - } - return true; - } - case BY_PLANE: { - if (!myPlane) { - myError = "Symmetry builder :: plane is not valid."; - return false; - } - if (!mySourceShape) { - myError = "Symmetry builder :: source shape is not valid."; - return false; - } - return true; - } - default: { - myError = "Symmetry builder :: method not implemented."; - return false; - } - } + build(theSourceShape, aTrsf); } //================================================================================================= -void GeomAlgoAPI_Symmetry::build() +GeomAlgoAPI_Symmetry::GeomAlgoAPI_Symmetry(std::shared_ptr theSourceShape, + std::shared_ptr thePlane) { - gp_Trsf* aTrsf = new gp_Trsf(); - - switch (myMethodType) { - case BY_POINT: { - const gp_Pnt& aPoint = myPoint->impl(); - aTrsf->SetMirror(aPoint); - break; - } - case BY_AXIS: { - const gp_Ax1& anAxis = myAxis->impl(); - aTrsf->SetMirror(anAxis); - break; - } - case BY_PLANE: { - const gp_Ax2& aPlane = myPlane->impl(); - aTrsf->SetMirror(aPlane); - break; - } - default: { - myError = "Symmetry builder :: method not supported"; - return; - } - } - - const TopoDS_Shape& aSourceShape = mySourceShape->impl(); - - if(aSourceShape.IsNull()) { - myError = "Symmetry builder :: source shape does not contain any actual shape."; - return; - } - - // Transform the shape while copying it. - BRepBuilderAPI_Transform* aBuilder = new BRepBuilderAPI_Transform(aSourceShape, *aTrsf, true); - if(!aBuilder) { - myError = "Symmetry builder :: transform initialization failed."; - return; - } - - setImpl(aBuilder); - setBuilderType(OCCT_BRepBuilderAPI_MakeShape); - - if(!aBuilder->IsDone()) { - myError = "Symmetry builder :: algorithm failed."; + if (!thePlane) { + myError = "Symmetry builder :: plane is not valid."; return; } - TopoDS_Shape aResult = aBuilder->Shape(); + GeomTrsfPtr aTrsf(new GeomAPI_Trsf); + aTrsf->setSymmetry(thePlane); - std::shared_ptr aShape(new GeomAPI_Shape()); - aShape->setImpl(new TopoDS_Shape(aResult)); - setShape(aShape); - setDone(true); + build(theSourceShape, aTrsf); } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.h b/src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.h index f0f33aa90..884261a2d 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.h @@ -21,26 +21,19 @@ #define GEOMALGOAPI_SYMMETRY_H_ #include -#include +#include -#include -#include -#include +class GeomAPI_Ax1; +class GeomAPI_Ax2; +class GeomAPI_Pnt; /// \class GeomAlgoAPI_Symmetry /// \ingroup DataAlgo /// \brief Creates a copy of the object by performing a symmetry operation by a point, /// by an axis or by a plane. -class GeomAlgoAPI_Symmetry : public GeomAlgoAPI_MakeShape +class GeomAlgoAPI_Symmetry : public GeomAlgoAPI_Transform { public: - /// Type of symmetry operation - enum MethodType { - BY_POINT, ///< Symmetry by point. - BY_AXIS, ///< Symmetry by axis. - BY_PLANE ///< Symmetry by plane. - }; - /// \brief Creates an object which is obtained from current object by performing /// a symmetry operation by a point. /// \param[in] theSourceShape the shape to be moved. @@ -61,19 +54,6 @@ public: /// \param[in] thePlane the symmetry plane. GEOMALGOAPI_EXPORT GeomAlgoAPI_Symmetry(std::shared_ptr theSourceShape, std::shared_ptr thePlane); - - /// Checks if data for the symmetry execution is OK. - GEOMALGOAPI_EXPORT bool check(); - - /// Execute the symmetry. - GEOMALGOAPI_EXPORT void build(); - -private: - MethodType myMethodType; /// Type of method used. - std::shared_ptr mySourceShape; /// Shape to be moved. - std::shared_ptr myPoint; /// Reflection point. - std::shared_ptr myAxis; /// Reflection axis. - std::shared_ptr myPlane; /// Reflection plane. }; #endif // GEOMALGOAPI_SYMMETRY_H_ diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Transform.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Transform.cpp index 8ef306ef6..389f87e05 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Transform.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Transform.cpp @@ -29,7 +29,6 @@ //================================================================================================= GeomAlgoAPI_Transform::GeomAlgoAPI_Transform(std::shared_ptr theSourceShape, std::shared_ptr theTrsf) -: myTrsf(theTrsf) { build(theSourceShape, theTrsf); } @@ -38,37 +37,33 @@ GeomAlgoAPI_Transform::GeomAlgoAPI_Transform(std::shared_ptr theS void GeomAlgoAPI_Transform::build(std::shared_ptr theSourceShape, std::shared_ptr theTrsf) { - if(!theSourceShape || !theTrsf) { + if (!theSourceShape || !theTrsf) { + myError = "Transformation :: incorrect input data"; return; } const TopoDS_Shape& aSourceShape = theSourceShape->impl(); const gp_Trsf& aTrsf = theTrsf->impl(); - if(aSourceShape.IsNull()) { + if (aSourceShape.IsNull()) { + myError = "Transformation :: source shape does not contain any actual shape."; return; } BRepBuilderAPI_Transform* aBuilder = new BRepBuilderAPI_Transform(aSourceShape, aTrsf, true); - if(!aBuilder) { + if (!aBuilder) return; - } - this->setImpl(aBuilder); - this->setBuilderType(OCCT_BRepBuilderAPI_MakeShape); - if(aBuilder->IsDone() != Standard_True) { + setImpl(aBuilder); + setBuilderType(OCCT_BRepBuilderAPI_MakeShape); + + if (aBuilder->IsDone() != Standard_True) return; - } + TopoDS_Shape aResult = aBuilder->Shape(); std::shared_ptr aShape(new GeomAPI_Shape()); aShape->setImpl(new TopoDS_Shape(aResult)); - this->setShape(aShape); - this->setDone(true); -} - -//================================================================================================= -std::shared_ptr GeomAlgoAPI_Transform::transformation() const -{ - return myTrsf; + setShape(aShape); + setDone(true); } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Transform.h b/src/GeomAlgoAPI/GeomAlgoAPI_Transform.h index cb5382d48..bb7983b2b 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Transform.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Transform.h @@ -38,16 +38,13 @@ public: GEOMALGOAPI_EXPORT GeomAlgoAPI_Transform(std::shared_ptr theSourceShape, std::shared_ptr theTrsf); - /// \return the transformation. - GEOMALGOAPI_EXPORT std::shared_ptr transformation() const; +protected: + /// \brief Default constructor (to be used in the derived classes) + GeomAlgoAPI_Transform() {} -private: /// Builds resulting shape. void build(std::shared_ptr theSourceShape, std::shared_ptr theTrsf); - -private: - std::shared_ptr myTrsf; }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Translation.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Translation.cpp index b73713a8b..591c191f4 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Translation.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Translation.cpp @@ -17,21 +17,27 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include "GeomAlgoAPI_Translation.h" +#include + +#include +#include -#include #include -#include //================================================================================================= GeomAlgoAPI_Translation::GeomAlgoAPI_Translation(std::shared_ptr theSourceShape, std::shared_ptr theAxis, double theDistance) { - myMethodType = BY_DISTANCE; - mySourceShape = theSourceShape; - myAxis = theAxis; - myDistance = theDistance; + if (!theAxis) { + myError = "Translation builder :: axis is not valid."; + return; + } + + GeomTrsfPtr aTrsf(new GeomAPI_Trsf); + aTrsf->setTranslation(theAxis, theDistance); + + build(theSourceShape, aTrsf); } //================================================================================================= @@ -40,11 +46,10 @@ GeomAlgoAPI_Translation::GeomAlgoAPI_Translation(std::shared_ptr double theDy, double theDz) { - myMethodType = BY_DIM; - mySourceShape = theSourceShape; - myDx = theDx; - myDy = theDy; - myDz = theDz; + GeomTrsfPtr aTrsf(new GeomAPI_Trsf); + aTrsf->setTranslation(theDx, theDy, theDz); + + build(theSourceShape, aTrsf); } //================================================================================================= @@ -52,113 +57,21 @@ GeomAlgoAPI_Translation::GeomAlgoAPI_Translation(std::shared_ptr std::shared_ptr theStartPoint, std::shared_ptr theEndPoint) { - myMethodType = BY_POINTS; - mySourceShape = theSourceShape; - myStartPoint = theStartPoint; - myEndPoint = theEndPoint; -} - -//================================================================================================= -bool GeomAlgoAPI_Translation::check() -{ - switch (myMethodType) { - case BY_DISTANCE: { - if (!myAxis) { - myError = "Translation builder :: axis is not valid."; - return false; - } - if (!mySourceShape) { - myError = "Translation builder :: source shape is not valid."; - return false; - } - return true; - } - case BY_DIM: { - if (!mySourceShape) { - myError = "Translation builder :: source shape is not valid."; - return false; - } - return true; - } - case BY_POINTS: { - if (!myStartPoint) { - myError = "Translation builder :: start point is not valid."; - return false; - } - if (!myEndPoint) { - myError = "Translation builder :: end point is not valid."; - return false; - } - if (!mySourceShape) { - myError = "Translation builder :: source shape is invalid."; - return false; - } - if(myStartPoint->distance(myEndPoint) < Precision::Confusion()) { - myError = "Translation builder :: start point and end point coincide."; - return false; - } - return true; - } - default: { - myError = "Translation builder :: method not implemented."; - return false; - } - } -} - -//================================================================================================= -void GeomAlgoAPI_Translation::build() -{ - gp_Trsf* aTrsf = new gp_Trsf(); - - switch (myMethodType) { - case BY_DISTANCE: { - const gp_Ax1& anAxis = myAxis->impl(); - aTrsf->SetTranslation(gp_Vec(anAxis.Direction()) * myDistance); - break; - } - case BY_DIM: { - aTrsf->SetTranslation(gp_Vec(myDx, myDy, myDz)); - break; - } - case BY_POINTS: { - const gp_Pnt& aStartPoint = myStartPoint->impl(); - const gp_Pnt& aEndPoint = myEndPoint->impl(); - aTrsf->SetTranslation(aStartPoint, aEndPoint); - break; - } - default: { - myError = "Translation builder :: method not supported"; - return; - } - } - - const TopoDS_Shape& aSourceShape = mySourceShape->impl(); - - if(aSourceShape.IsNull()) { - myError = "Translation builder :: source shape does not contain any actual shape."; + if (!theStartPoint) { + myError = "Translation builder :: start point is not valid."; return; } - - // Transform the shape while copying it. - BRepBuilderAPI_Transform* aBuilder = new BRepBuilderAPI_Transform(aSourceShape, *aTrsf, true); - if(!aBuilder) { - myError = "Translation builder :: transform initialization failed."; + if (!theEndPoint) { + myError = "Translation builder :: end point is not valid."; return; } - - setImpl(aBuilder); - setBuilderType(OCCT_BRepBuilderAPI_MakeShape); - - if(!aBuilder->IsDone()) { - myError = "Translation builder :: algorithm failed."; + if (theStartPoint->distance(theEndPoint) < Precision::Confusion()) { + myError = "Translation builder :: start point and end point coincide."; return; } - TopoDS_Shape aResult = aBuilder->Shape(); + GeomTrsfPtr aTrsf(new GeomAPI_Trsf); + aTrsf->setTranslation(theStartPoint, theEndPoint); - std::shared_ptr aShape(new GeomAPI_Shape()); - aShape->setImpl(new TopoDS_Shape(aResult)); - setShape(aShape); - setDone(true); + build(theSourceShape, aTrsf); } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Translation.h b/src/GeomAlgoAPI/GeomAlgoAPI_Translation.h index f7b3be95e..7f9ea21dd 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Translation.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Translation.h @@ -21,24 +21,17 @@ #define GeomAlgoAPI_Translation_H_ #include -#include +#include -#include -#include +class GeomAPI_Ax1; +class GeomAPI_Pnt; /// \class GeomAlgoAPI_Translation /// \ingroup DataAlgo /// \brief Creates a copy of the object by moving it along the axis. -class GeomAlgoAPI_Translation : public GeomAlgoAPI_MakeShape +class GeomAlgoAPI_Translation : public GeomAlgoAPI_Transform { public: - /// Type of translation operation - enum MethodType { - BY_DISTANCE, ///< Translation by axis and distance - BY_DIM, ///< Translation by dimensions in X, Y and Z - BY_POINTS ///< Translation by two points - }; - /// \brief Creates an object which is obtained from current object by moving it along the axis. /// \param[in] theSourceShape a shape to be moved. /// \param[in] theAxis movement axis. @@ -66,23 +59,6 @@ public: GEOMALGOAPI_EXPORT GeomAlgoAPI_Translation(std::shared_ptr theSourceShape, std::shared_ptr theStartPoint, std::shared_ptr theEndPoint); - - /// Checks if data for the translation execution is OK. - GEOMALGOAPI_EXPORT bool check(); - - /// Execute the translation. - GEOMALGOAPI_EXPORT void build(); - -private: - MethodType myMethodType; /// Type of method used. - std::shared_ptr mySourceShape; /// Shape to be moved. - std::shared_ptr myAxis; /// Movement axis. - double myDistance; /// Movement distance. - double myDx; /// Movement dimension on X. - double myDy; /// Movement dimension on Y. - double myDz; /// Movement dimension on Z. - std::shared_ptr myStartPoint; /// Movement start point. - std::shared_ptr myEndPoint; /// Movement end point. }; #endif -- 2.39.2