Salome HOME
First phase of SketchSolver refactoring
[modules/shaper.git] / src / SketchSolver / SolveSpaceSolver / SolveSpaceSolver_ConstraintWrapper.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:    SolveSpaceSolver_ConstraintWrapper.h
4 // Created: 2 Dec 2015
5 // Author:  Artem ZHIDKOV
6
7 #ifndef SolveSpaceSolver_ConstraintWrapper_H_
8 #define SolveSpaceSolver_ConstraintWrapper_H_
9
10 #include <SketchSolver_IConstraintWrapper.h>
11 #include <slvs.h>
12
13
14 /**
15  *  Wrapper providing operations with SovleSpace constraints.
16  */
17 class SolveSpaceSolver_ConstraintWrapper : public SketchSolver_IConstraintWrapper
18 {
19 public:
20   SolveSpaceSolver_ConstraintWrapper(const ConstraintPtr&   theOriginal,
21                                      const Slvs_Constraint& theConstraint);
22
23   /// \brief Return SolveSpace constraint
24   const Slvs_Constraint& constraint() const
25   { return mySlvsConstraint; }
26   /// \brief Return SolveSpace constraint to change
27   Slvs_Constraint& changeConstraint()
28   { return mySlvsConstraint; }
29
30   /// \brief Return ID of current entity
31   virtual ConstraintID id() const;
32
33   /// \brief Change group for the constraint
34   virtual void setGroup(const GroupID& theGroup);
35   /// \brief Return identifier of the group the constraint belongs to
36   virtual const GroupID& group() const
37   { return (GroupID)mySlvsConstraint.group; }
38
39   /// \brief Return type of current entity
40   virtual SketchSolver_ConstraintType type() const;
41
42   /// \brief Assign numeric parameter of constraint
43   virtual void setValue(const double& theValue);
44
45   /// \brief Verify the feature is used in the constraint
46   virtual bool isUsed(FeaturePtr theFeature) const;
47   /// \brief Verify the attribute is used in the constraint
48   virtual bool isUsed(AttributePtr theAttribute) const;
49
50   /// \brief Compare current constraint with other
51   virtual bool isEqual(const ConstraintWrapperPtr& theOther);
52
53   /// \brief Update values of parameters of this constraint by the parameters of given one
54   /// \return \c true if some parameters change their values
55   virtual bool update(const std::shared_ptr<SketchSolver_IConstraintWrapper>& theOther);
56
57 private:
58   Slvs_Constraint mySlvsConstraint;
59 };
60
61 #endif