SHAPER  9.12.0
SketchPlugin_EllipticArc.h
1 // Copyright (C) 2017-2023 CEA, EDF
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_EllipticArc_H_
21 #define SketchPlugin_EllipticArc_H_
22 
23 #include <SketchPlugin.h>
24 #include <SketchPlugin_SketchEntity.h>
25 
31 {
32  public:
34  inline static const std::string& ID()
35  {
36  static const std::string ID("SketchEllipticArc");
37  return ID;
38  }
39 
41  inline static const std::string& CENTER_ID()
42  {
43  static const std::string ID("ellipse_center");
44  return ID;
45  }
46 
48  inline static const std::string& START_POINT_ID()
49  {
50  static const std::string ID("start_point");
51  return ID;
52  }
54  inline static const std::string& END_POINT_ID()
55  {
56  static const std::string ID("end_point");
57  return ID;
58  }
59 
61  inline static const std::string& FIRST_FOCUS_ID()
62  {
63  static const std::string ID("ellipse_first_focus");
64  return ID;
65  }
67  inline static const std::string& SECOND_FOCUS_ID()
68  {
69  static const std::string ID("ellipse_second_focus");
70  return ID;
71  }
72 
74  inline static const std::string& MAJOR_AXIS_START_ID()
75  {
76  static const std::string ID("ellipse_major_axis_start_point");
77  return ID;
78  }
80  inline static const std::string& MAJOR_AXIS_END_ID()
81  {
82  static const std::string ID("ellipse_major_axis_end_point");
83  return ID;
84  }
85 
87  inline static const std::string& MINOR_AXIS_START_ID()
88  {
89  static const std::string ID("ellipse_minor_axis_start_point");
90  return ID;
91  }
93  inline static const std::string& MINOR_AXIS_END_ID()
94  {
95  static const std::string ID("ellipse_minor_axis_end_point");
96  return ID;
97  }
98 
100  inline static const std::string& MAJOR_RADIUS_ID()
101  {
102  static const std::string ID("ellipse_major_radius");
103  return ID;
104  }
105 
107  inline static const std::string& MINOR_RADIUS_ID()
108  {
109  static const std::string ID("ellipse_minor_radius");
110  return ID;
111  }
112 
114  inline static const std::string& REVERSED_ID()
115  {
116  static const std::string ID("reversed");
117  return ID;
118  }
119 
121  SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
122  {
123  static std::string MY_KIND = SketchPlugin_EllipticArc::ID();
124  return MY_KIND;
125  }
126 
128  SKETCHPLUGIN_EXPORT virtual bool isFixed();
129 
131  SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
132 
134  SKETCHPLUGIN_EXPORT virtual void execute();
135 
138 
139 protected:
141  virtual void initDerivedClassAttributes();
142 
143 private:
144  bool fillCharacteristicPoints();
145 
146  void createEllipticArc(SketchPlugin_Sketch* theSketch);
147 
148 private:
149  double myParamDelta;
150 };
151 
152 #endif
Feature for creation of the new elliptic arc in Sketch.
Definition: SketchPlugin_EllipticArc.h:31
SketchPlugin_EllipticArc()
Use plugin manager for features creation.
Definition: SketchPlugin_EllipticArc.cpp:46
static const std::string & MAJOR_AXIS_START_ID()
2D point - start point of major axis
Definition: SketchPlugin_EllipticArc.h:74
virtual SKETCHPLUGIN_EXPORT const std::string & getKind()
Returns the kind of a feature.
Definition: SketchPlugin_EllipticArc.h:121
static const std::string & CENTER_ID()
2D point - center of the ellipse
Definition: SketchPlugin_EllipticArc.h:41
static const std::string & REVERSED_ID()
Flag the arc is reversed.
Definition: SketchPlugin_EllipticArc.h:114
static const std::string & MINOR_AXIS_END_ID()
2D point - end point of minor axis
Definition: SketchPlugin_EllipticArc.h:93
static const std::string & START_POINT_ID()
2D point - start point of elliptic arc
Definition: SketchPlugin_EllipticArc.h:48
virtual SKETCHPLUGIN_EXPORT bool isFixed()
Returns true is sketch element is under the rigid constraint.
Definition: SketchPlugin_EllipticArc.cpp:94
static const std::string & ID()
Ellipse feature kind.
Definition: SketchPlugin_EllipticArc.h:34
static const std::string & MAJOR_AXIS_END_ID()
2D point - end point of major axis
Definition: SketchPlugin_EllipticArc.h:80
virtual void initDerivedClassAttributes()
Initializes attributes of derived class.
Definition: SketchPlugin_EllipticArc.cpp:52
virtual SKETCHPLUGIN_EXPORT void attributeChanged(const std::string &theID)
Called on change of any argument-attribute of this object.
Definition: SketchPlugin_EllipticArc.cpp:98
static const std::string & END_POINT_ID()
2D point - end point of elliptic arc
Definition: SketchPlugin_EllipticArc.h:54
static const std::string & MINOR_AXIS_START_ID()
2D point - start point of minor axis
Definition: SketchPlugin_EllipticArc.h:87
static const std::string & MINOR_RADIUS_ID()
Minor radius of the ellipse.
Definition: SketchPlugin_EllipticArc.h:107
static const std::string & SECOND_FOCUS_ID()
2D point - second focus of the ellipse
Definition: SketchPlugin_EllipticArc.h:67
static const std::string & MAJOR_RADIUS_ID()
Major radius of the ellipse.
Definition: SketchPlugin_EllipticArc.h:100
virtual SKETCHPLUGIN_EXPORT void execute()
Creates a new part document if needed.
Definition: SketchPlugin_EllipticArc.cpp:80
static const std::string & FIRST_FOCUS_ID()
2D point - focus of the ellipse
Definition: SketchPlugin_EllipticArc.h:61
Sketch Entity for creation of the new feature in PartSet.
Definition: SketchPlugin_SketchEntity.h:45
Feature for creation of the new part in PartSet.
Definition: SketchPlugin_Sketch.h:47