public final class QuadTreeRasterModelBuilder extends Object implements AutoCloseable
The multi-level tile structure is defined by a reference and a number of levels where each level has a bounds and a number of columns and rows. The structure of the tiles is organized as follows:
(N,0,0)
on level N
is the top-left tile.
N
corresponds to a block of 2x2 tiles on level N+1
.
The IMultilevelTiledRasterDataRetriever
interface allows to load the tile data and it also allows to indicate that there is no data available for a tile. This allows to create low resolution overlays on high resolution data.
The following figure shows how such a multi-level tile structure looks like. Note that you can also define multi-level tiled structures that are not a quad-tree structure when using a MultilevelTiledRasterModelBuilder
.
This builder supports either imagery (RGBA) data or elevation data. The latter can be enabled by calling QuadTreeRasterModelBuilder#elevation
.
This article gives an example of how to use this class.
Constructor and Description |
---|
QuadTreeRasterModelBuilder(QuadTreeRasterModelBuilder other) |
Modifier and Type | Method and Description |
---|---|
QuadTreeRasterModelBuilder |
bounds(Bounds bounds)
Defines the extent of the raster data structure.
|
IRasterModel |
build()
Creates the raster model.
|
void |
close() |
QuadTreeRasterModelBuilder |
dataBounds(Bounds bounds)
Defines the extent of where actual data is a available.
|
QuadTreeRasterModelBuilder |
dataRetriever(IMultilevelTiledRasterDataRetriever dataRetriever)
Defines the implementation to be used to retrieve the raster tile data.
|
QuadTreeRasterModelBuilder |
elevation()
Marks this model as an elevation model.
|
QuadTreeRasterModelBuilder |
elevationNoDataValue(float noDataValue)
Sets a no-data value for elevation data.
|
QuadTreeRasterModelBuilder |
enableInvalidation()
Allows to create a raster model which can be invalidated.
|
protected void |
finalize() |
QuadTreeRasterModelBuilder |
level0ColumnCount(long colCount)
Defines the number of columns at the least detailed level.
|
QuadTreeRasterModelBuilder |
level0RowCount(long rowCount)
Defines the number of row at the least detailed level.
|
QuadTreeRasterModelBuilder |
levelCount(long levelCount)
Defines the number of detail levels.
|
QuadTreeRasterModelBuilder |
modelMetadata(ModelMetadata modelMetadata)
Defines the model metadata.
|
static QuadTreeRasterModelBuilder |
newBuilder()
Creates the builder class to create a raster model.
|
QuadTreeRasterModelBuilder |
reference(CoordinateReference modelReference)
Defines the reference in which the raster data is defined.
|
QuadTreeRasterModelBuilder |
samplingMode(RasterSamplingMode samplingMode)
Defines the sampling mode of the data.
|
QuadTreeRasterModelBuilder |
tileHeightPixels(long tileHeightPixels)
Defines the height in pixels for a single tile.
|
QuadTreeRasterModelBuilder |
tileWidthPixels(long tileWidthPixels)
Defines the width in pixels for a single tile.
|
public QuadTreeRasterModelBuilder(@NotNull QuadTreeRasterModelBuilder other)
public void close()
close
in interface AutoCloseable
@NotNull public static QuadTreeRasterModelBuilder newBuilder()
IRasterModel
.@NotNull public QuadTreeRasterModelBuilder reference(@NotNull CoordinateReference modelReference)
This information is mandatory.
modelReference
- the reference for the raster data. Cannot be null
.@NotNull public QuadTreeRasterModelBuilder level0RowCount(long rowCount)
This information is mandatory.
rowCount
- the number of tiles on the row of the least detailed level.@NotNull public QuadTreeRasterModelBuilder level0ColumnCount(long colCount)
This information is mandatory.
colCount
- the number of tiles on the column of the least detailed level.@NotNull public QuadTreeRasterModelBuilder levelCount(long levelCount)
This information is mandatory.
levelCount
- the number of detail levels.@NotNull public QuadTreeRasterModelBuilder tileWidthPixels(long tileWidthPixels)
This information is mandatory.
tileWidthPixels
- the width, in pixels, for a tile within the tiled structure.@NotNull public QuadTreeRasterModelBuilder tileHeightPixels(long tileHeightPixels)
This information is mandatory.
tileHeightPixels
- the height, in pixels, for a tile within the tiled structure.@NotNull public QuadTreeRasterModelBuilder bounds(@NotNull Bounds bounds)
This information is mandatory.
bounds
- the extent of the raster data structure.@NotNull public QuadTreeRasterModelBuilder dataBounds(@NotNull Bounds bounds)
This information is optional. If not defined the extent of the data is assumed to be based the entire structure.
bounds
- the extent of the 'actual' data.@NotNull public QuadTreeRasterModelBuilder samplingMode(@NotNull RasterSamplingMode samplingMode)
This information is optional. The default value is Area
.
samplingMode
- the sampling mode of the data.@NotNull public QuadTreeRasterModelBuilder modelMetadata(@NotNull ModelMetadata modelMetadata)
This information is mandatory.
modelMetadata
- the model metadata.@NotNull public QuadTreeRasterModelBuilder elevation()
If this method is called, the configured
IMultilevelTiledRasterDataRetriever
must return elevation data as well. See IMultilevelTiledRasterDataRetrieverCallback#onDataAvailable
and IMultilevelTiledRasterDataRetrieverCallback#onImageAvailable
for more information.
@NotNull public QuadTreeRasterModelBuilder elevationNoDataValue(float noDataValue)
When the provided elevation data in IMultilevelTiledRasterDataRetrieverCallback
contains this value, it is interpreted as a no-data value. This means that consumers of the data will have information that no data is available at that location, and that they can choose an appropriate fallback. For example when terrain is visualized, it can decide to fall back on other elevation data when it encounters a no-data elevation value.
This method is optional.
This method must only be called when the elevation
method is also called. If not, the build
method will throw an exception.
noDataValue
- the no-data value to use for elevation@NotNull public QuadTreeRasterModelBuilder dataRetriever(@NotNull IMultilevelTiledRasterDataRetriever dataRetriever)
This information is mandatory. A user implementation must be provided.
dataRetriever
- the interface that is called to retrieve the raster tile data. Cannot be null
.@NotNull public QuadTreeRasterModelBuilder enableInvalidation()
By default raster models are created without invalidation.
Call this method when you need a raster model for which the content can change. Then a IRasterModel
is created that returns true
for IRasterModel#canInvalidate
and for which you can call the method IRasterModel#invalidate
to indicate the content of the raster model has changed.
@NotNull public IRasterModel build()
Mandatory information:
java.lang.IllegalStateException
when the conditions to build the raster model are not met.