Package gov.nasa.worldwindx.examples
Class RadarVolume
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.render.AbstractShape
-
- gov.nasa.worldwindx.examples.RadarVolume
-
- 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 RadarVolume extends AbstractShape
Displays a volume defined by a near and far grid of positions. This shape is meant to represent a radar volume, with the radar having a minimum and maximum range.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classRadarVolume.ShapeDataThis class 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 booleanenableSidesstatic intEXTERNAL_OBSTRUCTIONprotected intheightstatic intINTERNAL_OBSTRUCTIONstatic intNO_OBSTRUCTIONprotected int[]obstructionFlagsprotected java.util.List<Position>positionsprotected java.nio.IntBuffersideIndicesprotected static intTRIANGLE_NORMALprotected static intVERTEX_NORMALprotected intwidth-
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 RadarVolume(java.util.List<Position> positions, int[] obstructionFlags, int width, int height)Constructs a radar volume.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcomputeCenterPoint()protected AbstractShape.AbstractShapeDatacreateCacheEntry(DrawContext dc)Creates and returns a new cache entry specific to the subclass.protected voiddoDrawInterior(DrawContext dc)Draws this shape's interior.protected voiddoDrawOutline(DrawContext dc)Draws this shape's outline.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.protected voiddrawModel(DrawContext dc, int displayMode)protected voidfillVBO(DrawContext dc)Fill this shape's vertex buffer objects.protected RadarVolume.ShapeDatagetCurrent()Returns the current shape data cache entry.ExtentgetExtent(Globe globe, double verticalExaggeration)Returns the objects enclosing volume as anExtentin model coordinates, given a specifiedGlobeand vertical exaggeration (seeSceneController.getVerticalExaggeration().intgetHeight()Indicates the grid height.int[]getObstructionFlags()Returns the inclusion flags as specified to this object's constructor.java.util.List<Position>getPositions()Returns the grid positions as specified to this object's constructor.PositiongetReferencePosition()A position associated with the object that indicates its aggregate geographic position.SectorgetSector()Returns the object's geographic extent.intgetWidth()Indicates the grid width.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 shape.booleanisEnableSides()java.lang.StringisExportFormatSupported(java.lang.String mimeType)Does this object support a certain export format?protected booleanisOrderedRenderableValid(DrawContext dc)Determines whether this shape's ordered renderable state is valid and can be rendered.protected voidmakeGridNormals()protected voidmakeGridTriangles()Forms the volume's front, back and bottom vertices and computes appropriate normals.protected voidmakeGridVertices(DrawContext dc)protected voidmakeSides()voidmoveTo(Position position)Move the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.protected booleanmustApplyTexture(DrawContext dc)Indicates whether texture should be applied to this shape.voidsetEnableSides(boolean enableSides)protected voidsetTriangleNormals(int[] flags, int[] indices)protected booleanshouldUseVBOs(DrawContext dc)Indicates whether this shape should use OpenGL vertex buffer objects.protected static java.nio.FloatBuffertrimBuffer(java.nio.FloatBuffer buffer)-
Methods inherited from class gov.nasa.worldwind.render.AbstractShape
addOrderedRenderable, beginDrawing, checkViewDistanceExpiration, clearCachedVbos, computeExtentFromPositions, computePoint, computePoint, countTriangleVertices, createPickedObject, createSurfaceShape, determineActiveAttributes, doDrag, doDrawOrderedRenderable, doGetRestorableState, doRestoreState, drag, drawBatched, drawInterior, drawOrderedRenderable, drawOutline, endDrawing, export, exportAsKML, getActiveAttributes, getAltitudeMode, getAttributes, getCurrentData, getDelegateOwner, getDistanceFromEye, getExtent, getGeometryRegenerationInterval, getHighlightAttributes, getOutlinePickWidth, getReferencePoint, getRestorableState, getVboIds, intersectsFrustum, isDragEnabled, isEnableBatchPicking, isEnableBatchRendering, isEnableDepthOffset, isHighlighted, isTerrainDependent, isViewDistanceExpiration, isVisible, makeOrderedRenderable, makeTexture, move, moveTo, mustApplyLighting, mustApplyLighting, mustCreateNormals, mustCreateNormals, mustDrawInterior, mustDrawOutline, mustRegenerateGeometry, pick, prepareToDrawInterior, prepareToDrawOutline, preRender, render, reset, restoreState, setAltitudeMode, setAttributes, setDelegateOwner, setDragEnabled, setEnableBatchPicking, setEnableBatchRendering, setEnableDepthOffset, setGeometryRegenerationInterval, setHighlightAttributes, setHighlighted, setOutlinePickWidth, setReferencePosition, setViewDistanceExpiration, setVisible, 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
-
NO_OBSTRUCTION
public static final int NO_OBSTRUCTION
- See Also:
- Constant Field Values
-
EXTERNAL_OBSTRUCTION
public static final int EXTERNAL_OBSTRUCTION
- See Also:
- Constant Field Values
-
INTERNAL_OBSTRUCTION
public static final int INTERNAL_OBSTRUCTION
- See Also:
- Constant Field Values
-
VERTEX_NORMAL
protected static final int VERTEX_NORMAL
- See Also:
- Constant Field Values
-
TRIANGLE_NORMAL
protected static final int TRIANGLE_NORMAL
- See Also:
- Constant Field Values
-
positions
protected java.util.List<Position> positions
-
obstructionFlags
protected int[] obstructionFlags
-
width
protected int width
-
height
protected int height
-
sideIndices
protected java.nio.IntBuffer sideIndices
-
enableSides
protected boolean enableSides
-
-
Constructor Detail
-
RadarVolume
public RadarVolume(java.util.List<Position> positions, int[] obstructionFlags, int width, int height)
Constructs a radar volume.- Parameters:
positions- the volume's positions, organized as two grids. The near grid is held in the first width x height entries, the far grid is held in the next width x height entries. This list is retained as-is and is not copied.obstructionFlags- flags indicating the obstruction state of the specified positions. This array is retained as-is and is not copied. Recognized values areNO_OBSTRUCTIONindicating that the specified position is unobstructed,INTERNAL_OBSTRUCTIONindicating that the position is obstructed beyond the near grid but before the far grid,EXTERNAL_OBSTRUCTIONindicating that the position is obstructed before the near grid.width- the horizontal dimension of the grid.height- the vertical dimension of the grid.- Throws:
java.lang.IllegalArgumentException- if the positions list or inclusion flags array is null, the size of the inclusion flags array is less than the number of grid positions, the positions list is less than the specified size, or the width or height are less than 2.
-
-
Method Detail
-
isEnableSides
public boolean isEnableSides()
-
setEnableSides
public void setEnableSides(boolean enableSides)
-
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
-
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 RadarVolume.ShapeData getCurrent()
Returns the current shape data cache entry.- Returns:
- the current data cache entry.
-
getPositions
public java.util.List<Position> getPositions()
Returns the grid positions as specified to this object's constructor.- Returns:
- this object's grid positions.
-
getObstructionFlags
public int[] getObstructionFlags()
Returns the inclusion flags as specified to this object's constructor.- Returns:
- this object's inclusion flags.
-
getWidth
public int getWidth()
Indicates the grid width.- Returns:
- the grid width.
-
getHeight
public int getHeight()
Indicates the grid height.- Returns:
- the grid height.
-
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.
-
shouldUseVBOs
protected boolean shouldUseVBOs(DrawContext dc)
Description copied from class:AbstractShapeIndicates whether this shape should use OpenGL vertex buffer objects.- Overrides:
shouldUseVBOsin classAbstractShape- Parameters:
dc- the current draw context.- Returns:
- true if this shape should use vertex buffer objects, otherwise false.
-
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)
-
doDrawOutline
protected void doDrawOutline(DrawContext dc)
Description copied from class:AbstractShapeDraws this shape's outline. Called immediately after callingAbstractShape.prepareToDrawOutline(DrawContext, ShapeAttributes, ShapeAttributes), which establishes OpenGL state for lighting, blending, pick color and line attributes. Subclasses should execute the drawing commands specific to the type of shape.A
AbstractShape.AbstractShapeDatamust be current when this method is called.- Specified by:
doDrawOutlinein classAbstractShape- Parameters:
dc- the current draw context.
-
doDrawInterior
protected void doDrawInterior(DrawContext dc)
Description copied from class:AbstractShapeDraws this shape's interior. Called immediately after callingAbstractShape.prepareToDrawInterior(DrawContext, ShapeAttributes, ShapeAttributes), which establishes OpenGL state for lighting, blending, pick color and interior attributes. Subclasses should execute the drawing commands specific to the type of shape.A
AbstractShape.AbstractShapeDatamust be current when this method is called.- Specified by:
doDrawInteriorin classAbstractShape- Parameters:
dc- the current draw context.
-
drawModel
protected void drawModel(DrawContext dc, int displayMode)
-
makeGridVertices
protected void makeGridVertices(DrawContext dc)
-
makeGridNormals
protected void makeGridNormals()
-
computeCenterPoint
protected void computeCenterPoint()
-
makeGridTriangles
protected void makeGridTriangles()
Forms the volume's front, back and bottom vertices and computes appropriate normals.
-
setTriangleNormals
protected void setTriangleNormals(int[] flags, int[] indices)
-
trimBuffer
protected static java.nio.FloatBuffer trimBuffer(java.nio.FloatBuffer buffer)
-
makeSides
protected void makeSides()
-
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.
-
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.
-
getSector
public Sector getSector()
Description copied from interface:GeographicExtentReturns the object's geographic extent.- Returns:
- the object's geographic extent.
-
getReferencePosition
public Position getReferencePosition()
Description copied from interface:MovableA position associated with the object that indicates its aggregate geographic position. The chosen position varies among implementers of this interface. For objects defined by a list of positions, the reference position is typically the first position in the list. For symmetric objects the reference position is often the center of the object. In many cases the object's reference position may be explicitly specified by the application.- Returns:
- the object's reference position, or null if no reference position is available.
-
moveTo
public void moveTo(Position position)
Description copied from interface:MovableMove the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.- Parameters:
position- the new position of the shape's reference position.
-
intersect
public java.util.List<Intersection> intersect(Line line, Terrain terrain) throws java.lang.InterruptedException
Description copied from class:AbstractShapeCompute the intersections of a specified line with this shape. If the shape's altitude mode is other thanWorldWind.ABSOLUTE, the shape'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 shape's geometry.- Returns:
- a list of intersections identifying where the line intersects the shape, or null if the line does not intersect the shape.
- Throws:
java.lang.InterruptedException- if the operation is interrupted.- See Also:
Terrain
-
isExportFormatSupported
public java.lang.String isExportFormatSupported(java.lang.String mimeType)
Description copied from interface:ExportableDoes this object support a certain export format?- 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.
-
-