1 // Copyright (C) 2014-2020 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
20 #include "SketchAPI_MacroCircle.h"
22 #include <GeomAPI_Pnt2d.h>
24 #include <ModelHighAPI_Double.h>
25 #include <ModelHighAPI_Dumper.h>
26 #include <ModelHighAPI_Selection.h>
27 #include <ModelHighAPI_Tools.h>
29 //==================================================================================================
30 SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr<ModelAPI_Feature>& theFeature)
31 : SketchAPI_SketchEntity(theFeature)
36 //==================================================================================================
37 SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
42 : SketchAPI_SketchEntity(theFeature)
45 setByCenterAndPassedPoints(theCenterX, theCenterY, thePassedX, thePassedY);
49 //==================================================================================================
50 SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
51 const std::shared_ptr<GeomAPI_Pnt2d>& theCenterPoint,
52 const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint)
53 : SketchAPI_SketchEntity(theFeature)
56 setByCenterAndPassedPoints(theCenterPoint, thePassedPoint);
60 //==================================================================================================
61 SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
62 double theX1, double theY1,
63 double theX2, double theY2,
64 double theX3, double theY3)
65 : SketchAPI_SketchEntity(theFeature)
68 setByThreePoints(theX1, theY1, theX2, theY2, theX3, theY3);
72 //==================================================================================================
73 SketchAPI_MacroCircle::SketchAPI_MacroCircle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
74 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
75 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
76 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3)
77 : SketchAPI_SketchEntity(theFeature)
80 setByThreePoints(thePoint1, thePoint2, thePoint3);
84 //==================================================================================================
85 SketchAPI_MacroCircle::~SketchAPI_MacroCircle()
89 //==================================================================================================
90 void SketchAPI_MacroCircle::setByCenterAndPassedPoints(double theCenterX,
95 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS(), mycircleType);
96 fillAttribute(centerPoint(), theCenterX, theCenterY);
97 fillAttribute(passedPoint(), thePassedX, thePassedY);
102 //==================================================================================================
103 void SketchAPI_MacroCircle::setByCenterAndPassedPoints(
104 const std::shared_ptr<GeomAPI_Pnt2d>& theCenterPoint,
105 const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint)
107 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS(), mycircleType);
108 fillAttribute(theCenterPoint, mycenterPoint);
109 fillAttribute(thePassedPoint, mypassedPoint);
114 //==================================================================================================
115 void SketchAPI_MacroCircle::setByThreePoints(double theX1, double theY1,
116 double theX2, double theY2,
117 double theX3, double theY3)
119 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), mycircleType);
120 fillAttribute(firstPoint(), theX1, theY1);
121 fillAttribute(secondPoint(), theX2, theY2);
122 fillAttribute(thirdPoint(), theX3, theY3);
127 //==================================================================================================
128 void SketchAPI_MacroCircle::setByThreePoints(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
129 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
130 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3)
132 fillAttribute(SketchPlugin_MacroCircle::CIRCLE_TYPE_BY_THREE_POINTS(), mycircleType);
133 fillAttribute(thePoint1, myfirstPoint);
134 fillAttribute(thePoint2, mysecondPoint);
135 fillAttribute(thePoint3, mythirdPoint);