public class IconLayer extends AbstractLayer
IconLayer
class manages a collection of WWIcon
objects for
rendering and picking. IconLayer
delegates to its internal IconRenderer
for rendering and picking operations.WWIcon
,
IconRenderer
Modifier and Type | Field and Description |
---|---|
protected long |
frameId |
protected IconRenderer |
iconRenderer |
protected BasicQuadTree<WWIcon> |
icons |
protected java.lang.Iterable<WWIcon> |
iconsOverride |
protected java.util.HashMap<GlobeStateKey,java.util.Set<WWIcon>> |
lastActiveIconsLists |
Constructor and Description |
---|
IconLayer()
Creates a new
IconLayer with an empty collection of Icons. |
Modifier and Type | Method and Description |
---|---|
void |
addIcon(WWIcon icon)
Adds the specified
icon to this layer's internal collection. |
void |
addIcons(java.lang.Iterable<WWIcon> icons)
Adds the contents of the specified
icons to this layer's internal collection. |
protected void |
clearIcons() |
protected void |
doPick(DrawContext dc,
java.awt.Point pickPoint) |
protected void |
doRender(DrawContext dc) |
protected java.lang.Iterable<WWIcon> |
getActiveIcons(DrawContext dc)
Returns the Iterable of currently active Icons.
|
java.lang.Iterable<WWIcon> |
getIcons()
Returns the Iterable of Icons currently in use by this layer.
|
double |
getOpacity()
Returns the layer's opacity value, which is ignored by this layer the icon's image is assumed to indicate its
opacity.
|
Pedestal |
getPedestal()
Returns the
Pedestal used by this layers internal IconRenderer . |
boolean |
isAllowBatchPicking()
Indicates whether icons are picked as a batch and therefore a
SelectEvent will
contain only one icon from the layer. |
boolean |
isAlwaysUseAbsoluteElevation()
Indicates whether an icon's elevation is treated as an offset from the terrain or an absolute elevation above sea
level.
|
boolean |
isHorizonClippingEnabled()
Indicates whether horizon clipping is performed.
|
boolean |
isPickFrustumClippingEnabled()
Indicates whether picking volume clipping is performed.
|
boolean |
isRegionCulling()
Indicates whether the layer culls icons whose latitude-longitude location is outside the visible terrain area.
|
boolean |
isViewClippingEnabled()
Indicates whether view volume clipping is performed.
|
void |
removeAllIcons()
Clears the contents of this layer's internal Icon collection.
|
void |
removeIcon(WWIcon icon)
Removes the specified
icon from this layer's internal collection, if it exists. |
void |
setAllowBatchPicking(boolean allowBatchPicking)
Specifies whether batch picking is allowed.
|
void |
setAlwaysUseAbsoluteElevation(boolean alwaysUseAbsoluteElevation)
Normally, an icon's elevation is treated as an offset from the terrain when it is less than the globe's maximum
elevation.
|
void |
setHorizonClippingEnabled(boolean horizonClippingEnabled)
Indicates whether to render icons beyond the horizon.
|
void |
setIcons(java.lang.Iterable<WWIcon> iconIterable)
Overrides the collection of currently active Icons with the specified
iconIterable . |
void |
setOpacity(double opacity)
Opacity is not applied to layers of this type.
|
void |
setPedestal(Pedestal pedestal)
Sets the
Pedestal used by this layers internal IconRenderer . |
void |
setPickFrustumClippingEnabled(boolean pickFrustumClippingEnabled)
Indicates whether to render icons outside the picking volume when in pick mode.
|
void |
setRegionCulling(boolean regionCulling)
Indicates whether the layer culls icons whose latitude-longitude location is outside the visible terrain area.
|
void |
setViewClippingEnabled(boolean viewClippingEnabled)
Indicates whether to render icons outside the view volume.
|
java.lang.String |
toString() |
createLayerConfigElements, dispose, doPreRender, getDataFileStore, getExpiryTime, getLayerConfigParams, getMaxActiveAltitude, getMaxEffectiveAltitude, getMinActiveAltitude, getMinEffectiveAltitude, getName, getRestorableState, getScale, getScreenCredit, isAtMaxResolution, isEnabled, isLayerActive, isLayerConfigDocument, isLayerInView, isMultiResolution, isNetworkRetrievalEnabled, isPickEnabled, pick, preRender, render, restoreState, setDataFileStore, setEnabled, setExpiryTime, setMaxActiveAltitude, setMinActiveAltitude, setName, setNetworkRetrievalEnabled, setPickEnabled, setScreenCredit
onMessage, propertyChange
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
onMessage
protected long frameId
protected IconRenderer iconRenderer
protected final BasicQuadTree<WWIcon> icons
protected java.lang.Iterable<WWIcon> iconsOverride
protected java.util.HashMap<GlobeStateKey,java.util.Set<WWIcon>> lastActiveIconsLists
public IconLayer()
IconLayer
with an empty collection of Icons.public void addIcon(WWIcon icon)
icon
to this layer's internal collection. If this layer's internal collection has
been overridden with a call to setIcons(java.lang.Iterable<gov.nasa.worldwind.render.WWIcon>)
, this will throw an exception.icon
- Icon to add.java.lang.IllegalArgumentException
- If icon
is null.java.lang.IllegalStateException
- If a custom Iterable has been specified by a call to setIcons
.public void addIcons(java.lang.Iterable<WWIcon> icons)
icons
to this layer's internal collection. If this layer's
internal collection has been overriden with a call to setIcons(java.lang.Iterable<gov.nasa.worldwind.render.WWIcon>)
, this will throw an exception.icons
- Icons to add.java.lang.IllegalArgumentException
- If icons
is null.java.lang.IllegalStateException
- If a custom Iterable has been specified by a call to setIcons
.protected void clearIcons()
protected void doPick(DrawContext dc, java.awt.Point pickPoint)
doPick
in class AbstractLayer
protected void doRender(DrawContext dc)
doRender
in class AbstractLayer
protected java.lang.Iterable<WWIcon> getActiveIcons(DrawContext dc)
setIcons(java.lang.Iterable<gov.nasa.worldwind.render.WWIcon>)
, this will returns a reference to that Iterable. If the caller passed setIcons
a null
parameter, or if setIcons
has not been called, this returns a view of this layer's internal
collection of Icons, culled to eliminate those outside the current sector geometry.dc
- a current DrawContext.public java.lang.Iterable<WWIcon> getIcons()
setIcons(java.lang.Iterable<gov.nasa.worldwind.render.WWIcon>)
, this will returns a reference to that Iterable. If the caller passed setIcons
a
null parameter, or if setIcons
has not been called, this returns a view of this layer's internal
collection of Icons. The view has no definitive order and may contain duplicate entries.public double getOpacity()
getOpacity
in interface Layer
getOpacity
in class AbstractLayer
public Pedestal getPedestal()
Pedestal
used by this layers internal IconRenderer
.Pedestal
used by this layers internal IconRenderer
.public boolean isAllowBatchPicking()
SelectEvent
will
contain only one icon from the layer. Batch picking is much faster than individual picking, so this attribute
should be used judiciously.setAllowBatchPicking(boolean)
public boolean isAlwaysUseAbsoluteElevation()
true
if icon elevations are treated as absolute, false
if they're treated as
offsets from the terrain.public boolean isHorizonClippingEnabled()
true
if horizon clipping is performed, otherwise false
.setHorizonClippingEnabled(boolean)
public boolean isPickFrustumClippingEnabled()
true
if picking volume clipping is performed, otherwise false
.setViewClippingEnabled(boolean)
public boolean isRegionCulling()
setRegionCulling(boolean)
for a fuller description of region culling.public boolean isViewClippingEnabled()
true
if view volume clipping is performed, otherwise false
.setViewClippingEnabled(boolean)
public void removeAllIcons()
setIcons(java.lang.Iterable<gov.nasa.worldwind.render.WWIcon>)
, this will throw an exception.java.lang.IllegalStateException
- If a custom Iterable has been specified by a call to setIcons
.public void removeIcon(WWIcon icon)
icon
from this layer's internal collection, if it exists. If this layer's
internal collection has been overriden with a call to setIcons(java.lang.Iterable<gov.nasa.worldwind.render.WWIcon>)
, this will throw an exception.icon
- Icon to remove.java.lang.IllegalArgumentException
- If icon
is null.java.lang.IllegalStateException
- If a custom Iterable has been specified by a call to setIcons
.public void setAllowBatchPicking(boolean allowBatchPicking)
SelectEvent
from the layer
will contain only one icon even if several overlapping icons are at the pick point. Batch picking is much faster
than individual picking so the default value is true.allowBatchPicking
- true if batch picking is allowed, otherwise false.public void setAlwaysUseAbsoluteElevation(boolean alwaysUseAbsoluteElevation)
true
causes the elevation to be treated as an
absolute elevation above sea level.alwaysUseAbsoluteElevation
- true
to treat icon elevations as absolute, false
to
treat them as offsets from the terrain.public void setHorizonClippingEnabled(boolean horizonClippingEnabled)
false
, horizon clipping is not performed.horizonClippingEnabled
- true
if horizon clipping should be performed, otherwise
false
.setViewClippingEnabled(boolean)
public void setIcons(java.lang.Iterable<WWIcon> iconIterable)
iconIterable
. This layer will
maintain a reference to iconIterable
strictly for picking and rendering. This layer will not modify
the Iterable reference. However, this will clear the internal collection of Icons, and will prevent any
modification to its contents via addIcon, addIcons, or removeIcons
.
If the specified iconIterable
is null, this layer will revert to maintaining its internal
collection.
iconIterable
- Iterable to use instead of this layer's internal collection, or null to use this layer's
internal collection.public void setOpacity(double opacity)
setOpacity
in interface Layer
setOpacity
in class AbstractLayer
opacity
- the current opacity value, which is ignored by this layer.public void setPedestal(Pedestal pedestal)
Pedestal
used by this layers internal IconRenderer
.pedestal
- Pedestal
to be used by this layers internal IconRenderer
.public void setPickFrustumClippingEnabled(boolean pickFrustumClippingEnabled)
false
, picking volume clipping is not performed.pickFrustumClippingEnabled
- true
if picking clipping should be performed, otherwise
false
.public void setRegionCulling(boolean regionCulling)
regionCulling
- true if region culling is performed, otherwise false.public void setViewClippingEnabled(boolean viewClippingEnabled)
false
, view volume clipping
is not performed.viewClippingEnabled
- true
if view clipping should be performed, otherwise false
.setHorizonClippingEnabled(boolean)
public java.lang.String toString()
toString
in class AbstractLayer