NASA World Wind

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

java.lang.Object
  extended by gov.nasa.worldwind.avlist.AVListImpl
      extended by gov.nasa.worldwind.WWObjectImpl
          extended by gov.nasa.worldwind.render.PointPlacemark
              extended by gov.nasa.worldwind.ogc.kml.impl.KMLPointPlacemarkImpl
All Implemented Interfaces:
AVList, MessageListener, Exportable, Locatable, Movable, KMLRenderable, Declutterable, Highlightable, OrderedRenderable, Renderable, WWObject, PropertyChangeListener, EventListener

public class KMLPointPlacemarkImpl
extends PointPlacemark
implements KMLRenderable

Implements the Point case of a KML Placemark element.


Field Summary
static double DEFAULT_LABEL_SCALE_THRESHOLD
           
protected  boolean highlightAttributesResolved
           
protected  long highlightIconRetrievalTime
          Indicates the time at which the highlight image source was specified.
protected  long iconRetrievalTime
          Indicates the time at which the image source was specified.
protected  double labelScaleThreshold
          Placemark labels with a scale less than this threshold will only be drawn when the placemark is highlighted.
protected  boolean normalAttributesResolved
           
protected  KMLPlacemark parent
           
 
Fields inherited from class gov.nasa.worldwind.render.PointPlacemark
activeAttributes, activeTexture, altitudeMode, applyVerticalExaggeration, boundsFont, clipToHorizon, DEFAULT_HIGHLIGHT_SCALE, DEFAULT_LABEL_OFFSET_IF_UNSPECIFIED, DEFAULT_POINT_SIZE, defaultAttributes, delegateOwner, dx, dy, enableBatchPicking, enableBatchRendering, enableDecluttering, eyeDistance, frameNumber, highlightAttrs, highlighted, labelBounds, labelText, lineEnabled, linePickWidth, normalAttrs, pickLayer, pickSupport, placePoint, position, screenPoint, terrainPoint, textures, visible
 
Fields inherited from interface gov.nasa.worldwind.Exportable
FORMAT_NOT_SUPPORTED, FORMAT_PARTIALLY_SUPPORTED, FORMAT_SUPPORTED
 
Constructor Summary
KMLPointPlacemarkImpl(KMLTraversalContext tc, KMLPlacemark placemark, KMLAbstractGeometry geom)
          Create an instance.
 
Method Summary
protected  PointPlacemarkAttributes assembleLabelAttributes(PointPlacemarkAttributes attrs, KMLLabelStyle style)
           
protected  PointPlacemarkAttributes assembleLineAttributes(PointPlacemarkAttributes attrs, KMLLineStyle style)
           
protected  PointPlacemarkAttributes assemblePointAttributes(PointPlacemarkAttributes attrs, KMLIconStyle style)
           
protected  PickedObject createPickedObject(DrawContext dc, Color pickColor)
          Create a PickedObject for this placemark.
protected  void determineActiveAttributes()
          Determines which attributes -- normal, highlight or default -- to use each frame.
protected  PointPlacemarkAttributes getInitialAttributes(String attrType)
          Get the initial attributes for this feature.
 double getLabelScaleThreshold()
          Get the label scale threshold.
protected  WWTexture initializeTexture(String address)
          Load a texture.
protected  PointPlacemarkAttributes makeAttributesCurrent(String attrType)
          Determine and set the PointPlacemark attributes from the KML Feature fields.
protected  boolean mustDrawLabel()
          Draw the label if the label scale is greater than the label scale threshold, if the image scale is zero (only the text is rendered, there is no image), or if the placemark is highlighted.
protected  boolean mustRefreshIcon()
          Indicates whether or not the icon resource has expired.
 void onMessage(Message message)
          Empty implementation of MessageListener.
 void preRender(KMLTraversalContext tc, DrawContext dc)
          Pre-render this element.
 void render(KMLTraversalContext tc, DrawContext dc)
          Render this element.
 void setLabelScaleThreshold(double labelScaleThreshold)
          Set the label scale threshold.
 
Methods inherited from class gov.nasa.worldwind.render.PointPlacemark
beginDrawing, chooseTexture, computeImageOffset, computeImageRectangle, computePlacemarkPoints, doDrawOrderedRenderable, drawBatched, drawLabel, drawLine, drawOrderedRenderable, drawPoint, endDrawing, export, exportAsKML, getActiveAttributes, getAltitudeMode, getAttributes, getBounds, getDefaultAttributes, getDelegateOwner, getDistanceFromEye, getHighlightAttributes, getLabelBounds, getLabelText, getLinePickWidth, getPosition, getReferencePosition, intersectsFrustum, isApplyVerticalExaggeration, isClipToHorizon, isDrawLine, isDrawPoint, isEnableBatchPicking, isEnableBatchRendering, isEnableDecluttering, isExportFormatSupported, isHighlighted, isLineEnabled, isVisible, makeOrderedRenderable, move, moveTo, pick, render, setAltitudeMode, setApplyVerticalExaggeration, setAttributes, setClipToHorizon, setDelegateOwner, setEnableBatchPicking, setEnableBatchRendering, setEnableDecluttering, setHighlightAttributes, setHighlighted, setLabelText, setLineColor, setLineEnabled, setLinePickWidth, setLineWidth, setPointSize, setPosition, setVisible
 
