Class: SizeDataUtils
Defined in: utils/data/SizeDataUtils.ts:16
Extends
DataUtilsBase
Constructors
Constructor
new SizeDataUtils():
SizeDataUtils
Returns
SizeDataUtils
Inherited from
DataUtilsBase.constructor
Methods
createUniformSizeData()
staticcreateUniformSizeData(n,size,options?):Float32Array
Defined in: utils/data/SizeDataUtils.ts:196
Creates a size data buffer of the given size filled with a single size value.
Parameters
n
number
Number of elements
size
number
The size value to fill with
options?
Optional buffer alignment and size scaling factor
align?
number
sizeFactor?
number
Returns
Float32Array
A Float32Array filled with the encoded size value
encodeSize()
staticencodeSize(size,options?):number
Defined in: utils/data/SizeDataUtils.ts:229
Encodes a size value, optionally scaled by a size factor.
Parameters
size
number
The size value to encode
options?
Optional size scaling factor (defaults to 1)
sizeFactor?
number
Returns
number
The scaled size value
fillFromConfigData()
protectedstaticfillFromConfigData<TValue>(data,ids,config,defaultValue,loadTable,parseTableValue,encodeValue,options?):Promise<void>
Defined in: utils/data/DataUtilsBase.ts:21
Fills data by loading values from the configured table column
For each ID in ids, the corresponding row is looked up in the loaded table by ID.
The raw cell value is parsed by parseTableValue; if parsing fails, defaultValue is used instead.
Type Parameters
TValue
TValue
Parameters
data
Output typed array to fill
ids
number[]
Ordered list of item IDs
config
A FromConfig specifying the source table and column
defaultValue
TValue
Value used when the ID is missing or parsing fails
loadTable
(tableId, options?) => Promise<TableData>
Async function that loads a TableData by ID
parseTableValue
(value, valueRange) => TValue | undefined
Converts a raw cell value to TValue, or undefined on failure
encodeValue
(value) => number
Converts TValue to the numeric representation stored in data
options?
Optional abort signal
signal?
AbortSignal
Returns
Promise<void>
Inherited from
DataUtilsBase.fillFromConfigData
fillGroupByConfigData()
protectedstaticfillGroupByConfigData<TValue,TMapRequired>(data,ids,config,defaultValue,loadTable,mapGroupToValue,encodeValue,options?):Promise<void>
Defined in: utils/data/DataUtilsBase.ts:81
Fills data by loading group keys from the configured table column and mapping them to values.
For each ID in ids, the corresponding row is looked up in the loaded table by ID.
The raw cell value is JSON-stringified to produce a group key, which is then mapped to a value using mapGroupToValue.
If the mapping fails, defaultValue is used instead.
Type Parameters
TValue
TValue
TMapRequired
TMapRequired extends boolean
Parameters
data
Output typed array to fill
ids
number[]
Ordered list of item IDs
config
GroupByConfig<TMapRequired>
A GroupByConfig specifying the source table and column
defaultValue
TValue
Value used when the ID is missing or the group is unmapped
loadTable
(tableId, options?) => Promise<TableData>
Async function that loads a TableData by ID
mapGroupToValue
(group) => TValue | undefined
Maps a JSON-stringified group key to TValue, or undefined
encodeValue
(value) => number
Converts TValue to the numeric representation stored in data
options?
Optional abort signal
signal?
AbortSignal
Returns
Promise<void>
Inherited from
DataUtilsBase.fillGroupByConfigData
loadConstantSizeData()
staticloadConstantSizeData(ids,config,options?):Float32Array
Defined in: utils/data/SizeDataUtils.ts:85
Creates a uniform size data buffer filled with the configured constant size.
Parameters
ids
number[]
Ordered list of item IDs (only the length is used)
config
ConstantConfig<number, { unit?: CoordinateSpace; }>
Constant size configuration containing the size value
options?
Optional buffer alignment and size scaling factor
align?
number
sizeFactor?
number
Returns
Float32Array
A Float32Array filled with the encoded constant size
loadFromSizeData()
staticloadFromSizeData(ids,config,defaultSize,loadTable,options?):Promise<Float32Array<ArrayBufferLike>>
Defined in: utils/data/SizeDataUtils.ts:108
Loads size data by reading numeric values from a table column.
Parameters
ids
number[]
Ordered list of item IDs
config
FromConfig<{ unit?: CoordinateSpace; }>
From configuration specifying the source table and column
defaultSize
number
Fallback size when a value is missing or invalid
loadTable
(tableId, options?) => Promise<TableData>
Async function that loads a TableData by ID
options?
Optional abort signal, buffer alignment, and size scaling factor
align?
number
signal?
AbortSignal
sizeFactor?
number
Returns
Promise<Float32Array<ArrayBufferLike>>
A Float32Array of encoded size values
loadGroupBySizeData()
staticloadGroupBySizeData(ids,config,sizeMaps,defaultSize,loadTable,options?):Promise<Float32Array<ArrayBufferLike>>
Defined in: utils/data/SizeDataUtils.ts:147
Loads size data by grouping IDs via a table column and mapping each group to a size value using a size map.
Parameters
ids
number[]
Ordered list of item IDs
config
GroupByConfig<true, { unit?: CoordinateSpace; }>
GroupBy configuration specifying the source table, column, and map
sizeMaps
DefaultMap<number>[]
Available size maps for group-to-size lookups
defaultSize
number
Fallback size when the map is not found or a group is unmapped
loadTable
(tableId, options?) => Promise<TableData>
Async function that loads a TableData by ID
options?
Optional abort signal, buffer alignment, and size scaling factor
align?
number
signal?
AbortSignal
sizeFactor?
number
Returns
Promise<Float32Array<ArrayBufferLike>>
A Float32Array of encoded size values
loadSizeData()
staticloadSizeData(ids,config,sizeMaps,defaultSize,loadTable,options?):Promise<Float32Array<ArrayBufferLike>>
Defined in: utils/data/SizeDataUtils.ts:31
Loads size data for a set of IDs based on the active size configuration source.
Dispatches to the appropriate loader (constant, from, or groupBy) depending on which configuration source is active.
Parameters
ids
number[]
Ordered list of item IDs
config
Size configuration specifying the data source
sizeMaps
DefaultMap<number>[]
Available size maps for groupBy lookups
defaultSize
number
Fallback size when no valid config or value is found
loadTable
(tableId, options?) => Promise<TableData>
Async function that loads a TableData by ID
options?
Optional abort signal, buffer alignment, and size scaling factor
align?
number
signal?
AbortSignal
sizeFactor?
number
Returns
Promise<Float32Array<ArrayBufferLike>>
A Float32Array of encoded size values, one per ID
parseSizeValue()
staticparseSizeValue(value):number|undefined
Defined in: utils/data/SizeDataUtils.ts:214
Parses a raw value as a size number.
Parameters
value
unknown
The raw value to parse (must be a number)
Returns
number | undefined
The numeric size value, or undefined if value is not a number