NASA World Wind

gov.nasa.worldwind.render
Interface SurfaceObject

All Superinterfaces:
AVList, OrderedRenderable, PreRenderable, Renderable
All Known Subinterfaces:
SurfaceShape
All Known Implementing Classes:
AbstractSurfaceObject, AbstractSurfaceRenderable, AbstractSurfaceShape, AnalyticSurface.AnalyticSurfaceObject, AnalyticSurface.ClampToGroundSurface, AnalyticSurface.ShadowSurface, KMLSurfacePolygonImpl, SectorSelector.RegionShape, SurfaceCircle, SurfaceEllipse, SurfaceIcon, SurfaceIcons, SurfacePolygon, SurfacePolygons, SurfacePolyline, SurfacePolylines, SurfaceQuad, SurfaceSector, SurfaceSquare, SurfaceText

public interface SurfaceObject
extends OrderedRenderable, PreRenderable, AVList

Common interface for renderables that are drawn on the Globe's surface terrain, such as SurfaceShape. SurfaceObject implements the Renderable and PreRenderable interfaces, so a surface object may be aggregated within any layer or within some arbitrary rendering code.

SurfaceObjects automatically aggregate themselves in the DrawContext's ordered surface renderable queue by calling DrawContext.addOrderedSurfaceRenderable(OrderedRenderable) during the preRender, pick, and render stages. This enables SurfaceObjects to be processed in bulk, and reduces texture memory consumption by sharing rendering resources amongst multiple SurfaceObjects.

Implementations of SurfaceObject require that preRender(DrawContext) is called before render(DrawContext) and pick(DrawContext, java.awt.Point), and that preRender is called at the appropriate stage in the current rendering cycle. Calling preRender locks in the SurfaceObject's visual appearance for any subsequent calls to pick or render until the next call preRender.


Method Summary
 Object getDelegateOwner()
          Returns the delegate owner of the surface object.
 double getDistanceFromEye()
          Returns zero to indicate that the surface object's distance from the eye is unknown.
 Extent getExtent(DrawContext dc)
          Returns the surface object's enclosing volume as an Extent in model coordinates, given a specified DrawContext.
 List<Sector> getSectors(DrawContext dc)
          Returns a List of Sector instances that bound the surface object on the specified DrawContext.
 Object getStateKey(DrawContext dc)
          Returns an object that uniquely identifies the surface object's state on the specified draw context.
 boolean isVisible()
          Indicates whether the surface object should be drawn during rendering.
 void pick(DrawContext dc, Point pickPoint)
          Causes the surface object to draw a pickable representation of itself on the surface terrain, using the provided draw context.
 void preRender(DrawContext dc)
          Causes the surface object to prepare a representation of itself which can be drawn on the surface terrain, using the provided draw context.
 void render(DrawContext dc)
          Causes the surface object to render a representation of itself on the surface terrain, using the provided draw context.
 void setDelegateOwner(Object owner)
          Specifies the delegate owner of the surface object.
 void setVisible(boolean visible)
          Specifies whether the surface object should be drawn during rendering.
 
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
 

Method Detail

getDelegateOwner

Object getDelegateOwner()
Returns the delegate owner of the surface object. If non-null, the returned object replaces the surface object as the pickable object returned during picking. If null, the surface object itself is the pickable object returned during picking.

Returns:
the object used as the pickable object returned during picking, or null to indicate the the surface object is returned during picking.

getDistanceFromEye

double getDistanceFromEye()
Returns zero to indicate that the surface object's distance from the eye is unknown. SurfaceObjects are processed on the DrawContext's ordered surface renderable queue. Ordered surface renderables do not utilize the renderable's distance from the eye to determine draw order.

Specified by:
getDistanceFromEye in interface OrderedRenderable
Returns:
zero, to indicate that the object's distance from the eye is unknown.

getExtent

Extent getExtent(DrawContext dc)
Returns the surface object's enclosing volume as an Extent in model coordinates, given a specified DrawContext.

Parameters:
dc - the current draw context.
Returns:
the surface object's Extent in model coordinates.
Throws:
IllegalArgumentException - if the draw context is null.

getSectors

List<Sector> getSectors(DrawContext dc)
Returns a List of Sector instances that bound the surface object on the specified DrawContext.

Parameters:
dc - the DrawContext the surface object is related to.
Returns:
the surface object's bounding Sectors.

getStateKey

Object getStateKey(DrawContext dc)
Returns an object that uniquely identifies the surface object's state on the specified draw context. This object is guaranteed to be globally unique; an equality test with a state key from another always returns false.

Parameters:
dc - the draw context the state key relates to.
Returns:
an object representing surface object's current state.

isVisible

boolean isVisible()
Indicates whether the surface object should be drawn during rendering.

Returns:
true if the object is to be drawn, otherwise false.

pick

void pick(DrawContext dc,
          Point pickPoint)
Causes the surface object to draw a pickable representation of itself on the surface terrain, using the provided draw context.

Specified by:
pick in interface OrderedRenderable
Parameters:
dc - the current draw context.
pickPoint - the pick point.
Throws:
IllegalArgumentException - if the draw context is null.

preRender

void preRender(DrawContext dc)
Causes the surface object to prepare a representation of itself which can be drawn on the surface terrain, using the provided draw context.

Specified by:
preRender in interface PreRenderable
Parameters:
dc - the current draw context.

render

void render(DrawContext dc)
Causes the surface object to render a representation of itself on the surface terrain, using the provided draw context.

Specified by:
render in interface Renderable
Parameters:
dc - the current draw context.
Throws:
IllegalArgumentException - if the draw context is null.
See Also:
DrawContext

setDelegateOwner

void setDelegateOwner(Object owner)
Specifies the delegate owner of the surface object. If non-null, the delegate owner replaces the surface object as the pickable object returned during picking. If null, the surface object itself is the pickable object returned during picking.

Parameters:
owner - the object to use as the pickable object returned during picking, or null to return the surface object.

setVisible

void setVisible(boolean visible)
Specifies whether the surface object should be drawn during rendering.

Parameters:
visible - true if the object is to be drawn, otherwise false.

NASA World Wind