Class AbstractSingleImageLayer

java.lang.Object
org.mapfish.print.map.geotools.AbstractGeotoolsLayer
org.mapfish.print.map.image.AbstractSingleImageLayer
All Implemented Interfaces:
MapLayer
Direct Known Subclasses:
ImageLayer, WmsLayer

public abstract class AbstractSingleImageLayer extends AbstractGeotoolsLayer
Common implementation for layers that are represented as a single grid coverage image.
  • Field Details

    • registry

      @Nonnull protected final com.codahale.metrics.MetricRegistry registry
      The metrics object.
    • configuration

      protected final Configuration configuration
      The configuration.
  • Constructor Details

    • AbstractSingleImageLayer

      protected AbstractSingleImageLayer(ExecutorService executorService, StyleSupplier<org.geotools.coverage.grid.GridCoverage2D> styleSupplier, AbstractLayerParams params, @Nonnull com.codahale.metrics.MetricRegistry registry, Configuration configuration)
      Constructor.
      Parameters:
      executorService - the thread pool for doing the rendering.
      styleSupplier - the style to use when drawing the constructed grid coverage on the map.
      params - the parameters for this layer
      registry - the metrics object.
      configuration - the configuration
  • Method Details

    • getLayers

      protected final List<? extends org.geotools.map.Layer> getLayers(MfClientHttpRequestFactory httpRequestFactory, MapfishMapContext mapContext, Processor.ExecutionContext context, MapLayer.LayerContext layerContext)
      Description copied from class: AbstractGeotoolsLayer
      Get the DataStore object that contains the data for this layer.
      Specified by:
      getLayers in class AbstractGeotoolsLayer
      Parameters:
      httpRequestFactory - the factory for making http requests
      mapContext - the map transformer
      context - the job ID
      layerContext - the context of this layer
    • loadImage

      protected abstract BufferedImage loadImage(MfClientHttpRequestFactory requestFactory, MapfishMapContext transformer) throws Exception
      Load the image at the requested size for the provided map bounds.
      Parameters:
      requestFactory - the factory to use for making http requests
      transformer - object containing map rendering information
      Throws:
      Exception
    • getStyleSupplier

      public StyleSupplier<org.geotools.coverage.grid.GridCoverage2D> getStyleSupplier()
    • createErrorImage

      protected BufferedImage createErrorImage(Rectangle area)
      Create an error image.
      Parameters:
      area - The size of the image
    • createTransparentImage

      protected BufferedImage createTransparentImage(Rectangle area)
      Create a transparent image.
      Parameters:
      area - The size of the image
    • fetchImage

      protected BufferedImage fetchImage(@Nonnull org.springframework.http.client.ClientHttpRequest request, @Nonnull MapfishMapContext transformer) throws IOException
      Fetch the given image from the web.
      Parameters:
      request - The request
      transformer - The transformer
      Returns:
      The image
      Throws:
      IOException