Salome HOME
Update unit tests for the PlaneGCS solver. Bug fixes.
[modules/shaper.git] / src / SketchSolver / SketchSolver_Storage.cpp
index e606f44c132d84324274139e8eaac3bcc90e9c0d..8370549174a16d7acc09de33e539a67599f88123 100644 (file)
@@ -76,7 +76,7 @@ void SketchSolver_Storage::addConstraint(
   if (!theSolverConstraints.empty() || aFound == myConstraintMap.end())
     myConstraintMap[theConstraint] = theSolverConstraints;
   // block events if necessary
-  if (myEventsBlocked && theConstraint->data() && theConstraint->data()->isValid())
+  if (myEventsBlocked && theConstraint && theConstraint->data() && theConstraint->data()->isValid())
     theConstraint->data()->blockSendAttributeUpdated(myEventsBlocked);
 }
 
@@ -652,6 +652,21 @@ void SketchSolver_Storage::blockEvents(bool 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;
+}