Class TLcdKML22PaintableGroundOverlay
- All Implemented Interfaces:
ILcdDataObject,ILcdBounded,ILcdTimeBounded,ILcdCache
This class is used as a wrapper around a TLcdKML22GroundOverlay. This class lazily initializes
the necessary resource to paint a TLcdKML22GroundOverlay with the KML painters.
An instance of this class will:
- Load the image resource needed for the given ground overlay in an asynchronous, lazy fashion.
- Generate a
ILcdRasterthat can be painted in a standard raster painter. - Generate a default image if the image in the ground overlay could not be found.
A paintable ground overlay is bounded in both space and time through the ILcdBounded and ILcdTimeBounded
interfaces. The bounds of the ILcdBounded interface reflect the model bounds given in a KML document, and
the ILcdTimeBounded interface reflects the Abstract Time element in the KML file
Use the getRaster() method to retrieve the generated ILcdRaster
- Since:
- 10.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTLcdKML22PaintableGroundOverlay(TLcdKML22GroundOverlay aGroundOverlay, TLcdKML22ResourceProvider aResourceProvider, TLcdKML22Parameters aParameters, ILcdKML22ResourceListener aResourceListener) Constructs a paintable ground overlay with the given parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoidClears the cache.protected Objectclone()Returns the bounds of the rotated bounds of theTLcdKML22GroundOverlaywrapped by this object.getCachedObject(Object aKey) Looks up and returns the cached Object corresponding to the given key.Returns the type of this data object.Returns the orignalTLcdKML22GroundOverlaythis paintable groundoverlay was based on.getImage()Returns the image used in this object.Returns the KML parameters mapReturns a raster representation of theTLcdKML22GroundOverlaywrapped by this rasterReturns the original, unaltered time bounds of theTLcdKML22GroundOverlaywrapped by this object.getValue(TLcdDataProperty aProperty) Returns the value of the given property.Convenience method that returns the value of the property with the given name.booleanhasValue(TLcdDataProperty aProperty) Indicates whether this data object has a value for the given property.booleanIndicates whether this data object has a value for the given property.voidinsertIntoCache(Object aKey, Object aObject) Inserts a cache Object corresponding to the given key Object.voidrefreshRaster(RenderedImage aImage, ILcdBounds aBounds) Refreshes this object by creating a newILcdRasterwith the given imageremoveCachedObject(Object aKey) Looks up and removes the cached Object corresponding to the given key.voidsetKMLParameters(TLcdKML22Parameters aParameterProvider) Sets the KML parameter mapvoidsetValue(TLcdDataProperty aProperty, Object aValue) Sets the value of the given property for this data object.voidConvenience method that sets the value of the property with the given name.
-
Field Details
-
DEFAULT_IMAGE
- See Also:
-
-
Constructor Details
-
TLcdKML22PaintableGroundOverlay
public TLcdKML22PaintableGroundOverlay(TLcdKML22GroundOverlay aGroundOverlay, TLcdKML22ResourceProvider aResourceProvider, TLcdKML22Parameters aParameters, ILcdKML22ResourceListener aResourceListener) Constructs a paintable ground overlay with the given parameters.
- Parameters:
aGroundOverlay- TheTLcdKML22GroundOverlaythat holds the bounds and image information for this newly constructed paintable ground overlayaResourceProvider- The resource provider that can be used to retrieve the image for this ground overlayaParameters- A valid KML parameter map that is needed to retrieve resources from the resource provideraResourceListener- A resource listener to be notified when the image of the paintable ground overlay is has been loaded.
-
-
Method Details
-
getKMLParameters
Returns the KML parameters map
- Returns:
- A
TLcdKML22Parameters
-
setKMLParameters
Sets the KML parameter map
- Parameters:
aParameterProvider- A validTLcdKML22Parameters
-
getBounds
Returns the bounds of the rotated bounds of the
TLcdKML22GroundOverlaywrapped by this object.- Specified by:
getBoundsin interfaceILcdBounded- Returns:
- The bounds of the rotated bounds of the ground overlay in model coordinates.
-
getTimeBounds
Returns the original, unaltered time bounds of theTLcdKML22GroundOverlaywrapped by this object.- Specified by:
getTimeBoundsin interfaceILcdTimeBounded- Returns:
- The time bounds of the groundoverlay
-
clearCache
public void clearCache()Description copied from interface:ILcdCacheClears the cache.- Specified by:
clearCachein interfaceILcdCache
-
insertIntoCache
Description copied from interface:ILcdCacheInserts a cache Object corresponding to the given key Object.- Specified by:
insertIntoCachein 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:ILcdCacheLooks up and returns the cached Object corresponding to the given key.- Specified by:
getCachedObjectin 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:ILcdCacheLooks up and removes the cached Object corresponding to the given key.- Specified by:
removeCachedObjectin 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.
-
getGroundOverlay
Returns the orignal
TLcdKML22GroundOverlaythis paintable groundoverlay was based on.- Returns:
- The original
TLcdKML22GroundOverlayused to create this object
-
getRaster
Returns a raster representation of the
TLcdKML22GroundOverlaywrapped by this rasterIf the raster was not previously initialized, this method will create it asynchronously
While creating a raster asynchronously, a temporary placeholder will be returned that is valid, and can be painted by a raster painter.
The
ILcdKML22ResourceListenergiven at construction time will be notified when the image of the raster has been loaded asynchronously. A consequent call to this method will result in the final raster being returned- Returns:
- A valid
ILcdRaster
-
refreshRaster
Refreshes this object by creating a new
ILcdRasterwith the given image- Parameters:
aImage- A valid image that should be used for this paintable groundoverlay. If null, nothing happens.aBounds- The bounds of the image, if they do not correspond to the LatLonBox defined in the ground overlay. If they do correspond to the ground overlay's LatLonBox, this parameter may benull.
-
getImage
Returns the image used in this object.
Note: While loading of images is done lazily, this method is a simple getter: It does not initialize the image
- Returns:
- Either the image used in this raster, or null if the image has not been loaded yet.
-
getDataType
Returns the type of this data object. This can never be
null. In this case, this matches the data type of the original groundoverlay.- Specified by:
getDataTypein interfaceILcdDataObject- Returns:
- the type of this data object
-
getValue
Description copied from interface:ILcdDataObjectReturns the value of the given property.
If the property is a collection, the returned value will never be null. If the property has not been set, an empty collection of the appropriate type will be returned (Set, List or Map).
The property must not be null, and must be declared in the
data object's typeor in one of its super types. Otherwise anIllegalArgumentExceptionis thrown.- Specified by:
getValuein interfaceILcdDataObject- Parameters:
aProperty- the property for which the value is to be returned- Returns:
- the value of the given property for this data object
-
setValue
Description copied from interface:ILcdDataObjectSets the value of the given property for this data object. The implementation is allowed to throw an exception if the given value can't be set.
The given property must be declared in thedata object's typeor in one of its super types. In other words, getDataType().getProperties().contains( aProperty ) should always be true. Otherwise, the implementation should throw anIllegalArgumentException.- Specified by:
setValuein interfaceILcdDataObject- Parameters:
aProperty- the property for which the value is to be setaValue- the value to set- See Also:
-
getValue
Description copied from interface:ILcdDataObjectConvenience method that returns the value of the property with the given name.
If more than one property exists with the given name, the most specific property should be used (this is the property defined by the most specialized type in this object's data type hierarchy). SeeILcdDataObject.getValue(TLcdDataProperty)for more information.- Specified by:
getValuein interfaceILcdDataObject- Parameters:
aPropertyName- the name of the property of which the value is to be returned- Returns:
- the value of the property with the given name
- See Also:
-
setValue
Description copied from interface:ILcdDataObjectConvenience method that sets the value of the property with the given name.
If more than one property exists with the given name, the most specific property should be used (this is the property defined by the most specialized type in this object's data type hierarchy). SeeILcdDataObject.setValue(TLcdDataProperty, Object)for more information.- Specified by:
setValuein interfaceILcdDataObject- Parameters:
aPropertyName- the name of the property of which the value is to be setaValue- the value to set
-
hasValue
Description copied from interface:ILcdDataObjectIndicates whether this data object has a value for the given property.aPropertyis from theright data type, and this instance has a value for it: returnstrueaPropertyis from theright data type, and this instance has no value for it: returnsfalseaPropertyis not from theright data type: not allowed, you will get IllegalArgumentExceptionaPropertyisnull: not allowed, you will get NullPointerException
- Specified by:
hasValuein interfaceILcdDataObject- Parameters:
aProperty- the property for which to return whether a value is present or not.- Returns:
trueif this data object has a value for the given property,falseotherwise.
-
hasValue
Description copied from interface:ILcdDataObjectIndicates whether this data object has a value for the given property.
SeeILcdDataObject.hasValue(TLcdDataProperty)for more information.- Specified by:
hasValuein interfaceILcdDataObject- Parameters:
aPropertyName- the name of the property for which to return whether a value is present or not.- Returns:
trueif this data object has a value for the property with the given name,falseotherwise.
-
clone
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-