Salome HOME
Issue #1157: Using parameters in point coordinates
[modules/shaper.git] / src / SketchSolver / SketchSolver_ISolver.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:    SketchSolver_ISolver.h
4 // Created: 30 Nov 2015
5 // Author:  Artem ZHIDKOV
6
7 #ifndef SketchSolver_ISolver_H_
8 #define SketchSolver_ISolver_H_
9
10 #include <SketchSolver.h>
11
12 #include <memory>
13
14 /// The result of constraints solution
15 enum SketchSolver_SolveStatus {
16   STATUS_OK,
17   STATUS_INCONSISTENT,
18   STATUS_EMPTYSET,
19   STATUS_FAILED // set if no one other status is applicable
20 };
21
22
23 /**
24  *  Interface providing operations to solve sketches.
25  */
26 class SketchSolver_ISolver
27 {
28 public:
29   virtual ~SketchSolver_ISolver() {}
30
31   /// \brief Changes the ID of the group to solve
32   void setGroup(const GroupID& theGroupID)
33   { myGroup = theGroupID; }
34
35   /// \brief Set or unset the flag which allows to find all failed constraints
36   void calculateFailedConstraints(bool theSic)
37   { myFindFaileds = theSic; }
38
39   /// \brief Solve the set of equations
40   /// \return identifier whether solution succeeded
41   virtual SketchSolver_SolveStatus solve() = 0;
42
43 protected:
44   GroupID myGroup;       ///< ID of the group to be solved
45   bool    myFindFaileds; ///< flag to find conflicting or inappropriate constraints
46 };
47
48 typedef std::shared_ptr<SketchSolver_ISolver> SolverPtr;
49
50 #endif