Salome HOME
Merge branch 'Pre_2.8.0_development'
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_RevolutionBoolean.h
1 // Copyright (C) 2014-2017  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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #ifndef FeaturesAPI_RevolutionBoolean_H_
22 #define FeaturesAPI_RevolutionBoolean_H_
23
24 #include "FeaturesAPI.h"
25
26 #include <FeaturesPlugin_CompositeBoolean.h>
27 #include <FeaturesPlugin_RevolutionCut.h>
28 #include <FeaturesPlugin_RevolutionFuse.h>
29
30 #include <ModelHighAPI_Interface.h>
31 #include <ModelHighAPI_Macro.h>
32
33 class ModelHighAPI_Double;
34 class ModelHighAPI_Dumper;
35 class ModelHighAPI_Reference;
36 class ModelHighAPI_Selection;
37
38 /// \class FeaturesAPI_RevolutionBoolean
39 /// \ingroup CPPHighAPI
40 /// \brief Interface for RevolutionBoolean feature.
41 class FeaturesAPI_RevolutionBoolean: public ModelHighAPI_Interface
42 {
43 public:
44   /// Destructor.
45   FEATURESAPI_EXPORT
46   virtual ~FeaturesAPI_RevolutionBoolean();
47
48   INTERFACE_11("",
49                sketch, FeaturesPlugin_Revolution::SKETCH_ID(),
50                ModelAPI_AttributeReference, /** Sketch launcher */,
51                baseObjects, FeaturesPlugin_Revolution::BASE_OBJECTS_ID(),
52                ModelAPI_AttributeSelectionList, /** Base objects */,
53                axis, FeaturesPlugin_Revolution::AXIS_OBJECT_ID(),
54                ModelAPI_AttributeSelection, /** Axis */,
55                creationMethod, FeaturesPlugin_Revolution::CREATION_METHOD(),
56                ModelAPI_AttributeString, /** Creation method */,
57                toAngle, FeaturesPlugin_Revolution::TO_ANGLE_ID(),
58                ModelAPI_AttributeDouble, /** To angle */,
59                fromAngle, FeaturesPlugin_Revolution::FROM_ANGLE_ID(),
60                ModelAPI_AttributeDouble, /** From angle */,
61                toObject, FeaturesPlugin_Revolution::TO_OBJECT_ID(),
62                ModelAPI_AttributeSelection, /** To object */,
63                toOffset, FeaturesPlugin_Revolution::TO_OFFSET_ID(),
64                ModelAPI_AttributeDouble, /** To offset */,
65                fromObject, FeaturesPlugin_Revolution::FROM_OBJECT_ID(),
66                ModelAPI_AttributeSelection, /** From object */,
67                fromOffset, FeaturesPlugin_Revolution::FROM_OFFSET_ID(),
68                ModelAPI_AttributeDouble, /** From offset */,
69                booleanObjects, FeaturesPlugin_CompositeBoolean::OBJECTS_ID(),
70                ModelAPI_AttributeSelectionList, /** Boolean objects */)
71
72   /// Modify base attribute of the feature.
73   FEATURESAPI_EXPORT
74   void setNestedSketch(const ModelHighAPI_Reference& theSketch);
75
76   /// Modify base attribute of the feature.
77   FEATURESAPI_EXPORT
78   void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
79
80   /// Modify axis_object attribute of the feature.
81   FEATURESAPI_EXPORT
82   void setAxis(const ModelHighAPI_Selection& theAxis);
83
84   /// Modify CreationMethod, to_angle, from_angle attributes of the feature.
85   FEATURESAPI_EXPORT
86   void setAngles(const ModelHighAPI_Double& theToAngle, const ModelHighAPI_Double& theFromAngle);
87
88   /// Modify creation_method, to_angle, from_angle attributes of the feature.
89   FEATURESAPI_EXPORT
90   void setAngle(const ModelHighAPI_Double& theAngle);
91
92   /// Modify creation_method, to_object, to_offset, from_object,
93   /// from_offset attributes of the feature.
94   FEATURESAPI_EXPORT
95   void setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject,
96                            const ModelHighAPI_Double& theToOffset,
97                            const ModelHighAPI_Selection& theFromObject,
98                            const ModelHighAPI_Double& theFromOffset);
99
100   /// Modiyfy main_objects attribute of the feature.
101   FEATURESAPI_EXPORT
102   void setBooleanObjects(const std::list<ModelHighAPI_Selection>& theBooleanObjects);
103
104   /// Dump wrapped feature
105   FEATURESAPI_EXPORT
106   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
107
108 protected:
109   /// Constructor without values.
110   FEATURESAPI_EXPORT
111   explicit FeaturesAPI_RevolutionBoolean(const std::shared_ptr<ModelAPI_Feature>& theFeature);
112
113 private:
114   void execIfBaseNotEmpty();
115 };
116
117 /// \class FeaturesAPI_RevolutionCut
118 /// \ingroup CPPHighAPI
119 /// \brief Interface for RevolutionCut feature.
120 class FeaturesAPI_RevolutionCut: public FeaturesAPI_RevolutionBoolean
121 {
122 public:
123
124   static std::string ID() { return FeaturesPlugin_RevolutionCut::ID(); }
125   virtual std::string getID() { return ID(); }
126
127   /// Constructor without values.
128   FEATURESAPI_EXPORT
129   explicit FeaturesAPI_RevolutionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature);
130
131   /// Constructor with values.
132   FEATURESAPI_EXPORT
133   explicit FeaturesAPI_RevolutionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
134                                      const std::list<ModelHighAPI_Selection>& theBaseObjects,
135                                      const ModelHighAPI_Selection& theAxis,
136                                      const ModelHighAPI_Double& theAngle,
137                                      const std::list<ModelHighAPI_Selection>& theBooleanObjects);
138
139   /// Constructor with values.
140   FEATURESAPI_EXPORT
141   explicit FeaturesAPI_RevolutionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
142                                      const std::list<ModelHighAPI_Selection>& theBaseObjects,
143                                      const ModelHighAPI_Selection& theAxis,
144                                      const ModelHighAPI_Double& theToAngle,
145                                      const ModelHighAPI_Double& theFromAngle,
146                                      const std::list<ModelHighAPI_Selection>& theBooleanObjects);
147
148   /// Constructor with values.
149   FEATURESAPI_EXPORT
150   explicit FeaturesAPI_RevolutionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
151                                      const std::list<ModelHighAPI_Selection>& theBaseObjects,
152                                      const ModelHighAPI_Selection& theAxis,
153                                      const ModelHighAPI_Selection& theToObject,
154                                      const ModelHighAPI_Double& theToOffset,
155                                      const ModelHighAPI_Selection& theFromObject,
156                                      const ModelHighAPI_Double& theFromOffset,
157                                      const std::list<ModelHighAPI_Selection>& theBooleanObjects);
158 };
159
160 /// Pointer on RevolutionCut object.
161 typedef std::shared_ptr<FeaturesAPI_RevolutionCut> RevolutionCutPtr;
162
163 /// \ingroup CPPHighAPI
164 /// \brief Create RevolutionCut feature.
165 FEATURESAPI_EXPORT
166 RevolutionCutPtr addRevolutionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
167                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
168                                   const ModelHighAPI_Selection& theAxis,
169                                   const ModelHighAPI_Double& theAngle,
170                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects);
171
172 /// \ingroup CPPHighAPI
173 /// \brief Create RevolutionCut feature.
174 FEATURESAPI_EXPORT
175 RevolutionCutPtr addRevolutionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
176                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
177                                   const ModelHighAPI_Selection& theAxis,
178                                   const ModelHighAPI_Double& theToAngle,
179                                   const ModelHighAPI_Double& theFromAngle,
180                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects);
181
182 /// \ingroup CPPHighAPI
183 /// \brief Create RevolutionCut feature.
184 FEATURESAPI_EXPORT
185 RevolutionCutPtr addRevolutionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
186                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
187                                   const ModelHighAPI_Selection& theAxis,
188                                   const ModelHighAPI_Selection& theToObject,
189                                   const ModelHighAPI_Double& theToOffset,
190                                   const ModelHighAPI_Selection& theFromObject,
191                                   const ModelHighAPI_Double& theFromOffset,
192                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects);
193
194 /// \class FeaturesAPI_RevolutionFuse
195 /// \ingroup CPPHighAPI
196 /// \brief Interface for RevolutionFuse feature.
197 class FeaturesAPI_RevolutionFuse: public FeaturesAPI_RevolutionBoolean
198 {
199 public:
200
201   static std::string ID() { return FeaturesPlugin_RevolutionFuse::ID(); }
202   virtual std::string getID() { return ID(); }
203
204   /// Constructor without values.
205   FEATURESAPI_EXPORT
206   explicit FeaturesAPI_RevolutionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature);
207
208   /// Constructor with values.
209   FEATURESAPI_EXPORT
210   explicit FeaturesAPI_RevolutionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
211                                       const std::list<ModelHighAPI_Selection>& theBaseObjects,
212                                       const ModelHighAPI_Selection& theAxis,
213                                       const ModelHighAPI_Double& theAngle,
214                                       const std::list<ModelHighAPI_Selection>& theBooleanObjects);
215
216   /// Constructor with values.
217   FEATURESAPI_EXPORT
218   explicit FeaturesAPI_RevolutionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
219                                       const std::list<ModelHighAPI_Selection>& theBaseObjects,
220                                       const ModelHighAPI_Selection& theAxis,
221                                       const ModelHighAPI_Double& theToAngle,
222                                       const ModelHighAPI_Double& theFromAngle,
223                                       const std::list<ModelHighAPI_Selection>& theBooleanObjects);
224
225   /// Constructor with values.
226   FEATURESAPI_EXPORT
227   explicit FeaturesAPI_RevolutionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
228                                       const std::list<ModelHighAPI_Selection>& theBaseObjects,
229                                       const ModelHighAPI_Selection& theAxis,
230                                       const ModelHighAPI_Selection& theToObject,
231                                       const ModelHighAPI_Double& theToOffset,
232                                       const ModelHighAPI_Selection& theFromObject,
233                                       const ModelHighAPI_Double& theFromOffset,
234                                       const std::list<ModelHighAPI_Selection>& theBooleanObjects);
235 };
236
237 /// Pointer on RevolutionFuse object.
238 typedef std::shared_ptr<FeaturesAPI_RevolutionFuse> RevolutionFusePtr;
239
240 /// \ingroup CPPHighAPI
241 /// \brief Create RevolutionFuse feature.
242 FEATURESAPI_EXPORT
243 RevolutionFusePtr addRevolutionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
244                                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
245                                     const ModelHighAPI_Selection& theAxis,
246                                     const ModelHighAPI_Double& theAngle,
247                                     const std::list<ModelHighAPI_Selection>& theBooleanObjects);
248
249 /// \ingroup CPPHighAPI
250 /// \brief Create RevolutionFuse feature.
251 FEATURESAPI_EXPORT
252 RevolutionFusePtr addRevolutionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
253                                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
254                                     const ModelHighAPI_Selection& theAxis,
255                                     const ModelHighAPI_Double& theToAngle,
256                                     const ModelHighAPI_Double& theFromAngle,
257                                     const std::list<ModelHighAPI_Selection>& theBooleanObjects);
258
259 /// \ingroup CPPHighAPI
260 /// \brief Create RevolutionFuse feature.
261 FEATURESAPI_EXPORT
262 RevolutionFusePtr addRevolutionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
263                                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
264                                     const ModelHighAPI_Selection& theAxis,
265                                     const ModelHighAPI_Selection& theToObject,
266                                     const ModelHighAPI_Double& theToOffset,
267                                     const ModelHighAPI_Selection& theFromObject,
268                                     const ModelHighAPI_Double& theFromOffset,
269                                     const std::list<ModelHighAPI_Selection>& theBooleanObjects);
270
271 #endif // FeaturesAPI_RevolutionBoolean_H_