WMTSLayerView2D-6YJOJ6Y7.js 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. import {
  2. n as n2,
  3. r as r2
  4. } from "./chunk-22J3OQXH.js";
  5. import "./chunk-W4JJD2VH.js";
  6. import "./chunk-6G6XHVK2.js";
  7. import "./chunk-TWB5CT7V.js";
  8. import "./chunk-H3QCF24A.js";
  9. import {
  10. i
  11. } from "./chunk-EAUVYZHD.js";
  12. import {
  13. f,
  14. u
  15. } from "./chunk-MNZXIBJ7.js";
  16. import "./chunk-YJKEIUMW.js";
  17. import "./chunk-JH3PLIM6.js";
  18. import "./chunk-FCDUTNBY.js";
  19. import "./chunk-LL6JU3GU.js";
  20. import "./chunk-ZIWBDWEW.js";
  21. import "./chunk-IQNZZCQJ.js";
  22. import "./chunk-Q4LKAPDF.js";
  23. import "./chunk-TODU7HVH.js";
  24. import "./chunk-23ONSYIH.js";
  25. import "./chunk-3T4BXU2T.js";
  26. import "./chunk-YLVXZ2PS.js";
  27. import "./chunk-EE6TL7XD.js";
  28. import "./chunk-GDB2KX4Y.js";
  29. import "./chunk-546QCRS4.js";
  30. import "./chunk-QXZVBSBH.js";
  31. import "./chunk-773XI6MQ.js";
  32. import "./chunk-WFSV2B2I.js";
  33. import "./chunk-J525NRN3.js";
  34. import "./chunk-MI7HWWFL.js";
  35. import "./chunk-ZHRMTKME.js";
  36. import {
  37. r
  38. } from "./chunk-PCGDLSZ4.js";
  39. import {
  40. p
  41. } from "./chunk-CAYFEZCR.js";
  42. import "./chunk-MFFE4I2S.js";
  43. import "./chunk-LMCIAW5S.js";
  44. import {
  45. h
  46. } from "./chunk-OTS3UE5B.js";
  47. import "./chunk-6RAL4JPQ.js";
  48. import "./chunk-LGW7TID4.js";
  49. import "./chunk-3OHML7FO.js";
  50. import "./chunk-G5AI6ZNE.js";
  51. import {
  52. e as e2
  53. } from "./chunk-FIYKFRB2.js";
  54. import "./chunk-FYNVVMWY.js";
  55. import "./chunk-Q52DVFYK.js";
  56. import "./chunk-HBMVUVZX.js";
  57. import "./chunk-CRGVDJI6.js";
  58. import "./chunk-6P6NA7JB.js";
  59. import "./chunk-XLV7RUSE.js";
  60. import "./chunk-NTUXR253.js";
  61. import "./chunk-RMX2AZ4P.js";
  62. import "./chunk-NE3ESGA6.js";
  63. import {
  64. l
  65. } from "./chunk-YIS6BAC3.js";
  66. import "./chunk-7XXXCK2A.js";
  67. import "./chunk-WJW5DUN6.js";
  68. import "./chunk-PJ7ZQ4VD.js";
  69. import "./chunk-WDLTDV2L.js";
  70. import "./chunk-TERAW6FT.js";
  71. import "./chunk-N2663GRX.js";
  72. import "./chunk-WEMIK25H.js";
  73. import "./chunk-7N4X6GF3.js";
  74. import "./chunk-JXW4QTJA.js";
  75. import "./chunk-UXF37FQ4.js";
  76. import "./chunk-ZOEK6QHJ.js";
  77. import "./chunk-XNLG7T2T.js";
  78. import "./chunk-IR4PV7VK.js";
  79. import "./chunk-2Z6LERTI.js";
  80. import "./chunk-OWVBLVP3.js";
  81. import "./chunk-AFZ7XSEW.js";
  82. import "./chunk-YBSUITLL.js";
  83. import "./chunk-ALDCDSPV.js";
  84. import "./chunk-DT6EAZQ5.js";
  85. import "./chunk-HNOZUNJ4.js";
  86. import "./chunk-PDKDCAAD.js";
  87. import "./chunk-ECW2QABR.js";
  88. import "./chunk-GCDJLKH4.js";
  89. import {
  90. E
  91. } from "./chunk-MRJEICT6.js";
  92. import {
  93. d,
  94. e,
  95. n2 as n
  96. } from "./chunk-Y3WMVFTW.js";
  97. import "./chunk-SAS7RONY.js";
  98. import "./chunk-WSRBH7BF.js";
  99. import "./chunk-IHXECKQQ.js";
  100. import {
  101. g
  102. } from "./chunk-ULGDPLM2.js";
  103. import {
  104. s
  105. } from "./chunk-EMJ4ZSM2.js";
  106. import "./chunk-IKP3YN53.js";
  107. import "./chunk-GZT4BVFP.js";
  108. import "./chunk-A5ICIBVI.js";
  109. // node_modules/@arcgis/core/views/2d/layers/WMTSLayerView2D.js
  110. var y = [102113, 102100, 3857, 3785, 900913];
  111. var _ = [0, 0];
  112. var w = s.getLogger("esri.views.2d.layers.WMTSLayerView2D");
  113. var g2 = class extends i(r2(f(u))) {
  114. constructor() {
  115. super(...arguments), this._tileStrategy = null, this._fetchQueue = null, this._tileRequests = new Map(), this.layer = null;
  116. }
  117. get tileMatrixSet() {
  118. const e3 = this._getTileMatrixSetBySpatialReference(this.layer.activeLayer);
  119. return e3 ? (e3.id !== this.layer.activeLayer.tileMatrixSetId && (this.layer.activeLayer.tileMatrixSetId = e3.id), e3) : null;
  120. }
  121. update(e3) {
  122. this._fetchQueue.pause(), this._fetchQueue.state = e3.state, this._tileStrategy.update(e3), this._fetchQueue.resume();
  123. }
  124. attach() {
  125. if (!this.tileMatrixSet)
  126. return;
  127. const { tileInfo: e3 } = this.tileMatrixSet;
  128. this._tileInfoView = new h(e3), this._fetchQueue = new p({ tileInfoView: this._tileInfoView, concurrency: 16, process: (e4, t) => this.fetchTile(e4, t) }), this._tileStrategy = new r({ cachePolicy: "keep", resampling: true, acquireTile: (e4) => this.acquireTile(e4), releaseTile: (e4) => this.releaseTile(e4), tileInfoView: this._tileInfoView }), this.handles.add(l(() => [this.layer?.activeLayer?.styleId, this.tileMatrixSet], () => this._refresh()), this.declaredClass), super.attach();
  129. }
  130. detach() {
  131. super.detach(), this.handles.remove(this.declaredClass), this._tileStrategy?.destroy(), this._fetchQueue?.destroy(), this._fetchQueue = this._tileStrategy = this._tileInfoView = null;
  132. }
  133. moveStart() {
  134. this.requestUpdate();
  135. }
  136. viewChange() {
  137. this.requestUpdate();
  138. }
  139. moveEnd() {
  140. this.requestUpdate();
  141. }
  142. releaseTile(e3) {
  143. this._fetchQueue.abort(e3.key.id), this._bitmapView.removeChild(e3), e3.once("detach", () => e3.destroy()), this.requestUpdate();
  144. }
  145. acquireTile(e3) {
  146. const t = this._bitmapView.createTile(e3), i2 = t.bitmap;
  147. return [i2.x, i2.y] = this._tileInfoView.getTileCoords(_, t.key), i2.resolution = this._tileInfoView.getTileResolution(t.key), [i2.width, i2.height] = this._tileInfoView.tileInfo.size, this._enqueueTileFetch(t), this._bitmapView.addChild(t), this.requestUpdate(), t;
  148. }
  149. async doRefresh() {
  150. this.updateRequested || this.suspended || this._refresh();
  151. }
  152. isUpdating() {
  153. return this._fetchQueue?.updating ?? false;
  154. }
  155. async fetchTile(e3, t = {}) {
  156. const s2 = "tilemapCache" in this.layer ? this.layer.tilemapCache : null, { signal: r3, resamplingLevel: a = 0 } = t;
  157. if (!s2)
  158. return this._fetchImage(e3, r3);
  159. const l2 = new e2(0, 0, 0, 0);
  160. let o;
  161. try {
  162. await s2.fetchAvailabilityUpsample(e3.level, e3.row, e3.col, l2, { signal: r3 }), o = await this._fetchImage(l2, r3);
  163. } catch (h2) {
  164. if (g(h2))
  165. throw h2;
  166. if (a < 3) {
  167. const i2 = this._tileInfoView.getTileParentId(e3.id);
  168. if (i2) {
  169. const s3 = new e2(i2), r4 = await this.fetchTile(s3, { ...t, resamplingLevel: a + 1 });
  170. return n2(this._tileInfoView, r4, s3, e3);
  171. }
  172. }
  173. throw h2;
  174. }
  175. return n2(this._tileInfoView, o, l2, e3);
  176. }
  177. canResume() {
  178. const e3 = super.canResume();
  179. return e3 ? this.tileMatrixSet !== null : e3;
  180. }
  181. supportsSpatialReference(e3) {
  182. return this.layer.activeLayer.tileMatrixSets.some((t) => E(t.tileInfo.spatialReference, e3));
  183. }
  184. async _enqueueTileFetch(e3) {
  185. if (!this._fetchQueue.has(e3.key.id)) {
  186. try {
  187. const t = await this._fetchQueue.push(e3.key);
  188. e3.bitmap.source = t, e3.bitmap.width = this._tileInfoView.tileInfo.size[0], e3.bitmap.height = this._tileInfoView.tileInfo.size[1], e3.once("attach", () => this.requestUpdate());
  189. } catch (t) {
  190. g(t) || w.error(t);
  191. }
  192. this.requestUpdate();
  193. }
  194. }
  195. async _fetchImage(e3, t) {
  196. return this.layer.fetchTile(e3.level, e3.row, e3.col, { signal: t });
  197. }
  198. _refresh() {
  199. this._fetchQueue.reset(), this._tileStrategy.tiles.forEach((e3) => {
  200. if (!e3.bitmap.source)
  201. return;
  202. const t = { id: e3.key.id, fulfilled: false, promise: this._fetchQueue.push(e3.key).then((t2) => {
  203. e3.bitmap.source = t2;
  204. }).catch((t2) => {
  205. g(t2) || (e3.bitmap.source = null);
  206. }).finally(() => {
  207. e3.requestRender(), t.fulfilled = true;
  208. }) };
  209. this._tileRequests.set(e3, t);
  210. });
  211. }
  212. _getTileMatrixSetBySpatialReference(e3) {
  213. const t = this.view.spatialReference;
  214. if (!e3.tileMatrixSets)
  215. return null;
  216. let i2 = e3.tileMatrixSets.find((e4) => E(e4.tileInfo.spatialReference, t));
  217. return !i2 && t.isWebMercator && (i2 = e3.tileMatrixSets.find((e4) => y.includes(e4.tileInfo.spatialReference.wkid))), i2;
  218. }
  219. };
  220. e([d()], g2.prototype, "_fetchQueue", void 0), e([d({ readOnly: true })], g2.prototype, "tileMatrixSet", null), g2 = e([n("esri.views.2d.layers.WMTSLayerView2D")], g2);
  221. var S = g2;
  222. export {
  223. S as default
  224. };
  225. //# sourceMappingURL=WMTSLayerView2D-6YJOJ6Y7.js.map