]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix for the issue #3081 : show free points must not show projected/external points
authormpv <mpv@opencascade.com>
Mon, 18 Nov 2019 09:30:14 +0000 (12:30 +0300)
committerrnv <rnv@opencascade.com>
Mon, 18 Nov 2019 09:40:59 +0000 (12:40 +0300)
src/SketcherPrs/SketcherPrs_Tools.cpp

index 394a638ff948a89e833e6a0961d0a4f74b88acfe..4e9522fd1f94caec8056f5c4faf59cbd7d613d58 100644 (file)
@@ -202,17 +202,28 @@ std::list<ResultPtr> 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<AttributePtr>& aRefs = aCurrent->data()->refsToMe();
-      std::set<AttributePtr>::iterator aRIt = aRefs.begin();
-      for (; aRIt != aRefs.end(); ++aRIt) {
-        FeaturePtr aRefFeat = ModelAPI_Feature::feature((*aRIt)->owner());
-        std::shared_ptr<SketchPlugin_Constraint> aRefConstr =
-            std::dynamic_pointer_cast<SketchPlugin_Constraint>(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<AttributePtr>& aRefs = aReferenced->data()->refsToMe();
+        std::set<AttributePtr>::iterator aRIt = aRefs.begin();
+        for (; aRIt != aRefs.end(); ++aRIt) {
+          FeaturePtr aRefFeat = ModelAPI_Feature::feature((*aRIt)->owner());
+          std::shared_ptr<SketchPlugin_Constraint> aRefConstr =
+              std::dynamic_pointer_cast<SketchPlugin_Constraint>(aRefFeat);
+          if (aRefConstr) {
+            aIsFree = false;
+            break;
+          }
+        }
       }
-      if (aRIt == aRefs.end())
+      if (aIsFree)
         aFreePoints.push_back(aCurrent->lastResult());
     }
   }