Salome HOME
Task 2.4. Ability to modify the radius of circles and arcs of circle with the mouse
[modules/shaper.git] / src / SketchSolver / SketchSolver_ConstraintFixed.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:    SketchSolver_ConstraintFixed.h
4 // Created: 30 Mar 2015
5 // Author:  Artem ZHIDKOV
6
7 #ifndef SketchSolver_ConstraintFixed_H_
8 #define SketchSolver_ConstraintFixed_H_
9
10 #include <SketchSolver_Constraint.h>
11
12 /** \class   SketchSolver_ConstraintFixed
13  *  \ingroup Plugins
14  *  \brief   Stores data of the Fixed constraint
15  */
16 class SketchSolver_ConstraintFixed : public SketchSolver_Constraint
17 {
18 public:
19   /// Creates constraint to manage the given constraint from plugin
20   SketchSolver_ConstraintFixed(ConstraintPtr theConstraint);
21 #ifndef SUPPORT_NEW_MOVE
22   /// Creates temporary constraint based on feature (useful while the feature is being moved)
23   SketchSolver_ConstraintFixed(FeaturePtr theFeature);
24 #endif
25
26   /// \brief Block or unblock events from this constraint
27   virtual void blockEvents(bool isBlocked);
28
29 #ifndef SUPPORT_NEW_MOVE
30   /// \brief Set coordinates of fixed feature to the values where it has been dragged.
31   ///        Useful when the feature is being moved.
32   void moveFeature();
33 #endif
34
35 protected:
36   /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints
37   virtual void process();
38
39   /// \brief Generate list of attributes of constraint in order useful for constraints
40   /// \param[out] theValue      numerical characteristic of constraint (e.g. distance)
41   /// \param[out] theAttributes list of attributes to be filled
42   virtual void getAttributes(EntityWrapperPtr& , std::vector<EntityWrapperPtr>& )
43   {}
44
45 #ifdef SUPPORT_NEW_MOVE
46   /// \brief Obtain entity to be fixed
47   virtual EntityWrapperPtr entityToFix();
48 #else
49   /// \brief Generate list of attributes of constraint in order useful for constraints
50   /// \param[out] theBaseEntity  the entity which coordinates should be fixed
51   /// \param[out] theFixedEntity the entity containing fixed values
52   virtual void getAttributes(EntityWrapperPtr& theBaseEntity,
53                              EntityWrapperPtr& theFixedEntity);
54 #endif
55
56   /// \brief Create Fixed constraint for the feature basing on its type
57   /// \param theFeature [in]  feature, converted to solver specific format
58   /// \return Fixed constraint
59   virtual ConstraintWrapperPtr fixFeature(EntityWrapperPtr theFeature);
60
61 #ifndef SUPPORT_NEW_MOVE
62 public:
63 #endif
64   /// \brief Get list of parameters of current entity
65   static GCS::VEC_pD toParameters(const EntityWrapperPtr& theEntity);
66
67 #ifdef SUPPORT_NEW_MOVE
68 protected:
69 #else
70 private:
71   FeaturePtr myBaseFeature; ///< fixed feature (when it is set, myBaseConstraint should be NULL)
72
73   ConstraintWrapperPtr myConstraint;
74   EntityWrapperPtr    myFixedEntity;
75 #endif
76   std::vector<double> myFixedValues;
77 };
78
79 #endif