Skip to content

Commit

Permalink
Merge pull request #518 from afischerdev/fix-nogos
Browse files Browse the repository at this point in the history
Fix wpt and nogo handling
  • Loading branch information
afischerdev committed Mar 28, 2023
2 parents dc5602b + 4147405 commit 88977cc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions brouter-core/src/main/java/btools/router/RoutingContext.java
Expand Up @@ -294,17 +294,19 @@ public void cleanNogoList(List<OsmNode> waypoints) {

public void checkMatchedWaypointAgainstNogos(List<MatchedWaypoint> matchedWaypoints) {
if (nogopoints == null) return;
List<MatchedWaypoint> newMatchedWaypoints = new ArrayList<>();
int theSize = matchedWaypoints.size();
if (theSize<2) return;
int removed = 0;
List<MatchedWaypoint> newMatchedWaypoints = new ArrayList<>();
MatchedWaypoint prevMwp = null;
boolean prevMwpIsInside = false;
for (int i = 0; i < theSize; i++) {
MatchedWaypoint mwp = matchedWaypoints.get(i);
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)
Expand Down

0 comments on commit 88977cc

Please sign in to comment.