Salome HOME
10e17a19f787eee555a35f6057b997dd0c905d00
[modules/shaper.git] / src / SketchSolver / PlaneGCSSolver / PlaneGCSSolver_ConstraintWrapper.h
1 // Copyright (C) 2014-2023  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 email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef PlaneGCSSolver_ConstraintWrapper_H_
21 #define PlaneGCSSolver_ConstraintWrapper_H_
22
23 #include <PlaneGCSSolver_Defs.h>
24 #include <PlaneGCSSolver_ScalarWrapper.h>
25
26 #include <list>
27
28 /**
29  *  Wrapper providing operations with PlaneGCS constraints.
30  */
31 class PlaneGCSSolver_ConstraintWrapper
32 {
33 public:
34   PlaneGCSSolver_ConstraintWrapper(const GCSConstraintPtr&            theConstraint,
35                                    const SketchSolver_ConstraintType& theType);
36   PlaneGCSSolver_ConstraintWrapper(const std::list<GCSConstraintPtr>& theConstraints,
37                                    const SketchSolver_ConstraintType& theType);
38
39   /// \brief Return list of constraints
40   const std::list<GCSConstraintPtr>& constraints() const
41   { return myGCSConstraints; }
42   /// \brief Change list of constraints
43   void setConstraints(const std::list<GCSConstraintPtr>& theConstraints)
44   { myGCSConstraints = theConstraints; }
45
46   /// \brief Return ID of current constraint
47   const ConstraintID& id() const
48   { return myID; }
49   /// \brief Change constraint ID
50   virtual void setId(const ConstraintID& theID);
51
52   /// \brief Return type of current entity
53   virtual SketchSolver_ConstraintType type() const
54   { return myType; }
55
56   /// \brief Assign numeric parameter of constraint
57   virtual void setValue(const double& theValue);
58   /// \brief Return numeric parameter of constraint
59   virtual double value() const;
60
61   /// \brief Change parameter representing the value of constraint
62   void setValueParameter(const ScalarWrapperPtr& theValue);
63   /// \brief Return parametric representation of constraint value
64   const ScalarWrapperPtr& valueParameter() const
65   { return myValueParam; }
66
67 private:
68   ConstraintID                myID;
69   SketchSolver_ConstraintType myType;
70   ScalarWrapperPtr            myValueParam;
71   std::list<GCSConstraintPtr> myGCSConstraints;
72 };
73
74 typedef std::shared_ptr<PlaneGCSSolver_ConstraintWrapper> ConstraintWrapperPtr;
75
76 #endif