Interface MapLayer

All Known Implementing Classes:
AbstractFeatureSourceLayer, AbstractGeotoolsLayer, AbstractSingleImageLayer, AbstractTiledLayer, FeatureLayer, GeoJsonLayer, GeotiffLayer, GmlLayer, GridLayer, ImageLayer, OsmLayer, TiledWmsLayer, WmsLayer, WMTSLayer

public interface MapLayer
Encapsulates the data required to load map data for a layer and render it.
  • Field Details

    • DEFAULT_SCALING

      static final double DEFAULT_SCALING
      Represents the default scaling factor applied to a map layer.

      By default, this value is set to 1.0, signifying no scaling. This variable can be used to adjust the scale ratio between map elements, ensuring that rendered layers maintain consistency in appearance and resolution. It is generally used in map rendering operations and calculations involving layer scaling.

      See Also:
  • Method Details

    • tryAddLayer

      Optional<MapLayer> tryAddLayer(MapLayer newLayer)
      Attempt to add the layer this layer so that both can be rendered as a single layer.

      For example: 2 WMS layers from the same WMS server can be combined into a single WMS layer and the map can be rendered with a single WMS request.

      Parameters:
      newLayer - the layer to combine with this layer. The new layer will be rendered below the current layer.
      Returns:
      If the two layers can be combined then a map layer representing the two layers will be returned. If the two layers cannot be combined then Option.absent() will be returned.
    • prepareRender

      MapLayer.LayerContext prepareRender(MapfishMapContext transformer, MfClientHttpRequestFactory clientHttpRequestFactory)
      Render the layer to the graphics2D object.
      Parameters:
      transformer - the map transformer containing the map bounds and size.
      clientHttpRequestFactory - the factory to use for making http requests.
      Returns:
      the LayerContext for this requested rendering.
    • render

      void render(Graphics2D graphics2D, MfClientHttpRequestFactory clientHttpRequestFactory, MapfishMapContext transformer, Processor.ExecutionContext context, MapLayer.LayerContext layerContext)
      Render the layer to the graphics2D object.
      Parameters:
      graphics2D - the graphics object.
      clientHttpRequestFactory - The factory to use for making http requests.
      transformer - the map transformer containing the map bounds and size.
      context - the job ID
      layerContext - the context of this layer
    • supportsNativeRotation

      boolean supportsNativeRotation()
      Indicate if the layer supports native rotation (e.g. WMS layers with the "angle" parameter).
      Returns:
      True if the layer itself takes care of rotating.
    • getName

      String getName()
      The layer name.
    • getRenderType

      MapLayer.RenderType getRenderType()
      Specify whether layer should be rendered as PNG, JPEG or SVG.
      Returns:
      render type
    • prefetchResources

      MapLayer.LayerContext prefetchResources(HttpRequestFetcher httpRequestFetcher, MfClientHttpRequestFactory clientHttpRequestFactory, MapfishMapContext transformer, Processor.ExecutionContext context, MapLayer.LayerContext layerContext)
      Cache any needed resources on disk.
      Parameters:
      httpRequestFetcher - TODO
      clientHttpRequestFactory - client http request factory
      transformer - transformer
      context - the job ID
      layerContext - the context of this layer
      Returns:
      the same layer context or one with updated contextual information
    • getOpacity

      double getOpacity()
      Gets the opacity.
      Returns:
      the opacity