@mapvx/web-components-ssr 1.7.0-dev.1 → 1.7.0-dev.2
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/README.md +17 -13
- package/dist/browser/{chunk-Cg9Nd_Mm.js → chunk-BcTPI0Ei.js} +78 -78
- package/dist/browser/chunk-BxefRtM9.js +3 -0
- package/dist/browser/{chunk-qJiyNNGo.js → chunk-C64ZrtDH.js} +9 -9
- package/dist/browser/{chunk-BK2bFfek.js → chunk-C7x5ioh5.js} +28 -28
- package/dist/browser/chunk-CHv413eO.js +13 -0
- package/dist/browser/chunk-CRCKWzfw.js +3 -0
- package/dist/browser/chunk-CYtO4qrL.js +3 -0
- package/dist/browser/chunk-CgRco1rJ.js +2 -0
- package/dist/browser/chunk-CwafJShv.js +3 -0
- package/dist/browser/chunk-D6zG2upO.js +1180 -0
- package/dist/browser/chunk-DIEcQ4a-.js +1318 -0
- package/dist/browser/chunk-DtPiRK4g.js +3 -0
- package/dist/browser/chunk-FjUzkN6v.js +2 -0
- package/dist/browser/chunk-KW-jIWmp.js +3 -0
- package/dist/browser/chunk-sqKVpUVP.js +4116 -0
- package/dist/browser/main.js +71 -71
- package/dist/browser/styles.css +1 -1
- package/dist/types/public-api.d.ts +90 -24
- package/package.json +29 -29
- package/dist/browser/chunk-7vIcv6rM.js +0 -1180
- package/dist/browser/chunk-Bjk3HkK2.js +0 -3
- package/dist/browser/chunk-CCaUxYwr.js +0 -3
- package/dist/browser/chunk-CTFjnL_B.js +0 -2
- package/dist/browser/chunk-ClYPPgpq.js +0 -3
- package/dist/browser/chunk-ConEJto8.js +0 -1318
- package/dist/browser/chunk-CuTcljJ2.js +0 -2
- package/dist/browser/chunk-CzASft0S.js +0 -13
- package/dist/browser/chunk-DAjekpI-.js +0 -3
- package/dist/browser/chunk-DHX-WiFW.js +0 -3
- package/dist/browser/chunk-DsKCGfdq.js +0 -3
- package/dist/browser/chunk-LltjhLJU.js +0 -4116
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as v,i as u,n as s,s as x,t as r}from"./main.js";import{
|
|
1
|
+
import{a as v,i as u,n as s,s as x,t as r}from"./main.js";import{$ as re$1,O as Zo$1,X as pt$1,Z as qr,h as Oi$1,l as Ko$1,n as De}from"./chunk-C7x5ioh5.js";import{C as Yr,L as ma,M as ie$1,O as ee,R as ne$1,T as ao,X as xs$1,Y as xe$1,f as Ka,v as S,w as _m,x as Wa,z as nt$1}from"./chunk-DIEcQ4a-.js";var po=v((vc,kt)=>{"use strict";kt.exports=ft;kt.exports.default=ft;function ft(i,e,t){t=t||2;var o=e&&e.length,n=o?e[0]*t:i.length,s=lo(i,0,n,t,!0),r=[];if(!s||s.next===s.prev)return r;var a,l,c,f,d,p,u;if(o&&(s=Rs(i,e,s,t)),i.length>80*t){a=c=i[0],l=f=i[1];for(var g=t;g<n;g+=t)d=i[g],p=i[g+1],d<a&&(a=d),p<l&&(l=p),d>c&&(c=d),p>f&&(f=p);u=Math.max(c-a,f-l),u=u!==0?32767/u:0}return ke(s,r,t,a,l,u,0),r}function lo(i,e,t,o,n){var s,r;if(n===zt(i,e,t,o)>0)for(s=e;s<t;s+=o)r=ao(s,i[s],i[s+1],r);else for(s=t-o;s>=e;s-=o)r=ao(s,i[s],i[s+1],r);return r&&dt(r,r.next)&&(Fe(r),r=r.next),r}function X(i,e){if(!i)return i;e||(e=i);var t=i,o;do if(o=!1,!t.steiner&&(dt(t,t.next)||w(t.prev,t,t.next)===0)){if(Fe(t),t=e=t.prev,t===t.next)break;o=!0}else t=t.next;while(o||t!==e);return e}function ke(i,e,t,o,n,s,r){if(i){!r&&s&&Fs(i,o,n,s);for(var a=i,l,c;i.prev!==i.next;){if(l=i.prev,c=i.next,s?Es(i,o,n,s):As(i)){e.push(l.i/t|0),e.push(i.i/t|0),e.push(c.i/t|0),Fe(i),i=c.next,a=c.next;continue}if(i=c,i===a){r?r===1?(i=Ts(X(i),e,t),ke(i,e,t,o,n,s,2)):r===2&&Os(i,e,t,o,n,s):ke(X(i),e,t,o,n,s,1);break}}}}function As(i){var e=i.prev,t=i,o=i.next;if(w(e,t,o)>=0)return!1;for(var n=e.x,s=t.x,r=o.x,a=e.y,l=t.y,c=o.y,f=n<s?n<r?n:r:s<r?s:r,d=a<l?a<c?a:c:l<c?l:c,p=n>s?n>r?n:r:s>r?s:r,u=a>l?a>c?a:c:l>c?l:c,g=o.next;g!==e;){if(g.x>=f&&g.x<=p&&g.y>=d&&g.y<=u&&se(n,a,s,l,r,c,g.x,g.y)&&w(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function Es(i,e,t,o){var n=i.prev,s=i,r=i.next;if(w(n,s,r)>=0)return!1;for(var a=n.x,l=s.x,c=r.x,f=n.y,d=s.y,p=r.y,u=a<l?a<c?a:c:l<c?l:c,g=f<d?f<p?f:p:d<p?d:p,h=a>l?a>c?a:c:l>c?l:c,v=f>d?f>p?f:p:d>p?d:p,P=Rt(u,g,e,t,o),C=Rt(h,v,e,t,o),m=i.prevZ,x=i.nextZ;m&&m.z>=P&&x&&x.z<=C;){if(m.x>=u&&m.x<=h&&m.y>=g&&m.y<=v&&m!==n&&m!==r&&se(a,f,l,d,c,p,m.x,m.y)&&w(m.prev,m,m.next)>=0||(m=m.prevZ,x.x>=u&&x.x<=h&&x.y>=g&&x.y<=v&&x!==n&&x!==r&&se(a,f,l,d,c,p,x.x,x.y)&&w(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;m&&m.z>=P;){if(m.x>=u&&m.x<=h&&m.y>=g&&m.y<=v&&m!==n&&m!==r&&se(a,f,l,d,c,p,m.x,m.y)&&w(m.prev,m,m.next)>=0)return!1;m=m.prevZ}for(;x&&x.z<=C;){if(x.x>=u&&x.x<=h&&x.y>=g&&x.y<=v&&x!==n&&x!==r&&se(a,f,l,d,c,p,x.x,x.y)&&w(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function Ts(i,e,t){var o=i;do{var n=o.prev,s=o.next.next;!dt(n,s)&&co(n,o,o.next,s)&&De(n,s)&&De(s,n)&&(e.push(n.i/t|0),e.push(o.i/t|0),e.push(s.i/t|0),Fe(o),Fe(o.next),o=i=s),o=o.next}while(o!==i);return X(o)}function Os(i,e,t,o,n,s){var r=i;do{for(var a=r.next.next;a!==r.prev;){if(r.i!==a.i&&js(r,a)){var l=fo(r,a);r=X(r,r.next),l=X(l,l.next),ke(r,e,t,o,n,s,0),ke(l,e,t,o,n,s,0);return}a=a.next}r=r.next}while(r!==i)}function Rs(i,e,t,o){var n=[],s=0,r=e.length,a,l,c;for(;s<r;s++)a=e[s]*o,l=s<r-1?e[s+1]*o:i.length,c=lo(i,a,l,o,!1),c===c.next&&(c.steiner=!0),n.push(Gs(c));for(n.sort(Ms),s=0;s<n.length;s++)t=zs(n[s],t);return t}function Ms(i,e){return i.x-e.x}function zs(i,e){var t=ks(i,e);if(!t)return e;var o=fo(t,i);return X(o,o.next),X(t,t.next)}function ks(i,e){var t=e,o=i.x,n=i.y,s=-1/0,r;do{if(n<=t.y&&n>=t.next.y&&t.next.y!==t.y){var a=t.x+(n-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(a<=o&&a>s&&(s=a,r=t.x<t.next.x?t:t.next,a===o))return r}t=t.next}while(t!==e);if(!r)return null;var l=r,c=r.x,f=r.y,d=1/0,p;t=r;do o>=t.x&&t.x>=c&&o!==t.x&&se(n<f?o:s,n,c,f,n<f?s:o,n,t.x,t.y)&&(p=Math.abs(n-t.y)/(o-t.x),De(t,i)&&(p<d||p===d&&(t.x>r.x||t.x===r.x&&Ds(r,t)))&&(r=t,d=p)),t=t.next;while(t!==l);return r}function Ds(i,e){return w(i.prev,i,e.prev)<0&&w(e.next,i,i.next)<0}function Fs(i,e,t,o){var n=i;do n.z===0&&(n.z=Rt(n.x,n.y,e,t,o)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==i);n.prevZ.nextZ=null,n.prevZ=null,Ns(n)}function Ns(i){var e,t,o,n,s,r,a,l,c=1;do{for(t=i,i=null,s=null,r=0;t;){for(r++,o=t,a=0,e=0;e<c&&(a++,o=o.nextZ,!!o);e++);for(l=c;a>0||l>0&&o;)a!==0&&(l===0||!o||t.z<=o.z)?(n=t,t=t.nextZ,a--):(n=o,o=o.nextZ,l--),s?s.nextZ=n:i=n,n.prevZ=s,s=n;t=o}s.nextZ=null,c*=2}while(r>1);return i}function Rt(i,e,t,o,n){return i=(i-t)*n|0,e=(e-o)*n|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function Gs(i){var e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function se(i,e,t,o,n,s,r,a){return(n-r)*(e-a)>=(i-r)*(s-a)&&(i-r)*(o-a)>=(t-r)*(e-a)&&(t-r)*(s-a)>=(n-r)*(o-a)}function js(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!Bs(i,e)&&(De(i,e)&&De(e,i)&&Ws(i,e)&&(w(i.prev,i,e.prev)||w(i,e.prev,e))||dt(i,e)&&w(i.prev,i,i.next)>0&&w(e.prev,e,e.next)>0)}function w(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function dt(i,e){return i.x===e.x&&i.y===e.y}function co(i,e,t,o){var n=ct(w(i,e,t)),s=ct(w(i,e,o)),r=ct(w(t,o,i)),a=ct(w(t,o,e));return!!(n!==s&&r!==a||n===0&<(i,t,e)||s===0&<(i,o,e)||r===0&<(t,i,o)||a===0&<(t,e,o))}function lt(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function ct(i){return i>0?1:i<0?-1:0}function Bs(i,e){var t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&co(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function De(i,e){return w(i.prev,i,i.next)<0?w(i,e,i.next)>=0&&w(i,i.prev,e)>=0:w(i,e,i.prev)<0||w(i,i.next,e)<0}function Ws(i,e){var t=i,o=!1,n=(i.x+e.x)/2,s=(i.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&n<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(o=!o),t=t.next;while(t!==i);return o}function fo(i,e){var t=new Mt(i.i,i.x,i.y),o=new Mt(e.i,e.x,e.y),n=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=n,n.prev=t,o.next=t,t.prev=o,s.next=o,o.prev=s,o}function ao(i,e,t,o){var n=new Mt(i,e,t);return o?(n.next=o.next,n.prev=o,o.next.prev=n,o.next=n):(n.prev=n,n.next=n),n}function Fe(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Mt(i,e,t){this.i=i,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}ft.deviation=function(i,e,t,o){var n=e&&e.length,s=n?e[0]*t:i.length,r=Math.abs(zt(i,0,s,t));if(n)for(var a=0,l=e.length;a<l;a++){var c=e[a]*t,f=a<l-1?e[a+1]*t:i.length;r-=Math.abs(zt(i,c,f,t))}var d=0;for(a=0;a<o.length;a+=3){var p=o[a]*t,u=o[a+1]*t,g=o[a+2]*t;d+=Math.abs((i[p]-i[g])*(i[u+1]-i[p+1])-(i[p]-i[u])*(i[g+1]-i[p+1]))}return r===0&&d===0?0:Math.abs((d-r)/r)};function zt(i,e,t,o){for(var n=0,s=e,r=t-o;s<t;s+=o)n+=(i[r]-i[s])*(i[s+1]+i[r+1]),r=s;return n}ft.flatten=function(i){for(var e=i[0][0].length,t={vertices:[],holes:[],dimensions:e},o=0,n=0;n<i.length;n++){for(var s=0;s<i[n].length;s++)for(var r=0;r<e;r++)t.vertices.push(i[n][s][r]);n>0&&(o+=i[n-1].length,t.holes.push(o))}return t}});var pn=`struct ArcUniforms {
|
|
2
2
|
greatCircle: f32,
|
|
3
3
|
useShortestPath: f32,
|
|
4
4
|
numSegments: f32,
|
|
@@ -9,7 +9,7 @@ import{a as v,i as u,n as s,s as x,t as r}from"./main.js";import{A as Zo$1,J as
|
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
@group(0) @binding(auto) var<uniform> arc: ArcUniforms;
|
|
12
|
-
`;var
|
|
12
|
+
`;var Xt=`layout(std140) uniform arcUniforms {
|
|
13
13
|
bool greatCircle;
|
|
14
14
|
bool useShortestPath;
|
|
15
15
|
float numSegments;
|
|
@@ -18,7 +18,7 @@ import{a as v,i as u,n as s,s as x,t as r}from"./main.js";import{A as Zo$1,J as
|
|
|
18
18
|
float widthMaxPixels;
|
|
19
19
|
highp int widthUnits;
|
|
20
20
|
} arc;
|
|
21
|
-
`;var
|
|
21
|
+
`;var qt={name:`arc`,source:pn,vs:Xt,fs:Xt,uniformTypes:{greatCircle:`f32`,useShortestPath:`f32`,numSegments:`f32`,widthScale:`f32`,widthMinPixels:`f32`,widthMaxPixels:`f32`,widthUnits:`i32`}};var Qt=`const ZERO_OFFSET: vec3<f32> = vec3<f32>(0.0, 0.0, 0.0);
|
|
22
22
|
|
|
23
23
|
struct Attributes {
|
|
24
24
|
@location(0) instanceSourcePositions: vec3<f32>,
|
|
@@ -376,7 +376,7 @@ fn fragmentMain(varyings: Varyings) -> @location(0) vec4<f32> {
|
|
|
376
376
|
}
|
|
377
377
|
return deckgl_premultiplied_alpha(color);
|
|
378
378
|
}
|
|
379
|
-
`;var
|
|
379
|
+
`;var ei=`#version 300 es
|
|
380
380
|
#define SHADER_NAME arc-layer-vertex-shader
|
|
381
381
|
in vec4 instanceSourceColors;
|
|
382
382
|
in vec4 instanceTargetColors;
|
|
@@ -546,7 +546,7 @@ vec4 color = mix(instanceSourceColors, instanceTargetColors, segmentRatio);
|
|
|
546
546
|
vColor = vec4(color.rgb, color.a * layer.opacity);
|
|
547
547
|
DECKGL_FILTER_COLOR(vColor, geometry);
|
|
548
548
|
}
|
|
549
|
-
`;var
|
|
549
|
+
`;var ti=`#version 300 es
|
|
550
550
|
#define SHADER_NAME arc-layer-fragment-shader
|
|
551
551
|
precision highp float;
|
|
552
552
|
in vec4 vColor;
|
|
@@ -573,7 +573,7 @@ fragColor.a *= smoothedge(0.0, edgePixels);
|
|
|
573
573
|
#endif
|
|
574
574
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
575
575
|
}
|
|
576
|
-
`;var
|
|
576
|
+
`;var tt=[0,0,0,255];var un={getSourcePosition:{type:`accessor`,value:i=>i.sourcePosition},getTargetPosition:{type:`accessor`,value:i=>i.targetPosition},getSourceColor:{type:`accessor`,value:tt},getTargetColor:{type:`accessor`,value:tt},getWidth:{type:`accessor`,value:1},getHeight:{type:`accessor`,value:1},getTilt:{type:`accessor`,value:0},greatCircle:!1,numSegments:{type:`number`,value:50,min:1},widthUnits:`pixels`,widthScale:{type:`number`,value:1,min:0},widthMinPixels:{type:`number`,value:0,min:0},widthMaxPixels:{type:`number`,value:Number.MAX_SAFE_INTEGER,min:0},antialiasing:!1};var ce=class extends ao{getBounds(){return this.getAttributeManager()?.getBounds([`instanceSourcePositions`,`instanceTargetPositions`])}getShaders(){let{antialiasing:e}=this.props;return super.getShaders({vs:ei,fs:ti,source:Qt,defines:e?{ANTIALIASING:1}:{},modules:[Wa,ma,Ka,qt]})}get wrapLongitude(){return!1}initializeState(){this.getAttributeManager().addInstanced({instanceSourcePositions:{size:3,type:`float64`,fp64:this.use64bitPositions(),transition:!0,accessor:`getSourcePosition`},instanceTargetPositions:{size:3,type:`float64`,fp64:this.use64bitPositions(),transition:!0,accessor:`getTargetPosition`},instanceSourceColors:{size:this.props.colorFormat.length,type:`unorm8`,transition:!0,accessor:`getSourceColor`,defaultValue:tt},instanceTargetColors:{size:this.props.colorFormat.length,type:`unorm8`,transition:!0,accessor:`getTargetColor`,defaultValue:tt},instanceWidths:{size:1,transition:!0,accessor:`getWidth`,defaultValue:1},instanceHeights:{size:1,transition:!0,accessor:`getHeight`,defaultValue:1},instanceTilts:{size:1,transition:!0,accessor:`getTilt`,defaultValue:0}})}updateState(e){super.updateState(e);let{props:t,oldProps:o,changeFlags:n}=e;(n.extensionsChanged||t.antialiasing!==o.antialiasing)&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({uniforms:e}){let{widthUnits:t,widthScale:o,widthMinPixels:n,widthMaxPixels:s,greatCircle:r,wrapLongitude:a,numSegments:l}=this.props,c={numSegments:l,widthUnits:ee[t],widthScale:o,widthMinPixels:n,widthMaxPixels:s,greatCircle:r,useShortestPath:a},f=this.state.model;f.shaderInputs.setProps({arc:c}),f.setVertexCount(l*2),f.draw(this.context.renderPass)}_getModel(){return new De(this.context.device,s(r({},this.getShaders()),{id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),topology:`triangle-strip`,isInstanced:!0}))}};ce.layerName=`ArcLayer`;ce.defaultProps=un;var gn=ce;var hn=new Uint32Array([0,2,1,0,3,2]);var xn=new Float32Array([0,1,0,0,1,0,1,1]);function bt(i,e){if(!e)return vn(i);let t=Math.max(Math.abs(i[0][0]-i[3][0]),Math.abs(i[1][0]-i[2][0])),o=Math.max(Math.abs(i[1][1]-i[0][1]),Math.abs(i[2][1]-i[3][1])),n=Math.ceil(t/e)+1,s=Math.ceil(o/e)+1,r=(n-1)*(s-1)*6,a=new Uint32Array(r),l=new Float32Array(n*s*2),c=new Float64Array(n*s*3),f=0,d=0;for(let p=0;p<n;p++){let u=p/(n-1);for(let g=0;g<s;g++){let h=g/(s-1),v=mn(i,u,h);c[f*3+0]=v[0],c[f*3+1]=v[1],c[f*3+2]=v[2]||0,l[f*2+0]=u,l[f*2+1]=1-h,p>0&&g>0&&(a[d++]=f-s,a[d++]=f-s-1,a[d++]=f-1,a[d++]=f-s,a[d++]=f-1,a[d++]=f),f++}}return{vertexCount:r,positions:c,indices:a,texCoords:l}}function vn(i){let e=new Float64Array(12);for(let t=0;t<i.length;t++)e[t*3+0]=i[t][0],e[t*3+1]=i[t][1],e[t*3+2]=i[t][2]||0;return{vertexCount:6,positions:e,indices:hn,texCoords:xn}}function mn(i,e,t){return Oi$1(Oi$1(i[0],i[1],t),Oi$1(i[3],i[2],t),e)}var yn=`
|
|
577
577
|
struct BitmapUniforms {
|
|
578
578
|
bounds: vec4<f32>,
|
|
579
579
|
coordinateConversion: f32,
|
|
@@ -585,14 +585,14 @@ struct BitmapUniforms {
|
|
|
585
585
|
@group(0) @binding(auto) var<uniform> bitmap: BitmapUniforms;
|
|
586
586
|
@group(0) @binding(auto) var bitmapTexture: texture_2d<f32>;
|
|
587
587
|
@group(0) @binding(auto) var bitmapTextureSampler: sampler;
|
|
588
|
-
`;var
|
|
588
|
+
`;var ii=`layout(std140) uniform bitmapUniforms {
|
|
589
589
|
vec4 bounds;
|
|
590
590
|
float coordinateConversion;
|
|
591
591
|
float desaturate;
|
|
592
592
|
vec3 tintColor;
|
|
593
593
|
vec4 transparentColor;
|
|
594
594
|
} bitmap;
|
|
595
|
-
`;var
|
|
595
|
+
`;var oi={name:`bitmap`,source:yn,vs:ii,fs:ii,uniformTypes:{bounds:`vec4<f32>`,coordinateConversion:`f32`,desaturate:`f32`,tintColor:`vec3<f32>`,transparentColor:`vec4<f32>`}};var ni=`struct Attributes {
|
|
596
596
|
@location(0) positions: vec3<f32>,
|
|
597
597
|
@location(1) positions64Low: vec3<f32>,
|
|
598
598
|
@location(2) texCoords: vec2<f32>,
|
|
@@ -731,7 +731,7 @@ fn fragmentMain(input: Varyings) -> @location(0) vec4<f32> {
|
|
|
731
731
|
|
|
732
732
|
return deckgl_premultiplied_alpha(fragColor);
|
|
733
733
|
}
|
|
734
|
-
`;var
|
|
734
|
+
`;var si=`#version 300 es
|
|
735
735
|
#define SHADER_NAME bitmap-layer-vertex-shader
|
|
736
736
|
|
|
737
737
|
in vec2 texCoords;
|
|
@@ -762,7 +762,7 @@ void main(void) {
|
|
|
762
762
|
vec4 color = vec4(0.0);
|
|
763
763
|
DECKGL_FILTER_COLOR(color, geometry);
|
|
764
764
|
}
|
|
765
|
-
`;var
|
|
765
|
+
`;var ri=`#version 300 es
|
|
766
766
|
#define SHADER_NAME bitmap-layer-fragment-shader
|
|
767
767
|
|
|
768
768
|
#ifdef GL_ES
|
|
@@ -868,7 +868,7 @@ void main(void) {
|
|
|
868
868
|
fragColor.rgb = packUVsIntoRGB(uv);
|
|
869
869
|
}
|
|
870
870
|
}
|
|
871
|
-
`;var
|
|
871
|
+
`;var _n={image:{type:`image`,value:null,async:!0},bounds:{type:`array`,value:[1,0,0,1],compare:!0},_imageCoordinateSystem:`default`,desaturate:{type:`number`,min:0,max:1,value:0},transparentColor:{type:`color`,value:[0,0,0,0]},tintColor:{type:`color`,value:[255,255,255]},textureParameters:{type:`object`,ignore:!0,value:null}};var fe=class extends ao{getShaders(){return super.getShaders({vs:si,fs:ri,source:ni,modules:[ma,Wa,Ka,oi]})}initializeState(){let e=this.getAttributeManager(),t=!0;e.add({indices:{size:1,isIndexed:!0,update:o=>o.value=this.state.mesh.indices,noAlloc:t},positions:{size:3,type:`float64`,fp64:this.use64bitPositions(),update:o=>o.value=this.state.mesh.positions,noAlloc:t},texCoords:{size:2,update:o=>o.value=this.state.mesh.texCoords,noAlloc:t}})}updateState({props:e,oldProps:t,changeFlags:o}){let n=this.getAttributeManager();if(o.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),n.invalidateAll()),e.bounds!==t.bounds){let s=this.state.mesh,r$1=this._createMesh();this.state.model.setVertexCount(r$1.vertexCount);for(let a in r$1)s&&s[a]!==r$1[a]&&n.invalidate(a);this.setState(r({mesh:r$1},this._getCoordinateUniforms()))}else e._imageCoordinateSystem!==t._imageCoordinateSystem&&this.setState(this._getCoordinateUniforms())}getPickingInfo(e){let{image:t}=this.props,o=e.info;if(!o.color||!t)return o.bitmap=null,o;let{width:n,height:s}=t;o.index=0;let r=Sn(o.color);return o.bitmap={size:{width:n,height:s},uv:r,pixel:[Math.floor(r[0]*n),Math.floor(r[1]*s)]},o}disablePickingIndex(){this.setState({disablePicking:!0})}restorePickingColors(){this.setState({disablePicking:!1})}_updateAutoHighlight(e){super._updateAutoHighlight(s(r({},e),{color:this.encodePickingColor(0)}))}_createMesh(){let{bounds:e}=this.props,t=e;return ai(e)&&(t=[[e[0],e[1]],[e[0],e[3]],[e[2],e[3]],[e[2],e[1]]]),bt(t,this.context.viewport.resolution)}_getModel(){let e=this.context.device.type===`webgpu`?this.getAttributeManager().getBufferLayouts({isInstanced:!1}).filter(t=>t.name!==`indices`):this.getAttributeManager().getBufferLayouts();return new De(this.context.device,s(r({},this.getShaders()),{id:this.props.id,bufferLayout:e,topology:`triangle-list`,isInstanced:!1}))}draw(e){let{shaderModuleProps:t}=e,{model:o,coordinateConversion:n,bounds:s,disablePicking:r}=this.state,{image:a,desaturate:l,transparentColor:c,tintColor:f}=this.props;if(!(t.picking.isActive&&r)&&a&&o){let d={bitmapTexture:a,bounds:s,coordinateConversion:n,desaturate:l,tintColor:f.slice(0,3).map(p=>p/255),transparentColor:c.map(p=>p/255)};o.shaderInputs.setProps({bitmap:d}),o.draw(this.context.renderPass)}}_getCoordinateUniforms(){let{_imageCoordinateSystem:e}=this.props;if(e!=="default"){let{bounds:t}=this.props;if(!ai(t))throw new Error(`_imageCoordinateSystem only supports rectangular bounds`);let o=this.context.viewport.resolution?`lnglat`:`cartesian`;if(e=e===`lnglat`?`lnglat`:`cartesian`,e===`lnglat`&&o===`cartesian`)return{coordinateConversion:-1,bounds:t};if(e===`cartesian`&&o===`lnglat`){let n=nt$1([t[0],t[1]]),s=nt$1([t[2],t[3]]);return{coordinateConversion:1,bounds:[n[0],n[1],s[0],s[1]]}}}return{coordinateConversion:0,bounds:[0,0,0,0]}}};fe.layerName=`BitmapLayer`;fe.defaultProps=_n;var Cn=fe;function Sn(i){let[e,t,o]=i,n=(o&240)/256;return[(e+(o&15)/16)/256,(t+n)/256]}function ai(i){return Number.isFinite(i[0])}var li=`layout(std140) uniform iconUniforms {
|
|
872
872
|
float sizeScale;
|
|
873
873
|
vec2 iconsTextureDim;
|
|
874
874
|
float sizeBasis;
|
|
@@ -878,7 +878,7 @@ void main(void) {
|
|
|
878
878
|
highp int sizeUnits;
|
|
879
879
|
float alphaCutoff;
|
|
880
880
|
} icon;
|
|
881
|
-
`;var
|
|
881
|
+
`;var ci={name:`icon`,vs:li,fs:li,uniformTypes:{sizeScale:`f32`,iconsTextureDim:`vec2<f32>`,sizeBasis:`f32`,sizeMinPixels:`f32`,sizeMaxPixels:`f32`,billboard:`f32`,sizeUnits:`i32`,alphaCutoff:`f32`}};var fi=`#version 300 es
|
|
882
882
|
#define SHADER_NAME icon-layer-vertex-shader
|
|
883
883
|
in vec2 positions;
|
|
884
884
|
in vec3 instancePositions;
|
|
@@ -945,7 +945,7 @@ vColor = instanceColors;
|
|
|
945
945
|
DECKGL_FILTER_COLOR(vColor, geometry);
|
|
946
946
|
vColorMode = instanceColorModes;
|
|
947
947
|
}
|
|
948
|
-
`;var
|
|
948
|
+
`;var di=`#version 300 es
|
|
949
949
|
#define SHADER_NAME icon-layer-fragment-shader
|
|
950
950
|
precision highp float;
|
|
951
951
|
uniform sampler2D iconsTexture;
|
|
@@ -965,7 +965,7 @@ discard;
|
|
|
965
965
|
fragColor = vec4(color, a);
|
|
966
966
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
967
967
|
}
|
|
968
|
-
`;var
|
|
968
|
+
`;var Ln=`struct IconUniforms {
|
|
969
969
|
sizeScale: f32,
|
|
970
970
|
iconsTextureDim: vec2<f32>,
|
|
971
971
|
sizeBasis: f32,
|
|
@@ -1115,14 +1115,14 @@ fn fragmentMain(inp: Varyings) -> @location(0) vec4<f32> {
|
|
|
1115
1115
|
|
|
1116
1116
|
return fragColor;
|
|
1117
1117
|
}
|
|
1118
|
-
`;function
|
|
1118
|
+
`;function pi(i){return Ln.replace(`PICKING_COLOR_ATTRIBUTE`,i?`@location(10) rowIndexes: u32,`:``).replace(`PICKING_COLOR_VALUE`,i?`picking_getPickingColorFromIndex(inp.rowIndexes)`:`picking_getPickingColorFromIndex(inp.instanceIndex)`)}var bn=1024;var wn=4;var ui=()=>{};var gi={minFilter:`linear`,mipmapFilter:`linear`,magFilter:`linear`,addressModeU:`clamp-to-edge`,addressModeV:`clamp-to-edge`};var In={x:0,y:0,width:0,height:0};function An(i){return Math.pow(2,Math.ceil(Math.log2(i)))}function En(i,e,t,o){let n=Math.min(t/e.width,o/e.height),s=Math.floor(e.width*n),r=Math.floor(e.height*n);return n===1?{image:e,width:s,height:r}:(i.canvas.height=r,i.canvas.width=s,i.clearRect(0,0,s,r),i.drawImage(e,0,0,e.width,e.height,0,0,s,r),{image:i.canvas,width:s,height:r})}function de(i){return i&&(i.id||i.url)}function xi(i){let{device:e}=i;e.type===`webgl`?i.generateMipmapsWebGL():e.type===`webgpu`&&e.generateMipmapsWebGPU(i)}function Tn(i,e,t,o){let{width:n,height:s,device:r}=i,a=r.createTexture({format:`rgba8unorm`,width:e,height:t,sampler:o,mipLevels:r.getMipLevelCount(e,t)}),l=r.createCommandEncoder();l.copyTextureToTexture({sourceTexture:i,destinationTexture:a,width:n,height:s});let c=l.finish();return r.submit(c),xi(a),i.destroy(),a}function hi(i,e,t){for(let o=0;o<e.length;o++){let{icon:n,xOffset:s$1}=e[o],r$2=de(n);i[r$2]=s(r({},n),{x:s$1,y:t})}}function On({icons:i,buffer:e,mapping:t={},xOffset:o=0,yOffset:n=0,rowHeight:s=0,canvasWidth:r}){let a=[];for(let l=0;l<i.length;l++){let c=i[l];if(!t[de(c)]){let{height:d,width:p}=c;o+p+e>r&&(hi(t,a,n),o=0,n=s+n+e,s=0,a=[]),a.push({icon:c,xOffset:o}),o=o+p+e,s=Math.max(s,d)}}return a.length>0&&hi(t,a,n),{mapping:t,rowHeight:s,xOffset:o,yOffset:n,canvasWidth:r,canvasHeight:An(s+n+e)}}function Rn(i,e,t){if(!i||!e)return null;t=t||{};let o={},{iterable:n,objectInfo:s$2}=Yr(i);for(let r$3 of n){s$2.index++;let a=e(r$3,s$2),l=de(a);if(!a)throw new Error(`Icon is missing.`);if(!a.url)throw new Error(`Icon url is missing.`);!o[l]&&(!t[l]||a.url!==t[l].url)&&(o[l]=s(r({},a),{source:r$3,sourceIndex:s$2.index}))}return o}var pe=class{constructor(e,{onUpdate:t=ui,onError:o=ui}){this._loadOptions=null,this._texture=null,this._externalTexture=null,this._mapping={},this._samplerParameters=null,this._pendingCount=0,this._autoPacking=!1,this._xOffset=0,this._yOffset=0,this._rowHeight=0,this._buffer=wn,this._canvasWidth=bn,this._canvasHeight=0,this._canvas=null,this.device=e,this.onUpdate=t,this.onError=o}finalize(){this._texture?.delete()}getTexture(){return this._texture||this._externalTexture}getIconMapping(e){let t=this._autoPacking?de(e):e;return this._mapping[t]||In}setProps({loadOptions:e,autoPacking:t,iconAtlas:o,iconMapping:n,textureParameters:s}){e&&(this._loadOptions=e),t!==void 0&&(this._autoPacking=t),n&&(this._mapping=n),o&&(this._texture?.delete(),this._texture=null,this._externalTexture=o),s&&(this._samplerParameters=s)}get isLoaded(){return this._pendingCount===0}packIcons(e,t){if(!this._autoPacking||typeof document>`u`)return;let o=Object.values(Rn(e,t,this._mapping)||{});if(o.length>0){let{mapping:n,xOffset:s,yOffset:r,rowHeight:a,canvasHeight:l}=On({icons:o,buffer:this._buffer,canvasWidth:this._canvasWidth,mapping:this._mapping,rowHeight:this._rowHeight,xOffset:this._xOffset,yOffset:this._yOffset});this._rowHeight=a,this._mapping=n,this._xOffset=s,this._yOffset=r,this._canvasHeight=l,this._texture||(this._texture=this.device.createTexture({format:`rgba8unorm`,data:null,width:this._canvasWidth,height:this._canvasHeight,sampler:this._samplerParameters||gi,mipLevels:this.device.getMipLevelCount(this._canvasWidth,this._canvasHeight)})),this._texture.height!==this._canvasHeight&&(this._texture=Tn(this._texture,this._canvasWidth,this._canvasHeight,this._samplerParameters||gi)),this.onUpdate(!0),this._canvas=this._canvas||document.createElement(`canvas`),this._loadIcons(o)}}_loadIcons(e){let t=this._canvas.getContext(`2d`,{willReadFrequently:!0});for(let o of e)this._pendingCount++,xe$1(o.url,this._loadOptions).then(n=>{let s=de(o),r=this._mapping[s],{x:a,y:l,width:c,height:f}=r,{image:d,width:p,height:u}=En(t,n,c,f),g=a+(c-p)/2,h=l+(f-u)/2;this._texture?.copyExternalImage({image:d,x:g,y:h,width:p,height:u}),r.x=g,r.y=h,r.width=p,r.height=u,this._texture&&xi(this._texture),this.onUpdate(p!==c||u!==f)}).catch(n=>{this.onError({url:o.url,source:o.source,sourceIndex:o.sourceIndex,loadOptions:this._loadOptions,error:n})}).finally(()=>{this._pendingCount--})}};var vi=[0,0,0,255];var Mn={iconAtlas:{type:`image`,value:null,async:!0},iconMapping:{type:`object`,value:{},async:!0},sizeScale:{type:`number`,value:1,min:0},billboard:!0,sizeUnits:`pixels`,sizeBasis:`height`,sizeMinPixels:{type:`number`,min:0,value:0},sizeMaxPixels:{type:`number`,min:0,value:Number.MAX_SAFE_INTEGER},alphaCutoff:{type:`number`,value:.05,min:0,max:1},getPosition:{type:`accessor`,value:i=>i.position},getIcon:{type:`accessor`,value:i=>i.icon},getColor:{type:`accessor`,value:vi},getSize:{type:`accessor`,value:1},getAngle:{type:`accessor`,value:0},getPixelOffset:{type:`accessor`,value:[0,0]},onIconError:{type:`function`,value:null,optional:!0},textureParameters:{type:`object`,ignore:!0,value:null}};var ue=class extends ao{getShaders(){let e=!!this.props.data?.attributes?.rowIndexes;return super.getShaders({vs:fi,fs:di,source:pi(e),defines:e?{USE_ROW_INDEXES:!0}:{},modules:[Wa,ma,Ka,ci]})}initializeState(){this.state={iconManager:new pe(this.context.device,{onUpdate:this._onUpdate.bind(this),onError:this._onError.bind(this)})},this.getAttributeManager().addInstanced(r({instancePositions:{size:3,type:`float64`,fp64:this.use64bitPositions(),transition:!0,accessor:`getPosition`},instanceSizes:{size:1,transition:!0,bufferGroup:`icon-instance-data`,accessor:`getSize`,defaultValue:1},instanceIconDefs:{size:7,bufferGroup:`icon-instance-data`,accessor:`getIcon`,transform:this.getInstanceIconDef,shaderAttributes:{instanceOffsets:{size:2,elementOffset:0},instanceIconFrames:{size:4,elementOffset:2},instanceColorModes:{size:1,elementOffset:6}}},instanceColors:{size:this.props.colorFormat.length,type:`unorm8`,transition:!0,bufferGroup:`icon-instance-data`,accessor:`getColor`,defaultValue:vi},instanceAngles:{size:1,transition:!0,bufferGroup:`icon-instance-data`,accessor:`getAngle`},instancePixelOffset:{size:2,transition:!0,bufferGroup:`icon-instance-data`,accessor:`getPixelOffset`}},this.props.data?.attributes?.rowIndexes?{rowIndexes:{size:1,type:`uint32`,noAlloc:!0}}:{}))}updateState(e){super.updateState(e);let{props:t,oldProps:o,changeFlags:n}=e,s=this.getAttributeManager(),{iconAtlas:r,iconMapping:a,data:l,getIcon:c,textureParameters:f}=t,{iconManager:d}=this.state;if(typeof r==`string`)return;let p=r||this.internalState.isAsyncPropLoading(`iconAtlas`);d.setProps({loadOptions:t.loadOptions,autoPacking:!p,iconAtlas:r,iconMapping:p?a:null,textureParameters:f}),p?o.iconMapping!==t.iconMapping&&s.invalidate(`getIcon`):(n.dataChanged||n.updateTriggersChanged&&(n.updateTriggersChanged.all||n.updateTriggersChanged.getIcon))&&d.packIcons(l,c),n.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),s.invalidateAll())}get isLoaded(){return super.isLoaded&&this.state.iconManager.isLoaded}finalizeState(e){super.finalizeState(e),this.state.iconManager.finalize()}draw({uniforms:e}){this._drawModel(this.state.model)}_drawModel(e){let{sizeScale:t,sizeBasis:o,sizeMinPixels:n,sizeMaxPixels:s,sizeUnits:r,billboard:a,alphaCutoff:l}=this.props,{iconManager:c}=this.state,f=c.getTexture();if(f){let d={iconsTexture:f,iconsTextureDim:[f.width,f.height],sizeUnits:ee[r],sizeScale:t,sizeBasis:o===`height`?1:0,sizeMinPixels:n,sizeMaxPixels:s,billboard:a,alphaCutoff:l};e.shaderInputs.setProps({icon:d}),e.draw(this.context.renderPass)}}_getModel(e=this.props.id){return new De(this.context.device,s(r({},this.getShaders()),{id:e,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new re$1({topology:`triangle-strip`,attributes:{positions:{size:2,value:new Float32Array([-1,-1,1,-1,-1,1,1,1])}}}),isInstanced:!0}))}_onUpdate(e){e?(this.getAttributeManager()?.invalidate(`getIcon`),this.setNeedsUpdate()):this.setNeedsRedraw()}_onError(e){let t=this.getCurrentLayer()?.props.onIconError;t?t(e):S.error(e.error.message)()}getInstanceIconDef(e){let{x:t,y:o,width:n,height:s,mask:r,anchorX:a=n/2,anchorY:l=s/2}=this.state.iconManager.getIconMapping(e);return[n/2-a,s/2-l,t,o,n,s,r?1:0]}};ue.defaultProps=Mn;ue.layerName=`IconLayer`;var ge=ue;var mi=`layout(std140) uniform lineUniforms {
|
|
1119
1119
|
float widthScale;
|
|
1120
1120
|
float widthMinPixels;
|
|
1121
1121
|
float widthMaxPixels;
|
|
1122
1122
|
float useShortestPath;
|
|
1123
1123
|
highp int widthUnits;
|
|
1124
1124
|
} line;
|
|
1125
|
-
`;var
|
|
1125
|
+
`;var yi={name:`line`,source:``,vs:mi,fs:mi,uniformTypes:{widthScale:`f32`,widthMinPixels:`f32`,widthMaxPixels:`f32`,useShortestPath:`f32`,widthUnits:`i32`}};var Pi=`// ---------- Helper Structures & Functions ----------
|
|
1126
1126
|
|
|
1127
1127
|
// Placeholder filter functions.
|
|
1128
1128
|
fn deckgl_filter_size(offset: vec3<f32>, geometry: Geometry) -> vec3<f32> {
|
|
@@ -1342,7 +1342,7 @@ fn fragmentMain(
|
|
|
1342
1342
|
|
|
1343
1343
|
return fragColor;
|
|
1344
1344
|
}
|
|
1345
|
-
`;var
|
|
1345
|
+
`;var _i=`#version 300 es
|
|
1346
1346
|
#define SHADER_NAME line-layer-vertex-shader
|
|
1347
1347
|
in vec3 positions;
|
|
1348
1348
|
in vec3 instanceSourcePositions;
|
|
@@ -1418,7 +1418,7 @@ gl_Position = p + vec4(project_pixel_size_to_clipspace(offset.xy), 0.0, 0.0);
|
|
|
1418
1418
|
vColor = vec4(instanceColors.rgb, instanceColors.a * layer.opacity);
|
|
1419
1419
|
DECKGL_FILTER_COLOR(vColor, geometry);
|
|
1420
1420
|
}
|
|
1421
|
-
`;var
|
|
1421
|
+
`;var Ci=`#version 300 es
|
|
1422
1422
|
#define SHADER_NAME line-layer-fragment-shader
|
|
1423
1423
|
precision highp float;
|
|
1424
1424
|
in vec4 vColor;
|
|
@@ -1437,11 +1437,11 @@ fragColor.a *= smoothedge(0.0, edgePixels);
|
|
|
1437
1437
|
#endif
|
|
1438
1438
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
1439
1439
|
}
|
|
1440
|
-
`;var
|
|
1440
|
+
`;var kn={getSourcePosition:{type:`accessor`,value:i=>i.sourcePosition},getTargetPosition:{type:`accessor`,value:i=>i.targetPosition},getColor:{type:`accessor`,value:[0,0,0,255]},getWidth:{type:`accessor`,value:1},widthUnits:`pixels`,widthScale:{type:`number`,value:1,min:0},widthMinPixels:{type:`number`,value:0,min:0},widthMaxPixels:{type:`number`,value:Number.MAX_SAFE_INTEGER,min:0},antialiasing:!1};var he=class extends ao{getBounds(){return this.getAttributeManager()?.getBounds([`instanceSourcePositions`,`instanceTargetPositions`])}getShaders(){let{antialiasing:e}=this.props;return super.getShaders({vs:_i,fs:Ci,source:Pi,defines:e?{ANTIALIASING:1}:{},modules:[Wa,ma,Ka,yi]})}get wrapLongitude(){return!1}initializeState(){this.getAttributeManager().addInstanced({instanceSourcePositions:{size:3,type:`float64`,fp64:this.use64bitPositions(),transition:!0,accessor:`getSourcePosition`},instanceTargetPositions:{size:3,type:`float64`,fp64:this.use64bitPositions(),transition:!0,accessor:`getTargetPosition`},instanceColors:{size:this.props.colorFormat.length,type:`unorm8`,transition:!0,accessor:`getColor`,defaultValue:[0,0,0,255]},instanceWidths:{size:1,transition:!0,accessor:`getWidth`,defaultValue:1}})}updateState(e){super.updateState(e);let{props:t,oldProps:o,changeFlags:n}=e;(n.extensionsChanged||t.antialiasing!==o.antialiasing)&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({uniforms:e}){let{widthUnits:t,widthScale:o,widthMinPixels:n,widthMaxPixels:s$3,wrapLongitude:r$4}=this.props,a=this.state.model,l={widthUnits:ee[t],widthScale:o,widthMinPixels:n,widthMaxPixels:s$3,useShortestPath:r$4?1:0};a.shaderInputs.setProps({line:l}),a.draw(this.context.renderPass),r$4&&(a.shaderInputs.setProps({line:s(r({},l),{useShortestPath:-1})}),a.draw(this.context.renderPass))}_getModel(){return new De(this.context.device,s(r({},this.getShaders()),{id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new re$1({topology:`triangle-strip`,attributes:{positions:{size:3,value:new Float32Array([0,-1,0,0,1,0,1,-1,0,1,1,0])}}}),isInstanced:!0}))}};he.layerName=`LineLayer`;he.defaultProps=kn;var Dn=he;var Si=`layout(std140) uniform pointCloudUniforms {
|
|
1441
1441
|
float radiusPixels;
|
|
1442
1442
|
highp int sizeUnits;
|
|
1443
1443
|
} pointCloud;
|
|
1444
|
-
`;var
|
|
1444
|
+
`;var Li={name:`pointCloud`,source:``,vs:Si,fs:Si,uniformTypes:{radiusPixels:`f32`,sizeUnits:`i32`}};var bi=`#version 300 es
|
|
1445
1445
|
#define SHADER_NAME point-cloud-layer-vertex-shader
|
|
1446
1446
|
in vec3 positions;
|
|
1447
1447
|
in vec3 instanceNormals;
|
|
@@ -1474,7 +1474,7 @@ vec3 lightColor = lighting_getLightColor(instanceColors.rgb, project.cameraPosit
|
|
|
1474
1474
|
vColor = vec4(lightColor, instanceColors.a * layer.opacity);
|
|
1475
1475
|
DECKGL_FILTER_COLOR(vColor, geometry);
|
|
1476
1476
|
}
|
|
1477
|
-
`;var
|
|
1477
|
+
`;var wi=`#version 300 es
|
|
1478
1478
|
#define SHADER_NAME point-cloud-layer-fragment-shader
|
|
1479
1479
|
precision highp float;
|
|
1480
1480
|
in vec4 vColor;
|
|
@@ -1497,7 +1497,7 @@ fragColor.a *= smoothedge(0.0, edgePixels);
|
|
|
1497
1497
|
#endif
|
|
1498
1498
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
1499
1499
|
}
|
|
1500
|
-
`;var
|
|
1500
|
+
`;var Ii=`struct PointCloudUniforms {
|
|
1501
1501
|
radiusPixels: f32,
|
|
1502
1502
|
sizeUnits: i32,
|
|
1503
1503
|
};
|
|
@@ -1633,7 +1633,7 @@ fn fragmentMain(varyings: Varyings) -> @location(0) vec4<f32> {
|
|
|
1633
1633
|
|
|
1634
1634
|
return fragColor;
|
|
1635
1635
|
}
|
|
1636
|
-
`;var
|
|
1636
|
+
`;var Ai=[0,0,0,255];var Ei=[0,0,1];var Fn={sizeUnits:`pixels`,pointSize:{type:`number`,min:0,value:10},antialiasing:!1,getPosition:{type:`accessor`,value:i=>i.position},getNormal:{type:`accessor`,value:Ei},getColor:{type:`accessor`,value:Ai},material:!0,radiusPixels:{deprecatedFor:`pointSize`}};function Nn(i){let{header:e,attributes:t}=i;if(!(!e||!t)&&(i.length=e.vertexCount,t.POSITION&&(t.instancePositions=t.POSITION),t.NORMAL&&(t.instanceNormals=t.NORMAL),t.COLOR_0)){let{size:o,value:n}=t.COLOR_0;t.instanceColors={size:o,type:`unorm8`,value:n}}}var xe=class extends ao{getShaders(){let{antialiasing:e}=this.props;return super.getShaders({vs:bi,fs:wi,source:Ii,defines:e?{ANTIALIASING:1}:{},modules:[Wa,ma,Zo$1,Ka,Li]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:`float64`,fp64:this.use64bitPositions(),transition:!0,accessor:`getPosition`},instanceNormals:{size:3,transition:!0,accessor:`getNormal`,defaultValue:Ei},instanceColors:{size:this.props.colorFormat.length,type:`unorm8`,transition:!0,accessor:`getColor`,defaultValue:Ai}})}updateState(e){let{changeFlags:t,props:o,oldProps:n}=e;super.updateState(e),(t.extensionsChanged||o.antialiasing!==n.antialiasing)&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll()),t.dataChanged&&Nn(o.data)}draw({uniforms:e}){let{pointSize:t,sizeUnits:o}=this.props,n=this.state.model,s={sizeUnits:ee[o],radiusPixels:t};n.shaderInputs.setProps({pointCloud:s}),n.draw(this.context.renderPass)}_getModel(){let e=[];for(let t=0;t<3;t++){let o=t/3*Math.PI*2;e.push(Math.cos(o)*2,Math.sin(o)*2,0)}return new De(this.context.device,s(r({},this.getShaders()),{id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new re$1({topology:`triangle-list`,attributes:{positions:new Float32Array(e)}}),isInstanced:!0}))}};xe.layerName=`PointCloudLayer`;xe.defaultProps=Fn;var Gn=xe;var Ti=`layout(std140) uniform scatterplotUniforms {
|
|
1637
1637
|
float radiusScale;
|
|
1638
1638
|
float radiusMinPixels;
|
|
1639
1639
|
float radiusMaxPixels;
|
|
@@ -1647,7 +1647,7 @@ fn fragmentMain(varyings: Varyings) -> @location(0) vec4<f32> {
|
|
|
1647
1647
|
highp int radiusUnits;
|
|
1648
1648
|
highp int lineWidthUnits;
|
|
1649
1649
|
} scatterplot;
|
|
1650
|
-
`;var
|
|
1650
|
+
`;var Oi={name:`scatterplot`,vs:Ti,fs:Ti,source:``,uniformTypes:{radiusScale:`f32`,radiusMinPixels:`f32`,radiusMaxPixels:`f32`,lineWidthScale:`f32`,lineWidthMinPixels:`f32`,lineWidthMaxPixels:`f32`,stroked:`f32`,filled:`f32`,antialiasing:`f32`,billboard:`f32`,radiusUnits:`i32`,lineWidthUnits:`i32`}};var Ri=`#version 300 es
|
|
1651
1651
|
#define SHADER_NAME scatterplot-layer-vertex-shader
|
|
1652
1652
|
in vec3 positions;
|
|
1653
1653
|
in vec3 instancePositions;
|
|
@@ -1704,7 +1704,7 @@ DECKGL_FILTER_COLOR(vFillColor, geometry);
|
|
|
1704
1704
|
vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * layer.opacity);
|
|
1705
1705
|
DECKGL_FILTER_COLOR(vLineColor, geometry);
|
|
1706
1706
|
}
|
|
1707
|
-
`;var
|
|
1707
|
+
`;var Mi=`#version 300 es
|
|
1708
1708
|
#define SHADER_NAME scatterplot-layer-fragment-shader
|
|
1709
1709
|
precision highp float;
|
|
1710
1710
|
in vec4 vFillColor;
|
|
@@ -1742,7 +1742,7 @@ fragColor = vFillColor;
|
|
|
1742
1742
|
fragColor.a *= inCircle;
|
|
1743
1743
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
1744
1744
|
}
|
|
1745
|
-
`;var
|
|
1745
|
+
`;var jn=`// Main shaders
|
|
1746
1746
|
|
|
1747
1747
|
struct ScatterplotUniforms {
|
|
1748
1748
|
radiusScale: f32,
|
|
@@ -1946,7 +1946,7 @@ fn fragmentMain(varyings: Varyings) -> @location(0) vec4<f32> {
|
|
|
1946
1946
|
return fragColor;
|
|
1947
1947
|
// return vec4<f32>(0, 0, 1, 1);
|
|
1948
1948
|
}
|
|
1949
|
-
`;function
|
|
1949
|
+
`;function zi(i){return jn.replace(`PICKING_COLOR_ATTRIBUTE`,i?`@location(8) rowIndexes: u32,`:``).replace(`PICKING_COLOR_VALUE`,i?`picking_getPickingColorFromIndex(attributes.rowIndexes)`:`picking_getPickingColorFromIndex(attributes.instanceIndex)`)}var ie={name:`clip`,source:`struct ClipUniforms {
|
|
1950
1950
|
enabled: i32,
|
|
1951
1951
|
mode: i32,
|
|
1952
1952
|
bounds: vec4<f32>,
|
|
@@ -1980,7 +1980,7 @@ fn clip_filterColor(geometryCoordinates: vec2<f32>) {
|
|
|
1980
1980
|
discard;
|
|
1981
1981
|
}
|
|
1982
1982
|
}
|
|
1983
|
-
`,props:{},uniforms:{},bindingLayout:[{name:`clip`,group:2}],uniformTypes:{enabled:`i32`,mode:`i32`,bounds:`vec4<f32>`},defaultUniforms:{enabled:0,mode:0,bounds:[0,0,1,1]},getUniforms(t={}){let o={};return t.enabled!==void 0&&(o.enabled=t.enabled?1:0),t.mode!==void 0&&(o.mode=t.mode===`instance`?1:0),t.bounds!==void 0&&(o.bounds=t.bounds),o}};var _i=[0,0,0,255];var zn={radiusUnits:`meters`,radiusScale:{type:`number`,min:0,value:1},radiusMinPixels:{type:`number`,min:0,value:0},radiusMaxPixels:{type:`number`,min:0,value:Number.MAX_SAFE_INTEGER},lineWidthUnits:`meters`,lineWidthScale:{type:`number`,min:0,value:1},lineWidthMinPixels:{type:`number`,min:0,value:0},lineWidthMaxPixels:{type:`number`,min:0,value:Number.MAX_SAFE_INTEGER},stroked:!1,filled:!0,billboard:!1,antialiasing:!0,getPosition:{type:`accessor`,value:t=>t.position},getRadius:{type:`accessor`,value:1},getFillColor:{type:`accessor`,value:_i},getLineColor:{type:`accessor`,value:_i},getLineWidth:{type:`accessor`,value:1},getPixelOffset:{type:`accessor`,value:[0,0]},strokeWidth:{deprecatedFor:`getLineWidth`},outline:{deprecatedFor:`stroked`},getColor:{deprecatedFor:[`getFillColor`,`getLineColor`]}};var ut=(()=>{class t extends en$1{getShaders(){let e=!!this.props.data?.attributes?.rowIndexes;return super.getShaders({vs:mi,fs:yi,source:Pi(e),defines:e?{USE_ROW_INDEXES:!0}:{},modules:[Wa,ma,Ka,vi,...this.context.device.type===`webgpu`?[ie]:[]]})}initializeState(){let e=this.props.data?.attributes?.rowIndexes?{rowIndexes:{size:1,type:`uint32`,noAlloc:!0}}:{};this.getAttributeManager().addInstanced(r({instancePositions:{size:3,type:`float64`,fp64:this.use64bitPositions(),transition:!0,accessor:`getPosition`},instanceRadius:{size:1,transition:!0,accessor:`getRadius`,defaultValue:1,bufferGroup:`scatterplot-instance-data`},instanceFillColors:{size:this.props.colorFormat.length,transition:!0,type:`unorm8`,accessor:`getFillColor`,defaultValue:[0,0,0,255],bufferGroup:`scatterplot-instance-data`},instanceLineColors:{size:this.props.colorFormat.length,transition:!0,type:`unorm8`,accessor:`getLineColor`,defaultValue:[0,0,0,255],bufferGroup:`scatterplot-instance-data`},instanceLineWidths:{size:1,transition:!0,accessor:`getLineWidth`,defaultValue:1,bufferGroup:`scatterplot-instance-data`},instancePixelOffset:{size:2,transition:!0,accessor:`getPixelOffset`,bufferGroup:`scatterplot-instance-data`}},e))}updateState(e){super.updateState(e),e.changeFlags.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({uniforms:e}){let{radiusUnits:i,radiusScale:n,radiusMinPixels:s,radiusMaxPixels:r,stroked:a,filled:l,billboard:c,antialiasing:f,lineWidthUnits:d,lineWidthScale:u,lineWidthMinPixels:p,lineWidthMaxPixels:g}=this.props,h={stroked:a,filled:l,billboard:c,antialiasing:f,radiusUnits:ee[i],radiusScale:n,radiusMinPixels:s,radiusMaxPixels:r,lineWidthUnits:ee[d],lineWidthScale:u,lineWidthMinPixels:p,lineWidthMaxPixels:g},v=this.state.model;v.shaderInputs.setProps({scatterplot:h}),v.draw(this.context.renderPass)}_getModel(){return new De$1(this.context.device,s(r({},this.getShaders()),{id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new ne$1({topology:`triangle-strip`,attributes:{positions:{size:3,value:new Float32Array([-1,-1,0,1,-1,0,-1,1,0,1,1,0])}}}),isInstanced:!0}))}}return t.defaultProps=zn,t.layerName=`ScatterplotLayer`,t})();var oe={CLOCKWISE:1,COUNTER_CLOCKWISE:-1};function J(t,o,e={}){return Ci(t,e)!==o?(Dn(t,e),!0):!1}function Ci(t,o={}){return Math.sign(de(t,o))}var fe={x:0,y:1,z:2};function de(t,o={}){let{start:e=0,end:i=t.length,plane:n=`xy`}=o,s=o.size||2,r=0,a=fe[n[0]],l=fe[n[1]];for(let c=e,f=i-s;c<i;c+=s)r+=(t[c+a]-t[f+a])*(t[c+l]+t[f+l]),f=c;return r/2}function Dn(t,o){let{start:e=0,end:i=t.length,size:n=2}=o,s=(i-e)/n,r=Math.floor(s/2);for(let a=0;a<r;++a){let l=e+a*n,c=e+(s-1-a)*n;for(let f=0;f<n;++f){let d=t[l+f];t[l+f]=t[c+f],t[c+f]=d}}}function Nn(t,o,e=2,i,n=`xy`){let s=o&&o.length,r=s?o[0]*e:t.length,a=Si(t,0,r,e,!0,i&&i[0],n),l=[];if(!a||a.next===a.prev)return l;let c,f,d,u,p,g,h;if(s&&(a=Un(t,o,a,e,i,n)),t.length>80*e){u=f=t[0],p=d=t[1];for(let v=e;v<r;v+=e)g=t[v],h=t[v+1],g<u&&(u=g),h<p&&(p=h),g>f&&(f=g),h>d&&(d=h);c=Math.max(f-u,d-p),c=c!==0?32767/c:0}return ue(a,l,e,u,p,c,0),l}function Si(t,o,e,i,n,s,r){let a,l;s===void 0&&(s=de(t,{start:o,end:e,size:i,plane:r}));let c=fe[r[0]],f=fe[r[1]];if(n===s<0)for(a=o;a<e;a+=i)l=Li(a,t[a+c],t[a+f],l);else for(a=e-i;a>=o;a-=i)l=Li(a,t[a+c],t[a+f],l);return l&&Ne(l,l.next)&&(ge(l),l=l.next),l}function Y(t,o){if(!t)return t;o||(o=t);let e=t,i;do if(i=!1,!e.steiner&&(Ne(e,e.next)||b(e.prev,e,e.next)===0)){if(ge(e),e=o=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==o);return o}function ue(t,o,e,i,n,s,r){if(!t)return;!r&&s&&$n(t,i,n,s);let a=t,l,c;for(;t.prev!==t.next;){if(l=t.prev,c=t.next,s?Bn(t,i,n,s):Gn(t)){o.push(l.i/e|0),o.push(t.i/e|0),o.push(c.i/e|0),ge(t),t=c.next,a=c.next;continue}if(t=c,t===a){r?r===1?(t=jn(Y(t),o,e),ue(t,o,e,i,n,s,2)):r===2&&Wn(t,o,e,i,n,s):ue(Y(t),o,e,i,n,s,1);break}}}function Gn(t){let o=t.prev,e=t,i=t.next;if(b(o,e,i)>=0)return!1;let n=o.x,s=e.x,r=i.x,a=o.y,l=e.y,c=i.y,f=n<s?n<r?n:r:s<r?s:r,d=a<l?a<c?a:c:l<c?l:c,u=n>s?n>r?n:r:s>r?s:r,p=a>l?a>c?a:c:l>c?l:c,g=i.next;for(;g!==o;){if(g.x>=f&&g.x<=u&&g.y>=d&&g.y<=p&&ne(n,a,s,l,r,c,g.x,g.y)&&b(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function Bn(t,o,e,i){let n=t.prev,s=t,r=t.next;if(b(n,s,r)>=0)return!1;let a=n.x,l=s.x,c=r.x,f=n.y,d=s.y,u=r.y,p=a<l?a<c?a:c:l<c?l:c,g=f<d?f<u?f:u:d<u?d:u,h=a>l?a>c?a:c:l>c?l:c,v=f>d?f>u?f:u:d>u?d:u,P=pt(p,g,o,e,i),C=pt(h,v,o,e,i),m=t.prevZ,x=t.nextZ;for(;m&&m.z>=P&&x&&x.z<=C;){if(m.x>=p&&m.x<=h&&m.y>=g&&m.y<=v&&m!==n&&m!==r&&ne(a,f,l,d,c,u,m.x,m.y)&&b(m.prev,m,m.next)>=0||(m=m.prevZ,x.x>=p&&x.x<=h&&x.y>=g&&x.y<=v&&x!==n&&x!==r&&ne(a,f,l,d,c,u,x.x,x.y)&&b(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;m&&m.z>=P;){if(m.x>=p&&m.x<=h&&m.y>=g&&m.y<=v&&m!==n&&m!==r&&ne(a,f,l,d,c,u,m.x,m.y)&&b(m.prev,m,m.next)>=0)return!1;m=m.prevZ}for(;x&&x.z<=C;){if(x.x>=p&&x.x<=h&&x.y>=g&&x.y<=v&&x!==n&&x!==r&&ne(a,f,l,d,c,u,x.x,x.y)&&b(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function jn(t,o,e){let i=t;do{let n=i.prev,s=i.next.next;!Ne(n,s)&&bi(n,i,i.next,s)&&pe(n,s)&&pe(s,n)&&(o.push(n.i/e|0),o.push(i.i/e|0),o.push(s.i/e|0),ge(i),ge(i.next),i=t=s),i=i.next}while(i!==t);return Y(i)}function Wn(t,o,e,i,n,s){let r=t;do{let a=r.next.next;for(;a!==r.prev;){if(r.i!==a.i&&Xn(r,a)){let l=wi(r,a);r=Y(r,r.next),l=Y(l,l.next),ue(r,o,e,i,n,s,0),ue(l,o,e,i,n,s,0);return}a=a.next}r=r.next}while(r!==t)}function Un(t,o,e,i,n,s){let r=[],a,l,c,f,d;for(a=0,l=o.length;a<l;a++)c=o[a]*i,f=a<l-1?o[a+1]*i:t.length,d=Si(t,c,f,i,!1,n&&n[a+1],s),d===d.next&&(d.steiner=!0),r.push(Yn(d));for(r.sort(Vn),a=0;a<r.length;a++)e=Hn(r[a],e);return e}function Vn(t,o){return t.x-o.x}function Hn(t,o){let e=Zn(t,o);if(!e)return o;let i=wi(e,t);return Y(i,i.next),Y(e,e.next)}function Zn(t,o){let e=o,i=t.x,n=t.y,s=-Infinity,r;do{if(n<=e.y&&n>=e.next.y&&e.next.y!==e.y){let u=e.x+(n-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(u<=i&&u>s&&(s=u,r=e.x<e.next.x?e:e.next,u===i))return r}e=e.next}while(e!==o);if(!r)return null;let a=r,l=r.x,c=r.y,f=Infinity,d;e=r;do i>=e.x&&e.x>=l&&i!==e.x&&ne(n<c?i:s,n,l,c,n<c?s:i,n,e.x,e.y)&&(d=Math.abs(n-e.y)/(i-e.x),pe(e,t)&&(d<f||d===f&&(e.x>r.x||e.x===r.x&&Kn(r,e)))&&(r=e,f=d)),e=e.next;while(e!==a);return r}function Kn(t,o){return b(t.prev,t,o.prev)<0&&b(o.next,t,t.next)<0}function $n(t,o,e,i){let n=t;do n.z===0&&(n.z=pt(n.x,n.y,o,e,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,Jn(n)}function Jn(t){let o,e,i=1,n,s,r,a,l,c;do{for(s=t,t=null,c=null,n=0;s;){for(n++,a=s,r=0,e=0;e<i&&(r++,a=a.nextZ,!!a);e++);for(l=i;r>0||l>0&&a;)r!==0&&(l===0||!a||s.z<=a.z)?(o=s,s=s.nextZ,r--):(o=a,a=a.nextZ,l--),c?c.nextZ=o:t=o,o.prevZ=c,c=o;s=a}c.nextZ=null,i*=2}while(n>1);return t}function pt(t,o,e,i,n){return t=(t-e)*n|0,o=(o-i)*n|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,o=(o|o<<8)&16711935,o=(o|o<<4)&252645135,o=(o|o<<2)&858993459,o=(o|o<<1)&1431655765,t|o<<1}function Yn(t){let o=t,e=t;do(o.x<e.x||o.x===e.x&&o.y<e.y)&&(e=o),o=o.next;while(o!==t);return e}function ne(t,o,e,i,n,s,r,a){return(n-r)*(o-a)>=(t-r)*(s-a)&&(t-r)*(i-a)>=(e-r)*(o-a)&&(e-r)*(s-a)>=(n-r)*(i-a)}function Xn(t,o){return t.next.i!==o.i&&t.prev.i!==o.i&&!qn(t,o)&&(pe(t,o)&&pe(o,t)&&Qn(t,o)&&(b(t.prev,t,o.prev)||b(t,o.prev,o))||Ne(t,o)&&b(t.prev,t,t.next)>0&&b(o.prev,o,o.next)>0)}function b(t,o,e){return(o.y-t.y)*(e.x-o.x)-(o.x-t.x)*(e.y-o.y)}function Ne(t,o){return t.x===o.x&&t.y===o.y}function bi(t,o,e,i){let n=Fe(b(t,o,e)),s=Fe(b(t,o,i)),r=Fe(b(e,i,t)),a=Fe(b(e,i,o));return!!(n!==s&&r!==a||n===0&&De(t,e,o)||s===0&&De(t,i,o)||r===0&&De(e,t,i)||a===0&&De(e,o,i))}function De(t,o,e){return o.x<=Math.max(t.x,e.x)&&o.x>=Math.min(t.x,e.x)&&o.y<=Math.max(t.y,e.y)&&o.y>=Math.min(t.y,e.y)}function Fe(t){return t>0?1:t<0?-1:0}function qn(t,o){let e=t;do{if(e.i!==t.i&&e.next.i!==t.i&&e.i!==o.i&&e.next.i!==o.i&&bi(e,e.next,t,o))return!0;e=e.next}while(e!==t);return!1}function pe(t,o){return b(t.prev,t,t.next)<0?b(t,o,t.next)>=0&&b(t,t.prev,o)>=0:b(t,o,t.prev)<0||b(t,t.next,o)<0}function Qn(t,o){let e=t,i=!1,n=(t.x+o.x)/2,s=(t.y+o.y)/2;do e.y>s!=e.next.y>s&&e.next.y!==e.y&&n<(e.next.x-e.x)*(s-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==t);return i}function wi(t,o){let e=new he(t.i,t.x,t.y),i=new he(o.i,o.x,o.y),n=t.next,s=o.prev;return t.next=o,o.prev=t,e.next=n,n.prev=e,i.next=e,e.prev=i,s.next=i,i.prev=s,i}function Li(t,o,e,i){let n=new he(t,o,e);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function ge(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}var he=class{constructor(o,e,i){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=o,this.x=e,this.y=i}};function B(t,o){let e=o.length,i=t.length;if(i>0){let n=!0;for(let s=0;s<e;s++)if(t[i-e+s]!==o[s]){n=!1;break}if(n)return!1}for(let n=0;n<e;n++)t[i+n]=o[n];return!0}function xe(t,o){let e=o.length;for(let i=0;i<e;i++)t[i]=o[i]}function K(t,o,e,i,n=[]){let s=i+o*e;for(let r=0;r<e;r++)n[r]=t[s+r];return n}function Ge(t,o,e,i,n=[]){let s,r;if(e&8)s=(i[3]-t[1])/(o[1]-t[1]),r=3;else if(e&4)s=(i[1]-t[1])/(o[1]-t[1]),r=1;else if(e&2)s=(i[2]-t[0])/(o[0]-t[0]),r=2;else if(e&1)s=(i[0]-t[0])/(o[0]-t[0]),r=0;else return null;for(let a=0;a<t.length;a++)n[a]=(r&1)===a?i[r]:s*(o[a]-t[a])+t[a];return n}function ve(t,o){let e=0;return t[0]<o[0]?e|=1:t[0]>o[2]&&(e|=2),t[1]<o[1]?e|=4:t[1]>o[3]&&(e|=8),e}function me(t,o){let{size:e=2,broken:i=!1,gridResolution:n=10,gridOffset:s=[0,0],startIndex:r=0,endIndex:a=t.length}=o||{},l=(a-r)/e,c=[],f=[c],d=K(t,0,e,r),u,p,g=Ei(d,n,s,[]),h=[];B(c,d);for(let v=1;v<l;v++){for(u=K(t,v,e,r,u),p=ve(u,g);p;){Ge(d,u,p,g,h);let P=ve(h,g);P&&(Ge(d,h,P,g,h),p=P),B(c,h),xe(d,h),ts(g,n,p),i&&c.length>e&&(c=[],f.push(c),B(c,d)),p=ve(u,g)}B(c,u),xe(d,u)}return i?f:f[0]}var Ii=0;var es=1;function ye(t,o=null,e){if(!t.length)return[];let{size:i=2,gridResolution:n=10,gridOffset:s=[0,0],edgeTypes:r=!1}=e||{},a=[],l=[{pos:t,types:r?new Array(t.length/i).fill(es):null,holes:o||[]}],c=[[],[]],f=[];for(;l.length;){let{pos:d,types:u,holes:p}=l.shift();is(d,i,p[0]||d.length,c),f=Ei(c[0],n,s,f);let g=ve(c[1],f);if(g){let h=Ai(d,u,i,0,p[0]||d.length,f,g),v={pos:h[0].pos,types:h[0].types,holes:[]},P={pos:h[1].pos,types:h[1].types,holes:[]};l.push(v,P);for(let C=0;C<p.length;C++)h=Ai(d,u,i,p[C],p[C+1]||d.length,f,g),h[0]&&(v.holes.push(v.pos.length),v.pos=Be(v.pos,h[0].pos),r&&(v.types=Be(v.types,h[0].types))),h[1]&&(P.holes.push(P.pos.length),P.pos=Be(P.pos,h[1].pos),r&&(P.types=Be(P.types,h[1].types)))}else{let h={positions:d};r&&(h.edgeTypes=u),p.length&&(h.holeIndices=p),a.push(h)}}return a}function Ai(t,o,e,i,n,s,r){let a=(n-i)/e,l=[],c=[],f=[],d=[],u=[],p,g,h,v=K(t,a-1,e,i),P=Math.sign(r&8?v[1]-s[3]:v[0]-s[2]),C=o&&o[a-1],m=0,x=0;for(let L=0;L<a;L++)p=K(t,L,e,i,p),g=Math.sign(r&8?p[1]-s[3]:p[0]-s[2]),h=o&&o[i/e+L],g&&P&&P!==g&&(Ge(v,p,r,s,u),B(l,u)&&f.push(C),B(c,u)&&d.push(C)),g<=0?(B(l,p)&&f.push(h),m-=g):f.length&&(f[f.length-1]=Ii),g>=0?(B(c,p)&&d.push(h),x+=g):d.length&&(d[d.length-1]=Ii),xe(v,p),P=g,C=h;return[m?{pos:l,types:o&&f}:null,x?{pos:c,types:o&&d}:null]}function Ei(t,o,e,i){let n=Math.floor((t[0]-e[0])/o)*o+e[0],s=Math.floor((t[1]-e[1])/o)*o+e[1];return i[0]=n,i[1]=s,i[2]=n+o,i[3]=s+o,i}function ts(t,o,e){e&8?(t[1]+=o,t[3]+=o):e&4?(t[1]-=o,t[3]-=o):e&2?(t[0]+=o,t[2]+=o):e&1&&(t[0]-=o,t[2]-=o)}function is(t,o,e,i){let n=Infinity,s=-Infinity,r=Infinity,a=-Infinity;for(let l=0;l<e;l+=o){let c=t[l],f=t[l+1];n=c<n?c:n,s=c>s?c:s,r=f<r?f:r,a=f>a?f:a}return i[0][0]=n,i[0][1]=r,i[1][0]=s,i[1][1]=a,i}function Be(t,o){for(let e=0;e<o.length;e++)t.push(o[e]);return t}var os=85.051129;function gt(t,o){let{size:e=2,startIndex:i=0,endIndex:n=t.length,normalize:s=!0}=o||{},r=t.slice(i,n);Ti(r,e,0,n-i);let a=me(r,{size:e,broken:!0,gridResolution:360,gridOffset:[-180,-180]});if(s)for(let l of a)Oi(l,e);return a}function ht(t,o=null,e){let{size:i=2,normalize:n=!0,edgeTypes:s=!1}=e||{};o=o||[];let r=[],a=[],l=0,c=0;for(let d=0;d<=o.length;d++){let u=o[d]||t.length,p=c,g=ns(t,i,l,u);for(let h=g;h<u;h++)r[c++]=t[h];for(let h=l;h<g;h++)r[c++]=t[h];Ti(r,i,p,c),ss(r,i,p,c,e?.maxLatitude),l=u,a[d]=c}a.pop();let f=ye(r,a,{size:i,gridResolution:360,gridOffset:[-180,-180],edgeTypes:s});if(n)for(let d of f)Oi(d.positions,i);return f}function ns(t,o,e,i){let n=-1,s=-1;for(let r=e+1;r<i;r+=o){let a=Math.abs(t[r]);a>n&&(n=a,s=r-1)}return s}function ss(t,o,e,i,n=os){let s=t[e],r=t[i-o];if(Math.abs(s-r)>180){let a=K(t,0,o,e);a[0]+=Math.round((r-s)/360)*360,B(t,a),a[1]=Math.sign(a[1])*n,B(t,a),a[0]=s,B(t,a)}}function Ti(t,o,e,i){let n=t[0],s;for(let r=e;r<i;r+=o){s=t[r];let a=s-n;(a>180||a<-180)&&(s-=Math.round(a/360)*360),t[r]=n=s}}function Oi(t,o){let e,i=t.length/o;for(let s=0;s<i&&(e=t[s*o],(e+180)%360===0);s++);let n=-Math.round(e/360)*360;if(n!==0)for(let s=0;s<i;s++)t[s*o]+=n}var je=class extends ne$1{constructor(o){let{indices:e,attributes:i}=as(o);super(s(r({},o),{topology:`line-list`,indices:e,attributes:i}))}};function as(t){let{radius:o,height:e=1,nradial:i=10}=t,{vertices:n}=t;n&&(A.assert(n.length>=i),n=n.flatMap(p=>[p[0],p[1]]),J(n,oe.COUNTER_CLOCKWISE));let s=e>0,r=i+1,a=s?r*3+1:i,l=Math.PI*2/i,c=new Uint16Array(s?i*3*2:0),f=new Float32Array(a*3),d=new Float32Array(a*3),u=0;if(s){for(let p=0;p<r;p++){let g=p*l,h=p%i,v=Math.sin(g),P=Math.cos(g);for(let C=0;C<2;C++)f[u+0]=n?n[h*2]:P*o,f[u+1]=n?n[h*2+1]:v*o,f[u+2]=(1/2-C)*e,d[u+0]=n?n[h*2]:P,d[u+1]=n?n[h*2+1]:v,u+=3}f[u+0]=f[u-3],f[u+1]=f[u-2],f[u+2]=f[u-1],u+=3}for(let p=s?0:1;p<r;p++){let g=Math.floor(p/2)*Math.sign(.5-p%2),h=g*l,v=(g+i)%i,P=Math.sin(h),C=Math.cos(h);f[u+0]=n?n[v*2]:C*o,f[u+1]=n?n[v*2+1]:P*o,f[u+2]=e/2,d[u+2]=1,u+=3}if(s){let p=0;for(let g=0;g<i;g++)c[p++]=g*2+0,c[p++]=g*2+2,c[p++]=g*2+0,c[p++]=g*2+1,c[p++]=g*2+1,c[p++]=g*2+3}return{indices:c,attributes:{POSITION:{size:3,value:f},NORMAL:{size:3,value:d}}}}var ls=`struct ColumnUniforms {
|
|
1983
|
+
`,props:{},uniforms:{},bindingLayout:[{name:`clip`,group:2}],uniformTypes:{enabled:`i32`,mode:`i32`,bounds:`vec4<f32>`},defaultUniforms:{enabled:0,mode:0,bounds:[0,0,1,1]},getUniforms(i={}){let e={};return i.enabled!==void 0&&(e.enabled=i.enabled?1:0),i.mode!==void 0&&(e.mode=i.mode===`instance`?1:0),i.bounds!==void 0&&(e.bounds=i.bounds),e}};var ki=[0,0,0,255];var Un={radiusUnits:`meters`,radiusScale:{type:`number`,min:0,value:1},radiusMinPixels:{type:`number`,min:0,value:0},radiusMaxPixels:{type:`number`,min:0,value:Number.MAX_SAFE_INTEGER},lineWidthUnits:`meters`,lineWidthScale:{type:`number`,min:0,value:1},lineWidthMinPixels:{type:`number`,min:0,value:0},lineWidthMaxPixels:{type:`number`,min:0,value:Number.MAX_SAFE_INTEGER},stroked:!1,filled:!0,billboard:!1,antialiasing:!0,getPosition:{type:`accessor`,value:i=>i.position},getRadius:{type:`accessor`,value:1},getFillColor:{type:`accessor`,value:ki},getLineColor:{type:`accessor`,value:ki},getLineWidth:{type:`accessor`,value:1},getPixelOffset:{type:`accessor`,value:[0,0]},strokeWidth:{deprecatedFor:`getLineWidth`},outline:{deprecatedFor:`stroked`},getColor:{deprecatedFor:[`getFillColor`,`getLineColor`]}};var ve=class extends ao{getShaders(){let e=!!this.props.data?.attributes?.rowIndexes;return super.getShaders({vs:Ri,fs:Mi,source:zi(e),defines:e?{USE_ROW_INDEXES:!0}:{},modules:[Wa,ma,Ka,Oi,...this.context.device.type===`webgpu`?[ie]:[]]})}initializeState(){let e=this.props.data?.attributes?.rowIndexes?{rowIndexes:{size:1,type:`uint32`,noAlloc:!0}}:{};this.getAttributeManager().addInstanced(r({instancePositions:{size:3,type:`float64`,fp64:this.use64bitPositions(),transition:!0,accessor:`getPosition`},instanceRadius:{size:1,transition:!0,accessor:`getRadius`,defaultValue:1,bufferGroup:`scatterplot-instance-data`},instanceFillColors:{size:this.props.colorFormat.length,transition:!0,type:`unorm8`,accessor:`getFillColor`,defaultValue:[0,0,0,255],bufferGroup:`scatterplot-instance-data`},instanceLineColors:{size:this.props.colorFormat.length,transition:!0,type:`unorm8`,accessor:`getLineColor`,defaultValue:[0,0,0,255],bufferGroup:`scatterplot-instance-data`},instanceLineWidths:{size:1,transition:!0,accessor:`getLineWidth`,defaultValue:1,bufferGroup:`scatterplot-instance-data`},instancePixelOffset:{size:2,transition:!0,accessor:`getPixelOffset`,bufferGroup:`scatterplot-instance-data`}},e))}updateState(e){super.updateState(e),e.changeFlags.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({uniforms:e}){let{radiusUnits:t,radiusScale:o,radiusMinPixels:n,radiusMaxPixels:s,stroked:r,filled:a,billboard:l,antialiasing:c,lineWidthUnits:f,lineWidthScale:d,lineWidthMinPixels:p,lineWidthMaxPixels:u}=this.props,g={stroked:r,filled:a,billboard:l,antialiasing:c,radiusUnits:ee[t],radiusScale:o,radiusMinPixels:n,radiusMaxPixels:s,lineWidthUnits:ee[f],lineWidthScale:d,lineWidthMinPixels:p,lineWidthMaxPixels:u},h=this.state.model;h.shaderInputs.setProps({scatterplot:g}),h.draw(this.context.renderPass)}_getModel(){return new De(this.context.device,s(r({},this.getShaders()),{id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new re$1({topology:`triangle-strip`,attributes:{positions:{size:3,value:new Float32Array([-1,-1,0,1,-1,0,-1,1,0,1,1,0])}}}),isInstanced:!0}))}};ve.defaultProps=Un;ve.layerName=`ScatterplotLayer`;var wt=ve;var oe={CLOCKWISE:1,COUNTER_CLOCKWISE:-1};function Y(i,e,t={}){return Di(i,t)!==e?(Vn(i,t),!0):!1}function Di(i,e={}){return Math.sign(ye(i,e))}var me={x:0,y:1,z:2};function ye(i,e={}){let{start:t=0,end:o=i.length,plane:n=`xy`}=e,s=e.size||2,r=0,a=me[n[0]],l=me[n[1]];for(let c=t,f=o-s;c<o;c+=s)r+=(i[c+a]-i[f+a])*(i[c+l]+i[f+l]),f=c;return r/2}function Vn(i,e){let{start:t=0,end:o=i.length,size:n=2}=e,s=(o-t)/n,r=Math.floor(s/2);for(let a=0;a<r;++a){let l=t+a*n,c=t+(s-1-a)*n;for(let f=0;f<n;++f){let d=i[l+f];i[l+f]=i[c+f],i[c+f]=d}}}function Zn(i,e,t=2,o,n=`xy`){let s=e&&e.length,r=s?e[0]*t:i.length,a=Ni(i,0,r,t,!0,o&&o[0],n),l=[];if(!a||a.next===a.prev)return l;let c,f,d,p,u,g,h;if(s&&(a=Xn(i,e,a,t,o,n)),i.length>80*t){p=f=i[0],u=d=i[1];for(let v=t;v<r;v+=t)g=i[v],h=i[v+1],g<p&&(p=g),h<u&&(u=h),g>f&&(f=g),h>d&&(d=h);c=Math.max(f-p,d-u),c=c!==0?32767/c:0}return Pe(a,l,t,p,u,c,0),l}function Ni(i,e,t,o,n,s,r){let a,l;s===void 0&&(s=ye(i,{start:e,end:t,size:o,plane:r}));let c=me[r[0]],f=me[r[1]];if(n===s<0)for(a=e;a<t;a+=o)l=Fi(a,i[a+c],i[a+f],l);else for(a=t-o;a>=e;a-=o)l=Fi(a,i[a+c],i[a+f],l);return l&&nt(l,l.next)&&(Ce(l),l=l.next),l}function J(i,e){if(!i)return i;e||(e=i);let t=i,o;do if(o=!1,!t.steiner&&(nt(t,t.next)||b(t.prev,t,t.next)===0)){if(Ce(t),t=e=t.prev,t===t.next)break;o=!0}else t=t.next;while(o||t!==e);return e}function Pe(i,e,t,o,n,s,r){if(!i)return;!r&&s&&is(i,o,n,s);let a=i,l,c;for(;i.prev!==i.next;){if(l=i.prev,c=i.next,s?$n(i,o,n,s):Kn(i)){e.push(l.i/t|0),e.push(i.i/t|0),e.push(c.i/t|0),Ce(i),i=c.next,a=c.next;continue}if(i=c,i===a){r?r===1?(i=Yn(J(i),e,t),Pe(i,e,t,o,n,s,2)):r===2&&Jn(i,e,t,o,n,s):Pe(J(i),e,t,o,n,s,1);break}}}function Kn(i){let e=i.prev,t=i,o=i.next;if(b(e,t,o)>=0)return!1;let n=e.x,s=t.x,r=o.x,a=e.y,l=t.y,c=o.y,f=n<s?n<r?n:r:s<r?s:r,d=a<l?a<c?a:c:l<c?l:c,p=n>s?n>r?n:r:s>r?s:r,u=a>l?a>c?a:c:l>c?l:c,g=o.next;for(;g!==e;){if(g.x>=f&&g.x<=p&&g.y>=d&&g.y<=u&&ne(n,a,s,l,r,c,g.x,g.y)&&b(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function $n(i,e,t,o){let n=i.prev,s=i,r=i.next;if(b(n,s,r)>=0)return!1;let a=n.x,l=s.x,c=r.x,f=n.y,d=s.y,p=r.y,u=a<l?a<c?a:c:l<c?l:c,g=f<d?f<p?f:p:d<p?d:p,h=a>l?a>c?a:c:l>c?l:c,v=f>d?f>p?f:p:d>p?d:p,P=It(u,g,e,t,o),C=It(h,v,e,t,o),m=i.prevZ,x=i.nextZ;for(;m&&m.z>=P&&x&&x.z<=C;){if(m.x>=u&&m.x<=h&&m.y>=g&&m.y<=v&&m!==n&&m!==r&&ne(a,f,l,d,c,p,m.x,m.y)&&b(m.prev,m,m.next)>=0||(m=m.prevZ,x.x>=u&&x.x<=h&&x.y>=g&&x.y<=v&&x!==n&&x!==r&&ne(a,f,l,d,c,p,x.x,x.y)&&b(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;m&&m.z>=P;){if(m.x>=u&&m.x<=h&&m.y>=g&&m.y<=v&&m!==n&&m!==r&&ne(a,f,l,d,c,p,m.x,m.y)&&b(m.prev,m,m.next)>=0)return!1;m=m.prevZ}for(;x&&x.z<=C;){if(x.x>=u&&x.x<=h&&x.y>=g&&x.y<=v&&x!==n&&x!==r&&ne(a,f,l,d,c,p,x.x,x.y)&&b(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function Yn(i,e,t){let o=i;do{let n=o.prev,s=o.next.next;!nt(n,s)&&Gi(n,o,o.next,s)&&_e(n,s)&&_e(s,n)&&(e.push(n.i/t|0),e.push(o.i/t|0),e.push(s.i/t|0),Ce(o),Ce(o.next),o=i=s),o=o.next}while(o!==i);return J(o)}function Jn(i,e,t,o,n,s){let r=i;do{let a=r.next.next;for(;a!==r.prev;){if(r.i!==a.i&&ss(r,a)){let l=ji(r,a);r=J(r,r.next),l=J(l,l.next),Pe(r,e,t,o,n,s,0),Pe(l,e,t,o,n,s,0);return}a=a.next}r=r.next}while(r!==i)}function Xn(i,e,t,o,n,s){let r=[],a,l,c,f,d;for(a=0,l=e.length;a<l;a++)c=e[a]*o,f=a<l-1?e[a+1]*o:i.length,d=Ni(i,c,f,o,!1,n&&n[a+1],s),d===d.next&&(d.steiner=!0),r.push(ns(d));for(r.sort(qn),a=0;a<r.length;a++)t=Qn(r[a],t);return t}function qn(i,e){return i.x-e.x}function Qn(i,e){let t=es(i,e);if(!t)return e;let o=ji(t,i);return J(o,o.next),J(t,t.next)}function es(i,e){let t=e,o=i.x,n=i.y,s=-1/0,r;do{if(n<=t.y&&n>=t.next.y&&t.next.y!==t.y){let p=t.x+(n-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(p<=o&&p>s&&(s=p,r=t.x<t.next.x?t:t.next,p===o))return r}t=t.next}while(t!==e);if(!r)return null;let a=r,l=r.x,c=r.y,f=1/0,d;t=r;do o>=t.x&&t.x>=l&&o!==t.x&&ne(n<c?o:s,n,l,c,n<c?s:o,n,t.x,t.y)&&(d=Math.abs(n-t.y)/(o-t.x),_e(t,i)&&(d<f||d===f&&(t.x>r.x||t.x===r.x&&ts(r,t)))&&(r=t,f=d)),t=t.next;while(t!==a);return r}function ts(i,e){return b(i.prev,i,e.prev)<0&&b(e.next,i,i.next)<0}function is(i,e,t,o){let n=i;do n.z===0&&(n.z=It(n.x,n.y,e,t,o)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==i);n.prevZ.nextZ=null,n.prevZ=null,os(n)}function os(i){let e,t,o=1,n,s,r,a,l,c;do{for(s=i,i=null,c=null,n=0;s;){for(n++,a=s,r=0,t=0;t<o&&(r++,a=a.nextZ,!!a);t++);for(l=o;r>0||l>0&&a;)r!==0&&(l===0||!a||s.z<=a.z)?(e=s,s=s.nextZ,r--):(e=a,a=a.nextZ,l--),c?c.nextZ=e:i=e,e.prevZ=c,c=e;s=a}c.nextZ=null,o*=2}while(n>1);return i}function It(i,e,t,o,n){return i=(i-t)*n|0,e=(e-o)*n|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function ns(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function ne(i,e,t,o,n,s,r,a){return(n-r)*(e-a)>=(i-r)*(s-a)&&(i-r)*(o-a)>=(t-r)*(e-a)&&(t-r)*(s-a)>=(n-r)*(o-a)}function ss(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!rs(i,e)&&(_e(i,e)&&_e(e,i)&&as(i,e)&&(b(i.prev,i,e.prev)||b(i,e.prev,e))||nt(i,e)&&b(i.prev,i,i.next)>0&&b(e.prev,e,e.next)>0)}function b(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function nt(i,e){return i.x===e.x&&i.y===e.y}function Gi(i,e,t,o){let n=ot(b(i,e,t)),s=ot(b(i,e,o)),r=ot(b(t,o,i)),a=ot(b(t,o,e));return!!(n!==s&&r!==a||n===0&&it(i,t,e)||s===0&&it(i,o,e)||r===0&&it(t,i,o)||a===0&&it(t,e,o))}function it(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function ot(i){return i>0?1:i<0?-1:0}function rs(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&Gi(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function _e(i,e){return b(i.prev,i,i.next)<0?b(i,e,i.next)>=0&&b(i,i.prev,e)>=0:b(i,e,i.prev)<0||b(i,i.next,e)<0}function as(i,e){let t=i,o=!1,n=(i.x+e.x)/2,s=(i.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&n<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(o=!o),t=t.next;while(t!==i);return o}function ji(i,e){let t=new Se(i.i,i.x,i.y),o=new Se(e.i,e.x,e.y),n=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=n,n.prev=t,o.next=t,t.prev=o,s.next=o,o.prev=s,o}function Fi(i,e,t,o){let n=new Se(i,e,t);return o?(n.next=o.next,n.prev=o,o.next.prev=n,o.next=n):(n.prev=n,n.next=n),n}function Ce(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}var Se=class{constructor(e,t,o){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=e,this.x=t,this.y=o}};function G(i,e){let t=e.length,o=i.length;if(o>0){let n=!0;for(let s=0;s<t;s++)if(i[o-t+s]!==e[s]){n=!1;break}if(n)return!1}for(let n=0;n<t;n++)i[o+n]=e[n];return!0}function Le(i,e){let t=e.length;for(let o=0;o<t;o++)i[o]=e[o]}function Z(i,e,t,o,n=[]){let s=o+e*t;for(let r=0;r<t;r++)n[r]=i[s+r];return n}function st(i,e,t,o,n=[]){let s,r;if(t&8)s=(o[3]-i[1])/(e[1]-i[1]),r=3;else if(t&4)s=(o[1]-i[1])/(e[1]-i[1]),r=1;else if(t&2)s=(o[2]-i[0])/(e[0]-i[0]),r=2;else if(t&1)s=(o[0]-i[0])/(e[0]-i[0]),r=0;else return null;for(let a=0;a<i.length;a++)n[a]=(r&1)===a?o[r]:s*(e[a]-i[a])+i[a];return n}function be(i,e){let t=0;return i[0]<e[0]?t|=1:i[0]>e[2]&&(t|=2),i[1]<e[1]?t|=4:i[1]>e[3]&&(t|=8),t}function we(i,e){let{size:t=2,broken:o=!1,gridResolution:n=10,gridOffset:s=[0,0],startIndex:r=0,endIndex:a=i.length}=e||{},l=(a-r)/t,c=[],f=[c],d=Z(i,0,t,r),p,u,g=Ui(d,n,s,[]),h=[];G(c,d);for(let v=1;v<l;v++){for(p=Z(i,v,t,r,p),u=be(p,g);u;){st(d,p,u,g,h);let P=be(h,g);P&&(st(d,h,P,g,h),u=P),G(c,h),Le(d,h),cs(g,n,u),o&&c.length>t&&(c=[],f.push(c),G(c,d)),u=be(p,g)}G(c,p),Le(d,p)}return o?f:f[0]}var Bi=0;var ls=1;function Ie(i,e=null,t){if(!i.length)return[];let{size:o=2,gridResolution:n=10,gridOffset:s=[0,0],edgeTypes:r=!1}=t||{},a=[],l=[{pos:i,types:r?new Array(i.length/o).fill(ls):null,holes:e||[]}],c=[[],[]],f=[];for(;l.length;){let{pos:d,types:p,holes:u}=l.shift();fs(d,o,u[0]||d.length,c),f=Ui(c[0],n,s,f);let g=be(c[1],f);if(g){let h=Wi(d,p,o,0,u[0]||d.length,f,g),v={pos:h[0].pos,types:h[0].types,holes:[]},P={pos:h[1].pos,types:h[1].types,holes:[]};l.push(v,P);for(let C=0;C<u.length;C++)h=Wi(d,p,o,u[C],u[C+1]||d.length,f,g),h[0]&&(v.holes.push(v.pos.length),v.pos=rt(v.pos,h[0].pos),r&&(v.types=rt(v.types,h[0].types))),h[1]&&(P.holes.push(P.pos.length),P.pos=rt(P.pos,h[1].pos),r&&(P.types=rt(P.types,h[1].types)))}else{let h={positions:d};r&&(h.edgeTypes=p),u.length&&(h.holeIndices=u),a.push(h)}}return a}function Wi(i,e,t,o,n,s,r){let a=(n-o)/t,l=[],c=[],f=[],d=[],p=[],u,g,h,v=Z(i,a-1,t,o),P=Math.sign(r&8?v[1]-s[3]:v[0]-s[2]),C=e&&e[a-1],m=0,x=0;for(let S=0;S<a;S++)u=Z(i,S,t,o,u),g=Math.sign(r&8?u[1]-s[3]:u[0]-s[2]),h=e&&e[o/t+S],g&&P&&P!==g&&(st(v,u,r,s,p),G(l,p)&&f.push(C),G(c,p)&&d.push(C)),g<=0?(G(l,u)&&f.push(h),m-=g):f.length&&(f[f.length-1]=Bi),g>=0?(G(c,u)&&d.push(h),x+=g):d.length&&(d[d.length-1]=Bi),Le(v,u),P=g,C=h;return[m?{pos:l,types:e&&f}:null,x?{pos:c,types:e&&d}:null]}function Ui(i,e,t,o){let n=Math.floor((i[0]-t[0])/e)*e+t[0],s=Math.floor((i[1]-t[1])/e)*e+t[1];return o[0]=n,o[1]=s,o[2]=n+e,o[3]=s+e,o}function cs(i,e,t){t&8?(i[1]+=e,i[3]+=e):t&4?(i[1]-=e,i[3]-=e):t&2?(i[0]+=e,i[2]+=e):t&1&&(i[0]-=e,i[2]-=e)}function fs(i,e,t,o){let n=1/0,s=-1/0,r=1/0,a=-1/0;for(let l=0;l<t;l+=e){let c=i[l],f=i[l+1];n=c<n?c:n,s=c>s?c:s,r=f<r?f:r,a=f>a?f:a}return o[0][0]=n,o[0][1]=r,o[1][0]=s,o[1][1]=a,o}function rt(i,e){for(let t=0;t<e.length;t++)i.push(e[t]);return i}var ds=85.051129;function At(i,e){let{size:t=2,startIndex:o=0,endIndex:n=i.length,normalize:s=!0}=e||{},r=i.slice(o,n);Vi(r,t,0,n-o);let a=we(r,{size:t,broken:!0,gridResolution:360,gridOffset:[-180,-180]});if(s)for(let l of a)Hi(l,t);return a}function Et(i,e=null,t){let{size:o=2,normalize:n=!0,edgeTypes:s=!1}=t||{};e=e||[];let r=[],a=[],l=0,c=0;for(let d=0;d<=e.length;d++){let p=e[d]||i.length,u=c,g=ps(i,o,l,p);for(let h=g;h<p;h++)r[c++]=i[h];for(let h=l;h<g;h++)r[c++]=i[h];Vi(r,o,u,c),us(r,o,u,c,t?.maxLatitude),l=p,a[d]=c}a.pop();let f=Ie(r,a,{size:o,gridResolution:360,gridOffset:[-180,-180],edgeTypes:s});if(n)for(let d of f)Hi(d.positions,o);return f}function ps(i,e,t,o){let n=-1,s=-1;for(let r=t+1;r<o;r+=e){let a=Math.abs(i[r]);a>n&&(n=a,s=r-1)}return s}function us(i,e,t,o,n=ds){let s=i[t],r=i[o-e];if(Math.abs(s-r)>180){let a=Z(i,0,e,t);a[0]+=Math.round((r-s)/360)*360,G(i,a),a[1]=Math.sign(a[1])*n,G(i,a),a[0]=s,G(i,a)}}function Vi(i,e,t,o){let n=i[0],s;for(let r=t;r<o;r+=e){s=i[r];let a=s-n;(a>180||a<-180)&&(s-=Math.round(a/360)*360),i[r]=n=s}}function Hi(i,e){let t,o=i.length/e;for(let s=0;s<o&&(t=i[s*e],(t+180)%360===0);s++);let n=-Math.round(t/360)*360;if(n!==0)for(let s=0;s<o;s++)i[s*e]+=n}var Ae=class extends re$1{constructor(e){let{indices:t,attributes:o}=hs(e);super(s(r({},e),{topology:`line-list`,indices:t,attributes:o}))}};function hs(i){let{radius:e,height:t=1,nradial:o=10}=i,{vertices:n}=i;n&&(S.assert(n.length>=o),n=n.flatMap(u=>[u[0],u[1]]),Y(n,oe.COUNTER_CLOCKWISE));let s=t>0,r=o+1,a=s?r*3+1:o,l=Math.PI*2/o,c=new Uint16Array(s?o*3*2:0),f=new Float32Array(a*3),d=new Float32Array(a*3),p=0;if(s){for(let u=0;u<r;u++){let g=u*l,h=u%o,v=Math.sin(g),P=Math.cos(g);for(let C=0;C<2;C++)f[p+0]=n?n[h*2]:P*e,f[p+1]=n?n[h*2+1]:v*e,f[p+2]=(1/2-C)*t,d[p+0]=n?n[h*2]:P,d[p+1]=n?n[h*2+1]:v,p+=3}f[p+0]=f[p-3],f[p+1]=f[p-2],f[p+2]=f[p-1],p+=3}for(let u=s?0:1;u<r;u++){let g=Math.floor(u/2)*Math.sign(.5-u%2),h=g*l,v=(g+o)%o,P=Math.sin(h),C=Math.cos(h);f[p+0]=n?n[v*2]:C*e,f[p+1]=n?n[v*2+1]:P*e,f[p+2]=t/2,d[p+2]=1,p+=3}if(s){let u=0;for(let g=0;g<o;g++)c[u++]=g*2+0,c[u++]=g*2+2,c[u++]=g*2+0,c[u++]=g*2+1,c[u++]=g*2+1,c[u++]=g*2+3}return{indices:c,attributes:{POSITION:{size:3,value:f},NORMAL:{size:3,value:d}}}}var xs=`struct ColumnUniforms {
|
|
1984
1984
|
radius: f32,
|
|
1985
1985
|
angle: f32,
|
|
1986
1986
|
offset: vec2<f32>,
|
|
@@ -1998,7 +1998,7 @@ fn clip_filterColor(geometryCoordinates: vec2<f32>) {
|
|
|
1998
1998
|
};
|
|
1999
1999
|
|
|
2000
2000
|
@group(0) @binding(auto) var<uniform> column: ColumnUniforms;
|
|
2001
|
-
`;var
|
|
2001
|
+
`;var Zi=`layout(std140) uniform columnUniforms {
|
|
2002
2002
|
float radius;
|
|
2003
2003
|
float angle;
|
|
2004
2004
|
vec2 offset;
|
|
@@ -2014,7 +2014,7 @@ fn clip_filterColor(geometryCoordinates: vec2<f32>) {
|
|
|
2014
2014
|
highp int radiusUnits;
|
|
2015
2015
|
highp int widthUnits;
|
|
2016
2016
|
} column;
|
|
2017
|
-
`;var
|
|
2017
|
+
`;var Ki={name:`column`,source:xs,vs:Zi,fs:Zi,uniformTypes:{radius:`f32`,angle:`f32`,offset:`vec2<f32>`,extruded:`f32`,stroked:`f32`,isStroke:`f32`,coverage:`f32`,elevationScale:`f32`,edgeDistance:`f32`,widthScale:`f32`,widthMinPixels:`f32`,widthMaxPixels:`f32`,radiusUnits:`i32`,widthUnits:`i32`}};var $i=`struct Attributes {
|
|
2018
2018
|
@builtin(instance_index) instanceIndex: u32,
|
|
2019
2019
|
@location(0) positions: vec3<f32>,
|
|
2020
2020
|
@location(1) normals: vec3<f32>,
|
|
@@ -2049,7 +2049,7 @@ fn getOffset(
|
|
|
2049
2049
|
}
|
|
2050
2050
|
return vec3<f32>(offset, 0.0);
|
|
2051
2051
|
}
|
|
2052
|
-
`;var
|
|
2052
|
+
`;var vs=`${$i}
|
|
2053
2053
|
|
|
2054
2054
|
struct Varyings {
|
|
2055
2055
|
@builtin(position) position: vec4<f32>,
|
|
@@ -2127,7 +2127,7 @@ fn fragmentMain(varyings: Varyings) -> @location(0) vec4<f32> {
|
|
|
2127
2127
|
geometry.uv = vec2<f32>(0.0);
|
|
2128
2128
|
return deckgl_premultiplied_alpha(varyings.color);
|
|
2129
2129
|
}
|
|
2130
|
-
`;var
|
|
2130
|
+
`;var ms=`${$i}
|
|
2131
2131
|
|
|
2132
2132
|
struct Varyings {
|
|
2133
2133
|
@builtin(position) position: vec4<f32>,
|
|
@@ -2215,7 +2215,7 @@ fn fragmentMain(varyings: Varyings) -> @location(0) vec4<f32> {
|
|
|
2215
2215
|
|
|
2216
2216
|
return deckgl_premultiplied_alpha(fragColor);
|
|
2217
2217
|
}
|
|
2218
|
-
`;function
|
|
2218
|
+
`;function Yi(i){return i?ms:vs}var Ji=`#version 300 es
|
|
2219
2219
|
#define SHADER_NAME column-layer-vertex-shader
|
|
2220
2220
|
in vec3 positions;
|
|
2221
2221
|
in vec3 normals;
|
|
@@ -2279,7 +2279,7 @@ vColor = vec4(color.rgb, color.a * layer.opacity);
|
|
|
2279
2279
|
}
|
|
2280
2280
|
DECKGL_FILTER_COLOR(vColor, geometry);
|
|
2281
2281
|
}
|
|
2282
|
-
`;var
|
|
2282
|
+
`;var Xi=`#version 300 es
|
|
2283
2283
|
#define SHADER_NAME column-layer-fragment-shader
|
|
2284
2284
|
precision highp float;
|
|
2285
2285
|
out vec4 fragColor;
|
|
@@ -2299,7 +2299,7 @@ fragColor.rgb = lighting_getLightColor(vColor.rgb, cameraPosition, position_comm
|
|
|
2299
2299
|
#endif
|
|
2300
2300
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
2301
2301
|
}
|
|
2302
|
-
`;var
|
|
2302
|
+
`;var at=[0,0,0,255];var ys={name:`geometry`,stepMode:`vertex`,byteStride:24,attributes:[{attribute:`positions`,format:`float32x3`,byteOffset:0},{attribute:`normals`,format:`float32x3`,byteOffset:12}]};var Ps={diskResolution:{type:`number`,min:4,value:20},vertices:null,radius:{type:`number`,min:0,value:1e3},angle:{type:`number`,value:0},offset:{type:`array`,value:[0,0]},coverage:{type:`number`,min:0,max:1,value:1},elevationScale:{type:`number`,min:0,value:1},radiusUnits:`meters`,lineWidthUnits:`meters`,lineWidthScale:1,lineWidthMinPixels:0,lineWidthMaxPixels:Number.MAX_SAFE_INTEGER,extruded:!0,wireframe:!1,filled:!0,stroked:!1,flatShading:!1,getPosition:{type:`accessor`,value:i=>i.position},getFillColor:{type:`accessor`,value:at},getLineColor:{type:`accessor`,value:at},getLineWidth:{type:`accessor`,value:1},getElevation:{type:`accessor`,value:1e3},material:!0,getColor:{deprecatedFor:[`getFillColor`,`getLineColor`]}};var Ee=class extends ao{getShaders(){let e={},{flatShading:t}=this.props;return t&&(e.FLAT_SHADING=1),super.getShaders({vs:Ji,fs:Xi,source:Yi(t),defines:e,modules:[Wa,ma,t?Ko$1:Zo$1,Ka,Ki]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:`float64`,fp64:this.use64bitPositions(),transition:!0,accessor:`getPosition`},instanceElevations:{size:1,transition:!0,accessor:`getElevation`},instanceFillColors:{size:this.props.colorFormat.length,type:`unorm8`,transition:!0,accessor:`getFillColor`,defaultValue:at},instanceLineColors:{size:this.props.colorFormat.length,type:`unorm8`,transition:!0,accessor:`getLineColor`,defaultValue:at},instanceStrokeWidths:{size:1,accessor:`getLineWidth`,transition:!0}})}updateState(e){super.updateState(e);let{props:t,oldProps:o,changeFlags:n}=e,s=n.extensionsChanged||t.flatShading!==o.flatShading;s&&(this.state.models?.forEach(a=>a.destroy()),this.setState(this._getModels()),this.getAttributeManager().invalidateAll());let r=this.getNumInstances();this.state.fillModel.setInstanceCount(r),this.state.strokeModel.setInstanceCount(r),this.state.wireframeModel.setInstanceCount(r),(s||t.diskResolution!==o.diskResolution||t.vertices!==o.vertices||t.extruded!==o.extruded||t.stroked!==o.stroked)&&this._updateGeometry(t)}getGeometry(e,t,o){let n=new Ae({radius:1,height:o?2:0,vertices:t,nradial:e}),s=0;if(t)for(let r=0;r<e;r++){let a=t[r],l=Math.sqrt(a[0]*a[0]+a[1]*a[1]);s+=l/e}else s=1;return this.setState({edgeDistance:Math.cos(Math.PI/e)*s}),n}_getModels(){let e=this.getShaders(),t=[...this.getAttributeManager().getBufferLayouts(),ys],o=new De(this.context.device,s(r({},e),{id:`${this.props.id}-fill`,bufferLayout:t,isInstanced:!0})),n=new De(this.context.device,s(r({},e),{id:`${this.props.id}-stroke`,bufferLayout:t,isInstanced:!0})),s$4=new De(this.context.device,s(r({},e),{id:`${this.props.id}-wireframe`,bufferLayout:t,isInstanced:!0}));return{fillModel:o,strokeModel:n,wireframeModel:s$4,models:[s$4,o,n]}}_updateGeometry({diskResolution:e,vertices:t,extruded:o,stroked:n}){let s=this.getGeometry(e,t,o||n),r=s.attributes.POSITION,a=s.attributes.NORMAL;if(this._setFillGeometry(new re$1({topology:`triangle-strip`,attributes:{POSITION:r,NORMAL:a}})),!o&&n){let l=r.value.length/3;this._setStrokeGeometry(new re$1({topology:`triangle-strip`,vertexCount:l-e-1,attributes:{POSITION:r,NORMAL:a}}))}o&&this._setWireframeGeometry(s)}_setFillGeometry(e){let t=pt$1(e,{attributes:[`POSITION`,`NORMAL`]});this.state.fillModel.setGeometry(t)}_setStrokeGeometry(e){let t=pt$1(e,{attributes:[`POSITION`,`NORMAL`]});this.state.strokeModel.setGeometry(t)}_setWireframeGeometry(e){let t=pt$1(e,{attributes:[`POSITION`,`NORMAL`]}),o=this.state.wireframeModel;o.setGeometry(t),o.setTopology(`line-list`)}draw({uniforms:e}){let{lineWidthUnits:t,lineWidthScale:o,lineWidthMinPixels:n,lineWidthMaxPixels:s$5,radiusUnits:r$5,elevationScale:a,extruded:l,filled:c,stroked:f,wireframe:d,offset:p,coverage:u,radius:g,angle:h}=this.props,v=this.state.fillModel,P=this.state.strokeModel,C=this.state.wireframeModel,{edgeDistance:m}=this.state,x={radius:g,angle:h/180*Math.PI,offset:p,extruded:l,stroked:f,coverage:u,elevationScale:a,edgeDistance:m,radiusUnits:ee[r$5],widthUnits:ee[t],widthScale:o,widthMinPixels:n,widthMaxPixels:s$5};l&&d&&(C.shaderInputs.setProps({column:s(r({},x),{isStroke:!0})}),C.draw(this.context.renderPass)),c&&(v.shaderInputs.setProps({column:s(r({},x),{isStroke:!1})}),v.draw(this.context.renderPass)),!l&&f&&(P.shaderInputs.setProps({column:s(r({},x),{isStroke:!0})}),P.draw(this.context.renderPass))}};Ee.layerName=`ColumnLayer`;Ee.defaultProps=Ps;var Tt=Ee;var _s={cellSize:{type:`number`,min:0,value:1e3},offset:{type:`array`,value:[1,1]}};var Te=class extends Tt{_updateGeometry(){let e=new qr;this._setFillGeometry(e)}draw({uniforms:e}){let{elevationScale:t,extruded:o,offset:n,coverage:s,cellSize:r,angle:a,radiusUnits:l}=this.props,c=this.state.fillModel,f={radius:r/2,radiusUnits:ee[l],angle:a,offset:n,extruded:o,stroked:!1,coverage:s,elevationScale:t,edgeDistance:1,isStroke:!1,widthUnits:0,widthScale:0,widthMinPixels:0,widthMaxPixels:0};c.shaderInputs.setProps({column:f}),c.draw(this.context.renderPass)}};Te.layerName=`GridCellLayer`;Te.defaultProps=_s;var Cs=Te;function qi(i,e,t,o){let n;if(Array.isArray(i[0])){let s=i.length*e;n=new Array(s);for(let r=0;r<i.length;r++)for(let a=0;a<e;a++)n[r*e+a]=i[r][a]||0}else n=i;return t?we(n,{size:e,gridResolution:t}):o?At(n,{size:e}):n}var Ss=1;var Ls=2;var Oe=4;var Re=class extends xs$1{constructor(e){super(s(r({},e),{attributes:{positions:{size:3,padding:18,initialize:!0,type:e.fp64?Float64Array:Float32Array},segmentTypes:{size:1,type:e.isWebGPU?Float32Array:Uint8ClampedArray}}}))}get(e){return this.attributes[e]}getPathSegmentIndices(e){let t=this.attributes.segmentTypes,o=this.vertexStarts[e],n=Math.min(this.vertexStarts[e+1]??this.instanceCount,this.instanceCount),s=[];for(let r=o;r<n-1;r++)(t[r]&Oe)===0&&s.push(r);return s.length&&(t[o]&Oe)!==0&&s.unshift(s.pop()),s}getGeometryFromBuffer(e){return this.normalize||this.opts.isWebGPU?super.getGeometryFromBuffer(e):null}normalizeGeometry(e){return this.normalize?qi(e,this.positionSize,this.opts.resolution,this.opts.wrapLongitude):e}getGeometrySize(e){if(Qi(e)){let o=0;for(let n of e)o+=this.getGeometrySize(n);return o}let t=this.getPathLength(e);return t<2?0:this.isClosed(e)?t<3?0:t+2:t}updateGeometryAttributes(e,t){if(t.geometrySize!==0)if(e&&Qi(e))for(let o of e){let n=this.getGeometrySize(o);t.geometrySize=n,this.updateGeometryAttributes(o,t),t.vertexStart+=n}else this._updateSegmentTypes(e,t),this._updatePositions(e,t)}_updateSegmentTypes(e,t){let o=this.attributes.segmentTypes,n=e?this.isClosed(e):!1,{vertexStart:s,geometrySize:r}=t;o.fill(0,s,s+r),n?(o[s]=Oe,o[s+r-2]=Oe):(o[s]+=Ss,o[s+r-2]+=Ls),o[s+r-1]=Oe}_updatePositions(e,t){let{positions:o}=this.attributes;if(!o||!e)return;let{vertexStart:n,geometrySize:s}=t,r=new Array(3);for(let a=n,l=0;l<s;a++,l++)this.getPointOnPath(e,l,r),o[a*3]=r[0],o[a*3+1]=r[1],o[a*3+2]=r[2]}getPathLength(e){return e.length/this.positionSize}getPointOnPath(e,t,o=[]){let{positionSize:n}=this;t*n>=e.length&&(t+=1-e.length/n);let s=t*n;return o[0]=e[s],o[1]=e[s+1],o[2]=n===3&&e[s+2]||0,o}isClosed(e){if(!this.normalize)return!!this.opts.loop;let{positionSize:t}=this,o=e.length-t;return e[0]===e[o]&&e[1]===e[o+1]&&(t===2||e[2]===e[o+2])}};function Qi(i){return Array.isArray(i[0])}var bs=`struct PathUniforms {
|
|
2303
2303
|
widthScale: f32,
|
|
2304
2304
|
widthMinPixels: f32,
|
|
2305
2305
|
widthMaxPixels: f32,
|
|
@@ -2312,7 +2312,7 @@ DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
|
2312
2312
|
|
|
2313
2313
|
@group(0) @binding(auto)
|
|
2314
2314
|
var<uniform> path: PathUniforms;
|
|
2315
|
-
`;var
|
|
2315
|
+
`;var eo=`layout(std140) uniform pathUniforms {
|
|
2316
2316
|
float widthScale;
|
|
2317
2317
|
float widthMinPixels;
|
|
2318
2318
|
float widthMaxPixels;
|
|
@@ -2322,7 +2322,7 @@ var<uniform> path: PathUniforms;
|
|
|
2322
2322
|
bool billboard;
|
|
2323
2323
|
highp int widthUnits;
|
|
2324
2324
|
} path;
|
|
2325
|
-
`;var
|
|
2325
|
+
`;var to={name:`path`,source:bs,vs:eo,fs:eo,uniformTypes:{widthScale:`f32`,widthMinPixels:`f32`,widthMaxPixels:`f32`,jointType:`f32`,capType:`f32`,miterLimit:`f32`,billboard:`f32`,widthUnits:`i32`}};var io=`const EPSILON: f32 = 0.001;
|
|
2326
2326
|
const ZERO_OFFSET: vec3<f32> = vec3<f32>(0.0, 0.0, 0.0);
|
|
2327
2327
|
|
|
2328
2328
|
struct JoinResult {
|
|
@@ -2813,7 +2813,7 @@ fn fragmentMain(varyings: Varyings) -> @location(0) vec4<f32> {
|
|
|
2813
2813
|
return deckgl_premultiplied_alpha(varyings.vColor);
|
|
2814
2814
|
#endif
|
|
2815
2815
|
}
|
|
2816
|
-
`;var
|
|
2816
|
+
`;var oo=`#version 300 es
|
|
2817
2817
|
#define SHADER_NAME path-layer-vertex-shader
|
|
2818
2818
|
in vec2 positions;
|
|
2819
2819
|
in float instanceTypes;
|
|
@@ -3096,7 +3096,7 @@ DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
|
|
|
3096
3096
|
}
|
|
3097
3097
|
DECKGL_FILTER_COLOR(vColor, geometry);
|
|
3098
3098
|
}
|
|
3099
|
-
`;var
|
|
3099
|
+
`;var no=`#version 300 es
|
|
3100
3100
|
#define SHADER_NAME path-layer-fragment-shader
|
|
3101
3101
|
precision highp float;
|
|
3102
3102
|
in vec4 vColor;
|
|
@@ -3154,19 +3154,19 @@ fragColor = vColor;
|
|
|
3154
3154
|
#endif
|
|
3155
3155
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
3156
3156
|
}
|
|
3157
|
-
`;var Zi=[0,0,0,255];var Ps={widthUnits:`meters`,widthScale:{type:`number`,min:0,value:1},widthMinPixels:{type:`number`,min:0,value:0},widthMaxPixels:{type:`number`,min:0,value:Number.MAX_SAFE_INTEGER},jointRounded:!1,capRounded:!1,miterLimit:{type:`number`,min:0,value:4},antialiasing:!1,billboard:!1,_pathType:null,getPath:{type:`accessor`,value:t=>t.path},getColor:{type:`accessor`,value:Zi},getWidth:{type:`accessor`,value:1},rounded:{deprecatedFor:[`jointRounded`,`capRounded`]}};var vt={enter:(t,o)=>o.length?o.subarray(o.length-t.length):t};function _s(t){if(t.isGeospatial)return null;let{unitsPerMeter:o}=t.distanceScales;return[o[0],o[1],o[2]]}function Hi(t,o){return t===o||!!(t&&o&&t.length===o.length&&t.every((e,i)=>e===o[i]))}var _e=(()=>{class t extends en$1{getShaders(){let{antialiasing:e}=this.props;return super.getShaders({vs:Ui,fs:Vi,source:Wi,defines:e?{ANTIALIASING:1}:{},modules:[Wa,ma,Ka,ji,...this.context.device.type===`webgpu`?[ie]:[]]})}get wrapLongitude(){return!1}getBounds(){return this.context.device.type===`webgpu`?null:this.getAttributeManager()?.getBounds([`vertexPositions`])}getPathProjectionScale(e){let i=this.props.coordinateSystem;if(!!!this.getAttributeManager()?.getAttributes().instanceDashOffsets)return null;if(e instanceof se&&e.zoom>=12&&(i==="default"||i===`lnglat`||i===`cartesian`)){let a=oe$1.getUniforms({viewport:e,coordinateSystem:i,coordinateOrigin:this.props.coordinateOrigin,autoWrapLongitude:this.wrapLongitude});return[e.projectionMode,a.coordinateOrigin[1],a.commonOrigin[1],...a.commonUnitsPerWorldUnit,...a.commonUnitsPerWorldUnit2,a.commonUnitsPerMeter[2]]}let r=_s(e);return r?[e.projectionMode,...r]:[e.projectionMode]}shouldUpdateState(e){let{viewport:i}=this.context;return super.shouldUpdateState(e)||this.state?.tessellationResolution!==i.resolution||!Hi(this.state?.pathProjectionScale,this.getPathProjectionScale(i))}initializeState(){let i=this.context.device.type===`webgpu`;this.getAttributeManager().addInstanced(s(r({},i?{pathPositions:{size:24,type:`float32`,transition:!1,accessor:`getPath`,update:this.calculateWebGPUPositions,shaderAttributes:{instanceLeftPositions:{size:3,elementOffset:0},instanceStartPositions:{size:3,elementOffset:3},instanceEndPositions:{size:3,elementOffset:6},instanceRightPositions:{size:3,elementOffset:9},instanceLeftPositions64Low:{size:3,elementOffset:12},instanceStartPositions64Low:{size:3,elementOffset:15},instanceEndPositions64Low:{size:3,elementOffset:18},instanceRightPositions64Low:{size:3,elementOffset:21}},noAlloc:!0}}:{vertexPositions:{size:3,vertexOffset:1,type:`float64`,fp64:this.use64bitPositions(),transition:vt,accessor:`getPath`,update:this.calculatePositions,noAlloc:!0,shaderAttributes:{instanceLeftPositions:{vertexOffset:0},instanceStartPositions:{vertexOffset:1},instanceEndPositions:{vertexOffset:2},instanceRightPositions:{vertexOffset:3}}}}),{instanceTypes:{size:1,type:i?`float32`:`uint8`,update:this.calculateSegmentTypes,noAlloc:!0},instanceStrokeWidths:{size:1,accessor:`getWidth`,transition:i?!1:vt,defaultValue:1,bufferGroup:`path-instance-data`},instanceColors:{size:this.props.colorFormat.length,type:`unorm8`,accessor:`getColor`,transition:i?!1:vt,defaultValue:Zi,bufferGroup:`path-instance-data`},rowIndexes:{size:1,type:`uint32`,accessor:(s,{index:r})=>s&&s.__source?s.__source.index:r,bufferGroup:`path-instance-data`}})),this.setState({pathTesselator:new Ue({fp64:this.use64bitPositions(),isWebGPU:i}),tessellationResolution:this.context.viewport.resolution,pathProjectionScale:this.getPathProjectionScale(this.context.viewport)})}updateState(e){super.updateState(e);let{props:i,oldProps:n,changeFlags:s}=e,r=this.getAttributeManager(),{viewport:a}=this.context,l=this.state.tessellationResolution!==a.resolution,c=this.getPathProjectionScale(a),f=!Hi(this.state.pathProjectionScale,c),u=s.updateTriggersChanged&&(s.updateTriggersChanged.all||s.updateTriggersChanged.getPath)||i._pathType!==n._pathType||i.positionFormat!==n.positionFormat||i.wrapLongitude!==n.wrapLongitude||l;if(s.dataChanged||u){let{pathTesselator:g}=this.state,h=i.data.attributes||{};g.updateGeometry({data:i.data,geometryBuffer:h.getPath,buffers:h,normalize:!i._pathType,loop:i._pathType===`loop`,getGeometry:i.getPath,positionFormat:i.positionFormat,wrapLongitude:i.wrapLongitude,resolution:a.resolution,dataChanged:u?void 0:s.dataChanged}),this.setState({numInstances:g.instanceCount,startIndices:g.vertexStarts,tessellationResolution:a.resolution,pathProjectionScale:c}),!s.dataChanged||u?r.invalidateAll():f&&r.invalidate(`instanceDashOffsets`)}else f&&(this.setState({pathProjectionScale:c}),r.invalidate(`instanceDashOffsets`));(s.extensionsChanged||i.antialiasing!==n.antialiasing)&&(this.state.model?.destroy(),this.state.model=this._getModel(),r.invalidateAll())}getPickingInfo(e){let i=super.getPickingInfo(e),{index:n}=i,s=this.props.data;return s[0]&&s[0].__source&&(i.object=s.find(r=>r.__source.index===n)),i}disablePickingIndex(e){let i=this.props.data;if(i[0]&&i[0].__source)for(let n=0;n<i.length;n++)i[n].__source.index===e&&this._disablePickingIndex(n);else super.disablePickingIndex(e)}draw({uniforms:e}){let{jointRounded:i,capRounded:n,billboard:s,miterLimit:r,widthUnits:a,widthScale:l,widthMinPixels:c,widthMaxPixels:f}=this.props,d=this.state.model,u={jointType:Number(i),capType:Number(n),billboard:s,widthUnits:ee[a],widthScale:l,miterLimit:r,widthMinPixels:c,widthMaxPixels:f};d.shaderInputs.setProps({path:u}),d.draw(this.context.renderPass)}_getModel(){return new De$1(this.context.device,s(r({},this.getShaders()),{id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new ne$1({topology:`triangle-list`,attributes:{indices:new Uint16Array([0,1,2,1,4,2,1,3,4,3,5,4]),positions:{value:new Float32Array([0,0,0,-1,0,1,1,-1,1,1,1,0]),size:2}}}),isInstanced:!0}))}calculatePositions(e){let{pathTesselator:i}=this.state;e.startIndices=i.vertexStarts,e.value=i.get(`positions`)}calculateSegmentTypes(e){let{pathTesselator:i}=this.state;e.startIndices=i.vertexStarts,e.value=i.get(`segmentTypes`)}calculateWebGPUPositions(e){let{pathTesselator:i}=this.state,n=i.get(`positions`);if(!n){e.value=null;return}let s=i.instanceCount,r=new Float32Array(s*24),a=[-1,0,1,2];for(let l=0;l<s;l++){let c=l*24;for(let f=0;f<4;f++){let d=l+a[f],u=c+f*3;for(let p=0;p<3;p++){let g=d>=0&&d<s?n[d*3+p]:0,h=Math.fround(g);r[u+p]=h,r[u+p+12]=g-h}}}e.startIndices=i.vertexStarts,e.value=r}}return t.defaultProps=Ps,t.layerName=`PathLayer`,t})();var io=x(Xi(),1);var $e=oe.CLOCKWISE;var qi=oe.COUNTER_CLOCKWISE;var $={isClosed:!0};function Ns(t){if(t=t&&t.positions||t,!Array.isArray(t)&&!ArrayBuffer.isView(t))throw new Error(`invalid polygon`)}function re(t){return`positions`in t?t.positions:t}function be(t){return`holeIndices`in t?t.holeIndices:null}function Gs(t){return Array.isArray(t[0])}function Bs(t){return t.length>=1&&t[0].length>=2&&Number.isFinite(t[0][0])}function js(t){let o=t[0],e=t[t.length-1];return o[0]===e[0]&&o[1]===e[1]&&o[2]===e[2]}function Ws(t,o,e,i){for(let n=0;n<o;n++)if(t[e+n]!==t[i-o+n])return!1;return!0}function Qi(t,o,e,i,n){let s=o,r=e.length;for(let a=0;a<r;a++)for(let l=0;l<i;l++)t[s++]=e[a][l]||0;if(!js(e))for(let a=0;a<i;a++)t[s++]=e[0][a]||0;return $.start=o,$.end=s,$.size=i,J(t,n,$),s}function eo(t,o,e,i,n=0,s,r){s=s||e.length;let a=s-n;if(a<=0)return o;let l=o;for(let c=0;c<a;c++)t[l++]=e[n+c];if(!Ws(e,i,n,s))for(let c=0;c<i;c++)t[l++]=e[n+c];return $.start=o,$.end=l,$.size=i,J(t,r,$),l}function Je(t,o){Ns(t);let e=[],i=[];if(`positions`in t){let{positions:n,holeIndices:s}=t;if(s){let r=0;for(let a=0;a<=s.length;a++)r=eo(e,r,n,o,s[a-1],s[a],a===0?$e:qi),i.push(r);return i.pop(),{positions:e,holeIndices:i}}t=n}if(!Gs(t))return eo(e,0,t,o,0,e.length,$e),e;if(!Bs(t)){let n=0;for(let[s,r]of t.entries())n=Qi(e,n,r,o,s===0?$e:qi),i.push(n);return i.pop(),{positions:e,holeIndices:i}}return Qi(e,0,t,o,$e),e}function Ct(t,o,e){let i=t.length/3,n=0;for(let s=0;s<i;s++){let r=(s+1)%i;n+=t[s*3+o]*t[r*3+e],n-=t[r*3+o]*t[s*3+e]}return Math.abs(n/2)}function to(t,o,e,i){let n=t.length/3;for(let s=0;s<n;s++){let r=s*3,a=t[r+0],l=t[r+1],c=t[r+2];t[r+o]=a,t[r+e]=l,t[r+i]=c}}function oo(t,o,e,i){let n=be(t);n&&(n=n.map(a=>a/o));let s=re(t),r=i&&o===3;if(e){let a=s.length;s=s.slice();let l=[];for(let c=0;c<a;c+=o){l[0]=s[c],l[1]=s[c+1],r&&(l[2]=s[c+2]);let f=e(l);s[c]=f[0],s[c+1]=f[1],r&&(s[c+2]=f[2])}}if(r){let a=Ct(s,0,1),l=Ct(s,0,2),c=Ct(s,1,2);if(!a&&!l&&!c)return[];a>l&&a>c||(l>c?(e||(s=s.slice()),to(s,0,2,1)):(e||(s=s.slice()),to(s,2,0,1)))}return(0,io.default)(s,n,o)}var Ye=class extends an{constructor(o){let{fp64:e,IndexType:i=Uint32Array}=o;super(s(r({},o),{attributes:{positions:{size:3,type:e?Float64Array:Float32Array},vertexValid:{type:Uint16Array,size:1},indices:{type:i,size:1}}}))}get(o){let{attributes:e}=this;return o===`indices`?e.indices&&e.indices.subarray(0,this.vertexCount):e[o]}updateGeometry(o){super.updateGeometry(o);let e=this.buffers.indices;if(e)this.vertexCount=(e.value||e).length;else if(this.data&&!this.getGeometry)throw new Error(`missing indices buffer`)}normalizeGeometry(o){if(this.normalize){let e=Je(o,this.positionSize);return this.opts.resolution?ye(re(e),be(e),{size:this.positionSize,gridResolution:this.opts.resolution,edgeTypes:!0}):this.opts.wrapLongitude?ht(re(e),be(e),{size:this.positionSize,maxLatitude:86,edgeTypes:!0}):e}return o}getGeometrySize(o){if(so(o)){let e=0;for(let i of o)e+=this.getGeometrySize(i);return e}return re(o).length/this.positionSize}getGeometryFromBuffer(o){return this.normalize||!this.buffers.indices?super.getGeometryFromBuffer(o):null}updateGeometryAttributes(o,e){if(o&&so(o))for(let i of o){let n=this.getGeometrySize(i);e.geometrySize=n,this.updateGeometryAttributes(i,e),e.vertexStart+=n,e.indexStart=this.indexStarts[e.geometryIndex+1]}else{let i=o;this._updateIndices(i,e),this._updatePositions(i,e),this._updateVertexValid(i,e)}}_updateIndices(o,{geometryIndex:e,vertexStart:i,indexStart:n}){let{attributes:s,indexStarts:r,typedArrayManager:a}=this,l=s.indices;if(!l||!o)return;let c=n,f=oo(o,this.positionSize,this.opts.preproject,this.opts.full3d);l=a.allocate(l,n+f.length,{copy:!0});for(let d=0;d<f.length;d++)l[c++]=f[d]+i;r[e+1]=n+f.length,s.indices=l}_updatePositions(o,{vertexStart:e,geometrySize:i}){let{attributes:{positions:n},positionSize:s}=this;if(!n||!o)return;let r=re(o);for(let a=e,l=0;l<i;a++,l++){let c=r[l*s],f=r[l*s+1],d=s>2?r[l*s+2]:0;n[a*3]=c,n[a*3+1]=f,n[a*3+2]=d}}_updateVertexValid(o,{vertexStart:e,geometrySize:i}){let{positionSize:n}=this,s=this.attributes.vertexValid,r=o&&be(o);if(o&&o.edgeTypes?s.set(o.edgeTypes,e):s.fill(1,e,e+i),r)for(let a=0;a<r.length;a++)s[e+r[a]/n-1]=0;s[e+i-1]=0}};function so(t){return Array.isArray(t)&&t.length>0&&!Number.isFinite(t[0])}var Us=`struct SolidPolygonUniforms {
|
|
3157
|
+
`;var ro=[0,0,0,255];var ws={widthUnits:`meters`,widthScale:{type:`number`,min:0,value:1},widthMinPixels:{type:`number`,min:0,value:0},widthMaxPixels:{type:`number`,min:0,value:Number.MAX_SAFE_INTEGER},jointRounded:!1,capRounded:!1,miterLimit:{type:`number`,min:0,value:4},antialiasing:!1,billboard:!1,_pathType:null,getPath:{type:`accessor`,value:i=>i.path},getColor:{type:`accessor`,value:ro},getWidth:{type:`accessor`,value:1},rounded:{deprecatedFor:[`jointRounded`,`capRounded`]}};var Ot={enter:(i,e)=>e.length?e.subarray(e.length-i.length):i};function Is(i){if(i.isGeospatial)return null;let{unitsPerMeter:e}=i.distanceScales;return[e[0],e[1],e[2]]}function so(i,e){return i===e||!!(i&&e&&i.length===e.length&&i.every((t,o)=>t===e[o]))}var Me=class extends ao{getShaders(){let{antialiasing:e}=this.props;return super.getShaders({vs:oo,fs:no,source:io,defines:e?{ANTIALIASING:1}:{},modules:[Wa,ma,Ka,to,...this.context.device.type===`webgpu`?[ie]:[]]})}get wrapLongitude(){return!1}getBounds(){return this.context.device.type===`webgpu`?null:this.getAttributeManager()?.getBounds([`vertexPositions`])}getPathProjectionScale(e){let t=this.props.coordinateSystem;if(!!!this.getAttributeManager()?.getAttributes().instanceDashOffsets)return null;if(e instanceof ne$1&&e.zoom>=12&&(t==="default"||t===`lnglat`||t===`cartesian`)){let r=ie$1.getUniforms({viewport:e,coordinateSystem:t,coordinateOrigin:this.props.coordinateOrigin,autoWrapLongitude:this.wrapLongitude});return[e.projectionMode,r.coordinateOrigin[1],r.commonOrigin[1],...r.commonUnitsPerWorldUnit,...r.commonUnitsPerWorldUnit2,r.commonUnitsPerMeter[2]]}let s=Is(e);return s?[e.projectionMode,...s]:[e.projectionMode]}shouldUpdateState(e){let{viewport:t}=this.context;return super.shouldUpdateState(e)||this.state?.tessellationResolution!==t.resolution||!so(this.state?.pathProjectionScale,this.getPathProjectionScale(t))}initializeState(){let t=this.context.device.type===`webgpu`;this.getAttributeManager().addInstanced(s(r({},t?{pathPositions:{size:24,type:`float32`,transition:!1,accessor:`getPath`,update:this.calculateWebGPUPositions,shaderAttributes:{instanceLeftPositions:{size:3,elementOffset:0},instanceStartPositions:{size:3,elementOffset:3},instanceEndPositions:{size:3,elementOffset:6},instanceRightPositions:{size:3,elementOffset:9},instanceLeftPositions64Low:{size:3,elementOffset:12},instanceStartPositions64Low:{size:3,elementOffset:15},instanceEndPositions64Low:{size:3,elementOffset:18},instanceRightPositions64Low:{size:3,elementOffset:21}},noAlloc:!0}}:{vertexPositions:{size:3,vertexOffset:1,type:`float64`,fp64:this.use64bitPositions(),transition:Ot,accessor:`getPath`,update:this.calculatePositions,noAlloc:!0,shaderAttributes:{instanceLeftPositions:{vertexOffset:0},instanceStartPositions:{vertexOffset:1},instanceEndPositions:{vertexOffset:2},instanceRightPositions:{vertexOffset:3}}}}),{instanceTypes:{size:1,type:t?`float32`:`uint8`,update:this.calculateSegmentTypes,noAlloc:!0},instanceStrokeWidths:{size:1,accessor:`getWidth`,transition:t?!1:Ot,defaultValue:1,bufferGroup:`path-instance-data`},instanceColors:{size:this.props.colorFormat.length,type:`unorm8`,accessor:`getColor`,transition:t?!1:Ot,defaultValue:ro,bufferGroup:`path-instance-data`},rowIndexes:{size:1,type:`uint32`,accessor:(n,{index:s})=>n&&n.__source?n.__source.index:s,bufferGroup:`path-instance-data`}})),this.setState({pathTesselator:new Re({fp64:this.use64bitPositions(),isWebGPU:t}),tessellationResolution:this.context.viewport.resolution,pathProjectionScale:this.getPathProjectionScale(this.context.viewport)})}updateState(e){super.updateState(e);let{props:t,oldProps:o,changeFlags:n}=e,s=this.getAttributeManager(),{viewport:r}=this.context,a=this.state.tessellationResolution!==r.resolution,l=this.getPathProjectionScale(r),c=!so(this.state.pathProjectionScale,l),d=n.updateTriggersChanged&&(n.updateTriggersChanged.all||n.updateTriggersChanged.getPath)||t._pathType!==o._pathType||t.positionFormat!==o.positionFormat||t.wrapLongitude!==o.wrapLongitude||a;if(n.dataChanged||d){let{pathTesselator:u}=this.state,g=t.data.attributes||{};u.updateGeometry({data:t.data,geometryBuffer:g.getPath,buffers:g,normalize:!t._pathType,loop:t._pathType===`loop`,getGeometry:t.getPath,positionFormat:t.positionFormat,wrapLongitude:t.wrapLongitude,resolution:r.resolution,dataChanged:d?void 0:n.dataChanged}),this.setState({numInstances:u.instanceCount,startIndices:u.vertexStarts,tessellationResolution:r.resolution,pathProjectionScale:l}),!n.dataChanged||d?s.invalidateAll():c&&s.invalidate(`instanceDashOffsets`)}else c&&(this.setState({pathProjectionScale:l}),s.invalidate(`instanceDashOffsets`));(n.extensionsChanged||t.antialiasing!==o.antialiasing)&&(this.state.model?.destroy(),this.state.model=this._getModel(),s.invalidateAll())}getPickingInfo(e){let t=super.getPickingInfo(e),{index:o}=t,n=this.props.data;return n[0]&&n[0].__source&&(t.object=n.find(s=>s.__source.index===o)),t}disablePickingIndex(e){let t=this.props.data;if(t[0]&&t[0].__source)for(let o=0;o<t.length;o++)t[o].__source.index===e&&this._disablePickingIndex(o);else super.disablePickingIndex(e)}draw({uniforms:e}){let{jointRounded:t,capRounded:o,billboard:n,miterLimit:s,widthUnits:r,widthScale:a,widthMinPixels:l,widthMaxPixels:c}=this.props,f=this.state.model,d={jointType:Number(t),capType:Number(o),billboard:n,widthUnits:ee[r],widthScale:a,miterLimit:s,widthMinPixels:l,widthMaxPixels:c};f.shaderInputs.setProps({path:d}),f.draw(this.context.renderPass)}_getModel(){return new De(this.context.device,s(r({},this.getShaders()),{id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new re$1({topology:`triangle-list`,attributes:{indices:new Uint16Array([0,1,2,1,4,2,1,3,4,3,5,4]),positions:{value:new Float32Array([0,0,0,-1,0,1,1,-1,1,1,1,0]),size:2}}}),isInstanced:!0}))}calculatePositions(e){let{pathTesselator:t}=this.state;e.startIndices=t.vertexStarts,e.value=t.get(`positions`)}calculateSegmentTypes(e){let{pathTesselator:t}=this.state;e.startIndices=t.vertexStarts,e.value=t.get(`segmentTypes`)}calculateWebGPUPositions(e){let{pathTesselator:t}=this.state,o=t.get(`positions`);if(!o){e.value=null;return}let n=t.instanceCount,s=new Float32Array(n*24),r=[-1,0,1,2];for(let a=0;a<n;a++){let l=a*24;for(let c=0;c<4;c++){let f=a+r[c],d=l+c*3;for(let p=0;p<3;p++){let u=f>=0&&f<n?o[f*3+p]:0,g=Math.fround(u);s[d+p]=g,s[d+p+12]=u-g}}}e.startIndices=t.vertexStarts,e.value=s}};Me.defaultProps=ws;Me.layerName=`PathLayer`;var ze=Me;var vo=x(po(),1);var pt=oe.CLOCKWISE;var uo=oe.COUNTER_CLOCKWISE;var K={isClosed:!0};function Us(i){if(i=i&&i.positions||i,!Array.isArray(i)&&!ArrayBuffer.isView(i))throw new Error(`invalid polygon`)}function re(i){return`positions`in i?i.positions:i}function Ne(i){return`holeIndices`in i?i.holeIndices:null}function Vs(i){return Array.isArray(i[0])}function Hs(i){return i.length>=1&&i[0].length>=2&&Number.isFinite(i[0][0])}function Zs(i){let e=i[0],t=i[i.length-1];return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Ks(i,e,t,o){for(let n=0;n<e;n++)if(i[t+n]!==i[o-e+n])return!1;return!0}function go(i,e,t,o,n){let s=e,r=t.length;for(let a=0;a<r;a++)for(let l=0;l<o;l++)i[s++]=t[a][l]||0;if(!Zs(t))for(let a=0;a<o;a++)i[s++]=t[0][a]||0;return K.start=e,K.end=s,K.size=o,Y(i,n,K),s}function ho(i,e,t,o,n=0,s,r){s=s||t.length;let a=s-n;if(a<=0)return e;let l=e;for(let c=0;c<a;c++)i[l++]=t[n+c];if(!Ks(t,o,n,s))for(let c=0;c<o;c++)i[l++]=t[n+c];return K.start=e,K.end=l,K.size=o,Y(i,r,K),l}function ut(i,e){Us(i);let t=[],o=[];if(`positions`in i){let{positions:n,holeIndices:s}=i;if(s){let r=0;for(let a=0;a<=s.length;a++)r=ho(t,r,n,e,s[a-1],s[a],a===0?pt:uo),o.push(r);return o.pop(),{positions:t,holeIndices:o}}i=n}if(!Vs(i))return ho(t,0,i,e,0,t.length,pt),t;if(!Hs(i)){let n=0;for(let[s,r]of i.entries())n=go(t,n,r,e,s===0?pt:uo),o.push(n);return o.pop(),{positions:t,holeIndices:o}}return go(t,0,i,e,pt),t}function Dt(i,e,t){let o=i.length/3,n=0;for(let s=0;s<o;s++){let r=(s+1)%o;n+=i[s*3+e]*i[r*3+t],n-=i[r*3+e]*i[s*3+t]}return Math.abs(n/2)}function xo(i,e,t,o){let n=i.length/3;for(let s=0;s<n;s++){let r=s*3,a=i[r+0],l=i[r+1],c=i[r+2];i[r+e]=a,i[r+t]=l,i[r+o]=c}}function mo(i,e,t,o){let n=Ne(i);n&&(n=n.map(a=>a/e));let s=re(i),r=o&&e===3;if(t){let a=s.length;s=s.slice();let l=[];for(let c=0;c<a;c+=e){l[0]=s[c],l[1]=s[c+1],r&&(l[2]=s[c+2]);let f=t(l);s[c]=f[0],s[c+1]=f[1],r&&(s[c+2]=f[2])}}if(r){let a=Dt(s,0,1),l=Dt(s,0,2),c=Dt(s,1,2);if(!a&&!l&&!c)return[];a>l&&a>c||(l>c?(t||(s=s.slice()),xo(s,0,2,1)):(t||(s=s.slice()),xo(s,2,0,1)))}return(0,vo.default)(s,n,e)}var Ge=class extends xs$1{constructor(e){let{fp64:t,IndexType:o=Uint32Array}=e;super(s(r({},e),{attributes:{positions:{size:3,type:t?Float64Array:Float32Array},vertexValid:{type:Uint16Array,size:1},indices:{type:o,size:1}}}))}get(e){let{attributes:t}=this;return e===`indices`?t.indices&&t.indices.subarray(0,this.vertexCount):t[e]}updateGeometry(e){super.updateGeometry(e);let t=this.buffers.indices;if(t)this.vertexCount=(t.value||t).length;else if(this.data&&!this.getGeometry)throw new Error(`missing indices buffer`)}normalizeGeometry(e){if(this.normalize){let t=ut(e,this.positionSize);return this.opts.resolution?Ie(re(t),Ne(t),{size:this.positionSize,gridResolution:this.opts.resolution,edgeTypes:!0}):this.opts.wrapLongitude?Et(re(t),Ne(t),{size:this.positionSize,maxLatitude:86,edgeTypes:!0}):t}return e}getGeometrySize(e){if(Po(e)){let t=0;for(let o of e)t+=this.getGeometrySize(o);return t}return re(e).length/this.positionSize}getGeometryFromBuffer(e){return this.normalize||!this.buffers.indices?super.getGeometryFromBuffer(e):null}updateGeometryAttributes(e,t){if(e&&Po(e))for(let o of e){let n=this.getGeometrySize(o);t.geometrySize=n,this.updateGeometryAttributes(o,t),t.vertexStart+=n,t.indexStart=this.indexStarts[t.geometryIndex+1]}else{let o=e;this._updateIndices(o,t),this._updatePositions(o,t),this._updateVertexValid(o,t)}}_updateIndices(e,{geometryIndex:t,vertexStart:o,indexStart:n}){let{attributes:s,indexStarts:r,typedArrayManager:a}=this,l=s.indices;if(!l||!e)return;let c=n,f=mo(e,this.positionSize,this.opts.preproject,this.opts.full3d);l=a.allocate(l,n+f.length,{copy:!0});for(let d=0;d<f.length;d++)l[c++]=f[d]+o;r[t+1]=n+f.length,s.indices=l}_updatePositions(e,{vertexStart:t,geometrySize:o}){let{attributes:{positions:n},positionSize:s}=this;if(!n||!e)return;let r=re(e);for(let a=t,l=0;l<o;a++,l++){let c=r[l*s],f=r[l*s+1],d=s>2?r[l*s+2]:0;n[a*3]=c,n[a*3+1]=f,n[a*3+2]=d}}_updateVertexValid(e,{vertexStart:t,geometrySize:o}){let{positionSize:n}=this,s=this.attributes.vertexValid,r=e&&Ne(e);if(e&&e.edgeTypes?s.set(e.edgeTypes,t):s.fill(1,t,t+o),r)for(let a=0;a<r.length;a++)s[t+r[a]/n-1]=0;s[t+o-1]=0}};function Po(i){return Array.isArray(i)&&i.length>0&&!Number.isFinite(i[0])}var $s=`struct SolidPolygonUniforms {
|
|
3158
3158
|
extruded: f32,
|
|
3159
3159
|
isWireframe: f32,
|
|
3160
3160
|
elevationScale: f32,
|
|
3161
3161
|
};
|
|
3162
3162
|
|
|
3163
3163
|
@group(0) @binding(auto) var<uniform> solidPolygon: SolidPolygonUniforms;
|
|
3164
|
-
`;var
|
|
3164
|
+
`;var _o=`layout(std140) uniform solidPolygonUniforms {
|
|
3165
3165
|
bool extruded;
|
|
3166
3166
|
bool isWireframe;
|
|
3167
3167
|
float elevationScale;
|
|
3168
3168
|
} solidPolygon;
|
|
3169
|
-
`;var
|
|
3169
|
+
`;var Co={name:`solidPolygon`,source:$s,vs:_o,fs:_o,uniformTypes:{extruded:`f32`,isWireframe:`f32`,elevationScale:`f32`}};var gt=`in vec4 fillColors;
|
|
3170
3170
|
in vec4 lineColors;
|
|
3171
3171
|
in float rowIndexes;
|
|
3172
3172
|
out vec4 vColor;
|
|
@@ -3209,12 +3209,12 @@ vColor = vec4(colors.rgb, colors.a * layer.opacity);
|
|
|
3209
3209
|
}
|
|
3210
3210
|
DECKGL_FILTER_COLOR(vColor, geometry);
|
|
3211
3211
|
}
|
|
3212
|
-
`;var
|
|
3212
|
+
`;var So=`#version 300 es
|
|
3213
3213
|
#define SHADER_NAME solid-polygon-layer-vertex-shader
|
|
3214
3214
|
in vec3 vertexPositions;
|
|
3215
3215
|
in vec3 vertexPositions64Low;
|
|
3216
3216
|
in float elevations;
|
|
3217
|
-
${
|
|
3217
|
+
${gt}
|
|
3218
3218
|
void main(void) {
|
|
3219
3219
|
PolygonProps props;
|
|
3220
3220
|
props.positions = vertexPositions;
|
|
@@ -3223,7 +3223,7 @@ props.elevations = elevations;
|
|
|
3223
3223
|
props.normal = vec3(0.0, 0.0, 1.0);
|
|
3224
3224
|
calculatePosition(props);
|
|
3225
3225
|
}
|
|
3226
|
-
`;var
|
|
3226
|
+
`;var Lo=`#version 300 es
|
|
3227
3227
|
#define SHADER_NAME solid-polygon-layer-vertex-shader-side
|
|
3228
3228
|
#define IS_SIDE_VERTEX
|
|
3229
3229
|
in vec2 positions;
|
|
@@ -3233,7 +3233,7 @@ in vec3 vertexPositions64Low;
|
|
|
3233
3233
|
in vec3 nextVertexPositions64Low;
|
|
3234
3234
|
in float elevations;
|
|
3235
3235
|
in float instanceVertexValid;
|
|
3236
|
-
${
|
|
3236
|
+
${gt}
|
|
3237
3237
|
void main(void) {
|
|
3238
3238
|
if(instanceVertexValid < 0.5){
|
|
3239
3239
|
gl_Position = vec4(0.);
|
|
@@ -3264,7 +3264,7 @@ nextPos.x - pos.x + (nextPos64Low.x - pos64Low.x),
|
|
|
3264
3264
|
props.elevations = elevations * positions.y;
|
|
3265
3265
|
calculatePosition(props);
|
|
3266
3266
|
}
|
|
3267
|
-
`;var
|
|
3267
|
+
`;var bo=`#version 300 es
|
|
3268
3268
|
#define SHADER_NAME solid-polygon-layer-fragment-shader
|
|
3269
3269
|
precision highp float;
|
|
3270
3270
|
in vec4 vColor;
|
|
@@ -3274,7 +3274,7 @@ fragColor = vColor;
|
|
|
3274
3274
|
geometry.uv = vec2(0.);
|
|
3275
3275
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
3276
3276
|
}
|
|
3277
|
-
`;function
|
|
3277
|
+
`;function wo(){return`fn project_offset_normal(vector: vec3<f32>) -> vec3<f32> {
|
|
3278
3278
|
if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
|
|
3279
3279
|
project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSETS) {
|
|
3280
3280
|
return normalize(vector * project.commonUnitsPerWorldUnit);
|
|
@@ -3298,7 +3298,7 @@ fn apply_polygon_color(
|
|
|
3298
3298
|
}
|
|
3299
3299
|
return vec4<f32>(colors.rgb, colors.a * layer.opacity);
|
|
3300
3300
|
}
|
|
3301
|
-
`}function
|
|
3301
|
+
`}function Io(){return`@fragment
|
|
3302
3302
|
fn fragmentMain(inp: Varyings) -> @location(0) vec4<f32> {
|
|
3303
3303
|
geometry.uv = vec2<f32>(0.0, 0.0);
|
|
3304
3304
|
|
|
@@ -3332,7 +3332,7 @@ fn fragmentMain(inp: Varyings) -> @location(0) vec4<f32> {
|
|
|
3332
3332
|
|
|
3333
3333
|
return deckgl_premultiplied_alpha(fragColor);
|
|
3334
3334
|
}
|
|
3335
|
-
`}function
|
|
3335
|
+
`}function Ys(){return`${wo()}
|
|
3336
3336
|
|
|
3337
3337
|
struct Attributes {
|
|
3338
3338
|
@location(0) vertexPositions: vec3<f32>,
|
|
@@ -3387,10 +3387,10 @@ fn vertexMain(attributes: Attributes) -> Varyings {
|
|
|
3387
3387
|
return outp;
|
|
3388
3388
|
}
|
|
3389
3389
|
|
|
3390
|
-
${
|
|
3391
|
-
`}function
|
|
3390
|
+
${Io()}
|
|
3391
|
+
`}function Js(i){return`const RING_WINDING_ORDER_CW: bool = ${i?`true`:`false`};
|
|
3392
3392
|
|
|
3393
|
-
${
|
|
3393
|
+
${wo()}
|
|
3394
3394
|
|
|
3395
3395
|
struct Attributes {
|
|
3396
3396
|
@location(0) positions: vec2<f32>,
|
|
@@ -3477,25 +3477,25 @@ fn vertexMain(attributes: Attributes) -> Varyings {
|
|
|
3477
3477
|
return outp;
|
|
3478
3478
|
}
|
|
3479
3479
|
|
|
3480
|
-
${
|
|
3481
|
-
`}function go(t,o){return t===`top`?Vs():Hs(o)}var Qe=[0,0,0,255];var Zs={filled:!0,extruded:!1,wireframe:!1,_normalize:!0,_windingOrder:`CW`,_full3d:!1,elevationScale:{type:`number`,min:0,value:1},getPolygon:{type:`accessor`,value:t=>t.polygon},getElevation:{type:`accessor`,value:1e3},getFillColor:{type:`accessor`,value:Qe},getLineColor:{type:`accessor`,value:Qe},material:!0};var qe={enter:(t,o)=>o.length?o.subarray(o.length-t.length):t};var we=(()=>{class t extends en$1{getShaders(e){let i=!this.props._normalize&&this.props._windingOrder===`CCW`?0:1;return super.getShaders({vs:e===`top`?lo:co,fs:fo,source:go(e,!!i),defines:{RING_WINDING_ORDER_CW:i},modules:[Wa,ma,Zo$1,Ka,ao,...this.context.device.type===`webgpu`?[ie]:[]]})}get wrapLongitude(){return!1}getBounds(){return this.getAttributeManager()?.getBounds([`vertexPositions`])}initializeState(){let{viewport:e}=this.context,{coordinateSystem:i}=this.props,{_full3d:n}=this.props;e.isGeospatial&&i==="default"&&(i=`lnglat`);let s$6;i===`lnglat`&&(n?s$6=e.projectPosition.bind(e):s$6=e.projectFlat.bind(e)),this.setState({numInstances:0,polygonTesselator:new Ye({preproject:s$6,fp64:this.use64bitPositions(),IndexType:Uint32Array})});let r$7=this.getAttributeManager(),a=!0,l=this.context.device.type===`webgpu`;r$7.add(s(r({indices:{size:1,isIndexed:!0,update:this.calculateIndices,noAlloc:a},vertexPositions:r({size:3,type:`float64`,stepMode:`dynamic`,fp64:this.use64bitPositions(),transition:qe,accessor:`getPolygon`,update:this.calculatePositions,noAlloc:a},l?{}:{shaderAttributes:{nextVertexPositions:{vertexOffset:1}}})},l?{nextVertexPositions:{size:3,type:`float64`,stepMode:`dynamic`,fp64:this.use64bitPositions(),transition:!1,update:this.calculateNextPositions,noAlloc:a}}:{}),{[l?`vertexValid`:`instanceVertexValid`]:{size:1,type:l?`float32`:`uint16`,stepMode:`instance`,update:this.calculateVertexValid,noAlloc:a},elevations:{size:1,stepMode:`dynamic`,transition:qe,accessor:`getElevation`,bufferGroup:`solid-polygon-instance-data`},fillColors:{size:this.props.colorFormat.length,type:`unorm8`,stepMode:`dynamic`,transition:qe,accessor:`getFillColor`,defaultValue:Qe,bufferGroup:`solid-polygon-instance-data`},lineColors:{size:this.props.colorFormat.length,type:`unorm8`,stepMode:`dynamic`,transition:qe,accessor:`getLineColor`,defaultValue:Qe,bufferGroup:`solid-polygon-instance-data`},rowIndexes:{size:1,type:`uint32`,stepMode:`dynamic`,accessor:(c,{index:f})=>c&&c.__source?c.__source.index:f,bufferGroup:`solid-polygon-instance-data`}}))}getPickingInfo(e){let i=super.getPickingInfo(e),{index:n}=i,s=this.props.data;return s[0]&&s[0].__source&&(i.object=s.find(r=>r.__source.index===n)),i}disablePickingIndex(e){let i=this.props.data;if(i[0]&&i[0].__source)for(let n=0;n<i.length;n++)i[n].__source.index===e&&this._disablePickingIndex(n);else super.disablePickingIndex(e)}draw({uniforms:e}){let{extruded:i,filled:n,wireframe:s$7,elevationScale:r$8}=this.props,{topModel:a,sideModel:l,wireframeModel:c,polygonTesselator:f}=this.state,d={extruded:!!i,elevationScale:r$8,isWireframe:!1};c&&s$7&&(c.setInstanceCount(f.instanceCount-1),c.shaderInputs.setProps({solidPolygon:s(r({},d),{isWireframe:!0})}),c.draw(this.context.renderPass)),l&&n&&(l.setInstanceCount(f.instanceCount-1),l.shaderInputs.setProps({solidPolygon:d}),l.draw(this.context.renderPass)),a&&n&&(a.setVertexCount(f.vertexCount),a.shaderInputs.setProps({solidPolygon:d}),a.draw(this.context.renderPass))}updateState(e){super.updateState(e),this.updateGeometry(e);let{props:i,oldProps:n,changeFlags:s}=e,r=this.getAttributeManager();(s.extensionsChanged||i.filled!==n.filled||i.extruded!==n.extruded)&&(this.state.models?.forEach(l=>l.destroy()),this.setState(this._getModels()),r.invalidateAll())}updateGeometry({props:e,oldProps:i,changeFlags:n}){if(n.dataChanged||n.updateTriggersChanged&&(n.updateTriggersChanged.all||n.updateTriggersChanged.getPolygon)){let{polygonTesselator:r$9}=this.state,a=e.data.attributes||{};r$9.updateGeometry({data:e.data,normalize:e._normalize,geometryBuffer:a.getPolygon,buffers:this.context.device.type===`webgpu`?r({},a):a,getGeometry:e.getPolygon,positionFormat:e.positionFormat,wrapLongitude:e.wrapLongitude,resolution:this.context.viewport.resolution,fp64:this.use64bitPositions(),dataChanged:n.dataChanged,full3d:e._full3d}),this.setState({numInstances:r$9.instanceCount,startIndices:r$9.vertexStarts}),n.dataChanged||this.getAttributeManager().invalidateAll()}}_getModels(){let{id:e,filled:i,extruded:n}=this.props,s$8,r$10,a;if(i){let l=this.getShaders(`top`);l.defines=s(r({},l.defines),{NON_INSTANCED_MODEL:1});let c=this.getAttributeManager().getBufferLayouts({isInstanced:!1});this.context.device.type===`webgpu`&&(c=c.filter(f=>f.name!==`indices`&&f.name!==`vertexValid`&&f.name!==`instanceVertexValid`&&f.name!==`nextVertexPositions`)),s$8=new De$1(this.context.device,s(r({},l),{id:`${e}-top`,topology:`triangle-list`,bufferLayout:c,isIndexed:!0,userData:{excludeAttributes:{vertexValid:!0,instanceVertexValid:!0,nextVertexPositions:!0}}}))}if(n){let l=this.getAttributeManager().getBufferLayouts({isInstanced:!0});this.context.device.type===`webgpu`&&(l=l.filter(c=>c.name!==`indices`)),r$10=new De$1(this.context.device,s(r({},this.getShaders(`side`)),{id:`${e}-side`,bufferLayout:l,geometry:new ne$1({topology:`triangle-strip`,attributes:{positions:{size:2,value:new Float32Array([1,0,0,0,1,1,0,1])}}}),isInstanced:!0,userData:{excludeAttributes:{indices:!0}}})),a=new De$1(this.context.device,s(r({},this.getShaders(`side`)),{id:`${e}-wireframe`,bufferLayout:l,geometry:new ne$1({topology:`line-strip`,attributes:{positions:{size:2,value:new Float32Array([1,0,0,0,0,1,1,1])}}}),isInstanced:!0,userData:{excludeAttributes:{indices:!0}}}))}return{models:[r$10,a,s$8].filter(Boolean),topModel:s$8,sideModel:r$10,wireframeModel:a}}calculateIndices(e){let{polygonTesselator:i}=this.state;e.startIndices=i.indexStarts,e.value=i.get(`indices`)}calculatePositions(e){let{polygonTesselator:i}=this.state;e.startIndices=i.vertexStarts;let n=this.props.data.attributes?.getPolygon;if(this.context.device.type===`webgpu`&&ArrayBuffer.isView(n?.value)){let{value:s,size:r=3,offset:a=0,stride:l}=n,c=a/s.BYTES_PER_ELEMENT,f=l?l/s.BYTES_PER_ELEMENT:r,d=new Float64Array(i.instanceCount*3);for(let u=0;u<i.instanceCount;u++){let p=c+u*f,g=u*3;d[g]=s[p],d[g+1]=s[p+1],d[g+2]=r>2?s[p+2]:0}e.value=d;return}e.value=i.get(`positions`)}calculateVertexValid(e){let i=this.props.data.attributes?.instanceVertexValid?.value,n=this.context.device.type===`webgpu`&&i?i:this.state.polygonTesselator.get(`vertexValid`);e.value=this.context.device.type===`webgpu`&&n?Float32Array.from(n):n}calculateNextPositions(e){let{polygonTesselator:i}=this.state,n=this.getAttributeManager().getAttributes(),s=n.vertexPositions.value,r=this.props.data.attributes?.instanceVertexValid?.value||n.vertexValid?.value||i.get(`vertexValid`);if(e.startIndices=i.vertexStarts,!s){e.value=s;return}let a=s.length/3,l=new s.constructor(s.length);for(let c=0;c<a;c++){let f=c*3,d=r?.[c]&&c+1<a?f+3:f;for(let u=0;u<3;u++)l[f+u]=s[d+u]}e.value=l}}return t.defaultProps=Zs,t.layerName=`SolidPolygonLayer`,t})();function et({data:t,getIndex:o,dataRange:e,replace:i}){let{startRow:n=0,endRow:s=Infinity}=e,r=t.length,a=r,l=r;for(let u=0;u<r;u++){let p=o(t[u]);if(a>u&&p>=n&&(a=u),p>=s){l=u;break}}let c=a,d=l-a!==i.length?t.slice(l):void 0;for(let u=0;u<i.length;u++)t[c++]=i[u];if(d){for(let u=0;u<d.length;u++)t[c++]=d[u];t.length=c}return{startRow:a,endRow:a+i.length}}var ho=[0,0,0,255];var Js={stroked:!0,filled:!0,extruded:!1,elevationScale:1,wireframe:!1,_normalize:!0,_windingOrder:`CW`,lineWidthUnits:`meters`,lineWidthScale:1,lineWidthMinPixels:0,lineWidthMaxPixels:Number.MAX_SAFE_INTEGER,lineJointRounded:!1,lineMiterLimit:4,lineAntialiasing:!1,getPolygon:{type:`accessor`,value:t=>t.polygon},getFillColor:{type:`accessor`,value:[0,0,0,255]},getLineColor:{type:`accessor`,value:ho},getLineWidth:{type:`accessor`,value:1},getElevation:{type:`accessor`,value:1e3},material:!0};var Xs=(()=>{class t extends Dm{initializeState(){this.state={paths:[],pathsDiff:null},this.props.getLineDashArray&&A.removed(`getLineDashArray`,`PathStyleExtension`)()}updateState({changeFlags:e}){let i=e.dataChanged||e.updateTriggersChanged&&(e.updateTriggersChanged.all||e.updateTriggersChanged.getPolygon);if(i&&Array.isArray(e.dataChanged)){let n=this.state.paths.slice(),s=e.dataChanged.map(r=>et({data:n,getIndex:a=>a.__source.index,dataRange:r,replace:this._getPaths(r)}));this.setState({paths:n,pathsDiff:s})}else i&&this.setState({paths:this._getPaths(),pathsDiff:null})}_getPaths(e={}){let{data:i,getPolygon:n,positionFormat:s,_normalize:r}=this.props,a=[],l=s===`XY`?2:3,{startRow:c,endRow:f}=e,{iterable:d,objectInfo:u}=Ar(i,c,f);for(let p of d){u.index++;let g=n(p,u);r&&(g=Je(g,l));let{holeIndices:h}=g,v=g.positions||g;if(h)for(let P=0;P<=h.length;P++){let C=v.slice(h[P-1]||0,h[P]||v.length);a.push(this.getSubLayerRow({path:C},p,u.index))}else a.push(this.getSubLayerRow({path:v},p,u.index))}return a}renderLayers(){let{data:e,_dataDiff:i,stroked:n,filled:s,extruded:r,wireframe:a,_normalize:l,_windingOrder:c,elevationScale:f,transitions:d,positionFormat:u}=this.props,{lineWidthUnits:p,lineWidthScale:g,lineWidthMinPixels:h,lineWidthMaxPixels:v,lineJointRounded:P,lineMiterLimit:C,lineAntialiasing:m,lineDashJustified:x}=this.props,{getFillColor:L,getLineColor:N,getLineWidth:G,getLineDashArray:j,getElevation:F,getPolygon:U,updateTriggers:D,material:V}=this.props,{paths:W,pathsDiff:H}=this.state,Q=this.getSubLayerClass(`fill`,we),lt=this.getSubLayerClass(`stroke`,_e),k=this.shouldRenderSubLayer(`fill`,W)&&new Q({_dataDiff:i,extruded:r,elevationScale:f,filled:s,wireframe:a,_normalize:l,_windingOrder:c,getElevation:F,getFillColor:L,getLineColor:r&&a?N:ho,material:V,transitions:d},this.getSubLayerProps({id:`fill`,updateTriggers:D&&{getPolygon:D.getPolygon,getElevation:D.getElevation,getFillColor:D.getFillColor,lineColors:r&&a,getLineColor:D.getLineColor}}),{data:e,positionFormat:u,getPolygon:U}),I=!r&&n&&this.shouldRenderSubLayer(`stroke`,W)&&new lt({_dataDiff:H&&(()=>H),widthUnits:p,widthScale:g,widthMinPixels:h,widthMaxPixels:v,jointRounded:P,miterLimit:C,antialiasing:m,dashJustified:x,_pathType:`loop`,transitions:d&&{getWidth:d.getLineWidth,getColor:d.getLineColor,getPath:d.getPolygon},getColor:this.getSubLayerAccessor(N),getWidth:this.getSubLayerAccessor(G),getDashArray:this.getSubLayerAccessor(j)},this.getSubLayerProps({id:`stroke`,updateTriggers:D&&{getWidth:D.getLineWidth,getColor:D.getLineColor,getDashArray:D.getLineDashArray}}),{data:W,positionFormat:u,getPath:ct=>ct.path});return[!r&&k,I,r&&k]}}return t.layerName=`PolygonLayer`,t.defaultProps=Js,t})();function xo(t,o){if(!t)return null;let e=`startIndices`in t?t.startIndices[o]:o,i=t.featureIds.value[e];return e!==-1?qs(t,i,e):null}function qs(t,o,e){let i={properties:r({},t.properties[o])};for(let n in t.numericProps)i.properties[n]=t.numericProps[n].value[e];return i}function vo(t){let o={points:null,lines:null,polygons:null};for(let e in o){let i=t[e].globalFeatureIds.value;o[e]=new Uint32Array(i)}return o}var mo=`layout(std140) uniform sdfUniforms {
|
|
3480
|
+
${Io()}
|
|
3481
|
+
`}function Ao(i,e){return i===`top`?Ys():Js(e)}var xt=[0,0,0,255];var Xs={filled:!0,extruded:!1,wireframe:!1,_normalize:!0,_windingOrder:`CW`,_full3d:!1,elevationScale:{type:`number`,min:0,value:1},getPolygon:{type:`accessor`,value:i=>i.polygon},getElevation:{type:`accessor`,value:1e3},getFillColor:{type:`accessor`,value:xt},getLineColor:{type:`accessor`,value:xt},material:!0};var ht={enter:(i,e)=>e.length?e.subarray(e.length-i.length):i};var je=class extends ao{getShaders(e){let t=!this.props._normalize&&this.props._windingOrder===`CCW`?0:1;return super.getShaders({vs:e===`top`?So:Lo,fs:bo,source:Ao(e,!!t),defines:{RING_WINDING_ORDER_CW:t},modules:[Wa,ma,Zo$1,Ka,Co,...this.context.device.type===`webgpu`?[ie]:[]]})}get wrapLongitude(){return!1}getBounds(){return this.getAttributeManager()?.getBounds([`vertexPositions`])}initializeState(){let{viewport:e}=this.context,{coordinateSystem:t}=this.props,{_full3d:o}=this.props;e.isGeospatial&&t==="default"&&(t=`lnglat`);let n;t===`lnglat`&&(o?n=e.projectPosition.bind(e):n=e.projectFlat.bind(e)),this.setState({numInstances:0,polygonTesselator:new Ge({preproject:n,fp64:this.use64bitPositions(),IndexType:Uint32Array})});let s$6=this.getAttributeManager(),r$6=!0,a=this.context.device.type===`webgpu`;s$6.add(s(r({indices:{size:1,isIndexed:!0,update:this.calculateIndices,noAlloc:r$6},vertexPositions:r({size:3,type:`float64`,stepMode:`dynamic`,fp64:this.use64bitPositions(),transition:ht,accessor:`getPolygon`,update:this.calculatePositions,noAlloc:r$6},a?{}:{shaderAttributes:{nextVertexPositions:{vertexOffset:1}}})},a?{nextVertexPositions:{size:3,type:`float64`,stepMode:`dynamic`,fp64:this.use64bitPositions(),transition:!1,update:this.calculateNextPositions,noAlloc:r$6}}:{}),{[a?`vertexValid`:`instanceVertexValid`]:{size:1,type:a?`float32`:`uint16`,stepMode:`instance`,update:this.calculateVertexValid,noAlloc:r$6},elevations:{size:1,stepMode:`dynamic`,transition:ht,accessor:`getElevation`,bufferGroup:`solid-polygon-instance-data`},fillColors:{size:this.props.colorFormat.length,type:`unorm8`,stepMode:`dynamic`,transition:ht,accessor:`getFillColor`,defaultValue:xt,bufferGroup:`solid-polygon-instance-data`},lineColors:{size:this.props.colorFormat.length,type:`unorm8`,stepMode:`dynamic`,transition:ht,accessor:`getLineColor`,defaultValue:xt,bufferGroup:`solid-polygon-instance-data`},rowIndexes:{size:1,type:`uint32`,stepMode:`dynamic`,accessor:(l,{index:c})=>l&&l.__source?l.__source.index:c,bufferGroup:`solid-polygon-instance-data`}}))}getPickingInfo(e){let t=super.getPickingInfo(e),{index:o}=t,n=this.props.data;return n[0]&&n[0].__source&&(t.object=n.find(s=>s.__source.index===o)),t}disablePickingIndex(e){let t=this.props.data;if(t[0]&&t[0].__source)for(let o=0;o<t.length;o++)t[o].__source.index===e&&this._disablePickingIndex(o);else super.disablePickingIndex(e)}draw({uniforms:e}){let{extruded:t,filled:o,wireframe:n,elevationScale:s$7}=this.props,{topModel:r$7,sideModel:a,wireframeModel:l,polygonTesselator:c}=this.state,f={extruded:!!t,elevationScale:s$7,isWireframe:!1};l&&n&&(l.setInstanceCount(c.instanceCount-1),l.shaderInputs.setProps({solidPolygon:s(r({},f),{isWireframe:!0})}),l.draw(this.context.renderPass)),a&&o&&(a.setInstanceCount(c.instanceCount-1),a.shaderInputs.setProps({solidPolygon:f}),a.draw(this.context.renderPass)),r$7&&o&&(r$7.setVertexCount(c.vertexCount),r$7.shaderInputs.setProps({solidPolygon:f}),r$7.draw(this.context.renderPass))}updateState(e){super.updateState(e),this.updateGeometry(e);let{props:t,oldProps:o,changeFlags:n}=e,s=this.getAttributeManager();(n.extensionsChanged||t.filled!==o.filled||t.extruded!==o.extruded)&&(this.state.models?.forEach(a=>a.destroy()),this.setState(this._getModels()),s.invalidateAll())}updateGeometry({props:e,oldProps:t,changeFlags:o}){if(o.dataChanged||o.updateTriggersChanged&&(o.updateTriggersChanged.all||o.updateTriggersChanged.getPolygon)){let{polygonTesselator:s}=this.state,r$8=e.data.attributes||{};s.updateGeometry({data:e.data,normalize:e._normalize,geometryBuffer:r$8.getPolygon,buffers:this.context.device.type===`webgpu`?r({},r$8):r$8,getGeometry:e.getPolygon,positionFormat:e.positionFormat,wrapLongitude:e.wrapLongitude,resolution:this.context.viewport.resolution,fp64:this.use64bitPositions(),dataChanged:o.dataChanged,full3d:e._full3d}),this.setState({numInstances:s.instanceCount,startIndices:s.vertexStarts}),o.dataChanged||this.getAttributeManager().invalidateAll()}}_getModels(){let{id:e,filled:t,extruded:o}=this.props,n,s$8,r$9;if(t){let a=this.getShaders(`top`);a.defines=s(r({},a.defines),{NON_INSTANCED_MODEL:1});let l=this.getAttributeManager().getBufferLayouts({isInstanced:!1});this.context.device.type===`webgpu`&&(l=l.filter(c=>c.name!==`indices`&&c.name!==`vertexValid`&&c.name!==`instanceVertexValid`&&c.name!==`nextVertexPositions`)),n=new De(this.context.device,s(r({},a),{id:`${e}-top`,topology:`triangle-list`,bufferLayout:l,isIndexed:!0,userData:{excludeAttributes:{vertexValid:!0,instanceVertexValid:!0,nextVertexPositions:!0}}}))}if(o){let a=this.getAttributeManager().getBufferLayouts({isInstanced:!0});this.context.device.type===`webgpu`&&(a=a.filter(l=>l.name!==`indices`)),s$8=new De(this.context.device,s(r({},this.getShaders(`side`)),{id:`${e}-side`,bufferLayout:a,geometry:new re$1({topology:`triangle-strip`,attributes:{positions:{size:2,value:new Float32Array([1,0,0,0,1,1,0,1])}}}),isInstanced:!0,userData:{excludeAttributes:{indices:!0}}})),r$9=new De(this.context.device,s(r({},this.getShaders(`side`)),{id:`${e}-wireframe`,bufferLayout:a,geometry:new re$1({topology:`line-strip`,attributes:{positions:{size:2,value:new Float32Array([1,0,0,0,0,1,1,1])}}}),isInstanced:!0,userData:{excludeAttributes:{indices:!0}}}))}return{models:[s$8,r$9,n].filter(Boolean),topModel:n,sideModel:s$8,wireframeModel:r$9}}calculateIndices(e){let{polygonTesselator:t}=this.state;e.startIndices=t.indexStarts,e.value=t.get(`indices`)}calculatePositions(e){let{polygonTesselator:t}=this.state;e.startIndices=t.vertexStarts;let o=this.props.data.attributes?.getPolygon;if(this.context.device.type===`webgpu`&&ArrayBuffer.isView(o?.value)){let{value:n,size:s=3,offset:r=0,stride:a}=o,l=r/n.BYTES_PER_ELEMENT,c=a?a/n.BYTES_PER_ELEMENT:s,f=new Float64Array(t.instanceCount*3);for(let d=0;d<t.instanceCount;d++){let p=l+d*c,u=d*3;f[u]=n[p],f[u+1]=n[p+1],f[u+2]=s>2?n[p+2]:0}e.value=f;return}e.value=t.get(`positions`)}calculateVertexValid(e){let t=this.props.data.attributes?.instanceVertexValid?.value,o=this.context.device.type===`webgpu`&&t?t:this.state.polygonTesselator.get(`vertexValid`);e.value=this.context.device.type===`webgpu`&&o?Float32Array.from(o):o}calculateNextPositions(e){let{polygonTesselator:t}=this.state,o=this.getAttributeManager().getAttributes(),n=o.vertexPositions.value,s=this.props.data.attributes?.instanceVertexValid?.value||o.vertexValid?.value||t.get(`vertexValid`);if(e.startIndices=t.vertexStarts,!n){e.value=n;return}let r=n.length/3,a=new n.constructor(n.length);for(let l=0;l<r;l++){let c=l*3,f=s?.[l]&&l+1<r?c+3:c;for(let d=0;d<3;d++)a[c+d]=n[f+d]}e.value=a}};je.defaultProps=Xs;je.layerName=`SolidPolygonLayer`;var Be=je;function vt({data:i,getIndex:e,dataRange:t,replace:o}){let{startRow:n=0,endRow:s=1/0}=t,r=i.length,a=r,l=r;for(let p=0;p<r;p++){let u=e(i[p]);if(a>p&&u>=n&&(a=p),u>=s){l=p;break}}let c=a,d=l-a!==o.length?i.slice(l):void 0;for(let p=0;p<o.length;p++)i[c++]=o[p];if(d){for(let p=0;p<d.length;p++)i[c++]=d[p];i.length=c}return{startRow:a,endRow:a+o.length}}var Eo=[0,0,0,255];var Qs={stroked:!0,filled:!0,extruded:!1,elevationScale:1,wireframe:!1,_normalize:!0,_windingOrder:`CW`,lineWidthUnits:`meters`,lineWidthScale:1,lineWidthMinPixels:0,lineWidthMaxPixels:Number.MAX_SAFE_INTEGER,lineJointRounded:!1,lineMiterLimit:4,lineAntialiasing:!1,getPolygon:{type:`accessor`,value:i=>i.polygon},getFillColor:{type:`accessor`,value:[0,0,0,255]},getLineColor:{type:`accessor`,value:Eo},getLineWidth:{type:`accessor`,value:1},getElevation:{type:`accessor`,value:1e3},material:!0};var We=class extends _m{initializeState(){this.state={paths:[],pathsDiff:null},this.props.getLineDashArray&&S.removed(`getLineDashArray`,`PathStyleExtension`)()}updateState({changeFlags:e}){let t=e.dataChanged||e.updateTriggersChanged&&(e.updateTriggersChanged.all||e.updateTriggersChanged.getPolygon);if(t&&Array.isArray(e.dataChanged)){let o=this.state.paths.slice(),n=e.dataChanged.map(s=>vt({data:o,getIndex:r=>r.__source.index,dataRange:s,replace:this._getPaths(s)}));this.setState({paths:o,pathsDiff:n})}else t&&this.setState({paths:this._getPaths(),pathsDiff:null})}_getPaths(e={}){let{data:t,getPolygon:o,positionFormat:n,_normalize:s}=this.props,r=[],a=n===`XY`?2:3,{startRow:l,endRow:c}=e,{iterable:f,objectInfo:d}=Yr(t,l,c);for(let p of f){d.index++;let u=o(p,d);s&&(u=ut(u,a));let{holeIndices:g}=u,h=u.positions||u;if(g)for(let v=0;v<=g.length;v++){let P=h.slice(g[v-1]||0,g[v]||h.length);r.push(this.getSubLayerRow({path:P},p,d.index))}else r.push(this.getSubLayerRow({path:h},p,d.index))}return r}renderLayers(){let{data:e,_dataDiff:t,stroked:o,filled:n,extruded:s,wireframe:r,_normalize:a,_windingOrder:l,elevationScale:c,transitions:f,positionFormat:d}=this.props,{lineWidthUnits:p,lineWidthScale:u,lineWidthMinPixels:g,lineWidthMaxPixels:h,lineJointRounded:v,lineMiterLimit:P,lineAntialiasing:C,lineDashJustified:m}=this.props,{getFillColor:x,getLineColor:S,getLineWidth:N,getLineDashArray:W,getElevation:j,getPolygon:F,updateTriggers:A,material:V}=this.props,{paths:B,pathsDiff:U}=this.state,$=this.getSubLayerClass(`fill`,Be),Q=this.getSubLayerClass(`stroke`,ze),D=this.shouldRenderSubLayer(`fill`,B)&&new $({_dataDiff:t,extruded:s,elevationScale:c,filled:n,wireframe:r,_normalize:a,_windingOrder:l,getElevation:j,getFillColor:x,getLineColor:s&&r?S:Eo,material:V,transitions:f},this.getSubLayerProps({id:`fill`,updateTriggers:A&&{getPolygon:A.getPolygon,getElevation:A.getElevation,getFillColor:A.getFillColor,lineColors:s&&r,getLineColor:A.getLineColor}}),{data:e,positionFormat:d,getPolygon:F}),I=!s&&o&&this.shouldRenderSubLayer(`stroke`,B)&&new Q({_dataDiff:U&&(()=>U),widthUnits:p,widthScale:u,widthMinPixels:g,widthMaxPixels:h,jointRounded:v,miterLimit:P,antialiasing:C,dashJustified:m,_pathType:`loop`,transitions:f&&{getWidth:f.getLineWidth,getColor:f.getLineColor,getPath:f.getPolygon},getColor:this.getSubLayerAccessor(S),getWidth:this.getSubLayerAccessor(N),getDashArray:this.getSubLayerAccessor(W)},this.getSubLayerProps({id:`stroke`,updateTriggers:A&&{getWidth:A.getLineWidth,getColor:A.getLineColor,getDashArray:A.getLineDashArray}}),{data:B,positionFormat:d,getPath:St=>St.path});return[!s&&D,I,s&&D]}};We.layerName=`PolygonLayer`;We.defaultProps=Qs;var er=We;function To(i,e){if(!i)return null;let t=`startIndices`in i?i.startIndices[e]:e,o=i.featureIds.value[t];return t!==-1?tr(i,o,t):null}function tr(i,e,t){let o={properties:r({},i.properties[e])};for(let n in i.numericProps)o.properties[n]=i.numericProps[n].value[t];return o}function Oo(i){let e={points:null,lines:null,polygons:null};for(let t in e){let o=i[t].globalFeatureIds.value;e[t]=new Uint32Array(o)}return e}var Ro=`layout(std140) uniform sdfUniforms {
|
|
3482
3482
|
float gamma;
|
|
3483
3483
|
bool enabled;
|
|
3484
3484
|
float buffer;
|
|
3485
3485
|
float outlineBuffer;
|
|
3486
3486
|
vec4 outlineColor;
|
|
3487
3487
|
} sdf;
|
|
3488
|
-
`;var
|
|
3488
|
+
`;var Mo={name:`sdf`,vs:Ro,fs:Ro,uniformTypes:{gamma:`f32`,enabled:`f32`,buffer:`f32`,outlineBuffer:`f32`,outlineColor:`vec4<f32>`}};var Ue={none:0,start:1,center:2,end:3};var mt={name:`text`,vs:`layout(std140) uniform textUniforms {
|
|
3489
3489
|
highp vec2 cutoffPixels;
|
|
3490
3490
|
highp ivec2 align;
|
|
3491
3491
|
highp float fontSize;
|
|
3492
3492
|
bool flipY;
|
|
3493
3493
|
} text;
|
|
3494
3494
|
|
|
3495
|
-
#define ALIGN_MODE_START ${
|
|
3496
|
-
#define ALIGN_MODE_CENTER ${
|
|
3497
|
-
#define ALIGN_MODE_END ${
|
|
3498
|
-
`,getUniforms:({contentCutoffPixels:
|
|
3495
|
+
#define ALIGN_MODE_START ${Ue.start}
|
|
3496
|
+
#define ALIGN_MODE_CENTER ${Ue.center}
|
|
3497
|
+
#define ALIGN_MODE_END ${Ue.end}
|
|
3498
|
+
`,getUniforms:({contentCutoffPixels:i=[0,0],contentAlignHorizontal:e=`none`,contentAlignVertical:t=`none`,fontSize:o,viewport:n})=>({cutoffPixels:i,align:[Ue[e],Ue[t]],fontSize:o,flipY:n?.flipY??!1}),uniformTypes:{cutoffPixels:`vec2<f32>`,align:`vec2<i32>`,fontSize:`f32`,flipY:`f32`}};var zo=`#version 300 es
|
|
3499
3499
|
#define SHADER_NAME multi-icon-layer-vertex-shader
|
|
3500
3500
|
in vec2 positions;
|
|
3501
3501
|
in vec3 instancePositions;
|
|
@@ -3619,7 +3619,7 @@ vColor = instanceColors;
|
|
|
3619
3619
|
DECKGL_FILTER_COLOR(vColor, geometry);
|
|
3620
3620
|
vColorMode = instanceColorModes;
|
|
3621
3621
|
}
|
|
3622
|
-
`;var
|
|
3622
|
+
`;var ko=`#version 300 es
|
|
3623
3623
|
#define SHADER_NAME multi-icon-layer-fragment-shader
|
|
3624
3624
|
precision highp float;
|
|
3625
3625
|
uniform sampler2D iconsTexture;
|
|
@@ -3650,7 +3650,7 @@ fragColor = vec4(color.rgb, a * layer.opacity);
|
|
|
3650
3650
|
}
|
|
3651
3651
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
3652
3652
|
}
|
|
3653
|
-
`;function
|
|
3653
|
+
`;function or({collision:i=!1}={}){return`struct IconUniforms {
|
|
3654
3654
|
sizeScale: f32,
|
|
3655
3655
|
iconsTextureDim: vec2<f32>,
|
|
3656
3656
|
sizeBasis: f32,
|
|
@@ -3676,7 +3676,7 @@ struct SdfUniforms {
|
|
|
3676
3676
|
outlineColor: vec4<f32>
|
|
3677
3677
|
};
|
|
3678
3678
|
|
|
3679
|
-
${
|
|
3679
|
+
${i?`struct CollisionUniforms {
|
|
3680
3680
|
sort: i32,
|
|
3681
3681
|
enabled: i32
|
|
3682
3682
|
};
|
|
@@ -3689,10 +3689,10 @@ const ALIGN_MODE_END: i32 = 3;
|
|
|
3689
3689
|
@group(0) @binding(auto) var<uniform> icon: IconUniforms;
|
|
3690
3690
|
@group(0) @binding(auto) var<uniform> text: TextUniforms;
|
|
3691
3691
|
@group(0) @binding(auto) var<uniform> sdf: SdfUniforms;
|
|
3692
|
-
${
|
|
3692
|
+
${i?`@group(0) @binding(auto) var<uniform> collision: CollisionUniforms;`:``}
|
|
3693
3693
|
@group(0) @binding(auto) var iconsTexture : texture_2d<f32>;
|
|
3694
3694
|
@group(0) @binding(auto) var iconsTextureSampler : sampler;
|
|
3695
|
-
${
|
|
3695
|
+
${i?`@group(0) @binding(auto) var collision_texture : texture_2d<f32>;
|
|
3696
3696
|
`:``}
|
|
3697
3697
|
|
|
3698
3698
|
fn rotate_by_angle(vertex: vec2<f32>, angle_deg: f32) -> vec2<f32> {
|
|
@@ -3730,7 +3730,7 @@ fn get_pixel_offset_from_alignment(
|
|
|
3730
3730
|
return 0.0;
|
|
3731
3731
|
}
|
|
3732
3732
|
|
|
3733
|
-
${
|
|
3733
|
+
${i?`fn collision_match(texCoords: vec2<f32>, pickingColor: vec3<f32>) -> f32 {
|
|
3734
3734
|
let textureSize = vec2<i32>(textureDimensions(collision_texture));
|
|
3735
3735
|
let pixelCoords = clamp(
|
|
3736
3736
|
vec2<i32>(texCoords * vec2<f32>(textureSize)),
|
|
@@ -3775,7 +3775,7 @@ struct Attributes {
|
|
|
3775
3775
|
@location(9) instancePixelOffset: vec2<f32>,
|
|
3776
3776
|
@location(10) rowIndexes: u32,
|
|
3777
3777
|
@location(11) instanceClipRect: vec4<f32>,
|
|
3778
|
-
${
|
|
3778
|
+
${i?`@location(12) collisionPriorities: f32,`:``}
|
|
3779
3779
|
};
|
|
3780
3780
|
|
|
3781
3781
|
struct Varyings {
|
|
@@ -3873,7 +3873,7 @@ fn vertexMain(inp: Attributes) -> Varyings {
|
|
|
3873
3873
|
}
|
|
3874
3874
|
}
|
|
3875
3875
|
|
|
3876
|
-
${
|
|
3876
|
+
${i?` if (collision.sort != 0) {
|
|
3877
3877
|
pos.z = -0.001 * inp.collisionPriorities * pos.w;
|
|
3878
3878
|
}
|
|
3879
3879
|
`:``}
|
|
@@ -3923,7 +3923,7 @@ fn fragmentMain(inp: Varyings) -> @location(0) vec4<f32> {
|
|
|
3923
3923
|
return vec4<f32>(inp.pickingColor, 1.0);
|
|
3924
3924
|
}
|
|
3925
3925
|
|
|
3926
|
-
${
|
|
3926
|
+
${i?` let collisionFade = collision_is_visible(inp.position.xy / project.viewportSize, inp.pickingColor);
|
|
3927
3927
|
a = a * collisionFade;
|
|
3928
3928
|
if (a <= 0.0001) {
|
|
3929
3929
|
discard;
|
|
@@ -3951,9 +3951,9 @@ fn fragmentMain(inp: Varyings) -> @location(0) vec4<f32> {
|
|
|
3951
3951
|
|
|
3952
3952
|
return fragColor;
|
|
3953
3953
|
}
|
|
3954
|
-
`}var
|
|
3955
|
-
`||C===a)&&(P=C),P>v){let x=d?
|
|
3956
|
-
`&&(l[v]=0,c[v]=0,f[v]=0,v++)}return
|
|
3954
|
+
`}var Do=or();var Ft=192/256;var nr={getIconOffsets:{type:`accessor`,value:i=>i.offsets},getContentBox:{type:`accessor`,value:[0,0,-1,-1]},fontSize:1,alphaCutoff:.001,smoothing:.1,outlineWidth:0,outlineColor:{type:`color`,value:[0,0,0,255]},contentCutoffPixels:{type:`array`,value:[0,0]},contentAlignHorizontal:`none`,contentAlignVertical:`none`};var Ve=class extends ge{getShaders(){let e=super.getShaders();return s(r({},e),{modules:[...e.modules,mt,Mo],vs:zo,fs:ko,source:Do})}initializeState(){super.initializeState();let e=this.getAttributeManager(),t=e.attributes.instanceIconDefs;t.settings.update=this.calculateInstanceIconDefs,e.addInstanced({rowIndexes:{type:`uint32`,size:1,bufferGroup:`icon-instance-data`,accessor:(o,{index:n})=>n},instanceClipRect:{size:4,bufferGroup:`icon-instance-data`,accessor:`getContentBox`,defaultValue:[0,0,-1,-1]}})}updateState(e){super.updateState(e);let{props:t,oldProps:o,changeFlags:n}=e,{outlineColor:s}=t;if(n.extensionsChanged){this.state.fillModel?.destroy();let r=this.context.device.type===`webgpu`?this._getModel(`${this.props.id}-fill`):void 0;this.setState({fillModel:r,models:r?[this.state.model,r]:[this.state.model]})}if(n.updateTriggersChanged&&(n.updateTriggersChanged.getIcon||n.updateTriggersChanged.getIconOffsets)&&this.getAttributeManager().invalidate(`instanceIconDefs`),s!==o.outlineColor){let r=[s[0]/255,s[1]/255,s[2]/255,(s[3]??255)/255];this.setState({outlineColor:r})}!t.sdf&&t.outlineWidth&&S.warn(`${this.id}: fontSettings.sdf is required to render outline`)()}draw(e){let{sdf:t,smoothing:o,fontSize:n,outlineWidth:s$9,contentCutoffPixels:r$10,contentAlignHorizontal:a,contentAlignVertical:l}=this.props,{outlineColor:c}=this.state,f=s$9?Math.max(o,Ft*(1-s$9)):-1,d=this.state.model,p={buffer:Ft,outlineBuffer:f,gamma:o,enabled:!!t,outlineColor:c},u={contentCutoffPixels:r$10,contentAlignHorizontal:a,contentAlignVertical:l,fontSize:n,viewport:this.context.viewport};if(d.shaderInputs.setProps({sdf:p,text:u}),super.draw(e),t&&s$9){let{iconManager:g}=this.state;if(g.getTexture()){let v=this.state.fillModel||d;v.shaderInputs.setProps({sdf:s(r({},p),{outlineBuffer:Ft}),text:u}),this._drawModel(v)}}}calculateInstanceIconDefs(e,{startRow:t,endRow:o}){let{data:n,getIcon:s,getIconOffsets:r}=this.props,a=e.getVertexOffset(t),l=e.value,{iterable:c,objectInfo:f}=Yr(n,t,o);for(let d of c){f.index++;let p=s(d,f),u=r(d,f);if(p){let g=0;for(let h of Array.from(p)){let v=super.getInstanceIconDef(h);v[0]=u[g*2],v[1]+=u[g*2+1],v[6]=1,l.set(v,a),a+=e.size,g++}}}}};Ve.defaultProps=nr;Ve.layerName=`MultiIconLayer`;var Nt=Ve;var Gt=new Float64Array(256);for(let i=0;i<256;i++){let e=.5-Math.pow(i/255,.45454545454545453);Gt[i]=e*Math.abs(e)}Gt[255]=-0x56bc75e2d63100000;var He=class{constructor({fontSize:e=24,buffer:t=3,radius:o=8,cutoff:n=.25,fontFamily:s=`sans-serif`,fontWeight:r=`normal`,fontStyle:a=`normal`,lang:l=null}={}){t=this.buffer=Math.round(t),this.radius=o,this.cutoff=n,this.lang=l;let c=this.size=Math.ceil(e)+t*4,f=this._createCanvas(c),d=this.ctx=f.getContext(`2d`,{willReadFrequently:!0});d.font=`${a} ${r} ${e}px ${s}`,d.textBaseline=`alphabetic`,d.textAlign=`left`,d.fillStyle=`black`,l&&(d.lang=l);let u=(this.maxGlyphDim=c-t)+2*t;this.gridOuter=new Float64Array(u*u),this.gridInner=new Float64Array(u*u),this.f=new Float64Array(u),this.z=new Float64Array(u+1),this.v=new Uint16Array(u)}_createCanvas(e){if(typeof OffscreenCanvas<`u`)return new OffscreenCanvas(e,e);let t=document.createElement(`canvas`);return t.width=t.height=e,t}draw(e){let{width:t,actualBoundingBoxAscent:o,actualBoundingBoxDescent:n,actualBoundingBoxLeft:s,actualBoundingBoxRight:r}=this.ctx.measureText(e),a=Math.ceil(o),l=Math.floor(-s),c=Math.max(0,Math.min(this.maxGlyphDim,Math.ceil(r)-l)),f=Math.max(0,Math.min(this.maxGlyphDim,a+Math.ceil(n))),d=c+2*this.buffer,p=f+2*this.buffer,u=d*p,g=new Uint8ClampedArray(u),h={data:g,width:d,height:p,glyphWidth:c,glyphHeight:f,glyphTop:a,glyphLeft:l,glyphAdvance:t};if(c===0||f===0)return h;let{ctx:v,buffer:P,gridInner:C,gridOuter:m}=this;v.clearRect(P,P,c,f),v.fillText(e,P-l,P+a);let x=v.getImageData(P,P,c,f);m.fill(0x56bc75e2d63100000,0,u),C.fill(0,0,u);let S=3;for(let F=0;F<f;F++){let A=(F+P)*d+P;for(let V=0;V<c;V++,S+=4,A++){let B=x.data[S];if(B===0)continue;let U=Gt[B];m[A]=Math.max(0,U),C[A]=Math.max(0,-U)}}Fo(m,0,0,d,p,d,this.f,this.v,this.z,P);let N=Math.min(P,1);Fo(C,P-N,P-N,c+2*N,f+2*N,d,this.f,this.v,this.z);let W=255/this.radius,j=255*(1-this.cutoff);for(let F=0;F<u;F++){let A=Math.sqrt(m[F])-Math.sqrt(C[F]);g[F]=j-W*A}return h}};function Fo(i,e,t,o,n,s,r,a,l,c=0){for(let f=e+c;f<e+o-c;f++)No(i,t*s+f,s,n,r,a,l);for(let f=t;f<t+n;f++)No(i,f*s+e,1,o,r,a,l)}function No(i,e,t,o,n,s,r){s[0]=0,r[0]=-0x56bc75e2d63100000,r[1]=0x56bc75e2d63100000,n[0]=i[e];for(let a=1,l=0;a<o;a++){let c=n[a]=i[e+a*t],f=a*a,d;do{let p=s[l];d=(c-n[p]+f-p*p)/(a-p)/2}while(d<=r[l]&&--l>-1);l++,s[l]=a,r[l]=d,r[l+1]=0x56bc75e2d63100000}for(let a=0,l=0;a<o;a++){for(;r[l+1]<a;)l++;let c=s[l],f=a-c;i[e+a*t]=n[c]+f*f}}var sr=32;var rr=[];function ar(i){return Math.pow(2,Math.ceil(Math.log2(i)))}function Go({characterSet:i,measureText:e,buffer:t,maxCanvasWidth:o,mapping:n={},xOffset:s=0,yOffsetMin:r=0,yOffsetMax:a=0}){let c=s,f=r,d=a;for(let p of i)if(!n[p]){let{advance:u,width:g,ascent:h,descent:v}=e(p),P=h+v;c+g+t*2>o&&(c=0,f=d),n[p]={x:c+t,y:f+t,width:g,height:P,advance:u,anchorX:g/2,anchorY:h},c+=g+t*2,d=Math.max(d,f+P+t*2)}return{mapping:n,xOffset:c,yOffsetMin:f,yOffsetMax:d,canvasHeight:ar(d)}}function jo(i,e,t,o){let n=0;for(let s=e;s<t;s++){let r=i[s];n+=o[r]?.advance||0}return n}function Bo(i,e,t,o,n,s){let r=e,a=0;for(let l=e;l<t;l++){let c=jo(i,l,l+1,n);a+c>o&&(r<l&&s.push(l),r=l,a=0),a+=c}return a}function lr(i,e,t,o,n,s){let r=e,a=e,l=e,c=0;for(let f=e;f<t;f++)if((i[f]===` `||i[f+1]===` `||f+1===t)&&(l=f+1),l>a){let d=jo(i,a,l,n);c+d>o&&(r<a&&(s.push(a),r=a,c=0),d>o&&(d=Bo(i,a,l,o,n,s),r=s[s.length-1])),a=l,c+=d}return c}function cr(i,e,t,o,n=0,s){s===void 0&&(s=i.length);let r=[];return e===`break-all`?Bo(i,n,s,t,o,r):lr(i,n,s,t,o,r),r}function fr(i,e,t,o,n,s){let r=0,a=0;for(let l=e;l<t;l++){let f=o[i[l]];f&&(a=Math.max(a,f.height))}for(let l=e;l<t;l++){let c=i[l],f=o[c];f?(n[l]=r+f.anchorX,r+=f.advance):(S.warn(`Missing character: ${c} (${c.codePointAt(0)})`)(),n[l]=r,r+=sr)}s[0]=r,s[1]=a}function Wo(i,e,t,o,n,s){let r=Array.from(i),a=r.length,l=new Array(a),c=new Array(a),f=new Array(a),d=(o===`break-word`||o===`break-all`)&&isFinite(n)&&n>0,p=[0,0],u=[0,0],g=0,h=e+t/2,v=0,P=0;for(let C=0;C<=a;C++){let m=r[C];if((m===`
|
|
3955
|
+
`||C===a)&&(P=C),P>v){let x=d?cr(r,o,n,s,v,P):rr;for(let S=0;S<=x.length;S++){let N=S===0?v:x[S-1],W=S<x.length?x[S]:P;fr(r,N,W,s,l,u);for(let j=N;j<W;j++)c[j]=h,f[j]=u[0];g++,h+=t,p[0]=Math.max(p[0],u[0])}v=P}m===`
|
|
3956
|
+
`&&(l[v]=0,c[v]=0,f[v]=0,v++)}return p[1]=g*t,{x:l,y:c,rowWidth:f,size:p}}function Uo({value:i,length:e,stride:t,offset:o,startIndices:n,characterSet:s}){let r=i.BYTES_PER_ELEMENT,a=t?t/r:1,l=o?o/r:0,c=n[e]||Math.ceil((i.length-l)/a),f=s&&new Set,d=new Array(e),p=i;if(a>1||l>0){let u=i.constructor;p=new u(c);for(let g=0;g<c;g++)p[g]=i[g*a+l]}for(let u=0;u<e;u++){let g=n[u],h=n[u+1]||c,v=p.subarray(g,h);d[u]=String.fromCodePoint.apply(null,v),f&&v.forEach(f.add,f)}if(f)for(let u of f)s.add(String.fromCodePoint(u));return{texts:d,characterCount:c}}var ae=class{constructor(e=5){this._cache={},this._order=[],this.limit=e}get(e){let t=this._cache[e];return t&&(this._deleteOrder(e),this._appendOrder(e)),t}set(e,t){this._cache[e]?(this.delete(e),this._cache[e]=t,this._appendOrder(e)):(Object.keys(this._cache).length===this.limit&&this.delete(this._order[0]),this._cache[e]=t,this._appendOrder(e))}delete(e){this._cache[e]&&(delete this._cache[e],this._deleteOrder(e))}_deleteOrder(e){let t=this._order.indexOf(e);t>=0&&this._order.splice(t,1)}_appendOrder(e){this._order.push(e)}};function dr(){let i=[];for(let e=32;e<128;e++)i.push(String.fromCharCode(e));return i}var q={fontFamily:`Monaco, monospace`,fontWeight:`normal`,characterSet:dr(),fontSize:64,buffer:4,sdf:!1,cutoff:.25,radius:12,smoothing:.1};var Vo=1024;var Ho=.9;var Zo=.3;var $o=3;var yt=new ae($o);function pr(i,e){let t;typeof e==`string`?t=new Set(Array.from(e)):t=new Set(e);let o=yt.get(i);if(!o)return t;for(let n in o.mapping)t.has(n)&&t.delete(n);return t}function ur(i,e){for(let t=0;t<i.length;t++)e.data[4*t+3]=i[t]}function Ko(i,e,t,o){i.font=`${o} ${t}px ${e}`,i.fillStyle=`#000`,i.textBaseline=`alphabetic`,i.textAlign=`left`}function gr(i,e,t){if(t===void 0){let n=i.measureText(`A`);return n.fontBoundingBoxAscent?{advance:0,width:0,ascent:Math.ceil(n.fontBoundingBoxAscent),descent:Math.ceil(n.fontBoundingBoxDescent)}:{advance:0,width:0,ascent:e*Ho,descent:e*Zo}}let o=i.measureText(t);return o.actualBoundingBoxAscent?{advance:o.width,width:Math.ceil(o.actualBoundingBoxRight-o.actualBoundingBoxLeft),ascent:Math.ceil(o.actualBoundingBoxAscent),descent:Math.ceil(o.actualBoundingBoxDescent)}:{advance:o.width,width:o.width,ascent:e*Ho,descent:e*Zo}}function Yo(i){S.assert(Number.isFinite(i)&&i>=$o,`Invalid cache limit`),yt=new ae(i)}var Ze=class{constructor(){this.props=r({},q)}get atlas(){return this._atlas}get mapping(){return this._atlas&&this._atlas.mapping}setProps(e={}){Object.assign(this.props,e),e._getFontRenderer&&(this._getFontRenderer=e._getFontRenderer),this._key=this._getKey();let t=pr(this._key,this.props.characterSet),o=yt.get(this._key);if(o&&t.size===0){this._atlas!==o&&(this._atlas=o);return}let n=this._generateFontAtlas(t,o);this._atlas=n,yt.set(this._key,n)}_generateFontAtlas(e,t){let{fontFamily:o,fontWeight:n,fontSize:s,buffer:r$11,sdf:a,radius:l,cutoff:c}=this.props,f=t&&t.data;f||(f=document.createElement(`canvas`),f.width=Vo);let d=f.getContext(`2d`,{willReadFrequently:!0});Ko(d,o,s,n);let p=x=>gr(d,s,x),u;this._getFontRenderer?u=this._getFontRenderer(this.props):a&&(u={measure:p,draw:hr(this.props)});let{mapping:g,canvasHeight:h,xOffset:v,yOffsetMin:P,yOffsetMax:C}=Go(r({measureText:x=>u?u.measure(x):p(x),buffer:r$11,characterSet:e,maxCanvasWidth:Vo},t&&{mapping:t.mapping,xOffset:t.xOffset,yOffsetMin:t.yOffsetMin,yOffsetMax:t.yOffsetMax}));if(f.height!==h){let x=f.height>0?d.getImageData(0,0,f.width,f.height):null;f.height=h,x&&d.putImageData(x,0,0)}if(Ko(d,o,s,n),u)for(let x of e){let S=g[x],N=S.width,{data:W,left:j=0,top:F=0}=u.draw(x),A=S.x-j,V=S.y-F,B=Math.max(0,Math.round(A)),U=Math.max(0,Math.round(V)),$=Math.min(W.width,f.width-B),Q=Math.min(W.height,f.height-U);d.putImageData(W,B,U,0,0,$,Q),S.x=B,S.y=U,S.width=$,S.height=Q,S.anchorX+=$/2-j-N/2,S.anchorY+=F}else for(let x of e){let S=g[x];d.fillText(x,S.x,S.y+S.anchorY)}let m=u?u.measure():p();return{baselineOffset:(m.ascent-m.descent)/2,xOffset:v,yOffsetMin:P,yOffsetMax:C,mapping:g,data:f,width:f.width,height:f.height}}_getKey(){let{fontFamily:e,fontWeight:t,fontSize:o,buffer:n,sdf:s,radius:r,cutoff:a}=this.props;return s?`${e} ${t} ${o} ${n} ${r} ${a}`:`${e} ${t} ${o} ${n}`}};function hr({fontSize:i,buffer:e,radius:t,cutoff:o,fontFamily:n,fontWeight:s}){let r=new He({fontSize:i,buffer:e,radius:t,cutoff:o,fontFamily:n,fontWeight:`${s}`});return a=>{let{data:l,width:c,height:f}=r.draw(a),d=new ImageData(c,f);return ur(l,d),{data:d,left:e,top:e}}}var xr=`struct TextBackgroundUniforms {
|
|
3957
3957
|
billboard: f32,
|
|
3958
3958
|
sizeScale: f32,
|
|
3959
3959
|
sizeMinPixels: f32,
|
|
@@ -3965,7 +3965,7 @@ fn fragmentMain(inp: Varyings) -> @location(0) vec4<f32> {
|
|
|
3965
3965
|
};
|
|
3966
3966
|
|
|
3967
3967
|
@group(0) @binding(auto) var<uniform> textBackground: TextBackgroundUniforms;
|
|
3968
|
-
`;var
|
|
3968
|
+
`;var Jo=`layout(std140) uniform textBackgroundUniforms {
|
|
3969
3969
|
bool billboard;
|
|
3970
3970
|
float sizeScale;
|
|
3971
3971
|
float sizeMinPixels;
|
|
@@ -3975,7 +3975,7 @@ fn fragmentMain(inp: Varyings) -> @location(0) vec4<f32> {
|
|
|
3975
3975
|
highp int sizeUnits;
|
|
3976
3976
|
bool stroked;
|
|
3977
3977
|
} textBackground;
|
|
3978
|
-
`;var
|
|
3978
|
+
`;var Xo={name:`textBackground`,source:xr,vs:Jo,fs:Jo,uniformTypes:{billboard:`f32`,sizeScale:`f32`,sizeMinPixels:`f32`,sizeMaxPixels:`f32`,borderRadius:`vec4<f32>`,padding:`vec4<f32>`,sizeUnits:`i32`,stroked:`f32`}};var qo=`#version 300 es
|
|
3979
3979
|
#define SHADER_NAME text-background-layer-vertex-shader
|
|
3980
3980
|
in vec2 positions;
|
|
3981
3981
|
in vec3 instancePositions;
|
|
@@ -4049,7 +4049,7 @@ DECKGL_FILTER_COLOR(vFillColor, geometry);
|
|
|
4049
4049
|
vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * layer.opacity);
|
|
4050
4050
|
DECKGL_FILTER_COLOR(vLineColor, geometry);
|
|
4051
4051
|
}
|
|
4052
|
-
`;var
|
|
4052
|
+
`;var Qo=`#version 300 es
|
|
4053
4053
|
#define SHADER_NAME text-background-layer-fragment-shader
|
|
4054
4054
|
precision highp float;
|
|
4055
4055
|
in vec4 vFillColor;
|
|
@@ -4102,7 +4102,7 @@ fragColor = vFillColor;
|
|
|
4102
4102
|
}
|
|
4103
4103
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
4104
4104
|
}
|
|
4105
|
-
`;var
|
|
4105
|
+
`;var en=`struct TextUniforms {
|
|
4106
4106
|
cutoffPixels: vec2<f32>,
|
|
4107
4107
|
align: vec2<i32>,
|
|
4108
4108
|
fontSize: f32,
|
|
@@ -4332,5 +4332,5 @@ fn fragmentMain(varyings: Varyings) -> @location(0) vec4<f32> {
|
|
|
4332
4332
|
|
|
4333
4333
|
return deckgl_premultiplied_alpha(fragColor);
|
|
4334
4334
|
}
|
|
4335
|
-
`;var hr={billboard:!0,sizeScale:1,sizeUnits:`pixels`,sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,fontSize:1,borderRadius:{type:`object`,value:0},padding:{type:`array`,value:[0,0,0,0]},getPosition:{type:`accessor`,value:t=>t.position},getSize:{type:`accessor`,value:1},getAngle:{type:`accessor`,value:0},getPixelOffset:{type:`accessor`,value:[0,0]},getBoundingRect:{type:`accessor`,value:[0,0,0,0]},getClipRect:{type:`accessor`,value:[0,0,-1,-1]},getFillColor:{type:`accessor`,value:[0,0,0,255]},getLineColor:{type:`accessor`,value:[0,0,0,255]},getLineWidth:{type:`accessor`,value:1}};var wt=(()=>{class t extends en$1{getShaders(){return super.getShaders({vs:No,fs:Go,source:Bo,modules:[Wa,ma,Ka,Fo,tt]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:`float64`,fp64:this.use64bitPositions(),transition:!0,accessor:`getPosition`},instanceSizes:{size:1,transition:!0,bufferGroup:`text-background-instance-data`,accessor:`getSize`,defaultValue:1},instanceAngles:{size:1,transition:!0,bufferGroup:`text-background-instance-data`,accessor:`getAngle`},instanceRects:{size:4,bufferGroup:`text-background-instance-data`,accessor:`getBoundingRect`},instanceClipRect:{size:4,bufferGroup:`text-background-instance-data`,accessor:`getClipRect`,defaultValue:[0,0,-1,-1]},instancePixelOffsets:{size:2,transition:!0,bufferGroup:`text-background-instance-data`,accessor:`getPixelOffset`},instanceFillColors:{size:4,transition:!0,type:`unorm8`,accessor:`getFillColor`,defaultValue:[0,0,0,255]},instanceLineColors:{size:4,transition:!0,type:`unorm8`,accessor:`getLineColor`,defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,bufferGroup:`text-background-instance-data`,accessor:`getLineWidth`,defaultValue:1}})}updateState(e){super.updateState(e);let{changeFlags:i}=e;i.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({uniforms:e}){let{billboard:i,sizeScale:n,sizeUnits:s,sizeMinPixels:r,sizeMaxPixels:a,getLineWidth:l,fontSize:c}=this.props,{padding:f,borderRadius:d}=this.props;f.length<4&&(f=[f[0],f[1],f[0],f[1]]),Array.isArray(d)||(d=[d,d,d,d]);let u=this.state.model,p={billboard:i,stroked:!!l,borderRadius:d,padding:f,sizeUnits:ee[s],sizeScale:n,sizeMinPixels:r,sizeMaxPixels:a},g={fontSize:c,viewport:this.context.viewport};u.shaderInputs.setProps({textBackground:p,text:g}),u.draw(this.context.renderPass)}_getModel(){return new De$1(this.context.device,s(r({},this.getShaders()),{id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new ne$1({topology:`triangle-strip`,vertexCount:4,attributes:{positions:{size:2,value:new Float32Array([0,0,1,0,0,1,1,1])}}}),isInstanced:!0}))}}return t.defaultProps=hr,t.layerName=`TextBackgroundLayer`,t})();var jo={start:1,middle:0,end:-1};var Wo={top:1,center:0,bottom:-1};var It=[0,0,0,255];var mr={billboard:!0,sizeScale:1,sizeUnits:`pixels`,sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,background:!1,getBackgroundColor:{type:`accessor`,value:[255,255,255,255]},getBorderColor:{type:`accessor`,value:It},getBorderWidth:{type:`accessor`,value:0},backgroundBorderRadius:{type:`object`,value:0},backgroundPadding:{type:`array`,value:[0,0,0,0]},characterSet:{type:`object`,value:q.characterSet},fontFamily:q.fontFamily,fontWeight:q.fontWeight,lineHeight:1,outlineWidth:{type:`number`,value:0,min:0},outlineColor:{type:`color`,value:It},fontSettings:{type:`object`,value:{},compare:1},wordBreak:`break-word`,maxWidth:{type:`number`,value:-1},contentCutoffPixels:{type:`array`,value:[0,0]},contentAlignHorizontal:`none`,contentAlignVertical:`none`,getText:{type:`accessor`,value:t=>t.text},getPosition:{type:`accessor`,value:t=>t.position},getColor:{type:`accessor`,value:It},getSize:{type:`accessor`,value:32},getAngle:{type:`accessor`,value:0},getTextAnchor:{type:`accessor`,value:`middle`},getAlignmentBaseline:{type:`accessor`,value:`center`},getPixelOffset:{type:`accessor`,value:[0,0]},getContentBox:{type:`accessor`,value:[0,0,-1,-1]},backgroundColor:{deprecatedFor:[`background`,`getBackgroundColor`]}};var At=(()=>{class t extends Dm{constructor(){super(...arguments),this.getBoundingRect=(e,i)=>{let{size:[n,s]}=this.transformParagraph(e,i),{getTextAnchor:r,getAlignmentBaseline:a}=this.props,l=jo[typeof r==`function`?r(e,i):r],c=Wo[typeof a==`function`?a(e,i):a];return[(l-1)*n/2,(c-1)*s/2,n,s]},this.getIconOffsets=(e,i)=>{let{getTextAnchor:n,getAlignmentBaseline:s}=this.props,{x:r,y:a,rowWidth:l,size:[,c]}=this.transformParagraph(e,i),f=jo[typeof n==`function`?n(e,i):n],d=Wo[typeof s==`function`?s(e,i):s],u=r.length,p=new Array(u*2),g=0;for(let h=0;h<u;h++)p[g++]=(f-1)*l[h]/2+r[h],p[g++]=(d-1)*c/2+a[h];return p}}initializeState(){this.state={styleVersion:0,fontAtlasManager:new nt},this.props.maxWidth>0&&A.once(1,`v8.9 breaking change: TextLayer maxWidth is now relative to text size`)()}updateState(e){let{props:i,oldProps:n,changeFlags:s}=e;(s.dataChanged||s.updateTriggersChanged&&(s.updateTriggersChanged.all||s.updateTriggersChanged.getText))&&this._updateText(),(this._updateFontAtlas()||i.lineHeight!==n.lineHeight||i.wordBreak!==n.wordBreak||i.maxWidth!==n.maxWidth)&&this.setState({styleVersion:this.state.styleVersion+1})}getPickingInfo({info:e}){return e.object=e.index>=0?this.props.data[e.index]:null,e}_updateFontAtlas(){let{fontSettings:e,fontFamily:i,fontWeight:n,_getFontRenderer:s$10}=this.props,{fontAtlasManager:r$13,characterSet:a}=this.state,l=s(r({},e),{characterSet:a,fontFamily:i,fontWeight:n,_getFontRenderer:s$10});if(!r$13.mapping)return r$13.setProps(l),!0;for(let c in l)if(l[c]!==r$13.props[c])return r$13.setProps(l),!0;return!1}_updateText(){let{data:e,characterSet:i}=this.props,n=e.attributes?.getText,{getText:s$11}=this.props,r$14=e.startIndices,a,l=i===`auto`&&new Set;if(n&&r$14){let{texts:c,characterCount:f}=Eo(s(r({},ArrayBuffer.isView(n)?{value:n}:n),{length:e.length,startIndices:r$14,characterSet:l}));a=f,s$11=(d,{index:u})=>c[u]}else{let{iterable:c,objectInfo:f}=Ar(e);r$14=[0],a=0;for(let d of c){f.index++;let u=Array.from(s$11(d,f)||``);l&&u.forEach(l.add,l),a+=u.length,r$14.push(a)}}this.setState({getText:s$11,startIndices:r$14,numInstances:a,characterSet:l||i})}transformParagraph(e,i){let{fontAtlasManager:n}=this.state,s=n.mapping,{baselineOffset:r}=n.atlas,{fontSize:a}=n.props,l=this.state.getText,{wordBreak:c,lineHeight:f,maxWidth:d}=this.props;return Ao(l(e,i)||``,r,f*a,c,d*a,s)}renderLayers(){let{startIndices:e,numInstances:i,getText:n,fontAtlasManager:{atlas:s,mapping:r},styleVersion:a}=this.state,{data:l,_dataDiff:c,getPosition:f,getColor:d,getSize:u,getAngle:p,getPixelOffset:g,getBackgroundColor:h,getBorderColor:v,getBorderWidth:P,getContentBox:C,backgroundBorderRadius:m,backgroundPadding:x,background:L,billboard:N,fontSettings:G,outlineWidth:j,outlineColor:F,sizeScale:U,sizeUnits:D,sizeMinPixels:V,sizeMaxPixels:W,contentCutoffPixels:H,contentAlignHorizontal:Q,contentAlignVertical:lt,transitions:k,updateTriggers:I}=this.props,ct=this.getSubLayerClass(`characters`,St),$o=this.getSubLayerClass(`background`,wt),{fontSize:Tt}=this.state.fontAtlasManager.props;return[L&&new $o({getFillColor:h,getLineColor:v,getLineWidth:P,borderRadius:m,padding:x,getPosition:f,getSize:u,getAngle:p,getPixelOffset:g,getClipRect:C,billboard:N,sizeScale:U,sizeUnits:D,sizeMinPixels:V,sizeMaxPixels:W,fontSize:Tt,transitions:k&&{getPosition:k.getPosition,getAngle:k.getAngle,getSize:k.getSize,getFillColor:k.getBackgroundColor,getLineColor:k.getBorderColor,getLineWidth:k.getBorderWidth,getPixelOffset:k.getPixelOffset}},this.getSubLayerProps({id:`background`,updateTriggers:{getPosition:I.getPosition,getAngle:I.getAngle,getSize:I.getSize,getFillColor:I.getBackgroundColor,getLineColor:I.getBorderColor,getLineWidth:I.getBorderWidth,getPixelOffset:I.getPixelOffset,getBoundingRect:{getText:I.getText,getTextAnchor:I.getTextAnchor,getAlignmentBaseline:I.getAlignmentBaseline,styleVersion:a}}}),{data:l.attributes&&l.attributes.background?{length:l.length,attributes:l.attributes.background}:l,_dataDiff:c,autoHighlight:!1,getBoundingRect:this.getBoundingRect}),new ct({sdf:G.sdf,smoothing:Number.isFinite(G.smoothing)?G.smoothing:q.smoothing,outlineWidth:j/(G.radius||q.radius),outlineColor:F,iconAtlas:s,iconMapping:r,getPosition:f,getColor:d,getSize:u,getAngle:p,getPixelOffset:g,getContentBox:C,billboard:N,sizeScale:U,sizeUnits:D,sizeMinPixels:V,sizeMaxPixels:W,fontSize:Tt,contentCutoffPixels:H,contentAlignHorizontal:Q,contentAlignVertical:lt,transitions:k&&{getPosition:k.getPosition,getAngle:k.getAngle,getColor:k.getColor,getSize:k.getSize,getPixelOffset:k.getPixelOffset,getContentBox:k.getContentBox}},this.getSubLayerProps({id:`characters`,updateTriggers:{all:I.getText,getPosition:I.getPosition,getAngle:I.getAngle,getColor:I.getColor,getSize:I.getSize,getPixelOffset:I.getPixelOffset,getContentBox:I.getContentBox,getIconOffsets:{getTextAnchor:I.getTextAnchor,getAlignmentBaseline:I.getAlignmentBaseline,styleVersion:a}}}),{data:l,_dataDiff:c,startIndices:e,numInstances:i,getIconOffsets:this.getIconOffsets,getIcon:n})]}static set fontAtlasCacheLimit(e){ko(e)}}return t.defaultProps=mr,t.layerName=`TextLayer`,t})();var Ee={circle:{type:ut,props:{filled:`filled`,stroked:`stroked`,lineWidthMaxPixels:`lineWidthMaxPixels`,lineWidthMinPixels:`lineWidthMinPixels`,lineWidthScale:`lineWidthScale`,lineWidthUnits:`lineWidthUnits`,pointRadiusMaxPixels:`radiusMaxPixels`,pointRadiusMinPixels:`radiusMinPixels`,pointRadiusScale:`radiusScale`,pointRadiusUnits:`radiusUnits`,pointAntialiasing:`antialiasing`,pointBillboard:`billboard`,getFillColor:`getFillColor`,getLineColor:`getLineColor`,getLineWidth:`getLineWidth`,getPointRadius:`getRadius`}},icon:{type:ce,props:{iconAtlas:`iconAtlas`,iconMapping:`iconMapping`,iconSizeMaxPixels:`sizeMaxPixels`,iconSizeMinPixels:`sizeMinPixels`,iconSizeScale:`sizeScale`,iconSizeUnits:`sizeUnits`,iconAlphaCutoff:`alphaCutoff`,iconBillboard:`billboard`,getIcon:`getIcon`,getIconAngle:`getAngle`,getIconColor:`getColor`,getIconPixelOffset:`getPixelOffset`,getIconSize:`getSize`}},text:{type:At,props:{textSizeMaxPixels:`sizeMaxPixels`,textSizeMinPixels:`sizeMinPixels`,textSizeScale:`sizeScale`,textSizeUnits:`sizeUnits`,textBackground:`background`,textBackgroundPadding:`backgroundPadding`,textFontFamily:`fontFamily`,textFontWeight:`fontWeight`,textLineHeight:`lineHeight`,textMaxWidth:`maxWidth`,textOutlineColor:`outlineColor`,textOutlineWidth:`outlineWidth`,textWordBreak:`wordBreak`,textCharacterSet:`characterSet`,textBillboard:`billboard`,textFontSettings:`fontSettings`,getText:`getText`,getTextAngle:`getAngle`,getTextColor:`getColor`,getTextPixelOffset:`getPixelOffset`,getTextSize:`getSize`,getTextAnchor:`getTextAnchor`,getTextAlignmentBaseline:`getAlignmentBaseline`,getTextBackgroundColor:`getBackgroundColor`,getTextBorderColor:`getBorderColor`,getTextBorderWidth:`getBorderWidth`}}};var Te={type:_e,props:{lineWidthUnits:`widthUnits`,lineWidthScale:`widthScale`,lineWidthMinPixels:`widthMinPixels`,lineWidthMaxPixels:`widthMaxPixels`,lineJointRounded:`jointRounded`,lineCapRounded:`capRounded`,lineMiterLimit:`miterLimit`,lineBillboard:`billboard`,lineAntialiasing:`antialiasing`,getLineColor:`getColor`,getLineWidth:`getWidth`}};var st={type:we,props:{extruded:`extruded`,filled:`filled`,wireframe:`wireframe`,elevationScale:`elevationScale`,material:`material`,_full3d:`_full3d`,getElevation:`getElevation`,getFillColor:`getFillColor`,getLineColor:`getLineColor`}};function ae({type:t,props:o}){let e={};for(let i in o)e[i]=t.defaultProps[o[i]];return e}function rt(t,o){let{transitions:e,updateTriggers:i}=t.props,n={updateTriggers:{},transitions:e&&{getPosition:e.geometry}};for(let s in o){let r=o[s],a=t.props[s];s.startsWith(`get`)&&(a=t.getSubLayerAccessor(a),n.updateTriggers[r]=i[s],e&&(n.transitions[r]=e[s])),n[r]=a}return n}function Vo(t){if(Array.isArray(t))return t;switch(A.assert(t.type,`GeoJSON does not have type`),t.type){case`Feature`:return[t];case`FeatureCollection`:return A.assert(Array.isArray(t.features),`GeoJSON does not have features array`),t.features;default:return[{geometry:t}]}}function Et(t,o,e={}){let i={pointFeatures:[],lineFeatures:[],polygonFeatures:[],polygonOutlineFeatures:[]},{startRow:n=0,endRow:s=t.length}=e;for(let r=n;r<s;r++){let a=t[r],{geometry:l}=a;if(l)if(l.type===`GeometryCollection`){A.assert(Array.isArray(l.geometries),`GeoJSON does not have geometries array`);let{geometries:c}=l;for(let f=0;f<c.length;f++){let d=c[f];Uo(d,i,o,a,r)}}else Uo(l,i,o,a,r)}return i}function Uo(t,o,e,i,n){let{type:s,coordinates:r}=t,{pointFeatures:a,lineFeatures:l,polygonFeatures:c,polygonOutlineFeatures:f}=o;if(!_r(s,r)){A.warn(`${s} coordinates are malformed`)();return}switch(s){case`Point`:a.push(e({geometry:t},i,n));break;case`MultiPoint`:r.forEach(d=>{a.push(e({geometry:{type:`Point`,coordinates:d}},i,n))});break;case`LineString`:l.push(e({geometry:t},i,n));break;case`MultiLineString`:r.forEach(d=>{l.push(e({geometry:{type:`LineString`,coordinates:d}},i,n))});break;case`Polygon`:c.push(e({geometry:t},i,n)),r.forEach(d=>{f.push(e({geometry:{type:`LineString`,coordinates:d}},i,n))});break;case`MultiPolygon`:r.forEach(d=>{c.push(e({geometry:{type:`Polygon`,coordinates:d}},i,n)),d.forEach(u=>{f.push(e({geometry:{type:`LineString`,coordinates:u}},i,n))})});break;default:}}var Pr={Point:1,MultiPoint:2,LineString:2,MultiLineString:3,Polygon:3,MultiPolygon:4};function _r(t,o){let e=Pr[t];for(A.assert(e,`Unknown GeoJSON type ${t}`);o&&--e>0;)o=o[0];return o&&Number.isFinite(o[0])}function Ho(){return{points:{},lines:{},polygons:{},polygonsOutline:{}}}function at(t){return t.geometry.coordinates}function Zo(t,o){let e=Ho(),{pointFeatures:i,lineFeatures:n,polygonFeatures:s,polygonOutlineFeatures:r}=t;return e.points.data=i,e.points._dataDiff=o.pointFeatures&&(()=>o.pointFeatures),e.points.getPosition=at,e.lines.data=n,e.lines._dataDiff=o.lineFeatures&&(()=>o.lineFeatures),e.lines.getPath=at,e.polygons.data=s,e.polygons._dataDiff=o.polygonFeatures&&(()=>o.polygonFeatures),e.polygons.getPolygon=at,e.polygonsOutline.data=r,e.polygonsOutline._dataDiff=o.polygonOutlineFeatures&&(()=>o.polygonOutlineFeatures),e.polygonsOutline.getPath=at,e}function Ko(t){let o=Ho(),{points:e,lines:i,polygons:n}=t,s$12=vo(t);o.points.data={length:e.positions.value.length/e.positions.size,attributes:s(r({},e.attributes),{getPosition:e.positions,rowIndexes:{size:1,type:`uint32`,value:s$12.points}}),properties:e.properties,numericProps:e.numericProps,featureIds:e.featureIds},o.lines.data={length:i.pathIndices.value.length-1,startIndices:i.pathIndices.value,attributes:s(r({},i.attributes),{getPath:i.positions,rowIndexes:{size:1,type:`uint32`,value:s$12.lines}}),properties:i.properties,numericProps:i.numericProps,featureIds:i.featureIds},o.lines._pathType=`open`;let r$15=n.positions.value.length/n.positions.size,a=Array(r$15).fill(1);for(let l of n.primitivePolygonIndices.value)a[l-1]=0;return o.polygons.data={length:n.polygonIndices.value.length-1,startIndices:n.polygonIndices.value,attributes:s(r({},n.attributes),{getPolygon:n.positions,instanceVertexValid:{size:1,value:new Uint16Array(a)},rowIndexes:{size:1,type:`uint32`,value:s$12.polygons}}),properties:n.properties,numericProps:n.numericProps,featureIds:n.featureIds},o.polygons._normalize=!1,n.triangles&&(o.polygons.data.attributes.indices=n.triangles.value),o.polygonsOutline.data={length:n.primitivePolygonIndices.value.length-1,startIndices:n.primitivePolygonIndices.value,attributes:s(r({},n.attributes),{getPath:n.positions,rowIndexes:{size:1,type:`uint32`,value:s$12.polygons}}),properties:n.properties,numericProps:n.numericProps,featureIds:n.featureIds},o.polygonsOutline._pathType=`open`,o}var Cr=[`points`,`linestrings`,`polygons`];var Lr=s(r(r(r(r(r({},ae(Ee.circle)),ae(Ee.icon)),ae(Ee.text)),ae(Te)),ae(st)),{stroked:!0,filled:!0,extruded:!1,wireframe:!1,_full3d:!1,iconAtlas:{type:`object`,value:null},iconMapping:{type:`object`,value:{}},getIcon:{type:`accessor`,value:t=>t.properties.icon},getText:{type:`accessor`,value:t=>t.properties.text},pointType:`circle`,getRadius:{deprecatedFor:`getPointRadius`}});var br=(()=>{class t extends Dm{initializeState(){this.state={layerProps:{},features:{},featuresDiff:{}}}updateState({props:e,changeFlags:i}){if(!i.dataChanged)return;let{data:n}=this.props,s=n&&`points`in n&&`polygons`in n&&`lines`in n;this.setState({binary:s}),s?this._updateStateBinary({props:e,changeFlags:i}):this._updateStateJSON({props:e,changeFlags:i})}_updateStateBinary({props:e,changeFlags:i}){let n=Ko(e.data);this.setState({layerProps:n})}_updateStateJSON({props:e,changeFlags:i}){let n=Vo(e.data),s=this.getSubLayerRow.bind(this),r={},a={};if(Array.isArray(i.dataChanged)){let c=this.state.features;for(let f in c)r[f]=c[f].slice(),a[f]=[];for(let f of i.dataChanged){let d=Et(n,s,f);for(let u in c)a[u].push(et({data:r[u],getIndex:p=>p.__source.index,dataRange:f,replace:d[u]}))}}else r=Et(n,s);let l=Zo(r,a);this.setState({features:r,featuresDiff:a,layerProps:l})}getPickingInfo(e){let i=super.getPickingInfo(e),{index:n,sourceLayer:s}=i;return i.featureType=Cr.find(r=>s.id.startsWith(`${this.id}-${r}-`)),n>=0&&s.id.startsWith(`${this.id}-points-text`)&&this.state.binary&&(i.index=this.props.data.points.globalFeatureIds.value[n]),i}_updateAutoHighlight(e){let i=`${this.id}-points-`,n=e.featureType===`points`;for(let s of this.getSubLayers())s.id.startsWith(i)===n&&s.updateAutoHighlight(e)}_renderPolygonLayer(){let{extruded:e,wireframe:i}=this.props,{layerProps:n}=this.state,s=`polygons-fill`,r=this.shouldRenderSubLayer(s,n.polygons?.data)&&this.getSubLayerClass(s,st.type);if(r){let a=rt(this,st.props),l=e&&i;return l||delete a.getLineColor,a.updateTriggers.lineColors=l,new r(a,this.getSubLayerProps({id:s,updateTriggers:a.updateTriggers}),n.polygons)}return null}_renderLineLayers(){let{extruded:e,stroked:i}=this.props,{layerProps:n}=this.state,s=`polygons-stroke`,r=`linestrings`,a=!e&&i&&this.shouldRenderSubLayer(s,n.polygonsOutline?.data)&&this.getSubLayerClass(s,Te.type),l=this.shouldRenderSubLayer(r,n.lines?.data)&&this.getSubLayerClass(r,Te.type);if(a||l){let c=rt(this,Te.props);return[a&&new a(c,this.getSubLayerProps({id:s,updateTriggers:c.updateTriggers}),n.polygonsOutline),l&&new l(c,this.getSubLayerProps({id:r,updateTriggers:c.updateTriggers}),n.lines)]}return null}_renderPointLayers(){let{pointType:e}=this.props,{layerProps:i,binary:n}=this.state,{highlightedObjectIndex:s$13}=this.props;!n&&Number.isFinite(s$13)&&(s$13=i.points.data.findIndex(c=>c.__source.index===s$13));let r$16=new Set(e.split(`+`)),a=[];for(let c of r$16){let f=`points-${c}`,d=Ee[c],u$1=d&&this.shouldRenderSubLayer(f,i.points?.data)&&this.getSubLayerClass(f,d.type);if(u$1){let p=rt(this,d.props),g=i.points;if(c===`text`&&n){let l=g.data.attributes,{rowIndexes:h}=l,v=u(l,[`rowIndexes`]);g=s(r({},g),{data:s(r({},g.data),{attributes:v})})}a.push(new u$1(p,this.getSubLayerProps({id:f,updateTriggers:p.updateTriggers,highlightedObjectIndex:s$13}),g))}}return a}renderLayers(){let{extruded:e}=this.props,i=this._renderPolygonLayer(),n=this._renderLineLayers(),s=this._renderPointLayers();return[!e&&i,n,s,e&&i]}getSubLayerAccessor(e){let{binary:i}=this.state;return!i||typeof e!=`function`?super.getSubLayerAccessor(e):(n,s)=>{let{data:r,index:a}=s;return e(xo(r,a),s)}}}return t.layerName=`GeoJsonLayer`,t.defaultProps=Lr,t})();export{xt as _,Xs as a,ce as c,fn as d,ut as f,xs as g,wt as h,Tn as i,de as l,wn as m,Nn as n,_e as o,we as p,St as r,br as s,At as t,en as u};
|
|
4336
|
-
//# debugId=
|
|
4335
|
+
`;var vr={billboard:!0,sizeScale:1,sizeUnits:`pixels`,sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,fontSize:1,borderRadius:{type:`object`,value:0},padding:{type:`array`,value:[0,0,0,0]},getPosition:{type:`accessor`,value:i=>i.position},getSize:{type:`accessor`,value:1},getAngle:{type:`accessor`,value:0},getPixelOffset:{type:`accessor`,value:[0,0]},getBoundingRect:{type:`accessor`,value:[0,0,0,0]},getClipRect:{type:`accessor`,value:[0,0,-1,-1]},getFillColor:{type:`accessor`,value:[0,0,0,255]},getLineColor:{type:`accessor`,value:[0,0,0,255]},getLineWidth:{type:`accessor`,value:1}};var Ke=class extends ao{getShaders(){return super.getShaders({vs:qo,fs:Qo,source:en,modules:[Wa,ma,Ka,Xo,mt]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:`float64`,fp64:this.use64bitPositions(),transition:!0,accessor:`getPosition`},instanceSizes:{size:1,transition:!0,bufferGroup:`text-background-instance-data`,accessor:`getSize`,defaultValue:1},instanceAngles:{size:1,transition:!0,bufferGroup:`text-background-instance-data`,accessor:`getAngle`},instanceRects:{size:4,bufferGroup:`text-background-instance-data`,accessor:`getBoundingRect`},instanceClipRect:{size:4,bufferGroup:`text-background-instance-data`,accessor:`getClipRect`,defaultValue:[0,0,-1,-1]},instancePixelOffsets:{size:2,transition:!0,bufferGroup:`text-background-instance-data`,accessor:`getPixelOffset`},instanceFillColors:{size:4,transition:!0,type:`unorm8`,accessor:`getFillColor`,defaultValue:[0,0,0,255]},instanceLineColors:{size:4,transition:!0,type:`unorm8`,accessor:`getLineColor`,defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,bufferGroup:`text-background-instance-data`,accessor:`getLineWidth`,defaultValue:1}})}updateState(e){super.updateState(e);let{changeFlags:t}=e;t.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({uniforms:e}){let{billboard:t,sizeScale:o,sizeUnits:n,sizeMinPixels:s,sizeMaxPixels:r,getLineWidth:a,fontSize:l}=this.props,{padding:c,borderRadius:f}=this.props;c.length<4&&(c=[c[0],c[1],c[0],c[1]]),Array.isArray(f)||(f=[f,f,f,f]);let d=this.state.model,p={billboard:t,stroked:!!a,borderRadius:f,padding:c,sizeUnits:ee[n],sizeScale:o,sizeMinPixels:s,sizeMaxPixels:r},u={fontSize:l,viewport:this.context.viewport};d.shaderInputs.setProps({textBackground:p,text:u}),d.draw(this.context.renderPass)}_getModel(){return new De(this.context.device,s(r({},this.getShaders()),{id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new re$1({topology:`triangle-strip`,vertexCount:4,attributes:{positions:{size:2,value:new Float32Array([0,0,1,0,0,1,1,1])}}}),isInstanced:!0}))}};Ke.defaultProps=vr;Ke.layerName=`TextBackgroundLayer`;var jt=Ke;var tn={start:1,middle:0,end:-1};var on={top:1,center:0,bottom:-1};var Bt=[0,0,0,255];var yr={billboard:!0,sizeScale:1,sizeUnits:`pixels`,sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,background:!1,getBackgroundColor:{type:`accessor`,value:[255,255,255,255]},getBorderColor:{type:`accessor`,value:Bt},getBorderWidth:{type:`accessor`,value:0},backgroundBorderRadius:{type:`object`,value:0},backgroundPadding:{type:`array`,value:[0,0,0,0]},characterSet:{type:`object`,value:q.characterSet},fontFamily:q.fontFamily,fontWeight:q.fontWeight,lineHeight:1,outlineWidth:{type:`number`,value:0,min:0},outlineColor:{type:`color`,value:Bt},fontSettings:{type:`object`,value:{},compare:1},wordBreak:`break-word`,maxWidth:{type:`number`,value:-1},contentCutoffPixels:{type:`array`,value:[0,0]},contentAlignHorizontal:`none`,contentAlignVertical:`none`,getText:{type:`accessor`,value:i=>i.text},getPosition:{type:`accessor`,value:i=>i.position},getColor:{type:`accessor`,value:Bt},getSize:{type:`accessor`,value:32},getAngle:{type:`accessor`,value:0},getTextAnchor:{type:`accessor`,value:`middle`},getAlignmentBaseline:{type:`accessor`,value:`center`},getPixelOffset:{type:`accessor`,value:[0,0]},getContentBox:{type:`accessor`,value:[0,0,-1,-1]},backgroundColor:{deprecatedFor:[`background`,`getBackgroundColor`]}};var $e=class extends _m{constructor(){super(...arguments),this.getBoundingRect=(e,t)=>{let{size:[o,n]}=this.transformParagraph(e,t),{getTextAnchor:s,getAlignmentBaseline:r}=this.props,a=tn[typeof s==`function`?s(e,t):s],l=on[typeof r==`function`?r(e,t):r];return[(a-1)*o/2,(l-1)*n/2,o,n]},this.getIconOffsets=(e,t)=>{let{getTextAnchor:o,getAlignmentBaseline:n}=this.props,{x:s,y:r,rowWidth:a,size:[,l]}=this.transformParagraph(e,t),c=tn[typeof o==`function`?o(e,t):o],f=on[typeof n==`function`?n(e,t):n],d=s.length,p=new Array(d*2),u=0;for(let g=0;g<d;g++)p[u++]=(c-1)*a[g]/2+s[g],p[u++]=(f-1)*l/2+r[g];return p}}initializeState(){this.state={styleVersion:0,fontAtlasManager:new Ze},this.props.maxWidth>0&&S.once(1,`v8.9 breaking change: TextLayer maxWidth is now relative to text size`)()}updateState(e){let{props:t,oldProps:o,changeFlags:n}=e;(n.dataChanged||n.updateTriggersChanged&&(n.updateTriggersChanged.all||n.updateTriggersChanged.getText))&&this._updateText(),(this._updateFontAtlas()||t.lineHeight!==o.lineHeight||t.wordBreak!==o.wordBreak||t.maxWidth!==o.maxWidth)&&this.setState({styleVersion:this.state.styleVersion+1})}getPickingInfo({info:e}){return e.object=e.index>=0?this.props.data[e.index]:null,e}_updateFontAtlas(){let{fontSettings:e,fontFamily:t,fontWeight:o,_getFontRenderer:n}=this.props,{fontAtlasManager:s$10,characterSet:r$12}=this.state,a=s(r({},e),{characterSet:r$12,fontFamily:t,fontWeight:o,_getFontRenderer:n});if(!s$10.mapping)return s$10.setProps(a),!0;for(let l in a)if(a[l]!==s$10.props[l])return s$10.setProps(a),!0;return!1}_updateText(){let{data:e,characterSet:t}=this.props,o=e.attributes?.getText,{getText:n}=this.props,s$11=e.startIndices,r$13,a=t===`auto`&&new Set;if(o&&s$11){let{texts:l,characterCount:c}=Uo(s(r({},ArrayBuffer.isView(o)?{value:o}:o),{length:e.length,startIndices:s$11,characterSet:a}));r$13=c,n=(f,{index:d})=>l[d]}else{let{iterable:l,objectInfo:c}=Yr(e);s$11=[0],r$13=0;for(let f of l){c.index++;let d=Array.from(n(f,c)||``);a&&d.forEach(a.add,a),r$13+=d.length,s$11.push(r$13)}}this.setState({getText:n,startIndices:s$11,numInstances:r$13,characterSet:a||t})}transformParagraph(e,t){let{fontAtlasManager:o}=this.state,n=o.mapping,{baselineOffset:s}=o.atlas,{fontSize:r}=o.props,a=this.state.getText,{wordBreak:l,lineHeight:c,maxWidth:f}=this.props;return Wo(a(e,t)||``,s,c*r,l,f*r,n)}renderLayers(){let{startIndices:e,numInstances:t,getText:o,fontAtlasManager:{atlas:n,mapping:s},styleVersion:r}=this.state,{data:a,_dataDiff:l,getPosition:c,getColor:f,getSize:d,getAngle:p,getPixelOffset:u,getBackgroundColor:g,getBorderColor:h,getBorderWidth:v,getContentBox:P,backgroundBorderRadius:C,backgroundPadding:m,background:x,billboard:S,fontSettings:N,outlineWidth:W,outlineColor:j,sizeScale:F,sizeUnits:A,sizeMinPixels:V,sizeMaxPixels:B,contentCutoffPixels:U,contentAlignHorizontal:$,contentAlignVertical:Q,transitions:D,updateTriggers:I}=this.props,St=this.getSubLayerClass(`characters`,Nt),cn=this.getSubLayerClass(`background`,jt),{fontSize:Vt}=this.state.fontAtlasManager.props;return[x&&new cn({getFillColor:g,getLineColor:h,getLineWidth:v,borderRadius:C,padding:m,getPosition:c,getSize:d,getAngle:p,getPixelOffset:u,getClipRect:P,billboard:S,sizeScale:F,sizeUnits:A,sizeMinPixels:V,sizeMaxPixels:B,fontSize:Vt,transitions:D&&{getPosition:D.getPosition,getAngle:D.getAngle,getSize:D.getSize,getFillColor:D.getBackgroundColor,getLineColor:D.getBorderColor,getLineWidth:D.getBorderWidth,getPixelOffset:D.getPixelOffset}},this.getSubLayerProps({id:`background`,updateTriggers:{getPosition:I.getPosition,getAngle:I.getAngle,getSize:I.getSize,getFillColor:I.getBackgroundColor,getLineColor:I.getBorderColor,getLineWidth:I.getBorderWidth,getPixelOffset:I.getPixelOffset,getBoundingRect:{getText:I.getText,getTextAnchor:I.getTextAnchor,getAlignmentBaseline:I.getAlignmentBaseline,styleVersion:r}}}),{data:a.attributes&&a.attributes.background?{length:a.length,attributes:a.attributes.background}:a,_dataDiff:l,autoHighlight:!1,getBoundingRect:this.getBoundingRect}),new St({sdf:N.sdf,smoothing:Number.isFinite(N.smoothing)?N.smoothing:q.smoothing,outlineWidth:W/(N.radius||q.radius),outlineColor:j,iconAtlas:n,iconMapping:s,getPosition:c,getColor:f,getSize:d,getAngle:p,getPixelOffset:u,getContentBox:P,billboard:S,sizeScale:F,sizeUnits:A,sizeMinPixels:V,sizeMaxPixels:B,fontSize:Vt,contentCutoffPixels:U,contentAlignHorizontal:$,contentAlignVertical:Q,transitions:D&&{getPosition:D.getPosition,getAngle:D.getAngle,getColor:D.getColor,getSize:D.getSize,getPixelOffset:D.getPixelOffset,getContentBox:D.getContentBox}},this.getSubLayerProps({id:`characters`,updateTriggers:{all:I.getText,getPosition:I.getPosition,getAngle:I.getAngle,getColor:I.getColor,getSize:I.getSize,getPixelOffset:I.getPixelOffset,getContentBox:I.getContentBox,getIconOffsets:{getTextAnchor:I.getTextAnchor,getAlignmentBaseline:I.getAlignmentBaseline,styleVersion:r}}}),{data:a,_dataDiff:l,startIndices:e,numInstances:t,getIconOffsets:this.getIconOffsets,getIcon:o})]}static set fontAtlasCacheLimit(e){Yo(e)}};$e.defaultProps=yr;$e.layerName=`TextLayer`;var Wt=$e;var Ye={circle:{type:wt,props:{filled:`filled`,stroked:`stroked`,lineWidthMaxPixels:`lineWidthMaxPixels`,lineWidthMinPixels:`lineWidthMinPixels`,lineWidthScale:`lineWidthScale`,lineWidthUnits:`lineWidthUnits`,pointRadiusMaxPixels:`radiusMaxPixels`,pointRadiusMinPixels:`radiusMinPixels`,pointRadiusScale:`radiusScale`,pointRadiusUnits:`radiusUnits`,pointAntialiasing:`antialiasing`,pointBillboard:`billboard`,getFillColor:`getFillColor`,getLineColor:`getLineColor`,getLineWidth:`getLineWidth`,getPointRadius:`getRadius`}},icon:{type:ge,props:{iconAtlas:`iconAtlas`,iconMapping:`iconMapping`,iconSizeMaxPixels:`sizeMaxPixels`,iconSizeMinPixels:`sizeMinPixels`,iconSizeScale:`sizeScale`,iconSizeUnits:`sizeUnits`,iconAlphaCutoff:`alphaCutoff`,iconBillboard:`billboard`,getIcon:`getIcon`,getIconAngle:`getAngle`,getIconColor:`getColor`,getIconPixelOffset:`getPixelOffset`,getIconSize:`getSize`}},text:{type:Wt,props:{textSizeMaxPixels:`sizeMaxPixels`,textSizeMinPixels:`sizeMinPixels`,textSizeScale:`sizeScale`,textSizeUnits:`sizeUnits`,textBackground:`background`,textBackgroundPadding:`backgroundPadding`,textFontFamily:`fontFamily`,textFontWeight:`fontWeight`,textLineHeight:`lineHeight`,textMaxWidth:`maxWidth`,textOutlineColor:`outlineColor`,textOutlineWidth:`outlineWidth`,textWordBreak:`wordBreak`,textCharacterSet:`characterSet`,textBillboard:`billboard`,textFontSettings:`fontSettings`,getText:`getText`,getTextAngle:`getAngle`,getTextColor:`getColor`,getTextPixelOffset:`getPixelOffset`,getTextSize:`getSize`,getTextAnchor:`getTextAnchor`,getTextAlignmentBaseline:`getAlignmentBaseline`,getTextBackgroundColor:`getBackgroundColor`,getTextBorderColor:`getBorderColor`,getTextBorderWidth:`getBorderWidth`}}};var Je={type:ze,props:{lineWidthUnits:`widthUnits`,lineWidthScale:`widthScale`,lineWidthMinPixels:`widthMinPixels`,lineWidthMaxPixels:`widthMaxPixels`,lineJointRounded:`jointRounded`,lineCapRounded:`capRounded`,lineMiterLimit:`miterLimit`,lineBillboard:`billboard`,lineAntialiasing:`antialiasing`,getLineColor:`getColor`,getLineWidth:`getWidth`}};var Pt={type:Be,props:{extruded:`extruded`,filled:`filled`,wireframe:`wireframe`,elevationScale:`elevationScale`,material:`material`,_full3d:`_full3d`,getElevation:`getElevation`,getFillColor:`getFillColor`,getLineColor:`getLineColor`}};function le({type:i,props:e}){let t={};for(let o in e)t[o]=i.defaultProps[e[o]];return t}function _t(i,e){let{transitions:t,updateTriggers:o}=i.props,n={updateTriggers:{},transitions:t&&{getPosition:t.geometry}};for(let s in e){let r=e[s],a=i.props[s];s.startsWith(`get`)&&(a=i.getSubLayerAccessor(a),n.updateTriggers[r]=o[s],t&&(n.transitions[r]=t[s])),n[r]=a}return n}function sn(i){if(Array.isArray(i))return i;switch(S.assert(i.type,`GeoJSON does not have type`),i.type){case`Feature`:return[i];case`FeatureCollection`:return S.assert(Array.isArray(i.features),`GeoJSON does not have features array`),i.features;default:return[{geometry:i}]}}function Ut(i,e,t={}){let o={pointFeatures:[],lineFeatures:[],polygonFeatures:[],polygonOutlineFeatures:[]},{startRow:n=0,endRow:s=i.length}=t;for(let r=n;r<s;r++){let a=i[r],{geometry:l}=a;if(l)if(l.type===`GeometryCollection`){S.assert(Array.isArray(l.geometries),`GeoJSON does not have geometries array`);let{geometries:c}=l;for(let f=0;f<c.length;f++){let d=c[f];nn(d,o,e,a,r)}}else nn(l,o,e,a,r)}return o}function nn(i,e,t,o,n){let{type:s,coordinates:r}=i,{pointFeatures:a,lineFeatures:l,polygonFeatures:c,polygonOutlineFeatures:f}=e;if(!_r(s,r)){S.warn(`${s} coordinates are malformed`)();return}switch(s){case`Point`:a.push(t({geometry:i},o,n));break;case`MultiPoint`:r.forEach(d=>{a.push(t({geometry:{type:`Point`,coordinates:d}},o,n))});break;case`LineString`:l.push(t({geometry:i},o,n));break;case`MultiLineString`:r.forEach(d=>{l.push(t({geometry:{type:`LineString`,coordinates:d}},o,n))});break;case`Polygon`:c.push(t({geometry:i},o,n)),r.forEach(d=>{f.push(t({geometry:{type:`LineString`,coordinates:d}},o,n))});break;case`MultiPolygon`:r.forEach(d=>{c.push(t({geometry:{type:`Polygon`,coordinates:d}},o,n)),d.forEach(p=>{f.push(t({geometry:{type:`LineString`,coordinates:p}},o,n))})})}}var Pr={Point:1,MultiPoint:2,LineString:2,MultiLineString:3,Polygon:3,MultiPolygon:4};function _r(i,e){let t=Pr[i];for(S.assert(t,`Unknown GeoJSON type ${i}`);e&&--t>0;)e=e[0];return e&&Number.isFinite(e[0])}function rn(){return{points:{},lines:{},polygons:{},polygonsOutline:{}}}function Ct(i){return i.geometry.coordinates}function an(i,e){let t=rn(),{pointFeatures:o,lineFeatures:n,polygonFeatures:s,polygonOutlineFeatures:r}=i;return t.points.data=o,t.points._dataDiff=e.pointFeatures&&(()=>e.pointFeatures),t.points.getPosition=Ct,t.lines.data=n,t.lines._dataDiff=e.lineFeatures&&(()=>e.lineFeatures),t.lines.getPath=Ct,t.polygons.data=s,t.polygons._dataDiff=e.polygonFeatures&&(()=>e.polygonFeatures),t.polygons.getPolygon=Ct,t.polygonsOutline.data=r,t.polygonsOutline._dataDiff=e.polygonOutlineFeatures&&(()=>e.polygonOutlineFeatures),t.polygonsOutline.getPath=Ct,t}function ln(i){let e=rn(),{points:t,lines:o,polygons:n}=i,s$12=Oo(i);e.points.data={length:t.positions.value.length/t.positions.size,attributes:s(r({},t.attributes),{getPosition:t.positions,rowIndexes:{size:1,type:`uint32`,value:s$12.points}}),properties:t.properties,numericProps:t.numericProps,featureIds:t.featureIds},e.lines.data={length:o.pathIndices.value.length-1,startIndices:o.pathIndices.value,attributes:s(r({},o.attributes),{getPath:o.positions,rowIndexes:{size:1,type:`uint32`,value:s$12.lines}}),properties:o.properties,numericProps:o.numericProps,featureIds:o.featureIds},e.lines._pathType=`open`;let r$14=n.positions.value.length/n.positions.size,a=Array(r$14).fill(1);for(let l of n.primitivePolygonIndices.value)a[l-1]=0;return e.polygons.data={length:n.polygonIndices.value.length-1,startIndices:n.polygonIndices.value,attributes:s(r({},n.attributes),{getPolygon:n.positions,instanceVertexValid:{size:1,value:new Uint16Array(a)},rowIndexes:{size:1,type:`uint32`,value:s$12.polygons}}),properties:n.properties,numericProps:n.numericProps,featureIds:n.featureIds},e.polygons._normalize=!1,n.triangles&&(e.polygons.data.attributes.indices=n.triangles.value),e.polygonsOutline.data={length:n.primitivePolygonIndices.value.length-1,startIndices:n.primitivePolygonIndices.value,attributes:s(r({},n.attributes),{getPath:n.positions,rowIndexes:{size:1,type:`uint32`,value:s$12.polygons}}),properties:n.properties,numericProps:n.numericProps,featureIds:n.featureIds},e.polygonsOutline._pathType=`open`,e}var Cr=[`points`,`linestrings`,`polygons`];var Sr=s(r(r(r(r(r({},le(Ye.circle)),le(Ye.icon)),le(Ye.text)),le(Je)),le(Pt)),{stroked:!0,filled:!0,extruded:!1,wireframe:!1,_full3d:!1,iconAtlas:{type:`object`,value:null},iconMapping:{type:`object`,value:{}},getIcon:{type:`accessor`,value:i=>i.properties.icon},getText:{type:`accessor`,value:i=>i.properties.text},pointType:`circle`,getRadius:{deprecatedFor:`getPointRadius`}});var Xe=class extends _m{initializeState(){this.state={layerProps:{},features:{},featuresDiff:{}}}updateState({props:e,changeFlags:t}){if(!t.dataChanged)return;let{data:o}=this.props,n=o&&`points`in o&&`polygons`in o&&`lines`in o;this.setState({binary:n}),n?this._updateStateBinary({props:e,changeFlags:t}):this._updateStateJSON({props:e,changeFlags:t})}_updateStateBinary({props:e,changeFlags:t}){let o=ln(e.data);this.setState({layerProps:o})}_updateStateJSON({props:e,changeFlags:t}){let o=sn(e.data),n=this.getSubLayerRow.bind(this),s={},r={};if(Array.isArray(t.dataChanged)){let l=this.state.features;for(let c in l)s[c]=l[c].slice(),r[c]=[];for(let c of t.dataChanged){let f=Ut(o,n,c);for(let d in l)r[d].push(vt({data:s[d],getIndex:p=>p.__source.index,dataRange:c,replace:f[d]}))}}else s=Ut(o,n);let a=an(s,r);this.setState({features:s,featuresDiff:r,layerProps:a})}getPickingInfo(e){let t=super.getPickingInfo(e),{index:o,sourceLayer:n}=t;return t.featureType=Cr.find(s=>n.id.startsWith(`${this.id}-${s}-`)),o>=0&&n.id.startsWith(`${this.id}-points-text`)&&this.state.binary&&(t.index=this.props.data.points.globalFeatureIds.value[o]),t}_updateAutoHighlight(e){let t=`${this.id}-points-`,o=e.featureType===`points`;for(let n of this.getSubLayers())n.id.startsWith(t)===o&&n.updateAutoHighlight(e)}_renderPolygonLayer(){let{extruded:e,wireframe:t}=this.props,{layerProps:o}=this.state,n=`polygons-fill`,s=this.shouldRenderSubLayer(n,o.polygons?.data)&&this.getSubLayerClass(n,Pt.type);if(s){let r=_t(this,Pt.props),a=e&&t;return a||delete r.getLineColor,r.updateTriggers.lineColors=a,new s(r,this.getSubLayerProps({id:n,updateTriggers:r.updateTriggers}),o.polygons)}return null}_renderLineLayers(){let{extruded:e,stroked:t}=this.props,{layerProps:o}=this.state,n=`polygons-stroke`,s=`linestrings`,r=!e&&t&&this.shouldRenderSubLayer(n,o.polygonsOutline?.data)&&this.getSubLayerClass(n,Je.type),a=this.shouldRenderSubLayer(s,o.lines?.data)&&this.getSubLayerClass(s,Je.type);if(r||a){let l=_t(this,Je.props);return[r&&new r(l,this.getSubLayerProps({id:n,updateTriggers:l.updateTriggers}),o.polygonsOutline),a&&new a(l,this.getSubLayerProps({id:s,updateTriggers:l.updateTriggers}),o.lines)]}return null}_renderPointLayers(){let{pointType:e}=this.props,{layerProps:t,binary:o}=this.state,{highlightedObjectIndex:n}=this.props;!o&&Number.isFinite(n)&&(n=t.points.data.findIndex(l=>l.__source.index===n));let s$13=new Set(e.split(`+`)),r$15=[];for(let l of s$13){let c=`points-${l}`,f=Ye[l],d=f&&this.shouldRenderSubLayer(c,t.points?.data)&&this.getSubLayerClass(c,f.type);if(d){let p=_t(this,f.props),u$1=t.points;if(l===`text`&&o){let a=u$1.data.attributes,{rowIndexes:g}=a,h=u(a,[`rowIndexes`]);u$1=s(r({},u$1),{data:s(r({},u$1.data),{attributes:h})})}r$15.push(new d(p,this.getSubLayerProps({id:c,updateTriggers:p.updateTriggers,highlightedObjectIndex:n}),u$1))}}return r$15}renderLayers(){let{extruded:e}=this.props,t=this._renderPolygonLayer(),o=this._renderLineLayers(),n=this._renderPointLayers();return[!e&&t,o,n,e&&t]}getSubLayerAccessor(e){let{binary:t}=this.state;return!t||typeof e!=`function`?super.getSubLayerAccessor(e):(o,n)=>{let{data:s,index:r}=n;return e(To(s,r),n)}}};Xe.layerName=`GeoJsonLayer`;Xe.defaultProps=Sr;var Lr=Xe;export{ze as _,Gn as a,Tt as c,er as d,ge as f,ye as g,wt as h,Dn as i,Wt as l,jt as m,Cn as n,Lr as o,gn as p,Cs as r,Nt as s,Be as t,Zn as u};
|
|
4336
|
+
//# debugId=7fec4dc7-70a9-597d-a1ca-61760d4e356b
|