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

mapcss: dashes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapPainter.java

    r3858 r3859  
    100100    }
    101101
    102     public void drawWay(Way way, Color color, float width, float dashed[], Color dashedColor, boolean showDirection,
     102    public void drawWay(Way way, Color color, float width, float dashed[], float dashesOffset, Color dashedColor, boolean showDirection,
    103103            boolean reversedDirection, boolean showHeadArrowOnly) {
    104104
     
    156156            lastPoint = p;
    157157        }
    158         displaySegments(path, arrows, color, width, dashed, dashedColor);
    159     }
    160 
    161     private void displaySegments(GeneralPath path, GeneralPath arrows, Color color, float width, float dashed[], Color dashedColor) {
     158        displaySegments(path, arrows, color, width, dashed, dashesOffset, dashedColor);
     159    }
     160
     161    private void displaySegments(GeneralPath path, GeneralPath arrows, Color color, float width, float dashed[], float dashesOffset, Color dashedColor) {
    162162        g.setColor(inactive ? inactiveColor : color);
    163163        if (useStrokes) {
    164164            if (dashed != null && dashed.length > 0) {
    165                 g.setStroke(new BasicStroke(width,BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND,0, dashed,0));
     165                g.setStroke(new BasicStroke(width,BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND,0,dashed,dashesOffset));
    166166            } else {
    167167                g.setStroke(new BasicStroke(width,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND));
     
    175175            if (dashed != null && dashed.length > 0) {
    176176                float[] dashedOffset = new float[dashed.length];
    177                 System.arraycopy(dashed, 1, dashedOffset, 0, dashed.length - 1);
    178                 dashedOffset[dashed.length-1] = dashed[0];
    179                 float offset = dashedOffset[0];
    180                 g.setStroke(new BasicStroke(width,BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND,0,dashedOffset,offset));
     177                System.arraycopy(dashed, 0, dashedOffset, 1, dashed.length - 1);
     178                dashedOffset[0] = dashed[dashed.length-1];
     179                float offset = dashedOffset[0] + dashesOffset;
     180                g.setStroke(new BasicStroke(width,BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND,0,dashedOffset, offset));
    181181            } else {
    182182                g.setStroke(new BasicStroke(width,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND));
Note: See TracChangeset for help on using the changeset viewer.