const Model_FeatureUpdatedMessage* anUpdateMsg = dynamic_cast<const Model_FeatureUpdatedMessage*>(theMessage);
std::set< boost::shared_ptr<ModelAPI_Feature> > aFeatures = anUpdateMsg->features();
- if (!(theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURES_MOVED)))
+ bool isModifiedEvt = theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURES_MOVED);
+ if (!isModifiedEvt)
{
std::set< boost::shared_ptr<ModelAPI_Feature> >::iterator aFeatIter;
for (aFeatIter = aFeatures.begin(); aFeatIter != aFeatures.end(); aFeatIter++)
}
// Solve the set of constraints
- resolveConstraints();
+ resolveConstraints(isModifiedEvt);
}
else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURE_DELETED))
{
return boost::shared_ptr<SketchPlugin_Feature>();
}
-void SketchSolver_ConstraintManager::resolveConstraints()
+void SketchSolver_ConstraintManager::resolveConstraints(const bool needEvent)
{
std::vector<SketchSolver_ConstraintGroup*>::iterator aGroupIter;
for (aGroupIter = myGroups.begin(); aGroupIter != myGroups.end(); aGroupIter++)
(*aGroupIter)->resolveConstraints();
// Features may be updated => send events
- Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_UPDATED));
+ if (needEvent)
+ Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_UPDATED));
}
void updateEntity(boost::shared_ptr<SketchPlugin_Feature> theFeature);
/** \brief Goes through the list of groups and solve the constraints
+ * \param[in] needEvent shows that some features are probably updated and Update event should be thrown
*/
- void resolveConstraints();
+ void resolveConstraints(const bool needEvent);
private:
class SketchSolver_ConstraintGroup;