Package org.mapfish.print.map.tiled
Class TileCacheInformation
- java.lang.Object
-
- org.mapfish.print.map.tiled.TileCacheInformation
-
public abstract class TileCacheInformation extends java.lang.Object
Encapsulates the information needed to create tile requests for a particular map bounds and display.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
TileCacheInformation(MapBounds bounds, java.awt.Rectangle paintArea, double dpi, AbstractTiledLayerParams params)
Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.awt.image.BufferedImage
createBufferedImage(int imageWidth, int imageHeight)
Create a buffered image with the correct image bands etc...protected java.lang.String
createCommonUrl()
Create a URL that is common to all tiles for this layer.abstract java.lang.Double
getLayerDpi()
Get the DPI of the layer's images.org.locationtech.jts.geom.Coordinate
getMinGeoCoordinate(org.geotools.geometry.jts.ReferencedEnvelope envelope, org.locationtech.jts.geom.Coordinate geoTileSize)
Calculate the minx and miny coordinate of the tile that is the minx and miny tile.java.awt.image.BufferedImage
getMissingTileImage()
Return the image to draw in place of a tile that is missing.abstract double
getResolution()
Get the resolution that the layer uses for its calculations.int
getTileBufferHeight()
Obtain the buffer height for meta tiling.int
getTileBufferWidth()
Obtain the buffer width for meta tiling.protected abstract org.geotools.geometry.jts.ReferencedEnvelope
getTileCacheBounds()
Return the full bounds of the tileCache.abstract org.springframework.http.client.ClientHttpRequest
getTileRequest(MfClientHttpRequestFactory httpRequestFactory, java.lang.String commonUrl, org.geotools.geometry.jts.ReferencedEnvelope tileBounds, java.awt.Dimension tileSizeOnScreen, int column, int row)
Create the http request for loading the image at the indicated area and the indicated size.abstract java.awt.Dimension
getTileSize()
Obtain the image tile size of the tiles that will be loaded from the server.
-
-
-
Field Detail
-
bounds
protected final MapBounds bounds
the map bounds.
-
paintArea
protected final java.awt.Rectangle paintArea
the area to paint.
-
dpi
protected final double dpi
the DPI to render at.
-
-
Constructor Detail
-
TileCacheInformation
protected TileCacheInformation(MapBounds bounds, java.awt.Rectangle paintArea, double dpi, AbstractTiledLayerParams params)
Constructor.- Parameters:
bounds
- the map boundspaintArea
- the area to paintdpi
- the DPI to render atparams
- the params with the data for creating the layer.
-
-
Method Detail
-
getTileRequest
@Nonnull public abstract org.springframework.http.client.ClientHttpRequest getTileRequest(MfClientHttpRequestFactory httpRequestFactory, java.lang.String commonUrl, org.geotools.geometry.jts.ReferencedEnvelope tileBounds, java.awt.Dimension tileSizeOnScreen, int column, int row) throws java.lang.Exception
Create the http request for loading the image at the indicated area and the indicated size.- Parameters:
httpRequestFactory
- the factory to use for making http requestscommonUrl
- the uri that is common to all tiles. SeecreateCommonUrl()
tileBounds
- the bounds of the image in world coordinatestileSizeOnScreen
- the size of the tile on the screen or on the image.column
- the column index of the tile from the origin of the tile cache.row
- the row index of the tile from the origin of the tile cache.- Throws:
java.lang.Exception
-
getResolution
public abstract double getResolution()
Get the resolution that the layer uses for its calculations. The map isn't always at a resolution that a tiled layer supports so a scale is chosen for the layer that is close to the map scale. This method returns the layer's scale.This is used for calculating the bounds of tiles, the size number and indices of the tiles to be returned.
-
getLayerDpi
public abstract java.lang.Double getLayerDpi()
Get the DPI of the layer's images. The server renders at a certain DPI that may or may not be the same DPI that the map requires. Depending on the server and the protocol mapfish print might be able to request a certain DPI. But since that might not be the case, then the layer must be able to report the correct DPI.
-
getTileSize
public abstract java.awt.Dimension getTileSize()
Obtain the image tile size of the tiles that will be loaded from the server.
-
getTileBufferWidth
public int getTileBufferWidth()
Obtain the buffer width for meta tiling.
-
getTileBufferHeight
public int getTileBufferHeight()
Obtain the buffer height for meta tiling.
-
getTileCacheBounds
@Nonnull protected abstract org.geotools.geometry.jts.ReferencedEnvelope getTileCacheBounds()
Return the full bounds of the tileCache.
-
getMinGeoCoordinate
@Nonnull public org.locationtech.jts.geom.Coordinate getMinGeoCoordinate(org.geotools.geometry.jts.ReferencedEnvelope envelope, org.locationtech.jts.geom.Coordinate geoTileSize)
Calculate the minx and miny coordinate of the tile that is the minx and miny tile. It is the starting point of counting tiles to render.This equates to the minX and minY of the GridCoverage as well.
- Parameters:
envelope
- the area that will be displayed.geoTileSize
- the size of each tile in world space.
-
createBufferedImage
@Nonnull public java.awt.image.BufferedImage createBufferedImage(int imageWidth, int imageHeight)
Create a buffered image with the correct image bands etc... for the tiles being loaded.- Parameters:
imageWidth
- width of the image to createimageHeight
- height of the image to create.
-
createCommonUrl
protected java.lang.String createCommonUrl() throws java.net.URISyntaxException, java.io.UnsupportedEncodingException
Create a URL that is common to all tiles for this layer. It may have placeholder like ({matrixId}) if the layer desires. That is up to the layer implementation because the layer is responsible for taking the commonUrl and transforming it to a final tile URI.- Throws:
java.net.URISyntaxException
java.io.UnsupportedEncodingException
-
getMissingTileImage
@Nullable public java.awt.image.BufferedImage getMissingTileImage()
Return the image to draw in place of a tile that is missing.If this method returns null nothing will be drawn at the location of the missing image.
-
-