refactoring
This commit is contained in:
parent
30c5fda90a
commit
74ffdbeba5
3 changed files with 39 additions and 41 deletions
|
@ -179,26 +179,6 @@ public class Amenity extends MapObject {
|
|||
}
|
||||
}
|
||||
|
||||
public void addProfileTag(Entry<String, String> e) {
|
||||
if (getAdditionalInfo("profile") == null) {
|
||||
if (e.getKey().startsWith("tag_")) {
|
||||
switch (e.getValue().trim()) {
|
||||
case "bicycle":
|
||||
case "cycling":
|
||||
case "mtb":
|
||||
setAdditionalInfo("profile", "bicycle");
|
||||
break;
|
||||
case "hiking":
|
||||
case "hike":
|
||||
case "walking":
|
||||
case "walk":
|
||||
setAdditionalInfo("profile", "pedestrian");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toStringEn() {
|
||||
return super.toStringEn() + ": " + type.getKeyName() + ":" + subType;
|
||||
|
|
|
@ -922,11 +922,7 @@ public class MapPoiTypes {
|
|||
}
|
||||
}
|
||||
pat = poiTypesByTag.get(otag);
|
||||
if (pat == null && otag.startsWith("tag_")) {
|
||||
a.addProfileTag(e);
|
||||
}
|
||||
}
|
||||
|
||||
if (pat != null && pat.isAdditional()) {
|
||||
a.setAdditionalInfo(pat.getKeyName(), e.getValue());
|
||||
}
|
||||
|
|
|
@ -193,6 +193,10 @@ public class EntityParser {
|
|||
if (wbs != null) {
|
||||
am.setAdditionalInfo("wikipedia", wbs);
|
||||
}
|
||||
String tagCategory = getTagCategory(entity);
|
||||
if (tagCategory != null) {
|
||||
am.setAdditionalInfo("profile", tagCategory);
|
||||
}
|
||||
if (checkAmenitiesToAdd(am, amenitiesList) && !"no".equals(am.getSubType())) {
|
||||
amenitiesList.add(am);
|
||||
}
|
||||
|
@ -202,7 +206,25 @@ public class EntityParser {
|
|||
return amenitiesList;
|
||||
}
|
||||
|
||||
|
||||
private static String getTagCategory(Entity e) {
|
||||
Map<String, String> tags = e.getTags();
|
||||
for (String key : tags.keySet()) {
|
||||
if (key.startsWith("tag_")) {
|
||||
switch (tags.get(key).trim()) {
|
||||
case "bicycle":
|
||||
case "cycling":
|
||||
case "mtb":
|
||||
return "bicycle";
|
||||
case "hiking":
|
||||
case "hike":
|
||||
case "walking":
|
||||
case "walk":
|
||||
return "pedestrian";
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static boolean checkAmenitiesToAdd(Amenity a, List<Amenity> amenitiesList){
|
||||
// check amenity for duplication
|
||||
|
|
Loading…
Reference in a new issue