Salome HOME
Merge branch 'master' into cgt/devCEA
[modules/shaper.git] / src / SketchSolver / SolveSpaceSolver / SolveSpaceSolver_ConstraintWrapper.h
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #ifndef SolveSpaceSolver_ConstraintWrapper_H_
22 #define SolveSpaceSolver_ConstraintWrapper_H_
23
24 #include <SketchSolver_IConstraintWrapper.h>
25 #include <SolveSpaceSolver_Solver.h>
26
27
28 /**
29  *  Wrapper providing operations with SovleSpace constraints.
30  */
31 class SolveSpaceSolver_ConstraintWrapper : public SketchSolver_IConstraintWrapper
32 {
33 public:
34   SolveSpaceSolver_ConstraintWrapper(const ConstraintPtr&   theOriginal,
35                                      const Slvs_Constraint& theConstraint);
36
37   /// \brief Return SolveSpace constraint
38   const Slvs_Constraint& constraint() const
39   { return mySlvsConstraint; }
40   /// \brief Return SolveSpace constraint to change
41   Slvs_Constraint& changeConstraint()
42   { return mySlvsConstraint; }
43
44   /// \brief Return ID of current entity
45   virtual ConstraintID id() const;
46
47   /// \brief Change group for the constraint
48   virtual void setGroup(const GroupID& theGroup);
49   /// \brief Return identifier of the group the constraint belongs to
50   virtual GroupID group() const
51   { return (GroupID)mySlvsConstraint.group; }
52
53   /// \brief Return type of current entity
54   virtual SketchSolver_ConstraintType type() const;
55
56   /// \brief Verify the feature is used in the constraint
57   virtual bool isUsed(FeaturePtr theFeature) const;
58   /// \brief Verify the attribute is used in the constraint
59   virtual bool isUsed(AttributePtr theAttribute) const;
60
61   /// \brief Compare current constraint with other
62   virtual bool isEqual(const ConstraintWrapperPtr& theOther);
63
64   /// \brief Update values of parameters of this constraint by the parameters of given one
65   /// \return \c true if some parameters change their values
66   virtual bool update(const std::shared_ptr<SketchSolver_IConstraintWrapper>& theOther);
67
68 private:
69   Slvs_Constraint mySlvsConstraint;
70 };
71
72 #endif