X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchSolver%2FSketchSolver_ConstraintCoincidence.cpp;h=04e6db8d21c62e7c460d973106f8c830f7c4b664;hb=f003def34d1a3dd56e87329920d1950f080c58d1;hp=2afdbcf0d9ac9d8c67f85b0da750f878cfd81fa1;hpb=fd556d4df75f186c53769fb0e69b0c02ce8aec84;p=modules%2Fshaper.git diff --git a/src/SketchSolver/SketchSolver_ConstraintCoincidence.cpp b/src/SketchSolver/SketchSolver_ConstraintCoincidence.cpp index 2afdbcf0d..04e6db8d2 100644 --- a/src/SketchSolver/SketchSolver_ConstraintCoincidence.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintCoincidence.cpp @@ -4,6 +4,30 @@ #include +void SketchSolver_ConstraintCoincidence::getAttributes( + double& theValue, + std::vector& theAttributes) +{ + SketchSolver_Constraint::getAttributes(theValue, theAttributes); + if (!myErrorMsg.empty() || theAttributes[0] == SLVS_E_UNKNOWN) + return; + + if (theAttributes[1] != SLVS_E_UNKNOWN) + myType = SLVS_C_POINTS_COINCIDENT; + else if (theAttributes[2] != SLVS_E_UNKNOWN) { + // check the type of entity (line or circle) + Slvs_Entity anEnt = myStorage->getEntity(theAttributes[2]); + if (anEnt.type == SLVS_E_LINE_SEGMENT) + myType = SLVS_C_PT_ON_LINE; + else if (anEnt.type == SLVS_E_CIRCLE || anEnt.type == SLVS_E_ARC_OF_CIRCLE) + myType = SLVS_C_PT_ON_CIRCLE; + else + myErrorMsg = SketchSolver_Error::INCORRECT_ATTRIBUTE(); + } else + myErrorMsg = SketchSolver_Error::INCORRECT_ATTRIBUTE(); +} + + bool SketchSolver_ConstraintCoincidence::hasConstraint(ConstraintPtr theConstraint) const { if (myBaseConstraint == theConstraint) @@ -28,6 +52,10 @@ std::list SketchSolver_ConstraintCoincidence::constraints() const bool SketchSolver_ConstraintCoincidence::isCoincide( std::shared_ptr theConstraint) const { + // Multi-coincidence allowed for two points only + if (getType() != theConstraint->getType() || getType() != SLVS_C_POINTS_COINCIDENT) + return false; + std::set::const_iterator anAttrIter = theConstraint->myCoincidentPoints.begin(); for (; anAttrIter != theConstraint->myCoincidentPoints.end(); anAttrIter++) if (myCoincidentPoints.find(*anAttrIter) != myCoincidentPoints.end())