Merge pull request #518 from afischerdev/fix-nogos
Fix wpt and nogo handling
This commit is contained in:
commit
88977cca3a
1 changed files with 4 additions and 2 deletions
|
@ -294,9 +294,10 @@ public final class RoutingContext {
|
||||||
|
|
||||||
public void checkMatchedWaypointAgainstNogos(List<MatchedWaypoint> matchedWaypoints) {
|
public void checkMatchedWaypointAgainstNogos(List<MatchedWaypoint> matchedWaypoints) {
|
||||||
if (nogopoints == null) return;
|
if (nogopoints == null) return;
|
||||||
List<MatchedWaypoint> newMatchedWaypoints = new ArrayList<>();
|
|
||||||
int theSize = matchedWaypoints.size();
|
int theSize = matchedWaypoints.size();
|
||||||
|
if (theSize<2) return;
|
||||||
int removed = 0;
|
int removed = 0;
|
||||||
|
List<MatchedWaypoint> newMatchedWaypoints = new ArrayList<>();
|
||||||
MatchedWaypoint prevMwp = null;
|
MatchedWaypoint prevMwp = null;
|
||||||
boolean prevMwpIsInside = false;
|
boolean prevMwpIsInside = false;
|
||||||
for (int i = 0; i < theSize; i++) {
|
for (int i = 0; i < theSize; i++) {
|
||||||
|
@ -304,7 +305,8 @@ public final class RoutingContext {
|
||||||
boolean isInsideNogo = false;
|
boolean isInsideNogo = false;
|
||||||
OsmNode wp = mwp.crosspoint;
|
OsmNode wp = mwp.crosspoint;
|
||||||
for (OsmNodeNamed nogo : nogopoints) {
|
for (OsmNodeNamed nogo : nogopoints) {
|
||||||
if (wp.calcDistance(nogo) < nogo.radius
|
if (Double.isNaN(nogo.nogoWeight)
|
||||||
|
&& wp.calcDistance(nogo) < nogo.radius
|
||||||
&& (!(nogo instanceof OsmNogoPolygon)
|
&& (!(nogo instanceof OsmNogoPolygon)
|
||||||
|| (((OsmNogoPolygon) nogo).isClosed
|
|| (((OsmNogoPolygon) nogo).isClosed
|
||||||
? ((OsmNogoPolygon) nogo).isWithin(wp.ilon, wp.ilat)
|
? ((OsmNogoPolygon) nogo).isWithin(wp.ilon, wp.ilat)
|
||||||
|
|
Loading…
Reference in a new issue