Class Map.Builder

java.lang.Object
com.luciad.maps.Map.Builder
All Implemented Interfaces:
AutoCloseable
Enclosing class:
Map

public static final class Map.Builder extends Object implements AutoCloseable
Builder to create a Map.
  • Method Details Link icon

    • finalize Link icon

      protected void finalize()
      Overrides:
      finalize in class Object
    • close Link icon

      public void close()
      Specified by:
      close in interface AutoCloseable
    • build Link icon

      @NotNull public Map build() throws IllegalArgumentException, IllegalStateException
      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 Link icon

      @NotNull public Map.Builder reference(@NotNull CoordinateReference reference) throws NullPointerException
      Sets the reference for this Map.

      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 this Map, cannot be null.
      Returns:
      this
      Throws:
      NullPointerException - when the reference is null.
    • dpi Link icon

      @NotNull public Map.Builder dpi(double 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 Link icon

      @NotNull public Map.Builder displayScale(double 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 Link icon

      @NotNull public Map.Builder layerList(@NotNull LayerList layerList) throws NullPointerException
      Sets an initial layer list to use.

      Note: LayerList instances and the layers in them can not be shared with another Map.

      This parameter is optional. Not specifying one will create a new, empty, instance.

      Parameters:
      layerList - the initial layer list to use. Cannot be null.
      Returns:
      this
      Throws:
      NullPointerException - when the layer list is null.
    • backgroundColor Link icon

      @NotNull public Map.Builder backgroundColor(@NotNull android.graphics.Color color)
      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 Link icon

      @NotNull public Map.Builder maxMemoryUsageHint(double cpuMemory, double gpuMemory)
      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