From c1c327d836117fe9c3a65d05e93f3a5d4ede1a69 Mon Sep 17 00:00:00 2001 From: Pavel Shramov Date: Sat, 25 Feb 2012 18:51:45 +0400 Subject: [PATCH] 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 --- DataExtractionOSM/src/net/osmand/data/MapObject.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/DataExtractionOSM/src/net/osmand/data/MapObject.java b/DataExtractionOSM/src/net/osmand/data/MapObject.java index 13bc8c244c..637684eb1a 100644 --- a/DataExtractionOSM/src/net/osmand/data/MapObject.java +++ b/DataExtractionOSM/src/net/osmand/data/MapObject.java @@ -43,6 +43,17 @@ public abstract class MapObject implements Comparable, Serializable { if(this.location == null){ 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(){