--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: SketchAPI_Circle.cpp
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#include "SketchAPI_Circle.h"
+
+#include <GeomAPI_Pnt2d.h>
+
+#include <ModelHighAPI_Double.h>
+#include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+SketchAPI_Circle::SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: SketchAPI_SketchEntity(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+SketchAPI_Circle::SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ double theCenterX,
+ double theCenterY,
+ double theRadius)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if(initialize()) {
+ setByCenterAndRadius(theCenterX, theCenterY, theRadius);
+ }
+}
+
+//==================================================================================================
+SketchAPI_Circle::SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+ double theRadius)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if(initialize()) {
+ setByCenterAndRadius(theCenter, theRadius);
+ }
+}
+
+//==================================================================================================
+SketchAPI_Circle::SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ double theX1, double theY1,
+ double theX2, double theY2,
+ double theX3, double theY3)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ setByThreePoints(theX1, theY1, theX2, theY2, theX3, theY3);
+ }
+}
+
+//==================================================================================================
+SketchAPI_Circle::SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ setByThreePoints(thePoint1, thePoint2, thePoint3);
+ }
+}
+
+//==================================================================================================
+SketchAPI_Circle::SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_Selection& theExternal)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ setByExternal(theExternal);
+ }
+}
+
+//==================================================================================================
+SketchAPI_Circle::SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::string& theExternalName)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ setByExternalName(theExternalName);
+ }
+}
+
+//==================================================================================================
+SketchAPI_Circle::~SketchAPI_Circle()
+{
+
+}
+
+//==================================================================================================
+void SketchAPI_Circle::setByCenterAndRadius(double theCenterX, double theCenterY, double theRadius)
+{
+ fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_CENTER_AND_RADIUS(), mycircleType);
+ fillAttribute(center(), theCenterX, theCenterY);
+ fillAttribute(ModelHighAPI_Double(theRadius), myradius);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Circle::setByCenterAndRadius(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+ double theRadius)
+{
+ fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_CENTER_AND_RADIUS(), mycircleType);
+ fillAttribute(theCenter, mycenter);
+ fillAttribute(ModelHighAPI_Double(theRadius), myradius);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Circle::setByThreePoints(double theX1, double theY1,
+ double theX2, double theY2,
+ double theX3, double theY3)
+{
+ fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_THREE_POINTS(), mycircleType);
+ fillAttribute(firstPoint(), theX1, theY1);
+ fillAttribute(secondPoint(), theX2, theY2);
+ fillAttribute(thirdPoint(), theX3, theY3);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Circle::setByThreePoints(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3)
+{
+ fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_THREE_POINTS(), mycircleType);
+ fillAttribute(thePoint1, myfirstPoint);
+ fillAttribute(thePoint2, mysecondPoint);
+ fillAttribute(thePoint3, mythirdPoint);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Circle::setByExternal(const ModelHighAPI_Selection & theExternal)
+{
+ fillAttribute(theExternal, external());
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Circle::setByExternalName(const std::string & theExternalName)
+{
+ fillAttribute(ModelHighAPI_Selection("EDGE", theExternalName), external());
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Circle::setCenter(double theX, double theY)
+{
+ fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_CENTER_AND_RADIUS(), mycircleType);
+ fillAttribute(center(), theX, theY);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Circle::setCenter(const std::shared_ptr<GeomAPI_Pnt2d> & theCenter)
+{
+ fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_CENTER_AND_RADIUS(), mycircleType);
+ fillAttribute(theCenter, mycenter);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Circle::setRadius(double theRadius)
+{
+ fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_CENTER_AND_RADIUS(), mycircleType);
+ fillAttribute(ModelHighAPI_Double(theRadius), myradius);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Circle::setFirstPoint(double theX, double theY)
+{
+ fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_THREE_POINTS(), mycircleType);
+ fillAttribute(firstPoint(), theX, theY);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Circle::setFirstPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
+{
+ fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_THREE_POINTS(), mycircleType);
+ fillAttribute(thePoint, myfirstPoint);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Circle::setSecondPoint(double theX, double theY)
+{
+ fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_THREE_POINTS(), mycircleType);
+ fillAttribute(secondPoint(), theX, theY);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Circle::setSecondPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
+{
+ fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_THREE_POINTS(), mycircleType);
+ fillAttribute(thePoint, mysecondPoint);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Circle::setThirdPoint(double theX, double theY)
+{
+ fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_THREE_POINTS(), mycircleType);
+ fillAttribute(thirdPoint(), theX, theY);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Circle::setThirdPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
+{
+ fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_THREE_POINTS(), mycircleType);
+ fillAttribute(thePoint, mythirdPoint);
+
+ execute();
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: SketchAPI_Circle.h
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef SketchAPI_Circle_H_
+#define SketchAPI_Circle_H_
+
+#include "SketchAPI.h"
+#include "SketchAPI_SketchEntity.h"
+
+#include <GeomDataAPI_Point2D.h>
+
+#include <SketchPlugin_Circle.h>
+
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_Boolean
+/// \ingroup CPPHighAPI
+/// \brief Interface for Circle feature.
+class SketchAPI_Circle: public SketchAPI_SketchEntity
+{
+public:
+ /// Constructor without values.
+ SKETCHAPI_EXPORT
+ explicit SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ SKETCHAPI_EXPORT
+ SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ double theCenterX,
+ double theCenterY,
+ double theRadius);
+
+ /// Constructor with values.
+ SKETCHAPI_EXPORT
+ SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+ double theRadius);
+
+ /// Constructor with values.
+ SKETCHAPI_EXPORT
+ SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ double theX1, double theY1,
+ double theX2, double theY2,
+ double theX3, double theY3);
+
+ /// Constructor with values.
+ SKETCHAPI_EXPORT
+ SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3);
+
+ /// Constructor with values.
+ SKETCHAPI_EXPORT
+ SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_Selection& theExternal);
+
+ /// Constructor with values.
+ SKETCHAPI_EXPORT
+ SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::string& theExternalName);
+
+ /// Destructor.
+ SKETCHAPI_EXPORT
+ virtual ~SketchAPI_Circle();
+
+ INTERFACE_7(SketchPlugin_Circle::ID(),
+ circleType, SketchPlugin_Circle::CIRCLE_TYPE(), ModelAPI_AttributeString, /** Circle type */,
+ center, SketchPlugin_Circle::CENTER_ID(), GeomDataAPI_Point2D, /** Center point */,
+ radius, SketchPlugin_Circle::RADIUS_ID(), ModelAPI_AttributeDouble, /** Radius */,
+ firstPoint, SketchPlugin_Circle::FIRST_POINT_ID(), GeomDataAPI_Point2D, /** First point */,
+ secondPoint, SketchPlugin_Circle::SECOND_POINT_ID(), GeomDataAPI_Point2D, /** Second point */,
+ thirdPoint, SketchPlugin_Circle::THIRD_POINT_ID(), GeomDataAPI_Point2D, /** Third point */,
+ external, SketchPlugin_Circle::EXTERNAL_ID(), ModelAPI_AttributeSelection, /** External */)
+
+ /// Set by center and radius.
+ SKETCHAPI_EXPORT
+ void setByCenterAndRadius(double theCenterX, double theCenterY, double theRadius);
+
+ /// Set by center and radius.
+ SKETCHAPI_EXPORT
+ void setByCenterAndRadius(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter, double theRadius);
+
+ /// Set by three points.
+ SKETCHAPI_EXPORT
+ void setByThreePoints(double theX1, double theY1,
+ double theX2, double theY2,
+ double theX3, double theY3);
+
+ /// Set by three points.
+ SKETCHAPI_EXPORT
+ void setByThreePoints(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3);
+
+ /// Set by external.
+ SKETCHAPI_EXPORT
+ void setByExternal(const ModelHighAPI_Selection& theExternal);
+
+ /// Set by external name.
+ SKETCHAPI_EXPORT
+ void setByExternalName(const std::string& theExternalName);
+
+ /// Set center.
+ SKETCHAPI_EXPORT
+ void setCenter(double theX, double theY);
+
+ /// Set center.
+ SKETCHAPI_EXPORT
+ void setCenter(const std::shared_ptr<GeomAPI_Pnt2d> & theCenter);
+
+ /// Set radius.
+ SKETCHAPI_EXPORT
+ void setRadius(double theRadius);
+
+ /// Set first point.
+ SKETCHAPI_EXPORT
+ void setFirstPoint(double theX, double theY);
+
+ /// Set first point.
+ SKETCHAPI_EXPORT
+ void setFirstPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
+
+ /// Set second point.
+ SKETCHAPI_EXPORT
+ void setSecondPoint(double theX, double theY);
+
+ /// Set second point.
+ SKETCHAPI_EXPORT
+ void setSecondPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
+
+ /// Set third point.
+ SKETCHAPI_EXPORT
+ void setThirdPoint(double theX, double theY);
+
+ /// Set third point.
+ SKETCHAPI_EXPORT
+ void setThirdPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
+};
+
+/// Pointer on Circle object.
+typedef std::shared_ptr<SketchAPI_Circle> CirclePtr;
+
+#endif // SketchAPI_Circle_H_