|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgov.nasa.worldwind.avlist.AVListImpl
gov.nasa.worldwind.WWObjectImpl
gov.nasa.worldwind.terrain.HighResolutionTerrain
public class HighResolutionTerrain
Provides operations on the best available terrain. Operations such as line/terrain intersection and surface point computation use the highest resolution terrain data available from the globe's elevation model. Because the best available data may not be available when the operations are performed, the operations block while they retrieve the required data from either the local disk cache or a remote server. A timeout may be specified to limit the amount of time allowed for retrieving data. Operations fail if the timeout is exceeded.
| Nested Class Summary | |
|---|---|
static interface |
HighResolutionTerrain.IntersectionCallback
Defines an interface for returning computed intersections. |
protected static class |
HighResolutionTerrain.RectTile
Defines an internal terrain tile. |
protected static class |
HighResolutionTerrain.RenderInfo
Holds a tile's geometry. |
| Field Summary | |
|---|---|
protected static long |
DEFAULT_CACHE_CAPACITY
|
protected static int |
DEFAULT_DENSITY
|
protected int |
density
|
protected MemoryCache |
geometryCache
|
protected Globe |
globe
|
protected double |
latTileSize
|
protected double |
lonTileSize
|
protected int |
numCols
|
protected int |
numRows
|
protected Sector |
sector
|
protected ThreadLocal<Long> |
startTime
|
protected double |
targetResolution
|
protected MemoryCache |
tileCache
|
protected Long |
timeout
|
protected double |
verticalExaggeration
|
| Constructor Summary | |
|---|---|
HighResolutionTerrain(Globe globe,
Double targetResolution)
Constructs a terrain object for a specified globe. |
|
HighResolutionTerrain(Globe globe,
Sector sector,
Double targetResolution,
Double verticalExaggeration)
Constructs a terrain object for a specified sector of a specified globe. |
|
| Method Summary | |
|---|---|
protected Vec4 |
applyOffset(Vec4 point,
double metersOffset)
Applies a specified vertical offset to a surface point. |
protected HighResolutionTerrain.RenderInfo |
buildVerts(HighResolutionTerrain.RectTile tile)
Computes a terrain tile's vertices. |
void |
cacheIntersectingTiles(Position pA,
Position pB)
Cause the tiles used by subsequent intersection calculations to be cached so that they are available immediately to those subsequent calculations. |
void |
cacheIntersectingTiles(Sector sector)
Cause the tiles used by subsequent intersection calculations to be cached so that they are available immediately to those subsequent calculations. |
protected int |
computeColumn(Sector range,
Angle longitude)
Computes the column index corresponding to a specified latitude. |
protected void |
computeDimensions()
Computes the row and column dimensions of the tile array. |
protected ArrayList<LatLon> |
computeLocations(HighResolutionTerrain.RectTile tile)
Computes the tile's cell locations, determined by the tile's density and sector. |
protected int |
computeRow(Sector range,
Angle latitude)
Computes the row index corresponding to a specified latitude. |
protected void |
convertPointsToPositions(List<Vec4[]> points,
List<Position[]> positions)
|
protected static double |
createPosition(int start,
double decimal,
int density)
|
protected HighResolutionTerrain.RectTile |
createTile(int row,
int col)
Creates a tile for a specified row and column of the tile array. |
protected HighResolutionTerrain.RectTile |
createTile(Sector tileSector)
Creates the tile for a specified sector. |
protected Intersection[] |
doIntersect(Position pA,
Position pB)
Computes intersections of a line with the terrain. |
protected List<HighResolutionTerrain.RectTile> |
eliminateLowAltitudeTiles(List<HighResolutionTerrain.RectTile> tiles,
double minAltitude)
|
long |
getCacheCapacity()
Indicates the current cache capacity. |
double |
getCacheUsage()
Indicates the proportion of the cache currently used. |
protected HighResolutionTerrain.RectTile |
getContainingTile(Angle latitude,
Angle longitude)
Determines the tile that contains a specified location. |
int |
getDensity()
|
Double |
getElevation(LatLon location)
Computes the elevation at a specified location. |
protected double |
getElevations(Sector sector,
List<LatLon> latlons,
double targetResolution,
double[] elevations)
|
Position[] |
getExtremeElevations(LatLon center,
double width,
double height)
Determines the minimum and maximum elevations and their locations within a specified geographic quadrilateral. |
Position[] |
getExtremeElevations(Sector sector)
Determines the minimum and maximum elevations and their locations within a specified Sector. |
Globe |
getGlobe()
Returns the object's globe. |
protected Set<HighResolutionTerrain.RectTile> |
getIntersectingTiles(LatLon pA,
LatLon pB)
Determines and creates the terrain tiles intersected by a specified line. |
protected List<HighResolutionTerrain.RectTile> |
getIntersectingTiles(Sector sector)
|
List<Sector> |
getIntersectionTiles(Position pA,
Position pB)
|
int |
getNumCacheEntries()
Returns the number of entries currently in the cache. |
Sector |
getSector()
Returns the object's sector. |
Vec4 |
getSurfacePoint(Angle latitude,
Angle longitude,
double metersOffset)
Computes the Cartesian, model-coordinate point of a location on the terrain. |
protected Vec4 |
getSurfacePoint(HighResolutionTerrain.RectTile tile,
Angle latitude,
Angle longitude)
Computes the Cartesian, model-coordinate point of a location within a terrain tile. |
protected Vec4 |
getSurfacePoint(HighResolutionTerrain.RectTile tile,
Angle latitude,
Angle longitude,
double metersOffset)
Computes the Cartesian, model-coordinate point of a location within a terrain tile. |
Vec4 |
getSurfacePoint(Position position)
Computes the Cartesian, model-coordinate point of a position on the terrain. |
double |
getTargetResolution()
|
Long |
getTimeout()
Indicates the current timeout for operations requiring terrain data retrieval. |
double |
getVerticalExaggeration()
Indicates the vertical exaggeration used when performing terrain operations. |
protected static Vec4 |
interpolate(int row,
int column,
double xDec,
double yDec,
HighResolutionTerrain.RenderInfo ri)
|
protected static Vec4 |
interpolate(Vec4 bL,
Vec4 bR,
Vec4 tR,
Vec4 tL,
double xDec,
double yDec)
|
protected Intersection[] |
intersect(HighResolutionTerrain.RectTile tile,
Line line)
Computes the intersections of a line with a tile. |
protected List<Vec4[]> |
intersect(HighResolutionTerrain.RectTile tile,
Vec4[] triangle)
Computes the intersection of a triangle with a terrain tile. |
Intersection[] |
intersect(Line line)
Intersect a line with the terrain. |
void |
intersect(List<Position> positions,
HighResolutionTerrain.IntersectionCallback callback)
Intersects a specified list of geographic two-position lines with the terrain. |
Intersection[] |
intersect(Position pA,
Position pB)
Computes the intersections of a line with the terrain. |
Intersection[] |
intersect(Position pA,
Position pB,
int altitudeMode)
Computes the intersections of a line with the terrain. |
void |
intersectTriangle(Vec4[] triangleCoordinates,
Position[] trianglePositions,
List<Position[]> intersectPositionsOut)
Intersects a specified triangle with the terrain. |
protected void |
makeVerts(HighResolutionTerrain.RectTile tile)
Computes a terrain tile's vertices of draws them from the cache. |
void |
setCacheCapacity(long size)
Specifies the cache capacity. |
void |
setDensity(int density)
Specifies the number of intervals within a single terrain tile. |
void |
setTimeout(Long timeout)
Specifies the maximum amount of time allowed for retrieval of all terrain data necessary to satisfy an operation. |
| 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, 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 |
|---|
protected static final long DEFAULT_CACHE_CAPACITY
protected static final int DEFAULT_DENSITY
protected int density
protected MemoryCache geometryCache
protected Globe globe
protected double latTileSize
protected double lonTileSize
protected int numCols
protected int numRows
protected Sector sector
protected ThreadLocal<Long> startTime
protected double targetResolution
protected MemoryCache tileCache
protected Long timeout
protected double verticalExaggeration
| Constructor Detail |
|---|
public HighResolutionTerrain(Globe globe,
Double targetResolution)
globe - the terrain's globe.targetResolution - the target terrain resolution, in meters, or null to use the globe's highest resolution.
IllegalArgumentException - if the globe is null.
public HighResolutionTerrain(Globe globe,
Sector sector,
Double targetResolution,
Double verticalExaggeration)
globe - the terrain's globe.sector - the desired range for the terrain. Only locations within this sector may be used in
operations. If null, the sector spans the entire globe.targetResolution - the target terrain resolution, in meters, or null to use the globe's highest
resolution.verticalExaggeration - the vertical exaggeration to apply to terrain elevations. Null indicates no
exaggeration.
IllegalArgumentException - if the globe is null.| Method Detail |
|---|
protected Vec4 applyOffset(Vec4 point,
double metersOffset)
point - the surface point.metersOffset - the vertical offset to add to the point.
protected HighResolutionTerrain.RenderInfo buildVerts(HighResolutionTerrain.RectTile tile)
throws InterruptedException
tile - the tile to compute vertices for
InterruptedException - if the operation is interrupted.
WWTimeoutException - if terrain data retrieval exceeds the current timeout.
public void cacheIntersectingTiles(Position pA,
Position pB)
throws InterruptedException
pA - the line's first position.pB - the line's second position.
IllegalArgumentException - if either position is null.
InterruptedException - if the operation is interrupted. if the current timeout is exceeded while
retrieving terrain data.
public void cacheIntersectingTiles(Sector sector)
throws InterruptedException
sector - the sector for which to cache elevation data.
IllegalArgumentException - if the specified sector is null.
InterruptedException - if the operation is interrupted. if the current timeout is exceeded while
retrieving terrain data.
protected int computeColumn(Sector range,
Angle longitude)
range - the reference sector, typically that of this terrain instance.longitude - the latitude in question.
protected void computeDimensions()
protected ArrayList<LatLon> computeLocations(HighResolutionTerrain.RectTile tile)
tile - the tile to compute locations for.
protected int computeRow(Sector range,
Angle latitude)
range - the reference sector, typically that of this terrain instance.latitude - the latitude in question.
protected void convertPointsToPositions(List<Vec4[]> points,
List<Position[]> positions)
protected static double createPosition(int start,
double decimal,
int density)
protected HighResolutionTerrain.RectTile createTile(int row,
int col)
row - the tile's 0-origin row index.col - the tile's 0-origin column index.
protected HighResolutionTerrain.RectTile createTile(Sector tileSector)
tileSector - the sector for which to create the tile.
protected Intersection[] doIntersect(Position pA,
Position pB)
throws InterruptedException
pA - the line's first position.pB - the line's second position.
InterruptedException - if the operation is interrupted.
protected List<HighResolutionTerrain.RectTile> eliminateLowAltitudeTiles(List<HighResolutionTerrain.RectTile> tiles,
double minAltitude)
throws InterruptedException
InterruptedExceptionpublic long getCacheCapacity()
public double getCacheUsage()
protected HighResolutionTerrain.RectTile getContainingTile(Angle latitude,
Angle longitude)
latitude - the location's latitude.longitude - the location's longitude.
public int getDensity()
public Double getElevation(LatLon location)
WWTimeoutException if a timeout has been
specified and it is exceeded during the operation.
getElevation in interface Terrainlocation - the location at which to compute the elevation.
protected double getElevations(Sector sector,
List<LatLon> latlons,
double targetResolution,
double[] elevations)
throws InterruptedException
InterruptedException
public Position[] getExtremeElevations(LatLon center,
double width,
double height)
throws InterruptedException
center - The quadrilateral's center.width - The quadrilateral's longitudinal width, in meters.height - The quadrilateral's latitudinal height, in meters.
InterruptedException - if the operation is interrupted before it completes.
public Position[] getExtremeElevations(Sector sector)
throws InterruptedException
Sector.
sector - The sector in question.
InterruptedException - if the operation is interrupted before it completes.public Globe getGlobe()
getGlobe in interface Terrain
protected Set<HighResolutionTerrain.RectTile> getIntersectingTiles(LatLon pA,
LatLon pB)
pA - the line's first position.pB - the line's second position.
protected List<HighResolutionTerrain.RectTile> getIntersectingTiles(Sector sector)
public List<Sector> getIntersectionTiles(Position pA,
Position pB)
public int getNumCacheEntries()
public Sector getSector()
public Vec4 getSurfacePoint(Angle latitude,
Angle longitude,
double metersOffset)
WWTimeoutException if a timeout has been
specified and it is exceeded during the operation.
getSurfacePoint in interface Terrainlatitude - the location's latitude.longitude - the location's longitude.metersOffset - the location's distance above the terrain.
protected Vec4 getSurfacePoint(HighResolutionTerrain.RectTile tile,
Angle latitude,
Angle longitude)
throws InterruptedException
WWTimeoutException if a timeout has been
specified and it is exceeded during the operation.
tile - the terrain tile.latitude - the location's latitude.longitude - the location's longitude.
IllegalArgumentException - if the latitude or longitude are null.
WWTimeoutException - if the current timeout is exceeded while retrieving terrain data.
InterruptedException - if the operation is interrupted.setTimeout(Long)
protected Vec4 getSurfacePoint(HighResolutionTerrain.RectTile tile,
Angle latitude,
Angle longitude,
double metersOffset)
throws InterruptedException
WWTimeoutException if a timeout has been
specified and it is exceeded during the operation.
tile - the terrain tile.latitude - the location's latitude.longitude - the location's longitude.metersOffset - the location's distance above the terrain.
IllegalArgumentException - if the latitude or longitude are null.
WWTimeoutException - if the current timeout is exceeded while retrieving terrain data.
InterruptedException - if the operation is interrupted.setTimeout(Long)public Vec4 getSurfacePoint(Position position)
WWTimeoutException if a timeout has been
specified and it is exceeded during the operation.
getSurfacePoint in interface Terrainposition - the position.
public double getTargetResolution()
public Long getTimeout()
setTimeout(Long)public double getVerticalExaggeration()
getVerticalExaggeration in interface Terrain
protected static Vec4 interpolate(int row,
int column,
double xDec,
double yDec,
HighResolutionTerrain.RenderInfo ri)
protected static Vec4 interpolate(Vec4 bL,
Vec4 bR,
Vec4 tR,
Vec4 tL,
double xDec,
double yDec)
protected Intersection[] intersect(HighResolutionTerrain.RectTile tile,
Line line)
throws InterruptedException
tile - the tile.line - the line.
InterruptedException - if the operation is interrupted.
protected List<Vec4[]> intersect(HighResolutionTerrain.RectTile tile,
Vec4[] triangle)
throws InterruptedException
tile - the terrain tiletriangle - the Cartesian coordinates of the triangle.
InterruptedException - if the operation is interrupted before it completes.public Intersection[] intersect(Line line)
line - the line to intersect
public void intersect(List<Position> positions,
HighResolutionTerrain.IntersectionCallback callback)
throws InterruptedException
positions - The positions to intersect, with the line segments formed by each pair of positions, e.g. the
first line in formed by positions[0] and positions[1], the second by positions[2] and
positions[3], etc.callback - An object to call in order to return the computed intersections.
InterruptedException
public Intersection[] intersect(Position pA,
Position pB)
WWTimeoutException if a timeout has been
specified and it is exceeded during the operation.
intersect in interface TerrainpA - the line's first position.pB - the line's second position.
public Intersection[] intersect(Position pA,
Position pB,
int altitudeMode)
WWTimeoutException if a timeout has been
specified and it is exceeded during the operation.
intersect in interface TerrainpA - the line's first position.pB - the line's second position.altitudeMode - the altitude mode indicating the reference for the altitudes in the specified positions.
public void intersectTriangle(Vec4[] triangleCoordinates,
Position[] trianglePositions,
List<Position[]> intersectPositionsOut)
throws InterruptedException
triangleCoordinates - The Cartesian coordinates of the triangle.trianglePositions - The geographic coordinates of the triangle.intersectPositionsOut - A list in which to place the intersection positions. May not be null.
InterruptedException - if the operation is interrupted before it completes.
protected void makeVerts(HighResolutionTerrain.RectTile tile)
throws InterruptedException
tile - the tile to compute vertices for
InterruptedException - if the operation is interrupted.
WWTimeoutException - if terrain data retrieval exceeds the current timeout.public void setCacheCapacity(long size)
size - the cache capacity, in bytes. Values less than 1 MB are clamped to 1 MB.public void setDensity(int density)
density - the number of intervals used to form a terrain tile.public void setTimeout(Long timeout)
WWTimeoutException if the specified
timeout is exceeded.
timeout - the number of milliseconds to wait. May be null, to indicate that operations have unlimited amount
of time to operate.
|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||