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_ConstraintMovement.h
1 // Copyright (C) 2015-20xx CEA/DEN, EDF R&D
2
3 // File:    SketchSolver_ConstraintMovement.h
4 // Created: 15 Jun 2015
5 // Author:  Artem ZHIDKOV
6
7 #ifndef SketchSolver_ConstraintMovement_H_
8 #define SketchSolver_ConstraintMovement_H_
9
10 #include <SketchSolver_ConstraintFixed.h>
11
12 class GeomAPI_Pnt2d;
13
14 /** \class   SketchSolver_ConstraintMovement
15  *  \ingroup Plugins
16  *  \brief   Stores data to the Fixed constraint for the moved feature only
17  */
18 class SketchSolver_ConstraintMovement : public SketchSolver_ConstraintFixed
19 {
20 public:
21   /// Creates movement constraint based on feature
22   SketchSolver_ConstraintMovement(FeaturePtr theFeature);
23
24   /// Creates movement constraint based on point
25   SketchSolver_ConstraintMovement(AttributePtr thePoint);
26
27   /// \brief Set coordinates of the start point of the movement
28   void startPoint(const std::shared_ptr<GeomAPI_Pnt2d>& theStartPoint)
29   { myStartPoint = theStartPoint; }
30
31   /// \brief Set coordinates of fixed feature to the values where it has been dragged.
32   ///        Useful when the feature is being moved.
33   void moveTo(const std::shared_ptr<GeomAPI_Pnt2d>& theDestinationPoint);
34
35   /// \brief Block or unblock events from this constraint
36   virtual void blockEvents(bool isBlocked);
37
38   /// \brief Returns moved feature
39   FeaturePtr movedFeature() const
40   { return myMovedFeature; }
41
42 protected:
43   /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints
44   virtual void process();
45
46   /// \brief Obtain entity to be fixed
47   virtual EntityWrapperPtr entityToFix();
48
49 private:
50   FeaturePtr       myMovedFeature; ///< fixed feature (when it is set, myBaseConstraint should be NULL)
51   AttributePtr     myDraggedPoint; ///< one of the feature points which has been moved
52   std::shared_ptr<GeomAPI_Pnt2d> myStartPoint; ///< start point of the movement
53 };
54
55 #endif