Class Map.Builder
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
Map
-
Method Summary
Modifier and TypeMethodDescriptionbackgroundColor
(android.graphics.Color color) Configures the background color of the map.build()
Builds the Map for the configured settings.void
close()
displayScale
(double displayScale) Specifies the display scale to allow the renderer to scale the graphics on high DPI displays.dpi
(double dpi) Sets the DPI value that will be used to interpret map scales.protected void
finalize()
Sets an initial layer list to use.maxMemoryUsageHint
(double cpuMemory, double gpuMemory) A hint about the memory consumption allowed by the map.reference
(CoordinateReference reference) Sets the reference for thisMap
.
-
Method Details
-
finalize
protected void finalize() -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
build
Builds the Map for the configured settings.- Returns:
- the built
Map
. - Throws:
IllegalStateException
- when the map reference is not an allowed reference.IllegalArgumentException
- when the layer list, or a layer in it, is already attached to a map.- See Also:
-
reference
@NotNull public Map.Builder reference(@NotNull CoordinateReference reference) throws NullPointerException Sets the reference for thisMap
.This parameter is optional. The default is the reference with id EPSG:4978.
Only projected and geocentric references are allowed.
- Parameters:
reference
- the reference of thisMap
, cannot benull
.- Returns:
- this
- Throws:
NullPointerException
- when the reference isnull
.
-
dpi
Sets the DPI value that will be used to interpret map scales.See
Map#setDpi
for more information.- Parameters:
dpi
- the dpi- Returns:
- this
-
displayScale
Specifies the display scale to allow the renderer to scale the graphics on high DPI displays.See
Map#setDisplayScale
for more information.- Parameters:
displayScale
- the display scale. A value of 1.0 corresponds with a display scale of 100%.- Returns:
- this
-
layerList
Sets an initial layer list to use.Note:
LayerList
instances and the layers in them can not be shared with anotherMap
.This parameter is optional. Not specifying one will create a new, empty, instance.
- Parameters:
layerList
- the initial layer list to use. Cannot benull
.- Returns:
- this
- Throws:
NullPointerException
- when the layer list isnull
.
-
backgroundColor
Configures the background color of the map.This parameter is optional. Not specifying one will pick a default color. In 3D, the atmospheric effect has priority over the background color.
- Parameters:
color
- the color that is used to render the map background.- Returns:
- this
-
maxMemoryUsageHint
A hint about the memory consumption allowed by the map.These hints only apply to internal data managed by the map, not to any user data present in the application.
By default, the limits are 500 MB for CPU and 1000 MB for GPU.
This can help prevent the application from crashing. If you experience such behavior, try reducing both CPU and GPU memory from the default values. Alternatively, if memory is not a problem, pushing those values higher can improve caching efficiency.
Notes:
- The values are expressed in megabytes.
- The memory will be distributed over the layers in your map.
- The distribution happens automatically and continuously.
- The distribution can be un-even, so you can have large layers and small layers.
- Each layer implementation will attempt to restrict its memory usage to its allocation portion.
- Typically the layers will remove cached data to reach the limit.
- When the memory limits are reached, some layers will reduce quality or amount of data loaded. If so, they will log this clearly.
- Parameters:
cpuMemory
- a hint for the maximum CPU memory usage, defined in MB.gpuMemory
- a hint for the maximum GPU memory usage, defined in MB.- Returns:
- this
- Since:
- 2024.1
-