NASA World Wind

gov.nasa.worldwind.render
Class SurfacePolygon

java.lang.Object
  extended by gov.nasa.worldwind.avlist.AVListImpl
      extended by gov.nasa.worldwind.WWObjectImpl
          extended by gov.nasa.worldwind.render.AbstractSurfaceObject
              extended by gov.nasa.worldwind.render.AbstractSurfaceShape
                  extended by gov.nasa.worldwind.render.SurfacePolygon
All Implemented Interfaces:
AVList, MessageListener, Exportable, ExtentHolder, MeasurableArea, MeasurableLength, Movable, Highlightable, OrderedRenderable, PreRenderable, Renderable, SurfaceObject, SurfaceShape, Restorable, WWObject, PropertyChangeListener, EventListener
Direct Known Subclasses:
KMLSurfacePolygonImpl

public class SurfacePolygon
extends AbstractSurfaceShape
implements Exportable


Nested Class Summary
 
Nested classes/interfaces inherited from class gov.nasa.worldwind.render.AbstractSurfaceShape
AbstractSurfaceShape.GeometryKey, AbstractSurfaceShape.SurfaceShapeStateKey
 
Nested classes/interfaces inherited from class gov.nasa.worldwind.render.AbstractSurfaceObject
AbstractSurfaceObject.CacheEntry, AbstractSurfaceObject.SurfaceObjectStateKey
 
Field Summary
protected  List<Iterable<? extends LatLon>> boundaries
           
 
Fields inherited from class gov.nasa.worldwind.render.AbstractSurfaceShape
activeAttrs, activeGeometry, activeOutlineGeometry, areaMeasurer, areaMeasurerLastModifiedTime, DEFAULT_HIGHLIGHT_MATERIAL, DEFAULT_INTERIOR_MATERIAL, DEFAULT_MAX_EDGE_INTERVALS, DEFAULT_MIN_EDGE_INTERVALS, DEFAULT_OUTLINE_MATERIAL, DEFAULT_PATH_TYPE, DEFAULT_TEXELS_PER_EDGE_INTERVAL, defaultAttrs, geometryCache, highlightAttrs, highlighted, maxEdgeIntervals, minEdgeIntervals, normalAttrs, pathType, sectorCache, stackHandler, texelsPerEdgeInterval, texture, vertexBuffer
 
Fields inherited from class gov.nasa.worldwind.render.AbstractSurfaceObject
delegateOwner, drawBoundingSectors, enableBatchPicking, extentCache, lastModifiedTime, nextUniqueId, pickLayer, pickSupport, pickTileBuilder, pickTiles, uniqueId, visible
 
Fields inherited from interface gov.nasa.worldwind.Exportable
FORMAT_NOT_SUPPORTED, FORMAT_PARTIALLY_SUPPORTED, FORMAT_SUPPORTED
 
Constructor Summary
SurfacePolygon()
          Constructs a new surface polygon with the default attributes and no locations.
SurfacePolygon(Iterable<? extends LatLon> iterable)
          Constructs a new surface polygon with the default attributes and the specified iterable of locations.
SurfacePolygon(ShapeAttributes normalAttrs)
          Constructs a new surface polygon with the specified normal (as opposed to highlight) attributes and no locations.
SurfacePolygon(ShapeAttributes normalAttrs, Iterable<? extends LatLon> iterable)
          Constructs a new surface polygon with the specified normal (as opposed to highlight) attributes and the specified iterable of locations.
 
Method Summary
 void addInnerBoundary(Iterable<? extends LatLon> iterable)
           
protected  List<List<LatLon>> createGeometry(Globe globe, SurfaceTileDrawContext sdc)
           
protected  void doGetRestorableState(RestorableSupport rs, RestorableSupport.StateObject context)
           
protected  void doMoveTo(Position oldReferencePosition, Position newReferencePosition)
           
protected  void doRestoreState(RestorableSupport rs, RestorableSupport.StateObject context)
           
protected  void exportAsKML(Object output)
          Export the polygon to KML as a <Placemark> element.
 List<Iterable<? extends LatLon>> getBoundaries()
           
 Iterable<? extends LatLon> getLocations()
           
 Iterable<? extends LatLon> getLocations(Globe globe)
          Returns the shape's locations as they appear on the specified globe, or null if the shape has no locations.
 Iterable<? extends LatLon> getOuterBoundary()
           
 Position getReferencePosition()
          A position associated with the object that indicates its aggregate geographic position.
