@deck.gl/aggregation-layers 9.0.0-beta.1 → 9.0.0-beta.10

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 (360) hide show
  1. package/dist/aggregation-layer.js +153 -0
  2. package/{typed → dist}/contour-layer/contour-layer.d.ts +1 -1
  3. package/dist/contour-layer/contour-layer.d.ts.map +1 -0
  4. package/dist/contour-layer/contour-layer.js +240 -0
  5. package/dist/contour-layer/contour-utils.js +64 -0
  6. package/dist/contour-layer/marching-squares-codes.js +337 -0
  7. package/dist/contour-layer/marching-squares.js +147 -0
  8. package/{typed → dist}/cpu-grid-layer/cpu-grid-layer.d.ts +3 -3
  9. package/dist/cpu-grid-layer/cpu-grid-layer.d.ts.map +1 -0
  10. package/dist/cpu-grid-layer/cpu-grid-layer.js +129 -0
  11. package/dist/cpu-grid-layer/grid-aggregator.js +141 -0
  12. package/dist/dist.dev.js +1439 -10866
  13. package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +30 -0
  14. package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +112 -0
  15. package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer.d.ts +1 -1
  16. package/dist/gpu-grid-layer/gpu-grid-cell-layer.d.ts.map +1 -0
  17. package/dist/gpu-grid-layer/gpu-grid-cell-layer.js +145 -0
  18. package/{typed → dist}/gpu-grid-layer/gpu-grid-layer.d.ts +4 -4
  19. package/dist/gpu-grid-layer/gpu-grid-layer.d.ts.map +1 -0
  20. package/dist/gpu-grid-layer/gpu-grid-layer.js +288 -0
  21. package/{typed → dist}/grid-aggregation-layer.d.ts +3 -3
  22. package/dist/grid-aggregation-layer.d.ts.map +1 -0
  23. package/dist/grid-aggregation-layer.js +172 -0
  24. package/{typed → dist}/grid-layer/grid-layer.d.ts +2 -2
  25. package/dist/grid-layer/grid-layer.d.ts.map +1 -0
  26. package/dist/grid-layer/grid-layer.js +63 -0
  27. package/{typed → dist}/heatmap-layer/heatmap-layer-utils.d.ts +0 -9
  28. package/dist/heatmap-layer/heatmap-layer-utils.d.ts.map +1 -0
  29. package/dist/heatmap-layer/heatmap-layer-utils.js +63 -0
  30. package/{typed → dist}/heatmap-layer/heatmap-layer.d.ts +5 -6
  31. package/dist/heatmap-layer/heatmap-layer.d.ts.map +1 -0
  32. package/dist/heatmap-layer/heatmap-layer.js +455 -0
  33. package/dist/heatmap-layer/max-fs.glsl.js +9 -0
  34. package/dist/heatmap-layer/max-vs.glsl.d.ts +3 -0
  35. package/{typed → dist}/heatmap-layer/max-vs.glsl.d.ts.map +1 -1
  36. package/dist/heatmap-layer/max-vs.glsl.js +15 -0
  37. package/dist/heatmap-layer/triangle-layer-fragment.glsl.d.ts +3 -0
  38. package/dist/heatmap-layer/triangle-layer-fragment.glsl.js +51 -0
  39. package/dist/heatmap-layer/triangle-layer-vertex.glsl.js +47 -0
  40. package/{typed → dist}/heatmap-layer/triangle-layer.d.ts +10 -2
  41. package/dist/heatmap-layer/triangle-layer.d.ts.map +1 -0
  42. package/dist/heatmap-layer/triangle-layer.js +59 -0
  43. package/dist/heatmap-layer/weights-fs.glsl.js +17 -0
  44. package/dist/heatmap-layer/weights-vs.glsl.d.ts +3 -0
  45. package/{typed → dist}/heatmap-layer/weights-vs.glsl.d.ts.map +1 -1
  46. package/dist/heatmap-layer/weights-vs.glsl.js +21 -0
  47. package/dist/hexagon-layer/hexagon-aggregator.js +112 -0
  48. package/{typed → dist}/hexagon-layer/hexagon-layer.d.ts +4 -4
  49. package/dist/hexagon-layer/hexagon-layer.d.ts.map +1 -0
  50. package/dist/hexagon-layer/hexagon-layer.js +173 -0
  51. package/dist/index.cjs +4327 -0
  52. package/dist/index.cjs.map +7 -0
  53. package/dist/index.d.ts +20 -0
  54. package/dist/index.d.ts.map +1 -0
  55. package/dist/index.js +32 -0
  56. package/{typed → dist}/screen-grid-layer/screen-grid-cell-layer.d.ts +2 -3
  57. package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts.map +1 -0
  58. package/dist/screen-grid-layer/screen-grid-cell-layer.js +163 -0
  59. package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.js +35 -0
  60. package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.js +72 -0
  61. package/{typed → dist}/screen-grid-layer/screen-grid-layer.d.ts +1 -4
  62. package/dist/screen-grid-layer/screen-grid-layer.d.ts.map +1 -0
  63. package/dist/screen-grid-layer/screen-grid-layer.js +209 -0
  64. package/dist/types.js +1 -0
  65. package/dist/utils/aggregation-operation-utils.js +94 -0
  66. package/{typed → dist}/utils/bin-sorter.d.ts +1 -1
  67. package/dist/utils/bin-sorter.js +167 -0
  68. package/dist/utils/color-utils.js +53 -0
  69. package/dist/utils/cpu-aggregator.js +421 -0
  70. package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +36 -0
  71. package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +42 -0
  72. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +30 -0
  73. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +61 -0
  74. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +41 -0
  75. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +1 -0
  76. package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts.map +1 -1
  77. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +555 -0
  78. package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +32 -0
  79. package/dist/utils/grid-aggregation-utils.js +114 -0
  80. package/dist/utils/prop-utils.js +28 -0
  81. package/dist/utils/resource-utils.js +38 -0
  82. package/dist/utils/scale-utils.js +184 -0
  83. package/dist.min.js +299 -555
  84. package/package.json +19 -14
  85. package/src/contour-layer/contour-layer.ts +2 -3
  86. package/src/cpu-grid-layer/cpu-grid-layer.ts +1 -2
  87. package/src/gpu-grid-layer/gpu-grid-cell-layer.ts +1 -1
  88. package/src/gpu-grid-layer/gpu-grid-layer.ts +2 -2
  89. package/src/heatmap-layer/heatmap-layer-utils.ts +0 -23
  90. package/src/heatmap-layer/heatmap-layer.ts +92 -128
  91. package/src/heatmap-layer/max-vs.glsl.ts +11 -5
  92. package/src/heatmap-layer/triangle-layer-fragment.glsl.ts +2 -2
  93. package/src/heatmap-layer/triangle-layer.ts +17 -23
  94. package/src/heatmap-layer/weights-vs.glsl.ts +4 -2
  95. package/src/hexagon-layer/hexagon-layer.ts +2 -3
  96. package/src/screen-grid-layer/screen-grid-cell-layer.ts +0 -4
  97. package/src/screen-grid-layer/screen-grid-layer.ts +1 -11
  98. package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.ts +14 -28
  99. package/dist/es5/aggregation-layer.js +0 -215
  100. package/dist/es5/aggregation-layer.js.map +0 -1
  101. package/dist/es5/contour-layer/contour-layer.js +0 -353
  102. package/dist/es5/contour-layer/contour-layer.js.map +0 -1
  103. package/dist/es5/contour-layer/contour-utils.js +0 -110
  104. package/dist/es5/contour-layer/contour-utils.js.map +0 -1
  105. package/dist/es5/contour-layer/marching-squares-codes.js +0 -152
  106. package/dist/es5/contour-layer/marching-squares-codes.js.map +0 -1
  107. package/dist/es5/contour-layer/marching-squares.js +0 -168
  108. package/dist/es5/contour-layer/marching-squares.js.map +0 -1
  109. package/dist/es5/cpu-grid-layer/cpu-grid-layer.js +0 -235
  110. package/dist/es5/cpu-grid-layer/cpu-grid-layer.js.map +0 -1
  111. package/dist/es5/cpu-grid-layer/grid-aggregator.js +0 -180
  112. package/dist/es5/cpu-grid-layer/grid-aggregator.js.map +0 -1
  113. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +0 -9
  114. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js.map +0 -1
  115. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +0 -9
  116. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js.map +0 -1
  117. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer.js +0 -247
  118. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer.js.map +0 -1
  119. package/dist/es5/gpu-grid-layer/gpu-grid-layer.js +0 -424
  120. package/dist/es5/gpu-grid-layer/gpu-grid-layer.js.map +0 -1
  121. package/dist/es5/grid-aggregation-layer.js +0 -280
  122. package/dist/es5/grid-aggregation-layer.js.map +0 -1
  123. package/dist/es5/grid-layer/grid-layer.js +0 -125
  124. package/dist/es5/grid-layer/grid-layer.js.map +0 -1
  125. package/dist/es5/heatmap-layer/heatmap-layer-utils.js +0 -122
  126. package/dist/es5/heatmap-layer/heatmap-layer-utils.js.map +0 -1
  127. package/dist/es5/heatmap-layer/heatmap-layer.js +0 -672
  128. package/dist/es5/heatmap-layer/heatmap-layer.js.map +0 -1
  129. package/dist/es5/heatmap-layer/max-fs.glsl.js +0 -9
  130. package/dist/es5/heatmap-layer/max-fs.glsl.js.map +0 -1
  131. package/dist/es5/heatmap-layer/max-vs.glsl.js +0 -9
  132. package/dist/es5/heatmap-layer/max-vs.glsl.js.map +0 -1
  133. package/dist/es5/heatmap-layer/triangle-layer-fragment.glsl.js +0 -9
  134. package/dist/es5/heatmap-layer/triangle-layer-fragment.glsl.js.map +0 -1
  135. package/dist/es5/heatmap-layer/triangle-layer-vertex.glsl.js +0 -9
  136. package/dist/es5/heatmap-layer/triangle-layer-vertex.glsl.js.map +0 -1
  137. package/dist/es5/heatmap-layer/triangle-layer.js +0 -122
  138. package/dist/es5/heatmap-layer/triangle-layer.js.map +0 -1
  139. package/dist/es5/heatmap-layer/weights-fs.glsl.js +0 -9
  140. package/dist/es5/heatmap-layer/weights-fs.glsl.js.map +0 -1
  141. package/dist/es5/heatmap-layer/weights-vs.glsl.js +0 -9
  142. package/dist/es5/heatmap-layer/weights-vs.glsl.js.map +0 -1
  143. package/dist/es5/hexagon-layer/hexagon-aggregator.js +0 -118
  144. package/dist/es5/hexagon-layer/hexagon-aggregator.js.map +0 -1
  145. package/dist/es5/hexagon-layer/hexagon-layer.js +0 -289
  146. package/dist/es5/hexagon-layer/hexagon-layer.js.map +0 -1
  147. package/dist/es5/index.js +0 -104
  148. package/dist/es5/index.js.map +0 -1
  149. package/dist/es5/screen-grid-layer/screen-grid-cell-layer.js +0 -244
  150. package/dist/es5/screen-grid-layer/screen-grid-cell-layer.js.map +0 -1
  151. package/dist/es5/screen-grid-layer/screen-grid-layer-fragment.glsl.js +0 -9
  152. package/dist/es5/screen-grid-layer/screen-grid-layer-fragment.glsl.js.map +0 -1
  153. package/dist/es5/screen-grid-layer/screen-grid-layer-vertex.glsl.js +0 -9
  154. package/dist/es5/screen-grid-layer/screen-grid-layer-vertex.glsl.js.map +0 -1
  155. package/dist/es5/screen-grid-layer/screen-grid-layer.js +0 -317
  156. package/dist/es5/screen-grid-layer/screen-grid-layer.js.map +0 -1
  157. package/dist/es5/types.js +0 -2
  158. package/dist/es5/types.js.map +0 -1
  159. package/dist/es5/utils/aggregation-operation-utils.js +0 -123
  160. package/dist/es5/utils/aggregation-operation-utils.js.map +0 -1
  161. package/dist/es5/utils/bin-sorter.js +0 -248
  162. package/dist/es5/utils/bin-sorter.js.map +0 -1
  163. package/dist/es5/utils/color-utils.js +0 -39
  164. package/dist/es5/utils/color-utils.js.map +0 -1
  165. package/dist/es5/utils/cpu-aggregator.js +0 -496
  166. package/dist/es5/utils/cpu-aggregator.js.map +0 -1
  167. package/dist/es5/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +0 -9
  168. package/dist/es5/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js.map +0 -1
  169. package/dist/es5/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +0 -9
  170. package/dist/es5/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js.map +0 -1
  171. package/dist/es5/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +0 -9
  172. package/dist/es5/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js.map +0 -1
  173. package/dist/es5/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +0 -9
  174. package/dist/es5/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js.map +0 -1
  175. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +0 -63
  176. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js.map +0 -1
  177. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +0 -2
  178. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js.map +0 -1
  179. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +0 -732
  180. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.js.map +0 -1
  181. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +0 -155
  182. package/dist/es5/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +0 -9
  183. package/dist/es5/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js.map +0 -1
  184. package/dist/es5/utils/grid-aggregation-utils.js +0 -118
  185. package/dist/es5/utils/grid-aggregation-utils.js.map +0 -1
  186. package/dist/es5/utils/prop-utils.js +0 -19
  187. package/dist/es5/utils/prop-utils.js.map +0 -1
  188. package/dist/es5/utils/resource-utils.js +0 -59
  189. package/dist/es5/utils/resource-utils.js.map +0 -1
  190. package/dist/es5/utils/scale-utils.js +0 -254
  191. package/dist/es5/utils/scale-utils.js.map +0 -1
  192. package/dist/esm/aggregation-layer.js +0 -156
  193. package/dist/esm/aggregation-layer.js.map +0 -1
  194. package/dist/esm/contour-layer/contour-layer.js +0 -316
  195. package/dist/esm/contour-layer/contour-layer.js.map +0 -1
  196. package/dist/esm/contour-layer/contour-utils.js +0 -81
  197. package/dist/esm/contour-layer/contour-utils.js.map +0 -1
  198. package/dist/esm/contour-layer/marching-squares-codes.js +0 -219
  199. package/dist/esm/contour-layer/marching-squares-codes.js.map +0 -1
  200. package/dist/esm/contour-layer/marching-squares.js +0 -151
  201. package/dist/esm/contour-layer/marching-squares.js.map +0 -1
  202. package/dist/esm/cpu-grid-layer/cpu-grid-layer.js +0 -186
  203. package/dist/esm/cpu-grid-layer/cpu-grid-layer.js.map +0 -1
  204. package/dist/esm/cpu-grid-layer/grid-aggregator.js +0 -142
  205. package/dist/esm/cpu-grid-layer/grid-aggregator.js.map +0 -1
  206. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +0 -16
  207. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js.map +0 -1
  208. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +0 -122
  209. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js.map +0 -1
  210. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer.js +0 -196
  211. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer.js.map +0 -1
  212. package/dist/esm/gpu-grid-layer/gpu-grid-layer.js +0 -399
  213. package/dist/esm/gpu-grid-layer/gpu-grid-layer.js.map +0 -1
  214. package/dist/esm/grid-aggregation-layer.js +0 -240
  215. package/dist/esm/grid-aggregation-layer.js.map +0 -1
  216. package/dist/esm/grid-layer/grid-layer.js +0 -80
  217. package/dist/esm/grid-layer/grid-layer.js.map +0 -1
  218. package/dist/esm/heatmap-layer/heatmap-layer-utils.js +0 -68
  219. package/dist/esm/heatmap-layer/heatmap-layer-utils.js.map +0 -1
  220. package/dist/esm/heatmap-layer/heatmap-layer.js +0 -626
  221. package/dist/esm/heatmap-layer/heatmap-layer.js.map +0 -1
  222. package/dist/esm/heatmap-layer/max-fs.glsl.js +0 -10
  223. package/dist/esm/heatmap-layer/max-fs.glsl.js.map +0 -1
  224. package/dist/esm/heatmap-layer/max-vs.glsl.js +0 -14
  225. package/dist/esm/heatmap-layer/max-vs.glsl.js.map +0 -1
  226. package/dist/esm/heatmap-layer/triangle-layer-fragment.glsl.js +0 -43
  227. package/dist/esm/heatmap-layer/triangle-layer-fragment.glsl.js.map +0 -1
  228. package/dist/esm/heatmap-layer/triangle-layer-vertex.glsl.js +0 -33
  229. package/dist/esm/heatmap-layer/triangle-layer-vertex.glsl.js.map +0 -1
  230. package/dist/esm/heatmap-layer/triangle-layer.js +0 -80
  231. package/dist/esm/heatmap-layer/triangle-layer.js.map +0 -1
  232. package/dist/esm/heatmap-layer/weights-fs.glsl.js +0 -22
  233. package/dist/esm/heatmap-layer/weights-fs.glsl.js.map +0 -1
  234. package/dist/esm/heatmap-layer/weights-vs.glsl.js +0 -25
  235. package/dist/esm/heatmap-layer/weights-vs.glsl.js.map +0 -1
  236. package/dist/esm/hexagon-layer/hexagon-aggregator.js +0 -87
  237. package/dist/esm/hexagon-layer/hexagon-aggregator.js.map +0 -1
  238. package/dist/esm/hexagon-layer/hexagon-layer.js +0 -232
  239. package/dist/esm/hexagon-layer/hexagon-layer.js.map +0 -1
  240. package/dist/esm/index.js +0 -13
  241. package/dist/esm/index.js.map +0 -1
  242. package/dist/esm/screen-grid-layer/screen-grid-cell-layer.js +0 -203
  243. package/dist/esm/screen-grid-layer/screen-grid-cell-layer.js.map +0 -1
  244. package/dist/esm/screen-grid-layer/screen-grid-layer-fragment.glsl.js +0 -21
  245. package/dist/esm/screen-grid-layer/screen-grid-layer-fragment.glsl.js.map +0 -1
  246. package/dist/esm/screen-grid-layer/screen-grid-layer-vertex.glsl.js +0 -66
  247. package/dist/esm/screen-grid-layer/screen-grid-layer-vertex.glsl.js.map +0 -1
  248. package/dist/esm/screen-grid-layer/screen-grid-layer.js +0 -285
  249. package/dist/esm/screen-grid-layer/screen-grid-layer.js.map +0 -1
  250. package/dist/esm/types.js +0 -2
  251. package/dist/esm/types.js.map +0 -1
  252. package/dist/esm/utils/aggregation-operation-utils.js +0 -91
  253. package/dist/esm/utils/aggregation-operation-utils.js.map +0 -1
  254. package/dist/esm/utils/bin-sorter.js +0 -165
  255. package/dist/esm/utils/bin-sorter.js.map +0 -1
  256. package/dist/esm/utils/color-utils.js +0 -28
  257. package/dist/esm/utils/color-utils.js.map +0 -1
  258. package/dist/esm/utils/cpu-aggregator.js +0 -487
  259. package/dist/esm/utils/cpu-aggregator.js.map +0 -1
  260. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +0 -21
  261. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js.map +0 -1
  262. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +0 -35
  263. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js.map +0 -1
  264. package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +0 -16
  265. package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js.map +0 -1
  266. package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +0 -60
  267. package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js.map +0 -1
  268. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +0 -42
  269. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js.map +0 -1
  270. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +0 -2
  271. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js.map +0 -1
  272. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +0 -720
  273. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.js.map +0 -1
  274. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +0 -155
  275. package/dist/esm/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +0 -19
  276. package/dist/esm/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js.map +0 -1
  277. package/dist/esm/utils/grid-aggregation-utils.js +0 -109
  278. package/dist/esm/utils/grid-aggregation-utils.js.map +0 -1
  279. package/dist/esm/utils/prop-utils.js +0 -12
  280. package/dist/esm/utils/prop-utils.js.map +0 -1
  281. package/dist/esm/utils/resource-utils.js +0 -44
  282. package/dist/esm/utils/resource-utils.js.map +0 -1
  283. package/dist/esm/utils/scale-utils.js +0 -192
  284. package/dist/esm/utils/scale-utils.js.map +0 -1
  285. package/typed/contour-layer/contour-layer.d.ts.map +0 -1
  286. package/typed/cpu-grid-layer/cpu-grid-layer.d.ts.map +0 -1
  287. package/typed/gpu-grid-layer/gpu-grid-cell-layer.d.ts.map +0 -1
  288. package/typed/gpu-grid-layer/gpu-grid-layer.d.ts.map +0 -1
  289. package/typed/grid-aggregation-layer.d.ts.map +0 -1
  290. package/typed/grid-layer/grid-layer.d.ts.map +0 -1
  291. package/typed/heatmap-layer/heatmap-layer-utils.d.ts.map +0 -1
  292. package/typed/heatmap-layer/heatmap-layer.d.ts.map +0 -1
  293. package/typed/heatmap-layer/max-vs.glsl.d.ts +0 -3
  294. package/typed/heatmap-layer/triangle-layer-fragment.glsl.d.ts +0 -3
  295. package/typed/heatmap-layer/triangle-layer.d.ts.map +0 -1
  296. package/typed/heatmap-layer/weights-vs.glsl.d.ts +0 -3
  297. package/typed/hexagon-layer/hexagon-layer.d.ts.map +0 -1
  298. package/typed/index.d.ts +0 -20
  299. package/typed/index.d.ts.map +0 -1
  300. package/typed/screen-grid-layer/screen-grid-cell-layer.d.ts.map +0 -1
  301. package/typed/screen-grid-layer/screen-grid-layer.d.ts.map +0 -1
  302. /package/{typed → dist}/aggregation-layer.d.ts +0 -0
  303. /package/{typed → dist}/aggregation-layer.d.ts.map +0 -0
  304. /package/{typed → dist}/contour-layer/contour-utils.d.ts +0 -0
  305. /package/{typed → dist}/contour-layer/contour-utils.d.ts.map +0 -0
  306. /package/{typed → dist}/contour-layer/marching-squares-codes.d.ts +0 -0
  307. /package/{typed → dist}/contour-layer/marching-squares-codes.d.ts.map +0 -0
  308. /package/{typed → dist}/contour-layer/marching-squares.d.ts +0 -0
  309. /package/{typed → dist}/contour-layer/marching-squares.d.ts.map +0 -0
  310. /package/{typed → dist}/cpu-grid-layer/grid-aggregator.d.ts +0 -0
  311. /package/{typed → dist}/cpu-grid-layer/grid-aggregator.d.ts.map +0 -0
  312. /package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts +0 -0
  313. /package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts.map +0 -0
  314. /package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts +0 -0
  315. /package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts.map +0 -0
  316. /package/{typed → dist}/heatmap-layer/max-fs.glsl.d.ts +0 -0
  317. /package/{typed → dist}/heatmap-layer/max-fs.glsl.d.ts.map +0 -0
  318. /package/{typed → dist}/heatmap-layer/triangle-layer-fragment.glsl.d.ts.map +0 -0
  319. /package/{typed → dist}/heatmap-layer/triangle-layer-vertex.glsl.d.ts +0 -0
  320. /package/{typed → dist}/heatmap-layer/triangle-layer-vertex.glsl.d.ts.map +0 -0
  321. /package/{typed → dist}/heatmap-layer/weights-fs.glsl.d.ts +0 -0
  322. /package/{typed → dist}/heatmap-layer/weights-fs.glsl.d.ts.map +0 -0
  323. /package/{typed → dist}/hexagon-layer/hexagon-aggregator.d.ts +0 -0
  324. /package/{typed → dist}/hexagon-layer/hexagon-aggregator.d.ts.map +0 -0
  325. /package/{typed → dist}/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts +0 -0
  326. /package/{typed → dist}/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts.map +0 -0
  327. /package/{typed → dist}/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts +0 -0
  328. /package/{typed → dist}/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts.map +0 -0
  329. /package/{typed → dist}/types.d.ts +0 -0
  330. /package/{typed → dist}/types.d.ts.map +0 -0
  331. /package/{typed → dist}/utils/aggregation-operation-utils.d.ts +0 -0
  332. /package/{typed → dist}/utils/aggregation-operation-utils.d.ts.map +0 -0
  333. /package/{typed → dist}/utils/bin-sorter.d.ts.map +0 -0
  334. /package/{typed → dist}/utils/color-utils.d.ts +0 -0
  335. /package/{typed → dist}/utils/color-utils.d.ts.map +0 -0
  336. /package/{typed → dist}/utils/cpu-aggregator.d.ts +0 -0
  337. /package/{typed → dist}/utils/cpu-aggregator.d.ts.map +0 -0
  338. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts +0 -0
  339. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts.map +0 -0
  340. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts +0 -0
  341. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts.map +0 -0
  342. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts +0 -0
  343. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts.map +0 -0
  344. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts +0 -0
  345. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts.map +0 -0
  346. /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts +0 -0
  347. /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts.map +0 -0
  348. /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts +0 -0
  349. /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts.map +0 -0
  350. /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts +0 -0
  351. /package/{typed → dist}/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts +0 -0
  352. /package/{typed → dist}/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts.map +0 -0
  353. /package/{typed → dist}/utils/grid-aggregation-utils.d.ts +0 -0
  354. /package/{typed → dist}/utils/grid-aggregation-utils.d.ts.map +0 -0
  355. /package/{typed → dist}/utils/prop-utils.d.ts +0 -0
  356. /package/{typed → dist}/utils/prop-utils.d.ts.map +0 -0
  357. /package/{typed → dist}/utils/resource-utils.d.ts +0 -0
  358. /package/{typed → dist}/utils/resource-utils.d.ts.map +0 -0
  359. /package/{typed → dist}/utils/scale-utils.d.ts +0 -0
  360. /package/{typed → dist}/utils/scale-utils.d.ts.map +0 -0
