// Class: SketchSolver_ConstraintGroup
// Purpose: solve the set of constraints for the current group
// ============================================================================
-void SketchSolver_ConstraintGroup::resolveConstraints()
+bool SketchSolver_ConstraintGroup::resolveConstraints()
{
if (!myNeedToSolve)
- return;
+ return false;
myConstrSolver.setGroupID(myID);
myConstrSolver.setParameters(myParams);
if (aResult == SLVS_RESULT_OKAY) { // solution succeeded, store results into correspondent attributes
// Obtain result into the same list of parameters
if (!myConstrSolver.getResult(myParams))
- return;
+ return true;
// We should go through the attributes map, because only attributes have valued parameters
std::map<boost::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::iterator anEntIter =
removeTemporaryConstraints();
myNeedToSolve = false;
+ return true;
}
// ============================================================================
void splitGroup(std::vector<SketchSolver_ConstraintGroup*>& theCuts);
/** \brief Start solution procedure if necessary and update attributes of features
+ * \return \c false when no need to solve constraints
*/
- void resolveConstraints();
+ bool resolveConstraints();
/** \brief Searches the constraints built on the entity and emit the signal to update them
* \param[in] theEntity attribute of the constraint
// ============================================================================
void SketchSolver_ConstraintManager::resolveConstraints()
{
+ bool needToUpdate = false;
std::vector<SketchSolver_ConstraintGroup*>::iterator aGroupIter;
for (aGroupIter = myGroups.begin(); aGroupIter != myGroups.end(); aGroupIter++)
- (*aGroupIter)->resolveConstraints();
+ if ((*aGroupIter)->resolveConstraints())
+ needToUpdate = true;
// Features may be updated => send events
- Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
+ if (needToUpdate)
+ Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
}