Salome HOME
updated copyright message
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_Revolution.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_Revolution_H_
21 #define FeaturesAPI_Revolution_H_
22
23 #include "FeaturesAPI.h"
24
25 #include <FeaturesPlugin_Revolution.h>
26
27 #include <ModelHighAPI_Interface.h>
28 #include <ModelHighAPI_Macro.h>
29
30 class ModelHighAPI_Double;
31 class ModelHighAPI_Reference;
32 class ModelHighAPI_Selection;
33
34 /// \class FeaturesAPI_Revolution
35 /// \ingroup CPPHighAPI
36 /// \brief Interface for Revolution feature.
37 class FeaturesAPI_Revolution: public ModelHighAPI_Interface
38 {
39 public:
40   /// Constructor without values.
41   FEATURESAPI_EXPORT
42   explicit FeaturesAPI_Revolution(const std::shared_ptr<ModelAPI_Feature>& theFeature);
43
44   /// Constructor with values.
45   FEATURESAPI_EXPORT
46   explicit FeaturesAPI_Revolution(const std::shared_ptr<ModelAPI_Feature>& theFeature,
47                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
48                                   const ModelHighAPI_Selection& theAxis,
49                                   const ModelHighAPI_Double& theAngle);
50
51   /// Constructor with values.
52   FEATURESAPI_EXPORT
53   explicit FeaturesAPI_Revolution(const std::shared_ptr<ModelAPI_Feature>& theFeature,
54                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
55                                   const ModelHighAPI_Selection& theAxis,
56                                   const ModelHighAPI_Double& theToAngle,
57                                   const ModelHighAPI_Double& theFromAngle,
58                                   const std::string& theSelectionType = std::string());
59
60   /// Constructor with values.
61   FEATURESAPI_EXPORT
62   explicit FeaturesAPI_Revolution(const std::shared_ptr<ModelAPI_Feature>& theFeature,
63                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
64                                   const ModelHighAPI_Selection& theAxis,
65                                   const ModelHighAPI_Selection& theToObject,
66                                   const ModelHighAPI_Double& theToOffset,
67                                   const ModelHighAPI_Selection& theFromObject,
68                                   const ModelHighAPI_Double& theFromOffset,
69                                   const std::string& theSelectionType = std::string());
70
71   /// Destructor.
72   FEATURESAPI_EXPORT
73   virtual ~FeaturesAPI_Revolution();
74
75   INTERFACE_10(FeaturesPlugin_Revolution::ID(),
76                sketch, FeaturesPlugin_Revolution::SKETCH_ID(),
77                ModelAPI_AttributeReference, /** Sketch launcher */,
78                baseObjects, FeaturesPlugin_Revolution::BASE_OBJECTS_ID(),
79                ModelAPI_AttributeSelectionList, /** Base objects */,
80                axis, FeaturesPlugin_Revolution::AXIS_OBJECT_ID(),
81                ModelAPI_AttributeSelection, /** Axis */,
82                creationMethod, FeaturesPlugin_Revolution::CREATION_METHOD(),
83                ModelAPI_AttributeString, /** Creation method */,
84                toAngle, FeaturesPlugin_Revolution::TO_ANGLE_ID(),
85                ModelAPI_AttributeDouble, /** To angle */,
86                fromAngle, FeaturesPlugin_Revolution::FROM_ANGLE_ID(),
87                ModelAPI_AttributeDouble, /** From angle */,
88                toObject, FeaturesPlugin_Revolution::TO_OBJECT_ID(),
89                ModelAPI_AttributeSelection, /** To object */,
90                toOffset, FeaturesPlugin_Revolution::TO_OFFSET_ID(),
91                ModelAPI_AttributeDouble, /** To offset */,
92                fromObject, FeaturesPlugin_Revolution::FROM_OBJECT_ID(),
93                ModelAPI_AttributeSelection, /** From object */,
94                fromOffset, FeaturesPlugin_Revolution::FROM_OFFSET_ID(),
95                ModelAPI_AttributeDouble, /** From offset */)
96
97   /// Modify base attribute of the feature.
98   FEATURESAPI_EXPORT
99   void setNestedSketch(const ModelHighAPI_Reference& theSketch);
100
101   /// Modify base attribute of the feature.
102   FEATURESAPI_EXPORT
103   void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
104
105   /// Modify axis_object attribute of the feature.
106   FEATURESAPI_EXPORT
107   void setAxis(const ModelHighAPI_Selection& theAxis);
108
109   /// Modify CreationMethod, to_angle, from_angle attributes of the feature.
110   FEATURESAPI_EXPORT
111   void setAngles(const ModelHighAPI_Double& theToAngle,
112                  const ModelHighAPI_Double& theFromAngle);
113
114   /// Modify CreationMethod, to_angle, from_angle attributes of the feature.
115   FEATURESAPI_EXPORT
116   void setAngle(const ModelHighAPI_Double& theAngle);
117
118   /// Modify CreationMethod, to_object, to_offset,
119   /// from_object, from_offset attributes of the feature.
120   FEATURESAPI_EXPORT
121   void setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject,
122                            const ModelHighAPI_Double& theToOffset,
123                            const ModelHighAPI_Selection& theFromObject,
124                            const ModelHighAPI_Double& theFromOffset);
125
126   /// Dump wrapped feature
127   FEATURESAPI_EXPORT
128   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
129
130 private:
131   void execIfBaseNotEmpty();
132 };
133
134 /// Pointer on Revolution object.
135 typedef std::shared_ptr<FeaturesAPI_Revolution> RevolutionPtr;
136
137 /// \ingroup CPPHighAPI
138 /// \brief Create Revolution feature.
139 FEATURESAPI_EXPORT
140 RevolutionPtr addRevolution(const std::shared_ptr<ModelAPI_Document>& thePart,
141                             const std::list<ModelHighAPI_Selection>& theBaseObjects,
142                             const ModelHighAPI_Selection& theAxis,
143                             const ModelHighAPI_Double& theAngle);
144
145 /// \ingroup CPPHighAPI
146 /// \brief Create Revolution feature.
147 FEATURESAPI_EXPORT
148 RevolutionPtr addRevolution(const std::shared_ptr<ModelAPI_Document>& thePart,
149                             const std::list<ModelHighAPI_Selection>& theBaseObjects,
150                             const ModelHighAPI_Selection& theAxis,
151                             const ModelHighAPI_Double& theToAngle,
152                             const ModelHighAPI_Double& theFromAngle,
153                             const std::string& theSelectionType = std::string());
154
155 /// \ingroup CPPHighAPI
156 /// \brief Create Revolution feature.
157 FEATURESAPI_EXPORT
158 RevolutionPtr addRevolution(const std::shared_ptr<ModelAPI_Document>& thePart,
159                             const std::list<ModelHighAPI_Selection>& theBaseObjects,
160                             const ModelHighAPI_Selection& theAxis,
161                             const ModelHighAPI_Selection& theToObject,
162                             const ModelHighAPI_Double& theToOffset,
163                             const ModelHighAPI_Selection& theFromObject,
164                             const ModelHighAPI_Double& theFromOffset,
165                             const std::string& theSelectionType = std::string());
166
167 #endif // FeaturesAPI_Revolution_H_