Package gov.nasa.worldwind.ogc.kml.impl
Class KMLPointPlacemarkImpl
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.render.PointPlacemark
-
- gov.nasa.worldwind.ogc.kml.impl.KMLPointPlacemarkImpl
-
- All Implemented Interfaces:
AVList
,Draggable
,MessageListener
,Exportable
,Locatable
,Movable
,KMLRenderable
,Highlightable
,Renderable
,WWObject
,java.beans.PropertyChangeListener
,java.util.EventListener
public class KMLPointPlacemarkImpl extends PointPlacemark implements KMLRenderable
Implements the Point case of a KML Placemark element.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class gov.nasa.worldwind.render.PointPlacemark
PointPlacemark.LODSelector, PointPlacemark.OrderedPlacemark
-
-
Field Summary
Fields Modifier and Type Field Description 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, alwaysOnTop, applyVerticalExaggeration, clipToHorizon, DEFAULT_HIGHLIGHT_SCALE, DEFAULT_LABEL_OFFSET_IF_UNSPECIFIED, DEFAULT_POINT_SIZE, defaultAttributes, delegateOwner, dragEnabled, draggableSupport, dx, dy, enableBatchPicking, enableBatchRendering, enableDecluttering, enableLabelPicking, eyeDistance, frameNumber, highlightAttrs, highlighted, labelText, lineEnabled, linePickWidth, LODSelector, normalAttrs, PICK_Y_OFFSET, PICK_Y_SIZE_DELTA, pickLayer, pickSupport, placePoint, position, screenPoint, terrainPoint, textures, TRANSPARENT_IMAGE_ADDRESS, visible
-
Fields inherited from interface gov.nasa.worldwind.Exportable
FORMAT_NOT_SUPPORTED, FORMAT_PARTIALLY_SUPPORTED, FORMAT_SUPPORTED
-
-
Constructor Summary
Constructors Constructor Description KMLPointPlacemarkImpl(KMLTraversalContext tc, KMLPlacemark placemark, KMLAbstractGeometry geom)
Create an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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, java.awt.Color pickColor)
Create aPickedObject
for this placemark.protected void
determineActiveAttributes()
Determines which attributes -- normal, highlight or default -- to use each frame.protected PointPlacemarkAttributes
getInitialAttributes(java.lang.String attrType)
Get the initial attributes for this feature.double
getLabelScaleThreshold()
Get the label scale threshold.protected WWTexture
initializeTexture(java.lang.String address)
Load a texture.protected PointPlacemarkAttributes
makeAttributesCurrent(java.lang.String attrType)
Determine and set thePointPlacemark
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, computeImageBounds, computeImageOffset, computeLabelPoint, computePlacemarkPoints, doDrag, doDrawOrderedRenderable, drag, drawBatched, drawLabel, drawLine, drawOrderedRenderable, drawPoint, endDrawing, export, exportAsKML, getActiveAttributes, getAltitudeMode, getAttributes, getDefaultAttributes, getDelegateOwner, getDistanceFromEye, getHighlightAttributes, getLabelBounds, getLabelText, getLinePickWidth, getLODSelector, getPosition, getReferencePosition, intersectsFrustum, isAlwaysOnTop, isApplyVerticalExaggeration, isClipToHorizon, isDragEnabled, isDrawLine, isDrawPoint, isEnableBatchPicking, isEnableBatchRendering, isEnableDecluttering, isEnableLabelPicking, isExportFormatSupported, isHighlighted, isLineEnabled, isVisible, makeOrderedRenderable, move, moveTo, pick, render, setAltitudeMode, setAlwaysOnTop, setApplyVerticalExaggeration, setAttributes, setClipToHorizon, setDelegateOwner, setDragEnabled, setEnableBatchPicking, setEnableBatchRendering, setEnableDecluttering, setEnableLabelPicking, setHighlightAttributes, setHighlighted, setLabelText, setLineColor, setLineEnabled, setLinePickWidth, setLineWidth, setLODSelector, 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, 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
-
parent
protected final KMLPlacemark parent
-
highlightAttributesResolved
protected boolean highlightAttributesResolved
-
normalAttributesResolved
protected boolean normalAttributesResolved
-
iconRetrievalTime
protected long iconRetrievalTime
Indicates the time at which the image source was specified.
-
highlightIconRetrievalTime
protected long highlightIconRetrievalTime
Indicates the time at which the highlight image source was specified.
-
DEFAULT_LABEL_SCALE_THRESHOLD
public static final double DEFAULT_LABEL_SCALE_THRESHOLD
- See Also:
- Constant Field Values
-
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.
-
-
Constructor Detail
-
KMLPointPlacemarkImpl
public KMLPointPlacemarkImpl(KMLTraversalContext tc, KMLPlacemark placemark, KMLAbstractGeometry geom)
Create an instance.- Parameters:
tc
- the currentKMLTraversalContext
.placemark
- the Placemark element containing the Point.geom
- theKMLPoint
geometry.- Throws:
java.lang.NullPointerException
- if the geometry is null.java.lang.IllegalArgumentException
- if the parent placemark or the traversal context is null.
-
-
Method Detail
-
preRender
public void preRender(KMLTraversalContext tc, DrawContext dc)
Description copied from interface:KMLRenderable
Pre-render this element.- Specified by:
preRender
in interfaceKMLRenderable
- 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 interfaceKMLRenderable
- Parameters:
tc
- the current KML traversal context.dc
- the current draw context.
-
determineActiveAttributes
protected void determineActiveAttributes()
Description copied from class:PointPlacemark
Determines which attributes -- normal, highlight or default -- to use each frame.- Overrides:
determineActiveAttributes
in classPointPlacemark
-
mustRefreshIcon
protected boolean mustRefreshIcon()
Indicates whether or not the icon resource has expired.- Returns:
- True if the icon has expired and must be refreshed.
-
initializeTexture
protected WWTexture initializeTexture(java.lang.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 classPointPlacemark
- 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.
-
createPickedObject
protected PickedObject createPickedObject(DrawContext dc, java.awt.Color pickColor)
Create aPickedObject
for this placemark. The PickedObject returned by this method will be added to the pick list to represent the current placemark.- Overrides:
createPickedObject
in classPointPlacemark
- Parameters:
dc
- Active draw context.pickColor
- Unique color for this PickedObject.- Returns:
- A new picked object.
-
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 classPointPlacemark
- Returns:
- True if the label must be drawn.
-
makeAttributesCurrent
protected PointPlacemarkAttributes makeAttributesCurrent(java.lang.String attrType)
Determine and set thePointPlacemark
attributes from the KML Feature fields.- Parameters:
attrType
- the type of attributes, eitherKMLConstants.NORMAL
orKMLConstants.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.
-
assemblePointAttributes
protected PointPlacemarkAttributes assemblePointAttributes(PointPlacemarkAttributes attrs, KMLIconStyle style)
-
assembleLineAttributes
protected PointPlacemarkAttributes assembleLineAttributes(PointPlacemarkAttributes attrs, KMLLineStyle style)
-
assembleLabelAttributes
protected PointPlacemarkAttributes assembleLabelAttributes(PointPlacemarkAttributes attrs, KMLLabelStyle style)
-
getInitialAttributes
protected PointPlacemarkAttributes getInitialAttributes(java.lang.String attrType)
Get the initial attributes for this feature. These attributes will be changed to reflect the feature's style.- Parameters:
attrType
-KMLConstants.NORMAL
orKMLConstants.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)
-
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()
-
onMessage
public void onMessage(Message message)
Description copied from class:WWObjectImpl
Empty implementation of MessageListener.- Specified by:
onMessage
in interfaceMessageListener
- Overrides:
onMessage
in classWWObjectImpl
- Parameters:
message
- The message that was received.
-
-