1 // Copyright (C) 2015-20xx CEA/DEN, EDF R&D
3 // File: SketchSolver_ConstraintMovement.h
4 // Created: 15 Jun 2015
5 // Author: Artem ZHIDKOV
7 #ifndef SketchSolver_ConstraintMovement_H_
8 #define SketchSolver_ConstraintMovement_H_
10 #include <SketchSolver_ConstraintFixed.h>
14 /** \class SketchSolver_ConstraintMovement
16 * \brief Stores data to the Fixed constraint for the moved feature only
18 class SketchSolver_ConstraintMovement : public SketchSolver_ConstraintFixed
21 /// Creates movement constraint based on feature
22 SketchSolver_ConstraintMovement(FeaturePtr theFeature);
24 /// Creates movement constraint based on point
25 SketchSolver_ConstraintMovement(AttributePtr thePoint);
27 /// \brief Set coordinates of the start point of the movement
28 void startPoint(const std::shared_ptr<GeomAPI_Pnt2d>& theStartPoint)
29 { myStartPoint = theStartPoint; }
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);
35 /// \brief Block or unblock events from this constraint
36 virtual void blockEvents(bool isBlocked);
38 /// \brief Returns moved feature
39 FeaturePtr movedFeature() const
40 { return myMovedFeature; }
43 /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints
44 virtual void process();
46 /// \brief Obtain entity to be fixed
47 virtual EntityWrapperPtr entityToFix();
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