Ignore:
Timestamp:
2011-02-05T19:47:07+01:00 (13 years ago)
Author:
bastiK
Message:

mapcss: dashes

Location:
trunk/src/org/openstreetmap/josm/gui/mappaint
Files:
2 edited

Legend:

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

    r3858 r3859  
    6565    @Override
    6666    public String toString() {
    67         return "AreaElemStyle{" + super.toString() + "color=" + color + '}';
     67        return "AreaElemStyle{" + super.toString() + "color=" + Utils.toString(color) + '}';
    6868    }
    6969}
  • trunk/src/org/openstreetmap/josm/gui/mappaint/LineElemStyle.java

    r3858 r3859  
    1616
    1717    public static LineElemStyle createSimpleLineStyle(Color color) {
    18         return new LineElemStyle(Cascade.EMPTY_CASCADE, -1f, 0f, color != null ? color : PaintColors.UNTAGGED.get(), null, null);
     18        return new LineElemStyle(Cascade.EMPTY_CASCADE, -1f, 0f, color != null ? color : PaintColors.UNTAGGED.get(), null, 0f, null);
    1919    }
    2020    public static final LineElemStyle UNTAGGED_WAY = createSimpleLineStyle(null);
     
    2424    public Color color;
    2525    private float[] dashed;
     26    private float dashesOffset;
    2627    public Color dashedColor;
    2728
    28     protected LineElemStyle(Cascade c, float width, float realWidth, Color color, float[] dashed, Color dashedColor) {
     29    protected LineElemStyle(Cascade c, float width, float realWidth, Color color, float[] dashed, float dashesOffset, Color dashedColor) {
    2930        super(c);
    3031        setWidth(width);
     
    3233        this.color = color;
    3334        this.dashed = dashed;
     35        this.dashesOffset = dashesOffset;
    3436        this.dashedColor = dashedColor;
    3537    }
     
    8486            }
    8587        }
     88        float dashesOffset = c.get(prefix + "dashes-offset", 0f, Float.class);
    8689        Color dashesBackground = c.get(prefix + "dashes-background-color", null, Color.class);
    87 
    88         return new LineElemStyle(c, width, realWidth, color, dashes, dashesBackground);
     90        if (dashesBackground != null) {
     91            pAlpha = color_float2int(c.get(prefix + "dashes-background-opacity", null, Float.class));
     92            if (pAlpha != null) {
     93                alpha = pAlpha;
     94            }
     95            dashesBackground = new Color(dashesBackground.getRed(), dashesBackground.getGreen(),
     96                    dashesBackground.getBlue(), alpha);
     97        }
     98
     99        return new LineElemStyle(c, width, realWidth, color, dashes, dashesOffset, dashesBackground);
    89100    }
    90101
     
    140151        }
    141152
    142         painter.drawWay(w, markColor != null ? markColor : color, myWidth, dashed, myDashedColor, showDirection,
    143                     selected ? false : reversedDirection, showOnlyHeadArrowOnly);
     153        painter.drawWay(w, markColor != null ? markColor : color, myWidth, dashed,
     154                dashesOffset, myDashedColor, showDirection,
     155                selected ? false : reversedDirection, showOnlyHeadArrowOnly);
    144156
    145157        if(paintSettings.isShowOrderNumber()) {
     
    177189                Utils.equal(color, other.color) &&
    178190                Arrays.equals(dashed, other.dashed) &&
     191                dashesOffset == other.dashesOffset &&
    179192                Utils.equal(dashedColor, other.dashedColor);
    180193    }
     
    187200        hash = 29 * hash + color.hashCode();
    188201        hash = 29 * hash + Arrays.hashCode(dashed);
     202        hash = 29 * hash + Float.floatToIntBits(dashesOffset);
    189203        hash = 29 * hash + (dashedColor != null ? dashedColor.hashCode() : 0);
    190204        return hash;
     
    193207    @Override
    194208    public String toString() {
    195         return "LineElemStyle{" + super.toString() + "width=" + width + " realWidth=" + realWidth + " color=" + color + " dashed=" + Arrays.toString(dashed) + " dashedColor=" + dashedColor + '}';
     209        return "LineElemStyle{" + super.toString() + "width=" + width +
     210                " realWidth=" + realWidth + " color=" + Utils.toString(color) +
     211                " dashed=" + Arrays.toString(dashed) +
     212                (dashesOffset == 0f ? "" : " dashesOffses=" + dashesOffset) +
     213                " dashedColor=" + Utils.toString(dashedColor) + '}';
    196214    }
    197215}
Note: See TracChangeset for help on using the changeset viewer.