Class TLcdEarthGXYVectorPainter
- All Implemented Interfaces:
ILcdCloneable
,ILcdPropertyChangeSource
,ILcdGXYPainter
,ILcdGXYPainterProvider
,Serializable
,Cloneable
ILcdGXYPainter
can paint the vector data of ILcdEarthTileSet
instances in a 2D view.
Supported objects
This painter can visualize anyILcdEarthTileSet
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)
).
Visualization
The tile level is chosen using thegetLodStrategy()
. 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
.- Since:
- 8.2
- 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
ConstructorDescriptionTLcdEarthGXYVectorPainter
(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. -
Method Summary
Modifier and TypeMethodDescriptionprotected ILcdEarthTileSetCoverage
chooseTileSetCoverage
(ILcdEarthTileSet aTileSet) Chooses a coverage in a tile set.void
Clears the cache.clone()
MakesObject.clone()
public.Returns the display name of thisILcdGXYPainter
.Returns the current LOD strategy.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.Methods inherited from class com.luciad.earth.view.gxy.ALcdEarthGXYPainter
boundsSFCT, getCacheSize, getExceptionHandler, getObject, getTileSet, getTileSet, getTileSetCoverage, isAsynchronousTileRequestAllowed, isRepaintViewWhenTileAvailable, isTouched, setAsynchronousTileRequestAllowed, setExceptionHandler, setObject, setRepaintViewWhenTileAvailable
Methods inherited from class com.luciad.view.gxy.ALcdGXYPainter
addPropertyChangeListener, anchorPointSFCT, firePropertyChangeEvent, firePropertyChangeEvent, getCursor, getGXYPainter, isTraceOn, removePropertyChangeListener, setClassTraceOn, setDisplayName, setTraceOn, snapTarget, supportSnap
-
Constructor Details
-
TLcdEarthGXYVectorPainter
Creates a new 2D Painter that delegates painting of the tile data to the given painter.- Parameters:
aTileDataPainter
- The painter to delegate the painting of the tile data to.
-
TLcdEarthGXYVectorPainter
public TLcdEarthGXYVectorPainter(ILcdGXYPainter aTileDataPainter, ILcdEarthGXYLodSelectionStrategy aLodStrategy) Creates a new 2D Painter that delegates painting of the tile data to the given painter.- Parameters:
aTileDataPainter
- The painter to delegate the painting of the tile data to.aLodStrategy
- The strategy to use for selecting a LOD.
-
TLcdEarthGXYVectorPainter
public 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.- Parameters:
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.
-
-
Method Details
-
getTileDataPainter
Returns the current gxy painter for the tile data.- Returns:
- A gxy painter.
-
setTileDataPainter
Sets the gxy painter for the tile data.- Parameters:
aDelegate
- The new gxy painter.
-
getLodStrategy
Returns the current LOD strategy.- Returns:
- A gxy LOD strategy.
-
setLodStrategy
Sets the LOD strategy.- Parameters:
aLodStrategy
- The new gxy LOD strategy.
-
setCacheSize
public void setCacheSize(int aCacheSize) Description copied from class:ALcdEarthGXYPainter
Sets the size of the cache (in #tiles). If the new cache size is smaller than the current cache size some elements will be removed from the cache.- Overrides:
setCacheSize
in classALcdEarthGXYPainter
- Parameters:
aCacheSize
- the new cache size
-
clearCache
public void clearCache()Description copied from class:ALcdEarthGXYPainter
Clears the cache.- Overrides:
clearCache
in classALcdEarthGXYPainter
-
chooseTileSetCoverage
Description copied from class:ALcdEarthGXYPainter
Chooses a coverage in a tile set.- Specified by:
chooseTileSetCoverage
in classALcdEarthGXYPainter
- Parameters:
aTileSet
- the tile set that will be painted- Returns:
- a coverage in the specified tile set that should be painted
-
paint
Description copied from interface:ILcdGXYPainter
Displays the representation of the object in the given mode on the Graphics passed, taking into account the supplied context.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:
- transformations which allow to compute the location in view space of points and bounds given in model, space
- a pen which can connect points with a line or create arcs around a point,
- the view for which the object's representation must be painted. This can be useful when the painted object depends on the scale of the view, or the presence of other layers in the view.
- the current location(s) of the mouse or input device and the last location(s) the mouse or input device was pressed.
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 ofILcdGXYPainter
andILcdGXYEditor
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 theILcdGXYPainter
andILcdGXYEditor
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.
- Parameters:
aGraphics
- the Graphics on which the representation of the object is paintedaMode
- the mode the object is represented in (see class documentation).aContext
- theILcdGXYContext
the drawing depends on.
-
getDisplayName
Description copied from class:ALcdGXYPainter
Returns the display name of thisILcdGXYPainter
.- Specified by:
getDisplayName
in interfaceILcdGXYPainter
- Overrides:
getDisplayName
in classALcdGXYPainter
- Returns:
- the name that has been set using
setDisplayName()
, orthis.toString()
if no name has been set.
-
clone
Description copied from interface:ILcdCloneable
Makes
When for example extending fromObject.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 ); } }
- Specified by:
clone
in interfaceILcdCloneable
- Specified by:
clone
in interfaceILcdGXYPainterProvider
- Overrides:
clone
in classALcdEarthGXYPainter
- Returns:
- a clone of this painter provider.
- See Also:
-