Class GridLayer
- java.lang.Object
-
- org.mapfish.print.map.geotools.grid.GridLayer
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.mapfish.print.attribute.map.MapLayer
MapLayer.RenderType
-
-
Constructor Summary
Constructors Constructor Description GridLayer(java.util.concurrent.ExecutorService executorService, FeatureSourceSupplier featureSourceSupplier, StyleSupplier<org.geotools.api.data.FeatureSource> styleSupplier, boolean renderAsSvg, GridParam params, org.mapfish.print.map.geotools.grid.LabelPositionCollector labels)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getImageBufferScaling()
Get the scale ratio between the tiles resolution and the target resolution.java.lang.String
getName()
The layer name.double
getOpacity()
Gets the opacity.MapLayer.RenderType
getRenderType()
Specify whether layer should be rendered as PNG, JPEG or SVG.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 graphics, 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.
-
-
-
Constructor Detail
-
GridLayer
public GridLayer(java.util.concurrent.ExecutorService executorService, FeatureSourceSupplier featureSourceSupplier, StyleSupplier<org.geotools.api.data.FeatureSource> styleSupplier, boolean renderAsSvg, GridParam params, org.mapfish.print.map.geotools.grid.LabelPositionCollector labels)
Constructor.- Parameters:
executorService
- the thread pool for doing the rendering.featureSourceSupplier
- a function that creates the feature source. This will only be called once.styleSupplier
- a function that creates the style for styling the features. This will only be called once.renderAsSvg
- is the layer rendered as SVG?params
- the parameters for this layerlabels
- the grid labels to render
-
-
Method Detail
-
tryAddLayer
public 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.
-
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.- Specified by:
getImageBufferScaling
in interfaceMapLayer
-
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 void render(java.awt.Graphics2D graphics, MfClientHttpRequestFactory clientHttpRequestFactory, MapfishMapContext transformer, Processor.ExecutionContext context)
Description copied from interface:MapLayer
Render the layer to the graphics2D object.
-
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 java.lang.String getName()
Description copied from interface:MapLayer
The layer name.
-
getRenderType
public MapLayer.RenderType getRenderType()
Description copied from interface:MapLayer
Specify whether layer should be rendered as PNG, JPEG or SVG.- Specified by:
getRenderType
in interfaceMapLayer
- Returns:
- render type
-
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
-
getOpacity
public double getOpacity()
Description copied from interface:MapLayer
Gets the opacity.- Specified by:
getOpacity
in interfaceMapLayer
- Returns:
- the opacity
-
-