1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: FeaturesAPI_RevolutionBoolean.cpp
4 // Created: 09 June 2016
5 // Author: Dmitry Bobylev
7 #include "FeaturesAPI_RevolutionBoolean.h"
9 #include <ModelHighAPI_Double.h>
10 #include <ModelHighAPI_Tools.h>
12 //==================================================================================================
13 FeaturesAPI_RevolutionBoolean::FeaturesAPI_RevolutionBoolean(const std::shared_ptr<ModelAPI_Feature>& theFeature)
14 : ModelHighAPI_Interface(theFeature)
18 //==================================================================================================
19 FeaturesAPI_RevolutionBoolean::~FeaturesAPI_RevolutionBoolean()
23 //==================================================================================================
24 void FeaturesAPI_RevolutionBoolean::setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects)
26 fillAttribute(theBaseObjects, mybaseObjects);
31 //==================================================================================================
32 void FeaturesAPI_RevolutionBoolean::setAxis(const ModelHighAPI_Selection& theAxis)
34 fillAttribute(theAxis, myaxis);
39 //==================================================================================================
40 void FeaturesAPI_RevolutionBoolean::setAngles(const ModelHighAPI_Double& theToAngle,
41 const ModelHighAPI_Double& theFromAngle)
43 fillAttribute(FeaturesPlugin_Revolution::CREATION_METHOD_BY_ANGLES(), mycreationMethod);
44 fillAttribute(theToAngle, mytoAngle);
45 fillAttribute(theFromAngle, myfromAngle);
50 //==================================================================================================
51 void FeaturesAPI_RevolutionBoolean::setAngle(const ModelHighAPI_Double& theAngle)
53 fillAttribute(FeaturesPlugin_Revolution::CREATION_METHOD_BY_ANGLES(), mycreationMethod);
54 fillAttribute(theAngle, mytoAngle);
55 fillAttribute(ModelHighAPI_Double(), myfromAngle);
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)
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);
75 //==================================================================================================
76 void FeaturesAPI_RevolutionBoolean::setBooleanObjects(const std::list<ModelHighAPI_Selection>& theBooleanObjects)
78 fillAttribute(theBooleanObjects, mybooleanObjects);
83 //==================================================================================================
84 FeaturesAPI_RevolutionCut::FeaturesAPI_RevolutionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature)
85 : FeaturesAPI_RevolutionBoolean(theFeature)
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)
99 fillAttribute(theBaseObjects, mybaseObjects);
100 fillAttribute(theAxis, myaxis);
101 fillAttribute(theSize, mytoAngle);
102 fillAttribute(ModelHighAPI_Double(), myfromAngle);
103 setBooleanObjects(theBooleanObjects);
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)
117 fillAttribute(theBaseObjects, mybaseObjects);
118 fillAttribute(theAxis, myaxis);
119 fillAttribute(theToAngle, mytoAngle);
120 fillAttribute(theFromAngle, myfromAngle);
121 setBooleanObjects(theBooleanObjects);
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)
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);
147 // TODO(spo): make add* as static functions of the class
148 //==================================================================================================
149 RevolutionCutPtr addRevolutionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
150 const std::list<ModelHighAPI_Selection>& theBaseObjects,
151 const ModelHighAPI_Selection& theAxis,
152 const ModelHighAPI_Double& theSize,
153 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
155 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_RevolutionCut::ID());
156 return RevolutionCutPtr(new FeaturesAPI_RevolutionCut(aFeature, theBaseObjects, theAxis, theSize, theBooleanObjects));
159 //==================================================================================================
160 RevolutionCutPtr addRevolutionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
161 const std::list<ModelHighAPI_Selection>& theBaseObjects,
162 const ModelHighAPI_Selection& theAxis,
163 const ModelHighAPI_Double& theToAngle,
164 const ModelHighAPI_Double& theFromAngle,
165 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
167 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_RevolutionCut::ID());
168 return RevolutionCutPtr(new FeaturesAPI_RevolutionCut(aFeature,
176 //==================================================================================================
177 RevolutionCutPtr addRevolutionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
178 const std::list<ModelHighAPI_Selection>& theBaseObjects,
179 const ModelHighAPI_Selection& theAxis,
180 const ModelHighAPI_Selection& theToObject,
181 const ModelHighAPI_Double& theToOffset,
182 const ModelHighAPI_Selection& theFromObject,
183 const ModelHighAPI_Double& theFromOffset,
184 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
186 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_RevolutionCut::ID());
187 return RevolutionCutPtr(new FeaturesAPI_RevolutionCut(aFeature,
198 //==================================================================================================
199 FeaturesAPI_RevolutionFuse::FeaturesAPI_RevolutionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature)
200 : FeaturesAPI_RevolutionBoolean(theFeature)
205 //==================================================================================================
206 FeaturesAPI_RevolutionFuse::FeaturesAPI_RevolutionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
207 const std::list<ModelHighAPI_Selection>& theBaseObjects,
208 const ModelHighAPI_Selection& theAxis,
209 const ModelHighAPI_Double& theSize,
210 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
211 : FeaturesAPI_RevolutionBoolean(theFeature)
214 fillAttribute(theBaseObjects, mybaseObjects);
215 fillAttribute(theAxis, myaxis);
216 fillAttribute(theSize, mytoAngle);
217 fillAttribute(ModelHighAPI_Double(), myfromAngle);
218 setBooleanObjects(theBooleanObjects);
222 //==================================================================================================
223 FeaturesAPI_RevolutionFuse::FeaturesAPI_RevolutionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
224 const std::list<ModelHighAPI_Selection>& theBaseObjects,
225 const ModelHighAPI_Selection& theAxis,
226 const ModelHighAPI_Double& theToAngle,
227 const ModelHighAPI_Double& theFromAngle,
228 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
229 : FeaturesAPI_RevolutionBoolean(theFeature)
232 fillAttribute(theBaseObjects, mybaseObjects);
233 fillAttribute(theAxis, myaxis);
234 fillAttribute(theToAngle, mytoAngle);
235 fillAttribute(theFromAngle, myfromAngle);
236 setBooleanObjects(theBooleanObjects);
240 //==================================================================================================
241 FeaturesAPI_RevolutionFuse::FeaturesAPI_RevolutionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
242 const std::list<ModelHighAPI_Selection>& theBaseObjects,
243 const ModelHighAPI_Selection& theAxis,
244 const ModelHighAPI_Selection& theToObject,
245 const ModelHighAPI_Double& theToOffset,
246 const ModelHighAPI_Selection& theFromObject,
247 const ModelHighAPI_Double& theFromOffset,
248 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
249 : FeaturesAPI_RevolutionBoolean(theFeature)
252 fillAttribute(theBaseObjects, mybaseObjects);
253 fillAttribute(theAxis, myaxis);
254 fillAttribute(theToObject, mytoObject);
255 fillAttribute(theToOffset, mytoOffset);
256 fillAttribute(theFromObject, myfromObject);
257 fillAttribute(theFromOffset, myfromOffset);
258 setBooleanObjects(theBooleanObjects);
262 // TODO(spo): make add* as static functions of the class
263 //==================================================================================================
264 RevolutionFusePtr addRevolutionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
265 const std::list<ModelHighAPI_Selection>& theBaseObjects,
266 const ModelHighAPI_Selection& theAxis,
267 const ModelHighAPI_Double& theSize,
268 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
270 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_RevolutionFuse::ID());
271 return RevolutionFusePtr(new FeaturesAPI_RevolutionFuse(aFeature, theBaseObjects, theAxis, theSize, theBooleanObjects));
274 //==================================================================================================
275 RevolutionFusePtr addRevolutionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
276 const std::list<ModelHighAPI_Selection>& theBaseObjects,
277 const ModelHighAPI_Selection& theAxis,
278 const ModelHighAPI_Double& theToAngle,
279 const ModelHighAPI_Double& theFromAngle,
280 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
282 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_RevolutionFuse::ID());
283 return RevolutionFusePtr(new FeaturesAPI_RevolutionFuse(aFeature,
291 //==================================================================================================
292 RevolutionFusePtr addRevolutionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
293 const std::list<ModelHighAPI_Selection>& theBaseObjects,
294 const ModelHighAPI_Selection& theAxis,
295 const ModelHighAPI_Selection& theToObject,
296 const ModelHighAPI_Double& theToOffset,
297 const ModelHighAPI_Selection& theFromObject,
298 const ModelHighAPI_Double& theFromOffset,
299 const std::list<ModelHighAPI_Selection>& theBooleanObjects)
301 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_RevolutionFuse::ID());
302 return RevolutionFusePtr(new FeaturesAPI_RevolutionFuse(aFeature,