chunk-TYZ4SNOQ.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. import {
  2. l
  3. } from "./chunk-6RAL4JPQ.js";
  4. import {
  5. i
  6. } from "./chunk-VAY3LZG7.js";
  7. import {
  8. n as n2
  9. } from "./chunk-H6ETEALK.js";
  10. import {
  11. e
  12. } from "./chunk-FIYKFRB2.js";
  13. import {
  14. n
  15. } from "./chunk-DT6EAZQ5.js";
  16. import {
  17. a
  18. } from "./chunk-GZT4BVFP.js";
  19. // node_modules/@arcgis/core/views/2d/layers/features/support/TileStore.js
  20. var n3 = { added: [], removed: [] };
  21. var r = new Set();
  22. var d = new e(0, 0, 0, 0);
  23. var l2 = class extends n {
  24. constructor(e2) {
  25. super(), this._tiles = new Map(), this._index = i(9, a("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 s of e2.added)
  45. if (!this.has(s)) {
  46. const e3 = new n2(this.tileScheme, s);
  47. this._tiles.set(s, 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: s, lodInfo: h } = t, { level: l3 } = h;
  61. if (s.length > 0)
  62. for (const { row: o, colFrom: a2, colTo: m } of s)
  63. for (let e3 = a2; e3 <= m; e3++) {
  64. const t2 = d.set(l3, o, h.normalizeCol(e3), h.getWorldForColumn(e3)).id;
  65. if (r.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), n3.added.push(e4);
  68. }
  69. }
  70. for (let i2 = this.tiles.length - 1; i2 >= 0; i2--) {
  71. const e3 = this.tiles[i2];
  72. r.has(e3.id) || (this._tiles.delete(e3.id), this.tiles.splice(i2, 1), this._index.remove(e3), n3.removed.push(e3));
  73. }
  74. (n3.added.length || n3.removed.length) && this.emit("update", n3), l.pool.release(t), r.clear(), n3.added.length = 0, n3.removed.length = 0;
  75. }
  76. };
  77. export {
  78. l2 as l
  79. };
  80. //# sourceMappingURL=chunk-TYZ4SNOQ.js.map