1 // Copyright (C) 2017-20xx CEA/DEN, EDF R&D -->
3 // File: SketchPlugin_MacroEllipse.h
4 // Created: 26 April 2017
5 // Author: Artem ZHIDKOV
7 #ifndef SketchPlugin_MacroEllipse_H_
8 #define SketchPlugin_MacroEllipse_H_
10 #include <ModelAPI_IReentrant.h>
11 #include <SketchPlugin.h>
12 #include <SketchPlugin_SketchEntity.h>
13 #include <GeomAPI_IPresentable.h>
15 ////class GeomAPI_Circ2d;
18 /**\class SketchPlugin_MacroEllipse
20 * \brief Feature for creation of the new ellipse in Sketch.
22 class SketchPlugin_MacroEllipse: public SketchPlugin_SketchEntity,
23 public GeomAPI_IPresentable,
24 public ModelAPI_IReentrant
27 /// Ellipse feature kind
28 inline static const std::string& ID()
30 static const std::string ID("SketchMacroEllipse");
34 /// 2D point - center of the ellipse.
35 inline static const std::string& CENTER_POINT_ID()
37 static const std::string ID("center_point");
41 /// Reference for center point selection.
42 inline static const std::string& CENTER_POINT_REF_ID()
44 static const std::string ID("center_point_ref");
48 /// 2D point - major axis point of the ellipse.
49 inline static const std::string& MAJOR_AXIS_POINT_ID()
51 static const std::string ID("major_axis_point");
55 /// Reference for major axis point selection.
56 inline static const std::string& MAJOR_AXIS_POINT_REF_ID()
58 static const std::string ID("major_axis_point_ref");
62 /// 2D point - passed point of the ellipse
63 inline static const std::string& PASSED_POINT_ID()
65 static const std::string ID("passed_point");
69 /// Reference for passed point selection.
70 inline static const std::string& PASSED_POINT_REF_ID()
72 static const std::string ID("passed_point_ref");
76 /// Major radius of the ellipse
77 inline static const std::string& MAJOR_RADIUS_ID()
79 static const std::string ID("ellipse_major_radius");
83 /// Minor radius of the ellipse
84 inline static const std::string& MINOR_RADIUS_ID()
86 static const std::string ID("ellipse_minor_radius");
90 /// Returns the kind of a feature
91 SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
93 static std::string MY_KIND = SketchPlugin_MacroEllipse::ID();
97 /// \brief Request for initialization of data model of the feature: adding all attributes.
98 SKETCHPLUGIN_EXPORT virtual void initAttributes();
100 /// Called on change of any argument-attribute of this object
101 SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
103 /// Returns the AIS preview
104 virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
106 /// Creates a new part document if needed
107 SKETCHPLUGIN_EXPORT virtual void execute();
109 /// Moves the feature
110 /// \param theDeltaX the delta for X coordinate is moved
111 /// \param theDeltaY the delta for Y coordinate is moved
112 SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY)
115 /// Reimplemented from ModelAPI_Feature::isMacro().
117 SKETCHPLUGIN_EXPORT virtual bool isMacro() const
120 SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const
123 /// Apply information of the message to current object. It fills reference object,
124 /// tangent type and tangent point refence in case of tangent arc
125 virtual std::string processEvent(const std::shared_ptr<Events_Message>& theMessage);
127 /// Use plugin manager for features creation
128 SketchPlugin_MacroEllipse();
131 void constraintsForEllipse(FeaturePtr theEllipseFeature);
133 FeaturePtr createEllipseFeature();
136 std::shared_ptr<GeomAPI_Pnt2d> myCenter;
137 std::shared_ptr<GeomAPI_Pnt2d> myFocus;
138 double myMajorRadius;
139 double myMinorRadius;