1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: FeaturesAPI_Revolution.cpp
4 // Created: 09 June 2016
5 // Author: Dmitry Bobylev
7 #include "FeaturesAPI_Revolution.h"
9 #include <ModelHighAPI_Double.h>
10 #include <ModelHighAPI_Tools.h>
12 //==================================================================================================
13 FeaturesAPI_Revolution::FeaturesAPI_Revolution(const std::shared_ptr<ModelAPI_Feature>& theFeature)
14 : ModelHighAPI_Interface(theFeature)
19 //==================================================================================================
20 FeaturesAPI_Revolution::FeaturesAPI_Revolution(const std::shared_ptr<ModelAPI_Feature>& theFeature,
21 const std::list<ModelHighAPI_Selection>& theBaseObjects,
22 const ModelHighAPI_Selection& theAxis,
23 const ModelHighAPI_Double& theAngle)
24 : ModelHighAPI_Interface(theFeature)
27 fillAttribute(theBaseObjects, mybaseObjects);
28 fillAttribute(theAxis, myaxis);
29 setAngles(theAngle, ModelHighAPI_Double());
33 //==================================================================================================
34 FeaturesAPI_Revolution::FeaturesAPI_Revolution(const std::shared_ptr<ModelAPI_Feature>& theFeature,
35 const std::list<ModelHighAPI_Selection>& theBaseObjects,
36 const ModelHighAPI_Selection& theAxis,
37 const ModelHighAPI_Double& theToAngle,
38 const ModelHighAPI_Double& theFromAngle)
39 : ModelHighAPI_Interface(theFeature)
42 fillAttribute(theBaseObjects, mybaseObjects);
43 fillAttribute(theAxis, myaxis);
44 setAngles(theToAngle, theFromAngle);
48 //==================================================================================================
49 FeaturesAPI_Revolution::FeaturesAPI_Revolution(const std::shared_ptr<ModelAPI_Feature>& theFeature,
50 const std::list<ModelHighAPI_Selection>& theBaseObjects,
51 const ModelHighAPI_Selection& theAxis,
52 const ModelHighAPI_Selection& theToObject,
53 const ModelHighAPI_Double& theToOffset,
54 const ModelHighAPI_Selection& theFromObject,
55 const ModelHighAPI_Double& theFromOffset)
56 : ModelHighAPI_Interface(theFeature)
59 fillAttribute(theBaseObjects, mybaseObjects);
60 fillAttribute(theAxis, myaxis);
61 setPlanesAndOffsets(theToObject, theToOffset, theFromObject, theFromOffset);
65 //==================================================================================================
66 FeaturesAPI_Revolution::~FeaturesAPI_Revolution()
71 //==================================================================================================
72 void FeaturesAPI_Revolution::setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects)
74 fillAttribute(theBaseObjects, mybaseObjects);
79 //==================================================================================================
80 void FeaturesAPI_Revolution::setAxis(const ModelHighAPI_Selection& theAxis)
82 fillAttribute(theAxis, myaxis);
87 //==================================================================================================
88 void FeaturesAPI_Revolution::setAngles(const ModelHighAPI_Double& theToAngle,
89 const ModelHighAPI_Double& theFromAngle)
91 fillAttribute(FeaturesPlugin_Revolution::CREATION_METHOD_BY_ANGLES(), mycreationMethod);
92 fillAttribute(theToAngle, mytoAngle);
93 fillAttribute(theFromAngle, myfromAngle);
98 //==================================================================================================
99 void FeaturesAPI_Revolution::setAngle(const ModelHighAPI_Double& theAngle)
101 fillAttribute(FeaturesPlugin_Revolution::CREATION_METHOD_BY_ANGLES(), mycreationMethod);
102 fillAttribute(theAngle, mytoAngle);
103 fillAttribute(ModelHighAPI_Double(), myfromAngle);
108 //==================================================================================================
109 void FeaturesAPI_Revolution::setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject,
110 const ModelHighAPI_Double& theToOffset,
111 const ModelHighAPI_Selection& theFromObject,
112 const ModelHighAPI_Double& theFromOffset)
114 fillAttribute("ByPlanesAndOffsets", mycreationMethod);
115 fillAttribute(theToObject, mytoObject);
116 fillAttribute(theToOffset, mytoOffset);
117 fillAttribute(theFromObject, myfromObject);
118 fillAttribute(theFromOffset, myfromOffset);
123 //==================================================================================================
124 RevolutionPtr addRevolution(const std::shared_ptr<ModelAPI_Document>& thePart,
125 const std::list<ModelHighAPI_Selection>& theBaseObjects,
126 const ModelHighAPI_Selection& theAxis,
127 const ModelHighAPI_Double& theAngle)
129 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Revolution::ID());
130 return RevolutionPtr(new FeaturesAPI_Revolution(aFeature, theBaseObjects, theAxis, theAngle));
133 //==================================================================================================
134 RevolutionPtr addRevolution(const std::shared_ptr<ModelAPI_Document>& thePart,
135 const std::list<ModelHighAPI_Selection>& theBaseObjects,
136 const ModelHighAPI_Selection& theAxis,
137 const ModelHighAPI_Double& theToAngle,
138 const ModelHighAPI_Double& theFromAngle)
140 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Revolution::ID());
141 return RevolutionPtr(new FeaturesAPI_Revolution(aFeature,
148 //==================================================================================================
149 RevolutionPtr addRevolution(const std::shared_ptr<ModelAPI_Document>& thePart,
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)
157 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Revolution::ID());
158 return RevolutionPtr(new FeaturesAPI_Revolution(aFeature,