Skip to main content

Class: ResolveUtils

Defined in: utils/ResolveUtils.ts:24

Utility methods for resolving data from layer configs

Constructors

Constructor

new ResolveUtils(): ResolveUtils

Returns

ResolveUtils

Methods

resolveColors()

static resolveColors(ids, colorConfig, colorMaps, defaultColor, loadTable, visibilityData, opacityData, options?): Promise<Uint32Array<ArrayBufferLike>>

Defined in: utils/ResolveUtils.ts:229

Resolves a Uint32Array of packed 0xRRGGBBAA color values for the given item IDs

Supports constant, from-column (palette-mapped), groupBy-column, and random config sources. Table values are parsed as numeric color values and mapped to RGBA via a provided color palette. When mapping from a group-by column, group keys are JSON-stringified and mapped to colors via a provided color map. If no color map is provided, group keys are hashed and mapped to a provided color range and palette. If a mapping is missing or parsing fails, the defaultColor is used instead. After colors are resolved, the alpha byte of each entry is set from opacityData (or 0 when the item is invisible according to visibilityData).

Parameters

ids

number[]

Ordered list of item IDs to resolve

colorConfig

ColorConfig

The color configuration describing the data source

colorMaps

DefaultMap<Color>[]

Named maps from group strings to Color values

defaultColor

Color

Fallback color used when a value cannot be resolved

loadTable

(tableId, options?) => Promise<TableData>

Async function that loads a TableData by ID

visibilityData

Uint8Array

Resolved visibility data produced by resolveVisibilities

opacityData

Uint8Array

Resolved opacity data produced by resolveOpacities

options?

Optional abort signal and alignment for the output array length

align?

number

signal?

AbortSignal

Returns

Promise<Uint32Array<ArrayBufferLike>>

A Uint32Array of length align(ids.length, align) with packed RGBA colors


resolveMarkers()

static resolveMarkers(ids, markerConfig, markerMaps, defaultMarker, loadTable, options?): Promise<Uint8Array<ArrayBufferLike>>

Defined in: utils/ResolveUtils.ts:42

Resolves a Uint8Array of marker indices for the given item IDs

Supports constant, from-column, and groupBy-column config sources. Table values are parsed as numeric marker indices. When mapping from a group-by column, group keys are JSON-stringified and mapped to marker indices via a provided marker map. If no marker map is provided, group keys are hashed and mapped to all available markers. If a mapping is missing or parsing fails, the defaultMarker is used instead.

Parameters

ids

number[]

Ordered list of item IDs to resolve

markerConfig

MarkerConfig

The marker configuration describing the data source

markerMaps

DefaultMap<Marker>[]

Named maps from group strings to Marker values

defaultMarker

Marker

Fallback marker used when a value cannot be resolved

loadTable

(tableId, options?) => Promise<TableData>

Async function that loads a TableData by ID

options?

Optional abort signal and alignment for the output array length

align?

number

signal?

AbortSignal

Returns

Promise<Uint8Array<ArrayBufferLike>>

A Uint8Array of length align(ids.length, align) with encoded markers


resolveOpacities()

static resolveOpacities(ids, opacityConfig, opacityMaps, defaultOpacity, loadTable, options?): Promise<Uint8Array<ArrayBufferLike>>

Defined in: utils/ResolveUtils.ts:484

Resolves a Uint8Array of opacity values (0–255) for the given item IDs

Supports constant, from-column, and groupBy-column config sources. Table values are parsed as numeric opacities in the [0, 1] range. When mapping from a group-by column, group keys are JSON-stringified and mapped to opacity values via a provided opacity map. If a mapping is missing or parsing fails, the defaultOpacity is used instead. Each resolved opacity in [0, 1] is multiplied by opacityFactor, then scaled to the [0, 255] byte range.

Parameters

ids

number[]

Ordered list of item IDs to resolve

opacityConfig

OpacityConfig

The opacity configuration describing the data source

opacityMaps

DefaultMap<number>[]

Named maps from group strings to numeric opacity values in [0, 1]

defaultOpacity

number

Fallback opacity in [0, 1] used when a value cannot be resolved

loadTable

(tableId, options?) => Promise<TableData>

Async function that loads a TableData by ID

options?

Optional abort signal, alignment for the output array length, and opacity factor

align?

number

opacityFactor?

number

signal?

AbortSignal

Returns

Promise<Uint8Array<ArrayBufferLike>>

A Uint8Array of length align(ids.length, align) with byte-scaled opacities


resolveSizes()

static resolveSizes(ids, sizeConfig, sizeMaps, defaultSize, loadTable, options?): Promise<Float32Array<ArrayBufferLike>>

Defined in: utils/ResolveUtils.ts:143

Resolves a Float32Array of size values for the given item IDs

Supports constant, from-column, and groupBy-column config sources. Table values are parsed as numeric sizes. When mapping from a group-by column, group keys are JSON-stringified and mapped to sizes via a provided size map. If a mapping is missing or parsing fails, the defaultSize is used instead. Each resolved size is multiplied by sizeFactor before being stored.

Parameters

ids

number[]

Ordered list of item IDs to resolve

sizeConfig

SizeConfig

The size configuration describing the data source

sizeMaps

DefaultMap<number>[]

Named maps from group strings to numeric size values

defaultSize

number

Fallback size used when a value cannot be resolved

loadTable

(tableId, options?) => Promise<TableData>

Async function that loads a TableData by ID

options?

Optional abort signal, alignment for the output array length, and size factor

align?

number

signal?

AbortSignal

sizeFactor?

number

Returns

Promise<Float32Array<ArrayBufferLike>>

A Float32Array of length align(ids.length, align) with scaled sizes


resolveVisibilities()

static resolveVisibilities(ids, visibilityConfig, visibilityMaps, defaultVisibility, loadTable, options?): Promise<Uint8Array<ArrayBufferLike>>

Defined in: utils/ResolveUtils.ts:388

Resolves a Uint8Array of visibility values (0 or 1) for the given item IDs

Supports constant, from-column (truthy when value > 0), and groupBy-column config sources. Table values are parsed as numeric visibility flags (0 = invisible, otherwise visible). When mapping from a group-by column, group keys are JSON-stringified and mapped to visibility via a provided visibility map. If a mapping is missing or parsing fails, the defaultVisibility is used instead.

Parameters

ids

number[]

Ordered list of item IDs to resolve

visibilityConfig

VisibilityConfig

The visibility configuration describing the data source

visibilityMaps

DefaultMap<boolean>[]

Named maps from group strings to boolean visibility values

defaultVisibility

boolean

Fallback visibility used when a value cannot be resolved

loadTable

(tableId, options?) => Promise<TableData>

Async function that loads a TableData by ID

options?

Optional abort signal and alignment for the output array length

align?

number

signal?

AbortSignal

Returns

Promise<Uint8Array<ArrayBufferLike>>

A Uint8Array of length align(ids.length, align) with visibility flags