Salome HOME
Dimensions move using ModelAPI_ObjectMovedMessage mechanism. Move by deltas is obsole...
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_Arc.h
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #ifndef SketchPlugin_Arc_H_
22 #define SketchPlugin_Arc_H_
23
24 #include "SketchPlugin.h"
25
26 #include "SketchPlugin_SketchEntity.h"
27
28
29
30 /**\class SketchPlugin_Arc
31  * \ingroup Plugins
32  * \brief Feature for creation of the new arc of circle in PartSet.
33  * The visualization of this object is separated in two parts. The first one is an AIS object
34  * calculated when there is non-initialized attributes of the arc. The second is a result and
35  * it is calculated if all attributes are initialized.
36  */
37 class SketchPlugin_Arc: public SketchPlugin_SketchEntity
38 {
39  public:
40   /// Arc feature kind
41   inline static const std::string& ID()
42   {
43     static const std::string ID("SketchArc");
44     return ID;
45   }
46
47   /// Central 2D point of the circle which contains the arc
48   inline static const std::string& CENTER_ID()
49   {
50     static const std::string ID = "center_point";
51     return ID;
52   }
53
54   /// Start 2D point of the arc
55   inline static const std::string& START_ID()
56   {
57     static const std::string ID = "start_point";
58     return ID;
59   }
60
61   /// End 2D point of the arc
62   inline static const std::string& END_ID()
63   {
64     static const std::string ID = "end_point";
65     return ID;
66   }
67
68   /// Arc radius.
69   static const std::string& RADIUS_ID()
70   {
71     static const std::string ID("radius");
72     return ID;
73   }
74
75   /// Arc angle.
76   static const std::string& ANGLE_ID()
77   {
78     static const std::string ID("angle");
79     return ID;
80   }
81
82   /// Reversed flag
83   inline static const std::string& REVERSED_ID()
84   {
85     static const std::string ID("reversed");
86     return ID;
87   }
88
89   /// Returns the kind of a feature
90   SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
91   {
92     static std::string MY_KIND = SketchPlugin_Arc::ID();
93     return MY_KIND;
94   }
95
96   /// Returns true is sketch element is under the rigid constraint
97   SKETCHPLUGIN_EXPORT virtual bool isFixed();
98
99   /// Called on change of any argument-attribute of this object
100   /// \param theID identifier of changed attribute
101   SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
102
103   /// Creates an arc-shape
104   SKETCHPLUGIN_EXPORT virtual void execute();
105
106   /// Updates the "reversed" flag
107   /// \param isReversed  whether the arc will be reversed
108   void setReversed(bool isReversed);
109
110   /// Returns \c true is the arc is reversed
111   bool isReversed();
112
113   /// Use plugin manager for features creation
114   SketchPlugin_Arc();
115
116 protected:
117   /// \brief Initializes attributes of derived class.
118   virtual void initDerivedClassAttributes();
119
120 private:
121   /// to define in which direction draw arc
122   double myParamBefore;
123 };
124
125 #endif