]> SALOME platform Git repositories - modules/shaper.git/blob - src/SketchSolver/SketchSolver_ConstraintMovement.h
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
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 moveTo(const std::shared_ptr<GeomAPI_Pnt2d>& theDestinationPoint);
33
34   /// \brief Block or unblock events from this constraint
35   virtual void blockEvents(bool isBlocked);
36
37   /// \brief Returns moved feature
38   FeaturePtr movedFeature() const
39   { return myMovedFeature; }
40
41 protected:
42   /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints
43   virtual void process();
44
45   /// \brief Create Fixed constraint for the feature basing on its type and moved point
46   /// \return Fixed constraint
47   ConstraintWrapperPtr initMovement();
48
49   /// \brief Create constraint to fix moved arc extremity
50   ConstraintWrapperPtr fixArcExtremity(const EntityWrapperPtr& theArcExtremity);
51
52   /// \brief Creat constraint to fix moved point on circle/arc
53   ConstraintWrapperPtr fixPointOnCircle(const EntityWrapperPtr& theCircular);
54
55 private:
56   FeaturePtr       myMovedFeature; ///< fixed feature (if set, myBaseConstraint should be NULL)
57   AttributePtr     myDraggedPoint; ///< one of the feature points which has been moved
58   std::shared_ptr<GeomAPI_Pnt2d> myStartPoint; ///< start point of the movement
59
60   bool mySimpleMove; ///< simple move, thus all parameters should be increased by movement delta
61 };
62
63 #endif