Ignore:
Timestamp:
2009-09-06T23:07:33+02:00 (15 years ago)
Author:
Gubaer
Message:

new: rewrite of CombineWay action
new: conflict resolution dialog for CombineWay, including conflicts for different relation memberships
cleanup: cleanup in OsmReader, reduces memory footprint and reduces parsing time
cleanup: made most of the public fields in OsmPrimitive @deprecated, added accessors and changed the code
cleanup: replaced usages of @deprecated constructors for ExtendedDialog
fixed #3208: Combine ways brokes relation order

WARNING: this changeset touches a lot of code all over the code base. "latest" might become slightly unstable in the next days. Also experience incompatibility issues with plugins in the next few days.

File:
1 edited

Legend:

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

    r2017 r2070  
    66import java.util.ArrayList;
    77import java.util.Collection;
     8import java.util.Collections;
    89import java.util.HashMap;
    910import java.util.HashSet;
     
    571572            throw new IllegalStateException(tr("tag collection can't be applied to a primitive because there are keys with multiple values"));
    572573        for (Tag tag: tags) {
    573             primitive.put(tag.getKey(), tag.getValue());
     574            if (tag.getValue() == null || tag.getValue().equals("")) {
     575                primitive.remove(tag.getKey());
     576            } else {
     577                primitive.put(tag.getKey(), tag.getValue());
     578            }
    574579        }
    575580    }
     
    682687        return ret;
    683688    }
     689
     690    /**
     691     * Replies the concatenation of all tag values (concatenated by a semicolon)
     692     *
     693     * @return the concatenation of all tag values
     694     */
     695    public String getJoinedValues(String key) {
     696        StringBuffer buffer = new StringBuffer();
     697        List<String> values = new ArrayList<String>(getValues(key));
     698        values.remove("");
     699        Collections.sort(values);
     700        Iterator<String> iter = values.iterator();
     701        while (iter.hasNext()) {
     702            buffer.append(iter.next());
     703            if (iter.hasNext()) {
     704                buffer.append(";");
     705            }
     706        }
     707        return buffer.toString();
     708    }
    684709}
Note: See TracChangeset for help on using the changeset viewer.