123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- import {
- l
- } from "./chunk-LMCIAW5S.js";
- import {
- m
- } from "./chunk-6P6NA7JB.js";
- import {
- d,
- e,
- n2 as n,
- y3 as y
- } from "./chunk-Y3WMVFTW.js";
- // node_modules/@arcgis/core/views/2d/tiling/PagedTileQueue.js
- function n2(e2, t) {
- return e2.length = 0, t.forEach((t2) => e2.push(t2)), e2;
- }
- var u = new Set();
- var a = [];
- var c = new Map();
- var h = [0, 0];
- var l2 = class extends y {
- constructor(e2) {
- super(e2), this._keyToItem = new Map(), this.concurrency = 6, this.strategy = "scale-first", this.tileInfoView = null;
- }
- initialize() {
- const { concurrency: e2, process: t } = this;
- this._queue = new l({ concurrency: e2, process: (e3, s) => {
- const r = this._keyToItem.get(e3);
- return t(r, { signal: s });
- }, peeker: (e3) => e3.values().next().value });
- }
- destroy() {
- this.clear(), this._queue.destroy(), this._queue = null;
- }
- get length() {
- return this._queue ? this._queue.length : 0;
- }
- get onGoingCount() {
- return this._keyToItem.size;
- }
- get updating() {
- return this.length > 0 || this.onGoingCount > 0;
- }
- abort(e2) {
- const t = typeof e2 == "string" ? e2 : e2.id;
- this._queue.abort(t);
- }
- clear() {
- this._queue.clear(), this._keyToItem.clear(), this.notifyChange("updating");
- }
- has(e2) {
- return typeof e2 == "string" ? this._keyToItem.has(e2) : this._keyToItem.has(e2.id);
- }
- isOngoing(e2) {
- const t = typeof e2 == "string" ? e2 : e2.id;
- return this.has(t) && this._queue.isOngoing(t);
- }
- pause() {
- this._queue.pause();
- }
- push(e2, t) {
- const s = e2.key.id + "-" + t;
- if (this.has(s))
- return this.get(s);
- const r = this._queue.push(s), o = () => {
- this._keyToItem.delete(s), this.notifyChange("updating");
- };
- return this._keyToItem.set(s, e2), r.then(o, o), this.notifyChange("updating"), r;
- }
- reset() {
- this._queue.reset(), this.notifyChange("updating");
- }
- resume() {
- this._queue.resume();
- }
- _peekByScaleFirst(e2) {
- if (!this.state)
- return e2.values().next().value;
- const t = this.tileInfoView;
- let s = Number.NEGATIVE_INFINITY, r = Number.POSITIVE_INFINITY;
- e2.forEach((e3) => {
- const t2 = this._keyToItem.get(e3), o2 = this.tileInfoView.getTileScale(t2.key);
- c.has(o2) || (c.set(o2, []), s = Math.max(o2, s), r = Math.min(o2, r)), c.get(o2).push(t2.key), u.add(o2);
- });
- let o = this.state.scale;
- c.has(o) || (n2(a, u), a.sort((e3, t2) => e3 - t2), o = a.reduce((e3, t2) => Math.abs(t2 - o) < Math.abs(e3 - o) ? t2 : e3, a[0])), o = Math.min(o, s), o = Math.max(o, r);
- const i = c.get(o), h2 = t.getClosestInfoForScale(o), l3 = h2.getColumnForX(this.state.center[0]), p = h2.getRowForY(this.state.center[1]);
- return i.sort((e3, t2) => {
- const s2 = h2.denormalizeCol(e3.col, e3.world), r2 = h2.denormalizeCol(t2.col, t2.world);
- return Math.sqrt((l3 - s2) * (l3 - s2) + (p - e3.row) * (p - e3.row)) - Math.sqrt((l3 - r2) * (l3 - r2) + (p - t2.row) * (p - t2.row));
- }), u.clear(), c.clear(), i[0].id;
- }
- _peekByCenterFirst(e2) {
- if (!this.state)
- return e2.values().next().value;
- const t = this.tileInfoView, s = this.state.center;
- let r = Number.POSITIVE_INFINITY, i = null;
- return e2.forEach((e3) => {
- const n3 = this._keyToItem.get(e3);
- t.getTileCoords(h, n3.key);
- const u2 = m(h, s);
- u2 < r && (r = u2, i = n3.key);
- }), i.id;
- }
- };
- e([d({ constructOnly: true })], l2.prototype, "concurrency", void 0), e([d({ constructOnly: true })], l2.prototype, "process", void 0), e([d()], l2.prototype, "state", void 0), e([d({ constructOnly: true })], l2.prototype, "strategy", void 0), e([d({ constructOnly: true })], l2.prototype, "tileInfoView", void 0), e([d({ readOnly: true })], l2.prototype, "updating", null), l2 = e([n("esri.views.2d.tiling.PagedTileQueue")], l2);
- //# sourceMappingURL=chunk-ZVHTCCQC.js.map
|