Salome HOME
Changes in the presentations of features
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_Line.h
1 // File:        SketchPlugin_Line.h
2 // Created:     24 Apr 2014
3 // Author:      Mikhail PONIKAROV
4
5 #ifndef SketchPlugin_Line_HeaderFile
6 #define SketchPlugin_Line_HeaderFile
7
8 #include "SketchPlugin.h"
9 #include <SketchPlugin_Feature.h>
10 #include <SketchPlugin_Sketch.h>
11 #include <list>
12
13 /// Line feature kind
14 const std::string SKETCH_LINE_KIND("SketchLine");
15
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");
20
21 /**\class SketchPlugin_Line
22  * \ingroup DataModel
23  * \brief Feature for creation of the new part in PartSet.
24  */
25 class SketchPlugin_Line: public SketchPlugin_Feature
26 {
27 public:
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;}
31
32   /// Returns to which group in the document must be added feature
33   SKETCHPLUGIN_EXPORT virtual const std::string& getGroup() 
34   {static std::string MY_GROUP = SKETCH_KIND; return MY_GROUP;}
35
36   /// Creates a new part document if needed
37   SKETCHPLUGIN_EXPORT virtual void execute();
38
39   /// Request for initialization of data model of the feature: adding all attributes
40   SKETCHPLUGIN_EXPORT virtual void initAttributes();
41
42   /// Returns the sketch preview
43   SKETCHPLUGIN_EXPORT virtual const boost::shared_ptr<GeomAPI_Shape>& preview();
44
45   /// Returns the AIS preview
46   SKETCHPLUGIN_EXPORT virtual boost::shared_ptr<GeomAPI_AISObject> getAISObject(
47                                 boost::shared_ptr<GeomAPI_AISObject> thePrevious);
48
49   /// Adds sub-feature of the higher level feature (sub-element of the sketch)
50   /// \param theFeature sub-feature
51   SKETCHPLUGIN_EXPORT virtual const void addSub(
52     const FeaturePtr& theFeature) {};
53
54   /// Moves the feature
55   /// \param theDeltaX the delta for X coordinate is moved
56   /// \param theDeltaY the delta for Y coordinate is moved
57   SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY);
58
59   /// Return the distance between the feature and the point
60   /// \param thePoint the point
61   virtual double distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint);
62
63   /// Use plugin manager for features creation
64   SketchPlugin_Line();
65 };
66
67 #endif