public abstract class AbstractShape extends WWObjectImpl implements Highlightable, OrderedRenderable, Movable, Movable2, ExtentHolder, GeographicExtent, Exportable, Restorable, PreRenderable, Attributable, Draggable
Renderable
s. Implements common
attribute handling and rendering flow for outlined shapes. Provides common defaults and common export code.
In order to support simultaneous use of this shape with multiple globes (windows), this shape maintains a cache of
data computed relative to each globe. During rendering, the data for the currently active globe, as indicated in the
draw context, is made current. Subsequently called methods rely on the existence of this current data cache entry.Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractShape.AbstractShapeData
Holds the globe-dependent data captured in this shape's data cache.
|
Modifier and Type | Field and Description |
---|---|
protected ShapeAttributes |
activeAttributes
The attributes active for a particular pick and render pass.
|
protected int |
altitudeMode |
protected OGLStackHandler |
BEogsh |
protected AbstractShape.AbstractShapeData |
currentData
Identifies the active globe-dependent data for the current invocation of
render(DrawContext) . |
protected static int |
DEFAULT_ALTITUDE_MODE
The default altitude mode.
|
protected static int |
DEFAULT_GEOMETRY_GENERATION_INTERVAL
The default geometry regeneration interval.
|
protected static Material |
DEFAULT_HIGHLIGHT_MATERIAL
The default highlight color.
|
protected static Material |
DEFAULT_INTERIOR_MATERIAL
The default interior color.
|
protected static Material |
DEFAULT_OUTLINE_MATERIAL
The default outline color.
|
protected static int |
DEFAULT_OUTLINE_PICK_WIDTH
The default outline pick width.
|
protected static ShapeAttributes |
defaultAttributes
The attributes used if attributes are not specified.
|
protected java.lang.Object |
delegateOwner |
protected boolean |
dragEnabled |
protected DraggableSupport |
draggableSupport |
protected boolean |
enableBatchPicking |
protected boolean |
enableBatchRendering |
protected boolean |
enableDepthOffset |
protected ShapeAttributes |
highlightAttrs
This shape's highlighted attributes.
|
protected boolean |
highlighted |
protected long |
maxExpiryTime |
protected long |
minExpiryTime |
protected ShapeAttributes |
normalAttrs
This shape's normal, non-highlighted attributes.
|
protected int |
outlinePickWidth |
protected OutlinedShape |
outlineShapeRenderer
Outlined shapes are drawn as
OutlinedShape s. |
protected Layer |
pickLayer |
protected PickSupport |
pickSupport |
protected Position |
referencePosition |
protected Sector |
sector |
protected ShapeDataCache |
shapeDataCache
Holds globe-dependent computed data.
|
protected SurfaceShape |
surfaceShape |
protected static int |
VBO_THRESHOLD
Indicates the number of vertices that must be present in order for VBOs to be used to render this shape.
|
protected boolean |
viewDistanceExpiration |
protected boolean |
visible |
FORMAT_NOT_SUPPORTED, FORMAT_PARTIALLY_SUPPORTED, FORMAT_SUPPORTED
Modifier | Constructor and Description |
---|---|
protected |
AbstractShape()
Invokes
initialize() during construction and sets the data cache's expiration time to a default value. |
protected |
AbstractShape(AbstractShape source) |
Modifier and Type | Method and Description |
---|---|
protected void |
addOrderedRenderable(DrawContext dc)
Adds this shape to the draw context's ordered renderable list.
|
protected OGLStackHandler |
beginDrawing(DrawContext dc,
int attrMask)
Establish the OpenGL state needed to draw this shape.
|
protected void |
checkViewDistanceExpiration(DrawContext dc)
Determines whether this shape's geometry should be invalidated because the view distance changed, and if so,
invalidates the geometry.
|
protected void |
clearCachedVbos(DrawContext dc)
Removes from the GPU resource cache the entry for the current data cache entry's VBOs.
|
protected Extent |
computeExtentFromPositions(Globe globe,
double verticalExaggeration,
java.lang.Iterable<? extends LatLon> positions)
Computes this shape's approximate extent from its positions.
|
protected Vec4 |
computePoint(DrawContext dc,
Terrain terrain,
Position position)
Computes a model-coordinate point from a position, applying this shape's altitude mode, and using
CLAMP_TO_GROUND if the current globe is 2D. |
protected Vec4 |
computePoint(Terrain terrain,
Position position)
Computes a model-coordinate point from a position, applying this shape's altitude mode.
|
protected int |
countTriangleVertices(java.util.List<java.util.List<java.lang.Integer>> prims,
java.util.List<java.lang.Integer> primTypes) |
protected abstract AbstractShape.AbstractShapeData |
createCacheEntry(DrawContext dc)
Creates and returns a new cache entry specific to the subclass.
|
protected PickedObject |
createPickedObject(int colorCode)
Creates a
PickedObject for this shape and the specified unique pick color code. |
protected SurfaceShape |
createSurfaceShape()
Returns a
SurfaceShape that corresponds to this Path and is used for drawing on 2D globes. |
protected void |
determineActiveAttributes()
Determines which attributes -- normal, highlight or default -- to use each frame.
|
protected void |
doDrag(DragContext dragContext) |
protected abstract void |
doDrawInterior(DrawContext dc)
Draws this shape's interior.
|
protected void |
doDrawOrderedRenderable(DrawContext dc,
PickSupport pickCandidates)
Draw this shape as an ordered renderable.
|
protected abstract void |
doDrawOutline(DrawContext dc)
Draws this shape's outline.
|
protected abstract void |
doExportAsKML(javax.xml.stream.XMLStreamWriter xmlWriter)
Exports shape-specific fields.
|
protected void |
doGetRestorableState(RestorableSupport rs,
RestorableSupport.StateObject context) |
protected abstract boolean |
doMakeOrderedRenderable(DrawContext dc)
Produces the geometry and other state necessary to represent this shape as an ordered renderable.
|
protected void |
doRestoreState(RestorableSupport rs,
RestorableSupport.StateObject context) |
void |
drag(DragContext dragContext)
Drag the object given the provided
DragContext . |
protected void |
drawBatched(DrawContext dc)
Draws this ordered renderable and all subsequent Path ordered renderables in the ordered renderable list.
|
protected void |
drawInterior(DrawContext dc)
Draws this shape's interior.
|
protected void |
drawOrderedRenderable(DrawContext dc)
Draws this shape as an ordered renderable.
|
protected void |
drawOutline(DrawContext dc)
Draws this shape's outline.
|
protected void |
endDrawing(DrawContext dc)
Pop the state set in
beginDrawing(DrawContext, int) . |
void |
export(java.lang.String mimeType,
java.lang.Object output)
Exports the object to a format.
|
protected void |
exportAsKML(java.lang.Object output)
Export the placemark to KML as a
<Placemark> element. |
protected abstract void |
fillVBO(DrawContext dc)
Fill this shape's vertex buffer objects.
|
ShapeAttributes |
getActiveAttributes()
Returns this shape's currently active attributes, as determined during the most recent call to
determineActiveAttributes() . |
int |
getAltitudeMode()
Returns this shape's altitude mode.
|
ShapeAttributes |
getAttributes()
Returns this shape's normal (as opposed to highlight) attributes.
|
protected AbstractShape.AbstractShapeData |
getCurrentData()
Returns the data cache entry for the current rendering.
|
java.lang.Object |
getDelegateOwner() |
double |
getDistanceFromEye()
Returns the ordered renderable's distance from the current view's eye point.
|
Extent |
getExtent()
Returns this shape's extent in model coordinates.
|
Extent |
getExtent(Globe globe,
double verticalExaggeration)
Returns the objects enclosing volume as an
Extent in model coordinates, given a
specified Globe and vertical exaggeration (see SceneController.getVerticalExaggeration() . |
long |
getGeometryRegenerationInterval()
Indicates the maximum length of time between geometry regenerations.
|
ShapeAttributes |
getHighlightAttributes()
Returns this shape's highlight attributes.
|
int |
getOutlinePickWidth()
Indicates the outline line width to use during picking.
|
Vec4 |
getReferencePoint()
Returns the Cartesian coordinates of this shape's reference position as computed during the most recent
rendering.
|
java.lang.String |
getRestorableState()
Returns an XML document string describing the object's state.
|
protected int[] |
getVboIds(DrawContext dc)
Get or create OpenGL resource IDs for the current data cache entry.
|
protected abstract void |
initialize()
Called during construction to establish any subclass-specific state such as different default values than those
set by this class.
|
abstract java.util.List<Intersection> |
intersect(Line line,
Terrain terrain)
Compute the intersections of a specified line with this shape.
|
protected boolean |
intersectsFrustum(DrawContext dc)
Determines whether this shape intersects the view frustum.
|
boolean |
isDragEnabled()
Indicates whether the object is enabled for dragging.
|
boolean |
isEnableBatchPicking()
Indicates whether batch picking is enabled.
|
boolean |
isEnableBatchRendering()
Indicates whether batch rendering is enabled for the concrete shape type of this shape.
|
boolean |
isEnableDepthOffset()
Indicates whether the filled sides of this shape should be offset towards the viewer to help eliminate artifacts
when two or more faces of this or other filled shapes are coincident.
|
java.lang.String |
isExportFormatSupported(java.lang.String mimeType)
Does this object support a certain export format?
|
boolean |
isHighlighted()
Indicates whether to highlight the shape.
|
protected abstract boolean |
isOrderedRenderableValid(DrawContext dc)
Determines whether this shape's ordered renderable state is valid and can be rendered.
|
protected boolean |
isTerrainDependent()
Indicates whether this shape's geometry depends on the terrain.
|
boolean |
isViewDistanceExpiration()
Indicates whether this shape's terrain-dependent geometry is continually computed as its distance from the eye
point changes.
|
boolean |
isVisible()
Indicates whether this shape is drawn during rendering.
|
protected void |
makeOrderedRenderable(DrawContext dc)
Determines whether to add this shape to the draw context's ordered renderable list.
|
protected WWTexture |
makeTexture(java.lang.Object imageSource)
Creates a
WWTexture for a specified image source. |
void |
move(Position delta)
Shift the shape over the globe's surface while maintaining its original azimuth, its orientation relative to
North.
|
void |
moveTo(Globe globe,
Position position)
Move the shape over the globe's surface while maintaining its original azimuth, its orientation relative to
North.
|
protected boolean |
mustApplyLighting(DrawContext dc)
Indicates whether standard lighting must be applied by consulting the current active attributes.
|
protected boolean |
mustApplyLighting(DrawContext dc,
ShapeAttributes activeAttrs)
Indicates whether standard lighting must be applied by consulting either the specified active attributes or the
current active attributes.
|
protected abstract boolean |
mustApplyTexture(DrawContext dc)
Indicates whether texture should be applied to this shape.
|
protected boolean |
mustCreateNormals(DrawContext dc)
Indicates whether normal vectors must be computed by consulting the current active attributes.
|
protected boolean |
mustCreateNormals(DrawContext dc,
ShapeAttributes activeAttrs)
Indicates whether normal vectors must be computed by consulting either the specified active attributes or the
current active attributes.
|
protected boolean |
mustDrawInterior()
Indicates whether this shape's interior must be drawn.
|
protected boolean |
mustDrawOutline()
Indicates whether this shape's outline must be drawn.
|
protected boolean |
mustRegenerateGeometry(DrawContext dc)
Indicates whether this shape's renderable geometry must be recomputed, either as a result of an attribute or
property change or the expiration of the geometry regeneration interval.
|
void |
pick(DrawContext dc,
java.awt.Point pickPoint)
Executes a pick of the ordered renderable.
|
protected void |
prepareToDrawInterior(DrawContext dc,
ShapeAttributes activeAttrs,
ShapeAttributes defaultAttrs)
Establishes OpenGL state for drawing the interior, including setting the color/material.
|
protected void |
prepareToDrawOutline(DrawContext dc,
ShapeAttributes activeAttrs,
ShapeAttributes defaultAttrs)
Establishes OpenGL state for drawing the outline, including setting the color/material, line smoothing, line
width and stipple.
|
void |
preRender(DrawContext dc) |
void |
render(DrawContext dc)
Causes this
Renderable to render itself using the provided draw context. |
protected void |
reset()
Invalidates computed values.
|
void |
restoreState(java.lang.String stateInXml)
Restores the object's state to what is described in the specified XML document string.
|
void |
setAltitudeMode(int altitudeMode)
Specifies this shape's altitude mode, one of
WorldWind.ABSOLUTE , WorldWind.RELATIVE_TO_GROUND or
WorldWind.CLAMP_TO_GROUND . |
void |
setAttributes(ShapeAttributes normalAttrs)
Specifies this shape's normal (as opposed to highlight) attributes.
|
void |
setDelegateOwner(java.lang.Object delegateOwner) |
void |
setDragEnabled(boolean enabled)
Controls whether the object is enabled for dragging.
|
void |
setEnableBatchPicking(boolean enableBatchPicking)
Specifies whether adjacent shapes of this shape's concrete type in the ordered renderable list may be pick-tested
together if they are contained in the same layer.
|
void |
setEnableBatchRendering(boolean enableBatchRendering)
Specifies whether adjacent shapes of this shape's concrete type in the ordered renderable list may be rendered
together if they are contained in the same layer.
|
void |
setEnableDepthOffset(boolean enableDepthOffset)
Specifies whether the filled sides of this shape should be offset towards the viewer to help eliminate artifacts
when two or more faces of this or other filled shapes are coincident.
|
void |
setGeometryRegenerationInterval(int geometryRegenerationInterval)
Specifies the maximum length of time between geometry regenerations.
|
void |
setHighlightAttributes(ShapeAttributes highlightAttrs)
Specifies this shape's highlight attributes.
|
void |
setHighlighted(boolean highlighted)
Specifies whether to highlight the shape.
|
void |
setOutlinePickWidth(int outlinePickWidth)
Specifies the outline line width to use during picking.
|
void |
setReferencePosition(Position referencePosition)
Specifies the position to use as a reference position for computed geometry.
|
void |
setViewDistanceExpiration(boolean viewDistanceExpiration)
Specifies whether this shape's terrain-dependent geometry is continually computed as its distance from the eye
point changes.
|
void |
setVisible(boolean visible)
Specifies whether this shape is drawn during rendering.
|
protected boolean |
shouldUseVBOs(DrawContext dc)
Indicates whether this shape should use OpenGL vertex buffer objects.
|
protected void |
updateSurfaceShape()
Sets surface shape parameters prior to picking and rendering the 2D shape used to represent this shape on 2D
globes.
|
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, toString, wait, wait, wait
getReferencePosition, moveTo
getReferencePosition
getSector
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
protected ShapeAttributes activeAttributes
protected int altitudeMode
protected OGLStackHandler BEogsh
protected AbstractShape.AbstractShapeData currentData
render(DrawContext)
. The active
data is drawn from this shape's data cache at the beginning of the render
method.protected static final int DEFAULT_ALTITUDE_MODE
protected static final int DEFAULT_GEOMETRY_GENERATION_INTERVAL
protected static final Material DEFAULT_HIGHLIGHT_MATERIAL
protected static final Material DEFAULT_INTERIOR_MATERIAL
protected static final Material DEFAULT_OUTLINE_MATERIAL
protected static final int DEFAULT_OUTLINE_PICK_WIDTH
protected static ShapeAttributes defaultAttributes
protected java.lang.Object delegateOwner
protected boolean dragEnabled
protected DraggableSupport draggableSupport
protected boolean enableBatchPicking
protected boolean enableBatchRendering
protected boolean enableDepthOffset
protected ShapeAttributes highlightAttrs
protected boolean highlighted
protected long maxExpiryTime
protected long minExpiryTime
protected ShapeAttributes normalAttrs
protected int outlinePickWidth
protected OutlinedShape outlineShapeRenderer
OutlinedShape
s.protected Layer pickLayer
protected PickSupport pickSupport
protected Position referencePosition
protected Sector sector
protected ShapeDataCache shapeDataCache
render(DrawContext)
.protected SurfaceShape surfaceShape
protected static final int VBO_THRESHOLD
protected boolean viewDistanceExpiration
protected boolean visible
protected AbstractShape()
initialize()
during construction and sets the data cache's expiration time to a default value.protected AbstractShape(AbstractShape source)
protected void addOrderedRenderable(DrawContext dc)
dc
- the current draw context.protected OGLStackHandler beginDrawing(DrawContext dc, int attrMask)
AbstractShape.AbstractShapeData
must be current when this method is called.dc
- the current draw context.attrMask
- an attribute mask indicating state the caller will set. This base class implementation sets
GL_CURRENT_BIT, GL_LINE_BIT, GL_HINT_BIT, GL_POLYGON_BIT, GL_COLOR_BUFFER_BIT, and
GL_TRANSFORM_BIT
.protected void checkViewDistanceExpiration(DrawContext dc)
dc
- the current draw context.protected void clearCachedVbos(DrawContext dc)
AbstractShape.AbstractShapeData
must be current when this method is called.dc
- the current draw context.protected Extent computeExtentFromPositions(Globe globe, double verticalExaggeration, java.lang.Iterable<? extends LatLon> positions)
globe
- the globe to use to compute the extent.verticalExaggeration
- the vertical exaggeration to apply to computed terrain points.positions
- the positions to compute the extent for.globe
or
positions
is null.protected Vec4 computePoint(DrawContext dc, Terrain terrain, Position position)
CLAMP_TO_GROUND
if the current globe is 2D.dc
- the current draw context.terrain
- the terrain to compute a point relative to the globe's surface.position
- the position to compute a point for.protected Vec4 computePoint(Terrain terrain, Position position)
terrain
- the terrain to compute a point relative to the globe's surface.position
- the position to compute a point for.protected int countTriangleVertices(java.util.List<java.util.List<java.lang.Integer>> prims, java.util.List<java.lang.Integer> primTypes)
protected abstract AbstractShape.AbstractShapeData createCacheEntry(DrawContext dc)
dc
- the current draw context.protected PickedObject createPickedObject(int colorCode)
PickedObject
for this shape and the specified unique pick color code.
The PickedObject returned by this method will be added to the pick list to represent the current shape.colorCode
- the unique color code for this shape.protected SurfaceShape createSurfaceShape()
SurfaceShape
that corresponds to this Path and is used for drawing on 2D globes.protected void determineActiveAttributes()
getActiveAttributes()
protected void doDrag(DragContext dragContext)
protected abstract void doDrawInterior(DrawContext dc)
prepareToDrawInterior(DrawContext,
ShapeAttributes, ShapeAttributes)
, which establishes OpenGL state for lighting, blending, pick color and
interior attributes. Subclasses should execute the drawing commands specific to the type of shape.
A AbstractShape.AbstractShapeData
must be current when this method is called.dc
- the current draw context.protected void doDrawOrderedRenderable(DrawContext dc, PickSupport pickCandidates)
PickSupport
. The PickSupport
may not be the one associated with this instance. During batch
picking the PickSupport
of the instance initiating the batch picking is used so that all shapes
rendered in batch are added to the same pick list.
A AbstractShape.AbstractShapeData
must be current when this method is called.dc
- the current draw context.pickCandidates
- a pick support holding the picked object list to add this shape to.protected abstract void doDrawOutline(DrawContext dc)
prepareToDrawOutline(DrawContext,
ShapeAttributes, ShapeAttributes)
, which establishes OpenGL state for lighting, blending, pick color and line
attributes. Subclasses should execute the drawing commands specific to the type of shape.
A AbstractShape.AbstractShapeData
must be current when this method is called.dc
- the current draw context.protected abstract void doExportAsKML(javax.xml.stream.XMLStreamWriter xmlWriter) throws java.io.IOException, javax.xml.stream.XMLStreamException
xmlWriter
- the export writer to write to.java.io.IOException
- if an IO error occurs while writing to the output destination.javax.xml.stream.XMLStreamException
- if an exception occurs converting this shape's fields to XML.protected void doGetRestorableState(RestorableSupport rs, RestorableSupport.StateObject context)
protected abstract boolean doMakeOrderedRenderable(DrawContext dc)
pick(DrawContext, java.awt.Point)
and render(DrawContext)
when it's been determined that the shape is
likely to be visible.dc
- the current draw context.pick(DrawContext, java.awt.Point)
,
render(DrawContext)
protected void doRestoreState(RestorableSupport rs, RestorableSupport.StateObject context)
public void drag(DragContext dragContext)
Draggable
DragContext
.drag
in interface Draggable
dragContext
- the DragContext
of this dragging event.protected void drawBatched(DrawContext dc)
AbstractShape.AbstractShapeData
must be current when this method is called.dc
- the current draw context.protected void drawInterior(DrawContext dc)
AbstractShape.AbstractShapeData
must be current when this method is called.dc
- the current draw context.protected void drawOrderedRenderable(DrawContext dc)
AbstractShape.AbstractShapeData
must be current when this method is called.dc
- the current draw context.protected void drawOutline(DrawContext dc)
AbstractShape.AbstractShapeData
must be current when this method is called.dc
- the current draw context.protected void endDrawing(DrawContext dc)
beginDrawing(DrawContext, int)
.
A AbstractShape.AbstractShapeData
must be current when this method is called.dc
- the current draw context.public void export(java.lang.String mimeType, java.lang.Object output) throws java.io.IOException, java.lang.UnsupportedOperationException
Exportable
export
in interface Exportable
mimeType
- Desired export format. Call Exportable.isExportFormatSupported(String)
to make sure that the object
supports the format before trying to export, or be prepared to handle UnsupportedOperationException
.output
- Object that will receive the exported data. The type of this object depends on the export format.
All formats should support java.io.OutputStream
. Text based format (for example, XML
formats) should also support java.io.Writer
. Certain formats may also support other
object types.java.io.IOException
- if an exception occurs while exporting the data.java.lang.UnsupportedOperationException
- if the format is not supported by this object, or if the output
argument is not of a supported type.Exportable.isExportFormatSupported(String)
protected void exportAsKML(java.lang.Object output) throws java.io.IOException, javax.xml.stream.XMLStreamException
<Placemark>
element. The output
object will receive the data.
This object must be one of: java.io.Writer java.io.OutputStream javax.xml.stream.XMLStreamWriteroutput
- Object to receive the generated KML.javax.xml.stream.XMLStreamException
- If an exception occurs while writing the KMLjava.io.IOException
- if an exception occurs while exporting the data.export(String, Object)
protected abstract void fillVBO(DrawContext dc)
AbstractShape.AbstractShapeData
must be current when this method is called.dc
- the current draw context.public ShapeAttributes getActiveAttributes()
determineActiveAttributes()
. The active attributes are either the normal or highlight attributes, depending on
this shape's highlight flag, and incorporates default attributes for those not specified in the applicable
attribute set.public int getAltitudeMode()
setAltitudeMode(int)
public ShapeAttributes getAttributes()
getAttributes
in interface Attributable
protected AbstractShape.AbstractShapeData getCurrentData()
public java.lang.Object getDelegateOwner()
public double getDistanceFromEye()
OrderedRenderable
getDistanceFromEye
in interface OrderedRenderable
public Extent getExtent()
public Extent getExtent(Globe globe, double verticalExaggeration)
ExtentHolder
Extent
in model coordinates, given a
specified Globe
and vertical exaggeration (see SceneController.getVerticalExaggeration()
.getExtent
in interface ExtentHolder
globe
- the Globe the object is related to.verticalExaggeration
- the vertical exaggeration of the scene containing this object.public long getGeometryRegenerationInterval()
setGeometryRegenerationInterval(int)
for the regeneration-interval's description.setGeometryRegenerationInterval(int)
public ShapeAttributes getHighlightAttributes()
getHighlightAttributes
in interface Attributable
public int getOutlinePickWidth()
public Vec4 getReferencePoint()
public java.lang.String getRestorableState()
Restorable
restoreState
and passing the XML document.getRestorableState
in interface Restorable
protected int[] getVboIds(DrawContext dc)
AbstractShape.AbstractShapeData
must be current when this method is called.dc
- the current draw context.protected abstract void initialize()
public abstract java.util.List<Intersection> intersect(Line line, Terrain terrain) throws java.lang.InterruptedException
WorldWind.ABSOLUTE
, the shape's geometry is created relative to the specified terrain rather than the terrain
used during rendering, which may be at lower level of detail than required for accurate intersection
determination.line
- the line to intersect.terrain
- the Terrain
to use when computing the shape's geometry.java.lang.InterruptedException
- if the operation is interrupted.Terrain
protected boolean intersectsFrustum(DrawContext dc)
AbstractShape.AbstractShapeData
must be current when this method is called.dc
- the current draw context.public boolean isDragEnabled()
Draggable
isDragEnabled
in interface Draggable
public boolean isEnableBatchPicking()
setEnableBatchPicking(boolean).
public boolean isEnableBatchRendering()
setEnableBatchRendering(boolean).
public boolean isEnableDepthOffset()
public java.lang.String isExportFormatSupported(java.lang.String mimeType)
Exportable
isExportFormatSupported
in interface Exportable
mimeType
- Desired export format.Exportable.FORMAT_SUPPORTED
, Exportable.FORMAT_NOT_SUPPORTED
, or Exportable.FORMAT_PARTIALLY_SUPPORTED
.Exportable.export(String, Object)
public boolean isHighlighted()
Highlightable
isHighlighted
in interface Highlightable
protected abstract boolean isOrderedRenderableValid(DrawContext dc)
makeOrderedRenderable(DrawContext)
just prior to adding the shape to the ordered renderable list.dc
- the current draw context.protected boolean isTerrainDependent()
public boolean isViewDistanceExpiration()
public boolean isVisible()
setVisible(boolean)
protected void makeOrderedRenderable(DrawContext dc)
AbstractShape.AbstractShapeData
must be current when this method is called.dc
- the current draw context.protected WWTexture makeTexture(java.lang.Object imageSource)
WWTexture
for a specified image source.imageSource
- the image source for which to create the texture.WWTexture
.java.lang.IllegalArgumentException
- if the image source is null.public void move(Position delta)
Movable
public void moveTo(Globe globe, Position position)
Movable2
protected boolean mustApplyLighting(DrawContext dc)
mustApplyLighting(DrawContext, ShapeAttributes)
, specifying null for the activeAttrs.dc
- the current draw contextprotected boolean mustApplyLighting(DrawContext dc, ShapeAttributes activeAttrs)
dc
- the current draw contextactiveAttrs
- the attribute bundle to consider when determining whether lighting is applied. May be null, in
which case the current active attributes are used.protected abstract boolean mustApplyTexture(DrawContext dc)
dc
- the current draw contextprotected boolean mustCreateNormals(DrawContext dc)
mustCreateNormals(DrawContext, ShapeAttributes)
, specifying null for the activeAttrs.dc
- the current draw contextprotected boolean mustCreateNormals(DrawContext dc, ShapeAttributes activeAttrs)
mustApplyLighting(DrawContext, ShapeAttributes)
, passing the specified
active attrs.dc
- the current draw contextactiveAttrs
- the attribute bundle to consider when determining whether normals should be computed. May be
null, in which case the current active attributes are used.protected boolean mustDrawInterior()
protected boolean mustDrawOutline()
protected boolean mustRegenerateGeometry(DrawContext dc)
AbstractShape.AbstractShapeData
must be current when this method is called.dc
- the current draw context.public void pick(DrawContext dc, java.awt.Point pickPoint)
OrderedRenderable
pick
in interface OrderedRenderable
dc
- the current draw context.pickPoint
- the pick point.protected void prepareToDrawInterior(DrawContext dc, ShapeAttributes activeAttrs, ShapeAttributes defaultAttrs)
dc
- the current draw context.activeAttrs
- the attributes indicating the state value to set.defaultAttrs
- the attributes to use if activeAttrs
does not contain a necessary value.protected void prepareToDrawOutline(DrawContext dc, ShapeAttributes activeAttrs, ShapeAttributes defaultAttrs)
dc
- the current draw context.activeAttrs
- the attributes indicating the state value to set.defaultAttrs
- the attributes to use if activeAttrs
does not contain a necessary value.public void preRender(DrawContext dc)
preRender
in interface PreRenderable
public void render(DrawContext dc)
Renderable
Renderable
to render itself using the provided draw context.render
in interface Renderable
dc
- the DrawContext
to be usedDrawContext
protected void reset()
public void restoreState(java.lang.String stateInXml)
Restorable
restoreState
in interface Restorable
stateInXml
- an XML document string describing an object's state.public void setAltitudeMode(int altitudeMode)
WorldWind.ABSOLUTE
, WorldWind.RELATIVE_TO_GROUND
or
WorldWind.CLAMP_TO_GROUND
.
Note: If the altitude mode is unrecognized, WorldWind.ABSOLUTE
is used.
Note: Subclasses may recognize additional altitude modes or may not recognize the ones described above.altitudeMode
- the altitude mode. The default value is WorldWind.ABSOLUTE
.public void setAttributes(ShapeAttributes normalAttrs)
setAttributes
in interface Attributable
normalAttrs
- the normal attributes. May be null, in which case default attributes are used.public void setDelegateOwner(java.lang.Object delegateOwner)
public void setDragEnabled(boolean enabled)
Draggable
setDragEnabled
in interface Draggable
enabled
- true
if the object is enabled, else false
.public void setEnableBatchPicking(boolean enableBatchPicking)
SelectEvent
even if several of the polygons are at
the pick position.
Batch rendering (setEnableBatchRendering(boolean)
) must be enabled in order for batch picking to occur.enableBatchPicking
- true to enable batch rendering, otherwise false.public void setEnableBatchRendering(boolean enableBatchRendering)
enableBatchRendering
- true to enable batch rendering, otherwise false.public void setEnableDepthOffset(boolean enableDepthOffset)
Offset
.enableDepthOffset
- true if depth offset is applied, otherwise false.public void setGeometryRegenerationInterval(int geometryRegenerationInterval)
WorldWind.CLAMP_TO_GROUND
or WorldWind.RELATIVE_TO_GROUND
in order to
capture changes to the terrain. (The terrain changes when its resolution changes or when new elevation data is
returned from a server.) Decreasing this value causes the geometry to more quickly track terrain changes but at
the cost of performance. Increasing this value often does not have much effect because there are limiting factors
other than geometry regeneration.geometryRegenerationInterval
- the geometry regeneration interval, in milliseconds. The default is two
seconds.public void setHighlightAttributes(ShapeAttributes highlightAttrs)
setHighlightAttributes
in interface Attributable
highlightAttrs
- the highlight attributes. May be null, in which case default attributes are used.public void setHighlighted(boolean highlighted)
Highlightable
setHighlighted
in interface Highlightable
highlighted
- true to highlight the shape, otherwise false.public void setOutlinePickWidth(int outlinePickWidth)
outlinePickWidth
- the outline pick width. The default is 10.java.lang.IllegalArgumentException
- if the width is less than 0.public void setReferencePosition(Position referencePosition)
referencePosition
- the reference position. May be null, in which case the first position of the outer
boundary is the reference position.public void setViewDistanceExpiration(boolean viewDistanceExpiration)
viewDistanceExpiration
- true to enable view distance expiration, otherwise false.public void setVisible(boolean visible)
visible
- true to draw this shape, otherwise false. The default value is true.setAttributes(ShapeAttributes)
protected boolean shouldUseVBOs(DrawContext dc)
dc
- the current draw context.protected void updateSurfaceShape()