Salome HOME
08263db8c587c23797ff5866843a562d8e2bc4cc
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_Circle.h
1 // File:        SketchPlugin_Circle.h
2 // Created:     26 May 2014
3 // Author:      Artem ZHIDKOV
4
5 #ifndef SketchPlugin_Circle_H_
6 #define SketchPlugin_Circle_H_
7
8 #include "SketchPlugin.h"
9 #include <SketchPlugin_Feature.h>
10 #include <SketchPlugin_Sketch.h>
11 #include <GeomAPI_IPresentable.h>
12
13 /**\class SketchPlugin_Circle
14  * \ingroup DataModel
15  * \brief Feature for creation of the new circle in PartSet.
16  */
17 class SketchPlugin_Circle : public SketchPlugin_Feature  //, public GeomAPI_IPresentable
18 {
19  public:
20   /// Circle feature kind
21   inline static const std::string& ID()
22   {
23     static const std::string MY_CIRCLE_ID("SketchCircle");
24     return MY_CIRCLE_ID;
25   }
26
27   /// 2D point - center of the circle
28   inline static const std::string& CENTER_ID()
29   {
30     static const std::string MY_CIRCLE_CENTER_ID("CircleCenter");
31     return MY_CIRCLE_CENTER_ID;
32   }
33
34   /// Radius of the circle
35   inline static const std::string& RADIUS_ID()
36   {
37     static const std::string MY_CIRCLE_RADIUS_ID("CircleRadius");
38     return MY_CIRCLE_RADIUS_ID;
39   }
40
41   /// Returns the kind of a feature
42   SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
43   {
44     static std::string MY_KIND = SketchPlugin_Circle::ID();
45     return MY_KIND;
46   }
47
48   /// Returns true is sketch element is under the rigid constraint
49   SKETCHPLUGIN_EXPORT virtual bool isFixed();
50
51   /// Creates a new part document if needed
52   SKETCHPLUGIN_EXPORT virtual void execute();
53
54   /// Request for initialization of data model of the feature: adding all attributes
55   SKETCHPLUGIN_EXPORT virtual void initAttributes();
56
57   /// Returns the AIS preview
58   virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious)
59   {
60     return simpleAISObject(firstResult(), thePrevious);
61   }
62
63   /// Adds sub-feature of the higher level feature (sub-element of the sketch)
64   /// \param theFeature sub-feature
65   SKETCHPLUGIN_EXPORT virtual const void addSub(const FeaturePtr& theFeature)
66   {
67   }
68   ;
69
70   /// Moves the feature
71   /// \param theDeltaX the delta for X coordinate is moved
72   /// \param theDeltaY the delta for Y coordinate is moved
73   SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY);
74
75   /// Return the distance between the feature and the point
76   /// \param thePoint the point
77   virtual double distanceToPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
78
79   /// Called on change of any argument-attribute of this object
80   SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
81
82   /// Use plugin manager for features creation
83   SketchPlugin_Circle();
84 };
85
86 #endif