1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: SolveSpaceSolver_Solver.h
4 // Created: 07 May 2014
5 // Author: Artem ZHIDKOV
7 #ifndef SolveSpaceSolver_Solver_H_
8 #define SolveSpaceSolver_Solver_H_
10 #include <SketchSolver_ISolver.h>
12 // Need to be defined before including SolveSpace to avoid additional
13 // dependences on Windows platform
14 #if defined(WIN32) && !defined(HAVE_C99_INTEGER_TYPES)
15 typedef unsigned int UINT32;
24 // Unknown constraint (for error reporting)
25 #define SLVS_C_UNKNOWN 0
26 // Fillet constraint identifier
27 #define SLVS_C_FILLET 100100
28 // Multi-rotation constraint identifier
29 #define SLVS_C_MULTI_ROTATION 100101
30 // Multi-translation constraint identifier
31 #define SLVS_C_MULTI_TRANSLATION 100102
33 #define SLVS_E_UNKNOWN 0
35 #define SLVS_G_UNKNOWN 0
36 // Group ID to store external objects
37 #define SLVS_G_OUTOFGROUP 1
39 /** \class SolveSpaceSolver_Solver
41 * \brief Performs high-level operations to solve sketch in SolveSpace.
43 class SolveSpaceSolver_Solver : public SketchSolver_ISolver
46 SolveSpaceSolver_Solver();
47 virtual ~SolveSpaceSolver_Solver();
49 /** \brief Change array of parameters
50 * \param[in] theParameters pointer to the array of parameters
51 * \param[in] theSize size of this array
53 void setParameters(Slvs_Param* theParameters, int theSize);
55 /** \brief Change array of entities
56 * \param[in] theEntities pointer to the array of entities
57 * \param[in] theSize size of this array
59 void setEntities(Slvs_Entity* theEntities, int theSize);
61 /** \brief Change array of constraints
62 * \param[in] theConstraints pointer to the array of constraints
63 * \param[in] theSize size of this array
65 void setConstraints(Slvs_Constraint* theConstraints, int theSize);
67 /** \brief Store the parameters of the point which was moved by user.
68 * The solver will watch this items to be constant
69 * \param[in] theDragged list of parameters (not more than 4) which should not be changed during solving
71 void setDraggedParameters(const Slvs_hParam* theDragged);
73 /** \brief Solve the set of equations
74 * \return identifier whether solution succeeded
76 virtual SketchSolver_SolveStatus solve();
78 /// \brief Prepare for solving. Store initial values of parameters for undo
79 virtual void prepare();
81 /// \brief Revert solution to initial values
84 /// \brief Check the constraint is conflicted with others
85 virtual bool isConflicting(const ConstraintID& theConstraint) const;
87 /// \brief Degrees of freedom
88 virtual int dof() const;
91 /// \brief Check whether degenerated arcs exist
92 bool hasDegeneratedArcs() const;
95 Slvs_System myEquationsSystem; ///< set of equations for solving in SolveSpace
96 Slvs_Param* myParamsCopy; ///< copy of parameters