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
public abstract class AbstractSingleImageLayer extends AbstractGeotoolsLayer
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.RenderType
-
-
Field Summary
Fields Modifier and Type Field Description protected Configuration
configuration
The configuration.protected com.codahale.metrics.MetricRegistry
registry
The metrics object.
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractSingleImageLayer(java.util.concurrent.ExecutorService executorService, StyleSupplier<org.geotools.coverage.grid.GridCoverage2D> styleSupplier, AbstractLayerParams params, com.codahale.metrics.MetricRegistry registry, Configuration configuration)
Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected java.awt.image.BufferedImage
createErrorImage(java.awt.Rectangle area)
Create an error image.protected java.awt.image.BufferedImage
fetchImage(org.springframework.http.client.ClientHttpRequest request, MapfishMapContext transformer)
Fetch the given image from the web.double
getImageBufferScaling()
Get the scale ratio between the tiles resolution and the target resolution.protected java.util.List<? extends org.geotools.map.Layer>
getLayers(MfClientHttpRequestFactory httpRequestFactory, MapfishMapContext mapContext, Processor.ExecutionContext context)
Get theDataStore
object that contains the data for this layer.StyleSupplier<org.geotools.coverage.grid.GridCoverage2D>
getStyleSupplier()
protected abstract java.awt.image.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, prepareRender, 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
-
-
-
-
Field Detail
-
registry
@Nonnull protected final com.codahale.metrics.MetricRegistry registry
The metrics object.
-
configuration
protected final Configuration configuration
The configuration.
-
-
Constructor Detail
-
AbstractSingleImageLayer
protected AbstractSingleImageLayer(java.util.concurrent.ExecutorService executorService, StyleSupplier<org.geotools.coverage.grid.GridCoverage2D> styleSupplier, AbstractLayerParams params, 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 Detail
-
getLayers
protected final java.util.List<? extends org.geotools.map.Layer> getLayers(MfClientHttpRequestFactory httpRequestFactory, MapfishMapContext mapContext, Processor.ExecutionContext context)
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 ID
-
loadImage
protected abstract java.awt.image.BufferedImage loadImage(MfClientHttpRequestFactory requestFactory, MapfishMapContext transformer) throws java.lang.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:
java.lang.Exception
-
getImageBufferScaling
public double getImageBufferScaling()
Description copied from interface:MapLayer
Get the scale ratio between the tiles resolution and the target resolution. Used to don't scale the tiles on tiled layer.
-
getStyleSupplier
public StyleSupplier<org.geotools.coverage.grid.GridCoverage2D> getStyleSupplier()
-
createErrorImage
protected java.awt.image.BufferedImage createErrorImage(java.awt.Rectangle area)
Create an error image.- Parameters:
area
- The size of the image
-
fetchImage
protected java.awt.image.BufferedImage fetchImage(@Nonnull org.springframework.http.client.ClientHttpRequest request, @Nonnull MapfishMapContext transformer) throws java.io.IOException
Fetch the given image from the web.- Parameters:
request
- The requesttransformer
- The transformer- Returns:
- The image
- Throws:
java.io.IOException
-
-