Class QuadTreeRasterModelBuilder
- All Implemented Interfaces:
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:
- Level 0 is the least detailed level.
- All levels have the same extent and top-left corner.
- The tile coordinate
(N,0,0)
on levelN
is the top-left tile. - Each tile on level
N
corresponds to a block of 2x2 tiles on levelN+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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionattributionProvider
(IMultilevelTiledAttributionProvider attributionProvider) Sets the attribution provider for this model.Defines the extent of the raster data structure.build()
Creates the raster model.void
close()
dataBounds
(Bounds bounds) Defines the extent of where actual data is a available.dataRetriever
(IMultilevelTiledRasterDataRetriever dataRetriever) Defines the implementation to be used to retrieve the raster tile data.Marks this model as an elevation model.elevationNoDataValue
(float noDataValue) Sets a no-data value for elevation data.Allows to create a raster model which can be invalidated.protected void
finalize()
level0ColumnCount
(long colCount) Defines the number of columns at the least detailed level.level0RowCount
(long rowCount) Defines the number of row at the least detailed level.levelCount
(long levelCount) Defines the number of detail levels.modelMetadata
(ModelMetadata modelMetadata) Defines the model metadata.static QuadTreeRasterModelBuilder
Creates the builder class to create a raster model.reference
(CoordinateReference modelReference) Defines the reference in which the raster data is defined.samplingMode
(RasterSamplingMode samplingMode) Defines the sampling mode of the data.tileHeightPixels
(long tileHeightPixels) Defines the height in pixels for a single tile.tileWidthPixels
(long tileWidthPixels) Defines the width in pixels for a single tile.
-
Constructor Details
-
Method Details
-
finalize
protected void finalize() -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
newBuilder
Creates the builder class to create a raster model.- Returns:
- the builder class for creation of a 'basic'
IRasterModel
.
-
reference
Defines the reference in which the raster data is defined.This information is mandatory.
- Parameters:
modelReference
- the reference for the raster data. Cannot benull
.- Returns:
- this builder.
-
level0RowCount
Defines the number of row at the least detailed level.This information is mandatory.
- Parameters:
rowCount
- the number of tiles on the row of the least detailed level.- Returns:
- this builder.
-
level0ColumnCount
Defines the number of columns at the least detailed level.This information is mandatory.
- Parameters:
colCount
- the number of tiles on the column of the least detailed level.- Returns:
- this builder.
-
levelCount
Defines the number of detail levels.This information is mandatory.
- Parameters:
levelCount
- the number of detail levels.- Returns:
- this builder.
-
tileWidthPixels
Defines the width in pixels for a single tile.This information is mandatory.
- Parameters:
tileWidthPixels
- the width, in pixels, for a tile within the tiled structure.- Returns:
- this builder.
-
tileHeightPixels
Defines the height in pixels for a single tile.This information is mandatory.
- Parameters:
tileHeightPixels
- the height, in pixels, for a tile within the tiled structure.- Returns:
- this builder.
-
bounds
Defines the extent of the raster data structure.This information is mandatory.
- Parameters:
bounds
- the extent of the raster data structure.- Returns:
- this builder.
-
dataBounds
Defines the extent of where actual data is a available.This information is optional. If not defined the extent of the data is assumed to be based the entire structure.
- Parameters:
bounds
- the extent of the 'actual' data.- Returns:
- this builder.
-
samplingMode
Defines the sampling mode of the data.This information is optional. The default value is
Area
.- Parameters:
samplingMode
- the sampling mode of the data.- Returns:
- this builder.
-
modelMetadata
Defines the model metadata.This information is mandatory.
- Parameters:
modelMetadata
- the model metadata.- Returns:
- this builder.
-
elevation
Marks this model as an elevation model.If this method is called, the
configured
IMultilevelTiledRasterDataRetriever
must return elevation data as well. SeeIMultilevelTiledRasterDataRetrieverCallback#onDataAvailable
andIMultilevelTiledRasterDataRetrieverCallback#onImageAvailable
for more information.- Returns:
- this builder
-
elevationNoDataValue
Sets a no-data value for elevation data.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, thebuild
method will throw an exception.- Parameters:
noDataValue
- the no-data value to use for elevation- Returns:
- this builder
- Since:
- 2023.0
-
dataRetriever
@NotNull public QuadTreeRasterModelBuilder dataRetriever(@NotNull IMultilevelTiledRasterDataRetriever dataRetriever) Defines the implementation to be used to retrieve the raster tile data.This information is mandatory. A user implementation must be provided.
- Parameters:
dataRetriever
- the interface that is called to retrieve the raster tile data. Cannot benull
.- Returns:
- this builder.
-
attributionProvider
@NotNull public QuadTreeRasterModelBuilder attributionProvider(@NotNull IMultilevelTiledAttributionProvider attributionProvider) Sets the attribution provider for this model.By default, no attribution provider is set.
- Parameters:
attributionProvider
- the attribution provider for the model. Can benull
.- Returns:
- this builder.
- Since:
- 2024.0
-
enableInvalidation
Allows to create a raster model which can be invalidated.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 returnstrue
forIRasterModel#canInvalidate
and for which you can call the methodIRasterModel#invalidate
to indicate the content of the raster model has changed.- Returns:
- this builder.
-
build
Creates the raster model.Mandatory information:
- the reference of the raster data
- the number of columns and rows at the least detail level
- the number of detail levels
- model metadata
- data retriever
- Returns:
- the raster model, or a
java.lang.IllegalStateException
when the conditions to build the raster model are not met.
-