1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: SketchPlugin_ConstraintDistanceHorizontal.h
5 // Author: Artem ZHIDKOV
7 #ifndef SketchPlugin_ConstraintDistanceHorizontal_H_
8 #define SketchPlugin_ConstraintDistanceHorizontal_H_
10 #include <SketchPlugin.h>
11 #include <SketchPlugin_ConstraintDistance.h>
13 /** \class SketchPlugin_ConstraintDistanceHorizontal
15 * \brief Feature for creation of a new constraint which defines a horizontal distance between two points.
17 * This constraint has three attributes:
18 * SketchPlugin_Constraint::VALUE(), SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B()
20 class SketchPlugin_ConstraintDistanceHorizontal : public SketchPlugin_ConstraintDistance
23 /// Distance constraint kind
24 inline static const std::string& ID()
26 static const std::string MY_CONSTRAINT_DISTANCE_ID("SketchConstraintDistanceHorizontal");
27 return MY_CONSTRAINT_DISTANCE_ID;
30 /// \brief Returns the kind of a feature
31 SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
33 static std::string MY_KIND = SketchPlugin_ConstraintDistanceHorizontal::ID();
37 /// \brief Creates a new part document if needed
38 SKETCHPLUGIN_EXPORT virtual void execute();
40 /// \brief Request for initialization of data model of the feature: adding all attributes
41 SKETCHPLUGIN_EXPORT virtual void initAttributes();
43 /// Returns the AIS preview
44 SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr 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 /// Called on change of any argument-attribute of this object
52 /// \param theID identifier of changed attribute
53 SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
55 /// \brief Use plugin manager for features creation
56 SketchPlugin_ConstraintDistanceHorizontal();
59 /// Returns the current distance between the feature attributes
60 virtual double calculateCurrentDistance();
63 bool myFlyoutUpdate; ///< to avoid cyclic dependencies on automatic updates of flyout point