@@ -0,0 +1,59 @@
1
+ // Copyright (c) 2015 - 2019 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 { Model } from '@luma.gl/engine';
21
+ import { Layer, project32 } from '@deck.gl/core';
22
+ import vs from "./triangle-layer-vertex.glsl.js";
23
+ import fs from "./triangle-layer-fragment.glsl.js";
24
+ export default class TriangleLayer extends Layer {
25
+ static { this.layerName = 'TriangleLayer'; }
26
+ getShaders() {
27
+ return { vs, fs, modules: [project32] };
28
+ }
29
+ initializeState({ device }) {
30
+ this.setState({ model: this._getModel(device) });
31
+ }
32
+ _getModel(device) {
33
+ const { vertexCount, data, weightsTexture, maxTexture, colorTexture } = this.props;
34
+ return new Model(device, {
35
+ ...this.getShaders(),
36
+ id: this.props.id,
37
+ bindings: { weightsTexture, maxTexture, colorTexture },
38
+ attributes: data.attributes,
39
+ bufferLayout: [
40
+ { name: 'positions', format: 'float32x3' },
41
+ { name: 'texCoords', format: 'float32x2' }
42
+ ],
43
+ topology: 'triangle-fan-webgl',
44
+ vertexCount
45
+ });
46
+ }
47
+ draw({ uniforms }) {
48
+ const { model } = this.state;
49
+ const { intensity, threshold, aggregationMode, colorDomain } = this.props;
50
+ model.setUniforms({
51
+ ...uniforms,
52
+ intensity,
53
+ threshold,
54
+ aggregationMode,
55
+ colorDomain
56
+ });
57
+ model.draw(this.context.renderPass);
58
+ }
59
+ }
@@ -0,0 +1,17 @@
1
+ export default `\
2
+ #version 300 es
3
+ in vec4 weightsTexture;
4
+ out vec4 fragColor;
5
+ float gaussianKDE(float u){
6
+ return pow(2.71828, -u*u/0.05555)/(1.77245385*0.166666);
7
+ }
8
+ void main()
9
+ {
10
+ float dist = length(gl_PointCoord - vec2(0.5, 0.5));
11
+ if (dist > 0.5) {
12
+ discard;
13
+ }
14
+ fragColor = weightsTexture * gaussianKDE(2. * dist);
15
+ DECKGL_FILTER_COLOR(fragColor, geometry);
16
+ }
17
+ `;
@@ -0,0 +1,3 @@
1
+ declare const _default: "#version 300 es\nin vec3 positions;\nin vec3 positions64Low;\nin float weights;\nout vec4 weightsTexture;\nuniform float radiusPixels;\nuniform float textureWidth;\nuniform vec4 commonBounds;\nuniform float weightsScale;\n\nvoid main()\n{\n weightsTexture = vec4(weights * weightsScale, 0., 0., 1.);\n\n float radiusTexels = project_pixel_size(radiusPixels) * textureWidth / (commonBounds.z - commonBounds.x);\n gl_PointSize = radiusTexels * 2.;\n\n vec3 commonPosition = project_position(positions, positions64Low);\n\n // // map xy from commonBounds to [-1, 1]\n gl_Position.xy = (commonPosition.xy - commonBounds.xy) / (commonBounds.zw - commonBounds.xy) ;\n gl_Position.xy = (gl_Position.xy * 2.) - (1.);\n gl_Position.w = 1.0;\n}\n";
2
+ export default _default;
3
+ //# sourceMappingURL=weights-vs.glsl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"weights-vs.glsl.d.ts","sourceRoot":"","sources":["../../src/heatmap-layer/weights-vs.glsl.ts"],"names":[],"mappings":";AAAA,wBAuBE"}
1
+ {"version":3,"file":"weights-vs.glsl.d.ts","sourceRoot":"","sources":["../../src/heatmap-layer/weights-vs.glsl.ts"],"names":[],"mappings":";AAAA,wBAyBE"}
@@ -0,0 +1,21 @@
1
+ export default `\
2
+ #version 300 es
3
+ in vec3 positions;
4
+ in vec3 positions64Low;
5
+ in float weights;
6
+ out vec4 weightsTexture;
7
+ uniform float radiusPixels;
8
+ uniform float textureWidth;
9
+ uniform vec4 commonBounds;
10
+ uniform float weightsScale;
11
+ void main()
12
+ {
13
+ weightsTexture = vec4(weights * weightsScale, 0., 0., 1.);
14
+ float radiusTexels = project_pixel_size(radiusPixels) * textureWidth / (commonBounds.z - commonBounds.x);
15
+ gl_PointSize = radiusTexels * 2.;
16
+ vec3 commonPosition = project_position(positions, positions64Low);
17
+ gl_Position.xy = (commonPosition.xy - commonBounds.xy) / (commonBounds.zw - commonBounds.xy) ;
18
+ gl_Position.xy = (gl_Position.xy * 2.) - (1.);
19
+ gl_Position.w = 1.0;
20
+ }
21
+ `;
@@ -0,0 +1,112 @@
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 { hexbin } from 'd3-hexbin';
21
+ import { createIterable, log } from '@deck.gl/core';
22
+ /**
23
+ * Use d3-hexbin to performs hexagonal binning from geo points to hexagons
24
+ * @param {Iterable} data - array of points
25
+ * @param {Number} radius - hexagon radius in meter
26
+ * @param {function} getPosition - get points lon lat
27
+ * @param {Object} viewport - current viewport object
28
+
29
+ * @return {Object} - hexagons and countRange
30
+ */
31
+ export function pointToHexbin(props, aggregationParams) {
32
+ const { data, radius } = props;
33
+ const { viewport, attributes } = aggregationParams;
34
+ // get hexagon radius in mercator world unit
35
+ const centerLngLat = data.length ? getPointsCenter(data, aggregationParams) : null;
36
+ const radiusCommon = getRadiusInCommon(radius, viewport, centerLngLat);
37
+ // add world space coordinates to points
38
+ const screenPoints = [];
39
+ const { iterable, objectInfo } = createIterable(data);
40
+ const positions = attributes.positions.value;
41
+ const { size } = attributes.positions.getAccessor();
42
+ for (const object of iterable) {
43
+ objectInfo.index++;
44
+ const posIndex = objectInfo.index * size;
45
+ const position = [positions[posIndex], positions[posIndex + 1]];
46
+ const arrayIsFinite = Number.isFinite(position[0]) && Number.isFinite(position[1]);
47
+ if (arrayIsFinite) {
48
+ screenPoints.push({
49
+ screenCoord: viewport.projectFlat(position),
50
+ source: object,
51
+ index: objectInfo.index
52
+ });
53
+ }
54
+ else {
55
+ log.warn('HexagonLayer: invalid position')();
56
+ }
57
+ }
58
+ const newHexbin = hexbin()
59
+ .radius(radiusCommon)
60
+ .x(d => d.screenCoord[0])
61
+ .y(d => d.screenCoord[1]);
62
+ const hexagonBins = newHexbin(screenPoints);
63
+ return {
64
+ hexagons: hexagonBins.map((hex, index) => ({
65
+ position: viewport.unprojectFlat([hex.x, hex.y]),
66
+ points: hex,
67
+ index
68
+ })),
69
+ radiusCommon
70
+ };
71
+ }
72
+ /**
73
+ * Get the bounding box of all data points
74
+ */
75
+ export function getPointsCenter(data, aggregationParams) {
76
+ const { attributes } = aggregationParams;
77
+ const positions = attributes.positions.value;
78
+ const { size } = attributes.positions.getAccessor();
79
+ let minX = Infinity;
80
+ let minY = Infinity;
81
+ let maxX = -Infinity;
82
+ let maxY = -Infinity;
83
+ let i;
84
+ for (i = 0; i < size * data.length; i += size) {
85
+ const x = positions[i];
86
+ const y = positions[i + 1];
87
+ const arrayIsFinite = Number.isFinite(x) && Number.isFinite(y);
88
+ if (arrayIsFinite) {
89
+ minX = Math.min(x, minX);
90
+ maxX = Math.max(x, maxX);
91
+ minY = Math.min(y, minY);
92
+ maxY = Math.max(y, maxY);
93
+ }
94
+ }
95
+ // return center
96
+ return [minX, minY, maxX, maxY].every(Number.isFinite)
97
+ ? [(minX + maxX) / 2, (minY + maxY) / 2]
98
+ : null;
99
+ }
100
+ /**
101
+ * Get radius in mercator world space coordinates from meter
102
+ * @param {Number} radius - in meter
103
+ * @param {Object} viewport - current viewport object
104
+ * @param {Array<Number>} center - data center
105
+
106
+ * @return {Number} radius in mercator world spcae coordinates
107
+ */
108
+ export function getRadiusInCommon(radius, viewport, center) {
109
+ const { unitsPerMeter } = viewport.getDistanceScales(center);
110
+ // x, y distance should be the same
111
+ return radius * unitsPerMeter[0];
112
+ }
@@ -1,8 +1,8 @@
1
1
  import { Accessor, AccessorFunction, Color, Position, Material, UpdateParameters, DefaultProps } from '@deck.gl/core';
2
2
  import { ColumnLayer } from '@deck.gl/layers';
3
- import CPUAggregator from '../utils/cpu-aggregator';
4
- import AggregationLayer, { AggregationLayerProps } from '../aggregation-layer';
5
- import { AggregateAccessor } from '../types';
3
+ import CPUAggregator from "../utils/cpu-aggregator.js";
4
+ import AggregationLayer, { AggregationLayerProps } from "../aggregation-layer.js";
5
+ import { AggregateAccessor } from "../types.js";
6
6
  /** All properties supported by by HexagonLayer. */
7
7
  export type HexagonLayerProps<DataT = unknown> = _HexagonLayerProps<DataT> & AggregationLayerProps<DataT>;
8
8
  /** Properties added by HexagonLayer. */
@@ -144,7 +144,7 @@ type _HexagonLayerProps<DataT = unknown> = {
144
144
  _filterData: null | ((d: DataT) => boolean);
145
145
  };
146
146
  /** Aggregates data into a hexagon-based heatmap. The color and height of a hexagon are determined based on the objects it contains. */
147
- export default class HexagonLayer<DataT, ExtraPropsT extends {} = {}> extends AggregationLayer<DataT, ExtraPropsT & Required<_HexagonLayerProps>> {
147
+ export default class HexagonLayer<DataT, ExtraPropsT extends {} = {}> extends AggregationLayer<DataT, ExtraPropsT & Required<_HexagonLayerProps<DataT>>> {
148
148
  static layerName: string;
149
149
  static defaultProps: DefaultProps<HexagonLayerProps<unknown>>;
150
150
  state: AggregationLayer<DataT>['state'] & {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hexagon-layer.d.ts","sourceRoot":"","sources":["../../src/hexagon-layer/hexagon-layer.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,173 @@
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 { log } from '@deck.gl/core';
21
+ import { ColumnLayer } from '@deck.gl/layers';
22
+ import { defaultColorRange } from "../utils/color-utils.js";
23
+ import { pointToHexbin } from "./hexagon-aggregator.js";
24
+ import CPUAggregator from "../utils/cpu-aggregator.js";
25
+ import AggregationLayer from "../aggregation-layer.js";
26
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
27
+ function nop() { }
28
+ const defaultProps = {
29
+ // color
30
+ colorDomain: null,
31
+ colorRange: defaultColorRange,
32
+ getColorValue: { type: 'accessor', value: null }, // default value is calcuated from `getColorWeight` and `colorAggregation`
33
+ getColorWeight: { type: 'accessor', value: 1 },
34
+ colorAggregation: 'SUM',
35
+ lowerPercentile: { type: 'number', value: 0, min: 0, max: 100 },
36
+ upperPercentile: { type: 'number', value: 100, min: 0, max: 100 },
37
+ colorScaleType: 'quantize',
38
+ onSetColorDomain: nop,
39
+ // elevation
40
+ elevationDomain: null,
41
+ elevationRange: [0, 1000],
42
+ getElevationValue: { type: 'accessor', value: null }, // default value is calcuated from `getElevationWeight` and `elevationAggregation`
43
+ getElevationWeight: { type: 'accessor', value: 1 },
44
+ elevationAggregation: 'SUM',
45
+ elevationLowerPercentile: { type: 'number', value: 0, min: 0, max: 100 },
46
+ elevationUpperPercentile: { type: 'number', value: 100, min: 0, max: 100 },
47
+ elevationScale: { type: 'number', min: 0, value: 1 },
48
+ elevationScaleType: 'linear',
49
+ onSetElevationDomain: nop,
50
+ radius: { type: 'number', value: 1000, min: 1 },
51
+ coverage: { type: 'number', min: 0, max: 1, value: 1 },
52
+ extruded: false,
53
+ hexagonAggregator: pointToHexbin,
54
+ getPosition: { type: 'accessor', value: (x) => x.position },
55
+ // Optional material for 'lighting' shader module
56
+ material: true,
57
+ // data filter
58
+ _filterData: { type: 'function', value: null, optional: true }
59
+ };
60
+ /** Aggregates data into a hexagon-based heatmap. The color and height of a hexagon are determined based on the objects it contains. */
61
+ export default class HexagonLayer extends AggregationLayer {
62
+ static { this.layerName = 'HexagonLayer'; }
63
+ static { this.defaultProps = defaultProps; }
64
+ initializeState() {
65
+ const cpuAggregator = new CPUAggregator({
66
+ getAggregator: props => props.hexagonAggregator,
67
+ getCellSize: props => props.radius
68
+ });
69
+ this.state = {
70
+ cpuAggregator,
71
+ aggregatorState: cpuAggregator.state,
72
+ vertices: null
73
+ };
74
+ const attributeManager = this.getAttributeManager();
75
+ attributeManager.add({
76
+ positions: { size: 3, type: 'float64', accessor: 'getPosition' }
77
+ });
78
+ // color and elevation attributes can't be added as attributes
79
+ // they are calculated using 'getValue' accessor that takes an array of pints.
80
+ }
81
+ updateState(opts) {
82
+ super.updateState(opts);
83
+ if (opts.changeFlags.propsOrDataChanged) {
84
+ const aggregatorState = this.state.cpuAggregator.updateState(opts, {
85
+ viewport: this.context.viewport,
86
+ attributes: this.getAttributes()
87
+ });
88
+ if (this.state.aggregatorState.layerData !== aggregatorState.layerData) {
89
+ // if user provided custom aggregator and returns hexagonVertices,
90
+ // Need to recalculate radius and angle based on vertices
91
+ // @ts-expect-error
92
+ const { hexagonVertices } = aggregatorState.layerData || {};
93
+ this.setState({
94
+ vertices: hexagonVertices && this.convertLatLngToMeterOffset(hexagonVertices)
95
+ });
96
+ }
97
+ this.setState({
98
+ // make a copy of the internal state of cpuAggregator for testing
99
+ aggregatorState
100
+ });
101
+ }
102
+ }
103
+ convertLatLngToMeterOffset(hexagonVertices) {
104
+ const { viewport } = this.context;
105
+ if (Array.isArray(hexagonVertices) && hexagonVertices.length === 6) {
106
+ // get centroid of hexagons
107
+ const vertex0 = hexagonVertices[0];
108
+ const vertex3 = hexagonVertices[3];
109
+ const centroid = [(vertex0[0] + vertex3[0]) / 2, (vertex0[1] + vertex3[1]) / 2];
110
+ const centroidFlat = viewport.projectFlat(centroid);
111
+ const { metersPerUnit } = viewport.getDistanceScales(centroid);
112
+ // offset all points by centroid to meter offset
113
+ const vertices = hexagonVertices.map(vt => {
114
+ const vtFlat = viewport.projectFlat(vt);
115
+ return [
116
+ (vtFlat[0] - centroidFlat[0]) * metersPerUnit[0],
117
+ (vtFlat[1] - centroidFlat[1]) * metersPerUnit[1]
118
+ ];
119
+ });
120
+ return vertices;
121
+ }
122
+ log.error('HexagonLayer: hexagonVertices needs to be an array of 6 points')();
123
+ return null;
124
+ }
125
+ getPickingInfo({ info }) {
126
+ return this.state.cpuAggregator.getPickingInfo({ info });
127
+ }
128
+ // create a method for testing
129
+ _onGetSublayerColor(cell) {
130
+ return this.state.cpuAggregator.getAccessor('fillColor')(cell);
131
+ }
132
+ // create a method for testing
133
+ _onGetSublayerElevation(cell) {
134
+ return this.state.cpuAggregator.getAccessor('elevation')(cell);
135
+ }
136
+ _getSublayerUpdateTriggers() {
137
+ return this.state.cpuAggregator.getUpdateTriggers(this.props);
138
+ }
139
+ renderLayers() {
140
+ const { elevationScale, extruded, coverage, material, transitions } = this.props;
141
+ const { aggregatorState, vertices } = this.state;
142
+ const SubLayerClass = this.getSubLayerClass('hexagon-cell', ColumnLayer);
143
+ const updateTriggers = this._getSublayerUpdateTriggers();
144
+ const geometry = vertices
145
+ ? { vertices, radius: 1 }
146
+ : {
147
+ // default geometry
148
+ // @ts-expect-error TODO - undefined property?
149
+ radius: aggregatorState.layerData.radiusCommon || 1,
150
+ radiusUnits: 'common',
151
+ angle: 90
152
+ };
153
+ return new SubLayerClass({
154
+ ...geometry,
155
+ diskResolution: 6,
156
+ elevationScale,
157
+ extruded,
158
+ coverage,
159
+ material,
160
+ getFillColor: this._onGetSublayerColor.bind(this),
161
+ getElevation: this._onGetSublayerElevation.bind(this),
162
+ transitions: transitions && {
163
+ getFillColor: transitions.getColorValue || transitions.getColorWeight,
164
+ getElevation: transitions.getElevationValue || transitions.getElevationWeight
165
+ }
166
+ }, this.getSubLayerProps({
167
+ id: 'hexagon-cell',
168
+ updateTriggers
169
+ }), {
170
+ data: aggregatorState.layerData.data
171
+ });
172
+ }
173
+ }