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

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 (362) hide show
  1. package/{typed → dist}/aggregation-layer.d.ts +2 -2
  2. package/dist/aggregation-layer.d.ts.map +1 -0
  3. package/dist/aggregation-layer.js +153 -0
  4. package/{typed → dist}/contour-layer/contour-layer.d.ts +1 -1
  5. package/dist/contour-layer/contour-layer.d.ts.map +1 -0
  6. package/dist/contour-layer/contour-layer.js +240 -0
  7. package/dist/contour-layer/contour-utils.js +64 -0
  8. package/dist/contour-layer/marching-squares-codes.js +337 -0
  9. package/dist/contour-layer/marching-squares.js +147 -0
  10. package/{typed → dist}/cpu-grid-layer/cpu-grid-layer.d.ts +3 -3
  11. package/dist/cpu-grid-layer/cpu-grid-layer.d.ts.map +1 -0
  12. package/dist/cpu-grid-layer/cpu-grid-layer.js +129 -0
  13. package/dist/cpu-grid-layer/grid-aggregator.js +141 -0
  14. package/dist/dist.dev.js +1442 -10868
  15. package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +30 -0
  16. package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +112 -0
  17. package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer.d.ts +1 -1
  18. package/dist/gpu-grid-layer/gpu-grid-cell-layer.d.ts.map +1 -0
  19. package/dist/gpu-grid-layer/gpu-grid-cell-layer.js +145 -0
  20. package/{typed → dist}/gpu-grid-layer/gpu-grid-layer.d.ts +4 -4
  21. package/dist/gpu-grid-layer/gpu-grid-layer.d.ts.map +1 -0
  22. package/dist/gpu-grid-layer/gpu-grid-layer.js +288 -0
  23. package/{typed → dist}/grid-aggregation-layer.d.ts +3 -3
  24. package/dist/grid-aggregation-layer.d.ts.map +1 -0
  25. package/dist/grid-aggregation-layer.js +172 -0
  26. package/{typed → dist}/grid-layer/grid-layer.d.ts +2 -2
  27. package/dist/grid-layer/grid-layer.d.ts.map +1 -0
  28. package/dist/grid-layer/grid-layer.js +63 -0
  29. package/{typed → dist}/heatmap-layer/heatmap-layer-utils.d.ts +0 -9
  30. package/dist/heatmap-layer/heatmap-layer-utils.d.ts.map +1 -0
  31. package/dist/heatmap-layer/heatmap-layer-utils.js +63 -0
  32. package/{typed → dist}/heatmap-layer/heatmap-layer.d.ts +5 -6
  33. package/dist/heatmap-layer/heatmap-layer.d.ts.map +1 -0
  34. package/dist/heatmap-layer/heatmap-layer.js +455 -0
  35. package/dist/heatmap-layer/max-fs.glsl.js +9 -0
  36. package/dist/heatmap-layer/max-vs.glsl.d.ts +3 -0
  37. package/{typed → dist}/heatmap-layer/max-vs.glsl.d.ts.map +1 -1
  38. package/dist/heatmap-layer/max-vs.glsl.js +15 -0
  39. package/dist/heatmap-layer/triangle-layer-fragment.glsl.d.ts +3 -0
  40. package/dist/heatmap-layer/triangle-layer-fragment.glsl.js +51 -0
  41. package/dist/heatmap-layer/triangle-layer-vertex.glsl.js +47 -0
  42. package/{typed → dist}/heatmap-layer/triangle-layer.d.ts +10 -2
  43. package/dist/heatmap-layer/triangle-layer.d.ts.map +1 -0
  44. package/dist/heatmap-layer/triangle-layer.js +59 -0
  45. package/dist/heatmap-layer/weights-fs.glsl.js +17 -0
  46. package/dist/heatmap-layer/weights-vs.glsl.d.ts +3 -0
  47. package/{typed → dist}/heatmap-layer/weights-vs.glsl.d.ts.map +1 -1
  48. package/dist/heatmap-layer/weights-vs.glsl.js +21 -0
  49. package/dist/hexagon-layer/hexagon-aggregator.js +112 -0
  50. package/{typed → dist}/hexagon-layer/hexagon-layer.d.ts +4 -4
  51. package/dist/hexagon-layer/hexagon-layer.d.ts.map +1 -0
  52. package/dist/hexagon-layer/hexagon-layer.js +173 -0
  53. package/dist/index.cjs +4328 -0
  54. package/dist/index.cjs.map +7 -0
  55. package/dist/index.d.ts +20 -0
  56. package/dist/index.d.ts.map +1 -0
  57. package/dist/index.js +32 -0
  58. package/{typed → dist}/screen-grid-layer/screen-grid-cell-layer.d.ts +2 -3
  59. package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts.map +1 -0
  60. package/dist/screen-grid-layer/screen-grid-cell-layer.js +164 -0
  61. package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.js +35 -0
  62. package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.js +72 -0
  63. package/{typed → dist}/screen-grid-layer/screen-grid-layer.d.ts +1 -4
  64. package/dist/screen-grid-layer/screen-grid-layer.d.ts.map +1 -0
  65. package/dist/screen-grid-layer/screen-grid-layer.js +209 -0
  66. package/dist/types.js +1 -0
  67. package/dist/utils/aggregation-operation-utils.js +94 -0
  68. package/{typed → dist}/utils/bin-sorter.d.ts +1 -1
  69. package/dist/utils/bin-sorter.js +167 -0
  70. package/dist/utils/color-utils.js +53 -0
  71. package/dist/utils/cpu-aggregator.js +421 -0
  72. package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +36 -0
  73. package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +42 -0
  74. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +30 -0
  75. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +61 -0
  76. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +41 -0
  77. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +1 -0
  78. package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts.map +1 -1
  79. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +555 -0
  80. package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +32 -0
  81. package/dist/utils/grid-aggregation-utils.js +114 -0
  82. package/dist/utils/prop-utils.js +28 -0
  83. package/dist/utils/resource-utils.js +38 -0
  84. package/dist/utils/scale-utils.js +184 -0
  85. package/dist.min.js +299 -555
  86. package/package.json +19 -14
  87. package/src/aggregation-layer.ts +3 -2
  88. package/src/contour-layer/contour-layer.ts +2 -3
  89. package/src/cpu-grid-layer/cpu-grid-layer.ts +1 -2
  90. package/src/gpu-grid-layer/gpu-grid-cell-layer.ts +1 -1
  91. package/src/gpu-grid-layer/gpu-grid-layer.ts +2 -2
  92. package/src/heatmap-layer/heatmap-layer-utils.ts +0 -23
  93. package/src/heatmap-layer/heatmap-layer.ts +91 -127
  94. package/src/heatmap-layer/max-vs.glsl.ts +11 -5
  95. package/src/heatmap-layer/triangle-layer-fragment.glsl.ts +2 -2
  96. package/src/heatmap-layer/triangle-layer.ts +17 -23
  97. package/src/heatmap-layer/weights-vs.glsl.ts +4 -2
  98. package/src/hexagon-layer/hexagon-layer.ts +2 -3
  99. package/src/screen-grid-layer/screen-grid-cell-layer.ts +3 -6
  100. package/src/screen-grid-layer/screen-grid-layer.ts +1 -11
  101. package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.ts +16 -30
  102. package/dist/es5/aggregation-layer.js +0 -215
  103. package/dist/es5/aggregation-layer.js.map +0 -1
  104. package/dist/es5/contour-layer/contour-layer.js +0 -353
  105. package/dist/es5/contour-layer/contour-layer.js.map +0 -1
  106. package/dist/es5/contour-layer/contour-utils.js +0 -110
  107. package/dist/es5/contour-layer/contour-utils.js.map +0 -1
  108. package/dist/es5/contour-layer/marching-squares-codes.js +0 -152
  109. package/dist/es5/contour-layer/marching-squares-codes.js.map +0 -1
  110. package/dist/es5/contour-layer/marching-squares.js +0 -168
  111. package/dist/es5/contour-layer/marching-squares.js.map +0 -1
  112. package/dist/es5/cpu-grid-layer/cpu-grid-layer.js +0 -235
  113. package/dist/es5/cpu-grid-layer/cpu-grid-layer.js.map +0 -1
  114. package/dist/es5/cpu-grid-layer/grid-aggregator.js +0 -180
  115. package/dist/es5/cpu-grid-layer/grid-aggregator.js.map +0 -1
  116. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +0 -9
  117. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js.map +0 -1
  118. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +0 -9
  119. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js.map +0 -1
  120. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer.js +0 -247
  121. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer.js.map +0 -1
  122. package/dist/es5/gpu-grid-layer/gpu-grid-layer.js +0 -424
  123. package/dist/es5/gpu-grid-layer/gpu-grid-layer.js.map +0 -1
  124. package/dist/es5/grid-aggregation-layer.js +0 -280
  125. package/dist/es5/grid-aggregation-layer.js.map +0 -1
  126. package/dist/es5/grid-layer/grid-layer.js +0 -125
  127. package/dist/es5/grid-layer/grid-layer.js.map +0 -1
  128. package/dist/es5/heatmap-layer/heatmap-layer-utils.js +0 -122
  129. package/dist/es5/heatmap-layer/heatmap-layer-utils.js.map +0 -1
  130. package/dist/es5/heatmap-layer/heatmap-layer.js +0 -672
  131. package/dist/es5/heatmap-layer/heatmap-layer.js.map +0 -1
  132. package/dist/es5/heatmap-layer/max-fs.glsl.js +0 -9
  133. package/dist/es5/heatmap-layer/max-fs.glsl.js.map +0 -1
  134. package/dist/es5/heatmap-layer/max-vs.glsl.js +0 -9
  135. package/dist/es5/heatmap-layer/max-vs.glsl.js.map +0 -1
  136. package/dist/es5/heatmap-layer/triangle-layer-fragment.glsl.js +0 -9
  137. package/dist/es5/heatmap-layer/triangle-layer-fragment.glsl.js.map +0 -1
  138. package/dist/es5/heatmap-layer/triangle-layer-vertex.glsl.js +0 -9
  139. package/dist/es5/heatmap-layer/triangle-layer-vertex.glsl.js.map +0 -1
  140. package/dist/es5/heatmap-layer/triangle-layer.js +0 -122
  141. package/dist/es5/heatmap-layer/triangle-layer.js.map +0 -1
  142. package/dist/es5/heatmap-layer/weights-fs.glsl.js +0 -9
  143. package/dist/es5/heatmap-layer/weights-fs.glsl.js.map +0 -1
  144. package/dist/es5/heatmap-layer/weights-vs.glsl.js +0 -9
  145. package/dist/es5/heatmap-layer/weights-vs.glsl.js.map +0 -1
  146. package/dist/es5/hexagon-layer/hexagon-aggregator.js +0 -118
  147. package/dist/es5/hexagon-layer/hexagon-aggregator.js.map +0 -1
  148. package/dist/es5/hexagon-layer/hexagon-layer.js +0 -289
  149. package/dist/es5/hexagon-layer/hexagon-layer.js.map +0 -1
  150. package/dist/es5/index.js +0 -104
  151. package/dist/es5/index.js.map +0 -1
  152. package/dist/es5/screen-grid-layer/screen-grid-cell-layer.js +0 -244
  153. package/dist/es5/screen-grid-layer/screen-grid-cell-layer.js.map +0 -1
  154. package/dist/es5/screen-grid-layer/screen-grid-layer-fragment.glsl.js +0 -9
  155. package/dist/es5/screen-grid-layer/screen-grid-layer-fragment.glsl.js.map +0 -1
  156. package/dist/es5/screen-grid-layer/screen-grid-layer-vertex.glsl.js +0 -9
  157. package/dist/es5/screen-grid-layer/screen-grid-layer-vertex.glsl.js.map +0 -1
  158. package/dist/es5/screen-grid-layer/screen-grid-layer.js +0 -317
  159. package/dist/es5/screen-grid-layer/screen-grid-layer.js.map +0 -1
  160. package/dist/es5/types.js +0 -2
  161. package/dist/es5/types.js.map +0 -1
  162. package/dist/es5/utils/aggregation-operation-utils.js +0 -123
  163. package/dist/es5/utils/aggregation-operation-utils.js.map +0 -1
  164. package/dist/es5/utils/bin-sorter.js +0 -248
  165. package/dist/es5/utils/bin-sorter.js.map +0 -1
  166. package/dist/es5/utils/color-utils.js +0 -39
  167. package/dist/es5/utils/color-utils.js.map +0 -1
  168. package/dist/es5/utils/cpu-aggregator.js +0 -496
  169. package/dist/es5/utils/cpu-aggregator.js.map +0 -1
  170. package/dist/es5/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +0 -9
  171. package/dist/es5/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js.map +0 -1
  172. package/dist/es5/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +0 -9
  173. package/dist/es5/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js.map +0 -1
  174. package/dist/es5/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +0 -9
  175. package/dist/es5/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js.map +0 -1
  176. package/dist/es5/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +0 -9
  177. package/dist/es5/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js.map +0 -1
  178. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +0 -63
  179. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js.map +0 -1
  180. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +0 -2
  181. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js.map +0 -1
  182. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +0 -732
  183. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.js.map +0 -1
  184. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +0 -155
  185. package/dist/es5/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +0 -9
  186. package/dist/es5/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js.map +0 -1
  187. package/dist/es5/utils/grid-aggregation-utils.js +0 -118
  188. package/dist/es5/utils/grid-aggregation-utils.js.map +0 -1
  189. package/dist/es5/utils/prop-utils.js +0 -19
  190. package/dist/es5/utils/prop-utils.js.map +0 -1
  191. package/dist/es5/utils/resource-utils.js +0 -59
  192. package/dist/es5/utils/resource-utils.js.map +0 -1
  193. package/dist/es5/utils/scale-utils.js +0 -254
  194. package/dist/es5/utils/scale-utils.js.map +0 -1
  195. package/dist/esm/aggregation-layer.js +0 -156
  196. package/dist/esm/aggregation-layer.js.map +0 -1
  197. package/dist/esm/contour-layer/contour-layer.js +0 -316
  198. package/dist/esm/contour-layer/contour-layer.js.map +0 -1
  199. package/dist/esm/contour-layer/contour-utils.js +0 -81
  200. package/dist/esm/contour-layer/contour-utils.js.map +0 -1
  201. package/dist/esm/contour-layer/marching-squares-codes.js +0 -219
  202. package/dist/esm/contour-layer/marching-squares-codes.js.map +0 -1
  203. package/dist/esm/contour-layer/marching-squares.js +0 -151
  204. package/dist/esm/contour-layer/marching-squares.js.map +0 -1
  205. package/dist/esm/cpu-grid-layer/cpu-grid-layer.js +0 -186
  206. package/dist/esm/cpu-grid-layer/cpu-grid-layer.js.map +0 -1
  207. package/dist/esm/cpu-grid-layer/grid-aggregator.js +0 -142
  208. package/dist/esm/cpu-grid-layer/grid-aggregator.js.map +0 -1
  209. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +0 -16
  210. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js.map +0 -1
  211. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +0 -122
  212. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js.map +0 -1
  213. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer.js +0 -196
  214. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer.js.map +0 -1
  215. package/dist/esm/gpu-grid-layer/gpu-grid-layer.js +0 -399
  216. package/dist/esm/gpu-grid-layer/gpu-grid-layer.js.map +0 -1
  217. package/dist/esm/grid-aggregation-layer.js +0 -240
  218. package/dist/esm/grid-aggregation-layer.js.map +0 -1
  219. package/dist/esm/grid-layer/grid-layer.js +0 -80
  220. package/dist/esm/grid-layer/grid-layer.js.map +0 -1
  221. package/dist/esm/heatmap-layer/heatmap-layer-utils.js +0 -68
  222. package/dist/esm/heatmap-layer/heatmap-layer-utils.js.map +0 -1
  223. package/dist/esm/heatmap-layer/heatmap-layer.js +0 -626
  224. package/dist/esm/heatmap-layer/heatmap-layer.js.map +0 -1
  225. package/dist/esm/heatmap-layer/max-fs.glsl.js +0 -10
  226. package/dist/esm/heatmap-layer/max-fs.glsl.js.map +0 -1
  227. package/dist/esm/heatmap-layer/max-vs.glsl.js +0 -14
  228. package/dist/esm/heatmap-layer/max-vs.glsl.js.map +0 -1
  229. package/dist/esm/heatmap-layer/triangle-layer-fragment.glsl.js +0 -43
  230. package/dist/esm/heatmap-layer/triangle-layer-fragment.glsl.js.map +0 -1
  231. package/dist/esm/heatmap-layer/triangle-layer-vertex.glsl.js +0 -33
  232. package/dist/esm/heatmap-layer/triangle-layer-vertex.glsl.js.map +0 -1
  233. package/dist/esm/heatmap-layer/triangle-layer.js +0 -80
  234. package/dist/esm/heatmap-layer/triangle-layer.js.map +0 -1
  235. package/dist/esm/heatmap-layer/weights-fs.glsl.js +0 -22
  236. package/dist/esm/heatmap-layer/weights-fs.glsl.js.map +0 -1
  237. package/dist/esm/heatmap-layer/weights-vs.glsl.js +0 -25
  238. package/dist/esm/heatmap-layer/weights-vs.glsl.js.map +0 -1
  239. package/dist/esm/hexagon-layer/hexagon-aggregator.js +0 -87
  240. package/dist/esm/hexagon-layer/hexagon-aggregator.js.map +0 -1
  241. package/dist/esm/hexagon-layer/hexagon-layer.js +0 -232
  242. package/dist/esm/hexagon-layer/hexagon-layer.js.map +0 -1
  243. package/dist/esm/index.js +0 -13
  244. package/dist/esm/index.js.map +0 -1
  245. package/dist/esm/screen-grid-layer/screen-grid-cell-layer.js +0 -203
  246. package/dist/esm/screen-grid-layer/screen-grid-cell-layer.js.map +0 -1
  247. package/dist/esm/screen-grid-layer/screen-grid-layer-fragment.glsl.js +0 -21
  248. package/dist/esm/screen-grid-layer/screen-grid-layer-fragment.glsl.js.map +0 -1
  249. package/dist/esm/screen-grid-layer/screen-grid-layer-vertex.glsl.js +0 -66
  250. package/dist/esm/screen-grid-layer/screen-grid-layer-vertex.glsl.js.map +0 -1
  251. package/dist/esm/screen-grid-layer/screen-grid-layer.js +0 -285
  252. package/dist/esm/screen-grid-layer/screen-grid-layer.js.map +0 -1
  253. package/dist/esm/types.js +0 -2
  254. package/dist/esm/types.js.map +0 -1
  255. package/dist/esm/utils/aggregation-operation-utils.js +0 -91
  256. package/dist/esm/utils/aggregation-operation-utils.js.map +0 -1
  257. package/dist/esm/utils/bin-sorter.js +0 -165
  258. package/dist/esm/utils/bin-sorter.js.map +0 -1
  259. package/dist/esm/utils/color-utils.js +0 -28
  260. package/dist/esm/utils/color-utils.js.map +0 -1
  261. package/dist/esm/utils/cpu-aggregator.js +0 -487
  262. package/dist/esm/utils/cpu-aggregator.js.map +0 -1
  263. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +0 -21
  264. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js.map +0 -1
  265. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +0 -35
  266. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js.map +0 -1
  267. package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +0 -16
  268. package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js.map +0 -1
  269. package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +0 -60
  270. package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js.map +0 -1
  271. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +0 -42
  272. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js.map +0 -1
  273. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +0 -2
  274. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js.map +0 -1
  275. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +0 -720
  276. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.js.map +0 -1
  277. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +0 -155
  278. package/dist/esm/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +0 -19
  279. package/dist/esm/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js.map +0 -1
  280. package/dist/esm/utils/grid-aggregation-utils.js +0 -109
  281. package/dist/esm/utils/grid-aggregation-utils.js.map +0 -1
  282. package/dist/esm/utils/prop-utils.js +0 -12
  283. package/dist/esm/utils/prop-utils.js.map +0 -1
  284. package/dist/esm/utils/resource-utils.js +0 -44
  285. package/dist/esm/utils/resource-utils.js.map +0 -1
  286. package/dist/esm/utils/scale-utils.js +0 -192
  287. package/dist/esm/utils/scale-utils.js.map +0 -1
  288. package/typed/aggregation-layer.d.ts.map +0 -1
  289. package/typed/contour-layer/contour-layer.d.ts.map +0 -1
  290. package/typed/cpu-grid-layer/cpu-grid-layer.d.ts.map +0 -1
  291. package/typed/gpu-grid-layer/gpu-grid-cell-layer.d.ts.map +0 -1
  292. package/typed/gpu-grid-layer/gpu-grid-layer.d.ts.map +0 -1
  293. package/typed/grid-aggregation-layer.d.ts.map +0 -1
  294. package/typed/grid-layer/grid-layer.d.ts.map +0 -1
  295. package/typed/heatmap-layer/heatmap-layer-utils.d.ts.map +0 -1
  296. package/typed/heatmap-layer/heatmap-layer.d.ts.map +0 -1
  297. package/typed/heatmap-layer/max-vs.glsl.d.ts +0 -3
  298. package/typed/heatmap-layer/triangle-layer-fragment.glsl.d.ts +0 -3
  299. package/typed/heatmap-layer/triangle-layer.d.ts.map +0 -1
  300. package/typed/heatmap-layer/weights-vs.glsl.d.ts +0 -3
  301. package/typed/hexagon-layer/hexagon-layer.d.ts.map +0 -1
  302. package/typed/index.d.ts +0 -20
  303. package/typed/index.d.ts.map +0 -1
  304. package/typed/screen-grid-layer/screen-grid-cell-layer.d.ts.map +0 -1
  305. package/typed/screen-grid-layer/screen-grid-layer.d.ts.map +0 -1
  306. /package/{typed → dist}/contour-layer/contour-utils.d.ts +0 -0
  307. /package/{typed → dist}/contour-layer/contour-utils.d.ts.map +0 -0
  308. /package/{typed → dist}/contour-layer/marching-squares-codes.d.ts +0 -0
  309. /package/{typed → dist}/contour-layer/marching-squares-codes.d.ts.map +0 -0
  310. /package/{typed → dist}/contour-layer/marching-squares.d.ts +0 -0
  311. /package/{typed → dist}/contour-layer/marching-squares.d.ts.map +0 -0
  312. /package/{typed → dist}/cpu-grid-layer/grid-aggregator.d.ts +0 -0
  313. /package/{typed → dist}/cpu-grid-layer/grid-aggregator.d.ts.map +0 -0
  314. /package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts +0 -0
  315. /package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts.map +0 -0
  316. /package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts +0 -0
  317. /package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts.map +0 -0
  318. /package/{typed → dist}/heatmap-layer/max-fs.glsl.d.ts +0 -0
  319. /package/{typed → dist}/heatmap-layer/max-fs.glsl.d.ts.map +0 -0
  320. /package/{typed → dist}/heatmap-layer/triangle-layer-fragment.glsl.d.ts.map +0 -0
  321. /package/{typed → dist}/heatmap-layer/triangle-layer-vertex.glsl.d.ts +0 -0
  322. /package/{typed → dist}/heatmap-layer/triangle-layer-vertex.glsl.d.ts.map +0 -0
  323. /package/{typed → dist}/heatmap-layer/weights-fs.glsl.d.ts +0 -0
  324. /package/{typed → dist}/heatmap-layer/weights-fs.glsl.d.ts.map +0 -0
  325. /package/{typed → dist}/hexagon-layer/hexagon-aggregator.d.ts +0 -0
  326. /package/{typed → dist}/hexagon-layer/hexagon-aggregator.d.ts.map +0 -0
  327. /package/{typed → dist}/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts +0 -0
  328. /package/{typed → dist}/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts.map +0 -0
  329. /package/{typed → dist}/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts +0 -0
  330. /package/{typed → dist}/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts.map +0 -0
  331. /package/{typed → dist}/types.d.ts +0 -0
  332. /package/{typed → dist}/types.d.ts.map +0 -0
  333. /package/{typed → dist}/utils/aggregation-operation-utils.d.ts +0 -0
  334. /package/{typed → dist}/utils/aggregation-operation-utils.d.ts.map +0 -0
  335. /package/{typed → dist}/utils/bin-sorter.d.ts.map +0 -0
  336. /package/{typed → dist}/utils/color-utils.d.ts +0 -0
  337. /package/{typed → dist}/utils/color-utils.d.ts.map +0 -0
  338. /package/{typed → dist}/utils/cpu-aggregator.d.ts +0 -0
  339. /package/{typed → dist}/utils/cpu-aggregator.d.ts.map +0 -0
  340. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts +0 -0
  341. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts.map +0 -0
  342. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts +0 -0
  343. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts.map +0 -0
  344. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts +0 -0
  345. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts.map +0 -0
  346. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts +0 -0
  347. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts.map +0 -0
  348. /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts +0 -0
  349. /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts.map +0 -0
  350. /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts +0 -0
  351. /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts.map +0 -0
  352. /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts +0 -0
  353. /package/{typed → dist}/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts +0 -0
  354. /package/{typed → dist}/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts.map +0 -0
  355. /package/{typed → dist}/utils/grid-aggregation-utils.d.ts +0 -0
  356. /package/{typed → dist}/utils/grid-aggregation-utils.d.ts.map +0 -0
  357. /package/{typed → dist}/utils/prop-utils.d.ts +0 -0
  358. /package/{typed → dist}/utils/prop-utils.d.ts.map +0 -0
  359. /package/{typed → dist}/utils/resource-utils.d.ts +0 -0
  360. /package/{typed → dist}/utils/resource-utils.d.ts.map +0 -0
  361. /package/{typed → dist}/utils/scale-utils.d.ts +0 -0
  362. /package/{typed → dist}/utils/scale-utils.d.ts.map +0 -0
