Salome HOME
Merge branch 'master' of newgeom:newgeom
[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_H_
6 #define SketchPlugin_Arc_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_Arc
14  * \ingroup DataModel
15  * \brief Feature for creation of the new arc of circle in PartSet.
16  */
17 class SketchPlugin_Arc: public SketchPlugin_Feature//, public GeomAPI_IPresentable
18 {
19 public:
20   /// Arc feature kind
21   inline static const std::string& ID()
22   {
23     static const std::string MY_SKETCH_ARC_ID("SketchArc");
24     return MY_SKETCH_ARC_ID;
25   }
26
27   /// Central 2D point of the circle which contains the arc
28   inline static const std::string& CENTER_ID()
29   {
30     static const std::string MY_CENTER_ID = "ArcCenter";
31     return MY_CENTER_ID;
32   }
33   /// Start 2D point of the arc
34   inline static const std::string& START_ID()
35   {
36     static const std::string MY_START_ID = "ArcStartPoint";
37     return MY_START_ID;
38   }
39   /// End 2D point of the arc
40   inline static const std::string& END_ID()
41   {
42     static const std::string MY_END_ID = "ArcEndPoint";
43     return MY_END_ID;
44   }
45
46   /// Returns the kind of a feature
47   SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
48   {static std::string MY_KIND = SketchPlugin_Arc::ID(); return MY_KIND;}
49
50   /// Creates an arc-shape
51   SKETCHPLUGIN_EXPORT virtual void execute();
52
53   /// Request for initialization of data model of the feature: adding all attributes
54   SKETCHPLUGIN_EXPORT virtual void initAttributes();
55
56   /// Returns the AIS preview
57   virtual boost::shared_ptr<GeomAPI_AISObject> getAISObject(
58                                 boost::shared_ptr<GeomAPI_AISObject> thePrevious)
59   {return simpleAISObject(firstResult(), thePrevious);}
60
61   /// Moves the feature
62   /// \param theDeltaX the delta for X coordinate is moved
63   /// \param theDeltaY the delta for Y coordinate is moved
64   SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY);
65
66   /// Return the distance between the feature and the point
67   /// \param thePoint the point
68   virtual double distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint);
69
70   /// Use plugin manager for features creation
71   SketchPlugin_Arc();
72 };
73
74 #endif