@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,57 +1,46 @@
1
- // Copyright (c) 2015 - 2018 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 {LineLayer, SolidPolygonLayer} from '@deck.gl/layers';
22
- import {generateContours} from './contour-utils';
1
+ // deck.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
23
5
  import {
24
6
  Accessor,
25
- AccessorFunction,
26
- Color,
27
- log,
7
+ COORDINATE_SYSTEM,
8
+ GetPickingInfoParams,
9
+ project32,
10
+ LayersList,
11
+ PickingInfo,
28
12
  Position,
13
+ Viewport,
14
+ _deepEqual,
29
15
  UpdateParameters,
30
- DefaultProps,
31
- LayersList
16
+ DefaultProps
32
17
  } from '@deck.gl/core';
33
-
34
- import GPUGridAggregator from '../utils/gpu-grid-aggregation/gpu-grid-aggregator';
35
- import {AGGREGATION_OPERATION, getValueFunc} from '../utils/aggregation-operation-utils';
36
- import {getBoundingBox, getGridParams} from '../utils/grid-aggregation-utils';
37
- import GridAggregationLayer, {GridAggregationLayerProps} from '../grid-aggregation-layer';
18
+ import {PathLayer, SolidPolygonLayer} from '@deck.gl/layers';
19
+ import {WebGLAggregator, CPUAggregator, AggregationOperation} from '../common/aggregator/index';
20
+ import AggregationLayer from '../common/aggregation-layer';
21
+ import {AggregationLayerProps} from '../common/aggregation-layer';
22
+ import {generateContours, Contour, ContourLine, ContourPolygon} from './contour-utils';
23
+ import {getAggregatorValueReader} from './value-reader';
24
+ import {getBinIdRange} from '../common/utils/bounds-utils';
25
+ import {Matrix4} from '@math.gl/core';
26
+ import {BinOptions, binOptionsUniforms} from './bin-options-uniforms';
38
27
 
39
28
  const DEFAULT_COLOR = [255, 255, 255, 255];
40
29
  const DEFAULT_STROKE_WIDTH = 1;
41
- const DEFAULT_THRESHOLD = 1;
42
30
 
