chunk-HEFAWVPH.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. import {
  2. G,
  3. j2 as j
  4. } from "./chunk-ECW2QABR.js";
  5. // node_modules/@arcgis/core/arcade/functions/centroid.js
  6. function e(t, n, e2) {
  7. return Math.sqrt((t[0] - n[0]) ** 2 + (t[1] - n[1]) ** 2 + (t[2] !== void 0 && n[2] !== void 0 ? (t[2] * e2 - n[2] * e2) ** 2 : 0));
  8. }
  9. var r = [];
  10. for (const v of [[9002, 56146130, 6131, 6132, 8050, 8051, 8228], [9003, 5702, 6358, 6359, 6360, 8052, 8053], [9095, 5754]]) {
  11. const t = v[0];
  12. for (let n = 1; n < v.length; n++)
  13. r[v[n]] = t;
  14. }
  15. var o = [];
  16. function s(t) {
  17. return t.vcsWkid && r[t.vcsWkid] !== void 0 ? o[r[t.vcsWkid]] : t.latestVcsWkid && r[t.latestVcsWkid] !== void 0 ? o[r[t.latestVcsWkid]] : 1;
  18. }
  19. function c(t, n, e2) {
  20. const r2 = { x: 0, y: 0 };
  21. n && (r2.z = 0), e2 && (r2.m = 0);
  22. let o2 = 0, s2 = t[0];
  23. for (let c2 = 0; c2 < t.length; c2++) {
  24. const a2 = t[c2];
  25. if (f(a2, s2) === false) {
  26. const t2 = h(s2, a2, n), c3 = i(s2, a2, n, e2);
  27. c3.x *= t2, c3.y *= t2, r2.x += c3.x, r2.y += c3.y, n && (c3.z *= t2, r2.z += c3.z), e2 && (c3.m *= t2, r2.m += c3.m), o2 += t2, s2 = a2;
  28. }
  29. }
  30. return o2 > 0 ? (r2.x /= o2, r2.y /= o2, n && (r2.z /= o2), e2 && (r2.m /= o2)) : (r2.x = t[0][0], r2.y = t[0][1], n && (r2.z = t[0][2]), e2 && n ? r2.m = t[0][3] : e2 && (r2.m = t[0][2])), r2;
  31. }
  32. function i(t, n, e2, r2) {
  33. const o2 = { x: (t[0] + n[0]) / 2, y: (t[1] + n[1]) / 2 };
  34. return e2 && (o2.z = (t[2] + n[2]) / 2), e2 && r2 ? o2.m = (t[3] + n[3]) / 2 : r2 && (o2.m = (t[2] + n[2]) / 2), o2;
  35. }
  36. function a(t, n) {
  37. if (t.length <= 1)
  38. return 0;
  39. let e2 = 0;
  40. for (let r2 = 1; r2 < t.length; r2++)
  41. e2 += h(t[r2 - 1], t[r2], n);
  42. return e2;
  43. }
  44. function h(t, n, e2) {
  45. const r2 = n[0] - t[0], o2 = n[1] - t[1];
  46. if (e2) {
  47. const t2 = n[2] - n[2];
  48. return Math.sqrt(r2 * r2 + o2 * o2 + t2 * t2);
  49. }
  50. return Math.sqrt(r2 * r2 + o2 * o2);
  51. }
  52. function f(t, n) {
  53. if (t.length !== n.length)
  54. return false;
  55. for (let e2 = 0; e2 < t.length; e2++)
  56. if (t[e2] !== n[e2])
  57. return false;
  58. return true;
  59. }
  60. function l(n) {
  61. const e2 = { x: 0, y: 0, spatialReference: n.spatialReference.toJSON() }, r2 = { x: 0, y: 0, spatialReference: n.spatialReference.toJSON() };
  62. let o2 = 0, s2 = 0;
  63. for (let t = 0; t < n.paths.length; t++) {
  64. if (n.paths[t].length === 0)
  65. continue;
  66. const i2 = a(n.paths[t], n.hasZ === true);
  67. if (i2 === 0) {
  68. const r3 = c(n.paths[t], n.hasZ === true, n.hasM === true);
  69. e2.x += r3.x, e2.y += r3.y, n.hasZ === true && (e2.z += r3.z), n.hasM === true && (e2.m += r3.m), ++o2;
  70. } else {
  71. const e3 = c(n.paths[t], n.hasZ === true, n.hasM === true);
  72. r2.x += e3.x * i2, r2.y += e3.y * i2, n.hasZ === true && (r2.z += e3.z * i2), n.hasM === true && (r2.m += e3.m * i2), s2 += i2;
  73. }
  74. }
  75. return s2 > 0 ? (r2.x /= s2, r2.y /= s2, n.hasZ === true && (r2.z /= s2), n.hasM === true && (r2.m /= s2), new j(r2)) : o2 > 0 ? (e2.x /= o2, e2.y /= o2, n.hasZ === true && (r2.z /= o2), n.hasM === true && (e2.m /= o2), new j(e2)) : null;
  76. }
  77. function u(n) {
  78. if (n.points.length === 0)
  79. return null;
  80. let e2 = 0, r2 = 0, o2 = 0, s2 = 0;
  81. for (let t = 0; t < n.points.length; t++) {
  82. const c3 = n.getPoint(t);
  83. c3.hasZ === true && (o2 += c3.z), c3.hasM === true && (s2 += c3.m), e2 += c3.x, r2 += c3.y, s2 += c3.m;
  84. }
  85. const c2 = { x: e2 / n.points.length, y: r2 / n.points.length, spatialReference: null };
  86. return c2.spatialReference = n.spatialReference.toJSON(), n.hasZ === true && (c2.z = o2 / n.points.length), n.hasM === true && (c2.m = s2 / n.points.length), new j(c2);
  87. }
  88. function y(t, n) {
  89. return t.x * n.x + t.y * n.y;
  90. }
  91. function x(t, n) {
  92. return t.x * n.y - n.x * t.y;
  93. }
  94. function m(t, n, e2 = 0) {
  95. for (; t < e2; )
  96. t += n;
  97. const r2 = e2 + n;
  98. for (; t >= r2; )
  99. t -= n;
  100. return t;
  101. }
  102. function g(t, n) {
  103. return Math.atan2(n.y - t.y, n.x - t.x);
  104. }
  105. function p(t, n) {
  106. return m(g(t, n), 2 * Math.PI) * (180 / Math.PI);
  107. }
  108. function M(t, n) {
  109. return m(Math.PI / 2 - g(t, n), 2 * Math.PI) * (180 / Math.PI);
  110. }
  111. function z(t, n, e2) {
  112. const r2 = { x: t.x - n.x, y: t.y - n.y }, o2 = { x: e2.x - n.x, y: e2.y - n.y };
  113. return Math.atan2(x(r2, o2), y(r2, o2));
  114. }
  115. function P(t, n, e2) {
  116. return m(z(t, n, e2), 2 * Math.PI) * (180 / Math.PI);
  117. }
  118. function d(t, n, e2) {
  119. return m(-1 * z(t, n, e2), 2 * Math.PI) * (180 / Math.PI);
  120. }
  121. o[9002] = 0.3048, o[9003] = 0.3048006096012192, o[9095] = 0.3048007491;
  122. var I = [0, 0];
  123. function Z(t) {
  124. for (let e2 = 0; e2 < t.length; e2++) {
  125. const r2 = t[e2];
  126. for (let s2 = 0; s2 < r2.length - 1; s2++) {
  127. const o3 = r2[s2], c2 = r2[s2 + 1];
  128. for (let r3 = e2 + 1; r3 < t.length; r3++)
  129. for (let e3 = 0; e3 < t[r3].length - 1; e3++) {
  130. const s3 = t[r3][e3], i2 = t[r3][e3 + 1];
  131. if (G(o3, c2, s3, i2, I) && !(I[0] === o3[0] && I[1] === o3[1] || I[0] === s3[0] && I[1] === s3[1] || I[0] === c2[0] && I[1] === c2[1] || I[0] === i2[0] && I[1] === i2[1]))
  132. return true;
  133. }
  134. }
  135. const o2 = r2.length;
  136. if (!(o2 < 3))
  137. for (let t2 = 0; t2 <= o2 - 2; t2++) {
  138. const e3 = r2[t2], s2 = r2[t2 + 1];
  139. for (let c2 = t2 + 2; c2 <= o2 - 2; c2++) {
  140. const t3 = r2[c2], o3 = r2[c2 + 1];
  141. if (G(e3, s2, t3, o3, I) && !(I[0] === e3[0] && I[1] === e3[1] || I[0] === t3[0] && I[1] === t3[1] || I[0] === s2[0] && I[1] === s2[1] || I[0] === o3[0] && I[1] === o3[1]))
  142. return true;
  143. }
  144. }
  145. }
  146. return false;
  147. }
  148. export {
  149. e,
  150. s,
  151. l,
  152. u,
  153. p,
  154. M,
  155. P,
  156. d,
  157. Z
  158. };
  159. //# sourceMappingURL=chunk-HEFAWVPH.js.map