Class TLcdEarthGXYViewTileSet

java.lang.Object
com.luciad.earth.tileset.ALcdEarthTileSet
com.luciad.earth.tileset.raster.TLcdEarthGXYViewTileSet
All Implemented Interfaces:
ILcdEarthTileSet, ILcdBounded, ILcdDisposable, ILcdLayered, Serializable, AutoCloseable

public class TLcdEarthGXYViewTileSet extends ALcdEarthTileSet implements ILcdLayered
A tileset that generates texture data using an offscreen 2D view.

This tileset can for example be used to generate the terrain textures on-the-fly. Noteworthy configuration:

This tileset is thread-safe for tile reading.

The produceTile(com.luciad.earth.tileset.ILcdEarthTileSetCoverage, int, long, long, com.luciad.reference.ILcdGeoReference, com.luciad.earth.tileset.TLcdEarthTileFormat, com.luciad.earth.tileset.TLcdEarthTileOperationMode, com.luciad.earth.tileset.ILcdEarthTileSetCallback, java.lang.Object) and ALcdEarthTileSet.updateTile(com.luciad.earth.tileset.ALcdEarthTile, com.luciad.earth.tileset.TLcdEarthTileOperationMode, com.luciad.earth.tileset.ILcdEarthTileSetCallback, java.lang.Object) methods generate a TLcdEarthGXYViewTileSet.PaintException when an error occurs while painting a layer for a tile. It its thrown directly be thrown by the synchronous methods or passed on the callback for asynchronous methods.

