Ticket #4298: tmc-oepnv.patch

File tmc-oepnv.patch, 2.3 KB (added by vsandre, 16 years ago)
  • org/openstreetmap/josm/gui/DefaultNameFormatter.java

     
    4646    }
    4747
    4848    /** the default list of tags which are used as naming tags in relations */
    49     static public final String[] DEFAULT_NAMING_TAGS_FOR_RELATIONS = {"name", "ref", "restriction", "note"};
     49    static public final String[] DEFAULT_NAMING_TAGS_FOR_RELATIONS = {"name", "ref", "restriction", "public_transport", ":LocationCode", "note"};
    5050
    5151    /** the current list of tags used as naming tags in relations */
    5252    static private List<String> namingTagsForRelations =  null;
     
    160160        } else {
    161161            name = relation.get("type");
    162162            if (name == null) {
     163                name = (relation.get("public_transport") != null) ? tr("public transport") : "";
     164            }
     165            if (name == null) {
    163166                name = tr("relation");
    164167            }
    165168
    166169            name += " (";
    167170            String nameTag = null;
    168             Set<String> namingTags = new HashSet<String>(getNamingtagsForRelations());
    169             for (String n : relation.keySet()) {
    170                 // #3328: "note " and " note" are name tags too
    171                 if (namingTags.contains(n.trim())) {
     171            for (String n : getNamingtagsForRelations()) {
     172                if (n.equals("name")) {
    172173                    if (Main.pref.getBoolean("osm-primitives.localize-name", true)) {
    173174                        nameTag = relation.getLocalName();
    174175                    } else {
    175176                        nameTag = relation.getName();
    176177                    }
    177                     if (nameTag == null) {
    178                         nameTag = relation.get(n);
     178                } else if (n.equals(":LocationCode")) {
     179                    for (String m : relation.keySet()) {
     180                        if (m.endsWith(n)) {
     181                            nameTag = relation.get(m);
     182                            break;
     183                        }
    179184                    }
     185                } else {
     186                    nameTag = relation.get(n);
    180187                }
    181188                if (nameTag != null) {
    182189                    break;