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",
// "-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 {

View file

@ -84,7 +84,7 @@ public class MapRenderingTypes {
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
boolean split = splitIsNeeded(tags);
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;
for(String s : tags.keySet()) {
if(s.startsWith("seamark:")) {
@ -105,7 +105,7 @@ public class MapRenderingTypes {
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, String> common = new HashMap<String, String>();
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";
}

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();
// it could be collection of amenities
boolean relation = entity instanceof Relation;
boolean purerelation = relation && !"multipolygon".equals(tags.get("type"));
for (Map.Entry<String, String> 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<Map<String, String>> it = MapRenderingTypes.splitTagsIntoDifferentObjects(tags);
for (Map<String, String> ts : it) {
for (Map.Entry<String, String> 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);
}
}
}
}