Package com.luciad.earth.view.gxy
Class TLcdEarthGXYSinglevaluedRasterPainter
java.lang.Object
com.luciad.view.gxy.ALcdGXYPainter
com.luciad.earth.view.gxy.ALcdEarthGXYPainter
com.luciad.earth.view.gxy.TLcdEarthGXYRasterPainter
com.luciad.earth.view.gxy.TLcdEarthGXYSinglevaluedRasterPainter
- All Implemented Interfaces:
ILcdCloneable
,ILcdPropertyChangeSource
,ILcdStatusSource
,ILcdGXYPainter
,ILcdGXYPainterProvider
,Serializable
,Cloneable
- Direct Known Subclasses:
TLcdEarthGXYElevationRasterPainter
This
ILcdGXYPainter
can paint the scalar data of ILcdEarthTileSet
instances in a 2D view.
This painter has been replaced by TLcdGXYImagePainter
. Please consider using it
instead of this one.
Supported objects
This painter can visualize anyILcdEarthTileSet
that can produce tiles with a TLcdEarthMultivaluedData
as the tile data. Note that only the first parameter of this data is visualized. The first such
coverage in the tileset will be used (see TLcdEarthGXYRasterPainter.chooseTileSetCoverage(com.luciad.earth.tileset.ILcdEarthTileSet)
).
Visualization
To visualize the scalar data, each value is firstconverted to a short
which is then mapped to a color using the color model
. No color model is set by default.
By default the tile level is chosen such that 4 pixels in the view map to at least one value, if
possible. This avoids most pixelation effects (e.g. that individual pixels are visible). To achieve
this a tile level is chosen with a higher pixel density
than the
view. This behavior can be changed by either setting the quality
or by overriding the TLcdEarthGXYRasterPainter.chooseTileSetLevel(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext, com.luciad.shape.ILcdBounds)
method.
If some tiles are not available, the tiles at lower levels will be used automatically to avoid
gaps.
If required this painter will warp the data between different coordinate systems, otherwise it
will just paint their linearly scaled images.
The bounds of the tile set will be painted instead of the tiles if the pixel density of the least
detailed level is too high
. There is no limit on the pixel
density by default so the bounds of a tile set will never be painted unless the start resolution
factor is set to a lower value. Typically this is fine for tile sets that cover the entire world
but it may be necessary to lower the start resolution factor if there are multiple smaller tile
sets in a view.
Incremental visualization
If the tileset supports asynchronous tile production, the visualization can be done incrementally. This means that the tiles will be requested asynchronously and the view will be repainted as the tiles become available. To enable this theALcdEarthGXYPainter.isAsynchronousTileRequestAllowed()
and ALcdEarthGXYPainter.isRepaintViewWhenTileAvailable()
should be
set to true
(default).
Caching
By default only the tiles necessary for the view will be cached using hard references (seeTLcdEarthGXYRasterPainter.setCacheSize(int)
). Other tiles will also be cached if there is enough
memory (see TLcdEarthGXYRasterPainter.isSoftCachingEnabled()
). Tiles that reside in either of these caches will be
updated automatically every minute (see TLcdEarthGXYRasterPainter.getUpdateInterval()
). You can use the TLcdEarthGXYRasterPainter.updateTiles(com.luciad.view.gxy.ILcdGXYView)
method to update all tiles that are currently
cached immediately.
Performance considerations
- To achieve optimal performance the reference of the tileset and the world reference should match. If this is not the case the raster data will need to be warped on-the-fly.
- When incremental visualization is enabled other layers may also be repainted more frequently. This could result in reduced performance if this takes too much time.
- When incremental visualization is enabled in combination with asynchronous
painting it may sometimes take a significant amount of time before a paint is completed. More
specifically this situation occurs if the painting is interrupted before it can finish due to a
repaint for tile that has just become available. To avoid this you can disable the interruption
of paints (see
TLcdGXYAsynchronousPaintQueue.setInterruptPainting(boolean)
)
- Since:
- 10.1
- See Also:
-
Field Summary
Fields inherited from class com.luciad.view.gxy.ALcdGXYPainter
defaultCreationFillStyle, defaultCreationLineStyle, defaultFillStyle, defaultLineStyle, fWorkBounds
Fields inherited from interface com.luciad.view.gxy.ILcdGXYPainter
BODY, CREATING, DEFAULT, HANDLES, RESHAPING, SELECTED, SNAPS, TRANSLATING
-
Constructor Summary
ConstructorDescriptionCreates a new earth 2D scalar raster painter with the default cache size.TLcdEarthGXYSinglevaluedRasterPainter
(int aCacheSize) Creates a new earth 2D scalar raster painter with the specified cache size. -
Method Summary
Modifier and TypeMethodDescriptionprotected TLcdEarthTileFormat
chooseTileFormat
(ILcdEarthTileSet aTileSet, ILcdEarthTileSetCoverage aCoverage) Chooses a tile format from the given tileset and coverage to be used for producing tiles.protected short
convertToShort
(double aValue) Converts a native value to a short.protected ILcdTile
createRasterTile
(ALcdEarthTile aTile) Creates anILcdTile
corresponding to the specifiedALcdEarthTile
.int
Gets the value in the color model that is used for unknown values.protected ILcdTile
Returns a representative empty tile for this painter.int[]
Gets the range of values in the color model that is used for valid values.double
Returns the offset that is applied to the values when they are converted to shorts.double
Returns the scale that is applied to the values when they are converted to shorts.protected boolean
isValidCoverage
(ILcdEarthTileSetCoverage aCoverage) Returns whether the given coverage can be drawn by this painter.void
setDefaultValue
(int aDefaultValue) Sets the value in the color model that is used for unknown values.void
setQuality
(double aQuality) The default value is0.25
.void
setValueRange
(int aMin, int aMax) Sets the range of values in the color model that is used for valid values.void
setValueToShortOffset
(double aOffset) Sets the offset that is applied to the values when they are converted to shorts.void
setValueToShortScale
(double aScale) Sets the scale that is applied to the values when they are converted to shorts.Methods inherited from class com.luciad.earth.view.gxy.TLcdEarthGXYRasterPainter
addStatusListener, chooseTileSetCoverage, chooseTileSetLevel, clearCache, clearCache, clone, configureBaseTileSet, createAsynchronousTileSet, getBoundsFillStyle, getBoundsLineStyle, getBrightness, getCacheSize, getColorModel, getContrast, getDisplayName, getOversamplingRate, getPaintCache, getPixelDensity, getQuality, getRequestFormat, getRGBImageFilter, getStartResolutionFactor, getTileContext, getTileSet, getTransparency, getUpdateInterval, getWarpBlockSize, isAllowOutdatedTiles, isAutoIncreaseCacheSize, isPaintBoundsFill, isPaintBoundsOutline, isParentTileRequestAllowed, isSoftCachingEnabled, paint, releaseHardReferencedCache, releaseHardReferencedCache, removeStatusListener, setAllowOutdatedTiles, setAsynchronousTileRequestAllowed, setAutoIncreaseCacheSize, setBoundsFillStyle, setBoundsLineStyle, setBrightness, setCacheSize, setColorModel, setContrast, setExceptionHandler, setObject, setOversamplingRate, setPaintBoundsFill, setPaintBoundsOutline, setPaintCache, setParentTileRequestAllowed, setRepaintViewWhenTileAvailable, setRGBImageFilter, setSoftCachingEnabled, setStartResolutionFactor, setTransparency, setUpdateInterval, setWarpBlockSize, updateTiles, updateTiles
Methods inherited from class com.luciad.earth.view.gxy.ALcdEarthGXYPainter
boundsSFCT, getExceptionHandler, getObject, getTileSet, getTileSetCoverage, isAsynchronousTileRequestAllowed, isRepaintViewWhenTileAvailable, isTouched
Methods inherited from class com.luciad.view.gxy.ALcdGXYPainter
addPropertyChangeListener, anchorPointSFCT, firePropertyChangeEvent, firePropertyChangeEvent, getCursor, getGXYPainter, isTraceOn, removePropertyChangeListener, setClassTraceOn, setDisplayName, setTraceOn, snapTarget, supportSnap
-
Constructor Details
-
TLcdEarthGXYSinglevaluedRasterPainter
public TLcdEarthGXYSinglevaluedRasterPainter()Creates a new earth 2D scalar raster painter with the default cache size. Note that a color model must be set before this painter can be used.- See Also:
-
TLcdEarthGXYSinglevaluedRasterPainter
public TLcdEarthGXYSinglevaluedRasterPainter(int aCacheSize) Creates a new earth 2D scalar raster painter with the specified cache size. Note that a color model must be set before this painter can be used.- Parameters:
aCacheSize
- the maximum number of entries in the cache- See Also:
-
-
Method Details
-
getDefaultValue
public int getDefaultValue()Gets the value in the color model that is used for unknown values. The initial default value is0
.- Returns:
- the color model value used for unknown values
- See Also:
-
setDefaultValue
public void setDefaultValue(int aDefaultValue) Sets the value in the color model that is used for unknown values. Only the first lower 16 bits of the specified value are used.- Parameters:
aDefaultValue
- the default value- See Also:
-
setValueRange
public void setValueRange(int aMin, int aMax) Sets the range of values in the color model that is used for valid values. Only the first lower 16 bits of the specified value are used.- Parameters:
aMin
- the inclusive lower boundaMax
- the inclusive upper bound- See Also:
-
getValueRange
public int[] getValueRange()Gets the range of values in the color model that is used for valid values. When converting model values to the color model, the converted values will be bounded by this range.- Returns:
- the inclusive lower and upper bounds
-
setQuality
public void setQuality(double aQuality) The default value is0.25
.- Overrides:
setQuality
in classTLcdEarthGXYRasterPainter
- Parameters:
aQuality
- the new quality
-
isValidCoverage
Returns whether the given coverage can be drawn by this painter. The returned coverage should support a format that can be handled bycreateRasterTile(com.luciad.earth.tileset.ALcdEarthTile)
. The default implementation returnstrue
if the coverage implementsILcdEarthRasterTileSetCoverage
, and the tileset supports a format withTLcdEarthMultivaluedData
as format class and no format name with the specified coverage.- Overrides:
isValidCoverage
in classTLcdEarthGXYRasterPainter
- Parameters:
aCoverage
- the candidate coverage- Returns:
true
if the given coverage can be painted- See Also:
-
chooseTileFormat
protected TLcdEarthTileFormat chooseTileFormat(ILcdEarthTileSet aTileSet, ILcdEarthTileSetCoverage aCoverage) Chooses a tile format from the given tileset and coverage to be used for producing tiles. The format should be supported bycreateRasterTile(com.luciad.earth.tileset.ALcdEarthTile)
. The default implementation returns a format withTLcdEarthMultivaluedData
as format class and no format name.- Overrides:
chooseTileFormat
in classTLcdEarthGXYRasterPainter
- Parameters:
aTileSet
- the tileset whose tiles are being paintedaCoverage
- the coverage whose tiles are being painted.- Returns:
- the format in which tiles should be obtained
-
createRasterTile
Creates anILcdTile
corresponding to the specifiedALcdEarthTile
. The resulting raster tile is used in order to draw the output of a tileset usingTLcdRasterPainter
. The default implementation can only create a tile for tiles with aTLcdEarthMultivaluedData
as tile data. Each value in the first dimension of this data is converted to a short usingconvertToShort(double)
.- Overrides:
createRasterTile
in classTLcdEarthGXYRasterPainter
- Parameters:
aTile
- the tile to convert into a raster tile- Returns:
- a raster tile
-
getValueToShortOffset
public double getValueToShortOffset()Returns the offset that is applied to the values when they are converted to shorts. The default value is0
.- Returns:
- the offset
- See Also:
-
setValueToShortOffset
public void setValueToShortOffset(double aOffset) Sets the offset that is applied to the values when they are converted to shorts.- Parameters:
aOffset
- the offset- See Also:
-
getValueToShortScale
public double getValueToShortScale()Returns the scale that is applied to the values when they are converted to shorts. The default value is1
.- Returns:
- the scale
- See Also:
-
setValueToShortScale
public void setValueToShortScale(double aScale) Sets the scale that is applied to the values when they are converted to shorts.- Parameters:
aScale
- the scale- See Also:
-
convertToShort
protected short convertToShort(double aValue) Converts a native value to a short. The default implementation returns the default value if the given value is Double.NaN. Otherwise the given value is first transformedtransformedValue = offset + value * scale;
and then rounded to the nearest integer value and clamped the result to the valid range of a short. Typically the offset and scale are chosen in such a way that they map the expected value range to the range of a short minus one (ex. [Short.MIN_VALUE
,Short.MAX_VALUE
- 1]). This last value can then be used as thedefault value
.- Parameters:
aValue
- a value- Returns:
- A short representing the value
- See Also:
-
getEmptyTile
Description copied from class:TLcdEarthGXYRasterPainter
Returns a representative empty tile for this painter. For example, the tile's default value may be used when painting missing data.- Overrides:
getEmptyTile
in classTLcdEarthGXYRasterPainter
- Returns:
- an empty tile.
-