added startway check

This commit is contained in:
afischerdev 2024-09-07 14:42:10 +02:00
parent 6b4d989868
commit d2d639666e
8 changed files with 64 additions and 5 deletions

View file

@ -116,7 +116,8 @@ public final class DirectWeaver extends ByteDataWriter {
int ilontarget = ilon + dlon_remaining;
int ilattarget = ilat + dlat_remaining;
if (matcher != null) {
if (!matcher.start(ilon, ilat, ilontarget, ilattarget)) {
boolean useAsStartWay = wayTags==null || wayValidator.checkStartWay(wayTags.data);
if (!matcher.start(ilon, ilat, ilontarget, ilattarget, useAsStartWay)) {
matcher = null;
}
}

View file

@ -28,6 +28,7 @@ public final class WaypointMatcherImpl implements WaypointMatcher {
private boolean anyUpdate;
private int lonLast;
private int latLast;
boolean useAsStartWay = true;
private Comparator<MatchedWaypoint> comparator;
@ -78,6 +79,7 @@ public final class WaypointMatcherImpl implements WaypointMatcher {
//for ( MatchedWaypoint mwp : waypoints )
for (int i = 0; i < waypoints.size(); i++) {
if (!useAsStartWay && i==0) continue;
MatchedWaypoint mwp = waypoints.get(i);
if (mwp.direct &&
@ -141,7 +143,7 @@ public final class WaypointMatcherImpl implements WaypointMatcher {
}
@Override
public boolean start(int ilonStart, int ilatStart, int ilonTarget, int ilatTarget) {
public boolean start(int ilonStart, int ilatStart, int ilonTarget, int ilatTarget, boolean useAsStartWay) {
if (islandPairs.size() > 0) {
long n1 = ((long) ilonStart) << 32 | ilatStart;
long n2 = ((long) ilonTarget) << 32 | ilatTarget;
@ -154,6 +156,7 @@ public final class WaypointMatcherImpl implements WaypointMatcher {
lonTarget = ilonTarget;
latTarget = ilatTarget;
anyUpdate = false;
this.useAsStartWay = useAsStartWay;
return true;
}