chunk-XLV7RUSE.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. import {
  2. n
  3. } from "./chunk-NTUXR253.js";
  4. import {
  5. e,
  6. u
  7. } from "./chunk-WEMIK25H.js";
  8. import {
  9. j,
  10. o2 as o
  11. } from "./chunk-XNLG7T2T.js";
  12. // node_modules/@arcgis/core/renderers/support/heatmapUtils.js
  13. var a = 2.4;
  14. function i(t) {
  15. return e(t * a);
  16. }
  17. function f(t) {
  18. return u(t) / a;
  19. }
  20. function c(r, n2, e2, a2) {
  21. let { color: i2, ratio: f2 } = n2, { color: c2, ratio: s2 } = e2;
  22. if (s2 === f2) {
  23. const t = 1e-6;
  24. s2 === 1 ? f2 -= t : s2 += t;
  25. }
  26. const u2 = o((a2 - f2) / (s2 - f2), 0, 1);
  27. j(r, i2.toArray(), c2.toArray(), u2);
  28. }
  29. function s(t) {
  30. const r = 512, n2 = new Uint8ClampedArray(4 * r);
  31. if (t = t.filter(({ ratio: t2 }) => t2 >= 0 && t2 <= 1).sort((t2, r2) => t2.ratio - r2.ratio).map(({ color: t2, ratio: r2 }) => ({ color: t2, ratio: Math.max(r2, 1e-3) })), t.length < 1)
  32. return n2;
  33. let o2 = t[0], a2 = t[0], i2 = 1;
  34. const f2 = n();
  35. for (let e2 = 0; e2 < r; e2++) {
  36. const s2 = (e2 + 0.5) / r;
  37. for (; s2 > a2.ratio && i2 < t.length; )
  38. o2 = a2, a2 = t[i2++];
  39. c(f2, o2, a2, s2), n2.set(f2, 4 * e2);
  40. }
  41. return n2;
  42. }
  43. function l(t, r, o2, e2) {
  44. const { radius: a2, fieldOffset: i2, field: f2 } = r, c2 = Math.round(u(a2)), s2 = new Float64Array(o2 * e2);
  45. let u2, l2 = Number.NEGATIVE_INFINITY;
  46. const m2 = x(f2, i2), h2 = new Set();
  47. for (const n2 of t) {
  48. const t2 = n2.getCursor();
  49. for (; t2.next(); ) {
  50. const r2 = t2.getObjectId();
  51. if (h2.has(r2))
  52. continue;
  53. h2.add(r2);
  54. const n3 = t2.readLegacyPointGeometry(), a3 = 128;
  55. if (n3.x < -a3 || n3.x >= o2 + a3 || n3.y < -a3 || n3.y > e2 + a3)
  56. continue;
  57. const i3 = +m2(t2), f3 = Math.max(0, Math.round(n3.x) - c2), d2 = Math.max(0, Math.round(n3.y) - c2), x2 = Math.min(e2, Math.round(n3.y) + c2), M = Math.min(o2, Math.round(n3.x) + c2);
  58. for (let t3 = d2; t3 < x2; t3++)
  59. for (let r3 = f3; r3 < M; r3++) {
  60. const e3 = t3 * o2 + r3, a4 = y(n3.x - r3, n3.y - t3, c2);
  61. u2 = s2[e3] += a4 * i3, u2 > l2 && (l2 = u2);
  62. }
  63. }
  64. }
  65. return { matrix: s2.buffer, max: l2 };
  66. }
  67. function m(t, r, n2, o2, e2, a2) {
  68. t.canvas.width = t.canvas.height = r, t.clearRect(0, 0, r, r);
  69. const i2 = t.getImageData(0, 0, r, r);
  70. n2 && o2 && i2.data.set(new Uint8ClampedArray(h(r, n2, o2, e2, a2))), t.putImageData(i2, 0, 0);
  71. }
  72. function h(r, n2, o2, e2, a2) {
  73. const i2 = new Uint32Array(r * r), f2 = "buffer" in n2 ? n2 : new Float64Array(n2), c2 = "buffer" in o2 ? new Uint32Array(o2.buffer) : new Uint32Array(new Uint8Array(o2).buffer), s2 = c2.length / (a2 - e2);
  74. for (let u2 = 0; u2 < f2.length; u2++) {
  75. const r2 = f2[u2], n3 = Math.floor((r2 - e2) * s2);
  76. i2[u2] = c2[o(n3, 0, c2.length - 1)];
  77. }
  78. return i2.buffer;
  79. }
  80. function y(t, r, n2) {
  81. const o2 = Math.sqrt(t ** 2 + r ** 2) / n2;
  82. return o2 > 1 ? 0 : 3 / (Math.PI * n2 ** 2) * (1 - o2 ** 2) ** 2;
  83. }
  84. function d(t, r) {
  85. return typeof t == "function" ? t : t ? typeof r == "string" ? (r2) => -1 * +r2[t] : (n2) => +n2[t] + r : () => 1;
  86. }
  87. function x(t, r) {
  88. return t != null ? typeof r == "string" ? (r2) => -1 * +r2.readAttribute(t) : (n2) => +n2.readAttribute(t) + r : (t2) => 1;
  89. }
  90. export {
  91. a,
  92. i,
  93. f,
  94. s,
  95. l,
  96. m,
  97. y,
  98. d
  99. };
  100. //# sourceMappingURL=chunk-XLV7RUSE.js.map