geometryServiceUtils-ZH623NJZ.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. import {
  2. e as e2,
  3. n as n2
  4. } from "./chunk-YASLQAXE.js";
  5. import {
  6. a,
  7. v
  8. } from "./chunk-2Z6LERTI.js";
  9. import "./chunk-OWVBLVP3.js";
  10. import {
  11. B
  12. } from "./chunk-4NKD334K.js";
  13. import "./chunk-65K7LC56.js";
  14. import "./chunk-ATPLLI5W.js";
  15. import "./chunk-XH7RUGVZ.js";
  16. import "./chunk-TBBTRX4O.js";
  17. import "./chunk-YBSUITLL.js";
  18. import {
  19. U
  20. } from "./chunk-VNFRAYHO.js";
  21. import "./chunk-R5IG2D6H.js";
  22. import "./chunk-VBRY5KJM.js";
  23. import "./chunk-PDKDCAAD.js";
  24. import "./chunk-ECW2QABR.js";
  25. import "./chunk-GCDJLKH4.js";
  26. import "./chunk-MRJEICT6.js";
  27. import {
  28. d,
  29. e,
  30. l3 as l,
  31. n2 as n
  32. } from "./chunk-Y3WMVFTW.js";
  33. import "./chunk-SAS7RONY.js";
  34. import "./chunk-WSRBH7BF.js";
  35. import {
  36. b
  37. } from "./chunk-IHXECKQQ.js";
  38. import "./chunk-ULGDPLM2.js";
  39. import {
  40. r,
  41. s3 as s
  42. } from "./chunk-EMJ4ZSM2.js";
  43. import "./chunk-IKP3YN53.js";
  44. import "./chunk-GZT4BVFP.js";
  45. import "./chunk-A5ICIBVI.js";
  46. // node_modules/@arcgis/core/rest/geometryService/utils.js
  47. function o(e3, r2, o2) {
  48. const n5 = a(r2);
  49. return e3.map((e4) => {
  50. const t = n5.fromJSON(e4);
  51. return t.spatialReference = o2, t;
  52. });
  53. }
  54. // node_modules/@arcgis/core/rest/support/ProjectParameters.js
  55. var i = class extends l {
  56. constructor(r2) {
  57. super(r2), this.geometries = null, this.outSpatialReference = null, this.transformation = null, this.transformForward = null;
  58. }
  59. toJSON() {
  60. const r2 = this.geometries.map((r3) => r3.toJSON()), t = this.geometries[0], o2 = {};
  61. return o2.outSR = this.outSpatialReference.wkid || JSON.stringify(this.outSpatialReference.toJSON()), o2.inSR = t.spatialReference.wkid || JSON.stringify(t.spatialReference.toJSON()), o2.geometries = JSON.stringify({ geometryType: v(t), geometries: r2 }), this.transformation && (o2.transformation = this.transformation.wkid || JSON.stringify(this.transformation)), this.transformForward != null && (o2.transformForward = this.transformForward), o2;
  62. }
  63. };
  64. e([d()], i.prototype, "geometries", void 0), e([d({ json: { read: { source: "outSR" } } })], i.prototype, "outSpatialReference", void 0), e([d()], i.prototype, "transformation", void 0), e([d()], i.prototype, "transformForward", void 0), i = e([n("esri.rest.support.ProjectParameters")], i);
  65. var a2 = i;
  66. // node_modules/@arcgis/core/rest/geometryService/project.js
  67. var i2 = b(a2);
  68. async function n3(o2, m, n5) {
  69. m = i2(m);
  70. const u = n2(o2), c = { ...u.query, f: "json", ...m.toJSON() }, j = m.outSpatialReference, a4 = v(m.geometries[0]), f = e2(c, n5);
  71. return U(u.path + "/project", f).then(({ data: { geometries: r2 } }) => o(r2, a4, j));
  72. }
  73. // node_modules/@arcgis/core/portal/support/geometryServiceUtils.js
  74. async function n4(o2 = null, i3) {
  75. if (r.geometryServiceUrl)
  76. return r.geometryServiceUrl;
  77. if (!o2)
  78. throw new s("internal:geometry-service-url-not-configured");
  79. let n5;
  80. n5 = "portal" in o2 ? o2.portal || B.getDefault() : o2, await n5.load({ signal: i3 });
  81. const a4 = n5.helperServices?.geometry?.url;
  82. if (!a4)
  83. throw new s("internal:geometry-service-url-not-configured");
  84. return a4;
  85. }
  86. async function a3(r2, t, a4 = null, l2) {
  87. const c = await n4(a4, l2), s2 = new a2();
  88. s2.geometries = [r2], s2.outSpatialReference = t;
  89. const m = await n3(c, s2, { signal: l2 });
  90. if (m && Array.isArray(m) && m.length === 1)
  91. return m[0];
  92. throw new s("internal:geometry-service-projection-failed");
  93. }
  94. export {
  95. n4 as getGeometryServiceURL,
  96. a3 as projectGeometry
  97. };
  98. //# sourceMappingURL=geometryServiceUtils-ZH623NJZ.js.map