- Timestamp:
- 2015-11-14T22:06:03+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
r9002 r9005 451 451 } 452 452 453 protected void drawArea(OsmPrimitive osm, Path2D.Double path, Color color, MapImage fillImage, boolean disabled, TextElement text) {453 protected void drawArea(OsmPrimitive osm, Path2D.Double path, Color color, MapImage fillImage, Float extent, boolean disabled, TextElement text) { 454 454 455 455 Shape area = path.createTransformedShape(nc.getAffineTransform()); … … 462 462 } 463 463 g.setColor(color); 464 g.fill(area); 464 if (extent == null) { 465 g.fill(area); 466 } else { 467 Shape clip = g.getClip(); 468 g.clip(area); 469 g.setStroke(new BasicStroke(2 * extent)); 470 g.draw(area); 471 g.setClip(clip); 472 } 465 473 } else { 466 474 TexturePaint texture = new TexturePaint(fillImage.getImage(disabled), … … 559 567 * @param color The color to fill the area with. 560 568 * @param fillImage The image to fill the area with. Overrides color. 569 * @param extent if not null, area will be filled partially; specifies, how 570 * far to fill from the boundary towards the center of the area; 571 * if null, area will be filled completely 561 572 * @param disabled If this should be drawn with a special disabled style. 562 573 * @param text The text to write on the area. 563 574 */ 564 public void drawArea(Relation r, Color color, MapImage fillImage, boolean disabled, TextElement text) {575 public void drawArea(Relation r, Color color, MapImage fillImage, Float extent, boolean disabled, TextElement text) { 565 576 Multipolygon multipolygon = MultipolygonCache.getInstance().get(nc, r); 566 577 if (!r.isDisabled() && !multipolygon.getOuterWays().isEmpty()) { … … 572 583 drawArea(r, p, 573 584 pd.selected ? paintSettings.getRelationSelectedColor(color.getAlpha()) : color, 574 fillImage, disabled, text);585 fillImage, extent, disabled, text); 575 586 } 576 587 } … … 582 593 * @param color The color to fill the area with. 583 594 * @param fillImage The image to fill the area with. Overrides color. 595 * @param extent if not null, area will be filled partially; specifies, how 596 * far to fill from the boundary towards the center of the area; 597 * if null, area will be filled completely 584 598 * @param disabled If this should be drawn with a special disabled style. 585 599 * @param text The text to write on the area. 586 600 */ 587 public void drawArea(Way w, Color color, MapImage fillImage, boolean disabled, TextElement text) {588 drawArea(w, getPath(w), color, fillImage, disabled, text);601 public void drawArea(Way w, Color color, MapImage fillImage, Float extent, boolean disabled, TextElement text) { 602 drawArea(w, getPath(w), color, fillImage, extent, disabled, text); 589 603 } 590 604 -
trunk/src/org/openstreetmap/josm/gui/mappaint/AreaElemStyle.java
r8289 r9005 25 25 public MapImage fillImage; 26 26 public TextElement text; 27 public Float extent; 27 28 28 protected AreaElemStyle(Cascade c, Color color, MapImage fillImage, TextElement text) {29 protected AreaElemStyle(Cascade c, Color color, MapImage fillImage, Float extent, TextElement text) { 29 30 super(c, 1f); 30 31 CheckParameterUtil.ensureParameterNotNull(color); 31 32 this.color = color; 33 this.extent = extent; 32 34 this.fillImage = fillImage; 33 35 this.text = text; … … 38 40 MapImage fillImage = null; 39 41 Color color = null; 42 Float extent = null; 40 43 41 44 IconReference iconRef = c.get(FILL_IMAGE, null, IconReference.class); … … 69 72 } 70 73 color = new Color(color.getRed(), color.getGreen(), color.getBlue(), alpha); 74 extent = c.get(FILL_EXTENT, null, float.class); 71 75 } 72 76 } … … 79 83 80 84 if (color != null) 81 return new AreaElemStyle(c, color, fillImage, text);85 return new AreaElemStyle(c, color, fillImage, extent, text); 82 86 else 83 87 return null; … … 96 100 } 97 101 } 98 painter.drawArea((Way) osm, myColor, fillImage, painter.isInactiveMode() || osm.isDisabled(), text);102 painter.drawArea((Way) osm, myColor, fillImage, extent, painter.isInactiveMode() || osm.isDisabled(), text); 99 103 } else if (osm instanceof Relation) { 100 104 if (color != null && (selected || outermember)) { 101 105 myColor = paintSettings.getRelationSelectedColor(color.getAlpha()); 102 106 } 103 painter.drawArea((Relation) osm, myColor, fillImage, painter.isInactiveMode() || osm.isDisabled(), text);107 painter.drawArea((Relation) osm, myColor, fillImage, extent, painter.isInactiveMode() || osm.isDisabled(), text); 104 108 } 105 109 } … … 117 121 if (!Objects.equals(color, other.color)) 118 122 return false; 123 if (extent != other.extent) 124 return false; 119 125 if (!Objects.equals(text, other.text)) 120 126 return false; … … 126 132 int hash = 3; 127 133 hash = 61 * hash + color.hashCode(); 134 hash = 61 * hash + (extent != null ? Float.floatToIntBits(extent) : 0); 128 135 hash = 61 * hash + (fillImage != null ? fillImage.hashCode() : 0); 129 136 hash = 61 * hash + (text != null ? text.hashCode() : 0); -
trunk/src/org/openstreetmap/josm/gui/mappaint/StyleKeys.java
r8260 r9005 10 10 String DASHES_OFFSET = "dashes-offset"; 11 11 String FILL_COLOR = "fill-color"; 12 String FILL_EXTENT = "fill-extent"; 12 13 String FILL_IMAGE = "fill-image"; 13 14 String FILL_OPACITY = "fill-opacity";
Note:
See TracChangeset
for help on using the changeset viewer.