remove mismatched pts array
This commit is contained in:
parent
8528276ffb
commit
dbaab10377
6 changed files with 34 additions and 21 deletions
|
|
@ -212,10 +212,14 @@ public class FormatGpx extends Formatter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (t.exportCorrectedWaypoints && t.correctedWaypoints != null) {
|
if (t.exportCorrectedWaypoints) {
|
||||||
for (int i = 0; i <= t.correctedWaypoints.size() - 1; i++) {
|
for (int i = 0; i <= t.matchedWaypoints.size() - 1; i++) {
|
||||||
OsmNodeNamed n = t.correctedWaypoints.get(i);
|
MatchedWaypoint wt = t.matchedWaypoints.get(i);
|
||||||
formatWaypointGpx(sb, n, "via_corr");
|
if (wt.correctedpoint != null) {
|
||||||
|
OsmNodeNamed n = new OsmNodeNamed(wt.correctedpoint);
|
||||||
|
n.name = wt.name + "_corr";
|
||||||
|
formatWaypointGpx(sb, n, "via_corr");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -158,15 +158,19 @@ public class FormatJson extends Formatter {
|
||||||
}
|
}
|
||||||
if (t.exportCorrectedWaypoints) {
|
if (t.exportCorrectedWaypoints) {
|
||||||
if (t.exportWaypoints) sb.append(" ,\n");
|
if (t.exportWaypoints) sb.append(" ,\n");
|
||||||
for (int i = 0; i <= t.correctedWaypoints.size() - 1; i++) {
|
boolean hasCorrPoints = false;
|
||||||
|
for (int i = 0; i <= t.matchedWaypoints.size() - 1; i++) {
|
||||||
String type = "via_corr";
|
String type = "via_corr";
|
||||||
|
|
||||||
OsmNodeNamed wp = t.correctedWaypoints.get(i);
|
MatchedWaypoint wp = t.matchedWaypoints.get(i);
|
||||||
addFeature(sb, type, wp.name, wp.ilat, wp.ilon, wp.getSElev());
|
if (wp.correctedpoint != null) {
|
||||||
if (i < t.correctedWaypoints.size() - 1) {
|
if (hasCorrPoints) {
|
||||||
sb.append(",");
|
sb.append(",");
|
||||||
|
}
|
||||||
|
addFeature(sb, type, wp.name + "_corr", wp.correctedpoint.ilat, wp.correctedpoint.ilon, wp.correctedpoint.getSElev());
|
||||||
|
sb.append(" \n");
|
||||||
|
hasCorrPoints = true;
|
||||||
}
|
}
|
||||||
sb.append(" \n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package btools.router;
|
package btools.router;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import btools.mapaccess.MatchedWaypoint;
|
import btools.mapaccess.MatchedWaypoint;
|
||||||
|
|
@ -63,8 +64,17 @@ public class FormatKml extends Formatter {
|
||||||
createFolder(sb, "end", t.matchedWaypoints.subList(size - 1, size));
|
createFolder(sb, "end", t.matchedWaypoints.subList(size - 1, size));
|
||||||
}
|
}
|
||||||
if (t.exportCorrectedWaypoints) {
|
if (t.exportCorrectedWaypoints) {
|
||||||
int size = t.correctedWaypoints.size();
|
List<OsmNodeNamed> list = new ArrayList<>();
|
||||||
createViaFolder(sb, "via_cor", t.correctedWaypoints.subList(0, size));
|
for (int i = 0; i < t.matchedWaypoints.size(); i++) {
|
||||||
|
MatchedWaypoint wp = t.matchedWaypoints.get(i);
|
||||||
|
if (wp.correctedpoint != null) {
|
||||||
|
OsmNodeNamed n = new OsmNodeNamed(wp.correctedpoint);
|
||||||
|
n.name = wp.name + "_corr";
|
||||||
|
list.add(n);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int size = list.size();
|
||||||
|
createViaFolder(sb, "via_corr", list.subList(0, size));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sb.append(" </Document>\n");
|
sb.append(" </Document>\n");
|
||||||
|
|
@ -84,6 +94,7 @@ public class FormatKml extends Formatter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createViaFolder(StringBuilder sb, String type, List<OsmNodeNamed> waypoints) {
|
private void createViaFolder(StringBuilder sb, String type, List<OsmNodeNamed> waypoints) {
|
||||||
|
if (waypoints.isEmpty()) return;
|
||||||
sb.append(" <Folder>\n");
|
sb.append(" <Folder>\n");
|
||||||
sb.append(" <name>" + type + "</name>\n");
|
sb.append(" <name>" + type + "</name>\n");
|
||||||
for (int i = 0; i < waypoints.size(); i++) {
|
for (int i = 0; i < waypoints.size(); i++) {
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,6 @@ public final class OsmTrack {
|
||||||
public String name = "unset";
|
public String name = "unset";
|
||||||
|
|
||||||
protected List<MatchedWaypoint> matchedWaypoints;
|
protected List<MatchedWaypoint> matchedWaypoints;
|
||||||
protected List<OsmNodeNamed> correctedWaypoints;
|
|
||||||
public boolean exportWaypoints = false;
|
public boolean exportWaypoints = false;
|
||||||
public boolean exportCorrectedWaypoints = false;
|
public boolean exportCorrectedWaypoints = false;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,6 @@ public class RoutingEngine extends Thread {
|
||||||
private boolean finished = false;
|
private boolean finished = false;
|
||||||
|
|
||||||
protected List<OsmNodeNamed> waypoints = null;
|
protected List<OsmNodeNamed> waypoints = null;
|
||||||
protected List<OsmNodeNamed> correctedWaypoints = null;
|
|
||||||
List<OsmNodeNamed> extraWaypoints = null;
|
List<OsmNodeNamed> extraWaypoints = null;
|
||||||
protected List<MatchedWaypoint> matchedWaypoints;
|
protected List<MatchedWaypoint> matchedWaypoints;
|
||||||
private int linksProcessed = 0;
|
private int linksProcessed = 0;
|
||||||
|
|
@ -1036,7 +1035,6 @@ public class RoutingEngine extends Thread {
|
||||||
|
|
||||||
matchedWaypoints.get(matchedWaypoints.size() - 1).indexInTrack = totaltrack.nodes.size() - 1;
|
matchedWaypoints.get(matchedWaypoints.size() - 1).indexInTrack = totaltrack.nodes.size() - 1;
|
||||||
totaltrack.matchedWaypoints = matchedWaypoints;
|
totaltrack.matchedWaypoints = matchedWaypoints;
|
||||||
totaltrack.correctedWaypoints = correctedWaypoints;
|
|
||||||
totaltrack.processVoiceHints(routingContext);
|
totaltrack.processVoiceHints(routingContext);
|
||||||
totaltrack.prepareSpeedProfile(routingContext);
|
totaltrack.prepareSpeedProfile(routingContext);
|
||||||
|
|
||||||
|
|
@ -1195,12 +1193,8 @@ public class RoutingEngine extends Thread {
|
||||||
|
|
||||||
setNewVoiceHint(t, last, lastJunctions, newJunction, newTarget);
|
setNewVoiceHint(t, last, lastJunctions, newJunction, newTarget);
|
||||||
|
|
||||||
if (correctedWaypoints == null) correctedWaypoints = new ArrayList<>();
|
// fill to correctedpoint
|
||||||
OsmNodeNamed n = new OsmNodeNamed();
|
startWp.correctedpoint = new OsmNode(newJunction.getILon(), newJunction.getILat());
|
||||||
n.ilon = newJunction.getILon();
|
|
||||||
n.ilat = newJunction.getILat();
|
|
||||||
n.name = startWp.name + "_corr";
|
|
||||||
correctedWaypoints.add(n);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ public final class MatchedWaypoint {
|
||||||
public OsmNode node2;
|
public OsmNode node2;
|
||||||
public OsmNode crosspoint;
|
public OsmNode crosspoint;
|
||||||
public OsmNode waypoint;
|
public OsmNode waypoint;
|
||||||
|
public OsmNode correctedpoint;
|
||||||
public String name; // waypoint name used in error messages
|
public String name; // waypoint name used in error messages
|
||||||
public double radius; // distance in meter between waypoint and crosspoint
|
public double radius; // distance in meter between waypoint and crosspoint
|
||||||
public boolean direct; // from this point go direct to next = beeline routing
|
public boolean direct; // from this point go direct to next = beeline routing
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue