chunk-RDOYANC4.js 6.7 KB

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