chunk-QHH4NYIZ.js 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. import {
  2. c as c2
  3. } from "./chunk-TD4DLRQ7.js";
  4. import {
  5. r as r4
  6. } from "./chunk-56H3JM63.js";
  7. import {
  8. e as e2
  9. } from "./chunk-OSNKP4CI.js";
  10. import {
  11. a as a3
  12. } from "./chunk-435DJNTD.js";
  13. import {
  14. n as n2
  15. } from "./chunk-5MVUZO4F.js";
  16. import {
  17. E,
  18. X,
  19. y as y2
  20. } from "./chunk-4VRSV2TU.js";
  21. import {
  22. n as n4
  23. } from "./chunk-MD4XYAEQ.js";
  24. import {
  25. i
  26. } from "./chunk-FMKGHOGD.js";
  27. import {
  28. p
  29. } from "./chunk-6URTNEGN.js";
  30. import {
  31. o as o2
  32. } from "./chunk-6B2LQBKM.js";
  33. import {
  34. a
  35. } from "./chunk-RMX2AZ4P.js";
  36. import {
  37. v
  38. } from "./chunk-KHA63LLS.js";
  39. import {
  40. c
  41. } from "./chunk-FGKNEJKJ.js";
  42. import {
  43. f
  44. } from "./chunk-PSV473TI.js";
  45. import {
  46. O
  47. } from "./chunk-I3OBGWNS.js";
  48. import {
  49. y
  50. } from "./chunk-EG5OI4V4.js";
  51. import {
  52. n as n3
  53. } from "./chunk-CYI7KFYB.js";
  54. import {
  55. a as a2
  56. } from "./chunk-5LXROFTA.js";
  57. import {
  58. t as t2
  59. } from "./chunk-W72F6AS3.js";
  60. import {
  61. b
  62. } from "./chunk-4DDBH2K5.js";
  63. import {
  64. U
  65. } from "./chunk-VNFRAYHO.js";
  66. import {
  67. M2 as M,
  68. o
  69. } from "./chunk-ECW2QABR.js";
  70. import {
  71. r as r3
  72. } from "./chunk-MRJEICT6.js";
  73. import {
  74. d,
  75. e,
  76. n2 as n,
  77. r2,
  78. t3 as t
  79. } from "./chunk-Y3WMVFTW.js";
  80. import {
  81. S
  82. } from "./chunk-IHXECKQQ.js";
  83. import {
  84. g,
  85. w
  86. } from "./chunk-ULGDPLM2.js";
  87. import {
  88. s3 as s
  89. } from "./chunk-EMJ4ZSM2.js";
  90. import {
  91. r
  92. } from "./chunk-GZT4BVFP.js";
  93. // node_modules/@arcgis/core/layers/MapImageLayer.js
  94. var q = class extends a2(a3(t2(E(y2(p(c(v(O(n3(i(o2(a(b))))))))))))) {
  95. constructor(...e3) {
  96. super(...e3), this.datesInUnknownTimezone = false, this.dpi = 96, this.gdbVersion = null, this.imageFormat = "png24", this.imageMaxHeight = 2048, this.imageMaxWidth = 2048, this.imageTransparency = true, this.isReference = null, this.labelsVisible = false, this.operationalLayerType = "ArcGISMapServiceLayer", this.sourceJSON = null, this.sublayers = null, this.type = "map-image", this.url = null;
  97. }
  98. normalizeCtorArgs(e3, r5) {
  99. return typeof e3 == "string" ? { url: e3, ...r5 } : e3;
  100. }
  101. load(e3) {
  102. const r5 = r(e3) ? e3.signal : null;
  103. return this.addResolvingPromise(this.loadFromPortal({ supportedTypes: ["Map Service"] }, e3).catch(w).then(() => this._fetchService(r5))), Promise.resolve(this);
  104. }
  105. readImageFormat(e3, r5) {
  106. const t3 = r5.supportedImageFormatTypes;
  107. return t3 && t3.includes("PNG32") ? "png32" : "png24";
  108. }
  109. writeSublayers(e3, r5, t3, o3) {
  110. if (!this.loaded || !e3)
  111. return;
  112. const i2 = e3.slice().reverse().flatten(({ sublayers: e4 }) => e4 && e4.toArray().reverse()).toArray();
  113. let s2 = false;
  114. if (this.capabilities && this.capabilities.operations.supportsExportMap && this.capabilities.exportMap.supportsDynamicLayers) {
  115. const e4 = t(o3.origin);
  116. if (e4 === r2.PORTAL_ITEM) {
  117. const e5 = this.createSublayersForOrigin("service").sublayers;
  118. s2 = n4(i2, e5, r2.SERVICE);
  119. } else if (e4 > r2.PORTAL_ITEM) {
  120. const e5 = this.createSublayersForOrigin("portal-item");
  121. s2 = n4(i2, e5.sublayers, t(e5.origin));
  122. }
  123. }
  124. const a4 = [], p2 = { writeSublayerStructure: s2, ...o3 };
  125. let n5 = s2;
  126. i2.forEach((e4) => {
  127. const r6 = e4.write({}, p2);
  128. a4.push(r6), n5 = n5 || e4.originOf("visible") === "user";
  129. });
  130. a4.some((e4) => Object.keys(e4).length > 1) && (r5.layers = a4), n5 && (r5.visibleLayers = i2.filter((e4) => e4.visible).map((e4) => e4.id));
  131. }
  132. createExportImageParameters(e3, r5, t3, o3) {
  133. const i2 = o3 && o3.pixelRatio || 1;
  134. e3 && this.version >= 10 && (e3 = e3.clone().shiftCentralMeridian());
  135. const s2 = new c2({ layer: this, floors: o3?.floors, scale: r4({ extent: e3, width: r5 }) * i2 }), a4 = s2.toJSON();
  136. s2.destroy();
  137. const p2 = !o3 || !o3.rotation || this.version < 10.3 ? {} : { rotation: -o3.rotation }, n5 = e3 && e3.spatialReference, m = n5.wkid || JSON.stringify(n5.toJSON());
  138. a4.dpi *= i2;
  139. const l = {};
  140. if (o3?.timeExtent) {
  141. const { start: e4, end: r6 } = o3.timeExtent.toJSON();
  142. l.time = e4 && r6 && e4 === r6 ? "" + e4 : `${e4 == null ? "null" : e4},${r6 == null ? "null" : r6}`;
  143. } else
  144. this.timeInfo && !this.timeInfo.hasLiveData && (l.time = "null,null");
  145. return { bbox: e3 && e3.xmin + "," + e3.ymin + "," + e3.xmax + "," + e3.ymax, bboxSR: m, imageSR: m, size: r5 + "," + t3, ...a4, ...p2, ...l };
  146. }
  147. async fetchImage(e3, t3, i2, s2) {
  148. const a4 = { responseType: "image", signal: s2?.signal ?? null, query: { ...this.parsedUrl.query, ...this.createExportImageParameters(e3, t3, i2, s2), f: "image", ...this.refreshParameters, ...this.customParameters, token: this.apiKey } }, p2 = this.parsedUrl.path + "/export";
  149. if (a4.query.dynamicLayers != null && !this.capabilities.exportMap.supportsDynamicLayers)
  150. throw new s("mapimagelayer:dynamiclayer-not-supported", `service ${this.url} doesn't support dynamic layers, which is required to be able to change the sublayer's order, rendering, labeling or source.`, { query: a4.query });
  151. return U(p2, a4).then((e4) => e4.data).catch((e4) => {
  152. if (g(e4))
  153. throw e4;
  154. throw new s("mapimagelayer:image-fetch-error", `Unable to load image: ${p2}`, { error: e4 });
  155. });
  156. }
  157. async fetchRecomputedExtents(e3 = {}) {
  158. const o3 = { ...e3, query: { returnUpdates: true, f: "json", ...this.customParameters, token: this.apiKey } }, { data: i2 } = await U(this.url, o3), { extent: s2, fullExtent: a4, timeExtent: p2 } = i2, n5 = s2 || a4;
  159. return { fullExtent: n5 && M.fromJSON(n5), timeExtent: p2 && y.fromJSON({ start: p2[0], end: p2[1] }) };
  160. }
  161. loadAll() {
  162. return n2(this, (e3) => {
  163. e3(this.allSublayers);
  164. });
  165. }
  166. serviceSupportsSpatialReference(e3) {
  167. return e2(this, e3);
  168. }
  169. async _fetchService(e3) {
  170. if (this.sourceJSON)
  171. return void this.read(this.sourceJSON, { origin: "service", url: this.parsedUrl });
  172. const { data: t3, ssl: o3 } = await U(this.parsedUrl.path, { query: { f: "json", ...this.parsedUrl.query, ...this.customParameters, token: this.apiKey }, signal: e3 });
  173. o3 && (this.url = this.url.replace(/^http:/i, "https:")), this.sourceJSON = t3, this.read(t3, { origin: "service", url: this.parsedUrl });
  174. }
  175. };
  176. e([d({ type: Boolean })], q.prototype, "datesInUnknownTimezone", void 0), e([d()], q.prototype, "dpi", void 0), e([d()], q.prototype, "gdbVersion", void 0), e([d()], q.prototype, "imageFormat", void 0), e([o("imageFormat", ["supportedImageFormatTypes"])], q.prototype, "readImageFormat", null), e([d({ json: { origins: { service: { read: { source: "maxImageHeight" } } } } })], q.prototype, "imageMaxHeight", void 0), e([d({ json: { origins: { service: { read: { source: "maxImageWidth" } } } } })], q.prototype, "imageMaxWidth", void 0), e([d()], q.prototype, "imageTransparency", void 0), e([d({ type: Boolean, json: { read: false, write: { enabled: true, overridePolicy: () => ({ enabled: false }) } } })], q.prototype, "isReference", void 0), e([d({ json: { read: false, write: false } })], q.prototype, "labelsVisible", void 0), e([d({ type: ["ArcGISMapServiceLayer"] })], q.prototype, "operationalLayerType", void 0), e([d({ json: { read: false, write: false } })], q.prototype, "popupEnabled", void 0), e([d()], q.prototype, "sourceJSON", void 0), e([d({ json: { write: { ignoreOrigin: true } } })], q.prototype, "sublayers", void 0), e([r3("sublayers", { layers: { type: [X] }, visibleLayers: { type: [S] } })], q.prototype, "writeSublayers", null), e([d({ type: ["show", "hide", "hide-children"] })], q.prototype, "listMode", void 0), e([d({ json: { read: false }, readOnly: true, value: "map-image" })], q.prototype, "type", void 0), e([d(f)], q.prototype, "url", void 0), q = e([n("esri.layers.MapImageLayer")], q);
  177. var F = q;
  178. export {
  179. F
  180. };
  181. //# sourceMappingURL=chunk-QHH4NYIZ.js.map