- return theConstraint1.ptA != theConstraint2.ptA ||
- theConstraint1.ptB != theConstraint2.ptB ||
- theConstraint1.entityA != theConstraint2.entityA ||
- theConstraint1.entityB != theConstraint2.entityB ||
- theConstraint1.entityC != theConstraint2.entityC ||
- theConstraint1.entityD != theConstraint2.entityD ||
- fabs(theConstraint1.valA - theConstraint2.valA) > tolerance;
+ if (isBlocked == myEventsBlocked)
+ return;
+
+ std::map<ConstraintPtr, std::list<ConstraintWrapperPtr> >::const_iterator
+ aCIter = myConstraintMap.begin();
+ for (; aCIter != myConstraintMap.end(); aCIter++)
+ if (aCIter->first->data() && aCIter->first->data()->isValid())
+ aCIter->first->data()->blockSendAttributeUpdated(isBlocked);
+
+ std::map<FeaturePtr, EntityWrapperPtr>::const_iterator aFIter = myFeatureMap.begin();
+ for (; aFIter != myFeatureMap.end(); aFIter++)
+ if (aFIter->first->data() && aFIter->first->data()->isValid())
+ aFIter->first->data()->blockSendAttributeUpdated(isBlocked);
+
+ std::map<AttributePtr, EntityWrapperPtr>::const_iterator anAtIter = myAttributeMap.begin();
+ for (; anAtIter != myAttributeMap.end(); anAtIter++)
+ if (anAtIter->first->owner() && anAtIter->first->owner()->data() &&
+ anAtIter->first->owner()->data()->isValid())
+ anAtIter->first->owner()->data()->blockSendAttributeUpdated(isBlocked);
+ myEventsBlocked = isBlocked;
+}
+
+std::set<ObjectPtr> SketchSolver_Storage::getConflictingConstraints(SolverPtr theSolver) const
+{
+ std::set<ObjectPtr> aConflicting;
+ std::map<ConstraintPtr, std::list<ConstraintWrapperPtr> >::const_iterator
+ aConstrIt = myConstraintMap.begin();
+ for (; aConstrIt != myConstraintMap.end(); ++aConstrIt) {
+ std::list<ConstraintWrapperPtr>::const_iterator anIt = aConstrIt->second.begin();
+ for (; anIt != aConstrIt->second.end(); ++anIt)
+ if (theSolver->isConflicting((*anIt)->id())) {
+ aConflicting.insert(aConstrIt->first);
+ break;
+ }
+ }
+ return aConflicting;
+}
+
+
+
+
+
+// ============== Auxiliary functions ====================================
+bool isEqual(const std::list<ConstraintWrapperPtr>& theCVec1,
+ const std::list<ConstraintWrapperPtr>& theCVec2)
+{
+ if (theCVec1.size() != theCVec2.size())
+ return false;
+
+ std::list<bool> aChecked(theCVec2.size(), false);
+ std::list<ConstraintWrapperPtr>::const_iterator anIt1 = theCVec1.begin();
+ for (; anIt1 != theCVec1.end(); ++anIt1) {
+ std::list<ConstraintWrapperPtr>::const_iterator anIt2 = theCVec2.begin();
+ std::list<bool>::iterator aCheckIt = aChecked.begin();
+ while (aCheckIt != aChecked.end() && *aCheckIt) {
+ ++aCheckIt;
+ ++anIt2;
+ }
+ for (; anIt2 != theCVec2.end(); ++anIt2, ++aCheckIt)
+ if (!(*aCheckIt) && (*anIt1)->isEqual(*anIt2)) {
+ *aCheckIt = true;
+ break;
+ }
+ // the same constraint is not found
+ if (anIt2 == theCVec2.end())
+ return false;
+ }
+ return true;