public class RasterTerrainCache extends TerrainCache
RasterTerrainProvider
.Constructor and Description |
---|
RasterTerrainCache(RasterTerrainProvider provider)
Initializes a new instance.
|
Modifier and Type | Method and Description |
---|---|
RasterTerrainIndexExtent |
getCacheRegionContainingPoint(double longitude,
double latitude)
Gets the extents of the cache region that contains a specified longitude and latitude.
|
int |
getCacheTileSize()
Gets the size, in posts, of a terrain region in the cache.
|
TerrainRegion |
getLeastRecentlyUsedRegion()
Gets the region in this cache that was least recently used.
|
TerrainPosts |
getPosts(double longitude,
double latitude)
Gets the collection of posts containing a specified longitude and latitude.
|
long |
getSize()
Gets the approximate total memory, in bytes, used by all regions in the cache.
|
void |
loadRegion(TerrainRegion region)
Deprecated.
Internal use only.
|
void |
preloadExtent(CartographicExtent extent)
Loads the terrain data in a given extent into the terrain cache.
|
void |
removeRegion(TerrainRegion region)
Deprecated.
Internal use only.
|
void |
setCacheTileSize(int value)
Sets the size, in posts, of a terrain region in the cache.
|
void |
unloadExtent(CartographicExtent extent)
Unloads the cached terrain data for a given extent.
|
getGroup
public RasterTerrainCache(@Nonnull RasterTerrainProvider provider)
provider
- The terrain provider associated with this cache.ArgumentNullException
- Thrown when provider
is null
.public void removeRegion(TerrainRegion region)
removeRegion
in class TerrainCache
region
- The region to remove.ArgumentNullException
- Thrown when region
is null
.public void loadRegion(TerrainRegion region)
loadRegion
in class TerrainCache
region
- The region to load.ArgumentNullException
- Thrown when region
is null
.public final int getCacheTileSize()
RasterTerrainProviders
set this to their
natural tile size during construction in order to improve read performance.
It cannot be set after the cache is used for the first time. Because adjacent
cache blocks share rows or columns of posts, the actual number of posts requested from the terrain
provider will be one post greater than this number in each direction. For example, if the tile size
is 1200, a westernmost cache block will cover posts 0 through 1200 (inclusive, for a total of 1201 posts)
in the longitude direction. The next cache block to the east will cover posts 1200 through 2400 (1201
posts again).public final void setCacheTileSize(int value)
RasterTerrainProviders
set this to their
natural tile size during construction in order to improve read performance.
It cannot be set after the cache is used for the first time. Because adjacent
cache blocks share rows or columns of posts, the actual number of posts requested from the terrain
provider will be one post greater than this number in each direction. For example, if the tile size
is 1200, a westernmost cache block will cover posts 0 through 1200 (inclusive, for a total of 1201 posts)
in the longitude direction. The next cache block to the east will cover posts 1200 through 2400 (1201
posts again).public long getSize()
getSize
in class TerrainCache
public TerrainRegion getLeastRecentlyUsedRegion()
getLeastRecentlyUsedRegion
in class TerrainCache
public final TerrainPosts getPosts(double longitude, double latitude)
TerrainCacheGroup
thread.longitude
- The required longitude.latitude
- The required latitude.@Nonnull public final RasterTerrainIndexExtent getCacheRegionContainingPoint(double longitude, double latitude)
longitude
- The longitude of interest.latitude
- The latitude of interest.public final void preloadExtent(@Nonnull CartographicExtent extent)
TerrainCacheGroup's
MaximumSize
(get
/ set
). Furthermore, the loaded terrain data is locked
in memory (meaning it will not be unloaded) until the user calls RasterTerrainCache.unloadExtent(agi.foundation.coordinates.CartographicExtent)
.
This method is safe to call from any thread.extent
- The extent for which to load terrain data, in the native units of the terrain provider.ArgumentNullException
- Thrown when extent
is null
.public final void unloadExtent(@Nonnull CartographicExtent extent)
extent
- The extent for which to unload terrain, in the native units of the terrain provider.ArgumentNullException
- Thrown when extent
is null
.