chunk-2VFJVI2I.js 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. import {
  2. g
  3. } from "./chunk-RZFGRBD7.js";
  4. import {
  5. y
  6. } from "./chunk-BJHM4JNS.js";
  7. import {
  8. i
  9. } from "./chunk-UXF37FQ4.js";
  10. import {
  11. c,
  12. d as d2
  13. } from "./chunk-2Z6LERTI.js";
  14. import {
  15. s
  16. } from "./chunk-PDKDCAAD.js";
  17. import {
  18. o
  19. } from "./chunk-ECW2QABR.js";
  20. import {
  21. k2 as k,
  22. r as r2
  23. } from "./chunk-MRJEICT6.js";
  24. import {
  25. d,
  26. e,
  27. l3 as l,
  28. n2 as n
  29. } from "./chunk-Y3WMVFTW.js";
  30. import {
  31. m
  32. } from "./chunk-IKP3YN53.js";
  33. import {
  34. e as e2,
  35. r
  36. } from "./chunk-GZT4BVFP.js";
  37. // node_modules/@arcgis/core/rest/support/FeatureSet.js
  38. var d3;
  39. var g2 = new s({ esriGeometryPoint: "point", esriGeometryMultipoint: "multipoint", esriGeometryPolyline: "polyline", esriGeometryPolygon: "polygon", esriGeometryEnvelope: "extent", mesh: "mesh", "": null });
  40. var j = d3 = class extends l {
  41. constructor(e3) {
  42. super(e3), this.displayFieldName = null, this.exceededTransferLimit = false, this.features = [], this.fields = null, this.geometryType = null, this.hasM = false, this.hasZ = false, this.queryGeometry = null, this.spatialReference = null;
  43. }
  44. readFeatures(e3, t) {
  45. const o2 = k.fromJSON(t.spatialReference), s2 = [];
  46. for (let i2 = 0; i2 < e3.length; i2++) {
  47. const t2 = e3[i2], a = g.fromJSON(t2), p = t2.geometry && t2.geometry.spatialReference;
  48. r(a.geometry) && !p && (a.geometry.spatialReference = o2);
  49. const l2 = t2.aggregateGeometries, y2 = a.aggregateGeometries;
  50. if (l2 && r(y2))
  51. for (const e4 in y2) {
  52. const t3 = y2[e4], r3 = l2[e4]?.spatialReference;
  53. r(t3) && !r3 && (t3.spatialReference = o2);
  54. }
  55. s2.push(a);
  56. }
  57. return s2;
  58. }
  59. writeGeometryType(e3, t, r3, o2) {
  60. if (e3)
  61. return void g2.write(e3, t, r3, o2);
  62. const { features: s2 } = this;
  63. if (s2) {
  64. for (const i2 of s2)
  65. if (i2 && r(i2.geometry))
  66. return void g2.write(i2.geometry.type, t, r3, o2);
  67. }
  68. }
  69. readQueryGeometry(e3, t) {
  70. if (!e3)
  71. return null;
  72. const r3 = !!e3.spatialReference, o2 = d2(e3);
  73. return !r3 && t.spatialReference && (o2.spatialReference = k.fromJSON(t.spatialReference)), o2;
  74. }
  75. writeSpatialReference(e3, t) {
  76. if (e3)
  77. return void (t.spatialReference = e3.toJSON());
  78. const { features: r3 } = this;
  79. if (r3) {
  80. for (const o2 of r3)
  81. if (o2 && r(o2.geometry) && o2.geometry.spatialReference)
  82. return void (t.spatialReference = o2.geometry.spatialReference.toJSON());
  83. }
  84. }
  85. clone() {
  86. return new d3(this.cloneProperties());
  87. }
  88. cloneProperties() {
  89. return m({ displayFieldName: this.displayFieldName, exceededTransferLimit: this.exceededTransferLimit, features: this.features, fields: this.fields, geometryType: this.geometryType, hasM: this.hasM, hasZ: this.hasZ, queryGeometry: this.queryGeometry, spatialReference: this.spatialReference, transform: this.transform });
  90. }
  91. toJSON(e3) {
  92. const t = this.write();
  93. if (t.features && Array.isArray(e3) && e3.length > 0)
  94. for (let r3 = 0; r3 < t.features.length; r3++) {
  95. const o2 = t.features[r3];
  96. if (o2.geometry) {
  97. const t2 = e3 && e3[r3];
  98. o2.geometry = t2 && t2.toJSON() || o2.geometry;
  99. }
  100. }
  101. return t;
  102. }
  103. quantize(e3) {
  104. const { scale: [t, r3], translate: [o2, s2] } = e3, i2 = (e4) => Math.round((e4 - o2) / t), n2 = (e4) => Math.round((s2 - e4) / r3), p = this.features, l2 = this._getQuantizationFunction(this.geometryType, i2, n2);
  105. for (let y2 = 0, m2 = p.length; y2 < m2; y2++)
  106. l2(e2(p[y2].geometry)) || (p.splice(y2, 1), y2--, m2--);
  107. return this.transform = e3, this;
  108. }
  109. unquantize() {
  110. const { geometryType: e3, features: t, transform: r3 } = this;
  111. if (!r3)
  112. return this;
  113. const { translate: [o2, s2], scale: [i2, a] } = r3, p = (e4) => e4 * i2 + o2, l2 = (e4) => s2 - e4 * a, y2 = this._getHydrationFunction(e3, p, l2);
  114. for (const { geometry: m2 } of t)
  115. r(m2) && y2(m2);
  116. return this.transform = null, this;
  117. }
  118. _quantizePoints(e3, t, r3) {
  119. let o2, s2;
  120. const i2 = [];
  121. for (let n2 = 0, a = e3.length; n2 < a; n2++) {
  122. const a2 = e3[n2];
  123. if (n2 > 0) {
  124. const e4 = t(a2[0]), n3 = r3(a2[1]);
  125. e4 === o2 && n3 === s2 || (i2.push([e4 - o2, n3 - s2]), o2 = e4, s2 = n3);
  126. } else
  127. o2 = t(a2[0]), s2 = r3(a2[1]), i2.push([o2, s2]);
  128. }
  129. return i2.length > 0 ? i2 : null;
  130. }
  131. _getQuantizationFunction(e3, t, r3) {
  132. return e3 === "point" ? (e4) => (e4.x = t(e4.x), e4.y = r3(e4.y), e4) : e3 === "polyline" || e3 === "polygon" ? (e4) => {
  133. const o2 = c(e4) ? e4.rings : e4.paths, s2 = [];
  134. for (let i2 = 0, n2 = o2.length; i2 < n2; i2++) {
  135. const e5 = o2[i2], n3 = this._quantizePoints(e5, t, r3);
  136. n3 && s2.push(n3);
  137. }
  138. return s2.length > 0 ? (c(e4) ? e4.rings = s2 : e4.paths = s2, e4) : null;
  139. } : e3 === "multipoint" ? (e4) => {
  140. const o2 = this._quantizePoints(e4.points, t, r3);
  141. return o2.length > 0 ? (e4.points = o2, e4) : null;
  142. } : e3 === "extent" ? (e4) => e4 : null;
  143. }
  144. _getHydrationFunction(e3, t, r3) {
  145. return e3 === "point" ? (e4) => {
  146. e4.x = t(e4.x), e4.y = r3(e4.y);
  147. } : e3 === "polyline" || e3 === "polygon" ? (e4) => {
  148. const o2 = c(e4) ? e4.rings : e4.paths;
  149. let s2, i2;
  150. for (let n2 = 0, a = o2.length; n2 < a; n2++) {
  151. const e5 = o2[n2];
  152. for (let o3 = 0, n3 = e5.length; o3 < n3; o3++) {
  153. const n4 = e5[o3];
  154. o3 > 0 ? (s2 += n4[0], i2 += n4[1]) : (s2 = n4[0], i2 = n4[1]), n4[0] = t(s2), n4[1] = r3(i2);
  155. }
  156. }
  157. } : e3 === "extent" ? (e4) => {
  158. e4.xmin = t(e4.xmin), e4.ymin = r3(e4.ymin), e4.xmax = t(e4.xmax), e4.ymax = r3(e4.ymax);
  159. } : e3 === "multipoint" ? (e4) => {
  160. const o2 = e4.points;
  161. let s2, i2;
  162. for (let n2 = 0, a = o2.length; n2 < a; n2++) {
  163. const e5 = o2[n2];
  164. n2 > 0 ? (s2 += e5[0], i2 += e5[1]) : (s2 = e5[0], i2 = e5[1]), e5[0] = t(s2), e5[1] = r3(i2);
  165. }
  166. } : void 0;
  167. }
  168. };
  169. e([d({ type: String, json: { write: true } })], j.prototype, "displayFieldName", void 0), e([d({ type: Boolean, json: { write: { overridePolicy: (e3) => ({ enabled: e3 }) } } })], j.prototype, "exceededTransferLimit", void 0), e([d({ type: [g], json: { write: true } })], j.prototype, "features", void 0), e([o("features")], j.prototype, "readFeatures", null), e([d({ type: [y], json: { write: true } })], j.prototype, "fields", void 0), e([d({ type: ["point", "multipoint", "polyline", "polygon", "extent", "mesh"], json: { read: { reader: g2.read } } })], j.prototype, "geometryType", void 0), e([r2("geometryType")], j.prototype, "writeGeometryType", null), e([d({ type: Boolean, json: { write: { overridePolicy: (e3) => ({ enabled: e3 }) } } })], j.prototype, "hasM", void 0), e([d({ type: Boolean, json: { write: { overridePolicy: (e3) => ({ enabled: e3 }) } } })], j.prototype, "hasZ", void 0), e([d({ types: i, json: { write: true } })], j.prototype, "queryGeometry", void 0), e([o("queryGeometry")], j.prototype, "readQueryGeometry", null), e([d({ type: k, json: { write: true } })], j.prototype, "spatialReference", void 0), e([r2("spatialReference")], j.prototype, "writeSpatialReference", null), e([d({ json: { write: true } })], j.prototype, "transform", void 0), j = d3 = e([n("esri.rest.support.FeatureSet")], j), j.prototype.toJSON.isDefaultToJSON = true;
  170. var x = j;
  171. export {
  172. x
  173. };
  174. //# sourceMappingURL=chunk-2VFJVI2I.js.map