1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: SketchPlugin_MacroCircle.h
4 // Created: 26 May 2014
5 // Author: Artem ZHIDKOV
7 #ifndef SketchPlugin_MacroCircle_H_
8 #define SketchPlugin_MacroCircle_H_
10 #include "SketchPlugin.h"
12 #include "SketchPlugin_Sketch.h"
13 #include "SketchPlugin_SketchEntity.h"
15 #include <GeomAPI_IPresentable.h>
16 #include <GeomAPI_Pnt2d.h>
18 /**\class SketchPlugin_MacroCircle
20 * \brief Feature for creation of the new circle in Sketch.
22 class SketchPlugin_MacroCircle: public SketchPlugin_SketchEntity,
23 public GeomAPI_IPresentable
26 /// Circle feature kind
27 inline static const std::string& ID()
29 static const std::string ID("SketchMacroCircle");
33 inline static const std::string& CIRCLE_TYPE()
35 static const std::string ID("circle_type");
39 /// Creation method by center and passed point.
40 inline static const std::string& CIRCLE_TYPE_BY_CENTER_AND_PASSED_POINTS()
42 static const std::string ID("circle_type_by_center_and_passed_points");
46 /// Creation method by three points.
47 inline static const std::string& CIRCLE_TYPE_BY_THREE_POINTS()
49 static const std::string ID("circle_type_by_three_points");
53 /// 2D point - center of the circle.
54 inline static const std::string& CENTER_POINT_ID()
56 static const std::string ID("center_point");
60 /// Reference for center point selection.
61 inline static const std::string& CENTER_POINT_REF_ID()
63 static const std::string ID("center_point_ref");
67 /// 2D point - passed point of the circle
68 inline static const std::string& PASSED_POINT_ID()
70 static const std::string ID("passed_point");
74 /// Reference for passed point selection.
75 inline static const std::string& PASSED_POINT_REF_ID()
77 static const std::string ID("passed_point_ref");
82 inline static const std::string& FIRST_POINT_ID()
84 static const std::string ID("first_point");
89 inline static const std::string& SECOND_POINT_ID()
91 static const std::string ID("second_point");
96 inline static const std::string& THIRD_POINT_ID()
98 static const std::string ID("third_point");
102 /// Radius of the circle
103 inline static const std::string& CIRCLE_RADIUS_ID()
105 static const std::string ID("circle_radius");
109 /// Returns the kind of a feature
110 SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
112 static std::string MY_KIND = SketchPlugin_MacroCircle::ID();
116 /// \brief Request for initialization of data model of the feature: adding all attributes.
117 SKETCHPLUGIN_EXPORT virtual void initAttributes();
119 /// Called on change of any argument-attribute of this object
120 SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
122 /// Returns the AIS preview
123 virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
125 /// Creates a new part document if needed
126 SKETCHPLUGIN_EXPORT virtual void execute();
128 /// Moves the feature
129 /// \param theDeltaX the delta for X coordinate is moved
130 /// \param theDeltaY the delta for Y coordinate is moved
131 SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY)
134 /// Reimplemented from ModelAPI_Feature::isMacro().
136 SKETCHPLUGIN_EXPORT virtual bool isMacro() const {return true;};
138 SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const {return false;};
140 /// Use plugin manager for features creation
141 SketchPlugin_MacroCircle();
144 void resetAttribute(const std::string& theId);
147 std::shared_ptr<GeomAPI_Pnt2d> myCenter;