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){ if(this.location == null){
this.location = MapUtils.getCenter(e); this.location = MapUtils.getCenter(e);
} }
this.setNameFromOperator(e); if(this.name == null) {
this.setNameFromOperator(e);
}
if(this.name == null) {
this.setNameFromRef(e);
}
} }
public void setNameFromOperator(Entity e){ public void setNameFromRef(Entity e) {
if (this.name != null) return; String ref = e.getTag(OSMTagKey.REF);
String op = e.getTag(OSMTagKey.OPERATOR); 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); String ref = e.getTag(OSMTagKey.REF);
if (op == null) return;
if (ref != null) if (ref != null)
op += " [" + ref + "]"; op += " [" + ref + "]";
this.name = op; this.name = op;