From: mpv Date: Mon, 18 Nov 2019 09:30:14 +0000 (+0300) Subject: Fix for the issue #3081 : show free points must not show projected/external points X-Git-Tag: V9_5_0a1~171 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ca94318894d6cc22024c65f444b223951d15abc8;p=modules%2Fshaper.git Fix for the issue #3081 : show free points must not show projected/external points --- diff --git a/src/SketcherPrs/SketcherPrs_Tools.cpp b/src/SketcherPrs/SketcherPrs_Tools.cpp index 394a638ff..4e9522fd1 100644 --- a/src/SketcherPrs/SketcherPrs_Tools.cpp +++ b/src/SketcherPrs/SketcherPrs_Tools.cpp @@ -202,17 +202,28 @@ std::list getFreePoints(const CompositeFeaturePtr& theSketch) anObjIt != anObjects.end(); ++anObjIt) { FeaturePtr aCurrent = ModelAPI_Feature::feature(*anObjIt); if (aCurrent && aCurrent->getKind() == SketchPlugin_Point::ID()) { - // check point is not referred by any constraints - const std::set& aRefs = aCurrent->data()->refsToMe(); - std::set::iterator aRIt = aRefs.begin(); - for (; aRIt != aRefs.end(); ++aRIt) { - FeaturePtr aRefFeat = ModelAPI_Feature::feature((*aRIt)->owner()); - std::shared_ptr aRefConstr = - std::dynamic_pointer_cast(aRefFeat); - if (aRefConstr) - break; + // check point is not referred by any constraints: the feature and result of point + bool aIsFree = true; + for(int aKind = 0; aIsFree && aKind < 2; aKind++) { // 0 for feature, 1 for result + ObjectPtr aReferenced = aCurrent; + if (aKind == 1) + if (!aCurrent->results().empty()) + aReferenced = aCurrent->firstResult(); + else + break; + const std::set& aRefs = aReferenced->data()->refsToMe(); + std::set::iterator aRIt = aRefs.begin(); + for (; aRIt != aRefs.end(); ++aRIt) { + FeaturePtr aRefFeat = ModelAPI_Feature::feature((*aRIt)->owner()); + std::shared_ptr aRefConstr = + std::dynamic_pointer_cast(aRefFeat); + if (aRefConstr) { + aIsFree = false; + break; + } + } } - if (aRIt == aRefs.end()) + if (aIsFree) aFreePoints.push_back(aCurrent->lastResult()); } }