Package com.luciad.wms.server
Interface ILcdWMSGetLegendGraphicRequestEncoder
- All Known Implementing Classes:
TLcdDefaultWMSGetLegendGraphicEncoder
public interface ILcdWMSGetLegendGraphicRequestEncoder
This interface specifies methods to encode the result of a
The type of encoding is defined by the actual implementations.
Each
To plug in your own implementation you need to override
GetLegendGraphic request.The type of encoding is defined by the actual implementations.
Each
ILcdWMSLegendGraphicRequestEncoder has a content type that identifies the type of data
encoded by the implementation. This is the MIME - TYPE of the encoded result.
Allowed values are the same as for the FORMAT parameter of the WMS GetMap request. This list contains a number of basic image formats like png and jpeg, but also non image formats like pdf and kml.
The user can select any format from this list as long as the data written to the output stream complies with the expected MIME - TYPE, most clients however offer only support for image formats.To plug in your own implementation you need to override
ALcdOGCWMSCommandDispatcherFactory.createWMSGetLegendGraphicEncoders(ServletConfig) and add your encoder to the array that is returned.-
Method Summary
Modifier and TypeMethodDescriptionbooleanencode(TLcdWMSGetLegendGraphicRequestContext aWMSGetLegendGraphicRequestContext, TLcdWMSRequestContext aWMSRequestContext, OutputStream aOutputStream) Encodes the legend graphic for a given layer and sends it to the givenOutputStream.Returns the content MIME type of the encoder.default TLcdWMSLegendURLParametersgetLegendURL(ALcdWMSLayer aLayer, ALcdWMSLayerStyle aLayerStyle, TLcdWMSLegendURLParameters aDefaultLegendURL) Determines the online resource, width and height to advertise in theLegendURLfor the given layer and style.
-
Method Details
-
getContentType
String getContentType()Returns the content MIME type of the encoder.- Returns:
- the MIME-type as
String.
-
encode
boolean encode(TLcdWMSGetLegendGraphicRequestContext aWMSGetLegendGraphicRequestContext, TLcdWMSRequestContext aWMSRequestContext, OutputStream aOutputStream) throws IOException Encodes the legend graphic for a given layer and sends it to the givenOutputStream.- Parameters:
aWMSGetLegendGraphicRequestContext- a container for all relevant information that might be useful when generating legendsaWMSRequestContext- a container for the original request and other related request parameters.aOutputStream- theOutputStreamto write the output to. The type of data is given bygetContentType().- Returns:
- True if the encoder can handle this case, false if it does not.
- Throws:
IOException- for any I/O Exceptions.- Since:
- 2022.0
-
getLegendURL
default TLcdWMSLegendURLParameters getLegendURL(ALcdWMSLayer aLayer, ALcdWMSLayerStyle aLayerStyle, TLcdWMSLegendURLParameters aDefaultLegendURL) Determines the online resource, width and height to advertise in theLegendURLfor the given layer and style.aDefaultLegendURLholds the parameters that would otherwise be advertised: an online resource pointing to aGetLegendGraphicrequest on this encoder, and the default configured legend dimensions. Implementations can:- return
aDefaultLegendURLunchanged, to keep that default behavior; - return a different
TLcdWMSLegendURLParameters, to override the width, the height, the online resource, 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-nullresult, noLegendURLis advertised for this content type, for this layer and style.
aDefaultLegendURLunchanged is not the same as returningnull: 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, returnsaDefaultLegendURLunchanged, which preserves the behavior prior to the introduction of this method.- Parameters:
aLayer- the layer for which aLegendURLis being advertised.aLayerStyle- the style for which aLegendURLis being advertised.aDefaultLegendURL- the parameters that would otherwise be advertised.- Returns:
- the parameters to advertise, a modified copy of
aDefaultLegendURL, ornull. - Since:
- 2026.0.15
- return
-