@mapvx/web-components-ssr 1.4.1 → 1.5.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/dist/browser/chunk-Bjk3HkK2.js +2 -0
- package/dist/browser/chunk-CCaUxYwr.js +2 -0
- package/dist/browser/chunk-CP_etSVX.js +4343 -0
- package/dist/browser/chunk-CTFjnL_B.js +1 -0
- package/dist/browser/chunk-CdqAsQa0.js +2047 -0
- package/dist/browser/chunk-Dkhxm9pV.js +1 -0
- package/dist/browser/chunk-Dm8HBhbB.js +1 -0
- package/dist/browser/chunk-DsKCGfdq.js +1 -0
- package/dist/browser/chunk-LltjhLJU.js +4115 -0
- package/dist/browser/chunk-UfDdP4s_.js +1 -0
- package/dist/browser/chunk-VDwq1GVr.js +511 -0
- package/dist/browser/main.js +65 -64
- package/package.json +3 -3
- package/dist/browser/chunk-BDMQUEs2.js +0 -4343
- package/dist/browser/chunk-C12DvVrC.js +0 -4113
- package/dist/browser/chunk-CEnPvr71.js +0 -2047
- package/dist/browser/chunk-CIopM6sW.js +0 -508
- package/dist/browser/chunk-DQUK2GdN.js +0 -2
- package/dist/browser/chunk-VKMNXWI5.js +0 -2
- package/dist/browser/chunk-ZOhCrUx8.js +0 -2
- package/dist/browser/chunk-y8EsCUPj.js +0 -1
|
@@ -1,2047 +0,0 @@
|
|
|
1
|
-
import {m as mc,o as Jh,t as nu,aq as yt$1,K as Kt$1,u as ue$1,s as rn$1,ar as tn$1,Z as Zr,c as Dv,as as ka,at as Eh,C,f as fi$1,N as Nt$1,au as bc,l as ht}from'./chunk-BDMQUEs2.js';import {s as s$1,r as r$1,u,x,v}from'./main.js';var Ui=v((Al,vt)=>{"use strict";vt.exports=Ve;vt.exports.default=Ve;function Ve(t,i,e){e=e||2;var o=i&&i.length,n=o?i[0]*e:t.length,s=Di(t,0,n,e,!0),r=[];if(!s||s.next===s.prev)return r;var a,l,c,f,u,d,p;if(o&&(s=es(t,i,s,e)),t.length>80*e){a=c=t[0],l=f=t[1];for(var g=e;g<n;g+=e)u=t[g],d=t[g+1],u<a&&(a=u),d<l&&(l=d),u>c&&(c=u),d>f&&(f=d);p=Math.max(c-a,f-l),p=p!==0?32767/p:0;}return Pe(s,r,e,a,l,p,0),r}function Di(t,i,e,o,n){var s,r;if(n===mt(t,i,e,o)>0)for(s=i;s<e;s+=o)r=Fi(s,t[s],t[s+1],r);else for(s=e-o;s>=i;s-=o)r=Fi(s,t[s],t[s+1],r);return r&&Ze(r,r.next)&&(Ce(r),r=r.next),r}function X(t,i){if(!t)return t;i||(i=t);var e=t,o;do if(o=!1,!e.steiner&&(Ze(e,e.next)||b(e.prev,e,e.next)===0)){if(Ce(e),e=i=e.prev,e===e.next)break;o=!0;}else e=e.next;while(o||e!==i);return i}function Pe(t,i,e,o,n,s,r){if(t){!r&&s&&ss(t,o,n,s);for(var a=t,l,c;t.prev!==t.next;){if(l=t.prev,c=t.next,s?Xn(t,o,n,s):Yn(t)){i.push(l.i/e|0),i.push(t.i/e|0),i.push(c.i/e|0),Ce(t),t=c.next,a=c.next;continue}if(t=c,t===a){r?r===1?(t=qn(X(t),i,e),Pe(t,i,e,o,n,s,2)):r===2&&Qn(t,i,e,o,n,s):Pe(X(t),i,e,o,n,s,1);break}}}}function Yn(t){var i=t.prev,e=t,o=t.next;if(b(i,e,o)>=0)return !1;for(var n=i.x,s=e.x,r=o.x,a=i.y,l=e.y,c=o.y,f=n<s?n<r?n:r:s<r?s:r,u=a<l?a<c?a:c:l<c?l:c,d=n>s?n>r?n:r:s>r?s:r,p=a>l?a>c?a:c:l>c?l:c,g=o.next;g!==i;){if(g.x>=f&&g.x<=d&&g.y>=u&&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 Xn(t,i,e,o){var n=t.prev,s=t,r=t.next;if(b(n,s,r)>=0)return !1;for(var a=n.x,l=s.x,c=r.x,f=n.y,u=s.y,d=r.y,p=a<l?a<c?a:c:l<c?l:c,g=f<u?f<d?f:d:u<d?u:d,h=a>l?a>c?a:c:l>c?l:c,m=f>u?f>d?f:d:u>d?u:d,y=ht(p,g,i,e,o),C=ht(h,m,i,e,o),v=t.prevZ,x=t.nextZ;v&&v.z>=y&&x&&x.z<=C;){if(v.x>=p&&v.x<=h&&v.y>=g&&v.y<=m&&v!==n&&v!==r&&ne(a,f,l,u,c,d,v.x,v.y)&&b(v.prev,v,v.next)>=0||(v=v.prevZ,x.x>=p&&x.x<=h&&x.y>=g&&x.y<=m&&x!==n&&x!==r&&ne(a,f,l,u,c,d,x.x,x.y)&&b(x.prev,x,x.next)>=0))return !1;x=x.nextZ;}for(;v&&v.z>=y;){if(v.x>=p&&v.x<=h&&v.y>=g&&v.y<=m&&v!==n&&v!==r&&ne(a,f,l,u,c,d,v.x,v.y)&&b(v.prev,v,v.next)>=0)return !1;v=v.prevZ;}for(;x&&x.z<=C;){if(x.x>=p&&x.x<=h&&x.y>=g&&x.y<=m&&x!==n&&x!==r&&ne(a,f,l,u,c,d,x.x,x.y)&&b(x.prev,x,x.next)>=0)return !1;x=x.nextZ;}return !0}function qn(t,i,e){var o=t;do{var n=o.prev,s=o.next.next;!Ze(n,s)&&Bi(n,o,o.next,s)&&_e(n,s)&&_e(s,n)&&(i.push(n.i/e|0),i.push(o.i/e|0),i.push(s.i/e|0),Ce(o),Ce(o.next),o=t=s),o=o.next;}while(o!==t);return X(o)}function Qn(t,i,e,o,n,s){var r=t;do{for(var a=r.next.next;a!==r.prev;){if(r.i!==a.i&&ls(r,a)){var l=Gi(r,a);r=X(r,r.next),l=X(l,l.next),Pe(r,i,e,o,n,s,0),Pe(l,i,e,o,n,s,0);return}a=a.next;}r=r.next;}while(r!==t)}function es(t,i,e,o){var n=[],s,r,a,l,c;for(s=0,r=i.length;s<r;s++)a=i[s]*o,l=s<r-1?i[s+1]*o:t.length,c=Di(t,a,l,o,!1),c===c.next&&(c.steiner=!0),n.push(as(c));for(n.sort(ts),s=0;s<n.length;s++)e=is(n[s],e);return e}function ts(t,i){return t.x-i.x}function is(t,i){var e=os(t,i);if(!e)return i;var o=Gi(e,t);return X(o,o.next),X(e,e.next)}function os(t,i){var e=i,o=t.x,n=t.y,s=-1/0,r;do{if(n<=e.y&&n>=e.next.y&&e.next.y!==e.y){var a=e.x+(n-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=o&&a>s&&(s=a,r=e.x<e.next.x?e:e.next,a===o))return r}e=e.next;}while(e!==i);if(!r)return null;var l=r,c=r.x,f=r.y,u=1/0,d;e=r;do o>=e.x&&e.x>=c&&o!==e.x&&ne(n<f?o:s,n,c,f,n<f?s:o,n,e.x,e.y)&&(d=Math.abs(n-e.y)/(o-e.x),_e(e,t)&&(d<u||d===u&&(e.x>r.x||e.x===r.x&&ns(r,e)))&&(r=e,u=d)),e=e.next;while(e!==l);return r}function ns(t,i){return b(t.prev,t,i.prev)<0&&b(i.next,t,t.next)<0}function ss(t,i,e,o){var n=t;do n.z===0&&(n.z=ht(n.x,n.y,i,e,o)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,rs(n);}function rs(t){var i,e,o,n,s,r,a,l,c=1;do{for(e=t,t=null,s=null,r=0;e;){for(r++,o=e,a=0,i=0;i<c&&(a++,o=o.nextZ,!!o);i++);for(l=c;a>0||l>0&&o;)a!==0&&(l===0||!o||e.z<=o.z)?(n=e,e=e.nextZ,a--):(n=o,o=o.nextZ,l--),s?s.nextZ=n:t=n,n.prevZ=s,s=n;e=o;}s.nextZ=null,c*=2;}while(r>1);return t}function ht(t,i,e,o,n){return t=(t-e)*n|0,i=(i-o)*n|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,t|i<<1}function as(t){var i=t,e=t;do(i.x<e.x||i.x===e.x&&i.y<e.y)&&(e=i),i=i.next;while(i!==t);return e}function ne(t,i,e,o,n,s,r,a){return (n-r)*(i-a)>=(t-r)*(s-a)&&(t-r)*(o-a)>=(e-r)*(i-a)&&(e-r)*(s-a)>=(n-r)*(o-a)}function ls(t,i){return t.next.i!==i.i&&t.prev.i!==i.i&&!cs(t,i)&&(_e(t,i)&&_e(i,t)&&fs(t,i)&&(b(t.prev,t,i.prev)||b(t,i.prev,i))||Ze(t,i)&&b(t.prev,t,t.next)>0&&b(i.prev,i,i.next)>0)}function b(t,i,e){return (i.y-t.y)*(e.x-i.x)-(i.x-t.x)*(e.y-i.y)}function Ze(t,i){return t.x===i.x&&t.y===i.y}function Bi(t,i,e,o){var n=je(b(t,i,e)),s=je(b(t,i,o)),r=je(b(e,o,t)),a=je(b(e,o,i));return !!(n!==s&&r!==a||n===0&&We(t,e,i)||s===0&&We(t,o,i)||r===0&&We(e,t,o)||a===0&&We(e,i,o))}function We(t,i,e){return i.x<=Math.max(t.x,e.x)&&i.x>=Math.min(t.x,e.x)&&i.y<=Math.max(t.y,e.y)&&i.y>=Math.min(t.y,e.y)}function je(t){return t>0?1:t<0?-1:0}function cs(t,i){var e=t;do{if(e.i!==t.i&&e.next.i!==t.i&&e.i!==i.i&&e.next.i!==i.i&&Bi(e,e.next,t,i))return !0;e=e.next;}while(e!==t);return !1}function _e(t,i){return b(t.prev,t,t.next)<0?b(t,i,t.next)>=0&&b(t,t.prev,i)>=0:b(t,i,t.prev)<0||b(t,t.next,i)<0}function fs(t,i){var e=t,o=!1,n=(t.x+i.x)/2,s=(t.y+i.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&&(o=!o),e=e.next;while(e!==t);return o}function Gi(t,i){var e=new xt(t.i,t.x,t.y),o=new xt(i.i,i.x,i.y),n=t.next,s=i.prev;return t.next=i,i.prev=t,e.next=n,n.prev=e,o.next=e,e.prev=o,s.next=o,o.prev=s,o}function Fi(t,i,e,o){var n=new xt(t,i,e);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(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);}function xt(t,i,e){this.i=t,this.x=i,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1;}Ve.deviation=function(t,i,e,o){var n=i&&i.length,s=n?i[0]*e:t.length,r=Math.abs(mt(t,0,s,e));if(n)for(var a=0,l=i.length;a<l;a++){var c=i[a]*e,f=a<l-1?i[a+1]*e:t.length;r-=Math.abs(mt(t,c,f,e));}var u=0;for(a=0;a<o.length;a+=3){var d=o[a]*e,p=o[a+1]*e,g=o[a+2]*e;u+=Math.abs((t[d]-t[g])*(t[p+1]-t[d+1])-(t[d]-t[p])*(t[g+1]-t[d+1]));}return r===0&&u===0?0:Math.abs((u-r)/r)};function mt(t,i,e,o){for(var n=0,s=i,r=e-o;s<e;s+=o)n+=(t[r]-t[s])*(t[s+1]+t[r+1]),r=s;return n}Ve.flatten=function(t){for(var i=t[0][0].length,e={vertices:[],holes:[],dimensions:i},o=0,n=0;n<t.length;n++){for(var s=0;s<t[n].length;s++)for(var r=0;r<i;r++)e.vertices.push(t[n][s][r]);n>0&&(o+=t[n-1].length,e.holes.push(o));}return e};});var zt=`layout(std140) uniform arcUniforms {
|
|
2
|
-
bool greatCircle;
|
|
3
|
-
bool useShortestPath;
|
|
4
|
-
float numSegments;
|
|
5
|
-
float widthScale;
|
|
6
|
-
float widthMinPixels;
|
|
7
|
-
float widthMaxPixels;
|
|
8
|
-
highp int widthUnits;
|
|
9
|
-
} arc;
|
|
10
|
-
`,Ot={name:"arc",vs:zt,fs:zt,uniformTypes:{greatCircle:"f32",useShortestPath:"f32",numSegments:"f32",widthScale:"f32",widthMinPixels:"f32",widthMaxPixels:"f32",widthUnits:"i32"}};var Rt=`#version 300 es
|
|
11
|
-
#define SHADER_NAME arc-layer-vertex-shader
|
|
12
|
-
in vec4 instanceSourceColors;
|
|
13
|
-
in vec4 instanceTargetColors;
|
|
14
|
-
in vec3 instanceSourcePositions;
|
|
15
|
-
in vec3 instanceSourcePositions64Low;
|
|
16
|
-
in vec3 instanceTargetPositions;
|
|
17
|
-
in vec3 instanceTargetPositions64Low;
|
|
18
|
-
in vec3 instancePickingColors;
|
|
19
|
-
in float instanceWidths;
|
|
20
|
-
in float instanceHeights;
|
|
21
|
-
in float instanceTilts;
|
|
22
|
-
out vec4 vColor;
|
|
23
|
-
out vec2 uv;
|
|
24
|
-
out float isValid;
|
|
25
|
-
float paraboloid(float distance, float sourceZ, float targetZ, float ratio) {
|
|
26
|
-
float deltaZ = targetZ - sourceZ;
|
|
27
|
-
float dh = distance * instanceHeights;
|
|
28
|
-
if (dh == 0.0) {
|
|
29
|
-
return sourceZ + deltaZ * ratio;
|
|
30
|
-
}
|
|
31
|
-
float unitZ = deltaZ / dh;
|
|
32
|
-
float p2 = unitZ * unitZ + 1.0;
|
|
33
|
-
float dir = step(deltaZ, 0.0);
|
|
34
|
-
float z0 = mix(sourceZ, targetZ, dir);
|
|
35
|
-
float r = mix(ratio, 1.0 - ratio, dir);
|
|
36
|
-
return sqrt(r * (p2 - r)) * dh + z0;
|
|
37
|
-
}
|
|
38
|
-
vec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction, float width) {
|
|
39
|
-
vec2 dir_screenspace = normalize(line_clipspace * project.viewportSize);
|
|
40
|
-
dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
|
|
41
|
-
return dir_screenspace * offset_direction * width / 2.0;
|
|
42
|
-
}
|
|
43
|
-
float getSegmentRatio(float index) {
|
|
44
|
-
return smoothstep(0.0, 1.0, index / (arc.numSegments - 1.0));
|
|
45
|
-
}
|
|
46
|
-
vec3 interpolateFlat(vec3 source, vec3 target, float segmentRatio) {
|
|
47
|
-
float distance = length(source.xy - target.xy);
|
|
48
|
-
float z = paraboloid(distance, source.z, target.z, segmentRatio);
|
|
49
|
-
float tiltAngle = radians(instanceTilts);
|
|
50
|
-
vec2 tiltDirection = normalize(target.xy - source.xy);
|
|
51
|
-
vec2 tilt = vec2(-tiltDirection.y, tiltDirection.x) * z * sin(tiltAngle);
|
|
52
|
-
return vec3(
|
|
53
|
-
mix(source.xy, target.xy, segmentRatio) + tilt,
|
|
54
|
-
z * cos(tiltAngle)
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
float getAngularDist (vec2 source, vec2 target) {
|
|
58
|
-
vec2 sourceRadians = radians(source);
|
|
59
|
-
vec2 targetRadians = radians(target);
|
|
60
|
-
vec2 sin_half_delta = sin((sourceRadians - targetRadians) / 2.0);
|
|
61
|
-
vec2 shd_sq = sin_half_delta * sin_half_delta;
|
|
62
|
-
float a = shd_sq.y + cos(sourceRadians.y) * cos(targetRadians.y) * shd_sq.x;
|
|
63
|
-
return 2.0 * asin(sqrt(a));
|
|
64
|
-
}
|
|
65
|
-
vec3 interpolateGreatCircle(vec3 source, vec3 target, vec3 source3D, vec3 target3D, float angularDist, float t) {
|
|
66
|
-
vec2 lngLat;
|
|
67
|
-
if(abs(angularDist - PI) < 0.001) {
|
|
68
|
-
lngLat = (1.0 - t) * source.xy + t * target.xy;
|
|
69
|
-
} else {
|
|
70
|
-
float a = sin((1.0 - t) * angularDist);
|
|
71
|
-
float b = sin(t * angularDist);
|
|
72
|
-
vec3 p = source3D.yxz * a + target3D.yxz * b;
|
|
73
|
-
lngLat = degrees(vec2(atan(p.y, -p.x), atan(p.z, length(p.xy))));
|
|
74
|
-
}
|
|
75
|
-
float z = paraboloid(angularDist * EARTH_RADIUS, source.z, target.z, t);
|
|
76
|
-
return vec3(lngLat, z);
|
|
77
|
-
}
|
|
78
|
-
void main(void) {
|
|
79
|
-
geometry.worldPosition = instanceSourcePositions;
|
|
80
|
-
geometry.worldPositionAlt = instanceTargetPositions;
|
|
81
|
-
float segmentIndex = float(gl_VertexID / 2);
|
|
82
|
-
float segmentSide = mod(float(gl_VertexID), 2.) == 0. ? -1. : 1.;
|
|
83
|
-
float segmentRatio = getSegmentRatio(segmentIndex);
|
|
84
|
-
float prevSegmentRatio = getSegmentRatio(max(0.0, segmentIndex - 1.0));
|
|
85
|
-
float nextSegmentRatio = getSegmentRatio(min(arc.numSegments - 1.0, segmentIndex + 1.0));
|
|
86
|
-
float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));
|
|
87
|
-
isValid = 1.0;
|
|
88
|
-
uv = vec2(segmentRatio, segmentSide);
|
|
89
|
-
geometry.uv = uv;
|
|
90
|
-
geometry.pickingColor = instancePickingColors;
|
|
91
|
-
vec4 curr;
|
|
92
|
-
vec4 next;
|
|
93
|
-
vec3 source;
|
|
94
|
-
vec3 target;
|
|
95
|
-
if ((arc.greatCircle || project.projectionMode == PROJECTION_MODE_GLOBE) && project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) {
|
|
96
|
-
source = project_globe_(vec3(instanceSourcePositions.xy, 0.0));
|
|
97
|
-
target = project_globe_(vec3(instanceTargetPositions.xy, 0.0));
|
|
98
|
-
float angularDist = getAngularDist(instanceSourcePositions.xy, instanceTargetPositions.xy);
|
|
99
|
-
vec3 prevPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, prevSegmentRatio);
|
|
100
|
-
vec3 currPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, segmentRatio);
|
|
101
|
-
vec3 nextPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, nextSegmentRatio);
|
|
102
|
-
if (abs(currPos.x - prevPos.x) > 180.0) {
|
|
103
|
-
indexDir = -1.0;
|
|
104
|
-
isValid = 0.0;
|
|
105
|
-
} else if (abs(currPos.x - nextPos.x) > 180.0) {
|
|
106
|
-
indexDir = 1.0;
|
|
107
|
-
isValid = 0.0;
|
|
108
|
-
}
|
|
109
|
-
nextPos = indexDir < 0.0 ? prevPos : nextPos;
|
|
110
|
-
nextSegmentRatio = indexDir < 0.0 ? prevSegmentRatio : nextSegmentRatio;
|
|
111
|
-
if (isValid == 0.0) {
|
|
112
|
-
nextPos.x += nextPos.x > 0.0 ? -360.0 : 360.0;
|
|
113
|
-
float t = ((currPos.x > 0.0 ? 180.0 : -180.0) - currPos.x) / (nextPos.x - currPos.x);
|
|
114
|
-
currPos = mix(currPos, nextPos, t);
|
|
115
|
-
segmentRatio = mix(segmentRatio, nextSegmentRatio, t);
|
|
116
|
-
}
|
|
117
|
-
vec3 currPos64Low = mix(instanceSourcePositions64Low, instanceTargetPositions64Low, segmentRatio);
|
|
118
|
-
vec3 nextPos64Low = mix(instanceSourcePositions64Low, instanceTargetPositions64Low, nextSegmentRatio);
|
|
119
|
-
curr = project_position_to_clipspace(currPos, currPos64Low, vec3(0.0), geometry.position);
|
|
120
|
-
next = project_position_to_clipspace(nextPos, nextPos64Low, vec3(0.0));
|
|
121
|
-
} else {
|
|
122
|
-
vec3 source_world = instanceSourcePositions;
|
|
123
|
-
vec3 target_world = instanceTargetPositions;
|
|
124
|
-
if (arc.useShortestPath) {
|
|
125
|
-
source_world.x = mod(source_world.x + 180., 360.0) - 180.;
|
|
126
|
-
target_world.x = mod(target_world.x + 180., 360.0) - 180.;
|
|
127
|
-
float deltaLng = target_world.x - source_world.x;
|
|
128
|
-
if (deltaLng > 180.) target_world.x -= 360.;
|
|
129
|
-
if (deltaLng < -180.) source_world.x -= 360.;
|
|
130
|
-
}
|
|
131
|
-
source = project_position(source_world, instanceSourcePositions64Low);
|
|
132
|
-
target = project_position(target_world, instanceTargetPositions64Low);
|
|
133
|
-
float antiMeridianX = 0.0;
|
|
134
|
-
if (arc.useShortestPath) {
|
|
135
|
-
if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {
|
|
136
|
-
antiMeridianX = -(project.coordinateOrigin.x + 180.) / 360. * TILE_SIZE;
|
|
137
|
-
}
|
|
138
|
-
float thresholdRatio = (antiMeridianX - source.x) / (target.x - source.x);
|
|
139
|
-
if (prevSegmentRatio <= thresholdRatio && nextSegmentRatio > thresholdRatio) {
|
|
140
|
-
isValid = 0.0;
|
|
141
|
-
indexDir = sign(segmentRatio - thresholdRatio);
|
|
142
|
-
segmentRatio = thresholdRatio;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
nextSegmentRatio = indexDir < 0.0 ? prevSegmentRatio : nextSegmentRatio;
|
|
146
|
-
vec3 currPos = interpolateFlat(source, target, segmentRatio);
|
|
147
|
-
vec3 nextPos = interpolateFlat(source, target, nextSegmentRatio);
|
|
148
|
-
if (arc.useShortestPath) {
|
|
149
|
-
if (nextPos.x < antiMeridianX) {
|
|
150
|
-
currPos.x += TILE_SIZE;
|
|
151
|
-
nextPos.x += TILE_SIZE;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
curr = project_common_position_to_clipspace(vec4(currPos, 1.0));
|
|
155
|
-
next = project_common_position_to_clipspace(vec4(nextPos, 1.0));
|
|
156
|
-
geometry.position = vec4(currPos, 1.0);
|
|
157
|
-
}
|
|
158
|
-
float widthPixels = clamp(
|
|
159
|
-
project_size_to_pixel(instanceWidths * arc.widthScale, arc.widthUnits),
|
|
160
|
-
arc.widthMinPixels, arc.widthMaxPixels
|
|
161
|
-
);
|
|
162
|
-
vec3 offset = vec3(
|
|
163
|
-
getExtrusionOffset((next.xy - curr.xy) * indexDir, segmentSide, widthPixels),
|
|
164
|
-
0.0);
|
|
165
|
-
DECKGL_FILTER_SIZE(offset, geometry);
|
|
166
|
-
DECKGL_FILTER_GL_POSITION(curr, geometry);
|
|
167
|
-
gl_Position = curr + vec4(project_pixel_size_to_clipspace(offset.xy), 0.0, 0.0);
|
|
168
|
-
vec4 color = mix(instanceSourceColors, instanceTargetColors, segmentRatio);
|
|
169
|
-
vColor = vec4(color.rgb, color.a * layer.opacity);
|
|
170
|
-
DECKGL_FILTER_COLOR(vColor, geometry);
|
|
171
|
-
}
|
|
172
|
-
`;var kt=`#version 300 es
|
|
173
|
-
#define SHADER_NAME arc-layer-fragment-shader
|
|
174
|
-
precision highp float;
|
|
175
|
-
in vec4 vColor;
|
|
176
|
-
in vec2 uv;
|
|
177
|
-
in float isValid;
|
|
178
|
-
out vec4 fragColor;
|
|
179
|
-
void main(void) {
|
|
180
|
-
if (isValid == 0.0) {
|
|
181
|
-
discard;
|
|
182
|
-
}
|
|
183
|
-
fragColor = vColor;
|
|
184
|
-
geometry.uv = uv;
|
|
185
|
-
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
186
|
-
}
|
|
187
|
-
`;var ze=[0,0,0,255],Fo={getSourcePosition:{type:"accessor",value:t=>t.sourcePosition},getTargetPosition:{type:"accessor",value:t=>t.targetPosition},getSourceColor:{type:"accessor",value:ze},getTargetColor:{type:"accessor",value:ze},getWidth:{type:"accessor",value:1},getHeight:{type:"accessor",value:1},getTilt:{type:"accessor",value:0},greatCircle:false,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}},Do=(()=>{class t extends mc{getBounds(){return this.getAttributeManager()?.getBounds(["instanceSourcePositions","instanceTargetPositions"])}getShaders(){return super.getShaders({vs:Rt,fs:kt,modules:[Jh,nu,Ot]})}get wrapLongitude(){return false}initializeState(){this.getAttributeManager().addInstanced({instanceSourcePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:true,accessor:"getSourcePosition"},instanceTargetPositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:true,accessor:"getTargetPosition"},instanceSourceColors:{size:this.props.colorFormat.length,type:"unorm8",transition:true,accessor:"getSourceColor",defaultValue:ze},instanceTargetColors:{size:this.props.colorFormat.length,type:"unorm8",transition:true,accessor:"getTargetColor",defaultValue:ze},instanceWidths:{size:1,transition:true,accessor:"getWidth",defaultValue:1},instanceHeights:{size:1,transition:true,accessor:"getHeight",defaultValue:1},instanceTilts:{size:1,transition:true,accessor:"getTilt",defaultValue:0}});}updateState(e){super.updateState(e),e.changeFlags.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll());}draw({uniforms:e}){let{widthUnits:o,widthScale:n,widthMinPixels:s,widthMaxPixels:r,greatCircle:a,wrapLongitude:l,numSegments:c}=this.props,f={numSegments:c,widthUnits:yt$1[o],widthScale:n,widthMinPixels:s,widthMaxPixels:r,greatCircle:a,useShortestPath:l},u=this.state.model;u.shaderInputs.setProps({arc:f}),u.setVertexCount(c*2),u.draw(this.context.renderPass);}_getModel(){return new Kt$1(this.context.device,s$1(r$1({},this.getShaders()),{id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),topology:"triangle-strip",isInstanced:true}))}}return t.layerName="ArcLayer",t.defaultProps=Fo,t})(),Bo=Do;var Go=new Uint32Array([0,2,1,0,3,2]),Uo=new Float32Array([0,1,0,0,1,0,1,1]);function at(t,i){if(!i)return No(t);let e=Math.max(Math.abs(t[0][0]-t[3][0]),Math.abs(t[1][0]-t[2][0])),o=Math.max(Math.abs(t[1][1]-t[0][1]),Math.abs(t[2][1]-t[3][1])),n=Math.ceil(e/i)+1,s=Math.ceil(o/i)+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,u=0;for(let d=0;d<n;d++){let p=d/(n-1);for(let g=0;g<s;g++){let h=g/(s-1),m=Wo(t,p,h);c[f*3+0]=m[0],c[f*3+1]=m[1],c[f*3+2]=m[2]||0,l[f*2+0]=p,l[f*2+1]=1-h,d>0&&g>0&&(a[u++]=f-s,a[u++]=f-s-1,a[u++]=f-1,a[u++]=f-s,a[u++]=f-1,a[u++]=f),f++;}}return {vertexCount:r,positions:c,indices:a,texCoords:l}}function No(t){let i=new Float64Array(12);for(let e=0;e<t.length;e++)i[e*3+0]=t[e][0],i[e*3+1]=t[e][1],i[e*3+2]=t[e][2]||0;return {vertexCount:6,positions:i,indices:Go,texCoords:Uo}}function Wo(t,i,e){return ht(ht(t[0],t[1],e),ht(t[3],t[2],e),i)}var Ft=`layout(std140) uniform bitmapUniforms {
|
|
188
|
-
vec4 bounds;
|
|
189
|
-
float coordinateConversion;
|
|
190
|
-
float desaturate;
|
|
191
|
-
vec3 tintColor;
|
|
192
|
-
vec4 transparentColor;
|
|
193
|
-
} bitmap;
|
|
194
|
-
`,Dt={name:"bitmap",vs:Ft,fs:Ft,uniformTypes:{bounds:"vec4<f32>",coordinateConversion:"f32",desaturate:"f32",tintColor:"vec3<f32>",transparentColor:"vec4<f32>"}};var Bt=`#version 300 es
|
|
195
|
-
#define SHADER_NAME bitmap-layer-vertex-shader
|
|
196
|
-
|
|
197
|
-
in vec2 texCoords;
|
|
198
|
-
in vec3 positions;
|
|
199
|
-
in vec3 positions64Low;
|
|
200
|
-
|
|
201
|
-
out vec2 vTexCoord;
|
|
202
|
-
out vec2 vTexPos;
|
|
203
|
-
|
|
204
|
-
const vec3 pickingColor = vec3(1.0, 0.0, 0.0);
|
|
205
|
-
|
|
206
|
-
void main(void) {
|
|
207
|
-
geometry.worldPosition = positions;
|
|
208
|
-
geometry.uv = texCoords;
|
|
209
|
-
geometry.pickingColor = pickingColor;
|
|
210
|
-
|
|
211
|
-
gl_Position = project_position_to_clipspace(positions, positions64Low, vec3(0.0), geometry.position);
|
|
212
|
-
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
|
|
213
|
-
|
|
214
|
-
vTexCoord = texCoords;
|
|
215
|
-
|
|
216
|
-
if (bitmap.coordinateConversion < -0.5) {
|
|
217
|
-
vTexPos = geometry.position.xy + project.commonOrigin.xy;
|
|
218
|
-
} else if (bitmap.coordinateConversion > 0.5) {
|
|
219
|
-
vTexPos = geometry.worldPosition.xy;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
vec4 color = vec4(0.0);
|
|
223
|
-
DECKGL_FILTER_COLOR(color, geometry);
|
|
224
|
-
}
|
|
225
|
-
`;var jo=`
|
|
226
|
-
vec3 packUVsIntoRGB(vec2 uv) {
|
|
227
|
-
// Extract the top 8 bits. We want values to be truncated down so we can add a fraction
|
|
228
|
-
vec2 uv8bit = floor(uv * 256.);
|
|
229
|
-
|
|
230
|
-
// Calculate the normalized remainders of u and v parts that do not fit into 8 bits
|
|
231
|
-
// Scale and clamp to 0-1 range
|
|
232
|
-
vec2 uvFraction = fract(uv * 256.);
|
|
233
|
-
vec2 uvFraction4bit = floor(uvFraction * 16.);
|
|
234
|
-
|
|
235
|
-
// Remainder can be encoded in blue channel, encode as 4 bits for pixel coordinates
|
|
236
|
-
float fractions = uvFraction4bit.x + uvFraction4bit.y * 16.;
|
|
237
|
-
|
|
238
|
-
return vec3(uv8bit, fractions) / 255.;
|
|
239
|
-
}
|
|
240
|
-
`,Gt=`#version 300 es
|
|
241
|
-
#define SHADER_NAME bitmap-layer-fragment-shader
|
|
242
|
-
|
|
243
|
-
#ifdef GL_ES
|
|
244
|
-
precision highp float;
|
|
245
|
-
#endif
|
|
246
|
-
|
|
247
|
-
uniform sampler2D bitmapTexture;
|
|
248
|
-
|
|
249
|
-
in vec2 vTexCoord;
|
|
250
|
-
in vec2 vTexPos;
|
|
251
|
-
|
|
252
|
-
out vec4 fragColor;
|
|
253
|
-
|
|
254
|
-
/* projection utils */
|
|
255
|
-
const float TILE_SIZE = 512.0;
|
|
256
|
-
const float PI = 3.1415926536;
|
|
257
|
-
const float WORLD_SCALE = TILE_SIZE / PI / 2.0;
|
|
258
|
-
|
|
259
|
-
// from degrees to Web Mercator
|
|
260
|
-
vec2 lnglat_to_mercator(vec2 lnglat) {
|
|
261
|
-
float x = lnglat.x;
|
|
262
|
-
float y = clamp(lnglat.y, -89.9, 89.9);
|
|
263
|
-
return vec2(
|
|
264
|
-
radians(x) + PI,
|
|
265
|
-
PI + log(tan(PI * 0.25 + radians(y) * 0.5))
|
|
266
|
-
) * WORLD_SCALE;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
// from Web Mercator to degrees
|
|
270
|
-
vec2 mercator_to_lnglat(vec2 xy) {
|
|
271
|
-
xy /= WORLD_SCALE;
|
|
272
|
-
return degrees(vec2(
|
|
273
|
-
xy.x - PI,
|
|
274
|
-
atan(exp(xy.y - PI)) * 2.0 - PI * 0.5
|
|
275
|
-
));
|
|
276
|
-
}
|
|
277
|
-
/* End projection utils */
|
|
278
|
-
|
|
279
|
-
// apply desaturation
|
|
280
|
-
vec3 color_desaturate(vec3 color) {
|
|
281
|
-
float luminance = (color.r + color.g + color.b) * 0.333333333;
|
|
282
|
-
return mix(color, vec3(luminance), bitmap.desaturate);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
// apply tint
|
|
286
|
-
vec3 color_tint(vec3 color) {
|
|
287
|
-
return color * bitmap.tintColor;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
// blend with background color
|
|
291
|
-
vec4 apply_opacity(vec3 color, float alpha) {
|
|
292
|
-
if (bitmap.transparentColor.a == 0.0) {
|
|
293
|
-
return vec4(color, alpha);
|
|
294
|
-
}
|
|
295
|
-
float blendedAlpha = alpha + bitmap.transparentColor.a * (1.0 - alpha);
|
|
296
|
-
float highLightRatio = alpha / blendedAlpha;
|
|
297
|
-
vec3 blendedRGB = mix(bitmap.transparentColor.rgb, color, highLightRatio);
|
|
298
|
-
return vec4(blendedRGB, blendedAlpha);
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
vec2 getUV(vec2 pos) {
|
|
302
|
-
return vec2(
|
|
303
|
-
(pos.x - bitmap.bounds[0]) / (bitmap.bounds[2] - bitmap.bounds[0]),
|
|
304
|
-
(pos.y - bitmap.bounds[3]) / (bitmap.bounds[1] - bitmap.bounds[3])
|
|
305
|
-
);
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
${jo}
|
|
309
|
-
|
|
310
|
-
void main(void) {
|
|
311
|
-
vec2 uv = vTexCoord;
|
|
312
|
-
if (bitmap.coordinateConversion < -0.5) {
|
|
313
|
-
vec2 lnglat = mercator_to_lnglat(vTexPos);
|
|
314
|
-
uv = getUV(lnglat);
|
|
315
|
-
} else if (bitmap.coordinateConversion > 0.5) {
|
|
316
|
-
vec2 commonPos = lnglat_to_mercator(vTexPos);
|
|
317
|
-
uv = getUV(commonPos);
|
|
318
|
-
}
|
|
319
|
-
vec4 bitmapColor = texture(bitmapTexture, uv);
|
|
320
|
-
|
|
321
|
-
fragColor = apply_opacity(color_tint(color_desaturate(bitmapColor.rgb)), bitmapColor.a * layer.opacity);
|
|
322
|
-
|
|
323
|
-
geometry.uv = uv;
|
|
324
|
-
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
325
|
-
|
|
326
|
-
if (bool(picking.isActive) && !bool(picking.isAttribute)) {
|
|
327
|
-
// Since instance information is not used, we can use picking color for pixel index
|
|
328
|
-
fragColor.rgb = packUVsIntoRGB(uv);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
`;var Vo={image:{type:"image",value:null,async:true},bounds:{type:"array",value:[1,0,0,1],compare:true},_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:true,value:null}},Zo=(()=>{class t extends mc{getShaders(){return super.getShaders({vs:Bt,fs:Gt,modules:[Jh,nu,Dt]})}initializeState(){let e=this.getAttributeManager();e.remove(["instancePickingColors"]);let o=true;e.add({indices:{size:1,isIndexed:true,update:n=>n.value=this.state.mesh.indices,noAlloc:o},positions:{size:3,type:"float64",fp64:this.use64bitPositions(),update:n=>n.value=this.state.mesh.positions,noAlloc:o},texCoords:{size:2,update:n=>n.value=this.state.mesh.texCoords,noAlloc:o}});}updateState({props:e,oldProps:o,changeFlags:n}){let s=this.getAttributeManager();if(n.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),s.invalidateAll()),e.bounds!==o.bounds){let r=this.state.mesh,a=this._createMesh();this.state.model.setVertexCount(a.vertexCount);for(let l in a)r&&r[l]!==a[l]&&s.invalidate(l);this.setState(r$1({mesh:a},this._getCoordinateUniforms()));}else e._imageCoordinateSystem!==o._imageCoordinateSystem&&this.setState(this._getCoordinateUniforms());}getPickingInfo(e){let{image:o}=this.props,n=e.info;if(!n.color||!o)return n.bitmap=null,n;let{width:s,height:r}=o;n.index=0;let a=Ko(n.color);return n.bitmap={size:{width:s,height:r},uv:a,pixel:[Math.floor(a[0]*s),Math.floor(a[1]*r)]},n}disablePickingIndex(){this.setState({disablePicking:true});}restorePickingColors(){this.setState({disablePicking:false});}_updateAutoHighlight(e){super._updateAutoHighlight(s$1(r$1({},e),{color:this.encodePickingColor(0)}));}_createMesh(){let{bounds:e}=this.props,o=e;return Ut(e)&&(o=[[e[0],e[1]],[e[0],e[3]],[e[2],e[3]],[e[2],e[1]]]),at(o,this.context.viewport.resolution)}_getModel(){return new Kt$1(this.context.device,s$1(r$1({},this.getShaders()),{id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),topology:"triangle-list",isInstanced:false}))}draw(e){let{shaderModuleProps:o}=e,{model:n,coordinateConversion:s,bounds:r,disablePicking:a}=this.state,{image:l,desaturate:c,transparentColor:f,tintColor:u}=this.props;if(!(o.picking.isActive&&a)&&l&&n){let d={bitmapTexture:l,bounds:r,coordinateConversion:s,desaturate:c,tintColor:u.slice(0,3).map(p=>p/255),transparentColor:f.map(p=>p/255)};n.shaderInputs.setProps({bitmap:d}),n.draw(this.context.renderPass);}}_getCoordinateUniforms(){let{_imageCoordinateSystem:e}=this.props;if(e!=="default"){let{bounds:o}=this.props;if(!Ut(o))throw new Error("_imageCoordinateSystem only supports rectangular bounds");let n=this.context.viewport.resolution?"lnglat":"cartesian";if(e=e==="lnglat"?"lnglat":"cartesian",e==="lnglat"&&n==="cartesian")return {coordinateConversion:-1,bounds:o};if(e==="cartesian"&&n==="lnglat"){let s=ue$1([o[0],o[1]]),r=ue$1([o[2],o[3]]);return {coordinateConversion:1,bounds:[s[0],s[1],r[0],r[1]]}}}return {coordinateConversion:0,bounds:[0,0,0,0]}}}return t.layerName="BitmapLayer",t.defaultProps=Vo,t})(),Ho=Zo;function Ko(t){let[i,e,o]=t,n=(o&240)/256,s=(o&15)/16;return [(i+s)/256,(e+n)/256]}function Ut(t){return Number.isFinite(t[0])}var Nt=`layout(std140) uniform iconUniforms {
|
|
332
|
-
float sizeScale;
|
|
333
|
-
vec2 iconsTextureDim;
|
|
334
|
-
float sizeBasis;
|
|
335
|
-
float sizeMinPixels;
|
|
336
|
-
float sizeMaxPixels;
|
|
337
|
-
bool billboard;
|
|
338
|
-
highp int sizeUnits;
|
|
339
|
-
float alphaCutoff;
|
|
340
|
-
} icon;
|
|
341
|
-
`,Wt={name:"icon",vs:Nt,fs:Nt,uniformTypes:{sizeScale:"f32",iconsTextureDim:"vec2<f32>",sizeBasis:"f32",sizeMinPixels:"f32",sizeMaxPixels:"f32",billboard:"f32",sizeUnits:"i32",alphaCutoff:"f32"}};var jt=`#version 300 es
|
|
342
|
-
#define SHADER_NAME icon-layer-vertex-shader
|
|
343
|
-
in vec2 positions;
|
|
344
|
-
in vec3 instancePositions;
|
|
345
|
-
in vec3 instancePositions64Low;
|
|
346
|
-
in float instanceSizes;
|
|
347
|
-
in float instanceAngles;
|
|
348
|
-
in vec4 instanceColors;
|
|
349
|
-
in vec3 instancePickingColors;
|
|
350
|
-
in vec4 instanceIconFrames;
|
|
351
|
-
in float instanceColorModes;
|
|
352
|
-
in vec2 instanceOffsets;
|
|
353
|
-
in vec2 instancePixelOffset;
|
|
354
|
-
out float vColorMode;
|
|
355
|
-
out vec4 vColor;
|
|
356
|
-
out vec2 vTextureCoords;
|
|
357
|
-
out vec2 uv;
|
|
358
|
-
vec2 rotate_by_angle(vec2 vertex, float angle) {
|
|
359
|
-
float angle_radian = angle * PI / 180.0;
|
|
360
|
-
float cos_angle = cos(angle_radian);
|
|
361
|
-
float sin_angle = sin(angle_radian);
|
|
362
|
-
mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle);
|
|
363
|
-
return rotationMatrix * vertex;
|
|
364
|
-
}
|
|
365
|
-
void main(void) {
|
|
366
|
-
geometry.worldPosition = instancePositions;
|
|
367
|
-
geometry.uv = positions;
|
|
368
|
-
geometry.pickingColor = instancePickingColors;
|
|
369
|
-
uv = positions;
|
|
370
|
-
vec2 iconSize = instanceIconFrames.zw;
|
|
371
|
-
float sizePixels = clamp(
|
|
372
|
-
project_size_to_pixel(instanceSizes * icon.sizeScale, icon.sizeUnits),
|
|
373
|
-
icon.sizeMinPixels, icon.sizeMaxPixels
|
|
374
|
-
);
|
|
375
|
-
float iconConstraint = icon.sizeBasis == 0.0 ? iconSize.x : iconSize.y;
|
|
376
|
-
float instanceScale = iconConstraint == 0.0 ? 0.0 : sizePixels / iconConstraint;
|
|
377
|
-
vec2 pixelOffset = positions / 2.0 * iconSize + instanceOffsets;
|
|
378
|
-
pixelOffset = rotate_by_angle(pixelOffset, instanceAngles) * instanceScale;
|
|
379
|
-
pixelOffset += instancePixelOffset;
|
|
380
|
-
pixelOffset.y *= -1.0;
|
|
381
|
-
if (icon.billboard) {
|
|
382
|
-
gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);
|
|
383
|
-
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
|
|
384
|
-
vec3 offset = vec3(pixelOffset, 0.0);
|
|
385
|
-
DECKGL_FILTER_SIZE(offset, geometry);
|
|
386
|
-
gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);
|
|
387
|
-
} else {
|
|
388
|
-
vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0);
|
|
389
|
-
DECKGL_FILTER_SIZE(offset_common, geometry);
|
|
390
|
-
gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position);
|
|
391
|
-
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
|
|
392
|
-
}
|
|
393
|
-
vTextureCoords = mix(
|
|
394
|
-
instanceIconFrames.xy,
|
|
395
|
-
instanceIconFrames.xy + iconSize,
|
|
396
|
-
(positions.xy + 1.0) / 2.0
|
|
397
|
-
) / icon.iconsTextureDim;
|
|
398
|
-
vColor = instanceColors;
|
|
399
|
-
DECKGL_FILTER_COLOR(vColor, geometry);
|
|
400
|
-
vColorMode = instanceColorModes;
|
|
401
|
-
}
|
|
402
|
-
`;var Vt=`#version 300 es
|
|
403
|
-
#define SHADER_NAME icon-layer-fragment-shader
|
|
404
|
-
precision highp float;
|
|
405
|
-
uniform sampler2D iconsTexture;
|
|
406
|
-
in float vColorMode;
|
|
407
|
-
in vec4 vColor;
|
|
408
|
-
in vec2 vTextureCoords;
|
|
409
|
-
in vec2 uv;
|
|
410
|
-
out vec4 fragColor;
|
|
411
|
-
void main(void) {
|
|
412
|
-
geometry.uv = uv;
|
|
413
|
-
vec4 texColor = texture(iconsTexture, vTextureCoords);
|
|
414
|
-
vec3 color = mix(texColor.rgb, vColor.rgb, vColorMode);
|
|
415
|
-
float a = texColor.a * layer.opacity * vColor.a;
|
|
416
|
-
if (a < icon.alphaCutoff) {
|
|
417
|
-
discard;
|
|
418
|
-
}
|
|
419
|
-
fragColor = vec4(color, a);
|
|
420
|
-
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
421
|
-
}
|
|
422
|
-
`;var Zt=`struct IconUniforms {
|
|
423
|
-
sizeScale: f32,
|
|
424
|
-
iconsTextureDim: vec2<f32>,
|
|
425
|
-
sizeBasis: f32,
|
|
426
|
-
sizeMinPixels: f32,
|
|
427
|
-
sizeMaxPixels: f32,
|
|
428
|
-
billboard: i32,
|
|
429
|
-
sizeUnits: i32,
|
|
430
|
-
alphaCutoff: f32
|
|
431
|
-
};
|
|
432
|
-
|
|
433
|
-
@group(0) @binding(auto) var<uniform> icon: IconUniforms;
|
|
434
|
-
@group(0) @binding(auto) var iconsTexture : texture_2d<f32>;
|
|
435
|
-
@group(0) @binding(auto) var iconsTextureSampler : sampler;
|
|
436
|
-
|
|
437
|
-
fn rotate_by_angle(vertex: vec2<f32>, angle_deg: f32) -> vec2<f32> {
|
|
438
|
-
let angle_radian = angle_deg * PI / 180.0;
|
|
439
|
-
let c = cos(angle_radian);
|
|
440
|
-
let s = sin(angle_radian);
|
|
441
|
-
let rotation = mat2x2<f32>(vec2<f32>(c, s), vec2<f32>(-s, c));
|
|
442
|
-
return rotation * vertex;
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
struct Attributes {
|
|
446
|
-
@location(0) positions: vec2<f32>,
|
|
447
|
-
|
|
448
|
-
@location(1) instancePositions: vec3<f32>,
|
|
449
|
-
@location(2) instancePositions64Low: vec3<f32>,
|
|
450
|
-
@location(3) instanceSizes: f32,
|
|
451
|
-
@location(4) instanceAngles: f32,
|
|
452
|
-
@location(5) instanceColors: vec4<f32>,
|
|
453
|
-
@location(6) instancePickingColors: vec3<f32>,
|
|
454
|
-
@location(7) instanceIconFrames: vec4<f32>,
|
|
455
|
-
@location(8) instanceColorModes: f32,
|
|
456
|
-
@location(9) instanceOffsets: vec2<f32>,
|
|
457
|
-
@location(10) instancePixelOffset: vec2<f32>,
|
|
458
|
-
};
|
|
459
|
-
|
|
460
|
-
struct Varyings {
|
|
461
|
-
@builtin(position) position: vec4<f32>,
|
|
462
|
-
|
|
463
|
-
@location(0) vColorMode: f32,
|
|
464
|
-
@location(1) vColor: vec4<f32>,
|
|
465
|
-
@location(2) vTextureCoords: vec2<f32>,
|
|
466
|
-
@location(3) uv: vec2<f32>,
|
|
467
|
-
@location(4) pickingColor: vec3<f32>,
|
|
468
|
-
};
|
|
469
|
-
|
|
470
|
-
@vertex
|
|
471
|
-
fn vertexMain(inp: Attributes) -> Varyings {
|
|
472
|
-
// write geometry fields used by filters + FS
|
|
473
|
-
geometry.worldPosition = inp.instancePositions;
|
|
474
|
-
geometry.uv = inp.positions;
|
|
475
|
-
geometry.pickingColor = inp.instancePickingColors;
|
|
476
|
-
|
|
477
|
-
var outp: Varyings;
|
|
478
|
-
outp.uv = inp.positions;
|
|
479
|
-
|
|
480
|
-
let iconSize = inp.instanceIconFrames.zw;
|
|
481
|
-
|
|
482
|
-
// convert size in meters to pixels, then clamp
|
|
483
|
-
let sizePixels = clamp(
|
|
484
|
-
project_unit_size_to_pixel(inp.instanceSizes * icon.sizeScale, icon.sizeUnits),
|
|
485
|
-
icon.sizeMinPixels, icon.sizeMaxPixels
|
|
486
|
-
);
|
|
487
|
-
|
|
488
|
-
// scale icon height to match instanceSize
|
|
489
|
-
let iconConstraint = select(iconSize.y, iconSize.x, icon.sizeBasis == 0.0);
|
|
490
|
-
let instanceScale = select(sizePixels / iconConstraint, 0.0, iconConstraint == 0.0);
|
|
491
|
-
|
|
492
|
-
// scale and rotate vertex in "pixel" units; then add per-instance pixel offset
|
|
493
|
-
var pixelOffset = inp.positions / 2.0 * iconSize + inp.instanceOffsets;
|
|
494
|
-
pixelOffset = rotate_by_angle(pixelOffset, inp.instanceAngles) * instanceScale;
|
|
495
|
-
pixelOffset = pixelOffset + inp.instancePixelOffset;
|
|
496
|
-
pixelOffset.y = pixelOffset.y * -1.0;
|
|
497
|
-
|
|
498
|
-
if (icon.billboard != 0) {
|
|
499
|
-
var pos = project_position_to_clipspace(inp.instancePositions, inp.instancePositions64Low, vec3<f32>(0.0)); // TODO, &geometry.position);
|
|
500
|
-
// DECKGL_FILTER_GL_POSITION(pos, geometry);
|
|
501
|
-
|
|
502
|
-
var offset = vec3<f32>(pixelOffset, 0.0);
|
|
503
|
-
// DECKGL_FILTER_SIZE(offset, geometry);
|
|
504
|
-
let clipOffset = project_pixel_size_to_clipspace(offset.xy);
|
|
505
|
-
pos = vec4<f32>(pos.x + clipOffset.x, pos.y + clipOffset.y, pos.z, pos.w);
|
|
506
|
-
outp.position = pos;
|
|
507
|
-
} else {
|
|
508
|
-
var offset_common = vec3<f32>(project_pixel_size_vec2(pixelOffset), 0.0);
|
|
509
|
-
// DECKGL_FILTER_SIZE(offset_common, geometry);
|
|
510
|
-
var pos = project_position_to_clipspace(inp.instancePositions, inp.instancePositions64Low, offset_common); // TODO, &geometry.position);
|
|
511
|
-
// DECKGL_FILTER_GL_POSITION(pos, geometry);
|
|
512
|
-
outp.position = pos;
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
let uvMix = (inp.positions.xy + vec2<f32>(1.0, 1.0)) * 0.5;
|
|
516
|
-
outp.vTextureCoords = mix(inp.instanceIconFrames.xy, inp.instanceIconFrames.xy + iconSize, uvMix) / icon.iconsTextureDim;
|
|
517
|
-
|
|
518
|
-
outp.vColor = inp.instanceColors;
|
|
519
|
-
// DECKGL_FILTER_COLOR(outp.vColor, geometry);
|
|
520
|
-
|
|
521
|
-
outp.vColorMode = inp.instanceColorModes;
|
|
522
|
-
outp.pickingColor = inp.instancePickingColors;
|
|
523
|
-
|
|
524
|
-
return outp;
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
@fragment
|
|
528
|
-
fn fragmentMain(inp: Varyings) -> @location(0) vec4<f32> {
|
|
529
|
-
// expose to deck.gl filter hooks
|
|
530
|
-
geometry.uv = inp.uv;
|
|
531
|
-
|
|
532
|
-
let texColor = textureSample(iconsTexture, iconsTextureSampler, inp.vTextureCoords);
|
|
533
|
-
|
|
534
|
-
// if colorMode == 0, use pixel color from the texture
|
|
535
|
-
// if colorMode == 1 (or picking), use texture as transparency mask
|
|
536
|
-
let rgb = mix(texColor.rgb, inp.vColor.rgb, inp.vColorMode);
|
|
537
|
-
let a = texColor.a * layer.opacity * inp.vColor.a;
|
|
538
|
-
|
|
539
|
-
if (a < icon.alphaCutoff) {
|
|
540
|
-
discard;
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
if (picking.isActive > 0.5) {
|
|
544
|
-
if (!picking_isColorValid(inp.pickingColor)) {
|
|
545
|
-
discard;
|
|
546
|
-
}
|
|
547
|
-
return vec4<f32>(inp.pickingColor, 1.0);
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
var fragColor = deckgl_premultiplied_alpha(vec4<f32>(rgb, a));
|
|
551
|
-
|
|
552
|
-
if (picking.isHighlightActive > 0.5) {
|
|
553
|
-
let highlightedObjectColor = picking_normalizeColor(picking.highlightedObjectColor);
|
|
554
|
-
if (picking_isColorZero(abs(inp.pickingColor - highlightedObjectColor))) {
|
|
555
|
-
let highLightAlpha = picking.highlightColor.a;
|
|
556
|
-
let blendedAlpha = highLightAlpha + fragColor.a * (1.0 - highLightAlpha);
|
|
557
|
-
if (blendedAlpha > 0.0) {
|
|
558
|
-
let highLightRatio = highLightAlpha / blendedAlpha;
|
|
559
|
-
fragColor = vec4<f32>(
|
|
560
|
-
mix(fragColor.rgb, picking.highlightColor.rgb, highLightRatio),
|
|
561
|
-
blendedAlpha
|
|
562
|
-
);
|
|
563
|
-
} else {
|
|
564
|
-
fragColor = vec4<f32>(fragColor.rgb, 0.0);
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
return fragColor;
|
|
570
|
-
}
|
|
571
|
-
`;var $o=1024,Jo=4,Ht=()=>{},Kt={minFilter:"linear",mipmapFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"},Yo={x:0,y:0,width:0,height:0};function Xo(t){return Math.pow(2,Math.ceil(Math.log2(t)))}function qo(t,i,e,o){let n=Math.min(e/i.width,o/i.height),s=Math.floor(i.width*n),r=Math.floor(i.height*n);return n===1?{image:i,width:s,height:r}:(t.canvas.height=r,t.canvas.width=s,t.clearRect(0,0,s,r),t.drawImage(i,0,0,i.width,i.height,0,0,s,r),{image:t.canvas,width:s,height:r})}function ae(t){return t&&(t.id||t.url)}function Jt(t){let{device:i}=t;i.type==="webgl"?t.generateMipmapsWebGL():i.type==="webgpu"&&i.generateMipmapsWebGPU(t);}function Qo(t,i,e,o){let{width:n,height:s,device:r}=t,a=r.createTexture({format:"rgba8unorm",width:i,height:e,sampler:o,mipLevels:r.getMipLevelCount(i,e)}),l=r.createCommandEncoder();l.copyTextureToTexture({sourceTexture:t,destinationTexture:a,width:n,height:s});let c=l.finish();return r.submit(c),Jt(a),t.destroy(),a}function $t(t,i,e){for(let o=0;o<i.length;o++){let{icon:n,xOffset:s}=i[o],r=ae(n);t[r]=s$1(r$1({},n),{x:s,y:e});}}function en({icons:t,buffer:i,mapping:e={},xOffset:o=0,yOffset:n=0,rowHeight:s=0,canvasWidth:r}){let a=[];for(let l=0;l<t.length;l++){let c=t[l],f=ae(c);if(!e[f]){let{height:u,width:d}=c;o+d+i>r&&($t(e,a,n),o=0,n=s+n+i,s=0,a=[]),a.push({icon:c,xOffset:o}),o=o+d+i,s=Math.max(s,u);}}return a.length>0&&$t(e,a,n),{mapping:e,rowHeight:s,xOffset:o,yOffset:n,canvasWidth:r,canvasHeight:Xo(s+n+i)}}function tn(t,i,e){if(!t||!i)return null;e=e||{};let o={},{iterable:n,objectInfo:s}=fi$1(t);for(let r of n){s.index++;let a=i(r,s),l=ae(a);if(!a)throw new Error("Icon is missing.");if(!a.url)throw new Error("Icon url is missing.");!o[l]&&(!e[l]||a.url!==e[l].url)&&(o[l]=s$1(r$1({},a),{source:r,sourceIndex:s.index}));}return o}var Oe=class{constructor(i,{onUpdate:e=Ht,onError:o=Ht}){this._loadOptions=null,this._texture=null,this._externalTexture=null,this._mapping={},this._samplerParameters=null,this._pendingCount=0,this._autoPacking=false,this._xOffset=0,this._yOffset=0,this._rowHeight=0,this._buffer=Jo,this._canvasWidth=$o,this._canvasHeight=0,this._canvas=null,this.device=i,this.onUpdate=e,this.onError=o;}finalize(){this._texture?.delete();}getTexture(){return this._texture||this._externalTexture}getIconMapping(i){let e=this._autoPacking?ae(i):i;return this._mapping[e]||Yo}setProps({loadOptions:i,autoPacking:e,iconAtlas:o,iconMapping:n,textureParameters:s}){i&&(this._loadOptions=i),e!==void 0&&(this._autoPacking=e),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(i,e){if(!this._autoPacking||typeof document>"u")return;let o=Object.values(tn(i,e,this._mapping)||{});if(o.length>0){let{mapping:n,xOffset:s,yOffset:r,rowHeight:a,canvasHeight:l}=en({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||Kt,mipLevels:this.device.getMipLevelCount(this._canvasWidth,this._canvasHeight)})),this._texture.height!==this._canvasHeight&&(this._texture=Qo(this._texture,this._canvasWidth,this._canvasHeight,this._samplerParameters||Kt)),this.onUpdate(true),this._canvas=this._canvas||document.createElement("canvas"),this._loadIcons(o);}}_loadIcons(i){let e=this._canvas.getContext("2d",{willReadFrequently:true});for(let o of i)this._pendingCount++,Nt$1(o.url,this._loadOptions).then(n=>{let s=ae(o),r=this._mapping[s],{x:a,y:l,width:c,height:f}=r,{image:u,width:d,height:p}=qo(e,n,c,f),g=a+(c-d)/2,h=l+(f-p)/2;this._texture?.copyExternalImage({image:u,x:g,y:h,width:d,height:p}),r.x=g,r.y=h,r.width=d,r.height=p,this._texture&&Jt(this._texture),this.onUpdate(d!==c||p!==f);}).catch(n=>{this.onError({url:o.url,source:o.source,sourceIndex:o.sourceIndex,loadOptions:this._loadOptions,error:n});}).finally(()=>{this._pendingCount--;});}};var Yt=[0,0,0,255],on={iconAtlas:{type:"image",value:null,async:true},iconMapping:{type:"object",value:{},async:true},sizeScale:{type:"number",value:1,min:0},billboard:true,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:t=>t.position},getIcon:{type:"accessor",value:t=>t.icon},getColor:{type:"accessor",value:Yt},getSize:{type:"accessor",value:1},getAngle:{type:"accessor",value:0},getPixelOffset:{type:"accessor",value:[0,0]},onIconError:{type:"function",value:null,optional:true},textureParameters:{type:"object",ignore:true,value:null}},nn=(()=>{class t extends mc{getShaders(){return super.getShaders({vs:jt,fs:Vt,source:Zt,modules:[Jh,Eh,nu,Wt]})}initializeState(){this.state={iconManager:new Oe(this.context.device,{onUpdate:this._onUpdate.bind(this),onError:this._onError.bind(this)})},this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:true,accessor:"getPosition"},instanceSizes:{size:1,transition:true,accessor:"getSize",defaultValue:1},instanceIconDefs:{size:7,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:true,accessor:"getColor",defaultValue:Yt},instanceAngles:{size:1,transition:true,accessor:"getAngle"},instancePixelOffset:{size:2,transition:true,accessor:"getPixelOffset"}});}updateState(e){super.updateState(e);let{props:o,oldProps:n,changeFlags:s}=e,r=this.getAttributeManager(),{iconAtlas:a,iconMapping:l,data:c,getIcon:f,textureParameters:u}=o,{iconManager:d}=this.state;if(typeof a=="string")return;let p=a||this.internalState.isAsyncPropLoading("iconAtlas");d.setProps({loadOptions:o.loadOptions,autoPacking:!p,iconAtlas:a,iconMapping:p?l:null,textureParameters:u}),p?n.iconMapping!==o.iconMapping&&r.invalidate("getIcon"):(s.dataChanged||s.updateTriggersChanged&&(s.updateTriggersChanged.all||s.updateTriggersChanged.getIcon))&&d.packIcons(c,f),s.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),r.invalidateAll());}get isLoaded(){return super.isLoaded&&this.state.iconManager.isLoaded}finalizeState(e){super.finalizeState(e),this.state.iconManager.finalize();}draw({uniforms:e}){let{sizeScale:o,sizeBasis:n,sizeMinPixels:s,sizeMaxPixels:r,sizeUnits:a,billboard:l,alphaCutoff:c}=this.props,{iconManager:f}=this.state,u=f.getTexture();if(u){let d=this.state.model,p={iconsTexture:u,iconsTextureDim:[u.width,u.height],sizeUnits:yt$1[a],sizeScale:o,sizeBasis:n==="height"?1:0,sizeMinPixels:s,sizeMaxPixels:r,billboard:l,alphaCutoff:c};d.shaderInputs.setProps({icon:p}),d.draw(this.context.renderPass);}}_getModel(){let e=[-1,-1,1,-1,-1,1,1,1];return new Kt$1(this.context.device,s$1(r$1({},this.getShaders()),{id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Zr({topology:"triangle-strip",attributes:{positions:{size:2,value:new Float32Array(e)}}}),isInstanced:true}))}_onUpdate(e){e?(this.getAttributeManager()?.invalidate("getIcon"),this.setNeedsUpdate()):this.setNeedsRedraw();}_onError(e){let o=this.getCurrentLayer()?.props.onIconError;o?o(e):C.error(e.error.message)();}getInstanceIconDef(e){let{x:o,y:n,width:s,height:r,mask:a,anchorX:l=s/2,anchorY:c=r/2}=this.state.iconManager.getIconMapping(e);return [s/2-l,r/2-c,o,n,s,r,a?1:0]}}return t.defaultProps=on,t.layerName="IconLayer",t})(),le=nn;var Xt=`layout(std140) uniform lineUniforms {
|
|
572
|
-
float widthScale;
|
|
573
|
-
float widthMinPixels;
|
|
574
|
-
float widthMaxPixels;
|
|
575
|
-
float useShortestPath;
|
|
576
|
-
highp int widthUnits;
|
|
577
|
-
} line;
|
|
578
|
-
`,qt={name:"line",source:"",vs:Xt,fs:Xt,uniformTypes:{widthScale:"f32",widthMinPixels:"f32",widthMaxPixels:"f32",useShortestPath:"f32",widthUnits:"i32"}};var Qt=`// ---------- Helper Structures & Functions ----------
|
|
579
|
-
|
|
580
|
-
// Placeholder filter functions.
|
|
581
|
-
fn deckgl_filter_size(offset: vec3<f32>, geometry: Geometry) -> vec3<f32> {
|
|
582
|
-
return offset;
|
|
583
|
-
}
|
|
584
|
-
fn deckgl_filter_gl_position(p: vec4<f32>, geometry: Geometry) -> vec4<f32> {
|
|
585
|
-
if (picking.isAttribute > 0.5) {
|
|
586
|
-
// For depth picking, write normalized depth into the picking payload.
|
|
587
|
-
// This mirrors the legacy DECKGL_FILTER_GL_POSITION hook on WebGL.
|
|
588
|
-
}
|
|
589
|
-
return p;
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
// Compute an extrusion offset given a line direction (in clipspace),
|
|
593
|
-
// an offset direction (-1 or 1), and a width in pixels.
|
|
594
|
-
// Assumes a uniform "project" with a viewportSize field is available.
|
|
595
|
-
fn getExtrusionOffset(line_clipspace: vec2<f32>, offset_direction: f32, width: f32) -> vec2<f32> {
|
|
596
|
-
// project.viewportSize should be provided as a uniform (not shown here)
|
|
597
|
-
let dir_screenspace = normalize(line_clipspace * project.viewportSize);
|
|
598
|
-
// Rotate by 90\xB0: (x,y) becomes (-y,x)
|
|
599
|
-
let rotated = vec2<f32>(-dir_screenspace.y, dir_screenspace.x);
|
|
600
|
-
return rotated * offset_direction * width / 2.0;
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
// Splits the line between two points at a given x coordinate.
|
|
604
|
-
// Interpolates the y and z components.
|
|
605
|
-
fn splitLine(a: vec3<f32>, b: vec3<f32>, x: f32) -> vec3<f32> {
|
|
606
|
-
let t: f32 = (x - a.x) / (b.x - a.x);
|
|
607
|
-
return vec3<f32>(x, a.yz + t * (b.yz - a.yz));
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
// ---------- Uniforms & Global Structures ----------
|
|
611
|
-
|
|
612
|
-
struct LineUniforms {
|
|
613
|
-
widthScale: f32,
|
|
614
|
-
widthMinPixels: f32,
|
|
615
|
-
widthMaxPixels: f32,
|
|
616
|
-
useShortestPath: f32,
|
|
617
|
-
widthUnits: i32,
|
|
618
|
-
};
|
|
619
|
-
|
|
620
|
-
@group(0) @binding(0)
|
|
621
|
-
var<uniform> line: LineUniforms;
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
// ---------- Vertex Output Structure ----------
|
|
626
|
-
|
|
627
|
-
struct Varyings {
|
|
628
|
-
@builtin(position) gl_Position: vec4<f32>,
|
|
629
|
-
@location(0) vColor: vec4<f32>,
|
|
630
|
-
@location(1) uv: vec2<f32>,
|
|
631
|
-
@location(2) pickingColor: vec3<f32>,
|
|
632
|
-
};
|
|
633
|
-
|
|
634
|
-
// ---------- Vertex Shader Entry Point ----------
|
|
635
|
-
|
|
636
|
-
@vertex
|
|
637
|
-
fn vertexMain(
|
|
638
|
-
@location(0) positions: vec3<f32>,
|
|
639
|
-
@location(1) instanceSourcePositions: vec3<f32>,
|
|
640
|
-
@location(2) instanceTargetPositions: vec3<f32>,
|
|
641
|
-
@location(3) instanceSourcePositions64Low: vec3<f32>,
|
|
642
|
-
@location(4) instanceTargetPositions64Low: vec3<f32>,
|
|
643
|
-
@location(5) instanceColors: vec4<f32>,
|
|
644
|
-
@location(6) instancePickingColors: vec3<f32>,
|
|
645
|
-
@location(7) instanceWidths: f32
|
|
646
|
-
) -> Varyings {
|
|
647
|
-
geometry.worldPosition = instanceSourcePositions;
|
|
648
|
-
geometry.worldPositionAlt = instanceTargetPositions;
|
|
649
|
-
|
|
650
|
-
var source_world: vec3<f32> = instanceSourcePositions;
|
|
651
|
-
var target_world: vec3<f32> = instanceTargetPositions;
|
|
652
|
-
var source_world_64low: vec3<f32> = instanceSourcePositions64Low;
|
|
653
|
-
var target_world_64low: vec3<f32> = instanceTargetPositions64Low;
|
|
654
|
-
|
|
655
|
-
// Apply shortest-path adjustments if needed.
|
|
656
|
-
if (line.useShortestPath > 0.5 || line.useShortestPath < -0.5) {
|
|
657
|
-
source_world.x = (source_world.x + 180.0 % 360.0) - 180.0;
|
|
658
|
-
target_world.x = (target_world.x + 180.0 % 360.0) - 180.0;
|
|
659
|
-
let deltaLng: f32 = target_world.x - source_world.x;
|
|
660
|
-
|
|
661
|
-
if (deltaLng * line.useShortestPath > 180.0) {
|
|
662
|
-
source_world.x = source_world.x + 360.0 * line.useShortestPath;
|
|
663
|
-
source_world = splitLine(source_world, target_world, 180.0 * line.useShortestPath);
|
|
664
|
-
source_world_64low = vec3<f32>(0.0, 0.0, 0.0);
|
|
665
|
-
} else if (deltaLng * line.useShortestPath < -180.0) {
|
|
666
|
-
target_world.x = target_world.x + 360.0 * line.useShortestPath;
|
|
667
|
-
target_world = splitLine(source_world, target_world, 180.0 * line.useShortestPath);
|
|
668
|
-
target_world_64low = vec3<f32>(0.0, 0.0, 0.0);
|
|
669
|
-
} else if (line.useShortestPath < 0.0) {
|
|
670
|
-
var abortOut: Varyings;
|
|
671
|
-
abortOut.gl_Position = vec4<f32>(0.0);
|
|
672
|
-
abortOut.vColor = vec4<f32>(0.0);
|
|
673
|
-
abortOut.uv = vec2<f32>(0.0);
|
|
674
|
-
return abortOut;
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
// Project Pos and target positions to clip space.
|
|
679
|
-
let sourceResult = project_position_to_clipspace_and_commonspace(source_world, source_world_64low, vec3<f32>(0.0));
|
|
680
|
-
let targetResult = project_position_to_clipspace_and_commonspace(target_world, target_world_64low, vec3<f32>(0.0));
|
|
681
|
-
let sourcePos: vec4<f32> = sourceResult.clipPosition;
|
|
682
|
-
let targetPos: vec4<f32> = targetResult.clipPosition;
|
|
683
|
-
let source_commonspace: vec4<f32> = sourceResult.commonPosition;
|
|
684
|
-
let target_commonspace: vec4<f32> = targetResult.commonPosition;
|
|
685
|
-
|
|
686
|
-
// Interpolate along the line segment.
|
|
687
|
-
let segmentIndex: f32 = positions.x;
|
|
688
|
-
let p: vec4<f32> = sourcePos + segmentIndex * (targetPos - sourcePos);
|
|
689
|
-
geometry.position = source_commonspace + segmentIndex * (target_commonspace - source_commonspace);
|
|
690
|
-
let uv: vec2<f32> = positions.xy;
|
|
691
|
-
geometry.uv = uv;
|
|
692
|
-
geometry.pickingColor = instancePickingColors;
|
|
693
|
-
|
|
694
|
-
// Determine width in pixels.
|
|
695
|
-
let widthPixels: f32 = clamp(
|
|
696
|
-
project_unit_size_to_pixel(instanceWidths * line.widthScale, line.widthUnits),
|
|
697
|
-
line.widthMinPixels, line.widthMaxPixels
|
|
698
|
-
);
|
|
699
|
-
|
|
700
|
-
// Compute extrusion offset.
|
|
701
|
-
let extrusion: vec2<f32> = getExtrusionOffset(targetPos.xy - sourcePos.xy, positions.y, widthPixels);
|
|
702
|
-
let offset: vec3<f32> = vec3<f32>(extrusion, 0.0);
|
|
703
|
-
|
|
704
|
-
// Apply deck.gl filter functions.
|
|
705
|
-
let filteredOffset = deckgl_filter_size(offset, geometry);
|
|
706
|
-
let filteredP = deckgl_filter_gl_position(p, geometry);
|
|
707
|
-
|
|
708
|
-
let clipOffset: vec2<f32> = project_pixel_size_to_clipspace(filteredOffset.xy);
|
|
709
|
-
let finalPosition: vec4<f32> = filteredP + vec4<f32>(clipOffset, 0.0, 0.0);
|
|
710
|
-
|
|
711
|
-
// Compute color.
|
|
712
|
-
var vColor: vec4<f32> = vec4<f32>(instanceColors.rgb, instanceColors.a * layer.opacity);
|
|
713
|
-
// vColor = deckgl_filter_color(vColor, geometry);
|
|
714
|
-
|
|
715
|
-
var output: Varyings;
|
|
716
|
-
output.gl_Position = finalPosition;
|
|
717
|
-
output.vColor = vColor;
|
|
718
|
-
output.uv = uv;
|
|
719
|
-
output.pickingColor = instancePickingColors;
|
|
720
|
-
return output;
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
@fragment
|
|
724
|
-
fn fragmentMain(
|
|
725
|
-
@location(0) vColor: vec4<f32>,
|
|
726
|
-
@location(1) uv: vec2<f32>,
|
|
727
|
-
@location(2) pickingColor: vec3<f32>
|
|
728
|
-
) -> @location(0) vec4<f32> {
|
|
729
|
-
// Create and initialize geometry with the provided uv.
|
|
730
|
-
var geometry: Geometry;
|
|
731
|
-
geometry.uv = uv;
|
|
732
|
-
|
|
733
|
-
// Start with the input color.
|
|
734
|
-
var fragColor: vec4<f32> = vColor;
|
|
735
|
-
|
|
736
|
-
if (picking.isActive > 0.5) {
|
|
737
|
-
if (!picking_isColorValid(pickingColor)) {
|
|
738
|
-
discard;
|
|
739
|
-
}
|
|
740
|
-
return vec4<f32>(pickingColor, 1.0);
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
if (picking.isHighlightActive > 0.5) {
|
|
744
|
-
let highlightedObjectColor = picking_normalizeColor(picking.highlightedObjectColor);
|
|
745
|
-
if (picking_isColorZero(abs(pickingColor - highlightedObjectColor))) {
|
|
746
|
-
let highLightAlpha = picking.highlightColor.a;
|
|
747
|
-
let blendedAlpha = highLightAlpha + fragColor.a * (1.0 - highLightAlpha);
|
|
748
|
-
if (blendedAlpha > 0.0) {
|
|
749
|
-
let highLightRatio = highLightAlpha / blendedAlpha;
|
|
750
|
-
fragColor = vec4<f32>(
|
|
751
|
-
mix(fragColor.rgb, picking.highlightColor.rgb, highLightRatio),
|
|
752
|
-
blendedAlpha
|
|
753
|
-
);
|
|
754
|
-
} else {
|
|
755
|
-
fragColor = vec4<f32>(fragColor.rgb, 0.0);
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
// Apply premultiplied alpha as required by transparent canvas
|
|
761
|
-
fragColor = deckgl_premultiplied_alpha(fragColor);
|
|
762
|
-
|
|
763
|
-
return fragColor;
|
|
764
|
-
}
|
|
765
|
-
`;var ei=`#version 300 es
|
|
766
|
-
#define SHADER_NAME line-layer-vertex-shader
|
|
767
|
-
in vec3 positions;
|
|
768
|
-
in vec3 instanceSourcePositions;
|
|
769
|
-
in vec3 instanceTargetPositions;
|
|
770
|
-
in vec3 instanceSourcePositions64Low;
|
|
771
|
-
in vec3 instanceTargetPositions64Low;
|
|
772
|
-
in vec4 instanceColors;
|
|
773
|
-
in vec3 instancePickingColors;
|
|
774
|
-
in float instanceWidths;
|
|
775
|
-
out vec4 vColor;
|
|
776
|
-
out vec2 uv;
|
|
777
|
-
vec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction, float width) {
|
|
778
|
-
vec2 dir_screenspace = normalize(line_clipspace * project.viewportSize);
|
|
779
|
-
dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
|
|
780
|
-
return dir_screenspace * offset_direction * width / 2.0;
|
|
781
|
-
}
|
|
782
|
-
vec3 splitLine(vec3 a, vec3 b, float x) {
|
|
783
|
-
float t = (x - a.x) / (b.x - a.x);
|
|
784
|
-
return vec3(x, mix(a.yz, b.yz, t));
|
|
785
|
-
}
|
|
786
|
-
void main(void) {
|
|
787
|
-
geometry.worldPosition = instanceSourcePositions;
|
|
788
|
-
geometry.worldPositionAlt = instanceTargetPositions;
|
|
789
|
-
vec3 source_world = instanceSourcePositions;
|
|
790
|
-
vec3 target_world = instanceTargetPositions;
|
|
791
|
-
vec3 source_world_64low = instanceSourcePositions64Low;
|
|
792
|
-
vec3 target_world_64low = instanceTargetPositions64Low;
|
|
793
|
-
if (line.useShortestPath > 0.5 || line.useShortestPath < -0.5) {
|
|
794
|
-
source_world.x = mod(source_world.x + 180., 360.0) - 180.;
|
|
795
|
-
target_world.x = mod(target_world.x + 180., 360.0) - 180.;
|
|
796
|
-
float deltaLng = target_world.x - source_world.x;
|
|
797
|
-
if (deltaLng * line.useShortestPath > 180.) {
|
|
798
|
-
source_world.x += 360. * line.useShortestPath;
|
|
799
|
-
source_world = splitLine(source_world, target_world, 180. * line.useShortestPath);
|
|
800
|
-
source_world_64low = vec3(0.0);
|
|
801
|
-
} else if (deltaLng * line.useShortestPath < -180.) {
|
|
802
|
-
target_world.x += 360. * line.useShortestPath;
|
|
803
|
-
target_world = splitLine(source_world, target_world, 180. * line.useShortestPath);
|
|
804
|
-
target_world_64low = vec3(0.0);
|
|
805
|
-
} else if (line.useShortestPath < 0.) {
|
|
806
|
-
gl_Position = vec4(0.);
|
|
807
|
-
return;
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
vec4 source_commonspace;
|
|
811
|
-
vec4 target_commonspace;
|
|
812
|
-
vec4 source = project_position_to_clipspace(source_world, source_world_64low, vec3(0.), source_commonspace);
|
|
813
|
-
vec4 target = project_position_to_clipspace(target_world, target_world_64low, vec3(0.), target_commonspace);
|
|
814
|
-
float segmentIndex = positions.x;
|
|
815
|
-
vec4 p = mix(source, target, segmentIndex);
|
|
816
|
-
geometry.position = mix(source_commonspace, target_commonspace, segmentIndex);
|
|
817
|
-
uv = positions.xy;
|
|
818
|
-
geometry.uv = uv;
|
|
819
|
-
geometry.pickingColor = instancePickingColors;
|
|
820
|
-
float widthPixels = clamp(
|
|
821
|
-
project_size_to_pixel(instanceWidths * line.widthScale, line.widthUnits),
|
|
822
|
-
line.widthMinPixels, line.widthMaxPixels
|
|
823
|
-
);
|
|
824
|
-
vec3 offset = vec3(
|
|
825
|
-
getExtrusionOffset(target.xy - source.xy, positions.y, widthPixels),
|
|
826
|
-
0.0);
|
|
827
|
-
DECKGL_FILTER_SIZE(offset, geometry);
|
|
828
|
-
DECKGL_FILTER_GL_POSITION(p, geometry);
|
|
829
|
-
gl_Position = p + vec4(project_pixel_size_to_clipspace(offset.xy), 0.0, 0.0);
|
|
830
|
-
vColor = vec4(instanceColors.rgb, instanceColors.a * layer.opacity);
|
|
831
|
-
DECKGL_FILTER_COLOR(vColor, geometry);
|
|
832
|
-
}
|
|
833
|
-
`;var ti=`#version 300 es
|
|
834
|
-
#define SHADER_NAME line-layer-fragment-shader
|
|
835
|
-
precision highp float;
|
|
836
|
-
in vec4 vColor;
|
|
837
|
-
in vec2 uv;
|
|
838
|
-
out vec4 fragColor;
|
|
839
|
-
void main(void) {
|
|
840
|
-
geometry.uv = uv;
|
|
841
|
-
fragColor = vColor;
|
|
842
|
-
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
843
|
-
}
|
|
844
|
-
`;var sn=[0,0,0,255],rn={getSourcePosition:{type:"accessor",value:t=>t.sourcePosition},getTargetPosition:{type:"accessor",value:t=>t.targetPosition},getColor:{type:"accessor",value:sn},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}},an=(()=>{class t extends mc{getBounds(){return this.getAttributeManager()?.getBounds(["instanceSourcePositions","instanceTargetPositions"])}getShaders(){return super.getShaders({vs:ei,fs:ti,source:Qt,modules:[Jh,Eh,nu,qt]})}get wrapLongitude(){return false}initializeState(){this.getAttributeManager().addInstanced({instanceSourcePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:true,accessor:"getSourcePosition"},instanceTargetPositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:true,accessor:"getTargetPosition"},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",transition:true,accessor:"getColor",defaultValue:[0,0,0,255]},instanceWidths:{size:1,transition:true,accessor:"getWidth",defaultValue:1}});}updateState(e){super.updateState(e),e.changeFlags.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll());}draw({uniforms:e}){let{widthUnits:o,widthScale:n,widthMinPixels:s,widthMaxPixels:r,wrapLongitude:a}=this.props,l=this.state.model,c={widthUnits:yt$1[o],widthScale:n,widthMinPixels:s,widthMaxPixels:r,useShortestPath:a?1:0};l.shaderInputs.setProps({line:c}),l.draw(this.context.renderPass),a&&(l.shaderInputs.setProps({line:s$1(r$1({},c),{useShortestPath:-1})}),l.draw(this.context.renderPass));}_getModel(){let e=[0,-1,0,0,1,0,1,-1,0,1,1,0];return new Kt$1(this.context.device,s$1(r$1({},this.getShaders()),{id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Zr({topology:"triangle-strip",attributes:{positions:{size:3,value:new Float32Array(e)}}}),isInstanced:true}))}}return t.layerName="LineLayer",t.defaultProps=rn,t})(),ln=an;var ii=`layout(std140) uniform pointCloudUniforms {
|
|
845
|
-
float radiusPixels;
|
|
846
|
-
highp int sizeUnits;
|
|
847
|
-
} pointCloud;
|
|
848
|
-
`,oi={name:"pointCloud",source:"",vs:ii,fs:ii,uniformTypes:{radiusPixels:"f32",sizeUnits:"i32"}};var ni=`#version 300 es
|
|
849
|
-
#define SHADER_NAME point-cloud-layer-vertex-shader
|
|
850
|
-
in vec3 positions;
|
|
851
|
-
in vec3 instanceNormals;
|
|
852
|
-
in vec4 instanceColors;
|
|
853
|
-
in vec3 instancePositions;
|
|
854
|
-
in vec3 instancePositions64Low;
|
|
855
|
-
in vec3 instancePickingColors;
|
|
856
|
-
out vec4 vColor;
|
|
857
|
-
out vec2 unitPosition;
|
|
858
|
-
void main(void) {
|
|
859
|
-
geometry.worldPosition = instancePositions;
|
|
860
|
-
geometry.normal = project_normal(instanceNormals);
|
|
861
|
-
unitPosition = positions.xy;
|
|
862
|
-
geometry.uv = unitPosition;
|
|
863
|
-
geometry.pickingColor = instancePickingColors;
|
|
864
|
-
vec3 offset = vec3(positions.xy * project_size_to_pixel(pointCloud.radiusPixels, pointCloud.sizeUnits), 0.0);
|
|
865
|
-
DECKGL_FILTER_SIZE(offset, geometry);
|
|
866
|
-
gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.), geometry.position);
|
|
867
|
-
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
|
|
868
|
-
gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);
|
|
869
|
-
vec3 lightColor = lighting_getLightColor(instanceColors.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal);
|
|
870
|
-
vColor = vec4(lightColor, instanceColors.a * layer.opacity);
|
|
871
|
-
DECKGL_FILTER_COLOR(vColor, geometry);
|
|
872
|
-
}
|
|
873
|
-
`;var si=`#version 300 es
|
|
874
|
-
#define SHADER_NAME point-cloud-layer-fragment-shader
|
|
875
|
-
precision highp float;
|
|
876
|
-
in vec4 vColor;
|
|
877
|
-
in vec2 unitPosition;
|
|
878
|
-
out vec4 fragColor;
|
|
879
|
-
void main(void) {
|
|
880
|
-
geometry.uv = unitPosition.xy;
|
|
881
|
-
float distToCenter = length(unitPosition);
|
|
882
|
-
if (distToCenter > 1.0) {
|
|
883
|
-
discard;
|
|
884
|
-
}
|
|
885
|
-
fragColor = vColor;
|
|
886
|
-
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
887
|
-
}
|
|
888
|
-
`;var ri=`struct PointCloudUniforms {
|
|
889
|
-
radiusPixels: f32,
|
|
890
|
-
sizeUnits: i32,
|
|
891
|
-
};
|
|
892
|
-
|
|
893
|
-
@group(0) @binding(0)
|
|
894
|
-
var<uniform> pointCloudUniforms: PointCloudUniforms;
|
|
895
|
-
|
|
896
|
-
struct ConstantAttributes {
|
|
897
|
-
instanceNormals: vec3<f32>,
|
|
898
|
-
instanceColors: vec4<f32>,
|
|
899
|
-
instancePositions: vec3<f32>,
|
|
900
|
-
instancePositions64Low: vec3<f32>,
|
|
901
|
-
instancePickingColors: vec3<f32>
|
|
902
|
-
};
|
|
903
|
-
|
|
904
|
-
const constants = ConstantAttributes(
|
|
905
|
-
vec3<f32>(1.0, 0.0, 0.0),
|
|
906
|
-
vec4<f32>(0.0, 0.0, 0.0, 1.0),
|
|
907
|
-
vec3<f32>(0.0),
|
|
908
|
-
vec3<f32>(0.0),
|
|
909
|
-
vec3<f32>(0.0)
|
|
910
|
-
);
|
|
911
|
-
|
|
912
|
-
struct Attributes {
|
|
913
|
-
@builtin(instance_index) instanceIndex : u32,
|
|
914
|
-
@builtin(vertex_index) vertexIndex : u32,
|
|
915
|
-
@location(0) positions: vec3<f32>,
|
|
916
|
-
@location(1) instancePositions: vec3<f32>,
|
|
917
|
-
@location(2) instancePositions64Low: vec3<f32>,
|
|
918
|
-
@location(3) instanceNormals: vec3<f32>,
|
|
919
|
-
@location(4) instanceColors: vec4<f32>,
|
|
920
|
-
@location(5) instancePickingColors: vec3<f32>
|
|
921
|
-
};
|
|
922
|
-
|
|
923
|
-
struct Varyings {
|
|
924
|
-
@builtin(position) position: vec4<f32>,
|
|
925
|
-
@location(0) vColor: vec4<f32>,
|
|
926
|
-
@location(1) unitPosition: vec2<f32>,
|
|
927
|
-
@location(2) pickingColor: vec3<f32>,
|
|
928
|
-
};
|
|
929
|
-
|
|
930
|
-
@vertex
|
|
931
|
-
fn vertexMain(attributes: Attributes) -> Varyings {
|
|
932
|
-
var varyings: Varyings;
|
|
933
|
-
|
|
934
|
-
geometry.worldPosition = attributes.instancePositions;
|
|
935
|
-
|
|
936
|
-
let centerResult = project_position_to_clipspace_and_commonspace(
|
|
937
|
-
attributes.instancePositions,
|
|
938
|
-
attributes.instancePositions64Low,
|
|
939
|
-
vec3<f32>(0.0)
|
|
940
|
-
);
|
|
941
|
-
geometry.position = centerResult.commonPosition;
|
|
942
|
-
geometry.normal = project_normal(attributes.instanceNormals);
|
|
943
|
-
|
|
944
|
-
// position on the containing square in [-1, 1] space
|
|
945
|
-
varyings.unitPosition = attributes.positions.xy;
|
|
946
|
-
geometry.uv = varyings.unitPosition;
|
|
947
|
-
geometry.pickingColor = attributes.instancePickingColors;
|
|
948
|
-
|
|
949
|
-
// Find the center of the point and add the current vertex
|
|
950
|
-
let offset = vec3<f32>(
|
|
951
|
-
attributes.positions.xy *
|
|
952
|
-
project_unit_size_to_pixel(pointCloudUniforms.radiusPixels, pointCloudUniforms.sizeUnits),
|
|
953
|
-
0.0
|
|
954
|
-
);
|
|
955
|
-
// DECKGL_FILTER_SIZE(offset, geometry);
|
|
956
|
-
|
|
957
|
-
varyings.position = centerResult.clipPosition;
|
|
958
|
-
// DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
|
|
959
|
-
let clipPixels = project_pixel_size_to_clipspace(offset.xy);
|
|
960
|
-
varyings.position.x += clipPixels.x;
|
|
961
|
-
varyings.position.y += clipPixels.y;
|
|
962
|
-
|
|
963
|
-
// Apply lighting
|
|
964
|
-
let lightColor = lighting_getLightColor2(attributes.instanceColors.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal);
|
|
965
|
-
|
|
966
|
-
// Apply opacity to instance color, or return instance picking color
|
|
967
|
-
varyings.vColor = vec4(lightColor, attributes.instanceColors.a * layer.opacity);
|
|
968
|
-
// DECKGL_FILTER_COLOR(vColor, geometry);
|
|
969
|
-
varyings.pickingColor = attributes.instancePickingColors;
|
|
970
|
-
|
|
971
|
-
return varyings;
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
@fragment
|
|
975
|
-
fn fragmentMain(varyings: Varyings) -> @location(0) vec4<f32> {
|
|
976
|
-
// var geometry: Geometry;
|
|
977
|
-
// geometry.uv = unitPosition.xy;
|
|
978
|
-
|
|
979
|
-
let distToCenter = length(varyings.unitPosition);
|
|
980
|
-
if (distToCenter > 1.0) {
|
|
981
|
-
discard;
|
|
982
|
-
}
|
|
983
|
-
|
|
984
|
-
var fragColor: vec4<f32>;
|
|
985
|
-
|
|
986
|
-
fragColor = varyings.vColor;
|
|
987
|
-
|
|
988
|
-
if (picking.isActive > 0.5) {
|
|
989
|
-
if (!picking_isColorValid(varyings.pickingColor)) {
|
|
990
|
-
discard;
|
|
991
|
-
}
|
|
992
|
-
return vec4<f32>(varyings.pickingColor, 1.0);
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
if (picking.isHighlightActive > 0.5) {
|
|
996
|
-
let highlightedObjectColor = picking_normalizeColor(picking.highlightedObjectColor);
|
|
997
|
-
if (picking_isColorZero(abs(varyings.pickingColor - highlightedObjectColor))) {
|
|
998
|
-
let highLightAlpha = picking.highlightColor.a;
|
|
999
|
-
let blendedAlpha = highLightAlpha + fragColor.a * (1.0 - highLightAlpha);
|
|
1000
|
-
if (blendedAlpha > 0.0) {
|
|
1001
|
-
let highLightRatio = highLightAlpha / blendedAlpha;
|
|
1002
|
-
fragColor = vec4<f32>(
|
|
1003
|
-
mix(fragColor.rgb, picking.highlightColor.rgb, highLightRatio),
|
|
1004
|
-
blendedAlpha
|
|
1005
|
-
);
|
|
1006
|
-
} else {
|
|
1007
|
-
fragColor = vec4<f32>(fragColor.rgb, 0.0);
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
|
|
1012
|
-
// Apply premultiplied alpha as required by transparent canvas
|
|
1013
|
-
fragColor = deckgl_premultiplied_alpha(fragColor);
|
|
1014
|
-
|
|
1015
|
-
return fragColor;
|
|
1016
|
-
}
|
|
1017
|
-
`;var ai=[0,0,0,255],li=[0,0,1],cn={sizeUnits:"pixels",pointSize:{type:"number",min:0,value:10},getPosition:{type:"accessor",value:t=>t.position},getNormal:{type:"accessor",value:li},getColor:{type:"accessor",value:ai},material:true,radiusPixels:{deprecatedFor:"pointSize"}};function fn(t){let{header:i,attributes:e}=t;if(!(!i||!e)&&(t.length=i.vertexCount,e.POSITION&&(e.instancePositions=e.POSITION),e.NORMAL&&(e.instanceNormals=e.NORMAL),e.COLOR_0)){let{size:o,value:n}=e.COLOR_0;e.instanceColors={size:o,type:"unorm8",value:n};}}var un=(()=>{class t extends mc{getShaders(){return super.getShaders({vs:ni,fs:si,source:ri,modules:[Jh,Eh,tn$1,nu,oi]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:true,accessor:"getPosition"},instanceNormals:{size:3,transition:true,accessor:"getNormal",defaultValue:li},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",transition:true,accessor:"getColor",defaultValue:ai}});}updateState(e){let{changeFlags:o,props:n}=e;super.updateState(e),o.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll()),o.dataChanged&&fn(n.data);}draw({uniforms:e}){let{pointSize:o,sizeUnits:n}=this.props,s=this.state.model,r={sizeUnits:yt$1[n],radiusPixels:o};s.shaderInputs.setProps({pointCloud:r}),s.draw(this.context.renderPass);}_getModel(){let e=[];for(let o=0;o<3;o++){let n=o/3*Math.PI*2;e.push(Math.cos(n)*2,Math.sin(n)*2,0);}return new Kt$1(this.context.device,s$1(r$1({},this.getShaders()),{id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Zr({topology:"triangle-list",attributes:{positions:new Float32Array(e)}}),isInstanced:true}))}}return t.layerName="PointCloudLayer",t.defaultProps=cn,t})(),dn=un;var ci=`layout(std140) uniform scatterplotUniforms {
|
|
1018
|
-
float radiusScale;
|
|
1019
|
-
float radiusMinPixels;
|
|
1020
|
-
float radiusMaxPixels;
|
|
1021
|
-
float lineWidthScale;
|
|
1022
|
-
float lineWidthMinPixels;
|
|
1023
|
-
float lineWidthMaxPixels;
|
|
1024
|
-
float stroked;
|
|
1025
|
-
float filled;
|
|
1026
|
-
bool antialiasing;
|
|
1027
|
-
bool billboard;
|
|
1028
|
-
highp int radiusUnits;
|
|
1029
|
-
highp int lineWidthUnits;
|
|
1030
|
-
} scatterplot;
|
|
1031
|
-
`,fi={name:"scatterplot",vs:ci,fs:ci,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 ui=`#version 300 es
|
|
1032
|
-
#define SHADER_NAME scatterplot-layer-vertex-shader
|
|
1033
|
-
in vec3 positions;
|
|
1034
|
-
in vec3 instancePositions;
|
|
1035
|
-
in vec3 instancePositions64Low;
|
|
1036
|
-
in float instanceRadius;
|
|
1037
|
-
in float instanceLineWidths;
|
|
1038
|
-
in vec4 instanceFillColors;
|
|
1039
|
-
in vec4 instanceLineColors;
|
|
1040
|
-
in vec3 instancePickingColors;
|
|
1041
|
-
in vec2 instancePixelOffset;
|
|
1042
|
-
out vec4 vFillColor;
|
|
1043
|
-
out vec4 vLineColor;
|
|
1044
|
-
out vec2 unitPosition;
|
|
1045
|
-
out float innerUnitRadius;
|
|
1046
|
-
out float outerRadiusPixels;
|
|
1047
|
-
void main(void) {
|
|
1048
|
-
geometry.worldPosition = instancePositions;
|
|
1049
|
-
outerRadiusPixels = clamp(
|
|
1050
|
-
project_size_to_pixel(scatterplot.radiusScale * instanceRadius, scatterplot.radiusUnits),
|
|
1051
|
-
scatterplot.radiusMinPixels, scatterplot.radiusMaxPixels
|
|
1052
|
-
);
|
|
1053
|
-
float lineWidthPixels = clamp(
|
|
1054
|
-
project_size_to_pixel(scatterplot.lineWidthScale * instanceLineWidths, scatterplot.lineWidthUnits),
|
|
1055
|
-
scatterplot.lineWidthMinPixels, scatterplot.lineWidthMaxPixels
|
|
1056
|
-
);
|
|
1057
|
-
outerRadiusPixels += scatterplot.stroked * lineWidthPixels / 2.0;
|
|
1058
|
-
float edgePadding = scatterplot.antialiasing ? (outerRadiusPixels + SMOOTH_EDGE_RADIUS) / outerRadiusPixels : 1.0;
|
|
1059
|
-
unitPosition = edgePadding * positions.xy;
|
|
1060
|
-
geometry.uv = unitPosition;
|
|
1061
|
-
geometry.pickingColor = instancePickingColors;
|
|
1062
|
-
innerUnitRadius = 1.0 - scatterplot.stroked * lineWidthPixels / outerRadiusPixels;
|
|
1063
|
-
if (scatterplot.billboard) {
|
|
1064
|
-
gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);
|
|
1065
|
-
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
|
|
1066
|
-
vec3 offset = edgePadding * positions * outerRadiusPixels;
|
|
1067
|
-
offset.xy += instancePixelOffset;
|
|
1068
|
-
DECKGL_FILTER_SIZE(offset, geometry);
|
|
1069
|
-
gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);
|
|
1070
|
-
} else {
|
|
1071
|
-
vec3 offset = edgePadding * positions * project_pixel_size(outerRadiusPixels);
|
|
1072
|
-
offset.xy += project_pixel_size(instancePixelOffset);
|
|
1073
|
-
DECKGL_FILTER_SIZE(offset, geometry);
|
|
1074
|
-
gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset, geometry.position);
|
|
1075
|
-
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
|
|
1076
|
-
}
|
|
1077
|
-
vFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * layer.opacity);
|
|
1078
|
-
DECKGL_FILTER_COLOR(vFillColor, geometry);
|
|
1079
|
-
vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * layer.opacity);
|
|
1080
|
-
DECKGL_FILTER_COLOR(vLineColor, geometry);
|
|
1081
|
-
}
|
|
1082
|
-
`;var di=`#version 300 es
|
|
1083
|
-
#define SHADER_NAME scatterplot-layer-fragment-shader
|
|
1084
|
-
precision highp float;
|
|
1085
|
-
in vec4 vFillColor;
|
|
1086
|
-
in vec4 vLineColor;
|
|
1087
|
-
in vec2 unitPosition;
|
|
1088
|
-
in float innerUnitRadius;
|
|
1089
|
-
in float outerRadiusPixels;
|
|
1090
|
-
out vec4 fragColor;
|
|
1091
|
-
void main(void) {
|
|
1092
|
-
geometry.uv = unitPosition;
|
|
1093
|
-
float distToCenter = length(unitPosition) * outerRadiusPixels;
|
|
1094
|
-
float inCircle = scatterplot.antialiasing ?
|
|
1095
|
-
smoothedge(distToCenter, outerRadiusPixels) :
|
|
1096
|
-
step(distToCenter, outerRadiusPixels);
|
|
1097
|
-
if (inCircle == 0.0) {
|
|
1098
|
-
discard;
|
|
1099
|
-
}
|
|
1100
|
-
if (scatterplot.stroked > 0.5) {
|
|
1101
|
-
float isLine = scatterplot.antialiasing ?
|
|
1102
|
-
smoothedge(innerUnitRadius * outerRadiusPixels, distToCenter) :
|
|
1103
|
-
step(innerUnitRadius * outerRadiusPixels, distToCenter);
|
|
1104
|
-
if (scatterplot.filled > 0.5) {
|
|
1105
|
-
fragColor = mix(vFillColor, vLineColor, isLine);
|
|
1106
|
-
} else {
|
|
1107
|
-
if (isLine == 0.0) {
|
|
1108
|
-
discard;
|
|
1109
|
-
}
|
|
1110
|
-
fragColor = vec4(vLineColor.rgb, vLineColor.a * isLine);
|
|
1111
|
-
}
|
|
1112
|
-
} else if (scatterplot.filled < 0.5) {
|
|
1113
|
-
discard;
|
|
1114
|
-
} else {
|
|
1115
|
-
fragColor = vFillColor;
|
|
1116
|
-
}
|
|
1117
|
-
fragColor.a *= inCircle;
|
|
1118
|
-
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
1119
|
-
}
|
|
1120
|
-
`;var pi=`// Main shaders
|
|
1121
|
-
|
|
1122
|
-
struct ScatterplotUniforms {
|
|
1123
|
-
radiusScale: f32,
|
|
1124
|
-
radiusMinPixels: f32,
|
|
1125
|
-
radiusMaxPixels: f32,
|
|
1126
|
-
lineWidthScale: f32,
|
|
1127
|
-
lineWidthMinPixels: f32,
|
|
1128
|
-
lineWidthMaxPixels: f32,
|
|
1129
|
-
stroked: f32,
|
|
1130
|
-
filled: i32,
|
|
1131
|
-
antialiasing: i32,
|
|
1132
|
-
billboard: i32,
|
|
1133
|
-
radiusUnits: i32,
|
|
1134
|
-
lineWidthUnits: i32,
|
|
1135
|
-
};
|
|
1136
|
-
|
|
1137
|
-
struct ConstantAttributeUniforms {
|
|
1138
|
-
instancePositions: vec3<f32>,
|
|
1139
|
-
instancePositions64Low: vec3<f32>,
|
|
1140
|
-
instanceRadius: f32,
|
|
1141
|
-
instanceLineWidths: f32,
|
|
1142
|
-
instanceFillColors: vec4<f32>,
|
|
1143
|
-
instanceLineColors: vec4<f32>,
|
|
1144
|
-
instancePickingColors: vec3<f32>,
|
|
1145
|
-
instancePixelOffset: vec2<f32>,
|
|
1146
|
-
|
|
1147
|
-
instancePositionsConstant: i32,
|
|
1148
|
-
instancePositions64LowConstant: i32,
|
|
1149
|
-
instanceRadiusConstant: i32,
|
|
1150
|
-
instanceLineWidthsConstant: i32,
|
|
1151
|
-
instanceFillColorsConstant: i32,
|
|
1152
|
-
instanceLineColorsConstant: i32,
|
|
1153
|
-
instancePickingColorsConstant: i32,
|
|
1154
|
-
instancePixelOffsetConstant: i32
|
|
1155
|
-
};
|
|
1156
|
-
|
|
1157
|
-
@group(0) @binding(0) var<uniform> scatterplot: ScatterplotUniforms;
|
|
1158
|
-
|
|
1159
|
-
struct ConstantAttributes {
|
|
1160
|
-
instancePositions: vec3<f32>,
|
|
1161
|
-
instancePositions64Low: vec3<f32>,
|
|
1162
|
-
instanceRadius: f32,
|
|
1163
|
-
instanceLineWidths: f32,
|
|
1164
|
-
instanceFillColors: vec4<f32>,
|
|
1165
|
-
instanceLineColors: vec4<f32>,
|
|
1166
|
-
instancePickingColors: vec3<f32>,
|
|
1167
|
-
instancePixelOffset: vec2<f32>
|
|
1168
|
-
};
|
|
1169
|
-
|
|
1170
|
-
const constants = ConstantAttributes(
|
|
1171
|
-
vec3<f32>(0.0),
|
|
1172
|
-
vec3<f32>(0.0),
|
|
1173
|
-
0.0,
|
|
1174
|
-
0.0,
|
|
1175
|
-
vec4<f32>(0.0, 0.0, 0.0, 1.0),
|
|
1176
|
-
vec4<f32>(0.0, 0.0, 0.0, 1.0),
|
|
1177
|
-
vec3<f32>(0.0),
|
|
1178
|
-
vec2<f32>(0.0)
|
|
1179
|
-
);
|
|
1180
|
-
|
|
1181
|
-
struct Attributes {
|
|
1182
|
-
@builtin(instance_index) instanceIndex : u32,
|
|
1183
|
-
@builtin(vertex_index) vertexIndex : u32,
|
|
1184
|
-
@location(0) positions: vec3<f32>,
|
|
1185
|
-
@location(1) instancePositions: vec3<f32>,
|
|
1186
|
-
@location(2) instancePositions64Low: vec3<f32>,
|
|
1187
|
-
@location(3) instanceRadius: f32,
|
|
1188
|
-
@location(4) instanceLineWidths: f32,
|
|
1189
|
-
@location(5) instanceFillColors: vec4<f32>,
|
|
1190
|
-
@location(6) instanceLineColors: vec4<f32>,
|
|
1191
|
-
@location(7) instancePickingColors: vec3<f32>,
|
|
1192
|
-
@location(8) instancePixelOffset: vec2<f32>
|
|
1193
|
-
};
|
|
1194
|
-
|
|
1195
|
-
struct Varyings {
|
|
1196
|
-
@builtin(position) position: vec4<f32>,
|
|
1197
|
-
@location(0) vFillColor: vec4<f32>,
|
|
1198
|
-
@location(1) vLineColor: vec4<f32>,
|
|
1199
|
-
@location(2) unitPosition: vec2<f32>,
|
|
1200
|
-
@location(3) innerUnitRadius: f32,
|
|
1201
|
-
@location(4) outerRadiusPixels: f32,
|
|
1202
|
-
@location(5) pickingColor: vec3<f32>,
|
|
1203
|
-
};
|
|
1204
|
-
|
|
1205
|
-
@vertex
|
|
1206
|
-
fn vertexMain(attributes: Attributes) -> Varyings {
|
|
1207
|
-
var varyings: Varyings;
|
|
1208
|
-
|
|
1209
|
-
// Draw an inline geometry constant array clip space triangle to verify that rendering works.
|
|
1210
|
-
// var positions = array<vec2<f32>, 3>(vec2(0.0, 0.5), vec2(-0.5, -0.5), vec2(0.5, -0.5));
|
|
1211
|
-
// if (attributes.instanceIndex == 0) {
|
|
1212
|
-
// varyings.position = vec4<f32>(positions[attributes.vertexIndex], 0.0, 1.0);
|
|
1213
|
-
// return varyings;
|
|
1214
|
-
// }
|
|
1215
|
-
|
|
1216
|
-
geometry.worldPosition = attributes.instancePositions;
|
|
1217
|
-
|
|
1218
|
-
// Multiply out radius and clamp to limits
|
|
1219
|
-
varyings.outerRadiusPixels = clamp(
|
|
1220
|
-
project_unit_size_to_pixel(scatterplot.radiusScale * attributes.instanceRadius, scatterplot.radiusUnits),
|
|
1221
|
-
scatterplot.radiusMinPixels, scatterplot.radiusMaxPixels
|
|
1222
|
-
);
|
|
1223
|
-
|
|
1224
|
-
// Multiply out line width and clamp to limits
|
|
1225
|
-
let lineWidthPixels = clamp(
|
|
1226
|
-
project_unit_size_to_pixel(scatterplot.lineWidthScale * attributes.instanceLineWidths, scatterplot.lineWidthUnits),
|
|
1227
|
-
scatterplot.lineWidthMinPixels, scatterplot.lineWidthMaxPixels
|
|
1228
|
-
);
|
|
1229
|
-
|
|
1230
|
-
// outer radius needs to offset by half stroke width
|
|
1231
|
-
varyings.outerRadiusPixels += scatterplot.stroked * lineWidthPixels / 2.0;
|
|
1232
|
-
// Expand geometry to accommodate edge smoothing
|
|
1233
|
-
let edgePadding = select(
|
|
1234
|
-
(varyings.outerRadiusPixels + SMOOTH_EDGE_RADIUS) / varyings.outerRadiusPixels,
|
|
1235
|
-
1.0,
|
|
1236
|
-
scatterplot.antialiasing != 0
|
|
1237
|
-
);
|
|
1238
|
-
|
|
1239
|
-
// position on the containing square in [-1, 1] space
|
|
1240
|
-
varyings.unitPosition = edgePadding * attributes.positions.xy;
|
|
1241
|
-
geometry.uv = varyings.unitPosition;
|
|
1242
|
-
geometry.pickingColor = attributes.instancePickingColors;
|
|
1243
|
-
|
|
1244
|
-
varyings.innerUnitRadius = 1.0 - scatterplot.stroked * lineWidthPixels / varyings.outerRadiusPixels;
|
|
1245
|
-
|
|
1246
|
-
if (scatterplot.billboard != 0) {
|
|
1247
|
-
varyings.position = project_position_to_clipspace(attributes.instancePositions, attributes.instancePositions64Low, vec3<f32>(0.0)); // TODO , geometry.position);
|
|
1248
|
-
// DECKGL_FILTER_GL_POSITION(varyings.position, geometry);
|
|
1249
|
-
var offset = edgePadding * attributes.positions * varyings.outerRadiusPixels;
|
|
1250
|
-
offset = vec3<f32>(offset.xy + attributes.instancePixelOffset, offset.z);
|
|
1251
|
-
// DECKGL_FILTER_SIZE(offset, geometry);
|
|
1252
|
-
let clipPixels = project_pixel_size_to_clipspace(offset.xy);
|
|
1253
|
-
varyings.position = vec4<f32>(varyings.position.x + clipPixels.x, varyings.position.y + clipPixels.y, varyings.position.z, varyings.position.w);
|
|
1254
|
-
} else {
|
|
1255
|
-
var offset = edgePadding * attributes.positions * project_pixel_size_float(varyings.outerRadiusPixels);
|
|
1256
|
-
offset = vec3<f32>(offset.xy + project_pixel_size_vec2(attributes.instancePixelOffset), offset.z);
|
|
1257
|
-
// DECKGL_FILTER_SIZE(offset, geometry);
|
|
1258
|
-
varyings.position = project_position_to_clipspace(attributes.instancePositions, attributes.instancePositions64Low, offset); // TODO , geometry.position);
|
|
1259
|
-
// DECKGL_FILTER_GL_POSITION(varyings.position, geometry);
|
|
1260
|
-
}
|
|
1261
|
-
|
|
1262
|
-
// Apply opacity to instance color, or return instance picking color
|
|
1263
|
-
varyings.vFillColor = vec4<f32>(attributes.instanceFillColors.rgb, attributes.instanceFillColors.a * layer.opacity);
|
|
1264
|
-
// DECKGL_FILTER_COLOR(varyings.vFillColor, geometry);
|
|
1265
|
-
varyings.vLineColor = vec4<f32>(attributes.instanceLineColors.rgb, attributes.instanceLineColors.a * layer.opacity);
|
|
1266
|
-
// DECKGL_FILTER_COLOR(varyings.vLineColor, geometry);
|
|
1267
|
-
varyings.pickingColor = attributes.instancePickingColors;
|
|
1268
|
-
|
|
1269
|
-
return varyings;
|
|
1270
|
-
}
|
|
1271
|
-
|
|
1272
|
-
@fragment
|
|
1273
|
-
fn fragmentMain(varyings: Varyings) -> @location(0) vec4<f32> {
|
|
1274
|
-
// var geometry: Geometry;
|
|
1275
|
-
// geometry.uv = unitPosition;
|
|
1276
|
-
|
|
1277
|
-
let distToCenter = length(varyings.unitPosition) * varyings.outerRadiusPixels;
|
|
1278
|
-
let inCircle = select(
|
|
1279
|
-
smoothedge(distToCenter, varyings.outerRadiusPixels),
|
|
1280
|
-
step(distToCenter, varyings.outerRadiusPixels),
|
|
1281
|
-
scatterplot.antialiasing != 0
|
|
1282
|
-
);
|
|
1283
|
-
|
|
1284
|
-
if (inCircle == 0.0) {
|
|
1285
|
-
discard;
|
|
1286
|
-
}
|
|
1287
|
-
|
|
1288
|
-
var fragColor: vec4<f32>;
|
|
1289
|
-
|
|
1290
|
-
if (scatterplot.stroked != 0) {
|
|
1291
|
-
let isLine = select(
|
|
1292
|
-
smoothedge(varyings.innerUnitRadius * varyings.outerRadiusPixels, distToCenter),
|
|
1293
|
-
step(varyings.innerUnitRadius * varyings.outerRadiusPixels, distToCenter),
|
|
1294
|
-
scatterplot.antialiasing != 0
|
|
1295
|
-
);
|
|
1296
|
-
|
|
1297
|
-
if (scatterplot.filled != 0) {
|
|
1298
|
-
fragColor = mix(varyings.vFillColor, varyings.vLineColor, isLine);
|
|
1299
|
-
} else {
|
|
1300
|
-
if (isLine == 0.0) {
|
|
1301
|
-
discard;
|
|
1302
|
-
}
|
|
1303
|
-
fragColor = vec4<f32>(varyings.vLineColor.rgb, varyings.vLineColor.a * isLine);
|
|
1304
|
-
}
|
|
1305
|
-
} else if (scatterplot.filled == 0) {
|
|
1306
|
-
discard;
|
|
1307
|
-
} else {
|
|
1308
|
-
fragColor = varyings.vFillColor;
|
|
1309
|
-
}
|
|
1310
|
-
|
|
1311
|
-
fragColor.a *= inCircle;
|
|
1312
|
-
|
|
1313
|
-
if (picking.isActive > 0.5) {
|
|
1314
|
-
if (!picking_isColorValid(varyings.pickingColor)) {
|
|
1315
|
-
discard;
|
|
1316
|
-
}
|
|
1317
|
-
return vec4<f32>(varyings.pickingColor, 1.0);
|
|
1318
|
-
}
|
|
1319
|
-
|
|
1320
|
-
if (picking.isHighlightActive > 0.5) {
|
|
1321
|
-
let highlightedObjectColor = picking_normalizeColor(picking.highlightedObjectColor);
|
|
1322
|
-
if (picking_isColorZero(abs(varyings.pickingColor - highlightedObjectColor))) {
|
|
1323
|
-
let highLightAlpha = picking.highlightColor.a;
|
|
1324
|
-
let blendedAlpha = highLightAlpha + fragColor.a * (1.0 - highLightAlpha);
|
|
1325
|
-
if (blendedAlpha > 0.0) {
|
|
1326
|
-
let highLightRatio = highLightAlpha / blendedAlpha;
|
|
1327
|
-
fragColor = vec4<f32>(
|
|
1328
|
-
mix(fragColor.rgb, picking.highlightColor.rgb, highLightRatio),
|
|
1329
|
-
blendedAlpha
|
|
1330
|
-
);
|
|
1331
|
-
} else {
|
|
1332
|
-
fragColor = vec4<f32>(fragColor.rgb, 0.0);
|
|
1333
|
-
}
|
|
1334
|
-
}
|
|
1335
|
-
}
|
|
1336
|
-
|
|
1337
|
-
// Apply premultiplied alpha as required by transparent canvas
|
|
1338
|
-
fragColor = deckgl_premultiplied_alpha(fragColor);
|
|
1339
|
-
|
|
1340
|
-
return fragColor;
|
|
1341
|
-
// return vec4<f32>(0, 0, 1, 1);
|
|
1342
|
-
}
|
|
1343
|
-
`;var gi=[0,0,0,255],pn={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:false,filled:true,billboard:false,antialiasing:true,getPosition:{type:"accessor",value:t=>t.position},getRadius:{type:"accessor",value:1},getFillColor:{type:"accessor",value:gi},getLineColor:{type:"accessor",value:gi},getLineWidth:{type:"accessor",value:1},getPixelOffset:{type:"accessor",value:[0,0]},strokeWidth:{deprecatedFor:"getLineWidth"},outline:{deprecatedFor:"stroked"},getColor:{deprecatedFor:["getFillColor","getLineColor"]}},gn=(()=>{class t extends mc{getShaders(){return super.getShaders({vs:ui,fs:di,source:pi,modules:[Jh,Eh,nu,fi]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:true,accessor:"getPosition"},instanceRadius:{size:1,transition:true,accessor:"getRadius",defaultValue:1},instanceFillColors:{size:this.props.colorFormat.length,transition:true,type:"unorm8",accessor:"getFillColor",defaultValue:[0,0,0,255]},instanceLineColors:{size:this.props.colorFormat.length,transition:true,type:"unorm8",accessor:"getLineColor",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:true,accessor:"getLineWidth",defaultValue:1},instancePixelOffset:{size:2,transition:true,accessor:"getPixelOffset"}});}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:o,radiusScale:n,radiusMinPixels:s,radiusMaxPixels:r,stroked:a,filled:l,billboard:c,antialiasing:f,lineWidthUnits:u,lineWidthScale:d,lineWidthMinPixels:p,lineWidthMaxPixels:g}=this.props,h={stroked:a,filled:l,billboard:c,antialiasing:f,radiusUnits:yt$1[o],radiusScale:n,radiusMinPixels:s,radiusMaxPixels:r,lineWidthUnits:yt$1[u],lineWidthScale:d,lineWidthMinPixels:p,lineWidthMaxPixels:g},m=this.state.model;m.shaderInputs.setProps({scatterplot:h}),m.draw(this.context.renderPass);}_getModel(){let e=[-1,-1,0,1,-1,0,-1,1,0,1,1,0];return new Kt$1(this.context.device,s$1(r$1({},this.getShaders()),{id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Zr({topology:"triangle-strip",attributes:{positions:{size:3,value:new Float32Array(e)}}}),isInstanced:true}))}}return t.defaultProps=pn,t.layerName="ScatterplotLayer",t})(),lt=gn;var ie={CLOCKWISE:1,COUNTER_CLOCKWISE:-1};function J(t,i,e={}){return hi(t,e)!==i?(hn(t,e),true):false}function hi(t,i={}){return Math.sign(fe(t,i))}var ce={x:0,y:1,z:2};function fe(t,i={}){let{start:e=0,end:o=t.length,plane:n="xy"}=i,s=i.size||2,r=0,a=ce[n[0]],l=ce[n[1]];for(let c=e,f=o-s;c<o;c+=s)r+=(t[c+a]-t[f+a])*(t[c+l]+t[f+l]),f=c;return r/2}function hn(t,i){let{start:e=0,end:o=t.length,size:n=2}=i,s=(o-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 u=t[l+f];t[l+f]=t[c+f],t[c+f]=u;}}}function mn(t,i,e=2,o,n="xy"){let s=i&&i.length,r=s?i[0]*e:t.length,a=mi(t,0,r,e,true,o&&o[0],n),l=[];if(!a||a.next===a.prev)return l;let c,f,u,d,p,g,h;if(s&&(a=Cn(t,i,a,e,o,n)),t.length>80*e){d=f=t[0],p=u=t[1];for(let m=e;m<r;m+=e)g=t[m],h=t[m+1],g<d&&(d=g),h<p&&(p=h),g>f&&(f=g),h>u&&(u=h);c=Math.max(f-d,u-p),c=c!==0?32767/c:0;}return ue(a,l,e,d,p,c,0),l}function mi(t,i,e,o,n,s,r){let a,l;s===void 0&&(s=fe(t,{start:i,end:e,size:o,plane:r}));let c=ce[r[0]],f=ce[r[1]];if(n===s<0)for(a=i;a<e;a+=o)l=xi(a,t[a+c],t[a+f],l);else for(a=e-o;a>=i;a-=o)l=xi(a,t[a+c],t[a+f],l);return l&&Fe(l,l.next)&&(pe(l),l=l.next),l}function Y(t,i){if(!t)return t;i||(i=t);let e=t,o;do if(o=false,!e.steiner&&(Fe(e,e.next)||w(e.prev,e,e.next)===0)){if(pe(e),e=i=e.prev,e===e.next)break;o=true;}else e=e.next;while(o||e!==i);return i}function ue(t,i,e,o,n,s,r){if(!t)return;!r&&s&&In(t,o,n,s);let a=t,l,c;for(;t.prev!==t.next;){if(l=t.prev,c=t.next,s?yn(t,o,n,s):vn(t)){i.push(l.i/e|0),i.push(t.i/e|0),i.push(c.i/e|0),pe(t),t=c.next,a=c.next;continue}if(t=c,t===a){r?r===1?(t=Pn(Y(t),i,e),ue(t,i,e,o,n,s,2)):r===2&&_n(t,i,e,o,n,s):ue(Y(t),i,e,o,n,s,1);break}}}function vn(t){let i=t.prev,e=t,o=t.next;if(w(i,e,o)>=0)return false;let n=i.x,s=e.x,r=o.x,a=i.y,l=e.y,c=o.y,f=n<s?n<r?n:r:s<r?s:r,u=a<l?a<c?a:c:l<c?l:c,d=n>s?n>r?n:r:s>r?s:r,p=a>l?a>c?a:c:l>c?l:c,g=o.next;for(;g!==i;){if(g.x>=f&&g.x<=d&&g.y>=u&&g.y<=p&&oe(n,a,s,l,r,c,g.x,g.y)&&w(g.prev,g,g.next)>=0)return false;g=g.next;}return true}function yn(t,i,e,o){let n=t.prev,s=t,r=t.next;if(w(n,s,r)>=0)return false;let a=n.x,l=s.x,c=r.x,f=n.y,u=s.y,d=r.y,p=a<l?a<c?a:c:l<c?l:c,g=f<u?f<d?f:d:u<d?u:d,h=a>l?a>c?a:c:l>c?l:c,m=f>u?f>d?f:d:u>d?u:d,y=ct(p,g,i,e,o),C=ct(h,m,i,e,o),v=t.prevZ,x=t.nextZ;for(;v&&v.z>=y&&x&&x.z<=C;){if(v.x>=p&&v.x<=h&&v.y>=g&&v.y<=m&&v!==n&&v!==r&&oe(a,f,l,u,c,d,v.x,v.y)&&w(v.prev,v,v.next)>=0||(v=v.prevZ,x.x>=p&&x.x<=h&&x.y>=g&&x.y<=m&&x!==n&&x!==r&&oe(a,f,l,u,c,d,x.x,x.y)&&w(x.prev,x,x.next)>=0))return false;x=x.nextZ;}for(;v&&v.z>=y;){if(v.x>=p&&v.x<=h&&v.y>=g&&v.y<=m&&v!==n&&v!==r&&oe(a,f,l,u,c,d,v.x,v.y)&&w(v.prev,v,v.next)>=0)return false;v=v.prevZ;}for(;x&&x.z<=C;){if(x.x>=p&&x.x<=h&&x.y>=g&&x.y<=m&&x!==n&&x!==r&&oe(a,f,l,u,c,d,x.x,x.y)&&w(x.prev,x,x.next)>=0)return false;x=x.nextZ;}return true}function Pn(t,i,e){let o=t;do{let n=o.prev,s=o.next.next;!Fe(n,s)&&vi(n,o,o.next,s)&&de(n,s)&&de(s,n)&&(i.push(n.i/e|0),i.push(o.i/e|0),i.push(s.i/e|0),pe(o),pe(o.next),o=t=s),o=o.next;}while(o!==t);return Y(o)}function _n(t,i,e,o,n,s){let r=t;do{let a=r.next.next;for(;a!==r.prev;){if(r.i!==a.i&&Tn(r,a)){let l=yi(r,a);r=Y(r,r.next),l=Y(l,l.next),ue(r,i,e,o,n,s,0),ue(l,i,e,o,n,s,0);return}a=a.next;}r=r.next;}while(r!==t)}function Cn(t,i,e,o,n,s){let r=[],a,l,c,f,u;for(a=0,l=i.length;a<l;a++)c=i[a]*o,f=a<l-1?i[a+1]*o:t.length,u=mi(t,c,f,o,false,n&&n[a+1],s),u===u.next&&(u.steiner=true),r.push(An(u));for(r.sort(Ln),a=0;a<r.length;a++)e=Sn(r[a],e);return e}function Ln(t,i){return t.x-i.x}function Sn(t,i){let e=wn(t,i);if(!e)return i;let o=yi(e,t);return Y(o,o.next),Y(e,e.next)}function wn(t,i){let e=i,o=t.x,n=t.y,s=-1/0,r;do{if(n<=e.y&&n>=e.next.y&&e.next.y!==e.y){let d=e.x+(n-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(d<=o&&d>s&&(s=d,r=e.x<e.next.x?e:e.next,d===o))return r}e=e.next;}while(e!==i);if(!r)return null;let a=r,l=r.x,c=r.y,f=1/0,u;e=r;do o>=e.x&&e.x>=l&&o!==e.x&&oe(n<c?o:s,n,l,c,n<c?s:o,n,e.x,e.y)&&(u=Math.abs(n-e.y)/(o-e.x),de(e,t)&&(u<f||u===f&&(e.x>r.x||e.x===r.x&&bn(r,e)))&&(r=e,f=u)),e=e.next;while(e!==a);return r}function bn(t,i){return w(t.prev,t,i.prev)<0&&w(i.next,t,t.next)<0}function In(t,i,e,o){let n=t;do n.z===0&&(n.z=ct(n.x,n.y,i,e,o)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,Mn(n);}function Mn(t){let i,e,o=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<o&&(r++,a=a.nextZ,!!a);e++);for(l=o;r>0||l>0&&a;)r!==0&&(l===0||!a||s.z<=a.z)?(i=s,s=s.nextZ,r--):(i=a,a=a.nextZ,l--),c?c.nextZ=i:t=i,i.prevZ=c,c=i;s=a;}c.nextZ=null,o*=2;}while(n>1);return t}function ct(t,i,e,o,n){return t=(t-e)*n|0,i=(i-o)*n|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,t|i<<1}function An(t){let i=t,e=t;do(i.x<e.x||i.x===e.x&&i.y<e.y)&&(e=i),i=i.next;while(i!==t);return e}function oe(t,i,e,o,n,s,r,a){return (n-r)*(i-a)>=(t-r)*(s-a)&&(t-r)*(o-a)>=(e-r)*(i-a)&&(e-r)*(s-a)>=(n-r)*(o-a)}function Tn(t,i){return t.next.i!==i.i&&t.prev.i!==i.i&&!En(t,i)&&(de(t,i)&&de(i,t)&&zn(t,i)&&(w(t.prev,t,i.prev)||w(t,i.prev,i))||Fe(t,i)&&w(t.prev,t,t.next)>0&&w(i.prev,i,i.next)>0)}function w(t,i,e){return (i.y-t.y)*(e.x-i.x)-(i.x-t.x)*(e.y-i.y)}function Fe(t,i){return t.x===i.x&&t.y===i.y}function vi(t,i,e,o){let n=ke(w(t,i,e)),s=ke(w(t,i,o)),r=ke(w(e,o,t)),a=ke(w(e,o,i));return !!(n!==s&&r!==a||n===0&&Re(t,e,i)||s===0&&Re(t,o,i)||r===0&&Re(e,t,o)||a===0&&Re(e,i,o))}function Re(t,i,e){return i.x<=Math.max(t.x,e.x)&&i.x>=Math.min(t.x,e.x)&&i.y<=Math.max(t.y,e.y)&&i.y>=Math.min(t.y,e.y)}function ke(t){return t>0?1:t<0?-1:0}function En(t,i){let e=t;do{if(e.i!==t.i&&e.next.i!==t.i&&e.i!==i.i&&e.next.i!==i.i&&vi(e,e.next,t,i))return true;e=e.next;}while(e!==t);return false}function de(t,i){return w(t.prev,t,t.next)<0?w(t,i,t.next)>=0&&w(t,t.prev,i)>=0:w(t,i,t.prev)<0||w(t,t.next,i)<0}function zn(t,i){let e=t,o=false,n=(t.x+i.x)/2,s=(t.y+i.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&&(o=!o),e=e.next;while(e!==t);return o}function yi(t,i){let e=new ge(t.i,t.x,t.y),o=new ge(i.i,i.x,i.y),n=t.next,s=i.prev;return t.next=i,i.prev=t,e.next=n,n.prev=e,o.next=e,e.prev=o,s.next=o,o.prev=s,o}function xi(t,i,e,o){let n=new ge(t,i,e);return o?(n.next=o.next,n.prev=o,o.next.prev=n,o.next=n):(n.prev=n,n.next=n),n}function pe(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 ge=class{constructor(i,e,o){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=false,this.i=i,this.x=e,this.y=o;}};function G(t,i){let e=i.length,o=t.length;if(o>0){let n=true;for(let s=0;s<e;s++)if(t[o-e+s]!==i[s]){n=false;break}if(n)return false}for(let n=0;n<e;n++)t[o+n]=i[n];return true}function he(t,i){let e=i.length;for(let o=0;o<e;o++)t[o]=i[o];}function H(t,i,e,o,n=[]){let s=o+i*e;for(let r=0;r<e;r++)n[r]=t[s+r];return n}function De(t,i,e,o,n=[]){let s,r;if(e&8)s=(o[3]-t[1])/(i[1]-t[1]),r=3;else if(e&4)s=(o[1]-t[1])/(i[1]-t[1]),r=1;else if(e&2)s=(o[2]-t[0])/(i[0]-t[0]),r=2;else if(e&1)s=(o[0]-t[0])/(i[0]-t[0]),r=0;else return null;for(let a=0;a<t.length;a++)n[a]=(r&1)===a?o[r]:s*(i[a]-t[a])+t[a];return n}function xe(t,i){let e=0;return t[0]<i[0]?e|=1:t[0]>i[2]&&(e|=2),t[1]<i[1]?e|=4:t[1]>i[3]&&(e|=8),e}function me(t,i){let{size:e=2,broken:o=false,gridResolution:n=10,gridOffset:s=[0,0],startIndex:r=0,endIndex:a=t.length}=i||{},l=(a-r)/e,c=[],f=[c],u=H(t,0,e,r),d,p,g=Ci(u,n,s,[]),h=[];G(c,u);for(let m=1;m<l;m++){for(d=H(t,m,e,r,d),p=xe(d,g);p;){De(u,d,p,g,h);let y=xe(h,g);y&&(De(u,h,y,g,h),p=y),G(c,h),he(u,h),Rn(g,n,p),o&&c.length>e&&(c=[],f.push(c),G(c,u)),p=xe(d,g);}G(c,d),he(u,d);}return o?f:f[0]}var Pi=0,On=1;function ve(t,i=null,e){if(!t.length)return [];let{size:o=2,gridResolution:n=10,gridOffset:s=[0,0],edgeTypes:r=false}=e||{},a=[],l=[{pos:t,types:r?new Array(t.length/o).fill(On):null,holes:i||[]}],c=[[],[]],f=[];for(;l.length;){let{pos:u,types:d,holes:p}=l.shift();kn(u,o,p[0]||u.length,c),f=Ci(c[0],n,s,f);let g=xe(c[1],f);if(g){let h=_i(u,d,o,0,p[0]||u.length,f,g),m={pos:h[0].pos,types:h[0].types,holes:[]},y={pos:h[1].pos,types:h[1].types,holes:[]};l.push(m,y);for(let C=0;C<p.length;C++)h=_i(u,d,o,p[C],p[C+1]||u.length,f,g),h[0]&&(m.holes.push(m.pos.length),m.pos=Be(m.pos,h[0].pos),r&&(m.types=Be(m.types,h[0].types))),h[1]&&(y.holes.push(y.pos.length),y.pos=Be(y.pos,h[1].pos),r&&(y.types=Be(y.types,h[1].types)));}else {let h={positions:u};r&&(h.edgeTypes=d),p.length&&(h.holeIndices=p),a.push(h);}}return a}function _i(t,i,e,o,n,s,r){let a=(n-o)/e,l=[],c=[],f=[],u=[],d=[],p,g,h,m=H(t,a-1,e,o),y=Math.sign(r&8?m[1]-s[3]:m[0]-s[2]),C=i&&i[a-1],v=0,x=0;for(let L=0;L<a;L++)p=H(t,L,e,o,p),g=Math.sign(r&8?p[1]-s[3]:p[0]-s[2]),h=i&&i[o/e+L],g&&y&&y!==g&&(De(m,p,r,s,d),G(l,d)&&f.push(C),G(c,d)&&u.push(C)),g<=0?(G(l,p)&&f.push(h),v-=g):f.length&&(f[f.length-1]=Pi),g>=0?(G(c,p)&&u.push(h),x+=g):u.length&&(u[u.length-1]=Pi),he(m,p),y=g,C=h;return [v?{pos:l,types:i&&f}:null,x?{pos:c,types:i&&u}:null]}function Ci(t,i,e,o){let n=Math.floor((t[0]-e[0])/i)*i+e[0],s=Math.floor((t[1]-e[1])/i)*i+e[1];return o[0]=n,o[1]=s,o[2]=n+i,o[3]=s+i,o}function Rn(t,i,e){e&8?(t[1]+=i,t[3]+=i):e&4?(t[1]-=i,t[3]-=i):e&2?(t[0]+=i,t[2]+=i):e&1&&(t[0]-=i,t[2]-=i);}function kn(t,i,e,o){let n=1/0,s=-1/0,r=1/0,a=-1/0;for(let l=0;l<e;l+=i){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 o[0][0]=n,o[0][1]=r,o[1][0]=s,o[1][1]=a,o}function Be(t,i){for(let e=0;e<i.length;e++)t.push(i[e]);return t}var Fn=85.051129;function ft(t,i){let{size:e=2,startIndex:o=0,endIndex:n=t.length,normalize:s=true}=i||{},r=t.slice(o,n);Li(r,e,0,n-o);let a=me(r,{size:e,broken:true,gridResolution:360,gridOffset:[-180,-180]});if(s)for(let l of a)Si(l,e);return a}function ut(t,i=null,e){let{size:o=2,normalize:n=true,edgeTypes:s=false}=e||{};i=i||[];let r=[],a=[],l=0,c=0;for(let u=0;u<=i.length;u++){let d=i[u]||t.length,p=c,g=Dn(t,o,l,d);for(let h=g;h<d;h++)r[c++]=t[h];for(let h=l;h<g;h++)r[c++]=t[h];Li(r,o,p,c),Bn(r,o,p,c,e?.maxLatitude),l=d,a[u]=c;}a.pop();let f=ve(r,a,{size:o,gridResolution:360,gridOffset:[-180,-180],edgeTypes:s});if(n)for(let u of f)Si(u.positions,o);return f}function Dn(t,i,e,o){let n=-1,s=-1;for(let r=e+1;r<o;r+=i){let a=Math.abs(t[r]);a>n&&(n=a,s=r-1);}return s}function Bn(t,i,e,o,n=Fn){let s=t[e],r=t[o-i];if(Math.abs(s-r)>180){let a=H(t,0,i,e);a[0]+=Math.round((r-s)/360)*360,G(t,a),a[1]=Math.sign(a[1])*n,G(t,a),a[0]=s,G(t,a);}}function Li(t,i,e,o){let n=t[0],s;for(let r=e;r<o;r+=i){s=t[r];let a=s-n;(a>180||a<-180)&&(s-=Math.round(a/360)*360),t[r]=n=s;}}function Si(t,i){let e,o=t.length/i;for(let s=0;s<o&&(e=t[s*i],(e+180)%360===0);s++);let n=-Math.round(e/360)*360;if(n!==0)for(let s=0;s<o;s++)t[s*i]+=n;}var Ge=class extends Zr{constructor(i){let{indices:e,attributes:o}=Un(i);super(s$1(r$1({},i),{indices:e,attributes:o}));}};function Un(t){let{radius:i,height:e=1,nradial:o=10}=t,{vertices:n}=t;n&&(C.assert(n.length>=o),n=n.flatMap(p=>[p[0],p[1]]),J(n,ie.COUNTER_CLOCKWISE));let s=e>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),u=new Float32Array(a*3),d=0;if(s){for(let p=0;p<r;p++){let g=p*l,h=p%o,m=Math.sin(g),y=Math.cos(g);for(let C=0;C<2;C++)f[d+0]=n?n[h*2]:y*i,f[d+1]=n?n[h*2+1]:m*i,f[d+2]=(1/2-C)*e,u[d+0]=n?n[h*2]:y,u[d+1]=n?n[h*2+1]:m,d+=3;}f[d+0]=f[d-3],f[d+1]=f[d-2],f[d+2]=f[d-1],d+=3;}for(let p=s?0:1;p<r;p++){let g=Math.floor(p/2)*Math.sign(.5-p%2),h=g*l,m=(g+o)%o,y=Math.sin(h),C=Math.cos(h);f[d+0]=n?n[m*2]:C*i,f[d+1]=n?n[m*2+1]:y*i,f[d+2]=e/2,u[d+2]=1,d+=3;}if(s){let p=0;for(let g=0;g<o;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:u}}}}var wi=`layout(std140) uniform columnUniforms {
|
|
1344
|
-
float radius;
|
|
1345
|
-
float angle;
|
|
1346
|
-
vec2 offset;
|
|
1347
|
-
bool extruded;
|
|
1348
|
-
bool stroked;
|
|
1349
|
-
bool isStroke;
|
|
1350
|
-
float coverage;
|
|
1351
|
-
float elevationScale;
|
|
1352
|
-
float edgeDistance;
|
|
1353
|
-
float widthScale;
|
|
1354
|
-
float widthMinPixels;
|
|
1355
|
-
float widthMaxPixels;
|
|
1356
|
-
highp int radiusUnits;
|
|
1357
|
-
highp int widthUnits;
|
|
1358
|
-
} column;
|
|
1359
|
-
`,bi={name:"column",vs:wi,fs:wi,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 Ii=`#version 300 es
|
|
1360
|
-
#define SHADER_NAME column-layer-vertex-shader
|
|
1361
|
-
in vec3 positions;
|
|
1362
|
-
in vec3 normals;
|
|
1363
|
-
in vec3 instancePositions;
|
|
1364
|
-
in float instanceElevations;
|
|
1365
|
-
in vec3 instancePositions64Low;
|
|
1366
|
-
in vec4 instanceFillColors;
|
|
1367
|
-
in vec4 instanceLineColors;
|
|
1368
|
-
in float instanceStrokeWidths;
|
|
1369
|
-
in vec3 instancePickingColors;
|
|
1370
|
-
out vec4 vColor;
|
|
1371
|
-
#ifdef FLAT_SHADING
|
|
1372
|
-
out vec3 cameraPosition;
|
|
1373
|
-
out vec4 position_commonspace;
|
|
1374
|
-
#endif
|
|
1375
|
-
void main(void) {
|
|
1376
|
-
geometry.worldPosition = instancePositions;
|
|
1377
|
-
vec4 color = column.isStroke ? instanceLineColors : instanceFillColors;
|
|
1378
|
-
mat2 rotationMatrix = mat2(cos(column.angle), sin(column.angle), -sin(column.angle), cos(column.angle));
|
|
1379
|
-
float elevation = 0.0;
|
|
1380
|
-
float strokeOffsetRatio = 1.0;
|
|
1381
|
-
if (column.extruded) {
|
|
1382
|
-
elevation = instanceElevations * (positions.z + 1.0) / 2.0 * column.elevationScale;
|
|
1383
|
-
} else if (column.stroked) {
|
|
1384
|
-
float widthPixels = clamp(
|
|
1385
|
-
project_size_to_pixel(instanceStrokeWidths * column.widthScale, column.widthUnits),
|
|
1386
|
-
column.widthMinPixels, column.widthMaxPixels) / 2.0;
|
|
1387
|
-
float halfOffset = project_pixel_size(widthPixels) / project_size(column.edgeDistance * column.coverage * column.radius);
|
|
1388
|
-
if (column.isStroke) {
|
|
1389
|
-
strokeOffsetRatio -= sign(positions.z) * halfOffset;
|
|
1390
|
-
} else {
|
|
1391
|
-
strokeOffsetRatio -= halfOffset;
|
|
1392
|
-
}
|
|
1393
|
-
}
|
|
1394
|
-
float shouldRender = float(color.a > 0.0 && instanceElevations >= 0.0);
|
|
1395
|
-
float dotRadius = column.radius * column.coverage * shouldRender;
|
|
1396
|
-
geometry.pickingColor = instancePickingColors;
|
|
1397
|
-
vec3 centroidPosition = vec3(instancePositions.xy, instancePositions.z + elevation);
|
|
1398
|
-
vec3 centroidPosition64Low = instancePositions64Low;
|
|
1399
|
-
vec2 offset = (rotationMatrix * positions.xy * strokeOffsetRatio + column.offset) * dotRadius;
|
|
1400
|
-
if (column.radiusUnits == UNIT_METERS) {
|
|
1401
|
-
offset = project_size(offset);
|
|
1402
|
-
} else if (column.radiusUnits == UNIT_PIXELS) {
|
|
1403
|
-
offset = project_pixel_size(offset);
|
|
1404
|
-
}
|
|
1405
|
-
vec3 pos = vec3(offset, 0.);
|
|
1406
|
-
DECKGL_FILTER_SIZE(pos, geometry);
|
|
1407
|
-
gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position);
|
|
1408
|
-
geometry.normal = project_normal(vec3(rotationMatrix * normals.xy, normals.z));
|
|
1409
|
-
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
|
|
1410
|
-
if (column.extruded && !column.isStroke) {
|
|
1411
|
-
#ifdef FLAT_SHADING
|
|
1412
|
-
cameraPosition = project.cameraPosition;
|
|
1413
|
-
position_commonspace = geometry.position;
|
|
1414
|
-
vColor = vec4(color.rgb, color.a * layer.opacity);
|
|
1415
|
-
#else
|
|
1416
|
-
vec3 lightColor = lighting_getLightColor(color.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal);
|
|
1417
|
-
vColor = vec4(lightColor, color.a * layer.opacity);
|
|
1418
|
-
#endif
|
|
1419
|
-
} else {
|
|
1420
|
-
vColor = vec4(color.rgb, color.a * layer.opacity);
|
|
1421
|
-
}
|
|
1422
|
-
DECKGL_FILTER_COLOR(vColor, geometry);
|
|
1423
|
-
}
|
|
1424
|
-
`;var Mi=`#version 300 es
|
|
1425
|
-
#define SHADER_NAME column-layer-fragment-shader
|
|
1426
|
-
precision highp float;
|
|
1427
|
-
out vec4 fragColor;
|
|
1428
|
-
in vec4 vColor;
|
|
1429
|
-
#ifdef FLAT_SHADING
|
|
1430
|
-
in vec3 cameraPosition;
|
|
1431
|
-
in vec4 position_commonspace;
|
|
1432
|
-
#endif
|
|
1433
|
-
void main(void) {
|
|
1434
|
-
fragColor = vColor;
|
|
1435
|
-
geometry.uv = vec2(0.);
|
|
1436
|
-
#ifdef FLAT_SHADING
|
|
1437
|
-
if (column.extruded && !column.isStroke && !bool(picking.isActive)) {
|
|
1438
|
-
vec3 normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));
|
|
1439
|
-
fragColor.rgb = lighting_getLightColor(vColor.rgb, cameraPosition, position_commonspace.xyz, normal);
|
|
1440
|
-
}
|
|
1441
|
-
#endif
|
|
1442
|
-
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
1443
|
-
}
|
|
1444
|
-
`;var Ue=[0,0,0,255],Nn={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:true,wireframe:false,filled:true,stroked:false,flatShading:false,getPosition:{type:"accessor",value:t=>t.position},getFillColor:{type:"accessor",value:Ue},getLineColor:{type:"accessor",value:Ue},getLineWidth:{type:"accessor",value:1},getElevation:{type:"accessor",value:1e3},material:true,getColor:{deprecatedFor:["getFillColor","getLineColor"]}},Wn=(()=>{class t extends mc{getShaders(){let e={},{flatShading:o}=this.props;return o&&(e.FLAT_SHADING=1),super.getShaders({vs:Ii,fs:Mi,defines:e,modules:[Jh,o?rn$1:tn$1,nu,bi]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:true,accessor:"getPosition"},instanceElevations:{size:1,transition:true,accessor:"getElevation"},instanceFillColors:{size:this.props.colorFormat.length,type:"unorm8",transition:true,accessor:"getFillColor",defaultValue:Ue},instanceLineColors:{size:this.props.colorFormat.length,type:"unorm8",transition:true,accessor:"getLineColor",defaultValue:Ue},instanceStrokeWidths:{size:1,accessor:"getLineWidth",transition:true}});}updateState(e){super.updateState(e);let{props:o,oldProps:n,changeFlags:s}=e,r=s.extensionsChanged||o.flatShading!==n.flatShading;r&&(this.state.models?.forEach(l=>l.destroy()),this.setState(this._getModels()),this.getAttributeManager().invalidateAll());let a=this.getNumInstances();this.state.fillModel.setInstanceCount(a),this.state.wireframeModel.setInstanceCount(a),(r||o.diskResolution!==n.diskResolution||o.vertices!==n.vertices||(o.extruded||o.stroked)!==(n.extruded||n.stroked))&&this._updateGeometry(o);}getGeometry(e,o,n){let s=new Ge({radius:1,height:n?2:0,vertices:o,nradial:e}),r=0;if(o)for(let a=0;a<e;a++){let l=o[a],c=Math.sqrt(l[0]*l[0]+l[1]*l[1]);r+=c/e;}else r=1;return this.setState({edgeDistance:Math.cos(Math.PI/e)*r}),s}_getModels(){let e=this.getShaders(),o=this.getAttributeManager().getBufferLayouts(),n=new Kt$1(this.context.device,s$1(r$1({},e),{id:`${this.props.id}-fill`,bufferLayout:o,isInstanced:true})),s=new Kt$1(this.context.device,s$1(r$1({},e),{id:`${this.props.id}-wireframe`,bufferLayout:o,isInstanced:true}));return {fillModel:n,wireframeModel:s,models:[s,n]}}_updateGeometry({diskResolution:e,vertices:o,extruded:n,stroked:s}){let r=this.getGeometry(e,o,n||s);this.setState({fillVertexCount:r.attributes.POSITION.value.length/3});let a=this.state.fillModel,l=this.state.wireframeModel,{POSITION:c,NORMAL:f}=r.attributes,u=new Zr({topology:"triangle-strip",attributes:{POSITION:c,NORMAL:f}});a.setGeometry(u),l.setGeometry(r),l.setTopology("line-list");}draw({uniforms:e}){let{lineWidthUnits:o,lineWidthScale:n,lineWidthMinPixels:s,lineWidthMaxPixels:r,radiusUnits:a,elevationScale:l,extruded:c,filled:f,stroked:u,wireframe:d,offset:p,coverage:g,radius:h,angle:m}=this.props,y=this.state.fillModel,C=this.state.wireframeModel,{fillVertexCount:v,edgeDistance:x}=this.state,L={radius:h,angle:m/180*Math.PI,offset:p,extruded:c,stroked:u,coverage:g,elevationScale:l,edgeDistance:x,radiusUnits:yt$1[a],widthUnits:yt$1[o],widthScale:n,widthMinPixels:s,widthMaxPixels:r};c&&d&&(C.shaderInputs.setProps({column:s$1(r$1({},L),{isStroke:true})}),C.draw(this.context.renderPass)),f&&(y.setVertexCount(v),y.shaderInputs.setProps({column:s$1(r$1({},L),{isStroke:false})}),y.draw(this.context.renderPass)),!c&&u&&(y.setVertexCount(v*2/3),y.shaderInputs.setProps({column:s$1(r$1({},L),{isStroke:true})}),y.draw(this.context.renderPass));}}return t.layerName="ColumnLayer",t.defaultProps=Nn,t})(),dt=Wn;var jn={cellSize:{type:"number",min:0,value:1e3},offset:{type:"array",value:[1,1]}},Vn=(()=>{class t extends dt{_updateGeometry(){let e=new ka;this.state.fillModel.setGeometry(e);}draw({uniforms:e}){let{elevationScale:o,extruded:n,offset:s,coverage:r,cellSize:a,angle:l,radiusUnits:c}=this.props,f=this.state.fillModel,u={radius:a/2,radiusUnits:yt$1[c],angle:l,offset:s,extruded:n,stroked:false,coverage:r,elevationScale:o,edgeDistance:1,isStroke:false,widthUnits:0,widthScale:0,widthMinPixels:0,widthMaxPixels:0};f.shaderInputs.setProps({column:u}),f.draw(this.context.renderPass);}}return t.layerName="GridCellLayer",t.defaultProps=jn,t})(),Zn=Vn;function Ai(t,i,e,o){let n;if(Array.isArray(t[0])){let s=t.length*i;n=new Array(s);for(let r=0;r<t.length;r++)for(let a=0;a<i;a++)n[r*i+a]=t[r][a]||0;}else n=t;return e?me(n,{size:i,gridResolution:e}):o?ft(n,{size:i}):n}var Hn=1,Kn=2,pt=4,Ne=class extends bc{constructor(i){super(s$1(r$1({},i),{attributes:{positions:{size:3,padding:18,initialize:true,type:i.fp64?Float64Array:Float32Array},segmentTypes:{size:1,type:Uint8ClampedArray}}}));}get(i){return this.attributes[i]}getGeometryFromBuffer(i){return this.normalize?super.getGeometryFromBuffer(i):null}normalizeGeometry(i){return this.normalize?Ai(i,this.positionSize,this.opts.resolution,this.opts.wrapLongitude):i}getGeometrySize(i){if(Ti(i)){let o=0;for(let n of i)o+=this.getGeometrySize(n);return o}let e=this.getPathLength(i);return e<2?0:this.isClosed(i)?e<3?0:e+2:e}updateGeometryAttributes(i,e){if(e.geometrySize!==0)if(i&&Ti(i))for(let o of i){let n=this.getGeometrySize(o);e.geometrySize=n,this.updateGeometryAttributes(o,e),e.vertexStart+=n;}else this._updateSegmentTypes(i,e),this._updatePositions(i,e);}_updateSegmentTypes(i,e){let o=this.attributes.segmentTypes,n=i?this.isClosed(i):false,{vertexStart:s,geometrySize:r}=e;o.fill(0,s,s+r),n?(o[s]=pt,o[s+r-2]=pt):(o[s]+=Hn,o[s+r-2]+=Kn),o[s+r-1]=pt;}_updatePositions(i,e){let{positions:o}=this.attributes;if(!o||!i)return;let{vertexStart:n,geometrySize:s}=e,r=new Array(3);for(let a=n,l=0;l<s;a++,l++)this.getPointOnPath(i,l,r),o[a*3]=r[0],o[a*3+1]=r[1],o[a*3+2]=r[2];}getPathLength(i){return i.length/this.positionSize}getPointOnPath(i,e,o=[]){let{positionSize:n}=this;e*n>=i.length&&(e+=1-i.length/n);let s=e*n;return o[0]=i[s],o[1]=i[s+1],o[2]=n===3&&i[s+2]||0,o}isClosed(i){if(!this.normalize)return !!this.opts.loop;let{positionSize:e}=this,o=i.length-e;return i[0]===i[o]&&i[1]===i[o+1]&&(e===2||i[2]===i[o+2])}};function Ti(t){return Array.isArray(t[0])}var Ei=`layout(std140) uniform pathUniforms {
|
|
1445
|
-
float widthScale;
|
|
1446
|
-
float widthMinPixels;
|
|
1447
|
-
float widthMaxPixels;
|
|
1448
|
-
float jointType;
|
|
1449
|
-
float capType;
|
|
1450
|
-
float miterLimit;
|
|
1451
|
-
bool billboard;
|
|
1452
|
-
highp int widthUnits;
|
|
1453
|
-
} path;
|
|
1454
|
-
`,zi={name:"path",vs:Ei,fs:Ei,uniformTypes:{widthScale:"f32",widthMinPixels:"f32",widthMaxPixels:"f32",jointType:"f32",capType:"f32",miterLimit:"f32",billboard:"f32",widthUnits:"i32"}};var Oi=`#version 300 es
|
|
1455
|
-
#define SHADER_NAME path-layer-vertex-shader
|
|
1456
|
-
in vec2 positions;
|
|
1457
|
-
in float instanceTypes;
|
|
1458
|
-
in vec3 instanceStartPositions;
|
|
1459
|
-
in vec3 instanceEndPositions;
|
|
1460
|
-
in vec3 instanceLeftPositions;
|
|
1461
|
-
in vec3 instanceRightPositions;
|
|
1462
|
-
in vec3 instanceLeftPositions64Low;
|
|
1463
|
-
in vec3 instanceStartPositions64Low;
|
|
1464
|
-
in vec3 instanceEndPositions64Low;
|
|
1465
|
-
in vec3 instanceRightPositions64Low;
|
|
1466
|
-
in float instanceStrokeWidths;
|
|
1467
|
-
in vec4 instanceColors;
|
|
1468
|
-
in vec3 instancePickingColors;
|
|
1469
|
-
uniform float opacity;
|
|
1470
|
-
out vec4 vColor;
|
|
1471
|
-
out vec2 vCornerOffset;
|
|
1472
|
-
out float vMiterLength;
|
|
1473
|
-
out vec2 vPathPosition;
|
|
1474
|
-
out float vPathLength;
|
|
1475
|
-
out float vJointType;
|
|
1476
|
-
const float EPSILON = 0.001;
|
|
1477
|
-
const vec3 ZERO_OFFSET = vec3(0.0);
|
|
1478
|
-
float flipIfTrue(bool flag) {
|
|
1479
|
-
return -(float(flag) * 2. - 1.);
|
|
1480
|
-
}
|
|
1481
|
-
vec3 getLineJoinOffset(
|
|
1482
|
-
vec3 prevPoint, vec3 currPoint, vec3 nextPoint,
|
|
1483
|
-
vec2 width
|
|
1484
|
-
) {
|
|
1485
|
-
bool isEnd = positions.x > 0.0;
|
|
1486
|
-
float sideOfPath = positions.y;
|
|
1487
|
-
float isJoint = float(sideOfPath == 0.0);
|
|
1488
|
-
vec3 deltaA3 = (currPoint - prevPoint);
|
|
1489
|
-
vec3 deltaB3 = (nextPoint - currPoint);
|
|
1490
|
-
mat3 rotationMatrix;
|
|
1491
|
-
bool needsRotation = !path.billboard && project_needs_rotation(currPoint, rotationMatrix);
|
|
1492
|
-
if (needsRotation) {
|
|
1493
|
-
deltaA3 = deltaA3 * rotationMatrix;
|
|
1494
|
-
deltaB3 = deltaB3 * rotationMatrix;
|
|
1495
|
-
}
|
|
1496
|
-
vec2 deltaA = deltaA3.xy / width;
|
|
1497
|
-
vec2 deltaB = deltaB3.xy / width;
|
|
1498
|
-
float lenA = length(deltaA);
|
|
1499
|
-
float lenB = length(deltaB);
|
|
1500
|
-
vec2 dirA = lenA > 0. ? normalize(deltaA) : vec2(0.0, 0.0);
|
|
1501
|
-
vec2 dirB = lenB > 0. ? normalize(deltaB) : vec2(0.0, 0.0);
|
|
1502
|
-
vec2 perpA = vec2(-dirA.y, dirA.x);
|
|
1503
|
-
vec2 perpB = vec2(-dirB.y, dirB.x);
|
|
1504
|
-
vec2 tangent = dirA + dirB;
|
|
1505
|
-
tangent = length(tangent) > 0. ? normalize(tangent) : perpA;
|
|
1506
|
-
vec2 miterVec = vec2(-tangent.y, tangent.x);
|
|
1507
|
-
vec2 dir = isEnd ? dirA : dirB;
|
|
1508
|
-
vec2 perp = isEnd ? perpA : perpB;
|
|
1509
|
-
float L = isEnd ? lenA : lenB;
|
|
1510
|
-
float sinHalfA = abs(dot(miterVec, perp));
|
|
1511
|
-
float cosHalfA = abs(dot(dirA, miterVec));
|
|
1512
|
-
float turnDirection = flipIfTrue(dirA.x * dirB.y >= dirA.y * dirB.x);
|
|
1513
|
-
float cornerPosition = sideOfPath * turnDirection;
|
|
1514
|
-
float miterSize = 1.0 / max(sinHalfA, EPSILON);
|
|
1515
|
-
miterSize = mix(
|
|
1516
|
-
min(miterSize, max(lenA, lenB) / max(cosHalfA, EPSILON)),
|
|
1517
|
-
miterSize,
|
|
1518
|
-
step(0.0, cornerPosition)
|
|
1519
|
-
);
|
|
1520
|
-
vec2 offsetVec = mix(miterVec * miterSize, perp, step(0.5, cornerPosition))
|
|
1521
|
-
* (sideOfPath + isJoint * turnDirection);
|
|
1522
|
-
bool isStartCap = lenA == 0.0 || (!isEnd && (instanceTypes == 1.0 || instanceTypes == 3.0));
|
|
1523
|
-
bool isEndCap = lenB == 0.0 || (isEnd && (instanceTypes == 2.0 || instanceTypes == 3.0));
|
|
1524
|
-
bool isCap = isStartCap || isEndCap;
|
|
1525
|
-
if (isCap) {
|
|
1526
|
-
offsetVec = mix(perp * sideOfPath, dir * path.capType * 4.0 * flipIfTrue(isStartCap), isJoint);
|
|
1527
|
-
vJointType = path.capType;
|
|
1528
|
-
} else {
|
|
1529
|
-
vJointType = path.jointType;
|
|
1530
|
-
}
|
|
1531
|
-
vPathLength = L;
|
|
1532
|
-
vCornerOffset = offsetVec;
|
|
1533
|
-
vMiterLength = dot(vCornerOffset, miterVec * turnDirection);
|
|
1534
|
-
vMiterLength = isCap ? isJoint : vMiterLength;
|
|
1535
|
-
vec2 offsetFromStartOfPath = vCornerOffset + deltaA * float(isEnd);
|
|
1536
|
-
vPathPosition = vec2(
|
|
1537
|
-
dot(offsetFromStartOfPath, perp),
|
|
1538
|
-
dot(offsetFromStartOfPath, dir)
|
|
1539
|
-
);
|
|
1540
|
-
geometry.uv = vPathPosition;
|
|
1541
|
-
float isValid = step(instanceTypes, 3.5);
|
|
1542
|
-
vec3 offset = vec3(offsetVec * width * isValid, 0.0);
|
|
1543
|
-
if (needsRotation) {
|
|
1544
|
-
offset = rotationMatrix * offset;
|
|
1545
|
-
}
|
|
1546
|
-
return offset;
|
|
1547
|
-
}
|
|
1548
|
-
void clipLine(inout vec4 position, vec4 refPosition) {
|
|
1549
|
-
if (position.w < EPSILON) {
|
|
1550
|
-
float r = (EPSILON - refPosition.w) / (position.w - refPosition.w);
|
|
1551
|
-
position = refPosition + (position - refPosition) * r;
|
|
1552
|
-
}
|
|
1553
|
-
}
|
|
1554
|
-
void main() {
|
|
1555
|
-
geometry.pickingColor = instancePickingColors;
|
|
1556
|
-
vColor = vec4(instanceColors.rgb, instanceColors.a * layer.opacity);
|
|
1557
|
-
float isEnd = positions.x;
|
|
1558
|
-
vec3 prevPosition = mix(instanceLeftPositions, instanceStartPositions, isEnd);
|
|
1559
|
-
vec3 prevPosition64Low = mix(instanceLeftPositions64Low, instanceStartPositions64Low, isEnd);
|
|
1560
|
-
vec3 currPosition = mix(instanceStartPositions, instanceEndPositions, isEnd);
|
|
1561
|
-
vec3 currPosition64Low = mix(instanceStartPositions64Low, instanceEndPositions64Low, isEnd);
|
|
1562
|
-
vec3 nextPosition = mix(instanceEndPositions, instanceRightPositions, isEnd);
|
|
1563
|
-
vec3 nextPosition64Low = mix(instanceEndPositions64Low, instanceRightPositions64Low, isEnd);
|
|
1564
|
-
geometry.worldPosition = currPosition;
|
|
1565
|
-
vec2 widthPixels = vec2(clamp(
|
|
1566
|
-
project_size_to_pixel(instanceStrokeWidths * path.widthScale, path.widthUnits),
|
|
1567
|
-
path.widthMinPixels, path.widthMaxPixels) / 2.0);
|
|
1568
|
-
vec3 width;
|
|
1569
|
-
if (path.billboard) {
|
|
1570
|
-
vec4 prevPositionScreen = project_position_to_clipspace(prevPosition, prevPosition64Low, ZERO_OFFSET);
|
|
1571
|
-
vec4 currPositionScreen = project_position_to_clipspace(currPosition, currPosition64Low, ZERO_OFFSET, geometry.position);
|
|
1572
|
-
vec4 nextPositionScreen = project_position_to_clipspace(nextPosition, nextPosition64Low, ZERO_OFFSET);
|
|
1573
|
-
clipLine(prevPositionScreen, currPositionScreen);
|
|
1574
|
-
clipLine(nextPositionScreen, currPositionScreen);
|
|
1575
|
-
clipLine(currPositionScreen, mix(nextPositionScreen, prevPositionScreen, isEnd));
|
|
1576
|
-
width = vec3(widthPixels, 0.0);
|
|
1577
|
-
DECKGL_FILTER_SIZE(width, geometry);
|
|
1578
|
-
vec3 offset = getLineJoinOffset(
|
|
1579
|
-
prevPositionScreen.xyz / prevPositionScreen.w,
|
|
1580
|
-
currPositionScreen.xyz / currPositionScreen.w,
|
|
1581
|
-
nextPositionScreen.xyz / nextPositionScreen.w,
|
|
1582
|
-
project_pixel_size_to_clipspace(width.xy)
|
|
1583
|
-
);
|
|
1584
|
-
DECKGL_FILTER_GL_POSITION(currPositionScreen, geometry);
|
|
1585
|
-
gl_Position = vec4(currPositionScreen.xyz + offset * currPositionScreen.w, currPositionScreen.w);
|
|
1586
|
-
} else {
|
|
1587
|
-
prevPosition = project_position(prevPosition, prevPosition64Low);
|
|
1588
|
-
currPosition = project_position(currPosition, currPosition64Low);
|
|
1589
|
-
nextPosition = project_position(nextPosition, nextPosition64Low);
|
|
1590
|
-
width = vec3(project_pixel_size(widthPixels), 0.0);
|
|
1591
|
-
DECKGL_FILTER_SIZE(width, geometry);
|
|
1592
|
-
vec3 offset = getLineJoinOffset(prevPosition, currPosition, nextPosition, width.xy);
|
|
1593
|
-
geometry.position = vec4(currPosition + offset, 1.0);
|
|
1594
|
-
gl_Position = project_common_position_to_clipspace(geometry.position);
|
|
1595
|
-
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
|
|
1596
|
-
}
|
|
1597
|
-
DECKGL_FILTER_COLOR(vColor, geometry);
|
|
1598
|
-
}
|
|
1599
|
-
`;var Ri=`#version 300 es
|
|
1600
|
-
#define SHADER_NAME path-layer-fragment-shader
|
|
1601
|
-
precision highp float;
|
|
1602
|
-
in vec4 vColor;
|
|
1603
|
-
in vec2 vCornerOffset;
|
|
1604
|
-
in float vMiterLength;
|
|
1605
|
-
in vec2 vPathPosition;
|
|
1606
|
-
in float vPathLength;
|
|
1607
|
-
in float vJointType;
|
|
1608
|
-
out vec4 fragColor;
|
|
1609
|
-
void main(void) {
|
|
1610
|
-
geometry.uv = vPathPosition;
|
|
1611
|
-
if (vPathPosition.y < 0.0 || vPathPosition.y > vPathLength) {
|
|
1612
|
-
if (vJointType > 0.5 && length(vCornerOffset) > 1.0) {
|
|
1613
|
-
discard;
|
|
1614
|
-
}
|
|
1615
|
-
if (vJointType < 0.5 && vMiterLength > path.miterLimit + 1.0) {
|
|
1616
|
-
discard;
|
|
1617
|
-
}
|
|
1618
|
-
}
|
|
1619
|
-
fragColor = vColor;
|
|
1620
|
-
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
1621
|
-
}
|
|
1622
|
-
`;var ki=[0,0,0,255],$n={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:false,capRounded:false,miterLimit:{type:"number",min:0,value:4},billboard:false,_pathType:null,getPath:{type:"accessor",value:t=>t.path},getColor:{type:"accessor",value:ki},getWidth:{type:"accessor",value:1},rounded:{deprecatedFor:["jointRounded","capRounded"]}},gt={enter:(t,i)=>i.length?i.subarray(i.length-t.length):t},Jn=(()=>{class t extends mc{getShaders(){return super.getShaders({vs:Oi,fs:Ri,modules:[Jh,nu,zi]})}get wrapLongitude(){return false}getBounds(){return this.getAttributeManager()?.getBounds(["vertexPositions"])}initializeState(){this.getAttributeManager().addInstanced({vertexPositions:{size:3,vertexOffset:1,type:"float64",fp64:this.use64bitPositions(),transition:gt,accessor:"getPath",update:this.calculatePositions,noAlloc:true,shaderAttributes:{instanceLeftPositions:{vertexOffset:0},instanceStartPositions:{vertexOffset:1},instanceEndPositions:{vertexOffset:2},instanceRightPositions:{vertexOffset:3}}},instanceTypes:{size:1,type:"uint8",update:this.calculateSegmentTypes,noAlloc:true},instanceStrokeWidths:{size:1,accessor:"getWidth",transition:gt,defaultValue:1},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",accessor:"getColor",transition:gt,defaultValue:ki},instancePickingColors:{size:4,type:"uint8",accessor:(n,{index:s,target:r})=>this.encodePickingColor(n&&n.__source?n.__source.index:s,r)}}),this.setState({pathTesselator:new Ne({fp64:this.use64bitPositions()})});}updateState(e){super.updateState(e);let{props:o,changeFlags:n}=e,s=this.getAttributeManager();if(n.dataChanged||n.updateTriggersChanged&&(n.updateTriggersChanged.all||n.updateTriggersChanged.getPath)){let{pathTesselator:a}=this.state,l=o.data.attributes||{};a.updateGeometry({data:o.data,geometryBuffer:l.getPath,buffers:l,normalize:!o._pathType,loop:o._pathType==="loop",getGeometry:o.getPath,positionFormat:o.positionFormat,wrapLongitude:o.wrapLongitude,resolution:this.context.viewport.resolution,dataChanged:n.dataChanged}),this.setState({numInstances:a.instanceCount,startIndices:a.vertexStarts}),n.dataChanged||s.invalidateAll();}n.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),s.invalidateAll());}getPickingInfo(e){let o=super.getPickingInfo(e),{index:n}=o,s=this.props.data;return s[0]&&s[0].__source&&(o.object=s.find(r=>r.__source.index===n)),o}disablePickingIndex(e){let o=this.props.data;if(o[0]&&o[0].__source)for(let n=0;n<o.length;n++)o[n].__source.index===e&&this._disablePickingIndex(n);else super.disablePickingIndex(e);}draw({uniforms:e}){let{jointRounded:o,capRounded:n,billboard:s,miterLimit:r,widthUnits:a,widthScale:l,widthMinPixels:c,widthMaxPixels:f}=this.props,u=this.state.model,d={jointType:Number(o),capType:Number(n),billboard:s,widthUnits:yt$1[a],widthScale:l,miterLimit:r,widthMinPixels:c,widthMaxPixels:f};u.shaderInputs.setProps({path:d}),u.draw(this.context.renderPass);}_getModel(){let e=[0,1,2,1,4,2,1,3,4,3,5,4],o=[0,0,0,-1,0,1,1,-1,1,1,1,0];return new Kt$1(this.context.device,s$1(r$1({},this.getShaders()),{id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Zr({topology:"triangle-list",attributes:{indices:new Uint16Array(e),positions:{value:new Float32Array(o),size:2}}}),isInstanced:true}))}calculatePositions(e){let{pathTesselator:o}=this.state;e.startIndices=o.vertexStarts,e.value=o.get("positions");}calculateSegmentTypes(e){let{pathTesselator:o}=this.state;e.startIndices=o.vertexStarts,e.value=o.get("segmentTypes");}}return t.defaultProps=$n,t.layerName="PathLayer",t})(),ye=Jn;var Zi=x(Ui(),1);var He=ie.CLOCKWISE,Ni=ie.COUNTER_CLOCKWISE,K={};function us(t){if(t=t&&t.positions||t,!Array.isArray(t)&&!ArrayBuffer.isView(t))throw new Error("invalid polygon")}function se(t){return "positions"in t?t.positions:t}function Le(t){return "holeIndices"in t?t.holeIndices:null}function ds(t){return Array.isArray(t[0])}function ps(t){return t.length>=1&&t[0].length>=2&&Number.isFinite(t[0][0])}function gs(t){let i=t[0],e=t[t.length-1];return i[0]===e[0]&&i[1]===e[1]&&i[2]===e[2]}function hs(t,i,e,o){for(let n=0;n<i;n++)if(t[e+n]!==t[o-i+n])return false;return true}function Wi(t,i,e,o,n){let s=i,r=e.length;for(let a=0;a<r;a++)for(let l=0;l<o;l++)t[s++]=e[a][l]||0;if(!gs(e))for(let a=0;a<o;a++)t[s++]=e[0][a]||0;return K.start=i,K.end=s,K.size=o,J(t,n,K),s}function ji(t,i,e,o,n=0,s,r){s=s||e.length;let a=s-n;if(a<=0)return i;let l=i;for(let c=0;c<a;c++)t[l++]=e[n+c];if(!hs(e,o,n,s))for(let c=0;c<o;c++)t[l++]=e[n+c];return K.start=i,K.end=l,K.size=o,J(t,r,K),l}function Ke(t,i){us(t);let e=[],o=[];if("positions"in t){let{positions:n,holeIndices:s}=t;if(s){let r=0;for(let a=0;a<=s.length;a++)r=ji(e,r,n,i,s[a-1],s[a],a===0?He:Ni),o.push(r);return o.pop(),{positions:e,holeIndices:o}}t=n;}if(!ds(t))return ji(e,0,t,i,0,e.length,He),e;if(!ps(t)){let n=0;for(let[s,r]of t.entries())n=Wi(e,n,r,i,s===0?He:Ni),o.push(n);return o.pop(),{positions:e,holeIndices:o}}return Wi(e,0,t,i,He),e}function yt(t,i,e){let o=t.length/3,n=0;for(let s=0;s<o;s++){let r=(s+1)%o;n+=t[s*3+i]*t[r*3+e],n-=t[r*3+i]*t[s*3+e];}return Math.abs(n/2)}function Vi(t,i,e,o){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+i]=a,t[r+e]=l,t[r+o]=c;}}function Hi(t,i,e,o){let n=Le(t);n&&(n=n.map(a=>a/i));let s=se(t),r=o&&i===3;if(e){let a=s.length;s=s.slice();let l=[];for(let c=0;c<a;c+=i){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=yt(s,0,1),l=yt(s,0,2),c=yt(s,1,2);if(!a&&!l&&!c)return [];a>l&&a>c||(l>c?(e||(s=s.slice()),Vi(s,0,2,1)):(e||(s=s.slice()),Vi(s,2,0,1)));}return (0, Zi.default)(s,n,i)}var $e=class extends bc{constructor(i){let{fp64:e,IndexType:o=Uint32Array}=i;super(s$1(r$1({},i),{attributes:{positions:{size:3,type:e?Float64Array:Float32Array},vertexValid:{type:Uint16Array,size:1},indices:{type:o,size:1}}}));}get(i){let{attributes:e}=this;return i==="indices"?e.indices&&e.indices.subarray(0,this.vertexCount):e[i]}updateGeometry(i){super.updateGeometry(i);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(i){if(this.normalize){let e=Ke(i,this.positionSize);return this.opts.resolution?ve(se(e),Le(e),{size:this.positionSize,gridResolution:this.opts.resolution,edgeTypes:true}):this.opts.wrapLongitude?ut(se(e),Le(e),{size:this.positionSize,maxLatitude:86,edgeTypes:true}):e}return i}getGeometrySize(i){if($i(i)){let e=0;for(let o of i)e+=this.getGeometrySize(o);return e}return se(i).length/this.positionSize}getGeometryFromBuffer(i){return this.normalize||!this.buffers.indices?super.getGeometryFromBuffer(i):null}updateGeometryAttributes(i,e){if(i&&$i(i))for(let o of i){let n=this.getGeometrySize(o);e.geometrySize=n,this.updateGeometryAttributes(o,e),e.vertexStart+=n,e.indexStart=this.indexStarts[e.geometryIndex+1];}else {let o=i;this._updateIndices(o,e),this._updatePositions(o,e),this._updateVertexValid(o,e);}}_updateIndices(i,{geometryIndex:e,vertexStart:o,indexStart:n}){let{attributes:s,indexStarts:r,typedArrayManager:a}=this,l=s.indices;if(!l||!i)return;let c=n,f=Hi(i,this.positionSize,this.opts.preproject,this.opts.full3d);l=a.allocate(l,n+f.length,{copy:true});for(let u=0;u<f.length;u++)l[c++]=f[u]+o;r[e+1]=n+f.length,s.indices=l;}_updatePositions(i,{vertexStart:e,geometrySize:o}){let{attributes:{positions:n},positionSize:s}=this;if(!n||!i)return;let r=se(i);for(let a=e,l=0;l<o;a++,l++){let c=r[l*s],f=r[l*s+1],u=s>2?r[l*s+2]:0;n[a*3]=c,n[a*3+1]=f,n[a*3+2]=u;}}_updateVertexValid(i,{vertexStart:e,geometrySize:o}){let{positionSize:n}=this,s=this.attributes.vertexValid,r=i&&Le(i);if(i&&i.edgeTypes?s.set(i.edgeTypes,e):s.fill(1,e,e+o),r)for(let a=0;a<r.length;a++)s[e+r[a]/n-1]=0;s[e+o-1]=0;}};function $i(t){return Array.isArray(t)&&t.length>0&&!Number.isFinite(t[0])}var Ji=`layout(std140) uniform solidPolygonUniforms {
|
|
1623
|
-
bool extruded;
|
|
1624
|
-
bool isWireframe;
|
|
1625
|
-
float elevationScale;
|
|
1626
|
-
} solidPolygon;
|
|
1627
|
-
`,Yi={name:"solidPolygon",vs:Ji,fs:Ji,uniformTypes:{extruded:"f32",isWireframe:"f32",elevationScale:"f32"}};var Je=`in vec4 fillColors;
|
|
1628
|
-
in vec4 lineColors;
|
|
1629
|
-
in vec3 pickingColors;
|
|
1630
|
-
out vec4 vColor;
|
|
1631
|
-
struct PolygonProps {
|
|
1632
|
-
vec3 positions;
|
|
1633
|
-
vec3 positions64Low;
|
|
1634
|
-
vec3 normal;
|
|
1635
|
-
float elevations;
|
|
1636
|
-
};
|
|
1637
|
-
vec3 project_offset_normal(vec3 vector) {
|
|
1638
|
-
if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
|
|
1639
|
-
project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSETS) {
|
|
1640
|
-
return normalize(vector * project.commonUnitsPerWorldUnit);
|
|
1641
|
-
}
|
|
1642
|
-
return project_normal(vector);
|
|
1643
|
-
}
|
|
1644
|
-
void calculatePosition(PolygonProps props) {
|
|
1645
|
-
vec3 pos = props.positions;
|
|
1646
|
-
vec3 pos64Low = props.positions64Low;
|
|
1647
|
-
vec3 normal = props.normal;
|
|
1648
|
-
vec4 colors = solidPolygon.isWireframe ? lineColors : fillColors;
|
|
1649
|
-
geometry.worldPosition = props.positions;
|
|
1650
|
-
geometry.pickingColor = pickingColors;
|
|
1651
|
-
if (solidPolygon.extruded) {
|
|
1652
|
-
pos.z += props.elevations * solidPolygon.elevationScale;
|
|
1653
|
-
}
|
|
1654
|
-
gl_Position = project_position_to_clipspace(pos, pos64Low, vec3(0.), geometry.position);
|
|
1655
|
-
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
|
|
1656
|
-
if (solidPolygon.extruded) {
|
|
1657
|
-
#ifdef IS_SIDE_VERTEX
|
|
1658
|
-
normal = project_offset_normal(normal);
|
|
1659
|
-
#else
|
|
1660
|
-
normal = project_normal(normal);
|
|
1661
|
-
#endif
|
|
1662
|
-
geometry.normal = normal;
|
|
1663
|
-
vec3 lightColor = lighting_getLightColor(colors.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal);
|
|
1664
|
-
vColor = vec4(lightColor, colors.a * layer.opacity);
|
|
1665
|
-
} else {
|
|
1666
|
-
vColor = vec4(colors.rgb, colors.a * layer.opacity);
|
|
1667
|
-
}
|
|
1668
|
-
DECKGL_FILTER_COLOR(vColor, geometry);
|
|
1669
|
-
}
|
|
1670
|
-
`;var Xi=`#version 300 es
|
|
1671
|
-
#define SHADER_NAME solid-polygon-layer-vertex-shader
|
|
1672
|
-
in vec3 vertexPositions;
|
|
1673
|
-
in vec3 vertexPositions64Low;
|
|
1674
|
-
in float elevations;
|
|
1675
|
-
${Je}
|
|
1676
|
-
void main(void) {
|
|
1677
|
-
PolygonProps props;
|
|
1678
|
-
props.positions = vertexPositions;
|
|
1679
|
-
props.positions64Low = vertexPositions64Low;
|
|
1680
|
-
props.elevations = elevations;
|
|
1681
|
-
props.normal = vec3(0.0, 0.0, 1.0);
|
|
1682
|
-
calculatePosition(props);
|
|
1683
|
-
}
|
|
1684
|
-
`;var qi=`#version 300 es
|
|
1685
|
-
#define SHADER_NAME solid-polygon-layer-vertex-shader-side
|
|
1686
|
-
#define IS_SIDE_VERTEX
|
|
1687
|
-
in vec2 positions;
|
|
1688
|
-
in vec3 vertexPositions;
|
|
1689
|
-
in vec3 nextVertexPositions;
|
|
1690
|
-
in vec3 vertexPositions64Low;
|
|
1691
|
-
in vec3 nextVertexPositions64Low;
|
|
1692
|
-
in float elevations;
|
|
1693
|
-
in float instanceVertexValid;
|
|
1694
|
-
${Je}
|
|
1695
|
-
void main(void) {
|
|
1696
|
-
if(instanceVertexValid < 0.5){
|
|
1697
|
-
gl_Position = vec4(0.);
|
|
1698
|
-
return;
|
|
1699
|
-
}
|
|
1700
|
-
PolygonProps props;
|
|
1701
|
-
vec3 pos;
|
|
1702
|
-
vec3 pos64Low;
|
|
1703
|
-
vec3 nextPos;
|
|
1704
|
-
vec3 nextPos64Low;
|
|
1705
|
-
#if RING_WINDING_ORDER_CW == 1
|
|
1706
|
-
pos = vertexPositions;
|
|
1707
|
-
pos64Low = vertexPositions64Low;
|
|
1708
|
-
nextPos = nextVertexPositions;
|
|
1709
|
-
nextPos64Low = nextVertexPositions64Low;
|
|
1710
|
-
#else
|
|
1711
|
-
pos = nextVertexPositions;
|
|
1712
|
-
pos64Low = nextVertexPositions64Low;
|
|
1713
|
-
nextPos = vertexPositions;
|
|
1714
|
-
nextPos64Low = vertexPositions64Low;
|
|
1715
|
-
#endif
|
|
1716
|
-
props.positions = mix(pos, nextPos, positions.x);
|
|
1717
|
-
props.positions64Low = mix(pos64Low, nextPos64Low, positions.x);
|
|
1718
|
-
props.normal = vec3(
|
|
1719
|
-
pos.y - nextPos.y + (pos64Low.y - nextPos64Low.y),
|
|
1720
|
-
nextPos.x - pos.x + (nextPos64Low.x - pos64Low.x),
|
|
1721
|
-
0.0);
|
|
1722
|
-
props.elevations = elevations * positions.y;
|
|
1723
|
-
calculatePosition(props);
|
|
1724
|
-
}
|
|
1725
|
-
`;var Qi=`#version 300 es
|
|
1726
|
-
#define SHADER_NAME solid-polygon-layer-fragment-shader
|
|
1727
|
-
precision highp float;
|
|
1728
|
-
in vec4 vColor;
|
|
1729
|
-
out vec4 fragColor;
|
|
1730
|
-
void main(void) {
|
|
1731
|
-
fragColor = vColor;
|
|
1732
|
-
geometry.uv = vec2(0.);
|
|
1733
|
-
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
1734
|
-
}
|
|
1735
|
-
`;var Xe=[0,0,0,255],xs={filled:true,extruded:false,wireframe:false,_normalize:true,_windingOrder:"CW",_full3d:false,elevationScale:{type:"number",min:0,value:1},getPolygon:{type:"accessor",value:t=>t.polygon},getElevation:{type:"accessor",value:1e3},getFillColor:{type:"accessor",value:Xe},getLineColor:{type:"accessor",value:Xe},material:true},Ye={enter:(t,i)=>i.length?i.subarray(i.length-t.length):t},ms=(()=>{class t extends mc{getShaders(e){return super.getShaders({vs:e==="top"?Xi:qi,fs:Qi,defines:{RING_WINDING_ORDER_CW:!this.props._normalize&&this.props._windingOrder==="CCW"?0:1},modules:[Jh,tn$1,nu,Yi]})}get wrapLongitude(){return false}getBounds(){return this.getAttributeManager()?.getBounds(["vertexPositions"])}initializeState(){let{viewport:e}=this.context,{coordinateSystem:o}=this.props,{_full3d:n}=this.props;e.isGeospatial&&o==="default"&&(o="lnglat");let s;o==="lnglat"&&(n?s=e.projectPosition.bind(e):s=e.projectFlat.bind(e)),this.setState({numInstances:0,polygonTesselator:new $e({preproject:s,fp64:this.use64bitPositions(),IndexType:Uint32Array})});let r=this.getAttributeManager(),a=true;r.remove(["instancePickingColors"]),r.add({indices:{size:1,isIndexed:true,update:this.calculateIndices,noAlloc:a},vertexPositions:{size:3,type:"float64",stepMode:"dynamic",fp64:this.use64bitPositions(),transition:Ye,accessor:"getPolygon",update:this.calculatePositions,noAlloc:a,shaderAttributes:{nextVertexPositions:{vertexOffset:1}}},instanceVertexValid:{size:1,type:"uint16",stepMode:"instance",update:this.calculateVertexValid,noAlloc:a},elevations:{size:1,stepMode:"dynamic",transition:Ye,accessor:"getElevation"},fillColors:{size:this.props.colorFormat.length,type:"unorm8",stepMode:"dynamic",transition:Ye,accessor:"getFillColor",defaultValue:Xe},lineColors:{size:this.props.colorFormat.length,type:"unorm8",stepMode:"dynamic",transition:Ye,accessor:"getLineColor",defaultValue:Xe},pickingColors:{size:4,type:"uint8",stepMode:"dynamic",accessor:(l,{index:c,target:f})=>this.encodePickingColor(l&&l.__source?l.__source.index:c,f)}});}getPickingInfo(e){let o=super.getPickingInfo(e),{index:n}=o,s=this.props.data;return s[0]&&s[0].__source&&(o.object=s.find(r=>r.__source.index===n)),o}disablePickingIndex(e){let o=this.props.data;if(o[0]&&o[0].__source)for(let n=0;n<o.length;n++)o[n].__source.index===e&&this._disablePickingIndex(n);else super.disablePickingIndex(e);}draw({uniforms:e}){let{extruded:o,filled:n,wireframe:s,elevationScale:r}=this.props,{topModel:a,sideModel:l,wireframeModel:c,polygonTesselator:f}=this.state,u={extruded:!!o,elevationScale:r,isWireframe:false};c&&s&&(c.setInstanceCount(f.instanceCount-1),c.shaderInputs.setProps({solidPolygon:s$1(r$1({},u),{isWireframe:true})}),c.draw(this.context.renderPass)),l&&n&&(l.setInstanceCount(f.instanceCount-1),l.shaderInputs.setProps({solidPolygon:u}),l.draw(this.context.renderPass)),a&&n&&(a.setVertexCount(f.vertexCount),a.shaderInputs.setProps({solidPolygon:u}),a.draw(this.context.renderPass));}updateState(e){super.updateState(e),this.updateGeometry(e);let{props:o,oldProps:n,changeFlags:s}=e,r=this.getAttributeManager();(s.extensionsChanged||o.filled!==n.filled||o.extruded!==n.extruded)&&(this.state.models?.forEach(l=>l.destroy()),this.setState(this._getModels()),r.invalidateAll());}updateGeometry({props:e,oldProps:o,changeFlags:n}){if(n.dataChanged||n.updateTriggersChanged&&(n.updateTriggersChanged.all||n.updateTriggersChanged.getPolygon)){let{polygonTesselator:r}=this.state,a=e.data.attributes||{};r.updateGeometry({data:e.data,normalize:e._normalize,geometryBuffer:a.getPolygon,buffers: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.instanceCount,startIndices:r.vertexStarts}),n.dataChanged||this.getAttributeManager().invalidateAll();}}_getModels(){let{id:e,filled:o,extruded:n}=this.props,s,r,a;if(o){let l=this.getShaders("top");l.defines.NON_INSTANCED_MODEL=1;let c=this.getAttributeManager().getBufferLayouts({isInstanced:false});s=new Kt$1(this.context.device,s$1(r$1({},l),{id:`${e}-top`,topology:"triangle-list",bufferLayout:c,isIndexed:true,userData:{excludeAttributes:{instanceVertexValid:true}}}));}if(n){let l=this.getAttributeManager().getBufferLayouts({isInstanced:true});r=new Kt$1(this.context.device,s$1(r$1({},this.getShaders("side")),{id:`${e}-side`,bufferLayout:l,geometry:new Zr({topology:"triangle-strip",attributes:{positions:{size:2,value:new Float32Array([1,0,0,0,1,1,0,1])}}}),isInstanced:true,userData:{excludeAttributes:{indices:true}}})),a=new Kt$1(this.context.device,s$1(r$1({},this.getShaders("side")),{id:`${e}-wireframe`,bufferLayout:l,geometry:new Zr({topology:"line-strip",attributes:{positions:{size:2,value:new Float32Array([1,0,0,0,0,1,1,1])}}}),isInstanced:true,userData:{excludeAttributes:{indices:true}}}));}return {models:[r,a,s].filter(Boolean),topModel:s,sideModel:r,wireframeModel:a}}calculateIndices(e){let{polygonTesselator:o}=this.state;e.startIndices=o.indexStarts,e.value=o.get("indices");}calculatePositions(e){let{polygonTesselator:o}=this.state;e.startIndices=o.vertexStarts,e.value=o.get("positions");}calculateVertexValid(e){e.value=this.state.polygonTesselator.get("vertexValid");}}return t.defaultProps=xs,t.layerName="SolidPolygonLayer",t})(),Se=ms;function qe({data:t,getIndex:i,dataRange:e,replace:o}){let{startRow:n=0,endRow:s=1/0}=e,r=t.length,a=r,l=r;for(let d=0;d<r;d++){let p=i(t[d]);if(a>d&&p>=n&&(a=d),p>=s){l=d;break}}let c=a,u=l-a!==o.length?t.slice(l):void 0;for(let d=0;d<o.length;d++)t[c++]=o[d];if(u){for(let d=0;d<u.length;d++)t[c++]=u[d];t.length=c;}return {startRow:a,endRow:a+o.length}}var eo=[0,0,0,255],vs=[0,0,0,255],ys={stroked:true,filled:true,extruded:false,elevationScale:1,wireframe:false,_normalize:true,_windingOrder:"CW",lineWidthUnits:"meters",lineWidthScale:1,lineWidthMinPixels:0,lineWidthMaxPixels:Number.MAX_SAFE_INTEGER,lineJointRounded:false,lineMiterLimit:4,getPolygon:{type:"accessor",value:t=>t.polygon},getFillColor:{type:"accessor",value:vs},getLineColor:{type:"accessor",value:eo},getLineWidth:{type:"accessor",value:1},getElevation:{type:"accessor",value:1e3},material:true},Ps=(()=>{class t extends Dv{initializeState(){this.state={paths:[],pathsDiff:null},this.props.getLineDashArray&&C.removed("getLineDashArray","PathStyleExtension")();}updateState({changeFlags:e}){let o=e.dataChanged||e.updateTriggersChanged&&(e.updateTriggersChanged.all||e.updateTriggersChanged.getPolygon);if(o&&Array.isArray(e.dataChanged)){let n=this.state.paths.slice(),s=e.dataChanged.map(r=>qe({data:n,getIndex:a=>a.__source.index,dataRange:r,replace:this._getPaths(r)}));this.setState({paths:n,pathsDiff:s});}else o&&this.setState({paths:this._getPaths(),pathsDiff:null});}_getPaths(e={}){let{data:o,getPolygon:n,positionFormat:s,_normalize:r}=this.props,a=[],l=s==="XY"?2:3,{startRow:c,endRow:f}=e,{iterable:u,objectInfo:d}=fi$1(o,c,f);for(let p of u){d.index++;let g=n(p,d);r&&(g=Ke(g,l));let{holeIndices:h}=g,m=g.positions||g;if(h)for(let y=0;y<=h.length;y++){let C=m.slice(h[y-1]||0,h[y]||m.length);a.push(this.getSubLayerRow({path:C},p,d.index));}else a.push(this.getSubLayerRow({path:m},p,d.index));}return a}renderLayers(){let{data:e,_dataDiff:o,stroked:n,filled:s,extruded:r,wireframe:a,_normalize:l,_windingOrder:c,elevationScale:f,transitions:u,positionFormat:d}=this.props,{lineWidthUnits:p,lineWidthScale:g,lineWidthMinPixels:h,lineWidthMaxPixels:m,lineJointRounded:y,lineMiterLimit:C,lineDashJustified:v}=this.props,{getFillColor:x,getLineColor:L,getLineWidth:B,getLineDashArray:D,getElevation:U,getPolygon:F,updateTriggers:M,material:j}=this.props,{paths:N,pathsDiff:W}=this.state,$=this.getSubLayerClass("fill",Se),Q=this.getSubLayerClass("stroke",ye),Ae=this.shouldRenderSubLayer("fill",N)&&new $({_dataDiff:o,extruded:r,elevationScale:f,filled:s,wireframe:a,_normalize:l,_windingOrder:c,getElevation:U,getFillColor:x,getLineColor:r&&a?L:eo,material:j,transitions:u},this.getSubLayerProps({id:"fill",updateTriggers:M&&{getPolygon:M.getPolygon,getElevation:M.getElevation,getFillColor:M.getFillColor,lineColors:r&&a,getLineColor:M.getLineColor}}),{data:e,positionFormat:d,getPolygon:F}),k=!r&&n&&this.shouldRenderSubLayer("stroke",N)&&new Q({_dataDiff:W&&(()=>W),widthUnits:p,widthScale:g,widthMinPixels:h,widthMaxPixels:m,jointRounded:y,miterLimit:C,dashJustified:v,_pathType:"loop",transitions:u&&{getWidth:u.getLineWidth,getColor:u.getLineColor,getPath:u.getPolygon},getColor:this.getSubLayerAccessor(L),getWidth:this.getSubLayerAccessor(B),getDashArray:this.getSubLayerAccessor(D)},this.getSubLayerProps({id:"stroke",updateTriggers:M&&{getWidth:M.getLineWidth,getColor:M.getLineColor,getDashArray:M.getLineDashArray}}),{data:N,positionFormat:d,getPath:I=>I.path});return [!r&&Ae,k,r&&Ae]}}return t.layerName="PolygonLayer",t.defaultProps=ys,t})(),_s=Ps;function to(t,i){if(!t)return null;let e="startIndices"in t?t.startIndices[i]:i,o=t.featureIds.value[e];return e!==-1?Cs(t,o,e):null}function Cs(t,i,e){let o={properties:r$1({},t.properties[i])};for(let n in t.numericProps)o.properties[n]=t.numericProps[n].value[e];return o}function io(t,i){let e={points:null,lines:null,polygons:null};for(let o in e){let n=t[o].globalFeatureIds.value;e[o]=new Uint8ClampedArray(n.length*4);let s=[];for(let r=0;r<n.length;r++)i(n[r],s),e[o][r*4+0]=s[0],e[o][r*4+1]=s[1],e[o][r*4+2]=s[2],e[o][r*4+3]=255;}return e}var oo=`layout(std140) uniform sdfUniforms {
|
|
1736
|
-
float gamma;
|
|
1737
|
-
bool enabled;
|
|
1738
|
-
float buffer;
|
|
1739
|
-
float outlineBuffer;
|
|
1740
|
-
vec4 outlineColor;
|
|
1741
|
-
} sdf;
|
|
1742
|
-
`,no={name:"sdf",vs:oo,fs:oo,uniformTypes:{gamma:"f32",enabled:"f32",buffer:"f32",outlineBuffer:"f32",outlineColor:"vec4<f32>"}};var we={none:0,start:1,center:2,end:3},Ls=`layout(std140) uniform textUniforms {
|
|
1743
|
-
highp vec2 cutoffPixels;
|
|
1744
|
-
highp ivec2 align;
|
|
1745
|
-
highp float fontSize;
|
|
1746
|
-
bool flipY;
|
|
1747
|
-
} text;
|
|
1748
|
-
|
|
1749
|
-
#define ALIGN_MODE_START ${we.start}
|
|
1750
|
-
#define ALIGN_MODE_CENTER ${we.center}
|
|
1751
|
-
#define ALIGN_MODE_END ${we.end}
|
|
1752
|
-
`,Qe={name:"text",vs:Ls,getUniforms:({contentCutoffPixels:t=[0,0],contentAlignHorizontal:i="none",contentAlignVertical:e="none",fontSize:o,viewport:n})=>({cutoffPixels:t,align:[we[i],we[e]],fontSize:o,flipY:n?.flipY??false}),uniformTypes:{cutoffPixels:"vec2<f32>",align:"vec2<i32>",fontSize:"f32",flipY:"f32"}};var so=`#version 300 es
|
|
1753
|
-
#define SHADER_NAME multi-icon-layer-vertex-shader
|
|
1754
|
-
in vec2 positions;
|
|
1755
|
-
in vec3 instancePositions;
|
|
1756
|
-
in vec3 instancePositions64Low;
|
|
1757
|
-
in float instanceSizes;
|
|
1758
|
-
in float instanceAngles;
|
|
1759
|
-
in vec4 instanceColors;
|
|
1760
|
-
in vec3 instancePickingColors;
|
|
1761
|
-
in vec4 instanceIconFrames;
|
|
1762
|
-
in float instanceColorModes;
|
|
1763
|
-
in vec2 instanceOffsets;
|
|
1764
|
-
in vec2 instancePixelOffset;
|
|
1765
|
-
in vec4 instanceClipRect;
|
|
1766
|
-
out float vColorMode;
|
|
1767
|
-
out vec4 vColor;
|
|
1768
|
-
out vec2 vTextureCoords;
|
|
1769
|
-
out vec2 uv;
|
|
1770
|
-
vec2 rotate_by_angle(vec2 vertex, float angle) {
|
|
1771
|
-
float angle_radian = angle * PI / 180.0;
|
|
1772
|
-
float cos_angle = cos(angle_radian);
|
|
1773
|
-
float sin_angle = sin(angle_radian);
|
|
1774
|
-
mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle);
|
|
1775
|
-
return rotationMatrix * vertex;
|
|
1776
|
-
}
|
|
1777
|
-
float getPixelOffsetFromAlignment(float anchor, float extent, float clipStart, float clipEnd, int mode) {
|
|
1778
|
-
if (clipEnd < clipStart) return 0.0;
|
|
1779
|
-
if (mode == ALIGN_MODE_START) {
|
|
1780
|
-
return max(- (anchor + clipStart), 0.0);
|
|
1781
|
-
}
|
|
1782
|
-
if (mode == ALIGN_MODE_CENTER) {
|
|
1783
|
-
float _min = max(0., anchor + clipStart);
|
|
1784
|
-
float _max = min(extent, anchor + clipEnd);
|
|
1785
|
-
return _min < _max ? (_min + _max) / 2.0 - anchor : 0.0;
|
|
1786
|
-
}
|
|
1787
|
-
if (mode == ALIGN_MODE_END) {
|
|
1788
|
-
return min(extent - (anchor + clipEnd), 0.);
|
|
1789
|
-
}
|
|
1790
|
-
return 0.0;
|
|
1791
|
-
}
|
|
1792
|
-
void main(void) {
|
|
1793
|
-
geometry.worldPosition = instancePositions;
|
|
1794
|
-
geometry.uv = positions;
|
|
1795
|
-
geometry.pickingColor = instancePickingColors;
|
|
1796
|
-
uv = positions;
|
|
1797
|
-
vec2 iconSize = instanceIconFrames.zw;
|
|
1798
|
-
float sizePixels = clamp(
|
|
1799
|
-
project_size_to_pixel(instanceSizes * icon.sizeScale, icon.sizeUnits),
|
|
1800
|
-
icon.sizeMinPixels, icon.sizeMaxPixels
|
|
1801
|
-
);
|
|
1802
|
-
float instanceScale = sizePixels / text.fontSize;
|
|
1803
|
-
vec2 pixelOffset = positions / 2.0 * iconSize + instanceOffsets;
|
|
1804
|
-
pixelOffset = rotate_by_angle(pixelOffset, instanceAngles) * instanceScale;
|
|
1805
|
-
pixelOffset += instancePixelOffset;
|
|
1806
|
-
pixelOffset.y *= -1.0;
|
|
1807
|
-
vec2 anchorPosScreen;
|
|
1808
|
-
if (icon.billboard) {
|
|
1809
|
-
gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);
|
|
1810
|
-
anchorPosScreen = gl_Position.xy / gl_Position.w;
|
|
1811
|
-
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
|
|
1812
|
-
vec3 offset = vec3(pixelOffset, 0.0);
|
|
1813
|
-
DECKGL_FILTER_SIZE(offset, geometry);
|
|
1814
|
-
gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);
|
|
1815
|
-
} else {
|
|
1816
|
-
vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0);
|
|
1817
|
-
if (text.flipY) {
|
|
1818
|
-
offset_common.y *= -1.;
|
|
1819
|
-
}
|
|
1820
|
-
DECKGL_FILTER_SIZE(offset_common, geometry);
|
|
1821
|
-
vec4 anchorPos = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0));
|
|
1822
|
-
anchorPosScreen = anchorPos.xy / anchorPos.w;
|
|
1823
|
-
gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position);
|
|
1824
|
-
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
|
|
1825
|
-
}
|
|
1826
|
-
anchorPosScreen = vec2(anchorPosScreen.x + 1.0, 1.0 - anchorPosScreen.y) / 2.0 * project.viewportSize / project.devicePixelRatio;
|
|
1827
|
-
vec2 xy = project_size_to_pixel(instanceClipRect.xy);
|
|
1828
|
-
vec2 wh = project_size_to_pixel(instanceClipRect.zw);
|
|
1829
|
-
if (text.flipY) {
|
|
1830
|
-
xy.y = -xy.y - wh.y;
|
|
1831
|
-
}
|
|
1832
|
-
if (text.align.x > 0 || text.align.y > 0) {
|
|
1833
|
-
vec2 viewportPixels = project.viewportSize / project.devicePixelRatio;
|
|
1834
|
-
vec2 scrollPixels = vec2(
|
|
1835
|
-
getPixelOffsetFromAlignment(anchorPosScreen.x, viewportPixels.x, xy.x, xy.x + wh.x, text.align.x),
|
|
1836
|
-
-getPixelOffsetFromAlignment(anchorPosScreen.y, viewportPixels.y, -xy.y - wh.y, -xy.y, text.align.y)
|
|
1837
|
-
);
|
|
1838
|
-
pixelOffset += scrollPixels;
|
|
1839
|
-
gl_Position.xy += project_pixel_size_to_clipspace(scrollPixels);
|
|
1840
|
-
}
|
|
1841
|
-
if (instanceClipRect.z >= 0.) {
|
|
1842
|
-
if (pixelOffset.x < xy.x || pixelOffset.x > xy.x + wh.x) {
|
|
1843
|
-
gl_Position = vec4(0.0);
|
|
1844
|
-
}
|
|
1845
|
-
else if (text.cutoffPixels.x > 0.) {
|
|
1846
|
-
float vpWidth = project.viewportSize.x / project.devicePixelRatio;
|
|
1847
|
-
float l = max(anchorPosScreen.x + xy.x, 0.0);
|
|
1848
|
-
float r = min(anchorPosScreen.x + xy.x + wh.x, vpWidth);
|
|
1849
|
-
if (r - l < text.cutoffPixels.x) {
|
|
1850
|
-
gl_Position = vec4(0.0);
|
|
1851
|
-
}
|
|
1852
|
-
}
|
|
1853
|
-
}
|
|
1854
|
-
if (instanceClipRect.w >= 0.) {
|
|
1855
|
-
if (pixelOffset.y < xy.y || pixelOffset.y > xy.y + wh.y) {
|
|
1856
|
-
gl_Position = vec4(0.0);
|
|
1857
|
-
}
|
|
1858
|
-
else if (text.cutoffPixels.y > 0.) {
|
|
1859
|
-
float vpHeight = project.viewportSize.y / project.devicePixelRatio;
|
|
1860
|
-
float t = max(anchorPosScreen.y - xy.y - wh.y, 0.0);
|
|
1861
|
-
float b = min(anchorPosScreen.y - xy.y, vpHeight);
|
|
1862
|
-
if (b - t < text.cutoffPixels.y) {
|
|
1863
|
-
gl_Position = vec4(0.0);
|
|
1864
|
-
}
|
|
1865
|
-
}
|
|
1866
|
-
}
|
|
1867
|
-
vTextureCoords = mix(
|
|
1868
|
-
instanceIconFrames.xy,
|
|
1869
|
-
instanceIconFrames.xy + iconSize,
|
|
1870
|
-
(positions.xy + 1.0) / 2.0
|
|
1871
|
-
) / icon.iconsTextureDim;
|
|
1872
|
-
vColor = instanceColors;
|
|
1873
|
-
DECKGL_FILTER_COLOR(vColor, geometry);
|
|
1874
|
-
vColorMode = instanceColorModes;
|
|
1875
|
-
}
|
|
1876
|
-
`;var ro=`#version 300 es
|
|
1877
|
-
#define SHADER_NAME multi-icon-layer-fragment-shader
|
|
1878
|
-
precision highp float;
|
|
1879
|
-
uniform sampler2D iconsTexture;
|
|
1880
|
-
in vec4 vColor;
|
|
1881
|
-
in vec2 vTextureCoords;
|
|
1882
|
-
in vec2 uv;
|
|
1883
|
-
out vec4 fragColor;
|
|
1884
|
-
void main(void) {
|
|
1885
|
-
geometry.uv = uv;
|
|
1886
|
-
if (!bool(picking.isActive)) {
|
|
1887
|
-
float alpha = texture(iconsTexture, vTextureCoords).a;
|
|
1888
|
-
vec4 color = vColor;
|
|
1889
|
-
if (sdf.enabled) {
|
|
1890
|
-
float distance = alpha;
|
|
1891
|
-
alpha = smoothstep(sdf.buffer - sdf.gamma, sdf.buffer + sdf.gamma, distance);
|
|
1892
|
-
if (sdf.outlineBuffer > 0.0) {
|
|
1893
|
-
float inFill = alpha;
|
|
1894
|
-
float inBorder = smoothstep(sdf.outlineBuffer - sdf.gamma, sdf.outlineBuffer + sdf.gamma, distance);
|
|
1895
|
-
color = mix(sdf.outlineColor, vColor, inFill);
|
|
1896
|
-
alpha = inBorder;
|
|
1897
|
-
}
|
|
1898
|
-
}
|
|
1899
|
-
float a = alpha * color.a;
|
|
1900
|
-
if (a < icon.alphaCutoff) {
|
|
1901
|
-
discard;
|
|
1902
|
-
}
|
|
1903
|
-
fragColor = vec4(color.rgb, a * layer.opacity);
|
|
1904
|
-
}
|
|
1905
|
-
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
1906
|
-
}
|
|
1907
|
-
`;var Pt=192/256;var Ss={getIconOffsets:{type:"accessor",value:t=>t.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"},ws=(()=>{class t extends le{getShaders(){let e=super.getShaders();return s$1(r$1({},e),{modules:[...e.modules,Qe,no],vs:so,fs:ro})}initializeState(){super.initializeState();let e=this.getAttributeManager(),o=e.attributes.instanceIconDefs;o.settings.update=this.calculateInstanceIconDefs,e.addInstanced({instancePickingColors:{type:"uint8",size:4,accessor:(n,{index:s,target:r})=>this.encodePickingColor(s,r)},instanceClipRect:{size:4,accessor:"getContentBox",defaultValue:[0,0,-1,-1]}});}updateState(e){super.updateState(e);let{props:o,oldProps:n,changeFlags:s}=e,{outlineColor:r}=o;if(s.updateTriggersChanged&&(s.updateTriggersChanged.getIcon||s.updateTriggersChanged.getIconOffsets)&&this.getAttributeManager().invalidate("instanceIconDefs"),r!==n.outlineColor){let a=[r[0]/255,r[1]/255,r[2]/255,(r[3]??255)/255];this.setState({outlineColor:a});}!o.sdf&&o.outlineWidth&&C.warn(`${this.id}: fontSettings.sdf is required to render outline`)();}draw(e){let{sdf:o,smoothing:n,fontSize:s,outlineWidth:r,contentCutoffPixels:a,contentAlignHorizontal:l,contentAlignVertical:c}=this.props,{outlineColor:f}=this.state,u=r?Math.max(n,Pt*(1-r)):-1,d=this.state.model,p={buffer:Pt,outlineBuffer:u,gamma:n,enabled:!!o,outlineColor:f},g={contentCutoffPixels:a,contentAlignHorizontal:l,contentAlignVertical:c,fontSize:s,viewport:this.context.viewport};if(d.shaderInputs.setProps({sdf:p,text:g}),super.draw(e),o&&r){let{iconManager:h}=this.state;h.getTexture()&&(d.shaderInputs.setProps({sdf:s$1(r$1({},p),{outlineBuffer:Pt})}),d.draw(this.context.renderPass));}}calculateInstanceIconDefs(e,{startRow:o,endRow:n}){let{data:s,getIcon:r,getIconOffsets:a}=this.props,l=e.getVertexOffset(o),c=e.value,{iterable:f,objectInfo:u}=fi$1(s,o,n);for(let d of f){u.index++;let p=r(d,u),g=a(d,u);if(p){let h=0;for(let m of Array.from(p)){let y=super.getInstanceIconDef(m);y[0]=g[h*2],y[1]+=g[h*2+1],y[6]=1,c.set(y,l),l+=e.size,h++;}}}}}return t.defaultProps=Ss,t.layerName="MultiIconLayer",t})(),_t=ws;var Ct=new Float64Array(256);for(let t=0;t<256;t++){let i=.5-Math.pow(t/255,.45454545454545453);Ct[t]=i*Math.abs(i);}Ct[255]=-1e20;var et=class{constructor({fontSize:i=24,buffer:e=3,radius:o=8,cutoff:n=.25,fontFamily:s="sans-serif",fontWeight:r="normal",fontStyle:a="normal",lang:l=null}={}){this.buffer=e,this.radius=o,this.cutoff=n,this.lang=l;let c=this.size=i+e*4,f=this._createCanvas(c),u=this.ctx=f.getContext("2d",{willReadFrequently:true});u.font=`${a} ${r} ${i}px ${s}`,u.textBaseline="alphabetic",u.textAlign="left",u.fillStyle="black",this.gridOuter=new Float64Array(c*c),this.gridInner=new Float64Array(c*c),this.f=new Float64Array(c),this.z=new Float64Array(c+1),this.v=new Uint16Array(c);}_createCanvas(i){if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(i,i);let e=document.createElement("canvas");return e.width=e.height=i,e}draw(i){let{width:e,actualBoundingBoxAscent:o,actualBoundingBoxDescent:n,actualBoundingBoxLeft:s,actualBoundingBoxRight:r}=this.ctx.measureText(i),a=Math.ceil(o),l=Math.floor(-s),c=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(r)-l)),f=Math.max(0,Math.min(this.size-this.buffer,a+Math.ceil(n))),u=c+2*this.buffer,d=f+2*this.buffer,p=Math.max(u*d,0),g=new Uint8ClampedArray(p),h={data:g,width:u,height:d,glyphWidth:c,glyphHeight:f,glyphTop:a,glyphLeft:l,glyphAdvance:e};if(c===0||f===0)return h;let{ctx:m,buffer:y,gridInner:C,gridOuter:v}=this;this.lang&&(m.lang=this.lang),m.clearRect(y,y,c,f),m.fillText(i,y-l,y+a);let x=m.getImageData(y,y,c,f);v.fill(1e20,0,p),C.fill(0,0,p);let L=3;for(let F=0;F<f;F++){let M=(F+y)*u+y;for(let j=0;j<c;j++,L+=4,M++){let N=x.data[L];if(N===0)continue;let W=Ct[N];v[M]=Math.max(0,W),C[M]=Math.max(0,-W);}}ao(v,0,0,u,d,u,this.f,this.v,this.z);let B=Math.min(y,1);ao(C,y-B,y-B,c+2*B,f+2*B,u,this.f,this.v,this.z);let D=255/this.radius,U=255*(1-this.cutoff);for(let F=0;F<p;F++){let M=Math.sqrt(v[F])-Math.sqrt(C[F]);g[F]=Math.round(U-D*M);}return h}};function ao(t,i,e,o,n,s,r,a,l){for(let c=i;c<i+o;c++)lo(t,e*s+c,s,n,r,a,l);for(let c=e;c<e+n;c++)lo(t,c*s+i,1,o,r,a,l);}function lo(t,i,e,o,n,s,r){s[0]=0,r[0]=-1e20,r[1]=1e20,n[0]=t[i];for(let a=1,l=0,c=0;a<o;a++){n[a]=t[i+a*e];let f=a*a;do{let u=s[l];c=(n[a]-n[u]+f-u*u)/(a-u)/2;}while(c<=r[l]&&--l>-1);l++,s[l]=a,r[l]=c,r[l+1]=1e20;}for(let a=0,l=0;a<o;a++){for(;r[l+1]<a;)l++;let c=s[l],f=a-c;t[i+a*e]=n[c]+f*f;}}var bs=32,Is=[];function Ms(t){return Math.pow(2,Math.ceil(Math.log2(t)))}function co({characterSet:t,measureText:i,buffer:e,maxCanvasWidth:o,mapping:n={},xOffset:s=0,yOffsetMin:r=0,yOffsetMax:a=0}){let c=s,f=r,u=a;for(let d of t)if(!n[d]){let{advance:p,width:g,ascent:h,descent:m}=i(d),y=h+m;c+g+e*2>o&&(c=0,f=u),n[d]={x:c+e,y:f+e,width:g,height:y,advance:p,anchorX:g/2,anchorY:h},c+=g+e*2,u=Math.max(u,f+y+e*2);}return {mapping:n,xOffset:c,yOffsetMin:f,yOffsetMax:u,canvasHeight:Ms(u)}}function fo(t,i,e,o){let n=0;for(let s=i;s<e;s++){let r=t[s];n+=o[r]?.advance||0;}return n}function uo(t,i,e,o,n,s){let r=i,a=0;for(let l=i;l<e;l++){let c=fo(t,l,l+1,n);a+c>o&&(r<l&&s.push(l),r=l,a=0),a+=c;}return a}function As(t,i,e,o,n,s){let r=i,a=i,l=i,c=0;for(let f=i;f<e;f++)if((t[f]===" "||t[f+1]===" "||f+1===e)&&(l=f+1),l>a){let u=fo(t,a,l,n);c+u>o&&(r<a&&(s.push(a),r=a,c=0),u>o&&(u=uo(t,a,l,o,n,s),r=s[s.length-1])),a=l,c+=u;}return c}function Ts(t,i,e,o,n=0,s){s===void 0&&(s=t.length);let r=[];return i==="break-all"?uo(t,n,s,e,o,r):As(t,n,s,e,o,r),r}function Es(t,i,e,o,n,s){let r=0,a=0;for(let l=i;l<e;l++){let c=t[l],f=o[c];f&&(a=Math.max(a,f.height));}for(let l=i;l<e;l++){let c=t[l],f=o[c];f?(n[l]=r+f.anchorX,r+=f.advance):(C.warn(`Missing character: ${c} (${c.codePointAt(0)})`)(),n[l]=r,r+=bs);}s[0]=r,s[1]=a;}function po(t,i,e,o,n,s){let r=Array.from(t),a=r.length,l=new Array(a),c=new Array(a),f=new Array(a),u=(o==="break-word"||o==="break-all")&&isFinite(n)&&n>0,d=[0,0],p=[0,0],g=0,h=i+e/2,m=0,y=0;for(let C=0;C<=a;C++){let v=r[C];if((v===`
|
|
1908
|
-
`||C===a)&&(y=C),y>m){let x=u?Ts(r,o,n,s,m,y):Is;for(let L=0;L<=x.length;L++){let B=L===0?m:x[L-1],D=L<x.length?x[L]:y;Es(r,B,D,s,l,p);for(let U=B;U<D;U++)c[U]=h,f[U]=p[0];g++,h+=e,d[0]=Math.max(d[0],p[0]);}m=y;}v===`
|
|
1909
|
-
`&&(l[m]=0,c[m]=0,f[m]=0,m++);}return d[1]=g*e,{x:l,y:c,rowWidth:f,size:d}}function go({value:t,length:i,stride:e,offset:o,startIndices:n,characterSet:s}){let r=t.BYTES_PER_ELEMENT,a=e?e/r:1,l=o?o/r:0,c=n[i]||Math.ceil((t.length-l)/a),f=s&&new Set,u=new Array(i),d=t;if(a>1||l>0){let p=t.constructor;d=new p(c);for(let g=0;g<c;g++)d[g]=t[g*a+l];}for(let p=0;p<i;p++){let g=n[p],h=n[p+1]||c,m=d.subarray(g,h);u[p]=String.fromCodePoint.apply(null,m),f&&m.forEach(f.add,f);}if(f)for(let p of f)s.add(String.fromCodePoint(p));return {texts:u,characterCount:c}}var be=class{constructor(i=5){this._cache={},this._order=[],this.limit=i;}get(i){let e=this._cache[i];return e&&(this._deleteOrder(i),this._appendOrder(i)),e}set(i,e){this._cache[i]?(this.delete(i),this._cache[i]=e,this._appendOrder(i)):(Object.keys(this._cache).length===this.limit&&this.delete(this._order[0]),this._cache[i]=e,this._appendOrder(i));}delete(i){this._cache[i]&&(delete this._cache[i],this._deleteOrder(i));}_deleteOrder(i){let e=this._order.indexOf(i);e>=0&&this._order.splice(e,1);}_appendOrder(i){this._order.push(i);}};function zs(){let t=[];for(let i=32;i<128;i++)t.push(String.fromCharCode(i));return t}var q={fontFamily:"Monaco, monospace",fontWeight:"normal",characterSet:zs(),fontSize:64,buffer:4,sdf:false,cutoff:.25,radius:12,smoothing:.1},ho=1024,xo=.9,mo=.3,yo=3,tt=new be(yo);function Os(t,i){let e;typeof i=="string"?e=new Set(Array.from(i)):e=new Set(i);let o=tt.get(t);if(!o)return e;for(let n in o.mapping)e.has(n)&&e.delete(n);return e}function Rs(t,i){for(let e=0;e<t.length;e++)i.data[4*e+3]=t[e];}function vo(t,i,e,o){t.font=`${o} ${e}px ${i}`,t.fillStyle="#000",t.textBaseline="alphabetic",t.textAlign="left";}function ks(t,i,e){if(e===void 0){let n=t.measureText("A");return n.fontBoundingBoxAscent?{advance:0,width:0,ascent:Math.ceil(n.fontBoundingBoxAscent),descent:Math.ceil(n.fontBoundingBoxDescent)}:{advance:0,width:0,ascent:i*xo,descent:i*mo}}let o=t.measureText(e);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:i*xo,descent:i*mo}}function Po(t){C.assert(Number.isFinite(t)&&t>=yo,"Invalid cache limit"),tt=new be(t);}var it=class{constructor(){this.props=r$1({},q);}get atlas(){return this._atlas}get mapping(){return this._atlas&&this._atlas.mapping}setProps(i={}){Object.assign(this.props,i),i._getFontRenderer&&(this._getFontRenderer=i._getFontRenderer),this._key=this._getKey();let e=Os(this._key,this.props.characterSet),o=tt.get(this._key);if(o&&e.size===0){this._atlas!==o&&(this._atlas=o);return}let n=this._generateFontAtlas(e,o);this._atlas=n,tt.set(this._key,n);}_generateFontAtlas(i,e){let{fontFamily:o,fontWeight:n,fontSize:s,buffer:r,sdf:a,radius:l,cutoff:c}=this.props,f=e&&e.data;f||(f=document.createElement("canvas"),f.width=ho);let u=f.getContext("2d",{willReadFrequently:true});vo(u,o,s,n);let d=x=>ks(u,s,x),p;this._getFontRenderer?p=this._getFontRenderer(this.props):a&&(p={measure:d,draw:Fs(this.props)});let{mapping:g,canvasHeight:h,xOffset:m,yOffsetMin:y,yOffsetMax:C}=co(r$1({measureText:x=>p?p.measure(x):d(x),buffer:r,characterSet:i,maxCanvasWidth:ho},e&&{mapping:e.mapping,xOffset:e.xOffset,yOffsetMin:e.yOffsetMin,yOffsetMax:e.yOffsetMax}));if(f.height!==h){let x=f.height>0?u.getImageData(0,0,f.width,f.height):null;f.height=h,x&&u.putImageData(x,0,0);}if(vo(u,o,s,n),p)for(let x of i){let L=g[x],B=L.width,{data:D,left:U=0,top:F=0}=p.draw(x),M=L.x-U,j=L.y-F,N=Math.max(0,Math.round(M)),W=Math.max(0,Math.round(j)),$=Math.min(D.width,f.width-N),Q=Math.min(D.height,f.height-W);u.putImageData(D,N,W,0,0,$,Q),L.x=N,L.y=W,L.width=$,L.height=Q,L.anchorX+=$/2-U-B/2,L.anchorY+=F;}else for(let x of i){let L=g[x];u.fillText(x,L.x,L.y+L.anchorY);}let v=p?p.measure():d();return {baselineOffset:(v.ascent-v.descent)/2,xOffset:m,yOffsetMin:y,yOffsetMax:C,mapping:g,data:f,width:f.width,height:f.height}}_getKey(){let{fontFamily:i,fontWeight:e,fontSize:o,buffer:n,sdf:s,radius:r,cutoff:a}=this.props;return s?`${i} ${e} ${o} ${n} ${r} ${a}`:`${i} ${e} ${o} ${n}`}};function Fs({fontSize:t,buffer:i,radius:e,cutoff:o,fontFamily:n,fontWeight:s}){let r=new et({fontSize:t,buffer:i,radius:e,cutoff:o,fontFamily:n,fontWeight:`${s}`});return a=>{let{data:l,width:c,height:f}=r.draw(a),u=new ImageData(c,f);return Rs(l,u),{data:u,left:i,top:i}}}var _o=`layout(std140) uniform textBackgroundUniforms {
|
|
1910
|
-
bool billboard;
|
|
1911
|
-
float sizeScale;
|
|
1912
|
-
float sizeMinPixels;
|
|
1913
|
-
float sizeMaxPixels;
|
|
1914
|
-
vec4 borderRadius;
|
|
1915
|
-
vec4 padding;
|
|
1916
|
-
highp int sizeUnits;
|
|
1917
|
-
bool stroked;
|
|
1918
|
-
} textBackground;
|
|
1919
|
-
`,Co={name:"textBackground",vs:_o,fs:_o,uniformTypes:{billboard:"f32",sizeScale:"f32",sizeMinPixels:"f32",sizeMaxPixels:"f32",borderRadius:"vec4<f32>",padding:"vec4<f32>",sizeUnits:"i32",stroked:"f32"}};var Lo=`#version 300 es
|
|
1920
|
-
#define SHADER_NAME text-background-layer-vertex-shader
|
|
1921
|
-
in vec2 positions;
|
|
1922
|
-
in vec3 instancePositions;
|
|
1923
|
-
in vec3 instancePositions64Low;
|
|
1924
|
-
in vec4 instanceRects;
|
|
1925
|
-
in vec4 instanceClipRect;
|
|
1926
|
-
in float instanceSizes;
|
|
1927
|
-
in float instanceAngles;
|
|
1928
|
-
in vec2 instancePixelOffsets;
|
|
1929
|
-
in float instanceLineWidths;
|
|
1930
|
-
in vec4 instanceFillColors;
|
|
1931
|
-
in vec4 instanceLineColors;
|
|
1932
|
-
in vec3 instancePickingColors;
|
|
1933
|
-
out vec4 vFillColor;
|
|
1934
|
-
out vec4 vLineColor;
|
|
1935
|
-
out float vLineWidth;
|
|
1936
|
-
out vec2 uv;
|
|
1937
|
-
out vec2 dimensions;
|
|
1938
|
-
vec2 rotate_by_angle(vec2 vertex, float angle) {
|
|
1939
|
-
float angle_radian = radians(angle);
|
|
1940
|
-
float cos_angle = cos(angle_radian);
|
|
1941
|
-
float sin_angle = sin(angle_radian);
|
|
1942
|
-
mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle);
|
|
1943
|
-
return rotationMatrix * vertex;
|
|
1944
|
-
}
|
|
1945
|
-
void main(void) {
|
|
1946
|
-
geometry.worldPosition = instancePositions;
|
|
1947
|
-
geometry.uv = positions;
|
|
1948
|
-
geometry.pickingColor = instancePickingColors;
|
|
1949
|
-
uv = positions;
|
|
1950
|
-
vLineWidth = instanceLineWidths;
|
|
1951
|
-
float sizePixels = clamp(
|
|
1952
|
-
project_size_to_pixel(instanceSizes * textBackground.sizeScale, textBackground.sizeUnits),
|
|
1953
|
-
textBackground.sizeMinPixels, textBackground.sizeMaxPixels
|
|
1954
|
-
);
|
|
1955
|
-
float instanceScale = sizePixels / text.fontSize;
|
|
1956
|
-
dimensions = instanceRects.zw * instanceScale + textBackground.padding.xy + textBackground.padding.zw;
|
|
1957
|
-
vec2 pixelOffset = (positions * instanceRects.zw + instanceRects.xy) * instanceScale + mix(-textBackground.padding.xy, textBackground.padding.zw, positions);
|
|
1958
|
-
pixelOffset = rotate_by_angle(pixelOffset, instanceAngles);
|
|
1959
|
-
pixelOffset += instancePixelOffsets;
|
|
1960
|
-
pixelOffset.y *= -1.0;
|
|
1961
|
-
vec2 xy = project_size_to_pixel(instanceClipRect.xy);
|
|
1962
|
-
vec2 wh = project_size_to_pixel(instanceClipRect.zw);
|
|
1963
|
-
if (text.flipY) {
|
|
1964
|
-
xy.y = -xy.y - wh.y;
|
|
1965
|
-
}
|
|
1966
|
-
if (instanceClipRect.z >= 0.0) {
|
|
1967
|
-
dimensions.x = wh.x;
|
|
1968
|
-
pixelOffset.x = xy.x + uv.x * wh.x + mix(-textBackground.padding.x, textBackground.padding.z, uv.x);
|
|
1969
|
-
}
|
|
1970
|
-
if (instanceClipRect.w >= 0.0) {
|
|
1971
|
-
dimensions.y = wh.y;
|
|
1972
|
-
pixelOffset.y = xy.y + uv.y * wh.y + mix(-textBackground.padding.y, textBackground.padding.w, uv.y);
|
|
1973
|
-
}
|
|
1974
|
-
if (textBackground.billboard) {
|
|
1975
|
-
gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);
|
|
1976
|
-
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
|
|
1977
|
-
vec3 offset = vec3(pixelOffset, 0.0);
|
|
1978
|
-
DECKGL_FILTER_SIZE(offset, geometry);
|
|
1979
|
-
gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);
|
|
1980
|
-
} else {
|
|
1981
|
-
vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0);
|
|
1982
|
-
if (text.flipY) {
|
|
1983
|
-
offset_common.y *= -1.;
|
|
1984
|
-
}
|
|
1985
|
-
DECKGL_FILTER_SIZE(offset_common, geometry);
|
|
1986
|
-
gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position);
|
|
1987
|
-
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
|
|
1988
|
-
}
|
|
1989
|
-
vFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * layer.opacity);
|
|
1990
|
-
DECKGL_FILTER_COLOR(vFillColor, geometry);
|
|
1991
|
-
vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * layer.opacity);
|
|
1992
|
-
DECKGL_FILTER_COLOR(vLineColor, geometry);
|
|
1993
|
-
}
|
|
1994
|
-
`;var So=`#version 300 es
|
|
1995
|
-
#define SHADER_NAME text-background-layer-fragment-shader
|
|
1996
|
-
precision highp float;
|
|
1997
|
-
in vec4 vFillColor;
|
|
1998
|
-
in vec4 vLineColor;
|
|
1999
|
-
in float vLineWidth;
|
|
2000
|
-
in vec2 uv;
|
|
2001
|
-
in vec2 dimensions;
|
|
2002
|
-
out vec4 fragColor;
|
|
2003
|
-
float round_rect(vec2 p, vec2 size, vec4 radii) {
|
|
2004
|
-
vec2 pixelPositionCB = (p - 0.5) * size;
|
|
2005
|
-
vec2 sizeCB = size * 0.5;
|
|
2006
|
-
float maxBorderRadius = min(size.x, size.y) * 0.5;
|
|
2007
|
-
vec4 borderRadius = vec4(min(radii, maxBorderRadius));
|
|
2008
|
-
borderRadius.xy =
|
|
2009
|
-
(pixelPositionCB.x > 0.0) ? borderRadius.xy : borderRadius.zw;
|
|
2010
|
-
borderRadius.x = (pixelPositionCB.y > 0.0) ? borderRadius.x : borderRadius.y;
|
|
2011
|
-
vec2 q = abs(pixelPositionCB) - sizeCB + borderRadius.x;
|
|
2012
|
-
return -(min(max(q.x, q.y), 0.0) + length(max(q, 0.0)) - borderRadius.x);
|
|
2013
|
-
}
|
|
2014
|
-
float rect(vec2 p, vec2 size) {
|
|
2015
|
-
vec2 pixelPosition = p * size;
|
|
2016
|
-
return min(min(pixelPosition.x, size.x - pixelPosition.x),
|
|
2017
|
-
min(pixelPosition.y, size.y - pixelPosition.y));
|
|
2018
|
-
}
|
|
2019
|
-
vec4 get_stroked_fragColor(float dist) {
|
|
2020
|
-
float isBorder = smoothedge(dist, vLineWidth);
|
|
2021
|
-
return mix(vFillColor, vLineColor, isBorder);
|
|
2022
|
-
}
|
|
2023
|
-
void main(void) {
|
|
2024
|
-
geometry.uv = uv;
|
|
2025
|
-
if (textBackground.borderRadius != vec4(0.0)) {
|
|
2026
|
-
float distToEdge = round_rect(uv, dimensions, textBackground.borderRadius);
|
|
2027
|
-
float shapeAlpha = smoothedge(-distToEdge, 0.0);
|
|
2028
|
-
if (shapeAlpha == 0.0) {
|
|
2029
|
-
discard;
|
|
2030
|
-
}
|
|
2031
|
-
if (textBackground.stroked) {
|
|
2032
|
-
fragColor = get_stroked_fragColor(distToEdge);
|
|
2033
|
-
} else {
|
|
2034
|
-
fragColor = vFillColor;
|
|
2035
|
-
}
|
|
2036
|
-
fragColor.a *= shapeAlpha;
|
|
2037
|
-
} else {
|
|
2038
|
-
if (textBackground.stroked) {
|
|
2039
|
-
float distToEdge = rect(uv, dimensions);
|
|
2040
|
-
fragColor = get_stroked_fragColor(distToEdge);
|
|
2041
|
-
} else {
|
|
2042
|
-
fragColor = vFillColor;
|
|
2043
|
-
}
|
|
2044
|
-
}
|
|
2045
|
-
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
2046
|
-
}
|
|
2047
|
-
`;var Ds={billboard:true,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}},Bs=(()=>{class t extends mc{getShaders(){return super.getShaders({vs:Lo,fs:So,modules:[Jh,nu,Co,Qe]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:true,accessor:"getPosition"},instanceSizes:{size:1,transition:true,accessor:"getSize",defaultValue:1},instanceAngles:{size:1,transition:true,accessor:"getAngle"},instanceRects:{size:4,accessor:"getBoundingRect"},instanceClipRect:{size:4,accessor:"getClipRect",defaultValue:[0,0,-1,-1]},instancePixelOffsets:{size:2,transition:true,accessor:"getPixelOffset"},instanceFillColors:{size:4,transition:true,type:"unorm8",accessor:"getFillColor",defaultValue:[0,0,0,255]},instanceLineColors:{size:4,transition:true,type:"unorm8",accessor:"getLineColor",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:true,accessor:"getLineWidth",defaultValue:1}});}updateState(e){super.updateState(e);let{changeFlags:o}=e;o.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll());}draw({uniforms:e}){let{billboard:o,sizeScale:n,sizeUnits:s,sizeMinPixels:r,sizeMaxPixels:a,getLineWidth:l,fontSize:c}=this.props,{padding:f,borderRadius:u}=this.props;f.length<4&&(f=[f[0],f[1],f[0],f[1]]),Array.isArray(u)||(u=[u,u,u,u]);let d=this.state.model,p={billboard:o,stroked:!!l,borderRadius:u,padding:f,sizeUnits:yt$1[s],sizeScale:n,sizeMinPixels:r,sizeMaxPixels:a},g={fontSize:c,viewport:this.context.viewport};d.shaderInputs.setProps({textBackground:p,text:g}),d.draw(this.context.renderPass);}_getModel(){let e=[0,0,1,0,0,1,1,1];return new Kt$1(this.context.device,s$1(r$1({},this.getShaders()),{id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Zr({topology:"triangle-strip",vertexCount:4,attributes:{positions:{size:2,value:new Float32Array(e)}}}),isInstanced:true}))}}return t.defaultProps=Ds,t.layerName="TextBackgroundLayer",t})(),Lt=Bs;var wo={start:1,middle:0,end:-1},bo={top:1,center:0,bottom:-1},St=[0,0,0,255],Gs=1,Us={billboard:true,sizeScale:1,sizeUnits:"pixels",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,background:false,getBackgroundColor:{type:"accessor",value:[255,255,255,255]},getBorderColor:{type:"accessor",value:St},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:Gs,outlineWidth:{type:"number",value:0,min:0},outlineColor:{type:"color",value:St},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:St},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"]}},Ns=(()=>{class t extends Dv{constructor(){super(...arguments),this.getBoundingRect=(e,o)=>{let{size:[n,s]}=this.transformParagraph(e,o),{getTextAnchor:r,getAlignmentBaseline:a}=this.props,l=wo[typeof r=="function"?r(e,o):r],c=bo[typeof a=="function"?a(e,o):a];return [(l-1)*n/2,(c-1)*s/2,n,s]},this.getIconOffsets=(e,o)=>{let{getTextAnchor:n,getAlignmentBaseline:s}=this.props,{x:r,y:a,rowWidth:l,size:[,c]}=this.transformParagraph(e,o),f=wo[typeof n=="function"?n(e,o):n],u=bo[typeof s=="function"?s(e,o):s],d=r.length,p=new Array(d*2),g=0;for(let h=0;h<d;h++)p[g++]=(f-1)*l[h]/2+r[h],p[g++]=(u-1)*c/2+a[h];return p};}initializeState(){this.state={styleVersion:0,fontAtlasManager:new it},this.props.maxWidth>0&&C.once(1,"v8.9 breaking change: TextLayer maxWidth is now relative to text size")();}updateState(e){let{props:o,oldProps:n,changeFlags:s}=e;(s.dataChanged||s.updateTriggersChanged&&(s.updateTriggersChanged.all||s.updateTriggersChanged.getText))&&this._updateText(),(this._updateFontAtlas()||o.lineHeight!==n.lineHeight||o.wordBreak!==n.wordBreak||o.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:o,fontWeight:n,_getFontRenderer:s}=this.props,{fontAtlasManager:r,characterSet:a}=this.state,l=s$1(r$1({},e),{characterSet:a,fontFamily:o,fontWeight:n,_getFontRenderer:s});if(!r.mapping)return r.setProps(l),true;for(let c in l)if(l[c]!==r.props[c])return r.setProps(l),true;return false}_updateText(){let{data:e,characterSet:o}=this.props,n=e.attributes?.getText,{getText:s}=this.props,r=e.startIndices,a,l=o==="auto"&&new Set;if(n&&r){let{texts:c,characterCount:f}=go(s$1(r$1({},ArrayBuffer.isView(n)?{value:n}:n),{length:e.length,startIndices:r,characterSet:l}));a=f,s=(u,{index:d})=>c[d];}else {let{iterable:c,objectInfo:f}=fi$1(e);r=[0],a=0;for(let u of c){f.index++;let d=Array.from(s(u,f)||"");l&&d.forEach(l.add,l),a+=d.length,r.push(a);}}this.setState({getText:s,startIndices:r,numInstances:a,characterSet:l||o});}transformParagraph(e,o){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:u}=this.props,d=l(e,o)||"";return po(d,r,f*a,c,u*a,s)}renderLayers(){let{startIndices:e,numInstances:o,getText:n,fontAtlasManager:{atlas:s,mapping:r},styleVersion:a}=this.state,{data:l,_dataDiff:c,getPosition:f,getColor:u,getSize:d,getAngle:p,getPixelOffset:g,getBackgroundColor:h,getBorderColor:m,getBorderWidth:y,getContentBox:C,backgroundBorderRadius:v,backgroundPadding:x,background:L,billboard:B,fontSettings:D,outlineWidth:U,outlineColor:F,sizeScale:M,sizeUnits:j,sizeMinPixels:N,sizeMaxPixels:W,contentCutoffPixels:$,contentAlignHorizontal:Q,contentAlignVertical:Ae,transitions:k,updateTriggers:I}=this.props,zo=this.getSubLayerClass("characters",_t),Oo=this.getSubLayerClass("background",Lt),{fontSize:It}=this.state.fontAtlasManager.props;return [L&&new Oo({getFillColor:h,getLineColor:m,getLineWidth:y,borderRadius:v,padding:x,getPosition:f,getSize:d,getAngle:p,getPixelOffset:g,getClipRect:C,billboard:B,sizeScale:M,sizeUnits:j,sizeMinPixels:N,sizeMaxPixels:W,fontSize:It,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:false,getBoundingRect:this.getBoundingRect}),new zo({sdf:D.sdf,smoothing:Number.isFinite(D.smoothing)?D.smoothing:q.smoothing,outlineWidth:U/(D.radius||q.radius),outlineColor:F,iconAtlas:s,iconMapping:r,getPosition:f,getColor:u,getSize:d,getAngle:p,getPixelOffset:g,getContentBox:C,billboard:B,sizeScale:M,sizeUnits:j,sizeMinPixels:N,sizeMaxPixels:W,fontSize:It,contentCutoffPixels:$,contentAlignHorizontal:Q,contentAlignVertical:Ae,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:o,getIconOffsets:this.getIconOffsets,getIcon:n})]}static set fontAtlasCacheLimit(e){Po(e);}}return t.defaultProps=Us,t.layerName="TextLayer",t})(),wt=Ns;var Ie={circle:{type:lt,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:le,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"}}},Me={type:ye,props:{lineWidthUnits:"widthUnits",lineWidthScale:"widthScale",lineWidthMinPixels:"widthMinPixels",lineWidthMaxPixels:"widthMaxPixels",lineJointRounded:"jointRounded",lineCapRounded:"capRounded",lineMiterLimit:"miterLimit",lineBillboard:"billboard",getLineColor:"getColor",getLineWidth:"getWidth"}},ot={type:Se,props:{extruded:"extruded",filled:"filled",wireframe:"wireframe",elevationScale:"elevationScale",material:"material",_full3d:"_full3d",getElevation:"getElevation",getFillColor:"getFillColor",getLineColor:"getLineColor"}};function re({type:t,props:i}){let e={};for(let o in i)e[o]=t.defaultProps[i[o]];return e}function nt(t,i){let{transitions:e,updateTriggers:o}=t.props,n={updateTriggers:{},transitions:e&&{getPosition:e.geometry}};for(let s in i){let r=i[s],a=t.props[s];s.startsWith("get")&&(a=t.getSubLayerAccessor(a),n.updateTriggers[r]=o[s],e&&(n.transitions[r]=e[s])),n[r]=a;}return n}function Mo(t){if(Array.isArray(t))return t;switch(C.assert(t.type,"GeoJSON does not have type"),t.type){case "Feature":return [t];case "FeatureCollection":return C.assert(Array.isArray(t.features),"GeoJSON does not have features array"),t.features;default:return [{geometry:t}]}}function bt(t,i,e={}){let o={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"){C.assert(Array.isArray(l.geometries),"GeoJSON does not have geometries array");let{geometries:c}=l;for(let f=0;f<c.length;f++){let u=c[f];Io(u,o,i,a,r);}}else Io(l,o,i,a,r);}return o}function Io(t,i,e,o,n){let{type:s,coordinates:r}=t,{pointFeatures:a,lineFeatures:l,polygonFeatures:c,polygonOutlineFeatures:f}=i;if(!js(s,r)){C.warn(`${s} coordinates are malformed`)();return}switch(s){case "Point":a.push(e({geometry:t},o,n));break;case "MultiPoint":r.forEach(u=>{a.push(e({geometry:{type:"Point",coordinates:u}},o,n));});break;case "LineString":l.push(e({geometry:t},o,n));break;case "MultiLineString":r.forEach(u=>{l.push(e({geometry:{type:"LineString",coordinates:u}},o,n));});break;case "Polygon":c.push(e({geometry:t},o,n)),r.forEach(u=>{f.push(e({geometry:{type:"LineString",coordinates:u}},o,n));});break;case "MultiPolygon":r.forEach(u=>{c.push(e({geometry:{type:"Polygon",coordinates:u}},o,n)),u.forEach(d=>{f.push(e({geometry:{type:"LineString",coordinates:d}},o,n));});});break;}}var Ws={Point:1,MultiPoint:2,LineString:2,MultiLineString:3,Polygon:3,MultiPolygon:4};function js(t,i){let e=Ws[t];for(C.assert(e,`Unknown GeoJSON type ${t}`);i&&--e>0;)i=i[0];return i&&Number.isFinite(i[0])}function Ao(){return {points:{},lines:{},polygons:{},polygonsOutline:{}}}function st(t){return t.geometry.coordinates}function To(t,i){let e=Ao(),{pointFeatures:o,lineFeatures:n,polygonFeatures:s,polygonOutlineFeatures:r}=t;return e.points.data=o,e.points._dataDiff=i.pointFeatures&&(()=>i.pointFeatures),e.points.getPosition=st,e.lines.data=n,e.lines._dataDiff=i.lineFeatures&&(()=>i.lineFeatures),e.lines.getPath=st,e.polygons.data=s,e.polygons._dataDiff=i.polygonFeatures&&(()=>i.polygonFeatures),e.polygons.getPolygon=st,e.polygonsOutline.data=r,e.polygonsOutline._dataDiff=i.polygonOutlineFeatures&&(()=>i.polygonOutlineFeatures),e.polygonsOutline.getPath=st,e}function Eo(t,i){let e=Ao(),{points:o,lines:n,polygons:s}=t,r=io(t,i);e.points.data={length:o.positions.value.length/o.positions.size,attributes:s$1(r$1({},o.attributes),{getPosition:o.positions,instancePickingColors:{size:4,value:r.points}}),properties:o.properties,numericProps:o.numericProps,featureIds:o.featureIds},e.lines.data={length:n.pathIndices.value.length-1,startIndices:n.pathIndices.value,attributes:s$1(r$1({},n.attributes),{getPath:n.positions,instancePickingColors:{size:4,value:r.lines}}),properties:n.properties,numericProps:n.numericProps,featureIds:n.featureIds},e.lines._pathType="open";let a=s.positions.value.length/s.positions.size,l=Array(a).fill(1);for(let c of s.primitivePolygonIndices.value)l[c-1]=0;return e.polygons.data={length:s.polygonIndices.value.length-1,startIndices:s.polygonIndices.value,attributes:s$1(r$1({},s.attributes),{getPolygon:s.positions,instanceVertexValid:{size:1,value:new Uint16Array(l)},pickingColors:{size:4,value:r.polygons}}),properties:s.properties,numericProps:s.numericProps,featureIds:s.featureIds},e.polygons._normalize=false,s.triangles&&(e.polygons.data.attributes.indices=s.triangles.value),e.polygonsOutline.data={length:s.primitivePolygonIndices.value.length-1,startIndices:s.primitivePolygonIndices.value,attributes:s$1(r$1({},s.attributes),{getPath:s.positions,instancePickingColors:{size:4,value:r.polygons}}),properties:s.properties,numericProps:s.numericProps,featureIds:s.featureIds},e.polygonsOutline._pathType="open",e}var Vs=["points","linestrings","polygons"],Zs=s$1(r$1(r$1(r$1(r$1(r$1({},re(Ie.circle)),re(Ie.icon)),re(Ie.text)),re(Me)),re(ot)),{stroked:true,filled:true,extruded:false,wireframe:false,_full3d:false,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"}}),Hs=(()=>{class t extends Dv{initializeState(){this.state={layerProps:{},features:{},featuresDiff:{}};}updateState({props:e,changeFlags:o}){if(!o.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:o}):this._updateStateJSON({props:e,changeFlags:o});}_updateStateBinary({props:e,changeFlags:o}){let n=Eo(e.data,this.encodePickingColor);this.setState({layerProps:n});}_updateStateJSON({props:e,changeFlags:o}){let n=Mo(e.data),s=this.getSubLayerRow.bind(this),r={},a={};if(Array.isArray(o.dataChanged)){let c=this.state.features;for(let f in c)r[f]=c[f].slice(),a[f]=[];for(let f of o.dataChanged){let u=bt(n,s,f);for(let d in c)a[d].push(qe({data:r[d],getIndex:p=>p.__source.index,dataRange:f,replace:u[d]}));}}else r=bt(n,s);let l=To(r,a);this.setState({features:r,featuresDiff:a,layerProps:l});}getPickingInfo(e){let o=super.getPickingInfo(e),{index:n,sourceLayer:s}=o;return o.featureType=Vs.find(r=>s.id.startsWith(`${this.id}-${r}-`)),n>=0&&s.id.startsWith(`${this.id}-points-text`)&&this.state.binary&&(o.index=this.props.data.points.globalFeatureIds.value[n]),o}_updateAutoHighlight(e){let o=`${this.id}-points-`,n=e.featureType==="points";for(let s of this.getSubLayers())s.id.startsWith(o)===n&&s.updateAutoHighlight(e);}_renderPolygonLayer(){let{extruded:e,wireframe:o}=this.props,{layerProps:n}=this.state,s="polygons-fill",r=this.shouldRenderSubLayer(s,n.polygons?.data)&&this.getSubLayerClass(s,ot.type);if(r){let a=nt(this,ot.props),l=e&&o;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:o}=this.props,{layerProps:n}=this.state,s="polygons-stroke",r="linestrings",a=!e&&o&&this.shouldRenderSubLayer(s,n.polygonsOutline?.data)&&this.getSubLayerClass(s,Me.type),l=this.shouldRenderSubLayer(r,n.lines?.data)&&this.getSubLayerClass(r,Me.type);if(a||l){let c=nt(this,Me.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:o,binary:n}=this.state,{highlightedObjectIndex:s}=this.props;!n&&Number.isFinite(s)&&(s=o.points.data.findIndex(c=>c.__source.index===s));let r=new Set(e.split("+")),a=[];for(let c of r){let f=`points-${c}`,u$1=Ie[c],d=u$1&&this.shouldRenderSubLayer(f,o.points?.data)&&this.getSubLayerClass(f,u$1.type);if(d){let p=nt(this,u$1.props),g=o.points;if(c==="text"&&n){let l=g.data.attributes,{instancePickingColors:h}=l,m=u(l,["instancePickingColors"]);g=s$1(r$1({},g),{data:s$1(r$1({},g.data),{attributes:m})});}a.push(new d(p,this.getSubLayerProps({id:f,updateTriggers:p.updateTriggers,highlightedObjectIndex:s}),g));}}return a}renderLayers(){let{extruded:e}=this.props,o=this._renderPolygonLayer(),n=this._renderLineLayers(),s=this._renderPointLayers();return [!e&&o,n,s,e&&o]}getSubLayerAccessor(e){let{binary:o}=this.state;return !o||typeof e!="function"?super.getSubLayerAccessor(e):(n,s)=>{let{data:r,index:a}=s,l=to(r,a);return e(l,s)}}}return t.layerName="GeoJsonLayer",t.defaultProps=Zs,t})(),Ks=Hs;var chunkPIHUIY5E=/*#__PURE__*/Object.freeze({__proto__:null,ArcLayer:Bo,BitmapLayer:Ho,ColumnLayer:dt,GeoJsonLayer:Ks,GridCellLayer:Zn,IconLayer:le,LineLayer:ln,PathLayer:ye,PointCloudLayer:dn,PolygonLayer:_s,ScatterplotLayer:lt,SolidPolygonLayer:Se,TextLayer:wt,_MultiIconLayer:_t,_TextBackgroundLayer:Lt});export{Bo as B,Ho as H,Ks as K,_s as _,dn as a,chunkPIHUIY5E as c,dt as d,fe as f,mn as m,ye as y};
|