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>
14 const std::string SKETCH_LINE_KIND("SketchLine");
16 /// Start 2D point of the line
17 const std::string LINE_ATTR_START("StartPoint");
18 /// End 2D point of the line
19 const std::string LINE_ATTR_END("EndPoint");
21 /**\class SketchPlugin_Line
23 * \brief Feature for creation of the new part in PartSet.
25 class SketchPlugin_Line: public SketchPlugin_Feature
28 /// Returns the kind of a feature
29 SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
30 {static std::string MY_KIND = SKETCH_LINE_KIND; return MY_KIND;}
32 /// Creates a new part document if needed
33 SKETCHPLUGIN_EXPORT virtual void execute(boost::shared_ptr<ModelAPI_Result>& theResult);
35 /// Request for initialization of data model of the feature: adding all attributes
36 SKETCHPLUGIN_EXPORT virtual void initAttributes();
38 /// Returns the AIS preview
39 SKETCHPLUGIN_EXPORT virtual boost::shared_ptr<GeomAPI_AISObject> getAISObject(
40 boost::shared_ptr<GeomAPI_AISObject> thePrevious);
42 /// Adds sub-feature of the higher level feature (sub-element of the sketch)
43 /// \param theFeature sub-feature
44 SKETCHPLUGIN_EXPORT virtual const void addSub(
45 const FeaturePtr& theFeature) {};
48 /// \param theDeltaX the delta for X coordinate is moved
49 /// \param theDeltaY the delta for Y coordinate is moved
50 SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY);
52 /// Return the distance between the feature and the point
53 /// \param thePoint the point
54 virtual double distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint);
56 /// Use plugin manager for features creation