Salome HOME
Checking that collinearity constraint is already in the solver
[modules/shaper.git] / src / SketchSolver / SketchSolver_ConstraintCollinear.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:    SketchSolver_ConstraintCollinear.h
4 // Created: 27 May 2014
5 // Author:  Artem ZHIDKOV
6
7 #ifndef SketchSolver_ConstraintCollinear_H_
8 #define SketchSolver_ConstraintCollinear_H_
9
10 #include <SketchSolver_Constraint.h>
11
12 /** \class   SketchSolver_ConstraintCollinear
13  *  \ingroup Plugins
14  *  \brief   Converts collinear constraint to the constraint applicable for solver
15  */
16 class SketchSolver_ConstraintCollinear : public SketchSolver_Constraint
17 {
18 public:
19   /// Constructor based on SketchPlugin constraint
20   SketchSolver_ConstraintCollinear(ConstraintPtr theConstraint)
21     : SketchSolver_Constraint(theConstraint),
22       myInSolver(false)
23   {
24     for (int i = 0; i < 4; ++i)
25       myIsConstraintApplied[i] = false;
26   }
27
28   /// \brief Notify this object about the feature is changed somewhere
29   virtual void notify(const FeaturePtr&      theFeature,
30                       PlaneGCSSolver_Update* theUpdater);
31
32 protected:
33   /// \brief Converts SketchPlugin constraint to a list of solver constraints
34   virtual void process();
35
36 private:
37   EntityWrapperPtr myPoints[4];  ///< extremities on collinear lines
38   bool myIsConstraintApplied[4]; ///< set \c true if point on opposite line
39   bool myInSolver; ///< the constraint is added to the solver
40 };
41
42 #endif