1 // Copyright (C) 2017-2022 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File: FeaturesPlugin_MultiRotation.h
21 // Created: 30 Jan 2017
22 // Author: Clarisse Genrault (CEA)
24 #ifndef FEATURESPLUGIN_MULTIROTATION_H_
25 #define FEATURESPLUGIN_MULTIROTATION_H_
27 #include <FeaturesPlugin.h>
29 #include <GeomAlgoAPI_Rotation.h>
30 #include <GeomAlgoAPI_Translation.h>
32 #include <ModelAPI_Feature.h>
34 /** \class FeaturesPlugin_MultiRotation
36 * \brief Feature that rotaes object around an axis an number of times.
37 * The 2D version also makes translated copies of the object and performs the rotation
40 class FeaturesPlugin_MultiRotation : public ModelAPI_Feature
43 /// Multi-rotation kind.
44 inline static const std::string& ID()
46 static const std::string MY_MULTIROTATION_ID("AngularCopy");
47 return MY_MULTIROTATION_ID;
50 /// Attribute name of referenced objects.
51 inline static const std::string& OBJECTS_LIST_ID()
53 static const std::string MY_OBJECTS_LIST_ID("main_objects");
54 return MY_OBJECTS_LIST_ID;
57 /// Attribute name of the angular direction.
58 inline static const std::string& AXIS_ANGULAR_ID()
60 static const std::string MY_AXIS_ANGULAR_ID("axis_angular");
61 return MY_AXIS_ANGULAR_ID;
64 /// Attribute name for use angular step.
65 inline static const std::string& USE_ANGULAR_STEP_ID()
67 static const std::string MY_USE_ANGULAR_STEP_ID("use_step_angular");
68 return MY_USE_ANGULAR_STEP_ID;
71 /// Attribute name of step for the angular.
72 inline static const std::string& STEP_ANGULAR_ID()
74 static const std::string MY_STEP_ANGULAR_ID("step_angular");
75 return MY_STEP_ANGULAR_ID;
78 /// Attribute name of number of copies for angular.
79 inline static const std::string& NB_COPIES_ANGULAR_ID()
81 static const std::string MY_NB_COPIES_ANGULAR_ID("nb_angular");
82 return MY_NB_COPIES_ANGULAR_ID;
85 /// Attribute name for use radial dir.
86 inline static const std::string& USE_RADIAL_DIR_ID()
88 static const std::string MY_USE_RADIAL_DIR_ID("use_radial_dir");
89 return MY_USE_RADIAL_DIR_ID;
92 /// Attribute name of radial step.
93 inline static const std::string& STEP_RADIAL_ID()
95 static const std::string MY_STEP_RADIAL_ID("step_radial");
96 return MY_STEP_RADIAL_ID;
99 /// Attribute name of number of copies for radial.
100 inline static const std::string& NB_COPIES_RADIAL_ID()
102 static const std::string MY_NB_COPIES_RADIAL_ID("nb_radial");
103 return MY_NB_COPIES_RADIAL_ID;
106 /// \return the kind of a feature.
107 FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
109 static std::string MY_KIND = FeaturesPlugin_MultiRotation::ID();
113 /// Performs the algorithm and stores results it in the data structure.
114 FEATURESPLUGIN_EXPORT virtual void execute();
116 /// Request for initialization of data model of the feature: adding all attributes.
117 FEATURESPLUGIN_EXPORT virtual void initAttributes();
119 /// Use plugin manager for features creation.
120 FeaturesPlugin_MultiRotation();
123 /// Fill axis, number of copies and angle of the rotation.
124 /// \returns \c false in case of errors.
125 bool paramsOfRotation(std::shared_ptr<GeomAPI_Ax1>& theAxis, double& theAngle, int& theQuantity);
127 /// Perform the multi rotation in one direction.
128 void performRotation1D();
130 #ifdef FEATURE_MULTIROTATION_TWO_DIRECTIONS
131 /// Perform the multi rotation in two directions.
132 void performRotation2D();
134 void loadNamingDS2(std::list<std::shared_ptr<GeomAlgoAPI_Translation> > theListOfTranslationAlgo,
135 std::shared_ptr<ModelAPI_ResultBody> theResultBody,
136 std::shared_ptr<GeomAPI_Shape> theBaseShape);
138 void loadNamingDS3(std::list<std::shared_ptr<GeomAlgoAPI_Rotation> > theListOfRotationAlgo,
139 std::shared_ptr<ModelAPI_ResultBody> theResultBody,
140 std::shared_ptr<GeomAPI_Shape> theBaseShape, int nb);
144 #endif // FEATURESPLUGIN_MULTIROTATION_H_