public class SurfacePolygon extends AbstractSurfaceShape implements Exportable
Modifier and Type | Class and Description |
---|---|
protected static class |
SurfacePolygon.ShapeData |
protected static class |
SurfacePolygon.Vertex |
AbstractSurfaceShape.GeometryKey, AbstractSurfaceShape.SurfaceShapeStateKey
AbstractSurfaceObject.CacheEntry, AbstractSurfaceObject.SurfaceObjectStateKey
Modifier and Type | Field and Description |
---|---|
protected List<Iterable<? extends LatLon>> |
boundaries |
protected WWTexture |
explicitTexture
If an image source was specified, this is the WWTexture form.
|
protected float[] |
explicitTextureCoords
This shape's texture coordinates.
|
protected Map<Object,SurfacePolygon.ShapeData> |
shapeDataCache |
protected static GLUtessellator |
tess |
protected static GLUTessellatorSupport.CollectPrimitivesCallback |
tessCallback |
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, dragEnabled, draggableSupport, geometryCache, highlightAttrs, highlighted, maxEdgeIntervals, minEdgeIntervals, normalAttrs, pathType, sectorCache, stackHandler, texelsPerEdgeInterval, texture, vertexBuffer
delegateOwner, drawBoundingSectors, enableBatchPicking, extentCache, lastModifiedTime, nextUniqueId, pickLayer, pickSupport, pickTileBuilder, uniqueId, visible
FORMAT_NOT_SUPPORTED, FORMAT_PARTIALLY_SUPPORTED, FORMAT_SUPPORTED
Constructor and Description |
---|
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.
|
SurfacePolygon(SurfacePolygon source)
Creates a shallow copy of the specified source shape.
|
Modifier and Type | Method and Description |
---|---|
void |
addInnerBoundary(Iterable<? extends LatLon> iterable) |
protected void |
applyInteriorState(DrawContext dc,
SurfaceTileDrawContext sdc,
ShapeAttributes attributes,
WWTexture texture,
LatLon refLocation) |
protected List<List<SurfacePolygon.Vertex>> |
assembleContours(Angle maxEdgeLength) |
protected void |
clearCaches()
Clears this SurfaceObject's internal extent cache.
|
protected List<List<SurfacePolygon.Vertex>> |
clipWithDateline(List<SurfacePolygon.Vertex> contour) |
protected List<SurfacePolygon.Vertex> |
clipWithPole(List<SurfacePolygon.Vertex> contour,
String pole,
Angle maxEdgeLength) |
protected void |
closeContour(List<SurfacePolygon.Vertex> contour) |
protected List<List<LatLon>> |
createGeometry(Globe globe,
double edgeIntervalsPerDegree) |
protected void |
doDrawGeographic(DrawContext dc,
SurfaceTileDrawContext sdc) |
protected void |
doGetRestorableState(RestorableSupport rs,
RestorableSupport.StateObject context) |
protected void |
doMoveTo(Globe globe,
Position oldReferencePosition,
Position newReferencePosition) |
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.
|
float[] |
getTextureCoords()
Returns the texture coordinates for this polygon.
|
Object |
getTextureImageSource()
Returns this polygon's texture image source.
|
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) |
void |
setTextureImageSource(Object imageSource,
float[] texCoords,
int texCoordCount)
Specifies the texture to apply to this polygon.
|
protected void |
subdivideContour(List<SurfacePolygon.Vertex> contour,
Angle maxEdgeLength) |
protected void |
subdivideEdge(SurfacePolygon.Vertex begin,
SurfacePolygon.Vertex end,
Angle maxEdgeLength,
List<SurfacePolygon.Vertex> result) |
protected SurfacePolygon.ShapeData |
tessellateContours(List<List<SurfacePolygon.Vertex>> contours) |
protected double[] |
uvWeightedAverage(List<SurfacePolygon.Vertex> contour,
SurfacePolygon.Vertex vertex) |
addIntermediateLocations, applyInteriorTextureState, applyModelviewTransform, applyOutlineState, beginDrawing, canContainPole, combine, combineBounds, combineContours, computeEdgeIntervalsPerDegree, computeEdgeIntervalsPerDegree, computeSectors, computeSectors, containsPole, createActiveAttributes, createGeometry, createGeometryKey, cutAlongDateLine, determineActiveAttributes, determineActiveGeometry, doCombineContour, doCombineContours, doDrag, doTessellateInterior, drag, drawGeographic, drawInterior, drawLineStrip, drawOutline, endDrawing, export, generateIntermediateLocations, getActiveAttributes, getActiveGeometry, getArea, getArea, getAttributes, getCachedGeometry, getExtent, getHeight, getHighlightAttributes, getInteriorTexture, getLength, getMinAndMaxEdgeIntervals, getPathType, getPerimeter, getRestorableState, getSectors, getStateKey, getTexelsPerEdgeInterval, getWidth, isDragEnabled, isExportFormatSupported, isHighlighted, isSectorEmpty, makeOrderedPreRenderable, move, moveTo, moveTo, onShapeChanged, pathTypeFromString, repeatAroundDateline, restoreState, setAttributes, setDragEnabled, setHighlightAttributes, setHighlighted, setMinAndMaxEdgeIntervals, setPathType, setTexelsPerEdgeInterval, setupAreaMeasurer, tessellateInterior, tessellateInteriorVertices
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
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
export, isExportFormatSupported
getDelegateOwner, getDistanceFromEye, getExtent, isEnableBatchPicking, isVisible, pick, preRender, setDelegateOwner, setEnableBatchPicking, setVisible
render
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
protected WWTexture explicitTexture
protected float[] explicitTextureCoords
protected Map<Object,SurfacePolygon.ShapeData> shapeDataCache
protected static GLUtessellator tess
protected static GLUTessellatorSupport.CollectPrimitivesCallback tessCallback
public SurfacePolygon()
public SurfacePolygon(Iterable<? extends LatLon> iterable)
iterable
- the polygon locations.IllegalArgumentException
- if the locations iterable is null.public SurfacePolygon(ShapeAttributes normalAttrs)
normalAttrs
- the normal attributes. May be null, in which case default attributes are used.public SurfacePolygon(ShapeAttributes normalAttrs, Iterable<? extends LatLon> iterable)
normalAttrs
- the normal attributes. May be null, in which case default attributes are used.iterable
- the polygon locations.IllegalArgumentException
- if the locations iterable is null.public SurfacePolygon(SurfacePolygon source)
source
- the shape to copy.protected void applyInteriorState(DrawContext dc, SurfaceTileDrawContext sdc, ShapeAttributes attributes, WWTexture texture, LatLon refLocation)
applyInteriorState
in class AbstractSurfaceShape
protected List<List<SurfacePolygon.Vertex>> assembleContours(Angle maxEdgeLength)
protected void clearCaches()
AbstractSurfaceShape
clearCaches
in class AbstractSurfaceShape
protected List<List<SurfacePolygon.Vertex>> clipWithDateline(List<SurfacePolygon.Vertex> contour)
protected List<SurfacePolygon.Vertex> clipWithPole(List<SurfacePolygon.Vertex> contour, String pole, Angle maxEdgeLength)
protected void closeContour(List<SurfacePolygon.Vertex> contour)
protected List<List<LatLon>> createGeometry(Globe globe, double edgeIntervalsPerDegree)
createGeometry
in class AbstractSurfaceShape
protected void doDrawGeographic(DrawContext dc, SurfaceTileDrawContext sdc)
doDrawGeographic
in class AbstractSurfaceShape
protected void doGetRestorableState(RestorableSupport rs, RestorableSupport.StateObject context)
doGetRestorableState
in class AbstractSurfaceShape
protected void doMoveTo(Globe globe, Position oldReferencePosition, Position newReferencePosition)
doMoveTo
in class AbstractSurfaceShape
protected void doMoveTo(Position oldReferencePosition, Position newReferencePosition)
doMoveTo
in class AbstractSurfaceShape
protected void doRestoreState(RestorableSupport rs, RestorableSupport.StateObject context)
doRestoreState
in class AbstractSurfaceShape
protected void exportAsKML(Object output) throws IOException, 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.XMLStreamWriterexportAsKML
in class AbstractSurfaceShape
output
- Object to receive the generated KML.XMLStreamException
- If an exception occurs while writing the KMLIOException
- if an exception occurs while exporting the data.AbstractSurfaceShape.export(String, Object)
public Iterable<? extends LatLon> getLocations(Globe globe)
SurfaceShape
globe
, or null if the shape has no
locations.getLocations
in interface SurfaceShape
globe
- the globe the shape is related to.public Position getReferencePosition()
Movable
getReferencePosition
in interface Movable
getReferencePosition
in interface Movable2
getReferencePosition
in class AbstractSurfaceShape
public float[] getTextureCoords()
public Object getTextureImageSource()
protected void handleUnsuccessfulInteriorTessellation(DrawContext dc)
handleUnsuccessfulInteriorTessellation
in class AbstractSurfaceShape
dc
- the current DrawContext.protected void legacyRestoreState(RestorableSupport rs, RestorableSupport.StateObject context)
AbstractSurfaceShape
AbstractSurfaceShape.doRestoreState(gov.nasa.worldwind.util.RestorableSupport,
gov.nasa.worldwind.util.RestorableSupport.StateObject)
.legacyRestoreState
in class AbstractSurfaceShape
rs
- RestorableSupport object which contains the state value properties.context
- active context in the RestorableSupport to read state from.public void setTextureImageSource(Object imageSource, float[] texCoords, int texCoordCount)
imageSource
- the texture image source. May be a String
identifying a file path or URL, a File
, or a URL
.texCoords
- the (s, t) texture coordinates aligning the image to the polygon. There must be one texture
coordinate pair, (s, t), for each polygon location in the polygon's outer boundary.texCoordCount
- the number of texture coordinates, (s, v) pairs, specified.IllegalArgumentException
- if the image source is not null and either the texture coordinates are null or
inconsistent with the specified texture-coordinate count, or there are fewer
than three texture coordinate pairs.protected void subdivideContour(List<SurfacePolygon.Vertex> contour, Angle maxEdgeLength)
protected void subdivideEdge(SurfacePolygon.Vertex begin, SurfacePolygon.Vertex end, Angle maxEdgeLength, List<SurfacePolygon.Vertex> result)
protected SurfacePolygon.ShapeData tessellateContours(List<List<SurfacePolygon.Vertex>> contours)
protected double[] uvWeightedAverage(List<SurfacePolygon.Vertex> contour, SurfacePolygon.Vertex vertex)