Class TLcdKML22PaintableGroundOverlay

java.lang.Object
com.luciad.format.kml22.model.feature.TLcdKML22PaintableGroundOverlay
All Implemented Interfaces:
ILcdDataObject, ILcdBounded, ILcdTimeBounded, ILcdCache

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:

  • 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 Details

  • Constructor Details

    • TLcdKML22PaintableGroundOverlay

      public TLcdKML22PaintableGroundOverlay(TLcdKML22GroundOverlay aGroundOverlay, TLcdKML22ResourceProvider aResourceProvider, TLcdKML22Parameters aParameters, ILcdKML22ResourceListener aResourceListener)

      Constructs a paintable ground overlay with the given parameters.

      Parameters:
      aGroundOverlay - The TLcdKML22GroundOverlay that holds the bounds and image information for this newly constructed paintable ground overlay
      aResourceProvider - The resource provider that can be used to retrieve the image for this ground overlay
      aParameters - A valid KML parameter map that is needed to retrieve resources from the resource provider
      aResourceListener - A resource listener to be notified when the image of the paintable ground overlay is has been loaded.
  • Method Details

    • getKMLParameters

      public TLcdKML22Parameters getKMLParameters()

      Returns the KML parameters map

      Returns:
      A TLcdKML22Parameters
    • setKMLParameters

      public void setKMLParameters(TLcdKML22Parameters aParameterProvider)

      Sets the KML parameter map

      Parameters:
      aParameterProvider - A valid TLcdKML22Parameters
    • getBounds

      public ILcdBounds getBounds()

      Returns the bounds of the rotated bounds of the TLcdKML22GroundOverlay wrapped by this object.

      Specified by:
      getBounds in interface ILcdBounded
      Returns:
      The bounds of the rotated bounds of the ground overlay in model coordinates.
    • getTimeBounds

      public ILcdTimeBounds getTimeBounds()
      Returns the original, unaltered time bounds of the TLcdKML22GroundOverlay wrapped by this object.
      Specified by:
      getTimeBounds in interface ILcdTimeBounded
      Returns:
      The time bounds of the groundoverlay
    • clearCache

      public void clearCache()
      Description copied from interface: ILcdCache
      Clears the cache.
      Specified by:
      clearCache in interface ILcdCache
    • insertIntoCache

      public void insertIntoCache(Object aKey, Object aObject)
      Description copied from interface: ILcdCache
      Inserts a cache Object corresponding to the given key Object.
      Specified by:
      insertIntoCache in interface ILcdCache
      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

      public Object getCachedObject(Object aKey)
      Description copied from interface: ILcdCache
      Looks up and returns the cached Object corresponding to the given key.
      Specified by:
      getCachedObject in interface ILcdCache
      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

      public Object removeCachedObject(Object aKey)
      Description copied from interface: ILcdCache
      Looks up and removes the cached Object corresponding to the given key.
      Specified by:
      removeCachedObject in interface ILcdCache
      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

      public TLcdKML22GroundOverlay getGroundOverlay()

      Returns the orignal TLcdKML22GroundOverlay this paintable groundoverlay was based on.

      Returns:
      The original TLcdKML22GroundOverlay used to create this object
    • getRaster

      public 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

      Returns:
      A valid ILcdRaster
    • refreshRaster

      public void refreshRaster(RenderedImage aImage, ILcdBounds aBounds)

      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 be null.
    • getImage

      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

      Returns:
      Either the image used in this raster, or null if the image has not been loaded yet.
    • getDataType

      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.

      Specified by:
      getDataType in interface ILcdDataObject
      Returns:
      the type of this data object
    • getValue

      public Object getValue(TLcdDataProperty aProperty)
      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 an IllegalArgumentException is thrown.

      Specified by:
      getValue in interface ILcdDataObject
      Parameters:
      aProperty - the property for which the value is to be returned
      Returns:
      the value of the given property for this data object
    • setValue

      public void setValue(TLcdDataProperty aProperty, Object aValue)
      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 the data 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.

      Specified by:
      setValue in interface ILcdDataObject
      Parameters:
      aProperty - the property for which the value is to be set
      aValue - the value to set
      See Also:
    • getValue

      public Object getValue(String aPropertyName)
      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).

      See ILcdDataObject.getValue(TLcdDataProperty) for more information.

      Specified by:
      getValue in interface ILcdDataObject
      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

      public void setValue(String aPropertyName, Object aValue)
      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).

      See ILcdDataObject.setValue(TLcdDataProperty, Object) for more information.

      Specified by:
      setValue in interface ILcdDataObject
      Parameters:
      aPropertyName - the name of the property of which the value is to be set
      aValue - the value to set
    • hasValue

      public boolean hasValue(TLcdDataProperty aProperty)
      Description copied from interface: ILcdDataObject
      Indicates whether this data object has a value for the given property.

      • 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 IllegalArgumentException
      • aProperty is null: not allowed, you will get NullPointerException

      A multivalued property is considered to have a value if it has at least one value.

      Specified by:
      hasValue in interface ILcdDataObject
      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

      public boolean hasValue(String aPropertyName)
      Description copied from interface: ILcdDataObject
      Indicates whether this data object has a value for the given property.
      See ILcdDataObject.hasValue(TLcdDataProperty) for more information.
      Specified by:
      hasValue in interface ILcdDataObject
      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

      protected Object clone() throws CloneNotSupportedException
      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException