Class ExtrudedPolygon
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.render.AbstractShape
-
- gov.nasa.worldwind.render.ExtrudedPolygon
-
- All Implemented Interfaces:
AVList,Draggable,MessageListener,Exportable,ExtentHolder,Movable,Movable2,Attributable,GeographicExtent,Highlightable,OrderedRenderable,PreRenderable,Renderable,Restorable,WWObject,java.beans.PropertyChangeListener,java.util.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
LatLonlocations orPositionpositions, 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.
ExtrudedPolygonside 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 callingsetReferenceLocation(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 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
SurfacePolygonto represent itself. Cap texture is not supported in this case.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classExtrudedPolygon.ExtrudedBoundaryInfoHolds globe-specific information for each contour of the polygon.protected static classExtrudedPolygon.ShapeDataTheShapeDataclass holds globe-specific data for this shape.-
Nested classes/interfaces inherited from class gov.nasa.worldwind.render.AbstractShape
AbstractShape.AbstractShapeData
-
-
Field Summary
Fields Modifier and Type Field Description protected ShapeAttributesactiveSideAttributesThe currently active side attributes, derived from the specified attributes.protected doublebaseDepthprotected java.util.List<java.util.List<? extends LatLon>>boundariesThe location of each vertex in this shape's boundaries.protected static java.util.HashMap<java.lang.Integer,java.nio.IntBuffer>capEdgeIndexBuffersprotected WWTexturecapTextureThis shape's cap texture.protected java.nio.FloatBuffercapTextureCoordsThis shape's cap texture coordinates.protected static intDEFAULT_ALTITUDE_MODEThe default altitude mode.protected static MaterialDEFAULT_SIDES_INTERIOR_MATERIALThe default interior color for sides.protected static ShapeAttributesdefaultSideAttributesThe attributes used if attributes are not specified.protected booleanenableCapIndicates whether the cap should be drawn.protected booleanenableSidesIndicates whether the sides should be drawn.protected doubleheightThis shape's height.protected java.lang.ObjectpreviousIntersectionGlobeStateKeyThe globe state key for the globe used in the most recent intersection calculation.protected ExtrudedPolygon.ShapeDatapreviousIntersectionShapeDataThe shape data used for the previous intersection calculation.protected TerrainpreviousIntersectionTerrainThe terrain used in the most recent intersection calculations.protected ShapeAttributessideAttributesThe attributes to use when drawing this shape's sides.protected static java.util.HashMap<java.lang.Integer,java.nio.IntBuffer>sideEdgeIndexBuffersprotected static java.util.HashMap<java.lang.Integer,java.nio.IntBuffer>sideFillIndexBuffersprotected ShapeAttributessideHighlightAttributesThe attributes to use when drawing this shape's sides in highlight mode.protected java.util.List<java.util.List<WWTexture>>sideTexturesThis shape's side textures.protected inttotalFaceCountThe total number of faces in all this shape's boundaries.protected inttotalNumLocationsThe total number of locations in all boundaries.protected static intVBO_THRESHOLDIndicates 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, dragEnabled, draggableSupport, enableBatchPicking, enableBatchRendering, enableDepthOffset, highlightAttrs, highlighted, maxExpiryTime, minExpiryTime, normalAttrs, outlinePickWidth, outlineShapeRenderer, pickLayer, pickSupport, referencePosition, sector, shapeDataCache, surfaceShape, viewDistanceExpiration, visible
-
Fields inherited from interface gov.nasa.worldwind.Exportable
FORMAT_NOT_SUPPORTED, FORMAT_PARTIALLY_SUPPORTED, FORMAT_SUPPORTED
-
-
Constructor Summary
Constructors Constructor Description ExtrudedPolygon()Constructs an extruded polygon with an empty outer boundary and a default height of 1 meter.ExtrudedPolygon(Position.PositionList corners)Constructs an extruded polygon from an outer boundary specified with position heights.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, 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 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 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddInnerBoundary(java.lang.Iterable<? extends LatLon> corners)Add an inner boundary to this polygon.voidaddInnerBoundary(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 OGLStackHandlerbeginDrawing(DrawContext dc, int attrMask)Establish the OpenGL state needed to draw this shape.protected voidcomputeBoundaryVertices(Terrain terrain, ExtrudedPolygon.ExtrudedBoundaryInfo boundary, Vec4 refPoint)Compute and set the Cartesian vertices for one specified boundary of this shape.protected java.nio.FloatBuffercomputeCapNormals(ExtrudedPolygon.ExtrudedBoundaryInfo boundary, java.nio.FloatBuffer nBuf)Compute normal vectors for an extruded polygon's cap vertices.protected ExtentcomputeExtent(ExtrudedPolygon.ExtrudedBoundaryInfo outerBoundary, Vec4 refPoint)Computes this shapes extent.protected doublecomputeEyeDistance(DrawContext dc, ExtrudedPolygon.ShapeData shapeData)Computes the minimum distance between this shape and the eye point.protected Vec4computePolygonNormal(ExtrudedPolygon.ShapeData shapeData)protected voidcomputeReferencePoint(Terrain terrain, ExtrudedPolygon.ShapeData shapeData)Computes and sets this shape's reference point, the Cartesian position corresponding to its geographic location.protected intcountLocations()Counts the total number of locations in this polygon's boundaries, not including positions introduced by extrusion.protected AbstractShape.AbstractShapeDatacreateCacheEntry(DrawContext dc)Creates and returns a new cache entry specific to the subclass.protected voidcreateCapGeometry(DrawContext dc, ExtrudedPolygon.ShapeData shapeData)Compute the cap geometry.protected voidcreateCapNormals(ExtrudedPolygon.ShapeData shapeData)protected voidcreateFullGeometry(DrawContext dc, Terrain terrain, ExtrudedPolygon.ShapeData shapeData, boolean skipOuterBoundary)Computes a boundary set's full geometry.protected ExtrudedPolygon.ShapeDatacreateIntersectionGeometry(Terrain terrain)protected voidcreateMinimalGeometry(DrawContext dc, ExtrudedPolygon.ShapeData shapeData)Computes the information necessary to determine this extruded polygon's extent.protected voidcreateSideGeometry(ExtrudedPolygon.ShapeData shapeData)Constructs the Cartesian geometry of this shape's sides and sets it in the specified shape data.protected voidcreateSideNormals(ExtrudedPolygon.ShapeData shapeData)protected voidcreateSideTextureCoords(ExtrudedPolygon.ShapeData shapeData)Creates the texture coordinates for this shape's sides.protected SurfaceShapecreateSurfaceShape()Returns aSurfaceShapethat corresponds to this Path and is used for drawing on 2D globes.protected voidcreateTessllationGeometry(DrawContext dc, ExtrudedPolygon.ShapeData shapeData)Tessellates this extruded polygon's cap.protected voidcreateVertices(Terrain terrain, ExtrudedPolygon.ShapeData shapeData, boolean skipOuterBoundary)Creates this shape's Cartesian vertices.protected voiddetermineActiveAttributes()Determines which attributes -- normal, highlight or default -- to use each frame.protected voiddoDrawInterior(DrawContext dc)Not used by this class.protected voiddoDrawOutline(DrawContext dc)Not used by this class, which overridesdrawOutline(DrawContext).protected voiddoExportAsKML(javax.xml.stream.XMLStreamWriter xmlWriter)Exports shape-specific fields.protected booleandoMakeOrderedRenderable(DrawContext dc)Produces the geometry and other state necessary to represent this shape as an ordered renderable.voiddrawCapInterior(DrawContext dc, ExtrudedPolygon.ShapeData shapeData)Draws the filled interior of this shape's cap.voiddrawCapOutline(DrawContext dc, ExtrudedPolygon.ShapeData shapeData)Draws the cap's outline.voiddrawInterior(DrawContext dc)Draws this shape's interior.voiddrawOutline(DrawContext dc)Draws this shape's outline.protected voiddrawSideInteriors(DrawContext dc, ExtrudedPolygon.ShapeData shapeData)Draws this shape's sides.protected voiddrawSideOutline(DrawContext dc, ExtrudedPolygon.ShapeData shapeData)Draws this extruded polygon's side outline.protected voidexportBoundaryAsLinearRing(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.FloatBufferfillSideNormalBuffer(Vec4[] topVerts, Vec4[] bottomVerts, java.nio.FloatBuffer nBuf)protected voidfillSideTexCoordBuffer(Vec4[] topVerts, Vec4[] bottomVerts, java.nio.FloatBuffer tBuf)Computes the texture coordinates for a boundary of this shape.protected java.nio.FloatBufferfillSideVertexBuffer(Vec4[] topVerts, Vec4[] bottomVerts, java.nio.FloatBuffer vBuf)protected voidfillVBO(DrawContext dc)Fill this shape's vertex buffer objects.protected voidgenerateCapInteriorIndices(ExtrudedPolygon.ShapeData shapeData)Construct the lists of indices that identify the tessellated shape's vertices in the vertex buffer.protected ShapeAttributesgetActiveCapAttributes()Each time this polygon is rendered the appropriate attributes for the current mode are determined.protected ShapeAttributesgetActiveSideAttributes()Each time this polygon is rendered the appropriate attributes for the current mode are determined.doublegetBaseDepth()Returns this object's base depth.protected java.util.List<java.util.List<? extends LatLon>>getBoundaries()Returns this shape's boundaries.ShapeAttributesgetCapAttributes()Returns the attributes applied to this polygon's cap.protected java.nio.IntBuffergetCapEdgeIndices(int n)Returns the indices defining the cap vertices.ShapeAttributesgetCapHighlightAttributes()Returns the highlight attributes applied to this polygon's cap.java.lang.ObjectgetCapImageSource()Returns this extruded polygon's cap image.protected WWTexturegetCapTexture()Get the texture applied to this extruded polygon's cap.protected ExtrudedPolygon.ShapeDatagetCurrent()Indicates the currently active shape data.ExtentgetExtent(Globe globe, double verticalExaggeration)Returns the objects enclosing volume as anExtentin model coordinates, given a specifiedGlobeand vertical exaggeration (seeSceneController.getVerticalExaggeration().doublegetHeight()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.LatLongetReferenceLocation()Indicates the location to use as a reference location for computed geometry.PositiongetReferencePosition()Indicates the position used as a reference position for this extruded polygon's computed geometry.SectorgetSector()Returns the object's geographic extent.ShapeAttributesgetSideAttributes()Returns the attributes applied to this polygon's side faces.protected java.nio.IntBuffergetSideEdgeIndices(int n)Returns the indices defining the vertices of a boundary's face edges.ShapeAttributesgetSideHighlightAttributes()Returns the highlight attributes applied to this polygon's side faces.protected java.nio.IntBuffergetSideIndices(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.booleanhasSideTextures()Indicates whether side images have been specified for this extruded polygon.protected voidinitialize()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 voidintersectCap(Line line, ExtrudedPolygon.ShapeData shapeData, java.util.List<Intersection> intersections)booleanisEnableCap()Indicates whether the cap of this extruded polygon is drawn.booleanisEnableSides()Indicates whether the sides of this extruded polygon are drawn.protected booleanisOrderedRenderableValid(DrawContext dc)Determines whether this shape's ordered renderable state is valid and can be rendered.protected booleanisOuterBoundaryValid()Indicates whether this shape's outer boundary exists and has more than two points.protected booleanisSameAsPreviousTerrain(Terrain terrain)protected booleanisTerrainDependent()Indicates whether this shape's geometry depends on the terrain.voidmoveTo(Position position)Move the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.protected booleanmustApplySideTextures()protected booleanmustApplyTexture(DrawContext dc)Indicates whether texture should be applied to this shape.protected booleanmustDrawInterior()Indicates whether the interior of either the sides or cap must be drawn.protected booleanmustDrawOutline()Indicates whether the polygon's outline should be drawn.protected booleanmustRegenerateGeometry(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.voidrender(DrawContext dc)Causes thisRenderableto render itself using the provided draw context.protected voidreset()Invalidates computed values.voidsetBaseDepth(double baseDepth)Specifies a depth below the terrain at which to place this extruded polygon's base vertices.voidsetCapAttributes(ShapeAttributes attributes)Specifies the attributes applied to this polygon's cap.voidsetCapHighlightAttributes(ShapeAttributes attributes)Specifies the highlight attributes applied to this polygon's cap.voidsetCapImageSource(java.lang.Object imageSource, float[] texCoords, int texCoordCount)Specifies the image to apply to this extruded polygon's cap.voidsetEnableCap(boolean enableCap)Specifies whether the cap of this extruded polygon is drawn.voidsetEnableSides(boolean enableSides)Specifies whether to draw the sides of this extruded polygon.voidsetHeight(double height)Specifies the height of this extruded polygon.voidsetOuterBoundary(java.lang.Iterable<? extends LatLon> corners)Specifies the latitude and longitude of the locations defining the outer boundary of this polygon.voidsetOuterBoundary(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.voidsetOuterBoundary(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.voidsetReferenceLocation(LatLon referenceLocation)Specifies the location to use as a reference location for computed geometry.voidsetSideAttributes(ShapeAttributes attributes)Specifies the attributes applied to this polygon's side faces.voidsetSideHighlightAttributes(ShapeAttributes attributes)Specifies the highlight attributes applied to this polygon's side faces.protected voidsetSurfacePolygonBoundaries(SurfaceShape shape)protected voidtessellatePolygon(ExtrudedPolygon.ShapeData shapeData, Vec4 normal)Tessellates the polygon from its vertices.protected voidwriteKMLBoundaries(javax.xml.stream.XMLStreamWriter xmlWriter)-
Methods inherited from class gov.nasa.worldwind.render.AbstractShape
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
-
Methods inherited from class gov.nasa.worldwind.WWObjectImpl
onMessage, propertyChange
-
Methods inherited from class gov.nasa.worldwind.avlist.AVListImpl
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface gov.nasa.worldwind.avlist.AVList
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
-
-
-
-
Field Detail
-
DEFAULT_SIDES_INTERIOR_MATERIAL
protected static final Material DEFAULT_SIDES_INTERIOR_MATERIAL
The default interior color for sides.
-
DEFAULT_ALTITUDE_MODE
protected static final int DEFAULT_ALTITUDE_MODE
The default altitude mode.- See Also:
- Constant Field Values
-
defaultSideAttributes
protected static final ShapeAttributes defaultSideAttributes
The attributes used if attributes are not specified.
-
baseDepth
protected double baseDepth
-
capEdgeIndexBuffers
protected static java.util.HashMap<java.lang.Integer,java.nio.IntBuffer> capEdgeIndexBuffers
-
sideFillIndexBuffers
protected static java.util.HashMap<java.lang.Integer,java.nio.IntBuffer> sideFillIndexBuffers
-
sideEdgeIndexBuffers
protected static java.util.HashMap<java.lang.Integer,java.nio.IntBuffer> sideEdgeIndexBuffers
-
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.
-
boundaries
protected java.util.List<java.util.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.
-
totalNumLocations
protected int totalNumLocations
The total number of locations in all boundaries.
-
totalFaceCount
protected int totalFaceCount
The total number of faces in all this shape's boundaries.
-
height
protected double height
This shape's height. Default is 1.
-
sideAttributes
protected ShapeAttributes sideAttributes
The attributes to use when drawing this shape's sides.
-
sideHighlightAttributes
protected ShapeAttributes sideHighlightAttributes
The attributes to use when drawing this shape's sides in highlight mode.
-
activeSideAttributes
protected ShapeAttributes activeSideAttributes
The currently active side attributes, derived from the specified attributes. Current only during rendering.
-
sideTextures
protected java.util.List<java.util.List<WWTexture>> sideTextures
This shape's side textures.
-
capTexture
protected WWTexture capTexture
This shape's cap texture.
-
capTextureCoords
protected java.nio.FloatBuffer capTextureCoords
This shape's cap texture coordinates.
-
enableCap
protected boolean enableCap
Indicates whether the cap should be drawn.
-
enableSides
protected boolean enableSides
Indicates whether the sides should be drawn.
-
previousIntersectionTerrain
protected Terrain previousIntersectionTerrain
The terrain used in the most recent intersection calculations.
-
previousIntersectionGlobeStateKey
protected java.lang.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.
-
-
Constructor Detail
-
ExtrudedPolygon
public ExtrudedPolygon()
Constructs an extruded polygon with an empty outer boundary and a default height of 1 meter.
-
ExtrudedPolygon
public ExtrudedPolygon(java.lang.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 isWorldWind.CONSTANT, which is the default for this shape.
-
ExtrudedPolygon
public 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.- 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 isWorldWind.CONSTANT, which is the default for this shape.- Throws:
java.lang.IllegalArgumentException- if the location list is null or the height is specified but less than or equal to zero.
-
ExtrudedPolygon
public 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.- 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 isWorldWind.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:
java.lang.IllegalArgumentException- if the location list is null or the height is specified but less than or equal to zero.
-
ExtrudedPolygon
public ExtrudedPolygon(java.lang.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:
java.lang.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:
java.lang.IllegalArgumentException- if the position list is null.
-
ExtrudedPolygon
public 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.- 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:
java.lang.IllegalArgumentException- if the position list is null.
-
-
Method Detail
-
createCacheEntry
protected AbstractShape.AbstractShapeData createCacheEntry(DrawContext dc)
Description copied from class:AbstractShapeCreates and returns a new cache entry specific to the subclass.- Specified by:
createCacheEntryin classAbstractShape- Parameters:
dc- the current draw context.- Returns:
- a data cache entry for the state in the specified draw context.
-
getCurrent
protected ExtrudedPolygon.ShapeData getCurrent()
Indicates the currently active shape data.- Returns:
- the currently active shape data.
-
initialize
protected void initialize()
Description copied from class:AbstractShapeCalled during construction to establish any subclass-specific state such as different default values than those set by this class.- Specified by:
initializein classAbstractShape
-
reset
protected void reset()
Description copied from class:AbstractShapeInvalidates computed values. Called when this shape's contents or certain attributes change.- Overrides:
resetin classAbstractShape
-
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.
-
getOuterBoundary
public java.lang.Iterable<? extends LatLon> getOuterBoundary()
Returns the list of locations or positions defining this polygon's outer boundary.- Returns:
- this polygon's positions.
-
outerBoundary
protected java.util.List<? extends LatLon> outerBoundary()
Returns a reference to the outer boundary of this polygon.- Returns:
- this polygon's outer boundary.
-
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
-
setOuterBoundary
public void setOuterBoundary(java.lang.Iterable<? extends LatLon> corners)
Specifies the latitude and longitude of the locations defining the outer boundary of this polygon. To specify altitudes, passPositions rather thanLatLons. The shape's height is not modified.- Parameters:
corners- the outer boundary locations.- Throws:
java.lang.IllegalArgumentException- if the location list is null or contains fewer than three locations.
-
setOuterBoundary
public 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. To specify altitudes, passPositions rather thanLatLons.- 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:
java.lang.IllegalArgumentException- if the location list is null.
-
setOuterBoundary
public 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. To specify altitudes for each boundary location, passPositions rather thanLatLons, but those altitudes are used only when the shape's altitude mode isWorldWind.ABSOLUTE.- Parameters:
corners- the outer boundary locations.height- the shape height, in meters.- Throws:
java.lang.IllegalArgumentException- if the location list is null or contains fewer than three locations.
-
fillBoundary
protected java.util.List<? extends LatLon> fillBoundary(java.lang.Iterable<? extends LatLon> corners)
-
addInnerBoundary
public void addInnerBoundary(java.lang.Iterable<? extends LatLon> corners)
Add an inner boundary to this polygon.- Parameters:
corners- the boundary's locations.- Throws:
java.lang.IllegalArgumentException- if the location list is null or contains fewer than three locations.
-
addInnerBoundary
public 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. SpecifyLatLons to use the polygon's single height, orPositions, 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:
java.lang.IllegalArgumentException- if the location list is null.
-
getBoundaries
protected java.util.List<java.util.List<? extends LatLon>> getBoundaries()
Returns this shape's boundaries.- Returns:
- this shape's boundaries.
-
fillImageList
protected java.util.List<WWTexture> fillImageList(java.lang.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
imageSourcesargument is null.
-
getCapImageSource
public java.lang.Object getCapImageSource()
Returns this extruded polygon's cap image.- Returns:
- the texture image source, or null if no source has been specified.
-
setCapImageSource
public void setCapImageSource(java.lang.Object imageSource, float[] texCoords, int texCoordCount)Specifies the image to apply to this extruded polygon's cap.- Parameters:
imageSource- the image source. May be aStringidentifying a file path or URL, aFile, or aURL.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:
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.
-
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.
-
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.
-
getHeight
public double getHeight()
Returns the height of this extruded polygon.- Returns:
- the height originally specified, in meters.
-
setHeight
public void setHeight(double height)
Specifies the height of this extruded polygon.- Parameters:
height- the height, in meters.- Throws:
java.lang.IllegalArgumentException- if the height is less than or equal to zero.
-
isEnableCap
public boolean isEnableCap()
Indicates whether the cap of this extruded polygon is drawn.- Returns:
- true to draw the cap, otherwise false.
-
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.
-
isEnableSides
public boolean isEnableSides()
Indicates whether the sides of this extruded polygon are drawn.- Returns:
- true to draw the sides, 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.
-
getSideAttributes
public ShapeAttributes getSideAttributes()
Returns the attributes applied to this polygon's side faces.- Returns:
- this polygon's side attributes.
-
setSideAttributes
public void setSideAttributes(ShapeAttributes attributes)
Specifies the attributes applied to this polygon's side faces.- Parameters:
attributes- this polygon's side attributes.- Throws:
java.lang.IllegalArgumentException- ifattributesis null.
-
getCapAttributes
public ShapeAttributes getCapAttributes()
Returns the attributes applied to this polygon's cap.- Returns:
- this polygon's cap attributes.
-
setCapAttributes
public void setCapAttributes(ShapeAttributes attributes)
Specifies the attributes applied to this polygon's cap.- Parameters:
attributes- this polygon's cap attributes.- Throws:
java.lang.IllegalArgumentException- ifattributesis null.
-
getSideHighlightAttributes
public ShapeAttributes getSideHighlightAttributes()
Returns the highlight attributes applied to this polygon's side faces.- Returns:
- this polygon's side highlight attributes.
-
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:
java.lang.IllegalArgumentException- ifattributesis null.
-
getCapHighlightAttributes
public ShapeAttributes getCapHighlightAttributes()
Returns the highlight attributes applied to this polygon's cap.- Returns:
- this polygon's cap highlight attributes.
-
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:
java.lang.IllegalArgumentException- ifattributesis null.
-
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.
-
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.
-
getSector
public Sector getSector()
Description copied from interface:GeographicExtentReturns the object's geographic extent.- Returns:
- the object's geographic extent.
-
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()
-
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)
-
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.
-
getBaseDepth
public double getBaseDepth()
Returns this object's base depth.- Returns:
- This object's base depth, in meters.
- See Also:
setBaseDepth(double)
-
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.)
-
getImageSources
public java.util.List<java.util.List<java.lang.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.
-
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.
-
mustApplyTexture
protected boolean mustApplyTexture(DrawContext dc)
Description copied from class:AbstractShapeIndicates 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:
mustApplyTexturein classAbstractShape- Parameters:
dc- the current draw context- Returns:
- true if texture should be applied, otherwise false.
-
isTerrainDependent
protected boolean isTerrainDependent()
Description copied from class:AbstractShapeIndicates whether this shape's geometry depends on the terrain.- Overrides:
isTerrainDependentin classAbstractShape- Returns:
- true if this shape's geometry depends on the terrain, otherwise false.
-
mustApplySideTextures
protected boolean mustApplySideTextures()
-
mustDrawInterior
protected boolean mustDrawInterior()
Indicates whether the interior of either the sides or cap must be drawn.- Overrides:
mustDrawInteriorin classAbstractShape- Returns:
- true if an interior must be drawn, otherwise false.
-
mustDrawOutline
protected boolean mustDrawOutline()
Indicates whether the polygon's outline should be drawn.- Overrides:
mustDrawOutlinein classAbstractShape- Returns:
- true if the outline should be drawn, otherwise false.
-
mustRegenerateGeometry
protected boolean mustRegenerateGeometry(DrawContext dc)
Description copied from class:AbstractShapeIndicates 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.AbstractShapeDatamust be current when this method is called.- Overrides:
mustRegenerateGeometryin classAbstractShape- Parameters:
dc- the current draw context.- Returns:
- true if this shape's geometry must be regenerated, otherwise false.
-
getExtent
public Extent getExtent(Globe globe, double verticalExaggeration)
Description copied from interface:ExtentHolderReturns the objects enclosing volume as anExtentin model coordinates, given a specifiedGlobeand vertical exaggeration (seeSceneController.getVerticalExaggeration().- Specified by:
getExtentin interfaceExtentHolder- Overrides:
getExtentin classAbstractShape- 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.
-
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.
-
determineActiveAttributes
protected void determineActiveAttributes()
Description copied from class:AbstractShapeDetermines which attributes -- normal, highlight or default -- to use each frame. Places the result in this shape's current active attributes.- Overrides:
determineActiveAttributesin classAbstractShape- See Also:
AbstractShape.getActiveAttributes()
-
createSurfaceShape
protected SurfaceShape createSurfaceShape()
Description copied from class:AbstractShapeReturns aSurfaceShapethat corresponds to this Path and is used for drawing on 2D globes.- Overrides:
createSurfaceShapein classAbstractShape- Returns:
- The surface shape to represent this Path on a 2D globe.
-
setSurfacePolygonBoundaries
protected void setSurfacePolygonBoundaries(SurfaceShape shape)
-
render
public void render(DrawContext dc)
Description copied from interface:RenderableCauses thisRenderableto render itself using the provided draw context.- Specified by:
renderin interfaceRenderable- Overrides:
renderin classAbstractShape- Parameters:
dc- theDrawContextto be used- See Also:
DrawContext
-
isOrderedRenderableValid
protected boolean isOrderedRenderableValid(DrawContext dc)
Description copied from class:AbstractShapeDetermines whether this shape's ordered renderable state is valid and can be rendered. Called byAbstractShape.makeOrderedRenderable(DrawContext)just prior to adding the shape to the ordered renderable list.- Specified by:
isOrderedRenderableValidin classAbstractShape- Parameters:
dc- the current draw context.- Returns:
- true if this shape is ready to be rendered as an ordered renderable.
-
doMakeOrderedRenderable
protected boolean doMakeOrderedRenderable(DrawContext dc)
Description copied from class:AbstractShapeProduces 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 duringAbstractShape.pick(DrawContext, java.awt.Point)andAbstractShape.render(DrawContext)when it's been determined that the shape is likely to be visible.- Specified by:
doMakeOrderedRenderablein classAbstractShape- 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)
-
beginDrawing
protected OGLStackHandler beginDrawing(DrawContext dc, int attrMask)
Description copied from class:AbstractShapeEstablish the OpenGL state needed to draw this shape.A
AbstractShape.AbstractShapeDatamust be current when this method is called.- Overrides:
beginDrawingin classAbstractShape- Parameters:
dc- the current draw context.attrMask- an attribute mask indicating state the caller will set. This base class implementation setsGL_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.
-
drawOutline
public void drawOutline(DrawContext dc)
Description copied from class:AbstractShapeDraws this shape's outline.A
AbstractShape.AbstractShapeDatamust be current when this method is called.- Overrides:
drawOutlinein classAbstractShape- Parameters:
dc- the current draw context.
-
drawInterior
public void drawInterior(DrawContext dc)
Description copied from class:AbstractShapeDraws this shape's interior.A
AbstractShape.AbstractShapeDatamust be current when this method is called.- Overrides:
drawInteriorin classAbstractShape- Parameters:
dc- the current draw context.
-
doDrawOutline
protected void doDrawOutline(DrawContext dc)
Not used by this class, which overridesdrawOutline(DrawContext).- Specified by:
doDrawOutlinein classAbstractShape- Parameters:
dc- not used.
-
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.
-
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.
-
doDrawInterior
protected void doDrawInterior(DrawContext dc)
Not used by this class.- Specified by:
doDrawInteriorin classAbstractShape- Parameters:
dc- not used.
-
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.
-
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.
-
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.
-
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.
-
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.
-
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.
-
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.
-
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.
-
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.
-
createCapGeometry
protected void createCapGeometry(DrawContext dc, ExtrudedPolygon.ShapeData shapeData)
Compute the cap geometry.- Parameters:
dc- the current draw context.shapeData- boundary vertices are calculated duringcreateMinimalGeometry(DrawContext, gov.nasa.worldwind.render.ExtrudedPolygon.ShapeData)).
-
createCapNormals
protected void createCapNormals(ExtrudedPolygon.ShapeData shapeData)
-
computeCapNormals
protected java.nio.FloatBuffer computeCapNormals(ExtrudedPolygon.ExtrudedBoundaryInfo boundary, java.nio.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.
-
fillSideVertexBuffer
protected java.nio.FloatBuffer fillSideVertexBuffer(Vec4[] topVerts, Vec4[] bottomVerts, java.nio.FloatBuffer vBuf)
-
fillSideNormalBuffer
protected java.nio.FloatBuffer fillSideNormalBuffer(Vec4[] topVerts, Vec4[] bottomVerts, java.nio.FloatBuffer nBuf)
-
fillSideTexCoordBuffer
protected void fillSideTexCoordBuffer(Vec4[] topVerts, Vec4[] bottomVerts, java.nio.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.
-
getCapEdgeIndices
protected java.nio.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.
-
getSideIndices
protected java.nio.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.
-
getSideEdgeIndices
protected java.nio.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.
-
fillVBO
protected void fillVBO(DrawContext dc)
Description copied from class:AbstractShapeFill this shape's vertex buffer objects. If the vertex buffer object resource IDs don't yet exist, create them.A
AbstractShape.AbstractShapeDatamust be current when this method is called.- Specified by:
fillVBOin classAbstractShape- Parameters:
dc- the current draw context.
-
createTessllationGeometry
protected void createTessllationGeometry(DrawContext dc, ExtrudedPolygon.ShapeData shapeData)
Tessellates this extruded polygon's cap. This method catchesOutOfMemoryErrorexceptions and if the draw context is not null passes the exception to the rendering exception listener (seeWorldWindow.addRenderingExceptionListener(gov.nasa.worldwind.event.RenderingExceptionListener)).- Parameters:
dc- the draw context.shapeData- the boundary set to tessellate
-
computePolygonNormal
protected Vec4 computePolygonNormal(ExtrudedPolygon.ShapeData shapeData)
-
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.
-
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.
-
isSameAsPreviousTerrain
protected boolean isSameAsPreviousTerrain(Terrain terrain)
-
intersect
public java.util.List<Intersection> intersect(Line line, Terrain terrain) throws java.lang.InterruptedException
Compute the intersections of a specified line with this extruded polygon. If the polygon's altitude mode is other thanWorldWind.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:
intersectin classAbstractShape- Parameters:
line- the line to intersect.terrain- theTerrainto 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:
java.lang.InterruptedException- if the operation is interrupted.- See Also:
Terrain
-
createIntersectionGeometry
protected ExtrudedPolygon.ShapeData createIntersectionGeometry(Terrain terrain)
-
intersectBoundarySides
protected java.util.List<Intersection> intersectBoundarySides(Line line, ExtrudedPolygon.ExtrudedBoundaryInfo boundary) throws java.lang.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:
java.lang.InterruptedException- if the operation is interrupted.
-
intersectCap
protected void intersectCap(Line line, ExtrudedPolygon.ShapeData shapeData, java.util.List<Intersection> intersections) throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
-
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.
-
doExportAsKML
protected void doExportAsKML(javax.xml.stream.XMLStreamWriter xmlWriter) throws java.io.IOException, javax.xml.stream.XMLStreamExceptionDescription copied from class:AbstractShapeExports shape-specific fields.- Specified by:
doExportAsKMLin classAbstractShape- Parameters:
xmlWriter- the export writer to write to.- Throws:
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.
-
writeKMLBoundaries
protected void writeKMLBoundaries(javax.xml.stream.XMLStreamWriter xmlWriter) throws java.io.IOException, javax.xml.stream.XMLStreamException- Throws:
java.io.IOExceptionjavax.xml.stream.XMLStreamException
-
exportBoundaryAsLinearRing
protected void exportBoundaryAsLinearRing(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.Iterable<? extends LatLon> boundary) throws javax.xml.stream.XMLStreamExceptionWrites 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:
javax.xml.stream.XMLStreamException- if an error occurs during writing.
-
-