NASA World Wind

gov.nasa.worldwind.render
Class ExtrudedPolygon

java.lang.Object
  extended by gov.nasa.worldwind.avlist.AVListImpl
      extended by gov.nasa.worldwind.WWObjectImpl
          extended by gov.nasa.worldwind.render.AbstractShape
              extended by gov.nasa.worldwind.render.ExtrudedPolygon
All Implemented Interfaces:
AVList, MessageListener, Exportable, ExtentHolder, Movable, GeographicExtent, Highlightable, OrderedRenderable, Renderable, Restorable, WWObject, PropertyChangeListener, EventListener
Direct Known Subclasses:
KMLExtrudedPolygonImpl

public class ExtrudedPolygon
extends AbstractShape

A multi-sided 3D shell formed by a base polygon in latitude and longitude extruded from the terrain to either a specified height or an independent height per location. The base polygon may be complex with multiple internal but not intersecting contours.

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 Positions 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 World Windows. 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.


Nested Class Summary
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.
 
Nested classes/interfaces inherited from class gov.nasa.worldwind.render.AbstractShape
AbstractShape.AbstractShapeData
 
Field Summary
protected  ShapeAttributes activeSideAttributes
          The currently active side attributes, derived from the specified attributes.
protected  double baseDepth
           
protected  List<List<? extends LatLon>> boundaries
          The location of each vertex in this shape's boundaries.
protected static HashMap<Integer,IntBuffer> capEdgeIndexBuffers
           
protected  WWTexture capTexture
          This shape's cap texture.
protected  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  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 HashMap<Integer,IntBuffer> sideEdgeIndexBuffers
           
protected static HashMap<Integer,IntBuffer> sideFillIndexBuffers
           
protected  ShapeAttributes sideHighlightAttributes
          The attributes to use when drawing this shape's sides in highlight mode.
protected  List<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.
 
Fields inherited from class gov.nasa.worldwind.render.AbstractShape
activeAttributes, altitudeMode, BEogsh, currentData, DEFAULT_GEOMETRY_GENERATION_INTERVAL, DEFAULT_HIGHLIGHT_MATERIAL, DEFAULT_INTERIOR_MATERIAL, DEFAULT_OUTLINE_MATERIAL, DEFAULT_OUTLINE_PICK_WIDTH, defaultAttributes, delegateOwner, enableBatchPicking, enableBatchRendering, enableDepthOffset, highlightAttrs, highlighted, maxExpiryTime, minExpiryTime, normalAttrs, outlinePickWidth, outlineShapeRenderer, pickLayer, pickSupport, referencePosition, sector, shapeDataCache, viewDistanceExpiration, visible
 
Fields inherited from interface gov.nasa.worldwind.Exportable
FORMAT_NOT_SUPPORTED, FORMAT_PARTIALLY_SUPPORTED, FORMAT_SUPPORTED
 
Constructor Summary
ExtrudedPolygon()
          Constructs an extruded polygon with an empty outer boundary and a default height of 1 meter.
ExtrudedPolygon(Double height)
          Constructs an extruded polygon of a specified height and an empty outer boundary.
ExtrudedPolygon(Iterable<? extends LatLon> corners, Double height)
          Constructs an extruded polygon for a specified list of outer boundary locations and a height.
ExtrudedPolygon(Iterable<? extends LatLon> corners, double height, Iterable<?> imageSources)
          Constructs an extruded polygon from an outer boundary, a height, and images for its outer faces.
ExtrudedPolygon(Iterable<? extends Position> corners)
          Constructs an extruded polygon from an outer boundary.
