NASA World Wind

gov.nasa.worldwind.render
Class Cylinder

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.RigidShape
                  extended by gov.nasa.worldwind.render.Cylinder
All Implemented Interfaces:
AVList, MessageListener, Exportable, ExtentHolder, Movable, GeographicExtent, Highlightable, OrderedRenderable, Renderable, Restorable, WWObject, PropertyChangeListener, EventListener

public class Cylinder
extends RigidShape

A general cylinder volume defined by a center position, height and radius, or alternatively, by three axis radii.


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
protected static int DEFAULT_SUBDIVISIONS
           
protected  int faceCount
           
protected  int subdivisions
           
 
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, enableBatchPicking, enableBatchRendering, enableDepthOffset, highlightAttrs, highlighted, maxExpiryTime, minExpiryTime, normalAttrs, outlinePickWidth, outlineShapeRenderer, pickLayer, pickSupport, referencePosition, sector, shapeDataCache, VBO_THRESHOLD, viewDistanceExpiration, visible
 
Fields inherited from interface gov.nasa.worldwind.Exportable
FORMAT_NOT_SUPPORTED, FORMAT_PARTIALLY_SUPPORTED, FORMAT_SUPPORTED
 
Constructor Summary
Cylinder()
          Construct a cylinder with default parameters
Cylinder(Position centerPosition, double height, double radius)
          Constructs a Cylinder from a specified center position, height and radius.
Cylinder(Position centerPosition, double northSouthRadius, double verticalRadius, double eastWestRadius)
          Constructs a cylinder from a specified center position and axes lengths.
Cylinder(Position centerPosition, double northSouthRadius, double verticalRadius, double eastWestRadius, Angle heading, Angle tilt, Angle roll)
          Constructs a cylinder from a specified center position, axes lengths and rotation angles.
 
Method Summary
protected  double computeDetailThreshold()
          Computes a threshold value, based on the current detailHint, for use in the sufficientDetail() calculation.
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.
protected  RigidShape.ShapeData createIntersectionGeometry(Terrain terrain)
           
protected  void doExportAsKML(XMLStreamWriter xmlWriter)
          Exports shape-specific fields.
protected  void drawGeometry(DrawContext dc, int mode, int count, int type, Buffer elementBuffer, RigidShape.ShapeData shapeData, int face)
          Renders the cylinder, using data from the provided buffer and the given parameters.
 int getFaceCount()
          Returns the number of separate faces that comprise this shape.
 int getSubdivisions()
           
 String isExportFormatSupported(String mimeType)
          No export formats supported.
protected  void makeGeometry(RigidShape.ShapeData shapeData)
          Sets the Geometry mesh for this cylinder, either by pulling it from the geometryCache, or by creating it anew if the appropriate geometry does not yet exist in the cache.
protected  void makeUnitCylinder(int subdivisions, List<Geometry> meshes)
          Generates a unit cylinder geometry, including the vertices, indices, normals and texture coordinates, tessellated with the specified number of divisions.
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  boolean sufficientDetail(DrawContext dc, int subdivisions, RigidShape.ShapeData shapeData)
           
 
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, initialize, intersect, intersect, intersect, intersectFace, isOrderedRenderableValid, isSameAsPreviousTerrain, moveTo, mustApplyTexture, mustApplyTexture, 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, countTriangleVertices, createPickedObject, determineActiveAttributes, doDrawOrderedRenderable, drawBatched, drawInterior, drawOrderedRenderable, drawOutline, endDrawing, export, exportAsKML, getActiveAttributes, getAltitudeMode, getAttributes, getCurrentData, getDelegateOwner, getDistanceFromEye, getExtent, getGeometryRegenerationInterval, getHighlightAttributes, getOutlinePickWidth, getReferencePoint, getVboIds, intersectsFrustum, isEnableBatchPicking, isEnableBatchRendering, isEnableDepthOffset, isHighlighted, isTerrainDependent, isViewDistanceExpiration, isVisible, makeOrderedRenderable, makeTexture, move, mustApplyLighting, mustApplyLighting, mustCreateNormals, mustCreateNormals, mustDrawInterior, mustDrawOutline, pick, prepareToDrawInterior, prepareToDrawOutline, render, 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

DEFAULT_SUBDIVISIONS

protected static final int DEFAULT_SUBDIVISIONS
See Also:
Constant Field Values

faceCount

