Salome HOME
Boost has been removed from code
[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  * The visualization of this object is separated in two parts. The first one is an AIS object
17  * calculated when there is non-initialized attributes of the arc. The second is a result and
18  * it is calculated if all attributes are initialized.
19  */
20 class SketchPlugin_Arc : public SketchPlugin_Feature, public GeomAPI_IPresentable
21 {
22  public:
23   /// Arc feature kind
24   inline static const std::string& ID()
25   {
26     static const std::string MY_SKETCH_ARC_ID("SketchArc");
27     return MY_SKETCH_ARC_ID;
28   }
29
30   /// Central 2D point of the circle which contains the arc
31   inline static const std::string& CENTER_ID()
32   {
33     static const std::string MY_CENTER_ID = "ArcCenter";
34     return MY_CENTER_ID;
35   }
36   /// Start 2D point of the arc
37   inline static const std::string& START_ID()
38   {
39     static const std::string MY_START_ID = "ArcStartPoint";
40     return MY_START_ID;
41   }
42   /// End 2D point of the arc
43   inline static const std::string& END_ID()
44   {
45     static const std::string MY_END_ID = "ArcEndPoint";
46     return MY_END_ID;
47   }
48
49   /// Returns the kind of a feature
50   SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
51   {
52     static std::string MY_KIND = SketchPlugin_Arc::ID();
53     return MY_KIND;
54   }
55
56   /// Returns true is sketch element is under the rigid constraint
57   SKETCHPLUGIN_EXPORT virtual bool isFixed();
58
59   /// Creates an arc-shape
60   SKETCHPLUGIN_EXPORT virtual void execute();
61
62   /// Request for initialization of data model of the feature: adding all attributes
63   SKETCHPLUGIN_EXPORT virtual void initAttributes();
64
65   /// Returns the AIS preview
66   virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
67
68   /// Moves the feature
69   /// \param theDeltaX the delta for X coordinate is moved
70   /// \param theDeltaY the delta for Y coordinate is moved
71   SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY);
72
73   /// Return the distance between the feature and the point
74   /// \param thePoint the point
75   virtual double distanceToPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
76
77   /// Use plugin manager for features creation
78   SketchPlugin_Arc();
79
80 private:
81   /// Returns true if all obligatory attributes are initialized
82   bool isFeatureValid();
83 };
84
85 #endif