Ignore:
Timestamp:
2015-11-14T22:06:03+01:00 (8 years ago)
Author:
bastiK
Message:

see #12104 - mapcss: add option for partial filling of areas (inspired by iD)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

    r9002 r9005  
    451451    }
    452452
    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) {
    454454
    455455        Shape area = path.createTransformedShape(nc.getAffineTransform());
     
    462462                }
    463463                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                }
    465473            } else {
    466474                TexturePaint texture = new TexturePaint(fillImage.getImage(disabled),
     
    559567     * @param color The color to fill the area with.
    560568     * @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
    561572     * @param disabled If this should be drawn with a special disabled style.
    562573     * @param text The text to write on the area.
    563574     */
    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) {
    565576        Multipolygon multipolygon = MultipolygonCache.getInstance().get(nc, r);
    566577        if (!r.isDisabled() && !multipolygon.getOuterWays().isEmpty()) {
     
    572583                drawArea(r, p,
    573584                        pd.selected ? paintSettings.getRelationSelectedColor(color.getAlpha()) : color,
    574                                 fillImage, disabled, text);
     585                        fillImage, extent, disabled, text);
    575586            }
    576587        }
     
    582593     * @param color The color to fill the area with.
    583594     * @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
    584598     * @param disabled If this should be drawn with a special disabled style.
    585599     * @param text The text to write on the area.
    586600     */
    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);
    589603    }
    590604
Note: See TracChangeset for help on using the changeset viewer.