@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,19 @@
1
+ export default `\
2
+ #version 300 es
3
+ uniform sampler2D inTexture;
4
+ uniform float textureSize;
5
+ out vec4 outTexture;
6
+
7
+ void main()
8
+ {
9
+ // Sample every pixel in texture
10
+ int yIndex = gl_VertexID / int(textureSize);
11
+ int xIndex = gl_VertexID - (yIndex * int(textureSize));
12
+ vec2 uv = (0.5 + vec2(float(xIndex), float(yIndex))) / textureSize;
13
+ outTexture = texture(inTexture, uv);
14
+
15
+ gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
16
+ // Enforce default value for ANGLE issue (https://bugs.chromium.org/p/angleproject/issues/detail?id=3941)
17
+ gl_PointSize = 1.0;
18
+ }
19
+ `;
@@ -0,0 +1,3 @@
1
+ declare const _default: "#version 300 es\n#define SHADER_NAME triangle-layer-fragment-shader\n\nprecision highp float;\n\nuniform float opacity;\nuniform sampler2D weightsTexture;\nuniform sampler2D colorTexture;\nuniform float aggregationMode;\n\nin vec2 vTexCoords;\nin float vIntensityMin;\nin float vIntensityMax;\n\nout vec4 fragColor;\n\nvec4 getLinearColor(float value) {\n float factor = clamp(value * vIntensityMax, 0., 1.);\n vec4 color = texture(colorTexture, vec2(factor, 0.5));\n color.a *= min(value * vIntensityMin, 1.0);\n return color;\n}\n\nvoid main(void) {\n vec4 weights = texture(weightsTexture, vTexCoords);\n float weight = weights.r;\n\n if (aggregationMode > 0.5) {\n weight /= max(1.0, weights.a);\n }\n\n // discard pixels with 0 weight.\n if (weight <= 0.) {\n discard;\n }\n\n vec4 linearColor = getLinearColor(weight);\n linearColor.a *= opacity;\n fragColor = linearColor;\n}\n";
2
+ export default _default;
3
+ //# sourceMappingURL=triangle-layer-fragment.glsl.d.ts.map
@@ -0,0 +1,61 @@
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 triangle-layer-fragment-shader
23
+
24
+ precision highp float;
25
+
26
+ uniform float opacity;
27
+ uniform sampler2D weightsTexture;
28
+ uniform sampler2D colorTexture;
29
+ uniform float aggregationMode;
30
+
31
+ in vec2 vTexCoords;
32
+ in float vIntensityMin;
33
+ in float vIntensityMax;
34
+
35
+ out vec4 fragColor;
36
+
37
+ vec4 getLinearColor(float value) {
38
+ float factor = clamp(value * vIntensityMax, 0., 1.);
39
+ vec4 color = texture(colorTexture, vec2(factor, 0.5));
40
+ color.a *= min(value * vIntensityMin, 1.0);
41
+ return color;
42
+ }
43
+
44
+ void main(void) {
45
+ vec4 weights = texture(weightsTexture, vTexCoords);
46
+ float weight = weights.r;
47
+
48
+ if (aggregationMode > 0.5) {
49
+ weight /= max(1.0, weights.a);
50
+ }
51
+
52
+ // discard pixels with 0 weight.
53
+ if (weight <= 0.) {
54
+ discard;
55
+ }
56
+
57
+ vec4 linearColor = getLinearColor(weight);
58
+ linearColor.a *= opacity;
59
+ fragColor = linearColor;
60
+ }
61
+ `;
@@ -0,0 +1,52 @@
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
21
+ export default `\
22
+ #version 300 es
23
+ #define SHADER_NAME heatp-map-layer-vertex-shader
24
+
25
+ uniform sampler2D maxTexture;
26
+ uniform float intensity;
27
+ uniform vec2 colorDomain;
28
+ uniform float threshold;
29
+ uniform float aggregationMode;
30
+
31
+ in vec3 positions;
32
+ in vec2 texCoords;
33
+
34
+ out vec2 vTexCoords;
35
+ out float vIntensityMin;
36
+ out float vIntensityMax;
37
+
38
+ void main(void) {
39
+ gl_Position = project_position_to_clipspace(positions, vec3(0.0), vec3(0.0));
40
+ vTexCoords = texCoords;
41
+ vec4 maxTexture = texture(maxTexture, vec2(0.5));
42
+ float maxValue = aggregationMode < 0.5 ? maxTexture.r : maxTexture.g;
43
+ float minValue = maxValue * threshold;
44
+ if (colorDomain[1] > 0.) {
45
+ // if user specified custom domain use it.
46
+ maxValue = colorDomain[1];
47
+ minValue = colorDomain[0];
48
+ }
49
+ vIntensityMax = intensity / maxValue;
50
+ vIntensityMin = intensity / minValue;
51
+ }
52
+ `;
@@ -1,7 +1,13 @@
1
- import type { Device, Texture } from '@luma.gl/core';
1
+ import type { Buffer, Device, Texture } from '@luma.gl/core';
2
2
  import { Model } from '@luma.gl/engine';
3
3
  import { Layer, LayerContext } from '@deck.gl/core';
4
4
  type _TriangleLayerProps = {
5
+ data: {
6
+ attributes: {
7
+ positions: Buffer;
8
+ texCoords: Buffer;
9
+ };
10
+ };
5
11
  colorDomain: number[];
6
12
  aggregationMode: string;
7
13
  threshold: number;
@@ -9,12 +15,14 @@ type _TriangleLayerProps = {
9
15
  vertexCount: number;
10
16
  colorTexture: Texture;
11
17
  maxTexture: Texture;
12
- texture: Texture;
18
+ weightsTexture: Texture;
13
19
  };
14
20
  export default class TriangleLayer extends Layer<_TriangleLayerProps> {
15
21
  static layerName: string;
16
22
  state: {
17
23
  model: Model;
24
+ positions: Buffer;
25
+ texCoords: Buffer;
18
26
  };
19
27
  getShaders(): {
20
28
  vs: string;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"triangle-layer.d.ts","sourceRoot":"","sources":["../../src/heatmap-layer/triangle-layer.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAC,KAAK,EAAE,YAAY,EAAY,MAAM,eAAe,CAAC;AAI7D,KAAK,mBAAmB,GAAG;IACzB,IAAI,EAAE;QAAC,UAAU,EAAE;YAAC,SAAS,EAAE,MAAM,CAAC;YAAC,SAAS,EAAE,MAAM,CAAA;SAAC,CAAA;KAAC,CAAC;IAC3D,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,KAAK,CAAC,mBAAmB,CAAC;IACnE,MAAM,CAAC,SAAS,SAAmB;IAEnC,KAAK,EAAG;QACN,KAAK,EAAE,KAAK,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IAEF,UAAU;;;;;IAIV,eAAe,CAAC,EAAC,MAAM,EAAC,EAAE,YAAY,GAAG,IAAI;IAI7C,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK;IAiBhC,IAAI,CAAC,EAAC,QAAQ,EAAC;;KAAA,GAAG,IAAI;CAYvB"}
@@ -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
+ }
@@ -19,4 +19,3 @@ void main()
19
19
  DECKGL_FILTER_COLOR(fragColor, geometry);
20
20
  }
21
21
  `;