protected  void handleUnsuccessfulInteriorTessellation(DrawContext dc)
          Overridden to clear the polygon's locations iterable upon an unsuccessful tessellation attempt.
protected  void legacyRestoreState(RestorableSupport rs, RestorableSupport.StateObject context)
          Restores state values from previous versions of the SurfaceShape state XML.
 void setLocations(Iterable<? extends LatLon> iterable)
           
 void setOuterBoundary(Iterable<? extends LatLon> iterable)
           
 
Methods inherited from class gov.nasa.worldwind.render.AbstractSurfaceShape
addIntermediateLocations, applyInteriorState, applyInteriorTextureState, applyModelviewTransform, applyOutlineState, beginDrawing, canContainPole, clearCaches, computeEdgeIntervalsPerDegree, computeSectors, computeSectors, containsPole, createActiveAttributes, createGeometryKey, cutAlongDateLine, determineActiveAttributes, determineActiveGeometry, doDrawGeographic, doTessellateInterior, drawGeographic, drawInterior, drawOutline, endDrawing, export, generateIntermediateLocations, getActiveAttributes, getActiveGeometry, getArea, getArea, getAttributes, getCachedGeometry, getExtent, getHeight, getHighlightAttributes, getInteriorTexture, getLength, getMinAndMaxEdgeIntervals, getPathType, getPerimeter, getRestorableState, getSectors, getStateKey, getTexelsPerEdgeInterval, getWidth, intersectionWithMeridian, isExportFormatSupported, isHighlighted, isSectorEmpty, makeOrderedPreRenderable, move, moveTo, onShapeChanged, pathTypeFromString, repeatAroundDateline, restoreState, setAttributes, setHighlightAttributes, setHighlighted, setMinAndMaxEdgeIntervals, setPathType, setTexelsPerEdgeInterval, setupAreaMeasurer, tessellateInterior, tessellateInteriorVertices
 
Methods inherited from class gov.nasa.worldwind.render.AbstractSurfaceObject
buildPickRepresentation, computeExtent, computeExtent, createPickedObject, createPickTileBuilder, drawBoundingSectors, drawOrderedRenderable, drawPickRepresentation, getDelegateOwner, getDistanceFromEye, getExtent, getUniqueId, intersectsFrustum, intersectsPickFrustum, intersectsVisibleSector, isDrawBoundingSectors, isEnableBatchPicking, isVisible, makeOrderedRenderable, nextUniqueId, pick, pickBatched, pickOrderedRenderable, preRender, render, setDelegateOwner, setDrawBoundingSectors, setEnableBatchPicking, setVisible, updateModifiedTime
 
Methods inherited from class gov.nasa.worldwind.WWObjectImpl
onMessage, 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, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.nasa.worldwind.Exportable
export, isExportFormatSupported
 
Methods inherited from interface gov.nasa.worldwind.render.SurfaceObject
getDelegateOwner, getDistanceFromEye, getExtent, isVisible, pick, preRender, render, setDelegateOwner, setVisible
 
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

boundaries

protected List<Iterable<? extends LatLon>> boundaries
Constructor Detail

SurfacePolygon

public SurfacePolygon()
Constructs a new surface polygon with the default attributes and no locations.


SurfacePolygon

public SurfacePolygon(Iterable<? extends LatLon> iterable)
Constructs a new surface polygon with the default attributes and the specified iterable of locations.

Note: If fewer than three locations is specified, no polygon is drawn.

Parameters:
iterable - the polygon locations.
Throws:
IllegalArgumentException - if the locations iterable is null.

SurfacePolygon

public SurfacePolygon(ShapeAttributes normalAttrs)
Constructs a new surface polygon with the specified normal (as opposed to highlight) attributes and no locations. Modifying the attribute reference after calling this constructor causes this shape's appearance to change accordingly.

Parameters:
normalAttrs - the normal attributes. May be null, in which case default attributes are used.

SurfacePolygon

public SurfacePolygon(ShapeAttributes normalAttrs,
                      Iterable<? extends LatLon> iterable)
