MapObject: set name from operator
If name is not available (common case for fuel stations) create it from operator and ref (if found). Signed-off-by: Pavel Shramov <shramov@mexmat.net>
This commit is contained in:
parent
078d11c324
commit
c1c327d836
1 changed files with 11 additions and 0 deletions
|
@ -43,6 +43,17 @@ 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNameFromOperator(Entity e){
|
||||||
|
if (this.name != null) return;
|
||||||
|
String op = e.getTag(OSMTagKey.OPERATOR);
|
||||||
|
String ref = e.getTag(OSMTagKey.REF);
|
||||||
|
if (op == null) return;
|
||||||
|
if (ref != null)
|
||||||
|
op += " [" + ref + "]";
|
||||||
|
this.name = op;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityId getEntityId(){
|
public EntityId getEntityId(){
|
||||||
|
|
Loading…
Reference in a new issue