From 802c52c860755de3dbcc43f05aec907be21cf891 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sun, 19 Jun 2011 19:06:35 +0200 Subject: [PATCH] Implement base map layer. Fix some bugs --- .../src/net/osmand/ToDoConstants.java | 3 + .../src/net/osmand/data/Boundary.java | 37 +-- .../src/net/osmand/data/MapAlgorithms.java | 139 ++++++++++ .../osmand/data/preparation/IndexCreator.java | 34 ++- .../preparation/IndexVectorMapCreator.java | 41 ++- .../net/osmand/data/preparation/MapZooms.java | 16 +- .../src/net/osmand/osm/MapRenderingTypes.java | 16 +- DataExtractionOSM/src/net/osmand/osm/Way.java | 6 +- .../src/net/osmand/osm/rendering_types.xml | 17 +- .../osmand/osm/util/FixLinkedCoastline.java | 244 ++++++++++++++++++ .../src/net/osmand/render/default.render.xml | 16 +- OsmAnd/res/drawable/h_city.png | Bin 0 -> 250 bytes OsmAnd/res/drawable/h_mot_shield1.png | Bin 0 -> 412 bytes OsmAnd/res/drawable/h_mot_shield2.png | Bin 0 -> 439 bytes OsmAnd/res/drawable/h_mot_shield3.png | Bin 0 -> 441 bytes OsmAnd/res/drawable/h_mot_shield4.png | Bin 0 -> 445 bytes OsmAnd/res/drawable/h_mot_shield5.png | Bin 0 -> 446 bytes OsmAnd/res/drawable/h_mot_shield6.png | Bin 0 -> 447 bytes OsmAnd/res/drawable/h_mot_shield7.png | Bin 0 -> 447 bytes OsmAnd/res/drawable/h_mot_shield8.png | Bin 0 -> 450 bytes OsmAnd/res/drawable/h_pri_shield1.png | Bin 0 -> 422 bytes OsmAnd/res/drawable/h_pri_shield2.png | Bin 0 -> 431 bytes OsmAnd/res/drawable/h_pri_shield3.png | Bin 0 -> 433 bytes OsmAnd/res/drawable/h_pri_shield4.png | Bin 0 -> 437 bytes OsmAnd/res/drawable/h_pri_shield5.png | Bin 0 -> 439 bytes OsmAnd/res/drawable/h_pri_shield6.png | Bin 0 -> 440 bytes OsmAnd/res/drawable/h_pri_shield7.png | Bin 0 -> 440 bytes OsmAnd/res/drawable/h_pri_shield8.png | Bin 0 -> 442 bytes OsmAnd/res/drawable/h_sec_shield1.png | Bin 0 -> 422 bytes OsmAnd/res/drawable/h_sec_shield2.png | Bin 0 -> 431 bytes OsmAnd/res/drawable/h_sec_shield3.png | Bin 0 -> 433 bytes OsmAnd/res/drawable/h_sec_shield4.png | Bin 0 -> 437 bytes OsmAnd/res/drawable/h_sec_shield5.png | Bin 0 -> 439 bytes OsmAnd/res/drawable/h_sec_shield6.png | Bin 0 -> 440 bytes OsmAnd/res/drawable/h_sec_shield7.png | Bin 0 -> 440 bytes OsmAnd/res/drawable/h_sec_shield8.png | Bin 0 -> 442 bytes OsmAnd/res/drawable/h_ter_shield1.png | Bin 0 -> 422 bytes OsmAnd/res/drawable/h_ter_shield2.png | Bin 0 -> 431 bytes OsmAnd/res/drawable/h_ter_shield3.png | Bin 0 -> 433 bytes OsmAnd/res/drawable/h_ter_shield4.png | Bin 0 -> 437 bytes OsmAnd/res/drawable/h_ter_shield5.png | Bin 0 -> 439 bytes OsmAnd/res/drawable/h_ter_shield6.png | Bin 0 -> 440 bytes OsmAnd/res/drawable/h_ter_shield7.png | Bin 0 -> 440 bytes OsmAnd/res/drawable/h_ter_shield8.png | Bin 0 -> 442 bytes OsmAnd/res/drawable/h_tru_shield1.png | Bin 0 -> 422 bytes OsmAnd/res/drawable/h_tru_shield2.png | Bin 0 -> 431 bytes OsmAnd/res/drawable/h_tru_shield3.png | Bin 0 -> 433 bytes OsmAnd/res/drawable/h_tru_shield4.png | Bin 0 -> 437 bytes OsmAnd/res/drawable/h_tru_shield5.png | Bin 0 -> 441 bytes OsmAnd/res/drawable/h_tru_shield6.png | Bin 0 -> 440 bytes OsmAnd/res/drawable/h_tru_shield7.png | Bin 0 -> 440 bytes OsmAnd/res/drawable/h_tru_shield8.png | Bin 0 -> 442 bytes OsmAnd/res/values/strings.xml | 2 +- .../src/net/osmand/plus/OsmandSettings.java | 2 +- .../plus/activities/MainMenuActivity.java | 9 +- .../plus/activities/SettingsActivity.java | 2 +- .../osmand/plus/render/MapVectorLayer.java | 12 +- .../osmand/plus/render/OsmandRenderer.java | 4 +- .../osmand/plus/render/RenderingIcons.java | 194 ++------------ config/basemap/README | 14 + config/basemap/shp2osm.pl | 167 ++++++++++++ 61 files changed, 712 insertions(+), 263 deletions(-) create mode 100644 DataExtractionOSM/src/net/osmand/osm/util/FixLinkedCoastline.java create mode 100644 OsmAnd/res/drawable/h_city.png create mode 100644 OsmAnd/res/drawable/h_mot_shield1.png create mode 100644 OsmAnd/res/drawable/h_mot_shield2.png create mode 100644 OsmAnd/res/drawable/h_mot_shield3.png create mode 100644 OsmAnd/res/drawable/h_mot_shield4.png create mode 100644 OsmAnd/res/drawable/h_mot_shield5.png create mode 100644 OsmAnd/res/drawable/h_mot_shield6.png create mode 100644 OsmAnd/res/drawable/h_mot_shield7.png create mode 100644 OsmAnd/res/drawable/h_mot_shield8.png create mode 100644 OsmAnd/res/drawable/h_pri_shield1.png create mode 100644 OsmAnd/res/drawable/h_pri_shield2.png create mode 100644 OsmAnd/res/drawable/h_pri_shield3.png create mode 100644 OsmAnd/res/drawable/h_pri_shield4.png create mode 100644 OsmAnd/res/drawable/h_pri_shield5.png create mode 100644 OsmAnd/res/drawable/h_pri_shield6.png create mode 100644 OsmAnd/res/drawable/h_pri_shield7.png create mode 100644 OsmAnd/res/drawable/h_pri_shield8.png create mode 100644 OsmAnd/res/drawable/h_sec_shield1.png create mode 100644 OsmAnd/res/drawable/h_sec_shield2.png create mode 100644 OsmAnd/res/drawable/h_sec_shield3.png create mode 100644 OsmAnd/res/drawable/h_sec_shield4.png create mode 100644 OsmAnd/res/drawable/h_sec_shield5.png create mode 100644 OsmAnd/res/drawable/h_sec_shield6.png create mode 100644 OsmAnd/res/drawable/h_sec_shield7.png create mode 100644 OsmAnd/res/drawable/h_sec_shield8.png create mode 100644 OsmAnd/res/drawable/h_ter_shield1.png create mode 100644 OsmAnd/res/drawable/h_ter_shield2.png create mode 100644 OsmAnd/res/drawable/h_ter_shield3.png create mode 100644 OsmAnd/res/drawable/h_ter_shield4.png create mode 100644 OsmAnd/res/drawable/h_ter_shield5.png create mode 100644 OsmAnd/res/drawable/h_ter_shield6.png create mode 100644 OsmAnd/res/drawable/h_ter_shield7.png create mode 100644 OsmAnd/res/drawable/h_ter_shield8.png create mode 100644 OsmAnd/res/drawable/h_tru_shield1.png create mode 100644 OsmAnd/res/drawable/h_tru_shield2.png create mode 100644 OsmAnd/res/drawable/h_tru_shield3.png create mode 100644 OsmAnd/res/drawable/h_tru_shield4.png create mode 100644 OsmAnd/res/drawable/h_tru_shield5.png create mode 100644 OsmAnd/res/drawable/h_tru_shield6.png create mode 100644 OsmAnd/res/drawable/h_tru_shield7.png create mode 100644 OsmAnd/res/drawable/h_tru_shield8.png create mode 100644 config/basemap/README create mode 100755 config/basemap/shp2osm.pl diff --git a/DataExtractionOSM/src/net/osmand/ToDoConstants.java b/DataExtractionOSM/src/net/osmand/ToDoConstants.java index 35a5056ff7..42511a1988 100644 --- a/DataExtractionOSM/src/net/osmand/ToDoConstants.java +++ b/DataExtractionOSM/src/net/osmand/ToDoConstants.java @@ -13,6 +13,9 @@ public class ToDoConstants { // Map Refactoring // Remove notification from OsmAndMapTileView (?) // Yandex Traffic make downloadable + // Index version + // 1. POI inside obf + // 2. Multiple attributes for one point (amenity=circle, type=...) // === Refactoring issues === diff --git a/DataExtractionOSM/src/net/osmand/data/Boundary.java b/DataExtractionOSM/src/net/osmand/data/Boundary.java index 036c9341c2..1b077b31cf 100644 --- a/DataExtractionOSM/src/net/osmand/data/Boundary.java +++ b/DataExtractionOSM/src/net/osmand/data/Boundary.java @@ -28,14 +28,14 @@ public class Boundary { int intersections = 0; for(Way w : outerWays){ for(int i=0; i b.getLatitude()){ - return false; - } else { - if(longitude > Math.max(a.getLongitude(), b.getLongitude())) { - return true; - } else if(longitude < Math.min(a.getLongitude(), b.getLongitude())){ - return false; - } else { - if(a.getLongitude() == b.getLongitude()) { - // the node on the boundary !!! - return true; - } - // that tested on all cases (left/right) - double mR = (b.getLatitude() - a.getLatitude()) / (b.getLongitude() - a.getLongitude()); - double mB = (latitude - a.getLatitude()) / (longitude - a.getLongitude()); - if(mB <= mR){ - return true; - } else { - return false; - } - } - } - } - public LatLon getCenterPoint(){ List points = new ArrayList(); for(Way w : outerWays){ diff --git a/DataExtractionOSM/src/net/osmand/data/MapAlgorithms.java b/DataExtractionOSM/src/net/osmand/data/MapAlgorithms.java index bf4cf9e8ba..10a6443b66 100644 --- a/DataExtractionOSM/src/net/osmand/data/MapAlgorithms.java +++ b/DataExtractionOSM/src/net/osmand/data/MapAlgorithms.java @@ -1,8 +1,10 @@ package net.osmand.data; import java.util.ArrayList; +import java.util.Collections; import java.util.List; +import net.osmand.osm.LatLon; import net.osmand.osm.MapUtils; import net.osmand.osm.Node; import net.osmand.osm.Way; @@ -61,6 +63,9 @@ public class MapAlgorithms { } private static double orthogonalDistance(int zoom, Node nodeLineStart, Node nodeLineEnd, Node node) { + if(zoom > 31){ + zoom = 31; + } double x1 = MapUtils.getTileNumberX(zoom, nodeLineStart.getLongitude()); double y1 = MapUtils.getTileNumberY(zoom, nodeLineStart.getLatitude()); double x2 = MapUtils.getTileNumberX(zoom, nodeLineEnd.getLongitude()); @@ -73,4 +78,138 @@ public class MapAlgorithms { double D = y2 - y1; return Math.abs(A * D - C * B) / Math.sqrt(C * C + D * D); } + + public static boolean isClockwiseWay(Way w){ + return isClockwiseWay(Collections.singletonList(w)); + + } + + public static boolean isClockwiseWay(List ways){ + if(ways.isEmpty()){ + return true; + } + LatLon latLon = ways.get(0).getLatLon(); + double lat = latLon.getLatitude(); + double lon = 180; + double firstLon = -360; + boolean firstDirectionUp = false; + double previousLon = -360; + + double clockwiseSum = 0; + + Node prev = null; + boolean firstWay = true; + for(Way w : ways){ + List ns = w.getNodes(); + int startInd = 0; + if(firstWay && ns.size() > 0){ + prev = ns.get(0); + startInd = 1; + firstWay = false; + } + for(int i = startInd; i < ns.size();i++) { + Node next = ns.get(i); + double rlon = ray_intersect_lon(prev, next, lat, lon); + if(rlon != - 360d){ + boolean skipSameSide = (prev.getLatitude() <= lat) == (next.getLatitude() <= lat); + if(skipSameSide){ + continue; + } + boolean directionUp = prev.getLatitude() <= lat; + if(firstLon == - 360){ + firstDirectionUp = directionUp; + firstLon = rlon; + } else { + boolean clockwise = (!directionUp) == (previousLon < rlon); + if(clockwise){ + clockwiseSum += Math.abs(previousLon - rlon); + } else { + clockwiseSum -= Math.abs(previousLon - rlon); + } + } + previousLon = rlon; + } + prev = next; + } + } + + if(firstLon != -360){ + boolean clockwise = (!firstDirectionUp) == (previousLon < firstLon); + if(clockwise){ + clockwiseSum += Math.abs(previousLon - firstLon); + } else { + clockwiseSum -= Math.abs(previousLon - firstLon); + } + } + + return clockwiseSum >= 0; + + + } + + public static double ray_intersect_lon(Node node, Node node2, double latitude, double longitude) { + // a node below + Node a = node.getLatitude() < node2.getLatitude() ? node : node2; + // b node above + Node b = a == node2 ? node : node2; + if (latitude == a.getLatitude() || latitude == b.getLatitude()) { + latitude += 0.00000001d; + } + if (latitude < a.getLatitude() || latitude > b.getLatitude()) { + return -360d; + } else { + if (longitude < Math.min(a.getLongitude(), b.getLongitude())) { + return -360d; + } else { + if (a.getLongitude() == b.getLongitude() && longitude == a.getLongitude()) { + // the node on the boundary !!! + return longitude; + } + // that tested on all cases (left/right) + double lon = b.getLongitude()+ + (b.getLatitude() - latitude) * (b.getLongitude() - a.getLongitude()) / (b.getLatitude() - a.getLatitude()); + if (lon <= longitude) { + return lon; + } else { + return -360d; + } + } + } + + } + + // Try to intersect with ray from left to right + public static boolean ray_intersect(Node node, Node node2, double latitude, double longitude) { + // a node below + Node a = node.getLatitude() < node2.getLatitude() ? node : node2; + // b node above + Node b = a == node2 ? node : node2; + if(latitude == a.getLatitude() || latitude == b.getLatitude()){ + latitude += 0.00000001d; + } + if(latitude < a.getLatitude() || latitude > b.getLatitude()){ + return false; + } else { + if(longitude > Math.max(a.getLongitude(), b.getLongitude())) { + return true; + } else if(longitude < Math.min(a.getLongitude(), b.getLongitude())){ + return false; + } else { + if(a.getLongitude() == b.getLongitude()) { + // the node on the boundary !!! + return true; + } + // that tested on all cases (left/right) + double mR = (b.getLatitude() - a.getLatitude()) / (b.getLongitude() - a.getLongitude()); + double mB = (latitude - a.getLatitude()) / (longitude - a.getLongitude()); + if(mB <= mR){ + return true; + } else { + return false; + } + } + } + } + + } diff --git a/DataExtractionOSM/src/net/osmand/data/preparation/IndexCreator.java b/DataExtractionOSM/src/net/osmand/data/preparation/IndexCreator.java index 3644d145ce..d361aa07e4 100644 --- a/DataExtractionOSM/src/net/osmand/data/preparation/IndexCreator.java +++ b/DataExtractionOSM/src/net/osmand/data/preparation/IndexCreator.java @@ -10,11 +10,13 @@ import java.io.RandomAccessFile; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; +import java.util.Arrays; import net.osmand.Algoritms; import net.osmand.IProgress; import net.osmand.binary.BinaryMapIndexWriter; import net.osmand.data.IndexConstants; +import net.osmand.data.preparation.MapZooms.MapZoomPair; import net.osmand.data.preparation.OsmDbAccessor.OsmDbVisitor; import net.osmand.impl.ConsoleProgressImplementation; import net.osmand.osm.Entity; @@ -63,11 +65,14 @@ public class IndexCreator { private boolean normalizeStreets = true; // true by default private boolean saveAddressWays = true; // true by default + private int zoomWaySmothness = 0; private String regionName; private String poiFileName = null; private String mapFileName = null; private Long lastModifiedDate = null; + + private IndexTransportCreator indexTransportCreator; @@ -116,6 +121,10 @@ public class IndexCreator { public void setNormalizeStreets(boolean normalizeStreets) { this.normalizeStreets = normalizeStreets; } + + public void setZoomWaySmothness(int zoomWaySmothness) { + this.zoomWaySmothness = zoomWaySmothness; + } public String getRegionName() { if (regionName == null) { @@ -351,7 +360,7 @@ public class IndexCreator { this.accessor = new OsmDbAccessor(); - indexMapCreator.initSettings(mapZooms, renderingTypes); + indexMapCreator.initSettings(mapZooms, renderingTypes, zoomWaySmothness); // init address String[] normalizeDefaultSuffixes = null; @@ -587,9 +596,9 @@ public class IndexCreator { long time = System.currentTimeMillis(); IndexCreator creator = new IndexCreator(new File("/home/victor/projects/OsmAnd/data/osm-gen/")); //$NON-NLS-1$ creator.setIndexMap(true); - creator.setIndexAddress(true); - creator.setIndexPOI(true); - creator.setIndexTransport(true); +// creator.setIndexAddress(true); +// creator.setIndexPOI(true); +// creator.setIndexTransport(true); // for NL // creator.setCityAdminLevel("10"); @@ -597,11 +606,24 @@ public class IndexCreator { creator.deleteDatabaseIndexes = true; creator.deleteOsmDB = true; - creator.generateIndexes(new File("/home/victor/projects/OsmAnd/download/410/map.osm"), - new ConsoleProgressImplementation(1), null, MapZooms.getDefault(), null); +// creator.generateIndexes(new File("/home/victor/projects/OsmAnd/download/410/map.osm"), +// new ConsoleProgressImplementation(1), null, MapZooms.getDefault(), null); // creator.generateIndexes(new File("/home/victor/projects/OsmAnd/data/osm-maps/minsk_around.osm"), // new ConsoleProgressImplementation(1), null, MapZooms.getDefault(), null); + MapZooms mapZooms = new MapZooms(); + MapZoomPair pair1 = new MapZooms.MapZoomPair(1, 3); + MapZoomPair pair2 = new MapZooms.MapZoomPair(4, 5); + MapZoomPair pair3 = new MapZooms.MapZoomPair(6, 7); + + mapZooms.setLevels(Arrays.asList(pair1, pair2, pair3)); + creator.setZoomWaySmothness(2); + creator.generateIndexes(new File( + "/home/victor/projects/OsmAnd/download/basemap/10m_coastline_out.osm" +// "/home/victor/projects/OsmAnd/download/basemap/10-admin-0-countries.osm" +// "/home/victor/projects/OsmAnd/download/basemap/10m_populated_places.osm" + ), + new ConsoleProgressImplementation(1), null, mapZooms, null); // creator.setNodesDBFile(new File("e:/Information/OSM maps/osmand/minsk.tmp.odb")); diff --git a/DataExtractionOSM/src/net/osmand/data/preparation/IndexVectorMapCreator.java b/DataExtractionOSM/src/net/osmand/data/preparation/IndexVectorMapCreator.java index 5941630784..ea014b2891 100644 --- a/DataExtractionOSM/src/net/osmand/data/preparation/IndexVectorMapCreator.java +++ b/DataExtractionOSM/src/net/osmand/data/preparation/IndexVectorMapCreator.java @@ -12,7 +12,6 @@ import java.sql.Statement; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; @@ -67,6 +66,8 @@ public class IndexVectorMapCreator extends AbstractIndexPartCreator { private int lowLevelWays = -1; private RTree[] mapTree = null; private Connection mapConnection; + + private int zoomWaySmothness = 0; public IndexVectorMapCreator() { @@ -354,10 +355,9 @@ public class IndexVectorMapCreator extends AbstractIndexPartCreator { boolean point = (type & 3) == MapRenderingTypes.POINT_TYPE; RTree rtree = null; - int zoom; long id = (baseId << 3) | ((level & 3) << 1); rtree = mapTree[level]; - zoom = mapZooms.getLevel(level).getMaxZoom() - 1; + boolean skip = false; String eName = renderingTypes.getEntityName(e); @@ -368,11 +368,13 @@ public class IndexVectorMapCreator extends AbstractIndexPartCreator { if (e.getTag(OSMTagKey.HIGHWAY) != null) { highwayAttributes = MapRenderingTypes.getHighwayAttributes(e); } + if (e instanceof Way) { id |= 1; // simplify route - if (level > 0) { - e = simplifyWay((Way) e, id, hasMulti, zoom, eName, type, level); + int zoomToSimplify = mapZooms.getLevel(level).getMaxZoom() - 1; + if (zoomToSimplify < 15) { + e = simplifyWay((Way) e, id, hasMulti, zoomToSimplify, eName, type, level); skip = e == null; } @@ -443,12 +445,13 @@ public class IndexVectorMapCreator extends AbstractIndexPartCreator { boolean cycle = originalE.getNodeIds().get(0).longValue() == originalE.getNodeIds().get(nodes.size() - 1).longValue(); long longType = encodeTypesToOneLong(type); - boolean skip = checkForSmallAreas(nodes, zoom, 3, 3); - if (skip && cycle/* || !hasMulti)*/) { - return null; + if (cycle) { + if(checkForSmallAreas(nodes, zoom + Math.min(zoomWaySmothness / 2, 3), 1, 4)){ + return null; + } } - MapAlgorithms.simplifyDouglasPeucker(nodes, zoom + 8, 3, way); + MapAlgorithms.simplifyDouglasPeucker(nodes, zoom + 8 + zoomWaySmothness, 3, way); if (way.getNodes().size() < 2) { return null; } @@ -575,12 +578,12 @@ public class IndexVectorMapCreator extends AbstractIndexPartCreator { boolean cycle = startNode == endNode; boolean hasMulti = multiPolygonsWays[level].containsKey(id >> 3); if(cycle || !hasMulti){ - skip = checkForSmallAreas(wNodes, zoom - 1, 1, 4); + skip = checkForSmallAreas(wNodes, zoom - 1 + Math.min(zoomWaySmothness / 2, 3), 1, 4); } if (!skip) { Way newWs = new Way(id); - MapAlgorithms.simplifyDouglasPeucker(wNodes, zoom - 1 + 8, 3, newWs); + MapAlgorithms.simplifyDouglasPeucker(wNodes, zoom - 1 + 8 + zoomWaySmothness, 3, newWs); int type = decodeTypesFromOneLong(ltype); insertBinaryMapRenderObjectIndex(mapTree[level], newWs, name, @@ -617,8 +620,9 @@ public class IndexVectorMapCreator extends AbstractIndexPartCreator { } @SuppressWarnings("unchecked") - public void initSettings(MapZooms mapZooms, MapRenderingTypes renderingTypes) { + public void initSettings(MapZooms mapZooms, MapRenderingTypes renderingTypes, int zoomWaySmothness) { this.mapZooms = mapZooms; + this.zoomWaySmothness = zoomWaySmothness; this.renderingTypes = renderingTypes; // init map multiPolygonsWays = new Map[mapZooms.size()]; @@ -633,9 +637,10 @@ public class IndexVectorMapCreator extends AbstractIndexPartCreator { if (e instanceof Way || e instanceof Node) { // manipulate what kind of way to load ctx.loadEntityData(e, false); - boolean inverse = "-1".equals(e.getTag(OSMTagKey.ONEWAY)); //$NON-NLS-1$ + boolean oneway = "-1".equals(e.getTag(OSMTagKey.ONEWAY)); //$NON-NLS-1$ for (int i = 0; i < mapZooms.size(); i++) { - writeBinaryEntityToMapDatabase(e, e.getId(), i == 0 ? inverse : false, i); + boolean inverse = i == 0 ? oneway : false; + writeBinaryEntityToMapDatabase(e, e.getId(), inverse, i); } } } @@ -922,4 +927,12 @@ public class IndexVectorMapCreator extends AbstractIndexPartCreator { closeAllPreparedStatements(); } + + public void setZoomWaySmothness(int zoomWaySmothness) { + this.zoomWaySmothness = zoomWaySmothness; + } + + public int getZoomWaySmothness() { + return zoomWaySmothness; + } } diff --git a/DataExtractionOSM/src/net/osmand/data/preparation/MapZooms.java b/DataExtractionOSM/src/net/osmand/data/preparation/MapZooms.java index 48b1f94eed..79fa7976f8 100644 --- a/DataExtractionOSM/src/net/osmand/data/preparation/MapZooms.java +++ b/DataExtractionOSM/src/net/osmand/data/preparation/MapZooms.java @@ -1,11 +1,14 @@ package net.osmand.data.preparation; 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; @@ -22,6 +25,10 @@ public class MapZooms { return maxZoom; } + @Override + public String toString() { + return "MapZoomPair : " + minZoom + " - "+ maxZoom; + } } private List levels = new ArrayList(); @@ -33,6 +40,13 @@ public class MapZooms { 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;13-15;15 @@ -51,7 +65,7 @@ public class MapZooms { list.add(0, new MapZoomPair(Integer.parseInt(s.substring(0, i)), Integer.parseInt(s.substring(i + 1)))); } } - list.add(0, new MapZoomPair(zeroLevel, 22)); + list.add(0, new MapZoomPair(zeroLevel, MapZoomPair.MAX_ALLOWED_ZOOM)); if(list.size() < 1 || list.size() > 4){ throw new IllegalArgumentException("Map zooms should have at least 1 level and less than 4 levels"); } diff --git a/DataExtractionOSM/src/net/osmand/osm/MapRenderingTypes.java b/DataExtractionOSM/src/net/osmand/osm/MapRenderingTypes.java index dac188eb0f..3bc10c8f22 100644 --- a/DataExtractionOSM/src/net/osmand/osm/MapRenderingTypes.java +++ b/DataExtractionOSM/src/net/osmand/osm/MapRenderingTypes.java @@ -137,17 +137,18 @@ public class MapRenderingTypes { // val could be null means others for that tag private Integer nullRule; private Map rules = new LinkedHashMap(); - private String nameNullTag; + private Map nameNullTag = new LinkedHashMap(); public MapRulType(String tag, String nameNullTag){ this.tag = tag; + this.nameNullTag.put(null, nameNullTag); } public String getTag() { return tag; } - public String getNameNullTag() { + public Map getNameNullTag() { return nameNullTag; } @@ -563,8 +564,10 @@ public class MapRenderingTypes { for (String tag : tagKeySet) { if (types.containsKey(tag)) { MapRulType rType = types.get(tag); - if (rType.getNameNullTag() != null) { - name = e.getTag(rType.getNameNullTag()); + String val = i == 1 ? null : e.getTag(tag); + String nameNullTag = rType.getNameNullTag().get(val); + if (nameNullTag != null) { + name = e.getTag(nameNullTag); if (name != null) { break; } @@ -765,10 +768,13 @@ public class MapRenderingTypes { if(st == INIT_RULE_TYPES){ MapRulType rtype = types.get(tag); if(rtype == null){ - rtype = new MapRulType(tag, nameNullTag); + rtype = new MapRulType(tag, null); types.put(tag, rtype); } rtype.registerType(minZoom, val, pointRule, polylineRule, polygonRule, type, subtype); + if(nameNullTag != null){ + rtype.getNameNullTag().put(val, nameNullTag); + } } else if(st == INIT_AMENITY_MAP){ if(pointRule == POINT_TYPE || polygonRule == POLYGON_WITH_CENTER_TYPE || polygonRule == POLYGON_TYPE){ registerAmenity(tag, val, type, subtype); diff --git a/DataExtractionOSM/src/net/osmand/osm/Way.java b/DataExtractionOSM/src/net/osmand/osm/Way.java index 22f8e31bc6..7d461aad74 100644 --- a/DataExtractionOSM/src/net/osmand/osm/Way.java +++ b/DataExtractionOSM/src/net/osmand/osm/Way.java @@ -37,7 +37,11 @@ public class Way extends Entity { if(nodeIds == null){ return null; } - return nodeIds.remove(i); + Long toReturn = nodeIds.remove(i); + if(nodes != null && nodes.size() > i){ + nodes.remove(i); + } + return toReturn; } public List getNodeIds(){ diff --git a/DataExtractionOSM/src/net/osmand/osm/rendering_types.xml b/DataExtractionOSM/src/net/osmand/osm/rendering_types.xml index 3c7cf14b26..595ef09847 100644 --- a/DataExtractionOSM/src/net/osmand/osm/rendering_types.xml +++ b/DataExtractionOSM/src/net/osmand/osm/rendering_types.xml @@ -409,7 +409,7 @@ - + @@ -540,14 +540,16 @@ + + - - + + @@ -570,8 +572,10 @@ + + @@ -623,4 +627,11 @@ + + + + + + + \ No newline at end of file diff --git a/DataExtractionOSM/src/net/osmand/osm/util/FixLinkedCoastline.java b/DataExtractionOSM/src/net/osmand/osm/util/FixLinkedCoastline.java new file mode 100644 index 0000000000..3b4b1c83f5 --- /dev/null +++ b/DataExtractionOSM/src/net/osmand/osm/util/FixLinkedCoastline.java @@ -0,0 +1,244 @@ +package net.osmand.osm.util; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.xml.stream.XMLStreamException; + +import net.osmand.data.MapAlgorithms; +import net.osmand.impl.ConsoleProgressImplementation; +import net.osmand.osm.Entity; +import net.osmand.osm.LatLon; +import net.osmand.osm.MapUtils; +import net.osmand.osm.Node; +import net.osmand.osm.Way; +import net.osmand.osm.Entity.EntityId; +import net.osmand.osm.Entity.EntityType; +import net.osmand.osm.OSMSettings.OSMTagKey; +import net.osmand.osm.io.OsmBaseStorage; +import net.osmand.osm.io.OsmStorageWriter; + +import org.xml.sax.SAXException; + +public class FixLinkedCoastline { + + public static void main(String[] args) throws IOException, SAXException, XMLStreamException { + String fileToRead = args != null && args.length > 0 ? args[0] : null; + if(fileToRead == null) { + fileToRead = "/home/victor/projects/OsmAnd/download/basemap/10m_coastline.osm"; + } + File read = new File(fileToRead); + File write ; + String fileToWrite = args != null && args.length > 1 ? args[1] : null; + if(fileToWrite != null){ + write = new File(fileToWrite); + + } else { + String fileName = read.getName(); + int i = fileName.lastIndexOf('.'); + fileName = fileName.substring(0, i) + "_out"+ fileName.substring(i); + write = new File(read.getParentFile(), fileName); + } + + write.createNewFile(); + + process(read, write); + } + + private static void process(File read, File write) throws IOException, SAXException, XMLStreamException { + OsmBaseStorage storage = new OsmBaseStorage(); + storage.parseOSM(new FileInputStream(read), new ConsoleProgressImplementation()); + + Map entities = new HashMap( storage.getRegisteredEntities()); + List toWrite = new ArrayList(); + + for(EntityId e : entities.keySet()){ + if(e.getType() == EntityType.WAY){ + Entity oldWay = storage.getRegisteredEntities().remove(e); + List result = processWay((Way) oldWay); + alignAndAddtoStorage(storage, toWrite, result); + } + } + + System.out.println("ERROR Ways : "); + int errors = 0; + for(List w : endWays.values()){ + Way way = w.get(0); + Way lway = w.get(w.size() - 1); + LatLon first = way.getNodes().get(0).getLatLon(); + LatLon last = lway.getNodes().get(lway.getNodes().size() - 1).getLatLon(); + double dist = MapUtils.getDistance(first, last); + if(dist < 500 && w.size() >= 3){ + alignAndAddtoStorage(storage, toWrite, w); + } else { + errors++; + String val = "First " + first+ "Last " + last + " id " + way.getId() + " dist " + MapUtils.getDistance(first, last) + " m"; + System.out.println("Ways in chain - " + w.size() + " - " + val); + } + } + System.out.println("Fixed errors : " + ERRORS +", errors not fixed : " + errors ); + OsmStorageWriter writer = new OsmStorageWriter(); + writer.saveStorage(new FileOutputStream(write), storage, toWrite, true); + } + + private static void alignAndAddtoStorage(OsmBaseStorage storage, List toWrite, List result) { + // align start/end node and add to strage + for (int i = 0; i < result.size(); i++) { + Node nextStart; + if (i < result.size() - 1) { + nextStart = result.get(i + 1).getNodes().get(0); + } else { + nextStart = result.get(0).getNodes().get(0); + } + + Way w = result.get(i); + int sz = w.getNodes().size(); + w.removeNodeByIndex(sz - 1); + w.addNode(nextStart); + if("land_coastline".equals(w.getTag(OSMTagKey.NATURAL))) { + w.putTag(OSMTagKey.NATURAL.getValue(), "coastline"); + } + + EntityId eId = EntityId.valueOf(w); + storage.getRegisteredEntities().put(eId, w); + toWrite.add(eId); + } + } + + private static long calcCoordinate(net.osmand.osm.Node node){ + LatLon l = node.getLatLon(); + double lon =l.getLongitude(); + if(180 - Math.abs(l.getLongitude()) < 0.0001){ + if(l.getLongitude() < 0){ + lon = -179.9999; + } else { + lon = 180; + } + } + return ((long)MapUtils.getTileNumberY(21, l.getLatitude()) << 32l) + ((long)MapUtils.getTileNumberX(21, lon)); + } + + private static Map> startWays = new LinkedHashMap>(); + private static Map> endWays = new LinkedHashMap>(); + private static Map duplicatedSimpleIslands = new LinkedHashMap(); + private static int ERRORS = 0; + + private static Way revertWay(Way way){ + ArrayList revNodes = new ArrayList(way.getNodes()); + Collections.reverse(revNodes); + Way ws = new Way(way.getId()); + for(String key : way.getTagKeySet()){ + ws.putTag(key, way.getTag(key)); + } + for(net.osmand.osm.Node n : revNodes){ + ws.addNode(n); + } + return ws; + } + + private static boolean pointContains(long start, long end){ + return startWays.containsKey(start) || endWays.containsKey(end) || startWays.containsKey(end) || endWays.containsKey(start); + } + + private static long lastPoint(Way w){ + return calcCoordinate(w.getNodes().get(w.getNodes().size() - 1)); + } + private static long lastPoint(List w){ + return lastPoint(w.get(w.size() - 1)); + } + + private static long firstPoint(List w){ + return firstPoint(w.get(0)); + } + + private static long firstPoint(Way way) { + return calcCoordinate(way.getNodes().get(0)); + } + + private static List processWay(Way way) { + // F Lat 8.27039215702537 Lon 73.0661727222713L Lat 8.27039215702537 Lon 73.0661727222713 id -1211228 + long start = firstPoint(way); + long end = lastPoint(way); + LatLon first = way.getNodes().get(0).getLatLon(); + LatLon last = way.getNodes().get(way.getNodes().size() - 1).getLatLon(); + String val = "F " + first + "L " + last + " id " + way.getId(); + List cycle = null; + if (start == end || MapUtils.getDistance(first, last) < 20) { + LatLon c = way.getLatLon(); + cycle = Collections.singletonList(way); + for(Way w : duplicatedSimpleIslands.keySet()){ + LatLon center = duplicatedSimpleIslands.get(w); + if(MapUtils.getDistance(center, c) < 4000){ + //System.out.println("DUPLICATED " + first); + return Collections.emptyList(); + } + } + duplicatedSimpleIslands.put(way, c); + } else { + List list = new ArrayList(); + list.add(way); + +// System.out.println(val); + + while (pointContains(start, end)) { + if (startWays.containsKey(start) || endWays.containsKey(end)) { + ERRORS++; + Collections.reverse(list); + for (int i = 0; i < list.size(); i++) { + list.set(i, revertWay(list.get(i))); + } + long t = start; + start = end; + end = t; + } + if (endWays.containsKey(start)) { + List tlist = endWays.remove(start); + startWays.remove(firstPoint(tlist)); + tlist.addAll(list); + list = tlist; + + } else if (startWays.containsKey(end)) { + List tlist = startWays.remove(end); + endWays.remove(lastPoint(tlist)); + list.addAll(tlist); + } + start = firstPoint(list); + end = lastPoint(list); + if (start == end) { + cycle = list; + break; + } + } + if (cycle == null) { + startWays.put(start, list); + endWays.put(end, list); + } + } + + if (cycle != null) { + boolean clockwiseWay = MapAlgorithms.isClockwiseWay(cycle); + if (clockwiseWay) { + List ways = new ArrayList(); + ERRORS ++; + for (int i = cycle.size() - 1; i >= 0; i--) { + // System.out.println("Cycle error " + way.getId()); + ways.add(revertWay(cycle.get(i))); + } + return ways; + } + return cycle; + + } + return Collections.emptyList(); + + } + +} diff --git a/DataExtractionOSM/src/net/osmand/render/default.render.xml b/DataExtractionOSM/src/net/osmand/render/default.render.xml index 5cd2b3c829..c6ffbc26ae 100644 --- a/DataExtractionOSM/src/net/osmand/render/default.render.xml +++ b/DataExtractionOSM/src/net/osmand/render/default.render.xml @@ -310,12 +310,13 @@ - - + + + - - - + + + @@ -447,6 +448,9 @@ + + + @@ -498,7 +502,7 @@ - + diff --git a/OsmAnd/res/drawable/h_city.png b/OsmAnd/res/drawable/h_city.png new file mode 100644 index 0000000000000000000000000000000000000000..c0c8d517714d7be71e79bc1e2bd55db0b178140c GIT binary patch literal 250 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1SGw4HSYi^#^NA%Cx&(BWL^R}oCO|{#S9GG z!XV7ZFl&wkP>{XE)7O>#Hk+`3yx<|;V~s!|$r9Iy66gHf+|;}h2Ir#G#FEq$h4Rdj z3$^QCk=TxAT44$rjF6*2UngDRjQ)~bL literal 0 HcmV?d00001 diff --git a/OsmAnd/res/drawable/h_mot_shield1.png b/OsmAnd/res/drawable/h_mot_shield1.png new file mode 100644 index 0000000000000000000000000000000000000000..ce509fff2c75e2d06eec8f65fe8a62e2a134118e GIT binary patch literal 412 zcmeAS@N?(olHy`uVBq!ia0vp^f*{Pn3?z9rZ$AN~SkfJR9T^y|-MHc(VFct$mbgZg z1m~xflqVLYGB~E>C#5QQ<|d}62BjvZR2H60wE-$J3-AeX&1qS1>%sHK&)@$4|G$0q z#?tPkTMwT9`u*p=lUI*lxIJ^#-nz-F-@N}kVbS)BHy$qDba>6qlR&KsCZg+rlu${K zUocQ3DqwiDf4>k=_ME4SV@SoVBmoviHV%f(j7%MjXVM=gq@+A~!qm;kA|PPAp~%2^ ze29<qP*?Ds2s=Yw1_CGc60V$!9 zAirRsUR1#FX#aj8pzKRe7srr_TS)>ejBFwdVoV$gY#R*pjg@5zHZ&|{VCrC0Id|~L z$%8!1YkYcg90D5{k{G%+Z~Ck}`^ce_=T0kd2sk)!@|Ed@Sl@_fTQwr7@l zkn|{x0caLmogW*|f#Zi61RQvHdTM3}-SOdJU}Tw+aBNCKViHir0v7gVEeyiU4h)R8 z2fH*GMVL7hCJ0AdIC}HOOi2bNju-rHer6_|a%EL=oy8RzBnpnQJ2WsdoHu8E^|Qk7 QC(zRjp00i_>zopr04V9Ing9R* literal 0 HcmV?d00001 diff --git a/OsmAnd/res/drawable/h_mot_shield3.png b/OsmAnd/res/drawable/h_mot_shield3.png new file mode 100644 index 0000000000000000000000000000000000000000..9b27a6b6f12fa5be6837a5ba0d0ff40c0d5e46b9 GIT binary patch literal 441 zcmeAS@N?(olHy`uVBq!ia0vp^@<1%e!3-pYs@ki86id3JuOkD)wHsIbBaDE2$r9Iy zlHmNblJdl&R0hYC{G?O`&)mfH)S%SFl*+=BsWw1GW&u7St~o6WZasMZ|NsB32hUGf zwEgk(x24@nzkdI@@8s1t??1QC-ne+v;fpsO)=gf0{KD-uJ5SDBwHK(>{-@?WASF~1 zqesl7*3pL*x9xbFEkF%)-Lh92*#zZk;`HzCpIY zu+W%+MSz*vUY%L*!12QjK%;niYAl}aoGHNo($f<>ueFm=p`qcEjKx#d86d$Im0@!} zIcNgS*g1){-9*~jnAw4W@$dN)C);A@wa@hx0IAMdGv|iSgH)Eb*$NH}jZHIpCw5Mq zIh$3I!{D<)A=6S;po4_!b!vLv_-HgtY?qd)XJ9th L`njxgN@xNAh%&6T literal 0 HcmV?d00001 diff --git a/OsmAnd/res/drawable/h_mot_shield4.png b/OsmAnd/res/drawable/h_mot_shield4.png new file mode 100644 index 0000000000000000000000000000000000000000..0c7ba694449feb51cef8640ee2db134bd1b7c810 GIT binary patch literal 445 zcmeAS@N?(olHy`uVBq!ia0vp^YCtT=!3-qZ=IC_-DVB6cUq=RpYd5a=M;HP5k|nMY zCBgY=CFO}lsSJ)O`AMk?p1FzXsX?iUDV2pMQ*D5X%mREuTyt6$+aoT!xwKnted?0_=VeRcAlKMYA;Z${ZGw%KuV}2 z$S)YE7Zor(+P_~2DEr>i#WAGfR+0baLXI6g*LprTXU!Tgw?tgno;mKo z(IaOW1RQvH{>t`_Gi_N8#5(=Y>B*{IXM+mKW^B}$plg^t*tKixk9pWp+1Lz!-5}4 z$tg*x&(aPuvCOEPVbQpXg^`J4l2gPFiJLPwFuKX*6>u?fD6l=cB<;|^$RK6QR(A7x RF&oh944$rjF6*2Ung9W0t``6R literal 0 HcmV?d00001 diff --git a/OsmAnd/res/drawable/h_mot_shield5.png b/OsmAnd/res/drawable/h_mot_shield5.png new file mode 100644 index 0000000000000000000000000000000000000000..2d0c1dd2a657b39f55f7106e3234e2741316908f GIT binary patch literal 446 zcmeAS@N?(olHy`uVBq!ia0vp^xaoT!xwKnted?0_=VeRcAlKMYA;Z${ZGw%KuV}2 z$S)YE7Zor(+P_~2DEqXG(r#<`dgc)xeO%p!qD} z(UXK@+z~S+ZZ>!^GIcPnm@#$k`~}Vt7B?#;Ss0l(R?KRi+s#qFdE+J{4ki|X3uk@) z@El>#Q_Eum>Q8v^JVk-;!$$)K76E2vW%-G#cFvSw0BM@(aaG5Mhk=nL{(JaZG%Q-e|yQz{EjrrH1%nFaWSxaPDhxb@)q|NsBD9y~u` z(e}sB-^wPh)n1@h`=6TkfRs>4 zkY6xRFDhVow12-4Q1+vzi(^Q|tt0^!Mz%$a5ta@Nh7DUk7#Rz(T0|VU#lY0TxTL+g zb8_=ci36vOoM5}cDB!^3V7uncpCh~aS|`t)?kJ$p&@jv5#?FrK!qVE>%?b_-jDHUw zIq$&qAn8#W1BU_|Tb&=zv)m2+}me^YW2HM;HVg9DHS#WC|rD z0aYicY@D==bA_BjgTujtPF-?lWoc{;3{1y_mDQy=XI0#|$->CQv7)ng>g0^w6_Smb zAnP48J9{T~PMtZsRY4%(S>hv>SAr}Y3LaYN50g{Um3Sm7cN|gTe~DWM4f4g|Mu literal 0 HcmV?d00001 diff --git a/OsmAnd/res/drawable/h_mot_shield7.png b/OsmAnd/res/drawable/h_mot_shield7.png new file mode 100644 index 0000000000000000000000000000000000000000..35a3dfc50a0d83c1fc1651bd4504ff8cf80c1a08 GIT binary patch literal 447 zcmeAS@N?(olHy`uVBq!ia0vp^)<7)C!3-or&Zt}jQY`6?zK#qG*KS<#k1zuAB}-f* zN`mv#O3D+9QW+dm@{>{(JaZG%Q-e|yQz{EjrrH1%nFaWSxaPDhxb@)q|NsBD9y~u` z(e}sB-^wPh)n1@h`=6TkfRs>4 zkY6xRFDhVow12-4Q1+vzi(^Q|tt0^!Mz$cv2yq7n!-mpNM#htvEFuohE{uy)OxKPpx;TPM$*?kJ$p&`@Q0W2eVAeQ9m&W(5ZZ#=obI zoOiH#kn|{xfkT0ftaoT!xwKnted?0_=VeRcAlKMYA;Z${ZGw%KuV}2 z$S)YE7Zor(+P_~2DEr0J#WAGfR+0b5HNOR%AkmX6b!vLv_$*;^lglgcV+H!<)M@Sp24;p| Xzu5cA!i`md{%7!X^>bP0l+XkK)orKO literal 0 HcmV?d00001 diff --git a/OsmAnd/res/drawable/h_pri_shield1.png b/OsmAnd/res/drawable/h_pri_shield1.png new file mode 100644 index 0000000000000000000000000000000000000000..1234b383ddd30bac021b7db9609a1278bb1ab305 GIT binary patch literal 422 zcmeAS@N?(olHy`uVBq!ia0vp^f*{Pn3?z9rZ$AN~SkfJR9T^y|-MHc(VFct$mbgZg z1m~xflqVLYGB~E>C#5QQ<|d}62BjvZR2H60wE-$J3-AeX-CbS3uc77nzWpaBPC3-p zd1cX(J8Rd!I&$Rx<}IJjpMSh#*NqjcF3y?%?dsKcCr_Q7KJ!?2KTvDt1&1j>N~k2r zFZe$?V0g5DzYtLNhNp{TNX4xr0TxC!4u;K)OdX78(w`(IKT1kv>}F&UVD@O3I=OT9 z%&E=Odj(IhawxDZU|?4_ju7S+whrJ>XlPJcQ_~YrEHPt;1Pdb*M+RF6D@Vf(2F4=? z4jew$z>p)u17@G?RXKF#2!nuw!(JN?rJg-NQI?R7MQw8#fkyN_bP{4LVqoHU!4)Ug z!XeMk?7+Zy_wX^ka(;H}W(5a^#ye-u@dX||aq#3J1r7m+g!+vii#`~9-dt$Z_=i=% uL16#p4Mm2Ah1?B)`2-wzBpxygBrup3v6gKJU*8J!BZH@_pUXO@geCwDRi*|2 literal 0 HcmV?d00001 diff --git a/OsmAnd/res/drawable/h_pri_shield2.png b/OsmAnd/res/drawable/h_pri_shield2.png new file mode 100644 index 0000000000000000000000000000000000000000..880ab4a8279bcdfd061e053123b0654890c9f70f GIT binary patch literal 431 zcmeAS@N?(olHy`uVBq!ia0vp^5HqM^Q$h@J@fPqDTnOR(X8H=zovjYPo?~`Lw5}u_p0JWOsSly6hVB&beDd)qv zKmsT^_w4B=#e>JsG6*<0)Nk0h_;+*jTt@+g1_!(JboYyg&m25?NP$DZ;lYNa$4?)$ zwTjwHt1D})0U9B+OJ|MEh6|}rgc#cO92g8Abn!PZFf+_iU|quL=DPssSq4v6KbLh* G2~7Zk7Ns)) literal 0 HcmV?d00001 diff --git a/OsmAnd/res/drawable/h_pri_shield3.png b/OsmAnd/res/drawable/h_pri_shield3.png new file mode 100644 index 0000000000000000000000000000000000000000..a97846a0325ea4e2c5db296f4cbcb6bdae47e9af GIT binary patch literal 433 zcmeAS@N?(olHy`uVBq!ia0vp^@<1%e!3-pYs@ki86id3JuOkD)wHsIbBaDE2$r9Iy zlHmNblJdl&R0hYC{G?O`&)mfH)S%SFl*+=BsWw1GW&u7SuDh%2pYPj$a^jSI4K0V- zI z{DS|Z1BOTY_X`1KAA7nuhE&{25@2Cu%VE%A7I5H6h)l~Xa|=0e_!LtZBap9<8OG

)71n*c=-em~QoknsYRy zFfesAHqP#46i;}b!T{97rl&XOlTQy110&0pR_Wz7#`??-42--77tilyRA^|J_xzwH z{}d(;g$4GNkp(9|7aB9L2weF8CdcB>`IE;KI0PIPd`M0{oW^9V&d%Me;K0y$c>dh! zlcjb4u->qgaD2!w;4tAwa^h3RZhJSqx`IE9ECS4pKiD}87=-7up363heHaeY<+~-N{pDr_Vgr-4E0%%yTgiNC}k$ z`33(+2Mmw)?-v5fKKFES45_%4B*4PRX2YEyQU|{p_GAyP#Pvkn8j%;4$j K=d#Wzp$PzBO|NqR literal 0 HcmV?d00001 diff --git a/OsmAnd/res/drawable/h_pri_shield5.png b/OsmAnd/res/drawable/h_pri_shield5.png new file mode 100644 index 0000000000000000000000000000000000000000..f68bc7da230b074047ea181d02219a9a69820422 GIT binary patch literal 439 zcmeAS@N?(olHy`uVBq!ia0vp^xeHaeY<+~-N{pDr_Vgr-4E0%%yTgiNC}k$ z`33(+2Mmw)?-v5fzVvi)45_%4B*4PRc8FmOpF)GgfvlN3BP2dD%9Vv}sA^zHV$e)` zp712?5c>_w%E%dwUW`l~j4NhLZth&*93gqL;S?hi$BJ2V`)6{L8ykEw;9z1AxNz2G z1`m@$DFfq?0|$;CbC5}Rn8LuJz{ZxBrxa>zXv6?iVjJVKD(zV+PnNbm;81w-nA?q#G(WyDHpd1A zrscw7aejJxUbf6{Z5Ev3$H2rfi7oPG<%eaCZh4FaQY=7QCtWgkXkcWpf6bb2f P=xGK|S3j3^P6{(JaZG%Q-e|yQz{EjrrH1%nFaWSxbCj5f4*=3$%#|;HMHDW zyZ%sH=c^+}t}I&e>HPWoo3~t?GylelRgZV<`gZl|yOXERPM>+KyC0}knCD_3kP<2h z@(cct4j3No-!BA|edX!m7*cU7Nq~isZ4qOHr2~Uu!&ZahjRr!D6*nRe-eO?tU|iBZ zw|V01PL2cTPM$u*bA?gBfycpij*QQdU42t0@~+@kXlR&qFVdQ&MBb@0Ij30&j0`b literal 0 HcmV?d00001 diff --git a/OsmAnd/res/drawable/h_pri_shield7.png b/OsmAnd/res/drawable/h_pri_shield7.png new file mode 100644 index 0000000000000000000000000000000000000000..7e4e2f12668eed20d0648c75b6dffea22d369ddc GIT binary patch literal 440 zcmeAS@N?(olHy`uVBq!ia0vp^)<7)C!3-or&Zt}jQY`6?zK#qG*KS<#k1zuAB}-f* zN`mv#O3D+9QW+dm@{>{(JaZG%Q-e|yQz{EjrrH1%nFaWSxbCj5f4*=3$%#|;HMHDW zyZ%sH=c^+}t}I&e>HPWoo3~t?GylelRgZV<`gZl|yOXERPM>+KyC0}knCD_3kP<2h z@(cct4j3No-!BA|edX!m7*cU7Nq~isEr>Bf+=0Qcq132&qk#~A#f`{=yBL`|7?(_) z+dOf0XT^bYCr=;Zxxyjfz~iuXj*O3r)y%0Ac~?j(G&EG*{5iw(n?AELf3t!E1LI$> zO=}exF0let^2FruJYf*?V{2eYN_g;0&0AksnHi`g_MGdqxU@K+FjJJ@vb{Mx42 zF>;%}Fl}XI5inR+5qa|B>ElNk1RM_hNKI5$uCu%;!NSPIF=gG28y;I{&Yavl)lop9 z;lRt8tbMSfsN~vzC!~e!wv?vvV4YX Ryg*+wc)I$ztaD0e0sypvu!jHu literal 0 HcmV?d00001 diff --git a/OsmAnd/res/drawable/h_pri_shield8.png b/OsmAnd/res/drawable/h_pri_shield8.png new file mode 100644 index 0000000000000000000000000000000000000000..73fcb3bc48035434321f1f7ca3be158e004d8a0f GIT binary patch literal 442 zcmeAS@N?(olHy`uVBq!ia0vp^PCzWk!3-qhCUi9eDVB6cUq=RpYd5a=M;HP5k|nMY zCBgY=CFO}lsSJ)O`AMk?p1FzXsX?iUDV2pMQ*D5X%mREuTz6O3Ki{|ieHaeY<+~-N{pDr_Vgr-4E0%%yTgiNC}k$ z`33(+2Mmw)?-v5fzVUQ%45_%4B*4PRX2cj_?7(2yz?<+aDN#l8!-maGyo?+QY!f)& z$n@OtQDH9gixW#*P}jha#4zi?$%8KQ>?0&^Hl#7I2wdPOvr8*F+|)R+-BCcHq2Zy! zI%x-nC6Wpa5)wOZNN6zV%;8~RJaXW`S>H}UpB^BadU?vhrowGjn9t@H7Dp zI;X6&XHLwL=Yn-&d~N}9Ko@)XrKUbtv|Vmg#NAM=1@uxtTpR<71jEE=wgsYZ1g8M~ O&EVC#5QQ<|d}62BjvZR2H60wE-$J3-AeXJ+`*x@-{wOh#wVRPefZ3y=wYjsq zw{`OLxq>HHITY9yFsQRjM+j>R8wYSGG&Csb)bs=tOU$T{U}0q9$Y2X$&g&&*$@(DQbNIYZ~NMNw&VJ&N%{`Nf3j|`r!elF{r5}E*_1*#;9-T7|fej2v3|+-V28y$f96P}^g^@#H0gJV~@hVxKo*14c21XVW`A}Pq zh8CdK#>V!kjLaJfj2Ku1n3>JZm$3*dGdnOa@;*5@CE-~r15m43j#Y#t0~5y!PCXya z1rk8Xxo1zeDIPq2m_fk7p?<@LMZcRTPjwVfXmGGgPj$U`_{_EBC$ustLJqHHE2VMLP49pDkma;B69Ct1Z=vf9&S3j3^ HP6yv#?FRprdb>00_i*FvD{qx14PY-ro-9P>Oj((ul+d)C%KuV}2 z$S?RmI$(ITf4>k=_OYjnV@SoVBmoviwj2f>W&sDDgvd0xGPjTeM-Q=uF#`DtnPPly zd1@gC4xK!Gj%NxBhXUII6LofBvBx(hA{)6Fm^d`fA3EN1wT{hAkIk`xf$3Ins5wVN z3IkI|V`KYNM)8E_DGWeOY66)Y|NOjZDdG5#U%+9)kL2WsPTlryd5i^r7+D0E8-K8K7%&LRv7Vcx5ugC{E`z75 KpUXO@geCxC-m5(T literal 0 HcmV?d00001 diff --git a/OsmAnd/res/drawable/h_sec_shield4.png b/OsmAnd/res/drawable/h_sec_shield4.png new file mode 100644 index 0000000000000000000000000000000000000000..656817ae81a8a68b64a20ca85052742f4fb3ac67 GIT binary patch literal 437 zcmeAS@N?(olHy`uVBq!ia0vp^YCtT=!3-qZ=IC_-DVB6cUq=RpYd5a=M;HP5k|nMY zCBgY=CFO}lsSJ)O`AMk?p1FzXsX?iUDV2pMQ*D5X%mREuT#v17d2@5qrQMTHZfL)A zZ2tQ@+s2c0x6-A zAiv=M=z!tT{{2Eg+2@`vjv*Ddk_1>7*=!irFeo%g9O#;{^M>R`raUpT4NeUVNenBK z9wt0VJj4}YQF(J_V-^Eb2jhya$<3VG=jQaRaVTYAWC=NT=y=chT%MjgJWW7uiMZWn z2Zkje!z6Y@NOCZg`LO{FN_g;4aY;|-L`H>%hOlD6pkrrFGYB|1D09v}b_&Qi;P6;& z3C{{9pe*Cz({2uu^5V=642*|+=Ze61fp%m2KQ=~-aG%Aw%Fm6-hS*gPkRN|pnfEI2c0x6-A zAiv=M=z!tT{{2Eg*_WO!jv*Ddk_1>7*$y$R;ZtakIFL1S=MBk^jCo>a8>$)@k{C48 z9wt0VJj5PhQF(J_qZcDn2jhwvlbbsiINy+nY&^xt#Ia&lYyV7+a$|!cV-6-3feU9{ zX7Dg6lrk_LIdI_UDF>N^=P3*v3T$k0a!R4bhDHoPCAKjxtJ0pO0)-c_y39U%ib25P zz=3CKL8bwU4h)RWlcx7tT&;=WVPIt8$uA3AbZGYEsg42)4Gx7TPkG%aN%P|~V{>d^ zU|KF*7U!q8=Vi{(JaZG%Q-e|yQz{EjrrH1%nFaWSxE@>E^5*8IOS>nZ+|YjK z*!=f*ww>A1{pj4XuTS*uDgF~@y{2BK0VlVb^rA9JNkiIH;7D@1X4mJ zL4Lvi(E-Dw{riQ0vadW{978H@B?+)FvMpkauykNBY}jg0ywO;QaYy8h1GgBMIvAI< zw>D2~@8mde=;Y~hJXaV69C#dT=g9aR+11xOQFH~jLPNu>h#xaLzY8-fn>Q;sFfjgg z-ear45X1*m$rH1NM}@J>kF9|rDdE9GMPFfIWoDof*^{ob)Y9UB!c0-_t9;k+Ffg+8 zsN`KTVZ6%BB4F^M@}|e7Bgc<22sj+5NJ>{#oo5j#$->CQF-0jNvU6Ma%*oBYjsgk| z2QvHTPM_R8W6SaL=MHjsRRc}&e43+k=g5*GH#x=vEp`qCwxUnM4h@V9uUOf9CaJ9G Q0s5N3)78&qol`;+0NDSp)c^nh literal 0 HcmV?d00001 diff --git a/OsmAnd/res/drawable/h_sec_shield7.png b/OsmAnd/res/drawable/h_sec_shield7.png new file mode 100644 index 0000000000000000000000000000000000000000..04035ca4ad2c4929831a5bd757771e0e48fe91ac GIT binary patch literal 440 zcmeAS@N?(olHy`uVBq!ia0vp^)<7)C!3-or&Zt}jQY`6?zK#qG*KS<#k1zuAB}-f* zN`mv#O3D+9QW+dm@{>{(JaZG%Q-e|yQz{EjrrH1%nFaWSxE@>E^5*8IOS>nZ+|YjK z*!=f*ww>A1{pj4XuTS*uDgF~@y{2BK0VlVb^rA9JNkiIH;7D@1X4mJ zL4Lvi(E-Dw{riQ0vadW{978H@B?+)FvIQ|lh&wPCHk29_Z!{L--w}D^z%E9n4#p)@ zTbn1gcUBxYbn^5$o+}&z4m=KP=g9b|Sk3I6D7r#Yp`oEF^2ZF%Z~Dy2=FJKY42*xh zHmy})xWo!n$rH1N=LtiZA6o-MQo@6Wir)Id%FI9|vFBW;#ihjog_)xKmhD}`!@$VW z6O*^;3)5Cc76F5G6*o^@JbnBqgMh<|$}YV% R{0;OqgQu&X%Q~loCIAtlw6OpH literal 0 HcmV?d00001 diff --git a/OsmAnd/res/drawable/h_sec_shield8.png b/OsmAnd/res/drawable/h_sec_shield8.png new file mode 100644 index 0000000000000000000000000000000000000000..2c914687e5697f5f650d155274b179f5693e712d GIT binary patch literal 442 zcmeAS@N?(olHy`uVBq!ia0vp^PCzWk!3-qhCUi9eDVB6cUq=RpYd5a=M;HP5k|nMY zCBgY=CFO}lsSJ)O`AMk?p1FzXsX?iUDV2pMQ*D5X%mREuT#v17d2@5qrQMTHZfL)A zZ2tQ@+s2c0x6-A zAiv=M=z!tT{{2Eg**Bgpjv*Ddk_1>7*^C$?j2##Z8+a3*C8euK7HrFi0CJu?6dvZi14jw z&^hHdd*;L}c`jI2#^)9w2XwKAUuyD0HQVJzpEw$dwSZmK%jkzi;SW?RtNGg}bo OZw60SKbLh*2~7Yue5|AZ literal 0 HcmV?d00001 diff --git a/OsmAnd/res/drawable/h_ter_shield1.png b/OsmAnd/res/drawable/h_ter_shield1.png new file mode 100644 index 0000000000000000000000000000000000000000..9fad535583ba20155dbe81c59b2c6b52b83c8fd1 GIT binary patch literal 422 zcmeAS@N?(olHy`uVBq!ia0vp^f*{Pn3?z9rZ$AN~SkfJR9T^y|-MHc(VFct$mbgZg z1m~xflqVLYGB~E>C#5QQ<|d}62BjvZR2H60wE-$J3-AeXJ#wu7_=!oc?{7VIYU;&v zvu|Hn`tauJ_YZe`eY)@I?RD2LExLDo#f!U}e!e*L>GAHfXJ%ZvFb}BpGoQvkASF~1 z0evUM}E2rzpzOl|I* z-8yyh^j^UetQ-n#3mDYdxg&&)g{=cP6dD?o*3|R_6idvgkYHhC;>chNVdZGJ!N7Rr zz=5OZ8W?is@POH8dsPk{I>I2};IKEwL#byEP?RO4V^P~&MxYUW4;_UVix`+VUU0>w zwQ$IbGdnOa-aUMbubf}qx>>=2q4Ca{b9{kEPnMu9`XA)$Wb$D*Q*92*J^8vn2g vI0)=F-u%hHu< Up@f`9*Kv{0tpOe?yO}uBOW{j`jNrY)z4*}Q$iB}eX6SF literal 0 HcmV?d00001 diff --git a/OsmAnd/res/drawable/h_ter_shield2.png b/OsmAnd/res/drawable/h_ter_shield2.png new file mode 100644 index 0000000000000000000000000000000000000000..3092a899ba8c3e226f5e363b110692cfab9b21a5 GIT binary patch literal 431 zcmeAS@N?(olHy`uVBq!ia0vp^5Qkqteto*{>FssbFD<%veZ`Brn|{7H^y%^LD;MUSJu?HSwZDA+M<69s z666>BA003}+P_~2DErXU#WAGfR+0bfnj9EUath?8!Of5ZJ(w#L!h-WS}_v$hi|tQy4iE7O-f`8?Tb(>9OHyVqj!3kq@=y zXlMayZEWmrWn|t^XvDxGz|3rJzKlg!nc0DXk@v}=DGAR~8Gu^Na;zdG7??O-aLV~` zE|369&OLj&Px0XKqYMHL4)q&0F8JL%xz$lXp~1l}J<;*v;WH->o>SluaCopG>G9Ji zO|7E#((K9_Yk)=w?RvAuX2XTlCt?ikdJYVR54!jp7?>GmFK1m+HP8Js(6bDlu6{1- HoD!M}$9Sf&a44`XFi~e07JGbCGO~e-fr&%o{HfzTSL@i^-J#dEWdpP2Oi z;f{wlSKq#}^wg=TPj9dL`gGsD>npBbTJ+-Xrk^hkeR{n6?3o!?F3baJos#xs36K&h z3Gxg6j}90f?cXm1lzr~$;uunKD@lNbkWOUDB-~)r6oO`6B!j68p4W&gN~g!%^=|5pv*b@*dZX}fWu?O zB|IybfU=B-Py0DY%9}GgFfbnOoyuCjqi}-(2NR2chFC-J#dEWdpP2Oi z;f{wlSKq#}^wg=TPj9dL`gGsD>npBbTJ+-Xrk^hkeR{n6?3o!?F3baJos#xs36K&h z3Gxg6j}90f?cXm1lzr*x;uunKD@lNbk?jz}8a{;vi33?PcScHnWRx>2+fdcOki?*w z_BiE9(joR678Q{*8@(8rIv7{XXrA1;!1;z`WWy;&CXN-edi!T`lp7m-GT>lh5x8*H zWd;wELMa2|kpl7KZY-q#)RAPI_WmVd1Th z960byF~~GP(Sd={dD8T`7FTQT@Gvm4@Z^VyEjl#2xz$lXp~0c>zopr0HngPqW}N^ literal 0 HcmV?d00001 diff --git a/OsmAnd/res/drawable/h_ter_shield6.png b/OsmAnd/res/drawable/h_ter_shield6.png new file mode 100644 index 0000000000000000000000000000000000000000..4561fb16ec403b0a26ec879604d0d08531cf71b9 GIT binary patch literal 440 zcmeAS@N?(olHy`uVBq!ia0vp^CO|C6!3-pq9{(JaZG%Q-e|yQz{EjrrH1%nFaWSxE?vy|N8#ci|1w^KQZb3 z!yONAuD*R`>8VpwpWa^g_36HQ*H>J>wCKg%O+Q~8`t*4B*)ub)T$l&cIwkGN5+Eg1 z666>BA003}+P_~2DErFO#WAGfR+0b&A~6o!^C-mHC?$92gk? zI`6SnUdvckd*M?k&>^lurf1HiR?+=S!!uB#Z33<3@ZDw0waRp(hmNU$(6aZFK)i0IhXJ+pc8Tt@+g zh69=XQ>Qo2p0P#!z^RiQUe!QTJfFVFu{pA&$W5=VK#QG2fvxD1utNhQ!^drGK0Axf RJplTe!PC{xWt~$(699-0vp)a; literal 0 HcmV?d00001 diff --git a/OsmAnd/res/drawable/h_ter_shield7.png b/OsmAnd/res/drawable/h_ter_shield7.png new file mode 100644 index 0000000000000000000000000000000000000000..80b4a16457e6637a674c7341db91a5e0218844ee GIT binary patch literal 440 zcmeAS@N?(olHy`uVBq!ia0vp^)<7)C!3-or&Zt}jQY`6?zK#qG*KS<#k1zuAB}-f* zN`mv#O3D+9QW+dm@{>{(JaZG%Q-e|yQz{EjrrH1%nFaWSxE?vy|N8#ci|1w^KQZb3 z!yONAuD*R`>8VpwpWa^g_36HQ*H>J>wCKg%O+Q~8`t*4B*)ub)T$l&cIwkGN5+Eg1 z666>BA003}+P_~2DErFO#WAGfR+0bR?#}1x8#dC#2z=6kMt;`%B6|0$ZC$g@PRA^|Zy7^;<=Qn+3W&UOb2L{H! zUYph`FkE5At~X(BPDNrVP$5ZlGt;;)8f+NfWk~se#`di@Gvm4 z^u)+*`ogr8kww5@UB%6l7f&BQ%OK!z;74kzqH>*OgaivC6UUTw5fL6+XU=S%Jl9b` zq2a*GnNz1X&u;mmbKulT4zKe-Q%<_S$+1y+qU@$uS767)p}@xVN#CJ?kzso+TUprO S&Y3`8GkCiCxvX-J#dEWdpP2Oi z;f{wlSKq#}^wg=TPj9dL`gGsD>npBbTJ+-Xrk^hkeR{n6?3o!?F3baJos#xs36K&h z3Gxg6j}90f?cXm1lzrpr;uunKD@lNbkSz4-!I6xb$k z=FI7d@ljzmI)^XzX(MmD4|un1h>FtbZ5I^5JavE5NXp`qcS z!#ZgPh9!~;4H6PNA|*5!*2wTMFdjK@;HYb-pid8w&GLoMT-D9svk^$Q=9HaHt&Bi@ zolWgR$_=|1nK&eN?s+33aq#$A1_6fyB?nJA)$MwakSM^yp%CyYB~kIR>=~IkZ+M!3 z2Axx0vq$F6lIMbqVSa7_azGb*_@$;lR0G=9 P^f!a2tDnm{r-UW|!)LJ} literal 0 HcmV?d00001 diff --git a/OsmAnd/res/drawable/h_tru_shield1.png b/OsmAnd/res/drawable/h_tru_shield1.png new file mode 100644 index 0000000000000000000000000000000000000000..bbdd6fcc8d4b985e327a50114ef09b4aa04e6f2d GIT binary patch literal 422 zcmeAS@N?(olHy`uVBq!ia0vp^f*{Pn3?z9rZ$AN~SkfJR9T^y|-MHc(VFct$mbgZg z1m~xflqVLYGB~E>C#5QQ<|d}62BjvZR2H60wE-$J3-AeXZC~BqyT13r!wVZvZQOTd z-{dWmuRXgqfA9PwH;z1d|7i8G)u-;B+Hroz%P%kQyt=dW;L@2pW&*X|6jv?>QbHv` ze!>6I0mGyH`-OnAH#}V&Ln>}139vA-aWHIVWa?l%ll~+r@ljeDYd0f{0JBHK%*mbY zb7wYBZxuYj%AvrvfPr1zIzm`mSUP}1p`k(POifQfvBZoWk}Ql&92smOtQ-wD7#NQn zIB@h>1A~qX514(pS>@2VBMbr#4trxflzR36MOi{R7Pa*<0*&Z<=qAKi#K6Syf-5ep zg+pGP*@1!a?%_jh<^1f@%?b_-jd#u*V+%Zb;^4_s3LF9s3H2L46cudzyt%-r@eiwj ugTVgHM#aX4A2}NS@(DQbNIYZ~NMJB~%35~Ma*7Plj|`r!elF{r5}E)ZMW)&S literal 0 HcmV?d00001 diff --git a/OsmAnd/res/drawable/h_tru_shield2.png b/OsmAnd/res/drawable/h_tru_shield2.png new file mode 100644 index 0000000000000000000000000000000000000000..e33d296b93acc58bc360a1622118c1b80396e513 GIT binary patch literal 431 zcmeAS@N?(olHy`uVBq!ia0vp^58Au70 z1o;L3M+Xd#_U{)0%0BdTaSW-rl_bEz$R@%d#>An(w!y$y+*(FJlo_W_Dm;&=GwYsv#8lVwEyL58yY`Bp6M3A9f&w;`4K^K1m12e^}Um~ zOuqK)+Qw5G_g&d{|;+C$B>F!Ndhd4Y&i@%%mNNP36W`fWo{t{&K_e5V+8UQGR^$l zk9tbN=8d1r7m+1s{@AkESshv#WDAD>yJT9-cpU zdNa4~AJ!X|l8z7g1so>)NKSn0)@|=5S6A?dkwt*H@drDH0fYEo)^n1ft;s;|GI+ZB KxvXwB*~ zyEb{tZ1s-wJ5Jp__43QhJFo7{+%a?M!KFa0*I)hT2U0>M zL4Lvi(E-Dw{riQ0vd=wT978H@B?+)Fve_`KVNht0IM6j?=MBk?Omb#n8=M*#k{DJd zJx+O&c8KeSMa9jTjadv#9gHiwnkRE^pSz|<$Dx#gktO8VvEx1Gb9s7fc$$FR5^=lD z4h%~`hDq#*kl=2M~z~Qmt z5}p-IKv~Aar@b5`<;9sD7#I)t&SkCNQMkc?gNa2zLo6cV!;Ir+4xT)vz#-u9z#{ee z(+7v-mNUJX)3d;Wl|#XUD>3!)!Ff&+JAWS3WC1#$!#kgWk&R*T1lAvmjy4w70} znY`otj%&}ZJ$nD>)ZJ72uIyWVZ1u)d8;{&L^76~enLB3Qd39&$!KFa0(|)Y11X4mJ zL4Lvi(E-Dw{riQ0vadZ|978H@B?+)FvK?Yr!>7<7aUg5vP7BG8jC^@w8>$)@k{C3f zrKP8&9%A27Sz$S|(TkC(gK@=-_PL!4oFgP|Hk@K);#e_j_WYR~<;DdC1{_Q*0vFD@ z%-~^CC}m(ga^S$xV-7M2PZJq96ci46Ey+?dV*{F*knlt)$dp;1*@3~(pg<_wOx_;I zWMrP*>~S?lhKGTXg~u~a>`}<)VnYTN0fRl3H#@lU!_3$m8yJ|5s!B^IUY=Qb{(JaZG%Q-e|yQz{EjrrH1%nFaWSxVEouzwq$F{Jryg*Z1zb zvhUinYa35(oV;c7ksC)Iy?=D-?y1$sR_{2!r^cV69DdT{B?9W#MiKL&Qs0#ZUH zL4Lvi(E-Dw{riQ0vadW{978H@B?+)FvMpkauykNBY}jg0yxBmAamS4t2X8Sjbucbz z@0~ocy_4g>v4f`%@mygPaNu#Um6_vnWLMwZiJ~jG6&f05-S{!1^Sdy!vUszC0|Vn< z=RLLx3_*NAl{|OW@Tf3~@v${9Bqcm}sOT#!tjr8lB74$zmRedIP?#yoeUVyCX82^Sp*DTRNnNwbmaJ11_6fy6-kMzs`D%&Bv}}lIHo8?M0RfLp4mKkuA_iL z!-35H*6Gc&XKXos{?JJduWFzvo=@N8#2i^t{(JaZG%Q-e|yQz{EjrrH1%nFaWSxVEouzwq$F{Jryg*Z1zb zvhUinYa35(oV;c7ksC)Iy?=D-?y1$sR_{2!r^cV69DdT{B?9W#MiKL&Qs0#ZUH zL4Lvi(E-Dw{riQ0vadW{978H@B?+)FvIQ|lh&wPCHk29_Z#EF(-*Mx{!Cj0@9gIt+ z_D-JI-dSc&=~=IPf^Em6_wCVl{K_M9~$J3JncaH-F6V{HD*WEZ(f(z`*#| zYtvcHsDWe{*U@FO)*Rk_YGLXw4%iDSyTh)B<^GiNqWp6e)} z&~V`8%+~46vs=ELIe+LRhu3+aDJR|Ewc$gp)UTiNfc RN}w=d@O1TaS?83{1OTRSwKM<# literal 0 HcmV?d00001 diff --git a/OsmAnd/res/drawable/h_tru_shield8.png b/OsmAnd/res/drawable/h_tru_shield8.png new file mode 100644 index 0000000000000000000000000000000000000000..587324a7c09b0424cc24c045ded7b9327d892edd GIT binary patch literal 442 zcmeAS@N?(olHy`uVBq!ia0vp^PCzWk!3-qhCUi9eDVB6cUq=RpYd5a=M;HP5k|nMY zCBgY=CFO}lsSJ)O`AMk?p1FzXsX?iUDV2pMQ*D5X%mREuT-#T-UwC+7{@(e$>wB*~ zySDGjzKy3gPTn&4$c-b9-ap!Le#h!#t54lM_43QhJFo66J-Bq{j+sEMsjJt21X4mJ zL4Lvi(E-Dw{riQ0vTrshnpHFwmS+aG&DSP zSSRhkutZX!K|*3jq=W{;8W|o2#v=y~9Chs!^yvYzS-$X@tGXF{HUjC^oU*g2l@X|~ zv#DK3xnUP06NkjkJ#R!L4jw2>@?5Yk%+D=A4(MVJztr@{inhy*iZ~mJwSZmK%jkzkn6%C>;J=;ThI PzZpDT{an^LB{Ts5Pn527 literal 0 HcmV?d00001 diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 8bc34b203e..44345e30d0 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -53,7 +53,7 @@ Day/Night Mode \tThe map appearance can for some vector maps be changed between day (brighter) and night (darker). \n\tNight colors are safer for night driving. - \n\tYou can set a policy for day/night switching in \'Main Menu\' -> \'Settings\' -> \'Maps\' ->\'Day/night mode\'. + \n\tYou can set a policy for day/night switching in \'Main Menu\' -> \'Settings\' -> \'Map appearance\' ->\'Day/night mode\'. \n\tChoices are: \n\t\'Sunrise/Sunset\' - automatic mode, controlled by position of the sun (default) \n\t\'Day\' - always use day mode diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index b777789fe6..8aa2f049ec 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -500,7 +500,7 @@ public class OsmandSettings { public final OsmandPreference MAX_LEVEL_TO_DOWNLOAD_TILE = new IntPreference("max_level_download_tile", 18, false, true); // this value string is synchronized with settings_pref.xml preference name - public final OsmandPreference LEVEL_TO_SWITCH_VECTOR_RASTER = new IntPreference("level_to_switch_vector_raster", 5, false, true); + public final OsmandPreference LEVEL_TO_SWITCH_VECTOR_RASTER = new IntPreference("level_to_switch_vector_raster", 1, false, true); // this value string is synchronized with settings_pref.xml preference name public final OsmandPreference MAP_VIEW_3D = new BooleanPreference("map_view_3d", false, false); diff --git a/OsmAnd/src/net/osmand/plus/activities/MainMenuActivity.java b/OsmAnd/src/net/osmand/plus/activities/MainMenuActivity.java index 69b7af0fc7..401729dbee 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MainMenuActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MainMenuActivity.java @@ -164,9 +164,11 @@ public class MainMenuActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + boolean exit = false; if(getIntent() != null){ Intent intent = getIntent(); if(intent.getExtras() != null && intent.getExtras().containsKey(APP_EXIT_KEY)){ + exit = true; finish(); } } @@ -222,10 +224,11 @@ public class MainMenuActivity extends Activity { activity.startActivity(search); } }); + if(exit){ + return; + } - ((OsmandApplication)getApplication()).checkApplicationIsBeingInitialized(this); - - + ((OsmandApplication)getApplication()).checkApplicationIsBeingInitialized(this); SharedPreferences pref = getPreferences(MODE_WORLD_WRITEABLE); boolean firstTime = false; if(!pref.contains(FIRST_TIME_APP_RUN)){ diff --git a/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java index 85840321da..64f116dd00 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java @@ -231,7 +231,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference } registerListPreference(osmandSettings.MAX_LEVEL_TO_DOWNLOAD_TILE, screen, entries, intValues); - startZoom = 3; + startZoom = 1; endZoom = 18; entries = new String[endZoom - startZoom + 1]; intValues = new Integer[endZoom - startZoom + 1]; diff --git a/OsmAnd/src/net/osmand/plus/render/MapVectorLayer.java b/OsmAnd/src/net/osmand/plus/render/MapVectorLayer.java index 3d0fc56c72..ef5413eb38 100644 --- a/OsmAnd/src/net/osmand/plus/render/MapVectorLayer.java +++ b/OsmAnd/src/net/osmand/plus/render/MapVectorLayer.java @@ -93,24 +93,24 @@ public class MapVectorLayer extends BaseMapLayer { tileLayer.drawTileMap(canvas, tilesRect); resourceManager.getRenderer().interruptLoadingMap(); } else { - if (!view.isZooming()){ + if (!view.isZooming()) { pixRect.set(0, 0, view.getWidth(), view.getHeight()); updateRotatedTileBox(); - if(resourceManager.updateRenderedMapNeeded(rotatedTileBox)){ + if (resourceManager.updateRenderedMapNeeded(rotatedTileBox)) { // pixRect.set(-view.getWidth(), -view.getHeight() / 2, 2 * view.getWidth(), 3 * view.getHeight() / 2); - pixRect.set(-view.getWidth()/3, -view.getHeight() / 4, 4 * view.getWidth() /3, 5 * view.getHeight() / 4); + pixRect.set(-view.getWidth() / 3, -view.getHeight() / 4, 4 * view.getWidth() / 3, 5 * view.getHeight() / 4); updateRotatedTileBox(); resourceManager.updateRendererMap(rotatedTileBox); // does it slow down Map refreshing ? // Arguments : 1. Map request to read data slows whole process // 2. It works in operating memory - if(!warningToSwitchMapShown){ - if(!resourceManager.getRenderer().containsLatLonMapData(view.getLatitude(), view.getLongitude(), view.getZoom())){ + if (!warningToSwitchMapShown) { + if (!resourceManager.getRenderer().containsLatLonMapData(view.getLatitude(), view.getLongitude(), view.getZoom())) { Toast.makeText(view.getContext(), R.string.switch_to_raster_map_to_see, Toast.LENGTH_LONG).show(); warningToSwitchMapShown = true; } } } - + } MapRenderRepositories renderer = resourceManager.getRenderer(); diff --git a/OsmAnd/src/net/osmand/plus/render/OsmandRenderer.java b/OsmAnd/src/net/osmand/plus/render/OsmandRenderer.java index 89e0ff807d..7318196532 100644 --- a/OsmAnd/src/net/osmand/plus/render/OsmandRenderer.java +++ b/OsmAnd/src/net/osmand/plus/render/OsmandRenderer.java @@ -685,8 +685,8 @@ public class OsmandRenderer { rc.main.updatePaint(paint); canvas.drawPath(path, paint); // for test purpose - // rc.second.strokeWidth = 1.5f; - // rc.second.color = Color.BLACK; + // rc.second.strokeWidth = 1.5f; + // rc.second.color = Color.BLACK; if (rc.second.strokeWidth != 0) { rc.second.updatePaint(paint); diff --git a/OsmAnd/src/net/osmand/plus/render/RenderingIcons.java b/OsmAnd/src/net/osmand/plus/render/RenderingIcons.java index 35354748b9..17a14ce54e 100644 --- a/OsmAnd/src/net/osmand/plus/render/RenderingIcons.java +++ b/OsmAnd/src/net/osmand/plus/render/RenderingIcons.java @@ -1,9 +1,11 @@ package net.osmand.plus.render; +import java.lang.reflect.Field; import java.util.LinkedHashMap; import java.util.Map; import net.osmand.plus.R; +import net.osmand.plus.R.drawable; public class RenderingIcons { @@ -16,183 +18,19 @@ public class RenderingIcons { return icons; } - private static void initIcons() { - icons.put("aerodrome", R.drawable.h_aerodrome); //$NON-NLS-1$ - icons.put("airport", R.drawable.h_airport); //$NON-NLS-1$ - icons.put("alpine_hut", R.drawable.h_alpine_hut); //$NON-NLS-1$ - icons.put("amenity_court", R.drawable.h_amenity_court); //$NON-NLS-1$ - icons.put("arts_centre", R.drawable.g_amenity_arts_centre); //$NON-NLS-1$ - icons.put("atm", R.drawable.h_atm); //$NON-NLS-1$ - icons.put("bank", R.drawable.h_bank); //$NON-NLS-1$ - icons.put("bar", R.drawable.h_bar); //$NON-NLS-1$ - icons.put("beach", R.drawable.h_beach); //$NON-NLS-1$ - icons.put("bench", R.drawable.g_amenity_bench); //$NON-NLS-1$ - icons.put("biergarten", R.drawable.h_biergarten); //$NON-NLS-1$ - icons.put("bicycle_rental", R.drawable.h_bicycle_rental); //$NON-NLS-1$ - icons.put("bollard", R.drawable.h_bollard); //$NON-NLS-1$ - icons.put("books", R.drawable.g_shop_books); //$NON-NLS-1$ - icons.put("bus_station", R.drawable.h_bus_station); //$NON-NLS-1$ - icons.put("bus_stop_small", R.drawable.h_bus_stop_small); //$NON-NLS-1$ - icons.put("bus_stop", R.drawable.h_bus_stop); //$NON-NLS-1$ - icons.put("cable_car", R.drawable.h_cable_car); //$NON-NLS-1$ - icons.put("cafe", R.drawable.h_cafe); //$NON-NLS-1$ - icons.put("camp_site", R.drawable.h_camp_site); //$NON-NLS-1$ - icons.put("car_sharing", R.drawable.h_car_sharing); //$NON-NLS-1$ - icons.put("caravan_park", R.drawable.h_caravan_park); //$NON-NLS-1$ - icons.put("casino", R.drawable.g_tourist_casino); //$NON-NLS-1$ - icons.put("castle", R.drawable.g_historic_castle); //$NON-NLS-1$ - icons.put("cave_entrance", R.drawable.h_cave_entrance); //$NON-NLS-1$ - icons.put("chair_lift", R.drawable.h_chair_lift); //$NON-NLS-1$ - icons.put("chalet", R.drawable.h_chalet); //$NON-NLS-1$ - icons.put("cinema", R.drawable.h_cinema); //$NON-NLS-1$ - icons.put("cliff", R.drawable.h_cliff); //$NON-NLS-1$ - icons.put("cliff2", R.drawable.h_cliff2); //$NON-NLS-1$ - icons.put("computer", R.drawable.g_shop_computer); //$NON-NLS-1$ - icons.put("confectionery", R.drawable.g_shop_confectionery); //$NON-NLS-1$ - icons.put("courthouse", R.drawable.g_amenity_courthouse); //$NON-NLS-1$ - icons.put("danger", R.drawable.h_danger); //$NON-NLS-1$ - icons.put("department_store", R.drawable.h_department_store); //$NON-NLS-1$ - icons.put("do_it_yourself", R.drawable.g_shop_diy); //$NON-NLS-1$ - icons.put("drinking_water", R.drawable.h_drinking_water); //$NON-NLS-1$ - icons.put("embassy", R.drawable.h_embassy); //$NON-NLS-1$ - icons.put("emergency_phone", R.drawable.h_emergency_phone); //$NON-NLS-1$ - icons.put("entrance", R.drawable.g_barrier_entrance); //$NON-NLS-1$ - icons.put("exchange", R.drawable.g_money_exchange); //$NON-NLS-1$ - icons.put("fast_food", R.drawable.h_fast_food); //$NON-NLS-1$ - icons.put("fire_station", R.drawable.h_fire_station); //$NON-NLS-1$ - icons.put("forest", R.drawable.h_forest); //$NON-NLS-1$ - icons.put("fuel", R.drawable.h_fuel); //$NON-NLS-1$ - icons.put("gate2", R.drawable.h_gate2); //$NON-NLS-1$ - icons.put("geocache_found", R.drawable.h_geocache_found); //$NON-NLS-1$ - icons.put("geocache_not_found", R.drawable.h_geocache_not_found); //$NON-NLS-1$ - icons.put("guest_house", R.drawable.h_guest_house); //$NON-NLS-1$ - icons.put("glacier", R.drawable.h_glacier); //$NON-NLS-1$ - icons.put("grave_yard", R.drawable.h_grave_yard); //$NON-NLS-1$ - icons.put("guest_house", R.drawable.h_guest_house); //$NON-NLS-1$ - icons.put("florist", R.drawable.h_florist); //$NON-NLS-1$ - icons.put("fountain", R.drawable.g_amenity_fountain); //$NON-NLS-1$ - icons.put("garden_centre", R.drawable.g_shop_garden_centre); //$NON-NLS-1$ - icons.put("halt", R.drawable.h_halt); //$NON-NLS-1$ - icons.put("helipad", R.drawable.h_helipad); //$NON-NLS-1$ - icons.put("hospital", R.drawable.h_hospital); //$NON-NLS-1$ - icons.put("hostel", R.drawable.h_hostel); //$NON-NLS-1$ - icons.put("hotel", R.drawable.h_hotel); //$NON-NLS-1$ - icons.put("ice_cream", R.drawable.g_food_ice_cream); //$NON-NLS-1$ - icons.put("information", R.drawable.h_information); //$NON-NLS-1$ - icons.put("jewelry", R.drawable.g_shop_jewelry); //$NON-NLS-1$ - icons.put("kiosk", R.drawable.g_shop_kiosk); //$NON-NLS-1$ - icons.put("level_crossing", R.drawable.h_level_crossing); //$NON-NLS-1$ - icons.put("level_crossing2", R.drawable.h_level_crossing2); //$NON-NLS-1$ - icons.put("library", R.drawable.h_library); //$NON-NLS-1$ - icons.put("liftgate", R.drawable.h_liftgate); //$NON-NLS-1$ - icons.put("lighthouse", R.drawable.h_lighthouse); //$NON-NLS-1$ - icons.put("lock_gate", R.drawable.h_lock_gate); //$NON-NLS-1$ - icons.put("marketplace", R.drawable.g_amenity_marketplace); //$NON-NLS-1$ - icons.put("marsh", R.drawable.h_marsh); //$NON-NLS-1$ - icons.put("mast", R.drawable.h_mast); //$NON-NLS-1$ - icons.put("memorial", R.drawable.h_memorial); //$NON-NLS-1$ - icons.put("motel", R.drawable.h_motel); //$NON-NLS-1$ - icons.put("mini_roundabout", R.drawable.h_mini_roundabout); //$NON-NLS-1$ - icons.put("mud", R.drawable.h_mud); //$NON-NLS-1$ - icons.put("museum", R.drawable.h_museum); //$NON-NLS-1$ - icons.put("music", R.drawable.g_shop_music); //$NON-NLS-1$ - icons.put("nr", R.drawable.h_nr); //$NON-NLS-1$ - icons.put("optician", R.drawable.g_health_optician); //$NON-NLS-1$ - icons.put("orchard", R.drawable.h_orchard); //$NON-NLS-1$ - icons.put("parking", R.drawable.h_parking); //$NON-NLS-1$ - icons.put("peak", R.drawable.h_peak); //$NON-NLS-1$ - icons.put("shop_pet", R.drawable.g_shop_pet); //$NON-NLS-1$ - icons.put("pharmacy", R.drawable.h_pharmacy); //$NON-NLS-1$ - icons.put("picnic_site", R.drawable.h_picnic_site); //$NON-NLS-1$ - icons.put("place_of_worship", R.drawable.h_place_of_worship); //$NON-NLS-1$ - icons.put("playground", R.drawable.h_playground); //$NON-NLS-1$ - icons.put("police", R.drawable.h_police); //$NON-NLS-1$ - icons.put("postbox", R.drawable.h_postbox); //$NON-NLS-1$ - icons.put("postoffice", R.drawable.h_postoffice); //$NON-NLS-1$ - icons.put("power_tower", R.drawable.h_power_tower); //$NON-NLS-1$ - icons.put("power_wind", R.drawable.h_power_wind); //$NON-NLS-1$ - icons.put("prison", R.drawable.h_prison); //$NON-NLS-1$ - icons.put("pub", R.drawable.h_pub); //$NON-NLS-1$ - icons.put("quarry2", R.drawable.h_quarry2); //$NON-NLS-1$ - icons.put("recycling", R.drawable.h_recycling); //$NON-NLS-1$ - icons.put("restaurant", R.drawable.h_restaurant); //$NON-NLS-1$ - icons.put("school", R.drawable.h_school); //$NON-NLS-1$ - icons.put("scrub", R.drawable.h_scrub); //$NON-NLS-1$ - icons.put("shelter", R.drawable.h_shelter); //$NON-NLS-1$ - icons.put("shop_bakery", R.drawable.h_shop_bakery); //$NON-NLS-1$ - icons.put("shop_butcher", R.drawable.h_shop_butcher); //$NON-NLS-1$ - icons.put("shop_clothes", R.drawable.h_shop_clothes); //$NON-NLS-1$ - icons.put("shop_convenience", R.drawable.h_shop_convenience); //$NON-NLS-1$ - icons.put("shop_diy", R.drawable.h_shop_diy); //$NON-NLS-1$ - icons.put("shop_bicycle", R.drawable.h_shop_bicycle); //$NON-NLS-1$ - icons.put("shop_car", R.drawable.h_shop_car); //$NON-NLS-1$ - icons.put("shop_car_repair", R.drawable.h_shop_car_repair); //$NON-NLS-1$ - icons.put("shop_hairdresser", R.drawable.h_shop_hairdresser); //$NON-NLS-1$ - icons.put("shop_supermarket", R.drawable.h_shop_supermarket); //$NON-NLS-1$ - icons.put("slipway", R.drawable.h_slipway); //$NON-NLS-1$ - icons.put("sports_centre", R.drawable.g_leisure_sports_centre); //$NON-NLS-1$ - icons.put("spring", R.drawable.h_spring); //$NON-NLS-1$ - icons.put("station_small", R.drawable.h_station_small); //$NON-NLS-1$ - icons.put("station", R.drawable.h_station); //$NON-NLS-1$ - icons.put("subway_entrance", R.drawable.h_subway_entrance); //$NON-NLS-1$ - icons.put("taxi", R.drawable.g_transport_taxi); //$NON-NLS-1$ - icons.put("telephone", R.drawable.h_telephone); //$NON-NLS-1$ - icons.put("theatre", R.drawable.h_theatre); //$NON-NLS-1$ - icons.put("toilets", R.drawable.h_toilets); //$NON-NLS-1$ - icons.put("toys", R.drawable.g_shop_toys); //$NON-NLS-1$ - icons.put("traffic_light", R.drawable.h_traffic_light); //$NON-NLS-1$ - icons.put("highway_ford", R.drawable.h_highway_ford); //$NON-NLS-1$ - icons.put("tree", R.drawable.h_tree); //$NON-NLS-1$ - icons.put("tree2", R.drawable.h_tree2); //$NON-NLS-1$ - icons.put("university", R.drawable.g_amenity_university); //$NON-NLS-1$ - icons.put("vending_machine", R.drawable.g_amenity_vending_machine); //$NON-NLS-1$ - icons.put("viewpoint", R.drawable.h_viewpoint); //$NON-NLS-1$ - icons.put("vineyard", R.drawable.h_vineyard); //$NON-NLS-1$ - icons.put("volcano", R.drawable.h_volcano); //$NON-NLS-1$ - icons.put("water_tower", R.drawable.h_water_tower); //$NON-NLS-1$ - icons.put("windmill", R.drawable.h_windmill); //$NON-NLS-1$ - icons.put("zoo", R.drawable.h_zoo); //$NON-NLS-1$ - - icons.put("mot_shield1", R.drawable.mot_shield1); //$NON-NLS-1$ - icons.put("mot_shield2", R.drawable.mot_shield2); //$NON-NLS-1$ - icons.put("mot_shield3", R.drawable.mot_shield3); //$NON-NLS-1$ - icons.put("mot_shield4", R.drawable.mot_shield4); //$NON-NLS-1$ - icons.put("mot_shield5", R.drawable.mot_shield5); //$NON-NLS-1$ - icons.put("mot_shield6", R.drawable.mot_shield6); //$NON-NLS-1$ - icons.put("mot_shield7", R.drawable.mot_shield7); //$NON-NLS-1$ - icons.put("mot_shield8", R.drawable.mot_shield8); //$NON-NLS-1$ - icons.put("pri_shield1", R.drawable.pri_shield1); //$NON-NLS-1$ - icons.put("pri_shield2", R.drawable.pri_shield2); //$NON-NLS-1$ - icons.put("pri_shield3", R.drawable.pri_shield3); //$NON-NLS-1$ - icons.put("pri_shield4", R.drawable.pri_shield4); //$NON-NLS-1$ - icons.put("pri_shield5", R.drawable.pri_shield5); //$NON-NLS-1$ - icons.put("pri_shield6", R.drawable.pri_shield6); //$NON-NLS-1$ - icons.put("pri_shield7", R.drawable.pri_shield7); //$NON-NLS-1$ - icons.put("pri_shield8", R.drawable.pri_shield8); //$NON-NLS-1$ - icons.put("sec_shield1", R.drawable.sec_shield1); //$NON-NLS-1$ - icons.put("sec_shield2", R.drawable.sec_shield2); //$NON-NLS-1$ - icons.put("sec_shield3", R.drawable.sec_shield3); //$NON-NLS-1$ - icons.put("sec_shield4", R.drawable.sec_shield4); //$NON-NLS-1$ - icons.put("sec_shield5", R.drawable.sec_shield5); //$NON-NLS-1$ - icons.put("sec_shield6", R.drawable.sec_shield6); //$NON-NLS-1$ - icons.put("sec_shield7", R.drawable.sec_shield7); //$NON-NLS-1$ - icons.put("sec_shield8", R.drawable.sec_shield8); //$NON-NLS-1$ - icons.put("ter_shield1", R.drawable.ter_shield1); //$NON-NLS-1$ - icons.put("ter_shield2", R.drawable.ter_shield2); //$NON-NLS-1$ - icons.put("ter_shield3", R.drawable.ter_shield3); //$NON-NLS-1$ - icons.put("ter_shield4", R.drawable.ter_shield4); //$NON-NLS-1$ - icons.put("ter_shield5", R.drawable.ter_shield5); //$NON-NLS-1$ - icons.put("ter_shield6", R.drawable.ter_shield6); //$NON-NLS-1$ - icons.put("ter_shield7", R.drawable.ter_shield7); //$NON-NLS-1$ - icons.put("ter_shield8", R.drawable.ter_shield8); //$NON-NLS-1$ - icons.put("tru_shield1", R.drawable.tru_shield1); //$NON-NLS-1$ - icons.put("tru_shield2", R.drawable.tru_shield2); //$NON-NLS-1$ - icons.put("tru_shield3", R.drawable.tru_shield3); //$NON-NLS-1$ - icons.put("tru_shield4", R.drawable.tru_shield4); //$NON-NLS-1$ - icons.put("tru_shield5", R.drawable.tru_shield5); //$NON-NLS-1$ - icons.put("tru_shield6", R.drawable.tru_shield6); //$NON-NLS-1$ - icons.put("tru_shield7", R.drawable.tru_shield7); //$NON-NLS-1$ - icons.put("tru_shield8", R.drawable.tru_shield8); //$NON-NLS-1$ - } + public static void initIcons() { + Class cl = R.drawable.class; + for (Field f : cl.getDeclaredFields()) { + if (f.getName().startsWith("h_") || f.getName().startsWith("g_")) { + try { + icons.put(f.getName().substring(2), f.getInt(null)); + } catch (IllegalArgumentException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + } + } + } } diff --git a/config/basemap/README b/config/basemap/README new file mode 100644 index 0000000000..19851b2bf4 --- /dev/null +++ b/config/basemap/README @@ -0,0 +1,14 @@ +1. Find and install perl Geo-ShapeFile-2.52 + cd Geo-ShapeFile-2.52/ + sudo perl Makefile.PL + make + make test + +2. Locate and run shp2osm.pl. +Example (replacing tags): perl ./shp2osm.pl 10m-coastline/10m_coastline.shp | sed 's/FeatureCla/natural/g;s/Coastline/coastline/g' > 10m_coastline.osm +3. Fix manually all 180 degrees breaks (simply divide islands into 2 islands and add connect line on 180 degree) and make Antarctica cycled. +4. Run net.osmand.osm.util.FixLinkedCoastline from DataExtractionosm.jar with arg0=filename. +5. !Fix manually Caspey Sea ! +6. ! Check 2 ShriLanka islands (2 coastlines on one place) +6. ! Check North America for bug! +7. Run Index Creator. diff --git a/config/basemap/shp2osm.pl b/config/basemap/shp2osm.pl new file mode 100755 index 0000000000..889612bf2c --- /dev/null +++ b/config/basemap/shp2osm.pl @@ -0,0 +1,167 @@ +# Copyright (c) 2006 Gabriel Ebner +# updated in 2008 by Tobias Wendorff +# HTML-Entities based on ideas of Hermann Schwärzler +# Gauß-Krüger implementation based on gauss.pl by Andreas Achtzehn +# version 1.3 (17. September 2008) + +use Geo::ShapeFile; +use HTML::Entities qw(encode_entities_numeric); +use Math::Trig; + +if(@ARGV == 0) { + print "usage:\n"; + print "with transformation from GK to WGS84: 'shp2osm.pl shapefile GK'\n"; + print "without transformation: 'shp2osm.pl shapefile'"; + exit; +} + +print <<'END'; + + +END + +#BEGIN { our %default_tags = ( natural => 'water', source => 'SWDB' ); } +BEGIN { our %default_tags = ( ); } + +my $file = @ARGV[0]; +$file =~ s/\.shp$//; +my $shpf = Geo::ShapeFile->new($file); +proc_shpf($shpf); + +{ + BEGIN { our $i = -1; } + + sub tags_out { + my ($tags) = @_; + my %tags = $tags ? %$tags : (); + #$tags{'created_by'} ||= 'shp2osm.pl'; + delete $tags{'_deleted'} unless $tags{'_deleted'}; + while ( my ( $k, $v ) = each %tags ) { + my $key = encode_entities_numeric($k); + my $val = encode_entities_numeric($v); + print ' \n" if $val; + } + } + + sub node_out { + my ( $lon, $lat, $tags ) = @_; + my $id = $i--; + if(@ARGV[1] eq 'GK') { + my ($wgs84lon, $wgs84lat) = gk2geo($lon, $lat); + print " \n"; + } else { + print " \n"; + } + $id; + } + + sub seg_out { + my $id = $i+1; + $id; + } + + sub way_out { + my ( $segs, $tags ) = @_; + my $id = $i--; + print " \n"; + print " \n" for @$segs; + tags_out $tags; + print " \n"; + $id; + } +} + + +print <<'END'; + +END + +sub polyline_out { + my ( $pts, $tags, $connect_last_seg ) = @_; + + my ( $first_node, $last_node, @segs ); + for my $pt (@$pts) { + my $node = node_out @$pt; + push @segs, seg_out $last_node, $node; + $last_node = $node; + $first_node ||= $last_node; + } + push @segs, seg_out $last_node, $first_node + if $first_node && $connect_last_seg; + way_out \@segs, $tags; +} + +sub proc_obj { + my ( $shp, $dbf, $type ) = @_; + my $tags = { %default_tags, %$dbf }; + my $is_polygon = $type % 10 == 5; + for ( 1 .. $shp->num_parts ) { + polyline_out [ map( [ $_->X(), $_->Y() ], $shp->get_part($_) ) ], $tags, + $is_polygon; + } + } + +sub proc_shpf { + my ($shpf) = @_; + my $type = $shpf->shape_type; + for ( 1 .. $shpf->shapes() ) { + my $shp = $shpf->get_shp_record($_); + my %dbf = $shpf->get_dbf_record($_); + proc_obj $shp, \%dbf, $type; + } +} + +sub gk2geo { + my $sr = $_[0]; + my $sx = $_[1]; + + my $bm = int($sr/1000000); + my $y = $sr-($bm*1000000+500000); + my $si = $sx/111120.6196; + my $px = $si+0.143885358*sin(2*$si*0.017453292)+0.00021079*sin(4*$si*0.017453292)+0.000000423*sin(6*$si*0.017453292); + my $t = (sin($px*0.017453292))/(cos($px*0.017453292)); + my $v = sqrt(1+0.006719219*cos($px*0.017453292)*cos($px*0.017453292)); + my $ys = ($y*$v)/6398786.85; + my $lat = $px-$ys*$ys*57.29577*$t*$v*$v*(0.5-$ys*$ys*(4.97-3*$t*$t)/24); + my $dl = $ys*57.29577/cos($px*0.017453292) * (1-$ys*$ys/6*($v*$v+2*$t*$t-$ys*$ys*(0.6+1.1*$t*$t)*(0.6+1.1*$t*$t))); + my $lon = $bm*3+$dl; + + my $potsd_a = 6377397.155; + my $wgs84_a = 6378137.0; + my $potsd_f = 1/299.152812838; + my $wgs84_f = 1/298.257223563; + + my $potsd_es = 2*$potsd_f - $potsd_f*$potsd_f; + + my $potsd_dx = 606.0; + my $potsd_dy = 23.0; + my $potsd_dz = 413.0; + my $pi = 3.141592654; + my $latr = $lat/180*$pi; + my $lonr = $lon/180*$pi; + + my $sa = sin($latr); + my $ca = cos($latr); + my $so = sin($lonr); + my $co = cos($lonr); + + my $bda = 1-$potsd_f; + + my $delta_a = $wgs84_a - $potsd_a; + my $delta_f = $wgs84_f - $potsd_f; + + my $rn = $potsd_a / sqrt(1-$potsd_es*sin($latr)*sin($latr)); + my $rm = $potsd_a * ((1-$potsd_es)/sqrt(1-$potsd_es*sin($latr)*sin($latr)*1-$potsd_es*sin($latr)*sin($latr)*1-$potsd_es*sin($latr)*sin($latr))); + + my $ta = (-$potsd_dx*$sa*$co - $potsd_dy*$sa*$so)+$potsd_dz*$ca; + my $tb = $delta_a*(($rn*$potsd_es*$sa*$ca)/$potsd_a); + my $tc = $delta_f*($rm/$bda+$rn*$bda)*$sa*$ca; + my $dlat = ($ta+$tb+$tc)/$rm; + + my $dlon = (-$potsd_dx*$so + $potsd_dy*$co)/($rn*$ca); + + my $wgs84lat = ($latr + $dlat)*180/$pi; + my $wgs84lon = ($lonr + $dlon)*180/$pi; + + return( $wgs84lon, $wgs84lat); +}