X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchSolver%2FSketchSolver_Manager.h;h=c1e853603273d070854a9f1d1a98b0460ae796a6;hb=4f565b2204d3fba046aa8c851abada2a5a17bf6c;hp=6883cd44877d27e2eded0acde185eeb3f7ecb63d;hpb=fd7266e083c3fb837b8b195b1db746fdbd7b2be8;p=modules%2Fshaper.git diff --git a/src/SketchSolver/SketchSolver_Manager.h b/src/SketchSolver/SketchSolver_Manager.h index 6883cd448..c1e853603 100644 --- a/src/SketchSolver/SketchSolver_Manager.h +++ b/src/SketchSolver/SketchSolver_Manager.h @@ -14,7 +14,7 @@ #include #include -#include +#include #include /** \class SketchSolver_Manager @@ -41,6 +41,12 @@ public: */ virtual void processEvent(const std::shared_ptr& theMessage); + /** + * The solver needs all the updated objects are transfered in one group, not one by one. + * This iscreases performance and avoids problems in resolve of only part of the made updates. + */ + virtual bool groupMessages(); + /// \brief Initialize builder for solver's data structure entities /// \param theBuilder [in] solver's specific builder SKETCHSOLVER_EXPORT void setBuilder(BuilderPtr theBuilder); @@ -79,13 +85,17 @@ protected: /** \brief Updates entity which is moved in GUI * \param[in] theFeature entity to be updated + * \return \c true, if the entity has been moved */ - void moveEntity(std::shared_ptr theFeature); + bool moveEntity(std::shared_ptr theFeature); /** \brief Goes through the list of groups and solve the constraints - * \return \c true, if groups are resolved, and features should be updated (send the Update event) + * \param[in] theGroups list of groups to be resolved (if empty list, all groups are resolved) + * \return \c true, if groups are resolved, and features should be updated + * (send the Update event) */ - bool resolveConstraints(); + bool resolveConstraints(const std::list& theGroups = + std::list()); private: /** \brief Searches list of groups which interact with specified feature @@ -108,13 +118,22 @@ private: /// \brief Allow to send the Update event void allowSendUpdate() const; + /// \brief If the message shows that any group is repaired after conflicting, + /// find other groups on the same sketch, which have conflicts. + void checkConflictingConstraints(const std::shared_ptr& theMessage); + + /// \brief Calculate DoF for each sketch and send messages if changed + void degreesOfFreedom(); + private: static SketchSolver_Manager* mySelf; ///< Self pointer to implement singleton functionality - std::vector myGroups; ///< Groups of constraints + std::list myGroups; ///< Groups of constraints BuilderPtr myBuilder; ///< Builder for solver's entities /// true if computation is performed and all "updates" are generated by this algo /// and needs no recomputation bool myIsComputed; + + std::map myDoF; ///< Degree of freedom for corresponding sketch }; #endif