1 // Copyright (C) 2017 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 // File: SketchSolver_ConstraintMovement.h
22 // Created: 15 Jun 2015
23 // Author: Artem ZHIDKOV
25 #ifndef SketchSolver_ConstraintMovement_H_
26 #define SketchSolver_ConstraintMovement_H_
28 #include <SketchSolver_ConstraintFixed.h>
32 /** \class SketchSolver_ConstraintMovement
34 * \brief Stores data to the Fixed constraint for the moved feature only
36 class SketchSolver_ConstraintMovement : public SketchSolver_ConstraintFixed
39 /// Creates movement constraint based on feature
40 SketchSolver_ConstraintMovement(FeaturePtr theFeature);
42 /// Creates movement constraint based on point
43 SketchSolver_ConstraintMovement(AttributePtr thePoint);
45 /// \brief Set coordinates of the start point of the movement
46 void startPoint(const std::shared_ptr<GeomAPI_Pnt2d>& theStartPoint);
48 /// \brief Set coordinates of fixed feature to the values where it has been dragged.
49 /// Useful when the feature is being moved.
50 void moveTo(const std::shared_ptr<GeomAPI_Pnt2d>& theDestinationPoint);
52 /// \brief Block or unblock events from this constraint
53 virtual void blockEvents(bool isBlocked);
55 /// \brief Returns moved feature
56 FeaturePtr movedFeature() const
57 { return myMovedFeature; }
60 /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints
61 virtual void process();
63 /// \brief Create Fixed constraint for the feature basing on its type and moved point
64 /// \return Fixed constraint
65 ConstraintWrapperPtr initMovement();
67 /// \brief Create constraint to fix moved arc extremity
68 ConstraintWrapperPtr fixArcExtremity(const EntityWrapperPtr& theArcExtremity);
70 /// \brief Creat constraint to fix moved point on circle/arc
71 ConstraintWrapperPtr fixPointOnCircle(const EntityWrapperPtr& theCircular);
74 FeaturePtr myMovedFeature; ///< fixed feature (if set, myBaseConstraint should be NULL)
75 AttributePtr myDraggedPoint; ///< one of the feature points which has been moved
76 std::shared_ptr<GeomAPI_Pnt2d> myStartPoint; ///< start point of the movement
78 bool mySimpleMove; ///< simple move, thus all parameters should be increased by movement delta