error on dynamic range
This commit is contained in:
parent
57726a36ce
commit
22842f0305
@ -981,13 +981,7 @@ public class RoutingEngine extends Thread {
|
||||
logInfo("second check for way points");
|
||||
resetCache(false);
|
||||
range = -range;
|
||||
List<MatchedWaypoint> tmp = new ArrayList<>();
|
||||
// only w/o crosspoint check
|
||||
for (MatchedWaypoint mwp: unmatchedWaypoints) {
|
||||
if (mwp.crosspoint == null) tmp.add(mwp);
|
||||
}
|
||||
|
||||
ok = nodesCache.matchWaypointsToNodes(tmp, range, islandNodePairs);
|
||||
ok = nodesCache.matchWaypointsToNodes(unmatchedWaypoints, range, islandNodePairs);
|
||||
}
|
||||
if (!ok) {
|
||||
for (MatchedWaypoint mwp :unmatchedWaypoints) {
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
package btools.mapaccess;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import btools.codec.WaypointMatcher;
|
||||
import btools.util.CheapRuler;
|
||||
import btools.util.CheapAngleMeter;
|
||||
import btools.util.CheapRuler;
|
||||
|
||||
/**
|
||||
* the WaypointMatcher is feeded by the decoder with geoemtries of ways that are
|
||||
@ -29,8 +29,9 @@ public final class WaypointMatcherImpl implements WaypointMatcher {
|
||||
private int lonLast;
|
||||
private int latLast;
|
||||
boolean useAsStartWay = true;
|
||||
public boolean useDynamicRange;
|
||||
private int maxWptIdx;
|
||||
private double maxDistance;
|
||||
public boolean useDynamicRange = false;
|
||||
|
||||
private Comparator<MatchedWaypoint> comparator;
|
||||
|
||||
@ -38,9 +39,11 @@ public final class WaypointMatcherImpl implements WaypointMatcher {
|
||||
this.waypoints = waypoints;
|
||||
this.islandPairs = islandPairs;
|
||||
MatchedWaypoint last = null;
|
||||
this.useDynamicRange = maxDistance < 0;
|
||||
this.maxDistance = maxDistance;
|
||||
if (maxDistance < 0.) {
|
||||
this.maxDistance = -1;
|
||||
maxDistance *= -1;
|
||||
useDynamicRange = true;
|
||||
}
|
||||
|
||||
for (MatchedWaypoint mwp : waypoints) {
|
||||
@ -87,7 +90,7 @@ public final class WaypointMatcherImpl implements WaypointMatcher {
|
||||
|
||||
//for ( MatchedWaypoint mwp : waypoints )
|
||||
for (int i = 0; i < waypoints.size(); i++) {
|
||||
if (!useAsStartWay && i==0) continue;
|
||||
if (!useAsStartWay && i == 0) continue;
|
||||
MatchedWaypoint mwp = waypoints.get(i);
|
||||
|
||||
if (mwp.direct &&
|
||||
@ -113,7 +116,7 @@ public final class WaypointMatcherImpl implements WaypointMatcher {
|
||||
double r22 = x2 * x2 + y2 * y2;
|
||||
double radius = Math.abs(r12 < r22 ? y1 * dx - x1 * dy : y2 * dx - x2 * dy) / d;
|
||||
|
||||
if (radius <= mwp.radius || this.useDynamicRange) {
|
||||
if (radius <= mwp.radius || (this.maxDistance == -1d && (i == 0 || i == maxWptIdx))) {
|
||||
double s1 = x1 * dx + y1 * dy;
|
||||
double s2 = x2 * dx + y2 * dy;
|
||||
|
||||
@ -123,7 +126,8 @@ public final class WaypointMatcherImpl implements WaypointMatcher {
|
||||
}
|
||||
if (s2 > 0.) {
|
||||
radius = Math.sqrt(s1 < s2 ? r12 : r22);
|
||||
if (radius > mwp.radius)
|
||||
|
||||
if (radius > mwp.radius && this.maxDistance != -1)
|
||||
continue;
|
||||
}
|
||||
// new match for that waypoint
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user