Salome HOME
Improve sketch performance while moving entities
authorazv <azv@opencascade.com>
Thu, 27 Apr 2017 07:52:15 +0000 (10:52 +0300)
committerazv <azv@opencascade.com>
Thu, 27 Apr 2017 07:52:15 +0000 (10:52 +0300)
src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp
src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateCoincidence.cpp

index eb8868409fbcf49e072b8d6d122525737f3beeed..d06446e6f534ccb4d22fe7c0845a60f74e77c6a7 100644 (file)
@@ -35,7 +35,8 @@ void PlaneGCSSolver_Solver::addConstraint(GCSConstraintPtr theConstraint)
 {
   myEquationSystem->addConstraint(theConstraint.get());
   myConstraints[theConstraint->getTag()].insert(theConstraint);
-  myDOF = -1;
+  if (theConstraint->getTag() >= 0)
+    myDOF = -1;
 }
 
 void PlaneGCSSolver_Solver::removeConstraint(ConstraintID theID)
@@ -46,7 +47,8 @@ void PlaneGCSSolver_Solver::removeConstraint(ConstraintID theID)
     myDOF = (int)myParameters.size();
   } else {
     myEquationSystem->clearByTag(theID);
-    myDOF = -1;
+    if (theID >= 0)
+      myDOF = -1;
   }
 }
 
index 51cf2f9854d2b218cba0bc3cfe9c37c3d3191777..1b7252e2bf17abf6fb2ef1ebe50ba6c1232b7fb1 100644 (file)
@@ -18,12 +18,11 @@ void PlaneGCSSolver_UpdateCoincidence::attach(SketchSolver_Constraint* theObserv
 {
   if (theType == GROUP()) {
     std::list<SketchSolver_Constraint*>::iterator aPlaceToAdd = myObservers.end();
-    // point-point coincidence is placed first
-    if (theObserver->getType() == CONSTRAINT_PT_PT_COINCIDENT) {
-      for (aPlaceToAdd = myObservers.begin(); aPlaceToAdd != myObservers.end(); ++aPlaceToAdd)
-        if ((*aPlaceToAdd)->getType() != CONSTRAINT_PT_PT_COINCIDENT)
-          break;
-    }
+    // point-point coincidence is placed first,
+    // other constraints are sorted by their type
+    for (aPlaceToAdd = myObservers.begin(); aPlaceToAdd != myObservers.end(); ++aPlaceToAdd)
+      if ((*aPlaceToAdd)->getType() > theObserver->getType())
+        break;
     myObservers.insert(aPlaceToAdd, theObserver);
   } else
     myNext->attach(theObserver, theType);