Class TLcdEarthGXYViewTileSet
- All Implemented Interfaces:
ILcdEarthTileSet
,ILcdBounded
,ILcdDisposable
,ILcdLayered
,Serializable
,AutoCloseable
- add data through
GXY layers
, but make sure they have no asynchronous behavior - for transparent data configure both the
background color
and thetile image type
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:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
An exception that happened during the painting of a layer. -
Constructor Summary
ConstructorDescriptionTLcdEarthGXYViewTileSet
(ILcdBounds aBounds, int aLevels, int aTileResolution) Creates a gxy view tileset.TLcdEarthGXYViewTileSet
(ILcdBounds aBounds, int aLevels, long aLevel0Rows, long aLevel0Columns, int aTileResolution) Creates a gxy view tileset.TLcdEarthGXYViewTileSet
(ILcdBounds aBounds, int aLevels, long aLevel0Rows, long aLevel0Columns, int aTileWidth, int aTileHeight, ILcdGeoReference aModelReference) Creates a gxy view tileset.TLcdEarthGXYViewTileSet
(ILcdBounds aBounds, int aLevels, long aLevel0Rows, long aLevel0Columns, int aTileResolution, ILcdGeoReference aModelReference) Creates a gxy view tileset. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addGXYLayer
(ILcdGXYLayer aGXYLayer) Adds a GXY layer to this tile set.void
addLayeredListener
(ILcdLayeredListener aILcdLayeredListener) Registers the givenILcdLayeredListener
to be notified when layers are added, removed or moved.boolean
containsLayer
(ILcdLayer aILcdLayer) Returns whether thisILcdLayered
contains the given layer.boolean
containsTile
(ILcdEarthTileSetCoverage aCoverage, int aLevel, long aX, long aY, Object aContext) Returns true if the repository contains the specified tile.void
dispose()
This method releases all resources held by the repository, such as file locks, threads or server connections.Returns the background color for the produced tiles.Returns the bounds of this tile set, expressed in the model reference of the model that contains this tile set.getGXYLayer
(int aIndex) Returns the coverage with the painted layers.int
Returns the image type used for the produced images.getLayer
(int i) Returns theILcdLayer
in thisILcdLayered
with indexaIndex
.int
Returns the current oversampling factor for the produced images.getTileSetCoverage
(int aIndex) Returns the coverage at the specified index.int
Returns the number of coverages this tileset contains.int
Returns the index if the given layer is in the list.boolean
Specifies if anti-aliasing is enabled or not.boolean
isGeoReferenceSupported
(ILcdEarthTileSetCoverage aCoverage, ILcdGeoReference aGeoReference) Returns true only for the coverage's native georeference.int
Returns the number ofILcdLayer
objects in thisILcdLayered
.Returns theILcdLayer
of thisILcdLayered
that contains the givenILcdModel
.layers()
Returns anEnumeration
of allILcdLayer
objects currently in thisILcdLayered
, starting from the bottom layer to the top layer.Returns anEnumeration
of allILcdLayer
objects currently in thisILcdLayered
, starting from the top layer to the bottom layer.void
moveLayerAt
(int i, ILcdLayer aILcdLayer) Moves the given layer (which is already inILcdLayered
) to the existing index aIndex.void
produceTile
(ILcdEarthTileSetCoverage aCoverage, int aLevel, long aTileX, long aTileY, ILcdGeoReference aGeoReference, TLcdEarthTileFormat aFormat, TLcdEarthTileOperationMode aMode, ILcdEarthTileSetCallback aCallback, Object aContext) Produces the requested tile, and invoke the supplied callback when done.void
Removes all theILcdLayer
objects from thisILcdLayered
.void
removeLayer
(ILcdLayer aILcdLayer) Removes aLayer from thisILcdLayered
.void
removeLayeredListener
(ILcdLayeredListener aILcdLayeredListener) Unregisters the givenILcdLayeredListener
from receiving layered events for theILcdLayered
.void
setAntiAliased
(boolean aAntiAliased) Changes the anti-aliasing behavior.void
setBackgroundColor
(Color aColor) Sets the background color for the produced tiles.void
setImageType
(int aImageType) Sets the image type used for the produced images.void
setOverSamplingFactor
(int aOverSamplingFactor) Sets the oversampling factor for the produced images.Methods inherited from class com.luciad.earth.tileset.ALcdEarthTileSet
cancelTile, containsTileSetCoverage, getLevelCount, getTileBoundsSFCT, getTileColumnCount, getTileRowCount, getTileSetCoverage, isFormatSupported, produceTile, updateTile, updateTile
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.luciad.util.ILcdDisposable
close
Methods inherited from interface com.luciad.view.ILcdLayered
addLayeredListener, getLayers, removeLayeredListener
-
Constructor Details
-
TLcdEarthGXYViewTileSet
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
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'stileAvailable()
method. If the tile cannot be produced for some reason, the methodtileNotAvailable()
should be called instead.If the tileset supports it and
aMode
isTLcdEarthTileOperationMode.PREFER_ASYNCHRONOUS
, the tile request may be executed asynchronously. However, the callback must be invoked at some point in time, unless thecancelTile()
method is used to cancel the tile request before it is executed. IfaMode
isTLcdEarthTileOperationMode.FORCE_SYNCHRONOUS
, the request must be executed synchronously and the callback must be invoked beforeproduceTile()
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 calltileNotAvailable()
. If the tileset callstileAvailable()
, the geo reference of the resulting tile must be equal toaGeoReference
, 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, useisFormatSupported()
. If the specified format is not supported, the tileset should calltileNotAvailable()
.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 interfaceILcdEarthTileSet
- Parameters:
aCoverage
- the coverage from which the tile is requestedaLevel
- the level from which the tile is requestedaTileX
- the column index of the requested tileaTileY
- the row index of the requested tileaGeoReference
- the reference system in which the tile should be returnedaFormat
- the desired format of the tile's dataaMode
- controls the synchronous or asynchronous behaviour of the tilesetaCallback
- will be invoked when the tile is available to be usedaContext
- 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 interfaceILcdEarthTileSet
- Overrides:
containsTile
in classALcdEarthTileSet
- Parameters:
aCoverage
- the coverage from which to query a tileaLevel
- the detail level for which to query a tileaX
- the column index at which to query a tileaY
- the row index at which to query a tileaContext
- 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 interfaceILcdDisposable
- Specified by:
dispose
in interfaceILcdEarthTileSet
- Overrides:
dispose
in classALcdEarthTileSet
-
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 interfaceILcdBounded
- Specified by:
getBounds
in interfaceILcdEarthTileSet
- 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 interfaceILcdEarthTileSet
- Returns:
- the number of coverages this tileset contains
-
getTileSetCoverage
Description copied from interface:ILcdEarthTileSet
Returns the coverage at the specified index.- Specified by:
getTileSetCoverage
in interfaceILcdEarthTileSet
- 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 interfaceILcdEarthTileSet
- Overrides:
isGeoReferenceSupported
in classALcdEarthTileSet
- Parameters:
aCoverage
- the coverage to check foraGeoReference
- 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 factorN
results inN
2
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 toBufferedImage.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
Sets the background color for the produced tiles. For transparent background you should also configure a propertile image type
.- Parameters:
aColor
- A background color.- See Also:
-
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 isfalse
, 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 toisAntiAliased()
for more information.- Parameters:
aAntiAliased
-true
to enable anti-aliasing,false
to let layers and painters decide.- Since:
- 2018.0
-
addLayeredListener
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 interfaceILcdLayered
- Parameters:
aILcdLayeredListener
- the listener that from now on will be notified of all changes to theILcdLayered
- See Also:
-
removeLayeredListener
Description copied from interface:ILcdLayered
Unregisters the givenILcdLayeredListener
from receiving layered events for theILcdLayered
.- Specified by:
removeLayeredListener
in interfaceILcdLayered
- Parameters:
aILcdLayeredListener
- the listener that will no longer be notified of changes to theILcdLayered
- See Also:
-
getLayer
Description copied from interface:ILcdLayered
Returns theILcdLayer
in thisILcdLayered
with indexaIndex
.- Specified by:
getLayer
in interfaceILcdLayered
- Parameters:
i
- the position of the layer to retrieve in theILcdLayered
.- Returns:
- the
ILcdLayer
in thisILcdLayered
with indexaIndex
. - Throws:
ArrayIndexOutOfBoundsException
- if the given index is invalid
-
addGXYLayer
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:TLcdGXYImagePainter
andTLcdEarthGXYRasterPainter
should haveasynchronousTileRequestAllowed
andrepaintViewWhenTileAvailable
set tofalse
- do not use
ILcdGXYAsynchronousLayerWrapper
or disable its asynchronous behavior
- Parameters:
aGXYLayer
- the GXY layer
-
getGXYLayer
-
layerCount
public int layerCount()Description copied from interface:ILcdLayered
Returns the number ofILcdLayer
objects in thisILcdLayered
.- Specified by:
layerCount
in interfaceILcdLayered
- Returns:
- the number of
ILcdLayer
objects in thisILcdLayered
.
-
layers
Description copied from interface:ILcdLayered
Returns anEnumeration
of allILcdLayer
objects currently in thisILcdLayered
, starting from the bottom layer to the top layer.- Specified by:
layers
in interfaceILcdLayered
- Returns:
- an
Enumeration
of allILcdLayer
objects currently in thisILcdLayered
, starting from the bottom layer to the top layer.
-
layersBackwards
Description copied from interface:ILcdLayered
Returns anEnumeration
of allILcdLayer
objects currently in thisILcdLayered
, starting from the top layer to the bottom layer.- Specified by:
layersBackwards
in interfaceILcdLayered
- Returns:
- an
Enumeration
of allILcdLayer
objects currently in thisILcdLayered
, starting from the top layer to the bottom layer.
-
layerOf
Description copied from interface:ILcdLayered
Returns theILcdLayer
of thisILcdLayered
that contains the givenILcdModel
.- Specified by:
layerOf
in interfaceILcdLayered
- Parameters:
aModel
- the model to check for in thisILcdLayered
.- Returns:
- the
ILcdLayer
of thisILcdLayered
that contains the givenILcdModel
. - Throws:
NoSuchElementException
- if there is no layer containing the given model
-
indexOf
Description copied from interface:ILcdLayered
Returns the index if the given layer is in the list.- Specified by:
indexOf
in interfaceILcdLayered
- Parameters:
aLayer
- the layer whose index to return- Returns:
- the index of
aLayer
- Throws:
NoSuchElementException
- ifaLayer
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 inILcdLayered
) 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 allILcdLayer
objects in from previousIndex + 1 to aIndex is decremented with 1. If previousIndex > aIndex, then the index of allILcdLayer
objects in from aIndex to previousIndex -1 is incremented with 1.- Specified by:
moveLayerAt
in interfaceILcdLayered
- Parameters:
i
- the index of the position where to move the layer.aILcdLayer
- the layer to move.- Throws:
NoSuchElementException
- ifaLayer
is not in thisILcdLayered
.ArrayIndexOutOfBoundsException
- ifaIndex
is not an index of one of the layers of thisILcdLayered
.
-
removeLayer
Description copied from interface:ILcdLayered
Removes aLayer from thisILcdLayered
.- Specified by:
removeLayer
in interfaceILcdLayered
- Parameters:
aILcdLayer
- the layer to remove.- Throws:
NoSuchElementException
-
removeAllLayers
public void removeAllLayers()Description copied from interface:ILcdLayered
Removes all theILcdLayer
objects from thisILcdLayered
.- Specified by:
removeAllLayers
in interfaceILcdLayered
-
containsLayer
Description copied from interface:ILcdLayered
Returns whether thisILcdLayered
contains the given layer. More formally, returnstrue
if and only if theILcdLayered
contains at least one layerl
such that (aLayer==null ? l==null : aLayer.equals(l)).- Specified by:
containsLayer
in interfaceILcdLayered
- Parameters:
aILcdLayer
- the layer to check whether it is in this layered.- Returns:
- true if
aLayer
is in thisILcdLayered
, false otherwise.
-