chunk-YLEVJ6UV.js 9.7 KB

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