Salome HOME
Task 2.7. Horizontal and Vertical Distance constraint
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_ConstraintDistanceVertical.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:    SketchPlugin_ConstraintDistanceVertical.h
4 // Created: 10 May 2017
5 // Author:  Artem ZHIDKOV
6
7 #ifndef SketchPlugin_ConstraintDistanceVertical_H_
8 #define SketchPlugin_ConstraintDistanceVertical_H_
9
10 #include <SketchPlugin.h>
11 #include <SketchPlugin_ConstraintDistance.h>
12
13 /** \class SketchPlugin_ConstraintDistanceVertical
14  *  \ingroup Plugins
15  *  \brief Feature for creation of a new constraint which defines a vertical distance between two points.
16  *
17  *  This constraint has three attributes:
18  *  SketchPlugin_Constraint::VALUE(), SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B()
19  */
20 class SketchPlugin_ConstraintDistanceVertical : public SketchPlugin_ConstraintDistance
21 {
22 public:
23   /// Distance constraint kind
24   inline static const std::string& ID()
25   {
26     static const std::string MY_CONSTRAINT_DISTANCE_ID("SketchConstraintDistanceVertical");
27     return MY_CONSTRAINT_DISTANCE_ID;
28   }
29
30   /// \brief Returns the kind of a feature
31   SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
32   {
33     static std::string MY_KIND = SketchPlugin_ConstraintDistanceVertical::ID();
34     return MY_KIND;
35   }
36
37   /// \brief Creates a new part document if needed
38   SKETCHPLUGIN_EXPORT virtual void execute();
39
40   /// \brief Request for initialization of data model of the feature: adding all attributes
41   SKETCHPLUGIN_EXPORT virtual void initAttributes();
42
43   /// Returns the AIS preview
44   SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr 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   /// 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);
54
55   /// \brief Use plugin manager for features creation
56   SketchPlugin_ConstraintDistanceVertical();
57
58 protected:
59   /// Returns the current distance between the feature attributes
60   virtual double calculateCurrentDistance();
61
62 private:
63   bool myFlyoutUpdate; ///< to avoid cyclic dependencies on automatic updates of flyout point
64 };
65
66 #endif