public abstract class QuantizedMeshTerrainProvider extends TerrainProvider
TerrainProvider
which reads data from a quadtree of quantized-mesh terrain tiles.
See the quantized-mesh
specification for more details on the quantized-mesh format.Modifier | Constructor and Description |
---|---|
protected |
QuantizedMeshTerrainProvider(QuantizedMeshTilesetMetadata metadata)
Initializes a new instance as a member of the default
TerrainCacheGroup . |
protected |
QuantizedMeshTerrainProvider(QuantizedMeshTilesetMetadata metadata,
TerrainCacheGroup cacheGroup)
Initializes a new instance.
|
Modifier and Type | Method and Description |
---|---|
QuantizedMeshTileCoordinateExtent |
extentToCoordinateExtent(int level,
CartographicExtent extent)
Gets a
QuantizedMeshTileCoordinateExtent which contains a given CartographicExtent . |
QuantizedMeshTileID |
findMostDetailedAvailableTile(int level,
int x,
int y)
Find the most detailed tile that is available and which overlaps the given tile coordinates.
|
QuantizedMeshTerrainCache |
getCache()
Gets the cache for this terrain provider.
|
TerrainInterpolator<QuantizedMeshTerrainTile> |
getDefaultInterpolator()
Gets the default interpolator to use to interpolate heights
when a specific interpolator is not specified in the call to
QuantizedMeshTerrainProvider.getHeight(double,double)
or QuantizedMeshTerrainProvider.getHeightNativeUnits(double,double) . |
FirstPartialsOfHeight |
getFirstPartials(double longitude,
double latitude)
|
FirstPartialsOfHeight |
getFirstPartials(double longitude,
double latitude,
TerrainInterpolator<QuantizedMeshTerrainTile> interpolator)
|
double |
getHeight(double longitude,
double latitude)
Gets the interpolated height of the terrain at the specified longitude and latitude using the
default interpolator for this terrain provider.
|
double |
getHeight(double longitude,
double latitude,
TerrainInterpolator<QuantizedMeshTerrainTile> interpolator)
Gets the interpolated height of the terrain at the specified longitude and latitude using the
specified
TerrainInterpolator . |
double |
getHeightNativeUnits(double longitude,
double latitude)
Gets the interpolated height of the terrain at the specified longitude and latitude.
|
double |
getLocalMinimumSampleSpacing(double longitude,
double latitude)
Gets the smallest distance between the successive height samples of the terrain data, in radians, at the specified coordinates.
|
int |
getMaximumLevel()
Gets the maximum zoom level.
|
abstract QuantizedMeshTerrainTile |
getMesh(int level,
int x,
int y)
Gets a mesh for a specified set of coordinates.
|
QuantizedMeshTilesetMetadata |
getMetadata()
Gets the metadata for this tileset.
|
double |
getMinimumSampleSpacing()
Gets the smallest distance between the successive height samples of the terrain data, in radians.
|
static int |
getNumberOfXTilesAtLevel(int level)
Gets the number of tiles in the X direction at a given zoom level.
|
static int |
getNumberOfYTilesAtLevel(int level)
Gets the number of tiles in the Y direction at a given zoom level.
|
SecondPartialsOfHeight |
getSecondPartials(double longitude,
double latitude)
|
SecondPartialsOfHeight |
getSecondPartials(double longitude,
double latitude,
TerrainInterpolator<QuantizedMeshTerrainTile> interpolator)
|
int |
getZoomLevel()
Gets the zoom level to request tiles at.
|
boolean |
isTileAvailable(int level,
int x,
int y)
Determines whether a tile with the given tile coordinates is available.
|
static int |
latitudeToYTileCoordinate(int level,
double latitude)
Gets the Y tile coordinate for a given latitude.
|
static int |
longitudeToXTileCoordinate(int level,
double longitude)
Gets the X tile coordinate for a given longitude.
|
void |
preloadExtent(CartographicExtent extent)
Loads the terrain data in a given
CartographicExtent into the terrain cache. |
void |
setDefaultInterpolator(TerrainInterpolator<QuantizedMeshTerrainTile> value)
Sets the default interpolator to use to interpolate heights
when a specific interpolator is not specified in the call to
QuantizedMeshTerrainProvider.getHeight(double,double)
or QuantizedMeshTerrainProvider.getHeightNativeUnits(double,double) . |
void |
setZoomLevel(int value)
Sets the zoom level to request tiles at.
|
static CartographicExtent |
tileCoordinatesToExtent(int level,
int x,
int y)
Gets the bounding extent of a tile with the given tile coordinates.
|
void |
unloadExtent(CartographicExtent extent)
Unloads the cached terrain data for a given
CartographicExtent . |
static void |
validateTileCoordinates(int level,
int x,
int y)
Determines whether the given tile coordinates are valid, that is, whether
the coordinates define a tile that could possibly exist, and throws an
ArgumentOutOfRangeException if one of the coordinates is invalid. |
getBoundingExtent, getBoundingExtentNativeUnits, getGradient, getHeightReference, getHeightRelativeToShape, getHessian, getNativeToMeters, getNormal, getRadiansToNative, getReferenceSurface, getShape, getShapeFixedFrame, inGlobalBounds, setBoundingExtent, setBoundingExtentNativeUnits, setHeightReference, setNativeToMeters, setRadiansToNative, setReferenceSurface, setShape, setShapeFixedFrame
protected QuantizedMeshTerrainProvider(@Nonnull QuantizedMeshTilesetMetadata metadata)
TerrainCacheGroup
.metadata
- The metadata for the tileset.protected QuantizedMeshTerrainProvider(@Nonnull QuantizedMeshTilesetMetadata metadata, @Nonnull TerrainCacheGroup cacheGroup)
metadata
- The metadata for the tileset.cacheGroup
- The cache group of which this provider is a member.ArgumentNullException
- Thrown when metadata
or cacheGroup
is null
.@Nonnull public final QuantizedMeshTerrainCache getCache()
public final TerrainInterpolator<QuantizedMeshTerrainTile> getDefaultInterpolator()
QuantizedMeshTerrainProvider.getHeight(double,double)
or QuantizedMeshTerrainProvider.getHeightNativeUnits(double,double)
.public final void setDefaultInterpolator(TerrainInterpolator<QuantizedMeshTerrainTile> value)
QuantizedMeshTerrainProvider.getHeight(double,double)
or QuantizedMeshTerrainProvider.getHeightNativeUnits(double,double)
.public double getMinimumSampleSpacing()
getMinimumSampleSpacing
in class TerrainProvider
public double getLocalMinimumSampleSpacing(double longitude, double latitude)
getLocalMinimumSampleSpacing
in class TerrainProvider
longitude
- The longitude, in radians.latitude
- The latitude, in radians.public double getHeight(double longitude, double latitude)
If HeightReference
(get
/ set
) is HeightReference.REFERENCE_SURFACE
,
the returned height is relative to the surface specified by the ReferenceSurface
(get
/ set
) property.
If HeightReference
(get
/ set
) is HeightReference.SHAPE
,
the returned height is relative to the ellipsoid specified by the Shape
(get
/ set
) property.
This method may return Double.NaN
if the requested longitude and latitude are outside
the terrain region or if the terrain data indicates that the height is unknown.
It is safe to call this method from multiple threads simultaneously.
getHeight
in class TerrainProvider
longitude
- The longitude, in radians.
Requesting a height for a longitude less than -π or greater than π will always return Double.NaN
.latitude
- The latitude, in radians.
Requesting a height for a latitude less than -π/2 or greater than π/2 will always return Double.NaN
.Double.NaN
if the height is not available at the requested longitude and latitude.public final double getHeight(double longitude, double latitude, TerrainInterpolator<QuantizedMeshTerrainTile> interpolator)
TerrainInterpolator
.
The returned height is relative to the ellipsoid specified by the Shape
(get
/ set
) property.
This method may return Double.NaN
if the requested longitude and latitude are outside
the terrain region or if the terrain data indicates that the height is unknown.
It is safe to call this method from multiple threads simultaneously.
longitude
- The longitude, in radians.
Requesting a height for a longitude less than -π or greater than π will always return Double.NaN
.latitude
- The latitude, in radians.
Requesting a height for a latitude less than -π/2 or greater than π/2 will always return Double.NaN
.interpolator
- The TerrainInterpolator
to use to interpolate heights.Double.NaN
if the height is not available at the requested longitude and latitude.public double getHeightNativeUnits(double longitude, double latitude)
If HeightReference
(get
/ set
) is HeightReference.REFERENCE_SURFACE
,
the returned height is relative to the surface specified by the ReferenceSurface
(get
/ set
) property.
If HeightReference
(get
/ set
) is HeightReference.SHAPE
,
the returned height is relative to the ellipsoid specified by the Shape
(get
/ set
) property.
This method may return Double.NaN
if the requested longitude and latitude are outside
the terrain region or if the terrain data indicates that the height is unknown.
It is safe to call this method from multiple threads simultaneously.
getHeightNativeUnits
in class TerrainProvider
longitude
- The longitude, in the native units of the terrain provider.latitude
- The latitude, in the native units of the terrain provider.Double.NaN
if the height is not available at the requested longitude and latitude.@Nonnull public FirstPartialsOfHeight getFirstPartials(double longitude, double latitude)
Shape
(get
/ set
).getFirstPartials
in class TerrainProvider
longitude
- The longitude, in radians.
Requesting derivatives for a longitude less than -π or greater than π will always return Double.NaN
.latitude
- The latitude, in radians.
Requesting derivatives for a latitude less than -π/2 or greater than π/2 will always return Double.NaN
.FirstPartialsOfHeight
with respect to longitude and latitude,
in meters of height per radian.@Nonnull public final FirstPartialsOfHeight getFirstPartials(double longitude, double latitude, TerrainInterpolator<QuantizedMeshTerrainTile> interpolator)
Shape
(get
/ set
).longitude
- The longitude, in radians.
Requesting derivatives for a longitude less than -π or greater than π will always return Double.NaN
.latitude
- The latitude, in radians.
Requesting derivatives for a latitude less than -π/2 or greater than π/2 will always return Double.NaN
.interpolator
- The interpolator to use when computing the value of the partial derivatives inside the boundary.FirstPartialsOfHeight
with respect to longitude and latitude,
in meters of height per radian.@Nonnull public SecondPartialsOfHeight getSecondPartials(double longitude, double latitude)
Shape
(get
/ set
).getSecondPartials
in class TerrainProvider
longitude
- The longitude, in radians.
Requesting derivatives for a longitude less than -π or greater than π will always return Double.NaN
.latitude
- The latitude, in radians.
Requesting derivatives for a latitude less than -π/2 or greater than π/2 will always return Double.NaN
.SecondPartialsOfHeight
with respect to longitude and latitude,
in meters of height per radian squared.@Nonnull public final SecondPartialsOfHeight getSecondPartials(double longitude, double latitude, TerrainInterpolator<QuantizedMeshTerrainTile> interpolator)
Shape
(get
/ set
).longitude
- The longitude, in radians.
Requesting derivatives for a longitude less than -π or greater than π will always return Double.NaN
.latitude
- The latitude, in radians.
Requesting derivatives for a latitude less than -π/2 or greater than π/2 will always return Double.NaN
.interpolator
- The interpolator to use when computing the value of the partial derivatives inside the boundary.SecondPartialsOfHeight
with respect to longitude and latitude,
in meters of height per radian squared.@Nonnull public abstract QuantizedMeshTerrainTile getMesh(int level, int x, int y)
level
- The zoom level.x
- The X tile coordinate.y
- The Y tile coordinate.DataUnavailableException
- Thrown when the requested tile does not exist.ArgumentOutOfRangeException
- Thrown when the tile coordinates are invalid.@Nonnull public final QuantizedMeshTileID findMostDetailedAvailableTile(int level, int x, int y)
level
- The zoom level.x
- The X tile coordinate.y
- The Y tile coordinate.ArgumentOutOfRangeException
- Thrown when the tile coordinates are invalid.public final boolean isTileAvailable(int level, int x, int y)
level
- The zoom level.x
- The X tile coordinate.y
- The Y tile coordinate.true
if the given tile exists; otherwise false
.ArgumentOutOfRangeException
- Thrown when the tile coordinates are invalid.public static void validateTileCoordinates(int level, int x, int y)
ArgumentOutOfRangeException
if one of the coordinates is invalid.
This method does not determine whether the tile actually exists.level
- The zoom level.x
- The X tile coordinate.y
- The Y tile coordinate.ArgumentOutOfRangeException
- Thrown when the tile coordinates are invalid.public static int getNumberOfXTilesAtLevel(int level)
level
- The zoom level.public static int getNumberOfYTilesAtLevel(int level)
level
- The zoom level.public static int longitudeToXTileCoordinate(int level, double longitude)
The X coordinate increases from west to east. That is, the origin is in the south-west.
level
- The zoom level.longitude
- The longitude.ArgumentOutOfRangeException
- Thrown when longitude
is outside the range -π to π.public static int latitudeToYTileCoordinate(int level, double latitude)
The Y coordinate increases from south to north. That is, the origin is in the south-west.
level
- The zoom level.latitude
- The latitude.ArgumentOutOfRangeException
- Thrown when latitude
is outside the range -π/2 to π/2.@Nonnull public static CartographicExtent tileCoordinatesToExtent(int level, int x, int y)
The X coordinate increases from west to east, and the Y coordinate increases from south to north. That is, the origin is in the south-west.
level
- The zoom level.x
- The X tile coordinate.y
- The Y tile coordinate.ArgumentOutOfRangeException
- Thrown when the tile coordinates are invalid.@Nonnull public final QuantizedMeshTileCoordinateExtent extentToCoordinateExtent(int level, @Nonnull CartographicExtent extent)
QuantizedMeshTileCoordinateExtent
which contains a given CartographicExtent
.level
- The zoom level.extent
- The extent.QuantizedMeshTileCoordinateExtent
of the smallest region within the bounding extent that contains
the given CartographicExtent
. If the extent is completely outside the bounding extent of the terrain,
then OutsideExtent
(get
) will be returned.
If the extent includes some regions outside the bounding extent of the terrain,
the coordinates will be clamped to the terrain's edges.ArgumentNullException
- Thrown when extent
is null
.public void preloadExtent(CartographicExtent extent)
CartographicExtent
into the terrain cache.
This method does not return until the terrain data is fully loaded. All terrain data within the extent is loaded into
memory, even if doing so would exceed the TerrainCacheGroup's
MaximumSize
(get
/ set
). Furthermore, the loaded terrain data is locked
in memory (meaning it will not be unloaded) until the user calls QuantizedMeshTerrainProvider.unloadExtent(agi.foundation.coordinates.CartographicExtent)
.
This method is safe to call from any thread.preloadExtent
in class TerrainProvider
extent
- The extent for which to load terrain data, in radians.ArgumentNullException
- Thrown when extent
is null
.public void unloadExtent(CartographicExtent extent)
CartographicExtent
.
This method unloads all cached regions where any part of the region falls within
the extent. It does not return until the regions have been unloaded. However,
if a region within the extent is being used in another thread while this method
is executing, the region may be reloaded immediately after this method unloads it.
This method is safe to call from any thread.unloadExtent
in class TerrainProvider
extent
- The CartographicExtent
for which to unload terrain, in radians.ArgumentNullException
- Thrown when extent
is null
.public final int getZoomLevel()
public final void setZoomLevel(int value)
public final int getMaximumLevel()
@Nonnull public final QuantizedMeshTilesetMetadata getMetadata()