protected int faceCount

subdivisions

protected int subdivisions
Constructor Detail

Cylinder

public Cylinder()
Construct a cylinder with default parameters


Cylinder

public Cylinder(Position centerPosition,
                double height,
                double radius)
Constructs a Cylinder from a specified center position, height and radius.

Parameters:
centerPosition - the Cylinder's center position.
height - the Cylinder's height, in meters.
radius - the radius of the Cylinder's base, in meters.
Throws:
IllegalArgumentException - if the center position is null or any of the radii are not greater than 0.

Cylinder

public Cylinder(Position centerPosition,
                double northSouthRadius,
                double verticalRadius,
                double eastWestRadius)
Constructs a cylinder from a specified center position and axes lengths.

Parameters:
centerPosition - the cylinder's center position.
northSouthRadius - the cylinder's north-south radius, in meters.
verticalRadius - the cylinder's vertical radius, in meters.
eastWestRadius - the cylinder's east-west radius, in meters.
Throws:
IllegalArgumentException - if the center position is null or any of the radii are not greater than 0.

Cylinder

public Cylinder(Position centerPosition,
                double northSouthRadius,
                double verticalRadius,
                double eastWestRadius,
                Angle heading,
                Angle tilt,
                Angle roll)
Constructs a cylinder 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 cylinder's center position.
northSouthRadius - the cylinder's north-south radius, in meters.
verticalRadius - the cylinder's vertical radius, in meters.
eastWestRadius - the cylinder's east-west radius, in meters.
heading - the cylinder's azimuth, its rotation about its vertical axis.
tilt - the cylinder pitch, its rotation about its east-west axis.
roll - the cylinder's roll, its rotation about its north-south axis.
Method Detail

computeDetailThreshold

protected double computeDetailThreshold()
Computes a threshold value, based on the current detailHint, for use in the sufficientDetail() calculation.

Returns:
the detailThreshold

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:
computeSubdivisions in class RigidShape
Parameters:
dc - the current drawContext.
shapeData - the current globe-specific shape data

createIntersectionGeometry

protected RigidShape.ShapeData createIntersectionGeometry(Terrain terrain)
Specified by:
createIntersectionGeometry in class RigidShape

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.

drawGeometry

protected void drawGeometry(DrawContext dc,
                            int mode,
                            int count,
                            int type,
                            Buffer elementBuffer,
                            RigidShape.ShapeData shapeData,
                            int face)
Renders the cylinder, using data from the provided buffer and the given parameters.

Specified by:
drawGeometry in class RigidShape
Parameters:
dc - the current draw context
mode - the render mode
count - the number of elements to be drawn
type - the data type of the elements to be drawn
elementBuffer - the buffer containing the list of elements to be drawn
shapeData - this shape's current globe-specific shape data
face - the shape face currently being drawn

getFaceCount

public int getFaceCount()
Description copied from class: RigidShape
Returns the number of separate faces that comprise this shape.

Overrides:
getFaceCount in class RigidShape
Returns:
number of faces

getSubdivisions

public int getSubdivisions()
Specified by:
getSubdivisions in class RigidShape

isExportFormatSupported

public String isExportFormatSupported(String mimeType)
No export formats supported.

Specified by:
isExportFormatSupported in interface Exportable
Overrides:
isExportFormatSupported in class AbstractShape
Parameters:
mimeType - Desired export format.
Returns:
One of Exportable.FORMAT_SUPPORTED, Exportable.FORMAT_NOT_SUPPORTED, or Exportable.FORMAT_PARTIALLY_SUPPORTED.
See Also:
Exportable.export(String, Object)

makeGeometry

protected void makeGeometry(RigidShape.ShapeData shapeData)
Sets the Geometry mesh for this cylinder, 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:
makeGeometry in class RigidShape
Parameters:
shapeData - this shape's current shape data.

makeUnitCylinder

protected void makeUnitCylinder(int subdivisions,
                                List<Geometry> meshes)
Generates a unit cylinder 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 cylinder geometry
meshes - the Geometry list to hold the computed points, etc. for all Geometries

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 RigidShape
Parameters:
dc - the current draw context.
Returns:
true if this shape's geometry must be regenerated, otherwise false.

sufficientDetail

protected boolean sufficientDetail(DrawContext dc,
                                   int subdivisions,
                                   RigidShape.ShapeData shapeData)

NASA World Wind