@deck.gl/extensions 8.9.5 → 8.9.7

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.
Files changed (131) hide show
  1. package/dist/dist.dev.js +17 -17
  2. package/dist/es5/brushing/{brushing.js → brushing-extension.js} +1 -1
  3. package/dist/es5/brushing/brushing-extension.js.map +1 -0
  4. package/dist/es5/brushing/shader-module.js.map +1 -1
  5. package/dist/es5/clip/{clip.js → clip-extension.js} +1 -1
  6. package/dist/es5/clip/clip-extension.js.map +1 -0
  7. package/dist/es5/collision-filter/{collision-filter.js → collision-filter-extension.js} +1 -1
  8. package/dist/es5/collision-filter/collision-filter-extension.js.map +1 -0
  9. package/dist/es5/data-filter/{data-filter.js → data-filter-extension.js} +1 -1
  10. package/dist/es5/data-filter/data-filter-extension.js.map +1 -0
  11. package/dist/es5/data-filter/shader-module.js.map +1 -1
  12. package/dist/es5/fill-style/{fill-style.js → fill-style-extension.js} +1 -1
  13. package/dist/es5/fill-style/fill-style-extension.js.map +1 -0
  14. package/dist/es5/fp64/{fp64.js → fp64-extension.js} +1 -1
  15. package/dist/es5/fp64/fp64-extension.js.map +1 -0
  16. package/dist/es5/index.js +18 -18
  17. package/dist/es5/index.js.map +1 -1
  18. package/dist/es5/mask/{mask.js → mask-extension.js} +1 -1
  19. package/dist/es5/mask/mask-extension.js.map +1 -0
  20. package/dist/es5/path-style/{path-style.js → path-style-extension.js} +1 -1
  21. package/dist/es5/path-style/path-style-extension.js.map +1 -0
  22. package/dist/es5/terrain/{terrain.js → terrain-extension.js} +1 -1
  23. package/dist/es5/terrain/terrain-extension.js.map +1 -0
  24. package/dist/esm/brushing/{brushing.js → brushing-extension.js} +1 -1
  25. package/dist/esm/brushing/brushing-extension.js.map +1 -0
  26. package/dist/esm/brushing/shader-module.js.map +1 -1
  27. package/dist/esm/clip/{clip.js → clip-extension.js} +1 -1
  28. package/dist/esm/clip/clip-extension.js.map +1 -0
  29. package/dist/esm/collision-filter/{collision-filter.js → collision-filter-extension.js} +1 -1
  30. package/dist/esm/collision-filter/collision-filter-extension.js.map +1 -0
  31. package/dist/esm/data-filter/{data-filter.js → data-filter-extension.js} +1 -1
  32. package/dist/esm/data-filter/data-filter-extension.js.map +1 -0
  33. package/dist/esm/data-filter/shader-module.js.map +1 -1
  34. package/dist/esm/fill-style/{fill-style.js → fill-style-extension.js} +1 -1
  35. package/dist/esm/fill-style/fill-style-extension.js.map +1 -0
  36. package/dist/esm/fp64/{fp64.js → fp64-extension.js} +1 -1
  37. package/dist/esm/fp64/fp64-extension.js.map +1 -0
  38. package/dist/esm/index.js +9 -9
  39. package/dist/esm/index.js.map +1 -1
  40. package/dist/esm/mask/{mask.js → mask-extension.js} +1 -1
  41. package/dist/esm/mask/mask-extension.js.map +1 -0
  42. package/dist/esm/path-style/{path-style.js → path-style-extension.js} +1 -1
  43. package/dist/esm/path-style/path-style-extension.js.map +1 -0
  44. package/dist/esm/terrain/{terrain.js → terrain-extension.js} +1 -1
  45. package/dist/esm/terrain/terrain-extension.js.map +1 -0
  46. package/package.json +2 -2
  47. package/src/brushing/shader-module.ts +1 -1
  48. package/src/data-filter/shader-module.ts +1 -1
  49. package/src/index.ts +17 -17
  50. package/typed/brushing/brushing-extension.d.ts +39 -0
  51. package/typed/brushing/brushing-extension.d.ts.map +1 -0
  52. package/typed/brushing/brushing.js +83 -0
  53. package/typed/brushing/shader-module.d.ts +1 -1
  54. package/typed/brushing/shader-module.d.ts.map +1 -1
  55. package/typed/brushing/shader-module.js +116 -0
  56. package/typed/clip/clip-extension.d.ts +32 -0
  57. package/typed/clip/clip-extension.d.ts.map +1 -0
  58. package/typed/clip/clip.js +114 -0
  59. package/typed/collide/collide-effect.d.ts +1 -1
  60. package/typed/collide/collide-effect.d.ts.map +1 -1
  61. package/typed/collide/collide-pass.d.ts +0 -1
  62. package/typed/collide/collide-pass.d.ts.map +1 -1
  63. package/typed/collide/collide.d.ts +0 -1
  64. package/typed/collide/collide.d.ts.map +1 -1
  65. package/typed/collide/shader-module.d.ts.map +1 -1
  66. package/typed/collision-filter/collision-filter-extension.d.ts +41 -0
  67. package/typed/collision-filter/collision-filter-extension.d.ts.map +1 -0
  68. package/typed/data-filter/aggregator.js +98 -0
  69. package/typed/data-filter/data-filter-extension.d.ts +90 -0
  70. package/typed/data-filter/data-filter-extension.d.ts.map +1 -0
  71. package/typed/data-filter/data-filter.js +159 -0
  72. package/typed/data-filter/shader-module.d.ts +1 -1
  73. package/typed/data-filter/shader-module.d.ts.map +1 -1
  74. package/typed/data-filter/shader-module.js +152 -0
  75. package/typed/fill-style/fill-style-extension.d.ts +86 -0
  76. package/typed/fill-style/fill-style-extension.d.ts.map +1 -0
  77. package/typed/fill-style/fill-style.js +152 -0
  78. package/typed/fill-style/shaders.glsl.js +95 -0
  79. package/typed/fp64/fp64-extension.d.ts +8 -0
  80. package/typed/fp64/fp64-extension.d.ts.map +1 -0
  81. package/typed/fp64/fp64.js +34 -0
  82. package/typed/fp64/project64.glsl.js +100 -0
  83. package/typed/fp64/project64.js +50 -0
  84. package/typed/index.d.ts +17 -17
  85. package/typed/index.d.ts.map +1 -1
  86. package/typed/index.js +9 -0
  87. package/typed/mask/mask-extension.d.ts +30 -0
  88. package/typed/mask/mask-extension.d.ts.map +1 -0
  89. package/typed/mask/mask.js +48 -0
  90. package/typed/mask/shader-module.js +73 -0
  91. package/typed/path-style/path-style-extension.d.ts +66 -0
  92. package/typed/path-style/path-style-extension.d.ts.map +1 -0
  93. package/typed/path-style/path-style.js +107 -0
  94. package/typed/path-style/shaders.glsl.js +93 -0
  95. package/typed/terrain/height-map.d.ts +27 -0
  96. package/typed/terrain/height-map.d.ts.map +1 -0
  97. package/typed/terrain/shader-module-offset.d.ts +4 -0
  98. package/typed/terrain/shader-module-offset.d.ts.map +1 -0
  99. package/typed/terrain/shader-module-source.d.ts +4 -0
  100. package/typed/terrain/shader-module-source.d.ts.map +1 -0
  101. package/typed/terrain/terrain-extension.d.ts +21 -0
  102. package/typed/terrain/terrain-extension.d.ts.map +1 -0
  103. package/dist/es5/brushing/brushing.js.map +0 -1
  104. package/dist/es5/clip/clip.js.map +0 -1
  105. package/dist/es5/collision-filter/collision-filter.js.map +0 -1
  106. package/dist/es5/data-filter/data-filter.js.map +0 -1
  107. package/dist/es5/fill-style/fill-style.js.map +0 -1
  108. package/dist/es5/fp64/fp64.js.map +0 -1
  109. package/dist/es5/mask/mask.js.map +0 -1
  110. package/dist/es5/path-style/path-style.js.map +0 -1
  111. package/dist/es5/terrain/terrain.js.map +0 -1
  112. package/dist/esm/brushing/brushing.js.map +0 -1
  113. package/dist/esm/clip/clip.js.map +0 -1
  114. package/dist/esm/collision-filter/collision-filter.js.map +0 -1
  115. package/dist/esm/data-filter/data-filter.js.map +0 -1
  116. package/dist/esm/fill-style/fill-style.js.map +0 -1
  117. package/dist/esm/fp64/fp64.js.map +0 -1
  118. package/dist/esm/mask/mask.js.map +0 -1
  119. package/dist/esm/path-style/path-style.js.map +0 -1
  120. package/dist/esm/terrain/terrain.js.map +0 -1
  121. package/typed/effect-order.d.ts +0 -6
  122. package/typed/effect-order.d.ts.map +0 -1
  123. /package/src/brushing/{brushing.ts → brushing-extension.ts} +0 -0
  124. /package/src/clip/{clip.ts → clip-extension.ts} +0 -0
  125. /package/src/collision-filter/{collision-filter.ts → collision-filter-extension.ts} +0 -0
  126. /package/src/data-filter/{data-filter.ts → data-filter-extension.ts} +0 -0
  127. /package/src/fill-style/{fill-style.ts → fill-style-extension.ts} +0 -0
  128. /package/src/fp64/{fp64.ts → fp64-extension.ts} +0 -0
  129. /package/src/mask/{mask.ts → mask-extension.ts} +0 -0
  130. /package/src/path-style/{path-style.ts → path-style-extension.ts} +0 -0
  131. /package/src/terrain/{terrain.ts → terrain-extension.ts} +0 -0
