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