Ignore:
Timestamp:
2012-05-06T21:23:18+02:00 (12 years ago)
Author:
bastiK
Message:

mapcss: change z-index handling

In contrast to previous default z-index of 1000 for nodes and -1000 for areas, the default z-index is
now always 0. An additional "major-z-index" is used to sort elemstyles by category, this property
can be adjusted in the style, so icons can be rendered below lines, if you want to.

File:
1 edited

Legend:

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

    r5214 r5217  
    4040
    4141    protected enum LineType {
    42         NORMAL(""),
    43         CASING("casing-"),
    44         LEFT_CASING("left-casing-"),
    45         RIGHT_CASING("right-casing-");
    46 
    47         public String prefix;
    48 
    49         LineType(String prefix) {
     42        NORMAL("", 3f),
     43        CASING("casing-", 2f),
     44        LEFT_CASING("left-casing-", 2.1f),
     45        RIGHT_CASING("right-casing-", 2.1f);
     46
     47        public final String prefix;
     48        public final float default_major_z_index;
     49
     50        LineType(String prefix, float default_major_z_index) {
    5051            this.prefix = prefix;
    51         }
    52     }
    53 
    54     protected LineElemStyle(Cascade c, BasicStroke line, Color color, BasicStroke dashesLine, Color dashesBackground, float offset, float realWidth) {
    55         super(c, 0f);
     52            this.default_major_z_index = default_major_z_index;
     53        }
     54    }
     55
     56    protected LineElemStyle(Cascade c, float default_major_z_index, BasicStroke line, Color color, BasicStroke dashesLine, Color dashesBackground, float offset, float realWidth) {
     57        super(c, default_major_z_index);
    5658        this.line = line;
    5759        this.color = color;
     
    6971        LineElemStyle leftCasing = createImpl(env, LineType.LEFT_CASING);
    7072        if (leftCasing != null) {
    71             leftCasing.z_index += -90;
    7273            leftCasing.isModifier = true;
    7374        }
     
    7879        LineElemStyle rightCasing = createImpl(env, LineType.RIGHT_CASING);
    7980        if (rightCasing != null) {
    80             rightCasing.z_index += -90;
    8181            rightCasing.isModifier = true;
    8282        }
     
    8787        LineElemStyle casing = createImpl(env, LineType.CASING);
    8888        if (casing != null) {
    89             casing.z_index += -100;
    9089            casing.isModifier = true;
    9190        }
     
    263262        }
    264263
    265         return new LineElemStyle(c, line, color, dashesLine, dashesBackground, offset, realWidth);
     264        return new LineElemStyle(c, type.default_major_z_index, line, color, dashesLine, dashesBackground, offset, realWidth);
    266265    }
    267266
Note: See TracChangeset for help on using the changeset viewer.