Add name from ref for amenity

This commit is contained in:
Victor Shcherb 2012-12-11 01:03:44 +01:00
parent 20c31ad0ec
commit b7acdbd8cc

View file

@ -43,14 +43,26 @@ public abstract class MapObject implements Comparable<MapObject>, Serializable {
if(this.location == null){
this.location = MapUtils.getCenter(e);
}
if(this.name == null) {
this.setNameFromOperator(e);
}
if(this.name == null) {
this.setNameFromRef(e);
}
}
public void setNameFromOperator(Entity e){
if (this.name != null) return;
String op = e.getTag(OSMTagKey.OPERATOR);
public void setNameFromRef(Entity e) {
String ref = e.getTag(OSMTagKey.REF);
if(ref != null){
this.name = ref;
}
}
public void setNameFromOperator(Entity e) {
String op = e.getTag(OSMTagKey.OPERATOR);
if (op == null)
return;
String ref = e.getTag(OSMTagKey.REF);
if (op == null) return;
if (ref != null)
op += " [" + ref + "]";
this.name = op;