Salome HOME
crash fix: mirror (line, axis of sketch), select with rectangle, delete
[modules/shaper.git] / src / SketchSolver / PlaneGCSSolver / PlaneGCSSolver_ConstraintWrapper.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:    PlaneGCSSolver_ConstraintWrapper.h
4 // Created: 14 Dec 2015
5 // Author:  Artem ZHIDKOV
6
7 #ifndef PlaneGCSSolver_ConstraintWrapper_H_
8 #define PlaneGCSSolver_ConstraintWrapper_H_
9
10 #include <PlaneGCSSolver_Defs.h>
11 #include <PlaneGCSSolver_Solver.h>
12 #include <SketchSolver_IConstraintWrapper.h>
13
14
15 /**
16  *  Wrapper providing operations with SovleSpace constraints.
17  */
18 class PlaneGCSSolver_ConstraintWrapper : public SketchSolver_IConstraintWrapper
19 {
20 public:
21   PlaneGCSSolver_ConstraintWrapper(const ConstraintPtr& theOriginal,
22                                    const GCSConstraintPtr& theConstraint,
23                                    const SketchSolver_ConstraintType& theType);
24   PlaneGCSSolver_ConstraintWrapper(const ConstraintPtr& theOriginal,
25                                    const std::list<GCSConstraintPtr>& theConstraints,
26                                    const SketchSolver_ConstraintType& theType);
27
28   /// \brief Return list of constraints
29   const std::list<GCSConstraintPtr>& constraints() const
30   { return myGCSConstraints; }
31
32   /// \brief Return ID of current entity
33   virtual ConstraintID id() const
34   { return myID; }
35   /// \brief Change constraint ID
36   void setId( const ConstraintID& theID);
37
38   /// \brief Change group for the constraint
39   virtual void setGroup(const GroupID& theGroup);
40   /// \brief Return identifier of the group the constraint belongs to
41   virtual GroupID group() const
42   { return myGroup; }
43
44   /// \brief Return type of current entity
45   virtual SketchSolver_ConstraintType type() const
46   { return myType; }
47
48   /// \brief Assign numeric parameter of constraint
49   virtual void setValue(const double& theValue);
50
51   /// \brief Change parameter representing the value of constraint
52   void setValueParameter(const ParameterWrapperPtr& theValue);
53   /// \brief Return parametric representation of constraint value
54   const ParameterWrapperPtr& valueParameter() const
55   { return myValueParam; }
56
57   /// \brief Verify the feature is used in the constraint
58   virtual bool isUsed(FeaturePtr theFeature) const;
59   /// \brief Verify the attribute is used in the constraint
60   virtual bool isUsed(AttributePtr theAttribute) const;
61
62   /// \brief Compare current constraint with other
63   virtual bool isEqual(const ConstraintWrapperPtr& theOther);
64
65   /// \brief Update values of parameters of this constraint by the parameters of given one
66   /// \return \c true if some parameters change their values
67   virtual bool update(const std::shared_ptr<SketchSolver_IConstraintWrapper>& theOther);
68
69 private:
70   ConstraintID     myID;
71   GroupID          myGroup;
72   SketchSolver_ConstraintType myType;
73   ParameterWrapperPtr myValueParam;
74   std::list<GCSConstraintPtr> myGCSConstraints;
75 };
76
77 #endif