1 #include <SketchSolver_ConstraintEqual.h>
2 #include <SketchSolver_Error.h>
4 void SketchSolver_ConstraintEqual::getAttributes(
6 std::vector<EntityWrapperPtr>& theAttributes)
8 SketchSolver_Constraint::getAttributes(theValue, theAttributes);
9 if (!myErrorMsg.empty() || !theAttributes[2] || !theAttributes[3]) {
10 theAttributes.clear();
14 // Check the quantity of entities of each type
18 bool isArcFirst = false; // in line-arc equivalence, the line should be first
19 std::vector<EntityWrapperPtr>::iterator anAttrIt = theAttributes.begin() + 2;
20 for (; anAttrIt != theAttributes.end(); ++anAttrIt) {
21 SketchSolver_EntityType aType = (*anAttrIt)->type();
22 if (aType == ENTITY_LINE)
24 else if (aType == ENTITY_CIRCLE)
26 else if (aType == ENTITY_ARC) {
28 isArcFirst = (aNbLines == 0);
32 if (aNbLines + aNbArcs + aNbCircs != 2 ||
33 (aNbLines == aNbCircs && aNbArcs == 0)) {
34 myErrorMsg = SketchSolver_Error::INCORRECT_ATTRIBUTE();
40 myType = CONSTRAINT_EQUAL_RADIUS;
43 myType = CONSTRAINT_EQUAL_LINE_ARC;
44 if (isArcFirst) { // change the order of arc and line
45 EntityWrapperPtr aTmp = theAttributes[2];
46 theAttributes[2] = theAttributes[3];
47 theAttributes[3] = aTmp;
51 myType = CONSTRAINT_EQUAL_LINES;