From b225dd22d90853f59c082193f34a5a8279f527eb Mon Sep 17 00:00:00 2001 From: afischerdev Date: Sat, 25 Mar 2023 12:12:29 +0100 Subject: [PATCH] do not remove wpt in weighted nogos --- .../src/main/java/btools/router/RoutingContext.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/brouter-core/src/main/java/btools/router/RoutingContext.java b/brouter-core/src/main/java/btools/router/RoutingContext.java index 917d633..ab6b136 100644 --- a/brouter-core/src/main/java/btools/router/RoutingContext.java +++ b/brouter-core/src/main/java/btools/router/RoutingContext.java @@ -304,9 +304,10 @@ public final class RoutingContext { public void checkMatchedWaypointAgainstNogos(List matchedWaypoints) { if (nogopoints == null) return; - List newMatchedWaypoints = new ArrayList<>(); int theSize = matchedWaypoints.size(); + if (theSize<2) return; int removed = 0; + List newMatchedWaypoints = new ArrayList<>(); MatchedWaypoint prevMwp = null; boolean prevMwpIsInside = false; for (int i = 0; i < theSize; i++) { @@ -314,7 +315,8 @@ public final class RoutingContext { boolean isInsideNogo = false; OsmNode wp = mwp.crosspoint; for (OsmNodeNamed nogo : nogopoints) { - if (wp.calcDistance(nogo) < nogo.radius + if (Double.isNaN(nogo.nogoWeight) + && wp.calcDistance(nogo) < nogo.radius && (!(nogo instanceof OsmNogoPolygon) || (((OsmNogoPolygon) nogo).isClosed ? ((OsmNogoPolygon) nogo).isWithin(wp.ilon, wp.ilat)