Salome HOME
Merge branch 'master' into cgt/devCEA
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_Arc.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:        SketchPlugin_Arc.h
4 // Created:     26 May 2014
5 // Author:      Artem ZHIDKOV
6
7 #ifndef SketchPlugin_Arc_H_
8 #define SketchPlugin_Arc_H_
9
10 #include "SketchPlugin.h"
11
12 #include "SketchPlugin_SketchEntity.h"
13
14
15
16 /**\class SketchPlugin_Arc
17  * \ingroup Plugins
18  * \brief Feature for creation of the new arc of circle in PartSet.
19  * The visualization of this object is separated in two parts. The first one is an AIS object
20  * calculated when there is non-initialized attributes of the arc. The second is a result and
21  * it is calculated if all attributes are initialized.
22  */
23 class SketchPlugin_Arc: public SketchPlugin_SketchEntity
24 {
25  public:
26   /// Arc feature kind
27   inline static const std::string& ID()
28   {
29     static const std::string ID("SketchArc");
30     return ID;
31   }
32
33   /// Central 2D point of the circle which contains the arc
34   inline static const std::string& CENTER_ID()
35   {
36     static const std::string ID = "center_point";
37     return ID;
38   }
39
40   /// Start 2D point of the arc
41   inline static const std::string& START_ID()
42   {
43     static const std::string ID = "start_point";
44     return ID;
45   }
46
47   /// End 2D point of the arc
48   inline static const std::string& END_ID()
49   {
50     static const std::string ID = "end_point";
51     return ID;
52   }
53
54   /// Arc radius.
55   static const std::string& RADIUS_ID()
56   {
57     static const std::string ID("radius");
58     return ID;
59   }
60
61   /// Arc angle.
62   static const std::string& ANGLE_ID()
63   {
64     static const std::string ID("angle");
65     return ID;
66   }
67
68   /// Reversed flag
69   inline static const std::string& REVERSED_ID()
70   {
71     static const std::string ID("reversed");
72     return ID;
73   }
74
75   /// Returns the kind of a feature
76   SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
77   {
78     static std::string MY_KIND = SketchPlugin_Arc::ID();
79     return MY_KIND;
80   }
81
82   /// Returns true is sketch element is under the rigid constraint
83   SKETCHPLUGIN_EXPORT virtual bool isFixed();
84
85   /// Called on change of any argument-attribute of this object
86   /// \param theID identifier of changed attribute
87   SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
88
89   /// Creates an arc-shape
90   SKETCHPLUGIN_EXPORT virtual void execute();
91
92   /// Moves the feature
93   /// \param theDeltaX the delta for X coordinate is moved
94   /// \param theDeltaY the delta for Y coordinate is moved
95   SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY);
96
97   /// Updates the "reversed" flag
98   /// \param isReversed  whether the arc will be reversed
99   void setReversed(bool isReversed);
100
101   /// Returns \c true is the arc is reversed
102   bool isReversed();
103
104   /// Use plugin manager for features creation
105   SketchPlugin_Arc();
106
107 protected:
108   /// \brief Initializes attributes of derived class.
109   virtual void initDerivedClassAttributes();
110
111 private:
112   /// to define in which direction draw arc
113   double myParamBefore;
114 };
115
116 #endif