1 // File: SketchPlugin_Circle.h
2 // Created: 26 May 2014
3 // Author: Artem ZHIDKOV
5 #ifndef SketchPlugin_Circle_H_
6 #define SketchPlugin_Circle_H_
8 #include "SketchPlugin.h"
9 #include <SketchPlugin_Feature.h>
10 #include <SketchPlugin_Sketch.h>
11 #include <GeomAPI_IPresentable.h>
13 /**\class SketchPlugin_Circle
15 * \brief Feature for creation of the new circle in PartSet.
17 class SketchPlugin_Circle : public SketchPlugin_Feature //, public GeomAPI_IPresentable
20 /// Circle feature kind
21 inline static const std::string& ID()
23 static const std::string MY_CIRCLE_ID("SketchCircle");
27 /// 2D point - center of the circle
28 inline static const std::string& CENTER_ID()
30 static const std::string MY_CIRCLE_CENTER_ID("CircleCenter");
31 return MY_CIRCLE_CENTER_ID;
34 /// Radius of the circle
35 inline static const std::string& RADIUS_ID()
37 static const std::string MY_CIRCLE_RADIUS_ID("CircleRadius");
38 return MY_CIRCLE_RADIUS_ID;
41 /// Returns the kind of a feature
42 SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
44 static std::string MY_KIND = SketchPlugin_Circle::ID();
48 /// Creates a new part document if needed
49 SKETCHPLUGIN_EXPORT virtual void execute();
51 /// Request for initialization of data model of the feature: adding all attributes
52 SKETCHPLUGIN_EXPORT virtual void initAttributes();
54 /// Returns the AIS preview
55 virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious)
57 return simpleAISObject(firstResult(), thePrevious);
60 /// Adds sub-feature of the higher level feature (sub-element of the sketch)
61 /// \param theFeature sub-feature
62 SKETCHPLUGIN_EXPORT virtual const void addSub(const FeaturePtr& theFeature)
68 /// \param theDeltaX the delta for X coordinate is moved
69 /// \param theDeltaY the delta for Y coordinate is moved
70 SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY);
72 /// Return the distance between the feature and the point
73 /// \param thePoint the point
74 virtual double distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint);
76 /// Use plugin manager for features creation
77 SketchPlugin_Circle();