Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_ConstraintLength.h
1 // File:    SketchPlugin_ConstraintLength.h
2 // Created: 30 May 2014
3 // Author:  Artem ZHIDKOV
4
5 #ifndef SketchPlugin_ConstraintLength_HeaderFile
6 #define SketchPlugin_ConstraintLength_HeaderFile
7
8 #include "SketchPlugin.h"
9 #include "SketchPlugin_Constraint.h"
10 #include <SketchPlugin_Sketch.h>
11 #include <list>
12
13 /** \class SketchPlugin_ConstraintLength
14  *  \ingroup DataModel
15  *  \brief Feature for creation of a new constraint which defines a length of a line segment
16  *
17  *  These constraint has two attributes:
18  *  SketchPlugin_Constraint::VALUE() (length) and SketchPlugin_Constraint::ENTITY_A() (segment),
19  *  SketchPlugin_Constraint::FLYOUT_VALUE_PNT() (distance of a constraints handle)
20  */
21 class SketchPlugin_ConstraintLength: public SketchPlugin_Constraint
22 {
23 public:
24   /// Length constraint kind
25   inline static const std::string& ID()
26   {
27     static const std::string MY_CONSTRAINT_LENGTH_ID("SketchConstraintLength");
28     return MY_CONSTRAINT_LENGTH_ID;
29   }
30   /// \brief Returns the kind of a feature
31   SKETCHPLUGIN_EXPORT virtual const std::string& getKind() 
32   {static std::string MY_KIND = SketchPlugin_ConstraintLength::ID(); return MY_KIND;}
33
34   /// \brief Creates a new part document if needed
35   SKETCHPLUGIN_EXPORT virtual void execute();
36
37   /// \brief Request for initialization of data model of the feature: adding all attributes
38   SKETCHPLUGIN_EXPORT virtual void initAttributes();
39
40   /// Returns the AIS preview
41   SKETCHPLUGIN_EXPORT virtual boost::shared_ptr<GeomAPI_AISObject> getAISObject(
42                                 boost::shared_ptr<GeomAPI_AISObject> thePrevious);
43
44   /// Moves the feature
45   /// \param theDeltaX the delta for X coordinate is moved
46   /// \param theDeltaY the delta for Y coordinate is moved
47   SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY);
48
49   /// \brief Use plugin manager for features creation
50   SketchPlugin_ConstraintLength();
51 };
52
53 #endif