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"
11 #include <SketchPlugin_SketchEntity.h>
12 #include <SketchPlugin_Sketch.h>
13 #include <GeomAPI_IPresentable.h>
15 /**\class SketchPlugin_MacroArc
17 * \brief Feature for creation of the new arc of circle in PartSet.
18 * The visualization of this object is separated in two parts. The first one is an AIS object
19 * calculated when there is non-initialized attributes of the arc. The second is a result and
20 * it is calculated if all attributes are initialized.
22 class SketchPlugin_MacroArc: public SketchPlugin_SketchEntity,
23 public GeomAPI_IPresentable
27 inline static const std::string& ID()
29 static const std::string ID("SketchMacroArc");
33 inline static const std::string& ARC_TYPE()
35 static const std::string ID("arc_type");
39 static const std::string& ARC_TYPE_BY_CENTER_AND_POINTS()
41 static const std::string ID("by_center_and_points");
44 static const std::string& ARC_TYPE_BY_THREE_POINTS()
46 static const std::string ID("by_three_points");
50 inline static const std::string& ARC_TYPE_BY_TANGENT_EDGE()
52 static const std::string ID("by_tangent_edge");
56 /// Central 2D point of the circle which contains the arc
57 inline static const std::string& CENTER_POINT_ID()
59 static const std::string ID = "center_point";
63 inline static const std::string& CENTER_POINT_REF_ID()
65 static const std::string ID = "center_point_ref";
69 /// Start 2D point of the arc
70 inline static const std::string& START_POINT_1_ID()
72 static const std::string ID = "start_point_1";
76 /// Start 2D point of the arc
77 inline static const std::string& START_POINT_2_ID()
79 static const std::string ID = "start_point_2";
83 inline static const std::string& START_POINT_REF_ID()
85 static const std::string ID = "start_point_ref";
89 /// End 2D point of the arc
90 inline static const std::string& END_POINT_1_ID()
92 static const std::string ID = "end_point_1";
96 /// End 2D point of the arc
97 inline static const std::string& END_POINT_2_ID()
99 static const std::string ID = "end_point_2";
103 /// End 2D point of the arc
104 inline static const std::string& END_POINT_3_ID()
106 static const std::string ID = "end_point_3";
110 inline static const std::string& END_POINT_REF_ID()
112 static const std::string ID = "end_point_ref";
116 /// Passed point of the arc.
117 static const std::string& PASSED_POINT_ID()
119 static const std::string ID("passed_point");
123 static const std::string& PASSED_POINT_REF_ID()
125 static const std::string ID("passed_point_ref");
129 static const std::string& TANGENT_POINT_ID()
131 static const std::string ID("tangent_point");
136 static const std::string& RADIUS_ID()
138 static const std::string ID("radius");
143 static const std::string& ANGLE_ID()
145 static const std::string ID("angle");
149 /// Returns the kind of a feature
150 SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
152 static std::string MY_KIND = SketchPlugin_MacroArc::ID();
156 /// \brief Request for initialization of data model of the feature: adding all attributes.
157 SKETCHPLUGIN_EXPORT virtual void initAttributes();
159 /// Called on change of any argument-attribute of this object
160 /// \param theID identifier of changed attribute
161 SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
163 /// Returns the AIS preview
164 virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
166 /// Creates an arc-shape
167 SKETCHPLUGIN_EXPORT virtual void execute();
169 /// Moves the feature
170 /// \param theDeltaX the delta for X coordinate is moved
171 /// \param theDeltaY the delta for Y coordinate is moved
172 SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY)
176 /// Reimplemented from ModelAPI_Feature::isMacro().
177 SKETCHPLUGIN_EXPORT virtual bool isMacro() const {return true;};
179 SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const {return false;};
181 /// Use plugin manager for features creation.
182 SketchPlugin_MacroArc();
185 std::shared_ptr<GeomAPI_Pnt2d> myCenter;
186 std::shared_ptr<GeomAPI_Pnt2d> myStart;
187 std::shared_ptr<GeomAPI_Pnt2d> myEnd;
189 /// To define in which direction draw arc.
191 double myParamBefore;