Salome HOME
Remove some TODOs
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_RevolutionBoolean.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:        FeaturesAPI_RevolutionBoolean.cpp
4 // Created:     09 June 2016
5 // Author:      Dmitry Bobylev
6
7 #include "FeaturesAPI_RevolutionBoolean.h"
8
9 #include <ModelHighAPI_Double.h>
10 #include <ModelHighAPI_Tools.h>
11
12 //==================================================================================================
13 FeaturesAPI_RevolutionBoolean::FeaturesAPI_RevolutionBoolean(const std::shared_ptr<ModelAPI_Feature>& theFeature)
14 : ModelHighAPI_Interface(theFeature)
15 {
16 }
17
18 //==================================================================================================
19 FeaturesAPI_RevolutionBoolean::~FeaturesAPI_RevolutionBoolean()
20 {
21 }
22
23 //==================================================================================================
24 void FeaturesAPI_RevolutionBoolean::setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects)
25 {
26   fillAttribute(theBaseObjects, mybaseObjects);
27
28   execute();
29 }
30
31 //==================================================================================================
32 void FeaturesAPI_RevolutionBoolean::setAxis(const ModelHighAPI_Selection& theAxis)
33 {
34   fillAttribute(theAxis, myaxis);
35
36   execute();
37 }
38
39 //==================================================================================================
40 void FeaturesAPI_RevolutionBoolean::setAngles(const ModelHighAPI_Double& theToAngle,
41                                               const ModelHighAPI_Double& theFromAngle)
42 {
43   fillAttribute(FeaturesPlugin_Revolution::CREATION_METHOD_BY_ANGLES(), mycreationMethod);
44   fillAttribute(theToAngle, mytoAngle);
45   fillAttribute(theFromAngle, myfromAngle);
46
47   execute();
48 }
49
50 //==================================================================================================
51 void FeaturesAPI_RevolutionBoolean::setAngle(const ModelHighAPI_Double& theAngle)
52 {
53   fillAttribute(FeaturesPlugin_Revolution::CREATION_METHOD_BY_ANGLES(), mycreationMethod);
54   fillAttribute(theAngle, mytoAngle);
55   fillAttribute(ModelHighAPI_Double(), myfromAngle);
56
57   execute();
58 }
59
60 //==================================================================================================
61 void FeaturesAPI_RevolutionBoolean::setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject,
62                                                         const ModelHighAPI_Double& theToOffset,
63                                                         const ModelHighAPI_Selection& theFromObject,
64                                                         const ModelHighAPI_Double& theFromOffset)
65 {
66   fillAttribute(FeaturesPlugin_Revolution::CREATION_METHOD_BY_PLANES(), mycreationMethod);
67   fillAttribute(theToObject, mytoObject);
68   fillAttribute(theToOffset, mytoOffset);
69   fillAttribute(theFromObject, myfromObject);
70   fillAttribute(theFromOffset, myfromOffset);
71
72   execute();
73 }
74
75 //==================================================================================================
76 void FeaturesAPI_RevolutionBoolean::setBooleanObjects(const std::list<ModelHighAPI_Selection>& theBooleanObjects)
77 {
78   fillAttribute(theBooleanObjects, mybooleanObjects);
79
80   execute();
81 }
82
83 //==================================================================================================
84 FeaturesAPI_RevolutionCut::FeaturesAPI_RevolutionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature)
85 : FeaturesAPI_RevolutionBoolean(theFeature)
86 {
87   initialize();
88 }
89
90 //==================================================================================================
91 FeaturesAPI_RevolutionCut::FeaturesAPI_RevolutionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
92                                                      const std::list<ModelHighAPI_Selection>& theBaseObjects,
93                                                      const ModelHighAPI_Selection& theAxis,
94                                                      const ModelHighAPI_Double& theSize,
95                                                      const std::list<ModelHighAPI_Selection>& theBooleanObjects)
96 : FeaturesAPI_RevolutionBoolean(theFeature)
97 {
98   if(initialize()) {
99     fillAttribute(theBaseObjects, mybaseObjects);
100     fillAttribute(theAxis, myaxis);
101     fillAttribute(theSize, mytoAngle);
102     fillAttribute(ModelHighAPI_Double(), myfromAngle);
103     setBooleanObjects(theBooleanObjects);
104   }
105 }
106
107 //==================================================================================================
108 FeaturesAPI_RevolutionCut::FeaturesAPI_RevolutionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
109                                                      const std::list<ModelHighAPI_Selection>& theBaseObjects,
110                                                      const ModelHighAPI_Selection& theAxis,
111                                                      const ModelHighAPI_Double& theToAngle,
112                                                      const ModelHighAPI_Double& theFromAngle,
113                                                      const std::list<ModelHighAPI_Selection>& theBooleanObjects)
114 : FeaturesAPI_RevolutionBoolean(theFeature)
115 {
116   if(initialize()) {
117     fillAttribute(theBaseObjects, mybaseObjects);
118     fillAttribute(theAxis, myaxis);
119     fillAttribute(theToAngle, mytoAngle);
120     fillAttribute(theFromAngle, myfromAngle);
121     setBooleanObjects(theBooleanObjects);
122   }
123 }
124
125 //==================================================================================================
126 FeaturesAPI_RevolutionCut::FeaturesAPI_RevolutionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
127                                                      const std::list<ModelHighAPI_Selection>& theBaseObjects,
128                                                      const ModelHighAPI_Selection& theAxis,
129                                                      const ModelHighAPI_Selection& theToObject,
130                                                      const ModelHighAPI_Double& theToOffset,
131                                                      const ModelHighAPI_Selection& theFromObject,
132                                                      const ModelHighAPI_Double& theFromOffset,
133                                                      const std::list<ModelHighAPI_Selection>& theBooleanObjects)
134 : FeaturesAPI_RevolutionBoolean(theFeature)
135 {
136   if(initialize()) {
137     fillAttribute(theBaseObjects, mybaseObjects);
138     fillAttribute(theAxis, myaxis);
139     fillAttribute(theToObject, mytoObject);
140     fillAttribute(theToOffset, mytoOffset);
141     fillAttribute(theFromObject, myfromObject);
142     fillAttribute(theFromOffset, myfromOffset);
143     setBooleanObjects(theBooleanObjects);
144   }
145 }
146
147 //==================================================================================================
148 RevolutionCutPtr addRevolutionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
149                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
150                                   const ModelHighAPI_Selection& theAxis,
151                                   const ModelHighAPI_Double& theSize,
152                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
153 {
154   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_RevolutionCut::ID());
155   return RevolutionCutPtr(new FeaturesAPI_RevolutionCut(aFeature, theBaseObjects, theAxis, theSize, theBooleanObjects));
156 }
157
158 //==================================================================================================
159 RevolutionCutPtr addRevolutionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
160                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
161                                   const ModelHighAPI_Selection& theAxis,
162                                   const ModelHighAPI_Double& theToAngle,
163                                   const ModelHighAPI_Double& theFromAngle,
164                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
165 {
166   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_RevolutionCut::ID());
167   return RevolutionCutPtr(new FeaturesAPI_RevolutionCut(aFeature,
168                                                       theBaseObjects,
169                                                       theAxis,
170                                                       theToAngle,
171                                                       theFromAngle,
172                                                       theBooleanObjects));
173 }
174
175 //==================================================================================================
176 RevolutionCutPtr addRevolutionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
177                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
178                                   const ModelHighAPI_Selection& theAxis,
179                                   const ModelHighAPI_Selection& theToObject,
180                                   const ModelHighAPI_Double& theToOffset,
181                                   const ModelHighAPI_Selection& theFromObject,
182                                   const ModelHighAPI_Double& theFromOffset,
183                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects)
184 {
185   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_RevolutionCut::ID());
186   return RevolutionCutPtr(new FeaturesAPI_RevolutionCut(aFeature,
187                                                       theBaseObjects,
188                                                       theAxis,
189                                                       theToObject,
190                                                       theToOffset,
191                                                       theFromObject,
192                                                       theFromOffset,
193                                                       theBooleanObjects));
194 }
195
196
197 //==================================================================================================
198 FeaturesAPI_RevolutionFuse::FeaturesAPI_RevolutionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature)
199 : FeaturesAPI_RevolutionBoolean(theFeature)
200 {
201   initialize();
202 }
203
204 //==================================================================================================
205 FeaturesAPI_RevolutionFuse::FeaturesAPI_RevolutionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
206                                                        const std::list<ModelHighAPI_Selection>& theBaseObjects,
207                                                        const ModelHighAPI_Selection& theAxis,
208                                                        const ModelHighAPI_Double& theSize,
209                                                        const std::list<ModelHighAPI_Selection>& theBooleanObjects)
210 : FeaturesAPI_RevolutionBoolean(theFeature)
211 {
212   if(initialize()) {
213     fillAttribute(theBaseObjects, mybaseObjects);
214     fillAttribute(theAxis, myaxis);
215     fillAttribute(theSize, mytoAngle);
216     fillAttribute(ModelHighAPI_Double(), myfromAngle);
217     setBooleanObjects(theBooleanObjects);
218   }
219 }
220
221 //==================================================================================================
222 FeaturesAPI_RevolutionFuse::FeaturesAPI_RevolutionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
223                                                        const std::list<ModelHighAPI_Selection>& theBaseObjects,
224                                                        const ModelHighAPI_Selection& theAxis,
225                                                        const ModelHighAPI_Double& theToAngle,
226                                                        const ModelHighAPI_Double& theFromAngle,
227                                                        const std::list<ModelHighAPI_Selection>& theBooleanObjects)
228 : FeaturesAPI_RevolutionBoolean(theFeature)
229 {
230   if(initialize()) {
231     fillAttribute(theBaseObjects, mybaseObjects);
232     fillAttribute(theAxis, myaxis);
233     fillAttribute(theToAngle, mytoAngle);
234     fillAttribute(theFromAngle, myfromAngle);
235     setBooleanObjects(theBooleanObjects);
236   }
237 }
238
239 //==================================================================================================
240 FeaturesAPI_RevolutionFuse::FeaturesAPI_RevolutionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
241                                                        const std::list<ModelHighAPI_Selection>& theBaseObjects,
242                                                        const ModelHighAPI_Selection& theAxis,
243                                                        const ModelHighAPI_Selection& theToObject,
244                                                        const ModelHighAPI_Double& theToOffset,
245                                                        const ModelHighAPI_Selection& theFromObject,
246                                                        const ModelHighAPI_Double& theFromOffset,
247                                                        const std::list<ModelHighAPI_Selection>& theBooleanObjects)
248 : FeaturesAPI_RevolutionBoolean(theFeature)
249 {
250   if(initialize()) {
251     fillAttribute(theBaseObjects, mybaseObjects);
252     fillAttribute(theAxis, myaxis);
253     fillAttribute(theToObject, mytoObject);
254     fillAttribute(theToOffset, mytoOffset);
255     fillAttribute(theFromObject, myfromObject);
256     fillAttribute(theFromOffset, myfromOffset);
257     setBooleanObjects(theBooleanObjects);
258   }
259 }
260
261 //==================================================================================================
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_Double& theSize,
266                                     const std::list<ModelHighAPI_Selection>& theBooleanObjects)
267 {
268   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_RevolutionFuse::ID());
269   return RevolutionFusePtr(new FeaturesAPI_RevolutionFuse(aFeature, theBaseObjects, theAxis, theSize, theBooleanObjects));
270 }
271
272 //==================================================================================================
273 RevolutionFusePtr addRevolutionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
274                                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
275                                     const ModelHighAPI_Selection& theAxis,
276                                     const ModelHighAPI_Double& theToAngle,
277                                     const ModelHighAPI_Double& theFromAngle,
278                                     const std::list<ModelHighAPI_Selection>& theBooleanObjects)
279 {
280   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_RevolutionFuse::ID());
281   return RevolutionFusePtr(new FeaturesAPI_RevolutionFuse(aFeature,
282                                                         theBaseObjects,
283                                                         theAxis,
284                                                         theToAngle,
285                                                         theFromAngle,
286                                                         theBooleanObjects));
287 }
288
289 //==================================================================================================
290 RevolutionFusePtr addRevolutionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
291                                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
292                                     const ModelHighAPI_Selection& theAxis,
293                                     const ModelHighAPI_Selection& theToObject,
294                                     const ModelHighAPI_Double& theToOffset,
295                                     const ModelHighAPI_Selection& theFromObject,
296                                     const ModelHighAPI_Double& theFromOffset,
297                                     const std::list<ModelHighAPI_Selection>& theBooleanObjects)
298 {
299   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_RevolutionFuse::ID());
300   return RevolutionFusePtr(new FeaturesAPI_RevolutionFuse(aFeature,
301                                                         theBaseObjects,
302                                                         theAxis,
303                                                         theToObject,
304                                                         theToOffset,
305                                                         theFromObject,
306                                                         theFromOffset,
307                                                         theBooleanObjects));
308 }