Merge branch 'master' of ssh://github.com/osmandapp/Osmand into sasha_pasha_branch
This commit is contained in:
commit
021766c587
7 changed files with 254 additions and 18 deletions
|
@ -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;
|
||||
|
|
|
@ -1743,6 +1743,7 @@ public class BinaryMapIndexReader {
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
public LatLon getCenterLatLon() {
|
||||
if(roots.size() == 0) {
|
||||
return null;
|
||||
|
@ -1761,6 +1762,14 @@ public class BinaryMapIndexReader {
|
|||
return decodingRules.get(type);
|
||||
}
|
||||
|
||||
public Integer getRule(TagValuePair tv) {
|
||||
Map<String, Integer> m = encodingRules.get(tv.tag);
|
||||
if (m != null) {
|
||||
return m.get(tv.value);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void finishInitializingTags() {
|
||||
int free = decodingRules.size();
|
||||
coastlineBrokenEncodingType = free++;
|
||||
|
@ -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 {
|
||||
|
@ -1906,6 +1978,11 @@ public class BinaryMapIndexReader {
|
|||
}
|
||||
|
||||
private List<MapTree> trees = null;
|
||||
|
||||
|
||||
public MapZooms.MapZoomPair getMapZoom() {
|
||||
return new MapZooms.MapZoomPair(minZoom, maxZoom);
|
||||
}
|
||||
}
|
||||
|
||||
private static class MapTree {
|
||||
|
|
137
OsmAnd-java/src/net/osmand/binary/MapZooms.java
Normal file
137
OsmAnd-java/src/net/osmand/binary/MapZooms.java
Normal file
|
@ -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<MapZoomPair> levels = new ArrayList<MapZoomPair>();
|
||||
private boolean simplify;
|
||||
|
||||
|
||||
public List<MapZoomPair> getLevels() {
|
||||
return levels;
|
||||
}
|
||||
|
||||
public void setLevels(List<MapZoomPair> levels) {
|
||||
this.levels = levels;
|
||||
Collections.sort(levels, new Comparator<MapZoomPair>() {
|
||||
|
||||
@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<MapZoomPair> list = new ArrayList<MapZoomPair>();
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -2844,7 +2844,7 @@ Tidligere destination bliver sidste mellemliggende punkt.</string>
|
|||
<string name="add_point_before">Tilføj punkt før</string>
|
||||
<string name="add_point_after">Tilføj punkt efter</string>
|
||||
<string name="shared_string_options">Indstillinger</string>
|
||||
<string name="measurement_tool_snap_to_road_descr">OsmAnd vil tilføje yderligere punkter, tilpasset typen af navigation.</string>
|
||||
<string name="measurement_tool_snap_to_road_descr">Tilføjer yderligere punkter, tilpasset typen af navigation.</string>
|
||||
<string name="measurement_tool_save_as_new_track_descr">Gem punkterne enten som rutepunkter eller som en linje.</string>
|
||||
<string name="choose_navigation_type">Vælg navigationstype</string>
|
||||
<string name="add_route_points">Tilføj rutepunkter</string>
|
||||
|
|
|
@ -2620,11 +2620,11 @@ Rappresenta l\'area: %1$s x %2$s</string>
|
|||
<string name="quick_action_map_source_switch">La sorgente della mappa è stata cambiata in \"%s\".</string>
|
||||
<string name="quick_action_btn_tutorial_title">Cambia la posizione del pulsante</string>
|
||||
<string name="quick_action_btn_tutorial_descr">Tieni premuto e trascina per cambiare la sua posizione nello schermo</string>
|
||||
<string name="rendering_attr_depthContours_name">Linee isoipse marine</string>
|
||||
<string name="rendering_attr_depthContours_name">Isoipse nautiche</string>
|
||||
<string name="auto_split_recording_title">Divisione automatica delle registrazioni dopo un periodo</string>
|
||||
<string name="auto_split_recording_descr">Inizia un nuovo segmento dopo 6 minuti, una nuova traccia dopo 2 ore, o un nuovo file dopo un intervallo maggiore.</string>
|
||||
<string name="rendering_attr_depthContours_description">Mostra contorni e punti in profondità</string>
|
||||
<string name="release_2_6">"\\u2022 Nuove funzionalità: Pulsante azione veloce
|
||||
<string name="release_2_6">"• Nuove funzionalità: Pulsante azione veloce
|
||||
\n
|
||||
\n • Migliorata la risposta del touch screen ai gesti (es. zoommare e allargare)
|
||||
\n
|
||||
|
@ -2654,7 +2654,7 @@ Rappresenta l\'area: %1$s x %2$s</string>
|
|||
<string name="total_distance">Distanza totale</string>
|
||||
|
||||
<string name="routing_attr_height_relief_smoothness_factor_description">Più piatto o più colline</string>
|
||||
<string name="routing_attr_height_obstacles_name">Utilizza dati elevazione</string>
|
||||
<string name="routing_attr_height_obstacles_name">Utilizza dati di quota</string>
|
||||
<string name="routing_attr_height_obstacles_description">Utilizza i dati di elevazione del terreno forniti da SRTM, ASTER e EU-DEM</string>
|
||||
|
||||
<string name="shared_string_time_span">Intervallo di tempo</string>
|
||||
|
@ -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:
|
|||
<string name="add_point_before">Aggiungi un punto prima</string>
|
||||
<string name="add_point_after">Aggiungi un punto dopo</string>
|
||||
<string name="shared_string_options">Opzioni</string>
|
||||
<string name="measurement_tool_snap_to_road_descr">OsmAnd aggiugerà dei punti, in base al tipo di navigazione.</string>
|
||||
<string name="measurement_tool_snap_to_road_descr">OsmAnd aggiungerà dei punti, in base al tipo di navigazione.</string>
|
||||
<string name="measurement_tool_save_as_new_track_descr">Puoi salvare i punti sia come punti di un percorso che come linea.</string>
|
||||
<string name="choose_navigation_type">Scegli la modalità di navigazione</string>
|
||||
</resources>
|
||||
|
|
|
@ -3479,4 +3479,29 @@
|
|||
<string name="poi_direction_down">Kierunek: dół</string>
|
||||
<string name="poi_winter_room_yes">Pokój zimowy: tak</string>
|
||||
<string name="poi_winter_room_no">Pokój zimowy: nie</string>
|
||||
</resources>
|
||||
<string name="poi_boat_rental_type">Wypożyczane łodzie</string>
|
||||
|
||||
<string name="poi_animal_shelter_purpose_release_yes">Uwalnianie: tak</string>
|
||||
<string name="poi_animal_shelter_purpose_release_no">Uwalnianie: nie</string>
|
||||
|
||||
<string name="poi_spaceport">Kosmodrom</string>
|
||||
|
||||
<string name="poi_boat_rental">Wypożyczalnia łodzi</string>
|
||||
<string name="poi_boat_motorboat_rental_yes">Motorówki: tak</string>
|
||||
<string name="poi_boat_motorboat_rental_no">Motorówki: nie</string>
|
||||
<string name="poi_boat_houseboat_rental_yes">Barki mieszkalne: tak</string>
|
||||
<string name="poi_boat_houseboat_rental_no">Barki mieszkalne: nie</string>
|
||||
<string name="poi_boat_pedalboat_rental_yes">Rowery wodne: tak</string>
|
||||
<string name="poi_boat_pedalboat_rental_no">Rowery wodne: nie</string>
|
||||
<string name="poi_boat_jetski_rental_yes">Skutery wodne: tak</string>
|
||||
<string name="poi_boat_jetski_rental_no">Skutery wodne: nie</string>
|
||||
<string name="poi_boat_sailboat_rental_yes">Żaglówki: tak</string>
|
||||
<string name="poi_boat_sailboat_rental_no">Żaglówki: nie</string>
|
||||
<string name="poi_boat_dinghy_rental_rental_yes">Łodzie wiosłowe: tak</string>
|
||||
<string name="poi_boat_dinghy_rental_rental_no">Łodzie wiosłowe: nie</string>
|
||||
<string name="poi_boat_kayak_rental_rental_yes">Kajaki: tak</string>
|
||||
<string name="poi_boat_kayak_rental_rental_no">Kajaki: nie</string>
|
||||
<string name="poi_boat_canoe_rental_rental_yes">Kanadyjki: tak</string>
|
||||
<string name="poi_boat_canoe_rental_rental_no">Kanadyjki: nie</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -8,8 +8,6 @@ You are welcome to discuss any question regarding the project at the Google grou
|
|||
<img src="https://raw.githubusercontent.com/osmandapp/osmandapp.github.io/9fc59e5136b6a07045eb96d052b3ce6ddde805c3/website/images/help/badge_store_google_play.png" alt="Get it on Google Play" height="60"/></a>
|
||||
<a href="https://www.amazon.com/OsmAnd-Maps-Navigation/dp/B00D0SA8I8" target="_blank">
|
||||
<img src="https://raw.githubusercontent.com/osmandapp/osmandapp.github.io/9fc59e5136b6a07045eb96d052b3ce6ddde805c3/website/images/help/badge_store_amazon.png" alt="Get it on Amazon" height="60"/></a>
|
||||
<a href="https://f-droid.org/repository/browse/?fdid=net.osmand.plus" target="_blank">
|
||||
<img src="https://raw.githubusercontent.com/osmandapp/osmandapp.github.io/9fc59e5136b6a07045eb96d052b3ce6ddde805c3/website/images/help/badge_store_fdroid.png" alt="Get it on F-Droid" height="60"/></a>
|
||||
<a href="https://itunes.apple.com/app/apple-store/id934850257?mt=8" target="_blank">
|
||||
<img src="https://raw.githubusercontent.com/osmandapp/osmandapp.github.io/9fc59e5136b6a07045eb96d052b3ce6ddde805c3/website/images/help/badge_store_appstore.png" alt="Get it on AppStore" height="60"/></a>
|
||||
|
||||
|
|
Loading…
Reference in a new issue