Since:
8.2
See Also:
  • Constructor Details

    • TLcdEarthGXYViewTileSet

      public TLcdEarthGXYViewTileSet(ILcdBounds aBounds, int aLevels, int aTileResolution)
      Creates a gxy view tileset.
      Parameters:
      aBounds - The geodetic bounds of the tileset.
      aLevels - The number of tile levels.
      aTileResolution - The resolution of a single tile.
    • TLcdEarthGXYViewTileSet

      public TLcdEarthGXYViewTileSet(ILcdBounds aBounds, int aLevels, long aLevel0Rows, long aLevel0Columns, int aTileResolution)
      Creates a gxy view tileset.
      Parameters:
      aBounds - The geodetic bounds of the tileset.
      aLevels - The number of tile levels.
      aLevel0Rows - The number of tile rows at level 0.
      aLevel0Columns - The number of tile columns at level 0.
      aTileResolution - The resolution of a single tile.
      See Also:
    • TLcdEarthGXYViewTileSet

      public TLcdEarthGXYViewTileSet(ILcdBounds aBounds, int aLevels, long aLevel0Rows, long aLevel0Columns, int aTileResolution, ILcdGeoReference aModelReference)
      Creates a gxy view tileset.
      Parameters:
      aBounds - The bounds of the tileset in the model reference.
      aLevels - The number of tile levels.
      aLevel0Rows - The number of tile rows at level 0.
      aLevel0Columns - The number of tile columns at level 0.
      aTileResolution - The resolution of a single tile.
      aModelReference - The reference in which the tile set's bounds and tile pyramid are defined
      See Also:
    • TLcdEarthGXYViewTileSet

      public TLcdEarthGXYViewTileSet(ILcdBounds aBounds, int aLevels, long aLevel0Rows, long aLevel0Columns, int aTileWidth, int aTileHeight, ILcdGeoReference aModelReference)
      Creates a gxy view tileset.
      Parameters:
      aBounds - The bounds of the tileset in the model reference.
      aLevels - The number of tile levels.
      aLevel0Rows - The number of tile rows at level 0.
      aLevel0Columns - The number of tile columns at level 0.
      aTileWidth - The width in pixels of a single tile.
      aTileHeight - The height in pixels of a single tile.
      aModelReference - The reference in which the tile set's bounds and tile pyramid are defined
      See Also:
  • Method Details

    • getImageCoverage

      public ILcdEarthRasterTileSetCoverage getImageCoverage()
      Returns the coverage with the painted layers.
      Returns:
      the image coverage.
    • produceTile

      public void produceTile(ILcdEarthTileSetCoverage aCoverage, int aLevel, long aTileX, long aTileY, ILcdGeoReference aGeoReference, TLcdEarthTileFormat aFormat, TLcdEarthTileOperationMode aMode, ILcdEarthTileSetCallback aCallback, Object aContext)
      Description copied from interface: ILcdEarthTileSet
      Produces the requested tile, and invoke the supplied callback when done. The resulting tile is passed to the call back's tileAvailable() method. If the tile cannot be produced for some reason, the method tileNotAvailable() should be called instead.

      If the tileset supports it and aMode is TLcdEarthTileOperationMode.PREFER_ASYNCHRONOUS, the tile request may be executed asynchronously. However, the callback must be invoked at some point in time, unless the cancelTile() method is used to cancel the tile request before it is executed. If aMode is TLcdEarthTileOperationMode.FORCE_SYNCHRONOUS, the request must be executed synchronously and the callback must be invoked before produceTile() returns.

      Tiles may be requested in reference systems other than the native geo reference of the underlying data, provided that the isGeoReferenceSupported() method returns true for the requested reference. If this is not the case, the tileset should call tileNotAvailable(). If the tileset calls tileAvailable(), the geo reference of the resulting tile must be equal to aGeoReference, and the tile's bounds must likewise be expressed in this reference.

      Similarly, tiles may be requested in different data formats, as described by TLcdEarthTileFormat. The format determines the type of the data object that will be contained in the requested tile. To check if a format is supported, use isFormatSupported(). If the specified format is not supported, the tileset should call tileNotAvailable().

      The context parameter may be used to pass application-specific data into the tileset. If it is not needed, its value may be null.

      Specified by:
      produceTile in interface ILcdEarthTileSet
      Parameters:
      aCoverage - the coverage from which the tile is requested
      aLevel - the level from which the tile is requested
      aTileX - the column index of the requested tile
      aTileY - the row index of the requested tile
      aGeoReference - the reference system in which the tile should be returned
      aFormat - the desired format of the tile's data
      aMode - controls the synchronous or asynchronous behaviour of the tileset
      aCallback - will be invoked when the tile is available to be used
      aContext - application-specific data to be used by the tileset, if any
    • containsTile

      public boolean containsTile(ILcdEarthTileSetCoverage aCoverage, int aLevel, long aX, long aY, Object aContext)
      Description copied from interface: ILcdEarthTileSet
      Returns true if the repository contains the specified tile.
      Specified by:
      containsTile in interface ILcdEarthTileSet
      Overrides:
      containsTile in class ALcdEarthTileSet
      Parameters:
      aCoverage - the coverage from which to query a tile
      aLevel - the detail level for which to query a tile
      aX - the column index at which to query a tile
      aY - the row index at which to query a tile
      aContext - application-specific data to be used by the tileset, if any
      Returns:
      true if the repository contains the requested tile
    • dispose

      public void dispose()
      Description copied from interface: ILcdEarthTileSet
      This method releases all resources held by the repository, such as file locks, threads or server connections.
      Specified by:
      dispose in interface ILcdDisposable
      Specified by:
      dispose in interface ILcdEarthTileSet
      Overrides:
      dispose in class ALcdEarthTileSet
    • getBounds

      public ILcdBounds getBounds()
      Description copied from interface: ILcdEarthTileSet
      Returns the bounds of this tile set, expressed in the model reference of the model that contains this tile set.
      Specified by:
      getBounds in interface ILcdBounded
      Specified by:
      getBounds in interface ILcdEarthTileSet
      Returns:
      the bounds of this tile set
      See Also:
    • getTileSetCoverageCount

      public int getTileSetCoverageCount()
      Description copied from interface: ILcdEarthTileSet
      Returns the number of coverages this tileset contains.
      Specified by:
      getTileSetCoverageCount in interface ILcdEarthTileSet
      Returns:
      the number of coverages this tileset contains
    • getTileSetCoverage

      public ILcdEarthTileSetCoverage getTileSetCoverage(int aIndex)
      Description copied from interface: ILcdEarthTileSet
      Returns the coverage at the specified index.
      Specified by:
      getTileSetCoverage in interface ILcdEarthTileSet
      Parameters:
      aIndex - the index of the coverage to return
      Returns:
      the requested ILcdEarthTileSetCoverage
    • isGeoReferenceSupported

      public boolean isGeoReferenceSupported(ILcdEarthTileSetCoverage aCoverage, ILcdGeoReference aGeoReference)
      Description copied from class: ALcdEarthTileSet
      Returns true only for the coverage's native georeference.
      Specified by:
      isGeoReferenceSupported in interface ILcdEarthTileSet
      Overrides:
      isGeoReferenceSupported in class ALcdEarthTileSet
      Parameters:
      aCoverage - the coverage to check for
      aGeoReference - the reference to check for
      Returns:
      true if the given coverage can be queried with the given reference
    • getOverSamplingFactor

      public int getOverSamplingFactor()
      Returns the current oversampling factor for the produced images.
      Returns:
      An oversampling factor.
      See Also:
    • setOverSamplingFactor

      public void setOverSamplingFactor(int aOverSamplingFactor)
      Sets the oversampling factor for the produced images. A higher oversampling factor reduces the amount of aliasing in the images at the cost of performance. An oversampling factor N results in N2 samples for each pixel, so it should always be >=1.
      Parameters:
      aOverSamplingFactor - The new oversampling factor.
    • setImageType

      public void setImageType(int aImageType)
      Sets the image type used for the produced images.

      For transparent data you should set it to BufferedImage.TYPE_INT_ARGB.

      Parameters:
      aImageType - A valid image type.
      See Also:
    • getImageType

      public int getImageType()
      Returns the image type used for the produced images.
      Returns:
      The current image type.
      See Also:
    • setBackgroundColor

      public void setBackgroundColor(Color aColor)
      Sets the background color for the produced tiles.

      For transparent background you should also configure a proper tile image type.

      Parameters:
      aColor - A background color.
      See Also:
    • getBackgroundColor

      public Color getBackgroundColor()
      Returns the background color for the produced tiles.
      Returns:
      The current background color.
    • isAntiAliased

      public boolean isAntiAliased()
      Specifies if anti-aliasing is enabled or not. Anti-aliasing makes lines and text appear smoother, but slows down rendering a little bit. If this property is false, it does not mean anti-aliasing is fully disabled. It only means anti-aliasing is not enabled on the view level, various layers and painters may still decide to enable anti-aliasing for what they render.
      Returns:
      true if anti-aliasing is enabled, false otherwise.
      Since:
      2018.0
    • setAntiAliased

      public void setAntiAliased(boolean aAntiAliased)
      Changes the anti-aliasing behavior. Please refer to isAntiAliased() for more information.
      Parameters:
      aAntiAliased - true to enable anti-aliasing, false to let layers and painters decide.
      Since:
      2018.0
    • addLayeredListener

      public void addLayeredListener(ILcdLayeredListener aILcdLayeredListener)
      Description copied from interface: ILcdLayered

      Registers the given ILcdLayeredListener to be notified when layers are added, removed or moved.

      In case you need to register a listener which keeps a reference to an object with a shorter life-time than this layered, you can use a ALcdWeakLayeredListener instance as layered listener.

      Specified by:
      addLayeredListener in interface ILcdLayered
      Parameters:
      aILcdLayeredListener - the listener that from now on will be notified of all changes to the ILcdLayered
      See Also:
    • removeLayeredListener

      public void removeLayeredListener(ILcdLayeredListener aILcdLayeredListener)
      Description copied from interface: ILcdLayered
      Unregisters the given ILcdLayeredListener from receiving layered events for the ILcdLayered.
      Specified by:
      removeLayeredListener in interface ILcdLayered
      Parameters:
      aILcdLayeredListener - the listener that will no longer be notified of changes to the ILcdLayered
      See Also:
    • getLayer

      public ILcdLayer getLayer(int i) throws ArrayIndexOutOfBoundsException
      Description copied from interface: ILcdLayered
      Returns the ILcdLayer in this ILcdLayered with index aIndex.
      Specified by:
      getLayer in interface ILcdLayered
      Parameters:
      i - the position of the layer to retrieve in the ILcdLayered.
      Returns:
      the ILcdLayer in this ILcdLayered with index aIndex.
      Throws:
      ArrayIndexOutOfBoundsException - if the given index is invalid
    • addGXYLayer

      public void addGXYLayer(ILcdGXYLayer aGXYLayer)
      Adds a GXY layer to this tile set. Its contents will be rendered into the tiles.

      Make sure to disable all asynchronous behavior of the layer. Most notably:

      Parameters:
      aGXYLayer - the GXY layer
    • getGXYLayer

      public ILcdGXYLayer getGXYLayer(int aIndex)
    • layerCount

      public int layerCount()
      Description copied from interface: ILcdLayered
      Returns the number of ILcdLayer objects in this ILcdLayered.
      Specified by:
      layerCount in interface ILcdLayered
      Returns:
      the number of ILcdLayer objects in this ILcdLayered.
    • layers

      public Enumeration layers()
      Description copied from interface: ILcdLayered
      Returns an Enumeration of all ILcdLayer objects currently in this ILcdLayered, starting from the bottom layer to the top layer.
      Specified by:
      layers in interface ILcdLayered
      Returns:
      an Enumeration of all ILcdLayer objects currently in this ILcdLayered, starting from the bottom layer to the top layer.
    • layersBackwards

      public Enumeration layersBackwards()
      Description copied from interface: ILcdLayered
      Returns an Enumeration of all ILcdLayer objects currently in this ILcdLayered, starting from the top layer to the bottom layer.
      Specified by:
      layersBackwards in interface ILcdLayered
      Returns:
      an Enumeration of all ILcdLayer objects currently in this ILcdLayered, starting from the top layer to the bottom layer.
    • layerOf

      public ILcdLayer layerOf(ILcdModel aModel) throws NoSuchElementException
      Description copied from interface: ILcdLayered
      Returns the ILcdLayer of this ILcdLayered that contains the given ILcdModel.
      Specified by:
      layerOf in interface ILcdLayered
      Parameters:
      aModel - the model to check for in this ILcdLayered.
      Returns:
      the ILcdLayer of this ILcdLayered that contains the given ILcdModel.
      Throws:
      NoSuchElementException - if there is no layer containing the given model
    • indexOf

      public int indexOf(ILcdLayer aLayer) throws NoSuchElementException
      Description copied from interface: ILcdLayered
      Returns the index if the given layer is in the list.
      Specified by:
      indexOf in interface ILcdLayered
      Parameters:
      aLayer - the layer whose index to return
      Returns:
      the index of aLayer
      Throws:
      NoSuchElementException - if aLayer is not in the list
    • moveLayerAt

      public void moveLayerAt(int i, ILcdLayer aILcdLayer) throws NoSuchElementException, ArrayIndexOutOfBoundsException
      Description copied from interface: ILcdLayered
      Moves the given layer (which is already in ILcdLayered) to the existing index aIndex. When a layer is moved down, all layers in between the previous and future position of the given layer (including the layer at index aIndex) are moved one position up. When a layer is moved up, all layers in between the previous and future position of the given layer (including the layer at index aIndex) are moved one position down.

      More formally, let previousIndex be the index of aLayer before the move. If previousIndex < aIndex, then the index of all ILcdLayer objects in from previousIndex + 1 to aIndex is decremented with 1. If previousIndex > aIndex, then the index of all ILcdLayer objects in from aIndex to previousIndex -1 is incremented with 1.

      Specified by:
      moveLayerAt in interface ILcdLayered
      Parameters:
      i - the index of the position where to move the layer.
      aILcdLayer - the layer to move.
      Throws:
      NoSuchElementException - if aLayer is not in this ILcdLayered.
      ArrayIndexOutOfBoundsException - if aIndex is not an index of one of the layers of this ILcdLayered.
    • removeLayer

      public void removeLayer(ILcdLayer aILcdLayer) throws NoSuchElementException
      Description copied from interface: ILcdLayered
      Removes aLayer from this ILcdLayered.
      Specified by:
      removeLayer in interface ILcdLayered
      Parameters:
      aILcdLayer - the layer to remove.
      Throws:
      NoSuchElementException
    • removeAllLayers

      public void removeAllLayers()
      Description copied from interface: ILcdLayered
      Removes all the ILcdLayer objects from this ILcdLayered.
      Specified by:
      removeAllLayers in interface ILcdLayered
    • containsLayer

      public boolean containsLayer(ILcdLayer aILcdLayer)
      Description copied from interface: ILcdLayered
      Returns whether this ILcdLayered contains the given layer. More formally, returns true if and only if the ILcdLayered contains at least one layer l such that (aLayer==null ? l==null : aLayer.equals(l)).
      Specified by:
      containsLayer in interface ILcdLayered
      Parameters:
      aILcdLayer - the layer to check whether it is in this layered.
      Returns:
      true if aLayer is in this ILcdLayered, false otherwise.