public class TLcdHypsometricEarthPainter extends TLcdEarthGXYRasterPainter
defaultCreationFillStyle, defaultCreationLineStyle, defaultFillStyle, defaultLineStyle, fWorkBounds
BODY, CREATING, DEFAULT, HANDLES, RESHAPING, SELECTED, SNAPS, TRANSLATING
Constructor and Description |
---|
TLcdHypsometricEarthPainter(ILcdHypsometricTileFactory aTileFactory,
ILcdHypsometricValueProvider aHypsometricValueProvider,
int aUnknownValue)
Creates a new hypsometric earth painter with the given hypsometric tile factory.
|
TLcdHypsometricEarthPainter(TLcdHypsometricTileFactory aTileFactory)
Creates a new hypsometric earth painter with the given hypsometric tile factory.
|
Modifier and Type | Method and Description |
---|---|
protected TLcdEarthTileFormat |
chooseTileFormat(ILcdEarthTileSet aTileSet,
ILcdEarthTileSetCoverage aCoverage)
Chooses a tile format from the given tile set and coverage to be used for producing tiles.
|
protected ILcdEarthTileSet |
configureBaseTileSet(Object aObject,
ILcdEarthTileSet aTileSet)
Configures the base tile set.
|
protected ILcdTile |
createRasterTile(ALcdEarthTile aTile)
Creates an
ILcdTile corresponding to the specified ALcdEarthTile . |
protected ILcdTile |
getEmptyTile()
Returns a representative empty tile for this painter.
|
ILcdHypsometricValueProvider |
getHypsometricValueProvider()
Returns the hypsometric value provider
|
ILcdHypsometricTileFactory |
getTileFactory()
Gets the tile factory set on this hypsometric earth painter.
|
int |
getUnknownValue()
Returns the unknown value that is used when no result could be determined for the input data.
|
protected boolean |
isValidCoverage(ILcdEarthTileSetCoverage aCoverage)
Returns whether the given coverage can be drawn by this painter.
|
void |
paint(Graphics aGraphics,
int aMode,
ILcdGXYContext aContext)
Displays the representation of the object in the given mode on the Graphics passed, taking into account the
supplied context.
|
double |
retrieveCachedHypsometricValue(ILcdPoint aPoint,
ILcdEarthTileSet aTileset)
Retrieves a cached hypsometric value from this painter for a given point in model coordinates.
|
void |
setHypsometricValueProvider(ILcdHypsometricValueProvider aHypsometricValueProvider)
Sets the hypsometric value provider
|
void |
setTileFactory(ILcdHypsometricTileFactory aTileFactory)
Sets the tile factory set on this hypsometric earth painter.
|
void |
setUnknownValue(int aUnknownValue)
Sets the unknown value when no result could be determined for the input data.
|
addStatusListener, chooseTileSetCoverage, chooseTileSetLevel, clearCache, clearCache, clone, 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, releaseHardReferencedCache, releaseHardReferencedCache, removeStatusListener, setAllowOutdatedTiles, setAsynchronousTileRequestAllowed, setAutoIncreaseCacheSize, setBoundsFillStyle, setBoundsLineStyle, setBrightness, setCacheSize, setColorModel, setContrast, setExceptionHandler, setObject, setOversamplingRate, setPaintBoundsFill, setPaintBoundsOutline, setPaintCache, setParentTileRequestAllowed, setQuality, setRepaintViewWhenTileAvailable, setRGBImageFilter, setSoftCachingEnabled, setStartResolutionFactor, setTransparency, setUpdateInterval, setWarpBlockSize, updateTiles, updateTiles
boundsSFCT, getExceptionHandler, getObject, getTileSet, getTileSetCoverage, isAsynchronousTileRequestAllowed, isRepaintViewWhenTileAvailable, isTouched
addPropertyChangeListener, anchorPointSFCT, firePropertyChangeEvent, firePropertyChangeEvent, getCursor, getGXYPainter, isTraceOn, removePropertyChangeListener, setClassTraceOn, setDisplayName, setTraceOn, snapTarget, supportSnap
public TLcdHypsometricEarthPainter(ILcdHypsometricTileFactory aTileFactory, ILcdHypsometricValueProvider aHypsometricValueProvider, int aUnknownValue)
aTileFactory
- the hypsometric tile factory to use for creating hypsometric tiles based on an earth tileset.aHypsometricValueProvider
- The hypsometric value provider to use for calculating hypsometric values in an earth tilesetaUnknownValue
- The value to use when no value could be determined in the earth tileset.public TLcdHypsometricEarthPainter(TLcdHypsometricTileFactory aTileFactory)
TLcdHypsometricTileFactory
and is equivalent to calling:
new TLcdHypsometricEarthPainter( tileFactory, tileFactory.getHypsometricValueProvider(), tileFactory.getHypsometricColorModel(), tileFactory.getUnknownValue() )
aTileFactory
- the hypsometric tile factory to use for creating hypsometric tilesprotected ILcdTile getEmptyTile()
TLcdEarthGXYRasterPainter
getEmptyTile
in class TLcdEarthGXYRasterPainter
public ILcdHypsometricTileFactory getTileFactory()
public void setTileFactory(ILcdHypsometricTileFactory aTileFactory)
aTileFactory
- the hypsometric tile factory on this earth painterpublic ILcdHypsometricValueProvider getHypsometricValueProvider()
public void setHypsometricValueProvider(ILcdHypsometricValueProvider aHypsometricValueProvider)
aHypsometricValueProvider
- a hypsometric value providerpublic int getUnknownValue()
public void setUnknownValue(int aUnknownValue)
aUnknownValue
- the unknown valuepublic void paint(Graphics aGraphics, int aMode, ILcdGXYContext aContext)
ILcdGXYPainter
The visual representation of an object depends on the context. Depending on the context (e.g. is the location covered by the view), an object may or may not have a representation. The context contains:
The mode passed in this method indicates what part of the object must be painted, whether it should be painted as selected or not, and whether user interaction (via mouse movements) must be taken into account.
When the mode passed contains either TRANSLATING, RESHAPING or CREATING, this method is also responsible for
interpreting interaction on the representation of an object and modifying the representation of the object
accordingly. The painter is not responsible for modifying the object itself, this is done by
a corresponding ILcdGXYEditor
.
Implementations of ILcdGXYPainter
and ILcdGXYEditor
interfaces must be consistent for
an object: the painter must display the result of the user interaction on the object, while the editor is
responsible for modifying the object as a result of the user interaction.
A good practice to ensure a consistent implementation is to implement both the ILcdGXYPainter
and ILcdGXYEditor
interfaces in a single class.
When the mode passed includes SNAPS, the part of the representation which corresponds to the object returned as
snap target by the method snapTarget
must be painted in order to provide the user with a visual indication of the snap target.
The Graphics passed in this method can be different from the Graphics returned by a view due to techniques such as double buffering (as applied in Swing). Basic drawing operations must always be performed on the Graphics passed as an argument in this method.
paint
in interface ILcdGXYPainter
paint
in class TLcdEarthGXYRasterPainter
aGraphics
- the Graphics on which the representation of the object is paintedaMode
- the mode the object is represented in (see class documentation).aContext
- the ILcdGXYContext
the drawing depends on.protected ILcdEarthTileSet configureBaseTileSet(Object aObject, ILcdEarthTileSet aTileSet)
TLcdEarthGXYRasterPainter
configureBaseTileSet
in class TLcdEarthGXYRasterPainter
aObject
- the object being paintedaTileSet
- the base tile setTLcdEarthGXYRasterPainter.chooseTileSetCoverage(com.luciad.earth.tileset.ILcdEarthTileSet)
,
TLcdEarthGXYRasterPainter.getTileSet(Object)
public double retrieveCachedHypsometricValue(ILcdPoint aPoint, ILcdEarthTileSet aTileset)
aPoint
- The point for which to retrieve the value in model coordinates. The reference of this point
should be the same as the earth tileset.aTileset
- the tileset for which to retrieve the value. This tileset needs to be an element
of the model that is being painted. ( In other words "ILcdModel.elements()" should contain
the given aTileset ). It is the same tileset that is set on this painter when
TLcdEarthGXYRasterPainter.setObject(Object)
is called before a paint operation.The unknown value:
This value will be returned if the
given point is out of bounds, the given point is not in the painted (cached) region of
the painter, or if the tileset does not contain elevation data in the given point.
protected boolean isValidCoverage(ILcdEarthTileSetCoverage aCoverage)
TLcdEarthGXYRasterPainter
TLcdEarthGXYRasterPainter.createRasterTile(com.luciad.earth.tileset.ALcdEarthTile)
.
The default implementation returns true
if the coverage is a raster coverage
and the tiles set supports a format with RenderedImage
as format class
and no format name with the specified coverage.isValidCoverage
in class TLcdEarthGXYRasterPainter
aCoverage
- the candidate coveragetrue
if the given coverage can be paintedILcdEarthRasterTileSetCoverage
,
ILcdEarthTileSet.isFormatSupported(com.luciad.earth.tileset.ILcdEarthTileSetCoverage,
com.luciad.earth.tileset.TLcdEarthTileFormat)
protected TLcdEarthTileFormat chooseTileFormat(ILcdEarthTileSet aTileSet, ILcdEarthTileSetCoverage aCoverage)
TLcdEarthGXYRasterPainter
TLcdEarthGXYRasterPainter.createRasterTile(com.luciad.earth.tileset.ALcdEarthTile)
.
The default implementation returns a format with RenderedImage
as format
class and no format name.chooseTileFormat
in class TLcdEarthGXYRasterPainter
aTileSet
- the tile set whose tiles are being paintedaCoverage
- the coverage whose tiles are being painted.protected ILcdTile createRasterTile(ALcdEarthTile aTile)
TLcdEarthGXYRasterPainter
ILcdTile
corresponding to the specified ALcdEarthTile
. The resulting raster tile is used in order to draw the
output of a tile set using TLcdRasterPainter
.
The default implementation can only create a tile for tiles with a RenderedImage
as tile data.createRasterTile
in class TLcdEarthGXYRasterPainter
aTile
- the tile to convert into a raster tile