Package org.mapfish.print.map.tiled
Class TileInformation<T extends AbstractTiledLayerParams>
java.lang.Object
org.mapfish.print.map.tiled.TileInformation<T>
- Type Parameters:
T
- Type of the params associated to this Tile.
Encapsulates the information needed to create tile requests for a particular map bounds and
display.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
TileInformation
(MapBounds bounds, Rectangle paintArea, double dpi, T params) Constructor. -
Method Summary
Modifier and TypeMethodDescriptioncreateBufferedImage
(int imageWidth, int imageHeight) Create a buffered image with the correct image bands etc...protected String
Create a URL that is common to all tiles for this layer.protected abstract double
Return the scaling for this tileInformation.abstract Double
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.Return the image to draw in place of a tile that is missing.protected final T
abstract double
Get the resolution that the layer uses for its calculations.protected abstract org.geotools.geometry.jts.ReferencedEnvelope
Return the full bounds of the tile.int
Obtain the buffer height for meta tiling.int
Obtain the buffer width for meta tiling.abstract org.springframework.http.client.ClientHttpRequest
getTileRequest
(MfClientHttpRequestFactory httpRequestFactory, String commonUrl, org.geotools.geometry.jts.ReferencedEnvelope tileBounds, Dimension tileSizeOnScreen, int column, int row) Create the http request for loading the image at the indicated area and the indicated size.abstract Dimension
Obtain the image tile size of the tiles that will be loaded from the server.
-
Field Details
-
bounds
the map bounds. -
paintArea
the area to paint. -
dpi
protected final double dpithe DPI to render at.
-
-
Constructor Details
-
TileInformation
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 Details
-
getTileRequest
@Nonnull public abstract org.springframework.http.client.ClientHttpRequest getTileRequest(MfClientHttpRequestFactory httpRequestFactory, String commonUrl, org.geotools.geometry.jts.ReferencedEnvelope tileBounds, Dimension tileSizeOnScreen, int column, int row) throws 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.row
- the row index of the tile from the origin of the tile.- Throws:
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
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
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. -
getTileBounds
@Nonnull protected abstract org.geotools.geometry.jts.ReferencedEnvelope getTileBounds()Return the full bounds of the tile. -
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
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
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. -
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.
-
getParams
-
getImageBufferScaling
protected abstract double getImageBufferScaling()Return the scaling for this tileInformation.- Returns:
- the aspect ratio
-