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:
Pavel Shramov 2012-02-25 18:51:45 +04:00
parent 078d11c324
commit c1c327d836

View file

@ -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(){