Salome HOME
Implement Collinear constraint
[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   {
23     for (int i = 0; i < 4; ++i)
24       myIsConstraintApplied[i] = false;
25   }
26
27   /// \brief Notify this object about the feature is changed somewhere
28   virtual void notify(const FeaturePtr&      theFeature,
29                       PlaneGCSSolver_Update* theUpdater);
30
31 protected:
32   /// \brief Converts SketchPlugin constraint to a list of solver constraints
33   virtual void process();
34
35 private:
36   EntityWrapperPtr myPoints[4];  ///< extremities on collinear lines
37   bool myIsConstraintApplied[4]; ///< set \c true if point on opposite line
38 };
39
40 #endif