NASA World Wind

gov.nasa.worldwind.render.airspaces
Class Box

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.Box
All Implemented Interfaces:
AVList, ExtentHolder, Movable, Airspace, Renderable, Restorable

public class Box
extends AbstractAirspace


Nested Class Summary
protected static class Box.BoxData
          Holds a box's vertex data that's associated with a particular globe.
 
Nested classes/interfaces inherited from class gov.nasa.worldwind.render.airspaces.AbstractAirspace
AbstractAirspace.AirspaceInfo
 
Field Summary
protected static int A_LOW_LEFT
           
protected static int A_LOW_RIGHT
           
protected static int A_UPR_LEFT
           
protected static int A_UPR_RIGHT
           
protected static int B_LOW_LEFT
           
protected static int B_LOW_RIGHT
           
protected static int B_UPR_LEFT
           
protected static int B_UPR_RIGHT
           
protected  Map<Globe,Box.BoxData> boxData
          Map indicating the box's vertices associated with a particular globe.
protected static int DEFAULT_HEIGHT_STACKS
           
protected static int DEFAULT_PILLARS
           
protected static int DEFAULT_STACKS
           
static int FACE_BACK
           
static int FACE_BOTTOM
           
static int FACE_FRONT
           
static int FACE_LEFT
           
static int FACE_RIGHT
           
static int FACE_TOP
           
protected static int LOW_FACE
           
protected static int MINIMAL_GEOMETRY_PILLARS
           
protected static int MINIMAL_GEOMETRY_STACKS
           
protected static int SIDE_FACE
           
protected static int UPR_FACE
           
 
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
Box()
           
Box(AirspaceAttributes attributes)
           
Box(LatLon location1, LatLon location2, double leftWidth, double rightWidth)
           
 
Method Summary
 void clearVertices()
          Removes all of this box's globe-associated vertex data.
protected  Box computeExtent(Globe globe, double verticalExaggeration)
           
protected  List<Vec4> computeMinimalGeometry(Globe globe, double verticalExaggeration)
           
protected  Vec4 computeReferenceCenter(DrawContext dc)
           
static Plane[] computeStandardPlanes(Globe globe, double verticalExaggeration, Box box)
          Returns an array of six Planes that define the plane for each face of the specified box on the specified globe.
static Vec4[] computeStandardVertices(Globe globe, double verticalExaggeration, Box box)
           
protected  void doGetRestorableState(RestorableSupport rs, RestorableSupport.StateObject context)
           
protected  void doMoveTo(Position oldRef, Position newRef)
           
protected  void doRenderGeometry(DrawContext dc, String drawStyle)
           
protected  void doRestoreState(RestorableSupport rs, RestorableSupport.StateObject context)
           
protected  int getHeightStacks()
           
 LatLon[] getLocations()
           
protected  int getPillars()
           
 Position getReferencePosition()
          A position associated with the object that indicates its aggregate geographic position.
protected  int getStacks()
           
 Vec4[] getVertices()
           
 Vec4[] getVertices(Globe globe)
          Indicates this box's vertices that associated with the specified globe.
 double[] getWidths()
           
 boolean[] isEnableCaps()
           
protected  boolean isForceCullFace()
           
 boolean isVerticesValid(Globe globe)
          Indicates whether the box's vertices associated with the specific globe are valid for the globe's current state.
 void setEnableCaps(boolean enable)
           
 void setEnableCaps(boolean enableStartCap, boolean enableEndCap)
           
 void setEnableEndCap(boolean enable)
           
 void setEnableStartCap(boolean enable)
           
protected  void setForceCullFace(boolean forceCullFace)
           
 void setLocations(LatLon location1, LatLon location2)
          Sets the leg's locations, in geographic coordinates.
protected  void setPillars(int pillars)
           
protected  void setStacks(int stacks)
           
 void setVertices(Globe globe, Vec4[] vertices)
          Specifies this box's vertices that are associated with the specified globe.
 void setVertices(Vec4[] vertices)
           
 void setWidths(double leftWidth, double rightWidth)
           
 
