X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchSolver%2FSketchSolver_Solver.h;h=8a4f9964e95a7795389fc3563c538b99a22c91d2;hb=329d73a7dbce38e38063ff41186be492e3529ab5;hp=beb2f249f7d24b321c87bb31435745e3adc74e0e;hpb=7ecefe4ca74618ab6fc2e7990b6ad50c12bca63c;p=modules%2Fshaper.git diff --git a/src/SketchSolver/SketchSolver_Solver.h b/src/SketchSolver/SketchSolver_Solver.h index beb2f249f..8a4f9964e 100644 --- a/src/SketchSolver/SketchSolver_Solver.h +++ b/src/SketchSolver/SketchSolver_Solver.h @@ -7,4 +7,72 @@ #include "SketchSolver.h" +// Need to be defined before including SolveSpace to avoid additional dependances on Windows platform +#if defined(WIN32) && !defined(HAVE_C99_INTEGER_TYPES) +typedef unsigned int UINT32; +#else +#include +#endif +#include +#include + +#include + + +#define SLVS_RESULT_EMPTY_SET -1 + +// Unknown constraint (for error reporting) +#define SLVS_C_UNKNOWN 0 +// Unknown entity +#define SLVS_E_UNKNOWN 0 + + +class SketchSolver_Solver +{ +public: + SketchSolver_Solver(); + ~SketchSolver_Solver(); + + /** \brief Initialize the ID of the group + */ + inline void setGroupID(Slvs_hGroup theGroupID) + { myGroupID = theGroupID; } + + /** \brief Change array of parameters + * \param[in] theParameters vector of parameters + */ + void setParameters(const std::vector& theParameters); + + /** \brief Change array of entities + * \param[in] theEntities vector of entities + */ + void setEntities(const std::vector& theEntities); + + /** \brief Change array of constraints + * \param[in] theConstraints vector of constraints + */ + void setConstraints(const std::vector& theConstraints); + + /** \brief Store the parameters of the point which was moved by user. + * The solver will watch this items to be constant + * \param[in] theDragged list of parameters (not more than 4) which should not be changed during solving + */ + void setDraggedParameters(const std::vector& theDragged); + + /** \brief Solve the set of equations + * \return identifier whether solution succeeded + */ + int solve(); + + /** \brief Updates the list of parameters by calculated values + * \param[in,out] theParameters parameters to be updated + * \return \c true if parameters are updated correctly + */ + bool getResult(std::vector& theParameters); + +private: + Slvs_hGroup myGroupID; ///< identifier of the group to be solved + Slvs_System myEquationsSystem; ///< set of equations for solving in SolveSpace +}; + #endif