22
- //# sourceMappingURL=weights-fs.glsl.js.map
@@ -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"}
@@ -8,18 +8,19 @@ uniform float radiusPixels;
8
8
  uniform float textureWidth;
9
9
  uniform vec4 commonBounds;
10
10
  uniform float weightsScale;
11
+
11
12
  void main()
12
13
  {
13
14
  weightsTexture = vec4(weights * weightsScale, 0., 0., 1.);
14
15
 
15
- float radiusTexels = project_pixel_size(radiusPixels) * textureWidth / (commonBounds.z - commonBounds.x);
16
+ float radiusTexels = project_pixel_size(radiusPixels) * textureWidth / (commonBounds.z - commonBounds.x);
16
17
  gl_PointSize = radiusTexels * 2.;
17
18
 
18
19
  vec3 commonPosition = project_position(positions, positions64Low);
19
20
 
20
- // map xy from commonBounds to [-1, 1]
21
+ // // map xy from commonBounds to [-1, 1]
21
22
  gl_Position.xy = (commonPosition.xy - commonBounds.xy) / (commonBounds.zw - commonBounds.xy) ;
22
23
  gl_Position.xy = (gl_Position.xy * 2.) - (1.);
24
+ gl_Position.w = 1.0;
23
25
  }
24
26
  `;
25
- //# sourceMappingURL=weights-vs.glsl.js.map
@@ -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
+ }
@@ -0,0 +1,174 @@
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 { GL } from '@luma.gl/constants';
23
+ import { defaultColorRange } from "../utils/color-utils.js";
24
+ import { pointToHexbin } from "./hexagon-aggregator.js";
25
+ import CPUAggregator from "../utils/cpu-aggregator.js";
26
+ import AggregationLayer from "../aggregation-layer.js";
27
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
28
+ function nop() { }
29
+ const defaultProps = {
30
+ // color
31
+ colorDomain: null,
32
+ colorRange: defaultColorRange,
33
+ getColorValue: { type: 'accessor', value: null }, // default value is calcuated from `getColorWeight` and `colorAggregation`
34
+ getColorWeight: { type: 'accessor', value: 1 },
35
+ colorAggregation: 'SUM',
36
+ lowerPercentile: { type: 'number', value: 0, min: 0, max: 100 },
37
+ upperPercentile: { type: 'number', value: 100, min: 0, max: 100 },
38
+ colorScaleType: 'quantize',
39
+ onSetColorDomain: nop,
40
+ // elevation
41
+ elevationDomain: null,
42
+ elevationRange: [0, 1000],
43
+ getElevationValue: { type: 'accessor', value: null }, // default value is calcuated from `getElevationWeight` and `elevationAggregation`
44
+ getElevationWeight: { type: 'accessor', value: 1 },
45
+ elevationAggregation: 'SUM',
46
+ elevationLowerPercentile: { type: 'number', value: 0, min: 0, max: 100 },
47
+ elevationUpperPercentile: { type: 'number', value: 100, min: 0, max: 100 },
48
+ elevationScale: { type: 'number', min: 0, value: 1 },
49
+ elevationScaleType: 'linear',
50
+ onSetElevationDomain: nop,
51
+ radius: { type: 'number', value: 1000, min: 1 },
52
+ coverage: { type: 'number', min: 0, max: 1, value: 1 },
53
+ extruded: false,
54
+ hexagonAggregator: pointToHexbin,
55
+ getPosition: { type: 'accessor', value: (x) => x.position },
56
+ // Optional material for 'lighting' shader module
57
+ material: true,
58
+ // data filter
59
+ _filterData: { type: 'function', value: null, optional: true }
60
+ };
61
+ /** Aggregates data into a hexagon-based heatmap. The color and height of a hexagon are determined based on the objects it contains. */
62
+ export default class HexagonLayer extends AggregationLayer {
63
+ static { this.layerName = 'HexagonLayer'; }
64
+ static { this.defaultProps = defaultProps; }
65
+ initializeState() {
66
+ const cpuAggregator = new CPUAggregator({
67
+ getAggregator: props => props.hexagonAggregator,
68
+ getCellSize: props => props.radius
69
+ });
70
+ this.state = {
71
+ cpuAggregator,
72
+ aggregatorState: cpuAggregator.state,
73
+ vertices: null
74
+ };
75
+ const attributeManager = this.getAttributeManager();
76
+ attributeManager.add({
77
+ positions: { size: 3, type: GL.DOUBLE, accessor: 'getPosition' }
78
+ });
79
+ // color and elevation attributes can't be added as attributes
80
+ // they are calculated using 'getValue' accessor that takes an array of pints.
81
+ }
82
+ updateState(opts) {
83
+ super.updateState(opts);
84
+ if (opts.changeFlags.propsOrDataChanged) {
85
+ const aggregatorState = this.state.cpuAggregator.updateState(opts, {
86
+ viewport: this.context.viewport,
87
+ attributes: this.getAttributes()
88
+ });
89
+ if (this.state.aggregatorState.layerData !== aggregatorState.layerData) {
90
+ // if user provided custom aggregator and returns hexagonVertices,
91
+ // Need to recalculate radius and angle based on vertices
92
+ // @ts-expect-error
93
+ const { hexagonVertices } = aggregatorState.layerData || {};
94
+ this.setState({
95
+ vertices: hexagonVertices && this.convertLatLngToMeterOffset(hexagonVertices)
96
+ });
97
+ }
98
+ this.setState({
99
+ // make a copy of the internal state of cpuAggregator for testing
100
+ aggregatorState
101
+ });
102
+ }
103
+ }
104
+ convertLatLngToMeterOffset(hexagonVertices) {
105
+ const { viewport } = this.context;
106
+ if (Array.isArray(hexagonVertices) && hexagonVertices.length === 6) {
107
+ // get centroid of hexagons
108
+ const vertex0 = hexagonVertices[0];
109
+ const vertex3 = hexagonVertices[3];
110
+ const centroid = [(vertex0[0] + vertex3[0]) / 2, (vertex0[1] + vertex3[1]) / 2];
111
+ const centroidFlat = viewport.projectFlat(centroid);
112
+ const { metersPerUnit } = viewport.getDistanceScales(centroid);
113
+ // offset all points by centroid to meter offset
114
+ const vertices = hexagonVertices.map(vt => {
115
+ const vtFlat = viewport.projectFlat(vt);
116
+ return [
117
+ (vtFlat[0] - centroidFlat[0]) * metersPerUnit[0],
118
+ (vtFlat[1] - centroidFlat[1]) * metersPerUnit[1]
119
+ ];
120
+ });
121
+ return vertices;
122
+ }
123
+ log.error('HexagonLayer: hexagonVertices needs to be an array of 6 points')();
124
+ return null;
125
+ }
126
+ getPickingInfo({ info }) {
127
+ return this.state.cpuAggregator.getPickingInfo({ info });
128
+ }
129
+ // create a method for testing
130
+ _onGetSublayerColor(cell) {
131
+ return this.state.cpuAggregator.getAccessor('fillColor')(cell);
132
+ }
133
+ // create a method for testing
134
+ _onGetSublayerElevation(cell) {
135
+ return this.state.cpuAggregator.getAccessor('elevation')(cell);
136
+ }
137
+ _getSublayerUpdateTriggers() {
138
+ return this.state.cpuAggregator.getUpdateTriggers(this.props);
139
+ }
140
+ renderLayers() {
141
+ const { elevationScale, extruded, coverage, material, transitions } = this.props;
142
+ const { aggregatorState, vertices } = this.state;
143
+ const SubLayerClass = this.getSubLayerClass('hexagon-cell', ColumnLayer);
144
+ const updateTriggers = this._getSublayerUpdateTriggers();
145
+ const geometry = vertices
146
+ ? { vertices, radius: 1 }
147
+ : {
148
+ // default geometry
149
+ // @ts-expect-error TODO - undefined property?
150
+ radius: aggregatorState.layerData.radiusCommon || 1,
151
+ radiusUnits: 'common',
152
+ angle: 90
153
+ };
154
+ return new SubLayerClass({
155
+ ...geometry,
156
+ diskResolution: 6,
157
+ elevationScale,
158
+ extruded,
159
+ coverage,
160
+ material,
161
+ getFillColor: this._onGetSublayerColor.bind(this),
162
+ getElevation: this._onGetSublayerElevation.bind(this),
163
+ transitions: transitions && {
164
+ getFillColor: transitions.getColorValue || transitions.getColorWeight,
165
+ getElevation: transitions.getElevationValue || transitions.getElevationWeight
166
+ }
167
+ }, this.getSubLayerProps({
168
+ id: 'hexagon-cell',
169
+ updateTriggers
170
+ }), {
171
+ data: aggregatorState.layerData.data
172
+ });
173
+ }
174
+ }