-#include <map>
-
-bool SketchSolver_ConstraintCoincidence::hasConstraint(ConstraintPtr theConstraint) const
-{
- if (myBaseConstraint == theConstraint)
- return true;
- std::map<Slvs_hConstraint, ConstraintPtr>::const_iterator anIt = myExtraCoincidence.begin();
- for (; anIt != myExtraCoincidence.end(); anIt++)
- if (anIt->second == theConstraint)
- return true;
- return false;
-}
-
-std::list<ConstraintPtr> SketchSolver_ConstraintCoincidence::constraints() const
-{
- std::list<ConstraintPtr> aConstraints;
- aConstraints.push_back(myBaseConstraint);
- std::map<Slvs_hConstraint, ConstraintPtr>::const_iterator anIt = myExtraCoincidence.begin();
- for (; anIt != myExtraCoincidence.end(); anIt++)
- aConstraints.push_back(anIt->second);
- return aConstraints;
-}
-
-bool SketchSolver_ConstraintCoincidence::isCoincide(
- std::shared_ptr<SketchSolver_ConstraintCoincidence> theConstraint) const
-{
- std::set<AttributePtr>::const_iterator anAttrIter = theConstraint->myCoincidentPoints.begin();
- for (; anAttrIter != theConstraint->myCoincidentPoints.end(); anAttrIter++)
- if (myCoincidentPoints.find(*anAttrIter) != myCoincidentPoints.end())
- return true;
- return false;
-}
-
-void SketchSolver_ConstraintCoincidence::attach(
- std::shared_ptr<SketchSolver_ConstraintCoincidence> theConstraint)
-{
- cleanErrorMsg();
- Slvs_Constraint aBaseCoincidence = myStorage->getConstraint(mySlvsConstraints.front());
- // Remove constraints from theConstraint
- std::vector<Slvs_hConstraint>::iterator aCIter = theConstraint->mySlvsConstraints.begin();
- for (; aCIter != theConstraint->mySlvsConstraints.end(); aCIter++)
- theConstraint->myStorage->removeConstraint(*aCIter);
-
- if (myStorage == theConstraint->myStorage) {
- // Clean removed items
- std::set<Slvs_hParam> aRemParams;
- std::set<Slvs_hEntity> aRemEnts;
- std::set<Slvs_hConstraint> aRemConstr;
- theConstraint->myStorage->getRemoved(aRemParams, aRemEnts, aRemConstr);
- }
-
- // Copy data.
- addConstraint(theConstraint->myBaseConstraint);
- std::map<Slvs_hConstraint, ConstraintPtr>::iterator aConstrIter =
- theConstraint->myExtraCoincidence.begin();
- for (; aConstrIter != theConstraint->myExtraCoincidence.end(); aConstrIter++)
- addConstraint(aConstrIter->second);
- // Clear the lists to not remove the entities on destruction
- theConstraint->mySlvsConstraints.clear();
- theConstraint->myFeatureMap.clear();
- theConstraint->myAttributeMap.clear();
-}
-
-Slvs_hConstraint SketchSolver_ConstraintCoincidence::addConstraint(
- Slvs_hEntity thePoint1, Slvs_hEntity thePoint2)