Ignore:
Timestamp:
2017-07-07T21:27:45+02:00 (3 years ago)
Author:
michael2402
Message:

Fix #14926: Preserve image phase when clamping a line.

File:
1 edited

Legend:

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

    r12450 r12455  
    655655        }
    656656
    657         double startOffset = phase % repeat;
    658         if (startOffset < 0) {
    659             startOffset += repeat;
    660         }
     657        double startOffset = computeStartOffset(phase, repeat);
    661658
    662659        BufferedImage image = pattern.getImage(disabled);
    663660
    664         path.visitClippedLine(startOffset, repeat, (inLineOffset, start, end, startIsOldEnd) -> {
     661        path.visitClippedLine(repeat, (inLineOffset, start, end, startIsOldEnd) -> {
    665662            final double segmentLength = start.distanceToInView(end);
    666663            if (segmentLength < 0.1) {
     
    679676
    680677            // The start of the next image
    681             double imageStart = -(inLineOffset % repeat);
     678            double imageStart = -((inLineOffset + startOffset) % repeat);
    682679
    683680            while (imageStart < segmentLength) {
     
    691688            g.setTransform(saveTransform);
    692689        });
     690    }
     691
     692    private static double computeStartOffset(double phase, final double repeat) {
     693        double startOffset = phase % repeat;
     694        if (startOffset < 0) {
     695            startOffset += repeat;
     696        }
     697        return startOffset;
    693698    }
    694699
     
    12911296            double interval = 60;
    12921297
    1293             path.visitClippedLine(0, 60, (inLineOffset, start, end, startIsOldEnd) -> {
     1298            path.visitClippedLine(60, (inLineOffset, start, end, startIsOldEnd) -> {
    12941299                double segmentLength = start.distanceToInView(end);
    12951300                if (segmentLength > 0.001) {
Note: See TracChangeset for help on using the changeset viewer.