Methods inherited from class gov.nasa.worldwind.WWObjectImpl
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.avlist.AVList
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
 

Field Detail

DEFAULT_LABEL_SCALE_THRESHOLD

public static final double DEFAULT_LABEL_SCALE_THRESHOLD
See Also:
Constant Field Values

highlightAttributesResolved

protected boolean highlightAttributesResolved

highlightIconRetrievalTime

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


iconRetrievalTime

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


labelScaleThreshold

protected double labelScaleThreshold
Placemark labels with a scale less than this threshold will only be drawn when the placemark is highlighted. This logic supports KML files with many placemarks with small labels, and drawing all the labels would be too cluttered.


normalAttributesResolved

protected boolean normalAttributesResolved

parent

protected final KMLPlacemark parent
Constructor Detail

KMLPointPlacemarkImpl

public KMLPointPlacemarkImpl(KMLTraversalContext tc,
                             KMLPlacemark placemark,
                             KMLAbstractGeometry geom)
Create an instance.

Parameters:
tc - the current KMLTraversalContext.
placemark - the Placemark element containing the Point.
geom - the KMLPoint geometry.
Throws:
NullPointerException - if the geometry is null.
IllegalArgumentException - if the parent placemark or the traversal context is null.
Method Detail

assembleLabelAttributes

protected PointPlacemarkAttributes assembleLabelAttributes(PointPlacemarkAttributes attrs,
                                                           KMLLabelStyle style)

assembleLineAttributes

protected PointPlacemarkAttributes assembleLineAttributes(PointPlacemarkAttributes attrs,
                                                          KMLLineStyle style)

assemblePointAttributes

protected PointPlacemarkAttributes assemblePointAttributes(PointPlacemarkAttributes attrs,
                                                           KMLIconStyle style)

createPickedObject

protected PickedObject createPickedObject(DrawContext dc,
                                          Color pickColor)
Create a PickedObject for this placemark. The PickedObject returned by this method will be added to the pick list to represent the current placemark.

Overrides:
createPickedObject in class PointPlacemark
Parameters:
dc - Active draw context.
pickColor - Unique color for this PickedObject.
Returns:
A new picked object.

determineActiveAttributes

protected void determineActiveAttributes()
Description copied from class: PointPlacemark
Determines which attributes -- normal, highlight or default -- to use each frame.

Overrides:
determineActiveAttributes in class PointPlacemark

getInitialAttributes

protected PointPlacemarkAttributes getInitialAttributes(String attrType)
Get the initial attributes for this feature. These attributes will be changed to reflect the feature's style.

Parameters:
attrType - KMLConstants.NORMAL or KMLConstants.HIGHLIGHT.
Returns:
New placemark attributes.

getLabelScaleThreshold

public double getLabelScaleThreshold()
Get the label scale threshold. The placemark label will be drawn if the label scale is greater than or equal to this threshold, or if the placemark is highlighted.

Returns:
Label scale threshold.
See Also:
setLabelScaleThreshold(double)

initializeTexture

protected WWTexture initializeTexture(String address)
Load a texture. If the texture source is not available locally, this method requests the texture source and returns null. Overridden to set the expiration time of the placemark's icon based on the HTTP headers of the linked resource.

Overrides:
initializeTexture in class PointPlacemark
Parameters:
address - Path or URL to the image to load into a texture.
Returns:
The new texture, or null if the texture could not be created because the resource is not yet available locally.

makeAttributesCurrent

protected PointPlacemarkAttributes makeAttributesCurrent(String attrType)
Determine and set the PointPlacemark attributes from the KML Feature fields.

Parameters:
attrType - the type of attributes, either KMLConstants.NORMAL or KMLConstants.HIGHLIGHT.
Returns:
The new attributes, or null if there are no attributes defined. Returns a partially empty attributes bundle marked unresolved if any of placemark KML styles are unresolved.

mustDrawLabel

protected boolean mustDrawLabel()
Draw the label if the label scale is greater than the label scale threshold, if the image scale is zero (only the text is rendered, there is no image), or if the placemark is highlighted.

Overrides:
mustDrawLabel in class PointPlacemark
Returns:
True if the label must be drawn.

mustRefreshIcon

protected boolean mustRefreshIcon()
Indicates whether or not the icon resource has expired.

Returns:
True if the icon has expired and must be refreshed.

onMessage

public void onMessage(Message message)
Description copied from class: WWObjectImpl
Empty implementation of MessageListener.

Specified by:
onMessage in interface MessageListener
Overrides:
onMessage in class WWObjectImpl
Parameters:
message - The message that was received.

preRender

public void preRender(KMLTraversalContext tc,
                      DrawContext dc)
Description copied from interface: KMLRenderable
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)
Description copied from interface: KMLRenderable
Render this element.

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

setLabelScaleThreshold

public void setLabelScaleThreshold(double labelScaleThreshold)
Set the label scale threshold. The placemark label will be drawn if the label scale is greater or equal to than this threshold, or if the placemark is highlighted.

Parameters:
labelScaleThreshold - New label scale threshold.
See Also:
getLabelScaleThreshold()

NASA World Wind