1 // File: SketchPlugin_ConstraintLength.h
2 // Created: 30 May 2014
3 // Author: Artem ZHIDKOV
5 #ifndef SketchPlugin_ConstraintLength_H_
6 #define SketchPlugin_ConstraintLength_H_
8 #include "SketchPlugin.h"
9 #include "SketchPlugin_Constraint.h"
10 #include <SketchPlugin_Sketch.h>
13 #define LENGTH_COLOR "255, 0, 255"
15 /** \class SketchPlugin_ConstraintLength
17 * \brief Feature for creation of a new constraint which defines a length of a line segment
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)
23 class SketchPlugin_ConstraintLength: public SketchPlugin_Constraint
26 /// Length constraint kind
27 inline static const std::string& ID()
29 static const std::string MY_CONSTRAINT_LENGTH_ID("SketchConstraintLength");
30 return MY_CONSTRAINT_LENGTH_ID;
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;}
36 /// \brief Creates a new part document if needed
37 SKETCHPLUGIN_EXPORT virtual void execute();
39 /// \brief Request for initialization of data model of the feature: adding all attributes
40 SKETCHPLUGIN_EXPORT virtual void initAttributes();
42 /// Returns the AIS preview
43 SKETCHPLUGIN_EXPORT virtual boost::shared_ptr<GeomAPI_AISObject> getAISObject(
44 boost::shared_ptr<GeomAPI_AISObject> thePrevious);
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);
51 /// \brief Use plugin manager for features creation
52 SketchPlugin_ConstraintLength();