@deck.gl/aggregation-layers 9.0.35 → 9.1.0-beta.1

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 (318) hide show
  1. package/dist/common/aggregation-layer.d.ts +30 -0
  2. package/dist/common/aggregation-layer.d.ts.map +1 -0
  3. package/dist/common/aggregation-layer.js +69 -0
  4. package/dist/common/aggregator/aggregator.d.ts +76 -0
  5. package/dist/common/aggregator/aggregator.d.ts.map +1 -0
  6. package/dist/common/aggregator/aggregator.js +4 -0
  7. package/dist/common/aggregator/cpu-aggregator/aggregate.d.ts +27 -0
  8. package/dist/common/aggregator/cpu-aggregator/aggregate.d.ts.map +1 -0
  9. package/dist/common/aggregator/cpu-aggregator/aggregate.js +66 -0
  10. package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.d.ts +70 -0
  11. package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.d.ts.map +1 -0
  12. package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.js +139 -0
  13. package/dist/common/aggregator/cpu-aggregator/sort-bins.d.ts +15 -0
  14. package/dist/common/aggregator/cpu-aggregator/sort-bins.d.ts.map +1 -0
  15. package/dist/common/aggregator/cpu-aggregator/sort-bins.js +43 -0
  16. package/dist/common/aggregator/cpu-aggregator/vertex-accessor.d.ts +21 -0
  17. package/dist/common/aggregator/cpu-aggregator/vertex-accessor.d.ts.map +1 -0
  18. package/dist/common/aggregator/cpu-aggregator/vertex-accessor.js +55 -0
  19. package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.d.ts +18 -0
  20. package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.d.ts.map +1 -0
  21. package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.js +20 -0
  22. package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.d.ts +14 -0
  23. package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.d.ts.map +1 -0
  24. package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.js +17 -0
  25. package/dist/common/aggregator/gpu-aggregator/utils.d.ts +6 -0
  26. package/dist/common/aggregator/gpu-aggregator/utils.d.ts.map +1 -0
  27. package/dist/common/aggregator/gpu-aggregator/utils.js +24 -0
  28. package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.d.ts +24 -0
  29. package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.d.ts.map +1 -0
  30. package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.js +215 -0
  31. package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.d.ts +81 -0
  32. package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.d.ts.map +1 -0
  33. package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.js +201 -0
  34. package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.d.ts +38 -0
  35. package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.d.ts.map +1 -0
  36. package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.js +223 -0
  37. package/dist/common/aggregator/index.d.ts +6 -0
  38. package/dist/common/aggregator/index.d.ts.map +1 -0
  39. package/dist/common/aggregator/index.js +5 -0
  40. package/dist/common/types.d.ts +11 -0
  41. package/dist/common/types.d.ts.map +1 -0
  42. package/dist/common/types.js +4 -0
  43. package/dist/common/utils/bounds-utils.d.ts +10 -0
  44. package/dist/common/utils/bounds-utils.d.ts.map +1 -0
  45. package/dist/common/utils/bounds-utils.js +20 -0
  46. package/dist/common/utils/color-utils.d.ts +10 -0
  47. package/dist/common/utils/color-utils.d.ts.map +1 -0
  48. package/dist/common/utils/color-utils.js +65 -0
  49. package/dist/common/utils/prop-utils.d.ts.map +1 -0
  50. package/dist/common/utils/prop-utils.js +12 -0
  51. package/dist/common/utils/scale-utils.d.ts +46 -0
  52. package/dist/common/utils/scale-utils.d.ts.map +1 -0
  53. package/dist/common/utils/scale-utils.js +180 -0
  54. package/dist/contour-layer/bin-options-uniforms.d.ts +13 -0
  55. package/dist/contour-layer/bin-options-uniforms.d.ts.map +1 -0
  56. package/dist/contour-layer/bin-options-uniforms.js +17 -0
  57. package/dist/contour-layer/contour-layer.d.ts +42 -50
  58. package/dist/contour-layer/contour-layer.d.ts.map +1 -1
  59. package/dist/contour-layer/contour-layer.js +232 -192
  60. package/dist/contour-layer/contour-utils.d.ts +36 -15
  61. package/dist/contour-layer/contour-utils.d.ts.map +1 -1
  62. package/dist/contour-layer/contour-utils.js +24 -29
  63. package/dist/contour-layer/marching-squares-codes.d.ts.map +1 -1
  64. package/dist/contour-layer/marching-squares-codes.js +3 -0
  65. package/dist/contour-layer/marching-squares.d.ts +22 -6
  66. package/dist/contour-layer/marching-squares.d.ts.map +1 -1
  67. package/dist/contour-layer/marching-squares.js +71 -68
  68. package/dist/contour-layer/value-reader.d.ts +10 -0
  69. package/dist/contour-layer/value-reader.d.ts.map +1 -0
  70. package/dist/contour-layer/value-reader.js +46 -0
  71. package/dist/dist.dev.js +4842 -4081
  72. package/dist/grid-layer/bin-options-uniforms.d.ts +13 -0
  73. package/dist/grid-layer/bin-options-uniforms.d.ts.map +1 -0
  74. package/dist/grid-layer/bin-options-uniforms.js +17 -0
  75. package/dist/grid-layer/grid-cell-layer-vertex.glsl.d.ts +3 -0
  76. package/dist/grid-layer/grid-cell-layer-vertex.glsl.d.ts.map +1 -0
  77. package/dist/grid-layer/grid-cell-layer-vertex.glsl.js +51 -0
  78. package/dist/grid-layer/grid-cell-layer.d.ts +32 -0
  79. package/dist/grid-layer/grid-cell-layer.d.ts.map +1 -0
  80. package/dist/grid-layer/grid-cell-layer.js +93 -0
  81. package/dist/grid-layer/grid-layer-uniforms.d.ts +21 -0
  82. package/dist/grid-layer/grid-layer-uniforms.d.ts.map +1 -0
  83. package/dist/grid-layer/grid-layer-uniforms.js +23 -0
  84. package/dist/grid-layer/grid-layer.d.ts +175 -13
  85. package/dist/grid-layer/grid-layer.d.ts.map +1 -1
  86. package/dist/grid-layer/grid-layer.js +342 -46
  87. package/dist/{aggregation-layer.d.ts → heatmap-layer/aggregation-layer.d.ts} +1 -0
  88. package/dist/heatmap-layer/aggregation-layer.d.ts.map +1 -0
  89. package/dist/{aggregation-layer.js → heatmap-layer/aggregation-layer.js} +6 -21
  90. package/dist/heatmap-layer/heatmap-layer-uniforms.d.ts +30 -0
  91. package/dist/heatmap-layer/heatmap-layer-uniforms.d.ts.map +1 -0
  92. package/dist/heatmap-layer/heatmap-layer-uniforms.js +32 -0
  93. package/dist/heatmap-layer/heatmap-layer-utils.d.ts +1 -1
  94. package/dist/heatmap-layer/heatmap-layer-utils.d.ts.map +1 -1
  95. package/dist/heatmap-layer/heatmap-layer-utils.js +3 -0
  96. package/dist/heatmap-layer/heatmap-layer.d.ts +6 -4
  97. package/dist/heatmap-layer/heatmap-layer.d.ts.map +1 -1
  98. package/dist/heatmap-layer/heatmap-layer.js +43 -33
  99. package/dist/heatmap-layer/max-fs.glsl.d.ts.map +1 -1
  100. package/dist/heatmap-layer/max-fs.glsl.js +3 -0
  101. package/dist/heatmap-layer/max-vs.glsl.d.ts +1 -1
  102. package/dist/heatmap-layer/max-vs.glsl.d.ts.map +1 -1
  103. package/dist/heatmap-layer/max-vs.glsl.js +6 -4
  104. package/dist/heatmap-layer/triangle-layer-fragment.glsl.d.ts +1 -1
  105. package/dist/heatmap-layer/triangle-layer-fragment.glsl.d.ts.map +1 -1
  106. package/dist/heatmap-layer/triangle-layer-fragment.glsl.js +5 -23
  107. package/dist/heatmap-layer/triangle-layer-uniforms.d.ts +22 -0
  108. package/dist/heatmap-layer/triangle-layer-uniforms.d.ts.map +1 -0
  109. package/dist/heatmap-layer/triangle-layer-uniforms.js +22 -0
  110. package/dist/heatmap-layer/triangle-layer-vertex.glsl.d.ts +1 -1
  111. package/dist/heatmap-layer/triangle-layer-vertex.glsl.d.ts.map +1 -1
  112. package/dist/heatmap-layer/triangle-layer-vertex.glsl.js +10 -30
  113. package/dist/heatmap-layer/triangle-layer.d.ts +4 -10
  114. package/dist/heatmap-layer/triangle-layer.d.ts.map +1 -1
  115. package/dist/heatmap-layer/triangle-layer.js +17 -30
  116. package/dist/heatmap-layer/weights-fs.glsl.d.ts.map +1 -1
  117. package/dist/heatmap-layer/weights-fs.glsl.js +3 -0
  118. package/dist/heatmap-layer/weights-vs.glsl.d.ts +1 -1
  119. package/dist/heatmap-layer/weights-vs.glsl.d.ts.map +1 -1
  120. package/dist/heatmap-layer/weights-vs.glsl.js +6 -7
  121. package/dist/hexagon-layer/bin-options-uniforms.d.ts +14 -0
  122. package/dist/hexagon-layer/bin-options-uniforms.d.ts.map +1 -0
  123. package/dist/hexagon-layer/bin-options-uniforms.js +17 -0
  124. package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.d.ts +3 -0
  125. package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.d.ts.map +1 -0
  126. package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.js +55 -0
  127. package/dist/hexagon-layer/hexagon-cell-layer.d.ts +29 -0
  128. package/dist/hexagon-layer/hexagon-cell-layer.d.ts.map +1 -0
  129. package/dist/hexagon-layer/hexagon-cell-layer.js +94 -0
  130. package/dist/hexagon-layer/hexagon-layer-uniforms.d.ts +19 -0
  131. package/dist/hexagon-layer/hexagon-layer-uniforms.d.ts.map +1 -0
  132. package/dist/hexagon-layer/hexagon-layer-uniforms.js +21 -0
  133. package/dist/hexagon-layer/hexagon-layer.d.ts +84 -54
  134. package/dist/hexagon-layer/hexagon-layer.d.ts.map +1 -1
  135. package/dist/hexagon-layer/hexagon-layer.js +307 -123
  136. package/dist/hexagon-layer/hexbin.d.ts +17 -0
  137. package/dist/hexagon-layer/hexbin.d.ts.map +1 -0
  138. package/dist/hexagon-layer/hexbin.js +69 -0
  139. package/dist/index.cjs +3025 -2946
  140. package/dist/index.cjs.map +4 -4
  141. package/dist/index.d.ts +7 -13
  142. package/dist/index.d.ts.map +1 -1
  143. package/dist/index.js +5 -27
  144. package/dist/screen-grid-layer/bin-options-uniforms.d.ts +11 -0
  145. package/dist/screen-grid-layer/bin-options-uniforms.d.ts.map +1 -0
  146. package/dist/screen-grid-layer/bin-options-uniforms.js +15 -0
  147. package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts +11 -16
  148. package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts.map +1 -1
  149. package/dist/screen-grid-layer/screen-grid-cell-layer.js +52 -134
  150. package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts +1 -1
  151. package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts.map +1 -1
  152. package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.js +4 -24
  153. package/dist/screen-grid-layer/screen-grid-layer-uniforms.d.ts +17 -0
  154. package/dist/screen-grid-layer/screen-grid-layer-uniforms.d.ts.map +1 -0
  155. package/dist/screen-grid-layer/screen-grid-layer-uniforms.js +19 -0
  156. package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts +1 -1
  157. package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts.map +1 -1
  158. package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.js +21 -62
  159. package/dist/screen-grid-layer/screen-grid-layer.d.ts +33 -40
  160. package/dist/screen-grid-layer/screen-grid-layer.d.ts.map +1 -1
  161. package/dist/screen-grid-layer/screen-grid-layer.js +157 -174
  162. package/dist.min.js +401 -382
  163. package/package.json +10 -9
  164. package/src/common/aggregation-layer.ts +107 -0
  165. package/src/common/aggregator/aggregator.ts +88 -0
  166. package/src/common/aggregator/cpu-aggregator/aggregate.ts +101 -0
  167. package/src/common/aggregator/cpu-aggregator/cpu-aggregator.ts +203 -0
  168. package/src/common/aggregator/cpu-aggregator/sort-bins.ts +63 -0
  169. package/src/common/aggregator/cpu-aggregator/vertex-accessor.ts +86 -0
  170. package/src/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.ts +33 -0
  171. package/src/common/aggregator/gpu-aggregator/bin-sorter-uniforms.ts +27 -0
  172. package/src/common/aggregator/gpu-aggregator/utils.ts +27 -0
  173. package/src/common/aggregator/gpu-aggregator/webgl-aggregation-transform.ts +247 -0
  174. package/src/common/aggregator/gpu-aggregator/webgl-aggregator.ts +274 -0
  175. package/src/common/aggregator/gpu-aggregator/webgl-bin-sorter.ts +258 -0
  176. package/src/common/aggregator/index.ts +10 -0
  177. package/src/{types.ts → common/types.ts} +10 -4
  178. package/src/common/utils/bounds-utils.ts +34 -0
  179. package/src/common/utils/color-utils.ts +86 -0
  180. package/src/common/utils/prop-utils.ts +13 -0
  181. package/src/common/utils/scale-utils.ts +236 -0
  182. package/src/contour-layer/bin-options-uniforms.ts +26 -0
  183. package/src/contour-layer/contour-layer.ts +300 -265
  184. package/src/contour-layer/contour-utils.ts +68 -39
  185. package/src/contour-layer/marching-squares-codes.ts +4 -0
  186. package/src/contour-layer/marching-squares.ts +93 -82
  187. package/src/contour-layer/value-reader.ts +65 -0
  188. package/src/grid-layer/bin-options-uniforms.ts +26 -0
  189. package/src/grid-layer/grid-cell-layer-vertex.glsl.ts +68 -0
  190. package/src/grid-layer/grid-cell-layer.ts +141 -0
  191. package/src/grid-layer/grid-layer-uniforms.ts +37 -0
  192. package/src/grid-layer/grid-layer.ts +614 -73
  193. package/src/{aggregation-layer.ts → heatmap-layer/aggregation-layer.ts} +6 -21
  194. package/src/heatmap-layer/heatmap-layer-uniforms.ts +50 -0
  195. package/src/heatmap-layer/heatmap-layer-utils.ts +9 -1
  196. package/src/heatmap-layer/heatmap-layer.ts +59 -36
  197. package/src/heatmap-layer/max-fs.glsl.ts +4 -0
  198. package/src/heatmap-layer/max-vs.glsl.ts +7 -4
  199. package/src/heatmap-layer/triangle-layer-fragment.glsl.ts +5 -23
  200. package/src/heatmap-layer/triangle-layer-uniforms.ts +37 -0
  201. package/src/heatmap-layer/triangle-layer-vertex.glsl.ts +10 -30
  202. package/src/heatmap-layer/triangle-layer.ts +26 -31
  203. package/src/heatmap-layer/weights-fs.glsl.ts +4 -0
  204. package/src/heatmap-layer/weights-vs.glsl.ts +7 -7
  205. package/src/hexagon-layer/bin-options-uniforms.ts +27 -0
  206. package/src/hexagon-layer/hexagon-cell-layer-vertex.glsl.ts +73 -0
  207. package/src/hexagon-layer/hexagon-cell-layer.ts +141 -0
  208. package/src/hexagon-layer/hexagon-layer-uniforms.ts +34 -0
  209. package/src/hexagon-layer/hexagon-layer.ts +454 -186
  210. package/src/hexagon-layer/hexbin.ts +79 -0
  211. package/src/index.ts +21 -34
  212. package/src/screen-grid-layer/bin-options-uniforms.ts +23 -0
  213. package/src/screen-grid-layer/screen-grid-cell-layer.ts +71 -156
  214. package/src/screen-grid-layer/screen-grid-layer-fragment.glsl.ts +4 -24
  215. package/src/screen-grid-layer/screen-grid-layer-uniforms.ts +31 -0
  216. package/src/screen-grid-layer/screen-grid-layer-vertex.glsl.ts +21 -64
  217. package/src/screen-grid-layer/screen-grid-layer.ts +194 -222
  218. package/dist/aggregation-layer.d.ts.map +0 -1
  219. package/dist/cpu-grid-layer/cpu-grid-layer.d.ts +0 -158
  220. package/dist/cpu-grid-layer/cpu-grid-layer.d.ts.map +0 -1
  221. package/dist/cpu-grid-layer/cpu-grid-layer.js +0 -130
  222. package/dist/cpu-grid-layer/grid-aggregator.d.ts +0 -35
  223. package/dist/cpu-grid-layer/grid-aggregator.d.ts.map +0 -1
  224. package/dist/cpu-grid-layer/grid-aggregator.js +0 -141
  225. package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts +0 -3
  226. package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts.map +0 -1
  227. package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +0 -30
  228. package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts +0 -3
  229. package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts.map +0 -1
  230. package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +0 -112
  231. package/dist/gpu-grid-layer/gpu-grid-cell-layer.d.ts +0 -48
  232. package/dist/gpu-grid-layer/gpu-grid-cell-layer.d.ts.map +0 -1
  233. package/dist/gpu-grid-layer/gpu-grid-cell-layer.js +0 -146
  234. package/dist/gpu-grid-layer/gpu-grid-layer.d.ts +0 -99
  235. package/dist/gpu-grid-layer/gpu-grid-layer.d.ts.map +0 -1
  236. package/dist/gpu-grid-layer/gpu-grid-layer.js +0 -289
  237. package/dist/grid-aggregation-layer.d.ts +0 -67
  238. package/dist/grid-aggregation-layer.d.ts.map +0 -1
  239. package/dist/grid-aggregation-layer.js +0 -173
  240. package/dist/hexagon-layer/hexagon-aggregator.d.ts +0 -27
  241. package/dist/hexagon-layer/hexagon-aggregator.d.ts.map +0 -1
  242. package/dist/hexagon-layer/hexagon-aggregator.js +0 -112
  243. package/dist/types.d.ts +0 -12
  244. package/dist/types.d.ts.map +0 -1
  245. package/dist/types.js +0 -1
  246. package/dist/utils/aggregation-operation-utils.d.ts +0 -19
  247. package/dist/utils/aggregation-operation-utils.d.ts.map +0 -1
  248. package/dist/utils/aggregation-operation-utils.js +0 -94
  249. package/dist/utils/bin-sorter.d.ts +0 -52
  250. package/dist/utils/bin-sorter.d.ts.map +0 -1
  251. package/dist/utils/bin-sorter.js +0 -167
  252. package/dist/utils/color-utils.d.ts +0 -3
  253. package/dist/utils/color-utils.d.ts.map +0 -1
  254. package/dist/utils/color-utils.js +0 -53
  255. package/dist/utils/cpu-aggregator.d.ts +0 -169
  256. package/dist/utils/cpu-aggregator.d.ts.map +0 -1
  257. package/dist/utils/cpu-aggregator.js +0 -421
  258. package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts +0 -3
  259. package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts.map +0 -1
  260. package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +0 -36
  261. package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts +0 -3
  262. package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts.map +0 -1
  263. package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +0 -42
  264. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts +0 -3
  265. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts.map +0 -1
  266. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +0 -30
  267. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts +0 -3
  268. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts.map +0 -1
  269. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +0 -61
  270. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts +0 -38
  271. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts.map +0 -1
  272. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +0 -41
  273. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts +0 -1
  274. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts.map +0 -1
  275. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +0 -1
  276. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts +0 -76
  277. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts.map +0 -1
  278. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +0 -555
  279. package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts +0 -3
  280. package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts.map +0 -1
  281. package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +0 -32
  282. package/dist/utils/grid-aggregation-utils.d.ts +0 -30
  283. package/dist/utils/grid-aggregation-utils.d.ts.map +0 -1
  284. package/dist/utils/grid-aggregation-utils.js +0 -114
  285. package/dist/utils/prop-utils.d.ts.map +0 -1
  286. package/dist/utils/prop-utils.js +0 -28
  287. package/dist/utils/resource-utils.d.ts +0 -14
  288. package/dist/utils/resource-utils.d.ts.map +0 -1
  289. package/dist/utils/resource-utils.js +0 -38
  290. package/dist/utils/scale-utils.d.ts +0 -15
  291. package/dist/utils/scale-utils.d.ts.map +0 -1
  292. package/dist/utils/scale-utils.js +0 -184
  293. package/src/cpu-grid-layer/cpu-grid-layer.ts +0 -329
  294. package/src/cpu-grid-layer/grid-aggregator.ts +0 -184
  295. package/src/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.ts +0 -35
  296. package/src/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.ts +0 -143
  297. package/src/gpu-grid-layer/gpu-grid-cell-layer.ts +0 -201
  298. package/src/gpu-grid-layer/gpu-grid-layer.ts +0 -455
  299. package/src/grid-aggregation-layer.ts +0 -243
  300. package/src/hexagon-layer/hexagon-aggregator.ts +0 -127
  301. package/src/utils/aggregation-operation-utils.ts +0 -118
  302. package/src/utils/bin-sorter.ts +0 -218
  303. package/src/utils/color-utils.ts +0 -57
  304. package/src/utils/cpu-aggregator.ts +0 -503
  305. package/src/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.ts +0 -40
  306. package/src/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.ts +0 -54
  307. package/src/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.ts +0 -35
  308. package/src/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.ts +0 -79
  309. package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.ts +0 -46
  310. package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.ts +0 -0
  311. package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +0 -155
  312. package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.ts +0 -690
  313. package/src/utils/gpu-grid-aggregation/transform-mean-vs.glsl.ts +0 -38
  314. package/src/utils/grid-aggregation-utils.ts +0 -147
  315. package/src/utils/prop-utils.ts +0 -29
  316. package/src/utils/resource-utils.ts +0 -53
  317. package/src/utils/scale-utils.js +0 -219
  318. /package/dist/{utils → common/utils}/prop-utils.d.ts +0 -0
