{ "version": 3, "sources": ["../src/index.ts", "../src/arc-layer/arc-layer.ts", "../src/arc-layer/arc-layer-uniforms.ts", "../src/arc-layer/arc-layer-vertex.glsl.ts", "../src/arc-layer/arc-layer-fragment.glsl.ts", "../src/bitmap-layer/bitmap-layer.ts", "../src/bitmap-layer/create-mesh.ts", "../src/bitmap-layer/bitmap-layer-uniforms.ts", "../src/bitmap-layer/bitmap-layer-vertex.ts", "../src/bitmap-layer/bitmap-layer-fragment.ts", "../src/icon-layer/icon-layer.ts", "../src/icon-layer/icon-layer-uniforms.ts", "../src/icon-layer/icon-layer-vertex.glsl.ts", "../src/icon-layer/icon-layer-fragment.glsl.ts", "../src/icon-layer/icon-manager.ts", "../src/line-layer/line-layer.ts", "../src/line-layer/line-layer-uniforms.ts", "../src/line-layer/line-layer-vertex.glsl.ts", "../src/line-layer/line-layer-fragment.glsl.ts", "../src/point-cloud-layer/point-cloud-layer.ts", "../src/point-cloud-layer/point-cloud-layer-uniforms.ts", "../src/point-cloud-layer/point-cloud-layer-vertex.glsl.ts", "../src/point-cloud-layer/point-cloud-layer-fragment.glsl.ts", "../src/scatterplot-layer/scatterplot-layer.ts", "../src/scatterplot-layer/scatterplot-layer-uniforms.ts", "../src/scatterplot-layer/scatterplot-layer-vertex.glsl.ts", "../src/scatterplot-layer/scatterplot-layer-fragment.glsl.ts", "../src/column-layer/column-layer.ts", "../src/column-layer/column-geometry.ts", "../src/column-layer/column-layer-uniforms.ts", "../src/column-layer/column-layer-vertex.glsl.ts", "../src/column-layer/column-layer-fragment.glsl.ts", "../src/column-layer/grid-cell-layer.ts", "../src/path-layer/path-layer.ts", "../src/path-layer/path-tesselator.ts", "../src/path-layer/path.ts", "../src/path-layer/path-layer-uniforms.ts", "../src/path-layer/path-layer-vertex.glsl.ts", "../src/path-layer/path-layer-fragment.glsl.ts", "../src/polygon-layer/polygon-layer.ts", "../src/solid-polygon-layer/solid-polygon-layer.ts", "../src/solid-polygon-layer/polygon.ts", "../src/solid-polygon-layer/polygon-tesselator.ts", "../src/solid-polygon-layer/solid-polygon-layer-uniforms.ts", "../src/solid-polygon-layer/solid-polygon-layer-vertex-main.glsl.ts", "../src/solid-polygon-layer/solid-polygon-layer-vertex-top.glsl.ts", "../src/solid-polygon-layer/solid-polygon-layer-vertex-side.glsl.ts", "../src/solid-polygon-layer/solid-polygon-layer-fragment.glsl.ts", "../src/utils.ts", "../src/geojson-layer/geojson-layer.ts", "../src/geojson-layer/geojson-binary.ts", "../src/text-layer/text-layer.ts", "../src/text-layer/multi-icon-layer/multi-icon-layer.ts", "../src/text-layer/multi-icon-layer/sdf-uniforms.ts", "../src/text-layer/multi-icon-layer/multi-icon-layer-fragment.glsl.ts", "../src/text-layer/font-atlas-manager.ts", "../src/text-layer/utils.ts", "../src/text-layer/lru-cache.ts", "../src/text-layer/text-background-layer/text-background-layer.ts", "../src/text-layer/text-background-layer/text-background-layer-uniforms.ts", "../src/text-layer/text-background-layer/text-background-layer-vertex.glsl.ts", "../src/text-layer/text-background-layer/text-background-layer-fragment.glsl.ts", "../src/geojson-layer/sub-layer-map.ts", "../src/geojson-layer/geojson.ts", "../src/geojson-layer/geojson-layer-props.ts"], "sourcesContent": ["// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/* eslint-disable max-len */\n\n// Core Layers\nexport {default as ArcLayer} from './arc-layer/arc-layer';\nexport {default as BitmapLayer} from './bitmap-layer/bitmap-layer';\nexport {default as IconLayer} from './icon-layer/icon-layer';\nexport {default as LineLayer} from './line-layer/line-layer';\nexport {default as PointCloudLayer} from './point-cloud-layer/point-cloud-layer';\nexport {default as ScatterplotLayer} from './scatterplot-layer/scatterplot-layer';\nexport {default as ColumnLayer} from './column-layer/column-layer';\nexport {default as GridCellLayer} from './column-layer/grid-cell-layer';\nexport {default as PathLayer} from './path-layer/path-layer';\nexport {default as PolygonLayer} from './polygon-layer/polygon-layer';\nexport {default as GeoJsonLayer} from './geojson-layer/geojson-layer';\nexport {default as TextLayer} from './text-layer/text-layer';\nexport {default as SolidPolygonLayer} from './solid-polygon-layer/solid-polygon-layer';\n\n// Experimental layer exports\nexport {default as _MultiIconLayer} from './text-layer/multi-icon-layer/multi-icon-layer';\nexport {default as _TextBackgroundLayer} from './text-layer/text-background-layer/text-background-layer';\n\n// Types\nexport type {ArcLayerProps} from './arc-layer/arc-layer';\nexport type {\n BitmapLayerProps,\n BitmapBoundingBox,\n BitmapLayerPickingInfo\n} from './bitmap-layer/bitmap-layer';\nexport type {ColumnLayerProps} from './column-layer/column-layer';\nexport type {ScatterplotLayerProps} from './scatterplot-layer/scatterplot-layer';\nexport type {IconLayerProps} from './icon-layer/icon-layer';\nexport type {LineLayerProps} from './line-layer/line-layer';\nexport type {PolygonLayerProps} from './polygon-layer/polygon-layer';\nexport type {GeoJsonLayerProps} from './geojson-layer/geojson-layer';\nexport type {GridCellLayerProps} from './column-layer/grid-cell-layer';\nexport type {TextLayerProps} from './text-layer/text-layer';\nexport type {MultiIconLayerProps} from './text-layer/multi-icon-layer/multi-icon-layer';\nexport type {PointCloudLayerProps} from './point-cloud-layer/point-cloud-layer';\nexport type {TextBackgroundLayerProps} from './text-layer/text-background-layer/text-background-layer';\nexport type {PathLayerProps} from './path-layer/path-layer';\nexport type {SolidPolygonLayerProps} from './solid-polygon-layer/solid-polygon-layer';\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {\n Layer,\n project32,\n picking,\n UNIT,\n UpdateParameters,\n LayerProps,\n LayerDataSource,\n Unit,\n AccessorFunction,\n Position,\n Accessor,\n Color,\n DefaultProps\n} from '@deck.gl/core';\n\nimport {Model} from '@luma.gl/engine';\n\nimport {arcUniforms, ArcProps} from './arc-layer-uniforms';\nimport vs from './arc-layer-vertex.glsl';\nimport fs from './arc-layer-fragment.glsl';\n\nconst DEFAULT_COLOR: [number, number, number, number] = [0, 0, 0, 255];\n\nconst defaultProps: DefaultProps = {\n getSourcePosition: {type: 'accessor', value: (x: any) => x.sourcePosition},\n getTargetPosition: {type: 'accessor', value: (x: any) => x.targetPosition},\n getSourceColor: {type: 'accessor', value: DEFAULT_COLOR},\n getTargetColor: {type: 'accessor', value: DEFAULT_COLOR},\n getWidth: {type: 'accessor', value: 1},\n getHeight: {type: 'accessor', value: 1},\n getTilt: {type: 'accessor', value: 0},\n\n greatCircle: false,\n numSegments: {type: 'number', value: 50, min: 1},\n\n widthUnits: 'pixels',\n widthScale: {type: 'number', value: 1, min: 0},\n widthMinPixels: {type: 'number', value: 0, min: 0},\n widthMaxPixels: {type: 'number', value: Number.MAX_SAFE_INTEGER, min: 0}\n};\n\n/** All properties supported by ArcLayer. */\nexport type ArcLayerProps = _ArcLayerProps & LayerProps;\n\n/** Properties added by ArcLayer. */\ntype _ArcLayerProps = {\n data: LayerDataSource;\n /**\n * If `true`, create the arc along the shortest path on the earth surface.\n * @default false\n */\n greatCircle?: boolean;\n\n /**\n * The number of segments used to draw each arc.\n * @default 50\n */\n numSegments?: number;\n\n /**\n * The units of the line width, one of `'meters'`, `'common'`, and `'pixels'`\n * @default 'pixels'\n */\n widthUnits?: Unit;\n\n /**\n * The scaling multiplier for the width of each line.\n * @default 1\n */\n widthScale?: number;\n\n /**\n * The minimum line width in pixels.\n * @default 0\n */\n widthMinPixels?: number;\n\n /**\n * The maximum line width in pixels.\n * @default Number.MAX_SAFE_INTEGER\n */\n widthMaxPixels?: number;\n\n /**\n * Method called to retrieve the source position of each object.\n * @default object => object.sourcePosition\n */\n getSourcePosition?: AccessorFunction;\n\n /**\n * Method called to retrieve the target position of each object.\n * @default object => object.targetPosition\n */\n getTargetPosition?: AccessorFunction;\n\n /**\n * The rgba color is in the format of `[r, g, b, [a]]`.\n * @default [0, 0, 0, 255]\n */\n getSourceColor?: Accessor;\n\n /**\n * The rgba color is in the format of `[r, g, b, [a]]`.\n * @default [0, 0, 0, 255]\n */\n getTargetColor?: Accessor;\n\n /**\n * The line width of each object, in units specified by `widthUnits`.\n * @default 1\n */\n getWidth?: Accessor;\n\n /**\n * Multiplier of layer height. `0` will make the layer flat.\n * @default 1\n */\n getHeight?: Accessor;\n\n /**\n * Use to tilt the arc to the side if you have multiple arcs with the same source and target positions.\n * @default 0\n */\n getTilt?: Accessor;\n};\n\n/** Render raised arcs joining pairs of source and target coordinates. */\nexport default class ArcLayer extends Layer<\n ExtraPropsT & Required<_ArcLayerProps>\n> {\n static layerName = 'ArcLayer';\n static defaultProps = defaultProps;\n\n state!: {\n model?: Model;\n };\n\n getBounds(): [number[], number[]] | null {\n return this.getAttributeManager()?.getBounds([\n 'instanceSourcePositions',\n 'instanceTargetPositions'\n ]);\n }\n\n getShaders() {\n return super.getShaders({vs, fs, modules: [project32, picking, arcUniforms]}); // 'project' module added by default.\n }\n\n // This layer has its own wrapLongitude logic\n get wrapLongitude() {\n return false;\n }\n\n initializeState() {\n const attributeManager = this.getAttributeManager()!;\n\n /* eslint-disable max-len */\n attributeManager.addInstanced({\n instanceSourcePositions: {\n size: 3,\n type: 'float64',\n fp64: this.use64bitPositions(),\n transition: true,\n accessor: 'getSourcePosition'\n },\n instanceTargetPositions: {\n size: 3,\n type: 'float64',\n fp64: this.use64bitPositions(),\n transition: true,\n accessor: 'getTargetPosition'\n },\n instanceSourceColors: {\n size: this.props.colorFormat.length,\n type: 'unorm8',\n transition: true,\n accessor: 'getSourceColor',\n defaultValue: DEFAULT_COLOR\n },\n instanceTargetColors: {\n size: this.props.colorFormat.length,\n type: 'unorm8',\n transition: true,\n accessor: 'getTargetColor',\n defaultValue: DEFAULT_COLOR\n },\n instanceWidths: {\n size: 1,\n transition: true,\n accessor: 'getWidth',\n defaultValue: 1\n },\n instanceHeights: {\n size: 1,\n transition: true,\n accessor: 'getHeight',\n defaultValue: 1\n },\n instanceTilts: {\n size: 1,\n transition: true,\n accessor: 'getTilt',\n defaultValue: 0\n }\n });\n /* eslint-enable max-len */\n }\n\n updateState(params: UpdateParameters): void {\n super.updateState(params);\n\n if (params.changeFlags.extensionsChanged) {\n this.state.model?.destroy();\n this.state.model = this._getModel();\n this.getAttributeManager()!.invalidateAll();\n }\n }\n\n draw({uniforms}) {\n const {\n widthUnits,\n widthScale,\n widthMinPixels,\n widthMaxPixels,\n greatCircle,\n wrapLongitude,\n numSegments\n } = this.props;\n const arcProps: ArcProps = {\n numSegments,\n widthUnits: UNIT[widthUnits],\n widthScale,\n widthMinPixels,\n widthMaxPixels,\n greatCircle,\n useShortestPath: wrapLongitude\n };\n\n const model = this.state.model!;\n model.shaderInputs.setProps({arc: arcProps});\n model.setVertexCount(numSegments * 2);\n model.draw(this.context.renderPass);\n }\n\n protected _getModel(): Model {\n return new Model(this.context.device, {\n ...this.getShaders(),\n id: this.props.id,\n bufferLayout: this.getAttributeManager()!.getBufferLayouts(),\n topology: 'triangle-strip',\n isInstanced: true\n });\n }\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderModule} from '@luma.gl/shadertools';\n\nconst uniformBlock = `\\\nuniform arcUniforms {\n bool greatCircle;\n bool useShortestPath;\n float numSegments;\n float widthScale;\n float widthMinPixels;\n float widthMaxPixels;\n highp int widthUnits;\n} arc;\n`;\n\nexport type ArcProps = {\n greatCircle: boolean;\n useShortestPath: boolean;\n numSegments: number;\n widthScale: number;\n widthMinPixels: number;\n widthMaxPixels: number;\n widthUnits: number;\n};\n\nexport const arcUniforms = {\n name: 'arc',\n vs: uniformBlock,\n fs: uniformBlock,\n uniformTypes: {\n greatCircle: 'f32',\n useShortestPath: 'f32',\n numSegments: 'f32',\n widthScale: 'f32',\n widthMinPixels: 'f32',\n widthMaxPixels: 'f32',\n widthUnits: 'i32'\n }\n} as const satisfies ShaderModule;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport default `\\\n#version 300 es\n#define SHADER_NAME arc-layer-vertex-shader\n\nin vec4 instanceSourceColors;\nin vec4 instanceTargetColors;\nin vec3 instanceSourcePositions;\nin vec3 instanceSourcePositions64Low;\nin vec3 instanceTargetPositions;\nin vec3 instanceTargetPositions64Low;\nin vec3 instancePickingColors;\nin float instanceWidths;\nin float instanceHeights;\nin float instanceTilts;\n\nout vec4 vColor;\nout vec2 uv;\nout float isValid;\n\nfloat paraboloid(float distance, float sourceZ, float targetZ, float ratio) {\n // d: distance on the xy plane\n // r: ratio of the current point\n // p: ratio of the peak of the arc\n // h: height multiplier\n // z = f(r) = sqrt(r * (p * 2 - r)) * d * h\n // f(0) = 0\n // f(1) = dz\n\n float deltaZ = targetZ - sourceZ;\n float dh = distance * instanceHeights;\n if (dh == 0.0) {\n return sourceZ + deltaZ * ratio;\n }\n float unitZ = deltaZ / dh;\n float p2 = unitZ * unitZ + 1.0;\n\n // sqrt does not deal with negative values, manually flip source and target if delta.z < 0\n float dir = step(deltaZ, 0.0);\n float z0 = mix(sourceZ, targetZ, dir);\n float r = mix(ratio, 1.0 - ratio, dir);\n return sqrt(r * (p2 - r)) * dh + z0;\n}\n\n// offset vector by strokeWidth pixels\n// offset_direction is -1 (left) or 1 (right)\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction, float width) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace * project.viewportSize);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n\n return dir_screenspace * offset_direction * width / 2.0;\n}\n\nfloat getSegmentRatio(float index) {\n return smoothstep(0.0, 1.0, index / (arc.numSegments - 1.0));\n}\n\nvec3 interpolateFlat(vec3 source, vec3 target, float segmentRatio) {\n float distance = length(source.xy - target.xy);\n float z = paraboloid(distance, source.z, target.z, segmentRatio);\n\n float tiltAngle = radians(instanceTilts);\n vec2 tiltDirection = normalize(target.xy - source.xy);\n vec2 tilt = vec2(-tiltDirection.y, tiltDirection.x) * z * sin(tiltAngle);\n\n return vec3(\n mix(source.xy, target.xy, segmentRatio) + tilt,\n z * cos(tiltAngle)\n );\n}\n\n/* Great circle interpolation\n * http://www.movable-type.co.uk/scripts/latlong.html\n */\nfloat getAngularDist (vec2 source, vec2 target) {\n vec2 sourceRadians = radians(source);\n vec2 targetRadians = radians(target);\n vec2 sin_half_delta = sin((sourceRadians - targetRadians) / 2.0);\n vec2 shd_sq = sin_half_delta * sin_half_delta;\n\n float a = shd_sq.y + cos(sourceRadians.y) * cos(targetRadians.y) * shd_sq.x;\n return 2.0 * asin(sqrt(a));\n}\n\nvec3 interpolateGreatCircle(vec3 source, vec3 target, vec3 source3D, vec3 target3D, float angularDist, float t) {\n vec2 lngLat;\n\n // if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation\n if(abs(angularDist - PI) < 0.001) {\n lngLat = (1.0 - t) * source.xy + t * target.xy;\n } else {\n float a = sin((1.0 - t) * angularDist);\n float b = sin(t * angularDist);\n vec3 p = source3D.yxz * a + target3D.yxz * b;\n lngLat = degrees(vec2(atan(p.y, -p.x), atan(p.z, length(p.xy))));\n }\n\n float z = paraboloid(angularDist * EARTH_RADIUS, source.z, target.z, t);\n\n return vec3(lngLat, z);\n}\n\n/* END GREAT CIRCLE */\n\nvoid main(void) {\n geometry.worldPosition = instanceSourcePositions;\n geometry.worldPositionAlt = instanceTargetPositions;\n\n /*\n * --(i, -1)-----------_(i+1, -1)--\n * | _,-\" |\n * o _,-\" o\n * | _,-\" |\n * --(i, 1)\"-------------(i+1, 1)--\n */\n float segmentIndex = float(gl_VertexID / 2);\n float segmentSide = mod(float(gl_VertexID), 2.) == 0. ? -1. : 1.;\n float segmentRatio = getSegmentRatio(segmentIndex);\n float prevSegmentRatio = getSegmentRatio(max(0.0, segmentIndex - 1.0));\n float nextSegmentRatio = getSegmentRatio(min(arc.numSegments - 1.0, segmentIndex + 1.0));\n\n // if it's the first point, use next - current as direction\n // otherwise use current - prev\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n isValid = 1.0;\n\n uv = vec2(segmentRatio, segmentSide);\n geometry.uv = uv;\n geometry.pickingColor = instancePickingColors;\n\n vec4 curr;\n vec4 next;\n vec3 source;\n vec3 target;\n\n if ((arc.greatCircle || project.projectionMode == PROJECTION_MODE_GLOBE) && project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\n source = project_globe_(vec3(instanceSourcePositions.xy, 0.0));\n target = project_globe_(vec3(instanceTargetPositions.xy, 0.0));\n float angularDist = getAngularDist(instanceSourcePositions.xy, instanceTargetPositions.xy);\n\n vec3 prevPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, prevSegmentRatio);\n vec3 currPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, segmentRatio);\n vec3 nextPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, nextSegmentRatio);\n\n if (abs(currPos.x - prevPos.x) > 180.0) {\n indexDir = -1.0;\n isValid = 0.0;\n } else if (abs(currPos.x - nextPos.x) > 180.0) {\n indexDir = 1.0;\n isValid = 0.0;\n }\n nextPos = indexDir < 0.0 ? prevPos : nextPos;\n nextSegmentRatio = indexDir < 0.0 ? prevSegmentRatio : nextSegmentRatio;\n\n if (isValid == 0.0) {\n // split at the 180th meridian\n nextPos.x += nextPos.x > 0.0 ? -360.0 : 360.0;\n float t = ((currPos.x > 0.0 ? 180.0 : -180.0) - currPos.x) / (nextPos.x - currPos.x);\n currPos = mix(currPos, nextPos, t);\n segmentRatio = mix(segmentRatio, nextSegmentRatio, t);\n }\n\n vec3 currPos64Low = mix(instanceSourcePositions64Low, instanceTargetPositions64Low, segmentRatio);\n vec3 nextPos64Low = mix(instanceSourcePositions64Low, instanceTargetPositions64Low, nextSegmentRatio);\n \n curr = project_position_to_clipspace(currPos, currPos64Low, vec3(0.0), geometry.position);\n next = project_position_to_clipspace(nextPos, nextPos64Low, vec3(0.0));\n \n } else {\n vec3 source_world = instanceSourcePositions;\n vec3 target_world = instanceTargetPositions;\n if (arc.useShortestPath) {\n source_world.x = mod(source_world.x + 180., 360.0) - 180.;\n target_world.x = mod(target_world.x + 180., 360.0) - 180.;\n\n float deltaLng = target_world.x - source_world.x;\n if (deltaLng > 180.) target_world.x -= 360.;\n if (deltaLng < -180.) source_world.x -= 360.;\n }\n source = project_position(source_world, instanceSourcePositions64Low);\n target = project_position(target_world, instanceTargetPositions64Low);\n\n // common x at longitude=-180\n float antiMeridianX = 0.0;\n\n if (arc.useShortestPath) {\n if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {\n antiMeridianX = -(project.coordinateOrigin.x + 180.) / 360. * TILE_SIZE;\n }\n float thresholdRatio = (antiMeridianX - source.x) / (target.x - source.x);\n\n if (prevSegmentRatio <= thresholdRatio && nextSegmentRatio > thresholdRatio) {\n isValid = 0.0;\n indexDir = sign(segmentRatio - thresholdRatio);\n segmentRatio = thresholdRatio;\n }\n }\n\n nextSegmentRatio = indexDir < 0.0 ? prevSegmentRatio : nextSegmentRatio;\n vec3 currPos = interpolateFlat(source, target, segmentRatio);\n vec3 nextPos = interpolateFlat(source, target, nextSegmentRatio);\n\n if (arc.useShortestPath) {\n if (nextPos.x < antiMeridianX) {\n currPos.x += TILE_SIZE;\n nextPos.x += TILE_SIZE;\n }\n }\n\n curr = project_common_position_to_clipspace(vec4(currPos, 1.0));\n next = project_common_position_to_clipspace(vec4(nextPos, 1.0));\n geometry.position = vec4(currPos, 1.0);\n }\n\n // Multiply out width and clamp to limits\n // mercator pixels are interpreted as screen pixels\n float widthPixels = clamp(\n project_size_to_pixel(instanceWidths * arc.widthScale, arc.widthUnits),\n arc.widthMinPixels, arc.widthMaxPixels\n );\n\n // extrude\n vec3 offset = vec3(\n getExtrusionOffset((next.xy - curr.xy) * indexDir, segmentSide, widthPixels),\n 0.0);\n DECKGL_FILTER_SIZE(offset, geometry);\n DECKGL_FILTER_GL_POSITION(curr, geometry);\n gl_Position = curr + vec4(project_pixel_size_to_clipspace(offset.xy), 0.0, 0.0);\n\n vec4 color = mix(instanceSourceColors, instanceTargetColors, segmentRatio);\n vColor = vec4(color.rgb, color.a * layer.opacity);\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n`;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport default `\\\n#version 300 es\n#define SHADER_NAME arc-layer-fragment-shader\n\nprecision highp float;\n\nin vec4 vColor;\nin vec2 uv;\nin float isValid;\n\nout vec4 fragColor;\n\nvoid main(void) {\n if (isValid == 0.0) {\n discard;\n }\n\n fragColor = vColor;\n geometry.uv = uv;\n\n DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n`;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {\n Layer,\n project32,\n picking,\n CoordinateSystem,\n COORDINATE_SYSTEM,\n LayerProps,\n PickingInfo,\n GetPickingInfoParams,\n UpdateParameters,\n Color,\n TextureSource,\n Position,\n DefaultProps\n} from '@deck.gl/core';\nimport {Model} from '@luma.gl/engine';\nimport type {SamplerProps, Texture} from '@luma.gl/core';\nimport {lngLatToWorld} from '@math.gl/web-mercator';\n\nimport createMesh from './create-mesh';\n\nimport {bitmapUniforms, BitmapProps} from './bitmap-layer-uniforms';\nimport vs from './bitmap-layer-vertex';\nimport fs from './bitmap-layer-fragment';\n\nconst defaultProps: DefaultProps = {\n image: {type: 'image', value: null, async: true},\n bounds: {type: 'array', value: [1, 0, 0, 1], compare: true},\n _imageCoordinateSystem: COORDINATE_SYSTEM.DEFAULT,\n\n desaturate: {type: 'number', min: 0, max: 1, value: 0},\n // More context: because of the blending mode we're using for ground imagery,\n // alpha is not effective when blending the bitmap layers with the base map.\n // Instead we need to manually dim/blend rgb values with a background color.\n transparentColor: {type: 'color', value: [0, 0, 0, 0]},\n tintColor: {type: 'color', value: [255, 255, 255]},\n\n textureParameters: {type: 'object', ignore: true, value: null}\n};\n\n/** All properties supported by BitmapLayer. */\nexport type BitmapLayerProps = _BitmapLayerProps & LayerProps;\nexport type BitmapBoundingBox =\n | [left: number, bottom: number, right: number, top: number]\n | [Position, Position, Position, Position];\n\n/** Properties added by BitmapLayer. */\ntype _BitmapLayerProps = {\n data: never;\n /**\n * The image to display.\n *\n * @default null\n */\n image?: string | TextureSource | null;\n\n /**\n * Supported formats:\n * - Coordinates of the bounding box of the bitmap `[left, bottom, right, top]`\n * - Coordinates of four corners of the bitmap, should follow the sequence of `[[left, bottom], [left, top], [right, top], [right, bottom]]`.\n * Each position could optionally contain a third component `z`.\n * @default [1, 0, 0, 1]\n */\n bounds?: BitmapBoundingBox;\n\n /**\n * > Note: this prop is experimental.\n *\n * Specifies how image coordinates should be geographically interpreted.\n * @default COORDINATE_SYSTEM.DEFAULT\n */\n _imageCoordinateSystem?: CoordinateSystem;\n\n /**\n * The desaturation of the bitmap. Between `[0, 1]`.\n * @default 0\n */\n desaturate?: number;\n\n /**\n * The color to use for transparent pixels, in `[r, g, b, a]`.\n * @default [0, 0, 0, 0]\n */\n transparentColor?: Color;\n\n /**\n * The color to tint the bitmap by, in `[r, g, b]`.\n * @default [255, 255, 255]\n */\n tintColor?: Color;\n\n /** Customize the [texture parameters](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/texParameter). */\n textureParameters?: SamplerProps | null;\n};\n\nexport type BitmapLayerPickingInfo = PickingInfo<\n null,\n {\n bitmap: {\n /** Size of the original image */\n size: {\n width: number;\n height: number;\n };\n /** Hovered pixel uv in 0-1 range */\n uv: [number, number];\n /** Hovered pixel in the original image */\n pixel: [number, number];\n } | null;\n }\n>;\n\n/** Render a bitmap at specified boundaries. */\nexport default class BitmapLayer extends Layer<\n ExtraPropsT & Required<_BitmapLayerProps>\n> {\n static layerName = 'BitmapLayer';\n static defaultProps = defaultProps;\n\n state!: {\n disablePicking?: boolean;\n model?: Model;\n mesh?: any;\n coordinateConversion: number;\n bounds: [number, number, number, number];\n };\n\n getShaders() {\n return super.getShaders({vs, fs, modules: [project32, picking, bitmapUniforms]});\n }\n\n initializeState() {\n const attributeManager = this.getAttributeManager()!;\n\n attributeManager.remove(['instancePickingColors']);\n const noAlloc = true;\n\n attributeManager.add({\n indices: {\n size: 1,\n isIndexed: true,\n update: attribute => (attribute.value = this.state.mesh.indices),\n noAlloc\n },\n positions: {\n size: 3,\n type: 'float64',\n fp64: this.use64bitPositions(),\n update: attribute => (attribute.value = this.state.mesh.positions),\n noAlloc\n },\n texCoords: {\n size: 2,\n update: attribute => (attribute.value = this.state.mesh.texCoords),\n noAlloc\n }\n });\n }\n\n updateState({props, oldProps, changeFlags}: UpdateParameters): void {\n // setup model first\n const attributeManager = this.getAttributeManager()!;\n\n if (changeFlags.extensionsChanged) {\n this.state.model?.destroy();\n this.state.model = this._getModel();\n attributeManager.invalidateAll();\n }\n\n if (props.bounds !== oldProps.bounds) {\n const oldMesh = this.state.mesh;\n const mesh = this._createMesh();\n this.state.model!.setVertexCount(mesh.vertexCount);\n for (const key in mesh) {\n if (oldMesh && oldMesh[key] !== mesh[key]) {\n attributeManager.invalidate(key);\n }\n }\n this.setState({mesh, ...this._getCoordinateUniforms()});\n } else if (props._imageCoordinateSystem !== oldProps._imageCoordinateSystem) {\n this.setState(this._getCoordinateUniforms());\n }\n }\n\n getPickingInfo(params: GetPickingInfoParams): BitmapLayerPickingInfo {\n const {image} = this.props;\n const info = params.info as BitmapLayerPickingInfo;\n\n if (!info.color || !image) {\n info.bitmap = null;\n return info;\n }\n\n const {width, height} = image as Texture;\n\n // Picking color doesn't represent object index in this layer\n info.index = 0;\n\n // Calculate uv and pixel in bitmap\n const uv = unpackUVsFromRGB(info.color);\n\n info.bitmap = {\n size: {width, height},\n uv,\n pixel: [Math.floor(uv[0] * width), Math.floor(uv[1] * height)]\n };\n\n return info;\n }\n\n // Override base Layer multi-depth picking logic\n disablePickingIndex() {\n this.setState({disablePicking: true});\n }\n\n restorePickingColors() {\n this.setState({disablePicking: false});\n }\n\n protected _updateAutoHighlight(info) {\n super._updateAutoHighlight({\n ...info,\n color: this.encodePickingColor(0)\n });\n }\n\n protected _createMesh() {\n const {bounds} = this.props;\n\n let normalizedBounds = bounds;\n // bounds as [minX, minY, maxX, maxY]\n if (isRectangularBounds(bounds)) {\n /*\n (minX0, maxY3) ---- (maxX2, maxY3)\n | |\n | |\n | |\n (minX0, minY1) ---- (maxX2, minY1)\n */\n normalizedBounds = [\n [bounds[0], bounds[1]],\n [bounds[0], bounds[3]],\n [bounds[2], bounds[3]],\n [bounds[2], bounds[1]]\n ];\n }\n\n return createMesh(normalizedBounds, this.context.viewport.resolution);\n }\n\n protected _getModel(): Model {\n /*\n 0,0 --- 1,0\n | |\n 0,1 --- 1,1\n */\n return new Model(this.context.device, {\n ...this.getShaders(),\n id: this.props.id,\n bufferLayout: this.getAttributeManager()!.getBufferLayouts(),\n topology: 'triangle-list',\n isInstanced: false\n });\n }\n\n draw(opts) {\n const {shaderModuleProps} = opts;\n const {model, coordinateConversion, bounds, disablePicking} = this.state;\n const {image, desaturate, transparentColor, tintColor} = this.props;\n\n if (shaderModuleProps.picking.isActive && disablePicking) {\n return;\n }\n\n // // TODO fix zFighting\n // Render the image\n if (image && model) {\n const bitmapProps: BitmapProps = {\n bitmapTexture: image as Texture,\n bounds,\n coordinateConversion,\n desaturate,\n tintColor: tintColor.slice(0, 3).map(x => x / 255) as [number, number, number],\n transparentColor: transparentColor.map(x => x / 255) as [number, number, number, number]\n };\n model.shaderInputs.setProps({bitmap: bitmapProps});\n model.draw(this.context.renderPass);\n }\n }\n\n _getCoordinateUniforms() {\n const {LNGLAT, CARTESIAN, DEFAULT} = COORDINATE_SYSTEM;\n let {_imageCoordinateSystem: imageCoordinateSystem} = this.props;\n if (imageCoordinateSystem !== DEFAULT) {\n const {bounds} = this.props;\n if (!isRectangularBounds(bounds)) {\n throw new Error('_imageCoordinateSystem only supports rectangular bounds');\n }\n\n // The default behavior (linearly interpolated tex coords)\n const defaultImageCoordinateSystem = this.context.viewport.resolution ? LNGLAT : CARTESIAN;\n imageCoordinateSystem = imageCoordinateSystem === LNGLAT ? LNGLAT : CARTESIAN;\n\n if (imageCoordinateSystem === LNGLAT && defaultImageCoordinateSystem === CARTESIAN) {\n // LNGLAT in Mercator, e.g. display LNGLAT-encoded image in WebMercator projection\n return {coordinateConversion: -1, bounds};\n }\n if (imageCoordinateSystem === CARTESIAN && defaultImageCoordinateSystem === LNGLAT) {\n // Mercator in LNGLAT, e.g. display WebMercator encoded image in Globe projection\n const bottomLeft = lngLatToWorld([bounds[0], bounds[1]]);\n const topRight = lngLatToWorld([bounds[2], bounds[3]]);\n return {\n coordinateConversion: 1,\n bounds: [bottomLeft[0], bottomLeft[1], topRight[0], topRight[1]]\n };\n }\n }\n return {\n coordinateConversion: 0,\n bounds: [0, 0, 0, 0]\n };\n }\n}\n\n/**\n * Decode uv floats from rgb bytes where b contains 4-bit fractions of uv\n * @param {number[]} color\n * @returns {number[]} uvs\n * https://stackoverflow.com/questions/30242013/glsl-compressing-packing-multiple-0-1-colours-var4-into-a-single-var4-variab\n */\nfunction unpackUVsFromRGB(color: Uint8Array): [number, number] {\n const [u, v, fracUV] = color;\n const vFrac = (fracUV & 0xf0) / 256;\n const uFrac = (fracUV & 0x0f) / 16;\n return [(u + uFrac) / 256, (v + vFrac) / 256];\n}\n\nfunction isRectangularBounds(\n bounds: [number, number, number, number] | [Position, Position, Position, Position]\n): bounds is [number, number, number, number] {\n return Number.isFinite(bounds[0]);\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {lerp} from '@math.gl/core';\n\nconst DEFAULT_INDICES = new Uint32Array([0, 2, 1, 0, 3, 2]);\nconst DEFAULT_TEX_COORDS = new Float32Array([0, 1, 0, 0, 1, 0, 1, 1]);\n\n/*\n 1 ---- 2\n | |\n | |\n 0 ---- 3\n*/\n/* eslint-disable max-statements */\nexport default function createMesh(bounds, resolution) {\n if (!resolution) {\n return createQuad(bounds);\n }\n const maxXSpan = Math.max(\n Math.abs(bounds[0][0] - bounds[3][0]),\n Math.abs(bounds[1][0] - bounds[2][0])\n );\n const maxYSpan = Math.max(\n Math.abs(bounds[1][1] - bounds[0][1]),\n Math.abs(bounds[2][1] - bounds[3][1])\n );\n const uCount = Math.ceil(maxXSpan / resolution) + 1;\n const vCount = Math.ceil(maxYSpan / resolution) + 1;\n\n const vertexCount = (uCount - 1) * (vCount - 1) * 6;\n const indices = new Uint32Array(vertexCount);\n const texCoords = new Float32Array(uCount * vCount * 2);\n const positions = new Float64Array(uCount * vCount * 3);\n\n // Tesselate\n let vertex = 0;\n let index = 0;\n for (let u = 0; u < uCount; u++) {\n const ut = u / (uCount - 1);\n for (let v = 0; v < vCount; v++) {\n const vt = v / (vCount - 1);\n const p = interpolateQuad(bounds, ut, vt);\n\n positions[vertex * 3 + 0] = p[0];\n positions[vertex * 3 + 1] = p[1];\n positions[vertex * 3 + 2] = p[2] || 0;\n\n texCoords[vertex * 2 + 0] = ut;\n texCoords[vertex * 2 + 1] = 1 - vt;\n\n if (u > 0 && v > 0) {\n indices[index++] = vertex - vCount;\n indices[index++] = vertex - vCount - 1;\n indices[index++] = vertex - 1;\n indices[index++] = vertex - vCount;\n indices[index++] = vertex - 1;\n indices[index++] = vertex;\n }\n\n vertex++;\n }\n }\n return {\n vertexCount,\n positions,\n indices,\n texCoords\n };\n}\n\nfunction createQuad(bounds) {\n const positions = new Float64Array(12);\n // [[minX, minY], [minX, maxY], [maxX, maxY], [maxX, minY]]\n for (let i = 0; i < bounds.length; i++) {\n positions[i * 3 + 0] = bounds[i][0];\n positions[i * 3 + 1] = bounds[i][1];\n positions[i * 3 + 2] = bounds[i][2] || 0;\n }\n\n return {\n vertexCount: 6,\n positions,\n indices: DEFAULT_INDICES,\n texCoords: DEFAULT_TEX_COORDS\n };\n}\n\nfunction interpolateQuad(quad, ut, vt) {\n return lerp(lerp(quad[0], quad[1], vt), lerp(quad[3], quad[2], vt), ut);\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Texture} from '@luma.gl/core';\nimport type {ShaderModule} from '@luma.gl/shadertools';\n\nconst uniformBlock = `\\\nuniform bitmapUniforms {\n vec4 bounds;\n float coordinateConversion;\n float desaturate;\n vec3 tintColor;\n vec4 transparentColor;\n} bitmap;\n`;\n\nexport type BitmapProps = {\n bounds: [number, number, number, number];\n coordinateConversion: number;\n desaturate: number;\n tintColor: [number, number, number];\n transparentColor: [number, number, number, number];\n bitmapTexture: Texture;\n};\n\nexport const bitmapUniforms = {\n name: 'bitmap',\n vs: uniformBlock,\n fs: uniformBlock,\n uniformTypes: {\n bounds: 'vec4',\n coordinateConversion: 'f32',\n desaturate: 'f32',\n tintColor: 'vec3',\n transparentColor: 'vec4'\n }\n} as const satisfies ShaderModule;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport default `\\\n#version 300 es\n#define SHADER_NAME bitmap-layer-vertex-shader\n\nin vec2 texCoords;\nin vec3 positions;\nin vec3 positions64Low;\n\nout vec2 vTexCoord;\nout vec2 vTexPos;\n\nconst vec3 pickingColor = vec3(1.0, 0.0, 0.0);\n\nvoid main(void) {\n geometry.worldPosition = positions;\n geometry.uv = texCoords;\n geometry.pickingColor = pickingColor;\n\n gl_Position = project_position_to_clipspace(positions, positions64Low, vec3(0.0), geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n\n vTexCoord = texCoords;\n\n if (bitmap.coordinateConversion < -0.5) {\n vTexPos = geometry.position.xy + project.commonOrigin.xy;\n } else if (bitmap.coordinateConversion > 0.5) {\n vTexPos = geometry.worldPosition.xy;\n }\n\n vec4 color = vec4(0.0);\n DECKGL_FILTER_COLOR(color, geometry);\n}\n`;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/**\n * Pack the top 12 bits of two normalized floats into 3 8-bit (rgb) values\n * This enables addressing 4096x4096 individual pixels\n *\n * returns vec3 encoded RGB colors\n * result.r - top 8 bits of u\n * result.g - top 8 bits of v\n * result.b - next 4 bits of u and v: (u + v * 16)\n */\nconst packUVsIntoRGB = `\nvec3 packUVsIntoRGB(vec2 uv) {\n // Extract the top 8 bits. We want values to be truncated down so we can add a fraction\n vec2 uv8bit = floor(uv * 256.);\n\n // Calculate the normalized remainders of u and v parts that do not fit into 8 bits\n // Scale and clamp to 0-1 range\n vec2 uvFraction = fract(uv * 256.);\n vec2 uvFraction4bit = floor(uvFraction * 16.);\n\n // Remainder can be encoded in blue channel, encode as 4 bits for pixel coordinates\n float fractions = uvFraction4bit.x + uvFraction4bit.y * 16.;\n\n return vec3(uv8bit, fractions) / 255.;\n}\n`;\n\nexport default `\\\n#version 300 es\n#define SHADER_NAME bitmap-layer-fragment-shader\n\n#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform sampler2D bitmapTexture;\n\nin vec2 vTexCoord;\nin vec2 vTexPos;\n\nout vec4 fragColor;\n\n/* projection utils */\nconst float TILE_SIZE = 512.0;\nconst float PI = 3.1415926536;\nconst float WORLD_SCALE = TILE_SIZE / PI / 2.0;\n\n// from degrees to Web Mercator\nvec2 lnglat_to_mercator(vec2 lnglat) {\n float x = lnglat.x;\n float y = clamp(lnglat.y, -89.9, 89.9);\n return vec2(\n radians(x) + PI,\n PI + log(tan(PI * 0.25 + radians(y) * 0.5))\n ) * WORLD_SCALE;\n}\n\n// from Web Mercator to degrees\nvec2 mercator_to_lnglat(vec2 xy) {\n xy /= WORLD_SCALE;\n return degrees(vec2(\n xy.x - PI,\n atan(exp(xy.y - PI)) * 2.0 - PI * 0.5\n ));\n}\n/* End projection utils */\n\n// apply desaturation\nvec3 color_desaturate(vec3 color) {\n float luminance = (color.r + color.g + color.b) * 0.333333333;\n return mix(color, vec3(luminance), bitmap.desaturate);\n}\n\n// apply tint\nvec3 color_tint(vec3 color) {\n return color * bitmap.tintColor;\n}\n\n// blend with background color\nvec4 apply_opacity(vec3 color, float alpha) {\n if (bitmap.transparentColor.a == 0.0) {\n return vec4(color, alpha);\n }\n float blendedAlpha = alpha + bitmap.transparentColor.a * (1.0 - alpha);\n float highLightRatio = alpha / blendedAlpha;\n vec3 blendedRGB = mix(bitmap.transparentColor.rgb, color, highLightRatio);\n return vec4(blendedRGB, blendedAlpha);\n}\n\nvec2 getUV(vec2 pos) {\n return vec2(\n (pos.x - bitmap.bounds[0]) / (bitmap.bounds[2] - bitmap.bounds[0]),\n (pos.y - bitmap.bounds[3]) / (bitmap.bounds[1] - bitmap.bounds[3])\n );\n}\n\n${packUVsIntoRGB}\n\nvoid main(void) {\n vec2 uv = vTexCoord;\n if (bitmap.coordinateConversion < -0.5) {\n vec2 lnglat = mercator_to_lnglat(vTexPos);\n uv = getUV(lnglat);\n } else if (bitmap.coordinateConversion > 0.5) {\n vec2 commonPos = lnglat_to_mercator(vTexPos);\n uv = getUV(commonPos);\n }\n vec4 bitmapColor = texture(bitmapTexture, uv);\n\n fragColor = apply_opacity(color_tint(color_desaturate(bitmapColor.rgb)), bitmapColor.a * layer.opacity);\n\n geometry.uv = uv;\n DECKGL_FILTER_COLOR(fragColor, geometry);\n\n if (bool(picking.isActive) && !bool(picking.isAttribute)) {\n // Since instance information is not used, we can use picking color for pixel index\n fragColor.rgb = packUVsIntoRGB(uv);\n }\n}\n`;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {Layer, project32, picking, log, UNIT} from '@deck.gl/core';\nimport {SamplerProps, Texture} from '@luma.gl/core';\nimport {Model, Geometry} from '@luma.gl/engine';\n\nimport {iconUniforms, IconProps} from './icon-layer-uniforms';\nimport vs from './icon-layer-vertex.glsl';\nimport fs from './icon-layer-fragment.glsl';\nimport IconManager from './icon-manager';\n\nimport type {\n LayerProps,\n LayerDataSource,\n Accessor,\n AccessorFunction,\n Position,\n Color,\n Unit,\n UpdateParameters,\n LayerContext,\n DefaultProps\n} from '@deck.gl/core';\n\nimport type {UnpackedIcon, IconMapping, LoadIconErrorContext} from './icon-manager';\n\ntype _IconLayerProps = {\n data: LayerDataSource;\n /** A prepacked image that contains all icons. */\n iconAtlas?: string | Texture;\n /** Icon names mapped to icon definitions, or a URL to load such mapping from a JSON file. */\n iconMapping?: string | IconMapping;\n\n /** Icon size multiplier.\n * @default 1\n */\n sizeScale?: number;\n /**\n * The units of the icon size, one of `meters`, `common`, and `pixels`.\n *\n * @default 'pixels'\n */\n sizeUnits?: Unit;\n /**\n * The minimum size in pixels. When using non-pixel `sizeUnits`, this prop can be used to prevent the icon from getting too small when zoomed out.\n */\n sizeMinPixels?: number;\n /**\n * The maximum size in pixels. When using non-pixel `sizeUnits`, this prop can be used to prevent the icon from getting too big when zoomed in.\n */\n sizeMaxPixels?: number;\n /** If `true`, the icon always faces camera. Otherwise the icon faces up (z)\n * @default true\n */\n billboard?: boolean;\n /**\n * Discard pixels whose opacity is below this threshold.\n * A discarded pixel would create a \"hole\" in the icon that is not considered part of the object.\n * @default 0.05\n */\n alphaCutoff?: number;\n\n /** Anchor position accessor. */\n getPosition?: Accessor;\n /** Icon definition accessor.\n * Should return the icon id if using pre-packed icons (`iconAtlas` + `iconMapping`).\n * Return an object that defines the icon if using auto-packing.\n */\n getIcon?: AccessorFunction | AccessorFunction;\n /** Icon color accessor.\n * @default [0, 0, 0, 255]\n */\n getColor?: Accessor;\n /** Icon size accessor.\n * @default 1\n */\n getSize?: Accessor;\n /** Icon rotation accessor, in degrees.\n * @default 0\n */\n getAngle?: Accessor;\n /**\n * Icon offsest accessor, in pixels.\n * @default [0, 0]\n */\n getPixelOffset?: Accessor;\n /**\n * Callback called if the attempt to fetch an icon returned by `getIcon` fails.\n */\n onIconError?: ((context: LoadIconErrorContext) => void) | null;\n\n /** Customize the [texture parameters](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/texParameter). */\n textureParameters?: SamplerProps | null;\n};\n\nexport type IconLayerProps = _IconLayerProps & LayerProps;\n\nconst DEFAULT_COLOR: [number, number, number, number] = [0, 0, 0, 255];\n\nconst defaultProps: DefaultProps = {\n iconAtlas: {type: 'image', value: null, async: true},\n iconMapping: {type: 'object', value: {}, async: true},\n sizeScale: {type: 'number', value: 1, min: 0},\n billboard: true,\n sizeUnits: 'pixels',\n sizeMinPixels: {type: 'number', min: 0, value: 0}, // min point radius in pixels\n sizeMaxPixels: {type: 'number', min: 0, value: Number.MAX_SAFE_INTEGER}, // max point radius in pixels\n alphaCutoff: {type: 'number', value: 0.05, min: 0, max: 1},\n\n getPosition: {type: 'accessor', value: (x: any) => x.position},\n getIcon: {type: 'accessor', value: (x: any) => x.icon},\n getColor: {type: 'accessor', value: DEFAULT_COLOR},\n getSize: {type: 'accessor', value: 1},\n getAngle: {type: 'accessor', value: 0},\n getPixelOffset: {type: 'accessor', value: [0, 0]},\n\n onIconError: {type: 'function', value: null, optional: true},\n\n textureParameters: {type: 'object', ignore: true, value: null}\n};\n\n/** Render raster icons at given coordinates. */\nexport default class IconLayer extends Layer<\n ExtraPropsT & Required<_IconLayerProps>\n> {\n static defaultProps = defaultProps;\n static layerName = 'IconLayer';\n\n state!: {\n model?: Model;\n iconManager: IconManager;\n };\n\n getShaders() {\n return super.getShaders({vs, fs, modules: [project32, picking, iconUniforms]});\n }\n\n initializeState() {\n this.state = {\n iconManager: new IconManager(this.context.device, {\n onUpdate: this._onUpdate.bind(this),\n onError: this._onError.bind(this)\n })\n };\n\n const attributeManager = this.getAttributeManager();\n /* eslint-disable max-len */\n attributeManager!.addInstanced({\n instancePositions: {\n size: 3,\n type: 'float64',\n fp64: this.use64bitPositions(),\n transition: true,\n accessor: 'getPosition'\n },\n instanceSizes: {\n size: 1,\n transition: true,\n accessor: 'getSize',\n defaultValue: 1\n },\n instanceOffsets: {\n size: 2,\n accessor: 'getIcon',\n // eslint-disable-next-line @typescript-eslint/unbound-method\n transform: this.getInstanceOffset\n },\n instanceIconFrames: {\n size: 4,\n accessor: 'getIcon',\n // eslint-disable-next-line @typescript-eslint/unbound-method\n transform: this.getInstanceIconFrame\n },\n instanceColorModes: {\n size: 1,\n type: 'uint8',\n accessor: 'getIcon',\n // eslint-disable-next-line @typescript-eslint/unbound-method\n transform: this.getInstanceColorMode\n },\n instanceColors: {\n size: this.props.colorFormat.length,\n type: 'unorm8',\n transition: true,\n accessor: 'getColor',\n defaultValue: DEFAULT_COLOR\n },\n instanceAngles: {\n size: 1,\n transition: true,\n accessor: 'getAngle'\n },\n instancePixelOffset: {\n size: 2,\n transition: true,\n accessor: 'getPixelOffset'\n }\n });\n /* eslint-enable max-len */\n }\n\n /* eslint-disable max-statements, complexity */\n updateState(params: UpdateParameters) {\n super.updateState(params);\n const {props, oldProps, changeFlags} = params;\n\n const attributeManager = this.getAttributeManager();\n const {iconAtlas, iconMapping, data, getIcon, textureParameters} = props;\n const {iconManager} = this.state;\n\n if (typeof iconAtlas === 'string') {\n return;\n }\n\n // internalState is always defined during updateState\n const prePacked = iconAtlas || this.internalState!.isAsyncPropLoading('iconAtlas');\n iconManager.setProps({\n loadOptions: props.loadOptions,\n autoPacking: !prePacked,\n iconAtlas,\n iconMapping: prePacked ? (iconMapping as IconMapping) : null,\n textureParameters\n });\n\n // prepacked iconAtlas from user\n if (prePacked) {\n if (oldProps.iconMapping !== props.iconMapping) {\n attributeManager!.invalidate('getIcon');\n }\n } else if (\n changeFlags.dataChanged ||\n (changeFlags.updateTriggersChanged &&\n (changeFlags.updateTriggersChanged.all || changeFlags.updateTriggersChanged.getIcon))\n ) {\n // Auto packing - getIcon is expected to return an object\n iconManager.packIcons(data, getIcon as AccessorFunction);\n }\n\n if (changeFlags.extensionsChanged) {\n this.state.model?.destroy();\n this.state.model = this._getModel();\n attributeManager!.invalidateAll();\n }\n }\n /* eslint-enable max-statements, complexity */\n\n get isLoaded(): boolean {\n return super.isLoaded && this.state.iconManager.isLoaded;\n }\n\n finalizeState(context: LayerContext): void {\n super.finalizeState(context);\n // Release resources held by the icon manager\n this.state.iconManager.finalize();\n }\n\n draw({uniforms}): void {\n const {sizeScale, sizeMinPixels, sizeMaxPixels, sizeUnits, billboard, alphaCutoff} = this.props;\n const {iconManager} = this.state;\n\n const iconsTexture = iconManager.getTexture();\n if (iconsTexture) {\n const model = this.state.model!;\n const iconProps: IconProps = {\n iconsTexture,\n iconsTextureDim: [iconsTexture.width, iconsTexture.height],\n sizeUnits: UNIT[sizeUnits],\n sizeScale,\n sizeMinPixels,\n sizeMaxPixels,\n billboard,\n alphaCutoff\n };\n\n model.shaderInputs.setProps({icon: iconProps});\n model.draw(this.context.renderPass);\n }\n }\n\n protected _getModel(): Model {\n // The icon-layer vertex shader uses 2d positions\n // specifed via: in vec2 positions;\n const positions = [-1, -1, 1, -1, -1, 1, 1, 1];\n\n return new Model(this.context.device, {\n ...this.getShaders(),\n id: this.props.id,\n bufferLayout: this.getAttributeManager()!.getBufferLayouts(),\n geometry: new Geometry({\n topology: 'triangle-strip',\n attributes: {\n // The size must be explicitly passed here otherwise luma.gl\n // will default to assuming that positions are 3D (x,y,z)\n positions: {\n size: 2,\n value: new Float32Array(positions)\n }\n }\n }),\n isInstanced: true\n });\n }\n\n private _onUpdate(): void {\n this.setNeedsRedraw();\n }\n\n private _onError(evt: LoadIconErrorContext): void {\n const onIconError = this.getCurrentLayer()?.props.onIconError;\n if (onIconError) {\n onIconError(evt);\n } else {\n log.error(evt.error.message)();\n }\n }\n\n protected getInstanceOffset(icon: string): number[] {\n const {\n width,\n height,\n anchorX = width / 2,\n anchorY = height / 2\n } = this.state.iconManager.getIconMapping(icon);\n return [width / 2 - anchorX, height / 2 - anchorY];\n }\n\n protected getInstanceColorMode(icon: string): number {\n const mapping = this.state.iconManager.getIconMapping(icon);\n return mapping.mask ? 1 : 0;\n }\n\n protected getInstanceIconFrame(icon: string): number[] {\n const {x, y, width, height} = this.state.iconManager.getIconMapping(icon);\n return [x, y, width, height];\n }\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderModule} from '@luma.gl/shadertools';\nimport {Texture} from '@luma.gl/core';\n\nconst uniformBlock = `\\\nuniform iconUniforms {\n float sizeScale;\n vec2 iconsTextureDim;\n float sizeMinPixels;\n float sizeMaxPixels;\n bool billboard;\n highp int sizeUnits;\n float alphaCutoff;\n} icon;\n`;\n\ntype IconBindingProps = {\n iconsTexture: Texture;\n};\n\ntype IconUniformProps = {\n sizeScale: number;\n iconsTextureDim: [number, number];\n sizeMinPixels: number;\n sizeMaxPixels: number;\n billboard: boolean;\n sizeUnits: number;\n alphaCutoff: number;\n};\n\nexport type IconProps = IconBindingProps & IconUniformProps;\n\nexport const iconUniforms = {\n name: 'icon',\n vs: uniformBlock,\n fs: uniformBlock,\n uniformTypes: {\n sizeScale: 'f32',\n iconsTextureDim: 'vec2',\n sizeMinPixels: 'f32',\n sizeMaxPixels: 'f32',\n billboard: 'f32',\n sizeUnits: 'i32',\n alphaCutoff: 'f32'\n }\n} as const satisfies ShaderModule;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport default `\\\n#version 300 es\n#define SHADER_NAME icon-layer-vertex-shader\n\nin vec2 positions;\n\nin vec3 instancePositions;\nin vec3 instancePositions64Low;\nin float instanceSizes;\nin float instanceAngles;\nin vec4 instanceColors;\nin vec3 instancePickingColors;\nin vec4 instanceIconFrames;\nin float instanceColorModes;\nin vec2 instanceOffsets;\nin vec2 instancePixelOffset;\n\nout float vColorMode;\nout vec4 vColor;\nout vec2 vTextureCoords;\nout vec2 uv;\n\nvec2 rotate_by_angle(vec2 vertex, float angle) {\n float angle_radian = angle * PI / 180.0;\n float cos_angle = cos(angle_radian);\n float sin_angle = sin(angle_radian);\n mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle);\n return rotationMatrix * vertex;\n}\n\nvoid main(void) {\n geometry.worldPosition = instancePositions;\n geometry.uv = positions;\n geometry.pickingColor = instancePickingColors;\n uv = positions;\n\n vec2 iconSize = instanceIconFrames.zw;\n // convert size in meters to pixels, then scaled and clamp\n \n // project meters to pixels and clamp to limits \n float sizePixels = clamp(\n project_size_to_pixel(instanceSizes * icon.sizeScale, icon.sizeUnits),\n icon.sizeMinPixels, icon.sizeMaxPixels\n );\n\n // scale icon height to match instanceSize\n float instanceScale = iconSize.y == 0.0 ? 0.0 : sizePixels / iconSize.y;\n\n // scale and rotate vertex in \"pixel\" value and convert back to fraction in clipspace\n vec2 pixelOffset = positions / 2.0 * iconSize + instanceOffsets;\n pixelOffset = rotate_by_angle(pixelOffset, instanceAngles) * instanceScale;\n pixelOffset += instancePixelOffset;\n pixelOffset.y *= -1.0;\n\n if (icon.billboard) {\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n vec3 offset = vec3(pixelOffset, 0.0);\n DECKGL_FILTER_SIZE(offset, geometry);\n gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);\n\n } else {\n vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0);\n DECKGL_FILTER_SIZE(offset_common, geometry);\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position); \n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n }\n\n vTextureCoords = mix(\n instanceIconFrames.xy,\n instanceIconFrames.xy + iconSize,\n (positions.xy + 1.0) / 2.0\n ) / icon.iconsTextureDim;\n\n vColor = instanceColors;\n DECKGL_FILTER_COLOR(vColor, geometry);\n\n vColorMode = instanceColorModes;\n}\n`;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport default `\\\n#version 300 es\n#define SHADER_NAME icon-layer-fragment-shader\n\nprecision highp float;\n\nuniform sampler2D iconsTexture;\n\nin float vColorMode;\nin vec4 vColor;\nin vec2 vTextureCoords;\nin vec2 uv;\n\nout vec4 fragColor;\n\nvoid main(void) {\n geometry.uv = uv;\n\n vec4 texColor = texture(iconsTexture, vTextureCoords);\n\n // if colorMode == 0, use pixel color from the texture\n // if colorMode == 1 or rendering picking buffer, use texture as transparency mask\n vec3 color = mix(texColor.rgb, vColor.rgb, vColorMode);\n // Take the global opacity and the alpha from vColor into account for the alpha component\n float a = texColor.a * layer.opacity * vColor.a;\n\n if (a < icon.alphaCutoff) {\n discard;\n }\n\n fragColor = vec4(color, a);\n DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n`;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/* global document */\nimport {Device, Texture, SamplerProps} from '@luma.gl/core';\nimport {load} from '@loaders.gl/core';\nimport {createIterable} from '@deck.gl/core';\n\nimport type {AccessorFunction} from '@deck.gl/core';\n\nconst DEFAULT_CANVAS_WIDTH = 1024;\nconst DEFAULT_BUFFER = 4;\n\nconst noop = () => {};\n\nconst DEFAULT_SAMPLER_PARAMETERS: SamplerProps = {\n minFilter: 'linear',\n mipmapFilter: 'linear',\n // LINEAR is the default value but explicitly set it here\n magFilter: 'linear',\n // minimize texture boundary artifacts\n addressModeU: 'clamp-to-edge',\n addressModeV: 'clamp-to-edge'\n};\n\ntype IconDef = {\n /** Width of the icon */\n width: number;\n /** Height of the icon */\n height: number;\n /** Horizontal position of icon anchor. Default: half width. */\n anchorX?: number;\n /** Vertical position of icon anchor. Default: half height. */\n anchorY?: number;\n /**\n * Whether the icon is treated as a transparency mask.\n * If `true`, color defined by `getColor` is applied.\n * If `false`, pixel color from the icon image is applied.\n * @default false\n */\n mask?: boolean;\n};\n\nexport type UnpackedIcon = {\n /** Url to fetch the icon */\n url: string;\n /** Unique identifier of the icon. Icons of the same id are only fetched once. Fallback to `url` if not specified. */\n id?: string;\n} & IconDef;\n\ntype PrepackedIcon = {\n /** Left position of the icon on the atlas */\n x: number;\n /** Top position of the icon on the atlas */\n y: number;\n} & IconDef;\n\nconst MISSING_ICON: PrepackedIcon = {\n x: 0,\n y: 0,\n width: 0,\n height: 0\n};\n\nexport type IconMapping = Record;\n\nexport type LoadIconErrorContext = {\n error: Error;\n /** The URL that was trying to fetch */\n url: string;\n /** The original data object that requested this icon */\n source: any;\n /** The index of the original data object that requested this icon */\n sourceIndex: number;\n /** The load options used for the fetch */\n loadOptions: any;\n};\n\nfunction nextPowOfTwo(number: number): number {\n return Math.pow(2, Math.ceil(Math.log2(number)));\n}\n\n// update comment to create a new texture and copy original data.\nfunction resizeImage(\n ctx: CanvasRenderingContext2D,\n imageData: HTMLImageElement | ImageBitmap,\n maxWidth: number,\n maxHeight: number\n): {\n image: HTMLImageElement | HTMLCanvasElement | ImageBitmap;\n width: number;\n height: number;\n} {\n const resizeRatio = Math.min(maxWidth / imageData.width, maxHeight / imageData.height);\n const width = Math.floor(imageData.width * resizeRatio);\n const height = Math.floor(imageData.height * resizeRatio);\n\n if (resizeRatio === 1) {\n // No resizing required\n return {image: imageData, width, height};\n }\n\n ctx.canvas.height = height;\n ctx.canvas.width = width;\n\n ctx.clearRect(0, 0, width, height);\n\n // image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight\n ctx.drawImage(imageData, 0, 0, imageData.width, imageData.height, 0, 0, width, height);\n return {image: ctx.canvas, width, height};\n}\n\nfunction getIconId(icon: UnpackedIcon): string {\n return icon && (icon.id || icon.url);\n}\n\n// resize texture without losing original data\nfunction resizeTexture(\n texture: Texture,\n width: number,\n height: number,\n sampler: SamplerProps\n): Texture {\n const {width: oldWidth, height: oldHeight, device} = texture;\n\n const newTexture = device.createTexture({\n format: 'rgba8unorm',\n width,\n height,\n sampler,\n mipmaps: true\n });\n const commandEncoder = device.createCommandEncoder();\n commandEncoder.copyTextureToTexture({\n sourceTexture: texture,\n destinationTexture: newTexture,\n width: oldWidth,\n height: oldHeight\n });\n commandEncoder.finish();\n\n texture.destroy();\n return newTexture;\n}\n\n// traverse icons in a row of icon atlas\n// extend each icon with left-top coordinates\nfunction buildRowMapping(\n mapping: IconMapping,\n columns: {\n icon: UnpackedIcon;\n xOffset: number;\n }[],\n yOffset: number\n): void {\n for (let i = 0; i < columns.length; i++) {\n const {icon, xOffset} = columns[i];\n const id = getIconId(icon);\n mapping[id] = {\n ...icon,\n x: xOffset,\n y: yOffset\n };\n }\n}\n\n/**\n * Generate coordinate mapping to retrieve icon left-top position from an icon atlas\n */\nexport function buildMapping({\n icons,\n buffer,\n mapping = {},\n xOffset = 0,\n yOffset = 0,\n rowHeight = 0,\n canvasWidth\n}: {\n /** list of icon definitions */\n icons: UnpackedIcon[];\n /** add bleeding buffer to the right and bottom side of the image */\n buffer: number;\n /** right position of last icon in old mapping */\n xOffset: number;\n /** top position in last icon in old mapping */\n yOffset: number;\n /** height of the last icon's row */\n rowHeight: number;\n /** max width of canvas */\n canvasWidth: number;\n mapping: IconMapping;\n}): {\n mapping: IconMapping;\n rowHeight: number;\n xOffset: number;\n yOffset: number;\n canvasWidth: number;\n canvasHeight: number;\n} {\n let columns: {\n icon: UnpackedIcon;\n xOffset: number;\n }[] = [];\n // Strategy to layout all the icons into a texture:\n // traverse the icons sequentially, layout the icons from left to right, top to bottom\n // when the sum of the icons width is equal or larger than canvasWidth,\n // move to next row starting from total height so far plus max height of the icons in previous row\n // row width is equal to canvasWidth\n // row height is decided by the max height of the icons in that row\n // mapping coordinates of each icon is its left-top position in the texture\n for (let i = 0; i < icons.length; i++) {\n const icon = icons[i];\n const id = getIconId(icon);\n\n if (!mapping[id]) {\n const {height, width} = icon;\n\n // fill one row\n if (xOffset + width + buffer > canvasWidth) {\n buildRowMapping(mapping, columns, yOffset);\n\n xOffset = 0;\n yOffset = rowHeight + yOffset + buffer;\n rowHeight = 0;\n columns = [];\n }\n\n columns.push({\n icon,\n xOffset\n });\n\n xOffset = xOffset + width + buffer;\n rowHeight = Math.max(rowHeight, height);\n }\n }\n\n if (columns.length > 0) {\n buildRowMapping(mapping, columns, yOffset);\n }\n\n return {\n mapping,\n rowHeight,\n xOffset,\n yOffset,\n canvasWidth,\n canvasHeight: nextPowOfTwo(rowHeight + yOffset + buffer)\n };\n}\n\n// extract icons from data\n// return icons should be unique, and not cached or cached but url changed\nexport function getDiffIcons(\n data: any,\n getIcon: AccessorFunction | null,\n cachedIcons: Record\n): Record<\n string,\n UnpackedIcon & {\n source: any;\n sourceIndex: number;\n }\n> | null {\n if (!data || !getIcon) {\n return null;\n }\n\n cachedIcons = cachedIcons || {};\n const icons = {};\n const {iterable, objectInfo} = createIterable(data);\n for (const object of iterable) {\n objectInfo.index++;\n const icon = getIcon(object, objectInfo);\n const id = getIconId(icon);\n\n if (!icon) {\n throw new Error('Icon is missing.');\n }\n\n if (!icon.url) {\n throw new Error('Icon url is missing.');\n }\n\n if (!icons[id] && (!cachedIcons[id] || icon.url !== cachedIcons[id].url)) {\n icons[id] = {...icon, source: object, sourceIndex: objectInfo.index};\n }\n }\n return icons;\n}\n\nexport default class IconManager {\n device: Device;\n\n private onUpdate: () => void;\n private onError: (context: LoadIconErrorContext) => void;\n private _loadOptions: any = null;\n private _texture: Texture | null = null;\n private _externalTexture: Texture | null = null;\n private _mapping: IconMapping = {};\n private _samplerParameters: SamplerProps | null = null;\n\n /** count of pending requests to fetch icons */\n private _pendingCount: number = 0;\n\n private _autoPacking: boolean = false;\n\n // / internal state used for autoPacking\n\n private _xOffset: number = 0;\n private _yOffset: number = 0;\n private _rowHeight: number = 0;\n private _buffer: number = DEFAULT_BUFFER;\n private _canvasWidth: number = DEFAULT_CANVAS_WIDTH;\n private _canvasHeight: number = 0;\n private _canvas: HTMLCanvasElement | null = null;\n\n constructor(\n device: Device,\n {\n onUpdate = noop,\n onError = noop\n }: {\n /** Callback when the texture updates */\n onUpdate: () => void;\n /** Callback when an error is encountered */\n onError: (context: LoadIconErrorContext) => void;\n }\n ) {\n this.device = device;\n this.onUpdate = onUpdate;\n this.onError = onError;\n }\n\n finalize(): void {\n this._texture?.delete();\n }\n\n getTexture(): Texture | null {\n return this._texture || this._externalTexture;\n }\n\n getIconMapping(icon: string | UnpackedIcon): PrepackedIcon {\n const id = this._autoPacking ? getIconId(icon as UnpackedIcon) : (icon as string);\n return this._mapping[id] || MISSING_ICON;\n }\n\n setProps({\n loadOptions,\n autoPacking,\n iconAtlas,\n iconMapping,\n textureParameters\n }: {\n loadOptions?: any;\n autoPacking?: boolean;\n iconAtlas?: Texture | null;\n iconMapping?: IconMapping | null;\n textureParameters?: SamplerProps | null;\n }) {\n if (loadOptions) {\n this._loadOptions = loadOptions;\n }\n\n if (autoPacking !== undefined) {\n this._autoPacking = autoPacking;\n }\n\n if (iconMapping) {\n this._mapping = iconMapping;\n }\n\n if (iconAtlas) {\n this._texture?.delete();\n this._texture = null;\n this._externalTexture = iconAtlas;\n }\n\n if (textureParameters) {\n this._samplerParameters = textureParameters;\n }\n }\n\n get isLoaded(): boolean {\n return this._pendingCount === 0;\n }\n\n packIcons(data: any, getIcon: AccessorFunction): void {\n if (!this._autoPacking || typeof document === 'undefined') {\n return;\n }\n\n const icons = Object.values(getDiffIcons(data, getIcon, this._mapping) || {});\n\n if (icons.length > 0) {\n // generate icon mapping\n const {mapping, xOffset, yOffset, rowHeight, canvasHeight} = buildMapping({\n icons,\n buffer: this._buffer,\n canvasWidth: this._canvasWidth,\n mapping: this._mapping,\n rowHeight: this._rowHeight,\n xOffset: this._xOffset,\n yOffset: this._yOffset\n });\n\n this._rowHeight = rowHeight;\n this._mapping = mapping;\n this._xOffset = xOffset;\n this._yOffset = yOffset;\n this._canvasHeight = canvasHeight;\n\n // create new texture\n if (!this._texture) {\n this._texture = this.device.createTexture({\n format: 'rgba8unorm',\n width: this._canvasWidth,\n height: this._canvasHeight,\n sampler: this._samplerParameters || DEFAULT_SAMPLER_PARAMETERS,\n mipmaps: true\n });\n }\n\n if (this._texture.height !== this._canvasHeight) {\n this._texture = resizeTexture(\n this._texture,\n this._canvasWidth,\n this._canvasHeight,\n this._samplerParameters || DEFAULT_SAMPLER_PARAMETERS\n );\n }\n\n this.onUpdate();\n\n // load images\n this._canvas = this._canvas || document.createElement('canvas');\n this._loadIcons(icons);\n }\n }\n\n private _loadIcons(\n icons: (UnpackedIcon & {\n source: any;\n sourceIndex: number;\n })[]\n ): void {\n // This method is only called in the auto packing case, where _canvas is defined\n const ctx = this._canvas!.getContext('2d', {\n willReadFrequently: true\n }) as CanvasRenderingContext2D;\n\n for (const icon of icons) {\n this._pendingCount++;\n load(icon.url, this._loadOptions)\n .then(imageData => {\n const id = getIconId(icon);\n\n const iconDef = this._mapping[id];\n const {x, y, width: maxWidth, height: maxHeight} = iconDef;\n\n const {image, width, height} = resizeImage(\n ctx,\n imageData as ImageBitmap,\n maxWidth,\n maxHeight\n );\n\n this._texture?.copyExternalImage({\n image,\n x: x + (maxWidth - width) / 2,\n y: y + (maxHeight - height) / 2,\n width,\n height\n });\n iconDef.width = width;\n iconDef.height = height;\n\n // Call to regenerate mipmaps after modifying texture(s)\n // @ts-expect-error TODO v9 API not yet clear\n this._texture.generateMipmap();\n\n this.onUpdate();\n })\n .catch(error => {\n this.onError({\n url: icon.url,\n source: icon.source,\n sourceIndex: icon.sourceIndex,\n loadOptions: this._loadOptions,\n error\n });\n })\n .finally(() => {\n this._pendingCount--;\n });\n }\n }\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {\n Layer,\n project32,\n picking,\n UNIT,\n LayerProps,\n LayerDataSource,\n Unit,\n Position,\n Accessor,\n Color,\n UpdateParameters,\n DefaultProps\n} from '@deck.gl/core';\nimport {Geometry} from '@luma.gl/engine';\nimport {Model} from '@luma.gl/engine';\n\nimport {lineUniforms, LineProps} from './line-layer-uniforms';\nimport vs from './line-layer-vertex.glsl';\nimport fs from './line-layer-fragment.glsl';\n\nconst DEFAULT_COLOR: [number, number, number, number] = [0, 0, 0, 255];\n\nconst defaultProps: DefaultProps = {\n getSourcePosition: {type: 'accessor', value: (x: any) => x.sourcePosition},\n getTargetPosition: {type: 'accessor', value: (x: any) => x.targetPosition},\n getColor: {type: 'accessor', value: DEFAULT_COLOR},\n getWidth: {type: 'accessor', value: 1},\n\n widthUnits: 'pixels',\n widthScale: {type: 'number', value: 1, min: 0},\n widthMinPixels: {type: 'number', value: 0, min: 0},\n widthMaxPixels: {type: 'number', value: Number.MAX_SAFE_INTEGER, min: 0}\n};\n\n/** All properties supported by LineLayer. */\nexport type LineLayerProps = _LineLayerProps & LayerProps;\n\n/** Properties added by LineLayer. */\ntype _LineLayerProps = {\n data: LayerDataSource;\n /**\n * The units of the line width, one of `'meters'`, `'common'`, and `'pixels'`.\n * @default 'pixels'\n */\n widthUnits?: Unit;\n\n /**\n * The scaling multiplier for the width of each line.\n * @default 1\n */\n widthScale?: number;\n\n /**\n * The minimum line width in pixels.\n * @default 0\n */\n widthMinPixels?: number;\n\n /**\n * The maximum line width in pixels.\n * @default Number.MAX_SAFE_INTEGER\n */\n widthMaxPixels?: number;\n\n /**\n * Source position of each object.\n * @default object => object.sourcePosition\n */\n getSourcePosition?: Accessor;\n\n /**\n * Target position of each object.\n * @default object => object.targetPosition\n */\n getTargetPosition?: Accessor;\n\n /**\n * The rgba color is in the format of `[r, g, b, [a]]`.\n * @default [0, 0, 0, 255]\n */\n getColor?: Accessor;\n\n /**\n * Width of each object\n * @default 1\n */\n getWidth?: Accessor;\n};\n\n/**\n * A layer that renders straight lines joining pairs of source and target coordinates.\n */\nexport default class LineLayer extends Layer<\n ExtraProps & Required<_LineLayerProps>\n> {\n static layerName = 'LineLayer';\n static defaultProps = defaultProps;\n\n state!: {\n model?: Model;\n };\n\n getBounds(): [number[], number[]] | null {\n return this.getAttributeManager()?.getBounds([\n 'instanceSourcePositions',\n 'instanceTargetPositions'\n ]);\n }\n\n getShaders() {\n return super.getShaders({vs, fs, modules: [project32, picking, lineUniforms]});\n }\n\n // This layer has its own wrapLongitude logic\n get wrapLongitude(): boolean {\n return false;\n }\n\n initializeState() {\n const attributeManager = this.getAttributeManager()!;\n\n /* eslint-disable max-len */\n attributeManager.addInstanced({\n instanceSourcePositions: {\n size: 3,\n type: 'float64',\n fp64: this.use64bitPositions(),\n transition: true,\n accessor: 'getSourcePosition'\n },\n instanceTargetPositions: {\n size: 3,\n type: 'float64',\n fp64: this.use64bitPositions(),\n transition: true,\n accessor: 'getTargetPosition'\n },\n instanceColors: {\n size: this.props.colorFormat.length,\n type: 'unorm8',\n transition: true,\n accessor: 'getColor',\n defaultValue: [0, 0, 0, 255]\n },\n instanceWidths: {\n size: 1,\n transition: true,\n accessor: 'getWidth',\n defaultValue: 1\n }\n });\n /* eslint-enable max-len */\n }\n\n updateState(params: UpdateParameters): void {\n super.updateState(params);\n\n if (params.changeFlags.extensionsChanged) {\n this.state.model?.destroy();\n this.state.model = this._getModel();\n this.getAttributeManager()!.invalidateAll();\n }\n }\n\n draw({uniforms}): void {\n const {widthUnits, widthScale, widthMinPixels, widthMaxPixels, wrapLongitude} = this.props;\n const model = this.state.model!;\n const lineProps: LineProps = {\n widthUnits: UNIT[widthUnits],\n widthScale,\n widthMinPixels,\n widthMaxPixels,\n useShortestPath: wrapLongitude ? 1 : 0\n };\n model.shaderInputs.setProps({line: lineProps});\n model.draw(this.context.renderPass);\n\n if (wrapLongitude) {\n // Render a second copy for the clipped lines at the 180th meridian\n model.shaderInputs.setProps({line: {...lineProps, useShortestPath: -1}});\n model.draw(this.context.renderPass);\n }\n }\n\n protected _getModel(): Model {\n /*\n * (0, -1)-------------_(1, -1)\n * | _,-\" |\n * o _,-\" o\n * | _,-\" |\n * (0, 1)\"-------------(1, 1)\n */\n const positions = [0, -1, 0, 0, 1, 0, 1, -1, 0, 1, 1, 0];\n\n return new Model(this.context.device, {\n ...this.getShaders(),\n id: this.props.id,\n bufferLayout: this.getAttributeManager()!.getBufferLayouts(),\n geometry: new Geometry({\n topology: 'triangle-strip',\n attributes: {\n positions: {size: 3, value: new Float32Array(positions)}\n }\n }),\n isInstanced: true\n });\n }\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderModule} from '@luma.gl/shadertools';\n\nconst uniformBlock = `\\\nuniform lineUniforms {\n float widthScale;\n float widthMinPixels;\n float widthMaxPixels;\n float useShortestPath;\n highp int widthUnits;\n} line;\n`;\n\nexport type LineProps = {\n widthScale: number;\n widthMinPixels: number;\n widthMaxPixels: number;\n useShortestPath: number;\n widthUnits: number;\n};\n\nexport const lineUniforms = {\n name: 'line',\n vs: uniformBlock,\n fs: uniformBlock,\n uniformTypes: {\n widthScale: 'f32',\n widthMinPixels: 'f32',\n widthMaxPixels: 'f32',\n useShortestPath: 'f32',\n widthUnits: 'i32'\n }\n} as const satisfies ShaderModule;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport default `\\\n#version 300 es\n#define SHADER_NAME line-layer-vertex-shader\n\nin vec3 positions;\nin vec3 instanceSourcePositions;\nin vec3 instanceTargetPositions;\nin vec3 instanceSourcePositions64Low;\nin vec3 instanceTargetPositions64Low;\nin vec4 instanceColors;\nin vec3 instancePickingColors;\nin float instanceWidths;\n\nout vec4 vColor;\nout vec2 uv;\n\n// offset vector by strokeWidth pixels\n// offset_direction is -1 (left) or 1 (right)\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction, float width) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace * project.viewportSize);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n\n return dir_screenspace * offset_direction * width / 2.0;\n}\n\nvec3 splitLine(vec3 a, vec3 b, float x) {\n float t = (x - a.x) / (b.x - a.x);\n return vec3(x, mix(a.yz, b.yz, t));\n}\n\nvoid main(void) {\n geometry.worldPosition = instanceSourcePositions;\n geometry.worldPositionAlt = instanceTargetPositions;\n\n vec3 source_world = instanceSourcePositions;\n vec3 target_world = instanceTargetPositions;\n vec3 source_world_64low = instanceSourcePositions64Low;\n vec3 target_world_64low = instanceTargetPositions64Low;\n\n if (line.useShortestPath > 0.5 || line.useShortestPath < -0.5) {\n source_world.x = mod(source_world.x + 180., 360.0) - 180.;\n target_world.x = mod(target_world.x + 180., 360.0) - 180.;\n float deltaLng = target_world.x - source_world.x;\n\n if (deltaLng * line.useShortestPath > 180.) {\n source_world.x += 360. * line.useShortestPath;\n source_world = splitLine(source_world, target_world, 180. * line.useShortestPath);\n source_world_64low = vec3(0.0);\n } else if (deltaLng * line.useShortestPath < -180.) {\n target_world.x += 360. * line.useShortestPath;\n target_world = splitLine(source_world, target_world, 180. * line.useShortestPath);\n target_world_64low = vec3(0.0);\n } else if (line.useShortestPath < 0.) {\n // Line is not split, abort\n gl_Position = vec4(0.);\n return;\n }\n }\n\n // Position\n vec4 source_commonspace;\n vec4 target_commonspace;\n vec4 source = project_position_to_clipspace(source_world, source_world_64low, vec3(0.), source_commonspace);\n vec4 target = project_position_to_clipspace(target_world, target_world_64low, vec3(0.), target_commonspace);\n \n // linear interpolation of source & target to pick right coord\n float segmentIndex = positions.x;\n vec4 p = mix(source, target, segmentIndex);\n geometry.position = mix(source_commonspace, target_commonspace, segmentIndex);\n uv = positions.xy;\n geometry.uv = uv;\n geometry.pickingColor = instancePickingColors;\n\n // Multiply out width and clamp to limits\n float widthPixels = clamp(\n project_size_to_pixel(instanceWidths * line.widthScale, line.widthUnits),\n line.widthMinPixels, line.widthMaxPixels\n );\n\n // extrude\n vec3 offset = vec3(\n getExtrusionOffset(target.xy - source.xy, positions.y, widthPixels),\n 0.0);\n DECKGL_FILTER_SIZE(offset, geometry);\n DECKGL_FILTER_GL_POSITION(p, geometry);\n gl_Position = p + vec4(project_pixel_size_to_clipspace(offset.xy), 0.0, 0.0);\n\n // Color\n vColor = vec4(instanceColors.rgb, instanceColors.a * layer.opacity);\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n`;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport default `\\\n#version 300 es\n#define SHADER_NAME line-layer-fragment-shader\n\nprecision highp float;\n\nin vec4 vColor;\nin vec2 uv;\n\nout vec4 fragColor;\n\nvoid main(void) {\n geometry.uv = uv;\n\n fragColor = vColor;\n\n DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n`;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {\n Layer,\n project32,\n picking,\n UNIT,\n LayerProps,\n LayerDataSource,\n UpdateParameters,\n Unit,\n AccessorFunction,\n Position,\n Accessor,\n Color,\n Material,\n DefaultProps\n} from '@deck.gl/core';\nimport {Model, Geometry} from '@luma.gl/engine';\nimport {gouraudMaterial} from '@luma.gl/shadertools';\n\nimport {pointCloudUniforms, PointCloudProps} from './point-cloud-layer-uniforms';\nimport vs from './point-cloud-layer-vertex.glsl';\nimport fs from './point-cloud-layer-fragment.glsl';\n\nconst DEFAULT_COLOR: [number, number, number, number] = [0, 0, 0, 255];\nconst DEFAULT_NORMAL: [number, number, number] = [0, 0, 1];\n\nconst defaultProps: DefaultProps = {\n sizeUnits: 'pixels',\n pointSize: {type: 'number', min: 0, value: 10}, // point radius in pixels\n\n getPosition: {type: 'accessor', value: (x: any) => x.position},\n getNormal: {type: 'accessor', value: DEFAULT_NORMAL},\n getColor: {type: 'accessor', value: DEFAULT_COLOR},\n\n material: true,\n\n // Depreated\n radiusPixels: {deprecatedFor: 'pointSize'}\n};\n\n// support loaders.gl point cloud format\nfunction normalizeData(data) {\n const {header, attributes} = data;\n if (!header || !attributes) {\n return;\n }\n\n data.length = header.vertexCount;\n\n if (attributes.POSITION) {\n attributes.instancePositions = attributes.POSITION;\n }\n if (attributes.NORMAL) {\n attributes.instanceNormals = attributes.NORMAL;\n }\n if (attributes.COLOR_0) {\n const {size, value} = attributes.COLOR_0;\n attributes.instanceColors = {size, type: 'unorm8', value};\n }\n}\n\n/** All properties supported by PointCloudLayer. */\nexport type PointCloudLayerProps = _PointCloudLayerProps & LayerProps;\n\n/** Properties added by PointCloudLayer. */\ntype _PointCloudLayerProps = {\n data: LayerDataSource;\n /**\n * The units of the point size, one of `'meters'`, `'common'`, and `'pixels'`.\n * @default 'pixels'\n */\n sizeUnits?: Unit;\n\n /**\n * Global radius of all points, in units specified by `sizeUnits`\n * @default 10\n */\n pointSize?: number;\n\n /**\n * @deprecated Use `pointSize` instead\n */\n radiusPixels?: number;\n\n /**\n * Material settings for lighting effect.\n *\n * @default true\n * @see https://deck.gl/docs/developer-guide/using-lighting\n */\n material?: Material;\n\n /**\n * Method called to retrieve the position of each object.\n * @default object => object.position\n */\n getPosition?: AccessorFunction;\n\n /**\n * The normal of each object, in `[nx, ny, nz]`.\n * @default [0, 0, 1]\n */\n getNormal?: Accessor;\n\n /**\n * The rgba color is in the format of `[r, g, b, [a]]`\n * @default [0, 0, 0, 255]\n */\n getColor?: Accessor;\n};\n\n/** Render a point cloud with 3D positions, normals and colors. */\nexport default class PointCloudLayer extends Layer<\n ExtraPropsT & Required<_PointCloudLayerProps>\n> {\n static layerName = 'PointCloudLayer';\n static defaultProps = defaultProps;\n\n state!: {\n model?: Model;\n };\n\n getShaders() {\n return super.getShaders({\n vs,\n fs,\n modules: [project32, gouraudMaterial, picking, pointCloudUniforms]\n });\n }\n\n initializeState() {\n this.getAttributeManager()!.addInstanced({\n instancePositions: {\n size: 3,\n type: 'float64',\n fp64: this.use64bitPositions(),\n transition: true,\n accessor: 'getPosition'\n },\n instanceNormals: {\n size: 3,\n transition: true,\n accessor: 'getNormal',\n defaultValue: DEFAULT_NORMAL\n },\n instanceColors: {\n size: this.props.colorFormat.length,\n type: 'unorm8',\n transition: true,\n accessor: 'getColor',\n defaultValue: DEFAULT_COLOR\n }\n });\n }\n\n updateState(params: UpdateParameters): void {\n const {changeFlags, props} = params;\n super.updateState(params);\n if (changeFlags.extensionsChanged) {\n this.state.model?.destroy();\n this.state.model = this._getModel();\n this.getAttributeManager()!.invalidateAll();\n }\n if (changeFlags.dataChanged) {\n normalizeData(props.data);\n }\n }\n\n draw({uniforms}) {\n const {pointSize, sizeUnits} = this.props;\n const model = this.state.model!;\n const pointCloudProps: PointCloudProps = {\n sizeUnits: UNIT[sizeUnits],\n radiusPixels: pointSize\n };\n model.shaderInputs.setProps({pointCloud: pointCloudProps});\n model.draw(this.context.renderPass);\n }\n\n protected _getModel(): Model {\n // a triangle that minimally cover the unit circle\n const positions: number[] = [];\n for (let i = 0; i < 3; i++) {\n const angle = (i / 3) * Math.PI * 2;\n positions.push(Math.cos(angle) * 2, Math.sin(angle) * 2, 0);\n }\n\n return new Model(this.context.device, {\n ...this.getShaders(),\n id: this.props.id,\n bufferLayout: this.getAttributeManager()!.getBufferLayouts(),\n geometry: new Geometry({\n topology: 'triangle-list',\n attributes: {\n positions: new Float32Array(positions)\n }\n }),\n isInstanced: true\n });\n }\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderModule} from '@luma.gl/shadertools';\n\nconst uniformBlock = `\\\nuniform pointCloudUniforms {\n float radiusPixels;\n highp int sizeUnits;\n} pointCloud;\n`;\n\nexport type PointCloudProps = {\n radiusPixels: number;\n sizeUnits: number;\n};\n\nexport const pointCloudUniforms = {\n name: 'pointCloud',\n vs: uniformBlock,\n fs: uniformBlock,\n uniformTypes: {\n radiusPixels: 'f32',\n sizeUnits: 'i32'\n }\n} as const satisfies ShaderModule;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport default `\\\n#version 300 es\n#define SHADER_NAME point-cloud-layer-vertex-shader\n\nin vec3 positions;\nin vec3 instanceNormals;\nin vec4 instanceColors;\nin vec3 instancePositions;\nin vec3 instancePositions64Low;\nin vec3 instancePickingColors;\n\nout vec4 vColor;\nout vec2 unitPosition;\n\nvoid main(void) {\n geometry.worldPosition = instancePositions;\n geometry.normal = project_normal(instanceNormals);\n\n // position on the containing square in [-1, 1] space\n unitPosition = positions.xy;\n geometry.uv = unitPosition;\n geometry.pickingColor = instancePickingColors;\n\n // Find the center of the point and add the current vertex\n vec3 offset = vec3(positions.xy * project_size_to_pixel(pointCloud.radiusPixels, pointCloud.sizeUnits), 0.0);\n DECKGL_FILTER_SIZE(offset, geometry);\n\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.), geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);\n\n // Apply lighting\n vec3 lightColor = lighting_getLightColor(instanceColors.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal);\n\n // Apply opacity to instance color, or return instance picking color\n vColor = vec4(lightColor, instanceColors.a * layer.opacity);\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n`;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport default `\\\n#version 300 es\n#define SHADER_NAME point-cloud-layer-fragment-shader\n\nprecision highp float;\n\nin vec4 vColor;\nin vec2 unitPosition;\n\nout vec4 fragColor;\n\nvoid main(void) {\n geometry.uv = unitPosition.xy;\n\n float distToCenter = length(unitPosition);\n\n if (distToCenter > 1.0) {\n discard;\n }\n\n fragColor = vColor;\n DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n`;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {Layer, project32, picking, UNIT} from '@deck.gl/core';\nimport {Geometry} from '@luma.gl/engine';\nimport {Model} from '@luma.gl/engine';\n\nimport {scatterplotUniforms, ScatterplotProps} from './scatterplot-layer-uniforms';\nimport vs from './scatterplot-layer-vertex.glsl';\nimport fs from './scatterplot-layer-fragment.glsl';\n\nimport type {\n LayerProps,\n LayerDataSource,\n UpdateParameters,\n Accessor,\n Unit,\n Position,\n Color,\n DefaultProps\n} from '@deck.gl/core';\n\nconst DEFAULT_COLOR: [number, number, number, number] = [0, 0, 0, 255];\n\n/** All props supported by the ScatterplotLayer */\nexport type ScatterplotLayerProps = _ScatterplotLayerProps & LayerProps;\n\n/** Props added by the ScatterplotLayer */\ntype _ScatterplotLayerProps = {\n data: LayerDataSource;\n /**\n * The units of the radius, one of `'meters'`, `'common'`, and `'pixels'`.\n * @default 'meters'\n */\n radiusUnits?: Unit;\n /**\n * Radius multiplier.\n * @default 1\n */\n radiusScale?: number;\n /**\n * The minimum radius in pixels. This prop can be used to prevent the circle from getting too small when zoomed out.\n * @default 0\n */\n radiusMinPixels?: number;\n /**\n * The maximum radius in pixels. This prop can be used to prevent the circle from getting too big when zoomed in.\n * @default Number.MAX_SAFE_INTEGER\n */\n radiusMaxPixels?: number;\n\n /**\n * The units of the stroke width, one of `'meters'`, `'common'`, and `'pixels'`.\n * @default 'meters'\n */\n lineWidthUnits?: Unit;\n /**\n * Stroke width multiplier.\n * @default 1\n */\n lineWidthScale?: number;\n /**\n * The minimum stroke width in pixels. This prop can be used to prevent the line from getting too thin when zoomed out.\n * @default 0\n */\n lineWidthMinPixels?: number;\n /**\n * The maximum stroke width in pixels. This prop can be used to prevent the circle from getting too thick when zoomed in.\n * @default Number.MAX_SAFE_INTEGER\n */\n lineWidthMaxPixels?: number;\n\n /**\n * Draw the outline of points.\n * @default false\n */\n stroked?: boolean;\n /**\n * Draw the filled area of points.\n * @default true\n */\n filled?: boolean;\n /**\n * If `true`, rendered circles always face the camera. If `false` circles face up (i.e. are parallel with the ground plane).\n * @default false\n */\n billboard?: boolean;\n /**\n * If `true`, circles are rendered with smoothed edges. If `false`, circles are rendered with rough edges. Antialiasing can cause artifacts on edges of overlapping circles.\n * @default true\n */\n antialiasing?: boolean;\n\n /**\n * Center position accessor.\n */\n getPosition?: Accessor;\n /**\n * Radius accessor.\n * @default 1\n */\n getRadius?: Accessor;\n /**\n * Fill color accessor.\n * @default [0, 0, 0, 255]\n */\n getFillColor?: Accessor;\n /**\n * Stroke color accessor.\n * @default [0, 0, 0, 255]\n */\n getLineColor?: Accessor;\n /**\n * Stroke width accessor.\n * @default 1\n */\n getLineWidth?: Accessor;\n /**\n * @deprecated Use `getLineWidth` instead\n */\n strokeWidth?: number;\n /**\n * @deprecated Use `stroked` instead\n */\n outline?: boolean;\n /**\n * @deprecated Use `getFillColor` and `getLineColor` instead\n */\n getColor?: Accessor;\n};\n\nconst defaultProps: DefaultProps = {\n radiusUnits: 'meters',\n radiusScale: {type: 'number', min: 0, value: 1},\n radiusMinPixels: {type: 'number', min: 0, value: 0}, // min point radius in pixels\n radiusMaxPixels: {type: 'number', min: 0, value: Number.MAX_SAFE_INTEGER}, // max point radius in pixels\n\n lineWidthUnits: 'meters',\n lineWidthScale: {type: 'number', min: 0, value: 1},\n lineWidthMinPixels: {type: 'number', min: 0, value: 0},\n lineWidthMaxPixels: {type: 'number', min: 0, value: Number.MAX_SAFE_INTEGER},\n\n stroked: false,\n filled: true,\n billboard: false,\n antialiasing: true,\n\n getPosition: {type: 'accessor', value: (x: any) => x.position},\n getRadius: {type: 'accessor', value: 1},\n getFillColor: {type: 'accessor', value: DEFAULT_COLOR},\n getLineColor: {type: 'accessor', value: DEFAULT_COLOR},\n getLineWidth: {type: 'accessor', value: 1},\n\n // deprecated\n strokeWidth: {deprecatedFor: 'getLineWidth'},\n outline: {deprecatedFor: 'stroked'},\n getColor: {deprecatedFor: ['getFillColor', 'getLineColor']}\n};\n\n/** Render circles at given coordinates. */\nexport default class ScatterplotLayer extends Layer<\n ExtraPropsT & Required<_ScatterplotLayerProps>\n> {\n static defaultProps = defaultProps;\n static layerName: string = 'ScatterplotLayer';\n\n state!: {\n model?: Model;\n };\n\n getShaders() {\n return super.getShaders({\n vs,\n fs,\n modules: [project32, picking, scatterplotUniforms]\n });\n }\n\n initializeState() {\n this.getAttributeManager()!.addInstanced({\n instancePositions: {\n size: 3,\n type: 'float64',\n fp64: this.use64bitPositions(),\n transition: true,\n accessor: 'getPosition'\n },\n instanceRadius: {\n size: 1,\n transition: true,\n accessor: 'getRadius',\n defaultValue: 1\n },\n instanceFillColors: {\n size: this.props.colorFormat.length,\n transition: true,\n type: 'unorm8',\n accessor: 'getFillColor',\n defaultValue: [0, 0, 0, 255]\n },\n instanceLineColors: {\n size: this.props.colorFormat.length,\n transition: true,\n type: 'unorm8',\n accessor: 'getLineColor',\n defaultValue: [0, 0, 0, 255]\n },\n instanceLineWidths: {\n size: 1,\n transition: true,\n accessor: 'getLineWidth',\n defaultValue: 1\n }\n });\n }\n\n updateState(params: UpdateParameters) {\n super.updateState(params);\n\n if (params.changeFlags.extensionsChanged) {\n this.state.model?.destroy();\n this.state.model = this._getModel();\n this.getAttributeManager()!.invalidateAll();\n }\n }\n\n draw({uniforms}) {\n const {\n radiusUnits,\n radiusScale,\n radiusMinPixels,\n radiusMaxPixels,\n stroked,\n filled,\n billboard,\n antialiasing,\n lineWidthUnits,\n lineWidthScale,\n lineWidthMinPixels,\n lineWidthMaxPixels\n } = this.props;\n const scatterplotProps: ScatterplotProps = {\n stroked,\n filled,\n billboard,\n antialiasing,\n radiusUnits: UNIT[radiusUnits],\n radiusScale,\n radiusMinPixels,\n radiusMaxPixels,\n lineWidthUnits: UNIT[lineWidthUnits],\n lineWidthScale,\n lineWidthMinPixels,\n lineWidthMaxPixels\n };\n const model = this.state.model!;\n model.shaderInputs.setProps({scatterplot: scatterplotProps});\n model.draw(this.context.renderPass);\n }\n\n protected _getModel() {\n // a square that minimally cover the unit circle\n const positions = [-1, -1, 0, 1, -1, 0, -1, 1, 0, 1, 1, 0];\n return new Model(this.context.device, {\n ...this.getShaders(),\n id: this.props.id,\n bufferLayout: this.getAttributeManager()!.getBufferLayouts(),\n geometry: new Geometry({\n topology: 'triangle-strip',\n attributes: {\n positions: {size: 3, value: new Float32Array(positions)}\n }\n }),\n isInstanced: true\n });\n }\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderModule} from '@luma.gl/shadertools';\n\nconst uniformBlock = `\\\nuniform scatterplotUniforms {\n float radiusScale;\n float radiusMinPixels;\n float radiusMaxPixels;\n float lineWidthScale;\n float lineWidthMinPixels;\n float lineWidthMaxPixels;\n float stroked;\n bool filled;\n bool antialiasing;\n bool billboard;\n highp int radiusUnits;\n highp int lineWidthUnits;\n} scatterplot;\n`;\n\nexport type ScatterplotProps = {\n radiusScale: number;\n radiusMinPixels: number;\n radiusMaxPixels: number;\n lineWidthScale: number;\n lineWidthMinPixels: number;\n lineWidthMaxPixels: number;\n stroked: boolean;\n filled: boolean;\n antialiasing: boolean;\n billboard: boolean;\n radiusUnits: number;\n lineWidthUnits: number;\n};\n\nexport const scatterplotUniforms = {\n name: 'scatterplot',\n vs: uniformBlock,\n fs: uniformBlock,\n uniformTypes: {\n radiusScale: 'f32',\n radiusMinPixels: 'f32',\n radiusMaxPixels: 'f32',\n lineWidthScale: 'f32',\n lineWidthMinPixels: 'f32',\n lineWidthMaxPixels: 'f32',\n stroked: 'f32',\n filled: 'f32',\n antialiasing: 'f32',\n billboard: 'f32',\n radiusUnits: 'i32',\n lineWidthUnits: 'i32'\n }\n} as const satisfies ShaderModule;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport default `\\\n#version 300 es\n#define SHADER_NAME scatterplot-layer-vertex-shader\n\nin vec3 positions;\n\nin vec3 instancePositions;\nin vec3 instancePositions64Low;\nin float instanceRadius;\nin float instanceLineWidths;\nin vec4 instanceFillColors;\nin vec4 instanceLineColors;\nin vec3 instancePickingColors;\n\nout vec4 vFillColor;\nout vec4 vLineColor;\nout vec2 unitPosition;\nout float innerUnitRadius;\nout float outerRadiusPixels;\n\n\nvoid main(void) {\n geometry.worldPosition = instancePositions;\n\n // Multiply out radius and clamp to limits\n outerRadiusPixels = clamp(\n project_size_to_pixel(scatterplot.radiusScale * instanceRadius, scatterplot.radiusUnits),\n scatterplot.radiusMinPixels, scatterplot.radiusMaxPixels\n );\n \n // Multiply out line width and clamp to limits\n float lineWidthPixels = clamp(\n project_size_to_pixel(scatterplot.lineWidthScale * instanceLineWidths, scatterplot.lineWidthUnits),\n scatterplot.lineWidthMinPixels, scatterplot.lineWidthMaxPixels\n );\n\n // outer radius needs to offset by half stroke width\n outerRadiusPixels += scatterplot.stroked * lineWidthPixels / 2.0;\n // Expand geometry to accomodate edge smoothing\n float edgePadding = scatterplot.antialiasing ? (outerRadiusPixels + SMOOTH_EDGE_RADIUS) / outerRadiusPixels : 1.0;\n\n // position on the containing square in [-1, 1] space\n unitPosition = edgePadding * positions.xy;\n geometry.uv = unitPosition;\n geometry.pickingColor = instancePickingColors;\n\n innerUnitRadius = 1.0 - scatterplot.stroked * lineWidthPixels / outerRadiusPixels;\n \n if (scatterplot.billboard) {\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n vec3 offset = edgePadding * positions * outerRadiusPixels;\n DECKGL_FILTER_SIZE(offset, geometry);\n gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);\n } else {\n vec3 offset = edgePadding * positions * project_pixel_size(outerRadiusPixels);\n DECKGL_FILTER_SIZE(offset, geometry);\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset, geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n }\n\n // Apply opacity to instance color, or return instance picking color\n vFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * layer.opacity);\n DECKGL_FILTER_COLOR(vFillColor, geometry);\n vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * layer.opacity);\n DECKGL_FILTER_COLOR(vLineColor, geometry);\n}\n`;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport default `\\\n#version 300 es\n#define SHADER_NAME scatterplot-layer-fragment-shader\n\nprecision highp float;\n\nin vec4 vFillColor;\nin vec4 vLineColor;\nin vec2 unitPosition;\nin float innerUnitRadius;\nin float outerRadiusPixels;\n\nout vec4 fragColor;\n\nvoid main(void) {\n geometry.uv = unitPosition;\n\n float distToCenter = length(unitPosition) * outerRadiusPixels;\n float inCircle = scatterplot.antialiasing ?\n smoothedge(distToCenter, outerRadiusPixels) : \n step(distToCenter, outerRadiusPixels);\n\n if (inCircle == 0.0) {\n discard;\n }\n\n if (scatterplot.stroked > 0.5) {\n float isLine = scatterplot.antialiasing ? \n smoothedge(innerUnitRadius * outerRadiusPixels, distToCenter) :\n step(innerUnitRadius * outerRadiusPixels, distToCenter);\n\n if (scatterplot.filled) {\n fragColor = mix(vFillColor, vLineColor, isLine);\n } else {\n if (isLine == 0.0) {\n discard;\n }\n fragColor = vec4(vLineColor.rgb, vLineColor.a * isLine);\n }\n } else if (scatterplot.filled == false) {\n discard;\n } else {\n fragColor = vFillColor;\n }\n\n fragColor.a *= inCircle;\n DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n`;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {\n Layer,\n project32,\n picking,\n UNIT,\n LayerProps,\n LayerDataSource,\n UpdateParameters,\n Unit,\n AccessorFunction,\n Position,\n Accessor,\n Color,\n Material,\n DefaultProps\n} from '@deck.gl/core';\nimport {gouraudMaterial, phongMaterial} from '@luma.gl/shadertools';\nimport {Model} from '@luma.gl/engine';\nimport ColumnGeometry from './column-geometry';\n\nimport {columnUniforms, ColumnProps} from './column-layer-uniforms';\nimport vs from './column-layer-vertex.glsl';\nimport fs from './column-layer-fragment.glsl';\n\nconst DEFAULT_COLOR: [number, number, number, number] = [0, 0, 0, 255];\n\nconst defaultProps: DefaultProps = {\n diskResolution: {type: 'number', min: 4, value: 20},\n vertices: null,\n radius: {type: 'number', min: 0, value: 1000},\n angle: {type: 'number', value: 0},\n offset: {type: 'array', value: [0, 0]},\n coverage: {type: 'number', min: 0, max: 1, value: 1},\n elevationScale: {type: 'number', min: 0, value: 1},\n radiusUnits: 'meters',\n lineWidthUnits: 'meters',\n lineWidthScale: 1,\n lineWidthMinPixels: 0,\n lineWidthMaxPixels: Number.MAX_SAFE_INTEGER,\n\n extruded: true,\n wireframe: false,\n filled: true,\n stroked: false,\n flatShading: false,\n\n getPosition: {type: 'accessor', value: (x: any) => x.position},\n getFillColor: {type: 'accessor', value: DEFAULT_COLOR},\n getLineColor: {type: 'accessor', value: DEFAULT_COLOR},\n getLineWidth: {type: 'accessor', value: 1},\n getElevation: {type: 'accessor', value: 1000},\n material: true,\n getColor: {deprecatedFor: ['getFillColor', 'getLineColor']}\n};\n\n/** All properties supported by ColumnLayer. */\nexport type ColumnLayerProps = _ColumnLayerProps & LayerProps;\n\n/** Properties added by ColumnLayer. */\ntype _ColumnLayerProps = {\n data: LayerDataSource;\n /**\n * The number of sides to render the disk as.\n * @default 20\n */\n diskResolution?: number;\n\n /**\n * isk size in units specified by `radiusUnits`.\n * @default 1000\n */\n radius?: number;\n\n /**\n * Disk rotation, counter-clockwise in degrees.\n * @default 0\n */\n angle?: number;\n\n /**\n * Replace the default geometry (regular polygon that fits inside the unit circle) with a custom one.\n * @default null\n */\n vertices?: Position[] | null;\n\n /**\n * Disk offset from the position, relative to the radius.\n * @default [0,0]\n */\n offset?: [number, number];\n\n /**\n * Radius multiplier, between 0 - 1\n * @default 1\n */\n coverage?: number;\n\n /**\n * Column elevation multiplier.\n * @default 1\n */\n elevationScale?: number;\n\n /**\n * Whether to draw a filled column (solid fill).\n * @default true\n */\n filled?: boolean;\n\n /**\n * Whether to draw an outline around the disks.\n * @default false\n */\n stroked?: boolean;\n\n /**\n * Whether to extrude the columns. If set to `false`, all columns will be rendered as flat polygons.\n * @default true\n */\n extruded?: boolean;\n\n /**\n * Whether to generate a line wireframe of the column.\n * @default false\n */\n wireframe?: boolean;\n\n /**\n * If `true`, the vertical surfaces of the columns use [flat shading](https://en.wikipedia.org/wiki/Shading#Flat_vs._smooth_shading).\n * @default false\n */\n flatShading?: boolean;\n\n /**\n * The units of the radius.\n * @default 'meters'\n */\n radiusUnits?: Unit;\n\n /**\n * The units of the line width.\n * @default 'meters'\n */\n lineWidthUnits?: Unit;\n\n /**\n * The line width multiplier that multiplied to all outlines.\n * @default 1\n */\n lineWidthScale?: number;\n\n /**\n * The minimum outline width in pixels.\n * @default 0\n */\n lineWidthMinPixels?: number;\n\n /**\n * The maximum outline width in pixels.\n * @default Number.MAX_SAFE_INTEGER\n */\n lineWidthMaxPixels?: number;\n\n /**\n * Material settings for lighting effect. Applies if `extruded: true`.\n *\n * @default true\n * @see https://deck.gl/docs/developer-guide/using-lighting\n */\n material?: Material;\n\n /**\n * Method called to retrieve the position of each column.\n * @default object => object.position\n */\n getPosition?: AccessorFunction;\n\n /**\n * @deprecated Use getFilledColor and getLineColor instead\n */\n getColor?: Accessor;\n\n /**\n * Fill collor value or accessor.\n * @default [0, 0, 0, 255]\n */\n getFillColor?: Accessor;\n\n /**\n * Line color value or accessor.\n *\n * @default [0, 0, 0, 255]\n */\n getLineColor?: Accessor;\n\n /**\n * The elevation of each cell in meters.\n * @default 1000\n */\n getElevation?: Accessor;\n\n /**\n * The width of the outline of the column, in units specified by `lineWidthUnits`.\n *\n * @default 1\n */\n getLineWidth?: Accessor;\n};\n\n/** Render extruded cylinders (tessellated regular polygons) at given coordinates. */\nexport default class ColumnLayer extends Layer<\n ExtraPropsT & Required<_ColumnLayerProps>\n> {\n static layerName = 'ColumnLayer';\n static defaultProps = defaultProps;\n\n state!: {\n fillModel?: Model;\n wireframeModel?: Model;\n models?: Model[];\n fillVertexCount: number;\n edgeDistance: number;\n };\n\n getShaders() {\n const defines: Record = {};\n\n const {flatShading} = this.props;\n if (flatShading) {\n defines.FLAT_SHADING = 1;\n }\n return super.getShaders({\n vs,\n fs,\n defines,\n modules: [project32, flatShading ? phongMaterial : gouraudMaterial, picking, columnUniforms]\n });\n }\n\n /**\n * DeckGL calls initializeState when GL context is available\n * Essentially a deferred constructor\n */\n initializeState() {\n const attributeManager = this.getAttributeManager()!;\n /* eslint-disable max-len */\n attributeManager.addInstanced({\n instancePositions: {\n size: 3,\n type: 'float64',\n fp64: this.use64bitPositions(),\n transition: true,\n accessor: 'getPosition'\n },\n instanceElevations: {\n size: 1,\n transition: true,\n accessor: 'getElevation'\n },\n instanceFillColors: {\n size: this.props.colorFormat.length,\n type: 'unorm8',\n transition: true,\n accessor: 'getFillColor',\n defaultValue: DEFAULT_COLOR\n },\n instanceLineColors: {\n size: this.props.colorFormat.length,\n type: 'unorm8',\n transition: true,\n accessor: 'getLineColor',\n defaultValue: DEFAULT_COLOR\n },\n instanceStrokeWidths: {\n size: 1,\n accessor: 'getLineWidth',\n transition: true\n }\n });\n /* eslint-enable max-len */\n }\n\n updateState(params: UpdateParameters): void {\n super.updateState(params);\n\n const {props, oldProps, changeFlags} = params;\n const regenerateModels =\n changeFlags.extensionsChanged || props.flatShading !== oldProps.flatShading;\n\n if (regenerateModels) {\n this.state.models?.forEach(model => model.destroy());\n this.setState(this._getModels());\n this.getAttributeManager()!.invalidateAll();\n }\n\n const instanceCount = this.getNumInstances();\n this.state.fillModel!.setInstanceCount(instanceCount);\n this.state.wireframeModel!.setInstanceCount(instanceCount);\n\n if (\n regenerateModels ||\n props.diskResolution !== oldProps.diskResolution ||\n props.vertices !== oldProps.vertices ||\n (props.extruded || props.stroked) !== (oldProps.extruded || oldProps.stroked)\n ) {\n this._updateGeometry(props);\n }\n }\n\n getGeometry(diskResolution: number, vertices: number[] | undefined, hasThinkness: boolean) {\n const geometry = new ColumnGeometry({\n radius: 1,\n height: hasThinkness ? 2 : 0,\n vertices,\n nradial: diskResolution\n });\n\n let meanVertexDistance = 0;\n if (vertices) {\n for (let i = 0; i < diskResolution; i++) {\n const p = vertices[i];\n const d = Math.sqrt(p[0] * p[0] + p[1] * p[1]);\n meanVertexDistance += d / diskResolution;\n }\n } else {\n meanVertexDistance = 1;\n }\n this.setState({\n edgeDistance: Math.cos(Math.PI / diskResolution) * meanVertexDistance\n });\n\n return geometry;\n }\n\n protected _getModels() {\n const shaders = this.getShaders();\n const bufferLayout = this.getAttributeManager()!.getBufferLayouts();\n\n const fillModel = new Model(this.context.device, {\n ...shaders,\n id: `${this.props.id}-fill`,\n bufferLayout,\n isInstanced: true\n });\n const wireframeModel = new Model(this.context.device, {\n ...shaders,\n id: `${this.props.id}-wireframe`,\n bufferLayout,\n isInstanced: true\n });\n\n return {\n fillModel,\n wireframeModel,\n models: [wireframeModel, fillModel]\n };\n }\n\n protected _updateGeometry({diskResolution, vertices, extruded, stroked}) {\n const geometry = this.getGeometry(diskResolution, vertices, extruded || stroked);\n\n this.setState({\n fillVertexCount: geometry.attributes.POSITION.value.length / 3\n });\n\n const fillModel = this.state.fillModel!;\n const wireframeModel = this.state.wireframeModel!;\n fillModel.setGeometry(geometry);\n fillModel.setTopology('triangle-strip');\n // Disable indices\n fillModel.setIndexBuffer(null);\n\n wireframeModel.setGeometry(geometry);\n wireframeModel.setTopology('line-list');\n }\n\n draw({uniforms}) {\n const {\n lineWidthUnits,\n lineWidthScale,\n lineWidthMinPixels,\n lineWidthMaxPixels,\n radiusUnits,\n elevationScale,\n extruded,\n filled,\n stroked,\n wireframe,\n offset,\n coverage,\n radius,\n angle\n } = this.props;\n const fillModel = this.state.fillModel!;\n const wireframeModel = this.state.wireframeModel!;\n const {fillVertexCount, edgeDistance} = this.state;\n\n const columnProps: Omit = {\n radius,\n angle: (angle / 180) * Math.PI,\n offset,\n extruded,\n stroked,\n coverage,\n elevationScale,\n edgeDistance,\n radiusUnits: UNIT[radiusUnits],\n widthUnits: UNIT[lineWidthUnits],\n widthScale: lineWidthScale,\n widthMinPixels: lineWidthMinPixels,\n widthMaxPixels: lineWidthMaxPixels\n };\n\n // When drawing 3d: draw wireframe first so it doesn't get occluded by depth test\n if (extruded && wireframe) {\n wireframeModel.shaderInputs.setProps({\n column: {\n ...columnProps,\n isStroke: true\n }\n });\n wireframeModel.draw(this.context.renderPass);\n }\n\n if (filled) {\n // model.setProps({isIndexed: false});\n fillModel.setVertexCount(fillVertexCount);\n fillModel.shaderInputs.setProps({\n column: {\n ...columnProps,\n isStroke: false\n }\n });\n fillModel.draw(this.context.renderPass);\n }\n // When drawing 2d: draw fill before stroke so that the outline is always on top\n if (!extruded && stroked) {\n // model.setProps({isIndexed: false});\n // The width of the stroke is achieved by flattening the side of the cylinder.\n // Skip the last 1/3 of the vertices which is the top.\n fillModel.setVertexCount((fillVertexCount * 2) / 3);\n fillModel.shaderInputs.setProps({\n column: {\n ...columnProps,\n isStroke: true\n }\n });\n fillModel.draw(this.context.renderPass);\n }\n }\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {log, BinaryAttribute} from '@deck.gl/core';\nimport {Geometry} from '@luma.gl/engine';\n\nimport {modifyPolygonWindingDirection, WINDING} from '@math.gl/polygon';\n\ntype ColumnGeometryProps = {\n id?: string;\n radius: number;\n height?: number;\n nradial?: number;\n vertices?: number[];\n};\n\nexport default class ColumnGeometry extends Geometry {\n constructor(props: ColumnGeometryProps) {\n const {indices, attributes} = tesselateColumn(props);\n super({\n ...props,\n indices,\n // @ts-expect-error\n attributes\n });\n }\n}\n\n/* eslint-disable max-statements, complexity */\nfunction tesselateColumn(props: ColumnGeometryProps): {\n indices: Uint16Array;\n attributes: Record;\n} {\n const {radius, height = 1, nradial = 10} = props;\n let {vertices} = props;\n\n if (vertices) {\n log.assert(vertices.length >= nradial); // `vertices` must contain at least `diskResolution` points\n vertices = vertices.flatMap(v => [v[0], v[1]]);\n modifyPolygonWindingDirection(vertices, WINDING.COUNTER_CLOCKWISE);\n }\n\n const isExtruded = height > 0;\n const vertsAroundEdge = nradial + 1; // loop\n const numVertices = isExtruded\n ? vertsAroundEdge * 3 + 1 // top, side top edge, side bottom edge, one additional degenerage vertex\n : nradial; // top\n\n const stepAngle = (Math.PI * 2) / nradial;\n\n // Used for wireframe\n const indices = new Uint16Array(isExtruded ? nradial * 3 * 2 : 0); // top loop, side vertical, bottom loop\n\n const positions = new Float32Array(numVertices * 3);\n const normals = new Float32Array(numVertices * 3);\n\n let i = 0;\n\n // side tesselation: 0, 1, 2, 3, 4, 5, ...\n //\n // 0 - 2 - 4 ... top\n // | / | / |\n // 1 - 3 - 5 ... bottom\n //\n if (isExtruded) {\n for (let j = 0; j < vertsAroundEdge; j++) {\n const a = j * stepAngle;\n const vertexIndex = j % nradial;\n const sin = Math.sin(a);\n const cos = Math.cos(a);\n\n for (let k = 0; k < 2; k++) {\n positions[i + 0] = vertices ? vertices[vertexIndex * 2] : cos * radius;\n positions[i + 1] = vertices ? vertices[vertexIndex * 2 + 1] : sin * radius;\n positions[i + 2] = (1 / 2 - k) * height;\n\n normals[i + 0] = vertices ? vertices[vertexIndex * 2] : cos;\n normals[i + 1] = vertices ? vertices[vertexIndex * 2 + 1] : sin;\n\n i += 3;\n }\n }\n\n // duplicate the last vertex to create proper degenerate triangle.\n positions[i + 0] = positions[i - 3];\n positions[i + 1] = positions[i - 2];\n positions[i + 2] = positions[i - 1];\n i += 3;\n }\n\n // The column geometry is rendered as a triangle strip, so\n // in order to render sides and top in one go we need to use degenerate triangles.\n // Duplicate last vertex of side trinagles and first vertex of the top cap to preserve winding order.\n\n // top tesselation: 0, -1, 1, -2, 2, -3, 3, ...\n //\n // 0 -- 1\n // / \\\n // -1 2\n // | |\n // -2 3\n // \\ /\n // -3 -- 4\n //\n for (let j = isExtruded ? 0 : 1; j < vertsAroundEdge; j++) {\n const v = Math.floor(j / 2) * Math.sign(0.5 - (j % 2));\n const a = v * stepAngle;\n const vertexIndex = (v + nradial) % nradial;\n const sin = Math.sin(a);\n const cos = Math.cos(a);\n\n positions[i + 0] = vertices ? vertices[vertexIndex * 2] : cos * radius;\n positions[i + 1] = vertices ? vertices[vertexIndex * 2 + 1] : sin * radius;\n positions[i + 2] = height / 2;\n\n normals[i + 2] = 1;\n\n i += 3;\n }\n\n if (isExtruded) {\n let index = 0;\n for (let j = 0; j < nradial; j++) {\n // top loop\n indices[index++] = j * 2 + 0;\n indices[index++] = j * 2 + 2;\n // side vertical\n indices[index++] = j * 2 + 0;\n indices[index++] = j * 2 + 1;\n // bottom loop\n indices[index++] = j * 2 + 1;\n indices[index++] = j * 2 + 3;\n }\n }\n\n return {\n indices,\n attributes: {\n POSITION: {size: 3, value: positions},\n NORMAL: {size: 3, value: normals}\n }\n };\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderModule} from '@luma.gl/shadertools';\n\nconst uniformBlock = `\\\nuniform columnUniforms {\n float radius;\n float angle;\n vec2 offset;\n bool extruded;\n bool stroked;\n bool isStroke;\n float coverage;\n float elevationScale;\n float edgeDistance;\n float widthScale;\n float widthMinPixels;\n float widthMaxPixels;\n highp int radiusUnits;\n highp int widthUnits;\n} column;\n`;\n\nexport type ColumnProps = {\n radius: number;\n angle: number;\n offset: [number, number];\n extruded: boolean;\n stroked: boolean;\n isStroke: boolean;\n coverage: number;\n elevationScale: number;\n edgeDistance: number;\n widthScale: number;\n widthMinPixels: number;\n widthMaxPixels: number;\n radiusUnits: number;\n widthUnits: number;\n};\n\nexport const columnUniforms = {\n name: 'column',\n vs: uniformBlock,\n fs: uniformBlock,\n uniformTypes: {\n radius: 'f32',\n angle: 'f32',\n offset: 'vec2',\n extruded: 'f32',\n stroked: 'f32',\n isStroke: 'f32',\n coverage: 'f32',\n elevationScale: 'f32',\n edgeDistance: 'f32',\n widthScale: 'f32',\n widthMinPixels: 'f32',\n widthMaxPixels: 'f32',\n radiusUnits: 'i32',\n widthUnits: 'i32'\n }\n} as const satisfies ShaderModule;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport default `#version 300 es\n\n#define SHADER_NAME column-layer-vertex-shader\n\nin vec3 positions;\nin vec3 normals;\n\nin vec3 instancePositions;\nin float instanceElevations;\nin vec3 instancePositions64Low;\nin vec4 instanceFillColors;\nin vec4 instanceLineColors;\nin float instanceStrokeWidths;\n\nin vec3 instancePickingColors;\n\n// Result\nout vec4 vColor;\n#ifdef FLAT_SHADING\nout vec3 cameraPosition;\nout vec4 position_commonspace;\n#endif\n\nvoid main(void) {\n geometry.worldPosition = instancePositions;\n\n vec4 color = column.isStroke ? instanceLineColors : instanceFillColors;\n // rotate primitive position and normal\n mat2 rotationMatrix = mat2(cos(column.angle), sin(column.angle), -sin(column.angle), cos(column.angle));\n\n // calculate elevation, if 3d not enabled set to 0\n // cylindar gemoetry height are between -1.0 to 1.0, transform it to between 0, 1\n float elevation = 0.0;\n // calculate stroke offset\n float strokeOffsetRatio = 1.0;\n\n if (column.extruded) {\n elevation = instanceElevations * (positions.z + 1.0) / 2.0 * column.elevationScale;\n } else if (column.stroked) {\n float widthPixels = clamp(\n project_size_to_pixel(instanceStrokeWidths * column.widthScale, column.widthUnits),\n column.widthMinPixels, column.widthMaxPixels) / 2.0;\n float halfOffset = project_pixel_size(widthPixels) / project_size(column.edgeDistance * column.coverage * column.radius);\n if (column.isStroke) {\n strokeOffsetRatio -= sign(positions.z) * halfOffset;\n } else {\n strokeOffsetRatio -= halfOffset;\n }\n }\n\n // if alpha == 0.0 or z < 0.0, do not render element\n float shouldRender = float(color.a > 0.0 && instanceElevations >= 0.0);\n float dotRadius = column.radius * column.coverage * shouldRender;\n\n geometry.pickingColor = instancePickingColors;\n\n // project center of column\n vec3 centroidPosition = vec3(instancePositions.xy, instancePositions.z + elevation);\n vec3 centroidPosition64Low = instancePositions64Low;\n vec2 offset = (rotationMatrix * positions.xy * strokeOffsetRatio + column.offset) * dotRadius;\n if (column.radiusUnits == UNIT_METERS) {\n offset = project_size(offset);\n }\n vec3 pos = vec3(offset, 0.);\n DECKGL_FILTER_SIZE(pos, geometry);\n\n gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position);\n geometry.normal = project_normal(vec3(rotationMatrix * normals.xy, normals.z));\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n\n // Light calculations\n if (column.extruded && !column.isStroke) {\n#ifdef FLAT_SHADING\n cameraPosition = project.cameraPosition;\n position_commonspace = geometry.position;\n vColor = vec4(color.rgb, color.a * layer.opacity);\n#else\n vec3 lightColor = lighting_getLightColor(color.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal);\n vColor = vec4(lightColor, color.a * layer.opacity);\n#endif\n } else {\n vColor = vec4(color.rgb, color.a * layer.opacity);\n }\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n`;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport default `#version 300 es\n#define SHADER_NAME column-layer-fragment-shader\n\nprecision highp float;\n\nout vec4 fragColor;\n\nin vec4 vColor;\n#ifdef FLAT_SHADING\nin vec3 cameraPosition;\nin vec4 position_commonspace;\n#endif\n\nvoid main(void) {\n fragColor = vColor;\n // Fails to compile on some Android devices if geometry is never assigned (#8411)\n geometry.uv = vec2(0.);\n#ifdef FLAT_SHADING\n if (column.extruded && !column.isStroke && !bool(picking.isActive)) {\n vec3 normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));\n fragColor.rgb = lighting_getLightColor(vColor.rgb, cameraPosition, position_commonspace.xyz, normal);\n }\n#endif\n DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n`;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {DefaultProps} from '@deck.gl/core';\nimport {UNIT} from '@deck.gl/core';\nimport {CubeGeometry} from '@luma.gl/engine';\nimport ColumnLayer, {ColumnLayerProps} from './column-layer';\nimport {ColumnProps} from './column-layer-uniforms';\n\nconst defaultProps: DefaultProps = {\n cellSize: {type: 'number', min: 0, value: 1000},\n offset: {type: 'array', value: [1, 1]}\n};\n\n/** All properties supported by GridCellLayer. */\nexport type GridCellLayerProps = _GridCellLayerProps & ColumnLayerProps;\n\n/** Properties added by GridCellLayer. */\ntype _GridCellLayerProps = {\n /**\n * @default 1000\n */\n cellSize?: number;\n};\n\nexport default class GridCellLayer extends ColumnLayer<\n DataT,\n ExtraPropsT & Required<_GridCellLayerProps>\n> {\n static layerName = 'GridCellLayer';\n static defaultProps = defaultProps;\n\n protected _updateGeometry() {\n const geometry = new CubeGeometry();\n this.state.fillModel!.setGeometry(geometry);\n }\n\n draw({uniforms}) {\n const {elevationScale, extruded, offset, coverage, cellSize, angle, radiusUnits} = this.props;\n const fillModel = this.state.fillModel!;\n const columnProps: ColumnProps = {\n radius: cellSize / 2,\n radiusUnits: UNIT[radiusUnits],\n angle,\n offset,\n extruded,\n stroked: false,\n coverage,\n elevationScale,\n edgeDistance: 1,\n isStroke: false,\n widthUnits: 0,\n widthScale: 0,\n widthMinPixels: 0,\n widthMaxPixels: 0\n };\n fillModel.shaderInputs.setProps({column: columnProps});\n fillModel.draw(this.context.renderPass);\n }\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {Layer, project32, picking, UNIT} from '@deck.gl/core';\nimport {Geometry} from '@luma.gl/engine';\nimport {Model} from '@luma.gl/engine';\nimport PathTesselator from './path-tesselator';\n\nimport {pathUniforms, PathProps} from './path-layer-uniforms';\nimport vs from './path-layer-vertex.glsl';\nimport fs from './path-layer-fragment.glsl';\n\nimport type {\n LayerProps,\n LayerDataSource,\n Color,\n Accessor,\n AccessorFunction,\n Unit,\n UpdateParameters,\n GetPickingInfoParams,\n PickingInfo,\n DefaultProps\n} from '@deck.gl/core';\nimport type {PathGeometry} from './path';\n\ntype _PathLayerProps = {\n data: LayerDataSource;\n /** The units of the line width, one of `'meters'`, `'common'`, and `'pixels'`\n * @default 'meters'\n */\n widthUnits?: Unit;\n /**\n * Path width multiplier.\n * @default 1\n */\n widthScale?: number;\n /**\n * The minimum path width in pixels. This prop can be used to prevent the path from getting too thin when zoomed out.\n * @default 0\n */\n widthMinPixels?: number;\n /**\n * The maximum path width in pixels. This prop can be used to prevent the path from getting too thick when zoomed in.\n * @default Number.MAX_SAFE_INTEGER\n */\n widthMaxPixels?: number;\n /**\n * Type of joint. If `true`, draw round joints. Otherwise draw miter joints.\n * @default false\n */\n jointRounded?: boolean;\n /**\n * Type of caps. If `true`, draw round caps. Otherwise draw square caps.\n * @default false\n */\n capRounded?: boolean;\n /**\n * The maximum extent of a joint in ratio to the stroke width. Only works if `jointRounded` is `false`.\n * @default 4\n */\n miterLimit?: number;\n /**\n * If `true`, extrude the path in screen space (width always faces the camera).\n * If `false`, the width always faces up (z).\n * @default false\n */\n billboard?: boolean;\n /**\n * (Experimental) If `'loop'` or `'open'`, will skip normalizing the coordinates returned by `getPath` and instead assume all paths are to be loops or open paths.\n * When normalization is disabled, paths must be specified in the format of flat array. Open paths must contain at least 2 vertices and closed paths must contain at least 3 vertices.\n * @default null\n */\n _pathType?: null | 'loop' | 'open';\n /**\n * Path geometry accessor.\n */\n getPath?: AccessorFunction;\n /**\n * Path color accessor.\n * @default [0, 0, 0, 255]\n */\n getColor?: Accessor;\n /**\n * Path width accessor.\n * @default 1\n */\n getWidth?: Accessor;\n /**\n * @deprecated Use `jointRounded` and `capRounded` instead\n */\n rounded?: boolean;\n};\n\nexport type PathLayerProps = _PathLayerProps & LayerProps;\n\nconst DEFAULT_COLOR: [number, number, number, number] = [0, 0, 0, 255];\n\nconst defaultProps: DefaultProps = {\n widthUnits: 'meters',\n widthScale: {type: 'number', min: 0, value: 1},\n widthMinPixels: {type: 'number', min: 0, value: 0},\n widthMaxPixels: {type: 'number', min: 0, value: Number.MAX_SAFE_INTEGER},\n jointRounded: false,\n capRounded: false,\n miterLimit: {type: 'number', min: 0, value: 4},\n billboard: false,\n _pathType: null,\n\n getPath: {type: 'accessor', value: (object: any) => object.path},\n getColor: {type: 'accessor', value: DEFAULT_COLOR},\n getWidth: {type: 'accessor', value: 1},\n\n // deprecated props\n rounded: {deprecatedFor: ['jointRounded', 'capRounded']}\n};\n\nconst ATTRIBUTE_TRANSITION = {\n enter: (value, chunk) => {\n return chunk.length ? chunk.subarray(chunk.length - value.length) : value;\n }\n};\n\n/** Render lists of coordinate points as extruded polylines with mitering. */\nexport default class PathLayer extends Layer<\n ExtraPropsT & Required<_PathLayerProps>\n> {\n static defaultProps = defaultProps;\n static layerName = 'PathLayer';\n\n state!: {\n model?: Model;\n pathTesselator: PathTesselator;\n };\n\n getShaders() {\n return super.getShaders({vs, fs, modules: [project32, picking, pathUniforms]}); // 'project' module added by default.\n }\n\n get wrapLongitude(): boolean {\n return false;\n }\n\n getBounds(): [number[], number[]] | null {\n return this.getAttributeManager()?.getBounds(['vertexPositions']);\n }\n\n initializeState() {\n const noAlloc = true;\n const attributeManager = this.getAttributeManager();\n /* eslint-disable max-len */\n attributeManager!.addInstanced({\n vertexPositions: {\n size: 3,\n // Start filling buffer from 1 vertex in\n vertexOffset: 1,\n type: 'float64',\n fp64: this.use64bitPositions(),\n transition: ATTRIBUTE_TRANSITION,\n accessor: 'getPath',\n // eslint-disable-next-line @typescript-eslint/unbound-method\n update: this.calculatePositions,\n noAlloc,\n shaderAttributes: {\n instanceLeftPositions: {\n vertexOffset: 0\n },\n instanceStartPositions: {\n vertexOffset: 1\n },\n instanceEndPositions: {\n vertexOffset: 2\n },\n instanceRightPositions: {\n vertexOffset: 3\n }\n }\n },\n instanceTypes: {\n size: 1,\n type: 'uint8',\n // eslint-disable-next-line @typescript-eslint/unbound-method\n update: this.calculateSegmentTypes,\n noAlloc\n },\n instanceStrokeWidths: {\n size: 1,\n accessor: 'getWidth',\n transition: ATTRIBUTE_TRANSITION,\n defaultValue: 1\n },\n instanceColors: {\n size: this.props.colorFormat.length,\n type: 'unorm8',\n accessor: 'getColor',\n transition: ATTRIBUTE_TRANSITION,\n defaultValue: DEFAULT_COLOR\n },\n instancePickingColors: {\n size: 4,\n type: 'uint8',\n accessor: (object, {index, target: value}) =>\n this.encodePickingColor(object && object.__source ? object.__source.index : index, value)\n }\n });\n /* eslint-enable max-len */\n\n this.setState({\n pathTesselator: new PathTesselator({\n fp64: this.use64bitPositions()\n })\n });\n }\n\n updateState(params: UpdateParameters) {\n super.updateState(params);\n const {props, changeFlags} = params;\n\n const attributeManager = this.getAttributeManager();\n\n const geometryChanged =\n changeFlags.dataChanged ||\n (changeFlags.updateTriggersChanged &&\n (changeFlags.updateTriggersChanged.all || changeFlags.updateTriggersChanged.getPath));\n\n if (geometryChanged) {\n const {pathTesselator} = this.state;\n const buffers = (props.data as any).attributes || {};\n\n pathTesselator.updateGeometry({\n data: props.data,\n geometryBuffer: buffers.getPath,\n buffers,\n normalize: !props._pathType,\n loop: props._pathType === 'loop',\n getGeometry: props.getPath,\n positionFormat: props.positionFormat,\n wrapLongitude: props.wrapLongitude,\n // TODO - move the flag out of the viewport\n resolution: this.context.viewport.resolution,\n dataChanged: changeFlags.dataChanged\n });\n this.setState({\n numInstances: pathTesselator.instanceCount,\n startIndices: pathTesselator.vertexStarts\n });\n if (!changeFlags.dataChanged) {\n // Base `layer.updateState` only invalidates all attributes on data change\n // Cover the rest of the scenarios here\n attributeManager!.invalidateAll();\n }\n }\n\n if (changeFlags.extensionsChanged) {\n this.state.model?.destroy();\n this.state.model = this._getModel();\n attributeManager!.invalidateAll();\n }\n }\n\n getPickingInfo(params: GetPickingInfoParams): PickingInfo {\n const info = super.getPickingInfo(params);\n const {index} = info;\n const data = this.props.data as any[];\n\n // Check if data comes from a composite layer, wrapped with getSubLayerRow\n if (data[0] && data[0].__source) {\n // index decoded from picking color refers to the source index\n info.object = data.find(d => d.__source.index === index);\n }\n return info;\n }\n\n /** Override base Layer method */\n disablePickingIndex(objectIndex: number) {\n const data = this.props.data as any[];\n\n // Check if data comes from a composite layer, wrapped with getSubLayerRow\n if (data[0] && data[0].__source) {\n // index decoded from picking color refers to the source index\n for (let i = 0; i < data.length; i++) {\n if (data[i].__source.index === objectIndex) {\n this._disablePickingIndex(i);\n }\n }\n } else {\n super.disablePickingIndex(objectIndex);\n }\n }\n\n draw({uniforms}) {\n const {\n jointRounded,\n capRounded,\n billboard,\n miterLimit,\n widthUnits,\n widthScale,\n widthMinPixels,\n widthMaxPixels\n } = this.props;\n\n const model = this.state.model!;\n const pathProps: PathProps = {\n jointType: Number(jointRounded),\n capType: Number(capRounded),\n billboard,\n widthUnits: UNIT[widthUnits],\n widthScale,\n miterLimit,\n widthMinPixels,\n widthMaxPixels\n };\n model.shaderInputs.setProps({path: pathProps});\n model.draw(this.context.renderPass);\n }\n\n protected _getModel(): Model {\n /*\n * _\n * \"-_ 1 3 5\n * _ \"o---------------------o-------------------_-o\n * - / \"\"--..__ '. _.-' /\n * _ \"@- - - - - \"\"--..__- - - - x - - - -_.@' /\n * \"-_ / \"\"--..__ '. _,-` : /\n * \"o----------------------------\"\"-o' : /\n * 0,2 4 / '. : /\n * / '.: /\n * / :'. /\n * / : ', /\n * / : o\n */\n\n // prettier-ignore\n const SEGMENT_INDICES = [\n // start corner\n 0, 1, 2,\n // body\n 1, 4, 2,\n 1, 3, 4,\n // end corner\n 3, 5, 4\n ];\n\n // [0] position on segment - 0: start, 1: end\n // [1] side of path - -1: left, 0: center (joint), 1: right\n // prettier-ignore\n const SEGMENT_POSITIONS = [\n // bevel start corner\n 0, 0,\n // start inner corner\n 0, -1,\n // start outer corner\n 0, 1,\n // end inner corner\n 1, -1,\n // end outer corner\n 1, 1,\n // bevel end corner\n 1, 0\n ];\n\n return new Model(this.context.device, {\n ...this.getShaders(),\n id: this.props.id,\n bufferLayout: this.getAttributeManager()!.getBufferLayouts(),\n geometry: new Geometry({\n topology: 'triangle-list',\n attributes: {\n indices: new Uint16Array(SEGMENT_INDICES),\n positions: {value: new Float32Array(SEGMENT_POSITIONS), size: 2}\n }\n }),\n isInstanced: true\n });\n }\n\n protected calculatePositions(attribute) {\n const {pathTesselator} = this.state;\n\n attribute.startIndices = pathTesselator.vertexStarts;\n attribute.value = pathTesselator.get('positions');\n }\n\n protected calculateSegmentTypes(attribute) {\n const {pathTesselator} = this.state;\n\n attribute.startIndices = pathTesselator.vertexStarts;\n attribute.value = pathTesselator.get('segmentTypes');\n }\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {Tesselator} from '@deck.gl/core';\nimport {normalizePath} from './path';\n\nimport type {TypedArray} from '@math.gl/core';\nimport type {PathGeometry, FlatPathGeometry, NormalizedPathGeometry} from './path';\n\nconst START_CAP = 1;\nconst END_CAP = 2;\nconst INVALID = 4;\n\n// This class is set up to allow querying one attribute at a time\n// the way the AttributeManager expects it\nexport default class PathTesselator extends Tesselator<\n PathGeometry,\n NormalizedPathGeometry,\n {\n fp64?: boolean;\n resolution?: number;\n wrapLongitude?: boolean;\n loop?: boolean;\n }\n> {\n constructor(opts) {\n super({\n ...opts,\n attributes: {\n // Padding covers shaderAttributes for last segment in largest case fp64\n // additional vertex + hi & low parts, 3 * 6\n positions: {\n size: 3,\n padding: 18,\n initialize: true,\n type: opts.fp64 ? Float64Array : Float32Array\n },\n segmentTypes: {size: 1, type: Uint8ClampedArray}\n }\n });\n }\n\n /** Get packed attribute by name */\n get(attributeName: string): TypedArray | null {\n return this.attributes[attributeName];\n }\n\n /* Implement base Tesselator interface */\n protected getGeometryFromBuffer(buffer) {\n if (this.normalize) {\n return super.getGeometryFromBuffer(buffer);\n }\n // we don't need to read the positions if no normalization\n return null;\n }\n\n /* Implement base Tesselator interface */\n protected normalizeGeometry(path: PathGeometry): number[][] | PathGeometry {\n if (this.normalize) {\n return normalizePath(path, this.positionSize, this.opts.resolution, this.opts.wrapLongitude);\n }\n return path;\n }\n\n /* Implement base Tesselator interface */\n protected getGeometrySize(path: NormalizedPathGeometry): number {\n if (isCut(path)) {\n let size = 0;\n for (const subPath of path) {\n size += this.getGeometrySize(subPath);\n }\n return size;\n }\n const numPoints = this.getPathLength(path);\n if (numPoints < 2) {\n // invalid path\n return 0;\n }\n if (this.isClosed(path)) {\n // minimum 3 vertices\n return numPoints < 3 ? 0 : numPoints + 2;\n }\n return numPoints;\n }\n\n /* Implement base Tesselator interface */\n protected updateGeometryAttributes(\n path: NormalizedPathGeometry | null,\n context: {\n vertexStart: number;\n geometrySize: number;\n }\n ): void {\n if (context.geometrySize === 0) {\n return;\n }\n if (path && isCut(path)) {\n for (const subPath of path) {\n const geometrySize = this.getGeometrySize(subPath);\n context.geometrySize = geometrySize;\n this.updateGeometryAttributes(subPath, context);\n context.vertexStart += geometrySize;\n }\n } else {\n this._updateSegmentTypes(path, context);\n this._updatePositions(path, context);\n }\n }\n\n private _updateSegmentTypes(\n path: FlatPathGeometry | null,\n context: {\n vertexStart: number;\n geometrySize: number;\n }\n ) {\n const segmentTypes = this.attributes.segmentTypes as TypedArray;\n const isPathClosed = path ? this.isClosed(path) : false;\n const {vertexStart, geometrySize} = context;\n\n // positions -- A0 A1 B0 B1 B2 B3 B0 B1 B2 --\n // segmentTypes 3 4 4 0 0 0 0 4 4\n segmentTypes.fill(0, vertexStart, vertexStart + geometrySize);\n if (isPathClosed) {\n segmentTypes[vertexStart] = INVALID;\n segmentTypes[vertexStart + geometrySize - 2] = INVALID;\n } else {\n segmentTypes[vertexStart] += START_CAP;\n segmentTypes[vertexStart + geometrySize - 2] += END_CAP;\n }\n segmentTypes[vertexStart + geometrySize - 1] = INVALID;\n }\n\n private _updatePositions(\n path: FlatPathGeometry | null,\n context: {\n vertexStart: number;\n geometrySize: number;\n }\n ) {\n const {positions} = this.attributes;\n if (!positions || !path) {\n return;\n }\n const {vertexStart, geometrySize} = context;\n const p = new Array(3);\n\n // positions -- A0 A1 B0 B1 B2 B3 B0 B1 B2 --\n // segmentTypes 3 4 4 0 0 0 0 4 4\n for (let i = vertexStart, ptIndex = 0; ptIndex < geometrySize; i++, ptIndex++) {\n this.getPointOnPath(path, ptIndex, p);\n positions[i * 3] = p[0];\n positions[i * 3 + 1] = p[1];\n positions[i * 3 + 2] = p[2];\n }\n }\n\n // Utilities\n /** Returns the number of points in the path */\n private getPathLength(path: FlatPathGeometry): number {\n return path.length / this.positionSize;\n }\n\n /** Returns a point on the path at the specified index */\n private getPointOnPath(path: FlatPathGeometry, index: number, target: number[] = []): number[] {\n const {positionSize} = this;\n if (index * positionSize >= path.length) {\n // loop\n index += 1 - path.length / positionSize;\n }\n const i = index * positionSize;\n target[0] = path[i];\n target[1] = path[i + 1];\n target[2] = (positionSize === 3 && path[i + 2]) || 0;\n return target;\n }\n\n // Returns true if the first and last points are identical\n private isClosed(path: FlatPathGeometry): boolean {\n if (!this.normalize) {\n return Boolean(this.opts.loop);\n }\n const {positionSize} = this;\n const lastPointIndex = path.length - positionSize;\n return (\n path[0] === path[lastPointIndex] &&\n path[1] === path[lastPointIndex + 1] &&\n (positionSize === 2 || path[2] === path[lastPointIndex + 2])\n );\n }\n}\n\nfunction isCut(path: NormalizedPathGeometry): path is FlatPathGeometry[] {\n return Array.isArray(path[0]);\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {cutPolylineByGrid, cutPolylineByMercatorBounds} from '@math.gl/polygon';\n\nimport type {NumericArray} from '@math.gl/core';\nimport type {Position} from '@deck.gl/core';\n\nexport type NestedPathGeometry = Position[];\nexport type FlatPathGeometry = NumericArray;\nexport type PathGeometry = NestedPathGeometry | FlatPathGeometry;\nexport type NormalizedPathGeometry = FlatPathGeometry[] | FlatPathGeometry;\n\n/**\n * Flattens a nested path object\n * Cut the feature if needed (globe projection, wrap longitude, etc.)\n * Returns a flat array of path positions, or a list of flat arrays representing multiple paths\n */\nexport function normalizePath(\n path: PathGeometry,\n size: number,\n gridResolution?: number,\n wrapLongitude?: boolean\n): number[][] | NumericArray {\n let flatPath: NumericArray;\n if (Array.isArray(path[0])) {\n const length = path.length * size;\n flatPath = new Array(length);\n for (let i = 0; i < path.length; i++) {\n for (let j = 0; j < size; j++) {\n flatPath[i * size + j] = path[i][j] || 0;\n }\n }\n } else {\n flatPath = path as NumericArray;\n }\n if (gridResolution) {\n return cutPolylineByGrid(flatPath, {size, gridResolution});\n }\n if (wrapLongitude) {\n return cutPolylineByMercatorBounds(flatPath, {size});\n }\n return flatPath;\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderModule} from '@luma.gl/shadertools';\n\nconst uniformBlock = `\\\nuniform pathUniforms {\n float widthScale;\n float widthMinPixels;\n float widthMaxPixels;\n float jointType;\n float capType;\n float miterLimit;\n bool billboard;\n highp int widthUnits;\n} path;\n`;\n\nexport type PathProps = {\n widthScale: number;\n widthMinPixels: number;\n widthMaxPixels: number;\n jointType: number;\n capType: number;\n miterLimit: number;\n billboard: boolean;\n widthUnits: number;\n};\n\nexport const pathUniforms = {\n name: 'path',\n vs: uniformBlock,\n fs: uniformBlock,\n uniformTypes: {\n widthScale: 'f32',\n widthMinPixels: 'f32',\n widthMaxPixels: 'f32',\n jointType: 'f32',\n capType: 'f32',\n miterLimit: 'f32',\n billboard: 'f32',\n widthUnits: 'i32'\n }\n} as const satisfies ShaderModule;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport default `\\\n#version 300 es\n#define SHADER_NAME path-layer-vertex-shader\n\nin vec2 positions;\n\nin float instanceTypes;\nin vec3 instanceStartPositions;\nin vec3 instanceEndPositions;\nin vec3 instanceLeftPositions;\nin vec3 instanceRightPositions;\nin vec3 instanceLeftPositions64Low;\nin vec3 instanceStartPositions64Low;\nin vec3 instanceEndPositions64Low;\nin vec3 instanceRightPositions64Low;\nin float instanceStrokeWidths;\nin vec4 instanceColors;\nin vec3 instancePickingColors;\n\nuniform float opacity;\n\nout vec4 vColor;\nout vec2 vCornerOffset;\nout float vMiterLength;\nout vec2 vPathPosition;\nout float vPathLength;\nout float vJointType;\n\nconst float EPSILON = 0.001;\nconst vec3 ZERO_OFFSET = vec3(0.0);\n\nfloat flipIfTrue(bool flag) {\n return -(float(flag) * 2. - 1.);\n}\n\n// calculate line join positions\nvec3 getLineJoinOffset(\n vec3 prevPoint, vec3 currPoint, vec3 nextPoint,\n vec2 width\n) {\n bool isEnd = positions.x > 0.0;\n // side of the segment - -1: left, 0: center, 1: right\n float sideOfPath = positions.y;\n float isJoint = float(sideOfPath == 0.0);\n\n vec3 deltaA3 = (currPoint - prevPoint);\n vec3 deltaB3 = (nextPoint - currPoint);\n\n mat3 rotationMatrix;\n bool needsRotation = !path.billboard && project_needs_rotation(currPoint, rotationMatrix);\n if (needsRotation) {\n deltaA3 = deltaA3 * rotationMatrix;\n deltaB3 = deltaB3 * rotationMatrix;\n }\n vec2 deltaA = deltaA3.xy / width;\n vec2 deltaB = deltaB3.xy / width;\n\n float lenA = length(deltaA);\n float lenB = length(deltaB);\n\n vec2 dirA = lenA > 0. ? normalize(deltaA) : vec2(0.0, 0.0);\n vec2 dirB = lenB > 0. ? normalize(deltaB) : vec2(0.0, 0.0);\n\n vec2 perpA = vec2(-dirA.y, dirA.x);\n vec2 perpB = vec2(-dirB.y, dirB.x);\n\n // tangent of the corner\n vec2 tangent = dirA + dirB;\n tangent = length(tangent) > 0. ? normalize(tangent) : perpA;\n // direction of the corner\n vec2 miterVec = vec2(-tangent.y, tangent.x);\n // direction of the segment\n vec2 dir = isEnd ? dirA : dirB;\n // direction of the extrusion\n vec2 perp = isEnd ? perpA : perpB;\n // length of the segment\n float L = isEnd ? lenA : lenB;\n\n // A = angle of the corner\n float sinHalfA = abs(dot(miterVec, perp));\n float cosHalfA = abs(dot(dirA, miterVec));\n\n // -1: right, 1: left\n float turnDirection = flipIfTrue(dirA.x * dirB.y >= dirA.y * dirB.x);\n\n // relative position to the corner:\n // -1: inside (smaller side of the angle)\n // 0: center\n // 1: outside (bigger side of the angle)\n float cornerPosition = sideOfPath * turnDirection;\n\n float miterSize = 1.0 / max(sinHalfA, EPSILON);\n // trim if inside corner extends further than the line segment\n miterSize = mix(\n min(miterSize, max(lenA, lenB) / max(cosHalfA, EPSILON)),\n miterSize,\n step(0.0, cornerPosition)\n );\n\n vec2 offsetVec = mix(miterVec * miterSize, perp, step(0.5, cornerPosition))\n * (sideOfPath + isJoint * turnDirection);\n\n // special treatment for start cap and end cap\n bool isStartCap = lenA == 0.0 || (!isEnd && (instanceTypes == 1.0 || instanceTypes == 3.0));\n bool isEndCap = lenB == 0.0 || (isEnd && (instanceTypes == 2.0 || instanceTypes == 3.0));\n bool isCap = isStartCap || isEndCap;\n\n // extend out a triangle to envelope the round cap\n if (isCap) {\n offsetVec = mix(perp * sideOfPath, dir * path.capType * 4.0 * flipIfTrue(isStartCap), isJoint);\n vJointType = path.capType;\n } else {\n vJointType = path.jointType;\n }\n\n // Generate variables for fragment shader\n vPathLength = L;\n vCornerOffset = offsetVec;\n vMiterLength = dot(vCornerOffset, miterVec * turnDirection);\n vMiterLength = isCap ? isJoint : vMiterLength;\n\n vec2 offsetFromStartOfPath = vCornerOffset + deltaA * float(isEnd);\n vPathPosition = vec2(\n dot(offsetFromStartOfPath, perp),\n dot(offsetFromStartOfPath, dir)\n );\n geometry.uv = vPathPosition;\n\n float isValid = step(instanceTypes, 3.5);\n vec3 offset = vec3(offsetVec * width * isValid, 0.0);\n\n if (needsRotation) {\n offset = rotationMatrix * offset;\n }\n return offset;\n}\n\n// In clipspace extrusion, if a line extends behind the camera, clip it to avoid visual artifacts\nvoid clipLine(inout vec4 position, vec4 refPosition) {\n if (position.w < EPSILON) {\n float r = (EPSILON - refPosition.w) / (position.w - refPosition.w);\n position = refPosition + (position - refPosition) * r;\n }\n}\n\nvoid main() {\n geometry.pickingColor = instancePickingColors;\n\n vColor = vec4(instanceColors.rgb, instanceColors.a * layer.opacity);\n\n float isEnd = positions.x;\n\n vec3 prevPosition = mix(instanceLeftPositions, instanceStartPositions, isEnd);\n vec3 prevPosition64Low = mix(instanceLeftPositions64Low, instanceStartPositions64Low, isEnd);\n\n vec3 currPosition = mix(instanceStartPositions, instanceEndPositions, isEnd);\n vec3 currPosition64Low = mix(instanceStartPositions64Low, instanceEndPositions64Low, isEnd);\n\n vec3 nextPosition = mix(instanceEndPositions, instanceRightPositions, isEnd);\n vec3 nextPosition64Low = mix(instanceEndPositions64Low, instanceRightPositions64Low, isEnd);\n\n geometry.worldPosition = currPosition;\n vec2 widthPixels = vec2(clamp(\n project_size_to_pixel(instanceStrokeWidths * path.widthScale, path.widthUnits),\n path.widthMinPixels, path.widthMaxPixels) / 2.0);\n vec3 width;\n\n if (path.billboard) {\n // Extrude in clipspace\n vec4 prevPositionScreen = project_position_to_clipspace(prevPosition, prevPosition64Low, ZERO_OFFSET);\n vec4 currPositionScreen = project_position_to_clipspace(currPosition, currPosition64Low, ZERO_OFFSET, geometry.position);\n vec4 nextPositionScreen = project_position_to_clipspace(nextPosition, nextPosition64Low, ZERO_OFFSET);\n\n clipLine(prevPositionScreen, currPositionScreen);\n clipLine(nextPositionScreen, currPositionScreen);\n clipLine(currPositionScreen, mix(nextPositionScreen, prevPositionScreen, isEnd));\n\n width = vec3(widthPixels, 0.0);\n DECKGL_FILTER_SIZE(width, geometry);\n\n vec3 offset = getLineJoinOffset(\n prevPositionScreen.xyz / prevPositionScreen.w,\n currPositionScreen.xyz / currPositionScreen.w,\n nextPositionScreen.xyz / nextPositionScreen.w,\n project_pixel_size_to_clipspace(width.xy)\n );\n\n DECKGL_FILTER_GL_POSITION(currPositionScreen, geometry);\n gl_Position = vec4(currPositionScreen.xyz + offset * currPositionScreen.w, currPositionScreen.w);\n } else {\n // Extrude in commonspace\n prevPosition = project_position(prevPosition, prevPosition64Low);\n currPosition = project_position(currPosition, currPosition64Low);\n nextPosition = project_position(nextPosition, nextPosition64Low);\n\n width = vec3(project_pixel_size(widthPixels), 0.0);\n DECKGL_FILTER_SIZE(width, geometry);\n\n vec3 offset = getLineJoinOffset(prevPosition, currPosition, nextPosition, width.xy);\n geometry.position = vec4(currPosition + offset, 1.0);\n gl_Position = project_common_position_to_clipspace(geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n }\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n`;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport default `\\\n#version 300 es\n#define SHADER_NAME path-layer-fragment-shader\n\nprecision highp float;\n\nin vec4 vColor;\nin vec2 vCornerOffset;\nin float vMiterLength;\n/*\n * vPathPosition represents the relative coordinates of the current fragment on the path segment.\n * vPathPosition.x - position along the width of the path, between [-1, 1]. 0 is the center line.\n * vPathPosition.y - position along the length of the path, between [0, L / width].\n */\nin vec2 vPathPosition;\nin float vPathLength;\nin float vJointType;\n\nout vec4 fragColor;\n\nvoid main(void) {\n geometry.uv = vPathPosition;\n\n if (vPathPosition.y < 0.0 || vPathPosition.y > vPathLength) {\n // if joint is rounded, test distance from the corner\n if (vJointType > 0.5 && length(vCornerOffset) > 1.0) {\n discard;\n }\n // trim miter\n if (vJointType < 0.5 && vMiterLength > path.miterLimit + 1.0) {\n discard;\n }\n }\n fragColor = vColor;\n\n DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n`;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {\n Accessor,\n AccessorFunction,\n Color,\n CompositeLayer,\n CompositeLayerProps,\n createIterable,\n Layer,\n LayerDataSource,\n LayersList,\n log,\n Unit,\n Material,\n UpdateParameters,\n DefaultProps\n} from '@deck.gl/core';\nimport SolidPolygonLayer from '../solid-polygon-layer/solid-polygon-layer';\nimport PathLayer from '../path-layer/path-layer';\nimport * as Polygon from '../solid-polygon-layer/polygon';\nimport {replaceInRange} from '../utils';\n\n/**\n * All properties supported by `PolygonLayer`.\n */\nexport type PolygonLayerProps = _PolygonLayerProps & CompositeLayerProps;\n\n/**\n * Properties added by `PolygonLayer`.\n */\ntype _PolygonLayerProps = {\n data: LayerDataSource;\n /**\n * Whether to draw an outline around the polygon (solid fill).\n *\n * Note that both the outer polygon as well the outlines of any holes will be drawn.\n *\n * @default true\n */\n stroked?: boolean;\n\n /**\n * Whether to draw a filled polygon (solid fill).\n *\n * Note that only the area between the outer polygon and any holes will be filled.\n *\n * @default true\n */\n filled?: boolean;\n\n /**\n * Whether to extrude the polygons.\n *\n * Based on the elevations provided by the `getElevation` accessor.\n *\n * If set to `false`, all polygons will be flat, this generates less geometry and is faster\n * than simply returning 0 from getElevation.\n *\n * @default false\n */\n extruded?: boolean;\n\n /**\n * Elevation multiplier.\n *\n * The final elevation is calculated by `elevationScale * getElevation(d)`.\n * `elevationScale` is a handy property to scale all elevation without updating the data.\n *\n * @default 1\n */\n elevationScale?: number;\n\n /**\n * Whether to generate a line wireframe of the hexagon.\n *\n * The outline will have \"horizontal\" lines closing the top and bottom polygons and a vertical\n * line (a \"strut\") for each vertex on the polygon.\n *\n * @default false\n */\n wireframe?: boolean;\n\n /**\n * The units of the line width, one of `meters`, `common`, and `pixels`.\n *\n * @default 'meters'\n * @see Unit.\n */\n lineWidthUnits?: Unit;\n\n /**\n * The line width multiplier that multiplied to all outlines of `Polygon` and `MultiPolygon`\n * features if the stroked attribute is true.\n *\n * @default 1\n */\n lineWidthScale?: number;\n\n /**\n * The minimum line width in pixels.\n *\n * @default 0\n */\n lineWidthMinPixels?: number;\n\n /**\n * The maximum line width in pixels\n *\n * @default Number.MAX_SAFE_INTEGER\n */\n lineWidthMaxPixels?: number;\n\n /**\n * Type of joint. If `true`, draw round joints. Otherwise draw miter joints.\n *\n * @default false\n */\n lineJointRounded?: boolean;\n\n /**\n * The maximum extent of a joint in ratio to the stroke width.\n *\n * Only works if `lineJointRounded` is false.\n *\n * @default 4\n */\n lineMiterLimit?: number;\n\n lineDashJustified?: boolean;\n\n /** Called on each object in the data stream to retrieve its corresponding polygon. */\n getPolygon?: AccessorFunction;\n\n /**\n * Fill collor value or accessor.\n *\n * @default [0, 0, 0, 255]\n */\n getFillColor?: Accessor;\n\n /**\n * Line color value or accessor.\n *\n * @default [0, 0, 0, 255]\n */\n getLineColor?: Accessor;\n\n /**\n * Line width value or accessor.\n *\n * @default 1\n */\n getLineWidth?: Accessor;\n\n /**\n * Elevation valur or accessor.\n *\n * Only used if `extruded: true`.\n *\n * @default 1000\n */\n getElevation?: Accessor;\n\n /**\n * This property has been moved to `PathStyleExtension`.\n *\n * @deprecated\n */\n getLineDashArray?: Accessor | null;\n\n /**\n * If `false`, will skip normalizing the coordinates returned by `getPolygon`.\n *\n * **Note**: This prop is experimental\n *\n * @default true\n */\n _normalize?: boolean;\n\n /**\n * Specifies the winding order of rings in the polygon data.\n *\n * **Note**: This prop is experimental\n *\n * @default 'CW'\n */\n _windingOrder?: 'CW' | 'CCW';\n\n /**\n * Material settings for lighting effect. Applies if `extruded: true`.\n *\n * @default true\n * @see https://deck.gl/docs/developer-guide/using-lighting\n */\n material?: Material;\n};\n\nconst defaultLineColor: [number, number, number, number] = [0, 0, 0, 255];\nconst defaultFillColor: [number, number, number, number] = [0, 0, 0, 255];\n\nconst defaultProps: DefaultProps = {\n stroked: true,\n filled: true,\n extruded: false,\n elevationScale: 1,\n wireframe: false,\n _normalize: true,\n _windingOrder: 'CW',\n\n lineWidthUnits: 'meters',\n lineWidthScale: 1,\n lineWidthMinPixels: 0,\n lineWidthMaxPixels: Number.MAX_SAFE_INTEGER,\n lineJointRounded: false,\n lineMiterLimit: 4,\n\n getPolygon: {type: 'accessor', value: (f: any) => f.polygon},\n // Polygon fill color\n getFillColor: {type: 'accessor', value: defaultFillColor},\n // Point, line and polygon outline color\n getLineColor: {type: 'accessor', value: defaultLineColor},\n // Line and polygon outline accessors\n getLineWidth: {type: 'accessor', value: 1},\n // Polygon extrusion accessor\n getElevation: {type: 'accessor', value: 1000},\n\n // Optional material for 'lighting' shader module\n material: true\n};\n\n/** A composite layer that renders filled, stroked and/or extruded polygons. */\nexport default class PolygonLayer extends CompositeLayer<\n Required<_PolygonLayerProps> & ExtraProps\n> {\n static layerName = 'PolygonLayer';\n static defaultProps = defaultProps;\n\n state!: {\n paths: number[][];\n pathsDiff:\n | {\n startRow: number;\n endRow: number;\n }[]\n | null;\n };\n\n initializeState(): void {\n this.state = {\n paths: [],\n pathsDiff: null\n };\n\n if (this.props.getLineDashArray) {\n log.removed('getLineDashArray', 'PathStyleExtension')();\n }\n }\n\n updateState({changeFlags}: UpdateParameters) {\n const geometryChanged =\n changeFlags.dataChanged ||\n (changeFlags.updateTriggersChanged &&\n (changeFlags.updateTriggersChanged.all || changeFlags.updateTriggersChanged.getPolygon));\n\n if (geometryChanged && Array.isArray(changeFlags.dataChanged)) {\n const paths = this.state.paths.slice();\n const pathsDiff = changeFlags.dataChanged.map(dataRange =>\n replaceInRange({\n data: paths,\n getIndex: p => p.__source.index,\n dataRange,\n replace: this._getPaths(dataRange)\n })\n );\n this.setState({paths, pathsDiff});\n } else if (geometryChanged) {\n this.setState({\n paths: this._getPaths(),\n pathsDiff: null\n });\n }\n }\n\n private _getPaths(dataRange: {startRow?: number; endRow?: number} = {}): {path: number[]}[] {\n const {data, getPolygon, positionFormat, _normalize} = this.props;\n const paths: {path: number[]}[] = [];\n const positionSize = positionFormat === 'XY' ? 2 : 3;\n const {startRow, endRow} = dataRange;\n\n const {iterable, objectInfo} = createIterable(data, startRow, endRow);\n for (const object of iterable) {\n objectInfo.index++;\n let polygon = getPolygon(object, objectInfo);\n if (_normalize) {\n polygon = Polygon.normalize(polygon, positionSize);\n }\n const {holeIndices} = polygon;\n const positions = polygon.positions || polygon;\n\n if (holeIndices) {\n // split the positions array into `holeIndices.length + 1` rings\n // holeIndices[-1] falls back to 0\n // holeIndices[holeIndices.length] falls back to positions.length\n for (let i = 0; i <= holeIndices.length; i++) {\n const path = positions.slice(holeIndices[i - 1] || 0, holeIndices[i] || positions.length);\n paths.push(this.getSubLayerRow({path}, object, objectInfo.index));\n }\n } else {\n paths.push(this.getSubLayerRow({path: positions}, object, objectInfo.index));\n }\n }\n return paths;\n }\n\n /* eslint-disable complexity */\n renderLayers(): Layer | null | LayersList {\n // Layer composition props\n const {\n data,\n _dataDiff,\n stroked,\n filled,\n extruded,\n wireframe,\n _normalize,\n _windingOrder,\n elevationScale,\n transitions,\n positionFormat\n } = this.props;\n\n // Rendering props underlying layer\n const {\n lineWidthUnits,\n lineWidthScale,\n lineWidthMinPixels,\n lineWidthMaxPixels,\n lineJointRounded,\n lineMiterLimit,\n lineDashJustified\n } = this.props;\n\n // Accessor props for underlying layers\n const {\n getFillColor,\n getLineColor,\n getLineWidth,\n getLineDashArray,\n getElevation,\n getPolygon,\n updateTriggers,\n material\n } = this.props;\n\n const {paths, pathsDiff} = this.state;\n\n const FillLayer = this.getSubLayerClass('fill', SolidPolygonLayer);\n const StrokeLayer = this.getSubLayerClass('stroke', PathLayer);\n\n // Filled Polygon Layer\n const polygonLayer =\n this.shouldRenderSubLayer('fill', paths) &&\n new FillLayer(\n {\n _dataDiff,\n extruded,\n elevationScale,\n\n filled,\n wireframe,\n _normalize,\n _windingOrder,\n\n getElevation,\n getFillColor,\n getLineColor: extruded && wireframe ? getLineColor : defaultLineColor,\n\n material,\n transitions\n },\n this.getSubLayerProps({\n id: 'fill',\n updateTriggers: updateTriggers && {\n getPolygon: updateTriggers.getPolygon,\n getElevation: updateTriggers.getElevation,\n getFillColor: updateTriggers.getFillColor,\n // using a legacy API to invalid lineColor attributes\n // if (extruded && wireframe) has changed\n lineColors: extruded && wireframe,\n getLineColor: updateTriggers.getLineColor\n }\n }),\n {\n data,\n positionFormat,\n getPolygon\n }\n );\n\n // Polygon line layer\n const polygonLineLayer =\n !extruded &&\n stroked &&\n this.shouldRenderSubLayer('stroke', paths) &&\n new StrokeLayer(\n {\n _dataDiff: pathsDiff && (() => pathsDiff),\n widthUnits: lineWidthUnits,\n widthScale: lineWidthScale,\n widthMinPixels: lineWidthMinPixels,\n widthMaxPixels: lineWidthMaxPixels,\n jointRounded: lineJointRounded,\n miterLimit: lineMiterLimit,\n dashJustified: lineDashJustified,\n\n // Already normalized\n _pathType: 'loop',\n\n transitions: transitions && {\n getWidth: transitions.getLineWidth,\n getColor: transitions.getLineColor,\n getPath: transitions.getPolygon\n },\n\n getColor: this.getSubLayerAccessor(getLineColor),\n getWidth: this.getSubLayerAccessor(getLineWidth),\n getDashArray: this.getSubLayerAccessor(getLineDashArray)\n },\n this.getSubLayerProps({\n id: 'stroke',\n updateTriggers: updateTriggers && {\n getWidth: updateTriggers.getLineWidth,\n getColor: updateTriggers.getLineColor,\n getDashArray: updateTriggers.getLineDashArray\n }\n }),\n {\n data: paths,\n positionFormat,\n getPath: x => x.path\n }\n );\n\n return [\n // If not extruded: flat fill layer is drawn below outlines\n !extruded && polygonLayer,\n polygonLineLayer,\n // If extruded: draw fill layer last for correct blending behavior\n extruded && polygonLayer\n ];\n }\n /* eslint-enable complexity */\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {Layer, project32, picking, COORDINATE_SYSTEM} from '@deck.gl/core';\nimport {Model, Geometry} from '@luma.gl/engine';\nimport {gouraudMaterial} from '@luma.gl/shadertools';\n\n// Polygon geometry generation is managed by the polygon tesselator\nimport PolygonTesselator from './polygon-tesselator';\n\nimport {solidPolygonUniforms, SolidPolygonProps} from './solid-polygon-layer-uniforms';\nimport vsTop from './solid-polygon-layer-vertex-top.glsl';\nimport vsSide from './solid-polygon-layer-vertex-side.glsl';\nimport fs from './solid-polygon-layer-fragment.glsl';\n\nimport type {\n LayerProps,\n LayerDataSource,\n Color,\n Material,\n Accessor,\n AccessorFunction,\n UpdateParameters,\n GetPickingInfoParams,\n PickingInfo,\n DefaultProps\n} from '@deck.gl/core';\nimport type {PolygonGeometry} from './polygon';\n\ntype _SolidPolygonLayerProps = {\n data: LayerDataSource;\n /** Whether to fill the polygons\n * @default true\n */\n filled?: boolean;\n /** Whether to extrude the polygons\n * @default false\n */\n extruded?: boolean;\n /** Whether to generate a line wireframe of the polygon.\n * @default false\n */\n wireframe?: boolean;\n /**\n * (Experimental) If `false`, will skip normalizing the coordinates returned by `getPolygon`.\n * @default true\n */\n _normalize?: boolean;\n /**\n * (Experimental) This prop is only effective with `_normalize: false`.\n * It specifies the winding order of rings in the polygon data, one of 'CW' (clockwise) and 'CCW' (counter-clockwise)\n */\n _windingOrder?: 'CW' | 'CCW';\n\n /**\n * (Experimental) This prop is only effective with `XYZ` data.\n * When true, polygon tesselation will be performed on the plane with the largest area, instead of the xy plane.\n * @default false\n */\n _full3d?: boolean;\n\n /** Elevation multiplier.\n * @default 1\n */\n elevationScale?: number;\n\n /** Polygon geometry accessor. */\n getPolygon?: AccessorFunction;\n /** Extrusion height accessor.\n * @default 1000\n */\n getElevation?: Accessor;\n /** Fill color accessor.\n * @default [0, 0, 0, 255]\n */\n getFillColor?: Accessor;\n /** Stroke color accessor.\n * @default [0, 0, 0, 255]\n */\n getLineColor?: Accessor;\n\n /**\n * Material settings for lighting effect. Applies if `extruded: true`\n *\n * @default true\n * @see https://deck.gl/docs/developer-guide/using-lighting\n */\n material?: Material;\n};\n\n/** Render filled and/or extruded polygons. */\nexport type SolidPolygonLayerProps = _SolidPolygonLayerProps & LayerProps;\n\nconst DEFAULT_COLOR: [number, number, number, number] = [0, 0, 0, 255];\n\nconst defaultProps: DefaultProps = {\n filled: true,\n extruded: false,\n wireframe: false,\n _normalize: true,\n _windingOrder: 'CW',\n _full3d: false,\n\n elevationScale: {type: 'number', min: 0, value: 1},\n\n getPolygon: {type: 'accessor', value: (f: any) => f.polygon},\n getElevation: {type: 'accessor', value: 1000},\n getFillColor: {type: 'accessor', value: DEFAULT_COLOR},\n getLineColor: {type: 'accessor', value: DEFAULT_COLOR},\n\n material: true\n};\n\nconst ATTRIBUTE_TRANSITION = {\n enter: (value, chunk) => {\n return chunk.length ? chunk.subarray(chunk.length - value.length) : value;\n }\n};\n\nexport default class SolidPolygonLayer extends Layer<\n ExtraPropsT & Required<_SolidPolygonLayerProps>\n> {\n static defaultProps = defaultProps;\n static layerName = 'SolidPolygonLayer';\n\n state!: {\n topModel?: Model;\n sideModel?: Model;\n wireframeModel?: Model;\n models?: Model[];\n numInstances: number;\n polygonTesselator: PolygonTesselator;\n };\n\n getShaders(type) {\n return super.getShaders({\n vs: type === 'top' ? vsTop : vsSide,\n fs,\n defines: {\n RING_WINDING_ORDER_CW: !this.props._normalize && this.props._windingOrder === 'CCW' ? 0 : 1\n },\n modules: [project32, gouraudMaterial, picking, solidPolygonUniforms]\n });\n }\n\n get wrapLongitude(): boolean {\n return false;\n }\n\n getBounds(): [number[], number[]] | null {\n return this.getAttributeManager()?.getBounds(['vertexPositions']);\n }\n\n initializeState() {\n const {viewport} = this.context;\n let {coordinateSystem} = this.props;\n const {_full3d} = this.props;\n if (viewport.isGeospatial && coordinateSystem === COORDINATE_SYSTEM.DEFAULT) {\n coordinateSystem = COORDINATE_SYSTEM.LNGLAT;\n }\n\n let preproject: ((xy: number[]) => number[]) | undefined;\n\n if (coordinateSystem === COORDINATE_SYSTEM.LNGLAT) {\n if (_full3d) {\n preproject = viewport.projectPosition.bind(viewport);\n } else {\n preproject = viewport.projectFlat.bind(viewport);\n }\n }\n\n this.setState({\n numInstances: 0,\n polygonTesselator: new PolygonTesselator({\n // Lnglat coordinates are usually projected non-linearly, which affects tesselation results\n // Provide a preproject function if the coordinates are in lnglat\n preproject,\n fp64: this.use64bitPositions(),\n IndexType: Uint32Array\n })\n });\n\n const attributeManager = this.getAttributeManager()!;\n const noAlloc = true;\n\n attributeManager.remove(['instancePickingColors']);\n\n /* eslint-disable max-len */\n attributeManager.add({\n indices: {\n size: 1,\n isIndexed: true,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n update: this.calculateIndices,\n noAlloc\n },\n vertexPositions: {\n size: 3,\n type: 'float64',\n stepMode: 'dynamic',\n fp64: this.use64bitPositions(),\n transition: ATTRIBUTE_TRANSITION,\n accessor: 'getPolygon',\n // eslint-disable-next-line @typescript-eslint/unbound-method\n update: this.calculatePositions,\n noAlloc,\n shaderAttributes: {\n nextVertexPositions: {\n vertexOffset: 1\n }\n }\n },\n instanceVertexValid: {\n size: 1,\n type: 'uint16',\n stepMode: 'instance',\n // eslint-disable-next-line @typescript-eslint/unbound-method\n update: this.calculateVertexValid,\n noAlloc\n },\n elevations: {\n size: 1,\n stepMode: 'dynamic',\n transition: ATTRIBUTE_TRANSITION,\n accessor: 'getElevation'\n },\n fillColors: {\n size: this.props.colorFormat.length,\n type: 'unorm8',\n stepMode: 'dynamic',\n transition: ATTRIBUTE_TRANSITION,\n accessor: 'getFillColor',\n defaultValue: DEFAULT_COLOR\n },\n lineColors: {\n size: this.props.colorFormat.length,\n type: 'unorm8',\n stepMode: 'dynamic',\n transition: ATTRIBUTE_TRANSITION,\n accessor: 'getLineColor',\n defaultValue: DEFAULT_COLOR\n },\n pickingColors: {\n size: 4,\n type: 'uint8',\n stepMode: 'dynamic',\n accessor: (object, {index, target: value}) =>\n this.encodePickingColor(object && object.__source ? object.__source.index : index, value)\n }\n });\n /* eslint-enable max-len */\n }\n\n getPickingInfo(params: GetPickingInfoParams): PickingInfo {\n const info = super.getPickingInfo(params);\n const {index} = info;\n const data = this.props.data as any[];\n\n // Check if data comes from a composite layer, wrapped with getSubLayerRow\n if (data[0] && data[0].__source) {\n // index decoded from picking color refers to the source index\n info.object = data.find(d => d.__source.index === index);\n }\n return info;\n }\n\n disablePickingIndex(objectIndex: number) {\n const data = this.props.data as any[];\n\n // Check if data comes from a composite layer, wrapped with getSubLayerRow\n if (data[0] && data[0].__source) {\n // index decoded from picking color refers to the source index\n for (let i = 0; i < data.length; i++) {\n if (data[i].__source.index === objectIndex) {\n this._disablePickingIndex(i);\n }\n }\n } else {\n super.disablePickingIndex(objectIndex);\n }\n }\n\n draw({uniforms}) {\n const {extruded, filled, wireframe, elevationScale} = this.props;\n const {topModel, sideModel, wireframeModel, polygonTesselator} = this.state;\n\n const renderUniforms: SolidPolygonProps = {\n extruded: Boolean(extruded),\n elevationScale,\n isWireframe: false\n };\n\n // Note - the order is important\n if (wireframeModel && wireframe) {\n wireframeModel.setInstanceCount(polygonTesselator.instanceCount - 1);\n wireframeModel.shaderInputs.setProps({solidPolygon: {...renderUniforms, isWireframe: true}});\n wireframeModel.draw(this.context.renderPass);\n }\n\n if (sideModel && filled) {\n sideModel.setInstanceCount(polygonTesselator.instanceCount - 1);\n sideModel.shaderInputs.setProps({solidPolygon: renderUniforms});\n sideModel.draw(this.context.renderPass);\n }\n\n if (topModel && filled) {\n topModel.setVertexCount(polygonTesselator.vertexCount);\n topModel.shaderInputs.setProps({solidPolygon: renderUniforms});\n topModel.draw(this.context.renderPass);\n }\n }\n\n updateState(updateParams: UpdateParameters) {\n super.updateState(updateParams);\n\n this.updateGeometry(updateParams);\n\n const {props, oldProps, changeFlags} = updateParams;\n const attributeManager = this.getAttributeManager();\n\n const regenerateModels =\n changeFlags.extensionsChanged ||\n props.filled !== oldProps.filled ||\n props.extruded !== oldProps.extruded;\n\n if (regenerateModels) {\n this.state.models?.forEach(model => model.destroy());\n\n this.setState(this._getModels());\n attributeManager!.invalidateAll();\n }\n }\n\n protected updateGeometry({props, oldProps, changeFlags}: UpdateParameters) {\n const geometryConfigChanged =\n changeFlags.dataChanged ||\n (changeFlags.updateTriggersChanged &&\n (changeFlags.updateTriggersChanged.all || changeFlags.updateTriggersChanged.getPolygon));\n\n // When the geometry config or the data is changed,\n // tessellator needs to be invoked\n if (geometryConfigChanged) {\n const {polygonTesselator} = this.state;\n const buffers = (props.data as any).attributes || {};\n polygonTesselator.updateGeometry({\n data: props.data,\n normalize: props._normalize,\n geometryBuffer: buffers.getPolygon,\n buffers,\n getGeometry: props.getPolygon,\n positionFormat: props.positionFormat,\n wrapLongitude: props.wrapLongitude,\n // TODO - move the flag out of the viewport\n resolution: this.context.viewport.resolution,\n fp64: this.use64bitPositions(),\n dataChanged: changeFlags.dataChanged,\n full3d: props._full3d\n });\n\n this.setState({\n numInstances: polygonTesselator.instanceCount,\n startIndices: polygonTesselator.vertexStarts\n });\n\n if (!changeFlags.dataChanged) {\n // Base `layer.updateState` only invalidates all attributes on data change\n // Cover the rest of the scenarios here\n this.getAttributeManager()!.invalidateAll();\n }\n }\n }\n\n protected _getModels() {\n const {id, filled, extruded} = this.props;\n\n let topModel;\n let sideModel;\n let wireframeModel;\n\n if (filled) {\n const shaders = this.getShaders('top');\n shaders.defines.NON_INSTANCED_MODEL = 1;\n const bufferLayout = this.getAttributeManager()!.getBufferLayouts({isInstanced: false});\n\n topModel = new Model(this.context.device, {\n ...shaders,\n id: `${id}-top`,\n topology: 'triangle-list',\n bufferLayout,\n isIndexed: true,\n userData: {\n excludeAttributes: {instanceVertexValid: true}\n }\n });\n }\n if (extruded) {\n const bufferLayout = this.getAttributeManager()!.getBufferLayouts({isInstanced: true});\n\n sideModel = new Model(this.context.device, {\n ...this.getShaders('side'),\n id: `${id}-side`,\n bufferLayout,\n geometry: new Geometry({\n topology: 'triangle-strip',\n attributes: {\n // top right - top left - bottom right - bottom left\n positions: {\n size: 2,\n value: new Float32Array([1, 0, 0, 0, 1, 1, 0, 1])\n }\n }\n }),\n isInstanced: true,\n userData: {\n excludeAttributes: {indices: true}\n }\n });\n\n wireframeModel = new Model(this.context.device, {\n ...this.getShaders('side'),\n id: `${id}-wireframe`,\n bufferLayout,\n geometry: new Geometry({\n topology: 'line-strip',\n attributes: {\n // top right - top left - bottom left - bottom right\n positions: {\n size: 2,\n value: new Float32Array([1, 0, 0, 0, 0, 1, 1, 1])\n }\n }\n }),\n isInstanced: true,\n userData: {\n excludeAttributes: {indices: true}\n }\n });\n }\n\n return {\n models: [sideModel, wireframeModel, topModel].filter(Boolean),\n topModel,\n sideModel,\n wireframeModel\n };\n }\n\n protected calculateIndices(attribute) {\n const {polygonTesselator} = this.state;\n attribute.startIndices = polygonTesselator.indexStarts;\n attribute.value = polygonTesselator.get('indices');\n }\n\n protected calculatePositions(attribute) {\n const {polygonTesselator} = this.state;\n attribute.startIndices = polygonTesselator.vertexStarts;\n attribute.value = polygonTesselator.get('positions');\n }\n\n protected calculateVertexValid(attribute) {\n attribute.value = this.state.polygonTesselator.get('vertexValid');\n }\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/* eslint-disable max-params */\nimport earcut from 'earcut';\nimport {modifyPolygonWindingDirection, WINDING} from '@math.gl/polygon';\n\nimport type {Position} from '@deck.gl/core';\nimport type {NumericArray} from '@math.gl/core';\n\nconst OUTER_POLYGON_WINDING = WINDING.CLOCKWISE;\nconst HOLE_POLYGON_WINDING = WINDING.COUNTER_CLOCKWISE;\n\ntype WindingOptions = {\n start?: number;\n end?: number;\n size?: number;\n isClosed?: boolean;\n};\n\n/** A scratch object for sending winding options */\nconst windingOptions: WindingOptions = {\n isClosed: true\n};\n\n// 4 data formats are supported:\n\n/** Simple Polygon: an array of points */\nexport type NestedSimplePolygonGeometry = Position[];\n/** Complex Polygon: an array of array of points (array of rings)\n * with the first ring representing the outer hull and other rings representing holes\n */\nexport type NestedComplexPolygonGeometry = Position[][];\n/** An array of numbers (flattened \"simple polygon\") */\nexport type FlatSimplePolygonGeometry = NumericArray;\n/** Flattened \"complex polygon\" */\nexport type FlatComplexPolygonGeometry = {positions: NumericArray; holeIndices: NumericArray};\n\nexport type PolygonGeometry =\n | NestedSimplePolygonGeometry\n | NestedComplexPolygonGeometry\n | FlatSimplePolygonGeometry\n | FlatComplexPolygonGeometry;\n\nexport type NormalizedPolygonGeometry = FlatSimplePolygonGeometry | FlatComplexPolygonGeometry;\n\n/**\n * Ensure a polygon is valid format\n */\nfunction validate(polygon: PolygonGeometry): void {\n polygon = (polygon && (polygon as FlatComplexPolygonGeometry).positions) || polygon;\n if (!Array.isArray(polygon) && !ArrayBuffer.isView(polygon)) {\n throw new Error('invalid polygon');\n }\n}\n\n/** Get the positions from a normalized polygon */\nexport function getPositions(polygon: NormalizedPolygonGeometry): NumericArray {\n return 'positions' in polygon ? polygon.positions : polygon;\n}\n\n/** Get the hole indices from a normalized polygon */\nexport function getHoleIndices(polygon: NormalizedPolygonGeometry): NumericArray | null {\n return 'holeIndices' in polygon ? polygon.holeIndices : null;\n}\n\n/**\n * Check if a polygon is nested or flat\n * Returns true if the polygon is a flat polygon (i.e. not an array of polygons)\n */\nfunction isNested(\n polygon: PolygonGeometry\n): polygon is NestedSimplePolygonGeometry | NestedComplexPolygonGeometry {\n return Array.isArray(polygon[0]);\n}\n\n/**\n * Check if a polygon is simple or complex\n * Returns true if the polygon is a simple polygon (i.e. not an array of polygons)\n */\nfunction isSimple(\n polygon: NestedSimplePolygonGeometry | NestedComplexPolygonGeometry\n): polygon is NestedSimplePolygonGeometry {\n return polygon.length >= 1 && polygon[0].length >= 2 && Number.isFinite(polygon[0][0]);\n}\n\n/**\n * Check if a simple polygon is a closed ring\n * Returns true if the simple polygon is a closed ring\n */\nfunction isNestedRingClosed(simplePolygon: NestedSimplePolygonGeometry): boolean {\n // check if first and last vertex are the same\n const p0 = simplePolygon[0];\n const p1 = simplePolygon[simplePolygon.length - 1];\n\n return p0[0] === p1[0] && p0[1] === p1[1] && p0[2] === p1[2];\n}\n\n/**\n * Check if a simple flat array is a closed ring\n * Returns true if the simple flat array is a closed ring\n */\nfunction isFlatRingClosed(\n positions: FlatSimplePolygonGeometry,\n /** size of a position, 2 (xy) or 3 (xyz) */\n size: number,\n /** start index of the path in the positions array */\n startIndex: number,\n /** end index of the path in the positions array */\n endIndex: number\n): boolean {\n for (let i = 0; i < size; i++) {\n if (positions[startIndex + i] !== positions[endIndex - size + i]) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Copy a simple polygon coordinates into a flat array, closes the ring if needed.\n * Returns the index of the write head in the destination\n */\nfunction copyNestedRing(\n /** destination */\n target: NumericArray,\n /** index in the destination to start copying into */\n targetStartIndex: number,\n /** the source polygon */\n simplePolygon: NestedSimplePolygonGeometry,\n /** size of a position, 2 (xy) or 3 (xyz) */\n size: number,\n /** modify polygon to be of the specified winding direction */\n windingDirection: number\n): number {\n let targetIndex = targetStartIndex;\n const len = simplePolygon.length;\n for (let i = 0; i < len; i++) {\n for (let j = 0; j < size; j++) {\n target[targetIndex++] = simplePolygon[i][j] || 0;\n }\n }\n\n if (!isNestedRingClosed(simplePolygon)) {\n for (let j = 0; j < size; j++) {\n target[targetIndex++] = simplePolygon[0][j] || 0;\n }\n }\n\n windingOptions.start = targetStartIndex;\n windingOptions.end = targetIndex;\n windingOptions.size = size;\n modifyPolygonWindingDirection(target, windingDirection, windingOptions);\n\n return targetIndex;\n}\n\n/**\n * Copy a simple flat array into another flat array, closes the ring if needed.\n * Returns the index of the write head in the destination\n */\nfunction copyFlatRing(\n /** destination */\n target: NumericArray,\n /** index in the destination to start copying into */\n targetStartIndex: number,\n /** the source polygon */\n positions: FlatSimplePolygonGeometry,\n /** size of a position, 2 (xy) or 3 (xyz) */\n size: number,\n /** start index of the path in the positions array */\n srcStartIndex: number = 0,\n /** end index of the path in the positions array */\n srcEndIndex: number,\n windingDirection: number\n): number {\n srcEndIndex = srcEndIndex || positions.length;\n const srcLength = srcEndIndex - srcStartIndex;\n if (srcLength <= 0) {\n return targetStartIndex;\n }\n let targetIndex = targetStartIndex;\n\n for (let i = 0; i < srcLength; i++) {\n target[targetIndex++] = positions[srcStartIndex + i];\n }\n\n if (!isFlatRingClosed(positions, size, srcStartIndex, srcEndIndex)) {\n for (let i = 0; i < size; i++) {\n target[targetIndex++] = positions[srcStartIndex + i];\n }\n }\n\n windingOptions.start = targetStartIndex;\n windingOptions.end = targetIndex;\n windingOptions.size = size;\n modifyPolygonWindingDirection(target, windingDirection, windingOptions);\n\n return targetIndex;\n}\n\n/**\n * Normalize any polygon representation into the \"complex flat\" format\n */\n/* eslint-disable max-statements */\nexport function normalize(\n polygon: PolygonGeometry,\n positionSize: number\n): NormalizedPolygonGeometry {\n validate(polygon);\n\n const positions: number[] = [];\n const holeIndices: number[] = [];\n\n if ('positions' in polygon) {\n // complex flat\n const {positions: srcPositions, holeIndices: srcHoleIndices} = polygon;\n\n if (srcHoleIndices) {\n let targetIndex = 0;\n // split the positions array into `holeIndices.length + 1` rings\n // holeIndices[-1] falls back to 0\n // holeIndices[holeIndices.length] falls back to positions.length\n for (let i = 0; i <= srcHoleIndices.length; i++) {\n targetIndex = copyFlatRing(\n positions,\n targetIndex,\n srcPositions,\n positionSize,\n srcHoleIndices[i - 1],\n srcHoleIndices[i],\n i === 0 ? OUTER_POLYGON_WINDING : HOLE_POLYGON_WINDING\n );\n holeIndices.push(targetIndex);\n }\n // The last one is not a starting index of a hole, remove\n holeIndices.pop();\n\n return {positions, holeIndices};\n }\n polygon = srcPositions;\n }\n if (!isNested(polygon)) {\n // simple flat\n copyFlatRing(positions, 0, polygon, positionSize, 0, positions.length, OUTER_POLYGON_WINDING);\n return positions;\n }\n if (!isSimple(polygon)) {\n // complex polygon\n let targetIndex = 0;\n\n for (const [polygonIndex, simplePolygon] of polygon.entries()) {\n targetIndex = copyNestedRing(\n positions,\n targetIndex,\n simplePolygon,\n positionSize,\n polygonIndex === 0 ? OUTER_POLYGON_WINDING : HOLE_POLYGON_WINDING\n );\n holeIndices.push(targetIndex);\n }\n // The last one is not a starting index of a hole, remove\n holeIndices.pop();\n // last index points to the end of the array, remove it\n return {positions, holeIndices};\n }\n // simple polygon\n copyNestedRing(positions, 0, polygon, positionSize, OUTER_POLYGON_WINDING);\n return positions;\n}\n/* eslint-enable max-statements */\n\n/*\n * Calculate the area of a single plane of the polygon\n */\nfunction getPlaneArea(positions: NumericArray, xIndex: number, yIndex: number): number {\n const numVerts = positions.length / 3;\n let area = 0;\n for (let i = 0; i < numVerts; i++) {\n const j = (i + 1) % numVerts;\n area += positions[i * 3 + xIndex] * positions[j * 3 + yIndex];\n area -= positions[j * 3 + xIndex] * positions[i * 3 + yIndex];\n }\n return Math.abs(area / 2);\n}\n\nfunction permutePositions(positions: NumericArray, xIndex: number, yIndex: number, zIndex: number) {\n const numVerts = positions.length / 3;\n for (let i = 0; i < numVerts; i++) {\n const o = i * 3;\n\n const x = positions[o + 0];\n const y = positions[o + 1];\n const z = positions[o + 2];\n\n positions[o + xIndex] = x;\n positions[o + yIndex] = y;\n positions[o + zIndex] = z;\n }\n}\n\n/**\n * Get vertex indices for drawing polygon mesh (triangulation)\n */\n// eslint-disable-next-line complexity, max-statements\nexport function getSurfaceIndices(\n polygon: NormalizedPolygonGeometry,\n positionSize: number,\n preproject?: (xy: number[]) => number[],\n full3d?: boolean\n): number[] {\n let holeIndices = getHoleIndices(polygon);\n if (holeIndices) {\n holeIndices = holeIndices.map(positionIndex => positionIndex / positionSize);\n }\n\n let positions = getPositions(polygon);\n\n const is3d = full3d && positionSize === 3;\n\n if (preproject) {\n // When tesselating lnglat coordinates, project them to the common space for accuracy\n const n = positions.length;\n\n // Clone the array\n positions = positions.slice();\n\n const p: number[] = [];\n for (let i = 0; i < n; i += positionSize) {\n p[0] = positions[i];\n p[1] = positions[i + 1];\n\n if (is3d) {\n p[2] = positions[i + 2];\n }\n\n const xy = preproject(p);\n\n positions[i] = xy[0];\n positions[i + 1] = xy[1];\n\n if (is3d) {\n positions[i + 2] = xy[2];\n }\n }\n }\n\n if (is3d) {\n // calculate plane with largest area\n const xyArea = getPlaneArea(positions, 0, 1);\n const xzArea = getPlaneArea(positions, 0, 2);\n const yzArea = getPlaneArea(positions, 1, 2);\n\n if (!xyArea && !xzArea && !yzArea) {\n return []; // no planes have area, nothing we can do\n }\n\n // permute positions to make the largest plane xy for earcut\n if (xyArea > xzArea && xyArea > yzArea) {\n // xy plane largest, nothing to do\n } else if (xzArea > yzArea) {\n // xz plane largest, permute to make xyz -> xzy\n if (!preproject) {\n positions = positions.slice();\n }\n permutePositions(positions, 0, 2, 1);\n } else {\n // yz plane largest, permute to make xyz -> yzx\n if (!preproject) {\n positions = positions.slice();\n }\n permutePositions(positions, 2, 0, 1);\n }\n }\n\n // Let earcut triangulate the polygon\n return earcut(positions, holeIndices, positionSize);\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// Handles tesselation of polygons with holes\n// - 2D surfaces\n// - 2D outlines\n// - 3D surfaces (top and sides only)\n// - 3D wireframes (not yet)\nimport * as Polygon from './polygon';\nimport {Tesselator} from '@deck.gl/core';\nimport {cutPolygonByGrid, cutPolygonByMercatorBounds} from '@math.gl/polygon';\n\nimport type {\n PolygonGeometry,\n NormalizedPolygonGeometry,\n FlatComplexPolygonGeometry\n} from './polygon';\nimport type {TypedArray} from '@math.gl/core';\n\ntype GeometryUpdateContext = {\n vertexStart: number;\n indexStart: number;\n geometrySize: number;\n geometryIndex: number;\n};\n\ntype CutPolygon = FlatComplexPolygonGeometry & {\n edgeTypes: number[];\n};\n\n// This class is set up to allow querying one attribute at a time\n// the way the AttributeManager expects it\nexport default class PolygonTesselator extends Tesselator<\n PolygonGeometry,\n NormalizedPolygonGeometry | CutPolygon[],\n {\n fp64?: boolean;\n IndexType?: Uint32ArrayConstructor | Uint16ArrayConstructor;\n resolution?: number;\n wrapLongitude?: boolean;\n preproject?: (xy: number[]) => number[];\n full3d?: boolean;\n }\n> {\n constructor(opts) {\n const {fp64, IndexType = Uint32Array} = opts;\n super({\n ...opts,\n attributes: {\n positions: {size: 3, type: fp64 ? Float64Array : Float32Array},\n vertexValid: {type: Uint16Array, size: 1},\n indices: {type: IndexType, size: 1}\n }\n });\n }\n\n /** Get attribute by name */\n get(attributeName: string): TypedArray | null {\n const {attributes} = this;\n if (attributeName === 'indices') {\n return attributes.indices && attributes.indices.subarray(0, this.vertexCount);\n }\n\n return attributes[attributeName];\n }\n\n /** Override base Tesselator method */\n updateGeometry(opts) {\n super.updateGeometry(opts);\n\n const externalIndices = this.buffers.indices;\n if (externalIndices) {\n // @ts-ignore (2339) value is not defined on TypedArray (fall through)\n this.vertexCount = (externalIndices.value || externalIndices).length;\n } else if (this.data && !this.getGeometry) {\n throw new Error('missing indices buffer');\n }\n }\n\n /** Implement base Tesselator interface */\n protected normalizeGeometry(polygon: PolygonGeometry): NormalizedPolygonGeometry | CutPolygon[] {\n if (this.normalize) {\n const normalizedPolygon = Polygon.normalize(polygon, this.positionSize);\n if (this.opts.resolution) {\n return cutPolygonByGrid(\n Polygon.getPositions(normalizedPolygon),\n Polygon.getHoleIndices(normalizedPolygon),\n {\n size: this.positionSize,\n gridResolution: this.opts.resolution,\n edgeTypes: true\n }\n ) as CutPolygon[];\n }\n if (this.opts.wrapLongitude) {\n return cutPolygonByMercatorBounds(\n Polygon.getPositions(normalizedPolygon),\n Polygon.getHoleIndices(normalizedPolygon),\n {\n size: this.positionSize,\n maxLatitude: 86,\n edgeTypes: true\n }\n ) as CutPolygon[];\n }\n return normalizedPolygon;\n }\n // normalize is explicitly set to false, assume that user passed in already normalized polygons\n return polygon as NormalizedPolygonGeometry;\n }\n\n /** Implement base Tesselator interface */\n protected getGeometrySize(polygon: NormalizedPolygonGeometry | CutPolygon[]): number {\n if (isCut(polygon)) {\n let size = 0;\n for (const subPolygon of polygon) {\n size += this.getGeometrySize(subPolygon);\n }\n return size;\n }\n return Polygon.getPositions(polygon).length / this.positionSize;\n }\n\n /** Override base Tesselator method */\n protected getGeometryFromBuffer(buffer) {\n if (this.normalize || !this.buffers.indices) {\n return super.getGeometryFromBuffer(buffer);\n }\n // we don't need to read the positions if no normalization/tesselation\n return null;\n }\n\n /** Implement base Tesselator interface */\n protected updateGeometryAttributes(\n polygon: NormalizedPolygonGeometry | CutPolygon[] | null,\n context: GeometryUpdateContext\n ) {\n if (polygon && isCut(polygon)) {\n for (const subPolygon of polygon) {\n const geometrySize = this.getGeometrySize(subPolygon);\n context.geometrySize = geometrySize;\n this.updateGeometryAttributes(subPolygon, context);\n context.vertexStart += geometrySize;\n context.indexStart = this.indexStarts[context.geometryIndex + 1];\n }\n } else {\n const normalizedPolygon = polygon as NormalizedPolygonGeometry;\n this._updateIndices(normalizedPolygon, context);\n this._updatePositions(normalizedPolygon, context);\n this._updateVertexValid(normalizedPolygon, context);\n }\n }\n\n // Flatten the indices array\n private _updateIndices(\n polygon: NormalizedPolygonGeometry | null,\n {geometryIndex, vertexStart: offset, indexStart}: GeometryUpdateContext\n ) {\n const {attributes, indexStarts, typedArrayManager} = this;\n\n let target = attributes.indices;\n if (!target || !polygon) {\n return;\n }\n let i = indexStart;\n\n // 1. get triangulated indices for the internal areas\n const indices = Polygon.getSurfaceIndices(\n polygon,\n this.positionSize,\n this.opts.preproject,\n this.opts.full3d\n );\n\n // make sure the buffer is large enough\n target = typedArrayManager.allocate(target, indexStart + indices.length, {\n copy: true\n });\n\n // 2. offset each index by the number of indices in previous polygons\n for (let j = 0; j < indices.length; j++) {\n target[i++] = indices[j] + offset;\n }\n\n indexStarts[geometryIndex + 1] = indexStart + indices.length;\n attributes.indices = target;\n }\n\n // Flatten out all the vertices of all the sub subPolygons\n private _updatePositions(\n polygon: NormalizedPolygonGeometry | null,\n {vertexStart, geometrySize}: GeometryUpdateContext\n ) {\n const {\n attributes: {positions},\n positionSize\n } = this;\n if (!positions || !polygon) {\n return;\n }\n const polygonPositions = Polygon.getPositions(polygon);\n\n for (let i = vertexStart, j = 0; j < geometrySize; i++, j++) {\n const x = polygonPositions[j * positionSize];\n const y = polygonPositions[j * positionSize + 1];\n const z = positionSize > 2 ? polygonPositions[j * positionSize + 2] : 0;\n\n positions[i * 3] = x;\n positions[i * 3 + 1] = y;\n positions[i * 3 + 2] = z;\n }\n }\n\n private _updateVertexValid(\n polygon: NormalizedPolygonGeometry | null,\n {vertexStart, geometrySize}: GeometryUpdateContext\n ) {\n const {positionSize} = this;\n const vertexValid = this.attributes.vertexValid as TypedArray;\n const holeIndices = polygon && Polygon.getHoleIndices(polygon);\n /* We are reusing the some buffer for `nextPositions` by offseting one vertex\n * to the left. As a result,\n * the last vertex of each ring overlaps with the first vertex of the next ring.\n * `vertexValid` is used to mark the end of each ring so we don't draw these\n * segments:\n positions A0 A1 A2 A3 A4 B0 B1 B2 C0 ...\n nextPositions A1 A2 A3 A4 B0 B1 B2 C0 C1 ...\n vertexValid 1 1 1 1 0 1 1 0 1 ...\n */\n if (polygon && (polygon as CutPolygon).edgeTypes) {\n vertexValid.set((polygon as CutPolygon).edgeTypes, vertexStart);\n } else {\n vertexValid.fill(1, vertexStart, vertexStart + geometrySize);\n }\n if (holeIndices) {\n for (let j = 0; j < holeIndices.length; j++) {\n vertexValid[vertexStart + holeIndices[j] / positionSize - 1] = 0;\n }\n }\n vertexValid[vertexStart + geometrySize - 1] = 0;\n }\n}\n\nfunction isCut(polygon: NormalizedPolygonGeometry | CutPolygon[]): polygon is CutPolygon[] {\n return Array.isArray(polygon) && polygon.length > 0 && !Number.isFinite(polygon[0]);\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderModule} from '@luma.gl/shadertools';\n\nconst uniformBlock = `\\\nuniform solidPolygonUniforms {\n bool extruded;\n bool isWireframe;\n float elevationScale;\n} solidPolygon;\n`;\n\nexport type SolidPolygonProps = {\n extruded: boolean;\n isWireframe: boolean;\n elevationScale: number;\n};\n\nexport const solidPolygonUniforms = {\n name: 'solidPolygon',\n vs: uniformBlock,\n fs: uniformBlock,\n uniformTypes: {\n extruded: 'f32',\n isWireframe: 'f32',\n elevationScale: 'f32'\n }\n} as const satisfies ShaderModule;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport default `\\\n\nin vec4 fillColors;\nin vec4 lineColors;\nin vec3 pickingColors;\n\nout vec4 vColor;\n\nstruct PolygonProps {\n vec3 positions;\n vec3 positions64Low;\n vec3 normal;\n float elevations;\n};\n\nvec3 project_offset_normal(vec3 vector) {\n if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT ||\n project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSETS) {\n // normals generated by the polygon tesselator are in lnglat offsets instead of meters\n return normalize(vector * project.commonUnitsPerWorldUnit);\n }\n return project_normal(vector);\n}\n\nvoid calculatePosition(PolygonProps props) {\n vec3 pos = props.positions;\n vec3 pos64Low = props.positions64Low;\n vec3 normal = props.normal;\n vec4 colors = solidPolygon.isWireframe ? lineColors : fillColors;\n\n geometry.worldPosition = props.positions;\n geometry.pickingColor = pickingColors;\n\n if (solidPolygon.extruded) {\n pos.z += props.elevations * solidPolygon.elevationScale;\n }\n gl_Position = project_position_to_clipspace(pos, pos64Low, vec3(0.), geometry.position);\n\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n\n if (solidPolygon.extruded) {\n #ifdef IS_SIDE_VERTEX\n normal = project_offset_normal(normal);\n #else\n normal = project_normal(normal);\n #endif\n geometry.normal = normal;\n vec3 lightColor = lighting_getLightColor(colors.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal);\n vColor = vec4(lightColor, colors.a * layer.opacity);\n } else {\n vColor = vec4(colors.rgb, colors.a * layer.opacity);\n }\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n`;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport main from './solid-polygon-layer-vertex-main.glsl';\n\nexport default `\\\n#version 300 es\n#define SHADER_NAME solid-polygon-layer-vertex-shader\n\nin vec3 vertexPositions;\nin vec3 vertexPositions64Low;\nin float elevations;\n\n${main}\n\nvoid main(void) {\n PolygonProps props;\n\n props.positions = vertexPositions;\n props.positions64Low = vertexPositions64Low;\n props.elevations = elevations;\n props.normal = vec3(0.0, 0.0, 1.0);\n\n calculatePosition(props);\n}\n`;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport main from './solid-polygon-layer-vertex-main.glsl';\n\nexport default `\\\n#version 300 es\n#define SHADER_NAME solid-polygon-layer-vertex-shader-side\n#define IS_SIDE_VERTEX\n\nin vec2 positions;\n\nin vec3 vertexPositions;\nin vec3 nextVertexPositions;\nin vec3 vertexPositions64Low;\nin vec3 nextVertexPositions64Low;\nin float elevations;\nin float instanceVertexValid;\n\n${main}\n\nvoid main(void) {\n if(instanceVertexValid < 0.5){\n gl_Position = vec4(0.);\n return;\n }\n\n PolygonProps props;\n\n vec3 pos;\n vec3 pos64Low;\n vec3 nextPos;\n vec3 nextPos64Low;\n\n #if RING_WINDING_ORDER_CW == 1\n pos = vertexPositions;\n pos64Low = vertexPositions64Low;\n nextPos = nextVertexPositions;\n nextPos64Low = nextVertexPositions64Low;\n #else\n pos = nextVertexPositions;\n pos64Low = nextVertexPositions64Low;\n nextPos = vertexPositions;\n nextPos64Low = vertexPositions64Low;\n #endif\n\n props.positions = mix(pos, nextPos, positions.x);\n props.positions64Low = mix(pos64Low, nextPos64Low, positions.x);\n\n props.normal = vec3(\n pos.y - nextPos.y + (pos64Low.y - nextPos64Low.y),\n nextPos.x - pos.x + (nextPos64Low.x - pos64Low.x),\n 0.0);\n\n props.elevations = elevations * positions.y;\n\n calculatePosition(props);\n}\n`;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport default `\\\n#version 300 es\n#define SHADER_NAME solid-polygon-layer-fragment-shader\n\nprecision highp float;\n\nin vec4 vColor;\n\nout vec4 fragColor;\n\nvoid main(void) {\n fragColor = vColor;\n // Fails to compile on some Android devices if geometry is never assigned (#8411)\n geometry.uv = vec2(0.);\n\n DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n`;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// Assume data array is sorted by \n// Replaces the specified range with a new subarray\n// Mutates the data array\n// Returns {startRow, endRow} of the inserted items\nexport function replaceInRange({\n data,\n getIndex,\n dataRange,\n replace\n}: {\n data: any[];\n getIndex: (d: any) => number;\n dataRange: {startRow?: number; endRow?: number};\n replace: any[];\n}): {startRow: Number; endRow: number} {\n const {startRow = 0, endRow = Infinity} = dataRange;\n const count = data.length;\n let replaceStart = count;\n let replaceEnd = count;\n for (let i = 0; i < count; i++) {\n const row = getIndex(data[i]);\n if (replaceStart > i && row >= startRow) {\n replaceStart = i;\n }\n if (row >= endRow) {\n replaceEnd = i;\n break;\n }\n }\n let index = replaceStart;\n const dataLengthChanged = replaceEnd - replaceStart !== replace.length;\n // Save the items after replaceEnd before we overwrite data\n const endChunk = dataLengthChanged ? data.slice(replaceEnd) : undefined;\n // Insert new items\n for (let i = 0; i < replace.length; i++) {\n data[index++] = replace[i];\n }\n if (endChunk) {\n // Append items after replaceEnd\n for (let i = 0; i < endChunk.length; i++) {\n data[index++] = endChunk[i];\n }\n // Trim additional items\n data.length = index;\n }\n\n return {\n startRow: replaceStart,\n endRow: replaceStart + replace.length\n };\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {\n Accessor,\n Color,\n CompositeLayer,\n CompositeLayerProps,\n Layer,\n LayerData,\n PickingInfo,\n Unit,\n Material,\n UpdateParameters,\n _ConstructorOf,\n DefaultProps\n} from '@deck.gl/core';\n\nimport type {BinaryFeatureCollection} from '@loaders.gl/schema';\nimport type {Feature, Geometry, GeoJSON} from 'geojson';\n\nimport {replaceInRange} from '../utils';\nimport {BinaryFeatureTypes, binaryToFeatureForAccesor} from './geojson-binary';\nimport {\n POINT_LAYER,\n LINE_LAYER,\n POLYGON_LAYER,\n getDefaultProps,\n forwardProps\n} from './sub-layer-map';\n\nimport {getGeojsonFeatures, SeparatedGeometries, separateGeojsonFeatures} from './geojson';\nimport {\n createLayerPropsFromFeatures,\n createLayerPropsFromBinary,\n SubLayersProps\n} from './geojson-layer-props';\n\n/** All properties supported by GeoJsonLayer */\nexport type GeoJsonLayerProps =\n _GeoJsonLayerProps & CompositeLayerProps;\n\n/** Properties added by GeoJsonLayer */\nexport type _GeoJsonLayerProps = {\n data:\n | string\n | GeoJSON\n | Feature[]\n | BinaryFeatureCollection\n | Promise;\n /**\n * How to render Point and MultiPoint features in the data.\n *\n * Supported types are:\n * * `'circle'`\n * * `'icon'`\n * * `'text'`\n *\n * @default 'circle'\n */\n pointType?: string;\n} & _GeoJsonLayerFillProps &\n _GeoJsonLayerStrokeProps &\n _GeoJsonLayer3DProps &\n _GeoJsonLayerPointCircleProps &\n _GeojsonLayerIconPointProps &\n _GeojsonLayerTextPointProps;\n\n/** GeoJsonLayer fill options. */\ntype _GeoJsonLayerFillProps = {\n /**\n * Whether to draw a filled polygon (solid fill).\n *\n * Note that only the area between the outer polygon and any holes will be filled.\n *\n * @default true\n */\n filled?: boolean;\n\n /**\n * Fill collor value or accessor.\n *\n * @default [0, 0, 0, 255]\n */\n getFillColor?: Accessor, Color>;\n};\n\n/** GeoJsonLayer stroke options. */\ntype _GeoJsonLayerStrokeProps = {\n /**\n * Whether to draw an outline around the polygon (solid fill).\n *\n * Note that both the outer polygon as well the outlines of any holes will be drawn.\n *\n * @default true\n */\n stroked?: boolean;\n\n /**\n * Line color value or accessor.\n *\n * @default [0, 0, 0, 255]\n */\n getLineColor?: Accessor, Color>;\n\n /**\n * Line width value or accessor.\n *\n * @default 1\n */\n getLineWidth?: Accessor, number>;\n\n /**\n * The units of the line width, one of `meters`, `common`, and `pixels`.\n *\n * @default 'meters'\n * @see Unit.\n */\n lineWidthUnits?: Unit;\n\n /**\n * A multiplier that is applied to all line widths\n *\n * @default 1\n */\n lineWidthScale?: number;\n\n /**\n * The minimum line width in pixels.\n *\n * @default 0\n */\n lineWidthMinPixels?: number;\n\n /**\n * The maximum line width in pixels\n *\n * @default Number.MAX_SAFE_INTEGER\n */\n lineWidthMaxPixels?: number;\n\n /**\n * Type of joint. If `true`, draw round joints. Otherwise draw miter joints.\n *\n * @default false\n */\n lineJointRounded?: boolean;\n\n /**\n * The maximum extent of a joint in ratio to the stroke width.\n *\n * Only works if `lineJointRounded` is false.\n *\n * @default 4\n */\n lineMiterLimit?: number;\n\n /**\n * Type of line caps.\n *\n * If `true`, draw round caps. Otherwise draw square caps.\n *\n * @default false\n */\n lineCapRounded?: boolean;\n\n /**\n * If `true`, extrude the line in screen space (width always faces the camera).\n * If `false`, the width always faces up.\n *\n * @default false\n */\n lineBillboard?: boolean;\n};\n\n/** GeoJsonLayer 3D options. */\ntype _GeoJsonLayer3DProps = {\n /**\n * Extrude Polygon and MultiPolygon features along the z-axis if set to true\n *\n * Based on the elevations provided by the `getElevation` accessor.\n *\n * @default false\n */\n extruded?: boolean;\n\n /**\n * Whether to generate a line wireframe of the hexagon.\n *\n * @default false\n */\n wireframe?: boolean;\n\n /**\n * (Experimental) This prop is only effective with `XYZ` data.\n * When true, polygon tesselation will be performed on the plane with the largest area, instead of the xy plane.\n * @default false\n */\n _full3d?: boolean;\n\n /**\n * Elevation valur or accessor.\n *\n * Only used if `extruded: true`.\n *\n * @default 1000\n */\n getElevation?: Accessor, number>;\n\n /**\n * Elevation multiplier.\n *\n * The final elevation is calculated by `elevationScale * getElevation(d)`.\n * `elevationScale` is a handy property to scale all elevation without updating the data.\n *\n * @default 1\n */\n elevationScale?: boolean;\n\n /**\n * Material settings for lighting effect. Applies to extruded polgons.\n *\n * @default true\n * @see https://deck.gl/docs/developer-guide/using-lighting\n */\n material?: Material;\n};\n\n/** GeoJsonLayer Properties forwarded to `ScatterPlotLayer` if `pointType` is `'circle'` */\nexport type _GeoJsonLayerPointCircleProps = {\n getPointRadius?: Accessor, number>;\n pointRadiusUnits?: Unit;\n pointRadiusScale?: number;\n pointRadiusMinPixels?: number;\n pointRadiusMaxPixels?: number;\n pointAntialiasing?: boolean;\n pointBillboard?: boolean;\n\n /** @deprecated use getPointRadius */\n getRadius?: Accessor, number>;\n};\n\n/** GeoJsonLayer properties forwarded to `IconLayer` if `pointType` is `'icon'` */\ntype _GeojsonLayerIconPointProps = {\n iconAtlas?: any;\n iconMapping?: any;\n getIcon?: Accessor, any>;\n getIconSize?: Accessor, number>;\n getIconColor?: Accessor, Color>;\n getIconAngle?: Accessor, number>;\n getIconPixelOffset?: Accessor, number[]>;\n iconSizeUnits?: Unit;\n iconSizeScale?: number;\n iconSizeMinPixels?: number;\n iconSizeMaxPixels?: number;\n iconBillboard?: boolean;\n iconAlphaCutoff?: number;\n};\n\n/** GeoJsonLayer properties forwarded to `TextLayer` if `pointType` is `'text'` */\ntype _GeojsonLayerTextPointProps = {\n getText?: Accessor, any>;\n getTextColor?: Accessor, Color>;\n getTextAngle?: Accessor, number>;\n getTextSize?: Accessor, number>;\n getTextAnchor?: Accessor, string>;\n getTextAlignmentBaseline?: Accessor, string>;\n getTextPixelOffset?: Accessor, number[]>;\n getTextBackgroundColor?: Accessor, Color>;\n getTextBorderColor?: Accessor, Color>;\n getTextBorderWidth?: Accessor, number>;\n textSizeUnits?: Unit;\n textSizeScale?: number;\n textSizeMinPixels?: number;\n textSizeMaxPixels?: number;\n textCharacterSet?: any;\n textFontFamily?: string;\n textFontWeight?: number;\n textLineHeight?: number;\n textMaxWidth?: number;\n textWordBreak?: string; // TODO\n textBackground?: boolean;\n textBackgroundPadding?: number[];\n textOutlineColor?: Color;\n textOutlineWidth?: number;\n textBillboard?: boolean;\n textFontSettings?: any;\n};\n\nconst FEATURE_TYPES = ['points', 'linestrings', 'polygons'];\n\nconst defaultProps: DefaultProps = {\n ...getDefaultProps(POINT_LAYER.circle),\n ...getDefaultProps(POINT_LAYER.icon),\n ...getDefaultProps(POINT_LAYER.text),\n ...getDefaultProps(LINE_LAYER),\n ...getDefaultProps(POLYGON_LAYER),\n\n // Overwrite sub layer defaults\n stroked: true,\n filled: true,\n extruded: false,\n wireframe: false,\n _full3d: false,\n iconAtlas: {type: 'object', value: null},\n iconMapping: {type: 'object', value: {}},\n getIcon: {type: 'accessor', value: f => f.properties.icon},\n getText: {type: 'accessor', value: f => f.properties.text},\n\n // Self props\n pointType: 'circle',\n\n // TODO: deprecated, remove in v9\n getRadius: {deprecatedFor: 'getPointRadius'}\n};\n\ntype GeoJsonPickingInfo = PickingInfo & {\n featureType?: string | null;\n info?: any;\n};\n\n/** Render GeoJSON formatted data as polygons, lines and points (circles, icons and/or texts). */\nexport default class GeoJsonLayer<\n FeaturePropertiesT = any,\n ExtraProps extends {} = {}\n> extends CompositeLayer> & ExtraProps> {\n static layerName = 'GeoJsonLayer';\n static defaultProps = defaultProps;\n\n state!: {\n layerProps: Partial;\n features: Partial;\n featuresDiff: Partial<{\n [key in keyof SeparatedGeometries]: {\n startRow: number;\n endRow: number;\n }[];\n }>;\n binary?: boolean;\n };\n\n initializeState(): void {\n this.state = {\n layerProps: {},\n features: {},\n featuresDiff: {}\n };\n }\n\n updateState({props, changeFlags}: UpdateParameters): void {\n if (!changeFlags.dataChanged) {\n return;\n }\n const {data} = this.props;\n const binary =\n data && 'points' in (data as {}) && 'polygons' in (data as {}) && 'lines' in (data as {});\n\n this.setState({binary});\n\n if (binary) {\n this._updateStateBinary({props, changeFlags});\n } else {\n this._updateStateJSON({props, changeFlags});\n }\n }\n\n private _updateStateBinary({props, changeFlags}): void {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const layerProps = createLayerPropsFromBinary(props.data, this.encodePickingColor);\n this.setState({layerProps});\n }\n\n private _updateStateJSON({props, changeFlags}): void {\n const features: Feature[] = getGeojsonFeatures(props.data) as any;\n const wrapFeature = this.getSubLayerRow.bind(this);\n let newFeatures: SeparatedGeometries = {} as SeparatedGeometries;\n const featuresDiff = {};\n\n if (Array.isArray(changeFlags.dataChanged)) {\n const oldFeatures = this.state.features;\n for (const key in oldFeatures) {\n newFeatures[key] = oldFeatures[key].slice();\n featuresDiff[key] = [];\n }\n\n for (const dataRange of changeFlags.dataChanged) {\n const partialFeatures = separateGeojsonFeatures(features, wrapFeature, dataRange);\n for (const key in oldFeatures) {\n featuresDiff[key].push(\n replaceInRange({\n data: newFeatures[key],\n getIndex: f => f.__source.index,\n dataRange,\n replace: partialFeatures[key]\n })\n );\n }\n }\n } else {\n newFeatures = separateGeojsonFeatures(features, wrapFeature);\n }\n\n const layerProps = createLayerPropsFromFeatures(newFeatures, featuresDiff);\n\n this.setState({\n features: newFeatures,\n featuresDiff,\n layerProps\n });\n }\n\n getPickingInfo(params): GeoJsonPickingInfo {\n const info = super.getPickingInfo(params) as GeoJsonPickingInfo;\n const {index, sourceLayer} = info;\n info.featureType = FEATURE_TYPES.find(ft => sourceLayer!.id.startsWith(`${this.id}-${ft}-`));\n if (index >= 0 && sourceLayer!.id.startsWith(`${this.id}-points-text`) && this.state.binary) {\n info.index = (this.props.data as BinaryFeatureCollection).points!.globalFeatureIds.value[\n index\n ];\n }\n return info;\n }\n\n _updateAutoHighlight(info: GeoJsonPickingInfo): void {\n // All sub layers except the points layer use source feature index to encode the picking color\n // The points layer uses indices from the points data array.\n const pointLayerIdPrefix = `${this.id}-points-`;\n const sourceIsPoints = info.featureType === 'points';\n for (const layer of this.getSubLayers()) {\n if (layer.id.startsWith(pointLayerIdPrefix) === sourceIsPoints) {\n layer.updateAutoHighlight(info);\n }\n }\n }\n\n private _renderPolygonLayer(): Layer | null {\n const {extruded, wireframe} = this.props;\n const {layerProps} = this.state;\n const id = 'polygons-fill';\n\n const PolygonFillLayer =\n this.shouldRenderSubLayer(id, layerProps.polygons?.data) &&\n this.getSubLayerClass(id, POLYGON_LAYER.type);\n\n if (PolygonFillLayer) {\n const forwardedProps = forwardProps(this, POLYGON_LAYER.props);\n // Avoid building the lineColors attribute if wireframe is off\n const useLineColor = extruded && wireframe;\n if (!useLineColor) {\n delete forwardedProps.getLineColor;\n }\n // using a legacy API to invalid lineColor attributes\n forwardedProps.updateTriggers.lineColors = useLineColor;\n\n return new PolygonFillLayer(\n forwardedProps,\n this.getSubLayerProps({\n id,\n updateTriggers: forwardedProps.updateTriggers\n }),\n layerProps.polygons\n );\n }\n return null;\n }\n\n private _renderLineLayers(): (Layer | false)[] | null {\n const {extruded, stroked} = this.props;\n const {layerProps} = this.state;\n const polygonStrokeLayerId = 'polygons-stroke';\n const lineStringsLayerId = 'linestrings';\n\n const PolygonStrokeLayer =\n !extruded &&\n stroked &&\n this.shouldRenderSubLayer(polygonStrokeLayerId, layerProps.polygonsOutline?.data) &&\n this.getSubLayerClass(polygonStrokeLayerId, LINE_LAYER.type);\n const LineStringsLayer =\n this.shouldRenderSubLayer(lineStringsLayerId, layerProps.lines?.data) &&\n this.getSubLayerClass(lineStringsLayerId, LINE_LAYER.type);\n\n if (PolygonStrokeLayer || LineStringsLayer) {\n const forwardedProps = forwardProps(this, LINE_LAYER.props);\n\n return [\n PolygonStrokeLayer &&\n new PolygonStrokeLayer(\n forwardedProps,\n this.getSubLayerProps({\n id: polygonStrokeLayerId,\n updateTriggers: forwardedProps.updateTriggers\n }),\n layerProps.polygonsOutline\n ),\n\n LineStringsLayer &&\n new LineStringsLayer(\n forwardedProps,\n this.getSubLayerProps({\n id: lineStringsLayerId,\n updateTriggers: forwardedProps.updateTriggers\n }),\n layerProps.lines\n )\n ];\n }\n return null;\n }\n\n private _renderPointLayers(): Layer[] | null {\n const {pointType} = this.props;\n const {layerProps, binary} = this.state;\n let {highlightedObjectIndex} = this.props;\n\n if (!binary && Number.isFinite(highlightedObjectIndex)) {\n // @ts-expect-error TODO - type non-binary data\n highlightedObjectIndex = layerProps.points.data.findIndex(\n d => d.__source.index === highlightedObjectIndex\n );\n }\n\n // Avoid duplicate sub layer ids\n const types = new Set(pointType.split('+'));\n const pointLayers: Layer[] = [];\n for (const type of types) {\n const id = `points-${type}`;\n const PointLayerMapping = POINT_LAYER[type];\n const PointsLayer: _ConstructorOf =\n PointLayerMapping &&\n this.shouldRenderSubLayer(id, layerProps.points?.data) &&\n this.getSubLayerClass(id, PointLayerMapping.type);\n if (PointsLayer) {\n const forwardedProps = forwardProps(this, PointLayerMapping.props);\n let pointsLayerProps = layerProps.points;\n\n if (type === 'text' && binary) {\n // Picking colors are per-point but for text per-character are required\n // getPickingInfo() maps back to the correct index\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n // @ts-expect-error TODO - type binary data\n const {instancePickingColors, ...rest} = pointsLayerProps.data.attributes;\n pointsLayerProps = {\n ...pointsLayerProps,\n // @ts-expect-error TODO - type binary data\n data: {...(pointsLayerProps.data as LayerData), attributes: rest}\n };\n }\n\n pointLayers.push(\n new PointsLayer(\n forwardedProps,\n this.getSubLayerProps({\n id,\n updateTriggers: forwardedProps.updateTriggers,\n highlightedObjectIndex\n }),\n pointsLayerProps\n )\n );\n }\n }\n return pointLayers;\n }\n\n renderLayers() {\n const {extruded} = this.props;\n\n const polygonFillLayer = this._renderPolygonLayer();\n const lineLayers = this._renderLineLayers();\n const pointLayers = this._renderPointLayers();\n\n return [\n // If not extruded: flat fill layer is drawn below outlines\n !extruded && polygonFillLayer,\n lineLayers,\n pointLayers,\n // If extruded: draw fill layer last for correct blending behavior\n extruded && polygonFillLayer\n ];\n }\n\n protected getSubLayerAccessor(accessor: Accessor): Accessor {\n const {binary} = this.state;\n if (!binary || typeof accessor !== 'function') {\n return super.getSubLayerAccessor(accessor);\n }\n\n return (object, info) => {\n const {data, index} = info;\n const feature = binaryToFeatureForAccesor(data as unknown as BinaryFeatureTypes, index);\n // @ts-ignore (TS2349) accessor is always function\n return accessor(feature, info);\n };\n }\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// This module implement some utility functions to work with\n// the geojson-binary format defined at loaders.gl:\n// https://github.com/visgl/loaders.gl/blob/master/modules/gis/docs/api-reference/geojson-to-binary.md\n\nimport {BinaryAttribute} from '@deck.gl/core';\nimport {\n BinaryFeatureCollection,\n BinaryLineFeature,\n BinaryPointFeature,\n BinaryPolygonFeature,\n Feature\n} from '@loaders.gl/schema';\n\nexport type BinaryFeatureTypes = BinaryPointFeature | BinaryLineFeature | BinaryPolygonFeature;\n\nexport type ExtendedBinaryFeatureCollection = {\n [P in keyof Omit]: BinaryFeatureCollection[P] & {\n attributes?: Record;\n };\n};\n\ntype FeaureOnlyProperties = Pick;\n\n/**\n * Return the feature for an accesor\n */\nexport function binaryToFeatureForAccesor(\n data: BinaryFeatureTypes,\n index: number\n): FeaureOnlyProperties | null {\n if (!data) {\n return null;\n }\n\n const featureIndex = 'startIndices' in data ? (data as any).startIndices[index] : index;\n const geometryIndex = data.featureIds.value[featureIndex];\n\n if (featureIndex !== -1) {\n return getPropertiesForIndex(data, geometryIndex, featureIndex);\n }\n\n return null;\n}\n\nfunction getPropertiesForIndex(\n data: BinaryFeatureTypes,\n propertiesIndex: number,\n numericPropsIndex: number\n): FeaureOnlyProperties {\n const feature = {\n properties: {...data.properties[propertiesIndex]}\n };\n\n for (const prop in data.numericProps) {\n feature.properties[prop] = data.numericProps[prop].value[numericPropsIndex];\n }\n\n return feature;\n}\n\n// Custom picking color to keep binary indexes\nexport function calculatePickingColors(\n geojsonBinary: Required,\n encodePickingColor: (id: number, result: number[]) => void\n): Record {\n const pickingColors: Record = {\n points: null,\n lines: null,\n polygons: null\n };\n for (const key in pickingColors) {\n const featureIds = geojsonBinary[key].globalFeatureIds.value;\n pickingColors[key] = new Uint8ClampedArray(featureIds.length * 4);\n const pickingColor = [];\n for (let i = 0; i < featureIds.length; i++) {\n encodePickingColor(featureIds[i], pickingColor);\n pickingColors[key][i * 4 + 0] = pickingColor[0];\n pickingColors[key][i * 4 + 1] = pickingColor[1];\n pickingColors[key][i * 4 + 2] = pickingColor[2];\n pickingColors[key][i * 4 + 3] = 255;\n }\n }\n\n return pickingColors;\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {CompositeLayer, createIterable, log} from '@deck.gl/core';\nimport MultiIconLayer from './multi-icon-layer/multi-icon-layer';\nimport FontAtlasManager, {\n DEFAULT_FONT_SETTINGS,\n setFontAtlasCacheLimit\n} from './font-atlas-manager';\nimport {transformParagraph, getTextFromBuffer} from './utils';\n\nimport TextBackgroundLayer from './text-background-layer/text-background-layer';\n\nimport type {FontSettings} from './font-atlas-manager';\nimport type {\n LayerProps,\n LayerDataSource,\n Accessor,\n AccessorFunction,\n AccessorContext,\n Unit,\n Position,\n Color,\n UpdateParameters,\n GetPickingInfoParams,\n PickingInfo,\n DefaultProps\n} from '@deck.gl/core';\n\nconst TEXT_ANCHOR = {\n start: 1,\n middle: 0,\n end: -1\n} as const;\n\nconst ALIGNMENT_BASELINE = {\n top: 1,\n center: 0,\n bottom: -1\n} as const;\n\nconst DEFAULT_COLOR: [number, number, number, number] = [0, 0, 0, 255];\n\nconst DEFAULT_LINE_HEIGHT = 1.0;\n\ntype _TextLayerProps = {\n data: LayerDataSource;\n /** If `true`, the text always faces camera. Otherwise the text faces up (z).\n * @default true\n */\n billboard?: boolean;\n /**\n * Text size multiplier.\n * @default 1\n */\n sizeScale?: number;\n /**\n * The units of the size, one of `'meters'`, `'common'`, and `'pixels'`.\n * @default 'pixels'\n */\n sizeUnits?: Unit;\n /**\n * The minimum size in pixels. When using non-pixel `sizeUnits`, this prop can be used to prevent the icon from getting too small when zoomed out.\n * @default 0\n */\n sizeMinPixels?: number;\n /**\n * The maximum size in pixels. When using non-pixel `sizeUnits`, this prop can be used to prevent the icon from getting too big when zoomed in.\n * @default Number.MAX_SAFE_INTEGER\n */\n sizeMaxPixels?: number;\n\n /** Whether to render background for the text blocks.\n * @default false\n */\n background?: boolean;\n /** Background color accessor.\n * @default [255, 255, 255, 255]\n */\n getBackgroundColor?: Accessor;\n /** Border color accessor.\n * @default [0, 0, 0, 255]\n */\n getBorderColor?: Accessor;\n /** Border width accessor.\n * @default 0\n */\n getBorderWidth?: Accessor;\n /**\n * The padding of the background..\n * If an array of 2 is supplied, it is interpreted as `[padding_x, padding_y]` in pixels.\n * If an array of 4 is supplied, it is interpreted as `[padding_left, padding_top, padding_right, padding_bottom]` in pixels.\n * @default [0, 0, 0, 0]\n */\n backgroundPadding?: [number, number] | [number, number, number, number];\n /**\n * Specifies a list of characters to include in the font. If set to 'auto', will be automatically generated from the data set.\n * @default (ASCII characters 32-128)\n */\n characterSet?: FontSettings['characterSet'] | 'auto';\n /** CSS font family\n * @default 'Monaco, monospace'\n */\n fontFamily?: FontSettings['fontFamily'];\n /** CSS font weight\n * @default 'normal'\n */\n fontWeight?: FontSettings['fontWeight'];\n /** A unitless number that will be multiplied with the current text size to set the line height.\n * @default 'normal'\n */\n lineHeight?: number;\n /**\n * Width of outline around the text, relative to the text size. Only effective if `fontSettings.sdf` is `true`.\n * @default 0\n */\n outlineWidth?: number;\n /**\n * Color of outline around the text, in `[r, g, b, [a]]`. Each channel is a number between 0-255 and `a` is 255 if not supplied.\n * @default [0, 0, 0, 255]\n */\n outlineColor?: Color;\n /**\n * Advance options for fine tuning the appearance and performance of the generated shared `fontAtlas`.\n */\n fontSettings?: FontSettings;\n /**\n * Available options are `break-all` and `break-word`. A valid `maxWidth` has to be provided to use `wordBreak`.\n * @default 'break-word'\n */\n wordBreak?: 'break-word' | 'break-all';\n /**\n * A unitless number that will be multiplied with the current text size to set the width limit of a string.\n * If specified, when the text is longer than the width limit, it will be wrapped into multiple lines using\n * the strategy of `wordBreak`.\n * @default -1\n */\n maxWidth?: number;\n /**\n * Label text accessor\n */\n getText?: AccessorFunction;\n /**\n * Anchor position accessor\n */\n getPosition?: Accessor;\n /**\n * Label color accessor\n * @default [0, 0, 0, 255]\n */\n getColor?: Accessor;\n /**\n * Label size accessor\n * @default 32\n */\n getSize?: Accessor;\n /**\n * Label rotation accessor, in degrees\n * @default 0\n */\n getAngle?: Accessor;\n /**\n * Horizontal alignment accessor\n * @default 'middle'\n */\n getTextAnchor?: Accessor;\n /**\n * Vertical alignment accessor\n * @default 'center'\n */\n getAlignmentBaseline?: Accessor;\n /**\n * Label offset from the anchor position, [x, y] in pixels\n * @default [0, 0]\n */\n getPixelOffset?: Accessor;\n /**\n * @deprecated Use `background` and `getBackgroundColor` instead\n */\n backgroundColor?: Color;\n};\n\nexport type TextLayerProps = _TextLayerProps & LayerProps;\n\nconst defaultProps: DefaultProps = {\n billboard: true,\n sizeScale: 1,\n sizeUnits: 'pixels',\n sizeMinPixels: 0,\n sizeMaxPixels: Number.MAX_SAFE_INTEGER,\n\n background: false,\n getBackgroundColor: {type: 'accessor', value: [255, 255, 255, 255]},\n getBorderColor: {type: 'accessor', value: DEFAULT_COLOR},\n getBorderWidth: {type: 'accessor', value: 0},\n backgroundPadding: {type: 'array', value: [0, 0, 0, 0]},\n\n characterSet: {type: 'object', value: DEFAULT_FONT_SETTINGS.characterSet},\n fontFamily: DEFAULT_FONT_SETTINGS.fontFamily,\n fontWeight: DEFAULT_FONT_SETTINGS.fontWeight,\n lineHeight: DEFAULT_LINE_HEIGHT,\n outlineWidth: {type: 'number', value: 0, min: 0},\n outlineColor: {type: 'color', value: DEFAULT_COLOR},\n fontSettings: {type: 'object', value: {}, compare: 1},\n\n // auto wrapping options\n wordBreak: 'break-word',\n maxWidth: {type: 'number', value: -1},\n\n getText: {type: 'accessor', value: (x: any) => x.text},\n getPosition: {type: 'accessor', value: (x: any) => x.position},\n getColor: {type: 'accessor', value: DEFAULT_COLOR},\n getSize: {type: 'accessor', value: 32},\n getAngle: {type: 'accessor', value: 0},\n getTextAnchor: {type: 'accessor', value: 'middle'},\n getAlignmentBaseline: {type: 'accessor', value: 'center'},\n getPixelOffset: {type: 'accessor', value: [0, 0]},\n\n // deprecated\n backgroundColor: {deprecatedFor: ['background', 'getBackgroundColor']}\n};\n\n/** Render text labels at given coordinates. */\nexport default class TextLayer extends CompositeLayer<\n ExtraPropsT & Required<_TextLayerProps>\n> {\n static defaultProps = defaultProps;\n static layerName = 'TextLayer';\n\n state!: {\n styleVersion: number;\n fontAtlasManager: FontAtlasManager;\n characterSet?: Set;\n startIndices?: number[];\n numInstances?: number;\n getText?: AccessorFunction;\n };\n\n initializeState() {\n this.state = {\n styleVersion: 0,\n fontAtlasManager: new FontAtlasManager()\n };\n\n // Breaking change in v8.9\n if (this.props.maxWidth > 0) {\n log.warn('v8.9 breaking change: TextLayer maxWidth is now relative to text size')();\n }\n }\n\n // eslint-disable-next-line complexity\n updateState(params: UpdateParameters) {\n const {props, oldProps, changeFlags} = params;\n const textChanged =\n changeFlags.dataChanged ||\n (changeFlags.updateTriggersChanged &&\n (changeFlags.updateTriggersChanged.all || changeFlags.updateTriggersChanged.getText));\n\n if (textChanged) {\n this._updateText();\n }\n\n const fontChanged = this._updateFontAtlas();\n\n const styleChanged =\n fontChanged ||\n props.lineHeight !== oldProps.lineHeight ||\n props.wordBreak !== oldProps.wordBreak ||\n props.maxWidth !== oldProps.maxWidth;\n\n if (styleChanged) {\n this.setState({\n styleVersion: this.state.styleVersion + 1\n });\n }\n }\n\n getPickingInfo({info}: GetPickingInfoParams): PickingInfo {\n // because `TextLayer` assign the same pickingInfoIndex for one text label,\n // here info.index refers the index of text label in props.data\n info.object = info.index >= 0 ? (this.props.data as any[])[info.index] : null;\n return info;\n }\n\n /** Returns true if font has changed */\n private _updateFontAtlas(): boolean {\n const {fontSettings, fontFamily, fontWeight} = this.props;\n const {fontAtlasManager, characterSet} = this.state;\n\n const fontProps = {\n ...fontSettings,\n characterSet,\n fontFamily,\n fontWeight\n };\n\n if (!fontAtlasManager.mapping) {\n // This is the first update\n fontAtlasManager.setProps(fontProps);\n return true;\n }\n\n for (const key in fontProps) {\n if (fontProps[key] !== fontAtlasManager.props[key]) {\n fontAtlasManager.setProps(fontProps);\n return true;\n }\n }\n\n return false;\n }\n\n // Text strings are variable width objects\n // Count characters and start offsets\n private _updateText() {\n const {data, characterSet} = this.props;\n const textBuffer = (data as any).attributes?.getText;\n let {getText} = this.props;\n let startIndices: number[] = (data as any).startIndices;\n let numInstances: number;\n\n const autoCharacterSet = characterSet === 'auto' && new Set();\n\n if (textBuffer && startIndices) {\n const {texts, characterCount} = getTextFromBuffer({\n ...(ArrayBuffer.isView(textBuffer) ? {value: textBuffer} : textBuffer),\n // @ts-ignore if data.attribute is defined then length is expected\n length: data.length,\n startIndices,\n characterSet: autoCharacterSet\n });\n numInstances = characterCount;\n getText = (_, {index}) => texts[index];\n } else {\n const {iterable, objectInfo} = createIterable(data);\n startIndices = [0];\n numInstances = 0;\n\n for (const object of iterable) {\n objectInfo.index++;\n // Break into an array of characters\n // When dealing with double-length unicode characters, `str.length` or `str[i]` do not work\n const text = Array.from(getText(object, objectInfo) || '');\n if (autoCharacterSet) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n text.forEach(autoCharacterSet.add, autoCharacterSet);\n }\n numInstances += text.length;\n startIndices.push(numInstances);\n }\n }\n\n this.setState({\n getText,\n startIndices,\n numInstances,\n characterSet: autoCharacterSet || characterSet\n });\n }\n\n /** There are two size systems in this layer:\n\n + Pixel size: user-specified text size, via getSize, sizeScale, sizeUnits etc.\n The layer roughly matches the output of the layer to CSS pixels, e.g. getSize: 12, sizeScale: 2\n in layer props is roughly equivalent to font-size: 24px in CSS.\n + Texture size: internally, character positions in a text blob are calculated using the sizes of iconMapping,\n which depends on how large each character is drawn into the font atlas. This is controlled by\n fontSettings.fontSize (default 64) and most users do not set it manually.\n These numbers are intended to be used in the vertex shader and never to be exposed to the end user.\n\n All surfaces exposed to the user should either use the pixel size or a multiplier relative to the pixel size. */\n\n /** Calculate the size and position of each character in a text string.\n * Values are in texture size */\n private transformParagraph(\n object: DataT,\n objectInfo: AccessorContext\n ): ReturnType {\n const {fontAtlasManager} = this.state;\n const iconMapping = fontAtlasManager.mapping!;\n const getText = this.state.getText!;\n const {wordBreak, lineHeight, maxWidth} = this.props;\n\n const paragraph = getText(object, objectInfo) || '';\n return transformParagraph(\n paragraph,\n lineHeight,\n wordBreak,\n maxWidth * fontAtlasManager.props.fontSize,\n iconMapping\n );\n }\n\n /** Returns the x, y, width, height of each text string, relative to pixel size.\n * Used to render the background.\n */\n private getBoundingRect: AccessorFunction = (\n object,\n objectInfo\n ) => {\n let {\n size: [width, height]\n } = this.transformParagraph(object, objectInfo);\n const {fontSize} = this.state.fontAtlasManager.props;\n width /= fontSize;\n height /= fontSize;\n\n const {getTextAnchor, getAlignmentBaseline} = this.props;\n const anchorX =\n TEXT_ANCHOR[\n typeof getTextAnchor === 'function' ? getTextAnchor(object, objectInfo) : getTextAnchor\n ];\n const anchorY =\n ALIGNMENT_BASELINE[\n typeof getAlignmentBaseline === 'function'\n ? getAlignmentBaseline(object, objectInfo)\n : getAlignmentBaseline\n ];\n\n return [((anchorX - 1) * width) / 2, ((anchorY - 1) * height) / 2, width, height];\n };\n\n /** Returns the x, y offsets of each character in a text string, in texture size.\n * Used to layout characters in the vertex shader.\n */\n private getIconOffsets: AccessorFunction = (object, objectInfo) => {\n const {getTextAnchor, getAlignmentBaseline} = this.props;\n\n const {\n x,\n y,\n rowWidth,\n size: [width, height]\n } = this.transformParagraph(object, objectInfo);\n const anchorX =\n TEXT_ANCHOR[\n typeof getTextAnchor === 'function' ? getTextAnchor(object, objectInfo) : getTextAnchor\n ];\n const anchorY =\n ALIGNMENT_BASELINE[\n typeof getAlignmentBaseline === 'function'\n ? getAlignmentBaseline(object, objectInfo)\n : getAlignmentBaseline\n ];\n\n const numCharacters = x.length;\n const offsets = new Array(numCharacters * 2);\n let index = 0;\n\n for (let i = 0; i < numCharacters; i++) {\n // For a multi-line object, offset in x-direction needs consider\n // the row offset in the paragraph and the object offset in the row\n const rowOffset = ((1 - anchorX) * (width - rowWidth[i])) / 2;\n offsets[index++] = ((anchorX - 1) * width) / 2 + rowOffset + x[i];\n offsets[index++] = ((anchorY - 1) * height) / 2 + y[i];\n }\n return offsets;\n };\n\n renderLayers() {\n const {\n startIndices,\n numInstances,\n getText,\n fontAtlasManager: {scale, atlas, mapping},\n styleVersion\n } = this.state;\n\n const {\n data,\n _dataDiff,\n getPosition,\n getColor,\n getSize,\n getAngle,\n getPixelOffset,\n getBackgroundColor,\n getBorderColor,\n getBorderWidth,\n backgroundPadding,\n background,\n billboard,\n fontSettings,\n outlineWidth,\n outlineColor,\n sizeScale,\n sizeUnits,\n sizeMinPixels,\n sizeMaxPixels,\n transitions,\n updateTriggers\n } = this.props;\n\n const CharactersLayerClass = this.getSubLayerClass('characters', MultiIconLayer);\n const BackgroundLayerClass = this.getSubLayerClass('background', TextBackgroundLayer);\n\n return [\n background &&\n new BackgroundLayerClass(\n {\n // background props\n getFillColor: getBackgroundColor,\n getLineColor: getBorderColor,\n getLineWidth: getBorderWidth,\n padding: backgroundPadding,\n\n // props shared with characters layer\n getPosition,\n getSize,\n getAngle,\n getPixelOffset,\n billboard,\n sizeScale,\n sizeUnits,\n sizeMinPixels,\n sizeMaxPixels,\n\n transitions: transitions && {\n getPosition: transitions.getPosition,\n getAngle: transitions.getAngle,\n getSize: transitions.getSize,\n getFillColor: transitions.getBackgroundColor,\n getLineColor: transitions.getBorderColor,\n getLineWidth: transitions.getBorderWidth,\n getPixelOffset: transitions.getPixelOffset\n }\n },\n this.getSubLayerProps({\n id: 'background',\n updateTriggers: {\n getPosition: updateTriggers.getPosition,\n getAngle: updateTriggers.getAngle,\n getSize: updateTriggers.getSize,\n getFillColor: updateTriggers.getBackgroundColor,\n getLineColor: updateTriggers.getBorderColor,\n getLineWidth: updateTriggers.getBorderWidth,\n getPixelOffset: updateTriggers.getPixelOffset,\n getBoundingRect: {\n getText: updateTriggers.getText,\n getTextAnchor: updateTriggers.getTextAnchor,\n getAlignmentBaseline: updateTriggers.getAlignmentBaseline,\n styleVersion\n }\n }\n }),\n {\n data:\n // @ts-ignore (2339) attribute is not defined on all data types\n data.attributes && data.attributes.background\n ? // @ts-ignore (2339) attribute is not defined on all data types\n {length: data.length, attributes: data.attributes.background}\n : data,\n _dataDiff,\n // Maintain the same background behavior as <=8.3. Remove in v9?\n autoHighlight: false,\n getBoundingRect: this.getBoundingRect\n }\n ),\n new CharactersLayerClass(\n {\n sdf: fontSettings.sdf,\n smoothing: Number.isFinite(fontSettings.smoothing)\n ? fontSettings.smoothing\n : DEFAULT_FONT_SETTINGS.smoothing,\n outlineWidth: outlineWidth / (fontSettings.radius || DEFAULT_FONT_SETTINGS.radius),\n outlineColor,\n iconAtlas: atlas,\n iconMapping: mapping,\n\n getPosition,\n getColor,\n getSize,\n getAngle,\n getPixelOffset,\n\n billboard,\n sizeScale: sizeScale * scale,\n sizeUnits,\n sizeMinPixels: sizeMinPixels * scale,\n sizeMaxPixels: sizeMaxPixels * scale,\n\n transitions: transitions && {\n getPosition: transitions.getPosition,\n getAngle: transitions.getAngle,\n getColor: transitions.getColor,\n getSize: transitions.getSize,\n getPixelOffset: transitions.getPixelOffset\n }\n },\n this.getSubLayerProps({\n id: 'characters',\n updateTriggers: {\n all: updateTriggers.getText,\n getPosition: updateTriggers.getPosition,\n getAngle: updateTriggers.getAngle,\n getColor: updateTriggers.getColor,\n getSize: updateTriggers.getSize,\n getPixelOffset: updateTriggers.getPixelOffset,\n getIconOffsets: {\n getTextAnchor: updateTriggers.getTextAnchor,\n getAlignmentBaseline: updateTriggers.getAlignmentBaseline,\n styleVersion\n }\n }\n }),\n {\n data,\n _dataDiff,\n startIndices,\n numInstances,\n getIconOffsets: this.getIconOffsets,\n getIcon: getText\n }\n )\n ];\n }\n\n static set fontAtlasCacheLimit(limit: number) {\n setFontAtlasCacheLimit(limit);\n }\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {log} from '@deck.gl/core';\nimport IconLayer from '../../icon-layer/icon-layer';\n\nimport {SdfProps, sdfUniforms} from './sdf-uniforms';\nimport fs from './multi-icon-layer-fragment.glsl';\n\nimport type {IconLayerProps} from '../../icon-layer/icon-layer';\nimport type {Accessor, Color, UpdateParameters, DefaultProps} from '@deck.gl/core';\n\n// TODO expose as layer properties\nconst DEFAULT_BUFFER = 192.0 / 256;\nconst EMPTY_ARRAY = [];\n\ntype _MultiIconLayerProps = {\n getIconOffsets?: Accessor;\n sdf?: boolean;\n smoothing?: number;\n outlineWidth?: number;\n outlineColor?: Color;\n};\n\nexport type MultiIconLayerProps = _MultiIconLayerProps &\n IconLayerProps;\n\nconst defaultProps: DefaultProps = {\n getIconOffsets: {type: 'accessor', value: (x: any) => x.offsets},\n alphaCutoff: 0.001,\n smoothing: 0.1,\n outlineWidth: 0,\n outlineColor: {type: 'color', value: [0, 0, 0, 255]}\n};\n\nexport default class MultiIconLayer extends IconLayer<\n DataT,\n ExtraPropsT & Required<_MultiIconLayerProps>\n> {\n static defaultProps = defaultProps;\n static layerName = 'MultiIconLayer';\n\n state!: IconLayer['state'] & {\n outlineColor: [number, number, number, number];\n };\n\n getShaders() {\n const shaders = super.getShaders();\n return {...shaders, modules: [...shaders.modules, sdfUniforms], fs};\n }\n\n initializeState() {\n super.initializeState();\n\n const attributeManager = this.getAttributeManager();\n attributeManager!.addInstanced({\n instanceOffsets: {\n size: 2,\n accessor: 'getIconOffsets'\n },\n instancePickingColors: {\n type: 'uint8',\n size: 3,\n accessor: (object, {index, target: value}) => this.encodePickingColor(index, value)\n }\n });\n }\n\n updateState(params: UpdateParameters) {\n super.updateState(params);\n const {props, oldProps} = params;\n let {outlineColor} = props;\n\n if (outlineColor !== oldProps.outlineColor) {\n outlineColor = outlineColor.map(x => x / 255) as Color;\n outlineColor[3] = Number.isFinite(outlineColor[3]) ? outlineColor[3] : 1;\n\n this.setState({\n outlineColor\n });\n }\n if (!props.sdf && props.outlineWidth) {\n log.warn(`${this.id}: fontSettings.sdf is required to render outline`)();\n }\n }\n\n draw(params) {\n const {sdf, smoothing, outlineWidth} = this.props;\n const {outlineColor} = this.state;\n const outlineBuffer = outlineWidth\n ? Math.max(smoothing, DEFAULT_BUFFER * (1 - outlineWidth))\n : -1;\n\n const model = this.state.model!;\n const sdfProps: SdfProps = {\n buffer: DEFAULT_BUFFER,\n outlineBuffer,\n gamma: smoothing,\n enabled: Boolean(sdf),\n outlineColor\n };\n model.shaderInputs.setProps({sdf: sdfProps});\n super.draw(params);\n\n // draw text without outline on top to ensure a thick outline won't occlude other characters\n if (sdf && outlineWidth) {\n const {iconManager} = this.state;\n const iconsTexture = iconManager.getTexture();\n\n if (iconsTexture) {\n model.shaderInputs.setProps({sdf: {...sdfProps, outlineBuffer: DEFAULT_BUFFER}});\n model.draw(this.context.renderPass);\n }\n }\n }\n\n protected getInstanceOffset(icons: string): number[] {\n return icons ? Array.from(icons).flatMap(icon => super.getInstanceOffset(icon)) : EMPTY_ARRAY;\n }\n\n getInstanceColorMode(icons: string): number {\n return 1; // mask\n }\n\n getInstanceIconFrame(icons: string): number[] {\n return icons\n ? Array.from(icons).flatMap(icon => super.getInstanceIconFrame(icon))\n : EMPTY_ARRAY;\n }\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderModule} from '@luma.gl/shadertools';\n\nconst uniformBlock = `\\\nuniform sdfUniforms {\n float gamma;\n bool enabled;\n float buffer;\n float outlineBuffer;\n vec4 outlineColor;\n} sdf;\n`;\n\nexport type SdfProps = {\n gamma: number;\n enabled: boolean;\n buffer: number;\n outlineBuffer: number;\n outlineColor: [number, number, number, number];\n};\n\nexport const sdfUniforms = {\n name: 'sdf',\n vs: uniformBlock,\n fs: uniformBlock,\n uniformTypes: {\n gamma: 'f32',\n enabled: 'f32',\n buffer: 'f32',\n outlineBuffer: 'f32',\n outlineColor: 'vec4'\n }\n} as const satisfies ShaderModule;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport default `\\\n#version 300 es\n#define SHADER_NAME multi-icon-layer-fragment-shader\n\nprecision highp float;\n\nuniform sampler2D iconsTexture;\n\nin vec4 vColor;\nin vec2 vTextureCoords;\nin vec2 uv;\n\nout vec4 fragColor;\n\nvoid main(void) {\n geometry.uv = uv;\n\n if (!bool(picking.isActive)) {\n float alpha = texture(iconsTexture, vTextureCoords).a;\n vec4 color = vColor;\n\n // if enable sdf (signed distance fields)\n if (sdf.enabled) {\n float distance = alpha;\n alpha = smoothstep(sdf.buffer - sdf.gamma, sdf.buffer + sdf.gamma, distance);\n\n if (sdf.outlineBuffer > 0.0) {\n float inFill = alpha;\n float inBorder = smoothstep(sdf.outlineBuffer - sdf.gamma, sdf.outlineBuffer + sdf.gamma, distance);\n color = mix(sdf.outlineColor, vColor, inFill);\n alpha = inBorder;\n }\n }\n\n // Take the global opacity and the alpha from color into account for the alpha component\n float a = alpha * color.a;\n \n if (a < icon.alphaCutoff) {\n discard;\n }\n\n fragColor = vec4(color.rgb, a * layer.opacity);\n }\n\n DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n`;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/* global document */\nimport TinySDF from '@mapbox/tiny-sdf';\n\nimport {log} from '@deck.gl/core';\n\nimport {buildMapping, CharacterMapping} from './utils';\nimport LRUCache from './lru-cache';\n\n// import type {Texture} from '@deck.gl/core';\n\nfunction getDefaultCharacterSet() {\n const charSet: string[] = [];\n for (let i = 32; i < 128; i++) {\n charSet.push(String.fromCharCode(i));\n }\n return charSet;\n}\n\nexport type FontSettings = {\n /** CSS font family\n * @default 'Monaco, monospace'\n */\n fontFamily?: string;\n /** CSS font weight\n * @default 'normal'\n */\n fontWeight?: string | number;\n /** Specifies a list of characters to include in the font.\n * @default (ASCII characters 32-128)\n */\n characterSet?: Set | string[] | string;\n /** Font size in pixels. This option is only applied for generating `fontAtlas`, it does not impact the size of displayed text labels. Larger `fontSize` will give you a sharper look when rendering text labels with very large font sizes. But larger `fontSize` requires more time and space to generate the `fontAtlas`.\n * @default 64\n */\n fontSize?: number;\n /** Whitespace buffer around each side of the character. In general, bigger `fontSize` requires bigger `buffer`. Increase `buffer` will add more space between each character when layout `characterSet` in `fontAtlas`. This option could be tuned to provide sufficient space for drawing each character and avoiding overlapping of neighboring characters.\n * @default 4\n */\n buffer?: number;\n /** Flag to enable / disable `sdf`. [`sdf` (Signed Distance Fields)](http://cs.brown.edu/people/pfelzens/papers/dt-final.pdf) will provide a sharper look when rendering with very large or small font sizes. `TextLayer` integrates with [`TinySDF`](https://github.com/mapbox/tiny-sdf) which implements the `sdf` algorithm.\n * @default false\n */\n sdf?: boolean;\n /** How much of the radius (relative) is used for the inside part the glyph. Bigger `cutoff` makes character thinner. Smaller `cutoff` makes character look thicker. Only applies when `sdf: true`.\n * @default 0.25\n */\n cutoff?: number;\n /** How many pixels around the glyph shape to use for encoding distance. Bigger radius yields higher quality outcome. Only applies when `sdf: true`.\n * @default 12\n */\n radius?: number;\n /** How much smoothing to apply to the text edges. Only applies when `sdf: true`.\n * @default 0.1\n */\n smoothing?: number;\n};\n\nexport const DEFAULT_FONT_SETTINGS: Required = {\n fontFamily: 'Monaco, monospace',\n fontWeight: 'normal',\n characterSet: getDefaultCharacterSet(),\n fontSize: 64,\n buffer: 4,\n sdf: false,\n cutoff: 0.25,\n radius: 12,\n smoothing: 0.1\n};\n\nconst MAX_CANVAS_WIDTH = 1024;\n\nconst BASELINE_SCALE = 0.9;\nconst HEIGHT_SCALE = 1.2;\n\n// only preserve latest three fontAtlas\nconst CACHE_LIMIT = 3;\n\ntype FontAtlas = {\n /** x position of last character in mapping */\n xOffset: number;\n /** y position of last character in mapping */\n yOffset: number;\n /** bounding box of each character in the texture */\n mapping: CharacterMapping;\n /** packed texture */\n data: HTMLCanvasElement;\n /** texture width */\n width: number;\n /** texture height */\n height: number;\n};\n\nlet cache = new LRUCache(CACHE_LIMIT);\n\n/**\n * get all the chars not in cache\n * @returns chars not in cache\n */\nfunction getNewChars(cacheKey: string, characterSet: Set | string[] | string): Set {\n let newCharSet: Set;\n if (typeof characterSet === 'string') {\n newCharSet = new Set(Array.from(characterSet));\n } else {\n newCharSet = new Set(characterSet);\n }\n\n const cachedFontAtlas = cache.get(cacheKey);\n if (!cachedFontAtlas) {\n return newCharSet;\n }\n\n for (const char in cachedFontAtlas.mapping) {\n if (newCharSet.has(char)) {\n newCharSet.delete(char);\n }\n }\n return newCharSet;\n}\n\nfunction populateAlphaChannel(alphaChannel: Uint8ClampedArray, imageData: ImageData): void {\n // populate distance value from tinySDF to image alpha channel\n for (let i = 0; i < alphaChannel.length; i++) {\n imageData.data[4 * i + 3] = alphaChannel[i];\n }\n}\n\nfunction setTextStyle(\n ctx: CanvasRenderingContext2D,\n fontFamily: string,\n fontSize: number,\n fontWeight: string | number\n): void {\n ctx.font = `${fontWeight} ${fontSize}px ${fontFamily}`;\n ctx.fillStyle = '#000';\n ctx.textBaseline = 'alphabetic';\n ctx.textAlign = 'left';\n}\n\n/**\n * Sets the Font Atlas LRU Cache Limit\n * @param {number} limit LRU Cache limit\n */\nexport function setFontAtlasCacheLimit(limit: number): void {\n log.assert(Number.isFinite(limit) && limit >= CACHE_LIMIT, 'Invalid cache limit');\n\n cache = new LRUCache(limit);\n}\n\nexport default class FontAtlasManager {\n /** Font settings */\n props: Required = {...DEFAULT_FONT_SETTINGS};\n\n /** Cache key of the current font atlas */\n private _key?: string;\n /** The current font atlas */\n private _atlas?: FontAtlas;\n\n get atlas(): Readonly | undefined {\n return this._atlas;\n }\n\n // TODO - cut during v9 porting as types reveal this is not correct\n // get texture(): Texture | undefined {\n // return this._atlas;\n // }\n\n get mapping(): CharacterMapping | undefined {\n return this._atlas && this._atlas.mapping;\n }\n\n get scale(): number {\n const {fontSize, buffer} = this.props;\n return (fontSize * HEIGHT_SCALE + buffer * 2) / fontSize;\n }\n\n setProps(props: FontSettings = {}) {\n Object.assign(this.props, props);\n\n // update cache key\n this._key = this._getKey();\n\n const charSet = getNewChars(this._key, this.props.characterSet);\n const cachedFontAtlas = cache.get(this._key);\n\n // if a fontAtlas associated with the new settings is cached and\n // there are no new chars\n if (cachedFontAtlas && charSet.size === 0) {\n // update texture with cached fontAtlas\n if (this._atlas !== cachedFontAtlas) {\n this._atlas = cachedFontAtlas;\n }\n return;\n }\n\n // update fontAtlas with new settings\n const fontAtlas = this._generateFontAtlas(charSet, cachedFontAtlas);\n this._atlas = fontAtlas;\n\n // update cache\n cache.set(this._key, fontAtlas);\n }\n\n // eslint-disable-next-line max-statements\n private _generateFontAtlas(characterSet: Set, cachedFontAtlas?: FontAtlas): FontAtlas {\n const {fontFamily, fontWeight, fontSize, buffer, sdf, radius, cutoff} = this.props;\n let canvas = cachedFontAtlas && cachedFontAtlas.data;\n if (!canvas) {\n canvas = document.createElement('canvas');\n canvas.width = MAX_CANVAS_WIDTH;\n }\n const ctx = canvas.getContext('2d', {willReadFrequently: true})!;\n\n setTextStyle(ctx, fontFamily, fontSize, fontWeight);\n\n // 1. build mapping\n const {mapping, canvasHeight, xOffset, yOffset} = buildMapping({\n getFontWidth: char => ctx.measureText(char).width,\n fontHeight: fontSize * HEIGHT_SCALE,\n buffer,\n characterSet,\n maxCanvasWidth: MAX_CANVAS_WIDTH,\n ...(cachedFontAtlas && {\n mapping: cachedFontAtlas.mapping,\n xOffset: cachedFontAtlas.xOffset,\n yOffset: cachedFontAtlas.yOffset\n })\n });\n\n // 2. update canvas\n // copy old canvas data to new canvas only when height changed\n if (canvas.height !== canvasHeight) {\n const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);\n canvas.height = canvasHeight;\n ctx.putImageData(imageData, 0, 0);\n }\n setTextStyle(ctx, fontFamily, fontSize, fontWeight);\n\n // 3. layout characters\n if (sdf) {\n const tinySDF = new TinySDF({\n fontSize,\n buffer,\n radius,\n cutoff,\n fontFamily,\n fontWeight: `${fontWeight}`\n });\n\n for (const char of characterSet) {\n const {data, width, height, glyphTop} = tinySDF.draw(char);\n mapping[char].width = width;\n mapping[char].layoutOffsetY = fontSize * BASELINE_SCALE - glyphTop;\n\n const imageData = ctx.createImageData(width, height);\n populateAlphaChannel(data, imageData);\n ctx.putImageData(imageData, mapping[char].x, mapping[char].y);\n }\n } else {\n for (const char of characterSet) {\n ctx.fillText(char, mapping[char].x, mapping[char].y + buffer + fontSize * BASELINE_SCALE);\n }\n }\n\n return {\n xOffset,\n yOffset,\n mapping,\n data: canvas,\n width: canvas.width,\n height: canvas.height\n };\n }\n\n private _getKey(): string {\n const {fontFamily, fontWeight, fontSize, buffer, sdf, radius, cutoff} = this.props;\n if (sdf) {\n return `${fontFamily} ${fontWeight} ${fontSize} ${buffer} ${radius} ${cutoff}`;\n }\n return `${fontFamily} ${fontWeight} ${fontSize} ${buffer}`;\n }\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/* eslint-disable max-statements, max-params, complexity, max-depth */\n// TODO merge with icon-layer/icon-manager\nimport {log} from '@deck.gl/core';\nimport type {NumericArray} from '@math.gl/core';\n\nconst MISSING_CHAR_WIDTH = 32;\nconst SINGLE_LINE = [];\n\nexport type Character = {\n x: number;\n y: number;\n width: number;\n height: number;\n layoutWidth: number;\n layoutHeight: number;\n layoutOffsetY?: number;\n};\n\nexport type CharacterMapping = Record;\n\nexport function nextPowOfTwo(number: number): number {\n return Math.pow(2, Math.ceil(Math.log2(number)));\n}\n\n/**\n * Generate character mapping table or update from an existing mapping table\n */\nexport function buildMapping({\n characterSet,\n getFontWidth,\n fontHeight,\n buffer,\n maxCanvasWidth,\n mapping = {},\n xOffset = 0,\n yOffset = 0\n}: {\n /** list of characters */\n characterSet: Set;\n /** function to get width of each character */\n getFontWidth: (char: string) => number;\n /** height of font */\n fontHeight: number;\n /** bleeding buffer surround each character */\n buffer: number;\n /** max width of font atlas */\n maxCanvasWidth: number;\n /** cached mapping table */\n mapping?: CharacterMapping;\n /** x position of last character in the existing mapping table */\n xOffset?: number;\n /** y position of last character in the existing mapping table */\n yOffset?: number;\n}): {\n /** new mapping table */\n mapping: CharacterMapping;\n /** x position of last character in the new mapping table */\n xOffset: number;\n /** y position of last character in the new mapping table */\n yOffset: number;\n /** height of the font atlas canvas, power of 2 */\n canvasHeight: number;\n} {\n let row = 0;\n // continue from x position of last character in the old mapping\n let x = xOffset;\n const rowHeight = fontHeight + buffer * 2;\n\n for (const char of characterSet) {\n if (!mapping[char]) {\n // measure texts\n // TODO - use Advanced text metrics when they are adopted:\n // https://developer.mozilla.org/en-US/docs/Web/API/TextMetrics\n const width = getFontWidth(char);\n\n if (x + width + buffer * 2 > maxCanvasWidth) {\n x = 0;\n row++;\n }\n mapping[char] = {\n x: x + buffer,\n y: yOffset + row * rowHeight + buffer,\n width,\n height: rowHeight,\n layoutWidth: width,\n layoutHeight: fontHeight\n };\n x += width + buffer * 2;\n }\n }\n\n return {\n mapping,\n xOffset: x,\n yOffset: yOffset + row * rowHeight,\n canvasHeight: nextPowOfTwo(yOffset + (row + 1) * rowHeight)\n };\n}\n\nfunction getTextWidth(\n text: string[],\n startIndex: number,\n endIndex: number,\n mapping: CharacterMapping\n): number {\n let width = 0;\n for (let i = startIndex; i < endIndex; i++) {\n const character = text[i];\n width += mapping[character]?.layoutWidth || 0;\n }\n\n return width;\n}\n\nfunction breakAll(\n text: string[],\n startIndex: number,\n endIndex: number,\n maxWidth: number,\n iconMapping: CharacterMapping,\n target: number[]\n): number {\n let rowStartCharIndex = startIndex;\n let rowOffsetLeft = 0;\n\n for (let i = startIndex; i < endIndex; i++) {\n // 2. figure out where to break lines\n const textWidth = getTextWidth(text, i, i + 1, iconMapping);\n if (rowOffsetLeft + textWidth > maxWidth) {\n if (rowStartCharIndex < i) {\n target.push(i);\n }\n rowStartCharIndex = i;\n rowOffsetLeft = 0;\n }\n rowOffsetLeft += textWidth;\n }\n\n return rowOffsetLeft;\n}\n\nfunction breakWord(\n text: string[],\n startIndex: number,\n endIndex: number,\n maxWidth: number,\n iconMapping: CharacterMapping,\n target: number[]\n): number {\n let rowStartCharIndex = startIndex;\n let groupStartCharIndex = startIndex;\n let groupEndCharIndex = startIndex;\n let rowOffsetLeft = 0;\n\n for (let i = startIndex; i < endIndex; i++) {\n // 1. break text into word groups\n // - if current char is white space\n // - else if next char is white space\n // - else if reach last char\n if (text[i] === ' ') {\n groupEndCharIndex = i + 1;\n } else if (text[i + 1] === ' ' || i + 1 === endIndex) {\n groupEndCharIndex = i + 1;\n }\n\n if (groupEndCharIndex > groupStartCharIndex) {\n // 2. break text into next row at maxWidth\n let groupWidth = getTextWidth(text, groupStartCharIndex, groupEndCharIndex, iconMapping);\n if (rowOffsetLeft + groupWidth > maxWidth) {\n if (rowStartCharIndex < groupStartCharIndex) {\n target.push(groupStartCharIndex);\n rowStartCharIndex = groupStartCharIndex;\n rowOffsetLeft = 0;\n }\n\n // if a single text group is bigger than maxWidth, then `break-all`\n if (groupWidth > maxWidth) {\n groupWidth = breakAll(\n text,\n groupStartCharIndex,\n groupEndCharIndex,\n maxWidth,\n iconMapping,\n target\n );\n // move reference to last row\n rowStartCharIndex = target[target.length - 1];\n }\n }\n groupStartCharIndex = groupEndCharIndex;\n rowOffsetLeft += groupWidth;\n }\n }\n\n return rowOffsetLeft;\n}\n\n/**\n * Wrap the given text so that each line does not exceed the given max width.\n * Returns a list of indices where line breaks should be inserted.\n */\nexport function autoWrapping(\n text: string[],\n wordBreak: 'break-all' | 'break-word',\n maxWidth: number,\n iconMapping: CharacterMapping,\n startIndex: number = 0,\n endIndex: number\n): number[] {\n if (endIndex === undefined) {\n endIndex = text.length;\n }\n const result = [];\n if (wordBreak === 'break-all') {\n breakAll(text, startIndex, endIndex, maxWidth, iconMapping, result);\n } else {\n breakWord(text, startIndex, endIndex, maxWidth, iconMapping, result);\n }\n return result;\n}\n\nfunction transformRow(\n line: string[],\n startIndex: number,\n endIndex: number,\n iconMapping: CharacterMapping,\n leftOffsets: number[],\n rowSize: [number, number]\n) {\n let x = 0;\n let rowHeight = 0;\n\n for (let i = startIndex; i < endIndex; i++) {\n const character = line[i];\n const frame = iconMapping[character];\n if (frame) {\n if (!rowHeight) {\n // frame.height should be a constant\n rowHeight = frame.layoutHeight;\n }\n leftOffsets[i] = x + frame.layoutWidth / 2;\n x += frame.layoutWidth;\n } else {\n log.warn(`Missing character: ${character} (${character.codePointAt(0)})`)();\n leftOffsets[i] = x;\n x += MISSING_CHAR_WIDTH;\n }\n }\n\n rowSize[0] = x;\n rowSize[1] = rowHeight;\n}\n\n/**\n * Transform a text paragraph to an array of characters, each character contains\n */\nexport function transformParagraph(\n paragraph: string,\n /** CSS line-height */\n lineHeight: number,\n /** CSS word-break option */\n wordBreak: 'break-word' | 'break-all',\n /** CSS max-width */\n maxWidth: number,\n /** character mapping table for retrieving a character from font atlas */\n iconMapping: CharacterMapping\n): {\n /** x position of each character */\n x: number[];\n /** y position of each character */\n y: number[];\n /** the current row width of each character */\n rowWidth: number[];\n /** the width and height of the paragraph */\n size: [number, number];\n} {\n // Break into an array of characters\n // When dealing with double-length unicode characters, `str.length` or `str[i]` do not work\n const characters = Array.from(paragraph);\n const numCharacters = characters.length;\n const x = new Array(numCharacters) as number[];\n const y = new Array(numCharacters) as number[];\n const rowWidth = new Array(numCharacters) as number[];\n const autoWrappingEnabled =\n (wordBreak === 'break-word' || wordBreak === 'break-all') && isFinite(maxWidth) && maxWidth > 0;\n\n // maxWidth and height of the paragraph\n const size: [number, number] = [0, 0];\n const rowSize: [number, number] = [0, 0];\n let rowOffsetTop = 0;\n let lineStartIndex = 0;\n let lineEndIndex = 0;\n\n for (let i = 0; i <= numCharacters; i++) {\n const char = characters[i];\n if (char === '\\n' || i === numCharacters) {\n lineEndIndex = i;\n }\n\n if (lineEndIndex > lineStartIndex) {\n const rows = autoWrappingEnabled\n ? autoWrapping(characters, wordBreak, maxWidth, iconMapping, lineStartIndex, lineEndIndex)\n : SINGLE_LINE;\n\n for (let rowIndex = 0; rowIndex <= rows.length; rowIndex++) {\n const rowStart = rowIndex === 0 ? lineStartIndex : rows[rowIndex - 1];\n const rowEnd = rowIndex < rows.length ? rows[rowIndex] : lineEndIndex;\n\n transformRow(characters, rowStart, rowEnd, iconMapping, x, rowSize);\n for (let j = rowStart; j < rowEnd; j++) {\n const char = characters[j];\n const layoutOffsetY = iconMapping[char]?.layoutOffsetY || 0;\n y[j] = rowOffsetTop + rowSize[1] / 2 + layoutOffsetY;\n rowWidth[j] = rowSize[0];\n }\n\n rowOffsetTop = rowOffsetTop + rowSize[1] * lineHeight;\n size[0] = Math.max(size[0], rowSize[0]);\n }\n lineStartIndex = lineEndIndex;\n }\n\n if (char === '\\n') {\n // Make sure result.length matches paragraph.length\n x[lineStartIndex] = 0;\n y[lineStartIndex] = 0;\n rowWidth[lineStartIndex] = 0;\n lineStartIndex++;\n }\n }\n\n // last row\n size[1] = rowOffsetTop;\n return {x, y, rowWidth, size};\n}\n\nexport function getTextFromBuffer({\n value,\n length,\n stride,\n offset,\n startIndices,\n characterSet\n}: {\n value: Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array;\n length: number;\n stride?: number;\n offset?: number;\n startIndices: NumericArray;\n characterSet?: Set;\n}): {\n texts: string[];\n characterCount: number;\n} {\n const bytesPerElement = value.BYTES_PER_ELEMENT;\n const elementStride = stride ? stride / bytesPerElement : 1;\n const elementOffset = offset ? offset / bytesPerElement : 0;\n const characterCount =\n startIndices[length] || Math.ceil((value.length - elementOffset) / elementStride);\n const autoCharacterSet = characterSet && new Set();\n\n const texts = new Array(length);\n\n let codes = value;\n if (elementStride > 1 || elementOffset > 0) {\n const ArrayType = value.constructor as\n | Uint8ArrayConstructor\n | Uint8ClampedArrayConstructor\n | Uint16ArrayConstructor\n | Uint32ArrayConstructor;\n codes = new ArrayType(characterCount);\n for (let i = 0; i < characterCount; i++) {\n codes[i] = value[i * elementStride + elementOffset];\n }\n }\n\n for (let index = 0; index < length; index++) {\n const startIndex = startIndices[index];\n const endIndex = startIndices[index + 1] || characterCount;\n const codesAtIndex = codes.subarray(startIndex, endIndex);\n // @ts-ignore TS wants the argument to be number[] but typed array works too\n texts[index] = String.fromCodePoint.apply(null, codesAtIndex);\n if (autoCharacterSet) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n codesAtIndex.forEach(autoCharacterSet.add, autoCharacterSet);\n }\n }\n\n if (autoCharacterSet) {\n for (const charCode of autoCharacterSet) {\n characterSet.add(String.fromCodePoint(charCode));\n }\n }\n\n return {texts, characterCount};\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/**\n * LRU Cache class with limit\n *\n * Update order for each get/set operation\n * Delete oldest when reach given limit\n */\n\nexport default class LRUCache {\n private limit: number;\n private _cache: Record = {};\n /** access/update order, first item is oldest, last item is newest */\n private _order: string[] = [];\n\n constructor(limit: number = 5) {\n this.limit = limit;\n }\n\n get(key: string): ValueT {\n const value = this._cache[key];\n if (value) {\n // update order\n this._deleteOrder(key);\n this._appendOrder(key);\n }\n return value;\n }\n\n set(key: string, value: ValueT): void {\n if (!this._cache[key]) {\n // if reach limit, delete the oldest\n if (Object.keys(this._cache).length === this.limit) {\n this.delete(this._order[0]);\n }\n\n this._cache[key] = value;\n this._appendOrder(key);\n } else {\n // if found in cache, delete the old one, insert new one to the first of list\n this.delete(key);\n\n this._cache[key] = value;\n this._appendOrder(key);\n }\n }\n\n delete(key: string): void {\n const value = this._cache[key];\n if (value) {\n delete this._cache[key];\n this._deleteOrder(key);\n }\n }\n\n private _deleteOrder(key: string): void {\n const index = this._order.indexOf(key);\n if (index >= 0) {\n this._order.splice(index, 1);\n }\n }\n\n private _appendOrder(key: string): void {\n this._order.push(key);\n }\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {Layer, project32, picking, UNIT} from '@deck.gl/core';\nimport {Geometry} from '@luma.gl/engine';\nimport {Model} from '@luma.gl/engine';\n\nimport {TextBackgroundProps, textBackgroundUniforms} from './text-background-layer-uniforms';\nimport vs from './text-background-layer-vertex.glsl';\nimport fs from './text-background-layer-fragment.glsl';\n\nimport type {\n LayerProps,\n LayerDataSource,\n Accessor,\n Unit,\n Position,\n Color,\n UpdateParameters,\n DefaultProps\n} from '@deck.gl/core';\n\ntype _TextBackgroundLayerProps = {\n data: LayerDataSource;\n billboard?: boolean;\n sizeScale?: number;\n sizeUnits?: Unit;\n sizeMinPixels?: number;\n sizeMaxPixels?: number;\n\n padding?: [number, number] | [number, number, number, number];\n\n getPosition?: Accessor;\n getSize?: Accessor;\n getAngle?: Accessor;\n getPixelOffset?: Accessor;\n getBoundingRect?: Accessor;\n getFillColor?: Accessor;\n getLineColor?: Accessor;\n getLineWidth?: Accessor;\n};\n\nexport type TextBackgroundLayerProps = _TextBackgroundLayerProps &\n LayerProps;\n\nconst defaultProps: DefaultProps = {\n billboard: true,\n sizeScale: 1,\n sizeUnits: 'pixels',\n sizeMinPixels: 0,\n sizeMaxPixels: Number.MAX_SAFE_INTEGER,\n\n padding: {type: 'array', value: [0, 0, 0, 0]},\n\n getPosition: {type: 'accessor', value: (x: any) => x.position},\n getSize: {type: 'accessor', value: 1},\n getAngle: {type: 'accessor', value: 0},\n getPixelOffset: {type: 'accessor', value: [0, 0]},\n getBoundingRect: {type: 'accessor', value: [0, 0, 0, 0]},\n getFillColor: {type: 'accessor', value: [0, 0, 0, 255]},\n getLineColor: {type: 'accessor', value: [0, 0, 0, 255]},\n getLineWidth: {type: 'accessor', value: 1}\n};\n\nexport default class TextBackgroundLayer extends Layer<\n ExtraPropsT & Required<_TextBackgroundLayerProps>\n> {\n static defaultProps = defaultProps;\n static layerName = 'TextBackgroundLayer';\n\n state!: {\n model?: Model;\n };\n\n getShaders() {\n return super.getShaders({vs, fs, modules: [project32, picking, textBackgroundUniforms]});\n }\n\n initializeState() {\n this.getAttributeManager()!.addInstanced({\n instancePositions: {\n size: 3,\n type: 'float64',\n fp64: this.use64bitPositions(),\n transition: true,\n accessor: 'getPosition'\n },\n instanceSizes: {\n size: 1,\n transition: true,\n accessor: 'getSize',\n defaultValue: 1\n },\n instanceAngles: {\n size: 1,\n transition: true,\n accessor: 'getAngle'\n },\n instanceRects: {\n size: 4,\n accessor: 'getBoundingRect'\n },\n instancePixelOffsets: {\n size: 2,\n transition: true,\n accessor: 'getPixelOffset'\n },\n instanceFillColors: {\n size: 4,\n transition: true,\n type: 'unorm8',\n accessor: 'getFillColor',\n defaultValue: [0, 0, 0, 255]\n },\n instanceLineColors: {\n size: 4,\n transition: true,\n type: 'unorm8',\n accessor: 'getLineColor',\n defaultValue: [0, 0, 0, 255]\n },\n instanceLineWidths: {\n size: 1,\n transition: true,\n accessor: 'getLineWidth',\n defaultValue: 1\n }\n });\n }\n\n updateState(params: UpdateParameters) {\n super.updateState(params);\n const {changeFlags} = params;\n if (changeFlags.extensionsChanged) {\n this.state.model?.destroy();\n this.state.model = this._getModel();\n this.getAttributeManager()!.invalidateAll();\n }\n }\n\n draw({uniforms}) {\n const {billboard, sizeScale, sizeUnits, sizeMinPixels, sizeMaxPixels, getLineWidth} =\n this.props;\n let {padding} = this.props;\n\n if (padding.length < 4) {\n padding = [padding[0], padding[1], padding[0], padding[1]];\n }\n\n const model = this.state.model!;\n const textBackgroundProps: TextBackgroundProps = {\n billboard,\n stroked: Boolean(getLineWidth),\n padding: padding as [number, number, number, number],\n sizeUnits: UNIT[sizeUnits],\n sizeScale,\n sizeMinPixels,\n sizeMaxPixels\n };\n model.shaderInputs.setProps({textBackground: textBackgroundProps});\n model.draw(this.context.renderPass);\n }\n\n protected _getModel(): Model {\n // a square that minimally cover the unit circle\n const positions = [0, 0, 1, 0, 0, 1, 1, 1];\n\n return new Model(this.context.device, {\n ...this.getShaders(),\n id: this.props.id,\n bufferLayout: this.getAttributeManager()!.getBufferLayouts(),\n geometry: new Geometry({\n topology: 'triangle-strip',\n vertexCount: 4,\n attributes: {\n positions: {size: 2, value: new Float32Array(positions)}\n }\n }),\n isInstanced: true\n });\n }\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderModule} from '@luma.gl/shadertools';\n\nconst uniformBlock = `\\\nuniform textBackgroundUniforms {\n bool billboard;\n float sizeScale;\n float sizeMinPixels;\n float sizeMaxPixels;\n vec4 padding;\n highp int sizeUnits;\n bool stroked;\n} textBackground;\n`;\n\nexport type TextBackgroundProps = {\n billboard: boolean;\n sizeScale: number;\n sizeMinPixels: number;\n sizeMaxPixels: number;\n padding: [number, number, number, number];\n sizeUnits: number;\n stroked: boolean;\n};\n\nexport const textBackgroundUniforms = {\n name: 'textBackground',\n vs: uniformBlock,\n fs: uniformBlock,\n uniformTypes: {\n billboard: 'f32',\n sizeScale: 'f32',\n sizeMinPixels: 'f32',\n sizeMaxPixels: 'f32',\n padding: 'vec4',\n sizeUnits: 'i32',\n stroked: 'f32'\n }\n} as const satisfies ShaderModule;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport default `\\\n#version 300 es\n#define SHADER_NAME text-background-layer-vertex-shader\n\nin vec2 positions;\n\nin vec3 instancePositions;\nin vec3 instancePositions64Low;\nin vec4 instanceRects;\nin float instanceSizes;\nin float instanceAngles;\nin vec2 instancePixelOffsets;\nin float instanceLineWidths;\nin vec4 instanceFillColors;\nin vec4 instanceLineColors;\nin vec3 instancePickingColors;\n\nout vec4 vFillColor;\nout vec4 vLineColor;\nout float vLineWidth;\nout vec2 uv;\nout vec2 dimensions;\n\nvec2 rotate_by_angle(vec2 vertex, float angle) {\n float angle_radian = radians(angle);\n float cos_angle = cos(angle_radian);\n float sin_angle = sin(angle_radian);\n mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle);\n return rotationMatrix * vertex;\n}\n\nvoid main(void) {\n geometry.worldPosition = instancePositions;\n geometry.uv = positions;\n geometry.pickingColor = instancePickingColors;\n uv = positions;\n vLineWidth = instanceLineWidths;\n\n // convert size in meters to pixels, then scaled and clamp\n\n // project meters to pixels and clamp to limits\n float sizePixels = clamp(\n project_size_to_pixel(instanceSizes * textBackground.sizeScale, textBackground.sizeUnits),\n textBackground.sizeMinPixels, textBackground.sizeMaxPixels\n );\n\n dimensions = instanceRects.zw * sizePixels + textBackground.padding.xy + textBackground.padding.zw;\n\n vec2 pixelOffset = (positions * instanceRects.zw + instanceRects.xy) * sizePixels + mix(-textBackground.padding.xy, textBackground.padding.zw, positions);\n pixelOffset = rotate_by_angle(pixelOffset, instanceAngles);\n pixelOffset += instancePixelOffsets;\n pixelOffset.y *= -1.0;\n\n if (textBackground.billboard) {\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n vec3 offset = vec3(pixelOffset, 0.0);\n DECKGL_FILTER_SIZE(offset, geometry);\n gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);\n } else {\n vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0);\n DECKGL_FILTER_SIZE(offset_common, geometry);\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n }\n\n // Apply opacity to instance color, or return instance picking color\n vFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * layer.opacity);\n DECKGL_FILTER_COLOR(vFillColor, geometry);\n vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * layer.opacity);\n DECKGL_FILTER_COLOR(vLineColor, geometry);\n}\n`;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport default `\\\n#version 300 es\n#define SHADER_NAME text-background-layer-fragment-shader\n\nprecision highp float;\n\nin vec4 vFillColor;\nin vec4 vLineColor;\nin float vLineWidth;\nin vec2 uv;\nin vec2 dimensions;\n\nout vec4 fragColor;\n\nvoid main(void) {\n geometry.uv = uv;\n\n vec2 pixelPosition = uv * dimensions;\n if (textBackground.stroked) {\n float distToEdge = min(\n min(pixelPosition.x, dimensions.x - pixelPosition.x),\n min(pixelPosition.y, dimensions.y - pixelPosition.y)\n );\n float isBorder = smoothedge(distToEdge, vLineWidth);\n fragColor = mix(vFillColor, vLineColor, isBorder);\n } else {\n fragColor = vFillColor;\n }\n\n DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n`;\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {CompositeLayer, Layer} from '@deck.gl/core';\n\nimport IconLayer from '../icon-layer/icon-layer';\nimport ScatterplotLayer from '../scatterplot-layer/scatterplot-layer';\nimport TextLayer from '../text-layer/text-layer';\nimport PathLayer from '../path-layer/path-layer';\nimport SolidPolygonLayer from '../solid-polygon-layer/solid-polygon-layer';\n\nexport const POINT_LAYER = {\n circle: {\n type: ScatterplotLayer,\n props: {\n filled: 'filled',\n stroked: 'stroked',\n\n lineWidthMaxPixels: 'lineWidthMaxPixels',\n lineWidthMinPixels: 'lineWidthMinPixels',\n lineWidthScale: 'lineWidthScale',\n lineWidthUnits: 'lineWidthUnits',\n pointRadiusMaxPixels: 'radiusMaxPixels',\n pointRadiusMinPixels: 'radiusMinPixels',\n pointRadiusScale: 'radiusScale',\n pointRadiusUnits: 'radiusUnits',\n pointAntialiasing: 'antialiasing',\n pointBillboard: 'billboard',\n\n getFillColor: 'getFillColor',\n getLineColor: 'getLineColor',\n getLineWidth: 'getLineWidth',\n getPointRadius: 'getRadius'\n }\n },\n icon: {\n type: IconLayer,\n props: {\n iconAtlas: 'iconAtlas',\n iconMapping: 'iconMapping',\n\n iconSizeMaxPixels: 'sizeMaxPixels',\n iconSizeMinPixels: 'sizeMinPixels',\n iconSizeScale: 'sizeScale',\n iconSizeUnits: 'sizeUnits',\n iconAlphaCutoff: 'alphaCutoff',\n iconBillboard: 'billboard',\n\n getIcon: 'getIcon',\n getIconAngle: 'getAngle',\n getIconColor: 'getColor',\n getIconPixelOffset: 'getPixelOffset',\n getIconSize: 'getSize'\n }\n },\n text: {\n type: TextLayer,\n props: {\n textSizeMaxPixels: 'sizeMaxPixels',\n textSizeMinPixels: 'sizeMinPixels',\n textSizeScale: 'sizeScale',\n textSizeUnits: 'sizeUnits',\n\n textBackground: 'background',\n textBackgroundPadding: 'backgroundPadding',\n textFontFamily: 'fontFamily',\n textFontWeight: 'fontWeight',\n textLineHeight: 'lineHeight',\n textMaxWidth: 'maxWidth',\n textOutlineColor: 'outlineColor',\n textOutlineWidth: 'outlineWidth',\n textWordBreak: 'wordBreak',\n textCharacterSet: 'characterSet',\n textBillboard: 'billboard',\n textFontSettings: 'fontSettings',\n\n getText: 'getText',\n getTextAngle: 'getAngle',\n getTextColor: 'getColor',\n getTextPixelOffset: 'getPixelOffset',\n getTextSize: 'getSize',\n getTextAnchor: 'getTextAnchor',\n getTextAlignmentBaseline: 'getAlignmentBaseline',\n getTextBackgroundColor: 'getBackgroundColor',\n getTextBorderColor: 'getBorderColor',\n getTextBorderWidth: 'getBorderWidth'\n }\n }\n};\n\nexport const LINE_LAYER = {\n type: PathLayer,\n props: {\n lineWidthUnits: 'widthUnits',\n lineWidthScale: 'widthScale',\n lineWidthMinPixels: 'widthMinPixels',\n lineWidthMaxPixels: 'widthMaxPixels',\n lineJointRounded: 'jointRounded',\n lineCapRounded: 'capRounded',\n lineMiterLimit: 'miterLimit',\n lineBillboard: 'billboard',\n\n getLineColor: 'getColor',\n getLineWidth: 'getWidth'\n }\n};\n\nexport const POLYGON_LAYER = {\n type: SolidPolygonLayer,\n props: {\n extruded: 'extruded',\n filled: 'filled',\n wireframe: 'wireframe',\n elevationScale: 'elevationScale',\n material: 'material',\n _full3d: '_full3d',\n\n getElevation: 'getElevation',\n getFillColor: 'getFillColor',\n getLineColor: 'getLineColor'\n }\n};\n\nexport function getDefaultProps({\n type,\n props\n}: {\n type: typeof Layer;\n props: Record;\n}): Record {\n const result = {};\n for (const key in props) {\n result[key] = type.defaultProps[props[key]];\n }\n return result;\n}\n\nexport function forwardProps(\n layer: CompositeLayer,\n mapping: Record\n): Record {\n const {transitions, updateTriggers} = layer.props;\n const result: Record = {\n updateTriggers: {},\n transitions: transitions && {\n getPosition: transitions.geometry\n }\n };\n\n for (const sourceKey in mapping) {\n const targetKey = mapping[sourceKey];\n let value = layer.props[sourceKey];\n if (sourceKey.startsWith('get')) {\n // isAccessor\n value = (layer as any).getSubLayerAccessor(value);\n result.updateTriggers[targetKey] = updateTriggers[sourceKey];\n if (transitions) {\n result.transitions[targetKey] = transitions[sourceKey];\n }\n }\n result[targetKey] = value;\n }\n return result;\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {log} from '@deck.gl/core';\nimport type {\n Feature,\n GeoJSON,\n GeoJsonGeometryTypes,\n LineString,\n MultiLineString,\n MultiPoint,\n MultiPolygon,\n Point,\n Polygon\n} from 'geojson';\n\ntype SupportedGeometry = Point | MultiPoint | LineString | MultiLineString | Polygon | MultiPolygon;\n\nexport type SeparatedGeometries = {\n pointFeatures: {geometry: Point}[];\n lineFeatures: {geometry: LineString}[];\n polygonFeatures: {geometry: Polygon}[];\n polygonOutlineFeatures: {geometry: LineString}[];\n};\n\n/**\n * \"Normalizes\" complete or partial GeoJSON data into iterable list of features\n * Can accept GeoJSON geometry or \"Feature\", \"FeatureCollection\" in addition\n * to plain arrays and iterables.\n * Works by extracting the feature array or wrapping single objects in an array,\n * so that subsequent code can simply iterate over features.\n *\n * @param {object} geojson - geojson data\n * @param {Object|Array} data - geojson object (FeatureCollection, Feature or\n * Geometry) or array of features\n * @return {Array|\"iteratable\"} - iterable list of features\n */\nexport function getGeojsonFeatures(geojson: GeoJSON): Feature[] {\n // If array, assume this is a list of features\n if (Array.isArray(geojson)) {\n return geojson;\n }\n\n log.assert(geojson.type, 'GeoJSON does not have type');\n\n switch (geojson.type) {\n case 'Feature':\n // Wrap the feature in a 'Features' array\n return [geojson];\n case 'FeatureCollection':\n // Just return the 'Features' array from the collection\n log.assert(Array.isArray(geojson.features), 'GeoJSON does not have features array');\n return geojson.features;\n default:\n // Assume it's a geometry, we'll check type in separateGeojsonFeatures\n // Wrap the geometry object in a 'Feature' object and wrap in an array\n return [{geometry: geojson}] as Feature[];\n }\n}\n\n// Linearize\nexport function separateGeojsonFeatures(\n features: Feature[],\n wrapFeature: (row: T, sourceObject: any, sourceObjectIndex: number) => T,\n dataRange: {startRow?: number; endRow?: number} = {}\n): SeparatedGeometries {\n const separated: SeparatedGeometries = {\n pointFeatures: [],\n lineFeatures: [],\n polygonFeatures: [],\n polygonOutlineFeatures: []\n };\n const {startRow = 0, endRow = features.length} = dataRange;\n\n for (let featureIndex = startRow; featureIndex < endRow; featureIndex++) {\n const feature = features[featureIndex];\n const {geometry} = feature;\n\n if (!geometry) {\n // geometry can be null per specification\n continue; // eslint-disable-line no-continue\n }\n\n if (geometry.type === 'GeometryCollection') {\n log.assert(Array.isArray(geometry.geometries), 'GeoJSON does not have geometries array');\n const {geometries} = geometry;\n for (let i = 0; i < geometries.length; i++) {\n const subGeometry = geometries[i];\n separateGeometry(\n subGeometry as SupportedGeometry,\n separated,\n wrapFeature,\n feature,\n featureIndex\n );\n }\n } else {\n separateGeometry(geometry, separated, wrapFeature, feature, featureIndex);\n }\n }\n\n return separated;\n}\n\nfunction separateGeometry(\n geometry: SupportedGeometry,\n separated: SeparatedGeometries,\n wrapFeature: (row: T, sourceObject: any, sourceObjectIndex: number) => T,\n sourceFeature: Feature,\n sourceFeatureIndex: number\n) {\n const {type, coordinates} = geometry;\n const {pointFeatures, lineFeatures, polygonFeatures, polygonOutlineFeatures} = separated;\n\n if (!validateGeometry(type, coordinates)) {\n // Avoid hard failure if some features are malformed\n log.warn(`${type} coordinates are malformed`)();\n return;\n }\n\n // Split each feature, but keep track of the source feature and index (for Multi* geometries)\n switch (type) {\n case 'Point':\n pointFeatures.push(\n wrapFeature(\n {\n geometry\n },\n sourceFeature,\n sourceFeatureIndex\n )\n );\n break;\n case 'MultiPoint':\n coordinates.forEach(point => {\n pointFeatures.push(\n wrapFeature(\n {\n geometry: {type: 'Point', coordinates: point}\n },\n sourceFeature,\n sourceFeatureIndex\n )\n );\n });\n break;\n case 'LineString':\n lineFeatures.push(\n wrapFeature(\n {\n geometry\n },\n sourceFeature,\n sourceFeatureIndex\n )\n );\n break;\n case 'MultiLineString':\n // Break multilinestrings into multiple lines\n coordinates.forEach(path => {\n lineFeatures.push(\n wrapFeature(\n {\n geometry: {type: 'LineString', coordinates: path}\n },\n sourceFeature,\n sourceFeatureIndex\n )\n );\n });\n break;\n case 'Polygon':\n polygonFeatures.push(\n wrapFeature(\n {\n geometry\n },\n sourceFeature,\n sourceFeatureIndex\n )\n );\n // Break polygon into multiple lines\n coordinates.forEach(path => {\n polygonOutlineFeatures.push(\n wrapFeature(\n {\n geometry: {type: 'LineString', coordinates: path}\n },\n sourceFeature,\n sourceFeatureIndex\n )\n );\n });\n break;\n case 'MultiPolygon':\n // Break multipolygons into multiple polygons\n coordinates.forEach(polygon => {\n polygonFeatures.push(\n wrapFeature(\n {\n geometry: {type: 'Polygon', coordinates: polygon}\n },\n sourceFeature,\n sourceFeatureIndex\n )\n );\n // Break polygon into multiple lines\n polygon.forEach(path => {\n polygonOutlineFeatures.push(\n wrapFeature(\n {\n geometry: {type: 'LineString', coordinates: path}\n },\n sourceFeature,\n sourceFeatureIndex\n )\n );\n });\n });\n break;\n default:\n }\n}\n\n/**\n * Simple GeoJSON validation util. For perf reasons we do not validate against the full spec,\n * only the following:\n - geometry.type is supported\n - geometry.coordinate has correct nesting level\n */\nconst COORDINATE_NEST_LEVEL: Record = {\n Point: 1,\n MultiPoint: 2,\n LineString: 2,\n MultiLineString: 3,\n Polygon: 3,\n MultiPolygon: 4\n};\n\nexport function validateGeometry(type: GeoJsonGeometryTypes, coordinates: any): boolean {\n let nestLevel = COORDINATE_NEST_LEVEL[type] as number;\n\n log.assert(nestLevel, `Unknown GeoJSON type ${type}`);\n\n while (coordinates && --nestLevel > 0) {\n coordinates = coordinates[0];\n }\n\n return coordinates && Number.isFinite(coordinates[0]);\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {LayerData, LayerProps} from '@deck.gl/core';\nimport {PolygonLayerProps, ScatterplotLayerProps} from '..';\nimport {calculatePickingColors} from './geojson-binary';\nimport type {ExtendedBinaryFeatureCollection} from './geojson-binary';\nimport {SeparatedGeometries} from './geojson';\n\n// TODO: PathLayer is not yet typed\ntype PathLayerProps = LayerProps & Record;\n\nexport type SubLayersProps = {\n points: Partial;\n lines: Partial;\n polygons: Partial;\n polygonsOutline: Partial;\n};\n\nfunction createEmptyLayerProps(): SubLayersProps {\n return {\n points: {},\n lines: {},\n polygons: {},\n polygonsOutline: {}\n };\n}\n\nfunction getCoordinates(f) {\n return f.geometry.coordinates;\n}\n\nexport function createLayerPropsFromFeatures(\n features: SeparatedGeometries,\n featuresDiff\n): SubLayersProps {\n const layerProps = createEmptyLayerProps();\n const {pointFeatures, lineFeatures, polygonFeatures, polygonOutlineFeatures} = features;\n\n layerProps.points.data = pointFeatures;\n layerProps.points._dataDiff = featuresDiff.pointFeatures && (() => featuresDiff.pointFeatures);\n layerProps.points.getPosition = getCoordinates;\n\n layerProps.lines.data = lineFeatures;\n layerProps.lines._dataDiff = featuresDiff.lineFeatures && (() => featuresDiff.lineFeatures);\n layerProps.lines.getPath = getCoordinates;\n\n layerProps.polygons.data = polygonFeatures;\n layerProps.polygons._dataDiff =\n featuresDiff.polygonFeatures && (() => featuresDiff.polygonFeatures);\n layerProps.polygons.getPolygon = getCoordinates;\n\n layerProps.polygonsOutline.data = polygonOutlineFeatures;\n layerProps.polygonsOutline._dataDiff =\n featuresDiff.polygonOutlineFeatures && (() => featuresDiff.polygonOutlineFeatures);\n layerProps.polygonsOutline.getPath = getCoordinates;\n\n return layerProps;\n}\n\nexport function createLayerPropsFromBinary(\n geojsonBinary: Required,\n encodePickingColor: (id: number, result: number[]) => void\n): SubLayersProps {\n // The binary data format is documented here\n // https://github.com/visgl/loaders.gl/blob/master/modules/gis/docs/api-reference/geojson-to-binary.md\n // It is the default output from the `MVTLoader` and can also be obtained\n // from GeoJSON by using the `geojsonToBinary` utility function.\n const layerProps = createEmptyLayerProps();\n const {points, lines, polygons} = geojsonBinary;\n\n const customPickingColors = calculatePickingColors(geojsonBinary, encodePickingColor);\n\n layerProps.points.data = {\n length: points.positions.value.length / points.positions.size,\n attributes: {\n ...points.attributes,\n getPosition: points.positions,\n instancePickingColors: {\n size: 4,\n value: customPickingColors.points!\n }\n },\n properties: points.properties,\n numericProps: points.numericProps,\n featureIds: points.featureIds\n } as LayerData;\n\n layerProps.lines.data = {\n length: lines.pathIndices.value.length - 1,\n startIndices: lines.pathIndices.value,\n attributes: {\n ...lines.attributes,\n getPath: lines.positions,\n instancePickingColors: {\n size: 4,\n value: customPickingColors.lines!\n }\n },\n properties: lines.properties,\n numericProps: lines.numericProps,\n featureIds: lines.featureIds\n } as LayerData;\n layerProps.lines._pathType = 'open';\n\n layerProps.polygons.data = {\n length: polygons.polygonIndices.value.length - 1,\n startIndices: polygons.polygonIndices.value,\n attributes: {\n ...polygons.attributes,\n getPolygon: polygons.positions,\n pickingColors: {\n size: 4,\n value: customPickingColors.polygons!\n }\n },\n properties: polygons.properties,\n numericProps: polygons.numericProps,\n featureIds: polygons.featureIds\n } as LayerData;\n layerProps.polygons._normalize = false;\n if (polygons.triangles) {\n (layerProps.polygons.data as any).attributes.indices = polygons.triangles.value;\n }\n\n layerProps.polygonsOutline.data = {\n length: polygons.primitivePolygonIndices.value.length - 1,\n startIndices: polygons.primitivePolygonIndices.value,\n attributes: {\n ...polygons.attributes,\n getPath: polygons.positions,\n instancePickingColors: {\n size: 4,\n value: customPickingColors.polygons!\n }\n },\n properties: polygons.properties,\n numericProps: polygons.numericProps,\n featureIds: polygons.featureIds\n } as LayerData;\n layerProps.polygonsOutline._pathType = 'open';\n\n return layerProps;\n}\n"], "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;ACIA,kBAcO;AAEP,oBAAoB;;;ACdpB,IAAM,eAAe;;;;;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UACA,gBAAgB,eAAe;UAC/B;SACD,GACD,gBAAgB,CACjB;MAEL;IACF;AACA,WAAO;EACT;EAEA,eAAY;AACV,UAAM,EAAC,SAAQ,IAAI,KAAK;AAExB,UAAM,mBAAmB,KAAK,oBAAmB;AACjD,UAAM,aAAa,KAAK,kBAAiB;AACzC,UAAM,cAAc,KAAK,mBAAkB;AAE3C,WAAO;;MAEL,CAAC,YAAY;MACb;MACA;;MAEA,YAAY;;EAEhB;EAEU,oBAA6B,UAA2B;AAChE,UAAM,EAAC,OAAM,IAAI,KAAK;AACtB,QAAI,CAAC,UAAU,OAAO,aAAa,YAAY;AAC7C,aAAO,MAAM,oBAAoB,QAAQ;IAC3C;AAEA,WAAO,CAAC,QAAQ,SAAQ;AACtB,YAAM,EAAC,MAAM,MAAK,IAAI;AACtB,YAAM,UAAU,0BAA0B,MAAuC,KAAK;AAEtF,aAAO,SAAS,SAAS,IAAI;IAC/B;EACF;;AA3QO,aAAA,YAAY;AACZ,aAAA,eAAeA;4BALH;", "names": ["import_core", "import_engine", "import_core", "uniformBlock", "defaultProps", "import_core", "import_engine", "uniformBlock", "import_core", "DEFAULT_COLOR", "defaultProps", "import_core", "import_engine", "uniformBlock", "DEFAULT_COLOR", "defaultProps", "import_core", "import_engine", "uniformBlock", "DEFAULT_COLOR", "defaultProps", "import_core", "import_engine", "uniformBlock", "DEFAULT_COLOR", "defaultProps", "import_core", "import_shadertools", "import_engine", "import_core", "import_engine", "uniformBlock", "DEFAULT_COLOR", "defaultProps", "import_core", "import_engine", "defaultProps", "import_core", "import_engine", "import_core", "import_polygon", "uniformBlock", "DEFAULT_COLOR", "defaultProps", "import_core", "import_core", "import_engine", "import_shadertools", "import_polygon", "earcut", "import_core", "import_polygon", "isCut", "uniformBlock", "DEFAULT_COLOR", "defaultProps", "ATTRIBUTE_TRANSITION", "defaultProps", "import_core", "import_core", "import_core", "uniformBlock", "DEFAULT_BUFFER", "defaultProps", "import_core", "import_core", "nextPowOfTwo", "buildMapping", "char", "buildMapping", "TinySDF", "import_core", "import_engine", "uniformBlock", "defaultProps", "DEFAULT_COLOR", "defaultProps", "import_core", "defaultProps"] }