1 // Copyright (C) 2014-2019 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_Ellipse_H_
21 #define SketchAPI_Ellipse_H_
23 #include "SketchAPI.h"
24 #include "SketchAPI_SketchEntity.h"
26 #include <SketchPlugin_Ellipse.h>
28 class ModelHighAPI_Selection;
30 /// \class SketchAPI_Ellipse
31 /// \ingroup CPPHighAPI
32 /// \brief Interface for Ellipse feature.
33 class SketchAPI_Ellipse : public SketchAPI_SketchEntity
36 /// Constructor without values.
38 explicit SketchAPI_Ellipse(const std::shared_ptr<ModelAPI_Feature>& theFeature);
40 /// Constructor with values.
42 SketchAPI_Ellipse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
43 double theCenterX, double theCenterY,
44 double theFocusX, double theFocusY,
45 double theMinorRadius);
47 /// Constructor with values.
49 SketchAPI_Ellipse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
50 const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
51 const std::shared_ptr<GeomAPI_Pnt2d>& theFocus,
52 double theMinorRadius);
54 /// Constructor with external.
56 SketchAPI_Ellipse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
57 const ModelHighAPI_Selection& theExternal);
59 /// Constructor with external.
61 SketchAPI_Ellipse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
62 const std::string& theExternalName);
66 virtual ~SketchAPI_Ellipse();
68 INTERFACE_10(SketchPlugin_Ellipse::ID(),
69 center, SketchPlugin_Ellipse::CENTER_ID(),
70 GeomDataAPI_Point2D, /** Center point */,
71 firstFocus, SketchPlugin_Ellipse::FIRST_FOCUS_ID(),
72 GeomDataAPI_Point2D, /** Focus in positive direction of a major axis */,
73 secondFocus, SketchPlugin_Ellipse::SECOND_FOCUS_ID(),
74 GeomDataAPI_Point2D, /** Focus in negative direction of a major axis */,
75 majorAxisNegative, SketchPlugin_Ellipse::MAJOR_AXIS_START_ID(),
76 GeomDataAPI_Point2D, /** Start point of major axis */,
77 majorAxisPositive, SketchPlugin_Ellipse::MAJOR_AXIS_END_ID(),
78 GeomDataAPI_Point2D, /** End point of major axis */,
79 minorAxisNegative, SketchPlugin_Ellipse::MINOR_AXIS_START_ID(),
80 GeomDataAPI_Point2D, /** Start point of minor axis */,
81 minorAxisPositive, SketchPlugin_Ellipse::MINOR_AXIS_END_ID(),
82 GeomDataAPI_Point2D, /** End point of minor axis */,
83 majorRadius, SketchPlugin_Ellipse::MAJOR_RADIUS_ID(),
84 ModelAPI_AttributeDouble, /** Major radius */,
85 minorRadius, SketchPlugin_Ellipse::MINOR_RADIUS_ID(),
86 ModelAPI_AttributeDouble, /** Minor radius */,
87 external, SketchPlugin_Ellipse::EXTERNAL_ID(),
88 ModelAPI_AttributeSelection, /** External */)
90 /// Set by center, focus and radius.
92 void setByCenterFocusAndRadius(double theCenterX, double theCenterY,
93 double theFocusX, double theFocusY,
94 double theMinorRadius);
96 /// Set by center, focus and radius.
98 void setByCenterFocusAndRadius(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
99 const std::shared_ptr<GeomAPI_Pnt2d>& theFocus,
100 double theMinorRadius);
104 void setByExternal(const ModelHighAPI_Selection& theExternal);
106 /// Set by external name.
108 void setByExternalName(const std::string& theExternalName);
112 void setCenter(double theX, double theY);
116 void setCenter(const std::shared_ptr<GeomAPI_Pnt2d> & theCenter);
120 void setFocus(double theX, double theY);
124 void setFocus(const std::shared_ptr<GeomAPI_Pnt2d> & theCenter);
128 void setMinorRadius(double theRadius);
130 /// Return major axis of the ellipse
132 ModelHighAPI_Selection majorAxis() const;
134 /// Return minor axis of the ellipse
136 ModelHighAPI_Selection minorAxis() const;
138 /// Create construction elements (focuses, axes etc.).
139 /// Empty value for each parameter shows that the corresponding feature has been removed.
140 /// Value "aux" marks this feature as auxiliary.
141 /// And the name of the feature shows that it is a regular feature.
143 std::list<std::shared_ptr<SketchAPI_SketchEntity> > construction(
144 const std::string& center = std::string(),
145 const std::string& firstFocus = std::string(),
146 const std::string& secondFocus = std::string(),
147 const std::string& majorAxisStart = std::string(),
148 const std::string& majorAxisEnd = std::string(),
149 const std::string& minorAxisStart = std::string(),
150 const std::string& minorAxisEnd = std::string(),
151 const std::string& majorAxis = std::string(),
152 const std::string& minorAxis = std::string()) const;
154 /// Dump wrapped feature
156 virtual void dump(ModelHighAPI_Dumper& theDumper) const;
159 /// Pointer on Ellipse object.
160 typedef std::shared_ptr<SketchAPI_Ellipse> EllipsePtr;
162 #endif // SketchPlugin_Ellipse_H_