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


Ignore:
Timestamp:
2012-12-19T14:21:31+01:00 (12 years ago)
Author:
Don-vip
Message:

see #8255 - Use 'type' attribute when specified to filter role candidates (for example, this prevents highway=crossing or highway=street_lampnodes to be added as street members to an associatedStreet relation)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java

    r5614 r5624  
    5454import org.openstreetmap.josm.data.osm.Node;
    5555import org.openstreetmap.josm.data.osm.OsmPrimitive;
     56import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
    5657import org.openstreetmap.josm.data.osm.OsmUtils;
    5758import org.openstreetmap.josm.data.osm.Relation;
     
    121122        }
    122123
    123         public static PresetType forPrimitiveType(org.openstreetmap.josm.data.osm.OsmPrimitiveType type) {
     124        public static PresetType forPrimitiveType(OsmPrimitiveType type) {
    124125            switch (type) {
    125126            case NODE:
     
    15891590
    15901591    public String suggestRoleForOsmPrimitive(OsmPrimitive osm) {
    1591         if (roles == null) {
    1592             return null;
    1593         }
    1594         for (Role i : roles.roles) {
    1595             if (i.memberExpression != null && i.memberExpression.match(osm)) {
    1596                 return i.key;
     1592        if (roles != null && osm != null) {
     1593            for (Role i : roles.roles) {
     1594                if (i.memberExpression != null && i.memberExpression.match(osm)
     1595                        && (i.types == null || i.types.isEmpty() || i.types.contains(PresetType.forPrimitive(osm)) )) {
     1596                    return i.key;
     1597                }
    15971598            }
    15981599        }
Note: See TracChangeset for help on using the changeset viewer.