From 54700513a72cea82ab7f9c1dbdb87239dee53f0b Mon Sep 17 00:00:00 2001 From: Adam Voss Date: Sun, 27 Aug 2017 15:38:03 -0500 Subject: [PATCH 1/6] Remove "Get it on F-Droid" from README According to https://github.com/osmandapp/Osmand/issues/4329#issuecomment-324415127 (and others) F-Droid is not an official publication target and not supported by this repository. The F-Droid badge gives the impression it is official so removing the badge helps to clarify this misconception. --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 2e64fb03dc..859ab4203f 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,6 @@ You are welcome to discuss any question regarding the project at the Google grou Get it on Google Play Get it on Amazon - -Get it on F-Droid Get it on AppStore From bae3931f05e7e2f3ecad670d5aa4fefa265238df Mon Sep 17 00:00:00 2001 From: Verdulo Date: Sun, 27 Aug 2017 21:08:10 +0000 Subject: [PATCH 2/6] Translated using Weblate (Polish) Currently translated at 100.0% (3167 of 3167 strings) --- OsmAnd/res/values-pl/phrases.xml | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-pl/phrases.xml b/OsmAnd/res/values-pl/phrases.xml index 1c9c0abb62..d5295f4e74 100644 --- a/OsmAnd/res/values-pl/phrases.xml +++ b/OsmAnd/res/values-pl/phrases.xml @@ -3479,4 +3479,29 @@ Kierunek: dół Pokój zimowy: tak Pokój zimowy: nie - + Wypożyczane łodzie + +Uwalnianie: tak + Uwalnianie: nie + + Kosmodrom + + Wypożyczalnia łodzi + Motorówki: tak + Motorówki: nie + Barki mieszkalne: tak + Barki mieszkalne: nie + Rowery wodne: tak + Rowery wodne: nie + Skutery wodne: tak + Skutery wodne: nie + Żaglówki: tak + Żaglówki: nie + Łodzie wiosłowe: tak + Łodzie wiosłowe: nie + Kajaki: tak + Kajaki: nie + Kanadyjki: tak + Kanadyjki: nie + + From 7b345337e8fd0290d2a35ec4cfe042e809f690e3 Mon Sep 17 00:00:00 2001 From: jan madsen Date: Sun, 27 Aug 2017 08:17:56 +0000 Subject: [PATCH 3/6] Translated using Weblate (Danish) Currently translated at 100.0% (2400 of 2400 strings) --- OsmAnd/res/values-da/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/res/values-da/strings.xml b/OsmAnd/res/values-da/strings.xml index 42845c9a1e..108e3cb495 100644 --- a/OsmAnd/res/values-da/strings.xml +++ b/OsmAnd/res/values-da/strings.xml @@ -2844,7 +2844,7 @@ Tidligere destination bliver sidste mellemliggende punkt. Tilføj punkt før Tilføj punkt efter Indstillinger - OsmAnd vil tilføje yderligere punkter, tilpasset typen af navigation. + Tilføjer yderligere punkter, tilpasset typen af navigation. Gem punkterne enten som rutepunkter eller som en linje. Vælg navigationstype Tilføj rutepunkter From 24d837c9ff08e343741d61c03ad214d71fe08065 Mon Sep 17 00:00:00 2001 From: Massimiliano Caniparoli Date: Sun, 27 Aug 2017 12:42:28 +0000 Subject: [PATCH 4/6] Translated using Weblate (Italian) Currently translated at 98.1% (2356 of 2400 strings) --- OsmAnd/res/values-it/strings.xml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/OsmAnd/res/values-it/strings.xml b/OsmAnd/res/values-it/strings.xml index 814416d5f1..512c73f1fc 100644 --- a/OsmAnd/res/values-it/strings.xml +++ b/OsmAnd/res/values-it/strings.xml @@ -2620,28 +2620,28 @@ Rappresenta l\'area: %1$s x %2$s La sorgente della mappa è stata cambiata in \"%s\". Cambia la posizione del pulsante Tieni premuto e trascina per cambiare la sua posizione nello schermo - Linee isoipse marine + Isoipse nautiche Divisione automatica delle registrazioni dopo un periodo Inizia un nuovo segmento dopo 6 minuti, una nuova traccia dopo 2 ore, o un nuovo file dopo un intervallo maggiore. Mostra contorni e punti in profondità - "\\u2022 Nuove funzionalità: Pulsante azione veloce -\n + "• Nuove funzionalità: Pulsante azione veloce +\n \n • Migliorata la risposta del touch screen ai gesti (es. zoommare e allargare) \n \n • Nuovi caratteri della mappa mappa per estendere la copertura di più lingue -\n +\n \n • Supporto TTS per le lingue locali (e accenti) -\n +\n \n • Miglioramento della visibilità in molti stili mappa e wikipedia -\n +\n \n • Supporto all\'Open Location Code (OLC) -\n +\n \n • Visualizzazione di un profilo altimetrico, pendenza, e velocità per i GPX registrati e percorsi calcolati -\n +\n \n • Impostazione e miglioramenti della logica dello \"Stile guida\" nella guida svolta per svolta in bicicletta -\n +\n \n • Molti altri miglioramenti e correzioni di errori -\n +\n \n e altro ancora…" Stile di guida @@ -2654,7 +2654,7 @@ Rappresenta l\'area: %1$s x %2$s Distanza totale Più piatto o più colline - Utilizza dati elevazione + Utilizza dati di quota Utilizza i dati di elevazione del terreno forniti da SRTM, ASTER e EU-DEM Intervallo di tempo @@ -2858,7 +2858,7 @@ Copertura e qualità approssimativamente: \n \n • Widget righello per la misurazione della distanza \n -\n • Informazioni dettagliate e suddivisore delle tue tracce GPX +\n • Scelta degli intervalli delle tracce GPX con informazioni dettagliate sul tuo percorso \n \n • Altre migliorie e correzioni di errori \n @@ -2882,7 +2882,7 @@ Copertura e qualità approssimativamente: Aggiungi un punto prima Aggiungi un punto dopo Opzioni - OsmAnd aggiugerà dei punti, in base al tipo di navigazione. + OsmAnd aggiungerà dei punti, in base al tipo di navigazione. Puoi salvare i punti sia come punti di un percorso che come linea. Scegli la modalità di navigazione From 437a24d3647dea339d50ece73bbae0dc3622d5bd Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sun, 27 Aug 2017 23:38:54 +0200 Subject: [PATCH 5/6] Add new class --- .../osmand/binary/BinaryMapIndexReader.java | 5 + .../src/net/osmand/binary/MapZooms.java | 137 ++++++++++++++++++ 2 files changed, 142 insertions(+) create mode 100644 OsmAnd-java/src/net/osmand/binary/MapZooms.java diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java b/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java index 0086ed7950..32d20bec6d 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java @@ -1906,6 +1906,11 @@ public class BinaryMapIndexReader { } private List trees = null; + + + public MapZooms.MapZoomPair getMapZoom() { + return new MapZooms.MapZoomPair(minZoom, maxZoom); + } } private static class MapTree { diff --git a/OsmAnd-java/src/net/osmand/binary/MapZooms.java b/OsmAnd-java/src/net/osmand/binary/MapZooms.java new file mode 100644 index 0000000000..faaade2457 --- /dev/null +++ b/OsmAnd-java/src/net/osmand/binary/MapZooms.java @@ -0,0 +1,137 @@ +package net.osmand.binary; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +public class MapZooms { + + public static class MapZoomPair { + public static int MAX_ALLOWED_ZOOM = 22; + private int minZoom; + private int maxZoom; + + public MapZoomPair(int minZoom, int maxZoom) { + this.maxZoom = maxZoom; + this.minZoom = minZoom; + } + + public int getMinZoom() { + return minZoom; + } + + public int getMaxZoom() { + return maxZoom; + } + + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + maxZoom; + result = prime * result + minZoom; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + MapZoomPair other = (MapZoomPair) obj; + if (maxZoom != other.maxZoom) + return false; + if (minZoom != other.minZoom) + return false; + return true; + } + + @Override + public String toString() { + return "MapZoomPair : " + minZoom + " - "+ maxZoom; + } + } + + private List levels = new ArrayList(); + private boolean simplify; + + + public List getLevels() { + return levels; + } + + public void setLevels(List levels) { + this.levels = levels; + Collections.sort(levels, new Comparator() { + + @Override + public int compare(MapZoomPair o1, MapZoomPair o2) { + return -new Integer(o1.getMaxZoom()).compareTo(o2.getMaxZoom()); + } + }); + } + /** + * @param zooms - could be 5-8;7-10;11-14;15- + */ + public static MapZooms parseZooms(String zooms) throws IllegalArgumentException { + String[] split = zooms.split(";"); + + + int zeroLevel = 15; + List list = new ArrayList(); + for(String s : split){ + s = s.trim(); + if(s.length() == 0) { + continue; + } + int i = s.indexOf('-'); + if (i == -1) { + zeroLevel = Integer.parseInt(s); + list.add(0, new MapZoomPair(zeroLevel, zeroLevel)); + } else if(s.endsWith("-")){ + list.add(0, new MapZoomPair(Integer.parseInt(s.substring(0, i)), MapZoomPair.MAX_ALLOWED_ZOOM)); + } else { + list.add(0, new MapZoomPair(Integer.parseInt(s.substring(0, i)), Integer.parseInt(s.substring(i + 1)))); + } + } + if(list.size() < 1 || list.size() > 8){ + throw new IllegalArgumentException("Map zooms should have at least 1 level and less than 8 levels"); + } + MapZooms mapZooms = new MapZooms(); + mapZooms.setSimplify(zooms.endsWith(";")); + mapZooms.setLevels(list); + return mapZooms; + } + + private void setSimplify(boolean simplify) { + this.simplify = simplify; + } + + public boolean isDetailedZoomSimplified() { + return simplify; + } + + public int size(){ + return levels.size(); + } + + public MapZoomPair getLevel(int level){ + return levels.get(level); + } + + private static MapZooms DEFAULT = null; + public static String MAP_ZOOMS_DEFAULT = "11;12;13-14;15-"; + public static MapZooms getDefault(){ + if(DEFAULT == null){ + DEFAULT = parseZooms(MAP_ZOOMS_DEFAULT); + } + return DEFAULT; + + } + +} From 1a9fff8754d930bbfa63645cc9768ec9e7a485e7 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Mon, 28 Aug 2017 00:09:55 +0200 Subject: [PATCH 6/6] Make sure objects are adopted --- .../osmand/binary/BinaryMapDataObject.java | 1 - .../osmand/binary/BinaryMapIndexReader.java | 72 +++++++++++++++++++ 2 files changed, 72 insertions(+), 1 deletion(-) diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryMapDataObject.java b/OsmAnd-java/src/net/osmand/binary/BinaryMapDataObject.java index d070cdbfd2..f6a2fe2640 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryMapDataObject.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryMapDataObject.java @@ -6,7 +6,6 @@ import gnu.trove.map.hash.TIntObjectHashMap; import java.util.Arrays; import java.util.LinkedHashMap; import java.util.Map; -import java.util.TreeSet; import net.osmand.binary.BinaryMapIndexReader.MapIndex; import net.osmand.binary.BinaryMapIndexReader.TagValuePair; diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java b/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java index 32d20bec6d..1c87fef158 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java @@ -1742,6 +1742,7 @@ public class BinaryMapIndexReader { } return null; } + public LatLon getCenterLatLon() { if(roots.size() == 0) { @@ -1760,6 +1761,14 @@ public class BinaryMapIndexReader { public TagValuePair decodeType(int type) { return decodingRules.get(type); } + + public Integer getRule(TagValuePair tv) { + Map m = encodingRules.get(tv.tag); + if (m != null) { + return m.get(tv.value); + } + return null; + } public void finishInitializingTags() { int free = decodingRules.size(); @@ -1824,6 +1833,69 @@ public class BinaryMapIndexReader { public int getFieldNumber() { return OsmandOdb.OsmAndStructure.MAPINDEX_FIELD_NUMBER; } + + public BinaryMapDataObject adoptMapObject(BinaryMapDataObject o) { + if(o.mapIndex == this) { + return o; + } + if(encodingRules.isEmpty()) { + encodingRules.putAll(o.mapIndex.encodingRules); + decodingRules.putAll(o.mapIndex.decodingRules); + return o; + } + TIntArrayList types = new TIntArrayList(); + TIntArrayList additionalTypes = new TIntArrayList(); + if (o.types != null) { + for (int i = 0; i < o.types.length; i++) { + TagValuePair tp = o.mapIndex.decodeType(o.types[i]); + Integer r = getRule(tp); + if(r != null) { + types.add(r); + } else { + int nid = decodingRules.size(); + initMapEncodingRule(tp.additionalAttribute, decodingRules.size(), tp.tag, tp.value); + types.add(nid); + } + } + } + if (o.additionalTypes != null) { + for (int i = 0; i < o.additionalTypes.length; i++) { + TagValuePair tp = o.mapIndex.decodeType(o.additionalTypes[i]); + Integer r = getRule(tp); + if(r != null) { + additionalTypes.add(r); + } else { + int nid = decodingRules.size(); + initMapEncodingRule(tp.additionalAttribute, decodingRules.size(), tp.tag, tp.value); + additionalTypes.add(nid); + } + } + } + + BinaryMapDataObject bm = + new BinaryMapDataObject(o.id, o.coordinates, o.polygonInnerCoordinates, o.objectType, o.area, + types.toArray(), additionalTypes.isEmpty() ? null : additionalTypes.toArray()); + if (o.namesOrder != null) { + bm.objectNames = new TIntObjectHashMap<>(); + bm.namesOrder = new TIntArrayList(); + for (int i = 0; i < o.namesOrder.size(); i++) { + int nameType = o.namesOrder.get(i); + String name = o.objectNames.get(nameType); + TagValuePair tp = o.mapIndex.decodeType(nameType); + Integer r = getRule(tp); + if(r != null) { + bm.namesOrder.add(r); + bm.objectNames.put(r, name); + } else { + int nid = decodingRules.size(); + initMapEncodingRule(tp.additionalAttribute, decodingRules.size(), tp.tag, tp.value); + additionalTypes.add(nid); + bm.objectNames.put(nid, name); + } + } + } + return bm; + } } public static class TagValuePair {