@deck.gl/aggregation-layers 9.0.40 → 9.1.0-beta.3

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 (372) 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 +70 -0
  4. package/dist/common/aggregation-layer.js.map +1 -0
  5. package/dist/common/aggregator/aggregator.d.ts +76 -0
  6. package/dist/common/aggregator/aggregator.d.ts.map +1 -0
  7. package/dist/common/aggregator/aggregator.js +5 -0
  8. package/dist/common/aggregator/aggregator.js.map +1 -0
  9. package/dist/common/aggregator/cpu-aggregator/aggregate.d.ts +27 -0
  10. package/dist/common/aggregator/cpu-aggregator/aggregate.d.ts.map +1 -0
  11. package/dist/common/aggregator/cpu-aggregator/aggregate.js +67 -0
  12. package/dist/common/aggregator/cpu-aggregator/aggregate.js.map +1 -0
  13. package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.d.ts +70 -0
  14. package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.d.ts.map +1 -0
  15. package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.js +140 -0
  16. package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.js.map +1 -0
  17. package/dist/common/aggregator/cpu-aggregator/sort-bins.d.ts +15 -0
  18. package/dist/common/aggregator/cpu-aggregator/sort-bins.d.ts.map +1 -0
  19. package/dist/common/aggregator/cpu-aggregator/sort-bins.js +44 -0
  20. package/dist/common/aggregator/cpu-aggregator/sort-bins.js.map +1 -0
  21. package/dist/common/aggregator/cpu-aggregator/vertex-accessor.d.ts +21 -0
  22. package/dist/common/aggregator/cpu-aggregator/vertex-accessor.d.ts.map +1 -0
  23. package/dist/common/aggregator/cpu-aggregator/vertex-accessor.js +56 -0
  24. package/dist/common/aggregator/cpu-aggregator/vertex-accessor.js.map +1 -0
  25. package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.d.ts +18 -0
  26. package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.d.ts.map +1 -0
  27. package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.js +21 -0
  28. package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.js.map +1 -0
  29. package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.d.ts +14 -0
  30. package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.d.ts.map +1 -0
  31. package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.js +18 -0
  32. package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.js.map +1 -0
  33. package/dist/common/aggregator/gpu-aggregator/utils.d.ts +6 -0
  34. package/dist/common/aggregator/gpu-aggregator/utils.d.ts.map +1 -0
  35. package/dist/common/aggregator/gpu-aggregator/utils.js +25 -0
  36. package/dist/common/aggregator/gpu-aggregator/utils.js.map +1 -0
  37. package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.d.ts +24 -0
  38. package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.d.ts.map +1 -0
  39. package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.js +216 -0
  40. package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.js.map +1 -0
  41. package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.d.ts +81 -0
  42. package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.d.ts.map +1 -0
  43. package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.js +202 -0
  44. package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.js.map +1 -0
  45. package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.d.ts +38 -0
  46. package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.d.ts.map +1 -0
  47. package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.js +224 -0
  48. package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.js.map +1 -0
  49. package/dist/common/aggregator/index.d.ts +6 -0
  50. package/dist/common/aggregator/index.d.ts.map +1 -0
  51. package/dist/common/aggregator/index.js +6 -0
  52. package/dist/common/aggregator/index.js.map +1 -0
  53. package/dist/common/types.d.ts +11 -0
  54. package/dist/common/types.d.ts.map +1 -0
  55. package/dist/common/types.js +5 -0
  56. package/dist/common/types.js.map +1 -0
  57. package/dist/common/utils/bounds-utils.d.ts +10 -0
  58. package/dist/common/utils/bounds-utils.d.ts.map +1 -0
  59. package/dist/common/utils/bounds-utils.js +21 -0
  60. package/dist/common/utils/bounds-utils.js.map +1 -0
  61. package/dist/common/utils/color-utils.d.ts +10 -0
  62. package/dist/common/utils/color-utils.d.ts.map +1 -0
  63. package/dist/common/utils/color-utils.js +66 -0
  64. package/dist/common/utils/color-utils.js.map +1 -0
  65. package/dist/common/utils/prop-utils.d.ts.map +1 -0
  66. package/dist/common/utils/prop-utils.js +13 -0
  67. package/dist/common/utils/prop-utils.js.map +1 -0
  68. package/dist/common/utils/scale-utils.d.ts +46 -0
  69. package/dist/common/utils/scale-utils.d.ts.map +1 -0
  70. package/dist/common/utils/scale-utils.js +181 -0
  71. package/dist/common/utils/scale-utils.js.map +1 -0
  72. package/dist/contour-layer/bin-options-uniforms.d.ts +13 -0
  73. package/dist/contour-layer/bin-options-uniforms.d.ts.map +1 -0
  74. package/dist/contour-layer/bin-options-uniforms.js +18 -0
  75. package/dist/contour-layer/bin-options-uniforms.js.map +1 -0
  76. package/dist/contour-layer/contour-layer.d.ts +42 -50
  77. package/dist/contour-layer/contour-layer.d.ts.map +1 -1
  78. package/dist/contour-layer/contour-layer.js +233 -192
  79. package/dist/contour-layer/contour-layer.js.map +1 -0
  80. package/dist/contour-layer/contour-utils.d.ts +36 -15
  81. package/dist/contour-layer/contour-utils.d.ts.map +1 -1
  82. package/dist/contour-layer/contour-utils.js +25 -29
  83. package/dist/contour-layer/contour-utils.js.map +1 -0
  84. package/dist/contour-layer/marching-squares-codes.d.ts.map +1 -1
  85. package/dist/contour-layer/marching-squares-codes.js +4 -0
  86. package/dist/contour-layer/marching-squares-codes.js.map +1 -0
  87. package/dist/contour-layer/marching-squares.d.ts +22 -6
  88. package/dist/contour-layer/marching-squares.d.ts.map +1 -1
  89. package/dist/contour-layer/marching-squares.js +72 -68
  90. package/dist/contour-layer/marching-squares.js.map +1 -0
  91. package/dist/contour-layer/value-reader.d.ts +10 -0
  92. package/dist/contour-layer/value-reader.d.ts.map +1 -0
  93. package/dist/contour-layer/value-reader.js +47 -0
  94. package/dist/contour-layer/value-reader.js.map +1 -0
  95. package/dist/dist.dev.js +4844 -4083
  96. package/dist/grid-layer/bin-options-uniforms.d.ts +13 -0
  97. package/dist/grid-layer/bin-options-uniforms.d.ts.map +1 -0
  98. package/dist/grid-layer/bin-options-uniforms.js +18 -0
  99. package/dist/grid-layer/bin-options-uniforms.js.map +1 -0
  100. package/dist/grid-layer/grid-cell-layer-vertex.glsl.d.ts +3 -0
  101. package/dist/grid-layer/grid-cell-layer-vertex.glsl.d.ts.map +1 -0
  102. package/dist/grid-layer/grid-cell-layer-vertex.glsl.js +52 -0
  103. package/dist/grid-layer/grid-cell-layer-vertex.glsl.js.map +1 -0
  104. package/dist/grid-layer/grid-cell-layer.d.ts +32 -0
  105. package/dist/grid-layer/grid-cell-layer.d.ts.map +1 -0
  106. package/dist/grid-layer/grid-cell-layer.js +94 -0
  107. package/dist/grid-layer/grid-cell-layer.js.map +1 -0
  108. package/dist/grid-layer/grid-layer-uniforms.d.ts +21 -0
  109. package/dist/grid-layer/grid-layer-uniforms.d.ts.map +1 -0
  110. package/dist/grid-layer/grid-layer-uniforms.js +24 -0
  111. package/dist/grid-layer/grid-layer-uniforms.js.map +1 -0
  112. package/dist/grid-layer/grid-layer.d.ts +176 -14
  113. package/dist/grid-layer/grid-layer.d.ts.map +1 -1
  114. package/dist/grid-layer/grid-layer.js +343 -46
  115. package/dist/grid-layer/grid-layer.js.map +1 -0
  116. package/dist/{aggregation-layer.d.ts → heatmap-layer/aggregation-layer.d.ts} +1 -0
  117. package/dist/heatmap-layer/aggregation-layer.d.ts.map +1 -0
  118. package/dist/{aggregation-layer.js → heatmap-layer/aggregation-layer.js} +7 -21
  119. package/dist/heatmap-layer/aggregation-layer.js.map +1 -0
  120. package/dist/heatmap-layer/heatmap-layer-uniforms.d.ts +30 -0
  121. package/dist/heatmap-layer/heatmap-layer-uniforms.d.ts.map +1 -0
  122. package/dist/heatmap-layer/heatmap-layer-uniforms.js +33 -0
  123. package/dist/heatmap-layer/heatmap-layer-uniforms.js.map +1 -0
  124. package/dist/heatmap-layer/heatmap-layer-utils.d.ts +1 -1
  125. package/dist/heatmap-layer/heatmap-layer-utils.d.ts.map +1 -1
  126. package/dist/heatmap-layer/heatmap-layer-utils.js +4 -0
  127. package/dist/heatmap-layer/heatmap-layer-utils.js.map +1 -0
  128. package/dist/heatmap-layer/heatmap-layer.d.ts +6 -4
  129. package/dist/heatmap-layer/heatmap-layer.d.ts.map +1 -1
  130. package/dist/heatmap-layer/heatmap-layer.js +44 -33
  131. package/dist/heatmap-layer/heatmap-layer.js.map +1 -0
  132. package/dist/heatmap-layer/max-fs.glsl.d.ts.map +1 -1
  133. package/dist/heatmap-layer/max-fs.glsl.js +4 -0
  134. package/dist/heatmap-layer/max-fs.glsl.js.map +1 -0
  135. package/dist/heatmap-layer/max-vs.glsl.d.ts +1 -1
  136. package/dist/heatmap-layer/max-vs.glsl.d.ts.map +1 -1
  137. package/dist/heatmap-layer/max-vs.glsl.js +7 -4
  138. package/dist/heatmap-layer/max-vs.glsl.js.map +1 -0
  139. package/dist/heatmap-layer/triangle-layer-fragment.glsl.d.ts +1 -1
  140. package/dist/heatmap-layer/triangle-layer-fragment.glsl.d.ts.map +1 -1
  141. package/dist/heatmap-layer/triangle-layer-fragment.glsl.js +6 -23
  142. package/dist/heatmap-layer/triangle-layer-fragment.glsl.js.map +1 -0
  143. package/dist/heatmap-layer/triangle-layer-uniforms.d.ts +22 -0
  144. package/dist/heatmap-layer/triangle-layer-uniforms.d.ts.map +1 -0
  145. package/dist/heatmap-layer/triangle-layer-uniforms.js +23 -0
  146. package/dist/heatmap-layer/triangle-layer-uniforms.js.map +1 -0
  147. package/dist/heatmap-layer/triangle-layer-vertex.glsl.d.ts +1 -1
  148. package/dist/heatmap-layer/triangle-layer-vertex.glsl.d.ts.map +1 -1
  149. package/dist/heatmap-layer/triangle-layer-vertex.glsl.js +11 -30
  150. package/dist/heatmap-layer/triangle-layer-vertex.glsl.js.map +1 -0
  151. package/dist/heatmap-layer/triangle-layer.d.ts +4 -10
  152. package/dist/heatmap-layer/triangle-layer.d.ts.map +1 -1
  153. package/dist/heatmap-layer/triangle-layer.js +18 -30
  154. package/dist/heatmap-layer/triangle-layer.js.map +1 -0
  155. package/dist/heatmap-layer/weights-fs.glsl.d.ts.map +1 -1
  156. package/dist/heatmap-layer/weights-fs.glsl.js +4 -0
  157. package/dist/heatmap-layer/weights-fs.glsl.js.map +1 -0
  158. package/dist/heatmap-layer/weights-vs.glsl.d.ts +1 -1
  159. package/dist/heatmap-layer/weights-vs.glsl.d.ts.map +1 -1
  160. package/dist/heatmap-layer/weights-vs.glsl.js +7 -7
  161. package/dist/heatmap-layer/weights-vs.glsl.js.map +1 -0
  162. package/dist/hexagon-layer/bin-options-uniforms.d.ts +14 -0
  163. package/dist/hexagon-layer/bin-options-uniforms.d.ts.map +1 -0
  164. package/dist/hexagon-layer/bin-options-uniforms.js +18 -0
  165. package/dist/hexagon-layer/bin-options-uniforms.js.map +1 -0
  166. package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.d.ts +3 -0
  167. package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.d.ts.map +1 -0
  168. package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.js +56 -0
  169. package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.js.map +1 -0
  170. package/dist/hexagon-layer/hexagon-cell-layer.d.ts +29 -0
  171. package/dist/hexagon-layer/hexagon-cell-layer.d.ts.map +1 -0
  172. package/dist/hexagon-layer/hexagon-cell-layer.js +95 -0
  173. package/dist/hexagon-layer/hexagon-cell-layer.js.map +1 -0
  174. package/dist/hexagon-layer/hexagon-layer-uniforms.d.ts +19 -0
  175. package/dist/hexagon-layer/hexagon-layer-uniforms.d.ts.map +1 -0
  176. package/dist/hexagon-layer/hexagon-layer-uniforms.js +22 -0
  177. package/dist/hexagon-layer/hexagon-layer-uniforms.js.map +1 -0
  178. package/dist/hexagon-layer/hexagon-layer.d.ts +84 -54
  179. package/dist/hexagon-layer/hexagon-layer.d.ts.map +1 -1
  180. package/dist/hexagon-layer/hexagon-layer.js +308 -123
  181. package/dist/hexagon-layer/hexagon-layer.js.map +1 -0
  182. package/dist/hexagon-layer/hexbin.d.ts +17 -0
  183. package/dist/hexagon-layer/hexbin.d.ts.map +1 -0
  184. package/dist/hexagon-layer/hexbin.js +70 -0
  185. package/dist/hexagon-layer/hexbin.js.map +1 -0
  186. package/dist/index.cjs +3026 -2947
  187. package/dist/index.cjs.map +4 -4
  188. package/dist/index.d.ts +7 -13
  189. package/dist/index.d.ts.map +1 -1
  190. package/dist/index.js +6 -27
  191. package/dist/index.js.map +1 -0
  192. package/dist/screen-grid-layer/bin-options-uniforms.d.ts +11 -0
  193. package/dist/screen-grid-layer/bin-options-uniforms.d.ts.map +1 -0
  194. package/dist/screen-grid-layer/bin-options-uniforms.js +16 -0
  195. package/dist/screen-grid-layer/bin-options-uniforms.js.map +1 -0
  196. package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts +11 -16
  197. package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts.map +1 -1
  198. package/dist/screen-grid-layer/screen-grid-cell-layer.js +53 -134
  199. package/dist/screen-grid-layer/screen-grid-cell-layer.js.map +1 -0
  200. package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts +1 -1
  201. package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts.map +1 -1
  202. package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.js +5 -24
  203. package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.js.map +1 -0
  204. package/dist/screen-grid-layer/screen-grid-layer-uniforms.d.ts +17 -0
  205. package/dist/screen-grid-layer/screen-grid-layer-uniforms.d.ts.map +1 -0
  206. package/dist/screen-grid-layer/screen-grid-layer-uniforms.js +20 -0
  207. package/dist/screen-grid-layer/screen-grid-layer-uniforms.js.map +1 -0
  208. package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts +1 -1
  209. package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts.map +1 -1
  210. package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.js +22 -62
  211. package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.js.map +1 -0
  212. package/dist/screen-grid-layer/screen-grid-layer.d.ts +33 -40
  213. package/dist/screen-grid-layer/screen-grid-layer.d.ts.map +1 -1
  214. package/dist/screen-grid-layer/screen-grid-layer.js +158 -174
  215. package/dist/screen-grid-layer/screen-grid-layer.js.map +1 -0
  216. package/dist.min.js +401 -382
  217. package/package.json +10 -9
  218. package/src/common/aggregation-layer.ts +107 -0
  219. package/src/common/aggregator/aggregator.ts +88 -0
  220. package/src/common/aggregator/cpu-aggregator/aggregate.ts +101 -0
  221. package/src/common/aggregator/cpu-aggregator/cpu-aggregator.ts +203 -0
  222. package/src/common/aggregator/cpu-aggregator/sort-bins.ts +63 -0
  223. package/src/common/aggregator/cpu-aggregator/vertex-accessor.ts +86 -0
  224. package/src/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.ts +33 -0
  225. package/src/common/aggregator/gpu-aggregator/bin-sorter-uniforms.ts +27 -0
  226. package/src/common/aggregator/gpu-aggregator/utils.ts +27 -0
  227. package/src/common/aggregator/gpu-aggregator/webgl-aggregation-transform.ts +247 -0
  228. package/src/common/aggregator/gpu-aggregator/webgl-aggregator.ts +274 -0
  229. package/src/common/aggregator/gpu-aggregator/webgl-bin-sorter.ts +258 -0
  230. package/src/common/aggregator/index.ts +10 -0
  231. package/src/{types.ts → common/types.ts} +10 -4
  232. package/src/common/utils/bounds-utils.ts +34 -0
  233. package/src/common/utils/color-utils.ts +86 -0
  234. package/src/common/utils/prop-utils.ts +13 -0
  235. package/src/common/utils/scale-utils.ts +236 -0
  236. package/src/contour-layer/bin-options-uniforms.ts +26 -0
  237. package/src/contour-layer/contour-layer.ts +300 -265
  238. package/src/contour-layer/contour-utils.ts +68 -39
  239. package/src/contour-layer/marching-squares-codes.ts +4 -0
  240. package/src/contour-layer/marching-squares.ts +93 -82
  241. package/src/contour-layer/value-reader.ts +65 -0
  242. package/src/grid-layer/bin-options-uniforms.ts +26 -0
  243. package/src/grid-layer/grid-cell-layer-vertex.glsl.ts +68 -0
  244. package/src/grid-layer/grid-cell-layer.ts +141 -0
  245. package/src/grid-layer/grid-layer-uniforms.ts +37 -0
  246. package/src/grid-layer/grid-layer.ts +614 -73
  247. package/src/{aggregation-layer.ts → heatmap-layer/aggregation-layer.ts} +6 -21
  248. package/src/heatmap-layer/heatmap-layer-uniforms.ts +50 -0
  249. package/src/heatmap-layer/heatmap-layer-utils.ts +9 -1
  250. package/src/heatmap-layer/heatmap-layer.ts +59 -36
  251. package/src/heatmap-layer/max-fs.glsl.ts +4 -0
  252. package/src/heatmap-layer/max-vs.glsl.ts +7 -4
  253. package/src/heatmap-layer/triangle-layer-fragment.glsl.ts +5 -23
  254. package/src/heatmap-layer/triangle-layer-uniforms.ts +37 -0
  255. package/src/heatmap-layer/triangle-layer-vertex.glsl.ts +10 -30
  256. package/src/heatmap-layer/triangle-layer.ts +26 -31
  257. package/src/heatmap-layer/weights-fs.glsl.ts +4 -0
  258. package/src/heatmap-layer/weights-vs.glsl.ts +7 -7
  259. package/src/hexagon-layer/bin-options-uniforms.ts +27 -0
  260. package/src/hexagon-layer/hexagon-cell-layer-vertex.glsl.ts +73 -0
  261. package/src/hexagon-layer/hexagon-cell-layer.ts +141 -0
  262. package/src/hexagon-layer/hexagon-layer-uniforms.ts +34 -0
  263. package/src/hexagon-layer/hexagon-layer.ts +454 -186
  264. package/src/hexagon-layer/hexbin.ts +79 -0
  265. package/src/index.ts +21 -34
  266. package/src/screen-grid-layer/bin-options-uniforms.ts +23 -0
  267. package/src/screen-grid-layer/screen-grid-cell-layer.ts +71 -156
  268. package/src/screen-grid-layer/screen-grid-layer-fragment.glsl.ts +4 -24
  269. package/src/screen-grid-layer/screen-grid-layer-uniforms.ts +31 -0
  270. package/src/screen-grid-layer/screen-grid-layer-vertex.glsl.ts +21 -64
  271. package/src/screen-grid-layer/screen-grid-layer.ts +194 -222
  272. package/dist/aggregation-layer.d.ts.map +0 -1
  273. package/dist/cpu-grid-layer/cpu-grid-layer.d.ts +0 -158
  274. package/dist/cpu-grid-layer/cpu-grid-layer.d.ts.map +0 -1
  275. package/dist/cpu-grid-layer/cpu-grid-layer.js +0 -130
  276. package/dist/cpu-grid-layer/grid-aggregator.d.ts +0 -35
  277. package/dist/cpu-grid-layer/grid-aggregator.d.ts.map +0 -1
  278. package/dist/cpu-grid-layer/grid-aggregator.js +0 -141
  279. package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts +0 -3
  280. package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts.map +0 -1
  281. package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +0 -30
  282. package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts +0 -3
  283. package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts.map +0 -1
  284. package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +0 -112
  285. package/dist/gpu-grid-layer/gpu-grid-cell-layer.d.ts +0 -48
  286. package/dist/gpu-grid-layer/gpu-grid-cell-layer.d.ts.map +0 -1
  287. package/dist/gpu-grid-layer/gpu-grid-cell-layer.js +0 -146
  288. package/dist/gpu-grid-layer/gpu-grid-layer.d.ts +0 -99
  289. package/dist/gpu-grid-layer/gpu-grid-layer.d.ts.map +0 -1
  290. package/dist/gpu-grid-layer/gpu-grid-layer.js +0 -289
  291. package/dist/grid-aggregation-layer.d.ts +0 -67
  292. package/dist/grid-aggregation-layer.d.ts.map +0 -1
  293. package/dist/grid-aggregation-layer.js +0 -173
  294. package/dist/hexagon-layer/hexagon-aggregator.d.ts +0 -27
  295. package/dist/hexagon-layer/hexagon-aggregator.d.ts.map +0 -1
  296. package/dist/hexagon-layer/hexagon-aggregator.js +0 -112
  297. package/dist/types.d.ts +0 -12
  298. package/dist/types.d.ts.map +0 -1
  299. package/dist/types.js +0 -1
  300. package/dist/utils/aggregation-operation-utils.d.ts +0 -19
  301. package/dist/utils/aggregation-operation-utils.d.ts.map +0 -1
  302. package/dist/utils/aggregation-operation-utils.js +0 -94
  303. package/dist/utils/bin-sorter.d.ts +0 -52
  304. package/dist/utils/bin-sorter.d.ts.map +0 -1
  305. package/dist/utils/bin-sorter.js +0 -167
  306. package/dist/utils/color-utils.d.ts +0 -3
  307. package/dist/utils/color-utils.d.ts.map +0 -1
  308. package/dist/utils/color-utils.js +0 -53
  309. package/dist/utils/cpu-aggregator.d.ts +0 -169
  310. package/dist/utils/cpu-aggregator.d.ts.map +0 -1
  311. package/dist/utils/cpu-aggregator.js +0 -421
  312. package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts +0 -3
  313. package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts.map +0 -1
  314. package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +0 -36
  315. package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts +0 -3
  316. package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts.map +0 -1
  317. package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +0 -42
  318. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts +0 -3
  319. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts.map +0 -1
  320. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +0 -30
  321. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts +0 -3
  322. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts.map +0 -1
  323. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +0 -61
  324. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts +0 -38
  325. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts.map +0 -1
  326. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +0 -41
  327. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts +0 -1
  328. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts.map +0 -1
  329. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +0 -1
  330. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts +0 -76
  331. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts.map +0 -1
  332. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +0 -555
  333. package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts +0 -3
  334. package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts.map +0 -1
  335. package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +0 -32
  336. package/dist/utils/grid-aggregation-utils.d.ts +0 -30
  337. package/dist/utils/grid-aggregation-utils.d.ts.map +0 -1
  338. package/dist/utils/grid-aggregation-utils.js +0 -114
  339. package/dist/utils/prop-utils.d.ts.map +0 -1
  340. package/dist/utils/prop-utils.js +0 -28
  341. package/dist/utils/resource-utils.d.ts +0 -14
  342. package/dist/utils/resource-utils.d.ts.map +0 -1
  343. package/dist/utils/resource-utils.js +0 -38
  344. package/dist/utils/scale-utils.d.ts +0 -15
  345. package/dist/utils/scale-utils.d.ts.map +0 -1
  346. package/dist/utils/scale-utils.js +0 -184
  347. package/src/cpu-grid-layer/cpu-grid-layer.ts +0 -329
  348. package/src/cpu-grid-layer/grid-aggregator.ts +0 -184
  349. package/src/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.ts +0 -35
  350. package/src/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.ts +0 -143
  351. package/src/gpu-grid-layer/gpu-grid-cell-layer.ts +0 -201
  352. package/src/gpu-grid-layer/gpu-grid-layer.ts +0 -455
  353. package/src/grid-aggregation-layer.ts +0 -243
  354. package/src/hexagon-layer/hexagon-aggregator.ts +0 -127
  355. package/src/utils/aggregation-operation-utils.ts +0 -118
  356. package/src/utils/bin-sorter.ts +0 -218
  357. package/src/utils/color-utils.ts +0 -57
  358. package/src/utils/cpu-aggregator.ts +0 -503
  359. package/src/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.ts +0 -40
  360. package/src/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.ts +0 -54
  361. package/src/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.ts +0 -35
  362. package/src/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.ts +0 -79
  363. package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.ts +0 -46
  364. package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.ts +0 -0
  365. package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +0 -155
  366. package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.ts +0 -690
  367. package/src/utils/gpu-grid-aggregation/transform-mean-vs.glsl.ts +0 -38
  368. package/src/utils/grid-aggregation-utils.ts +0 -147
  369. package/src/utils/prop-utils.ts +0 -29
  370. package/src/utils/resource-utils.ts +0 -53
  371. package/src/utils/scale-utils.js +0 -219
  372. /package/dist/{utils → common/utils}/prop-utils.d.ts +0 -0
