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