Salome HOME
13fdc2acabacec6590c2f5277b38e5d4df3658f9
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_Rotation.h
1 // Copyright (C) 2014-2023  CEA, EDF
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 #ifndef FeaturesAPI_Rotation_H_
21 #define FeaturesAPI_Rotation_H_
22
23 #include "FeaturesAPI.h"
24
25 #include <FeaturesPlugin_Rotation.h>
26
27 #include <ModelHighAPI_Double.h>
28 #include <ModelHighAPI_Interface.h>
29 #include <ModelHighAPI_Macro.h>
30 #include <ModelHighAPI_Selection.h>
31
32 class ModelHighAPI_Dumper;
33
34 /// \class FeaturesAPI_Rotation
35 /// \ingroup CPPHighAPI
36 /// \brief Interface for Rotation feature.
37 class FeaturesAPI_Rotation: public ModelHighAPI_Interface
38 {
39 public:
40   /// Constructor without values.
41   FEATURESAPI_EXPORT
42   explicit FeaturesAPI_Rotation(const std::shared_ptr<ModelAPI_Feature>& theFeature);
43
44   /// Constructor with values.
45   FEATURESAPI_EXPORT
46   FeaturesAPI_Rotation(const std::shared_ptr<ModelAPI_Feature>& theFeature,
47                        const std::list<ModelHighAPI_Selection>& theMainObjects,
48                        const ModelHighAPI_Selection& theAxisObject,
49                        const ModelHighAPI_Double& theAngle);
50
51   /// Constructor with values.
52   FEATURESAPI_EXPORT
53   FeaturesAPI_Rotation(const std::shared_ptr<ModelAPI_Feature>& theFeature,
54                        const std::list<ModelHighAPI_Selection>& theMainObjects,
55                        const ModelHighAPI_Selection& theCenterPoint,
56                        const ModelHighAPI_Selection& theStartPoint,
57                        const ModelHighAPI_Selection& theEndPoint);
58
59   /// Destructor.
60   FEATURESAPI_EXPORT
61   virtual ~FeaturesAPI_Rotation();
62
63   INTERFACE_7(FeaturesPlugin_Rotation::ID(),
64               creationMethod, FeaturesPlugin_Rotation::CREATION_METHOD(),
65               ModelAPI_AttributeString, /** Creation method */,
66               mainObjects, FeaturesPlugin_Rotation::OBJECTS_LIST_ID(),
67               ModelAPI_AttributeSelectionList, /** Main objects */,
68               axisObject, FeaturesPlugin_Rotation::AXIS_OBJECT_ID(),
69               ModelAPI_AttributeSelection, /** Axis object */,
70               angle, FeaturesPlugin_Rotation::ANGLE_ID(),
71               ModelAPI_AttributeDouble, /** Angle */,
72               centerPoint, FeaturesPlugin_Rotation::CENTER_POINT_ID(),
73               ModelAPI_AttributeSelection, /** Center point */,
74               startPoint, FeaturesPlugin_Rotation::START_POINT_ID(),
75               ModelAPI_AttributeSelection, /** Start point */,
76               endPoint, FeaturesPlugin_Rotation::END_POINT_ID(),
77               ModelAPI_AttributeSelection, /** End point */
78              )
79
80   /// Set main objects.
81   FEATURESAPI_EXPORT
82   void setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects);
83
84   /// Set axis object.
85   FEATURESAPI_EXPORT
86   void setAxisObject(const ModelHighAPI_Selection& theAxisObject);
87
88   /// Set angle.
89   FEATURESAPI_EXPORT
90   void setAngle(const ModelHighAPI_Double& theAngle);
91
92   /// Set center point, start point and end point
93   FEATURESAPI_EXPORT
94   void setPoints(const ModelHighAPI_Selection& theCenterPoint,
95                  const ModelHighAPI_Selection& theStartPoint,
96                  const ModelHighAPI_Selection& theEndPoint);
97
98   /// Dump wrapped feature
99   FEATURESAPI_EXPORT
100   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
101 };
102
103 /// Pointer on Rotation object.
104 typedef std::shared_ptr<FeaturesAPI_Rotation> RotationPtr;
105
106
107 #define DUMMY std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>()
108
109 /// \ingroup CPPHighAPI
110 /// \brief Create Rotation feature.
111 FEATURESAPI_EXPORT RotationPtr addRotation(
112     const std::shared_ptr<ModelAPI_Document>& part,
113     const std::list<ModelHighAPI_Selection>& objects,
114     const ModelHighAPI_Selection& axis = ModelHighAPI_Selection(),
115     const std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>& angle = DUMMY,
116     const ModelHighAPI_Selection& center = ModelHighAPI_Selection(),
117     const ModelHighAPI_Selection& start = ModelHighAPI_Selection(),
118     const ModelHighAPI_Selection& end = ModelHighAPI_Selection(),
119     const bool keepSubResults = false);
120
121 #endif // FeaturesAPI_Rotation_H_