Salome HOME
There is implemented fixed constraint for the points which coordinates are given...
[modules/shaper.git] / src / SketchSolver / SketchSolver_ConstraintParametric.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:    SketchSolver_ConstraintParametric.h
4 // Created: 15 Jun 2015
5 // Author:  Artem ZHIDKOV
6
7 #ifndef SketchSolver_ConstraintParametric_H_
8 #define SketchSolver_ConstraintParametric_H_
9
10 #include "SketchSolver.h"
11 #include <SketchSolver_ConstraintRigid.h>
12
13 /** \class   SketchSolver_ConstraintParametric
14  *  \ingroup Plugins
15  *  \brief   Stores data of Rigid (Fixed) constraint for the attribute
16  *           which coordinates are given by parametric expression
17  */
18 class SketchSolver_ConstraintParametric : public SketchSolver_ConstraintRigid
19 {
20 private:
21   /// Creates constraint to manage the given constraint from plugin
22   SketchSolver_ConstraintParametric()
23     : SketchSolver_ConstraintRigid(ConstraintPtr())
24   {}
25
26 public:
27   /// Creates temporary constraint based on feature
28   SketchSolver_ConstraintParametric(AttributePtr theAttribute);
29
30   /// \brief Update constraint
31   virtual void update(ConstraintPtr theConstraint = ConstraintPtr());
32
33   /// \brief Update points coincident with parametric one
34   virtual void refresh();
35
36 protected:
37   /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints
38   virtual void process();
39
40   /// \brief Convert attribute to the entity
41   /// \param[out] theAttributeID   identifier of the entity related to the attribute
42   virtual void getAttributes(Slvs_hEntity& theAttributeID);
43
44   /// \brief This method is used in derived objects to check consistence of constraint.
45   virtual void adjustConstraint();
46
47 private:
48   AttributePtr myBaseAttribute; ///< attribute given by expression
49   Slvs_hEntity myHorizLineID;   ///< identifier of horizontal line, containing the point
50   Slvs_hEntity myVertLineID;    ///< identifier of vertical line, containing the point
51   double myX, myY;
52 };
53
54 #endif