Salome HOME
Update copyrights
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_MultiRotation.h
1 // Copyright (C) 2017-2019  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // File:        FeaturesPlugin_MultiRotation.h
21 // Created:     30 Jan 2017
22 // Author:      Clarisse Genrault (CEA)
23
24 #ifndef FEATURESPLUGIN_MULTIROTATION_H_
25 #define FEATURESPLUGIN_MULTIROTATION_H_
26
27 #include <FeaturesPlugin.h>
28
29 #include <GeomAlgoAPI_Rotation.h>
30 #include <GeomAlgoAPI_Translation.h>
31
32 #include <ModelAPI_Feature.h>
33
34 /** \class FeaturesPlugin_MultiRotation
35  *  \ingroup Plugins
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
38  *         on these as well.
39  */
40 class FeaturesPlugin_MultiRotation : public ModelAPI_Feature
41 {
42   public:
43   /// Multi-rotation kind.
44   inline static const std::string& ID()
45   {
46     static const std::string MY_MULTIROTATION_ID("AngularCopy");
47     return MY_MULTIROTATION_ID;
48   }
49
50   /// Attribute name of referenced objects.
51   inline static const std::string& OBJECTS_LIST_ID()
52   {
53     static const std::string MY_OBJECTS_LIST_ID("main_objects");
54     return MY_OBJECTS_LIST_ID;
55   }
56
57   /// Attribute name of the angular direction.
58   inline static const std::string& AXIS_ANGULAR_ID()
59   {
60     static const std::string MY_AXIS_ANGULAR_ID("axis_angular");
61     return MY_AXIS_ANGULAR_ID;
62   }
63
64   /// Attribute name for use angular step.
65   inline static const std::string& USE_ANGULAR_STEP_ID()
66   {
67     static const std::string MY_USE_ANGULAR_STEP_ID("use_step_angular");
68     return MY_USE_ANGULAR_STEP_ID;
69   }
70
71   /// Attribute name of step for the angular.
72   inline static const std::string& STEP_ANGULAR_ID()
73   {
74     static const std::string MY_STEP_ANGULAR_ID("step_angular");
75     return MY_STEP_ANGULAR_ID;
76   }
77
78   /// Attribute name of number of copies for angular.
79   inline static const std::string& NB_COPIES_ANGULAR_ID()
80   {
81     static const std::string MY_NB_COPIES_ANGULAR_ID("nb_angular");
82     return MY_NB_COPIES_ANGULAR_ID;
83   }
84
85   /// Attribute name for use radial dir.
86   inline static const std::string& USE_RADIAL_DIR_ID()
87   {
88     static const std::string MY_USE_RADIAL_DIR_ID("use_radial_dir");
89     return MY_USE_RADIAL_DIR_ID;
90   }
91
92   /// Attribute name of radial step.
93   inline static const std::string& STEP_RADIAL_ID()
94   {
95     static const std::string MY_STEP_RADIAL_ID("step_radial");
96     return MY_STEP_RADIAL_ID;
97   }
98
99   /// Attribute name of number of copies for radial.
100   inline static const std::string& NB_COPIES_RADIAL_ID()
101   {
102     static const std::string MY_NB_COPIES_RADIAL_ID("nb_radial");
103     return MY_NB_COPIES_RADIAL_ID;
104   }
105
106   /// \return the kind of a feature.
107   FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
108   {
109     static std::string MY_KIND = FeaturesPlugin_MultiRotation::ID();
110     return MY_KIND;
111   }
112
113   /// Creates a new part document if needed.
114   FEATURESPLUGIN_EXPORT virtual void execute();
115
116   /// Request for initialization of data model of the feature: adding all attributes.
117   FEATURESPLUGIN_EXPORT virtual void initAttributes();
118
119   /// Use plugin manager for features creation.
120   FeaturesPlugin_MultiRotation();
121
122 private:
123   /// Perform the multi rotation in one direction.
124   void performRotation1D();
125
126 #ifdef FEATURE_MULTIROTATION_TWO_DIRECTIONS
127   /// Perform the multi rotation in two directions.
128   void performRotation2D();
129
130   void loadNamingDS2(std::list<std::shared_ptr<GeomAlgoAPI_Translation> > theListOfTranslationAlgo,
131                     std::shared_ptr<ModelAPI_ResultBody> theResultBody,
132                     std::shared_ptr<GeomAPI_Shape> theBaseShape);
133
134   void loadNamingDS3(std::list<std::shared_ptr<GeomAlgoAPI_Rotation> > theListOfRotationAlgo,
135                     std::shared_ptr<ModelAPI_ResultBody> theResultBody,
136                     std::shared_ptr<GeomAPI_Shape> theBaseShape, int nb);
137 #endif
138
139   void loadNamingDS(std::list<std::shared_ptr<GeomAlgoAPI_Rotation> > theListOfRotationAlgo,
140                     std::shared_ptr<ModelAPI_ResultBody> theResultBody,
141                     std::shared_ptr<GeomAPI_Shape> theBaseShape);
142 };
143
144 #endif // FEATURESPLUGIN_MULTIROTATION_H_