NASA World Wind

gov.nasa.worldwind.ogc.kml
Class KMLRegion.RegionData

java.lang.Object
  extended by gov.nasa.worldwind.avlist.AVListImpl
      extended by gov.nasa.worldwind.cache.ShapeDataCache.ShapeDataCacheEntry
          extended by gov.nasa.worldwind.ogc.kml.KMLRegion.RegionData
All Implemented Interfaces:
AVList
Enclosing class:
KMLRegion

protected static class KMLRegion.RegionData
extends ShapeDataCache.ShapeDataCacheEntry

RegionData holds a Region's computed data used during a single call to Region.isActive, and is unique to a particular Globe.

RegionData entries are places in a Region's regionDataCache, and are retrieved during each call to isActive using the current Globe as the cache key. RegionData's elements depend on the Globe's ElevationModel, and therefore cannot be permanently cached. Each RegionData entry is valid for a random amount of time between its minExpiryTime and its maxExpiryTime, after which it must be regenerated. The time is randomized to amortize the cost of regenerating data for multiple Regions over multiple frames.

isActive
RegionData's isActive property indicates whether the Region associated with a RegionData entry is active. This is used to share the result of computing isActive among multiple calls during the same frame. For example, the preRender and render passes need not each compute isActive, and can therefore share the same computation by ensuring that this property is set at most once per frame. Callers determine when to recompute isActive by comparing the DrawContext's current frame number against the RegionData's activeFrameNumber. This property is accessed by calling isActive and setActive.

extent
RegionData's extent property is an Extent used to determine if a Region's bounding box is in view. This property is accessed by calling getExtent and setExtent. May be null.

sector
RegionData's sector property is a Sector used to determine if Regions with an altitudeMode of clampToGround are in view. Accessed by calling getSector and setSector. When a Region's altitudeMode is clampToGround, the Region's sector can be used to determine visibility because the Region is defined to be on the Globe's surface.

points
RegionData's points property indicates a list of model-coordinate points representing the corners and interior of the Region. These points are used to determine the distance between the Region and the View's eye point. If the Region has altitude mode of clampToGround, this list must contain five points: the model-coordinate points of the Region's four corners and center point on the surface terrain.


Field Summary
protected  long activeFrameNumber
          Identifies the frame used to determine if this entry's Region is active.
protected  int altitudeMode
          Indicates the vertical datum against which the altitudes values in this entry's Region are interpreted.
protected  long frameNumber
          Identifies the frame used to calculate this entry's values.
protected  boolean isActive
          Identifies whether this entry's Region is active.
protected  List<Vec4> points
          Indicates the model-coordinate points representing the corners and interior of this entry's Region.
protected  Sector sector
          Indicates the Sector used to determine if a Region who's altitudeMode is clampToGround is visible.
 
Fields inherited from class gov.nasa.worldwind.cache.ShapeDataCache.ShapeDataCacheEntry
extent, eyeDistance, globeStateKey, lastUsed, timer, verticalExaggeration
 
Constructor Summary
KMLRegion.RegionData(DrawContext dc, long minExpiryTime, long maxExpiryTime)
          Constructs a new RegionData entry from the Globe and vertical exaggeration of a specified draw context.
 
Method Summary
 long getActiveFrameNumber()
          Identifies the frame used to determine if this entry's Region is active.
 int getAltitudeMode()
          Indicates the vertical datum against which the altitudes values in this entry's Region are interpreted.
 long getFrameNumber()
          Identifies the frame used to calculate this entry's values.
 List<Vec4> getPoints()
          Indicates the model-coordinate points representing the corners and interior of this entry's Region.
 Sector getSector()
          Indicates the Sector used to determine if a Region who's altitudeMode is clampToGround is visible.
 boolean isActive()
          Indicates whether this entry's Region is active.
 void setActive(boolean active)
          Specifies whether this entry's Region is active.
 void setActiveFrameNumber(long frameNumber)
          Specifies the frame used to determine if this entry's Region is active.
 void setAltitudeMode(int altitudeMode)
          Specifies the vertical datum against which the altitudes values in this entry's Region should be interpreted.
 void setFrameNumber(long frameNumber)
          Specifies the frame used to calculate this entry's values.
 void setPoints(List<Vec4> points)
          Specifies the model-coordinate points representing the corners and interior of this entry's Region.
 void setSector(Sector sector)
          Specifies the Sector that defines a Region's surface sector on the Globe.
 
Methods inherited from class gov.nasa.worldwind.cache.ShapeDataCache.ShapeDataCacheEntry
getExtent, getEyeDistance, getGlobeStateKey, getTimer, getVerticalExaggeration, isExpired, isValid, restartTimer, setExpired, setExtent, setEyeDistance, setGlobeStateKey, setTimer, setVerticalExaggeration
 
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
 

