Fix seamarks

This commit is contained in:
Victor Shcherb 2015-08-06 00:39:38 +02:00
parent 7cd35f8fc7
commit ec3a8f53c0
3 changed files with 20 additions and 16 deletions

View file

@ -75,6 +75,7 @@ public class BinaryInspector {
// "-bbox=1.74,51.17,1.75,51.16", // "-bbox=1.74,51.17,1.75,51.16",
// "-vstats", // "-vstats",
"/Users/victorshcherb/osmand/maps/Synthetic_test_rendering.obf" "/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" // "/Users/victorshcherb/osmand/temp/Czech-republic_jihovychod_europe_2.road.obf"
}); });
} else { } else {

View file

@ -84,7 +84,7 @@ public class MapRenderingTypes {
init(); init();
} }
} }
public Collection<Map<String, String>> splitTagsIntoDifferentObjects(final Map<String, String> tags) { public static Collection<Map<String, String>> splitTagsIntoDifferentObjects(final Map<String, String> tags) {
// check open sea maps tags // check open sea maps tags
boolean split = splitIsNeeded(tags); boolean split = splitIsNeeded(tags);
if(!split) { if(!split) {
@ -94,7 +94,7 @@ public class MapRenderingTypes {
} }
} }
protected boolean splitIsNeeded(final Map<String, String> tags) { protected static boolean splitIsNeeded(final Map<String, String> tags) {
boolean seamark = false; boolean seamark = false;
for(String s : tags.keySet()) { for(String s : tags.keySet()) {
if(s.startsWith("seamark:")) { if(s.startsWith("seamark:")) {
@ -105,7 +105,7 @@ public class MapRenderingTypes {
return seamark; return seamark;
} }
private Collection<Map<String, String>> splitOpenSeaMapsTags(final Map<String, String> tags) { private static Collection<Map<String, String>> splitOpenSeaMapsTags(final Map<String, String> tags) {
Map<String, Map<String, String>> groupByOpenSeamaps = new HashMap<String, Map<String, String>>(); Map<String, Map<String, String>> groupByOpenSeamaps = new HashMap<String, Map<String, String>>();
Map<String, String> common = new HashMap<String, String>(); Map<String, String> common = new HashMap<String, String>();
String ATTACHED_KEY = "seamark:attached"; 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")) { if(value.equals("light_major") || value.equals("light_minor")) {
return "light"; return "light";
} }

View file

@ -175,22 +175,25 @@ public class EntityParser {
} }
public static List<Amenity> parseAmenities(MapPoiTypes poiTypes, Entity entity, Map<String, String> tags,List<Amenity> amenitiesList) { public static List<Amenity> parseAmenities(MapPoiTypes poiTypes, Entity entity, Map<String, String> tags,
List<Amenity> amenitiesList) {
amenitiesList.clear(); amenitiesList.clear();
// it could be collection of amenities // it could be collection of amenities
boolean relation = entity instanceof Relation; boolean relation = entity instanceof Relation;
boolean purerelation = relation && !"multipolygon".equals(tags.get("type")); boolean purerelation = relation && !"multipolygon".equals(tags.get("type"));
Collection<Map<String, String>> it = MapRenderingTypes.splitTagsIntoDifferentObjects(tags);
for (Map.Entry<String, String> e : tags.entrySet()) { for (Map<String, String> ts : it) {
Amenity am = poiTypes.parseAmenity(e.getKey(), e.getValue(), purerelation, tags); for (Map.Entry<String, String> e : ts.entrySet()) {
if (am != null) { Amenity am = poiTypes.parseAmenity(e.getKey(), e.getValue(), purerelation, ts);
parseMapObject(am, entity, tags); if (am != null) {
String wbs = getWebSiteURL(tags); parseMapObject(am, entity, ts);
if(wbs != null) { String wbs = getWebSiteURL(ts);
am.setAdditionalInfo("website", wbs); if (wbs != null) {
} am.setAdditionalInfo("website", wbs);
if (checkAmenitiesToAdd(am, amenitiesList) && !"no".equals(am.getSubType())) { }
amenitiesList.add(am); if (checkAmenitiesToAdd(am, amenitiesList) && !"no".equals(am.getSubType())) {
amenitiesList.add(am);
}
} }
} }
} }