Ignore:
Timestamp:
2009-12-28T00:14:33+01:00 (14 years ago)
Author:
Gubaer
Message:

Partial commit due to issue described in #4137
Breaks the build

Location:
trunk/src/org/openstreetmap/josm/data/osm/history
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/history/HistoryNode.java

    r2512 r2686  
    3434        this.coords = coords;
    3535    }
     36
     37    @Override
     38    public String getDisplayName(HistoryNameFormatter formatter) {
     39        return formatter.format(this);
     40    }
    3641}
  • trunk/src/org/openstreetmap/josm/data/osm/history/HistoryOsmPrimitive.java

    r2626 r2686  
    77import java.util.Date;
    88import java.util.HashMap;
     9import java.util.Locale;
    910import java.util.Map;
    1011
     
    146147    }
    147148
     149    /**
     150     * Replies the name of this primitive. The default implementation replies the value
     151     * of the tag <tt>name</tt> or null, if this tag is not present.
     152     *
     153     * @return the name of this primitive
     154     */
     155    public String getName() {
     156        if (get("name") != null)
     157            return get("name");
     158        return null;
     159    }
     160
     161    /**
     162     * Replies the display name of a primitive formatted by <code>formatter</code>
     163     *
     164     * @return the display name
     165     */
     166    public abstract String getDisplayName(HistoryNameFormatter formatter);
     167
     168    /**
     169     * Replies the a localized name for this primitive given by the value of the tags (in this order)
     170     * <ul>
     171     *   <li>name:lang_COUNTRY_Variant  of the current locale</li>
     172     *   <li>name:lang_COUNTRY of the current locale</li>
     173     *   <li>name:lang of the current locale</li>
     174     *   <li>name of the current locale</li>
     175     * </ul>
     176     *
     177     * null, if no such tag exists
     178     *
     179     * @return the name of this primitive
     180     */
     181    public String getLocalName() {
     182        String key = "name:" + Locale.getDefault().toString();
     183        if (get(key) != null)
     184            return get(key);
     185        key = "name:" + Locale.getDefault().getLanguage() + "_" + Locale.getDefault().getCountry();
     186        if (get(key) != null)
     187            return get(key);
     188        key = "name:" + Locale.getDefault().getLanguage();
     189        if (get(key) != null)
     190            return get(key);
     191        return getName();
     192    }
     193
     194
     195
    148196    @Override
    149197    public int hashCode() {
  • trunk/src/org/openstreetmap/josm/data/osm/history/HistoryRelation.java

    r2512 r2686  
    111111        members.add(member);
    112112    }
     113
     114    @Override
     115    public String getDisplayName(HistoryNameFormatter formatter) {
     116        return formatter.format(this);
     117    }
    113118}
  • trunk/src/org/openstreetmap/josm/data/osm/history/HistoryWay.java

    r2512 r2686  
    7777        nodeIds.add(ref);
    7878    }
     79
     80    /**
     81     * Replies true if this way is closed.
     82     *
     83     * @return true if this way is closed.
     84     */
     85    public boolean isClosed() {
     86        return getNumNodes() >= 3 && nodeIds.get(0) == nodeIds.get(nodeIds.size()-1);
     87    }
     88
     89    @Override
     90    public String getDisplayName(HistoryNameFormatter formatter) {
     91        return formatter.format(this);
     92    }
    7993}
Note: See TracChangeset for help on using the changeset viewer.