Changeset 12455 in josm for trunk/src/org
- Timestamp:
- 2017-07-07T21:27:45+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
r12450 r12455 655 655 } 656 656 657 double startOffset = phase % repeat; 658 if (startOffset < 0) { 659 startOffset += repeat; 660 } 657 double startOffset = computeStartOffset(phase, repeat); 661 658 662 659 BufferedImage image = pattern.getImage(disabled); 663 660 664 path.visitClippedLine( startOffset,repeat, (inLineOffset, start, end, startIsOldEnd) -> {661 path.visitClippedLine(repeat, (inLineOffset, start, end, startIsOldEnd) -> { 665 662 final double segmentLength = start.distanceToInView(end); 666 663 if (segmentLength < 0.1) { … … 679 676 680 677 // The start of the next image 681 double imageStart = -( inLineOffset% repeat);678 double imageStart = -((inLineOffset + startOffset) % repeat); 682 679 683 680 while (imageStart < segmentLength) { … … 691 688 g.setTransform(saveTransform); 692 689 }); 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; 693 698 } 694 699 … … 1291 1296 double interval = 60; 1292 1297 1293 path.visitClippedLine( 0,60, (inLineOffset, start, end, startIsOldEnd) -> {1298 path.visitClippedLine(60, (inLineOffset, start, end, startIsOldEnd) -> { 1294 1299 double segmentLength = start.distanceToInView(end); 1295 1300 if (segmentLength > 0.001) { -
trunk/src/org/openstreetmap/josm/gui/draw/MapViewPath.java
r12450 r12455 254 254 length += f; 255 255 } 256 return visitClippedLine( ((BasicStroke) stroke).getDashPhase(),length, consumer);256 return visitClippedLine(length, consumer); 257 257 } else { 258 return visitClippedLine(0, 0,consumer);258 return visitClippedLine(0, consumer); 259 259 } 260 260 } … … 263 263 * Visits all straight segments of this path. The segments are clamped to the view. 264 264 * If they are clamped, the start points are aligned with the pattern. 265 * @param strokeOffset The initial offset of the pattern 266 * @param strokeLength The dash pattern length. 0 to use no pattern. 265 * @param strokeLength The dash pattern length. 0 to use no pattern. Only segments of this length will be removed from the line. 267 266 * @param consumer The consumer to call for each segment 268 267 * @return false if visiting the path failed because there e.g. were non-straight segments. 269 268 * @since 11147 270 269 */ 271 public boolean visitClippedLine(double stroke Offset, double strokeLength, PathSegmentConsumer consumer) {272 return new ClampingPathVisitor(state.getViewClipRectangle(), stroke Offset, strokeLength, consumer)270 public boolean visitClippedLine(double strokeLength, PathSegmentConsumer consumer) { 271 return new ClampingPathVisitor(state.getViewClipRectangle(), strokeLength, consumer) 273 272 .visit(this); 274 273 } … … 400 399 * Create a new {@link ClampingPathVisitor} 401 400 * @param clip View clip rectangle 402 * @param strokeOffset Initial stroke offset403 401 * @param strokeLength Total length of a stroke sequence 404 402 * @param consumer The consumer to notify of the path segments. 405 403 */ 406 ClampingPathVisitor(MapViewRectangle clip, double stroke Offset, double strokeLength, PathSegmentConsumer consumer) {404 ClampingPathVisitor(MapViewRectangle clip, double strokeLength, PathSegmentConsumer consumer) { 407 405 this.clip = clip; 408 this.strokeProgress = Math.min(strokeLength - strokeOffset, 0);409 406 this.strokeLength = strokeLength; 410 407 this.consumer = consumer;
Note:
See TracChangeset
for help on using the changeset viewer.