@deck.gl/aggregation-layers 9.0.40 → 9.1.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 (372) hide show
  1. package/dist/common/aggregation-layer.d.ts +30 -0
  2. package/dist/common/aggregation-layer.d.ts.map +1 -0
  3. package/dist/common/aggregation-layer.js +70 -0
  4. package/dist/common/aggregation-layer.js.map +1 -0
  5. package/dist/common/aggregator/aggregator.d.ts +76 -0
  6. package/dist/common/aggregator/aggregator.d.ts.map +1 -0
  7. package/dist/common/aggregator/aggregator.js +5 -0
  8. package/dist/common/aggregator/aggregator.js.map +1 -0
  9. package/dist/common/aggregator/cpu-aggregator/aggregate.d.ts +27 -0
  10. package/dist/common/aggregator/cpu-aggregator/aggregate.d.ts.map +1 -0
  11. package/dist/common/aggregator/cpu-aggregator/aggregate.js +67 -0
  12. package/dist/common/aggregator/cpu-aggregator/aggregate.js.map +1 -0
  13. package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.d.ts +70 -0
  14. package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.d.ts.map +1 -0
  15. package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.js +140 -0
  16. package/dist/common/aggregator/cpu-aggregator/cpu-aggregator.js.map +1 -0
  17. package/dist/common/aggregator/cpu-aggregator/sort-bins.d.ts +15 -0
  18. package/dist/common/aggregator/cpu-aggregator/sort-bins.d.ts.map +1 -0
  19. package/dist/common/aggregator/cpu-aggregator/sort-bins.js +44 -0
  20. package/dist/common/aggregator/cpu-aggregator/sort-bins.js.map +1 -0
  21. package/dist/common/aggregator/cpu-aggregator/vertex-accessor.d.ts +21 -0
  22. package/dist/common/aggregator/cpu-aggregator/vertex-accessor.d.ts.map +1 -0
  23. package/dist/common/aggregator/cpu-aggregator/vertex-accessor.js +56 -0
  24. package/dist/common/aggregator/cpu-aggregator/vertex-accessor.js.map +1 -0
  25. package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.d.ts +18 -0
  26. package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.d.ts.map +1 -0
  27. package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.js +21 -0
  28. package/dist/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.js.map +1 -0
  29. package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.d.ts +14 -0
  30. package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.d.ts.map +1 -0
  31. package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.js +18 -0
  32. package/dist/common/aggregator/gpu-aggregator/bin-sorter-uniforms.js.map +1 -0
  33. package/dist/common/aggregator/gpu-aggregator/utils.d.ts +6 -0
  34. package/dist/common/aggregator/gpu-aggregator/utils.d.ts.map +1 -0
  35. package/dist/common/aggregator/gpu-aggregator/utils.js +25 -0
  36. package/dist/common/aggregator/gpu-aggregator/utils.js.map +1 -0
  37. package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.d.ts +24 -0
  38. package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.d.ts.map +1 -0
  39. package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.js +216 -0
  40. package/dist/common/aggregator/gpu-aggregator/webgl-aggregation-transform.js.map +1 -0
  41. package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.d.ts +81 -0
  42. package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.d.ts.map +1 -0
  43. package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.js +202 -0
  44. package/dist/common/aggregator/gpu-aggregator/webgl-aggregator.js.map +1 -0
  45. package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.d.ts +38 -0
  46. package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.d.ts.map +1 -0
  47. package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.js +224 -0
  48. package/dist/common/aggregator/gpu-aggregator/webgl-bin-sorter.js.map +1 -0
  49. package/dist/common/aggregator/index.d.ts +6 -0
  50. package/dist/common/aggregator/index.d.ts.map +1 -0
  51. package/dist/common/aggregator/index.js +6 -0
  52. package/dist/common/aggregator/index.js.map +1 -0
  53. package/dist/common/types.d.ts +11 -0
  54. package/dist/common/types.d.ts.map +1 -0
  55. package/dist/common/types.js +5 -0
  56. package/dist/common/types.js.map +1 -0
  57. package/dist/common/utils/bounds-utils.d.ts +10 -0
  58. package/dist/common/utils/bounds-utils.d.ts.map +1 -0
  59. package/dist/common/utils/bounds-utils.js +21 -0
  60. package/dist/common/utils/bounds-utils.js.map +1 -0
  61. package/dist/common/utils/color-utils.d.ts +10 -0
  62. package/dist/common/utils/color-utils.d.ts.map +1 -0
  63. package/dist/common/utils/color-utils.js +66 -0
  64. package/dist/common/utils/color-utils.js.map +1 -0
  65. package/dist/common/utils/prop-utils.d.ts.map +1 -0
  66. package/dist/common/utils/prop-utils.js +13 -0
  67. package/dist/common/utils/prop-utils.js.map +1 -0
  68. package/dist/common/utils/scale-utils.d.ts +46 -0
  69. package/dist/common/utils/scale-utils.d.ts.map +1 -0
  70. package/dist/common/utils/scale-utils.js +181 -0
  71. package/dist/common/utils/scale-utils.js.map +1 -0
  72. package/dist/contour-layer/bin-options-uniforms.d.ts +13 -0
  73. package/dist/contour-layer/bin-options-uniforms.d.ts.map +1 -0
  74. package/dist/contour-layer/bin-options-uniforms.js +18 -0
  75. package/dist/contour-layer/bin-options-uniforms.js.map +1 -0
  76. package/dist/contour-layer/contour-layer.d.ts +42 -50
  77. package/dist/contour-layer/contour-layer.d.ts.map +1 -1
  78. package/dist/contour-layer/contour-layer.js +233 -192
  79. package/dist/contour-layer/contour-layer.js.map +1 -0
  80. package/dist/contour-layer/contour-utils.d.ts +36 -15
  81. package/dist/contour-layer/contour-utils.d.ts.map +1 -1
  82. package/dist/contour-layer/contour-utils.js +25 -29
  83. package/dist/contour-layer/contour-utils.js.map +1 -0
  84. package/dist/contour-layer/marching-squares-codes.d.ts.map +1 -1
  85. package/dist/contour-layer/marching-squares-codes.js +4 -0
  86. package/dist/contour-layer/marching-squares-codes.js.map +1 -0
  87. package/dist/contour-layer/marching-squares.d.ts +22 -6
  88. package/dist/contour-layer/marching-squares.d.ts.map +1 -1
  89. package/dist/contour-layer/marching-squares.js +72 -68
  90. package/dist/contour-layer/marching-squares.js.map +1 -0
  91. package/dist/contour-layer/value-reader.d.ts +10 -0
  92. package/dist/contour-layer/value-reader.d.ts.map +1 -0
  93. package/dist/contour-layer/value-reader.js +47 -0
  94. package/dist/contour-layer/value-reader.js.map +1 -0
  95. package/dist/dist.dev.js +4844 -4083
  96. package/dist/grid-layer/bin-options-uniforms.d.ts +13 -0
  97. package/dist/grid-layer/bin-options-uniforms.d.ts.map +1 -0
  98. package/dist/grid-layer/bin-options-uniforms.js +18 -0
  99. package/dist/grid-layer/bin-options-uniforms.js.map +1 -0
  100. package/dist/grid-layer/grid-cell-layer-vertex.glsl.d.ts +3 -0
  101. package/dist/grid-layer/grid-cell-layer-vertex.glsl.d.ts.map +1 -0
  102. package/dist/grid-layer/grid-cell-layer-vertex.glsl.js +52 -0
  103. package/dist/grid-layer/grid-cell-layer-vertex.glsl.js.map +1 -0
  104. package/dist/grid-layer/grid-cell-layer.d.ts +32 -0
  105. package/dist/grid-layer/grid-cell-layer.d.ts.map +1 -0
  106. package/dist/grid-layer/grid-cell-layer.js +94 -0
  107. package/dist/grid-layer/grid-cell-layer.js.map +1 -0
  108. package/dist/grid-layer/grid-layer-uniforms.d.ts +21 -0
  109. package/dist/grid-layer/grid-layer-uniforms.d.ts.map +1 -0
  110. package/dist/grid-layer/grid-layer-uniforms.js +24 -0
  111. package/dist/grid-layer/grid-layer-uniforms.js.map +1 -0
  112. package/dist/grid-layer/grid-layer.d.ts +176 -14
  113. package/dist/grid-layer/grid-layer.d.ts.map +1 -1
  114. package/dist/grid-layer/grid-layer.js +343 -46
  115. package/dist/grid-layer/grid-layer.js.map +1 -0
  116. package/dist/{aggregation-layer.d.ts → heatmap-layer/aggregation-layer.d.ts} +1 -0
  117. package/dist/heatmap-layer/aggregation-layer.d.ts.map +1 -0
  118. package/dist/{aggregation-layer.js → heatmap-layer/aggregation-layer.js} +7 -21
  119. package/dist/heatmap-layer/aggregation-layer.js.map +1 -0
  120. package/dist/heatmap-layer/heatmap-layer-uniforms.d.ts +30 -0
  121. package/dist/heatmap-layer/heatmap-layer-uniforms.d.ts.map +1 -0
  122. package/dist/heatmap-layer/heatmap-layer-uniforms.js +33 -0
  123. package/dist/heatmap-layer/heatmap-layer-uniforms.js.map +1 -0
  124. package/dist/heatmap-layer/heatmap-layer-utils.d.ts +1 -1
  125. package/dist/heatmap-layer/heatmap-layer-utils.d.ts.map +1 -1
  126. package/dist/heatmap-layer/heatmap-layer-utils.js +4 -0
  127. package/dist/heatmap-layer/heatmap-layer-utils.js.map +1 -0
  128. package/dist/heatmap-layer/heatmap-layer.d.ts +6 -4
  129. package/dist/heatmap-layer/heatmap-layer.d.ts.map +1 -1
  130. package/dist/heatmap-layer/heatmap-layer.js +44 -33
  131. package/dist/heatmap-layer/heatmap-layer.js.map +1 -0
  132. package/dist/heatmap-layer/max-fs.glsl.d.ts.map +1 -1
  133. package/dist/heatmap-layer/max-fs.glsl.js +4 -0
  134. package/dist/heatmap-layer/max-fs.glsl.js.map +1 -0
  135. package/dist/heatmap-layer/max-vs.glsl.d.ts +1 -1
  136. package/dist/heatmap-layer/max-vs.glsl.d.ts.map +1 -1
  137. package/dist/heatmap-layer/max-vs.glsl.js +7 -4
  138. package/dist/heatmap-layer/max-vs.glsl.js.map +1 -0
  139. package/dist/heatmap-layer/triangle-layer-fragment.glsl.d.ts +1 -1
  140. package/dist/heatmap-layer/triangle-layer-fragment.glsl.d.ts.map +1 -1
  141. package/dist/heatmap-layer/triangle-layer-fragment.glsl.js +6 -23
  142. package/dist/heatmap-layer/triangle-layer-fragment.glsl.js.map +1 -0
  143. package/dist/heatmap-layer/triangle-layer-uniforms.d.ts +22 -0
  144. package/dist/heatmap-layer/triangle-layer-uniforms.d.ts.map +1 -0
  145. package/dist/heatmap-layer/triangle-layer-uniforms.js +23 -0
  146. package/dist/heatmap-layer/triangle-layer-uniforms.js.map +1 -0
  147. package/dist/heatmap-layer/triangle-layer-vertex.glsl.d.ts +1 -1
  148. package/dist/heatmap-layer/triangle-layer-vertex.glsl.d.ts.map +1 -1
  149. package/dist/heatmap-layer/triangle-layer-vertex.glsl.js +11 -30
  150. package/dist/heatmap-layer/triangle-layer-vertex.glsl.js.map +1 -0
  151. package/dist/heatmap-layer/triangle-layer.d.ts +4 -10
  152. package/dist/heatmap-layer/triangle-layer.d.ts.map +1 -1
  153. package/dist/heatmap-layer/triangle-layer.js +18 -30
  154. package/dist/heatmap-layer/triangle-layer.js.map +1 -0
  155. package/dist/heatmap-layer/weights-fs.glsl.d.ts.map +1 -1
  156. package/dist/heatmap-layer/weights-fs.glsl.js +4 -0
  157. package/dist/heatmap-layer/weights-fs.glsl.js.map +1 -0
  158. package/dist/heatmap-layer/weights-vs.glsl.d.ts +1 -1
  159. package/dist/heatmap-layer/weights-vs.glsl.d.ts.map +1 -1
  160. package/dist/heatmap-layer/weights-vs.glsl.js +7 -7
  161. package/dist/heatmap-layer/weights-vs.glsl.js.map +1 -0
  162. package/dist/hexagon-layer/bin-options-uniforms.d.ts +14 -0
  163. package/dist/hexagon-layer/bin-options-uniforms.d.ts.map +1 -0
  164. package/dist/hexagon-layer/bin-options-uniforms.js +18 -0
  165. package/dist/hexagon-layer/bin-options-uniforms.js.map +1 -0
  166. package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.d.ts +3 -0
  167. package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.d.ts.map +1 -0
  168. package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.js +56 -0
  169. package/dist/hexagon-layer/hexagon-cell-layer-vertex.glsl.js.map +1 -0
  170. package/dist/hexagon-layer/hexagon-cell-layer.d.ts +29 -0
  171. package/dist/hexagon-layer/hexagon-cell-layer.d.ts.map +1 -0
  172. package/dist/hexagon-layer/hexagon-cell-layer.js +95 -0
  173. package/dist/hexagon-layer/hexagon-cell-layer.js.map +1 -0
  174. package/dist/hexagon-layer/hexagon-layer-uniforms.d.ts +19 -0
  175. package/dist/hexagon-layer/hexagon-layer-uniforms.d.ts.map +1 -0
  176. package/dist/hexagon-layer/hexagon-layer-uniforms.js +22 -0
  177. package/dist/hexagon-layer/hexagon-layer-uniforms.js.map +1 -0
  178. package/dist/hexagon-layer/hexagon-layer.d.ts +84 -54
  179. package/dist/hexagon-layer/hexagon-layer.d.ts.map +1 -1
  180. package/dist/hexagon-layer/hexagon-layer.js +308 -123
  181. package/dist/hexagon-layer/hexagon-layer.js.map +1 -0
  182. package/dist/hexagon-layer/hexbin.d.ts +17 -0
  183. package/dist/hexagon-layer/hexbin.d.ts.map +1 -0
  184. package/dist/hexagon-layer/hexbin.js +70 -0
  185. package/dist/hexagon-layer/hexbin.js.map +1 -0
  186. package/dist/index.cjs +3026 -2947
  187. package/dist/index.cjs.map +4 -4
  188. package/dist/index.d.ts +7 -13
  189. package/dist/index.d.ts.map +1 -1
  190. package/dist/index.js +6 -27
  191. package/dist/index.js.map +1 -0
  192. package/dist/screen-grid-layer/bin-options-uniforms.d.ts +11 -0
  193. package/dist/screen-grid-layer/bin-options-uniforms.d.ts.map +1 -0
  194. package/dist/screen-grid-layer/bin-options-uniforms.js +16 -0
  195. package/dist/screen-grid-layer/bin-options-uniforms.js.map +1 -0
  196. package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts +11 -16
  197. package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts.map +1 -1
  198. package/dist/screen-grid-layer/screen-grid-cell-layer.js +53 -134
  199. package/dist/screen-grid-layer/screen-grid-cell-layer.js.map +1 -0
  200. package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts +1 -1
  201. package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts.map +1 -1
  202. package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.js +5 -24
  203. package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.js.map +1 -0
  204. package/dist/screen-grid-layer/screen-grid-layer-uniforms.d.ts +17 -0
  205. package/dist/screen-grid-layer/screen-grid-layer-uniforms.d.ts.map +1 -0
  206. package/dist/screen-grid-layer/screen-grid-layer-uniforms.js +20 -0
  207. package/dist/screen-grid-layer/screen-grid-layer-uniforms.js.map +1 -0
  208. package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts +1 -1
  209. package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts.map +1 -1
  210. package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.js +22 -62
  211. package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.js.map +1 -0
  212. package/dist/screen-grid-layer/screen-grid-layer.d.ts +33 -40
  213. package/dist/screen-grid-layer/screen-grid-layer.d.ts.map +1 -1
  214. package/dist/screen-grid-layer/screen-grid-layer.js +158 -174
  215. package/dist/screen-grid-layer/screen-grid-layer.js.map +1 -0
  216. package/dist.min.js +401 -382
  217. package/package.json +10 -9
  218. package/src/common/aggregation-layer.ts +107 -0
  219. package/src/common/aggregator/aggregator.ts +88 -0
  220. package/src/common/aggregator/cpu-aggregator/aggregate.ts +101 -0
  221. package/src/common/aggregator/cpu-aggregator/cpu-aggregator.ts +203 -0
  222. package/src/common/aggregator/cpu-aggregator/sort-bins.ts +63 -0
  223. package/src/common/aggregator/cpu-aggregator/vertex-accessor.ts +86 -0
  224. package/src/common/aggregator/gpu-aggregator/aggregation-transform-uniforms.ts +33 -0
  225. package/src/common/aggregator/gpu-aggregator/bin-sorter-uniforms.ts +27 -0
  226. package/src/common/aggregator/gpu-aggregator/utils.ts +27 -0
  227. package/src/common/aggregator/gpu-aggregator/webgl-aggregation-transform.ts +247 -0
  228. package/src/common/aggregator/gpu-aggregator/webgl-aggregator.ts +274 -0
  229. package/src/common/aggregator/gpu-aggregator/webgl-bin-sorter.ts +258 -0
  230. package/src/common/aggregator/index.ts +10 -0
  231. package/src/{types.ts → common/types.ts} +10 -4
  232. package/src/common/utils/bounds-utils.ts +34 -0
  233. package/src/common/utils/color-utils.ts +86 -0
  234. package/src/common/utils/prop-utils.ts +13 -0
  235. package/src/common/utils/scale-utils.ts +236 -0
  236. package/src/contour-layer/bin-options-uniforms.ts +26 -0
  237. package/src/contour-layer/contour-layer.ts +300 -265
  238. package/src/contour-layer/contour-utils.ts +68 -39
  239. package/src/contour-layer/marching-squares-codes.ts +4 -0
  240. package/src/contour-layer/marching-squares.ts +93 -82
  241. package/src/contour-layer/value-reader.ts +65 -0
  242. package/src/grid-layer/bin-options-uniforms.ts +26 -0
  243. package/src/grid-layer/grid-cell-layer-vertex.glsl.ts +68 -0
  244. package/src/grid-layer/grid-cell-layer.ts +141 -0
  245. package/src/grid-layer/grid-layer-uniforms.ts +37 -0
  246. package/src/grid-layer/grid-layer.ts +614 -73
  247. package/src/{aggregation-layer.ts → heatmap-layer/aggregation-layer.ts} +6 -21
  248. package/src/heatmap-layer/heatmap-layer-uniforms.ts +50 -0
  249. package/src/heatmap-layer/heatmap-layer-utils.ts +9 -1
  250. package/src/heatmap-layer/heatmap-layer.ts +59 -36
  251. package/src/heatmap-layer/max-fs.glsl.ts +4 -0
  252. package/src/heatmap-layer/max-vs.glsl.ts +7 -4
  253. package/src/heatmap-layer/triangle-layer-fragment.glsl.ts +5 -23
  254. package/src/heatmap-layer/triangle-layer-uniforms.ts +37 -0
  255. package/src/heatmap-layer/triangle-layer-vertex.glsl.ts +10 -30
  256. package/src/heatmap-layer/triangle-layer.ts +26 -31
  257. package/src/heatmap-layer/weights-fs.glsl.ts +4 -0
  258. package/src/heatmap-layer/weights-vs.glsl.ts +7 -7
  259. package/src/hexagon-layer/bin-options-uniforms.ts +27 -0
  260. package/src/hexagon-layer/hexagon-cell-layer-vertex.glsl.ts +73 -0
  261. package/src/hexagon-layer/hexagon-cell-layer.ts +141 -0
  262. package/src/hexagon-layer/hexagon-layer-uniforms.ts +34 -0
  263. package/src/hexagon-layer/hexagon-layer.ts +454 -186
  264. package/src/hexagon-layer/hexbin.ts +79 -0
  265. package/src/index.ts +21 -34
  266. package/src/screen-grid-layer/bin-options-uniforms.ts +23 -0
  267. package/src/screen-grid-layer/screen-grid-cell-layer.ts +71 -156
  268. package/src/screen-grid-layer/screen-grid-layer-fragment.glsl.ts +4 -24
  269. package/src/screen-grid-layer/screen-grid-layer-uniforms.ts +31 -0
  270. package/src/screen-grid-layer/screen-grid-layer-vertex.glsl.ts +21 -64
  271. package/src/screen-grid-layer/screen-grid-layer.ts +194 -222
  272. package/dist/aggregation-layer.d.ts.map +0 -1
  273. package/dist/cpu-grid-layer/cpu-grid-layer.d.ts +0 -158
  274. package/dist/cpu-grid-layer/cpu-grid-layer.d.ts.map +0 -1
  275. package/dist/cpu-grid-layer/cpu-grid-layer.js +0 -130
  276. package/dist/cpu-grid-layer/grid-aggregator.d.ts +0 -35
  277. package/dist/cpu-grid-layer/grid-aggregator.d.ts.map +0 -1
  278. package/dist/cpu-grid-layer/grid-aggregator.js +0 -141
  279. package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts +0 -3
  280. package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts.map +0 -1
  281. package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +0 -30
  282. package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts +0 -3
  283. package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts.map +0 -1
  284. package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +0 -112
  285. package/dist/gpu-grid-layer/gpu-grid-cell-layer.d.ts +0 -48
  286. package/dist/gpu-grid-layer/gpu-grid-cell-layer.d.ts.map +0 -1
  287. package/dist/gpu-grid-layer/gpu-grid-cell-layer.js +0 -146
  288. package/dist/gpu-grid-layer/gpu-grid-layer.d.ts +0 -99
  289. package/dist/gpu-grid-layer/gpu-grid-layer.d.ts.map +0 -1
  290. package/dist/gpu-grid-layer/gpu-grid-layer.js +0 -289
  291. package/dist/grid-aggregation-layer.d.ts +0 -67
  292. package/dist/grid-aggregation-layer.d.ts.map +0 -1
  293. package/dist/grid-aggregation-layer.js +0 -173
  294. package/dist/hexagon-layer/hexagon-aggregator.d.ts +0 -27
  295. package/dist/hexagon-layer/hexagon-aggregator.d.ts.map +0 -1
  296. package/dist/hexagon-layer/hexagon-aggregator.js +0 -112
  297. package/dist/types.d.ts +0 -12
  298. package/dist/types.d.ts.map +0 -1
  299. package/dist/types.js +0 -1
  300. package/dist/utils/aggregation-operation-utils.d.ts +0 -19
  301. package/dist/utils/aggregation-operation-utils.d.ts.map +0 -1
  302. package/dist/utils/aggregation-operation-utils.js +0 -94
  303. package/dist/utils/bin-sorter.d.ts +0 -52
  304. package/dist/utils/bin-sorter.d.ts.map +0 -1
  305. package/dist/utils/bin-sorter.js +0 -167
  306. package/dist/utils/color-utils.d.ts +0 -3
  307. package/dist/utils/color-utils.d.ts.map +0 -1
  308. package/dist/utils/color-utils.js +0 -53
  309. package/dist/utils/cpu-aggregator.d.ts +0 -169
  310. package/dist/utils/cpu-aggregator.d.ts.map +0 -1
  311. package/dist/utils/cpu-aggregator.js +0 -421
  312. package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts +0 -3
  313. package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts.map +0 -1
  314. package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +0 -36
  315. package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts +0 -3
  316. package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts.map +0 -1
  317. package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +0 -42
  318. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts +0 -3
  319. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts.map +0 -1
  320. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +0 -30
  321. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts +0 -3
  322. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts.map +0 -1
  323. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +0 -61
  324. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts +0 -38
  325. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts.map +0 -1
  326. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +0 -41
  327. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts +0 -1
  328. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts.map +0 -1
  329. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +0 -1
  330. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts +0 -76
  331. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts.map +0 -1
  332. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +0 -555
  333. package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts +0 -3
  334. package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts.map +0 -1
  335. package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +0 -32
  336. package/dist/utils/grid-aggregation-utils.d.ts +0 -30
  337. package/dist/utils/grid-aggregation-utils.d.ts.map +0 -1
  338. package/dist/utils/grid-aggregation-utils.js +0 -114
  339. package/dist/utils/prop-utils.d.ts.map +0 -1
  340. package/dist/utils/prop-utils.js +0 -28
  341. package/dist/utils/resource-utils.d.ts +0 -14
  342. package/dist/utils/resource-utils.d.ts.map +0 -1
  343. package/dist/utils/resource-utils.js +0 -38
  344. package/dist/utils/scale-utils.d.ts +0 -15
  345. package/dist/utils/scale-utils.d.ts.map +0 -1
  346. package/dist/utils/scale-utils.js +0 -184
  347. package/src/cpu-grid-layer/cpu-grid-layer.ts +0 -329
  348. package/src/cpu-grid-layer/grid-aggregator.ts +0 -184
  349. package/src/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.ts +0 -35
  350. package/src/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.ts +0 -143
  351. package/src/gpu-grid-layer/gpu-grid-cell-layer.ts +0 -201
  352. package/src/gpu-grid-layer/gpu-grid-layer.ts +0 -455
  353. package/src/grid-aggregation-layer.ts +0 -243
  354. package/src/hexagon-layer/hexagon-aggregator.ts +0 -127
  355. package/src/utils/aggregation-operation-utils.ts +0 -118
  356. package/src/utils/bin-sorter.ts +0 -218
  357. package/src/utils/color-utils.ts +0 -57
  358. package/src/utils/cpu-aggregator.ts +0 -503
  359. package/src/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.ts +0 -40
  360. package/src/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.ts +0 -54
  361. package/src/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.ts +0 -35
  362. package/src/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.ts +0 -79
  363. package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.ts +0 -46
  364. package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.ts +0 -0
  365. package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +0 -155
  366. package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.ts +0 -690
  367. package/src/utils/gpu-grid-aggregation/transform-mean-vs.glsl.ts +0 -38
  368. package/src/utils/grid-aggregation-utils.ts +0 -147
  369. package/src/utils/prop-utils.ts +0 -29
  370. package/src/utils/resource-utils.ts +0 -53
  371. package/src/utils/scale-utils.js +0 -219
  372. /package/dist/{utils → common/utils}/prop-utils.d.ts +0 -0