43
31
  const defaultProps: DefaultProps<ContourLayerProps> = {
44
32
  // grid aggregation
45
- cellSize: {type: 'number', min: 1, max: 1000, value: 1000},
33
+ cellSize: {type: 'number', min: 1, value: 1000},
34
+ gridOrigin: {type: 'array', compare: true, value: [0, 0]},
46
35
  getPosition: {type: 'accessor', value: (x: any) => x.position},
47
36
  getWeight: {type: 'accessor', value: 1},
48
- gpuAggregation: false, // TODO(v9): Re-enable GPU aggregation.
37
+ gpuAggregation: true,
49
38
  aggregation: 'SUM',
50
39
 
51
40
  // contour lines
52
41
  contours: {
53
42
  type: 'object',
54
- value: [{threshold: DEFAULT_THRESHOLD}],
43
+ value: [{threshold: 1}],
55
44
  optional: true,
56
45
  compare: 3
57
46
  },
@@ -59,33 +48,27 @@ const defaultProps: DefaultProps<ContourLayerProps> = {
59
48
  zOffset: 0.005
60
49
  };
61
50
 
62
- const POSITION_ATTRIBUTE_NAME = 'positions';
63
-
64
- const DIMENSIONS = {
65
- data: {
66
- props: ['cellSize']
67
- },
68
- weights: {
69
- props: ['aggregation'],
70
- accessors: ['getWeight']
71
- }
72
- };
73
-
74
- /** All properties supported by ContourLayer. */
51
+ /** All properties supported by GridLayer. */
75
52
  export type ContourLayerProps<DataT = unknown> = _ContourLayerProps<DataT> &
76
- GridAggregationLayerProps<DataT>;
53
+ AggregationLayerProps<DataT>;
77
54
 
78
- /** Properties added by ContourLayer. */
79
- export type _ContourLayerProps<DataT> = {
55
+ /** Properties added by GridLayer. */
56
+ type _ContourLayerProps<DataT> = {
80
57
  /**
81
58
  * Size of each cell in meters.
82
59
  * @default 1000
83
60
  */
84
61
  cellSize?: number;
85
62
 
63
+ /**
64
+ * The grid origin
65
+ * @default [0, 0]
66
+ */
67
+ gridOrigin?: [number, number];
68
+
86
69
  /**
87
70
  * When set to true, aggregation is performed on GPU, provided other conditions are met.
88
- * @default true
71
+ * @default false
89
72
  */
90
73
  gpuAggregation?: boolean;
91
74
 
@@ -93,35 +76,13 @@ export type _ContourLayerProps<DataT> = {
93
76
  * Defines the type of aggregation operation, valid values are 'SUM', 'MEAN', 'MIN' and 'MAX'.
94
77
  * @default 'SUM'
95
78
  */
96
- aggregation?: 'SUM' | 'MEAN' | 'MIN' | 'MAX';
79
+ aggregation?: AggregationOperation;
97
80
 
98
81
  /**
99
82
  * Definition of contours to be drawn.
100
83
  * @default [{threshold: 1}]
101
84
  */
102
- contours: {
103
- /**
104
- * Isolines: `threshold` value must be a single `Number`, Isolines are generated based on this threshold value.
105
- *
106
- * Isobands: `threshold` value must be an Array of two `Number`s. Isobands are generated using `[threshold[0], threshold[1])` as threshold range, i.e area that has values `>= threshold[0]` and `< threshold[1]` are rendered with corresponding color. NOTE: `threshold[0]` is inclusive and `threshold[1]` is not inclusive.
107
- */
108
- threshold: number | number[];
109
-
110
- /**
111
- * RGBA color array to be used to render the contour.
112
- * @default [255, 255, 255, 255]
113
- */
114
- color?: Color;
115
-
116
- /**
117
- * Applicable for `Isoline`s only, width of the Isoline in pixels.
118
- * @default 1
119
- */
120
- strokeWidth?: number;
121
-
122
- /** Defines z order of the contour. */
123
- zIndex?: number;
124
- }[];
85
+ contours?: Contour[];
125
86
 
126
87
  /**
127
88
  * A very small z offset that is added for each vertex of a contour (Isoline or Isoband).
@@ -133,7 +94,7 @@ export type _ContourLayerProps<DataT> = {
133
94
  * Method called to retrieve the position of each object.
134
95
  * @default object => object.position
135
96
  */
136
- getPosition?: AccessorFunction<DataT, Position>;
97
+ getPosition?: Accessor<DataT, Position>;
137
98
 
138
99
  /**
139
100
  * The weight of each object.
@@ -142,243 +103,317 @@ export type _ContourLayerProps<DataT> = {
142
103
  getWeight?: Accessor<DataT, number>;
143
104
  };
144
105
 
145
- /** Aggregate data into iso-lines or iso-bands for a given threshold and cell size. */
146
- export default class ContourLayer<
147
- DataT = any,
148
- ExtraPropsT extends {} = {}
149
- > extends GridAggregationLayer<DataT, ExtraPropsT & Required<_ContourLayerProps<DataT>>> {
106
+ export type ContourLayerPickingInfo = PickingInfo<{
107
+ contour: Contour;
108
+ }>;
109
+
110
+ /** Aggregate data into a grid-based heatmap. The color and height of a cell are determined based on the objects it contains. */
111
+ export default class GridLayer<DataT = any, ExtraPropsT extends {} = {}> extends AggregationLayer<
112
+ DataT,
113
+ ExtraPropsT & Required<_ContourLayerProps<DataT>>
114
+ > {
150
115
  static layerName = 'ContourLayer';
151
116
  static defaultProps = defaultProps;
152
117
 
153
- state!: GridAggregationLayer<DataT>['state'] & {
154
- contourData: {
155
- contourSegments: {
156
- start: number[];
157
- end: number[];
158
- contour: any;
159
- }[];
160
- contourPolygons: {
161
- vertices: number[][];
162
- contour: any;
163
- }[];
118
+ state!: AggregationLayer<DataT>['state'] &
119
+ BinOptions & {
120
+ // Aggregator result
121
+ aggregatedValueReader?: (x: number, y: number) => number;
122
+ contourData?: {
123
+ lines: ContourLine[];
124
+ polygons: ContourPolygon[];
125
+ };
126
+
127
+ binIdRange: [number, number][];
128
+ aggregatorViewport: Viewport;
164
129
  };
165
- thresholdData: any;
166
- };
167
130
 
168
- initializeState(): void {
169
- super.initializeAggregationLayer({
170
- dimensions: DIMENSIONS
171
- });
172
- this.setState({
173
- contourData: {},
174
- projectPoints: false,
175
- weights: {
176
- count: {
177
- size: 1,
178
- operation: AGGREGATION_OPERATION.SUM
179
- }
180
- }
131
+ getAggregatorType(): string {
132
+ return this.props.gpuAggregation && WebGLAggregator.isSupported(this.context.device)
133
+ ? 'gpu'
134
+ : 'cpu';
135
+ }
136
+
137
+ createAggregator(type: string): WebGLAggregator | CPUAggregator {
138
+ if (type === 'cpu') {
139
+ return new CPUAggregator({
140
+ dimensions: 2,
141
+ getBin: {
142
+ sources: ['positions'],
143
+ getValue: ({positions}: {positions: number[]}, index: number, opts: BinOptions) => {
144
+ const viewport = this.state.aggregatorViewport;
145
+ // project to common space
146
+ const p = viewport.projectPosition(positions);
147
+ const {cellSizeCommon, cellOriginCommon} = opts;
148
+ return [
149
+ Math.floor((p[0] - cellOriginCommon[0]) / cellSizeCommon[0]),
150
+ Math.floor((p[1] - cellOriginCommon[1]) / cellSizeCommon[1])
151
+ ];
152
+ }
153
+ },
154
+ getValue: [{sources: ['counts'], getValue: ({counts}) => counts}],
155
+ onUpdate: this._onAggregationUpdate.bind(this)
156
+ });
157
+ }
158
+ return new WebGLAggregator(this.context.device, {
159
+ dimensions: 2,
160
+ channelCount: 1,
161
+ bufferLayout: this.getAttributeManager()!.getBufferLayouts({isInstanced: false}),
162
+ ...super.getShaders({
163
+ modules: [project32, binOptionsUniforms],
164
+ vs: /* glsl */ `
165
+ in vec3 positions;
166
+ in vec3 positions64Low;
167
+ in float counts;
168
+
169
+ void getBin(out ivec2 binId) {
170
+ vec3 positionCommon = project_position(positions, positions64Low);
171
+ vec2 gridCoords = floor(positionCommon.xy / binOptions.cellSizeCommon);
172
+ binId = ivec2(gridCoords);
173
+ }
174
+ void getValue(out float value) {
175
+ value = counts;
176
+ }
177
+ `
178
+ }),
179
+ onUpdate: this._onAggregationUpdate.bind(this)
181
180
  });
181
+ }
182
+
183
+ initializeState() {
184
+ super.initializeState();
185
+
182
186
  const attributeManager = this.getAttributeManager()!;
183
187
  attributeManager.add({
184
- [POSITION_ATTRIBUTE_NAME]: {
188
+ positions: {
185
189
  size: 3,
186
190
  accessor: 'getPosition',
187
191
  type: 'float64',
188
192
  fp64: this.use64bitPositions()
189
193
  },
190
- // this attribute is used in gpu aggregation path only
191
- count: {size: 3, accessor: 'getWeight'}
194
+ counts: {size: 1, accessor: 'getWeight'}
195
+ });
196
+ }
197
+
198
+ updateState(params: UpdateParameters<this>) {
199
+ const aggregatorChanged = super.updateState(params);
200
+
201
+ const {props, oldProps, changeFlags} = params;
202
+ const {aggregator} = this.state;
203
+ if (
204
+ aggregatorChanged ||
205
+ changeFlags.dataChanged ||
206
+ props.cellSize !== oldProps.cellSize ||
207
+ !_deepEqual(props.gridOrigin, oldProps.gridOrigin, 1) ||
208
+ props.aggregation !== oldProps.aggregation
209
+ ) {
210
+ this._updateBinOptions();
211
+ const {cellSizeCommon, cellOriginCommon, binIdRange} = this.state;
212
+
213
+ aggregator.setProps({
214
+ // @ts-expect-error only used by GPUAggregator
215
+ binIdRange,
216
+ pointCount: this.getNumInstances(),
217
+ operations: [props.aggregation],
218
+ binOptions: {
219
+ cellSizeCommon,
220
+ cellOriginCommon
221
+ }
222
+ });
223
+ }
224
+
225
+ if (!_deepEqual(oldProps.contours, props.contours, 2)) {
226
+ // Recalculate contours
227
+ this.setState({contourData: null});
228
+ }
229
+
230
+ return aggregatorChanged;
231
+ }
232
+
233
+ private _updateBinOptions() {
234
+ const bounds = this.getBounds();
235
+ const cellSizeCommon: [number, number] = [1, 1];
236
+ let cellOriginCommon: [number, number] = [0, 0];
237
+ let binIdRange: [number, number][] = [
238
+ [0, 1],
239
+ [0, 1]
240
+ ];
241
+ let viewport = this.context.viewport;
242
+
243
+ if (bounds && Number.isFinite(bounds[0][0])) {
244
+ let centroid = [(bounds[0][0] + bounds[1][0]) / 2, (bounds[0][1] + bounds[1][1]) / 2];
245
+ const {cellSize, gridOrigin} = this.props;
246
+ const {unitsPerMeter} = viewport.getDistanceScales(centroid);
247
+ cellSizeCommon[0] = unitsPerMeter[0] * cellSize;
248
+ cellSizeCommon[1] = unitsPerMeter[1] * cellSize;
249
+
250
+ // Offset common space to center at the origin of the grid cell where the data center is in
251
+ // This improves precision without affecting the cell positions
252
+ const centroidCommon = viewport.projectFlat(centroid);
253
+ cellOriginCommon = [
254
+ Math.floor((centroidCommon[0] - gridOrigin[0]) / cellSizeCommon[0]) * cellSizeCommon[0] +
255
+ gridOrigin[0],
256
+ Math.floor((centroidCommon[1] - gridOrigin[1]) / cellSizeCommon[1]) * cellSizeCommon[1] +
257
+ gridOrigin[1]
258
+ ];
259
+ centroid = viewport.unprojectFlat(cellOriginCommon);
260
+
261
+ const ViewportType = viewport.constructor as any;
262
+ // We construct a viewport for the GPU aggregator's project module
263
+ // This viewport is determined by data
264
+ // removes arbitrary precision variance that depends on initial view state
265
+ viewport = viewport.isGeospatial
266
+ ? new ViewportType({longitude: centroid[0], latitude: centroid[1], zoom: 12})
267
+ : new Viewport({position: [centroid[0], centroid[1], 0], zoom: 12});
268
+
269
+ // Round to the nearest 32-bit float to match CPU and GPU results
270
+ cellOriginCommon = [Math.fround(viewport.center[0]), Math.fround(viewport.center[1])];
271
+
272
+ binIdRange = getBinIdRange({
273
+ dataBounds: bounds,
274
+ getBinId: (p: number[]) => {
275
+ const positionCommon = viewport.projectFlat(p);
276
+ return [
277
+ Math.floor((positionCommon[0] - cellOriginCommon[0]) / cellSizeCommon[0]),
278
+ Math.floor((positionCommon[1] - cellOriginCommon[1]) / cellSizeCommon[1])
279
+ ];
280
+ }
281
+ });
282
+ }
283
+
284
+ this.setState({cellSizeCommon, cellOriginCommon, binIdRange, aggregatorViewport: viewport});
285
+ }
286
+
287
+ override draw(opts) {
288
+ // Replaces render time viewport with our own
289
+ if (opts.shaderModuleProps.project) {
290
+ opts.shaderModuleProps.project.viewport = this.state.aggregatorViewport;
291
+ }
292
+ super.draw(opts);
293
+ }
294
+
295
+ private _onAggregationUpdate() {
296
+ const {aggregator, binIdRange} = this.state;
297
+ this.setState({
298
+ aggregatedValueReader: getAggregatorValueReader({aggregator, binIdRange, channel: 0}),
299
+ contourData: null
192
300
  });
193
301
  }
194
302
 
195
- updateState(opts: UpdateParameters<this>): void {
196
- super.updateState(opts);
197
- let contoursChanged = false;
198
- const {oldProps, props} = opts;
199
- const {aggregationDirty} = this.state;
303
+ private _getContours(): {
304
+ lines: ContourLine[];
305
+ polygons: ContourPolygon[];
306
+ } | null {
307
+ const {aggregatedValueReader} = this.state;
308
+ if (!aggregatedValueReader) {
309
+ return null;
310
+ }
200
311
 
201
- if (oldProps.contours !== props.contours || oldProps.zOffset !== props.zOffset) {
202
- contoursChanged = true;
203
- this._updateThresholdData(opts.props);
312
+ if (!this.state.contourData) {
313
+ const {binIdRange} = this.state;
314
+ const {contours} = this.props;
315
+ const contourData = generateContours({
316
+ contours,
317
+ getValue: aggregatedValueReader,
318
+ xRange: binIdRange[0],
319
+ yRange: binIdRange[1]
320
+ });
321
+
322
+ this.state.contourData = contourData;
204
323
  }
324
+ return this.state.contourData;
325
+ }
205
326
 
206
- if (this.getNumInstances() > 0 && (aggregationDirty || contoursChanged)) {
207
- this._generateContours();
327
+ onAttributeChange(id: string) {
328
+ const {aggregator} = this.state;
329
+ switch (id) {
330
+ case 'positions':
331
+ aggregator.setNeedsUpdate();
332
+
333
+ this._updateBinOptions();
334
+ const {cellSizeCommon, cellOriginCommon, binIdRange} = this.state;
335
+ aggregator.setProps({
336
+ // @ts-expect-error only used by GPUAggregator
337
+ binIdRange,
338
+ binOptions: {
339
+ cellSizeCommon,
340
+ cellOriginCommon
341
+ }
342
+ });
343
+ break;
344
+
345
+ case 'counts':
346
+ aggregator.setNeedsUpdate(0);
347
+ break;
348
+
349
+ default:
350
+ // This should not happen
208
351
  }
209
352
  }
210
353
 
211
- renderLayers(): LayersList {
212
- const {contourSegments, contourPolygons} = this.state.contourData;
354
+ renderLayers(): LayersList | null {
355
+ const contourData = this._getContours();
356
+ if (!contourData) {
357
+ return null;
358
+ }
359
+ const {lines, polygons} = contourData;
360
+ const {zOffset} = this.props;
361
+ const {cellOriginCommon, cellSizeCommon} = this.state;
213
362
 
214
- const LinesSubLayerClass = this.getSubLayerClass('lines', LineLayer);
363
+ const LinesSubLayerClass = this.getSubLayerClass('lines', PathLayer);
215
364
  const BandsSubLayerClass = this.getSubLayerClass('bands', SolidPolygonLayer);
365
+ const modelMatrix = new Matrix4()
366
+ .translate([cellOriginCommon[0], cellOriginCommon[1], 0])
367
+ .scale([cellSizeCommon[0], cellSizeCommon[1], zOffset]);
216
368
 
217
369
  // Contour lines layer
218
370
  const lineLayer =
219
- contourSegments &&
220
- contourSegments.length > 0 &&
371
+ lines &&
372
+ lines.length > 0 &&
221
373
  new LinesSubLayerClass(
222
374
  this.getSubLayerProps({
223
375
  id: 'lines'
224
376
  }),
225
377
  {
226
- data: this.state.contourData.contourSegments,
227
- getSourcePosition: d => d.start,
228
- getTargetPosition: d => d.end,
229
- getColor: d => d.contour.color || DEFAULT_COLOR,
230
- getWidth: d => d.contour.strokeWidth || DEFAULT_STROKE_WIDTH
378
+ data: lines,
379
+ coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
380
+ modelMatrix,
381
+ getPath: d => d.vertices,
382
+ getColor: d => d.contour.color ?? DEFAULT_COLOR,
383
+ getWidth: d => d.contour.strokeWidth ?? DEFAULT_STROKE_WIDTH,
384
+ widthUnits: 'pixels'
231
385
  }
232
386
  );
233
387
 
234
388
  // Contour bands layer
235
389
  const bandsLayer =
236
- contourPolygons &&
237
- contourPolygons.length > 0 &&
390
+ polygons &&
391
+ polygons.length > 0 &&
238
392
  new BandsSubLayerClass(
239
393
  this.getSubLayerProps({
240
394
  id: 'bands'
241
395
  }),
242
396
  {
243
- data: this.state.contourData.contourPolygons,
397
+ data: polygons,
398
+ coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
399
+ modelMatrix,
244
400
  getPolygon: d => d.vertices,
245
- getFillColor: d => d.contour.color || DEFAULT_COLOR
401
+ getFillColor: d => d.contour.color ?? DEFAULT_COLOR
246
402
  }
247
403
  );
248
404
 
249
405
  return [lineLayer, bandsLayer];
250
406
  }
251
407
 
252
- // Aggregation Overrides
253
-
254
- /* eslint-disable max-statements, complexity */
255
- updateAggregationState(opts: UpdateParameters<this>) {
256
- const {props, oldProps} = opts;
257
- const {cellSize, coordinateSystem} = props;
258
- const {viewport} = this.context;
259
- const cellSizeChanged = oldProps.cellSize !== cellSize;
260
- let gpuAggregation = props.gpuAggregation;
261
- if (this.state.gpuAggregation !== props.gpuAggregation) {
262
- if (gpuAggregation && !GPUGridAggregator.isSupported(this.context.device)) {
263
- log.warn('GPU Grid Aggregation not supported, falling back to CPU')();
264
- gpuAggregation = false;
265
- }
266
- }
267
- const gpuAggregationChanged = gpuAggregation !== this.state.gpuAggregation;
268
- this.setState({
269
- gpuAggregation
270
- });
271
-
272
- const {dimensions} = this.state;
273
- const positionsChanged = this.isAttributeChanged(POSITION_ATTRIBUTE_NAME);
274
- const {data, weights} = dimensions;
275
-
276
- let {boundingBox} = this.state;
277
- if (positionsChanged) {
278
- boundingBox = getBoundingBox(this.getAttributes(), this.getNumInstances());
279
- this.setState({boundingBox});
280
- }
281
- if (positionsChanged || cellSizeChanged) {
282
- const {gridOffset, translation, width, height, numCol, numRow} = getGridParams(
283
- boundingBox,
284
- cellSize,
285
- viewport,
286
- coordinateSystem
287
- );
288
- this.allocateResources(numRow, numCol);
289
- this.setState({
290
- gridOffset,
291
- boundingBox,
292
- translation,
293
- posOffset: translation.slice(), // Used for CPU aggregation, to offset points
294
- gridOrigin: [-1 * translation[0], -1 * translation[1]],
295
- width,
296
- height,
297
- numCol,
298
- numRow
299
- });
300
- }
301
-
302
- const aggregationDataDirty =
303
- positionsChanged ||
304
- gpuAggregationChanged ||
305
- this.isAggregationDirty(opts, {
306
- dimension: data,
307
- compareAll: gpuAggregation // check for all (including extentions props) when using gpu aggregation
308
- });
309
- const aggregationWeightsDirty = this.isAggregationDirty(opts, {
310
- dimension: weights
311
- });
312
-
313
- if (aggregationWeightsDirty) {
314
- this._updateAccessors(opts);
315
- }
316
- if (aggregationDataDirty || aggregationWeightsDirty) {
317
- this._resetResults();
318
- }
319
- this.setState({
320
- aggregationDataDirty,
321
- aggregationWeightsDirty
322
- });
323
- }
324
- /* eslint-enable max-statements, complexity */
325
-
326
- // Private (Aggregation)
327
-
328
- private _updateAccessors(opts: UpdateParameters<this>) {
329
- const {getWeight, aggregation, data} = opts.props;
330
- const {count} = this.state.weights;
331
- if (count) {
332
- count.getWeight = getWeight;
333
- count.operation = AGGREGATION_OPERATION[aggregation];
334
- }
335
- this.setState({getValue: getValueFunc(aggregation, getWeight, {data})});
336
- }
337
-
338
- private _resetResults() {
339
- const {count} = this.state.weights;
340
- if (count) {
341
- count.aggregationData = null;
342
- }
343
- }
344
-
345
- // Private (Contours)
346
-
347
- private _generateContours() {
348
- const {numCol, numRow, gridOrigin, gridOffset, thresholdData} = this.state;
349
- const {count} = this.state.weights;
350
- let {aggregationData} = count;
351
- if (!aggregationData) {
352
- // @ts-ignore
353
- aggregationData = count.aggregationBuffer!.readSyncWebGL() as Float32Array;
354
- count.aggregationData = aggregationData;
355
- }
356
-
357
- const {cellWeights} = GPUGridAggregator.getCellData({countsData: aggregationData});
358
- const contourData = generateContours({
359
- thresholdData,
360
- cellWeights,
361
- gridSize: [numCol, numRow],
362
- gridOrigin,
363
- cellSize: [gridOffset.xOffset, gridOffset.yOffset]
364
- });
365
-
366
- // contourData contains both iso-lines and iso-bands if requested.
367
- this.setState({contourData});
368
- }
369
-
370
- private _updateThresholdData(props) {
371
- const {contours, zOffset} = props;
372
- const count = contours.length;
373
- const thresholdData = new Array(count);
374
- for (let i = 0; i < count; i++) {
375
- const contour = contours[i];
376
- thresholdData[i] = {
377
- contour,
378
- zIndex: contour.zIndex || i,
379
- zOffset
408
+ getPickingInfo(params: GetPickingInfoParams): ContourLayerPickingInfo {
409
+ const info: ContourLayerPickingInfo = params.info;
410
+ const {object} = info;
411
+ if (object) {
412
+ info.object = {
413
+ contour: (object as ContourLine | ContourPolygon).contour
380
414
  };
381
415
  }
382
- this.setState({thresholdData});
416
+
417
+ return info;
383
418
  }
384
419
  }