@@ -1,66 +1,41 @@
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.
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
20
4
 
21
5
  import {
22
6
  Accessor,
23
7
  Color,
24
8
  GetPickingInfoParams,
9
+ CompositeLayerProps,
25
10
  Layer,
26
- LayerContext,
11
+ project32,
27
12
  LayersList,
28
- log,
29
13
  PickingInfo,
30
14
  Position,
31
15
  UpdateParameters,
32
16
  DefaultProps
33
17
  } from '@deck.gl/core';
34
- import type {Buffer, Texture} from '@luma.gl/core';
35
- import GPUGridAggregator from '../utils/gpu-grid-aggregation/gpu-grid-aggregator';
36
- import {AGGREGATION_OPERATION, getValueFunc} from '../utils/aggregation-operation-utils';
18
+ import {WebGLAggregator, CPUAggregator, AggregationOperation} from '../common/aggregator/index';
19
+ import AggregationLayer from '../common/aggregation-layer';
37
20
  import ScreenGridCellLayer from './screen-grid-cell-layer';
38
- import GridAggregationLayer, {GridAggregationLayerProps} from '../grid-aggregation-layer';
39
- import {getFloatTexture} from '../utils/resource-utils';
21
+ import {BinOptions, binOptionsUniforms} from './bin-options-uniforms';
22
+ import {defaultColorRange} from '../common/utils/color-utils';
40
23
 
