{
myEquationSystem->addConstraint(theConstraint.get());
myConstraints[theConstraint->getTag()].insert(theConstraint);
- myDOF = -1;
+ if (theConstraint->getTag() >= 0)
+ myDOF = -1;
}
void PlaneGCSSolver_Solver::removeConstraint(ConstraintID theID)
myDOF = (int)myParameters.size();
} else {
myEquationSystem->clearByTag(theID);
- myDOF = -1;
+ if (theID >= 0)
+ myDOF = -1;
}
}
{
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);