123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- import {
- s as s3
- } from "./chunk-L372ZBYB.js";
- import {
- E,
- X,
- y
- } from "./chunk-4VRSV2TU.js";
- import {
- i
- } from "./chunk-FMKGHOGD.js";
- import {
- p
- } from "./chunk-6URTNEGN.js";
- import {
- o as o2
- } from "./chunk-6B2LQBKM.js";
- import {
- d as d2,
- g,
- m
- } from "./chunk-X7DBH4KK.js";
- import {
- a
- } from "./chunk-RMX2AZ4P.js";
- import {
- v
- } from "./chunk-KHA63LLS.js";
- import {
- c
- } from "./chunk-FGKNEJKJ.js";
- import {
- f
- } from "./chunk-PSV473TI.js";
- import {
- O
- } from "./chunk-I3OBGWNS.js";
- import {
- n as n2
- } from "./chunk-CYI7KFYB.js";
- import {
- a as a2
- } from "./chunk-5LXROFTA.js";
- import {
- t
- } from "./chunk-W72F6AS3.js";
- import {
- b
- } from "./chunk-4DDBH2K5.js";
- import {
- U
- } from "./chunk-VNFRAYHO.js";
- import {
- I,
- Q,
- j
- } from "./chunk-VBRY5KJM.js";
- import {
- o
- } from "./chunk-ECW2QABR.js";
- import {
- s as s2
- } from "./chunk-GCDJLKH4.js";
- import {
- k2 as k,
- r as r2
- } from "./chunk-MRJEICT6.js";
- import {
- d,
- e,
- n2 as n
- } from "./chunk-Y3WMVFTW.js";
- import {
- w
- } from "./chunk-ULGDPLM2.js";
- import {
- s3 as s
- } from "./chunk-EMJ4ZSM2.js";
- import {
- r
- } from "./chunk-GZT4BVFP.js";
- // node_modules/@arcgis/core/layers/TileLayer.js
- var W = ["Canvas/World_Dark_Gray_Base", "Canvas/World_Dark_Gray_Reference", "Canvas/World_Light_Gray_Base", "Canvas/World_Light_Gray_Reference", "Elevation/World_Hillshade", "Elevation/World_Hillshade_Dark", "Ocean/World_Ocean_Base", "Ocean/World_Ocean_Reference", "Ocean_Basemap", "Reference/World_Boundaries_and_Places", "Reference/World_Boundaries_and_Places_Alternate", "Reference/World_Transportation", "World_Imagery", "World_Street_Map", "World_Topo_Map"];
- var I2 = class extends a2(E(t(c(v(s3(y(p(O(a(n2(i(o2(b))))))))))))) {
- constructor(...e2) {
- super(...e2), this.listMode = "show", this.isReference = null, this.operationalLayerType = "ArcGISTiledMapServiceLayer", this.resampling = true, this.sourceJSON = null, this.spatialReference = null, this.path = null, this.sublayers = null, this.type = "tile", this.url = null;
- }
- normalizeCtorArgs(e2, r3) {
- return typeof e2 == "string" ? { url: e2, ...r3 } : e2;
- }
- load(e2) {
- const r3 = r(e2) ? e2.signal : null;
- return this.addResolvingPromise(this.loadFromPortal({ supportedTypes: ["Map Service"] }, e2).catch(w).then(() => this._fetchService(r3))), Promise.resolve(this);
- }
- get attributionDataUrl() {
- const e2 = this.parsedUrl?.path.toLowerCase();
- return e2 && this._getDefaultAttribution(this._getMapName(e2));
- }
- readSpatialReference(e2, r3) {
- return (e2 = e2 || r3.tileInfo && r3.tileInfo.spatialReference) && k.fromJSON(e2);
- }
- writeSublayers(e2, r3, t2, s4) {
- if (!this.loaded || !e2)
- return;
- const i2 = e2.slice().reverse().flatten(({ sublayers: e3 }) => e3 && e3.toArray().reverse()).toArray(), o3 = [], a3 = { writeSublayerStructure: false, ...s4 };
- i2.forEach((e3) => {
- const r4 = e3.write({}, a3);
- o3.push(r4);
- });
- o3.some((e3) => Object.keys(e3).length > 1) && (r3.layers = o3);
- }
- get tileServers() {
- return this._getDefaultTileServers(this.parsedUrl.path);
- }
- castTileServers(e2) {
- return Array.isArray(e2) ? e2.map((e3) => j(e3).path) : null;
- }
- fetchTile(e2, t2, s4, i2 = {}) {
- const { signal: o3 } = i2, a3 = this.getTileUrl(e2, t2, s4), l = { responseType: "image", signal: o3, query: { ...this.refreshParameters } };
- return U(a3, l).then((e3) => e3.data);
- }
- getTileUrl(e2, r3, t2) {
- const s4 = !this.tilemapCache && this.supportsBlankTile, i2 = I({ ...this.parsedUrl.query, blankTile: !s4 && null, ...this.customParameters, token: this.apiKey }), o3 = this.tileServers;
- return `${o3 && o3.length ? o3[r3 % o3.length] : this.parsedUrl.path}/tile/${e2}/${r3}/${t2}${i2 ? "?" + i2 : ""}`;
- }
- _fetchService(e2) {
- return new Promise((s4, o3) => {
- if (this.sourceJSON) {
- if (this.sourceJSON.bandCount != null && this.sourceJSON.pixelSizeX != null)
- throw new s("tile-layer:unsupported-url", "use ImageryTileLayer to open a tiled image service");
- return void s4({ data: this.sourceJSON });
- }
- if (!this.parsedUrl)
- throw new s("tile-layer:undefined-url", "layer's url is not defined");
- const a3 = m(this.parsedUrl.path);
- if (r(a3) && a3.serverType === "ImageServer")
- throw new s("tile-layer:unsupported-url", "use ImageryTileLayer to open a tiled image service");
- U(this.parsedUrl.path, { query: { f: "json", ...this.parsedUrl.query, ...this.customParameters, token: this.apiKey }, responseType: "json", signal: e2 }).then(s4, o3);
- }).then((r3) => {
- if (r3.ssl && (this.url = this.url.replace(/^http:/i, "https:")), this.sourceJSON = r3.data, this.read(r3.data, { origin: "service", url: this.parsedUrl }), this.version === 10.1 && !g(this.url))
- return this._fetchServerVersion(this.url, e2).then((e3) => {
- this.read({ currentVersion: e3 });
- }).catch(() => {
- });
- });
- }
- _fetchServerVersion(e2, s4) {
- if (!d2(e2))
- return Promise.reject();
- const i2 = e2.replace(/(.*\/rest)\/.*/i, "$1") + "/info";
- return U(i2, { query: { f: "json", ...this.customParameters, token: this.apiKey }, responseType: "json", signal: s4 }).then((e3) => {
- if (e3.data && e3.data.currentVersion)
- return e3.data.currentVersion;
- throw new s("tile-layer:version-not-available");
- });
- }
- _getMapName(e2) {
- const r3 = e2.match(/^(?:https?:)?\/\/(server\.arcgisonline\.com|services\.arcgisonline\.com|ibasemaps-api\.arcgis\.com)\/arcgis\/rest\/services\/([^\/]+(\/[^\/]+)*)\/mapserver/i);
- return r3 && r3[2];
- }
- _getDefaultAttribution(e2) {
- if (!e2)
- return;
- let r3;
- e2 = e2.toLowerCase();
- for (let t2 = 0, s4 = W.length; t2 < s4; t2++)
- if (r3 = W[t2], r3.toLowerCase().includes(e2))
- return Q("//static.arcgis.com/attribution/" + r3);
- }
- _getDefaultTileServers(e2) {
- const r3 = e2.search(/^(?:https?:)?\/\/server\.arcgisonline\.com/i) !== -1, t2 = e2.search(/^(?:https?:)?\/\/services\.arcgisonline\.com/i) !== -1;
- return r3 || t2 ? [e2, e2.replace(r3 ? /server\.arcgisonline/i : /services\.arcgisonline/i, r3 ? "services.arcgisonline" : "server.arcgisonline")] : [];
- }
- get hasOverriddenFetchTile() {
- return !this.fetchTile.__isDefault__;
- }
- };
- e([d({ readOnly: true })], I2.prototype, "attributionDataUrl", null), e([d({ type: ["show", "hide", "hide-children"] })], I2.prototype, "listMode", void 0), e([d({ json: { read: true, write: true } })], I2.prototype, "blendMode", void 0), e([d({ type: Boolean, json: { read: false, write: { enabled: true, overridePolicy: () => ({ enabled: false }) } } })], I2.prototype, "isReference", void 0), e([d({ readOnly: true, type: ["ArcGISTiledMapServiceLayer"] })], I2.prototype, "operationalLayerType", void 0), e([d({ type: Boolean })], I2.prototype, "resampling", void 0), e([d()], I2.prototype, "sourceJSON", void 0), e([d({ type: k })], I2.prototype, "spatialReference", void 0), e([o("spatialReference", ["spatialReference", "tileInfo"])], I2.prototype, "readSpatialReference", null), e([d({ type: String, json: { origins: { "web-scene": { read: true, write: true } }, read: false } })], I2.prototype, "path", void 0), e([d({ readOnly: true })], I2.prototype, "sublayers", void 0), e([r2("sublayers", { layers: { type: [X] } })], I2.prototype, "writeSublayers", null), e([d({ json: { read: false, write: false } })], I2.prototype, "popupEnabled", void 0), e([d()], I2.prototype, "tileServers", null), e([s2("tileServers")], I2.prototype, "castTileServers", null), e([d({ readOnly: true, json: { read: false } })], I2.prototype, "type", void 0), e([d(f)], I2.prototype, "url", void 0), I2 = e([n("esri.layers.TileLayer")], I2), I2.prototype.fetchTile.__isDefault__ = true;
- var C = I2;
- export {
- C
- };
- //# sourceMappingURL=chunk-JMD675LG.js.map
|