NASA World Wind

gov.nasa.worldwind.render.airspaces
Class TrackAirspace

java.lang.Object
  extended by gov.nasa.worldwind.avlist.AVListImpl
      extended by gov.nasa.worldwind.render.airspaces.AbstractAirspace
          extended by gov.nasa.worldwind.render.airspaces.TrackAirspace
All Implemented Interfaces:
AVList, ExtentHolder, Movable, Airspace, Renderable, Restorable
Direct Known Subclasses:
Route

public class TrackAirspace
extends AbstractAirspace


Nested Class Summary
 
Nested classes/interfaces inherited from class gov.nasa.worldwind.render.airspaces.AbstractAirspace
AbstractAirspace.AirspaceInfo
 
Field Summary
protected  boolean enableInnerCaps
           
protected  List<Box> legs
           
protected  Angle smallAngleThreshold
          Denotes the the threshold that defines whether the angle between two adjacent legs is small.
 
Fields inherited from class gov.nasa.worldwind.render.airspaces.AbstractAirspace
airspaceInfo, ARC_SLICES, DISABLE_TERRAIN_CONFORMANCE, EXPIRY_TIME, GEOMETRY_CACHE_KEY, GEOMETRY_CACHE_NAME, GLOBE_KEY, LENGTH_SLICES, LOOPS, PILLARS, SLICES, SPLIT_THRESHOLD, STACKS, SUBDIVISIONS, VERTICAL_EXAGGERATION
 
Fields inherited from interface gov.nasa.worldwind.render.airspaces.Airspace
DRAW_STYLE_FILL, DRAW_STYLE_OUTLINE
 
Constructor Summary
TrackAirspace()
           
TrackAirspace(AirspaceAttributes attributes)
           
TrackAirspace(Collection<Box> legs)
           
 
Method Summary
protected  void addLeg(Box leg)
           
 Box addLeg(LatLon start, LatLon end, double lowerAltitude, double upperAltitude, double leftWidth, double rightWidth)
           
protected  void addLegs(Iterable<Box> newLegs)
           
protected  Plane computeBisectingPlane(Globe globe, Box leg1, Box leg2)
          Returns a Plane that bisects the angle between the two legs at the point at their common location.
protected  Extent computeExtent(DrawContext dc)
           
protected  Extent computeExtent(Globe globe, double verticalExaggeration)
           
protected  List<Vec4> computeMinimalGeometry(Globe globe, double verticalExaggeration)
           
protected  void doGetRestorableState(RestorableSupport rs, RestorableSupport.StateObject context)
           
protected  void doMoveTo(Position oldRef, Position newRef)
           
protected  void doRenderExtent(DrawContext dc)
           
protected  void doRenderGeometry(DrawContext dc, String drawStyle)
           
protected  void doRestoreState(RestorableSupport rs, RestorableSupport.StateObject context)
           
protected  void doUpdateLegs(DrawContext dc)
           
 List<Box> getLegs()
           
 Position getReferencePosition()
          A position associated with the object that indicates its aggregate geographic position.
 Angle getSmallAngleThreshold()
          Desnotes the threshold that defines whether the angle between two adjacent legs is small.
 boolean isAirspaceVisible(DrawContext dc)
          Test if this airspace is visible in the specified draw context.
 boolean isEnableInnerCaps()
           
protected  boolean isLegsOutOfDate(DrawContext dc)
           
protected  boolean isRightTurn(Globe globe, Box leg1, Box leg2)
          Specifies whether the two adjacent legs make a right turn relative to the surface of the specified globe.
protected  boolean isSmallAngle(Globe globe, Box leg1, Box leg2)
          Specifies whether the angle between the two adjacent legs is less than a specified threshold.
protected  void joinLegs(Globe globe, double verticalExaggeration, Box leg1, Box leg2)
          Modifies the vertices of the specified adjacent legs to produce a seamless transition from the first leg to the second.
 void makeOrderedRenderable(DrawContext dc, AirspaceRenderer renderer)
           
protected  boolean mustJoinLegs(Box leg1, Box leg2)
          Specifies whether the legs must have their adjacent vertices joined.
 void removeAllLegs()
           
 void setAltitudes(double lowerAltitude, double upperAltitude)
          Sets the lower and upper airspace surface altitudes.
 void setEnableInnerCaps(boolean draw)
           
 void setLegs(Collection<Box> legs)
           
protected  void setLegsOutOfDate()
           
 void setSmallAngleThreshold(Angle angle)
          Specifies the threshold that defines whether the angle between two adjacent legs is small.
 void setTerrainConforming(boolean lowerTerrainConformant, boolean upperTerrainConformant)
          Sets the altitude datum, which indicates whether airspace altitudes are relative to mean sea level, ground level or a single ground reference location.
 
