UNPKG

@doegis/core

Version:

DOE GIS API

3 lines (1 loc) 22.7 kB
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import s from"../../../../core/Handles.js";import i from"../../../../core/Logger.js";import{someMap as r}from"../../../../core/MapUtils.js";import{isSome as a,destroyMaybe as n,isNone as o,unwrap as u}from"../../../../core/maybe.js";import{isAbortError as l,eachAlways as h,throwIfAborted as c}from"../../../../core/promiseUtils.js";import{on as d}from"../../../../core/reactiveUtils.js";import{schedule as p}from"../../../../core/scheduling.js";import{property as f}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as m}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as _,equals as g,clone as F,expand as y,toExtent as T}from"../../../../geometry/support/aaBoundingRect.js";import{getObjectId as x,hasVertices as E}from"../../../../layers/graphics/dehydratedFeatures.js";import C from"../../../../rest/support/QuantizationParameters.js";import R from"../../../../rest/support/Query.js";import{ViewingMode as b}from"../../../ViewingMode.js";import{MultiFeatureReference as v,SingleFeatureReference as M}from"./featureReference.js";import{FAILED_FEATURE_COUNT as w,FetchStatus as D,FeatureTile as O}from"./FeatureTile.js";import{tilesAreRelated as j}from"../../terrain/tileUtils.js";import{ImmediateTask as P,TaskPriority as N}from"../../../support/Scheduler.js";const U="esri.views.3d.layers.support.FeatureTileFetcher3D",I=i.getLogger(U);let A=class extends t{set maximumNumberOfFeatures(e){e=e||1/0;const t=this._get("maximumNumberOfFeatures");e===t||e<1||(this._set("maximumNumberOfFeatures",e),this._maximumFeaturesUpdated(t,e))}set memoryFactor(e){this.memoryFactor!==e&&(this._set("memoryFactor",e),this._setDirty())}set lodFactor(e){this.lodFactor!==e&&(this._set("lodFactor",e),this._supportsResolution&&this.refetch())}get useTileCount(){return this._useTileCount&&a(this.context.query.queryFeatureCount)}set useTileCount(e){this._useTileCount=e,this.notifyChange("useTileCount")}get memoryForUnusedFeatures(){let e=0;return this._featureTiles.forEach((t=>e+=t.estimatedUnusedSize)),e}get totalVertices(){let e=0;return this._featureTiles.forEach((t=>e+=t.numVertices)),e}get totalFeatures(){let e=0;return this._featureTiles.forEach((t=>e+=t.numFeatures)),e}set filterExtent(e){if(a(e)&&this.context.tilingScheme&&!e.spatialReference.equals(this.context.tilingScheme.spatialReference))return void I.error("#filterExtent=","extent needs to be in the same spatial reference as the tiling scheme");const t=this._get("filterExtent");if(t===e||a(t)&&e&&t.equals(e))return;const s=a(e)?e.clone():null;this._set("filterExtent",s),this._reclip(s,t)}constructor(e){super(e),this._useTileCount=!1,this.updating=!1,this.running=!1,this.updatingTotal=0,this.updatingRemaining=0,this.expectedFeatureDiff=0,this.maximumNumberOfFeaturesExceeded=!1,this.maximumNumberOfFeaturesExceededThrottle=1e3,this._fullRatio=1,this._farRatio=1,this._changes={updates:{adds:new Array,removes:new Array},adds:new Array,removes:new Array},this._handles=new s,this._frameTask=P,this._dirty=!1,this._featureTiles=new Map,this._displayingFeatureReferences=new Map,this._numDisplayingFeatureReferences=0,this._suspended=!0,this._pendingEdits=null}initialize(){this._handles.add(d((()=>this.tileDescriptors),"change",(()=>this._setDirty()),{onListenerAdd:()=>this._setDirty()})),this._objectIdField=this.context.objectIdField,this.FeatureReferenceClass=this.context.capabilities.supportsMultipleResolutions?v:M;const e=this.context.scheduler;a(e)&&(this._frameTask=e.registerTask(N.FEATURE_TILE_FETCHER,this)),this._setDirty()}destroy(){this._frameTask.remove(),this._handles=n(this._handles),this._featureTiles.forEach((e=>{this._cancelFetchTile(e),this._removeTile(e)})),this._featureTiles.clear(),this._displayingFeatureReferences.clear(),this._pendingEdits?.controller.abort(),this._pendingEdits=null}get _paused(){return this._suspended||!!this._pendingEdits}restart(){this._featureTiles.forEach((e=>{this._cancelFetchTile(e),this._clearTile(e),this._resetFetchTile(e)})),a(this.context.memoryCache)&&this.context.memoryCache.clear(),this._setDirty()}refetch(){this._featureTiles.forEach((e=>{this._cancelFetchTile(e),this._resetFetchTile(e)})),a(this.context.memoryCache)&&this.context.memoryCache.clear(),this._setDirty()}suspend(){this._suspended||(this._suspended=!0,this._pause(),this._setDirty())}resume(){this._suspended&&(this._suspended=!1,this._unpause())}_pause(){this._paused&&(this._featureTiles.forEach((e=>this._cancelFetchTile(e))),this._updated())}_unpause(){this._paused||(this._setDirty(),this._updated())}get availableFields(){let e=null;return this._featureTiles.forEach((t=>{o(t.displayingFeatures)||0===t.displayingFeatures.length||(o(e)?e=new Set(t.availableFields):e.forEach((s=>{t.availableFields.has(s)||u(e).delete(s)})))})),a(e)?e:new Set}applyEdits(e){this._pendingEdits||(this._pendingEdits={edits:Promise.resolve(),count:0,controller:new AbortController},this._pause());const t=this._pendingEdits;t.count++;const s=t.edits.then((()=>e.result.catch((e=>{if(l(e))throw e;return null})).then((e=>e?(this._applyEditsDeleteFeatures(e.deletedFeatures),this._applyEditsAddUpdateFeatures(e.addedFeatures,e.updatedFeatures,t.controller.signal).then((()=>e))):e)).then((e=>(0==--t.count&&(this._pendingEdits===t&&(this._pendingEdits=null),a(this.context.memoryCache)&&this.context.memoryCache.clear(),this._unpause(),this._updated()),e)))));return t.edits=s,this._updated(),s}_applyEditsDeleteFeatures(e){if(0===e.length)return;const t=this.context.globalIdField,s=t&&this.availableFields.has(t),i=new Set,r=this._objectIdField;e.forEach((({objectId:e,globalId:a})=>{if((!e||e<0)&&t){s||I.errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected in the view`);const e=this.features.find((e=>e.attributes&&e.attributes[t]===a));e&&i.add(x(e,r))}else i.add(e)})),this._featureTiles.forEach((e=>{if(!e.features)return;const t=e.features.filter((e=>!i.has(x(e,this._objectIdField))));t.length!==e.features.length&&(e.setFeatures(t,0,e.availableFields),this._invalidateCounts())}))}async _applyEditsAddUpdateFeatures(e,t,s){const i=[],r=new Set;if(e.forEach((e=>i.push(e.objectId))),t.forEach((e=>{i.push(e.objectId),r.add(e.objectId)})),0===i.length)return;const a=[];this._featureTiles.forEach((e=>{const t=this._applyEditsAddUpdateTile(e,i,r,s);t&&a.push(t)})),await h(a)}async _applyEditsAddUpdateTile(e,t,s,i){if(!e.features)return;const r=this._createQuery(e);r.resultType=void 0,r.cacheHint=!1,r.objectIds=t;const a=await this._queryFeatures(r,i);let n=null;if(s.size>0){const t=e.features.filter((e=>!s.has(x(e,this._objectIdField))));t.length!==e.features.length&&(n=t)}if(a.features.length>0){n||(n=e.features.slice());for(const e of a.features)n.push(e)}n&&(e.hasPreciseFeatureCount&&(e.numFeatures=Math.max(e.numFeatures,n.length)),e.setFeatures(n,0,k(e.availableFields,a.fields)),this._invalidateCounts())}_queryFeatures(e,t){return this.context.query.queryFeaturesDehydrated(e,{signal:t,timeout:X})}_setDirty(){this._dirty=!0,this._updated()}runTask(e){if(this._frameTask.processQueue(e),!this._dirty||!this.initialized)return;this._dirty=!1;const t=this._getListOfTiles();if(this._markTilesNotAlive(t),!e.run((()=>this._addTiles(t,e)))||!e.run((()=>this._filterExtentTiles(t,e)))||!e.run((()=>this._removeTiles(t,e)))||e.done)return void this._setDirty();const s=this._sortTiles(t);e.run((()=>this._showTiles(s,e)))&&e.run((()=>this._fetchTiles(s,e)))&&e.run((()=>this._updateMemoryEstimates(s,e)))||this._setDirty(),this._updated(),this.updating||this._updateMaximumNumberOfFeaturesExceeded()}_markTilesNotAlive(e){for(const t of e)t.alive=!1}_addTiles(e,t){return!this._suspended&&(this.tileDescriptors.forEach((s=>{const i=this._featureTiles.get(s.id);i?i.alive=!0:t.done||(e.push(this._addTile(s)),t.madeProgress())})),t.hasProgressed)}_filterExtentTiles(e,t){for(const s of e){if(t.done)break;s.alive&&(s.filtered=!s.intersects(this.filterExtent),s.filtered&&(this._clearTile(s),t.madeProgress()))}return t.hasProgressed}_removeTiles(e,t){for(let s=e.length-1;s>=0&&!t.done;s--){const i=e[s];i.alive||(this._removeTile(i),s!==e.length-1&&(e[s]=e[e.length-1]),e.pop(),t.madeProgress())}return t.hasProgressed}_sortTiles(e){return e.sort(((e,t)=>(e.descriptor.loadPriority??0)-(t.descriptor.loadPriority??0))),e}_showTiles(e,t){const s=this._updateRatio(e),i=e=>{const t=this._fullRatio<1?s(e)*this._farRatio:1;return e.reduceFeatures(t,this.memoryFactor,this._objectIdField)&&this._setDirty(),this._showTile(e)};for(const r of e)if(!t.run((()=>i(r)))){this._setDirty();break}return t.hasProgressed}_fetchTiles(e,t){if(this._paused)return!1;let s=!1;for(const i of e){if(!i.needsFetching)continue;const e=a(this.context.memoryCache)?this.context.memoryCache.pop(i.id):null;if(a(e))i.cache=e,this._setDirty(),this._scheduleUpdated(),t.madeProgress();else{if(this._needsNumFeatures(i)){const e=new AbortController,r=this._fetchTileCount(i,e.signal);this._handleRequest(i,r,e,(()=>i.numFeatures=w)),s=!0,t.madeProgress()}if(t.done)return!0}}if(s)return t.hasProgressed;for(const i of e)if(i.needsFetching){const e=new AbortController,s=this._fetchTile(i,e.signal);if(this._handleRequest(i,s,e,(e=>{i.setFeatures([],0,null),this._invalidateCounts(),i.featuresMissing=!1,this.context.logFetchError(I,e)})),t.madeProgress())return!0}return t.hasProgressed}_updateMemoryEstimates(e,t){return e.some((e=>!t.run((()=>e.updateMemoryEstimates()))&&(this._setDirty(),!0))),t.hasProgressed}_reclip(e,t){if(!this.initialized)return;const s=new Array;this._featureTiles.forEach((i=>{o(i.displayingFeatures)||0===i.displayingFeatures.length||(i.intersectionIncludingBorrowed(t,B),i.intersectionIncludingBorrowed(e,G),g(B,G)||s.push(i))})),this._refreshDisplayingFeatures(s),this._updated()}_refreshDisplayingFeatures(e){const t=new Set,s=this._changes.updates;for(const i of e)if(!o(i.displayingFeatures))for(const e of i.displayingFeatures){const i=x(e,this._objectIdField);if(t.has(i))continue;t.add(i);const r=this._displayingFeatureReferences.get(i).feature;s.removes.push(r),s.adds.push(r)}this._applyChanges()}_updated(){let e=0;this._paused||this._featureTiles.forEach((t=>t.isFetching?++e:0));const t=this._dirty||!!this._pendingEdits||e>0;if(this._set("running",this._dirty),this._set("updating",t),t){let t=0,s=0,i=0,r=0,n=0;const o=this._displayingFeatureReferences.size/this._numDisplayingFeatureReferences;this._featureTiles.forEach((e=>{if(++s,e.isFetching&&e.hasPreciseFeatureCount){const t=this._maximumFeaturesForTile(e)*(1-e.emptyFeatureRatio),s=a(e.displayingFeatures)?e.displayingFeatures.length*o:0;n+=t-s}e.needsFetching?++r:e.numFeatures>0&&(++i,t+=e.numFeatures)})),r+=e;let u=0,l=0;t?(l=t,u=Math.min(r*t/i,t)):(l=s,u=r),n=Math.min(this.maximumNumberOfFeatures-this.features.length,n),this._set("updatingTotal",l),this._set("updatingRemaining",u),this._set("expectedFeatureDiff",n)}else this._set("updatingTotal",0),this._set("updatingRemaining",0),this._set("expectedFeatureDiff",0);this.debugger&&this.debugger.update()}_updateMaximumNumberOfFeaturesExceeded(){const e=r(this._featureTiles,(e=>e.perTileMaximumNumberOfFeaturesExceeded));this._set("maximumNumberOfFeaturesExceeded",e)}_updateRatio(e){const t=S(e),s=e=>1/(1<<Math.max(0,t-e.descriptor.lij[0]));let i=0,r=0;for(const a of e){const e=a.numFeatures;i+=e,r+=e*s(a)}return this._fullRatio=Math.min(1,this.maximumNumberOfFeatures/i),this._farRatio=this.maximumNumberOfFeatures/r,this._scheduleUpdated(),s}_maximumFeaturesUpdated(e,t){e!==t&&(t>e&&this._featureTiles.forEach((e=>{if(!e.featuresMissing)return;const t=this._maximumFeaturesForTile(e);e.features&&(e.features.length>=t||e.fetchStatus===D.FULL)||(this._cancelFetchTile(e),this._resetFetchTile(e))})),this._setDirty())}_addTile(e){const t=new O(e);return this._featureTiles.set(t.id,t),this._resetFetchTile(t),this._referenceDisplayingFeaturesFromRelatedTiles(t),t}_referenceDisplayingFeaturesFromRelatedTiles(e){const t=e.descriptor.resolution;this._featureTiles.forEach((s=>{if(!(o(s.displayingFeatures)||e===s||e.descriptor.lij&&s.descriptor.lij&&!j(e.descriptor.lij,s.descriptor.lij))){o(e.displayingFeatures)&&(e.displayingFeatures=[]),e.descriptor.extent&&s.descriptor.extent&&(o(e.extentIncludingBorrowedFeatures)&&(e.extentIncludingBorrowedFeatures=F(e.descriptor.extent)),y(e.extentIncludingBorrowedFeatures,s.descriptor.extent,e.extentIncludingBorrowedFeatures));for(const i of s.displayingFeatures){e.displayingFeatures.push(i);const s=this._displayingFeatureReferences.get(x(i,this._objectIdField));s.ref(s.feature,t),this._numDisplayingFeatureReferences++}}})),e.featureLimit=a(e.displayingFeatures)?e.displayingFeatures.length:0}_removeTile(e){this._clearTile(e),this._featureTiles.delete(e.id)}_resetFetchTile(e){e.filtered=!e.intersects(this.filterExtent),e.filtered?e.needsFetching&&(e.fetchStatus=D.DONE):e.fetchStatus=D.FETCH_NEEDED}_cancelFetchTile(e){const t=e.requestController;a(t)&&(e.requestController=null,e.resetFetching(),t.abort())}async _fetchTileCount(e,t){return e.numFeatures=await this._fetchCount(e,t),this._updateRatio(this._getListOfTiles()),e.fetchStatus===D.REFETCHING?D.REFETCH_NEEDED:D.FETCH_NEEDED}async _fetchTile(e,t){const s=this._maximumFeaturesForTile(e);if(s<=0)return V(e);const i=this._getMaxRecordCount(e),r=Math.ceil(s/i);if(q(e)||!this.context.capabilities.supportsMaxRecordCountFactor||e.numFeatures<=s&&r>R.MAX_MAX_RECORD_COUNT_FACTOR)return this._fetchPagedTile(e,t);const a=this._createQuery(e);if(a.maxRecordCountFactor=Math.ceil(s/i),e.isRefetching&&e.features&&e.features.length>0){const t=Math.ceil(e.features.length/(1-e.emptyFeatureRatio)/i);a.maxRecordCountFactor=Math.max(t+1,a.maxRecordCountFactor)}const{features:n,exceededTransferLimit:o,fields:u}=await this._queryFeatures(a,t),l=o?a.maxRecordCountFactor>=R.MAX_MAX_RECORD_COUNT_FACTOR?D.FULL:D.DONE:D.FULL;return await this._frameTask.schedule((()=>{e.featuresMissing=n.length<e.numFeatures||!!o;const t=this._removeEmptyFeatures(n);e.setFeatures(n,t,H(u))}),t),c(t),this._invalidateCounts(),l}async _fetchCount(e,t){return this.context.query.queryFeatureCount(this._createFeatureCountQuery(e),{signal:t})}async _fetchPagedTile(e,t){let s,i=0,r=0,a=0,n=this._maximumFeaturesForTile(e)-a;const o=this._getMaxRecordCount(e);let l=null;for(;;){const h=this._createQuery(e),d=this._setPagingParameters(h,i,n,o),{features:p,exceededTransferLimit:f,fields:m}=await this._queryFeatures(h,t);if(await this._frameTask.schedule((()=>{d&&(i+=u(h.num)),a+=p.length,r+=this._removeEmptyFeatures(p),e.featuresMissing=i<e.numFeatures||!!f,s=s?s.concat(p):p,l=k(l,m),e.setFeatures(s,r,l)}),t),c(t),this._invalidateCounts(),this._setDirty(),n=this._maximumFeaturesForTile(e)-a,!d||!f||n<=0)return f?D.DONE:D.FULL}}_createFeatureCountQuery(e){const t=this._createQuery(e);return this.context.capabilities.supportsCacheHint&&(t.resultType=void 0,t.cacheHint=!0),t}_createQuery(e){const t=this.context.createQuery(),s=e.descriptor.extent;if(s){const e=this.context.tilingScheme.spatialReference;t.geometry=T(s,e)}return this._setResolutionParams(t,e),this._useTileQuery(e)?t.resultType="tile":this.context.capabilities.supportsCacheHint&&(t.cacheHint=!0),t}_setPagingParameters(e,t,s,i){return!!this.context.capabilities.supportsPagination&&(e.start=t,s>0&&this.context.capabilities.supportsMaxRecordCountFactor?(e.maxRecordCountFactor=Math.ceil(s/i),e.num=Math.min(e.maxRecordCountFactor*i,s)):e.num=Math.min(i),!0)}_getEffectiveTileResolution(e){if(null==e.descriptor.resolution)return null;const t=this.context.viewingMode===b.Global?this.context.tilingScheme.resolutionAtLevel(3):1/0;return Math.min(e.descriptor.resolution,t)/this.lodFactor}get _supportsResolution(){return this.context.capabilities.supportsMultipleResolutions&&"point"!==this.context.geometryType}_setResolutionParams(e,t){if(!this._supportsResolution)return;const s=this._getEffectiveTileResolution(t);null!=s&&(this.context.capabilities.supportsQuantization?e.quantizationParameters=new C({mode:"view",originPosition:"upper-left",tolerance:s,extent:this.context.fullExtent}):"polyline"===this.context.geometryType&&(e.maxAllowableOffset=s))}_removeEmptyFeatures(e){const t=e.length;for(let s=0;s<e.length;){const t=e[s];E(t.geometry)?++s:(e[s]=e[e.length-1],--e.length)}return t-e.length}_needsNumFeatures(e){return this.useTileCount&&e.needsFeatureCount&&!q(e)}_getMaxRecordCount(e){const{tileMaxRecordCount:t,maxRecordCount:s}=this.context;return this._useTileQuery(e)&&a(t)&&t>0&&this.context.capabilities.supportsResultType?t:a(s)&&s>0?s:z}_useTileQuery(e){return(!q(e)||!this.context.capabilities.supportsCacheHint)&&this.context.capabilities.supportsResultType}_handleRequest(e,t,s,i){e.fetchStatus=e.needsRefetching?D.REFETCHING:D.FETCHING,e.requestController=s;let r=!1;t.then((t=>{e.requestController=null,e.fetchStatus=t})).catch((t=>{e.requestController===s&&(e.requestController=null,e.fetchStatus=D.DONE),l(t)?r=!0:i(t)})).then((()=>{r||this._setDirty(),this._scheduleUpdated()}))}_scheduleUpdated(){this._handles&&!this._handles.has("scheduleUpdated")&&this._handles.add(p((()=>{this._handles.remove("scheduleUpdated"),this._updated()})),"scheduleUpdated")}_showTile(e){if(a(e.displayingFeatures)&&!e.needsDisplayUpdate)return!1;const t=e.features;if(0===e.featureLimit||!t){const t=a(e.displayingFeatures)&&e.displayingFeatures.length>0;return this._hideTileFeatures(e),e.displayingFeatures=[],t}const s=e.descriptor.resolution,i=this._changes.updates,r=this._changes.adds,n=Math.min(e.featureLimit,t.length);e.featureLimit=n;for(let a=0;a<n;++a){const e=t[a],n=x(e,this._objectIdField),o=this._displayingFeatureReferences.get(n);if(o){const t=o.ref(e,s);t.oldVersion!==t.newVersion&&(t.oldVersion&&i.removes.push(t.oldVersion),t.newVersion&&i.adds.push(t.newVersion))}else this._displayingFeatureReferences.set(n,new this.FeatureReferenceClass(e,s)),r.push(e);this._numDisplayingFeatureReferences++}return this._hideTileFeatures(e),this._applyChanges(),e.displayingFeatures=t.slice(0,n),!0}_hideTile(e){this._cancelFetchTile(e),this._hideTileFeatures(e)}_hideTileFeatures(e){if(o(e.displayingFeatures))return;const t=this._changes.updates,s=this._changes.removes;for(const i of e.displayingFeatures){const r=x(i,this._objectIdField),a=this._displayingFeatureReferences.get(r);if(!a)continue;const n=a.unref(e.descriptor.resolution);this._numDisplayingFeatureReferences--,n?n.oldVersion!==n.newVersion&&(null==n.newVersion?(this._displayingFeatureReferences.delete(r),n.oldVersion&&s.push(n.oldVersion)):(t.adds.push(n.newVersion),n.oldVersion&&t.removes.push(n.oldVersion))):console.error("Hiding unreferenced feature")}this._applyChanges(),e.displayingFeatures=null}_applyChanges(){const e=this._changes.updates;e.removes.length>0&&(this.features.removeMany(e.removes),e.removes.length=0),e.adds.length>0&&(this.features.addMany(e.adds),e.adds.length=0);const t=this._changes.adds,s=this._changes.removes,i=Math.min(t.length,s.length);let r=0;for(;r<i;){const e=Math.min(r+$,i);this.features.addMany(t.slice(r,e)),this.features.removeMany(s.slice(r,e)),r=e}t.length>i&&this.features.addMany(0===r?t:t.slice(r)),s.length>i&&this.features.removeMany(0===r?s:s.slice(r)),t.length=0,s.length=0}_clearTile(e){if(this._hideTile(e),e.features&&a(this.context.memoryCache)){const t=16+e.estimatedSize;this.context.memoryCache.put(e.id,e.cache,t)}e.setFeatures(null,0,null),this._invalidateCounts()}_invalidateCounts(){this.notifyChange("totalVertices"),this.notifyChange("totalFeatures"),this.notifyChange("memoryForUnusedFeatures")}_getListOfTiles(){return Array.from(this._featureTiles.values())}get storedFeatures(){return this._getListOfTiles().reduce(((e,t)=>e+(t.features?t.features.length:0)),0)}get missingTiles(){return Array.from(this._featureTiles.values()).reduce(((e,t)=>e+(t.needsFetching||t.isFetching?1:0)),0)}_maximumFeaturesForTile(e){const t=e.hasPreciseFeatureCount?e.numFeatures:1/0,s=e.hasPreciseFeatureCount?t:this.maximumNumberOfFeatures,i=this._fullRatio<1?this._farRatio:1;return Math.min(Math.ceil(s*i/(1-e.emptyFeatureRatio)),t)}get test(){return{process:e=>this.runTask(e),getFeatureTileById:e=>this._featureTiles.get(e),forEachFeatureTile:e=>this._featureTiles.forEach(e)}}};function q(e){return"dummy-tile-full-extent"===e.id}function S(e){let t=0;for(const s of e)s.features&&s.features.length>0&&s.alive&&(t=Math.max(t,s.descriptor.lij[0]));return t}function L(e){const t=e.capabilities.query;return{supportsMultipleResolutions:Q(e),supportsPagination:!(!t||!t.supportsPagination),supportsResultType:!(!t||!t.supportsResultType),supportsCacheHint:!(!t||!t.supportsCacheHint),supportsQuantization:!(!t||!t.supportsQuantization),supportsQuantizationEditMode:!(!t||!t.supportsQuantizationEditMode),supportsMaxRecordCountFactor:!(!t||!t.supportsMaxRecordCountFactor),supportsFormatPBF:!(!t||!t.supportsFormatPBF)}}function Q(e){switch(e.geometryType){case"polyline":return!0;case"polygon":return e.capabilities&&e.capabilities.query&&e.capabilities.query.supportsQuantization;default:return!1}}function V(e){return e.setFeatures([],0,null),e.featuresMissing=!1,D.DONE}function H(e){return o(e)?new Set:new Set(e.map((e=>e.name)))}function k(e,t){if(o(e)||o(t))return H(t);const s=new Set;for(const{name:i}of t)e.has(i)&&s.add(i);return s}e([f({constructOnly:!0})],A.prototype,"features",void 0),e([f()],A.prototype,"tileDescriptors",void 0),e([f({value:1/0})],A.prototype,"maximumNumberOfFeatures",null),e([f({value:1})],A.prototype,"memoryFactor",null),e([f({value:1})],A.prototype,"lodFactor",null),e([f()],A.prototype,"useTileCount",null),e([f({readOnly:!0})],A.prototype,"updating",void 0),e([f({readOnly:!0})],A.prototype,"running",void 0),e([f({readOnly:!0})],A.prototype,"updatingTotal",void 0),e([f({readOnly:!0})],A.prototype,"updatingRemaining",void 0),e([f({readOnly:!0})],A.prototype,"expectedFeatureDiff",void 0),e([f({readOnly:!0})],A.prototype,"memoryForUnusedFeatures",null),e([f({readOnly:!0})],A.prototype,"maximumNumberOfFeaturesExceeded",void 0),e([f({constructOnly:!0})],A.prototype,"maximumNumberOfFeaturesExceededThrottle",void 0),e([f({readOnly:!0})],A.prototype,"totalVertices",null),e([f({readOnly:!0})],A.prototype,"totalFeatures",null),e([f()],A.prototype,"filterExtent",null),e([f({constructOnly:!0})],A.prototype,"context",void 0),A=e([m(U)],A);const z=2e3,B=_(),G=_(),X=6e5,$=200;export{A as FeatureTileFetcher3D,L as contextCapabilitiesFromLayer};