Ignore:
Timestamp:
2011-05-02T23:47:19+02:00 (13 years ago)
Author:
bastiK
Message:

mapcss: add role based selection (collaborative work by Gubaer and me)

File:
1 edited

Legend:

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

    r4011 r4069  
    174174
    175175            public String parent_tag(String key) {
    176                 if (env.getMatchingReferrers() == null) {
     176                if (env.parent == null) {
    177177                    // we don't have a matched parent, so just search all referrers
    178178                    for (OsmPrimitive parent : env.osm.getReferrers()) {
     
    183183                    return null;
    184184                }
    185                 if (env.getMatchingReferrers().isEmpty())
    186                     return null;
    187                 // use always the first matching referrer to have consistency
    188                 // in an expression and declaration block
    189                 return env.getMatchingReferrers().iterator().next().get(key);
     185                return env.parent.get(key);
    190186            }
    191187
    192188            public boolean has_tag_key(String key) {
    193189                return env.osm.hasKey(key);
     190            }
     191
     192            public Float index() {
     193                if (env.index == null)
     194                    return null;
     195                return new Float(env.index + 1);
     196            }
     197
     198            public String role() {
     199                return env.getRole();
    194200            }
    195201
Note: See TracChangeset for help on using the changeset viewer.