123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- import {
- R as R2
- } from "./chunk-O6KMIRUU.js";
- import {
- h
- } from "./chunk-VQXMCZYH.js";
- import {
- e as e2
- } from "./chunk-TFHLTN6F.js";
- import {
- j
- } from "./chunk-YLEVJ6UV.js";
- import {
- f as f2,
- u
- } from "./chunk-2H5MD622.js";
- import {
- R
- } from "./chunk-PQFTYGF5.js";
- import {
- e,
- m,
- n5 as n,
- y3 as y
- } from "./chunk-2Z2TG5CU.js";
- import {
- E,
- f,
- w,
- x
- } from "./chunk-V6P2MAQQ.js";
- // node_modules/@arcgis/core/views/2d/viewStateUtils.js
- var t = Math.PI / 180;
- function n2(n3) {
- return n3 * t;
- }
- function o(t2, o2) {
- const a2 = n2(o2.rotation), r = Math.abs(Math.cos(a2)), s = Math.abs(Math.sin(a2)), [u2, c] = o2.size;
- return t2[0] = Math.round(c * s + u2 * r), t2[1] = Math.round(c * r + u2 * s), t2;
- }
- function a(t2, n3, o2, a2) {
- const [r, s] = n3, [u2, c] = a2, h2 = 0.5 * o2;
- return t2[0] = r - h2 * u2, t2[1] = s - h2 * c, t2[2] = r + h2 * u2, t2[3] = s + h2 * c, t2;
- }
- // node_modules/@arcgis/core/views/2d/layers/support/ExportStrategy.js
- var y2 = u();
- var x2 = [0, 0];
- var S = new e2(0, 0, 0, 0);
- var _ = { container: null, fetchSource: null, requestUpdate: null, imageMaxWidth: 2048, imageMaxHeight: 2048, imageRotationSupported: false, imageNormalizationSupported: false, hidpi: false };
- var w2 = class extends m {
- constructor(t2) {
- super(t2), this._imagePromise = null, this.bitmaps = [], this.hidpi = _.hidpi, this.imageMaxWidth = _.imageMaxWidth, this.imageMaxHeight = _.imageMaxHeight, this.imageRotationSupported = _.imageRotationSupported, this.imageNormalizationSupported = _.imageNormalizationSupported, this.update = x(async (t3, e3) => {
- if (f(e3), !t3.stationary || this.destroyed)
- return;
- const i = t3.state, s = R(i.spatialReference), a2 = this.hidpi ? t3.pixelRatio : 1, n3 = this.imageNormalizationSupported && i.worldScreenWidth && i.worldScreenWidth < i.size[0];
- n3 ? (x2[0] = i.worldScreenWidth, x2[1] = i.size[1]) : this.imageRotationSupported ? (x2[0] = i.size[0], x2[1] = i.size[1]) : o(x2, i);
- const p = Math.floor(x2[0] * a2) > this.imageMaxWidth || Math.floor(x2[1] * a2) > this.imageMaxHeight, m2 = s && (i.extent.xmin < s.valid[0] || i.extent.xmax > s.valid[1]), h2 = !this.imageNormalizationSupported && m2, c = !p && !h2, u2 = this.imageRotationSupported ? i.rotation : 0, g = this.container.children.slice();
- if (c) {
- const t4 = n3 ? i.paddedViewState.center : i.center;
- this._imagePromise && console.error("Image promise was not defined!"), this._imagePromise = this._singleExport(i, x2, t4, i.resolution, u2, a2, e3);
- } else {
- let t4 = Math.min(this.imageMaxWidth, this.imageMaxHeight);
- h2 && (t4 = Math.min(i.worldScreenWidth, t4)), this._imagePromise = this._tiledExport(i, t4, a2, e3);
- }
- try {
- const t4 = await this._imagePromise;
- f(e3);
- const i2 = [];
- if (this._imagePromise = null, this.destroyed)
- return;
- this.bitmaps = t4 != null ? t4 : [];
- for (const e4 of g)
- t4.includes(e4) || i2.push(e4.fadeOut().then(() => {
- e4.remove(), e4.destroy();
- }));
- for (const e4 of t4)
- i2.push(e4.fadeIn());
- await Promise.all(i2);
- } catch (f3) {
- this._imagePromise = null, w(f3);
- }
- }, 5e3), this.updateExports = x(async (t3) => {
- const e3 = [];
- for (const i of this.container.children) {
- if (!i.visible || !i.stage)
- return;
- e3.push(t3(i).then(() => {
- i.invalidateTexture(), i.requestRender();
- }));
- }
- this._imagePromise = E(e3).then(() => this._imagePromise = null), await this._imagePromise;
- });
- }
- destroy() {
- this.bitmaps.forEach((t2) => t2.destroy()), this.bitmaps = [];
- }
- get updating() {
- return !this.destroyed && null !== this._imagePromise;
- }
- async _export(t2, e3, i, r, s, a2) {
- const n3 = await this.fetchSource(t2, Math.floor(e3 * s), Math.floor(i * s), { rotation: r, pixelRatio: s, signal: a2 });
- f(a2);
- const p = new R2(null, { immutable: true, requestRenderOnSourceChangedEnabled: true });
- return p.x = t2.xmin, p.y = t2.ymax, p.resolution = t2.width / e3, p.rotation = r, p.pixelRatio = s, p.opacity = 0, this.container.addChild(p), await p.setSourceAsync(n3, a2), f(a2), p;
- }
- async _singleExport(t2, e3, i, o2, r, s, a2) {
- a(y2, i, o2, e3);
- const n3 = f2(y2, t2.spatialReference);
- return [await this._export(n3, e3[0], e3[1], r, s, a2)];
- }
- _tiledExport(t2, e3, i, o2) {
- const r = j.create({ size: e3, spatialReference: t2.spatialReference, scales: [t2.scale] }), s = new h(r), a2 = s.getTileCoverage(t2);
- if (!a2)
- return null;
- const n3 = [];
- return a2.forEach((r2, a3, p, l) => {
- S.set(r2, a3, p, 0), s.getTileBounds(y2, S);
- const h2 = f2(y2, t2.spatialReference);
- n3.push(this._export(h2, e3, e3, 0, i, o2).then((t3) => (0 !== l && (S.set(r2, a3, p, l), s.getTileBounds(y2, S), t3.x = y2[0], t3.y = y2[3]), t3)));
- }), Promise.all(n3);
- }
- };
- e([y()], w2.prototype, "_imagePromise", void 0), e([y()], w2.prototype, "bitmaps", void 0), e([y()], w2.prototype, "container", void 0), e([y()], w2.prototype, "fetchSource", void 0), e([y()], w2.prototype, "hidpi", void 0), e([y()], w2.prototype, "imageMaxWidth", void 0), e([y()], w2.prototype, "imageMaxHeight", void 0), e([y()], w2.prototype, "imageRotationSupported", void 0), e([y()], w2.prototype, "imageNormalizationSupported", void 0), e([y()], w2.prototype, "requestUpdate", void 0), e([y()], w2.prototype, "updating", null), w2 = e([n("esri.views.2d.layers.support.ExportStrategy")], w2);
- var v = w2;
- export {
- v
- };
- //# sourceMappingURL=chunk-NAWSWIYX.js.map
|