Package gov.nasa.worldwind.render
Class Pyramid
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.render.AbstractShape
-
- gov.nasa.worldwind.render.RigidShape
-
- gov.nasa.worldwind.render.Pyramid
-
- All Implemented Interfaces:
AVList,Draggable,MessageListener,Exportable,ExtentHolder,Movable,Movable2,Attributable,GeographicExtent,Highlightable,OrderedRenderable,PreRenderable,Renderable,Restorable,WWObject,java.beans.PropertyChangeListener,java.util.EventListener
public class Pyramid extends RigidShape
A general pyramid volume defined by a center position, a height, and two axis lengths.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class gov.nasa.worldwind.render.RigidShape
RigidShape.Offsets, RigidShape.ShapeData
-
Nested classes/interfaces inherited from class gov.nasa.worldwind.render.AbstractShape
AbstractShape.AbstractShapeData
-
-
Field Summary
Fields Modifier and Type Field Description protected static intDEFAULT_SUBDIVISIONSprotected intfaceCountprotected intsubdivisions-
Fields inherited from class gov.nasa.worldwind.render.RigidShape
centerPosition, DEFAULT_GEOMETRY_CACHE_SIZE, detailHint, eastWestRadius, GEOMETRY_CACHE_KEY, GEOMETRY_CACHE_NAME, geometryBuilder, heading, imageSources, northSouthRadius, offsets, offsetTextureCoords, previousIntersectionGlobeStateKey, previousIntersectionShapeData, previousIntersectionTerrain, renderExtent, roll, skewEastWest, skewNorthSouth, textures, tilt, verticalRadius
-
Fields inherited from class gov.nasa.worldwind.render.AbstractShape
activeAttributes, altitudeMode, BEogsh, currentData, DEFAULT_ALTITUDE_MODE, 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, VBO_THRESHOLD, viewDistanceExpiration, visible
-
Fields inherited from interface gov.nasa.worldwind.Exportable
FORMAT_NOT_SUPPORTED, FORMAT_PARTIALLY_SUPPORTED, FORMAT_SUPPORTED
-
-
Constructor Summary
Constructors Constructor Description Pyramid()Construct a Pyramid with default parametersPyramid(Position centerPosition, double height, double width)Construct a Pyramid from a specified center position, height and width.Pyramid(Position centerPosition, double northSouthRadius, double verticalRadius, double eastWestRadius)Construct a Pyramid from a specified center position and axes lengths.Pyramid(Position centerPosition, double northSouthRadius, double verticalRadius, double eastWestRadius, Angle heading, Angle tilt, Angle roll)Construct a Pyramid from a specified center position, axes lengths and rotation angles.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcomputeSubdivisions(DrawContext dc, RigidShape.ShapeData shapeData)Computes the number of subdivisions necessary to achieve the expected Level of Detail given the shape's relationship to the viewer.protected RigidShape.ShapeDatacreateIntersectionGeometry(Terrain terrain)protected voiddoExportAsKML(javax.xml.stream.XMLStreamWriter xmlWriter)Exports shape-specific fields.protected voiddrawGeometry(DrawContext dc, int mode, int count, int type, java.nio.Buffer elementBuffer, RigidShape.ShapeData shapeData, int face)Renders the Pyramid, using data from the provided buffer and the given parametersintgetFaceCount()Returns the number of separate faces that comprise this shape.doublegetHeight()Returns the height of the Pyramid, which is just twice its vertical radius.intgetSubdivisions()protected voidinitialize()Called during construction to establish any subclass-specific state such as different default values than those set by this class.java.lang.StringisExportFormatSupported(java.lang.String mimeType)No export formats supported.protected voidmakeGeometry(RigidShape.ShapeData shapeData)Sets the Geometry mesh for this Pyramid, either by pulling it from the geometryCache, or by creating it anew if the appropriate geometry does not yet exist in the cache.protected voidmakeUnitPyramid(int subdivisions, java.util.List<Geometry> meshes)Generates a unit pyramid geometry, including the vertices, indices, normals and texture coordinates, tessellated with the specified number of divisions.voidsetHeight(double height)Specifies this Pyramid's height in meters.voidsetWidth(double width)Specifies the width of the Pyramid's base in meters.-
Methods inherited from class gov.nasa.worldwind.render.RigidShape
beginDrawing, clearCachedVbos, clearIntersectionGeometry, computeExtent, computeReferencePoint, computeReferencePoint, computeRenderMatrix, computeRenderMatrix, computeRenderMatrixInverse, computeTransformedVertices, createCacheEntry, doDrawInterior, doDrawOutline, doGetRestorableState, doMakeOrderedRenderable, doRestoreState, drawGeometry, fillVBO, getCenterPosition, getCurrentShapeData, getDetailHint, getEastWestRadius, getExtent, getGeometryBuilder, getGeometryCache, getHeading, getImageSource, getNorthSouthRadius, getOffsets, getReferencePosition, getRestorableState, getRoll, getSector, getSkewEastWest, getSkewNorthSouth, getTexture, getTilt, getVboIds, getVerticalRadius, intersect, intersect, intersect, intersectFace, isOrderedRenderableValid, isSameAsPreviousTerrain, moveTo, mustApplyTexture, mustApplyTexture, mustRegenerateGeometry, reset, restoreState, setCenterPosition, setDetailHint, setEastWestRadius, setFaceCount, setHeading, setImageSource, setImageSources, setImageSources, setModelViewMatrix, setNorthSouthRadius, setOffset, setRoll, setSkewEastWest, setSkewNorthSouth, setTexture, setTilt, setUpGeometryCache, setVerticalRadius
-
Methods inherited from class gov.nasa.worldwind.render.AbstractShape
addOrderedRenderable, checkViewDistanceExpiration, computeExtentFromPositions, computePoint, computePoint, countTriangleVertices, createPickedObject, createSurfaceShape, determineActiveAttributes, doDrag, doDrawOrderedRenderable, drag, drawBatched, drawInterior, drawOrderedRenderable, drawOutline, endDrawing, export, exportAsKML, getActiveAttributes, getAltitudeMode, getAttributes, getCurrentData, getDelegateOwner, getDistanceFromEye, getExtent, getGeometryRegenerationInterval, getHighlightAttributes, getOutlinePickWidth, getReferencePoint, getVboIds, intersectsFrustum, isDragEnabled, isEnableBatchPicking, isEnableBatchRendering, isEnableDepthOffset, isHighlighted, isTerrainDependent, isViewDistanceExpiration, isVisible, makeOrderedRenderable, makeTexture, move, moveTo, mustApplyLighting, mustApplyLighting, mustCreateNormals, mustCreateNormals, mustDrawInterior, mustDrawOutline, pick, prepareToDrawInterior, prepareToDrawOutline, preRender, render, 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_SUBDIVISIONS
protected static final int DEFAULT_SUBDIVISIONS
- See Also:
- Constant Field Values
-
faceCount
protected int faceCount
-
subdivisions
protected int subdivisions
-
-
Constructor Detail
-
Pyramid
public Pyramid()
Construct a Pyramid with default parameters
-
Pyramid
public Pyramid(Position centerPosition, double height, double width)
Construct a Pyramid from a specified center position, height and width.- Parameters:
centerPosition- the Pyramid's center position.height- the Pyramid's height, in meters.width- the width of the Pyramid's base, in meters.- Throws:
java.lang.IllegalArgumentException- if the center position is null or any of the radii are not greater than 0.
-
Pyramid
public Pyramid(Position centerPosition, double northSouthRadius, double verticalRadius, double eastWestRadius)
Construct a Pyramid from a specified center position and axes lengths.- Parameters:
centerPosition- the Pyramid's center position.northSouthRadius- the Pyramid's north-south radius, in meters.verticalRadius- the Pyramid's vertical radius, in meters.eastWestRadius- the Pyramid's east-west radius, in meters.- Throws:
java.lang.IllegalArgumentException- if the center position is null or any of the radii are not greater than 0.
-
Pyramid
public Pyramid(Position centerPosition, double northSouthRadius, double verticalRadius, double eastWestRadius, Angle heading, Angle tilt, Angle roll)
Construct a Pyramid from a specified center position, axes lengths and rotation angles. All angles are specified in degrees and positive angles are counter-clockwise.- Parameters:
centerPosition- the Pyramid's center position.northSouthRadius- the Pyramid's north-south radius, in meters.verticalRadius- the Pyramid's vertical radius, in meters.eastWestRadius- the Pyramid's east-west radius, in meters.heading- the Pyramid's azimuth, its rotation about its vertical axis.tilt- the Pyramid pitch, its rotation about its east-west axis.roll- the Pyramid's roll, its rotation about its north-south axis.
-
-
Method Detail
-
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.- Overrides:
initializein classRigidShape
-
getHeight
public double getHeight()
Returns the height of the Pyramid, which is just twice its vertical radius.- Returns:
- this Pyramid's height.
-
setHeight
public void setHeight(double height)
Specifies this Pyramid's height in meters. The height of the Pyramid is just twice its vertical radius, so we just divide the height by two to get the value for the verticalRadius. The height must be greater than 0.- Parameters:
height- the height of the Pyramid. Must be greater than 0.- Throws:
java.lang.IllegalArgumentException- if the height is not greater than 0.
-
setWidth
public void setWidth(double width)
Specifies the width of the Pyramid's base in meters. The width of the Pyramid is just twice its base's north-south and east-west radii, so we just divide the width by two to get these values. The width must be greater than 0.- Parameters:
width- the width of the Pyramid. Must be greater than 0.- Throws:
java.lang.IllegalArgumentException- if the width is not greater than 0.
-
getFaceCount
public int getFaceCount()
Description copied from class:RigidShapeReturns the number of separate faces that comprise this shape.- Overrides:
getFaceCountin classRigidShape- Returns:
- number of faces
-
getSubdivisions
public int getSubdivisions()
- Specified by:
getSubdivisionsin classRigidShape
-
computeSubdivisions
protected void computeSubdivisions(DrawContext dc, RigidShape.ShapeData shapeData)
Computes the number of subdivisions necessary to achieve the expected Level of Detail given the shape's relationship to the viewer.- Specified by:
computeSubdivisionsin classRigidShape- Parameters:
dc- the current drawContext.shapeData- the current globe-specific shape data
-
makeGeometry
protected void makeGeometry(RigidShape.ShapeData shapeData)
Sets the Geometry mesh for this Pyramid, either by pulling it from the geometryCache, or by creating it anew if the appropriate geometry does not yet exist in the cache.- Specified by:
makeGeometryin classRigidShape- Parameters:
shapeData- the current shape data.
-
makeUnitPyramid
protected void makeUnitPyramid(int subdivisions, java.util.List<Geometry> meshes)Generates a unit pyramid geometry, including the vertices, indices, normals and texture coordinates, tessellated with the specified number of divisions.- Parameters:
subdivisions- the number of times to subdivide the unit pyramid geometrymeshes- the Geometry list to hold the computed points, etc. for all Geometries
-
drawGeometry
protected void drawGeometry(DrawContext dc, int mode, int count, int type, java.nio.Buffer elementBuffer, RigidShape.ShapeData shapeData, int face)
Renders the Pyramid, using data from the provided buffer and the given parameters- Specified by:
drawGeometryin classRigidShape- Parameters:
dc- the current draw contextmode- the render modecount- the number of elements to be drawntype- the data type of the elements to be drawnelementBuffer- the buffer containing the list of elements to be drawnshapeData- the current globe-specific shape dataface- the index of the shape face to render
-
createIntersectionGeometry
protected RigidShape.ShapeData createIntersectionGeometry(Terrain terrain)
- Specified by:
createIntersectionGeometryin classRigidShape
-
isExportFormatSupported
public java.lang.String isExportFormatSupported(java.lang.String mimeType)
No export formats supported.- Specified by:
isExportFormatSupportedin interfaceExportable- Overrides:
isExportFormatSupportedin classAbstractShape- Parameters:
mimeType- Desired export format.- Returns:
- One of
Exportable.FORMAT_SUPPORTED,Exportable.FORMAT_NOT_SUPPORTED, orExportable.FORMAT_PARTIALLY_SUPPORTED. - See Also:
Exportable.export(String, Object)
-
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.
-
-