@@ -1,146 +0,0 @@
1
- // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
2
- //
3
- // Permission is hereby granted, free of charge, to any person obtaining a copy
4
- // of this software and associated documentation files (the "Software"), to deal
5
- // in the Software without restriction, including without limitation the rights
6
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- // copies of the Software, and to permit persons to whom the Software is
8
- // furnished to do so, subject to the following conditions:
9
- //
10
- // The above copyright notice and this permission notice shall be included in
11
- // all copies or substantial portions of the Software.
12
- //
13
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- // THE SOFTWARE.
20
- import { Layer, fp64LowPart, project32, gouraudLighting, picking } from '@deck.gl/core';
21
- import { CubeGeometry } from '@luma.gl/engine';
22
- import { fp64arithmetic } from '@luma.gl/shadertools';
23
- import { Model } from '@luma.gl/engine';
24
- import { GL } from '@luma.gl/constants';
25
- import { defaultColorRange, colorRangeToFlatArray } from "../utils/color-utils.js";
26
- import vs from "./gpu-grid-cell-layer-vertex.glsl.js";
27
- import fs from "./gpu-grid-cell-layer-fragment.glsl.js";
28
- const COLOR_DATA_UBO_INDEX = 0;
29
- const ELEVATION_DATA_UBO_INDEX = 1;
30
- const defaultProps = {
31
- // color
32
- colorDomain: null,
33
- colorRange: defaultColorRange,
34
- // elevation
35
- elevationDomain: null,
36
- elevationRange: [0, 1000],
37
- elevationScale: { type: 'number', min: 0, value: 1 },
38
- // grid
39
- gridSize: { type: 'array', value: [1, 1] },
40
- gridOrigin: { type: 'array', value: [0, 0] },
41
- gridOffset: { type: 'array', value: [0, 0] },
42
- cellSize: { type: 'number', min: 0, max: 1000, value: 1000 },
43
- offset: { type: 'array', value: [1, 1] },
44
- coverage: { type: 'number', min: 0, max: 1, value: 1 },
45
- extruded: true,
46
- material: true // Use lighting module defaults
47
- };
48
- class GPUGridCellLayer extends Layer {
49
- getShaders() {
50
- return super.getShaders({
51
- vs,
52
- fs,
53
- modules: [project32, gouraudLighting, picking, fp64arithmetic]
54
- });
55
- }
56
- initializeState() {
57
- const attributeManager = this.getAttributeManager();
58
- attributeManager.addInstanced({
59
- colors: {
60
- size: 4,
61
- noAlloc: true
62
- },
63
- elevations: {
64
- size: 4,
65
- noAlloc: true
66
- }
67
- });
68
- const model = this._getModel();
69
- this._setupUniformBuffer(model);
70
- this.setState({ model });
71
- }
72
- _getModel() {
73
- return new Model(this.context.device, {
74
- ...this.getShaders(),
75
- id: this.props.id,
76
- geometry: new CubeGeometry(),
77
- isInstanced: true
78
- });
79
- }
80
- draw({ uniforms }) {
81
- const { cellSize, offset, extruded, elevationScale, coverage, gridSize, gridOrigin, gridOffset, elevationRange, colorMaxMinBuffer, elevationMaxMinBuffer } = this.props;
82
- const model = this.state.model;
83
- const gridOriginLow = [fp64LowPart(gridOrigin[0]), fp64LowPart(gridOrigin[1])];
84
- const gridOffsetLow = [fp64LowPart(gridOffset[0]), fp64LowPart(gridOffset[1])];
85
- const domainUniforms = this.getDomainUniforms();
86
- const colorRange = colorRangeToFlatArray(this.props.colorRange);
87
- this.bindUniformBuffers(colorMaxMinBuffer, elevationMaxMinBuffer);
88
- model.setUniforms(uniforms);
89
- model.setUniforms(domainUniforms);
90
- model.setUniforms({
91
- cellSize,
92
- offset,
93
- extruded,
94
- elevationScale,
95
- coverage,
96
- gridSize,
97
- gridOrigin,
98
- gridOriginLow,
99
- gridOffset,
100
- gridOffsetLow,
101
- colorRange,
102
- elevationRange
103
- });
104
- model.draw(this.context.renderPass);
105
- this.unbindUniformBuffers(colorMaxMinBuffer, elevationMaxMinBuffer);
106
- }
107
- bindUniformBuffers(colorMaxMinBuffer, elevationMaxMinBuffer) {
108
- colorMaxMinBuffer.bind({ target: 35345, index: COLOR_DATA_UBO_INDEX });
109
- elevationMaxMinBuffer.bind({ target: 35345, index: ELEVATION_DATA_UBO_INDEX });
110
- }
111
- unbindUniformBuffers(colorMaxMinBuffer, elevationMaxMinBuffer) {
112
- colorMaxMinBuffer.unbind({ target: 35345, index: COLOR_DATA_UBO_INDEX });
113
- elevationMaxMinBuffer.unbind({ target: 35345, index: ELEVATION_DATA_UBO_INDEX });
114
- }
115
- getDomainUniforms() {
116
- const { colorDomain, elevationDomain } = this.props;
117
- const domainUniforms = {};
118
- if (colorDomain !== null) {
119
- domainUniforms.colorDomainValid = true;
120
- domainUniforms.colorDomain = colorDomain;
121
- }
122
- else {
123
- domainUniforms.colorDomainValid = false;
124
- }
125
- if (elevationDomain !== null) {
126
- domainUniforms.elevationDomainValid = true;
127
- domainUniforms.elevationDomain = elevationDomain;
128
- }
129
- else {
130
- domainUniforms.elevationDomainValid = false;
131
- }
132
- return domainUniforms;
133
- }
134
- _setupUniformBuffer(model) {
135
- // @ts-expect-error TODO v9 This code is not portable to WebGPU
136
- const programHandle = model.pipeline.handle;
137
- const gl = this.context.gl;
138
- const colorIndex = gl.getUniformBlockIndex(programHandle, 'ColorData');
139
- const elevationIndex = gl.getUniformBlockIndex(programHandle, 'ElevationData');
140
- gl.uniformBlockBinding(programHandle, colorIndex, COLOR_DATA_UBO_INDEX);
141
- gl.uniformBlockBinding(programHandle, elevationIndex, ELEVATION_DATA_UBO_INDEX);
142
- }
143
- }
144
- GPUGridCellLayer.layerName = 'GPUGridCellLayer';
145
- GPUGridCellLayer.defaultProps = defaultProps;
146
- export default GPUGridCellLayer;
@@ -1,99 +0,0 @@
1
- import { Accessor, AccessorFunction, Color, Material, GetPickingInfoParams, LayerContext, PickingInfo, Position, DefaultProps } from '@deck.gl/core';
2
- import GPUGridCellLayer from "./gpu-grid-cell-layer.js";
3
- import { GridHash } from "./../cpu-grid-layer/grid-aggregator.js";
4
- import GridAggregationLayer, { GridAggregationLayerProps } from "../grid-aggregation-layer.js";
5
- /** All properties supported by GPUGridLayer. */
6
- export type GPUGridLayerProps<DataT = unknown> = _GPUGridLayerProps<DataT> & GridAggregationLayerProps<DataT>;
7
- /** Properties added by GPUGridLayer. */
8
- export type _GPUGridLayerProps<DataT> = {
9
- /**
10
- * Size of each cell in meters.
11
- * @default 1000
12
- */
13
- cellSize?: number;
14
- /**
15
- * Color scale domain, default is set to the extent of aggregated weights in each cell.
16
- * @default [min(colorWeight), max(colorWeight)]
17
- */
18
- colorDomain?: [number, number] | null;
19
- /**
20
- * Default: [colorbrewer](http://colorbrewer2.org/#type=sequential&scheme=YlOrRd&n=6) `6-class YlOrRd`
21
- */
22
- colorRange?: Color[];
23
- /**
24
- * Cell size multiplier, clamped between 0 - 1.
25
- * @default 1
26
- */
27
- coverage?: number;
28
- /**
29
- * Elevation scale input domain, default is set to between 0 and the max of aggregated weights in each cell.
30
- * @default [0, max(elevationWeight)]
31
- */
32
- elevationDomain?: [number, number] | null;
33
- /**
34
- * Elevation scale output range.
35
- * @default [0, 1000]
36
- */
37
- elevationRange?: [number, number];
38
- /**
39
- * Cell elevation multiplier.
40
- * @default 1
41
- */
42
- elevationScale?: number;
43
- /**
44
- * Whether to enable cell elevation. If set to false, all cell will be flat.
45
- * @default true
46
- */
47
- extruded?: boolean;
48
- /**
49
- * Material settings for lighting effect. Applies if `extruded: true`.
50
- *
51
- * @default true
52
- * @see https://deck.gl/docs/developer-guide/using-lighting
53
- */
54
- material?: Material;
55
- /**
56
- * Defines the operation used to aggregate all data object weights to calculate a cell's color value.
57
- * @default 'SUM'
58
- */
59
- colorAggregation?: 'SUM' | 'MEAN' | 'MIN' | 'MAX';
60
- /**
61
- * Defines the operation used to aggregate all data object weights to calculate a cell's elevation value.
62
- * @default 'SUM'
63
- */
64
- elevationAggregation?: 'SUM' | 'MEAN' | 'MIN' | 'MAX';
65
- /**
66
- * Method called to retrieve the position of each object.
67
- * @default object => object.position
68
- */
69
- getPosition?: AccessorFunction<DataT, Position>;
70
- /**
71
- * The weight of a data object used to calculate the color value for a cell.
72
- * @default 1
73
- */
74
- getColorWeight?: Accessor<DataT, number>;
75
- /**
76
- * The weight of a data object used to calculate the elevation value for a cell.
77
- * @default 1
78
- */
79
- getElevationWeight?: Accessor<DataT, number>;
80
- };
81
- /** Aggregate data into a grid-based heatmap. Aggregation is performed on GPU. */
82
- export default class GPUGridLayer<DataT = any, ExtraPropsT extends {} = {}> extends GridAggregationLayer<DataT, ExtraPropsT & Required<_GPUGridLayerProps<DataT>>> {
83
- static layerName: string;
84
- static defaultProps: DefaultProps<GPUGridLayerProps<unknown>>;
85
- state: GridAggregationLayer<DataT>['state'] & {
86
- isSupported: boolean;
87
- gridHash?: GridHash;
88
- };
89
- initializeState({ device }: LayerContext): void;
90
- updateState(opts: any): void;
91
- getHashKeyForIndex(index: number): string;
92
- getPositionForIndex(index: number): Position;
93
- getPickingInfo({ info, mode }: GetPickingInfoParams): PickingInfo;
94
- renderLayers(): GPUGridCellLayer | null;
95
- finalizeState(context: LayerContext): void;
96
- updateAggregationState(opts: any): void;
97
- _updateAccessors(opts: any): void;
98
- }
99
- //# sourceMappingURL=gpu-grid-layer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gpu-grid-layer.d.ts","sourceRoot":"","sources":["../../src/gpu-grid-layer/gpu-grid-layer.ts"],"names":[],"mappings":"AAqBA,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,KAAK,EACL,QAAQ,EACR,oBAAoB,EACpB,YAAY,EAEZ,WAAW,EACX,QAAQ,EACR,YAAY,EACb,MAAM,eAAe,CAAC;AAKvB,OAAO,gBAAgB,iCAA8B;AACrD,OAAO,EAA4B,QAAQ,EAAC,+CAA4C;AACxF,OAAO,oBAAoB,EAAE,EAAC,yBAAyB,EAAC,qCAAkC;AAsC1F,gDAAgD;AAChD,MAAM,MAAM,iBAAiB,CAAC,KAAK,GAAG,OAAO,IAAI,kBAAkB,CAAC,KAAK,CAAC,GACxE,yBAAyB,CAAC,KAAK,CAAC,CAAC;AAEnC,wCAAwC;AACxC,MAAM,MAAM,kBAAkB,CAAC,KAAK,IAAI;IACtC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IAEtC;;OAEG;IACH,UAAU,CAAC,EAAE,KAAK,EAAE,CAAC;IAErB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IAE1C;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAElC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;IAElD;;;OAGG;IACH,oBAAoB,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;IAEtD;;;OAGG;IACH,WAAW,CAAC,EAAE,gBAAgB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAEhD;;;OAGG;IACH,cAAc,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAEzC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;CAC9C,CAAC;AAEF,iFAAiF;AACjF,MAAM,CAAC,OAAO,OAAO,YAAY,CAC/B,KAAK,GAAG,GAAG,EACX,WAAW,SAAS,EAAE,GAAG,EAAE,CAC3B,SAAQ,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,QAAQ,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;IACtF,MAAM,CAAC,SAAS,SAAkB;IAClC,MAAM,CAAC,YAAY,2CAAgB;IAEnC,KAAK,EAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,GAAG;QAC7C,WAAW,EAAE,OAAO,CAAC;QACrB,QAAQ,CAAC,EAAE,QAAQ,CAAC;KACrB,CAAC;IAEF,eAAe,CAAC,EAAC,MAAM,EAAC,EAAE,YAAY,GAAG,IAAI;IAiD7C,WAAW,CAAC,IAAI,KAAA;IAehB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAkBzC,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ;IAa5C,cAAc,CAAC,EAAC,IAAI,EAAE,IAAI,EAAC,EAAE,oBAAoB,GAAG,WAAW;IAqD/D,YAAY;IAsDZ,aAAa,CAAC,OAAO,EAAE,YAAY;IAYnC,sBAAsB,CAAC,IAAI,KAAA;IAoD3B,gBAAgB,CAAC,IAAI,KAAA;CAMtB"}
@@ -1,289 +0,0 @@
1
- // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
2
- //
3
- // Permission is hereby granted, free of charge, to any person obtaining a copy
4
- // of this software and associated documentation files (the "Software"), to deal
5
- // in the Software without restriction, including without limitation the rights
6
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- // copies of the Software, and to permit persons to whom the Software is
8
- // furnished to do so, subject to the following conditions:
9
- //
10
- // The above copyright notice and this permission notice shall be included in
11
- // all copies or substantial portions of the Software.
12
- //
13
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- // THE SOFTWARE.
20
- import { GL } from '@luma.gl/constants';
21
- import { log } from '@deck.gl/core';
22
- import GPUGridAggregator from "../utils/gpu-grid-aggregation/gpu-grid-aggregator.js";
23
- import { AGGREGATION_OPERATION } from "../utils/aggregation-operation-utils.js";
24
- import { defaultColorRange, colorRangeToFlatArray } from "../utils/color-utils.js";
25
- import GPUGridCellLayer from "./gpu-grid-cell-layer.js";
26
- import { pointToDensityGridDataCPU } from "./../cpu-grid-layer/grid-aggregator.js";
27
- import GridAggregationLayer from "../grid-aggregation-layer.js";
28
- import { getBoundingBox, getGridParams } from "../utils/grid-aggregation-utils.js";
29
- const defaultProps = {
30
- // color
31
- colorDomain: null,
32
- colorRange: defaultColorRange,
33
- getColorWeight: { type: 'accessor', value: 1 },
34
- colorAggregation: 'SUM',
35
- // elevation
36
- elevationDomain: null,
37
- elevationRange: [0, 1000],
38
- getElevationWeight: { type: 'accessor', value: 1 },
39
- elevationAggregation: 'SUM',
40
- elevationScale: { type: 'number', min: 0, value: 1 },
41
- // grid
42
- cellSize: { type: 'number', min: 1, max: 1000, value: 1000 },
43
- coverage: { type: 'number', min: 0, max: 1, value: 1 },
44
- getPosition: { type: 'accessor', value: (x) => x.position },
45
- extruded: false,
46
- // Optional material for 'lighting' shader module
47
- material: true
48
- };
49
- // This layer only perform GPU aggregation, no need to seperate data and weight props
50
- // aggregation will be dirty when any of the props are changed.
51
- const DIMENSIONS = {
52
- data: {
53
- props: ['cellSize', 'colorAggregation', 'elevationAggregation']
54
- }
55
- // rest of the changes are detected by `state.attributesChanged`
56
- };
57
- const POSITION_ATTRIBUTE_NAME = 'positions';
58
- /** Aggregate data into a grid-based heatmap. Aggregation is performed on GPU. */
59
- class GPUGridLayer extends GridAggregationLayer {
60
- initializeState({ device }) {
61
- const isSupported = GPUGridAggregator.isSupported(device);
62
- if (!isSupported) {
63
- log.error('GPUGridLayer is not supported on this browser, use GridLayer instead')();
64
- }
65
- super.initializeAggregationLayer({
66
- dimensions: DIMENSIONS
67
- });
68
- this.setState({
69
- gpuAggregation: false, // TODO(v9): Re-enable GPU aggregation.
70
- projectPoints: false, // aggregation in world space
71
- isSupported,
72
- weights: {
73
- color: {
74
- needMin: true,
75
- needMax: true,
76
- combineMaxMin: true,
77
- maxMinBuffer: device.createBuffer({
78
- byteLength: 4 * 4,
79
- // @ts-expect-error webgl-legacy
80
- accessor: { size: 4, type: 5126, divisor: 1 }
81
- })
82
- },
83
- elevation: {
84
- needMin: true,
85
- needMax: true,
86
- combineMaxMin: true,
87
- maxMinBuffer: device.createBuffer({
88
- byteLength: 4 * 4,
89
- // @ts-expect-error
90
- accessor: { size: 4, type: 5126, divisor: 1 }
91
- })
92
- }
93
- },
94
- positionAttributeName: 'positions'
95
- });
96
- const attributeManager = this.getAttributeManager();
97
- attributeManager.add({
98
- [POSITION_ATTRIBUTE_NAME]: {
99
- size: 3,
100
- accessor: 'getPosition',
101
- type: 'float64',
102
- fp64: this.use64bitPositions()
103
- },
104
- color: { size: 3, accessor: 'getColorWeight' },
105
- elevation: { size: 3, accessor: 'getElevationWeight' }
106
- });
107
- }
108
- updateState(opts) {
109
- if (this.state.isSupported === false) {
110
- // Skip update, layer not supported
111
- return;
112
- }
113
- super.updateState(opts);
114
- const { aggregationDirty } = this.state;
115
- if (aggregationDirty) {
116
- // reset cached CPU Aggregation results (used for picking)
117
- this.setState({
118
- gridHash: null
119
- });
120
- }
121
- }
122
- getHashKeyForIndex(index) {
123
- const { numRow, numCol, boundingBox, gridOffset } = this.state;
124
- const gridSize = [numCol, numRow];
125
- const gridOrigin = [boundingBox.xMin, boundingBox.yMin];
126
- const cellSize = [gridOffset.xOffset, gridOffset.yOffset];
127
- const yIndex = Math.floor(index / gridSize[0]);
128
- const xIndex = index - yIndex * gridSize[0];
129
- // This will match the index to the hash-key to access aggregation data from CPU aggregation results.
130
- const latIdx = Math.floor((yIndex * cellSize[1] + gridOrigin[1] + 90 + cellSize[1] / 2) / cellSize[1]);
131
- const lonIdx = Math.floor((xIndex * cellSize[0] + gridOrigin[0] + 180 + cellSize[0] / 2) / cellSize[0]);
132
- return `${latIdx}-${lonIdx}`;
133
- }
134
- getPositionForIndex(index) {
135
- const { numRow, numCol, boundingBox, gridOffset } = this.state;
136
- const gridSize = [numCol, numRow];
137
- const gridOrigin = [boundingBox.xMin, boundingBox.yMin];
138
- const cellSize = [gridOffset.xOffset, gridOffset.yOffset];
139
- const yIndex = Math.floor(index / gridSize[0]);
140
- const xIndex = index - yIndex * gridSize[0];
141
- const yPos = yIndex * cellSize[1] + gridOrigin[1];
142
- const xPos = xIndex * cellSize[0] + gridOrigin[0];
143
- return [xPos, yPos];
144
- }
145
- getPickingInfo({ info, mode }) {
146
- const { index } = info;
147
- let object = null;
148
- if (index >= 0) {
149
- const gpuGridAggregator = this.state.gpuGridAggregator;
150
- const position = this.getPositionForIndex(index);
151
- const colorInfo = GPUGridAggregator.getAggregationData({
152
- pixelIndex: index,
153
- ...gpuGridAggregator.getData('color')
154
- });
155
- const elevationInfo = GPUGridAggregator.getAggregationData({
156
- pixelIndex: index,
157
- ...gpuGridAggregator.getData('elevation')
158
- });
159
- object = {
160
- colorValue: colorInfo.cellWeight,
161
- elevationValue: elevationInfo.cellWeight,
162
- count: colorInfo.cellCount || elevationInfo.cellCount,
163
- position,
164
- totalCount: colorInfo.totalCount || elevationInfo.totalCount
165
- };
166
- if (mode !== 'hover') {
167
- // perform CPU aggregation for full list of points for each cell
168
- const { props } = this;
169
- let { gridHash } = this.state;
170
- if (!gridHash) {
171
- const { gridOffset, translation, boundingBox } = this.state;
172
- const { viewport } = this.context;
173
- const attributes = this.getAttributes();
174
- const cpuAggregation = pointToDensityGridDataCPU(props, {
175
- gridOffset,
176
- attributes,
177
- viewport,
178
- translation,
179
- boundingBox
180
- });
181
- gridHash = cpuAggregation.gridHash;
182
- this.setState({ gridHash });
183
- }
184
- const key = this.getHashKeyForIndex(index);
185
- const cpuAggregationData = gridHash[key];
186
- Object.assign(object, cpuAggregationData);
187
- }
188
- }
189
- // override object with picked cell
190
- info.picked = Boolean(object);
191
- info.object = object;
192
- return info;
193
- }
194
- renderLayers() {
195
- if (!this.state.isSupported) {
196
- return null;
197
- }
198
- const { elevationScale, extruded, cellSize: cellSizeMeters, coverage, material, elevationRange, colorDomain, elevationDomain } = this.props;
199
- const { weights, numRow, numCol, gridOrigin, gridOffset } = this.state;
200
- const { color, elevation } = weights;
201
- const colorRange = colorRangeToFlatArray(this.props.colorRange);
202
- const SubLayerClass = this.getSubLayerClass('gpu-grid-cell', GPUGridCellLayer);
203
- return new SubLayerClass({
204
- gridSize: [numCol, numRow],
205
- gridOrigin,
206
- gridOffset: [gridOffset.xOffset, gridOffset.yOffset],
207
- colorRange,
208
- elevationRange,
209
- colorDomain,
210
- elevationDomain,
211
- cellSize: cellSizeMeters,
212
- coverage,
213
- material,
214
- elevationScale,
215
- extruded
216
- }, this.getSubLayerProps({
217
- id: 'gpu-grid-cell'
218
- }), {
219
- data: {
220
- attributes: {
221
- colors: color.aggregationBuffer,
222
- elevations: elevation.aggregationBuffer
223
- }
224
- },
225
- colorMaxMinBuffer: color.maxMinBuffer,
226
- elevationMaxMinBuffer: elevation.maxMinBuffer,
227
- numInstances: numCol * numRow
228
- });
229
- }
230
- finalizeState(context) {
231
- const { color, elevation } = this.state.weights;
232
- [color, elevation].forEach(weight => {
233
- const { aggregationBuffer, maxMinBuffer } = weight;
234
- maxMinBuffer?.destroy();
235
- aggregationBuffer?.destroy();
236
- });
237
- super.finalizeState(context);
238
- }
239
- // Aggregation Overrides
240
- updateAggregationState(opts) {
241
- const { props, oldProps } = opts;
242
- const { cellSize, coordinateSystem } = props;
243
- const { viewport } = this.context;
244
- const cellSizeChanged = oldProps.cellSize !== cellSize;
245
- const { dimensions } = this.state;
246
- const positionsChanged = this.isAttributeChanged(POSITION_ATTRIBUTE_NAME);
247
- // any attribute changed
248
- const attributesChanged = positionsChanged || this.isAttributeChanged();
249
- let { boundingBox } = this.state;
250
- if (positionsChanged) {
251
- boundingBox = getBoundingBox(this.getAttributes(), this.getNumInstances());
252
- this.setState({ boundingBox });
253
- }
254
- if (positionsChanged || cellSizeChanged) {
255
- const { gridOffset, translation, width, height, numCol, numRow } = getGridParams(boundingBox, cellSize, viewport, coordinateSystem);
256
- this.allocateResources(numRow, numCol);
257
- this.setState({
258
- gridOffset,
259
- translation,
260
- gridOrigin: [-1 * translation[0], -1 * translation[1]],
261
- width,
262
- height,
263
- numCol,
264
- numRow
265
- });
266
- }
267
- const aggregationDataDirty = attributesChanged ||
268
- this.isAggregationDirty(opts, {
269
- dimension: dimensions.data,
270
- compareAll: true
271
- });
272
- if (aggregationDataDirty) {
273
- this._updateAccessors(opts);
274
- }
275
- this.setState({
276
- aggregationDataDirty
277
- });
278
- }
279
- // Private
280
- _updateAccessors(opts) {
281
- const { colorAggregation, elevationAggregation } = opts.props;
282
- const { color, elevation } = this.state.weights;
283
- color.operation = AGGREGATION_OPERATION[colorAggregation];
284
- elevation.operation = AGGREGATION_OPERATION[elevationAggregation];
285
- }
286
- }
287
- GPUGridLayer.layerName = 'GPUGridLayer';
288
- GPUGridLayer.defaultProps = defaultProps;
289
- export default GPUGridLayer;
@@ -1,67 +0,0 @@
1
- import { LayerContext, UpdateParameters, Accessor } from '@deck.gl/core';
2
- import AggregationLayer, { AggregationLayerProps } from "./aggregation-layer.js";
3
- import GPUGridAggregator from "./utils/gpu-grid-aggregation/gpu-grid-aggregator.js";
4
- import BinSorter from "./utils/bin-sorter.js";
5
- import type { Buffer } from '@luma.gl/core';
6
- export type GridAggregationLayerProps<DataT> = AggregationLayerProps<DataT>;
7
- export default abstract class GridAggregationLayer<DataT, ExtraPropsT extends {} = {}> extends AggregationLayer<DataT, ExtraPropsT> {
8
- static layerName: string;
9
- state: AggregationLayer<DataT>['state'] & {
10
- aggregationDataDirty?: boolean;
11
- aggregationWeightsDirty?: boolean;
12
- aggregationDirty?: boolean;
13
- gpuAggregation?: any;
14
- getValue?: () => any;
15
- sortedBins?: BinSorter;
16
- weights: {
17
- [key: string]: {
18
- aggregationBuffer?: Buffer;
19
- maxMinBuffer?: Buffer;
20
- aggregationData: Float32Array | null;
21
- maxMinData: Float32Array;
22
- maxData: Float32Array;
23
- minData: Float32Array;
24
- getWeight: Accessor<DataT, number>;
25
- operation: number;
26
- };
27
- };
28
- cpuGridAggregator?: Function;
29
- gpuGridAggregator?: GPUGridAggregator;
30
- layerData: any;
31
- numRow: number;
32
- numCol: number;
33
- gridOffset: {
34
- xOffset: number;
35
- yOffset: number;
36
- };
37
- posOffset: number[];
38
- gridOrigin: number[];
39
- translation: number[];
40
- scaling: number[];
41
- boundingBox: {
42
- xMin: number;
43
- yMin: number;
44
- xMax: number;
45
- yMax: number;
46
- };
47
- projectPoints?: (p: [number, number]) => [number, number];
48
- };
49
- initializeAggregationLayer({ dimensions }: {
50
- dimensions: any;
51
- }): void;
52
- updateState(opts: UpdateParameters<this>): void;
53
- finalizeState(context: LayerContext): void;
54
- updateShaders(shaders: any): void;
55
- updateAggregationState(opts: UpdateParameters<this>): void;
56
- allocateResources(numRow: any, numCol: any): void;
57
- updateResults({ aggregationData, maxMinData, maxData, minData }: {
58
- aggregationData: any;
59
- maxMinData: any;
60
- maxData: any;
61
- minData: any;
62
- }): void;
63
- _updateAggregation(opts: any): void;
64
- _updateWeightBins(): void;
65
- _uploadAggregationResults(): void;
66
- }
67
- //# sourceMappingURL=grid-aggregation-layer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"grid-aggregation-layer.d.ts","sourceRoot":"","sources":["../src/grid-aggregation-layer.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAC,YAAY,EAAO,gBAAgB,EAAE,QAAQ,EAAC,MAAM,eAAe,CAAC;AAC5E,OAAO,gBAAgB,EAAE,EAAC,qBAAqB,EAAC,+BAA4B;AAC5E,OAAO,iBAAiB,4DAAyD;AACjF,OAAO,SAAS,8BAA2B;AAE3C,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAE1C,MAAM,MAAM,yBAAyB,CAAC,KAAK,IAAI,qBAAqB,CAAC,KAAK,CAAC,CAAC;AAE5E,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,oBAAoB,CAChD,KAAK,EACL,WAAW,SAAS,EAAE,GAAG,EAAE,CAC3B,SAAQ,gBAAgB,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5C,MAAM,CAAC,SAAS,SAA0B;IAE1C,KAAK,EAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,GAAG;QACzC,oBAAoB,CAAC,EAAE,OAAO,CAAC;QAC/B,uBAAuB,CAAC,EAAE,OAAO,CAAC;QAClC,gBAAgB,CAAC,EAAE,OAAO,CAAC;QAC3B,cAAc,CAAC,EAAE,GAAG,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,GAAG,CAAC;QACrB,UAAU,CAAC,EAAE,SAAS,CAAC;QACvB,OAAO,EAAE;YACP,CAAC,GAAG,EAAE,MAAM,GAAG;gBACb,iBAAiB,CAAC,EAAE,MAAM,CAAC;gBAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;gBACtB,eAAe,EAAE,YAAY,GAAG,IAAI,CAAC;gBACrC,UAAU,EAAE,YAAY,CAAC;gBACzB,OAAO,EAAE,YAAY,CAAC;gBACtB,OAAO,EAAE,YAAY,CAAC;gBACtB,SAAS,EAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;gBACnC,SAAS,EAAE,MAAM,CAAC;aACnB,CAAC;SACH,CAAC;QACF,iBAAiB,CAAC,EAAE,QAAQ,CAAC;QAC7B,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;QACtC,SAAS,EAAE,GAAG,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE;YAAC,OAAO,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAC,CAAC;QAC/C,SAAS,EAAE,MAAM,EAAE,CAAC;QACpB,UAAU,EAAE,MAAM,EAAE,CAAC;QACrB,WAAW,EAAE,MAAM,EAAE,CAAC;QACtB,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,WAAW,EAAE;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAC,CAAC;QACtE,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC3D,CAAC;IAEF,0BAA0B,CAAC,EAAC,UAAU,EAAC;;KAAA;IAYvC,WAAW,CAAC,IAAI,EAAE,gBAAgB,CAAC,IAAI,CAAC;IA8BxC,aAAa,CAAC,OAAO,EAAE,YAAY;IASnC,aAAa,CAAC,OAAO,EAAE,GAAG,GAAG,IAAI;IAQjC,sBAAsB,CAAC,IAAI,EAAE,gBAAgB,CAAC,IAAI,CAAC;IAKnD,iBAAiB,CAAC,MAAM,KAAA,EAAE,MAAM,KAAA;IAsBhC,aAAa,CAAC,EAAC,eAAe,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAC;;;;;KAAA;IAY7D,kBAAkB,CAAC,IAAI,KAAA;IAgDvB,iBAAiB;IAOjB,yBAAyB,IAAI,IAAI;CAoBlC"}