Fix seamarks
This commit is contained in:
parent
7cd35f8fc7
commit
ec3a8f53c0
3 changed files with 20 additions and 16 deletions
|
@ -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 {
|
||||||
|
|
|
@ -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";
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,18 +175,20 @@ 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()) {
|
||||||
|
Amenity am = poiTypes.parseAmenity(e.getKey(), e.getValue(), purerelation, ts);
|
||||||
if (am != null) {
|
if (am != null) {
|
||||||
parseMapObject(am, entity, tags);
|
parseMapObject(am, entity, ts);
|
||||||
String wbs = getWebSiteURL(tags);
|
String wbs = getWebSiteURL(ts);
|
||||||
if(wbs != null) {
|
if (wbs != null) {
|
||||||
am.setAdditionalInfo("website", wbs);
|
am.setAdditionalInfo("website", wbs);
|
||||||
}
|
}
|
||||||
if (checkAmenitiesToAdd(am, amenitiesList) && !"no".equals(am.getSubType())) {
|
if (checkAmenitiesToAdd(am, amenitiesList) && !"no".equals(am.getSubType())) {
|
||||||
|
@ -194,6 +196,7 @@ public class EntityParser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return amenitiesList;
|
return amenitiesList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue