@deck.gl/aggregation-layers 9.0.0-beta.1 → 9.0.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 (336) hide show
  1. package/dist/aggregation-layer.js +153 -0
  2. package/dist/contour-layer/contour-layer.js +241 -0
  3. package/dist/contour-layer/contour-utils.js +64 -0
  4. package/dist/contour-layer/marching-squares-codes.js +337 -0
  5. package/dist/contour-layer/marching-squares.js +147 -0
  6. package/dist/cpu-grid-layer/cpu-grid-layer.js +130 -0
  7. package/dist/cpu-grid-layer/grid-aggregator.js +141 -0
  8. package/dist/dist.dev.js +1187 -10528
  9. package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +34 -0
  10. package/dist/{esm/gpu-grid-layer → gpu-grid-layer}/gpu-grid-cell-layer-vertex.glsl.js +20 -1
  11. package/dist/gpu-grid-layer/gpu-grid-cell-layer.js +145 -0
  12. package/dist/gpu-grid-layer/gpu-grid-layer.js +288 -0
  13. package/dist/grid-aggregation-layer.js +172 -0
  14. package/dist/grid-layer/grid-layer.js +63 -0
  15. package/{typed → dist}/heatmap-layer/heatmap-layer-utils.d.ts +0 -9
  16. package/dist/heatmap-layer/heatmap-layer-utils.d.ts.map +1 -0
  17. package/dist/heatmap-layer/heatmap-layer-utils.js +63 -0
  18. package/{typed → dist}/heatmap-layer/heatmap-layer.d.ts +4 -4
  19. package/dist/heatmap-layer/heatmap-layer.d.ts.map +1 -0
  20. package/dist/heatmap-layer/heatmap-layer.js +471 -0
  21. package/dist/{esm/heatmap-layer → heatmap-layer}/max-fs.glsl.js +0 -1
  22. package/dist/heatmap-layer/max-vs.glsl.d.ts +3 -0
  23. package/{typed → dist}/heatmap-layer/max-vs.glsl.d.ts.map +1 -1
  24. package/dist/heatmap-layer/max-vs.glsl.js +19 -0
  25. package/dist/heatmap-layer/triangle-layer-fragment.glsl.d.ts +3 -0
  26. package/dist/heatmap-layer/triangle-layer-fragment.glsl.js +61 -0
  27. package/dist/heatmap-layer/triangle-layer-vertex.glsl.js +52 -0
  28. package/{typed → dist}/heatmap-layer/triangle-layer.d.ts +10 -2
  29. package/dist/heatmap-layer/triangle-layer.d.ts.map +1 -0
  30. package/dist/heatmap-layer/triangle-layer.js +59 -0
  31. package/dist/{esm/heatmap-layer → heatmap-layer}/weights-fs.glsl.js +0 -1
  32. package/dist/heatmap-layer/weights-vs.glsl.d.ts +3 -0
  33. package/{typed → dist}/heatmap-layer/weights-vs.glsl.d.ts.map +1 -1
  34. package/dist/{esm/heatmap-layer → heatmap-layer}/weights-vs.glsl.js +4 -3
  35. package/dist/hexagon-layer/hexagon-aggregator.js +112 -0
  36. package/dist/hexagon-layer/hexagon-layer.js +174 -0
  37. package/dist/index.cjs +4494 -0
  38. package/dist/index.cjs.map +7 -0
  39. package/dist/index.js +32 -0
  40. package/dist/screen-grid-layer/screen-grid-cell-layer.js +166 -0
  41. package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.js +40 -0
  42. package/dist/{esm/screen-grid-layer → screen-grid-layer}/screen-grid-layer-vertex.glsl.js +19 -1
  43. package/dist/screen-grid-layer/screen-grid-layer.js +216 -0
  44. package/dist/types.js +1 -0
  45. package/dist/utils/aggregation-operation-utils.js +94 -0
  46. package/dist/utils/bin-sorter.js +167 -0
  47. package/dist/utils/color-utils.js +53 -0
  48. package/dist/utils/cpu-aggregator.js +421 -0
  49. package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +39 -0
  50. package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +53 -0
  51. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +34 -0
  52. package/dist/{esm/utils → utils}/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +19 -1
  53. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +41 -0
  54. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +1 -0
  55. package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts.map +1 -1
  56. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +566 -0
  57. package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +37 -0
  58. package/dist/utils/grid-aggregation-utils.js +114 -0
  59. package/dist/utils/prop-utils.js +28 -0
  60. package/dist/utils/resource-utils.js +38 -0
  61. package/dist/utils/scale-utils.js +184 -0
  62. package/dist.min.js +74 -178
  63. package/package.json +18 -11
  64. package/src/heatmap-layer/heatmap-layer-utils.ts +0 -23
  65. package/src/heatmap-layer/heatmap-layer.ts +87 -105
  66. package/src/heatmap-layer/max-vs.glsl.ts +11 -5
  67. package/src/heatmap-layer/triangle-layer-fragment.glsl.ts +2 -2
  68. package/src/heatmap-layer/triangle-layer.ts +17 -23
  69. package/src/heatmap-layer/weights-vs.glsl.ts +4 -2
  70. package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.ts +10 -13
  71. package/dist/es5/aggregation-layer.js +0 -215
  72. package/dist/es5/aggregation-layer.js.map +0 -1
  73. package/dist/es5/contour-layer/contour-layer.js +0 -353
  74. package/dist/es5/contour-layer/contour-layer.js.map +0 -1
  75. package/dist/es5/contour-layer/contour-utils.js +0 -110
  76. package/dist/es5/contour-layer/contour-utils.js.map +0 -1
  77. package/dist/es5/contour-layer/marching-squares-codes.js +0 -152
  78. package/dist/es5/contour-layer/marching-squares-codes.js.map +0 -1
  79. package/dist/es5/contour-layer/marching-squares.js +0 -168
  80. package/dist/es5/contour-layer/marching-squares.js.map +0 -1
  81. package/dist/es5/cpu-grid-layer/cpu-grid-layer.js +0 -235
  82. package/dist/es5/cpu-grid-layer/cpu-grid-layer.js.map +0 -1
  83. package/dist/es5/cpu-grid-layer/grid-aggregator.js +0 -180
  84. package/dist/es5/cpu-grid-layer/grid-aggregator.js.map +0 -1
  85. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +0 -9
  86. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js.map +0 -1
  87. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +0 -9
  88. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js.map +0 -1
  89. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer.js +0 -247
  90. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer.js.map +0 -1
  91. package/dist/es5/gpu-grid-layer/gpu-grid-layer.js +0 -424
  92. package/dist/es5/gpu-grid-layer/gpu-grid-layer.js.map +0 -1
  93. package/dist/es5/grid-aggregation-layer.js +0 -280
  94. package/dist/es5/grid-aggregation-layer.js.map +0 -1
  95. package/dist/es5/grid-layer/grid-layer.js +0 -125
  96. package/dist/es5/grid-layer/grid-layer.js.map +0 -1
  97. package/dist/es5/heatmap-layer/heatmap-layer-utils.js +0 -122
  98. package/dist/es5/heatmap-layer/heatmap-layer-utils.js.map +0 -1
  99. package/dist/es5/heatmap-layer/heatmap-layer.js +0 -672
  100. package/dist/es5/heatmap-layer/heatmap-layer.js.map +0 -1
  101. package/dist/es5/heatmap-layer/max-fs.glsl.js +0 -9
  102. package/dist/es5/heatmap-layer/max-fs.glsl.js.map +0 -1
  103. package/dist/es5/heatmap-layer/max-vs.glsl.js +0 -9
  104. package/dist/es5/heatmap-layer/max-vs.glsl.js.map +0 -1
  105. package/dist/es5/heatmap-layer/triangle-layer-fragment.glsl.js +0 -9
  106. package/dist/es5/heatmap-layer/triangle-layer-fragment.glsl.js.map +0 -1
  107. package/dist/es5/heatmap-layer/triangle-layer-vertex.glsl.js +0 -9
  108. package/dist/es5/heatmap-layer/triangle-layer-vertex.glsl.js.map +0 -1
  109. package/dist/es5/heatmap-layer/triangle-layer.js +0 -122
  110. package/dist/es5/heatmap-layer/triangle-layer.js.map +0 -1
  111. package/dist/es5/heatmap-layer/weights-fs.glsl.js +0 -9
  112. package/dist/es5/heatmap-layer/weights-fs.glsl.js.map +0 -1
  113. package/dist/es5/heatmap-layer/weights-vs.glsl.js +0 -9
  114. package/dist/es5/heatmap-layer/weights-vs.glsl.js.map +0 -1
  115. package/dist/es5/hexagon-layer/hexagon-aggregator.js +0 -118
  116. package/dist/es5/hexagon-layer/hexagon-aggregator.js.map +0 -1
  117. package/dist/es5/hexagon-layer/hexagon-layer.js +0 -289
  118. package/dist/es5/hexagon-layer/hexagon-layer.js.map +0 -1
  119. package/dist/es5/index.js +0 -104
  120. package/dist/es5/index.js.map +0 -1
  121. package/dist/es5/screen-grid-layer/screen-grid-cell-layer.js +0 -244
  122. package/dist/es5/screen-grid-layer/screen-grid-cell-layer.js.map +0 -1
  123. package/dist/es5/screen-grid-layer/screen-grid-layer-fragment.glsl.js +0 -9
  124. package/dist/es5/screen-grid-layer/screen-grid-layer-fragment.glsl.js.map +0 -1
  125. package/dist/es5/screen-grid-layer/screen-grid-layer-vertex.glsl.js +0 -9
  126. package/dist/es5/screen-grid-layer/screen-grid-layer-vertex.glsl.js.map +0 -1
  127. package/dist/es5/screen-grid-layer/screen-grid-layer.js +0 -317
  128. package/dist/es5/screen-grid-layer/screen-grid-layer.js.map +0 -1
  129. package/dist/es5/types.js +0 -2
  130. package/dist/es5/types.js.map +0 -1
  131. package/dist/es5/utils/aggregation-operation-utils.js +0 -123
  132. package/dist/es5/utils/aggregation-operation-utils.js.map +0 -1
  133. package/dist/es5/utils/bin-sorter.js +0 -248
  134. package/dist/es5/utils/bin-sorter.js.map +0 -1
  135. package/dist/es5/utils/color-utils.js +0 -39
  136. package/dist/es5/utils/color-utils.js.map +0 -1
  137. package/dist/es5/utils/cpu-aggregator.js +0 -496
  138. package/dist/es5/utils/cpu-aggregator.js.map +0 -1
  139. package/dist/es5/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +0 -9
  140. package/dist/es5/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js.map +0 -1
  141. package/dist/es5/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +0 -9
  142. package/dist/es5/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js.map +0 -1
  143. package/dist/es5/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +0 -9
  144. package/dist/es5/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js.map +0 -1
  145. package/dist/es5/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +0 -9
  146. package/dist/es5/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js.map +0 -1
  147. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +0 -63
  148. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js.map +0 -1
  149. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +0 -2
  150. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js.map +0 -1
  151. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +0 -732
  152. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.js.map +0 -1
  153. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +0 -155
  154. package/dist/es5/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +0 -9
  155. package/dist/es5/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js.map +0 -1
  156. package/dist/es5/utils/grid-aggregation-utils.js +0 -118
  157. package/dist/es5/utils/grid-aggregation-utils.js.map +0 -1
  158. package/dist/es5/utils/prop-utils.js +0 -19
  159. package/dist/es5/utils/prop-utils.js.map +0 -1
  160. package/dist/es5/utils/resource-utils.js +0 -59
  161. package/dist/es5/utils/resource-utils.js.map +0 -1
  162. package/dist/es5/utils/scale-utils.js +0 -254
  163. package/dist/es5/utils/scale-utils.js.map +0 -1
  164. package/dist/esm/aggregation-layer.js +0 -156
  165. package/dist/esm/aggregation-layer.js.map +0 -1
  166. package/dist/esm/contour-layer/contour-layer.js +0 -316
  167. package/dist/esm/contour-layer/contour-layer.js.map +0 -1
  168. package/dist/esm/contour-layer/contour-utils.js +0 -81
  169. package/dist/esm/contour-layer/contour-utils.js.map +0 -1
  170. package/dist/esm/contour-layer/marching-squares-codes.js +0 -219
  171. package/dist/esm/contour-layer/marching-squares-codes.js.map +0 -1
  172. package/dist/esm/contour-layer/marching-squares.js +0 -151
  173. package/dist/esm/contour-layer/marching-squares.js.map +0 -1
  174. package/dist/esm/cpu-grid-layer/cpu-grid-layer.js +0 -186
  175. package/dist/esm/cpu-grid-layer/cpu-grid-layer.js.map +0 -1
  176. package/dist/esm/cpu-grid-layer/grid-aggregator.js +0 -142
  177. package/dist/esm/cpu-grid-layer/grid-aggregator.js.map +0 -1
  178. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +0 -16
  179. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js.map +0 -1
  180. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js.map +0 -1
  181. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer.js +0 -196
  182. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer.js.map +0 -1
  183. package/dist/esm/gpu-grid-layer/gpu-grid-layer.js +0 -399
  184. package/dist/esm/gpu-grid-layer/gpu-grid-layer.js.map +0 -1
  185. package/dist/esm/grid-aggregation-layer.js +0 -240
  186. package/dist/esm/grid-aggregation-layer.js.map +0 -1
  187. package/dist/esm/grid-layer/grid-layer.js +0 -80
  188. package/dist/esm/grid-layer/grid-layer.js.map +0 -1
  189. package/dist/esm/heatmap-layer/heatmap-layer-utils.js +0 -68
  190. package/dist/esm/heatmap-layer/heatmap-layer-utils.js.map +0 -1
  191. package/dist/esm/heatmap-layer/heatmap-layer.js +0 -626
  192. package/dist/esm/heatmap-layer/heatmap-layer.js.map +0 -1
  193. package/dist/esm/heatmap-layer/max-fs.glsl.js.map +0 -1
  194. package/dist/esm/heatmap-layer/max-vs.glsl.js +0 -14
  195. package/dist/esm/heatmap-layer/max-vs.glsl.js.map +0 -1
  196. package/dist/esm/heatmap-layer/triangle-layer-fragment.glsl.js +0 -43
  197. package/dist/esm/heatmap-layer/triangle-layer-fragment.glsl.js.map +0 -1
  198. package/dist/esm/heatmap-layer/triangle-layer-vertex.glsl.js +0 -33
  199. package/dist/esm/heatmap-layer/triangle-layer-vertex.glsl.js.map +0 -1
  200. package/dist/esm/heatmap-layer/triangle-layer.js +0 -80
  201. package/dist/esm/heatmap-layer/triangle-layer.js.map +0 -1
  202. package/dist/esm/heatmap-layer/weights-fs.glsl.js.map +0 -1
  203. package/dist/esm/heatmap-layer/weights-vs.glsl.js.map +0 -1
  204. package/dist/esm/hexagon-layer/hexagon-aggregator.js +0 -87
  205. package/dist/esm/hexagon-layer/hexagon-aggregator.js.map +0 -1
  206. package/dist/esm/hexagon-layer/hexagon-layer.js +0 -232
  207. package/dist/esm/hexagon-layer/hexagon-layer.js.map +0 -1
  208. package/dist/esm/index.js +0 -13
  209. package/dist/esm/index.js.map +0 -1
  210. package/dist/esm/screen-grid-layer/screen-grid-cell-layer.js +0 -203
  211. package/dist/esm/screen-grid-layer/screen-grid-cell-layer.js.map +0 -1
  212. package/dist/esm/screen-grid-layer/screen-grid-layer-fragment.glsl.js +0 -21
  213. package/dist/esm/screen-grid-layer/screen-grid-layer-fragment.glsl.js.map +0 -1
  214. package/dist/esm/screen-grid-layer/screen-grid-layer-vertex.glsl.js.map +0 -1
  215. package/dist/esm/screen-grid-layer/screen-grid-layer.js +0 -285
  216. package/dist/esm/screen-grid-layer/screen-grid-layer.js.map +0 -1
  217. package/dist/esm/types.js +0 -2
  218. package/dist/esm/types.js.map +0 -1
  219. package/dist/esm/utils/aggregation-operation-utils.js +0 -91
  220. package/dist/esm/utils/aggregation-operation-utils.js.map +0 -1
  221. package/dist/esm/utils/bin-sorter.js +0 -165
  222. package/dist/esm/utils/bin-sorter.js.map +0 -1
  223. package/dist/esm/utils/color-utils.js +0 -28
  224. package/dist/esm/utils/color-utils.js.map +0 -1
  225. package/dist/esm/utils/cpu-aggregator.js +0 -487
  226. package/dist/esm/utils/cpu-aggregator.js.map +0 -1
  227. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +0 -21
  228. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js.map +0 -1
  229. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +0 -35
  230. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js.map +0 -1
  231. package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +0 -16
  232. package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js.map +0 -1
  233. package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js.map +0 -1
  234. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +0 -42
  235. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js.map +0 -1
  236. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +0 -2
  237. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js.map +0 -1
  238. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +0 -720
  239. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.js.map +0 -1
  240. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +0 -155
  241. package/dist/esm/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +0 -19
  242. package/dist/esm/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js.map +0 -1
  243. package/dist/esm/utils/grid-aggregation-utils.js +0 -109
  244. package/dist/esm/utils/grid-aggregation-utils.js.map +0 -1
  245. package/dist/esm/utils/prop-utils.js +0 -12
  246. package/dist/esm/utils/prop-utils.js.map +0 -1
  247. package/dist/esm/utils/resource-utils.js +0 -44
  248. package/dist/esm/utils/resource-utils.js.map +0 -1
  249. package/dist/esm/utils/scale-utils.js +0 -192
  250. package/dist/esm/utils/scale-utils.js.map +0 -1
  251. package/typed/heatmap-layer/heatmap-layer-utils.d.ts.map +0 -1
  252. package/typed/heatmap-layer/heatmap-layer.d.ts.map +0 -1
  253. package/typed/heatmap-layer/max-vs.glsl.d.ts +0 -3
  254. package/typed/heatmap-layer/triangle-layer-fragment.glsl.d.ts +0 -3
  255. package/typed/heatmap-layer/triangle-layer.d.ts.map +0 -1
  256. package/typed/heatmap-layer/weights-vs.glsl.d.ts +0 -3
  257. /package/{typed → dist}/aggregation-layer.d.ts +0 -0
  258. /package/{typed → dist}/aggregation-layer.d.ts.map +0 -0
  259. /package/{typed → dist}/contour-layer/contour-layer.d.ts +0 -0
  260. /package/{typed → dist}/contour-layer/contour-layer.d.ts.map +0 -0
  261. /package/{typed → dist}/contour-layer/contour-utils.d.ts +0 -0
  262. /package/{typed → dist}/contour-layer/contour-utils.d.ts.map +0 -0
  263. /package/{typed → dist}/contour-layer/marching-squares-codes.d.ts +0 -0
  264. /package/{typed → dist}/contour-layer/marching-squares-codes.d.ts.map +0 -0
  265. /package/{typed → dist}/contour-layer/marching-squares.d.ts +0 -0
  266. /package/{typed → dist}/contour-layer/marching-squares.d.ts.map +0 -0
  267. /package/{typed → dist}/cpu-grid-layer/cpu-grid-layer.d.ts +0 -0
  268. /package/{typed → dist}/cpu-grid-layer/cpu-grid-layer.d.ts.map +0 -0
  269. /package/{typed → dist}/cpu-grid-layer/grid-aggregator.d.ts +0 -0
  270. /package/{typed → dist}/cpu-grid-layer/grid-aggregator.d.ts.map +0 -0
  271. /package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts +0 -0
  272. /package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts.map +0 -0
  273. /package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts +0 -0
  274. /package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts.map +0 -0
  275. /package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer.d.ts +0 -0
  276. /package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer.d.ts.map +0 -0
  277. /package/{typed → dist}/gpu-grid-layer/gpu-grid-layer.d.ts +0 -0
  278. /package/{typed → dist}/gpu-grid-layer/gpu-grid-layer.d.ts.map +0 -0
  279. /package/{typed → dist}/grid-aggregation-layer.d.ts +0 -0
  280. /package/{typed → dist}/grid-aggregation-layer.d.ts.map +0 -0
  281. /package/{typed → dist}/grid-layer/grid-layer.d.ts +0 -0
  282. /package/{typed → dist}/grid-layer/grid-layer.d.ts.map +0 -0
  283. /package/{typed → dist}/heatmap-layer/max-fs.glsl.d.ts +0 -0
  284. /package/{typed → dist}/heatmap-layer/max-fs.glsl.d.ts.map +0 -0
  285. /package/{typed → dist}/heatmap-layer/triangle-layer-fragment.glsl.d.ts.map +0 -0
  286. /package/{typed → dist}/heatmap-layer/triangle-layer-vertex.glsl.d.ts +0 -0
  287. /package/{typed → dist}/heatmap-layer/triangle-layer-vertex.glsl.d.ts.map +0 -0
  288. /package/{typed → dist}/heatmap-layer/weights-fs.glsl.d.ts +0 -0
  289. /package/{typed → dist}/heatmap-layer/weights-fs.glsl.d.ts.map +0 -0
  290. /package/{typed → dist}/hexagon-layer/hexagon-aggregator.d.ts +0 -0
  291. /package/{typed → dist}/hexagon-layer/hexagon-aggregator.d.ts.map +0 -0
  292. /package/{typed → dist}/hexagon-layer/hexagon-layer.d.ts +0 -0
  293. /package/{typed → dist}/hexagon-layer/hexagon-layer.d.ts.map +0 -0
  294. /package/{typed → dist}/index.d.ts +0 -0
  295. /package/{typed → dist}/index.d.ts.map +0 -0
  296. /package/{typed → dist}/screen-grid-layer/screen-grid-cell-layer.d.ts +0 -0
  297. /package/{typed → dist}/screen-grid-layer/screen-grid-cell-layer.d.ts.map +0 -0
  298. /package/{typed → dist}/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts +0 -0
  299. /package/{typed → dist}/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts.map +0 -0
  300. /package/{typed → dist}/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts +0 -0
  301. /package/{typed → dist}/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts.map +0 -0
  302. /package/{typed → dist}/screen-grid-layer/screen-grid-layer.d.ts +0 -0
  303. /package/{typed → dist}/screen-grid-layer/screen-grid-layer.d.ts.map +0 -0
  304. /package/{typed → dist}/types.d.ts +0 -0
  305. /package/{typed → dist}/types.d.ts.map +0 -0
  306. /package/{typed → dist}/utils/aggregation-operation-utils.d.ts +0 -0
  307. /package/{typed → dist}/utils/aggregation-operation-utils.d.ts.map +0 -0
  308. /package/{typed → dist}/utils/bin-sorter.d.ts +0 -0
  309. /package/{typed → dist}/utils/bin-sorter.d.ts.map +0 -0
  310. /package/{typed → dist}/utils/color-utils.d.ts +0 -0
  311. /package/{typed → dist}/utils/color-utils.d.ts.map +0 -0
  312. /package/{typed → dist}/utils/cpu-aggregator.d.ts +0 -0
  313. /package/{typed → dist}/utils/cpu-aggregator.d.ts.map +0 -0
  314. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts +0 -0
  315. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts.map +0 -0
  316. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts +0 -0
  317. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts.map +0 -0
  318. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts +0 -0
  319. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts.map +0 -0
  320. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts +0 -0
  321. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts.map +0 -0
  322. /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts +0 -0
  323. /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts.map +0 -0
  324. /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts +0 -0
  325. /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts.map +0 -0
  326. /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts +0 -0
  327. /package/{typed → dist}/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts +0 -0
  328. /package/{typed → dist}/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts.map +0 -0
  329. /package/{typed → dist}/utils/grid-aggregation-utils.d.ts +0 -0
  330. /package/{typed → dist}/utils/grid-aggregation-utils.d.ts.map +0 -0
  331. /package/{typed → dist}/utils/prop-utils.d.ts +0 -0
  332. /package/{typed → dist}/utils/prop-utils.d.ts.map +0 -0
  333. /package/{typed → dist}/utils/resource-utils.d.ts +0 -0
  334. /package/{typed → dist}/utils/resource-utils.d.ts.map +0 -0
  335. /package/{typed → dist}/utils/scale-utils.d.ts +0 -0
  336. /package/{typed → dist}/utils/scale-utils.d.ts.map +0 -0
