chunk-GSORSXL5.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. import {
  2. l
  3. } from "./chunk-4E6K4P67.js";
  4. import {
  5. o
  6. } from "./chunk-WEMIK25H.js";
  7. import {
  8. s,
  9. s3 as s2
  10. } from "./chunk-EMJ4ZSM2.js";
  11. import {
  12. a
  13. } from "./chunk-GZT4BVFP.js";
  14. // node_modules/@arcgis/core/views/2d/layers/features/support/rendererUtils.js
  15. var l2 = 8;
  16. var a2 = l2 - 2;
  17. var n = s.getLogger("esri.views.2d.layers.features.support.rendererUtils");
  18. var i = (e) => {
  19. if (!("visualVariables" in e) || !e.visualVariables || !e.visualVariables.length)
  20. return e;
  21. const r = e.clone(), t = r.visualVariables.map((e2) => p(e2) ? c(e2) : e2);
  22. return r.visualVariables = t, r;
  23. };
  24. function u(e) {
  25. return e.map((e2) => p(e2) ? c(e2.clone()) : e2);
  26. }
  27. function p(e) {
  28. return (e.type === "size" || e.type === "color" || e.type === "opacity") && e.stops != null;
  29. }
  30. function c(e) {
  31. return e.stops = g(e.type, e.stops), e;
  32. }
  33. function f(e, r, t) {
  34. return (1 - t) * e + t * r;
  35. }
  36. function b(e, r) {
  37. const [t, ...s3] = r, l3 = s3.pop(), n2 = s3[0].value, i2 = s3[s3.length - 1].value, u2 = (i2 - n2) / a2, p2 = [];
  38. for (let a3 = n2; a3 < i2; a3 += u2) {
  39. let t2 = 0;
  40. for (; a3 >= s3[t2].value; )
  41. t2++;
  42. const l4 = s3[t2], n3 = r[t2 - 1], i3 = a3 - n3.value, u3 = l4.value === n3.value ? 1 : i3 / (l4.value - n3.value);
  43. if (e === "color") {
  44. const e2 = s3[t2], o2 = r[t2 - 1], l5 = e2.color.clone();
  45. l5.r = f(o2.color.r, l5.r, u3), l5.g = f(o2.color.g, l5.g, u3), l5.b = f(o2.color.b, l5.b, u3), l5.a = f(o2.color.a, l5.a, u3), p2.push({ value: a3, color: l5, label: e2.label });
  46. } else if (e === "size") {
  47. const e2 = s3[t2], l5 = r[t2 - 1], n4 = o(e2.size), i4 = f(o(l5.size), n4, u3);
  48. p2.push({ value: a3, size: i4, label: e2.label });
  49. } else {
  50. const e2 = s3[t2], o2 = f(r[t2 - 1].opacity, e2.opacity, u3);
  51. p2.push({ value: a3, opacity: o2, label: e2.label });
  52. }
  53. }
  54. return [t, ...p2, l3];
  55. }
  56. function m(e) {
  57. const [r, ...t] = e, o2 = t.pop();
  58. for (; t.length > a2; ) {
  59. let e2 = 0, r2 = 0;
  60. for (let o3 = 1; o3 < t.length; o3++) {
  61. const s3 = t[o3 - 1], l3 = t[o3], a3 = Math.abs(l3.value - s3.value);
  62. a3 > r2 && (r2 = a3, e2 = o3);
  63. }
  64. t.splice(e2, 1);
  65. }
  66. return [r, ...t, o2];
  67. }
  68. function g(e, r) {
  69. return r.length <= l2 ? r : (n.warn(`Found ${r.length} Visual Variable stops, but MapView only supports ${l2}. Displayed stops will be simplified.`), r.length > 2 * l2 ? b(e, r) : m(r));
  70. }
  71. function h() {
  72. if (a("heatmap-force-raster"))
  73. return "raster";
  74. const { supportsTextureFloat: e, supportsTextureHalfFloat: t, supportsColorBufferFloat: o2, supportsColorBufferFloatBlend: l3, supportsColorBufferHalfFloat: a3 } = l("2d");
  75. return e && o2 && l3 || t && a3 ? "symbol" : a("heatmap-allow-raster-fallback") ? "raster" : "none";
  76. }
  77. function v(t) {
  78. if (!t)
  79. return true;
  80. switch (t.type) {
  81. case "dot-density":
  82. if (!l("2d").supportsTextureFloat)
  83. return n.error(new s2("webgl-missing-extension", "Missing WebGL extension OES_Texture_Float which is required for DotDensity")), false;
  84. break;
  85. case "heatmap": {
  86. const t2 = h();
  87. if (t2 === "none" || t2 === "raster" && !a("heatmap-force-raster")) {
  88. const r = l("2d"), o2 = ["supportsTextureFloat", "supportsTextureHalfFloat", "supportsColorBufferFloat", "supportsColorBufferFloatBlend", "supportsColorBufferHalfFloat"].filter((e) => !r[e]).join(", ");
  89. if (t2 === "none")
  90. return n.errorOnce(new s2("webgl-missing-extension", `Missing WebGL${r.type} requirements for Heatmap: ${o2}`)), false;
  91. t2 === "raster" && n.warnOnce(`Missing WebGL${r.type} requirements for accelerated Heatmap: ${o2}. Feature support may be limited.`);
  92. }
  93. break;
  94. }
  95. }
  96. return true;
  97. }
  98. export {
  99. i,
  100. u,
  101. h,
  102. v
  103. };
  104. //# sourceMappingURL=chunk-GSORSXL5.js.map