123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483 |
- import {
- A
- } from "./chunk-P2L4QEOI.js";
- import {
- s as s2
- } from "./chunk-D6FGJON6.js";
- import {
- i
- } from "./chunk-VAY3LZG7.js";
- import {
- a as a2,
- m
- } from "./chunk-LY74KTXV.js";
- import {
- O
- } from "./chunk-WNCU6BFU.js";
- import {
- i as i2
- } from "./chunk-LRDX4TO7.js";
- import {
- n
- } from "./chunk-DT6EAZQ5.js";
- import {
- s
- } from "./chunk-EMJ4ZSM2.js";
- import {
- a,
- e,
- r,
- t
- } from "./chunk-GZT4BVFP.js";
- // node_modules/@arcgis/core/views/2d/arcade/callExpressionWithCursor.js
- function r2(r4, a3, t2) {
- r4.referencesGeometry();
- const n2 = a3.readArcadeFeature();
- try {
- return r4.evaluate({ ...t2, $feature: n2 });
- } catch (o2) {
- return s.getLogger("esri.views.2d.support.arcadeOnDemand").warn("Feature arcade evaluation failed:", o2), null;
- }
- }
- // node_modules/@arcgis/core/views/2d/layers/features/Store2D.js
- var o = import("./labelFormatUtils-UVCDII77.js");
- var c = class {
- constructor(e2, s3) {
- this._canCacheExpressionValue = false, this._sourceInfo = e2, this._storage = s3, this._bitsets = { computed: s3.getBitset(s3.createBitset()) };
- }
- get storage() {
- return this._storage;
- }
- invalidate() {
- this._bitsets.computed.clear();
- }
- async updateSchema(r4, a3) {
- const o2 = m(this._schema, a3);
- if (this._schema = a3, !a3 || t(o2) || !a2(o2, "attributes"))
- return;
- a("esri-2d-update-debug") && console.debug("Applying Update - Store:", o2), this._bitsets.computed.clear(), r4.targets[a3.name] = true;
- const c3 = a3.attributes, n2 = [], d = [];
- for (const e2 in c3) {
- const s3 = c3[e2];
- switch (s3.type) {
- case "field":
- break;
- case "expression":
- n2.push(this._createArcadeComputedField(s3));
- break;
- case "label-expression":
- n2.push(this._createLabelArcadeComputedField(s3));
- break;
- case "statistic":
- d.push(s3);
- }
- }
- this._computedFields = await Promise.all(n2), this._canCacheExpressionValue = !this._computedFields.some((e2) => e2.type === "expression" && e2.expression.referencesScale()), this._statisticFields = d;
- }
- setComputedAttributes(e2, s3, t2, i3) {
- const r4 = this._bitsets.computed;
- if (!this._canCacheExpressionValue || !r4.has(t2)) {
- r4.set(t2);
- for (const r5 of this._computedFields) {
- const a3 = this._evaluateField(s3, r5, i3);
- switch (r5.resultType) {
- case "numeric":
- e2.setComputedNumericAtIndex(t2, r5.fieldIndex, a3);
- break;
- case "string":
- e2.setComputedStringAtIndex(t2, r5.fieldIndex, a3);
- }
- }
- }
- }
- async _createArcadeComputedField(e2) {
- const s3 = this._sourceInfo.spatialReference, t2 = this._sourceInfo.fieldsIndex;
- return { ...e2, expression: await i2(e2.valueExpression, s3, t2) };
- }
- async _createLabelArcadeComputedField(e2) {
- const s3 = this._sourceInfo.spatialReference, t2 = this._sourceInfo.fieldsIndex, { createLabelFunction: i3 } = await o, r4 = await i3(e2.label, t2, s3);
- return { ...e2, builder: r4 };
- }
- _evaluateField(e2, s3, t2) {
- switch (s3.type) {
- case "label-expression": {
- const t3 = e2.readArcadeFeature();
- return s3.builder.evaluate(t3) || "";
- }
- case "expression": {
- const { expression: i3 } = s3;
- return r2(i3, e2, { $view: { scale: t2 } });
- }
- }
- }
- };
- // node_modules/@arcgis/core/views/2d/layers/features/support/FeatureSetReaderPBFIndirect.js
- var r3 = class extends A {
- constructor(r4, t2) {
- super(A.createInstance(), r4.fullSchema()), this._currentIndex = -1, this._reader = r4, this._indices = t2;
- }
- static from(e2, t2) {
- return new r3(e2.copy(), t2);
- }
- get hasNext() {
- return this._currentIndex + 1 < this._indices.length;
- }
- getSize() {
- return this._indices.length;
- }
- getCursor() {
- return this.copy();
- }
- copy() {
- const e2 = new r3(this._reader.copy(), this._indices);
- return e2._currentIndex = this._currentIndex, e2;
- }
- next() {
- for (; this._nextIndex() && !this._reader._getExists(); )
- ;
- return this._currentIndex < this._indices.length;
- }
- _nextIndex() {
- return ++this._currentIndex < this._indices.length && (this._reader.setIndex(this._indices[this._currentIndex]), true);
- }
- setArcadeSpatialReference(e2) {
- this._reader.setArcadeSpatialReference(e2);
- }
- attachStorage(e2) {
- this._reader.attachStorage(e2);
- }
- get geometryType() {
- return this._reader.geometryType;
- }
- get hasFeatures() {
- return this._reader.hasFeatures;
- }
- get exceededTransferLimit() {
- return this._reader.exceededTransferLimit;
- }
- get hasZ() {
- return this._reader.hasZ;
- }
- get hasM() {
- return this._reader.hasM;
- }
- getStorage() {
- return this._reader.getStorage();
- }
- getComputedNumeric(e2) {
- return this._reader.getComputedNumericAtIndex(0);
- }
- setComputedNumeric(e2, r4) {
- return this._reader.setComputedNumericAtIndex(r4, 0);
- }
- getComputedString(e2) {
- return this._reader.getComputedStringAtIndex(0);
- }
- setComputedString(e2, r4) {
- return this._reader.setComputedStringAtIndex(0, r4);
- }
- getComputedNumericAtIndex(e2) {
- return this._reader.getComputedNumericAtIndex(e2);
- }
- setComputedNumericAtIndex(e2, r4) {
- this._reader.setComputedNumericAtIndex(e2, r4);
- }
- getComputedStringAtIndex(e2) {
- return this._reader.getComputedStringAtIndex(e2);
- }
- setComputedStringAtIndex(e2, r4) {
- return this._reader.setComputedStringAtIndex(e2, r4);
- }
- transform(e2, r4, t2, d) {
- const a3 = this.copy();
- return a3._reader = this._reader.transform(e2, r4, t2, d), a3;
- }
- readAttribute(e2, r4 = false) {
- return this._reader.readAttribute(e2, r4);
- }
- readAttributes() {
- return this._reader.readAttributes();
- }
- joinAttributes(e2) {
- return this._reader.joinAttributes(e2);
- }
- readArcadeFeature() {
- return this._reader.readArcadeFeature();
- }
- geometry() {
- return this._reader.geometry();
- }
- field(e2) {
- return this.readAttribute(e2, true);
- }
- hasField(e2) {
- return this._reader.hasField(e2);
- }
- setField(e2, r4) {
- return this._reader.setField(e2, r4);
- }
- keys() {
- return this._reader.keys();
- }
- castToText() {
- return this._reader.castToText();
- }
- getQuantizationTransform() {
- return this._reader.getQuantizationTransform();
- }
- getFieldNames() {
- return this._reader.getFieldNames();
- }
- getAttributeHash() {
- return this._reader.getAttributeHash();
- }
- getObjectId() {
- return this._reader.getObjectId();
- }
- getDisplayId() {
- return this._reader.getDisplayId();
- }
- setDisplayId(e2) {
- return this._reader.setDisplayId(e2);
- }
- getGroupId() {
- return this._reader.getGroupId();
- }
- setGroupId(e2) {
- return this._reader.setGroupId(e2);
- }
- getXHydrated() {
- return this._reader.getXHydrated();
- }
- getYHydrated() {
- return this._reader.getYHydrated();
- }
- getX() {
- return this._reader.getX();
- }
- getY() {
- return this._reader.getY();
- }
- setIndex(e2) {
- return this._reader.setIndex(e2);
- }
- getIndex() {
- return this._reader.getIndex();
- }
- readLegacyFeature() {
- return this._reader.readLegacyFeature();
- }
- readOptimizedFeature() {
- return this._reader.readOptimizedFeature();
- }
- readLegacyPointGeometry() {
- return this._reader.readLegacyPointGeometry();
- }
- readLegacyGeometry() {
- return this._reader.readLegacyGeometry();
- }
- readLegacyCentroid() {
- return this._reader.readLegacyCentroid();
- }
- readGeometryArea() {
- return this._reader.readGeometryArea();
- }
- readUnquantizedGeometry() {
- return this._reader.readUnquantizedGeometry();
- }
- readHydratedGeometry() {
- return this._reader.readHydratedGeometry();
- }
- readGeometry() {
- return this._reader.readGeometry();
- }
- readCentroid() {
- return this._reader.readCentroid();
- }
- _readAttribute(e2, r4) {
- throw new Error("Error: Should not be called. Underlying _reader should be used instead");
- }
- _readAttributes() {
- throw new Error("Error: Should not be called. Underlying _reader should be used instead");
- }
- };
- // node_modules/@arcgis/core/views/2d/layers/features/FeatureStore2D.js
- function h(t2, e2) {
- return t2 << 16 | e2;
- }
- function c2(t2) {
- return (4294901760 & t2) >>> 16;
- }
- function I(t2) {
- return 65535 & t2;
- }
- var u = { getObjectId: (t2) => t2.getObjectId(), getAttributes: (t2) => t2.readAttributes(), getAttribute: (t2, e2) => t2.readAttribute(e2), cloneWithGeometry: (t2, e2) => t2, getGeometry: (t2) => t2.readHydratedGeometry(), getCentroid: (t2, e2) => t2.readCentroid() };
- var l = class extends c {
- constructor(s3, a3, r4) {
- super(s3, a3), this.featureAdapter = u, this.events = new n(), this._featureSetsByInstance = new Map(), this._objectIdToDisplayId = new Map(), this._spatialIndexInvalid = true, this._indexSearchCache = new s2(50), this._index = i(9, (t2) => ({ minX: this._storage.getXMin(t2), minY: this._storage.getYMin(t2), maxX: this._storage.getXMax(t2), maxY: this._storage.getYMax(t2) })), this.mode = r4;
- }
- get storeStatistics() {
- let t2 = 0, e2 = 0, s3 = 0;
- return this.forEach((a3) => {
- const r4 = a3.readGeometry();
- r4 && (e2 += r4.isPoint ? 1 : r4.lengths.reduce((t3, e3) => t3 + e3, 0), s3 += r4.isPoint ? 1 : r4.lengths.length, t2 += 1);
- }), { featureCount: t2, vertexCount: e2, ringCount: s3 };
- }
- hasInstance(t2) {
- return this._featureSetsByInstance.has(t2);
- }
- onTileData(t2, e2) {
- if (t(e2.addOrUpdate))
- return e2;
- if (e2.addOrUpdate.attachStorage(this._storage), this.mode === "snapshot") {
- const s3 = e2.addOrUpdate.getCursor();
- for (; s3.next(); ) {
- const e3 = s3.getDisplayId();
- this.setComputedAttributes(this._storage, s3, e3, t2.scale);
- }
- return e2;
- }
- this._featureSetsByInstance.set(e2.addOrUpdate.instance, e2.addOrUpdate);
- const a3 = e2.addOrUpdate.getCursor();
- for (; a3.next(); )
- this._insertFeature(a3, t2.scale);
- return this._spatialIndexInvalid = true, this.events.emit("changed"), e2;
- }
- search(t2) {
- this._rebuildIndex();
- const e2 = t2.id, s3 = this._indexSearchCache.find((t3) => t3.tileId === e2);
- if (r(s3))
- return s3.readers;
- const r4 = new Map(), n2 = this._searchIndex(t2.bounds), i3 = [];
- for (const a3 of n2) {
- const t3 = this._storage.getInstanceId(a3), e3 = c2(t3), s4 = I(t3);
- r4.has(e3) || r4.set(e3, []);
- r4.get(e3).push(s4);
- }
- return r4.forEach((t3, e3) => {
- const s4 = this._featureSetsByInstance.get(e3);
- i3.push(r3.from(s4, t3));
- }), this._indexSearchCache.enqueue({ tileId: e2, readers: i3 }), i3;
- }
- insert(t2) {
- const e2 = t2.getCursor(), s3 = this._storage;
- for (; e2.next(); ) {
- const t3 = h(e2.instance, e2.getIndex()), a3 = e2.getObjectId(), r4 = this._objectIdToDisplayId.get(a3) ?? this._storage.createDisplayId();
- e2.setDisplayId(r4), s3.setInstanceId(r4, t3), this._objectIdToDisplayId.set(a3, r4);
- }
- this._featureSetsByInstance.set(t2.instance, t2), this._spatialIndexInvalid = true;
- }
- remove(t2) {
- const e2 = this._objectIdToDisplayId.get(t2);
- if (!e2)
- return;
- const s3 = this._storage.getInstanceId(e2), a3 = I(s3), r4 = c2(s3), n2 = this._featureSetsByInstance.get(r4);
- this._objectIdToDisplayId.delete(t2), this._storage.releaseDisplayId(e2), n2.removeAtIndex(a3), n2.isEmpty && this._featureSetsByInstance.delete(r4), this._spatialIndexInvalid = true;
- }
- toArray() {
- const t2 = new Array();
- return this.forEach((e2) => t2.push(e2)), t2;
- }
- forEach(t2) {
- this._objectIdToDisplayId.forEach((e2) => {
- const s3 = this._storage.getInstanceId(e2), a3 = this._lookupFeature(s3);
- t2(a3);
- });
- }
- forEachUnsafe(t2) {
- this._objectIdToDisplayId.forEach((e2) => {
- const s3 = this._storage.getInstanceId(e2), a3 = c2(s3), r4 = I(s3), n2 = this._getFeatureSet(a3);
- n2.setIndex(r4), t2(n2);
- });
- }
- forEachInBounds(t2, e2) {
- const s3 = this._searchIndex(t2);
- for (const a3 of s3) {
- const t3 = this.lookupFeatureByDisplayId(a3, this._storage);
- e2(e(t3));
- }
- }
- forEachBounds(t2, e2, s3) {
- this._rebuildIndex();
- const a3 = [0, 0, 0, 0];
- for (const r4 of t2) {
- if (!r4.readGeometry())
- continue;
- const t3 = r4.getDisplayId();
- a3[0] = this._storage.getXMin(t3), a3[1] = this._storage.getYMin(t3), a3[2] = this._storage.getXMax(t3), a3[3] = this._storage.getYMax(t3), e2(O(s3, a3));
- }
- }
- sweepFeatures(t2, e2, s3) {
- this._spatialIndexInvalid = true, this._objectIdToDisplayId.forEach((a3, r4) => {
- t2.has(a3) || (e2.releaseDisplayId(a3), s3 && s3.unsetAttributeData(a3), this._objectIdToDisplayId.delete(r4));
- }), this.events.emit("changed");
- }
- sweepFeatureSets(t2) {
- this._spatialIndexInvalid = true, this._featureSetsByInstance.forEach((e2, s3) => {
- t2.has(s3) || this._featureSetsByInstance.delete(s3);
- });
- }
- lookupObjectId(t2, e2) {
- const a3 = this.lookupFeatureByDisplayId(t2, e2);
- return t(a3) ? null : a3.getObjectId();
- }
- lookupDisplayId(t2) {
- return this._objectIdToDisplayId.get(t2);
- }
- lookupFeatureByDisplayId(t2, e2) {
- const s3 = e2.getInstanceId(t2);
- return this._lookupFeature(s3);
- }
- lookupByDisplayIdUnsafe(t2) {
- const e2 = this._storage.getInstanceId(t2), s3 = c2(e2), a3 = I(e2), r4 = this._getFeatureSet(s3);
- return r4 ? (r4.setIndex(a3), r4) : null;
- }
- _insertFeature(t2, e2) {
- const s3 = this._storage, a3 = t2.getObjectId(), r4 = h(t2.instance, t2.getIndex());
- s3.getInstanceId(t2.getDisplayId());
- let n2 = this._objectIdToDisplayId.get(a3);
- n2 || (n2 = s3.createDisplayId(), this._objectIdToDisplayId.set(a3, n2), this._spatialIndexInvalid = true), t2.setDisplayId(n2), s3.setInstanceId(n2, r4), this.setComputedAttributes(s3, t2, n2, e2);
- }
- _searchIndex(t2) {
- this._rebuildIndex();
- const e2 = { minX: t2[0], minY: t2[1], maxX: t2[2], maxY: t2[3] };
- return this._index.search(e2);
- }
- _rebuildIndex() {
- if (!this._spatialIndexInvalid)
- return;
- const t2 = [];
- this.mode === "snapshot" ? this._featureSetsByInstance.forEach((e2) => {
- const s3 = e2.getCursor();
- for (; s3.next(); ) {
- const e3 = s3.getDisplayId();
- this._storage.setBounds(e3, s3) && t2.push(e3);
- }
- }) : this._objectIdToDisplayId.forEach((e2) => {
- const s3 = this._storage.getInstanceId(e2);
- this._storage.setBounds(e2, this._lookupFeature(s3)) && t2.push(e2);
- }), this._index.clear(), this._index.load(t2), this._indexSearchCache.clear(), this._spatialIndexInvalid = false;
- }
- _lookupFeature(t2) {
- const e2 = c2(t2), s3 = this._getFeatureSet(e2);
- if (!s3)
- return null;
- const a3 = s3.getCursor(), r4 = I(t2);
- return a3.setIndex(r4), a3;
- }
- _getFeatureSet(t2) {
- return this._featureSetsByInstance.get(t2);
- }
- };
- export {
- c,
- r3 as r,
- u,
- l
- };
- //# sourceMappingURL=chunk-U2FIWR5R.js.map
|