]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/SketchSolver/SketchSolver_Group.cpp
Salome HOME
Sending by sketcher the list of constraints which are not conflicting already.
[modules/shaper.git] / src / SketchSolver / SketchSolver_Group.cpp
index d6c8b0218cd86e6547b1cc33d9cad5c8e98115fd..204410560c943f4996ea32b18f7441457456eb9a 100644 (file)
@@ -98,6 +98,11 @@ SketchSolver_Group::~SketchSolver_Group()
 {
   myConstraints.clear();
   GroupIndexer::REMOVE_GROUP(myID);
+  // send the message that there is no more conflicting constraints
+  if (!myConflictingConstraints.empty()) {
+    sendMessage(EVENT_SOLVER_REPAIRED, myConflictingConstraints);
+    myConflictingConstraints.clear();
+  }
 }
 
 // ============================================================================
@@ -345,20 +350,31 @@ bool SketchSolver_Group::resolveConstraints()
       if (myPrevResult != STATUS_OK || myPrevResult == STATUS_UNKNOWN) {
         getWorkplane()->string(SketchPlugin_Sketch::SOLVER_ERROR())->setValue("");
         // the error message should be changed before sending the message
-        sendMessage(EVENT_SOLVER_REPAIRED);
+        sendMessage(EVENT_SOLVER_REPAIRED, myConflictingConstraints);
+        myConflictingConstraints.clear();
         myPrevResult = STATUS_OK;
       }
     } else {
       mySketchSolver->undo();
       if (!myConstraints.empty()) {
-//      Events_Error::send(SketchSolver_Error::CONSTRAINTS(), this);
+        // the error message should be changed before sending the message
         getWorkplane()->string(SketchPlugin_Sketch::SOLVER_ERROR())->setValue(SketchSolver_Error::CONSTRAINTS());
         if (myPrevResult != aResult || myPrevResult == STATUS_UNKNOWN) {
           // Obtain list of conflicting constraints
           std::set<ObjectPtr> aConflicting = myStorage->getConflictingConstraints(mySketchSolver);
 
-          // the error message should be changed before sending the message
-          sendMessage(EVENT_SOLVER_FAILED, aConflicting);
+          if (myConflictingConstraints.empty())
+            sendMessage(EVENT_SOLVER_FAILED, aConflicting);
+          else {
+            std::set<ObjectPtr>::iterator anIt = aConflicting.begin();
+            for (; anIt != aConflicting.end(); ++anIt)
+              myConflictingConstraints.erase(*anIt);
+            if (!myConflictingConstraints.empty()) {
+              // some constraints does not conflict, send corresponding message
+              sendMessage(EVENT_SOLVER_REPAIRED, myConflictingConstraints);
+            }
+          }
+          myConflictingConstraints = aConflicting;
           myPrevResult = aResult;
         }
       }