Changeset 9061 in josm for trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
- Timestamp:
- 2015-11-24T20:49:07+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
r9059 r9061 333 333 private boolean showIcons; 334 334 private boolean isOutlineOnly; 335 private boolean isUnclosedAreaHighlight; 336 private double unclosedAreaHighlightWidth; 335 337 336 338 private Font orderFont; … … 451 453 } 452 454 453 protected void drawArea(OsmPrimitive osm, Path2D.Double path, Color color, MapImage fillImage, Float extent, 455 /** 456 * Worker function for drawing areas. 457 * 458 * @param osm the primitive 459 * @param path the path object for the area that should be drawn; in case 460 * of multipolygons, this can path can be a complex shape with one outer 461 * polygon and one or more inner polygons 462 * @param color The color to fill the area with. 463 * @param fillImage The image to fill the area with. Overrides color. 464 * @param extent if not null, area will be filled partially; specifies, how 465 * far to fill from the boundary towards the center of the area; 466 * if null, area will be filled completely 467 * @param unClosedHighlight true, if the fact that the way / multipolygon is not 468 * properly closed should be highlighted; this parameter is only used 469 * for partial fill ({@code extent != null}), otherwise it is ignored 470 * @param disabled If this should be drawn with a special disabled style. 471 * @param text The text to write on the area. 472 */ 473 protected void drawArea(OsmPrimitive osm, Path2D.Double path, Color color, MapImage fillImage, Float extent, boolean unClosedHighlight, 454 474 boolean disabled, TextElement text) { 455 475 … … 466 486 g.fill(area); 467 487 } else { 468 Shape clip = g.getClip(); 469 g.clip(area); 470 g.setStroke(new BasicStroke(2 * extent, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); 471 g.draw(area); 472 g.setClip(clip); 488 if (unClosedHighlight) { 489 g.setStroke(new BasicStroke((int)(unclosedAreaHighlightWidth / 100 * extent), 490 BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); 491 g.draw(area); 492 } else { 493 Shape clip = g.getClip(); 494 g.clip(area); 495 g.setStroke(new BasicStroke(2 * extent, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); 496 g.draw(area); 497 g.setClip(clip); 498 } 473 499 } 474 500 } else { … … 483 509 g.fill(area); 484 510 } else { 485 Shape clip = g.getClip(); 486 BasicStroke stroke = new BasicStroke(2 * extent, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); 487 g.clip(stroke.createStrokedShape(area)); 488 g.fill(area); 489 g.setClip(clip); 511 if (unClosedHighlight) { 512 g.setStroke(new BasicStroke((int)(unclosedAreaHighlightWidth / 100 * extent), 513 BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); 514 g.draw(area); 515 } else { 516 Shape clip = g.getClip(); 517 BasicStroke stroke = new BasicStroke(2 * extent, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); 518 g.clip(stroke.createStrokedShape(area)); 519 g.fill(area); 520 g.setClip(clip); 521 } 490 522 } 491 523 g.setPaintMode(); … … 592 624 drawArea(r, p, 593 625 pd.selected ? paintSettings.getRelationSelectedColor(color.getAlpha()) : color, 594 fillImage, extent, disabled, text); 626 fillImage, extent, 627 isUnclosedAreaHighlight && extent != null && !pd.isClosed(), 628 disabled, text); 595 629 } 596 630 } … … 609 643 */ 610 644 public void drawArea(Way w, Color color, MapImage fillImage, Float extent, boolean disabled, TextElement text) { 611 drawArea(w, getPath(w), color, fillImage, extent, disabled, text);645 drawArea(w, getPath(w), color, fillImage, extent, isUnclosedAreaHighlight && !w.isClosed(), disabled, text); 612 646 } 613 647 … … 1464 1498 showIcons = paintSettings.getShowIconsDistance() > circum; 1465 1499 isOutlineOnly = paintSettings.isOutlineOnly(); 1500 isUnclosedAreaHighlight = paintSettings.isUnclosedAreaHighlight(); 1501 unclosedAreaHighlightWidth = paintSettings.getUnclosedAreaHighlightWidth(); 1466 1502 orderFont = new Font(Main.pref.get("mappaint.font", "Droid Sans"), Font.PLAIN, Main.pref.getInteger("mappaint.fontsize", 8)); 1467 1503
Note:
See TracChangeset
for help on using the changeset viewer.