41
24
  const defaultProps: DefaultProps<ScreenGridLayerProps> = {
42
- ...(ScreenGridCellLayer.defaultProps as DefaultProps<ScreenGridLayerProps<unknown>>),
25
+ cellSizePixels: {type: 'number', value: 100, min: 1},
26
+ cellMarginPixels: {type: 'number', value: 2, min: 0},
27
+ colorRange: defaultColorRange,
28
+ colorScaleType: 'linear',
43
29
  getPosition: {type: 'accessor', value: (d: any) => d.position},
44
30
  getWeight: {type: 'accessor', value: 1},
45
31
 
46
- gpuAggregation: false, // TODO(v9): Re-enable GPU aggregation.
32
+ gpuAggregation: true,
47
33
  aggregation: 'SUM'
48
34
  };
49
35
 
50
- const POSITION_ATTRIBUTE_NAME = 'positions';
51
- const DIMENSIONS = {
52
- data: {
53
- props: ['cellSizePixels']
54
- },
55
- weights: {
56
- props: ['aggregation'],
57
- accessors: ['getWeight']
58
- }
59
- };
60
-
61
36
  /** All properties supported by ScreenGridLayer. */
62
37
  export type ScreenGridLayerProps<DataT = unknown> = _ScreenGridLayerProps<DataT> &
63
- GridAggregationLayerProps<DataT>;
38
+ CompositeLayerProps;
64
39
 
65
40
  /** Properties added by ScreenGridLayer. */
66
41
  export type _ScreenGridLayerProps<DataT> = {
@@ -76,20 +51,6 @@ export type _ScreenGridLayerProps<DataT> = {
76
51
  */
77
52
  cellMarginPixels?: number;
78
53
 
79
- /**
80
- * Expressed as an rgba array, minimal color that could be rendered by a tile.
81
- * @default [0, 0, 0, 255]
82
- * @deprecated Deprecated in version 5.2.0, use `colorRange` and `colorDomain` instead.
83
- */
84
- minColor?: Color | null;
85
-
86
- /**
87
- * Expressed as an rgba array, maximal color that could be rendered by a tile.
88
- * @default [0, 255, 0, 255]
89
- * @deprecated Deprecated in version 5.2.0, use `colorRange` and `colorDomain` instead.
90
- */
91
- maxColor?: Color | null;
92
-
93
54
  /**
94
55
  * Color scale input domain. The color scale maps continues numeric domain into discrete color range.
95
56
  * @default [1, max(weight)]
@@ -103,6 +64,13 @@ export type _ScreenGridLayerProps<DataT> = {
103
64
  */
104
65
  colorRange?: Color[];
105
66
 
67
+ /**
68
+ * Scaling function used to determine the color of the grid cell.
69
+ * Supported Values are 'quantize', 'linear', 'quantile' and 'ordinal'.
70
+ * @default 'quantize'
71
+ */
72
+ colorScaleType?: 'linear' | 'quantize';
73
+
106
74
  /**
107
75
  * Method called to retrieve the position of each object.
108
76
  *
@@ -126,220 +94,224 @@ export type _ScreenGridLayerProps<DataT> = {
126
94
 
127
95
  /**
128
96
  * Defines the type of aggregation operation
129
- *
130
- * V valid values are 'SUM', 'MEAN', 'MIN' and 'MAX'.
97
+ * Valid values are 'SUM', 'MEAN', 'MIN', 'MAX', 'COUNT'.
131
98
  *
132
99
  * @default 'SUM'
133
100
  */
134
- aggregation?: 'SUM' | 'MEAN' | 'MIN' | 'MAX';
101
+ aggregation?: AggregationOperation;
135
102
  };
136
103
 
104
+ export type ScreenGridLayerPickingInfo<DataT> = PickingInfo<{
105
+ /** Column index of the picked cell, starting from 0 at the left of the viewport */
106
+ col: number;
107
+ /** Row index of the picked cell, starting from 0 at the top of the viewport */
108
+ row: number;
109
+ /** Aggregated value */
110
+ value: number;
111
+ /** Number of data points in the picked cell */
112
+ count: number;
113
+ /** Indices of the data objects in the picked cell. Only available if using CPU aggregation. */
114
+ pointIndices?: number[];
115
+ /** The data objects in the picked cell. Only available if using CPU aggregation and layer data is an array. */
116
+ points?: DataT[];
117
+ }>;
118
+
137
119
  /** Aggregates data into histogram bins and renders them as a grid. */
138
120
  export default class ScreenGridLayer<
139
121
  DataT = any,
140
122
  ExtraProps extends {} = {}
141
- > extends GridAggregationLayer<DataT, ExtraProps & Required<_ScreenGridLayerProps<DataT>>> {
123
+ > extends AggregationLayer<DataT, ExtraProps & Required<_ScreenGridLayerProps<DataT>>> {
142
124
  static layerName = 'ScreenGridLayer';
143
125
  static defaultProps = defaultProps;
144
126
 
145
- state!: GridAggregationLayer<DataT>['state'] & {
146
- supported: boolean;
147
- gpuGridAggregator?: any;
148
- gpuAggregation?: any;
149
- weights?: any;
150
- maxTexture?: Texture;
151
- aggregationBuffer?: Buffer;
152
- maxBuffer?: Buffer;
153
- };
127
+ getAggregatorType(): string {
128
+ return this.props.gpuAggregation && WebGLAggregator.isSupported(this.context.device)
129
+ ? 'gpu'
130
+ : 'cpu';
131
+ }
154
132
 
155
- initializeState() {
156
- super.initializeAggregationLayer({
157
- dimensions: DIMENSIONS,
158
- // @ts-expect-error
159
- getCellSize: props => props.cellSizePixels // TODO
160
- });
161
- const weights = {
162
- count: {
163
- size: 1,
164
- operation: AGGREGATION_OPERATION.SUM,
165
- needMax: true,
166
- maxTexture: getFloatTexture(this.context.device, {id: `${this.id}-max-texture`})
167
- }
168
- };
169
- this.setState({
170
- supported: true,
171
- projectPoints: true, // aggregation in screen space
172
- weights,
173
- subLayerData: {attributes: {}},
174
- maxTexture: weights.count.maxTexture,
175
- positionAttributeName: 'positions',
176
- posOffset: [0, 0],
177
- translation: [1, -1]
133
+ createAggregator(type: string): WebGLAggregator | CPUAggregator {
134
+ if (type === 'cpu' || !WebGLAggregator.isSupported(this.context.device)) {
135
+ return new CPUAggregator({
136
+ dimensions: 2,
137
+ getBin: {
138
+ sources: ['positions'],
139
+ getValue: ({positions}: {positions: number[]}, index: number, opts: BinOptions) => {
140
+ const viewport = this.context.viewport;
141
+ const p = viewport.project(positions);
142
+ const cellSizePixels: number = opts.cellSizePixels;
143
+ if (p[0] < 0 || p[0] >= viewport.width || p[1] < 0 || p[1] >= viewport.height) {
144
+ // Not on screen
145
+ return null;
146
+ }
147
+ return [Math.floor(p[0] / cellSizePixels), Math.floor(p[1] / cellSizePixels)];
148
+ }
149
+ },
150
+ getValue: [{sources: ['counts'], getValue: ({counts}) => counts}]
151
+ });
152
+ }
153
+ return new WebGLAggregator(this.context.device, {
154
+ dimensions: 2,
155
+ channelCount: 1,
156
+ bufferLayout: this.getAttributeManager()!.getBufferLayouts({isInstanced: false}),
157
+ ...super.getShaders({
158
+ modules: [project32, binOptionsUniforms],
159
+ vs: `
160
+ in vec3 positions;
161
+ in vec3 positions64Low;
162
+ in float counts;
163
+
164
+ void getBin(out ivec2 binId) {
165
+ vec4 pos = project_position_to_clipspace(positions, positions64Low, vec3(0.0));
166
+ vec2 screenCoords = vec2(pos.x / pos.w + 1.0, 1.0 - pos.y / pos.w) / 2.0 * project.viewportSize / project.devicePixelRatio;
167
+ vec2 gridCoords = floor(screenCoords / binOptions.cellSizePixels);
168
+ binId = ivec2(gridCoords);
169
+ }
170
+ void getValue(out float weight) {
171
+ weight = counts;
172
+ }
173
+ `
174
+ })
178
175
  });
176
+ }
177
+
178
+ initializeState() {
179
+ super.initializeState();
180
+
179
181
  const attributeManager = this.getAttributeManager()!;
180
182
  attributeManager.add({
181
- [POSITION_ATTRIBUTE_NAME]: {
183
+ positions: {
182
184
  size: 3,
183
185
  accessor: 'getPosition',
184
186
  type: 'float64',
185
187
  fp64: this.use64bitPositions()
186
188
  },
187
189
  // this attribute is used in gpu aggregation path only
188
- count: {size: 3, accessor: 'getWeight'}
190
+ counts: {size: 1, accessor: 'getWeight'}
189
191
  });
190
192
  }
191
193
 
192
194
  shouldUpdateState({changeFlags}: UpdateParameters<this>) {
193
- return this.state.supported && changeFlags.somethingChanged;
195
+ return changeFlags.somethingChanged;
194
196
  }
195
197
 
196
- updateState(opts: UpdateParameters<this>) {
197
- super.updateState(opts);
198
+ updateState(params: UpdateParameters<this>) {
199
+ const aggregatorChanged = super.updateState(params);
200
+
201
+ const {props, oldProps, changeFlags} = params;
202
+ const {cellSizePixels, aggregation} = props;
203
+ if (
204
+ aggregatorChanged ||
205
+ changeFlags.dataChanged ||
206
+ changeFlags.updateTriggersChanged ||
207
+ changeFlags.viewportChanged ||
208
+ aggregation !== oldProps.aggregation ||
209
+ cellSizePixels !== oldProps.cellSizePixels
210
+ ) {
211
+ const {width, height} = this.context.viewport;
212
+ const {aggregator} = this.state;
213
+
214
+ if (aggregator instanceof WebGLAggregator) {
215
+ aggregator.setProps({
216
+ binIdRange: [
217
+ [0, Math.ceil(width / cellSizePixels)],
218
+ [0, Math.ceil(height / cellSizePixels)]
219
+ ]
220
+ });
221
+ }
222
+
223
+ aggregator.setProps({
224
+ pointCount: this.getNumInstances(),
225
+ operations: [aggregation],
226
+ binOptions: {
227
+ cellSizePixels
228
+ }
229
+ });
230
+ }
231
+
232
+ if (changeFlags.viewportChanged) {
233
+ // Rerun aggregation on viewport change
234
+ this.state.aggregator.setNeedsUpdate();
235
+ }
236
+ return aggregatorChanged;
198
237
  }
199
238
 
200
- renderLayers(): LayersList | Layer {
201
- if (!this.state.supported) {
202
- return [];
239
+ onAttributeChange(id: string) {
240
+ const {aggregator} = this.state;
241
+ switch (id) {
242
+ case 'positions':
243
+ aggregator.setNeedsUpdate();
244
+ break;
245
+
246
+ case 'counts':
247
+ aggregator.setNeedsUpdate(0);
248
+ break;
249
+
250
+ default:
251
+ // This should not happen
203
252
  }
204
- const {maxTexture, numRow, numCol, weights} = this.state;
205
- const {updateTriggers} = this.props;
206
- const {aggregationBuffer} = weights.count;
253
+ }
254
+
255
+ renderLayers(): LayersList | Layer | null {
256
+ const {aggregator} = this.state;
207
257
  const CellLayerClass = this.getSubLayerClass('cells', ScreenGridCellLayer);
258
+ const binAttribute = aggregator.getBins();
259
+ const weightAttribute = aggregator.getResult(0);
208
260
 
209
261
  return new CellLayerClass(
210
262
  this.props,
211
263
  this.getSubLayerProps({
212
- id: 'cell-layer',
213
- updateTriggers
264
+ id: 'cell-layer'
214
265
  }),
215
266
  {
216
- data: {attributes: {instanceCounts: aggregationBuffer}},
217
- maxTexture,
218
- numInstances: numRow * numCol
267
+ data: {
268
+ length: aggregator.binCount,
269
+ attributes: {
270
+ getBin: binAttribute,
271
+ getWeight: weightAttribute
272
+ }
273
+ },
274
+ // Data has changed shallowly, but we likely don't need to update the attributes
275
+ dataComparator: (data, oldData) => data.length === oldData.length,
276
+ updateTriggers: {
277
+ getBin: [binAttribute],
278
+ getWeight: [weightAttribute]
279
+ },
280
+ parameters: {
281
+ depthWriteEnabled: false,
282
+ ...this.props.parameters
283
+ },
284
+ // Evaluate domain at draw() time
285
+ colorDomain: () => this.props.colorDomain || aggregator.getResultDomain(0),
286
+ // Extensions are already handled by the GPUAggregator, do not pass it down
287
+ extensions: []
219
288
  }
220
289
  );
221
290
  }
222
291
 
223
- finalizeState(context: LayerContext): void {
224
- super.finalizeState(context);
225
-
226
- const {aggregationBuffer, maxBuffer, maxTexture} = this.state;
227
-
228
- aggregationBuffer?.delete();
229
- maxBuffer?.delete();
230
- maxTexture?.delete();
231
- }
232
-
233
- getPickingInfo({info}: GetPickingInfoParams): PickingInfo {
292
+ getPickingInfo(params: GetPickingInfoParams): ScreenGridLayerPickingInfo<DataT> {
293
+ const info: ScreenGridLayerPickingInfo<DataT> = params.info;
234
294
  const {index} = info;
235
295
  if (index >= 0) {
236
- const {gpuGridAggregator, gpuAggregation, weights} = this.state;
237
- // Get count aggregation results
238
- const aggregationResults = gpuAggregation
239
- ? gpuGridAggregator.getData('count')
240
- : weights.count;
241
-
242
- // Each instance (one cell) is aggregated into single pixel,
243
- // Get current instance's aggregation details.
244
- info.object = GPUGridAggregator.getAggregationData({
245
- pixelIndex: index,
246
- ...aggregationResults
247
- });
248
- }
249
-
250
- return info;
251
- }
252
-
253
- // Aggregation Overrides
254
-
255
- updateResults({aggregationData, maxData}) {
256
- const {count} = this.state.weights;
257
- count.aggregationData = aggregationData;
258
- count.aggregationBuffer.write(aggregationData);
259
- count.maxData = maxData;
260
- count.maxTexture.setImageData({data: maxData});
261
- }
262
-
263
- /* eslint-disable complexity, max-statements */
264
- updateAggregationState(opts) {
265
- const cellSize = opts.props.cellSizePixels;
266
- const cellSizeChanged = opts.oldProps.cellSizePixels !== cellSize;
267
- const {viewportChanged} = opts.changeFlags;
268
- let gpuAggregation = opts.props.gpuAggregation;
269
- if (this.state.gpuAggregation !== opts.props.gpuAggregation) {
270
- if (gpuAggregation && !GPUGridAggregator.isSupported(this.context.device)) {
271
- log.warn('GPU Grid Aggregation not supported, falling back to CPU')();
272
- gpuAggregation = false;
296
+ const bin = this.state.aggregator.getBin(index);
297
+ let object: ScreenGridLayerPickingInfo<DataT>['object'];
298
+ if (bin) {
299
+ object = {
300
+ col: bin.id[0],
301
+ row: bin.id[1],
302
+ value: bin.value[0],
303
+ count: bin.count
304
+ };
305
+ if (bin.pointIndices) {
306
+ object.pointIndices = bin.pointIndices;
307
+ object.points = Array.isArray(this.props.data)
308
+ ? bin.pointIndices.map(i => (this.props.data as DataT[])[i])
309
+ : [];
310
+ }
273
311
  }
312
+ info.object = object;
274
313
  }
275
- const gpuAggregationChanged = gpuAggregation !== this.state.gpuAggregation;
276
- this.setState({
277
- gpuAggregation
278
- });
279
314
 
280
- const positionsChanged = this.isAttributeChanged(POSITION_ATTRIBUTE_NAME);
281
-
282
- const {dimensions} = this.state;
283
- const {data, weights} = dimensions;
284
- const aggregationDataDirty =
285
- positionsChanged ||
286
- gpuAggregationChanged ||
287
- viewportChanged ||
288
- this.isAggregationDirty(opts, {
289
- compareAll: gpuAggregation, // check for all (including extentions props) when using gpu aggregation
290
- dimension: data
291
- });
292
- const aggregationWeightsDirty = this.isAggregationDirty(opts, {dimension: weights});
293
-
294
- this.setState({
295
- aggregationDataDirty,
296
- aggregationWeightsDirty
297
- });
298
-
299
- const {viewport} = this.context;
300
-
301
- if (viewportChanged || cellSizeChanged) {
302
- const {width, height} = viewport;
303
- const numCol = Math.ceil(width / cellSize);
304
- const numRow = Math.ceil(height / cellSize);
305
- this.allocateResources(numRow, numCol);
306
- this.setState({
307
- // transformation from clipspace to screen(pixel) space
308
- scaling: [width / 2, -height / 2, 1],
309
-
310
- gridOffset: {xOffset: cellSize, yOffset: cellSize},
311
- width,
312
- height,
313
- numCol,
314
- numRow
315
- });
316
- }
317
-
318
- if (aggregationWeightsDirty) {
319
- this._updateAccessors(opts);
320
- }
321
- if (aggregationDataDirty || aggregationWeightsDirty) {
322
- this._resetResults();
323
- }
324
- }
325
- /* eslint-enable complexity, max-statements */
326
-
327
- // Private
328
-
329
- _updateAccessors(opts) {
330
- const {getWeight, aggregation, data} = opts.props;
331
- const {count} = this.state.weights;
332
- if (count) {
333
- count.getWeight = getWeight;
334
- count.operation = AGGREGATION_OPERATION[aggregation];
335
- }
336
- this.setState({getValue: getValueFunc(aggregation, getWeight, {data})});
337
- }
338
-
339
- _resetResults() {
340
- const {count} = this.state.weights;
341
- if (count) {
342
- count.aggregationData = null;
343
- }
315
+ return info;
344
316
  }
345
317
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"aggregation-layer.d.ts","sourceRoot":"","sources":["../src/aggregation-layer.ts"],"names":[],"mappings":"AAoBA,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,eAAe,EAEf,gBAAgB,EAChB,mBAAmB,EACnB,SAAS,EACV,MAAM,eAAe,CAAC;AAGvB,MAAM,MAAM,qBAAqB,CAAC,KAAK,IAAI,mBAAmB,GAAG;IAC/D,IAAI,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC;CAC9B,CAAC;AAEF,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,gBAAgB,CAC5C,KAAK,EACL,WAAW,SAAS,EAAE,GAAG,EAAE,CAC3B,SAAQ,cAAc,CAAC,QAAQ,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,GAAG,WAAW,CAAC;IACvE,MAAM,CAAC,SAAS,SAAsB;IAEtC,KAAK,EAAG;QACN,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAClC,UAAU,CAAC,EAAE,GAAG,CAAC;QACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KACzC,CAAC;IAEF,0BAA0B,CAAC,UAAU,EAAE,GAAG;IAU1C,WAAW,CAAC,IAAI,EAAE,gBAAgB,CAAC,IAAI,CAAC;IAexC,gBAAgB,CAAC,iBAAiB,KAAA;IAMlC,aAAa,IAAI;QAAC,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,CAAA;KAAC;IAI1C,iBAAiB;IAiBjB,aAAa,CAAC,OAAO,KAAA;IAIrB;;;;;;;QAOI;IACJ,kBAAkB,CAChB,UAAU,KAAA,EACV,MAAM,GAAE;QAAC,UAAU,CAAC,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,GAAG,CAAA;KAAM,GACnD,MAAM,GAAG,OAAO;IAyCnB;;;;;QAKI;IACJ,kBAAkB,CAAC,IAAI,CAAC,EAAE,MAAM;IAYhC,oBAAoB;CAMrB"}
@@ -1,158 +0,0 @@
1
- import { Accessor, AccessorFunction, Color, Position, Material, DefaultProps } from '@deck.gl/core';
2
- import CPUAggregator from "../utils/cpu-aggregator.js";
3
- import AggregationLayer, { AggregationLayerProps } from "../aggregation-layer.js";
4
- import { Layer, UpdateParameters, GetPickingInfoParams, PickingInfo } from '@deck.gl/core';
5
- import { AggregateAccessor } from "../types.js";
6
- /** All properties supported by CPUGridLayer. */
7
- export type CPUGridLayerProps<DataT = unknown> = _CPUGridLayerProps<DataT> & AggregationLayerProps<DataT>;
8
- /** Properties added by CPUGridLayer. */
9
- type _CPUGridLayerProps<DataT> = {
10
- /**
11
- * Size of each cell in meters.
12
- * @default 1000
13
- */
14
- cellSize?: number;
15
- /**
16
- * Color scale domain, default is set to the extent of aggregated weights in each cell.
17
- * @default [min(colorWeight), max(colorWeight)]
18
- */
19
- colorDomain?: [number, number] | null;
20
- /**
21
- * Default: [colorbrewer](http://colorbrewer2.org/#type=sequential&scheme=YlOrRd&n=6) `6-class YlOrRd`
22
- */
23
- colorRange?: Color[];
24
- /**
25
- * Cell size multiplier, clamped between 0 - 1.
26
- * @default 1
27
- */
28
- coverage?: number;
29
- /**
30
- * Elevation scale input domain, default is set to between 0 and the max of aggregated weights in each cell.
31
- * @default [0, max(elevationWeight)]
32
- */
33
- elevationDomain?: [number, number] | null;
34
- /**
35
- * Elevation scale output range.
36
- * @default [0, 1000]
37
- */
38
- elevationRange?: [number, number];
39
- /**
40
- * Cell elevation multiplier.
41
- * @default 1
42
- */
43
- elevationScale?: number;
44
- /**
45
- * Whether to enable cell elevation. If set to false, all cell will be flat.
46
- * @default true
47
- */
48
- extruded?: boolean;
49
- /**
50
- * Filter cells and re-calculate color by `upperPercentile`.
51
- * Cells with value arger than the upperPercentile will be hidden.
52
- * @default 100
53
- */
54
- upperPercentile?: number;
55
- /**
56
- * Filter cells and re-calculate color by `lowerPercentile`.
57
- * Cells with value smaller than the lowerPercentile will be hidden.
58
- * @default 0
59
- */
60
- lowerPercentile?: number;
61
- /**
62
- * Filter cells and re-calculate elevation by `elevationUpperPercentile`.
63
- * Cells with elevation value larger than the `elevationUpperPercentile` will be hidden.
64
- * @default 100
65
- */
66
- elevationUpperPercentile?: number;
67
- /**
68
- * Filter cells and re-calculate elevation by `elevationLowerPercentile`.
69
- * Cells with elevation value larger than the `elevationLowerPercentile` will be hidden.
70
- * @default 0
71
- */
72
- elevationLowerPercentile?: number;
73
- /**
74
- * Scaling function used to determine the color of the grid cell, default value is 'quantize'.
75
- * Supported Values are 'quantize', 'linear', 'quantile' and 'ordinal'.
76
- * @default 'quantize'
77
- */
78
- colorScaleType?: 'quantize' | 'linear' | 'quantile' | 'ordinal';
79
- /**
80
- * Scaling function used to determine the elevation of the grid cell, only supports 'linear'.
81
- */
82
- elevationScaleType?: 'linear';
83
- gridAggregator?: (props: any, params: any) => any;
84
- /**
85
- * Material settings for lighting effect. Applies if `extruded: true`.
86
- *
87
- * @default true
88
- * @see https://deck.gl/docs/developer-guide/using-lighting
89
- */
90
- material?: Material;
91
- /**
92
- * Defines the operation used to aggregate all data object weights to calculate a cell's color value.
93
- * @default 'SUM'
94
- */
95
- colorAggregation?: 'SUM' | 'MEAN' | 'MIN' | 'MAX';
96
- /**
97
- * Defines the operation used to aggregate all data object weights to calculate a cell's elevation value.
98
- * @default 'SUM'
99
- */
100
- elevationAggregation?: 'SUM' | 'MEAN' | 'MIN' | 'MAX';
101
- /**
102
- * Method called to retrieve the position of each object.
103
- * @default object => object.position
104
- */
105
- getPosition?: AccessorFunction<DataT, Position>;
106
- /**
107
- * The weight of a data object used to calculate the color value for a cell.
108
- * @default 1
109
- */
110
- getColorWeight?: Accessor<DataT, number>;
111
- /**
112
- * After data objects are aggregated into cells, this accessor is called on each cell to get the value that its color is based on.
113
- * @default null
114
- */
115
- getColorValue?: AggregateAccessor<DataT> | null;
116
- /**
117
- * The weight of a data object used to calculate the elevation value for a cell.
118
- * @default 1
119
- */
120
- getElevationWeight?: Accessor<DataT, number>;
121
- /**
122
- * After data objects are aggregated into cells, this accessor is called on each cell to get the value that its elevation is based on.
123
- * @default null
124
- */
125
- getElevationValue?: AggregateAccessor<DataT> | null;
126
- /**
127
- * This callback will be called when bin color domain has been calculated.
128
- * @default () => {}
129
- */
130
- onSetColorDomain?: (minMax: [number, number]) => void;
131
- /**
132
- * This callback will be called when bin elevation domain has been calculated.
133
- * @default () => {}
134
- */
135
- onSetElevationDomain?: (minMax: [number, number]) => void;
136
- /**
137
- * (Experimental) Filter data objects
138
- */
139
- _filterData: null | ((d: DataT) => boolean);
140
- };
141
- /** Aggregate data into a grid-based heatmap. Aggregation is performed on CPU. */
142
- export default class CPUGridLayer<DataT = any, ExtraPropsT extends {} = {}> extends AggregationLayer<DataT, ExtraPropsT & Required<_CPUGridLayerProps<DataT>>> {
143
- static layerName: string;
144
- static defaultProps: DefaultProps<CPUGridLayerProps<unknown>>;
145
- state: AggregationLayer<DataT>['state'] & {
146
- cpuAggregator: CPUAggregator;
147
- aggregatorState: CPUAggregator['state'];
148
- };
149
- initializeState(): void;
150
- updateState(opts: UpdateParameters<this>): void;
151
- getPickingInfo({ info }: GetPickingInfoParams): PickingInfo;
152
- _onGetSublayerColor(cell: any): any;
153
- _onGetSublayerElevation(cell: any): any;
154
- _getSublayerUpdateTriggers(): {};
155
- renderLayers(): Layer;
156
- }
157
- export {};
158
- //# sourceMappingURL=cpu-grid-layer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cpu-grid-layer.d.ts","sourceRoot":"","sources":["../../src/cpu-grid-layer/cpu-grid-layer.ts"],"names":[],"mappings":"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"}