Add name from ref for amenity
This commit is contained in:
parent
20c31ad0ec
commit
b7acdbd8cc
1 changed files with 17 additions and 5 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
if(this.name == null) {
|
||||||
this.setNameFromOperator(e);
|
this.setNameFromOperator(e);
|
||||||
}
|
}
|
||||||
|
if(this.name == null) {
|
||||||
|
this.setNameFromRef(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNameFromRef(Entity e) {
|
||||||
|
String ref = e.getTag(OSMTagKey.REF);
|
||||||
|
if(ref != null){
|
||||||
|
this.name = ref;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setNameFromOperator(Entity e) {
|
public void setNameFromOperator(Entity e) {
|
||||||
if (this.name != null) return;
|
|
||||||
String op = e.getTag(OSMTagKey.OPERATOR);
|
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;
|
||||||
|
|
Loading…
Reference in a new issue