Esempio n. 1
0
  private String getRelationTypeName(IRelation relation) {
    String name = trc("Relation type", relation.get("type"));
    if (name == null) {
      name = (relation.get("public_transport") != null) ? tr("public transport") : null;
    }
    if (name == null) {
      String building = relation.get("building");
      if (OsmUtils.isTrue(building)) {
        name = tr("building");
      } else if (building != null) {
        name = tr(building); // translate tag!
      }
    }
    if (name == null) {
      name = trc("Place type", relation.get("place"));
    }
    if (name == null) {
      name = tr("relation");
    }
    String admin_level = relation.get("admin_level");
    if (admin_level != null) {
      name += "[" + admin_level + "]";
    }

    for (NameFormatterHook hook : formatHooks) {
      String hookResult = hook.checkRelationTypeName(relation, name);
      if (hookResult != null) return hookResult;
    }

    return name;
  }
Esempio n. 2
0
 private String getNameTagValue(IRelation relation, String nameTag) {
   if (nameTag.equals("name")) {
     if (Main.pref.getBoolean("osm-primitives.localize-name", true))
       return relation.getLocalName();
     else return relation.getName();
   } else if (nameTag.equals(":LocationCode")) {
     for (String m : relation.keySet()) {
       if (m.endsWith(nameTag)) return relation.get(m);
     }
     return null;
   } else if (nameTag.startsWith("?") && OsmUtils.isTrue(relation.get(nameTag.substring(1)))) {
     return tr(nameTag.substring(1));
   } else if (nameTag.startsWith("?") && OsmUtils.isFalse(relation.get(nameTag.substring(1)))) {
     return null;
   } else {
     return trc_lazy(nameTag, I18n.escape(relation.get(nameTag)));
   }
 }