Ignore:
Timestamp:
2015-04-25T19:13:12+02:00 (9 years ago)
Author:
simon04
Message:

fix #9782 fix #10859 - MapCSS validator: evaluate real key and value for KeyConditions

File:
1 edited

Legend:

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

    r8252 r8266  
    44import java.text.MessageFormat;
    55import java.util.Arrays;
     6import java.util.Collection;
    67import java.util.EnumSet;
    78import java.util.Objects;
     
    340341        }
    341342
    342         public Tag asTag() {
    343             return new Tag(label);
     343        public Tag asTag(OsmPrimitive p) {
     344            String key = label;
     345            if (KeyMatchType.REGEX.equals(matchType)) {
     346                final Collection<String> matchingKeys = Utils.filter(p.keySet(), containsPattern);
     347                if (!matchingKeys.isEmpty()) {
     348                    key = matchingKeys.iterator().next();
     349                }
     350            }
     351            return new Tag(key, p.get(key));
    344352        }
    345353
Note: See TracChangeset for help on using the changeset viewer.