Salome HOME
Merge remote-tracking branch 'origin/Toolbars_Management'
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_MultiRotation.h
1 // Copyright (C) 2014-201x CEA/DEN, EDF R&D
2
3 // File:        FeaturesPlugin_MultiRotation.h
4 // Created:     30 Jan 2017
5 // Author:      Clarisse Genrault (CEA)
6
7 #ifndef FEATURESPLUGIN_MULTIROTATION_H_
8 #define FEATURESPLUGIN_MULTIROTATION_H_
9
10 #include <FeaturesPlugin.h>
11
12 #include <GeomAlgoAPI_Rotation.h>
13 #include <GeomAlgoAPI_Translation.h>
14
15 #include <ModelAPI_Feature.h>
16
17 /** \class FeaturesPlugin_MultiRotation
18  *  \ingroup Plugins
19  *  \brief Feature that rotaes object around an axis an number of times.
20  *         The 2D version also makes translated copies of the object and performs the rotation
21  *         on these as well.
22  */
23 class FeaturesPlugin_MultiRotation : public ModelAPI_Feature
24 {
25   public:
26   /// Multi-rotation kind.
27   inline static const std::string& ID()
28   {
29     static const std::string MY_MULTIROTATION_ID("AngularCopy");
30     return MY_MULTIROTATION_ID;
31   }
32
33   /// Attribute name of referenced objects.
34   inline static const std::string& OBJECTS_LIST_ID()
35   {
36     static const std::string MY_OBJECTS_LIST_ID("main_objects");
37     return MY_OBJECTS_LIST_ID;
38   }
39
40   /// Attribute name of the angular direction.
41   inline static const std::string& AXIS_ANGULAR_ID()
42   {
43     static const std::string MY_AXIS_ANGULAR_ID("axis_angular");
44     return MY_AXIS_ANGULAR_ID;
45   }
46
47   /// Attribute name for use angular step.
48   inline static const std::string& USE_ANGULAR_STEP_ID()
49   {
50     static const std::string MY_USE_ANGULAR_STEP_ID("use_step_angular");
51     return MY_USE_ANGULAR_STEP_ID;
52   }
53
54   /// Attribute name of step for the angular.
55   inline static const std::string& STEP_ANGULAR_ID()
56   {
57     static const std::string MY_STEP_ANGULAR_ID("step_angular");
58     return MY_STEP_ANGULAR_ID;
59   }
60
61   /// Attribute name of number of copies for angular.
62   inline static const std::string& NB_COPIES_ANGULAR_ID()
63   {
64     static const std::string MY_NB_COPIES_ANGULAR_ID("nb_angular");
65     return MY_NB_COPIES_ANGULAR_ID;
66   }
67
68   /// Attribute name for use radial dir.
69   inline static const std::string& USE_RADIAL_DIR_ID()
70   {
71     static const std::string MY_USE_RADIAL_DIR_ID("use_radial_dir");
72     return MY_USE_RADIAL_DIR_ID;
73   }
74
75   /// Attribute name of radial step.
76   inline static const std::string& STEP_RADIAL_ID()
77   {
78     static const std::string MY_STEP_RADIAL_ID("step_radial");
79     return MY_STEP_RADIAL_ID;
80   }
81
82   /// Attribute name of number of copies for radial.
83   inline static const std::string& NB_COPIES_RADIAL_ID()
84   {
85     static const std::string MY_NB_COPIES_RADIAL_ID("nb_radial");
86     return MY_NB_COPIES_RADIAL_ID;
87   }
88
89   /// \return the kind of a feature.
90   FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
91   {
92     static std::string MY_KIND = FeaturesPlugin_MultiRotation::ID();
93     return MY_KIND;
94   }
95
96   /// Creates a new part document if needed.
97   FEATURESPLUGIN_EXPORT virtual void execute();
98
99   /// Request for initialization of data model of the feature: adding all attributes.
100   FEATURESPLUGIN_EXPORT virtual void initAttributes();
101
102   /// Use plugin manager for features creation.
103   FeaturesPlugin_MultiRotation();
104
105 private:
106   /// Perform the multi rotation in one direction.
107   void performRotation1D();
108
109 #ifdef FEATURE_MULTIROTATION_TWO_DIRECTIONS
110   /// Perform the multi rotation in two directions.
111   void performRotation2D();
112
113   void loadNamingDS2(std::list<std::shared_ptr<GeomAlgoAPI_Translation> > theListOfTranslationAlgo,
114                     std::shared_ptr<ModelAPI_ResultBody> theResultBody,
115                     std::shared_ptr<GeomAPI_Shape> theBaseShape);
116
117   void loadNamingDS3(std::list<std::shared_ptr<GeomAlgoAPI_Rotation> > theListOfRotationAlgo,
118                     std::shared_ptr<ModelAPI_ResultBody> theResultBody,
119                     std::shared_ptr<GeomAPI_Shape> theBaseShape, int nb);
120 #endif
121
122   void loadNamingDS(std::list<std::shared_ptr<GeomAlgoAPI_Rotation> > theListOfRotationAlgo,
123                     std::shared_ptr<ModelAPI_ResultBody> theResultBody,
124                     std::shared_ptr<GeomAPI_Shape> theBaseShape);
125 };
126
127 #endif // FEATURESPLUGIN_MULTIROTATION_H_