1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: SketchAPI_MacroCircle.cpp
4 // Created: 09 June 2016
5 // Author: Dmitry Bobylev
7 #include "SketchAPI_MacroCircle.h"
9 #include <GeomAPI_Pnt2d.h>
11 #include <ModelHighAPI_Double.h>
12 #include <ModelHighAPI_Dumper.h>
13 #include <ModelHighAPI_Selection.h>
14 #include <ModelHighAPI_Tools.h>
16 //==================================================================================================
17 SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr<ModelAPI_Feature>& theFeature)
18 : SketchAPI_SketchEntity(theFeature)
23 //==================================================================================================
24 SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
29 : SketchAPI_SketchEntity(theFeature)
32 setByCenterAndPassedPoints(theCenterX, theCenterY, thePassedX, thePassedY);
36 //==================================================================================================
37 SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
38 const std::shared_ptr<GeomAPI_Pnt2d>& theCenterPoint,
39 const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint)
40 : SketchAPI_SketchEntity(theFeature)
43 setByCenterAndPassedPoints(theCenterPoint, thePassedPoint);
47 //==================================================================================================
48 SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
49 double theX1, double theY1,
50 double theX2, double theY2,
51 double theX3, double theY3)
52 : SketchAPI_SketchEntity(theFeature)
55 setByThreePoints(theX1, theY1, theX2, theY2, theX3, theY3);
59 //==================================================================================================
60 SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
61 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
62 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
63 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3)
64 : SketchAPI_SketchEntity(theFeature)
67 setByThreePoints(thePoint1, thePoint2, thePoint3);
71 //==================================================================================================
72 SketchAPI_MacroCircle::~SketchAPI_MacroCircle()
76 //==================================================================================================
77 void SketchAPI_MacroCircle::setByCenterAndPassedPoints(double theCenterX,
82 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS(), mycircleType);
83 fillAttribute(centerPoint(), theCenterX, theCenterY);
84 fillAttribute(passedPoint(), thePassedX, thePassedY);
89 //==================================================================================================
90 void SketchAPI_MacroCircle::setByCenterAndPassedPoints(
91 const std::shared_ptr<GeomAPI_Pnt2d>& theCenterPoint,
92 const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint)
94 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS(), mycircleType);
95 fillAttribute(theCenterPoint, mycenterPoint);
96 fillAttribute(thePassedPoint, mypassedPoint);
101 //==================================================================================================
102 void SketchAPI_MacroCircle::setByThreePoints(double theX1, double theY1,
103 double theX2, double theY2,
104 double theX3, double theY3)
106 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), mycircleType);
107 fillAttribute(firstPoint(), theX1, theY1);
108 fillAttribute(secondPoint(), theX2, theY2);
109 fillAttribute(thirdPoint(), theX3, theY3);
114 //==================================================================================================
115 void SketchAPI_MacroCircle::setByThreePoints(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
116 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
117 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3)
119 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), mycircleType);
120 fillAttribute(thePoint1, myfirstPoint);
121 fillAttribute(thePoint2, mysecondPoint);
122 fillAttribute(thePoint3, mythirdPoint);
127 //==================================================================================================
128 void SketchAPI_MacroCircle::setCenterPoint(double theX, double theY)
130 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS(), mycircleType);
131 fillAttribute(centerPoint(), theX, theY);
136 //==================================================================================================
137 void SketchAPI_MacroCircle::setCenterPoint(const std::shared_ptr<GeomAPI_Pnt2d>& theCenterPoint)
139 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS(), mycircleType);
140 fillAttribute(theCenterPoint, mycenterPoint);
145 //==================================================================================================
146 void SketchAPI_MacroCircle::setPassedPoint(double theX, double theY)
148 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS(), mycircleType);
149 fillAttribute(passedPoint(), theX, theY);
154 //==================================================================================================
155 void SketchAPI_MacroCircle::setPassedPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint)
157 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS(), mycircleType);
158 fillAttribute(thePassedPoint, mypassedPoint);
163 //==================================================================================================
164 void SketchAPI_MacroCircle::setFirstPoint(double theX, double theY)
166 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), mycircleType);
167 fillAttribute(firstPoint(), theX, theY);
172 //==================================================================================================
173 void SketchAPI_MacroCircle::setFirstPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
175 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), mycircleType);
176 fillAttribute(thePoint, myfirstPoint);
181 //==================================================================================================
182 void SketchAPI_MacroCircle::setSecondPoint(double theX, double theY)
184 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), mycircleType);
185 fillAttribute(secondPoint(), theX, theY);
190 //==================================================================================================
191 void SketchAPI_MacroCircle::setSecondPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
193 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), mycircleType);
194 fillAttribute(thePoint, mysecondPoint);
199 //==================================================================================================
200 void SketchAPI_MacroCircle::setThirdPoint(double theX, double theY)
202 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), mycircleType);
203 fillAttribute(thirdPoint(), theX, theY);
208 //==================================================================================================
209 void SketchAPI_MacroCircle::setThirdPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
211 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), mycircleType);
212 fillAttribute(thePoint, mythirdPoint);