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
ILcdRaster
that 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
-
Constructor Summary
ConstructorDescriptionTLcdKML22PaintableGroundOverlay
(TLcdKML22GroundOverlay aGroundOverlay, TLcdKML22ResourceProvider aResourceProvider, TLcdKML22Parameters aParameters, ILcdKML22ResourceListener aResourceListener) Constructs a paintable ground overlay with the given parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears the cache.protected Object
clone()
Returns the bounds of the rotated bounds of theTLcdKML22GroundOverlay
wrapped 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 orignalTLcdKML22GroundOverlay
this paintable groundoverlay was based on.getImage()
Returns the image used in this object.Returns the KML parameters mapReturns a raster representation of theTLcdKML22GroundOverlay
wrapped by this rasterReturns the original, unaltered time bounds of theTLcdKML22GroundOverlay
wrapped 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.boolean
hasValue
(TLcdDataProperty aProperty) Indicates whether this data object has a value for the given property.boolean
Indicates whether this data object has a value for the given property.void
insertIntoCache
(Object aKey, Object aObject) Inserts a cache Object corresponding to the given key Object.void
refreshRaster
(RenderedImage aImage, ILcdBounds aBounds) Refreshes this object by creating a newILcdRaster
with the given imageremoveCachedObject
(Object aKey) Looks up and removes the cached Object corresponding to the given key.void
setKMLParameters
(TLcdKML22Parameters aParameterProvider) Sets the KML parameter mapvoid
setValue
(TLcdDataProperty aProperty, Object aValue) Sets the value of the given property for this data object.void
Convenience 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
- TheTLcdKML22GroundOverlay
that 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
TLcdKML22GroundOverlay
wrapped by this object.- Specified by:
getBounds
in interfaceILcdBounded
- Returns:
- The bounds of the rotated bounds of the ground overlay in model coordinates.
-
getTimeBounds
Returns the original, unaltered time bounds of theTLcdKML22GroundOverlay
wrapped by this object.- Specified by:
getTimeBounds
in interfaceILcdTimeBounded
- Returns:
- The time bounds of the groundoverlay
-
clearCache
public void clearCache()Description copied from interface:ILcdCache
Clears the cache.- Specified by:
clearCache
in interfaceILcdCache
-
insertIntoCache
Description copied from interface:ILcdCache
Inserts a cache Object corresponding to the given key Object.- Specified by:
insertIntoCache
in 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:ILcdCache
Looks up and returns the cached Object corresponding to the given key.- Specified by:
getCachedObject
in 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:ILcdCache
Looks up and removes the cached Object corresponding to the given key.- Specified by:
removeCachedObject
in 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
TLcdKML22GroundOverlay
this paintable groundoverlay was based on.- Returns:
- The original
TLcdKML22GroundOverlay
used to create this object
-
getRaster
Returns a raster representation of the
TLcdKML22GroundOverlay
wrapped 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
ILcdKML22ResourceListener
given 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
ILcdRaster
with 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:
getDataType
in interfaceILcdDataObject
- Returns:
- the type of this data object
-
getValue
Description copied from interface:ILcdDataObject
Returns 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 type
or in one of its super types. Otherwise anIllegalArgumentException
is thrown.- Specified by:
getValue
in 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:ILcdDataObject
Sets 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 type
or 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:
setValue
in interfaceILcdDataObject
- Parameters:
aProperty
- the property for which the value is to be setaValue
- the value to set- See Also:
-
getValue
Description copied from interface:ILcdDataObject
Convenience 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:
getValue
in 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:ILcdDataObject
Convenience 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:
setValue
in 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:ILcdDataObject
Indicates whether this data object has a value for the given property.aProperty
is from theright data type
, and this instance has a value for it: returnstrue
aProperty
is from theright data type
, and this instance has no value for it: returnsfalse
aProperty
is not from theright data type
: not allowed, you will get IllegalArgumentExceptionaProperty
isnull
: not allowed, you will get NullPointerException
- Specified by:
hasValue
in interfaceILcdDataObject
- Parameters:
aProperty
- the property for which to return whether a value is present or not.- Returns:
true
if this data object has a value for the given property,false
otherwise.
-
hasValue
Description copied from interface:ILcdDataObject
Indicates whether this data object has a value for the given property.
SeeILcdDataObject.hasValue(TLcdDataProperty)
for more information.- Specified by:
hasValue
in interfaceILcdDataObject
- Parameters:
aPropertyName
- the name of the property for which to return whether a value is present or not.- Returns:
true
if this data object has a value for the property with the given name,false
otherwise.
-
clone
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-