chunk-RBZL6SRZ.js 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. import {
  2. u
  3. } from "./chunk-N2663GRX.js";
  4. import {
  5. z
  6. } from "./chunk-O4FY3ITT.js";
  7. import {
  8. s
  9. } from "./chunk-PDKDCAAD.js";
  10. import {
  11. M,
  12. j2 as j,
  13. o
  14. } from "./chunk-ECW2QABR.js";
  15. import {
  16. E,
  17. I,
  18. R,
  19. k2 as k,
  20. o as o2,
  21. r
  22. } from "./chunk-MRJEICT6.js";
  23. import {
  24. d,
  25. e,
  26. l3 as l,
  27. n2 as n
  28. } from "./chunk-Y3WMVFTW.js";
  29. import {
  30. S
  31. } from "./chunk-IHXECKQQ.js";
  32. import {
  33. t
  34. } from "./chunk-GZT4BVFP.js";
  35. // node_modules/@arcgis/core/layers/support/LOD.js
  36. var i;
  37. var l2 = i = class extends l {
  38. constructor(e2) {
  39. super(e2), this.cols = null, this.level = 0, this.levelValue = null, this.origin = null, this.resolution = 0, this.rows = null, this.scale = 0;
  40. }
  41. clone() {
  42. return new i({ cols: this.cols, level: this.level, levelValue: this.levelValue, resolution: this.resolution, rows: this.rows, scale: this.scale });
  43. }
  44. };
  45. e([d({ json: { write: true, origins: { "web-document": { read: false, write: false }, "portal-item": { read: false, write: false } } } })], l2.prototype, "cols", void 0), e([d({ type: S, json: { write: true } })], l2.prototype, "level", void 0), e([d({ type: String, json: { write: true } })], l2.prototype, "levelValue", void 0), e([d({ json: { write: true, origins: { "web-document": { read: false, write: false }, "portal-item": { read: false, write: false } } } })], l2.prototype, "origin", void 0), e([d({ type: Number, json: { write: true } })], l2.prototype, "resolution", void 0), e([d({ json: { write: true, origins: { "web-document": { read: false, write: false }, "portal-item": { read: false, write: false } } } })], l2.prototype, "rows", void 0), e([d({ type: Number, json: { write: true } })], l2.prototype, "scale", void 0), l2 = i = e([n("esri.layers.support.LOD")], l2);
  46. var p = l2;
  47. // node_modules/@arcgis/core/layers/support/TileInfo.js
  48. var w;
  49. var x = new s({ PNG: "png", PNG8: "png8", PNG24: "png24", PNG32: "png32", JPEG: "jpg", JPG: "jpg", DIB: "dib", TIFF: "tiff", EMF: "emf", PS: "ps", PDF: "pdf", GIF: "gif", SVG: "svg", SVGZ: "svgz", Mixed: "mixed", MIXED: "mixed", LERC: "lerc", LERC2D: "lerc2d", RAW: "raw", pbf: "pbf" });
  50. var O = w = class extends l {
  51. constructor(e2) {
  52. super(e2), this.dpi = 96, this.format = null, this.origin = null, this.minScale = 0, this.maxScale = 0, this.size = null, this.spatialReference = null;
  53. }
  54. static create(e2 = {}) {
  55. const { resolutionFactor: t2 = 1, scales: o3, size: r2 = 256, spatialReference: i2 = k.WebMercator, numLODs: l3 = 24 } = e2;
  56. if (!I(i2)) {
  57. const e3 = [];
  58. if (o3)
  59. for (let t3 = 0; t3 < o3.length; t3++) {
  60. const r3 = o3[t3];
  61. e3.push({ level: t3, scale: r3, resolution: r3 });
  62. }
  63. else {
  64. let t3 = 5e-4;
  65. for (let o4 = l3 - 1; o4 >= 0; o4--)
  66. e3.unshift({ level: o4, scale: t3, resolution: t3 }), t3 *= 2;
  67. }
  68. return new w({ dpi: 96, lods: e3, origin: new j(0, 0, i2), size: [r2, r2], spatialReference: i2 });
  69. }
  70. const n2 = R(i2), a = e2.origin ? new j({ x: e2.origin.x, y: e2.origin.y, spatialReference: i2 }) : new j(n2 ? { x: n2.origin[0], y: n2.origin[1], spatialReference: i2 } : { x: 0, y: 0, spatialReference: i2 }), p2 = 96, f = 1 / (z(i2) * 39.37 * p2), g = [];
  71. if (o3)
  72. for (let s2 = 0; s2 < o3.length; s2++) {
  73. const e3 = o3[s2], t3 = e3 * f;
  74. g.push({ level: s2, scale: e3, resolution: t3 });
  75. }
  76. else {
  77. let e3 = o2(i2) ? 512 / r2 * 5916575275917094e-7 : 256 / r2 * 591657527591555e-6;
  78. const o4 = Math.ceil(l3 / t2);
  79. g.push({ level: 0, scale: e3, resolution: e3 * f });
  80. for (let r3 = 1; r3 < o4; r3++) {
  81. const o5 = e3 / 2 ** t2, s2 = o5 * f;
  82. g.push({ level: r3, scale: o5, resolution: s2 }), e3 = o5;
  83. }
  84. }
  85. return new w({ dpi: p2, lods: g, origin: a, size: [r2, r2], spatialReference: i2 });
  86. }
  87. get isWrappable() {
  88. const { spatialReference: e2, origin: t2 } = this;
  89. if (e2 && t2) {
  90. const o3 = R(e2);
  91. return e2.isWrappable && Math.abs(o3.origin[0] - t2.x) <= o3.dx;
  92. }
  93. return false;
  94. }
  95. readOrigin(e2, t2) {
  96. return j.fromJSON({ spatialReference: t2.spatialReference, ...e2 });
  97. }
  98. set lods(e2) {
  99. let t2 = 0, o3 = 0;
  100. const r2 = [];
  101. this._levelToLOD = {}, e2 && (t2 = -1 / 0, o3 = 1 / 0, e2.forEach((e3) => {
  102. r2.push(e3.scale), t2 = e3.scale > t2 ? e3.scale : t2, o3 = e3.scale < o3 ? e3.scale : o3, this._levelToLOD[e3.level] = e3;
  103. })), this._set("scales", r2), this._set("minScale", t2), this._set("maxScale", o3), this._set("lods", e2), this._initializeUpsampleLevels();
  104. }
  105. readSize(e2, t2) {
  106. return [t2.cols, t2.rows];
  107. }
  108. writeSize(e2, t2) {
  109. t2.cols = e2[0], t2.rows = e2[1];
  110. }
  111. zoomToScale(e2) {
  112. const t2 = this.scales;
  113. if (e2 <= 0)
  114. return t2[0];
  115. if (e2 >= t2.length - 1)
  116. return t2[t2.length - 1];
  117. {
  118. const o3 = Math.floor(e2), r2 = o3 + 1;
  119. return t2[o3] / (t2[o3] / t2[r2]) ** (e2 - o3);
  120. }
  121. }
  122. scaleToZoom(e2) {
  123. const t2 = this.scales, o3 = t2.length - 1;
  124. let r2 = 0;
  125. for (; r2 < o3; r2++) {
  126. const o4 = t2[r2], s2 = t2[r2 + 1];
  127. if (o4 <= e2)
  128. return r2;
  129. if (s2 === e2)
  130. return r2 + 1;
  131. if (o4 > e2 && s2 < e2)
  132. return r2 + Math.log(o4 / e2) / Math.log(o4 / s2);
  133. }
  134. return r2;
  135. }
  136. snapScale(e2, t2 = 0.95) {
  137. const o3 = this.scaleToZoom(e2);
  138. return o3 % Math.floor(o3) >= t2 ? this.zoomToScale(Math.ceil(o3)) : this.zoomToScale(Math.floor(o3));
  139. }
  140. tileAt(e2, t2, o3, s2) {
  141. const i2 = this.lodAt(e2);
  142. if (!i2)
  143. return null;
  144. let l3, n2;
  145. if (typeof t2 == "number")
  146. l3 = t2, n2 = o3;
  147. else if (E(t2.spatialReference, this.spatialReference))
  148. l3 = t2.x, n2 = t2.y, s2 = o3;
  149. else {
  150. const e3 = M(t2, this.spatialReference);
  151. if (t(e3))
  152. return null;
  153. l3 = e3.x, n2 = e3.y, s2 = o3;
  154. }
  155. const a = i2.resolution * this.size[0], p2 = i2.resolution * this.size[1];
  156. return s2 || (s2 = { id: null, level: 0, row: 0, col: 0, extent: u() }), s2.level = e2, s2.row = Math.floor((this.origin.y - n2) / p2 + 1e-3), s2.col = Math.floor((l3 - this.origin.x) / a + 1e-3), this.updateTileInfo(s2), s2;
  157. }
  158. updateTileInfo(e2, t2 = w.ExtrapolateOptions.NONE) {
  159. let o3 = this.lodAt(e2.level);
  160. if (!o3 && t2 === w.ExtrapolateOptions.POWER_OF_TWO) {
  161. const t3 = this.lods[this.lods.length - 1];
  162. t3.level < e2.level && (o3 = t3);
  163. }
  164. if (!o3)
  165. return;
  166. const r2 = e2.level - o3.level, s2 = o3.resolution * this.size[0] / 2 ** r2, i2 = o3.resolution * this.size[1] / 2 ** r2;
  167. e2.id = `${e2.level}/${e2.row}/${e2.col}`, e2.extent || (e2.extent = u()), e2.extent[0] = this.origin.x + e2.col * s2, e2.extent[1] = this.origin.y - (e2.row + 1) * i2, e2.extent[2] = e2.extent[0] + s2, e2.extent[3] = e2.extent[1] + i2;
  168. }
  169. upsampleTile(e2) {
  170. const t2 = this._upsampleLevels[e2.level];
  171. return !(!t2 || t2.parentLevel === -1) && (e2.level = t2.parentLevel, e2.row = Math.floor(e2.row / t2.factor + 1e-3), e2.col = Math.floor(e2.col / t2.factor + 1e-3), this.updateTileInfo(e2), true);
  172. }
  173. getTileBounds(e2, t2) {
  174. const { resolution: o3 } = this.lodAt(t2.level), r2 = o3 * this.size[0], s2 = o3 * this.size[1];
  175. return e2[0] = this.origin.x + t2.col * r2, e2[1] = this.origin.y - (t2.row + 1) * s2, e2[2] = e2[0] + r2, e2[3] = e2[1] + s2, e2;
  176. }
  177. lodAt(e2) {
  178. return this._levelToLOD && this._levelToLOD[e2] || null;
  179. }
  180. clone() {
  181. return w.fromJSON(this.write({}));
  182. }
  183. getOrCreateCompatible(e2, t2) {
  184. if (this.size[0] === 256 && this.size[1] === 256)
  185. return e2 === 256 ? this : null;
  186. const o3 = [], r2 = this.lods.length;
  187. for (let s2 = 0; s2 < r2; s2++) {
  188. const e3 = this.lods[s2], r3 = e3.resolution * t2;
  189. o3.push(new p({ level: e3.level, scale: e3.scale, resolution: r3 }));
  190. }
  191. return new w({ size: [e2, e2], dpi: this.dpi, format: this.format, compressionQuality: this.compressionQuality, origin: this.origin, spatialReference: this.spatialReference, lods: o3 });
  192. }
  193. _initializeUpsampleLevels() {
  194. const e2 = this.lods;
  195. this._upsampleLevels = [];
  196. let t2 = null;
  197. for (let o3 = 0; o3 < e2.length; o3++) {
  198. const r2 = e2[o3];
  199. this._upsampleLevels[r2.level] = { parentLevel: t2 ? t2.level : -1, factor: t2 ? t2.resolution / r2.resolution : 0 }, t2 = r2;
  200. }
  201. }
  202. };
  203. e([d({ type: Number, json: { write: true } })], O.prototype, "compressionQuality", void 0), e([d({ type: Number, json: { write: true } })], O.prototype, "dpi", void 0), e([d({ type: String, json: { read: x.read, write: x.write, origins: { "web-scene": { read: false, write: false } } } })], O.prototype, "format", void 0), e([d({ readOnly: true })], O.prototype, "isWrappable", null), e([d({ type: j, json: { write: true } })], O.prototype, "origin", void 0), e([o("origin")], O.prototype, "readOrigin", null), e([d({ type: [p], value: null, json: { write: true } })], O.prototype, "lods", null), e([d({ readOnly: true })], O.prototype, "minScale", void 0), e([d({ readOnly: true })], O.prototype, "maxScale", void 0), e([d({ readOnly: true })], O.prototype, "scales", void 0), e([d({ cast: (e2) => Array.isArray(e2) ? e2 : typeof e2 == "number" ? [e2, e2] : [256, 256] })], O.prototype, "size", void 0), e([o("size", ["rows", "cols"])], O.prototype, "readSize", null), e([r("size", { cols: { type: S }, rows: { type: S } })], O.prototype, "writeSize", null), e([d({ type: k, json: { write: true } })], O.prototype, "spatialReference", void 0), O = w = e([n("esri.layers.support.TileInfo")], O), function(e2) {
  204. var t2;
  205. (t2 = e2.ExtrapolateOptions || (e2.ExtrapolateOptions = {}))[t2.NONE = 0] = "NONE", t2[t2.POWER_OF_TWO = 1] = "POWER_OF_TWO";
  206. }(O || (O = {}));
  207. var S2 = O;
  208. export {
  209. p,
  210. S2 as S
  211. };
  212. //# sourceMappingURL=chunk-RBZL6SRZ.js.map