Salome HOME
e8c0252bdc623132a9a77246e12431636b670a7f
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_Ellipse.h
1 // Copyright (C) 2017-2019  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 // File:        SketchPlugin_Ellipse.h
21 // Created:     26 April 2017
22 // Author:      Artem ZHIDKOV
23
24 #ifndef SketchPlugin_Ellipse_H_
25 #define SketchPlugin_Ellipse_H_
26
27 #include <SketchPlugin.h>
28 #include <SketchPlugin_SketchEntity.h>
29
30 /**\class SketchPlugin_Ellipse
31  * \ingroup Plugins
32  * \brief Feature for creation of the new ellipse in Sketch.
33  */
34 class SketchPlugin_Ellipse: public SketchPlugin_SketchEntity
35 {
36  public:
37   /// Ellipse feature kind
38   inline static const std::string& ID()
39   {
40     static const std::string ID("SketchEllipse");
41     return ID;
42   }
43
44   /// 2D point - center of the ellipse
45   inline static const std::string& CENTER_ID()
46   {
47     static const std::string ID("ellipse_center");
48     return ID;
49   }
50
51   /// 2D point - focus of the ellipse
52   inline static const std::string& FOCUS_ID()
53   {
54     static const std::string ID("ellipse_focus");
55     return ID;
56   }
57
58   /// Major radius of the ellipse
59   inline static const std::string& MAJOR_RADIUS_ID()
60   {
61     static const std::string ID("ellipse_major_radius");
62     return ID;
63   }
64
65   /// Minor radius of the ellipse
66   inline static const std::string& MINOR_RADIUS_ID()
67   {
68     static const std::string ID("ellipse_minor_radius");
69     return ID;
70   }
71
72   /// Returns the kind of a feature
73   SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
74   {
75     static std::string MY_KIND = SketchPlugin_Ellipse::ID();
76     return MY_KIND;
77   }
78
79   /// Returns true is sketch element is under the rigid constraint
80   SKETCHPLUGIN_EXPORT virtual bool isFixed();
81
82   /// Called on change of any argument-attribute of this object
83   SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
84
85   /// Creates a new part document if needed
86   SKETCHPLUGIN_EXPORT virtual void execute();
87
88   /// Use plugin manager for features creation
89   SketchPlugin_Ellipse();
90
91 protected:
92   /// \brief Initializes attributes of derived class.
93   virtual void initDerivedClassAttributes();
94 };
95
96 #endif