Class SurfacePolygons
- java.lang.Object
-
- All Implemented Interfaces:
AVList,Draggable,MessageListener,ExtentHolder,MeasurableArea,MeasurableLength,Movable,Movable2,Attributable,Highlightable,OrderedRenderable,PreRenderable,Renderable,SurfaceObject,SurfaceRenderable,SurfaceShape,Restorable,Combinable,WWObject,java.beans.PropertyChangeListener,java.util.EventListener
public class SurfacePolygons extends SurfacePolylines
Renders fast multiple polygons with or without holes in one pass. It relies on aCompoundVecBuffer.Whether a polygon ring is filled or is a hole in another polygon depends on the vertices winding order and the winding rule used - see setWindingRule(String).
-
-
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
Fields Modifier and Type Field Description protected java.lang.ObjectinteriorDisplayListCacheKeyprotected booleanneedsInteriorTessellationprotected int[]polygonRingGroupsprotected WWTexturetextureprotected java.lang.StringwindingRule-
Fields inherited from class gov.nasa.worldwind.render.SurfacePolylines
buffer, crossesDateLine, needsOutlineTessellation, outlineDisplayListCacheKey, sectors
-
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, dragEnabled, draggableSupport, geometryCache, highlightAttrs, highlighted, maxEdgeIntervals, minEdgeIntervals, normalAttrs, pathType, sectorCache, stackHandler, texelsPerEdgeInterval, vertexBuffer
-
Fields inherited from class gov.nasa.worldwind.render.AbstractSurfaceObject
delegateOwner, drawBoundingSectors, enableBatchPicking, extentCache, lastModifiedTime, nextUniqueId, pickLayer, pickSupport, pickTileBuilder, uniqueId, visible
-
-
Constructor Summary
Constructors Constructor Description SurfacePolygons(Sector sector, CompoundVecBuffer buffer)SurfacePolygons(CompoundVecBuffer buffer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.List<double[]>computeDateLineCrossingPoints(VecBuffer vecBuffer)protected double[]computeDateLineEntryPoint(double[] from, double[] to)protected intcomputePole(java.util.List<double[]> dateLineCrossingPoints)protected double[]computePoleWrappingPoint(int pole, java.util.List<double[]> dateLineCrossingPoints)protected int[]doTessellateInterior(DrawContext dc, LatLon referenceLocation)protected voiddrawInterior(DrawContext dc, SurfaceTileDrawContext sdc)int[]getPolygonRingGroups()Get a copy of the polygon ring groups array - can be null.protected WWTexturegetTexture()java.lang.StringgetWindingRule()Get the winding rule used when tessellating polygons.protected voidhandleUnsuccessfulInteriorTessellation(DrawContext dc)protected voidonGeometryChanged()voidsetPolygonRingGroups(int[] ringGroups)Set the polygon ring groups array - can be null.voidsetWindingRule(java.lang.String windingRule)Set the winding rule used when tessellating polygons.protected int[]tessellateInterior(DrawContext dc, LatLon referenceLocation)protected inttessellateInteriorVertices(com.jogamp.opengl.glu.GLUtessellator tess, LatLon referenceLocation)protected booleantessellateRing(com.jogamp.opengl.glu.GLUtessellator tess, VecBuffer vecBuffer, LatLon referenceLocation)-
Methods inherited from class gov.nasa.worldwind.render.SurfacePolylines
canContainPole, createGeometry, createGeometry, determineActiveGeometry, doMoveTo, doMoveTo, drawOutline, getBuffer, getLocations, getLocations, getReferencePosition, getSectors, setLocations, tessellateOutline, tessellatePart
-
Methods inherited from class gov.nasa.worldwind.render.AbstractSurfaceShape
addIntermediateLocations, applyInteriorState, applyInteriorTextureState, applyModelviewTransform, applyOutlineState, beginDrawing, clearCaches, combine, combineBounds, combineContours, computeEdgeIntervalsPerDegree, computeEdgeIntervalsPerDegree, computeSectors, computeSectors, containsPole, createActiveAttributes, createGeometryKey, cutAlongDateLine, determineActiveAttributes, doCombineContour, doCombineContours, doDrag, doDrawGeographic, doGetRestorableState, doRestoreState, doTessellateInterior, drag, drawGeographic, drawLineStrip, endDrawing, export, exportAsKML, generateIntermediateLocations, getActiveAttributes, getActiveGeometry, getArea, getArea, getAttributes, getCachedGeometry, getExtent, getHeight, getHighlightAttributes, getInteriorTexture, getLength, getMinAndMaxEdgeIntervals, getPathType, getPerimeter, getRestorableState, getStateKey, getTexelsPerEdgeInterval, getWidth, isDragEnabled, isExportFormatSupported, isHighlighted, isSectorEmpty, legacyRestoreState, makeOrderedPreRenderable, move, moveTo, moveTo, pathTypeFromString, repeatAroundDateline, restoreState, setAttributes, setDragEnabled, 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, onShapeChanged, 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, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
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
-
Methods inherited from interface gov.nasa.worldwind.render.Renderable
render
-
Methods inherited from interface gov.nasa.worldwind.render.SurfaceObject
getDelegateOwner, getDistanceFromEye, getExtent, isEnableBatchPicking, isVisible, pick, preRender, setDelegateOwner, setEnableBatchPicking, setVisible
-
-
-
-
Field Detail
-
polygonRingGroups
protected int[] polygonRingGroups
-
windingRule
protected java.lang.String windingRule
-
needsInteriorTessellation
protected boolean needsInteriorTessellation
-
texture
protected WWTexture texture
-
interiorDisplayListCacheKey
protected java.lang.Object interiorDisplayListCacheKey
-
-
Constructor Detail
-
SurfacePolygons
public SurfacePolygons(CompoundVecBuffer buffer)
-
SurfacePolygons
public SurfacePolygons(Sector sector, CompoundVecBuffer buffer)
-
-
Method Detail
-
getPolygonRingGroups
public int[] getPolygonRingGroups()
Get a copy of the polygon ring groups array - can be null.When not null the polygon ring groups array identifies the starting sub buffer index for each polygon. In that case rings from a same group will be tesselated together as part of the same polygon.
When
nullpolygon rings that follow the current winding rule are tessellated separatly as different polygons. Rings that are reverse winded are considered holes to be applied to the last straight winded ring polygon.- Returns:
- a copy of the polygon ring groups array - can be null.
-
setPolygonRingGroups
public void setPolygonRingGroups(int[] ringGroups)
Set the polygon ring groups array - can be null.When not null the polygon ring groups array identifies the starting sub buffer index for each polygon. In that case rings from a same group will be tesselated together as part of the same polygon.
When
nullpolygon rings that follow the current winding rule are tessellated separatly as different polygons. Rings that are reverse winded are considered holes to be applied to the last straight winded ring polygon.- Parameters:
ringGroups- a copy of the polygon ring groups array - can be null.
-
getWindingRule
public java.lang.String getWindingRule()
Get the winding rule used when tessellating polygons. Can be one ofAVKey.CLOCKWISE(default) orAVKey.COUNTER_CLOCKWISE.When set to
AVKey.CLOCKWISEpolygons which run clockwise will be filled and those which run counter clockwise will produce 'holes'. The interpretation is reversed when the winding rule is set toAVKey.COUNTER_CLOCKWISE.- Returns:
- the winding rule used when tessellating polygons.
-
setWindingRule
public void setWindingRule(java.lang.String windingRule)
Set the winding rule used when tessellating polygons. Can be one ofAVKey.CLOCKWISE(default) orAVKey.COUNTER_CLOCKWISE.When set to
AVKey.CLOCKWISEpolygons which run clockwise will be filled and those which run counter clockwise will produce 'holes'. The interpretation is reversed when the winding rule is set toAVKey.COUNTER_CLOCKWISE.- Parameters:
windingRule- the winding rule to use when tessellating polygons.
-
onGeometryChanged
protected void onGeometryChanged()
- Overrides:
onGeometryChangedin classSurfacePolylines
-
drawInterior
protected void drawInterior(DrawContext dc, SurfaceTileDrawContext sdc)
- Overrides:
drawInteriorin classSurfacePolylines
-
getTexture
protected WWTexture getTexture()
-
tessellateInterior
protected int[] tessellateInterior(DrawContext dc, LatLon referenceLocation)
-
doTessellateInterior
protected int[] doTessellateInterior(DrawContext dc, LatLon referenceLocation)
-
handleUnsuccessfulInteriorTessellation
protected void handleUnsuccessfulInteriorTessellation(DrawContext dc)
- Overrides:
handleUnsuccessfulInteriorTessellationin classAbstractSurfaceShape
-
tessellateInteriorVertices
protected int tessellateInteriorVertices(com.jogamp.opengl.glu.GLUtessellator tess, LatLon referenceLocation)
-
tessellateRing
protected boolean tessellateRing(com.jogamp.opengl.glu.GLUtessellator tess, VecBuffer vecBuffer, LatLon referenceLocation)
-
computeDateLineCrossingPoints
protected java.util.List<double[]> computeDateLineCrossingPoints(VecBuffer vecBuffer)
-
computePole
protected int computePole(java.util.List<double[]> dateLineCrossingPoints)
-
computePoleWrappingPoint
protected double[] computePoleWrappingPoint(int pole, java.util.List<double[]> dateLineCrossingPoints)
-
computeDateLineEntryPoint
protected double[] computeDateLineEntryPoint(double[] from, double[] to)
-
-