Merge pull request #478 from afischerdev/update-version

Extend android service interface and http API
This commit is contained in:
zod 2022-11-14 21:47:58 +01:00 committed by GitHub
commit 0566f8154c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 47 additions and 7 deletions

View file

@ -57,7 +57,7 @@ public class BRouterWorker {
if ("osmand".equalsIgnoreCase(tiFormat)) {
rc.turnInstructionMode = 3;
} else if ("locus".equalsIgnoreCase(tiFormat)) {
rc.turnInstructionMode = 2;
rc.turnInstructionMode = 7;
}
}
if (params.containsKey("timode")) {
@ -112,7 +112,19 @@ public class BRouterWorker {
String key = tk2.nextToken();
if (tk2.hasMoreTokens()) {
String value = tk2.nextToken();
rc.keyValues.put(key, value);
if (key.equals("straight")) {
try {
String[] sa = value.split(",");
for (int i = 0; i < sa.length; i++) {
int v = Integer.valueOf(sa[i]);
if (waypoints.size() > v) waypoints.get(v).direct = true;
}
} catch (Exception e) {
System.err.println("error " + e.getStackTrace()[0].getLineNumber() + " " + e.getStackTrace()[0] + "\n" + e);
}
} else {
rc.keyValues.put(key, value);
}
}
}
}
@ -226,6 +238,13 @@ public class BRouterWorker {
if (lonLat.length < 2)
throw new IllegalArgumentException("we need two lat/lon points at least!");
wplist.add(readPosition(lonLat[0], lonLat[1], "via" + i));
if (lonLat.length > 2) {
if (lonLat[2].equals("d")) {
wplist.get(wplist.size() - 1).direct = true;
} else {
wplist.get(wplist.size() - 1).name = lonLat[2];
}
}
}
wplist.get(0).name = "from";