1 // File: SketchPlugin_Line.h
2 // Created: 24 Apr 2014
3 // Author: Mikhail PONIKAROV
5 #ifndef SketchPlugin_Line_HeaderFile
6 #define SketchPlugin_Line_HeaderFile
8 #include "SketchPlugin.h"
9 #include <SketchPlugin_Feature.h>
10 #include <SketchPlugin_Sketch.h>
13 /**\class SketchPlugin_Line
15 * \brief Feature for creation of the new part in PartSet.
17 class SketchPlugin_Line: public SketchPlugin_Feature
21 inline static const std::string& ID()
23 static const std::string SKETCH_LINE_ID("SketchLine");
24 return SKETCH_LINE_ID;
26 /// Start 2D point of the line
27 inline static const std::string& START_ID()
29 static const std::string MY_START_ID("StartPoint");
32 /// End 2D point of the line
33 inline static const std::string& END_ID()
35 static const std::string MY_END_ID("EndPoint");
39 /// Returns the kind of a feature
40 SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
41 {static std::string MY_KIND = SketchPlugin_Line::ID(); return MY_KIND;}
43 /// Returns to which group in the document must be added feature
44 SKETCHPLUGIN_EXPORT virtual const std::string& getGroup()
45 {static std::string MY_GROUP = SketchPlugin_Sketch::ID(); return MY_GROUP;}
47 /// Creates a new part document if needed
48 SKETCHPLUGIN_EXPORT virtual void execute();
50 /// Request for initialization of data model of the feature: adding all attributes
51 SKETCHPLUGIN_EXPORT virtual void initAttributes();
53 /// Returns the sketch preview
54 SKETCHPLUGIN_EXPORT virtual const boost::shared_ptr<GeomAPI_Shape>& preview();
56 /// Returns the AIS preview
57 SKETCHPLUGIN_EXPORT virtual boost::shared_ptr<GeomAPI_AISObject> getAISObject(
58 boost::shared_ptr<GeomAPI_AISObject> thePrevious);
60 /// Adds sub-feature of the higher level feature (sub-element of the sketch)
61 /// \param theFeature sub-feature
62 SKETCHPLUGIN_EXPORT virtual const void addSub(
63 const FeaturePtr& theFeature) {};
66 /// \param theDeltaX the delta for X coordinate is moved
67 /// \param theDeltaY the delta for Y coordinate is moved
68 SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY);
70 /// Return the distance between the feature and the point
71 /// \param thePoint the point
72 virtual double distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint);
74 /// Use plugin manager for features creation