Salome HOME
Issue 1299 Angle presentation: providing angle value attirbute in feature which serve...
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_ConstraintAngle.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:    SketchPlugin_ConstraintAngle.h
4 // Created: 19 August 2015
5 // Author:  Artem ZHIDKOV
6
7 #ifndef SketchPlugin_ConstraintAngle_H_
8 #define SketchPlugin_ConstraintAngle_H_
9
10 #include "SketchPlugin.h"
11 #include <SketchPlugin_Sketch.h>
12 #include "SketchPlugin_ConstraintBase.h"
13
14 /** \class SketchPlugin_ConstraintAngle
15  *  \ingroup Plugins
16  *  \brief Feature for creation of a new constraint fix angle between two lines
17  *
18  *  This constraint has two attributes:
19  *  SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B()
20  */
21 class SketchPlugin_ConstraintAngle : public SketchPlugin_ConstraintBase
22 {
23  public:
24   /// Angle constraint kind
25   inline static const std::string& ID()
26   {
27     static const std::string MY_CONSTRAINT_ANGLE_ID("SketchConstraintAngle");
28     return MY_CONSTRAINT_ANGLE_ID;
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_ConstraintAngle::ID();
34     return MY_KIND;
35   }
36
37   /// attribute name of operation type
38   inline static const std::string& TYPE_ID()
39   {
40     static const std::string MY_TYPE_ID("AngleType");
41     return MY_TYPE_ID;
42   }
43
44   /// attribute name of operation type
45   inline static const std::string& ANGLE_VALUE_ID()
46   {
47     static const std::string MY_ANGLE_VALUE_ID("AngleValue");
48     return MY_ANGLE_VALUE_ID;
49   }
50
51   /// \brief Creates a new part document if needed
52   SKETCHPLUGIN_EXPORT virtual void execute();
53
54   /// Computes the attribute value on the base of other attributes if the value can be computed
55   /// \param theAttributeId an attribute index to be computed
56   /// \return a boolean value about it is computed
57   SKETCHPLUGIN_EXPORT virtual bool compute(const std::string& theAttributeId);
58
59   /// \brief Request for initialization of data model of the feature: adding all attributes
60   SKETCHPLUGIN_EXPORT virtual void initAttributes();
61
62   /// Retuns the parameters of color definition in the resources config manager
63   SKETCHPLUGIN_EXPORT virtual void colorConfigInfo(std::string& theSection, std::string& theName,
64                                                    std::string& theDefault);
65
66   /// Called on change of any argument-attribute of this object
67   /// \param theID identifier of changed attribute
68   SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
69
70   /// Returns the AIS preview
71   SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
72
73   /// Moves the feature
74   /// \param theDeltaX the delta for X coordinate is moved
75   /// \param theDeltaY the delta for Y coordinate is moved
76   SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY);
77
78   /// Calculate current value of the angle
79   double calculateAngle();
80
81   /// Update value of VALUE attribute by the combination of the current angle type and angle value
82   void updateAngleValue();
83
84   /// \brief Use plugin manager for features creation
85   SketchPlugin_ConstraintAngle();
86
87 private:
88   bool myFlyoutUpdate; ///< to avoid cyclic dependencies on automatic updates of flyout point
89 };
90
91 #endif