Ignore:
Timestamp:
2011-08-13T19:51:31+02:00 (13 years ago)
Author:
bastiK
Message:

mapcss: add line offset

File:
1 edited

Legend:

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

    r4305 r4316  
    3333    public Color color;
    3434    public Color dashesBackground;
     35    public int offset;
    3536    public float realWidth; // the real width of this line in meter
    3637
    3738    private BasicStroke dashesLine;
    3839
    39     protected LineElemStyle(Cascade c, BasicStroke line, Color color, BasicStroke dashesLine, Color dashesBackground, float realWidth) {
     40    protected LineElemStyle(Cascade c, BasicStroke line, Color color, BasicStroke dashesLine, Color dashesBackground, int offset, float realWidth) {
    4041        super(c, 0f);
    4142        this.line = line;
     
    4344        this.dashesLine = dashesLine;
    4445        this.dashesBackground = dashesBackground;
     46        this.offset = offset;
    4547        this.realWidth = realWidth;
    4648    }
     
    175177        BasicStroke dashesLine = null;
    176178
     179        float offset = c.get("offset", 0f, Float.class);
     180
    177181        if (dashes != null && dashesBackground != null) {
    178182            float[] dashes2 = new float[dashes.length];
     
    182186        }
    183187
    184         return new LineElemStyle(c, line, color, dashesLine, dashesBackground, realWidth);
     188        return new LineElemStyle(c, line, color, dashesLine, dashesBackground, (int) offset, realWidth);
    185189    }
    186190
     
    228232        }
    229233
    230         painter.drawWay(w, myColor, myLine, myDashLine, myDashedColor, showOrientation,
     234        painter.drawWay(w, myColor, myLine, myDashLine, myDashedColor, offset, showOrientation,
    231235                showOnlyHeadArrowOnly, showOneway, onewayReversed);
    232236
     
    260264            equal(dashesLine, other.dashesLine) &&
    261265            equal(dashesBackground, other.dashesBackground) &&
     266            offset == other.offset &&
    262267            realWidth == other.realWidth;
    263268    }
     
    270275        hash = 29 * hash + (dashesLine != null ? dashesLine.hashCode() : 0);
    271276        hash = 29 * hash + (dashesBackground != null ? dashesBackground.hashCode() : 0);
     277        hash = 29 * hash + offset;
    272278        hash = 29 * hash + Float.floatToIntBits(realWidth);
    273279        return hash;
     
    283289            " linejoin=" + linejoinToString(line.getLineJoin()) +
    284290            " linecap=" + linecapToString(line.getEndCap()) +
     291            (offset == 0 ? "" : " offset=" + offset) +
    285292            '}';
    286293    }
Note: See TracChangeset for help on using the changeset viewer.