LuciadCPillar 2026.1.02
Loading...
Searching...
No Matches
luciad::Map::Builder Class Referencefinal

Builder to create a Map. More...

#include <luciad/maps/Map.h>

Public Member Functions

 ~Builder ()
Builder & autoAdjustDepthRangeEnabled (bool enabled)
 Sets whether automatic adjustment of the camera near and far planes is enabled.
Builder & backgroundColor (Color color)
 Configures the background color of the map.
std::shared_ptr< Map > build ()
 Builds the Map for the configured settings.
Builder & displayScale (double displayScale)
 Specifies the display scale to allow the renderer to scale the graphics on high DPI displays.
Builder & dpi (double dpi)
 Sets the DPI value that will be used to interpret map scales.
Builder & layerList (std::shared_ptr< LayerList > layerList)
 Sets an initial layer list to use.
Builder & maxMemoryUsageHint (double cpuMemory, double gpuMemory)
 A hint about the memory consumption allowed by the map.
Builder & reference (std::shared_ptr< CoordinateReference > reference)
 Sets the reference for this Map.

Detailed Description

Builder to create a Map.

Constructor & Destructor Documentation

◆ ~Builder()

luciad::Map::Builder::~Builder ( )

Member Function Documentation

◆ autoAdjustDepthRangeEnabled()

Builder & luciad::Map::Builder::autoAdjustDepthRangeEnabled ( bool enabled)

Sets whether automatic adjustment of the camera near and far planes is enabled.

See Map::setAutoAdjustDepthRangeEnabled for more information.

This parameter is optional. The default is true.

Parameters
enabledwhether the near and far planes are adjusted automatically.
Returns
this
Since
2026.1

◆ backgroundColor()

Builder & luciad::Map::Builder::backgroundColor ( 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
colorthe color that is used to render the map background.
Returns
this
Since
2020.1

◆ build()

std::shared_ptr< Map > luciad::Map::Builder::build ( )

Builds the Map for the configured settings.

Returns
the built Map.
Exceptions
luciad::LogicExceptionwhen the map reference is not an allowed reference.
InvalidArgumentExceptionwhen the layer list, or a layer in it, is already attached to a map.
See also
reference

◆ displayScale()

Builder & luciad::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
displayScalethe display scale. A value of 1.0 corresponds with a display scale of 100%.
Returns
this
Since
2022.0

◆ dpi()

Builder & luciad::Map::Builder::dpi ( double dpi)

Sets the DPI value that will be used to interpret map scales.

See Map::setDpi for more information.

Parameters
dpithe DPI value
Returns
this

◆ layerList()

Builder & luciad::Map::Builder::layerList ( std::shared_ptr< LayerList > layerList)

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
layerListthe initial layer list to use. Cannot be nullptr.
Exceptions
NullArgumentExceptionwhen the layer list is nullptr.
Returns
this

◆ maxMemoryUsageHint()

Builder & luciad::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 2000 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 uneven, 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
cpuMemorya hint for the maximum CPU memory usage, defined in MB.
gpuMemorya hint for the maximum GPU memory usage, defined in MB.
Returns
this
Since
2024.1

◆ reference()

Builder & luciad::Map::Builder::reference ( std::shared_ptr< CoordinateReference > reference)

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
referencethe reference of this Map, cannot be nullptr.
Exceptions
NullArgumentExceptionwhen the reference is nullptr.
Returns
this