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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #include "SketchAPI_MacroCircle.h"
23 #include <GeomAPI_Pnt2d.h>
25 #include <ModelHighAPI_Double.h>
26 #include <ModelHighAPI_Dumper.h>
27 #include <ModelHighAPI_Selection.h>
28 #include <ModelHighAPI_Tools.h>
30 //==================================================================================================
31 SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr<ModelAPI_Feature>& theFeature)
32 : SketchAPI_SketchEntity(theFeature)
37 //==================================================================================================
38 SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
43 : SketchAPI_SketchEntity(theFeature)
46 setByCenterAndPassedPoints(theCenterX, theCenterY, thePassedX, thePassedY);
50 //==================================================================================================
51 SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
52 const std::shared_ptr<GeomAPI_Pnt2d>& theCenterPoint,
53 const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint)
54 : SketchAPI_SketchEntity(theFeature)
57 setByCenterAndPassedPoints(theCenterPoint, thePassedPoint);
61 //==================================================================================================
62 SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
63 double theX1, double theY1,
64 double theX2, double theY2,
65 double theX3, double theY3)
66 : SketchAPI_SketchEntity(theFeature)
69 setByThreePoints(theX1, theY1, theX2, theY2, theX3, theY3);
73 //==================================================================================================
74 SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
75 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
76 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
77 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3)
78 : SketchAPI_SketchEntity(theFeature)
81 setByThreePoints(thePoint1, thePoint2, thePoint3);
85 //==================================================================================================
86 SketchAPI_MacroCircle::~SketchAPI_MacroCircle()
90 //==================================================================================================
91 void SketchAPI_MacroCircle::setByCenterAndPassedPoints(double theCenterX,
96 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS(), mycircleType);
97 fillAttribute(centerPoint(), theCenterX, theCenterY);
98 fillAttribute(passedPoint(), thePassedX, thePassedY);
103 //==================================================================================================
104 void SketchAPI_MacroCircle::setByCenterAndPassedPoints(
105 const std::shared_ptr<GeomAPI_Pnt2d>& theCenterPoint,
106 const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint)
108 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS(), mycircleType);
109 fillAttribute(theCenterPoint, mycenterPoint);
110 fillAttribute(thePassedPoint, mypassedPoint);
115 //==================================================================================================
116 void SketchAPI_MacroCircle::setByThreePoints(double theX1, double theY1,
117 double theX2, double theY2,
118 double theX3, double theY3)
120 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), mycircleType);
121 fillAttribute(firstPoint(), theX1, theY1);
122 fillAttribute(secondPoint(), theX2, theY2);
123 fillAttribute(thirdPoint(), theX3, theY3);
128 //==================================================================================================
129 void SketchAPI_MacroCircle::setByThreePoints(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
130 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
131 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3)
133 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), mycircleType);
134 fillAttribute(thePoint1, myfirstPoint);
135 fillAttribute(thePoint2, mysecondPoint);
136 fillAttribute(thePoint3, mythirdPoint);
141 //==================================================================================================
142 void SketchAPI_MacroCircle::setCenterPoint(double theX, double theY)
144 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS(), mycircleType);
145 fillAttribute(centerPoint(), theX, theY);
150 //==================================================================================================
151 void SketchAPI_MacroCircle::setCenterPoint(const std::shared_ptr<GeomAPI_Pnt2d>& theCenterPoint)
153 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS(), mycircleType);
154 fillAttribute(theCenterPoint, mycenterPoint);
159 //==================================================================================================
160 void SketchAPI_MacroCircle::setPassedPoint(double theX, double theY)
162 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS(), mycircleType);
163 fillAttribute(passedPoint(), theX, theY);
168 //==================================================================================================
169 void SketchAPI_MacroCircle::setPassedPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint)
171 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS(), mycircleType);
172 fillAttribute(thePassedPoint, mypassedPoint);
177 //==================================================================================================
178 void SketchAPI_MacroCircle::setFirstPoint(double theX, double theY)
180 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), mycircleType);
181 fillAttribute(firstPoint(), theX, theY);
186 //==================================================================================================
187 void SketchAPI_MacroCircle::setFirstPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
189 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), mycircleType);
190 fillAttribute(thePoint, myfirstPoint);
195 //==================================================================================================
196 void SketchAPI_MacroCircle::setSecondPoint(double theX, double theY)
198 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), mycircleType);
199 fillAttribute(secondPoint(), theX, theY);
204 //==================================================================================================
205 void SketchAPI_MacroCircle::setSecondPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
207 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), mycircleType);
208 fillAttribute(thePoint, mysecondPoint);
213 //==================================================================================================
214 void SketchAPI_MacroCircle::setThirdPoint(double theX, double theY)
216 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), mycircleType);
217 fillAttribute(thirdPoint(), theX, theY);
222 //==================================================================================================
223 void SketchAPI_MacroCircle::setThirdPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
225 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), mycircleType);
226 fillAttribute(thePoint, mythirdPoint);