ExtrudedPolygon(Iterable<? extends Position> corners, 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.
 
Method Summary
 void addInnerBoundary(Iterable<? extends LatLon> corners)
          Add an inner boundary to this polygon.
 void addInnerBoundary(Iterable<? extends LatLon> corners, 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  FloatBuffer computeCapNormals(ExtrudedPolygon.ExtrudedBoundaryInfo boundary, 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  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(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(XMLStreamWriter xmlWriter, 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  List<? extends LatLon> fillBoundary(Iterable<? extends LatLon> corners)
           
protected  List<WWTexture> fillImageList(Iterable<?> imageSources)
          Creates texture object for a boundary's image sources.
protected  FloatBuffer fillSideNormalBuffer(Vec4[] topVerts, Vec4[] bottomVerts, FloatBuffer nBuf)
           
protected  void fillSideTexCoordBuffer(Vec4[] topVerts, Vec4[] bottomVerts, FloatBuffer tBuf)
          Computes the texture coordinates for a boundary of this shape.
protected  FloatBuffer fillSideVertexBuffer(Vec4[] topVerts, Vec4[] bottomVerts, 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  List<List<? extends LatLon>> getBoundaries()
          Returns this shape's boundaries.
 ShapeAttributes getCapAttributes()
          Returns the attributes applied to this polygon's cap.
protected  IntBuffer getCapEdgeIndices(int n)
          Returns the indices defining the cap vertices.
 ShapeAttributes getCapHighlightAttributes()
          Returns the highlight attributes applied to this polygon's cap.
 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.
 List<List<Object>> getImageSources()
          Returns this extruded polygon's side images.
 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  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  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.
 List<Intersection> intersect(Line line, Terrain terrain)
          Compute the intersections of a specified line with this extruded polygon.
protected  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, 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  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(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(Iterable<? extends LatLon> corners)
          Specifies the latitude and longitude of the locations defining the outer boundary of this polygon.
 void setOuterBoundary(Iterable<? extends LatLon> corners, Double height)
          Specifies the latitude and longitude of the outer boundary locations defining this polygon, and optionally the extruded polygon's height.
 void setOuterBoundary(Iterable<? extends LatLon> corners, 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 tessellatePolygon(ExtrudedPolygon.ShapeData shapeData, Vec4 normal)
          Tessellates the polygon from its vertices.
protected  void writeKMLBoundaries(XMLStreamWriter xmlWriter)
           
 
Methods inherited from class gov.nasa.worldwind.render.AbstractShape
addOrderedRenderable, checkViewDistanceExpiration, clearCachedVbos, computeExtentFromPositions, computePoint, countTriangleVertices, createPickedObject, doDrawOrderedRenderable, doGetRestorableState, doRestoreState, drawBatched, drawOrderedRenderable, endDrawing, export, exportAsKML, getActiveAttributes, getAltitudeMode, getAttributes, getCurrentData, getDelegateOwner, getDistanceFromEye, getExtent, getGeometryRegenerationInterval, getHighlightAttributes, getOutlinePickWidth, getReferencePoint, getRestorableState, getVboIds, intersectsFrustum, isEnableBatchPicking, isEnableBatchRendering, isEnableDepthOffset, isExportFormatSupported, isHighlighted, isViewDistanceExpiration, isVisible, makeOrderedRenderable, makeTexture, move, mustApplyLighting, mustApplyLighting, mustCreateNormals, mustCreateNormals, pick, prepareToDrawInterior, prepareToDrawOutline, restoreState, setAltitudeMode, setAttributes, setDelegateOwner, setEnableBatchPicking, setEnableBatchRendering, setEnableDepthOffset, setGeometryRegenerationInterval, setHighlightAttributes, setHighlighted, setOutlinePickWidth, setReferencePosition, setViewDistanceExpiration, setVisible, shouldUseVBOs
 
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.avlist.AVList
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
 

Field Detail

activeSideAttributes

protected ShapeAttributes activeSideAttributes
The currently active side attributes, derived from the specified attributes. Current only during rendering.


baseDepth

protected double baseDepth

boundaries

protected List<List<? extends LatLon>> boundaries
The location of each vertex in this shape's boundaries. There is one list per boundary. There is always an entry for the outer boundary, but its list is empty if an outer boundary has not been specified.


capEdgeIndexBuffers

protected static HashMap<Integer,IntBuffer> capEdgeIndexBuffers

capTexture

protected WWTexture capTexture
This shape's cap texture.


capTextureCoords

protected FloatBuffer capTextureCoords
This shape's cap texture coordinates.


DEFAULT_ALTITUDE_MODE

protected static final int DEFAULT_ALTITUDE_MODE
The default altitude mode.

See Also:
Constant Field Values

DEFAULT_SIDES_INTERIOR_MATERIAL

protected static final Material DEFAULT_SIDES_INTERIOR_MATERIAL
The default interior color for sides.


defaultSideAttributes

protected static final ShapeAttributes defaultSideAttributes
The attributes used if attributes are not specified.


enableCap

protected boolean enableCap
Indicates whether the cap should be drawn.


enableSides

protected boolean enableSides
Indicates whether the sides should be drawn.


height

protected double height
This shape's height. Default is 1.


previousIntersectionGlobeStateKey

protected Object previousIntersectionGlobeStateKey
The globe state key for the globe used in the most recent intersection calculation.


previousIntersectionShapeData

protected ExtrudedPolygon.ShapeData previousIntersectionShapeData
The shape data used for the previous intersection calculation.


previousIntersectionTerrain

protected Terrain previousIntersectionTerrain
The terrain used in the most recent intersection calculations.


sideAttributes

protected ShapeAttributes sideAttributes
The attributes to use when drawing this shape's sides.


sideEdgeIndexBuffers

protected static HashMap<Integer,IntBuffer> sideEdgeIndexBuffers

sideFillIndexBuffers

protected static HashMap<Integer,IntBuffer> sideFillIndexBuffers

sideHighlightAttributes

protected ShapeAttributes sideHighlightAttributes
The attributes to use when drawing this shape's sides in highlight mode.


sideTextures

protected List<List<WWTexture>> sideTextures
This shape's side textures.


totalFaceCount

protected int totalFaceCount
The total number of faces in all this shape's boundaries.


totalNumLocations

protected int totalNumLocations
The total number of locations in all boundaries.


VBO_THRESHOLD

protected static final int VBO_THRESHOLD
Indicates the number of vertices that must be present in order for VBOs to be used to render this shape.

Constructor Detail

ExtrudedPolygon

public ExtrudedPolygon()
Constructs an extruded polygon with an empty outer boundary and a default height of 1 meter.


ExtrudedPolygon

public ExtrudedPolygon(Double height)
Constructs an extruded polygon of a specified height and an empty outer boundary.

Parameters:
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.

ExtrudedPolygon

public ExtrudedPolygon(Iterable<? extends LatLon> corners,
                       Double height)
Constructs an extruded polygon for a specified list of outer boundary locations and a height.

Parameters:
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.
Throws:
IllegalArgumentException - if the location list is null or the height is specified but less than or equal to zero.

ExtrudedPolygon

public ExtrudedPolygon(Iterable<? extends LatLon> corners,
                       double height,
                       Iterable<?> imageSources)
Constructs an extruded polygon from an outer boundary, a height, and images for its outer faces.

Parameters:
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.
Throws:
IllegalArgumentException - if the location list is null or the height is specified but less than or equal to zero.

ExtrudedPolygon

public ExtrudedPolygon(Iterable<? extends Position> corners)
Constructs an extruded polygon from an outer boundary.

Parameters:
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.
Throws:
IllegalArgumentException - if the position list is null.

ExtrudedPolygon

public ExtrudedPolygon(Iterable<? extends Position> corners,
                       Iterable<?> imageSources)
Constructs an extruded polygon from an outer boundary and apply specified textures to its outer faces.

Parameters:
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.
Throws:
IllegalArgumentException - if the position list is null.

ExtrudedPolygon

public ExtrudedPolygon(Position.PositionList corners)
Constructs an extruded polygon from an outer boundary specified with position heights.

Parameters:
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.
Throws:
IllegalArgumentException - if the position list is null.
Method Detail

addInnerBoundary

public void addInnerBoundary(Iterable<? extends LatLon> corners)
Add an inner boundary to this polygon.

Parameters:
corners - the boundary's locations.
Throws:
IllegalArgumentException - if the location list is null or contains fewer than three locations.

addInnerBoundary

public void addInnerBoundary(Iterable<? extends LatLon> corners,
                             Iterable<?> imageSources)
Add an inner boundary to this polygon and specify images to apply to each of the boundary's faces. Specify LatLons to use the polygon's single height, or Positions, to include individual altitudes.

Parameters:
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.
Throws:
IllegalArgumentException - if the location list is null.

beginDrawing

protected OGLStackHandler beginDrawing(DrawContext dc,
                                       int attrMask)
Description copied from class: AbstractShape
Establish the OpenGL state needed to draw this shape.

A AbstractShape.AbstractShapeData must be current when this method is called.

Overrides:
beginDrawing in class AbstractShape
Parameters:
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.
Returns:
the stack handler used to set the OpenGL state. Callers should use this to set additional state, especially state indicated in the attribute mask argument.

computeBoundaryVertices

protected void computeBoundaryVertices(Terrain terrain,
                                       ExtrudedPolygon.ExtrudedBoundaryInfo boundary,
                                       Vec4 refPoint)
Compute and set the Cartesian vertices for one specified boundary of this shape.

Parameters:
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.

computeCapNormals

protected FloatBuffer computeCapNormals(ExtrudedPolygon.ExtrudedBoundaryInfo boundary,
                                        FloatBuffer nBuf)
Compute normal vectors for an extruded polygon's cap vertices.

Parameters:
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.
Returns:
the buffer specified as input, with its limit incremented by the number of vertices copied, and its position set to 0.

computeExtent

protected Extent computeExtent(ExtrudedPolygon.ExtrudedBoundaryInfo outerBoundary,
                               Vec4 refPoint)
Computes this shapes extent. If a reference point is specified, the extent is translated to that reference point.

Parameters:
outerBoundary - the shape's outer boundary.
refPoint - a reference point to which the extent is translated. May be null.
Returns:
the computed extent, or null if the extent cannot be computed.

computeEyeDistance

protected double computeEyeDistance(DrawContext dc,
                                    ExtrudedPolygon.ShapeData shapeData)
Computes the minimum distance between this shape and the eye point.

Parameters:
dc - the draw context.
shapeData - this shape's current globe-specific data.
Returns:
the minimum distance from the shape to the eye point.

computePolygonNormal

protected Vec4 computePolygonNormal(ExtrudedPolygon.ShapeData shapeData)

computeReferencePoint

protected void computeReferencePoint(Terrain terrain,
                                     ExtrudedPolygon.ShapeData shapeData)
Computes and sets this shape's reference point, the Cartesian position corresponding to its geographic location.

Parameters:
terrain - the terrain to use when computing the reference point. The reference point is always on the terrain.
shapeData - the current shape data.

countLocations

protected int countLocations()
Counts the total number of locations in this polygon's boundaries, not including positions introduced by extrusion.

Returns:
the number of locations in the polygon boundaries.

createCacheEntry

protected AbstractShape.AbstractShapeData createCacheEntry(DrawContext dc)
Description copied from class: AbstractShape
Creates and returns a new cache entry specific to the subclass.

Specified by:
createCacheEntry in class AbstractShape
Parameters:
dc - the current draw context.
Returns:
a data cache entry for the state in the specified draw context.

createCapGeometry

protected void createCapGeometry(DrawContext dc,
                                 ExtrudedPolygon.ShapeData shapeData)
Compute the cap geometry.

Parameters:
dc - the current draw context.
shapeData - boundary vertices are calculated during createMinimalGeometry(DrawContext, gov.nasa.worldwind.render.ExtrudedPolygon.ShapeData)).

createCapNormals

protected void createCapNormals(ExtrudedPolygon.ShapeData shapeData)

createFullGeometry

protected void createFullGeometry(DrawContext dc,
                                  Terrain terrain,
                                  ExtrudedPolygon.ShapeData shapeData,
                                  boolean skipOuterBoundary)
Computes a boundary set's full geometry.

Parameters:
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.

createIntersectionGeometry

protected ExtrudedPolygon.ShapeData createIntersectionGeometry(Terrain terrain)

createMinimalGeometry

protected void createMinimalGeometry(DrawContext dc,
                                     ExtrudedPolygon.ShapeData shapeData)
Computes the information necessary to determine this extruded polygon's extent.

Parameters:
dc - the current draw context.
shapeData - this shape's current globe-specific data.

createSideGeometry

protected void createSideGeometry(ExtrudedPolygon.ShapeData shapeData)
Constructs the Cartesian geometry of this shape's sides and sets it in the specified shape data.

Parameters:
shapeData - the current shape data.

createSideNormals

protected void createSideNormals(ExtrudedPolygon.ShapeData shapeData)

createSideTextureCoords

protected void createSideTextureCoords(ExtrudedPolygon.ShapeData shapeData)
Creates the texture coordinates for this shape's sides.

Parameters:
shapeData - the current shape data.

createTessllationGeometry

protected void createTessllationGeometry(DrawContext dc,
                                         ExtrudedPolygon.ShapeData shapeData)
Tessellates this extruded polygon's cap. This method catches 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)).

Parameters:
dc - the draw context.
shapeData - the boundary set to tessellate

createVertices

protected void createVertices(Terrain terrain,
                              ExtrudedPolygon.ShapeData shapeData,
                              boolean skipOuterBoundary)
Creates this shape's Cartesian vertices.

Parameters:
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.

determineActiveAttributes

protected void determineActiveAttributes()
Description copied from class: AbstractShape
Determines which attributes -- normal, highlight or default -- to use each frame. Places the result in this shape's current active attributes.

Overrides:
determineActiveAttributes in class AbstractShape
See Also:
AbstractShape.getActiveAttributes()

doDrawInterior

protected void doDrawInterior(DrawContext dc)
Not used by this class.

Specified by:
doDrawInterior in class AbstractShape
Parameters:
dc - not used.

doDrawOutline

protected void doDrawOutline(DrawContext dc)
Not used by this class, which overrides drawOutline(DrawContext).

Specified by:
doDrawOutline in class AbstractShape
Parameters:
dc - not used.

doExportAsKML

protected void doExportAsKML(XMLStreamWriter xmlWriter)
                      throws IOException,
                             XMLStreamException
Description copied from class: AbstractShape
Exports shape-specific fields.

Specified by:
doExportAsKML in class AbstractShape
Parameters:
xmlWriter - the export writer to write to.
Throws:
IOException - if an IO error occurs while writing to the output destination.
XMLStreamException - if an exception occurs converting this shape's fields to XML.

doMakeOrderedRenderable

protected boolean doMakeOrderedRenderable(DrawContext dc)
Description copied from class: AbstractShape
Produces the geometry and other state necessary to represent this shape as an ordered renderable. Places this shape on the draw context's ordered renderable list for subsequent rendering. This method is called during AbstractShape.pick(DrawContext, java.awt.Point) and AbstractShape.render(DrawContext) when it's been determined that the shape is likely to be visible.

Specified by:
doMakeOrderedRenderable in class AbstractShape
Parameters:
dc - the current draw context.
Returns:
true if the ordered renderable state was successfully computed, otherwise false, in which case the current pick or render pass is terminated for this shape. Subclasses should return false if it is not possible to create the ordered renderable state.
See Also:
AbstractShape.pick(DrawContext, java.awt.Point), AbstractShape.render(DrawContext)

drawCapInterior

public void drawCapInterior(DrawContext dc,
                            ExtrudedPolygon.ShapeData shapeData)
Draws the filled interior of this shape's cap.

Parameters:
dc - the draw context.
shapeData - this shape's current globe-specific data.

drawCapOutline

public void drawCapOutline(DrawContext dc,
                           ExtrudedPolygon.ShapeData shapeData)
Draws the cap's outline.

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.

Parameters:
dc - the draw context.
shapeData - the current shape data.

drawInterior

public void drawInterior(DrawContext dc)
Description copied from class: AbstractShape
Draws this shape's interior.

A AbstractShape.AbstractShapeData must be current when this method is called.

Overrides:
drawInterior in class AbstractShape
Parameters:
dc - the current draw context.

drawOutline

public void drawOutline(DrawContext dc)
Description copied from class: AbstractShape
Draws this shape's outline.

A AbstractShape.AbstractShapeData must be current when this method is called.

Overrides:
drawOutline in class AbstractShape
Parameters:
dc - the current draw context.

drawSideInteriors

protected void drawSideInteriors(DrawContext dc,
                                 ExtrudedPolygon.ShapeData shapeData)
Draws this shape's sides.

Parameters:
dc - the draw context.
shapeData - this shape's current globe-specific data.

drawSideOutline

protected void drawSideOutline(DrawContext dc,
                               ExtrudedPolygon.ShapeData shapeData)
Draws this extruded polygon's side outline.

Parameters:
dc - the draw context.
shapeData - the current shape data.

exportBoundaryAsLinearRing

protected void exportBoundaryAsLinearRing(XMLStreamWriter xmlWriter,
                                          Iterable<? extends LatLon> boundary)
                                   throws XMLStreamException
Writes the boundary in KML as either a list of lat, lon, altitude tuples or lat, lon tuples, depending on the type originally specified.

Parameters:
xmlWriter - the XML writer.
boundary - the boundary to write.
Throws:
XMLStreamException - if an error occurs during writing.

fillBoundary

protected List<? extends LatLon> fillBoundary(Iterable<? extends LatLon> corners)

fillImageList

protected List<WWTexture> fillImageList(Iterable<?> imageSources)
Creates texture object for a boundary's image sources.

Parameters:
imageSources - the images to apply for this boundary.
Returns:
the list of texture objects, or null if the imageSources argument is null.

fillSideNormalBuffer

protected FloatBuffer fillSideNormalBuffer(Vec4[] topVerts,
                                           Vec4[] bottomVerts,
                                           FloatBuffer nBuf)

fillSideTexCoordBuffer

protected void fillSideTexCoordBuffer(Vec4[] topVerts,
                                      Vec4[] bottomVerts,
                                      FloatBuffer tBuf)
Computes the texture coordinates for a boundary of this shape.

Parameters:
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.

fillSideVertexBuffer

protected FloatBuffer fillSideVertexBuffer(Vec4[] topVerts,
                                           Vec4[] bottomVerts,
                                           FloatBuffer vBuf)

fillVBO

protected void fillVBO(DrawContext dc)
Description copied from class: AbstractShape
Fill this shape's vertex buffer objects. If the vertex buffer object resource IDs don't yet exist, create them.

A AbstractShape.AbstractShapeData must be current when this method is called.

Specified by:
fillVBO in class AbstractShape
Parameters:
dc - the current draw context.

generateCapInteriorIndices

protected void generateCapInteriorIndices(ExtrudedPolygon.ShapeData shapeData)
Construct the lists of indices that identify the tessellated shape's vertices in the vertex buffer.

Parameters:
shapeData - the current shape data.

getActiveCapAttributes

protected ShapeAttributes getActiveCapAttributes()
Each time this polygon is rendered the appropriate attributes for the current mode are determined. This method returns the resolved attributes.

Returns:
the currently active attributes for this polygon's cap.

getActiveSideAttributes

protected ShapeAttributes getActiveSideAttributes()
Each time this polygon is rendered the appropriate attributes for the current mode are determined. This method returns the resolved attributes.

Returns:
the currently active attributes for this polygon's side faces.

getBaseDepth

public double getBaseDepth()
Returns this object's base depth.

Returns:
This object's base depth, in meters.
See Also:
setBaseDepth(double)

getBoundaries

protected List<List<? extends LatLon>> getBoundaries()
Returns this shape's boundaries.

Returns:
this shape's boundaries.

getCapAttributes

public ShapeAttributes getCapAttributes()
Returns the attributes applied to this polygon's cap.

Returns:
this polygon's cap attributes.

getCapEdgeIndices

protected IntBuffer getCapEdgeIndices(int n)
Returns the indices defining the cap vertices.

Parameters:
n - the number of positions in the polygon.
Returns:
a buffer of indices that can be passed to OpenGL to draw all the shape's edges.

getCapHighlightAttributes

public ShapeAttributes getCapHighlightAttributes()
Returns the highlight attributes applied to this polygon's cap.

Returns:
this polygon's cap highlight attributes.

getCapImageSource

public Object getCapImageSource()
Returns this extruded polygon's cap image.

Returns:
the texture image source, or null if no source has been specified.

getCapTexture

protected WWTexture getCapTexture()
Get the texture applied to this extruded polygon's cap.

Returns:
The texture, or null if there is no texture or the texture is not yet available.

getCurrent

protected ExtrudedPolygon.ShapeData getCurrent()
Indicates the currently active shape data.

Returns:
the currently active shape data.

getExtent

public Extent getExtent(Globe globe,
                        double verticalExaggeration)
Description copied from interface: ExtentHolder
Returns the objects enclosing volume as an Extent in model coordinates, given a specified Globe and vertical exaggeration (see SceneController.getVerticalExaggeration().

Specified by:
getExtent in interface ExtentHolder
Overrides:
getExtent in class AbstractShape
Parameters:
globe - the Globe the object is related to.
verticalExaggeration - the vertical exaggeration of the scene containing this object.
Returns:
the object's Extent in model coordinates.

getHeight

public double getHeight()
Returns the height of this extruded polygon.

Returns:
the height originally specified, in meters.

getImageSources

public List<List<Object>> getImageSources()
Returns this extruded polygon's side images.

Returns:
a collection of lists each identifying the image sources for the associated outer or inner polygon boundary.

getOuterBoundary

public Iterable<? extends LatLon> getOuterBoundary()
Returns the list of locations or positions defining this polygon's outer boundary.

Returns:
this polygon's positions.

getReferenceLocation

public LatLon getReferenceLocation()
Indicates the location to use as a reference location for computed geometry.

Returns:
the reference location, or null if no reference location has been specified.
See Also:
getReferencePosition()

getReferencePosition

public Position getReferencePosition()
Indicates the position used as a reference position for this extruded polygon's computed geometry.

Returns:
the reference position, or null if no reference position has been specified.

getSector

public Sector getSector()
Description copied from interface: GeographicExtent
Returns the object's geographic extent.

Returns:
the object's geographic extent.

getSideAttributes

public ShapeAttributes getSideAttributes()
Returns the attributes applied to this polygon's side faces.

Returns:
this polygon's side attributes.

getSideEdgeIndices

protected IntBuffer getSideEdgeIndices(int n)
Returns the indices defining the vertices of a boundary's face edges.

Parameters:
n - the number of positions in the boundary.
Returns:
a buffer of indices that can be passed to OpenGL to draw all the boundary's edges.

getSideHighlightAttributes

public ShapeAttributes getSideHighlightAttributes()
Returns the highlight attributes applied to this polygon's side faces.

Returns:
this polygon's side highlight attributes.

getSideIndices

protected IntBuffer getSideIndices(int n)
Returns the indices defining the vertices of each face of this extruded polygon.

Parameters:
n - the number of positions in this extruded polygon.
Returns:
a buffer of indices that can be passed to OpenGL to draw all face of the shape.

getTextureCoords

public float[] getTextureCoords()
Returns the texture coordinates for this polygon's cap.

Returns:
the texture coordinates, or null if no cap texture coordinates have been specified.

hasSideTextures

public boolean hasSideTextures()
Indicates whether side images have been specified for this extruded polygon.

Returns:
true if side textures have been specified, otherwise false.

initialize

protected void initialize()
Description copied from class: AbstractShape
Called during construction to establish any subclass-specific state such as different default values than those set by this class.

Specified by:
initialize in class AbstractShape

intersect

public List<Intersection> intersect(Line line,
                                    Terrain terrain)
                             throws InterruptedException
Compute the intersections of a specified line with this extruded polygon. If the polygon's altitude mode is other than 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.

Specified by:
intersect in class AbstractShape
Parameters:
line - the line to intersect.
terrain - the Terrain to use when computing the extruded polygon's geometry.
Returns:
a list of intersections identifying where the line intersects the extruded polygon, or null if the line does not intersect the extruded polygon.
Throws:
InterruptedException - if the operation is interrupted.
See Also:
Terrain

intersectBoundarySides

protected List<Intersection> intersectBoundarySides(Line line,
                                                    ExtrudedPolygon.ExtrudedBoundaryInfo boundary)
                                             throws InterruptedException
Intersects a line with the sides of an individual boundary.

Parameters:
line - the line to intersect.
boundary - the boundary to intersect.
Returns:
the computed intersections, or null if there are no intersections.
Throws:
InterruptedException - if the operation is interrupted.

intersectCap

protected void intersectCap(Line line,
                            ExtrudedPolygon.ShapeData shapeData,
                            List<Intersection> intersections)
                     throws InterruptedException
Throws:
InterruptedException

isEnableCap

public boolean isEnableCap()
Indicates whether the cap of this extruded polygon is drawn.

Returns:
true to draw the cap, otherwise false.

isEnableSides

public boolean isEnableSides()
Indicates whether the sides of this extruded polygon are drawn.

Returns:
true to draw the sides, otherwise false.

isOrderedRenderableValid

protected boolean isOrderedRenderableValid(DrawContext dc)
Description copied from class: AbstractShape
Determines whether this shape's ordered renderable state is valid and can be rendered. Called by AbstractShape.makeOrderedRenderable(DrawContext)just prior to adding the shape to the ordered renderable list.

Specified by:
isOrderedRenderableValid in class AbstractShape
Parameters:
dc - the current draw context.
Returns:
true if this shape is ready to be rendered as an ordered renderable.

isOuterBoundaryValid

protected boolean isOuterBoundaryValid()
Indicates whether this shape's outer boundary exists and has more than two points.

Returns:
true if the outer boundary is valid, otherwise false.s

isSameAsPreviousTerrain

protected boolean isSameAsPreviousTerrain(Terrain terrain)

isTerrainDependent

protected boolean isTerrainDependent()
Description copied from class: AbstractShape
Indicates whether this shape's geometry depends on the terrain.

Overrides:
isTerrainDependent in class AbstractShape
Returns:
true if this shape's geometry depends on the terrain, otherwise false.

moveTo

public void moveTo(Position position)
Move the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.

Note that this method overwrites the boundary locations lists, and therefore no longer refer to the originally specified boundary lists.

Parameters:
position - the new position of the shape's reference position.

mustApplySideTextures

protected boolean mustApplySideTextures()

mustApplyTexture

protected boolean mustApplyTexture(DrawContext dc)
Description copied from class: AbstractShape
Indicates whether texture should be applied to this shape. Called during rendering to determine whether texture state should be established during preparation for interior drawing.

Note: This method always returns false during the pick pass.

Specified by:
mustApplyTexture in class AbstractShape
Parameters:
dc - the current draw context
Returns:
true if texture should be applied, otherwise false.

mustDrawInterior

protected boolean mustDrawInterior()
Indicates whether the interior of either the sides or cap must be drawn.

Overrides:
mustDrawInterior in class AbstractShape
Returns:
true if an interior must be drawn, otherwise false.

mustDrawOutline

protected boolean mustDrawOutline()
Indicates whether the polygon's outline should be drawn.

Overrides:
mustDrawOutline in class AbstractShape
Returns:
true if the outline should be drawn, otherwise false.

mustRegenerateGeometry

protected boolean mustRegenerateGeometry(DrawContext dc)
Description copied from class: AbstractShape
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.

A AbstractShape.AbstractShapeData must be current when this method is called.

Overrides:
mustRegenerateGeometry in class AbstractShape
Parameters:
dc - the current draw context.
Returns:
true if this shape's geometry must be regenerated, otherwise false.

outerBoundary

protected List<? extends LatLon> outerBoundary()
Returns a reference to the outer boundary of this polygon.

Returns:
this polygon's outer boundary.

render

public void render(DrawContext dc)
Description copied from interface: Renderable
Causes this Renderable to render itself using the provided draw context.

Specified by:
render in interface Renderable
Overrides:
render in class AbstractShape
Parameters:
dc - the DrawContext to be used
See Also:
DrawContext

reset

protected void reset()
Description copied from class: AbstractShape
Invalidates computed values. Called when this shape's contents or certain attributes change.

Overrides:
reset in class AbstractShape

setBaseDepth

public void setBaseDepth(double baseDepth)
Specifies a depth below the terrain at which to place this extruded polygon's base vertices. This value does not affect the height of the extruded polygon nor the position of its cap. It positions the base vertices such that they are the specified distance below the terrain. The default value is zero, therefore the base vertices are position on the terrain.

Parameters:
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.)

setCapAttributes

public void setCapAttributes(ShapeAttributes attributes)
Specifies the attributes applied to this polygon's cap.

Parameters:
attributes - this polygon's cap attributes.
Throws:
IllegalArgumentException - if attributes is null.

setCapHighlightAttributes

public void setCapHighlightAttributes(ShapeAttributes attributes)
Specifies the highlight attributes applied to this polygon's cap.

Parameters:
attributes - this polygon's cap highlight attributes.
Throws:
IllegalArgumentException - if attributes is null.

setCapImageSource

public void setCapImageSource(Object imageSource,
                              float[] texCoords,
                              int texCoordCount)
Specifies the image to apply to this extruded polygon's cap.

Parameters:
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.
Throws:
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.

setEnableCap

public void setEnableCap(boolean enableCap)
Specifies whether the cap of this extruded polygon is drawn.

Parameters:
enableCap - true to draw the cap, otherwise false.

setEnableSides

public void setEnableSides(boolean enableSides)
Specifies whether to draw the sides of this extruded polygon.

Parameters:
enableSides - true to draw the sides, otherwise false.

setHeight

public void setHeight(double height)
Specifies the height of this extruded polygon.

Parameters:
height - the height, in meters.
Throws:
IllegalArgumentException - if the height is less than or equal to zero.

setOuterBoundary

public void setOuterBoundary(Iterable<? extends LatLon> corners)
Specifies the latitude and longitude of the locations defining the outer boundary of this polygon. To specify altitudes, pass Positions rather than LatLons. The shape's height is not modified.

Parameters:
corners - the outer boundary locations.
Throws:
IllegalArgumentException - if the location list is null or contains fewer than three locations.

setOuterBoundary

public void setOuterBoundary(Iterable<? extends LatLon> corners,
                             Double height)
Specifies the latitude and longitude of the outer boundary locations defining this polygon, and optionally the extruded polygon's height. To specify altitudes for each boundary location, pass Positions rather than LatLons, but those altitudes are used only when the shape's altitude mode is WorldWind.ABSOLUTE.

Parameters:
corners - the outer boundary locations.
height - the shape height, in meters.
Throws:
IllegalArgumentException - if the location list is null or contains fewer than three locations.

setOuterBoundary

public void setOuterBoundary(Iterable<? extends LatLon> corners,
                             Iterable<?> imageSources)
Specifies the latitudes, longitudes and outer-boundary images for the outer boundary of this polygon. To specify altitudes, pass Positions rather than LatLons.

Parameters:
corners - the polygon locations.
imageSources - images to apply to the outer faces. One image must be specified for each face. May be null.
Throws:
IllegalArgumentException - if the location list is null.

setReferenceLocation

public void setReferenceLocation(LatLon referenceLocation)
Specifies the location to use as a reference location for computed geometry. This value should typically be left to the default, which is the first location in the extruded polygon's outer boundary.

Parameters:
referenceLocation - the reference location. May be null, in which case the first location of the outer boundary is the reference location.
See Also:
AbstractShape.setReferencePosition(gov.nasa.worldwind.geom.Position)

setSideAttributes

public void setSideAttributes(ShapeAttributes attributes)
Specifies the attributes applied to this polygon's side faces.

Parameters:
attributes - this polygon's side attributes.
Throws:
IllegalArgumentException - if attributes is null.

setSideHighlightAttributes

public void setSideHighlightAttributes(ShapeAttributes attributes)
Specifies the highlight attributes applied to this polygon's side faces.

Parameters:
attributes - this polygon's side highlight attributes.
Throws:
IllegalArgumentException - if attributes is null.

tessellatePolygon

protected void tessellatePolygon(ExtrudedPolygon.ShapeData shapeData,
                                 Vec4 normal)
Tessellates the polygon from its vertices.

Parameters:
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.

writeKMLBoundaries

protected void writeKMLBoundaries(XMLStreamWriter xmlWriter)
                           throws IOException,
                                  XMLStreamException
Throws:
IOException
XMLStreamException

NASA World Wind