Changeset 2750 in josm for trunk/src


Ignore:
Timestamp:
2010-01-07T09:21:49+01:00 (14 years ago)
Author:
Gubaer
Message:

applied #4298: patch by vsandre: displayed relation name

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java

    r2711 r2750  
    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 */
     
    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            }
     
    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();
     
    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) {
Note: See TracChangeset for help on using the changeset viewer.