From 56dbd52065a8c99d5ef61987ff6ad4b54860a5d9 Mon Sep 17 00:00:00 2001 From: afischerdev Date: Mon, 20 Nov 2023 17:08:20 +0100 Subject: [PATCH 01/30] added new format classes --- .../main/java/btools/router/FormatCsv.java | 43 ++ .../main/java/btools/router/FormatGpx.java | 532 ++++++++++++++++++ .../main/java/btools/router/FormatJson.java | 246 ++++++++ .../main/java/btools/router/FormatKml.java | 91 +++ .../main/java/btools/router/Formatter.java | 73 +++ 5 files changed, 985 insertions(+) create mode 100644 brouter-core/src/main/java/btools/router/FormatCsv.java create mode 100644 brouter-core/src/main/java/btools/router/FormatGpx.java create mode 100644 brouter-core/src/main/java/btools/router/FormatJson.java create mode 100644 brouter-core/src/main/java/btools/router/FormatKml.java create mode 100644 brouter-core/src/main/java/btools/router/Formatter.java diff --git a/brouter-core/src/main/java/btools/router/FormatCsv.java b/brouter-core/src/main/java/btools/router/FormatCsv.java new file mode 100644 index 0000000..37b7408 --- /dev/null +++ b/brouter-core/src/main/java/btools/router/FormatCsv.java @@ -0,0 +1,43 @@ +package btools.router; + +import java.io.BufferedWriter; +import java.io.StringWriter; + +public class FormatCsv extends Formatter { + + + public FormatCsv(RoutingContext rc) { + super(rc); + } + + @Override + public String format(OsmTrack t) { + try { + StringWriter sw = new StringWriter(); + BufferedWriter bw = new BufferedWriter(sw); + writeMessages(bw, t); + return sw.toString(); + } catch (Exception ex) { + return "Error: " + ex.getMessage(); + } + } + + public void writeMessages(BufferedWriter bw, OsmTrack t) throws Exception { + dumpLine(bw, MESSAGES_HEADER); + for (String m : t.aggregateMessages()) { + dumpLine(bw, m); + } + if (bw != null) + bw.close(); + } + + private void dumpLine(BufferedWriter bw, String s) throws Exception { + if (bw == null) { + System.out.println(s); + } else { + bw.write(s); + bw.write("\n"); + } + } + +} diff --git a/brouter-core/src/main/java/btools/router/FormatGpx.java b/brouter-core/src/main/java/btools/router/FormatGpx.java new file mode 100644 index 0000000..e162292 --- /dev/null +++ b/brouter-core/src/main/java/btools/router/FormatGpx.java @@ -0,0 +1,532 @@ +package btools.router; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.StringWriter; +import java.util.Map; + +import btools.mapaccess.MatchedWaypoint; +import btools.util.StringUtils; + +public class FormatGpx extends Formatter { + public FormatGpx(RoutingContext rc) { + super(rc); + } + + @Override + public String format(OsmTrack t) { + try { + StringWriter sw = new StringWriter(8192); + BufferedWriter bw = new BufferedWriter(sw); + formatAsGpx(bw, t); + bw.close(); + return sw.toString(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public String formatAsGpx(BufferedWriter sb, OsmTrack t) throws IOException { + int turnInstructionMode = t.voiceHints != null ? t.voiceHints.turnInstructionMode : 0; + + sb.append("\n"); + if (turnInstructionMode != 9) { + for (int i = t.messageList.size() - 1; i >= 0; i--) { + String message = t.messageList.get(i); + if (i < t.messageList.size() - 1) + message = "(alt-index " + i + ": " + message + " )"; + if (message != null) + sb.append("\n"); + } + } + + if (turnInstructionMode == 4) { // comment style + sb.append("\n"); + sb.append("\n"); + sb.append("\n"); + } + sb.append("\n"); + } else { + sb.append(" creator=\"BRouter-" + t.version + "\" version=\"1.1\">\n"); + } + if (turnInstructionMode == 9) { + sb.append(" \n"); + sb.append(" ").append(t.name).append("\n"); + sb.append(" \n"); + sb.append(" ").append(t.messageList.get(0)).append("\n"); + if (t.params != null && t.params.size() > 0) { + sb.append(" e : t.params.entrySet()) { + if (i++ != 0) sb.append("&"); + sb.append(e.getKey()).append("=").append(e.getValue()); + } + sb.append("]]>\n"); + } + sb.append(" \n"); + sb.append(" \n"); + } + if (turnInstructionMode == 3 || turnInstructionMode == 8) { // osmand style, cruiser + float lastRteTime = 0; + + sb.append(" \n"); + + float rteTime = t.getVoiceHintTime(0); + StringBuffer first = new StringBuffer(); + // define start point + { + first.append(" \n") + .append(" start\n \n"); + if (rteTime != lastRteTime) { // add timing only if available + double ti = rteTime - lastRteTime; + first.append(" \n"); + lastRteTime = rteTime; + } + first.append(" 0\n \n \n"); + } + if (turnInstructionMode == 8) { + if (t.matchedWaypoints.get(0).direct && t.voiceHints.list.get(0).indexInTrack == 0) { + // has a voice hint do nothing, voice hint will do + } else { + sb.append(first.toString()); + } + } else { + sb.append(first.toString()); + } + + for (int i = 0; i < t.voiceHints.list.size(); i++) { + VoiceHint hint = t.voiceHints.list.get(i); + sb.append(" \n") + .append(" ") + .append(turnInstructionMode == 3 ? hint.getMessageString() : hint.getCruiserMessageString()) + .append("\n \n"); + + rteTime = t.getVoiceHintTime(i + 1); + + if (rteTime != lastRteTime) { // add timing only if available + double ti = rteTime - lastRteTime; + sb.append(" \n"); + lastRteTime = rteTime; + } + sb.append(" ") + .append(turnInstructionMode == 3 ? hint.getCommandString() : hint.getCruiserCommandString()) + .append("\n ").append("" + (int) hint.angle) + .append("\n ").append("" + hint.indexInTrack).append("\n \n \n"); + } + sb.append(" \n") + .append(" destination\n \n"); + sb.append(" \n"); + sb.append(" ").append("" + (t.nodes.size() - 1)).append("\n \n \n"); + + sb.append("\n"); + } + + if (turnInstructionMode == 7) { // old locus style + float lastRteTime = t.getVoiceHintTime(0); + + for (int i = 0; i < t.voiceHints.list.size(); i++) { + VoiceHint hint = t.voiceHints.list.get(i); + sb.append(" ") + .append(hint.selev == Short.MIN_VALUE ? "" : "" + (hint.selev / 4.) + "") + .append("").append(hint.getMessageString()).append("") + .append("").append("" + hint.distanceToNext).append(""); + float rteTime = t.getVoiceHintTime(i + 1); + if (rteTime != lastRteTime) { // add timing only if available + double ti = rteTime - lastRteTime; + double speed = hint.distanceToNext / ti; + sb.append("").append("" + ti).append("") + .append("").append("" + speed).append(""); + lastRteTime = rteTime; + } + sb.append("").append("" + hint.getLocusAction()).append("") + .append("\n"); + } + } + if (turnInstructionMode == 5) { // gpsies style + for (VoiceHint hint : t.voiceHints.list) { + sb.append(" ") + .append("").append(hint.getMessageString()).append("") + .append("").append(hint.getSymbolString().toLowerCase()).append("") + .append("").append(hint.getSymbolString()).append("") + .append("\n"); + } + } + + if (turnInstructionMode == 6) { // orux style + for (VoiceHint hint : t.voiceHints.list) { + sb.append(" ") + .append(hint.selev == Short.MIN_VALUE ? "" : "" + (hint.selev / 4.) + "") + .append("\n" + + " \n" + + " ").append("" + hint.getOruxAction()) + .append("\n" + + " \n" + + " \n" + + " \n"); + } + } + + for (int i = 0; i <= t.pois.size() - 1; i++) { + OsmNodeNamed poi = t.pois.get(i); + sb.append(" \n") + .append(" ").append(StringUtils.escapeXml10(poi.name)).append("\n") + .append(" \n"); + } + + if (t.exportWaypoints) { + for (int i = 0; i <= t.matchedWaypoints.size() - 1; i++) { + MatchedWaypoint wt = t.matchedWaypoints.get(i); + sb.append(" \n") + .append(" ").append(StringUtils.escapeXml10(wt.name)).append("\n"); + if (i == 0) { + sb.append(" from\n"); + } else if (i == t.matchedWaypoints.size() - 1) { + sb.append(" to\n"); + } else { + sb.append(" via\n"); + } + sb.append(" \n"); + } + } + sb.append(" \n"); + if (turnInstructionMode == 9 + || turnInstructionMode == 2 + || turnInstructionMode == 8 + || turnInstructionMode == 4) { // Locus, comment, cruise, brouter style + sb.append(" ").append(t.name).append("\n"); + sb.append(" ").append(t.voiceHints.getTransportMode()).append("\n"); + } else { + sb.append(" ").append(t.name).append("\n"); + } + + if (turnInstructionMode == 7) { + sb.append(" \n"); + sb.append(" ").append("" + t.voiceHints.getLocusRouteType()).append("\n"); + sb.append(" 1\n"); + sb.append(" \n"); + } + + + // all points + sb.append(" \n"); + String lastway = ""; + boolean bNextDirect = false; + OsmPathElement nn = null; + String aSpeed; + + for (int idx = 0; idx < t.nodes.size(); idx++) { + OsmPathElement n = t.nodes.get(idx); + String sele = n.getSElev() == Short.MIN_VALUE ? "" : "" + n.getElev() + ""; + VoiceHint hint = t.getVoiceHint(idx); + MatchedWaypoint mwpt = t.getMatchedWaypoint(idx); + + if (t.showTime) { + sele += ""; + } + if (turnInstructionMode == 8) { + if (mwpt != null && + !mwpt.name.startsWith("via") && !mwpt.name.startsWith("from") && !mwpt.name.startsWith("to")) { + sele += "" + mwpt.name + ""; + } + } + boolean bNeedHeader = false; + if (turnInstructionMode == 9) { // trkpt/sym style + + if (hint != null) { + + if (mwpt != null && + !mwpt.name.startsWith("via") && !mwpt.name.startsWith("from") && !mwpt.name.startsWith("to")) { + sele += "" + mwpt.name + ""; + } + sele += "" + hint.getCruiserMessageString() + ""; + sele += "" + hint.getCommandString(hint.cmd) + ""; + if (mwpt != null) { + sele += "Via"; + } + sele += ""; + if (t.showspeed) { + double speed = 0; + if (nn != null) { + int dist = n.calcDistance(nn); + float dt = n.getTime() - nn.getTime(); + if (dt != 0.f) { + speed = ((3.6f * dist) / dt + 0.5); + } + } + sele += "" + (((int) (speed * 10)) / 10.f) + ""; + } + + sele += "" + hint.getCommandString() + ";" + (int) (hint.distanceToNext) + "," + hint.formatGeometry() + ""; + if (n.message != null && n.message.wayKeyValues != null && !n.message.wayKeyValues.equals(lastway)) { + sele += "" + n.message.wayKeyValues + ""; + lastway = n.message.wayKeyValues; + } + if (n.message != null && n.message.nodeKeyValues != null) { + sele += "" + n.message.nodeKeyValues + ""; + } + sele += ""; + + } + if (idx == 0 && hint == null) { + if (mwpt != null && mwpt.direct) { + sele += "beeline"; + } else { + sele += "start"; + } + sele += "Via"; + + } else if (idx == t.nodes.size() - 1 && hint == null) { + + sele += "end"; + sele += "Via"; + + } else { + if (mwpt != null && hint == null) { + if (mwpt.direct) { + // bNextDirect = true; + sele += "beeline"; + } else { + sele += "" + mwpt.name + ""; + } + sele += "Via"; + bNextDirect = false; + } + } + + + if (hint == null) { + bNeedHeader = (t.showspeed || (n.message != null && n.message.wayKeyValues != null && !n.message.wayKeyValues.equals(lastway))) || + (n.message != null && n.message.nodeKeyValues != null); + if (bNeedHeader) { + sele += ""; + if (t.showspeed) { + double speed = 0; + if (nn != null) { + int dist = n.calcDistance(nn); + float dt = n.getTime() - nn.getTime(); + if (dt != 0.f) { + speed = ((3.6f * dist) / dt + 0.5); + } + } + sele += "" + (((int) (speed * 10)) / 10.f) + ""; + } + if (n.message != null && n.message.wayKeyValues != null && !n.message.wayKeyValues.equals(lastway)) { + sele += "" + n.message.wayKeyValues + ""; + lastway = n.message.wayKeyValues; + } + if (n.message != null && n.message.nodeKeyValues != null) { + sele += "" + n.message.nodeKeyValues + ""; + } + sele += ""; + } + } + } + + if (turnInstructionMode == 2) { // locus style new + if (hint != null) { + if (mwpt != null) { + if (!mwpt.name.startsWith("via") && !mwpt.name.startsWith("from") && !mwpt.name.startsWith("to")) { + sele += "" + mwpt.name + ""; + } + if (mwpt.direct && bNextDirect) { + sele += "" + hint.getLocusSymbolString() + "pass_placeShaping"; + // bNextDirect = false; + } else if (mwpt.direct) { + if (idx == 0) + sele += "pass_placeVia"; + else + sele += "pass_placeShaping"; + bNextDirect = true; + } else if (bNextDirect) { + sele += "beeline" + hint.getLocusSymbolString() + "Shaping"; + bNextDirect = false; + } else { + sele += "" + hint.getLocusSymbolString() + "Via"; + } + } else { + sele += "" + hint.getLocusSymbolString() + ""; + } + } else { + if (idx == 0 && hint == null) { + + int pos = sele.indexOf(""; + if (mwpt != null && mwpt.direct) { + bNextDirect = true; + } + sele += "pass_place"; + sele += "Via"; + + } else if (idx == t.nodes.size() - 1 && hint == null) { + + int pos = sele.indexOf(""; + if (bNextDirect) { + sele += "beeline"; + } + sele += "pass_place"; + sele += "Via"; + + } else { + if (mwpt != null) { + if (!mwpt.name.startsWith("via") && !mwpt.name.startsWith("from") && !mwpt.name.startsWith("to")) { + sele += "" + mwpt.name + ""; + } + if (mwpt.direct && bNextDirect) { + sele += "beelinepass_placeShaping"; + } else if (mwpt.direct) { + if (idx == 0) + sele += "pass_placeVia"; + else + sele += "pass_placeShaping"; + bNextDirect = true; + } else if (bNextDirect) { + sele += "beelinepass_placeShaping"; + bNextDirect = false; + } else if (mwpt.name.startsWith("via") || + mwpt.name.startsWith("from") || + mwpt.name.startsWith("to")) { + if (bNextDirect) { + sele += "beelinepass_placeShaping"; + } else { + sele += "pass_placeVia"; + } + bNextDirect = false; + } else { + sele += "" + mwpt.name + ""; + sele += "pass_placeVia"; + } + } + } + } + } + sb.append(" ").append(sele).append("\n"); + + nn = n; + } + + sb.append(" \n"); + sb.append(" \n"); + sb.append("\n"); + + return sb.toString(); + } + + public String formatAsWaypoint(OsmNodeNamed n) { + try { + StringWriter sw = new StringWriter(8192); + BufferedWriter bw = new BufferedWriter(sw); + formatGpxHeader(bw); + formatWaypointGpx(bw, n); + formatGpxFooter(bw); + bw.close(); + sw.close(); + return sw.toString(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public void formatGpxHeader(BufferedWriter sb) throws IOException { + sb.append("\n"); + sb.append("\n"); + } + + public void formatGpxFooter(BufferedWriter sb) throws IOException { + sb.append("\n"); + } + + public void formatWaypointGpx(BufferedWriter sb, OsmNodeNamed n) throws IOException { + sb.append(" "); + if (n.getSElev() != Short.MIN_VALUE) { + sb.append("").append("" + n.getElev()).append(""); + } + if (n.name != null) { + sb.append("").append(StringUtils.escapeXml10(n.name)).append(""); + } + if (n.nodeDescription != null && rc != null) { + sb.append("").append(rc.expctxWay.getKeyValueDescription(false, n.nodeDescription)).append(""); + } + sb.append("\n"); + } + + public static String getWaypoint(int ilon, int ilat, String name, String desc) { + return "" + name + "" + (desc != null ? "" + desc + "" : "") + ""; + } + + public OsmTrack read(String filename) throws Exception { + File f = new File(filename); + if (!f.exists()) { + return null; + } + OsmTrack track = new OsmTrack(); + BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(f))); + + for (; ; ) { + String line = br.readLine(); + if (line == null) + break; + + int idx0 = line.indexOf("= 0) { + idx0 = line.indexOf(" lon=\""); + idx0 += 6; + int idx1 = line.indexOf('"', idx0); + int ilon = (int) ((Double.parseDouble(line.substring(idx0, idx1)) + 180.) * 1000000. + 0.5); + int idx2 = line.indexOf(" lat=\""); + if (idx2 < 0) + continue; + idx2 += 6; + int idx3 = line.indexOf('"', idx2); + int ilat = (int) ((Double.parseDouble(line.substring(idx2, idx3)) + 90.) * 1000000. + 0.5); + track.nodes.add(OsmPathElement.create(ilon, ilat, (short) 0, null, false)); + } + } + br.close(); + return track; + } + +} diff --git a/brouter-core/src/main/java/btools/router/FormatJson.java b/brouter-core/src/main/java/btools/router/FormatJson.java new file mode 100644 index 0000000..a2c5b7a --- /dev/null +++ b/brouter-core/src/main/java/btools/router/FormatJson.java @@ -0,0 +1,246 @@ +package btools.router; + +import java.io.BufferedWriter; +import java.io.StringWriter; +import java.text.DecimalFormat; +import java.text.NumberFormat; +import java.util.List; +import java.util.Locale; + +import btools.mapaccess.MatchedWaypoint; +import btools.util.StringUtils; + +public class FormatJson extends Formatter { + + public FormatJson(RoutingContext rc) { + super(rc); + } + + @Override + public String format(OsmTrack t) { + int turnInstructionMode = t.voiceHints != null ? t.voiceHints.turnInstructionMode : 0; + + StringBuilder sb = new StringBuilder(8192); + + sb.append("{\n"); + sb.append(" \"type\": \"FeatureCollection\",\n"); + sb.append(" \"features\": [\n"); + sb.append(" {\n"); + sb.append(" \"type\": \"Feature\",\n"); + sb.append(" \"properties\": {\n"); + sb.append(" \"creator\": \"BRouter-" + t.version + "\",\n"); + sb.append(" \"name\": \"").append(t.name).append("\",\n"); + sb.append(" \"track-length\": \"").append(t.distance).append("\",\n"); + sb.append(" \"filtered ascend\": \"").append(t.ascend).append("\",\n"); + sb.append(" \"plain-ascend\": \"").append(t.plainAscend).append("\",\n"); + sb.append(" \"total-time\": \"").append(t.getTotalSeconds()).append("\",\n"); + sb.append(" \"total-energy\": \"").append(t.energy).append("\",\n"); + sb.append(" \"cost\": \"").append(t.cost).append("\",\n"); + if (t.voiceHints != null && !t.voiceHints.list.isEmpty()) { + sb.append(" \"voicehints\": [\n"); + for (VoiceHint hint : t.voiceHints.list) { + sb.append(" ["); + sb.append(hint.indexInTrack); + sb.append(',').append(hint.getJsonCommandIndex()); + sb.append(',').append(hint.getExitNumber()); + sb.append(',').append(hint.distanceToNext); + sb.append(',').append((int) hint.angle); + + // not always include geometry because longer and only needed for comment style + if (turnInstructionMode == 4) { // comment style + sb.append(",\"").append(hint.formatGeometry()).append("\""); + } + + sb.append("],\n"); + } + sb.deleteCharAt(sb.lastIndexOf(",")); + sb.append(" ],\n"); + } + if (t.showSpeedProfile) { // set in profile + List sp = t.aggregateSpeedProfile(); + if (sp.size() > 0) { + sb.append(" \"speedprofile\": [\n"); + for (int i = sp.size() - 1; i >= 0; i--) { + sb.append(" [").append(sp.get(i)).append(i > 0 ? "],\n" : "]\n"); + } + sb.append(" ],\n"); + } + } + // ... traditional message list + { + sb.append(" \"messages\": [\n"); + sb.append(" [\"").append(MESSAGES_HEADER.replaceAll("\t", "\", \"")).append("\"],\n"); + for (String m : t.aggregateMessages()) { + sb.append(" [\"").append(m.replaceAll("\t", "\", \"")).append("\"],\n"); + } + sb.deleteCharAt(sb.lastIndexOf(",")); + sb.append(" ],\n"); + } + + if (t.getTotalSeconds() > 0) { + sb.append(" \"times\": ["); + DecimalFormat decimalFormat = (DecimalFormat) NumberFormat.getInstance(Locale.ENGLISH); + decimalFormat.applyPattern("0.###"); + for (OsmPathElement n : t.nodes) { + sb.append(decimalFormat.format(n.getTime())).append(","); + } + sb.deleteCharAt(sb.lastIndexOf(",")); + sb.append("]\n"); + } else { + sb.deleteCharAt(sb.lastIndexOf(",")); + } + + sb.append(" },\n"); + + if (t.iternity != null) { + sb.append(" \"iternity\": [\n"); + for (String s : t.iternity) { + sb.append(" \"").append(s).append("\",\n"); + } + sb.deleteCharAt(sb.lastIndexOf(",")); + sb.append(" ],\n"); + } + sb.append(" \"geometry\": {\n"); + sb.append(" \"type\": \"LineString\",\n"); + sb.append(" \"coordinates\": [\n"); + + OsmPathElement nn = null; + for (OsmPathElement n : t.nodes) { + String sele = n.getSElev() == Short.MIN_VALUE ? "" : ", " + n.getElev(); + if (t.showspeed) { // hack: show speed instead of elevation + double speed = 0; + if (nn != null) { + int dist = n.calcDistance(nn); + float dt = n.getTime() - nn.getTime(); + if (dt != 0.f) { + speed = ((3.6f * dist) / dt + 0.5); + } + } + sele = ", " + (((int) (speed * 10)) / 10.f); + } + sb.append(" [").append(formatILon(n.getILon())).append(", ").append(formatILat(n.getILat())) + .append(sele).append("],\n"); + nn = n; + } + sb.deleteCharAt(sb.lastIndexOf(",")); + + sb.append(" ]\n"); + sb.append(" }\n"); + if (t.exportWaypoints || !t.pois.isEmpty()) { + sb.append(" },\n"); + for (int i = 0; i <= t.pois.size() - 1; i++) { + OsmNodeNamed poi = t.pois.get(i); + addFeature(sb, "poi", poi.name, poi.ilat, poi.ilon); + if (i < t.matchedWaypoints.size() - 1) { + sb.append(","); + } + sb.append(" \n"); + } + if (t.exportWaypoints) { + for (int i = 0; i <= t.matchedWaypoints.size() - 1; i++) { + String type; + if (i == 0) { + type = "from"; + } else if (i == t.matchedWaypoints.size() - 1) { + type = "to"; + } else { + type = "via"; + } + + MatchedWaypoint wp = t.matchedWaypoints.get(i); + addFeature(sb, type, wp.name, wp.waypoint.ilat, wp.waypoint.ilon); + if (i < t.matchedWaypoints.size() - 1) { + sb.append(","); + } + sb.append(" \n"); + } + } + } else { + sb.append(" }\n"); + } + sb.append(" ]\n"); + sb.append("}\n"); + + return sb.toString(); + } + + private void addFeature(StringBuilder sb, String type, String name, int ilat, int ilon) { + sb.append(" {\n"); + sb.append(" \"type\": \"Feature\",\n"); + sb.append(" \"properties\": {\n"); + sb.append(" \"name\": \"" + StringUtils.escapeJson(name) + "\",\n"); + sb.append(" \"type\": \"" + type + "\"\n"); + sb.append(" },\n"); + sb.append(" \"geometry\": {\n"); + sb.append(" \"type\": \"Point\",\n"); + sb.append(" \"coordinates\": [\n"); + sb.append(" " + formatILon(ilon) + ",\n"); + sb.append(" " + formatILat(ilat) + "\n"); + sb.append(" ]\n"); + sb.append(" }\n"); + sb.append(" }"); + } + + public String formatAsWaypoint(OsmNodeNamed n) { + try { + StringWriter sw = new StringWriter(8192); + BufferedWriter bw = new BufferedWriter(sw); + addJsonHeader(bw); + addJsonFeature(bw, "info", "wpinfo", n.ilon, n.ilat, n.getElev(), (n.nodeDescription != null ? rc.expctxWay.getKeyValueDescription(false, n.nodeDescription) : null)); + addJsonFooter(bw); + bw.close(); + sw.close(); + return sw.toString(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private void addJsonFeature(BufferedWriter sb, String type, String name, int ilon, int ilat, double elev, String desc) { + try { + sb.append(" {\n"); + sb.append(" \"type\": \"Feature\",\n"); + sb.append(" \"properties\": {\n"); + sb.append(" \"creator\": \"BRouter-" + OsmTrack.version + "\",\n"); + sb.append(" \"name\": \"" + StringUtils.escapeJson(name) + "\",\n"); + sb.append(" \"type\": \"" + type + "\""); + if (desc != null) { + sb.append(",\n \"message\": \"" + desc + "\"\n"); + } else { + sb.append("\n"); + } + sb.append(" },\n"); + sb.append(" \"geometry\": {\n"); + sb.append(" \"type\": \"Point\",\n"); + sb.append(" \"coordinates\": [\n"); + sb.append(" " + formatILon(ilon) + ",\n"); + sb.append(" " + formatILat(ilat) + ",\n"); + sb.append(" " + elev + "\n"); + sb.append(" ]\n"); + sb.append(" }\n"); + sb.append(" }\n"); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private static void addJsonHeader(BufferedWriter sb) { + try { + sb.append("{\n"); + sb.append(" \"type\": \"FeatureCollection\",\n"); + sb.append(" \"features\": [\n"); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private static void addJsonFooter(BufferedWriter sb) { + try { + sb.append(" ]\n"); + sb.append("}\n"); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + +} diff --git a/brouter-core/src/main/java/btools/router/FormatKml.java b/brouter-core/src/main/java/btools/router/FormatKml.java new file mode 100644 index 0000000..5798c5c --- /dev/null +++ b/brouter-core/src/main/java/btools/router/FormatKml.java @@ -0,0 +1,91 @@ +package btools.router; + +import java.util.List; + +import btools.mapaccess.MatchedWaypoint; +import btools.util.StringUtils; + +public class FormatKml extends Formatter { + public FormatKml(RoutingContext rc) { + super(rc); + } + + @Override + public String format(OsmTrack t) { + StringBuilder sb = new StringBuilder(8192); + + sb.append("\n"); + + sb.append("\n"); + sb.append(" \n"); + sb.append(" KML Samples\n"); + sb.append(" 1\n"); + sb.append(" 3.497064\n"); + sb.append(" 872\n"); + sb.append(" To enable simple instructions add: 'instructions=1' as parameter to the URL\n"); + sb.append(" \n"); + sb.append(" Paths\n"); + sb.append(" 0\n"); + sb.append(" Examples of paths.\n"); + sb.append(" \n"); + sb.append(" Tessellated\n"); + sb.append(" 0\n"); + sb.append(" tag has a value of 1, the line will contour to the underlying terrain]]>\n"); + sb.append(" \n"); + sb.append(" 1\n"); + sb.append(" "); + + for (OsmPathElement n : t.nodes) { + sb.append(formatILon(n.getILon())).append(",").append(formatILat(n.getILat())).append("\n"); + } + + sb.append(" \n"); + sb.append(" \n"); + sb.append(" \n"); + sb.append(" \n"); + if (t.exportWaypoints || !t.pois.isEmpty()) { + if (!t.pois.isEmpty()) { + sb.append(" \n"); + sb.append(" poi\n"); + for (int i = 0; i < t.pois.size(); i++) { + OsmNodeNamed poi = t.pois.get(i); + createPlaceMark(sb, poi.name, poi.ilat, poi.ilon); + } + sb.append(" \n"); + } + + if (t.exportWaypoints) { + int size = t.matchedWaypoints.size(); + createFolder(sb, "start", t.matchedWaypoints.subList(0, 1)); + if (t.matchedWaypoints.size() > 2) { + createFolder(sb, "via", t.matchedWaypoints.subList(1, size - 1)); + } + createFolder(sb, "end", t.matchedWaypoints.subList(size - 1, size)); + } + } + sb.append(" \n"); + sb.append("\n"); + + return sb.toString(); + } + + private void createFolder(StringBuilder sb, String type, List waypoints) { + sb.append(" \n"); + sb.append(" " + type + "\n"); + for (int i = 0; i < waypoints.size(); i++) { + MatchedWaypoint wp = waypoints.get(i); + createPlaceMark(sb, wp.name, wp.waypoint.ilat, wp.waypoint.ilon); + } + sb.append(" \n"); + } + + private void createPlaceMark(StringBuilder sb, String name, int ilat, int ilon) { + sb.append(" \n"); + sb.append(" " + StringUtils.escapeXml10(name) + "\n"); + sb.append(" \n"); + sb.append(" " + formatILon(ilon) + "," + formatILat(ilat) + "\n"); + sb.append(" \n"); + sb.append(" \n"); + } + +} diff --git a/brouter-core/src/main/java/btools/router/Formatter.java b/brouter-core/src/main/java/btools/router/Formatter.java new file mode 100644 index 0000000..190d279 --- /dev/null +++ b/brouter-core/src/main/java/btools/router/Formatter.java @@ -0,0 +1,73 @@ +package btools.router; + +import java.io.BufferedWriter; +import java.io.FileWriter; + +public abstract class Formatter { + private static final int OUTPUT_FORMAT_GPX = 0; + private static final int OUTPUT_FORMAT_KML = 1; + private static final int OUTPUT_FORMAT_JSON = 2; + private static final int OUTPUT_FORMAT_CSV = 3; + + static final String MESSAGES_HEADER = "Longitude\tLatitude\tElevation\tDistance\tCostPerKm\tElevCost\tTurnCost\tNodeCost\tInitialCost\tWayTags\tNodeTags\tTime\tEnergy"; + + RoutingContext rc; + + Formatter() { + } + + Formatter(RoutingContext rc) { + this.rc = rc; + } + + /** + * writes the track in gpx-format to a file + * + * @param filename the filename to write to + * @param t the track to write + */ + public void write(String filename, OsmTrack t) throws Exception { + BufferedWriter bw = new BufferedWriter(new FileWriter(filename)); + bw.write(format(t)); + bw.close(); + } + + public OsmTrack read(String filename) throws Exception { + return null; + } + + /** + * writes the track in a selected output format to a string + * + * @param t the track to format + * @return the formatted string + */ + public abstract String format(OsmTrack t); + + + static String formatILon(int ilon) { + return formatPos(ilon - 180000000); + } + + static String formatILat(int ilat) { + return formatPos(ilat - 90000000); + } + + private static String formatPos(int p) { + boolean negative = p < 0; + if (negative) + p = -p; + char[] ac = new char[12]; + int i = 11; + while (p != 0 || i > 3) { + ac[i--] = (char) ('0' + (p % 10)); + p /= 10; + if (i == 5) + ac[i--] = '.'; + } + if (negative) + ac[i--] = '-'; + return new String(ac, i + 1, 11 - i); + } + +} From c47444e0f881fe146385dcecaf0b6357c5050de6 Mon Sep 17 00:00:00 2001 From: afischerdev Date: Mon, 20 Nov 2023 17:09:14 +0100 Subject: [PATCH 02/30] enabled functions for public --- .../src/main/java/btools/router/OsmTrack.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/brouter-core/src/main/java/btools/router/OsmTrack.java b/brouter-core/src/main/java/btools/router/OsmTrack.java index ac3b51f..d070256 100644 --- a/brouter-core/src/main/java/btools/router/OsmTrack.java +++ b/brouter-core/src/main/java/btools/router/OsmTrack.java @@ -66,7 +66,7 @@ public final class OsmTrack { private CompactLongMap detourMap; - private VoiceHintList voiceHints; + public VoiceHintList voiceHints; public String message = null; public List messageList = null; @@ -178,7 +178,7 @@ public final class OsmTrack { nodesMap = new FrozenLongMap<>(nodesMap); } - private List aggregateMessages() { + public List aggregateMessages() { ArrayList res = new ArrayList<>(); MessageData current = null; for (OsmPathElement n : nodes) { @@ -200,7 +200,7 @@ public final class OsmTrack { return res; } - private List aggregateSpeedProfile() { + public List aggregateSpeedProfile() { ArrayList res = new ArrayList<>(); int vmax = -1; int vmaxe = -1; @@ -1140,7 +1140,7 @@ public final class OsmTrack { sb.append(" }"); } - private VoiceHint getVoiceHint(int i) { + public VoiceHint getVoiceHint(int i) { if (voiceHints == null) return null; for (VoiceHint hint : voiceHints.list) { if (hint.indexInTrack == i) { @@ -1150,7 +1150,7 @@ public final class OsmTrack { return null; } - private MatchedWaypoint getMatchedWaypoint(int idx) { + public MatchedWaypoint getMatchedWaypoint(int idx) { if (matchedWaypoints == null) return null; for (MatchedWaypoint wp : matchedWaypoints) { if (idx == wp.indexInTrack) { @@ -1168,7 +1168,7 @@ public final class OsmTrack { return vnode0 < vnode1 ? vnode0 : vnode1; } - private int getTotalSeconds() { + public int getTotalSeconds() { float s = nodes.size() < 2 ? 0 : nodes.get(nodes.size() - 1).getTime() - nodes.get(0).getTime(); return (int) (s + 0.5); } @@ -1398,7 +1398,7 @@ public final class OsmTrack { return 2; } - private float getVoiceHintTime(int i) { + public float getVoiceHintTime(int i) { if (voiceHints.list.isEmpty()) { return 0f; } From ad3db9c00450abeaddb96f442a26fc95f7e78c2b Mon Sep 17 00:00:00 2001 From: afischerdev Date: Mon, 20 Nov 2023 17:33:09 +0100 Subject: [PATCH 03/30] updated output for command line --- .../java/btools/router/RoutingEngine.java | 80 +++++++++++++++---- 1 file changed, 64 insertions(+), 16 deletions(-) diff --git a/brouter-core/src/main/java/btools/router/RoutingEngine.java b/brouter-core/src/main/java/btools/router/RoutingEngine.java index baff3dc..c3c2597 100644 --- a/brouter-core/src/main/java/btools/router/RoutingEngine.java +++ b/brouter-core/src/main/java/btools/router/RoutingEngine.java @@ -199,27 +199,63 @@ public class RoutingEngine extends Thread { messageList.add(track.message); track.messageList = messageList; if (outfileBase != null) { - String filename = outfileBase + i + ".gpx"; - OsmTrack oldTrack = new OsmTrack(); - oldTrack.readGpx(filename); - if (track.equalsTrack(oldTrack)) { + String filename = outfileBase + i + "." + routingContext.outputFormat; + OsmTrack oldTrack = null; + switch (routingContext.outputFormat) { + case "gpx": + oldTrack = new FormatGpx(routingContext).read(filename); + break; + case "geojson": // read only gpx at the moment + case "json": + // oldTrack = new FormatJson(routingContext).read(filename); + break; + case "kml": + // oldTrack = new FormatJson(routingContext).read(filename); + break; + default: + break; + } + if (oldTrack != null && track.equalsTrack(oldTrack)) { continue; } oldTrack = null; track.exportWaypoints = routingContext.exportWaypoints; - // doesn't work at the moment - // use routingContext.outputFormat - track.writeGpx(filename); + filename = outfileBase + i + "." + routingContext.outputFormat; + switch (routingContext.outputFormat) { + case "gpx": + outputMessage = new FormatGpx(routingContext).format(track); + break; + case "geojson": + case "json": + outputMessage = new FormatJson(routingContext).format(track); + break; + case "kml": + outputMessage = new FormatKml(routingContext).format(track); + break; + case "csv": + default: + outputMessage = null; + break; + } + if (outputMessage != null) { + File out = new File(filename); + FileWriter fw = new FileWriter(filename); + fw.write(outputMessage); + fw.close(); + outputMessage = null; + } + foundTrack = track; alternativeIndex = i; outfile = filename; } else { if (i == routingContext.getAlternativeIdx(0, 3)) { if ("CSV".equals(System.getProperty("reportFormat"))) { - track.dumpMessages(null, routingContext); + String filename = outfileBase + i + ".csv"; + new FormatCsv(routingContext).write(filename, track); } else { if (!quite) { - System.out.println(track.formatAsGpx()); + System.out.println(new FormatGpx(routingContext).format(track)); } } foundTrack = track; @@ -229,7 +265,7 @@ public class RoutingEngine extends Thread { } if (logfileBase != null) { String logfilename = logfileBase + i + ".csv"; - track.dumpMessages(logfilename, routingContext); + new FormatCsv(routingContext).write(logfilename, track); } break; } @@ -308,15 +344,27 @@ public class RoutingEngine extends Thread { OsmNodeNamed n = new OsmNodeNamed(listOne.get(0).crosspoint); n.selev = startNode != null ? startNode.getSElev() : Short.MIN_VALUE; - // doesn't work at the moment - // use routingContext.outputFormat - outputMessage = OsmTrack.formatAsGpxWaypoint(n); + switch (routingContext.outputFormat) { + case "gpx": + outputMessage = new FormatGpx(routingContext).formatAsWaypoint(n); + break; + case "geojson": + case "json": + outputMessage = new FormatJson(routingContext).formatAsWaypoint(n); + break; + case "kml": + case "csv": + default: + outputMessage = null; + break; + } if (outfileBase != null) { - String filename = outfileBase + ".gpx"; + String filename = outfileBase + "." + routingContext.outputFormat; File out = new File(filename); FileWriter fw = new FileWriter(filename); fw.write(outputMessage); fw.close(); + outputMessage = null; } long endTime = System.currentTimeMillis(); logInfo("execution time = " + (endTime - startTime) / 1000. + " seconds"); @@ -951,7 +999,7 @@ public class RoutingEngine extends Thread { if (track == null) { for (int cfi = 0; cfi < airDistanceCostFactors.length; cfi++) { - if (cfi > 0) lastAirDistanceCostFactor = airDistanceCostFactors[cfi-1]; + if (cfi > 0) lastAirDistanceCostFactor = airDistanceCostFactors[cfi - 1]; airDistanceCostFactor = airDistanceCostFactors[cfi]; if (airDistanceCostFactor < 0.) { @@ -1447,7 +1495,7 @@ public class RoutingEngine extends Thread { boolean inRadius = boundary == null || boundary.isInBoundary(nextNode, bestPath.cost); - if (inRadius && (isFinalLink || bestPath.cost + bestPath.airdistance <= (lastAirDistanceCostFactor != 0. ? maxTotalCost*lastAirDistanceCostFactor : maxTotalCost) + addDiff)) { + if (inRadius && (isFinalLink || bestPath.cost + bestPath.airdistance <= (lastAirDistanceCostFactor != 0. ? maxTotalCost * lastAirDistanceCostFactor : maxTotalCost) + addDiff)) { // add only if this may beat an existing path for that link OsmLinkHolder dominator = link.getFirstLinkHolder(currentNode); while (!trafficSim && dominator != null) { From 149b83056e45df9cf4444e7a397b600c084e459d Mon Sep 17 00:00:00 2001 From: afischerdev Date: Mon, 20 Nov 2023 17:39:29 +0100 Subject: [PATCH 04/30] updated output for server --- .../btools/server/request/ServerHandler.java | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/brouter-server/src/main/java/btools/server/request/ServerHandler.java b/brouter-server/src/main/java/btools/server/request/ServerHandler.java index 898121c..505fd2b 100644 --- a/brouter-server/src/main/java/btools/server/request/ServerHandler.java +++ b/brouter-server/src/main/java/btools/server/request/ServerHandler.java @@ -1,10 +1,12 @@ package btools.server.request; -import java.io.BufferedWriter; import java.io.File; -import java.io.StringWriter; import java.util.Map; +import btools.router.FormatCsv; +import btools.router.FormatGpx; +import btools.router.FormatJson; +import btools.router.FormatKml; import btools.router.OsmTrack; import btools.router.RoutingContext; import btools.server.ServiceContext; @@ -76,23 +78,17 @@ public class ServerHandler extends RequestHandler { } if (format == null || "gpx".equals(format)) { - result = track.formatAsGpx(); + result = new FormatGpx(rc).format(track); } else if ("kml".equals(format)) { - result = track.formatAsKml(); + result = new FormatKml(rc).format(track); } else if ("geojson".equals(format)) { - result = track.formatAsGeoJson(); + result = new FormatJson(rc).format(track); } else if ("csv".equals(format)) { - try { - StringWriter sw = new StringWriter(); - BufferedWriter bw = new BufferedWriter(sw); - track.writeMessages(bw, rc); - return sw.toString(); - } catch (Exception ex) { - return "Error: " + ex.getMessage(); - } + result = new FormatCsv(rc).format(track); } else { System.out.println("unknown track format '" + format + "', using default"); - result = track.formatAsGpx(); + //result = track.formatAsGpx(); + result = new FormatGpx(rc).format(track); } return result; From 24e15b54663e3366f2858ca60003136d88d8b8a9 Mon Sep 17 00:00:00 2001 From: afischerdev Date: Mon, 20 Nov 2023 18:12:21 +0100 Subject: [PATCH 05/30] updated output for app --- .../java/btools/routingapp/BRouterWorker.java | 52 ++++++++++--------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/brouter-routing-app/src/main/java/btools/routingapp/BRouterWorker.java b/brouter-routing-app/src/main/java/btools/routingapp/BRouterWorker.java index 5823db5..64e73d5 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/BRouterWorker.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/BRouterWorker.java @@ -12,6 +12,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import btools.router.FormatGpx; +import btools.router.FormatJson; +import btools.router.FormatKml; import btools.router.OsmNodeNamed; import btools.router.OsmTrack; import btools.router.RoutingContext; @@ -151,42 +154,41 @@ public class BRouterWorker { if ("kml".equals(rc.outputFormat)) writeFromat = OUTPUT_FORMAT_KML; if ("json".equals(rc.outputFormat)) writeFromat = OUTPUT_FORMAT_JSON; } - - OsmTrack track = cr.getFoundTrack(); + OsmTrack track = null; + track = cr.getFoundTrack(); if (track != null) { track.exportWaypoints = rc.exportWaypoints; if (pathToFileResult == null) { switch (writeFromat) { - case OUTPUT_FORMAT_GPX: - return track.formatAsGpx(); case OUTPUT_FORMAT_KML: - return track.formatAsKml(); + return new FormatKml(rc).format(track); case OUTPUT_FORMAT_JSON: - return track.formatAsGeoJson(); + return new FormatJson(rc).format(track); + case OUTPUT_FORMAT_GPX: default: - return track.formatAsGpx(); + return new FormatGpx(rc).format(track); } } - try { - switch (writeFromat) { - case OUTPUT_FORMAT_GPX: - track.writeGpx(pathToFileResult); - break; - case OUTPUT_FORMAT_KML: - track.writeKml(pathToFileResult); - break; - case OUTPUT_FORMAT_JSON: - track.writeJson(pathToFileResult); - break; - default: - track.writeGpx(pathToFileResult); - break; - } - } catch (Exception e) { - return "error writing file: " + e; - } + } + try { + switch (writeFromat) { + case OUTPUT_FORMAT_KML: + new FormatKml(rc).write(pathToFileResult, track); + break; + case OUTPUT_FORMAT_JSON: + new FormatJson(rc).write(pathToFileResult, track); + break; + case OUTPUT_FORMAT_GPX: + default: + new FormatGpx(rc).write(pathToFileResult, track); + break; + } + } catch (Exception e) { + return "error writing file: " + e; + } + } else { // get other infos if (cr.getErrorMessage() != null) { return cr.getErrorMessage(); From fcbaf598aa29698ebf3525c1b348b896ee4683ce Mon Sep 17 00:00:00 2001 From: afischerdev Date: Tue, 21 Nov 2023 13:00:39 +0100 Subject: [PATCH 06/30] moved some format routines --- .../main/java/btools/router/FormatGpx.java | 2 +- .../main/java/btools/router/Formatter.java | 41 +++++++++++++++++++ .../java/btools/router/RoutingEngine.java | 4 +- 3 files changed, 44 insertions(+), 3 deletions(-) diff --git a/brouter-core/src/main/java/btools/router/FormatGpx.java b/brouter-core/src/main/java/btools/router/FormatGpx.java index e162292..0ed6cc5 100644 --- a/brouter-core/src/main/java/btools/router/FormatGpx.java +++ b/brouter-core/src/main/java/btools/router/FormatGpx.java @@ -250,7 +250,7 @@ public class FormatGpx extends Formatter { MatchedWaypoint mwpt = t.getMatchedWaypoint(idx); if (t.showTime) { - sele += ""; + sele += ""; } if (turnInstructionMode == 8) { if (mwpt != null && diff --git a/brouter-core/src/main/java/btools/router/Formatter.java b/brouter-core/src/main/java/btools/router/Formatter.java index 190d279..b9c3276 100644 --- a/brouter-core/src/main/java/btools/router/Formatter.java +++ b/brouter-core/src/main/java/btools/router/Formatter.java @@ -2,6 +2,10 @@ package btools.router; import java.io.BufferedWriter; import java.io.FileWriter; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Locale; +import java.util.TimeZone; public abstract class Formatter { private static final int OUTPUT_FORMAT_GPX = 0; @@ -70,4 +74,41 @@ public abstract class Formatter { return new String(ac, i + 1, 11 - i); } + public static String getFormattedTime2(int s) { + int seconds = (int) (s + 0.5); + int hours = seconds / 3600; + int minutes = (seconds - hours * 3600) / 60; + seconds = seconds - hours * 3600 - minutes * 60; + String time = ""; + if (hours != 0) + time = "" + hours + "h "; + if (minutes != 0) + time = time + minutes + "m "; + if (seconds != 0) + time = time + seconds + "s"; + return time; + } + + static public String getFormattedEnergy(int energy) { + return format1(energy / 3600000.) + "kwh"; + } + + static private String format1(double n) { + String s = "" + (long) (n * 10 + 0.5); + int len = s.length(); + return s.substring(0, len - 1) + "." + s.charAt(len - 1); + } + + + static final String dateformat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"; + + static public String getFormattedTime3(float time) { + SimpleDateFormat TIMESTAMP_FORMAT = new SimpleDateFormat(dateformat, Locale.US); + TIMESTAMP_FORMAT.setTimeZone(TimeZone.getTimeZone("UTC")); + // yyyy-mm-ddThh:mm:ss.SSSZ + Date d = new Date((long) (time * 1000f)); + return TIMESTAMP_FORMAT.format(d); + } + + } diff --git a/brouter-core/src/main/java/btools/router/RoutingEngine.java b/brouter-core/src/main/java/btools/router/RoutingEngine.java index c3c2597..a3c2d1e 100644 --- a/brouter-core/src/main/java/btools/router/RoutingEngine.java +++ b/brouter-core/src/main/java/btools/router/RoutingEngine.java @@ -192,7 +192,7 @@ public class RoutingEngine extends Thread { track.message = "track-length = " + track.distance + " filtered ascend = " + track.ascend + " plain-ascend = " + track.plainAscend + " cost=" + track.cost; if (track.energy != 0) { - track.message += " energy=" + track.getFormattedEnergy() + " time=" + track.getFormattedTime2(); + track.message += " energy=" + Formatter.getFormattedEnergy(track.energy) + " time=" + Formatter.getFormattedTime2(track.getTotalSeconds()); } track.name = "brouter_" + routingContext.getProfileName() + "_" + i; @@ -1676,7 +1676,7 @@ public class RoutingEngine extends Thread { } public String getTime() { - return foundTrack.getFormattedTime2(); + return Formatter.getFormattedTime2(foundTrack.getTotalSeconds()); } public OsmTrack getFoundTrack() { From 8a7fa9fa810466751c68831a587e6a076ebfb560 Mon Sep 17 00:00:00 2001 From: afischerdev Date: Tue, 21 Nov 2023 13:26:05 +0100 Subject: [PATCH 07/30] changes for engineMode 2 --- .../java/btools/router/RoutingEngine.java | 4 +++ .../src/main/java/btools/server/BRouter.java | 6 +++- .../main/java/btools/server/RouteServer.java | 31 +++++++++++++------ 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/brouter-core/src/main/java/btools/router/RoutingEngine.java b/brouter-core/src/main/java/btools/router/RoutingEngine.java index a3c2d1e..105ed09 100644 --- a/brouter-core/src/main/java/btools/router/RoutingEngine.java +++ b/brouter-core/src/main/java/btools/router/RoutingEngine.java @@ -365,6 +365,10 @@ public class RoutingEngine extends Thread { fw.write(outputMessage); fw.close(); outputMessage = null; + } else { + if (!quite && outputMessage != null) { + System.out.println(outputMessage); + } } long endTime = System.currentTimeMillis(); logInfo("execution time = " + (endTime - startTime) / 1000. + " seconds"); diff --git a/brouter-server/src/main/java/btools/server/BRouter.java b/brouter-server/src/main/java/btools/server/BRouter.java index 3788e51..a6dfe10 100644 --- a/brouter-server/src/main/java/btools/server/BRouter.java +++ b/brouter-server/src/main/java/btools/server/BRouter.java @@ -30,6 +30,10 @@ public class BRouter { List wplist = routingParamCollector.getWayPointList(lonlats); Map params = routingParamCollector.getUrlParams(queryString); + int engineMode = 0; + if (params.containsKey("engineMode")) { + engineMode = Integer.parseInt(params.get("engineMode")); + } routingParamCollector.setParams(rc, wplist, params); String exportName = null; @@ -47,7 +51,7 @@ public class BRouter { maxRunningTime = Integer.parseInt(sMaxRunningTime) * 1000; } - RoutingEngine re = new RoutingEngine(exportName, null, new File(args[0]), wplist, rc); + RoutingEngine re = new RoutingEngine(exportName, null, new File(args[0]), wplist, rc, engineMode); re.doRun(maxRunningTime); if (re.getErrorMessage() != null) { System.out.println(re.getErrorMessage()); diff --git a/brouter-server/src/main/java/btools/server/RouteServer.java b/brouter-server/src/main/java/btools/server/RouteServer.java index bb5e98c..ba421f9 100644 --- a/brouter-server/src/main/java/btools/server/RouteServer.java +++ b/brouter-server/src/main/java/btools/server/RouteServer.java @@ -211,18 +211,29 @@ public class RouteServer extends Thread implements Comparable { } else { OsmTrack track = cr.getFoundTrack(); + if (engineMode == 2) { + // no zip for this engineMode + encodings = null; + } String headers = encodings == null || encodings.indexOf("gzip") < 0 ? null : "Content-Encoding: gzip\n"; writeHttpHeader(bw, handler.getMimeType(), handler.getFileName(), headers, HTTP_STATUS_OK); - if (track != null) { - if (headers != null) { // compressed - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - Writer w = new OutputStreamWriter(new GZIPOutputStream(baos), "UTF-8"); - w.write(handler.formatTrack(track)); - w.close(); - bw.flush(); - clientSocket.getOutputStream().write(baos.toByteArray()); - } else { - bw.write(handler.formatTrack(track)); + if (engineMode == 0) { + if (track != null) { + if (headers != null) { // compressed + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + Writer w = new OutputStreamWriter(new GZIPOutputStream(baos), "UTF-8"); + w.write(handler.formatTrack(track)); + w.close(); + bw.flush(); + clientSocket.getOutputStream().write(baos.toByteArray()); + } else { + bw.write(handler.formatTrack(track)); + } + } + } else if (engineMode == 2) { + String s = cr.getFoundInfo(); + if (s != null) { + bw.write(s); } } } From cb0b1d88554a09acb73daa9e45a4846edeacda38 Mon Sep 17 00:00:00 2001 From: afischerdev Date: Tue, 21 Nov 2023 14:05:19 +0100 Subject: [PATCH 08/30] removed unused formatting --- .../main/java/btools/router/Formatter.java | 4 - .../src/main/java/btools/router/OsmTrack.java | 873 ------------------ 2 files changed, 877 deletions(-) diff --git a/brouter-core/src/main/java/btools/router/Formatter.java b/brouter-core/src/main/java/btools/router/Formatter.java index b9c3276..09bdb1d 100644 --- a/brouter-core/src/main/java/btools/router/Formatter.java +++ b/brouter-core/src/main/java/btools/router/Formatter.java @@ -8,10 +8,6 @@ import java.util.Locale; import java.util.TimeZone; public abstract class Formatter { - private static final int OUTPUT_FORMAT_GPX = 0; - private static final int OUTPUT_FORMAT_KML = 1; - private static final int OUTPUT_FORMAT_JSON = 2; - private static final int OUTPUT_FORMAT_CSV = 3; static final String MESSAGES_HEADER = "Longitude\tLatitude\tElevation\tDistance\tCostPerKm\tElevCost\tTurnCost\tNodeCost\tInitialCost\tWayTags\tNodeTags\tTime\tEnergy"; diff --git a/brouter-core/src/main/java/btools/router/OsmTrack.java b/brouter-core/src/main/java/btools/router/OsmTrack.java index d070256..9ccff98 100644 --- a/brouter-core/src/main/java/btools/router/OsmTrack.java +++ b/brouter-core/src/main/java/btools/router/OsmTrack.java @@ -7,33 +7,20 @@ package btools.router; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; -import java.io.BufferedReader; -import java.io.BufferedWriter; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.EOFException; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; -import java.io.FileWriter; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.StringWriter; -import java.text.DecimalFormat; -import java.text.NumberFormat; -import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.Date; import java.util.List; -import java.util.Locale; import java.util.Map; -import java.util.TimeZone; import btools.mapaccess.MatchedWaypoint; import btools.mapaccess.OsmPos; import btools.util.CompactLongMap; import btools.util.FrozenLongMap; -import btools.util.StringUtils; public final class OsmTrack { final public static String version = "1.7.3"; @@ -395,751 +382,8 @@ public final class OsmTrack { public int plainAscend; public int cost; public int energy; - - /** - * writes the track in gpx-format to a file - * - * @param filename the filename to write to - */ - public void writeGpx(String filename) throws Exception { - BufferedWriter bw = new BufferedWriter(new FileWriter(filename)); - formatAsGpx(bw); - bw.close(); - } - - public String formatAsGpx() { - try { - StringWriter sw = new StringWriter(8192); - BufferedWriter bw = new BufferedWriter(sw); - formatAsGpx(bw); - bw.close(); - return sw.toString(); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - public String formatAsGpx(BufferedWriter sb) throws IOException { - int turnInstructionMode = voiceHints != null ? voiceHints.turnInstructionMode : 0; - - sb.append("\n"); - if (turnInstructionMode != 9) { - for (int i = messageList.size() - 1; i >= 0; i--) { - String message = messageList.get(i); - if (i < messageList.size() - 1) - message = "(alt-index " + i + ": " + message + " )"; - if (message != null) - sb.append("\n"); - } - } - - if (turnInstructionMode == 4) { // comment style - sb.append("\n"); - sb.append("\n"); - sb.append("\n"); - } - sb.append("\n"); - } else { - sb.append(" creator=\"BRouter-" + version + "\" version=\"1.1\">\n"); - } - if (turnInstructionMode == 9) { - sb.append(" \n"); - sb.append(" ").append(name).append("\n"); - sb.append(" \n"); - sb.append(" ").append(messageList.get(0)).append("\n"); - if (params != null && params.size() > 0) { - sb.append(" e : params.entrySet()) { - if (i++ != 0) sb.append("&"); - sb.append(e.getKey()).append("=").append(e.getValue()); - } - sb.append("]]>\n"); - } - sb.append(" \n"); - sb.append(" \n"); - } - if (turnInstructionMode == 3 || turnInstructionMode == 8) { // osmand style, cruiser - float lastRteTime = 0; - - sb.append(" \n"); - - float rteTime = getVoiceHintTime(0); - StringBuffer first = new StringBuffer(); - // define start point - { - first.append(" \n") - .append(" start\n \n"); - if (rteTime != lastRteTime) { // add timing only if available - double t = rteTime - lastRteTime; - first.append(" \n"); - lastRteTime = rteTime; - } - first.append(" 0\n \n \n"); - } - if (turnInstructionMode == 8) { - if (matchedWaypoints.get(0).direct && voiceHints.list.get(0).indexInTrack == 0) { - // has a voice hint do nothing, voice hint will do - } else { - sb.append(first.toString()); - } - } else { - sb.append(first.toString()); - } - - for (int i = 0; i < voiceHints.list.size(); i++) { - VoiceHint hint = voiceHints.list.get(i); - sb.append(" \n") - .append(" ") - .append(turnInstructionMode == 3 ? hint.getMessageString() : hint.getCruiserMessageString()) - .append("\n \n"); - - rteTime = getVoiceHintTime(i + 1); - - if (rteTime != lastRteTime) { // add timing only if available - double t = rteTime - lastRteTime; - sb.append(" \n"); - lastRteTime = rteTime; - } - sb.append(" ") - .append(turnInstructionMode == 3 ? hint.getCommandString() : hint.getCruiserCommandString()) - .append("\n ").append("" + (int) hint.angle) - .append("\n ").append("" + hint.indexInTrack).append("\n \n \n"); - } - sb.append(" \n") - .append(" destination\n \n"); - sb.append(" \n"); - sb.append(" ").append("" + (nodes.size() - 1)).append("\n \n \n"); - - sb.append("\n"); - } - - if (turnInstructionMode == 7) { // old locus style - float lastRteTime = getVoiceHintTime(0); - - for (int i = 0; i < voiceHints.list.size(); i++) { - VoiceHint hint = voiceHints.list.get(i); - sb.append(" ") - .append(hint.selev == Short.MIN_VALUE ? "" : "" + (hint.selev / 4.) + "") - .append("").append(hint.getMessageString()).append("") - .append("").append("" + hint.distanceToNext).append(""); - float rteTime = getVoiceHintTime(i + 1); - if (rteTime != lastRteTime) { // add timing only if available - double t = rteTime - lastRteTime; - double speed = hint.distanceToNext / t; - sb.append("").append("" + t).append("") - .append("").append("" + speed).append(""); - lastRteTime = rteTime; - } - sb.append("").append("" + hint.getLocusAction()).append("") - .append("\n"); - } - } - if (turnInstructionMode == 5) { // gpsies style - for (VoiceHint hint : voiceHints.list) { - sb.append(" ") - .append("").append(hint.getMessageString()).append("") - .append("").append(hint.getSymbolString().toLowerCase()).append("") - .append("").append(hint.getSymbolString()).append("") - .append("\n"); - } - } - - if (turnInstructionMode == 6) { // orux style - for (VoiceHint hint : voiceHints.list) { - sb.append(" ") - .append(hint.selev == Short.MIN_VALUE ? "" : "" + (hint.selev / 4.) + "") - .append("\n" + - " \n" + - " ").append("" + hint.getOruxAction()) - .append("\n" + - " \n" + - " \n" + - " \n"); - } - } - - for (int i = 0; i <= pois.size() - 1; i++) { - OsmNodeNamed poi = pois.get(i); - sb.append(" \n") - .append(" ").append(StringUtils.escapeXml10(poi.name)).append("\n") - .append(" \n"); - } - - if (exportWaypoints) { - for (int i = 0; i <= matchedWaypoints.size() - 1; i++) { - MatchedWaypoint wt = matchedWaypoints.get(i); - sb.append(" \n") - .append(" ").append(StringUtils.escapeXml10(wt.name)).append("\n"); - if (i == 0) { - sb.append(" from\n"); - } else if (i == matchedWaypoints.size() - 1) { - sb.append(" to\n"); - } else { - sb.append(" via\n"); - } - sb.append(" \n"); - } - } - sb.append(" \n"); - if (turnInstructionMode == 9 - || turnInstructionMode == 2 - || turnInstructionMode == 8 - || turnInstructionMode == 4) { // Locus, comment, cruise, brouter style - sb.append(" ").append(name).append("\n"); - sb.append(" ").append(voiceHints.getTransportMode()).append("\n"); - } else { - sb.append(" ").append(name).append("\n"); - } - - if (turnInstructionMode == 7) { - sb.append(" \n"); - sb.append(" ").append("" + voiceHints.getLocusRouteType()).append("\n"); - sb.append(" 1\n"); - sb.append(" \n"); - } - - - // all points - sb.append(" \n"); - String lastway = ""; - boolean bNextDirect = false; - OsmPathElement nn = null; - String aSpeed; - - for (int idx = 0; idx < nodes.size(); idx++) { - OsmPathElement n = nodes.get(idx); - String sele = n.getSElev() == Short.MIN_VALUE ? "" : "" + n.getElev() + ""; - VoiceHint hint = getVoiceHint(idx); - MatchedWaypoint mwpt = getMatchedWaypoint(idx); - - if (showTime) { - sele += ""; - } - if (turnInstructionMode == 8) { - if (mwpt != null && - !mwpt.name.startsWith("via") && !mwpt.name.startsWith("from") && !mwpt.name.startsWith("to")) { - sele += "" + mwpt.name + ""; - } - } - boolean bNeedHeader = false; - if (turnInstructionMode == 9) { // trkpt/sym style - - if (hint != null) { - - if (mwpt != null && - !mwpt.name.startsWith("via") && !mwpt.name.startsWith("from") && !mwpt.name.startsWith("to")) { - sele += "" + mwpt.name + ""; - } - sele += "" + hint.getCruiserMessageString() + ""; - sele += "" + hint.getCommandString(hint.cmd) + ""; - if (mwpt != null) { - sele += "Via"; - } - sele += ""; - if (showspeed) { - double speed = 0; - if (nn != null) { - int dist = n.calcDistance(nn); - float dt = n.getTime() - nn.getTime(); - if (dt != 0.f) { - speed = ((3.6f * dist) / dt + 0.5); - } - } - sele += "" + (((int) (speed * 10)) / 10.f) + ""; - } - - sele += "" + hint.getCommandString() + ";" + (int) (hint.distanceToNext) + "," + hint.formatGeometry() + ""; - if (n.message != null && n.message.wayKeyValues != null && !n.message.wayKeyValues.equals(lastway)) { - sele += "" + n.message.wayKeyValues + ""; - lastway = n.message.wayKeyValues; - } - if (n.message != null && n.message.nodeKeyValues != null) { - sele += "" + n.message.nodeKeyValues + ""; - } - sele += ""; - - } - if (idx == 0 && hint == null) { - if (mwpt != null && mwpt.direct) { - sele += "beeline"; - } else { - sele += "start"; - } - sele += "Via"; - - } else if (idx == nodes.size() - 1 && hint == null) { - - sele += "end"; - sele += "Via"; - - } else { - if (mwpt != null && hint == null) { - if (mwpt.direct) { - // bNextDirect = true; - sele += "beeline"; - } else { - sele += "" + mwpt.name + ""; - } - sele += "Via"; - bNextDirect = false; - } - } - - - if (hint == null) { - bNeedHeader = (showspeed || (n.message != null && n.message.wayKeyValues != null && !n.message.wayKeyValues.equals(lastway))) || - (n.message != null && n.message.nodeKeyValues != null); - if (bNeedHeader) { - sele += ""; - if (showspeed) { - double speed = 0; - if (nn != null) { - int dist = n.calcDistance(nn); - float dt = n.getTime() - nn.getTime(); - if (dt != 0.f) { - speed = ((3.6f * dist) / dt + 0.5); - } - } - sele += "" + (((int) (speed * 10)) / 10.f) + ""; - } - if (n.message != null && n.message.wayKeyValues != null && !n.message.wayKeyValues.equals(lastway)) { - sele += "" + n.message.wayKeyValues + ""; - lastway = n.message.wayKeyValues; - } - if (n.message != null && n.message.nodeKeyValues != null) { - sele += "" + n.message.nodeKeyValues + ""; - } - sele += ""; - } - } - } - - if (turnInstructionMode == 2) { // locus style new - if (hint != null) { - if (mwpt != null) { - if (!mwpt.name.startsWith("via") && !mwpt.name.startsWith("from") && !mwpt.name.startsWith("to")) { - sele += "" + mwpt.name + ""; - } - if (mwpt.direct && bNextDirect) { - sele += "" + hint.getLocusSymbolString() + "pass_placeShaping"; - // bNextDirect = false; - } else if (mwpt.direct) { - if (idx == 0) - sele += "pass_placeVia"; - else - sele += "pass_placeShaping"; - bNextDirect = true; - } else if (bNextDirect) { - sele += "beeline" + hint.getLocusSymbolString() + "Shaping"; - bNextDirect = false; - } else { - sele += "" + hint.getLocusSymbolString() + "Via"; - } - } else { - sele += "" + hint.getLocusSymbolString() + ""; - } - } else { - if (idx == 0 && hint == null) { - - int pos = sele.indexOf(""; - if (mwpt != null && mwpt.direct) { - bNextDirect = true; - } - sele += "pass_place"; - sele += "Via"; - - } else if (idx == nodes.size() - 1 && hint == null) { - - int pos = sele.indexOf(""; - if (bNextDirect) { - sele += "beeline"; - } - sele += "pass_place"; - sele += "Via"; - - } else { - if (mwpt != null) { - if (!mwpt.name.startsWith("via") && !mwpt.name.startsWith("from") && !mwpt.name.startsWith("to")) { - sele += "" + mwpt.name + ""; - } - if (mwpt.direct && bNextDirect) { - sele += "beelinepass_placeShaping"; - } else if (mwpt.direct) { - if (idx == 0) - sele += "pass_placeVia"; - else - sele += "pass_placeShaping"; - bNextDirect = true; - } else if (bNextDirect) { - sele += "beelinepass_placeShaping"; - bNextDirect = false; - } else if (mwpt.name.startsWith("via") || - mwpt.name.startsWith("from") || - mwpt.name.startsWith("to")) { - if (bNextDirect) { - sele += "beelinepass_placeShaping"; - } else { - sele += "pass_placeVia"; - } - bNextDirect = false; - } else { - sele += "" + mwpt.name + ""; - sele += "pass_placeVia"; - } - } - } - } - } - sb.append(" ").append(sele).append("\n"); - - nn = n; - } - - sb.append(" \n"); - sb.append(" \n"); - sb.append("\n"); - - return sb.toString(); - } - - static public String formatAsGpxWaypoint(OsmNodeNamed n) { - try { - StringWriter sw = new StringWriter(8192); - BufferedWriter bw = new BufferedWriter(sw); - formatGpxHeader(bw); - formatWaypointGpx(bw, n); - formatGpxFooter(bw); - bw.close(); - sw.close(); - return sw.toString(); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - static public void formatGpxHeader(BufferedWriter sb) throws IOException { - sb.append("\n"); - sb.append("\n"); - } - - static public void formatGpxFooter(BufferedWriter sb) throws IOException { - sb.append("\n"); - } - - static public void formatWaypointGpx(BufferedWriter sb, OsmNodeNamed n) throws IOException { - sb.append(" "); - if (n.getSElev() != Short.MIN_VALUE) { - sb.append("").append("" + n.getElev()).append(""); - } - if (n.name != null) { - sb.append("").append(StringUtils.escapeXml10(n.name)).append(""); - } - if (n.nodeDescription != null) { - sb.append("").append("hat desc").append(""); - } - sb.append("\n"); - } - - public void writeKml(String filename) throws Exception { - BufferedWriter bw = new BufferedWriter(new FileWriter(filename)); - - bw.write(formatAsKml()); - bw.close(); - } - - public String formatAsKml() { - StringBuilder sb = new StringBuilder(8192); - - sb.append("\n"); - - sb.append("\n"); - sb.append(" \n"); - sb.append(" KML Samples\n"); - sb.append(" 1\n"); - sb.append(" 3.497064\n"); - sb.append(" 872\n"); - sb.append(" To enable simple instructions add: 'instructions=1' as parameter to the URL\n"); - sb.append(" \n"); - sb.append(" Paths\n"); - sb.append(" 0\n"); - sb.append(" Examples of paths.\n"); - sb.append(" \n"); - sb.append(" Tessellated\n"); - sb.append(" 0\n"); - sb.append(" tag has a value of 1, the line will contour to the underlying terrain]]>\n"); - sb.append(" \n"); - sb.append(" 1\n"); - sb.append(" "); - - for (OsmPathElement n : nodes) { - sb.append(formatILon(n.getILon())).append(",").append(formatILat(n.getILat())).append("\n"); - } - - sb.append(" \n"); - sb.append(" \n"); - sb.append(" \n"); - sb.append(" \n"); - if (exportWaypoints || !pois.isEmpty()) { - if (!pois.isEmpty()) { - sb.append(" \n"); - sb.append(" poi\n"); - for (int i = 0; i < pois.size(); i++) { - OsmNodeNamed poi = pois.get(i); - createPlaceMark(sb, poi.name, poi.ilat, poi.ilon); - } - sb.append(" \n"); - } - - if (exportWaypoints) { - int size = matchedWaypoints.size(); - createFolder(sb, "start", matchedWaypoints.subList(0, 1)); - if (matchedWaypoints.size() > 2) { - createFolder(sb, "via", matchedWaypoints.subList(1, size - 1)); - } - createFolder(sb, "end", matchedWaypoints.subList(size - 1, size)); - } - } - sb.append(" \n"); - sb.append("\n"); - - return sb.toString(); - } - - private void createFolder(StringBuilder sb, String type, List waypoints) { - sb.append(" \n"); - sb.append(" " + type + "\n"); - for (int i = 0; i < waypoints.size(); i++) { - MatchedWaypoint wp = waypoints.get(i); - createPlaceMark(sb, wp.name, wp.waypoint.ilat, wp.waypoint.ilon); - } - sb.append(" \n"); - } - - private void createPlaceMark(StringBuilder sb, String name, int ilat, int ilon) { - sb.append(" \n"); - sb.append(" " + StringUtils.escapeXml10(name) + "\n"); - sb.append(" \n"); - sb.append(" " + formatILon(ilon) + "," + formatILat(ilat) + "\n"); - sb.append(" \n"); - sb.append(" \n"); - } - public List iternity; - public void writeJson(String filename) throws Exception { - BufferedWriter bw = new BufferedWriter(new FileWriter(filename)); - - bw.write(formatAsGeoJson()); - bw.close(); - } - - - public String formatAsGeoJson() { - int turnInstructionMode = voiceHints != null ? voiceHints.turnInstructionMode : 0; - - StringBuilder sb = new StringBuilder(8192); - - sb.append("{\n"); - sb.append(" \"type\": \"FeatureCollection\",\n"); - sb.append(" \"features\": [\n"); - sb.append(" {\n"); - sb.append(" \"type\": \"Feature\",\n"); - sb.append(" \"properties\": {\n"); - sb.append(" \"creator\": \"BRouter-" + version + "\",\n"); - sb.append(" \"name\": \"").append(name).append("\",\n"); - sb.append(" \"track-length\": \"").append(distance).append("\",\n"); - sb.append(" \"filtered ascend\": \"").append(ascend).append("\",\n"); - sb.append(" \"plain-ascend\": \"").append(plainAscend).append("\",\n"); - sb.append(" \"total-time\": \"").append(getTotalSeconds()).append("\",\n"); - sb.append(" \"total-energy\": \"").append(energy).append("\",\n"); - sb.append(" \"cost\": \"").append(cost).append("\",\n"); - if (voiceHints != null && !voiceHints.list.isEmpty()) { - sb.append(" \"voicehints\": [\n"); - for (VoiceHint hint : voiceHints.list) { - sb.append(" ["); - sb.append(hint.indexInTrack); - sb.append(',').append(hint.getJsonCommandIndex()); - sb.append(',').append(hint.getExitNumber()); - sb.append(',').append(hint.distanceToNext); - sb.append(',').append((int) hint.angle); - - // not always include geometry because longer and only needed for comment style - if (turnInstructionMode == 4) { // comment style - sb.append(",\"").append(hint.formatGeometry()).append("\""); - } - - sb.append("],\n"); - } - sb.deleteCharAt(sb.lastIndexOf(",")); - sb.append(" ],\n"); - } - if (showSpeedProfile) { // set in profile - List sp = aggregateSpeedProfile(); - if (sp.size() > 0) { - sb.append(" \"speedprofile\": [\n"); - for (int i = sp.size() - 1; i >= 0; i--) { - sb.append(" [").append(sp.get(i)).append(i > 0 ? "],\n" : "]\n"); - } - sb.append(" ],\n"); - } - } - // ... traditional message list - { - sb.append(" \"messages\": [\n"); - sb.append(" [\"").append(MESSAGES_HEADER.replaceAll("\t", "\", \"")).append("\"],\n"); - for (String m : aggregateMessages()) { - sb.append(" [\"").append(m.replaceAll("\t", "\", \"")).append("\"],\n"); - } - sb.deleteCharAt(sb.lastIndexOf(",")); - sb.append(" ],\n"); - } - - if (getTotalSeconds() > 0) { - sb.append(" \"times\": ["); - DecimalFormat decimalFormat = (DecimalFormat) NumberFormat.getInstance(Locale.ENGLISH); - decimalFormat.applyPattern("0.###"); - for (OsmPathElement n : nodes) { - sb.append(decimalFormat.format(n.getTime())).append(","); - } - sb.deleteCharAt(sb.lastIndexOf(",")); - sb.append("]\n"); - } else { - sb.deleteCharAt(sb.lastIndexOf(",")); - } - - sb.append(" },\n"); - - if (iternity != null) { - sb.append(" \"iternity\": [\n"); - for (String s : iternity) { - sb.append(" \"").append(s).append("\",\n"); - } - sb.deleteCharAt(sb.lastIndexOf(",")); - sb.append(" ],\n"); - } - sb.append(" \"geometry\": {\n"); - sb.append(" \"type\": \"LineString\",\n"); - sb.append(" \"coordinates\": [\n"); - - OsmPathElement nn = null; - for (OsmPathElement n : nodes) { - String sele = n.getSElev() == Short.MIN_VALUE ? "" : ", " + n.getElev(); - if (showspeed) { // hack: show speed instead of elevation - double speed = 0; - if (nn != null) { - int dist = n.calcDistance(nn); - float dt = n.getTime() - nn.getTime(); - if (dt != 0.f) { - speed = ((3.6f * dist) / dt + 0.5); - } - } - sele = ", " + (((int) (speed * 10)) / 10.f); - } - sb.append(" [").append(formatILon(n.getILon())).append(", ").append(formatILat(n.getILat())) - .append(sele).append("],\n"); - nn = n; - } - sb.deleteCharAt(sb.lastIndexOf(",")); - - sb.append(" ]\n"); - sb.append(" }\n"); - if (exportWaypoints || !pois.isEmpty()) { - sb.append(" },\n"); - for (int i = 0; i <= pois.size() - 1; i++) { - OsmNodeNamed poi = pois.get(i); - addFeature(sb, "poi", poi.name, poi.ilat, poi.ilon); - if (i < matchedWaypoints.size() - 1) { - sb.append(","); - } - sb.append(" \n"); - } - if (exportWaypoints) { - for (int i = 0; i <= matchedWaypoints.size() - 1; i++) { - String type; - if (i == 0) { - type = "from"; - } else if (i == matchedWaypoints.size() - 1) { - type = "to"; - } else { - type = "via"; - } - - MatchedWaypoint wp = matchedWaypoints.get(i); - addFeature(sb, type, wp.name, wp.waypoint.ilat, wp.waypoint.ilon); - if (i < matchedWaypoints.size() - 1) { - sb.append(","); - } - sb.append(" \n"); - } - } - } else { - sb.append(" }\n"); - } - sb.append(" ]\n"); - sb.append("}\n"); - - return sb.toString(); - } - - private void addFeature(StringBuilder sb, String type, String name, int ilat, int ilon) { - sb.append(" {\n"); - sb.append(" \"type\": \"Feature\",\n"); - sb.append(" \"properties\": {\n"); - sb.append(" \"name\": \"" + StringUtils.escapeJson(name) + "\",\n"); - sb.append(" \"type\": \"" + type + "\"\n"); - sb.append(" },\n"); - sb.append(" \"geometry\": {\n"); - sb.append(" \"type\": \"Point\",\n"); - sb.append(" \"coordinates\": [\n"); - sb.append(" " + formatILon(ilon) + ",\n"); - sb.append(" " + formatILat(ilat) + "\n"); - sb.append(" ]\n"); - sb.append(" }\n"); - sb.append(" }"); - } - public VoiceHint getVoiceHint(int i) { if (voiceHints == null) return null; for (VoiceHint hint : voiceHints.list) { @@ -1173,123 +417,6 @@ public final class OsmTrack { return (int) (s + 0.5); } - public String getFormattedTime() { - return format1(getTotalSeconds() / 60.) + "m"; - } - - public String getFormattedTime2() { - int seconds = (int) (getTotalSeconds() + 0.5); - int hours = seconds / 3600; - int minutes = (seconds - hours * 3600) / 60; - seconds = seconds - hours * 3600 - minutes * 60; - String time = ""; - if (hours != 0) - time = "" + hours + "h "; - if (minutes != 0) - time = time + minutes + "m "; - if (seconds != 0) - time = time + seconds + "s"; - return time; - } - - SimpleDateFormat TIMESTAMP_FORMAT; - - public String getFormattedTime3(float time) { - if (TIMESTAMP_FORMAT == null) { - TIMESTAMP_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US); - TIMESTAMP_FORMAT.setTimeZone(TimeZone.getTimeZone("UTC")); - } - // yyyy-mm-ddThh:mm:ss.SSSZ - Date d = new Date((long) (time * 1000f)); - return TIMESTAMP_FORMAT.format(d); - } - - public String getFormattedEnergy() { - return format1(energy / 3600000.) + "kwh"; - } - - private static String formatILon(int ilon) { - return formatPos(ilon - 180000000); - } - - private static String formatILat(int ilat) { - return formatPos(ilat - 90000000); - } - - private static String formatPos(int p) { - boolean negative = p < 0; - if (negative) - p = -p; - char[] ac = new char[12]; - int i = 11; - while (p != 0 || i > 3) { - ac[i--] = (char) ('0' + (p % 10)); - p /= 10; - if (i == 5) - ac[i--] = '.'; - } - if (negative) - ac[i--] = '-'; - return new String(ac, i + 1, 11 - i); - } - - private String format1(double n) { - String s = "" + (long) (n * 10 + 0.5); - int len = s.length(); - return s.substring(0, len - 1) + "." + s.charAt(len - 1); - } - - public void dumpMessages(String filename, RoutingContext rc) throws Exception { - BufferedWriter bw = filename == null ? null : new BufferedWriter(new FileWriter(filename)); - writeMessages(bw, rc); - } - - public void writeMessages(BufferedWriter bw, RoutingContext rc) throws Exception { - dumpLine(bw, MESSAGES_HEADER); - for (String m : aggregateMessages()) { - dumpLine(bw, m); - } - if (bw != null) - bw.close(); - } - - private void dumpLine(BufferedWriter bw, String s) throws Exception { - if (bw == null) { - System.out.println(s); - } else { - bw.write(s); - bw.write("\n"); - } - } - - public void readGpx(String filename) throws Exception { - File f = new File(filename); - if (!f.exists()) - return; - BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(f))); - - for (; ; ) { - String line = br.readLine(); - if (line == null) - break; - - int idx0 = line.indexOf("= 0) { - idx0 += 12; - int idx1 = line.indexOf('"', idx0); - int ilon = (int) ((Double.parseDouble(line.substring(idx0, idx1)) + 180.) * 1000000. + 0.5); - int idx2 = line.indexOf(" lat=\""); - if (idx2 < 0) - continue; - idx2 += 6; - int idx3 = line.indexOf('"', idx2); - int ilat = (int) ((Double.parseDouble(line.substring(idx2, idx3)) + 90.) * 1000000. + 0.5); - nodes.add(OsmPathElement.create(ilon, ilat, (short) 0, null, false)); - } - } - br.close(); - } - public boolean equalsTrack(OsmTrack t) { if (nodes.size() != t.nodes.size()) return false; From c52bd86dd5ad9b4f695a5a03982ec6af8837f70e Mon Sep 17 00:00:00 2001 From: Emux Date: Mon, 20 Nov 2023 15:22:20 +0200 Subject: [PATCH 09/30] Translations: Arabic, Catalan, Dutch, French, German, Greek, Italian, Polish, Spanish --- brouter-routing-app/build.gradle | 2 -- .../btools/routingapp/BInstallerActivity.java | 2 +- .../src/main/res/values-ar/strings.xml | 16 +++++++++ .../src/main/res/values-ca/strings.xml | 16 +++++++++ .../src/main/res/values-de/strings.xml | 16 +++++++++ .../src/main/res/values-el/strings.xml | 16 +++++++++ .../src/main/res/values-es/strings.xml | 16 +++++++++ .../src/main/res/values-fr/strings.xml | 16 +++++++++ .../src/main/res/values-it/strings.xml | 16 +++++++++ .../src/main/res/values-nl/strings.xml | 16 +++++++++ .../src/main/res/values-pl/strings.xml | 16 +++++++++ .../res/values/donottranslate-strings.xml | 7 ++++ .../src/main/res/values/strings.xml | 35 ++++--------------- 13 files changed, 159 insertions(+), 31 deletions(-) create mode 100644 brouter-routing-app/src/main/res/values-ar/strings.xml create mode 100644 brouter-routing-app/src/main/res/values-ca/strings.xml create mode 100644 brouter-routing-app/src/main/res/values-de/strings.xml create mode 100644 brouter-routing-app/src/main/res/values-el/strings.xml create mode 100644 brouter-routing-app/src/main/res/values-es/strings.xml create mode 100644 brouter-routing-app/src/main/res/values-fr/strings.xml create mode 100644 brouter-routing-app/src/main/res/values-it/strings.xml create mode 100644 brouter-routing-app/src/main/res/values-nl/strings.xml create mode 100644 brouter-routing-app/src/main/res/values-pl/strings.xml create mode 100644 brouter-routing-app/src/main/res/values/donottranslate-strings.xml diff --git a/brouter-routing-app/build.gradle b/brouter-routing-app/build.gradle index 9cd72f4..2300600 100644 --- a/brouter-routing-app/build.gradle +++ b/brouter-routing-app/build.gradle @@ -20,8 +20,6 @@ android { minSdkVersion 14 targetSdkVersion 33 - resConfigs "en" - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/brouter-routing-app/src/main/java/btools/routingapp/BInstallerActivity.java b/brouter-routing-app/src/main/java/btools/routingapp/BInstallerActivity.java index c49a6be..f9ffe61 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/BInstallerActivity.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/BInstallerActivity.java @@ -171,7 +171,7 @@ public class BInstallerActivity extends AppCompatActivity { } mButtonDownload.setText(getString(R.string.action_download, getSegmentsPlural(selectedTilesDownload.size()))); mButtonDownload.setEnabled(true); - mSummaryInfo.setText(getString(R.string.summary_segments, Formatter.formatFileSize(this, tileSize), Formatter.formatFileSize(this, getAvailableSpace(mBaseDir.getAbsolutePath())))); + mSummaryInfo.setText(String.format(getString(R.string.summary_segments), Formatter.formatFileSize(this, tileSize), Formatter.formatFileSize(this, getAvailableSpace(mBaseDir.getAbsolutePath())))); } else if (selectedTilesUpdate.size() > 0) { mButtonDownload.setText(getString(R.string.action_update, getSegmentsPlural(selectedTilesUpdate.size()))); mButtonDownload.setEnabled(true); diff --git a/brouter-routing-app/src/main/res/values-ar/strings.xml b/brouter-routing-app/src/main/res/values-ar/strings.xml new file mode 100644 index 0000000..43e2663 --- /dev/null +++ b/brouter-routing-app/src/main/res/values-ar/strings.xml @@ -0,0 +1,16 @@ + + + + %d قطعة + %d قطع + + إلغاء التنزيل + استيراد ملف تعريف + تنزيل %s + حذف %s + تحديث %s + حدد القطع + إيقاف التنزيل + الحجم=%1$s\nالحجم المتوفر=%2$s + تحميل القطع + diff --git a/brouter-routing-app/src/main/res/values-ca/strings.xml b/brouter-routing-app/src/main/res/values-ca/strings.xml new file mode 100644 index 0000000..13aeaea --- /dev/null +++ b/brouter-routing-app/src/main/res/values-ca/strings.xml @@ -0,0 +1,16 @@ + + + + %d segment + %d segments + + Cancel·lar descàrrega + Importar perfil + Descàrrega %s + Eliminar %s + Actualitzar %s + Seleccionar segments + Aturar Descàrrega + Espai=%1$s\nLliure=%2$s + Descarregar segments + diff --git a/brouter-routing-app/src/main/res/values-de/strings.xml b/brouter-routing-app/src/main/res/values-de/strings.xml new file mode 100644 index 0000000..85002f5 --- /dev/null +++ b/brouter-routing-app/src/main/res/values-de/strings.xml @@ -0,0 +1,16 @@ + + + + %d Segment + %d Segmente + + Download abbrechen + Profil importieren + %s downloaden + %s löschen + %s aktualisieren + Segmente auswählen + Download stoppen + Größe=%1$s\nFrei=%2$s + Segmente herunterladen + diff --git a/brouter-routing-app/src/main/res/values-el/strings.xml b/brouter-routing-app/src/main/res/values-el/strings.xml new file mode 100644 index 0000000..0ef6b6c --- /dev/null +++ b/brouter-routing-app/src/main/res/values-el/strings.xml @@ -0,0 +1,16 @@ + + + + %d τμήμα + %d τμήματα + + Ακύρωση λήψης + Εισαγωγή προφίλ + Λήψη %s + Διαγραφή %s + Ενημέρωση %s + Επιλογή τμημάτων + Διακοπή λήψης + Μέγεθος=%1$s\nΕλεύθερο=%2$s + Λήψη τμημάτων + diff --git a/brouter-routing-app/src/main/res/values-es/strings.xml b/brouter-routing-app/src/main/res/values-es/strings.xml new file mode 100644 index 0000000..3929ff0 --- /dev/null +++ b/brouter-routing-app/src/main/res/values-es/strings.xml @@ -0,0 +1,16 @@ + + + + %d segmento + %d segmentos + + Cancelar descarga + Importar perfil + Descargar %s + Eliminar %s + Actualizar %s + Seleccionar segmentos + Detener descarga + Tamaño=%1$s\nGratis=%2$s + Descargar segmentos + diff --git a/brouter-routing-app/src/main/res/values-fr/strings.xml b/brouter-routing-app/src/main/res/values-fr/strings.xml new file mode 100644 index 0000000..b390687 --- /dev/null +++ b/brouter-routing-app/src/main/res/values-fr/strings.xml @@ -0,0 +1,16 @@ + + + + %d segment + %d segments + + Annuler le téléchargement + Importer le profil + Télécharger %s + Supprimer %s + Mettre à jour %s + Sélectionner les segments + Arrêter le téléchargement + Taille=%1$s\nGratuit=%2$s + Télécharger les segments + diff --git a/brouter-routing-app/src/main/res/values-it/strings.xml b/brouter-routing-app/src/main/res/values-it/strings.xml new file mode 100644 index 0000000..10f29fe --- /dev/null +++ b/brouter-routing-app/src/main/res/values-it/strings.xml @@ -0,0 +1,16 @@ + + + + %d segmento + %d segmenti + + Annulla download + Importa profilo + Scarica %s + Elimina %s + Aggiorna %s + Seleziona segmenti + Interrompi download + Taglia=%1$s\nGratis=%2$s + Scarica segmenti + diff --git a/brouter-routing-app/src/main/res/values-nl/strings.xml b/brouter-routing-app/src/main/res/values-nl/strings.xml new file mode 100644 index 0000000..300d668 --- /dev/null +++ b/brouter-routing-app/src/main/res/values-nl/strings.xml @@ -0,0 +1,16 @@ + + + + %d segment + %d segmenten + + Download annuleren + Profiel importeren + Downloaden %s + Verwijderen %s + Bijwerken %s + Segmenten selecteren + Download stoppen + Grootte=%1$s\nGratis=%2$s + Segmenten downloaden + diff --git a/brouter-routing-app/src/main/res/values-pl/strings.xml b/brouter-routing-app/src/main/res/values-pl/strings.xml new file mode 100644 index 0000000..2de0f3c --- /dev/null +++ b/brouter-routing-app/src/main/res/values-pl/strings.xml @@ -0,0 +1,16 @@ + + + + %d segment + %d segmenty/ów + + Anuluj pobieranie + Importuj profil + Pobierz %s + Usuń %s + Zaktualizuj %s + Wybierz segmenty + Zatrzymaj pobieranie + Rozmiar=%1$s\nDostępne=%2$s + Pobieranie segmentów + diff --git a/brouter-routing-app/src/main/res/values/donottranslate-strings.xml b/brouter-routing-app/src/main/res/values/donottranslate-strings.xml new file mode 100644 index 0000000..254dd8f --- /dev/null +++ b/brouter-routing-app/src/main/res/values/donottranslate-strings.xml @@ -0,0 +1,7 @@ + + + BRouter + filename.brf + brouter_download + Downloads + diff --git a/brouter-routing-app/src/main/res/values/strings.xml b/brouter-routing-app/src/main/res/values/strings.xml index 168a26a..3ddedd0 100644 --- a/brouter-routing-app/src/main/res/values/strings.xml +++ b/brouter-routing-app/src/main/res/values/strings.xml @@ -1,37 +1,16 @@ - - - - + + %d segment %d segments - BRouter - Cancel Download - Import Profile - filename.brf - Starting download… - Cancelling… + Cancel download + Import profile Download %s Delete %s Update %s Select segments - Stop Download - Size=%s\nFree=%s - brouter_download - Download Segments - Downloads + Stop download + Size=%1$s\nFree=%2$s + Download segments From a3d561e1446545aa93341158f0a913e75529f783 Mon Sep 17 00:00:00 2001 From: Emux Date: Sat, 9 Dec 2023 14:00:50 +0200 Subject: [PATCH 10/30] Android targetSdk 34 --- brouter-routing-app/src/main/AndroidManifest.xml | 5 +++++ .../src/main/java/btools/routingapp/DownloadWorker.java | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/brouter-routing-app/src/main/AndroidManifest.xml b/brouter-routing-app/src/main/AndroidManifest.xml index e210ef7..831deea 100644 --- a/brouter-routing-app/src/main/AndroidManifest.xml +++ b/brouter-routing-app/src/main/AndroidManifest.xml @@ -10,6 +10,7 @@ + + = Build.VERSION_CODES.Q) + setForegroundAsync(new ForegroundInfo(NOTIFICATION_ID, notificationBuilder.build(), ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC)); + else + setForegroundAsync(new ForegroundInfo(NOTIFICATION_ID, notificationBuilder.build())); try { if (DEBUG) Log.d(LOG_TAG, "Download lookup & profiles"); if (!downloadLookup()) { From 03bbbcfc0c063c121195121d220be1cf5f98d8b8 Mon Sep 17 00:00:00 2001 From: afischerdev Date: Sat, 9 Dec 2023 15:28:17 +0100 Subject: [PATCH 11/30] enabled compressed json output for app --- .../src/main/java/btools/routingapp/BRouterService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/brouter-routing-app/src/main/java/btools/routingapp/BRouterService.java b/brouter-routing-app/src/main/java/btools/routingapp/BRouterService.java index 8d6ea4e..90b875c 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/BRouterService.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/BRouterService.java @@ -100,7 +100,7 @@ public class BRouterService extends Service { boolean canCompress = "true".equals(params.getString("acceptCompressedResult")); try { String gpxMessage = worker.getTrackFromParams(params); - if (canCompress && gpxMessage.startsWith("<")) { + if (canCompress) { try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); baos.write("z64".getBytes(Charset.forName("UTF-8"))); // marker prefix From 2669ae95582043adddb5e8b79eaf75768f295e49 Mon Sep 17 00:00:00 2001 From: afischerdev Date: Sun, 10 Dec 2023 12:16:03 +0100 Subject: [PATCH 12/30] added new resources from hardcoded string --- .../btools/routingapp/BRouterActivity.java | 82 +++++++++---------- .../src/main/res/values/strings.xml | 41 ++++++++++ 2 files changed, 79 insertions(+), 44 deletions(-) diff --git a/brouter-routing-app/src/main/java/btools/routingapp/BRouterActivity.java b/brouter-routing-app/src/main/java/btools/routingapp/BRouterActivity.java index 1dca201..f633b47 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/BRouterActivity.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/BRouterActivity.java @@ -58,7 +58,7 @@ public class BRouterActivity extends AppCompatActivity implements ActivityCompat private static final int DIALOG_PICKWAYPOINT_ID = 10; private static final int DIALOG_SELECTBASEDIR_ID = 11; private static final int DIALOG_MAINACTION_ID = 12; - private static final int DIALOG_OLDDATAHINT_ID = 13; + //private static final int DIALOG_OLDDATAHINT_ID = 13; private static final int DIALOG_SHOW_REPEAT_TIMEOUT_HELP_ID = 16; private final Set dialogIds = new HashSet<>(); private BRouterView mBRouterView; @@ -133,7 +133,7 @@ public class BRouterActivity extends AppCompatActivity implements ActivityCompat switch (id) { case DIALOG_SELECTPROFILE_ID: - builder.setTitle("Select a routing profile"); + builder.setTitle(R.string.action_select_profile); builder.setItems(availableProfiles, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { selectedProfile = availableProfiles[item]; @@ -142,9 +142,9 @@ public class BRouterActivity extends AppCompatActivity implements ActivityCompat }); return builder.create(); case DIALOG_MAINACTION_ID: - builder.setTitle("Select Main Action"); + builder.setTitle(R.string.main_action); builder.setItems( - new String[]{"Download Manager", "BRouter App"}, + new String[]{getString(R.string.main_action_1), getString(R.string.main_action_2)}, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { if (item == 0) @@ -153,7 +153,7 @@ public class BRouterActivity extends AppCompatActivity implements ActivityCompat showADialog(DIALOG_SELECTPROFILE_ID); } }) - .setNegativeButton("Close", new DialogInterface.OnClickListener() { + .setNegativeButton(getString(R.string.close), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { finish(); } @@ -161,19 +161,15 @@ public class BRouterActivity extends AppCompatActivity implements ActivityCompat return builder.create(); case DIALOG_SHOW_DM_INFO_ID: builder - .setTitle("BRouter Download Manager") - .setMessage( - "*** Attention: ***\n\n" + "The Download Manager is used to download routing-data " - + "files which can be up to 170MB each. Do not start the Download Manager " - + "on a cellular data connection without a data plan! " - + "Download speed is restricted to 16 MBit/s.") - .setPositiveButton("I know", new DialogInterface.OnClickListener() { + .setTitle(R.string.title_download) + .setMessage(R.string.summary_download) + .setPositiveButton(R.string.i_know, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Intent intent = new Intent(BRouterActivity.this, BInstallerActivity.class); startActivity(intent); showNewDialog(DIALOG_MAINACTION_ID); } - }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { finish(); } @@ -181,18 +177,15 @@ public class BRouterActivity extends AppCompatActivity implements ActivityCompat return builder.create(); case DIALOG_SHOW_REPEAT_TIMEOUT_HELP_ID: builder - .setTitle("Successfully prepared a timeout-free calculation") - .setMessage( - "You successfully repeated a calculation that previously run into a timeout " - + "when started from your map-tool. If you repeat the same request from your " - + "maptool, with the exact same destination point and a close-by starting point, " - + "this request is guaranteed not to time out.") - .setNegativeButton("Exit", new DialogInterface.OnClickListener() { + .setTitle(R.string.title_timeoutfree) + .setMessage(R.string.summary_timeoutfree) + .setNegativeButton(R.string.exit, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { finish(); } }); return builder.create(); + /* case DIALOG_OLDDATAHINT_ID: builder .setTitle("Local setup needs reset") @@ -202,12 +195,13 @@ public class BRouterActivity extends AppCompatActivity implements ActivityCompat + "Before downloading new datafiles made for the new table, " + "you have to reset your local setup by 'moving away' (or deleting) " + "your /brouter directory and start a new setup by calling the " + "BRouter App again.") - .setPositiveButton("OK", new DialogInterface.OnClickListener() { + .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { finish(); } }); return builder.create(); + */ case DIALOG_ROUTINGMODES_ID: builder.setTitle(message); builder.setMultiChoiceItems(routingModes, routingModesChecked, @@ -217,7 +211,7 @@ public class BRouterActivity extends AppCompatActivity implements ActivityCompat routingModesChecked[which] = isChecked; } }); - builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() { + builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { mBRouterView.configureService(routingModes, routingModesChecked); } @@ -225,9 +219,9 @@ public class BRouterActivity extends AppCompatActivity implements ActivityCompat return builder.create(); case DIALOG_EXCEPTION_ID: builder - .setTitle("An Error occured") + .setTitle(R.string.error) .setMessage(errorMessage) - .setPositiveButton("OK", + .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { mBRouterView.continueProcessing(); @@ -235,12 +229,12 @@ public class BRouterActivity extends AppCompatActivity implements ActivityCompat }); return builder.create(); case DIALOG_TEXTENTRY_ID: - builder.setTitle("Enter SDCARD base dir:"); + builder.setTitle(R.string.title_sdcard); builder.setMessage(message); final EditText input = new EditText(this); // input.setText(defaultbasedir); builder.setView(input); - builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() { + builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { String basedir = input.getText().toString(); mBRouterView.startSetup(new File(basedir), true, false); @@ -248,7 +242,7 @@ public class BRouterActivity extends AppCompatActivity implements ActivityCompat }); return builder.create(); case DIALOG_SELECTBASEDIR_ID: - builder.setTitle("Choose brouter data base dir:"); + builder.setTitle(getString(R.string.action_choose_folder)); // builder.setMessage( message ); builder.setSingleChoiceItems(basedirOptions, 0, new DialogInterface.OnClickListener() { @Override @@ -256,7 +250,7 @@ public class BRouterActivity extends AppCompatActivity implements ActivityCompat selectedBasedir = item; } }); - builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() { + builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { if (selectedBasedir < availableBasedirs.size()) { mBRouterView.startSetup(availableBasedirs.get(selectedBasedir), true, false); @@ -267,7 +261,7 @@ public class BRouterActivity extends AppCompatActivity implements ActivityCompat }); return builder.create(); case DIALOG_VIASELECT_ID: - builder.setTitle("Check VIA Selection:"); + builder.setTitle(R.string.action_via_select); builder.setMultiChoiceItems(availableVias, getCheckedBooleanArray(availableVias.length), new DialogInterface.OnMultiChoiceClickListener() { @Override @@ -279,7 +273,7 @@ public class BRouterActivity extends AppCompatActivity implements ActivityCompat } } }); - builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() { + builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { mBRouterView.updateViaList(selectedVias); mBRouterView.startProcessing(selectedProfile); @@ -287,7 +281,7 @@ public class BRouterActivity extends AppCompatActivity implements ActivityCompat }); return builder.create(); case DIALOG_NOGOSELECT_ID: - builder.setTitle("Check NoGo Selection:"); + builder.setTitle(R.string.action_nogo_select); String[] nogoNames = new String[nogoList.size()]; for (int i = 0; i < nogoList.size(); i++) nogoNames[i] = nogoList.get(i).name; @@ -299,7 +293,7 @@ public class BRouterActivity extends AppCompatActivity implements ActivityCompat nogoEnabled[which] = isChecked; } }); - builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() { + builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { mBRouterView.updateNogoList(nogoEnabled); mBRouterView.startProcessing(selectedProfile); @@ -325,21 +319,21 @@ public class BRouterActivity extends AppCompatActivity implements ActivityCompat List slist = new ArrayList<>(); // Neutral button if (wpCount == 0) { - slist.add("Server-Mode"); + slist.add(getString(R.string.action_servermode)); } else if (wpCount == -3) { - slist.add("Info"); + slist.add(getString(R.string.action_info)); } else if (wpCount >= 2) { - slist.add("Calc Route"); + slist.add(getString(R.string.action_calc_route)); } if (wpCount == 0) { - slist.add("Profile Settings"); + slist.add(getString(R.string.action_profile_settings)); } // Positive button if (wpCount == -3 || wpCount == -1) { - slist.add("Share GPX"); + slist.add(getString(R.string.action_share)); } else if (wpCount >= 0) { - String selectLabel = wpCount == 0 ? "Select from" : "Select to/via"; + String selectLabel = wpCount == 0 ? getString(R.string.action_select_from) : getString(R.string.action_select_to); slist.add(selectLabel); } @@ -407,16 +401,16 @@ public class BRouterActivity extends AppCompatActivity implements ActivityCompat */ // Negative button - builder.setNegativeButton("Exit", (dialog, which) -> { + builder.setNegativeButton(R.string.exit, (dialog, which) -> { finish(); }); return builder.create(); case DIALOG_MODECONFIGOVERVIEW_ID: builder - .setTitle("Success") + .setTitle(R.string.success) .setMessage(message) - .setPositiveButton("Exit", + .setPositiveButton(R.string.exit, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { finish(); @@ -424,7 +418,7 @@ public class BRouterActivity extends AppCompatActivity implements ActivityCompat }); return builder.create(); case DIALOG_PICKWAYPOINT_ID: - builder.setTitle(wpCount > 0 ? "Select to/via" : "Select from"); + builder.setTitle(wpCount == 0 ? getString(R.string.action_select_from) : getString(R.string.action_select_to)); builder.setItems(availableWaypoints, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { mBRouterView.updateWaypointList(availableWaypoints[item]); @@ -472,11 +466,11 @@ public class BRouterActivity extends AppCompatActivity implements ActivityCompat //startActivityForResult(i, 100); someActivityResultLauncher.launch(i); } else { - Toast.makeText(this, "no profile data", Toast.LENGTH_LONG).show(); + Toast.makeText(this, R.string.msg_no_profile, Toast.LENGTH_LONG).show(); finish(); } } else { - Toast.makeText(this, selectedProfile + ", no used profile", Toast.LENGTH_LONG).show(); + Toast.makeText(this, selectedProfile + getString(R.string.msg_no_used_profile), Toast.LENGTH_LONG).show(); finish(); } } diff --git a/brouter-routing-app/src/main/res/values/strings.xml b/brouter-routing-app/src/main/res/values/strings.xml index 3ddedd0..91ed26c 100644 --- a/brouter-routing-app/src/main/res/values/strings.xml +++ b/brouter-routing-app/src/main/res/values/strings.xml @@ -13,4 +13,45 @@ Stop download Size=%1$s\nFree=%2$s Download segments + + Choose brouter data base dir: + Select a routing profile + Select Main Action + Download Manager + BRouter App + + Cancel + I know + Close + Exit + OK + Success + An Error occurred + + BRouter Download Manager + *** Attention:*** + \n\nThe Download Manager is used to download routing-data + files which can be up to 170MB each. Do not start the Download Manager + on a cellular data connection without a data plan! + Download speed is restricted to 16 MBit/s. + Successfully prepared a timeout-free calculation + You successfully repeated a calculation that previously run into a timeout + when started from your map-tool. If you repeat the same request from your + maptool, with the exact same destination point and a close-by starting point, + this request is guaranteed not to time out. + Enter SDCARD base dir: + + Check VIA Selection: + Check NoGo Selection: + Server-Mode + Info + Calc Route + Profile Settings + Share GPX + Select from + Select to/via + + no profile data + , no used profile + From b9cd75b7a04db7c77a9335cbad48b44bd8713109 Mon Sep 17 00:00:00 2001 From: afischerdev Date: Sun, 10 Dec 2023 12:26:20 +0100 Subject: [PATCH 13/30] more new resources from hardcoded string --- .../src/main/java/btools/routingapp/BInstallerActivity.java | 5 +++-- brouter-routing-app/src/main/res/values/strings.xml | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/brouter-routing-app/src/main/java/btools/routingapp/BInstallerActivity.java b/brouter-routing-app/src/main/java/btools/routingapp/BInstallerActivity.java index f9ffe61..693882a 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/BInstallerActivity.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/BInstallerActivity.java @@ -214,7 +214,8 @@ public class BInstallerActivity extends AppCompatActivity { .build(); } catch (IllegalStateException e) { - Toast.makeText(this, "Too much data for download. Please reduce.", Toast.LENGTH_LONG).show(); + Object data; + Toast.makeText(this, R.string.msg_too_much_data, Toast.LENGTH_LONG).show(); e.printStackTrace(); return; @@ -264,7 +265,7 @@ public class BInstallerActivity extends AppCompatActivity { } if (workInfo.getState() == WorkInfo.State.ENQUEUED) { - Toast.makeText(this, "Download scheduled. Check internet connection if it doesn't start.", Toast.LENGTH_LONG).show(); + Toast.makeText(this, R.string.msg_download_start, Toast.LENGTH_LONG).show(); mProgressIndicator.hide(); mProgressIndicator.setIndeterminate(true); mProgressIndicator.show(); diff --git a/brouter-routing-app/src/main/res/values/strings.xml b/brouter-routing-app/src/main/res/values/strings.xml index 91ed26c..903d95c 100644 --- a/brouter-routing-app/src/main/res/values/strings.xml +++ b/brouter-routing-app/src/main/res/values/strings.xml @@ -53,5 +53,7 @@ no profile data , no used profile + Too much data for download. Please reduce. + Download scheduled. Check internet connection if it doesn\'t start. From 3acbd96575d7ef3200f6674142977da60bcd5a32 Mon Sep 17 00:00:00 2001 From: afischerdev Date: Sun, 10 Dec 2023 13:19:54 +0100 Subject: [PATCH 14/30] more new resources from hardcoded messages --- .../java/btools/routingapp/BRouterView.java | 25 +++++++++++-------- .../src/main/res/values/strings.xml | 13 ++++++++++ 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/brouter-routing-app/src/main/java/btools/routingapp/BRouterView.java b/brouter-routing-app/src/main/java/btools/routingapp/BRouterView.java index ff50885..5c7be2b 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/BRouterView.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/BRouterView.java @@ -380,14 +380,14 @@ public class BRouterView extends View { try { cor.readAllPoints(); } catch (Exception e) { - msg = "Error reading waypoints: " + e; + msg = getContext().getString(R.string.msg_read_wpt_error)+ ": " + e; } int size = cor.allpoints.size(); if (size < 1) - msg = "coordinate source does not contain any waypoints!"; + msg = getContext().getString(R.string.msg_no_wpt); if (size > 1000) - msg = "coordinate source contains too much waypoints: " + size + "(please use from/to/via names)"; + msg = getContext().getString(R.string.msg_to_much_wpts, size); } if (msg != null) { @@ -471,13 +471,13 @@ public class BRouterView extends View { if (needsWaypointSelection) { StringBuilder msg; if (wpList.size() == 0) { - msg = new StringBuilder("Expecting waypoint selection\n" + "(coordinate-source: " + cor.basedir + cor.rootdir + ")"); + msg = new StringBuilder(getContext().getString(R.string.msg_no_wpt_selection) + "(coordinate-source: " + cor.basedir + cor.rootdir + ")"); } else { - msg = new StringBuilder("current waypoint selection:\n"); + msg = new StringBuilder(getContext().getString(R.string.msg_wpt_selection)); for (int i = 0; i < wpList.size(); i++) msg.append(i > 0 ? "->" : "").append(wpList.get(i).name); } - ((BRouterActivity) getContext()).showResultMessage("Select Action", msg.toString(), wpList.size()); + ((BRouterActivity) getContext()).showResultMessage(getContext().getString(R.string.title_action), msg.toString(), wpList.size()); return; } @@ -718,8 +718,13 @@ public class BRouterView extends View { ((BRouterActivity) getContext()).showErrorMessage(cr.getErrorMessage()); } else { String memstat = memoryClass + "mb pathPeak " + ((cr.getPathPeak() + 500) / 1000) + "k"; - String result = "version = BRouter-" + getContext().getString(R.string.app_version) + "\n" + "mem = " + memstat + "\ndistance = " + cr.getDistance() / 1000. + " km\n" + "filtered ascend = " + cr.getAscend() - + " m\n" + "plain ascend = " + cr.getPlainAscend() + " m\n" + "estimated time = " + cr.getTime(); + String result = getContext().getString(R.string.msg_status_result, + getContext().getString(R.string.app_version), + memstat, + Double.toString(cr.getDistance() / 1000.), + Integer.toString(cr.getAscend()), + Integer.toString(cr.getPlainAscend()), + cr.getTime()); rawTrack = cr.getFoundRawTrack(); @@ -728,9 +733,9 @@ public class BRouterView extends View { writeRawTrackToPath(rawTrackPath); } - String title = "Success"; + String title = getContext().getString(R.string.success); if (cr.getAlternativeIndex() > 0) - title += " / " + cr.getAlternativeIndex() + ". Alternative"; + title += " / " + cr.getAlternativeIndex() + ". " + getContext().getString(R.string.msg_alternative); ((BRouterActivity) getContext()).showResultMessage(title, result, rawTrackPath == null ? -1 : -3); trackOutfile = cr.getOutfile(); diff --git a/brouter-routing-app/src/main/res/values/strings.xml b/brouter-routing-app/src/main/res/values/strings.xml index 903d95c..2c1b384 100644 --- a/brouter-routing-app/src/main/res/values/strings.xml +++ b/brouter-routing-app/src/main/res/values/strings.xml @@ -40,6 +40,7 @@ maptool, with the exact same destination point and a close-by starting point, this request is guaranteed not to time out. Enter SDCARD base dir: + Select Action Check VIA Selection: Check NoGo Selection: @@ -55,5 +56,17 @@ , no used profile Too much data for download. Please reduce. Download scheduled. Check internet connection if it doesn\'t start. + current waypoint selection:\n + Expecting waypoint selection\n + Alternative + version = BRouter-%1$s \n + mem = %2$s \n + distance = %3$s km\n + filtered ascend = %4$s m\n + plain ascend = %5$s m\n + estimated time = %6$s + Error reading waypoints + coordinate source does not contain any waypoints! + "coordinate source contains too much waypoints: %1$d (please use from/to/via names) From 28ca2b7217ea886b93ad708dac8de18291ba7a13 Mon Sep 17 00:00:00 2001 From: afischerdev Date: Sun, 10 Dec 2023 13:24:31 +0100 Subject: [PATCH 15/30] move new resources to all xml --- .../src/main/res/values-ar/strings.xml | 56 +++++++++++++++++++ .../src/main/res/values-ca/strings.xml | 56 +++++++++++++++++++ .../src/main/res/values-de/strings.xml | 56 +++++++++++++++++++ .../src/main/res/values-el/strings.xml | 56 +++++++++++++++++++ .../src/main/res/values-es/strings.xml | 56 +++++++++++++++++++ .../src/main/res/values-fr/strings.xml | 56 +++++++++++++++++++ .../src/main/res/values-it/strings.xml | 56 +++++++++++++++++++ .../src/main/res/values-nl/strings.xml | 56 +++++++++++++++++++ .../src/main/res/values-pl/strings.xml | 56 +++++++++++++++++++ 9 files changed, 504 insertions(+) diff --git a/brouter-routing-app/src/main/res/values-ar/strings.xml b/brouter-routing-app/src/main/res/values-ar/strings.xml index 43e2663..c08e7ec 100644 --- a/brouter-routing-app/src/main/res/values-ar/strings.xml +++ b/brouter-routing-app/src/main/res/values-ar/strings.xml @@ -13,4 +13,60 @@ إيقاف التنزيل الحجم=%1$s\nالحجم المتوفر=%2$s تحميل القطع + + Choose brouter data base dir: + Select a routing profile + Select Main Action + Download Manager + BRouter App + + Cancel + I know + Close + Exit + OK + Success + An Error occurred + + BRouter Download Manager + *** Attention:*** + \n\nThe Download Manager is used to download routing-data + files which can be up to 170MB each. Do not start the Download Manager + on a cellular data connection without a data plan! + Download speed is restricted to 16 MBit/s. + Successfully prepared a timeout-free calculation + You successfully repeated a calculation that previously run into a timeout + when started from your map-tool. If you repeat the same request from your + maptool, with the exact same destination point and a close-by starting point, + this request is guaranteed not to time out. + Enter SDCARD base dir: + Select Action + + Check VIA Selection: + Check NoGo Selection: + Server-Mode + Info + Calc Route + Profile Settings + Share GPX + Select from + Select to/via + + no profile data + , no used profile + Too much data for download. Please reduce. + Download scheduled. Check internet connection if it doesn\'t start. + current waypoint selection:\n + Expecting waypoint selection\n + Alternative + version = BRouter-%1$s \n + mem = %2$s \n + distance = %3$s km\n + filtered ascend = %4$s m\n + plain ascend = %5$s m\n + estimated time = %6$s + Error reading waypoints + coordinate source does not contain any waypoints! + "coordinate source contains too much waypoints: %1$d (please use from/to/via names) + diff --git a/brouter-routing-app/src/main/res/values-ca/strings.xml b/brouter-routing-app/src/main/res/values-ca/strings.xml index 13aeaea..54b2760 100644 --- a/brouter-routing-app/src/main/res/values-ca/strings.xml +++ b/brouter-routing-app/src/main/res/values-ca/strings.xml @@ -13,4 +13,60 @@ Aturar Descàrrega Espai=%1$s\nLliure=%2$s Descarregar segments + + Choose brouter data base dir: + Select a routing profile + Select Main Action + Download Manager + BRouter App + + Cancel + I know + Close + Exit + OK + Success + An Error occurred + + BRouter Download Manager + *** Attention:*** + \n\nThe Download Manager is used to download routing-data + files which can be up to 170MB each. Do not start the Download Manager + on a cellular data connection without a data plan! + Download speed is restricted to 16 MBit/s. + Successfully prepared a timeout-free calculation + You successfully repeated a calculation that previously run into a timeout + when started from your map-tool. If you repeat the same request from your + maptool, with the exact same destination point and a close-by starting point, + this request is guaranteed not to time out. + Enter SDCARD base dir: + Select Action + + Check VIA Selection: + Check NoGo Selection: + Server-Mode + Info + Calc Route + Profile Settings + Share GPX + Select from + Select to/via + + no profile data + , no used profile + Too much data for download. Please reduce. + Download scheduled. Check internet connection if it doesn\'t start. + current waypoint selection:\n + Expecting waypoint selection\n + Alternative + version = BRouter-%1$s \n + mem = %2$s \n + distance = %3$s km\n + filtered ascend = %4$s m\n + plain ascend = %5$s m\n + estimated time = %6$s + Error reading waypoints + coordinate source does not contain any waypoints! + "coordinate source contains too much waypoints: %1$d (please use from/to/via names) + diff --git a/brouter-routing-app/src/main/res/values-de/strings.xml b/brouter-routing-app/src/main/res/values-de/strings.xml index 85002f5..39bb025 100644 --- a/brouter-routing-app/src/main/res/values-de/strings.xml +++ b/brouter-routing-app/src/main/res/values-de/strings.xml @@ -13,4 +13,60 @@ Download stoppen Größe=%1$s\nFrei=%2$s Segmente herunterladen + + Choose brouter data base dir: + Select a routing profile + Select Main Action + Download Manager + BRouter App + + Cancel + I know + Close + Exit + OK + Success + An Error occurred + + BRouter Download Manager + *** Attention:*** + \n\nThe Download Manager is used to download routing-data + files which can be up to 170MB each. Do not start the Download Manager + on a cellular data connection without a data plan! + Download speed is restricted to 16 MBit/s. + Successfully prepared a timeout-free calculation + You successfully repeated a calculation that previously run into a timeout + when started from your map-tool. If you repeat the same request from your + maptool, with the exact same destination point and a close-by starting point, + this request is guaranteed not to time out. + Enter SDCARD base dir: + Select Action + + Check VIA Selection: + Check NoGo Selection: + Server-Mode + Info + Calc Route + Profile Settings + Share GPX + Select from + Select to/via + + no profile data + , no used profile + Too much data for download. Please reduce. + Download scheduled. Check internet connection if it doesn\'t start. + current waypoint selection:\n + Expecting waypoint selection\n + Alternative + version = BRouter-%1$s \n + mem = %2$s \n + distance = %3$s km\n + filtered ascend = %4$s m\n + plain ascend = %5$s m\n + estimated time = %6$s + Error reading waypoints + coordinate source does not contain any waypoints! + "coordinate source contains too much waypoints: %1$d (please use from/to/via names) + diff --git a/brouter-routing-app/src/main/res/values-el/strings.xml b/brouter-routing-app/src/main/res/values-el/strings.xml index 0ef6b6c..a8d74fb 100644 --- a/brouter-routing-app/src/main/res/values-el/strings.xml +++ b/brouter-routing-app/src/main/res/values-el/strings.xml @@ -13,4 +13,60 @@ Διακοπή λήψης Μέγεθος=%1$s\nΕλεύθερο=%2$s Λήψη τμημάτων + + Choose brouter data base dir: + Select a routing profile + Select Main Action + Download Manager + BRouter App + + Cancel + I know + Close + Exit + OK + Success + An Error occurred + + BRouter Download Manager + *** Attention:*** + \n\nThe Download Manager is used to download routing-data + files which can be up to 170MB each. Do not start the Download Manager + on a cellular data connection without a data plan! + Download speed is restricted to 16 MBit/s. + Successfully prepared a timeout-free calculation + You successfully repeated a calculation that previously run into a timeout + when started from your map-tool. If you repeat the same request from your + maptool, with the exact same destination point and a close-by starting point, + this request is guaranteed not to time out. + Enter SDCARD base dir: + Select Action + + Check VIA Selection: + Check NoGo Selection: + Server-Mode + Info + Calc Route + Profile Settings + Share GPX + Select from + Select to/via + + no profile data + , no used profile + Too much data for download. Please reduce. + Download scheduled. Check internet connection if it doesn\'t start. + current waypoint selection:\n + Expecting waypoint selection\n + Alternative + version = BRouter-%1$s \n + mem = %2$s \n + distance = %3$s km\n + filtered ascend = %4$s m\n + plain ascend = %5$s m\n + estimated time = %6$s + Error reading waypoints + coordinate source does not contain any waypoints! + "coordinate source contains too much waypoints: %1$d (please use from/to/via names) + diff --git a/brouter-routing-app/src/main/res/values-es/strings.xml b/brouter-routing-app/src/main/res/values-es/strings.xml index 3929ff0..ff1327f 100644 --- a/brouter-routing-app/src/main/res/values-es/strings.xml +++ b/brouter-routing-app/src/main/res/values-es/strings.xml @@ -13,4 +13,60 @@ Detener descarga Tamaño=%1$s\nGratis=%2$s Descargar segmentos + + Choose brouter data base dir: + Select a routing profile + Select Main Action + Download Manager + BRouter App + + Cancel + I know + Close + Exit + OK + Success + An Error occurred + + BRouter Download Manager + *** Attention:*** + \n\nThe Download Manager is used to download routing-data + files which can be up to 170MB each. Do not start the Download Manager + on a cellular data connection without a data plan! + Download speed is restricted to 16 MBit/s. + Successfully prepared a timeout-free calculation + You successfully repeated a calculation that previously run into a timeout + when started from your map-tool. If you repeat the same request from your + maptool, with the exact same destination point and a close-by starting point, + this request is guaranteed not to time out. + Enter SDCARD base dir: + Select Action + + Check VIA Selection: + Check NoGo Selection: + Server-Mode + Info + Calc Route + Profile Settings + Share GPX + Select from + Select to/via + + no profile data + , no used profile + Too much data for download. Please reduce. + Download scheduled. Check internet connection if it doesn\'t start. + current waypoint selection:\n + Expecting waypoint selection\n + Alternative + version = BRouter-%1$s \n + mem = %2$s \n + distance = %3$s km\n + filtered ascend = %4$s m\n + plain ascend = %5$s m\n + estimated time = %6$s + Error reading waypoints + coordinate source does not contain any waypoints! + "coordinate source contains too much waypoints: %1$d (please use from/to/via names) + diff --git a/brouter-routing-app/src/main/res/values-fr/strings.xml b/brouter-routing-app/src/main/res/values-fr/strings.xml index b390687..293b40d 100644 --- a/brouter-routing-app/src/main/res/values-fr/strings.xml +++ b/brouter-routing-app/src/main/res/values-fr/strings.xml @@ -13,4 +13,60 @@ Arrêter le téléchargement Taille=%1$s\nGratuit=%2$s Télécharger les segments + + Choose brouter data base dir: + Select a routing profile + Select Main Action + Download Manager + BRouter App + + Cancel + I know + Close + Exit + OK + Success + An Error occurred + + BRouter Download Manager + *** Attention:*** + \n\nThe Download Manager is used to download routing-data + files which can be up to 170MB each. Do not start the Download Manager + on a cellular data connection without a data plan! + Download speed is restricted to 16 MBit/s. + Successfully prepared a timeout-free calculation + You successfully repeated a calculation that previously run into a timeout + when started from your map-tool. If you repeat the same request from your + maptool, with the exact same destination point and a close-by starting point, + this request is guaranteed not to time out. + Enter SDCARD base dir: + Select Action + + Check VIA Selection: + Check NoGo Selection: + Server-Mode + Info + Calc Route + Profile Settings + Share GPX + Select from + Select to/via + + no profile data + , no used profile + Too much data for download. Please reduce. + Download scheduled. Check internet connection if it doesn\'t start. + current waypoint selection:\n + Expecting waypoint selection\n + Alternative + version = BRouter-%1$s \n + mem = %2$s \n + distance = %3$s km\n + filtered ascend = %4$s m\n + plain ascend = %5$s m\n + estimated time = %6$s + Error reading waypoints + coordinate source does not contain any waypoints! + "coordinate source contains too much waypoints: %1$d (please use from/to/via names) + diff --git a/brouter-routing-app/src/main/res/values-it/strings.xml b/brouter-routing-app/src/main/res/values-it/strings.xml index 10f29fe..af2be5c 100644 --- a/brouter-routing-app/src/main/res/values-it/strings.xml +++ b/brouter-routing-app/src/main/res/values-it/strings.xml @@ -13,4 +13,60 @@ Interrompi download Taglia=%1$s\nGratis=%2$s Scarica segmenti + + Choose brouter data base dir: + Select a routing profile + Select Main Action + Download Manager + BRouter App + + Cancel + I know + Close + Exit + OK + Success + An Error occurred + + BRouter Download Manager + *** Attention:*** + \n\nThe Download Manager is used to download routing-data + files which can be up to 170MB each. Do not start the Download Manager + on a cellular data connection without a data plan! + Download speed is restricted to 16 MBit/s. + Successfully prepared a timeout-free calculation + You successfully repeated a calculation that previously run into a timeout + when started from your map-tool. If you repeat the same request from your + maptool, with the exact same destination point and a close-by starting point, + this request is guaranteed not to time out. + Enter SDCARD base dir: + Select Action + + Check VIA Selection: + Check NoGo Selection: + Server-Mode + Info + Calc Route + Profile Settings + Share GPX + Select from + Select to/via + + no profile data + , no used profile + Too much data for download. Please reduce. + Download scheduled. Check internet connection if it doesn\'t start. + current waypoint selection:\n + Expecting waypoint selection\n + Alternative + version = BRouter-%1$s \n + mem = %2$s \n + distance = %3$s km\n + filtered ascend = %4$s m\n + plain ascend = %5$s m\n + estimated time = %6$s + Error reading waypoints + coordinate source does not contain any waypoints! + "coordinate source contains too much waypoints: %1$d (please use from/to/via names) + diff --git a/brouter-routing-app/src/main/res/values-nl/strings.xml b/brouter-routing-app/src/main/res/values-nl/strings.xml index 300d668..cbc9a87 100644 --- a/brouter-routing-app/src/main/res/values-nl/strings.xml +++ b/brouter-routing-app/src/main/res/values-nl/strings.xml @@ -13,4 +13,60 @@ Download stoppen Grootte=%1$s\nGratis=%2$s Segmenten downloaden + + Choose brouter data base dir: + Select a routing profile + Select Main Action + Download Manager + BRouter App + + Cancel + I know + Close + Exit + OK + Success + An Error occurred + + BRouter Download Manager + *** Attention:*** + \n\nThe Download Manager is used to download routing-data + files which can be up to 170MB each. Do not start the Download Manager + on a cellular data connection without a data plan! + Download speed is restricted to 16 MBit/s. + Successfully prepared a timeout-free calculation + You successfully repeated a calculation that previously run into a timeout + when started from your map-tool. If you repeat the same request from your + maptool, with the exact same destination point and a close-by starting point, + this request is guaranteed not to time out. + Enter SDCARD base dir: + Select Action + + Check VIA Selection: + Check NoGo Selection: + Server-Mode + Info + Calc Route + Profile Settings + Share GPX + Select from + Select to/via + + no profile data + , no used profile + Too much data for download. Please reduce. + Download scheduled. Check internet connection if it doesn\'t start. + current waypoint selection:\n + Expecting waypoint selection\n + Alternative + version = BRouter-%1$s \n + mem = %2$s \n + distance = %3$s km\n + filtered ascend = %4$s m\n + plain ascend = %5$s m\n + estimated time = %6$s + Error reading waypoints + coordinate source does not contain any waypoints! + "coordinate source contains too much waypoints: %1$d (please use from/to/via names) + diff --git a/brouter-routing-app/src/main/res/values-pl/strings.xml b/brouter-routing-app/src/main/res/values-pl/strings.xml index 2de0f3c..f797ee1 100644 --- a/brouter-routing-app/src/main/res/values-pl/strings.xml +++ b/brouter-routing-app/src/main/res/values-pl/strings.xml @@ -13,4 +13,60 @@ Zatrzymaj pobieranie Rozmiar=%1$s\nDostępne=%2$s Pobieranie segmentów + + Choose brouter data base dir: + Select a routing profile + Select Main Action + Download Manager + BRouter App + + Cancel + I know + Close + Exit + OK + Success + An Error occurred + + BRouter Download Manager + *** Attention:*** + \n\nThe Download Manager is used to download routing-data + files which can be up to 170MB each. Do not start the Download Manager + on a cellular data connection without a data plan! + Download speed is restricted to 16 MBit/s. + Successfully prepared a timeout-free calculation + You successfully repeated a calculation that previously run into a timeout + when started from your map-tool. If you repeat the same request from your + maptool, with the exact same destination point and a close-by starting point, + this request is guaranteed not to time out. + Enter SDCARD base dir: + Select Action + + Check VIA Selection: + Check NoGo Selection: + Server-Mode + Info + Calc Route + Profile Settings + Share GPX + Select from + Select to/via + + no profile data + , no used profile + Too much data for download. Please reduce. + Download scheduled. Check internet connection if it doesn\'t start. + current waypoint selection:\n + Expecting waypoint selection\n + Alternative + version = BRouter-%1$s \n + mem = %2$s \n + distance = %3$s km\n + filtered ascend = %4$s m\n + plain ascend = %5$s m\n + estimated time = %6$s + Error reading waypoints + coordinate source does not contain any waypoints! + "coordinate source contains too much waypoints: %1$d (please use from/to/via names) + From 30d4fbb0b00572dfdb5243f911373f7b8d42f845 Mon Sep 17 00:00:00 2001 From: afischerdev Date: Sun, 10 Dec 2023 13:58:46 +0100 Subject: [PATCH 16/30] xml error correction --- brouter-routing-app/src/main/res/values-ar/strings.xml | 2 +- brouter-routing-app/src/main/res/values-ca/strings.xml | 2 +- brouter-routing-app/src/main/res/values-de/strings.xml | 2 +- brouter-routing-app/src/main/res/values-el/strings.xml | 2 +- brouter-routing-app/src/main/res/values-es/strings.xml | 2 +- brouter-routing-app/src/main/res/values-fr/strings.xml | 2 +- brouter-routing-app/src/main/res/values-it/strings.xml | 2 +- brouter-routing-app/src/main/res/values-nl/strings.xml | 2 +- brouter-routing-app/src/main/res/values-pl/strings.xml | 2 +- brouter-routing-app/src/main/res/values/strings.xml | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/brouter-routing-app/src/main/res/values-ar/strings.xml b/brouter-routing-app/src/main/res/values-ar/strings.xml index c08e7ec..850445e 100644 --- a/brouter-routing-app/src/main/res/values-ar/strings.xml +++ b/brouter-routing-app/src/main/res/values-ar/strings.xml @@ -67,6 +67,6 @@ estimated time = %6$s Error reading waypoints coordinate source does not contain any waypoints! - "coordinate source contains too much waypoints: %1$d (please use from/to/via names) + coordinate source contains too much waypoints: %1$d (please use from/to/via names) diff --git a/brouter-routing-app/src/main/res/values-ca/strings.xml b/brouter-routing-app/src/main/res/values-ca/strings.xml index 54b2760..1fc3b7e 100644 --- a/brouter-routing-app/src/main/res/values-ca/strings.xml +++ b/brouter-routing-app/src/main/res/values-ca/strings.xml @@ -67,6 +67,6 @@ estimated time = %6$s Error reading waypoints coordinate source does not contain any waypoints! - "coordinate source contains too much waypoints: %1$d (please use from/to/via names) + coordinate source contains too much waypoints: %1$d (please use from/to/via names) diff --git a/brouter-routing-app/src/main/res/values-de/strings.xml b/brouter-routing-app/src/main/res/values-de/strings.xml index 39bb025..0968c2f 100644 --- a/brouter-routing-app/src/main/res/values-de/strings.xml +++ b/brouter-routing-app/src/main/res/values-de/strings.xml @@ -67,6 +67,6 @@ estimated time = %6$s Error reading waypoints coordinate source does not contain any waypoints! - "coordinate source contains too much waypoints: %1$d (please use from/to/via names) + coordinate source contains too much waypoints: %1$d (please use from/to/via names) diff --git a/brouter-routing-app/src/main/res/values-el/strings.xml b/brouter-routing-app/src/main/res/values-el/strings.xml index a8d74fb..f25ef54 100644 --- a/brouter-routing-app/src/main/res/values-el/strings.xml +++ b/brouter-routing-app/src/main/res/values-el/strings.xml @@ -67,6 +67,6 @@ estimated time = %6$s Error reading waypoints coordinate source does not contain any waypoints! - "coordinate source contains too much waypoints: %1$d (please use from/to/via names) + coordinate source contains too much waypoints: %1$d (please use from/to/via names) diff --git a/brouter-routing-app/src/main/res/values-es/strings.xml b/brouter-routing-app/src/main/res/values-es/strings.xml index ff1327f..75d4f0e 100644 --- a/brouter-routing-app/src/main/res/values-es/strings.xml +++ b/brouter-routing-app/src/main/res/values-es/strings.xml @@ -67,6 +67,6 @@ estimated time = %6$s Error reading waypoints coordinate source does not contain any waypoints! - "coordinate source contains too much waypoints: %1$d (please use from/to/via names) + coordinate source contains too much waypoints: %1$d (please use from/to/via names) diff --git a/brouter-routing-app/src/main/res/values-fr/strings.xml b/brouter-routing-app/src/main/res/values-fr/strings.xml index 293b40d..e6baa53 100644 --- a/brouter-routing-app/src/main/res/values-fr/strings.xml +++ b/brouter-routing-app/src/main/res/values-fr/strings.xml @@ -67,6 +67,6 @@ estimated time = %6$s Error reading waypoints coordinate source does not contain any waypoints! - "coordinate source contains too much waypoints: %1$d (please use from/to/via names) + coordinate source contains too much waypoints: %1$d (please use from/to/via names) diff --git a/brouter-routing-app/src/main/res/values-it/strings.xml b/brouter-routing-app/src/main/res/values-it/strings.xml index af2be5c..03a4726 100644 --- a/brouter-routing-app/src/main/res/values-it/strings.xml +++ b/brouter-routing-app/src/main/res/values-it/strings.xml @@ -67,6 +67,6 @@ estimated time = %6$s Error reading waypoints coordinate source does not contain any waypoints! - "coordinate source contains too much waypoints: %1$d (please use from/to/via names) + coordinate source contains too much waypoints: %1$d (please use from/to/via names) diff --git a/brouter-routing-app/src/main/res/values-nl/strings.xml b/brouter-routing-app/src/main/res/values-nl/strings.xml index cbc9a87..dcb449a 100644 --- a/brouter-routing-app/src/main/res/values-nl/strings.xml +++ b/brouter-routing-app/src/main/res/values-nl/strings.xml @@ -67,6 +67,6 @@ estimated time = %6$s Error reading waypoints coordinate source does not contain any waypoints! - "coordinate source contains too much waypoints: %1$d (please use from/to/via names) + coordinate source contains too much waypoints: %1$d (please use from/to/via names) diff --git a/brouter-routing-app/src/main/res/values-pl/strings.xml b/brouter-routing-app/src/main/res/values-pl/strings.xml index f797ee1..ada4d41 100644 --- a/brouter-routing-app/src/main/res/values-pl/strings.xml +++ b/brouter-routing-app/src/main/res/values-pl/strings.xml @@ -67,6 +67,6 @@ estimated time = %6$s Error reading waypoints coordinate source does not contain any waypoints! - "coordinate source contains too much waypoints: %1$d (please use from/to/via names) + coordinate source contains too much waypoints: %1$d (please use from/to/via names) diff --git a/brouter-routing-app/src/main/res/values/strings.xml b/brouter-routing-app/src/main/res/values/strings.xml index 2c1b384..cfc2d16 100644 --- a/brouter-routing-app/src/main/res/values/strings.xml +++ b/brouter-routing-app/src/main/res/values/strings.xml @@ -67,6 +67,6 @@ estimated time = %6$s Error reading waypoints coordinate source does not contain any waypoints! - "coordinate source contains too much waypoints: %1$d (please use from/to/via names) + coordinate source contains too much waypoints: %1$d (please use from/to/via names) From 1e9783819b57373112a30e4c30c1f8f9da3e4ab2 Mon Sep 17 00:00:00 2001 From: afischerdev Date: Mon, 11 Dec 2023 10:52:22 +0100 Subject: [PATCH 17/30] added str format for resource strings --- .../src/main/java/btools/routingapp/BRouterView.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/brouter-routing-app/src/main/java/btools/routingapp/BRouterView.java b/brouter-routing-app/src/main/java/btools/routingapp/BRouterView.java index 5c7be2b..e87f593 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/BRouterView.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/BRouterView.java @@ -387,7 +387,7 @@ public class BRouterView extends View { if (size < 1) msg = getContext().getString(R.string.msg_no_wpt); if (size > 1000) - msg = getContext().getString(R.string.msg_to_much_wpts, size); + msg = String.format(getContext().getString(R.string.msg_to_much_wpts), size); } if (msg != null) { @@ -718,7 +718,7 @@ public class BRouterView extends View { ((BRouterActivity) getContext()).showErrorMessage(cr.getErrorMessage()); } else { String memstat = memoryClass + "mb pathPeak " + ((cr.getPathPeak() + 500) / 1000) + "k"; - String result = getContext().getString(R.string.msg_status_result, + String result = String.format(getContext().getString(R.string.msg_status_result), getContext().getString(R.string.app_version), memstat, Double.toString(cr.getDistance() / 1000.), From a21dee5923e2c050969bd8ba8b9a530a3cb82e6f Mon Sep 17 00:00:00 2001 From: afischerdev Date: Mon, 11 Dec 2023 14:02:45 +0100 Subject: [PATCH 18/30] string name misspelling --- .../src/main/java/btools/routingapp/BRouterView.java | 2 +- brouter-routing-app/src/main/res/values-ar/strings.xml | 2 +- brouter-routing-app/src/main/res/values-ca/strings.xml | 2 +- brouter-routing-app/src/main/res/values-de/strings.xml | 2 +- brouter-routing-app/src/main/res/values-el/strings.xml | 2 +- brouter-routing-app/src/main/res/values-es/strings.xml | 2 +- brouter-routing-app/src/main/res/values-fr/strings.xml | 2 +- brouter-routing-app/src/main/res/values-it/strings.xml | 2 +- brouter-routing-app/src/main/res/values-nl/strings.xml | 2 +- brouter-routing-app/src/main/res/values-pl/strings.xml | 2 +- brouter-routing-app/src/main/res/values/strings.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/brouter-routing-app/src/main/java/btools/routingapp/BRouterView.java b/brouter-routing-app/src/main/java/btools/routingapp/BRouterView.java index e87f593..a14dfcf 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/BRouterView.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/BRouterView.java @@ -387,7 +387,7 @@ public class BRouterView extends View { if (size < 1) msg = getContext().getString(R.string.msg_no_wpt); if (size > 1000) - msg = String.format(getContext().getString(R.string.msg_to_much_wpts), size); + msg = String.format(getContext().getString(R.string.msg_too_much_wpts), size); } if (msg != null) { diff --git a/brouter-routing-app/src/main/res/values-ar/strings.xml b/brouter-routing-app/src/main/res/values-ar/strings.xml index 850445e..9f804d5 100644 --- a/brouter-routing-app/src/main/res/values-ar/strings.xml +++ b/brouter-routing-app/src/main/res/values-ar/strings.xml @@ -67,6 +67,6 @@ estimated time = %6$s Error reading waypoints coordinate source does not contain any waypoints! - coordinate source contains too much waypoints: %1$d (please use from/to/via names) + coordinate source contains too much waypoints: %1$d (please use from/to/via names) diff --git a/brouter-routing-app/src/main/res/values-ca/strings.xml b/brouter-routing-app/src/main/res/values-ca/strings.xml index 1fc3b7e..3bd69c2 100644 --- a/brouter-routing-app/src/main/res/values-ca/strings.xml +++ b/brouter-routing-app/src/main/res/values-ca/strings.xml @@ -67,6 +67,6 @@ estimated time = %6$s Error reading waypoints coordinate source does not contain any waypoints! - coordinate source contains too much waypoints: %1$d (please use from/to/via names) + coordinate source contains too much waypoints: %1$d (please use from/to/via names) diff --git a/brouter-routing-app/src/main/res/values-de/strings.xml b/brouter-routing-app/src/main/res/values-de/strings.xml index 0968c2f..ae6d47c 100644 --- a/brouter-routing-app/src/main/res/values-de/strings.xml +++ b/brouter-routing-app/src/main/res/values-de/strings.xml @@ -67,6 +67,6 @@ estimated time = %6$s Error reading waypoints coordinate source does not contain any waypoints! - coordinate source contains too much waypoints: %1$d (please use from/to/via names) + coordinate source contains too much waypoints: %1$d (please use from/to/via names) diff --git a/brouter-routing-app/src/main/res/values-el/strings.xml b/brouter-routing-app/src/main/res/values-el/strings.xml index f25ef54..1b34a3a 100644 --- a/brouter-routing-app/src/main/res/values-el/strings.xml +++ b/brouter-routing-app/src/main/res/values-el/strings.xml @@ -67,6 +67,6 @@ estimated time = %6$s Error reading waypoints coordinate source does not contain any waypoints! - coordinate source contains too much waypoints: %1$d (please use from/to/via names) + coordinate source contains too much waypoints: %1$d (please use from/to/via names) diff --git a/brouter-routing-app/src/main/res/values-es/strings.xml b/brouter-routing-app/src/main/res/values-es/strings.xml index 75d4f0e..4fe540e 100644 --- a/brouter-routing-app/src/main/res/values-es/strings.xml +++ b/brouter-routing-app/src/main/res/values-es/strings.xml @@ -67,6 +67,6 @@ estimated time = %6$s Error reading waypoints coordinate source does not contain any waypoints! - coordinate source contains too much waypoints: %1$d (please use from/to/via names) + coordinate source contains too much waypoints: %1$d (please use from/to/via names) diff --git a/brouter-routing-app/src/main/res/values-fr/strings.xml b/brouter-routing-app/src/main/res/values-fr/strings.xml index e6baa53..58f0f56 100644 --- a/brouter-routing-app/src/main/res/values-fr/strings.xml +++ b/brouter-routing-app/src/main/res/values-fr/strings.xml @@ -67,6 +67,6 @@ estimated time = %6$s Error reading waypoints coordinate source does not contain any waypoints! - coordinate source contains too much waypoints: %1$d (please use from/to/via names) + coordinate source contains too much waypoints: %1$d (please use from/to/via names) diff --git a/brouter-routing-app/src/main/res/values-it/strings.xml b/brouter-routing-app/src/main/res/values-it/strings.xml index 03a4726..c9e56a5 100644 --- a/brouter-routing-app/src/main/res/values-it/strings.xml +++ b/brouter-routing-app/src/main/res/values-it/strings.xml @@ -67,6 +67,6 @@ estimated time = %6$s Error reading waypoints coordinate source does not contain any waypoints! - coordinate source contains too much waypoints: %1$d (please use from/to/via names) + coordinate source contains too much waypoints: %1$d (please use from/to/via names) diff --git a/brouter-routing-app/src/main/res/values-nl/strings.xml b/brouter-routing-app/src/main/res/values-nl/strings.xml index dcb449a..2b58d1d 100644 --- a/brouter-routing-app/src/main/res/values-nl/strings.xml +++ b/brouter-routing-app/src/main/res/values-nl/strings.xml @@ -67,6 +67,6 @@ estimated time = %6$s Error reading waypoints coordinate source does not contain any waypoints! - coordinate source contains too much waypoints: %1$d (please use from/to/via names) + coordinate source contains too much waypoints: %1$d (please use from/to/via names) diff --git a/brouter-routing-app/src/main/res/values-pl/strings.xml b/brouter-routing-app/src/main/res/values-pl/strings.xml index ada4d41..4ad50c0 100644 --- a/brouter-routing-app/src/main/res/values-pl/strings.xml +++ b/brouter-routing-app/src/main/res/values-pl/strings.xml @@ -67,6 +67,6 @@ estimated time = %6$s Error reading waypoints coordinate source does not contain any waypoints! - coordinate source contains too much waypoints: %1$d (please use from/to/via names) + coordinate source contains too much waypoints: %1$d (please use from/to/via names) diff --git a/brouter-routing-app/src/main/res/values/strings.xml b/brouter-routing-app/src/main/res/values/strings.xml index cfc2d16..3a08420 100644 --- a/brouter-routing-app/src/main/res/values/strings.xml +++ b/brouter-routing-app/src/main/res/values/strings.xml @@ -67,6 +67,6 @@ estimated time = %6$s Error reading waypoints coordinate source does not contain any waypoints! - coordinate source contains too much waypoints: %1$d (please use from/to/via names) + coordinate source contains too much waypoints: %1$d (please use from/to/via names) From f37c77267a92abaa0d6dfc5e1f9decc9d8d62644 Mon Sep 17 00:00:00 2001 From: afischerdev Date: Thu, 14 Dec 2023 11:47:35 +0100 Subject: [PATCH 19/30] added translations and new messages --- .../btools/routingapp/BInstallerActivity.java | 39 +++--- .../src/main/res/values-ar/strings.xml | 121 ++++++++++-------- .../src/main/res/values-ca/strings.xml | 118 ++++++++++------- .../src/main/res/values-de/strings.xml | 115 ++++++++++------- .../src/main/res/values-el/strings.xml | 121 ++++++++++-------- .../src/main/res/values-es/strings.xml | 116 ++++++++++------- .../src/main/res/values-fr/strings.xml | 113 +++++++++------- .../src/main/res/values-it/strings.xml | 119 ++++++++++------- .../src/main/res/values-nl/strings.xml | 107 +++++++++------- .../src/main/res/values-pl/strings.xml | 119 ++++++++++------- .../src/main/res/values/strings.xml | 22 ++++ 11 files changed, 656 insertions(+), 454 deletions(-) diff --git a/brouter-routing-app/src/main/java/btools/routingapp/BInstallerActivity.java b/brouter-routing-app/src/main/java/btools/routingapp/BInstallerActivity.java index 693882a..7ceac35 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/BInstallerActivity.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/BInstallerActivity.java @@ -10,7 +10,6 @@ import android.annotation.SuppressLint; import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; -import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.content.res.Resources; import android.os.Build; @@ -296,13 +295,13 @@ public class BInstallerActivity extends AppCompatActivity { String result; switch (workInfo.getState()) { case FAILED: - result = "Download failed"; + result = getString(R.string.msg_download_faild); break; case CANCELLED: - result = "Download cancelled"; + result = getString(R.string.msg_download_cancel); break; case SUCCEEDED: - result = "Download succeeded"; + result = getString(R.string.msg_download_succeed); break; default: result = ""; @@ -350,12 +349,12 @@ public class BInstallerActivity extends AppCompatActivity { switch (id) { case DIALOG_CONFIRM_DELETE_ID: builder - .setTitle("Confirm Delete") - .setMessage("Really delete?").setPositiveButton("Yes", new DialogInterface.OnClickListener() { + .setTitle(R.string.title_delete) + .setMessage(R.string.summary_delete).setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { deleteSelectedTiles(); } - }).setNegativeButton("No", new DialogInterface.OnClickListener() { + }).setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { } }); @@ -363,9 +362,9 @@ public class BInstallerActivity extends AppCompatActivity { case DIALOG_CONFIRM_NEXTSTEPS_ID: builder - .setTitle("Version Problem") - .setMessage("The base version for tiles has changed. What to do?") - .setPositiveButton("Continue with current download, delete other old data", new DialogInterface.OnClickListener() { + .setTitle(R.string.title_version) + .setMessage(R.string.summary_version) + .setPositiveButton(R.string.action_version1, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { ArrayList allTiles = mBInstallerView.getSelectedTiles(MASK_INSTALLED_RD5); @@ -377,11 +376,11 @@ public class BInstallerActivity extends AppCompatActivity { } downloadSelectedTiles(); } - }).setNegativeButton("Select all for download and start", new DialogInterface.OnClickListener() { + }).setNegativeButton(R.string.action_version2, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { downloadInstalledTiles(); } - }).setNeutralButton("Cancel now, complete on an other day", new DialogInterface.OnClickListener() { + }).setNeutralButton(R.string.action_version3, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { File tmplookupFile = new File(mBaseDir, "brouter/profiles2/lookups.dat.tmp"); tmplookupFile.delete(); @@ -392,17 +391,17 @@ public class BInstallerActivity extends AppCompatActivity { case DIALOG_CONFIRM_GETDIFFS_ID: builder - .setTitle("Version Differences") - .setMessage("The base version for some tiles is different. What to do?") - .setPositiveButton("Download all different tiles", new DialogInterface.OnClickListener() { + .setTitle(R.string.title_version_diff) + .setMessage(R.string.summary_version_diff) + .setPositiveButton(R.string.action_version_diff1, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { downloadDiffVersionTiles(); } - }).setNegativeButton("Drop all different tiles", new DialogInterface.OnClickListener() { + }).setNegativeButton(R.string.action_version_diff2, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dropDiffVersionTiles(); } - }).setNeutralButton("Cancel now, complete on an other day", new DialogInterface.OnClickListener() { + }).setNeutralButton(R.string.action_version_diff3, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { finish(); } @@ -410,9 +409,9 @@ public class BInstallerActivity extends AppCompatActivity { return builder.create(); case DIALOG_NEW_APP_NEEDED_ID: builder - .setTitle("App Version") - .setMessage("The new data version needs a new app. Please update BRouter first") - .setPositiveButton("Ok", new DialogInterface.OnClickListener() { + .setTitle(R.string.title_version) + .setMessage(R.string.summary_new_version) + .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { finish(); } diff --git a/brouter-routing-app/src/main/res/values-ar/strings.xml b/brouter-routing-app/src/main/res/values-ar/strings.xml index 9f804d5..74679da 100644 --- a/brouter-routing-app/src/main/res/values-ar/strings.xml +++ b/brouter-routing-app/src/main/res/values-ar/strings.xml @@ -14,59 +14,80 @@ الحجم=%1$s\nالحجم المتوفر=%2$s تحميل القطع - Choose brouter data base dir: - Select a routing profile - Select Main Action - Download Manager - BRouter App + اختر مكان قاعدة بيانات brouter: + اختر ملف تعريف التوجيه + حدد الإجراء الرئيسي + مدير التنزيلات + تطبيق BRouter - Cancel - I know - Close - Exit - OK - Success - An Error occurred + إلغاء + أعرف ذلك + إغلاق + خروج + موافق + تم بنجاح + حدث خطأ ما - BRouter Download Manager - *** Attention:*** - \n\nThe Download Manager is used to download routing-data - files which can be up to 170MB each. Do not start the Download Manager - on a cellular data connection without a data plan! - Download speed is restricted to 16 MBit/s. - Successfully prepared a timeout-free calculation - You successfully repeated a calculation that previously run into a timeout - when started from your map-tool. If you repeat the same request from your - maptool, with the exact same destination point and a close-by starting point, - this request is guaranteed not to time out. - Enter SDCARD base dir: - Select Action + مدير تنزيلات BRouter + *** تحذير:*** + \n\nيتم استخدام مدير التنزيل لتنزيل ملفات بيانات التوجيه عبر الطرق + والتي يمكن أن يصل حجمها إلى 170 ميجابايت، لذلك لا تقم بتشغيل + "مدير التنزيلات" حينما تكون متصلاً عبر البيانات الخلوية ومحدوداً بحجم التنزيلات! + سرعة التنزيل محدودة على 16 ميجابايت/بالثانية. + أنجزت عملية الحساب بنجاح وبدون تأخير + لقد نجحت في تكرار عملية حسابية كانت قد انتهت في السابق + عند بدايتها من خلال أداة الخريطة، إذا قمت بتكرار نفس الطلب من + أداة الخريطة الخاصة بك ومع نفس الوجهة بالضبط وبنقطة بداية + قريبة، فسيضمن لك التطبيق عدم انتهاء مهلة هذا الطلب. + أدخل مسار الذاكرة الخارجية: + اختر الإجراء - Check VIA Selection: - Check NoGo Selection: - Server-Mode - Info - Calc Route - Profile Settings - Share GPX - Select from - Select to/via + التحقق من النقاط الوسيطة: + التحقق من النقاط المسبتعدة: + وضع-الخادم + معلومات + حساب الطريق + إعدادات ملف التعريف + مشاركة ملف GPX + اختر من + اختر إلى/عبر - no profile data - , no used profile - Too much data for download. Please reduce. - Download scheduled. Check internet connection if it doesn\'t start. - current waypoint selection:\n - Expecting waypoint selection\n - Alternative - version = BRouter-%1$s \n - mem = %2$s \n - distance = %3$s km\n - filtered ascend = %4$s m\n - plain ascend = %5$s m\n - estimated time = %6$s - Error reading waypoints - coordinate source does not contain any waypoints! - coordinate source contains too much waypoints: %1$d (please use from/to/via names) + لا توجد بيانات ملف التعريف + ، لا يوجد ملف تعريف مستخدم + هناك الكثير من البيانات للتنزيل، من فضلك قم بتقليلها. + تمت جدولة التنزيل، وتحقق من اتصالك بالإنترنت إذا لم يبدأ التنزيل. + نقاط الطريق الحالية المحددة:\n + نقاط الطريق المتوقعة المحددة\n + البديل + الإصدار = BRouter-%1$s \n + الذاكرة = %2$s \n + المسافة = %3$s كم\n + التصاعد المرشح = %4$s م\n + التصاعد العادي = %5$s م\n + الوقت المقدر = %6$s + خطأ في قراءة نقاط الطريق + لا يحتوي مصدر الإحداثيات على أي نقاط الطريق! + مصدر الإحداثيات يحتوي على عدد كبير جدًا من نقاط الطريق: %1$d (يرجى استخدام أسماء النقاط من/إلى/عبر from/to/via) + + No + Yes + + Confirm Delete + Really delete? + Version Problem + The base version for tiles has changed. What to do? + Continue with current download, delete other old data + Select all for download and start + Cancel now, complete on an other day + Version Differences + The base version for some tiles is different. What to do? + Download all different tiles + Drop all different tiles + Cancel now, complete on an other day + The new data version needs a new app. Please update BRouter first + + Download failed + Download cancelled + Download succeeded diff --git a/brouter-routing-app/src/main/res/values-ca/strings.xml b/brouter-routing-app/src/main/res/values-ca/strings.xml index 3bd69c2..3ebbf3e 100644 --- a/brouter-routing-app/src/main/res/values-ca/strings.xml +++ b/brouter-routing-app/src/main/res/values-ca/strings.xml @@ -14,59 +14,79 @@ Espai=%1$s\nLliure=%2$s Descarregar segments - Choose brouter data base dir: - Select a routing profile - Select Main Action - Download Manager - BRouter App + Escollir directori base brouter: + Seleccionar un perfil d\'enrutament + Seleccionar Acció Principal + Gestor de Baixades + App BRouter - Cancel - I know - Close - Exit - OK - Success - An Error occurred + Cancel·lar + Ho sé + Tancar + Sortir + D\'acord + Èxit + Ha aparegut un error - BRouter Download Manager - *** Attention:*** - \n\nThe Download Manager is used to download routing-data - files which can be up to 170MB each. Do not start the Download Manager - on a cellular data connection without a data plan! - Download speed is restricted to 16 MBit/s. - Successfully prepared a timeout-free calculation - You successfully repeated a calculation that previously run into a timeout - when started from your map-tool. If you repeat the same request from your - maptool, with the exact same destination point and a close-by starting point, - this request is guaranteed not to time out. - Enter SDCARD base dir: - Select Action + Gestor de baixades BRouter + *** Atenció:*** + \n\nEl Gestor de Baixades es fa servir per descarregar fitxers de dades + d\'enrutament, que poden arribar als 170 Mb cadascun. No inicies el Gestor + des d\'un mòbil sense un pla de dades! + La velocitat de baixada està limitada a 16 Mbit/s. + S\'ha preparat correctament un càlcul sense límit de temps + S\'ha repetit amb èxit un càlcul a través de l\'aplicació de cartografia que prèviament havia + superat el temps d\'espera. Si repeteixes la mateixa petició amb exactament el mateix destí i un punt de partida proper, + es garanteix que la petició no esgotarà el límit de temps. + Introdueix el directori base de la tarja SD: + Seleccionar Acció - Check VIA Selection: - Check NoGo Selection: - Server-Mode + Comprovar Selecció VIA: + Comprovar Selecció NoGo: + Mode-Servidor Info - Calc Route - Profile Settings - Share GPX - Select from - Select to/via + Calc Ruta + Ajustaments del perfil + Compartir GPX + Seleccionar des de + Seleccionar a/via - no profile data - , no used profile - Too much data for download. Please reduce. - Download scheduled. Check internet connection if it doesn\'t start. - current waypoint selection:\n - Expecting waypoint selection\n - Alternative - version = BRouter-%1$s \n - mem = %2$s \n - distance = %3$s km\n - filtered ascend = %4$s m\n - plain ascend = %5$s m\n - estimated time = %6$s - Error reading waypoints - coordinate source does not contain any waypoints! - coordinate source contains too much waypoints: %1$d (please use from/to/via names) + no hi ha dades al perfil + , cap perfil utilitzat + Massa dades per baixar. Si us plau, redueix-les. + Baixada programada. Comprovar la connexió a internet si no comença. + selecció actual de fita:\n + Esperant selecció de fita\n + Alternativa + versió = BRouter-%1$s \n + memòria = %2$s \n + distància = %3$s km\n + ascensió filtrada = %4$s m\n + ascens en pla = %5$s m\n + temps estimat = %6$s + Error llegint fites + la font de coordenades no conté cap fita! + la font de coordenades conté massa fites: %1$d (si us plau, fes servir noms des de/a/via) + + No + Yes + + Confirm Delete + Really delete? + Version Problem + The base version for tiles has changed. What to do? + Continue with current download, delete other old data + Select all for download and start + Cancel now, complete on an other day + Version Differences + The base version for some tiles is different. What to do? + Download all different tiles + Drop all different tiles + Cancel now, complete on an other day + The new data version needs a new app. Please update BRouter first + + Download failed + Download cancelled + Download succeeded diff --git a/brouter-routing-app/src/main/res/values-de/strings.xml b/brouter-routing-app/src/main/res/values-de/strings.xml index ae6d47c..9a7bed9 100644 --- a/brouter-routing-app/src/main/res/values-de/strings.xml +++ b/brouter-routing-app/src/main/res/values-de/strings.xml @@ -14,59 +14,80 @@ Größe=%1$s\nFrei=%2$s Segmente herunterladen - Choose brouter data base dir: - Select a routing profile - Select Main Action - Download Manager - BRouter App + BRouter-Datenbankverzeichnis wählen: + Routenprofil wählen + Standardaktion wählen + Downloadmanager + BRouter-App - Cancel - I know - Close - Exit + Abbrechen + Ich weiß + Schließen + Verlassen OK - Success - An Error occurred + Erfolg + Ein Fehler ist aufgetreten - BRouter Download Manager - *** Attention:*** - \n\nThe Download Manager is used to download routing-data - files which can be up to 170MB each. Do not start the Download Manager - on a cellular data connection without a data plan! - Download speed is restricted to 16 MBit/s. - Successfully prepared a timeout-free calculation - You successfully repeated a calculation that previously run into a timeout - when started from your map-tool. If you repeat the same request from your - maptool, with the exact same destination point and a close-by starting point, - this request is guaranteed not to time out. - Enter SDCARD base dir: - Select Action + BRouter Downloadmanager + *** Achtung:*** + \n\nDer Downloadmanager wird zum Herunterladen von Routingdaten verwendet + die jeweils bis zu 170MB groß sein können. Starten Sie den Downloadmanager + nicht auf Mobiltelefonen ohne Mobilfunktdatentarif! + Die Downloadgeschwindigkeit ist auf 16 MBit/s begrenzt. + Berechnung ohne Zeitüberschreitung erfolgreich + Sie haben eine Berechnung erfolgreich wiederholt, bei + der zuvor beim Start von Ihrem Karten-Tool aus eine Zeitüberschreitung auftrat. + Wenn Sie dieselbe Anfrage von Ihrem Karten-Tool aus wiederholen, mit genau demselben + Zielpunkt und einem nahe gelegenen Startpunkt, wird diese Anfrage garantiert nicht abbrechen. + SD-Karten Verzeichnis wählen: + Aktion wählen - Check VIA Selection: - Check NoGo Selection: - Server-Mode + Via-Auswahl prüfen: + NoGo-Auswahl prüfen: + Server-Modus Info - Calc Route - Profile Settings - Share GPX - Select from - Select to/via + Route berechnen + Profileinstellungen + GPX teilen + "Von" wählen + "Nach"/Via wählen - no profile data - , no used profile - Too much data for download. Please reduce. - Download scheduled. Check internet connection if it doesn\'t start. - current waypoint selection:\n - Expecting waypoint selection\n + Keine Profildaten + , kein verwendetes Profil + Zu viele Daten für den Download. Bitte reduzieren. + Download geplant. Überprüfen Sie die Internetverbindung, wenn der Download nicht startet. + aktuelle Wegpunktauswahl:\n + Erwarte Wegpunktauswahl\n Alternative - version = BRouter-%1$s \n - mem = %2$s \n - distance = %3$s km\n - filtered ascend = %4$s m\n - plain ascend = %5$s m\n - estimated time = %6$s - Error reading waypoints - coordinate source does not contain any waypoints! - coordinate source contains too much waypoints: %1$d (please use from/to/via names) + Version = BRouter-%1$s\n + Speicher = %2$s \n + Abstand = %3$s km\n + gefilterter Aufstieg = %4$s m\n + schlichter Aufstieg = %5$s m\n + geschätzte Zeit = %6$s + Fehler beim Lesen von Wegpunkten + Die Koordinatenquelle enthält keine Wegpunkte! + Die Koordinatenquelle enthält zu viele Wegpunkte: %1$d (bitte von/nach/via-Namen verwenden) + + No + Yes + + Confirm Delete + Really delete? + Version Problem + The base version for tiles has changed. What to do? + Continue with current download, delete other old data + Select all for download and start + Cancel now, complete on an other day + Version Differences + The base version for some tiles is different. What to do? + Download all different tiles + Drop all different tiles + Cancel now, complete on an other day + The new data version needs a new app. Please update BRouter first + + Download failed + Download cancelled + Download succeeded diff --git a/brouter-routing-app/src/main/res/values-el/strings.xml b/brouter-routing-app/src/main/res/values-el/strings.xml index 1b34a3a..742b9a3 100644 --- a/brouter-routing-app/src/main/res/values-el/strings.xml +++ b/brouter-routing-app/src/main/res/values-el/strings.xml @@ -1,7 +1,7 @@ - %d τμήμα + %d τμήμαcompare cl %d τμήματα Ακύρωση λήψης @@ -14,59 +14,80 @@ Μέγεθος=%1$s\nΕλεύθερο=%2$s Λήψη τμημάτων - Choose brouter data base dir: - Select a routing profile - Select Main Action - Download Manager - BRouter App + Επιλέξτε φάκελο δεδομένων brouter: + Επιλέξτε ένα προφίλ δρομολόγησης + Επιλέξτε ενέργεια + Διαχειριστής λήψεων + Εφαρμογή BRouter - Cancel - I know - Close - Exit + Ακύρωση + Γνωρίζω + Κλείσιμο + Έξοδος OK - Success - An Error occurred + Επιτυχία + Παρουσιάστηκε σφάλμα - BRouter Download Manager - *** Attention:*** - \n\nThe Download Manager is used to download routing-data - files which can be up to 170MB each. Do not start the Download Manager - on a cellular data connection without a data plan! - Download speed is restricted to 16 MBit/s. - Successfully prepared a timeout-free calculation - You successfully repeated a calculation that previously run into a timeout - when started from your map-tool. If you repeat the same request from your - maptool, with the exact same destination point and a close-by starting point, - this request is guaranteed not to time out. - Enter SDCARD base dir: - Select Action + BRouter διαχειριστής λήψεων + *** Προσοχή:*** + \n\nΟ διαχειριστής λήψεων χρησιμοποιείται για τη λήψη αρχείων δεδομένων δρομολόγησης + που μπορεί να είναι έως 170MB το καθένα. Μην ξεκινήσετε το διαχειριστή λήψεων + σε σύνδεση δεδομένων κινητής τηλεφωνίας χωρίς πρόγραμμα δεδομένων! + Η ταχύτητα λήψης περιορίζεται στα 16 MBit/s. + Ετοιμάστηκε επιτυχώς ένας υπολογισμός χωρίς χρονικό όριο + Επαναλάβατε με επιτυχία έναν υπολογισμό που πριν είχε χρονικό όριο + όταν ξεκίνησε από το εργαλείο χαρτών σας. Εάν επαναλάβετε το ίδιο αίτημα + από το εργαλείο χαρτών σας, με τον ίδιο ακριβώς προορισμό και μια κοντινή αφετηρία, + αυτό το αίτημα είναι εγγυημένο ότι δεν θα λήξει. + Εισάγετε φάκελο SDCARD: + Επιλέξτε ενέργεια - Check VIA Selection: - Check NoGo Selection: - Server-Mode - Info - Calc Route - Profile Settings - Share GPX - Select from - Select to/via + Ελέγξτε την επιλογή VIA: + Ελέγξτε την επιλογή NoGo: + Λειτουργία διακομιστή + Πληροφορίες + Υπολογισμός διαδρομής + Ρυθμίσεις προφίλ + Κοινή χρήση GPX + Επιλέξτε από + Επιλέξτε προς/μέσω - no profile data - , no used profile - Too much data for download. Please reduce. - Download scheduled. Check internet connection if it doesn\'t start. - current waypoint selection:\n - Expecting waypoint selection\n - Alternative - version = BRouter-%1$s \n - mem = %2$s \n - distance = %3$s km\n - filtered ascend = %4$s m\n - plain ascend = %5$s m\n - estimated time = %6$s - Error reading waypoints - coordinate source does not contain any waypoints! - coordinate source contains too much waypoints: %1$d (please use from/to/via names) + μη δεδομένα προφίλ + , μη χρησιμοποιημένο προφίλ + Πάρα πολλά δεδομένα για λήψη. Παρακαλώ μειώστε. + Προγραμματισμένη λήψη. Ελέγξτε τη σύνδεση στο διαδίκτυο εάν δεν ξεκινά. + τρέχουσα επιλογή σημείου:\n + Αναμένεται επιλογή σημείου\n + Εναλλακτική + έκδοση = BRouter-%1$s \n + μνήμη = %2$s \n + απόσταση = %3$s km\n + φιλτραρισμένη άνοδος = %4$s m\n + απλή άνοδος = %5$s m\n + εκτιμώμενος χρόνος = %6$s + Σφάλμα ανάγνωσης σημείων + η πηγή συντεταγμένων δεν περιέχει σημεία! + η πηγή συντεταγμένων περιέχει πάρα πολλά σημεία: %1$d (παρακαλώ χρησιμοποιήστε από/προς/μέσω ονόματα) + + No + Yes + + Confirm Delete + Really delete? + Version Problem + The base version for tiles has changed. What to do? + Continue with current download, delete other old data + Select all for download and start + Cancel now, complete on an other day + Version Differences + The base version for some tiles is different. What to do? + Download all different tiles + Drop all different tiles + Cancel now, complete on an other day + The new data version needs a new app. Please update BRouter first + + Download failed + Download cancelled + Download succeeded diff --git a/brouter-routing-app/src/main/res/values-es/strings.xml b/brouter-routing-app/src/main/res/values-es/strings.xml index 4fe540e..6570697 100644 --- a/brouter-routing-app/src/main/res/values-es/strings.xml +++ b/brouter-routing-app/src/main/res/values-es/strings.xml @@ -14,59 +14,79 @@ Tamaño=%1$s\nGratis=%2$s Descargar segmentos - Choose brouter data base dir: - Select a routing profile - Select Main Action - Download Manager - BRouter App + Seleccionar directorio base brouter: + Seleccionar un perfil de enrutamiento + Seleccionar Acción Principal + Gestor de Descargas + App BRouter - Cancel - I know - Close - Exit + Cancelar + Lo se + Cerrar + Salir OK - Success - An Error occurred + Salir + Ha aparecido un error - BRouter Download Manager - *** Attention:*** - \n\nThe Download Manager is used to download routing-data - files which can be up to 170MB each. Do not start the Download Manager - on a cellular data connection without a data plan! - Download speed is restricted to 16 MBit/s. - Successfully prepared a timeout-free calculation - You successfully repeated a calculation that previously run into a timeout - when started from your map-tool. If you repeat the same request from your - maptool, with the exact same destination point and a close-by starting point, - this request is guaranteed not to time out. - Enter SDCARD base dir: - Select Action + Gestor de descargas BRouter + *** Atención:*** + \n\nEl Gestor de Descargas se usa para descargar ficheros de datos + de ruta, que pueden llegar a los 170 Mb cada uno. No inicies el Gestor + desde un terminal sin plan de datos! + La velocidad de descarga está limitada a 16 Mbit/s. + Se ha preparado correctamente un cálculo sin límite de tiempo + Se ha repetido un cálculo a través de la aplicación de mapas que previamente + había superado el tiempo de espera. Si repites la misma petición con exactamente el mismo destino y un punto de partida cercano, + se garantiza que la petición no agotará el límite de tiempo. + Introduce el directorio base de la tarjeta SD: + Seleccionar Acción - Check VIA Selection: - Check NoGo Selection: - Server-Mode + Comprobar Selección VIA: + Comprobar Selección NoGo: + Modo-Servidor Info - Calc Route - Profile Settings - Share GPX - Select from - Select to/via + Calc Ruta + Ajustes del perfil + Compartir GPX + Seleccionar desde + Seleccionar a/vía - no profile data - , no used profile - Too much data for download. Please reduce. - Download scheduled. Check internet connection if it doesn\'t start. - current waypoint selection:\n - Expecting waypoint selection\n - Alternative - version = BRouter-%1$s \n - mem = %2$s \n - distance = %3$s km\n - filtered ascend = %4$s m\n - plain ascend = %5$s m\n - estimated time = %6$s - Error reading waypoints - coordinate source does not contain any waypoints! - coordinate source contains too much waypoints: %1$d (please use from/to/via names) + no hay datos en el perfil + , ningún perfil utilizado + Demasiados datos a descargar. Por favor, reducidlos. + Descarga programada. Comprueba la conexión a internet si no se inicia. + selección actual de waypoint:\n + Esperando selección de waypoint\n + Alternativa + versión = BRouter-%1$s \n + memoria = %2$s \n + distancia = %3$s km\n + ascensión filtrada = %4$s m\n + ascensión en llano = %5$s m\n + tiempo estimado = %6$s + Error leyendo waypoints + la fuente de coordenadas no contiene ningún waypoint! + la fuente de coordenadas contiene demasiados waypoints: %1$d (por favor, usa nombres desde/a/vía) + + No + Yes + + Confirm Delete + Really delete? + Version Problem + The base version for tiles has changed. What to do? + Continue with current download, delete other old data + Select all for download and start + Cancel now, complete on an other day + Version Differences + The base version for some tiles is different. What to do? + Download all different tiles + Drop all different tiles + Cancel now, complete on an other day + The new data version needs a new app. Please update BRouter first + + Download failed + Download cancelled + Download succeeded diff --git a/brouter-routing-app/src/main/res/values-fr/strings.xml b/brouter-routing-app/src/main/res/values-fr/strings.xml index 58f0f56..be54330 100644 --- a/brouter-routing-app/src/main/res/values-fr/strings.xml +++ b/brouter-routing-app/src/main/res/values-fr/strings.xml @@ -14,59 +14,80 @@ Taille=%1$s\nGratuit=%2$s Télécharger les segments - Choose brouter data base dir: - Select a routing profile - Select Main Action - Download Manager - BRouter App + Choisissez le répertoire de la base de données brouter: + Sélectionnez un profil de routage + Sélectionner l\'action principale + Gestionnaire de téléchargement + Application BRouter - Cancel - I know - Close - Exit + Annuler + Je sais + Fermer + Quitter OK - Success - An Error occurred + Succès + Une erreur s\'est produite - BRouter Download Manager - *** Attention:*** - \n\nThe Download Manager is used to download routing-data - files which can be up to 170MB each. Do not start the Download Manager - on a cellular data connection without a data plan! - Download speed is restricted to 16 MBit/s. - Successfully prepared a timeout-free calculation - You successfully repeated a calculation that previously run into a timeout - when started from your map-tool. If you repeat the same request from your - maptool, with the exact same destination point and a close-by starting point, - this request is guaranteed not to time out. - Enter SDCARD base dir: - Select Action + Gestionnaire de téléchargement BRouter + *** Attention :*** + \n\nLe gestionnaire de téléchargement est utilisé pour télécharger les données de routage + fichiers pouvant atteindre 170MB chacun. Ne démarrez pas le gestionnaire de téléchargement + sur une connexion de données cellulaires sans forfait de données ! + La vitesse de téléchargement est limitée à 16 MBit/s. + Préparation réussie d\'un calcul sans délai d\'attente + Vous avez répété avec succès un calcul qui avait précédemment expiré + lorsqu\'il est démarré à partir de votre outil cartographique. Si vous répétez la même demande de votre + maptool, avec exactement le même point de destination et un point de départ à proximité, + il est garanti que cette requête n\'expirera pas. + Entrez le répertoire de base de la SDCARD: + Sélectionner une action - Check VIA Selection: - Check NoGo Selection: - Server-Mode - Info - Calc Route - Profile Settings - Share GPX - Select from - Select to/via + Vérifier la sélection VIA: + Vérifier la sélection NoGo: + Mode serveur + Informations + Calculer l\'itinéraire + Paramètres du profil + Partager GPX + Sélectionner de + Sélectionner vers/via - no profile data - , no used profile - Too much data for download. Please reduce. - Download scheduled. Check internet connection if it doesn\'t start. - current waypoint selection:\n - Expecting waypoint selection\n + aucune donnée de profil + , aucun profil utilisé + Trop de données à télécharger. Veuillez réduire. + Téléchargement planifié. Vérifiez la connexion Internet si elle ne démarre pas. + sélection actuelle du waypoint:\n + Sélection de waypoint en attente\n Alternative version = BRouter-%1$s \n - mem = %2$s \n + mémoire = %2$s \n distance = %3$s km\n - filtered ascend = %4$s m\n - plain ascend = %5$s m\n - estimated time = %6$s - Error reading waypoints - coordinate source does not contain any waypoints! - coordinate source contains too much waypoints: %1$d (please use from/to/via names) + montée filtrée = %4$s m\n + montée simple = %5$s m\n + temps estimé = %6$s + Erreur lors de la lecture des waypoints + la source de coordonnées ne contient aucun waypoint! + la source de coordonnées contient trop de waypoints: %1$d (veuillez utiliser les noms de/vers/via) + + No + Yes + + Confirm Delete + Really delete? + Version Problem + The base version for tiles has changed. What to do? + Continue with current download, delete other old data + Select all for download and start + Cancel now, complete on an other day + Version Differences + The base version for some tiles is different. What to do? + Download all different tiles + Drop all different tiles + Cancel now, complete on an other day + The new data version needs a new app. Please update BRouter first + + Download failed + Download cancelled + Download succeeded diff --git a/brouter-routing-app/src/main/res/values-it/strings.xml b/brouter-routing-app/src/main/res/values-it/strings.xml index c9e56a5..298978b 100644 --- a/brouter-routing-app/src/main/res/values-it/strings.xml +++ b/brouter-routing-app/src/main/res/values-it/strings.xml @@ -14,59 +14,80 @@ Taglia=%1$s\nGratis=%2$s Scarica segmenti - Choose brouter data base dir: - Select a routing profile - Select Main Action - Download Manager - BRouter App + Seleziona la directory del database brouter: + Seleziona un profilo di instradamento + Seleziona azione principale + Gestore dei download + Applicazione BRouter - Cancel - I know - Close - Exit + Annulla + Lo so + Chiudi + Esci OK - Success - An Error occurred + Successo + Si è verificato un errore - BRouter Download Manager - *** Attention:*** - \n\nThe Download Manager is used to download routing-data - files which can be up to 170MB each. Do not start the Download Manager - on a cellular data connection without a data plan! - Download speed is restricted to 16 MBit/s. - Successfully prepared a timeout-free calculation - You successfully repeated a calculation that previously run into a timeout - when started from your map-tool. If you repeat the same request from your - maptool, with the exact same destination point and a close-by starting point, - this request is guaranteed not to time out. - Enter SDCARD base dir: - Select Action + Gestore download BRouter + *** Attenzione:*** + \n\nIl Download Manager viene utilizzato per scaricare i dati di routing + file che possono pesare fino a 170 MB ciascuno. Non avviare il Download Manager + su una connessione dati cellulare senza un piano dati! + La velocità di download è limitata a 16 MBit/s. + Preparato con successo un calcolo senza timeout + Hai ripetuto con successo un calcolo che in precedenza era terminato con un timeout + quando avviato dal tuo strumento mappa. Se ripeti la stessa richiesta dal tuo + maptool, con lo stesso identico punto di destinazione e un punto di partenza vicino, + è garantito che questa richiesta non vada in timeout. + Inserisci la directory base della SDCARD: + Seleziona azione - Check VIA Selection: - Check NoGo Selection: - Server-Mode - Info - Calc Route - Profile Settings - Share GPX - Select from - Select to/via + Controlla la selezione VIA: + Controlla la selezione NoGo: + Modalità server + Informazioni + Calcola percorso + Impostazioni profilo + Condividi GPX + Seleziona da + Seleziona a/via - no profile data - , no used profile - Too much data for download. Please reduce. - Download scheduled. Check internet connection if it doesn\'t start. - current waypoint selection:\n - Expecting waypoint selection\n - Alternative - version = BRouter-%1$s \n - mem = %2$s \n - distance = %3$s km\n - filtered ascend = %4$s m\n - plain ascend = %5$s m\n - estimated time = %6$s - Error reading waypoints - coordinate source does not contain any waypoints! - coordinate source contains too much waypoints: %1$d (please use from/to/via names) + nessun dato del profilo + , nessun profilo utilizzato + Troppi dati per il download. Per favore riduci. + Download programmato. Controlla la connessione Internet se non si avvia. + selezione del waypoint corrente:\n + Attesa selezione waypoint\n + Alternativa + versione = BRouter-%1$s \n + memoria = %2$s \n + distanza = %3$s km\n + salita filtrata = %4$s m\n + salita semplice = %5$s m\n + tempo stimato = %6$s + Errore durante la lettura dei waypoint + la fonte delle coordinate non contiene alcun waypoint! + la fonte delle coordinate contiene troppi waypoint: %1$d (usa i nomi da/a/via) + + No + Yes + + Confirm Delete + Really delete? + Version Problem + The base version for tiles has changed. What to do? + Continue with current download, delete other old data + Select all for download and start + Cancel now, complete on an other day + Version Differences + The base version for some tiles is different. What to do? + Download all different tiles + Drop all different tiles + Cancel now, complete on an other day + The new data version needs a new app. Please update BRouter first + + Download failed + Download cancelled + Download succeeded diff --git a/brouter-routing-app/src/main/res/values-nl/strings.xml b/brouter-routing-app/src/main/res/values-nl/strings.xml index 2b58d1d..7d05ca9 100644 --- a/brouter-routing-app/src/main/res/values-nl/strings.xml +++ b/brouter-routing-app/src/main/res/values-nl/strings.xml @@ -14,59 +14,74 @@ Grootte=%1$s\nGratis=%2$s Segmenten downloaden - Choose brouter data base dir: - Select a routing profile - Select Main Action - Download Manager + Kies de brouter database map: + Selecteer een routingprofiel + Selecteer de hoofdactie + Download beheerder BRouter App - Cancel - I know - Close - Exit + Annuleer + Ik weet het + Sluiten + Verlaat OK - Success - An Error occurred + Succes + Er is een fout opgetreden BRouter Download Manager - *** Attention:*** - \n\nThe Download Manager is used to download routing-data - files which can be up to 170MB each. Do not start the Download Manager - on a cellular data connection without a data plan! - Download speed is restricted to 16 MBit/s. - Successfully prepared a timeout-free calculation - You successfully repeated a calculation that previously run into a timeout - when started from your map-tool. If you repeat the same request from your - maptool, with the exact same destination point and a close-by starting point, - this request is guaranteed not to time out. - Enter SDCARD base dir: - Select Action + *** OPgelet:*** + \n\nDe Download Manager wordt gebruikt voor het downloaden van routing-gegevens bestanden die elk maximaal 170 MB groot kunnen zijn. Start de Download Manager niet op een mobiele dataverbinding zonder data-abonnement! De downloadsnelheid is beperkt tot 16 MBit/s. + Een time-outvrije berekening is succesvol voorbereid + Je hebt met succes een berekening herhaald die eerder op een time-out stuitte toen deze vanuit je map-tool werd gestart. Als u hetzelfde verzoek herhaalt vanuit uw maptool, met exact hetzelfde bestemmingspunt en een dichtbijgelegen beginpunt zal deze aanvraag gegarandeerd geen time-out krijgen. + De SDCARD basis directory invoeren: + Actie selecteren - Check VIA Selection: - Check NoGo Selection: - Server-Mode + Controleer de VIA selectie: + Controleer de NoGo selectie: + Server-mode Info - Calc Route - Profile Settings - Share GPX - Select from - Select to/via + Bereken route + Profiel instellingen + GPX delen + Selecteer van + Selecteer naar/via - no profile data - , no used profile - Too much data for download. Please reduce. - Download scheduled. Check internet connection if it doesn\'t start. - current waypoint selection:\n - Expecting waypoint selection\n - Alternative - version = BRouter-%1$s \n - mem = %2$s \n - distance = %3$s km\n - filtered ascend = %4$s m\n - plain ascend = %5$s m\n - estimated time = %6$s - Error reading waypoints - coordinate source does not contain any waypoints! - coordinate source contains too much waypoints: %1$d (please use from/to/via names) + geen profiel data + , geen gebruikt profiel + Te veel gegevens om te downloaden. Verminder a.u.b. + Download is gepland. Controleer de internetverbinding als deze niet start. + huidige waypointselectie:\n + Verwacht waypointselectie\n + Alternatief + versie = BRouter-%1$s \n + geheugen = %2$s \n + afstand = %3$s km\n + gefilterde opstijging = %4$s m\n + simpel opstijging = %5$s m\n + geschatte tijd = %6$s + Fout bij het lezen van waypoints + coördinaten bron bevat geen waypoints! + De coördinatenbron bevat te veel waypoints: %1$d (gebruik van/naar/via namen) + + No + Yes + + Confirm Delete + Really delete? + Version Problem + The base version for tiles has changed. What to do? + Continue with current download, delete other old data + Select all for download and start + Cancel now, complete on an other day + Version Differences + The base version for some tiles is different. What to do? + Download all different tiles + Drop all different tiles + Cancel now, complete on an other day + The new data version needs a new app. Please update BRouter first + + Download failed + Download cancelled + Download succeeded diff --git a/brouter-routing-app/src/main/res/values-pl/strings.xml b/brouter-routing-app/src/main/res/values-pl/strings.xml index 4ad50c0..6bca420 100644 --- a/brouter-routing-app/src/main/res/values-pl/strings.xml +++ b/brouter-routing-app/src/main/res/values-pl/strings.xml @@ -14,59 +14,80 @@ Rozmiar=%1$s\nDostępne=%2$s Pobieranie segmentów - Choose brouter data base dir: - Select a routing profile - Select Main Action - Download Manager - BRouter App + Wybierz katalog bazy danych BRoutera: + Wybierz profil routingu + Wybierz akcję główną + Menedżer pobierania + Aplikacja BRouter - Cancel - I know - Close - Exit + Anuluj + Rozumiem + Zamknij + Wyjdź OK - Success - An Error occurred + Sukces + Wystąpił błąd - BRouter Download Manager - *** Attention:*** - \n\nThe Download Manager is used to download routing-data - files which can be up to 170MB each. Do not start the Download Manager - on a cellular data connection without a data plan! - Download speed is restricted to 16 MBit/s. - Successfully prepared a timeout-free calculation - You successfully repeated a calculation that previously run into a timeout - when started from your map-tool. If you repeat the same request from your - maptool, with the exact same destination point and a close-by starting point, - this request is guaranteed not to time out. - Enter SDCARD base dir: - Select Action + Menedżer pobierania BRoutera + *** Uwaga: *** + \n\nMenedżer pobierania służy do pobierania plików danych routingu, + które mogą mieć do 170 MB każdy. Nie uruchamiaj Menedżera pobierania, + jeżeli korzystasz z komórkowej transmisji danych bez planu taryfowego! + Prędkość pobierania jest ograniczona do 16 MBit/s. + Pomyślnie przygotowano obliczenia nie przekraczając limitu czasu + Pomyślnie powtórzono obliczenia, które wcześniej przekroczyły limit czasu + po uruchomieniu z narzędzia mapowego. Jeśli powtórzysz to samo żądanie ze swojego + narzędzia mapowego, z dokładnie tym samym punktem docelowym i pobliskim punktem początkowym, + gwarantuję, że to żądanie nie przekroczy limitu czasu. + Wybierz katalog SDCARD dla bazy: + Wybierz akcję - Check VIA Selection: - Check NoGo Selection: - Server-Mode - Info - Calc Route - Profile Settings - Share GPX - Select from - Select to/via + Sprawdź wybór VIA: + Sprawdź wybór NoGo: + Tryb serwera + Informacje + Oblicz trasę + Ustawienia profilu + Udostępnij GPX + Wybierz z + Wybierz do/przez - no profile data - , no used profile - Too much data for download. Please reduce. - Download scheduled. Check internet connection if it doesn\'t start. - current waypoint selection:\n - Expecting waypoint selection\n - Alternative - version = BRouter-%1$s \n - mem = %2$s \n - distance = %3$s km\n - filtered ascend = %4$s m\n - plain ascend = %5$s m\n - estimated time = %6$s - Error reading waypoints - coordinate source does not contain any waypoints! - coordinate source contains too much waypoints: %1$d (please use from/to/via names) + brak danych profilu + , brak używanego profilu + Za dużo danych do pobrania. Proszę ogranicz. + Pobieranie zaplanowane. Jeśli się nie rozpocznie, sprawdź połączenie internetowe. + bieżący wybór punktu trasy:\n + Oczekuję na wybór punktu trasy\n + Alternatywa + wersja = BRouter-%1$s \n + pamięć = %2$s \n + odległość = %3$s km\n + filtrowane wznoszenie = %4$sm\n + zwykłe wznoszenie = %5$sm\n + szacowany czas = %6$s + Błąd podczas odczytu punktów trasy + Źródło współrzędnych nie zawiera żadnych punktów trasy! + Źródło współrzędnych zawiera zbyt dużo punktów trasy: %1$d (proszę używać nazw z/do/przez) + + No + Yes + + Confirm Delete + Really delete? + Version Problem + The base version for tiles has changed. What to do? + Continue with current download, delete other old data + Select all for download and start + Cancel now, complete on an other day + Version Differences + The base version for some tiles is different. What to do? + Download all different tiles + Drop all different tiles + Cancel now, complete on an other day + The new data version needs a new app. Please update BRouter first + + Download failed + Download cancelled + Download succeeded diff --git a/brouter-routing-app/src/main/res/values/strings.xml b/brouter-routing-app/src/main/res/values/strings.xml index 3a08420..ad2e783 100644 --- a/brouter-routing-app/src/main/res/values/strings.xml +++ b/brouter-routing-app/src/main/res/values/strings.xml @@ -69,4 +69,26 @@ coordinate source does not contain any waypoints! coordinate source contains too much waypoints: %1$d (please use from/to/via names) + No + Yes + + Confirm Delete + Really delete? + Version Problem + The base version for tiles has changed. What to do? + Continue with current download, delete other old data + Select all for download and start + Cancel now, complete on an other day + Version Differences + The base version for some tiles is different. What to do? + Download all different tiles + Drop all different tiles + Cancel now, complete on an other day + The new data version needs a new app. Please update BRouter first + + Download failed + Download cancelled + Download succeeded + + From e918700bca1898947372006382b2408744e26718 Mon Sep 17 00:00:00 2001 From: afischerdev Date: Thu, 14 Dec 2023 12:01:29 +0100 Subject: [PATCH 20/30] added new message and rename msg --- .../src/main/java/btools/routingapp/BInstallerActivity.java | 4 ++-- brouter-routing-app/src/main/res/values-ar/strings.xml | 3 ++- brouter-routing-app/src/main/res/values-ca/strings.xml | 3 ++- brouter-routing-app/src/main/res/values-de/strings.xml | 3 ++- brouter-routing-app/src/main/res/values-el/strings.xml | 3 ++- brouter-routing-app/src/main/res/values-es/strings.xml | 3 ++- brouter-routing-app/src/main/res/values-fr/strings.xml | 3 ++- brouter-routing-app/src/main/res/values-it/strings.xml | 3 ++- brouter-routing-app/src/main/res/values-nl/strings.xml | 3 ++- brouter-routing-app/src/main/res/values-pl/strings.xml | 3 ++- brouter-routing-app/src/main/res/values/strings.xml | 3 ++- 11 files changed, 22 insertions(+), 12 deletions(-) diff --git a/brouter-routing-app/src/main/java/btools/routingapp/BInstallerActivity.java b/brouter-routing-app/src/main/java/btools/routingapp/BInstallerActivity.java index 7ceac35..5d375d6 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/BInstallerActivity.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/BInstallerActivity.java @@ -279,7 +279,7 @@ public class BInstallerActivity extends AppCompatActivity { String segmentName = progress.getString(DownloadWorker.PROGRESS_SEGMENT_NAME); int percent = progress.getInt(DownloadWorker.PROGRESS_SEGMENT_PERCENT, 0); if (percent > 0) { - mDownloadSummaryInfo.setText("Downloading .. " + segmentName); + mDownloadSummaryInfo.setText(getString(R.string.msg_download_started) + segmentName); } if (percent > 0) { mProgressIndicator.setIndeterminate(false); @@ -295,7 +295,7 @@ public class BInstallerActivity extends AppCompatActivity { String result; switch (workInfo.getState()) { case FAILED: - result = getString(R.string.msg_download_faild); + result = getString(R.string.msg_download_failed); break; case CANCELLED: result = getString(R.string.msg_download_cancel); diff --git a/brouter-routing-app/src/main/res/values-ar/strings.xml b/brouter-routing-app/src/main/res/values-ar/strings.xml index 74679da..b447e67 100644 --- a/brouter-routing-app/src/main/res/values-ar/strings.xml +++ b/brouter-routing-app/src/main/res/values-ar/strings.xml @@ -86,8 +86,9 @@ Cancel now, complete on an other day The new data version needs a new app. Please update BRouter first - Download failed + Download failed Download cancelled Download succeeded + "Downloading .. " diff --git a/brouter-routing-app/src/main/res/values-ca/strings.xml b/brouter-routing-app/src/main/res/values-ca/strings.xml index 3ebbf3e..0272aba 100644 --- a/brouter-routing-app/src/main/res/values-ca/strings.xml +++ b/brouter-routing-app/src/main/res/values-ca/strings.xml @@ -85,8 +85,9 @@ Cancel now, complete on an other day The new data version needs a new app. Please update BRouter first - Download failed + Download failed Download cancelled Download succeeded + "Downloading .. " diff --git a/brouter-routing-app/src/main/res/values-de/strings.xml b/brouter-routing-app/src/main/res/values-de/strings.xml index 9a7bed9..1c7e0b9 100644 --- a/brouter-routing-app/src/main/res/values-de/strings.xml +++ b/brouter-routing-app/src/main/res/values-de/strings.xml @@ -86,8 +86,9 @@ Cancel now, complete on an other day The new data version needs a new app. Please update BRouter first - Download failed + Download failed Download cancelled Download succeeded + "Downloading .. " diff --git a/brouter-routing-app/src/main/res/values-el/strings.xml b/brouter-routing-app/src/main/res/values-el/strings.xml index 742b9a3..a1f2c68 100644 --- a/brouter-routing-app/src/main/res/values-el/strings.xml +++ b/brouter-routing-app/src/main/res/values-el/strings.xml @@ -86,8 +86,9 @@ Cancel now, complete on an other day The new data version needs a new app. Please update BRouter first - Download failed + Download failed Download cancelled Download succeeded + "Downloading .. " diff --git a/brouter-routing-app/src/main/res/values-es/strings.xml b/brouter-routing-app/src/main/res/values-es/strings.xml index 6570697..7dc62e7 100644 --- a/brouter-routing-app/src/main/res/values-es/strings.xml +++ b/brouter-routing-app/src/main/res/values-es/strings.xml @@ -85,8 +85,9 @@ Cancel now, complete on an other day The new data version needs a new app. Please update BRouter first - Download failed + Download failed Download cancelled Download succeeded + "Downloading .. " diff --git a/brouter-routing-app/src/main/res/values-fr/strings.xml b/brouter-routing-app/src/main/res/values-fr/strings.xml index be54330..c04ed1b 100644 --- a/brouter-routing-app/src/main/res/values-fr/strings.xml +++ b/brouter-routing-app/src/main/res/values-fr/strings.xml @@ -86,8 +86,9 @@ Cancel now, complete on an other day The new data version needs a new app. Please update BRouter first - Download failed + Download failed Download cancelled Download succeeded + "Downloading .. " diff --git a/brouter-routing-app/src/main/res/values-it/strings.xml b/brouter-routing-app/src/main/res/values-it/strings.xml index 298978b..a459048 100644 --- a/brouter-routing-app/src/main/res/values-it/strings.xml +++ b/brouter-routing-app/src/main/res/values-it/strings.xml @@ -86,8 +86,9 @@ Cancel now, complete on an other day The new data version needs a new app. Please update BRouter first - Download failed + Download failed Download cancelled Download succeeded + "Downloading .. " diff --git a/brouter-routing-app/src/main/res/values-nl/strings.xml b/brouter-routing-app/src/main/res/values-nl/strings.xml index 7d05ca9..a1806b1 100644 --- a/brouter-routing-app/src/main/res/values-nl/strings.xml +++ b/brouter-routing-app/src/main/res/values-nl/strings.xml @@ -80,8 +80,9 @@ Cancel now, complete on an other day The new data version needs a new app. Please update BRouter first - Download failed + Download failed Download cancelled Download succeeded + "Downloading .. " diff --git a/brouter-routing-app/src/main/res/values-pl/strings.xml b/brouter-routing-app/src/main/res/values-pl/strings.xml index 6bca420..bf0c8be 100644 --- a/brouter-routing-app/src/main/res/values-pl/strings.xml +++ b/brouter-routing-app/src/main/res/values-pl/strings.xml @@ -86,8 +86,9 @@ Cancel now, complete on an other day The new data version needs a new app. Please update BRouter first - Download failed + Download failed Download cancelled Download succeeded + "Downloading .. " diff --git a/brouter-routing-app/src/main/res/values/strings.xml b/brouter-routing-app/src/main/res/values/strings.xml index ad2e783..74e54d0 100644 --- a/brouter-routing-app/src/main/res/values/strings.xml +++ b/brouter-routing-app/src/main/res/values/strings.xml @@ -86,9 +86,10 @@ Cancel now, complete on an other day The new data version needs a new app. Please update BRouter first - Download failed + Download failed Download cancelled Download succeeded + "Downloading .. " From de70dec44a5ca60c4ed52946a340a49f32153991 Mon Sep 17 00:00:00 2001 From: Emux Date: Thu, 14 Dec 2023 18:46:25 +0200 Subject: [PATCH 21/30] Fix some Lint issues --- .../src/main/java/btools/mapaccess/WaypointMatcherImpl.java | 2 +- .../src/main/java/btools/routingapp/BRouterService.java | 1 + .../src/main/java/btools/routingapp/BRouterWorker.java | 1 + brouter-util/src/main/java/btools/util/CompactLongMap.java | 2 ++ brouter-util/src/main/java/btools/util/SortedHeap.java | 1 + 5 files changed, 6 insertions(+), 1 deletion(-) diff --git a/brouter-mapaccess/src/main/java/btools/mapaccess/WaypointMatcherImpl.java b/brouter-mapaccess/src/main/java/btools/mapaccess/WaypointMatcherImpl.java index e70d3be..85ab9b5 100644 --- a/brouter-mapaccess/src/main/java/btools/mapaccess/WaypointMatcherImpl.java +++ b/brouter-mapaccess/src/main/java/btools/mapaccess/WaypointMatcherImpl.java @@ -51,7 +51,7 @@ public final class WaypointMatcherImpl implements WaypointMatcher { } // sort result list - comparator = new Comparator<>() { + comparator = new Comparator() { @Override public int compare(MatchedWaypoint mw1, MatchedWaypoint mw2) { int cmpDist = Double.compare(mw1.radius, mw2.radius); diff --git a/brouter-routing-app/src/main/java/btools/routingapp/BRouterService.java b/brouter-routing-app/src/main/java/btools/routingapp/BRouterService.java index 90b875c..1bb72af 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/BRouterService.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/BRouterService.java @@ -271,6 +271,7 @@ public class BRouterService extends Service { } } + @SuppressWarnings("deprecation") private void logBundle(Bundle params) { if (AppLogger.isLogging()) { for (String k : params.keySet()) { diff --git a/brouter-routing-app/src/main/java/btools/routingapp/BRouterWorker.java b/brouter-routing-app/src/main/java/btools/routingapp/BRouterWorker.java index 64e73d5..f7a74ff 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/BRouterWorker.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/BRouterWorker.java @@ -36,6 +36,7 @@ public class BRouterWorker { public List nogoPolygonsList; public String profileParams; + @SuppressWarnings("deprecation") public String getTrackFromParams(Bundle params) { int engineMode = 0; diff --git a/brouter-util/src/main/java/btools/util/CompactLongMap.java b/brouter-util/src/main/java/btools/util/CompactLongMap.java index b29d83a..49efc08 100644 --- a/brouter-util/src/main/java/btools/util/CompactLongMap.java +++ b/brouter-util/src/main/java/btools/util/CompactLongMap.java @@ -224,6 +224,7 @@ public class CompactLongMap { // does sorted array "a" contain "id" ? + @SuppressWarnings("unchecked") private boolean contains(int idx, long id, boolean doPut) { long[] a = al[idx]; int offset = a.length; @@ -243,6 +244,7 @@ public class CompactLongMap { return false; } + @SuppressWarnings("unchecked") protected void moveToFrozenArrays(long[] faid, List flv) { for (int i = 1; i < MAXLISTS; i++) { pa[i] = 0; diff --git a/brouter-util/src/main/java/btools/util/SortedHeap.java b/brouter-util/src/main/java/btools/util/SortedHeap.java index 3f2c4f1..b350d63 100644 --- a/brouter-util/src/main/java/btools/util/SortedHeap.java +++ b/brouter-util/src/main/java/btools/util/SortedHeap.java @@ -19,6 +19,7 @@ public final class SortedHeap { /** * @return the lowest key value, or null if none */ + @SuppressWarnings("unchecked") public V popLowestKeyValue() { SortedBin bin = firstNonEmpty; if (firstNonEmpty == null) { From a70c95c57656e6e48f4af6a137a48b79ae1fbea2 Mon Sep 17 00:00:00 2001 From: afischerdev Date: Thu, 14 Dec 2023 17:50:14 +0100 Subject: [PATCH 22/30] added translation for new messages and fixes --- .../src/main/res/values-ar/strings.xml | 38 +++++++++--------- .../src/main/res/values-ca/strings.xml | 36 ++++++++--------- .../src/main/res/values-de/strings.xml | 40 +++++++++---------- .../src/main/res/values-el/strings.xml | 38 +++++++++--------- .../src/main/res/values-es/strings.xml | 36 ++++++++--------- .../src/main/res/values-fr/strings.xml | 38 +++++++++--------- .../src/main/res/values-it/strings.xml | 36 ++++++++--------- .../src/main/res/values-nl/strings.xml | 38 +++++++++--------- .../src/main/res/values-pl/strings.xml | 38 +++++++++--------- .../src/main/res/values/strings.xml | 6 +-- 10 files changed, 172 insertions(+), 172 deletions(-) diff --git a/brouter-routing-app/src/main/res/values-ar/strings.xml b/brouter-routing-app/src/main/res/values-ar/strings.xml index b447e67..8759f4a 100644 --- a/brouter-routing-app/src/main/res/values-ar/strings.xml +++ b/brouter-routing-app/src/main/res/values-ar/strings.xml @@ -69,26 +69,26 @@ لا يحتوي مصدر الإحداثيات على أي نقاط الطريق! مصدر الإحداثيات يحتوي على عدد كبير جدًا من نقاط الطريق: %1$d (يرجى استخدام أسماء النقاط من/إلى/عبر from/to/via) - No - Yes + لا + نعم - Confirm Delete - Really delete? - Version Problem - The base version for tiles has changed. What to do? - Continue with current download, delete other old data - Select all for download and start - Cancel now, complete on an other day - Version Differences - The base version for some tiles is different. What to do? - Download all different tiles - Drop all different tiles - Cancel now, complete on an other day - The new data version needs a new app. Please update BRouter first + تأكيد الحذف + هل ترغب بالحذف؟ + مشكلة في الإصدار + لقد تغير الإصدار الأساسي للصور المتجانبة، ما الإجراء المناسب لفعله؟ + متابعة التنزيل الحالي، وحذف البيانات الأخرى القديمة + تحديد الكل للتنزيل والبدء + قم بالإلغاء في الوقت الحالي، واستكمله لاحقاً + اختلافات الإصدارات + الإصدار الأساسي لبعض الصور المتجانبة مختلف. ما الإجراء المناسب لفعله؟ + تحميل المختلف من الصور المتجانبة + حذف كل الصور المتجانبة المختلفة عن الأخرى + قم بالإلغاء في الوقت الحالي، واستكمله لاحقاً + يحتاج إصدار البيانات الجديد إلى وجود التطبيق الجديد، لذا نرجوا منك تحديث BRouter أولاً - Download failed - Download cancelled - Download succeeded - "Downloading .. " + فشل التنزيل + تم إلغاء التنزيل + تم التنزيل بنجاح + جار التنزيل… diff --git a/brouter-routing-app/src/main/res/values-ca/strings.xml b/brouter-routing-app/src/main/res/values-ca/strings.xml index 0272aba..6f2e8cf 100644 --- a/brouter-routing-app/src/main/res/values-ca/strings.xml +++ b/brouter-routing-app/src/main/res/values-ca/strings.xml @@ -69,25 +69,25 @@ la font de coordenades conté massa fites: %1$d (si us plau, fes servir noms des de/a/via) No - Yes + Si - Confirm Delete - Really delete? - Version Problem - The base version for tiles has changed. What to do? - Continue with current download, delete other old data - Select all for download and start - Cancel now, complete on an other day - Version Differences - The base version for some tiles is different. What to do? - Download all different tiles - Drop all different tiles - Cancel now, complete on an other day - The new data version needs a new app. Please update BRouter first + Confirmar Eliminar + Voleu realment eliminar? + Problema de versió + La versió base per les tesel·les ha canviat. Què vols fer? + Continuar amb la baixada, eliminar altres dades antigues + Seleccionar-ho tot per baixar i iniciar + Cancel·lar ara, completar un altre dia + Diferències de Versió + La versió base de diverses tesel·les és diferent. Què vols fer? + Baixar totes les tesel·les diferents + Descartar les tesel·les diferents + Cancel·lar ara, completar un altre dia + La nova versió de dades necessita una aplicació nova. Sisplau, actualitza BRouter primer - Download failed - Download cancelled - Download succeeded - "Downloading .. " + Baixada fallida + Baixada cancel·lada + Baixada exitosa + Baixant… diff --git a/brouter-routing-app/src/main/res/values-de/strings.xml b/brouter-routing-app/src/main/res/values-de/strings.xml index 1c7e0b9..902aa4d 100644 --- a/brouter-routing-app/src/main/res/values-de/strings.xml +++ b/brouter-routing-app/src/main/res/values-de/strings.xml @@ -63,32 +63,32 @@ Speicher = %2$s \n Abstand = %3$s km\n gefilterter Aufstieg = %4$s m\n - schlichter Aufstieg = %5$s m\n + flacher Aufstieg = %5$s m\n geschätzte Zeit = %6$s Fehler beim Lesen von Wegpunkten Die Koordinatenquelle enthält keine Wegpunkte! Die Koordinatenquelle enthält zu viele Wegpunkte: %1$d (bitte von/nach/via-Namen verwenden) - No - Yes + Nein + Ja - Confirm Delete - Really delete? - Version Problem - The base version for tiles has changed. What to do? - Continue with current download, delete other old data - Select all for download and start - Cancel now, complete on an other day - Version Differences - The base version for some tiles is different. What to do? - Download all different tiles - Drop all different tiles - Cancel now, complete on an other day - The new data version needs a new app. Please update BRouter first + Löschen bestätigen + Wirklich löschen? + Versionsproblem + Die Datenversion der Kacheln hat sich geändert. Bitte auswählen: + Download fortsetzen und alte Daten löschen? + Alle auswählen und Download starten + Abbrechen und später fortsetzen + Versionskonflikt + Die Datenversion für einige Kacheln ist unterschiedlich. Bitte auswählen: + Download alle unterschiedlichen Kacheln + Überspringe alle unterschiedlichen Kacheln + Abbrechen und später fortsetzen + Die neue Datenversion verlangt ein BRouter-Update. Bitte aktualisieren - Download failed - Download cancelled - Download succeeded - "Downloading .. " + Download fehlgeschlagen + Download abgebrochen + Download erfolgreich + Download läuft… diff --git a/brouter-routing-app/src/main/res/values-el/strings.xml b/brouter-routing-app/src/main/res/values-el/strings.xml index a1f2c68..4f2578e 100644 --- a/brouter-routing-app/src/main/res/values-el/strings.xml +++ b/brouter-routing-app/src/main/res/values-el/strings.xml @@ -69,26 +69,26 @@ η πηγή συντεταγμένων δεν περιέχει σημεία! η πηγή συντεταγμένων περιέχει πάρα πολλά σημεία: %1$d (παρακαλώ χρησιμοποιήστε από/προς/μέσω ονόματα) - No - Yes + Όχι + Ναι - Confirm Delete - Really delete? - Version Problem - The base version for tiles has changed. What to do? - Continue with current download, delete other old data - Select all for download and start - Cancel now, complete on an other day - Version Differences - The base version for some tiles is different. What to do? - Download all different tiles - Drop all different tiles - Cancel now, complete on an other day - The new data version needs a new app. Please update BRouter first + Επιβεβαίωση διαγραφής + Να γίνει διαγραφή; + Πρόβλημα έκδοσης + Η βασική έκδοση για τμήματα άλλαξε. Τι να κάνετε; + Συνέχεια με την τρέχουσα λήψη, διαγραφή άλλων παλαιών δεδομένων + Επιλέξτε όλα για λήψη και έναρξη + Ακύρωση τώρα, ολοκλήρωση άλλη μέρα + Διαφορές έκδοσης + Η βασική έκδοση για ορισμένα τμήματα είναι διαφορετική. Τι να κάνετε; + Λήψη όλων των διαφορετικών τμημάτων + Απόρριψη όλων των διαφορετικών τμημάτων + Ακύρωση τώρα, ολοκλήρωση άλλη μέρα + Η νέα έκδοση δεδομένων χρειάζεται νέα εφαρμογή. Ενημερώστε πρώτα το BRouter - Download failed - Download cancelled - Download succeeded - "Downloading .. " + Η λήψη απέτυχε + Η λήψη ακυρώθηκε + Η λήψη ολοκληρώθηκε + Λήψη… diff --git a/brouter-routing-app/src/main/res/values-es/strings.xml b/brouter-routing-app/src/main/res/values-es/strings.xml index 7dc62e7..9d2413a 100644 --- a/brouter-routing-app/src/main/res/values-es/strings.xml +++ b/brouter-routing-app/src/main/res/values-es/strings.xml @@ -69,25 +69,25 @@ la fuente de coordenadas contiene demasiados waypoints: %1$d (por favor, usa nombres desde/a/vía) No - Yes + Si - Confirm Delete - Really delete? - Version Problem - The base version for tiles has changed. What to do? - Continue with current download, delete other old data - Select all for download and start - Cancel now, complete on an other day - Version Differences - The base version for some tiles is different. What to do? - Download all different tiles - Drop all different tiles - Cancel now, complete on an other day - The new data version needs a new app. Please update BRouter first + Confirmar Eliminar + ¿Quieres realmente eliminar? + Problema de versión + La versión base para as teselas ha cambiado. ¿Qué quieres hacer? + Continuar con la descarga, eliminar otros datos antiguos + Seleccionar todo para descargar e iniciar + Cancelar ahora, completar otro día + Diferencias de versión + La versión base de varias teselas es distinta. ¿Qué quieres hacer? + Descargar todas las teselas distintas + Descartar las teselas distintas + Cancelar ahora, completar otro día + La nueva versión de datos necesita un aplicación nueva. Por favor, actualiza BRouter primero - Download failed - Download cancelled - Download succeeded - "Downloading .. " + Descarga fallida + Descarga cancelada + Descarga exitosa + Descargando… diff --git a/brouter-routing-app/src/main/res/values-fr/strings.xml b/brouter-routing-app/src/main/res/values-fr/strings.xml index c04ed1b..0b028f7 100644 --- a/brouter-routing-app/src/main/res/values-fr/strings.xml +++ b/brouter-routing-app/src/main/res/values-fr/strings.xml @@ -69,26 +69,26 @@ la source de coordonnées ne contient aucun waypoint! la source de coordonnées contient trop de waypoints: %1$d (veuillez utiliser les noms de/vers/via) - No - Yes + Non + Oui - Confirm Delete - Really delete? - Version Problem - The base version for tiles has changed. What to do? - Continue with current download, delete other old data - Select all for download and start - Cancel now, complete on an other day - Version Differences - The base version for some tiles is different. What to do? - Download all different tiles - Drop all different tiles - Cancel now, complete on an other day - The new data version needs a new app. Please update BRouter first + Confirmer la suppression + Vraiment supprimer? + Problème de version + La version de base des vignettes a changé. Que faire? + Continuer le téléchargement en cours, supprimer les autres anciennes données + Sélectionnez tout pour télécharger et démarrer + Annuler maintenant, terminer un autre jour + Différences de version + La version de base de certaines vignettes est différente. Que faire? + Télécharger toutes les différentes vignettes + Supprimez toutes les différentes vignettes + Annuler maintenant, terminer un autre jour + La nouvelle version des données nécessite une nouvelle application. Veuillez d\'abord mettre à jour BRouter - Download failed - Download cancelled - Download succeeded - "Downloading .. " + Téléchargement échoué + Téléchargement annulé + Téléchargement réussi + Téléchargement… diff --git a/brouter-routing-app/src/main/res/values-it/strings.xml b/brouter-routing-app/src/main/res/values-it/strings.xml index a459048..c82a6e2 100644 --- a/brouter-routing-app/src/main/res/values-it/strings.xml +++ b/brouter-routing-app/src/main/res/values-it/strings.xml @@ -70,25 +70,25 @@ la fonte delle coordinate contiene troppi waypoint: %1$d (usa i nomi da/a/via) No - Yes + - Confirm Delete - Really delete? - Version Problem - The base version for tiles has changed. What to do? - Continue with current download, delete other old data - Select all for download and start - Cancel now, complete on an other day - Version Differences - The base version for some tiles is different. What to do? - Download all different tiles - Drop all different tiles - Cancel now, complete on an other day - The new data version needs a new app. Please update BRouter first + Conferma eliminazione + Eliminare davvero? + Problema di versione + La versione base per i riquadri è cambiata. Cosa fare? + Continua con il download corrente, elimina altri vecchi dati + Seleziona tutto per il download e avvia + Annulla ora, completa un altro giorno + Differenze di versione + La versione base di alcuni riquadri è diversa. Cosa fare? + Scarica tutti i diversi riquadri + Rilascia tutti i diversi riquadri + Annulla ora, completa un altro giorno + La nuova versione dei dati necessita di una nuova app. Per favore aggiorna prima BRouter - Download failed - Download cancelled - Download succeeded - "Downloading .. " + Download fallito + Download annullato + Download riuscito + Download in corso… diff --git a/brouter-routing-app/src/main/res/values-nl/strings.xml b/brouter-routing-app/src/main/res/values-nl/strings.xml index a1806b1..fb8d201 100644 --- a/brouter-routing-app/src/main/res/values-nl/strings.xml +++ b/brouter-routing-app/src/main/res/values-nl/strings.xml @@ -63,26 +63,26 @@ coördinaten bron bevat geen waypoints! De coördinatenbron bevat te veel waypoints: %1$d (gebruik van/naar/via namen) - No - Yes + Nee + Ja - Confirm Delete - Really delete? - Version Problem - The base version for tiles has changed. What to do? - Continue with current download, delete other old data - Select all for download and start - Cancel now, complete on an other day - Version Differences - The base version for some tiles is different. What to do? - Download all different tiles - Drop all different tiles - Cancel now, complete on an other day - The new data version needs a new app. Please update BRouter first + Verwijderen bevestigen + Echt verwijderen? + Versie probleem + De basisversie voor de tegels is gewijzigd. Wat moet er gebeuren? + Doorgaan met de huidige download, verwijder de oude gegevens. + Selecteer alles om te downloaden en start + Annuleer nu, voltooi op een andere dag + Versieverschillen + De basisversie voor sommige tiles is anders. Wat moet er gebeuren? + Download alle verschillende tegels + Laat alle verschillende tegels vallen + Annuleer nu, en voltooi op een andere dag + Voor de nieuwe gegevensversie is een nieuwe app nodig. Update eerst de BRouter - Download failed - Download cancelled - Download succeeded - "Downloading .. " + Download is mislukt + Download is geannuleerd + Download is geslaagd + Downloaden… diff --git a/brouter-routing-app/src/main/res/values-pl/strings.xml b/brouter-routing-app/src/main/res/values-pl/strings.xml index bf0c8be..6901240 100644 --- a/brouter-routing-app/src/main/res/values-pl/strings.xml +++ b/brouter-routing-app/src/main/res/values-pl/strings.xml @@ -69,26 +69,26 @@ Źródło współrzędnych nie zawiera żadnych punktów trasy! Źródło współrzędnych zawiera zbyt dużo punktów trasy: %1$d (proszę używać nazw z/do/przez) - No - Yes + Nie + Tak - Confirm Delete - Really delete? - Version Problem - The base version for tiles has changed. What to do? - Continue with current download, delete other old data - Select all for download and start - Cancel now, complete on an other day - Version Differences - The base version for some tiles is different. What to do? - Download all different tiles - Drop all different tiles - Cancel now, complete on an other day - The new data version needs a new app. Please update BRouter first + Potwierdź usunięcie + Naprawdę usunąć? + Problem z wersją + Zmieniła się podstawowa wersja kafelków. Co robić? + Kontynuuj bieżące pobieranie, usuń inne stare dane + Wybierz wszystko i rozpocznij pobieranie + Anuluj teraz, dokończ innego dnia + Różnice wersji + Wersja podstawowa dla niektórych kafelków jest inna. Co robić? + Pobierz różne kafelki + Opuść wszystkie różne kafelki + Anuluj teraz, dokończ innego dnia + Nowa wersja danych wymaga nowej aplikacji. Najpierw zaktualizuj BRoutera - Download failed - Download cancelled - Download succeeded - "Downloading .. " + Pobieranie nie powiodło się + Pobieranie anulowane + Pobieranie powiodło się + Pobieranie… diff --git a/brouter-routing-app/src/main/res/values/strings.xml b/brouter-routing-app/src/main/res/values/strings.xml index 74e54d0..166323d 100644 --- a/brouter-routing-app/src/main/res/values/strings.xml +++ b/brouter-routing-app/src/main/res/values/strings.xml @@ -78,18 +78,18 @@ The base version for tiles has changed. What to do? Continue with current download, delete other old data Select all for download and start - Cancel now, complete on an other day + Cancel now, complete on another day Version Differences The base version for some tiles is different. What to do? Download all different tiles Drop all different tiles - Cancel now, complete on an other day + Cancel now, complete on another day The new data version needs a new app. Please update BRouter first Download failed Download cancelled Download succeeded - "Downloading .. " + Downloading… From 77014ffddbef98913651f7be0e0a243f348876b0 Mon Sep 17 00:00:00 2001 From: afischerdev Date: Thu, 14 Dec 2023 19:59:12 +0100 Subject: [PATCH 23/30] remove unused text --- brouter-routing-app/src/main/res/values-el/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/brouter-routing-app/src/main/res/values-el/strings.xml b/brouter-routing-app/src/main/res/values-el/strings.xml index 4f2578e..f5d098b 100644 --- a/brouter-routing-app/src/main/res/values-el/strings.xml +++ b/brouter-routing-app/src/main/res/values-el/strings.xml @@ -1,7 +1,7 @@ - %d τμήμαcompare cl + %d τμήμα %d τμήματα Ακύρωση λήψης From 158dc5e54d3e94d0693730e960556b2cc245fa83 Mon Sep 17 00:00:00 2001 From: afischerdev Date: Fri, 15 Dec 2023 14:01:13 +0100 Subject: [PATCH 24/30] do only compress gpx/json --- .../src/main/java/btools/routingapp/BRouterService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/brouter-routing-app/src/main/java/btools/routingapp/BRouterService.java b/brouter-routing-app/src/main/java/btools/routingapp/BRouterService.java index 90b875c..3e4f55e 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/BRouterService.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/BRouterService.java @@ -100,7 +100,7 @@ public class BRouterService extends Service { boolean canCompress = "true".equals(params.getString("acceptCompressedResult")); try { String gpxMessage = worker.getTrackFromParams(params); - if (canCompress) { + if (canCompress && (gpxMessage.startsWith("<") || gpxMessage.startsWith("{"))) { try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); baos.write("z64".getBytes(Charset.forName("UTF-8"))); // marker prefix From 9ef31e6d2c76663f0901ec724b8f9d09581de17b Mon Sep 17 00:00:00 2001 From: afischerdev Date: Fri, 15 Dec 2023 14:10:20 +0100 Subject: [PATCH 25/30] remove profile param when handled in app --- .../src/main/java/btools/routingapp/BRouterService.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/brouter-routing-app/src/main/java/btools/routingapp/BRouterService.java b/brouter-routing-app/src/main/java/btools/routingapp/BRouterService.java index 3e4f55e..1f16947 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/BRouterService.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/BRouterService.java @@ -96,6 +96,8 @@ public class BRouterService extends Service { if (errMsg != null) { return errMsg; } + // profile is already done + params.remove("profile"); boolean canCompress = "true".equals(params.getString("acceptCompressedResult")); try { From ec3461d8a237e8c3cddb8dc27d4a312fe1daccf4 Mon Sep 17 00:00:00 2001 From: afischerdev Date: Fri, 15 Dec 2023 14:25:03 +0100 Subject: [PATCH 26/30] changed handle back pressed logic --- .../routingapp/RoutingParameterDialog.java | 70 +++++++++++-------- 1 file changed, 41 insertions(+), 29 deletions(-) diff --git a/brouter-routing-app/src/main/java/btools/routingapp/RoutingParameterDialog.java b/brouter-routing-app/src/main/java/btools/routingapp/RoutingParameterDialog.java index 8eb4365..356e2d3 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/RoutingParameterDialog.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/RoutingParameterDialog.java @@ -10,6 +10,7 @@ import android.os.Bundle; import android.window.OnBackInvokedCallback; import android.window.OnBackInvokedDispatcher; +import androidx.activity.OnBackPressedCallback; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; @@ -168,41 +169,52 @@ public class RoutingParameterDialog extends AppCompatActivity { new OnBackInvokedCallback() { @Override public void onBackInvoked() { - StringBuilder sb = null; - if (sharedValues != null) { - // fill preference with used params - // for direct use in the BRouter interface "extraParams" - sb = new StringBuilder(); - for (Map.Entry entry : sharedValues.getAll().entrySet()) { - if (!entry.getKey().equals("params")) { - sb.append(sb.length() > 0 ? "&" : "") - .append(entry.getKey()) - .append("="); - String s = entry.getValue().toString(); - if (s.equals("true")) s = "1"; - else if (s.equals("false")) s = "0"; - sb.append(s); - } - } - } - // and return the array - // one should be enough - Intent i = new Intent(); - // i.putExtra("PARAMS", listParams); - i.putExtra("PROFILE", profile); - i.putExtra("PROFILE_HASH", profile_hash); - if (sb != null) i.putExtra("PARAMS_VALUES", sb.toString()); - - setResult(Activity.RESULT_OK, i); - finish(); + handleBackPressed(); } } ); - - + } else { + OnBackPressedCallback callback = new OnBackPressedCallback(true) { + @Override + public void handleOnBackPressed() { + handleBackPressed(); + } + }; + getOnBackPressedDispatcher().addCallback(this, callback); } } + private void handleBackPressed() { + StringBuilder sb = null; + if (sharedValues != null) { + // fill preference with used params + // for direct use in the BRouter interface "extraParams" + sb = new StringBuilder(); + for (Map.Entry entry : sharedValues.getAll().entrySet()) { + if (!entry.getKey().equals("params")) { + sb.append(sb.length() > 0 ? "&" : "") + .append(entry.getKey()) + .append("="); + String s = entry.getValue().toString(); + if (s.equals("true")) s = "1"; + else if (s.equals("false")) s = "0"; + sb.append(s); + } + } + } + // and return the array + // one should be enough + Intent i = new Intent(); + // i.putExtra("PARAMS", listParams); + i.putExtra("PROFILE", profile); + i.putExtra("PROFILE_HASH", profile_hash); + if (sb != null) i.putExtra("PARAMS_VALUES", sb.toString()); + + setResult(Activity.RESULT_OK, i); + finish(); + + } + @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); From 12309f298cafd8878e731553318c671c6a1cda71 Mon Sep 17 00:00:00 2001 From: afischerdev Date: Tue, 19 Dec 2023 17:25:02 +0100 Subject: [PATCH 27/30] update for some translations --- brouter-routing-app/src/main/res/values-ca/strings.xml | 5 +++-- brouter-routing-app/src/main/res/values-es/strings.xml | 5 +++-- brouter-routing-app/src/main/res/values-nl/strings.xml | 10 ++++++++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/brouter-routing-app/src/main/res/values-ca/strings.xml b/brouter-routing-app/src/main/res/values-ca/strings.xml index 6f2e8cf..9df7107 100644 --- a/brouter-routing-app/src/main/res/values-ca/strings.xml +++ b/brouter-routing-app/src/main/res/values-ca/strings.xml @@ -35,8 +35,9 @@ des d\'un mòbil sense un pla de dades! La velocitat de baixada està limitada a 16 Mbit/s. S\'ha preparat correctament un càlcul sense límit de temps - S\'ha repetit amb èxit un càlcul a través de l\'aplicació de cartografia que prèviament havia - superat el temps d\'espera. Si repeteixes la mateixa petició amb exactament el mateix destí i un punt de partida proper, + S\'ha repetit amb èxit un càlcul a través + de l\'aplicació de cartografia que prèviament havia superat el temps d\'espera. + Si repeteixes la mateixa petició amb exactament el mateix destí i un punt de partida proper, es garanteix que la petició no esgotarà el límit de temps. Introdueix el directori base de la tarja SD: Seleccionar Acció diff --git a/brouter-routing-app/src/main/res/values-es/strings.xml b/brouter-routing-app/src/main/res/values-es/strings.xml index 9d2413a..37094da 100644 --- a/brouter-routing-app/src/main/res/values-es/strings.xml +++ b/brouter-routing-app/src/main/res/values-es/strings.xml @@ -35,8 +35,9 @@ desde un terminal sin plan de datos! La velocidad de descarga está limitada a 16 Mbit/s. Se ha preparado correctamente un cálculo sin límite de tiempo - Se ha repetido un cálculo a través de la aplicación de mapas que previamente - había superado el tiempo de espera. Si repites la misma petición con exactamente el mismo destino y un punto de partida cercano, + Se ha repetido un cálculo a través + de la aplicación de mapas que previamente había superado el tiempo de espera. + Si repites la misma petición con exactamente el mismo destino y un punto de partida cercano, se garantiza que la petición no agotará el límite de tiempo. Introduce el directorio base de la tarjeta SD: Seleccionar Acción diff --git a/brouter-routing-app/src/main/res/values-nl/strings.xml b/brouter-routing-app/src/main/res/values-nl/strings.xml index fb8d201..fea694a 100644 --- a/brouter-routing-app/src/main/res/values-nl/strings.xml +++ b/brouter-routing-app/src/main/res/values-nl/strings.xml @@ -30,9 +30,15 @@ BRouter Download Manager *** OPgelet:*** - \n\nDe Download Manager wordt gebruikt voor het downloaden van routing-gegevens bestanden die elk maximaal 170 MB groot kunnen zijn. Start de Download Manager niet op een mobiele dataverbinding zonder data-abonnement! De downloadsnelheid is beperkt tot 16 MBit/s. + \n\nDe Download Manager wordt gebruikt voor het downloaden van routing-gegevens + bestanden die elk maximaal 170 MB groot kunnen zijn. Start de Download Manager + niet op een mobiele dataverbinding zonder data-abonnement! + De downloadsnelheid is beperkt tot 16 MBit/s. Een time-outvrije berekening is succesvol voorbereid - Je hebt met succes een berekening herhaald die eerder op een time-out stuitte toen deze vanuit je map-tool werd gestart. Als u hetzelfde verzoek herhaalt vanuit uw maptool, met exact hetzelfde bestemmingspunt en een dichtbijgelegen beginpunt zal deze aanvraag gegarandeerd geen time-out krijgen. + Je hebt met succes een berekening herhaald die eerder op een time-out + stuitte toen deze vanuit je map tool werd gestart. Als u hetzelfde verzoek herhaalt + vanuit uw map tool, met exact hetzelfde bestemmingspunt en een dichtbijgelegen beginpunt, + zal deze aanvraag gegarandeerd geen time-out krijgen. De SDCARD basis directory invoeren: Actie selecteren From 29673062b5a513696a6dee59a22af382a0df9b9d Mon Sep 17 00:00:00 2001 From: Emux Date: Thu, 21 Dec 2023 20:32:44 +0200 Subject: [PATCH 28/30] Fix Canvas.drawRect on older Android --- .../src/main/java/btools/routingapp/BInstallerView.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/brouter-routing-app/src/main/java/btools/routingapp/BInstallerView.java b/brouter-routing-app/src/main/java/btools/routingapp/BInstallerView.java index 4eaddac..8fb8949 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/BInstallerView.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/BInstallerView.java @@ -175,7 +175,7 @@ public class BInstallerView extends View { int tidx = gridPos2Tileindex(ix, iy); int tilesize = BInstallerSizes.getRd5Size(tidx); if (tilesize > 0) { - canvas.drawRect(fw * ix, fh * (iy + 1), fw * (ix + 1), fh * iy, paintGrid); + canvas.drawRect(fw * ix, fh * iy, fw * (ix + 1), fh * (iy + 1), paintGrid); } } } @@ -214,7 +214,7 @@ public class BInstallerView extends View { canvas.drawLine(fw * ix, fh * (iy + 1), fw * (ix + 1), fh * iy, pnt); // draw frame - canvas.drawRect(fw * ix, fh * (iy + 1), fw * (ix + 1), fh * iy, pnt); + canvas.drawRect(fw * ix, fh * iy, fw * (ix + 1), fh * (iy + 1), pnt); } } } From 152833386b7d338f6ca7f14ef67cbccf787bd994 Mon Sep 17 00:00:00 2001 From: afischerdev Date: Sat, 23 Dec 2023 14:37:37 +0100 Subject: [PATCH 29/30] new lang Korean translations --- .../src/main/res/values-ko/strings.xml | 94 +++++++++++++++++++ .../src/main/res/values/strings.xml | 4 +- 2 files changed, 96 insertions(+), 2 deletions(-) create mode 100644 brouter-routing-app/src/main/res/values-ko/strings.xml diff --git a/brouter-routing-app/src/main/res/values-ko/strings.xml b/brouter-routing-app/src/main/res/values-ko/strings.xml new file mode 100644 index 0000000..1c316ed --- /dev/null +++ b/brouter-routing-app/src/main/res/values-ko/strings.xml @@ -0,0 +1,94 @@ + + + + %d 구간 + %d 구간 + + 다운로드 취소 + 프로필 가져오기 + 다운로드 %s + 삭제 %s + 업데이트 %s + 구간 선택 + 다운로드 중지 + 크기=%1$s\n여유=%2$s + 구간 다운로드 + + brouter 데이터 베이스 선택 dir: + 루트 프로필 선택 + 주 활동 선택 + 다운로드 관리자 + BRouter 앱 + + 취소 + 알고 있습니다 + 가까운 + 나가기 + OK + 성공 + 에러가 발생됐습니다 + + BRouter 다운로드 관리자 + *** 주의:*** + \n\n다운로드 관리자는 라우팅 데이터를 다운로드하는 데 사용됩니다. + 파일당 최대 170MB까지 가능합니다. 다운로드 관리자를 시작하지 마십시오 + 데이터 요금제 없이 셀룰러 데이터 연결로! + 다운로드 속도는 16 MBit/s로 제한됩니다. + 시간 초과 없는 계산을 성공적으로 준비했습니다 + 이전에 시간 초과가 발생한 계산을 성공적으로 반복하셨습니다. + 지도 도구에서 시작할 때. 귀하가 귀하로부터 동일한 요청을 반복하는 경우 + 정확히 동일한 목적지와 가까운 시작점이 있는 지도 도구, + 이 요청은 시간 초과되지 않음이 보장됩니다. + SDCARD 기본 디렉토리 입력: + 작업 선택 + + 경유 선택 체크: + NoGo 선택 체크: + 서버-모드 + 정보 + 루트 계산 + 프로필 설정 + GPX 공유 + ~로부터 선택 + 선택 ~로/경유하여 + + 프로필 데이터 없음 + , 사용된 프로필 없음 + 다운로드 하기에 너무 많은 데이터. 줄이도록 하세요. + 다운로드 계획되어 있음. 인터넷 연결 체크 그렇지 않다면 시작. + 현재 장소 선택:\n + 장소 선택 기대\n + 대체 가능한 + 버전 = BRouter-%1$s \n + 메모리 = %2$s \n + 거리 = %3$s km\n + 필터링된 오름차순 = %4$s m\n + 일반 오름차순 = %5$s m\n + 예상 시간 = %6$s + 장소 읽는데 에러 + 좌표정보는 어떤 장소도 포함하고 있지 않습니다! + 좌표정보는 너무 많은 장소를 포함하고 있습니다: %1$d (~로 부터/~로/경유 이름 사용하세요) + + 아니요 + + + 삭제 확인 + 정말 삭제하시겠습니까? + 버전 문제 + 타일을 위한 기본 버전이 바뀌었습니다. 무엇을 해야죠? + 현재 다운로드 계속, 다른 오래된 데이터 삭제 + 다운로드 위해 모두 선택하고 시작 + 지금 취소, 다른 날 완료 + 버전 차이 + 어떤 타일을 위한 기본 버전은 다릅니다, 무엇을 해야죠? + 모든 다른 타일 다운로드 + 모든 다른 타일 백지화 + 지금 취소, 다른 날 완료 + 새로운 데이터 버전은 새로운 앱을 필요로 합니다. 우선 BRouter를 업데이트 하세요 + + 다운로드 실패 + 다운로드 취소됨 + 다운로드 성공 + 다운로딩… + + diff --git a/brouter-routing-app/src/main/res/values/strings.xml b/brouter-routing-app/src/main/res/values/strings.xml index 166323d..fe274ab 100644 --- a/brouter-routing-app/src/main/res/values/strings.xml +++ b/brouter-routing-app/src/main/res/values/strings.xml @@ -36,8 +36,8 @@ Download speed is restricted to 16 MBit/s. Successfully prepared a timeout-free calculation You successfully repeated a calculation that previously run into a timeout - when started from your map-tool. If you repeat the same request from your - maptool, with the exact same destination point and a close-by starting point, + when started from your map tool. If you repeat the same request from your + map tool, with the exact same destination point and a close-by starting point, this request is guaranteed not to time out. Enter SDCARD base dir: Select Action From ae951d9aa5a2806b3c4960462b0bebfe52ff4793 Mon Sep 17 00:00:00 2001 From: Waldir Pimenta Date: Fri, 12 Jan 2024 23:05:48 +0000 Subject: [PATCH 30/30] Fix 'sees' typo in consider_river switch Use wording proposed by @gnbl on https://github.com/nrenner/brouter-web/issues/747 --- misc/profiles2/fastbike.brf | 2 +- misc/profiles2/hiking-mountain.brf | 2 +- misc/profiles2/trekking.brf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/misc/profiles2/fastbike.brf b/misc/profiles2/fastbike.brf index 5c9e6a5..d51a880 100644 --- a/misc/profiles2/fastbike.brf +++ b/misc/profiles2/fastbike.brf @@ -25,7 +25,7 @@ assign allow_motorways = false # %allow_motorways% | Set to true to allow assign consider_traffic = false # %consider_traffic% | Activate to avoid traffic | boolean assign consider_noise = false # %consider_noise% | Activate to prefer a low-noise route | boolean -assign consider_river = false # %consider_river% | Activate to prefer a route along rivers or sees | boolean +assign consider_river = false # %consider_river% | Activate to prefer a route along rivers, lakes, etc. | boolean assign consider_forest = false # %consider_forest% | Activate to prefer a route in forest or parks | boolean assign consider_town = false # %consider_town% | Activate to bypass cities / big towns as far as possible | boolean diff --git a/misc/profiles2/hiking-mountain.brf b/misc/profiles2/hiking-mountain.brf index c4ce1bc..688da66 100644 --- a/misc/profiles2/hiking-mountain.brf +++ b/misc/profiles2/hiking-mountain.brf @@ -12,7 +12,7 @@ assign consider_elevation = false # %consider_elevation% | Activate to prefer a route with few elevation meters | boolean assign consider_noise = false # %consider_noise% | Activate to prefer a low-noise route | boolean -assign consider_river = false # %consider_river% | Activate to prefer a route along rivers or sees | boolean +assign consider_river = false # %consider_river% | Activate to prefer a route along rivers, lakes, etc. | boolean assign consider_forest = false # %consider_forest% | Activate to prefer a route in forest or green areas| boolean assign consider_town = false # %consider_town% | Activate to bypass cities / big towns as far as possible | boolean assign consider_traffic = 1 # %consider_traffic% | how do you plan to drive the tour? | [1=as cyclist alone in the week, 0.5=as cyclist alone at weekend, 0.3 =with a group of cyclists, 0.1=with a group of cyclists at week-end] diff --git a/misc/profiles2/trekking.brf b/misc/profiles2/trekking.brf index 3c8841a..b4aa6ed 100644 --- a/misc/profiles2/trekking.brf +++ b/misc/profiles2/trekking.brf @@ -16,7 +16,7 @@ assign stick_to_cycleroutes = false # %stick_to_cycleroutes% | Set true t assign avoid_unsafe = false # %avoid_unsafe% | Set true to avoid standard highways | boolean assign consider_noise = false # %consider_noise% | Activate to prefer a low-noise route | boolean -assign consider_river = false # %consider_river% | Activate to prefer a route along rivers or sees | boolean +assign consider_river = false # %consider_river% | Activate to prefer a route along rivers, lakes, etc. | boolean assign consider_forest = false # %consider_forest% | Activate to prefer a route in forest or parks | boolean assign consider_town = false # %consider_town% | Activate to bypass cities / big towns as far as possible | boolean assign consider_traffic = false # %consider_traffic% | Activate to consider traffic estimates | boolean