NASA World Wind

gov.nasa.worldwind.ogc.kml.impl
Class KMLScreenImageImpl

java.lang.Object
  extended by gov.nasa.worldwind.avlist.AVListImpl
      extended by gov.nasa.worldwind.WWObjectImpl
          extended by gov.nasa.worldwind.render.ScreenImage
              extended by gov.nasa.worldwind.ogc.kml.impl.KMLScreenImageImpl
All Implemented Interfaces:
AVList, MessageListener, Exportable, KMLRenderable, Renderable, WWObject, PropertyChangeListener, EventListener

public class KMLScreenImageImpl
extends ScreenImage
implements KMLRenderable

Implements at KML ScreenOverlay element.


Nested Class Summary
 
Nested classes/interfaces inherited from class gov.nasa.worldwind.render.ScreenImage
ScreenImage.OrderedImage
 
Field Summary
protected  long iconRetrievalTime
          Indicates the time at which the image source was specified.
protected static int KML_MAINTAIN_ASPECT_RATIO
          Size value that KML uses to indicate that the image aspect ration should be maintained.
protected static int KML_NATIVE_DIMENSION
          Size value that KML uses to indicate that the native image dimension should be maintained.
protected  KMLScreenOverlay parent
           
 
Fields inherited from class gov.nasa.worldwind.render.ScreenImage
awtScreenLocation, color, delegateOwner, dx, dy, frameNumber, height, imageOffset, imageSource, opacity, orderedImage, originalImageHeight, originalImageWidth, pickLayer, pickSupport, rotation, rotationOffset, rotationPoint, screenLocation, screenOffset, size, texture, width
 
Fields inherited from interface gov.nasa.worldwind.Exportable
FORMAT_NOT_SUPPORTED, FORMAT_PARTIALLY_SUPPORTED, FORMAT_SUPPORTED
 
Constructor Summary
KMLScreenImageImpl(KMLTraversalContext tc, KMLScreenOverlay overlay)
          Create an screen image.
 
Method Summary
protected  String getSizeMode(Double size)
          Get the size mode for a size parameter.
protected  BasicWWTexture initializeTexture()
          Create and initialize the texture from the image source.
protected  boolean mustResolveHref()
          Indicates whether or not the image source needs to be resolved.
 void preRender(KMLTraversalContext tc, DrawContext dc)
          Pre-render this element.
 void render(KMLTraversalContext tc, DrawContext dc)
          Render this element.
protected  String resolveHref()
          Resolve the HREF in this overlay's Icon element against the KML root.
 
Methods inherited from class gov.nasa.worldwind.render.ScreenImage
computeOffsets, doRender, draw, export, exportAsKML, getColor, getDelegateOwner, getImageHeight, getImageOffset, getImageSource, getImageWidth, getOpacity, getRotation, getRotationOffset, getScreenLocation, getScreenLocation, getScreenOffset, getSize, getTexture, isExportFormatSupported, pick, render, setColor, setDelegateOwner, setImageOffset, setImageSource, setOpacity, setRotation, setRotationOffset, setScreenLocation, setScreenOffset, setSize
 
Methods inherited from class gov.nasa.worldwind.WWObjectImpl
onMessage, propertyChange
 
Methods inherited from class gov.nasa.worldwind.avlist.AVListImpl
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.nasa.worldwind.event.MessageListener
onMessage
 
Methods inherited from interface gov.nasa.worldwind.avlist.AVList
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
 

Field Detail

iconRetrievalTime

protected long iconRetrievalTime
Indicates the time at which the image source was specified.


KML_MAINTAIN_ASPECT_RATIO

protected static final int KML_MAINTAIN_ASPECT_RATIO
Size value that KML uses to indicate that the image aspect ration should be maintained.

See Also:
Constant Field Values

KML_NATIVE_DIMENSION

protected static final int KML_NATIVE_DIMENSION
Size value that KML uses to indicate that the native image dimension should be maintained.

See Also:
Constant Field Values

parent

protected final KMLScreenOverlay parent
Constructor Detail

KMLScreenImageImpl

public KMLScreenImageImpl(KMLTraversalContext tc,
                          KMLScreenOverlay overlay)
Create an screen image.

Parameters:
tc - the current KMLTraversalContext.
overlay - the Overlay element containing.
Throws:
NullPointerException - if the traversal context is null.
IllegalArgumentException - if the parent overlay or the traversal context is null.
Method Detail

getSizeMode

protected String getSizeMode(Double size)
Get the size mode for a size parameter. The KML size tag takes a numeric size attribute, but certain values of this attribute change the interpretation of the tag.

Parameters:
size - The KML size attribute
Returns:
One of Size.NATIVE_DIMENSION, Size.MAINTAIN_ASPECT_RATIO, or Size.EXPLICIT_DIMENSION.

initializeTexture

protected BasicWWTexture initializeTexture()
Create and initialize the texture from the image source. If the image is not in memory this method will request that it be loaded and return null. Overridden to set the link expiration time based on HTTP headers after the image has been retrieved.

Overrides:
initializeTexture in class ScreenImage
Returns:
The texture, or null if the texture is not yet available.

mustResolveHref

protected boolean mustResolveHref()
Indicates whether or not the image source needs to be resolved. The source needs to be resolved when the KMLIcon is updated.

Returns:
True if the image source must be resolved.

preRender

public void preRender(KMLTraversalContext tc,
                      DrawContext dc)
Pre-render this element.

Specified by:
preRender in interface KMLRenderable
Parameters:
tc - the current KML traversal context.
dc - the current draw context.

render

public void render(KMLTraversalContext tc,
                   DrawContext dc)
Render this element.

Specified by:
render in interface KMLRenderable
Parameters:
tc - the current KML traversal context.
dc - the current draw context.

resolveHref

protected String resolveHref()
Resolve the HREF in this overlay's Icon element against the KML root.

Returns:
The resolved path to the image source.

NASA World Wind