@@ -1,329 +0,0 @@
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
-
21
- import {GridCellLayer} from '@deck.gl/layers';
22
- import {Accessor, AccessorFunction, Color, Position, Material, DefaultProps} from '@deck.gl/core';
23
-
24
- import {defaultColorRange} from '../utils/color-utils';
25
- import {pointToDensityGridDataCPU} from './grid-aggregator';
26
- import CPUAggregator from '../utils/cpu-aggregator';
27
- import AggregationLayer, {AggregationLayerProps} from '../aggregation-layer';
28
-
29
- import {Layer, UpdateParameters, GetPickingInfoParams, PickingInfo} from '@deck.gl/core';
30
- import {AggregateAccessor} from '../types';
31
-
32
- // eslint-disable-next-line @typescript-eslint/no-empty-function
33
- function nop() {}
34
-
35
- const defaultProps: DefaultProps<CPUGridLayerProps> = {
36
- // color
37
- colorDomain: null,
38
- colorRange: defaultColorRange,
39
- getColorValue: {type: 'accessor', value: null}, // default value is calculated from `getColorWeight` and `colorAggregation`
40
- getColorWeight: {type: 'accessor', value: 1},
41
- colorAggregation: 'SUM',
42
- lowerPercentile: {type: 'number', min: 0, max: 100, value: 0},
43
- upperPercentile: {type: 'number', min: 0, max: 100, value: 100},
44
- colorScaleType: 'quantize',
45
- onSetColorDomain: nop,
46
-
47
- // elevation
48
- elevationDomain: null,
49
- elevationRange: [0, 1000],
50
- getElevationValue: {type: 'accessor', value: null}, // default value is calculated from `getElevationWeight` and `elevationAggregation`
51
- getElevationWeight: {type: 'accessor', value: 1},
52
- elevationAggregation: 'SUM',
53
- elevationLowerPercentile: {type: 'number', min: 0, max: 100, value: 0},
54
- elevationUpperPercentile: {type: 'number', min: 0, max: 100, value: 100},
55
- elevationScale: {type: 'number', min: 0, value: 1},
56
- elevationScaleType: 'linear',
57
- onSetElevationDomain: nop,
58
-
59
- gridAggregator: pointToDensityGridDataCPU,
60
-
61
- // grid
62
- cellSize: {type: 'number', min: 0, max: 1000, value: 1000},
63
- coverage: {type: 'number', min: 0, max: 1, value: 1},
64
- getPosition: {type: 'accessor', value: (x: any) => x.position},
65
- extruded: false,
66
-
67
- // Optional material for 'lighting' shader module
68
- material: true,
69
-
70
- // data filter
71
- _filterData: {type: 'function', value: null, optional: true}
72
- };
73
-
74
- /** All properties supported by CPUGridLayer. */
75
- export type CPUGridLayerProps<DataT = unknown> = _CPUGridLayerProps<DataT> &
76
- AggregationLayerProps<DataT>;
77
-
78
- /** Properties added by CPUGridLayer. */
79
- type _CPUGridLayerProps<DataT> = {
80
- /**
81
- * Size of each cell in meters.
82
- * @default 1000
83
- */
84
- cellSize?: number;
85
-
86
- /**
87
- * Color scale domain, default is set to the extent of aggregated weights in each cell.
88
- * @default [min(colorWeight), max(colorWeight)]
89
- */
90
- colorDomain?: [number, number] | null;
91
-
92
- /**
93
- * Default: [colorbrewer](http://colorbrewer2.org/#type=sequential&scheme=YlOrRd&n=6) `6-class YlOrRd`
94
- */
95
- colorRange?: Color[];
96
-
97
- /**
98
- * Cell size multiplier, clamped between 0 - 1.
99
- * @default 1
100
- */
101
- coverage?: number;
102
-
103
- /**
104
- * Elevation scale input domain, default is set to between 0 and the max of aggregated weights in each cell.
105
- * @default [0, max(elevationWeight)]
106
- */
107
- elevationDomain?: [number, number] | null;
108
-
109
- /**
110
- * Elevation scale output range.
111
- * @default [0, 1000]
112
- */
113
- elevationRange?: [number, number];
114
-
115
- /**
116
- * Cell elevation multiplier.
117
- * @default 1
118
- */
119
- elevationScale?: number;
120
-
121
- /**
122
- * Whether to enable cell elevation. If set to false, all cell will be flat.
123
- * @default true
124
- */
125
- extruded?: boolean;
126
-
127
- /**
128
- * Filter cells and re-calculate color by `upperPercentile`.
129
- * Cells with value arger than the upperPercentile will be hidden.
130
- * @default 100
131
- */
132
- upperPercentile?: number;
133
-
134
- /**
135
- * Filter cells and re-calculate color by `lowerPercentile`.
136
- * Cells with value smaller than the lowerPercentile will be hidden.
137
- * @default 0
138
- */
139
- lowerPercentile?: number;
140
-
141
- /**
142
- * Filter cells and re-calculate elevation by `elevationUpperPercentile`.
143
- * Cells with elevation value larger than the `elevationUpperPercentile` will be hidden.
144
- * @default 100
145
- */
146
- elevationUpperPercentile?: number;
147
-
148
- /**
149
- * Filter cells and re-calculate elevation by `elevationLowerPercentile`.
150
- * Cells with elevation value larger than the `elevationLowerPercentile` will be hidden.
151
- * @default 0
152
- */
153
- elevationLowerPercentile?: number;
154
-
155
- /**
156
- * Scaling function used to determine the color of the grid cell, default value is 'quantize'.
157
- * Supported Values are 'quantize', 'linear', 'quantile' and 'ordinal'.
158
- * @default 'quantize'
159
- */
160
- colorScaleType?: 'quantize' | 'linear' | 'quantile' | 'ordinal';
161
-
162
- /**
163
- * Scaling function used to determine the elevation of the grid cell, only supports 'linear'.
164
- */
165
- elevationScaleType?: 'linear';
166
-
167
- // TODO - document
168
- gridAggregator?: (props: any, params: any) => any;
169
-
170
- /**
171
- * Material settings for lighting effect. Applies if `extruded: true`.
172
- *
173
- * @default true
174
- * @see https://deck.gl/docs/developer-guide/using-lighting
175
- */
176
- material?: Material;
177
-
178
- /**
179
- * Defines the operation used to aggregate all data object weights to calculate a cell's color value.
180
- * @default 'SUM'
181
- */
182
- colorAggregation?: 'SUM' | 'MEAN' | 'MIN' | 'MAX';
183
-
184
- /**
185
- * Defines the operation used to aggregate all data object weights to calculate a cell's elevation value.
186
- * @default 'SUM'
187
- */
188
- elevationAggregation?: 'SUM' | 'MEAN' | 'MIN' | 'MAX';
189
-
190
- /**
191
- * Method called to retrieve the position of each object.
192
- * @default object => object.position
193
- */
194
- getPosition?: AccessorFunction<DataT, Position>;
195
-
196
- /**
197
- * The weight of a data object used to calculate the color value for a cell.
198
- * @default 1
199
- */
200
- getColorWeight?: Accessor<DataT, number>;
201
-
202
- /**
203
- * After data objects are aggregated into cells, this accessor is called on each cell to get the value that its color is based on.
204
- * @default null
205
- */
206
- getColorValue?: AggregateAccessor<DataT> | null;
207
-
208
- /**
209
- * The weight of a data object used to calculate the elevation value for a cell.
210
- * @default 1
211
- */
212
- getElevationWeight?: Accessor<DataT, number>;
213
-
214
- /**
215
- * After data objects are aggregated into cells, this accessor is called on each cell to get the value that its elevation is based on.
216
- * @default null
217
- */
218
- getElevationValue?: AggregateAccessor<DataT> | null;
219
-
220
- /**
221
- * This callback will be called when bin color domain has been calculated.
222
- * @default () => {}
223
- */
224
- onSetColorDomain?: (minMax: [number, number]) => void;
225
-
226
- /**
227
- * This callback will be called when bin elevation domain has been calculated.
228
- * @default () => {}
229
- */
230
- onSetElevationDomain?: (minMax: [number, number]) => void;
231
-
232
- /**
233
- * (Experimental) Filter data objects
234
- */
235
- _filterData: null | ((d: DataT) => boolean);
236
- };
237
-
238
- /** Aggregate data into a grid-based heatmap. Aggregation is performed on CPU. */
239
- export default class CPUGridLayer<
240
- DataT = any,
241
- ExtraPropsT extends {} = {}
242
- > extends AggregationLayer<DataT, ExtraPropsT & Required<_CPUGridLayerProps<DataT>>> {
243
- static layerName = 'CPUGridLayer';
244
- static defaultProps = defaultProps;
245
-
246
- state!: AggregationLayer<DataT>['state'] & {
247
- cpuAggregator: CPUAggregator;
248
- aggregatorState: CPUAggregator['state'];
249
- };
250
-
251
- initializeState(): void {
252
- const cpuAggregator = new CPUAggregator({
253
- getAggregator: props => props.gridAggregator,
254
- getCellSize: props => props.cellSize
255
- });
256
-
257
- this.state = {
258
- cpuAggregator,
259
- aggregatorState: cpuAggregator.state
260
- };
261
- const attributeManager = this.getAttributeManager()!;
262
- attributeManager.add({
263
- positions: {size: 3, type: 'float64', accessor: 'getPosition'}
264
- });
265
- // color and elevation attributes can't be added as attributes
266
- // they are calcualted using 'getValue' accessor that takes an array of pints.
267
- }
268
-
269
- updateState(opts: UpdateParameters<this>) {
270
- super.updateState(opts);
271
- this.setState({
272
- // make a copy of the internal state of cpuAggregator for testing
273
- aggregatorState: this.state.cpuAggregator.updateState(opts, {
274
- viewport: this.context.viewport,
275
- attributes: this.getAttributes(),
276
- numInstances: this.getNumInstances()
277
- })
278
- });
279
- }
280
-
281
- getPickingInfo({info}: GetPickingInfoParams): PickingInfo {
282
- return this.state.cpuAggregator.getPickingInfo({info});
283
- }
284
-
285
- // create a method for testing
286
- _onGetSublayerColor(cell) {
287
- return this.state.cpuAggregator.getAccessor('fillColor')(cell);
288
- }
289
-
290
- // create a method for testing
291
- _onGetSublayerElevation(cell) {
292
- return this.state.cpuAggregator.getAccessor('elevation')(cell);
293
- }
294
-
295
- _getSublayerUpdateTriggers() {
296
- return this.state.cpuAggregator.getUpdateTriggers(this.props);
297
- }
298
-
299
- renderLayers(): Layer {
300
- const {elevationScale, extruded, cellSize, coverage, material, transitions} = this.props;
301
- const {cpuAggregator} = this.state;
302
- const SubLayerClass = this.getSubLayerClass('grid-cell', GridCellLayer);
303
- const updateTriggers = this._getSublayerUpdateTriggers();
304
-
305
- return new SubLayerClass(
306
- {
307
- cellSize,
308
- coverage,
309
- material,
310
- elevationScale,
311
- extruded,
312
-
313
- getFillColor: this._onGetSublayerColor.bind(this),
314
- getElevation: this._onGetSublayerElevation.bind(this),
315
- transitions: transitions && {
316
- getFillColor: transitions.getColorValue || transitions.getColorWeight,
317
- getElevation: transitions.getElevationValue || transitions.getElevationWeight
318
- }
319
- },
320
- this.getSubLayerProps({
321
- id: 'grid-cell',
322
- updateTriggers
323
- }),
324
- {
325
- data: cpuAggregator.state.layerData.data
326
- }
327
- );
328
- }
329
- }
@@ -1,184 +0,0 @@
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
-
21
- import {createIterable} from '@deck.gl/core';
22
- import {getGridOffset} from '../utils/grid-aggregation-utils';
23
-
24
- export type GridHash = {
25
- [key: string]: {
26
- count: number;
27
- points: unknown[];
28
- lonIdx: number;
29
- latIdx: number;
30
- };
31
- };
32
-
33
- /**
34
- * Calculate density grid from an array of points
35
- * @param {Object} props - object containing :
36
- * @param {Iterable} [props.data] - data objects to be aggregated
37
- * @param {Integer} [props.cellSize] - size of the grid cell
38
- *
39
- * @param {Object} aggregationParams - object containing :
40
- * @param {Object} gridOffset - {xOffset, yOffset} cell size in meters
41
- * @param {Integer} width - width of the grid
42
- * @param {Integer} height - height of the grid
43
- * @param {Boolean} projectPoints - `true` if doing screen space projection, `false` otherwise
44
- * @param {Array} attributes - attributes array containing position values
45
- * @param {Viewport} viewport - viewport to be used for projection
46
- * @param {Array} posOffset - [xOffset, yOffset] offset to be applied to positions to get cell index
47
- * @param {Object} boundingBox - {xMin, yMin, xMax, yMax} bounding box of input data
48
- *
49
- * @returns {object} - grid data, cell dimension
50
- */
51
- export function pointToDensityGridDataCPU(props, aggregationParams) {
52
- const hashInfo = pointsToGridHashing(props, aggregationParams);
53
- const result = getGridLayerDataFromGridHash(hashInfo);
54
-
55
- return {
56
- gridHash: hashInfo.gridHash,
57
- gridOffset: hashInfo.gridOffset,
58
- data: result
59
- };
60
- }
61
-
62
- /**
63
- * Project points into each cell, return a hash table of cells
64
- * @param {Iterable} points
65
- * @param {number} cellSize - unit size in meters
66
- * @param {function} getPosition - position accessor
67
- * @returns {object} - grid hash and cell dimension
68
- */
69
- /* eslint-disable-next-line max-statements, complexity */
70
- function pointsToGridHashing(
71
- props,
72
- aggregationParams
73
- ): {
74
- gridHash: GridHash;
75
- gridOffset: {xOffset: number; yOffset: number};
76
- offsets: [number, number];
77
- } {
78
- const {data = [], cellSize} = props;
79
- const {attributes, viewport, projectPoints, numInstances} = aggregationParams;
80
- const positions = attributes.positions.value;
81
- const {size} = attributes.positions.getAccessor();
82
- const boundingBox =
83
- aggregationParams.boundingBox || getPositionBoundingBox(attributes.positions, numInstances);
84
- const offsets = aggregationParams.posOffset || [180, 90];
85
- const gridOffset = aggregationParams.gridOffset || getGridOffset(boundingBox, cellSize);
86
-
87
- if (gridOffset.xOffset <= 0 || gridOffset.yOffset <= 0) {
88
- return {gridHash: {}, gridOffset, offsets: [0, 0]};
89
- }
90
-
91
- const {width, height} = viewport;
92
- const numCol = Math.ceil(width / gridOffset.xOffset);
93
- const numRow = Math.ceil(height / gridOffset.yOffset);
94
-
95
- // calculate count per cell
96
- const gridHash = {};
97
-
98
- const {iterable, objectInfo} = createIterable(data);
99
- const position = new Array(3);
100
- for (const pt of iterable) {
101
- objectInfo.index++;
102
- position[0] = positions[objectInfo.index * size];
103
- position[1] = positions[objectInfo.index * size + 1];
104
- position[2] = size >= 3 ? positions[objectInfo.index * size + 2] : 0;
105
- const [x, y] = projectPoints ? viewport.project(position) : position;
106
- if (Number.isFinite(x) && Number.isFinite(y)) {
107
- const yIndex = Math.floor((y + offsets[1]) / gridOffset.yOffset);
108
- const xIndex = Math.floor((x + offsets[0]) / gridOffset.xOffset);
109
- if (
110
- !projectPoints ||
111
- // when doing screen space agggregation (projectPoints = true), filter points outside of the viewport range.
112
- (xIndex >= 0 && xIndex < numCol && yIndex >= 0 && yIndex < numRow)
113
- ) {
114
- const key = `${yIndex}-${xIndex}`;
115
-
116
- gridHash[key] = gridHash[key] || {count: 0, points: [], lonIdx: xIndex, latIdx: yIndex};
117
- gridHash[key].count += 1;
118
- gridHash[key].points.push({
119
- source: pt,
120
- index: objectInfo.index
121
- });
122
- }
123
- }
124
- }
125
-
126
- return {gridHash, gridOffset, offsets: [offsets[0] * -1, offsets[1] * -1]};
127
- }
128
- /* eslint-enable max-statements, complexity */
129
-
130
- function getGridLayerDataFromGridHash({
131
- gridHash,
132
- gridOffset,
133
- offsets
134
- }: {
135
- gridHash: GridHash;
136
- gridOffset: {xOffset: number; yOffset: number};
137
- offsets: [number, number];
138
- }) {
139
- const data = new Array(Object.keys(gridHash).length);
140
- let i = 0;
141
- for (const key in gridHash) {
142
- const idxs = key.split('-');
143
- const latIdx = parseInt(idxs[0], 10);
144
- const lonIdx = parseInt(idxs[1], 10);
145
- const index = i++;
146
-
147
- data[index] = {
148
- index,
149
- position: [
150
- offsets[0] + gridOffset.xOffset * lonIdx,
151
- offsets[1] + gridOffset.yOffset * latIdx
152
- ],
153
- ...gridHash[key]
154
- };
155
- }
156
- return data;
157
- }
158
-
159
- // Calculate bounding box of position attribute
160
- function getPositionBoundingBox(positionAttribute, numInstance) {
161
- // TODO - value might not exist (e.g. attribute transition)
162
- const positions = positionAttribute.value;
163
- const {size} = positionAttribute.getAccessor();
164
-
165
- let yMin = Infinity;
166
- let yMax = -Infinity;
167
- let xMin = Infinity;
168
- let xMax = -Infinity;
169
- let y;
170
- let x;
171
-
172
- for (let i = 0; i < numInstance; i++) {
173
- x = positions[i * size];
174
- y = positions[i * size + 1];
175
- if (Number.isFinite(x) && Number.isFinite(y)) {
176
- yMin = y < yMin ? y : yMin;
177
- yMax = y > yMax ? y : yMax;
178
- xMin = x < xMin ? x : xMin;
179
- xMax = x > xMax ? x : xMax;
180
- }
181
- }
182
-
183
- return {xMin, xMax, yMin, yMax};
184
- }
@@ -1,35 +0,0 @@
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
-
21
- export default `\
22
- #version 300 es
23
- #define SHADER_NAME gpu-grid-cell-layer-fragment-shader
24
-
25
- precision highp float;
26
-
27
- in vec4 vColor;
28
-
29
- out vec4 fragColor;
30
-
31
- void main(void) {
32
- fragColor = vColor;
33
- fragColor = picking_filterColor(fragColor);
34
- }
35
- `;
@@ -1,143 +0,0 @@
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
-
21
- // Inspired by screen-grid-layer vertex shader in deck.gl
22
-
23
- export default `\
24
- #version 300 es
25
- #define SHADER_NAME gpu-grid-cell-layer-vertex-shader
26
- #define RANGE_COUNT 6
27
-
28
- in vec3 positions;
29
- in vec3 normals;
30
-
31
- in vec4 colors;
32
- in vec4 elevations;
33
- in vec3 instancePickingColors;
34
-
35
- // Custom uniforms
36
- uniform vec2 offset;
37
- uniform bool extruded;
38
- uniform float cellSize;
39
- uniform float coverage;
40
- uniform float opacity;
41
- uniform float elevationScale;
42
-
43
- uniform ivec2 gridSize;
44
- uniform vec2 gridOrigin;
45
- uniform vec2 gridOriginLow;
46
- uniform vec2 gridOffset;
47
- uniform vec2 gridOffsetLow;
48
- uniform vec4 colorRange[RANGE_COUNT];
49
- uniform vec2 elevationRange;
50
-
51
- // Domain uniforms
52
- uniform vec2 colorDomain;
53
- uniform bool colorDomainValid;
54
- uniform vec2 elevationDomain;
55
- uniform bool elevationDomainValid;
56
-
57
- layout(std140) uniform;
58
- uniform ColorData
59
- {
60
- vec4 maxMinCount;
61
- } colorData;
62
- uniform ElevationData
63
- {
64
- vec4 maxMinCount;
65
- } elevationData;
66
-
67
- #define EPSILON 0.00001
68
-
69
- // Result
70
- out vec4 vColor;
71
-
72
- vec4 quantizeScale(vec2 domain, vec4 range[RANGE_COUNT], float value) {
73
- vec4 outColor = vec4(0., 0., 0., 0.);
74
- if (value >= (domain.x - EPSILON) && value <= (domain.y + EPSILON)) {
75
- float domainRange = domain.y - domain.x;
76
- if (domainRange <= 0.) {
77
- outColor = colorRange[0];
78
- } else {
79
- float rangeCount = float(RANGE_COUNT);
80
- float rangeStep = domainRange / rangeCount;
81
- float idx = floor((value - domain.x) / rangeStep);
82
- idx = clamp(idx, 0., rangeCount - 1.);
83
- int intIdx = int(idx);
84
- outColor = colorRange[intIdx];
85
- }
86
- }
87
- return outColor;
88
- }
89
-
90
- float linearScale(vec2 domain, vec2 range, float value) {
91
- if (value >= (domain.x - EPSILON) && value <= (domain.y + EPSILON)) {
92
- return ((value - domain.x) / (domain.y - domain.x)) * (range.y - range.x) + range.x;
93
- }
94
- return -1.;
95
- }
96
-
97
- void main(void) {
98
- vec2 clrDomain = colorDomainValid ? colorDomain : vec2(colorData.maxMinCount.a, colorData.maxMinCount.r);
99
- vec4 color = quantizeScale(clrDomain, colorRange, colors.r);
100
-
101
- float elevation = 0.0;
102
-
103
- if (extruded) {
104
- vec2 elvDomain = elevationDomainValid ? elevationDomain : vec2(elevationData.maxMinCount.a, elevationData.maxMinCount.r);
105
- elevation = linearScale(elvDomain, elevationRange, elevations.r);
106
- elevation = elevation * (positions.z + 1.0) / 2.0 * elevationScale;
107
- }
108
-
109
- // if aggregated color or elevation is 0 do not render
110
- float shouldRender = float(color.r > 0.0 && elevations.r >= 0.0);
111
- float dotRadius = cellSize / 2. * coverage * shouldRender;
112
-
113
- int yIndex = (gl_InstanceID / gridSize[0]);
114
- int xIndex = gl_InstanceID - (yIndex * gridSize[0]);
115
-
116
- vec2 instancePositionXFP64 = mul_fp64(vec2(gridOffset[0], gridOffsetLow[0]), vec2(float(xIndex), 0.));
117
- instancePositionXFP64 = sum_fp64(instancePositionXFP64, vec2(gridOrigin[0], gridOriginLow[0]));
118
- vec2 instancePositionYFP64 = mul_fp64(vec2(gridOffset[1], gridOffsetLow[1]), vec2(float(yIndex), 0.));
119
- instancePositionYFP64 = sum_fp64(instancePositionYFP64, vec2(gridOrigin[1], gridOriginLow[1]));
120
-
121
- vec3 centroidPosition = vec3(instancePositionXFP64[0], instancePositionYFP64[0], elevation);
122
- vec3 centroidPosition64Low = vec3(instancePositionXFP64[1], instancePositionYFP64[1], 0.0);
123
- geometry.worldPosition = centroidPosition;
124
- vec3 pos = vec3(project_size(positions.xy + offset) * dotRadius, 0.);
125
-
126
- // Set color to be rendered to picking fbo (also used to check for selection highlight).
127
- picking_setPickingColor(instancePickingColors);
128
-
129
- gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position);
130
-
131
- // Light calculations
132
- // Worldspace is the linear space after Mercator projection
133
-
134
- vec3 normals_commonspace = project_normal(normals);
135
-
136
- if (extruded) {
137
- vec3 lightColor = lighting_getLightColor(color.rgb, project_uCameraPosition, geometry.position.xyz, normals_commonspace);
138
- vColor = vec4(lightColor, color.a * opacity) / 255.;
139
- } else {
140
- vColor = vec4(color.rgb, color.a * opacity) / 255.;
141
- }
142
- }
143
- `;