Ignore:
Timestamp:
2020-06-21T18:53:41+02:00 (6 years ago)
Author:
simon04
Message:

fix #18213 - MapCSS: add support for repeat-image-opacity

File:
1 edited

Legend:

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

    r16630 r16700  
    6767    public float phase;
    6868    /**
     69     * The opacity
     70     */
     71    public float opacity;
     72    /**
    6973     * The alignment of the image
    7074     */
     
    8185     * @param spacing The space between the images
    8286     * @param phase The offset of the first image along the way
     87     * @param opacity The opacity
    8388     * @param align The alignment of the image
    8489     */
    85     public RepeatImageElement(Cascade c, MapImage pattern, float offset, float spacing, float phase, LineImageAlignment align) {
     90    public RepeatImageElement(Cascade c, MapImage pattern, float offset, float spacing, float phase, float opacity, LineImageAlignment align) {
    8691        super(c, 2.9f);
    8792        CheckParameterUtil.ensureParameterNotNull(pattern);
     
    9196        this.spacing = spacing;
    9297        this.phase = phase;
     98        this.opacity = opacity;
    9399        this.align = align;
    94100    }
     
    107113        float spacing = c.get(REPEAT_IMAGE_SPACING, 0f, Float.class);
    108114        float phase = -c.get(REPEAT_IMAGE_PHASE, 0f, Float.class);
     115        float opacity = c.get(REPEAT_IMAGE_OPACITY, 1f, Float.class);
    109116
    110117        LineImageAlignment align = LineImageAlignment.CENTER;
     
    116123        }
    117124
    118         return new RepeatImageElement(c, pattern, offset, spacing, phase, align);
     125        return new RepeatImageElement(c, pattern, offset, spacing, phase, opacity, align);
    119126    }
    120127
     
    124131        if (primitive instanceof IWay) {
    125132            IWay<?> w = (IWay<?>) primitive;
    126             painter.drawRepeatImage(w, pattern, painter.isInactiveMode() || w.isDisabled(), offset, spacing, phase, align);
     133            painter.drawRepeatImage(w, pattern, painter.isInactiveMode() || w.isDisabled(), offset, spacing, phase, opacity, align);
    127134        }
    128135    }
     
    148155    @Override
    149156    public int hashCode() {
    150         return Objects.hash(super.hashCode(), pattern, offset, spacing, phase, align);
     157        return Objects.hash(super.hashCode(), pattern, offset, spacing, phase, opacity, align);
    151158    }
    152159
     
    155162        return "RepeatImageStyle{" + super.toString() + "pattern=[" + pattern +
    156163                "], offset=" + offset + ", spacing=" + spacing +
    157                 ", phase=" + -phase + ", align=" + align + '}';
     164                ", phase=" + -phase + ", opacity=" + opacity + ", align=" + align + '}';
    158165    }
    159166}
Note: See TracChangeset for help on using the changeset viewer.