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_MacroEllipse_H_
21 #define SketchAPI_MacroEllipse_H_
23 #include "SketchAPI.h"
24 #include "SketchAPI_SketchEntity.h"
26 #include <SketchPlugin_MacroEllipse.h>
28 class ModelHighAPI_RefAttr;
30 /// \class SketchAPI_MacroEllipse
31 /// \ingroup CPPHighAPI
32 /// \brief Interface for Ellipse feature.
33 class SketchAPI_MacroEllipse: public SketchAPI_SketchEntity
36 /// Constructor without values.
38 explicit SketchAPI_MacroEllipse(const std::shared_ptr<ModelAPI_Feature>& theFeature);
40 /// Constructor with values.
42 SketchAPI_MacroEllipse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
43 double theX1, double theY1,
44 double theX2, double theY2,
45 double theX3, double theY3,
46 bool byCenter = true);
48 /// Constructor with values.
50 SketchAPI_MacroEllipse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
51 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
52 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
53 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3,
54 bool byCenter = true);
56 /// Constructor with values and/or references.
58 SketchAPI_MacroEllipse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
59 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
60 const ModelHighAPI_RefAttr& thePoint1Ref,
61 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
62 const ModelHighAPI_RefAttr& thePoint2Ref,
63 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3,
64 const ModelHighAPI_RefAttr& thePoint3Ref,
65 bool byCenter = true);
69 virtual ~SketchAPI_MacroEllipse();
71 INTERFACE_9(SketchPlugin_MacroEllipse::ID(),
72 ellipseType, SketchPlugin_MacroEllipse::ELLIPSE_TYPE(),
73 ModelAPI_AttributeString, /** Ellipse type */,
74 centerPoint, SketchPlugin_MacroEllipse::FIRST_POINT_ID(),
75 GeomDataAPI_Point2D, /** Center point */,
76 centerPointRef, SketchPlugin_MacroEllipse::FIRST_POINT_REF_ID(),
77 ModelAPI_AttributeRefAttr, /** Reference to a center point */,
78 majorAxisNegativePoint, SketchPlugin_MacroEllipse::FIRST_POINT_ID(),
79 GeomDataAPI_Point2D, /** Major axis negative point point */,
80 majorAxisNegativePointRef, SketchPlugin_MacroEllipse::FIRST_POINT_REF_ID(),
81 ModelAPI_AttributeRefAttr, /** Reference to the negative point on a major axis */,
82 majorAxisPositivePoint, SketchPlugin_MacroEllipse::SECOND_POINT_ID(),
83 GeomDataAPI_Point2D, /** Major axis positive point point */,
84 majorAxisPositivePointRef, SketchPlugin_MacroEllipse::SECOND_POINT_REF_ID(),
85 ModelAPI_AttributeRefAttr, /** Reference to the positive point on a major axis */,
86 passedPoint, SketchPlugin_MacroEllipse::PASSED_POINT_ID(),
87 GeomDataAPI_Point2D, /** Passed point */,
88 passedPointRef, SketchPlugin_MacroEllipse::PASSED_POINT_REF_ID(),
89 ModelAPI_AttributeRefAttr, /** Reference to a passed point */)
92 /// Set flag of creation by center, major semi-axis and passed point.
93 void setByCenterAndPassedPoints();
94 /// Set flag of creation by major axis and passed point.
95 void setByMajorAxisAndPassedPoint();
97 /// Set points of ellipse.
98 void initializePoints(double theMajorAxisX1, double theMajorAxisY1,
99 double theMajorAxisX2, double theMajorAxisY2,
100 double thePassedX, double thePassedY);
102 /// Set points of ellipse.
103 void initializePoints(const std::shared_ptr<GeomAPI_Pnt2d>& theMajorAxisPoint1,
104 const std::shared_ptr<GeomAPI_Pnt2d>& theMajorAxisPoint2,
105 const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint);
107 /// Set points of ellipse.
108 void initializePoints(const std::shared_ptr<GeomAPI_Pnt2d>& theMajorAxisPoint1,
109 const ModelHighAPI_RefAttr& theMajorAxisPoint1Ref,
110 const std::shared_ptr<GeomAPI_Pnt2d>& theMajorAxisPoint2,
111 const ModelHighAPI_RefAttr& theMajorAxisPoint2Ref,
112 const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint,
113 const ModelHighAPI_RefAttr& thePassedPointRef);
116 /// Pointer on Circle object.
117 typedef std::shared_ptr<SketchAPI_MacroEllipse> MacroEllipsePtr;
119 #endif // SketchAPI_MacroEllipse_H_