@@ -1,626 +0,0 @@
1
- import { getBounds, boundsContain, packVertices, scaleToAspectRatio, getTextureCoordinates, getTextureParams } from './heatmap-layer-utils';
2
- import { GL } from '@luma.gl/constants';
3
- import { TextureTransform } from '@luma.gl/engine';
4
- import { withGLParameters } from '@luma.gl/webgl';
5
- import { AttributeManager, COORDINATE_SYSTEM, log } from '@deck.gl/core';
6
- import TriangleLayer from './triangle-layer';
7
- import AggregationLayer from '../aggregation-layer';
8
- import { defaultColorRange, colorRangeToFlatArray } from '../utils/color-utils';
9
- import weightsVs from './weights-vs.glsl';
10
- import weightsFs from './weights-fs.glsl';
11
- import vsMax from './max-vs.glsl';
12
- import fsMax from './max-fs.glsl';
13
- const RESOLUTION = 2;
14
- const TEXTURE_PROPS = {
15
- format: 'rgba8unorm',
16
- mipmaps: false,
17
- sampler: {
18
- minFilter: 'nearest',
19
- magFilter: 'nearest',
20
- addressModeU: 'clamp-to-edge',
21
- addressModeV: 'clamp-to-edge'
22
- }
23
- };
24
- const DEFAULT_COLOR_DOMAIN = [0, 0];
25
- const AGGREGATION_MODE = {
26
- SUM: 0,
27
- MEAN: 1
28
- };
29
- const defaultProps = {
30
- getPosition: {
31
- type: 'accessor',
32
- value: x => x.position
33
- },
34
- getWeight: {
35
- type: 'accessor',
36
- value: 1
37
- },
38
- intensity: {
39
- type: 'number',
40
- min: 0,
41
- value: 1
42
- },
43
- radiusPixels: {
44
- type: 'number',
45
- min: 1,
46
- max: 100,
47
- value: 50
48
- },
49
- colorRange: defaultColorRange,
50
- threshold: {
51
- type: 'number',
52
- min: 0,
53
- max: 1,
54
- value: 0.05
55
- },
56
- colorDomain: {
57
- type: 'array',
58
- value: null,
59
- optional: true
60
- },
61
- aggregation: 'SUM',
62
- weightsTextureSize: {
63
- type: 'number',
64
- min: 128,
65
- max: 2048,
66
- value: 2048
67
- },
68
- debounceTimeout: {
69
- type: 'number',
70
- min: 0,
71
- max: 1000,
72
- value: 500
73
- }
74
- };
75
- const REQUIRED_FEATURES = ['blend-minmax-webgl1', 'texture-formats-float32-webgl1'];
76
- const FLOAT_TARGET_FEATURES = ['texture-renderable-float32-webgl', 'texture-blend-float-webgl1'];
77
- const DIMENSIONS = {
78
- data: {
79
- props: ['radiusPixels']
80
- }
81
- };
82
- export default class HeatmapLayer extends AggregationLayer {
83
- constructor(...args) {
84
- super(...args);
85
- this.state = void 0;
86
- }
87
-
88
- initializeState() {
89
- if (!REQUIRED_FEATURES.every(feature => this.context.device.features.has(feature))) {
90
- this.setState({
91
- supported: false
92
- });
93
- log.error(`HeatmapLayer: ${this.id} is not supported on this browser`)();
94
- return;
95
- }
96
-
97
- super.initializeAggregationLayer(DIMENSIONS);
98
- this.setState({
99
- supported: true,
100
- colorDomain: DEFAULT_COLOR_DOMAIN
101
- });
102
-
103
- this._setupTextureParams();
104
-
105
- this._setupAttributes();
106
-
107
- this._setupResources();
108
- }
109
-
110
- shouldUpdateState({
111
- changeFlags
112
- }) {
113
- return changeFlags.somethingChanged;
114
- }
115
-
116
- updateState(opts) {
117
- if (!this.state.supported) {
118
- return;
119
- }
120
-
121
- super.updateState(opts);
122
-
123
- this._updateHeatmapState(opts);
124
- }
125
-
126
- _updateHeatmapState(opts) {
127
- const {
128
- props,
129
- oldProps
130
- } = opts;
131
-
132
- const changeFlags = this._getChangeFlags(opts);
133
-
134
- if (changeFlags.dataChanged || changeFlags.viewportChanged) {
135
- changeFlags.boundsChanged = this._updateBounds(changeFlags.dataChanged);
136
-
137
- this._updateTextureRenderingBounds();
138
- }
139
-
140
- if (changeFlags.dataChanged || changeFlags.boundsChanged) {
141
- clearTimeout(this.state.updateTimer);
142
- this.setState({
143
- isWeightMapDirty: true
144
- });
145
- } else if (changeFlags.viewportZoomChanged) {
146
- this._debouncedUpdateWeightmap();
147
- }
148
-
149
- if (props.colorRange !== oldProps.colorRange) {
150
- this._updateColorTexture(opts);
151
- }
152
-
153
- if (this.state.isWeightMapDirty) {
154
- this._updateWeightmap();
155
- }
156
-
157
- this.setState({
158
- zoom: opts.context.viewport.zoom
159
- });
160
- }
161
-
162
- renderLayers() {
163
- if (!this.state.supported) {
164
- return [];
165
- }
166
-
167
- const {
168
- weightsTexture,
169
- triPositionBuffer,
170
- triTexCoordBuffer,
171
- maxWeightsTexture,
172
- colorTexture,
173
- colorDomain
174
- } = this.state;
175
- const {
176
- updateTriggers,
177
- intensity,
178
- threshold,
179
- aggregation
180
- } = this.props;
181
- const TriangleLayerClass = this.getSubLayerClass('triangle', TriangleLayer);
182
- return new TriangleLayerClass(this.getSubLayerProps({
183
- id: 'triangle-layer',
184
- updateTriggers
185
- }), {
186
- coordinateSystem: COORDINATE_SYSTEM.DEFAULT,
187
- data: {
188
- attributes: {
189
- positions: triPositionBuffer,
190
- texCoords: triTexCoordBuffer
191
- }
192
- },
193
- vertexCount: 4,
194
- maxTexture: maxWeightsTexture,
195
- colorTexture,
196
- aggregationMode: AGGREGATION_MODE[aggregation] || 0,
197
- texture: weightsTexture,
198
- intensity,
199
- threshold,
200
- colorDomain
201
- });
202
- }
203
-
204
- finalizeState(context) {
205
- super.finalizeState(context);
206
- const {
207
- weightsTransform,
208
- weightsTexture,
209
- maxWeightTransform,
210
- maxWeightsTexture,
211
- triPositionBuffer,
212
- triTexCoordBuffer,
213
- colorTexture,
214
- updateTimer
215
- } = this.state;
216
- weightsTransform === null || weightsTransform === void 0 ? void 0 : weightsTransform.destroy();
217
- weightsTexture === null || weightsTexture === void 0 ? void 0 : weightsTexture.destroy();
218
- maxWeightTransform === null || maxWeightTransform === void 0 ? void 0 : maxWeightTransform.destroy();
219
- maxWeightsTexture === null || maxWeightsTexture === void 0 ? void 0 : maxWeightsTexture.destroy();
220
- triPositionBuffer === null || triPositionBuffer === void 0 ? void 0 : triPositionBuffer.destroy();
221
- triTexCoordBuffer === null || triTexCoordBuffer === void 0 ? void 0 : triTexCoordBuffer.destroy();
222
- colorTexture === null || colorTexture === void 0 ? void 0 : colorTexture.destroy();
223
-
224
- if (updateTimer) {
225
- clearTimeout(updateTimer);
226
- }
227
- }
228
-
229
- _getAttributeManager() {
230
- return new AttributeManager(this.context.device, {
231
- id: this.props.id,
232
- stats: this.context.stats
233
- });
234
- }
235
-
236
- _getChangeFlags(opts) {
237
- const changeFlags = {};
238
- const {
239
- dimensions
240
- } = this.state;
241
- changeFlags.dataChanged = this.isAttributeChanged() && 'attribute changed' || this.isAggregationDirty(opts, {
242
- compareAll: true,
243
- dimension: dimensions.data
244
- }) && 'aggregation is dirty';
245
- changeFlags.viewportChanged = opts.changeFlags.viewportChanged;
246
- const {
247
- zoom
248
- } = this.state;
249
-
250
- if (!opts.context.viewport || opts.context.viewport.zoom !== zoom) {
251
- changeFlags.viewportZoomChanged = true;
252
- }
253
-
254
- return changeFlags;
255
- }
256
-
257
- _createTextures() {
258
- const {
259
- textureSize,
260
- format,
261
- type
262
- } = this.state;
263
- this.setState({
264
- weightsTexture: this.context.device.createTexture({
265
- width: textureSize,
266
- height: textureSize,
267
- format,
268
- type,
269
- ...TEXTURE_PROPS
270
- }),
271
- maxWeightsTexture: this.context.device.createTexture({
272
- format,
273
- type,
274
- ...TEXTURE_PROPS
275
- })
276
- });
277
- }
278
-
279
- _setupAttributes() {
280
- const attributeManager = this.getAttributeManager();
281
- attributeManager.add({
282
- positions: {
283
- size: 3,
284
- type: 5130,
285
- accessor: 'getPosition'
286
- },
287
- weights: {
288
- size: 1,
289
- accessor: 'getWeight'
290
- }
291
- });
292
- this.setState({
293
- positionAttributeName: 'positions'
294
- });
295
- }
296
-
297
- _setupTextureParams() {
298
- const {
299
- device
300
- } = this.context;
301
- const {
302
- weightsTextureSize
303
- } = this.props;
304
- const textureSize = Math.min(weightsTextureSize, device.limits.maxTextureDimension2D);
305
- const floatTargetSupport = FLOAT_TARGET_FEATURES.every(feature => device.features.has(feature));
306
- const {
307
- format,
308
- type
309
- } = getTextureParams({
310
- device,
311
- floatTargetSupport
312
- });
313
- const weightsScale = floatTargetSupport ? 1 : 1 / 255;
314
- this.setState({
315
- textureSize,
316
- format,
317
- type,
318
- weightsScale
319
- });
320
-
321
- if (!floatTargetSupport) {
322
- log.warn(`HeatmapLayer: ${this.id} rendering to float texture not supported, fallingback to low precession format`)();
323
- }
324
- }
325
-
326
- getShaders(type) {
327
- return super.getShaders(type === 'max-weights-transform' ? {
328
- vs: vsMax,
329
- _fs: fsMax
330
- } : {
331
- vs: weightsVs,
332
- _fs: weightsFs
333
- });
334
- }
335
-
336
- _createWeightsTransform(shaders = {}) {
337
- var _weightsTransform;
338
-
339
- let {
340
- weightsTransform
341
- } = this.state;
342
- (_weightsTransform = weightsTransform) === null || _weightsTransform === void 0 ? void 0 : _weightsTransform.delete();
343
- weightsTransform = new TextureTransform(this.context.device, {
344
- id: `${this.id}-weights-transform`,
345
- vertexCount: 1,
346
- targetTexture: this.state.weightsTexture,
347
- targetTextureVarying: 'weightsTexture',
348
- ...shaders
349
- });
350
- this.setState({
351
- weightsTransform
352
- });
353
- }
354
-
355
- _setupResources() {
356
- this._createTextures();
357
-
358
- const {
359
- textureSize,
360
- weightsTexture,
361
- maxWeightsTexture
362
- } = this.state;
363
- const weightsTransformShaders = this.getShaders('weights-transform');
364
-
365
- this._createWeightsTransform(weightsTransformShaders);
366
-
367
- const maxWeightsTransformShaders = this.getShaders('max-weights-transform');
368
- const maxWeightTransform = new TextureTransform(this.context.device, {
369
- id: `${this.id}-max-weights-transform`,
370
- _sourceTextures: {
371
- inTexture: weightsTexture
372
- },
373
- _targetTexture: maxWeightsTexture,
374
- _targetTextureVarying: 'outTexture',
375
- ...maxWeightsTransformShaders,
376
- elementCount: textureSize * textureSize
377
- });
378
- this.setState({
379
- weightsTexture,
380
- maxWeightsTexture,
381
- maxWeightTransform,
382
- zoom: null,
383
- triPositionBuffer: this.context.device.createBuffer({
384
- byteLength: 48,
385
- accessor: {
386
- size: 3
387
- }
388
- }),
389
- triTexCoordBuffer: this.context.device.createBuffer({
390
- byteLength: 48,
391
- accessor: {
392
- size: 2
393
- }
394
- })
395
- });
396
- }
397
-
398
- updateShaders(shaderOptions) {
399
- this._createWeightsTransform(shaderOptions);
400
- }
401
-
402
- _updateMaxWeightValue() {
403
- const {
404
- maxWeightTransform
405
- } = this.state;
406
- maxWeightTransform.run({
407
- parameters: {
408
- blend: true,
409
- depthTest: false,
410
- blendFunc: [1, 1],
411
- blendEquation: 32776
412
- }
413
- });
414
- }
415
-
416
- _updateBounds(forceUpdate = false) {
417
- const {
418
- viewport
419
- } = this.context;
420
- const viewportCorners = [viewport.unproject([0, 0]), viewport.unproject([viewport.width, 0]), viewport.unproject([viewport.width, viewport.height]), viewport.unproject([0, viewport.height])].map(p => p.map(Math.fround));
421
- const visibleWorldBounds = getBounds(viewportCorners);
422
- const newState = {
423
- visibleWorldBounds,
424
- viewportCorners
425
- };
426
- let boundsChanged = false;
427
-
428
- if (forceUpdate || !this.state.worldBounds || !boundsContain(this.state.worldBounds, visibleWorldBounds)) {
429
- const scaledCommonBounds = this._worldToCommonBounds(visibleWorldBounds);
430
-
431
- const worldBounds = this._commonToWorldBounds(scaledCommonBounds);
432
-
433
- if (this.props.coordinateSystem === COORDINATE_SYSTEM.LNGLAT) {
434
- worldBounds[1] = Math.max(worldBounds[1], -85.051129);
435
- worldBounds[3] = Math.min(worldBounds[3], 85.051129);
436
- worldBounds[0] = Math.max(worldBounds[0], -360);
437
- worldBounds[2] = Math.min(worldBounds[2], 360);
438
- }
439
-
440
- const normalizedCommonBounds = this._worldToCommonBounds(worldBounds);
441
-
442
- newState.worldBounds = worldBounds;
443
- newState.normalizedCommonBounds = normalizedCommonBounds;
444
- boundsChanged = true;
445
- }
446
-
447
- this.setState(newState);
448
- return boundsChanged;
449
- }
450
-
451
- _updateTextureRenderingBounds() {
452
- const {
453
- triPositionBuffer,
454
- triTexCoordBuffer,
455
- normalizedCommonBounds,
456
- viewportCorners
457
- } = this.state;
458
- const {
459
- viewport
460
- } = this.context;
461
- triPositionBuffer.write(packVertices(viewportCorners, 3));
462
- const textureBounds = viewportCorners.map(p => getTextureCoordinates(viewport.projectPosition(p), normalizedCommonBounds));
463
- triTexCoordBuffer.write(packVertices(textureBounds, 2));
464
- }
465
-
466
- _updateColorTexture(opts) {
467
- const {
468
- colorRange
469
- } = opts.props;
470
- let {
471
- colorTexture
472
- } = this.state;
473
- const colors = colorRangeToFlatArray(colorRange, false, Uint8Array);
474
-
475
- if (colorTexture) {
476
- colorTexture.setImageData({
477
- data: colors,
478
- width: colorRange.length
479
- });
480
- } else {
481
- colorTexture = this.context.device.createTexture({
482
- data: colors,
483
- width: colorRange.length,
484
- height: 1,
485
- ...TEXTURE_PROPS
486
- });
487
- }
488
-
489
- this.setState({
490
- colorTexture
491
- });
492
- }
493
-
494
- _updateWeightmap() {
495
- const {
496
- radiusPixels,
497
- colorDomain,
498
- aggregation
499
- } = this.props;
500
- const {
501
- worldBounds,
502
- textureSize,
503
- weightsScale
504
- } = this.state;
505
- const weightsTransform = this.state.weightsTransform;
506
- this.state.isWeightMapDirty = false;
507
-
508
- const commonBounds = this._worldToCommonBounds(worldBounds, {
509
- useLayerCoordinateSystem: true
510
- });
511
-
512
- if (colorDomain && aggregation === 'SUM') {
513
- const {
514
- viewport
515
- } = this.context;
516
- const metersPerPixel = viewport.distanceScales.metersPerUnit[2] * (commonBounds[2] - commonBounds[0]) / textureSize;
517
- this.state.colorDomain = colorDomain.map(x => x * metersPerPixel * weightsScale);
518
- } else {
519
- this.state.colorDomain = colorDomain || DEFAULT_COLOR_DOMAIN;
520
- }
521
-
522
- const uniforms = {
523
- radiusPixels,
524
- commonBounds,
525
- textureWidth: textureSize,
526
- weightsScale
527
- };
528
- weightsTransform.update({
529
- elementCount: this.getNumInstances()
530
- });
531
- withGLParameters(this.context.gl, {
532
- clearColor: [0, 0, 0, 0]
533
- }, () => {
534
- weightsTransform.run({
535
- uniforms,
536
- parameters: {
537
- blend: true,
538
- depthTest: false,
539
- blendFunc: [1, 1],
540
- blendEquation: 32774
541
- },
542
- clearRenderTarget: true,
543
- attributes: this.getAttributes(),
544
- moduleSettings: this.getModuleSettings()
545
- });
546
- });
547
-
548
- this._updateMaxWeightValue();
549
- }
550
-
551
- _debouncedUpdateWeightmap(fromTimer = false) {
552
- let {
553
- updateTimer
554
- } = this.state;
555
- const {
556
- debounceTimeout
557
- } = this.props;
558
-
559
- if (fromTimer) {
560
- updateTimer = null;
561
-
562
- this._updateBounds(true);
563
-
564
- this._updateTextureRenderingBounds();
565
-
566
- this.setState({
567
- isWeightMapDirty: true
568
- });
569
- } else {
570
- this.setState({
571
- isWeightMapDirty: false
572
- });
573
- clearTimeout(updateTimer);
574
- updateTimer = setTimeout(this._debouncedUpdateWeightmap.bind(this, true), debounceTimeout);
575
- }
576
-
577
- this.setState({
578
- updateTimer
579
- });
580
- }
581
-
582
- _worldToCommonBounds(worldBounds, opts = {}) {
583
- const {
584
- useLayerCoordinateSystem = false
585
- } = opts;
586
- const [minLong, minLat, maxLong, maxLat] = worldBounds;
587
- const {
588
- viewport
589
- } = this.context;
590
- const {
591
- textureSize
592
- } = this.state;
593
- const {
594
- coordinateSystem
595
- } = this.props;
596
- const offsetMode = useLayerCoordinateSystem && (coordinateSystem === COORDINATE_SYSTEM.LNGLAT_OFFSETS || coordinateSystem === COORDINATE_SYSTEM.METER_OFFSETS);
597
- const offsetOriginCommon = offsetMode ? viewport.projectPosition(this.props.coordinateOrigin) : [0, 0];
598
- const size = textureSize * RESOLUTION / viewport.scale;
599
- let bottomLeftCommon;
600
- let topRightCommon;
601
-
602
- if (useLayerCoordinateSystem && !offsetMode) {
603
- bottomLeftCommon = this.projectPosition([minLong, minLat, 0]);
604
- topRightCommon = this.projectPosition([maxLong, maxLat, 0]);
605
- } else {
606
- bottomLeftCommon = viewport.projectPosition([minLong, minLat, 0]);
607
- topRightCommon = viewport.projectPosition([maxLong, maxLat, 0]);
608
- }
609
-
610
- return scaleToAspectRatio([bottomLeftCommon[0] - offsetOriginCommon[0], bottomLeftCommon[1] - offsetOriginCommon[1], topRightCommon[0] - offsetOriginCommon[0], topRightCommon[1] - offsetOriginCommon[1]], size, size);
611
- }
612
-
613
- _commonToWorldBounds(commonBounds) {
614
- const [xMin, yMin, xMax, yMax] = commonBounds;
615
- const {
616
- viewport
617
- } = this.context;
618
- const bottomLeftWorld = viewport.unprojectPosition([xMin, yMin]);
619
- const topRightWorld = viewport.unprojectPosition([xMax, yMax]);
620
- return bottomLeftWorld.slice(0, 2).concat(topRightWorld.slice(0, 2));
621
- }
622
-
623
- }
624
- HeatmapLayer.layerName = 'HeatmapLayer';
625
- HeatmapLayer.defaultProps = defaultProps;
626
- //# sourceMappingURL=heatmap-layer.js.map