chunk-VQXMCZYH.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. import {
  2. l
  3. } from "./chunk-JQUWFKNU.js";
  4. import {
  5. e
  6. } from "./chunk-TFHLTN6F.js";
  7. import {
  8. R
  9. } from "./chunk-PQFTYGF5.js";
  10. import {
  11. r
  12. } from "./chunk-YXWMMD76.js";
  13. // node_modules/@arcgis/core/views/2d/tiling/LODInfo.js
  14. function i(t, r3) {
  15. return [t, r3];
  16. }
  17. function e2(t, r3, o2) {
  18. return t[0] = r3, t[1] = o2, t;
  19. }
  20. function s(t, r3, o2, i3, e3) {
  21. return t[0] = r3, t[1] = o2, t[2] = i3, t[3] = e3, t;
  22. }
  23. var n = new e("0/0/0/0");
  24. var l2 = class {
  25. constructor(t, r3, o2, i3, e3, s2, n3, l3, h2, a2, u, m) {
  26. this.level = t, this.resolution = r3, this.scale = o2, this.origin = i3, this.first = e3, this.last = s2, this.size = n3, this.norm = l3, this.worldStart = h2, this.worldEnd = a2, this.worldSize = u, this.wrap = m;
  27. }
  28. static create(o2, s2, n3 = null) {
  29. const h2 = R(o2.spatialReference), a2 = s2.origin || i(o2.origin.x, o2.origin.y), u = i(o2.size[0] * s2.resolution, o2.size[1] * s2.resolution), m = i(-1 / 0, -1 / 0), g = i(1 / 0, 1 / 0), w = i(1 / 0, 1 / 0);
  30. r(n3) && (e2(m, Math.max(0, Math.floor((n3.xmin - a2[0]) / u[0])), Math.max(0, Math.floor((a2[1] - n3.ymax) / u[1]))), e2(g, Math.max(0, Math.floor((n3.xmax - a2[0]) / u[0])), Math.max(0, Math.floor((a2[1] - n3.ymin) / u[1]))), e2(w, g[0] - m[0] + 1, g[1] - m[1] + 1));
  31. const { cols: c, rows: d } = s2;
  32. let f, F, z, p;
  33. return !n3 && c && d && (e2(m, c[0], d[0]), e2(g, c[1], d[1]), e2(w, c[1] - c[0] + 1, d[1] - d[0] + 1)), o2.isWrappable ? (f = i(Math.ceil(Math.round((h2.valid[1] - h2.valid[0]) / s2.resolution) / o2.size[0]), w[1]), F = i(Math.floor((h2.origin[0] - a2[0]) / u[0]), m[1]), z = i(f[0] + F[0] - 1, g[1]), p = true) : (F = m, z = g, f = w, p = false), new l2(s2.level, s2.resolution, s2.scale, a2, m, g, w, u, F, z, f, p);
  34. }
  35. normalizeCol(t) {
  36. if (!this.wrap)
  37. return t;
  38. const r3 = this.worldSize[0];
  39. return t < 0 ? r3 - 1 - Math.abs((t + 1) % r3) : t % r3;
  40. }
  41. denormalizeCol(t, r3) {
  42. return this.wrap ? this.worldSize[0] * r3 + t : t;
  43. }
  44. getWorldForColumn(t) {
  45. return this.wrap ? Math.floor(t / this.worldSize[0]) : 0;
  46. }
  47. getFirstColumnForWorld(t) {
  48. return t * this.worldSize[0] + this.first[0];
  49. }
  50. getLastColumnForWorld(t) {
  51. return t * this.worldSize[0] + this.first[0] + this.size[0] - 1;
  52. }
  53. getColumnForX(t) {
  54. return (t - this.origin[0]) / this.norm[0];
  55. }
  56. getXForColumn(t) {
  57. return this.origin[0] + t * this.norm[0];
  58. }
  59. getRowForY(t) {
  60. return (this.origin[1] - t) / this.norm[1];
  61. }
  62. getYForRow(t) {
  63. return this.origin[1] - t * this.norm[1];
  64. }
  65. getTileBounds(t, r3, o2 = false) {
  66. n.set(r3);
  67. const i3 = o2 ? n.col : this.denormalizeCol(n.col, n.world), e3 = n.row;
  68. return s(t, this.getXForColumn(i3), this.getYForRow(e3 + 1), this.getXForColumn(i3 + 1), this.getYForRow(e3)), t;
  69. }
  70. getTileCoords(t, r3, o2 = false) {
  71. n.set(r3);
  72. const i3 = o2 ? n.col : this.denormalizeCol(n.col, n.world);
  73. return Array.isArray(t) ? e2(t, this.getXForColumn(i3), this.getYForRow(n.row)) : (t.x = this.getXForColumn(i3), t.y = this.getYForRow(n.row)), t;
  74. }
  75. };
  76. // node_modules/@arcgis/core/views/2d/tiling/TileSpan.js
  77. var o = class {
  78. constructor(o2, s2, t) {
  79. this.row = o2, this.colFrom = s2, this.colTo = t;
  80. }
  81. };
  82. // node_modules/@arcgis/core/views/2d/tiling/TileInfoView.js
  83. var i2 = new e("0/0/0/0");
  84. var n2 = class {
  85. constructor(e3, t, o2, l3, s2, i3, n3, r3) {
  86. this.x = e3, this.ymin = t, this.ymax = o2, this.invM = l3, this.leftAdjust = s2, this.rightAdjust = i3, this.leftBound = n3, this.rightBound = r3;
  87. }
  88. static create(e3, t) {
  89. e3[1] > t[1] && ([e3, t] = [t, e3]);
  90. const [o2, l3] = e3, [s2, i3] = t, r3 = s2 - o2, a2 = i3 - l3, h2 = 0 !== a2 ? r3 / a2 : 0, c = (Math.ceil(l3) - l3) * h2, f = (Math.floor(l3) - l3) * h2;
  91. return new n2(o2, Math.floor(l3), Math.ceil(i3), h2, r3 < 0 ? c : f, r3 < 0 ? f : c, r3 < 0 ? s2 : o2, r3 < 0 ? o2 : s2);
  92. }
  93. incrRow() {
  94. this.x += this.invM;
  95. }
  96. getLeftCol() {
  97. return Math.max(this.x + this.leftAdjust, this.leftBound);
  98. }
  99. getRightCol() {
  100. return Math.min(this.x + this.rightAdjust, this.rightBound);
  101. }
  102. };
  103. var r2 = [[0, 0], [0, 0], [0, 0], [0, 0]];
  104. var a = 1e-6;
  105. var h = class {
  106. constructor(e3, o2 = null) {
  107. this.tileInfo = e3, this.fullExtent = o2, this.scales = [], this._infoByScale = {}, this._infoByLevel = {};
  108. const l3 = e3.lods.slice();
  109. l3.sort((e4, t) => t.scale - e4.scale);
  110. const s2 = this._lodInfos = l3.map((l4) => l2.create(e3, l4, o2));
  111. l3.forEach((e4, t) => {
  112. this._infoByLevel[e4.level] = s2[t], this._infoByScale[e4.scale] = s2[t], this.scales[t] = e4.scale;
  113. }, this), this._wrap = e3.isWrappable;
  114. }
  115. get spatialReference() {
  116. return this.tileInfo.spatialReference;
  117. }
  118. getLODInfoAt(e3) {
  119. return this._infoByLevel["number" == typeof e3 ? e3 : e3.level];
  120. }
  121. getTileBounds(e3, t, o2 = false) {
  122. i2.set(t);
  123. const l3 = this._infoByLevel[i2.level];
  124. return l3 ? l3.getTileBounds(e3, i2, o2) : e3;
  125. }
  126. getTileCoords(e3, t, o2 = false) {
  127. i2.set(t);
  128. const l3 = this._infoByLevel[i2.level];
  129. return l3 ? l3.getTileCoords(e3, i2, o2) : e3;
  130. }
  131. getTileCoverage(e3, t = 192, l3 = "closest") {
  132. const i3 = "closest" === l3 ? this.getClosestInfoForScale(e3.scale) : this.getSmallestInfoForScale(e3.scale), a2 = l.pool.acquire(i3), h2 = this._wrap;
  133. let c, f, u, m = 1 / 0, g = -1 / 0;
  134. const d = a2.spans;
  135. r2[0][0] = r2[0][1] = r2[1][1] = r2[3][0] = -t, r2[1][0] = r2[2][0] = e3.size[0] + t, r2[2][1] = r2[3][1] = e3.size[1] + t;
  136. for (const o2 of r2)
  137. e3.toMap(o2, o2), o2[0] = i3.getColumnForX(o2[0]), o2[1] = i3.getRowForY(o2[1]);
  138. const y = [];
  139. let v = 3;
  140. for (let o2 = 0; o2 < 4; o2++) {
  141. if (r2[o2][1] === r2[v][1]) {
  142. v = o2;
  143. continue;
  144. }
  145. const e4 = n2.create(r2[o2], r2[v]);
  146. m = Math.min(e4.ymin, m), g = Math.max(e4.ymax, g), void 0 === y[e4.ymin] && (y[e4.ymin] = []), y[e4.ymin].push(e4), v = o2;
  147. }
  148. if (null == m || null == g || g - m > 100)
  149. return null;
  150. let _ = [];
  151. for (c = m; c < g; ) {
  152. null != y[c] && (_ = _.concat(y[c])), f = 1 / 0, u = -1 / 0;
  153. for (let e4 = _.length - 1; e4 >= 0; e4--) {
  154. const t2 = _[e4];
  155. f = Math.min(f, t2.getLeftCol()), u = Math.max(u, t2.getRightCol());
  156. }
  157. if (f = Math.floor(f), u = Math.floor(u), c >= i3.first[1] && c <= i3.last[1])
  158. if (h2)
  159. if (i3.size[0] < i3.worldSize[0]) {
  160. const e4 = Math.floor(u / i3.worldSize[0]);
  161. for (let t2 = Math.floor(f / i3.worldSize[0]); t2 <= e4; t2++)
  162. d.push(new o(c, Math.max(i3.getFirstColumnForWorld(t2), f), Math.min(i3.getLastColumnForWorld(t2), u)));
  163. } else
  164. d.push(new o(c, f, u));
  165. else
  166. f > i3.last[0] || u < i3.first[0] || (f = Math.max(f, i3.first[0]), u = Math.min(u, i3.last[0]), d.push(new o(c, f, u)));
  167. c += 1;
  168. for (let e4 = _.length - 1; e4 >= 0; e4--) {
  169. const t2 = _[e4];
  170. t2.ymax >= c ? t2.incrRow() : _.splice(e4, 1);
  171. }
  172. }
  173. return a2;
  174. }
  175. getTileParentId(e3) {
  176. i2.set(e3);
  177. const t = this._infoByLevel[i2.level], o2 = this._lodInfos.indexOf(t) - 1;
  178. return o2 < 0 ? null : (this._getTileIdAtLOD(i2, this._lodInfos[o2], i2), i2.id);
  179. }
  180. getTileResolution(e3) {
  181. const t = this._infoByLevel["object" == typeof e3 ? e3.level : e3];
  182. return t ? t.resolution : -1;
  183. }
  184. getTileScale(e3) {
  185. const t = this._infoByLevel[e3.level];
  186. return t ? t.scale : -1;
  187. }
  188. intersects(e3, t) {
  189. i2.set(t);
  190. const o2 = this._infoByLevel[i2.level], l3 = e3.lodInfo;
  191. if (l3.resolution > o2.resolution) {
  192. this._getTileIdAtLOD(i2, l3, i2);
  193. const t2 = l3.denormalizeCol(i2.col, i2.world);
  194. for (const o3 of e3.spans)
  195. if (o3.row === i2.row && o3.colFrom <= t2 && o3.colTo >= t2)
  196. return true;
  197. }
  198. if (l3.resolution < o2.resolution) {
  199. const [t2, s3, n3, r3] = e3.spans.reduce((e4, t3) => (e4[0] = Math.min(e4[0], t3.row), e4[1] = Math.max(e4[1], t3.row), e4[2] = Math.min(e4[2], t3.colFrom), e4[3] = Math.max(e4[3], t3.colTo), e4), [1 / 0, -1 / 0, 1 / 0, -1 / 0]), a2 = o2.denormalizeCol(i2.col, i2.world), h2 = l3.getColumnForX(o2.getXForColumn(a2)), c = l3.getRowForY(o2.getYForRow(i2.row)), f = l3.getColumnForX(o2.getXForColumn(a2 + 1)) - 1, u = l3.getRowForY(o2.getYForRow(i2.row + 1)) - 1;
  200. return !(h2 > r3 || f < n3 || c > s3 || u < t2);
  201. }
  202. const s2 = l3.denormalizeCol(i2.col, i2.world);
  203. return e3.spans.some((e4) => e4.row === i2.row && e4.colFrom <= s2 && e4.colTo >= s2);
  204. }
  205. normalizeBounds(t, o2, l3) {
  206. if (t[0] = o2[0], t[1] = o2[1], t[2] = o2[2], t[3] = o2[3], this._wrap) {
  207. const o3 = R(this.tileInfo.spatialReference), s2 = -l3 * (o3.valid[1] - o3.valid[0]);
  208. t[0] += s2, t[2] += s2;
  209. }
  210. return t;
  211. }
  212. getSmallestInfoForScale(e3) {
  213. const t = this.scales;
  214. if (this._infoByScale[e3])
  215. return this._infoByScale[e3];
  216. if (e3 > t[0])
  217. return this._infoByScale[t[0]];
  218. for (let o2 = 1; o2 < t.length - 1; o2++)
  219. if (e3 > t[o2] + a)
  220. return this._infoByScale[t[o2 - 1]];
  221. return this._infoByScale[t[t.length - 1]];
  222. }
  223. getClosestInfoForScale(e3) {
  224. const t = this.scales;
  225. return this._infoByScale[e3] || (e3 = t.reduce((t2, o2) => Math.abs(o2 - e3) < Math.abs(t2 - e3) ? o2 : t2, t[0])), this._infoByScale[e3];
  226. }
  227. scaleToLevel(e3) {
  228. const t = this.scales;
  229. if (this._infoByScale[e3])
  230. return this._infoByScale[e3].level;
  231. for (let o2 = t.length - 1; o2 >= 0; o2--)
  232. if (e3 < t[o2]) {
  233. if (o2 === t.length - 1)
  234. return this._infoByScale[t[t.length - 1]].level;
  235. return this._infoByScale[t[o2]].level + (t[o2] - e3) / (t[o2] - t[o2 + 1]);
  236. }
  237. return this._infoByScale[t[0]].level;
  238. }
  239. scaleToZoom(e3) {
  240. return this.tileInfo.scaleToZoom(e3);
  241. }
  242. _getTileIdAtLOD(e3, t, o2) {
  243. const l3 = this._infoByLevel[o2.level];
  244. return e3.set(o2), t.resolution < l3.resolution ? null : (t.resolution === l3.resolution || (e3.level = t.level, e3.col = Math.floor(o2.col * l3.resolution / t.resolution + 0.01), e3.row = Math.floor(o2.row * l3.resolution / t.resolution + 0.01)), e3);
  245. }
  246. };
  247. export {
  248. h
  249. };
  250. //# sourceMappingURL=chunk-VQXMCZYH.js.map