Constructs a new surface polygon with the specified normal (as opposed to highlight) attributes and the specified iterable of locations. Modifying the attribute reference after calling this constructor causes this shape's appearance to change accordingly.

Note: If fewer than three locations is specified, no polygon is drawn.

Parameters:
normalAttrs - the normal attributes. May be null, in which case default attributes are used.
iterable - the polygon locations.
Throws:
IllegalArgumentException - if the locations iterable is null.
Method Detail

addInnerBoundary

public void addInnerBoundary(Iterable<? extends LatLon> iterable)

createGeometry

protected List<List<LatLon>> createGeometry(Globe globe,
                                            SurfaceTileDrawContext sdc)
Specified by:
createGeometry in class AbstractSurfaceShape

doGetRestorableState

protected void doGetRestorableState(RestorableSupport rs,
                                    RestorableSupport.StateObject context)
Overrides:
doGetRestorableState in class AbstractSurfaceShape

doMoveTo

protected void doMoveTo(Position oldReferencePosition,
                        Position newReferencePosition)
Specified by:
doMoveTo in class AbstractSurfaceShape

doRestoreState

protected void doRestoreState(RestorableSupport rs,
                              RestorableSupport.StateObject context)
Overrides:
doRestoreState in class AbstractSurfaceShape

exportAsKML

protected void exportAsKML(Object output)
                    throws IOException,
                           XMLStreamException
Export the polygon to KML as a <Placemark> element. The output object will receive the data. This object must be one of: java.io.Writer java.io.OutputStream javax.xml.stream.XMLStreamWriter

Overrides:
exportAsKML in class AbstractSurfaceShape
Parameters:
output - Object to receive the generated KML.
Throws:
XMLStreamException - If an exception occurs while writing the KML
IOException - if an exception occurs while exporting the data.
See Also:
AbstractSurfaceShape.export(String, Object)

getBoundaries

public List<Iterable<? extends LatLon>> getBoundaries()

getLocations

public Iterable<? extends LatLon> getLocations()

getLocations

public Iterable<? extends LatLon> getLocations(Globe globe)
Description copied from interface: SurfaceShape
Returns the shape's locations as they appear on the specified globe, or null if the shape has no locations.

Specified by:
getLocations in interface SurfaceShape
Parameters:
globe - the globe the shape is related to.
Returns:
the shapes locations on the globe, or null if the shape has no locations.

getOuterBoundary

public Iterable<? extends LatLon> getOuterBoundary()

getReferencePosition

public Position getReferencePosition()
Description copied from interface: Movable
A position associated with the object that indicates its aggregate geographic position. The chosen position varies among implementers of this interface. For objects defined by a list of positions, the reference position is typically the first position in the list. For symmetric objects the reference position is often the center of the object. In many cases the object's reference position may be explicitly specified by the application.

Specified by:
getReferencePosition in interface Movable
Specified by:
getReferencePosition in class AbstractSurfaceShape
Returns:
the object's reference position, or null if no reference position is available.

handleUnsuccessfulInteriorTessellation

protected void handleUnsuccessfulInteriorTessellation(DrawContext dc)
Overridden to clear the polygon's locations iterable upon an unsuccessful tessellation attempt. This ensures the polygon won't attempt to re-tessellate itself each frame.

Overrides:
handleUnsuccessfulInteriorTessellation in class AbstractSurfaceShape
Parameters:
dc - the current DrawContext.

legacyRestoreState

protected void legacyRestoreState(RestorableSupport rs,
                                  RestorableSupport.StateObject context)
Description copied from class: AbstractSurfaceShape
Restores state values from previous versions of the SurfaceShape state XML. These values are stored or named differently than the current implementation. Those values which have not changed are ignored here, and will restored in AbstractSurfaceShape.doRestoreState(gov.nasa.worldwind.util.RestorableSupport, gov.nasa.worldwind.util.RestorableSupport.StateObject).

Overrides:
legacyRestoreState in class AbstractSurfaceShape
Parameters:
rs - RestorableSupport object which contains the state value properties.
context - active context in the RestorableSupport to read state from.

setLocations

public void setLocations(Iterable<? extends LatLon> iterable)

setOuterBoundary

public void setOuterBoundary(Iterable<? extends LatLon> iterable)

NASA World Wind