symbolLayerUtils-JPLC7RBG.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. import {
  2. e
  3. } from "./chunk-OKUFE7TO.js";
  4. import {
  5. c,
  6. t
  7. } from "./chunk-LTZ5XXDV.js";
  8. import {
  9. F,
  10. a
  11. } from "./chunk-ECY35CJI.js";
  12. import "./chunk-PT62335L.js";
  13. import "./chunk-2H5MD622.js";
  14. import "./chunk-RYY6632W.js";
  15. import "./chunk-DW42UVIT.js";
  16. import "./chunk-YAEIHDJH.js";
  17. import "./chunk-TJNOJH33.js";
  18. import "./chunk-OSHI574D.js";
  19. import {
  20. U
  21. } from "./chunk-DVUG3KID.js";
  22. import "./chunk-FWSQEIAR.js";
  23. import "./chunk-VEGAOVMY.js";
  24. import "./chunk-6T6G6LCQ.js";
  25. import "./chunk-YEJL5NEF.js";
  26. import "./chunk-PQFTYGF5.js";
  27. import "./chunk-2Z2TG5CU.js";
  28. import "./chunk-6KZ2LTDA.js";
  29. import "./chunk-U2XHEJM7.js";
  30. import "./chunk-SQOPWYIT.js";
  31. import "./chunk-V6P2MAQQ.js";
  32. import {
  33. s3 as s
  34. } from "./chunk-E5O6P5I2.js";
  35. import "./chunk-SPWQ3AWG.js";
  36. import "./chunk-2TIUKVZN.js";
  37. import {
  38. f,
  39. r
  40. } from "./chunk-YXWMMD76.js";
  41. import "./chunk-S5KM4IGW.js";
  42. // node_modules/@arcgis/core/symbols/support/symbolLayerUtils.js
  43. var a2 = m();
  44. function m() {
  45. return new e(50);
  46. }
  47. function y() {
  48. a2 = m();
  49. }
  50. function f2(e2, o) {
  51. if ("icon" === e2.type)
  52. return p(e2, o);
  53. if ("object" === e2.type)
  54. return d(e2, o);
  55. throw new s("symbol3d:unsupported-symbol-layer", "computeLayerSize only works with symbol layers of type Icon and Object");
  56. }
  57. async function l(e2, o) {
  58. if ("icon" === e2.type)
  59. return h(e2, o);
  60. if ("object" === e2.type)
  61. return w(e2, o);
  62. throw new s("symbol3d:unsupported-symbol-layer", "computeLayerSize only works with symbol layers of type Icon and Object");
  63. }
  64. async function p(e2, o) {
  65. var _a, _b;
  66. if ((_a = e2.resource) == null ? void 0 : _a.href)
  67. return b(e2.resource.href).then((e3) => [e3.width, e3.height]);
  68. if ((_b = e2.resource) == null ? void 0 : _b.primitive)
  69. return r(o) ? [o, o] : [256, 256];
  70. throw new s("symbol3d:invalid-symbol-layer", "symbol layers of type Icon must have either an href or a primitive resource");
  71. }
  72. function h(e2, r2) {
  73. return p(e2, r2).then((r3) => {
  74. if (null == e2.size)
  75. return r3;
  76. const o = r3[0] / r3[1];
  77. return o > 1 ? [e2.size, e2.size / o] : [e2.size * o, e2.size];
  78. });
  79. }
  80. function b(r2) {
  81. return U(r2, { responseType: "image" }).then((e2) => e2.data);
  82. }
  83. function d(e2, r2) {
  84. return j(e2, r2).then((e3) => F(e3));
  85. }
  86. async function w(e2, r2) {
  87. const o = await d(e2, r2);
  88. return t(o, e2);
  89. }
  90. async function j(e2, o) {
  91. var _a;
  92. if (!e2.isPrimitive) {
  93. const r2 = f((_a = e2.resource) == null ? void 0 : _a.href), o2 = a2.get(r2);
  94. if (void 0 !== o2)
  95. return o2;
  96. const t2 = await import("./objectResourceUtils-XPGL7LTG.js"), i2 = await t2.fetch(r2, { disableTextures: true });
  97. return a2.put(r2, i2.referenceBoundingBox), i2.referenceBoundingBox;
  98. }
  99. let i = null;
  100. if (e2.resource && e2.resource.primitive && (i = a(c(e2.resource.primitive)), r(o)))
  101. for (let r2 = 0; r2 < i.length; r2++)
  102. i[r2] *= o;
  103. return i ? Promise.resolve(i) : Promise.reject(new s("symbol:invalid-resource", "The symbol does not have a valid resource"));
  104. }
  105. export {
  106. y as clearBoundingBoxCache,
  107. p as computeIconLayerResourceSize,
  108. f2 as computeLayerResourceSize,
  109. l as computeLayerSize,
  110. d as computeObjectLayerResourceSize
  111. };
  112. //# sourceMappingURL=symbolLayerUtils-JPLC7RBG.js.map