From: azv Date: Wed, 2 Sep 2015 14:05:33 +0000 (+0300) Subject: Application crashes during sketching (issue #872) X-Git-Tag: V_1.4.0_beta4~148 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8014d0ac5139d9289e7dabb514ecaba8f263db0c;p=modules%2Fshaper.git Application crashes during sketching (issue #872) Multi-coincidence with external point was implemented --- diff --git a/src/SketchSolver/SketchSolver_ConstraintCoincidence.cpp b/src/SketchSolver/SketchSolver_ConstraintCoincidence.cpp index 0e6ee7490..205c744e9 100644 --- a/src/SketchSolver/SketchSolver_ConstraintCoincidence.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintCoincidence.cpp @@ -2,6 +2,8 @@ #include #include +#include + #include void SketchSolver_ConstraintCoincidence::getAttributes( @@ -169,9 +171,12 @@ void SketchSolver_ConstraintCoincidence::addConstraint(ConstraintPtr theConstrai Slvs_hEntity anEntity = SLVS_E_UNKNOWN; int anEntType; for (; anIter != anAttrList.end(); anIter++) { + Slvs_hEntity aPointID = SLVS_E_UNKNOWN; AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast(*anIter); if (!aRefAttr) continue; + + AttributePtr aPointAttr; if (aRefAttr->isObject()) { FeaturePtr aFeature = ModelAPI_Feature::feature(aRefAttr->object()); std::map::const_iterator aFeatFound = @@ -185,21 +190,29 @@ void SketchSolver_ConstraintCoincidence::addConstraint(ConstraintPtr theConstrai else myFeatureMap[aFeature] = anEntity; } + // If the feature is a point, add it to the list of coincident points + if (aFeature->getKind() == SketchPlugin_Point::ID()) { + aPointID = anEntity; + anEntity = SLVS_E_UNKNOWN; + aPointAttr = aFeature->attribute(SketchPlugin_Point::COORD_ID()); + } } else { - Slvs_hEntity anEntID = SLVS_E_UNKNOWN; + aPointAttr = aRefAttr->attr(); std::map::const_iterator anAttrFound = - myAttributeMap.find(aRefAttr->attr()); + myAttributeMap.find(aPointAttr); if (anAttrFound != myAttributeMap.end()) - anEntID = anAttrFound->second; + aPointID = anAttrFound->second; else { - anEntID = myGroup->getAttributeId(aRefAttr->attr()); - if (anEntID == SLVS_E_UNKNOWN) - anEntID = changeEntity(aRefAttr->attr(), anEntType); - else - myAttributeMap[aRefAttr->attr()] = anEntID; + aPointID = myGroup->getAttributeId(aPointAttr); + if (aPointID == SLVS_E_UNKNOWN) + aPointID = changeEntity(aPointAttr, anEntType); } - aPoints.push_back(anEntID); - myCoincidentPoints.insert(aRefAttr->attr()); + } + + if (aPointAttr) { // the point is found + aPoints.push_back(aPointID); + myCoincidentPoints.insert(aPointAttr); + myAttributeMap[aPointAttr] = aPointID; } }