X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchSolver%2FSketchSolver_ConstraintManager.h;h=a2d7ffaffe580a08ca944a71938b56dfae64092d;hb=fdf05fdbacbddf319df9770cddafaaa09e8cd1a4;hp=4101906ab743d4b869d87615c83c3899bdcb024c;hpb=8dc74f82810d5f597b78633b457efb0ef4f89f9f;p=modules%2Fshaper.git diff --git a/src/SketchSolver/SketchSolver_ConstraintManager.h b/src/SketchSolver/SketchSolver_ConstraintManager.h index 4101906ab..a2d7ffaff 100644 --- a/src/SketchSolver/SketchSolver_ConstraintManager.h +++ b/src/SketchSolver/SketchSolver_ConstraintManager.h @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + // File: SketchSolver_ConstraintManager.h // Created: 08 May 2014 // Author: Artem ZHIDKOV @@ -7,7 +9,7 @@ #include "SketchSolver.h" #include -#include +#include #include #include @@ -21,7 +23,7 @@ #include /** \class SketchSolver_ConstraintManager - * \ingroup DataModel + * \ingroup Plugins * \brief Listens the changes of SketchPlugin features and transforms the Constraint * feature into the format understandable by SolveSpace library. * @@ -42,65 +44,69 @@ class SketchSolver_ConstraintManager : public Events_Listener /** \brief Implementation of Event Listener method * \param[in] theMessage the data of the event */ - virtual void processEvent(const Events_Message* theMessage); + virtual void processEvent(const std::shared_ptr& theMessage); protected: SketchSolver_ConstraintManager(); ~SketchSolver_ConstraintManager(); - /** \brief Adds or updates a constraint in the suitable group - * \param[in] theConstraint constraint to be changed - * \return \c true if the constraint changed successfully + /** \brief Adds or updates a constraint or an entity in the suitable group + * \param[in] theFeature sketch feature to be changed + * \return \c true if the feature changed successfully */ - bool changeConstraint(boost::shared_ptr theConstraint); + bool changeConstraintOrEntity(std::shared_ptr theFeature); /** \brief Removes a constraint from the manager * \param[in] theConstraint constraint to be removed * \return \c true if the constraint removed successfully */ - bool removeConstraint(boost::shared_ptr theConstraint); + bool removeConstraint(std::shared_ptr theConstraint); /** \brief Adds or updates a workplane in the manager * \param[in] theSketch the feature to create or update workplane * \return \c true if the workplane changed successfully * \remark Type of theSketch is not verified inside */ - bool changeWorkplane(boost::shared_ptr theSketch); + bool changeWorkplane(CompositeFeaturePtr theSketch); /** \brief Removes a workplane from the manager. * All groups based on such workplane will be removed too. * \param[in] theSketch the feature to be removed * \return \c true if the workplane removed successfully */ - bool removeWorkplane(boost::shared_ptr theSketch); + bool removeWorkplane(std::shared_ptr theSketch); - /** \brief Updates entity which is neither workplane nor constraint + /** \brief Updates entity which is moved in GUI * \param[in] theFeature entity to be updated */ - void updateEntity(boost::shared_ptr theFeature); + void moveEntity(std::shared_ptr theFeature); /** \brief Goes through the list of groups and solve the constraints + * \param theForceUpdate flushes the update event in any case: something changed or not */ - void resolveConstraints(); + void resolveConstraints(const bool theForceUpdate); private: - /** \brief Searches list of groups which interact with specified constraint - * \param[in] theConstraint constraint to be found - * \param[out] theGroups list of group indexes interacted with constraint + /** \brief Searches list of groups which interact with specified feature + * \param[in] theFeature object to be found + * \param[out] theGroups list of group indexes interacted with the feature */ - void findGroups(boost::shared_ptr theConstraint, + void findGroups(std::shared_ptr theFeature, std::set& theGroupIDs) const; - /** \brief Searches in the list of groups the workplane which constains specified constraint - * \param[in] theConstraint constraint to be found - * \return workplane containing the constraint + /** \brief Searches in the list of groups the workplane which constains specified feature + * \param[in] theFeature object to be found + * \return workplane containing the feature */ - boost::shared_ptr findWorkplaneForConstraint( - boost::shared_ptr theConstraint) const; + std::shared_ptr findWorkplane( + std::shared_ptr theFeature) const; private: static SketchSolver_ConstraintManager* _self; ///< Self pointer to implement singleton functionality - std::vector myGroups; ///< Groups of constraints + std::vector myGroups; ///< Groups of constraints + /// true if computation is performed and all "updates" are generated by this algo + /// and needs no recomputation + bool myIsComputed; }; #endif