Class SphereAirspace
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.render.airspaces.AbstractAirspace
-
- gov.nasa.worldwind.render.airspaces.SphereAirspace
-
- All Implemented Interfaces:
AVList
,Draggable
,MessageListener
,ExtentHolder
,Movable
,Movable2
,Airspace
,Attributable
,Highlightable
,OrderedRenderable
,PreRenderable
,Renderable
,Restorable
,WWObject
,java.beans.PropertyChangeListener
,java.util.EventListener
public class SphereAirspace extends AbstractAirspace
A spherical airspace shape defined by a center location and a radius. The sphere's center altitude and terrain conformance attributes are taken from the lower altitude and lower terrain conformance. When terrain conformance is disabled, the sphere's altitude behaves as a height above mean sea level. When terrain conformance is enabled, the sphere's altitude will behave as a height offset above the terrain. Unlike other airspace shapes, the sphere's geometry will not morph to the terrain beneath it.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class gov.nasa.worldwind.render.airspaces.AbstractAirspace
AbstractAirspace.AirspaceInfo
-
-
Field Summary
Fields Modifier and Type Field Description protected static int
DEFAULT_SUBDIVISIONS
-
Fields inherited from class gov.nasa.worldwind.render.airspaces.AbstractAirspace
activeAttributes, airspaceInfo, alwaysOnTop, ARC_SLICES, attributes, currentInfo, DEFAULT_HIGHLIGHT_MATERIAL, DEFAULT_INTERIOR_MATERIAL, DEFAULT_OUTLINE_MATERIAL, DEFAULT_OUTLINE_PICK_WIDTH, defaultAttributes, delegateOwner, detailLevels, DISABLE_TERRAIN_CONFORMANCE, dragEnabled, draggableSupport, drawSurfaceShape, elevationMap, enableBatchPicking, enableBatchRendering, enableDepthOffset, enableLevelOfDetail, EXPIRY_TIME, expiryTime, frameTimeStamp, GEOMETRY_CACHE_KEY, GEOMETRY_CACHE_NAME, geometryBuilder, GLOBE_KEY, groundReference, highlightAttributes, highlighted, LENGTH_SLICES, LOOPS, lowerAltitude, lowerAltitudeDatum, lowerTerrainConforming, maxExpiryTime, minExpiryTime, mustRegenerateSurfaceShape, outlinePickWidth, outlineShapeRenderer, pickLayer, pickSupport, PILLARS, rand, SLICES, SPLIT_THRESHOLD, STACKS, SUBDIVISIONS, surfaceShape, upperAltitude, upperAltitudeDatum, upperTerrainConforming, VERTICAL_EXAGGERATION, visible
-
Fields inherited from interface gov.nasa.worldwind.render.airspaces.Airspace
DRAW_STYLE_FILL, DRAW_STYLE_OUTLINE
-
-
Constructor Summary
Constructors Constructor Description SphereAirspace()
SphereAirspace(LatLon location, double radius)
SphereAirspace(AirspaceAttributes attributes)
SphereAirspace(SphereAirspace source)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Extent
computeExtent(Globe globe, double verticalExaggeration)
protected Sphere
computeExtent(DrawContext dc)
protected double
computeEyeDistance(DrawContext dc)
protected java.util.List<Vec4>
computeMinimalGeometry(Globe globe, double verticalExaggeration)
protected SurfaceShape
createSurfaceShape()
Returns aSurfaceShape
that corresponds to this Airspace and is used for drawing on 2D globes.protected void
doGetRestorableState(RestorableSupport rs, RestorableSupport.StateObject context)
protected void
doMoveTo(Position oldRef, Position newRef)
protected void
doMoveTo(Globe globe, Position oldRef, Position newRef)
protected void
doRenderGeometry(DrawContext dc, java.lang.String drawStyle)
protected void
doRestoreState(RestorableSupport rs, RestorableSupport.StateObject context)
protected void
drawSphere(DrawContext dc)
protected void
drawUnitSphere(DrawContext dc, int subdivisions)
Extent
getExtent(DrawContext dc)
Returns this SphereAirspace'sExtent
for the specified DrawContext.LatLon
getLocation()
Returns the center location of the sphere.double
getRadius()
Returns the radius of the sphere in meters.Position
getReferencePosition()
A position associated with the object that indicates its aggregate geographic position.protected int
getSubdivisions()
protected void
makeSphere(double radius, int subdivisions, Geometry dest)
protected void
regenerateSurfaceShape(DrawContext dc, SurfaceShape shape)
Regenerates surface shape geometry prior to picking and rendering the 2D shape used to represent this Airspace on 2D globes.void
setLocation(LatLon location)
Sets the center location of the sphere.void
setRadius(double radius)
Sets the radius of the sphere in meters.protected void
setSubdivisions(int subdivisions)
protected void
updateSurfaceShape(DrawContext dc, SurfaceShape shape)
Sets surface shape parameters prior to picking and rendering the 2D shape used to represent this Airspace on 2D globes.-
Methods inherited from class gov.nasa.worldwind.render.airspaces.AbstractAirspace
addDetailLevels, adjustForGroundReference, beginRendering, clearElevationMap, computeDetailLevel, computeElevationAt, computeMinimalGeometry, computePointFromPosition, computeReferencePosition, createPickedObject, determineActiveAttributes, doDrag, doDrawOrderedRenderable, drag, drawBatched, drawGeometry, drawInterior, drawOrderedRenderable, drawOutline, endRendering, getActiveAttributes, getAirspaceInfo, getAltitudeDatum, getAltitudes, getAltitudes, getAttributes, getDelegateOwner, getDetailLevels, getDistanceFromEye, getExpiryRange, getExpiryTime, getExtent, getGeometryBuilder, getGeometryCache, getGroundReference, getHighlightAttributes, getOutlinePickWidth, getRestorableState, invalidateAirspaceData, isAirspaceCollapsed, isAirspaceVisible, isAlwaysOnTop, isDragEnabled, isDrawSurfaceShape, isEnableBatchPicking, isEnableBatchRendering, isEnableDepthOffset, isEnableLevelOfDetail, isExpired, isHighlighted, isTerrainConforming, isVisible, makeExtremePoints, makeOrderedRenderable, move, moveTo, moveTo, mustDrawInterior, mustDrawOutline, nextExpiryTime, pick, preRender, render, restoreState, setAltitude, setAltitudeDatum, setAltitudes, setAlwaysOnTop, setAttributes, setAttributes, setDelegateOwner, setDetailLevels, setDragEnabled, setDrawSurfaceShape, setEnableBatchPicking, setEnableBatchRendering, setEnableDepthOffset, setEnableLevelOfDetail, setExpiryRange, setExpiryTime, setGeometryBuilder, setGroundReference, setHighlightAttributes, setHighlightAttributes, setHighlighted, setOutlinePickWidth, setTerrainConforming, setTerrainConforming, setVisible, updateExpiryCriteria
-
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
-
-
Constructor Detail
-
SphereAirspace
public SphereAirspace(LatLon location, double radius)
-
SphereAirspace
public SphereAirspace(AirspaceAttributes attributes)
-
SphereAirspace
public SphereAirspace()
-
SphereAirspace
public SphereAirspace(SphereAirspace source)
-
-
Method Detail
-
getLocation
public LatLon getLocation()
Returns the center location of the sphere.- Returns:
- location of the sphere.
-
setLocation
public void setLocation(LatLon location)
Sets the center location of the sphere.- Parameters:
location
- the location of the sphere.- Throws:
java.lang.IllegalArgumentException
- iflocation
is null
-
getRadius
public double getRadius()
Returns the radius of the sphere in meters.- Returns:
- radius of the sphere in meters.
-
setRadius
public void setRadius(double radius)
Sets the radius of the sphere in meters. This will also set the altitude limits to match the new radius and center elevation.- Parameters:
radius
- the radius of the sphere.- Throws:
java.lang.IllegalArgumentException
- ifradius
is less than zero
-
getReferencePosition
public Position getReferencePosition()
Description copied from interface:Movable
A 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.
-
computeExtent
protected Extent computeExtent(Globe globe, double verticalExaggeration)
- Specified by:
computeExtent
in classAbstractAirspace
-
computeMinimalGeometry
protected java.util.List<Vec4> computeMinimalGeometry(Globe globe, double verticalExaggeration)
- Specified by:
computeMinimalGeometry
in classAbstractAirspace
-
getExtent
public Extent getExtent(DrawContext dc)
Returns this SphereAirspace'sExtent
for the specified DrawContext. This overridesAbstractAirspace.getExtent(gov.nasa.worldwind.render.DrawContext)
in order to bypass the superclass' extent caching. Unlike other Airspace's Extents, SphereAirspace's Extent is a perfect fittingSphere
, who's center point depends on the current surface geometry. For this reason SphereAirspace's exact bounding volume can be easily computed, and should not be cached.- Specified by:
getExtent
in interfaceAirspace
- Overrides:
getExtent
in classAbstractAirspace
- Parameters:
dc
- the current DrawContext.- Returns:
- this SphereAirspace's Extent in model coordinates.
- Throws:
java.lang.IllegalArgumentException
- if the DrawContext is null, or if the Globe held by the DrawContext is null.
-
computeExtent
protected Sphere computeExtent(DrawContext dc)
- Overrides:
computeExtent
in classAbstractAirspace
-
doMoveTo
protected void doMoveTo(Globe globe, Position oldRef, Position newRef)
- Overrides:
doMoveTo
in classAbstractAirspace
-
doMoveTo
protected void doMoveTo(Position oldRef, Position newRef)
- Overrides:
doMoveTo
in classAbstractAirspace
-
computeEyeDistance
protected double computeEyeDistance(DrawContext dc)
- Overrides:
computeEyeDistance
in classAbstractAirspace
-
createSurfaceShape
protected SurfaceShape createSurfaceShape()
Description copied from class:AbstractAirspace
Returns aSurfaceShape
that corresponds to this Airspace and is used for drawing on 2D globes.- Overrides:
createSurfaceShape
in classAbstractAirspace
- Returns:
- The surface shape to represent this Airspace on a 2D globe.
-
updateSurfaceShape
protected void updateSurfaceShape(DrawContext dc, SurfaceShape shape)
Description copied from class:AbstractAirspace
Sets surface shape parameters prior to picking and rendering the 2D shape used to represent this Airspace on 2D globes. Subclasses should override this method if they need to update more than the attributes and the delegate owner.- Overrides:
updateSurfaceShape
in classAbstractAirspace
- Parameters:
dc
- the current drawing context.shape
- the surface shape to update.
-
regenerateSurfaceShape
protected void regenerateSurfaceShape(DrawContext dc, SurfaceShape shape)
Description copied from class:AbstractAirspace
Regenerates surface shape geometry prior to picking and rendering the 2D shape used to represent this Airspace on 2D globes.- Overrides:
regenerateSurfaceShape
in classAbstractAirspace
- Parameters:
dc
- the current drawing context.shape
- the surface shape to regenerate.
-
getSubdivisions
protected int getSubdivisions()
-
setSubdivisions
protected void setSubdivisions(int subdivisions)
-
doRenderGeometry
protected void doRenderGeometry(DrawContext dc, java.lang.String drawStyle)
- Specified by:
doRenderGeometry
in classAbstractAirspace
-
drawSphere
protected void drawSphere(DrawContext dc)
-
drawUnitSphere
protected void drawUnitSphere(DrawContext dc, int subdivisions)
-
makeSphere
protected void makeSphere(double radius, int subdivisions, Geometry dest)
-
doGetRestorableState
protected void doGetRestorableState(RestorableSupport rs, RestorableSupport.StateObject context)
- Overrides:
doGetRestorableState
in classAbstractAirspace
-
doRestoreState
protected void doRestoreState(RestorableSupport rs, RestorableSupport.StateObject context)
- Overrides:
doRestoreState
in classAbstractAirspace
-
-