Class TLcdWCSProxy
- All Implemented Interfaces:
ILcdDataObject
,ILcdMultilevelRaster
,ILcdBounded
,ILcdCache
,ILcdCloneable
,ILcdDeepCloneable
,Cloneable
ILcdMultilevelRaster
, which fetches its data on the fly from a WCS which is
specified at construction time.
The bounds, resolution, tiling and multileveling of the raster can be
configured by the user at any time. Note, however, that changing any of
these parameters invalidates all data in the raster. By default,
sensible values for the tiled multilevel raster structure are determined
based on the WCS coverage bounds.
TLcdWCSProxy
cannot be instantiated directly. Use TLcdWCSProxyModelFactory
to create WCS proxy models.
If the setAsynchronousUpdates(boolean)
property is true,
TLcdWCSProxy
will perform requests to the WCS server on a separate thread.
This will in turn result in incremental updates of the view when the proxy
is painted, which improves the responsiveness of the application. Note,
however, that the property
TLcdMultilevelRasterPainter.setUseDeferredSubTileDecoding(boolean)
is best switched off in this case. If it is on, the raster painter may defer
the view update a second time, increasing the delay with which the coverage
data is actually shown.
This class also implements the imaging API using a has-an-image paradigm.
It is a TLcdDataObject
of a TLcdDataType
that has a TLcdHasGeometryAnnotation
.
You can get the ALcdImage
object using ALcdImage.fromDomainObject(Object)
where you pass an
instance of this class as argument.
Because an ALcdImage
represents read-only data, a new such object is created whenever a relevant
configuration parameter changes.
For example, when you set a different bounds on this proxy, a new ALcdImage
will be created.
You have to get the ALcdImage
again using ALcdImage.fromDomainObject(Object)
in order to get the
updated image.
References to outdated ALcdImage
s are still valid, but they will be outdated.
When using the imaging API, behavior is always synchronous and the configuration parameter
setAsynchronousUpdates(boolean)
is ignored.
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Enumeration class for defining the interpretation of the request bounds. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears the cache.Returns the 2D bounds of the area that is currently retrieved for the requested coverage.getCachedObject
(Object aKey) Looks up and returns the cached Object corresponding to the given key.Returns the 2D bounds of the available area for the requested coverage.Returns aTLcdWCSCoverageOffering
describing the requested coverage.Returns the current exception handler.Return the interpolation method with which the coverage is approximated.getRaster
(int aIndex) int
int
Return the number of tile columns in the most detailed raster.int
Returns the height of a single raster tile in pixels.int
Returns the width of a single raster tile in pixels.int
Return the number of tile rows in the most detailed raster.String[]
Returns the time instants used to request a subset of the specified coverage.String[][]
Returns the time intervals used to request a subset of the specified coverage.void
insertIntoCache
(Object aKey, Object aObject) Inserts a cache Object corresponding to the given key Object.void
Marks the raster as invalid, which will cause it to be reconstructed the next time it is accessed.boolean
Returns true if asynchronous updating is enabled.removeCachedObject
(Object aKey) Looks up and removes the cached Object corresponding to the given key.void
setAsynchronousUpdates
(boolean aAsynchronousUpdates) Specifies whether or not the WCS proxy should retrieve data asynchronously.void
setBounds
(ILcdBounds aBounds) Sets the 2D bounds of the area that should be retrieved.void
setBounds
(ILcdBounds aBounds, ILcdGeoReference aBoundsReference) Sets the 2D bounds of the area that should be retrieved.void
setBoundsType
(TLcdWCSProxy.BoundsType aBoundsType) Sets the interpretation of the request bounds (seesetBounds(com.luciad.shape.ILcdBounds)
andsetBounds(com.luciad.shape.ILcdBounds, com.luciad.reference.ILcdGeoReference)
).void
setErrorImage
(BufferedImage aErrorImage) Sets the image that is displayed when a WCS tile could not be retrieved due to an error.void
setExceptionHandler
(ILcdExceptionHandler aExceptionHandler) Sets an exception handler to use when exceptions occur while connecting to the WCS.void
setInterpolationMethod
(TLcdWCSInterpolationMethod aInterpolationMethod) Sets the interpolation method with which the coverage should be approximated.void
setPlaceholderImage
(BufferedImage aPlaceholderImage) Sets the image that is displayed while a WCS tile is being loaded.void
setRasterCount
(int aLevelCount) Sets the number of levels in the raster.void
setResolution
(double aResX, double aResY) Set the resolution of each single raster tile.void
setTileColumnCount
(int aTileColumnCount) Sets the number of tile columns that should be created for the most detailed raster.void
setTilePixelHeight
(int aTilePixelHeight) Sets the height of each single raster tile in pixels.void
setTilePixelWidth
(int aTilePixelWidth) Sets the width of each single raster tile in pixels.void
setTileRowCount
(int aTileRowCount) Sets the number of tile rows that should be created for the most detailed raster.void
setTimeInstants
(String[] aTimes) Sets one or more time instants to request a subset of the specified coverage.void
setTimeIntervals
(String[][] aTimeIntervals) Sets one or more time intervals to request a subset of the specified coverage.
-
Method Details
-
invalidate
public void invalidate()Marks the raster as invalid, which will cause it to be reconstructed the next time it is accessed. -
getCoverageOffering
Returns aTLcdWCSCoverageOffering
describing the requested coverage.- Returns:
- a
TLcdWCSCoverageOffering
describing the requested coverage.
-
getCoverageBounds
Returns the 2D bounds of the available area for the requested coverage.- Returns:
- the 2D bounds of the available area for the requested coverage.
-
getBounds
Returns the 2D bounds of the area that is currently retrieved for the requested coverage.- Specified by:
getBounds
in interfaceILcdBounded
- Returns:
- the 2D bounds of the area that is currently retrieved for the requested coverage.
-
insertIntoCache
Description copied from interface:ILcdCache
Inserts a cache Object corresponding to the given key Object.- Specified by:
insertIntoCache
in interfaceILcdCache
- Parameters:
aKey
- the key Object that will be used to identify the Object. The key must therefore be a unique identifier, typically the caller itself:insertIntoCache(this, ...)
.aObject
- the Object to be cached.
-
getCachedObject
Description copied from interface:ILcdCache
Looks up and returns the cached Object corresponding to the given key.- Specified by:
getCachedObject
in interfaceILcdCache
- Parameters:
aKey
- the key Object that was used for storing the cache Object.- Returns:
- the cached Object, or null if there is no Object corresponding to the given key.
-
removeCachedObject
Description copied from interface:ILcdCache
Looks up and removes the cached Object corresponding to the given key.- Specified by:
removeCachedObject
in interfaceILcdCache
- Parameters:
aKey
- the key Object that was used for storing the cache Object.- Returns:
- the cached Object, or null if there was no Object corresponding to the given key.
-
clearCache
public void clearCache()Description copied from interface:ILcdCache
Clears the cache.- Specified by:
clearCache
in interfaceILcdCache
-
getRasterCount
public int getRasterCount()- Specified by:
getRasterCount
in interfaceILcdMultilevelRaster
- Returns:
- the number of
ILcdRaster
objects in thisILcdMultilevelRaster
.
-
getRaster
- Specified by:
getRaster
in interfaceILcdMultilevelRaster
- Returns:
- the
ILcdRaster
at level aLevel.
-
setTileRowCount
public void setTileRowCount(int aTileRowCount) Sets the number of tile rows that should be created for the most detailed raster. Lower-level rasters may be given fewer tiles.- Parameters:
aTileRowCount
- the tile row count- Throws:
IllegalArgumentException
- if the given tile row count is negative or zero.
-
setTileColumnCount
public void setTileColumnCount(int aTileColumnCount) Sets the number of tile columns that should be created for the most detailed raster. Lower-level rasters may be given fewer tiles.- Parameters:
aTileColumnCount
- the tile column count- Throws:
IllegalArgumentException
- if the given tile column count is negative or zero.
-
setTilePixelWidth
public void setTilePixelWidth(int aTilePixelWidth) Sets the width of each single raster tile in pixels. If the tile resolution is specified, the tile width and height are ignored.- Parameters:
aTilePixelWidth
- the new tile width- Throws:
IllegalArgumentException
- if the given tile pixel width is negative or zero.- See Also:
-
setTilePixelHeight
public void setTilePixelHeight(int aTilePixelHeight) Sets the height of each single raster tile in pixels. If the tile resolution is specified, the tile width and height are ignored.- Parameters:
aTilePixelHeight
- the new tile height- Throws:
IllegalArgumentException
- if the given tile pixel height is negative or zero.- See Also:
-
setResolution
public void setResolution(double aResX, double aResY) Set the resolution of each single raster tile. If the tile resolution is specified, the tile width and height are ignored.- Parameters:
aResX
- resolution on the X-axisaResY
- resolution on the Y-axis- Throws:
IllegalArgumentException
- if one of the resolution is negative or zero.- See Also:
-
setBounds
Sets the 2D bounds of the area that should be retrieved. The bounds should be expressed in the reference of the enclosing proxy model. Ifnull
is supplied as bounds, the request bounds are reset to the coverage bounds (seegetCoverageBounds()
. By default, the bounds are equal to the coverage bounds.- Parameters:
aBounds
- the request bounds
-
setBounds
Sets the 2D bounds of the area that should be retrieved. The bounds should be expressed in the supplied reference. A best effort will be made to perform the coverage request using the given reference. Ifnull
is supplied as bounds, the request bounds are reset to the coverage bounds (seegetCoverageBounds()
. By default, the bounds are equal to the coverage bounds.- Parameters:
aBounds
- the request boundsaBoundsReference
- the reference of the request bounds
-
setBoundsType
Sets the interpretation of the request bounds (seesetBounds(com.luciad.shape.ILcdBounds)
andsetBounds(com.luciad.shape.ILcdBounds, com.luciad.reference.ILcdGeoReference)
). By default, the bounds type isTLcdWCSProxy.BoundsType.BOUNDS_2D
, indicating that the request bounds are interpreted as 2-dimensional bounds.- Parameters:
aBoundsType
- The interpretation of the request bounds- Throws:
NullPointerException
- if the bounds type isnull
-
setRasterCount
public void setRasterCount(int aLevelCount) Sets the number of levels in the raster. The highest level raster will have the resolution specified by the user. Lower raster levels will be constructed by decreasing the number of tiles and/or the resolution of the tiles.- Parameters:
aLevelCount
- the desired number of raster levels- Throws:
IllegalArgumentException
- if the given level count is negative or zero.
-
setTimeInstants
Sets one or more time instants to request a subset of the specified coverage. The time instants must be expressed in an (extended) ISO 8601 syntax.- Parameters:
aTimes
- time instants to request a subset of a coverage
-
setTimeIntervals
Sets one or more time intervals to request a subset of the specified coverage. The time instants must be expressed in an (extended) ISO 8601 syntax.- Parameters:
aTimeIntervals
- time intervals to request a subset of a coverage
-
setInterpolationMethod
Sets the interpolation method with which the coverage should be approximated.- Parameters:
aInterpolationMethod
- the interpolation method
-
getInterpolationMethod
Return the interpolation method with which the coverage is approximated.- Returns:
- the interpolation method
-
setPlaceholderImage
Sets the image that is displayed while a WCS tile is being loaded. By default these tiles are displayed transparent gray.- Parameters:
aPlaceholderImage
- the placeholder image
-
setErrorImage
Sets the image that is displayed when a WCS tile could not be retrieved due to an error. By default these tiles are displayed transparently- Parameters:
aErrorImage
- the error image
-
setExceptionHandler
Sets an exception handler to use when exceptions occur while connecting to the WCS. Exceptions may include service exceptions from the WCS itself, but also client-side exceptions that may occur if the response of the WCS cannot be properly decoded. If the exception handler is not set (or set to null), any exceptions will be silently ignored.- Parameters:
aExceptionHandler
- an exception handler
-
getTimeInstants
Returns the time instants used to request a subset of the specified coverage.- Returns:
- the time instants used to request a subset of the specified coverage.
- See Also:
-
getTimeIntervals
Returns the time intervals used to request a subset of the specified coverage.- Returns:
- the time intervals used to request a subset of the specified coverage.
- See Also:
-
getExceptionHandler
Returns the current exception handler.- Returns:
- the current exception handler.
-
setAsynchronousUpdates
public void setAsynchronousUpdates(boolean aAsynchronousUpdates) Specifies whether or not the WCS proxy should retrieve data asynchronously. If this property is set to true (the default value), the proxy will spread WCS requests out over multiple threads, allowing them to be processed simultaneously. Model changed events will be fired to notify the application when a tile in the raster has obtained all its data from the WCS.If this property is set to false, all updates to the WCS proxy will be performed synchronously on the calling thread.
- Parameters:
aAsynchronousUpdates
- true if asynchronous updating should be used
-
isAsynchronousUpdates
public boolean isAsynchronousUpdates()Returns true if asynchronous updating is enabled.- Returns:
- true if asynchronous updating is enabled
- See Also:
-
getTileRowCount
public int getTileRowCount()Return the number of tile rows in the most detailed raster. Lower-level rasters may be given fewer tiles.- Returns:
- the number of tile rows in the most detailed raster
- See Also:
-
getTileColumnCount
public int getTileColumnCount()Return the number of tile columns in the most detailed raster. Lower-level rasters may be given fewer tiles.- Returns:
- the number of tile columns in the most detailed raster
- See Also:
-
getTilePixelWidth
public int getTilePixelWidth()Returns the width of a single raster tile in pixels.- Returns:
- the width of a single raster tile in pixels
-
getTilePixelHeight
public int getTilePixelHeight()Returns the height of a single raster tile in pixels.- Returns:
- the height of a single raster tile in pixels
-