public class ExtrudedPolygon extends AbstractShape
Extruded polygon boundaries may be specified using either LatLon
locations or Position
positions, but
all the shape's boundary vertices must be the same type.
Extruded polygons may optionally be textured. Textures may be applied to both the faces of the outer and inner boundaries or just the outer boundaries. Texture can also be applied independently to the cap. Standard lighting is optionally applied. Texture source images are lazily retrieved and loaded. This can cause a brief period in which the texture is not displayed while it is retrieved from disk or network.
ExtrudedPolygon
side faces and cap have independent attributes for both normal and highlighted drawing.
When specifying a single height (altitude mode WorldWind.CONSTANT
, the height is relative to a reference
location designated by one of the specified polygon locations in the outer boundary. The default reference location
is the first one in the polygon's outer boundary. An alternative location may be specified by calling setReferenceLocation(LatLon)
. The extruded polygon is capped with a plane at the specified height and tangent to
the ellipsoid at the reference location. Since locations other than the reference location may resolve to points at
elevations other than that at the reference location, the distances from those points to the cap are adjusted so that
the adjacent sides precisely meet the cap. When specifying polygons using a single height, only the latitudes and
longitudes of polygon boundary positions must be specified.
Independent per-location heights may be specified via the altitude field of Position
s defining the
polygon's inner and outer boundaries. Depending on the specified altitude mode, the position altitudes may be
interpreted as altitudes relative to mean sea level or altitudes above the ground at the associated latitude and
longitude locations.
Boundaries are required to be closed, their first location must be equal to their last location. Boundaries that are not closed are explicitly closed by this shape when they are specified.
Extruded polygons are safe to share among WorldWindows. They should not be shared among layers in the same World Window.
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.
When drawn on a 2D globe, this shape uses a SurfacePolygon
to represent itself. Cap texture is not supported
in this case.
Modifier and Type | Class and Description |
---|---|
protected static class |
ExtrudedPolygon.ExtrudedBoundaryInfo
Holds globe-specific information for each contour of the polygon.
|
protected static class |
ExtrudedPolygon.ShapeData
The
ShapeData class holds globe-specific data for this shape. |
AbstractShape.AbstractShapeData
Modifier and Type | Field and Description |
---|---|
protected ShapeAttributes |
activeSideAttributes
The currently active side attributes, derived from the specified attributes.
|
protected double |
baseDepth |
protected java.util.List<java.util.List<? extends LatLon>> |
boundaries
The location of each vertex in this shape's boundaries.
|
protected static java.util.HashMap<java.lang.Integer,java.nio.IntBuffer> |
capEdgeIndexBuffers |
protected WWTexture |
capTexture
This shape's cap texture.
|
protected java.nio.FloatBuffer |
capTextureCoords
This shape's cap texture coordinates.
|
protected static int |
DEFAULT_ALTITUDE_MODE
The default altitude mode.
|
protected static Material |
DEFAULT_SIDES_INTERIOR_MATERIAL
The default interior color for sides.
|
protected static ShapeAttributes |
defaultSideAttributes
The attributes used if attributes are not specified.
|
protected boolean |
enableCap
Indicates whether the cap should be drawn.
|
protected boolean |
enableSides
Indicates whether the sides should be drawn.
|
protected double |
height
This shape's height.
|
protected java.lang.Object |
previousIntersectionGlobeStateKey
The globe state key for the globe used in the most recent intersection calculation.
|
protected ExtrudedPolygon.ShapeData |
previousIntersectionShapeData
The shape data used for the previous intersection calculation.
|
protected Terrain |
previousIntersectionTerrain
The terrain used in the most recent intersection calculations.
|
protected ShapeAttributes |
sideAttributes
The attributes to use when drawing this shape's sides.
|
protected static java.util.HashMap<java.lang.Integer,java.nio.IntBuffer> |
sideEdgeIndexBuffers |
protected static java.util.HashMap<java.lang.Integer,java.nio.IntBuffer> |
sideFillIndexBuffers |
protected ShapeAttributes |
sideHighlightAttributes
The attributes to use when drawing this shape's sides in highlight mode.
|
protected java.util.List<java.util.List<WWTexture>> |
sideTextures
This shape's side textures.
|
protected int |
totalFaceCount
The total number of faces in all this shape's boundaries.
|
protected int |
totalNumLocations
The total number of locations in all boundaries.
|
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.
|
activeAttributes, altitudeMode, BEogsh, currentData, DEFAULT_GEOMETRY_GENERATION_INTERVAL, DEFAULT_HIGHLIGHT_MATERIAL, DEFAULT_INTERIOR_MATERIAL, DEFAULT_OUTLINE_MATERIAL, DEFAULT_OUTLINE_PICK_WIDTH, defaultAttributes, delegateOwner, dragEnabled, draggableSupport, enableBatchPicking, enableBatchRendering, enableDepthOffset, highlightAttrs, highlighted, maxExpiryTime, minExpiryTime, normalAttrs, outlinePickWidth, outlineShapeRenderer, pickLayer, pickSupport, referencePosition, sector, shapeDataCache, surfaceShape, viewDistanceExpiration, visible
FORMAT_NOT_SUPPORTED, FORMAT_PARTIALLY_SUPPORTED, FORMAT_SUPPORTED
Constructor and Description |
---|
ExtrudedPolygon()
Constructs an extruded polygon with an empty outer boundary and a default height of 1 meter.
|
ExtrudedPolygon(java.lang.Double height)
Constructs an extruded polygon of a specified height and an empty outer boundary.
|
ExtrudedPolygon(java.lang.Iterable<? extends LatLon> corners,
java.lang.Double height)
Constructs an extruded polygon for a specified list of outer boundary locations and a height.
|
ExtrudedPolygon(java.lang.Iterable<? extends LatLon> corners,
double height,
java.lang.Iterable<?> imageSources)
Constructs an extruded polygon from an outer boundary, a height, and images for its outer faces.
|
ExtrudedPolygon(java.lang.Iterable<? extends Position> corners)
Constructs an extruded polygon from an outer boundary.
|
ExtrudedPolygon(java.lang.Iterable<? extends Position> corners,
java.lang.Iterable<?> imageSources)
Constructs an extruded polygon from an outer boundary and apply specified textures to its outer faces.
|
ExtrudedPolygon(Position.PositionList corners)
Constructs an extruded polygon from an outer boundary specified with position heights.
|
Modifier and Type | Method and Description |
---|---|
void |
addInnerBoundary(java.lang.Iterable<? extends LatLon> corners)
Add an inner boundary to this polygon.
|
void |
addInnerBoundary(java.lang.Iterable<? extends LatLon> corners,
java.lang.Iterable<?> imageSources)
Add an inner boundary to this polygon and specify images to apply to each of the boundary's faces.
|
protected OGLStackHandler |
beginDrawing(DrawContext dc,
int attrMask)
Establish the OpenGL state needed to draw this shape.
|
protected void |
computeBoundaryVertices(Terrain terrain,
ExtrudedPolygon.ExtrudedBoundaryInfo boundary,
Vec4 refPoint)
Compute and set the Cartesian vertices for one specified boundary of this shape.
|
protected java.nio.FloatBuffer |
computeCapNormals(ExtrudedPolygon.ExtrudedBoundaryInfo boundary,
java.nio.FloatBuffer nBuf)
Compute normal vectors for an extruded polygon's cap vertices.
|
protected Extent |
computeExtent(ExtrudedPolygon.ExtrudedBoundaryInfo outerBoundary,
Vec4 refPoint)
Computes this shapes extent.
|
protected double |
computeEyeDistance(DrawContext dc,
ExtrudedPolygon.ShapeData shapeData)
Computes the minimum distance between this shape and the eye point.
|
protected Vec4 |
computePolygonNormal(ExtrudedPolygon.ShapeData shapeData) |
protected void |
computeReferencePoint(Terrain terrain,
ExtrudedPolygon.ShapeData shapeData)
Computes and sets this shape's reference point, the Cartesian position corresponding to its geographic location.
|
protected int |
countLocations()
Counts the total number of locations in this polygon's boundaries, not including positions introduced by
extrusion.
|
protected AbstractShape.AbstractShapeData |
createCacheEntry(DrawContext dc)
Creates and returns a new cache entry specific to the subclass.
|
protected void |
createCapGeometry(DrawContext dc,
ExtrudedPolygon.ShapeData shapeData)
Compute the cap geometry.
|
protected void |
createCapNormals(ExtrudedPolygon.ShapeData shapeData) |
protected void |
createFullGeometry(DrawContext dc,
Terrain terrain,
ExtrudedPolygon.ShapeData shapeData,
boolean skipOuterBoundary)
Computes a boundary set's full geometry.
|
protected ExtrudedPolygon.ShapeData |
createIntersectionGeometry(Terrain terrain) |
protected void |
createMinimalGeometry(DrawContext dc,
ExtrudedPolygon.ShapeData shapeData)
Computes the information necessary to determine this extruded polygon's extent.
|
protected void |
createSideGeometry(ExtrudedPolygon.ShapeData shapeData)
Constructs the Cartesian geometry of this shape's sides and sets it in the specified shape data.
|
protected void |
createSideNormals(ExtrudedPolygon.ShapeData shapeData) |
protected void |
createSideTextureCoords(ExtrudedPolygon.ShapeData shapeData)
Creates the texture coordinates for this shape's sides.
|
protected SurfaceShape |
createSurfaceShape()
Returns a
SurfaceShape that corresponds to this Path and is used for drawing on 2D globes. |
protected void |
createTessllationGeometry(DrawContext dc,
ExtrudedPolygon.ShapeData shapeData)
Tessellates this extruded polygon's cap.
|
protected void |
createVertices(Terrain terrain,
ExtrudedPolygon.ShapeData shapeData,
boolean skipOuterBoundary)
Creates this shape's Cartesian vertices.
|
protected void |
determineActiveAttributes()
Determines which attributes -- normal, highlight or default -- to use each frame.
|
protected void |
doDrawInterior(DrawContext dc)
Not used by this class.
|
protected void |
doDrawOutline(DrawContext dc)
Not used by this class, which overrides
drawOutline(DrawContext) . |
protected void |
doExportAsKML(javax.xml.stream.XMLStreamWriter xmlWriter)
Exports shape-specific fields.
|
protected boolean |
doMakeOrderedRenderable(DrawContext dc)
Produces the geometry and other state necessary to represent this shape as an ordered renderable.
|
void |
drawCapInterior(DrawContext dc,
ExtrudedPolygon.ShapeData shapeData)
Draws the filled interior of this shape's cap.
|
void |
drawCapOutline(DrawContext dc,
ExtrudedPolygon.ShapeData shapeData)
Draws the cap's outline.
|
void |
drawInterior(DrawContext dc)
Draws this shape's interior.
|
void |
drawOutline(DrawContext dc)
Draws this shape's outline.
|
protected void |
drawSideInteriors(DrawContext dc,
ExtrudedPolygon.ShapeData shapeData)
Draws this shape's sides.
|
protected void |
drawSideOutline(DrawContext dc,
ExtrudedPolygon.ShapeData shapeData)
Draws this extruded polygon's side outline.
|
protected void |
exportBoundaryAsLinearRing(javax.xml.stream.XMLStreamWriter xmlWriter,
java.lang.Iterable<? extends LatLon> boundary)
Writes the boundary in KML as either a list of lat, lon, altitude tuples or lat, lon tuples, depending on the
type originally specified.
|
protected java.util.List<? extends LatLon> |
fillBoundary(java.lang.Iterable<? extends LatLon> corners) |
protected java.util.List<WWTexture> |
fillImageList(java.lang.Iterable<?> imageSources)
Creates texture object for a boundary's image sources.
|
protected java.nio.FloatBuffer |
fillSideNormalBuffer(Vec4[] topVerts,
Vec4[] bottomVerts,
java.nio.FloatBuffer nBuf) |
protected void |
fillSideTexCoordBuffer(Vec4[] topVerts,
Vec4[] bottomVerts,
java.nio.FloatBuffer tBuf)
Computes the texture coordinates for a boundary of this shape.
|
protected java.nio.FloatBuffer |
fillSideVertexBuffer(Vec4[] topVerts,
Vec4[] bottomVerts,
java.nio.FloatBuffer vBuf) |
protected void |
fillVBO(DrawContext dc)
Fill this shape's vertex buffer objects.
|
protected void |
generateCapInteriorIndices(ExtrudedPolygon.ShapeData shapeData)
Construct the lists of indices that identify the tessellated shape's vertices in the vertex buffer.
|
protected ShapeAttributes |
getActiveCapAttributes()
Each time this polygon is rendered the appropriate attributes for the current mode are determined.
|
protected ShapeAttributes |
getActiveSideAttributes()
Each time this polygon is rendered the appropriate attributes for the current mode are determined.
|
double |
getBaseDepth()
Returns this object's base depth.
|
protected java.util.List<java.util.List<? extends LatLon>> |
getBoundaries()
Returns this shape's boundaries.
|
ShapeAttributes |
getCapAttributes()
Returns the attributes applied to this polygon's cap.
|
protected java.nio.IntBuffer |
getCapEdgeIndices(int n)
Returns the indices defining the cap vertices.
|
ShapeAttributes |
getCapHighlightAttributes()
Returns the highlight attributes applied to this polygon's cap.
|
java.lang.Object |
getCapImageSource()
Returns this extruded polygon's cap image.
|
protected WWTexture |
getCapTexture()
Get the texture applied to this extruded polygon's cap.
|
protected ExtrudedPolygon.ShapeData |
getCurrent()
Indicates the currently active shape data.
|
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() . |
double |
getHeight()
Returns the height of this extruded polygon.
|
java.util.List<java.util.List<java.lang.Object>> |
getImageSources()
Returns this extruded polygon's side images.
|
java.lang.Iterable<? extends LatLon> |
getOuterBoundary()
Returns the list of locations or positions defining this polygon's outer boundary.
|
LatLon |
getReferenceLocation()
Indicates the location to use as a reference location for computed geometry.
|
Position |
getReferencePosition()
Indicates the position used as a reference position for this extruded polygon's computed geometry.
|
Sector |
getSector()
Returns the object's geographic extent.
|
ShapeAttributes |
getSideAttributes()
Returns the attributes applied to this polygon's side faces.
|
protected java.nio.IntBuffer |
getSideEdgeIndices(int n)
Returns the indices defining the vertices of a boundary's face edges.
|
ShapeAttributes |
getSideHighlightAttributes()
Returns the highlight attributes applied to this polygon's side faces.
|
protected java.nio.IntBuffer |
getSideIndices(int n)
Returns the indices defining the vertices of each face of this extruded polygon.
|
float[] |
getTextureCoords()
Returns the texture coordinates for this polygon's cap.
|
boolean |
hasSideTextures()
Indicates whether side images have been specified for this extruded polygon.
|
protected void |
initialize()
Called during construction to establish any subclass-specific state such as different default values than those
set by this class.
|
java.util.List<Intersection> |
intersect(Line line,
Terrain terrain)
Compute the intersections of a specified line with this extruded polygon.
|
protected java.util.List<Intersection> |
intersectBoundarySides(Line line,
ExtrudedPolygon.ExtrudedBoundaryInfo boundary)
Intersects a line with the sides of an individual boundary.
|
protected void |
intersectCap(Line line,
ExtrudedPolygon.ShapeData shapeData,
java.util.List<Intersection> intersections) |
boolean |
isEnableCap()
Indicates whether the cap of this extruded polygon is drawn.
|
boolean |
isEnableSides()
Indicates whether the sides of this extruded polygon are drawn.
|
protected boolean |
isOrderedRenderableValid(DrawContext dc)
Determines whether this shape's ordered renderable state is valid and can be rendered.
|
protected boolean |
isOuterBoundaryValid()
Indicates whether this shape's outer boundary exists and has more than two points.
|
protected boolean |
isSameAsPreviousTerrain(Terrain terrain) |
protected boolean |
isTerrainDependent()
Indicates whether this shape's geometry depends on the terrain.
|
void |
moveTo(Position position)
Move the shape over the globe's surface while maintaining its original azimuth, its orientation relative to
North.
|
protected boolean |
mustApplySideTextures() |
protected boolean |
mustApplyTexture(DrawContext dc)
Indicates whether texture should be applied to this shape.
|
protected boolean |
mustDrawInterior()
Indicates whether the interior of either the sides or cap must be drawn.
|
protected boolean |
mustDrawOutline()
Indicates whether the polygon's outline should 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.
|
protected java.util.List<? extends LatLon> |
outerBoundary()
Returns a reference to the outer boundary of this polygon.
|
void |
render(DrawContext dc)
Causes this
Renderable to render itself using the provided draw context. |
protected void |
reset()
Invalidates computed values.
|
void |
setBaseDepth(double baseDepth)
Specifies a depth below the terrain at which to place this extruded polygon's base vertices.
|
void |
setCapAttributes(ShapeAttributes attributes)
Specifies the attributes applied to this polygon's cap.
|
void |
setCapHighlightAttributes(ShapeAttributes attributes)
Specifies the highlight attributes applied to this polygon's cap.
|
void |
setCapImageSource(java.lang.Object imageSource,
float[] texCoords,
int texCoordCount)
Specifies the image to apply to this extruded polygon's cap.
|
void |
setEnableCap(boolean enableCap)
Specifies whether the cap of this extruded polygon is drawn.
|
void |
setEnableSides(boolean enableSides)
Specifies whether to draw the sides of this extruded polygon.
|
void |
setHeight(double height)
Specifies the height of this extruded polygon.
|
void |
setOuterBoundary(java.lang.Iterable<? extends LatLon> corners)
Specifies the latitude and longitude of the locations defining the outer boundary of this polygon.
|
void |
setOuterBoundary(java.lang.Iterable<? extends LatLon> corners,
java.lang.Double height)
Specifies the latitude and longitude of the outer boundary locations defining this polygon, and optionally the
extruded polygon's height.
|
void |
setOuterBoundary(java.lang.Iterable<? extends LatLon> corners,
java.lang.Iterable<?> imageSources)
Specifies the latitudes, longitudes and outer-boundary images for the outer boundary of this polygon.
|
void |
setReferenceLocation(LatLon referenceLocation)
Specifies the location to use as a reference location for computed geometry.
|
void |
setSideAttributes(ShapeAttributes attributes)
Specifies the attributes applied to this polygon's side faces.
|
void |
setSideHighlightAttributes(ShapeAttributes attributes)
Specifies the highlight attributes applied to this polygon's side faces.
|
protected void |
setSurfacePolygonBoundaries(SurfaceShape shape) |
protected void |
tessellatePolygon(ExtrudedPolygon.ShapeData shapeData,
Vec4 normal)
Tessellates the polygon from its vertices.
|
protected void |
writeKMLBoundaries(javax.xml.stream.XMLStreamWriter xmlWriter) |
addOrderedRenderable, checkViewDistanceExpiration, clearCachedVbos, computeExtentFromPositions, computePoint, computePoint, countTriangleVertices, createPickedObject, doDrag, doDrawOrderedRenderable, doGetRestorableState, doRestoreState, drag, drawBatched, drawOrderedRenderable, endDrawing, export, exportAsKML, getActiveAttributes, getAltitudeMode, getAttributes, getCurrentData, getDelegateOwner, getDistanceFromEye, getExtent, getGeometryRegenerationInterval, getHighlightAttributes, getOutlinePickWidth, getReferencePoint, getRestorableState, getVboIds, intersectsFrustum, isDragEnabled, isEnableBatchPicking, isEnableBatchRendering, isEnableDepthOffset, isExportFormatSupported, isHighlighted, isViewDistanceExpiration, isVisible, makeOrderedRenderable, makeTexture, move, moveTo, mustApplyLighting, mustApplyLighting, mustCreateNormals, mustCreateNormals, pick, prepareToDrawInterior, prepareToDrawOutline, preRender, restoreState, setAltitudeMode, setAttributes, setDelegateOwner, setDragEnabled, setEnableBatchPicking, setEnableBatchRendering, setEnableDepthOffset, setGeometryRegenerationInterval, setHighlightAttributes, setHighlighted, setOutlinePickWidth, setReferencePosition, setViewDistanceExpiration, setVisible, shouldUseVBOs, updateSurfaceShape
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
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
protected ShapeAttributes activeSideAttributes
protected double baseDepth
protected java.util.List<java.util.List<? extends LatLon>> boundaries
protected static java.util.HashMap<java.lang.Integer,java.nio.IntBuffer> capEdgeIndexBuffers
protected WWTexture capTexture
protected java.nio.FloatBuffer capTextureCoords
protected static final int DEFAULT_ALTITUDE_MODE
protected static final Material DEFAULT_SIDES_INTERIOR_MATERIAL
protected static final ShapeAttributes defaultSideAttributes
protected boolean enableCap
protected boolean enableSides
protected double height
protected java.lang.Object previousIntersectionGlobeStateKey
protected ExtrudedPolygon.ShapeData previousIntersectionShapeData
protected Terrain previousIntersectionTerrain
protected ShapeAttributes sideAttributes
protected static java.util.HashMap<java.lang.Integer,java.nio.IntBuffer> sideEdgeIndexBuffers
protected static java.util.HashMap<java.lang.Integer,java.nio.IntBuffer> sideFillIndexBuffers
protected ShapeAttributes sideHighlightAttributes
protected java.util.List<java.util.List<WWTexture>> sideTextures
protected int totalFaceCount
protected int totalNumLocations
protected static final int VBO_THRESHOLD
public ExtrudedPolygon()
public ExtrudedPolygon(java.lang.Double height)
height
- the shape height, in meters. May be null, in which case a height of 1 is used. The height is used
only when the altitude mode is WorldWind.CONSTANT
, which is the default for this shape.public ExtrudedPolygon(java.lang.Iterable<? extends LatLon> corners, java.lang.Double height)
corners
- the list of locations defining this extruded polygon's outer boundary.height
- the shape height, in meters. May be null, in which case a height of 1 is used. The height is used
only when the altitude mode is WorldWind.CONSTANT
, which is the default for this shape.java.lang.IllegalArgumentException
- if the location list is null or the height is specified but less than or equal
to zero.public ExtrudedPolygon(java.lang.Iterable<? extends LatLon> corners, double height, java.lang.Iterable<?> imageSources)
corners
- the list of locations defining this polygon's outer boundary.height
- the shape height, in meters. May be null, in which case a height of 1 is used. The height is
used only when the altitude mode is WorldWind.CONSTANT
, which is the default for this
shape.imageSources
- images to apply to the polygon's outer faces. One image for each face must be included. May
also be null.java.lang.IllegalArgumentException
- if the location list is null or the height is specified but less than or equal
to zero.public ExtrudedPolygon(java.lang.Iterable<? extends Position> corners)
corners
- the list of outer boundary positions -- latitude longitude and altitude. The altitude mode
determines whether the positions are considered relative to mean sea level (they are "absolute")
or the ground elevation at the associated latitude and longitude.java.lang.IllegalArgumentException
- if the position list is null.public ExtrudedPolygon(java.lang.Iterable<? extends Position> corners, java.lang.Iterable<?> imageSources)
corners
- the list of positions -- latitude longitude and altitude -- defining the polygon. The
altitude mode determines whether the positions are considered relative to mean sea level
(they are "absolute") or the ground elevation at the associated latitude and longitude.imageSources
- textures to apply to the polygon's outer faces. One texture for each face must be included.
May also be null.java.lang.IllegalArgumentException
- if the position list is null.public ExtrudedPolygon(Position.PositionList corners)
corners
- the list of positions -- latitude longitude and altitude -- defining the polygon's outer boundary.
The altitude mode determines whether the positions are considered relative to mean sea level (they
are "absolute") or the ground elevation at the associated latitude and longitude.java.lang.IllegalArgumentException
- if the position list is null.public void addInnerBoundary(java.lang.Iterable<? extends LatLon> corners)
corners
- the boundary's locations.java.lang.IllegalArgumentException
- if the location list is null or contains fewer than three locations.public void addInnerBoundary(java.lang.Iterable<? extends LatLon> corners, java.lang.Iterable<?> imageSources)
LatLon
s to use the polygon's single height, or Position
s, to include individual altitudes.corners
- the boundary's locations.imageSources
- images to apply to the boundary's faces. One image must be specified for each face. May be
null.java.lang.IllegalArgumentException
- if the location list is null.protected OGLStackHandler beginDrawing(DrawContext dc, int attrMask)
AbstractShape
A AbstractShape.AbstractShapeData
must be current when this method is called.
beginDrawing
in class AbstractShape
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 computeBoundaryVertices(Terrain terrain, ExtrudedPolygon.ExtrudedBoundaryInfo boundary, Vec4 refPoint)
terrain
- the terrain to use when computing the vertices.boundary
- the boundary for which to compute the vertices.refPoint
- the reference point specifying the coordinate origin of the vertices.protected java.nio.FloatBuffer computeCapNormals(ExtrudedPolygon.ExtrudedBoundaryInfo boundary, java.nio.FloatBuffer nBuf)
boundary
- the boundary to compute normals for.nBuf
- the buffer in which to place the computed normals. Must have enough remaining space to hold the
normals.protected Extent computeExtent(ExtrudedPolygon.ExtrudedBoundaryInfo outerBoundary, Vec4 refPoint)
outerBoundary
- the shape's outer boundary.refPoint
- a reference point to which the extent is translated. May be null.protected double computeEyeDistance(DrawContext dc, ExtrudedPolygon.ShapeData shapeData)
dc
- the draw context.shapeData
- this shape's current globe-specific data.protected Vec4 computePolygonNormal(ExtrudedPolygon.ShapeData shapeData)
protected void computeReferencePoint(Terrain terrain, ExtrudedPolygon.ShapeData shapeData)
terrain
- the terrain to use when computing the reference point. The reference point is always on the
terrain.shapeData
- the current shape data.protected int countLocations()
protected AbstractShape.AbstractShapeData createCacheEntry(DrawContext dc)
AbstractShape
createCacheEntry
in class AbstractShape
dc
- the current draw context.protected void createCapGeometry(DrawContext dc, ExtrudedPolygon.ShapeData shapeData)
dc
- the current draw context.shapeData
- boundary vertices are calculated during createMinimalGeometry(DrawContext,
gov.nasa.worldwind.render.ExtrudedPolygon.ShapeData)
).protected void createCapNormals(ExtrudedPolygon.ShapeData shapeData)
protected void createFullGeometry(DrawContext dc, Terrain terrain, ExtrudedPolygon.ShapeData shapeData, boolean skipOuterBoundary)
dc
- the current draw context.terrain
- the terrain to use when computing the geometry.shapeData
- the boundary set to compute the geometry for.skipOuterBoundary
- true if outer boundaries vertices do not need to be calculated, otherwise false.protected ExtrudedPolygon.ShapeData createIntersectionGeometry(Terrain terrain)
protected void createMinimalGeometry(DrawContext dc, ExtrudedPolygon.ShapeData shapeData)
dc
- the current draw context.shapeData
- this shape's current globe-specific data.protected void createSideGeometry(ExtrudedPolygon.ShapeData shapeData)
shapeData
- the current shape data.protected void createSideNormals(ExtrudedPolygon.ShapeData shapeData)
protected void createSideTextureCoords(ExtrudedPolygon.ShapeData shapeData)
shapeData
- the current shape data.protected SurfaceShape createSurfaceShape()
AbstractShape
SurfaceShape
that corresponds to this Path and is used for drawing on 2D globes.createSurfaceShape
in class AbstractShape
protected void createTessllationGeometry(DrawContext dc, ExtrudedPolygon.ShapeData shapeData)
OutOfMemoryError
exceptions and if the draw
context is not null passes the exception to the rendering exception listener (see WorldWindow.addRenderingExceptionListener(gov.nasa.worldwind.event.RenderingExceptionListener)
).dc
- the draw context.shapeData
- the boundary set to tessellateprotected void createVertices(Terrain terrain, ExtrudedPolygon.ShapeData shapeData, boolean skipOuterBoundary)
terrain
- the terrain to use when computing the vertices.shapeData
- the current shape data.skipOuterBoundary
- if true, do not compute the outer boundary's vertices because they have already been
computed.protected void determineActiveAttributes()
AbstractShape
determineActiveAttributes
in class AbstractShape
AbstractShape.getActiveAttributes()
protected void doDrawInterior(DrawContext dc)
doDrawInterior
in class AbstractShape
dc
- not used.protected void doDrawOutline(DrawContext dc)
drawOutline(DrawContext)
.doDrawOutline
in class AbstractShape
dc
- not used.protected void doExportAsKML(javax.xml.stream.XMLStreamWriter xmlWriter) throws java.io.IOException, javax.xml.stream.XMLStreamException
AbstractShape
doExportAsKML
in class AbstractShape
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 boolean doMakeOrderedRenderable(DrawContext dc)
AbstractShape
AbstractShape.pick(DrawContext, java.awt.Point)
and AbstractShape.render(DrawContext)
when it's been determined that the shape is
likely to be visible.doMakeOrderedRenderable
in class AbstractShape
dc
- the current draw context.AbstractShape.pick(DrawContext, java.awt.Point)
,
AbstractShape.render(DrawContext)
public void drawCapInterior(DrawContext dc, ExtrudedPolygon.ShapeData shapeData)
dc
- the draw context.shapeData
- this shape's current globe-specific data.public void drawCapOutline(DrawContext dc, ExtrudedPolygon.ShapeData shapeData)
This base implementation draws the outline of the basic polygon. Subclasses should override it to draw their outline or an alternate outline of the basic polygon.
dc
- the draw context.shapeData
- the current shape data.public void drawInterior(DrawContext dc)
AbstractShape
A AbstractShape.AbstractShapeData
must be current when this method is called.
drawInterior
in class AbstractShape
dc
- the current draw context.public void drawOutline(DrawContext dc)
AbstractShape
A AbstractShape.AbstractShapeData
must be current when this method is called.
drawOutline
in class AbstractShape
dc
- the current draw context.protected void drawSideInteriors(DrawContext dc, ExtrudedPolygon.ShapeData shapeData)
dc
- the draw context.shapeData
- this shape's current globe-specific data.protected void drawSideOutline(DrawContext dc, ExtrudedPolygon.ShapeData shapeData)
dc
- the draw context.shapeData
- the current shape data.protected void exportBoundaryAsLinearRing(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.Iterable<? extends LatLon> boundary) throws javax.xml.stream.XMLStreamException
xmlWriter
- the XML writer.boundary
- the boundary to write.javax.xml.stream.XMLStreamException
- if an error occurs during writing.protected java.util.List<? extends LatLon> fillBoundary(java.lang.Iterable<? extends LatLon> corners)
protected java.util.List<WWTexture> fillImageList(java.lang.Iterable<?> imageSources)
imageSources
- the images to apply for this boundary.imageSources
argument is null.protected java.nio.FloatBuffer fillSideNormalBuffer(Vec4[] topVerts, Vec4[] bottomVerts, java.nio.FloatBuffer nBuf)
protected void fillSideTexCoordBuffer(Vec4[] topVerts, Vec4[] bottomVerts, java.nio.FloatBuffer tBuf)
topVerts
- the boundary's top Cartesian coordinates.bottomVerts
- the boundary's bottom Cartesian coordinates.tBuf
- the buffer in which to place the computed texture coordinates.protected java.nio.FloatBuffer fillSideVertexBuffer(Vec4[] topVerts, Vec4[] bottomVerts, java.nio.FloatBuffer vBuf)
protected void fillVBO(DrawContext dc)
AbstractShape
A AbstractShape.AbstractShapeData
must be current when this method is called.
fillVBO
in class AbstractShape
dc
- the current draw context.protected void generateCapInteriorIndices(ExtrudedPolygon.ShapeData shapeData)
shapeData
- the current shape data.protected ShapeAttributes getActiveCapAttributes()
protected ShapeAttributes getActiveSideAttributes()
public double getBaseDepth()
setBaseDepth(double)
protected java.util.List<java.util.List<? extends LatLon>> getBoundaries()
public ShapeAttributes getCapAttributes()
protected java.nio.IntBuffer getCapEdgeIndices(int n)
n
- the number of positions in the polygon.public ShapeAttributes getCapHighlightAttributes()
public java.lang.Object getCapImageSource()
protected WWTexture getCapTexture()
protected ExtrudedPolygon.ShapeData getCurrent()
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
getExtent
in class AbstractShape
globe
- the Globe the object is related to.verticalExaggeration
- the vertical exaggeration of the scene containing this object.public double getHeight()
public java.util.List<java.util.List<java.lang.Object>> getImageSources()
public java.lang.Iterable<? extends LatLon> getOuterBoundary()
public LatLon getReferenceLocation()
getReferencePosition()
public Position getReferencePosition()
public Sector getSector()
GeographicExtent
public ShapeAttributes getSideAttributes()
protected java.nio.IntBuffer getSideEdgeIndices(int n)
n
- the number of positions in the boundary.public ShapeAttributes getSideHighlightAttributes()
protected java.nio.IntBuffer getSideIndices(int n)
n
- the number of positions in this extruded polygon.public float[] getTextureCoords()
public boolean hasSideTextures()
protected void initialize()
AbstractShape
initialize
in class AbstractShape
public java.util.List<Intersection> intersect(Line line, Terrain terrain) throws java.lang.InterruptedException
WorldWind.ABSOLUTE
, the extruded polygon'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.intersect
in class AbstractShape
line
- the line to intersect.terrain
- the Terrain
to use when computing the extruded polygon's geometry.java.lang.InterruptedException
- if the operation is interrupted.Terrain
protected java.util.List<Intersection> intersectBoundarySides(Line line, ExtrudedPolygon.ExtrudedBoundaryInfo boundary) throws java.lang.InterruptedException
line
- the line to intersect.boundary
- the boundary to intersect.java.lang.InterruptedException
- if the operation is interrupted.protected void intersectCap(Line line, ExtrudedPolygon.ShapeData shapeData, java.util.List<Intersection> intersections) throws java.lang.InterruptedException
java.lang.InterruptedException
public boolean isEnableCap()
public boolean isEnableSides()
protected boolean isOrderedRenderableValid(DrawContext dc)
AbstractShape
AbstractShape.makeOrderedRenderable(DrawContext)
just prior to adding the shape to the ordered renderable list.isOrderedRenderableValid
in class AbstractShape
dc
- the current draw context.protected boolean isOuterBoundaryValid()
protected boolean isSameAsPreviousTerrain(Terrain terrain)
protected boolean isTerrainDependent()
AbstractShape
isTerrainDependent
in class AbstractShape
public void moveTo(Position position)
Note that this method overwrites the boundary locations lists, and therefore no longer refer to the originally specified boundary lists.
position
- the new position of the shape's reference position.protected boolean mustApplySideTextures()
protected boolean mustApplyTexture(DrawContext dc)
AbstractShape
Note: This method always returns false during the pick pass.
mustApplyTexture
in class AbstractShape
dc
- the current draw contextprotected boolean mustDrawInterior()
mustDrawInterior
in class AbstractShape
protected boolean mustDrawOutline()
mustDrawOutline
in class AbstractShape
protected boolean mustRegenerateGeometry(DrawContext dc)
AbstractShape
A AbstractShape.AbstractShapeData
must be current when this method is called.
mustRegenerateGeometry
in class AbstractShape
dc
- the current draw context.protected java.util.List<? extends LatLon> outerBoundary()
public void render(DrawContext dc)
Renderable
Renderable
to render itself using the provided draw context.render
in interface Renderable
render
in class AbstractShape
dc
- the DrawContext
to be usedDrawContext
protected void reset()
AbstractShape
reset
in class AbstractShape
public void setBaseDepth(double baseDepth)
baseDepth
- the depth in meters to position the base vertices below the terrain. Specify positive values to
position the base vertices below the terrain. (Negative values position the base vertices above
the terrain.)public void setCapAttributes(ShapeAttributes attributes)
attributes
- this polygon's cap attributes.java.lang.IllegalArgumentException
- if attributes
is null.public void setCapHighlightAttributes(ShapeAttributes attributes)
attributes
- this polygon's cap highlight attributes.java.lang.IllegalArgumentException
- if attributes
is null.public void setCapImageSource(java.lang.Object imageSource, float[] texCoords, int texCoordCount)
imageSource
- the 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 location in the polygon's outer boundary.texCoordCount
- the number of texture coordinates, (s, v) pairs, specified.java.lang.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.public void setEnableCap(boolean enableCap)
enableCap
- true to draw the cap, otherwise false.public void setEnableSides(boolean enableSides)
enableSides
- true to draw the sides, otherwise false.public void setHeight(double height)
height
- the height, in meters.java.lang.IllegalArgumentException
- if the height is less than or equal to zero.public void setOuterBoundary(java.lang.Iterable<? extends LatLon> corners)
Position
s rather than LatLon
s. The shape's height is not modified.corners
- the outer boundary locations.java.lang.IllegalArgumentException
- if the location list is null or contains fewer than three locations.public void setOuterBoundary(java.lang.Iterable<? extends LatLon> corners, java.lang.Double height)
Position
s rather than
LatLon
s, but those altitudes are used only when the shape's altitude mode is WorldWind.ABSOLUTE
.corners
- the outer boundary locations.height
- the shape height, in meters.java.lang.IllegalArgumentException
- if the location list is null or contains fewer than three locations.public void setOuterBoundary(java.lang.Iterable<? extends LatLon> corners, java.lang.Iterable<?> imageSources)
Position
s rather than LatLon
s.corners
- the polygon locations.imageSources
- images to apply to the outer faces. One image must be specified for each face. May be null.java.lang.IllegalArgumentException
- if the location list is null.public void setReferenceLocation(LatLon referenceLocation)
referenceLocation
- the reference location. May be null, in which case the first location of the outer
boundary is the reference location.AbstractShape.setReferencePosition(gov.nasa.worldwind.geom.Position)
public void setSideAttributes(ShapeAttributes attributes)
attributes
- this polygon's side attributes.java.lang.IllegalArgumentException
- if attributes
is null.public void setSideHighlightAttributes(ShapeAttributes attributes)
attributes
- this polygon's side highlight attributes.java.lang.IllegalArgumentException
- if attributes
is null.protected void setSurfacePolygonBoundaries(SurfaceShape shape)
protected void tessellatePolygon(ExtrudedPolygon.ShapeData shapeData, Vec4 normal)
shapeData
- the polygon boundaries.normal
- a unit normal vector for the plane containing the polygon vertices. Even though the the vertices
might not be coplanar, only one representative normal is used for tessellation.protected void writeKMLBoundaries(javax.xml.stream.XMLStreamWriter xmlWriter) throws java.io.IOException, javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.stream.XMLStreamException