123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- import {
- e
- } from "./chunk-DMVKVC5I.js";
- import {
- h
- } from "./chunk-D5UVUJIX.js";
- import {
- gt
- } from "./chunk-JKFWEHNK.js";
- import {
- s as s3,
- t as t2
- } from "./chunk-3IRT3YKJ.js";
- import {
- G
- } from "./chunk-ECY35CJI.js";
- import {
- D,
- u
- } from "./chunk-2H5MD622.js";
- import {
- n
- } from "./chunk-IM3LVQXV.js";
- import {
- s2 as s,
- s3 as s2
- } from "./chunk-E5O6P5I2.js";
- import {
- has
- } from "./chunk-SPWQ3AWG.js";
- import {
- r,
- t
- } from "./chunk-YXWMMD76.js";
- // node_modules/@arcgis/core/layers/graphics/data/BoundsStore.js
- var d = 5e4;
- var n2 = { minX: 0, minY: 0, maxX: 0, maxY: 0 };
- function t3(i2) {
- n2.minX = i2[0], n2.minY = i2[1], n2.maxX = i2[2], n2.maxY = i2[3];
- }
- function e2(i2, s4, d2) {
- t3(s4), i2.search(n2, d2);
- }
- var o = class {
- constructor() {
- 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 = () => {
- if (this._indexInvalid) {
- const i2 = new Array(this._idByBounds.size);
- let s4 = 0;
- this._idByBounds.forEach((d2, n3) => {
- i2[s4++] = n3;
- }), this._indexInvalid = false, this._index.clear(), this._index.load(i2);
- } else
- this._boundsToLoad.length && (this._index.load(this._boundsToLoad.filter((i2) => this._idByBounds.has(i2))), this._boundsToLoad.length = 0);
- };
- }
- get fullBounds() {
- if (!this._boundsById.size)
- return null;
- const i2 = D();
- for (const s4 of this._boundsById.values())
- 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]));
- return i2;
- }
- get valid() {
- return !this._indexInvalid;
- }
- clear() {
- this._indexInvalid = false, this._boundsToLoad.length = 0, this._boundsById.clear(), this._idByBounds.clear(), this._index.clear();
- }
- delete(i2) {
- const s4 = this._boundsById.get(i2);
- this._boundsById.delete(i2), s4 && (this._idByBounds.delete(s4), this._indexInvalid || this._index.remove(s4));
- }
- forEachInBounds(i2, s4) {
- this._loadIndex(), e2(this._index, i2, (i3) => s4(this._idByBounds.get(i3)));
- }
- get(i2) {
- return this._boundsById.get(i2);
- }
- has(i2) {
- return this._boundsById.has(i2);
- }
- invalidateIndex() {
- this._indexInvalid || (this._indexInvalid = true, this._boundsToLoad.length = 0);
- }
- set(i2, s4) {
- if (!this._indexInvalid) {
- const s5 = this._boundsById.get(i2);
- s5 && (this._index.remove(s5), this._idByBounds.delete(s5));
- }
- this._boundsById.set(i2, s4), s4 && (this._idByBounds.set(s4, i2), this._indexInvalid || (this._boundsToLoad.push(s4), this._boundsToLoad.length > d && this._loadIndex()));
- }
- };
- // node_modules/@arcgis/core/layers/graphics/data/optimizedFeatureQueryEngineAdapter.js
- 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) };
- // node_modules/@arcgis/core/layers/graphics/data/FeatureStore.js
- var u2 = class {
- constructor(e3) {
- this.geometryInfo = e3, this._boundsStore = new o(), this._featuresById = /* @__PURE__ */ new Map(), this._markedIds = /* @__PURE__ */ new Set(), this.events = new n(), this.featureAdapter = i;
- }
- get geometryType() {
- return this.geometryInfo.geometryType;
- }
- get hasM() {
- return this.geometryInfo.hasM;
- }
- get hasZ() {
- return this.geometryInfo.hasZ;
- }
- get numFeatures() {
- return this._featuresById.size;
- }
- get fullBounds() {
- return this._boundsStore.fullBounds;
- }
- get storeStatistics() {
- let e3 = 0;
- return this._featuresById.forEach((t4) => {
- r(t4.geometry) && t4.geometry.coords && (e3 += t4.geometry.coords.length);
- }), { featureCount: this._featuresById.size, vertexCount: e3 / (this.hasZ ? this.hasM ? 4 : 3 : this.hasM ? 3 : 2) };
- }
- add(e3) {
- this._add(e3), this._emitChanged();
- }
- addMany(e3) {
- for (const t4 of e3)
- this._add(t4);
- this._emitChanged();
- }
- clear() {
- this._featuresById.clear(), this._boundsStore.clear(), this._emitChanged();
- }
- removeById(e3) {
- const t4 = this._featuresById.get(e3);
- return t4 ? (this._remove(t4), this._emitChanged(), t4) : null;
- }
- removeManyById(e3) {
- this._boundsStore.invalidateIndex();
- for (const t4 of e3) {
- const e4 = this._featuresById.get(t4);
- e4 && this._remove(e4);
- }
- this._emitChanged();
- }
- forEachBounds(e3, t4, r2) {
- for (const s4 of e3) {
- const e4 = this._boundsStore.get(s4.objectId);
- e4 && t4(G(r2, e4));
- }
- }
- getFeature(e3) {
- return this._featuresById.get(e3);
- }
- has(e3) {
- return this._featuresById.has(e3);
- }
- toArray() {
- return Array.from(this._featuresById.values());
- }
- forEach(e3) {
- this._featuresById.forEach((t4) => e3(t4));
- }
- forEachInBounds(e3, t4) {
- this._boundsStore.forEachInBounds(e3, (e4) => {
- t4(this._featuresById.get(e4));
- });
- }
- startMarkingUsedFeatures() {
- this._boundsStore.invalidateIndex(), this._markedIds.clear();
- }
- sweep() {
- let e3 = false;
- this._featuresById.forEach((t4, r2) => {
- this._markedIds.has(r2) || (e3 = true, this._remove(t4));
- }), this._markedIds.clear(), e3 && this._emitChanged();
- }
- _emitChanged() {
- this.events.emit("changed", void 0);
- }
- _add(t4) {
- if (!t4)
- return;
- const i2 = t4.objectId;
- if (null == i2)
- return void s.getLogger("esri.layers.graphics.data.FeatureStore").error(new s2("featurestore:invalid-feature", "feature id is missing", { feature: t4 }));
- const n3 = this._featuresById.get(i2);
- let h2;
- 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)
- return this._boundsStore.set(i2, null), void this._featuresById.set(i2, t4);
- 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);
- }
- _remove(e3) {
- return r(this.onFeatureRemove) && this.onFeatureRemove(e3), this._markedIds.delete(e3.objectId), this._boundsStore.delete(e3.objectId), this._featuresById.delete(e3.objectId), e3;
- }
- };
- export {
- o,
- u2 as u
- };
- //# sourceMappingURL=chunk-RDOYANC4.js.map
|