FeatureFilter-DN2CX36X.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. import {
  2. u as u2
  3. } from "./chunk-U2FIWR5R.js";
  4. import "./chunk-P2L4QEOI.js";
  5. import "./chunk-D6FGJON6.js";
  6. import {
  7. n,
  8. v as v2
  9. } from "./chunk-HSPVIAVJ.js";
  10. import {
  11. v
  12. } from "./chunk-XIEPNAEI.js";
  13. import "./chunk-M5BTTMP6.js";
  14. import "./chunk-XZA4MVET.js";
  15. import "./chunk-VAY3LZG7.js";
  16. import "./chunk-P4UZNLD5.js";
  17. import "./chunk-FYNVVMWY.js";
  18. import "./chunk-Q52DVFYK.js";
  19. import "./chunk-HBMVUVZX.js";
  20. import "./chunk-QOV6ITMI.js";
  21. import "./chunk-DH2OBAUC.js";
  22. import "./chunk-TNLRDNTC.js";
  23. import {
  24. b
  25. } from "./chunk-UD63WBG3.js";
  26. import "./chunk-LY74KTXV.js";
  27. import "./chunk-EWE6EXPY.js";
  28. import "./chunk-WNCU6BFU.js";
  29. import "./chunk-BJHM4JNS.js";
  30. import "./chunk-F6A2QQ26.js";
  31. import "./chunk-7ZIDBK7B.js";
  32. import "./chunk-EG5OI4V4.js";
  33. import "./chunk-LRDX4TO7.js";
  34. import "./chunk-TERAW6FT.js";
  35. import {
  36. u
  37. } from "./chunk-N2663GRX.js";
  38. import "./chunk-O4FY3ITT.js";
  39. import "./chunk-UXF37FQ4.js";
  40. import "./chunk-ZOEK6QHJ.js";
  41. import "./chunk-XNLG7T2T.js";
  42. import "./chunk-IR4PV7VK.js";
  43. import "./chunk-2Z6LERTI.js";
  44. import {
  45. c
  46. } from "./chunk-OWVBLVP3.js";
  47. import "./chunk-MXB2XLKV.js";
  48. import "./chunk-ALDCDSPV.js";
  49. import "./chunk-DT6EAZQ5.js";
  50. import "./chunk-HNOZUNJ4.js";
  51. import "./chunk-VNFRAYHO.js";
  52. import "./chunk-R5IG2D6H.js";
  53. import "./chunk-VBRY5KJM.js";
  54. import "./chunk-PDKDCAAD.js";
  55. import "./chunk-ECW2QABR.js";
  56. import "./chunk-GCDJLKH4.js";
  57. import "./chunk-MRJEICT6.js";
  58. import "./chunk-Y3WMVFTW.js";
  59. import "./chunk-SAS7RONY.js";
  60. import "./chunk-WSRBH7BF.js";
  61. import "./chunk-IHXECKQQ.js";
  62. import "./chunk-ULGDPLM2.js";
  63. import {
  64. s,
  65. s3 as s2
  66. } from "./chunk-EMJ4ZSM2.js";
  67. import "./chunk-IKP3YN53.js";
  68. import {
  69. t
  70. } from "./chunk-GZT4BVFP.js";
  71. import "./chunk-A5ICIBVI.js";
  72. // node_modules/@arcgis/core/views/2d/layers/features/support/whereUtils.js
  73. var t2 = s.getLogger("esri.views.2d.layers.features.support.whereUtils");
  74. var a = { getAttribute: (e, r) => e.field(r) };
  75. async function s3(r, s4) {
  76. const n2 = await import("./WhereClause-3WNNGKYX.js");
  77. try {
  78. const o = n2.WhereClause.create(r, s4);
  79. if (!o.isStandardized) {
  80. const r2 = new s2("mapview - bad input", "Unable to apply filter's definition expression, as expression is not standardized.", o);
  81. t2.error(r2);
  82. }
  83. return (e) => {
  84. const r2 = e.readArcadeFeature();
  85. return o.testFeature(r2, a);
  86. };
  87. } catch (o) {
  88. return t2.warn("mapview-bad-where-clause", "Encountered an error when evaluating where clause", r), (e) => true;
  89. }
  90. }
  91. // node_modules/@arcgis/core/views/2d/layers/features/support/FeatureFilter.js
  92. var m = s.getLogger("esri.views.2d.layers.features.controllers.FeatureFilter");
  93. var _ = 1;
  94. var p = 2;
  95. var y = class {
  96. constructor(t3) {
  97. this._geometryBounds = u(), this._idToVisibility = new Map(), this._serviceInfo = t3;
  98. }
  99. get hash() {
  100. return this._hash;
  101. }
  102. check(t3) {
  103. return this._applyFilter(t3);
  104. }
  105. clear() {
  106. const t3 = this._resetAllHiddenIds();
  107. return this.update(), { show: t3, hide: [] };
  108. }
  109. invalidate() {
  110. this._idToVisibility.forEach((t3, e) => {
  111. this._idToVisibility.set(e, 0);
  112. });
  113. }
  114. setKnownIds(t3) {
  115. for (const e of t3)
  116. this._idToVisibility.set(e, _);
  117. }
  118. setTrue(t3) {
  119. const e = [], i = [], s4 = new Set(t3);
  120. return this._idToVisibility.forEach((t4, r) => {
  121. const o = !!(this._idToVisibility.get(r) & _), h = s4.has(r);
  122. !o && h ? e.push(r) : o && !h && i.push(r), this._idToVisibility.set(r, h ? _ | p : 0);
  123. }), { show: e, hide: i };
  124. }
  125. createQuery() {
  126. const { geometry: t3, spatialRel: e, where: i, timeExtent: s4, objectIds: r } = this;
  127. return b.fromJSON({ geometry: t3, spatialRel: e, where: i, timeExtent: s4, objectIds: r });
  128. }
  129. async update(t3, e) {
  130. this._hash = JSON.stringify(t3);
  131. const i = await v(t3, null, e);
  132. await Promise.all([this._setGeometryFilter(i), this._setIdFilter(i), this._setAttributeFilter(i), this._setTimeFilter(i)]);
  133. }
  134. async _setAttributeFilter(t3) {
  135. if (!t3 || !t3.where)
  136. return this._clause = null, void (this.where = null);
  137. this._clause = await s3(t3.where, this._serviceInfo.fieldsIndex), this.where = t3.where;
  138. }
  139. _setIdFilter(t3) {
  140. this._idsToShow = t3 && t3.objectIds && new Set(t3.objectIds), this._idsToHide = t3 && t3.hiddenIds && new Set(t3.hiddenIds), this.objectIds = t3 && t3.objectIds;
  141. }
  142. async _setGeometryFilter(t3) {
  143. if (!t3 || !t3.geometry)
  144. return this._spatialQueryOperator = null, this.geometry = null, void (this.spatialRel = null);
  145. const e = t3.geometry, i = t3.spatialRel || "esriSpatialRelIntersects", s4 = await v2(i, e, this._serviceInfo.geometryType, this._serviceInfo.hasZ, this._serviceInfo.hasM);
  146. c(this._geometryBounds, e), this._spatialQueryOperator = s4, this.geometry = e, this.spatialRel = i;
  147. }
  148. _setTimeFilter(e) {
  149. if (this.timeExtent = this._timeOperator = null, e && e.timeExtent)
  150. if (this._serviceInfo.timeInfo)
  151. this.timeExtent = e.timeExtent, this._timeOperator = n(this._serviceInfo.timeInfo, e.timeExtent, u2);
  152. else {
  153. const i = new s2("feature-layer-view:time-filter-not-available", "Unable to apply time filter, as layer doesn't have time metadata.", e.timeExtent);
  154. m.error(i);
  155. }
  156. }
  157. _applyFilter(t3) {
  158. return this._filterByGeometry(t3) && this._filterById(t3) && this._filterByTime(t3) && this._filterByExpression(t3);
  159. }
  160. _filterByExpression(t3) {
  161. return !this.where || this._clause(t3);
  162. }
  163. _filterById(t3) {
  164. return (!this._idsToHide || !this._idsToHide.size || !this._idsToHide.has(t3.getObjectId())) && (!this._idsToShow || !this._idsToShow.size || this._idsToShow.has(t3.getObjectId()));
  165. }
  166. _filterByGeometry(t3) {
  167. if (!this.geometry)
  168. return true;
  169. const e = t3.readHydratedGeometry();
  170. return !!e && this._spatialQueryOperator(e);
  171. }
  172. _filterByTime(t3) {
  173. return !!t(this._timeOperator) || this._timeOperator(t3);
  174. }
  175. _resetAllHiddenIds() {
  176. const t3 = [];
  177. return this._idToVisibility.forEach((e, i) => {
  178. e & _ || (this._idToVisibility.set(i, _), t3.push(i));
  179. }), t3;
  180. }
  181. };
  182. export {
  183. y as default
  184. };
  185. //# sourceMappingURL=FeatureFilter-DN2CX36X.js.map