Field Detail

activeFrameNumber

protected long activeFrameNumber
Identifies the frame used to determine if this entry's Region is active. Initially -1.


altitudeMode

protected int altitudeMode
Indicates the vertical datum against which the altitudes values in this entry's Region are interpreted. One of WorldWind.ABSOLUTE, WorldWind.CLAMP_TO_GROUND, or WorldWind.RELATIVE_TO_GROUND. Initially -1.


frameNumber

protected long frameNumber
Identifies the frame used to calculate this entry's values. Initially -1.


isActive

protected boolean isActive
Identifies whether this entry's Region is active. Initially false.


points

protected List<Vec4> points
Indicates the model-coordinate points representing the corners and interior of this entry's Region. These points are used to determine the distance between this entry's Region and the View's eye point. Initially null.


sector

protected Sector sector
Indicates the Sector used to determine if a Region who's altitudeMode is clampToGround is visible. Initially null.

Constructor Detail

KMLRegion.RegionData

public KMLRegion.RegionData(DrawContext dc,
                            long minExpiryTime,
                            long maxExpiryTime)
Constructs a new RegionData entry from the Globe and vertical exaggeration of a specified draw context.

Parameters:
dc - the draw context. Must contain a Globe.
minExpiryTime - the minimum expiration duration, in milliseconds.
maxExpiryTime - the maximum expiration duration, in milliseconds.
Method Detail

getActiveFrameNumber

public long getActiveFrameNumber()
Identifies the frame used to determine if this entry's Region is active.

Returns:
the frame used to determine if this entry's Region is active.

getAltitudeMode

public int getAltitudeMode()
Indicates the vertical datum against which the altitudes values in this entry's Region are interpreted.

Returns:
the altitude mode of this entry's Region. One of WorldWind.ABSOLUTE, WorldWind.CLAMP_TO_GROUND, or WorldWind.RELATIVE_TO_GROUND.

getFrameNumber

public long getFrameNumber()
Identifies the frame used to calculate this entry's values.

Returns:
the frame used to calculate this entry's values.

getPoints

public List<Vec4> getPoints()
Indicates the model-coordinate points representing the corners and interior of this entry's Region. This returns null if this entry's Region has no geographic bounding box.

Returns:
the points representing the corners and interior of this entry's Region, or null if the Region has no bounding box.

getSector

public Sector getSector()
Indicates the Sector used to determine if a Region who's altitudeMode is clampToGround is visible. This returns null if this entry's Region's has no geographic bounding box.

Returns:
the Sector used to determine if a Region is visible, or null to specify that this entry's Region has no bounding box.

isActive

public boolean isActive()
Indicates whether this entry's Region is active.

Returns:
true if this entry's Region is active, otherwise false.

setActive

public void setActive(boolean active)
Specifies whether this entry's Region is active.

Parameters:
active - true to specify that this entry's Region is active, otherwise false.

setActiveFrameNumber

public void setActiveFrameNumber(long frameNumber)
Specifies the frame used to determine if this entry's Region is active.

Parameters:
frameNumber - the frame used to determine if this entry's Region is active.

setAltitudeMode

public void setAltitudeMode(int altitudeMode)
Specifies the vertical datum against which the altitudes values in this entry's Region should be interpreted. Must be one of WorldWind.ABSOLUTE, WorldWind.CLAMP_TO_GROUND, or WorldWind.RELATIVE_TO_GROUND.

Parameters:
altitudeMode - the vertical datum to use.

setFrameNumber

public void setFrameNumber(long frameNumber)
Specifies the frame used to calculate this entry's values.

Parameters:
frameNumber - the frame used to calculate this entry's values.

setPoints

public void setPoints(List<Vec4> points)
Specifies the model-coordinate points representing the corners and interior of this entry's Region. These points are used to determine the distance between this entry's Region and the View's eye point. Specify null to indicate that this entry' Region has no geographic bounding box.

If this entry's Region has altitude mode clampToGround, this list must contain five points: the model-coordinate points of the Region's four corners and center point on the surface terrain.

Parameters:
points - the points representing the corners and interior of this entry's Region, or null to specify that this entry's Region has no bounding box.

setSector

public void setSector(Sector sector)
Specifies the Sector that defines a Region's surface sector on the Globe. Specify null to indicate that this entry' Region has no geographic bounding box.

Parameters:
sector - the Sector that is used to determine if a clampToGround Region is visible, or null to specify that the entry's Region's has no bounding box.

NASA World Wind