Salome HOME
850d17e4a23e15b13ab3f7fd82cd1b9f69bf37c6
[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_H_
6 #define SketchPlugin_Line_H_
7
8 #include "SketchPlugin.h"
9 #include <SketchPlugin_Feature.h>
10 #include <SketchPlugin_Sketch.h>
11 #include <list>
12
13 /**\class SketchPlugin_Line
14  * \ingroup DataModel
15  * \brief Feature for creation of the new part in PartSet.
16  */
17 class SketchPlugin_Line : public SketchPlugin_Feature
18 {
19  public:
20   /// Arc feature kind
21   inline static const std::string& ID()
22   {
23     static const std::string SKETCH_LINE_ID("SketchLine");
24     return SKETCH_LINE_ID;
25   }
26   /// Start 2D point of the line
27   inline static const std::string& START_ID()
28   {
29     static const std::string MY_START_ID("StartPoint");
30     return MY_START_ID;
31   }
32   /// End 2D point of the line
33   inline static const std::string& END_ID()
34   {
35     static const std::string MY_END_ID("EndPoint");
36     return MY_END_ID;
37   }
38
39   /// Returns the kind of a feature
40   SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
41   {
42     static std::string MY_KIND = SketchPlugin_Line::ID();
43     return MY_KIND;
44   }
45
46   /// Returns true is sketch element is under the rigid constraint
47   SKETCHPLUGIN_EXPORT virtual bool isFixed();
48
49   /// Creates a new part document if needed
50   SKETCHPLUGIN_EXPORT virtual void execute();
51
52   /// Request for initialization of data model of the feature: adding all attributes
53   SKETCHPLUGIN_EXPORT virtual void initAttributes();
54
55   /// Returns the AIS preview
56   SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious)
57   {
58     return simpleAISObject(firstResult(), thePrevious);
59   }
60
61   /// Moves the feature
62   /// \param theDeltaX the delta for X coordinate is moved
63   /// \param theDeltaY the delta for Y coordinate is moved
64   SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY);
65
66   /// Return the distance between the feature and the point
67   /// \param thePoint the point
68   virtual double distanceToPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
69
70   /// Called on change of any argument-attribute of this object
71   SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
72
73   /// Use plugin manager for features creation
74   SketchPlugin_Line();
75 };
76
77 #endif