Methods inherited from class gov.nasa.worldwind.render.airspaces.AbstractAirspace
addDetailLevels, adjustForGroundReference, clearElevationMap, computeDetailLevel, computeElevationAt, computeExtent, computeEyeDistance, computeMinimalGeometry, computePointFromPosition, computeReferencePosition, doRender, doRenderExtent, getAirspaceInfo, getAltitudeDatum, getAltitudes, getAltitudes, getAttributes, getDetailLevels, getExpiryRange, getExpiryTime, getExtent, getExtent, getGeometryBuilder, getGeometryCache, getGroundReference, getRenderer, getRestorableState, isAirspaceCollapsed, isAirspaceVisible, isEnableLevelOfDetail, isExpired, isTerrainConforming, isVisible, makeExtremePoints, makeOrderedRenderable, move, moveTo, nextExpiryTime, render, renderExtent, renderGeometry, restoreState, setAltitude, setAltitudeDatum, setAltitudes, setAttributes, setDetailLevels, setEnableLevelOfDetail, setExpiryRange, setExpiryTime, setExtentOutOfDate, setGeometryBuilder, setGroundReference, setRenderer, setTerrainConforming, 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

A_LOW_LEFT

protected static final int A_LOW_LEFT
See Also:
Constant Field Values

A_LOW_RIGHT

protected static final int A_LOW_RIGHT
See Also:
Constant Field Values

A_UPR_LEFT

protected static final int A_UPR_LEFT
See Also:
Constant Field Values

A_UPR_RIGHT

protected static final int A_UPR_RIGHT
See Also:
Constant Field Values

B_LOW_LEFT

protected static final int B_LOW_LEFT
See Also:
Constant Field Values

B_LOW_RIGHT

protected static final int B_LOW_RIGHT
See Also:
Constant Field Values

B_UPR_LEFT

protected static final int B_UPR_LEFT
See Also:
Constant Field Values

B_UPR_RIGHT

protected static final int B_UPR_RIGHT
See Also:
Constant Field Values

boxData

protected Map<Globe,Box.BoxData> boxData
Map indicating the box's vertices associated with a particular globe. This enables a box to be used simultaneously in multiple models with different globes. This is initialized to a HashMap in order to support null keys. Null keys are used for backward compatibility with the Box accessor methods that do not specify a globe.


DEFAULT_HEIGHT_STACKS

protected static final int DEFAULT_HEIGHT_STACKS
See Also:
Constant Field Values

DEFAULT_PILLARS

protected static final int DEFAULT_PILLARS
See Also:
Constant Field Values

DEFAULT_STACKS

protected static final int DEFAULT_STACKS
See Also:
Constant Field Values

FACE_BACK

public static final int FACE_BACK
See Also:
Constant Field Values

FACE_BOTTOM

public static final int FACE_BOTTOM
See Also:
Constant Field Values

FACE_FRONT

public static final int FACE_FRONT
See Also:
Constant Field Values

FACE_LEFT

public static final int FACE_LEFT
See Also:
Constant Field Values

FACE_RIGHT

public static final int FACE_RIGHT
See Also:
Constant Field Values

FACE_TOP

public static final int FACE_TOP
See Also:
Constant Field Values

LOW_FACE

protected static final int LOW_FACE
See Also:
Constant Field Values

MINIMAL_GEOMETRY_PILLARS

protected static final int MINIMAL_GEOMETRY_PILLARS
See Also:
Constant Field Values

MINIMAL_GEOMETRY_STACKS

protected static final int MINIMAL_GEOMETRY_STACKS
See Also:
Constant Field Values

SIDE_FACE

protected static final int SIDE_FACE
See Also:
Constant Field Values

UPR_FACE

protected static final int UPR_FACE
See Also:
Constant Field Values
Constructor Detail

Box

public Box()

Box

public Box(AirspaceAttributes attributes)

Box

public Box(LatLon location1,
           LatLon location2,
           double leftWidth,
           double rightWidth)
Method Detail

clearVertices

