public class TLcdKML22PaintableGroundOverlay extends Object implements ILcdBounded, ILcdTimeBounded, ILcdDataObject, 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:
ILcdRaster
that can be painted in a standard raster painter.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
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_IMAGE |
Constructor and Description |
---|
TLcdKML22PaintableGroundOverlay(TLcdKML22GroundOverlay aGroundOverlay,
TLcdKML22ResourceProvider aResourceProvider,
TLcdKML22Parameters aParameters,
ILcdKML22ResourceListener aResourceListener)
Constructs a paintable ground overlay with the given parameters.
|
Modifier and Type | Method and Description |
---|---|
void |
clearCache()
Clears the cache.
|
protected Object |
clone() |
ILcdBounds |
getBounds()
Returns the bounds of the rotated bounds of the
TLcdKML22GroundOverlay wrapped by this
object. |
Object |
getCachedObject(Object aKey)
Looks up and returns the cached Object corresponding to the given key.
|
TLcdDataType |
getDataType()
Returns the type of this data object.
|
TLcdKML22GroundOverlay |
getGroundOverlay()
Returns the orignal
TLcdKML22GroundOverlay this paintable groundoverlay was based on. |
RenderedImage |
getImage()
Returns the image used in this object.
|
TLcdKML22Parameters |
getKMLParameters()
Returns the KML parameters map
|
ILcdRaster |
getRaster()
Returns a raster representation of the
TLcdKML22GroundOverlay wrapped by this raster |
ILcdTimeBounds |
getTimeBounds()
Returns the original, unaltered time bounds of the
TLcdKML22GroundOverlay wrapped by this
object. |
Object |
getValue(String aPropertyName)
Convenience method that returns the value of the property with the given name.
|
Object |
getValue(TLcdDataProperty aProperty)
Returns the value of the given property.
|
boolean |
hasValue(String aPropertyName)
Indicates whether this data object has a value for the given property.
|
boolean |
hasValue(TLcdDataProperty aProperty)
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 new
ILcdRaster with the given image |
Object |
removeCachedObject(Object aKey)
Looks up and removes the cached Object corresponding to the given key.
|
void |
setKMLParameters(TLcdKML22Parameters aParameterProvider)
Sets the KML parameter map
|
void |
setValue(String aPropertyName,
Object aValue)
Convenience method that sets the value of the property with the given name.
|
void |
setValue(TLcdDataProperty aProperty,
Object aValue)
Sets the value of the given property for this data object.
|
public static final String DEFAULT_IMAGE
public TLcdKML22PaintableGroundOverlay(TLcdKML22GroundOverlay aGroundOverlay, TLcdKML22ResourceProvider aResourceProvider, TLcdKML22Parameters aParameters, ILcdKML22ResourceListener aResourceListener)
Constructs a paintable ground overlay with the given parameters.
aGroundOverlay
- The TLcdKML22GroundOverlay
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.public TLcdKML22Parameters getKMLParameters()
Returns the KML parameters map
TLcdKML22Parameters
public void setKMLParameters(TLcdKML22Parameters aParameterProvider)
Sets the KML parameter map
aParameterProvider
- A valid TLcdKML22Parameters
public ILcdBounds getBounds()
Returns the bounds of the rotated bounds of the TLcdKML22GroundOverlay
wrapped by this
object.
getBounds
in interface ILcdBounded
public ILcdTimeBounds getTimeBounds()
TLcdKML22GroundOverlay
wrapped by this
object.getTimeBounds
in interface ILcdTimeBounded
public void clearCache()
ILcdCache
clearCache
in interface ILcdCache
public void insertIntoCache(Object aKey, Object aObject)
ILcdCache
insertIntoCache
in interface ILcdCache
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.public Object getCachedObject(Object aKey)
ILcdCache
getCachedObject
in interface ILcdCache
aKey
- the key Object that was used for storing the cache Object.public Object removeCachedObject(Object aKey)
ILcdCache
removeCachedObject
in interface ILcdCache
aKey
- the key Object that was used for storing the cache Object.public TLcdKML22GroundOverlay getGroundOverlay()
Returns the orignal TLcdKML22GroundOverlay
this paintable groundoverlay was based on.
TLcdKML22GroundOverlay
used to create this objectpublic ILcdRaster getRaster()
Returns a raster representation of the TLcdKML22GroundOverlay
wrapped by this raster
If 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
ILcdRaster
public void refreshRaster(RenderedImage aImage, ILcdBounds aBounds)
Refreshes this object by creating a new ILcdRaster
with the given image
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 be null
.public RenderedImage 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
public TLcdDataType 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.
getDataType
in interface ILcdDataObject
public Object getValue(TLcdDataProperty aProperty)
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 an IllegalArgumentException
is thrown.
getValue
in interface ILcdDataObject
aProperty
- the property for which the value is to be returnedpublic void setValue(TLcdDataProperty aProperty, Object aValue)
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 an IllegalArgumentException
.setValue
in interface ILcdDataObject
aProperty
- the property for which the value is to be setaValue
- the value to setTLcdDataType.getProperty(String)
public Object getValue(String aPropertyName)
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.getValue
in interface ILcdDataObject
aPropertyName
- the name of the property of which the value is to be returnedTLcdDataType.getProperty(String)
public void setValue(String aPropertyName, Object aValue)
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.setValue
in interface ILcdDataObject
aPropertyName
- the name of the property of which the value is to be setaValue
- the value to setpublic boolean hasValue(TLcdDataProperty aProperty)
ILcdDataObject
aProperty
is from the right data type
, and this instance has a value for it: returns true
aProperty
is from the right data type
, and this instance has no value for it: returns false
aProperty
is not from the right data type
: not allowed, you will get IllegalArgumentExceptionaProperty
is null
: not allowed, you will get NullPointerExceptionhasValue
in interface ILcdDataObject
aProperty
- the property for which to return whether a value is present or not.true
if this data object has a value for the given property, false
otherwise.public boolean hasValue(String aPropertyName)
ILcdDataObject
ILcdDataObject.hasValue(TLcdDataProperty)
for more information.hasValue
in interface ILcdDataObject
aPropertyName
- the name of the property for which to return whether a value is present
or not.true
if this data object has a value for the property with the given name,
false
otherwise.protected Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException