@deck.gl/aggregation-layers 9.0.34 → 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,201 +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
-
21
- import {
22
- Layer,
23
- fp64LowPart,
24
- project32,
25
- gouraudLighting,
26
- picking,
27
- LayerProps,
28
- DefaultProps
29
- } from '@deck.gl/core';
30
- import {CubeGeometry} from '@luma.gl/engine';
31
- import {fp64arithmetic} from '@luma.gl/shadertools';
32
- import {Model} from '@luma.gl/engine';
33
- import {Buffer} from '@luma.gl/core';
34
- import {GL} from '@luma.gl/constants';
35
- import {defaultColorRange, colorRangeToFlatArray} from '../utils/color-utils';
36
- import type {_GPUGridLayerProps} from './gpu-grid-layer';
37
- import vs from './gpu-grid-cell-layer-vertex.glsl';
38
- import fs from './gpu-grid-cell-layer-fragment.glsl';
39
-
40
- const COLOR_DATA_UBO_INDEX = 0;
41
- const ELEVATION_DATA_UBO_INDEX = 1;
42
-
43
- const defaultProps: DefaultProps<_GPUGridCellLayerProps & LayerProps> = {
44
- // color
45
- colorDomain: null,
46
- colorRange: defaultColorRange,
47
-
48
- // elevation
49
- elevationDomain: null,
50
- elevationRange: [0, 1000],
51
- elevationScale: {type: 'number', min: 0, value: 1},
52
-
53
- // grid
54
- gridSize: {type: 'array', value: [1, 1]},
55
- gridOrigin: {type: 'array', value: [0, 0]},
56
- gridOffset: {type: 'array', value: [0, 0]},
57
-
58
- cellSize: {type: 'number', min: 0, max: 1000, value: 1000},
59
- offset: {type: 'array', value: [1, 1]},
60
- coverage: {type: 'number', min: 0, max: 1, value: 1},
61
- extruded: true,
62
-
63
- material: true // Use lighting module defaults
64
- };
65
-
66
- type _GPUGridCellLayerProps = _GPUGridLayerProps<any> & {
67
- cellSize: number;
68
- offset: number[];
69
- coverage: number;
70
- extruded: boolean;
71
- elevationScale: number;
72
- elevationRange: [number, number];
73
- gridSize: number[];
74
- gridOrigin: number[];
75
- gridOffset: number[];
76
- colorMaxMinBuffer: Buffer;
77
- elevationMaxMinBuffer: Buffer;
78
- };
79
-
80
- export default class GPUGridCellLayer extends Layer<_GPUGridCellLayerProps> {
81
- static layerName = 'GPUGridCellLayer';
82
- static defaultProps = defaultProps;
83
-
84
- state!: {
85
- model?: Model;
86
- };
87
-
88
- getShaders() {
89
- return super.getShaders({
90
- vs,
91
- fs,
92
- modules: [project32, gouraudLighting, picking, fp64arithmetic]
93
- });
94
- }
95
-
96
- initializeState(): void {
97
- const attributeManager = this.getAttributeManager()!;
98
- attributeManager.addInstanced({
99
- colors: {
100
- size: 4,
101
- noAlloc: true
102
- },
103
- elevations: {
104
- size: 4,
105
- noAlloc: true
106
- }
107
- });
108
- const model = this._getModel();
109
- this._setupUniformBuffer(model);
110
- this.setState({model});
111
- }
112
-
113
- _getModel(): Model {
114
- return new Model(this.context.device, {
115
- ...this.getShaders(),
116
- id: this.props.id,
117
- geometry: new CubeGeometry(),
118
- isInstanced: true
119
- });
120
- }
121
-
122
- draw({uniforms}) {
123
- const {
124
- cellSize,
125
- offset,
126
- extruded,
127
- elevationScale,
128
- coverage,
129
- gridSize,
130
- gridOrigin,
131
- gridOffset,
132
- elevationRange,
133
- colorMaxMinBuffer,
134
- elevationMaxMinBuffer
135
- } = this.props;
136
- const model = this.state.model!;
137
-
138
- const gridOriginLow = [fp64LowPart(gridOrigin[0]), fp64LowPart(gridOrigin[1])];
139
- const gridOffsetLow = [fp64LowPart(gridOffset[0]), fp64LowPart(gridOffset[1])];
140
- const domainUniforms = this.getDomainUniforms();
141
- const colorRange = colorRangeToFlatArray(this.props.colorRange);
142
- this.bindUniformBuffers(colorMaxMinBuffer, elevationMaxMinBuffer);
143
- model.setUniforms(uniforms);
144
- model.setUniforms(domainUniforms);
145
- model.setUniforms({
146
- cellSize,
147
- offset,
148
- extruded,
149
- elevationScale,
150
- coverage,
151
- gridSize,
152
- gridOrigin,
153
- gridOriginLow,
154
- gridOffset,
155
- gridOffsetLow,
156
- colorRange,
157
- elevationRange
158
- });
159
- model.draw(this.context.renderPass);
160
- this.unbindUniformBuffers(colorMaxMinBuffer, elevationMaxMinBuffer);
161
- }
162
-
163
- bindUniformBuffers(colorMaxMinBuffer, elevationMaxMinBuffer) {
164
- colorMaxMinBuffer.bind({target: GL.UNIFORM_BUFFER, index: COLOR_DATA_UBO_INDEX});
165
- elevationMaxMinBuffer.bind({target: GL.UNIFORM_BUFFER, index: ELEVATION_DATA_UBO_INDEX});
166
- }
167
-
168
- unbindUniformBuffers(colorMaxMinBuffer, elevationMaxMinBuffer) {
169
- colorMaxMinBuffer.unbind({target: GL.UNIFORM_BUFFER, index: COLOR_DATA_UBO_INDEX});
170
- elevationMaxMinBuffer.unbind({target: GL.UNIFORM_BUFFER, index: ELEVATION_DATA_UBO_INDEX});
171
- }
172
-
173
- getDomainUniforms() {
174
- const {colorDomain, elevationDomain} = this.props;
175
- const domainUniforms: Record<string, any> = {};
176
- if (colorDomain !== null) {
177
- domainUniforms.colorDomainValid = true;
178
- domainUniforms.colorDomain = colorDomain;
179
- } else {
180
- domainUniforms.colorDomainValid = false;
181
- }
182
- if (elevationDomain !== null) {
183
- domainUniforms.elevationDomainValid = true;
184
- domainUniforms.elevationDomain = elevationDomain;
185
- } else {
186
- domainUniforms.elevationDomainValid = false;
187
- }
188
- return domainUniforms;
189
- }
190
-
191
- private _setupUniformBuffer(model: Model): void {
192
- // @ts-expect-error TODO v9 This code is not portable to WebGPU
193
- const programHandle = model.pipeline.handle;
194
-
195
- const gl = this.context.gl;
196
- const colorIndex = gl.getUniformBlockIndex(programHandle, 'ColorData');
197
- const elevationIndex = gl.getUniformBlockIndex(programHandle, 'ElevationData');
198
- gl.uniformBlockBinding(programHandle, colorIndex, COLOR_DATA_UBO_INDEX);
199
- gl.uniformBlockBinding(programHandle, elevationIndex, ELEVATION_DATA_UBO_INDEX);
200
- }
201
- }
@@ -1,455 +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
-
21
- import {GL} from '@luma.gl/constants';
22
- import {
23
- Accessor,
24
- AccessorFunction,
25
- Color,
26
- Material,
27
- GetPickingInfoParams,
28
- LayerContext,
29
- log,
30
- PickingInfo,
31
- Position,
32
- DefaultProps
33
- } from '@deck.gl/core';
34
-
35
- import GPUGridAggregator from '../utils/gpu-grid-aggregation/gpu-grid-aggregator';
36
- import {AGGREGATION_OPERATION} from '../utils/aggregation-operation-utils';
37
- import {defaultColorRange, colorRangeToFlatArray} from '../utils/color-utils';
38
- import GPUGridCellLayer from './gpu-grid-cell-layer';
39
- import {pointToDensityGridDataCPU, GridHash} from './../cpu-grid-layer/grid-aggregator';
40
- import GridAggregationLayer, {GridAggregationLayerProps} from '../grid-aggregation-layer';
41
- import {getBoundingBox, getGridParams} from '../utils/grid-aggregation-utils';
42
-
43
- const defaultProps: DefaultProps<GPUGridLayerProps> = {
44
- // color
45
- colorDomain: null,
46
- colorRange: defaultColorRange,
47
- getColorWeight: {type: 'accessor', value: 1},
48
- colorAggregation: 'SUM',
49
-
50
- // elevation
51
- elevationDomain: null,
52
- elevationRange: [0, 1000],
53
- getElevationWeight: {type: 'accessor', value: 1},
54
- elevationAggregation: 'SUM',
55
- elevationScale: {type: 'number', min: 0, value: 1},
56
-
57
- // grid
58
- cellSize: {type: 'number', min: 1, max: 1000, value: 1000},
59
- coverage: {type: 'number', min: 0, max: 1, value: 1},
60
- getPosition: {type: 'accessor', value: (x: any) => x.position},
61
- extruded: false,
62
-
63
- // Optional material for 'lighting' shader module
64
- material: true
65
- };
66
-
67
- // This layer only perform GPU aggregation, no need to seperate data and weight props
68
- // aggregation will be dirty when any of the props are changed.
69
-
70
- const DIMENSIONS = {
71
- data: {
72
- props: ['cellSize', 'colorAggregation', 'elevationAggregation']
73
- }
74
- // rest of the changes are detected by `state.attributesChanged`
75
- };
76
- const POSITION_ATTRIBUTE_NAME = 'positions';
77
-
78
- /** All properties supported by GPUGridLayer. */
79
- export type GPUGridLayerProps<DataT = unknown> = _GPUGridLayerProps<DataT> &
80
- GridAggregationLayerProps<DataT>;
81
-
82
- /** Properties added by GPUGridLayer. */
83
- export type _GPUGridLayerProps<DataT> = {
84
- /**
85
- * Size of each cell in meters.
86
- * @default 1000
87
- */
88
- cellSize?: number;
89
-
90
- /**
91
- * Color scale domain, default is set to the extent of aggregated weights in each cell.
92
- * @default [min(colorWeight), max(colorWeight)]
93
- */
94
- colorDomain?: [number, number] | null;
95
-
96
- /**
97
- * Default: [colorbrewer](http://colorbrewer2.org/#type=sequential&scheme=YlOrRd&n=6) `6-class YlOrRd`
98
- */
99
- colorRange?: Color[];
100
-
101
- /**
102
- * Cell size multiplier, clamped between 0 - 1.
103
- * @default 1
104
- */
105
- coverage?: number;
106
-
107
- /**
108
- * Elevation scale input domain, default is set to between 0 and the max of aggregated weights in each cell.
109
- * @default [0, max(elevationWeight)]
110
- */
111
- elevationDomain?: [number, number] | null;
112
-
113
- /**
114
- * Elevation scale output range.
115
- * @default [0, 1000]
116
- */
117
- elevationRange?: [number, number];
118
-
119
- /**
120
- * Cell elevation multiplier.
121
- * @default 1
122
- */
123
- elevationScale?: number;
124
-
125
- /**
126
- * Whether to enable cell elevation. If set to false, all cell will be flat.
127
- * @default true
128
- */
129
- extruded?: boolean;
130
-
131
- /**
132
- * Material settings for lighting effect. Applies if `extruded: true`.
133
- *
134
- * @default true
135
- * @see https://deck.gl/docs/developer-guide/using-lighting
136
- */
137
- material?: Material;
138
-
139
- /**
140
- * Defines the operation used to aggregate all data object weights to calculate a cell's color value.
141
- * @default 'SUM'
142
- */
143
- colorAggregation?: 'SUM' | 'MEAN' | 'MIN' | 'MAX';
144
-
145
- /**
146
- * Defines the operation used to aggregate all data object weights to calculate a cell's elevation value.
147
- * @default 'SUM'
148
- */
149
- elevationAggregation?: 'SUM' | 'MEAN' | 'MIN' | 'MAX';
150
-
151
- /**
152
- * Method called to retrieve the position of each object.
153
- * @default object => object.position
154
- */
155
- getPosition?: AccessorFunction<DataT, Position>;
156
-
157
- /**
158
- * The weight of a data object used to calculate the color value for a cell.
159
- * @default 1
160
- */
161
- getColorWeight?: Accessor<DataT, number>;
162
-
163
- /**
164
- * The weight of a data object used to calculate the elevation value for a cell.
165
- * @default 1
166
- */
167
- getElevationWeight?: Accessor<DataT, number>;
168
- };
169
-
170
- /** Aggregate data into a grid-based heatmap. Aggregation is performed on GPU. */
171
- export default class GPUGridLayer<
172
- DataT = any,
173
- ExtraPropsT extends {} = {}
174
- > extends GridAggregationLayer<DataT, ExtraPropsT & Required<_GPUGridLayerProps<DataT>>> {
175
- static layerName = 'GPUGridLayer';
176
- static defaultProps = defaultProps;
177
-
178
- state!: GridAggregationLayer<DataT>['state'] & {
179
- isSupported: boolean;
180
- gridHash?: GridHash;
181
- };
182
-
183
- initializeState({device}: LayerContext): void {
184
- const isSupported = GPUGridAggregator.isSupported(device);
185
- if (!isSupported) {
186
- log.error('GPUGridLayer is not supported on this browser, use GridLayer instead')();
187
- }
188
- super.initializeAggregationLayer({
189
- dimensions: DIMENSIONS
190
- });
191
- this.setState({
192
- gpuAggregation: false, // TODO(v9): Re-enable GPU aggregation.
193
- projectPoints: false, // aggregation in world space
194
- isSupported,
195
- weights: {
196
- color: {
197
- needMin: true,
198
- needMax: true,
199
- combineMaxMin: true,
200
- maxMinBuffer: device.createBuffer({
201
- byteLength: 4 * 4,
202
- // @ts-expect-error webgl-legacy
203
- accessor: {size: 4, type: GL.FLOAT, divisor: 1}
204
- })
205
- },
206
- elevation: {
207
- needMin: true,
208
- needMax: true,
209
- combineMaxMin: true,
210
- maxMinBuffer: device.createBuffer({
211
- byteLength: 4 * 4,
212
- // @ts-expect-error
213
- accessor: {size: 4, type: GL.FLOAT, divisor: 1}
214
- })
215
- }
216
- },
217
- positionAttributeName: 'positions'
218
- });
219
- const attributeManager = this.getAttributeManager()!;
220
- attributeManager.add({
221
- [POSITION_ATTRIBUTE_NAME]: {
222
- size: 3,
223
- accessor: 'getPosition',
224
- type: 'float64',
225
- fp64: this.use64bitPositions()
226
- },
227
- color: {size: 3, accessor: 'getColorWeight'},
228
- elevation: {size: 3, accessor: 'getElevationWeight'}
229
- });
230
- }
231
-
232
- updateState(opts) {
233
- if (this.state.isSupported === false) {
234
- // Skip update, layer not supported
235
- return;
236
- }
237
- super.updateState(opts);
238
- const {aggregationDirty} = this.state;
239
- if (aggregationDirty) {
240
- // reset cached CPU Aggregation results (used for picking)
241
- this.setState({
242
- gridHash: null
243
- });
244
- }
245
- }
246
-
247
- getHashKeyForIndex(index: number): string {
248
- const {numRow, numCol, boundingBox, gridOffset} = this.state;
249
- const gridSize = [numCol, numRow];
250
- const gridOrigin = [boundingBox.xMin, boundingBox.yMin];
251
- const cellSize = [gridOffset.xOffset, gridOffset.yOffset];
252
-
253
- const yIndex = Math.floor(index / gridSize[0]);
254
- const xIndex = index - yIndex * gridSize[0];
255
- // This will match the index to the hash-key to access aggregation data from CPU aggregation results.
256
- const latIdx = Math.floor(
257
- (yIndex * cellSize[1] + gridOrigin[1] + 90 + cellSize[1] / 2) / cellSize[1]
258
- );
259
- const lonIdx = Math.floor(
260
- (xIndex * cellSize[0] + gridOrigin[0] + 180 + cellSize[0] / 2) / cellSize[0]
261
- );
262
- return `${latIdx}-${lonIdx}`;
263
- }
264
-
265
- getPositionForIndex(index: number): Position {
266
- const {numRow, numCol, boundingBox, gridOffset} = this.state;
267
- const gridSize = [numCol, numRow];
268
- const gridOrigin = [boundingBox.xMin, boundingBox.yMin];
269
- const cellSize = [gridOffset.xOffset, gridOffset.yOffset];
270
-
271
- const yIndex = Math.floor(index / gridSize[0]);
272
- const xIndex = index - yIndex * gridSize[0];
273
- const yPos = yIndex * cellSize[1] + gridOrigin[1];
274
- const xPos = xIndex * cellSize[0] + gridOrigin[0];
275
- return [xPos, yPos];
276
- }
277
-
278
- getPickingInfo({info, mode}: GetPickingInfoParams): PickingInfo {
279
- const {index} = info;
280
- let object: any = null;
281
- if (index >= 0) {
282
- const gpuGridAggregator = this.state.gpuGridAggregator!;
283
- const position = this.getPositionForIndex(index);
284
- const colorInfo = GPUGridAggregator.getAggregationData({
285
- pixelIndex: index,
286
- ...gpuGridAggregator.getData('color')
287
- });
288
- const elevationInfo = GPUGridAggregator.getAggregationData({
289
- pixelIndex: index,
290
- ...gpuGridAggregator.getData('elevation')
291
- });
292
-
293
- object = {
294
- colorValue: colorInfo.cellWeight,
295
- elevationValue: elevationInfo.cellWeight,
296
- count: colorInfo.cellCount || elevationInfo.cellCount,
297
- position,
298
- totalCount: colorInfo.totalCount || elevationInfo.totalCount
299
- };
300
- if (mode !== 'hover') {
301
- // perform CPU aggregation for full list of points for each cell
302
- const {props} = this;
303
- let {gridHash} = this.state;
304
- if (!gridHash) {
305
- const {gridOffset, translation, boundingBox} = this.state;
306
- const {viewport} = this.context;
307
- const attributes = this.getAttributes();
308
- const cpuAggregation = pointToDensityGridDataCPU(props as any, {
309
- gridOffset,
310
- attributes,
311
- viewport,
312
- translation,
313
- boundingBox
314
- });
315
- gridHash = cpuAggregation.gridHash;
316
- this.setState({gridHash});
317
- }
318
- const key = this.getHashKeyForIndex(index);
319
- const cpuAggregationData = gridHash[key];
320
- Object.assign(object, cpuAggregationData);
321
- }
322
- }
323
-
324
- // override object with picked cell
325
- info.picked = Boolean(object);
326
- info.object = object;
327
-
328
- return info;
329
- }
330
-
331
- renderLayers() {
332
- if (!this.state.isSupported) {
333
- return null;
334
- }
335
- const {
336
- elevationScale,
337
- extruded,
338
- cellSize: cellSizeMeters,
339
- coverage,
340
- material,
341
- elevationRange,
342
- colorDomain,
343
- elevationDomain
344
- } = this.props;
345
-
346
- const {weights, numRow, numCol, gridOrigin, gridOffset} = this.state;
347
- const {color, elevation} = weights;
348
- const colorRange = colorRangeToFlatArray(this.props.colorRange);
349
-
350
- const SubLayerClass = this.getSubLayerClass('gpu-grid-cell', GPUGridCellLayer);
351
-
352
- return new SubLayerClass(
353
- {
354
- gridSize: [numCol, numRow],
355
- gridOrigin,
356
- gridOffset: [gridOffset.xOffset, gridOffset.yOffset],
357
- colorRange,
358
- elevationRange,
359
- colorDomain,
360
- elevationDomain,
361
-
362
- cellSize: cellSizeMeters,
363
- coverage,
364
- material,
365
- elevationScale,
366
- extruded
367
- },
368
- this.getSubLayerProps({
369
- id: 'gpu-grid-cell'
370
- }),
371
- {
372
- data: {
373
- attributes: {
374
- colors: color.aggregationBuffer,
375
- elevations: elevation.aggregationBuffer
376
- }
377
- },
378
- colorMaxMinBuffer: color.maxMinBuffer,
379
- elevationMaxMinBuffer: elevation.maxMinBuffer,
380
- numInstances: numCol * numRow
381
- }
382
- );
383
- }
384
-
385
- finalizeState(context: LayerContext) {
386
- const {color, elevation} = this.state.weights;
387
- [color, elevation].forEach(weight => {
388
- const {aggregationBuffer, maxMinBuffer} = weight;
389
- maxMinBuffer?.destroy();
390
- aggregationBuffer?.destroy();
391
- });
392
- super.finalizeState(context);
393
- }
394
-
395
- // Aggregation Overrides
396
-
397
- updateAggregationState(opts) {
398
- const {props, oldProps} = opts;
399
- const {cellSize, coordinateSystem} = props;
400
- const {viewport} = this.context;
401
- const cellSizeChanged = oldProps.cellSize !== cellSize;
402
- const {dimensions} = this.state;
403
-
404
- const positionsChanged = this.isAttributeChanged(POSITION_ATTRIBUTE_NAME);
405
- // any attribute changed
406
- const attributesChanged = positionsChanged || this.isAttributeChanged();
407
-
408
- let {boundingBox} = this.state;
409
- if (positionsChanged) {
410
- boundingBox = getBoundingBox(this.getAttributes(), this.getNumInstances());
411
- this.setState({boundingBox});
412
- }
413
- if (positionsChanged || cellSizeChanged) {
414
- const {gridOffset, translation, width, height, numCol, numRow} = getGridParams(
415
- boundingBox,
416
- cellSize,
417
- viewport,
418
- coordinateSystem
419
- );
420
- this.allocateResources(numRow, numCol);
421
- this.setState({
422
- gridOffset,
423
- translation,
424
- gridOrigin: [-1 * translation[0], -1 * translation[1]],
425
- width,
426
- height,
427
- numCol,
428
- numRow
429
- });
430
- }
431
-
432
- const aggregationDataDirty =
433
- attributesChanged ||
434
- this.isAggregationDirty(opts, {
435
- dimension: dimensions.data,
436
- compareAll: true
437
- });
438
-
439
- if (aggregationDataDirty) {
440
- this._updateAccessors(opts);
441
- }
442
- this.setState({
443
- aggregationDataDirty
444
- });
445
- }
446
-
447
- // Private
448
-
449
- _updateAccessors(opts) {
450
- const {colorAggregation, elevationAggregation} = opts.props;
451
- const {color, elevation} = this.state.weights;
452
- color.operation = AGGREGATION_OPERATION[colorAggregation];
453
- elevation.operation = AGGREGATION_OPERATION[elevationAggregation];
454
- }
455
- }