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.

public abstract class TileInformation<T extends AbstractTiledLayerParams> extends Object
Encapsulates the information needed to create tile requests for a particular map bounds and display.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final MapBounds
    the map bounds.
    protected final double
    the DPI to render at.
    protected final Rectangle
    the area to paint.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    TileInformation(MapBounds bounds, Rectangle paintArea, double dpi, T params)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    createBufferedImage(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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • bounds

      protected final MapBounds bounds
      the map bounds.
    • paintArea

      protected final Rectangle paintArea
      the area to paint.
    • dpi

      protected final double dpi
      the DPI to render at.
  • Constructor Details

    • TileInformation

      protected TileInformation(MapBounds bounds, Rectangle paintArea, double dpi, T params)
      Constructor.
      Parameters:
      bounds - the map bounds
      paintArea - the area to paint
      dpi - the DPI to render at
      params - 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 requests
      commonUrl - the uri that is common to all tiles. See createCommonUrl()
      tileBounds - the bounds of the image in world coordinates
      tileSizeOnScreen - 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

      public abstract 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 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.
    • 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

      @Nonnull public 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 create
      imageHeight - height of the image to create.
    • createCommonUrl

      protected String createCommonUrl() throws URISyntaxException, 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:
      URISyntaxException
      UnsupportedEncodingException
    • getMissingTileImage

      @Nullable public 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.

    • getParams

      protected final T getParams()
    • getImageBufferScaling

      protected abstract double getImageBufferScaling()
      Return the scaling for this tileInformation.
      Returns:
      the aspect ratio