Ignore:
Timestamp:
2009-07-25T18:37:45+02:00 (17 years ago)
Author:
jttt
Message:

Use OsmPrimitive methods instead of direct access to keys field when possible

Location:
trunk/src/org/openstreetmap/josm/data/osm
Files:
2 edited

Legend:

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

    r1762 r1843  
    2929 */
    3030abstract public class OsmPrimitive implements Comparable<OsmPrimitive> {
    31 
    32     /**
    33      * The key/value list for this primitive.
    34      */
    35     public Map<String, String> keys;
    3631
    3732    /* mappaint data */
     
    219214    }
    220215
     216    /*------------
     217     * Keys handling
     218     ------------*/
     219
     220    /**
     221     * The key/value list for this primitive.
     222     */
     223    public Map<String, String> keys;
     224
    221225    /**
    222226     * Set the given value to the given key
     
    248252    }
    249253
    250     public String getName() {
    251         return null;
     254    /**
     255     * Added in revision 1843
     256     * Please do not use in plug-ins until this version becomes JOSM tested
     257     */
     258    public final void removeAll() {
     259        keys = null;
     260        mappaintStyle = null;
    252261    }
    253262
     
    266275            return Collections.emptyList();
    267276        return keys.keySet();
     277    }
     278
     279    /**
     280     * Added in revision 1843
     281     * Please do not use in plug-ins until this version becomes JOSM tested
     282     */
     283    public final boolean hasKeys() {
     284        return keys != null && !keys.isEmpty();
     285    }
     286
     287
     288
     289
     290
     291
     292    public String getName() {
     293        return null;
    268294    }
    269295
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java

    r1755 r1843  
    495495            return;
    496496        }
    497         else if (drawMultipolygon && r.keys != null && "multipolygon".equals(r.keys.get("type")))
     497        else if (drawMultipolygon && "multipolygon".equals(r.get("type")))
    498498        {
    499499            if(drawMultipolygon(r))
    500500              return;
    501501        }
    502         else if (drawRestriction && r.keys != null && "restriction".equals(r.keys.get("type")))
     502        else if (drawRestriction && "restriction".equals(r.get("type")))
    503503        {
    504504            drawRestriction(r);
     
    751751
    752752        if (nodeStyle == null) {
    753             r.putError(tr("Style for restriction {0} not found.", r.keys.get("restriction")), true);
     753            r.putError(tr("Style for restriction {0} not found.", r.get("restriction")), true);
    754754            return;
    755755        }
     
    11121112    protected String getNodeName(Node n) {
    11131113        String name = null;
    1114         if (n.keys != null) {
     1114        if (n.hasKeys()) {
    11151115            for (String rn : regionalNameOrder) {
    1116                 name = n.keys.get(rn);
     1116                name = n.get(rn);
    11171117                if (name != null) break;
    11181118            }
Note: See TracChangeset for help on using the changeset viewer.