Changeset 4316 in josm for trunk/src


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

mapcss: add line offset

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

Legend:

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

    r4087 r4316  
    202202    @Override
    203203    public void render(final DataSet data, boolean renderVirtualNodes, Bounds bounds) {
    204         //long start = System.currentTimeMillis();
     204        long start = System.currentTimeMillis();
    205205        BBox bbox = new BBox(bounds);
    206206
     
    226226        collectWayStyles(data, sc, bbox);
    227227        collectRelationStyles(data, sc, bbox);
    228         //long phase1 = System.currentTimeMillis();
     228        long phase1 = System.currentTimeMillis();
    229229        sc.drawAll();
    230230        sc = null;
    231231        painter.drawVirtualNodes(data.searchWays(bbox));
    232232
    233         //long now = System.currentTimeMillis();
    234         //System.err.println(String.format("PAINTING TOOK %d [PHASE1 took %d] (at scale %s)", now - start, phase1 - start, circum));
     233        long now = System.currentTimeMillis();
     234        System.err.println(String.format("PAINTING TOOK %d [PHASE1 took %d] (at scale %s)", now - start, phase1 - start, circum));
    235235    }
    236236}
  • 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.