WMTSLayerView2D-2M4XG2BY.js 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. import {
  2. n as n2,
  3. t
  4. } from "./chunk-PVFGZTPJ.js";
  5. import "./chunk-TJ4DVYZ7.js";
  6. import "./chunk-E5TKVDJT.js";
  7. import "./chunk-O6KMIRUU.js";
  8. import "./chunk-264YGWEE.js";
  9. import {
  10. i
  11. } from "./chunk-YG7DNOY4.js";
  12. import {
  13. u,
  14. y as y3
  15. } from "./chunk-KUAEOLV3.js";
  16. import "./chunk-ZLQP3WDC.js";
  17. import "./chunk-JBMHQ5RK.js";
  18. import "./chunk-WBWQJQK4.js";
  19. import "./chunk-TDS6IBMU.js";
  20. import "./chunk-DBT4KOKX.js";
  21. import "./chunk-2GP5D74I.js";
  22. import "./chunk-EPMXCACW.js";
  23. import "./chunk-UWKVAZQ6.js";
  24. import "./chunk-T2SKWJGU.js";
  25. import "./chunk-UO3LS2M5.js";
  26. import "./chunk-H2VOWDMO.js";
  27. import "./chunk-QISOH77W.js";
  28. import "./chunk-XO5VJRK4.js";
  29. import "./chunk-3WXSWAUV.js";
  30. import "./chunk-27YO3FKC.js";
  31. import "./chunk-EQNT4A7P.js";
  32. import "./chunk-4OM3EX6P.js";
  33. import "./chunk-3OFVLRSL.js";
  34. import "./chunk-IQBIGNPU.js";
  35. import "./chunk-K7B6OWCU.js";
  36. import {
  37. r
  38. } from "./chunk-WNPL3C7R.js";
  39. import {
  40. y as y2
  41. } from "./chunk-E7ZLMIQ7.js";
  42. import "./chunk-UDYHZLTE.js";
  43. import "./chunk-QC7NCR5N.js";
  44. import {
  45. h
  46. } from "./chunk-VQXMCZYH.js";
  47. import "./chunk-JQUWFKNU.js";
  48. import "./chunk-RWQH5X3O.js";
  49. import "./chunk-6334AFGG.js";
  50. import {
  51. e as e2
  52. } from "./chunk-TFHLTN6F.js";
  53. import "./chunk-O3JQY77G.js";
  54. import "./chunk-E3G7BRZB.js";
  55. import "./chunk-JKFWEHNK.js";
  56. import "./chunk-EDHROVWI.js";
  57. import "./chunk-3IRT3YKJ.js";
  58. import "./chunk-YZVAB3DF.js";
  59. import "./chunk-PJNBFKPF.js";
  60. import "./chunk-C7742RNZ.js";
  61. import {
  62. l
  63. } from "./chunk-TJV6ODRM.js";
  64. import "./chunk-3WQOA5CB.js";
  65. import "./chunk-FZQZIM7U.js";
  66. import "./chunk-CZBRZ6SU.js";
  67. import "./chunk-VGWC3IKZ.js";
  68. import "./chunk-2H5MD622.js";
  69. import "./chunk-UVVU4UUO.js";
  70. import "./chunk-X4SA4ELJ.js";
  71. import "./chunk-ZAY3CMAZ.js";
  72. import "./chunk-3GZSQU56.js";
  73. import "./chunk-ZYRIJWLX.js";
  74. import "./chunk-RYY6632W.js";
  75. import "./chunk-DW42UVIT.js";
  76. import "./chunk-YAEIHDJH.js";
  77. import "./chunk-TJNOJH33.js";
  78. import "./chunk-OSHI574D.js";
  79. import "./chunk-ETGAZ7LF.js";
  80. import "./chunk-75U5LM2V.js";
  81. import "./chunk-RMDDCMKS.js";
  82. import "./chunk-VCH45Q2I.js";
  83. import "./chunk-LBW34VZ2.js";
  84. import "./chunk-GSSTTHIT.js";
  85. import "./chunk-IM3LVQXV.js";
  86. import "./chunk-55RWC67C.js";
  87. import "./chunk-HZRKBTHJ.js";
  88. import "./chunk-6T6G6LCQ.js";
  89. import "./chunk-YEJL5NEF.js";
  90. import {
  91. E
  92. } from "./chunk-PQFTYGF5.js";
  93. import {
  94. e,
  95. n5 as n,
  96. y3 as y
  97. } from "./chunk-2Z2TG5CU.js";
  98. import "./chunk-6KZ2LTDA.js";
  99. import "./chunk-U2XHEJM7.js";
  100. import "./chunk-SQOPWYIT.js";
  101. import {
  102. j
  103. } from "./chunk-V6P2MAQQ.js";
  104. import {
  105. s2 as s
  106. } from "./chunk-E5O6P5I2.js";
  107. import "./chunk-SPWQ3AWG.js";
  108. import "./chunk-2TIUKVZN.js";
  109. import "./chunk-YXWMMD76.js";
  110. import "./chunk-S5KM4IGW.js";
  111. // node_modules/@arcgis/core/views/2d/layers/WMTSLayerView2D.js
  112. var y4 = [102113, 102100, 3857, 3785, 900913];
  113. var _ = [0, 0];
  114. var w = class extends i(t(y3(u))) {
  115. constructor() {
  116. super(...arguments), this._tileStrategy = null, this._fetchQueue = null, this._tileRequests = /* @__PURE__ */ new Map(), this.layer = null;
  117. }
  118. get tileMatrixSet() {
  119. const e3 = this._getTileMatrixSetBySpatialReference(this.layer.activeLayer);
  120. return e3 ? (e3.id !== this.layer.activeLayer.tileMatrixSetId && (this.layer.activeLayer.tileMatrixSetId = e3.id), e3) : null;
  121. }
  122. update(e3) {
  123. this._fetchQueue.pause(), this._fetchQueue.state = e3.state, this._tileStrategy.update(e3), this._fetchQueue.resume();
  124. }
  125. attach() {
  126. if (!this.tileMatrixSet)
  127. return;
  128. const { tileInfo: e3 } = this.tileMatrixSet;
  129. this._tileInfoView = new h(e3), this._fetchQueue = new y2({ tileInfoView: this._tileInfoView, concurrency: 16, process: (e4, t2) => this.fetchTile(e4, t2) }), 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(() => {
  130. var _a, _b;
  131. return [(_b = (_a = this.layer) == null ? void 0 : _a.activeLayer) == null ? void 0 : _b.styleId, this.tileMatrixSet];
  132. }, () => this._refresh()), this.declaredClass), super.attach();
  133. }
  134. detach() {
  135. var _a, _b;
  136. super.detach(), this.handles.remove(this.declaredClass), (_a = this._tileStrategy) == null ? void 0 : _a.destroy(), (_b = this._fetchQueue) == null ? void 0 : _b.destroy(), this._fetchQueue = this._tileStrategy = this._tileInfoView = null;
  137. }
  138. moveStart() {
  139. this.requestUpdate();
  140. }
  141. viewChange() {
  142. this.requestUpdate();
  143. }
  144. moveEnd() {
  145. this.requestUpdate();
  146. }
  147. releaseTile(e3) {
  148. this._fetchQueue.abort(e3.key.id), this._bitmapView.removeChild(e3), e3.once("detach", () => e3.destroy()), this.requestUpdate();
  149. }
  150. acquireTile(e3) {
  151. const t2 = this._bitmapView.createTile(e3), i2 = t2.bitmap;
  152. return [i2.x, i2.y] = this._tileInfoView.getTileCoords(_, t2.key), i2.resolution = this._tileInfoView.getTileResolution(t2.key), [i2.width, i2.height] = this._tileInfoView.tileInfo.size, this._enqueueTileFetch(t2), this._bitmapView.addChild(t2), this.requestUpdate(), t2;
  153. }
  154. async doRefresh() {
  155. !this.attached || this.updateRequested || this.suspended || this._refresh();
  156. }
  157. isUpdating() {
  158. var _a, _b;
  159. return (_b = (_a = this._fetchQueue) == null ? void 0 : _a.updating) != null ? _b : false;
  160. }
  161. async fetchTile(e3, t2 = {}) {
  162. const s2 = "tilemapCache" in this.layer ? this.layer.tilemapCache : null, { signal: r2, resamplingLevel: a = 0 } = t2;
  163. if (!s2)
  164. return this._fetchImage(e3, r2);
  165. const l2 = new e2(0, 0, 0, 0);
  166. let o;
  167. try {
  168. await s2.fetchAvailabilityUpsample(e3.level, e3.row, e3.col, l2, { signal: r2 }), o = await this._fetchImage(l2, r2);
  169. } catch (h2) {
  170. if (j(h2))
  171. throw h2;
  172. if (a < 3) {
  173. const i2 = this._tileInfoView.getTileParentId(e3.id);
  174. if (i2) {
  175. const s3 = new e2(i2), r3 = await this.fetchTile(s3, { ...t2, resamplingLevel: a + 1 });
  176. return n2(this._tileInfoView, r3, s3, e3);
  177. }
  178. }
  179. throw h2;
  180. }
  181. return n2(this._tileInfoView, o, l2, e3);
  182. }
  183. canResume() {
  184. const e3 = super.canResume();
  185. return e3 ? null !== this.tileMatrixSet : e3;
  186. }
  187. supportsSpatialReference(e3) {
  188. return this.layer.activeLayer.tileMatrixSets.some((t2) => E(t2.tileInfo.spatialReference, e3));
  189. }
  190. async _enqueueTileFetch(e3) {
  191. if (!this._fetchQueue.has(e3.key.id)) {
  192. try {
  193. const t2 = await this._fetchQueue.push(e3.key);
  194. e3.bitmap.source = t2, e3.bitmap.width = this._tileInfoView.tileInfo.size[0], e3.bitmap.height = this._tileInfoView.tileInfo.size[1], e3.once("attach", () => this.requestUpdate());
  195. } catch (s2) {
  196. j(s2) || s.getLogger(this.declaredClass).error(s2);
  197. }
  198. this.requestUpdate();
  199. }
  200. }
  201. async _fetchImage(e3, t2) {
  202. return this.layer.fetchImageBitmapTile(e3.level, e3.row, e3.col, { signal: t2 });
  203. }
  204. _refresh() {
  205. this._fetchQueue.reset(), this._tileStrategy.tiles.forEach((e3) => {
  206. if (!e3.bitmap.source)
  207. return;
  208. const t2 = { id: e3.key.id, fulfilled: false, promise: this._fetchQueue.push(e3.key).then((t3) => {
  209. e3.bitmap.source = t3;
  210. }).catch((t3) => {
  211. j(t3) || (e3.bitmap.source = null);
  212. }).finally(() => {
  213. e3.requestRender(), t2.fulfilled = true;
  214. }) };
  215. this._tileRequests.set(e3, t2);
  216. });
  217. }
  218. _getTileMatrixSetBySpatialReference(e3) {
  219. const t2 = this.view.spatialReference;
  220. if (!e3.tileMatrixSets)
  221. return null;
  222. let i2 = e3.tileMatrixSets.find((e4) => E(e4.tileInfo.spatialReference, t2));
  223. return !i2 && t2.isWebMercator && (i2 = e3.tileMatrixSets.find((e4) => y4.includes(e4.tileInfo.spatialReference.wkid))), i2;
  224. }
  225. };
  226. e([y()], w.prototype, "_fetchQueue", void 0), e([y({ readOnly: true })], w.prototype, "tileMatrixSet", null), w = e([n("esri.views.2d.layers.WMTSLayerView2D")], w);
  227. var g = w;
  228. export {
  229. g as default
  230. };
  231. //# sourceMappingURL=WMTSLayerView2D-2M4XG2BY.js.map