public void clearVertices()
Removes all of this box's globe-associated vertex data.


computeExtent

protected Box 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

computeReferenceCenter

protected Vec4 computeReferenceCenter(DrawContext dc)

computeStandardPlanes

public static Plane[] computeStandardPlanes(Globe globe,
                                            double verticalExaggeration,
                                            Box box)
Returns an array of six Planes that define the plane for each face of the specified box on the specified globe. The each plane may be accessed using the FACE constants in Box as indices into the array: FACE_TOP, FACE_BOTTOM, FACE_LEFT, FACE_RIGHT, FACE_FRONT, FACE_BACK.

Parameters:
globe - the Globe the box is related to.
verticalExaggeration - the vertical exaggeration of the scene.
box - the Box to compute the planes for.
Returns:
six Planes for each face of the specified box, in the following order: top, bottom, left, right, front, back.

computeStandardVertices

public static Vec4[] computeStandardVertices(Globe globe,
                                             double verticalExaggeration,
                                             Box box)

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

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

getHeightStacks

protected int getHeightStacks()

getLocations

public LatLon[] getLocations()

getPillars

protected int getPillars()

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.

getStacks

protected int getStacks()

getVertices

public Vec4[] getVertices()

getVertices

public Vec4[] getVertices(Globe globe)
Indicates this box's vertices that associated with the specified globe. This returns null if no vertices are currently associated with the specified globe. Specify null to get the vertices that are not associated with any globe.

Parameters:
globe - the globe the vertices are associated with, or null to get the vertices that are not associated with any globe.
Returns:
an array of length 8 indicating this box's vertices in model coordinates, or null to indicate that no vertices are associated with the globe.

getWidths

public double[] getWidths()

isEnableCaps

public boolean[] isEnableCaps()

isForceCullFace

protected boolean isForceCullFace()

isVerticesValid

public boolean isVerticesValid(Globe globe)
Indicates whether the box's vertices associated with the specific globe are valid for the globe's current state. This returns true if this box has any vertex data associated with the globe and the globe state used to generate the data is equivalent to the globe's current state. This returns false if this box does not have any vertex data associated with the globe, or if the vertex data is out of date.

Parameters:
globe - the globe the vertices are associated with, or null to get the valid state of the vertices that are not associated with any globe.
Returns:
true if this box has vertices associated with the globe which are valid for the globe's current state, and false otherwise.

setEnableCaps

public void setEnableCaps(boolean enable)

setEnableCaps

public void setEnableCaps(boolean enableStartCap,
                          boolean enableEndCap)

setEnableEndCap

public void setEnableEndCap(boolean enable)

setEnableStartCap

public void setEnableStartCap(boolean enable)

setForceCullFace

protected void setForceCullFace(boolean forceCullFace)

setLocations

public void setLocations(LatLon location1,
                         LatLon location2)
Sets the leg's locations, in geographic coordinates.

Parameters:
location1 - geographic coordinates(latitude and longitude) specifying the center of the begining edge.
location2 - geographic coordinates(latitude and longitude) specifying the center of the ending edge.
Throws:
IllegalArgumentException - if location1 or location2 is null

setPillars

protected void setPillars(int pillars)

setStacks

protected void setStacks(int stacks)

setVertices

public void setVertices(Globe globe,
                        Vec4[] vertices)
Specifies this box's vertices that are associated with the specified globe. Specify a null globe to indicate that the vertices are not associated with any globe. Specify null vertices to remove vertices associated with the specified globe. This copies the elements of the specified vertices array; changes to the array after this method do not affect the data held by this box.

Parameters:
globe - the globe the vertices are associated with, or null to indicate that the vertices are not associated with any globe.
vertices - an array of length 8 indicating this box's vertices in model coordinates, or null to remove vertices associated with the specified globe.
Throws:
IllegalArgumentException - if the vertices array is not null and has fewer than eight elements.

setVertices

public void setVertices(Vec4[] vertices)

setWidths

public void setWidths(double leftWidth,
                      double rightWidth)

NASA World Wind