Changeset 3003 in josm


Ignore:
Timestamp:
2010-02-17T18:51:36+01:00 (15 years ago)
Author:
mjulius
Message:

fixes #4540 - watch:* and source:* tags should be considered as "uninteresting" tags

File:
1 edited

Legend:

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

    r2963 r3003  
    482482    /**
    483483     * Contains a list of "uninteresting" keys that do not make an object
    484      * "tagged".
    485      * Initialized by checkTagged()
     484     * "tagged".  Entries that end with ':' are causing a whole namespace to be considered
     485     * "uninteresting".  Only the first level namespace is considered.
     486     * Initialized by isUninterestingKey()
    486487     */
    487488    public static Collection<String> getUninterestingKeys() {
    488489        if (uninteresting == null) {
    489490            uninteresting = Main.pref.getCollection("tags.uninteresting",
    490                     Arrays.asList(new String[]{"source","note","comment","converted_by","created_by"}));
     491                    Arrays.asList(new String[]{"source", "source_ref", "source:", "note", "comment",
     492                            "converted_by", "created_by", "watch", "watch:"}));
    491493        }
    492494        return uninteresting;
     495    }
     496
     497    /**
     498     * Returns true if key is considered "uninteresting".
     499     */
     500    public static boolean isUninterestingKey(String key) {
     501        getUninterestingKeys();
     502        if (uninteresting.contains(key))
     503            return true;
     504        int pos = key.indexOf(':');
     505        if (pos > 0)
     506            return uninteresting.contains(key.substring(0, pos + 1));
     507        return false;
    493508    }
    494509
     
    10701085
    10711086    private void updateTagged() {
    1072         getUninterestingKeys();
    10731087        if (keys != null) {
    1074             for (Entry<String,String> e : getKeys().entrySet()) {
    1075                 if (!uninteresting.contains(e.getKey())) {
     1088            for (String key: keySet()) {
     1089                if (!isUninterestingKey(key)) {
    10761090                    flags |= FLAG_TAGGED;
    10771091                    return;
Note: See TracChangeset for help on using the changeset viewer.