chunk-GONLHNIL.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. import {
  2. v
  3. } from "./chunk-TWB5CT7V.js";
  4. import {
  5. h
  6. } from "./chunk-OTS3UE5B.js";
  7. import {
  8. e as e2
  9. } from "./chunk-FIYKFRB2.js";
  10. import {
  11. S
  12. } from "./chunk-RBZL6SRZ.js";
  13. import {
  14. u
  15. } from "./chunk-N2663GRX.js";
  16. import {
  17. M2 as M
  18. } from "./chunk-ECW2QABR.js";
  19. import {
  20. R
  21. } from "./chunk-MRJEICT6.js";
  22. import {
  23. d,
  24. e,
  25. n2 as n,
  26. y3 as y
  27. } from "./chunk-Y3WMVFTW.js";
  28. import {
  29. x
  30. } from "./chunk-ULGDPLM2.js";
  31. // node_modules/@arcgis/core/views/2d/viewStateUtils.js
  32. var t = Math.PI / 180;
  33. function n2(n3) {
  34. return n3 * t;
  35. }
  36. function r(t2, o) {
  37. const r2 = n2(o.rotation), u4 = Math.abs(Math.cos(r2)), a = Math.abs(Math.sin(r2)), [s, c] = o.size;
  38. return t2[0] = Math.round(c * a + s * u4), t2[1] = Math.round(c * u4 + s * a), t2;
  39. }
  40. function u2(t2, n3, o, r2) {
  41. const [u4, a] = n3, [s, c] = r2, i = 0.5 * o;
  42. return t2[0] = u4 - i * s, t2[1] = a - i * c, t2[2] = u4 + i * s, t2[3] = a + i * c, t2;
  43. }
  44. // node_modules/@arcgis/core/views/2d/layers/support/ExportStrategy.js
  45. var u3 = u();
  46. var g = [0, 0];
  47. var f = new e2(0, 0, 0, 0);
  48. var x2 = { container: null, fetchSource: null, requestUpdate: null, imageMaxWidth: 2048, imageMaxHeight: 2048, imageRotationSupported: false, imageNormalizationSupported: false, hidpi: false };
  49. var y2 = class extends y {
  50. constructor(t2) {
  51. super(t2), this._imagePromise = null, this.bitmaps = [], this.hidpi = x2.hidpi, this.imageMaxWidth = x2.imageMaxWidth, this.imageMaxHeight = x2.imageMaxHeight, this.imageRotationSupported = x2.imageRotationSupported, this.imageNormalizationSupported = x2.imageNormalizationSupported, this.update = x(async (t3, e3) => {
  52. if (!t3.stationary || this.destroyed)
  53. return null;
  54. const i = t3.state, o = R(i.spatialReference), r2 = this.hidpi ? t3.pixelRatio : 1, s = this.imageNormalizationSupported && i.worldScreenWidth && i.worldScreenWidth < i.size[0];
  55. s ? (g[0] = i.worldScreenWidth, g[1] = i.size[1]) : this.imageRotationSupported ? (g[0] = i.size[0], g[1] = i.size[1]) : r(g, i);
  56. const a = Math.floor(g[0] * r2) > this.imageMaxWidth || Math.floor(g[1] * r2) > this.imageMaxHeight, n3 = o && (i.extent.xmin < o.valid[0] || i.extent.xmax > o.valid[1]), l = !this.imageNormalizationSupported && n3, d2 = !a && !l, h2 = this.imageRotationSupported ? i.rotation : 0;
  57. if (d2) {
  58. const t4 = s ? i.paddedViewState.center : i.center;
  59. this._imagePromise = this._singleExport(i, g, t4, i.resolution, h2, r2, e3);
  60. } else {
  61. let t4 = Math.min(this.imageMaxWidth, this.imageMaxHeight);
  62. l && (t4 = Math.min(i.worldScreenWidth, t4)), this._imagePromise = this._tiledExport(i, t4, r2, e3);
  63. }
  64. return this._imagePromise.then(async (t4) => {
  65. if (this._imagePromise = null, !this.destroyed) {
  66. this.bitmaps = t4 ?? [];
  67. for (const e4 of this.container.children)
  68. t4.includes(e4) || e4.fadeOut().then(() => {
  69. e4.remove();
  70. });
  71. for (const e4 of t4)
  72. this.container.addChild(e4), e4.fadeIn();
  73. }
  74. }).catch((t4) => {
  75. throw this._imagePromise = null, t4;
  76. });
  77. }, 5e3);
  78. }
  79. destroy() {
  80. this.bitmaps = [];
  81. }
  82. get updating() {
  83. return !this.destroyed && this._imagePromise !== null;
  84. }
  85. updateExports(t2) {
  86. for (const e3 of this.container.children) {
  87. if (!e3.visible || !e3.stage)
  88. return;
  89. t2(e3), e3.invalidateTexture(), e3.requestRender();
  90. }
  91. }
  92. async _export(t2, e3, i, o, r2, s) {
  93. const a = await this.fetchSource(t2, Math.floor(e3 * r2), Math.floor(i * r2), { rotation: o, pixelRatio: r2, signal: s }), p = new v(a, "additive");
  94. return p.x = t2.xmin, p.y = t2.ymax, p.resolution = t2.width / e3, p.rotation = o, p.pixelRatio = r2, p;
  95. }
  96. async _singleExport(t2, e3, i, o, r2, a, p) {
  97. u2(u3, i, o, e3);
  98. const n3 = new M(u3[0], u3[1], u3[2], u3[3], t2.spatialReference);
  99. return [await this._export(n3, e3[0], e3[1], r2, a, p)];
  100. }
  101. _tiledExport(t2, e3, i, o) {
  102. const r2 = S.create({ size: e3, spatialReference: t2.spatialReference, scales: [t2.scale] }), a = new h(r2), p = a.getTileCoverage(t2);
  103. if (!p)
  104. return null;
  105. const m = [];
  106. return p.forEach((r3, p2, n3, l) => {
  107. f.set(r3, p2, n3, l), a.getTileBounds(u3, f);
  108. const d2 = new M(u3[0], u3[1], u3[2], u3[3], t2.spatialReference);
  109. m.push(this._export(d2, e3, e3, 0, i, o));
  110. }), Promise.all(m);
  111. }
  112. };
  113. e([d()], y2.prototype, "_imagePromise", void 0), e([d()], y2.prototype, "bitmaps", void 0), e([d()], y2.prototype, "container", void 0), e([d()], y2.prototype, "fetchSource", void 0), e([d()], y2.prototype, "hidpi", void 0), e([d()], y2.prototype, "imageMaxWidth", void 0), e([d()], y2.prototype, "imageMaxHeight", void 0), e([d()], y2.prototype, "imageRotationSupported", void 0), e([d()], y2.prototype, "imageNormalizationSupported", void 0), e([d()], y2.prototype, "requestUpdate", void 0), e([d()], y2.prototype, "updating", null), y2 = e([n("esri.views.2d.layers.support.ExportStrategy")], y2);
  114. var S2 = y2;
  115. export {
  116. S2 as S
  117. };
  118. //# sourceMappingURL=chunk-GONLHNIL.js.map