X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchSolver%2FSketchSolver_ConstraintTangent.cpp;h=22516bff36b9ad9ca01c77ba321d0a0d5d864b33;hb=06e7f5859095193fc7f498bd89a7d28009794f53;hp=f3832c24521f674cbd626acfe6815bf18710d33e;hpb=e05cf89c2b21303c51d9102315a82ac095eed3df;p=modules%2Fshaper.git diff --git a/src/SketchSolver/SketchSolver_ConstraintTangent.cpp b/src/SketchSolver/SketchSolver_ConstraintTangent.cpp index f3832c245..22516bff3 100644 --- a/src/SketchSolver/SketchSolver_ConstraintTangent.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintTangent.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2019 CEA/DEN, EDF R&D +// Copyright (C) 2014-2023 CEA, EDF // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -31,6 +31,8 @@ #include #include +#include + #include #include @@ -423,7 +425,7 @@ std::set coincidentBoundaryPoints(FeaturePtr theFeature1, FeatureP { std::set aCoincidences = collectCoincidences(theFeature1, theFeature2); // collect points only - std::set aCoincidentPoints; + std::map > aCoincidentPoints; std::set::const_iterator aCIt = aCoincidences.begin(); for (; aCIt != aCoincidences.end(); ++ aCIt) { for (int i = 0; i < CONSTRAINT_ATTR_SIZE; ++i) { @@ -435,25 +437,38 @@ std::set coincidentBoundaryPoints(FeaturePtr theFeature1, FeatureP FeaturePtr anOwner = ModelAPI_Feature::feature(anAttr->owner()); if (anOwner == theFeature1 || anOwner == theFeature2) { if (anAttr->id() == SketchPlugin_BSplineBase::POLES_ID()) { - AttributeIntegerPtr anIndex = (*aCIt)->integer(i == 0 ? - SketchPlugin_ConstraintCoincidenceInternal::INDEX_ENTITY_A() : - SketchPlugin_ConstraintCoincidenceInternal::INDEX_ENTITY_B()); + AttributePoint2DArrayPtr aPoles = + std::dynamic_pointer_cast(anAttr); + + AttributeIntegerPtr anIndex; + if (anOwner->getKind() == SketchPlugin_BSpline::ID()) { + anIndex = (*aCIt)->integer(i == 0 ? + SketchPlugin_ConstraintCoincidenceInternal::INDEX_ENTITY_A() : + SketchPlugin_ConstraintCoincidenceInternal::INDEX_ENTITY_B()); + } if (anIndex) { if (anIndex->value() == 0) anAttr = anOwner->attribute(SketchPlugin_BSpline::START_ID()); - else + else if (anIndex->value() + 1 == aPoles->size()) anAttr = anOwner->attribute(SketchPlugin_BSpline::END_ID()); if (anAttr) - aCoincidentPoints.insert(anAttr); + aCoincidentPoints[anOwner].insert(anAttr); } } else if (anAttr->id() != SketchPlugin_Arc::CENTER_ID() && anAttr->id() != SketchPlugin_Circle::CENTER_ID()) - aCoincidentPoints.insert(anAttr); + aCoincidentPoints[anOwner].insert(anAttr); } } } - return aCoincidentPoints; + + std::set aBoundaryPoints; + if (aCoincidentPoints.size() == 2) { + for (std::map >::iterator anIt = aCoincidentPoints.begin(); + anIt != aCoincidentPoints.end(); ++anIt) + aBoundaryPoints.insert(anIt->second.begin(), anIt->second.end()); + } + return aBoundaryPoints; } static std::set refsToFeatureAndResults(FeaturePtr theFeature)