Ignore:
Timestamp:
2011-01-24T13:40:19+01:00 (13 years ago)
Author:
bastiK
Message:

fixed #5873 - Custom styles are not used. If more than 1 rule applies with the same priority, use the last and not the first rule. This has worked before r3803 because it did not take the priority into account when the rules are in different files.

File:
1 edited

Legend:

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

    r3805 r3814  
    4444            IconElemStyle style;
    4545            if ((style = icons.get("n" + key + "=" + val)) != null) {
    46                 if (icon == null || style.priority > icon.priority) {
     46                if (icon == null || style.priority >= icon.priority) {
    4747                    icon = style;
    4848                }
    4949            }
    5050            if ((style = icons.get("b" + key + "=" + OsmUtils.getNamedOsmBoolean(val))) != null) {
    51                 if (icon == null || style.priority > icon.priority) {
     51                if (icon == null || style.priority >= icon.priority) {
    5252                    icon = style;
    5353                }
    5454            }
    5555            if ((style = icons.get("x" + key)) != null) {
    56                 if (icon == null || style.priority > icon.priority) {
     56                if (icon == null || style.priority >= icon.priority) {
    5757                    icon = style;
    5858                }
     
    6060        }
    6161        for (IconElemStyle s : iconsList) {
    62             if ((icon == null || s.priority > icon.priority) && s.check(primitive)) {
     62            if ((icon == null || s.priority >= icon.priority) && s.check(primitive)) {
    6363                icon = s;
    6464            }
     
    7575            LineElemStyle styleLine;
    7676            String idx = "n" + key + "=" + val;
    77             if ((styleArea = areas.get(idx)) != null && (area == null || styleArea.priority > area.priority) && (!noclosed || !styleArea.closed)) {
     77            if ((styleArea = areas.get(idx)) != null && (area == null || styleArea.priority >= area.priority) && (!noclosed || !styleArea.closed)) {
    7878                area = styleArea;
    7979            }
    80             if ((styleLine = lines.get(idx)) != null && (line == null || styleLine.priority > line.priority)) {
     80            if ((styleLine = lines.get(idx)) != null && (line == null || styleLine.priority >= line.priority)) {
    8181                line = styleLine;
    8282                lineIdx = idx;
     
    8686            }
    8787            idx = "b" + key + "=" + OsmUtils.getNamedOsmBoolean(val);
    88             if ((styleArea = areas.get(idx)) != null && (area == null || styleArea.priority > area.priority) && (!noclosed || !styleArea.closed)) {
     88            if ((styleArea = areas.get(idx)) != null && (area == null || styleArea.priority >= area.priority) && (!noclosed || !styleArea.closed)) {
    8989                area = styleArea;
    9090            }
    91             if ((styleLine = lines.get(idx)) != null && (line == null || styleLine.priority > line.priority)) {
     91            if ((styleLine = lines.get(idx)) != null && (line == null || styleLine.priority >= line.priority)) {
    9292                line = styleLine;
    9393                lineIdx = idx;
     
    9797            }
    9898            idx = "x" + key;
    99             if ((styleArea = areas.get(idx)) != null && (area == null || styleArea.priority > area.priority) && (!noclosed || !styleArea.closed)) {
     99            if ((styleArea = areas.get(idx)) != null && (area == null || styleArea.priority >= area.priority) && (!noclosed || !styleArea.closed)) {
    100100                area = styleArea;
    101101            }
    102             if ((styleLine = lines.get(idx)) != null && (line == null || styleLine.priority > line.priority)) {
     102            if ((styleLine = lines.get(idx)) != null && (line == null || styleLine.priority >= line.priority)) {
    103103                line = styleLine;
    104104                lineIdx = idx;
     
    109109        }
    110110        for (AreaElemStyle s : areasList) {
    111             if ((area == null || s.priority > area.priority) && (!noclosed || !s.closed) && s.check(primitive)) {
     111            if ((area == null || s.priority >= area.priority) && (!noclosed || !s.closed) && s.check(primitive)) {
    112112                area = s;
    113113            }
    114114        }
    115115        for (LineElemStyle s : linesList) {
    116             if ((line == null || s.priority > line.priority) && s.check(primitive)) {
     116            if ((line == null || s.priority >= line.priority) && s.check(primitive)) {
    117117                line = s;
    118118            }
Note: See TracChangeset for help on using the changeset viewer.