isNew = true;
if (isNew) {
mySolverConstraint = createPointsOnLine(aPoints[0], aPoints[1], aLine);
- myStorage->removeConstraint(myBaseConstraint);
- myStorage->addConstraint(myBaseConstraint, mySolverConstraint);
+ if (myInSolver) {
+ myStorage->removeConstraint(myBaseConstraint);
+ myInSolver = false;
+ }
+ if (mySolverConstraint) {
+ myStorage->addConstraint(myBaseConstraint, mySolverConstraint);
+ myInSolver = true;
+ }
+
+ for (int i = 0; i < 4; ++i)
+ myIsConstraintApplied[i] = aConstraintToApply[i];
}
}
public:
/// Constructor based on SketchPlugin constraint
SketchSolver_ConstraintCollinear(ConstraintPtr theConstraint)
- : SketchSolver_Constraint(theConstraint)
+ : SketchSolver_Constraint(theConstraint),
+ myInSolver(false)
{
for (int i = 0; i < 4; ++i)
myIsConstraintApplied[i] = false;
private:
EntityWrapperPtr myPoints[4]; ///< extremities on collinear lines
bool myIsConstraintApplied[4]; ///< set \c true if point on opposite line
+ bool myInSolver; ///< the constraint is added to the solver
};
#endif