@@ -0,0 +1,93 @@
1
+ export const dashShaders = {
2
+ inject: {
3
+ 'vs:#decl': `
4
+ attribute vec2 instanceDashArrays;
5
+ attribute float instanceDashOffsets;
6
+ varying vec2 vDashArray;
7
+ varying float vDashOffset;
8
+ `,
9
+ 'vs:#main-end': `
10
+ vDashArray = instanceDashArrays;
11
+ vDashOffset = instanceDashOffsets / width.x;
12
+ `,
13
+ 'fs:#decl': `
14
+ uniform float dashAlignMode;
15
+ uniform float capType;
16
+ uniform bool dashGapPickable;
17
+ varying vec2 vDashArray;
18
+ varying float vDashOffset;
19
+
20
+ float round(float x) {
21
+ return floor(x + 0.5);
22
+ }
23
+ `,
24
+ // if given position is in the gap part of the dashed line
25
+ // dashArray.x: solid stroke length, relative to width
26
+ // dashArray.y: gap length, relative to width
27
+ // alignMode:
28
+ // 0 - no adjustment
29
+ // o---- ---- ---- ---- o---- -o---- ---- o
30
+ // 1 - stretch to fit, draw half dash at each end for nicer joints
31
+ // o-- ---- ---- ---- --o-- --o-- ---- --o
32
+ 'fs:#main-start': `
33
+ float solidLength = vDashArray.x;
34
+ float gapLength = vDashArray.y;
35
+ float unitLength = solidLength + gapLength;
36
+
37
+ float offset;
38
+
39
+ if (unitLength > 0.0) {
40
+ if (dashAlignMode == 0.0) {
41
+ offset = vDashOffset;
42
+ } else {
43
+ unitLength = vPathLength / round(vPathLength / unitLength);
44
+ offset = solidLength / 2.0;
45
+ }
46
+
47
+ float unitOffset = mod(clamp(vPathPosition.y, 0.0, vPathLength) + offset, unitLength);
48
+
49
+ if (gapLength > 0.0 && unitOffset > solidLength) {
50
+ if (capType <= 0.5) {
51
+ if (!(dashGapPickable && picking_uActive)) {
52
+ discard;
53
+ }
54
+ } else {
55
+ // caps are rounded, test the distance to solid ends
56
+ float distToEnd = length(vec2(
57
+ min(unitOffset - solidLength, unitLength - unitOffset),
58
+ vPathPosition.x
59
+ ));
60
+ if (distToEnd > 1.0) {
61
+ if (!(dashGapPickable && picking_uActive)) {
62
+ discard;
63
+ }
64
+ }
65
+ }
66
+ }
67
+ }
68
+ `
69
+ }
70
+ };
71
+ export const offsetShaders = {
72
+ inject: {
73
+ 'vs:#decl': `
74
+ attribute float instanceOffsets;
75
+ `,
76
+ 'vs:DECKGL_FILTER_SIZE': `
77
+ float offsetWidth = abs(instanceOffsets * 2.0) + 1.0;
78
+ size *= offsetWidth;
79
+ `,
80
+ 'vCornerOffset = offsetVec;': `
81
+ float offsetWidth = abs(instanceOffsets * 2.0) + 1.0;
82
+ vec2 offsetCenter = -instanceOffsets * (isCap ? perp : miterVec * miterSize) * 2.0;
83
+ vCornerOffset = vCornerOffset * offsetWidth - offsetCenter;
84
+ `,
85
+ 'fs:#main-start': `
86
+ float isInside;
87
+ isInside = step(-1.0, vPathPosition.x) * step(vPathPosition.x, 1.0);
88
+ if (isInside == 0.0) {
89
+ discard;
90
+ }
91
+ `
92
+ }
93
+ };
@@ -0,0 +1,27 @@
1
+ import { Framebuffer } from '@luma.gl/core';
2
+ import { Bounds } from '../utils/projection-utils';
3
+ import type { Viewport, Layer } from '@deck.gl/core/typed';
4
+ export declare class HeightMap {
5
+ /** Viewport used to draw into the texture */
6
+ renderViewport: Viewport | null;
7
+ /** Bounds of the height map texture, in cartesian space */
8
+ bounds: Bounds | null;
9
+ private fbo?;
10
+ private gl;
11
+ /** Last rendered layers */
12
+ private layers;
13
+ /** Last layer.getBounds() */
14
+ private layersBounds;
15
+ /** The union of layersBounds in cartesian space */
16
+ private layersBoundsCommon;
17
+ private lastViewport;
18
+ static isSupported(gl: WebGLRenderingContext): boolean;
19
+ constructor(gl: WebGLRenderingContext);
20
+ getRenderFramebuffer(): Framebuffer | null;
21
+ shouldUpdate({ layers, viewport }: {
22
+ layers: Layer[];
23
+ viewport: Viewport;
24
+ }): boolean;
25
+ delete(): void;
26
+ }
27
+ //# sourceMappingURL=height-map.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"height-map.d.ts","sourceRoot":"","sources":["../../src/terrain/height-map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAiD,MAAM,EAAC,MAAM,4BAA4B,CAAC;AAGlG,OAAO,KAAK,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,eAAe,CAAC;AAInD,qBAAa,SAAS;IACpB,6CAA6C;IAC7C,cAAc,EAAE,QAAQ,GAAG,IAAI,CAAQ;IACvC,2DAA2D;IAC3D,MAAM,EAAE,MAAM,GAAG,IAAI,CAAQ;IAE7B,OAAO,CAAC,GAAG,CAAC,CAAc;IAC1B,OAAO,CAAC,EAAE,CAAwB;IAClC,2BAA2B;IAC3B,OAAO,CAAC,MAAM,CAAe;IAC7B,6BAA6B;IAC7B,OAAO,CAAC,YAAY,CAAuC;IAC3D,mDAAmD;IACnD,OAAO,CAAC,kBAAkB,CAAuB;IACjD,OAAO,CAAC,YAAY,CAAyB;IAE7C,MAAM,CAAC,WAAW,CAAC,EAAE,EAAE,qBAAqB,GAAG,OAAO;gBAI1C,EAAE,EAAE,qBAAqB;IAIrC,oBAAoB,IAAI,WAAW,GAAG,IAAI;IAU1C,YAAY,CAAC,EAAC,MAAM,EAAE,QAAQ,EAAC,EAAE;QAAC,MAAM,EAAE,KAAK,EAAE,CAAC;QAAC,QAAQ,EAAE,QAAQ,CAAA;KAAC,GAAG,OAAO;IA4DhF,MAAM;CAMP"}
@@ -0,0 +1,4 @@
1
+ import type { _ShaderModule as ShaderModule } from '@deck.gl/core/typed';
2
+ declare const _default: ShaderModule<any>;
3
+ export default _default;
4
+ //# sourceMappingURL=shader-module-offset.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shader-module-offset.d.ts","sourceRoot":"","sources":["../../src/terrain/shader-module-offset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,IAAI,YAAY,EAAC,MAAM,eAAe,CAAC;;AAEjE,wBAyBkB"}
@@ -0,0 +1,4 @@
1
+ import type { _ShaderModule as ShaderModule } from '@deck.gl/core/typed';
2
+ declare const _default: ShaderModule<any>;
3
+ export default _default;
4
+ //# sourceMappingURL=shader-module-source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shader-module-source.d.ts","sourceRoot":"","sources":["../../src/terrain/shader-module-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,IAAI,YAAY,EAAC,MAAM,eAAe,CAAC;;AAEjE,wBAiCkB"}
@@ -0,0 +1,21 @@
1
+ import { LayerExtension, UpdateParameters } from '@deck.gl/core/typed';
2
+ import type { Layer } from '@deck.gl/core/typed';
3
+ export declare type TerrainExtensionProps = {
4
+ /**
5
+ * controls whether an object is drawn over the terrain surface by its anchor (usually defined by an accessor called `getPosition`, e.g. icon, scatterplot) or by its geometry (e.g. path, polygon).
6
+ * If not specified, it is automatically deduced from the layer.
7
+ */
8
+ terrainDrawMode?: 'offset' | 'drape';
9
+ };
10
+ /** Allows layers to show/hide objects by a geofence. */
11
+ export default class TerrainExtension extends LayerExtension {
12
+ static defaultProps: {
13
+ terrainDrawMode: undefined;
14
+ };
15
+ static extensionName: string;
16
+ getShaders(this: Layer<TerrainExtensionProps>): any;
17
+ initializeState(this: Layer<TerrainExtensionProps>): void;
18
+ updateState(this: Layer<TerrainExtensionProps>, params: UpdateParameters<Layer<TerrainExtensionProps>>): void;
19
+ onNeedsRedraw(this: Layer<{}>): void;
20
+ }
21
+ //# sourceMappingURL=terrain-extension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terrain-extension.d.ts","sourceRoot":"","sources":["../../src/terrain/terrain-extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAI/D,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,eAAe,CAAC;AAMzC,oBAAY,qBAAqB,GAAG;IAClC;;;OAGG;IACH,eAAe,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;CACtC,CAAC;AASF,wDAAwD;AACxD,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,cAAc;IAC1D,MAAM,CAAC,YAAY;;MAAgB;IACnC,MAAM,CAAC,aAAa,SAAsB;IAE1C,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,qBAAqB,CAAC,GAAG,GAAG;IAMnD,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,qBAAqB,CAAC;IAIlD,WAAW,CACT,IAAI,EAAE,KAAK,CAAC,qBAAqB,CAAC,EAClC,MAAM,EAAE,gBAAgB,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAyBxD,aAAa,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI;CAMrC"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/brushing/brushing.ts"],"names":["defaultProps","getBrushingTarget","type","value","brushingTarget","brushingEnabled","brushingRadius","BrushingExtension","modules","shaderModule","context","extension","attributeManager","getAttributeManager","add","brushingTargets","size","accessor","shaderAttributes","divisor","instanceBrushingTargets","state","onMouseMove","getCurrentLayer","setNeedsRedraw","deck","eventManager","on","pointermove","pointerleave","off","LayerExtension"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoBA;;AACA;;;;;;AAIA,IAAMA,YAAY,GAAG;AACnBC,EAAAA,iBAAiB,EAAE;AAACC,IAAAA,IAAI,EAAE,UAAP;AAAmBC,IAAAA,KAAK,EAAE,CAAC,CAAD,EAAI,CAAJ;AAA1B,GADA;AAGnBC,EAAAA,cAAc,EAAE,QAHG;AAInBC,EAAAA,eAAe,EAAE,IAJE;AAKnBC,EAAAA,cAAc,EAAE;AALG,CAArB;;IA8BqBC,iB;;;;;;;;;;;;WAInB,sBAAkB;AAChB,aAAO;AACLC,QAAAA,OAAO,EAAE,CAACC,qBAAD;AADJ,OAAP;AAGD;;;WAED,yBAAqDC,OAArD,EAA4EC,SAA5E,EAA6F;AAAA;;AAC3F,UAAMC,gBAAgB,GAAG,KAAKC,mBAAL,EAAzB;;AACA,UAAID,gBAAJ,EAAsB;AACpBA,QAAAA,gBAAgB,CAACE,GAAjB,CAAqB;AACnBC,UAAAA,eAAe,EAAE;AACfC,YAAAA,IAAI,EAAE,CADS;AAEfC,YAAAA,QAAQ,EAAE,mBAFK;AAGfC,YAAAA,gBAAgB,EAAE;AAChBH,cAAAA,eAAe,EAAE;AACfI,gBAAAA,OAAO,EAAE;AADM,eADD;AAIhBC,cAAAA,uBAAuB,EAAE;AACvBD,gBAAAA,OAAO,EAAE;AADc;AAJT;AAHH;AADE,SAArB;AAcD;;AAID,WAAKE,KAAL,CAAWC,WAAX,GAAyB,YAAM;AAAA;;AAC7B,iCAAA,KAAI,CAACC,eAAL,kFAAwBC,cAAxB;AACD,OAFD;;AAGA,UAAId,OAAO,CAACe,IAAZ,EAAkB;AAEhBf,QAAAA,OAAO,CAACe,IAAR,CAAaC,YAAb,CAA0BC,EAA1B,CAA6B;AAC3BC,UAAAA,WAAW,EAAE,KAAKP,KAAL,CAAWC,WADG;AAE3BO,UAAAA,YAAY,EAAE,KAAKR,KAAL,CAAWC;AAFE,SAA7B;AAID;AACF;;;WAED,uBAAmDZ,OAAnD,EAA0EC,SAA1E,EAA2F;AAEzF,UAAID,OAAO,CAACe,IAAZ,EAAkB;AAEhBf,QAAAA,OAAO,CAACe,IAAR,CAAaC,YAAb,CAA0BI,GAA1B,CAA8B;AAC5BF,UAAAA,WAAW,EAAE,KAAKP,KAAL,CAAWC,WADI;AAE5BO,UAAAA,YAAY,EAAE,KAAKR,KAAL,CAAWC;AAFG,SAA9B;AAID;AACF;;;EApD4CS,oB;;;8BAA1BxB,iB,kBACGP,Y;8BADHO,iB,mBAEI,mB","sourcesContent":["// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport {LayerExtension} from '@deck.gl/core';\nimport shaderModule from './shader-module';\n\nimport type {Layer, LayerContext, Accessor} from '@deck.gl/core';\n\nconst defaultProps = {\n getBrushingTarget: {type: 'accessor', value: [0, 0]},\n\n brushingTarget: 'source',\n brushingEnabled: true,\n brushingRadius: 10000\n};\n\nexport type BrushingExtensionProps<DataT = any> = {\n /**\n * Called to retrieve an arbitrary position for each object that it will be filtered by.\n * Only effective if `brushingTarget` is set to `custom`.\n */\n getBrushingTarget?: Accessor<DataT, [number, number]>;\n /**\n * Enable/disable brushing. If brushing is disabled, all objects are rendered.\n * @default true\n */\n brushingEnabled?: boolean;\n /**\n * The position used to filter each object by.\n */\n brushingTarget?: 'source' | 'target' | 'source_target' | 'custom';\n /** The brushing radius centered at the pointer, in meters. If a data object is within this circle, it is rendered; otherwise it is hidden.\n * @default 10000\n */\n brushingRadius?: number;\n};\n\n/** Adds GPU-based data brushing functionalities to layers. It allows the layer to show/hide objects based on the current pointer position. */\nexport default class BrushingExtension extends LayerExtension {\n static defaultProps = defaultProps;\n static extensionName = 'BrushingExtension';\n\n getShaders(): any {\n return {\n modules: [shaderModule]\n };\n }\n\n initializeState(this: Layer<BrushingExtensionProps>, context: LayerContext, extension: this) {\n const attributeManager = this.getAttributeManager();\n if (attributeManager) {\n attributeManager.add({\n brushingTargets: {\n size: 2,\n accessor: 'getBrushingTarget',\n shaderAttributes: {\n brushingTargets: {\n divisor: 0\n },\n instanceBrushingTargets: {\n divisor: 1\n }\n }\n }\n });\n }\n\n // Trigger redraw when mouse moves\n // TODO - expose this in a better way\n this.state.onMouseMove = () => {\n this.getCurrentLayer()?.setNeedsRedraw();\n };\n if (context.deck) {\n // @ts-expect-error (2446) accessing protected property\n context.deck.eventManager.on({\n pointermove: this.state.onMouseMove,\n pointerleave: this.state.onMouseMove\n });\n }\n }\n\n finalizeState(this: Layer<BrushingExtensionProps>, context: LayerContext, extension: this) {\n // Remove event listeners\n if (context.deck) {\n // @ts-expect-error (2446) accessing protected property\n context.deck.eventManager.off({\n pointermove: this.state.onMouseMove,\n pointerleave: this.state.onMouseMove\n });\n }\n }\n}\n"],"file":"brushing.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/clip/clip.ts"],"names":["defaultProps","clipBounds","clipByInstance","undefined","shaderFunction","shaderModuleVs","name","vs","injectionVs","shaderModuleFs","fs","injectionFs","ClipExtension","getAttributeManager","attributes","props","Boolean","state","modules","inject","uniforms","clip_bounds","corner0","projectPosition","corner1","Math","min","max","LayerExtension"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoBA;;;;;;AAIA,IAAMA,YAAY,GAAG;AACnBC,EAAAA,UAAU,EAAE,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV,CADO;AAEnBC,EAAAA,cAAc,EAAEC;AAFG,CAArB;AAiBA,IAAMC,cAAc,oNAApB;AAYA,IAAMC,cAA4B,GAAG;AACnCC,EAAAA,IAAI,EAAE,SAD6B;AAEnCC,EAAAA,EAAE,EAAEH;AAF+B,CAArC;AAKA,IAAMI,WAAW,GAAG;AAClB,iDADkB;AAIlB,6GAJkB;AAOlB,iDAPkB;AAUlB;AAVkB,CAApB;AAmBA,IAAMC,cAA4B,GAAG;AACnCH,EAAAA,IAAI,EAAE,SAD6B;AAEnCI,EAAAA,EAAE,EAAEN;AAF+B,CAArC;AAKA,IAAMO,WAAW,GAA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,GAAL,CAASJ,OAAO,CAAC,CAAD,CAAhB,EAAqBE,OAAO,CAAC,CAAD,CAA5B,CAFqB,EAGrBC,IAAI,CAACE,GAAL,CAASL,OAAO,CAAC,CAAD,CAAhB,EAAqBE,OAAO,CAAC,CAAD,CAA5B,CAHqB,EAIrBC,IAAI,CAACE,GAAL,CAASL,OAAO,CAAC,CAAD,CAAhB,EAAqBE,OAAO,CAAC,CAAD,CAA5B,CAJqB,CAAvB;AAMD;AACF;;;EA5CwCI,oB;;;8BAAtBhB,a,kBACGZ,Y;8BADHY,a,mBAEI,e","sourcesContent":["// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport {LayerExtension, _ShaderModule as ShaderModule} from '@deck.gl/core';\n\nimport type {Layer} from '@deck.gl/core';\n\nconst defaultProps = {\n clipBounds: [0, 0, 1, 1],\n clipByInstance: undefined\n};\n\nexport type ClipExtensionProps = {\n /** Rectangular bounds to be used for clipping the rendered region, in `[left, bottom, right, top]`.\n * @default [0, 0, 1, 1]\n */\n clipBounds?: [number, number, number, number];\n /**\n * Controls whether an object is clipped by its anchor (e.g. icon, point) or by its geometry (e.g. path, polygon).\n * If not specified, it is automatically deduced from the layer.\n */\n clipByInstance?: boolean;\n};\n\nconst shaderFunction = `\nuniform vec4 clip_bounds;\n\nbool clip_isInBounds(vec2 position) {\n return position.x >= clip_bounds[0] && position.y >= clip_bounds[1] && position.x < clip_bounds[2] && position.y < clip_bounds[3];\n}\n`;\n\n/*\n * The vertex-shader version clips geometries by their anchor position\n * e.g. ScatterplotLayer - show if the center of a circle is within bounds\n */\nconst shaderModuleVs: ShaderModule = {\n name: 'clip-vs',\n vs: shaderFunction\n};\n\nconst injectionVs = {\n 'vs:#decl': `\nvarying float clip_isVisible;\n`,\n 'vs:DECKGL_FILTER_GL_POSITION': `\n clip_isVisible = float(clip_isInBounds(geometry.worldPosition.xy));\n`,\n 'fs:#decl': `\nvarying float clip_isVisible;\n`,\n 'fs:DECKGL_FILTER_COLOR': `\n if (clip_isVisible < 0.5) discard;\n`\n};\n\n/*\n * The fragment-shader version clips pixels at the bounds\n * e.g. PolygonLayer - show the part of the polygon that intersect with the bounds\n */\nconst shaderModuleFs: ShaderModule = {\n name: 'clip-fs',\n fs: shaderFunction\n};\n\nconst injectionFs = {\n 'vs:#decl': `\nvarying vec2 clip_commonPosition;\n`,\n 'vs:DECKGL_FILTER_GL_POSITION': `\n clip_commonPosition = geometry.position.xy;\n`,\n 'fs:#decl': `\nvarying vec2 clip_commonPosition;\n`,\n 'fs:DECKGL_FILTER_COLOR': `\n if (!clip_isInBounds(clip_commonPosition)) discard;\n`\n};\n\n/** Adds support for clipping rendered layers by rectangular bounds. */\nexport default class ClipExtension extends LayerExtension {\n static defaultProps = defaultProps;\n static extensionName = 'ClipExtension';\n\n getShaders(this: Layer<ClipExtensionProps>) {\n // If `clipByInstance: true`, the entire object is shown/hidden based on its anchor position (done by vertex shader)\n // Otherwise, the object is trimmed by the clip bounds (done by fragment shader)\n\n // Default behavior: consider a layer instanced if it has attribute `instancePositions`\n // @ts-expect-error attributeManager is always defined for primitive layers\n let clipByInstance = 'instancePositions' in this.getAttributeManager().attributes;\n // Users can override by setting the `clipByInstance` prop\n if (this.props.clipByInstance !== undefined) {\n clipByInstance = Boolean(this.props.clipByInstance);\n }\n this.state.clipByInstance = clipByInstance;\n\n return clipByInstance\n ? {\n modules: [shaderModuleVs],\n inject: injectionVs\n }\n : {\n modules: [shaderModuleFs],\n inject: injectionFs\n };\n }\n\n /* eslint-disable camelcase */\n draw(this: Layer<Required<ClipExtensionProps>>, {uniforms}: any): void {\n const {clipBounds} = this.props;\n if (this.state.clipByInstance) {\n uniforms.clip_bounds = clipBounds;\n } else {\n const corner0 = this.projectPosition([clipBounds[0], clipBounds[1], 0]);\n const corner1 = this.projectPosition([clipBounds[2], clipBounds[3], 0]);\n\n uniforms.clip_bounds = [\n Math.min(corner0[0], corner1[0]),\n Math.min(corner0[1], corner1[1]),\n Math.max(corner0[0], corner1[0]),\n Math.max(corner0[1], corner1[1])\n ];\n }\n }\n}\n"],"file":"clip.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/collision-filter/collision-filter.ts"],"names":["defaultProps","getCollisionPriority","type","value","collisionEnabled","collisionGroup","collisionTestProps","CollisionFilterExtension","modules","collision","uniforms","context","moduleParameters","props","collisionFBO","drawToCollisionMap","enabled","Boolean","collision_enabled","clone","extension","getAttributeManager","deck","_addDefaultEffect","CollisionFilterEffect","attributeManager","add","collisionPriorities","size","accessor","shaderAttributes","divisor","instanceCollisionPriorities","LayerExtension"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;;;;;AAEA,IAAMA,YAAY,GAAG;AACnBC,EAAAA,oBAAoB,EAAE;AAACC,IAAAA,IAAI,EAAE,UAAP;AAAmBC,IAAAA,KAAK,EAAE;AAA1B,GADH;AAEnBC,EAAAA,gBAAgB,EAAE,IAFC;AAGnBC,EAAAA,cAAc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V,aADL;AAEhBC,YAAAA,2BAA2B,EAAE;AAACD,cAAAA,OAAO,EAAE;AAAV;AAFb;AAHC;AADD,OAAtB;AAUD;;;WAED,iCAA2E;AACzE,aAAO,KAAKlB,KAAL,CAAWT,gBAAlB;AACD;;;EA9CmD6B,oB;;;8BAAjC1B,wB,kBACGP,Y;8BADHO,wB,mBAEI,0B","sourcesContent":["import {Accessor, Layer, LayerContext, LayerExtension} from '@deck.gl/core';\nimport collision from './shader-module';\nimport CollisionFilterEffect from './collision-filter-effect';\n\nconst defaultProps = {\n getCollisionPriority: {type: 'accessor', value: 0},\n collisionEnabled: true,\n collisionGroup: {type: 'string', value: 'default'},\n collisionTestProps: {}\n};\n\nexport type CollisionFilterExtensionProps<DataT = any> = {\n /**\n * Accessor for collision priority. Must return a number in the range -1000 -> 1000. Features with higher values are shown preferentially.\n */\n getCollisionPriority?: Accessor<DataT, number>;\n\n /**\n * Enable/disable collisions. If collisions are disabled, all objects are rendered.\n * @default true\n */\n collisionEnabled: boolean;\n\n /**\n * Collision group this layer belongs to. If it is not set, the 'default' collision group is used\n */\n collisionGroup?: string;\n\n /**\n * Props to override when rendering collision map\n */\n collisionTestProps?: {};\n};\n\n/** Allows layers to hide overlapping objects. */\nexport default class CollisionFilterExtension extends LayerExtension {\n static defaultProps = defaultProps;\n static extensionName = 'CollisionFilterExtension';\n\n getShaders(this: Layer<CollisionFilterExtensionProps>): any {\n return {modules: [collision]};\n }\n\n /* eslint-disable camelcase */\n draw(this: Layer<CollisionFilterExtensionProps>, {uniforms, context, moduleParameters}: any) {\n const {collisionEnabled} = this.props;\n const {collisionFBO, drawToCollisionMap} = moduleParameters;\n const enabled = collisionEnabled && Boolean(collisionFBO);\n uniforms.collision_enabled = enabled;\n\n if (drawToCollisionMap) {\n // Override any props with those defined in collisionTestProps\n // @ts-ignore\n this.props = this.clone(this.props.collisionTestProps).props;\n }\n }\n\n initializeState(\n this: Layer<CollisionFilterExtensionProps>,\n context: LayerContext,\n extension: this\n ) {\n if (this.getAttributeManager() === null) {\n return;\n }\n this.context.deck?._addDefaultEffect(new CollisionFilterEffect());\n const attributeManager = this.getAttributeManager();\n attributeManager!.add({\n collisionPriorities: {\n size: 1,\n accessor: 'getCollisionPriority',\n shaderAttributes: {\n collisionPriorities: {divisor: 0},\n instanceCollisionPriorities: {divisor: 1}\n }\n }\n });\n }\n\n getNeedsPickingBuffer(this: Layer<CollisionFilterExtensionProps>): boolean {\n return this.props.collisionEnabled;\n }\n}\n"],"file":"collision-filter.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/data-filter/data-filter.ts"],"names":["defaultProps","getFilterValue","type","value","onFilteredItemsChange","optional","filterEnabled","filterRange","filterSoftRange","filterTransformSize","filterTransformColor","DATA_TYPE_FROM_SIZE","DataFilterExtension","filterSize","fp64","countItems","Error","extension","opts","modules","shaderModule64","shaderModule","defines","DATAFILTER_TYPE","DATAFILTER_DOUBLE","Boolean","context","attributeManager","getAttributeManager","add","filterValues","size","accessor","shaderAttributes","divisor","instanceFilterValues","gl","useFloatTarget","aggregator","supportsFloatTarget","filterIndices","vertexOffset","normalized","object","index","i","__source","Math","floor","filterPrevIndices","filterFBO","getFramebuffer","filterModel","getModel","getShaders","call","setState","props","oldProps","state","filterNeedsUpdate","attributes","needsUpdate","params","setVertexCount","getNumInstances","framebuffer","color","updateModuleSettings","moduleParameters","setAttributes","getShaderAttributes","draw","parameters","viewport","width","height","count","length","id","delete","LayerExtension"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAoBA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;AAKA,IAAMA,YAAY,GAAG;AACnBC,EAAAA,cAAc,EAAE;AAACC,IAAAA,IAAI,EAAE,UAAP;AAAmBC,IAAAA,KAAK,EAAE;AAA1B,GADG;AAEnBC,EAAAA,qBAAqB,EAAE;AAACF,IAAAA,IAAI,EAAE,UAAP;AAAmBC,IAAAA,KAAK,EAAE,IAA1B;AAAgCE,IAAAA,QAAQ,EAAE;AA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AK,CAACtB,CAAD,CAAd;AACD;;AACDzC,QAAAA,qBAAqB,CAAC;AAAC2E,UAAAA,EAAE,EAAE,KAAKA,EAAV;AAAcF,UAAAA,KAAK,EAALA;AAAd,SAAD,CAArB;AAEA,aAAKlB,KAAL,CAAWC,iBAAX,GAA+B,KAA/B;AACD;AACF;;;WAED,yBAAqD;AACnD,yBAAiC,KAAKD,KAAtC;AAAA,UAAOT,SAAP,gBAAOA,SAAP;AAAA,UAAkBE,WAAlB,gBAAkBA,WAAlB;;AACA,UAAIF,SAAJ,EAAe;AACbA,QAAAA,SAAS,CAACiB,KAAV,CAAgBa,MAAhB;AACA9B,QAAAA,SAAS,CAAC8B,MAAV;AACA5B,QAAAA,WAAW,CAAC4B,MAAZ;AACD;AACF;;;EAlJ8CC,oB;;;8BAA5BrE,mB,kBACGZ,Y;8BADHY,mB,mBAEI,qB","sourcesContent":["// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport {LayerExtension} from '@deck.gl/core';\nimport {shaderModule, shaderModule64} from './shader-module';\nimport * as aggregator from './aggregator';\nimport {readPixelsToArray, clear} from '@luma.gl/core';\nimport GL from '@luma.gl/constants';\n\nimport type {Layer, LayerContext, Accessor, UpdateParameters} from '@deck.gl/core';\n\nconst defaultProps = {\n getFilterValue: {type: 'accessor', value: 0},\n onFilteredItemsChange: {type: 'function', value: null, optional: true},\n\n filterEnabled: true,\n filterRange: [-1, 1],\n filterSoftRange: null,\n filterTransformSize: true,\n filterTransformColor: true\n};\n\nexport type DataFilterExtensionProps<DataT = any> = {\n /**\n * Accessor to retrieve the value for each object that it will be filtered by.\n * Returns either a number (if `filterSize: 1`) or an array of numbers.\n */\n getFilterValue?: Accessor<DataT, number | number[]>;\n /**\n * Enable/disable the data filter. If the data filter is disabled, all objects are rendered.\n * @default true\n */\n filterEnabled?: boolean;\n /**\n * The [min, max] bounds which defines whether an object should be rendered.\n * If an object's filtered value is within the bounds, the object will be rendered; otherwise it will be hidden.\n * @default [-1, 1]\n */\n filterRange?: [number, number] | [number, number][];\n /**\n * If specified, objects will be faded in/out instead of abruptly shown/hidden.\n * When the filtered value is outside of the bounds defined by `filterSoftRange` but still within the bounds defined by `filterRange`, the object will be rendered as \"faded.\"\n * @default null\n */\n filterSoftRange?: [number, number] | [number, number][] | null;\n /**\n * When an object is \"faded\", manipulate its size so that it appears smaller or thinner. Only works if `filterSoftRange` is specified.\n * @default true\n */\n filterTransformSize?: boolean;\n /**\n * When an object is \"faded\", manipulate its opacity so that it appears more translucent. Only works if `filterSoftRange` is specified.\n * @default true\n */\n filterTransformColor?: boolean;\n /**\n * Only called if the `countItems` option is enabled.\n */\n onFilteredItemsChange?: (evt: {\n /** The id of the source layer. */\n id: string;\n /** The number of data objects that pass the filter. */\n count: number;\n }) => void;\n};\n\ntype DataFilterExtensionOptions = {\n /**\n * The size of the filter (number of columns to filter by). The data filter can show/hide data based on 1-4 numeric properties of each object.\n * @default 1\n */\n filterSize: number;\n /**\n * Use 64-bit precision instead of 32-bit.\n * @default false\n */\n fp64: boolean;\n /**\n * If `true`, reports the number of filtered objects with the `onFilteredItemsChange` callback.\n * @default `false`.\n */\n countItems: boolean;\n};\n\nconst DATA_TYPE_FROM_SIZE = {\n 1: 'float',\n 2: 'vec2',\n 3: 'vec3',\n 4: 'vec4'\n};\n\n/** Adds GPU-based data filtering functionalities to layers. It allows the layer to show/hide objects based on user-defined properties. */\nexport default class DataFilterExtension extends LayerExtension<DataFilterExtensionOptions> {\n static defaultProps = defaultProps;\n static extensionName = 'DataFilterExtension';\n\n constructor({\n filterSize = 1,\n fp64 = false,\n countItems = false\n }: Partial<DataFilterExtensionOptions> = {}) {\n if (!DATA_TYPE_FROM_SIZE[filterSize]) {\n throw new Error('filterSize out of range');\n }\n\n super({filterSize, fp64, countItems});\n }\n\n getShaders(this: Layer<DataFilterExtensionProps>, extension: this): any {\n const {filterSize, fp64} = extension.opts;\n\n return {\n modules: [fp64 ? shaderModule64 : shaderModule],\n defines: {\n DATAFILTER_TYPE: DATA_TYPE_FROM_SIZE[filterSize],\n DATAFILTER_DOUBLE: Boolean(fp64)\n }\n };\n }\n\n initializeState(this: Layer<DataFilterExtensionProps>, context: LayerContext, extension: this) {\n const attributeManager = this.getAttributeManager();\n if (attributeManager) {\n attributeManager.add({\n filterValues: {\n size: extension.opts.filterSize,\n type: extension.opts.fp64 ? GL.DOUBLE : GL.FLOAT,\n accessor: 'getFilterValue',\n shaderAttributes: {\n filterValues: {\n divisor: 0\n },\n instanceFilterValues: {\n divisor: 1\n }\n }\n }\n });\n }\n\n const {gl} = this.context;\n if (attributeManager && extension.opts.countItems) {\n const useFloatTarget = aggregator.supportsFloatTarget(gl);\n // This attribute is needed for variable-width data, e.g. Path, SolidPolygon, Text\n // The vertex shader checks if a vertex has the same \"index\" as the previous vertex\n // so that we only write one count cross multiple vertices of the same object\n attributeManager.add({\n filterIndices: {\n size: useFloatTarget ? 1 : 2,\n vertexOffset: 1,\n type: GL.UNSIGNED_BYTE,\n normalized: true,\n accessor: (object, {index}) => {\n const i = object && object.__source ? object.__source.index : index;\n return useFloatTarget ? (i + 1) % 255 : [(i + 1) % 255, Math.floor(i / 255) % 255];\n },\n shaderAttributes: {\n filterPrevIndices: {\n vertexOffset: 0\n },\n filterIndices: {\n vertexOffset: 1\n }\n }\n }\n });\n\n const filterFBO = aggregator.getFramebuffer(gl, useFloatTarget);\n const filterModel = aggregator.getModel(\n gl,\n extension.getShaders.call(this, extension),\n useFloatTarget\n );\n this.setState({filterFBO, filterModel});\n }\n }\n\n updateState(\n this: Layer<DataFilterExtensionProps>,\n {props, oldProps}: UpdateParameters<Layer<DataFilterExtensionProps>>\n ) {\n if (this.state.filterModel) {\n const attributeManager = this.getAttributeManager();\n const filterNeedsUpdate =\n // attributeManager must be defined for filterModel to be set\n attributeManager!.attributes.filterValues.needsUpdate() ||\n props.filterEnabled !== oldProps.filterEnabled ||\n props.filterRange !== oldProps.filterRange ||\n props.filterSoftRange !== oldProps.filterSoftRange;\n if (filterNeedsUpdate) {\n this.setState({filterNeedsUpdate});\n }\n }\n }\n\n draw(this: Layer<DataFilterExtensionProps>, params: any, extension: this) {\n const {filterFBO, filterModel, filterNeedsUpdate} = this.state;\n const {onFilteredItemsChange} = this.props;\n if (filterNeedsUpdate && onFilteredItemsChange && filterModel) {\n const {\n attributes: {filterValues, filterIndices}\n } = this.getAttributeManager()!;\n filterModel.setVertexCount(this.getNumInstances());\n\n const {gl} = this.context;\n clear(gl, {framebuffer: filterFBO, color: [0, 0, 0, 0]});\n\n filterModel\n .updateModuleSettings(params.moduleParameters)\n .setAttributes({\n ...filterValues.getShaderAttributes(),\n ...(filterIndices && filterIndices.getShaderAttributes())\n })\n .draw({\n framebuffer: filterFBO,\n parameters: {\n ...aggregator.parameters,\n viewport: [0, 0, filterFBO.width, filterFBO.height]\n }\n });\n const color = readPixelsToArray(filterFBO);\n let count = 0;\n for (let i = 0; i < color.length; i++) {\n count += color[i];\n }\n onFilteredItemsChange({id: this.id, count});\n\n this.state.filterNeedsUpdate = false;\n }\n }\n\n finalizeState(this: Layer<DataFilterExtensionProps>) {\n const {filterFBO, filterModel} = this.state;\n if (filterFBO) {\n filterFBO.color.delete();\n filterFBO.delete();\n filterModel.delete();\n }\n }\n}\n"],"file":"data-filter.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/fill-style/fill-style.ts"],"names":["defaultProps","fillPatternEnabled","fillPatternAtlas","type","value","async","parameters","fillPatternMapping","fillPatternMask","getFillPattern","d","pattern","getFillPatternScale","getFillPatternOffset","FillStyleExtension","layer","getAttributeManager","state","extension","isEnabled","modules","opts","patternShaders","filter","Boolean","context","attributeManager","add","fillPatternFrames","size","accessor","transform","getPatternFrame","bind","shaderAttributes","divisor","instanceFillPatternFrames","fillPatternScales","defaultValue","instanceFillPatternScales","fillPatternOffsets","instanceFillPatternOffsets","setState","emptyTexture","Texture2D","gl","data","Uint8Array","width","height","props","oldProps","invalidate","params","setModuleParameters","fillPatternTexture","patternTexture","delete","name","getCurrentLayer","def","x","y","LayerExtension"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAGA;;;;;;AAWA,IAAMA,YAAY,GAAG;AACnBC,EAAAA,kBAAkB,EAAE,IADD;AAEnBC,EAAAA,gBAAgB,EAAE;AAChBC,IAAAA,IAAI,EAAE,OADU;AAEhBC,IAAAA,KAAK,EAAE,IAFS;AAGhBC,IAAAA,KAAK,EAAE,IAHS;AAIhBC,IAAAA,UAAU;AAJM,GAFC;AAUnBC,EAAAA,kBAAkB,EAAE;AAACJ,IAAAA,IAAI,EAAE,QAAP;AAAiBC,IAAAA,KAAK,EAAE,EAAxB;AAA4BC,IAAAA,KAAK,EAAE;AAAnC,GAVD;AAWnBG,EAAAA,eAAe,EAAE,IAXE;AAYnBC,EAAAA,cAAc,EAAE;AAACN,IAAAA,IAAI,EAAE,UAAP;AAAmBC,IAAAA,KAAK,EAAE,eAAAM,CAAC;AAAA,aAAIA,CAAC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{LayerExtension} from '@deck.gl/core';\nimport {Texture2D} from '@luma.gl/core';\nimport GL from '@luma.gl/constants';\n\nimport {patternShaders} from './shaders.glsl';\n\nimport type {\n Layer,\n LayerContext,\n Accessor,\n AccessorFunction,\n Texture,\n UpdateParameters\n} from '@deck.gl/core';\n\nconst defaultProps = {\n fillPatternEnabled: true,\n fillPatternAtlas: {\n type: 'image',\n value: null,\n async: true,\n parameters: {\n [GL.TEXTURE_MIN_FILTER]: GL.LINEAR\n }\n },\n fillPatternMapping: {type: 'object', value: {}, async: true},\n fillPatternMask: true,\n getFillPattern: {type: 'accessor', value: d => d.pattern},\n getFillPatternScale: {type: 'accessor', value: 1},\n getFillPatternOffset: {type: 'accessor', value: [0, 0]}\n};\n\nexport type FillStyleExtensionProps<DataT = any> = {\n /** Cheap toggle to enable/disable pattern fill. Requires the `pattern` option to be on.\n * @default true\n */\n fillPatternEnabled?: boolean;\n /** Sprite image url or texture that packs all your patterns into one layout. */\n fillPatternAtlas?: string | Texture;\n /** Pattern names mapped to pattern definitions, or a url that points to a JSON file. */\n fillPatternMapping?:\n | string\n | Record<\n string,\n {\n /** Left position of the pattern on the atlas */\n x: number;\n /** Top position of the pattern on the atlas */\n y: number;\n /** Width of the pattern */\n width: number;\n /** Height of the pattern */\n height: number;\n }\n >;\n /**\n * Whether to treat the patterns as transparency masks.\n * @default true\n */\n fillPatternMask?: boolean;\n /** Accessor for the name of the pattern. */\n getFillPattern?: AccessorFunction<DataT, string>;\n /** Accessor for the scale of the pattern, relative to the original size. If the pattern is 24 x 24 pixels, scale `1` roughly yields 24 meters.\n * @default 1\n */\n getFillPatternScale?: Accessor<DataT, number>;\n /**\n * Accessor for the offset of the pattern, relative to the original size. Offset `[0.5, 0.5]` shifts the pattern alignment by half.\n * @default [0, 0]\n */\n getFillPatternOffset?: Accessor<DataT, [number, number]>;\n};\n\ntype FillStyleExtensionOptions = {\n /** If `true`, adds the ability to tile the filled area with a pattern.\n * @default false\n */\n pattern: boolean;\n};\n\n/** Adds selected features to layers that render a \"fill\", such as the `PolygonLayer` and `ScatterplotLayer`. */\nexport default class FillStyleExtension extends LayerExtension<FillStyleExtensionOptions> {\n static defaultProps = defaultProps;\n static extensionName = 'FillStyleExtension';\n\n constructor({pattern = false}: Partial<FillStyleExtensionOptions> = {}) {\n super({pattern});\n }\n\n isEnabled(layer: Layer<FillStyleExtensionProps>): boolean {\n return layer.getAttributeManager() !== null && !('pathTesselator' in layer.state);\n }\n\n getShaders(this: Layer<FillStyleExtensionProps>, extension: this): any {\n if (!extension.isEnabled(this)) {\n return null;\n }\n\n return {\n modules: [extension.opts.pattern && patternShaders].filter(Boolean)\n };\n }\n\n initializeState(this: Layer<FillStyleExtensionProps>, context: LayerContext, extension: this) {\n if (!extension.isEnabled(this)) {\n return;\n }\n\n const attributeManager = this.getAttributeManager();\n\n if (extension.opts.pattern) {\n attributeManager!.add({\n fillPatternFrames: {\n size: 4,\n accessor: 'getFillPattern',\n transform: extension.getPatternFrame.bind(this),\n shaderAttributes: {\n fillPatternFrames: {\n divisor: 0\n },\n instanceFillPatternFrames: {\n divisor: 1\n }\n }\n },\n fillPatternScales: {\n size: 1,\n accessor: 'getFillPatternScale',\n defaultValue: 1,\n shaderAttributes: {\n fillPatternScales: {\n divisor: 0\n },\n instanceFillPatternScales: {\n divisor: 1\n }\n }\n },\n fillPatternOffsets: {\n size: 2,\n accessor: 'getFillPatternOffset',\n shaderAttributes: {\n fillPatternOffsets: {\n divisor: 0\n },\n instanceFillPatternOffsets: {\n divisor: 1\n }\n }\n }\n });\n }\n this.setState({\n emptyTexture: new Texture2D(this.context.gl, {\n data: new Uint8Array(4),\n width: 1,\n height: 1\n })\n });\n }\n\n updateState(\n this: Layer<FillStyleExtensionProps>,\n {props, oldProps}: UpdateParameters<Layer<FillStyleExtensionProps>>,\n extension: this\n ) {\n if (!extension.isEnabled(this)) {\n return;\n }\n\n if (props.fillPatternMapping && props.fillPatternMapping !== oldProps.fillPatternMapping) {\n this.getAttributeManager()!.invalidate('getFillPattern');\n }\n }\n\n draw(this: Layer<FillStyleExtensionProps>, params: any, extension: this) {\n if (!extension.isEnabled(this)) {\n return;\n }\n\n const {fillPatternAtlas} = this.props;\n this.setModuleParameters({\n fillPatternTexture: fillPatternAtlas || this.state.emptyTexture\n });\n }\n\n finalizeState(this: Layer<FillStyleExtensionProps>) {\n const {patternTexture, emptyTexture} = this.state;\n patternTexture?.delete();\n emptyTexture?.delete();\n }\n\n getPatternFrame(this: Layer<FillStyleExtensionProps>, name: string) {\n const {fillPatternMapping} = this.getCurrentLayer()!.props;\n const def = fillPatternMapping && fillPatternMapping[name];\n return def ? [def.x, def.y, def.width, def.height] : [0, 0, 0, 0];\n }\n}\n"],"file":"fill-style.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/fp64/fp64.ts"],"names":["Fp64Extension","coordinateSystem","props","COORDINATE_SYSTEM","LNGLAT","DEFAULT","Error","modules","project64","LayerExtension"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoBA;;AACA;;;;;;IAKqBA,a;;;;;;;;;;;;WAGnB,sBAA6B;AAC3B,UAAOC,gBAAP,GAA2B,KAAKC,KAAhC,CAAOD,gBAAP;;AACA,UACEA,gBAAgB,KAAKE,wBAAkBC,MAAvC,IACAH,gBAAgB,KAAKE,wBAAkBE,OAFzC,EAGE;AACA,cAAM,IAAIC,KAAJ,CAAU,uCAAV,CAAN;AACD;;AAED,aAAO;AACLC,QAAAA,OAAO,EAAE,CAACC,gBAAD;AADJ,OAAP;AAGD;;;EAfwCC,oB;;;8BAAtBT,a,mBACI,e","sourcesContent":["// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport {LayerExtension, COORDINATE_SYSTEM} from '@deck.gl/core';\nimport project64 from './project64';\n\nimport type {Layer} from '@deck.gl/core';\n\n/** @deprecated Adds the legacy 64-bit precision to geospatial layers. */\nexport default class Fp64Extension extends LayerExtension {\n static extensionName = 'Fp64Extension';\n\n getShaders(this: Layer): any {\n const {coordinateSystem} = this.props;\n if (\n coordinateSystem !== COORDINATE_SYSTEM.LNGLAT &&\n coordinateSystem !== COORDINATE_SYSTEM.DEFAULT\n ) {\n throw new Error('fp64: coordinateSystem must be LNGLAT');\n }\n\n return {\n modules: [project64]\n };\n }\n}\n"],"file":"fp64.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/mask/mask.ts"],"names":["defaultProps","maskId","maskByInstance","undefined","maskInverted","MaskExtension","context","deck","_addDefaultEffect","MaskEffect","getAttributeManager","attributes","props","Boolean","state","modules","mask","uniforms","moduleParameters","mask_maskByInstance","maskChannels","viewport","index","bounds","fromCoordinateOrigin","coordinateOrigin","fromCoordinateSystem","coordinateSystem","mask_enabled","mask_channel","mask_inverted","COORDINATE_SYSTEM","DEFAULT","isGeospatial","LNGLAT","CARTESIAN","opts","modelMatrix","bl","projectPosition","tr","mask_bounds","log","warn","LayerExtension"],"mappings":";;;;;;;;;;;;;;;;;;;;;A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E_SYSTEM, Layer, LayerExtension, log} from '@deck.gl/core';\nimport mask from './shader-module';\nimport MaskEffect from './mask-effect';\n\nconst defaultProps = {\n maskId: '',\n maskByInstance: undefined,\n maskInverted: false\n};\n\nexport type MaskExtensionProps = {\n /**\n * Id of the layer that defines the mask. The mask layer must use the prop `operation: 'mask'`.\n * Masking is disabled if `maskId` is empty or no valid mask layer with the specified id is found.\n */\n maskId?: string;\n /**\n * controls whether an object is clipped by its anchor (usually defined by an accessor called `getPosition`, e.g. icon, scatterplot) or by its geometry (e.g. path, polygon).\n * If not specified, it is automatically deduced from the layer.\n */\n maskByInstance?: boolean;\n /**\n * Inverts the masking operation\n */\n maskInverted?: boolean;\n};\n\n/** Allows layers to show/hide objects by a geofence. */\nexport default class MaskExtension extends LayerExtension {\n static defaultProps = defaultProps;\n static extensionName = 'MaskExtension';\n\n initializeState(this: Layer<MaskExtensionProps>) {\n this.context.deck?._addDefaultEffect(new MaskEffect());\n }\n\n getShaders(this: Layer<MaskExtensionProps>): any {\n // Infer by geometry if 'maskByInstance' prop isn't explictly set\n let maskByInstance = 'instancePositions' in this.getAttributeManager()!.attributes;\n // Users can override by setting the `maskByInstance` prop\n if (this.props.maskByInstance !== undefined) {\n maskByInstance = Boolean(this.props.maskByInstance);\n }\n this.state.maskByInstance = maskByInstance;\n\n return {\n modules: [mask]\n };\n }\n\n /* eslint-disable camelcase */\n draw(this: Layer<Required<MaskExtensionProps>>, {uniforms, context, moduleParameters}: any) {\n uniforms.mask_maskByInstance = this.state.maskByInstance;\n const {maskId, maskInverted} = this.props;\n const {maskChannels} = moduleParameters;\n const {viewport} = context;\n if (maskChannels && maskChannels[maskId]) {\n const {index, bounds, coordinateOrigin: fromCoordinateOrigin} = maskChannels[maskId];\n let {coordinateSystem: fromCoordinateSystem} = maskChannels[maskId];\n uniforms.mask_enabled = true;\n uniforms.mask_channel = index;\n uniforms.mask_inverted = maskInverted;\n\n if (fromCoordinateSystem === COORDINATE_SYSTEM.DEFAULT) {\n fromCoordinateSystem = viewport.isGeospatial\n ? COORDINATE_SYSTEM.LNGLAT\n : COORDINATE_SYSTEM.CARTESIAN;\n }\n const opts = {modelMatrix: null, fromCoordinateOrigin, fromCoordinateSystem};\n const bl = this.projectPosition([bounds[0], bounds[1], 0], opts);\n const tr = this.projectPosition([bounds[2], bounds[3], 0], opts);\n uniforms.mask_bounds = [bl[0], bl[1], tr[0], tr[1]];\n } else {\n if (maskId) {\n log.warn(`Could not find a mask layer with id: ${maskId}`)();\n }\n uniforms.mask_enabled = false;\n }\n }\n}\n"],"file":"mask.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/path-style/path-style.ts"],"names":["defaultProps","getDashArray","type","value","getOffset","dashJustified","dashGapPickable","PathStyleExtension","dash","offset","highPrecisionDash","layer","state","extension","isEnabled","result","opts","dashShaders","offsetShaders","context","attributeManager","getAttributeManager","addInstanced","instanceDashArrays","size","accessor","instanceDashOffsets","transform","getDashOffsets","bind","instanceOffsets","params","uniforms","dashAlignMode","props","Boolean","model","setUniforms","path","positionSize","positionFormat","isNested","Array","isArray","geometrySize","length","p","prevP","i","slice","projectPosition","LayerExtension"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoBA;;AACA;;AACA;;;;;;AAIA,IAAMA,YAAY,GAAG;AACnBC,EAAAA,YAAY,EAAE;AAACC,IAAAA,IAAI,EAAE,UAAP;AAAmBC,IAAAA,KAAK,EAAE,CAAC,CAAD,EAAI,CAAJ;AAA1B,GADK;AAEnBC,EAAAA,SAAS,EAAE;AAACF,IAAAA,IAAI,EAAE,UAAP;AAAmBC,IAAAA,KAAK,EAAE;AAA1B,GAFQ;AAGnBE,EAAAA,aAAa,EAAE,KAHI;AAInBC,EAAAA,eAAe,EAAE;AAJE,CAArB;;IAkDqBC,kB;;;;;AAInB,gCAI4C;AAAA,mFAAJ,EAAI;AAAA,yBAH1CC,IAG0C;AAAA,QAH1CA,IAG0C,0BAHnC,KAGmC;AAAA,2BAF1CC,MAE0C;A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,GAAcN,YAA5D;AAEA,UAAIO,CAAJ;AACA,UAAIC,KAAJ;;AACA,WAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGJ,YAAY,GAAG,CAAnC,EAAsCI,CAAC,EAAvC,EAA2C;AACzCF,QAAAA,CAAC,GAAGL,QAAQ,GAAGH,IAAI,CAACU,CAAD,CAAP,GAAaV,IAAI,CAACW,KAAL,CAAWD,CAAC,GAAGT,YAAf,EAA6BS,CAAC,GAAGT,YAAJ,GAAmBA,YAAhD,CAAzB;AACAO,QAAAA,CAAC,GAAG,KAAKI,eAAL,CAAqBJ,CAArB,CAAJ;;AAEA,YAAIE,CAAC,GAAG,CAAR,EAAW;AACTjC,UAAAA,MAAM,CAACiC,CAAD,CAAN,GAAYjC,MAAM,CAACiC,CAAC,GAAG,CAAL,CAAN,GAAgB,eAAKD,KAAL,EAAYD,CAAZ,CAA5B;AACD;;AAEDC,QAAAA,KAAK,GAAGD,CAAR;AACD;;AACD,aAAO/B,MAAP;AACD;;;EAnG6CoC,oB;;;8BAA3B5C,kB,kBACGP,Y;8BADHO,kB,mBAEI,oB","sourcesContent":["// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport {LayerExtension, _mergeShaders as mergeShaders} from '@deck.gl/core';\nimport {dashShaders, offsetShaders} from './shaders.glsl';\nimport {dist} from 'gl-matrix/vec3';\n\nimport type {Layer, LayerContext, Accessor, UpdateParameters} from '@deck.gl/core';\n\nconst defaultProps = {\n getDashArray: {type: 'accessor', value: [0, 0]},\n getOffset: {type: 'accessor', value: 0},\n dashJustified: false,\n dashGapPickable: false\n};\n\nexport type PathStyleExtensionProps<DataT = any> = {\n /**\n * Accessor for the dash array to draw each path with: `[dashSize, gapSize]` relative to the width of the path.\n * Requires the `dash` option to be on.\n */\n getDashArray?: Accessor<DataT, [number, number]>;\n /**\n * Accessor for the offset to draw each path with, relative to the width of the path.\n * Negative offset is to the left hand side, and positive offset is to the right hand side.\n * @default 0\n */\n getOffset?: Accessor<DataT, number>;\n /**\n * If `true`, adjust gaps for the dashes to align at both ends.\n * @default false\n */\n dashJustified?: boolean;\n /**\n * If `true`, gaps between solid strokes are pickable. If `false`, only the solid strokes are pickable.\n * @default false\n */\n dashGapPickable?: boolean;\n};\n\ntype PathStyleExtensionOptions = {\n /**\n * Add capability to render dashed lines.\n * @default false\n */\n dash: boolean;\n /**\n * Add capability to offset lines.\n * @default false\n */\n offset: boolean;\n /**\n * Improve dash rendering quality in certain circumstances. Note that this option introduces additional performance overhead.\n * @default false\n */\n highPrecisionDash: boolean;\n};\n\n/** Adds selected features to the `PathLayer` and composite layers that render the `PathLayer`. */\nexport default class PathStyleExtension extends LayerExtension<PathStyleExtensionOptions> {\n static defaultProps = defaultProps;\n static extensionName = 'PathStyleExtension';\n\n constructor({\n dash = false,\n offset = false,\n highPrecisionDash = false\n }: Partial<PathStyleExtensionOptions> = {}) {\n super({dash: dash || highPrecisionDash, offset, highPrecisionDash});\n }\n\n isEnabled(layer: Layer<PathStyleExtensionProps>): boolean {\n return 'pathTesselator' in layer.state;\n }\n\n getShaders(this: Layer<PathStyleExtensionProps>, extension: this): any {\n if (!extension.isEnabled(this)) {\n return null;\n }\n\n // Merge shader injection\n let result = {};\n if (extension.opts.dash) {\n result = mergeShaders(result, dashShaders);\n }\n if (extension.opts.offset) {\n result = mergeShaders(result, offsetShaders);\n }\n\n return result;\n }\n\n initializeState(this: Layer<PathStyleExtensionProps>, context: LayerContext, extension: this) {\n const attributeManager = this.getAttributeManager();\n if (!attributeManager || !extension.isEnabled(this)) {\n // This extension only works with the PathLayer\n return;\n }\n\n if (extension.opts.dash) {\n attributeManager.addInstanced({\n instanceDashArrays: {size: 2, accessor: 'getDashArray'}\n });\n }\n if (extension.opts.highPrecisionDash) {\n attributeManager.addInstanced({\n instanceDashOffsets: {\n size: 1,\n accessor: 'getPath',\n transform: extension.getDashOffsets.bind(this)\n }\n });\n }\n if (extension.opts.offset) {\n attributeManager.addInstanced({\n instanceOffsets: {size: 1, accessor: 'getOffset'}\n });\n }\n }\n\n updateState(\n this: Layer<PathStyleExtensionProps>,\n params: UpdateParameters<Layer<PathStyleExtensionProps>>,\n extension: this\n ) {\n if (!extension.isEnabled(this)) {\n return;\n }\n\n const uniforms: any = {};\n\n if (extension.opts.dash) {\n uniforms.dashAlignMode = this.props.dashJustified ? 1 : 0;\n uniforms.dashGapPickable = Boolean(this.props.dashGapPickable);\n }\n\n this.state.model.setUniforms(uniforms);\n }\n\n getDashOffsets(this: Layer<PathStyleExtensionProps>, path: number[] | number[][]): number[] {\n const result = [0];\n const positionSize = this.props.positionFormat === 'XY' ? 2 : 3;\n const isNested = Array.isArray(path[0]);\n const geometrySize = isNested ? path.length : path.length / positionSize;\n\n let p;\n let prevP;\n for (let i = 0; i < geometrySize - 1; i++) {\n p = isNested ? path[i] : path.slice(i * positionSize, i * positionSize + positionSize);\n p = this.projectPosition(p);\n\n if (i > 0) {\n result[i] = result[i - 1] + dist(prevP, p);\n }\n\n prevP = p;\n }\n return result;\n }\n}\n"],"file":"path-style.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/terrain/terrain.ts"],"names":["defaultProps","terrainDrawMode","undefined","TerrainExtension","modules","terrainModule","context","deck","_addDefaultEffect","TerrainEffect","params","props","oldProps","state","extruded","is3d","attributes","getAttributeManager","hasAnchor","setState","terrainCoverNeedsRedraw","LayerExtension"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;;;;;AAIA,IAAMA,YAAY,GAAG;AACnBC,EAAAA,eAAe,EAAEC;AADE,CAArB;;IAoBqBC,gB;;;;;;;;;;;;WAInB,sBAAoD;AAClD,aAAO;AACLC,QAAAA,OAAO,EAAE,CAACC,2BAAD;AADJ,OAAP;AAGD;;;WAED,2BAAoD;AAAA;;AAClD,iCAAKC,OAAL,CAAaC,IAAb,0EAAmBC,iBAAnB,CAAqC,IAAIC,4BAAJ,EAArC;AACD;;;WAED,qBAEEC,MAFF,EAGE;AACA,UAAOC,KAAP,GAA0BD,MAA1B,CAAOC,KAAP;AAAA,UAAcC,QAAd,GAA0BF,MAA1B,CAAcE,QAAd;;AAEA,UACE,KAAKC,KAAL,CAAWZ,eAAX,IACAU,KAAK,CAACV,eAAN,KAA0BW,QAAQ,CAACX,eADnC,IAGAU,KAAK,CAACG,QAAN,KAAmBF,QAAQ,CAACE,QAJ9B,EAKE;AACA;AACD;;AAED,UAAKb,eAAL,GAAwBU,KAAxB,CAAKV,eAAL;;AACA,UAAI,CAACA,eAAL,EAAsB;AAAA;;AAGpB,YAAMc,IAAI,GAAG,KAAKJ,KAAL,CAAWG,QAAxB;AACA,YAAME,UAAU,4BAAG,KAAKC,mBAAL,EAAH,0DAAG,sBAA4BD,UAA/C;AACA,YAAME,SAAS,GAAGF,UAAU,IAAI,uBAAuBA,UAAvD;AACAf,QAAAA,eAAe,GAAGc,IAAI,IAAIG,SAAR,GAAoB,QAApB,GAA+B,OAAjD;AACD;;AACD,WAAKC,QAAL,CAAc;AAAClB,QAAAA,eAAe,EAAfA;AAAD,OAAd;AACD;;;WAED,yBAAqC;AACnC,UAAMY,KAAK,GAAG,KAAKA,KAAnB;;AACA,UAAIA,KAAK,CAACZ,eAAN,KAA0B,OAA9B,EAAuC;AACrCY,QAAAA,KAAK,CAACO,uBAAN,GAAgC,IAAhC;AACD;AACF;;;EA9C2CC,oB;;;8BAAzBlB,gB,kBACGH,Y;8BADHG,gB,mBAEI,kB","sourcesContent":["import {LayerExtension, UpdateParameters} from '@deck.gl/core';\nimport {TerrainEffect} from './terrain-effect';\nimport {terrainModule} from './shader-module';\n\nimport type {Layer} from '@deck.gl/core';\n\nconst defaultProps = {\n terrainDrawMode: undefined\n};\n\nexport type TerrainExtensionProps = {\n /**\n * controls whether an object is drawn over the terrain surface by its anchor (usually defined by an accessor called `getPosition`, e.g. icon, scatterplot) or by its geometry (e.g. path, polygon).\n * If not specified, it is automatically deduced from the layer.\n */\n terrainDrawMode?: 'offset' | 'drape';\n};\n\ntype TerrainExtensionState = {\n /** Resolved fitting mode */\n terrainDrawMode: 'offset' | 'drape';\n /** Set when a layer is flagged as needs redraw */\n terrainCoverNeedsRedraw: boolean;\n};\n\n/** Allows layers to show/hide objects by a geofence. */\nexport default class TerrainExtension extends LayerExtension {\n static defaultProps = defaultProps;\n static extensionName = 'TerrainExtension';\n\n getShaders(this: Layer<TerrainExtensionProps>): any {\n return {\n modules: [terrainModule]\n };\n }\n\n initializeState(this: Layer<TerrainExtensionProps>) {\n this.context.deck?._addDefaultEffect(new TerrainEffect());\n }\n\n updateState(\n this: Layer<TerrainExtensionProps>,\n params: UpdateParameters<Layer<TerrainExtensionProps>>\n ) {\n const {props, oldProps} = params;\n\n if (\n this.state.terrainDrawMode &&\n props.terrainDrawMode === oldProps.terrainDrawMode &&\n // @ts-ignore `extruded` may not exist in props\n props.extruded === oldProps.extruded\n ) {\n return;\n }\n\n let {terrainDrawMode} = props;\n if (!terrainDrawMode) {\n // props.extruded is used as an indication that the layer is 2.5D\n // @ts-ignore `extruded` may not exist in props\n const is3d = this.props.extruded as boolean;\n const attributes = this.getAttributeManager()?.attributes;\n const hasAnchor = attributes && 'instancePositions' in attributes;\n terrainDrawMode = is3d || hasAnchor ? 'offset' : 'drape';\n }\n this.setState({terrainDrawMode});\n }\n\n onNeedsRedraw(this: Layer<{}>): void {\n const state = this.state as TerrainExtensionState;\n if (state.terrainDrawMode === 'drape') {\n state.terrainCoverNeedsRedraw = true;\n }\n }\n}\n"],"file":"terrain.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/brushing/brushing.ts"],"names":["LayerExtension","shaderModule","defaultProps","getBrushingTarget","type","value","brushingTarget","brushingEnabled","brushingRadius","BrushingExtension","getShaders","modules","initializeState","context","extension","attributeManager","getAttributeManager","add","brushingTargets","size","accessor","shaderAttributes","divisor","instanceBrushingTargets","state","onMouseMove","getCurrentLayer","setNeedsRedraw","deck","eventManager","on","pointermove","pointerleave","finalizeState","off"],"mappings":";AAoBA,SAAQA,cAAR,QAA6B,eAA7B;AACA,OAAOC,YAAP,MAAyB,iBAAzB;AAIA,MAAMC,YAAY,GAAG;AACnBC,EAAAA,iBAAiB,EAAE;AAACC,IAAAA,IAAI,EAAE,UAAP;AAAmBC,IAAAA,KAAK,EAAE,CAAC,CAAD,EAAI,CAAJ;AAA1B,GADA;AAGnBC,EAAAA,cAAc,EAAE,QAHG;AAInBC,EAAAA,eAAe,EAAE,IAJE;AAKnBC,EAAAA,cAAc,EAAE;AALG,CAArB;AA8BA,eAAe,MAAMC,iBAAN,SAAgCT,cAAhC,CAA+C;AAI5DU,EAAAA,UAAU,GAAQ;AAChB,WAAO;AACLC,MAAAA,OAAO,EAAE,CAACV,YAAD;AADJ,KAAP;AAGD;;AAEDW,EAAAA,eAAe,CAAsCC,OAAtC,EAA6DC,SAA7D,EAA8E;AAC3F,UAAMC,gBAAgB,GAAG,KAAKC,mBAAL,EAAzB;;AACA,QAAID,gBAAJ,EAAsB;AACpBA,MAAAA,gBAAgB,CAACE,GAAjB,CAAqB;AACnBC,QAAAA,eAAe,EAAE;AACfC,UAAAA,IAAI,EAAE,CADS;AAEfC,UAAAA,QAAQ,EAAE,mBAFK;AAGfC,UAAAA,gBAAgB,EAAE;AAChBH,YAAAA,eAAe,EAAE;AACfI,cAAAA,OAAO,EAAE;AADM,aADD;AAIhBC,YAAAA,uBAAuB,EAAE;AACvBD,cAAAA,OAAO,EAAE;AADc;AAJT;AAHH;AADE,OAArB;AAcD;;AAID,SAAKE,KAAL,CAAWC,WAAX,GAAyB,MAAM;AAAA;;AAC7B,oCAAKC,eAAL,kFAAwBC,cAAxB;AACD,KAFD;;AAGA,QAAId,OAAO,CAACe,IAAZ,EAAkB;AAEhBf,MAAAA,OAAO,CAACe,IAAR,CAAaC,YAAb,CAA0BC,EAA1B,CAA6B;AAC3BC,QAAAA,WAAW,EAAE,KAAKP,KAAL,CAAWC,WADG;AAE3BO,QAAAA,YAAY,EAAE,KAAKR,KAAL,CAAWC;AAFE,OAA7B;AAID;AACF;;AAEDQ,EAAAA,aAAa,CAAsCpB,OAAtC,EAA6DC,SAA7D,EAA8E;AAEzF,QAAID,OAAO,CAACe,IAAZ,EAAkB;AAEhBf,MAAAA,OAAO,CAACe,IAAR,CAAaC,YAAb,CAA0BK,GAA1B,CAA8B;AAC5BH,QAAAA,WAAW,EAAE,KAAKP,KAAL,CAAWC,WADI;AAE5BO,QAAAA,YAAY,EAAE,KAAKR,KAAL,CAAWC;AAFG,OAA9B;AAID;AACF;;AApD2D;;gBAAzChB,iB,kBACGP,Y;;gBADHO,iB,mBAEI,mB","sourcesContent":["// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport {LayerExtension} from '@deck.gl/core';\nimport shaderModule from './shader-module';\n\nimport type {Layer, LayerContext, Accessor} from '@deck.gl/core';\n\nconst defaultProps = {\n getBrushingTarget: {type: 'accessor', value: [0, 0]},\n\n brushingTarget: 'source',\n brushingEnabled: true,\n brushingRadius: 10000\n};\n\nexport type BrushingExtensionProps<DataT = any> = {\n /**\n * Called to retrieve an arbitrary position for each object that it will be filtered by.\n * Only effective if `brushingTarget` is set to `custom`.\n */\n getBrushingTarget?: Accessor<DataT, [number, number]>;\n /**\n * Enable/disable brushing. If brushing is disabled, all objects are rendered.\n * @default true\n */\n brushingEnabled?: boolean;\n /**\n * The position used to filter each object by.\n */\n brushingTarget?: 'source' | 'target' | 'source_target' | 'custom';\n /** The brushing radius centered at the pointer, in meters. If a data object is within this circle, it is rendered; otherwise it is hidden.\n * @default 10000\n */\n brushingRadius?: number;\n};\n\n/** Adds GPU-based data brushing functionalities to layers. It allows the layer to show/hide objects based on the current pointer position. */\nexport default class BrushingExtension extends LayerExtension {\n static defaultProps = defaultProps;\n static extensionName = 'BrushingExtension';\n\n getShaders(): any {\n return {\n modules: [shaderModule]\n };\n }\n\n initializeState(this: Layer<BrushingExtensionProps>, context: LayerContext, extension: this) {\n const attributeManager = this.getAttributeManager();\n if (attributeManager) {\n attributeManager.add({\n brushingTargets: {\n size: 2,\n accessor: 'getBrushingTarget',\n shaderAttributes: {\n brushingTargets: {\n divisor: 0\n },\n instanceBrushingTargets: {\n divisor: 1\n }\n }\n }\n });\n }\n\n // Trigger redraw when mouse moves\n // TODO - expose this in a better way\n this.state.onMouseMove = () => {\n this.getCurrentLayer()?.setNeedsRedraw();\n };\n if (context.deck) {\n // @ts-expect-error (2446) accessing protected property\n context.deck.eventManager.on({\n pointermove: this.state.onMouseMove,\n pointerleave: this.state.onMouseMove\n });\n }\n }\n\n finalizeState(this: Layer<BrushingExtensionProps>, context: LayerContext, extension: this) {\n // Remove event listeners\n if (context.deck) {\n // @ts-expect-error (2446) accessing protected property\n context.deck.eventManager.off({\n pointermove: this.state.onMouseMove,\n pointerleave: this.state.onMouseMove\n });\n }\n }\n}\n"],"file":"brushing.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/clip/clip.ts"],"names":["LayerExtension","defaultProps","clipBounds","clipByInstance","undefined","shaderFunction","shaderModuleVs","name","vs","injectionVs","shaderModuleFs","fs","injectionFs","ClipExtension","getShaders","getAttributeManager","attributes","props","Boolean","state","modules","inject","draw","uniforms","clip_bounds","corner0","projectPosition","corner1","Math","min","max"],"mappings":";AAoBA,SAAQA,cAAR,QAA4D,eAA5D;AAIA,MAAMC,YAAY,GAAG;AACnBC,EAAAA,UAAU,EAAE,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV,CADO;AAEnBC,EAAAA,cAAc,EAAEC;AAFG,CAArB;AAiBA,MAAMC,cAAc,oNAApB;AAYA,MAAMC,cAA4B,GAAG;AACnCC,EAAAA,IAAI,EAAE,SAD6B;AAEnCC,EAAAA,EAAE,EAAEH;AAF+B,CAArC;AAKA,MAAMI,WAAW,GAAG;AAClB,iDADkB;AAIlB,6GAJkB;AAOlB,iDAPkB;AAUlB;AAVkB,CAApB;AAmBA,MAAMC,cAA4B,GAAG;A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AA,QAAQ,CAACC,WAAT,GAAuB,CACrBI,IAAI,CAACC,GAAL,CAASJ,OAAO,CAAC,CAAD,CAAhB,EAAqBE,OAAO,CAAC,CAAD,CAA5B,CADqB,EAErBC,IAAI,CAACC,GAAL,CAASJ,OAAO,CAAC,CAAD,CAAhB,EAAqBE,OAAO,CAAC,CAAD,CAA5B,CAFqB,EAGrBC,IAAI,CAACE,GAAL,CAASL,OAAO,CAAC,CAAD,CAAhB,EAAqBE,OAAO,CAAC,CAAD,CAA5B,CAHqB,EAIrBC,IAAI,CAACE,GAAL,CAASL,OAAO,CAAC,CAAD,CAAhB,EAAqBE,OAAO,CAAC,CAAD,CAA5B,CAJqB,CAAvB;AAMD;AACF;;AA5CuD;;gBAArCd,a,kBACGZ,Y;;gBADHY,a,mBAEI,e","sourcesContent":["// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport {LayerExtension, _ShaderModule as ShaderModule} from '@deck.gl/core';\n\nimport type {Layer} from '@deck.gl/core';\n\nconst defaultProps = {\n clipBounds: [0, 0, 1, 1],\n clipByInstance: undefined\n};\n\nexport type ClipExtensionProps = {\n /** Rectangular bounds to be used for clipping the rendered region, in `[left, bottom, right, top]`.\n * @default [0, 0, 1, 1]\n */\n clipBounds?: [number, number, number, number];\n /**\n * Controls whether an object is clipped by its anchor (e.g. icon, point) or by its geometry (e.g. path, polygon).\n * If not specified, it is automatically deduced from the layer.\n */\n clipByInstance?: boolean;\n};\n\nconst shaderFunction = `\nuniform vec4 clip_bounds;\n\nbool clip_isInBounds(vec2 position) {\n return position.x >= clip_bounds[0] && position.y >= clip_bounds[1] && position.x < clip_bounds[2] && position.y < clip_bounds[3];\n}\n`;\n\n/*\n * The vertex-shader version clips geometries by their anchor position\n * e.g. ScatterplotLayer - show if the center of a circle is within bounds\n */\nconst shaderModuleVs: ShaderModule = {\n name: 'clip-vs',\n vs: shaderFunction\n};\n\nconst injectionVs = {\n 'vs:#decl': `\nvarying float clip_isVisible;\n`,\n 'vs:DECKGL_FILTER_GL_POSITION': `\n clip_isVisible = float(clip_isInBounds(geometry.worldPosition.xy));\n`,\n 'fs:#decl': `\nvarying float clip_isVisible;\n`,\n 'fs:DECKGL_FILTER_COLOR': `\n if (clip_isVisible < 0.5) discard;\n`\n};\n\n/*\n * The fragment-shader version clips pixels at the bounds\n * e.g. PolygonLayer - show the part of the polygon that intersect with the bounds\n */\nconst shaderModuleFs: ShaderModule = {\n name: 'clip-fs',\n fs: shaderFunction\n};\n\nconst injectionFs = {\n 'vs:#decl': `\nvarying vec2 clip_commonPosition;\n`,\n 'vs:DECKGL_FILTER_GL_POSITION': `\n clip_commonPosition = geometry.position.xy;\n`,\n 'fs:#decl': `\nvarying vec2 clip_commonPosition;\n`,\n 'fs:DECKGL_FILTER_COLOR': `\n if (!clip_isInBounds(clip_commonPosition)) discard;\n`\n};\n\n/** Adds support for clipping rendered layers by rectangular bounds. */\nexport default class ClipExtension extends LayerExtension {\n static defaultProps = defaultProps;\n static extensionName = 'ClipExtension';\n\n getShaders(this: Layer<ClipExtensionProps>) {\n // If `clipByInstance: true`, the entire object is shown/hidden based on its anchor position (done by vertex shader)\n // Otherwise, the object is trimmed by the clip bounds (done by fragment shader)\n\n // Default behavior: consider a layer instanced if it has attribute `instancePositions`\n // @ts-expect-error attributeManager is always defined for primitive layers\n let clipByInstance = 'instancePositions' in this.getAttributeManager().attributes;\n // Users can override by setting the `clipByInstance` prop\n if (this.props.clipByInstance !== undefined) {\n clipByInstance = Boolean(this.props.clipByInstance);\n }\n this.state.clipByInstance = clipByInstance;\n\n return clipByInstance\n ? {\n modules: [shaderModuleVs],\n inject: injectionVs\n }\n : {\n modules: [shaderModuleFs],\n inject: injectionFs\n };\n }\n\n /* eslint-disable camelcase */\n draw(this: Layer<Required<ClipExtensionProps>>, {uniforms}: any): void {\n const {clipBounds} = this.props;\n if (this.state.clipByInstance) {\n uniforms.clip_bounds = clipBounds;\n } else {\n const corner0 = this.projectPosition([clipBounds[0], clipBounds[1], 0]);\n const corner1 = this.projectPosition([clipBounds[2], clipBounds[3], 0]);\n\n uniforms.clip_bounds = [\n Math.min(corner0[0], corner1[0]),\n Math.min(corner0[1], corner1[1]),\n Math.max(corner0[0], corner1[0]),\n Math.max(corner0[1], corner1[1])\n ];\n }\n }\n}\n"],"file":"clip.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/collision-filter/collision-filter.ts"],"names":["LayerExtension","collision","CollisionFilterEffect","defaultProps","getCollisionPriority","type","value","collisionEnabled","collisionGroup","collisionTestProps","CollisionFilterExtension","getShaders","modules","draw","uniforms","context","moduleParameters","props","collisionFBO","drawToCollisionMap","enabled","Boolean","collision_enabled","clone","initializeState","extension","getAttributeManager","deck","_addDefaultEffect","attributeManager","add","collisionPriorities","size","accessor","shaderAttributes","divisor","instanceCollisionPriorities","getNeedsPickingBuffer"],"mappings":";AAAA,SAAuCA,cAAvC,QAA4D,eAA5D;AACA,OAAOC,SAAP,MAAsB,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AgB,CAAEC,GAAlB,CAAsB;AACpBC,MAAAA,mBAAmB,EAAE;AACnBC,QAAAA,IAAI,EAAE,CADa;AAEnBC,QAAAA,QAAQ,EAAE,sBAFS;AAGnBC,QAAAA,gBAAgB,EAAE;AAChBH,UAAAA,mBAAmB,EAAE;AAACI,YAAAA,OAAO,EAAE;AAAV,WADL;AAEhBC,UAAAA,2BAA2B,EAAE;AAACD,YAAAA,OAAO,EAAE;AAAV;AAFb;AAHC;AADD,KAAtB;AAUD;;AAEDE,EAAAA,qBAAqB,GAAsD;AACzE,WAAO,KAAKpB,KAAL,CAAWV,gBAAlB;AACD;;AA9CkE;;gBAAhDG,wB,kBACGP,Y;;gBADHO,wB,mBAEI,0B","sourcesContent":["import {Accessor, Layer, LayerContext, LayerExtension} from '@deck.gl/core';\nimport collision from './shader-module';\nimport CollisionFilterEffect from './collision-filter-effect';\n\nconst defaultProps = {\n getCollisionPriority: {type: 'accessor', value: 0},\n collisionEnabled: true,\n collisionGroup: {type: 'string', value: 'default'},\n collisionTestProps: {}\n};\n\nexport type CollisionFilterExtensionProps<DataT = any> = {\n /**\n * Accessor for collision priority. Must return a number in the range -1000 -> 1000. Features with higher values are shown preferentially.\n */\n getCollisionPriority?: Accessor<DataT, number>;\n\n /**\n * Enable/disable collisions. If collisions are disabled, all objects are rendered.\n * @default true\n */\n collisionEnabled: boolean;\n\n /**\n * Collision group this layer belongs to. If it is not set, the 'default' collision group is used\n */\n collisionGroup?: string;\n\n /**\n * Props to override when rendering collision map\n */\n collisionTestProps?: {};\n};\n\n/** Allows layers to hide overlapping objects. */\nexport default class CollisionFilterExtension extends LayerExtension {\n static defaultProps = defaultProps;\n static extensionName = 'CollisionFilterExtension';\n\n getShaders(this: Layer<CollisionFilterExtensionProps>): any {\n return {modules: [collision]};\n }\n\n /* eslint-disable camelcase */\n draw(this: Layer<CollisionFilterExtensionProps>, {uniforms, context, moduleParameters}: any) {\n const {collisionEnabled} = this.props;\n const {collisionFBO, drawToCollisionMap} = moduleParameters;\n const enabled = collisionEnabled && Boolean(collisionFBO);\n uniforms.collision_enabled = enabled;\n\n if (drawToCollisionMap) {\n // Override any props with those defined in collisionTestProps\n // @ts-ignore\n this.props = this.clone(this.props.collisionTestProps).props;\n }\n }\n\n initializeState(\n this: Layer<CollisionFilterExtensionProps>,\n context: LayerContext,\n extension: this\n ) {\n if (this.getAttributeManager() === null) {\n return;\n }\n this.context.deck?._addDefaultEffect(new CollisionFilterEffect());\n const attributeManager = this.getAttributeManager();\n attributeManager!.add({\n collisionPriorities: {\n size: 1,\n accessor: 'getCollisionPriority',\n shaderAttributes: {\n collisionPriorities: {divisor: 0},\n instanceCollisionPriorities: {divisor: 1}\n }\n }\n });\n }\n\n getNeedsPickingBuffer(this: Layer<CollisionFilterExtensionProps>): boolean {\n return this.props.collisionEnabled;\n }\n}\n"],"file":"collision-filter.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/data-filter/data-filter.ts"],"names":["LayerExtension","shaderModule","shaderModule64","aggregator","readPixelsToArray","clear","defaultProps","getFilterValue","type","value","onFilteredItemsChange","optional","filterEnabled","filterRange","filterSoftRange","filterTransformSize","filterTransformColor","DATA_TYPE_FROM_SIZE","DataFilterExtension","constructor","filterSize","fp64","countItems","Error","getShaders","extension","opts","modules","defines","DATAFILTER_TYPE","DATAFILTER_DOUBLE","Boolean","initializeState","context","attributeManager","getAttributeManager","add","filterValues","size","accessor","shaderAttributes","divisor","instanceFilterValues","gl","useFloatTarget","supportsFloatTarget","filterIndices","vertexOffset","normalized","object","index","i","__source","Math","floor","filterPrevIndices","filterFBO","getFramebuffer","filterModel","getModel","call","setState","updateState","props","oldProps","state","filterNeedsUpdate","attributes","needsUpdate","draw","params","setVertexCount","getNumInstances","framebuffer","color","updateModuleSettings","moduleParameters","setAttributes","getShaderAttributes","parameters","viewport","width","height","count","length","id","finalizeState","delete"],"mappings":";AAoBA,SAAQA,cAAR,QAA6B,eAA7B;AACA,SAAQC,YAAR,EAAsBC,c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;AAFA;AAFR,OANR;AAaA,YAAMR,KAAK,GAAGtE,iBAAiB,CAACoD,SAAD,CAA/B;AACA,UAAI2B,KAAK,GAAG,CAAZ;;AACA,WAAK,IAAIhC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGuB,KAAK,CAACU,MAA1B,EAAkCjC,CAAC,EAAnC,EAAuC;AACrCgC,QAAAA,KAAK,IAAIT,KAAK,CAACvB,CAAD,CAAd;AACD;;AACDzC,MAAAA,qBAAqB,CAAC;AAAC2E,QAAAA,EAAE,EAAE,KAAKA,EAAV;AAAcF,QAAAA;AAAd,OAAD,CAArB;AAEA,WAAKlB,KAAL,CAAWC,iBAAX,GAA+B,KAA/B;AACD;AACF;;AAEDoB,EAAAA,aAAa,GAAwC;AACnD,UAAM;AAAC9B,MAAAA,SAAD;AAAYE,MAAAA;AAAZ,QAA2B,KAAKO,KAAtC;;AACA,QAAIT,SAAJ,EAAe;AACbA,MAAAA,SAAS,CAACkB,KAAV,CAAgBa,MAAhB;AACA/B,MAAAA,SAAS,CAAC+B,MAAV;AACA7B,MAAAA,WAAW,CAAC6B,MAAZ;AACD;AACF;;AAlJyF;;gBAAvErE,mB,kBACGZ,Y;;gBADHY,mB,mBAEI,qB","sourcesContent":["// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport {LayerExtension} from '@deck.gl/core';\nimport {shaderModule, shaderModule64} from './shader-module';\nimport * as aggregator from './aggregator';\nimport {readPixelsToArray, clear} from '@luma.gl/core';\nimport GL from '@luma.gl/constants';\n\nimport type {Layer, LayerContext, Accessor, UpdateParameters} from '@deck.gl/core';\n\nconst defaultProps = {\n getFilterValue: {type: 'accessor', value: 0},\n onFilteredItemsChange: {type: 'function', value: null, optional: true},\n\n filterEnabled: true,\n filterRange: [-1, 1],\n filterSoftRange: null,\n filterTransformSize: true,\n filterTransformColor: true\n};\n\nexport type DataFilterExtensionProps<DataT = any> = {\n /**\n * Accessor to retrieve the value for each object that it will be filtered by.\n * Returns either a number (if `filterSize: 1`) or an array of numbers.\n */\n getFilterValue?: Accessor<DataT, number | number[]>;\n /**\n * Enable/disable the data filter. If the data filter is disabled, all objects are rendered.\n * @default true\n */\n filterEnabled?: boolean;\n /**\n * The [min, max] bounds which defines whether an object should be rendered.\n * If an object's filtered value is within the bounds, the object will be rendered; otherwise it will be hidden.\n * @default [-1, 1]\n */\n filterRange?: [number, number] | [number, number][];\n /**\n * If specified, objects will be faded in/out instead of abruptly shown/hidden.\n * When the filtered value is outside of the bounds defined by `filterSoftRange` but still within the bounds defined by `filterRange`, the object will be rendered as \"faded.\"\n * @default null\n */\n filterSoftRange?: [number, number] | [number, number][] | null;\n /**\n * When an object is \"faded\", manipulate its size so that it appears smaller or thinner. Only works if `filterSoftRange` is specified.\n * @default true\n */\n filterTransformSize?: boolean;\n /**\n * When an object is \"faded\", manipulate its opacity so that it appears more translucent. Only works if `filterSoftRange` is specified.\n * @default true\n */\n filterTransformColor?: boolean;\n /**\n * Only called if the `countItems` option is enabled.\n */\n onFilteredItemsChange?: (evt: {\n /** The id of the source layer. */\n id: string;\n /** The number of data objects that pass the filter. */\n count: number;\n }) => void;\n};\n\ntype DataFilterExtensionOptions = {\n /**\n * The size of the filter (number of columns to filter by). The data filter can show/hide data based on 1-4 numeric properties of each object.\n * @default 1\n */\n filterSize: number;\n /**\n * Use 64-bit precision instead of 32-bit.\n * @default false\n */\n fp64: boolean;\n /**\n * If `true`, reports the number of filtered objects with the `onFilteredItemsChange` callback.\n * @default `false`.\n */\n countItems: boolean;\n};\n\nconst DATA_TYPE_FROM_SIZE = {\n 1: 'float',\n 2: 'vec2',\n 3: 'vec3',\n 4: 'vec4'\n};\n\n/** Adds GPU-based data filtering functionalities to layers. It allows the layer to show/hide objects based on user-defined properties. */\nexport default class DataFilterExtension extends LayerExtension<DataFilterExtensionOptions> {\n static defaultProps = defaultProps;\n static extensionName = 'DataFilterExtension';\n\n constructor({\n filterSize = 1,\n fp64 = false,\n countItems = false\n }: Partial<DataFilterExtensionOptions> = {}) {\n if (!DATA_TYPE_FROM_SIZE[filterSize]) {\n throw new Error('filterSize out of range');\n }\n\n super({filterSize, fp64, countItems});\n }\n\n getShaders(this: Layer<DataFilterExtensionProps>, extension: this): any {\n const {filterSize, fp64} = extension.opts;\n\n return {\n modules: [fp64 ? shaderModule64 : shaderModule],\n defines: {\n DATAFILTER_TYPE: DATA_TYPE_FROM_SIZE[filterSize],\n DATAFILTER_DOUBLE: Boolean(fp64)\n }\n };\n }\n\n initializeState(this: Layer<DataFilterExtensionProps>, context: LayerContext, extension: this) {\n const attributeManager = this.getAttributeManager();\n if (attributeManager) {\n attributeManager.add({\n filterValues: {\n size: extension.opts.filterSize,\n type: extension.opts.fp64 ? GL.DOUBLE : GL.FLOAT,\n accessor: 'getFilterValue',\n shaderAttributes: {\n filterValues: {\n divisor: 0\n },\n instanceFilterValues: {\n divisor: 1\n }\n }\n }\n });\n }\n\n const {gl} = this.context;\n if (attributeManager && extension.opts.countItems) {\n const useFloatTarget = aggregator.supportsFloatTarget(gl);\n // This attribute is needed for variable-width data, e.g. Path, SolidPolygon, Text\n // The vertex shader checks if a vertex has the same \"index\" as the previous vertex\n // so that we only write one count cross multiple vertices of the same object\n attributeManager.add({\n filterIndices: {\n size: useFloatTarget ? 1 : 2,\n vertexOffset: 1,\n type: GL.UNSIGNED_BYTE,\n normalized: true,\n accessor: (object, {index}) => {\n const i = object && object.__source ? object.__source.index : index;\n return useFloatTarget ? (i + 1) % 255 : [(i + 1) % 255, Math.floor(i / 255) % 255];\n },\n shaderAttributes: {\n filterPrevIndices: {\n vertexOffset: 0\n },\n filterIndices: {\n vertexOffset: 1\n }\n }\n }\n });\n\n const filterFBO = aggregator.getFramebuffer(gl, useFloatTarget);\n const filterModel = aggregator.getModel(\n gl,\n extension.getShaders.call(this, extension),\n useFloatTarget\n );\n this.setState({filterFBO, filterModel});\n }\n }\n\n updateState(\n this: Layer<DataFilterExtensionProps>,\n {props, oldProps}: UpdateParameters<Layer<DataFilterExtensionProps>>\n ) {\n if (this.state.filterModel) {\n const attributeManager = this.getAttributeManager();\n const filterNeedsUpdate =\n // attributeManager must be defined for filterModel to be set\n attributeManager!.attributes.filterValues.needsUpdate() ||\n props.filterEnabled !== oldProps.filterEnabled ||\n props.filterRange !== oldProps.filterRange ||\n props.filterSoftRange !== oldProps.filterSoftRange;\n if (filterNeedsUpdate) {\n this.setState({filterNeedsUpdate});\n }\n }\n }\n\n draw(this: Layer<DataFilterExtensionProps>, params: any, extension: this) {\n const {filterFBO, filterModel, filterNeedsUpdate} = this.state;\n const {onFilteredItemsChange} = this.props;\n if (filterNeedsUpdate && onFilteredItemsChange && filterModel) {\n const {\n attributes: {filterValues, filterIndices}\n } = this.getAttributeManager()!;\n filterModel.setVertexCount(this.getNumInstances());\n\n const {gl} = this.context;\n clear(gl, {framebuffer: filterFBO, color: [0, 0, 0, 0]});\n\n filterModel\n .updateModuleSettings(params.moduleParameters)\n .setAttributes({\n ...filterValues.getShaderAttributes(),\n ...(filterIndices && filterIndices.getShaderAttributes())\n })\n .draw({\n framebuffer: filterFBO,\n parameters: {\n ...aggregator.parameters,\n viewport: [0, 0, filterFBO.width, filterFBO.height]\n }\n });\n const color = readPixelsToArray(filterFBO);\n let count = 0;\n for (let i = 0; i < color.length; i++) {\n count += color[i];\n }\n onFilteredItemsChange({id: this.id, count});\n\n this.state.filterNeedsUpdate = false;\n }\n }\n\n finalizeState(this: Layer<DataFilterExtensionProps>) {\n const {filterFBO, filterModel} = this.state;\n if (filterFBO) {\n filterFBO.color.delete();\n filterFBO.delete();\n filterModel.delete();\n }\n }\n}\n"],"file":"data-filter.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/fill-style/fill-style.ts"],"names":["LayerExtension","Texture2D","patternShaders","defaultProps","fillPatternEnabled","fillPatternAtlas","type","value","async","parameters","fillPatternMapping","fillPatternMask","getFillPattern","d","pattern","getFillPatternScale","getFillPatternOffset","FillStyleExtension","constructor","isEnabled","layer","getAttributeManager","state","getShaders","extension","modules","opts","filter","Boolean","initializeState","context","attributeManager","add","fillPatternFrames","size","accessor","transform","getPatternFrame","bind","shaderAttributes","divisor","instanceFillPatternFrames","fillPatternScales","defaultValue","instanceFillPatternScales","fillPatternOffsets","instanceFillPatternOffsets","setState","emptyTexture","gl","data","Uint8Array","width","height","updateState","props","oldProps","invalidate","draw","params","setModuleParameters","fillPatternTexture","finalizeState","patternTexture","delete","name","getCurrentLayer","def","x","y"],"mappings":";AAAA,SAAQA,cAAR,QAA6B,eAA7B;AACA,SAAQC,SAAR,QAAwB,eAAxB;AAGA,SAAQC,cAAR,QAA6B,gBAA7B;AAWA,MAAMC,YAAY,GAAG;AACnBC,EAAAA,kBAAkB,EAAE,IADD;AAEnBC,EAAAA,gBAAgB,EAAE;AAChBC,IAAAA,IAAI,EAAE,OADU;AAEhBC,IAAAA,KAAK,EAAE,IAFS;AAGhBC,IAAAA,KAAK,EAAE,IAHS;AAIhBC,IAAAA,UAAU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,GAAGzD,kBAAkB,IAAIA,kBAAkB,CAACuD,IAAD,CAApD;AACA,WAAOE,GAAG,GAAG,CAACA,GAAG,CAACC,CAAL,EAAQD,GAAG,CAACE,CAAZ,EAAeF,GAAG,CAACf,KAAnB,EAA0Be,GAAG,CAACd,MAA9B,CAAH,GAA2C,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV,CAArD;AACD;;AAnHuF;;gBAArEpC,kB,kBACGd,Y;;gBADHc,kB,mBAEI,oB","sourcesContent":["import {LayerExtension} from '@deck.gl/core';\nimport {Texture2D} from '@luma.gl/core';\nimport GL from '@luma.gl/constants';\n\nimport {patternShaders} from './shaders.glsl';\n\nimport type {\n Layer,\n LayerContext,\n Accessor,\n AccessorFunction,\n Texture,\n UpdateParameters\n} from '@deck.gl/core';\n\nconst defaultProps = {\n fillPatternEnabled: true,\n fillPatternAtlas: {\n type: 'image',\n value: null,\n async: true,\n parameters: {\n [GL.TEXTURE_MIN_FILTER]: GL.LINEAR\n }\n },\n fillPatternMapping: {type: 'object', value: {}, async: true},\n fillPatternMask: true,\n getFillPattern: {type: 'accessor', value: d => d.pattern},\n getFillPatternScale: {type: 'accessor', value: 1},\n getFillPatternOffset: {type: 'accessor', value: [0, 0]}\n};\n\nexport type FillStyleExtensionProps<DataT = any> = {\n /** Cheap toggle to enable/disable pattern fill. Requires the `pattern` option to be on.\n * @default true\n */\n fillPatternEnabled?: boolean;\n /** Sprite image url or texture that packs all your patterns into one layout. */\n fillPatternAtlas?: string | Texture;\n /** Pattern names mapped to pattern definitions, or a url that points to a JSON file. */\n fillPatternMapping?:\n | string\n | Record<\n string,\n {\n /** Left position of the pattern on the atlas */\n x: number;\n /** Top position of the pattern on the atlas */\n y: number;\n /** Width of the pattern */\n width: number;\n /** Height of the pattern */\n height: number;\n }\n >;\n /**\n * Whether to treat the patterns as transparency masks.\n * @default true\n */\n fillPatternMask?: boolean;\n /** Accessor for the name of the pattern. */\n getFillPattern?: AccessorFunction<DataT, string>;\n /** Accessor for the scale of the pattern, relative to the original size. If the pattern is 24 x 24 pixels, scale `1` roughly yields 24 meters.\n * @default 1\n */\n getFillPatternScale?: Accessor<DataT, number>;\n /**\n * Accessor for the offset of the pattern, relative to the original size. Offset `[0.5, 0.5]` shifts the pattern alignment by half.\n * @default [0, 0]\n */\n getFillPatternOffset?: Accessor<DataT, [number, number]>;\n};\n\ntype FillStyleExtensionOptions = {\n /** If `true`, adds the ability to tile the filled area with a pattern.\n * @default false\n */\n pattern: boolean;\n};\n\n/** Adds selected features to layers that render a \"fill\", such as the `PolygonLayer` and `ScatterplotLayer`. */\nexport default class FillStyleExtension extends LayerExtension<FillStyleExtensionOptions> {\n static defaultProps = defaultProps;\n static extensionName = 'FillStyleExtension';\n\n constructor({pattern = false}: Partial<FillStyleExtensionOptions> = {}) {\n super({pattern});\n }\n\n isEnabled(layer: Layer<FillStyleExtensionProps>): boolean {\n return layer.getAttributeManager() !== null && !('pathTesselator' in layer.state);\n }\n\n getShaders(this: Layer<FillStyleExtensionProps>, extension: this): any {\n if (!extension.isEnabled(this)) {\n return null;\n }\n\n return {\n modules: [extension.opts.pattern && patternShaders].filter(Boolean)\n };\n }\n\n initializeState(this: Layer<FillStyleExtensionProps>, context: LayerContext, extension: this) {\n if (!extension.isEnabled(this)) {\n return;\n }\n\n const attributeManager = this.getAttributeManager();\n\n if (extension.opts.pattern) {\n attributeManager!.add({\n fillPatternFrames: {\n size: 4,\n accessor: 'getFillPattern',\n transform: extension.getPatternFrame.bind(this),\n shaderAttributes: {\n fillPatternFrames: {\n divisor: 0\n },\n instanceFillPatternFrames: {\n divisor: 1\n }\n }\n },\n fillPatternScales: {\n size: 1,\n accessor: 'getFillPatternScale',\n defaultValue: 1,\n shaderAttributes: {\n fillPatternScales: {\n divisor: 0\n },\n instanceFillPatternScales: {\n divisor: 1\n }\n }\n },\n fillPatternOffsets: {\n size: 2,\n accessor: 'getFillPatternOffset',\n shaderAttributes: {\n fillPatternOffsets: {\n divisor: 0\n },\n instanceFillPatternOffsets: {\n divisor: 1\n }\n }\n }\n });\n }\n this.setState({\n emptyTexture: new Texture2D(this.context.gl, {\n data: new Uint8Array(4),\n width: 1,\n height: 1\n })\n });\n }\n\n updateState(\n this: Layer<FillStyleExtensionProps>,\n {props, oldProps}: UpdateParameters<Layer<FillStyleExtensionProps>>,\n extension: this\n ) {\n if (!extension.isEnabled(this)) {\n return;\n }\n\n if (props.fillPatternMapping && props.fillPatternMapping !== oldProps.fillPatternMapping) {\n this.getAttributeManager()!.invalidate('getFillPattern');\n }\n }\n\n draw(this: Layer<FillStyleExtensionProps>, params: any, extension: this) {\n if (!extension.isEnabled(this)) {\n return;\n }\n\n const {fillPatternAtlas} = this.props;\n this.setModuleParameters({\n fillPatternTexture: fillPatternAtlas || this.state.emptyTexture\n });\n }\n\n finalizeState(this: Layer<FillStyleExtensionProps>) {\n const {patternTexture, emptyTexture} = this.state;\n patternTexture?.delete();\n emptyTexture?.delete();\n }\n\n getPatternFrame(this: Layer<FillStyleExtensionProps>, name: string) {\n const {fillPatternMapping} = this.getCurrentLayer()!.props;\n const def = fillPatternMapping && fillPatternMapping[name];\n return def ? [def.x, def.y, def.width, def.height] : [0, 0, 0, 0];\n }\n}\n"],"file":"fill-style.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/fp64/fp64.ts"],"names":["LayerExtension","COORDINATE_SYSTEM","project64","Fp64Extension","getShaders","coordinateSystem","props","LNGLAT","DEFAULT","Error","modules"],"mappings":";AAoBA,SAAQA,cAAR,EAAwBC,iBAAxB,QAAgD,eAAhD;AACA,OAAOC,SAAP,MAAsB,aAAtB;AAKA,eAAe,MAAMC,aAAN,SAA4BH,cAA5B,CAA2C;AAGxDI,EAAAA,UAAU,GAAmB;AAC3B,UAAM;AAACC,MAAAA;AAAD,QAAqB,KAAKC,KAAhC;;AACA,QACED,gBAAgB,KAAKJ,iBAAiB,CAACM,MAAvC,IACAF,gBAAgB,KAAKJ,iBAAiB,CAACO,OAFzC,EAGE;AACA,YAAM,IAAIC,KAAJ,CAAU,uCAAV,CAAN;AACD;;AAED,WAAO;AACLC,MAAAA,OAAO,EAAE,CAACR,SAAD;AADJ,KAAP;AAGD;;AAfuD;;gBAArCC,a,mBACI,e","sourcesContent":["// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport {LayerExtension, COORDINATE_SYSTEM} from '@deck.gl/core';\nimport project64 from './project64';\n\nimport type {Layer} from '@deck.gl/core';\n\n/** @deprecated Adds the legacy 64-bit precision to geospatial layers. */\nexport default class Fp64Extension extends LayerExtension {\n static extensionName = 'Fp64Extension';\n\n getShaders(this: Layer): any {\n const {coordinateSystem} = this.props;\n if (\n coordinateSystem !== COORDINATE_SYSTEM.LNGLAT &&\n coordinateSystem !== COORDINATE_SYSTEM.DEFAULT\n ) {\n throw new Error('fp64: coordinateSystem must be LNGLAT');\n }\n\n return {\n modules: [project64]\n };\n }\n}\n"],"file":"fp64.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/mask/mask.ts"],"names":["COORDINATE_SYSTEM","LayerExtension","log","mask","MaskEffect","defaultProps","maskId","maskByInstance","undefined","maskInverted","MaskExtension","initializeState","context","deck","_addDefaultEffect","getShaders","getAttributeManager","attributes","props","Boolean","state","modules","draw","uniforms","moduleParameters","mask_maskByInstance","maskChannels","viewport","index","bounds","coordinateOrigin","fromCoordinateOrigin","coordinateSystem","fromCoordinateSystem","mask_enabled","mask_channel","mask_inverted","DEFAULT","isGeospatial","LNGLAT","CARTESIAN","opts","modelMatrix","bl","projectPosition","tr","mask_bounds","warn"],"mappings":";AAAA,SAAQA,iBAAR,EAAkCC,cAAlC,EAAkDC,GAAlD,QAA4D,eAA5D;AACA,OAAOC,IAAP,MAAiB,iBAAjB;AACA,OAAOC,UAAP,MAAuB,eAAvB;AAEA,MAAMC,YAAY,GAAG;AACnBC,EAAAA,MAAM,EAAE,EADW;AAEnBC,EAAAA,cAAc,EAAEC,SAFG;AAGnBC,EAAAA,YAAY,EAAE;AAHK,CAArB;AAwBA,eAAe,MAAMC,aAAN,SAA4BT,cAA5B,CAA2C;AAIxDU,EAAAA,eAAe,GAAkC;AAAA;;AAC/C,+BAAKC,OAAL,CAAaC,IAAb,0EAAmBC,iBAAnB,CAAqC,IAAIV,UAAJ,EAArC;AACD;;AAEDW,EAAAA,UAAU,GAAuC;AAE/C,QAAIR,cAAc,IAAG,uBAAuB,KAAKS,mBAAL,GAA4BC,UAAtD,CAAlB;;AAEA,QAAI,KAAKC,KAAL,CAAWX,cAAX,KAA8BC,SAAlC,EAA6C;AAC3CD,MAAAA,cAAc,GAAGY,OAAO,CAAC,KAAKD,KAAL,CAAWX,cAAZ,CAAxB;AACD;;AACD,SAAKa,KAAL,CAAWb,cAAX,GAA4BA,cAA5B;AAEA,WAAO;AACLc,MAAAA,OAAO,EAAE,CAAClB,IAAD;AADJ,KAAP;AAGD;;AAGDmB,EAAAA,IAAI,CAA4C;AAACC,IAAA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A,MAAM,CAAC,CAAD,CAAlB,EAAuB,CAAvB,CAArB,EAAgDY,IAAhD,CAAX;AACAlB,MAAAA,QAAQ,CAACuB,WAAT,GAAuB,CAACH,EAAE,CAAC,CAAD,CAAH,EAAQA,EAAE,CAAC,CAAD,CAAV,EAAeE,EAAE,CAAC,CAAD,CAAjB,EAAsBA,EAAE,CAAC,CAAD,CAAxB,CAAvB;AACD,KAhBD,MAgBO;AACL,UAAIvC,MAAJ,EAAY;AACVJ,QAAAA,GAAG,CAAC6C,IAAJ,gDAAiDzC,MAAjD;AACD;;AACDiB,MAAAA,QAAQ,CAACW,YAAT,GAAwB,KAAxB;AACD;AACF;;AAlDuD;;gBAArCxB,a,kBACGL,Y;;gBADHK,a,mBAEI,e","sourcesContent":["import {COORDINATE_SYSTEM, Layer, LayerExtension, log} from '@deck.gl/core';\nimport mask from './shader-module';\nimport MaskEffect from './mask-effect';\n\nconst defaultProps = {\n maskId: '',\n maskByInstance: undefined,\n maskInverted: false\n};\n\nexport type MaskExtensionProps = {\n /**\n * Id of the layer that defines the mask. The mask layer must use the prop `operation: 'mask'`.\n * Masking is disabled if `maskId` is empty or no valid mask layer with the specified id is found.\n */\n maskId?: string;\n /**\n * controls whether an object is clipped by its anchor (usually defined by an accessor called `getPosition`, e.g. icon, scatterplot) or by its geometry (e.g. path, polygon).\n * If not specified, it is automatically deduced from the layer.\n */\n maskByInstance?: boolean;\n /**\n * Inverts the masking operation\n */\n maskInverted?: boolean;\n};\n\n/** Allows layers to show/hide objects by a geofence. */\nexport default class MaskExtension extends LayerExtension {\n static defaultProps = defaultProps;\n static extensionName = 'MaskExtension';\n\n initializeState(this: Layer<MaskExtensionProps>) {\n this.context.deck?._addDefaultEffect(new MaskEffect());\n }\n\n getShaders(this: Layer<MaskExtensionProps>): any {\n // Infer by geometry if 'maskByInstance' prop isn't explictly set\n let maskByInstance = 'instancePositions' in this.getAttributeManager()!.attributes;\n // Users can override by setting the `maskByInstance` prop\n if (this.props.maskByInstance !== undefined) {\n maskByInstance = Boolean(this.props.maskByInstance);\n }\n this.state.maskByInstance = maskByInstance;\n\n return {\n modules: [mask]\n };\n }\n\n /* eslint-disable camelcase */\n draw(this: Layer<Required<MaskExtensionProps>>, {uniforms, context, moduleParameters}: any) {\n uniforms.mask_maskByInstance = this.state.maskByInstance;\n const {maskId, maskInverted} = this.props;\n const {maskChannels} = moduleParameters;\n const {viewport} = context;\n if (maskChannels && maskChannels[maskId]) {\n const {index, bounds, coordinateOrigin: fromCoordinateOrigin} = maskChannels[maskId];\n let {coordinateSystem: fromCoordinateSystem} = maskChannels[maskId];\n uniforms.mask_enabled = true;\n uniforms.mask_channel = index;\n uniforms.mask_inverted = maskInverted;\n\n if (fromCoordinateSystem === COORDINATE_SYSTEM.DEFAULT) {\n fromCoordinateSystem = viewport.isGeospatial\n ? COORDINATE_SYSTEM.LNGLAT\n : COORDINATE_SYSTEM.CARTESIAN;\n }\n const opts = {modelMatrix: null, fromCoordinateOrigin, fromCoordinateSystem};\n const bl = this.projectPosition([bounds[0], bounds[1], 0], opts);\n const tr = this.projectPosition([bounds[2], bounds[3], 0], opts);\n uniforms.mask_bounds = [bl[0], bl[1], tr[0], tr[1]];\n } else {\n if (maskId) {\n log.warn(`Could not find a mask layer with id: ${maskId}`)();\n }\n uniforms.mask_enabled = false;\n }\n }\n}\n"],"file":"mask.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/path-style/path-style.ts"],"names":["LayerExtension","_mergeShaders","mergeShaders","dashShaders","offsetShaders","dist","defaultProps","getDashArray","type","value","getOffset","dashJustified","dashGapPickable","PathStyleExtension","constructor","dash","offset","highPrecisionDash","isEnabled","layer","state","getShaders","extension","result","opts","initializeState","context","attributeManager","getAttributeManager","addInstanced","instanceDashArrays","size","accessor","instanceDashOffsets","transform","getDashOffsets","bind","instanceOffsets","updateState","params","uniforms","dashAlignMode","props","Boolean","model","setUniforms","path","positionSize","positionFormat","isNested","Array","isArray","geometrySize","length","p","prevP","i","slice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;AACD;;AACD,WAAO/B,MAAP;AACD;;AAnGuF;;gBAArEV,kB,kBACGP,Y;;gBADHO,kB,mBAEI,oB","sourcesContent":["// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport {LayerExtension, _mergeShaders as mergeShaders} from '@deck.gl/core';\nimport {dashShaders, offsetShaders} from './shaders.glsl';\nimport {dist} from 'gl-matrix/vec3';\n\nimport type {Layer, LayerContext, Accessor, UpdateParameters} from '@deck.gl/core';\n\nconst defaultProps = {\n getDashArray: {type: 'accessor', value: [0, 0]},\n getOffset: {type: 'accessor', value: 0},\n dashJustified: false,\n dashGapPickable: false\n};\n\nexport type PathStyleExtensionProps<DataT = any> = {\n /**\n * Accessor for the dash array to draw each path with: `[dashSize, gapSize]` relative to the width of the path.\n * Requires the `dash` option to be on.\n */\n getDashArray?: Accessor<DataT, [number, number]>;\n /**\n * Accessor for the offset to draw each path with, relative to the width of the path.\n * Negative offset is to the left hand side, and positive offset is to the right hand side.\n * @default 0\n */\n getOffset?: Accessor<DataT, number>;\n /**\n * If `true`, adjust gaps for the dashes to align at both ends.\n * @default false\n */\n dashJustified?: boolean;\n /**\n * If `true`, gaps between solid strokes are pickable. If `false`, only the solid strokes are pickable.\n * @default false\n */\n dashGapPickable?: boolean;\n};\n\ntype PathStyleExtensionOptions = {\n /**\n * Add capability to render dashed lines.\n * @default false\n */\n dash: boolean;\n /**\n * Add capability to offset lines.\n * @default false\n */\n offset: boolean;\n /**\n * Improve dash rendering quality in certain circumstances. Note that this option introduces additional performance overhead.\n * @default false\n */\n highPrecisionDash: boolean;\n};\n\n/** Adds selected features to the `PathLayer` and composite layers that render the `PathLayer`. */\nexport default class PathStyleExtension extends LayerExtension<PathStyleExtensionOptions> {\n static defaultProps = defaultProps;\n static extensionName = 'PathStyleExtension';\n\n constructor({\n dash = false,\n offset = false,\n highPrecisionDash = false\n }: Partial<PathStyleExtensionOptions> = {}) {\n super({dash: dash || highPrecisionDash, offset, highPrecisionDash});\n }\n\n isEnabled(layer: Layer<PathStyleExtensionProps>): boolean {\n return 'pathTesselator' in layer.state;\n }\n\n getShaders(this: Layer<PathStyleExtensionProps>, extension: this): any {\n if (!extension.isEnabled(this)) {\n return null;\n }\n\n // Merge shader injection\n let result = {};\n if (extension.opts.dash) {\n result = mergeShaders(result, dashShaders);\n }\n if (extension.opts.offset) {\n result = mergeShaders(result, offsetShaders);\n }\n\n return result;\n }\n\n initializeState(this: Layer<PathStyleExtensionProps>, context: LayerContext, extension: this) {\n const attributeManager = this.getAttributeManager();\n if (!attributeManager || !extension.isEnabled(this)) {\n // This extension only works with the PathLayer\n return;\n }\n\n if (extension.opts.dash) {\n attributeManager.addInstanced({\n instanceDashArrays: {size: 2, accessor: 'getDashArray'}\n });\n }\n if (extension.opts.highPrecisionDash) {\n attributeManager.addInstanced({\n instanceDashOffsets: {\n size: 1,\n accessor: 'getPath',\n transform: extension.getDashOffsets.bind(this)\n }\n });\n }\n if (extension.opts.offset) {\n attributeManager.addInstanced({\n instanceOffsets: {size: 1, accessor: 'getOffset'}\n });\n }\n }\n\n updateState(\n this: Layer<PathStyleExtensionProps>,\n params: UpdateParameters<Layer<PathStyleExtensionProps>>,\n extension: this\n ) {\n if (!extension.isEnabled(this)) {\n return;\n }\n\n const uniforms: any = {};\n\n if (extension.opts.dash) {\n uniforms.dashAlignMode = this.props.dashJustified ? 1 : 0;\n uniforms.dashGapPickable = Boolean(this.props.dashGapPickable);\n }\n\n this.state.model.setUniforms(uniforms);\n }\n\n getDashOffsets(this: Layer<PathStyleExtensionProps>, path: number[] | number[][]): number[] {\n const result = [0];\n const positionSize = this.props.positionFormat === 'XY' ? 2 : 3;\n const isNested = Array.isArray(path[0]);\n const geometrySize = isNested ? path.length : path.length / positionSize;\n\n let p;\n let prevP;\n for (let i = 0; i < geometrySize - 1; i++) {\n p = isNested ? path[i] : path.slice(i * positionSize, i * positionSize + positionSize);\n p = this.projectPosition(p);\n\n if (i > 0) {\n result[i] = result[i - 1] + dist(prevP, p);\n }\n\n prevP = p;\n }\n return result;\n }\n}\n"],"file":"path-style.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/terrain/terrain.ts"],"names":["LayerExtension","TerrainEffect","terrainModule","defaultProps","terrainDrawMode","undefined","TerrainExtension","getShaders","modules","initializeState","context","deck","_addDefaultEffect","updateState","params","props","oldProps","state","extruded","is3d","attributes","getAttributeManager","hasAnchor","setState","onNeedsRedraw","terrainCoverNeedsRedraw"],"mappings":";AAAA,SAAQA,cAAR,QAA+C,eAA/C;AACA,SAAQC,aAAR,QAA4B,kBAA5B;AACA,SAAQC,aAAR,QAA4B,iBAA5B;AAIA,MAAMC,YAAY,GAAG;AACnBC,EAAAA,eAAe,EAAEC;AADE,CAArB;AAoBA,eAAe,MAAMC,gBAAN,SAA+BN,cAA/B,CAA8C;AAI3DO,EAAAA,UAAU,GAA0C;AAClD,WAAO;AACLC,MAAAA,OAAO,EAAE,CAACN,aAAD;AADJ,KAAP;AAGD;;AAEDO,EAAAA,eAAe,GAAqC;AAAA;;AAClD,+BAAKC,OAAL,CAAaC,IAAb,0EAAmBC,iBAAnB,CAAqC,IAAIX,aAAJ,EAArC;AACD;;AAEDY,EAAAA,WAAW,CAETC,MAFS,EAGT;AACA,UAAM;AAACC,MAAAA,KAAD;AAAQC,MAAAA;AAAR,QAAoBF,MAA1B;;AAEA,QACE,KAAKG,KAAL,CAAWb,eAAX,IACAW,KAAK,CAACX,eAAN,KAA0BY,QAAQ,CAACZ,eADnC,IAGAW,KAAK,CAACG,QAAN,KAAmBF,QAAQ,CAACE,QAJ9B,EAKE;AACA;AACD;;AAED,QAAI;AAACd,MAAAA;AAAD,QAAoBW,KAAxB;;AACA,QAAI,CAACX,eAAL,EAAsB;AAAA;;AAGpB,YAAMe,IAAI,GAAG,KAAKJ,KAAL,CAAWG,QAAxB;AACA,YAAME,UAAU,4BAAG,KAAKC,mBAAL,EAAH,0DAAG,sBAA4BD,UAA/C;AACA,YAAME,SAAS,GAAGF,UAAU,IAAI,uBAAuBA,UAAvD;AACAhB,MAAAA,eAAe,GAAGe,IAAI,IAAIG,SAAR,GAAoB,QAApB,GAA+B,OAAjD;AACD;;AACD,SAAKC,QAAL,CAAc;AAACnB,MAAAA;AAAD,KAAd;AACD;;AAEDoB,EAAAA,aAAa,GAAwB;AACnC,UAAMP,KAAK,GAAG,KAAKA,KAAnB;;AACA,QAAIA,KAAK,CAACb,eAAN,KAA0B,OAA9B,EAAuC;AACrCa,MAAAA,KAAK,CAACQ,uBAAN,GAAgC,IAAhC;AACD;AACF;;AA9C0D;;gBAAxCnB,gB,kBACGH,Y;;gBADHG,gB,mBAEI,kB","sourcesContent":["import {LayerExtension, UpdateParameters} from '@deck.gl/core';\nimport {TerrainEffect} from './terrain-effect';\nimport {terrainModule} from './shader-module';\n\nimport type {Layer} from '@deck.gl/core';\n\nconst defaultProps = {\n terrainDrawMode: undefined\n};\n\nexport type TerrainExtensionProps = {\n /**\n * controls whether an object is drawn over the terrain surface by its anchor (usually defined by an accessor called `getPosition`, e.g. icon, scatterplot) or by its geometry (e.g. path, polygon).\n * If not specified, it is automatically deduced from the layer.\n */\n terrainDrawMode?: 'offset' | 'drape';\n};\n\ntype TerrainExtensionState = {\n /** Resolved fitting mode */\n terrainDrawMode: 'offset' | 'drape';\n /** Set when a layer is flagged as needs redraw */\n terrainCoverNeedsRedraw: boolean;\n};\n\n/** Allows layers to show/hide objects by a geofence. */\nexport default class TerrainExtension extends LayerExtension {\n static defaultProps = defaultProps;\n static extensionName = 'TerrainExtension';\n\n getShaders(this: Layer<TerrainExtensionProps>): any {\n return {\n modules: [terrainModule]\n };\n }\n\n initializeState(this: Layer<TerrainExtensionProps>) {\n this.context.deck?._addDefaultEffect(new TerrainEffect());\n }\n\n updateState(\n this: Layer<TerrainExtensionProps>,\n params: UpdateParameters<Layer<TerrainExtensionProps>>\n ) {\n const {props, oldProps} = params;\n\n if (\n this.state.terrainDrawMode &&\n props.terrainDrawMode === oldProps.terrainDrawMode &&\n // @ts-ignore `extruded` may not exist in props\n props.extruded === oldProps.extruded\n ) {\n return;\n }\n\n let {terrainDrawMode} = props;\n if (!terrainDrawMode) {\n // props.extruded is used as an indication that the layer is 2.5D\n // @ts-ignore `extruded` may not exist in props\n const is3d = this.props.extruded as boolean;\n const attributes = this.getAttributeManager()?.attributes;\n const hasAnchor = attributes && 'instancePositions' in attributes;\n terrainDrawMode = is3d || hasAnchor ? 'offset' : 'drape';\n }\n this.setState({terrainDrawMode});\n }\n\n onNeedsRedraw(this: Layer<{}>): void {\n const state = this.state as TerrainExtensionState;\n if (state.terrainDrawMode === 'drape') {\n state.terrainCoverNeedsRedraw = true;\n }\n }\n}\n"],"file":"terrain.js"}
@@ -1,6 +0,0 @@
1
- declare const EffectOrder: {
2
- MaskEffect: number;
3
- CollideEffect: number;
4
- };
5
- export default EffectOrder;
6
- //# sourceMappingURL=effect-order.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"effect-order.d.ts","sourceRoot":"","sources":["../src/effect-order.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,WAAW;;;CAGhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
File without changes
File without changes
File without changes