Changeset 14557 in josm for trunk/src/org/openstreetmap/josm/data/osm/visitor
- Timestamp:
- 2018-12-13T15:15:34+01:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
r14273 r14557 446 446 } 447 447 g.setColor(color); 448 if (extent == null) { 449 g.fill(area); 450 } else { 451 Shape oldClip = g.getClip(); 452 Shape clip = area; 453 if (pfClip != null) { 454 clip = pfClip.createTransformedShape(mapState.getAffineTransform()); 455 } 456 g.clip(clip); 457 g.setStroke(new BasicStroke(2 * extent, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 4)); 458 g.draw(area); 459 g.setClip(oldClip); 460 g.setStroke(new BasicStroke()); 461 } 448 computeFill(area, extent, pfClip, 4); 462 449 } else { 463 450 // TexturePaint requires BufferedImage -> get base image from possible multi-resolution image … … 473 460 g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha)); 474 461 } 475 if (extent == null) { 476 g.fill(area); 477 } else { 478 Shape oldClip = g.getClip(); 479 BasicStroke stroke = new BasicStroke(2 * extent, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); 480 g.clip(stroke.createStrokedShape(area)); 481 Shape fill = area; 482 if (pfClip != null) { 483 fill = pfClip.createTransformedShape(mapState.getAffineTransform()); 484 } 485 g.fill(fill); 486 g.setClip(oldClip); 487 } 462 computeFill(area, extent, pfClip, 10); 488 463 g.setPaintMode(); 489 464 } 490 465 g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, antialiasing); 466 } 467 } 468 469 /** 470 * Fill the given shape. If partial fill is used, computes the clipping. 471 * @param shape the given shape 472 * @param extent if not null, area will be filled partially; specifies, how 473 * far to fill from the boundary towards the center of the area; 474 * if null, area will be filled completely 475 * @param pfClip clipping area for partial fill (only needed for unclosed 476 * polygons) 477 * @param mitterLimit parameter for BasicStroke 478 * 479 */ 480 private void computeFill(Shape shape, Float extent, Path2D.Double pfClip, float mitterLimit) { 481 if (extent == null) { 482 g.fill(shape); 483 } else { 484 Shape oldClip = g.getClip(); 485 Shape clip = shape; 486 if (pfClip != null) { 487 clip = pfClip.createTransformedShape(mapState.getAffineTransform()); 488 } 489 g.clip(clip); 490 g.setStroke(new BasicStroke(2 * extent, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, mitterLimit)); 491 g.draw(shape); 492 g.setClip(oldClip); 493 g.setStroke(new BasicStroke()); 491 494 } 492 495 }
Note:
See TracChangeset
for help on using the changeset viewer.