From 722ce316c19110c99bebb0863650cbb42fc00ada Mon Sep 17 00:00:00 2001 From: Clarisse Genrault Date: Mon, 3 Apr 2017 16:26:45 +0200 Subject: [PATCH] Added multirotation feature. --- .../FeaturesPlugin_MultiRotation.cpp | 480 ++++++++++++++++++ .../FeaturesPlugin_MultiRotation.h | 124 +++++ src/FeaturesPlugin/multirotation_widget.xml | 53 ++ src/GeomAlgoAPI/GeomAlgoAPI_MultiRotation.cpp | 26 + src/GeomAlgoAPI/GeomAlgoAPI_MultiRotation.h | 47 ++ 5 files changed, 730 insertions(+) create mode 100644 src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp create mode 100644 src/FeaturesPlugin/FeaturesPlugin_MultiRotation.h create mode 100644 src/FeaturesPlugin/multirotation_widget.xml create mode 100644 src/GeomAlgoAPI/GeomAlgoAPI_MultiRotation.cpp create mode 100644 src/GeomAlgoAPI/GeomAlgoAPI_MultiRotation.h diff --git a/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp b/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp new file mode 100644 index 000000000..4c1d8470e --- /dev/null +++ b/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp @@ -0,0 +1,480 @@ +// Copyright (C) 2014-201x CEA/DEN, EDF R&D + +// File: FeaturesPlugin_MultiRotation.cpp +// Created: 30 Jan 2017 +// Author: Clarisse Genrault (CEA) + +#include + +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +//================================================================================================= +FeaturesPlugin_MultiRotation::FeaturesPlugin_MultiRotation() +{ +} + +//================================================================================================= +void FeaturesPlugin_MultiRotation::initAttributes() +{ + AttributeSelectionListPtr aSelection = + std::dynamic_pointer_cast(data()->addAttribute( + FeaturesPlugin_MultiRotation::OBJECTS_LIST_ID(), + ModelAPI_AttributeSelectionList::typeId())); + + data()->addAttribute(FeaturesPlugin_MultiRotation::AXIS_ANGULAR_ID(), + ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(FeaturesPlugin_MultiRotation::USE_ANGULAR_STEP_ID(), + ModelAPI_AttributeString::typeId()); + data()->addAttribute(FeaturesPlugin_MultiRotation::STEP_ANGULAR_ID(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(FeaturesPlugin_MultiRotation::NB_COPIES_ANGULAR_ID(), + ModelAPI_AttributeInteger::typeId()); + + /*data()->addAttribute(FeaturesPlugin_MultiRotation::USE_RADIAL_DIR_ID(), + ModelAPI_AttributeString::typeId()); + data()->addAttribute(FeaturesPlugin_MultiRotation::STEP_RADIAL_ID(), + ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(FeaturesPlugin_MultiRotation::NB_COPIES_RADIAL_ID(), + ModelAPI_AttributeInteger::typeId());*/ +} + +//================================================================================================= +void FeaturesPlugin_MultiRotation::execute() +{ + /*std::string useRadialDir = string(FeaturesPlugin_MultiRotation::USE_RADIAL_DIR_ID())->value(); + if (useRadialDir.empty()) { + performRotation1D(); + } else { + performRotation2D(); + }*/ + performRotation1D(); +} + +//================================================================================================= +void FeaturesPlugin_MultiRotation::performRotation1D() +{ + // Getting objects. + ListOfShape anObjects; + std::list aContextes; + AttributeSelectionListPtr anObjectsSelList = + selectionList(FeaturesPlugin_MultiRotation::OBJECTS_LIST_ID()); + if (anObjectsSelList->size() == 0) { + return; + } + for(int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) { + std::shared_ptr anObjectAttr = + anObjectsSelList->value(anObjectsIndex); + std::shared_ptr anObject = anObjectAttr->value(); + if(!anObject.get()) { // may be for not-activated parts + eraseResults(); + return; + } + anObjects.push_back(anObject); + aContextes.push_back(anObjectAttr->context()); + } + + //Getting axis. + std::shared_ptr anAxis; + std::shared_ptr anEdge; + std::shared_ptr anObjRef = + selection(FeaturesPlugin_MultiRotation::AXIS_ANGULAR_ID()); + if(anObjRef && anObjRef->value() && anObjRef->value()->isEdge()) { + anEdge = std::shared_ptr(new GeomAPI_Edge(anObjRef->value())); + } else if (anObjRef && !anObjRef->value() && anObjRef->context() && + anObjRef->context()->shape() && anObjRef->context()->shape()->isEdge()) { + anEdge = std::shared_ptr(new GeomAPI_Edge(anObjRef->context()->shape())); + } + if(anEdge) { + anAxis = std::shared_ptr(new GeomAPI_Ax1(anEdge->line()->location(), + anEdge->line()->direction())); + } + + // Getting number of copies. + int nbCopies = + integer(FeaturesPlugin_MultiRotation::NB_COPIES_ANGULAR_ID())->value(); + + if (nbCopies <=0) { + std::string aFeatureError = "Multirotation builder "; + aFeatureError+=":: the number of copies for the angular direction is null or negative."; + setError(aFeatureError); + return; + } + + // Getting angle + double anAngle; + std::string useAngularStep = + string(FeaturesPlugin_MultiRotation::USE_ANGULAR_STEP_ID())->value(); + if (!useAngularStep.empty()) { + anAngle = real(FeaturesPlugin_MultiRotation::STEP_ANGULAR_ID())->value(); + } else { + anAngle = 360./nbCopies; + } + + // Moving each object. + int aResultIndex = 0; + std::list::iterator aContext = aContextes.begin(); + for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end(); + anObjectsIt++, aContext++) { + std::shared_ptr aBaseShape = *anObjectsIt; + bool isPart = (*aContext)->groupName() == ModelAPI_ResultPart::group(); + + // Setting result. + if (isPart) { + ResultPartPtr anOrigin = std::dynamic_pointer_cast(*aContext); + std::shared_ptr aTrsf(new GeomAPI_Trsf()); + for (int i=0; isetRotation(anAxis, i*anAngle); + ResultPartPtr aResultPart = document()->copyPart(anOrigin, data(), aResultIndex); + aResultPart->setTrsf(*aContext, aTrsf); + setResult(aResultPart, aResultIndex); + aResultIndex++; + } + } else { + ListOfShape aListOfShape; + std::list > aListOfRotationAlgo; + + for (int i=0; i aRotationnAlgo( + new GeomAlgoAPI_Rotation(aBaseShape, anAxis, i*anAngle)); + + if (!aRotationnAlgo->check()) { + setError(aRotationnAlgo->getError()); + break; + } + + aRotationnAlgo->build(); + + // Checking that the algorithm worked properly. + if (!aRotationnAlgo->isDone()) { + static const std::string aFeatureError = "Error : Multitranslation algorithm failed."; + setError(aFeatureError); + break; + } + if (aRotationnAlgo->shape()->isNull()) { + static const std::string aShapeError = "Error : Resulting shape is null."; + setError(aShapeError); + break; + } + if (!aRotationnAlgo->isValid()) { + static const std::string aFeatureError = "Error : Resulting shape in not valid."; + setError(aFeatureError); + break; + } + aListOfShape.push_back(aRotationnAlgo->shape()); + aListOfRotationAlgo.push_back(aRotationnAlgo); + } + std::shared_ptr aCompound = + GeomAlgoAPI_CompoundBuilder::compound(aListOfShape); + ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex); + aResultBody->storeModified(aBaseShape, aCompound); + loadNamingDS(aListOfRotationAlgo, aResultBody, aBaseShape); + + setResult(aResultBody, aResultIndex); + } + aResultIndex++; + } + + // Remove the rest results if there were produced in the previous pass. + removeResults(aResultIndex); +} + +//================================================================================================= +void FeaturesPlugin_MultiRotation::performRotation2D() +{ + // Getting objects. + ListOfShape anObjects; + std::list aContextes; + AttributeSelectionListPtr anObjectsSelList = + selectionList(FeaturesPlugin_MultiRotation::OBJECTS_LIST_ID()); + if (anObjectsSelList->size() == 0) { + return; + } + for(int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) { + std::shared_ptr anObjectAttr = + anObjectsSelList->value(anObjectsIndex); + std::shared_ptr anObject = anObjectAttr->value(); + if(!anObject.get()) { // may be for not-activated parts + eraseResults(); + return; + } + anObjects.push_back(anObject); + aContextes.push_back(anObjectAttr->context()); + } + + //Getting axis. + std::shared_ptr anAxis; + std::shared_ptr anEdge; + std::shared_ptr anObjRef = + selection(FeaturesPlugin_MultiRotation::AXIS_ANGULAR_ID()); + if(anObjRef && anObjRef->value() && anObjRef->value()->isEdge()) { + anEdge = std::shared_ptr(new GeomAPI_Edge(anObjRef->value())); + } else if (anObjRef && !anObjRef->value() && anObjRef->context() && + anObjRef->context()->shape() && anObjRef->context()->shape()->isEdge()) { + anEdge = std::shared_ptr(new GeomAPI_Edge(anObjRef->context()->shape())); + } + if(anEdge) { + anAxis = std::shared_ptr(new GeomAPI_Ax1(anEdge->line()->location(), + anEdge->line()->direction())); + } + + // Getting number of copies int he angular direction. + int nbAngular = + integer(FeaturesPlugin_MultiRotation::NB_COPIES_ANGULAR_ID())->value(); + + if (nbAngular <=0) { + std::string aFeatureError = "Multirotation builder "; + aFeatureError+=":: the number of copies for the angular direction is null or negative."; + setError(aFeatureError); + return; + } + + // Getting number of copies int he radial direction. + int nbRadial = + integer(FeaturesPlugin_MultiRotation::NB_COPIES_RADIAL_ID())->value(); + + if (nbRadial <=0) { + std::string aFeatureError = "Multirotation builder "; + aFeatureError+=":: the number of copies for the radial direction is null or negative."; + setError(aFeatureError); + return; + } + + // Getting angle + double anAngle; + std::string useAngularStep = + string(FeaturesPlugin_MultiRotation::USE_ANGULAR_STEP_ID())->value(); + if (!useAngularStep.empty()) { + anAngle = real(FeaturesPlugin_MultiRotation::STEP_ANGULAR_ID())->value(); + } else { + anAngle = 360./nbAngular; + } + + // + double aStep = real(FeaturesPlugin_MultiRotation::STEP_RADIAL_ID())->value(); + + // Moving each object. + int aResultIndex = 0; + std::list::iterator aContext = aContextes.begin(); + for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end(); + anObjectsIt++, aContext++) { + std::shared_ptr aBaseShape = *anObjectsIt; + bool isPart = (*aContext)->groupName() == ModelAPI_ResultPart::group(); + + std::shared_ptr aDir = GeomAlgoAPI_ShapeTools::makeToto(aBaseShape, anAxis); + double x = aDir->x(); + double y = aDir->y(); + double z = aDir->z(); + double norm = sqrt(x*x+y*y+z*z); + + // Setting result. + if (isPart) { + /*ResultPartPtr anOrigin = std::dynamic_pointer_cast(*aContext); + std::shared_ptr aTrsf(new GeomAPI_Trsf()); + for (int j=0; jsetTranslation(dx, dy, dz); + ResultPartPtr aResultPart = document()->copyPart(anOrigin, data(), aResultIndex); + aResultPart->setTrsf(*aContext, aTrsf); + setResult(aResultPart, aResultIndex); + aResultIndex++; + } + }*/ + } else { + ListOfShape aListOfShape; + std::list > aListOfTranslationAlgo; + std::list > aListOfRotationAlgo; + for (int j=0; j aTranslationAlgo( + new GeomAlgoAPI_Translation(aBaseShape, dx, dy, dz)); + + if (!aTranslationAlgo->check()) { + setError(aTranslationAlgo->getError()); + break; + } + + aTranslationAlgo->build(); + + // Checking that the algorithm worked properly. + if (!aTranslationAlgo->isDone()) { + static const std::string aFeatureError = "Error : Multirotation algorithm failed."; + setError(aFeatureError); + break; + } + if (aTranslationAlgo->shape()->isNull()) { + static const std::string aShapeError = "Error : Resulting shape is null."; + setError(aShapeError); + break; + } + if (!aTranslationAlgo->isValid()) { + static const std::string aFeatureError = "Error : Resulting shape in not valid."; + setError(aFeatureError); + break; + } + aListOfShape.push_back(aTranslationAlgo->shape()); + aListOfTranslationAlgo.push_back(aTranslationAlgo); + for (int i=1; i aRotationnAlgo( + new GeomAlgoAPI_Rotation(aTranslationAlgo->shape(), anAxis, i*anAngle)); + if (!aRotationnAlgo->check()) { + setError(aTranslationAlgo->getError()); + break; + } + aRotationnAlgo->build();// Checking that the algorithm worked properly. + if (!aRotationnAlgo->isDone()) { + static const std::string aFeatureError = "Error : Multirotation algorithm failed."; + setError(aFeatureError); + break; + } + if (aRotationnAlgo->shape()->isNull()) { + static const std::string aShapeError = "Error : Resulting shape is null."; + setError(aShapeError); + break; + } + if (!aRotationnAlgo->isValid()) { + static const std::string aFeatureError = "Error : Resulting shape in not valid."; + setError(aFeatureError); + break; + } + aListOfShape.push_back(aRotationnAlgo->shape()); + aListOfRotationAlgo.push_back(aRotationnAlgo); + } + } + std::shared_ptr aCompound = + GeomAlgoAPI_CompoundBuilder::compound(aListOfShape); + ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex); + aResultBody->storeModified(aBaseShape, aCompound); + + loadNamingDS2(aListOfTranslationAlgo, aResultBody, aBaseShape); + loadNamingDS3(aListOfRotationAlgo, aResultBody, aBaseShape, nbRadial); + setResult(aResultBody, aResultIndex); + } + aResultIndex++; + } + + // Remove the rest results if there were produced in the previous pass. + removeResults(aResultIndex); +} + +//================================================================================================= +void FeaturesPlugin_MultiRotation::loadNamingDS2( + std::list > theListOfTranslationAlgo, + std::shared_ptr theResultBody, + std::shared_ptr theBaseShape) +{ + int aTag = 1; + int anIndex = 1; + std::string aRotatedName; + + for (std::list >::const_iterator anIt = + theListOfTranslationAlgo.begin(); anIt != theListOfTranslationAlgo.cend(); ++anIt) { + std::cout << "LOAD" << std::endl; + std::shared_ptr aSubShapes = (*anIt)->mapOfSubShapes(); + + // naming of faces + aRotatedName = "Rotated_Face_" + std::to_string((long long) anIndex); + theResultBody->loadAndOrientModifiedShapes((*anIt).get(), theBaseShape, GeomAPI_Shape::FACE, + aTag++, aRotatedName, *aSubShapes.get(), + false, true); + + // naming of edges + aRotatedName = "Rotated_Edge_" + std::to_string((long long) anIndex); + theResultBody->loadAndOrientModifiedShapes((*anIt).get(), theBaseShape, GeomAPI_Shape::EDGE, + aTag++, aRotatedName, *aSubShapes.get(), + false, true); + + // naming of vertex + aRotatedName = "Rotated_Vertex_" + std::to_string((long long) anIndex); + theResultBody->loadAndOrientModifiedShapes((*anIt).get(), theBaseShape, GeomAPI_Shape::VERTEX, + aTag++, aRotatedName, *aSubShapes.get(), + false, true); + + ++anIndex; + } +} + +//================================================================================================= +void FeaturesPlugin_MultiRotation::loadNamingDS3( + std::list > theListOfRotationAlgo, + std::shared_ptr theResultBody, + std::shared_ptr theBaseShape, int nb) +{ + int aTag = 6*nb+1; + int anIndex = nb+1; + std::string aRotatedName; + + for (std::list >::const_iterator anIt = + theListOfRotationAlgo.begin(); anIt != theListOfRotationAlgo.cend(); ++anIt) { + + // naming of faces + int numFace = 1; + GeomAPI_ShapeExplorer anExp((*anIt)->shape(), GeomAPI_Shape::FACE); + for(; anExp.more(); anExp.next()) { + aRotatedName = "Rotated_Face_" + std::to_string((long long) anIndex); + aRotatedName = aRotatedName + "_" + std::to_string((long long) numFace); + theResultBody->generated(anExp.current(), aRotatedName, aTag++); + ++numFace; + } + ++anIndex; + } +} + +//================================================================================================= +void FeaturesPlugin_MultiRotation::loadNamingDS( + std::list > theListOfRotationAlgo, + std::shared_ptr theResultBody, + std::shared_ptr theBaseShape) +{ + int aTag = 1; + int anIndex = 1; + std::string aRotatedName; + + for (std::list >::const_iterator anIt = + theListOfRotationAlgo.begin(); anIt != theListOfRotationAlgo.cend(); ++anIt) { + std::shared_ptr aSubShapes = (*anIt)->mapOfSubShapes(); + + // naming of faces + aRotatedName = "Rotated_Face_" + std::to_string((long long) anIndex); + theResultBody->loadAndOrientModifiedShapes((*anIt).get(), theBaseShape, GeomAPI_Shape::FACE, + aTag++, aRotatedName, *aSubShapes.get(), + false, true); + + // naming of edges + aRotatedName = "Rotated_Edge_" + std::to_string((long long) anIndex); + theResultBody->loadAndOrientModifiedShapes((*anIt).get(), theBaseShape, GeomAPI_Shape::EDGE, + aTag++, aRotatedName, *aSubShapes.get(), + false, true); + + // naming of vertex + aRotatedName = "Rotated_Vertex_" + std::to_string((long long) anIndex); + theResultBody->loadAndOrientModifiedShapes((*anIt).get(), theBaseShape, GeomAPI_Shape::VERTEX, + aTag++, aRotatedName, *aSubShapes.get(), + false, true); + ++anIndex; + } +} diff --git a/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.h b/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.h new file mode 100644 index 000000000..b39d4b441 --- /dev/null +++ b/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.h @@ -0,0 +1,124 @@ +// Copyright (C) 2014-201x CEA/DEN, EDF R&D + +// File: FeaturesPlugin_MultiRotation.h +// Created: 30 Jan 2017 +// Author: Clarisse Genrault (CEA) + +#ifndef FEATURESPLUGIN_MULTIROTATION_H_ +#define FEATURESPLUGIN_MULTIROTATION_H_ + +#include + +#include +#include + +#include + +/** \class FeaturesPlugin_MultiRotation + * \ingroup Plugins + * \brief Feature for movement objects along one or two axes an arbitary number of times, + * making a copy every time. + */ +class FeaturesPlugin_MultiRotation : public ModelAPI_Feature +{ + public: + /// Multi-rotation kind. + inline static const std::string& ID() + { + static const std::string MY_MULTIROTATION_ID("MultiRotation"); + return MY_MULTIROTATION_ID; + } + + /// Attribute name of referenced objects. + inline static const std::string& OBJECTS_LIST_ID() + { + static const std::string MY_OBJECTS_LIST_ID("main_objects"); + return MY_OBJECTS_LIST_ID; + } + + /// Attribute name of the angular direction. + inline static const std::string& AXIS_ANGULAR_ID() + { + static const std::string MY_AXIS_ANGULAR_ID("axis_angular"); + return MY_AXIS_ANGULAR_ID; + } + + /// Attribute name for use angular step. + inline static const std::string& USE_ANGULAR_STEP_ID() + { + static const std::string MY_USE_ANGULAR_STEP_ID("use_step_angular"); + return MY_USE_ANGULAR_STEP_ID; + } + + /// Attribute name of step for the first direction. + inline static const std::string& STEP_ANGULAR_ID() + { + static const std::string MY_STEP_ANGULAR_ID("step_angular"); + return MY_STEP_ANGULAR_ID; + } + + /// Attribute name of number of copies for the first direction. + inline static const std::string& NB_COPIES_ANGULAR_ID() + { + static const std::string MY_NB_COPIES_ANGULAR_ID("nb_angular"); + return MY_NB_COPIES_ANGULAR_ID; + } + + /// Attribute name for use second dir. + inline static const std::string& USE_RADIAL_DIR_ID() + { + static const std::string MY_USE_RADIAL_DIR_ID("use_radial_dir"); + return MY_USE_RADIAL_DIR_ID; + } + + /// Attribute name of step for the second direction. + inline static const std::string& STEP_RADIAL_ID() + { + static const std::string MY_STEP_RADIAL_ID("step_radial"); + return MY_STEP_RADIAL_ID; + } + + /// Attribute name of number of copies for the second direction. + inline static const std::string& NB_COPIES_RADIAL_ID() + { + static const std::string MY_NB_COPIES_RADIAL_ID("nb_radial"); + return MY_NB_COPIES_RADIAL_ID; + } + + /// \return the kind of a feature. + FEATURESPLUGIN_EXPORT virtual const std::string& getKind() + { + static std::string MY_KIND = FeaturesPlugin_MultiRotation::ID(); + return MY_KIND; + } + + /// Creates a new part document if needed. + FEATURESPLUGIN_EXPORT virtual void execute(); + + /// Request for initialization of data model of the feature: adding all attributes. + FEATURESPLUGIN_EXPORT virtual void initAttributes(); + + /// Use plugin manager for features creation. + FeaturesPlugin_MultiRotation(); + +private: + /// Perform the multi translation in one direction. + void performRotation1D(); + + /// Perform the multi translation in two directions. + void performRotation2D(); + + void loadNamingDS2(std::list > theListOfTranslationAlgo, + std::shared_ptr theResultBody, + std::shared_ptr theBaseShape); + + void loadNamingDS3(std::list > theListOfRotationAlgo, + std::shared_ptr theResultBody, + std::shared_ptr theBaseShape, int nb); + + void loadNamingDS(std::list > theListOfRotationAlgo, + std::shared_ptr theResultBody, + std::shared_ptr theBaseShape); +}; + +#endif // FEATURESPLUGIN_MULTIROTATION_H_ \ No newline at end of file diff --git a/src/FeaturesPlugin/multirotation_widget.xml b/src/FeaturesPlugin/multirotation_widget.xml new file mode 100644 index 000000000..8396f4869 --- /dev/null +++ b/src/FeaturesPlugin/multirotation_widget.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MultiRotation.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_MultiRotation.cpp new file mode 100644 index 000000000..0c706d358 --- /dev/null +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MultiRotation.cpp @@ -0,0 +1,26 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + +// File: GeomAlgoAPI_MultiRotation.cpp +// Created: 30 Mar 2017 +// Author: Clarisse Genrault (CEA) + +#include "GeomAlgoAPI_MultiRotation.h" + +//================================================================================================= +GeomAlgoAPI_MultiRotation::GeomAlgoAPI_MultiRotation(std::shared_ptr theSourceShape, + std::shared_ptr theAxis, + double theAngle) +{ +} + +//================================================================================================= +bool GeomAlgoAPI_MultiRotation::check() +{ + return true; +} + +//================================================================================================= +void GeomAlgoAPI_MultiRotation::build() +{ + setDone(true); +} diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MultiRotation.h b/src/GeomAlgoAPI/GeomAlgoAPI_MultiRotation.h new file mode 100644 index 000000000..d687e4ae7 --- /dev/null +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MultiRotation.h @@ -0,0 +1,47 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + +// File: GeomAlgoAPI_MultiRotation.h +// Created: 30 Mar 2017 +// Author: Clarisse Genrault (CEA) + +#ifndef GEOMALGOAPI_MULTIROTATION_H_ +#define GEOMALGOAPI_MULTIROTATION_H_ + +#include +#include + +#include +#include + +/// \class GeomAlgoAPI_MultiRotation +/// \ingroup DataAlgo +/// \brief Creates a copy of the object by rotating it around the axis. +class GeomAlgoAPI_MultiRotation : public GeomAlgoAPI_MakeShape +{ +public: + + /// \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. + /// \param[in] theAxis rotation axis. + /// \param[in] theAngle rotation angle(in degree). + GEOMALGOAPI_EXPORT GeomAlgoAPI_MultiRotation(std::shared_ptr theSourceShape, + std::shared_ptr theAxis, + double theAngle); + + /// Checks if data for the translation execution is OK. + GEOMALGOAPI_EXPORT bool check(); + + /// Execute the translation. + GEOMALGOAPI_EXPORT void build(); + +private: + 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 // GEOMALGOAPI_MULTIROTATION_H_ -- 2.39.2