Package org.mapfish.print.map.image
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
Common implementation for layers that are represented as a single grid coverage image.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.mapfish.print.attribute.map.MapLayer
MapLayer.LayerContext, MapLayer.RenderType
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Configuration
The configuration.protected final com.codahale.metrics.MetricRegistry
The metrics object.Fields inherited from interface org.mapfish.print.attribute.map.MapLayer
DEFAULT_SCALING
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractSingleImageLayer
(ExecutorService executorService, StyleSupplier<org.geotools.coverage.grid.GridCoverage2D> styleSupplier, AbstractLayerParams params, com.codahale.metrics.MetricRegistry registry, Configuration configuration) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected BufferedImage
createErrorImage
(Rectangle area) Create an error image.protected BufferedImage
fetchImage
(org.springframework.http.client.ClientHttpRequest request, MapfishMapContext transformer) Fetch the given image from the web.protected final List<? extends org.geotools.map.Layer>
getLayers
(MfClientHttpRequestFactory httpRequestFactory, MapfishMapContext mapContext, Processor.ExecutionContext context, MapLayer.LayerContext layerContext) Get theDataStore
object that contains the data for this layer.StyleSupplier<org.geotools.coverage.grid.GridCoverage2D>
protected abstract BufferedImage
loadImage
(MfClientHttpRequestFactory requestFactory, MapfishMapContext transformer) Load the image at the requested size for the provided map bounds.Methods inherited from class org.mapfish.print.map.geotools.AbstractGeotoolsLayer
getFailOnError, getLayerTransformer, getName, getOpacity, prefetchResources, prepareLayerRendering, render, supportsNativeRotation, tryAddLayer
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.mapfish.print.attribute.map.MapLayer
getRenderType, prepareRender
-
Field Details
-
registry
@Nonnull protected final com.codahale.metrics.MetricRegistry registryThe metrics object. -
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 layerregistry
- 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 theDataStore
object that contains the data for this layer.- Specified by:
getLayers
in classAbstractGeotoolsLayer
- Parameters:
httpRequestFactory
- the factory for making http requestsmapContext
- the map transformercontext
- the job IDlayerContext
- 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 requeststransformer
- object containing map rendering information- Throws:
Exception
-
getStyleSupplier
-
createErrorImage
Create an error 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 requesttransformer
- The transformer- Returns:
- The image
- Throws:
IOException
-