chunk-5FHVUYVE.js 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. import {
  2. e
  3. } from "./chunk-M5BTTMP6.js";
  4. import {
  5. h
  6. } from "./chunk-4GGRJYTB.js";
  7. import {
  8. ge
  9. } from "./chunk-FYNVVMWY.js";
  10. import {
  11. s as s3,
  12. t as t2
  13. } from "./chunk-HBMVUVZX.js";
  14. import {
  15. O
  16. } from "./chunk-WNCU6BFU.js";
  17. import {
  18. D,
  19. u
  20. } from "./chunk-N2663GRX.js";
  21. import {
  22. n
  23. } from "./chunk-DT6EAZQ5.js";
  24. import {
  25. s,
  26. s3 as s2
  27. } from "./chunk-EMJ4ZSM2.js";
  28. import {
  29. a,
  30. r,
  31. t
  32. } from "./chunk-GZT4BVFP.js";
  33. // node_modules/@arcgis/core/layers/graphics/data/BoundsStore.js
  34. var n2 = 5e4;
  35. var t3 = { minX: 0, minY: 0, maxX: 0, maxY: 0 };
  36. function e2(i2) {
  37. t3.minX = i2[0], t3.minY = i2[1], t3.maxX = i2[2], t3.maxY = i2[3];
  38. }
  39. function o(i2, s4, d) {
  40. e2(s4), i2.search(t3, d);
  41. }
  42. var h2 = class {
  43. constructor() {
  44. this._indexInvalid = false, this._boundsToLoad = [], this._boundsById = new Map(), this._idByBounds = new Map(), this._index = new h(9, a("esri-csp-restrictions") ? (i2) => ({ minX: i2[0], minY: i2[1], maxX: i2[2], maxY: i2[3] }) : ["[0]", "[1]", "[2]", "[3]"]), this._loadIndex = () => {
  45. if (this._indexInvalid) {
  46. const i2 = new Array(this._idByBounds.size);
  47. let s4 = 0;
  48. this._idByBounds.forEach((d, n3) => {
  49. i2[s4++] = n3;
  50. }), this._indexInvalid = false, this._index.clear(), this._index.load(i2);
  51. } else
  52. this._boundsToLoad.length && (this._index.load(this._boundsToLoad.filter((i2) => this._idByBounds.has(i2))), this._boundsToLoad.length = 0);
  53. };
  54. }
  55. get fullBounds() {
  56. if (!this._boundsById.size)
  57. return null;
  58. const i2 = D();
  59. for (const s4 of this._boundsById.values())
  60. s4 && (i2[0] = Math.min(s4[0], i2[0]), i2[1] = Math.min(s4[1], i2[1]), i2[2] = Math.max(s4[2], i2[2]), i2[3] = Math.max(s4[3], i2[3]));
  61. return i2;
  62. }
  63. get valid() {
  64. return !this._indexInvalid;
  65. }
  66. clear() {
  67. this._indexInvalid = false, this._boundsToLoad.length = 0, this._boundsById.clear(), this._idByBounds.clear(), this._index.clear();
  68. }
  69. delete(i2) {
  70. const s4 = this._boundsById.get(i2);
  71. this._boundsById.delete(i2), s4 && (this._idByBounds.delete(s4), this._indexInvalid || this._index.remove(s4));
  72. }
  73. forEachInBounds(i2, s4) {
  74. this._loadIndex(), o(this._index, i2, (i3) => s4(this._idByBounds.get(i3)));
  75. }
  76. get(i2) {
  77. return this._boundsById.get(i2);
  78. }
  79. has(i2) {
  80. return this._boundsById.has(i2);
  81. }
  82. invalidateIndex() {
  83. this._indexInvalid || (this._indexInvalid = true, this._boundsToLoad.length = 0);
  84. }
  85. set(i2, s4) {
  86. if (!this._indexInvalid) {
  87. const s5 = this._boundsById.get(i2);
  88. s5 && (this._index.remove(s5), this._idByBounds.delete(s5));
  89. }
  90. this._boundsById.set(i2, s4), s4 && (this._idByBounds.set(s4, i2), this._indexInvalid || (this._boundsToLoad.push(s4), this._boundsToLoad.length > n2 && this._loadIndex()));
  91. }
  92. };
  93. // node_modules/@arcgis/core/layers/graphics/data/optimizedFeatureQueryEngineAdapter.js
  94. var i = { getObjectId: (t4) => t4.objectId, getAttributes: (t4) => t4.attributes, getAttribute: (t4, e3) => t4.attributes[e3], cloneWithGeometry: (t4, e3) => new s3(e3, t4.attributes, null, t4.objectId), getGeometry: (t4) => t4.geometry, getCentroid: (r2, i2) => (t(r2.centroid) && (r2.centroid = e(new t2(), r2.geometry, i2.hasZ, i2.hasM)), r2.centroid) };
  95. // node_modules/@arcgis/core/layers/graphics/data/FeatureStore.js
  96. var u2 = class {
  97. constructor(e3) {
  98. this.geometryInfo = e3, this._boundsStore = new h2(), this._featuresById = new Map(), this._markedIds = new Set(), this.events = new n(), this.featureAdapter = i;
  99. }
  100. get geometryType() {
  101. return this.geometryInfo.geometryType;
  102. }
  103. get hasM() {
  104. return this.geometryInfo.hasM;
  105. }
  106. get hasZ() {
  107. return this.geometryInfo.hasZ;
  108. }
  109. get numFeatures() {
  110. return this._featuresById.size;
  111. }
  112. get fullBounds() {
  113. return this._boundsStore.fullBounds;
  114. }
  115. get storeStatistics() {
  116. let e3 = 0;
  117. return this._featuresById.forEach((t4) => {
  118. r(t4.geometry) && t4.geometry.coords && (e3 += t4.geometry.coords.length);
  119. }), { featureCount: this._featuresById.size, vertexCount: e3 / (this.hasZ ? this.hasM ? 4 : 3 : this.hasM ? 3 : 2) };
  120. }
  121. add(e3) {
  122. this._add(e3), this._emitChanged();
  123. }
  124. addMany(e3) {
  125. for (const t4 of e3)
  126. this._add(t4);
  127. this._emitChanged();
  128. }
  129. clear() {
  130. this._featuresById.clear(), this._boundsStore.clear(), this._emitChanged();
  131. }
  132. removeById(e3) {
  133. const t4 = this._featuresById.get(e3);
  134. return t4 ? (this._remove(t4), this._emitChanged(), t4) : null;
  135. }
  136. removeManyById(e3) {
  137. this._boundsStore.invalidateIndex();
  138. for (const t4 of e3) {
  139. const e4 = this._featuresById.get(t4);
  140. e4 && this._remove(e4);
  141. }
  142. this._emitChanged();
  143. }
  144. forEachBounds(e3, t4, r2) {
  145. for (const s4 of e3) {
  146. const e4 = this._boundsStore.get(s4.objectId);
  147. e4 && t4(O(r2, e4));
  148. }
  149. }
  150. getFeature(e3) {
  151. return this._featuresById.get(e3);
  152. }
  153. has(e3) {
  154. return this._featuresById.has(e3);
  155. }
  156. toArray() {
  157. return Array.from(this._featuresById.values());
  158. }
  159. forEach(e3) {
  160. this._featuresById.forEach((t4) => e3(t4));
  161. }
  162. forEachInBounds(e3, t4) {
  163. this._boundsStore.forEachInBounds(e3, (e4) => {
  164. t4(this._featuresById.get(e4));
  165. });
  166. }
  167. startMarkingUsedFeatures() {
  168. this._boundsStore.invalidateIndex(), this._markedIds.clear();
  169. }
  170. sweep() {
  171. let e3 = false;
  172. this._featuresById.forEach((t4, r2) => {
  173. this._markedIds.has(r2) || (e3 = true, this._remove(t4));
  174. }), this._markedIds.clear(), e3 && this._emitChanged();
  175. }
  176. _emitChanged() {
  177. this.events.emit("changed", void 0);
  178. }
  179. _add(t4) {
  180. if (!t4)
  181. return;
  182. const i2 = t4.objectId;
  183. if (i2 == null)
  184. return void s.getLogger("esri.layers.graphics.data.FeatureStore").error(new s2("featurestore:invalid-feature", "feature id is missing", { feature: t4 }));
  185. const n3 = this._featuresById.get(i2);
  186. let h3;
  187. if (this._markedIds.add(i2), n3 ? (t4.displayId = n3.displayId, h3 = this._boundsStore.get(i2), this._boundsStore.delete(i2)) : r(this.onFeatureAdd) && this.onFeatureAdd(t4), t(t4.geometry) || !t4.geometry.coords || !t4.geometry.coords.length)
  188. return this._boundsStore.set(i2, null), void this._featuresById.set(i2, t4);
  189. h3 = ge(r(h3) ? h3 : u(), t4.geometry, this.geometryInfo.hasZ, this.geometryInfo.hasM), r(h3) && this._boundsStore.set(i2, h3), this._featuresById.set(i2, t4);
  190. }
  191. _remove(e3) {
  192. return r(this.onFeatureRemove) && this.onFeatureRemove(e3), this._markedIds.delete(e3.objectId), this._boundsStore.delete(e3.objectId), this._featuresById.delete(e3.objectId), e3;
  193. }
  194. };
  195. export {
  196. h2 as h,
  197. u2 as u
  198. };
  199. //# sourceMappingURL=chunk-5FHVUYVE.js.map