1 // Copyright (C) 2014-2017 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
20 #ifndef FeaturesAPI_RevolutionBoolean_H_
21 #define FeaturesAPI_RevolutionBoolean_H_
23 #include "FeaturesAPI.h"
25 #include <FeaturesPlugin_CompositeBoolean.h>
26 #include <FeaturesPlugin_RevolutionCut.h>
27 #include <FeaturesPlugin_RevolutionFuse.h>
29 #include <ModelHighAPI_Interface.h>
30 #include <ModelHighAPI_Macro.h>
32 class ModelHighAPI_Double;
33 class ModelHighAPI_Dumper;
34 class ModelHighAPI_Reference;
35 class ModelHighAPI_Selection;
37 /// \class FeaturesAPI_RevolutionBoolean
38 /// \ingroup CPPHighAPI
39 /// \brief Interface for RevolutionBoolean feature.
40 class FeaturesAPI_RevolutionBoolean: public ModelHighAPI_Interface
45 virtual ~FeaturesAPI_RevolutionBoolean();
48 sketch, FeaturesPlugin_Revolution::SKETCH_ID(),
49 ModelAPI_AttributeReference, /** Sketch launcher */,
50 baseObjects, FeaturesPlugin_Revolution::BASE_OBJECTS_ID(),
51 ModelAPI_AttributeSelectionList, /** Base objects */,
52 axis, FeaturesPlugin_Revolution::AXIS_OBJECT_ID(),
53 ModelAPI_AttributeSelection, /** Axis */,
54 creationMethod, FeaturesPlugin_Revolution::CREATION_METHOD(),
55 ModelAPI_AttributeString, /** Creation method */,
56 toAngle, FeaturesPlugin_Revolution::TO_ANGLE_ID(),
57 ModelAPI_AttributeDouble, /** To angle */,
58 fromAngle, FeaturesPlugin_Revolution::FROM_ANGLE_ID(),
59 ModelAPI_AttributeDouble, /** From angle */,
60 toObject, FeaturesPlugin_Revolution::TO_OBJECT_ID(),
61 ModelAPI_AttributeSelection, /** To object */,
62 toOffset, FeaturesPlugin_Revolution::TO_OFFSET_ID(),
63 ModelAPI_AttributeDouble, /** To offset */,
64 fromObject, FeaturesPlugin_Revolution::FROM_OBJECT_ID(),
65 ModelAPI_AttributeSelection, /** From object */,
66 fromOffset, FeaturesPlugin_Revolution::FROM_OFFSET_ID(),
67 ModelAPI_AttributeDouble, /** From offset */,
68 booleanObjects, FeaturesPlugin_CompositeBoolean::OBJECTS_ID(),
69 ModelAPI_AttributeSelectionList, /** Boolean objects */)
71 /// Modify base attribute of the feature.
73 void setNestedSketch(const ModelHighAPI_Reference& theSketch);
75 /// Modify base attribute of the feature.
77 void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
79 /// Modify axis_object attribute of the feature.
81 void setAxis(const ModelHighAPI_Selection& theAxis);
83 /// Modify CreationMethod, to_angle, from_angle attributes of the feature.
85 void setAngles(const ModelHighAPI_Double& theToAngle, const ModelHighAPI_Double& theFromAngle);
87 /// Modify creation_method, to_angle, from_angle attributes of the feature.
89 void setAngle(const ModelHighAPI_Double& theAngle);
91 /// Modify creation_method, to_object, to_offset, from_object,
92 /// from_offset attributes of the feature.
94 void setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject,
95 const ModelHighAPI_Double& theToOffset,
96 const ModelHighAPI_Selection& theFromObject,
97 const ModelHighAPI_Double& theFromOffset);
99 /// Modiyfy main_objects attribute of the feature.
101 void setBooleanObjects(const std::list<ModelHighAPI_Selection>& theBooleanObjects);
103 /// Dump wrapped feature
105 virtual void dump(ModelHighAPI_Dumper& theDumper) const;
108 /// Constructor without values.
110 explicit FeaturesAPI_RevolutionBoolean(const std::shared_ptr<ModelAPI_Feature>& theFeature);
113 void execIfBaseNotEmpty();
116 /// \class FeaturesAPI_RevolutionCut
117 /// \ingroup CPPHighAPI
118 /// \brief Interface for RevolutionCut feature.
119 class FeaturesAPI_RevolutionCut: public FeaturesAPI_RevolutionBoolean
123 static std::string ID() { return FeaturesPlugin_RevolutionCut::ID(); }
124 virtual std::string getID() { return ID(); }
126 /// Constructor without values.
128 explicit FeaturesAPI_RevolutionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature);
130 /// Constructor with values.
132 explicit FeaturesAPI_RevolutionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
133 const std::list<ModelHighAPI_Selection>& theBaseObjects,
134 const ModelHighAPI_Selection& theAxis,
135 const ModelHighAPI_Double& theAngle,
136 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
138 /// Constructor with values.
140 explicit FeaturesAPI_RevolutionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
141 const std::list<ModelHighAPI_Selection>& theBaseObjects,
142 const ModelHighAPI_Selection& theAxis,
143 const ModelHighAPI_Double& theToAngle,
144 const ModelHighAPI_Double& theFromAngle,
145 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
147 /// Constructor with values.
149 explicit FeaturesAPI_RevolutionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
150 const std::list<ModelHighAPI_Selection>& theBaseObjects,
151 const ModelHighAPI_Selection& theAxis,
152 const ModelHighAPI_Selection& theToObject,
153 const ModelHighAPI_Double& theToOffset,
154 const ModelHighAPI_Selection& theFromObject,
155 const ModelHighAPI_Double& theFromOffset,
156 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
159 /// Pointer on RevolutionCut object.
160 typedef std::shared_ptr<FeaturesAPI_RevolutionCut> RevolutionCutPtr;
162 /// \ingroup CPPHighAPI
163 /// \brief Create RevolutionCut feature.
165 RevolutionCutPtr addRevolutionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
166 const std::list<ModelHighAPI_Selection>& theBaseObjects,
167 const ModelHighAPI_Selection& theAxis,
168 const ModelHighAPI_Double& theAngle,
169 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
171 /// \ingroup CPPHighAPI
172 /// \brief Create RevolutionCut feature.
174 RevolutionCutPtr addRevolutionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
175 const std::list<ModelHighAPI_Selection>& theBaseObjects,
176 const ModelHighAPI_Selection& theAxis,
177 const ModelHighAPI_Double& theToAngle,
178 const ModelHighAPI_Double& theFromAngle,
179 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
181 /// \ingroup CPPHighAPI
182 /// \brief Create RevolutionCut feature.
184 RevolutionCutPtr addRevolutionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
185 const std::list<ModelHighAPI_Selection>& theBaseObjects,
186 const ModelHighAPI_Selection& theAxis,
187 const ModelHighAPI_Selection& theToObject,
188 const ModelHighAPI_Double& theToOffset,
189 const ModelHighAPI_Selection& theFromObject,
190 const ModelHighAPI_Double& theFromOffset,
191 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
193 /// \class FeaturesAPI_RevolutionFuse
194 /// \ingroup CPPHighAPI
195 /// \brief Interface for RevolutionFuse feature.
196 class FeaturesAPI_RevolutionFuse: public FeaturesAPI_RevolutionBoolean
200 static std::string ID() { return FeaturesPlugin_RevolutionFuse::ID(); }
201 virtual std::string getID() { return ID(); }
203 /// Constructor without values.
205 explicit FeaturesAPI_RevolutionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature);
207 /// Constructor with values.
209 explicit FeaturesAPI_RevolutionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
210 const std::list<ModelHighAPI_Selection>& theBaseObjects,
211 const ModelHighAPI_Selection& theAxis,
212 const ModelHighAPI_Double& theAngle,
213 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
215 /// Constructor with values.
217 explicit FeaturesAPI_RevolutionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
218 const std::list<ModelHighAPI_Selection>& theBaseObjects,
219 const ModelHighAPI_Selection& theAxis,
220 const ModelHighAPI_Double& theToAngle,
221 const ModelHighAPI_Double& theFromAngle,
222 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
224 /// Constructor with values.
226 explicit FeaturesAPI_RevolutionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
227 const std::list<ModelHighAPI_Selection>& theBaseObjects,
228 const ModelHighAPI_Selection& theAxis,
229 const ModelHighAPI_Selection& theToObject,
230 const ModelHighAPI_Double& theToOffset,
231 const ModelHighAPI_Selection& theFromObject,
232 const ModelHighAPI_Double& theFromOffset,
233 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
236 /// Pointer on RevolutionFuse object.
237 typedef std::shared_ptr<FeaturesAPI_RevolutionFuse> RevolutionFusePtr;
239 /// \ingroup CPPHighAPI
240 /// \brief Create RevolutionFuse feature.
242 RevolutionFusePtr addRevolutionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
243 const std::list<ModelHighAPI_Selection>& theBaseObjects,
244 const ModelHighAPI_Selection& theAxis,
245 const ModelHighAPI_Double& theAngle,
246 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
248 /// \ingroup CPPHighAPI
249 /// \brief Create RevolutionFuse feature.
251 RevolutionFusePtr addRevolutionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
252 const std::list<ModelHighAPI_Selection>& theBaseObjects,
253 const ModelHighAPI_Selection& theAxis,
254 const ModelHighAPI_Double& theToAngle,
255 const ModelHighAPI_Double& theFromAngle,
256 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
258 /// \ingroup CPPHighAPI
259 /// \brief Create RevolutionFuse feature.
261 RevolutionFusePtr addRevolutionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
262 const std::list<ModelHighAPI_Selection>& theBaseObjects,
263 const ModelHighAPI_Selection& theAxis,
264 const ModelHighAPI_Selection& theToObject,
265 const ModelHighAPI_Double& theToOffset,
266 const ModelHighAPI_Selection& theFromObject,
267 const ModelHighAPI_Double& theFromOffset,
268 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
270 #endif // FeaturesAPI_RevolutionBoolean_H_