Interface ILcdWMTSGetLegendGraphicRequestEncoder

All Known Implementing Classes:
TLcdDefaultWMTSGetLegendGraphicEncoder

public interface ILcdWMTSGetLegendGraphicRequestEncoder
Creates and encodes legend graphics to a specific content type. The type of encoding is defined by the actual implementations.
Each ILcdWMTSLegendGraphicRequestEncoder has a content type that identifies the type of data encoded by the implementation. This is usually the MIME - TYPE of the encoded result.
Since:
2022.0
  • Method Details

    • getContentType

      String getContentType()
      Returns the content MIME type of the encoder.
      Returns:
      the MIME-type as String.
    • encode

      boolean encode(TLcdWMTSGetLegendGraphicRequestContext aWMTSGetLegendGraphicRequestContext, OutputStream aOutputStream) throws IOException
      Encodes the legend graphic for a given TLcdWMTSGetLegendGraphicRequestContext and sends it to the given OutputStream.
      Parameters:
      aWMTSGetLegendGraphicRequestContext - a container for all relevant information that might be useful when generating legends.
      aOutputStream - the OutputStream to write the output to.
      Returns:
      True if the encoder can handle this case, false if it does not.
      Throws:
      IOException - for any I/O Exceptions.
    • getLegendURL

      default TLcdWMTSLegendURLParameters getLegendURL(String aLayer, String aStyle, TLcdWMTSLegendURLParameters aDefaultLegendURL)
      Determines the href, width and height to advertise in the LegendURL for the given layer and style.

      aDefaultLegendURL holds the parameters that would otherwise be advertised: an href pointing to a GetLegendGraphic request on this encoder, and the default configured legend dimensions. Implementations can:

      • return aDefaultLegendURL unchanged, to keep that default behavior;
      • return a different TLcdWMTSLegendURLParameters, to override the width, the height, the href, or all three — for example to advertise a static, externally-hosted legend image instead of a dynamically-generated one;
      • return null, to indicate this encoder has no opinion on this layer and style. If another encoder shares this encoder's content type, that encoder is consulted next; if none of them return a non-null result, no LegendURL is advertised for this content type, for this layer and style.
      Returning aDefaultLegendURL unchanged is not the same as returning null: the former confirms the default is correct for this layer and style and stops any further encoders sharing this content type from being consulted, while the latter defers that decision to them.

      By default, returns aDefaultLegendURL unchanged, which preserves the behavior prior to the introduction of this method.

      Parameters:
      aLayer - the identifier of the layer for which a LegendURL is being advertised.
      aStyle - the identifier of the style for which a LegendURL is being advertised.
      aDefaultLegendURL - the parameters that would otherwise be advertised.
      Returns:
      the parameters to advertise, a modified copy of aDefaultLegendURL, or null.
      Since:
      2026.0.15