1 // Copyright (C) 2014-2020 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef SketchAPI_EllipticArc_H_
21 #define SketchAPI_EllipticArc_H_
23 #include "SketchAPI.h"
24 #include "SketchAPI_SketchEntity.h"
26 #include <SketchPlugin_EllipticArc.h>
28 class ModelHighAPI_Selection;
30 /// \class SketchAPI_EllipticArc
31 /// \ingroup CPPHighAPI
32 /// \brief Interface for Elliptic Arc feature.
33 class SketchAPI_EllipticArc : public SketchAPI_SketchEntity
36 /// Constructor without values.
38 explicit SketchAPI_EllipticArc(const std::shared_ptr<ModelAPI_Feature>& theFeature);
40 /// Constructor with values.
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,
49 /// Constructor with values.
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,
58 /// Constructor with external.
60 SketchAPI_EllipticArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
61 const ModelHighAPI_Selection& theExternal);
63 /// Constructor with external.
65 SketchAPI_EllipticArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
66 const std::wstring& theExternalName);
70 virtual ~SketchAPI_EllipticArc();
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 */)
100 /// Set by center, focus and radius.
102 void setByCenterFocusAndPoints(double theCenterX, double theCenterY,
103 double theFocusX, double theFocusY,
104 double theStartX, double theStartY,
105 double theEndX, double theEndY,
108 /// Set by center, focus and radius.
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,
118 void setByExternal(const ModelHighAPI_Selection& theExternal);
120 /// Set by external name.
122 void setByExternalName(const std::wstring& theExternalName);
126 void setCenter(double theX, double theY);
130 void setCenter(const std::shared_ptr<GeomAPI_Pnt2d> & theCenter);
134 void setFocus(double theX, double theY);
138 void setFocus(const std::shared_ptr<GeomAPI_Pnt2d> & theFocus);
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.
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;
156 /// Dump wrapped feature
158 virtual void dump(ModelHighAPI_Dumper& theDumper) const;
161 /// Pointer on Ellipse object.
162 typedef std::shared_ptr<SketchAPI_EllipticArc> EllipticArcPtr;
164 #endif // SketchAPI_EllipticArc_H_