Salome HOME
Refactoring: static constants are replaced by inline functions in:
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_Arc.h
1 // File:        SketchPlugin_Arc.h
2 // Created:     26 May 2014
3 // Author:      Artem ZHIDKOV
4
5 #ifndef SketchPlugin_Arc_HeaderFile
6 #define SketchPlugin_Arc_HeaderFile
7
8 #include "SketchPlugin.h"
9 #include <SketchPlugin_Feature.h>
10 #include <SketchPlugin_Sketch.h>
11
12 /**\class SketchPlugin_Arc
13  * \ingroup DataModel
14  * \brief Feature for creation of the new arc of circle in PartSet.
15  */
16 class SketchPlugin_Arc: public SketchPlugin_Feature
17 {
18 public:
19   /// Arc feature kind
20   inline static const std::string& ID()
21   {
22     static const std::string MY_SKETCH_ARC_ID("SketchArc");
23     return MY_SKETCH_ARC_ID;
24   }
25
26   /// Central 2D point of the circle which contains the arc
27   inline static const std::string& CENTER_ID()
28   {
29     static const std::string MY_CENTER_ID = "ArcCenter";
30     return MY_CENTER_ID;
31   }
32   /// Start 2D point of the arc
33   inline static const std::string& START_ID()
34   {
35     static const std::string MY_START_ID = "ArcStartPoint";
36     return MY_START_ID;
37   }
38   /// End 2D point of the arc
39   inline static const std::string& END_ID()
40   {
41     static const std::string MY_END_ID = "ArcEndPoint";
42     return MY_END_ID;
43   }
44
45   /// Returns the kind of a feature
46   SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
47   {static std::string MY_KIND = SketchPlugin_Arc::ID(); return MY_KIND;}
48
49   /// Returns to which group in the document must be added feature
50   SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
51   {static std::string MY_GROUP = SketchPlugin_Sketch::ID(); return MY_GROUP;}
52
53   /// Creates a new part document if needed
54   SKETCHPLUGIN_EXPORT virtual void execute();
55
56   /// Request for initialization of data model of the feature: adding all attributes
57   SKETCHPLUGIN_EXPORT virtual void initAttributes();
58
59   /// Returns the sketch preview
60   SKETCHPLUGIN_EXPORT virtual const boost::shared_ptr<GeomAPI_Shape>& preview();
61
62   /// Returns the AIS preview
63   SKETCHPLUGIN_EXPORT virtual boost::shared_ptr<GeomAPI_AISObject> getAISObject(
64                                 boost::shared_ptr<GeomAPI_AISObject> thePrevious);
65
66   /// Adds sub-feature of the higher level feature (sub-element of the sketch)
67   /// \param theFeature sub-feature
68   SKETCHPLUGIN_EXPORT virtual const void addSub(
69     const FeaturePtr& theFeature) {};
70
71   /// Moves the feature
72   /// \param theDeltaX the delta for X coordinate is moved
73   /// \param theDeltaY the delta for Y coordinate is moved
74   SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY);
75
76   /// Return the distance between the feature and the point
77   /// \param thePoint the point
78   virtual double distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint);
79
80   /// Use plugin manager for features creation
81   SketchPlugin_Arc();
82 };
83
84 #endif