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