Salome HOME
Merge branch 'Dev_1.1.1' of newgeom:newgeom into Dev_1.2.0
[modules/shaper.git] / src / SketchSolver / SketchSolver_ConstraintDistance.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:    SketchSolver_ConstraintDistance.h
4 // Created: 31 Mar 2015
5 // Author:  Artem ZHIDKOV
6
7 #ifndef SketchSolver_ConstraintDistance_H_
8 #define SketchSolver_ConstraintDistance_H_
9
10 #include "SketchSolver.h"
11 #include <SketchSolver_Constraint.h>
12
13 /** \class   SketchSolver_ConstraintDistance
14  *  \ingroup Plugins
15  *  \brief   Convert distance constraint to SolveSpace structure
16  */
17 class SketchSolver_ConstraintDistance : public SketchSolver_Constraint
18 {
19 public:
20   SketchSolver_ConstraintDistance(ConstraintPtr theConstraint) :
21       SketchSolver_Constraint(theConstraint), myType(SLVS_C_UNKNOWN)
22   {}
23
24   /// \brief Update constraint
25   virtual void update(ConstraintPtr theConstraint = ConstraintPtr());
26
27   virtual int getType() const
28   {return myType; }
29
30 protected:
31   /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints
32   virtual void process();
33
34   /// \brief This method is used in derived objects to check consistence of constraint.
35   ///        E.g. the distance between line and point may be signed.
36   virtual void adjustConstraint();
37
38 private:
39   int myType; ///< type of constraint (applicable: SLVS_C_PT_PT_DISTANCE, SLVS_C_PT_LINE_DISTANCE)
40   double myPrevValue; ///< previous value of distance (for correct calculation of a distance sign)
41 };
42
43 #endif