- Timestamp:
- 2015-12-04T01:53:17+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/osm/visitor/paint
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapPaintSettings.java
r9076 r9082 49 49 /** Preference: should only the data area outline be drawn */ 50 50 private boolean outlineOnly; 51 /** Preference: if unclosed areas should be drawn differently for partial fill */52 private boolean unclosedAreaHighlight;53 /** Preference: width of unclosed area highlight */54 private double unclosedAreaHighlightWidth;55 51 /** Preference: parameter to avoid partial fill on small area objects: 56 52 * If more than a certain percentage of the total area would be filled by … … 115 111 116 112 outlineOnly = Main.pref.getBoolean("draw.data.area_outline_only", false); 117 unclosedAreaHighlight = Main.pref.getBoolean("draw.unclosed_area_partial_fill_highlight", false);118 unclosedAreaHighlightWidth = Main.pref.getDouble("draw.unclosed_area_partial_fill_highlight.width", 80);119 113 partialFillThreshold = Main.pref.getDouble("draw.area.partial_fill_threshold", 70); 120 114 } … … 357 351 public boolean isOutlineOnly() { 358 352 return outlineOnly; 359 }360 361 /**362 * Determines if unclosed areas should be drawn differently for partial fill.363 *364 * @return {@code true} if unclosed areas should be drawn differently for partial fill365 */366 public boolean isUnclosedAreaHighlight() {367 return unclosedAreaHighlight;368 }369 370 /**371 * Returns the width of unclosed area highlight.372 * @return the width of unclosed area highlight373 */374 public double getUnclosedAreaHighlightWidth() {375 return unclosedAreaHighlightWidth;376 353 } 377 354 -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
r9079 r9082 336 336 private boolean showIcons; 337 337 private boolean isOutlineOnly; 338 private boolean isUnclosedAreaHighlight;339 private double unclosedAreaHighlightWidth;340 338 private double partialFillThreshold; 341 339 … … 470 468 * if null, area will be filled completely 471 469 * @param pfClip clipping area for partial fill 472 * @param unclosedHighlight true, if the fact that the way / multipolygon is not473 * properly closed should be highlighted; this parameter is only used474 * for partial fill ({@code extent != null}), otherwise it is ignored475 470 * @param disabled If this should be drawn with a special disabled style. 476 471 * @param text The text to write on the area. 477 472 */ 478 protected void drawArea(OsmPrimitive osm, Path2D.Double path, Color color, MapImage fillImage, Float extent, Path2D.Double pfClip,479 boolean unclosedHighlight, boolean disabled, TextElement text) {473 protected void drawArea(OsmPrimitive osm, Path2D.Double path, Color color, 474 MapImage fillImage, Float extent, Path2D.Double pfClip, boolean disabled, TextElement text) { 480 475 481 476 Shape area = path.createTransformedShape(nc.getAffineTransform()); … … 491 486 g.fill(area); 492 487 } else { 493 if (unclosedHighlight) { 494 g.setStroke(new BasicStroke((int) (unclosedAreaHighlightWidth / 100 * extent), 495 BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); 496 g.draw(area); 497 } else { 498 Shape oldClip = g.getClip(); 499 Shape clip = area; 500 if (pfClip != null) { 501 clip = pfClip.createTransformedShape(nc.getAffineTransform()); 502 } 503 g.clip(clip); 504 g.setStroke(new BasicStroke(2 * extent, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); 505 g.draw(area); 506 g.setClip(oldClip); 488 Shape oldClip = g.getClip(); 489 Shape clip = area; 490 if (pfClip != null) { 491 clip = pfClip.createTransformedShape(nc.getAffineTransform()); 507 492 } 493 g.clip(clip); 494 g.setStroke(new BasicStroke(2 * extent, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); 495 g.draw(area); 496 g.setClip(oldClip); 508 497 } 509 498 } else { … … 518 507 g.fill(area); 519 508 } else { 520 if (unclosedHighlight) { 521 g.setStroke(new BasicStroke((int) (unclosedAreaHighlightWidth / 100 * extent), 522 BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); 523 g.draw(area); 524 } else { 525 Shape oldClip = g.getClip(); 526 BasicStroke stroke = new BasicStroke(2 * extent, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); 527 g.clip(stroke.createStrokedShape(area)); 528 Shape fill = area; 529 if (pfClip != null) { 530 fill = pfClip.createTransformedShape(nc.getAffineTransform()); 531 } 532 g.fill(fill); 533 g.setClip(oldClip); 509 Shape oldClip = g.getClip(); 510 BasicStroke stroke = new BasicStroke(2 * extent, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); 511 g.clip(stroke.createStrokedShape(area)); 512 Shape fill = area; 513 if (pfClip != null) { 514 fill = pfClip.createTransformedShape(nc.getAffineTransform()); 534 515 } 516 g.fill(fill); 517 g.setClip(oldClip); 535 518 } 536 519 g.setPaintMode(); … … 636 619 continue; 637 620 } 638 boolean unclosedHighlight = false;639 621 if (extent != null) { 640 622 if (pd.isClosed()) { … … 646 628 } 647 629 } else { 648 unclosedHighlight = isUnclosedAreaHighlight;649 630 pfClip = getPFClip(pd, extent * scale); 650 631 } … … 652 633 drawArea(r, p, 653 634 pd.selected ? paintSettings.getRelationSelectedColor(color.getAlpha()) : color, 654 fillImage, extent, pfClip, unclosedHighlight,disabled, text);635 fillImage, extent, pfClip, disabled, text); 655 636 } 656 637 } … … 682 663 } 683 664 } 684 drawArea(w, getPath(w), color, fillImage, extent, pfClip, isUnclosedAreaHighlight && !w.isClosed(),disabled, text);665 drawArea(w, getPath(w), color, fillImage, extent, pfClip, disabled, text); 685 666 } 686 667 … … 1538 1519 showIcons = paintSettings.getShowIconsDistance() > circum; 1539 1520 isOutlineOnly = paintSettings.isOutlineOnly(); 1540 isUnclosedAreaHighlight = paintSettings.isUnclosedAreaHighlight();1541 unclosedAreaHighlightWidth = paintSettings.getUnclosedAreaHighlightWidth();1542 1521 partialFillThreshold = paintSettings.getPartialFillThreshold(); 1543 1522 orderFont = new Font(Main.pref.get("mappaint.font", "Droid Sans"), Font.PLAIN, Main.pref.getInteger("mappaint.fontsize", 8));
Note:
See TracChangeset
for help on using the changeset viewer.