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