public class TLcdEarthGXYVectorPainter extends ALcdEarthGXYPainter
ILcdGXYPainter
can paint the vector data of ILcdEarthTileSet
instances in a 2D view.
ILcdEarthTileSet
that can produce
tiles with an array as the tile data, assuming that the data painter can paint the array elements.
The first such coverage in the tileset will be used (see chooseTileSetCoverage(com.luciad.earth.tileset.ILcdEarthTileSet)
).
getLodStrategy()
. By default a TLcdEarthGXYPointDensityLodStrategy
is used.
If some tiles are not available, the tiles at lower levels will be used automatically to avoid
gaps. However because a tile at level i+1
covers the same area as 4 tiles at level
i
, a tile may or may not be painted if one of the tiles in its 2x2 block with the same
parent at the previous level is not available. In general a tileset should make sure that either
no tiles or all tiles in such a block are available to ensure all its tiles can be painted.
The actual painting of the tile data elements is delegated to the tile data painter
.defaultCreationFillStyle, defaultCreationLineStyle, defaultFillStyle, defaultLineStyle, fWorkBounds
BODY, CREATING, DEFAULT, HANDLES, RESHAPING, SELECTED, SNAPS, TRANSLATING
Constructor and Description |
---|
TLcdEarthGXYVectorPainter(ILcdGXYPainter aTileDataPainter)
Creates a new 2D Painter that delegates painting of the tile data to the given painter.
|
TLcdEarthGXYVectorPainter(ILcdGXYPainter aTileDataPainter,
ILcdEarthGXYLodSelectionStrategy aLodStrategy)
Creates a new 2D Painter that delegates painting of the tile data to the given painter.
|
TLcdEarthGXYVectorPainter(ILcdGXYPainter aTileDataPainter,
ILcdEarthGXYLodSelectionStrategy aLodStrategy,
int aCacheSize)
Creates a new 2D Painter with the specified cache size, which delegates painting of the tile
data to the given painter.
|
Modifier and Type | Method and Description |
---|---|
protected ILcdEarthTileSetCoverage |
chooseTileSetCoverage(ILcdEarthTileSet aTileSet)
Chooses a coverage in a tile set.
|
void |
clearCache()
Clears the cache.
|
Object |
clone()
Makes
Object.clone() public. |
String |
getDisplayName()
Returns the display name of this
ILcdGXYPainter . |
ILcdEarthGXYLodSelectionStrategy |
getLodStrategy()
Returns the current LOD strategy.
|
ILcdGXYPainter |
getTileDataPainter()
Returns the current gxy painter for the tile data.
|
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.
|
void |
setCacheSize(int aCacheSize)
Sets the size of the cache (in #tiles).
|
void |
setLodStrategy(ILcdEarthGXYLodSelectionStrategy aLodStrategy)
Sets the LOD strategy.
|
void |
setTileDataPainter(ILcdGXYPainter aDelegate)
Sets the gxy painter for the tile data.
|
boundsSFCT, getCacheSize, getExceptionHandler, getObject, getTileSet, getTileSet, getTileSetCoverage, isAsynchronousTileRequestAllowed, isRepaintViewWhenTileAvailable, isTouched, setAsynchronousTileRequestAllowed, setExceptionHandler, setObject, setRepaintViewWhenTileAvailable
addPropertyChangeListener, anchorPointSFCT, firePropertyChangeEvent, firePropertyChangeEvent, getCursor, getGXYPainter, isTraceOn, removePropertyChangeListener, setClassTraceOn, setDisplayName, setTraceOn, snapTarget, supportSnap
public TLcdEarthGXYVectorPainter(ILcdGXYPainter aTileDataPainter)
aTileDataPainter
- The painter to delegate the painting of the tile data to.public TLcdEarthGXYVectorPainter(ILcdGXYPainter aTileDataPainter, ILcdEarthGXYLodSelectionStrategy aLodStrategy)
aTileDataPainter
- The painter to delegate the painting of the tile data to.aLodStrategy
- The strategy to use for selecting a LOD.public TLcdEarthGXYVectorPainter(ILcdGXYPainter aTileDataPainter, ILcdEarthGXYLodSelectionStrategy aLodStrategy, int aCacheSize)
aTileDataPainter
- The painter to delegate the painting of the tile data to.aLodStrategy
- The strategy to use for selecting a LOD.aCacheSize
- The number of entries in the tile cache.public ILcdGXYPainter getTileDataPainter()
public void setTileDataPainter(ILcdGXYPainter aDelegate)
aDelegate
- The new gxy painter.public ILcdEarthGXYLodSelectionStrategy getLodStrategy()
public void setLodStrategy(ILcdEarthGXYLodSelectionStrategy aLodStrategy)
aLodStrategy
- The new gxy LOD strategy.public void setCacheSize(int aCacheSize)
ALcdEarthGXYPainter
setCacheSize
in class ALcdEarthGXYPainter
aCacheSize
- the new cache sizepublic void clearCache()
ALcdEarthGXYPainter
clearCache
in class ALcdEarthGXYPainter
protected ILcdEarthTileSetCoverage chooseTileSetCoverage(ILcdEarthTileSet aTileSet)
ALcdEarthGXYPainter
chooseTileSetCoverage
in class ALcdEarthGXYPainter
aTileSet
- the tile set that will be paintedpublic 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.
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.public String getDisplayName()
ALcdGXYPainter
ILcdGXYPainter
.getDisplayName
in interface ILcdGXYPainter
getDisplayName
in class ALcdGXYPainter
setDisplayName()
, or
this.toString()
if no name has been set.public Object clone()
ILcdCloneable
Makes Object.clone()
public.
java.lang.Object
, it can be implemented like this:
public Object clone() {
try {
return super.clone();
} catch ( CloneNotSupportedException e ) {
// Cannot happen: extends from Object and implements Cloneable (see also Object.clone)
throw new RuntimeException( e );
}
}
clone
in interface ILcdCloneable
clone
in interface ILcdGXYPainterProvider
clone
in class ALcdEarthGXYPainter
Object.clone()