Ignore:
Timestamp:
2015-12-11T17:36:59+01:00 (10 years ago)
Author:
bastiK
Message:

mapcss partial fill: move threshold parameter ([9063]) into the mapcss style
(new property fill-extent-threshold)

  • add support for this parameter when area is unclosed
  • smaller extent for unclosed areas

(see #12104)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/AreaElemStyle.java

    r9008 r9099  
    2626    public TextElement text;
    2727    public Float extent;
     28    public Float extentThreshold;
    2829
    29     protected AreaElemStyle(Cascade c, Color color, MapImage fillImage, Float extent, TextElement text) {
     30    protected AreaElemStyle(Cascade c, Color color, MapImage fillImage, Float extent, Float extentThreshold, TextElement text) {
    3031        super(c, 1f);
    3132        CheckParameterUtil.ensureParameterNotNull(color);
    3233        this.color = color;
     34        this.fillImage = fillImage;
    3335        this.extent = extent;
    34         this.fillImage = fillImage;
     36        this.extentThreshold = extentThreshold;
    3537        this.text = text;
    3638    }
     
    3941        final Cascade c = env.mc.getCascade(env.layer);
    4042        MapImage fillImage = null;
    41         Color color = null;
    42         Float extent = null;
     43        Color color;
    4344
    4445        IconReference iconRef = c.get(FILL_IMAGE, null, IconReference.class);
     
    8182        }
    8283
    83         extent = c.get(FILL_EXTENT, null, float.class);
     84        Float extent = c.get(FILL_EXTENT, null, float.class);
     85        Float extentThreshold = c.get(FILL_EXTENT_THRESHOLD, null, float.class);
    8486
    8587        if (color != null)
    86             return new AreaElemStyle(c, color, fillImage, extent, text);
     88            return new AreaElemStyle(c, color, fillImage, extent, extentThreshold, text);
    8789        else
    8890            return null;
     
    101103                }
    102104            }
    103             painter.drawArea((Way) osm, myColor, fillImage, extent, painter.isInactiveMode() || osm.isDisabled(), text);
     105            painter.drawArea((Way) osm, myColor, fillImage, extent, extentThreshold, painter.isInactiveMode() || osm.isDisabled(), text);
    104106        } else if (osm instanceof Relation) {
    105107            if (color != null && (selected || outermember)) {
    106108                myColor = paintSettings.getRelationSelectedColor(color.getAlpha());
    107109            }
    108             painter.drawArea((Relation) osm, myColor, fillImage, extent, painter.isInactiveMode() || osm.isDisabled(), text);
     110            painter.drawArea((Relation) osm, myColor, fillImage, extent, extentThreshold, painter.isInactiveMode() || osm.isDisabled(), text);
    109111        }
    110112    }
     
    124126        if (extent != other.extent)
    125127            return false;
     128        if (extentThreshold != other.extentThreshold)
     129            return false;
    126130        if (!Objects.equals(text, other.text))
    127131            return false;
     
    134138        hash = 61 * hash + color.hashCode();
    135139        hash = 61 * hash + (extent != null ? Float.floatToIntBits(extent) : 0);
     140        hash = 61 * hash + (extentThreshold != null ? Float.floatToIntBits(extent) : 0);
    136141        hash = 61 * hash + (fillImage != null ? fillImage.hashCode() : 0);
    137142        hash = 61 * hash + (text != null ? text.hashCode() : 0);
Note: See TracChangeset for help on using the changeset viewer.