Package org.mapfish.print.map.geotools
Class AbstractGeotoolsLayer
- java.lang.Object
-
- org.mapfish.print.map.geotools.AbstractGeotoolsLayer
-
- All Implemented Interfaces:
MapLayer
- Direct Known Subclasses:
AbstractFeatureSourceLayer
,AbstractGridCoverage2DReaderLayer
,AbstractSingleImageLayer
,AbstractTiledLayer
public abstract class AbstractGeotoolsLayer extends java.lang.Object implements MapLayer
The AbstractGeotoolsLayer class.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.mapfish.print.attribute.map.MapLayer
MapLayer.RenderType
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractGeotoolsLayer(java.util.concurrent.ExecutorService executorService, AbstractLayerParams params)
Constructor.protected
AbstractGeotoolsLayer(AbstractGeotoolsLayer other)
Copy constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
getFailOnError()
protected abstract java.util.List<? extends org.geotools.map.Layer>
getLayers(MfClientHttpRequestFactory httpRequestFactory, MapfishMapContext transformer, Processor.ExecutionContext context)
Get theDataStore
object that contains the data for this layer.protected MapfishMapContext
getLayerTransformer(MapfishMapContext transformer)
If the layer transformer has not been prepared yet, do it.java.lang.String
getName()
The layer name.double
getOpacity()
Gets the opacity.void
prefetchResources(HttpRequestFetcher httpRequestFetcher, MfClientHttpRequestFactory clientHttpRequestFactory, MapfishMapContext transformer, Processor.ExecutionContext context)
Cache any needed resources on disk.void
prepareRender(MapfishMapContext transformer, MfClientHttpRequestFactory clientHttpRequestFactory)
Render the layer to the graphics2D object.void
render(java.awt.Graphics2D graphics2D, MfClientHttpRequestFactory clientHttpRequestFactory, MapfishMapContext transformer, Processor.ExecutionContext context)
Render the layer to the graphics2D object.boolean
supportsNativeRotation()
Indicate if the layer supports native rotation (e.g.java.util.Optional<MapLayer>
tryAddLayer(MapLayer newLayer)
Attempt to add the layer this layer so that both can be rendered as a single layer.-
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
getImageBufferScaling, getRenderType
-
-
-
-
Constructor Detail
-
AbstractGeotoolsLayer
protected AbstractGeotoolsLayer(java.util.concurrent.ExecutorService executorService, AbstractLayerParams params)
Constructor.- Parameters:
executorService
- the thread pool for doing the rendering.params
- the parameters for this layer
-
AbstractGeotoolsLayer
protected AbstractGeotoolsLayer(AbstractGeotoolsLayer other)
Copy constructor.- Parameters:
other
- The source.
-
-
Method Detail
-
tryAddLayer
public final java.util.Optional<MapLayer> tryAddLayer(MapLayer newLayer)
Description copied from interface:MapLayer
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.
- Specified by:
tryAddLayer
in interfaceMapLayer
- 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
public void prepareRender(MapfishMapContext transformer, MfClientHttpRequestFactory clientHttpRequestFactory)
Description copied from interface:MapLayer
Render the layer to the graphics2D object.- Specified by:
prepareRender
in interfaceMapLayer
- Parameters:
transformer
- the map transformer containing the map bounds and size.clientHttpRequestFactory
- the factory to use for making http requests.
-
render
public final void render(java.awt.Graphics2D graphics2D, MfClientHttpRequestFactory clientHttpRequestFactory, MapfishMapContext transformer, Processor.ExecutionContext context)
Description copied from interface:MapLayer
Render the layer to the graphics2D object.
-
getOpacity
public double getOpacity()
Description copied from interface:MapLayer
Gets the opacity.- Specified by:
getOpacity
in interfaceMapLayer
- Returns:
- the opacity
-
getLayers
protected abstract java.util.List<? extends org.geotools.map.Layer> getLayers(MfClientHttpRequestFactory httpRequestFactory, MapfishMapContext transformer, Processor.ExecutionContext context) throws java.lang.Exception
Get theDataStore
object that contains the data for this layer.- Parameters:
httpRequestFactory
- the factory for making http requeststransformer
- the map transformercontext
- the job ID- Throws:
java.lang.Exception
-
supportsNativeRotation
public boolean supportsNativeRotation()
Description copied from interface:MapLayer
Indicate if the layer supports native rotation (e.g. WMS layers with the "angle" parameter).- Specified by:
supportsNativeRotation
in interfaceMapLayer
- Returns:
- True if the layer itself takes care of rotating.
-
getName
public final java.lang.String getName()
Description copied from interface:MapLayer
The layer name.
-
getFailOnError
public final boolean getFailOnError()
-
getLayerTransformer
protected final MapfishMapContext getLayerTransformer(MapfishMapContext transformer)
If the layer transformer has not been prepared yet, do it.- Parameters:
transformer
- the transformer
-
prefetchResources
public void prefetchResources(HttpRequestFetcher httpRequestFetcher, MfClientHttpRequestFactory clientHttpRequestFactory, MapfishMapContext transformer, Processor.ExecutionContext context)
Description copied from interface:MapLayer
Cache any needed resources on disk.- Specified by:
prefetchResources
in interfaceMapLayer
- Parameters:
httpRequestFetcher
- TODOclientHttpRequestFactory
- client http request factorytransformer
- transformercontext
- the job ID
-
-