chunk-JJ4RRNEA.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. import {
  2. i
  3. } from "./chunk-QU433TMZ.js";
  4. import {
  5. l
  6. } from "./chunk-JQUWFKNU.js";
  7. import {
  8. n as n2
  9. } from "./chunk-CC74Y7ET.js";
  10. import {
  11. e
  12. } from "./chunk-TFHLTN6F.js";
  13. import {
  14. n
  15. } from "./chunk-IM3LVQXV.js";
  16. import {
  17. has
  18. } from "./chunk-SPWQ3AWG.js";
  19. // node_modules/@arcgis/core/views/2d/layers/features/support/TileStore.js
  20. var h = { added: [], removed: [] };
  21. var n3 = /* @__PURE__ */ new Set();
  22. var r = new e(0, 0, 0, 0);
  23. var d = class extends n {
  24. constructor(e2) {
  25. super(), this._tiles = /* @__PURE__ */ new Map(), this._index = i(9, has("esri-csp-restrictions") ? (e3) => ({ minX: e3.bounds[0], minY: e3.bounds[1], maxX: e3.bounds[2], maxY: e3.bounds[3] }) : [".bounds[0]", ".bounds[1]", ".bounds[2]", ".bounds[3]"]), this.tiles = [], this.tileScheme = e2;
  26. }
  27. destroy() {
  28. this.clear();
  29. }
  30. clear() {
  31. this.tiles.length = 0, this._tiles.clear(), this._index.clear();
  32. }
  33. has(e2) {
  34. return this._tiles.has(e2);
  35. }
  36. get(e2) {
  37. return this._tiles.get(e2);
  38. }
  39. boundsIntersections(e2) {
  40. return this._index.search({ minX: e2[0], minY: e2[1], maxX: e2[2], maxY: e2[3] });
  41. }
  42. updateTiles(e2) {
  43. const t = { added: [], removed: [] };
  44. for (const i2 of e2.added)
  45. if (!this.has(i2)) {
  46. const e3 = new n2(this.tileScheme, i2);
  47. this._tiles.set(i2, e3), this._index.insert(e3), t.added.push(e3);
  48. }
  49. for (const s of e2.removed)
  50. if (this.has(s)) {
  51. const e3 = this.get(s);
  52. this._tiles.delete(s), this._index.remove(e3), t.removed.push(e3);
  53. }
  54. this.tiles.length = 0, this._tiles.forEach((e3) => this.tiles.push(e3)), (t.added.length || t.removed.length) && this.emit("update", t);
  55. }
  56. setViewState(e2) {
  57. const t = this.tileScheme.getTileCoverage(e2, 0);
  58. if (!t)
  59. return;
  60. const { spans: o, lodInfo: d2 } = t, { level: l2 } = d2;
  61. if (o.length > 0)
  62. for (const { row: i2, colFrom: a, colTo: m } of o)
  63. for (let e3 = a; e3 <= m; e3++) {
  64. const t2 = r.set(l2, i2, d2.normalizeCol(e3), d2.getWorldForColumn(e3)).id;
  65. if (n3.add(t2), !this.has(t2)) {
  66. const e4 = new n2(this.tileScheme, t2);
  67. this._tiles.set(t2, e4), this._index.insert(e4), this.tiles.push(e4), h.added.push(e4);
  68. }
  69. }
  70. for (let s = this.tiles.length - 1; s >= 0; s--) {
  71. const e3 = this.tiles[s];
  72. n3.has(e3.id) || (this._tiles.delete(e3.id), this.tiles.splice(s, 1), this._index.remove(e3), h.removed.push(e3));
  73. }
  74. (h.added.length || h.removed.length) && this.emit("update", h), l.pool.release(t), n3.clear(), h.added.length = 0, h.removed.length = 0;
  75. }
  76. };
  77. export {
  78. d
  79. };
  80. //# sourceMappingURL=chunk-JJ4RRNEA.js.map