- void ResolveConstraints();
-
-private:
- class SketchSolver_ConstraintGroup;
-
- /** \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
- */
- void findGroups(boost::shared_ptr<SketchPlugin_Constraint> theConstraint,
- std::vector<Slvs_hGroup>& theGroupIDs) const;
-
- /** \brief Searches in the list of groups the workplane which constains specified constraint
- * \param[in] theConstraint constraint to be found
- * \return workplane contains the constraint
- */
- boost::shared_ptr<SketchPlugin_Sketch> findWorkplaneForConstraint(
- boost::shared_ptr<SketchPlugin_Constraint> theConstraint) const;
-
-private:
- static SketchSolver_ConstraintManager* _self; ///< Self pointer to implement singleton functionality
- std::vector<SketchSolver_ConstraintGroup*> myGroups; ///< Groups of constraints
-};
-
-
-/** \class SketchSolver_ConstraintGroup
- * \ingroup DataModel
- * \brief Keeps the group of constraints which based on the same entities
- */
-class SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup
-{
-public:
- /** \brief New group based on specified workplane
- */
- SketchSolver_ConstraintGroup(boost::shared_ptr<SketchPlugin_Sketch> theWorkplane);
-
- ~SketchSolver_ConstraintGroup();
-
- /// \brief Returns group's unique identifier
- const Slvs_hGroup& getId() const
- {return myID;}
-
- /** \brief Adds or updates a constraint in the group
- * \param[in] theConstraint constraint to be changed
- * \return \c true if the constraint added or updated successfully
- */
- bool changeConstraint(boost::shared_ptr<SketchPlugin_Constraint> theConstraint);
-
- /** \brief Removes a constraint into the group
- * \param[in] theConstraint constraint to be removed
- * \return \c true if the constraint removed successfully
- */
- bool removeConstraint(boost::shared_ptr<SketchPlugin_Constraint> theConstraint);
-
- /** \brief Verifies the constraint uses the objects from this group
- * \param[in] theConstraint constraint for verification of interaction
- * \return \c true if the constrained objects are used in current group
- */
- bool isInteract(boost::shared_ptr<SketchPlugin_Constraint> theConstraint) const;
-
- /** \brief Verifies the specified workplane is the same as a base workplane for this group
- * \param[in] theWorkplane workplane to be compared
- * \return \c true if workplanes are the same
- */
- bool isBaseWorkplane(boost::shared_ptr<SketchPlugin_Sketch> theWorkplane) const;
-
- boost::shared_ptr<SketchPlugin_Sketch> getWorkplane() const
- { return mySketch; }
-
- /** \brief Update parameters of workplane. Should be called when Update event is coming.
- * \return \c true if workplane updated successfully, \c false if workplane parameters are not consistent
- */
- bool updateWorkplane();
-
- /** \brief If the entity is in this group it will updated
- * \param[in] theEntity attribute, which values should update SolveSpace entity
- */
- void updateEntityIfPossible(boost::shared_ptr<ModelAPI_Attribute> theEntity);
-
- /** \brief Start solution procedure if necessary and update attributes of features
- */
- void ResolveConstraints();
-
-protected:
- /** \brief Adds or updates an entity in the group
- *
- * The parameters of entity will be parsed and added to the list of SolveSpace parameters.
- * Parameters of certain entity will be placed sequentially in the list.
- *
- * \param[in] theEntity the object of constraint
- * \return identifier of changed entity or 0 if entity could not be changed
- */
- Slvs_hEntity changeEntity(boost::shared_ptr<ModelAPI_Attribute> theEntity);