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);
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);
34 /// \brief Block or unblock events from this constraint
35 virtual void blockEvents(bool isBlocked);
37 /// \brief Returns moved feature
38 FeaturePtr movedFeature() const
39 { return myMovedFeature; }
42 /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints
43 virtual void process();
45 /// \brief Create Fixed constraint for the feature basing on its type and moved point
46 /// \return Fixed constraint
47 ConstraintWrapperPtr initMovement();
49 /// \brief Create constraint to fix moved arc extremity
50 ConstraintWrapperPtr fixArcExtremity(const EntityWrapperPtr& theArcExtremity);
52 /// \brief Creat constraint to fix moved point on circle/arc
53 ConstraintWrapperPtr fixPointOnCircle(const EntityWrapperPtr& theCircular);
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
60 bool mySimpleMove; ///< simple move, thus all parameters should be increased by movement delta