@deck.gl/aggregation-layers 8.9.19 → 8.9.21
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.min.js +27 -26
- package/package.json +3 -2
- package/src/types.ts +3 -2
- package/typed/types.d.ts +3 -2
- package/typed/types.d.ts.map +1 -1
package/dist.min.js
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
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
|
|
7
|
+
"use strict";var __exports__=(()=>{var ca=Object.create;var qe=Object.defineProperty;var pa=Object.getOwnPropertyDescriptor;var ma=Object.getOwnPropertyNames;var da=Object.getPrototypeOf,va=Object.prototype.hasOwnProperty;var yt=(t,a)=>()=>(a||t((a={exports:{}}).exports,a),a.exports),ha=(t,a)=>{for(var e in a)qe(t,e,{get:a[e],enumerable:!0})},Xe=(t,a,e,n)=>{if(a&&typeof a=="object"||typeof a=="function")for(let r of ma(a))!va.call(t,r)&&r!==e&&qe(t,r,{get:()=>a[r],enumerable:!(n=pa(a,r))||n.enumerable});return t},ae=(t,a,e)=>(Xe(t,a,"default"),e&&Xe(e,a,"default")),R=(t,a,e)=>(e=t!=null?ca(da(t)):{},Xe(a||!t||!t.__esModule?qe(e,"default",{value:t,enumerable:!0}):e,t)),ya=t=>Xe(qe({},"__esModule",{value:!0}),t);var me=yt((So,Wt)=>{Wt.exports=globalThis.deck});var G=yt((zo,Ht)=>{Ht.exports=globalThis.deck});var Q=yt((Uo,$t)=>{$t.exports=globalThis.luma});var je={};ha(je,{AGGREGATION_OPERATION:()=>L,CPUGridLayer:()=>fe,ContourLayer:()=>ft,GPUGridLayer:()=>ce,GridLayer:()=>pt,HeatmapLayer:()=>ht,HexagonLayer:()=>at,ScreenGridLayer:()=>rt,_AggregationLayer:()=>Z,_BinSorter:()=>Oe,_CPUAggregator:()=>Ce,_GPUGridAggregator:()=>V});var te={},jt=R(me());ae(te,R(me()));if(!jt.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");ae(je,te);function N(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}function Vt(t,a){for(var e=0;e<a.length;e++){var n=a[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function I(t,a,e){return a&&Vt(t.prototype,a),e&&Vt(t,e),t}function W(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function P(t){return P=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},P(t)}function xt(t,a){for(;!Object.prototype.hasOwnProperty.call(t,a)&&(t=P(t),t!==null););return t}function E(t,a,e){return typeof Reflect<"u"&&Reflect.get?E=Reflect.get:E=function(r,i,o){var s=xt(r,i);if(s){var u=Object.getOwnPropertyDescriptor(s,i);return u.get?u.get.call(o):u.value}},E(t,a,e||t)}function ke(t,a){return ke=Object.setPrototypeOf||function(n,r){return n.__proto__=r,n},ke(t,a)}function B(t,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(a&&a.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),a&&ke(t,a)}function ne(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ne=function(e){return typeof e}:ne=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ne(t)}function z(t,a){if(a&&(ne(a)==="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return W(t)}function p(t,a,e){return a in t?Object.defineProperty(t,a,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[a]=e,t}var Et=R(G());var F=R(Q());function St(t){if(Array.isArray(t))return t}function _t(t,a){var e=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(e!=null){var n=[],r=!0,i=!1,o,s;try{for(e=e.call(t);!(r=(o=e.next()).done)&&(n.push(o.value),!(a&&n.length===a));r=!0);}catch(u){i=!0,s=u}finally{try{!r&&e.return!=null&&e.return()}finally{if(i)throw s}}return n}}function Ye(t,a){(a==null||a>t.length)&&(a=t.length);for(var e=0,n=new Array(a);e<a;e++)n[e]=t[e];return n}function bt(t,a){if(t){if(typeof t=="string")return Ye(t,a);var e=Object.prototype.toString.call(t).slice(8,-1);if(e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set")return Array.from(t);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return Ye(t,a)}}function At(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
8
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function X(t,a){return St(t)||_t(t,a)||bt(t,a)||At()}function Ot(t){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=Math.fround(t),r=t-n;return a[e]=n,a[e+1]=r,a}function Xt(t){return t-Math.fround(t)}function qt(t){for(var a=new Float32Array(32),e=0;e<4;++e)for(var n=0;n<4;++n){var r=e*4+n;Ot(t[n*4+e],a,r*2)}return a}var Yt=`uniform float ONE;
|
|
8
9
|
vec2 split(float a) {
|
|
9
10
|
const float SPLIT = 4097.0;
|
|
10
11
|
float t = a * SPLIT;
|
|
@@ -145,7 +146,7 @@ vec2 sqrt_fp64(vec2 a) {
|
|
|
145
146
|
return sum_fp64(vec2(yn, 0.0), prod);
|
|
146
147
|
#endif
|
|
147
148
|
}
|
|
148
|
-
`;var
|
|
149
|
+
`;var xa={ONE:1};function Sa(){return xa}var de={name:"fp64-arithmetic",vs:Yt,fs:null,getUniforms:Sa,fp64ify:Ot,fp64LowPart:Xt,fp64ifyMatrix4:qt};var Se=R(G());var L={SUM:1,MEAN:2,MIN:3,MAX:4};function Kt(t,a){return t+a}function _a(t,a){return a>t?a:t}function ba(t,a){return a<t?a:t}function Aa(t,a){if(Number.isFinite(a))return t.length?a:null;var e=t.map(a).filter(Number.isFinite);return e.length?e.reduce(Kt,0)/e.length:null}function Oa(t,a){if(Number.isFinite(a))return t.length?t.length*a:null;var e=t.map(a).filter(Number.isFinite);return e.length?e.reduce(Kt,0):null}function Ta(t,a){if(Number.isFinite(a))return t.length?a:null;var e=t.map(a).filter(Number.isFinite);return e.length?e.reduce(_a,-1/0):null}function Ca(t,a){if(Number.isFinite(a))return t.length?a:null;var e=t.map(a).filter(Number.isFinite);return e.length?e.reduce(ba,1/0):null}function ve(t,a,e){var n=L[t]||L.SUM;switch(a=Pa(a,e),n){case L.MIN:return function(r){return Ca(r,a)};case L.SUM:return function(r){return Oa(r,a)};case L.MEAN:return function(r){return Aa(r,a)};case L.MAX:return function(r){return Ta(r,a)};default:return null}}function Pa(t){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Number.isFinite(t)?t:function(e){return a.index=e.index,t(e.source,a)}}function Qt(t){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function(e){return a.indices=e.map(function(n){return n.index}),t(e.map(function(n){return n.source}),a)}}var he,Ke,Zt={projectPoints:!1,viewport:null,createBufferObjects:!0,moduleSettings:{}},ie=3402823466e29,Tt=[32775,32774],Ct=[32776,32774],Jt=[32776,32775],Pt=(he={},p(he,L.SUM,32774),p(he,L.MEAN,32774),p(he,L.MIN,Tt),p(he,L.MAX,Ct),he);var er={size:1,operation:L.SUM,needMin:!1,needMax:!1,combineMaxMin:!1},tr=4;var us={format:34836,type:5126,border:0,mipmaps:!1,parameters:(Ke={},p(Ke,10240,9728),p(Ke,10241,9728),Ke),dataFormat:6408,width:1,height:1};var rr=`#define SHADER_NAME gpu-aggregation-to-grid-vs
|
|
149
150
|
|
|
150
151
|
attribute vec3 positions;
|
|
151
152
|
attribute vec3 positions64Low;
|
|
@@ -193,7 +194,7 @@ void main(void) {
|
|
|
193
194
|
gl_Position = vec4(pos, 0.0, 1.0);
|
|
194
195
|
gl_PointSize = 1.0;
|
|
195
196
|
}
|
|
196
|
-
`;var
|
|
197
|
+
`;var nr=`#define SHADER_NAME gpu-aggregation-to-grid-fs
|
|
197
198
|
|
|
198
199
|
precision highp float;
|
|
199
200
|
|
|
@@ -203,7 +204,7 @@ void main(void) {
|
|
|
203
204
|
gl_FragColor = vec4(vWeights, 1.0);
|
|
204
205
|
DECKGL_FILTER_COLOR(gl_FragColor, geometry);
|
|
205
206
|
}
|
|
206
|
-
`;var
|
|
207
|
+
`;var ar=`#version 300 es
|
|
207
208
|
#define SHADER_NAME gpu-aggregation-all-vs-64
|
|
208
209
|
|
|
209
210
|
in vec2 position;
|
|
@@ -231,7 +232,7 @@ void main(void) {
|
|
|
231
232
|
vTextureCoord = vec2(texCoordYFP64.x, texCoordXFP64.x);
|
|
232
233
|
gl_PointSize = 1.0;
|
|
233
234
|
}
|
|
234
|
-
`;var
|
|
235
|
+
`;var ir=`#version 300 es
|
|
235
236
|
#define SHADER_NAME gpu-aggregation-all-fs
|
|
236
237
|
|
|
237
238
|
precision highp float;
|
|
@@ -248,7 +249,7 @@ void main(void) {
|
|
|
248
249
|
fragColor.rgb = textureColor.rgb;
|
|
249
250
|
fragColor.a = combineMaxMin ? textureColor.r : textureColor.a;
|
|
250
251
|
}
|
|
251
|
-
`;var
|
|
252
|
+
`;var or=`#define SHADER_NAME gpu-aggregation-transform-mean-vs
|
|
252
253
|
attribute vec4 aggregationValues;
|
|
253
254
|
varying vec4 meanValues;
|
|
254
255
|
|
|
@@ -259,8 +260,8 @@ void main()
|
|
|
259
260
|
meanValues.w = aggregationValues.w;
|
|
260
261
|
gl_PointSize = 1.0;
|
|
261
262
|
}
|
|
262
|
-
`;var
|
|
263
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,s;return{s:function(){e=e.call(t)},n:function(){var l=e.next();return i=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!i&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function ps(t,a){if(t){if(typeof t=="string")return gn(t,a);var e=Object.prototype.toString.call(t).slice(8,-1);if(e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set")return Array.from(t);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return gn(t,a)}}function gn(t,a){(a==null||a>t.length)&&(a=t.length);for(var e=0,n=new Array(a);e<a;e++)n[e]=t[e];return n}function cn(t,a){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);a&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function k(t){for(var a=1;a<arguments.length;a++){var e=arguments[a]!=null?arguments[a]:{};a%2?cn(Object(e),!0).forEach(function(n){(0,yt.default)(t,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):cn(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}return t}var vs=["aggregationBuffer","maxMinBuffer","minBuffer","maxBuffer"],pn={maxData:"maxBuffer",minData:"minBuffer",maxMinData:"maxMinBuffer"},ms=[R.FEATURES.WEBGL2,R.FEATURES.COLOR_ATTACHMENT_RGBA32F,R.FEATURES.BLEND_EQUATION_MINMAX,R.FEATURES.FLOAT_BLEND,R.FEATURES.TEXTURE_FLOAT],G=function(){function t(a){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};(0,vn.default)(this,t),this.id=e.id||"gpu-grid-aggregator",this.gl=a,this.state={weightAttributes:{},textures:{},meanTextures:{},buffers:{},framebuffers:{},maxMinFramebuffers:{},minFramebuffers:{},maxFramebuffers:{},equations:{},resources:{},results:{}},this._hasGPUSupport=(0,R.isWebGL2)(a)&&(0,R.hasFeatures)(this.gl,R.FEATURES.BLEND_EQUATION_MINMAX,R.FEATURES.COLOR_ATTACHMENT_RGBA32F,R.FEATURES.TEXTURE_FLOAT),this._hasGPUSupport&&this._setupModels()}return(0,mn.default)(t,[{key:"delete",value:function(){var e=this.gridAggregationModel,n=this.allAggregationModel,r=this.meanTransform,i=this.state,o=i.textures,s=i.framebuffers,u=i.maxMinFramebuffers,l=i.minFramebuffers,g=i.maxFramebuffers,f=i.meanTextures,c=i.resources;e?.delete(),n?.delete(),r?.delete(),hs([s,o,u,l,g,f,c])}},{key:"run",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.setState({results:{}});var n=this._normalizeAggregationParams(e);return this._hasGPUSupport||Ce.log.log(1,"GPUGridAggregator: not supported")(),this._runAggregation(n)}},{key:"getData",value:function(e){var n={},r=this.state.results;r[e].aggregationData||(r[e].aggregationData=r[e].aggregationBuffer.getData()),n.aggregationData=r[e].aggregationData;for(var i in pn){var o=pn[i];(r[e][i]||r[e][o])&&(r[e][i]=r[e][i]||r[e][o].getData(),n[i]=r[e][i])}return n}},{key:"updateShaders",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.setState({shaderOptions:e,modelDirty:!0})}},{key:"_normalizeAggregationParams",value:function(e){var n=k(k({},tn),e),r=n.weights;return r&&(n.weights=ds(r)),n}},{key:"setState",value:function(e){Object.assign(this.state,e)}},{key:"_getAggregateData",value:function(e){var n={},r=this.state,i=r.textures,o=r.framebuffers,s=r.maxMinFramebuffers,u=r.minFramebuffers,l=r.maxFramebuffers,g=r.resources,f=e.weights;for(var c in f){n[c]={};var d=f[c],h=d.needMin,m=d.needMax,y=d.combineMaxMin;n[c].aggregationTexture=i[c],n[c].aggregationBuffer=(0,R.readPixelsToBuffer)(o[c],{target:f[c].aggregationBuffer,sourceType:5126}),h&&m&&y?(n[c].maxMinBuffer=(0,R.readPixelsToBuffer)(s[c],{target:f[c].maxMinBuffer,sourceType:5126}),n[c].maxMinTexture=g["".concat(c,"-maxMinTexture")]):(h&&(n[c].minBuffer=(0,R.readPixelsToBuffer)(u[c],{target:f[c].minBuffer,sourceType:5126}),n[c].minTexture=g["".concat(c,"-minTexture")]),m&&(n[c].maxBuffer=(0,R.readPixelsToBuffer)(l[c],{target:f[c].maxBuffer,sourceType:5126}),n[c].maxTexture=g["".concat(c,"-maxTexture")]))}return this._trackGPUResultBuffers(n,f),n}},{key:"_renderAggregateData",value:function(e){var n=e.cellSize,r=e.projectPoints,i=e.attributes,o=e.moduleSettings,s=e.numCol,u=e.numRow,l=e.weights,g=e.translation,f=e.scaling,c=this.state,d=c.maxMinFramebuffers,h=c.minFramebuffers,m=c.maxFramebuffers,y=[s,u],O={blend:!0,depthTest:!1,blendFunc:[1,1]},C={cellSize:n,gridSize:y,projectPoints:r,translation:g,scaling:f};for(var b in l){var P=l[b],w=P.needMin,M=P.needMax,D=w&&M&&l[b].combineMaxMin;this._renderToWeightsTexture({id:b,parameters:O,moduleSettings:o,uniforms:C,gridSize:y,attributes:i,weights:l}),D?this._renderToMaxMinTexture({id:b,parameters:k(k({},O),{},{blendEquation:rn}),gridSize:y,minOrMaxFb:d[b],clearParams:{clearColor:[0,0,0,oe]},combineMaxMin:D}):(w&&this._renderToMaxMinTexture({id:b,parameters:k(k({},O),{},{blendEquation:er}),gridSize:y,minOrMaxFb:h[b],clearParams:{clearColor:[oe,oe,oe,0]},combineMaxMin:D}),M&&this._renderToMaxMinTexture({id:b,parameters:k(k({},O),{},{blendEquation:tr}),gridSize:y,minOrMaxFb:m[b],clearParams:{clearColor:[0,0,0,0]},combineMaxMin:D}))}}},{key:"_renderToMaxMinTexture",value:function(e){var n=e.id,r=e.parameters,i=e.gridSize,o=e.minOrMaxFb,s=e.combineMaxMin,u=e.clearParams,l=u===void 0?{}:u,g=this.state.framebuffers,f=this.gl,c=this.allAggregationModel;(0,R.withParameters)(f,k(k({},l),{},{framebuffer:o,viewport:[0,0,i[0],i[1]]}),function(){f.clear(16384),c.draw({parameters:r,uniforms:{uSampler:g[n].texture,gridSize:i,combineMaxMin:s}})})}},{key:"_renderToWeightsTexture",value:function(e){var n=e.id,r=e.parameters,i=e.moduleSettings,o=e.uniforms,s=e.gridSize,u=e.weights,l=this.state,g=l.framebuffers,f=l.equations,c=l.weightAttributes,d=this.gl,h=this.gridAggregationModel,m=u[n].operation,y=m===E.MIN?[oe,oe,oe,0]:[0,0,0,0];if((0,R.withParameters)(d,{framebuffer:g[n],viewport:[0,0,s[0],s[1]],clearColor:y},function(){d.clear(16384);var w={weights:c[n]};h.draw({parameters:k(k({},r),{},{blendEquation:f[n]}),moduleSettings:i,uniforms:o,attributes:w})}),m===E.MEAN){var O=this.state,C=O.meanTextures,b=O.textures,P={_sourceTextures:{aggregationValues:C[n]},_targetTexture:b[n],elementCount:b[n].width*b[n].height};this.meanTransform?this.meanTransform.update(P):this.meanTransform=Ss(d,P),this.meanTransform.run({parameters:{blend:!1,depthTest:!1}}),g[n].attach((0,yt.default)({},36064,b[n]))}}},{key:"_runAggregation",value:function(e){this._updateModels(e),this._setupFramebuffers(e),this._renderAggregateData(e);var n=this._getAggregateData(e);return this.setState({results:n}),n}},{key:"_setupFramebuffers",value:function(e){var n=this.state,r=n.textures,i=n.framebuffers,o=n.maxMinFramebuffers,s=n.minFramebuffers,u=n.maxFramebuffers,l=n.meanTextures,g=n.equations,f=e.weights,c=e.numCol,d=e.numRow,h={width:c,height:d};for(var m in f){var y=f[m],O=y.needMin,C=y.needMax,b=y.combineMaxMin,P=y.operation;r[m]=f[m].aggregationTexture||r[m]||Te(this.gl,{id:"".concat(m,"-texture"),width:c,height:d}),r[m].resize(h);var w=r[m];P===E.MEAN&&(l[m]=l[m]||Te(this.gl,{id:"".concat(m,"-mean-texture"),width:c,height:d}),l[m].resize(h),w=l[m]),i[m]?i[m].attach((0,yt.default)({},36064,w)):i[m]=Ke(this.gl,{id:"".concat(m,"-fb"),width:c,height:d,texture:w}),i[m].resize(h),g[m]=rr[P]||rr.SUM,(O||C)&&(O&&C&&b?o[m]||(w=f[m].maxMinTexture||this._getMinMaxTexture("".concat(m,"-maxMinTexture")),o[m]=Ke(this.gl,{id:"".concat(m,"-maxMinFb"),texture:w})):(O&&(s[m]||(w=f[m].minTexture||this._getMinMaxTexture("".concat(m,"-minTexture")),s[m]=Ke(this.gl,{id:"".concat(m,"-minFb"),texture:w}))),C&&(u[m]||(w=f[m].maxTexture||this._getMinMaxTexture("".concat(m,"-maxTexture")),u[m]=Ke(this.gl,{id:"".concat(m,"-maxFb"),texture:w})))))}}},{key:"_getMinMaxTexture",value:function(e){var n=this.state.resources;return n[e]||(n[e]=Te(this.gl,{id:"resourceName"})),n[e]}},{key:"_setupModels",value:function(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=n.numCol,i=r===void 0?0:r,o=n.numRow,s=o===void 0?0:o,u=this.gl,l=this.state.shaderOptions;if((e=this.gridAggregationModel)===null||e===void 0||e.delete(),this.gridAggregationModel=ys(u,l),!this.allAggregationModel){var g=i*s;this.allAggregationModel=xs(u,g)}}},{key:"_setupWeightAttributes",value:function(e){var n=this.state.weightAttributes,r=e.weights;for(var i in r)n[i]=e.attributes[i]}},{key:"_trackGPUResultBuffers",value:function(e,n){var r=this.state.resources;for(var i in e)if(e[i]){var o=cs(vs),s;try{for(o.s();!(s=o.n()).done;){var u=s.value;if(e[i][u]&&n[i][u]!==e[i][u]){var l="gpu-result-".concat(i,"-").concat(u);r[l]&&r[l].delete(),r[l]=e[i][u]}}}catch(g){o.e(g)}finally{o.f()}}}},{key:"_updateModels",value:function(e){var n=e.vertexCount,r=e.attributes,i=e.numCol,o=e.numRow,s=this.state.modelDirty;s&&(this._setupModels(e),this.setState({modelDirty:!1})),this._setupWeightAttributes(e),this.gridAggregationModel.setVertexCount(n),this.gridAggregationModel.setAttributes(r),this.allAggregationModel.setInstanceCount(i*o)}}],[{key:"getAggregationData",value:function(e){var n=e.aggregationData,r=e.maxData,i=e.minData,o=e.maxMinData,s=e.pixelIndex,u=s*an,l={};return n&&(l.cellCount=n[u+3],l.cellWeight=n[u]),o?(l.maxCellWieght=o[0],l.minCellWeight=o[3]):(r&&(l.maxCellWieght=r[0],l.totalCount=r[3]),i&&(l.minCellWeight=i[0],l.totalCount=r[3])),l}},{key:"getCellData",value:function(e){for(var n=e.countsData,r=e.size,i=r===void 0?1:r,o=n.length/4,s=new Float32Array(o*i),u=new Uint32Array(o),l=0;l<o;l++){for(var g=0;g<i;g++)s[l*i+g]=n[l*4+g];u[l]=n[l*4+3]}return{cellCounts:u,cellWeights:s}}},{key:"isSupported",value:function(e){return(0,R.hasFeatures)(e,ms)}}]),t}();function ds(t){var a={};for(var e in t)a[e]=k(k({},nn),t[e]);return a}function hs(t){t=Array.isArray(t)?t:[t],t.forEach(function(a){for(var e in a)a[e].delete()})}function ys(t,a){var e=(0,Ce._mergeShaders)({vs:on,fs:sn,modules:[_e,Ce.project32]},a);return new R.Model(t,k({id:"Gird-Aggregation-Model",vertexCount:1,drawMode:0},e))}function xs(t,a){return new R.Model(t,{id:"All-Aggregation-Model",vs:un,fs:ln,modules:[_e],vertexCount:1,drawMode:0,isInstanced:!0,instanceCount:a,attributes:{position:[0,0]}})}function Ss(t,a){return new R.Transform(t,k({vs:fn,_targetTextureVarying:"meanValues"},a))}var xn=v(z()),Sn=v(U()),_n=v(ae()),bn=v(K()),An=v(H()),On=v($()),xt=v(j()),Qe=v(L()),ue=v(Q()),Pe=v(B());var Y=[[255,255,178],[254,217,118],[254,178,76],[253,141,60],[240,59,32],[189,0,38]];function se(t){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Float32Array,n;if(Number.isFinite(t[0]))n=new e(t);else{n=new e(t.length*4);for(var r=0,i=0;i<t.length;i++){var o=t[i];n[r++]=o[0],n[r++]=o[1],n[r++]=o[2],n[r++]=Number.isFinite(o[3])?o[3]:255}}if(a)for(var s=0;s<n.length;s++)n[s]/=255;return n}var dn=`#define SHADER_NAME screen-grid-layer-vertex-shader
|
|
263
|
+
`;var ye=R(Q()),Qe,wa=(Qe={},p(Qe,10240,9728),p(Qe,10241,9728),Qe);function xe(t){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},e=a.width,n=e===void 0?1:e,r=a.height,i=r===void 0?1:r,o=a.data,s=o===void 0?null:o,u=a.unpackFlipY,l=u===void 0?!0:u,g=a.parameters,f=g===void 0?wa:g,c=new ye.Texture2D(t,{data:s,format:(0,ye.isWebGL2)(t)?34836:6408,type:5126,border:0,mipmaps:!1,parameters:f,dataFormat:6408,width:n,height:i,unpackFlipY:l});return c}function Ge(t,a){var e=a.id,n=a.width,r=n===void 0?1:n,i=a.height,o=i===void 0?1:i,s=a.texture,u=new ye.Framebuffer(t,{id:e,width:r,height:o,attachments:p({},36064,s)});return u}function Da(t,a){var e=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=Ma(t))||a&&t&&typeof t.length=="number"){e&&(t=e);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(l){throw l},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
264
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,s;return{s:function(){e=e.call(t)},n:function(){var l=e.next();return i=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!i&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function Ma(t,a){if(t){if(typeof t=="string")return sr(t,a);var e=Object.prototype.toString.call(t).slice(8,-1);if(e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set")return Array.from(t);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return sr(t,a)}}function sr(t,a){(a==null||a>t.length)&&(a=t.length);for(var e=0,n=new Array(a);e<a;e++)n[e]=t[e];return n}function ur(t,a){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);a&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function j(t){for(var a=1;a<arguments.length;a++){var e=arguments[a]!=null?arguments[a]:{};a%2?ur(Object(e),!0).forEach(function(n){p(t,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):ur(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}return t}var Ea=["aggregationBuffer","maxMinBuffer","minBuffer","maxBuffer"],lr={maxData:"maxBuffer",minData:"minBuffer",maxMinData:"maxMinBuffer"},Ra=[F.FEATURES.WEBGL2,F.FEATURES.COLOR_ATTACHMENT_RGBA32F,F.FEATURES.BLEND_EQUATION_MINMAX,F.FEATURES.FLOAT_BLEND,F.FEATURES.TEXTURE_FLOAT],V=function(){function t(a){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};N(this,t),this.id=e.id||"gpu-grid-aggregator",this.gl=a,this.state={weightAttributes:{},textures:{},meanTextures:{},buffers:{},framebuffers:{},maxMinFramebuffers:{},minFramebuffers:{},maxFramebuffers:{},equations:{},resources:{},results:{}},this._hasGPUSupport=(0,F.isWebGL2)(a)&&(0,F.hasFeatures)(this.gl,F.FEATURES.BLEND_EQUATION_MINMAX,F.FEATURES.COLOR_ATTACHMENT_RGBA32F,F.FEATURES.TEXTURE_FLOAT),this._hasGPUSupport&&this._setupModels()}return I(t,[{key:"delete",value:function(){var e=this.gridAggregationModel,n=this.allAggregationModel,r=this.meanTransform,i=this.state,o=i.textures,s=i.framebuffers,u=i.maxMinFramebuffers,l=i.minFramebuffers,g=i.maxFramebuffers,f=i.meanTextures,c=i.resources;e?.delete(),n?.delete(),r?.delete(),Ia([s,o,u,l,g,f,c])}},{key:"run",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.setState({results:{}});var n=this._normalizeAggregationParams(e);return this._hasGPUSupport||Se.log.log(1,"GPUGridAggregator: not supported")(),this._runAggregation(n)}},{key:"getData",value:function(e){var n={},r=this.state.results;r[e].aggregationData||(r[e].aggregationData=r[e].aggregationBuffer.getData()),n.aggregationData=r[e].aggregationData;for(var i in lr){var o=lr[i];(r[e][i]||r[e][o])&&(r[e][i]=r[e][i]||r[e][o].getData(),n[i]=r[e][i])}return n}},{key:"updateShaders",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.setState({shaderOptions:e,modelDirty:!0})}},{key:"_normalizeAggregationParams",value:function(e){var n=j(j({},Zt),e),r=n.weights;return r&&(n.weights=Na(r)),n}},{key:"setState",value:function(e){Object.assign(this.state,e)}},{key:"_getAggregateData",value:function(e){var n={},r=this.state,i=r.textures,o=r.framebuffers,s=r.maxMinFramebuffers,u=r.minFramebuffers,l=r.maxFramebuffers,g=r.resources,f=e.weights;for(var c in f){n[c]={};var v=f[c],h=v.needMin,d=v.needMax,y=v.combineMaxMin;n[c].aggregationTexture=i[c],n[c].aggregationBuffer=(0,F.readPixelsToBuffer)(o[c],{target:f[c].aggregationBuffer,sourceType:5126}),h&&d&&y?(n[c].maxMinBuffer=(0,F.readPixelsToBuffer)(s[c],{target:f[c].maxMinBuffer,sourceType:5126}),n[c].maxMinTexture=g["".concat(c,"-maxMinTexture")]):(h&&(n[c].minBuffer=(0,F.readPixelsToBuffer)(u[c],{target:f[c].minBuffer,sourceType:5126}),n[c].minTexture=g["".concat(c,"-minTexture")]),d&&(n[c].maxBuffer=(0,F.readPixelsToBuffer)(l[c],{target:f[c].maxBuffer,sourceType:5126}),n[c].maxTexture=g["".concat(c,"-maxTexture")]))}return this._trackGPUResultBuffers(n,f),n}},{key:"_renderAggregateData",value:function(e){var n=e.cellSize,r=e.projectPoints,i=e.attributes,o=e.moduleSettings,s=e.numCol,u=e.numRow,l=e.weights,g=e.translation,f=e.scaling,c=this.state,v=c.maxMinFramebuffers,h=c.minFramebuffers,d=c.maxFramebuffers,y=[s,u],A={blend:!0,depthTest:!1,blendFunc:[1,1]},T={cellSize:n,gridSize:y,projectPoints:r,translation:g,scaling:f};for(var _ in l){var C=l[_],w=C.needMin,M=C.needMax,D=w&&M&&l[_].combineMaxMin;this._renderToWeightsTexture({id:_,parameters:A,moduleSettings:o,uniforms:T,gridSize:y,attributes:i,weights:l}),D?this._renderToMaxMinTexture({id:_,parameters:j(j({},A),{},{blendEquation:Jt}),gridSize:y,minOrMaxFb:v[_],clearParams:{clearColor:[0,0,0,ie]},combineMaxMin:D}):(w&&this._renderToMaxMinTexture({id:_,parameters:j(j({},A),{},{blendEquation:Tt}),gridSize:y,minOrMaxFb:h[_],clearParams:{clearColor:[ie,ie,ie,0]},combineMaxMin:D}),M&&this._renderToMaxMinTexture({id:_,parameters:j(j({},A),{},{blendEquation:Ct}),gridSize:y,minOrMaxFb:d[_],clearParams:{clearColor:[0,0,0,0]},combineMaxMin:D}))}}},{key:"_renderToMaxMinTexture",value:function(e){var n=e.id,r=e.parameters,i=e.gridSize,o=e.minOrMaxFb,s=e.combineMaxMin,u=e.clearParams,l=u===void 0?{}:u,g=this.state.framebuffers,f=this.gl,c=this.allAggregationModel;(0,F.withParameters)(f,j(j({},l),{},{framebuffer:o,viewport:[0,0,i[0],i[1]]}),function(){f.clear(16384),c.draw({parameters:r,uniforms:{uSampler:g[n].texture,gridSize:i,combineMaxMin:s}})})}},{key:"_renderToWeightsTexture",value:function(e){var n=e.id,r=e.parameters,i=e.moduleSettings,o=e.uniforms,s=e.gridSize,u=e.weights,l=this.state,g=l.framebuffers,f=l.equations,c=l.weightAttributes,v=this.gl,h=this.gridAggregationModel,d=u[n].operation,y=d===L.MIN?[ie,ie,ie,0]:[0,0,0,0];if((0,F.withParameters)(v,{framebuffer:g[n],viewport:[0,0,s[0],s[1]],clearColor:y},function(){v.clear(16384);var w={weights:c[n]};h.draw({parameters:j(j({},r),{},{blendEquation:f[n]}),moduleSettings:i,uniforms:o,attributes:w})}),d===L.MEAN){var A=this.state,T=A.meanTextures,_=A.textures,C={_sourceTextures:{aggregationValues:T[n]},_targetTexture:_[n],elementCount:_[n].width*_[n].height};this.meanTransform?this.meanTransform.update(C):this.meanTransform=Ba(v,C),this.meanTransform.run({parameters:{blend:!1,depthTest:!1}}),g[n].attach(p({},36064,_[n]))}}},{key:"_runAggregation",value:function(e){this._updateModels(e),this._setupFramebuffers(e),this._renderAggregateData(e);var n=this._getAggregateData(e);return this.setState({results:n}),n}},{key:"_setupFramebuffers",value:function(e){var n=this.state,r=n.textures,i=n.framebuffers,o=n.maxMinFramebuffers,s=n.minFramebuffers,u=n.maxFramebuffers,l=n.meanTextures,g=n.equations,f=e.weights,c=e.numCol,v=e.numRow,h={width:c,height:v};for(var d in f){var y=f[d],A=y.needMin,T=y.needMax,_=y.combineMaxMin,C=y.operation;r[d]=f[d].aggregationTexture||r[d]||xe(this.gl,{id:"".concat(d,"-texture"),width:c,height:v}),r[d].resize(h);var w=r[d];C===L.MEAN&&(l[d]=l[d]||xe(this.gl,{id:"".concat(d,"-mean-texture"),width:c,height:v}),l[d].resize(h),w=l[d]),i[d]?i[d].attach(p({},36064,w)):i[d]=Ge(this.gl,{id:"".concat(d,"-fb"),width:c,height:v,texture:w}),i[d].resize(h),g[d]=Pt[C]||Pt.SUM,(A||T)&&(A&&T&&_?o[d]||(w=f[d].maxMinTexture||this._getMinMaxTexture("".concat(d,"-maxMinTexture")),o[d]=Ge(this.gl,{id:"".concat(d,"-maxMinFb"),texture:w})):(A&&(s[d]||(w=f[d].minTexture||this._getMinMaxTexture("".concat(d,"-minTexture")),s[d]=Ge(this.gl,{id:"".concat(d,"-minFb"),texture:w}))),T&&(u[d]||(w=f[d].maxTexture||this._getMinMaxTexture("".concat(d,"-maxTexture")),u[d]=Ge(this.gl,{id:"".concat(d,"-maxFb"),texture:w})))))}}},{key:"_getMinMaxTexture",value:function(e){var n=this.state.resources;return n[e]||(n[e]=xe(this.gl,{id:"resourceName"})),n[e]}},{key:"_setupModels",value:function(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=n.numCol,i=r===void 0?0:r,o=n.numRow,s=o===void 0?0:o,u=this.gl,l=this.state.shaderOptions;if((e=this.gridAggregationModel)===null||e===void 0||e.delete(),this.gridAggregationModel=La(u,l),!this.allAggregationModel){var g=i*s;this.allAggregationModel=Fa(u,g)}}},{key:"_setupWeightAttributes",value:function(e){var n=this.state.weightAttributes,r=e.weights;for(var i in r)n[i]=e.attributes[i]}},{key:"_trackGPUResultBuffers",value:function(e,n){var r=this.state.resources;for(var i in e)if(e[i]){var o=Da(Ea),s;try{for(o.s();!(s=o.n()).done;){var u=s.value;if(e[i][u]&&n[i][u]!==e[i][u]){var l="gpu-result-".concat(i,"-").concat(u);r[l]&&r[l].delete(),r[l]=e[i][u]}}}catch(g){o.e(g)}finally{o.f()}}}},{key:"_updateModels",value:function(e){var n=e.vertexCount,r=e.attributes,i=e.numCol,o=e.numRow,s=this.state.modelDirty;s&&(this._setupModels(e),this.setState({modelDirty:!1})),this._setupWeightAttributes(e),this.gridAggregationModel.setVertexCount(n),this.gridAggregationModel.setAttributes(r),this.allAggregationModel.setInstanceCount(i*o)}}],[{key:"getAggregationData",value:function(e){var n=e.aggregationData,r=e.maxData,i=e.minData,o=e.maxMinData,s=e.pixelIndex,u=s*tr,l={};return n&&(l.cellCount=n[u+3],l.cellWeight=n[u]),o?(l.maxCellWieght=o[0],l.minCellWeight=o[3]):(r&&(l.maxCellWieght=r[0],l.totalCount=r[3]),i&&(l.minCellWeight=i[0],l.totalCount=r[3])),l}},{key:"getCellData",value:function(e){for(var n=e.countsData,r=e.size,i=r===void 0?1:r,o=n.length/4,s=new Float32Array(o*i),u=new Uint32Array(o),l=0;l<o;l++){for(var g=0;g<i;g++)s[l*i+g]=n[l*4+g];u[l]=n[l*4+3]}return{cellCounts:u,cellWeights:s}}},{key:"isSupported",value:function(e){return(0,F.hasFeatures)(e,Ra)}}]),t}();function Na(t){var a={};for(var e in t)a[e]=j(j({},er),t[e]);return a}function Ia(t){t=Array.isArray(t)?t:[t],t.forEach(function(a){for(var e in a)a[e].delete()})}function La(t,a){var e=(0,Se._mergeShaders)({vs:rr,fs:nr,modules:[de,Se.project32]},a);return new F.Model(t,j({id:"Gird-Aggregation-Model",vertexCount:1,drawMode:0},e))}function Fa(t,a){return new F.Model(t,{id:"All-Aggregation-Model",vs:ar,fs:ir,modules:[de],vertexCount:1,drawMode:0,isInstanced:!0,instanceCount:a,attributes:{position:[0,0]}})}function Ba(t,a){return new F.Transform(t,j({vs:or,_targetTextureVarying:"meanValues"},a))}var se=R(Q()),_e=R(G());var K=[[255,255,178],[254,217,118],[254,178,76],[253,141,60],[240,59,32],[189,0,38]];function oe(t){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Float32Array,n;if(Number.isFinite(t[0]))n=new e(t);else{n=new e(t.length*4);for(var r=0,i=0;i<t.length;i++){var o=t[i];n[r++]=o[0],n[r++]=o[1],n[r++]=o[2],n[r++]=Number.isFinite(o[3])?o[3]:255}}if(a)for(var s=0;s<n.length;s++)n[s]/=255;return n}var fr=`#define SHADER_NAME screen-grid-layer-vertex-shader
|
|
264
265
|
#define RANGE_COUNT 6
|
|
265
266
|
|
|
266
267
|
attribute vec3 positions;
|
|
@@ -320,7 +321,7 @@ void main(void) {
|
|
|
320
321
|
|
|
321
322
|
gl_Position = vec4(instancePositions + positions * cellScale, 1.);
|
|
322
323
|
}
|
|
323
|
-
`;var
|
|
324
|
+
`;var gr=`#define SHADER_NAME screen-grid-layer-fragment-shader
|
|
324
325
|
|
|
325
326
|
precision highp float;
|
|
326
327
|
|
|
@@ -335,14 +336,14 @@ void main(void) {
|
|
|
335
336
|
|
|
336
337
|
DECKGL_FILTER_COLOR(gl_FragColor, geometry);
|
|
337
338
|
}
|
|
338
|
-
`;function
|
|
339
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,s;return{s:function(){e=e.call(t)},n:function(){var l=e.next();return i=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!i&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function
|
|
340
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,s;return{s:function(){e=e.call(t)},n:function(){var l=e.next();return i=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!i&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function
|
|
341
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,s;return{s:function(){e=e.call(t)},n:function(){var l=e.next();return i=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!i&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function
|
|
342
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,s;return{s:function(){e=e.call(t)},n:function(){var l=e.next();return i=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!i&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function
|
|
343
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,s;return{s:function(){e=e.call(t)},n:function(){var l=e.next();return i=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!i&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function nu(t,a){if(t){if(typeof t=="string")return ia(t,a);var e=Object.prototype.toString.call(t).slice(8,-1);if(e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set")return Array.from(t);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return ia(t,a)}}function ia(t,a){(a==null||a>t.length)&&(a=t.length);for(var e=0,n=new Array(a);e<a;e++)n[e]=t[e];return n}function au(t){var a=iu();return function(){var n=(0,Re.default)(t),r;if(a){var i=(0,Re.default)(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return(0,fa.default)(this,r)}}function iu(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var ce=function(t){(0,la.default)(e,t);var a=au(e);function e(){var n;(0,oa.default)(this,e);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return n=a.call.apply(a,[this].concat(i)),(0,sr.default)((0,ua.default)(n),"state",void 0),n}return(0,sa.default)(e,[{key:"initializeAggregationLayer",value:function(r){var i=r.dimensions,o=this.context.gl;(0,Tt.default)((0,Re.default)(e.prototype),"initializeAggregationLayer",this).call(this,i),this.setState({layerData:{},gpuGridAggregator:new G(o,{id:"".concat(this.id,"-gpu-aggregator")}),cpuGridAggregator:Ee})}},{key:"updateState",value:function(r){(0,Tt.default)((0,Re.default)(e.prototype),"updateState",this).call(this,r),this.updateAggregationState(r);var i=this.state,o=i.aggregationDataDirty,s=i.aggregationWeightsDirty,u=i.gpuAggregation;if(!(this.getNumInstances()<=0)){var l=!1;(o||u&&s)&&(this._updateAggregation(r),l=!0),!u&&(o||s)&&(this._updateWeightBins(),this._uploadAggregationResults(),l=!0),this.setState({aggregationDirty:l})}}},{key:"finalizeState",value:function(r){var i,o=this.state.weights.count;o&&o.aggregationBuffer&&o.aggregationBuffer.delete(),(i=this.state.gpuGridAggregator)===null||i===void 0||i.delete(),(0,Tt.default)((0,Re.default)(e.prototype),"finalizeState",this).call(this,r)}},{key:"updateShaders",value:function(r){this.state.gpuAggregation&&this.state.gpuGridAggregator.updateShaders(r)}},{key:"updateAggregationState",value:function(r){ca.log.assert(!1)}},{key:"allocateResources",value:function(r,i){if(this.state.numRow!==r||this.state.numCol!==i){var o=i*r*4*4,s=this.context.gl,u=this.state.weights;for(var l in u){var g=u[l];g.aggregationBuffer&&g.aggregationBuffer.delete(),g.aggregationBuffer=new ga.Buffer(s,{byteLength:o,accessor:{size:4,type:5126,divisor:1}})}}}},{key:"updateResults",value:function(r){var i=r.aggregationData,o=r.maxMinData,s=r.maxData,u=r.minData,l=this.state.weights.count;l&&(l.aggregationData=i,l.maxMinData=o,l.maxData=s,l.minData=u)}},{key:"_updateAggregation",value:function(r){var i=this.state,o=i.cpuGridAggregator,s=i.gpuGridAggregator,u=i.gridOffset,l=i.posOffset,g=i.translation,f=g===void 0?[0,0]:g,c=i.scaling,d=c===void 0?[0,0,0]:c,h=i.boundingBox,m=i.projectPoints,y=i.gpuAggregation,O=i.numCol,C=i.numRow,b=r.props,P=this.context.viewport,w=this.getAttributes(),M=this.getNumInstances();if(y){var N=this.state.weights;s.run({weights:N,cellSize:[u.xOffset,u.yOffset],numCol:O,numRow:C,translation:f,scaling:d,vertexCount:M,projectPoints:m,attributes:w,moduleSettings:this.getModuleSettings()})}else{var D=o(b,{gridOffset:u,projectPoints:m,attributes:w,viewport:P,posOffset:l,boundingBox:h});this.setState({layerData:D})}}},{key:"_updateWeightBins",value:function(){var r=this.state.getValue,i=new Me(this.state.layerData.data||[],{getValue:r});this.setState({sortedBins:i})}},{key:"_uploadAggregationResults",value:function(){var r=this.state,i=r.numCol,o=r.numRow,s=this.state.layerData.data,u=this.state.sortedBins,l=u.aggregatedBins,g=u.minValue,f=u.maxValue,c=u.totalCount,d=4,h=i*o*d,m=new Float32Array(h).fill(0),y=ru(l),O;try{for(y.s();!(O=y.n()).done;){var C=O.value,b=s[C.i],P=b.lonIdx,w=b.latIdx,M=C.value,D=C.counts,N=(P+w*i)*d;m[N]=M,m[N+d-1]=D}}catch(W){y.e(W)}finally{y.f()}var V=new Float32Array([f,0,0,g]),q=new Float32Array([f,0,0,c]),te=new Float32Array([g,0,0,c]);this.updateResults({aggregationData:m,maxMinData:V,maxData:q,minData:te})}}]),e}(Z);(0,sr.default)(ce,"layerName","GridAggregationLayer");function ou(t){var a=su();return function(){var n=(0,Ne.default)(t),r;if(a){var i=(0,Ne.default)(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return(0,xa.default)(this,r)}}function su(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function pa(t,a){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);a&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function ur(t){for(var a=1;a<arguments.length;a++){var e=arguments[a]!=null?arguments[a]:{};a%2?pa(Object(e),!0).forEach(function(n){(0,pe.default)(t,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):pa(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}return t}var uu=ur(ur({},we.defaultProps),{},{getPosition:{type:"accessor",value:function(a){return a.position}},getWeight:{type:"accessor",value:1},gpuAggregation:!0,aggregation:"SUM"}),va="positions",lu={data:{props:["cellSizePixels"]},weights:{props:["aggregation"],accessors:["getWeight"]}},Pt=function(t){(0,ya.default)(e,t);var a=ou(e);function e(){var n;(0,ma.default)(this,e);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return n=a.call.apply(a,[this].concat(i)),(0,pe.default)((0,ha.default)(n),"state",void 0),n}return(0,da.default)(e,[{key:"initializeState",value:function(){var r,i=this.context.gl;if(!we.isSupported(i)){this.setState({supported:!1}),lr.log.error("ScreenGridLayer: ".concat(this.id," is not supported on this browser"))();return}(0,Ct.default)((0,Ne.default)(e.prototype),"initializeAggregationLayer",this).call(this,{dimensions:lu,getCellSize:function(l){return l.cellSizePixels}});var o={count:{size:1,operation:E.SUM,needMax:!0,maxTexture:Te(i,{id:"".concat(this.id,"-max-texture")})}};this.setState({supported:!0,projectPoints:!0,weights:o,subLayerData:{attributes:{}},maxTexture:o.count.maxTexture,positionAttributeName:"positions",posOffset:[0,0],translation:[1,-1]});var s=this.getAttributeManager();s.add((r={},(0,pe.default)(r,va,{size:3,accessor:"getPosition",type:5130,fp64:this.use64bitPositions()}),(0,pe.default)(r,"count",{size:3,accessor:"getWeight"}),r))}},{key:"shouldUpdateState",value:function(r){var i=r.changeFlags;return this.state.supported&&i.somethingChanged}},{key:"updateState",value:function(r){(0,Ct.default)((0,Ne.default)(e.prototype),"updateState",this).call(this,r)}},{key:"renderLayers",value:function(){if(!this.state.supported)return[];var r=this.state,i=r.maxTexture,o=r.numRow,s=r.numCol,u=r.weights,l=this.props.updateTriggers,g=u.count.aggregationBuffer,f=this.getSubLayerClass("cells",we);return new f(this.props,this.getSubLayerProps({id:"cell-layer",updateTriggers:l}),{data:{attributes:{instanceCounts:g}},maxTexture:i,numInstances:o*s})}},{key:"finalizeState",value:function(r){(0,Ct.default)((0,Ne.default)(e.prototype),"finalizeState",this).call(this,r);var i=this.state,o=i.aggregationBuffer,s=i.maxBuffer,u=i.maxTexture;o?.delete(),s?.delete(),u?.delete()}},{key:"getPickingInfo",value:function(r){var i=r.info,o=i.index;if(o>=0){var s=this.state,u=s.gpuGridAggregator,l=s.gpuAggregation,g=s.weights,f=l?u.getData("count"):g.count;i.object=G.getAggregationData(ur({pixelIndex:o},f))}return i}},{key:"updateResults",value:function(r){var i=r.aggregationData,o=r.maxData,s=this.state.weights.count;s.aggregationData=i,s.aggregationBuffer.setData({data:i}),s.maxData=o,s.maxTexture.setImageData({data:o})}},{key:"updateAggregationState",value:function(r){var i=r.props.cellSizePixels,o=r.oldProps.cellSizePixels!==i,s=r.changeFlags.viewportChanged,u=r.props.gpuAggregation;this.state.gpuAggregation!==r.props.gpuAggregation&&u&&!G.isSupported(this.context.gl)&&(lr.log.warn("GPU Grid Aggregation not supported, falling back to CPU")(),u=!1);var l=u!==this.state.gpuAggregation;this.setState({gpuAggregation:u});var g=this.isAttributeChanged(va),f=this.state.dimensions,c=f.data,d=f.weights,h=g||l||s||this.isAggregationDirty(r,{compareAll:u,dimension:c}),m=this.isAggregationDirty(r,{dimension:d});this.setState({aggregationDataDirty:h,aggregationWeightsDirty:m});var y=this.context.viewport;if(s||o){var O=y.width,C=y.height,b=Math.ceil(O/i),P=Math.ceil(C/i);this.allocateResources(P,b),this.setState({scaling:[O/2,-C/2,1],gridOffset:{xOffset:i,yOffset:i},width:O,height:C,numCol:b,numRow:P})}m&&this._updateAccessors(r),(h||m)&&this._resetResults()}},{key:"_updateAccessors",value:function(r){var i=r.props,o=i.getWeight,s=i.aggregation,u=i.data,l=this.state.weights.count;l&&(l.getWeight=o,l.operation=E[s]),this.setState({getValue:be(s,o,{data:u})})}},{key:"_resetResults",value:function(){var r=this.state.weights.count;r&&(r.aggregationData=null)}}]),e}(ce);(0,pe.default)(Pt,"layerName","ScreenGridLayer");(0,pe.default)(Pt,"defaultProps",uu);var Pa=v(z()),wa=v(U()),Da=v(K()),Ma=v(H()),Ea=v($()),wt=v(j()),cr=v(L()),Ra=v(Se());var fr=v(Zt()),gr=v(L()),Oa=v(z()),Ta=v(U());function Sa(t,a){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);a&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function J(t){for(var a=1;a<arguments.length;a++){var e=arguments[a]!=null?arguments[a]:{};a%2?Sa(Object(e),!0).forEach(function(n){(0,gr.default)(t,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):Sa(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}return t}function _a(){}var ba=["getBins","getDomain","getScaleFunc"],Aa=[{key:"fillColor",accessor:"getFillColor",pickingInfo:"colorValue",getBins:{triggers:{value:{prop:"getColorValue",updateTrigger:"getColorValue"},weight:{prop:"getColorWeight",updateTrigger:"getColorWeight"},aggregation:{prop:"colorAggregation"},filterData:{prop:"_filterData",updateTrigger:"_filterData"}}},getDomain:{triggers:{lowerPercentile:{prop:"lowerPercentile"},upperPercentile:{prop:"upperPercentile"},scaleType:{prop:"colorScaleType"}}},getScaleFunc:{triggers:{domain:{prop:"colorDomain"},range:{prop:"colorRange"}},onSet:{props:"onSetColorDomain"}},nullValue:[0,0,0,0]},{key:"elevation",accessor:"getElevation",pickingInfo:"elevationValue",getBins:{triggers:{value:{prop:"getElevationValue",updateTrigger:"getElevationValue"},weight:{prop:"getElevationWeight",updateTrigger:"getElevationWeight"},aggregation:{prop:"elevationAggregation"},filterData:{prop:"_filterData",updateTrigger:"_filterData"}}},getDomain:{triggers:{lowerPercentile:{prop:"elevationLowerPercentile"},upperPercentile:{prop:"elevationUpperPercentile"},scaleType:{prop:"elevationScaleType"}}},getScaleFunc:{triggers:{domain:{prop:"elevationDomain"},range:{prop:"elevationRange"}},onSet:{props:"onSetElevationDomain"}},nullValue:-1}],fu=function(a){return a.cellSize},Ie=function(){function t(a){(0,Oa.default)(this,t),this.state={layerData:{},dimensions:{}},this.changeFlags={},this.dimensionUpdaters={},this._getCellSize=a.getCellSize||fu,this._getAggregator=a.getAggregator,this._addDimension(a.dimensions||Aa)}return(0,Ta.default)(t,[{key:"updateState",value:function(e,n){var r=e.oldProps,i=e.props,o=e.changeFlags;this.updateGetValueFuncs(r,i,o);var s=this.needsReProjectPoints(r,i,o),u=!1;if(o.dataChanged||s)this.getAggregatedData(i,n),u=!0;else{var l=this.getDimensionChanges(r,i,o)||[];l.forEach(function(g){return typeof g=="function"&&g()}),u=!0}return this.setState({aggregationDirty:u}),this.state}},{key:"setState",value:function(e){this.state=J(J({},this.state),e)}},{key:"setDimensionState",value:function(e,n){this.setState({dimensions:J(J({},this.state.dimensions),{},(0,gr.default)({},e,J(J({},this.state.dimensions[e]),n)))})}},{key:"normalizeResult",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return e.hexagons?J({data:e.hexagons},e):e.layerData?J({data:e.layerData},e):e}},{key:"getAggregatedData",value:function(e,n){var r=this._getAggregator(e),i=r(e,n);this.setState({layerData:this.normalizeResult(i)}),this.changeFlags={layerData:!0},this.getSortedBins(e)}},{key:"updateGetValueFuncs",value:function(e,n,r){for(var i in this.dimensionUpdaters){var o=this.dimensionUpdaters[i].getBins.triggers,s=o.value,u=o.weight,l=o.aggregation,g=n[s.prop],f=this.needUpdateDimensionStep(this.dimensionUpdaters[i].getBins,e,n,r);f&&(g?g=en(g,{data:n.data}):g=be(n[l.prop],n[u.prop],{data:n.data})),g&&this.setDimensionState(i,{getValue:g})}}},{key:"needsReProjectPoints",value:function(e,n,r){return this._getCellSize(e)!==this._getCellSize(n)||this._getAggregator(e)!==this._getAggregator(n)||r.updateTriggersChanged&&(r.updateTriggersChanged.all||r.updateTriggersChanged.getPosition)}},{key:"addDimension",value:function(e){this._addDimension(e)}},{key:"_addDimension",value:function(){var e=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];n.forEach(function(r){var i=r.key;e.dimensionUpdaters[i]=e.getDimensionUpdaters(r),e.state.dimensions[i]={getValue:null,domain:null,sortedBins:null,scaleFunc:_a}})}},{key:"getDimensionUpdaters",value:function(e){var n=e.key,r=e.accessor,i=e.pickingInfo,o=e.getBins,s=e.getDomain,u=e.getScaleFunc,l=e.nullValue;return{key:n,accessor:r,pickingInfo:i,getBins:J({updater:this.getDimensionSortedBins},o),getDomain:J({updater:this.getDimensionValueDomain},s),getScaleFunc:J({updater:this.getDimensionScale},u),attributeAccessor:this.getSubLayerDimensionAttribute(n,l)}}},{key:"needUpdateDimensionStep",value:function(e,n,r,i){return Object.values(e.triggers).some(function(o){return o.updateTrigger?i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged[o.updateTrigger]):n[o.prop]!==r[o.prop]})}},{key:"getDimensionChanges",value:function(e,n,r){var i=this,o=[],s=function(g){var f=ba.find(function(c){return i.needUpdateDimensionStep(i.dimensionUpdaters[g][c],e,n,r)});f&&o.push(i.dimensionUpdaters[g][f].updater.bind(i,n,i.dimensionUpdaters[g]))};for(var u in this.dimensionUpdaters)s(u);return o.length?o:null}},{key:"getUpdateTriggers",value:function(e){var n=this,r=e.updateTriggers||{},i={},o=function(l){var g=n.dimensionUpdaters[l].accessor;i[g]={},ba.forEach(function(f){Object.values(n.dimensionUpdaters[l][f].triggers).forEach(function(c){var d=c.prop,h=c.updateTrigger;if(h){var m=r[h];(0,fr.default)(m)==="object"&&!Array.isArray(m)?Object.assign(i[g],m):m!==void 0&&(i[g][d]=m)}else i[g][d]=e[d]})})};for(var s in this.dimensionUpdaters)o(s);return i}},{key:"getSortedBins",value:function(e){for(var n in this.dimensionUpdaters)this.getDimensionSortedBins(e,this.dimensionUpdaters[n])}},{key:"getDimensionSortedBins",value:function(e,n){var r=n.key,i=this.state.dimensions[r].getValue,o=new Me(this.state.layerData.data||[],{getValue:i,filterData:e._filterData});this.setDimensionState(r,{sortedBins:o}),this.getDimensionValueDomain(e,n)}},{key:"getDimensionValueDomain",value:function(e,n){var r=n.getDomain,i=n.key,o=r.triggers,s=o.lowerPercentile,u=o.upperPercentile,l=o.scaleType,g=this.state.dimensions[i].sortedBins.getValueDomainByScale(e[l.prop],[e[s.prop],e[u.prop]]);this.setDimensionState(i,{valueDomain:g}),this.getDimensionScale(e,n)}},{key:"getDimensionScale",value:function(e,n){var r=n.key,i=n.getScaleFunc,o=n.getDomain,s=i.triggers,u=s.domain,l=s.range,g=o.triggers.scaleType,f=i.onSet,c=e[l.prop],d=e[u.prop]||this.state.dimensions[r].valueDomain,h=jn(g&&e[g.prop]),m=h(d,c);(0,fr.default)(f)==="object"&&typeof e[f.props]=="function"&&e[f.props](m.domain()),this.setDimensionState(r,{scaleFunc:m})}},{key:"getSubLayerDimensionAttribute",value:function(e,n){var r=this;return function(i){var o=r.state.dimensions[e],s=o.sortedBins,u=o.scaleFunc,l=s.binMap[i.index];if(l&&l.counts===0)return n;var g=l&&l.value,f=u.domain(),c=g>=f[0]&&g<=f[f.length-1];return c?u(g):n}}},{key:"getSubLayerAccessors",value:function(e){var n={};for(var r in this.dimensionUpdaters){var i=this.dimensionUpdaters[r].accessor;n[i]=this.getSubLayerDimensionAttribute(e,r)}return n}},{key:"getPickingInfo",value:function(e){var n=e.info,r=n.picked&&n.index>-1,i=null;if(r){var o=this.state.layerData.data[n.index],s={};for(var u in this.dimensionUpdaters){var l=this.dimensionUpdaters[u].pickingInfo,g=this.state.dimensions[u].sortedBins,f=g.binMap[o.index]&&g.binMap[o.index].value;s[l]=f}i=Object.assign(s,o,{points:o.filteredPoints||o.points})}return n.picked=Boolean(i),n.object=i,n}},{key:"getAccessor",value:function(e){return this.dimensionUpdaters.hasOwnProperty(e)?this.dimensionUpdaters[e].attributeAccessor:_a}}],[{key:"defaultDimensions",value:function(){return Aa}}]),t}();function gu(t){var a=cu();return function(){var n=(0,wt.default)(t),r;if(a){var i=(0,wt.default)(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return(0,Ea.default)(this,r)}}function cu(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ca(){}var pu={colorDomain:null,colorRange:Y,getColorValue:{type:"accessor",value:null},getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",lowerPercentile:{type:"number",min:0,max:100,value:0},upperPercentile:{type:"number",min:0,max:100,value:100},colorScaleType:"quantize",onSetColorDomain:Ca,elevationDomain:null,elevationRange:[0,1e3],getElevationValue:{type:"accessor",value:null},getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationLowerPercentile:{type:"number",min:0,max:100,value:0},elevationUpperPercentile:{type:"number",min:0,max:100,value:100},elevationScale:{type:"number",min:0,value:1},elevationScaleType:"linear",onSetElevationDomain:Ca,gridAggregator:Ee,cellSize:{type:"number",min:0,max:1e3,value:1e3},coverage:{type:"number",min:0,max:1,value:1},getPosition:{type:"accessor",value:function(a){return a.position}},extruded:!1,material:!0,_filterData:{type:"function",value:null,optional:!0}},ve=function(t){(0,Ma.default)(e,t);var a=gu(e);function e(){return(0,Pa.default)(this,e),a.apply(this,arguments)}return(0,wa.default)(e,[{key:"initializeState",value:function(){var r=new Ie({getAggregator:function(s){return s.gridAggregator},getCellSize:function(s){return s.cellSize}});this.state={cpuAggregator:r,aggregatorState:r.state};var i=this.getAttributeManager();i.add({positions:{size:3,type:5130,accessor:"getPosition"}})}},{key:"updateState",value:function(r){(0,Da.default)((0,wt.default)(e.prototype),"updateState",this).call(this,r),this.setState({aggregatorState:this.state.cpuAggregator.updateState(r,{viewport:this.context.viewport,attributes:this.getAttributes(),numInstances:this.getNumInstances()})})}},{key:"getPickingInfo",value:function(r){var i=r.info;return this.state.cpuAggregator.getPickingInfo({info:i})}},{key:"_onGetSublayerColor",value:function(r){return this.state.cpuAggregator.getAccessor("fillColor")(r)}},{key:"_onGetSublayerElevation",value:function(r){return this.state.cpuAggregator.getAccessor("elevation")(r)}},{key:"_getSublayerUpdateTriggers",value:function(){return this.state.cpuAggregator.getUpdateTriggers(this.props)}},{key:"renderLayers",value:function(){var r=this.props,i=r.elevationScale,o=r.extruded,s=r.cellSize,u=r.coverage,l=r.material,g=r.transitions,f=this.state.cpuAggregator,c=this.getSubLayerClass("grid-cell",Ra.GridCellLayer),d=this._getSublayerUpdateTriggers();return new c({cellSize:s,coverage:u,material:l,elevationScale:i,extruded:o,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:g&&{getFillColor:g.getColorValue||g.getColorWeight,getElevation:g.getElevationValue||g.getElevationWeight}},this.getSubLayerProps({id:"grid-cell",updateTriggers:d}),{data:f.state.layerData.data})}}]),e}(Z);(0,cr.default)(ve,"layerName","CPUGridLayer");(0,cr.default)(ve,"defaultProps",pu);var za=v(z()),Ua=v(U()),ka=v(ae()),Ga=v(K()),Wa=v(H()),ja=v($()),Mt=v(j()),Je=v(L()),Va=v(B()),Ha=v(Se());var Le=Math.PI/3,vu=[0,Le,2*Le,3*Le,4*Le,5*Le];function mu(t){return t[0]}function du(t){return t[1]}function pr(){var t=0,a=0,e=1,n=1,r=mu,i=du,o,s,u;function l(f){var c={},d=[],h,m=f.length;for(h=0;h<m;++h)if(!(isNaN(O=+r.call(null,y=f[h],h,f))||isNaN(C=+i.call(null,y,h,f)))){var y,O,C,b=Math.round(C=C/u),P=Math.round(O=O/s-(b&1)/2),w=C-b;if(Math.abs(w)*3>1){var M=O-P,D=P+(O<P?-1:1)/2,N=b+(C<b?-1:1),V=O-D,q=C-N;M*M+w*w>V*V+q*q&&(P=D+(b&1?1:-1)/2,b=N)}var te=P+"-"+b,W=c[te];W?W.push(y):(d.push(W=c[te]=[y]),W.x=(P+(b&1)/2)*s,W.y=b*u)}return d}function g(f){var c=0,d=0;return vu.map(function(h){var m=Math.sin(h)*f,y=-Math.cos(h)*f,O=m-c,C=y-d;return c=m,d=y,[O,C]})}return l.hexagon=function(f){return"m"+g(f==null?o:+f).join("l")+"z"},l.centers=function(){for(var f=[],c=Math.round(a/u),d=Math.round(t/s),h=c*u;h<n+o;h+=u,++c)for(var m=d*s+(c&1)*s/2;m<e+s/2;m+=s)f.push([m,h]);return f},l.mesh=function(){var f=g(o).slice(0,4).join("l");return l.centers().map(function(c){return"M"+c+"m"+f}).join("")},l.x=function(f){return arguments.length?(r=f,l):r},l.y=function(f){return arguments.length?(i=f,l):i},l.radius=function(f){return arguments.length?(o=+f,s=o*2*Math.sin(Le),u=o*1.5,l):o},l.size=function(f){return arguments.length?(t=a=0,e=+f[0],n=+f[1],l):[e-t,n-a]},l.extent=function(f){return arguments.length?(t=+f[0][0],a=+f[0][1],e=+f[1][0],n=+f[1][1],l):[[t,a],[e,n]]},l.radius(1)}var Dt=v(B());function hu(t,a){var e=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=yu(t))||a&&t&&typeof t.length=="number"){e&&(t=e);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(l){throw l},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
344
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,s;return{s:function(){e=e.call(t)},n:function(){var l=e.next();return i=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!i&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function yu(t,a){if(t){if(typeof t=="string")return Na(t,a);var e=Object.prototype.toString.call(t).slice(8,-1);if(e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set")return Array.from(t);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return Na(t,a)}}function Na(t,a){(a==null||a>t.length)&&(a=t.length);for(var e=0,n=new Array(a);e<a;e++)n[e]=t[e];return n}function Ia(t,a){var e=t.data,n=t.radius,r=a.viewport,i=a.attributes,o=e.length?xu(e,a):null,s=Su(n,r,o),u=[],l=(0,Dt.createIterable)(e),g=l.iterable,f=l.objectInfo,c=i.positions.value,d=i.positions.getAccessor(),h=d.size,m=hu(g),y;try{for(m.s();!(y=m.n()).done;){var O=y.value;f.index++;var C=f.index*h,b=[c[C],c[C+1]],P=Number.isFinite(b[0])&&Number.isFinite(b[1]);P?u.push({screenCoord:r.projectFlat(b),source:O,index:f.index}):Dt.log.warn("HexagonLayer: invalid position")()}}catch(D){m.e(D)}finally{m.f()}var w=pr().radius(s).x(function(D){return D.screenCoord[0]}).y(function(D){return D.screenCoord[1]}),M=w(u);return{hexagons:M.map(function(D,N){return{position:r.unprojectFlat([D.x,D.y]),points:D,index:N}}),radiusCommon:s}}function xu(t,a){var e=a.attributes,n=e.positions.value,r=e.positions.getAccessor(),i=r.size,o=1/0,s=1/0,u=-1/0,l=-1/0,g;for(g=0;g<i*t.length;g+=i){var f=n[g],c=n[g+1],d=Number.isFinite(f)&&Number.isFinite(c);d&&(o=Math.min(f,o),u=Math.max(f,u),s=Math.min(c,s),l=Math.max(c,l))}return[o,s,u,l].every(Number.isFinite)?[(o+u)/2,(s+l)/2]:null}function Su(t,a,e){var n=a.getDistanceScales(e),r=n.unitsPerMeter;return t*r[0]}function La(t,a){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);a&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function Fa(t){for(var a=1;a<arguments.length;a++){var e=arguments[a]!=null?arguments[a]:{};a%2?La(Object(e),!0).forEach(function(n){(0,Je.default)(t,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):La(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}return t}function _u(t){var a=bu();return function(){var n=(0,Mt.default)(t),r;if(a){var i=(0,Mt.default)(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return(0,ja.default)(this,r)}}function bu(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ba(){}var Au={colorDomain:null,colorRange:Y,getColorValue:{type:"accessor",value:null},getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",lowerPercentile:{type:"number",value:0,min:0,max:100},upperPercentile:{type:"number",value:100,min:0,max:100},colorScaleType:"quantize",onSetColorDomain:Ba,elevationDomain:null,elevationRange:[0,1e3],getElevationValue:{type:"accessor",value:null},getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationLowerPercentile:{type:"number",value:0,min:0,max:100},elevationUpperPercentile:{type:"number",value:100,min:0,max:100},elevationScale:{type:"number",min:0,value:1},elevationScaleType:"linear",onSetElevationDomain:Ba,radius:{type:"number",value:1e3,min:1},coverage:{type:"number",min:0,max:1,value:1},extruded:!1,hexagonAggregator:Ia,getPosition:{type:"accessor",value:function(a){return a.position}},material:!0,_filterData:{type:"function",value:null,optional:!0}},Et=function(t){(0,Wa.default)(e,t);var a=_u(e);function e(){var n;(0,za.default)(this,e);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return n=a.call.apply(a,[this].concat(i)),(0,Je.default)((0,ka.default)(n),"state",void 0),n}return(0,Ua.default)(e,[{key:"initializeState",value:function(){var r=new Ie({getAggregator:function(s){return s.hexagonAggregator},getCellSize:function(s){return s.radius}});this.state={cpuAggregator:r,aggregatorState:r.state,vertices:null};var i=this.getAttributeManager();i.add({positions:{size:3,type:5130,accessor:"getPosition"}})}},{key:"updateState",value:function(r){if((0,Ga.default)((0,Mt.default)(e.prototype),"updateState",this).call(this,r),r.changeFlags.propsOrDataChanged){var i=this.state.cpuAggregator.updateState(r,{viewport:this.context.viewport,attributes:this.getAttributes()});if(this.state.aggregatorState.layerData!==i.layerData){var o=i.layerData||{},s=o.hexagonVertices;this.setState({vertices:s&&this.convertLatLngToMeterOffset(s)})}this.setState({aggregatorState:i})}}},{key:"convertLatLngToMeterOffset",value:function(r){var i=this.context.viewport;if(Array.isArray(r)&&r.length===6){var o=r[0],s=r[3],u=[(o[0]+s[0])/2,(o[1]+s[1])/2],l=i.projectFlat(u),g=i.getDistanceScales(u),f=g.metersPerUnit,c=r.map(function(d){var h=i.projectFlat(d);return[(h[0]-l[0])*f[0],(h[1]-l[1])*f[1]]});return c}return Va.log.error("HexagonLayer: hexagonVertices needs to be an array of 6 points")(),null}},{key:"getPickingInfo",value:function(r){var i=r.info;return this.state.cpuAggregator.getPickingInfo({info:i})}},{key:"_onGetSublayerColor",value:function(r){return this.state.cpuAggregator.getAccessor("fillColor")(r)}},{key:"_onGetSublayerElevation",value:function(r){return this.state.cpuAggregator.getAccessor("elevation")(r)}},{key:"_getSublayerUpdateTriggers",value:function(){return this.state.cpuAggregator.getUpdateTriggers(this.props)}},{key:"renderLayers",value:function(){var r=this.props,i=r.elevationScale,o=r.extruded,s=r.coverage,u=r.material,l=r.transitions,g=this.state,f=g.aggregatorState,c=g.vertices,d=this.getSubLayerClass("hexagon-cell",Ha.ColumnLayer),h=this._getSublayerUpdateTriggers(),m=c?{vertices:c,radius:1}:{radius:f.layerData.radiusCommon||1,radiusUnits:"common",angle:90};return new d(Fa(Fa({},m),{},{diskResolution:6,elevationScale:i,extruded:o,coverage:s,material:u,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:l&&{getFillColor:l.getColorValue||l.getColorWeight,getElevation:l.getElevationValue||l.getElevationWeight}}),this.getSubLayerProps({id:"hexagon-cell",updateTriggers:h}),{data:f.layerData.data})}}]),e}(Z);(0,Je.default)(Et,"layerName","HexagonLayer");(0,Je.default)(Et,"defaultProps",Au);var Pi=v(z()),wi=v(U()),mr=v(K()),Di=v(H()),Mi=v($()),tt=v(j()),rt=v(L()),Ft=v(Se());var xi=v(L()),Si=v(B());var _=v(L()),S,x=.5,T=1/6,p={N:[0,x],E:[x,0],S:[0,-x],W:[-x,0],NE:[x,x],NW:[-x,x],SE:[x,-x],SW:[-x,-x]},Fe=[p.W,p.SW,p.S],Be=[p.S,p.SE,p.E],ze=[p.E,p.NE,p.N],Ue=[p.NW,p.W,p.N],ke=[[-x,T],[-x,-T],[-T,-x],[T,-x]],Ge=[[-T,-x],[T,-x],[x,-T],[x,T]],We=[[x,-T],[x,T],[T,x],[-T,x]],je=[[-x,T],[-x,-T],[T,x],[-T,x]],$a=[p.W,p.SW,p.SE,p.E],Xa=[p.S,p.SE,p.NE,p.N],qa=[p.NW,p.W,p.E,p.NE],Ya=[p.NW,p.SW,p.S,p.N],Ka=[[-x,T],[-x,-T],[x,-T],[x,T]],Qa=[[-T,-x],[T,-x],[T,x],[-T,x]],Ou=[p.NW,p.SW,p.SE,p.NE],Za=[p.NW,p.SW,p.SE,p.E,p.N],Ja=[p.W,p.SW,p.SE,p.NE,p.N],ei=[p.NW,p.W,p.S,p.SE,p.NE],ti=[p.NW,p.SW,p.S,p.E,p.NE],ri=[p.NW,p.W,[x,-T],[x,T],p.N],ni=[[-T,-x],[T,-x],p.E,p.NE,p.N],ai=[[-x,T],[-x,-T],p.S,p.SE,p.E],ii=[p.W,p.SW,p.S,[T,x],[-T,x]],oi=[p.NW,p.W,[-T,-x],[T,-x],p.N],si=[[-x,T],[-x,-T],p.E,p.NE,p.N],ui=[p.S,p.SE,p.E,[T,x],[-T,x]],li=[p.W,p.SW,p.S,[x,-T],[x,T]],fi=[p.W,p.SW,p.SE,p.E,[T,x],[-T,x]],gi=[[-x,T],[-x,-T],p.S,p.SE,p.NE,p.N],ci=[p.NW,p.W,[-T,-x],[T,-x],p.E,p.NE],pi=[p.NW,p.SW,p.S,[x,-T],[x,T],p.N],Ve=[p.W,p.SW,p.S,p.E,p.NE,p.N],He=[p.NW,p.W,p.S,p.SE,p.E,p.N],Rt=[[-x,T],[-x,-T],[-T,-x],[T,-x],p.E,p.NE,p.N],Nt=[p.W,p.SW,p.S,[x,-T],[x,T],[T,x],[-T,x]],It=[p.NW,p.W,[-T,-x],[T,-x],[x,-T],[x,T],p.N],Lt=[[-x,T],[-x,-T],p.S,p.SE,p.E,[T,x],[-T,x]],vi=[[-x,T],[-x,-T],[-T,-x],[T,-x],[x,-T],[x,T],[T,x],[-T,x]],mi={0:[],1:[[p.W,p.S]],2:[[p.S,p.E]],3:[[p.W,p.E]],4:[[p.N,p.E]],5:{0:[[p.W,p.S],[p.N,p.E]],1:[[p.W,p.N],[p.S,p.E]]},6:[[p.N,p.S]],7:[[p.W,p.N]],8:[[p.W,p.N]],9:[[p.N,p.S]],10:{0:[[p.W,p.N],[p.S,p.E]],1:[[p.W,p.S],[p.N,p.E]]},11:[[p.N,p.E]],12:[[p.W,p.E]],13:[[p.S,p.E]],14:[[p.W,p.S]],15:[]};function A(t){return parseInt(t,4)}var di=(S={},(0,_.default)(S,A("0000"),[]),(0,_.default)(S,A("2222"),[]),(0,_.default)(S,A("2221"),[Fe]),(0,_.default)(S,A("2212"),[Be]),(0,_.default)(S,A("2122"),[ze]),(0,_.default)(S,A("1222"),[Ue]),(0,_.default)(S,A("0001"),[Fe]),(0,_.default)(S,A("0010"),[Be]),(0,_.default)(S,A("0100"),[ze]),(0,_.default)(S,A("1000"),[Ue]),(0,_.default)(S,A("2220"),[ke]),(0,_.default)(S,A("2202"),[Ge]),(0,_.default)(S,A("2022"),[We]),(0,_.default)(S,A("0222"),[je]),(0,_.default)(S,A("0002"),[ke]),(0,_.default)(S,A("0020"),[Ge]),(0,_.default)(S,A("0200"),[We]),(0,_.default)(S,A("2000"),[je]),(0,_.default)(S,A("0011"),[$a]),(0,_.default)(S,A("0110"),[Xa]),(0,_.default)(S,A("1100"),[qa]),(0,_.default)(S,A("1001"),[Ya]),(0,_.default)(S,A("2211"),[$a]),(0,_.default)(S,A("2112"),[Xa]),(0,_.default)(S,A("1122"),[qa]),(0,_.default)(S,A("1221"),[Ya]),(0,_.default)(S,A("2200"),[Ka]),(0,_.default)(S,A("2002"),[Qa]),(0,_.default)(S,A("0022"),[Ka]),(0,_.default)(S,A("0220"),[Qa]),(0,_.default)(S,A("1111"),[Ou]),(0,_.default)(S,A("1211"),[Za]),(0,_.default)(S,A("2111"),[Ja]),(0,_.default)(S,A("1112"),[ei]),(0,_.default)(S,A("1121"),[ti]),(0,_.default)(S,A("1011"),[Za]),(0,_.default)(S,A("0111"),[Ja]),(0,_.default)(S,A("1110"),[ei]),(0,_.default)(S,A("1101"),[ti]),(0,_.default)(S,A("1200"),[ri]),(0,_.default)(S,A("0120"),[ni]),(0,_.default)(S,A("0012"),[ai]),(0,_.default)(S,A("2001"),[ii]),(0,_.default)(S,A("1022"),[ri]),(0,_.default)(S,A("2102"),[ni]),(0,_.default)(S,A("2210"),[ai]),(0,_.default)(S,A("0221"),[ii]),(0,_.default)(S,A("1002"),[oi]),(0,_.default)(S,A("2100"),[si]),(0,_.default)(S,A("0210"),[ui]),(0,_.default)(S,A("0021"),[li]),(0,_.default)(S,A("1220"),[oi]),(0,_.default)(S,A("0122"),[si]),(0,_.default)(S,A("2012"),[ui]),(0,_.default)(S,A("2201"),[li]),(0,_.default)(S,A("0211"),[fi]),(0,_.default)(S,A("2110"),[gi]),(0,_.default)(S,A("1102"),[ci]),(0,_.default)(S,A("1021"),[pi]),(0,_.default)(S,A("2011"),[fi]),(0,_.default)(S,A("0112"),[gi]),(0,_.default)(S,A("1120"),[ci]),(0,_.default)(S,A("1201"),[pi]),(0,_.default)(S,A("2101"),[Ve]),(0,_.default)(S,A("0121"),[Ve]),(0,_.default)(S,A("1012"),[He]),(0,_.default)(S,A("1210"),[He]),(0,_.default)(S,A("0101"),{0:[Fe,ze],1:[Ve],2:[Ve]}),(0,_.default)(S,A("1010"),{0:[Ue,Be],1:[He],2:[He]}),(0,_.default)(S,A("2121"),{0:[Ve],1:[Ve],2:[Fe,ze]}),(0,_.default)(S,A("1212"),{0:[He],1:[He],2:[Ue,Be]}),(0,_.default)(S,A("2120"),{0:[Rt],1:[Rt],2:[ke,ze]}),(0,_.default)(S,A("2021"),{0:[Nt],1:[Nt],2:[Fe,We]}),(0,_.default)(S,A("1202"),{0:[It],1:[It],2:[Ue,Ge]}),(0,_.default)(S,A("0212"),{0:[Lt],1:[Lt],2:[Be,je]}),(0,_.default)(S,A("0102"),{0:[ke,ze],1:[Rt],2:[Rt]}),(0,_.default)(S,A("0201"),{0:[Fe,We],1:[Nt],2:[Nt]}),(0,_.default)(S,A("1020"),{0:[Ue,Ge],1:[It],2:[It]}),(0,_.default)(S,A("2010"),{0:[Be,je],1:[Lt],2:[Lt]}),(0,_.default)(S,A("2020"),{0:[je,Ge],1:[vi],2:[ke,We]}),(0,_.default)(S,A("0202"),{0:[We,ke],1:[vi],2:[je,Ge]}),S);function hi(t,a){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);a&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function yi(t){for(var a=1;a<arguments.length;a++){var e=arguments[a]!=null?arguments[a]:{};a%2?hi(Object(e),!0).forEach(function(n){(0,xi.default)(t,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):hi(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}return t}var me={ISO_LINES:1,ISO_BANDS:2},Tu={zIndex:0,zOffset:.005};function et(t,a){return Array.isArray(a)?t<a[0]?0:t<a[1]?1:2:t>=a?1:0}function _i(t){var a=t.cellWeights,e=t.x,n=t.y,r=t.width,i=t.height,o=t.threshold;t.thresholdValue&&(Si.log.deprecated("thresholdValue","threshold")(),o=t.thresholdValue);var s=e<0,u=e>=r-1,l=n<0,g=n>=i-1,f=s||u||l||g,c={},d={};s||g?d.top=0:(c.top=a[(n+1)*r+e],d.top=et(c.top,o)),u||g?d.topRight=0:(c.topRight=a[(n+1)*r+e+1],d.topRight=et(c.topRight,o)),u||l?d.right=0:(c.right=a[n*r+e+1],d.right=et(c.right,o)),s||l?d.current=0:(c.current=a[n*r+e],d.current=et(c.current,o));var h=d.top,m=d.topRight,y=d.right,O=d.current,C=-1;Number.isFinite(o)&&(C=h<<3|m<<2|y<<1|O),Array.isArray(o)&&(C=h<<6|m<<4|y<<2|O);var b=0;return f||(b=et((c.top+c.topRight+c.right+c.current)/4,o)),{code:C,meanCode:b}}function vr(t){var a=t.gridOrigin,e=t.cellSize,n=t.x,r=t.y,i=t.code,o=t.meanCode,s=t.type,u=s===void 0?me.ISO_LINES:s,l=yi(yi({},Tu),t.thresholdData),g=u===me.ISO_BANDS?di[i]:mi[i];Array.isArray(g)||(g=g[o]);var f=l.zIndex*l.zOffset,c=(n+1)*e[0],d=(r+1)*e[1],h=a[0]+c,m=a[1]+d;if(u===me.ISO_BANDS){var y=[];return g.forEach(function(C){var b=[];C.forEach(function(P){var w=h+P[0]*e[0],M=m+P[1]*e[1];b.push([w,M,f])}),y.push(b)}),y}var O=[];return g.forEach(function(C){C.forEach(function(b){var P=h+b[0]*e[0],w=m+b[1]*e[1];O.push([P,w,f])})}),O}function bi(t,a){var e=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=Cu(t))||a&&t&&typeof t.length=="number"){e&&(t=e);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(l){throw l},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
345
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,s;return{s:function(){e=e.call(t)},n:function(){var l=e.next();return i=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!i&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function
|
|
339
|
+
`;function cr(t,a){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);a&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function wt(t){for(var a=1;a<arguments.length;a++){var e=arguments[a]!=null?arguments[a]:{};a%2?cr(Object(e),!0).forEach(function(n){p(t,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):cr(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}return t}function za(t){var a=Ua();return function(){var n=P(t),r;if(a){var i=P(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return z(this,r)}}function Ua(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var ka=[0,0,0,0],Ga=[0,255,0,255],Wa=["minColor","maxColor","colorRange","colorDomain"],ja={cellSizePixels:{value:100,min:1},cellMarginPixels:{value:2,min:0,max:5},colorDomain:null,colorRange:K},be=function(t){B(e,t);var a=za(e);function e(){var n;N(this,e);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return n=a.call.apply(a,[this].concat(i)),p(W(n),"state",void 0),n}return I(e,[{key:"getShaders",value:function(){return{vs:fr,fs:gr,modules:[_e.picking]}}},{key:"initializeState",value:function(){var r=this.context.gl,i=this.getAttributeManager();i.addInstanced({instancePositions:{size:3,update:this.calculateInstancePositions},instanceCounts:{size:4,noAlloc:!0}}),this.setState({model:this._getModel(r)})}},{key:"shouldUpdateState",value:function(r){var i=r.changeFlags;return i.somethingChanged}},{key:"updateState",value:function(r){E(P(e.prototype),"updateState",this).call(this,r);var i=r.oldProps,o=r.props,s=r.changeFlags,u=this.getAttributeManager();o.numInstances!==i.numInstances?u.invalidateAll():i.cellSizePixels!==o.cellSizePixels&&u.invalidate("instancePositions"),this._updateUniforms(i,o,s)}},{key:"draw",value:function(r){var i=r.uniforms,o=this.props,s=o.parameters,u=o.maxTexture,l=this.props.minColor||ka,g=this.props.maxColor||Ga,f=this.props.colorDomain||[1,0],c=this.state.model;c.setUniforms(i).setUniforms({minColor:l,maxColor:g,maxTexture:u,colorDomain:f}).draw({parameters:wt({depthTest:!1,depthMask:!1},s)})}},{key:"calculateInstancePositions",value:function(r,i){for(var o=i.numInstances,s=this.context.viewport,u=s.width,l=s.height,g=this.props.cellSizePixels,f=Math.ceil(u/g),c=r.value,v=r.size,h=0;h<o;h++){var d=h%f,y=Math.floor(h/f);c[h*v+0]=d*g/u*2-1,c[h*v+1]=1-y*g/l*2,c[h*v+2]=0}}},{key:"_getModel",value:function(r){return new se.Model(r,wt(wt({},this.getShaders()),{},{id:this.props.id,geometry:new se.Geometry({drawMode:6,attributes:{positions:new Float32Array([0,0,0,1,0,0,1,1,0,0,1,0])}}),isInstanced:!0}))}},{key:"_shouldUseMinMax",value:function(){var r=this.props,i=r.minColor,o=r.maxColor,s=r.colorDomain,u=r.colorRange;return i||o?(_e.log.deprecated("ScreenGridLayer props: minColor and maxColor","colorRange, colorDomain")(),!0):!(s||u)}},{key:"_updateUniforms",value:function(r,i,o){var s=this.state.model;if(Wa.some(function(y){return r[y]!==i[y]})&&s.setUniforms({shouldUseMinMax:this._shouldUseMinMax()}),r.colorRange!==i.colorRange&&s.setUniforms({colorRange:oe(i.colorRange)}),r.cellMarginPixels!==i.cellMarginPixels||r.cellSizePixels!==i.cellSizePixels||o.viewportChanged){var u=this.context.viewport,l=u.width,g=u.height,f=this.props,c=f.cellSizePixels,v=f.cellMarginPixels,h=c>v?v:0,d=new Float32Array([(c-h)/l*2,-(c-h)/g*2,1]);s.setUniforms({cellScale:d})}}}],[{key:"isSupported",value:function(r){return(0,se.hasFeatures)(r,[se.FEATURES.TEXTURE_FLOAT])}}]),e}(_e.Layer);p(be,"layerName","ScreenGridCellLayer");p(be,"defaultProps",ja);var Ae=R(G()),vr=R(Q());function pr(t,a){var e={};for(var n in t)a.includes(n)||(e[n]=t[n]);return e}function mr(t,a){var e=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=Va(t))||a&&t&&typeof t.length=="number"){e&&(t=e);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(l){throw l},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
340
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,s;return{s:function(){e=e.call(t)},n:function(){var l=e.next();return i=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!i&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function Va(t,a){if(t){if(typeof t=="string")return dr(t,a);var e=Object.prototype.toString.call(t).slice(8,-1);if(e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set")return Array.from(t);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return dr(t,a)}}function dr(t,a){(a==null||a>t.length)&&(a=t.length);for(var e=0,n=new Array(a);e<a;e++)n[e]=t[e];return n}function Ha(t){var a=$a();return function(){var n=P(t),r;if(a){var i=P(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return z(this,r)}}function $a(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Z=function(t){B(e,t);var a=Ha(e);function e(){var n;N(this,e);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return n=a.call.apply(a,[this].concat(i)),p(W(n),"state",void 0),n}return I(e,[{key:"initializeAggregationLayer",value:function(r){E(P(e.prototype),"initializeState",this).call(this,this.context),this.setState({ignoreProps:pr(this.constructor._propTypes,r.data.props),dimensions:r})}},{key:"updateState",value:function(r){E(P(e.prototype),"updateState",this).call(this,r);var i=r.changeFlags;if(i.extensionsChanged){var o=this.getShaders({});o&&o.defines&&(o.defines.NON_INSTANCED_MODEL=1),this.updateShaders(o)}this._updateAttributes()}},{key:"updateAttributes",value:function(r){this.setState({changedAttributes:r})}},{key:"getAttributes",value:function(){return this.getAttributeManager().getShaderAttributes()}},{key:"getModuleSettings",value:function(){var r=this.context,i=r.viewport,o=r.mousePosition,s=r.gl,u=Object.assign(Object.create(this.props),{viewport:i,mousePosition:o,pickingActive:0,devicePixelRatio:(0,vr.cssToDeviceRatio)(s)});return u}},{key:"updateShaders",value:function(r){}},{key:"isAggregationDirty",value:function(r){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=r.props,s=r.oldProps,u=r.changeFlags,l=i.compareAll,g=l===void 0?!1:l,f=i.dimension,c=this.state.ignoreProps,v=f.props,h=f.accessors,d=h===void 0?[]:h,y=u.updateTriggersChanged;if(u.dataChanged)return!0;if(y){if(y.all)return!0;var A=mr(d),T;try{for(A.s();!(T=A.n()).done;){var _=T.value;if(y[_])return!0}}catch(D){A.e(D)}finally{A.f()}}if(g)return u.extensionsChanged?!0:(0,Ae._compareProps)({oldProps:s,newProps:o,ignoreProps:c,propTypes:this.constructor._propTypes});var C=mr(v),w;try{for(C.s();!(w=C.n()).done;){var M=w.value;if(o[M]!==s[M])return!0}}catch(D){C.e(D)}finally{C.f()}return!1}},{key:"isAttributeChanged",value:function(r){var i=this.state.changedAttributes;return r?i&&i[r]!==void 0:!Xa(i)}},{key:"_getAttributeManager",value:function(){return new Ae.AttributeManager(this.context.gl,{id:this.props.id,stats:this.context.stats})}}]),e}(Ae.CompositeLayer);p(Z,"layerName","AggregationLayer");function Xa(t){var a=!0;for(var e in t){a=!1;break}return a}var Ur=R(Q()),kr=R(G());var xr=R(G());function qa(t,a){var e=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=Ya(t))||a&&t&&typeof t.length=="number"){e&&(t=e);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(l){throw l},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
341
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,s;return{s:function(){e=e.call(t)},n:function(){var l=e.next();return i=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!i&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function Ya(t,a){if(t){if(typeof t=="string")return hr(t,a);var e=Object.prototype.toString.call(t).slice(8,-1);if(e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set")return Array.from(t);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return hr(t,a)}}function hr(t,a){(a==null||a>t.length)&&(a=t.length);for(var e=0,n=new Array(a);e<a;e++)n[e]=t[e];return n}function Ze(t,a,e){var n=e;return n.domain=function(){return t},n.range=function(){return a},n}function yr(t,a){var e=function(r){return ni(t,a,r)};return Ze(t,a,e)}function Ka(t,a){var e=function(r){return ai(t,a,r)};return Ze(t,a,e)}function Qa(t,a){for(var e=t.sort(Sr),n=0,r=Math.max(1,a.length),i=new Array(r-1);++n<r;)i[n-1]=Za(e,n/r);var o=function(u){return ei(i,a,u)};return o.thresholds=function(){return i},Ze(t,a,o)}function Sr(t,a){return t-a}function Za(t,a){var e=t.length;if(a<=0||e<2)return t[0];if(a>=1)return t[e-1];var n=(e-1)*a,r=Math.floor(n),i=t[r],o=t[r+1];return i+(o-i)*(n-r)}function Ja(t,a){for(var e=0,n=t.length;e<n;){var r=e+n>>>1;Sr(t[r],a)>0?n=r:e=r+1}return e}function ei(t,a,e){return a[Ja(t,e)]}function ti(t,a,e,n){var r="".concat(n),i=a.get(r);return i===void 0&&(i=t.push(n),a.set(r,i)),e[(i-1)%e.length]}function ri(t,a){var e=new Map,n=[],r=qa(t),i;try{for(r.s();!(i=r.n()).done;){var o=i.value,s="".concat(o);e.has(s)||e.set(s,n.push(o))}}catch(l){r.e(l)}finally{r.f()}var u=function(g){return ti(n,e,a,g)};return Ze(t,a,u)}function ni(t,a,e){var n=t[1]-t[0];if(n<=0)return xr.log.warn("quantizeScale: invalid domain, returning range[0]")(),a[0];var r=n/a.length,i=Math.floor((e-t[0])/r),o=Math.max(Math.min(i,a.length-1),0);return a[o]}function ai(t,a,e){return(e-t[0])/(t[1]-t[0])*(a[1]-a[0])+a[0]}function _r(t){return t!=null}function ii(t){var a=[];return t.forEach(function(e){!a.includes(e)&&_r(e)&&a.push(e)}),a}function br(t,a){var e=typeof a=="function"?t.map(a):t;return e.filter(_r)}function Ar(t,a){return br(t,a)}function Or(t,a){return ii(br(t,a))}function Tr(t,a,e){return Math.max(a,Math.min(e,t))}function Cr(t){switch(t){case"quantize":return yr;case"linear":return Ka;case"quantile":return Qa;case"ordinal":return ri;default:return yr}}function Pr(t,a){var e=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=oi(t))||a&&t&&typeof t.length=="number"){e&&(t=e);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(l){throw l},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
342
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,s;return{s:function(){e=e.call(t)},n:function(){var l=e.next();return i=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!i&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function oi(t,a){if(t){if(typeof t=="string")return wr(t,a);var e=Object.prototype.toString.call(t).slice(8,-1);if(e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set")return Array.from(t);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return wr(t,a)}}function wr(t,a){(a==null||a>t.length)&&(a=t.length);for(var e=0,n=new Array(a);e<a;e++)n[e]=t[e];return n}var Mr=function(a){return a.length},si=3402823466e29,Er=function(a){return a.points},Rr=function(a){return a.index},Dr=function(a,e){return a<e?-1:a>e?1:a>=e?0:NaN},ui={getValue:Mr,getPoints:Er,getIndex:Rr,filterData:null},Oe=function(){function t(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ui;N(this,t),p(this,"maxCount",void 0),p(this,"maxValue",void 0),p(this,"minValue",void 0),p(this,"totalCount",void 0),p(this,"aggregatedBins",void 0),p(this,"sortedBins",void 0),p(this,"binMap",void 0),this.aggregatedBins=this.getAggregatedBins(a,e),this._updateMinMaxValues(),this.binMap=this.getBinMap()}return I(t,[{key:"getAggregatedBins",value:function(e,n){for(var r=n.getValue,i=r===void 0?Mr:r,o=n.getPoints,s=o===void 0?Er:o,u=n.getIndex,l=u===void 0?Rr:u,g=n.filterData,f=typeof g=="function",c=e.length,v=[],h=0,d=0;d<c;d++){var y=e[d],A=s(y),T=l(y),_=f?A.filter(g):A;y.filteredPoints=f?_:null;var C=_.length?i(_):null;C!=null&&(v[h]={i:Number.isFinite(T)?T:d,value:C,counts:_.length},h++)}return v}},{key:"_percentileToIndex",value:function(e){var n=this.sortedBins.length;if(n<2)return[0,0];var r=e.map(function(g){return Tr(g,0,100)}),i=X(r,2),o=i[0],s=i[1],u=Math.ceil(o/100*(n-1)),l=Math.floor(s/100*(n-1));return[u,l]}},{key:"getBinMap",value:function(){var e={},n=Pr(this.aggregatedBins),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;e[i.i]=i}}catch(o){n.e(o)}finally{n.f()}return e}},{key:"_updateMinMaxValues",value:function(){var e=0,n=0,r=si,i=0,o=Pr(this.aggregatedBins),s;try{for(o.s();!(s=o.n()).done;){var u=s.value;e=e>u.counts?e:u.counts,n=n>u.value?n:u.value,r=r<u.value?r:u.value,i+=u.counts}}catch(l){o.e(l)}finally{o.f()}this.maxCount=e,this.maxValue=n,this.minValue=r,this.totalCount=i}},{key:"getValueRange",value:function(e){if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort(function(o,s){return Dr(o.value,s.value)})),!this.sortedBins.length)return[];var n=0,r=this.sortedBins.length-1;if(Array.isArray(e)){var i=this._percentileToIndex(e);n=i[0],r=i[1]}return[this.sortedBins[n].value,this.sortedBins[r].value]}},{key:"getValueDomainByScale",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=X(n,2),i=r[0],o=i===void 0?0:i,s=r[1],u=s===void 0?100:s;if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort(function(g,f){return Dr(g.value,f.value)})),!this.sortedBins.length)return[];var l=this._percentileToIndex([o,u]);return this._getScaleDomain(e,l)}},{key:"_getScaleDomain",value:function(e,n){var r=X(n,2),i=r[0],o=r[1],s=this.sortedBins;switch(e){case"quantize":case"linear":return[s[i].value,s[o].value];case"quantile":return Ar(s.slice(i,o+1),function(u){return u.value});case"ordinal":return Or(s,function(u){return u.value});default:return[s[i].value,s[o].value]}}}]),t}();var Br=R(G());var ue=R(G()),Ir=6378e3;function Je(t){return Number.isFinite(t)?t:0}function et(t,a){for(var e=t.positions.value,n=1/0,r=-1/0,i=1/0,o=-1/0,s,u,l=0;l<a;l++)u=e[l*3],s=e[l*3+1],n=s<n?s:n,r=s>r?s:r,i=u<i?u:i,o=u>o?u:o;var g={xMin:Je(i),xMax:Je(o),yMin:Je(n),yMax:Je(r)};return g}function li(t,a,e,n){var r=n.width,i=n.height,o=e===ue.COORDINATE_SYSTEM.CARTESIAN?[-r/2,-i/2]:[-180,-90];ue.log.assert(e===ue.COORDINATE_SYSTEM.CARTESIAN||e===ue.COORDINATE_SYSTEM.LNGLAT||e===ue.COORDINATE_SYSTEM.DEFAULT);var s=t.xMin,u=t.yMin;return[-1*(Nr(s-o[0],a.xOffset)+o[0]),-1*(Nr(u-o[1],a.yOffset)+o[1])]}function Nr(t,a){var e=t<0?-1:1,n=e<0?Math.abs(t)+a:Math.abs(t);return n=Math.floor(n/a)*a,n*e}function Dt(t,a){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e)return{xOffset:a,yOffset:a};var n=t.yMin,r=t.yMax,i=(n+r)/2;return fi(a,i)}function tt(t,a,e,n){var r=Dt(t,a,n!==ue.COORDINATE_SYSTEM.CARTESIAN),i=li(t,r,n,e),o=t.xMin,s=t.yMin,u=t.xMax,l=t.yMax,g=u-o+r.xOffset,f=l-s+r.yOffset,c=Math.ceil(g/r.xOffset),v=Math.ceil(f/r.yOffset);return{gridOffset:r,translation:i,width:g,height:f,numCol:c,numRow:v}}function fi(t,a){var e=gi(t),n=ci(a,t);return{yOffset:e,xOffset:n}}function gi(t){return t/Ir*(180/Math.PI)}function ci(t,a){return a/Ir*(180/Math.PI)/Math.cos(t*Math.PI/180)}function Lr(t,a){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);a&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function pi(t){for(var a=1;a<arguments.length;a++){var e=arguments[a]!=null?arguments[a]:{};a%2?Lr(Object(e),!0).forEach(function(n){p(t,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):Lr(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}return t}function mi(t,a){var e=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=di(t))||a&&t&&typeof t.length=="number"){e&&(t=e);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(l){throw l},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
343
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,s;return{s:function(){e=e.call(t)},n:function(){var l=e.next();return i=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!i&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function di(t,a){if(t){if(typeof t=="string")return Fr(t,a);var e=Object.prototype.toString.call(t).slice(8,-1);if(e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set")return Array.from(t);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return Fr(t,a)}}function Fr(t,a){(a==null||a>t.length)&&(a=t.length);for(var e=0,n=new Array(a);e<a;e++)n[e]=t[e];return n}function Te(t,a){var e=vi(t,a),n=hi(e);return{gridHash:e.gridHash,gridOffset:e.gridOffset,data:n}}function vi(t,a){var e=t.data,n=e===void 0?[]:e,r=t.cellSize,i=a.attributes,o=a.viewport,s=a.projectPoints,u=a.numInstances,l=i.positions.value,g=i.positions.getAccessor(),f=g.size,c=a.boundingBox||yi(i.positions,u),v=a.posOffset||[180,90],h=a.gridOffset||Dt(c,r);if(h.xOffset<=0||h.yOffset<=0)return{gridHash:{},gridOffset:h};var d=o.width,y=o.height,A=Math.ceil(d/h.xOffset),T=Math.ceil(y/h.yOffset),_={},C=(0,Br.createIterable)(n),w=C.iterable,M=C.objectInfo,D=new Array(3),U=mi(w),$;try{for(U.s();!($=U.n()).done;){var Y=$.value;M.index++,D[0]=l[M.index*f],D[1]=l[M.index*f+1],D[2]=f>=3?l[M.index*f+2]:0;var ee=s?o.project(D):D,H=X(ee,2),pe=H[0],Gt=H[1];if(Number.isFinite(pe)&&Number.isFinite(Gt)){var Ve=Math.floor((Gt+v[1])/h.yOffset),He=Math.floor((pe+v[0])/h.xOffset);if(!s||He>=0&&He<A&&Ve>=0&&Ve<T){var $e="".concat(Ve,"-").concat(He);_[$e]=_[$e]||{count:0,points:[],lonIdx:He,latIdx:Ve},_[$e].count+=1,_[$e].points.push({source:Y,index:M.index})}}}}catch(ga){U.e(ga)}finally{U.f()}return{gridHash:_,gridOffset:h,offsets:[v[0]*-1,v[1]*-1]}}function hi(t){var a=t.gridHash,e=t.gridOffset,n=t.offsets,r=new Array(Object.keys(a).length),i=0;for(var o in a){var s=o.split("-"),u=parseInt(s[0],10),l=parseInt(s[1],10),g=i++;r[g]=pi({index:g,position:[n[0]+e.xOffset*l,n[1]+e.yOffset*u]},a[o])}return r}function yi(t,a){for(var e=t.value,n=t.getAccessor(),r=n.size,i=1/0,o=-1/0,s=1/0,u=-1/0,l,g,f=0;f<a;f++)g=e[f*r],l=e[f*r+1],Number.isFinite(g)&&Number.isFinite(l)&&(i=l<i?l:i,o=l>o?l:o,s=g<s?g:s,u=g>u?g:u);return{xMin:s,xMax:u,yMin:i,yMax:o}}function xi(t,a){var e=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=Si(t))||a&&t&&typeof t.length=="number"){e&&(t=e);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(l){throw l},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
344
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,s;return{s:function(){e=e.call(t)},n:function(){var l=e.next();return i=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!i&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function Si(t,a){if(t){if(typeof t=="string")return zr(t,a);var e=Object.prototype.toString.call(t).slice(8,-1);if(e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set")return Array.from(t);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return zr(t,a)}}function zr(t,a){(a==null||a>t.length)&&(a=t.length);for(var e=0,n=new Array(a);e<a;e++)n[e]=t[e];return n}function _i(t){var a=bi();return function(){var n=P(t),r;if(a){var i=P(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return z(this,r)}}function bi(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var le=function(t){B(e,t);var a=_i(e);function e(){var n;N(this,e);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return n=a.call.apply(a,[this].concat(i)),p(W(n),"state",void 0),n}return I(e,[{key:"initializeAggregationLayer",value:function(r){var i=r.dimensions,o=this.context.gl;E(P(e.prototype),"initializeAggregationLayer",this).call(this,i),this.setState({layerData:{},gpuGridAggregator:new V(o,{id:"".concat(this.id,"-gpu-aggregator")}),cpuGridAggregator:Te})}},{key:"updateState",value:function(r){E(P(e.prototype),"updateState",this).call(this,r),this.updateAggregationState(r);var i=this.state,o=i.aggregationDataDirty,s=i.aggregationWeightsDirty,u=i.gpuAggregation;if(!(this.getNumInstances()<=0)){var l=!1;(o||u&&s)&&(this._updateAggregation(r),l=!0),!u&&(o||s)&&(this._updateWeightBins(),this._uploadAggregationResults(),l=!0),this.setState({aggregationDirty:l})}}},{key:"finalizeState",value:function(r){var i,o=this.state.weights.count;o&&o.aggregationBuffer&&o.aggregationBuffer.delete(),(i=this.state.gpuGridAggregator)===null||i===void 0||i.delete(),E(P(e.prototype),"finalizeState",this).call(this,r)}},{key:"updateShaders",value:function(r){this.state.gpuAggregation&&this.state.gpuGridAggregator.updateShaders(r)}},{key:"updateAggregationState",value:function(r){kr.log.assert(!1)}},{key:"allocateResources",value:function(r,i){if(this.state.numRow!==r||this.state.numCol!==i){var o=i*r*4*4,s=this.context.gl,u=this.state.weights;for(var l in u){var g=u[l];g.aggregationBuffer&&g.aggregationBuffer.delete(),g.aggregationBuffer=new Ur.Buffer(s,{byteLength:o,accessor:{size:4,type:5126,divisor:1}})}}}},{key:"updateResults",value:function(r){var i=r.aggregationData,o=r.maxMinData,s=r.maxData,u=r.minData,l=this.state.weights.count;l&&(l.aggregationData=i,l.maxMinData=o,l.maxData=s,l.minData=u)}},{key:"_updateAggregation",value:function(r){var i=this.state,o=i.cpuGridAggregator,s=i.gpuGridAggregator,u=i.gridOffset,l=i.posOffset,g=i.translation,f=g===void 0?[0,0]:g,c=i.scaling,v=c===void 0?[0,0,0]:c,h=i.boundingBox,d=i.projectPoints,y=i.gpuAggregation,A=i.numCol,T=i.numRow,_=r.props,C=this.context.viewport,w=this.getAttributes(),M=this.getNumInstances();if(y){var U=this.state.weights;s.run({weights:U,cellSize:[u.xOffset,u.yOffset],numCol:A,numRow:T,translation:f,scaling:v,vertexCount:M,projectPoints:d,attributes:w,moduleSettings:this.getModuleSettings()})}else{var D=o(_,{gridOffset:u,projectPoints:d,attributes:w,viewport:C,posOffset:l,boundingBox:h});this.setState({layerData:D})}}},{key:"_updateWeightBins",value:function(){var r=this.state.getValue,i=new Oe(this.state.layerData.data||[],{getValue:r});this.setState({sortedBins:i})}},{key:"_uploadAggregationResults",value:function(){var r=this.state,i=r.numCol,o=r.numRow,s=this.state.layerData.data,u=this.state.sortedBins,l=u.aggregatedBins,g=u.minValue,f=u.maxValue,c=u.totalCount,v=4,h=i*o*v,d=new Float32Array(h).fill(0),y=xi(l),A;try{for(y.s();!(A=y.n()).done;){var T=A.value,_=s[T.i],C=_.lonIdx,w=_.latIdx,M=T.value,D=T.counts,U=(C+w*i)*v;d[U]=M,d[U+v-1]=D}}catch(H){y.e(H)}finally{y.f()}var $=new Float32Array([f,0,0,g]),Y=new Float32Array([f,0,0,c]),ee=new Float32Array([g,0,0,c]);this.updateResults({aggregationData:d,maxMinData:$,maxData:Y,minData:ee})}}]),e}(Z);p(le,"layerName","GridAggregationLayer");function Ai(t){var a=Oi();return function(){var n=P(t),r;if(a){var i=P(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return z(this,r)}}function Oi(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Gr(t,a){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);a&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function Mt(t){for(var a=1;a<arguments.length;a++){var e=arguments[a]!=null?arguments[a]:{};a%2?Gr(Object(e),!0).forEach(function(n){p(t,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):Gr(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}return t}var Ti=Mt(Mt({},be.defaultProps),{},{getPosition:{type:"accessor",value:function(a){return a.position}},getWeight:{type:"accessor",value:1},gpuAggregation:!0,aggregation:"SUM"}),Wr="positions",Ci={data:{props:["cellSizePixels"]},weights:{props:["aggregation"],accessors:["getWeight"]}},rt=function(t){B(e,t);var a=Ai(e);function e(){var n;N(this,e);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return n=a.call.apply(a,[this].concat(i)),p(W(n),"state",void 0),n}return I(e,[{key:"initializeState",value:function(){var r,i=this.context.gl;if(!be.isSupported(i)){this.setState({supported:!1}),Et.log.error("ScreenGridLayer: ".concat(this.id," is not supported on this browser"))();return}E(P(e.prototype),"initializeAggregationLayer",this).call(this,{dimensions:Ci,getCellSize:function(l){return l.cellSizePixels}});var o={count:{size:1,operation:L.SUM,needMax:!0,maxTexture:xe(i,{id:"".concat(this.id,"-max-texture")})}};this.setState({supported:!0,projectPoints:!0,weights:o,subLayerData:{attributes:{}},maxTexture:o.count.maxTexture,positionAttributeName:"positions",posOffset:[0,0],translation:[1,-1]});var s=this.getAttributeManager();s.add((r={},p(r,Wr,{size:3,accessor:"getPosition",type:5130,fp64:this.use64bitPositions()}),p(r,"count",{size:3,accessor:"getWeight"}),r))}},{key:"shouldUpdateState",value:function(r){var i=r.changeFlags;return this.state.supported&&i.somethingChanged}},{key:"updateState",value:function(r){E(P(e.prototype),"updateState",this).call(this,r)}},{key:"renderLayers",value:function(){if(!this.state.supported)return[];var r=this.state,i=r.maxTexture,o=r.numRow,s=r.numCol,u=r.weights,l=this.props.updateTriggers,g=u.count.aggregationBuffer,f=this.getSubLayerClass("cells",be);return new f(this.props,this.getSubLayerProps({id:"cell-layer",updateTriggers:l}),{data:{attributes:{instanceCounts:g}},maxTexture:i,numInstances:o*s})}},{key:"finalizeState",value:function(r){E(P(e.prototype),"finalizeState",this).call(this,r);var i=this.state,o=i.aggregationBuffer,s=i.maxBuffer,u=i.maxTexture;o?.delete(),s?.delete(),u?.delete()}},{key:"getPickingInfo",value:function(r){var i=r.info,o=i.index;if(o>=0){var s=this.state,u=s.gpuGridAggregator,l=s.gpuAggregation,g=s.weights,f=l?u.getData("count"):g.count;i.object=V.getAggregationData(Mt({pixelIndex:o},f))}return i}},{key:"updateResults",value:function(r){var i=r.aggregationData,o=r.maxData,s=this.state.weights.count;s.aggregationData=i,s.aggregationBuffer.setData({data:i}),s.maxData=o,s.maxTexture.setImageData({data:o})}},{key:"updateAggregationState",value:function(r){var i=r.props.cellSizePixels,o=r.oldProps.cellSizePixels!==i,s=r.changeFlags.viewportChanged,u=r.props.gpuAggregation;this.state.gpuAggregation!==r.props.gpuAggregation&&u&&!V.isSupported(this.context.gl)&&(Et.log.warn("GPU Grid Aggregation not supported, falling back to CPU")(),u=!1);var l=u!==this.state.gpuAggregation;this.setState({gpuAggregation:u});var g=this.isAttributeChanged(Wr),f=this.state.dimensions,c=f.data,v=f.weights,h=g||l||s||this.isAggregationDirty(r,{compareAll:u,dimension:c}),d=this.isAggregationDirty(r,{dimension:v});this.setState({aggregationDataDirty:h,aggregationWeightsDirty:d});var y=this.context.viewport;if(s||o){var A=y.width,T=y.height,_=Math.ceil(A/i),C=Math.ceil(T/i);this.allocateResources(C,_),this.setState({scaling:[A/2,-T/2,1],gridOffset:{xOffset:i,yOffset:i},width:A,height:T,numCol:_,numRow:C})}d&&this._updateAccessors(r),(h||d)&&this._resetResults()}},{key:"_updateAccessors",value:function(r){var i=r.props,o=i.getWeight,s=i.aggregation,u=i.data,l=this.state.weights.count;l&&(l.getWeight=o,l.operation=L[s]),this.setState({getValue:ve(s,o,{data:u})})}},{key:"_resetResults",value:function(){var r=this.state.weights.count;r&&(r.aggregationData=null)}}]),e}(le);p(rt,"layerName","ScreenGridLayer");p(rt,"defaultProps",Ti);var qr=R(me());function jr(t,a){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);a&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function J(t){for(var a=1;a<arguments.length;a++){var e=arguments[a]!=null?arguments[a]:{};a%2?jr(Object(e),!0).forEach(function(n){p(t,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):jr(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}return t}function Vr(){}var Hr=["getBins","getDomain","getScaleFunc"],$r=[{key:"fillColor",accessor:"getFillColor",pickingInfo:"colorValue",getBins:{triggers:{value:{prop:"getColorValue",updateTrigger:"getColorValue"},weight:{prop:"getColorWeight",updateTrigger:"getColorWeight"},aggregation:{prop:"colorAggregation"},filterData:{prop:"_filterData",updateTrigger:"_filterData"}}},getDomain:{triggers:{lowerPercentile:{prop:"lowerPercentile"},upperPercentile:{prop:"upperPercentile"},scaleType:{prop:"colorScaleType"}}},getScaleFunc:{triggers:{domain:{prop:"colorDomain"},range:{prop:"colorRange"}},onSet:{props:"onSetColorDomain"}},nullValue:[0,0,0,0]},{key:"elevation",accessor:"getElevation",pickingInfo:"elevationValue",getBins:{triggers:{value:{prop:"getElevationValue",updateTrigger:"getElevationValue"},weight:{prop:"getElevationWeight",updateTrigger:"getElevationWeight"},aggregation:{prop:"elevationAggregation"},filterData:{prop:"_filterData",updateTrigger:"_filterData"}}},getDomain:{triggers:{lowerPercentile:{prop:"elevationLowerPercentile"},upperPercentile:{prop:"elevationUpperPercentile"},scaleType:{prop:"elevationScaleType"}}},getScaleFunc:{triggers:{domain:{prop:"elevationDomain"},range:{prop:"elevationRange"}},onSet:{props:"onSetElevationDomain"}},nullValue:-1}],Pi=function(a){return a.cellSize},Ce=function(){function t(a){N(this,t),this.state={layerData:{},dimensions:{}},this.changeFlags={},this.dimensionUpdaters={},this._getCellSize=a.getCellSize||Pi,this._getAggregator=a.getAggregator,this._addDimension(a.dimensions||$r)}return I(t,[{key:"updateState",value:function(e,n){var r=e.oldProps,i=e.props,o=e.changeFlags;this.updateGetValueFuncs(r,i,o);var s=this.needsReProjectPoints(r,i,o),u=!1;if(o.dataChanged||s)this.getAggregatedData(i,n),u=!0;else{var l=this.getDimensionChanges(r,i,o)||[];l.forEach(function(g){return typeof g=="function"&&g()}),u=!0}return this.setState({aggregationDirty:u}),this.state}},{key:"setState",value:function(e){this.state=J(J({},this.state),e)}},{key:"setDimensionState",value:function(e,n){this.setState({dimensions:J(J({},this.state.dimensions),{},p({},e,J(J({},this.state.dimensions[e]),n)))})}},{key:"normalizeResult",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return e.hexagons?J({data:e.hexagons},e):e.layerData?J({data:e.layerData},e):e}},{key:"getAggregatedData",value:function(e,n){var r=this._getAggregator(e),i=r(e,n);this.setState({layerData:this.normalizeResult(i)}),this.changeFlags={layerData:!0},this.getSortedBins(e)}},{key:"updateGetValueFuncs",value:function(e,n,r){for(var i in this.dimensionUpdaters){var o=this.dimensionUpdaters[i].getBins.triggers,s=o.value,u=o.weight,l=o.aggregation,g=n[s.prop],f=this.needUpdateDimensionStep(this.dimensionUpdaters[i].getBins,e,n,r);f&&(g?g=Qt(g,{data:n.data}):g=ve(n[l.prop],n[u.prop],{data:n.data})),g&&this.setDimensionState(i,{getValue:g})}}},{key:"needsReProjectPoints",value:function(e,n,r){return this._getCellSize(e)!==this._getCellSize(n)||this._getAggregator(e)!==this._getAggregator(n)||r.updateTriggersChanged&&(r.updateTriggersChanged.all||r.updateTriggersChanged.getPosition)}},{key:"addDimension",value:function(e){this._addDimension(e)}},{key:"_addDimension",value:function(){var e=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];n.forEach(function(r){var i=r.key;e.dimensionUpdaters[i]=e.getDimensionUpdaters(r),e.state.dimensions[i]={getValue:null,domain:null,sortedBins:null,scaleFunc:Vr}})}},{key:"getDimensionUpdaters",value:function(e){var n=e.key,r=e.accessor,i=e.pickingInfo,o=e.getBins,s=e.getDomain,u=e.getScaleFunc,l=e.nullValue;return{key:n,accessor:r,pickingInfo:i,getBins:J({updater:this.getDimensionSortedBins},o),getDomain:J({updater:this.getDimensionValueDomain},s),getScaleFunc:J({updater:this.getDimensionScale},u),attributeAccessor:this.getSubLayerDimensionAttribute(n,l)}}},{key:"needUpdateDimensionStep",value:function(e,n,r,i){return Object.values(e.triggers).some(function(o){return o.updateTrigger?i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged[o.updateTrigger]):n[o.prop]!==r[o.prop]})}},{key:"getDimensionChanges",value:function(e,n,r){var i=this,o=[],s=function(g){var f=Hr.find(function(c){return i.needUpdateDimensionStep(i.dimensionUpdaters[g][c],e,n,r)});f&&o.push(i.dimensionUpdaters[g][f].updater.bind(i,n,i.dimensionUpdaters[g]))};for(var u in this.dimensionUpdaters)s(u);return o.length?o:null}},{key:"getUpdateTriggers",value:function(e){var n=this,r=e.updateTriggers||{},i={},o=function(l){var g=n.dimensionUpdaters[l].accessor;i[g]={},Hr.forEach(function(f){Object.values(n.dimensionUpdaters[l][f].triggers).forEach(function(c){var v=c.prop,h=c.updateTrigger;if(h){var d=r[h];ne(d)==="object"&&!Array.isArray(d)?Object.assign(i[g],d):d!==void 0&&(i[g][v]=d)}else i[g][v]=e[v]})})};for(var s in this.dimensionUpdaters)o(s);return i}},{key:"getSortedBins",value:function(e){for(var n in this.dimensionUpdaters)this.getDimensionSortedBins(e,this.dimensionUpdaters[n])}},{key:"getDimensionSortedBins",value:function(e,n){var r=n.key,i=this.state.dimensions[r].getValue,o=new Oe(this.state.layerData.data||[],{getValue:i,filterData:e._filterData});this.setDimensionState(r,{sortedBins:o}),this.getDimensionValueDomain(e,n)}},{key:"getDimensionValueDomain",value:function(e,n){var r=n.getDomain,i=n.key,o=r.triggers,s=o.lowerPercentile,u=o.upperPercentile,l=o.scaleType,g=this.state.dimensions[i].sortedBins.getValueDomainByScale(e[l.prop],[e[s.prop],e[u.prop]]);this.setDimensionState(i,{valueDomain:g}),this.getDimensionScale(e,n)}},{key:"getDimensionScale",value:function(e,n){var r=n.key,i=n.getScaleFunc,o=n.getDomain,s=i.triggers,u=s.domain,l=s.range,g=o.triggers.scaleType,f=i.onSet,c=e[l.prop],v=e[u.prop]||this.state.dimensions[r].valueDomain,h=Cr(g&&e[g.prop]),d=h(v,c);ne(f)==="object"&&typeof e[f.props]=="function"&&e[f.props](d.domain()),this.setDimensionState(r,{scaleFunc:d})}},{key:"getSubLayerDimensionAttribute",value:function(e,n){var r=this;return function(i){var o=r.state.dimensions[e],s=o.sortedBins,u=o.scaleFunc,l=s.binMap[i.index];if(l&&l.counts===0)return n;var g=l&&l.value,f=u.domain(),c=g>=f[0]&&g<=f[f.length-1];return c?u(g):n}}},{key:"getSubLayerAccessors",value:function(e){var n={};for(var r in this.dimensionUpdaters){var i=this.dimensionUpdaters[r].accessor;n[i]=this.getSubLayerDimensionAttribute(e,r)}return n}},{key:"getPickingInfo",value:function(e){var n=e.info,r=n.picked&&n.index>-1,i=null;if(r){var o=this.state.layerData.data[n.index],s={};for(var u in this.dimensionUpdaters){var l=this.dimensionUpdaters[u].pickingInfo,g=this.state.dimensions[u].sortedBins,f=g.binMap[o.index]&&g.binMap[o.index].value;s[l]=f}i=Object.assign(s,o,{points:o.filteredPoints||o.points})}return n.picked=Boolean(i),n.object=i,n}},{key:"getAccessor",value:function(e){return this.dimensionUpdaters.hasOwnProperty(e)?this.dimensionUpdaters[e].attributeAccessor:Vr}}],[{key:"defaultDimensions",value:function(){return $r}}]),t}();function wi(t){var a=Di();return function(){var n=P(t),r;if(a){var i=P(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return z(this,r)}}function Di(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Xr(){}var Mi={colorDomain:null,colorRange:K,getColorValue:{type:"accessor",value:null},getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",lowerPercentile:{type:"number",min:0,max:100,value:0},upperPercentile:{type:"number",min:0,max:100,value:100},colorScaleType:"quantize",onSetColorDomain:Xr,elevationDomain:null,elevationRange:[0,1e3],getElevationValue:{type:"accessor",value:null},getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationLowerPercentile:{type:"number",min:0,max:100,value:0},elevationUpperPercentile:{type:"number",min:0,max:100,value:100},elevationScale:{type:"number",min:0,value:1},elevationScaleType:"linear",onSetElevationDomain:Xr,gridAggregator:Te,cellSize:{type:"number",min:0,max:1e3,value:1e3},coverage:{type:"number",min:0,max:1,value:1},getPosition:{type:"accessor",value:function(a){return a.position}},extruded:!1,material:!0,_filterData:{type:"function",value:null,optional:!0}},fe=function(t){B(e,t);var a=wi(e);function e(){return N(this,e),a.apply(this,arguments)}return I(e,[{key:"initializeState",value:function(){var r=new Ce({getAggregator:function(s){return s.gridAggregator},getCellSize:function(s){return s.cellSize}});this.state={cpuAggregator:r,aggregatorState:r.state};var i=this.getAttributeManager();i.add({positions:{size:3,type:5130,accessor:"getPosition"}})}},{key:"updateState",value:function(r){E(P(e.prototype),"updateState",this).call(this,r),this.setState({aggregatorState:this.state.cpuAggregator.updateState(r,{viewport:this.context.viewport,attributes:this.getAttributes(),numInstances:this.getNumInstances()})})}},{key:"getPickingInfo",value:function(r){var i=r.info;return this.state.cpuAggregator.getPickingInfo({info:i})}},{key:"_onGetSublayerColor",value:function(r){return this.state.cpuAggregator.getAccessor("fillColor")(r)}},{key:"_onGetSublayerElevation",value:function(r){return this.state.cpuAggregator.getAccessor("elevation")(r)}},{key:"_getSublayerUpdateTriggers",value:function(){return this.state.cpuAggregator.getUpdateTriggers(this.props)}},{key:"renderLayers",value:function(){var r=this.props,i=r.elevationScale,o=r.extruded,s=r.cellSize,u=r.coverage,l=r.material,g=r.transitions,f=this.state.cpuAggregator,c=this.getSubLayerClass("grid-cell",qr.GridCellLayer),v=this._getSublayerUpdateTriggers();return new c({cellSize:s,coverage:u,material:l,elevationScale:i,extruded:o,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:g&&{getFillColor:g.getColorValue||g.getColorWeight,getElevation:g.getElevationValue||g.getElevationWeight}},this.getSubLayerProps({id:"grid-cell",updateTriggers:v}),{data:f.state.layerData.data})}}]),e}(Z);p(fe,"layerName","CPUGridLayer");p(fe,"defaultProps",Mi);var en=R(G()),tn=R(me());var Pe=Math.PI/3,Ei=[0,Pe,2*Pe,3*Pe,4*Pe,5*Pe];function Ri(t){return t[0]}function Ni(t){return t[1]}function Rt(){var t=0,a=0,e=1,n=1,r=Ri,i=Ni,o,s,u;function l(f){var c={},v=[],h,d=f.length;for(h=0;h<d;++h)if(!(isNaN(A=+r.call(null,y=f[h],h,f))||isNaN(T=+i.call(null,y,h,f)))){var y,A,T,_=Math.round(T=T/u),C=Math.round(A=A/s-(_&1)/2),w=T-_;if(Math.abs(w)*3>1){var M=A-C,D=C+(A<C?-1:1)/2,U=_+(T<_?-1:1),$=A-D,Y=T-U;M*M+w*w>$*$+Y*Y&&(C=D+(_&1?1:-1)/2,_=U)}var ee=C+"-"+_,H=c[ee];H?H.push(y):(v.push(H=c[ee]=[y]),H.x=(C+(_&1)/2)*s,H.y=_*u)}return v}function g(f){var c=0,v=0;return Ei.map(function(h){var d=Math.sin(h)*f,y=-Math.cos(h)*f,A=d-c,T=y-v;return c=d,v=y,[A,T]})}return l.hexagon=function(f){return"m"+g(f==null?o:+f).join("l")+"z"},l.centers=function(){for(var f=[],c=Math.round(a/u),v=Math.round(t/s),h=c*u;h<n+o;h+=u,++c)for(var d=v*s+(c&1)*s/2;d<e+s/2;d+=s)f.push([d,h]);return f},l.mesh=function(){var f=g(o).slice(0,4).join("l");return l.centers().map(function(c){return"M"+c+"m"+f}).join("")},l.x=function(f){return arguments.length?(r=f,l):r},l.y=function(f){return arguments.length?(i=f,l):i},l.radius=function(f){return arguments.length?(o=+f,s=o*2*Math.sin(Pe),u=o*1.5,l):o},l.size=function(f){return arguments.length?(t=a=0,e=+f[0],n=+f[1],l):[e-t,n-a]},l.extent=function(f){return arguments.length?(t=+f[0][0],a=+f[0][1],e=+f[1][0],n=+f[1][1],l):[[t,a],[e,n]]},l.radius(1)}var nt=R(G());function Ii(t,a){var e=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=Li(t))||a&&t&&typeof t.length=="number"){e&&(t=e);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(l){throw l},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
345
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,s;return{s:function(){e=e.call(t)},n:function(){var l=e.next();return i=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!i&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function Li(t,a){if(t){if(typeof t=="string")return Yr(t,a);var e=Object.prototype.toString.call(t).slice(8,-1);if(e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set")return Array.from(t);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return Yr(t,a)}}function Yr(t,a){(a==null||a>t.length)&&(a=t.length);for(var e=0,n=new Array(a);e<a;e++)n[e]=t[e];return n}function Kr(t,a){var e=t.data,n=t.radius,r=a.viewport,i=a.attributes,o=e.length?Fi(e,a):null,s=Bi(n,r,o),u=[],l=(0,nt.createIterable)(e),g=l.iterable,f=l.objectInfo,c=i.positions.value,v=i.positions.getAccessor(),h=v.size,d=Ii(g),y;try{for(d.s();!(y=d.n()).done;){var A=y.value;f.index++;var T=f.index*h,_=[c[T],c[T+1]],C=Number.isFinite(_[0])&&Number.isFinite(_[1]);C?u.push({screenCoord:r.projectFlat(_),source:A,index:f.index}):nt.log.warn("HexagonLayer: invalid position")()}}catch(D){d.e(D)}finally{d.f()}var w=Rt().radius(s).x(function(D){return D.screenCoord[0]}).y(function(D){return D.screenCoord[1]}),M=w(u);return{hexagons:M.map(function(D,U){return{position:r.unprojectFlat([D.x,D.y]),points:D,index:U}}),radiusCommon:s}}function Fi(t,a){var e=a.attributes,n=e.positions.value,r=e.positions.getAccessor(),i=r.size,o=1/0,s=1/0,u=-1/0,l=-1/0,g;for(g=0;g<i*t.length;g+=i){var f=n[g],c=n[g+1],v=Number.isFinite(f)&&Number.isFinite(c);v&&(o=Math.min(f,o),u=Math.max(f,u),s=Math.min(c,s),l=Math.max(c,l))}return[o,s,u,l].every(Number.isFinite)?[(o+u)/2,(s+l)/2]:null}function Bi(t,a,e){var n=a.getDistanceScales(e),r=n.unitsPerMeter;return t*r[0]}function Qr(t,a){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);a&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function Zr(t){for(var a=1;a<arguments.length;a++){var e=arguments[a]!=null?arguments[a]:{};a%2?Qr(Object(e),!0).forEach(function(n){p(t,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):Qr(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}return t}function zi(t){var a=Ui();return function(){var n=P(t),r;if(a){var i=P(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return z(this,r)}}function Ui(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Jr(){}var ki={colorDomain:null,colorRange:K,getColorValue:{type:"accessor",value:null},getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",lowerPercentile:{type:"number",value:0,min:0,max:100},upperPercentile:{type:"number",value:100,min:0,max:100},colorScaleType:"quantize",onSetColorDomain:Jr,elevationDomain:null,elevationRange:[0,1e3],getElevationValue:{type:"accessor",value:null},getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationLowerPercentile:{type:"number",value:0,min:0,max:100},elevationUpperPercentile:{type:"number",value:100,min:0,max:100},elevationScale:{type:"number",min:0,value:1},elevationScaleType:"linear",onSetElevationDomain:Jr,radius:{type:"number",value:1e3,min:1},coverage:{type:"number",min:0,max:1,value:1},extruded:!1,hexagonAggregator:Kr,getPosition:{type:"accessor",value:function(a){return a.position}},material:!0,_filterData:{type:"function",value:null,optional:!0}},at=function(t){B(e,t);var a=zi(e);function e(){var n;N(this,e);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return n=a.call.apply(a,[this].concat(i)),p(W(n),"state",void 0),n}return I(e,[{key:"initializeState",value:function(){var r=new Ce({getAggregator:function(s){return s.hexagonAggregator},getCellSize:function(s){return s.radius}});this.state={cpuAggregator:r,aggregatorState:r.state,vertices:null};var i=this.getAttributeManager();i.add({positions:{size:3,type:5130,accessor:"getPosition"}})}},{key:"updateState",value:function(r){if(E(P(e.prototype),"updateState",this).call(this,r),r.changeFlags.propsOrDataChanged){var i=this.state.cpuAggregator.updateState(r,{viewport:this.context.viewport,attributes:this.getAttributes()});if(this.state.aggregatorState.layerData!==i.layerData){var o=i.layerData||{},s=o.hexagonVertices;this.setState({vertices:s&&this.convertLatLngToMeterOffset(s)})}this.setState({aggregatorState:i})}}},{key:"convertLatLngToMeterOffset",value:function(r){var i=this.context.viewport;if(Array.isArray(r)&&r.length===6){var o=r[0],s=r[3],u=[(o[0]+s[0])/2,(o[1]+s[1])/2],l=i.projectFlat(u),g=i.getDistanceScales(u),f=g.metersPerUnit,c=r.map(function(v){var h=i.projectFlat(v);return[(h[0]-l[0])*f[0],(h[1]-l[1])*f[1]]});return c}return en.log.error("HexagonLayer: hexagonVertices needs to be an array of 6 points")(),null}},{key:"getPickingInfo",value:function(r){var i=r.info;return this.state.cpuAggregator.getPickingInfo({info:i})}},{key:"_onGetSublayerColor",value:function(r){return this.state.cpuAggregator.getAccessor("fillColor")(r)}},{key:"_onGetSublayerElevation",value:function(r){return this.state.cpuAggregator.getAccessor("elevation")(r)}},{key:"_getSublayerUpdateTriggers",value:function(){return this.state.cpuAggregator.getUpdateTriggers(this.props)}},{key:"renderLayers",value:function(){var r=this.props,i=r.elevationScale,o=r.extruded,s=r.coverage,u=r.material,l=r.transitions,g=this.state,f=g.aggregatorState,c=g.vertices,v=this.getSubLayerClass("hexagon-cell",tn.ColumnLayer),h=this._getSublayerUpdateTriggers(),d=c?{vertices:c,radius:1}:{radius:f.layerData.radiusCommon||1,radiusUnits:"common",angle:90};return new v(Zr(Zr({},d),{},{diskResolution:6,elevationScale:i,extruded:o,coverage:s,material:u,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:l&&{getFillColor:l.getColorValue||l.getColorWeight,getElevation:l.getElevationValue||l.getElevationWeight}}),this.getSubLayerProps({id:"hexagon-cell",updateTriggers:h}),{data:f.layerData.data})}}]),e}(Z);p(at,"layerName","HexagonLayer");p(at,"defaultProps",ki);var lt=R(me());var Mn=R(G());var S,x=.5,O=1/6,m={N:[0,x],E:[x,0],S:[0,-x],W:[-x,0],NE:[x,x],NW:[-x,x],SE:[x,-x],SW:[-x,-x]},we=[m.W,m.SW,m.S],De=[m.S,m.SE,m.E],Me=[m.E,m.NE,m.N],Ee=[m.NW,m.W,m.N],Re=[[-x,O],[-x,-O],[-O,-x],[O,-x]],Ne=[[-O,-x],[O,-x],[x,-O],[x,O]],Ie=[[x,-O],[x,O],[O,x],[-O,x]],Le=[[-x,O],[-x,-O],[O,x],[-O,x]],rn=[m.W,m.SW,m.SE,m.E],nn=[m.S,m.SE,m.NE,m.N],an=[m.NW,m.W,m.E,m.NE],on=[m.NW,m.SW,m.S,m.N],sn=[[-x,O],[-x,-O],[x,-O],[x,O]],un=[[-O,-x],[O,-x],[O,x],[-O,x]],Gi=[m.NW,m.SW,m.SE,m.NE],ln=[m.NW,m.SW,m.SE,m.E,m.N],fn=[m.W,m.SW,m.SE,m.NE,m.N],gn=[m.NW,m.W,m.S,m.SE,m.NE],cn=[m.NW,m.SW,m.S,m.E,m.NE],pn=[m.NW,m.W,[x,-O],[x,O],m.N],mn=[[-O,-x],[O,-x],m.E,m.NE,m.N],dn=[[-x,O],[-x,-O],m.S,m.SE,m.E],vn=[m.W,m.SW,m.S,[O,x],[-O,x]],hn=[m.NW,m.W,[-O,-x],[O,-x],m.N],yn=[[-x,O],[-x,-O],m.E,m.NE,m.N],xn=[m.S,m.SE,m.E,[O,x],[-O,x]],Sn=[m.W,m.SW,m.S,[x,-O],[x,O]],_n=[m.W,m.SW,m.SE,m.E,[O,x],[-O,x]],bn=[[-x,O],[-x,-O],m.S,m.SE,m.NE,m.N],An=[m.NW,m.W,[-O,-x],[O,-x],m.E,m.NE],On=[m.NW,m.SW,m.S,[x,-O],[x,O],m.N],Fe=[m.W,m.SW,m.S,m.E,m.NE,m.N],Be=[m.NW,m.W,m.S,m.SE,m.E,m.N],it=[[-x,O],[-x,-O],[-O,-x],[O,-x],m.E,m.NE,m.N],ot=[m.W,m.SW,m.S,[x,-O],[x,O],[O,x],[-O,x]],st=[m.NW,m.W,[-O,-x],[O,-x],[x,-O],[x,O],m.N],ut=[[-x,O],[-x,-O],m.S,m.SE,m.E,[O,x],[-O,x]],Tn=[[-x,O],[-x,-O],[-O,-x],[O,-x],[x,-O],[x,O],[O,x],[-O,x]],Cn={0:[],1:[[m.W,m.S]],2:[[m.S,m.E]],3:[[m.W,m.E]],4:[[m.N,m.E]],5:{0:[[m.W,m.S],[m.N,m.E]],1:[[m.W,m.N],[m.S,m.E]]},6:[[m.N,m.S]],7:[[m.W,m.N]],8:[[m.W,m.N]],9:[[m.N,m.S]],10:{0:[[m.W,m.N],[m.S,m.E]],1:[[m.W,m.S],[m.N,m.E]]},11:[[m.N,m.E]],12:[[m.W,m.E]],13:[[m.S,m.E]],14:[[m.W,m.S]],15:[]};function b(t){return parseInt(t,4)}var Pn=(S={},p(S,b("0000"),[]),p(S,b("2222"),[]),p(S,b("2221"),[we]),p(S,b("2212"),[De]),p(S,b("2122"),[Me]),p(S,b("1222"),[Ee]),p(S,b("0001"),[we]),p(S,b("0010"),[De]),p(S,b("0100"),[Me]),p(S,b("1000"),[Ee]),p(S,b("2220"),[Re]),p(S,b("2202"),[Ne]),p(S,b("2022"),[Ie]),p(S,b("0222"),[Le]),p(S,b("0002"),[Re]),p(S,b("0020"),[Ne]),p(S,b("0200"),[Ie]),p(S,b("2000"),[Le]),p(S,b("0011"),[rn]),p(S,b("0110"),[nn]),p(S,b("1100"),[an]),p(S,b("1001"),[on]),p(S,b("2211"),[rn]),p(S,b("2112"),[nn]),p(S,b("1122"),[an]),p(S,b("1221"),[on]),p(S,b("2200"),[sn]),p(S,b("2002"),[un]),p(S,b("0022"),[sn]),p(S,b("0220"),[un]),p(S,b("1111"),[Gi]),p(S,b("1211"),[ln]),p(S,b("2111"),[fn]),p(S,b("1112"),[gn]),p(S,b("1121"),[cn]),p(S,b("1011"),[ln]),p(S,b("0111"),[fn]),p(S,b("1110"),[gn]),p(S,b("1101"),[cn]),p(S,b("1200"),[pn]),p(S,b("0120"),[mn]),p(S,b("0012"),[dn]),p(S,b("2001"),[vn]),p(S,b("1022"),[pn]),p(S,b("2102"),[mn]),p(S,b("2210"),[dn]),p(S,b("0221"),[vn]),p(S,b("1002"),[hn]),p(S,b("2100"),[yn]),p(S,b("0210"),[xn]),p(S,b("0021"),[Sn]),p(S,b("1220"),[hn]),p(S,b("0122"),[yn]),p(S,b("2012"),[xn]),p(S,b("2201"),[Sn]),p(S,b("0211"),[_n]),p(S,b("2110"),[bn]),p(S,b("1102"),[An]),p(S,b("1021"),[On]),p(S,b("2011"),[_n]),p(S,b("0112"),[bn]),p(S,b("1120"),[An]),p(S,b("1201"),[On]),p(S,b("2101"),[Fe]),p(S,b("0121"),[Fe]),p(S,b("1012"),[Be]),p(S,b("1210"),[Be]),p(S,b("0101"),{0:[we,Me],1:[Fe],2:[Fe]}),p(S,b("1010"),{0:[Ee,De],1:[Be],2:[Be]}),p(S,b("2121"),{0:[Fe],1:[Fe],2:[we,Me]}),p(S,b("1212"),{0:[Be],1:[Be],2:[Ee,De]}),p(S,b("2120"),{0:[it],1:[it],2:[Re,Me]}),p(S,b("2021"),{0:[ot],1:[ot],2:[we,Ie]}),p(S,b("1202"),{0:[st],1:[st],2:[Ee,Ne]}),p(S,b("0212"),{0:[ut],1:[ut],2:[De,Le]}),p(S,b("0102"),{0:[Re,Me],1:[it],2:[it]}),p(S,b("0201"),{0:[we,Ie],1:[ot],2:[ot]}),p(S,b("1020"),{0:[Ee,Ne],1:[st],2:[st]}),p(S,b("2010"),{0:[De,Le],1:[ut],2:[ut]}),p(S,b("2020"),{0:[Le,Ne],1:[Tn],2:[Re,Ie]}),p(S,b("0202"),{0:[Ie,Re],1:[Tn],2:[Le,Ne]}),S);function wn(t,a){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);a&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function Dn(t){for(var a=1;a<arguments.length;a++){var e=arguments[a]!=null?arguments[a]:{};a%2?wn(Object(e),!0).forEach(function(n){p(t,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):wn(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}return t}var ge={ISO_LINES:1,ISO_BANDS:2},Wi={zIndex:0,zOffset:.005};function We(t,a){return Array.isArray(a)?t<a[0]?0:t<a[1]?1:2:t>=a?1:0}function En(t){var a=t.cellWeights,e=t.x,n=t.y,r=t.width,i=t.height,o=t.threshold;t.thresholdValue&&(Mn.log.deprecated("thresholdValue","threshold")(),o=t.thresholdValue);var s=e<0,u=e>=r-1,l=n<0,g=n>=i-1,f=s||u||l||g,c={},v={};s||g?v.top=0:(c.top=a[(n+1)*r+e],v.top=We(c.top,o)),u||g?v.topRight=0:(c.topRight=a[(n+1)*r+e+1],v.topRight=We(c.topRight,o)),u||l?v.right=0:(c.right=a[n*r+e+1],v.right=We(c.right,o)),s||l?v.current=0:(c.current=a[n*r+e],v.current=We(c.current,o));var h=v.top,d=v.topRight,y=v.right,A=v.current,T=-1;Number.isFinite(o)&&(T=h<<3|d<<2|y<<1|A),Array.isArray(o)&&(T=h<<6|d<<4|y<<2|A);var _=0;return f||(_=We((c.top+c.topRight+c.right+c.current)/4,o)),{code:T,meanCode:_}}function Nt(t){var a=t.gridOrigin,e=t.cellSize,n=t.x,r=t.y,i=t.code,o=t.meanCode,s=t.type,u=s===void 0?ge.ISO_LINES:s,l=Dn(Dn({},Wi),t.thresholdData),g=u===ge.ISO_BANDS?Pn[i]:Cn[i];Array.isArray(g)||(g=g[o]);var f=l.zIndex*l.zOffset,c=(n+1)*e[0],v=(r+1)*e[1],h=a[0]+c,d=a[1]+v;if(u===ge.ISO_BANDS){var y=[];return g.forEach(function(T){var _=[];T.forEach(function(C){var w=h+C[0]*e[0],M=d+C[1]*e[1];_.push([w,M,f])}),y.push(_)}),y}var A=[];return g.forEach(function(T){T.forEach(function(_){var C=h+_[0]*e[0],w=d+_[1]*e[1];A.push([C,w,f])})}),A}function Rn(t,a){var e=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=ji(t))||a&&t&&typeof t.length=="number"){e&&(t=e);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(l){throw l},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
346
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,s;return{s:function(){e=e.call(t)},n:function(){var l=e.next();return i=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!i&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function ji(t,a){if(t){if(typeof t=="string")return Nn(t,a);var e=Object.prototype.toString.call(t).slice(8,-1);if(e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set")return Array.from(t);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return Nn(t,a)}}function Nn(t,a){(a==null||a>t.length)&&(a=t.length);for(var e=0,n=new Array(a);e<a;e++)n[e]=t[e];return n}function In(t){var a=t.thresholdData,e=t.cellWeights,n=t.gridSize,r=t.gridOrigin,i=t.cellSize,o=[],s=[],u=n[0],l=n[1],g=0,f=0,c=Rn(a),v;try{for(c.s();!(v=c.n()).done;)for(var h=v.value,d=h.contour,y=d.threshold,A=-1;A<u;A++)for(var T=-1;T<l;T++){var _=En({cellWeights:e,threshold:y,x:A,y:T,width:u,height:l}),C=_.code,w=_.meanCode,M={type:ge.ISO_BANDS,gridOrigin:r,cellSize:i,x:A,y:T,width:u,height:l,code:C,meanCode:w,thresholdData:h};if(Array.isArray(y)){M.type=ge.ISO_BANDS;var D=Nt(M),U=Rn(D),$;try{for(U.s();!($=U.n()).done;){var Y=$.value;s[f++]={vertices:Y,contour:d}}}catch(pe){U.e(pe)}finally{U.f()}}else{M.type=ge.ISO_LINES;for(var ee=Nt(M),H=0;H<ee.length;H+=2)o[g++]={start:ee[H],end:ee[H+1],contour:d}}}}catch(pe){c.e(pe)}finally{c.f()}return{contourSegments:o,contourPolygons:s}}var Bn=R(G());function Vi(t){var a=Hi();return function(){var n=P(t),r;if(a){var i=P(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return z(this,r)}}function Hi(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Ln=[255,255,255,255],$i=1,Xi=1,qi={cellSize:{type:"number",min:1,max:1e3,value:1e3},getPosition:{type:"accessor",value:function(a){return a.position}},getWeight:{type:"accessor",value:1},gpuAggregation:!0,aggregation:"SUM",contours:{type:"object",value:[{threshold:Xi}],optional:!0,compare:3},zOffset:.005},Fn="positions",Yi={data:{props:["cellSize"]},weights:{props:["aggregation"],accessors:["getWeight"]}},ft=function(t){B(e,t);var a=Vi(e);function e(){return N(this,e),a.apply(this,arguments)}return I(e,[{key:"initializeState",value:function(){var r;E(P(e.prototype),"initializeAggregationLayer",this).call(this,{dimensions:Yi}),this.setState({contourData:{},projectPoints:!1,weights:{count:{size:1,operation:L.SUM}}});var i=this.getAttributeManager();i.add((r={},p(r,Fn,{size:3,accessor:"getPosition",type:5130,fp64:this.use64bitPositions()}),p(r,"count",{size:3,accessor:"getWeight"}),r))}},{key:"updateState",value:function(r){E(P(e.prototype),"updateState",this).call(this,r);var i=!1,o=r.oldProps,s=r.props,u=this.state.aggregationDirty;(o.contours!==s.contours||o.zOffset!==s.zOffset)&&(i=!0,this._updateThresholdData(r.props)),this.getNumInstances()>0&&(u||i)&&this._generateContours()}},{key:"renderLayers",value:function(){var r=this.state.contourData,i=r.contourSegments,o=r.contourPolygons,s=this.getSubLayerClass("lines",lt.LineLayer),u=this.getSubLayerClass("bands",lt.SolidPolygonLayer),l=i&&i.length>0&&new s(this.getSubLayerProps({id:"lines"}),{data:this.state.contourData.contourSegments,getSourcePosition:function(c){return c.start},getTargetPosition:function(c){return c.end},getColor:function(c){return c.contour.color||Ln},getWidth:function(c){return c.contour.strokeWidth||$i}}),g=o&&o.length>0&&new u(this.getSubLayerProps({id:"bands"}),{data:this.state.contourData.contourPolygons,getPolygon:function(c){return c.vertices},getFillColor:function(c){return c.contour.color||Ln}});return[l,g]}},{key:"updateAggregationState",value:function(r){var i=r.props,o=r.oldProps,s=i.cellSize,u=i.coordinateSystem,l=this.context.viewport,g=o.cellSize!==s,f=i.gpuAggregation;this.state.gpuAggregation!==i.gpuAggregation&&f&&!V.isSupported(this.context.gl)&&(Bn.log.warn("GPU Grid Aggregation not supported, falling back to CPU")(),f=!1);var c=f!==this.state.gpuAggregation;this.setState({gpuAggregation:f});var v=this.state.dimensions,h=this.isAttributeChanged(Fn),d=v.data,y=v.weights,A=this.state.boundingBox;if(h&&(A=et(this.getAttributes(),this.getNumInstances()),this.setState({boundingBox:A})),h||g){var T=tt(A,s,l,u),_=T.gridOffset,C=T.translation,w=T.width,M=T.height,D=T.numCol,U=T.numRow;this.allocateResources(U,D),this.setState({gridOffset:_,boundingBox:A,translation:C,posOffset:C.slice(),gridOrigin:[-1*C[0],-1*C[1]],width:w,height:M,numCol:D,numRow:U})}var $=h||c||this.isAggregationDirty(r,{dimension:d,compareAll:f}),Y=this.isAggregationDirty(r,{dimension:y});Y&&this._updateAccessors(r),($||Y)&&this._resetResults(),this.setState({aggregationDataDirty:$,aggregationWeightsDirty:Y})}},{key:"_updateAccessors",value:function(r){var i=r.props,o=i.getWeight,s=i.aggregation,u=i.data,l=this.state.weights.count;l&&(l.getWeight=o,l.operation=L[s]),this.setState({getValue:ve(s,o,{data:u})})}},{key:"_resetResults",value:function(){var r=this.state.weights.count;r&&(r.aggregationData=null)}},{key:"_generateContours",value:function(){var r=this.state,i=r.numCol,o=r.numRow,s=r.gridOrigin,u=r.gridOffset,l=r.thresholdData,g=this.state.weights.count,f=g.aggregationData;f||(f=g.aggregationBuffer.getData(),g.aggregationData=f);var c=V.getCellData({countsData:f}),v=c.cellWeights,h=In({thresholdData:l,cellWeights:v,gridSize:[i,o],gridOrigin:s,cellSize:[u.xOffset,u.yOffset]});this.setState({contourData:h})}},{key:"_updateThresholdData",value:function(r){for(var i=r.contours,o=r.zOffset,s=i.length,u=new Array(s),l=0;l<s;l++){var g=i[l];u[l]={contour:g,zIndex:g.zIndex||l,zOffset:o}}this.setState({thresholdData:u})}}]),e}(le);p(ft,"layerName","ContourLayer");p(ft,"defaultProps",qi);var Xn=R(G());var Ft=R(Q()),Hn=R(G());var q=R(G()),gt=R(Q());var zn=`#version 300 es
|
|
346
347
|
#define SHADER_NAME gpu-grid-cell-layer-vertex-shader
|
|
347
348
|
#define RANGE_COUNT 6
|
|
348
349
|
|
|
@@ -448,7 +449,7 @@ void main(void) {
|
|
|
448
449
|
vColor = vec4(color.rgb, color.a * opacity) / 255.;
|
|
449
450
|
}
|
|
450
451
|
}
|
|
451
|
-
`;var
|
|
452
|
+
`;var Un=`#version 300 es
|
|
452
453
|
#define SHADER_NAME gpu-grid-cell-layer-fragment-shader
|
|
453
454
|
|
|
454
455
|
precision highp float;
|
|
@@ -461,8 +462,8 @@ void main(void) {
|
|
|
461
462
|
fragColor = vColor;
|
|
462
463
|
fragColor = picking_filterColor(fragColor);
|
|
463
464
|
}
|
|
464
|
-
`;function Ii(t,a){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);a&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function Li(t){for(var a=1;a<arguments.length;a++){var e=arguments[a]!=null?arguments[a]:{};a%2?Ii(Object(e),!0).forEach(function(n){(0,Ut.default)(t,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):Ii(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}return t}function Nu(t){var a=Iu();return function(){var n=(0,zt.default)(t),r;if(a){var i=(0,zt.default)(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return(0,ki.default)(this,r)}}function Iu(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var dr=0,hr=1,Lu={colorDomain:null,colorRange:Y,elevationDomain:null,elevationRange:[0,1e3],elevationScale:{type:"number",min:0,value:1},gridSize:{type:"array",value:[1,1]},gridOrigin:{type:"array",value:[0,0]},gridOffset:{type:"array",value:[0,0]},cellSize:{type:"number",min:0,max:1e3,value:1e3},offset:{type:"array",value:[1,1]},coverage:{type:"number",min:0,max:1,value:1},extruded:!0,material:!0},Gt=function(t){(0,Ui.default)(e,t);var a=Nu(e);function e(){return(0,Fi.default)(this,e),a.apply(this,arguments)}return(0,Bi.default)(e,[{key:"getShaders",value:function(){return(0,zi.default)((0,zt.default)(e.prototype),"getShaders",this).call(this,{vs:Ri,fs:Ni,modules:[X.project32,X.gouraudLighting,X.picking,_e]})}},{key:"initializeState",value:function(r){var i=r.gl,o=this.getAttributeManager();o.addInstanced({colors:{size:4,noAlloc:!0},elevations:{size:4,noAlloc:!0}});var s=this._getModel(i);this._setupUniformBuffer(s),this.setState({model:s})}},{key:"_getModel",value:function(r){return new kt.Model(r,Li(Li({},this.getShaders()),{},{id:this.props.id,geometry:new kt.CubeGeometry,isInstanced:!0}))}},{key:"draw",value:function(r){var i=r.uniforms,o=this.props,s=o.cellSize,u=o.offset,l=o.extruded,g=o.elevationScale,f=o.coverage,c=o.gridSize,d=o.gridOrigin,h=o.gridOffset,m=o.elevationRange,y=o.colorMaxMinBuffer,O=o.elevationMaxMinBuffer,C=[(0,X.fp64LowPart)(d[0]),(0,X.fp64LowPart)(d[1])],b=[(0,X.fp64LowPart)(h[0]),(0,X.fp64LowPart)(h[1])],P=this.getDomainUniforms(),w=se(this.props.colorRange);this.bindUniformBuffers(y,O),this.state.model.setUniforms(i).setUniforms(P).setUniforms({cellSize:s,offset:u,extruded:l,elevationScale:g,coverage:f,gridSize:c,gridOrigin:d,gridOriginLow:C,gridOffset:h,gridOffsetLow:b,colorRange:w,elevationRange:m}).draw(),this.unbindUniformBuffers(y,O)}},{key:"bindUniformBuffers",value:function(r,i){r.bind({target:35345,index:dr}),i.bind({target:35345,index:hr})}},{key:"unbindUniformBuffers",value:function(r,i){r.unbind({target:35345,index:dr}),i.unbind({target:35345,index:hr})}},{key:"getDomainUniforms",value:function(){var r=this.props,i=r.colorDomain,o=r.elevationDomain,s={};return i!==null?(s.colorDomainValid=!0,s.colorDomain=i):s.colorDomainValid=!1,o!==null?(s.elevationDomainValid=!0,s.elevationDomain=o):s.elevationDomainValid=!1,s}},{key:"_setupUniformBuffer",value:function(r){var i=this.context.gl,o=r.program.handle,s=i.getUniformBlockIndex(o,"ColorData"),u=i.getUniformBlockIndex(o,"ElevationData");i.uniformBlockBinding(o,s,dr),i.uniformBlockBinding(o,u,hr)}}]),e}(X.Layer);(0,Ut.default)(Gt,"layerName","GPUGridCellLayer");(0,Ut.default)(Gt,"defaultProps",Lu);function Gi(t,a){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);a&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function Wi(t){for(var a=1;a<arguments.length;a++){var e=arguments[a]!=null?arguments[a]:{};a%2?Gi(Object(e),!0).forEach(function(n){(0,de.default)(t,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):Gi(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}return t}function Fu(t){var a=Bu();return function(){var n=(0,$e.default)(t),r;if(a){var i=(0,$e.default)(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return(0,Xi.default)(this,r)}}function Bu(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var zu={colorDomain:null,colorRange:Y,getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",elevationDomain:null,elevationRange:[0,1e3],getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationScale:{type:"number",min:0,value:1},cellSize:{type:"number",min:1,max:1e3,value:1e3},coverage:{type:"number",min:0,max:1,value:1},getPosition:{type:"accessor",value:function(a){return a.position}},extruded:!1,material:!0},Uu={data:{props:["cellSize","colorAggregation","elevationAggregation"]}},ji="positions",he=function(t){(0,$i.default)(e,t);var a=Fu(e);function e(){return(0,Vi.default)(this,e),a.apply(this,arguments)}return(0,Hi.default)(e,[{key:"initializeState",value:function(r){var i,o=r.gl,s=G.isSupported(o);s||qi.log.error("GPUGridLayer is not supported on this browser, use GridLayer instead")(),(0,Wt.default)((0,$e.default)(e.prototype),"initializeAggregationLayer",this).call(this,{dimensions:Uu}),this.setState({gpuAggregation:!0,projectPoints:!1,isSupported:s,weights:{color:{needMin:!0,needMax:!0,combineMaxMin:!0,maxMinBuffer:new yr.Buffer(o,{byteLength:4*4,accessor:{size:4,type:5126,divisor:1}})},elevation:{needMin:!0,needMax:!0,combineMaxMin:!0,maxMinBuffer:new yr.Buffer(o,{byteLength:4*4,accessor:{size:4,type:5126,divisor:1}})}},positionAttributeName:"positions"});var u=this.getAttributeManager();u.add((i={},(0,de.default)(i,ji,{size:3,accessor:"getPosition",type:5130,fp64:this.use64bitPositions()}),(0,de.default)(i,"color",{size:3,accessor:"getColorWeight"}),(0,de.default)(i,"elevation",{size:3,accessor:"getElevationWeight"}),i))}},{key:"updateState",value:function(r){if(this.state.isSupported!==!1){(0,Wt.default)((0,$e.default)(e.prototype),"updateState",this).call(this,r);var i=this.state.aggregationDirty;i&&this.setState({gridHash:null})}}},{key:"getHashKeyForIndex",value:function(r){var i=this.state,o=i.numRow,s=i.numCol,u=i.boundingBox,l=i.gridOffset,g=[s,o],f=[u.xMin,u.yMin],c=[l.xOffset,l.yOffset],d=Math.floor(r/g[0]),h=r-d*g[0],m=Math.floor((d*c[1]+f[1]+90+c[1]/2)/c[1]),y=Math.floor((h*c[0]+f[0]+180+c[0]/2)/c[0]);return"".concat(m,"-").concat(y)}},{key:"getPositionForIndex",value:function(r){var i=this.state,o=i.numRow,s=i.numCol,u=i.boundingBox,l=i.gridOffset,g=[s,o],f=[u.xMin,u.yMin],c=[l.xOffset,l.yOffset],d=Math.floor(r/g[0]),h=r-d*g[0],m=d*c[1]+f[1],y=h*c[0]+f[0];return[y,m]}},{key:"getPickingInfo",value:function(r){var i=r.info,o=r.mode,s=i.index,u=null;if(s>=0){var l=this.state.gpuGridAggregator,g=this.getPositionForIndex(s),f=G.getAggregationData(Wi({pixelIndex:s},l.getData("color"))),c=G.getAggregationData(Wi({pixelIndex:s},l.getData("elevation")));if(u={colorValue:f.cellWeight,elevationValue:c.cellWeight,count:f.cellCount||c.cellCount,position:g,totalCount:f.totalCount||c.totalCount},o!=="hover"){var d=this.props,h=this.state.gridHash;if(!h){var m=this.state,y=m.gridOffset,O=m.translation,C=m.boundingBox,b=this.context.viewport,P=this.getAttributes(),w=Ee(d,{gridOffset:y,attributes:P,viewport:b,translation:O,boundingBox:C});h=w.gridHash,this.setState({gridHash:h})}var M=this.getHashKeyForIndex(s),D=h[M];Object.assign(u,D)}}return i.picked=Boolean(u),i.object=u,i}},{key:"renderLayers",value:function(){if(!this.state.isSupported)return null;var r=this.props,i=r.elevationScale,o=r.extruded,s=r.cellSize,u=r.coverage,l=r.material,g=r.elevationRange,f=r.colorDomain,c=r.elevationDomain,d=this.state,h=d.weights,m=d.numRow,y=d.numCol,O=d.gridOrigin,C=d.gridOffset,b=h.color,P=h.elevation,w=se(this.props.colorRange),M=this.getSubLayerClass("gpu-grid-cell",Gt);return new M({gridSize:[y,m],gridOrigin:O,gridOffset:[C.xOffset,C.yOffset],colorRange:w,elevationRange:g,colorDomain:f,elevationDomain:c,cellSize:s,coverage:u,material:l,elevationScale:i,extruded:o},this.getSubLayerProps({id:"gpu-grid-cell"}),{data:{attributes:{colors:b.aggregationBuffer,elevations:P.aggregationBuffer}},colorMaxMinBuffer:b.maxMinBuffer,elevationMaxMinBuffer:P.maxMinBuffer,numInstances:y*m})}},{key:"finalizeState",value:function(r){var i=this.state.weights,o=i.color,s=i.elevation;[o,s].forEach(function(u){var l=u.aggregationBuffer,g=u.maxMinBuffer;g.delete(),l?.delete()}),(0,Wt.default)((0,$e.default)(e.prototype),"finalizeState",this).call(this,r)}},{key:"updateAggregationState",value:function(r){var i=r.props,o=r.oldProps,s=i.cellSize,u=i.coordinateSystem,l=this.context.viewport,g=o.cellSize!==s,f=this.state.dimensions,c=this.isAttributeChanged(ji),d=c||this.isAttributeChanged(),h=this.state.boundingBox;if(c&&(h=At(this.getAttributes(),this.getNumInstances()),this.setState({boundingBox:h})),c||g){var m=Ot(h,s,l,u),y=m.gridOffset,O=m.translation,C=m.width,b=m.height,P=m.numCol,w=m.numRow;this.allocateResources(w,P),this.setState({gridOffset:y,translation:O,gridOrigin:[-1*O[0],-1*O[1]],width:C,height:b,numCol:P,numRow:w})}var M=d||this.isAggregationDirty(r,{dimension:f.data,compareAll:!0});M&&this._updateAccessors(r),this.setState({aggregationDataDirty:M})}},{key:"_updateAccessors",value:function(r){var i=r.props,o=i.colorAggregation,s=i.elevationAggregation,u=this.state.weights,l=u.color,g=u.elevation;l.operation=E[o],g.operation=E[s]}}]),e}(ce);(0,de.default)(he,"layerName","GPUGridLayer");(0,de.default)(he,"defaultProps",zu);function ku(t){var a=Gu();return function(){var n=(0,Sr.default)(t),r;if(a){var i=(0,Sr.default)(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return(0,eo.default)(this,r)}}function Gu(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Yi(t,a){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);a&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function xr(t){for(var a=1;a<arguments.length;a++){var e=arguments[a]!=null?arguments[a]:{};a%2?Yi(Object(e),!0).forEach(function(n){(0,nt.default)(t,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):Yi(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}return t}var Wu=xr(xr(xr({},he.defaultProps),ve.defaultProps),{},{gpuAggregation:!1}),jt=function(t){(0,Ji.default)(e,t);var a=ku(e);function e(){var n;(0,Ki.default)(this,e);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return n=a.call.apply(a,[this].concat(i)),(0,nt.default)((0,Zi.default)(n),"state",void 0),n}return(0,Qi.default)(e,[{key:"initializeState",value:function(){this.state={useGPUAggregation:!0}}},{key:"updateState",value:function(r){var i=r.props;this.setState({useGPUAggregation:this.canUseGPUAggregation(i)})}},{key:"renderLayers",value:function(){var r=this.props,i=r.data,o=r.updateTriggers,s=this.state.useGPUAggregation?"GPU":"CPU",u=this.state.useGPUAggregation?this.getSubLayerClass("GPU",he):this.getSubLayerClass("CPU",ve);return new u(this.props,this.getSubLayerProps({id:s,updateTriggers:o}),{data:i})}},{key:"canUseGPUAggregation",value:function(r){var i=r.gpuAggregation,o=r.lowerPercentile,s=r.upperPercentile,u=r.getColorValue,l=r.getElevationValue,g=r.colorScaleType;return!(!i||!G.isSupported(this.context.gl)||o!==0||s!==100||u!==null||l!==null||g==="quantile"||g==="ordinal")}}]),e}(to.CompositeLayer);(0,nt.default)(jt,"layerName","GridLayer");(0,nt.default)(jt,"defaultProps",Wu);var Pr=v(Ye()),Oo=v(z()),To=v(U()),Co=v(ae()),at=v(K()),Po=v(H()),wo=v($()),ye=v(j()),ee=v(L());var _r=v(Ye()),ao=v(Q());function ju(t,a){var e=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=Vu(t))||a&&t&&typeof t.length=="number"){e&&(t=e);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(l){throw l},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
465
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,s;return{s:function(){e=e.call(t)},n:function(){var l=e.next();return i=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!i&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function
|
|
465
|
+
`;function kn(t,a){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);a&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function Gn(t){for(var a=1;a<arguments.length;a++){var e=arguments[a]!=null?arguments[a]:{};a%2?kn(Object(e),!0).forEach(function(n){p(t,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):kn(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}return t}function Ki(t){var a=Qi();return function(){var n=P(t),r;if(a){var i=P(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return z(this,r)}}function Qi(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var It=0,Lt=1,Zi={colorDomain:null,colorRange:K,elevationDomain:null,elevationRange:[0,1e3],elevationScale:{type:"number",min:0,value:1},gridSize:{type:"array",value:[1,1]},gridOrigin:{type:"array",value:[0,0]},gridOffset:{type:"array",value:[0,0]},cellSize:{type:"number",min:0,max:1e3,value:1e3},offset:{type:"array",value:[1,1]},coverage:{type:"number",min:0,max:1,value:1},extruded:!0,material:!0},ct=function(t){B(e,t);var a=Ki(e);function e(){return N(this,e),a.apply(this,arguments)}return I(e,[{key:"getShaders",value:function(){return E(P(e.prototype),"getShaders",this).call(this,{vs:zn,fs:Un,modules:[q.project32,q.gouraudLighting,q.picking,de]})}},{key:"initializeState",value:function(r){var i=r.gl,o=this.getAttributeManager();o.addInstanced({colors:{size:4,noAlloc:!0},elevations:{size:4,noAlloc:!0}});var s=this._getModel(i);this._setupUniformBuffer(s),this.setState({model:s})}},{key:"_getModel",value:function(r){return new gt.Model(r,Gn(Gn({},this.getShaders()),{},{id:this.props.id,geometry:new gt.CubeGeometry,isInstanced:!0}))}},{key:"draw",value:function(r){var i=r.uniforms,o=this.props,s=o.cellSize,u=o.offset,l=o.extruded,g=o.elevationScale,f=o.coverage,c=o.gridSize,v=o.gridOrigin,h=o.gridOffset,d=o.elevationRange,y=o.colorMaxMinBuffer,A=o.elevationMaxMinBuffer,T=[(0,q.fp64LowPart)(v[0]),(0,q.fp64LowPart)(v[1])],_=[(0,q.fp64LowPart)(h[0]),(0,q.fp64LowPart)(h[1])],C=this.getDomainUniforms(),w=oe(this.props.colorRange);this.bindUniformBuffers(y,A),this.state.model.setUniforms(i).setUniforms(C).setUniforms({cellSize:s,offset:u,extruded:l,elevationScale:g,coverage:f,gridSize:c,gridOrigin:v,gridOriginLow:T,gridOffset:h,gridOffsetLow:_,colorRange:w,elevationRange:d}).draw(),this.unbindUniformBuffers(y,A)}},{key:"bindUniformBuffers",value:function(r,i){r.bind({target:35345,index:It}),i.bind({target:35345,index:Lt})}},{key:"unbindUniformBuffers",value:function(r,i){r.unbind({target:35345,index:It}),i.unbind({target:35345,index:Lt})}},{key:"getDomainUniforms",value:function(){var r=this.props,i=r.colorDomain,o=r.elevationDomain,s={};return i!==null?(s.colorDomainValid=!0,s.colorDomain=i):s.colorDomainValid=!1,o!==null?(s.elevationDomainValid=!0,s.elevationDomain=o):s.elevationDomainValid=!1,s}},{key:"_setupUniformBuffer",value:function(r){var i=this.context.gl,o=r.program.handle,s=i.getUniformBlockIndex(o,"ColorData"),u=i.getUniformBlockIndex(o,"ElevationData");i.uniformBlockBinding(o,s,It),i.uniformBlockBinding(o,u,Lt)}}]),e}(q.Layer);p(ct,"layerName","GPUGridCellLayer");p(ct,"defaultProps",Zi);function Wn(t,a){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);a&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function jn(t){for(var a=1;a<arguments.length;a++){var e=arguments[a]!=null?arguments[a]:{};a%2?Wn(Object(e),!0).forEach(function(n){p(t,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):Wn(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}return t}function Ji(t){var a=eo();return function(){var n=P(t),r;if(a){var i=P(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return z(this,r)}}function eo(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var to={colorDomain:null,colorRange:K,getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",elevationDomain:null,elevationRange:[0,1e3],getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationScale:{type:"number",min:0,value:1},cellSize:{type:"number",min:1,max:1e3,value:1e3},coverage:{type:"number",min:0,max:1,value:1},getPosition:{type:"accessor",value:function(a){return a.position}},extruded:!1,material:!0},ro={data:{props:["cellSize","colorAggregation","elevationAggregation"]}},Vn="positions",ce=function(t){B(e,t);var a=Ji(e);function e(){return N(this,e),a.apply(this,arguments)}return I(e,[{key:"initializeState",value:function(r){var i,o=r.gl,s=V.isSupported(o);s||Hn.log.error("GPUGridLayer is not supported on this browser, use GridLayer instead")(),E(P(e.prototype),"initializeAggregationLayer",this).call(this,{dimensions:ro}),this.setState({gpuAggregation:!0,projectPoints:!1,isSupported:s,weights:{color:{needMin:!0,needMax:!0,combineMaxMin:!0,maxMinBuffer:new Ft.Buffer(o,{byteLength:4*4,accessor:{size:4,type:5126,divisor:1}})},elevation:{needMin:!0,needMax:!0,combineMaxMin:!0,maxMinBuffer:new Ft.Buffer(o,{byteLength:4*4,accessor:{size:4,type:5126,divisor:1}})}},positionAttributeName:"positions"});var u=this.getAttributeManager();u.add((i={},p(i,Vn,{size:3,accessor:"getPosition",type:5130,fp64:this.use64bitPositions()}),p(i,"color",{size:3,accessor:"getColorWeight"}),p(i,"elevation",{size:3,accessor:"getElevationWeight"}),i))}},{key:"updateState",value:function(r){if(this.state.isSupported!==!1){E(P(e.prototype),"updateState",this).call(this,r);var i=this.state.aggregationDirty;i&&this.setState({gridHash:null})}}},{key:"getHashKeyForIndex",value:function(r){var i=this.state,o=i.numRow,s=i.numCol,u=i.boundingBox,l=i.gridOffset,g=[s,o],f=[u.xMin,u.yMin],c=[l.xOffset,l.yOffset],v=Math.floor(r/g[0]),h=r-v*g[0],d=Math.floor((v*c[1]+f[1]+90+c[1]/2)/c[1]),y=Math.floor((h*c[0]+f[0]+180+c[0]/2)/c[0]);return"".concat(d,"-").concat(y)}},{key:"getPositionForIndex",value:function(r){var i=this.state,o=i.numRow,s=i.numCol,u=i.boundingBox,l=i.gridOffset,g=[s,o],f=[u.xMin,u.yMin],c=[l.xOffset,l.yOffset],v=Math.floor(r/g[0]),h=r-v*g[0],d=v*c[1]+f[1],y=h*c[0]+f[0];return[y,d]}},{key:"getPickingInfo",value:function(r){var i=r.info,o=r.mode,s=i.index,u=null;if(s>=0){var l=this.state.gpuGridAggregator,g=this.getPositionForIndex(s),f=V.getAggregationData(jn({pixelIndex:s},l.getData("color"))),c=V.getAggregationData(jn({pixelIndex:s},l.getData("elevation")));if(u={colorValue:f.cellWeight,elevationValue:c.cellWeight,count:f.cellCount||c.cellCount,position:g,totalCount:f.totalCount||c.totalCount},o!=="hover"){var v=this.props,h=this.state.gridHash;if(!h){var d=this.state,y=d.gridOffset,A=d.translation,T=d.boundingBox,_=this.context.viewport,C=this.getAttributes(),w=Te(v,{gridOffset:y,attributes:C,viewport:_,translation:A,boundingBox:T});h=w.gridHash,this.setState({gridHash:h})}var M=this.getHashKeyForIndex(s),D=h[M];Object.assign(u,D)}}return i.picked=Boolean(u),i.object=u,i}},{key:"renderLayers",value:function(){if(!this.state.isSupported)return null;var r=this.props,i=r.elevationScale,o=r.extruded,s=r.cellSize,u=r.coverage,l=r.material,g=r.elevationRange,f=r.colorDomain,c=r.elevationDomain,v=this.state,h=v.weights,d=v.numRow,y=v.numCol,A=v.gridOrigin,T=v.gridOffset,_=h.color,C=h.elevation,w=oe(this.props.colorRange),M=this.getSubLayerClass("gpu-grid-cell",ct);return new M({gridSize:[y,d],gridOrigin:A,gridOffset:[T.xOffset,T.yOffset],colorRange:w,elevationRange:g,colorDomain:f,elevationDomain:c,cellSize:s,coverage:u,material:l,elevationScale:i,extruded:o},this.getSubLayerProps({id:"gpu-grid-cell"}),{data:{attributes:{colors:_.aggregationBuffer,elevations:C.aggregationBuffer}},colorMaxMinBuffer:_.maxMinBuffer,elevationMaxMinBuffer:C.maxMinBuffer,numInstances:y*d})}},{key:"finalizeState",value:function(r){var i=this.state.weights,o=i.color,s=i.elevation;[o,s].forEach(function(u){var l=u.aggregationBuffer,g=u.maxMinBuffer;g.delete(),l?.delete()}),E(P(e.prototype),"finalizeState",this).call(this,r)}},{key:"updateAggregationState",value:function(r){var i=r.props,o=r.oldProps,s=i.cellSize,u=i.coordinateSystem,l=this.context.viewport,g=o.cellSize!==s,f=this.state.dimensions,c=this.isAttributeChanged(Vn),v=c||this.isAttributeChanged(),h=this.state.boundingBox;if(c&&(h=et(this.getAttributes(),this.getNumInstances()),this.setState({boundingBox:h})),c||g){var d=tt(h,s,l,u),y=d.gridOffset,A=d.translation,T=d.width,_=d.height,C=d.numCol,w=d.numRow;this.allocateResources(w,C),this.setState({gridOffset:y,translation:A,gridOrigin:[-1*A[0],-1*A[1]],width:T,height:_,numCol:C,numRow:w})}var M=v||this.isAggregationDirty(r,{dimension:f.data,compareAll:!0});M&&this._updateAccessors(r),this.setState({aggregationDataDirty:M})}},{key:"_updateAccessors",value:function(r){var i=r.props,o=i.colorAggregation,s=i.elevationAggregation,u=this.state.weights,l=u.color,g=u.elevation;l.operation=L[o],g.operation=L[s]}}]),e}(le);p(ce,"layerName","GPUGridLayer");p(ce,"defaultProps",to);function no(t){var a=ao();return function(){var n=P(t),r;if(a){var i=P(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return z(this,r)}}function ao(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function $n(t,a){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);a&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function Bt(t){for(var a=1;a<arguments.length;a++){var e=arguments[a]!=null?arguments[a]:{};a%2?$n(Object(e),!0).forEach(function(n){p(t,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):$n(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}return t}var io=Bt(Bt(Bt({},ce.defaultProps),fe.defaultProps),{},{gpuAggregation:!1}),pt=function(t){B(e,t);var a=no(e);function e(){var n;N(this,e);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return n=a.call.apply(a,[this].concat(i)),p(W(n),"state",void 0),n}return I(e,[{key:"initializeState",value:function(){this.state={useGPUAggregation:!0}}},{key:"updateState",value:function(r){var i=r.props;this.setState({useGPUAggregation:this.canUseGPUAggregation(i)})}},{key:"renderLayers",value:function(){var r=this.props,i=r.data,o=r.updateTriggers,s=this.state.useGPUAggregation?"GPU":"CPU",u=this.state.useGPUAggregation?this.getSubLayerClass("GPU",ce):this.getSubLayerClass("CPU",fe);return new u(this.props,this.getSubLayerProps({id:s,updateTriggers:o}),{data:i})}},{key:"canUseGPUAggregation",value:function(r){var i=r.gpuAggregation,o=r.lowerPercentile,s=r.upperPercentile,u=r.getColorValue,l=r.getElevationValue,g=r.colorScaleType;return!(!i||!V.isSupported(this.context.gl)||o!==0||s!==100||u!==null||l!==null||g==="quantile"||g==="ordinal")}}]),e}(Xn.CompositeLayer);p(pt,"layerName","GridLayer");p(pt,"defaultProps",io);var Kn=R(Q());function oo(t,a){var e=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=so(t))||a&&t&&typeof t.length=="number"){e&&(t=e);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(l){throw l},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
466
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,s;return{s:function(){e=e.call(t)},n:function(){var l=e.next();return i=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!i&&e.return!=null&&e.return()}finally{if(o)throw s}}}}function so(t,a){if(t){if(typeof t=="string")return qn(t,a);var e=Object.prototype.toString.call(t).slice(8,-1);if(e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set")return Array.from(t);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return qn(t,a)}}function qn(t,a){(a==null||a>t.length)&&(a=t.length);for(var e=0,n=new Array(a);e<a;e++)n[e]=t[e];return n}function Qn(t){var a=t.map(function(s){return s[0]}),e=t.map(function(s){return s[1]}),n=Math.min.apply(null,a),r=Math.max.apply(null,a),i=Math.min.apply(null,e),o=Math.max.apply(null,e);return[n,i,r,o]}function Zn(t,a){return a[0]>=t[0]&&a[2]<=t[2]&&a[1]>=t[1]&&a[3]<=t[3]}var Yn=new Float32Array(12);function zt(t){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2,e=0,n=oo(t),r;try{for(n.s();!(r=n.n()).done;)for(var i=r.value,o=0;o<a;o++)Yn[e++]=i[o]||0}catch(s){n.e(s)}finally{n.f()}return Yn}function Jn(t,a,e){var n=X(t,4),r=n[0],i=n[1],o=n[2],s=n[3],u=o-r,l=s-i,g=u,f=l;u/l<a/e?g=a/e*l:f=e/a*u,g<a&&(g=a,f=e);var c=(o+r)/2,v=(s+i)/2;return[c-g/2,v-f/2,c+g/2,v+f/2]}function ea(t,a){var e=X(a,4),n=e[0],r=e[1],i=e[2],o=e[3];return[(t[0]-n)/(i-n),(t[1]-r)/(o-r)]}function ta(t){var a=t.gl,e=t.floatTargetSupport;return e?{format:(0,Kn.isWebGL2)(a)?34836:6408,type:5126}:{format:6408,type:5121}}var k=R(Q()),re=R(G());var dt=R(Q()),vt=R(G());var ra=`#define SHADER_NAME heatp-map-layer-vertex-shader
|
|
466
467
|
|
|
467
468
|
uniform sampler2D maxTexture;
|
|
468
469
|
uniform float intensity;
|
|
@@ -490,7 +491,7 @@ void main(void) {
|
|
|
490
491
|
vIntensityMax = intensity / maxValue;
|
|
491
492
|
vIntensityMin = intensity / minValue;
|
|
492
493
|
}
|
|
493
|
-
`;var
|
|
494
|
+
`;var na=`#define SHADER_NAME triangle-layer-fragment-shader
|
|
494
495
|
|
|
495
496
|
precision highp float;
|
|
496
497
|
|
|
@@ -525,7 +526,7 @@ void main(void) {
|
|
|
525
526
|
linearColor.a *= opacity;
|
|
526
527
|
gl_FragColor =linearColor;
|
|
527
528
|
}
|
|
528
|
-
`;function
|
|
529
|
+
`;function aa(t,a){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);a&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function mt(t){for(var a=1;a<arguments.length;a++){var e=arguments[a]!=null?arguments[a]:{};a%2?aa(Object(e),!0).forEach(function(n){p(t,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):aa(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}return t}function uo(t){var a=lo();return function(){var n=P(t),r;if(a){var i=P(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return z(this,r)}}function lo(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Ut=function(t){B(e,t);var a=uo(e);function e(){return N(this,e),a.apply(this,arguments)}return I(e,[{key:"getShaders",value:function(){return{vs:ra,fs:na,modules:[vt.project32]}}},{key:"initializeState",value:function(r){var i=r.gl,o=this.getAttributeManager();o.add({positions:{size:3,noAlloc:!0},texCoords:{size:2,noAlloc:!0}}),this.setState({model:this._getModel(i)})}},{key:"_getModel",value:function(r){var i=this.props.vertexCount;return new dt.Model(r,mt(mt({},this.getShaders()),{},{id:this.props.id,geometry:new dt.Geometry({drawMode:6,vertexCount:i})}))}},{key:"draw",value:function(r){var i=r.uniforms,o=this.state.model,s=this.props,u=s.texture,l=s.maxTexture,g=s.colorTexture,f=s.intensity,c=s.threshold,v=s.aggregationMode,h=s.colorDomain;o.setUniforms(mt(mt({},i),{},{texture:u,maxTexture:l,colorTexture:g,intensity:f,threshold:c,aggregationMode:v,colorDomain:h})).draw()}}]),e}(vt.Layer);p(Ut,"layerName","TriangleLayer");var ia=`attribute vec3 positions;
|
|
529
530
|
attribute vec3 positions64Low;
|
|
530
531
|
attribute float weights;
|
|
531
532
|
varying vec4 weightsTexture;
|
|
@@ -544,7 +545,7 @@ void main()
|
|
|
544
545
|
gl_Position.xy = (commonPosition.xy - commonBounds.xy) / (commonBounds.zw - commonBounds.xy) ;
|
|
545
546
|
gl_Position.xy = (gl_Position.xy * 2.) - (1.);
|
|
546
547
|
}
|
|
547
|
-
`;var
|
|
548
|
+
`;var oa=`varying vec4 weightsTexture;
|
|
548
549
|
float gaussianKDE(float u){
|
|
549
550
|
return pow(2.71828, -u*u/0.05555)/(1.77245385*0.166666);
|
|
550
551
|
}
|
|
@@ -557,7 +558,7 @@ void main()
|
|
|
557
558
|
gl_FragColor = weightsTexture * gaussianKDE(2. * dist);
|
|
558
559
|
DECKGL_FILTER_COLOR(gl_FragColor, geometry);
|
|
559
560
|
}
|
|
560
|
-
`;var
|
|
561
|
+
`;var sa=`attribute vec4 inTexture;
|
|
561
562
|
varying vec4 outTexture;
|
|
562
563
|
|
|
563
564
|
void main()
|
|
@@ -566,11 +567,11 @@ outTexture = inTexture;
|
|
|
566
567
|
gl_Position = vec4(0, 0, 0, 1.);
|
|
567
568
|
gl_PointSize = 1.0;
|
|
568
569
|
}
|
|
569
|
-
`;var
|
|
570
|
+
`;var ua=`varying vec4 outTexture;
|
|
570
571
|
void main() {
|
|
571
572
|
gl_FragColor = outTexture;
|
|
572
573
|
gl_FragColor.g = outTexture.r / max(1.0, outTexture.a);
|
|
573
574
|
}
|
|
574
|
-
`;var Xe;function bo(t,a){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);a&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function qe(t){for(var a=1;a<arguments.length;a++){var e=arguments[a]!=null?arguments[a]:{};a%2?bo(Object(e),!0).forEach(function(n){(0,ee.default)(t,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):bo(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}return t}function Xu(t){var a=qu();return function(){var n=(0,ye.default)(t),r;if(a){var i=(0,ye.default)(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return(0,wo.default)(this,r)}}function qu(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Yu=2,Cr={mipmaps:!1,parameters:(Xe={},(0,ee.default)(Xe,10240,9729),(0,ee.default)(Xe,10241,9729),(0,ee.default)(Xe,10242,33071),(0,ee.default)(Xe,10243,33071),Xe),dataFormat:6408},Ao=[0,0],Ku={SUM:0,MEAN:1},Qu={getPosition:{type:"accessor",value:function(a){return a.position}},getWeight:{type:"accessor",value:1},intensity:{type:"number",min:0,value:1},radiusPixels:{type:"number",min:1,max:100,value:50},colorRange:Y,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}},Zu=[I.FEATURES.BLEND_EQUATION_MINMAX,I.FEATURES.TEXTURE_FLOAT],Ju=[I.FEATURES.COLOR_ATTACHMENT_RGBA32F,I.FEATURES.FLOAT_BLEND],el={data:{props:["radiusPixels"]}},Xt=function(t){(0,Po.default)(e,t);var a=Xu(e);function e(){var n;(0,Oo.default)(this,e);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return n=a.call.apply(a,[this].concat(i)),(0,ee.default)((0,Co.default)(n),"state",void 0),n}return(0,To.default)(e,[{key:"initializeState",value:function(){var r=this.context.gl;if(!(0,I.hasFeatures)(r,Zu)){this.setState({supported:!1}),ne.log.error("HeatmapLayer: ".concat(this.id," is not supported on this browser"))();return}(0,at.default)((0,ye.default)(e.prototype),"initializeAggregationLayer",this).call(this,el),this.setState({supported:!0,colorDomain:Ao}),this._setupTextureParams(),this._setupAttributes(),this._setupResources()}},{key:"shouldUpdateState",value:function(r){var i=r.changeFlags;return i.somethingChanged}},{key:"updateState",value:function(r){this.state.supported&&((0,at.default)((0,ye.default)(e.prototype),"updateState",this).call(this,r),this._updateHeatmapState(r))}},{key:"_updateHeatmapState",value:function(r){var i=r.props,o=r.oldProps,s=this._getChangeFlags(r);(s.dataChanged||s.viewportChanged)&&(s.boundsChanged=this._updateBounds(s.dataChanged),this._updateTextureRenderingBounds()),s.dataChanged||s.boundsChanged?(clearTimeout(this.state.updateTimer),this.setState({isWeightMapDirty:!0})):s.viewportZoomChanged&&this._debouncedUpdateWeightmap(),i.colorRange!==o.colorRange&&this._updateColorTexture(r),this.state.isWeightMapDirty&&this._updateWeightmap(),this.setState({zoom:r.context.viewport.zoom})}},{key:"renderLayers",value:function(){if(!this.state.supported)return[];var r=this.state,i=r.weightsTexture,o=r.triPositionBuffer,s=r.triTexCoordBuffer,u=r.maxWeightsTexture,l=r.colorTexture,g=r.colorDomain,f=this.props,c=f.updateTriggers,d=f.intensity,h=f.threshold,m=f.aggregation,y=this.getSubLayerClass("triangle",Tr);return new y(this.getSubLayerProps({id:"triangle-layer",updateTriggers:c}),{coordinateSystem:ne.COORDINATE_SYSTEM.DEFAULT,data:{attributes:{positions:o,texCoords:s}},vertexCount:4,maxTexture:u,colorTexture:l,aggregationMode:Ku[m]||0,texture:i,intensity:d,threshold:h,colorDomain:g})}},{key:"finalizeState",value:function(r){(0,at.default)((0,ye.default)(e.prototype),"finalizeState",this).call(this,r);var i=this.state,o=i.weightsTransform,s=i.weightsTexture,u=i.maxWeightTransform,l=i.maxWeightsTexture,g=i.triPositionBuffer,f=i.triTexCoordBuffer,c=i.colorTexture,d=i.updateTimer;o?.delete(),s?.delete(),u?.delete(),l?.delete(),g?.delete(),f?.delete(),c?.delete(),d&&clearTimeout(d)}},{key:"_getAttributeManager",value:function(){return new ne.AttributeManager(this.context.gl,{id:this.props.id,stats:this.context.stats})}},{key:"_getChangeFlags",value:function(r){var i={},o=this.state.dimensions;i.dataChanged=this.isAttributeChanged()||this.isAggregationDirty(r,{compareAll:!0,dimension:o.data}),i.viewportChanged=r.changeFlags.viewportChanged;var s=this.state.zoom;return(!r.context.viewport||r.context.viewport.zoom!==s)&&(i.viewportZoomChanged=!0),i}},{key:"_createTextures",value:function(){var r=this.context.gl,i=this.state,o=i.textureSize,s=i.format,u=i.type;this.setState({weightsTexture:new I.Texture2D(r,qe({width:o,height:o,format:s,type:u},Cr)),maxWeightsTexture:new I.Texture2D(r,qe({format:s,type:u},Cr))})}},{key:"_setupAttributes",value:function(){var r=this.getAttributeManager();r.add({positions:{size:3,type:5130,accessor:"getPosition"},weights:{size:1,accessor:"getWeight"}}),this.setState({positionAttributeName:"positions"})}},{key:"_setupTextureParams",value:function(){var r=this.context.gl,i=this.props.weightsTextureSize,o=Math.min(i,(0,I.getParameters)(r,3379)),s=(0,I.hasFeatures)(r,Ju),u=lo({gl:r,floatTargetSupport:s}),l=u.format,g=u.type,f=s?1:1/255;this.setState({textureSize:o,format:l,type:g,weightsScale:f}),s||ne.log.warn("HeatmapLayer: ".concat(this.id," rendering to float texture not supported, fallingback to low precession format"))()}},{key:"getShaders",value:function(r){return(0,at.default)((0,ye.default)(e.prototype),"getShaders",this).call(this,r==="max-weights-transform"?{vs:So,_fs:_o}:{vs:yo,_fs:xo})}},{key:"_createWeightsTransform",value:function(){var r,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=this.context.gl,s=this.state.weightsTransform,u=this.state.weightsTexture;(r=s)===null||r===void 0||r.delete(),s=new I.Transform(o,qe({id:"".concat(this.id,"-weights-transform"),elementCount:1,_targetTexture:u,_targetTextureVarying:"weightsTexture"},i)),this.setState({weightsTransform:s})}},{key:"_setupResources",value:function(){var r=this.context.gl;this._createTextures();var i=this.state,o=i.textureSize,s=i.weightsTexture,u=i.maxWeightsTexture,l=this.getShaders("weights-transform");this._createWeightsTransform(l);var g=this.getShaders("max-weights-transform"),f=new I.Transform(r,qe(qe({id:"".concat(this.id,"-max-weights-transform"),_sourceTextures:{inTexture:s},_targetTexture:u,_targetTextureVarying:"outTexture"},g),{},{elementCount:o*o}));this.setState({weightsTexture:s,maxWeightsTexture:u,maxWeightTransform:f,zoom:null,triPositionBuffer:new I.Buffer(r,{byteLength:48,accessor:{size:3}}),triTexCoordBuffer:new I.Buffer(r,{byteLength:48,accessor:{size:2}})})}},{key:"updateShaders",value:function(r){this._createWeightsTransform(r)}},{key:"_updateMaxWeightValue",value:function(){var r=this.state.maxWeightTransform;r.run({parameters:{blend:!0,depthTest:!1,blendFunc:[1,1],blendEquation:32776}})}},{key:"_updateBounds",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,i=this.context.viewport,o=[i.unproject([0,0]),i.unproject([i.width,0]),i.unproject([i.width,i.height]),i.unproject([0,i.height])].map(function(d){return d.map(Math.fround)}),s=io(o),u={visibleWorldBounds:s,viewportCorners:o},l=!1;if(r||!this.state.worldBounds||!oo(this.state.worldBounds,s)){var g=this._worldToCommonBounds(s),f=this._commonToWorldBounds(g);this.props.coordinateSystem===ne.COORDINATE_SYSTEM.LNGLAT&&(f[1]=Math.max(f[1],-85.051129),f[3]=Math.min(f[3],85.051129),f[0]=Math.max(f[0],-360),f[2]=Math.min(f[2],360));var c=this._worldToCommonBounds(f);u.worldBounds=f,u.normalizedCommonBounds=c,l=!0}return this.setState(u),l}},{key:"_updateTextureRenderingBounds",value:function(){var r=this.state,i=r.triPositionBuffer,o=r.triTexCoordBuffer,s=r.normalizedCommonBounds,u=r.viewportCorners,l=this.context.viewport;i.subData(br(u,3));var g=u.map(function(f){return uo(l.projectPosition(f),s)});o.subData(br(g,2))}},{key:"_updateColorTexture",value:function(r){var i=r.props.colorRange,o=this.state.colorTexture,s=se(i,!1,Uint8Array);o?o.setImageData({data:s,width:i.length}):o=new I.Texture2D(this.context.gl,qe({data:s,width:i.length,height:1},Cr)),this.setState({colorTexture:o})}},{key:"_updateWeightmap",value:function(){var r=this,i,o=this.props,s=o.radiusPixels,u=o.colorDomain,l=o.aggregation,g=this.state,f=g.weightsTransform,c=g.worldBounds,d=g.textureSize,h=g.weightsTexture,m=g.weightsScale;this.state.isWeightMapDirty=!1;var y=this._worldToCommonBounds(c,{useLayerCoordinateSystem:!0});if(u&&l==="SUM"){var O=this.context.viewport,C=O.distanceScales.metersPerUnit[2]*(y[2]-y[0])/d;this.state.colorDomain=u.map(function(P){return P*C*m})}else this.state.colorDomain=u||Ao;var b={radiusPixels:s,commonBounds:y,textureWidth:d,weightsScale:m};f.update({elementCount:this.getNumInstances()}),(0,I.withParameters)(this.context.gl,{clearColor:[0,0,0,0]},function(){f.run({uniforms:b,parameters:{blend:!0,depthTest:!1,blendFunc:[1,1],blendEquation:32774},clearRenderTarget:!0,attributes:r.getAttributes(),moduleSettings:r.getModuleSettings()})}),this._updateMaxWeightValue(),h.setParameters((i={},(0,ee.default)(i,10240,9729),(0,ee.default)(i,10241,9729),i))}},{key:"_debouncedUpdateWeightmap",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,i=this.state.updateTimer,o=this.props.debounceTimeout;r?(i=null,this._updateBounds(!0),this._updateTextureRenderingBounds(),this.setState({isWeightMapDirty:!0})):(this.setState({isWeightMapDirty:!1}),clearTimeout(i),i=setTimeout(this._debouncedUpdateWeightmap.bind(this,!0),o)),this.setState({updateTimer:i})}},{key:"_worldToCommonBounds",value:function(r){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=i.useLayerCoordinateSystem,s=o===void 0?!1:o,u=(0,Pr.default)(r,4),l=u[0],g=u[1],f=u[2],c=u[3],d=this.context.viewport,h=this.state.textureSize,m=this.props.coordinateSystem,y=s&&(m===ne.COORDINATE_SYSTEM.LNGLAT_OFFSETS||m===ne.COORDINATE_SYSTEM.METER_OFFSETS),O=y?d.projectPosition(this.props.coordinateOrigin):[0,0],C=h*Yu/d.scale,b,P;return s&&!y?(b=this.projectPosition([l,g,0]),P=this.projectPosition([f,c,0])):(b=d.projectPosition([l,g,0]),P=d.projectPosition([f,c,0])),so([b[0]-O[0],b[1]-O[1],P[0]-O[0],P[1]-O[1]],C,C)}},{key:"_commonToWorldBounds",value:function(r){var i=(0,Pr.default)(r,4),o=i[0],s=i[1],u=i[2],l=i[3],g=this.context.viewport,f=g.unprojectPosition([o,s]),c=g.unprojectPosition([u,l]);return f.slice(0,2).concat(c.slice(0,2))}}]),e}(Z);(0,ee.default)(Xt,"layerName","HeatmapLayer");(0,ee.default)(Xt,"defaultProps",Qu);return Fo(it);})();
|
|
575
|
+
`;var ze;function la(t,a){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);a&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function Ue(t){for(var a=1;a<arguments.length;a++){var e=arguments[a]!=null?arguments[a]:{};a%2?la(Object(e),!0).forEach(function(n){p(t,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):la(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}return t}function fo(t){var a=go();return function(){var n=P(t),r;if(a){var i=P(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return z(this,r)}}function go(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var co=2,kt={mipmaps:!1,parameters:(ze={},p(ze,10240,9729),p(ze,10241,9729),p(ze,10242,33071),p(ze,10243,33071),ze),dataFormat:6408},fa=[0,0],po={SUM:0,MEAN:1},mo={getPosition:{type:"accessor",value:function(a){return a.position}},getWeight:{type:"accessor",value:1},intensity:{type:"number",min:0,value:1},radiusPixels:{type:"number",min:1,max:100,value:50},colorRange:K,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}},vo=[k.FEATURES.BLEND_EQUATION_MINMAX,k.FEATURES.TEXTURE_FLOAT],ho=[k.FEATURES.COLOR_ATTACHMENT_RGBA32F,k.FEATURES.FLOAT_BLEND],yo={data:{props:["radiusPixels"]}},ht=function(t){B(e,t);var a=fo(e);function e(){var n;N(this,e);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return n=a.call.apply(a,[this].concat(i)),p(W(n),"state",void 0),n}return I(e,[{key:"initializeState",value:function(){var r=this.context.gl;if(!(0,k.hasFeatures)(r,vo)){this.setState({supported:!1}),re.log.error("HeatmapLayer: ".concat(this.id," is not supported on this browser"))();return}E(P(e.prototype),"initializeAggregationLayer",this).call(this,yo),this.setState({supported:!0,colorDomain:fa}),this._setupTextureParams(),this._setupAttributes(),this._setupResources()}},{key:"shouldUpdateState",value:function(r){var i=r.changeFlags;return i.somethingChanged}},{key:"updateState",value:function(r){this.state.supported&&(E(P(e.prototype),"updateState",this).call(this,r),this._updateHeatmapState(r))}},{key:"_updateHeatmapState",value:function(r){var i=r.props,o=r.oldProps,s=this._getChangeFlags(r);(s.dataChanged||s.viewportChanged)&&(s.boundsChanged=this._updateBounds(s.dataChanged),this._updateTextureRenderingBounds()),s.dataChanged||s.boundsChanged?(clearTimeout(this.state.updateTimer),this.setState({isWeightMapDirty:!0})):s.viewportZoomChanged&&this._debouncedUpdateWeightmap(),i.colorRange!==o.colorRange&&this._updateColorTexture(r),this.state.isWeightMapDirty&&this._updateWeightmap(),this.setState({zoom:r.context.viewport.zoom})}},{key:"renderLayers",value:function(){if(!this.state.supported)return[];var r=this.state,i=r.weightsTexture,o=r.triPositionBuffer,s=r.triTexCoordBuffer,u=r.maxWeightsTexture,l=r.colorTexture,g=r.colorDomain,f=this.props,c=f.updateTriggers,v=f.intensity,h=f.threshold,d=f.aggregation,y=this.getSubLayerClass("triangle",Ut);return new y(this.getSubLayerProps({id:"triangle-layer",updateTriggers:c}),{coordinateSystem:re.COORDINATE_SYSTEM.DEFAULT,data:{attributes:{positions:o,texCoords:s}},vertexCount:4,maxTexture:u,colorTexture:l,aggregationMode:po[d]||0,texture:i,intensity:v,threshold:h,colorDomain:g})}},{key:"finalizeState",value:function(r){E(P(e.prototype),"finalizeState",this).call(this,r);var i=this.state,o=i.weightsTransform,s=i.weightsTexture,u=i.maxWeightTransform,l=i.maxWeightsTexture,g=i.triPositionBuffer,f=i.triTexCoordBuffer,c=i.colorTexture,v=i.updateTimer;o?.delete(),s?.delete(),u?.delete(),l?.delete(),g?.delete(),f?.delete(),c?.delete(),v&&clearTimeout(v)}},{key:"_getAttributeManager",value:function(){return new re.AttributeManager(this.context.gl,{id:this.props.id,stats:this.context.stats})}},{key:"_getChangeFlags",value:function(r){var i={},o=this.state.dimensions;i.dataChanged=this.isAttributeChanged()||this.isAggregationDirty(r,{compareAll:!0,dimension:o.data}),i.viewportChanged=r.changeFlags.viewportChanged;var s=this.state.zoom;return(!r.context.viewport||r.context.viewport.zoom!==s)&&(i.viewportZoomChanged=!0),i}},{key:"_createTextures",value:function(){var r=this.context.gl,i=this.state,o=i.textureSize,s=i.format,u=i.type;this.setState({weightsTexture:new k.Texture2D(r,Ue({width:o,height:o,format:s,type:u},kt)),maxWeightsTexture:new k.Texture2D(r,Ue({format:s,type:u},kt))})}},{key:"_setupAttributes",value:function(){var r=this.getAttributeManager();r.add({positions:{size:3,type:5130,accessor:"getPosition"},weights:{size:1,accessor:"getWeight"}}),this.setState({positionAttributeName:"positions"})}},{key:"_setupTextureParams",value:function(){var r=this.context.gl,i=this.props.weightsTextureSize,o=Math.min(i,(0,k.getParameters)(r,3379)),s=(0,k.hasFeatures)(r,ho),u=ta({gl:r,floatTargetSupport:s}),l=u.format,g=u.type,f=s?1:1/255;this.setState({textureSize:o,format:l,type:g,weightsScale:f}),s||re.log.warn("HeatmapLayer: ".concat(this.id," rendering to float texture not supported, fallingback to low precession format"))()}},{key:"getShaders",value:function(r){return E(P(e.prototype),"getShaders",this).call(this,r==="max-weights-transform"?{vs:sa,_fs:ua}:{vs:ia,_fs:oa})}},{key:"_createWeightsTransform",value:function(){var r,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=this.context.gl,s=this.state.weightsTransform,u=this.state.weightsTexture;(r=s)===null||r===void 0||r.delete(),s=new k.Transform(o,Ue({id:"".concat(this.id,"-weights-transform"),elementCount:1,_targetTexture:u,_targetTextureVarying:"weightsTexture"},i)),this.setState({weightsTransform:s})}},{key:"_setupResources",value:function(){var r=this.context.gl;this._createTextures();var i=this.state,o=i.textureSize,s=i.weightsTexture,u=i.maxWeightsTexture,l=this.getShaders("weights-transform");this._createWeightsTransform(l);var g=this.getShaders("max-weights-transform"),f=new k.Transform(r,Ue(Ue({id:"".concat(this.id,"-max-weights-transform"),_sourceTextures:{inTexture:s},_targetTexture:u,_targetTextureVarying:"outTexture"},g),{},{elementCount:o*o}));this.setState({weightsTexture:s,maxWeightsTexture:u,maxWeightTransform:f,zoom:null,triPositionBuffer:new k.Buffer(r,{byteLength:48,accessor:{size:3}}),triTexCoordBuffer:new k.Buffer(r,{byteLength:48,accessor:{size:2}})})}},{key:"updateShaders",value:function(r){this._createWeightsTransform(r)}},{key:"_updateMaxWeightValue",value:function(){var r=this.state.maxWeightTransform;r.run({parameters:{blend:!0,depthTest:!1,blendFunc:[1,1],blendEquation:32776}})}},{key:"_updateBounds",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,i=this.context.viewport,o=[i.unproject([0,0]),i.unproject([i.width,0]),i.unproject([i.width,i.height]),i.unproject([0,i.height])].map(function(v){return v.map(Math.fround)}),s=Qn(o),u={visibleWorldBounds:s,viewportCorners:o},l=!1;if(r||!this.state.worldBounds||!Zn(this.state.worldBounds,s)){var g=this._worldToCommonBounds(s),f=this._commonToWorldBounds(g);this.props.coordinateSystem===re.COORDINATE_SYSTEM.LNGLAT&&(f[1]=Math.max(f[1],-85.051129),f[3]=Math.min(f[3],85.051129),f[0]=Math.max(f[0],-360),f[2]=Math.min(f[2],360));var c=this._worldToCommonBounds(f);u.worldBounds=f,u.normalizedCommonBounds=c,l=!0}return this.setState(u),l}},{key:"_updateTextureRenderingBounds",value:function(){var r=this.state,i=r.triPositionBuffer,o=r.triTexCoordBuffer,s=r.normalizedCommonBounds,u=r.viewportCorners,l=this.context.viewport;i.subData(zt(u,3));var g=u.map(function(f){return ea(l.projectPosition(f),s)});o.subData(zt(g,2))}},{key:"_updateColorTexture",value:function(r){var i=r.props.colorRange,o=this.state.colorTexture,s=oe(i,!1,Uint8Array);o?o.setImageData({data:s,width:i.length}):o=new k.Texture2D(this.context.gl,Ue({data:s,width:i.length,height:1},kt)),this.setState({colorTexture:o})}},{key:"_updateWeightmap",value:function(){var r=this,i,o=this.props,s=o.radiusPixels,u=o.colorDomain,l=o.aggregation,g=this.state,f=g.weightsTransform,c=g.worldBounds,v=g.textureSize,h=g.weightsTexture,d=g.weightsScale;this.state.isWeightMapDirty=!1;var y=this._worldToCommonBounds(c,{useLayerCoordinateSystem:!0});if(u&&l==="SUM"){var A=this.context.viewport,T=A.distanceScales.metersPerUnit[2]*(y[2]-y[0])/v;this.state.colorDomain=u.map(function(C){return C*T*d})}else this.state.colorDomain=u||fa;var _={radiusPixels:s,commonBounds:y,textureWidth:v,weightsScale:d};f.update({elementCount:this.getNumInstances()}),(0,k.withParameters)(this.context.gl,{clearColor:[0,0,0,0]},function(){f.run({uniforms:_,parameters:{blend:!0,depthTest:!1,blendFunc:[1,1],blendEquation:32774},clearRenderTarget:!0,attributes:r.getAttributes(),moduleSettings:r.getModuleSettings()})}),this._updateMaxWeightValue(),h.setParameters((i={},p(i,10240,9729),p(i,10241,9729),i))}},{key:"_debouncedUpdateWeightmap",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,i=this.state.updateTimer,o=this.props.debounceTimeout;r?(i=null,this._updateBounds(!0),this._updateTextureRenderingBounds(),this.setState({isWeightMapDirty:!0})):(this.setState({isWeightMapDirty:!1}),clearTimeout(i),i=setTimeout(this._debouncedUpdateWeightmap.bind(this,!0),o)),this.setState({updateTimer:i})}},{key:"_worldToCommonBounds",value:function(r){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=i.useLayerCoordinateSystem,s=o===void 0?!1:o,u=X(r,4),l=u[0],g=u[1],f=u[2],c=u[3],v=this.context.viewport,h=this.state.textureSize,d=this.props.coordinateSystem,y=s&&(d===re.COORDINATE_SYSTEM.LNGLAT_OFFSETS||d===re.COORDINATE_SYSTEM.METER_OFFSETS),A=y?v.projectPosition(this.props.coordinateOrigin):[0,0],T=h*co/v.scale,_,C;return s&&!y?(_=this.projectPosition([l,g,0]),C=this.projectPosition([f,c,0])):(_=v.projectPosition([l,g,0]),C=v.projectPosition([f,c,0])),Jn([_[0]-A[0],_[1]-A[1],C[0]-A[0],C[1]-A[1]],T,T)}},{key:"_commonToWorldBounds",value:function(r){var i=X(r,4),o=i[0],s=i[1],u=i[2],l=i[3],g=this.context.viewport,f=g.unprojectPosition([o,s]),c=g.unprojectPosition([u,l]);return f.slice(0,2).concat(c.slice(0,2))}}]),e}(Z);p(ht,"layerName","HeatmapLayer");p(ht,"defaultProps",mo);return ya(je);})();
|
|
575
576
|
return __exports__;
|
|
576
577
|
});
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@deck.gl/aggregation-layers",
|
|
3
3
|
"description": "deck.gl layers that aggregate the input data into alternative representations",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "8.9.
|
|
5
|
+
"version": "8.9.21",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"prepublishOnly": "npm run build-bundle && npm run build-bundle -- --env=dev"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
+
"@babel/runtime": "^7.0.0",
|
|
33
34
|
"@luma.gl/constants": "^8.5.20",
|
|
34
35
|
"@luma.gl/shadertools": "^8.5.20",
|
|
35
36
|
"@math.gl/web-mercator": "^3.6.2",
|
|
@@ -40,5 +41,5 @@
|
|
|
40
41
|
"@deck.gl/layers": "^8.0.0",
|
|
41
42
|
"@luma.gl/core": "^8.0.0"
|
|
42
43
|
},
|
|
43
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "d5dca2e143dd9cf4e204a4473d67de14e4e7f2ee"
|
|
44
45
|
}
|
package/src/types.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/** Type assigned to e.g. getColorValue/getElevationValue props in aggregation layers (e.g. CPUGridLayer, HexagonLayer)*/
|
|
2
|
+
export type AggregateAccessor<DataT = any> = (args: {
|
|
2
3
|
/** a list of objects whose positions fall inside this cell. */
|
|
3
4
|
objects: DataT[];
|
|
4
5
|
objectInfo: {
|
|
@@ -7,4 +8,4 @@ export type AggregateAccessor<DataT = any> = {
|
|
|
7
8
|
/** the value of the `data` prop */
|
|
8
9
|
data: any;
|
|
9
10
|
};
|
|
10
|
-
};
|
|
11
|
+
}) => number;
|
package/typed/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/** Type assigned to e.g. getColorValue/getElevationValue props in aggregation layers (e.g. CPUGridLayer, HexagonLayer)*/
|
|
2
|
+
export declare type AggregateAccessor<DataT = any> = (args: {
|
|
2
3
|
/** a list of objects whose positions fall inside this cell. */
|
|
3
4
|
objects: DataT[];
|
|
4
5
|
objectInfo: {
|
|
@@ -7,5 +8,5 @@ export declare type AggregateAccessor<DataT = any> = {
|
|
|
7
8
|
/** the value of the `data` prop */
|
|
8
9
|
data: any;
|
|
9
10
|
};
|
|
10
|
-
};
|
|
11
|
+
}) => number;
|
|
11
12
|
//# sourceMappingURL=types.d.ts.map
|
package/typed/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,iBAAiB,CAAC,KAAK,GAAG,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,yHAAyH;AACzH,oBAAY,iBAAiB,CAAC,KAAK,GAAG,GAAG,IAAI,CAAC,IAAI,EAAE;IAClD,+DAA+D;IAC/D,OAAO,EAAE,KAAK,EAAE,CAAC;IACjB,UAAU,EAAE;QACV,qDAAqD;QACrD,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,mCAAmC;QACnC,IAAI,EAAE,GAAG,CAAC;KACX,CAAC;CACH,KAAK,MAAM,CAAC"}
|