Merge branch 'master' of ssh://github.com/osmandapp/Osmand
This commit is contained in:
commit
93dd291796
14 changed files with 266 additions and 139 deletions
|
@ -7,71 +7,71 @@ import java.util.regex.Pattern;
|
|||
public class GeoPointParserUtil {
|
||||
|
||||
public static void main(String[] args) {
|
||||
final double lat = 34.99, lon = -106.61;
|
||||
final int ilat = 34, ilon = -106;
|
||||
final double dlat = 34.99, dlon = -106.61;
|
||||
final String name = "Treasure Island";
|
||||
int z = GeoParsedPoint.NO_ZOOM;
|
||||
String url;
|
||||
|
||||
// geo:34.99,-106.61
|
||||
url = "geo:" + lat + "," + lon;
|
||||
// geo:34,-106
|
||||
url = "geo:" + ilat + "," + ilon;
|
||||
System.out.println("url: " + url);
|
||||
GeoParsedPoint actual = GeoPointParserUtil.parse("geo", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(lat, lon));
|
||||
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon));
|
||||
|
||||
// geo:34.99,-106.61
|
||||
url = "geo:" + dlat + "," + dlon;
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("geo", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon));
|
||||
|
||||
// geo:34.99,-106.61?z=11
|
||||
z = 11;
|
||||
url = "geo:" + lat + "," + lon + "?z=" + z;
|
||||
url = "geo:" + dlat + "," + dlon + "?z=" + z;
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("geo", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
|
||||
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
||||
|
||||
// geo:34.99,-106.61 (Treasure Island)
|
||||
url = "geo:" + lat + "," + lon + " (" + name + ")";
|
||||
url = "geo:" + dlat + "," + dlon + " (" + name + ")";
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("geo", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, name));
|
||||
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, name));
|
||||
|
||||
// geo:34.99,-106.61?z=11 (Treasure Island)
|
||||
z = 11;
|
||||
url = "geo:" + lat + "," + lon + "?z=" + z + " (" + name + ")";
|
||||
url = "geo:" + dlat + "," + dlon + "?z=" + z + " (" + name + ")";
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("geo", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z, name));
|
||||
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z, name));
|
||||
|
||||
// 0,0?q=34,-106(Treasure Island)
|
||||
z = GeoParsedPoint.NO_ZOOM;
|
||||
url = "geo:0,0?q=" + ilat + "," + ilon + " (" + name + ")";
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("geo", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z, name));
|
||||
|
||||
// 0,0?q=34.99,-106.61(Treasure Island)
|
||||
z = GeoParsedPoint.NO_ZOOM;
|
||||
url = "geo:0,0?q=" + lat + "," + lon + " (" + name + ")";
|
||||
url = "geo:0,0?q=" + dlat + "," + dlon + " (" + name + ")";
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("geo", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z, name));
|
||||
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z, name));
|
||||
|
||||
// geo:0,0?z=11&q=34.99,-106.61(Treasure Island)
|
||||
z = 11;
|
||||
url = "geo:0,0?z=" + z + "&q=" + lat + "," + lon + " (" + name + ")";
|
||||
url = "geo:0,0?z=" + z + "&q=" + dlat + "," + dlon + " (" + name + ")";
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("geo", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z, name));
|
||||
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z, name));
|
||||
|
||||
// geo:0,0?z=11&q=34.99,-106.61
|
||||
z = 11;
|
||||
url = "geo:0,0?z=" + z + "&q=" + lat + "," + lon;
|
||||
url = "geo:0,0?z=" + z + "&q=" + dlat + "," + dlon;
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("geo", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
|
||||
|
||||
// geo:34.99,-106.61
|
||||
z = -1;
|
||||
url = "geo:" + lat + "," + lon;
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("geo", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
|
||||
|
||||
// geo:34.99,-106.61?z=11
|
||||
z = 11;
|
||||
url = "geo:" + lat + "," + lon + "?" + "z=" + z;
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("geo", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
|
||||
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
||||
|
||||
// google calendar
|
||||
// geo:0,0?q=760 West Genesee Street Syracuse NY 13204
|
||||
|
@ -88,82 +88,153 @@ public class GeoPointParserUtil {
|
|||
actual = GeoPointParserUtil.parse("geo", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(qstr));
|
||||
|
||||
// http://download.osmand.net/go?lat=34.99&lon=-106.61&z=11
|
||||
url = "http://download.osmand.net/go?lat=" + lat + "&lon=" + lon + "&z=" + z;
|
||||
// http://download.osmand.net/go?lat=34&lon=-106&z=11
|
||||
url = "http://download.osmand.net/go?lat=" + ilat + "&lon=" + ilon + "&z=" + z;
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("http", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
|
||||
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
|
||||
|
||||
// http://download.osmand.net/go?lat=34.99&lon=-106.61&z=11
|
||||
url = "http://download.osmand.net/go?lat=" + dlat + "&lon=" + dlon + "&z=" + z;
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("http", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
||||
|
||||
// http://openstreetmap.org/map=11/34/-106
|
||||
url = "http://openstreetmap.org/map=" + z + "/" + ilat + "/" + ilon;
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("http", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
|
||||
|
||||
// http://openstreetmap.org/map=11/34.99/-106.61
|
||||
url = "http://openstreetmap.org/map=" + z + "/" + lat + "/" + lon;
|
||||
url = "http://openstreetmap.org/map=" + z + "/" + dlat + "/" + dlon;
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("http", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
|
||||
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
||||
|
||||
// http://openstreetmap.de/zoom=11&lat=34&lon=-106
|
||||
url = "http://openstreetmap.de/zoom=" + z + "&lat=" + ilat + "&lon=" + ilon;
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("http", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
|
||||
|
||||
// http://openstreetmap.de/zoom=11&lat=34.99&lon=-106.61
|
||||
url = "http://openstreetmap.de/zoom=" + z + "&lat=" + lat + "&lon=" + lon;
|
||||
url = "http://openstreetmap.de/zoom=" + z + "&lat=" + dlat + "&lon=" + dlon;
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("http", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
|
||||
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
||||
|
||||
// http://openstreetmap.de/lat=34.99&lon=-106.61&zoom=11
|
||||
url = "http://openstreetmap.de/lat=" + lat + "&lon=" + lon + "&zoom=" + z;
|
||||
url = "http://openstreetmap.de/lat=" + dlat + "&lon=" + dlon + "&zoom=" + z;
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("http", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
|
||||
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
||||
|
||||
// http://maps.google.com/maps/@34,-106,11z
|
||||
url = "http://maps.google.com/maps/@" + ilat + "," + ilon + "," + z + "z";
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("http", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
|
||||
|
||||
// http://maps.google.com/maps/@34.99,-106.61,11z
|
||||
url = "http://maps.google.com/maps/@" + lat + "," + lon + "," + z + "z";
|
||||
url = "http://maps.google.com/maps/@" + dlat + "," + dlon + "," + z + "z";
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("http", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
|
||||
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
||||
|
||||
// http://maps.google.com/maps/ll=34,-106,z=11
|
||||
url = "http://maps.google.com/maps/ll=" + ilat + "," + ilon + ",z=" + z;
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("http", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
|
||||
|
||||
// http://maps.google.com/maps/ll=34.99,-106.61,z=11
|
||||
url = "http://maps.google.com/maps/ll=" + lat + "," + lon + ",z=" + z;
|
||||
url = "http://maps.google.com/maps/ll=" + dlat + "," + dlon + ",z=" + z;
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("http", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
|
||||
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
||||
|
||||
// http://maps.google.com/maps/q=loc:34,-106&z=11
|
||||
url = "http://maps.google.com/maps/q=loc:" + ilat + "," + ilon + "&z=" + z;
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("http", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
|
||||
|
||||
// http://maps.google.com/maps/q=loc:34.99,-106.61&z=11
|
||||
url = "http://maps.google.com/maps/q=loc:" + lat + "," + lon + "&z=" + z;
|
||||
url = "http://maps.google.com/maps/q=loc:" + dlat + "," + dlon + "&z=" + z;
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("http", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
|
||||
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
||||
|
||||
// whatsapp
|
||||
// http://maps.google.com/maps/q=loc:34,-106 (You)
|
||||
z = GeoParsedPoint.NO_ZOOM;
|
||||
url = "http://maps.google.com/maps/q=loc:" + ilat + "," + ilon + " (You)";
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("http", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
|
||||
|
||||
// whatsapp
|
||||
// http://maps.google.com/maps/q=loc:34.99,-106.61 (You)
|
||||
z = GeoParsedPoint.NO_ZOOM;
|
||||
url = "http://maps.google.com/maps/q=loc:" + lat + "," + lon + " (You)";
|
||||
url = "http://maps.google.com/maps/q=loc:" + dlat + "," + dlon + " (You)";
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("http", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
|
||||
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
||||
|
||||
// http://www.google.com/maps/search/food/34,-106,14z
|
||||
url = "http://www.google.com/maps/search/food/" + ilat + "," + ilon + "," + z + "z";
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("http", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
|
||||
|
||||
// http://www.google.com/maps/search/food/34.99,-106.61,14z
|
||||
url = "http://www.google.com/maps/search/food/" + lat + "," + lon + "," + z + "z";
|
||||
url = "http://www.google.com/maps/search/food/" + dlat + "," + dlon + "," + z + "z";
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("http", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
|
||||
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
||||
|
||||
// http://maps.google.com?saddr=Current+Location&daddr=34,-106
|
||||
z = GeoParsedPoint.NO_ZOOM;
|
||||
url = "http://maps.google.com?saddr=Current+Location&daddr=" + ilat + "," + ilon;
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("http", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
|
||||
|
||||
// http://maps.google.com?saddr=Current+Location&daddr=34.99,-106.61
|
||||
z = GeoParsedPoint.NO_ZOOM;
|
||||
url = "http://maps.google.com?saddr=Current+Location&daddr=" + lat + "," + lon;
|
||||
url = "http://maps.google.com?saddr=Current+Location&daddr=" + dlat + "," + dlon;
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("http", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
|
||||
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
||||
|
||||
// http://www.google.com/maps/dir/Current+Location/34,-106
|
||||
z = GeoParsedPoint.NO_ZOOM;
|
||||
url = "http://www.google.com/maps/dir/Current+Location/" + ilat + "," + ilon;
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("http", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
|
||||
|
||||
// http://www.google.com/maps/dir/Current+Location/34.99,-106.61
|
||||
z = GeoParsedPoint.NO_ZOOM;
|
||||
url = "http://www.google.com/maps/dir/Current+Location/" + lat + "," + lon;
|
||||
url = "http://www.google.com/maps/dir/Current+Location/" + dlat + "," + dlon;
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("http", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
|
||||
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
||||
|
||||
// http://maps.google.com/maps?q=34,-106
|
||||
z = GeoParsedPoint.NO_ZOOM;
|
||||
url = "http://maps.google.com/maps?q=" + ilat + "," + ilon;
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("http", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
|
||||
|
||||
// http://maps.google.com/maps?q=34.99,-106.61
|
||||
z = GeoParsedPoint.NO_ZOOM;
|
||||
url = "http://maps.google.com/maps?q=" + lat + "," + lon;
|
||||
url = "http://maps.google.com/maps?q=" + dlat + "," + dlon;
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("http", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
|
||||
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
||||
|
||||
// http://www.google.com/maps/place/760+West+Genesee+Street+Syracuse+NY+13204
|
||||
qstr = "760+West+Genesee+Street+Syracuse+NY+13204";
|
||||
|
@ -193,13 +264,19 @@ public class GeoPointParserUtil {
|
|||
actual = GeoPointParserUtil.parse("http", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(qstr));
|
||||
|
||||
// http://maps.yandex.ru/?ll=34.99,-106.61&z=11
|
||||
// http://maps.yandex.ru/?ll=34,-106&z=11
|
||||
z = 11;
|
||||
url = "http://maps.yandex.ru/?ll=" + lat + "," + lon + "&z=" + z;
|
||||
url = "http://maps.yandex.ru/?ll=" + ilat + "," + ilon + "&z=" + z;
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("http", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(lat, lon, z));
|
||||
assertGeoPoint(actual, new GeoParsedPoint(ilat, ilon, z));
|
||||
|
||||
// http://maps.yandex.ru/?ll=34.99,-106.61&z=11
|
||||
z = 11;
|
||||
url = "http://maps.yandex.ru/?ll=" + dlat + "," + dlon + "&z=" + z;
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("http", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z));
|
||||
}
|
||||
|
||||
private static void assertGeoPoint(GeoParsedPoint actual, GeoParsedPoint expected) {
|
||||
|
@ -265,32 +342,33 @@ public class GeoPointParserUtil {
|
|||
|
||||
final String[] osmandNetSite = { "//download.osmand.net/go?" };
|
||||
|
||||
final String[] osmandNetPattern = { "lat=(-?\\d{1,3}\\.\\d+)&lon=(-?\\d{1,3}\\.\\d+)&z=(\\d{1,2})" };
|
||||
final String[] osmandNetPattern = { "lat=([+-]?\\d+(?:\\.\\d+)?)&lon=([+-]?\\d+(?:\\.\\d+)?)&?(z=\\d{1,2})" };
|
||||
|
||||
final String[] openstreetmapOrgSite = { "//openstreetmap.org/", "//www.openstreetmap.org/" };
|
||||
|
||||
final String[] openstreetmapOrgPattern = { "(?:.*)(?:map=)(\\d{1,2})/(-?\\d{1,3}\\.\\d+)/(-?\\d{1,3}\\.\\d+)(?:.*)" };
|
||||
final String[] openstreetmapOrgPattern = { "(?:.*)(?:map=)(\\d{1,2})/([+-]?\\d+(?:\\.\\d+)?)/([+-]?\\d+(?:\\.\\d+)?)(?:.*)" };
|
||||
|
||||
final String[] openstreetmapDeSite = { "//openstreetmap.de/", "//www.openstreetmap.de/" };
|
||||
|
||||
final String[] openstreetmapDePattern = {
|
||||
"(?:.*)zoom=(\\d{1,2})&lat=(-?\\d{1,3}\\.\\d+)&lon=(-?\\d{1,3}\\.\\d+)(?:.*)",
|
||||
"(?:.*)lat=(-?\\d{1,3}\\.\\d+)&lon=(-?\\d{1,3}\\.\\d+)&z(?:oom)?=(\\d{1,2})(?:.*)" };
|
||||
"(?:.*)zoom=(\\d{1,2})&lat=([+-]?\\d+(?:\\.\\d+)?)&lon=([+-]?\\d+(?:\\.\\d+)?)(?:.*)",
|
||||
"(?:.*)lat=([+-]?\\d+(?:\\.\\d+)?)&lon=([+-]?\\d+(?:\\.\\d+)?)&?(z(?:oom)?=\\d{1,2})(?:.*)" };
|
||||
|
||||
final String[] googleComSite = { "//www.google.com/maps/", "//maps.google.com/maps", "//maps.google.com" };
|
||||
|
||||
final String[] googleComPattern = { "(?:.*)[@/](-?\\d{1,3}\\.\\d+),(-?\\d{1,3}\\.\\d+),(\\d{1,2})z(?:.*)",
|
||||
"(?:.*)ll=(-?\\d{1,3}\\.\\d+),(-?\\d{1,3}\\.\\d+)(?:.+)z=(\\d{1,2})(?:.*)",
|
||||
"(?:.*)q=([\\-+]?\\d{1,3}\\.\\d+),([\\-+]?\\d{1,3}\\.\\d+)(?:.*)&z=(\\d{1,2})",
|
||||
"(?:.*)(q=)(-?\\d{1,3}\\.\\d+),(-?\\d{1,3}\\.\\d+)(?:.*)",
|
||||
"(?:.*)q=loc:(-?\\d{1,3}\\.\\d+),(-?\\d{1,3}\\.\\d+)&z=(\\d{1,2})(?:.*)",
|
||||
"(?:.*)(q=loc:)(-?\\d{1,3}\\.\\d+),(-?\\d{1,3}\\.\\d+)(?:.*)",
|
||||
"(.*)daddr=(-?\\d{1,3}\\.\\d+),(-?\\d{1,3}\\.\\d+)(?:.*)",
|
||||
"(.*)/(-?\\d{1,3}\\.\\d+),(-?\\d{1,3}\\.\\d+)(?:.*)" };
|
||||
final String[] googleComPattern = {
|
||||
"(?:.*)[@/]([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?),(\\d{1,2}z)(?:.*)",
|
||||
"(?:.*)ll=([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?)(?:.+)(z=\\d{1,2})(?:.*)",
|
||||
"(?:.*)q=([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?)(?:.*)&?(z=\\d{1,2})",
|
||||
"(?:.*)(q=)([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?)(?:.*)",
|
||||
"(?:.*)q=loc:([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?)&?(z=\\d{1,2})(?:.*)",
|
||||
"(?:.*)(q=loc:)([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?)(?:.*)",
|
||||
"(.*)daddr=([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?)(?:.*)",
|
||||
"(.*)/([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?)(?:.*)" };
|
||||
|
||||
final String[] yandexRuSite = { "//maps.yandex.ru/" };
|
||||
|
||||
final String[] yandexRuPattern = { "(?:.*)ll=(-?\\d{1,3}.\\d+),(-?\\d{1,3}.\\d+)(?:.+)z=(\\d{1,2})(?:.*)" };
|
||||
final String[] yandexRuPattern = { "(?:.*)ll=([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?)(?:.+)(z=\\d{1,2})(?:.*)" };
|
||||
|
||||
final String sites[][] = { osmandNetSite, openstreetmapOrgSite, openstreetmapDeSite, googleComSite,
|
||||
yandexRuSite };
|
||||
|
@ -318,10 +396,19 @@ public class GeoPointParserUtil {
|
|||
int zoom;
|
||||
|
||||
// check sequence of values
|
||||
if (!matcher.group(3).contains(".")) {
|
||||
if (matcher.group(3).contains("z=")) {
|
||||
lat = Double.valueOf(matcher.group(1));
|
||||
lon = Double.valueOf(matcher.group(2));
|
||||
zoom = Integer.valueOf(matcher.group(3));
|
||||
zoom = Integer.valueOf(matcher.group(3).substring("z=".length()));
|
||||
} else if (matcher.group(3).contains("zoom=")) {
|
||||
lat = Double.valueOf(matcher.group(1));
|
||||
lon = Double.valueOf(matcher.group(2));
|
||||
zoom = Integer.valueOf(matcher.group(3).substring("zoom=".length()));
|
||||
} else if (matcher.group(3).contains("z")) {
|
||||
lat = Double.valueOf(matcher.group(1));
|
||||
lon = Double.valueOf(matcher.group(2));
|
||||
zoom = Integer.valueOf(matcher.group(3).substring(0,
|
||||
matcher.group(3).length() - 1));
|
||||
} else {
|
||||
lat = Double.valueOf(matcher.group(2));
|
||||
lon = Double.valueOf(matcher.group(3));
|
||||
|
@ -364,7 +451,7 @@ public class GeoPointParserUtil {
|
|||
// geo:0,0?q=34.99,-106.61(Treasure Island)
|
||||
// geo:0,0?z=11&q=34.99,-106.61(Treasure Island)
|
||||
String query = schemeSpecific.substring("0,0?".length());
|
||||
final String pattern = "(?:z=([0-9]{1,2}))?&?q=([\\-0-9\\.]+)?,([\\-0-9\\.]+)?[\\+]*(?:\\((.+?)\\))?";
|
||||
final String pattern = "(?:z=(\\d{1,2}))?&?q=([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?)[\\+]?(?:\\((.+?)\\))?";
|
||||
final Matcher matcher = Pattern.compile(pattern).matcher(query);
|
||||
if (matcher.matches()) {
|
||||
final String z = matcher.group(1);
|
||||
|
@ -382,7 +469,7 @@ public class GeoPointParserUtil {
|
|||
} else {
|
||||
// geo:47.6,-122.3
|
||||
// geo:47.6,-122.3?z=11 (Treasure Island)
|
||||
final String pattern = "([\\-\\d{1,2}\\.\\d]+),([\\-\\d{1,3}\\.\\d]+)(?:\\?z=(\\d{1,2}))?[\\+]?(?:\\((.*?)\\))?";
|
||||
final String pattern = "([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?)(?:\\?z=(\\d{1,2}))?[\\+]?(?:\\((.*?)\\))?";
|
||||
final Matcher matcher = Pattern.compile(pattern).matcher(schemeSpecific);
|
||||
if (matcher.matches()) {
|
||||
final double lat = Double.valueOf(matcher.group(1));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<resources><string name="auto_zoom_none">Без аўтаматычнага масштабіраваньня</string>
|
||||
<string name="auto_zoom_close">Зачыніць</string>
|
||||
<string name="auto_zoom_far">Для сярэдняга масштаба</string>
|
||||
|
@ -1937,9 +1937,9 @@ OsmAnd мае адкрыты зыходны код і актыўна разві
|
|||
<string name="more">Больш...</string>
|
||||
<string name="flat_list_waypoitns">Усе</string>
|
||||
<string name="waypoints">Кропкі шляху</string>
|
||||
<string name="way_alarms">Перашкоды</string>
|
||||
<string name="speak_favorites">Абвяшчаць выбраныя</string>
|
||||
<string name="speak_poi">Абвяшчаць POI</string>
|
||||
<string name="way_alarms">Дарожныя папярэджаньні</string>
|
||||
<string name="speak_favorites">Абвяшчаць выбраныя паблізу</string>
|
||||
<string name="speak_poi">Абвяшчаць POI паблізу</string>
|
||||
<string name="targets">Цэлі</string>
|
||||
<string name="flat_list_waypoints">Усе</string>
|
||||
<string name="index_tours">Паездкі</string>
|
||||
|
|
|
@ -856,7 +856,7 @@
|
|||
\n\nLa caixa de diàleg s\'amaga altre cop prement i aguantant dins seu.
|
||||
</string>
|
||||
<string name="tip_initial_t">"OsmAnd és una aplicació de navegació amb moltes funcionalitats.
|
||||
\n\nEs disposa d\'una introducció bàsica, de consells d\'ús i d\'una ajuda avançada via «Menú» → «Ajuda» des la pantalla del mapa. "</string>
|
||||
\n\nEs disposa d\'una introducció bàsica, de consells d\'ús i de trucs via «Menú» → «Ajuda» des la pantalla del mapa. "</string>
|
||||
<string name="send_location_way_choose_title">Comparteix l\'ubicació usant</string>
|
||||
<string name="old_map_index_is_not_supported">Format de mapa discontinuat «{0}» no esta suportat</string>
|
||||
<string name="select_max_zoom_preload_area">Selecciona el màxim zoom per precarregar</string>
|
||||
|
@ -1870,7 +1870,7 @@ La llista de països inclosos (bàsicament tot el món!): Afganistan, Albània,
|
|||
<string name="flat_list_waypoitns">Totes</string>
|
||||
<string name="waypoints">Fites</string>
|
||||
<string name="targets">Destinacions</string>
|
||||
<string name="way_alarms">Obstacles</string>
|
||||
<string name="way_alarms">Notificacions de tràfic</string>
|
||||
<string name="speak_favorites">Indica els preferits</string>
|
||||
<string name="speak_poi">Indica els PDI</string>
|
||||
<string name="index_tours">Itineraris</string>
|
||||
|
|
|
@ -1964,7 +1964,7 @@ Afghanistan, Albanien, Algeriet, Andorra, Angola, Anguilla, Antigua og Barbuda,
|
|||
<string name="flat_list_waypoitns">Alle</string>
|
||||
<string name="waypoints">Rutepunkter</string>
|
||||
<string name="targets">Destinationer</string>
|
||||
<string name="way_alarms">Forhindringer</string>
|
||||
<string name="way_alarms">Trafikadvarsler</string>
|
||||
<string name="speak_favorites">Favoritter</string>
|
||||
<string name="speak_poi">Interessepunkt (IP)</string>
|
||||
<string name="flat_list_waypoints">Alle</string>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<resources>
|
||||
<string name="speak_favorites">Nahegelegene Favoriten ankündigen</string>
|
||||
<string name="speak_poi">Nahegelegene POI ankündigen</string>
|
||||
<string name="tip_navigation">Navigation starten</string>
|
||||
<string name="tip_navigation_t">Die Route zu einem Ziel erhält man entweder durch direktes lang-anklicken eines Punktes in der Karte, (dann Kurzklick auf den Positionsmarker und das Auswählen des Menüpunktes \'Navigiere zu\'), oder über die Funktion \'Navigiere zu\' bei Klick auf ein Ergebnis einer Such-Liste oder einen Favoriten.
|
||||
\n\nDer Zielpunkt wird als orangefarbener Punkt auf der Karte markiert. Zu einem gewählten Ziel zeigt OsmAnd auf der Karte die Entfernung und die Richtung (orangefarbenes Dreieck) an.
|
||||
|
@ -1448,7 +1450,7 @@
|
|||
|
||||
<string name="speak_speed_limit">Höchstgeschwindigkeit ansagen</string>
|
||||
<string name="speak_cameras">Blitzer ansagen</string>
|
||||
<string name="speak_traffic_warnings">Verkehrsmeldungen ansagen</string>
|
||||
<string name="speak_traffic_warnings">Verkehrswarnungen ansagen</string>
|
||||
<string name="osb_author_or_password_not_specified">Bitte OSM-Nutzername und Passwort in den Einstellungen eingeben</string>
|
||||
<string name="clear_intermediate_points">Zwischenziele löschen</string>
|
||||
<string name="keep_intermediate_points">Zwischenziele behalten</string>
|
||||
|
@ -1963,9 +1965,7 @@ Afghanistan, Ägypten, Albanien, Algerien, Andorra, Angola, Anguilla, Antigua an
|
|||
<string name="flat_list_waypoints">Alle</string>
|
||||
<string name="waypoints">Wegpunkte</string>
|
||||
<string name="targets">Ziele</string>
|
||||
<string name="way_alarms">Hindernisse</string>
|
||||
<string name="speak_favorites">Favoriten ankündigen</string>
|
||||
<string name="speak_poi">POI ankündigen</string>
|
||||
<string name="way_alarms">Verkehrswarnungen</string>
|
||||
<string name="record_plugin_description">Speichern Sie Ihre Tracks mit einem Klick. Zeigt die Einstellung, wie Strecken aufgezeichnet werden – in lokale GPX-Dateien oder online via Web-Service.</string>
|
||||
<string name="route_descr_destination"/>
|
||||
</resources>
|
||||
|
|
|
@ -1803,9 +1803,9 @@ Afghanistan, Albanie, Algérie, Allemagne, Andorre, Angola, Anguilla, Antigua-et
|
|||
<string name="flat_list_waypoitns">Tous</string>
|
||||
<string name="waypoints">Points de cheminement</string>
|
||||
<string name="targets">Destinations</string>
|
||||
<string name="way_alarms">Obstacles</string>
|
||||
<string name="speak_favorites">Annoncer les favoris</string>
|
||||
<string name="speak_poi">Annoncer les points d\'intérêt</string>
|
||||
<string name="way_alarms">Alertes de circulation</string>
|
||||
<string name="speak_favorites">Annoncer les favoris proches</string>
|
||||
<string name="speak_poi">Annoncer les points d\'intérêt proches</string>
|
||||
<string name="flat_list_waypoints">Tous</string>
|
||||
<string name="index_tours">Tours</string>
|
||||
<string name="record_plugin_description">Enregistrer vos traces en touchant le bouton de l\'écran principal. Monter les paramètres pour l\'enregistrement des traces dans des fichiers GPX locaux ou en ligne avec un service Web.</string>
|
||||
|
|
|
@ -1740,9 +1740,9 @@
|
|||
<string name="flat_list_waypoints">Összes</string>
|
||||
<string name="waypoints">Útpontok</string>
|
||||
<string name="targets">Úti célok</string>
|
||||
<string name="way_alarms">Akadályok</string>
|
||||
<string name="speak_favorites">Kedvenc helyek</string>
|
||||
<string name="speak_poi">Érdekes helyek (POI)</string>
|
||||
<string name="way_alarms">Forgalmi figyelmeztetések</string>
|
||||
<string name="speak_favorites">Közeli kedvenc helyek</string>
|
||||
<string name="speak_poi">Közeli érdekes helyek (POI)</string>
|
||||
<string name="download_additional_maps">Letöltöd a hiányzó térképeket %1$s (%2$d MB)?</string>
|
||||
<string name="rendering_value_browse_map_name">Térképböngészés</string>
|
||||
<string name="rendering_value_car_name">Autó</string>
|
||||
|
|
|
@ -388,15 +388,13 @@
|
|||
\n\nJe kan een ander startpunt kiezen door het punt te selecteren op de kaart en \'Aanwijzingen vanaf\' te kiezen. Met navigatie wordt de route dan automatisch opnieuw berekend zodra je echte positie bekend is. Zo kan je snel starten op een plaats zonder GPS-ontvangst. Als je \'Toon route\' kiest wordt de route niet herberekend.
|
||||
</string>
|
||||
<string name="tip_search">Zoeken</string>
|
||||
<string name="tip_search_t">\tJe kan direct op de kaart naar plaatsen zoeken of zoeken naar een locatie (\'Kaartcontextmenu\' → \'Zoek hier dichtbij\'), of met het zoekscherm met \'Menu\' → \'Zoeken\'.
|
||||
\n\nOp het zoekscherm kan je zoeken:
|
||||
\n\t* op adres
|
||||
\n\t* op coördinaten
|
||||
\n\t* interessepunten (op categorie of op naam)
|
||||
\n\t* uit de zoekgeschiedenis
|
||||
\n\t* in de favorieten
|
||||
Kies daarna om er heen te navigeren, op de kaart te tonen, aan een route of de favorieten toe te voegen.
|
||||
</string>
|
||||
<string name="tip_search_t">"Je kan direct op de kaart naar plaatsen zoeken of zoeken naar een locatie (\'Kaartcontextmenu\' → \'Zoek hier dichtbij\'), of met het zoekscherm met \'Menu\' → \'Zoeken\'.
|
||||
\n\nOp het zoekscherm kan je zoeken:
|
||||
\n\t* op adres
|
||||
\n\t* op coördinaten
|
||||
\n\t* interessepunten (op categorie of op naam)
|
||||
\n\t* uit de zoekgeschiedenis
|
||||
\n\t* in de favorieten\n\nKies daarna om er heen te navigeren, op de kaart te tonen, of aan een route of de favorieten toe te voegen. "</string>
|
||||
<string name="tip_map_context_menu">Menu \'Gebruik locatie\'</string>
|
||||
<string name="tip_map_context_menu_t">\tHet contextmenu op de kaart biedt alle acties die te maken hebben met een punt op de kaart.
|
||||
\n\nHet wordt getoond als je (lang) op een punt op de kaart drukt en dan op de markering tikt, of door op de trackball-knop te drukken, of via \'Menu\' → \'Gebruik locatie\'.
|
||||
|
@ -404,7 +402,7 @@ Kies daarna om er heen te navigeren, op de kaart te tonen, aan een route of de f
|
|||
\n\tEen markering kan worden gesloten door er lang op te drukken.
|
||||
</string>
|
||||
<string name="tip_initial">Help</string>
|
||||
<string name="tip_initial_t">"OsmAnd is een navigatieprogramma met vele mogelijkheden.\n\nEen inleiding, tips en uitgebreide hulp zijn te vinden onder \'Menu\' → \'Help\', in het kaartscherm. "</string>
|
||||
<string name="tip_initial_t">"OsmAnd is een navigatieprogramma met vele mogelijkheden.\n\nEen inleiding, tips en hulp zijn te vinden onder \'Menu\' → \'Help\', in het kaartscherm. "</string>
|
||||
<string name="next_button">Volgende</string>
|
||||
<string name="previous_button">Vorige</string>
|
||||
<string name="unit_of_length_descr">Wijzig eenheden van afstand en snelheid</string>
|
||||
|
@ -1947,7 +1945,7 @@ Afghanistan, Albanie, Algerije, Andorra, Angola, Anguilla, Antigua en Barbuda, A
|
|||
<string name="flat_list_waypoitns">alle</string>
|
||||
<string name="waypoints">Routepunt(en)</string>
|
||||
<string name="targets">Bestemming(en)</string>
|
||||
<string name="way_alarms">Obstakel(s)</string>
|
||||
<string name="way_alarms">Filemeldingen</string>
|
||||
<string name="speak_favorites">Meld favorieten</string>
|
||||
<string name="speak_poi">Meld interessepunt (POI)</string>
|
||||
<string name="flat_list_waypoints">Alle</string>
|
||||
|
|
|
@ -1715,7 +1715,7 @@ Si cussigiat de annànghere unu o prus puntos intermedios pro megiorare sas pres
|
|||
<string name="flat_list_waypoitns">Totus</string>
|
||||
<string name="waypoints">Puntos mesanos</string>
|
||||
<string name="targets">Destinatziones</string>
|
||||
<string name="way_alarms">Impèigos</string>
|
||||
<string name="way_alarms">Avisos de tràficu</string>
|
||||
<string name="speak_favorites">Annùntzia Prefèrridos</string>
|
||||
<string name="speak_poi">Annùntzia PDI</string>
|
||||
<string name="flat_list_waypoints">Totus</string>
|
||||
|
|
|
@ -623,7 +623,7 @@
|
|||
<string name="replace_destination_point">Byt destination</string>
|
||||
<string name="new_destination_point_dialog">Du har redan en angiven destination.</string>
|
||||
<string name="target_point">Waypoint %1$s</string>
|
||||
<string name="target_points">Vägpunkter</string>
|
||||
<string name="target_points">Waypoints</string>
|
||||
<string name="intermediate_point_too_far">Waypointen %1$s för långt från närmaste väg.</string>
|
||||
<string name="arrived_at_intermediate_point">Du har anlänt till din waypoint</string>
|
||||
<string name="context_menu_item_intermediate_point">Lägg till som waypoint</string>
|
||||
|
@ -1671,7 +1671,7 @@
|
|||
<string name="flat_list_waypoitns">Alla</string>
|
||||
<string name="waypoints">Waypoints</string>
|
||||
<string name="targets">Mål</string>
|
||||
<string name="way_alarms">Hinder</string>
|
||||
<string name="way_alarms">Trafikskyltar</string>
|
||||
<string name="speak_favorites">Meddela favoriter</string>
|
||||
<string name="speak_poi">Meddela POI</string>
|
||||
<string name="index_tours">Rundturer</string>
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="speak_favorites">Announce nearby Favorites</string>
|
||||
<string name="speak_poi">Announce nearby POI</string>
|
||||
<string name="way_alarms">Traffic warnings</string>
|
||||
<string name="tip_navigation">Navigation</string>
|
||||
<string name="tip_navigation_t">To get directions to a place, either directly long-click on it on the map, (then tap its description marker and select \'Directions to\'), or select \'Directions to\' after tapping any entry in a search results list or favorite list.
|
||||
\n\nThe destination is marked as a target flag marker on the map and OsmAnd displays the distance to it and the direction to it (orange triangle).
|
||||
|
@ -63,9 +66,6 @@
|
|||
<string name="flat_list_waypoints">All</string>
|
||||
<string name="waypoints">Waypoints</string>
|
||||
<string name="targets">Destinations</string>
|
||||
<string name="way_alarms">Obstacles</string>
|
||||
<string name="speak_favorites">Announce Favorites</string>
|
||||
<string name="speak_poi">Announce POI</string>
|
||||
<string name="announce_gpx_waypoints">Announce GPX waypoints</string>
|
||||
<string name="download_additional_maps">Download missing maps %1$s (%2$d MB)?</string>
|
||||
<string name="more">More...</string>
|
||||
|
|
|
@ -825,7 +825,7 @@ public class OsmandSettings {
|
|||
public final OsmandPreference<Boolean> ANNOUNCE_NEARBY_POI = new BooleanPreference("announce_nearby_poi", false).makeProfile().cache();
|
||||
public final OsmandPreference<Boolean> SHOW_WPT = new BooleanPreference("show_gpx_wpt", true).makeGlobal().cache();
|
||||
public final OsmandPreference<Boolean> SHOW_NEARBY_POI = new BooleanPreference("show_nearby_poi", false).makeGlobal().cache();
|
||||
public final OsmandPreference<Boolean> SHOW_NEARBY_FAVORIES = new BooleanPreference("show_nearby_favorites", false).makeGlobal().cache();
|
||||
public final OsmandPreference<Boolean> SHOW_NEARBY_FAVORITES = new BooleanPreference("show_nearby_favorites", false).makeGlobal().cache();
|
||||
|
||||
public final OsmandPreference<Boolean> AVOID_TOLL_ROADS = new BooleanPreference("avoid_toll_roads", false).makeProfile().cache();
|
||||
public final OsmandPreference<Boolean> AVOID_MOTORWAY = new BooleanPreference("avoid_motorway", false).makeProfile().cache();
|
||||
|
|
|
@ -237,13 +237,13 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
|
|||
settings.SHOW_CAMERAS, settings.SHOW_LANES }, preference.getTitle());
|
||||
return true;
|
||||
} else if (preference == speakAlarms) {
|
||||
showBooleanSettings(new String[] { getString(R.string.speak_street_names), getString(R.string.speak_traffic_warnings), getString(R.string.speak_cameras),
|
||||
getString(R.string.speak_speed_limit),
|
||||
showBooleanSettings(new String[] { getString(R.string.speak_street_names), getString(R.string.speak_traffic_warnings),
|
||||
getString(R.string.speak_speed_limit), getString(R.string.speak_cameras),
|
||||
getString(R.string.speak_favorites),
|
||||
getString(R.string.speak_poi),
|
||||
getString(R.string.announce_gpx_waypoints)},
|
||||
new OsmandPreference[] { settings.SPEAK_STREET_NAMES, settings.SPEAK_TRAFFIC_WARNINGS,
|
||||
settings.SPEAK_SPEED_CAMERA , settings.SPEAK_SPEED_LIMIT,
|
||||
settings.SPEAK_SPEED_LIMIT, settings.SPEAK_SPEED_CAMERA,
|
||||
settings.ANNOUNCE_NEARBY_FAVORITES, settings.ANNOUNCE_NEARBY_POI, settings.ANNOUNCE_WPT}, preference.getTitle());
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ public class WaypointHelper {
|
|||
private int searchDeviationRadius = 500;
|
||||
private static final int LONG_ANNOUNCE_RADIUS = 700;
|
||||
private static final int SHORT_ANNOUNCE_RADIUS = 150;
|
||||
private static final int ALARMS_ANNOUNCE_RADIUS = 150;
|
||||
|
||||
OsmandApplication app;
|
||||
// every time we modify this collection, we change the reference (copy on write list)
|
||||
|
@ -193,13 +194,17 @@ public class WaypointHelper {
|
|||
|
||||
public void enableWaypointType(int type, boolean enable) {
|
||||
if(type == ALARMS) {
|
||||
app.getSettings().SHOW_TRAFFIC_WARNINGS.set(enable);
|
||||
app.getSettings().SPEAK_TRAFFIC_WARNINGS.set(enable);
|
||||
} else if(type == POI) {
|
||||
app.getSettings().SHOW_NEARBY_POI.set(enable);
|
||||
app.getSettings().ANNOUNCE_NEARBY_POI.set(enable);
|
||||
} else if(type == FAVORITES) {
|
||||
app.getSettings().SHOW_NEARBY_FAVORIES.set(enable);
|
||||
app.getSettings().SHOW_NEARBY_FAVORITES.set(enable);
|
||||
app.getSettings().ANNOUNCE_NEARBY_FAVORITES.set(enable);
|
||||
} else if(type == WAYPOINTS) {
|
||||
app.getSettings().SHOW_WPT.set(enable);
|
||||
app.getSettings().ANNOUNCE_WPT.set(enable);
|
||||
}
|
||||
recalculatePoints(route, type, locationPoints);
|
||||
}
|
||||
|
@ -221,13 +226,37 @@ public class WaypointHelper {
|
|||
|
||||
public boolean isTypeEnabled(int type) {
|
||||
if(type == ALARMS) {
|
||||
return showAlarms();
|
||||
} else if(type == POI) {
|
||||
return showPOI();
|
||||
} else if(type == FAVORITES) {
|
||||
return showFavorites();
|
||||
} else if(type == WAYPOINTS) {
|
||||
return showGPXWaypoints();
|
||||
return showAlarms() || announceAlarms();
|
||||
} else if (type == POI) {
|
||||
//sync SHOW (which has no item in nav settings) to automatically load points in the dialogue
|
||||
if (announcePOI()) {
|
||||
app.getSettings().SHOW_NEARBY_POI.set(true);
|
||||
} else {
|
||||
app.getSettings().SHOW_NEARBY_POI.set(false);
|
||||
}
|
||||
//no SHOW item in nav settings, hence only query ANNOUNCE here (makes inital Waypoint dialogue consistent with nav settings)
|
||||
//return showPOI() || announcePOI();
|
||||
return announcePOI();
|
||||
} else if (type == FAVORITES) {
|
||||
//sync SHOW (which has no item in nav settings) to automatically load points in the dialogue
|
||||
if (announceFavorites()) {
|
||||
app.getSettings().SHOW_NEARBY_FAVORITES.set(true);
|
||||
} else {
|
||||
app.getSettings().SHOW_NEARBY_FAVORITES.set(false);
|
||||
}
|
||||
//no SHOW item in nav settings, hence only query ANNOUNCE here (makes inital Waypoint dialogue consistent with nav settings)
|
||||
//return showFavorites() || announceFavorites();
|
||||
return announceFavorites();
|
||||
} else if (type == WAYPOINTS) {
|
||||
//sync SHOW (which has no item in nav settings) to automatically load points in the dialogue
|
||||
if (announceGPXWaypoints()) {
|
||||
app.getSettings().SHOW_WPT.set(true);
|
||||
} else {
|
||||
app.getSettings().SHOW_WPT.set(false);
|
||||
}
|
||||
//no SHOW item in nav settings, hence only query ANNOUNCE here (makes inital Waypoint dialogue consistent with nav settings)
|
||||
//return showGPXWaypoints() || announceGPXWaypoints();
|
||||
return announceGPXWaypoints();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -302,17 +331,19 @@ public class WaypointHelper {
|
|||
break;
|
||||
}
|
||||
LocationPoint point = lwp.point;
|
||||
double d1 = MapUtils.getDistance(lastKnownLocation.getLatitude(), lastKnownLocation.getLongitude(),
|
||||
point.getLatitude(), point.getLongitude()) + lwp.getDeviationDistance();
|
||||
double d1 = Math.max(0.0, MapUtils.getDistance(lastKnownLocation.getLatitude(), lastKnownLocation.getLongitude(),
|
||||
point.getLatitude(), point.getLongitude()) - lwp.getDeviationDistance());
|
||||
Integer state = locationPointsStates.get(point);
|
||||
if (state != null && state.intValue() == ANNOUNCED_ONCE
|
||||
&& getVoiceRouter()
|
||||
.isDistanceLess(lastKnownLocation.getSpeed(), d1, SHORT_ANNOUNCE_RADIUS)) {
|
||||
&& getVoiceRouter().isDistanceLess(lastKnownLocation.getSpeed(), d1, SHORT_ANNOUNCE_RADIUS)) {
|
||||
locationPointsStates.put(point, ANNOUNCED_DONE);
|
||||
announcePoints.add(lwp);
|
||||
} else if ((state == null || state == NOT_ANNOUNCED)
|
||||
&& getVoiceRouter()
|
||||
.isDistanceLess(lastKnownLocation.getSpeed(), d1, LONG_ANNOUNCE_RADIUS)) {
|
||||
} else if (type != ALARMS && (state == null || state == NOT_ANNOUNCED)
|
||||
&& getVoiceRouter().isDistanceLess(lastKnownLocation.getSpeed(), d1, LONG_ANNOUNCE_RADIUS)) {
|
||||
locationPointsStates.put(point, ANNOUNCED_ONCE);
|
||||
approachPoints.add(lwp);
|
||||
} else if (type == ALARMS && (state == null || state == NOT_ANNOUNCED)
|
||||
&& getVoiceRouter().isDistanceLess(lastKnownLocation.getSpeed(), d1, ALARMS_ANNOUNCE_RADIUS)) {
|
||||
locationPointsStates.put(point, ANNOUNCED_ONCE);
|
||||
approachPoints.add(lwp);
|
||||
}
|
||||
|
@ -336,7 +367,7 @@ public class WaypointHelper {
|
|||
getVoiceRouter().approachPoi(lastKnownLocation, approachPoints);
|
||||
} else if (type == ALARMS) {
|
||||
EnumSet<AlarmInfoType> ait = EnumSet.noneOf(AlarmInfoType.class);
|
||||
for(LocationPointWrapper pw : announcePoints) {
|
||||
for(LocationPointWrapper pw : approachPoints) {
|
||||
ait.add(((AlarmInfo) pw.point).getType());
|
||||
}
|
||||
for(AlarmInfoType t : ait) {
|
||||
|
@ -587,19 +618,26 @@ public class WaypointHelper {
|
|||
}
|
||||
|
||||
public boolean showFavorites() {
|
||||
return app.getSettings().SHOW_NEARBY_FAVORIES.get();
|
||||
}
|
||||
|
||||
public boolean showAlarms() {
|
||||
// I think this line was a bug:
|
||||
//return app.getSettings().SPEAK_SPEED_CAMERA.get() || app.getSettings().SPEAK_TRAFFIC_WARNINGS.get();
|
||||
return app.getSettings().SHOW_CAMERAS.get() || app.getSettings().SHOW_TRAFFIC_WARNINGS.get();
|
||||
return app.getSettings().SHOW_NEARBY_FAVORITES.get();
|
||||
}
|
||||
|
||||
public boolean announceFavorites() {
|
||||
return app.getSettings().ANNOUNCE_NEARBY_FAVORITES.get();
|
||||
}
|
||||
|
||||
|
||||
public boolean showAlarms() {
|
||||
//I think here only traffic warnings other than the speed cam are needed. speed cam setting is a separate setting for explicit allow/disallow by user.
|
||||
//return app.getSettings().SHOW_CAMERAS.get() || app.getSettings().SHOW_TRAFFIC_WARNINGS.get();
|
||||
return app.getSettings().SHOW_TRAFFIC_WARNINGS.get();
|
||||
}
|
||||
|
||||
public boolean announceAlarms() {
|
||||
//I think here only traffic warnings other than the speed cam are needed. speed cam setting is a separate setting for explicit allow/disallow by user.
|
||||
//return app.getSettings().SPEAK_SPEED_CAMERA.get() || app.getSettings().SPEAK_TRAFFIC_WARNINGS.get();
|
||||
return app.getSettings().SPEAK_TRAFFIC_WARNINGS.get();
|
||||
}
|
||||
|
||||
|
||||
public class LocationPointWrapper {
|
||||
LocationPoint point;
|
||||
float deviationDistance;
|
||||
|
@ -646,8 +684,12 @@ public class WaypointHelper {
|
|||
return uiCtx.getResources().getDrawable(
|
||||
!((TargetPoint)point).intermediate? R.drawable.list_destination:
|
||||
R.drawable.list_intermediate);
|
||||
} else {
|
||||
} else if(type == FAVORITES || type == WAYPOINTS) {
|
||||
return FavoriteImageDrawable.getOrCreate(uiCtx, point.getColor());
|
||||
} else if(type == ALARMS) {
|
||||
return null;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue