public class IconRenderer
extends java.lang.Object
WWIcon
instances for picking and rendering.
IconRenderer applies batch processing techniques to improve the runtime performance of picking and rendering large
collections of icons.
During the draw pass, IconRenderer records feedback information for each WWIcon which has the property key AVKey.FEEDBACK_ENABLED
set to true
. IconRenderer does not record any feedback
information during the pick pass. When feedback is enabled, IconRenderer puts properties which describe how each
WWIcon has been processed in key-value pairs attached to the WWIcon. Any of these properties may be null, indicating
that processing of the WWIcon was terminated before this information became available. The feedback properties for
WWIcon are as follows:
Key | Description |
---|---|
AVKey.FEEDBACK_REFERENCE_POINT | The icon's reference point in model coordinates. |
AVKey.FEEDBACK_SCREEN_BOUNDS | The icon's bounding rectangle in screen coordinates. |
Modifier and Type | Class and Description |
---|---|
protected class |
IconRenderer.OrderedIcon |
protected class |
IconRenderer.OrderedText |
Modifier and Type | Field and Description |
---|---|
protected boolean |
allowBatchPicking |
protected boolean |
alwaysUseAbsoluteElevation |
protected boolean |
horizonClippingEnabled |
protected OGLStackHandler |
oglStackHandler |
protected Pedestal |
pedestal |
protected boolean |
pickFrustumClippingEnabled |
protected PickSupport |
pickSupport |
protected boolean |
viewClippingEnabled |
Constructor and Description |
---|
IconRenderer() |
Modifier and Type | Method and Description |
---|---|
protected void |
addToolTip(DrawContext dc,
WWIcon icon,
Vec4 iconPoint) |
protected void |
applyBackground(DrawContext dc,
WWIcon icon,
Vec4 screenPoint,
double width,
double height,
double pedestalSpacing,
double pedestalScale) |
protected void |
beginDrawIcons(DrawContext dc) |
protected void |
doRecordFeedback(DrawContext dc,
WWIcon icon,
Vec4 modelPoint,
java.awt.Rectangle screenRect)
Records feedback about how the specified WWIcon has been processed.
|
protected Vec4 |
drawIcon(DrawContext dc,
IconRenderer.OrderedIcon uIcon) |
protected void |
drawIconsInBatch(DrawContext dc,
IconRenderer.OrderedIcon uIcon) |
protected void |
drawMany(DrawContext dc,
java.lang.Iterable<? extends WWIcon> icons,
Layer layer) |
protected void |
endDrawIcons(DrawContext dc) |
Pedestal |
getPedestal() |
boolean |
isAllowBatchPicking()
Indicates whether icons are picked as a batch and therefore a
SelectEvent will
contain only one icon from a given layer. |
boolean |
isAlwaysUseAbsoluteElevation()
Indicates whether an icon's elevation is treated as an offset from the terrain or an absolute elevation above sea
level.
|
protected boolean |
isFeedbackEnabled(DrawContext dc,
WWIcon icon)
Returns true if the IconRenderer should record feedback about how the specified WWIcon has been processed.
|
boolean |
isHorizonClippingEnabled()
Indicates whether horizon clipping is performed.
|
protected static boolean |
isIconValid(WWIcon icon,
boolean checkPosition) |
boolean |
isPickFrustumClippingEnabled()
Indicates whether picking volume clipping is performed.
|
boolean |
isViewClippingEnabled()
Indicates whether view volume clipping is performed.
|
void |
pick(DrawContext dc,
java.lang.Iterable<? extends WWIcon> icons,
java.awt.Point pickPoint,
Layer layer) |
protected void |
pickIconsInBatch(DrawContext dc,
IconRenderer.OrderedIcon uIcon) |
protected void |
recordFeedback(DrawContext dc,
WWIcon icon,
Vec4 modelPoint,
java.awt.Rectangle screenRect)
If feedback is enabled for the specified WWIcon, this method records feedback about how the specified WWIcon has
been processed.
|
void |
render(DrawContext dc,
java.lang.Iterable<? extends WWIcon> icons) |
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.
|
protected void |
setDepthFunc(DrawContext dc,
IconRenderer.OrderedIcon uIcon,
Vec4 screenPoint) |
void |
setHorizonClippingEnabled(boolean horizonClippingEnabled)
Indicates whether to render icons beyond the horizon.
|
void |
setPedestal(Pedestal pedestal) |
void |
setPickFrustumClippingEnabled(boolean pickFrustumClippingEnabled)
Indicates whether to render icons outside the picking volume when in pick mode.
|
void |
setViewClippingEnabled(boolean viewClippingEnabled)
Indicates whether to render icons outside the view volume.
|
java.lang.String |
toString() |
protected boolean allowBatchPicking
protected boolean alwaysUseAbsoluteElevation
protected boolean horizonClippingEnabled
protected OGLStackHandler oglStackHandler
protected Pedestal pedestal
protected boolean pickFrustumClippingEnabled
protected PickSupport pickSupport
protected boolean viewClippingEnabled
protected void addToolTip(DrawContext dc, WWIcon icon, Vec4 iconPoint)
protected void applyBackground(DrawContext dc, WWIcon icon, Vec4 screenPoint, double width, double height, double pedestalSpacing, double pedestalScale)
protected void beginDrawIcons(DrawContext dc)
protected void doRecordFeedback(DrawContext dc, WWIcon icon, Vec4 modelPoint, java.awt.Rectangle screenRect)
dc
- the current DrawContext.icon
- the icon which the feedback information refers to.modelPoint
- the icon's reference point in model coordinates.screenRect
- the icon's bounding rectangle in screen coordinates.protected Vec4 drawIcon(DrawContext dc, IconRenderer.OrderedIcon uIcon)
protected void drawIconsInBatch(DrawContext dc, IconRenderer.OrderedIcon uIcon)
protected void drawMany(DrawContext dc, java.lang.Iterable<? extends WWIcon> icons, Layer layer)
protected void endDrawIcons(DrawContext dc)
public Pedestal getPedestal()
public boolean isAllowBatchPicking()
SelectEvent
will
contain only one icon from a given 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.protected boolean isFeedbackEnabled(DrawContext dc, WWIcon icon)
dc
- the current DrawContext.icon
- the WWIcon to record feedback information for.public boolean isHorizonClippingEnabled()
true
if horizon clipping is performed, otherwise false
.setHorizonClippingEnabled(boolean)
protected static boolean isIconValid(WWIcon icon, boolean checkPosition)
public boolean isPickFrustumClippingEnabled()
true
if picking volume clipping is performed, otherwise false
.setPickFrustumClippingEnabled(boolean)
public boolean isViewClippingEnabled()
true
if view volume clipping is performed, otherwise false
.setViewClippingEnabled(boolean)
public void pick(DrawContext dc, java.lang.Iterable<? extends WWIcon> icons, java.awt.Point pickPoint, Layer layer)
protected void pickIconsInBatch(DrawContext dc, IconRenderer.OrderedIcon uIcon)
protected void recordFeedback(DrawContext dc, WWIcon icon, Vec4 modelPoint, java.awt.Rectangle screenRect)
dc
- the current DrawContext.icon
- the icon which the feedback information refers to.modelPoint
- the icon's reference point in model coordinates.screenRect
- the icon's bounding rectangle in screen coordinates.public void render(DrawContext dc, java.lang.Iterable<? extends WWIcon> icons)
public void setAllowBatchPicking(boolean allowBatchPicking)
SelectEvent
from a 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.protected void setDepthFunc(DrawContext dc, IconRenderer.OrderedIcon uIcon, Vec4 screenPoint)
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 setPedestal(Pedestal pedestal)
public void setPickFrustumClippingEnabled(boolean pickFrustumClippingEnabled)
false
, picking volume clipping is not performed.pickFrustumClippingEnabled
- true
if picking clipping should be performed, otherwise
false
.public void setViewClippingEnabled(boolean viewClippingEnabled)
true
, 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 java.lang.Object