1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: SketchPlugin_MacroArc.h
4 // Created: 26 May 2014
5 // Author: Artem ZHIDKOV
7 #ifndef SketchPlugin_MacroArc_H_
8 #define SketchPlugin_MacroArc_H_
10 #include "SketchPlugin.h"
12 #include "SketchPlugin_SketchEntity.h"
14 #include <GeomAPI_IPresentable.h>
18 /**\class SketchPlugin_MacroArc
20 * \brief Feature for creation of the new arc of circle in PartSet.
21 * The visualization of this object is separated in two parts. The first one is an AIS object
22 * calculated when there is non-initialized attributes of the arc. The second is a result and
23 * it is calculated if all attributes are initialized.
25 class SketchPlugin_MacroArc: public SketchPlugin_SketchEntity,
26 public GeomAPI_IPresentable
30 inline static const std::string& ID()
32 static const std::string ID("SketchMacroArc");
36 inline static const std::string& ARC_TYPE()
38 static const std::string ID("arc_type");
42 static const std::string& ARC_TYPE_BY_CENTER_AND_POINTS()
44 static const std::string ID("by_center_and_points");
47 static const std::string& ARC_TYPE_BY_THREE_POINTS()
49 static const std::string ID("by_three_points");
53 inline static const std::string& ARC_TYPE_BY_TANGENT_EDGE()
55 static const std::string ID("by_tangent_edge");
59 /// Central 2D point of the circle which contains the arc
60 inline static const std::string& CENTER_POINT_ID()
62 static const std::string ID = "center_point";
66 inline static const std::string& CENTER_POINT_REF_ID()
68 static const std::string ID = "center_point_ref";
72 /// Start 2D point of the arc
73 inline static const std::string& START_POINT_1_ID()
75 static const std::string ID = "start_point_1";
79 /// Start 2D point of the arc
80 inline static const std::string& START_POINT_2_ID()
82 static const std::string ID = "start_point_2";
86 inline static const std::string& START_POINT_REF_ID()
88 static const std::string ID = "start_point_ref";
92 /// End 2D point of the arc
93 inline static const std::string& END_POINT_1_ID()
95 static const std::string ID = "end_point_1";
99 /// End 2D point of the arc
100 inline static const std::string& END_POINT_2_ID()
102 static const std::string ID = "end_point_2";
106 /// End 2D point of the arc
107 inline static const std::string& END_POINT_3_ID()
109 static const std::string ID = "end_point_3";
113 inline static const std::string& END_POINT_REF_ID()
115 static const std::string ID = "end_point_ref";
119 /// Passed point of the arc.
120 static const std::string& PASSED_POINT_ID()
122 static const std::string ID("passed_point");
126 static const std::string& PASSED_POINT_REF_ID()
128 static const std::string ID("passed_point_ref");
132 static const std::string& TANGENT_POINT_ID()
134 static const std::string ID("tangent_point");
139 inline static const std::string& REVERSED_ID()
141 static const std::string ID("reversed");
146 static const std::string& RADIUS_ID()
148 static const std::string ID("radius");
153 static const std::string& ANGLE_ID()
155 static const std::string ID("angle");
159 /// Returns the kind of a feature
160 SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
162 static std::string MY_KIND = SketchPlugin_MacroArc::ID();
166 /// \brief Request for initialization of data model of the feature: adding all attributes.
167 SKETCHPLUGIN_EXPORT virtual void initAttributes();
169 /// Called on change of any argument-attribute of this object
170 /// \param theID identifier of changed attribute
171 SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
173 /// Returns the AIS preview
174 virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
176 /// Creates an arc-shape
177 SKETCHPLUGIN_EXPORT virtual void execute();
179 /// Moves the feature
180 /// \param theDeltaX the delta for X coordinate is moved
181 /// \param theDeltaY the delta for Y coordinate is moved
182 SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY)
186 /// Reimplemented from ModelAPI_Feature::isMacro().
187 SKETCHPLUGIN_EXPORT virtual bool isMacro() const {return true;};
189 SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const {return false;};
191 /// Use plugin manager for features creation.
192 SketchPlugin_MacroArc();
195 std::shared_ptr<GeomAPI_Pnt2d> myCenter;
196 std::shared_ptr<GeomAPI_Pnt2d> myStart;
197 std::shared_ptr<GeomAPI_Pnt2d> myEnd;
199 /// To define in which direction draw arc.
200 double myParamBefore;