Methods inherited from class gov.nasa.worldwind.render.airspaces.AbstractAirspace
addDetailLevels, adjustForGroundReference, clearElevationMap, computeDetailLevel, computeElevationAt, computeEyeDistance, computeMinimalGeometry, computePointFromPosition, computeReferencePosition, doRender, getAirspaceInfo, getAltitudeDatum, getAltitudes, getAltitudes, getAttributes, getDetailLevels, getExpiryRange, getExpiryTime, getExtent, getExtent, getGeometryBuilder, getGeometryCache, getGroundReference, getRenderer, getRestorableState, isAirspaceCollapsed, isEnableLevelOfDetail, isExpired, isTerrainConforming, isVisible, makeExtremePoints, move, moveTo, nextExpiryTime, render, renderExtent, renderGeometry, restoreState, setAltitude, setAltitudeDatum, setAttributes, setDetailLevels, setEnableLevelOfDetail, setExpiryRange, setExpiryTime, setExtentOutOfDate, setGeometryBuilder, setGroundReference, setRenderer, setTerrainConforming, setVisible, updateExpiryCriteria
 
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

enableInnerCaps

protected boolean enableInnerCaps

legs

protected List<Box> legs

smallAngleThreshold

protected Angle smallAngleThreshold
Denotes the the threshold that defines whether the angle between two adjacent legs is small. Initially 22.5 degrees.

Constructor Detail

TrackAirspace

public TrackAirspace()

TrackAirspace

public TrackAirspace(AirspaceAttributes attributes)

TrackAirspace

public TrackAirspace(Collection<Box> legs)
Method Detail

addLeg

protected void addLeg(Box leg)

addLeg

public Box addLeg(LatLon start,
                  LatLon end,
                  double lowerAltitude,
                  double upperAltitude,
                  double leftWidth,
                  double rightWidth)

addLegs

protected void addLegs(Iterable<Box> newLegs)

computeBisectingPlane

protected Plane computeBisectingPlane(Globe globe,
                                      Box leg1,
                                      Box leg2)
Returns a Plane that bisects the angle between the two legs at the point at their common location. leg1 must precede leg2, and they must share a common location at the end of leg1 and the beginning of leg2. This returns null if the legs overlap and cannot be bisected.

Parameters:
globe - the Globe the legs are related to.
leg1 - the first leg.
leg2 - the second leg.
Returns:
a Plane that bisects the geometry of the two legs.

computeExtent

protected Extent computeExtent(DrawContext dc)
Overrides:
computeExtent in class AbstractAirspace

computeExtent

protected Extent computeExtent(Globe globe,
                               double verticalExaggeration)
Specified by:
computeExtent in class AbstractAirspace

computeMinimalGeometry

protected List<Vec4> computeMinimalGeometry(Globe globe,
                                            double verticalExaggeration)
Specified by:
computeMinimalGeometry in class AbstractAirspace

doGetRestorableState

protected void doGetRestorableState(RestorableSupport rs,
                                    RestorableSupport.StateObject context)
Overrides:
doGetRestorableState in class AbstractAirspace

doMoveTo

protected void doMoveTo(Position oldRef,
                        Position newRef)
Overrides:
doMoveTo in class AbstractAirspace

doRenderExtent

protected void doRenderExtent(DrawContext dc)
Overrides:
doRenderExtent in class AbstractAirspace

doRenderGeometry

protected void doRenderGeometry(DrawContext dc,
                                String drawStyle)
Specified by:
doRenderGeometry in class AbstractAirspace

doRestoreState

protected void doRestoreState(RestorableSupport rs,
                              RestorableSupport.StateObject context)
Overrides:
doRestoreState in class AbstractAirspace

doUpdateLegs

protected void doUpdateLegs(DrawContext dc)

getLegs

public List<Box> getLegs()

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.

getSmallAngleThreshold

public Angle getSmallAngleThreshold()
Desnotes the threshold that defines whether the angle between two adjacent legs is small. This threshold is used to determine the best method for adjusting the vertices of adjacent legs.

Returns:
the angle used to determine when the angle between two adjacent legs is small.
See Also:
setSmallAngleThreshold(gov.nasa.worldwind.geom.Angle)

isAirspaceVisible

public boolean isAirspaceVisible(DrawContext dc)
Description copied from class: AbstractAirspace
Test if this airspace is visible in the specified draw context. During picking mode, this tests intersection against all of the draw context's pick frustums. During rendering mode, this tests intersection against the draw context's viewing frustum.

Specified by:
isAirspaceVisible in interface Airspace
Overrides:
isAirspaceVisible in class AbstractAirspace
Parameters:
dc - the draw context the airspace is related to.
Returns:
true if this airspace is visible; false otherwise.

isEnableInnerCaps

public boolean isEnableInnerCaps()

isLegsOutOfDate

protected boolean isLegsOutOfDate(DrawContext dc)

isRightTurn

protected boolean isRightTurn(Globe globe,
                              Box leg1,
                              Box leg2)
Specifies whether the two adjacent legs make a right turn relative to the surface of the specified globe. leg1 must precede leg2, and they must share a common location at the end of leg1 and the beginning of leg2.

Parameters:
globe - the Globe the legs are related to.
leg1 - the first leg.
leg2 - the second leg.
Returns:
@return true if the legs make a right turn on the specified globe, otherwise false.

isSmallAngle

