Salome HOME
Do not allow user to move fixed entities (issue #1043)
[modules/shaper.git] / src / SketchSolver / SketchSolver_ConstraintMovement.h
1 // Copyright (C) 2014-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.h"
11 #include <SketchSolver_ConstraintRigid.h>
12
13 #include <GeomDataAPI_Point2D.h>
14
15 /** \class   SketchSolver_ConstraintMovement
16  *  \ingroup Plugins
17  *  \brief   Stores data of Rigid (Fixed) constraint for the moved feature only
18  */
19 class SketchSolver_ConstraintMovement : public SketchSolver_ConstraintRigid
20 {
21 private:
22   /// Creates constraint to manage the given constraint from plugin
23   SketchSolver_ConstraintMovement(ConstraintPtr theConstraint)
24     : SketchSolver_ConstraintRigid(theConstraint)
25   {}
26
27 public:
28   /// Creates temporary constraint based on feature
29   SketchSolver_ConstraintMovement(FeaturePtr theFeature);
30
31 protected:
32   /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints
33   virtual void process();
34
35   /// \brief Generate list of attributes of constraint in order useful for SolveSpace constraints
36   /// \param[out] theValue        numerical characteristic of constraint (e.g. distance)
37   /// \param[out] theAttributes   list of attributes to be filled
38   /// \param[out] theIsFullyMoved shows that the feature is moved, in other case only one point of the feature is shifted
39   virtual void getAttributes(double& theValue, std::vector<Slvs_hEntity>& theAttributes, bool& theIsFullyMoved);
40
41   /// \brief Fixed feature basing on its type
42   virtual void fixFeature();
43
44 private:
45   /// \brief Check the coordinates of point are differ than coordinates of correponding SolveSpace entity
46   bool isMoved(std::shared_ptr<GeomDataAPI_Point2D> thePoint, const Slvs_Entity& theEntity);
47 };
48
49 #endif