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_ConstraintBase.h"
10 #include <SketchPlugin_Sketch.h>
13 #define LENGTH_COLOR "#ff00ff"
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_ConstraintBase
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()
35 static std::string MY_KIND = SketchPlugin_ConstraintLength::ID();
39 /// \brief Creates a new part document if needed
40 SKETCHPLUGIN_EXPORT virtual void execute();
42 /// \brief Request for initialization of data model of the feature: adding all attributes
43 SKETCHPLUGIN_EXPORT virtual void initAttributes();
45 /// Returns the AIS preview
46 SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
49 /// \param theDeltaX the delta for X coordinate is moved
50 /// \param theDeltaY the delta for Y coordinate is moved
51 SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY);
53 /// \brief Use plugin manager for features creation
54 SketchPlugin_ConstraintLength();