@deck.gl/aggregation-layers 9.3.0-alpha.2 → 9.3.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.d.ts +3 -1
- package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.d.ts.map +1 -1
- package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.js +3 -2
- package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.js.map +1 -1
- package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.d.ts +1 -1
- package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.js +1 -1
- package/dist/contour-layer/bin-options-uniforms.d.ts +1 -1
- package/dist/contour-layer/bin-options-uniforms.js +1 -1
- package/dist/dist.dev.js +15 -14
- package/dist/grid-layer/bin-options-uniforms.d.ts +1 -1
- package/dist/grid-layer/bin-options-uniforms.js +1 -1
- package/dist/grid-layer/grid-layer-uniforms.d.ts +1 -1
- package/dist/grid-layer/grid-layer-uniforms.js +1 -1
- package/dist/heatmap-layer/heatmap-layer-uniforms.d.ts +2 -2
- package/dist/heatmap-layer/heatmap-layer-uniforms.js +2 -2
- package/dist/heatmap-layer/triangle-layer-uniforms.d.ts +2 -2
- package/dist/heatmap-layer/triangle-layer-uniforms.js +1 -1
- package/dist/hexagon-layer/bin-options-uniforms.d.ts +1 -1
- package/dist/hexagon-layer/bin-options-uniforms.js +1 -1
- package/dist/hexagon-layer/hexagon-layer-uniforms.d.ts +1 -1
- package/dist/hexagon-layer/hexagon-layer-uniforms.js +1 -1
- package/dist/index.cjs +15 -14
- package/dist/index.cjs.map +2 -2
- package/dist/screen-grid-layer/bin-options-uniforms.d.ts +1 -1
- package/dist/screen-grid-layer/bin-options-uniforms.js +1 -1
- package/dist/screen-grid-layer/screen-grid-layer-uniforms.d.ts +1 -1
- package/dist/screen-grid-layer/screen-grid-layer-uniforms.js +1 -1
- package/dist/screen-grid-layer/screen-grid-layer.js +1 -1
- package/dist.min.js +14 -14
- package/package.json +7 -8
- package/src/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.ts +4 -2
- package/src/common/aggregator/gpu-aggregator/bin-sorter-uniforms.ts +1 -1
- package/src/contour-layer/bin-options-uniforms.ts +1 -1
- package/src/grid-layer/bin-options-uniforms.ts +1 -1
- package/src/grid-layer/grid-layer-uniforms.ts +1 -1
- package/src/heatmap-layer/heatmap-layer-uniforms.ts +2 -2
- package/src/heatmap-layer/triangle-layer-uniforms.ts +1 -1
- package/src/hexagon-layer/bin-options-uniforms.ts +1 -1
- package/src/hexagon-layer/hexagon-layer-uniforms.ts +1 -1
- package/src/screen-grid-layer/bin-options-uniforms.ts +1 -1
- package/src/screen-grid-layer/screen-grid-layer-uniforms.ts +1 -1
- package/src/screen-grid-layer/screen-grid-layer.ts +1 -1
|
@@ -3,7 +3,7 @@ export type BinOptions = {
|
|
|
3
3
|
};
|
|
4
4
|
export declare const binOptionsUniforms: {
|
|
5
5
|
readonly name: "binOptions";
|
|
6
|
-
readonly vs: "uniform binOptionsUniforms {\n float cellSizePixels;\n} binOptions;\n";
|
|
6
|
+
readonly vs: "layout(std140) uniform binOptionsUniforms {\n float cellSizePixels;\n} binOptions;\n";
|
|
7
7
|
readonly uniformTypes: {
|
|
8
8
|
readonly cellSizePixels: "f32";
|
|
9
9
|
};
|
|
@@ -7,7 +7,7 @@ export type ScreenGridProps = {
|
|
|
7
7
|
};
|
|
8
8
|
export declare const screenGridUniforms: {
|
|
9
9
|
readonly name: "screenGrid";
|
|
10
|
-
readonly vs: "uniform screenGridUniforms {\n vec2 cellSizeClipspace;\n vec2 gridSizeClipspace;\n vec2 colorDomain;\n} screenGrid;\n";
|
|
10
|
+
readonly vs: "layout(std140) uniform screenGridUniforms {\n vec2 cellSizeClipspace;\n vec2 gridSizeClipspace;\n vec2 colorDomain;\n} screenGrid;\n";
|
|
11
11
|
readonly uniformTypes: {
|
|
12
12
|
readonly cellSizeClipspace: "vec2<f32>";
|
|
13
13
|
readonly gridSizeClipspace: "vec2<f32>";
|
|
@@ -57,7 +57,7 @@ class ScreenGridLayer extends AggregationLayer {
|
|
|
57
57
|
|
|
58
58
|
void getBin(out ivec2 binId) {
|
|
59
59
|
vec4 pos = project_position_to_clipspace(positions, positions64Low, vec3(0.0));
|
|
60
|
-
vec2 screenCoords = vec2(pos.x / pos.w + 1.0, 1.0 - pos.y / pos.w) / 2.0 * project.viewportSize / project.devicePixelRatio;
|
|
60
|
+
vec2 screenCoords = vec2(pos.x / pos.w + 1.0, 1.0 - pos.y / pos.w) / 2.0 * project.viewportSize.xy / project.devicePixelRatio;
|
|
61
61
|
vec2 gridCoords = floor(screenCoords / binOptions.cellSizePixels);
|
|
62
62
|
binId = ivec2(gridCoords);
|
|
63
63
|
}
|
package/dist.min.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
else if (typeof define === 'function' && define.amd) define([], factory);
|
|
5
5
|
else if (typeof exports === 'object') exports['deck'] = factory();
|
|
6
6
|
else root['deck'] = factory();})(globalThis, function () {
|
|
7
|
-
"use strict";var __exports__=(()=>{var Lo=Object.create;var Et=Object.defineProperty;var Po=Object.getOwnPropertyDescriptor;var wo=Object.getOwnPropertyNames;var No=Object.getPrototypeOf,Oo=Object.prototype.hasOwnProperty;var ee=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),Ro=(n,t)=>{for(var e in t)Et(n,e,{get:t[e],enumerable:!0})},bt=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of wo(t))!Oo.call(n,r)&&r!==e&&Et(n,r,{get:()=>t[r],enumerable:!(o=Po(t,r))||o.enumerable});return n},j=(n,t,e)=>(bt(n,t,"default"),e&&bt(e,t,"default")),L=(n,t,e)=>(e=n!=null?Lo(No(n)):{},bt(t||!n||!n.__esModule?Et(e,"default",{value:n,enumerable:!0}):e,n)),_o=n=>bt(Et({},"__esModule",{value:!0}),n);var Z=ee((zr,ue)=>{ue.exports=globalThis.deck});var I=ee((Fr,xe)=>{xe.exports=globalThis.deck});var X=ee((jr,be)=>{be.exports=globalThis.luma});var Ct={};Ro(Ct,{CPUAggregator:()=>O,ContourLayer:()=>Jn,GridLayer:()=>so,HeatmapLayer:()=>To,HexagonLayer:()=>Xe,ScreenGridLayer:()=>We,WebGLAggregator:()=>P,_AggregationLayer:()=>U});var B={},me=L(Z(),1);j(B,L(Z(),1));if(!me.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");j(Ct,B);var Fe=L(I(),1);var Ce=L(I(),1);function ve({pointCount:n,getBinId:t}){let e=new Map;for(let o=0;o<n;o++){let r=t(o);if(r===null)continue;let i=e.get(String(r));i?i.points.push(o):(i={id:r,index:e.size,points:[o]},e.set(String(r),i))}return Array.from(e.values())}function Me({bins:n,dimensions:t,target:e}){let o=n.length*t;(!e||e.length<o)&&(e=new Float32Array(o));for(let r=0;r<n.length;r++){let{id:i}=n[r];Array.isArray(i)?e.set(i,r*t):e[r]=i}return e}var zo=n=>n.length,ye=(n,t)=>{let e=0;for(let o of n)e+=t(o);return e},Io=(n,t)=>n.length===0?NaN:ye(n,t)/n.length,Fo=(n,t)=>{let e=1/0;for(let o of n){let r=t(o);r<e&&(e=r)}return e},Wo=(n,t)=>{let e=-1/0;for(let o of n){let r=t(o);r>e&&(e=r)}return e},Se={COUNT:zo,SUM:ye,MEAN:Io,MIN:Fo,MAX:Wo};function Ae({bins:n,getValue:t,operation:e,target:o}){(!o||o.length<n.length)&&(o=new Float32Array(n.length));let r=1/0,i=-1/0;for(let s=0;s<n.length;s++){let{points:a}=n[s];o[s]=e(a,t),o[s]<r&&(r=o[s]),o[s]>i&&(i=o[s])}return{value:o,domain:[r,i]}}function ne(n,t,e){let o={};for(let i of n.sources||[]){let s=t[i];if(s)o[i]=Do(s);else throw new Error(`Cannot find attribute ${i}`)}let r={};return i=>{for(let s in o)r[s]=o[s](i);return n.getValue(r,i,e)}}function Do(n){let t=n.value,{offset:e=0,stride:o,size:r}=n.getAccessor(),i=t.BYTES_PER_ELEMENT,s=e/i,a=o?o/i:r;if(r===1)return n.isConstant?()=>t[0]:g=>{let h=s+a*g;return t[h]};let c;return n.isConstant?(c=Array.from(t),()=>c):(c=new Array(r),g=>{let h=s+a*g;for(let f=0;f<r;f++)c[f]=t[h+f];return c})}var O=class{constructor(t){this.bins=[],this.binIds=null,this.results=[],this.dimensions=t.dimensions,this.channelCount=t.getValue.length,this.props={...t,binOptions:{},pointCount:0,operations:[],customOperations:[],attributes:{}},this.needsUpdate=!0,this.setProps(t)}destroy(){}get binCount(){return this.bins.length}setProps(t){let e=this.props;if(t.binOptions&&((0,Ce._deepEqual)(t.binOptions,e.binOptions,2)||this.setNeedsUpdate()),t.operations)for(let o=0;o<this.channelCount;o++)t.operations[o]!==e.operations[o]&&this.setNeedsUpdate(o);if(t.customOperations)for(let o=0;o<this.channelCount;o++)Boolean(t.customOperations[o])!==Boolean(e.customOperations[o])&&this.setNeedsUpdate(o);t.pointCount!==void 0&&t.pointCount!==e.pointCount&&this.setNeedsUpdate(),t.attributes&&(t.attributes={...e.attributes,...t.attributes}),Object.assign(this.props,t)}setNeedsUpdate(t){t===void 0?this.needsUpdate=!0:this.needsUpdate!==!0&&(this.needsUpdate=this.needsUpdate||[],this.needsUpdate[t]=!0)}update(){if(this.needsUpdate===!0){this.bins=ve({pointCount:this.props.pointCount,getBinId:ne(this.props.getBin,this.props.attributes,this.props.binOptions)});let t=Me({bins:this.bins,dimensions:this.dimensions,target:this.binIds?.value});this.binIds={value:t,type:"float32",size:this.dimensions}}for(let t=0;t<this.channelCount;t++)if(this.needsUpdate===!0||this.needsUpdate[t]){let e=this.props.customOperations[t]||Se[this.props.operations[t]],{value:o,domain:r}=Ae({bins:this.bins,getValue:ne(this.props.getValue[t],this.props.attributes,void 0),operation:e,target:this.results[t]?.value});this.results[t]={value:o,domain:r,type:"float32",size:1},this.props.onUpdate?.({channel:t})}this.needsUpdate=!1}preDraw(){}getBins(){return this.binIds}getResult(t){return this.results[t]}getResultDomain(t){return this.results[t]?.domain??[1/0,-1/0]}getBin(t){let e=this.bins[t];if(!e)return null;let o=new Array(this.channelCount);for(let r=0;r<o.length;r++){let i=this.results[r];o[r]=i?.value[t]}return{id:e.id,value:o,count:e.points.length,pointIndices:e.points}}};var Le=L(X(),1);function Tt(n,t,e){return n.createFramebuffer({width:t,height:e,colorAttachments:[n.createTexture({width:t,height:e,format:"rgba32float",sampler:{minFilter:"nearest",magFilter:"nearest"}})]})}var Vo=`uniform binSorterUniforms {
|
|
7
|
+
"use strict";var __exports__=(()=>{var Lo=Object.create;var Et=Object.defineProperty;var Po=Object.getOwnPropertyDescriptor;var wo=Object.getOwnPropertyNames;var No=Object.getPrototypeOf,Oo=Object.prototype.hasOwnProperty;var ee=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),Ro=(n,t)=>{for(var e in t)Et(n,e,{get:t[e],enumerable:!0})},bt=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of wo(t))!Oo.call(n,r)&&r!==e&&Et(n,r,{get:()=>t[r],enumerable:!(o=Po(t,r))||o.enumerable});return n},j=(n,t,e)=>(bt(n,t,"default"),e&&bt(e,t,"default")),L=(n,t,e)=>(e=n!=null?Lo(No(n)):{},bt(t||!n||!n.__esModule?Et(e,"default",{value:n,enumerable:!0}):e,n)),_o=n=>bt(Et({},"__esModule",{value:!0}),n);var Z=ee((zr,ue)=>{ue.exports=globalThis.deck});var I=ee((Fr,xe)=>{xe.exports=globalThis.deck});var X=ee((jr,be)=>{be.exports=globalThis.luma});var Ct={};Ro(Ct,{CPUAggregator:()=>O,ContourLayer:()=>Jn,GridLayer:()=>so,HeatmapLayer:()=>To,HexagonLayer:()=>Xe,ScreenGridLayer:()=>We,WebGLAggregator:()=>P,_AggregationLayer:()=>U});var B={},me=L(Z(),1);j(B,L(Z(),1));if(!me.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");j(Ct,B);var Fe=L(I(),1);var Ce=L(I(),1);function ve({pointCount:n,getBinId:t}){let e=new Map;for(let o=0;o<n;o++){let r=t(o);if(r===null)continue;let i=e.get(String(r));i?i.points.push(o):(i={id:r,index:e.size,points:[o]},e.set(String(r),i))}return Array.from(e.values())}function Me({bins:n,dimensions:t,target:e}){let o=n.length*t;(!e||e.length<o)&&(e=new Float32Array(o));for(let r=0;r<n.length;r++){let{id:i}=n[r];Array.isArray(i)?e.set(i,r*t):e[r]=i}return e}var zo=n=>n.length,ye=(n,t)=>{let e=0;for(let o of n)e+=t(o);return e},Io=(n,t)=>n.length===0?NaN:ye(n,t)/n.length,Fo=(n,t)=>{let e=1/0;for(let o of n){let r=t(o);r<e&&(e=r)}return e},Wo=(n,t)=>{let e=-1/0;for(let o of n){let r=t(o);r>e&&(e=r)}return e},Se={COUNT:zo,SUM:ye,MEAN:Io,MIN:Fo,MAX:Wo};function Ae({bins:n,getValue:t,operation:e,target:o}){(!o||o.length<n.length)&&(o=new Float32Array(n.length));let r=1/0,i=-1/0;for(let s=0;s<n.length;s++){let{points:a}=n[s];o[s]=e(a,t),o[s]<r&&(r=o[s]),o[s]>i&&(i=o[s])}return{value:o,domain:[r,i]}}function ne(n,t,e){let o={};for(let i of n.sources||[]){let s=t[i];if(s)o[i]=Do(s);else throw new Error(`Cannot find attribute ${i}`)}let r={};return i=>{for(let s in o)r[s]=o[s](i);return n.getValue(r,i,e)}}function Do(n){let t=n.value,{offset:e=0,stride:o,size:r}=n.getAccessor(),i=t.BYTES_PER_ELEMENT,s=e/i,a=o?o/i:r;if(r===1)return n.isConstant?()=>t[0]:g=>{let h=s+a*g;return t[h]};let c;return n.isConstant?(c=Array.from(t),()=>c):(c=new Array(r),g=>{let h=s+a*g;for(let f=0;f<r;f++)c[f]=t[h+f];return c})}var O=class{constructor(t){this.bins=[],this.binIds=null,this.results=[],this.dimensions=t.dimensions,this.channelCount=t.getValue.length,this.props={...t,binOptions:{},pointCount:0,operations:[],customOperations:[],attributes:{}},this.needsUpdate=!0,this.setProps(t)}destroy(){}get binCount(){return this.bins.length}setProps(t){let e=this.props;if(t.binOptions&&((0,Ce._deepEqual)(t.binOptions,e.binOptions,2)||this.setNeedsUpdate()),t.operations)for(let o=0;o<this.channelCount;o++)t.operations[o]!==e.operations[o]&&this.setNeedsUpdate(o);if(t.customOperations)for(let o=0;o<this.channelCount;o++)Boolean(t.customOperations[o])!==Boolean(e.customOperations[o])&&this.setNeedsUpdate(o);t.pointCount!==void 0&&t.pointCount!==e.pointCount&&this.setNeedsUpdate(),t.attributes&&(t.attributes={...e.attributes,...t.attributes}),Object.assign(this.props,t)}setNeedsUpdate(t){t===void 0?this.needsUpdate=!0:this.needsUpdate!==!0&&(this.needsUpdate=this.needsUpdate||[],this.needsUpdate[t]=!0)}update(){if(this.needsUpdate===!0){this.bins=ve({pointCount:this.props.pointCount,getBinId:ne(this.props.getBin,this.props.attributes,this.props.binOptions)});let t=Me({bins:this.bins,dimensions:this.dimensions,target:this.binIds?.value});this.binIds={value:t,type:"float32",size:this.dimensions}}for(let t=0;t<this.channelCount;t++)if(this.needsUpdate===!0||this.needsUpdate[t]){let e=this.props.customOperations[t]||Se[this.props.operations[t]],{value:o,domain:r}=Ae({bins:this.bins,getValue:ne(this.props.getValue[t],this.props.attributes,void 0),operation:e,target:this.results[t]?.value});this.results[t]={value:o,domain:r,type:"float32",size:1},this.props.onUpdate?.({channel:t})}this.needsUpdate=!1}preDraw(){}getBins(){return this.binIds}getResult(t){return this.results[t]}getResultDomain(t){return this.results[t]?.domain??[1/0,-1/0]}getBin(t){let e=this.bins[t];if(!e)return null;let o=new Array(this.channelCount);for(let r=0;r<o.length;r++){let i=this.results[r];o[r]=i?.value[t]}return{id:e.id,value:o,count:e.points.length,pointIndices:e.points}}};var Le=L(X(),1);function Tt(n,t,e){return n.createFramebuffer({width:t,height:e,colorAttachments:[n.createTexture({width:t,height:e,format:"rgba32float",sampler:{minFilter:"nearest",magFilter:"nearest"}})]})}var Vo=`layout(std140) uniform binSorterUniforms {
|
|
8
8
|
ivec4 binIdRange;
|
|
9
9
|
ivec2 targetSize;
|
|
10
10
|
} binSorter;
|
|
@@ -65,13 +65,13 @@ void main() {
|
|
|
65
65
|
|
|
66
66
|
fragColor.w = 1.0;
|
|
67
67
|
}
|
|
68
|
-
`;return new Le.Model(n,{bufferLayout:t.bufferLayout,modules:[...t.modules||[],Ee],defines:{...t.defines,NON_INSTANCED_MODEL:1,NUM_CHANNELS:t.channelCount},isInstanced:!1,vs:o,fs:r,topology:"point-list",disableWarnings:!0})}var Ne=L(X(),1);var ko=`uniform aggregatorTransformUniforms {
|
|
68
|
+
`;return new Le.Model(n,{bufferLayout:t.bufferLayout,modules:[...t.modules||[],Ee],defines:{...t.defines,NON_INSTANCED_MODEL:1,NUM_CHANNELS:t.channelCount},isInstanced:!1,vs:o,fs:r,topology:"point-list",disableWarnings:!0})}var Ne=L(X(),1);var ko=`layout(std140) uniform aggregatorTransformUniforms {
|
|
69
69
|
ivec4 binIdRange;
|
|
70
70
|
bvec3 isCount;
|
|
71
71
|
bvec3 isMean;
|
|
72
72
|
float naN;
|
|
73
73
|
} aggregatorTransform;
|
|
74
|
-
`,we={name:"aggregatorTransform",vs:ko,uniformTypes:{binIdRange:"vec4<i32>",isCount:"vec3<f32>",isMean:"vec3<f32>"}};var oe=3e38,Pt=class{constructor(t,e){this.binBuffer=null,this.valueBuffer=null,this._domains=null,this.device=t,this.channelCount=e.channelCount,this.transform=jo(t,e),this.domainFBO=Tt(t,2,1)}destroy(){this.transform.destroy(),this.binBuffer?.destroy(),this.valueBuffer?.destroy(),this.domainFBO.colorAttachments[0].texture.destroy(),this.domainFBO.destroy()}get domains(){if(!this._domains){let t=this.device.readPixelsToArrayWebGL(this.domainFBO).buffer,e=new Float32Array(t);this._domains=[[-e[4],e[0]],[-e[5],e[1]],[-e[6],e[2]]].slice(0,this.channelCount)}return this._domains}setDimensions(t,e){let{model:o,transformFeedback:r}=this.transform;o.setVertexCount(t);let i={binIdRange:[e[0][0],e[0][1],e[1]?.[0]||0,e[1]?.[1]||0]};o.shaderInputs.setProps({aggregatorTransform:i});let s=t*e.length*4;(!this.binBuffer||this.binBuffer.byteLength<s)&&(this.binBuffer?.destroy(),this.binBuffer=this.device.createBuffer({byteLength:s}),r.setBuffer("binIds",this.binBuffer));let a=t*this.channelCount*4;(!this.valueBuffer||this.valueBuffer.byteLength<a)&&(this.valueBuffer?.destroy(),this.valueBuffer=this.device.createBuffer({byteLength:a}),r.setBuffer("values",this.valueBuffer))}update(t,e){if(!t)return;let o=this.transform,r=this.domainFBO,i=[0,1,2].map(c=>e[c]==="COUNT"?1:0),s=[0,1,2].map(c=>e[c]==="MEAN"?1:0),a={isCount:i,isMean:s,bins:t};o.model.shaderInputs.setProps({aggregatorTransform:a}),o.run({id:"gpu-aggregation-domain",framebuffer:r,parameters:{viewport:[0,0,2,1]},clearColor:[-oe,-oe,-oe,0],clearDepth:!1,clearStencil:!1}),this._domains=null}};function jo(n,t){let e=`#version 300 es
|
|
74
|
+
`,we={name:"aggregatorTransform",vs:ko,uniformTypes:{binIdRange:"vec4<i32>",isCount:"vec3<f32>",isMean:"vec3<f32>",naN:"f32"}};var oe=3e38,Pt=class{constructor(t,e){this.binBuffer=null,this.valueBuffer=null,this._domains=null,this.device=t,this.channelCount=e.channelCount,this.transform=jo(t,e),this.domainFBO=Tt(t,2,1)}destroy(){this.transform.destroy(),this.binBuffer?.destroy(),this.valueBuffer?.destroy(),this.domainFBO.colorAttachments[0].texture.destroy(),this.domainFBO.destroy()}get domains(){if(!this._domains){let t=this.device.readPixelsToArrayWebGL(this.domainFBO).buffer,e=new Float32Array(t);this._domains=[[-e[4],e[0]],[-e[5],e[1]],[-e[6],e[2]]].slice(0,this.channelCount)}return this._domains}setDimensions(t,e){let{model:o,transformFeedback:r}=this.transform;o.setVertexCount(t);let i={binIdRange:[e[0][0],e[0][1],e[1]?.[0]||0,e[1]?.[1]||0]};o.shaderInputs.setProps({aggregatorTransform:i});let s=t*e.length*4;(!this.binBuffer||this.binBuffer.byteLength<s)&&(this.binBuffer?.destroy(),this.binBuffer=this.device.createBuffer({byteLength:s}),r.setBuffer("binIds",this.binBuffer));let a=t*this.channelCount*4;(!this.valueBuffer||this.valueBuffer.byteLength<a)&&(this.valueBuffer?.destroy(),this.valueBuffer=this.device.createBuffer({byteLength:a}),r.setBuffer("values",this.valueBuffer))}update(t,e){if(!t)return;let o=this.transform,r=this.domainFBO,i=[0,1,2].map(c=>e[c]==="COUNT"?1:0),s=[0,1,2].map(c=>e[c]==="MEAN"?1:0),a={isCount:i,isMean:s,bins:t};o.model.shaderInputs.setProps({aggregatorTransform:a}),o.run({id:"gpu-aggregation-domain",framebuffer:r,parameters:{viewport:[0,0,2,1]},clearColor:[-oe,-oe,-oe,0],clearDepth:!1,clearStencil:!1}),this._domains=null}};function jo(n,t){let e=`#version 300 es
|
|
75
75
|
#define SHADER_NAME gpu-aggregation-domain-vertex
|
|
76
76
|
|
|
77
77
|
uniform sampler2D bins;
|
|
@@ -196,12 +196,12 @@ void main(void) {
|
|
|
196
196
|
fragColor = vColor;
|
|
197
197
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
198
198
|
}
|
|
199
|
-
`;var Go=`uniform screenGridUniforms {
|
|
199
|
+
`;var Go=`layout(std140) uniform screenGridUniforms {
|
|
200
200
|
vec2 cellSizeClipspace;
|
|
201
201
|
vec2 gridSizeClipspace;
|
|
202
202
|
vec2 colorDomain;
|
|
203
203
|
} screenGrid;
|
|
204
|
-
`,_e={name:"screenGrid",vs:Go,uniformTypes:{cellSizeClipspace:"vec2<f32>",gridSizeClipspace:"vec2<f32>",colorDomain:"vec2<f32>"}};var Rt=class extends zt.Layer{getShaders(){return super.getShaders({vs:Oe,fs:Re,modules:[zt.picking,_e]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:2,type:"float32",accessor:"getBin"},instanceWeights:{size:1,type:"float32",accessor:"getWeight"}}),this.state.model=this._getModel()}updateState(t){super.updateState(t);let{props:e,oldProps:o,changeFlags:r}=t,i=this.state.model;if(o.colorRange!==e.colorRange){this.state.colorTexture?.destroy(),this.state.colorTexture=J(this.context.device,e.colorRange,e.colorScaleType);let s={colorRange:this.state.colorTexture};i.shaderInputs.setProps({screenGrid:s})}else o.colorScaleType!==e.colorScaleType&&Q(this.state.colorTexture,e.colorScaleType);if(o.cellMarginPixels!==e.cellMarginPixels||o.cellSizePixels!==e.cellSizePixels||r.viewportChanged){let{width:s,height:a}=this.context.viewport,{cellSizePixels:c,cellMarginPixels:g}=this.props,h=Math.max(c-g,0),f={gridSizeClipspace:[c/s*2,c/a*2],cellSizeClipspace:[h/s*2,h/a*2]};i.shaderInputs.setProps({screenGrid:f})}}finalizeState(t){super.finalizeState(t),this.state.colorTexture?.destroy()}draw({uniforms:t}){let e=this.props.colorDomain(),o=this.state.model,r={colorDomain:e};o.shaderInputs.setProps({screenGrid:r}),o.draw(this.context.renderPass)}_getModel(){return new _t.Model(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new _t.Geometry({topology:"triangle-strip",attributes:{positions:{value:new Float32Array([0,0,1,0,0,1,1,1]),size:2}}}),isInstanced:!0})}};Rt.layerName="ScreenGridCellLayer";var ze=Rt;var qo=`uniform binOptionsUniforms {
|
|
204
|
+
`,_e={name:"screenGrid",vs:Go,uniformTypes:{cellSizeClipspace:"vec2<f32>",gridSizeClipspace:"vec2<f32>",colorDomain:"vec2<f32>"}};var Rt=class extends zt.Layer{getShaders(){return super.getShaders({vs:Oe,fs:Re,modules:[zt.picking,_e]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:2,type:"float32",accessor:"getBin"},instanceWeights:{size:1,type:"float32",accessor:"getWeight"}}),this.state.model=this._getModel()}updateState(t){super.updateState(t);let{props:e,oldProps:o,changeFlags:r}=t,i=this.state.model;if(o.colorRange!==e.colorRange){this.state.colorTexture?.destroy(),this.state.colorTexture=J(this.context.device,e.colorRange,e.colorScaleType);let s={colorRange:this.state.colorTexture};i.shaderInputs.setProps({screenGrid:s})}else o.colorScaleType!==e.colorScaleType&&Q(this.state.colorTexture,e.colorScaleType);if(o.cellMarginPixels!==e.cellMarginPixels||o.cellSizePixels!==e.cellSizePixels||r.viewportChanged){let{width:s,height:a}=this.context.viewport,{cellSizePixels:c,cellMarginPixels:g}=this.props,h=Math.max(c-g,0),f={gridSizeClipspace:[c/s*2,c/a*2],cellSizeClipspace:[h/s*2,h/a*2]};i.shaderInputs.setProps({screenGrid:f})}}finalizeState(t){super.finalizeState(t),this.state.colorTexture?.destroy()}draw({uniforms:t}){let e=this.props.colorDomain(),o=this.state.model,r={colorDomain:e};o.shaderInputs.setProps({screenGrid:r}),o.draw(this.context.renderPass)}_getModel(){return new _t.Model(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new _t.Geometry({topology:"triangle-strip",attributes:{positions:{value:new Float32Array([0,0,1,0,0,1,1,1]),size:2}}}),isInstanced:!0})}};Rt.layerName="ScreenGridCellLayer";var ze=Rt;var qo=`layout(std140) uniform binOptionsUniforms {
|
|
205
205
|
float cellSizePixels;
|
|
206
206
|
} binOptions;
|
|
207
207
|
`,Ie={name:"binOptions",vs:qo,uniformTypes:{cellSizePixels:"f32"}};var Yo={cellSizePixels:{type:"number",value:100,min:1},cellMarginPixels:{type:"number",value:2,min:0},colorRange:G,colorScaleType:"linear",getPosition:{type:"accessor",value:n=>n.position},getWeight:{type:"accessor",value:1},gpuAggregation:!0,aggregation:"SUM"},mt=class extends U{getAggregatorType(){return this.props.gpuAggregation&&P.isSupported(this.context.device)?"gpu":"cpu"}createAggregator(t){return t==="cpu"||!P.isSupported(this.context.device)?new O({dimensions:2,getBin:{sources:["positions"],getValue:({positions:e},o,r)=>{let i=this.context.viewport,s=i.project(e),a=r.cellSizePixels;return s[0]<0||s[0]>=i.width||s[1]<0||s[1]>=i.height?null:[Math.floor(s[0]/a),Math.floor(s[1]/a)]}},getValue:[{sources:["counts"],getValue:({counts:e})=>e}]}):new P(this.context.device,{dimensions:2,channelCount:1,bufferLayout:this.getAttributeManager().getBufferLayouts({isInstanced:!1}),...super.getShaders({modules:[Fe.project32,Ie],vs:`
|
|
@@ -211,7 +211,7 @@ DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
|
211
211
|
|
|
212
212
|
void getBin(out ivec2 binId) {
|
|
213
213
|
vec4 pos = project_position_to_clipspace(positions, positions64Low, vec3(0.0));
|
|
214
|
-
vec2 screenCoords = vec2(pos.x / pos.w + 1.0, 1.0 - pos.y / pos.w) / 2.0 * project.viewportSize / project.devicePixelRatio;
|
|
214
|
+
vec2 screenCoords = vec2(pos.x / pos.w + 1.0, 1.0 - pos.y / pos.w) / 2.0 * project.viewportSize.xy / project.devicePixelRatio;
|
|
215
215
|
vec2 gridCoords = floor(screenCoords / binOptions.cellSizePixels);
|
|
216
216
|
binId = ivec2(gridCoords);
|
|
217
217
|
}
|
|
@@ -296,13 +296,13 @@ vColor.rgb = lighting_getLightColor(vColor.rgb, project.cameraPosition, geometry
|
|
|
296
296
|
}
|
|
297
297
|
DECKGL_FILTER_COLOR(vColor, geometry);
|
|
298
298
|
}
|
|
299
|
-
`;var Jo=`uniform hexagonUniforms {
|
|
299
|
+
`;var Jo=`layout(std140) uniform hexagonUniforms {
|
|
300
300
|
vec4 colorDomain;
|
|
301
301
|
vec4 elevationDomain;
|
|
302
302
|
vec2 elevationRange;
|
|
303
303
|
vec2 originCommon;
|
|
304
304
|
} hexagon;
|
|
305
|
-
`,je={name:"hexagon",vs:Jo,uniformTypes:{colorDomain:"vec4<f32>",elevationDomain:"vec4<f32>",elevationRange:"vec2<f32>",originCommon:"vec2<f32>"}};var Dt=class extends Ge.ColumnLayer{getShaders(){let t=super.getShaders();return t.modules.push(je),{...t,vs:ke}}initializeState(){super.initializeState();let t=this.getAttributeManager();t.remove(["instanceElevations","instanceFillColors","instanceLineColors","instanceStrokeWidths"]),t.addInstanced({instancePositions:{size:2,type:"float32",accessor:"getBin"},instanceColorValues:{size:1,type:"float32",accessor:"getColorValue"},instanceElevationValues:{size:1,type:"float32",accessor:"getElevationValue"}})}updateState(t){super.updateState(t);let{props:e,oldProps:o}=t,r=this.state.fillModel;if(o.colorRange!==e.colorRange){this.state.colorTexture?.destroy(),this.state.colorTexture=J(this.context.device,e.colorRange,e.colorScaleType);let i={colorRange:this.state.colorTexture};r.shaderInputs.setProps({hexagon:i})}else o.colorScaleType!==e.colorScaleType&&Q(this.state.colorTexture,e.colorScaleType)}finalizeState(t){super.finalizeState(t),this.state.colorTexture?.destroy()}draw({uniforms:t}){let{radius:e,hexOriginCommon:o,elevationRange:r,elevationScale:i,extruded:s,coverage:a,colorDomain:c,elevationDomain:g}=this.props,h=this.props.colorCutoff||[-1/0,1/0],f=this.props.elevationCutoff||[-1/0,1/0],p=this.state.fillModel;p.vertexArray.indexBuffer&&p.setIndexBuffer(null),p.setVertexCount(this.state.fillVertexCount);let d={colorDomain:[Math.max(c[0],h[0]),Math.min(c[1],h[1]),Math.max(c[0]-1,h[0]),Math.min(c[1]+1,h[1])],elevationDomain:[Math.max(g[0],f[0]),Math.min(g[1],f[1]),Math.max(g[0]-1,f[0]),Math.min(g[1]+1,f[1])],elevationRange:[r[0]*i,r[1]*i],originCommon:o};p.shaderInputs.setProps({column:{extruded:s,coverage:a,radius:e},hexagon:d}),p.draw(this.context.renderPass)}};Dt.layerName="HexagonCellLayer";var qe=Dt;var tr=`uniform binOptionsUniforms {
|
|
305
|
+
`,je={name:"hexagon",vs:Jo,uniformTypes:{colorDomain:"vec4<f32>",elevationDomain:"vec4<f32>",elevationRange:"vec2<f32>",originCommon:"vec2<f32>"}};var Dt=class extends Ge.ColumnLayer{getShaders(){let t=super.getShaders();return t.modules.push(je),{...t,vs:ke}}initializeState(){super.initializeState();let t=this.getAttributeManager();t.remove(["instanceElevations","instanceFillColors","instanceLineColors","instanceStrokeWidths"]),t.addInstanced({instancePositions:{size:2,type:"float32",accessor:"getBin"},instanceColorValues:{size:1,type:"float32",accessor:"getColorValue"},instanceElevationValues:{size:1,type:"float32",accessor:"getElevationValue"}})}updateState(t){super.updateState(t);let{props:e,oldProps:o}=t,r=this.state.fillModel;if(o.colorRange!==e.colorRange){this.state.colorTexture?.destroy(),this.state.colorTexture=J(this.context.device,e.colorRange,e.colorScaleType);let i={colorRange:this.state.colorTexture};r.shaderInputs.setProps({hexagon:i})}else o.colorScaleType!==e.colorScaleType&&Q(this.state.colorTexture,e.colorScaleType)}finalizeState(t){super.finalizeState(t),this.state.colorTexture?.destroy()}draw({uniforms:t}){let{radius:e,hexOriginCommon:o,elevationRange:r,elevationScale:i,extruded:s,coverage:a,colorDomain:c,elevationDomain:g}=this.props,h=this.props.colorCutoff||[-1/0,1/0],f=this.props.elevationCutoff||[-1/0,1/0],p=this.state.fillModel;p.vertexArray.indexBuffer&&p.setIndexBuffer(null),p.setVertexCount(this.state.fillVertexCount);let d={colorDomain:[Math.max(c[0],h[0]),Math.min(c[1],h[1]),Math.max(c[0]-1,h[0]),Math.min(c[1]+1,h[1])],elevationDomain:[Math.max(g[0],f[0]),Math.min(g[1],f[1]),Math.max(g[0]-1,f[0]),Math.min(g[1]+1,f[1])],elevationRange:[r[0]*i,r[1]*i],originCommon:o};p.shaderInputs.setProps({column:{extruded:s,coverage:a,radius:e},hexagon:d}),p.draw(this.context.renderPass)}};Dt.layerName="HexagonCellLayer";var qe=Dt;var tr=`layout(std140) uniform binOptionsUniforms {
|
|
306
306
|
vec2 hexOriginCommon;
|
|
307
307
|
float radiusCommon;
|
|
308
308
|
} binOptions;
|
|
@@ -321,7 +321,7 @@ DECKGL_FILTER_COLOR(vColor, geometry);
|
|
|
321
321
|
void getValue(out vec2 value) {
|
|
322
322
|
value = vec2(colorWeights, elevationWeights);
|
|
323
323
|
}
|
|
324
|
-
`})})}initializeState(){super.initializeState(),this.getAttributeManager().add({positions:{size:3,accessor:"getPosition",type:"float64",fp64:this.use64bitPositions()},colorWeights:{size:1,accessor:"getColorWeight"},elevationWeights:{size:1,accessor:"getElevationWeight"}})}updateState(t){let e=super.updateState(t),{props:o,oldProps:r,changeFlags:i}=t,{aggregator:s}=this.state;if((i.dataChanged||!this.state.dataAsArray)&&(o.getColorValue||o.getElevationValue)&&(this.state.dataAsArray=Array.from((0,Y.createIterable)(o.data).iterable)),e||i.dataChanged||o.radius!==r.radius||o.getColorValue!==r.getColorValue||o.getElevationValue!==r.getElevationValue||o.colorAggregation!==r.colorAggregation||o.elevationAggregation!==r.elevationAggregation){this._updateBinOptions();let{radiusCommon:a,hexOriginCommon:c,binIdRange:g,dataAsArray:h}=this.state;if(s.setProps({binIdRange:g,pointCount:this.getNumInstances(),operations:[o.colorAggregation,o.elevationAggregation],binOptions:{radiusCommon:a,hexOriginCommon:c},onUpdate:this._onAggregationUpdate.bind(this)}),h){let{getColorValue:f,getElevationValue:p}=this.props;s.setProps({customOperations:[f&&(d=>f(d.map(x=>h[x]),{indices:d,data:o.data})),p&&(d=>p(d.map(x=>h[x]),{indices:d,data:o.data}))]})}}return i.updateTriggersChanged&&i.updateTriggersChanged.getColorValue&&s.setNeedsUpdate(0),i.updateTriggersChanged&&i.updateTriggersChanged.getElevationValue&&s.setNeedsUpdate(1),e}_updateBinOptions(){let t=this.getBounds(),e=1,o=[0,0],r=[[0,1],[0,1]],i=this.context.viewport;if(t&&Number.isFinite(t[0][0])){let s=[(t[0][0]+t[1][0])/2,(t[0][1]+t[1][1])/2],{radius:a}=this.props,{unitsPerMeter:c}=i.getDistanceScales(s);e=c[0]*a;let g=Wt(i.projectFlat(s),e);s=i.unprojectFlat(ie(g,e));let h=i.constructor;i=i.isGeospatial?new h({longitude:s[0],latitude:s[1],zoom:12}):new Y.Viewport({position:[s[0],s[1],0],zoom:12}),o=[Math.fround(i.center[0]),Math.fround(i.center[1])],r=tt({dataBounds:t,getBinId:f=>{let p=i.projectFlat(f);return p[0]-=o[0],p[1]-=o[1],Wt(p,e)},padding:1})}this.setState({radiusCommon:e,hexOriginCommon:o,binIdRange:r,aggregatorViewport:i})}draw(t){t.shaderModuleProps.project&&(t.shaderModuleProps.project.viewport=this.state.aggregatorViewport),super.draw(t)}_onAggregationUpdate({channel:t}){let e=this.getCurrentLayer().props,{aggregator:o}=this.state;if(t===0){let r=o.getResult(0);this.setState({colors:new q(r,o.binCount)}),e.onSetColorDomain(o.getResultDomain(0))}else if(t===1){let r=o.getResult(1);this.setState({elevations:new q(r,o.binCount)}),e.onSetElevationDomain(o.getResultDomain(1))}}onAttributeChange(t){let{aggregator:e}=this.state;switch(t){case"positions":e.setNeedsUpdate(),this._updateBinOptions();let{radiusCommon:o,hexOriginCommon:r,binIdRange:i}=this.state;e.setProps({binIdRange:i,binOptions:{radiusCommon:o,hexOriginCommon:r}});break;case"colorWeights":e.setNeedsUpdate(0);break;case"elevationWeights":e.setNeedsUpdate(1);break;default:}}renderLayers(){let{aggregator:t,radiusCommon:e,hexOriginCommon:o}=this.state,{elevationScale:r,colorRange:i,elevationRange:s,extruded:a,coverage:c,material:g,transitions:h,colorScaleType:f,lowerPercentile:p,upperPercentile:d,colorDomain:x,elevationScaleType:v,elevationLowerPercentile:y,elevationUpperPercentile:b,elevationDomain:E}=this.props,M=this.getSubLayerClass("cells",qe),C=t.getBins(),S=this.state.colors?.update({scaleType:f,lowerPercentile:p,upperPercentile:d}),A=this.state.elevations?.update({scaleType:v,lowerPercentile:y,upperPercentile:b});return!S||!A?null:new M(this.getSubLayerProps({id:"cells"}),{data:{length:t.binCount,attributes:{getBin:C,getColorValue:S.attribute,getElevationValue:A.attribute}},dataComparator:(w,N)=>w.length===N.length,updateTriggers:{getBin:[C],getColorValue:[S.attribute],getElevationValue:[A.attribute]},diskResolution:6,vertices:Be,radius:e,hexOriginCommon:o,elevationScale:r,colorRange:i,colorScaleType:f,elevationRange:s,extruded:a,coverage:c,material:g,colorDomain:S.domain||x||t.getResultDomain(0),elevationDomain:A.domain||E||t.getResultDomain(1),colorCutoff:S.cutoff,elevationCutoff:A.cutoff,transitions:h&&{getFillColor:h.getColorValue||h.getColorWeight,getElevation:h.getElevationValue||h.getElevationWeight},extensions:[]})}getPickingInfo(t){let e=t.info,{index:o}=e;if(o>=0){let r=this.state.aggregator.getBin(o),i;if(r){let s=ie(r.id,this.state.radiusCommon),a=this.context.viewport.unprojectFlat(s);i={col:r.id[0],row:r.id[1],position:a,colorValue:r.value[0],elevationValue:r.value[1],count:r.count},r.pointIndices&&(i.pointIndices=r.pointIndices,i.points=Array.isArray(this.props.data)?r.pointIndices.map(c=>this.props.data[c]):[])}e.object=i}return e}};xt.layerName="HexagonLayer";xt.defaultProps=er;var Xe=xt;var H=L(I(),1),Xt=L(Z(),1);var m=.16666666666666666,l={N:[0,.5],E:[.5,0],S:[0,-.5],W:[-.5,0],NE:[.5,.5],NW:[-.5,.5],SE:[.5,-.5],SW:[-.5,-.5]},et=[l.W,l.SW,l.S],nt=[l.S,l.SE,l.E],ot=[l.E,l.NE,l.N],rt=[l.NW,l.W,l.N],it=[[-.5,m],[-.5,-m],[-m,-.5],[m,-.5]],st=[[-m,-.5],[m,-.5],[.5,-m],[.5,m]],at=[[.5,-m],[.5,m],[m,.5],[-m,.5]],ct=[[-.5,m],[-.5,-m],[m,.5],[-m,.5]],Ke=[l.W,l.SW,l.SE,l.E],Ze=[l.S,l.SE,l.NE,l.N],Qe=[l.NW,l.W,l.E,l.NE],Je=[l.NW,l.SW,l.S,l.N],tn=[[-.5,m],[-.5,-m],[.5,-m],[.5,m]],en=[[-m,-.5],[m,-.5],[m,.5],[-m,.5]],nr=[l.NW,l.SW,l.SE,l.NE],nn=[l.NW,l.SW,l.SE,l.E,l.N],on=[l.W,l.SW,l.SE,l.NE,l.N],rn=[l.NW,l.W,l.S,l.SE,l.NE],sn=[l.NW,l.SW,l.S,l.E,l.NE],an=[l.NW,l.W,[.5,-m],[.5,m],l.N],cn=[[-m,-.5],[m,-.5],l.E,l.NE,l.N],ln=[[-.5,m],[-.5,-m],l.S,l.SE,l.E],gn=[l.W,l.SW,l.S,[m,.5],[-m,.5]],hn=[l.NW,l.W,[-m,-.5],[m,-.5],l.N],pn=[[-.5,m],[-.5,-m],l.E,l.NE,l.N],fn=[l.S,l.SE,l.E,[m,.5],[-m,.5]],dn=[l.W,l.SW,l.S,[.5,-m],[.5,m]],un=[l.W,l.SW,l.SE,l.E,[m,.5],[-m,.5]],mn=[[-.5,m],[-.5,-m],l.S,l.SE,l.NE,l.N],xn=[l.NW,l.W,[-m,-.5],[m,-.5],l.E,l.NE],vn=[l.NW,l.SW,l.S,[.5,-m],[.5,m],l.N],lt=[l.W,l.SW,l.S,l.E,l.NE,l.N],gt=[l.NW,l.W,l.S,l.SE,l.E,l.N],Vt=[[-.5,m],[-.5,-m],[-m,-.5],[m,-.5],l.E,l.NE,l.N],Bt=[l.W,l.SW,l.S,[.5,-m],[.5,m],[m,.5],[-m,.5]],Ut=[l.NW,l.W,[-m,-.5],[m,-.5],[.5,-m],[.5,m],l.N],Ht=[[-.5,m],[-.5,-m],l.S,l.SE,l.E,[m,.5],[-m,.5]],Mn=[[-.5,m],[-.5,-m],[-m,-.5],[m,-.5],[.5,-m],[.5,m],[m,.5],[-m,.5]],yn={0:[],1:[[l.W,l.S]],2:[[l.S,l.E]],3:[[l.W,l.E]],4:[[l.N,l.E]],5:{0:[[l.W,l.S],[l.N,l.E]],1:[[l.W,l.N],[l.S,l.E]]},6:[[l.N,l.S]],7:[[l.W,l.N]],8:[[l.W,l.N]],9:[[l.N,l.S]],10:{0:[[l.W,l.N],[l.S,l.E]],1:[[l.W,l.S],[l.N,l.E]]},11:[[l.N,l.E]],12:[[l.W,l.E]],13:[[l.S,l.E]],14:[[l.W,l.S]],15:[]};function u(n){return parseInt(n,4)}var Sn={[u("0000")]:[],[u("2222")]:[],[u("2221")]:[et],[u("2212")]:[nt],[u("2122")]:[ot],[u("1222")]:[rt],[u("0001")]:[et],[u("0010")]:[nt],[u("0100")]:[ot],[u("1000")]:[rt],[u("2220")]:[it],[u("2202")]:[st],[u("2022")]:[at],[u("0222")]:[ct],[u("0002")]:[it],[u("0020")]:[st],[u("0200")]:[at],[u("2000")]:[ct],[u("0011")]:[Ke],[u("0110")]:[Ze],[u("1100")]:[Qe],[u("1001")]:[Je],[u("2211")]:[Ke],[u("2112")]:[Ze],[u("1122")]:[Qe],[u("1221")]:[Je],[u("2200")]:[tn],[u("2002")]:[en],[u("0022")]:[tn],[u("0220")]:[en],[u("1111")]:[nr],[u("1211")]:[nn],[u("2111")]:[on],[u("1112")]:[rn],[u("1121")]:[sn],[u("1011")]:[nn],[u("0111")]:[on],[u("1110")]:[rn],[u("1101")]:[sn],[u("1200")]:[an],[u("0120")]:[cn],[u("0012")]:[ln],[u("2001")]:[gn],[u("1022")]:[an],[u("2102")]:[cn],[u("2210")]:[ln],[u("0221")]:[gn],[u("1002")]:[hn],[u("2100")]:[pn],[u("0210")]:[fn],[u("0021")]:[dn],[u("1220")]:[hn],[u("0122")]:[pn],[u("2012")]:[fn],[u("2201")]:[dn],[u("0211")]:[un],[u("2110")]:[mn],[u("1102")]:[xn],[u("1021")]:[vn],[u("2011")]:[un],[u("0112")]:[mn],[u("1120")]:[xn],[u("1201")]:[vn],[u("2101")]:[lt],[u("0121")]:[lt],[u("1012")]:[gt],[u("1210")]:[gt],[u("0101")]:{0:[et,ot],1:[lt],2:[lt]},[u("1010")]:{0:[rt,nt],1:[gt],2:[gt]},[u("2121")]:{0:[lt],1:[lt],2:[et,ot]},[u("1212")]:{0:[gt],1:[gt],2:[rt,nt]},[u("2120")]:{0:[Vt],1:[Vt],2:[it,ot]},[u("2021")]:{0:[Bt],1:[Bt],2:[et,at]},[u("1202")]:{0:[Ut],1:[Ut],2:[rt,st]},[u("0212")]:{0:[Ht],1:[Ht],2:[nt,ct]},[u("0102")]:{0:[it,ot],1:[Vt],2:[Vt]},[u("0201")]:{0:[et,at],1:[Bt],2:[Bt]},[u("1020")]:{0:[rt,st],1:[Ut],2:[Ut]},[u("2010")]:{0:[nt,ct],1:[Ht],2:[Ht]},[u("2020")]:{0:[ct,st],1:[Mn],2:[it,at]},[u("0202")]:{0:[at,it],1:[Mn],2:[ct,st]}};function vt(n,t){return Number.isNaN(n)?0:Array.isArray(t)?n<t[0]?0:n<t[1]?1:2:n>=t?1:0}function An(n){let{x:t,y:e,xRange:o,yRange:r,getValue:i,threshold:s}=n,a=t<o[0],c=t>=o[1]-1,g=e<r[0],h=e>=r[1]-1,f=a||c||g||h,p=0,d,x,v,y;if(a||h)v=0;else{let M=i(t,e+1);v=vt(M,s),p+=M}if(c||h)y=0;else{let M=i(t+1,e+1);y=vt(M,s),p+=M}if(c||g)x=0;else{let M=i(t+1,e);x=vt(M,s),p+=M}if(a||g)d=0;else{let M=i(t,e);d=vt(M,s),p+=M}let b=-1;Number.isFinite(s)&&(b=v<<3|y<<2|x<<1|d),Array.isArray(s)&&(b=v<<6|y<<4|x<<2|d);let E=0;return f||(E=vt(p/4,s)),{code:b,meanCode:E}}function Cn(n){let{x:t,y:e,z:o,code:r,meanCode:i}=n,s=Sn[r];Array.isArray(s)||(s=s[i]);let a=t+1,c=e+1,g=[];return s.forEach(h=>{let f=[];h.forEach(p=>{let d=a+p[0],x=c+p[1];f.push([d,x,o])}),g.push(f)}),g}function bn(n){let{x:t,y:e,z:o,code:r,meanCode:i}=n,s=yn[r];Array.isArray(s)||(s=s[i]);let a=t+1,c=e+1,g=[];return s.forEach(h=>{h.forEach(f=>{let p=a+f[0],d=c+f[1];g.push([p,d,o])})}),g}function En({contours:n,getValue:t,xRange:e,yRange:o}){let r=[],i=[],s=0,a=0;for(let c=0;c<n.length;c++){let g=n[c],h=g.zIndex??c,{threshold:f}=g;for(let p=e[0]-1;p<e[1];p++)for(let d=o[0]-1;d<o[1];d++){let{code:x,meanCode:v}=An({getValue:t,threshold:f,x:p,y:d,xRange:e,yRange:o}),y={x:p,y:d,z:h,code:x,meanCode:v};if(Array.isArray(f)){let b=Cn(y);for(let E of b)i[a++]={vertices:E,contour:g}}else{let b=bn(y);b.length>0&&(r[s++]={vertices:b,contour:g})}}}return{lines:r,polygons:i}}function Tn(n){let{aggregator:t,binIdRange:e,channel:o}=n;if(t instanceof P){let r=t.getResult(o)?.buffer;if(r){let i=new Float32Array(r.readSyncWebGL().buffer);return or(i,e)}}if(t instanceof O){let r=t.getResult(o)?.value,i=t.getBins()?.value;if(i&&r)return rr(r,i,t.binCount)}return null}function or(n,t){let[[e,o],[r,i]]=t,s=o-e,a=i-r;return(c,g)=>(c-=e,g-=r,c<0||c>=s||g<0||g>=a?NaN:n[g*s+c])}function rr(n,t,e){let o={};for(let r=0;r<e;r++){let i=t[r*2],s=t[r*2+1];o[i]=o[i]||{},o[i][s]=n[r]}return(r,i)=>o[r]?.[i]??NaN}var Zi=1/Math.PI*180,Qi=1/180*Math.PI,ir={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...ir}};var R=globalThis.mathgl.config;function Ln(n,{precision:t=R.precision}={}){return n=sr(n),`${parseFloat(n.toPrecision(t))}`}function kt(n){return Array.isArray(n)||ArrayBuffer.isView(n)&&!(n instanceof DataView)}function se(n,t,e){let o=R.EPSILON;e&&(R.EPSILON=e);try{if(n===t)return!0;if(kt(n)&&kt(t)){if(n.length!==t.length)return!1;for(let r=0;r<n.length;++r)if(!se(n[r],t[r]))return!1;return!0}return n&&n.equals?n.equals(t):t&&t.equals?t.equals(n):typeof n=="number"&&typeof t=="number"?Math.abs(n-t)<=R.EPSILON*Math.max(1,Math.abs(n),Math.abs(t)):!1}finally{R.EPSILON=o}}function sr(n){return Math.round(n/R.EPSILON)*R.EPSILON}var jt=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,e=0){for(let o=0;o<this.ELEMENTS;++o)this[o]=t[o+e];return this.check()}toArray(t=[],e=0){for(let o=0;o<this.ELEMENTS;++o)t[e+o]=this[o];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:kt(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(R)}formatString(t){let e="";for(let o=0;o<this.ELEMENTS;++o)e+=(o>0?", ":"")+Ln(this[o],t);return`${t.printTypes?this.constructor.name:""}[${e}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let e=0;e<this.ELEMENTS;++e)if(!se(this[e],t[e]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let e=0;e<this.ELEMENTS;++e)if(this[e]!==t[e])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,e,o){if(o===void 0)return this.lerp(this,t,e);for(let r=0;r<this.ELEMENTS;++r){let i=t[r],s=typeof e=="number"?e:e[r];this[r]=i+o*(s-i)}return this.check()}min(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=Math.min(t[e],this[e]);return this.check()}max(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=Math.max(t[e],this[e]);return this.check()}clamp(t,e){for(let o=0;o<this.ELEMENTS;++o)this[o]=Math.min(Math.max(this[o],t[o]),e[o]);return this.check()}add(...t){for(let e of t)for(let o=0;o<this.ELEMENTS;++o)this[o]+=e[o];return this.check()}subtract(...t){for(let e of t)for(let o=0;o<this.ELEMENTS;++o)this[o]-=e[o];return this.check()}scale(t){if(typeof t=="number")for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;else for(let e=0;e<this.ELEMENTS&&e<t.length;++e)this[e]*=t[e];return this.check()}multiplyByScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;return this.check()}check(){if(R.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let t=this.length===this.ELEMENTS;for(let e=0;e<this.ELEMENTS;++e)t=t&&Number.isFinite(this[e]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=t;return this.check()}addScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,e){for(let o=0;o<this.ELEMENTS;++o)this[o]=Math.min(Math.max(this[o],t),e);return this.check()}get elements(){return this}};function ar(n,t){if(n.length!==t)return!1;for(let e=0;e<n.length;++e)if(!Number.isFinite(n[e]))return!1;return!0}function Pn(n){if(!Number.isFinite(n))throw new Error(`Invalid number ${JSON.stringify(n)}`);return n}function Gt(n,t,e=""){if(R.debug&&!ar(n,t))throw new Error(`math.gl: ${e} some fields set to invalid numbers'`);return n}var k=typeof Float32Array<"u"?Float32Array:Array;var rs=Math.PI/180;function cr(){let n=new k(2);return k!=Float32Array&&(n[0]=0,n[1]=0),n}function On(n,t,e){let o=t[0],r=t[1];return n[0]=e[0]*o+e[4]*r+e[12],n[1]=e[1]*o+e[5]*r+e[13],n}var is=function(){let n=cr();return function(t,e,o,r,i,s){let a,c;for(e||(e=2),o||(o=0),r?c=Math.min(r*e+o,t.length):c=t.length,a=o;a<c;a+=e)n[0]=t[a],n[1]=t[a+1],i(n,n,s),t[a]=n[0],t[a+1]=n[1];return t}}();function Rn(n,t,e){let o=t[0],r=t[1],i=e[3]*o+e[7]*r||1;return n[0]=(e[0]*o+e[4]*r)/i,n[1]=(e[1]*o+e[5]*r)/i,n}function _n(n,t,e){let o=t[0],r=t[1],i=t[2],s=e[3]*o+e[7]*r+e[11]*i||1;return n[0]=(e[0]*o+e[4]*r+e[8]*i)/s,n[1]=(e[1]*o+e[5]*r+e[9]*i)/s,n[2]=(e[2]*o+e[6]*r+e[10]*i)/s,n}function lr(){let n=new k(3);return k!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n}function zn(n,t,e){let o=t[0],r=t[1],i=t[2],s=e[3]*o+e[7]*r+e[11]*i+e[15];return s=s||1,n[0]=(e[0]*o+e[4]*r+e[8]*i+e[12])/s,n[1]=(e[1]*o+e[5]*r+e[9]*i+e[13])/s,n[2]=(e[2]*o+e[6]*r+e[10]*i+e[14])/s,n}var cs=function(){let n=lr();return function(t,e,o,r,i,s){let a,c;for(e||(e=3),o||(o=0),r?c=Math.min(r*e+o,t.length):c=t.length,a=o;a<c;a+=e)n[0]=t[a],n[1]=t[a+1],n[2]=t[a+2],i(n,n,s),t[a]=n[0],t[a+1]=n[1],t[a+2]=n[2];return t}}();var qt=class extends jt{toString(){let t="[";if(R.printRowMajor){t+="row-major:";for(let e=0;e<this.RANK;++e)for(let o=0;o<this.RANK;++o)t+=` ${this[o*this.RANK+e]}`}else{t+="column-major:";for(let e=0;e<this.ELEMENTS;++e)t+=` ${this[e]}`}return t+="]",t}getElementIndex(t,e){return e*this.RANK+t}getElement(t,e){return this[e*this.RANK+t]}setElement(t,e,o){return this[e*this.RANK+t]=Pn(o),this}getColumn(t,e=new Array(this.RANK).fill(-0)){let o=t*this.RANK;for(let r=0;r<this.RANK;++r)e[r]=this[o+r];return e}setColumn(t,e){let o=t*this.RANK;for(let r=0;r<this.RANK;++r)this[o+r]=e[r];return this}};function gr(n){return n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function In(n,t){if(n===t){let e=t[1],o=t[2],r=t[3],i=t[6],s=t[7],a=t[11];n[1]=t[4],n[2]=t[8],n[3]=t[12],n[4]=e,n[6]=t[9],n[7]=t[13],n[8]=o,n[9]=i,n[11]=t[14],n[12]=r,n[13]=s,n[14]=a}else n[0]=t[0],n[1]=t[4],n[2]=t[8],n[3]=t[12],n[4]=t[1],n[5]=t[5],n[6]=t[9],n[7]=t[13],n[8]=t[2],n[9]=t[6],n[10]=t[10],n[11]=t[14],n[12]=t[3],n[13]=t[7],n[14]=t[11],n[15]=t[15];return n}function Fn(n,t){let e=t[0],o=t[1],r=t[2],i=t[3],s=t[4],a=t[5],c=t[6],g=t[7],h=t[8],f=t[9],p=t[10],d=t[11],x=t[12],v=t[13],y=t[14],b=t[15],E=e*a-o*s,M=e*c-r*s,C=e*g-i*s,S=o*c-r*a,A=o*g-i*a,w=r*g-i*c,N=h*v-f*x,_=h*y-p*x,z=h*b-d*x,F=f*y-p*v,W=f*b-d*v,D=p*b-d*y,T=E*D-M*W+C*F+S*z-A*_+w*N;return T?(T=1/T,n[0]=(a*D-c*W+g*F)*T,n[1]=(r*W-o*D-i*F)*T,n[2]=(v*w-y*A+b*S)*T,n[3]=(p*A-f*w-d*S)*T,n[4]=(c*z-s*D-g*_)*T,n[5]=(e*D-r*z+i*_)*T,n[6]=(y*C-x*w-b*M)*T,n[7]=(h*w-p*C+d*M)*T,n[8]=(s*W-a*z+g*N)*T,n[9]=(o*z-e*W-i*N)*T,n[10]=(x*A-v*C+b*E)*T,n[11]=(f*C-h*A-d*E)*T,n[12]=(a*_-s*F-c*N)*T,n[13]=(e*F-o*_+r*N)*T,n[14]=(v*M-x*S-y*E)*T,n[15]=(h*S-f*M+p*E)*T,n):null}function Wn(n){let t=n[0],e=n[1],o=n[2],r=n[3],i=n[4],s=n[5],a=n[6],c=n[7],g=n[8],h=n[9],f=n[10],p=n[11],d=n[12],x=n[13],v=n[14],y=n[15],b=t*s-e*i,E=t*a-o*i,M=e*a-o*s,C=g*x-h*d,S=g*v-f*d,A=h*v-f*x,w=t*A-e*S+o*C,N=i*A-s*S+a*C,_=g*M-h*E+f*b,z=d*M-x*E+v*b;return c*w-r*N+y*_-p*z}function ce(n,t,e){let o=t[0],r=t[1],i=t[2],s=t[3],a=t[4],c=t[5],g=t[6],h=t[7],f=t[8],p=t[9],d=t[10],x=t[11],v=t[12],y=t[13],b=t[14],E=t[15],M=e[0],C=e[1],S=e[2],A=e[3];return n[0]=M*o+C*a+S*f+A*v,n[1]=M*r+C*c+S*p+A*y,n[2]=M*i+C*g+S*d+A*b,n[3]=M*s+C*h+S*x+A*E,M=e[4],C=e[5],S=e[6],A=e[7],n[4]=M*o+C*a+S*f+A*v,n[5]=M*r+C*c+S*p+A*y,n[6]=M*i+C*g+S*d+A*b,n[7]=M*s+C*h+S*x+A*E,M=e[8],C=e[9],S=e[10],A=e[11],n[8]=M*o+C*a+S*f+A*v,n[9]=M*r+C*c+S*p+A*y,n[10]=M*i+C*g+S*d+A*b,n[11]=M*s+C*h+S*x+A*E,M=e[12],C=e[13],S=e[14],A=e[15],n[12]=M*o+C*a+S*f+A*v,n[13]=M*r+C*c+S*p+A*y,n[14]=M*i+C*g+S*d+A*b,n[15]=M*s+C*h+S*x+A*E,n}function Dn(n,t,e){let o=e[0],r=e[1],i=e[2],s,a,c,g,h,f,p,d,x,v,y,b;return t===n?(n[12]=t[0]*o+t[4]*r+t[8]*i+t[12],n[13]=t[1]*o+t[5]*r+t[9]*i+t[13],n[14]=t[2]*o+t[6]*r+t[10]*i+t[14],n[15]=t[3]*o+t[7]*r+t[11]*i+t[15]):(s=t[0],a=t[1],c=t[2],g=t[3],h=t[4],f=t[5],p=t[6],d=t[7],x=t[8],v=t[9],y=t[10],b=t[11],n[0]=s,n[1]=a,n[2]=c,n[3]=g,n[4]=h,n[5]=f,n[6]=p,n[7]=d,n[8]=x,n[9]=v,n[10]=y,n[11]=b,n[12]=s*o+h*r+x*i+t[12],n[13]=a*o+f*r+v*i+t[13],n[14]=c*o+p*r+y*i+t[14],n[15]=g*o+d*r+b*i+t[15]),n}function Vn(n,t,e){let o=e[0],r=e[1],i=e[2];return n[0]=t[0]*o,n[1]=t[1]*o,n[2]=t[2]*o,n[3]=t[3]*o,n[4]=t[4]*r,n[5]=t[5]*r,n[6]=t[6]*r,n[7]=t[7]*r,n[8]=t[8]*i,n[9]=t[9]*i,n[10]=t[10]*i,n[11]=t[11]*i,n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n}function Bn(n,t,e,o){let r=o[0],i=o[1],s=o[2],a=Math.sqrt(r*r+i*i+s*s),c,g,h,f,p,d,x,v,y,b,E,M,C,S,A,w,N,_,z,F,W,D,T,ft;return a<1e-6?null:(a=1/a,r*=a,i*=a,s*=a,g=Math.sin(e),c=Math.cos(e),h=1-c,f=t[0],p=t[1],d=t[2],x=t[3],v=t[4],y=t[5],b=t[6],E=t[7],M=t[8],C=t[9],S=t[10],A=t[11],w=r*r*h+c,N=i*r*h+s*g,_=s*r*h-i*g,z=r*i*h-s*g,F=i*i*h+c,W=s*i*h+r*g,D=r*s*h+i*g,T=i*s*h-r*g,ft=s*s*h+c,n[0]=f*w+v*N+M*_,n[1]=p*w+y*N+C*_,n[2]=d*w+b*N+S*_,n[3]=x*w+E*N+A*_,n[4]=f*z+v*F+M*W,n[5]=p*z+y*F+C*W,n[6]=d*z+b*F+S*W,n[7]=x*z+E*F+A*W,n[8]=f*D+v*T+M*ft,n[9]=p*D+y*T+C*ft,n[10]=d*D+b*T+S*ft,n[11]=x*D+E*T+A*ft,t!==n&&(n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n)}function Un(n,t,e){let o=Math.sin(e),r=Math.cos(e),i=t[4],s=t[5],a=t[6],c=t[7],g=t[8],h=t[9],f=t[10],p=t[11];return t!==n&&(n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[4]=i*r+g*o,n[5]=s*r+h*o,n[6]=a*r+f*o,n[7]=c*r+p*o,n[8]=g*r-i*o,n[9]=h*r-s*o,n[10]=f*r-a*o,n[11]=p*r-c*o,n}function Hn(n,t,e){let o=Math.sin(e),r=Math.cos(e),i=t[0],s=t[1],a=t[2],c=t[3],g=t[8],h=t[9],f=t[10],p=t[11];return t!==n&&(n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[0]=i*r-g*o,n[1]=s*r-h*o,n[2]=a*r-f*o,n[3]=c*r-p*o,n[8]=i*o+g*r,n[9]=s*o+h*r,n[10]=a*o+f*r,n[11]=c*o+p*r,n}function kn(n,t,e){let o=Math.sin(e),r=Math.cos(e),i=t[0],s=t[1],a=t[2],c=t[3],g=t[4],h=t[5],f=t[6],p=t[7];return t!==n&&(n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[0]=i*r+g*o,n[1]=s*r+h*o,n[2]=a*r+f*o,n[3]=c*r+p*o,n[4]=g*r-i*o,n[5]=h*r-s*o,n[6]=f*r-a*o,n[7]=p*r-c*o,n}function jn(n,t){let e=t[0],o=t[1],r=t[2],i=t[3],s=e+e,a=o+o,c=r+r,g=e*s,h=o*s,f=o*a,p=r*s,d=r*a,x=r*c,v=i*s,y=i*a,b=i*c;return n[0]=1-f-x,n[1]=h+b,n[2]=p-y,n[3]=0,n[4]=h-b,n[5]=1-g-x,n[6]=d+v,n[7]=0,n[8]=p+y,n[9]=d-v,n[10]=1-g-f,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function Gn(n,t,e,o,r,i,s){let a=1/(e-t),c=1/(r-o),g=1/(i-s);return n[0]=i*2*a,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=i*2*c,n[6]=0,n[7]=0,n[8]=(e+t)*a,n[9]=(r+o)*c,n[10]=(s+i)*g,n[11]=-1,n[12]=0,n[13]=0,n[14]=s*i*2*g,n[15]=0,n}function hr(n,t,e,o,r){let i=1/Math.tan(t/2);if(n[0]=i/e,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=i,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=-1,n[12]=0,n[13]=0,n[15]=0,r!=null&&r!==1/0){let s=1/(o-r);n[10]=(r+o)*s,n[14]=2*r*o*s}else n[10]=-1,n[14]=-2*o;return n}var qn=hr;function pr(n,t,e,o,r,i,s){let a=1/(t-e),c=1/(o-r),g=1/(i-s);return n[0]=-2*a,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=-2*c,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=2*g,n[11]=0,n[12]=(t+e)*a,n[13]=(r+o)*c,n[14]=(s+i)*g,n[15]=1,n}var Yn=pr;function $n(n,t,e,o){let r,i,s,a,c,g,h,f,p,d,x=t[0],v=t[1],y=t[2],b=o[0],E=o[1],M=o[2],C=e[0],S=e[1],A=e[2];return Math.abs(x-C)<1e-6&&Math.abs(v-S)<1e-6&&Math.abs(y-A)<1e-6?gr(n):(f=x-C,p=v-S,d=y-A,r=1/Math.sqrt(f*f+p*p+d*d),f*=r,p*=r,d*=r,i=E*d-M*p,s=M*f-b*d,a=b*p-E*f,r=Math.sqrt(i*i+s*s+a*a),r?(r=1/r,i*=r,s*=r,a*=r):(i=0,s=0,a=0),c=p*a-d*s,g=d*i-f*a,h=f*s-p*i,r=Math.sqrt(c*c+g*g+h*h),r?(r=1/r,c*=r,g*=r,h*=r):(c=0,g=0,h=0),n[0]=i,n[1]=c,n[2]=f,n[3]=0,n[4]=s,n[5]=g,n[6]=p,n[7]=0,n[8]=a,n[9]=h,n[10]=d,n[11]=0,n[12]=-(i*x+s*v+a*y),n[13]=-(c*x+g*v+h*y),n[14]=-(f*x+p*v+d*y),n[15]=1,n)}function fr(){let n=new k(4);return k!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0,n[3]=0),n}function Xn(n,t,e){let o=t[0],r=t[1],i=t[2],s=t[3];return n[0]=e[0]*o+e[4]*r+e[8]*i+e[12]*s,n[1]=e[1]*o+e[5]*r+e[9]*i+e[13]*s,n[2]=e[2]*o+e[6]*r+e[10]*i+e[14]*s,n[3]=e[3]*o+e[7]*r+e[11]*i+e[15]*s,n}var us=function(){let n=fr();return function(t,e,o,r,i,s){let a,c;for(e||(e=4),o||(o=0),r?c=Math.min(r*e+o,t.length):c=t.length,a=o;a<c;a+=e)n[0]=t[a],n[1]=t[a+1],n[2]=t[a+2],n[3]=t[a+3],i(n,n,s),t[a]=n[0],t[a+1]=n[1],t[a+2]=n[2],t[a+3]=n[3];return t}}();var he;(function(n){n[n.COL0ROW0=0]="COL0ROW0",n[n.COL0ROW1=1]="COL0ROW1",n[n.COL0ROW2=2]="COL0ROW2",n[n.COL0ROW3=3]="COL0ROW3",n[n.COL1ROW0=4]="COL1ROW0",n[n.COL1ROW1=5]="COL1ROW1",n[n.COL1ROW2=6]="COL1ROW2",n[n.COL1ROW3=7]="COL1ROW3",n[n.COL2ROW0=8]="COL2ROW0",n[n.COL2ROW1=9]="COL2ROW1",n[n.COL2ROW2=10]="COL2ROW2",n[n.COL2ROW3=11]="COL2ROW3",n[n.COL3ROW0=12]="COL3ROW0",n[n.COL3ROW1=13]="COL3ROW1",n[n.COL3ROW2=14]="COL3ROW2",n[n.COL3ROW3=15]="COL3ROW3"})(he||(he={}));var dr=45*Math.PI/180,ur=1,le=.1,ge=500,mr=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),K=class extends qt{static get IDENTITY(){return vr()}static get ZERO(){return xr()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return he}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,e,o,r,i,s,a,c,g,h,f,p,d,x,v,y){return this[0]=t,this[1]=e,this[2]=o,this[3]=r,this[4]=i,this[5]=s,this[6]=a,this[7]=c,this[8]=g,this[9]=h,this[10]=f,this[11]=p,this[12]=d,this[13]=x,this[14]=v,this[15]=y,this.check()}setRowMajor(t,e,o,r,i,s,a,c,g,h,f,p,d,x,v,y){return this[0]=t,this[1]=i,this[2]=g,this[3]=d,this[4]=e,this[5]=s,this[6]=h,this[7]=x,this[8]=o,this[9]=a,this[10]=f,this[11]=v,this[12]=r,this[13]=c,this[14]=p,this[15]=y,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(mr)}fromObject(t){return this.check()}fromQuaternion(t){return jn(this,t),this.check()}frustum(t){let{left:e,right:o,bottom:r,top:i,near:s=le,far:a=ge}=t;return a===1/0?Mr(this,e,o,r,i,s):Gn(this,e,o,r,i,s,a),this.check()}lookAt(t){let{eye:e,center:o=[0,0,0],up:r=[0,1,0]}=t;return $n(this,e,o,r),this.check()}ortho(t){let{left:e,right:o,bottom:r,top:i,near:s=le,far:a=ge}=t;return Yn(this,e,o,r,i,s,a),this.check()}orthographic(t){let{fovy:e=dr,aspect:o=ur,focalDistance:r=1,near:i=le,far:s=ge}=t;Kn(e);let a=e/2,c=r*Math.tan(a),g=c*o;return this.ortho({left:-g,right:g,bottom:-c,top:c,near:i,far:s})}perspective(t){let{fovy:e=45*Math.PI/180,aspect:o=1,near:r=.1,far:i=500}=t;return Kn(e),qn(this,e,o,r,i),this.check()}determinant(){return Wn(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,e){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],e=e||[-0,-0,-0];let o=this.getScale(e),r=1/o[0],i=1/o[1],s=1/o[2];return t[0]=this[0]*r,t[1]=this[1]*i,t[2]=this[2]*s,t[3]=0,t[4]=this[4]*r,t[5]=this[5]*i,t[6]=this[6]*s,t[7]=0,t[8]=this[8]*r,t[9]=this[9]*i,t[10]=this[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,e){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],e=e||[-0,-0,-0];let o=this.getScale(e),r=1/o[0],i=1/o[1],s=1/o[2];return t[0]=this[0]*r,t[1]=this[1]*i,t[2]=this[2]*s,t[3]=this[4]*r,t[4]=this[5]*i,t[5]=this[6]*s,t[6]=this[8]*r,t[7]=this[9]*i,t[8]=this[10]*s,t}transpose(){return In(this,this),this.check()}invert(){return Fn(this,this),this.check()}multiplyLeft(t){return ce(this,t,this),this.check()}multiplyRight(t){return ce(this,this,t),this.check()}rotateX(t){return Un(this,this,t),this.check()}rotateY(t){return Hn(this,this,t),this.check()}rotateZ(t){return kn(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,e){return Bn(this,this,t,e),this.check()}scale(t){return Vn(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return Dn(this,this,t),this.check()}transform(t,e){return t.length===4?(e=Xn(e||[-0,-0,-0,-0],t,this),Gt(e,4),e):this.transformAsPoint(t,e)}transformAsPoint(t,e){let{length:o}=t,r;switch(o){case 2:r=On(e||[-0,-0],t,this);break;case 3:r=zn(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Gt(r,t.length),r}transformAsVector(t,e){let o;switch(t.length){case 2:o=Rn(e||[-0,-0],t,this);break;case 3:o=_n(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Gt(o,t.length),o}transformPoint(t,e){return this.transformAsPoint(t,e)}transformVector(t,e){return this.transformAsPoint(t,e)}transformDirection(t,e){return this.transformAsVector(t,e)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,e,o){return this.identity().translate([t,e,o])}},Yt,$t;function xr(){return Yt||(Yt=new K([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Yt)),Yt}function vr(){return $t||($t=new K,Object.freeze($t)),$t}function Kn(n){if(n>Math.PI*2)throw Error("expected radians")}function Mr(n,t,e,o,r,i){let s=2*i/(e-t),a=2*i/(r-o),c=(e+t)/(e-t),g=(r+o)/(r-o),h=-1,f=-1,p=-2*i;return n[0]=s,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=a,n[6]=0,n[7]=0,n[8]=c,n[9]=g,n[10]=h,n[11]=f,n[12]=0,n[13]=0,n[14]=p,n[15]=0,n}var yr=`uniform binOptionsUniforms {
|
|
324
|
+
`})})}initializeState(){super.initializeState(),this.getAttributeManager().add({positions:{size:3,accessor:"getPosition",type:"float64",fp64:this.use64bitPositions()},colorWeights:{size:1,accessor:"getColorWeight"},elevationWeights:{size:1,accessor:"getElevationWeight"}})}updateState(t){let e=super.updateState(t),{props:o,oldProps:r,changeFlags:i}=t,{aggregator:s}=this.state;if((i.dataChanged||!this.state.dataAsArray)&&(o.getColorValue||o.getElevationValue)&&(this.state.dataAsArray=Array.from((0,Y.createIterable)(o.data).iterable)),e||i.dataChanged||o.radius!==r.radius||o.getColorValue!==r.getColorValue||o.getElevationValue!==r.getElevationValue||o.colorAggregation!==r.colorAggregation||o.elevationAggregation!==r.elevationAggregation){this._updateBinOptions();let{radiusCommon:a,hexOriginCommon:c,binIdRange:g,dataAsArray:h}=this.state;if(s.setProps({binIdRange:g,pointCount:this.getNumInstances(),operations:[o.colorAggregation,o.elevationAggregation],binOptions:{radiusCommon:a,hexOriginCommon:c},onUpdate:this._onAggregationUpdate.bind(this)}),h){let{getColorValue:f,getElevationValue:p}=this.props;s.setProps({customOperations:[f&&(d=>f(d.map(x=>h[x]),{indices:d,data:o.data})),p&&(d=>p(d.map(x=>h[x]),{indices:d,data:o.data}))]})}}return i.updateTriggersChanged&&i.updateTriggersChanged.getColorValue&&s.setNeedsUpdate(0),i.updateTriggersChanged&&i.updateTriggersChanged.getElevationValue&&s.setNeedsUpdate(1),e}_updateBinOptions(){let t=this.getBounds(),e=1,o=[0,0],r=[[0,1],[0,1]],i=this.context.viewport;if(t&&Number.isFinite(t[0][0])){let s=[(t[0][0]+t[1][0])/2,(t[0][1]+t[1][1])/2],{radius:a}=this.props,{unitsPerMeter:c}=i.getDistanceScales(s);e=c[0]*a;let g=Wt(i.projectFlat(s),e);s=i.unprojectFlat(ie(g,e));let h=i.constructor;i=i.isGeospatial?new h({longitude:s[0],latitude:s[1],zoom:12}):new Y.Viewport({position:[s[0],s[1],0],zoom:12}),o=[Math.fround(i.center[0]),Math.fround(i.center[1])],r=tt({dataBounds:t,getBinId:f=>{let p=i.projectFlat(f);return p[0]-=o[0],p[1]-=o[1],Wt(p,e)},padding:1})}this.setState({radiusCommon:e,hexOriginCommon:o,binIdRange:r,aggregatorViewport:i})}draw(t){t.shaderModuleProps.project&&(t.shaderModuleProps.project.viewport=this.state.aggregatorViewport),super.draw(t)}_onAggregationUpdate({channel:t}){let e=this.getCurrentLayer().props,{aggregator:o}=this.state;if(t===0){let r=o.getResult(0);this.setState({colors:new q(r,o.binCount)}),e.onSetColorDomain(o.getResultDomain(0))}else if(t===1){let r=o.getResult(1);this.setState({elevations:new q(r,o.binCount)}),e.onSetElevationDomain(o.getResultDomain(1))}}onAttributeChange(t){let{aggregator:e}=this.state;switch(t){case"positions":e.setNeedsUpdate(),this._updateBinOptions();let{radiusCommon:o,hexOriginCommon:r,binIdRange:i}=this.state;e.setProps({binIdRange:i,binOptions:{radiusCommon:o,hexOriginCommon:r}});break;case"colorWeights":e.setNeedsUpdate(0);break;case"elevationWeights":e.setNeedsUpdate(1);break;default:}}renderLayers(){let{aggregator:t,radiusCommon:e,hexOriginCommon:o}=this.state,{elevationScale:r,colorRange:i,elevationRange:s,extruded:a,coverage:c,material:g,transitions:h,colorScaleType:f,lowerPercentile:p,upperPercentile:d,colorDomain:x,elevationScaleType:v,elevationLowerPercentile:y,elevationUpperPercentile:b,elevationDomain:E}=this.props,M=this.getSubLayerClass("cells",qe),C=t.getBins(),S=this.state.colors?.update({scaleType:f,lowerPercentile:p,upperPercentile:d}),A=this.state.elevations?.update({scaleType:v,lowerPercentile:y,upperPercentile:b});return!S||!A?null:new M(this.getSubLayerProps({id:"cells"}),{data:{length:t.binCount,attributes:{getBin:C,getColorValue:S.attribute,getElevationValue:A.attribute}},dataComparator:(w,N)=>w.length===N.length,updateTriggers:{getBin:[C],getColorValue:[S.attribute],getElevationValue:[A.attribute]},diskResolution:6,vertices:Be,radius:e,hexOriginCommon:o,elevationScale:r,colorRange:i,colorScaleType:f,elevationRange:s,extruded:a,coverage:c,material:g,colorDomain:S.domain||x||t.getResultDomain(0),elevationDomain:A.domain||E||t.getResultDomain(1),colorCutoff:S.cutoff,elevationCutoff:A.cutoff,transitions:h&&{getFillColor:h.getColorValue||h.getColorWeight,getElevation:h.getElevationValue||h.getElevationWeight},extensions:[]})}getPickingInfo(t){let e=t.info,{index:o}=e;if(o>=0){let r=this.state.aggregator.getBin(o),i;if(r){let s=ie(r.id,this.state.radiusCommon),a=this.context.viewport.unprojectFlat(s);i={col:r.id[0],row:r.id[1],position:a,colorValue:r.value[0],elevationValue:r.value[1],count:r.count},r.pointIndices&&(i.pointIndices=r.pointIndices,i.points=Array.isArray(this.props.data)?r.pointIndices.map(c=>this.props.data[c]):[])}e.object=i}return e}};xt.layerName="HexagonLayer";xt.defaultProps=er;var Xe=xt;var H=L(I(),1),Xt=L(Z(),1);var m=.16666666666666666,l={N:[0,.5],E:[.5,0],S:[0,-.5],W:[-.5,0],NE:[.5,.5],NW:[-.5,.5],SE:[.5,-.5],SW:[-.5,-.5]},et=[l.W,l.SW,l.S],nt=[l.S,l.SE,l.E],ot=[l.E,l.NE,l.N],rt=[l.NW,l.W,l.N],it=[[-.5,m],[-.5,-m],[-m,-.5],[m,-.5]],st=[[-m,-.5],[m,-.5],[.5,-m],[.5,m]],at=[[.5,-m],[.5,m],[m,.5],[-m,.5]],ct=[[-.5,m],[-.5,-m],[m,.5],[-m,.5]],Ke=[l.W,l.SW,l.SE,l.E],Ze=[l.S,l.SE,l.NE,l.N],Qe=[l.NW,l.W,l.E,l.NE],Je=[l.NW,l.SW,l.S,l.N],tn=[[-.5,m],[-.5,-m],[.5,-m],[.5,m]],en=[[-m,-.5],[m,-.5],[m,.5],[-m,.5]],nr=[l.NW,l.SW,l.SE,l.NE],nn=[l.NW,l.SW,l.SE,l.E,l.N],on=[l.W,l.SW,l.SE,l.NE,l.N],rn=[l.NW,l.W,l.S,l.SE,l.NE],sn=[l.NW,l.SW,l.S,l.E,l.NE],an=[l.NW,l.W,[.5,-m],[.5,m],l.N],cn=[[-m,-.5],[m,-.5],l.E,l.NE,l.N],ln=[[-.5,m],[-.5,-m],l.S,l.SE,l.E],gn=[l.W,l.SW,l.S,[m,.5],[-m,.5]],hn=[l.NW,l.W,[-m,-.5],[m,-.5],l.N],pn=[[-.5,m],[-.5,-m],l.E,l.NE,l.N],fn=[l.S,l.SE,l.E,[m,.5],[-m,.5]],dn=[l.W,l.SW,l.S,[.5,-m],[.5,m]],un=[l.W,l.SW,l.SE,l.E,[m,.5],[-m,.5]],mn=[[-.5,m],[-.5,-m],l.S,l.SE,l.NE,l.N],xn=[l.NW,l.W,[-m,-.5],[m,-.5],l.E,l.NE],vn=[l.NW,l.SW,l.S,[.5,-m],[.5,m],l.N],lt=[l.W,l.SW,l.S,l.E,l.NE,l.N],gt=[l.NW,l.W,l.S,l.SE,l.E,l.N],Vt=[[-.5,m],[-.5,-m],[-m,-.5],[m,-.5],l.E,l.NE,l.N],Bt=[l.W,l.SW,l.S,[.5,-m],[.5,m],[m,.5],[-m,.5]],Ut=[l.NW,l.W,[-m,-.5],[m,-.5],[.5,-m],[.5,m],l.N],Ht=[[-.5,m],[-.5,-m],l.S,l.SE,l.E,[m,.5],[-m,.5]],Mn=[[-.5,m],[-.5,-m],[-m,-.5],[m,-.5],[.5,-m],[.5,m],[m,.5],[-m,.5]],yn={0:[],1:[[l.W,l.S]],2:[[l.S,l.E]],3:[[l.W,l.E]],4:[[l.N,l.E]],5:{0:[[l.W,l.S],[l.N,l.E]],1:[[l.W,l.N],[l.S,l.E]]},6:[[l.N,l.S]],7:[[l.W,l.N]],8:[[l.W,l.N]],9:[[l.N,l.S]],10:{0:[[l.W,l.N],[l.S,l.E]],1:[[l.W,l.S],[l.N,l.E]]},11:[[l.N,l.E]],12:[[l.W,l.E]],13:[[l.S,l.E]],14:[[l.W,l.S]],15:[]};function u(n){return parseInt(n,4)}var Sn={[u("0000")]:[],[u("2222")]:[],[u("2221")]:[et],[u("2212")]:[nt],[u("2122")]:[ot],[u("1222")]:[rt],[u("0001")]:[et],[u("0010")]:[nt],[u("0100")]:[ot],[u("1000")]:[rt],[u("2220")]:[it],[u("2202")]:[st],[u("2022")]:[at],[u("0222")]:[ct],[u("0002")]:[it],[u("0020")]:[st],[u("0200")]:[at],[u("2000")]:[ct],[u("0011")]:[Ke],[u("0110")]:[Ze],[u("1100")]:[Qe],[u("1001")]:[Je],[u("2211")]:[Ke],[u("2112")]:[Ze],[u("1122")]:[Qe],[u("1221")]:[Je],[u("2200")]:[tn],[u("2002")]:[en],[u("0022")]:[tn],[u("0220")]:[en],[u("1111")]:[nr],[u("1211")]:[nn],[u("2111")]:[on],[u("1112")]:[rn],[u("1121")]:[sn],[u("1011")]:[nn],[u("0111")]:[on],[u("1110")]:[rn],[u("1101")]:[sn],[u("1200")]:[an],[u("0120")]:[cn],[u("0012")]:[ln],[u("2001")]:[gn],[u("1022")]:[an],[u("2102")]:[cn],[u("2210")]:[ln],[u("0221")]:[gn],[u("1002")]:[hn],[u("2100")]:[pn],[u("0210")]:[fn],[u("0021")]:[dn],[u("1220")]:[hn],[u("0122")]:[pn],[u("2012")]:[fn],[u("2201")]:[dn],[u("0211")]:[un],[u("2110")]:[mn],[u("1102")]:[xn],[u("1021")]:[vn],[u("2011")]:[un],[u("0112")]:[mn],[u("1120")]:[xn],[u("1201")]:[vn],[u("2101")]:[lt],[u("0121")]:[lt],[u("1012")]:[gt],[u("1210")]:[gt],[u("0101")]:{0:[et,ot],1:[lt],2:[lt]},[u("1010")]:{0:[rt,nt],1:[gt],2:[gt]},[u("2121")]:{0:[lt],1:[lt],2:[et,ot]},[u("1212")]:{0:[gt],1:[gt],2:[rt,nt]},[u("2120")]:{0:[Vt],1:[Vt],2:[it,ot]},[u("2021")]:{0:[Bt],1:[Bt],2:[et,at]},[u("1202")]:{0:[Ut],1:[Ut],2:[rt,st]},[u("0212")]:{0:[Ht],1:[Ht],2:[nt,ct]},[u("0102")]:{0:[it,ot],1:[Vt],2:[Vt]},[u("0201")]:{0:[et,at],1:[Bt],2:[Bt]},[u("1020")]:{0:[rt,st],1:[Ut],2:[Ut]},[u("2010")]:{0:[nt,ct],1:[Ht],2:[Ht]},[u("2020")]:{0:[ct,st],1:[Mn],2:[it,at]},[u("0202")]:{0:[at,it],1:[Mn],2:[ct,st]}};function vt(n,t){return Number.isNaN(n)?0:Array.isArray(t)?n<t[0]?0:n<t[1]?1:2:n>=t?1:0}function An(n){let{x:t,y:e,xRange:o,yRange:r,getValue:i,threshold:s}=n,a=t<o[0],c=t>=o[1]-1,g=e<r[0],h=e>=r[1]-1,f=a||c||g||h,p=0,d,x,v,y;if(a||h)v=0;else{let M=i(t,e+1);v=vt(M,s),p+=M}if(c||h)y=0;else{let M=i(t+1,e+1);y=vt(M,s),p+=M}if(c||g)x=0;else{let M=i(t+1,e);x=vt(M,s),p+=M}if(a||g)d=0;else{let M=i(t,e);d=vt(M,s),p+=M}let b=-1;Number.isFinite(s)&&(b=v<<3|y<<2|x<<1|d),Array.isArray(s)&&(b=v<<6|y<<4|x<<2|d);let E=0;return f||(E=vt(p/4,s)),{code:b,meanCode:E}}function Cn(n){let{x:t,y:e,z:o,code:r,meanCode:i}=n,s=Sn[r];Array.isArray(s)||(s=s[i]);let a=t+1,c=e+1,g=[];return s.forEach(h=>{let f=[];h.forEach(p=>{let d=a+p[0],x=c+p[1];f.push([d,x,o])}),g.push(f)}),g}function bn(n){let{x:t,y:e,z:o,code:r,meanCode:i}=n,s=yn[r];Array.isArray(s)||(s=s[i]);let a=t+1,c=e+1,g=[];return s.forEach(h=>{h.forEach(f=>{let p=a+f[0],d=c+f[1];g.push([p,d,o])})}),g}function En({contours:n,getValue:t,xRange:e,yRange:o}){let r=[],i=[],s=0,a=0;for(let c=0;c<n.length;c++){let g=n[c],h=g.zIndex??c,{threshold:f}=g;for(let p=e[0]-1;p<e[1];p++)for(let d=o[0]-1;d<o[1];d++){let{code:x,meanCode:v}=An({getValue:t,threshold:f,x:p,y:d,xRange:e,yRange:o}),y={x:p,y:d,z:h,code:x,meanCode:v};if(Array.isArray(f)){let b=Cn(y);for(let E of b)i[a++]={vertices:E,contour:g}}else{let b=bn(y);b.length>0&&(r[s++]={vertices:b,contour:g})}}}return{lines:r,polygons:i}}function Tn(n){let{aggregator:t,binIdRange:e,channel:o}=n;if(t instanceof P){let r=t.getResult(o)?.buffer;if(r){let i=new Float32Array(r.readSyncWebGL().buffer);return or(i,e)}}if(t instanceof O){let r=t.getResult(o)?.value,i=t.getBins()?.value;if(i&&r)return rr(r,i,t.binCount)}return null}function or(n,t){let[[e,o],[r,i]]=t,s=o-e,a=i-r;return(c,g)=>(c-=e,g-=r,c<0||c>=s||g<0||g>=a?NaN:n[g*s+c])}function rr(n,t,e){let o={};for(let r=0;r<e;r++){let i=t[r*2],s=t[r*2+1];o[i]=o[i]||{},o[i][s]=n[r]}return(r,i)=>o[r]?.[i]??NaN}var Zi=1/Math.PI*180,Qi=1/180*Math.PI,ir={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...ir}};var R=globalThis.mathgl.config;function Ln(n,{precision:t=R.precision}={}){return n=sr(n),`${parseFloat(n.toPrecision(t))}`}function kt(n){return Array.isArray(n)||ArrayBuffer.isView(n)&&!(n instanceof DataView)}function se(n,t,e){let o=R.EPSILON;e&&(R.EPSILON=e);try{if(n===t)return!0;if(kt(n)&&kt(t)){if(n.length!==t.length)return!1;for(let r=0;r<n.length;++r)if(!se(n[r],t[r]))return!1;return!0}return n&&n.equals?n.equals(t):t&&t.equals?t.equals(n):typeof n=="number"&&typeof t=="number"?Math.abs(n-t)<=R.EPSILON*Math.max(1,Math.abs(n),Math.abs(t)):!1}finally{R.EPSILON=o}}function sr(n){return Math.round(n/R.EPSILON)*R.EPSILON}var jt=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,e=0){for(let o=0;o<this.ELEMENTS;++o)this[o]=t[o+e];return this.check()}toArray(t=[],e=0){for(let o=0;o<this.ELEMENTS;++o)t[e+o]=this[o];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:kt(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(R)}formatString(t){let e="";for(let o=0;o<this.ELEMENTS;++o)e+=(o>0?", ":"")+Ln(this[o],t);return`${t.printTypes?this.constructor.name:""}[${e}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let e=0;e<this.ELEMENTS;++e)if(!se(this[e],t[e]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let e=0;e<this.ELEMENTS;++e)if(this[e]!==t[e])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,e,o){if(o===void 0)return this.lerp(this,t,e);for(let r=0;r<this.ELEMENTS;++r){let i=t[r],s=typeof e=="number"?e:e[r];this[r]=i+o*(s-i)}return this.check()}min(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=Math.min(t[e],this[e]);return this.check()}max(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=Math.max(t[e],this[e]);return this.check()}clamp(t,e){for(let o=0;o<this.ELEMENTS;++o)this[o]=Math.min(Math.max(this[o],t[o]),e[o]);return this.check()}add(...t){for(let e of t)for(let o=0;o<this.ELEMENTS;++o)this[o]+=e[o];return this.check()}subtract(...t){for(let e of t)for(let o=0;o<this.ELEMENTS;++o)this[o]-=e[o];return this.check()}scale(t){if(typeof t=="number")for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;else for(let e=0;e<this.ELEMENTS&&e<t.length;++e)this[e]*=t[e];return this.check()}multiplyByScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;return this.check()}check(){if(R.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let t=this.length===this.ELEMENTS;for(let e=0;e<this.ELEMENTS;++e)t=t&&Number.isFinite(this[e]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=t;return this.check()}addScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,e){for(let o=0;o<this.ELEMENTS;++o)this[o]=Math.min(Math.max(this[o],t),e);return this.check()}get elements(){return this}};function ar(n,t){if(n.length!==t)return!1;for(let e=0;e<n.length;++e)if(!Number.isFinite(n[e]))return!1;return!0}function Pn(n){if(!Number.isFinite(n))throw new Error(`Invalid number ${JSON.stringify(n)}`);return n}function Gt(n,t,e=""){if(R.debug&&!ar(n,t))throw new Error(`math.gl: ${e} some fields set to invalid numbers'`);return n}var k=typeof Float32Array<"u"?Float32Array:Array;var rs=Math.PI/180;function cr(){let n=new k(2);return k!=Float32Array&&(n[0]=0,n[1]=0),n}function On(n,t,e){let o=t[0],r=t[1];return n[0]=e[0]*o+e[4]*r+e[12],n[1]=e[1]*o+e[5]*r+e[13],n}var is=function(){let n=cr();return function(t,e,o,r,i,s){let a,c;for(e||(e=2),o||(o=0),r?c=Math.min(r*e+o,t.length):c=t.length,a=o;a<c;a+=e)n[0]=t[a],n[1]=t[a+1],i(n,n,s),t[a]=n[0],t[a+1]=n[1];return t}}();function Rn(n,t,e){let o=t[0],r=t[1],i=e[3]*o+e[7]*r||1;return n[0]=(e[0]*o+e[4]*r)/i,n[1]=(e[1]*o+e[5]*r)/i,n}function _n(n,t,e){let o=t[0],r=t[1],i=t[2],s=e[3]*o+e[7]*r+e[11]*i||1;return n[0]=(e[0]*o+e[4]*r+e[8]*i)/s,n[1]=(e[1]*o+e[5]*r+e[9]*i)/s,n[2]=(e[2]*o+e[6]*r+e[10]*i)/s,n}function lr(){let n=new k(3);return k!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n}function zn(n,t,e){let o=t[0],r=t[1],i=t[2],s=e[3]*o+e[7]*r+e[11]*i+e[15];return s=s||1,n[0]=(e[0]*o+e[4]*r+e[8]*i+e[12])/s,n[1]=(e[1]*o+e[5]*r+e[9]*i+e[13])/s,n[2]=(e[2]*o+e[6]*r+e[10]*i+e[14])/s,n}var cs=function(){let n=lr();return function(t,e,o,r,i,s){let a,c;for(e||(e=3),o||(o=0),r?c=Math.min(r*e+o,t.length):c=t.length,a=o;a<c;a+=e)n[0]=t[a],n[1]=t[a+1],n[2]=t[a+2],i(n,n,s),t[a]=n[0],t[a+1]=n[1],t[a+2]=n[2];return t}}();var qt=class extends jt{toString(){let t="[";if(R.printRowMajor){t+="row-major:";for(let e=0;e<this.RANK;++e)for(let o=0;o<this.RANK;++o)t+=` ${this[o*this.RANK+e]}`}else{t+="column-major:";for(let e=0;e<this.ELEMENTS;++e)t+=` ${this[e]}`}return t+="]",t}getElementIndex(t,e){return e*this.RANK+t}getElement(t,e){return this[e*this.RANK+t]}setElement(t,e,o){return this[e*this.RANK+t]=Pn(o),this}getColumn(t,e=new Array(this.RANK).fill(-0)){let o=t*this.RANK;for(let r=0;r<this.RANK;++r)e[r]=this[o+r];return e}setColumn(t,e){let o=t*this.RANK;for(let r=0;r<this.RANK;++r)this[o+r]=e[r];return this}};function gr(n){return n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function In(n,t){if(n===t){let e=t[1],o=t[2],r=t[3],i=t[6],s=t[7],a=t[11];n[1]=t[4],n[2]=t[8],n[3]=t[12],n[4]=e,n[6]=t[9],n[7]=t[13],n[8]=o,n[9]=i,n[11]=t[14],n[12]=r,n[13]=s,n[14]=a}else n[0]=t[0],n[1]=t[4],n[2]=t[8],n[3]=t[12],n[4]=t[1],n[5]=t[5],n[6]=t[9],n[7]=t[13],n[8]=t[2],n[9]=t[6],n[10]=t[10],n[11]=t[14],n[12]=t[3],n[13]=t[7],n[14]=t[11],n[15]=t[15];return n}function Fn(n,t){let e=t[0],o=t[1],r=t[2],i=t[3],s=t[4],a=t[5],c=t[6],g=t[7],h=t[8],f=t[9],p=t[10],d=t[11],x=t[12],v=t[13],y=t[14],b=t[15],E=e*a-o*s,M=e*c-r*s,C=e*g-i*s,S=o*c-r*a,A=o*g-i*a,w=r*g-i*c,N=h*v-f*x,_=h*y-p*x,z=h*b-d*x,F=f*y-p*v,W=f*b-d*v,D=p*b-d*y,T=E*D-M*W+C*F+S*z-A*_+w*N;return T?(T=1/T,n[0]=(a*D-c*W+g*F)*T,n[1]=(r*W-o*D-i*F)*T,n[2]=(v*w-y*A+b*S)*T,n[3]=(p*A-f*w-d*S)*T,n[4]=(c*z-s*D-g*_)*T,n[5]=(e*D-r*z+i*_)*T,n[6]=(y*C-x*w-b*M)*T,n[7]=(h*w-p*C+d*M)*T,n[8]=(s*W-a*z+g*N)*T,n[9]=(o*z-e*W-i*N)*T,n[10]=(x*A-v*C+b*E)*T,n[11]=(f*C-h*A-d*E)*T,n[12]=(a*_-s*F-c*N)*T,n[13]=(e*F-o*_+r*N)*T,n[14]=(v*M-x*S-y*E)*T,n[15]=(h*S-f*M+p*E)*T,n):null}function Wn(n){let t=n[0],e=n[1],o=n[2],r=n[3],i=n[4],s=n[5],a=n[6],c=n[7],g=n[8],h=n[9],f=n[10],p=n[11],d=n[12],x=n[13],v=n[14],y=n[15],b=t*s-e*i,E=t*a-o*i,M=e*a-o*s,C=g*x-h*d,S=g*v-f*d,A=h*v-f*x,w=t*A-e*S+o*C,N=i*A-s*S+a*C,_=g*M-h*E+f*b,z=d*M-x*E+v*b;return c*w-r*N+y*_-p*z}function ce(n,t,e){let o=t[0],r=t[1],i=t[2],s=t[3],a=t[4],c=t[5],g=t[6],h=t[7],f=t[8],p=t[9],d=t[10],x=t[11],v=t[12],y=t[13],b=t[14],E=t[15],M=e[0],C=e[1],S=e[2],A=e[3];return n[0]=M*o+C*a+S*f+A*v,n[1]=M*r+C*c+S*p+A*y,n[2]=M*i+C*g+S*d+A*b,n[3]=M*s+C*h+S*x+A*E,M=e[4],C=e[5],S=e[6],A=e[7],n[4]=M*o+C*a+S*f+A*v,n[5]=M*r+C*c+S*p+A*y,n[6]=M*i+C*g+S*d+A*b,n[7]=M*s+C*h+S*x+A*E,M=e[8],C=e[9],S=e[10],A=e[11],n[8]=M*o+C*a+S*f+A*v,n[9]=M*r+C*c+S*p+A*y,n[10]=M*i+C*g+S*d+A*b,n[11]=M*s+C*h+S*x+A*E,M=e[12],C=e[13],S=e[14],A=e[15],n[12]=M*o+C*a+S*f+A*v,n[13]=M*r+C*c+S*p+A*y,n[14]=M*i+C*g+S*d+A*b,n[15]=M*s+C*h+S*x+A*E,n}function Dn(n,t,e){let o=e[0],r=e[1],i=e[2],s,a,c,g,h,f,p,d,x,v,y,b;return t===n?(n[12]=t[0]*o+t[4]*r+t[8]*i+t[12],n[13]=t[1]*o+t[5]*r+t[9]*i+t[13],n[14]=t[2]*o+t[6]*r+t[10]*i+t[14],n[15]=t[3]*o+t[7]*r+t[11]*i+t[15]):(s=t[0],a=t[1],c=t[2],g=t[3],h=t[4],f=t[5],p=t[6],d=t[7],x=t[8],v=t[9],y=t[10],b=t[11],n[0]=s,n[1]=a,n[2]=c,n[3]=g,n[4]=h,n[5]=f,n[6]=p,n[7]=d,n[8]=x,n[9]=v,n[10]=y,n[11]=b,n[12]=s*o+h*r+x*i+t[12],n[13]=a*o+f*r+v*i+t[13],n[14]=c*o+p*r+y*i+t[14],n[15]=g*o+d*r+b*i+t[15]),n}function Vn(n,t,e){let o=e[0],r=e[1],i=e[2];return n[0]=t[0]*o,n[1]=t[1]*o,n[2]=t[2]*o,n[3]=t[3]*o,n[4]=t[4]*r,n[5]=t[5]*r,n[6]=t[6]*r,n[7]=t[7]*r,n[8]=t[8]*i,n[9]=t[9]*i,n[10]=t[10]*i,n[11]=t[11]*i,n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n}function Bn(n,t,e,o){let r=o[0],i=o[1],s=o[2],a=Math.sqrt(r*r+i*i+s*s),c,g,h,f,p,d,x,v,y,b,E,M,C,S,A,w,N,_,z,F,W,D,T,ft;return a<1e-6?null:(a=1/a,r*=a,i*=a,s*=a,g=Math.sin(e),c=Math.cos(e),h=1-c,f=t[0],p=t[1],d=t[2],x=t[3],v=t[4],y=t[5],b=t[6],E=t[7],M=t[8],C=t[9],S=t[10],A=t[11],w=r*r*h+c,N=i*r*h+s*g,_=s*r*h-i*g,z=r*i*h-s*g,F=i*i*h+c,W=s*i*h+r*g,D=r*s*h+i*g,T=i*s*h-r*g,ft=s*s*h+c,n[0]=f*w+v*N+M*_,n[1]=p*w+y*N+C*_,n[2]=d*w+b*N+S*_,n[3]=x*w+E*N+A*_,n[4]=f*z+v*F+M*W,n[5]=p*z+y*F+C*W,n[6]=d*z+b*F+S*W,n[7]=x*z+E*F+A*W,n[8]=f*D+v*T+M*ft,n[9]=p*D+y*T+C*ft,n[10]=d*D+b*T+S*ft,n[11]=x*D+E*T+A*ft,t!==n&&(n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n)}function Un(n,t,e){let o=Math.sin(e),r=Math.cos(e),i=t[4],s=t[5],a=t[6],c=t[7],g=t[8],h=t[9],f=t[10],p=t[11];return t!==n&&(n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[4]=i*r+g*o,n[5]=s*r+h*o,n[6]=a*r+f*o,n[7]=c*r+p*o,n[8]=g*r-i*o,n[9]=h*r-s*o,n[10]=f*r-a*o,n[11]=p*r-c*o,n}function Hn(n,t,e){let o=Math.sin(e),r=Math.cos(e),i=t[0],s=t[1],a=t[2],c=t[3],g=t[8],h=t[9],f=t[10],p=t[11];return t!==n&&(n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[0]=i*r-g*o,n[1]=s*r-h*o,n[2]=a*r-f*o,n[3]=c*r-p*o,n[8]=i*o+g*r,n[9]=s*o+h*r,n[10]=a*o+f*r,n[11]=c*o+p*r,n}function kn(n,t,e){let o=Math.sin(e),r=Math.cos(e),i=t[0],s=t[1],a=t[2],c=t[3],g=t[4],h=t[5],f=t[6],p=t[7];return t!==n&&(n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[0]=i*r+g*o,n[1]=s*r+h*o,n[2]=a*r+f*o,n[3]=c*r+p*o,n[4]=g*r-i*o,n[5]=h*r-s*o,n[6]=f*r-a*o,n[7]=p*r-c*o,n}function jn(n,t){let e=t[0],o=t[1],r=t[2],i=t[3],s=e+e,a=o+o,c=r+r,g=e*s,h=o*s,f=o*a,p=r*s,d=r*a,x=r*c,v=i*s,y=i*a,b=i*c;return n[0]=1-f-x,n[1]=h+b,n[2]=p-y,n[3]=0,n[4]=h-b,n[5]=1-g-x,n[6]=d+v,n[7]=0,n[8]=p+y,n[9]=d-v,n[10]=1-g-f,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function Gn(n,t,e,o,r,i,s){let a=1/(e-t),c=1/(r-o),g=1/(i-s);return n[0]=i*2*a,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=i*2*c,n[6]=0,n[7]=0,n[8]=(e+t)*a,n[9]=(r+o)*c,n[10]=(s+i)*g,n[11]=-1,n[12]=0,n[13]=0,n[14]=s*i*2*g,n[15]=0,n}function hr(n,t,e,o,r){let i=1/Math.tan(t/2);if(n[0]=i/e,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=i,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=-1,n[12]=0,n[13]=0,n[15]=0,r!=null&&r!==1/0){let s=1/(o-r);n[10]=(r+o)*s,n[14]=2*r*o*s}else n[10]=-1,n[14]=-2*o;return n}var qn=hr;function pr(n,t,e,o,r,i,s){let a=1/(t-e),c=1/(o-r),g=1/(i-s);return n[0]=-2*a,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=-2*c,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=2*g,n[11]=0,n[12]=(t+e)*a,n[13]=(r+o)*c,n[14]=(s+i)*g,n[15]=1,n}var Yn=pr;function $n(n,t,e,o){let r,i,s,a,c,g,h,f,p,d,x=t[0],v=t[1],y=t[2],b=o[0],E=o[1],M=o[2],C=e[0],S=e[1],A=e[2];return Math.abs(x-C)<1e-6&&Math.abs(v-S)<1e-6&&Math.abs(y-A)<1e-6?gr(n):(f=x-C,p=v-S,d=y-A,r=1/Math.sqrt(f*f+p*p+d*d),f*=r,p*=r,d*=r,i=E*d-M*p,s=M*f-b*d,a=b*p-E*f,r=Math.sqrt(i*i+s*s+a*a),r?(r=1/r,i*=r,s*=r,a*=r):(i=0,s=0,a=0),c=p*a-d*s,g=d*i-f*a,h=f*s-p*i,r=Math.sqrt(c*c+g*g+h*h),r?(r=1/r,c*=r,g*=r,h*=r):(c=0,g=0,h=0),n[0]=i,n[1]=c,n[2]=f,n[3]=0,n[4]=s,n[5]=g,n[6]=p,n[7]=0,n[8]=a,n[9]=h,n[10]=d,n[11]=0,n[12]=-(i*x+s*v+a*y),n[13]=-(c*x+g*v+h*y),n[14]=-(f*x+p*v+d*y),n[15]=1,n)}function fr(){let n=new k(4);return k!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0,n[3]=0),n}function Xn(n,t,e){let o=t[0],r=t[1],i=t[2],s=t[3];return n[0]=e[0]*o+e[4]*r+e[8]*i+e[12]*s,n[1]=e[1]*o+e[5]*r+e[9]*i+e[13]*s,n[2]=e[2]*o+e[6]*r+e[10]*i+e[14]*s,n[3]=e[3]*o+e[7]*r+e[11]*i+e[15]*s,n}var us=function(){let n=fr();return function(t,e,o,r,i,s){let a,c;for(e||(e=4),o||(o=0),r?c=Math.min(r*e+o,t.length):c=t.length,a=o;a<c;a+=e)n[0]=t[a],n[1]=t[a+1],n[2]=t[a+2],n[3]=t[a+3],i(n,n,s),t[a]=n[0],t[a+1]=n[1],t[a+2]=n[2],t[a+3]=n[3];return t}}();var he;(function(n){n[n.COL0ROW0=0]="COL0ROW0",n[n.COL0ROW1=1]="COL0ROW1",n[n.COL0ROW2=2]="COL0ROW2",n[n.COL0ROW3=3]="COL0ROW3",n[n.COL1ROW0=4]="COL1ROW0",n[n.COL1ROW1=5]="COL1ROW1",n[n.COL1ROW2=6]="COL1ROW2",n[n.COL1ROW3=7]="COL1ROW3",n[n.COL2ROW0=8]="COL2ROW0",n[n.COL2ROW1=9]="COL2ROW1",n[n.COL2ROW2=10]="COL2ROW2",n[n.COL2ROW3=11]="COL2ROW3",n[n.COL3ROW0=12]="COL3ROW0",n[n.COL3ROW1=13]="COL3ROW1",n[n.COL3ROW2=14]="COL3ROW2",n[n.COL3ROW3=15]="COL3ROW3"})(he||(he={}));var dr=45*Math.PI/180,ur=1,le=.1,ge=500,mr=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),K=class extends qt{static get IDENTITY(){return vr()}static get ZERO(){return xr()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return he}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,e,o,r,i,s,a,c,g,h,f,p,d,x,v,y){return this[0]=t,this[1]=e,this[2]=o,this[3]=r,this[4]=i,this[5]=s,this[6]=a,this[7]=c,this[8]=g,this[9]=h,this[10]=f,this[11]=p,this[12]=d,this[13]=x,this[14]=v,this[15]=y,this.check()}setRowMajor(t,e,o,r,i,s,a,c,g,h,f,p,d,x,v,y){return this[0]=t,this[1]=i,this[2]=g,this[3]=d,this[4]=e,this[5]=s,this[6]=h,this[7]=x,this[8]=o,this[9]=a,this[10]=f,this[11]=v,this[12]=r,this[13]=c,this[14]=p,this[15]=y,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(mr)}fromObject(t){return this.check()}fromQuaternion(t){return jn(this,t),this.check()}frustum(t){let{left:e,right:o,bottom:r,top:i,near:s=le,far:a=ge}=t;return a===1/0?Mr(this,e,o,r,i,s):Gn(this,e,o,r,i,s,a),this.check()}lookAt(t){let{eye:e,center:o=[0,0,0],up:r=[0,1,0]}=t;return $n(this,e,o,r),this.check()}ortho(t){let{left:e,right:o,bottom:r,top:i,near:s=le,far:a=ge}=t;return Yn(this,e,o,r,i,s,a),this.check()}orthographic(t){let{fovy:e=dr,aspect:o=ur,focalDistance:r=1,near:i=le,far:s=ge}=t;Kn(e);let a=e/2,c=r*Math.tan(a),g=c*o;return this.ortho({left:-g,right:g,bottom:-c,top:c,near:i,far:s})}perspective(t){let{fovy:e=45*Math.PI/180,aspect:o=1,near:r=.1,far:i=500}=t;return Kn(e),qn(this,e,o,r,i),this.check()}determinant(){return Wn(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,e){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],e=e||[-0,-0,-0];let o=this.getScale(e),r=1/o[0],i=1/o[1],s=1/o[2];return t[0]=this[0]*r,t[1]=this[1]*i,t[2]=this[2]*s,t[3]=0,t[4]=this[4]*r,t[5]=this[5]*i,t[6]=this[6]*s,t[7]=0,t[8]=this[8]*r,t[9]=this[9]*i,t[10]=this[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,e){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],e=e||[-0,-0,-0];let o=this.getScale(e),r=1/o[0],i=1/o[1],s=1/o[2];return t[0]=this[0]*r,t[1]=this[1]*i,t[2]=this[2]*s,t[3]=this[4]*r,t[4]=this[5]*i,t[5]=this[6]*s,t[6]=this[8]*r,t[7]=this[9]*i,t[8]=this[10]*s,t}transpose(){return In(this,this),this.check()}invert(){return Fn(this,this),this.check()}multiplyLeft(t){return ce(this,t,this),this.check()}multiplyRight(t){return ce(this,this,t),this.check()}rotateX(t){return Un(this,this,t),this.check()}rotateY(t){return Hn(this,this,t),this.check()}rotateZ(t){return kn(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,e){return Bn(this,this,t,e),this.check()}scale(t){return Vn(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return Dn(this,this,t),this.check()}transform(t,e){return t.length===4?(e=Xn(e||[-0,-0,-0,-0],t,this),Gt(e,4),e):this.transformAsPoint(t,e)}transformAsPoint(t,e){let{length:o}=t,r;switch(o){case 2:r=On(e||[-0,-0],t,this);break;case 3:r=zn(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Gt(r,t.length),r}transformAsVector(t,e){let o;switch(t.length){case 2:o=Rn(e||[-0,-0],t,this);break;case 3:o=_n(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Gt(o,t.length),o}transformPoint(t,e){return this.transformAsPoint(t,e)}transformVector(t,e){return this.transformAsPoint(t,e)}transformDirection(t,e){return this.transformAsVector(t,e)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,e,o){return this.identity().translate([t,e,o])}},Yt,$t;function xr(){return Yt||(Yt=new K([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Yt)),Yt}function vr(){return $t||($t=new K,Object.freeze($t)),$t}function Kn(n){if(n>Math.PI*2)throw Error("expected radians")}function Mr(n,t,e,o,r,i){let s=2*i/(e-t),a=2*i/(r-o),c=(e+t)/(e-t),g=(r+o)/(r-o),h=-1,f=-1,p=-2*i;return n[0]=s,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=a,n[6]=0,n[7]=0,n[8]=c,n[9]=g,n[10]=h,n[11]=f,n[12]=0,n[13]=0,n[14]=p,n[15]=0,n}var yr=`layout(std140) uniform binOptionsUniforms {
|
|
325
325
|
vec2 cellOriginCommon;
|
|
326
326
|
vec2 cellSizeCommon;
|
|
327
327
|
} binOptions;
|
|
@@ -385,14 +385,14 @@ vColor.rgb = lighting_getLightColor(vColor.rgb, project.cameraPosition, geometry
|
|
|
385
385
|
}
|
|
386
386
|
DECKGL_FILTER_COLOR(vColor, geometry);
|
|
387
387
|
}
|
|
388
|
-
`;var Cr=`uniform gridUniforms {
|
|
388
|
+
`;var Cr=`layout(std140) uniform gridUniforms {
|
|
389
389
|
vec4 colorDomain;
|
|
390
390
|
vec4 elevationDomain;
|
|
391
391
|
vec2 elevationRange;
|
|
392
392
|
vec2 originCommon;
|
|
393
393
|
vec2 sizeCommon;
|
|
394
394
|
} grid;
|
|
395
|
-
`,eo={name:"grid",vs:Cr,uniformTypes:{colorDomain:"vec4<f32>",elevationDomain:"vec4<f32>",elevationRange:"vec2<f32>",originCommon:"vec2<f32>",sizeCommon:"vec2<f32>"}};var yt=class extends no.ColumnLayer{getShaders(){let t=super.getShaders();return t.modules.push(eo),{...t,vs:to}}initializeState(){super.initializeState();let t=this.getAttributeManager();t.remove(["instanceElevations","instanceFillColors","instanceLineColors","instanceStrokeWidths"]),t.addInstanced({instancePositions:{size:2,type:"float32",accessor:"getBin"},instanceColorValues:{size:1,type:"float32",accessor:"getColorValue"},instanceElevationValues:{size:1,type:"float32",accessor:"getElevationValue"}})}updateState(t){super.updateState(t);let{props:e,oldProps:o}=t,r=this.state.fillModel;if(o.colorRange!==e.colorRange){this.state.colorTexture?.destroy(),this.state.colorTexture=J(this.context.device,e.colorRange,e.colorScaleType);let i={colorRange:this.state.colorTexture};r.shaderInputs.setProps({grid:i})}else o.colorScaleType!==e.colorScaleType&&Q(this.state.colorTexture,e.colorScaleType)}finalizeState(t){super.finalizeState(t),this.state.colorTexture?.destroy()}_updateGeometry(){let t=new oo.CubeGeometry;this.state.fillModel.setGeometry(t)}draw({uniforms:t}){let{cellOriginCommon:e,cellSizeCommon:o,elevationRange:r,elevationScale:i,extruded:s,coverage:a,colorDomain:c,elevationDomain:g}=this.props,h=this.props.colorCutoff||[-1/0,1/0],f=this.props.elevationCutoff||[-1/0,1/0],p=this.state.fillModel,d={colorDomain:[Math.max(c[0],h[0]),Math.min(c[1],h[1]),Math.max(c[0]-1,h[0]),Math.min(c[1]+1,h[1])],elevationDomain:[Math.max(g[0],f[0]),Math.min(g[1],f[1]),Math.max(g[0]-1,f[0]),Math.min(g[1]+1,f[1])],elevationRange:[r[0]*i,r[1]*i],originCommon:e,sizeCommon:o};p.shaderInputs.setProps({column:{extruded:s,coverage:a},grid:d}),p.draw(this.context.renderPass)}};yt.layerName="GridCellLayer";var br=`uniform binOptionsUniforms {
|
|
395
|
+
`,eo={name:"grid",vs:Cr,uniformTypes:{colorDomain:"vec4<f32>",elevationDomain:"vec4<f32>",elevationRange:"vec2<f32>",originCommon:"vec2<f32>",sizeCommon:"vec2<f32>"}};var yt=class extends no.ColumnLayer{getShaders(){let t=super.getShaders();return t.modules.push(eo),{...t,vs:to}}initializeState(){super.initializeState();let t=this.getAttributeManager();t.remove(["instanceElevations","instanceFillColors","instanceLineColors","instanceStrokeWidths"]),t.addInstanced({instancePositions:{size:2,type:"float32",accessor:"getBin"},instanceColorValues:{size:1,type:"float32",accessor:"getColorValue"},instanceElevationValues:{size:1,type:"float32",accessor:"getElevationValue"}})}updateState(t){super.updateState(t);let{props:e,oldProps:o}=t,r=this.state.fillModel;if(o.colorRange!==e.colorRange){this.state.colorTexture?.destroy(),this.state.colorTexture=J(this.context.device,e.colorRange,e.colorScaleType);let i={colorRange:this.state.colorTexture};r.shaderInputs.setProps({grid:i})}else o.colorScaleType!==e.colorScaleType&&Q(this.state.colorTexture,e.colorScaleType)}finalizeState(t){super.finalizeState(t),this.state.colorTexture?.destroy()}_updateGeometry(){let t=new oo.CubeGeometry;this.state.fillModel.setGeometry(t)}draw({uniforms:t}){let{cellOriginCommon:e,cellSizeCommon:o,elevationRange:r,elevationScale:i,extruded:s,coverage:a,colorDomain:c,elevationDomain:g}=this.props,h=this.props.colorCutoff||[-1/0,1/0],f=this.props.elevationCutoff||[-1/0,1/0],p=this.state.fillModel,d={colorDomain:[Math.max(c[0],h[0]),Math.min(c[1],h[1]),Math.max(c[0]-1,h[0]),Math.min(c[1]+1,h[1])],elevationDomain:[Math.max(g[0],f[0]),Math.min(g[1],f[1]),Math.max(g[0]-1,f[0]),Math.min(g[1]+1,f[1])],elevationRange:[r[0]*i,r[1]*i],originCommon:e,sizeCommon:o};p.shaderInputs.setProps({column:{extruded:s,coverage:a},grid:d}),p.draw(this.context.renderPass)}};yt.layerName="GridCellLayer";var br=`layout(std140) uniform binOptionsUniforms {
|
|
396
396
|
vec2 cellOriginCommon;
|
|
397
397
|
vec2 cellSizeCommon;
|
|
398
398
|
} binOptions;
|
|
@@ -459,7 +459,7 @@ vec4 linearColor = getLinearColor(weight);
|
|
|
459
459
|
linearColor.a *= layer.opacity;
|
|
460
460
|
fragColor = linearColor;
|
|
461
461
|
}
|
|
462
|
-
`;var uo=`uniform triangleUniforms {
|
|
462
|
+
`;var uo=`layout(std140) uniform triangleUniforms {
|
|
463
463
|
float aggregationMode;
|
|
464
464
|
vec2 colorDomain;
|
|
465
465
|
float intensity;
|
|
@@ -514,13 +514,13 @@ void main() {
|
|
|
514
514
|
fragColor = outTexture;
|
|
515
515
|
fragColor.g = outTexture.r / max(1.0, outTexture.a);
|
|
516
516
|
}
|
|
517
|
-
`;var Lr=`uniform weightUniforms {
|
|
517
|
+
`;var Lr=`layout(std140) uniform weightUniforms {
|
|
518
518
|
vec4 commonBounds;
|
|
519
519
|
float radiusPixels;
|
|
520
520
|
float textureWidth;
|
|
521
521
|
float weightsScale;
|
|
522
522
|
} weight;
|
|
523
|
-
`,Co={name:"weight",vs:Lr,uniformTypes:{commonBounds:"vec4<f32>",radiusPixels:"f32",textureWidth:"f32",weightsScale:"f32"}},bo={name:"maxWeight",vs:`uniform maxWeightUniforms {
|
|
523
|
+
`,Co={name:"weight",vs:Lr,uniformTypes:{commonBounds:"vec4<f32>",radiusPixels:"f32",textureWidth:"f32",weightsScale:"f32"}},bo={name:"maxWeight",vs:`layout(std140) uniform maxWeightUniforms {
|
|
524
524
|
float textureSize;
|
|
525
525
|
} maxWeight;
|
|
526
526
|
`,uniformTypes:{textureSize:"f32"}};var Pr=2,fe={format:"rgba8unorm",dimension:"2d",width:1,height:1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},Eo=[0,0],wr={SUM:0,MEAN:1},Nr={getPosition:{type:"accessor",value:n=>n.position},getWeight:{type:"accessor",value:1},intensity:{type:"number",min:0,value:1},radiusPixels:{type:"number",min:1,max:100,value:50},colorRange:G,threshold:{type:"number",min:0,max:1,value:.05},colorDomain:{type:"array",value:null,optional:!0},aggregation:"SUM",weightsTextureSize:{type:"number",min:128,max:2048,value:2048},debounceTimeout:{type:"number",min:0,max:1e3,value:500}},Or=["float32-renderable-webgl","texture-blend-float-webgl"],Rr={data:{props:["radiusPixels"]}},At=class extends yo{getShaders(t){let e=[V.project32];return t.modules&&(e=[...e,...t.modules]),super.getShaders({...t,modules:e})}initializeState(){super.initializeAggregationLayer(Rr),this.setState({colorDomain:Eo}),this._setupTextureParams(),this._setupAttributes(),this._setupResources()}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState(t){super.updateState(t),this._updateHeatmapState(t)}_updateHeatmapState(t){let{props:e,oldProps:o}=t,r=this._getChangeFlags(t);if((r.dataChanged||r.viewportChanged)&&(r.boundsChanged=this._updateBounds(r.dataChanged),this._updateTextureRenderingBounds()),r.dataChanged||r.boundsChanged){if(clearTimeout(this.state.updateTimer),this.setState({isWeightMapDirty:!0}),r.dataChanged){let i=this.getShaders({vs:Jt,fs:te});this._createWeightsTransform(i)}}else r.viewportZoomChanged&&this._debouncedUpdateWeightmap();e.colorRange!==o.colorRange&&this._updateColorTexture(t),this.state.isWeightMapDirty&&this._updateWeightmap(),this.setState({zoom:t.context.viewport.zoom})}renderLayers(){let{weightsTexture:t,triPositionBuffer:e,triTexCoordBuffer:o,maxWeightsTexture:r,colorTexture:i,colorDomain:s}=this.state,{updateTriggers:a,intensity:c,threshold:g,aggregation:h}=this.props,f=this.getSubLayerClass("triangle",vo);return new f(this.getSubLayerProps({id:"triangle-layer",updateTriggers:a}),{coordinateSystem:V.COORDINATE_SYSTEM.DEFAULT,data:{attributes:{positions:e,texCoords:o}},vertexCount:4,maxTexture:r,colorTexture:i,aggregationMode:wr[h]||0,weightsTexture:t,intensity:c,threshold:g,colorDomain:s})}finalizeState(t){super.finalizeState(t);let{weightsTransform:e,weightsTexture:o,maxWeightTransform:r,maxWeightsTexture:i,triPositionBuffer:s,triTexCoordBuffer:a,colorTexture:c,updateTimer:g}=this.state;e?.destroy(),o?.destroy(),r?.destroy(),i?.destroy(),s?.destroy(),a?.destroy(),c?.destroy(),g&&clearTimeout(g)}_getAttributeManager(){return new V.AttributeManager(this.context.device,{id:this.props.id,stats:this.context.stats})}_getChangeFlags(t){let e={},{dimensions:o}=this.state;e.dataChanged=this.isAttributeChanged()&&"attribute changed"||this.isAggregationDirty(t,{compareAll:!0,dimension:o.data})&&"aggregation is dirty",e.viewportChanged=t.changeFlags.viewportChanged;let{zoom:r}=this.state;return(!t.context.viewport||t.context.viewport.zoom!==r)&&(e.viewportZoomChanged=!0),e}_createTextures(){let{textureSize:t,format:e}=this.state;this.setState({weightsTexture:this.context.device.createTexture({...fe,width:t,height:t,format:e}),maxWeightsTexture:this.context.device.createTexture({...fe,width:1,height:1,format:e})})}_setupAttributes(){this.getAttributeManager().add({positions:{size:3,type:"float64",accessor:"getPosition"},weights:{size:1,accessor:"getWeight"}}),this.setState({positionAttributeName:"positions"})}_setupTextureParams(){let{device:t}=this.context,{weightsTextureSize:e}=this.props,o=Math.min(e,t.limits.maxTextureDimension2D),r=Or.every(a=>t.features.has(a)),i=r?"rgba32float":"rgba8unorm",s=r?1:1/255;this.setState({textureSize:o,format:i,weightsScale:s}),r||V.log.warn(`HeatmapLayer: ${this.id} rendering to float texture not supported, falling back to low precision format`)()}_createWeightsTransform(t){let{weightsTransform:e}=this.state,{weightsTexture:o}=this.state,r=this.getAttributeManager();e?.destroy(),e=new de.TextureTransform(this.context.device,{id:`${this.id}-weights-transform`,bufferLayout:r.getBufferLayouts(),vertexCount:1,targetTexture:o,parameters:{depthWriteEnabled:!1,blend:!0,blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"},topology:"point-list",...t,modules:[...t.modules,Co]}),this.setState({weightsTransform:e})}_setupResources(){this._createTextures();let{device:t}=this.context,{textureSize:e,weightsTexture:o,maxWeightsTexture:r}=this.state,i=this.getShaders({vs:Jt,fs:te});this._createWeightsTransform(i);let s=this.getShaders({vs:So,fs:Ao,modules:[bo]}),a=new de.TextureTransform(t,{id:`${this.id}-max-weights-transform`,targetTexture:r,...s,vertexCount:e*e,topology:"point-list",parameters:{depthWriteEnabled:!1,blend:!0,blendColorOperation:"max",blendAlphaOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"}}),c={inTexture:o,textureSize:e};a.model.shaderInputs.setProps({maxWeight:c}),this.setState({weightsTexture:o,maxWeightsTexture:r,maxWeightTransform:a,zoom:null,triPositionBuffer:t.createBuffer({byteLength:48}),triTexCoordBuffer:t.createBuffer({byteLength:48})})}updateShaders(t){this._createWeightsTransform({vs:Jt,fs:te,...t})}_updateMaxWeightValue(){let{maxWeightTransform:t}=this.state;t.run({parameters:{viewport:[0,0,1,1]},clearColor:[0,0,0,0]})}_updateBounds(t=!1){let{viewport:e}=this.context,o=[e.unproject([0,0]),e.unproject([e.width,0]),e.unproject([0,e.height]),e.unproject([e.width,e.height])].map(a=>a.map(Math.fround)),r=co(o),i={visibleWorldBounds:r,viewportCorners:o},s=!1;if(t||!this.state.worldBounds||!lo(this.state.worldBounds,r)){let a=this._worldToCommonBounds(r),c=this._commonToWorldBounds(a);this.props.coordinateSystem===V.COORDINATE_SYSTEM.LNGLAT&&(c[1]=Math.max(c[1],-85.051129),c[3]=Math.min(c[3],85.051129),c[0]=Math.max(c[0],-360),c[2]=Math.min(c[2],360));let g=this._worldToCommonBounds(c);i.worldBounds=c,i.normalizedCommonBounds=g,s=!0}return this.setState(i),s}_updateTextureRenderingBounds(){let{triPositionBuffer:t,triTexCoordBuffer:e,normalizedCommonBounds:o,viewportCorners:r}=this.state,{viewport:i}=this.context;t.write(pe(r,3));let s=r.map(a=>ho(i.projectPosition(a),o));e.write(pe(s,2))}_updateColorTexture(t){let{colorRange:e}=t.props,{colorTexture:o}=this.state,r=re(e,!1,Uint8Array);o?.destroy(),o=this.context.device.createTexture({...fe,data:r,width:e.length,height:1}),this.setState({colorTexture:o})}_updateWeightmap(){let{radiusPixels:t,colorDomain:e,aggregation:o}=this.props,{worldBounds:r,textureSize:i,weightsScale:s,weightsTexture:a}=this.state,c=this.state.weightsTransform;this.state.isWeightMapDirty=!1;let g=this._worldToCommonBounds(r,{useLayerCoordinateSystem:!0});if(e&&o==="SUM"){let{viewport:M}=this.context,C=M.distanceScales.metersPerUnit[2]*(g[2]-g[0])/i;this.state.colorDomain=[e[0]*C*s,e[1]*C*s]}else this.state.colorDomain=e||Eo;let f=this.getAttributeManager().getAttributes(),p=this.getModuleSettings();this._setModelAttributes(c.model,f),c.model.setVertexCount(this.getNumInstances());let d={radiusPixels:t,commonBounds:g,textureWidth:i,weightsScale:s,weightsTexture:a},{viewport:x,devicePixelRatio:v,coordinateSystem:y,coordinateOrigin:b}=p,{modelMatrix:E}=this.props;c.model.shaderInputs.setProps({project:{viewport:x,devicePixelRatio:v,modelMatrix:E,coordinateSystem:y,coordinateOrigin:b},weight:d}),c.run({parameters:{viewport:[0,0,i,i]},clearColor:[0,0,0,0]}),this._updateMaxWeightValue()}_debouncedUpdateWeightmap(t=!1){let{updateTimer:e}=this.state,{debounceTimeout:o}=this.props;t?(e=null,this._updateBounds(!0),this._updateTextureRenderingBounds(),this.setState({isWeightMapDirty:!0})):(this.setState({isWeightMapDirty:!1}),clearTimeout(e),e=setTimeout(this._debouncedUpdateWeightmap.bind(this,!0),o)),this.setState({updateTimer:e})}_worldToCommonBounds(t,e={}){let{useLayerCoordinateSystem:o=!1}=e,[r,i,s,a]=t,{viewport:c}=this.context,{textureSize:g}=this.state,{coordinateSystem:h}=this.props,f=o&&(h===V.COORDINATE_SYSTEM.LNGLAT_OFFSETS||h===V.COORDINATE_SYSTEM.METER_OFFSETS),p=f?c.projectPosition(this.props.coordinateOrigin):[0,0],d=g*Pr/c.scale,x,v;return o&&!f?(x=this.projectPosition([r,i,0]),v=this.projectPosition([s,a,0])):(x=c.projectPosition([r,i,0]),v=c.projectPosition([s,a,0])),go([x[0]-p[0],x[1]-p[1],v[0]-p[0],v[1]-p[1]],d,d)}_commonToWorldBounds(t){let[e,o,r,i]=t,{viewport:s}=this.context,a=s.unprojectPosition([e,o]),c=s.unprojectPosition([r,i]);return a.slice(0,2).concat(c.slice(0,2))}};At.layerName="HeatmapLayer";At.defaultProps=Nr;var To=At;return _o(Ct);})();
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "deck.gl layers that aggregate the input data into alternative representations",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"version": "9.3.0-alpha.
|
|
6
|
+
"version": "9.3.0-alpha.5",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -38,17 +38,16 @@
|
|
|
38
38
|
"prepublishOnly": "npm run build-bundle && npm run build-bundle -- --env=dev"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@luma.gl/
|
|
42
|
-
"@luma.gl/shadertools": "^9.3.0-alpha.6",
|
|
41
|
+
"@luma.gl/shadertools": "^9.3.0-alpha.10",
|
|
43
42
|
"@math.gl/core": "^4.1.0",
|
|
44
43
|
"@math.gl/web-mercator": "^4.1.0",
|
|
45
44
|
"d3-hexbin": "^0.2.1"
|
|
46
45
|
},
|
|
47
46
|
"peerDependencies": {
|
|
48
|
-
"@deck.gl/core": "~9.
|
|
49
|
-
"@deck.gl/layers": "~9.
|
|
50
|
-
"@luma.gl/core": "~9.3.0-alpha.
|
|
51
|
-
"@luma.gl/engine": "~9.3.0-alpha.
|
|
47
|
+
"@deck.gl/core": "~9.3.0-alpha.1",
|
|
48
|
+
"@deck.gl/layers": "~9.3.0-alpha.1",
|
|
49
|
+
"@luma.gl/core": "~9.3.0-alpha.10",
|
|
50
|
+
"@luma.gl/engine": "~9.3.0-alpha.10"
|
|
52
51
|
},
|
|
53
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "c3ad1cee357af674cc31df37979d61325baf9d7a"
|
|
54
53
|
}
|
|
@@ -7,7 +7,7 @@ import {ShaderModule} from '@luma.gl/shadertools';
|
|
|
7
7
|
import {Texture} from '@luma.gl/core';
|
|
8
8
|
|
|
9
9
|
const uniformBlock = /* glsl */ `\
|
|
10
|
-
uniform aggregatorTransformUniforms {
|
|
10
|
+
layout(std140) uniform aggregatorTransformUniforms {
|
|
11
11
|
ivec4 binIdRange;
|
|
12
12
|
bvec3 isCount;
|
|
13
13
|
bvec3 isMean;
|
|
@@ -19,6 +19,7 @@ export type AggregatorTransformProps = {
|
|
|
19
19
|
binIdRange: NumberArray4;
|
|
20
20
|
isCount: NumberArray3;
|
|
21
21
|
isMean: NumberArray3;
|
|
22
|
+
naN: number;
|
|
22
23
|
bins: Texture;
|
|
23
24
|
};
|
|
24
25
|
|
|
@@ -28,6 +29,7 @@ export const aggregatorTransformUniforms = {
|
|
|
28
29
|
uniformTypes: {
|
|
29
30
|
binIdRange: 'vec4<i32>',
|
|
30
31
|
isCount: 'vec3<f32>',
|
|
31
|
-
isMean: 'vec3<f32>'
|
|
32
|
+
isMean: 'vec3<f32>',
|
|
33
|
+
naN: 'f32'
|
|
32
34
|
}
|
|
33
35
|
} as const satisfies ShaderModule<AggregatorTransformProps>;
|
|
@@ -6,7 +6,7 @@ import {NumberArray2, NumberArray4} from '@math.gl/core';
|
|
|
6
6
|
import {ShaderModule} from '@luma.gl/shadertools';
|
|
7
7
|
|
|
8
8
|
const uniformBlock = /* glsl */ `\
|
|
9
|
-
uniform binSorterUniforms {
|
|
9
|
+
layout(std140) uniform binSorterUniforms {
|
|
10
10
|
ivec4 binIdRange;
|
|
11
11
|
ivec2 targetSize;
|
|
12
12
|
} binSorter;
|
|
@@ -6,7 +6,7 @@ import {Texture} from '@luma.gl/core';
|
|
|
6
6
|
import type {ShaderModule} from '@luma.gl/shadertools';
|
|
7
7
|
|
|
8
8
|
const uniformBlock = /* glsl */ `\
|
|
9
|
-
uniform gridUniforms {
|
|
9
|
+
layout(std140) uniform gridUniforms {
|
|
10
10
|
vec4 colorDomain;
|
|
11
11
|
vec4 elevationDomain;
|
|
12
12
|
vec2 elevationRange;
|
|
@@ -6,7 +6,7 @@ import {Texture} from '@luma.gl/core';
|
|
|
6
6
|
import type {ShaderModule} from '@luma.gl/shadertools';
|
|
7
7
|
|
|
8
8
|
const uniformBlock = `\
|
|
9
|
-
uniform weightUniforms {
|
|
9
|
+
layout(std140) uniform weightUniforms {
|
|
10
10
|
vec4 commonBounds;
|
|
11
11
|
float radiusPixels;
|
|
12
12
|
float textureWidth;
|
|
@@ -40,7 +40,7 @@ export type MaxWeightProps = {
|
|
|
40
40
|
export const maxWeightUniforms = {
|
|
41
41
|
name: 'maxWeight',
|
|
42
42
|
vs: `\
|
|
43
|
-
uniform maxWeightUniforms {
|
|
43
|
+
layout(std140) uniform maxWeightUniforms {
|
|
44
44
|
float textureSize;
|
|
45
45
|
} maxWeight;
|
|
46
46
|
`,
|
|
@@ -6,7 +6,7 @@ import type {ShaderModule} from '@luma.gl/shadertools';
|
|
|
6
6
|
import {NumberArray2} from '@math.gl/core';
|
|
7
7
|
|
|
8
8
|
const uniformBlock = /* glsl */ `\
|
|
9
|
-
uniform binOptionsUniforms {
|
|
9
|
+
layout(std140) uniform binOptionsUniforms {
|
|
10
10
|
vec2 hexOriginCommon;
|
|
11
11
|
float radiusCommon;
|
|
12
12
|
} binOptions;
|
|
@@ -6,7 +6,7 @@ import {Texture} from '@luma.gl/core';
|
|
|
6
6
|
import type {ShaderModule} from '@luma.gl/shadertools';
|
|
7
7
|
|
|
8
8
|
const uniformBlock = /* glsl */ `\
|
|
9
|
-
uniform hexagonUniforms {
|
|
9
|
+
layout(std140) uniform hexagonUniforms {
|
|
10
10
|
vec4 colorDomain;
|
|
11
11
|
vec4 elevationDomain;
|
|
12
12
|
vec2 elevationRange;
|
|
@@ -6,7 +6,7 @@ import {Texture} from '@luma.gl/core';
|
|
|
6
6
|
import type {ShaderModule} from '@luma.gl/shadertools';
|
|
7
7
|
|
|
8
8
|
const uniformBlock = /* glsl */ `\
|
|
9
|
-
uniform screenGridUniforms {
|
|
9
|
+
layout(std140) uniform screenGridUniforms {
|
|
10
10
|
vec2 cellSizeClipspace;
|
|
11
11
|
vec2 gridSizeClipspace;
|
|
12
12
|
vec2 colorDomain;
|
|
@@ -163,7 +163,7 @@ export default class ScreenGridLayer<
|
|
|
163
163
|
|
|
164
164
|
void getBin(out ivec2 binId) {
|
|
165
165
|
vec4 pos = project_position_to_clipspace(positions, positions64Low, vec3(0.0));
|
|
166
|
-
vec2 screenCoords = vec2(pos.x / pos.w + 1.0, 1.0 - pos.y / pos.w) / 2.0 * project.viewportSize / project.devicePixelRatio;
|
|
166
|
+
vec2 screenCoords = vec2(pos.x / pos.w + 1.0, 1.0 - pos.y / pos.w) / 2.0 * project.viewportSize.xy / project.devicePixelRatio;
|
|
167
167
|
vec2 gridCoords = floor(screenCoords / binOptions.cellSizePixels);
|
|
168
168
|
binId = ivec2(gridCoords);
|
|
169
169
|
}
|