From ec3a8f53c04d028d880f20284c8005638f510026 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 6 Aug 2015 00:39:38 +0200 Subject: [PATCH] Fix seamarks --- .../net/osmand/binary/BinaryInspector.java | 1 + .../src/net/osmand/osm/MapRenderingTypes.java | 8 +++--- .../src/net/osmand/osm/edit/EntityParser.java | 27 ++++++++++--------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryInspector.java b/OsmAnd-java/src/net/osmand/binary/BinaryInspector.java index 330449cf6f..7a256a46eb 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryInspector.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryInspector.java @@ -75,6 +75,7 @@ public class BinaryInspector { // "-bbox=1.74,51.17,1.75,51.16", // "-vstats", "/Users/victorshcherb/osmand/maps/Synthetic_test_rendering.obf" +// "/Users/victorshcherb/osmand/maps/Map.obf" // "/Users/victorshcherb/osmand/temp/Czech-republic_jihovychod_europe_2.road.obf" }); } else { diff --git a/OsmAnd-java/src/net/osmand/osm/MapRenderingTypes.java b/OsmAnd-java/src/net/osmand/osm/MapRenderingTypes.java index 6f25488f53..b3edd1b014 100644 --- a/OsmAnd-java/src/net/osmand/osm/MapRenderingTypes.java +++ b/OsmAnd-java/src/net/osmand/osm/MapRenderingTypes.java @@ -84,7 +84,7 @@ public class MapRenderingTypes { init(); } } - public Collection> splitTagsIntoDifferentObjects(final Map tags) { + public static Collection> splitTagsIntoDifferentObjects(final Map tags) { // check open sea maps tags boolean split = splitIsNeeded(tags); if(!split) { @@ -94,7 +94,7 @@ public class MapRenderingTypes { } } - protected boolean splitIsNeeded(final Map tags) { + protected static boolean splitIsNeeded(final Map tags) { boolean seamark = false; for(String s : tags.keySet()) { if(s.startsWith("seamark:")) { @@ -105,7 +105,7 @@ public class MapRenderingTypes { return seamark; } - private Collection> splitOpenSeaMapsTags(final Map tags) { + private static Collection> splitOpenSeaMapsTags(final Map tags) { Map> groupByOpenSeamaps = new HashMap>(); Map common = new HashMap(); String ATTACHED_KEY = "seamark:attached"; @@ -148,7 +148,7 @@ public class MapRenderingTypes { } - private String openSeaType(String value) { + private static String openSeaType(String value) { if(value.equals("light_major") || value.equals("light_minor")) { return "light"; } diff --git a/OsmAnd-java/src/net/osmand/osm/edit/EntityParser.java b/OsmAnd-java/src/net/osmand/osm/edit/EntityParser.java index 63785b32fa..de89249cfb 100644 --- a/OsmAnd-java/src/net/osmand/osm/edit/EntityParser.java +++ b/OsmAnd-java/src/net/osmand/osm/edit/EntityParser.java @@ -175,22 +175,25 @@ public class EntityParser { } - public static List parseAmenities(MapPoiTypes poiTypes, Entity entity, Map tags,List amenitiesList) { + public static List parseAmenities(MapPoiTypes poiTypes, Entity entity, Map tags, + List amenitiesList) { amenitiesList.clear(); // it could be collection of amenities boolean relation = entity instanceof Relation; boolean purerelation = relation && !"multipolygon".equals(tags.get("type")); - - for (Map.Entry e : tags.entrySet()) { - Amenity am = poiTypes.parseAmenity(e.getKey(), e.getValue(), purerelation, tags); - if (am != null) { - parseMapObject(am, entity, tags); - String wbs = getWebSiteURL(tags); - if(wbs != null) { - am.setAdditionalInfo("website", wbs); - } - if (checkAmenitiesToAdd(am, amenitiesList) && !"no".equals(am.getSubType())) { - amenitiesList.add(am); + Collection> it = MapRenderingTypes.splitTagsIntoDifferentObjects(tags); + for (Map ts : it) { + for (Map.Entry e : ts.entrySet()) { + Amenity am = poiTypes.parseAmenity(e.getKey(), e.getValue(), purerelation, ts); + if (am != null) { + parseMapObject(am, entity, ts); + String wbs = getWebSiteURL(ts); + if (wbs != null) { + am.setAdditionalInfo("website", wbs); + } + if (checkAmenitiesToAdd(am, amenitiesList) && !"no".equals(am.getSubType())) { + amenitiesList.add(am); + } } } }