Salome HOME
Merge remote-tracking branch 'remotes/origin/EDF_2020_Lot2'
[modules/shaper.git] / src / SketchAPI / SketchAPI_EllipticArc.h
1 // Copyright (C) 2014-2020  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 SketchAPI_EllipticArc_H_
21 #define SketchAPI_EllipticArc_H_
22
23 #include "SketchAPI.h"
24 #include "SketchAPI_SketchEntity.h"
25
26 #include <SketchPlugin_EllipticArc.h>
27
28 class ModelHighAPI_Selection;
29
30 /// \class SketchAPI_EllipticArc
31 /// \ingroup CPPHighAPI
32 /// \brief Interface for Elliptic Arc feature.
33 class SketchAPI_EllipticArc : public SketchAPI_SketchEntity
34 {
35 public:
36   /// Constructor without values.
37   SKETCHAPI_EXPORT
38   explicit SketchAPI_EllipticArc(const std::shared_ptr<ModelAPI_Feature>& theFeature);
39
40   /// Constructor with values.
41   SKETCHAPI_EXPORT
42   SketchAPI_EllipticArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
43                         double theCenterX, double theCenterY,
44                         double theFocusX, double theFocusY,
45                         double theStartX, double theStartY,
46                         double theEndX, double theEndY,
47                         bool theInversed);
48
49   /// Constructor with values.
50   SKETCHAPI_EXPORT
51   SketchAPI_EllipticArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
52                         const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
53                         const std::shared_ptr<GeomAPI_Pnt2d>& theFocus,
54                         const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
55                         const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
56                         bool theInversed);
57
58   /// Constructor with external.
59   SKETCHAPI_EXPORT
60   SketchAPI_EllipticArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
61                         const ModelHighAPI_Selection& theExternal);
62
63   /// Constructor with external.
64   SKETCHAPI_EXPORT
65   SketchAPI_EllipticArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
66                         const std::wstring& theExternalName);
67
68   /// Destructor.
69   SKETCHAPI_EXPORT
70   virtual ~SketchAPI_EllipticArc();
71
72   INTERFACE_13(SketchPlugin_EllipticArc::ID(),
73                center, SketchPlugin_EllipticArc::CENTER_ID(),
74                GeomDataAPI_Point2D, /** Center point */,
75                startPoint, SketchPlugin_EllipticArc::START_POINT_ID(),
76                GeomDataAPI_Point2D, /** Start point of elliptic arc */,
77                endPoint, SketchPlugin_EllipticArc::END_POINT_ID(),
78                GeomDataAPI_Point2D, /** End point of elliptic arc */,
79                reversed, SketchPlugin_EllipticArc::REVERSED_ID(),
80                ModelAPI_AttributeBoolean, /** Inversed flag */,
81                firstFocus, SketchPlugin_EllipticArc::FIRST_FOCUS_ID(),
82                GeomDataAPI_Point2D, /** Focus in positive direction of a major axis */,
83                secondFocus, SketchPlugin_EllipticArc::SECOND_FOCUS_ID(),
84                GeomDataAPI_Point2D, /** Focus in negative direction of a major axis */,
85                majorAxisNegative, SketchPlugin_EllipticArc::MAJOR_AXIS_START_ID(),
86                GeomDataAPI_Point2D, /** Start point of major axis */,
87                majorAxisPositive, SketchPlugin_EllipticArc::MAJOR_AXIS_END_ID(),
88                GeomDataAPI_Point2D, /** End point of major axis */,
89                minorAxisNegative, SketchPlugin_EllipticArc::MINOR_AXIS_START_ID(),
90                GeomDataAPI_Point2D, /** Start point of minor axis */,
91                minorAxisPositive, SketchPlugin_EllipticArc::MINOR_AXIS_END_ID(),
92                GeomDataAPI_Point2D, /** End point of minor axis */,
93                majorRadius, SketchPlugin_EllipticArc::MAJOR_RADIUS_ID(),
94                ModelAPI_AttributeDouble, /** Major radius */,
95                minorRadius, SketchPlugin_EllipticArc::MINOR_RADIUS_ID(),
96                ModelAPI_AttributeDouble, /** Minor radius */,
97                external, SketchPlugin_EllipticArc::EXTERNAL_ID(),
98                ModelAPI_AttributeSelection, /** External */)
99
100   /// Set by center, focus and radius.
101   SKETCHAPI_EXPORT
102   void setByCenterFocusAndPoints(double theCenterX, double theCenterY,
103                                  double theFocusX, double theFocusY,
104                                  double theStartX, double theStartY,
105                                  double theEndX, double theEndY,
106                                  bool theInversed);
107
108   /// Set by center, focus and radius.
109   SKETCHAPI_EXPORT
110   void setByCenterFocusAndPoints(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
111                                  const std::shared_ptr<GeomAPI_Pnt2d>& theFocus,
112                                  const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
113                                  const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
114                                  bool theInversed);
115
116   /// Set by external.
117   SKETCHAPI_EXPORT
118   void setByExternal(const ModelHighAPI_Selection& theExternal);
119
120   /// Set by external name.
121   SKETCHAPI_EXPORT
122   void setByExternalName(const std::wstring& theExternalName);
123
124   /// Set center.
125   SKETCHAPI_EXPORT
126   void setCenter(double theX, double theY);
127
128   /// Set center.
129   SKETCHAPI_EXPORT
130   void setCenter(const std::shared_ptr<GeomAPI_Pnt2d> & theCenter);
131
132   /// Set focus.
133   SKETCHAPI_EXPORT
134   void setFocus(double theX, double theY);
135
136   /// Set focus.
137   SKETCHAPI_EXPORT
138   void setFocus(const std::shared_ptr<GeomAPI_Pnt2d> & theFocus);
139
140   /// Create construction elements (focuses, axes etc.).
141   /// Empty value for each parameter shows that the corresponding feature has been removed.
142   /// Value "aux" marks this feature as auxiliary.
143   /// And the name of the feature shows that it is a regular feature.
144   SKETCHAPI_EXPORT
145   std::list<std::shared_ptr<SketchAPI_SketchEntity> > construction(
146       const std::wstring& center = std::wstring(),
147       const std::wstring& firstFocus = std::wstring(),
148       const std::wstring& secondFocus = std::wstring(),
149       const std::wstring& majorAxisStart = std::wstring(),
150       const std::wstring& majorAxisEnd = std::wstring(),
151       const std::wstring& minorAxisStart = std::wstring(),
152       const std::wstring& minorAxisEnd = std::wstring(),
153       const std::wstring& majorAxis = std::wstring(),
154       const std::wstring& minorAxis = std::wstring()) const;
155
156   /// Dump wrapped feature
157   SKETCHAPI_EXPORT
158   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
159 };
160
161 /// Pointer on Ellipse object.
162 typedef std::shared_ptr<SketchAPI_EllipticArc> EllipticArcPtr;
163
164 #endif // SketchAPI_EllipticArc_H_