X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchSolver%2FSketchSolver_ConstraintMovement.h;h=8614f309ac064177045d915bad8d86d234c199fb;hb=d5b5ce2284869d8b97ce638502c58c810bbeb0c7;hp=93b2ea001f756e2e41b544bb30070f773556c8c1;hpb=f387a286673e6be6e5c065f3bbf3c19ed5981a30;p=modules%2Fshaper.git diff --git a/src/SketchSolver/SketchSolver_ConstraintMovement.h b/src/SketchSolver/SketchSolver_ConstraintMovement.h index 93b2ea001..8614f309a 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMovement.h +++ b/src/SketchSolver/SketchSolver_ConstraintMovement.h @@ -1,4 +1,22 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D +// Copyright (C) 2017 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or +// email : webmaster.salome@opencascade.com +// // File: SketchSolver_ConstraintMovement.h // Created: 15 Jun 2015 @@ -7,42 +25,57 @@ #ifndef SketchSolver_ConstraintMovement_H_ #define SketchSolver_ConstraintMovement_H_ -#include "SketchSolver.h" #include +class GeomAPI_Pnt2d; + /** \class SketchSolver_ConstraintMovement * \ingroup Plugins * \brief Stores data to the Fixed constraint for the moved feature only */ class SketchSolver_ConstraintMovement : public SketchSolver_ConstraintFixed { -private: - /// Creates constraint to manage the given constraint from plugin - SketchSolver_ConstraintMovement(ConstraintPtr theConstraint) - : SketchSolver_ConstraintFixed(theConstraint) - {} - public: - /// Creates temporary constraint based on feature - SketchSolver_ConstraintMovement(FeaturePtr theFeature) - : SketchSolver_ConstraintFixed(theFeature) - {} + /// Creates movement constraint based on feature + SketchSolver_ConstraintMovement(FeaturePtr theFeature); + + /// Creates movement constraint based on point + SketchSolver_ConstraintMovement(AttributePtr thePoint); + + /// \brief Set coordinates of the start point of the movement + void startPoint(const std::shared_ptr& theStartPoint); - /// \brief Tries to remove constraint - /// \return \c false, if current constraint contains another SketchPlugin constraints (like for multiple coincidence) - virtual bool remove(); + /// \brief Set coordinates of fixed feature to the values where it has been dragged. + /// Useful when the feature is being moved. + void moveTo(const std::shared_ptr& theDestinationPoint); + + /// \brief Block or unblock events from this constraint + virtual void blockEvents(bool isBlocked); + + /// \brief Returns moved feature + FeaturePtr movedFeature() const + { return myMovedFeature; } protected: /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints virtual void process(); - /// \brief Generate list of attributes of constraint in order useful for SolveSpace constraints - /// \param[out] theValue numerical characteristic of constraint (e.g. distance) - /// \param[out] theAttributes list of attributes to be filled (list of moved entities or attributes) - virtual void getAttributes(ParameterWrapperPtr& theValue, std::vector& theAttributes); + /// \brief Create Fixed constraint for the feature basing on its type and moved point + /// \return Fixed constraint + ConstraintWrapperPtr initMovement(); + + /// \brief Create constraint to fix moved arc extremity + ConstraintWrapperPtr fixArcExtremity(const EntityWrapperPtr& theArcExtremity); + + /// \brief Creat constraint to fix moved point on circle/arc + ConstraintWrapperPtr fixPointOnCircle(const EntityWrapperPtr& theCircular); private: - std::vector myMovedEntities; ///< list of entities that are moved + FeaturePtr myMovedFeature; ///< fixed feature (if set, myBaseConstraint should be NULL) + AttributePtr myDraggedPoint; ///< one of the feature points which has been moved + std::shared_ptr myStartPoint; ///< start point of the movement + + bool mySimpleMove; ///< simple move, thus all parameters should be increased by movement delta }; #endif