1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: SketchPlugin_Circle.h
4 // Created: 26 May 2014
5 // Author: Artem ZHIDKOV
7 #ifndef SketchPlugin_Circle_H_
8 #define SketchPlugin_Circle_H_
10 #include "SketchPlugin.h"
11 #include <SketchPlugin_SketchEntity.h>
12 #include <SketchPlugin_Sketch.h>
13 #include <GeomAPI_IPresentable.h>
15 /**\class SketchPlugin_Circle
17 * \brief Feature for creation of the new circle in PartSet.
19 class SketchPlugin_Circle : public SketchPlugin_SketchEntity, public GeomAPI_IPresentable
22 /// Circle feature kind
23 inline static const std::string& ID()
25 static const std::string MY_CIRCLE_ID("SketchCircle");
29 inline static const std::string& CIRCLE_TYPE()
31 static const std::string TYPE("CircleType");
35 /// 2D point - center of the circle
36 inline static const std::string& CENTER_ID()
38 static const std::string MY_CIRCLE_CENTER_ID("CircleCenter");
39 return MY_CIRCLE_CENTER_ID;
42 /// Radius of the circle
43 inline static const std::string& RADIUS_ID()
45 static const std::string MY_CIRCLE_RADIUS_ID("CircleRadius");
46 return MY_CIRCLE_RADIUS_ID;
49 /// Returns the kind of a feature
50 SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
52 static std::string MY_KIND = SketchPlugin_Circle::ID();
56 /// Returns true is sketch element is under the rigid constraint
57 SKETCHPLUGIN_EXPORT virtual bool isFixed();
59 /// Creates a new part document if needed
60 SKETCHPLUGIN_EXPORT virtual void execute();
62 /// Adds sub-feature of the higher level feature (sub-element of the sketch)
63 /// \param theFeature sub-feature
64 SKETCHPLUGIN_EXPORT virtual const void addSub(const FeaturePtr& theFeature)
69 /// \param theDeltaX the delta for X coordinate is moved
70 /// \param theDeltaY the delta for Y coordinate is moved
71 SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY);
73 /// Called on change of any argument-attribute of this object
74 SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
76 /// Returns the AIS preview
77 virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
79 /// Use plugin manager for features creation
80 SketchPlugin_Circle();
83 /// \brief Initializes attributes of derived class.
84 virtual void initDerivedClassAttributes();
87 /// Returns true if all obligatory attributes are initialized
88 bool isFeatureValid();
90 /// Update coordinates of representation by three points
91 void adjustThreePoints();