Package gov.nasa.worldwind.ogc.kml.impl
Class KMLScreenImageImpl
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.render.ScreenImage
-
- gov.nasa.worldwind.ogc.kml.impl.KMLScreenImageImpl
-
- All Implemented Interfaces:
AVList
,MessageListener
,Exportable
,KMLRenderable
,Renderable
,WWObject
,java.beans.PropertyChangeListener
,java.util.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
Fields Modifier and Type Field Description 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
Constructors Constructor Description KMLScreenImageImpl(KMLTraversalContext tc, KMLScreenOverlay overlay)
Create an screen image.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
getSizeMode(java.lang.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 java.lang.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, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
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
-
Methods inherited from interface gov.nasa.worldwind.event.MessageListener
onMessage
-
-
-
-
Field Detail
-
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
-
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
-
parent
protected final KMLScreenOverlay parent
-
iconRetrievalTime
protected long iconRetrievalTime
Indicates the time at which the image source was specified.
-
-
Constructor Detail
-
KMLScreenImageImpl
public KMLScreenImageImpl(KMLTraversalContext tc, KMLScreenOverlay overlay)
Create an screen image.- Parameters:
tc
- the currentKMLTraversalContext
.overlay
- the Overlay element containing.- Throws:
java.lang.NullPointerException
- if the traversal context is null.java.lang.IllegalArgumentException
- if the parent overlay or the traversal context is null.
-
-
Method Detail
-
preRender
public void preRender(KMLTraversalContext tc, DrawContext dc)
Pre-render this element.- Specified by:
preRender
in interfaceKMLRenderable
- Parameters:
tc
- the current KML traversal context.dc
- the current draw context.
-
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.
-
resolveHref
protected java.lang.String resolveHref()
Resolve the HREF in this overlay's Icon element against the KML root.- Returns:
- The resolved path to the image source.
-
render
public void render(KMLTraversalContext tc, DrawContext dc)
Render this element.- Specified by:
render
in interfaceKMLRenderable
- Parameters:
tc
- the current KML traversal context.dc
- the current draw context.
-
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 classScreenImage
- Returns:
- The texture, or null if the texture is not yet available.
-
getSizeMode
protected java.lang.String getSizeMode(java.lang.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.- A value of -1 indicates to use the native dimension.
- A value of 0 indicates to maintain the aspect ratio.
- A value of n sets the value of the dimension.
- Parameters:
size
- The KML size attribute- Returns:
- One of
Size.NATIVE_DIMENSION
,Size.MAINTAIN_ASPECT_RATIO
, orSize.EXPLICIT_DIMENSION
.
-
-