@@ -0,0 +1,34 @@
1
+ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
2
+ //
3
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ // of this software and associated documentation files (the "Software"), to deal
5
+ // in the Software without restriction, including without limitation the rights
6
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ // copies of the Software, and to permit persons to whom the Software is
8
+ // furnished to do so, subject to the following conditions:
9
+ //
10
+ // The above copyright notice and this permission notice shall be included in
11
+ // all copies or substantial portions of the Software.
12
+ //
13
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ // THE SOFTWARE.
20
+ export default `\
21
+ #version 300 es
22
+ #define SHADER_NAME gpu-grid-cell-layer-fragment-shader
23
+
24
+ precision highp float;
25
+
26
+ in vec4 vColor;
27
+
28
+ out vec4 fragColor;
29
+
30
+ void main(void) {
31
+ fragColor = vColor;
32
+ fragColor = picking_filterColor(fragColor);
33
+ }
34
+ `;
@@ -1,3 +1,23 @@
1
+ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
2
+ //
3
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ // of this software and associated documentation files (the "Software"), to deal
5
+ // in the Software without restriction, including without limitation the rights
6
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ // copies of the Software, and to permit persons to whom the Software is
8
+ // furnished to do so, subject to the following conditions:
9
+ //
10
+ // The above copyright notice and this permission notice shall be included in
11
+ // all copies or substantial portions of the Software.
12
+ //
13
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ // THE SOFTWARE.
20
+ // Inspired by screen-grid-layer vertex shader in deck.gl
1
21
  export default `\
2
22
  #version 300 es
3
23
  #define SHADER_NAME gpu-grid-cell-layer-vertex-shader
@@ -119,4 +139,3 @@ void main(void) {
119
139
  }
120
140
  }
121
141
  `;
122
- //# sourceMappingURL=gpu-grid-cell-layer-vertex.glsl.js.map
@@ -0,0 +1,145 @@
1
+ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
2
+ //
3
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ // of this software and associated documentation files (the "Software"), to deal
5
+ // in the Software without restriction, including without limitation the rights
6
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ // copies of the Software, and to permit persons to whom the Software is
8
+ // furnished to do so, subject to the following conditions:
9
+ //
10
+ // The above copyright notice and this permission notice shall be included in
11
+ // all copies or substantial portions of the Software.
12
+ //
13
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ // THE SOFTWARE.
20
+ import { Layer, fp64LowPart, project32, gouraudLighting, picking } from '@deck.gl/core';
21
+ import { CubeGeometry } from '@luma.gl/engine';
22
+ import { fp64arithmetic } from '@luma.gl/shadertools';
23
+ import { Model } from '@luma.gl/engine';
24
+ import { GL } from '@luma.gl/constants';
25
+ import { defaultColorRange, colorRangeToFlatArray } from "../utils/color-utils.js";
26
+ import vs from "./gpu-grid-cell-layer-vertex.glsl.js";
27
+ import fs from "./gpu-grid-cell-layer-fragment.glsl.js";
28
+ const COLOR_DATA_UBO_INDEX = 0;
29
+ const ELEVATION_DATA_UBO_INDEX = 1;
30
+ const defaultProps = {
31
+ // color
32
+ colorDomain: null,
33
+ colorRange: defaultColorRange,
34
+ // elevation
35
+ elevationDomain: null,
36
+ elevationRange: [0, 1000],
37
+ elevationScale: { type: 'number', min: 0, value: 1 },
38
+ // grid
39
+ gridSize: { type: 'array', value: [1, 1] },
40
+ gridOrigin: { type: 'array', value: [0, 0] },
41
+ gridOffset: { type: 'array', value: [0, 0] },
42
+ cellSize: { type: 'number', min: 0, max: 1000, value: 1000 },
43
+ offset: { type: 'array', value: [1, 1] },
44
+ coverage: { type: 'number', min: 0, max: 1, value: 1 },
45
+ extruded: true,
46
+ material: true // Use lighting module defaults
47
+ };
48
+ export default class GPUGridCellLayer extends Layer {
49
+ static { this.layerName = 'GPUGridCellLayer'; }
50
+ static { this.defaultProps = defaultProps; }
51
+ getShaders() {
52
+ return super.getShaders({
53
+ vs,
54
+ fs,
55
+ modules: [project32, gouraudLighting, picking, fp64arithmetic]
56
+ });
57
+ }
58
+ initializeState() {
59
+ const attributeManager = this.getAttributeManager();
60
+ attributeManager.addInstanced({
61
+ colors: {
62
+ size: 4,
63
+ noAlloc: true
64
+ },
65
+ elevations: {
66
+ size: 4,
67
+ noAlloc: true
68
+ }
69
+ });
70
+ const model = this._getModel();
71
+ this._setupUniformBuffer(model);
72
+ this.setState({ model });
73
+ }
74
+ _getModel() {
75
+ return new Model(this.context.device, {
76
+ ...this.getShaders(),
77
+ id: this.props.id,
78
+ geometry: new CubeGeometry(),
79
+ isInstanced: true
80
+ });
81
+ }
82
+ draw({ uniforms }) {
83
+ const { cellSize, offset, extruded, elevationScale, coverage, gridSize, gridOrigin, gridOffset, elevationRange, colorMaxMinBuffer, elevationMaxMinBuffer } = this.props;
84
+ const model = this.state.model;
85
+ const gridOriginLow = [fp64LowPart(gridOrigin[0]), fp64LowPart(gridOrigin[1])];
86
+ const gridOffsetLow = [fp64LowPart(gridOffset[0]), fp64LowPart(gridOffset[1])];
87
+ const domainUniforms = this.getDomainUniforms();
88
+ const colorRange = colorRangeToFlatArray(this.props.colorRange);
89
+ this.bindUniformBuffers(colorMaxMinBuffer, elevationMaxMinBuffer);
90
+ model.setUniforms(uniforms);
91
+ model.setUniforms(domainUniforms);
92
+ model.setUniforms({
93
+ cellSize,
94
+ offset,
95
+ extruded,
96
+ elevationScale,
97
+ coverage,
98
+ gridSize,
99
+ gridOrigin,
100
+ gridOriginLow,
101
+ gridOffset,
102
+ gridOffsetLow,
103
+ colorRange,
104
+ elevationRange
105
+ });
106
+ model.draw(this.context.renderPass);
107
+ this.unbindUniformBuffers(colorMaxMinBuffer, elevationMaxMinBuffer);
108
+ }
109
+ bindUniformBuffers(colorMaxMinBuffer, elevationMaxMinBuffer) {
110
+ colorMaxMinBuffer.bind({ target: GL.UNIFORM_BUFFER, index: COLOR_DATA_UBO_INDEX });
111
+ elevationMaxMinBuffer.bind({ target: GL.UNIFORM_BUFFER, index: ELEVATION_DATA_UBO_INDEX });
112
+ }
113
+ unbindUniformBuffers(colorMaxMinBuffer, elevationMaxMinBuffer) {
114
+ colorMaxMinBuffer.unbind({ target: GL.UNIFORM_BUFFER, index: COLOR_DATA_UBO_INDEX });
115
+ elevationMaxMinBuffer.unbind({ target: GL.UNIFORM_BUFFER, index: ELEVATION_DATA_UBO_INDEX });
116
+ }
117
+ getDomainUniforms() {
118
+ const { colorDomain, elevationDomain } = this.props;
119
+ const domainUniforms = {};
120
+ if (colorDomain !== null) {
121
+ domainUniforms.colorDomainValid = true;
122
+ domainUniforms.colorDomain = colorDomain;
123
+ }
124
+ else {
125
+ domainUniforms.colorDomainValid = false;
126
+ }
127
+ if (elevationDomain !== null) {
128
+ domainUniforms.elevationDomainValid = true;
129
+ domainUniforms.elevationDomain = elevationDomain;
130
+ }
131
+ else {
132
+ domainUniforms.elevationDomainValid = false;
133
+ }
134
+ return domainUniforms;
135
+ }
136
+ _setupUniformBuffer(model) {
137
+ // @ts-expect-error TODO v9 This code is not portable to WebGPU
138
+ const programHandle = model.pipeline.handle;
139
+ const gl = this.context.gl;
140
+ const colorIndex = gl.getUniformBlockIndex(programHandle, 'ColorData');
141
+ const elevationIndex = gl.getUniformBlockIndex(programHandle, 'ElevationData');
142
+ gl.uniformBlockBinding(programHandle, colorIndex, COLOR_DATA_UBO_INDEX);
143
+ gl.uniformBlockBinding(programHandle, elevationIndex, ELEVATION_DATA_UBO_INDEX);
144
+ }
145
+ }
@@ -0,0 +1,288 @@
1
+ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
2
+ //
3
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ // of this software and associated documentation files (the "Software"), to deal
5
+ // in the Software without restriction, including without limitation the rights
6
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ // copies of the Software, and to permit persons to whom the Software is
8
+ // furnished to do so, subject to the following conditions:
9
+ //
10
+ // The above copyright notice and this permission notice shall be included in
11
+ // all copies or substantial portions of the Software.
12
+ //
13
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ // THE SOFTWARE.
20
+ import { GL } from '@luma.gl/constants';
21
+ import { log } from '@deck.gl/core';
22
+ import GPUGridAggregator from "../utils/gpu-grid-aggregation/gpu-grid-aggregator.js";
23
+ import { AGGREGATION_OPERATION } from "../utils/aggregation-operation-utils.js";
24
+ import { defaultColorRange, colorRangeToFlatArray } from "../utils/color-utils.js";
25
+ import GPUGridCellLayer from "./gpu-grid-cell-layer.js";
26
+ import { pointToDensityGridDataCPU } from "./../cpu-grid-layer/grid-aggregator.js";
27
+ import GridAggregationLayer from "../grid-aggregation-layer.js";
28
+ import { getBoundingBox, getGridParams } from "../utils/grid-aggregation-utils.js";
29
+ const defaultProps = {
30
+ // color
31
+ colorDomain: null,
32
+ colorRange: defaultColorRange,
33
+ getColorWeight: { type: 'accessor', value: 1 },
34
+ colorAggregation: 'SUM',
35
+ // elevation
36
+ elevationDomain: null,
37
+ elevationRange: [0, 1000],
38
+ getElevationWeight: { type: 'accessor', value: 1 },
39
+ elevationAggregation: 'SUM',
40
+ elevationScale: { type: 'number', min: 0, value: 1 },
41
+ // grid
42
+ cellSize: { type: 'number', min: 1, max: 1000, value: 1000 },
43
+ coverage: { type: 'number', min: 0, max: 1, value: 1 },
44
+ getPosition: { type: 'accessor', value: (x) => x.position },
45
+ extruded: false,
46
+ // Optional material for 'lighting' shader module
47
+ material: true
48
+ };
49
+ // This layer only perform GPU aggregation, no need to seperate data and weight props
50
+ // aggregation will be dirty when any of the props are changed.
51
+ const DIMENSIONS = {
52
+ data: {
53
+ props: ['cellSize', 'colorAggregation', 'elevationAggregation']
54
+ }
55
+ // rest of the changes are detected by `state.attributesChanged`
56
+ };
57
+ const POSITION_ATTRIBUTE_NAME = 'positions';
58
+ /** Aggregate data into a grid-based heatmap. Aggregation is performed on GPU (WebGL2 only). */
59
+ export default class GPUGridLayer extends GridAggregationLayer {
60
+ static { this.layerName = 'GPUGridLayer'; }
61
+ static { this.defaultProps = defaultProps; }
62
+ initializeState({ device }) {
63
+ const isSupported = GPUGridAggregator.isSupported(device);
64
+ if (!isSupported) {
65
+ log.error('GPUGridLayer is not supported on this browser, use GridLayer instead')();
66
+ }
67
+ super.initializeAggregationLayer({
68
+ dimensions: DIMENSIONS
69
+ });
70
+ this.setState({
71
+ gpuAggregation: false, // TODO(v9): Re-enable GPU aggregation.
72
+ projectPoints: false, // aggregation in world space
73
+ isSupported,
74
+ weights: {
75
+ color: {
76
+ needMin: true,
77
+ needMax: true,
78
+ combineMaxMin: true,
79
+ maxMinBuffer: device.createBuffer({
80
+ byteLength: 4 * 4,
81
+ // @ts-expect-error webgl-legacy
82
+ accessor: { size: 4, type: GL.FLOAT, divisor: 1 }
83
+ })
84
+ },
85
+ elevation: {
86
+ needMin: true,
87
+ needMax: true,
88
+ combineMaxMin: true,
89
+ maxMinBuffer: device.createBuffer({
90
+ byteLength: 4 * 4,
91
+ // @ts-expect-error
92
+ accessor: { size: 4, type: GL.FLOAT, divisor: 1 }
93
+ })
94
+ }
95
+ },
96
+ positionAttributeName: 'positions'
97
+ });
98
+ const attributeManager = this.getAttributeManager();
99
+ attributeManager.add({
100
+ [POSITION_ATTRIBUTE_NAME]: {
101
+ size: 3,
102
+ accessor: 'getPosition',
103
+ type: GL.DOUBLE,
104
+ fp64: this.use64bitPositions()
105
+ },
106
+ color: { size: 3, accessor: 'getColorWeight' },
107
+ elevation: { size: 3, accessor: 'getElevationWeight' }
108
+ });
109
+ }
110
+ updateState(opts) {
111
+ if (this.state.isSupported === false) {
112
+ // Skip update, layer not supported
113
+ return;
114
+ }
115
+ super.updateState(opts);
116
+ const { aggregationDirty } = this.state;
117
+ if (aggregationDirty) {
118
+ // reset cached CPU Aggregation results (used for picking)
119
+ this.setState({
120
+ gridHash: null
121
+ });
122
+ }
123
+ }
124
+ getHashKeyForIndex(index) {
125
+ const { numRow, numCol, boundingBox, gridOffset } = this.state;
126
+ const gridSize = [numCol, numRow];
127
+ const gridOrigin = [boundingBox.xMin, boundingBox.yMin];
128
+ const cellSize = [gridOffset.xOffset, gridOffset.yOffset];
129
+ const yIndex = Math.floor(index / gridSize[0]);
130
+ const xIndex = index - yIndex * gridSize[0];
131
+ // This will match the index to the hash-key to access aggregation data from CPU aggregation results.
132
+ const latIdx = Math.floor((yIndex * cellSize[1] + gridOrigin[1] + 90 + cellSize[1] / 2) / cellSize[1]);
133
+ const lonIdx = Math.floor((xIndex * cellSize[0] + gridOrigin[0] + 180 + cellSize[0] / 2) / cellSize[0]);
134
+ return `${latIdx}-${lonIdx}`;
135
+ }
136
+ getPositionForIndex(index) {
137
+ const { numRow, numCol, boundingBox, gridOffset } = this.state;
138
+ const gridSize = [numCol, numRow];
139
+ const gridOrigin = [boundingBox.xMin, boundingBox.yMin];
140
+ const cellSize = [gridOffset.xOffset, gridOffset.yOffset];
141
+ const yIndex = Math.floor(index / gridSize[0]);
142
+ const xIndex = index - yIndex * gridSize[0];
143
+ const yPos = yIndex * cellSize[1] + gridOrigin[1];
144
+ const xPos = xIndex * cellSize[0] + gridOrigin[0];
145
+ return [xPos, yPos];
146
+ }
147
+ getPickingInfo({ info, mode }) {
148
+ const { index } = info;
149
+ let object = null;
150
+ if (index >= 0) {
151
+ const gpuGridAggregator = this.state.gpuGridAggregator;
152
+ const position = this.getPositionForIndex(index);
153
+ const colorInfo = GPUGridAggregator.getAggregationData({
154
+ pixelIndex: index,
155
+ ...gpuGridAggregator.getData('color')
156
+ });
157
+ const elevationInfo = GPUGridAggregator.getAggregationData({
158
+ pixelIndex: index,
159
+ ...gpuGridAggregator.getData('elevation')
160
+ });
161
+ object = {
162
+ colorValue: colorInfo.cellWeight,
163
+ elevationValue: elevationInfo.cellWeight,
164
+ count: colorInfo.cellCount || elevationInfo.cellCount,
165
+ position,
166
+ totalCount: colorInfo.totalCount || elevationInfo.totalCount
167
+ };
168
+ if (mode !== 'hover') {
169
+ // perform CPU aggregation for full list of points for each cell
170
+ const { props } = this;
171
+ let { gridHash } = this.state;
172
+ if (!gridHash) {
173
+ const { gridOffset, translation, boundingBox } = this.state;
174
+ const { viewport } = this.context;
175
+ const attributes = this.getAttributes();
176
+ const cpuAggregation = pointToDensityGridDataCPU(props, {
177
+ gridOffset,
178
+ attributes,
179
+ viewport,
180
+ translation,
181
+ boundingBox
182
+ });
183
+ gridHash = cpuAggregation.gridHash;
184
+ this.setState({ gridHash });
185
+ }
186
+ const key = this.getHashKeyForIndex(index);
187
+ const cpuAggregationData = gridHash[key];
188
+ Object.assign(object, cpuAggregationData);
189
+ }
190
+ }
191
+ // override object with picked cell
192
+ info.picked = Boolean(object);
193
+ info.object = object;
194
+ return info;
195
+ }
196
+ renderLayers() {
197
+ if (!this.state.isSupported) {
198
+ return null;
199
+ }
200
+ const { elevationScale, extruded, cellSize: cellSizeMeters, coverage, material, elevationRange, colorDomain, elevationDomain } = this.props;
201
+ const { weights, numRow, numCol, gridOrigin, gridOffset } = this.state;
202
+ const { color, elevation } = weights;
203
+ const colorRange = colorRangeToFlatArray(this.props.colorRange);
204
+ const SubLayerClass = this.getSubLayerClass('gpu-grid-cell', GPUGridCellLayer);
205
+ return new SubLayerClass({
206
+ gridSize: [numCol, numRow],
207
+ gridOrigin,
208
+ gridOffset: [gridOffset.xOffset, gridOffset.yOffset],
209
+ colorRange,
210
+ elevationRange,
211
+ colorDomain,
212
+ elevationDomain,
213
+ cellSize: cellSizeMeters,
214
+ coverage,
215
+ material,
216
+ elevationScale,
217
+ extruded
218
+ }, this.getSubLayerProps({
219
+ id: 'gpu-grid-cell'
220
+ }), {
221
+ data: {
222
+ attributes: {
223
+ colors: color.aggregationBuffer,
224
+ elevations: elevation.aggregationBuffer
225
+ }
226
+ },
227
+ colorMaxMinBuffer: color.maxMinBuffer,
228
+ elevationMaxMinBuffer: elevation.maxMinBuffer,
229
+ numInstances: numCol * numRow
230
+ });
231
+ }
232
+ finalizeState(context) {
233
+ const { color, elevation } = this.state.weights;
234
+ [color, elevation].forEach(weight => {
235
+ const { aggregationBuffer, maxMinBuffer } = weight;
236
+ maxMinBuffer?.destroy();
237
+ aggregationBuffer?.destroy();
238
+ });
239
+ super.finalizeState(context);
240
+ }
241
+ // Aggregation Overrides
242
+ updateAggregationState(opts) {
243
+ const { props, oldProps } = opts;
244
+ const { cellSize, coordinateSystem } = props;
245
+ const { viewport } = this.context;
246
+ const cellSizeChanged = oldProps.cellSize !== cellSize;
247
+ const { dimensions } = this.state;
248
+ const positionsChanged = this.isAttributeChanged(POSITION_ATTRIBUTE_NAME);
249
+ // any attribute changed
250
+ const attributesChanged = positionsChanged || this.isAttributeChanged();
251
+ let { boundingBox } = this.state;
252
+ if (positionsChanged) {
253
+ boundingBox = getBoundingBox(this.getAttributes(), this.getNumInstances());
254
+ this.setState({ boundingBox });
255
+ }
256
+ if (positionsChanged || cellSizeChanged) {
257
+ const { gridOffset, translation, width, height, numCol, numRow } = getGridParams(boundingBox, cellSize, viewport, coordinateSystem);
258
+ this.allocateResources(numRow, numCol);
259
+ this.setState({
260
+ gridOffset,
261
+ translation,
262
+ gridOrigin: [-1 * translation[0], -1 * translation[1]],
263
+ width,
264
+ height,
265
+ numCol,
266
+ numRow
267
+ });
268
+ }
269
+ const aggregationDataDirty = attributesChanged ||
270
+ this.isAggregationDirty(opts, {
271
+ dimension: dimensions.data,
272
+ compareAll: true
273
+ });
274
+ if (aggregationDataDirty) {
275
+ this._updateAccessors(opts);
276
+ }
277
+ this.setState({
278
+ aggregationDataDirty
279
+ });
280
+ }
281
+ // Private
282
+ _updateAccessors(opts) {
283
+ const { colorAggregation, elevationAggregation } = opts.props;
284
+ const { color, elevation } = this.state.weights;
285
+ color.operation = AGGREGATION_OPERATION[colorAggregation];
286
+ elevation.operation = AGGREGATION_OPERATION[elevationAggregation];
287
+ }
288
+ }
@@ -0,0 +1,172 @@
1
+ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.
2
+ //
3
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ // of this software and associated documentation files (the "Software"), to deal
5
+ // in the Software without restriction, including without limitation the rights
6
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ // copies of the Software, and to permit persons to whom the Software is
8
+ // furnished to do so, subject to the following conditions:
9
+ //
10
+ // The above copyright notice and this permission notice shall be included in
11
+ // all copies or substantial portions of the Software.
12
+ //
13
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ // THE SOFTWARE.
20
+ import { GL } from '@luma.gl/constants';
21
+ import { log } from '@deck.gl/core';
22
+ import AggregationLayer from "./aggregation-layer.js";
23
+ import GPUGridAggregator from "./utils/gpu-grid-aggregation/gpu-grid-aggregator.js";
24
+ import BinSorter from "./utils/bin-sorter.js";
25
+ import { pointToDensityGridDataCPU } from "./cpu-grid-layer/grid-aggregator.js";
26
+ export default class GridAggregationLayer extends AggregationLayer {
27
+ static { this.layerName = 'GridAggregationLayer'; }
28
+ initializeAggregationLayer({ dimensions }) {
29
+ super.initializeAggregationLayer(dimensions);
30
+ this.setState({
31
+ // CPU aggregation results
32
+ layerData: {},
33
+ gpuGridAggregator: new GPUGridAggregator(this.context.device, {
34
+ id: `${this.id}-gpu-aggregator`
35
+ }),
36
+ cpuGridAggregator: pointToDensityGridDataCPU
37
+ });
38
+ }
39
+ updateState(opts) {
40
+ // get current attributes
41
+ super.updateState(opts);
42
+ this.updateAggregationState(opts);
43
+ const { aggregationDataDirty, aggregationWeightsDirty, gpuAggregation } = this.state;
44
+ if (this.getNumInstances() <= 0) {
45
+ return;
46
+ }
47
+ let aggregationDirty = false;
48
+ // CPU aggregation is two steps
49
+ // 1. Create bins (based on cellSize and position) 2. Aggregate weights for each bin
50
+ // For GPU aggregation both above steps are combined into one step
51
+ // step-1
52
+ if (aggregationDataDirty || (gpuAggregation && aggregationWeightsDirty)) {
53
+ this._updateAggregation(opts);
54
+ aggregationDirty = true;
55
+ }
56
+ // step-2 (Applicalbe for CPU aggregation only)
57
+ if (!gpuAggregation && (aggregationDataDirty || aggregationWeightsDirty)) {
58
+ this._updateWeightBins();
59
+ this._uploadAggregationResults();
60
+ aggregationDirty = true;
61
+ }
62
+ this.setState({ aggregationDirty });
63
+ }
64
+ finalizeState(context) {
65
+ const { count } = this.state.weights;
66
+ if (count && count.aggregationBuffer) {
67
+ count.aggregationBuffer.delete();
68
+ }
69
+ this.state.gpuGridAggregator?.delete();
70
+ super.finalizeState(context);
71
+ }
72
+ updateShaders(shaders) {
73
+ if (this.state.gpuAggregation) {
74
+ this.state.gpuGridAggregator.updateShaders(shaders);
75
+ }
76
+ }
77
+ // Methods that can be overriden by subclasses for customizations
78
+ updateAggregationState(opts) {
79
+ // Sublayers should implement this method.
80
+ log.assert(false);
81
+ }
82
+ allocateResources(numRow, numCol) {
83
+ if (this.state.numRow !== numRow || this.state.numCol !== numCol) {
84
+ const dataBytes = numCol * numRow * 4 * 4;
85
+ const { weights } = this.state;
86
+ for (const name in weights) {
87
+ const weight = weights[name];
88
+ if (weight.aggregationBuffer) {
89
+ weight.aggregationBuffer.delete();
90
+ }
91
+ weight.aggregationBuffer = this.context.device.createBuffer({
92
+ byteLength: dataBytes,
93
+ // @ts-expect-error legacy
94
+ accessor: {
95
+ size: 4,
96
+ type: GL.FLOAT,
97
+ divisor: 1
98
+ }
99
+ });
100
+ }
101
+ }
102
+ }
103
+ updateResults({ aggregationData, maxMinData, maxData, minData }) {
104
+ const { count } = this.state.weights;
105
+ if (count) {
106
+ count.aggregationData = aggregationData;
107
+ count.maxMinData = maxMinData;
108
+ count.maxData = maxData;
109
+ count.minData = minData;
110
+ }
111
+ }
112
+ // Private
113
+ _updateAggregation(opts) {
114
+ const { cpuGridAggregator, gpuGridAggregator, gridOffset, posOffset, translation = [0, 0], scaling = [0, 0, 0], boundingBox, projectPoints, gpuAggregation, numCol, numRow } = this.state;
115
+ const { props } = opts;
116
+ const { viewport } = this.context;
117
+ const attributes = this.getAttributes();
118
+ const vertexCount = this.getNumInstances();
119
+ if (!gpuAggregation) {
120
+ const result = cpuGridAggregator(props, {
121
+ gridOffset,
122
+ projectPoints,
123
+ attributes,
124
+ viewport,
125
+ posOffset,
126
+ boundingBox
127
+ });
128
+ this.setState({
129
+ layerData: result
130
+ });
131
+ }
132
+ else {
133
+ const { weights } = this.state;
134
+ gpuGridAggregator.run({
135
+ weights,
136
+ cellSize: [gridOffset.xOffset, gridOffset.yOffset],
137
+ numCol,
138
+ numRow,
139
+ translation,
140
+ scaling,
141
+ vertexCount,
142
+ projectPoints,
143
+ attributes,
144
+ moduleSettings: this.getModuleSettings()
145
+ });
146
+ }
147
+ }
148
+ _updateWeightBins() {
149
+ const { getValue } = this.state;
150
+ const sortedBins = new BinSorter(this.state.layerData.data || [], { getValue });
151
+ this.setState({ sortedBins });
152
+ }
153
+ _uploadAggregationResults() {
154
+ const { numCol, numRow } = this.state;
155
+ const { data } = this.state.layerData;
156
+ const { aggregatedBins, minValue, maxValue, totalCount } = this.state.sortedBins;
157
+ const ELEMENTCOUNT = 4;
158
+ const aggregationSize = numCol * numRow * ELEMENTCOUNT;
159
+ const aggregationData = new Float32Array(aggregationSize).fill(0);
160
+ for (const bin of aggregatedBins) {
161
+ const { lonIdx, latIdx } = data[bin.i];
162
+ const { value, counts } = bin;
163
+ const cellIndex = (lonIdx + latIdx * numCol) * ELEMENTCOUNT;
164
+ aggregationData[cellIndex] = value;
165
+ aggregationData[cellIndex + ELEMENTCOUNT - 1] = counts;
166
+ }
167
+ const maxMinData = new Float32Array([maxValue, 0, 0, minValue]);
168
+ const maxData = new Float32Array([maxValue, 0, 0, totalCount]);
169
+ const minData = new Float32Array([minValue, 0, 0, totalCount]);
170
+ this.updateResults({ aggregationData, maxMinData, maxData, minData });
171
+ }
172
+ }