BingMapsLayer-ONE4BTEV.js 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. import {
  2. d as d2
  3. } from "./chunk-MWBB6M6Y.js";
  4. import {
  5. c
  6. } from "./chunk-FGKNEJKJ.js";
  7. import "./chunk-PSV473TI.js";
  8. import {
  9. O
  10. } from "./chunk-I3OBGWNS.js";
  11. import "./chunk-FONIFA5N.js";
  12. import "./chunk-EG5OI4V4.js";
  13. import "./chunk-65BYCSII.js";
  14. import "./chunk-WZQZRKNH.js";
  15. import "./chunk-LRDX4TO7.js";
  16. import "./chunk-6A4U74YA.js";
  17. import {
  18. S
  19. } from "./chunk-RBZL6SRZ.js";
  20. import "./chunk-CYI7KFYB.js";
  21. import {
  22. a
  23. } from "./chunk-5LXROFTA.js";
  24. import "./chunk-GJXW4HL5.js";
  25. import "./chunk-WJW5DUN6.js";
  26. import "./chunk-W72F6AS3.js";
  27. import "./chunk-PJ7ZQ4VD.js";
  28. import "./chunk-WDLTDV2L.js";
  29. import "./chunk-TERAW6FT.js";
  30. import "./chunk-N2663GRX.js";
  31. import "./chunk-O4FY3ITT.js";
  32. import "./chunk-WEMIK25H.js";
  33. import "./chunk-4DDBH2K5.js";
  34. import "./chunk-7N4X6GF3.js";
  35. import "./chunk-JXW4QTJA.js";
  36. import "./chunk-UXF37FQ4.js";
  37. import "./chunk-ZOEK6QHJ.js";
  38. import "./chunk-XNLG7T2T.js";
  39. import "./chunk-IR4PV7VK.js";
  40. import "./chunk-2Z6LERTI.js";
  41. import "./chunk-OWVBLVP3.js";
  42. import "./chunk-TBBTRX4O.js";
  43. import "./chunk-YBSUITLL.js";
  44. import "./chunk-ALDCDSPV.js";
  45. import "./chunk-DT6EAZQ5.js";
  46. import "./chunk-HNOZUNJ4.js";
  47. import {
  48. U
  49. } from "./chunk-VNFRAYHO.js";
  50. import "./chunk-R5IG2D6H.js";
  51. import "./chunk-VBRY5KJM.js";
  52. import {
  53. s as s2
  54. } from "./chunk-PDKDCAAD.js";
  55. import "./chunk-ECW2QABR.js";
  56. import "./chunk-GCDJLKH4.js";
  57. import {
  58. k2 as k
  59. } from "./chunk-MRJEICT6.js";
  60. import {
  61. d,
  62. e,
  63. n2 as n
  64. } from "./chunk-Y3WMVFTW.js";
  65. import "./chunk-SAS7RONY.js";
  66. import "./chunk-WSRBH7BF.js";
  67. import "./chunk-IHXECKQQ.js";
  68. import "./chunk-ULGDPLM2.js";
  69. import {
  70. s3 as s
  71. } from "./chunk-EMJ4ZSM2.js";
  72. import "./chunk-IKP3YN53.js";
  73. import {
  74. r,
  75. t
  76. } from "./chunk-GZT4BVFP.js";
  77. import "./chunk-A5ICIBVI.js";
  78. // node_modules/@arcgis/core/layers/BingMapsLayer.js
  79. var y = new s2({ BingMapsAerial: "aerial", BingMapsRoad: "road", BingMapsHybrid: "hybrid" });
  80. var h = "https://dev.virtualearth.net";
  81. var m = class extends a(c(O(d2))) {
  82. constructor(e2) {
  83. super(e2), this.type = "bing-maps", this.tileInfo = new S({ size: [256, 256], dpi: 96, origin: { x: -20037508342787e-6, y: 20037508342787e-6, spatialReference: k.WebMercator }, spatialReference: k.WebMercator, lods: [{ level: 1, resolution: 78271.5169639999, scale: 295828763795777e-6 }, { level: 2, resolution: 39135.7584820001, scale: 147914381897889e-6 }, { level: 3, resolution: 19567.8792409999, scale: 73957190948944e-6 }, { level: 4, resolution: 9783.93962049996, scale: 36978595474472e-6 }, { level: 5, resolution: 4891.96981024998, scale: 18489297737236e-6 }, { level: 6, resolution: 2445.98490512499, scale: 9244648868618e-6 }, { level: 7, resolution: 1222.99245256249, scale: 4622324434309e-6 }, { level: 8, resolution: 611.49622628138, scale: 2311162217155e-6 }, { level: 9, resolution: 305.748113140558, scale: 1155581108577e-6 }, { level: 10, resolution: 152.874056570411, scale: 577790.554289 }, { level: 11, resolution: 76.4370282850732, scale: 288895.277144 }, { level: 12, resolution: 38.2185141425366, scale: 144447.638572 }, { level: 13, resolution: 19.1092570712683, scale: 72223.819286 }, { level: 14, resolution: 9.55462853563415, scale: 36111.909643 }, { level: 15, resolution: 4.77731426794937, scale: 18055.954822 }, { level: 16, resolution: 2.38865713397468, scale: 9027.977411 }, { level: 17, resolution: 1.19432856685505, scale: 4513.988705 }, { level: 18, resolution: 0.597164283559817, scale: 2256.994353 }, { level: 19, resolution: 0.298582141647617, scale: 1128.497176 }, { level: 20, resolution: 0.1492910708238085, scale: 564.248588 }] }), this.key = null, this.style = "road", this.culture = "en-US", this.region = null, this.portalUrl = null, this.hasAttributionData = true;
  84. }
  85. get bingMetadata() {
  86. return this._get("bingMetadata");
  87. }
  88. set bingMetadata(e2) {
  89. this._set("bingMetadata", e2);
  90. }
  91. get copyright() {
  92. return r(this.bingMetadata) ? this.bingMetadata.copyright : null;
  93. }
  94. get operationalLayerType() {
  95. return y.toJSON(this.style);
  96. }
  97. get bingLogo() {
  98. return r(this.bingMetadata) ? this.bingMetadata.brandLogoUri : null;
  99. }
  100. load(e2) {
  101. return this.key ? this.addResolvingPromise(this._getMetadata()) : this.portalUrl ? this.addResolvingPromise(this._getPortalBingKey().then(() => this._getMetadata())) : this.addResolvingPromise(Promise.reject(new s("bingmapslayer:load", "Bing layer must have bing key."))), Promise.resolve(this);
  102. }
  103. getTileUrl(e2, t2, r2) {
  104. if (!this.loaded || t(this.bingMetadata))
  105. return null;
  106. const o = this.bingMetadata.resourceSets[0].resources[0], a2 = o.imageUrlSubdomains[t2 % o.imageUrlSubdomains.length], i = this._getQuadKey(e2, t2, r2);
  107. return o.imageUrl.replace("{subdomain}", a2).replace("{quadkey}", i);
  108. }
  109. async fetchAttributionData() {
  110. return this.load().then(() => {
  111. if (t(this.bingMetadata))
  112. return null;
  113. return { contributors: this.bingMetadata.resourceSets[0].resources[0].imageryProviders.map((e2) => ({ attribution: e2.attribution, coverageAreas: e2.coverageAreas.map((e3) => ({ zoomMin: e3.zoomMin, zoomMax: e3.zoomMax, score: 1, bbox: [e3.bbox[0], e3.bbox[1], e3.bbox[2], e3.bbox[3]] })) })) };
  114. });
  115. }
  116. _getMetadata() {
  117. const e2 = { road: "roadOnDemand", aerial: "aerial", hybrid: "aerialWithLabelsOnDemand" }[this.style];
  118. return U(`${h}/REST/v1/Imagery/Metadata/${e2}`, { responseType: "json", query: { include: "ImageryProviders", uriScheme: "https", key: this.key, suppressStatus: true, output: "json", culture: this.culture, userRegion: this.region } }).then((e3) => {
  119. const t2 = e3.data;
  120. if (t2.statusCode !== 200)
  121. throw new s("bingmapslayer:getmetadata", t2.statusDescription);
  122. if (this.bingMetadata = t2, this.bingMetadata.resourceSets.length === 0)
  123. throw new s("bingmapslayer:getmetadata", "no bing resourcesets");
  124. if (this.bingMetadata.resourceSets[0].resources.length === 0)
  125. throw new s("bingmapslayer:getmetadata", "no bing resources");
  126. }).catch((e3) => {
  127. throw new s("bingmapslayer:getmetadata", e3.message);
  128. });
  129. }
  130. _getPortalBingKey() {
  131. return U(this.portalUrl, { responseType: "json", authMode: "no-prompt", query: { f: "json" } }).then((e2) => {
  132. if (!e2.data.bingKey)
  133. throw new s("bingmapslayer:getportalbingkey", "The referenced Portal does not contain a valid bing key");
  134. this.key = e2.data.bingKey;
  135. }).catch((e2) => {
  136. throw new s("bingmapslayer:getportalbingkey", e2.message);
  137. });
  138. }
  139. _getQuadKey(e2, t2, r2) {
  140. let o = "";
  141. for (let a2 = e2; a2 > 0; a2--) {
  142. let e3 = 0;
  143. const s3 = 1 << a2 - 1;
  144. (r2 & s3) != 0 && (e3 += 1), (t2 & s3) != 0 && (e3 += 2), o += e3.toString();
  145. }
  146. return o;
  147. }
  148. };
  149. e([d({ json: { read: false, write: false }, value: null })], m.prototype, "bingMetadata", null), e([d({ json: { read: false, write: false }, value: "bing-maps", readOnly: true })], m.prototype, "type", void 0), e([d({ type: S })], m.prototype, "tileInfo", void 0), e([d({ type: String, readOnly: true, json: { read: false, write: false } })], m.prototype, "copyright", null), e([d({ type: String, json: { write: false, read: false } })], m.prototype, "key", void 0), e([d({ type: y.apiValues, nonNullable: true, json: { read: { source: "layerType", reader: y.read } } })], m.prototype, "style", void 0), e([d({ type: ["BingMapsAerial", "BingMapsHybrid", "BingMapsRoad"] })], m.prototype, "operationalLayerType", null), e([d({ type: String, json: { write: false, read: false } })], m.prototype, "culture", void 0), e([d({ type: String, json: { write: false, read: false } })], m.prototype, "region", void 0), e([d({ type: String, json: { write: true, read: true } })], m.prototype, "portalUrl", void 0), e([d({ type: Boolean, json: { write: false, read: false } })], m.prototype, "hasAttributionData", void 0), e([d({ type: String, readOnly: true })], m.prototype, "bingLogo", null), m = e([n("esri.layers.BingMapsLayer")], m);
  150. var b = m;
  151. export {
  152. b as default
  153. };
  154. //# sourceMappingURL=BingMapsLayer-ONE4BTEV.js.map