protected boolean isSmallAngle(Globe globe,
                               Box leg1,
                               Box leg2)
Specifies whether the angle between the two adjacent legs is less than a specified threshold. The threshold is configured by calling setSmallAngleThreshold(gov.nasa.worldwind.geom.Angle). leg1 must precede leg2, and they must share a common location at the end of leg1 and the beginning of leg2.

Parameters:
globe - the Globe the legs are related to.
leg1 - the first leg.
leg2 - the second leg.
Returns:
true if the angle between the two legs is small, otherwise false.

joinLegs

protected void joinLegs(Globe globe,
                        double verticalExaggeration,
                        Box leg1,
                        Box leg2)
Modifies the vertices of the specified adjacent legs to produce a seamless transition from the first leg to the second. leg1 must precede leg2, and they must share a common location at the end of leg1 and the beginning of leg2. Without joining the adjacent vertices, the geometry of two adjacent boxes contains a gap on one side and an intersection on the other.

This does nothing if the legs cannot be joined for any reason.

Parameters:
globe - the Globe the legs are related to.
verticalExaggeration - the vertical exaggeration of the scene.
leg1 - the first leg.
leg2 - the second leg.

makeOrderedRenderable

public void makeOrderedRenderable(DrawContext dc,
                                  AirspaceRenderer renderer)
Specified by:
makeOrderedRenderable in interface Airspace
Overrides:
makeOrderedRenderable in class AbstractAirspace

mustJoinLegs

protected boolean mustJoinLegs(Box leg1,
                               Box leg2)
Specifies whether the legs must have their adjacent vertices joined. leg1 must precede leg2. A track's legs must be joined when two adjacent legs share a common location. In this case, the geometry of the two adjacent boxes contains a gap on one side and an intersection on the other. Joining the legs modifies the vertices of each leg at their common location to produce a seamless transition from the first leg to the second.

Parameters:
leg1 - the first leg.
leg2 - the second leg.
Returns:
true if the legs must be joined, otherwise false.

removeAllLegs

public void removeAllLegs()

setAltitudes

public void setAltitudes(double lowerAltitude,
                         double upperAltitude)
Description copied from interface: Airspace
Sets the lower and upper airspace surface altitudes. The altitudes are interpreted according to the current altitude datum of the respective surface. See Airspace.setAltitudeDatum(String, String) for a description of the possible interpretations and the means to specify them.

Specified by:
setAltitudes in interface Airspace
Overrides:
setAltitudes in class AbstractAirspace
Parameters:
lowerAltitude - the lower surface altitude, in meters.
upperAltitude - the upper surface altitude, in meters.
See Also:
Airspace.setAltitudes(double, double), Airspace.setAltitudeDatum(java.lang.String, java.lang.String), Airspace.setGroundReference(gov.nasa.worldwind.geom.LatLon)

setEnableInnerCaps

public void setEnableInnerCaps(boolean draw)

setLegs

public void setLegs(Collection<Box> legs)

setLegsOutOfDate

protected void setLegsOutOfDate()

setSmallAngleThreshold

public void setSmallAngleThreshold(Angle angle)
Specifies the threshold that defines whether the angle between two adjacent legs is small. This threshold is used to determine the best method for adjusting the vertices of adjacent legs.

When the angle between adjacent legs is small, the standard method of joining the leg's vertices forms a very large peak pointing away from the leg's common point. In this case TrackAirspace uses a method that avoids this peak and produces a seamless transition between the adjacent legs.

Parameters:
angle - the angle to use when determining when the angle between two adjacent legs is small.
Throws:
IllegalArgumentException - if angle is null.
See Also:
getSmallAngleThreshold()

setTerrainConforming

public void setTerrainConforming(boolean lowerTerrainConformant,
                                 boolean upperTerrainConformant)
Description copied from interface: Airspace
Sets the altitude datum, which indicates whether airspace altitudes are relative to mean sea level, ground level or a single ground reference location. The datum is normally set via Airspace.setAltitudeDatum(String, String), but this method is provided for backwards compatibility with the means of originally setting the datum. See the argument descriptions below for the mapping of the boolean values of this method to the altitude-datum values.

Specified by:
setTerrainConforming in interface Airspace
Overrides:
setTerrainConforming in class AbstractAirspace
Parameters:
lowerTerrainConformant - the lower altitude datum. A value of true indicates a lower altitude datum of AVKey.ABOVE_GROUND_LEVEL (terrain conforming), a value of false indicates a lower altitude datum of {link AVKey#ABOVE_MEAN_SEA_LEVEL} (not terrain conforming). the terrain-conforming, a value of false indicates that it's not.
upperTerrainConformant - the upper altitude datum. A value of true indicates an upper altitude datum of AVKey.ABOVE_GROUND_LEVEL (terrain conforming), a value of false indicates an upper altitude datum of {link AVKey#ABOVE_MEAN_SEA_LEVEL} (not terrain conforming. the terrain-conforming, a value of false indicates that it's not.
See Also:
Airspace.setAltitudeDatum(String, String)

NASA World Wind