Changeset 7797 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2014-12-12T01:43:35+01:00 (9 years ago)
Author:
Don-vip
Message:

fix #10164 - handle dataset properly in mapcss icon fetching

File:
1 edited

Legend:

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

    r7563 r7797  
    2222import org.openstreetmap.josm.Main;
    2323import org.openstreetmap.josm.data.coor.LatLon;
     24import org.openstreetmap.josm.data.osm.DataSet;
    2425import org.openstreetmap.josm.data.osm.Node;
    2526import org.openstreetmap.josm.data.osm.Tag;
     
    139140    }
    140141
     142    /**
     143     * Returns the node icon that would be displayed for the given tag.
     144     * @param tag The tag to look an icon for
     145     * @param includeDeprecatedIcon if {@code true}, the special deprecated icon will be returned if applicable
     146     * @return {@code null} if no icon found, or if the icon is deprecated and not wanted
     147     */
    141148    public static ImageIcon getNodeIcon(Tag tag, boolean includeDeprecatedIcon) {
    142149        if (tag != null) {
     150            DataSet ds = new DataSet();
    143151            Node virtualNode = new Node(LatLon.ZERO);
    144152            virtualNode.put(tag.getKey(), tag.getValue());
     
    146154            MapCSSStyleSource.STYLE_SOURCE_LOCK.readLock().lock();
    147155            try {
     156                // Add primitive to dataset to avoid DataIntegrityProblemException when evaluating selectors
     157                ds.addPrimitive(virtualNode);
    148158                styleList = getStyles().generateStyles(virtualNode, 0.5, false).a;
     159                ds.removePrimitive(virtualNode);
    149160            } finally {
    150161                MapCSSStyleSource.STYLE_SOURCE_LOCK.readLock().unlock();
Note: See TracChangeset for help on using the changeset viewer.