]> SALOME platform Git repositories - modules/shaper.git/blob - src/SketchPlugin/SketchPlugin_Circle.h
Salome HOME
Merge branch 'master' of newgeom:newgeom.git
[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_HeaderFile
6 #define SketchPlugin_Circle_HeaderFile
7
8 #include "SketchPlugin.h"
9 #include <SketchPlugin_Feature.h>
10 #include <SketchPlugin_Sketch.h>
11
12 /**\class SketchPlugin_Circle
13  * \ingroup DataModel
14  * \brief Feature for creation of the new circle in PartSet.
15  */
16 class SketchPlugin_Circle: public SketchPlugin_Feature
17 {
18 public:
19   /// Circle feature kind
20   inline static const std::string& ID()
21   {
22     static const std::string MY_CIRCLE_ID("SketchCircle");
23     return MY_CIRCLE_ID;
24   }
25
26   /// 2D point - center of the circle
27   inline static const std::string& CENTER_ID()
28   {
29     static const std::string MY_CIRCLE_CENTER_ID("CircleCenter");
30     return MY_CIRCLE_CENTER_ID;
31   }
32
33   /// Radius of the circle
34   inline static const std::string& RADIUS_ID()
35   {
36     static const std::string MY_CIRCLE_RADIUS_ID("CircleRadius");
37     return MY_CIRCLE_RADIUS_ID;
38   }
39
40   /// Returns the kind of a feature
41   SKETCHPLUGIN_EXPORT virtual const std::string& getKind() 
42   {static std::string MY_KIND = SketchPlugin_Circle::ID(); return MY_KIND;}
43
44   /// Creates a new part document if needed
45   SKETCHPLUGIN_EXPORT virtual void execute();
46
47   /// Request for initialization of data model of the feature: adding all attributes
48   SKETCHPLUGIN_EXPORT virtual void initAttributes();
49
50   /// Returns the AIS preview
51   virtual boost::shared_ptr<GeomAPI_AISObject> getAISObject(
52                                 boost::shared_ptr<GeomAPI_AISObject> thePrevious)
53   {return simpleAISObject(firstResult(), thePrevious);}
54
55   /// Adds sub-feature of the higher level feature (sub-element of the sketch)
56   /// \param theFeature sub-feature
57   SKETCHPLUGIN_EXPORT virtual const void addSub(
58     const FeaturePtr& theFeature) {};
59
60   /// Moves the feature
61   /// \param theDeltaX the delta for X coordinate is moved
62   /// \param theDeltaY the delta for Y coordinate is moved
63   SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY);
64
65   /// Return the distance between the feature and the point
66   /// \param thePoint the point
67   virtual double distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint);
68
69   /// Use plugin manager for features creation
70   SketchPlugin_Circle();
71 };
72
73 #endif