@arcgis/core 6.0.0-next.22 → 6.0.0-next.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/PopupTemplate.js +1 -1
- package/analysis/LineOfSightAnalysis.d.ts +1 -1
- package/analysis/LineOfSightAnalysisObserver.d.ts +5 -4
- package/analysis/LineOfSightAnalysisTarget.d.ts +4 -4
- package/analysis/Viewshed.d.ts +4 -4
- package/arcgisGlobal.d.ts +0 -5
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{3c277a0f099d67090d07.js → 02335385b1476fe322eb.js} +1 -1
- package/assets/esri/core/workers/chunks/{4911ce62421a6c3320b0.js → 13c64087be3b2985a21b.js} +1 -1
- package/assets/esri/core/workers/chunks/{8e19629899a5becf8e19.js → 150e7a7bd5df25693da7.js} +1 -1
- package/assets/esri/core/workers/chunks/2c0cb214fedb29487eef.js +1 -0
- package/assets/esri/core/workers/chunks/{2e096537a3a5555a4a93.js → 4cb751dc8d00bdaeb04c.js} +1 -1
- package/assets/esri/core/workers/chunks/517106048980a3cbe072.js +1 -0
- package/assets/esri/core/workers/chunks/{d08ff41e2a9bcd58b64a.js → 636cd05abfbdff19029e.js} +1 -1
- package/assets/esri/core/workers/chunks/{84940d8e14caf5a27e04.js → 64b360625c68cb863a08.js} +1 -1
- package/assets/esri/core/workers/chunks/{814751e705c05099f864.js → 7c75a8ee266c36baa902.js} +1 -1
- package/assets/esri/core/workers/chunks/947674b2ca8be65b9bcc.js +1 -0
- package/assets/esri/core/workers/chunks/{baed828b7846c0863289.js → 96c4ea9cfa3930f1c3fb.js} +21 -17
- package/assets/esri/core/workers/chunks/{8a485130781b49dbf608.js → 9d40786c5ceface786ba.js} +1 -1
- package/assets/esri/core/workers/chunks/{a35c69a4751d28c39907.js → 9e7c4eda135c4911b268.js} +1 -1
- package/assets/esri/core/workers/chunks/ad96132bc89671e595f3.js +1 -0
- package/assets/esri/themes/base/_core.scss +0 -2
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/Component.glsl.js +9 -12
- package/chunks/DefaultMaterial.glsl.js +4 -5
- package/chunks/Path.glsl.js +2 -4
- package/chunks/RealisticTree.glsl.js +3 -3
- package/chunks/SSAO.glsl.js +1 -2
- package/config.js +1 -1
- package/geometry/support/clipRay.js +1 -1
- package/geometry/support/plane.js +1 -1
- package/interfaces.d.ts +0 -55
- package/kernel.js +1 -1
- package/layers/ElevationLayer.d.ts +6 -2
- package/layers/GeoJSONLayer.d.ts +2 -107
- package/layers/IntegratedMeshLayer.js +1 -1
- package/layers/SceneLayer.d.ts +40 -16
- package/layers/ViewshedLayer.d.ts +10 -4
- package/layers/WMSLayer.d.ts +2 -69
- package/layers/mixins/TemporalLayer.d.ts +70 -48
- package/layers/mixins/TiledImagery.d.ts +0 -11
- package/package.json +2 -2
- package/popup/content.d.ts +38 -1
- package/popup/content.js +1 -1
- package/smartMapping/popup/support/clusterUtils.js +1 -1
- package/smartMapping/popup/support/utils.js +2 -2
- package/smartMapping/renderers/size.js +1 -1
- package/smartMapping/renderers/support/regenerateUtils.js +1 -1
- package/support/timeUtils.d.ts +11 -0
- package/views/2d/engine/webgl/GlyphWorker.js +1 -1
- package/views/2d/layers/features/Processor.js +1 -1
- package/views/2d/layers/features/aggregation/GeohashSpatialIndex.js +1 -1
- package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
- package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
- package/views/2d/layers/features/processor/AggregateStrategy.js +1 -1
- package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
- package/views/2d/layers/features/processor/bins/BinAdapter.js +1 -1
- package/views/2d/layers/features/processor/bins/BinLevelState.js +1 -1
- package/views/2d/layers/features/processor/clusters/ClusterAdapter.js +1 -1
- package/views/2d/layers/features/processor/clusters/ClusterLevelState.js +1 -1
- package/views/2d/layers/features/processor/tracks/TrackAdapter.js +1 -1
- package/views/2d/layers/features/processor/tracks/TrackLevelState.js +1 -1
- package/views/2d/layers/features/schema/processor/SimpleProcessorSchema.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/ASourceChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/ByReferenceTileSourceChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/ParquetSnapshotSourceChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/StreamSourceChunk.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/features/support/FeatureFilterEvaluator.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
- package/views/2d/layers/features/support/GraphicsReader.js +1 -1
- package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
- package/views/3d/environment/SunLighting.d.ts +0 -1
- package/views/3d/environment/SunLighting.js +1 -1
- package/views/3d/environment/VirtualLighting.d.ts +0 -1
- package/views/3d/environment/VirtualLighting.js +1 -1
- package/views/3d/input/handlers/ground/GroundDoubleClickMove.js +1 -1
- package/views/3d/interactive/placementTools/GroundNavigationPlacementTool3D.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/state/utils/groundNavigationUtils.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/Component.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +1 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceRayMarching.glsl.js +1 -2
- package/views/3d/webgl-engine/effects/glow/applyEmissiveGlow.glsl.js +9 -4
- package/views/3d/webgl-engine/effects/snowcover/applySnow.glsl.js +18 -0
- package/views/3d/webgl-engine/lib/Intersector.js +1 -1
- package/views/3d/webgl-engine/materials/Path.glsl.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/worldSizedRibbonLineIntersectionUtils.js +2 -0
- package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
- package/views/layers/LineOfSightLayerView.d.ts +2 -2
- package/views/layers/ViewshedLayerView.d.ts +2 -1
- package/widgets/Feature/FeatureExpression/FeatureExpressionViewModel.js +1 -1
- package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
- package/widgets/Locate.d.ts +1 -1
- package/widgets/Search/SearchViewModel.js +1 -1
- package/widgets/Search/support/layerSearchUtils.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Sketch/support/PluginManager.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
- package/widgets/support/GeolocationPositioning.d.ts +1 -2
- package/assets/esri/core/workers/chunks/42045cf46497828cd3c0.js +0 -1
- package/assets/esri/core/workers/chunks/576248e9ae2654569420.js +0 -1
- package/assets/esri/core/workers/chunks/6059853ef3b6cddbe869.js +0 -1
- package/assets/esri/core/workers/chunks/a679207c3458cc0b1fec.js +0 -1
- package/assets/esri/themes/base/widgets/_DirectionalPad.scss +0 -85
- package/assets/esri/widgets/DirectionalPad/t9n/messages.ar.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.bg.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.bs.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.ca.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.cs.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.da.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.de.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.el.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.en.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.es.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.et.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.fi.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.fr.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.he.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.hr.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.hu.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.id.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.it.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.ja.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.ko.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.lt.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.lv.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.nl.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.no.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.pl.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.pt-BR.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.pt-PT.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.ro.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.ru.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.sk.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.sl.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.sr.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.sv.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.th.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.tr.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.uk.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.vi.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.zh-CN.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.zh-HK.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.zh-TW.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.ar.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.bg.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.bs.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.ca.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.cs.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.da.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.de.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.el.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.en.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.es.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.et.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.fi.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.fr.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.he.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.hr.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.hu.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.id.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.it.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.ja.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.ko.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.lt.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.lv.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.nl.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.no.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.pl.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.pt-BR.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.pt-PT.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.ro.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.ru.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.sk.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.sl.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.sr.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.sv.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.th.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.tr.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.uk.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.vi.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.zh-CN.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.zh-HK.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.zh-TW.json +0 -1
- package/views/2d/layers/features/FeatureSpatialIndex.js +0 -2
- package/views/2d/layers/features/support/FeatureSetReaderIndirect.js +0 -2
- package/views/3d/webgl-engine/effects/snowcover/SnowCover.glsl.js +0 -12
- package/widgets/DirectionalPad/DirectionalPadViewModel.d.ts +0 -85
- package/widgets/DirectionalPad/DirectionalPadViewModel.js +0 -2
- package/widgets/DirectionalPad/VisibleElements.d.ts +0 -40
- package/widgets/DirectionalPad/VisibleElements.js +0 -2
- package/widgets/DirectionalPad/constants.js +0 -2
- package/widgets/DirectionalPad/css.js +0 -2
- package/widgets/DirectionalPad/types.d.ts +0 -27
- package/widgets/DirectionalPad/utils.js +0 -2
- package/widgets/DirectionalPad.d.ts +0 -156
- package/widgets/DirectionalPad.js +0 -2
- package/widgets/Track/TrackViewModel.d.ts +0 -131
- package/widgets/Track/TrackViewModel.js +0 -2
- package/widgets/Track/types.d.ts +0 -6
- package/widgets/Track.d.ts +0 -278
- package/widgets/Track.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{EventEmitter as e}from"../../../../../core/Evented.js";import{create as t}from"../../../../../geometry/support/aaBoundingBox.js";import{getBoundsOptimizedGeometry as n}from"../../../../../layers/graphics/featureConversionUtils.js";import{optimizedFeatureQueryEngineAdapter as r}from"../../../../../layers/graphics/data/optimizedFeatureQueryEngineAdapter.js";import{QueryEngine as i}from"../../../../../layers/graphics/data/QueryEngine.js";import{collectExpressionDependencies as a}from"../../../../../support/ArcadeExpression.js";import{AProcessorStrategy as o,LevelReplaceBatch as s}from"./AProcessorStrategy.js";class c extends o{constructor(t,n,i,o,s,c){super(t,n,s),this.spatialReference=i,this.aggregateFields=o,this._adapter=c,this._arcadeDependencies=new Set,this._levelStates=new Map,this.events=new e,this.featureAdapter=r;for(let e of o)a(this._arcadeDependencies,e.computed)}get aggregateQueryEngine(){if(!this._aggregateQueryEngine){let{metadata:e}=this._adapter;this._aggregateQueryEngine=new i({featureStore:this,fieldsIndex:e.fieldsIndex,geometryType:e.geometryType,featureIdInfo:e.featureIdInfo,spatialReference:this.spatialReference})}return this._aggregateQueryEngine}get isAggregate(){return!0}removeChunks(e){}hasArcadeDependency(e){return this._arcadeDependencies.has(e)}destroy(){super.destroy();for(let e of this._levelStates.values())e.destroy();this._levelStates.clear()}onSubscribe(e){super.onSubscribe(e);let{scale:t,level:n}=e.tile;this._lastSubscribedLodInfo={scale:t,level:n}}onUnsubscribe(e){this._levelStates.get(e.tile.level)?.removeTile(e),super.onUnsubscribe(e)}requiresInvalidation(e){return!1}invalidate(){for(let e of this._levelStates.values())e.invalidate()}getDisplayIds(e){return this.getActiveLevelState()?.getDisplayIds(e)??{}}getDisplayFeatures(e){return this.getActiveLevelState()?.getDisplayFeatures(e)??{features:[],aggregates:[],tracks:[]}}getFeatureObjectIdsForAggregate(e){return this.getActiveLevelState()?.getFeatureObjectIdsForAggregate(e)??[]}applyOverrideUpdate(e){return this._adapter.applyOverrideUpdate(e,this._levelStates.values())}createState(e){return this._adapter.createSendState(e)}async updateChunks(e,t){let n=this._lastSubscribedLodInfo;if(n==null)return null;let r=this._getOrCreateLevelState(n),i=this._getSendStatesForLevel(n.level);await r.update(e,i);let a=new s(n.level);for(let n of i)
|
|
2
|
+
import{EventEmitter as e}from"../../../../../core/Evented.js";import{create as t}from"../../../../../geometry/support/aaBoundingBox.js";import{getBoundsOptimizedGeometry as n}from"../../../../../layers/graphics/featureConversionUtils.js";import{optimizedFeatureQueryEngineAdapter as r}from"../../../../../layers/graphics/data/optimizedFeatureQueryEngineAdapter.js";import{QueryEngine as i}from"../../../../../layers/graphics/data/QueryEngine.js";import{collectExpressionDependencies as a}from"../../../../../support/ArcadeExpression.js";import{AProcessorStrategy as o,LevelReplaceBatch as s}from"./AProcessorStrategy.js";class c extends o{constructor(t,n,i,o,s,c){super(t,n,s),this.spatialReference=i,this.aggregateFields=o,this._adapter=c,this._arcadeDependencies=new Set,this._levelStates=new Map,this.events=new e,this.featureAdapter=r;for(let e of o)a(this._arcadeDependencies,e.computed)}get aggregateQueryEngine(){if(!this._aggregateQueryEngine){let{metadata:e}=this._adapter;this._aggregateQueryEngine=new i({featureStore:this,fieldsIndex:e.fieldsIndex,geometryType:e.geometryType,featureIdInfo:e.featureIdInfo,spatialReference:this.spatialReference})}return this._aggregateQueryEngine}get isAggregate(){return!0}removeChunks(e){}hasArcadeDependency(e){return this._arcadeDependencies.has(e)}destroy(){super.destroy();for(let e of this._levelStates.values())e.destroy();this._levelStates.clear()}onSubscribe(e){super.onSubscribe(e);let{scale:t,level:n}=e.tile;this._lastSubscribedLodInfo={scale:t,level:n}}onUnsubscribe(e){this._levelStates.get(e.tile.level)?.removeTile(e),super.onUnsubscribe(e)}requiresInvalidation(e){return!1}invalidate(){for(let e of this._levelStates.values())e.invalidate()}getDisplayIds(e){return this.getActiveLevelState()?.getDisplayIds(e)??{}}getDisplayFeatures(e){return this.getActiveLevelState()?.getDisplayFeatures(e)??{features:[],aggregates:[],tracks:[]}}getFeatureObjectIdsForAggregate(e){return this.getActiveLevelState()?.getFeatureObjectIdsForAggregate(e)??[]}applyOverrideUpdate(e){return this._adapter.applyOverrideUpdate(e,this._levelStates.values())}createState(e){return this._adapter.createSendState(e)}async updateChunks(e,t){let n=this._lastSubscribedLodInfo;if(n==null)return null;let r=this._getOrCreateLevelState(n),i=this._getSendStatesForLevel(n.level);await r.update(e,i);let a=new s(n.level);for(let n of i){let i=r.createMessages(n,e,t,()=>{this.events.emit(`changed`)});a.messages.push(...i)}return this._adapter.applyAttributeUpdate(n),await this._adapter.afterUpdateLevelState(r,e,i),a}getActiveLevelState(){let e=this._lastSubscribedLodInfo;return e==null?null:this._levelStates.get(e.level)}_getOrCreateLevelState(e){let t=this._levelStates.get(e.level);return t??(t=this._adapter.createLevelState(e),this._levelStates.set(e.level,t)),t}_getSendStatesForLevel(e){return Array.from(this._sendStates.values()).filter(t=>t.subscription.tile.level===e)}forEach(e){this.getActiveLevelState()?.forEachAggregateWorldSpace(e)}forEachInBounds(e,t){}forEachBounds(e,r){let i=t();for(let t of e){let e=n(i,t.geometry);e&&r(e)}}}export{c as AggregateStrategy};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import has from"../../../../../core/has.js";import{AProcessorStrategy as e,UpdateBatch as t,AppendBatch as n,ASendState as r}from"./AProcessorStrategy.js";import{FeatureTileUpdateMessage as i,FeatureTileAppendMessage as a}from"../sources/FeatureSourceMessage.js";import{OverrideChunk as o}from"../sources/strategies/chunks/Overrides.js";import{createArcadeEvaluationOptions as s}from"../support/arcadeUtils.js";
|
|
2
|
+
import has from"../../../../../core/has.js";import{AProcessorStrategy as e,UpdateBatch as t,AppendBatch as n,ASendState as r}from"./AProcessorStrategy.js";import{FeatureTileUpdateMessage as i,FeatureTileAppendMessage as a}from"../sources/FeatureSourceMessage.js";import{OverrideChunk as o}from"../sources/strategies/chunks/Overrides.js";import{createArcadeEvaluationOptions as s}from"../support/arcadeUtils.js";class c extends r{}class l extends e{constructor(e,t,n,r){super(e,t,r),this._arcadeContextInfo=n,this._handledChunks=new Set,this._streamLayerDeferredObjectIdsToRemove=[]}destroy(){super.destroy();for(let e of this._source.chunks())this._cleanupChunkIds(e)}invalidateAttributeData(e){this._arcadeContextInfo=e,this._evalOptions!=null&&(this._evalOptions=s(this._evalOptions.$view.scale,e))}onSubscribe(e){super.onSubscribe(e),this._evalOptions=e.tile.createArcadeEvaluationOptions(this._arcadeContextInfo)}createState(e){return new c(e)}get aggregateQueryEngine(){return null}getDisplayFeatures(e){let t=new Set(e),n=new Set,r=[];for(let e of this._source.chunks()){let i=e.reader.getCursor();for(;i.next();){let e=i.getObjectId(),a=i.getDisplayId();t.has(a)&&!n.has(e)&&(r.push({...i.readLegacyFeatureWorldSpace(),displayId:a}),n.add(e))}}return{features:r,aggregates:[],tracks:[]}}async applyOverrideUpdate(e){let n=new t,r=[];for(let t of e.modified.values()){let e=this._attributeStore.createDisplayIdForObjectId(t.objectId);t.displayId=e,r.push(e)}let a=[];for(let t of e.removed){let e=this._attributeStore.getDisplayIdForObjectId(t);e!=null&&a.push(e)}let s=o.fromFeatures(Array.from(e.modified.values()),this._source.metadata);this._attributeStore.setDataForReader(s.reader,this._evalOptions,this._sqlOptions),has(`esri-2d-update-debug`)&&console.debug(`FeatureUpdateStrategy.applyLocalEdit`,{message:e,modifiedDisplayIds:r,removedDisplayIds:a}),this._handledChunks.add(s.chunkId);for(let e of this._sendStates.values())e.handledChunks.add(s.chunkId),n.messages.push(new i(e.subscription,null,r,!1,s.queryInfo));for(let e of this._sendStates.values()){let t=s.getTileReader(e.subscription.tile);n.messages.push(new i(e.subscription,t,a,!1,s.queryInfo))}for(let t of e.removed)this._attributeStore.releaseDisplayIdForObjectId(t);return n}async updateChunks(e,t){let r=new n;if(!e.length)return r;this._updateAttributeData();for(let t of this._sendStates.values()){let{subscription:n,handledChunks:i}=t;for(let o of e){let{chunkId:e}=o;if(i.has(e)||!this._handledChunks.has(e))continue;i.add(e);let s=o.getTileReader(n.tile);if(!s)continue;let c=new a(t.subscription,s,o.end,o.queryInfo);r.messages.push(c)}}return r}removeChunks(e){for(let t of e)this._cleanupChunkIds(t)}afterUpdateChunks(){for(let e of this._streamLayerDeferredObjectIdsToRemove)this._attributeStore.releaseDisplayIdForObjectId(e);this._streamLayerDeferredObjectIdsToRemove=[]}_cleanupChunkIds(e){if(this._handledChunks.has(e.chunkId)){let t=e.reader.getCursor();for(;t.next();){let e=t.getObjectId();this._source.isStream?this._streamLayerDeferredObjectIdsToRemove.push(e):this._attributeStore.releaseDisplayIdForObjectId(e)}this._handledChunks.delete(e.chunkId)}}_updateAttributeData(){for(let e of this._source.chunks()){let{chunkId:t,reader:n}=e;if(this._handledChunks.has(t))continue;let r=n.getCursor();for(;r.next();){let e=this._attributeStore.createDisplayIdForObjectId(r.getObjectId());r.setDisplayId(e)}this._attributeStore.setDataForReader(n,this._evalOptions,this._sqlOptions),this._handledChunks.add(t)}this._attributeStore.applyUpdate(this._source.chunks().map(e=>e.reader),this._evalOptions,this._sqlOptions)}}export{c as DefaultSendState,l as FeatureUpdateStrategy};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../../../../layers/support/FieldsIndex.js";import{BinLevelState as t}from"./BinLevelState.js";import{BinState as n}from"./BinState.js";import{
|
|
2
|
+
import e from"../../../../../../layers/support/FieldsIndex.js";import{BinLevelState as t}from"./BinLevelState.js";import{BinState as n}from"./BinState.js";import{createArcadeEvaluationOptions as r}from"../../support/arcadeUtils.js";import{FeatureMetadata as i}from"../../support/FeatureMetadata.js";import{Hashed as a}from"../../support/Hashed.js";class o{constructor(t,n,r,a,o,s,c,l){this._schema=t,this._featureFilter=n,this._arcadeContextInfo=r,this._aggregateFields=a,this._spatialReference=o,this._sqlOptions=l,this.metadata=i.createFeature({geometryType:`esriGeometryPolygon`,hasZ:!1,hasM:!1,featureIdInfo:{type:`object-id`,fieldName:`aggregateId`},fieldsIndex:new e(t.fields).toJSON(),globalIdField:null,spatialReference:s.metadata.spatialReference,outSpatialReference:s.metadata.outSpatialReference,attributeSpatialReference:null,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null}),this._getIndex=this._createGetIndex(),this._binContext={getIndex:this._getIndex,spatialReference:this._spatialReference,attributeStore:c,metadata:this.metadata,arcadeContextInfo:this._arcadeContextInfo,sqlOptions:this._sqlOptions}}createSendState(e){return new n(e)}createLevelState(e){return new t(e.level,this._binContext)}async applyOverrideUpdate(e,t){for(let e of t)e.invalidate();return null}applyAttributeUpdate(e){let t=r(e.scale,this._binContext.arcadeContextInfo);this._binContext.attributeStore.applyUpdate([],t,this._binContext.sqlOptions)}afterUpdateLevelState(e,t,n){}_createGetIndex(){return(e,t)=>{switch(this._schema.index.type){case`geohash`:return e.reader.getGeohashIndex(new a({type:`geohash`,fields:this._aggregateFields,featureFilter:this._featureFilter,geohashLevel:this._schema.index.fixBinLevel,spatialReference:this._spatialReference,arcadeContextInfo:this._arcadeContextInfo,scale:t.scale,sqlOptions:this._sqlOptions}));case`grid`:{let n=this._schema.index.fixedBinLevel,r=n==null?t.scale:t.tileInfoView.getLODInfoAt(n).scale;return e.reader.getGridIndex(new a({type:`grid`,fields:this._aggregateFields,cellSize:this._schema.index.size,featureFilter:this._featureFilter,spatialReference:this._spatialReference,arcadeContextInfo:this._arcadeContextInfo,scale:r,sqlOptions:this._sqlOptions}))}}}}}export{o as BinAdapter};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import has from"../../../../../../core/has.js";import{convertToFeature as e,unquantizeOptimizedGeometryInPlace as t}from"../../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as n}from"../../../../../../layers/graphics/OptimizedFeature.js";import{FeatureTileAppendMessage as r}from"../../sources/FeatureSourceMessage.js";import{FeatureSetReaderJSON as i}from"../../support/FeatureSetReaderJSON.js";class a{constructor(e,t){this.level=e,this._context=t,this._tileStates=new Map}destroy(){for(let e of this._tileStates.values())this._releaseTileState(e);this._tileStates.clear()}invalidate(){}update(e,t){}removeTile(e){let t=this._tileStates.get(e.key.id);t!=null&&(this._releaseTileState(t),this._tileStates.delete(e.key.id))}getDisplayIds(e){let t=new Set(e),n={};for(let e of this._featuresWorldSpace()){let{objectId:r,displayId:i}=e;r!=null&&t.has(r)&&(n[r]=i)}return n}getDisplayFeatures(t){let n=new Set(t),r=new Set,i=[];for(let t of this._featuresWorldSpace())n.has(t.displayId)&&!r.has(t.objectId)&&(t.geometry&&i.push({...e(t,this._context.metadata.geometryType,!1,!1),displayId:t.displayId}),r.add(t.objectId));return{features:[],aggregates:i,tracks:[]}}getFeatureObjectIdsForAggregate(e){for(let t of this._tileStates.values())for(let n of t.bins.values())if(n.id===e){let e=[];for(let t of n.containedObjectIds)for(let n of t.values())e.push(n);return e}return[]}forEachAggregateWorldSpace(e){let t=new Set;for(let n of this._featuresWorldSpace())t.has(n.objectId)||(e(n),t.add(n.objectId))}createMessages(e,t,a,o){let{subscription:s}=e,c=this._getOrCreateTileState(s),l=this._takeTileState(c),u=s.tile,d=new Set;for(let e of t)this._context.getIndex(e,u).putBounded(c.bins,d,u.extent,u.resolution);let f=[],p=s.tile.transform,m=s.tile.key.level;for(let e of c.bins.values()){let t=e.getGeometry(this._context.spatialReference,p),r=new n(t,e.getAttributes(),null,e.id);t||(r.centroid=e.getGeometricCentroid(this._context.spatialReference,p)),r.displayId=this._context.attributeStore.createDisplayIdForObjectId(`${r.objectId}.${m}`),c.featureCache.set(e.id,r),f.push(r)}o(),e.done||=!a;let h=i.fromOptimizedFeatures(f,this._context.metadata,p),g=
|
|
2
|
+
import has from"../../../../../../core/has.js";import{convertToFeature as e,unquantizeOptimizedGeometryInPlace as t}from"../../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as n}from"../../../../../../layers/graphics/OptimizedFeature.js";import{FeatureTileAppendMessage as r}from"../../sources/FeatureSourceMessage.js";import{FeatureSetReaderJSON as i}from"../../support/FeatureSetReaderJSON.js";class a{constructor(e,t){this.level=e,this._context=t,this._tileStates=new Map}destroy(){for(let e of this._tileStates.values())this._releaseTileState(e);this._tileStates.clear()}invalidate(){}update(e,t){}removeTile(e){let t=this._tileStates.get(e.key.id);t!=null&&(this._releaseTileState(t),this._tileStates.delete(e.key.id))}getDisplayIds(e){let t=new Set(e),n={};for(let e of this._featuresWorldSpace()){let{objectId:r,displayId:i}=e;r!=null&&t.has(r)&&(n[r]=i)}return n}getDisplayFeatures(t){let n=new Set(t),r=new Set,i=[];for(let t of this._featuresWorldSpace())n.has(t.displayId)&&!r.has(t.objectId)&&(t.geometry&&i.push({...e(t,this._context.metadata.geometryType,!1,!1),displayId:t.displayId}),r.add(t.objectId));return{features:[],aggregates:i,tracks:[]}}getFeatureObjectIdsForAggregate(e){for(let t of this._tileStates.values())for(let n of t.bins.values())if(n.id===e){let e=[];for(let t of n.containedObjectIds)for(let n of t.values())e.push(n);return e}return[]}forEachAggregateWorldSpace(e){let t=new Set;for(let n of this._featuresWorldSpace())t.has(n.objectId)||(e(n),t.add(n.objectId))}createMessages(e,t,a,o){let{subscription:s}=e,c=this._getOrCreateTileState(s),l=this._takeTileState(c),u=s.tile,d=new Set;for(let e of t)this._context.getIndex(e,u).putBounded(c.bins,d,u.extent,u.resolution);let f=[],p=s.tile.transform,m=s.tile.key.level;for(let e of c.bins.values()){let t=e.getGeometry(this._context.spatialReference,p),r=new n(t,e.getAttributes(),null,e.id);t||(r.centroid=e.getGeometricCentroid(this._context.spatialReference,p)),r.displayId=this._context.attributeStore.createDisplayIdForObjectId(`${r.objectId}.${m}`),c.featureCache.set(e.id,r),f.push(r)}o(),e.done||=!a;let h=i.fromOptimizedFeatures(f,this._context.metadata,p),g=e.subscription.tile.createArcadeEvaluationOptions(this._context.arcadeContextInfo);this._context.attributeStore.setDataForReader(h,g,this._context.sqlOptions),has(`esri-2d-update-debug`)&&console.debug(`Tile[${e.subscription.tile.id}] BinningStrategy._update`,{done:e.done});let _=new r(e.subscription,h,e.done,{});for(let e of l.featureCache.keys())this._context.attributeStore.releaseDisplayIdForObjectId(`${e}.${m}`);return[_]}_getOrCreateTileState(e){let t=this._tileStates.get(e.key.id);return t??(t={subscription:e,bins:new Map,featureCache:new Map},this._tileStates.set(e.key.id,t)),t}_takeTileState(e){let t=e.bins,n=e.featureCache;return e.bins=new Map,e.featureCache=new Map,{bins:t,featureCache:n}}_releaseTileState(e){let t=e.subscription.tile.key.level;for(let n of e.featureCache.keys())this._context.attributeStore.releaseDisplayIdForObjectId(`${n}.${t}`);e.bins.clear(),e.featureCache.clear()}*_featuresWorldSpace(){for(let e of this._tileStates.values())for(let n of e.featureCache.values()){let r=n.clone();r.geometry&&t(r.geometry,e.subscription.tile.transform),yield r}}}export{a as BinLevelState};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../../../../layers/support/FieldsIndex.js";import{ClusterLevelState as t}from"./ClusterLevelState.js";import{ClusterSendState as n}from"./ClusterSendState.js";import{
|
|
2
|
+
import e from"../../../../../../layers/support/FieldsIndex.js";import{ClusterLevelState as t}from"./ClusterLevelState.js";import{ClusterSendState as n}from"./ClusterSendState.js";import{createArcadeEvaluationOptions as r}from"../../support/arcadeUtils.js";import{FeatureMetadata as i}from"../../support/FeatureMetadata.js";class a{constructor(t,n,r,a,o,s,c){this.metadata=i.createFeature({geometryType:`esriGeometryPoint`,hasZ:!1,hasM:!1,featureIdInfo:{type:`object-id`,fieldName:`aggregateId`},fieldsIndex:new e([...a,...o.metadata.fieldsIndex.fields,{name:`aggregateId`,alias:`aggregateId`,type:`esriFieldTypeOID`}]).toJSON(),globalIdField:null,spatialReference:o.metadata.spatialReference,outSpatialReference:o.metadata.outSpatialReference,attributeSpatialReference:null,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null}),this._clusterContext={connection:t,clusterRadius:n,indexOptions:r,attributeStore:s,metadata:this.metadata,sqlOptions:c}}createSendState(e){return new n(e)}createLevelState(e){return new t(e.level,e.scale,this._clusterContext)}async applyOverrideUpdate(e,t){for(let e of t)e.invalidate();return null}applyAttributeUpdate(e){let t=r(e.scale,this._clusterContext.indexOptions.arcadeContextInfo);this._clusterContext.attributeStore.applyUpdate([],t,this._clusterContext.sqlOptions)}afterUpdateLevelState(e,t,n){return e.updateStatistics()}}export{a as ClusterAdapter};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import has from"../../../../../../core/has.js";import{convertToFeature as e}from"../../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as t}from"../../../../../../layers/graphics/OptimizedFeature.js";import n from"../../../../../../layers/graphics/OptimizedGeometry.js";import{tileSize as r}from"../../../../engine/webgl/definitions.js";import{GridCell as i}from"../../aggregation/GridCell.js";import{pixelsPerMapUnit as a}from"../../aggregation/GridSpatialIndex.js";import{WithDisplayId as o}from"../support/WithDisplayId.js";import{FeatureTileAppendMessage as s}from"../../sources/FeatureSourceMessage.js";import{FeatureSetReaderJSON as c}from"../../support/FeatureSetReaderJSON.js";import{Hashed as l}from"../../support/Hashed.js";class u{constructor(e,t,n){this.level=e,this._scale=t,this._context=n,this._statistics=new Map,this._handledChunks=new Set,this._handledIds=new Set,this._cells=new Map,this._clusters=new Map}destroy(){this._clearClusters()}_clearClusters(){for(let e of this._clusters.values())this._context.attributeStore.releaseDisplayIdForObjectId(e.inner.id);this._clusters.clear()}invalidate(){this._cells.clear(),this._handledChunks.clear(),this._handledIds.clear()}removeTile(e){}*aggregatesWorldSpace(){for(let e of this._clusters.values()){let n=e.inner.getCentroid(null);yield new t(n,e.inner.getAttributes(),null,e.inner.id,e.displayId)}}clusters(){return this._clusters.values()}getDisplayIds(e){let t=new Set(e),n={};for(let e of this._clusters.values())if(t.has(e.inner.id))n[e.inner.id]=e.displayId;else if(e.inner.count===1){let{firstObjectId:r}=e.inner;r!=null&&t.has(r)&&(n[r]=e.displayId)}return n}getDisplayFeatures(t){let n=new Set(t),r=new Set,i=[],a=[];for(let t of this.aggregatesWorldSpace())if(n.has(t.displayId)&&!r.has(t.displayId)){let n=e(t,this._context.metadata.geometryType,!1,!1);if(r.add(t.displayId),n.attributes.cluster_count===1){i.push({...n,displayId:t.displayId});continue}a.push({...n,displayId:t.displayId})}return{features:i,aggregates:a,tracks:[]}}getFeatureObjectIdsForAggregate(e){for(let t of this._clusters.values())if(t.inner.id===e){let e=[];for(let n of t.inner.containedObjectIds)for(let t of n.values())e.push(t);return e}return[]}forEachAggregateWorldSpace(e){for(let t of this.aggregatesWorldSpace())e(t)}update(e,t){let n=!1,r=new l({...this._context.indexOptions,scale:this._scale});for(let t of e)this._handledChunks.has(t.normalizedChunkId)||(this._handledChunks.add(t.normalizedChunkId),t.lodInfo!=null&&t.lodInfo.level!==this.level)||(t.getGridIndex(r).put(this._cells,this._handledIds),n=!0);let i=a(this._context.indexOptions.spatialReference,this._scale),o=this._context.indexOptions.cellSize,s={xMin:1/0,yMin:1/0,xMax:-1/0,yMax:-1/0};for(let{subscription:e}of t){let t=e.tile.bounds,n=Math.floor(t[0]*i/o),r=Math.floor(t[1]*i/o),a=Math.ceil(t[2]*i/o),c=Math.ceil(t[3]*i/o);s.xMin=Math.min(s.xMin,n),s.yMin=Math.min(s.yMin,r),s.xMax=Math.max(s.xMax,a),s.yMax=Math.max(s.yMax,c)}(this._lastCellBounds==null||s.xMin!==this._lastCellBounds.xMin||s.xMax!==this._lastCellBounds.xMax||s.yMin!==this._lastCellBounds.yMin||s.yMax!==this._lastCellBounds.yMax)&&(this._lastCellBounds=s,n=!0),n&&this._clusterCells(s)}async updateStatistics(){let e=!1;for(let t of this._clusters.values())t.inner.count>1&&(e=this._updateAggregateStatistics(this._statistics,t.inner)||e);if(e){let e=Array.from(this._statistics.entries()).map(([e,t])=>({fieldName:e,minValue:t.minValue,maxValue:t.maxValue}));await this._context.connection.container.updateStatistics(this.level,e)}}createMessages(e,t,n,r){let i=this._createAggregateFeatures(e);r(),e.done=e.done||!n;let a=
|
|
2
|
+
import has from"../../../../../../core/has.js";import{convertToFeature as e}from"../../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as t}from"../../../../../../layers/graphics/OptimizedFeature.js";import n from"../../../../../../layers/graphics/OptimizedGeometry.js";import{tileSize as r}from"../../../../engine/webgl/definitions.js";import{GridCell as i}from"../../aggregation/GridCell.js";import{pixelsPerMapUnit as a}from"../../aggregation/GridSpatialIndex.js";import{WithDisplayId as o}from"../support/WithDisplayId.js";import{FeatureTileAppendMessage as s}from"../../sources/FeatureSourceMessage.js";import{FeatureSetReaderJSON as c}from"../../support/FeatureSetReaderJSON.js";import{Hashed as l}from"../../support/Hashed.js";class u{constructor(e,t,n){this.level=e,this._scale=t,this._context=n,this._statistics=new Map,this._handledChunks=new Set,this._handledIds=new Set,this._cells=new Map,this._clusters=new Map}destroy(){this._clearClusters()}_clearClusters(){for(let e of this._clusters.values())this._context.attributeStore.releaseDisplayIdForObjectId(e.inner.id);this._clusters.clear()}invalidate(){this._cells.clear(),this._handledChunks.clear(),this._handledIds.clear()}removeTile(e){}*aggregatesWorldSpace(){for(let e of this._clusters.values()){let n=e.inner.getCentroid(null);yield new t(n,e.inner.getAttributes(),null,e.inner.id,e.displayId)}}clusters(){return this._clusters.values()}getDisplayIds(e){let t=new Set(e),n={};for(let e of this._clusters.values())if(t.has(e.inner.id))n[e.inner.id]=e.displayId;else if(e.inner.count===1){let{firstObjectId:r}=e.inner;r!=null&&t.has(r)&&(n[r]=e.displayId)}return n}getDisplayFeatures(t){let n=new Set(t),r=new Set,i=[],a=[];for(let t of this.aggregatesWorldSpace())if(n.has(t.displayId)&&!r.has(t.displayId)){let n=e(t,this._context.metadata.geometryType,!1,!1);if(r.add(t.displayId),n.attributes.cluster_count===1){i.push({...n,displayId:t.displayId});continue}a.push({...n,displayId:t.displayId})}return{features:i,aggregates:a,tracks:[]}}getFeatureObjectIdsForAggregate(e){for(let t of this._clusters.values())if(t.inner.id===e){let e=[];for(let n of t.inner.containedObjectIds)for(let t of n.values())e.push(t);return e}return[]}forEachAggregateWorldSpace(e){for(let t of this.aggregatesWorldSpace())e(t)}update(e,t){let n=!1,r=new l({...this._context.indexOptions,scale:this._scale});for(let t of e)this._handledChunks.has(t.normalizedChunkId)||(this._handledChunks.add(t.normalizedChunkId),t.lodInfo!=null&&t.lodInfo.level!==this.level)||(t.reader.getGridIndex(r).put(this._cells,this._handledIds),n=!0);let i=a(this._context.indexOptions.spatialReference,this._scale),o=this._context.indexOptions.cellSize,s={xMin:1/0,yMin:1/0,xMax:-1/0,yMax:-1/0};for(let{subscription:e}of t){let t=e.tile.bounds,n=Math.floor(t[0]*i/o),r=Math.floor(t[1]*i/o),a=Math.ceil(t[2]*i/o),c=Math.ceil(t[3]*i/o);s.xMin=Math.min(s.xMin,n),s.yMin=Math.min(s.yMin,r),s.xMax=Math.max(s.xMax,a),s.yMax=Math.max(s.yMax,c)}(this._lastCellBounds==null||s.xMin!==this._lastCellBounds.xMin||s.xMax!==this._lastCellBounds.xMax||s.yMin!==this._lastCellBounds.yMin||s.yMax!==this._lastCellBounds.yMax)&&(this._lastCellBounds=s,n=!0),n&&this._clusterCells(s)}async updateStatistics(){let e=!1;for(let t of this._clusters.values())t.inner.count>1&&(e=this._updateAggregateStatistics(this._statistics,t.inner)||e);if(e){let e=Array.from(this._statistics.entries()).map(([e,t])=>({fieldName:e,minValue:t.minValue,maxValue:t.maxValue}));await this._context.connection.container.updateStatistics(this.level,e)}}createMessages(e,t,n,r){let i=this._createAggregateFeatures(e);r(),e.done=e.done||!n;let a=e.subscription.tile.createArcadeEvaluationOptions(this._context.indexOptions.arcadeContextInfo);return this._context.attributeStore.setDataForReader(i,a,this._context.sqlOptions),has(`esri-2d-update-debug`)&&console.debug(`Tile[${e.subscription.tile.id}] ClusterStrategy._update`,{done:e.done}),[new s(e.subscription,i,e.done,{})]}_createAggregateFeatures(e){let i=e.subscription,a=[],o=i.tile.transform,s=Array.from(this._clusters.values()),l=s.length;for(let e of s){let i=e.inner.getCentroidX(o),s=e.inner.getCentroidY(o),c=e.inner.count===1?e.inner.firstObjectId:e.inner.id,l=e.displayId;if(i<r+128&&i>=-128&&s<r+128&&s>=-128){let r=new n([],[i,s]),o=new t(r,e.inner.getAttributes(),null,c,l);a.push(o)}}let u=c.fromOptimizedFeatures(a,this._context.metadata,i.tile.transform);return has(`esri-2d-update-debug`)&&console.debug(`Tile[${e.subscription.tile.id}] ClusterLevelState.createAggregateFeatures`,{clusters:u,levelClusterCount:l}),u}_clusterCells(e){let t=this._clusters;this._clusters=new Map;let n=this._context.clusterRadius*(1/a(this._context.indexOptions.spatialReference,this._scale)),r=Array.from(this._cells.values());r=r.sort((e,t)=>t.count-e.count);let s=new Set;for(let t of r){if(s.has(t.id)||t.gridX<e.xMin||t.gridX>e.xMax||t.gridY<e.yMin||t.gridY>e.yMax)continue;let r=1+this._context.clusterRadius/this._context.indexOptions.cellSize,a=this._context.attributeStore.createDisplayIdForObjectId(t.id),c=new o(t.clone(),a);s.add(t.id),this._clusters.set(t.id,c);let l=t.centroidXWorld,u=t.centroidYWorld;for(let e=t.gridY-r;e<=t.gridY+r;e++)for(let a=t.gridX-r;a<=t.gridX+r;a++){if(e===t.gridY&&a===t.gridX)continue;let r=this._cells.get(i.createId(a,e));if(!r||s.has(r.id))continue;let o=Math.abs(r.centroidXWorld-l),d=Math.abs(r.centroidYWorld-u);o<n&&d<n&&(c.inner.merge(r),s.add(r.id))}}for(let e of t.values())this._context.attributeStore.releaseDisplayIdForObjectId(e.inner.id)}_updateAggregateStatistics(e,t){let n=!1;for(let r of t.statistics.values()){if(r.field.type===`esriFieldTypeString`)continue;let t=r.value,i=r.field,a=e.get(i.name);if(a){let{minValue:e,maxValue:r}=a,i=Math.min(a.minValue,t),o=Math.max(a.maxValue,t);(e!==i||r!==o)&&(a.minValue=i,a.maxValue=o,n=!0)}else e.set(i.name,{minValue:t,maxValue:t}),n=!0}return n}}export{u as ClusterLevelState};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../../../../core/Logger.js";import{internalTrackPartField as t}from"../../../../../../layers/support/streamLayerUtils.js";import{TrackLevelState as n}from"./TrackLevelState.js";import{TrackSendState as r}from"./TrackSendState.js";import{
|
|
2
|
+
import e from"../../../../../../core/Logger.js";import{internalTrackPartField as t}from"../../../../../../layers/support/streamLayerUtils.js";import{TrackLevelState as n}from"./TrackLevelState.js";import{TrackSendState as r}from"./TrackSendState.js";import{createArcadeEvaluationOptions as i}from"../../support/arcadeUtils.js";import{FeatureMetadata as a}from"../../support/FeatureMetadata.js";const o=()=>e.getLogger(`esri.views.2d.layers.features.processor.TrackStrategy`);class s{constructor(e,n,r,i,o,s,c,l){let u=n.metadata.weakCloneWithAdditionalFields([{name:t,alias:`trackPart`,type:`esriFieldTypeSmallInteger`}]),d=n.metadata.fieldsIndex.toJSON();d.fields.push(...o,{name:t,alias:`trackPart`,type:`esriFieldTypeSmallInteger`},{name:`aggregateId`,alias:`aggregateId`,type:`esriFieldTypeOID`});let f=a.createFeature({geometryType:`esriGeometryPolyline`,featureIdInfo:{type:`object-id`,fieldName:`aggregateId`},fieldsIndex:d,globalIdField:null,spatialReference:n.metadata.spatialReference,outSpatialReference:n.metadata.outSpatialReference,attributeSpatialReference:null,subtypeField:null,subtypes:null,timeInfo:n.metadata.timeInfo,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null,hasZ:!1,hasM:!1});this.metadata=u,this._trackContext={schema:e,source:n,attributeStore:r,spatialReference:i,metadata:u,trackLineMetadata:f,aggregateFields:o,arcadeContextInfo:c,sqlOptions:l,featureFilter:s,isStream:n.isStream}}createSendState(e){return new r(e)}createLevelState(e){return new n(e.level,this._trackContext)}async applyOverrideUpdate(e,t){return o().error(`Applying override to tracks is not supported`),null}applyAttributeUpdate(e){let t=i(e.scale,this._trackContext.arcadeContextInfo);this._trackContext.attributeStore.applyUpdate([],t,this._trackContext.sqlOptions)}afterUpdateLevelState(e,t,n){}}export{s as TrackAdapter};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{isSome as e}from"../../../../../../core/arrayUtils.js";import{internalTrackPartField as t}from"../../../../../../layers/support/streamLayerUtils.js";import{Track as n}from"./Track.js";import{FeatureTileAppendMessage as r}from"../../sources/FeatureSourceMessage.js";import{createArcadeEvaluationOptions as i}from"../../support/arcadeUtils.js";import{FeatureSetReaderIndirect as a}from"../../support/
|
|
2
|
+
import{isSome as e}from"../../../../../../core/arrayUtils.js";import{internalTrackPartField as t}from"../../../../../../layers/support/streamLayerUtils.js";import{Track as n}from"./Track.js";import{FeatureTileAppendMessage as r}from"../../sources/FeatureSourceMessage.js";import{createArcadeEvaluationOptions as i}from"../../support/arcadeUtils.js";import{FeatureSetReaderIndirect as a}from"../../support/FeatureSetReader.js";import{FeatureSetReaderJSON as o}from"../../support/FeatureSetReaderJSON.js";class s{constructor(e,t){this.level=e,this._context=t,this._chunks=[],this._tracks=new Map,this._handledChunks=new Set}destroy(){this._clear()}invalidate(){}removeTile(e){}update(e,t){let n=this._chunks,r=this._tracks,i=this._handledChunks;this._chunks=e,this._tracks=new Map,this._handledChunks=new Set,this._rebuildTracks(e),this._releaseState(n,r,i)}getDisplayIds(e){let t=new Set(e),n={};for(let e of this._tracks.values()){if(t.has(e.objectId)){n[e.objectId]=e.displayId;continue}let r=e.latestObservationFeature;if(r?.objectId!=null&&t.has(r.objectId))n[r.objectId]=r.displayId;else for(let r of e.observations())r.objectId!=null&&t.has(r.objectId)&&(n[r.objectId]=r.displayId)}return n}getDisplayFeatures(e){let t=new Set(e),n=[],r=[],i=this._chunks.map(e=>e.reader.getCursor());for(let e of this._tracks.values()){if(t.has(e.displayId)&&r.push(e.getTrackLineDisplayFeature()),e.latestObservationFeature!=null&&t.has(e.latestObservationFeature.displayId)){let{displayId:t,chunkIndex:r,featureIndex:a}=e.latestObservationRecord,o=i[r];o.setIndex(a),n.push({displayId:t,...o.readLegacyFeatureWorldSpace()})}for(let{displayId:r,chunkIndex:a,featureIndex:o}of e.observations())if(t.has(r)){let e=i[a];e.setIndex(o),n.push({displayId:r,...e.readLegacyFeatureWorldSpace()})}}return{features:n,aggregates:[],tracks:r}}getFeatureObjectIdsForAggregate(e){for(let t of this._tracks.values())if(t.objectId===e)return Array.from(t.observations(),e=>e.objectId);return[]}forEachAggregateWorldSpace(e){for(let t of this._tracks.values())e(t.getTrackLineOptimizedFeature())}createMessages(n,i,s,c){n.done=n.done||!s;let l=[],u=[];for(let e of this._tracks.values())if(e.length>0){if(this._context.schema.showLatestObservation){let t=e.getLatestObservationFeatureForTile(n);t!=null&&l.push(t)}this._context.schema.showTrackLine&&e.overlapsTile(n.subscription.tile)&&u.push(e.getTrackLineFeatureForTile(n))}let d=o.fromOptimizedFeatures(l,this._context.metadata,n.subscription.tile.transform),f=o.fromOptimizedFeatures(u,this._context.trackLineMetadata,n.subscription.tile.transform),p=[];if(this._context.schema.showPreviousObservations){let r=this._chunks.map(()=>[]);for(let e of this._tracks.values())for(let{chunkIndex:t,featureIndex:n}of e.previousObservations())r[t].push(n);p=this._chunks.map((e,i)=>{let o=n.subscription.tile,s;if(this._context.metadata.geometryType===`esriGeometryPolygon`){let t=e.reader.queryFeaturesInBounds(o.bounds);t.setTransformForDisplay(o.transform),s=t}else s=e.getTileReader(o);if(s==null)return null;let c=a.from(s,r[i]);return c.setProcessorAttributes({[t]:2}),(c.geometryType===`esriGeometryPoint`||c.getInTransform()==null)&&c.setTransformForDisplay(n.subscription.tile.transform),c}).filter(e)}c();let m=n.subscription.tile.createArcadeEvaluationOptions(this._context.arcadeContextInfo);this._context.attributeStore.setDataForReader(f,m,this._context.sqlOptions);for(let e of p)this._context.attributeStore.setDataForReader(e,m,this._context.sqlOptions);return this._context.attributeStore.setDataForReader(d,m,this._context.sqlOptions),[new r(n.subscription,f,!1,{}),...p.map(e=>new r(n.subscription,e,!1,{})),new r(n.subscription,d,n.done,{})]}_clear(){this._releaseState(this._chunks,this._tracks,this._handledChunks),this._chunks=[],this._tracks.clear(),this._handledChunks.clear()}_rebuildTracks(e){if(!e.length)return;let t=this._context.metadata.timeInfo?.trackIdField;if(t!=null){for(let r=0;r<e.length;r++){let i=e[r];if(i.lodInfo!=null&&i.lodInfo.level!==this.level||this._handledChunks.has(i.chunkId))continue;this._handledChunks.add(i.chunkId);let a=i.reader.getCursor();for(;a.next();){let e=a.getObjectId();a.setDisplayId(this._context.attributeStore.createDisplayIdForObjectId(e))}let o=e=>{let i=e.getObjectId(),a=e.readAttribute(t);if(a!=null&&i!=null){if(!this._tracks.has(a)){let e=n.getOid(a),t=this._context.attributeStore.createDisplayIdForObjectId(e),r=new n(this._context,a,e,t);this._tracks.set(a,r)}this._tracks.get(a).stageObservation(r,e)}};if(this._context.featureFilter!==null)this._context.featureFilter.forEachMatch(i.reader,this._context.sqlOptions,o);else{let e=i.reader.getCursor();for(;e.next();)o(e)}}for(let t of this._tracks.values()){let n=t.commitObservations(this._context.attributeStore,e,this._context.featureFilter?.timeExtent);for(let e of n)this._context.attributeStore.releaseDisplayIdForObjectId(e);t.updateStatistics(e,i(1,this._context.arcadeContextInfo))}}}_releaseState(e,t,n){for(let t of e)if(n.has(t.chunkId)){let e=t.reader.getCursor();for(;e.next();){let t=e.getObjectId();this._context.attributeStore.releaseDisplayIdForObjectId(t)}}for(let e of t.values())this._releaseTrack(e)}_releaseTrack(e){this._context.attributeStore.releaseDisplayIdForObjectId(e.objectId),e.latestObservationFeature!=null&&this._context.attributeStore.releaseDisplayIdForObjectId(e.latestObservationFeature.objectId)}}export{s as TrackLevelState};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{pt2px as e}from"../../../../../../core/screenUtils.js";import t from"../../../../../../layers/support/OrderByInfo.js";import{createLabelMatcherSchema as
|
|
2
|
+
import{pt2px as e}from"../../../../../../core/screenUtils.js";import{kebabDict as t}from"../../../../../../layers/support/fieldType.js";import n from"../../../../../../layers/support/OrderByInfo.js";import{createLabelMatcherSchema as r}from"./LabelMatcherSchema.js";import{createMatcherSchema as i,createClassBreaksMatcherSchema as a}from"./MatcherSchema.js";import{createStorageSchema as o,createTrackStorageSchema as s}from"./StorageSchema.js";import{createVisualVariableUniforms as c}from"./VisualVariablesSchema.js";const l=e=>e.filter(({role:e})=>e===`highlight`),u=e=>e.find(({role:e})=>e===`visibility`)?.filters[0]??null;async function d(e,t,n){let i=t.renderer,a=c(i);return{symbology:n,labels:await r(e,t,a)}}async function f(e,t,n,r){let i=n.featureReduction;if(i)switch(i.type){case`binning`:return h(i,e,t,n,r);case`cluster`:return _(i,e,t,n,r)}if(n.trackInfo?.enabled)return v(n.trackInfo,e,t,n,r);e.symbolLayerDrawing=n.symbolLayerDrawing?.enabled?n.symbolLayerDrawing:null;let{symbology:a,storage:o}=await g(e,n.renderer,t.filters),s=y(n.orderBy,n.renderer,n.objectIdField),c=await d(e,n,a),l=x(c.symbology);return{storage:o,mesh:{properties:{sortKey:s,timeZone:t.timeZone,returnMeshObjectId:l,displayRefreshVersion:r,currentUser:t.currentUser},strategy:{type:`feature`},factory:c},expressionProperties:{timeExtent:t.timeExtent?.toJSON()}}}function p(e,t){return e.fields.map(e=>({...e.toJSON(),type:m(e,t)}))}function m(e,n){let{onStatisticExpression:r,onStatisticField:i,statisticType:a}=e;switch(a){case`min`:case`max`:case`avg`:case`avg_angle`:case`sum`:case`count`:return`esriFieldTypeDouble`;case`mode`:{if(r){let{returnType:e}=r;return e?e===`string`?`esriFieldTypeString`:`esriFieldTypeDouble`:`esriFieldTypeString`}let e=n.find(e=>e.name===i);return e?t.toJSON(e.type):`esriFieldTypeString`}}}async function h(t,n,i,a,o){let s=p(t,a.fields),d=t.renderer,{symbology:f,storage:m}=await g(n,d,l(i.filters)),h=c(d),_=await r(n,{geometryType:`polygon`,labelingInfoSource:a.labelingInfoSource+`-binning`,labelingInfo:t.labelingInfo,labelsVisible:t.labelsVisible},h),v=x(f),y=t.binType===`geohash`?{type:`geohash`,fixBinLevel:t.fixedBinLevel??3}:{type:`grid`,size:e(t.size),fixedBinLevel:t.fixedBinLevel};return{storage:m,mesh:{properties:{sortKey:null,timeZone:i.timeZone,returnMeshObjectId:v,displayRefreshVersion:o,currentUser:i.currentUser},strategy:{type:`binning`,fields:s,index:y,featureFilter:u(i.filters)},factory:{labels:_,symbology:f}},expressionProperties:{timeExtent:i.timeExtent?.toJSON()}}}async function g(e,t,n){if(t?.type===`class-breaks`){let{symbology:r,matcherFilter:i}=await a(e,t);return{symbology:r,storage:o(t,n,i)}}return{symbology:await i(e,t),storage:o(t,n)}}async function _(t,n,a,s,d){let f=p(t,s.fields),m={type:`cluster`,feature:await i(n,t.effectiveFeatureRenderer),cluster:await i(n,t.effectiveClusterRenderer)},h=c(t.effectiveFeatureRenderer),g={type:`cluster`,feature:await r(n,s,h),cluster:await r(n,{geometryType:`point`,labelingInfoSource:s.labelingInfoSource+`-clusters`,labelingInfo:t.labelingInfo,labelsVisible:t.labelsVisible},h)},_=o(t.effectiveFeatureRenderer,l(a.filters)),v=x(m);return{storage:_,mesh:{properties:{sortKey:null,timeZone:a.timeZone,displayRefreshVersion:d,returnMeshObjectId:v,currentUser:a.currentUser},strategy:{type:`cluster`,fields:f,featureFilter:u(a.filters),clusterRadius:e(t.clusterRadius/2)},factory:{labels:g,symbology:m}},expressionProperties:{timeExtent:a.timeExtent?.toJSON()}}}async function v(e,t,n,a,o){let d=p(e,a.fields),f={type:`track`,previousObservation:await i(t,e.previousObservations.renderer),latestObservation:await i(t,e.latestObservations.renderer),trackLine:await i(t,e.trackLines.renderer)},m={type:`track`,previousObservation:await r(t,{geometryType:a.geometryType,labelingInfoSource:a.labelingInfoSource+`-track-prev`,labelingInfo:e.previousObservations.labelingInfo,labelsVisible:e.previousObservations.labelsVisible},c(e.previousObservations.renderer)),latestObservation:await r(t,{geometryType:a.geometryType,labelingInfoSource:a.labelingInfoSource+`-track-latest`,labelingInfo:e.latestObservations.labelingInfo,labelsVisible:e.latestObservations.labelsVisible},c(e.latestObservations.renderer)),trackLine:await r(t,{geometryType:`polyline`,labelingInfoSource:a.labelingInfoSource+`-track-line`,labelingInfo:e.trackLines.labelingInfo,labelsVisible:e.trackLines.labelsVisible},c(e.trackLines.renderer))},h=s(e,l(n.filters)),g=x(f);return{storage:h,mesh:{properties:{sortKey:null,timeZone:n.timeZone,returnMeshObjectId:g,displayRefreshVersion:o,currentUser:n.currentUser},strategy:{type:`track`,featureFilter:u(n.filters),fields:d,maxDisplayDuration:e.maxDisplayDuration?.toMilliseconds()??0,maxDisplayObservationsPerTrack:e.maxDisplayObservationsPerTrack,showLatestObservation:e.latestObservations.visible,showPreviousObservations:e.previousObservations.visible,showTrackLine:e.trackLines.visible,timeField:e.timeField},factory:{labels:m,symbology:f}},expressionProperties:{timeExtent:n.timeExtent?.toJSON()}}}function y(e,t,r){let i=t!=null&&t.type===`unique-value`&&t.orderByClassesEnabled;if(e==="default"&&!i&&(e=[new n({field:r,order:`descending`})]),e!=="default"&&e?.length){e.length;let t=e[0],n=t.order===`ascending`?`asc`:`desc`;return t.field?{field:t.field,order:n}:t.valueExpression?{expression:t.valueExpression,order:n}:null}return i?{byRenderer:!0,order:`asc`}:null}function b(e){return e.techniqueType===2}function x(e){return!!(e.type===`simple`&&e.meshes.some(b)||e.type===`interval`&&(e.intervals.some(e=>e.meshes.some(b)||e.alternateMeshes.some(b))||e.backgroundFill.some(b))||e.type===`map`&&(e.map.some(e=>e.meshes.some(b)||e.alternateMeshes.some(b))||e.backgroundFill.some(b)))}export{f as createSimpleProcessorSchema,p as getAggregateFields,y as getSortKey};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
|
|
2
|
+
class e{size(){return this.reader.getSize()}get fields(){return this.reader.fields}invalidate(){this.reader.invalidateAggregateIndices()}get usedMemory(){return this.reader.underlyingMemory}getObjectIds(){let e=this.reader.getCursor(),t=[];for(;e.next();)t.push(e.getObjectId());return t}registerOverrides(e){this.reader.registerOverrides(e),this.invalidate()}}export{e as ASourceChunk};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{ASourceChunk as e}from"./ASourceChunk.js";class t extends e{constructor(e,t){super(),this._reader=e,this._tile=t;let n=this._reader.getCursor();n.next();let r=n.getObjectId();this.chunkId=`${this._tile.key.id}.${r}${this.end?`e`:``}`,this.normalizedChunkId=this.chunkId}get reader(){return this._reader}get first(){return!1}get end(){return!1}get queryInfo(){return{type:`snapshot`,chunkId:this.chunkId,size:this.size(),end:this.end}}get lodInfo(){return null}get tile(){return this._tile}getTileReader(e){if(this._tile.key.id!==e.key.id)return null;let t=this.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}export{t as ByReferenceTileSourceChunk};
|
|
2
|
+
import{ASourceChunk as e}from"./ASourceChunk.js";class t extends e{constructor(e,t){super(),this._reader=e,this._tile=t;let n=this._reader.getCursor();n.next();let r=n.getObjectId();this.chunkId=`${this._tile.key.id}.${r}${this.end?`e`:``}`,this.normalizedChunkId=this.chunkId}get reader(){return this._reader}get first(){return!1}get end(){return!1}get queryInfo(){return{type:`snapshot`,chunkId:this.chunkId,size:this.size(),end:this.end}}get lodInfo(){return null}get tile(){return this._tile}getTileReader(e){if(this._tile.key.id!==e.key.id)return null;let t=this.reader.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}export{t as ByReferenceTileSourceChunk};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{ASourceChunk as e}from"./ASourceChunk.js";class t extends e{constructor(e,t,n,r,i=0){super(),this._reader=e,this._queryJSON=t,this._page=n,this._end=r,this.fileIndex=i,this.chunkId=`${this.fileIndex}.${this._page}${this.end?`e`:``}`,this.normalizedChunkId=this.chunkId}get reader(){return this._reader}get first(){return this._page===0}get end(){return this._end}get queryInfo(){return{type:`snapshot`,chunkId:this.chunkId,queryJSON:this._queryJSON,page:this._page,size:this.size(),end:this.end}}get lodInfo(){return null}getTileReader(e){let t=this.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}export{t as FeatureSnapshotSourceChunk};
|
|
2
|
+
import{ASourceChunk as e}from"./ASourceChunk.js";class t extends e{constructor(e,t,n,r,i=0){super(),this._reader=e,this._queryJSON=t,this._page=n,this._end=r,this.fileIndex=i,this.chunkId=`${this.fileIndex}.${this._page}${this.end?`e`:``}`,this.normalizedChunkId=this.chunkId}get reader(){return this._reader}get first(){return this._page===0}get end(){return this._end}get queryInfo(){return{type:`snapshot`,chunkId:this.chunkId,queryJSON:this._queryJSON,page:this._page,size:this.size(),end:this.end}}get lodInfo(){return null}getTileReader(e){let t=this.reader.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}export{t as FeatureSnapshotSourceChunk};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{parseWhereClause as e}from"../../../../../../../core/sql.js";import{ASourceChunk as t}from"./ASourceChunk.js";import{FeatureSetReaderJSON as n}from"../../../support/FeatureSetReaderJSON.js";const r=1e4;class i{static async create(t){let{metadata:n,definitionExpression:r}=t,a=r?await e(r,n.fieldsIndex):null;return new i(n,a,r)}constructor(e,t,n){this.metadata=e,this._clause=t,this._definitionExpression=n}get hash(){return this._definitionExpression}testFeature(e){return this._clause==null||this._clause.testFeature(e)}}class a{constructor(){this.modified=new Map,this.removed=new Set}modify(e){this.modified.set(e.objectId,e),this.removed.has(e.objectId)&&this.removed.delete(e.objectId)}remove(e){this.modified.delete(e),this.removed.add(e)}get isEmpty(){return this.modified.size===0&&this.removed.size===0}applyWhereClause(e){let t=new a;for(let[n,r]of this.modified)e.testFeature(r)?t.modified.set(n,r):t.removed.add(r.objectId);for(let e of this.removed)t.removed.add(e);return t}}class o extends t{constructor(e){super(),this._reader=e,this.chunkId=`override`,this.normalizedChunkId=`override`}static fromFeatures(e,t){let r=n.fromOptimizedFeatures(e,t);return new o(r)}get reader(){return this._reader}get queryInfo(){return{}}get first(){return!1}get end(){return!1}get lodInfo(){return null}getTileReader(e){if(!this._reader.getSize())return null;let t=this.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}class s{constructor(e,t){this.inner=e,this.isWeak=t,this.lastWeak=null}get isStrong(){return!this.isWeak}}class c{constructor(e){this._parameters=e,this._overrides=new Map,this._update=new a,this._lastCleanup=0}update(e){this._parameters=e}hasOverride(e){return this._overrides.has(e)}onChunkInsert(e){if(this._overrides.size){let t=e.reader.getCursor();for(;t.next();){let e=t.getObjectId(),n=this._overrides.get(e);if(n?.lastWeak&&(n.lastWeak=null),n?.isWeak){let e=t.readOptimizedFeatureWorldSpace();e.attributes={...n.inner?.attributes??{},...e.attributes},n.inner=e,this._update.modify(e),this.invalidate()}}}e.registerOverrides(this)}apply(e,t){let{updateWeak:n,removeWeak:r,update:i,remove:a,release:o}=e.commands;this.invalidate();for(let e of n){let t=new s(e,!0),n=this._overrides.get(e.objectId);n?.isStrong?n.lastWeak=t:(this._overrides.set(e.objectId,t),this._update.modify(e))}for(let e of i){let t=new s(e,!1),n=this._overrides.get(e.objectId);t.lastWeak=n?.isWeak?n:n?.lastWeak??null,this._overrides.set(e.objectId,t),this._update.modify(e)}for(let e of r){let t=new s(null,!0),n=this._overrides.get(e);n?.isStrong?n.lastWeak=t:(this._overrides.set(e,t),this._update.remove(e))}for(let e of a){let t=new s(null,!1),n=this._overrides.get(e);t.lastWeak=n?.isWeak?n:n?.lastWeak??null,this._overrides.set(e,t),this._update.remove(e)}if(o.length){let e=new Set;for(let t of o){let n=this._overrides.get(t);n?.lastWeak?(this._overrides.set(t,n.lastWeak),n.lastWeak.inner==null?this._update.remove(t):this._update.modify(n.lastWeak.inner)):n&&!n.isWeak&&(this._overrides.delete(t),e.add(t))}t.forEachUnsafe(t=>{let n=t.getObjectId();e.has(n)&&(this._update.modify(t.readOptimizedFeatureWorldSpace()),e.delete(n))});for(let t of e.values())this._update.remove(t)}}clearWeakOverrides(){for(let[e,t]of this._overrides.entries())t.isWeak&&this._overrides.delete(e);this.invalidate()}cleanup(e){if(this._overrides.size<r)return;let t=performance.now();if(t-this._lastCleanup<1e3)return;this._lastCleanup=t;let n=this._getWeakDeletions();if(!(n.size<r)){for(let t of e){let e=t.reader.withoutOverrides().getCursor();for(;e.next();){let t=e.getObjectId();n.delete(t)}}for(let e of n)this._overrides.delete(e);n.size&&this.invalidate()}}takeOverrideUpdate(){let e=this._update;return e.isEmpty?null:(this._update=new a,e.applyWhereClause(this._parameters))}asChunk(){let e=this._parameters;if(this._lastOverrideParametersHash!==e.hash&&(this._lastOverrideParametersHash=e.hash,this._chunk=null),!this._chunk){let t=[];for(let n of this._overrides.values())n.inner!=null&&e.testFeature(n.inner)&&t.push(n.inner);this._chunk=o.fromFeatures(t,e.metadata)}return this._chunk}invalidate(){this._chunk=null}putWeakObjectIdsFromGlobalIds(e,t,n){for(let[r,i]of this._overrides.entries())if(i.isWeak&&i.inner!=null){let a=i.inner.attributes[n];a&&t.has(a)&&!e.has(a)&&e.set(a,r)}else if(i.lastWeak!=null&&i.lastWeak.inner!=null){let a=i.lastWeak.inner.attributes[n];a&&t.has(a)&&!e.has(a)&&e.set(a,r)}}_getWeakDeletions(){let e=new Set;for(let[t,n]of this._overrides.entries())n.isWeak&&n.inner==null&&e.add(t);return e}}export{o as OverrideChunk,i as OverrideParameters,c as OverrideState,a as OverrideUpdate};
|
|
2
|
+
import{parseWhereClause as e}from"../../../../../../../core/sql.js";import{ASourceChunk as t}from"./ASourceChunk.js";import{FeatureSetReaderJSON as n}from"../../../support/FeatureSetReaderJSON.js";const r=1e4;class i{static async create(t){let{metadata:n,definitionExpression:r}=t,a=r?await e(r,n.fieldsIndex):null;return new i(n,a,r)}constructor(e,t,n){this.metadata=e,this._clause=t,this._definitionExpression=n}get hash(){return this._definitionExpression}testFeature(e){return this._clause==null||this._clause.testFeature(e)}}class a{constructor(){this.modified=new Map,this.removed=new Set}modify(e){this.modified.set(e.objectId,e),this.removed.has(e.objectId)&&this.removed.delete(e.objectId)}remove(e){this.modified.delete(e),this.removed.add(e)}get isEmpty(){return this.modified.size===0&&this.removed.size===0}applyWhereClause(e){let t=new a;for(let[n,r]of this.modified)e.testFeature(r)?t.modified.set(n,r):t.removed.add(r.objectId);for(let e of this.removed)t.removed.add(e);return t}}class o extends t{constructor(e){super(),this._reader=e,this.chunkId=`override`,this.normalizedChunkId=`override`}static fromFeatures(e,t){let r=n.fromOptimizedFeatures(e,t);return new o(r)}get reader(){return this._reader}get queryInfo(){return{}}get first(){return!1}get end(){return!1}get lodInfo(){return null}getTileReader(e){if(!this._reader.getSize())return null;let t=this.reader.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}class s{constructor(e,t){this.inner=e,this.isWeak=t,this.lastWeak=null}get isStrong(){return!this.isWeak}}class c{constructor(e){this._parameters=e,this._overrides=new Map,this._update=new a,this._lastCleanup=0}update(e){this._parameters=e}hasOverride(e){return this._overrides.has(e)}onChunkInsert(e){if(this._overrides.size){let t=e.reader.getCursor();for(;t.next();){let e=t.getObjectId(),n=this._overrides.get(e);if(n?.lastWeak&&(n.lastWeak=null),n?.isWeak){let e=t.readOptimizedFeatureWorldSpace();e.attributes={...n.inner?.attributes??{},...e.attributes},n.inner=e,this._update.modify(e),this.invalidate()}}}e.registerOverrides(this)}apply(e,t){let{updateWeak:n,removeWeak:r,update:i,remove:a,release:o}=e.commands;this.invalidate();for(let e of n){let t=new s(e,!0),n=this._overrides.get(e.objectId);n?.isStrong?n.lastWeak=t:(this._overrides.set(e.objectId,t),this._update.modify(e))}for(let e of i){let t=new s(e,!1),n=this._overrides.get(e.objectId);t.lastWeak=n?.isWeak?n:n?.lastWeak??null,this._overrides.set(e.objectId,t),this._update.modify(e)}for(let e of r){let t=new s(null,!0),n=this._overrides.get(e);n?.isStrong?n.lastWeak=t:(this._overrides.set(e,t),this._update.remove(e))}for(let e of a){let t=new s(null,!1),n=this._overrides.get(e);t.lastWeak=n?.isWeak?n:n?.lastWeak??null,this._overrides.set(e,t),this._update.remove(e)}if(o.length){let e=new Set;for(let t of o){let n=this._overrides.get(t);n?.lastWeak?(this._overrides.set(t,n.lastWeak),n.lastWeak.inner==null?this._update.remove(t):this._update.modify(n.lastWeak.inner)):n&&!n.isWeak&&(this._overrides.delete(t),e.add(t))}t.forEachUnsafe(t=>{let n=t.getObjectId();e.has(n)&&(this._update.modify(t.readOptimizedFeatureWorldSpace()),e.delete(n))});for(let t of e.values())this._update.remove(t)}}clearWeakOverrides(){for(let[e,t]of this._overrides.entries())t.isWeak&&this._overrides.delete(e);this.invalidate()}cleanup(e){if(this._overrides.size<r)return;let t=performance.now();if(t-this._lastCleanup<1e3)return;this._lastCleanup=t;let n=this._getWeakDeletions();if(!(n.size<r)){for(let t of e){let e=t.reader.withoutOverrides().getCursor();for(;e.next();){let t=e.getObjectId();n.delete(t)}}for(let e of n)this._overrides.delete(e);n.size&&this.invalidate()}}takeOverrideUpdate(){let e=this._update;return e.isEmpty?null:(this._update=new a,e.applyWhereClause(this._parameters))}asChunk(){let e=this._parameters;if(this._lastOverrideParametersHash!==e.hash&&(this._lastOverrideParametersHash=e.hash,this._chunk=null),!this._chunk){let t=[];for(let n of this._overrides.values())n.inner!=null&&e.testFeature(n.inner)&&t.push(n.inner);this._chunk=o.fromFeatures(t,e.metadata)}return this._chunk}invalidate(){this._chunk=null}putWeakObjectIdsFromGlobalIds(e,t,n){for(let[r,i]of this._overrides.entries())if(i.isWeak&&i.inner!=null){let a=i.inner.attributes[n];a&&t.has(a)&&!e.has(a)&&e.set(a,r)}else if(i.lastWeak!=null&&i.lastWeak.inner!=null){let a=i.lastWeak.inner.attributes[n];a&&t.has(a)&&!e.has(a)&&e.set(a,r)}}_getWeakDeletions(){let e=new Set;for(let[t,n]of this._overrides.entries())n.isWeak&&n.inner==null&&e.add(t);return e}}export{o as OverrideChunk,i as OverrideParameters,c as OverrideState,a as OverrideUpdate};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{ASourceChunk as e}from"./ASourceChunk.js";import{FeatureSetReaderJSON as t}from"../../../support/FeatureSetReaderJSON.js";class n extends e{constructor(e,t,n,r,i){super(),this._metadata=e,this._reader=t,this._page=n,this._end=r,this._fileId=i,this.chunkId=`${this._fileId}.${this._page}${this.end?`e`:``}`,this.normalizedChunkId=this.chunkId}get reader(){return this._reader??t.empty(this._metadata)}get first(){return this._page===0}get end(){return this._end}get queryInfo(){return{type:`snapshot`,chunkId:this.chunkId,page:this._page,size:this.size(),end:this.end}}get lodInfo(){return null}async updateFields(e,t,n){if(this._fileId!=null)return this._reader?.updateFields(e,this._fileId,t,n)}getTileReader(e){let t=this.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}export{n as ParquetSnapshotSourceChunk};
|
|
2
|
+
import{ASourceChunk as e}from"./ASourceChunk.js";import{FeatureSetReaderJSON as t}from"../../../support/FeatureSetReaderJSON.js";class n extends e{constructor(e,t,n,r,i){super(),this._metadata=e,this._reader=t,this._page=n,this._end=r,this._fileId=i,this.chunkId=`${this._fileId}.${this._page}${this.end?`e`:``}`,this.normalizedChunkId=this.chunkId}get reader(){return this._reader??t.empty(this._metadata)}get first(){return this._page===0}get end(){return this._end}get queryInfo(){return{type:`snapshot`,chunkId:this.chunkId,page:this._page,size:this.size(),end:this.end}}get lodInfo(){return null}async updateFields(e,t,n){if(this._fileId!=null)return this._reader?.updateFields(e,this._fileId,t,n)}getTileReader(e){let t=this.reader.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}export{n as ParquetSnapshotSourceChunk};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{EventEmitter as e}from"../../../../../../../core/Evented.js";import has from"../../../../../../../core/has.js";import{create as t}from"../../../../../../../geometry/support/aaBoundingBox.js";import{FeatureStoreQueryAdapter as n}from"../../../FeatureStoreQueryAdapter.js";import{OverrideParameters as r,OverrideState as i}from"./Overrides.js";class a{constructor(){this._chunks=new Map,this._chunksToRemove=[],this.events=new e,this.featureAdapter=new n}destroy(){this.clear()}clear(){for(let e of this._chunks.values())this._chunksToRemove.push(e);this._chunks.clear(),this._overrides?.clearWeakOverrides()}get usedMemory(){let e=0;for(let t of this._chunks.values())e+=t.usedMemory;return e}async update(e){if(this._overrides){let t=await r.create(e);this._overrides.update(t)}this._postQueryFilter=e.postQueryFilter;for(let
|
|
2
|
+
import{EventEmitter as e}from"../../../../../../../core/Evented.js";import has from"../../../../../../../core/has.js";import{create as t}from"../../../../../../../geometry/support/aaBoundingBox.js";import{FeatureStoreQueryAdapter as n}from"../../../FeatureStoreQueryAdapter.js";import{OverrideParameters as r,OverrideState as i}from"./Overrides.js";class a{constructor(){this._chunks=new Map,this._chunksToRemove=[],this.events=new e,this.featureAdapter=new n}destroy(){this.clear()}clear(){for(let e of this._chunks.values())this._chunksToRemove.push(e);this._chunks.clear(),this._overrides?.clearWeakOverrides()}get usedMemory(){let e=0;for(let t of this._chunks.values())e+=t.usedMemory;return e}async update(e){if(this._overrides){let t=await r.create(e);this._overrides.update(t)}let t=this._postQueryFilter?.hash!==e.postQueryFilter?.hash;this._postQueryFilter=e.postQueryFilter;for(let e of this.insertedChunks())e.reader.applyPostQueryFilter(this._postQueryFilter),t&&e.invalidate();this._schema=e}*chunks(){this._overrides&&(yield this._overrides.asChunk()),yield*this._chunks.values()}insertedChunks(){return this._chunks.values()}insert(e){has(`esri-2d-update-debug`)&&console.debug(`Chunk[${e.chunkId}] SourceChunkStore.insert`),this._overrides?.onChunkInsert(e),this._chunks.set(e.chunkId,e),this._postQueryFilter&&(e.reader.applyPostQueryFilter(this._postQueryFilter),e.invalidate()),this.events.emit(`changed`)}remove(e){has(`esri-2d-update-debug`)&&console.debug(`Chunk[${e.chunkId}] SourceChunkStore.remove`),this._chunks.delete(e.chunkId),this._chunksToRemove.push(e)}removeById(e){has(`esri-2d-update-debug`)&&console.debug(`Chunk[${e}] SourceChunkStore.remove`);let t=this._chunks.get(e);this._chunks.delete(e),t&&this._chunksToRemove.push(t)}cleanup(){let e=this._chunksToRemove;return this._chunksToRemove=[],this._overrides?.cleanup(this._chunks.values()),e}async applyOverride(e){if(this._overrides==null){let e=await r.create(this._schema);this._overrides=new i(e);for(let e of this._chunks.values())this._overrides.onChunkInsert(e)}this._overrides.apply(e,this),this.events.emit(`changed`);for(let e of this._chunks.values())e.invalidate()}takeOverrideUpdate(){return this._overrides?.takeOverrideUpdate()}refresh(){this.events.emit(`refresh`)}forEach(e){let t=new Set;for(let n of this.chunks()){let r=n.reader.getCursor();for(;r.next();){let n=r.getObjectId();t.has(n)||(e(r.copy()),t.add(n))}}}forEachUnsafe(e){let t=new Set;for(let n of this.chunks()){let r=n.reader.getCursor();for(;r.next();){let n=r.getObjectId();t.has(n)||(e(r),t.add(n))}}}mapObjectIdsFromGlobalIds(e,t){let n=new Map,r=new Set(e);return this._overrides?.putWeakObjectIdsFromGlobalIds(n,r,t),this._forEachUnsafeIgnoreOverrides(e=>{let i=e.readAttribute(t);if(i&&r.has(i)&&!n.has(i)){let t=e.getObjectId();n.set(i,t)}}),n}forEachInBounds(e,t){let n=new Set;for(let r of this.chunks()){let i=r.reader.queryFeaturesInBounds(e);for(;i.next();){let e=i.getObjectId();n.has(e)||(t(i.copy()),n.add(e))}}}forEachBounds(e,n){let r=t();for(let t of e)t.getBounds(r)&&n(r)}_forEachUnsafeIgnoreOverrides(e){let t=new Set;for(let n of this._chunks.values()){let r=n.reader.withoutOverrides().getCursor();for(;r.next();){let n=r.getObjectId();t.has(n)||(e(r),t.add(n))}}}}export{a as FeatureSourceChunkStore};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{ASourceChunk as e}from"./ASourceChunk.js";class t extends e{constructor(e){super(),this._reader=e,this.chunkId=`stream-chunk`,this.normalizedChunkId=`stream-chunk`}get reader(){return this._reader}get first(){return!0}get end(){return!0}get queryInfo(){return{type:`stream`,chunkId:this.chunkId,size:this.size(),end:this.end}}get lodInfo(){return null}getTileReader(e){let t=this.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}export{t as StreamSourceChunk};
|
|
2
|
+
import{ASourceChunk as e}from"./ASourceChunk.js";class t extends e{constructor(e){super(),this._reader=e,this.chunkId=`stream-chunk`,this.normalizedChunkId=`stream-chunk`}get reader(){return this._reader}get first(){return!0}get end(){return!0}get queryInfo(){return{type:`stream`,chunkId:this.chunkId,size:this.size(),end:this.end}}get lodInfo(){return null}getTileReader(e){let t=this.reader.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}export{t as StreamSourceChunk};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../../../core/Error.js";import has from"../../../../../core/has.js";import t from"../../../../../core/Logger.js";import{diff as n}from"../../../../../core/accessorSupport/diffUtils.js";import{collectExpressionDependencies as r}from"../../../../../support/ArcadeExpression.js";import{attributeStoreInitialSize as i,maxHighlightGroups as a,filterFlag0 as o,effectFlag0 as s}from"../../../engine/webgl/definitions.js";import{getDisplayIdTexel as c}from"../../../engine/webgl/DisplayId.js";import{nanMagicNumber as l}from"../../../engine/webgl/shaderGraph/techniques/shaders/constants.js";import{createDebugLogger as u,DEBUG_ATTR_UPDATES as d}from"../../../engine/webgl/util/debug.js";import{DisplayIdGenerator as f}from"./DisplayIdGenerator.js";import p from"./FeatureFilterEvaluator.js";import{PixelType as m}from"../../../../webgl/enums.js";function h(e,t){if(!e||!t)return e;switch(t){case`radius`:case`distance`:return 2*e;case`diameter`:case`width`:return e;case`area`:return Math.sqrt(e)}return e}const g=()=>t.getLogger(`esri.views.layers.2d.features.support.AttributeStore`),_=t=>{switch(t){case m.UNSIGNED_BYTE:return Uint8Array;case m.UNSIGNED_SHORT_4_4_4_4:return Uint16Array;case m.FLOAT:return Float32Array;default:g().error(new e(`webgl-utils`,`Unable to handle type ${t}`));return}},v=u(d,g()),y={sharedArrayBuffer:has(`esri-shared-array-buffer`),atomics:has(`esri-atomics`)};class b{constructor(e,t,n){this.size=0,this.texelSize=4,this.dirtyStart=0,this.dirtyEnd=0;let{pixelType:r,layout:i,textureOnly:a}=t;this.textureOnly=a||!1,this.pixelType=r,this.layout=i,this._resetRange(),this.size=e,this.isLocal=n,a||(this.data=this._initData(r,e))}get usedMemory(){return this.data?.byteLength??0}get buffer(){return this.data?.buffer}unsetComponentAllTexels(e,t){let n=this.data;for(let r=0;r<this.size*this.size;r++)n[r*this.texelSize+e]&=~t;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponentAllTexels(e,t){let n=this.data;for(let r=0;r<this.size*this.size;r++)n[r*this.texelSize+e]|=255&t;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponent(e,t,n){let r=this.data;for(let i of n)r[i*this.texelSize+e]|=t,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}setComponentTexel(e,t,n){let r=this.data;r[n*this.texelSize+e]|=t,this.dirtyStart=Math.min(this.dirtyStart,n),this.dirtyEnd=Math.max(this.dirtyEnd,n)}unsetComponentTexel(e,t,n){let r=this.data;r[n*this.texelSize+e]&=~t,this.dirtyStart=Math.min(this.dirtyStart,n),this.dirtyEnd=Math.max(this.dirtyEnd,n)}getData(e,t){let n=c(e);return this.data[n*this.texelSize+t]}setData(e,t,n){let r=c(e),i=1<<t;(this.layout&i)===0?g().error(`mapview-attributes-store`,`Tried to set a value for a texel's readonly component`):this.data!=null&&(this.data[r*this.texelSize+t]=n,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r))}expand(e){if(this.size=e,!this.textureOnly){let t=this._initData(this.pixelType,e),n=this.data;t.set(n),this.data=t}}toMessage(){let e=this.dirtyStart,t=this.dirtyEnd,n=this.texelSize;if(e>t)return null;this._resetRange();let r=!this.isLocal,i=this.pixelType,a=this.layout,o=this.data;return{start:e,end:t,data:r&&o.slice(e*n,(t+1)*n)||null,pixelType:i,layout:a}}_initData(e,t){let n=ArrayBuffer,r=_(e),i=r.BYTES_PER_ELEMENT,a=new r(new n(t*t*4*i));for(let e=0;e<a.length;e+=4)a[e+1]=255;return a}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}}class x{constructor(e){this._client=e,this._filters=[],this._blocks=[],this._attributeComputeInfo=null,this._abortController=new AbortController,this._size=i,this._arcadeDependencies=new Set,this._initialized=!1,this.version=0,this._idGenerator=new f,this._epoch=1}destroy(){this._abortController.abort()}_initialize(){if(this._blockDescriptors!=null)return;let e=m.FLOAT;v(`Creating AttributeStore ${y.sharedArrayBuffer?`with`:`without`} shared memory`),this._blockDescriptors=[{pixelType:m.UNSIGNED_BYTE,layout:1},{pixelType:m.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:m.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:e,layout:15},{pixelType:e,layout:15},{pixelType:e,layout:15},{pixelType:e,layout:15},{pixelType:m.FLOAT,layout:15}],this._blocks=this._blockDescriptors.map(()=>null)}get usedMemory(){let e=0;for(let t of this._blocks)t&&(e+=t.usedMemory);return e+=this._idGenerator.usedMemory,e}createDisplayIdForObjectId(e){return this._idGenerator.createIdForObjectId(e)}releaseDisplayIdForObjectId(e){return this._idGenerator.releaseIdForObjectId(e)}getDisplayIdForObjectId(e){return this._idGenerator.getDisplayIdForObjectId(e)}incrementDisplayIdGeneration(){this._idGenerator.incrementGeneration()}hasArcadeDependency(e){return this._arcadeDependencies.has(e)}releaseAllIds(){this._idGenerator.releaseAll()}async update(e,t,r,i=0){let a=n(this._schema,e);if(this.version=i,a&&(has(`esri-2d-update-debug`)&&console.debug(`Version[${i}] AttributeStore.update`,{changed:a}),this._schema=e,this._attributeComputeInfo=null,this._matcherFilter=void 0,this._initialize(),e!=null)){if(r&&(this._filters=await Promise.all(e.filters.map(async({bitIndex:e,filters:t})=>({bitIndex:e,evaluators:await Promise.all(t.map(e=>p.create({geometryType:r.geometryType,hasM:!1,hasZ:!1,timeInfo:r.timeInfo,fieldsIndex:r.fieldsIndex,spatialReference:r.outSpatialReference,filterJSON:e})))})))),e.type===`simple`&&e.matcherFilter&&(this._matcherFilter=await t.createComputedField(e.matcherFilter),this._updateReferences(this._matcherFilter)),e.type===`multi`){this._attributeComputeInfo={type:`multi`,keyField:e.keyField,map:new Map};for(let n in e.bindings){let r=e.bindings[n];await Promise.all(r.map(async e=>{let r=await this._bind(t,e,parseInt(n,10));this._updateReferences(r)}))}}else this._attributeComputeInfo={type:`feature`,map:new Map},await Promise.all(e.bindings.map(async e=>{let n=await this._bind(t,e);this._updateReferences(n)}))}}setData(e,t,n,r){let i=c(e);this._ensureSizeForTexel(i),this._getBlock(t).setData(e,n,r)}getData(e,t,n){return this._getBlock(t).getData(e,n)}unsetAttributeData(e){let t=c(e);this._getBlock(0).setData(t,0,0)}referencesScale(){if(this._matcherFilter?.hasArcadeDependency(`scale`))return!0;let e=this._attributeComputeInfo;if(!e)return!1;if(e.type===`multi`){for(let t of e.map.values())for(let{field:e}of t.values())if(e?.hasArcadeDependency(`scale`))return!0}else for(let{field:t}of e.map.values())if(t?.hasArcadeDependency(`scale`))return!0;return!1}setAttributeData(e,t,n,r){let i=c(e);this._ensureSizeForTexel(i);let a=this.getFilterFlags(t,r);this._passesMatcherFilter(t,n)||(a&=~o),this._getBlock(0).setData(i,0,a);let s=this._attributeComputeInfo,u=null;s&&(u=s.type===`multi`?s.map.get(t.readAttribute(s.keyField)):s.map,u?.size&&u.forEach((e,r)=>{let a=r*1%4,o=Math.floor(r*1/4),s=this._getBlock(o+3),c=e.field?.read(t,n);e.valueRepresentation&&(c=h(c,e.valueRepresentation)),(c===null||isNaN(c)||c===1/0||c===-1/0)&&(c=l),s.setData(i,a,c)}))}get epoch(){return this._epoch}sendUpdates(){let e=this._blocks.map(e=>e==null?null:e.toMessage()),t=this._getInitArgs();this._client.update({initArgs:t,blockData:e,version:this.version,sendUpdateEpoch:this._epoch}),this._epoch+=1}_ensureSizeForTexel(e){for(;e>=this._size*this._size;)if(this._expand())return}async _bind(e,t,n){let r=await e.createComputedField(t),{valueRepresentation:i}=t,a=this._attributeComputeInfo;if(a.type===`multi`){let e=a.map.get(n)??new Map;e.set(t.binding,{field:r,valueRepresentation:i}),a.map.set(n,e)}else a.map.set(t.binding,{field:r,valueRepresentation:i});return r}_getInitArgs(){return this._initialized?null:(this._initialized=!0,this._getBlock(1),this._getBlock(2),this._getBlock(7),{blockSize:this._size,blockDescriptors:this._blocks.map(e=>e==null?null:{textureOnly:e.textureOnly,buffer:e.buffer,pixelType:e.pixelType})})}_getBlock(e){let t=this._blocks[e];if(t!=null)return t;v(`Initializing AttributeBlock at index ${e}`);let n=new b(this._size,this._blockDescriptors[e],this._client.isLocal);return this._blocks[e]=n,this._initialized=!1,n}_expand(){if(this._size<this._schema.capabilities.maxTextureSize){let e=this._size<<=1;v(`Expanding block size to`,e,this._blocks);for(let t of this._blocks)t?.expand(e);return this._initialized=!1,this._size=e,0}return g().error(new e(`mapview-limitations`,`Maximum number of onscreen features exceeded.`)),-1}_updateReferences(e){r(this._arcadeDependencies,e)}_passesMatcherFilter(e,t){if(this._matcherFilter===void 0)return!0;if(this._matcherFilter===null)return!1;let n=this._matcherFilter.read(e,t);return n==null||isNaN(n)||n===1/0||n===-1/0?!1:n>=-(2**53-1)&&n<=2**53-1}isVisible(e){return!!(this._getBlock(0).getData(e,0)&1<<a)}getFilterFlags(e,t){let n=o|s;for(let{bitIndex:r,evaluators:i}of this._filters){let a=1<<r;i.some(n=>n.check(e,t))?n|=a:n&=~a}return n}}export{x as AttributeStore,h as getVisualVariableSizeValueRepresentationRatio};
|
|
2
|
+
import e from"../../../../../core/Error.js";import has from"../../../../../core/has.js";import t from"../../../../../core/Logger.js";import{notDeepEqual as n}from"../../../../../core/object.js";import{collectExpressionDependencies as r}from"../../../../../support/ArcadeExpression.js";import{attributeStoreInitialSize as i,filterFlag0 as a,maxHighlightGroups as o,effectFlag0 as s}from"../../../engine/webgl/definitions.js";import{getDisplayIdTexel as c}from"../../../engine/webgl/DisplayId.js";import{nanMagicNumber as l}from"../../../engine/webgl/shaderGraph/techniques/shaders/constants.js";import{createDebugLogger as u,DEBUG_ATTR_UPDATES as d}from"../../../engine/webgl/util/debug.js";import{DisplayIdGenerator as f}from"./DisplayIdGenerator.js";import p from"./FeatureFilterEvaluator.js";import{PixelType as m}from"../../../../webgl/enums.js";function h(e,t){if(!e||!t)return e;switch(t){case`radius`:case`distance`:return 2*e;case`diameter`:case`width`:return e;case`area`:return Math.sqrt(e)}return e}const g=()=>t.getLogger(`esri.views.layers.2d.features.support.AttributeStore`),_=t=>{switch(t){case m.UNSIGNED_BYTE:return Uint8Array;case m.UNSIGNED_SHORT_4_4_4_4:return Uint16Array;case m.FLOAT:return Float32Array;default:g().error(new e(`webgl-utils`,`Unable to handle type ${t}`));return}},v=u(d,g()),y={sharedArrayBuffer:has(`esri-shared-array-buffer`),atomics:has(`esri-atomics`)};class b{constructor(e,t,n){this.size=0,this.texelSize=4,this.dirtyStart=0,this.dirtyEnd=0;let{pixelType:r,layout:i,textureOnly:a}=t;this.textureOnly=a||!1,this.pixelType=r,this.layout=i,this._resetRange(),this.size=e,this.isLocal=n,a||(this.data=this._initData(r,e))}get usedMemory(){return this.data?.byteLength??0}get buffer(){return this.data?.buffer}unsetComponentAllTexels(e,t){let n=this.data;for(let r=0;r<this.size*this.size;r++)n[r*this.texelSize+e]&=~t;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponentAllTexels(e,t){let n=this.data;for(let r=0;r<this.size*this.size;r++)n[r*this.texelSize+e]|=255&t;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponent(e,t,n){let r=this.data;for(let i of n)r[i*this.texelSize+e]|=t,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}setComponentTexel(e,t,n){let r=this.data;r[n*this.texelSize+e]|=t,this.dirtyStart=Math.min(this.dirtyStart,n),this.dirtyEnd=Math.max(this.dirtyEnd,n)}unsetComponentTexel(e,t,n){let r=this.data;r[n*this.texelSize+e]&=~t,this.dirtyStart=Math.min(this.dirtyStart,n),this.dirtyEnd=Math.max(this.dirtyEnd,n)}getData(e,t){let n=c(e);return this.data[n*this.texelSize+t]}setData(e,t,n){let r=c(e),i=1<<t;(this.layout&i)===0?g().error(`mapview-attributes-store`,`Tried to set a value for a texel's readonly component`):this.data!=null&&(this.data[r*this.texelSize+t]=n,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r))}expand(e){if(this.size=e,!this.textureOnly){let t=this._initData(this.pixelType,e),n=this.data;t.set(n),this.data=t}}toMessage(){let e=this.dirtyStart,t=this.dirtyEnd,n=this.texelSize;if(e>t)return null;this._resetRange();let r=!this.isLocal,i=this.pixelType,a=this.layout,o=this.data;return{start:e,end:t,data:r&&o.slice(e*n,(t+1)*n)||null,pixelType:i,layout:a}}_initData(e,t){let n=ArrayBuffer,r=_(e),i=r.BYTES_PER_ELEMENT,a=new r(new n(t*t*4*i));for(let e=0;e<a.length;e+=4)a[e+1]=255;return a}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}}class x{constructor(e){this._client=e,this.version=0,this._filters=[],this._blocks=[],this._attributeComputeInfo=null,this._abortController=new AbortController,this._size=i,this._rendererDependencies=new Set,this._initialized=!1,this._pendingAttributeUpdate={filterMask:0,matcherChanged:!1,rendererChanged:!1},this._epoch=1,this._idGenerator=new f}destroy(){this._abortController.abort()}_initialize(){if(this._blockDescriptors!=null)return;let e=m.FLOAT;v(`Creating AttributeStore ${y.sharedArrayBuffer?`with`:`without`} shared memory`),this._blockDescriptors=[{pixelType:m.UNSIGNED_BYTE,layout:1},{pixelType:m.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:m.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:e,layout:15},{pixelType:e,layout:15},{pixelType:e,layout:15},{pixelType:e,layout:15},{pixelType:m.FLOAT,layout:15}],this._blocks=this._blockDescriptors.map(()=>null)}get usedMemory(){let e=0;for(let t of this._blocks)t&&(e+=t.usedMemory);return e+=this._idGenerator.usedMemory,e}createDisplayIdForObjectId(e){return this._idGenerator.createIdForObjectId(e)}releaseDisplayIdForObjectId(e){return this._idGenerator.releaseIdForObjectId(e)}getDisplayIdForObjectId(e){return this._idGenerator.getDisplayIdForObjectId(e)}incrementDisplayIdGeneration(){this._idGenerator.incrementGeneration()}hasArcadeDependency(e){return!!this._matcherFilter?.hasArcadeDependency(e)||this._rendererDependencies.has(e)}releaseAllIds(){this._idGenerator.releaseAll()}async update(e,t,r,i=0,a){let o=this._schema;this._schema=e,this.version=i,this._initialize(),has(`esri-2d-update-debug`)&&console.debug(`Version[${i}] AttributeStore.update`,{changed:n(o,e)});let[s,c,l]=await Promise.all([this._updateFilters(o,r,a),this._updateMatcherFilter(o,t,a),this._updateRendererAttributes(o,t,a)]);this._pendingAttributeUpdate.filterMask|=s,this._pendingAttributeUpdate.matcherChanged||=c,this._pendingAttributeUpdate.rendererChanged||=l}applyUpdate(e,t,n){let r=this._pendingAttributeUpdate,i=this._lastEvaluationScale!==t.$view.scale,o=r.matcherChanged||i&&!!this._matcherFilter?.hasArcadeDependency(`scale`),s=r.rendererChanged||i&&this._rendererDependencies.has(`scale`),c=r.filterMask|(o?a:0);if(!c&&!s)return;let l=!1;for(let r of e)l||=r.getSize()>0,c&&this._setFilterData(r,n,c),c&a&&this._setMatcherFilterVisibility(r,t),s&&this._setRendererAttributeData(r,t);l&&(this._pendingAttributeUpdate={filterMask:0,matcherChanged:!1,rendererChanged:!1},this._lastEvaluationScale=t.$view.scale)}setData(e,t,n,r){let i=c(e);this._ensureSizeForTexel(i),this._getBlock(t).setData(e,n,r)}setDataForReader(e,t,n){this._setFilterData(e,n),this._setMatcherFilterVisibility(e,t),this._setRendererAttributeData(e,t)}get epoch(){return this._epoch}sendUpdates(){let e=this._blocks.map(e=>e==null?null:e.toMessage()),t=this._getInitArgs();this._client.update({initArgs:t,blockData:e,version:this.version,sendUpdateEpoch:this._epoch}),this._epoch+=1}async _updateFilters(e,t,r){if(!t)return 0;let i=new Map;for(let t of e?.filters??[])i.set(t.bitIndex,t);let a=new Map;for(let e of this._schema.filters)a.set(e.bitIndex,e);let s=0;for(let e=0;e<o+2;e++){let o=i.get(e),c=a.get(e),l=this._filters.find(this._matchesFilterBitIndex.bind(this,e));if(!c)o&&(this._filters=this._filters.filter(this._hasDifferentFilterBitIndex.bind(this,e)),s|=1<<e);else if(!l||n(o?.filters,c.filters)){let n=await Promise.all(c.filters.map(this._getFilterEvaluator.bind(this,o,l,t)));l?l.evaluators=n:this._filters.push({bitIndex:e,evaluators:n}),s|=1<<e}else r.currentUserChanged&&(s|=1<<e)}return s}async _updateMatcherFilter(e,t,r){let i=this._schema,a=e?.type===`simple`?e.matcherFilter:void 0,o=i.type===`simple`?i.matcherFilter:void 0;return n(a,o)?(this._matcherFilter=o==null?void 0:await t.createComputedField(o),!0):!(o==null||!r.timeZoneChanged&&(!this._matcherFilter||!r.dependencies.some(this._matcherFilter.hasArcadeDependency,this._matcherFilter)))}async _updateRendererAttributes(e,t,r){let i=this._schema,a=!e||e.type!==i.type,o=n(e?.bindings,i.bindings),s=e?.type===`multi`&&i.type===`multi`&&e.keyField!==i.keyField;return a||o||s?(await this._compileRendererAttributes(i,t),!0):!(!r.timeZoneChanged&&!r.dependencies.some(this._rendererDependencies.has,this._rendererDependencies))}_matchesFilterBitIndex(e,t){return t.bitIndex===e}_hasDifferentFilterBitIndex(e,t){return t.bitIndex!==e}_getFilterEvaluator(e,t,r,i){if(e&&t)for(let[r,a]of e.filters.entries()){if(n(a,i))continue;let e=t.evaluators[r];if(e)return Promise.resolve(e);break}return p.create({geometryType:r.geometryType,hasM:!1,hasZ:!1,timeInfo:r.timeInfo,fieldsIndex:r.fieldsIndex,spatialReference:r.outSpatialReference,filterJSON:i})}async _compileRendererAttributes(e,t){if(this._rendererDependencies.clear(),e.type===`multi`){this._attributeComputeInfo={type:`multi`,keyField:e.keyField,map:new Map};for(let n in e.bindings)await Promise.all(e.bindings[n].map(this._bind.bind(this,t,parseInt(n,10))))}else this._attributeComputeInfo={type:`feature`,map:new Map},await Promise.all(e.bindings.map(this._bind.bind(this,t,void 0)))}_setFilterData(e,t,n=255){let r=(a|s)&n;for(let{bitIndex:e}of this._filters)r&=~(1<<e);let i=e.getCursor();for(;i.next();){let e=i.getDisplayId();this._ensureSizeForTexel(c(e));let t=this._getBlock(0);t.setData(e,0,t.getData(e,0)&~n|r)}let o=this._getBlock(0);for(let{bitIndex:r,evaluators:i}of this._filters){let a=1<<r;if(n&a)for(let n of i)n.forEachMatch(e,t,this._setFilterFlag.bind(this,o,a))}}_setFilterFlag(e,t,n){let r=c(n.getDisplayId());e.setComponentTexel(0,t,r)}_setMatcherFilterVisibility(e,t){if(this._matcherFilter===void 0)return;let n=e.getCursor(),r=this._getBlock(0);for(;n.next();)this._passesMatcherFilter(n,t)||r.unsetComponentTexel(0,a,c(n.getDisplayId()))}_setRendererAttributeData(e,t){let n=this._attributeComputeInfo;if(!n)return;let r=e.getCursor();for(;r.next();){let e=n.type===`multi`?n.map.get(r.readAttribute(n.keyField)):n.map;if(!e?.size)continue;let i=c(r.getDisplayId());for(let[n,a]of e){let e=n*1%4,o=Math.floor(n*1/4),s=this._getBlock(o+3),c=a.field?.read(r,t);a.valueRepresentation&&(c=h(c,a.valueRepresentation)),(c===null||isNaN(c)||c===1/0||c===-1/0)&&(c=l),s.setData(i,e,c)}}}_ensureSizeForTexel(e){for(;e>=this._size*this._size;)if(this._expand())return}async _bind(e,t,n){let i=await e.createComputedField(n);r(this._rendererDependencies,i);let{valueRepresentation:a}=n,o=this._attributeComputeInfo;if(o.type===`multi`){let e=o.map.get(t)??new Map;e.set(n.binding,{field:i,valueRepresentation:a}),o.map.set(t,e)}else o.map.set(n.binding,{field:i,valueRepresentation:a});return i}_getInitArgs(){return this._initialized?null:(this._initialized=!0,this._getBlock(1),this._getBlock(2),this._getBlock(7),{blockSize:this._size,blockDescriptors:this._blocks.map(e=>e==null?null:{textureOnly:e.textureOnly,buffer:e.buffer,pixelType:e.pixelType})})}_getBlock(e){let t=this._blocks[e];if(t!=null)return t;v(`Initializing AttributeBlock at index ${e}`);let n=new b(this._size,this._blockDescriptors[e],this._client.isLocal);return this._blocks[e]=n,this._initialized=!1,n}_expand(){if(this._size<this._schema.capabilities.maxTextureSize){let e=this._size<<=1;v(`Expanding block size to`,e,this._blocks);for(let t of this._blocks)t?.expand(e);return this._initialized=!1,this._size=e,0}return g().error(new e(`mapview-limitations`,`Maximum number of onscreen features exceeded.`)),-1}_passesMatcherFilter(e,t){if(this._matcherFilter===void 0)return!0;if(this._matcherFilter===null)return!1;let n=this._matcherFilter.read(e,t);return n==null||isNaN(n)||n===1/0||n===-1/0?!1:n>=-(2**53-1)&&n<=2**53-1}isVisible(e){return!!(this._getBlock(0).getData(e,0)&1<<o)}}export{x as AttributeStore,h as getVisualVariableSizeValueRepresentationRatio};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../../../core/Error.js";import t from"../../../../../core/Logger.js";import{create as n}from"../../../../../geometry/support/aaBoundingRect.js";import{getBoundsXY as r}from"../../../../../geometry/support/boundsUtils.js";import{normalizeQueryLike as i}from"../../../../../layers/graphics/data/queryUtils.js";import{getSpatialQueryOperator as a}from"../../../../../layers/graphics/data/spatialQuerySupport.js";import{getTimeOperator as o}from"../../../../../layers/graphics/data/timeSupport.js";import s from"../../../../../rest/support/Query.js";import{FeatureStoreQueryAdapter as c}from"../FeatureStoreQueryAdapter.js";import{createWhereClause as l}from"./whereUtils.js";class u{constructor(e){this.
|
|
2
|
+
import e from"../../../../../core/Error.js";import t from"../../../../../core/Logger.js";import{create as n}from"../../../../../geometry/support/aaBoundingRect.js";import{getBoundsXY as r}from"../../../../../geometry/support/boundsUtils.js";import{normalizeQueryLike as i}from"../../../../../layers/graphics/data/queryUtils.js";import{getSpatialQueryOperator as a}from"../../../../../layers/graphics/data/spatialQuerySupport.js";import{getTimeOperator as o}from"../../../../../layers/graphics/data/timeSupport.js";import s from"../../../../../rest/support/Query.js";import{FeatureStoreQueryAdapter as c}from"../FeatureStoreQueryAdapter.js";import{createWhereClause as l}from"./whereUtils.js";class u{constructor(e){this._idToVisibility=new Map,this._serviceInfo=e}static async create(e){let t=new u(e);return await t.update(e.filterJSON,e.spatialReference),t}get hash(){return this._hash}forEachMatch(e,t,i){let a=this.geometry&&this.spatialRel!==`esriSpatialRelDisjoint`?e.queryFeaturesInBounds(r(n(),this.geometry)):e.getCursor();for(;a.next();)this._applyFilter(a,t)&&i(a)}invalidate(){this._idToVisibility.forEach((e,t)=>{this._idToVisibility.set(t,0)})}setKnownIds(e){for(let t of e)this._idToVisibility.set(t,1)}setTrue(e){let t=[],n=[],r=new Set(e);return this._idToVisibility.forEach((e,i)=>{let a=!!(this._idToVisibility.get(i)&1),o=r.has(i);!a&&o?t.push(i):a&&!o&&n.push(i),this._idToVisibility.set(i,o?3:0)}),{show:t,hide:n}}createQuery(){let{geometry:e,spatialRel:t,where:n,timeExtent:r,objectIds:i}=this;return s.fromJSON({geometry:e,spatialRel:t,where:n,timeExtent:r,objectIds:i})}async update(e,t){this._hash=JSON.stringify(e);let n=await i(e,null,t);await Promise.all([this._setGeometryFilter(n),this._setIdFilter(n),this._setAttributeFilter(n),this._setTimeFilter(n)])}async _setAttributeFilter(e){e?.where?(this._clause=await l(e.where,this._serviceInfo.fieldsIndex),this.where=e.where):(this._clause=null,this.where=null)}_setIdFilter(e){this._idsToShow=e?.objectIds&&new Set(e.objectIds),this._idsToHide=e?.hiddenIds&&new Set(e.hiddenIds),this.objectIds=e?.objectIds}async _setGeometryFilter(e){if(!e?.geometry){this._spatialQueryOperator=null,this.geometry=null,this.spatialRel=null;return}let t=e.geometry,n=e.spatialRel??`esriSpatialRelIntersects`,r=await a(n,t,this._serviceInfo.geometryType);this._spatialQueryOperator=r,this.geometry=t,this.spatialRel=n}_setTimeFilter(n){if(this.timeExtent=this._timeOperator=null,n?.timeExtent){if(this._serviceInfo.timeInfo)this.timeExtent=n.timeExtent,this._timeOperator=o(this._serviceInfo.timeInfo,n.timeExtent,c.Shared);else{let r=new e(`feature-layer-view:time-filter-not-available`,`Unable to apply time filter, as layer doesn't have time metadata.`,n.timeExtent);t.getLogger(`esri.views.2d.layers.features.controllers.FeatureFilter`).error(r)}}}_applyFilter(e,t){return this._filterByGeometry(e)&&this._filterById(e)&&this._filterByTime(e)&&this._filterByExpression(e,t)}_filterByExpression(e,t){return!this.where||this._clause(e,t)}_filterById(e){return(!this._idsToHide?.size||!this._idsToHide.has(e.getObjectId()))&&(!this._idsToShow?.size||this._idsToShow.has(e.getObjectId()))}_filterByGeometry(e){if(!this.geometry)return!0;let t=e.readGeometryWorldSpace();return t?this._spatialQueryOperator(t):!1}_filterByTime(e){return this._timeOperator==null||this._timeOperator(e)}}export{u as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{ArcadeDate as e}from"../../../../../arcade/ArcadeDate.js";import{createArcadeGeometryFromOptimizedGeometry as t}from"../../../../../arcade/geometry/adapters/optimized.js";import has from"../../../../../core/has.js";import{estimateNumberArrayMemory as n}from"../../../../../core/memoryEstimations.js";import{DateOnly as r}from"../../../../../core/sql/DateOnly.js";import{TimeOnly as i}from"../../../../../core/sql/TimeOnly.js";import{GeometryCursor as a}from"../../../../../geometry/GeometryCursor.js";import{fromRectValues as o}from"../../../../../geometry/support/aaBoundingBox.js";import{getLabelPoint as s}from"../../../../../geometry/support/labelPoint.js";import{quantizeX as c,quantizeY as l}from"../../../../../geometry/support/quantizationUtils.js";import{zScale as u}from"../../../../../geometry/support/zscale.js";import{getCentroidOptimizedGeometry as d}from"../../../../../layers/graphics/centroid.js";import{convertToGeometry as f,generalizeOptimizedGeometry as p,quantizeOptimizedGeometry as m,unquantizeOptimizedGeometryInPlace as h}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as g}from"../../../../../layers/graphics/OptimizedFeature.js";import _ from"../../../../../layers/graphics/OptimizedGeometry.js";import{system as v,unknown as y}from"../../../../../time/constants.js";import{FeatureSetCache as b}from"./FeatureSetCache.js";const x=has(`featurelayer-simplify-thresholds`)??[.5,.5,.5,.5],S=x[0],C=x[1],w=x[2],T=x[3],E=has(`featurelayer-simplify-payload-size-factors`)??[1,2,4],D=E[0],O=E[1],k=E[2],A=has(`featurelayer-simplify-mobile-factor`)??2,j=has(`esri-mobile`),M=4294967295;function N(e,t,n){if(!(e.length>t))for(;e.length<=t;)e.push(n)}class P{constructor(e){this.metadata=e,this.type=`FeatureSetReader`,this._overrides=null,this._postQueryFilteredIds=new Set,this._joined=[],this._objectIdToIndex=null,this._boundsBuffer=[],this._deleted=new Set,this._caches=new Map,this.arcadeDeclaredClass=`esri.arcade.Feature`,this._contextTimeZone=null}destroy(){}[Symbol.dispose](){this.destroy()}get geometryDensity(){return{sampleCount:0,densePairCount:0}}getAreaSimplificationThreshold(e,t){let n=1,r=j?A:1;t>4e6?n=k*r:t>1e6?n=O*r:t>5e5?n=D*r:t>1e5&&(n=r);let i=0;return e>4e3?i=T*n:e>2e3?i=w*n:e>100?i=C:e>15&&(i=S),i}getBounds(e){N(this._boundsBuffer,this.getIndex()*4+4,0);let t=this.getBoundsXMin();if(t===M||!isFinite(t))return!1;if(this.getBoundsXMin()===0){let t=this.readGeometryWorldSpace();if(t?.isPoint&&t.coords[0]===0&&t.coords[1]===0)return o(e,0,0,0,0),!0;if(!t)return this.setBoundsXMin(M),!1;let n=1/0,r=1/0,i=-1/0,a=-1/0;return t.forEachVertex((e,t)=>{n=Math.min(n,e),r=Math.min(r,t),i=Math.max(i,e),a=Math.max(a,t)}),this.setBoundsXMin(n),this.setBoundsYMin(r),this.setBoundsXMax(i),this.setBoundsYMax(a),o(e,n,r,i,a),!0}let n=this.getBoundsXMin(),r=this.getBoundsYMin(),i=this.getBoundsXMax(),a=this.getBoundsYMax();return o(e,n,r,i,a),!0}getBoundsXMin(){return this._boundsBuffer[this.getIndex()*4]}setBoundsXMin(e){this._boundsBuffer[this.getIndex()*4]=e}getBoundsYMin(){return this._boundsBuffer[this.getIndex()*4+1]}setBoundsYMin(e){this._boundsBuffer[this.getIndex()*4+1]=e}getBoundsXMax(){return this._boundsBuffer[this.getIndex()*4+2]}setBoundsXMax(e){this._boundsBuffer[this.getIndex()*4+2]=e}getBoundsYMax(){return this._boundsBuffer[this.getIndex()*4+3]}setBoundsYMax(e){this._boundsBuffer[this.getIndex()*4+3]=e}readAttributeAsTimestamp(e){let t=this.readAttribute(e);return typeof t==`string`?new Date(t).getTime():typeof t==`number`||t==null?t:null}readAttribute(e,t=!1){let n=this._readAttribute(e,t);if(n!==void 0)return n;for(let n of this._joined){n.setIndex(this.getIndex());let r=n._readAttribute(e,t);if(r!==void 0)return r}}readAttributes(){let e=this._readAttributes();for(let t of this._joined){t.setIndex(this.getIndex());let n=t._readAttributes();for(let t of Object.keys(n))e[t]=n[t]}return e}joinAttributes(e){this._joined.push(e)}registerOverrides(e){this._overrides=e}withoutOverrides(){let e=this.copy();return e._overrides=null,e}readOptimizedFeatureWorldSpace(){let e=this.readGeometryWorldSpace(),t=this.readAttributes(),n=this.readCentroidWorldSpace();return new g(e,t,n,this.getObjectId(),this.getDisplayId())}readLegacyFeatureForDisplay(){let e=this.readCentroidForDisplay();return{attributes:this.readAttributes(),geometry:this.readLegacyGeometryForDisplay(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyFeatureWorldSpace(){let e=this.readCentroidWorldSpace();return{attributes:this.readAttributes(),geometry:this._readLegacyGeometryWorldSpace(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyGeometryForDisplay(){let e=this.readGeometryForDisplay();return f(e,this.geometryType,!1,!1)}readXForDisplay(){return this._readX()}readYForDisplay(){return this._readY()}readXWorldSpace(){let e=this._readX(),t=this.getInTransform();return t==null?e:e*t.scale[0]+t.translate[0]}readYWorldSpace(){let e=this._readY(),t=this.getInTransform();return t==null?e:t.translate[1]-e*t.scale[1]}readGeometryForDisplay(){let e=this._readGeometryDeltaDecoded(!0);if(!e){let e=this._createDeltaQuantizedGeometryFromServerCentroid();return e?e.deltaDecode():null}return e}readGeometryForDisplayTransformed(e){let t=this.readGeometryForDisplay();if(t&&this.metadata.geometryType===`esriGeometryPolyline`&&(t=p(t,this.metadata.geometryType,e.scale[0])),t&&=m(t,this.metadata.geometryType,e,t.hasZ,t.hasM,!0),!t){let t=this.readCentroidForDisplay();if(!t)return null;let n=c(e,t.coords[0]),r=l(e,t.coords[1]);return this._createDeltaQuantizedExtrudedGeometry(n,r).deltaDecode()}return t}_transformToWorldSpace(e){if(!e)return null;e=e.clone();let t=this.getInTransform();t&&h(e,t);let n=u(this.metadata.spatialReference,this.metadata.outSpatialReference);if(e.hasZ&&n!==1){let{stride:t,coords:r}=e;for(let e=2;e<r.length;e+=t)r[e]*=n}return e}readGeometryWorldSpace(){let e=this._readGeometry();return e||=this._createDeltaQuantizedGeometryFromServerCentroid(),this._transformToWorldSpace(e)}readCentroidForDisplay(){let e=this.readGeometryForDisplay();return e?this._computeDisplayCentroid(e):this._readServerCentroid()}readCentroidWorldSpace(){let e=this.readGeometryForDisplay(),t=e?this._computeDisplayCentroid(e):this._readServerCentroid();return this._transformToWorldSpace(t)}setCache(e){let t=this._caches.get(e);t??(t=new b(this.getSize()),this._caches.set(e,t)),this._activeCache=t}setCachedValue(e){this._activeCache.set(this.getIndex(),e)}hasCachedValue(){return this._activeCache.has(this.getIndex())}getCachedValue(){return this._activeCache.get(this.getIndex())}delete(){this._deleted.add(this.getObjectId())}getByReferenceVertexCount(){return null}get underlyingMemory(){let e=0;e+=n(this._boundsBuffer);for(let t of this._caches.values())e+=t.usedMemory;return e}getDisplayTransform(){return null}_readGeometryDeltaDecoded(e){let t=this._readGeometry(e);if(this.geometryType===`esriGeometryPoint`||!t)return t;let n=this.getInTransform();if(!t||!n)return t;let r=n.scale[2]??1,i=n.translate[2]??0,a=n.scale[3]??1,o=n.translate[3]??0,{hasZ:s,hasM:c,stride:l,size:u,coords:d}=t,f=s&&(r!==1||i!==0),p=c&&(a!==1||o!==0);if(f||p){let e=s?3:2;for(let t=0,n=l*u;t<n;t+=l)f&&(d[t+2]=r*d[t+2]+i),p&&(d[t+e]=a*d[t+e]+o)}return t.deltaDecode()}get contextTimeZone(){return this._contextTimeZone}set contextTimeZone(e){this._contextTimeZone=e}readArcadeFeature(){return this}hasField(e){return this.fields.has(e)||this._joined.some(t=>t.hasField(e))}geometry(){let e=this.readGeometryWorldSpace();if(e==null)return null;let n;switch(this.geometryType){case`esriGeometryPoint`:n=`point`;break;case`esriGeometryMultipoint`:n=`multipoint`;break;case`esriGeometryPolyline`:n=`polyline`;break;case`esriGeometryPolygon`:n=`polygon`;break;default:throw Error(`Unexpected geometry type: ${this.geometryType}`)}return t(n,{lengths:e.lengths,coords:e.coords,hasZ:this.hasZ,hasM:this.hasM},this.metadata.outSpatialReference)}autocastArcadeDate(t,n){return n&&n instanceof Date?this.isUnknownDateTimeField(t)?e.unknownDateJSToArcadeDate(n):e.dateJSAndZoneToArcadeDate(n,this.contextTimeZone??v):n}isUnknownDateTimeField(e){return this.metadata.fieldsIndex.getTimeZone(e)===y}field(t){let n=this.fields.get(t);if(n)switch(n.type){case`date-only`:case`esriFieldTypeDateOnly`:return r.fromReader(this.readAttribute(t,!1));case`time-only`:case`esriFieldTypeTimeOnly`:return i.fromReader(this.readAttribute(t,!1));case`esriFieldTypeTimestampOffset`:case`timestamp-offset`:return e.fromReaderAsTimeStampOffset(this.readAttribute(t,!1));case`date`:case`esriFieldTypeDate`:return this.autocastArcadeDate(t,this.readAttribute(t,!0));default:return this.readAttribute(t,!1)}for(let a of this._joined)if(a.setIndex(this.getIndex()),n=a.fields.get(t),n)switch(n.type){case`date-only`:case`esriFieldTypeDateOnly`:return r.fromReader(a._readAttribute(t,!1));case`time-only`:case`esriFieldTypeTimeOnly`:return i.fromReader(a._readAttribute(t,!1));case`esriFieldTypeTimestampOffset`:case`timestamp-offset`:return e.fromReaderAsTimeStampOffset(a._readAttribute(t,!1));case`date`:case`esriFieldTypeDate`:return this.autocastArcadeDate(t,a._readAttribute(t,!0));default:return this.readAttribute(t,!1)}throw Error(`Field ${t} does not exist`)}setField(e,t){throw Error(`Unable to update feature attribute values, feature is readonly`)}keys(){return this.fields.fields.map(e=>e.name)}isEmpty(){return this.fields.fields.length<=0&&this.geometry()==null}castToText(e=!1){if(!e)return JSON.stringify(this.readLegacyFeatureForDisplay());let t=this.readLegacyFeatureForDisplay();if(!t)return JSON.stringify(null);let n={geometry:t.geometry,attributes:{...t.attributes}};for(let e in n.attributes){let t=n.attributes[e];t instanceof Date&&(n.attributes[e]=t.getTime())}return JSON.stringify(n)}gdbVersion(){return null}fullSchema(){return this.metadata.arcadeSchema}castAsJson(){return{attributes:this._readAttributes(),geometry:this.geometry()?.castAsJson()??null}}castAsJsonAsync(){return Promise.resolve(this.castAsJson())}applyPostQueryFilter(e){if(this._postQueryFilteredIds.clear(),!e)return;let t=this.getCursor();for(;t.next();)e.check(t,{currentUser:null})||this._postQueryFilteredIds.add(t.getObjectId())}_getExists(){let e=this.getObjectId();return this._deleted.has(e)?!1:this._overrides?!this._overrides.hasOverride(e):!this._postQueryFilteredIds.has(e)}_computeDisplayCentroid(e){if(this.getInTransform()==null)return d(e);let t=a.fromOptimized(e,this.geometryType);t.yFactor*=-1;let n=s(t);return n?isNaN(n[0])||isNaN(n[1])?d(e):(n[1]*=-1,new _([],n)):null}copyInto(e){e._joined=this._joined,e._overrides=this._overrides,e._objectIdToIndex=this._objectIdToIndex,e._boundsBuffer=this._boundsBuffer,e._activeCache=this._activeCache,e._caches=this._caches,e._contextTimeZone=this._contextTimeZone,e._postQueryFilteredIds=this._postQueryFilteredIds,e._deleted=this._deleted}_readLegacyGeometryWorldSpace(){let e=this.readGeometryWorldSpace();return f(e,this.geometryType,!1,!1)}_createDeltaQuantizedGeometryFromServerCentroid(){let e=this._readServerCentroid();if(!e)return null;let[t,n]=e.coords;return this._createDeltaQuantizedExtrudedGeometry(t,n)}_createDeltaQuantizedExtrudedGeometry(e,t){return this.geometryType===`esriGeometryPolyline`?this._createDeltaQuantizedExtrudedLine(e,t):this._createDeltaQuantizedExtrudedQuad(e,t)}_createDeltaQuantizedExtrudedQuad(e,t){return new _([5],[e-1,t,1,-1,1,1,-1,1,-1,-1])}_createDeltaQuantizedExtrudedLine(e,t){return new _([2],[e-1,t+1,1,-1])}}export{P as FeatureSetReader};
|
|
2
|
+
import{ArcadeDate as e}from"../../../../../arcade/ArcadeDate.js";import{createArcadeGeometryFromOptimizedGeometry as t}from"../../../../../arcade/geometry/adapters/optimized.js";import has from"../../../../../core/has.js";import{estimateNumberArrayMemory as n,estimateNumberMemory as r,baseObjectMemory as i}from"../../../../../core/memoryEstimations.js";import{r as a}from"../../../../../chunks/rbush.js";import{DateOnly as o}from"../../../../../core/sql/DateOnly.js";import{TimeOnly as s}from"../../../../../core/sql/TimeOnly.js";import{GeometryCursor as c}from"../../../../../geometry/GeometryCursor.js";import{fromRectValues as l,create as u}from"../../../../../geometry/support/aaBoundingBox.js";import{getLabelPoint as d}from"../../../../../geometry/support/labelPoint.js";import{quantizeX as f,quantizeY as p,normalizeTransform as m}from"../../../../../geometry/support/quantizationUtils.js";import{zScale as h}from"../../../../../geometry/support/zscale.js";import{getCentroidOptimizedGeometry as g}from"../../../../../layers/graphics/centroid.js";import{convertToGeometry as _,generalizeOptimizedGeometry as v,quantizeOptimizedGeometry as y,unquantizeOptimizedGeometryInPlace as b}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as x}from"../../../../../layers/graphics/OptimizedFeature.js";import S from"../../../../../layers/graphics/OptimizedGeometry.js";import{system as C,unknown as w}from"../../../../../time/constants.js";import{GeohashSpatialIndex as T}from"../aggregation/GeohashSpatialIndex.js";import{GridSpatialIndex as E}from"../aggregation/GridSpatialIndex.js";import{FeatureSetCache as D}from"./FeatureSetCache.js";const O=has(`featurelayer-simplify-thresholds`)??[.5,.5,.5,.5],k=O[0],A=O[1],j=O[2],M=O[3],N=has(`featurelayer-simplify-payload-size-factors`)??[1,2,4],P=N[0],F=N[1],I=N[2],L=has(`featurelayer-simplify-mobile-factor`)??2,R=has(`esri-mobile`),z=4294967295;function B(e,t,n){if(!(e.length>t))for(;e.length<=t;)e.push(n)}class V{constructor(e){this.metadata=e,this.type=`FeatureSetReader`,this._overrides=null,this._postQueryFilteredIds=new Set,this._joined=[],this._objectIdToIndex=null,this._boundsBuffer=[],this._aggregateCache={},this._deleted=new Set,this._caches=new Map,this.arcadeDeclaredClass=`esri.arcade.Feature`,this._contextTimeZone=null}destroy(){}[Symbol.dispose](){this.destroy()}get geometryDensity(){return{sampleCount:0,densePairCount:0}}getAreaSimplificationThreshold(e,t){let n=1,r=R?L:1;t>4e6?n=I*r:t>1e6?n=F*r:t>5e5?n=P*r:t>1e5&&(n=r);let i=0;return e>4e3?i=M*n:e>2e3?i=j*n:e>100?i=A:e>15&&(i=k),i}getBounds(e){B(this._boundsBuffer,this.getIndex()*4+4,0);let t=this.getBoundsXMin();if(t===z||!isFinite(t))return!1;if(this.getBoundsXMin()===0){let t=this.readGeometryWorldSpace();if(t?.isPoint&&t.coords[0]===0&&t.coords[1]===0)return l(e,0,0,0,0),!0;if(!t)return this.setBoundsXMin(z),!1;let n=1/0,r=1/0,i=-1/0,a=-1/0;return t.forEachVertex((e,t)=>{n=Math.min(n,e),r=Math.min(r,t),i=Math.max(i,e),a=Math.max(a,t)}),this.setBoundsXMin(n),this.setBoundsYMin(r),this.setBoundsXMax(i),this.setBoundsYMax(a),l(e,n,r,i,a),!0}let n=this.getBoundsXMin(),r=this.getBoundsYMin(),i=this.getBoundsXMax(),a=this.getBoundsYMax();return l(e,n,r,i,a),!0}getBoundsXMin(){return this._boundsBuffer[this.getIndex()*4]}setBoundsXMin(e){this._boundsBuffer[this.getIndex()*4]=e}getBoundsYMin(){return this._boundsBuffer[this.getIndex()*4+1]}setBoundsYMin(e){this._boundsBuffer[this.getIndex()*4+1]=e}getBoundsXMax(){return this._boundsBuffer[this.getIndex()*4+2]}setBoundsXMax(e){this._boundsBuffer[this.getIndex()*4+2]=e}getBoundsYMax(){return this._boundsBuffer[this.getIndex()*4+3]}setBoundsYMax(e){this._boundsBuffer[this.getIndex()*4+3]=e}readAttributeAsTimestamp(e){let t=this.readAttribute(e);return typeof t==`string`?new Date(t).getTime():typeof t==`number`||t==null?t:null}readAttribute(e,t=!1){let n=this._readAttribute(e,t);if(n!==void 0)return n;for(let n of this._joined){n.setIndex(this.getIndex());let r=n._readAttribute(e,t);if(r!==void 0)return r}}readAttributes(){let e=this._readAttributes();for(let t of this._joined){t.setIndex(this.getIndex());let n=t._readAttributes();for(let t of Object.keys(n))e[t]=n[t]}return e}joinAttributes(e){this._joined.push(e)}registerOverrides(e){this._overrides=e}withoutOverrides(){let e=this.copy();return e._overrides=null,e._aggregateCache={},e}readOptimizedFeatureWorldSpace(){let e=this.readGeometryWorldSpace(),t=this.readAttributes(),n=this.readCentroidWorldSpace();return new x(e,t,n,this.getObjectId(),this.getDisplayId())}readLegacyFeatureForDisplay(){let e=this.readCentroidForDisplay();return{attributes:this.readAttributes(),geometry:this.readLegacyGeometryForDisplay(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyFeatureWorldSpace(){let e=this.readCentroidWorldSpace();return{attributes:this.readAttributes(),geometry:this._readLegacyGeometryWorldSpace(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyGeometryForDisplay(){let e=this.readGeometryForDisplay();return _(e,this.geometryType,!1,!1)}readXForDisplay(){return this._readX()}readYForDisplay(){return this._readY()}readXWorldSpace(){let e=this._readX(),t=this.getInTransform();return t==null?e:e*t.scale[0]+t.translate[0]}readYWorldSpace(){let e=this._readY(),t=this.getInTransform();return t==null?e:t.translate[1]-e*t.scale[1]}readGeometryForDisplay(){let e=this._readGeometryDeltaDecoded(!0);if(!e){let e=this._createDeltaQuantizedGeometryFromServerCentroid();return e?e.deltaDecode():null}return e}readGeometryForDisplayTransformed(e){let t=this.readGeometryForDisplay();if(t&&this.metadata.geometryType===`esriGeometryPolyline`&&(t=v(t,this.metadata.geometryType,e.scale[0])),t&&=y(t,this.metadata.geometryType,e,t.hasZ,t.hasM,!0),!t){let t=this.readCentroidForDisplay();if(!t)return null;let n=f(e,t.coords[0]),r=p(e,t.coords[1]);return this._createDeltaQuantizedExtrudedGeometry(n,r).deltaDecode()}return t}_transformToWorldSpace(e){if(!e)return null;e=e.clone();let t=this.getInTransform();t&&b(e,t);let n=h(this.metadata.spatialReference,this.metadata.outSpatialReference);if(e.hasZ&&n!==1){let{stride:t,coords:r}=e;for(let e=2;e<r.length;e+=t)r[e]*=n}return e}readGeometryWorldSpace(){let e=this._readGeometry();return e||=this._createDeltaQuantizedGeometryFromServerCentroid(),this._transformToWorldSpace(e)}readCentroidForDisplay(){let e=this.readGeometryForDisplay();return e?this._computeDisplayCentroid(e):this._readServerCentroid()}readCentroidWorldSpace(){let e=this.readGeometryForDisplay(),t=e?this._computeDisplayCentroid(e):this._readServerCentroid();return this._transformToWorldSpace(t)}setCache(e){let t=this._caches.get(e);t??(t=new D(this.getSize()),this._caches.set(e,t)),this._activeCache=t}setCachedValue(e){this._activeCache.set(this.getIndex(),e)}hasCachedValue(){return this._activeCache.has(this.getIndex())}getCachedValue(){return this._activeCache.get(this.getIndex())}delete(){this._deleted.add(this.getObjectId())}getByReferenceVertexCount(){return null}get underlyingMemory(){let e=0;e+=n(this._boundsBuffer),e+=(this._spatialIndex?.all().length??0)*r,e+=this._aggregateCache.gridIndex?.usedMemory??0,e+=this._aggregateCache.geohashIndex?.usedMemory??0;for(let t of this._caches.values())e+=t.usedMemory;return e}getDisplayTransform(){return null}queryFeaturesInBounds(e){let t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return H.from(this,this.getSpatialIndex().search(t))}getSpatialIndex(){if(this._spatialIndex)return this._spatialIndex;let e=[],t=this.copy(),n=u();for(let r=0;r<this.getSize();r++)t.setIndex(r),t.getBounds(n)&&e.push(t.getIndex());let r=a(9,e=>(t.setIndex(e),{minX:t.getBoundsXMin(),minY:t.getBoundsYMin(),maxX:t.getBoundsXMax(),maxY:t.getBoundsYMax()}));return r.load(e),this._spatialIndex=r,r}getGridIndex(e){return e.hash!==this._aggregateCache.gridIndex?.hash&&(this._aggregateCache.gridIndex=new E(e,this.copy())),this._aggregateCache.gridIndex}getGeohashIndex(e){return e.hash!==this._aggregateCache.geohashIndex?.hash&&(this._aggregateCache.geohashIndex=new T(e,this.copy())),this._aggregateCache.geohashIndex}invalidateAggregateIndices(){this._aggregateCache.gridIndex=void 0,this._aggregateCache.geohashIndex=void 0}_readGeometryDeltaDecoded(e){let t=this._readGeometry(e);if(this.geometryType===`esriGeometryPoint`||!t)return t;let n=this.getInTransform();if(!t||!n)return t;let r=n.scale[2]??1,i=n.translate[2]??0,a=n.scale[3]??1,o=n.translate[3]??0,{hasZ:s,hasM:c,stride:l,size:u,coords:d}=t,f=s&&(r!==1||i!==0),p=c&&(a!==1||o!==0);if(f||p){let e=s?3:2;for(let t=0,n=l*u;t<n;t+=l)f&&(d[t+2]=r*d[t+2]+i),p&&(d[t+e]=a*d[t+e]+o)}return t.deltaDecode()}get contextTimeZone(){return this._contextTimeZone}set contextTimeZone(e){this._contextTimeZone=e}readArcadeFeature(){return this}hasField(e){return this.fields.has(e)||this._joined.some(t=>t.hasField(e))}geometry(){let e=this.readGeometryWorldSpace();if(e==null)return null;let n;switch(this.geometryType){case`esriGeometryPoint`:n=`point`;break;case`esriGeometryMultipoint`:n=`multipoint`;break;case`esriGeometryPolyline`:n=`polyline`;break;case`esriGeometryPolygon`:n=`polygon`;break;default:throw Error(`Unexpected geometry type: ${this.geometryType}`)}return t(n,{lengths:e.lengths,coords:e.coords,hasZ:this.hasZ,hasM:this.hasM},this.metadata.outSpatialReference)}autocastArcadeDate(t,n){return n&&n instanceof Date?this.isUnknownDateTimeField(t)?e.unknownDateJSToArcadeDate(n):e.dateJSAndZoneToArcadeDate(n,this.contextTimeZone??C):n}isUnknownDateTimeField(e){return this.metadata.fieldsIndex.getTimeZone(e)===w}field(t){let n=this.fields.get(t);if(n)switch(n.type){case`date-only`:case`esriFieldTypeDateOnly`:return o.fromReader(this.readAttribute(t,!1));case`time-only`:case`esriFieldTypeTimeOnly`:return s.fromReader(this.readAttribute(t,!1));case`esriFieldTypeTimestampOffset`:case`timestamp-offset`:return e.fromReaderAsTimeStampOffset(this.readAttribute(t,!1));case`date`:case`esriFieldTypeDate`:return this.autocastArcadeDate(t,this.readAttribute(t,!0));default:return this.readAttribute(t,!1)}for(let r of this._joined)if(r.setIndex(this.getIndex()),n=r.fields.get(t),n)switch(n.type){case`date-only`:case`esriFieldTypeDateOnly`:return o.fromReader(r._readAttribute(t,!1));case`time-only`:case`esriFieldTypeTimeOnly`:return s.fromReader(r._readAttribute(t,!1));case`esriFieldTypeTimestampOffset`:case`timestamp-offset`:return e.fromReaderAsTimeStampOffset(r._readAttribute(t,!1));case`date`:case`esriFieldTypeDate`:return this.autocastArcadeDate(t,r._readAttribute(t,!0));default:return this.readAttribute(t,!1)}throw Error(`Field ${t} does not exist`)}setField(e,t){throw Error(`Unable to update feature attribute values, feature is readonly`)}keys(){return this.fields.fields.map(e=>e.name)}isEmpty(){return this.fields.fields.length<=0&&this.geometry()==null}castToText(e=!1){if(!e)return JSON.stringify(this.readLegacyFeatureForDisplay());let t=this.readLegacyFeatureForDisplay();if(!t)return JSON.stringify(null);let n={geometry:t.geometry,attributes:{...t.attributes}};for(let e in n.attributes){let t=n.attributes[e];t instanceof Date&&(n.attributes[e]=t.getTime())}return JSON.stringify(n)}gdbVersion(){return null}fullSchema(){return this.metadata.arcadeSchema}castAsJson(){return{attributes:this._readAttributes(),geometry:this.geometry()?.castAsJson()??null}}castAsJsonAsync(){return Promise.resolve(this.castAsJson())}applyPostQueryFilter(e){if(this._postQueryFilteredIds.clear(),!e)return;let t=new Set;e.forEachMatch(this,{currentUser:null},e=>{t.add(e.getObjectId())});let n=[],r=this.getCursor();for(;r.next();)t.has(r.getObjectId())||n.push(r.getObjectId());for(let e of n)this._postQueryFilteredIds.add(e)}_getExists(){let e=this.getObjectId();return this._deleted.has(e)?!1:this._overrides?!this._overrides.hasOverride(e):!this._postQueryFilteredIds.has(e)}_computeDisplayCentroid(e){if(this.getInTransform()==null)return g(e);let t=c.fromOptimized(e,this.geometryType);t.yFactor*=-1;let n=d(t);return n?isNaN(n[0])||isNaN(n[1])?g(e):(n[1]*=-1,new S([],n)):null}copyInto(e){e._joined=this._joined,e._overrides=this._overrides,e._objectIdToIndex=this._objectIdToIndex,e._boundsBuffer=this._boundsBuffer,e._spatialIndex=this._spatialIndex,e._aggregateCache=this._aggregateCache,e._activeCache=this._activeCache,e._caches=this._caches,e._contextTimeZone=this._contextTimeZone,e._postQueryFilteredIds=this._postQueryFilteredIds,e._deleted=this._deleted}_readLegacyGeometryWorldSpace(){let e=this.readGeometryWorldSpace();return _(e,this.geometryType,!1,!1)}_createDeltaQuantizedGeometryFromServerCentroid(){let e=this._readServerCentroid();if(!e)return null;let[t,n]=e.coords;return this._createDeltaQuantizedExtrudedGeometry(t,n)}_createDeltaQuantizedExtrudedGeometry(e,t){return this.geometryType===`esriGeometryPolyline`?this._createDeltaQuantizedExtrudedLine(e,t):this._createDeltaQuantizedExtrudedQuad(e,t)}_createDeltaQuantizedExtrudedQuad(e,t){return new S([5],[e-1,t,1,-1,1,1,-1,1,-1,-1])}_createDeltaQuantizedExtrudedLine(e,t){return new S([2],[e-1,t+1,1,-1])}}class H extends V{static from(e,t){if(e instanceof this){let n=new Set(t),r=e._indices.filter(e=>n.has(e)),i=e.copy();return i._indices=r,i._currentIndex=-1,i}return new H(e.copy(),t)}constructor(e,t){super(e.metadata),this._currentIndex=-1,this._displayTransform=null,this._reader=e,this._indices=t}setTransformForDisplay(e){let t=this._reader.getInTransform();if(t==null){this._displayTransform=m(e);return}let n=m(t),r=m(e),[i,a]=n.scale,[o,s]=n.translate,[c,l]=r.scale,[u,d]=r.translate,f=i/c,p=a/l,h=(o-u)/c,g=(s-d)/l;this._displayTransform={originPosition:`lowerLeft`,scale:[1/f,1/p,1,1],translate:[-h/f,-g/p,0,0]}}getInTransform(){return this._reader.getInTransform()}getDisplayTransform(){return this._displayTransform}get fields(){return this._reader.fields}get hasNext(){return this._currentIndex+1<this._indices.length}getSize(){return this._indices.length}getCursor(){return this.copy()}copy(){let e=new H(this._reader.copy(),this._indices);return e._currentIndex=this._currentIndex,e._displayTransform=this._displayTransform,e._processorAttributes=this._processorAttributes,e}getSpatialIndex(){return this._reader.getSpatialIndex()}getGridIndex(e){throw Error(`Cannot request a grid index from an indirect feature set reader.`)}getGeohashIndex(e){throw Error(`Cannot request a geohash index from an indirect feature set reader.`)}get contextTimeZone(){return this._reader.contextTimeZone}set contextTimeZone(e){this._reader.contextTimeZone=e}get usedMemory(){return i+this._reader.usedMemory}setProcessorAttributes(e){this._processorAttributes=Object.assign(this._processorAttributes??{},e)}_nextIndex(){return++this._currentIndex<this._indices.length&&(this._reader.setIndex(this._indices[this._currentIndex]),!0)}next(){for(;this._nextIndex()&&!this._reader._getExists(););return this._currentIndex<this._indices.length}readXForDisplay(){return this._displayTransform?f(this._displayTransform,this._reader.readXForDisplay()):this._reader.readXForDisplay()}readYForDisplay(){return this._displayTransform?p(this._displayTransform,this._reader.readYForDisplay()):this._reader.readYForDisplay()}readGeometryForDisplay(){return this._displayTransform?this._reader.readGeometryForDisplayTransformed(this._displayTransform):this._reader.readGeometryForDisplay()}readCentroidForDisplay(){let e=this._reader.readCentroidForDisplay()?.clone();if(e){let[t,n]=e.coords;this._displayTransform&&(e.coords[0]=f(this._displayTransform,t),e.coords[1]=p(this._displayTransform,n))}return e}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}readAttribute(e,t=!1){let n=this._reader.readAttribute(e,t);return n!=null||!this._processorAttributes?n:this._processorAttributes[e]}readAttributes(){return{...this._processorAttributes,...this._reader.readAttributes()}}joinAttributes(e){return this._reader.joinAttributes(e)}getBounds(e){return this._reader.getBounds(e)}getBoundsXMin(){return this._reader.getBoundsXMin()}setBoundsXMin(e){this._reader.setBoundsXMin(e)}getBoundsYMin(){return this._reader.getBoundsYMin()}setBoundsYMin(e){this._reader.setBoundsYMin(e)}getBoundsXMax(){return this._reader.getBoundsXMax()}setBoundsXMax(e){this._reader.setBoundsXMax(e)}getBoundsYMax(){return this._reader.getBoundsYMax()}setBoundsYMax(e){this._reader.setBoundsYMax(e)}getAttributeHash(){return this._reader.getAttributeHash()}getObjectId(){return this._reader.getObjectId()}getDisplayId(){return this._reader.getDisplayId()}setDisplayId(e){return this._reader.setDisplayId(e)}setIndex(e){return this._reader.setIndex(e)}getIndex(){return this._reader.getIndex()}readXWorldSpace(){return this._reader.readXWorldSpace()}readYWorldSpace(){return this._reader.readYWorldSpace()}_readX(){return this._reader.readXForDisplay()}_readY(){return this._reader.readYForDisplay()}_readServerCentroid(){return this._reader._readServerCentroid()}readLegacyFeatureForDisplay(){let e=this.readCentroidForDisplay();return{attributes:this.readAttributes(),geometry:this.readLegacyGeometryForDisplay(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyGeometryForDisplay(){let e=this.readGeometryForDisplay();return _(e,this.geometryType,!1,!1)}readGeometryArea(){return this._displayTransform?this._reader.readGeometryForDisplayTransformed(this._displayTransform)?.area()??0:this._reader.readGeometryArea()}readGeometryWorldSpace(){return this._reader.readGeometryWorldSpace()}_readGeometry(){return this._reader._readGeometry()}get geometryDensity(){return this._reader.geometryDensity}_readAttribute(e,t){throw Error(`Error: Should not be called. Underlying _reader should be used instead`)}_readAttributes(){throw Error(`Error: Should not be called. Underlying _reader should be used instead`)}readArcadeFeature(){return this._reader.readArcadeFeature()}geometry(){return this._reader.geometry()}field(e){return this._reader.field(e)}hasField(e){return this._reader.hasField(e)}setField(e,t){return this._reader.setField(e,t)}keys(){return this._reader.keys()}castToText(e=!1){return this._reader.castToText(e)}}export{V as FeatureSetReader,H as FeatureSetReaderIndirect};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{ringsCentroid as e,polygonCentroid as t}from"../../../../../geometry/support/centroid.js";import{getJsonType as n,isGeometryWithZ as r,isGeometryWithM as i}from"../../../../../geometry/support/jsonTypeUtils.js";import{convertFromGeometry as a,generalizeOptimizedGeometry as o,quantizeOptimizedGeometry as s}from"../../../../../layers/graphics/featureConversionUtils.js";import c from"../../../../../layers/graphics/OptimizedGeometry.js";import{tileSize as l}from"../../../engine/webgl/definitions.js";import{FeatureSetReader as u}from"./FeatureSetReader.js";class d extends u{static from(e,t,n){return new d(e,t,n)}constructor(e,t,n){super(n),this._items=e,this._tile=t,this._index=-1,this._cachedGeometry=null;let r=t.lod;r.wrap&&(this._wrappingInfo={worldSizeX:r.worldSize[0]})}get _current(){return this._items[this._index]}getItem(){return this._current}getZOrder(){return this._current.zOrder}getMeshWriters(){return this._current.symbolResource?.symbolInfo.meshWriters??{writers:[],dependencies:new Map,exports:new Map,requiresCoordination:!1}}hasField(e){return this._current.attributes[e]!=null}field(e){return this.readAttribute(e)}get geometryType(){let e=n(this._current.geometry);return e===`esriGeometryPoint`?`esriGeometryMultipoint`:e}getCursor(){return this.copy()}copy(){let e=new d(this._items,this._tile,this.metadata);return this.copyInto(e),e}copyInto(e){super.copyInto(e),e._cachedGeometry=this._cachedGeometry,e._index=this._index}get fields(){throw Error(`Fields reading not supported to graphics.`)}get hasFeatures(){return!!this._items.length}get hasNext(){return this._index+1<this._items.length}get exceededTransferLimit(){throw Error(`InternalError: exceededTransferLimit not implemented for graphics.`)}get hasZ(){return r(this._current.projectedGeometry)}get hasM(){return i(this._current.projectedGeometry)}get usedMemory(){return this._current.usedMemory}getInTransform(){return this._tile.transform}getSize(){return this._items.length}getAttributeHash(){let e=``;for(let t in this._current.attributes)e+=this._current.attributes[t];return e}getObjectId(){return this._items[this._index].objectId}getDisplayId(){return this._current.displayId}setDisplayId(e){throw Error(`InternalError: Setting displayId not supported for graphics.`)}setIndex(e){this._index=e}getIndex(){return this._index}next(){for(this._cachedGeometry=null;++this._index<this._items.length&&!this._getExists(););return this._index<this._items.length}readGeometryArea(){throw Error(`InternalError: readGeometryArea not supported for graphics.`)}_readGeometry(){if(!this._cachedGeometry){let e=a(this._current.projectedGeometry);if(this.geometryType===`esriGeometryPolyline`&&(e=o(e,this.geometryType,this._tile.transform.scale[0])),this._cachedGeometry=s(e,this.geometryType,this._tile.transform),!this._cachedGeometry)return null;this._wrapGeometry(this._cachedGeometry)}return this._cachedGeometry}_wrapGeometry(e){if(!this._wrappingInfo)return;let{worldSizeX:t}=this._wrappingInfo;if(e.isPoint){if(t===1){e.coords.push(l,0),e.coords.push(-l*2,0),e.lengths.push(3);return}if(t===2){e.coords.push(l*2,0),e.coords.push(-l*4,0),e.lengths.push(3);return}this._wrapVertex(e.coords,0,2,t)}else if(this.geometryType===`esriGeometryMultipoint`){if(t===1){let t=e.coords.slice();t[0]-=512;let n=e.coords.slice();n[0]+=512,e.coords.push(...t,...n);let r=e.lengths[0];e.lengths.push(r,r);return}this._wrapVertex(e.coords,0,2,t)}}_wrapVertex(e,t,n,r){let i=t*n,a=e[i];a<-(l*(r-2))?e[i]=a+l*r:a>l*(r-1)&&(e[i]=a-l*r)}_readX(){let e=this._readGeometry();return e==null?0:e.coords[0]}_readY(){let e=this._readGeometry();return e==null?0:e.coords[1]}_readServerCentroid(){switch(this.geometryType){case`esriGeometryPolygon`:{let e=t(this._current.projectedGeometry),n=new c([],e,this.hasZ,!1);return s(n,this.geometryType,this._tile.transform)}case`esriGeometryPolyline`:{let t=this._current.projectedGeometry,n=e(t.paths,this.hasZ),r=new c([],n,this.hasZ,!1);return s(r,this.geometryType,this._tile.transform)}}return null}_readAttribute(e,t){let n=this._current.attributes[e];if(n!==void 0)return n;let r=e.toLowerCase();for(let e in this._current.attributes)if(e.toLowerCase()===r)return this._current.attributes[e]}_readAttributes(){return this._current.attributes}}export{d as GraphicsReader};
|
|
2
|
+
import{ringsCentroid as e,polygonCentroid as t}from"../../../../../geometry/support/centroid.js";import{getJsonType as n,isGeometryWithZ as r,isGeometryWithM as i}from"../../../../../geometry/support/jsonTypeUtils.js";import{convertFromGeometry as a,generalizeOptimizedGeometry as o,quantizeOptimizedGeometry as s}from"../../../../../layers/graphics/featureConversionUtils.js";import c from"../../../../../layers/graphics/OptimizedGeometry.js";import{tileSize as l}from"../../../engine/webgl/definitions.js";import{FeatureSetReader as u}from"./FeatureSetReader.js";class d extends u{static from(e,t,n){return new d(e,t,n)}constructor(e,t,n){super(n),this._items=e,this._tile=t,this._index=-1,this._cachedGeometry=null;let r=t.lod;r.wrap&&(this._wrappingInfo={worldSizeX:r.worldSize[0]})}get _current(){return this._items[this._index]}getItem(){return this._current}getZOrder(){return this._current.zOrder}getMeshWriters(){return this._current.symbolResource?.symbolInfo.meshWriters??{writers:[],dependencies:new Map,exports:new Map,requiresCoordination:!1}}hasField(e){return this._current.attributes[e]!=null}field(e){return this.readAttribute(e)}get geometryType(){let e=n(this._current.geometry);return e===`esriGeometryPoint`?`esriGeometryMultipoint`:e}getCursor(){return this.copy()}copy(){let e=new d(this._items,this._tile,this.metadata);return this.copyInto(e),e}copyInto(e){super.copyInto(e),e._cachedGeometry=this._cachedGeometry,e._index=this._index}get fields(){throw Error(`Fields reading not supported to graphics.`)}get hasFeatures(){return!!this._items.length}get hasNext(){return this._index+1<this._items.length}get exceededTransferLimit(){throw Error(`InternalError: exceededTransferLimit not implemented for graphics.`)}get hasZ(){return r(this._current.projectedGeometry)}get hasM(){return i(this._current.projectedGeometry)}get usedMemory(){return this._current.usedMemory}getInTransform(){return this._tile.transform}getSize(){return this._items.length}getAttributeHash(){let e=``;for(let t in this._current.attributes)e+=this._current.attributes[t];return e}getObjectId(){return this._items[this._index].objectId}getDisplayId(){return this._current.displayId}setDisplayId(e){throw Error(`InternalError: Setting displayId not supported for graphics.`)}setIndex(e){this._cachedGeometry=null,this._index=e}getIndex(){return this._index}next(){for(this._cachedGeometry=null;++this._index<this._items.length&&!this._getExists(););return this._index<this._items.length}readGeometryArea(){throw Error(`InternalError: readGeometryArea not supported for graphics.`)}_readGeometry(){if(!this._cachedGeometry){let e=a(this._current.projectedGeometry);if(this.geometryType===`esriGeometryPolyline`&&(e=o(e,this.geometryType,this._tile.transform.scale[0])),this._cachedGeometry=s(e,this.geometryType,this._tile.transform),!this._cachedGeometry)return null;this._wrapGeometry(this._cachedGeometry)}return this._cachedGeometry}_wrapGeometry(e){if(!this._wrappingInfo)return;let{worldSizeX:t}=this._wrappingInfo;if(e.isPoint){if(t===1){e.coords.push(l,0),e.coords.push(-l*2,0),e.lengths.push(3);return}if(t===2){e.coords.push(l*2,0),e.coords.push(-l*4,0),e.lengths.push(3);return}this._wrapVertex(e.coords,0,2,t)}else if(this.geometryType===`esriGeometryMultipoint`){if(t===1){let t=e.coords.slice();t[0]-=512;let n=e.coords.slice();n[0]+=512,e.coords.push(...t,...n);let r=e.lengths[0];e.lengths.push(r,r);return}this._wrapVertex(e.coords,0,2,t)}}_wrapVertex(e,t,n,r){let i=t*n,a=e[i];a<-(l*(r-2))?e[i]=a+l*r:a>l*(r-1)&&(e[i]=a-l*r)}_readX(){let e=this._readGeometry();return e==null?0:e.coords[0]}_readY(){let e=this._readGeometry();return e==null?0:e.coords[1]}_readServerCentroid(){switch(this.geometryType){case`esriGeometryPolygon`:{let e=t(this._current.projectedGeometry),n=new c([],e,this.hasZ,!1);return s(n,this.geometryType,this._tile.transform)}case`esriGeometryPolyline`:{let t=this._current.projectedGeometry,n=e(t.paths,this.hasZ),r=new c([],n,this.hasZ,!1);return s(r,this.geometryType,this._tile.transform)}}return null}_readAttribute(e,t){let n=this._current.attributes[e];if(n!==void 0)return n;let r=e.toLowerCase();for(let e in this._current.attributes)if(e.toLowerCase()===r)return this._current.attributes[e]}_readAttributes(){return this._current.attributes}}export{d as GraphicsReader};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{isSome as n}from"../../../../core/arrayUtils.js";import has from"../../../../core/has.js";import{IdentifiableMixin as r}from"../../../../core/Identifiable.js";import{assertIsSome as i}from"../../../../core/maybe.js";import{ignoreAbortErrors as a,throwIfAborted as o}from"../../../../core/promiseUtils.js";import{watch as s}from"../../../../core/reactiveUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{create as u}from"../../../../geometry/support/aaBoundingRect.js";import{isPolyline as d,isPolygon as f,isExtent as p,getJsonType as m}from"../../../../geometry/support/jsonTypeUtils.js";import h from"../../../../layers/support/FieldsIndex.js";import{symbolToCIM as g,CIMSymbolHelper as _}from"../../../../symbols/cim/CIMSymbolHelper.js";import{OverrideHelper as v}from"../../../../symbols/cim/OverrideHelper.js";import{errorPointSymbol2D as y,errorPolylineSymbol2D as b,errorPolygonSymbol2D as x}from"../../../../symbols/support/defaults.js";import{filterFlag0 as S}from"../../engine/webgl/definitions.js";import{FeatureTile as C}from"../../engine/webgl/FeatureTile.js";import{MeshData as w}from"../../engine/webgl/mesh/MeshData.js";import{createCalloutMeshWriterCoordinator as T}from"../../engine/webgl/mesh/factories/CalloutMeshWriterCoordinator.js";import{MeshWriterGroupCoordinator as E}from"../../engine/webgl/mesh/factories/MeshWriterGroupCoordinator.js";import{ResourceProxy as D}from"../../engine/webgl/mesh/factories/ResourceProxy.js";import{createGraphicSymbolMeshSchemas as O}from"../../engine/webgl/shaderGraph/techniques/createGraphicSymbolMeshSchemas.js";import{createMeshWriterGroup as k}from"../../engine/webgl/util/Matcher.js";import{createStorageSchema as A}from"../features/schema/processor/StorageSchema.js";import{AttributeStore as j}from"../features/support/AttributeStore.js";import{ComputedAttributeStorage as M}from"../features/support/ComputedAttributeStorage.js";import{GraphicsMetadata as N}from"../features/support/FeatureMetadata.js";import{GraphicsReader as P}from"../features/support/GraphicsReader.js";import F from"./GraphicStore.js";import{FeatureCommandQueue as I}from"../support/FeatureCommandQueue.js";import{UpdateTracking2D as L}from"../support/UpdateTracking2D.js";class R{static getOrCreate(e,t,n){let r=t.get(e.id);return r||(r=new R(e,n),t.set(e.id,r)),r}static fromItems(e,t,n){let r=new R(e,n);for(let e of t)r.append(e);return r}constructor(e,t){this.tile=e,this.metadata=t,this.addedOrModified=[],this.removed=[],this.objectIdMap=null}get reader(){return this._reader||=P.from(this.addedOrModified,this.tile,this.metadata),this._reader}append(e){this.addedOrModified.push(e),e.hasAnimations&&(this.objectIdMap=this.objectIdMap||{},this.objectIdMap[e.displayId]=e.objectId)}}let z=class extends r(t){constructor(e){super(e),this._attached=!1,this._tiles=new Map,this._controller=new AbortController,this._highlightFlagsByObjectId=new Map,this._hashToSymbolInfo=new Map,this._lastCleanup=performance.now(),this._cleanupRequired=!0,this.lastUpdateId=-1,this.renderer=null,this._updateTracking=new L({debugName:`GraphicsView2D`}),this.updateRequested=!1,this.defaultPointSymbolEnabled=!0,this._commandQueue=new I({process:e=>{switch(e.type){case`update`:return this._update();default:throw Error(`InternalError: Unsupported command`)}}}),this.graphicUpdateHandler=this.graphicUpdateHandler.bind(this)}destroy(){this.container.destroy(),this.view=null,this.renderer=null,this._set(`graphics`,null),this._controller.abort(),this._graphicStore.clear(),this._graphicStore.destroy(),this._attributeStore=null,this._hashToSymbolInfo.clear(),this._updateTracking.destroy(),this._commandQueue.destroy()}_initAttributeStore(){this._storage=new M({spatialReference:this.view.spatialReference,fields:new h}),this._attributeStore=new j({isLocal:!0,update:e=>{has(`esri-2d-update-debug`)&&console.debug(`[Id: ${this.layerId}] GraphicsView2D.AttributeStoreView.updateStart`,{message:e}),this.container.attributeView.requestUpdate(e),this.container.requestRender(),has(`esri-2d-update-debug`)&&console.debug(`[Id: ${this.layerId}] GraphicsView2D.AttributeStoreView.updateEnd`,{message:e})}});let e=A(null,[]);this._attributeStore.update(e,this._storage,null)}initialize(){this._initAttributeStore(),this._metadata=N.createGraphics(this.view.spatialReference),this._resourceProxy=new D({fetch:e=>Promise.all(e.map(e=>this.view.stage.textureManager.rasterizeItem(e))),fetchDictionary:e=>{throw Error(`InternalError: Graphics do not support Dictionary requests`)},fetchMesh:e=>{throw Error(`InternalError: Graphics do not support Mesh requests`)}}),this.addHandles([s(()=>this._effectiveRenderer,()=>this._pushUpdate()),this.view.graphicsTileStore.on(`update`,this._onTileUpdate.bind(this)),this.container.on(`attach`,()=>{this.addHandles([this.graphics.on(`change`,()=>this._pushUpdate())]),this._graphicStore?.destroy(),this._graphicStore=new F(this.view.spatialReference,this._cimResourceManager,this.view.featuresTilingScheme,this.view.state.scale,this._attributeStore),this._attached=!0,this.requestUpdate(),this._pushUpdate()})]),this._updateTracking.addUpdateTracking(`CommandQueue`,this._commandQueue.updateTracking);let e=this.view.graphicsTileStore.tiles;this._onTileUpdate({added:e,removed:[]})}get _effectiveRenderer(){return typeof this.renderer==`function`?this.renderer():this.renderer}get _cimResourceManager(){return this.view.stage.textureManager.resourceManager}get updating(){return!this._attached||this._updateTracking.updating}hitTest(e,t){if(!this.view||this.view.suspended)return[];let{resolution:r,rotation:i}=this.view.state,a=this._graphicStore.hitTest(e,t,r,i),o=new Set(a),s=this.graphics.items.reduce((e,t)=>(o.has(t.uid)&&e.set(t.uid,t),e),new Map);return a.map(e=>s.get(e)).filter(n)}requestUpdate(){this.updateRequested||(this.updateRequested=!0,this.requestUpdateCallback()),this.notifyChange(`updating`)}processUpdate(e){this.updateRequested&&(this.updateRequested=!1,this.update(e))}viewChange(){this.requestUpdate()}setHighlightFilters(e){this._highlightFlagsByObjectId.clear();for(let{order:t,filters:n}of e){let e=1<<t;for(let t of n)for(let n of t.objectIds??[]){let t=this._highlightFlagsByObjectId.get(n)??0;this._highlightFlagsByObjectId.set(n,t|e)}}if(this.container.setHighlightActive(this._highlightFlagsByObjectId.size>0),this._attached)for(let e of this._graphicStore.items())this._setFilterState(e);this._pushUpdate()}graphicUpdateHandler(e){this._pushUpdate()}update(e){this.updateRequested=!1,this._attached&&this._graphicStore.updateLevel(e.state.resolution)&&this.pushUpdate()}pushUpdate(){this._pushUpdate()}_pushUpdate(){a(this._commandQueue.push({type:`update`}))}async _update(){try{if(has(`esri-2d-update-debug`)&&console.debug(`[Id: ${this.layerId}] GraphicsView._update start`),this.graphics.destroyed)return;let e=await this._graphicStore.update(this.graphics,e=>this._getSymbolForGraphic(e),e=>this._ensureSymbolResource(e));for(let t of e.updated)this.container.restartAnimation(t.objectId);if(!e.hasAnyUpdate()){this._attributeStore.sendUpdates();return}e.removed.length&&(this._cleanupRequired=!0),has(`esri-2d-update-debug`)&&console.debug(`[Id: ${this.layerId}] GraphicsView updateMessage`,e);let t=this._createTileMessages(e);await this._densifyItemsForDisplay(t),await this._fetchResources(t),this._write(t);for(let t of e.added)this._setFilterState(t);for(let t of e.updated)this._setFilterState(t);has(`esri-2d-update-debug`)&&console.debug(`[Id: ${this.layerId}] GraphicsView sendUpdate`,e),this._attributeStore.sendUpdates(),has(`esri-2d-update-debug`)&&console.debug(`[Id: ${this.layerId}] GraphicsView sendUpdate.await`,e)}catch{}this._cleanupSharedResources()}_createTileMessages(e){let t=new Map;for(let n of e.added){let e=this.view.graphicsTileStore.getIntersectingTiles(n.symbolBounds);for(let r of e)R.getOrCreate(r,t,this._metadata).append(n)}for(let n of e.updated){let e=this.view.graphicsTileStore.getIntersectingTiles(n.prevSymbolBounds),r=this.view.graphicsTileStore.getIntersectingTiles(n.symbolBounds);for(let r of e)R.getOrCreate(r,t,this._metadata).removed.push(n.displayId);for(let e of r)R.getOrCreate(e,t,this._metadata).append(n)}for(let n of e.removed){let e=this.view.graphicsTileStore.getIntersectingTiles(n.symbolBounds);for(let r of e)R.getOrCreate(r,t,this._metadata).removed.push(n.displayId)}return Array.from(t.values())}async _densifyItemsForDisplay(e){let t=new Map;for(let n of e)for(let e of n.addedOrModified)t.has(e)||t.set(e,e.densifyCurvedGeometryForDisplay(this.view.spatialReference));await Promise.all(t.values())}async _fetchResources(e){let t={timeZone:null,timeExtent:null};for(let{tile:n,reader:r}of e){has(`esri-2d-update-debug`)&&console.debug(`Id[${this.layerId}] Tile[${n.id}] GraphicsView fetchResources`,e);let i=r.getCursor();for(;i.next();)for(let e of i.getMeshWriters().writers)e.enqueueRequest(this._resourceProxy,i,n.createArcadeEvaluationOptions(t))}await this._resourceProxy.fetchEnqueuedResources()}_write(e){for(let t of e){has(`esri-2d-update-debug`)&&console.debug(`Id[${this.layerId}] Tile[${t.tile.id}] GraphicsView write`,t);let e=this._writeMeshes(t),n=this._tiles.get(t.tile.key);n||=this._createFeatureTile(t.tile.key),has(`esri-2d-update-debug`)&&console.debug(`Id[${this.layerId}] Tile[${t.tile.id}] GraphicsView onTileData`,t),this.container.onTileData(n,{type:`update`,modify:e,remove:t.removed,end:!1,attributeEpoch:this._attributeStore.epoch,objectIdMap:t.objectIdMap}),this.container.requestRender()}}_writeMeshes(e){let t={timeZone:null,timeExtent:null},n=new w(e.tile.id),r=e.reader.getCursor();for(;r.next();)n.entityStart(r.getDisplayId(),r.getZOrder()),new E({out:n,proxy:this._resourceProxy,feature:r,options:e.tile.createArcadeEvaluationOptions(t),level:e.tile.level,coordinatorFactories:[T]}).coordinateAndWrite(r.getMeshWriters()),n.entityEnd();return{...n.serialize().message,tileId:e.tile.id,requiresRefresh:!1}}_setFilterState(e){let t=e.displayId,n=this._highlightFlagsByObjectId.get(e.objectId)??0;this._attributeStore.setData(t,0,0,n|(e.visible?S:0))}_getSymbolForGraphic(e){return e.symbol==null?this._effectiveRenderer==null?this._getNullSymbol(e):this._effectiveRenderer.getSymbol(e):e.symbol}async _ensureSymbolResource(e){if(!e.symbol)return;let t=await this._getSymbolInfo(e.symbol);if(!t)return;let n=t.linearCIM.filter(e=>e.type===`text`);e.symbolResource=n.length>0?{symbolInfo:t,textInfo:await this._getTextResources(e,n)}:{symbolInfo:t}}_getSymbolInfo(e){let t=e.hash();return this._hashToSymbolInfo.has(t)||this._hashToSymbolInfo.set(t,this._createSymbolInfo(t,e).catch(e=>null)),this._hashToSymbolInfo.get(t)}async _createSymbolInfo(e,t){let n=await this._convertToCIMSymbol(t),r=await this._createLinearCIM(n);return{hash:e,cimSymbol:n,linearCIM:r,meshWriters:await this._createMeshWriters(n,r,t.type===`text`)}}async _convertToCIMSymbol(e){let t=g(e);return t.type===`web-style`?this._convertToCIMSymbol(await t.fetchSymbol({acceptedFormats:[`cim`,`web`]})):t}async _createLinearCIM(e){return await _.normalizeSymbolAndFetchResources(e.symbol,this._cimResourceManager),this.view.stage.cimAnalyzer.analyzeSymbolReference(e,!1)}async _createMeshWriters(e,t,n){o(this._controller.signal);let r=this.container.instanceStore,i=this.view.stage.meshWriterRegistry,a=await O(e,t,r,n),s=await Promise.all(a.map(e=>i.createMeshWriter(this._storage,this._resourceProxy,{tileInfo:this.view.featuresTilingScheme.tileInfo},e,null)));return k(s,a)}_onTileUpdate(e){if(e.added&&e.added.length>0)for(let t of e.added)this._updateTracking.consumePromise(this._addTile(t));if(e.removed&&e.removed.length>0)for(let t of e.removed)this._removeTile(t.key)}_createFeatureTile(e){let t=this.view.featuresTilingScheme.getTileBounds(u(),e),n=this.view.featuresTilingScheme.getTileResolution(e.level),r=new C(e,n,t[0],t[3],this.container.labelStore);return r.presenting=!0,this._tiles.set(e,r),this.container.addChild(r),r}async _addTile(e){if(!this._attached)return;let t=this._graphicStore.queryItems(e);if(!t.length)return;let n=this._createFeatureTile(e.key),r=R.fromItems(e,t,this._metadata);await this._densifyItemsForDisplay([r]),await this._fetchResources([r]);let i=this._writeMeshes(r);n.update({type:`append`,append:i,end:!0,attributeEpoch:this._attributeStore.epoch,objectIdMap:r.objectIdMap})}_removeTile(e){if(!this._tiles.has(e))return;let t=this._tiles.get(e);this.container.removeChild(t),t.destroy(),this._tiles.delete(e)}_getNullSymbol(e){let t=e.geometry;return t?d(t)?b:f(t)||p(t)?x:this.defaultPointSymbolEnabled?y:null:this.defaultPointSymbolEnabled?y:null}async _getTextResources(e,t){let n=[],r=[];for(let i=0;i<t.length;i++){let a=t[i],{resource:o,overrides:s}=a.textRasterizationParam;if(s?.length>0){let t=v.resolveSymbolOverrides({type:`CIMSymbolReference`,primitiveOverrides:s,symbol:{type:`CIMPointSymbol`,symbolLayers:[{type:`CIMVectorMarker`,enable:!0,size:o.symbol.height,anchorPointUnits:`Relative`,frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:`CIMMarkerGraphic`,geometry:{x:0,y:0},symbol:o.symbol,textString:o.textString}],scaleSymbolsProportionally:!0,respectFrame:!0}]}},e,this.view.spatialReference,null,m(e.projectedGeometry),null,null);t.then(e=>{let{textString:t}=e.symbolLayers[0].markerGraphics[0];r.push({type:`cim-rasterization-info`,resource:{type:`text`,textString:t||``,font:o.font}}),a.text=o.textString=t||``}),n.push(t)}else r.push({type:`cim-rasterization-info`,resource:o})}n.length>0&&await Promise.all(n);let a=r.map(e=>this.view.stage.textureManager.rasterizeItem(e)),o=await Promise.all(a);i(o);let s=new Map;for(let e=0;e<t.length;e++){let n=t[e];s.set(n.textRasterizationParam.resource.symbol,{text:n.text,glyphMosaicItems:o[e]})}return s}_cleanupSharedResources(){if(!this._cleanupRequired)return;let e=performance.now();if(e-this._lastCleanup<5e3)return;this._cleanupRequired=!1,this._lastCleanup=e;let t=new Set;for(let e of this._graphicStore.items()){let n=e.symbolResource?.symbolInfo.hash;t.add(n)}let n=new Set(this._hashToSymbolInfo.keys());for(let e of n.values())t.has(e)||this._hashToSymbolInfo.delete(e)}};e([c()],z.prototype,`_effectiveRenderer`,null),e([c({constructOnly:!0})],z.prototype,`layerId`,void 0),e([c({constructOnly:!0})],z.prototype,`requestUpdateCallback`,void 0),e([c()],z.prototype,`container`,void 0),e([c({constructOnly:!0})],z.prototype,`graphics`,void 0),e([c()],z.prototype,`renderer`,void 0),e([c()],z.prototype,`_updateTracking`,void 0),e([c()],z.prototype,`updating`,null),e([c()],z.prototype,`view`,void 0),e([c()],z.prototype,`updateRequested`,void 0),e([c()],z.prototype,`defaultPointSymbolEnabled`,void 0),z=e([l(`esri.views.2d.layers.graphics.GraphicsView2D`)],z);const B=z;export{B as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{isSome as n}from"../../../../core/arrayUtils.js";import has from"../../../../core/has.js";import{IdentifiableMixin as r}from"../../../../core/Identifiable.js";import{assertIsSome as i}from"../../../../core/maybe.js";import{ignoreAbortErrors as a,throwIfAborted as o}from"../../../../core/promiseUtils.js";import{watch as s}from"../../../../core/reactiveUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{create as u}from"../../../../geometry/support/aaBoundingRect.js";import{isPolyline as d,isPolygon as f,isExtent as p,getJsonType as m}from"../../../../geometry/support/jsonTypeUtils.js";import h from"../../../../layers/support/FieldsIndex.js";import{symbolToCIM as g,CIMSymbolHelper as _}from"../../../../symbols/cim/CIMSymbolHelper.js";import{OverrideHelper as v}from"../../../../symbols/cim/OverrideHelper.js";import{errorPointSymbol2D as y,errorPolylineSymbol2D as b,errorPolygonSymbol2D as x}from"../../../../symbols/support/defaults.js";import{filterFlag0 as S}from"../../engine/webgl/definitions.js";import{FeatureTile as C}from"../../engine/webgl/FeatureTile.js";import{MeshData as w}from"../../engine/webgl/mesh/MeshData.js";import{createCalloutMeshWriterCoordinator as T}from"../../engine/webgl/mesh/factories/CalloutMeshWriterCoordinator.js";import{MeshWriterGroupCoordinator as E}from"../../engine/webgl/mesh/factories/MeshWriterGroupCoordinator.js";import{ResourceProxy as D}from"../../engine/webgl/mesh/factories/ResourceProxy.js";import{createGraphicSymbolMeshSchemas as O}from"../../engine/webgl/shaderGraph/techniques/createGraphicSymbolMeshSchemas.js";import{createMeshWriterGroup as k}from"../../engine/webgl/util/Matcher.js";import{createStorageSchema as A}from"../features/schema/processor/StorageSchema.js";import{AttributeStore as j}from"../features/support/AttributeStore.js";import{ComputedAttributeStorage as M}from"../features/support/ComputedAttributeStorage.js";import{GraphicsMetadata as N}from"../features/support/FeatureMetadata.js";import{GraphicsReader as P}from"../features/support/GraphicsReader.js";import F from"./GraphicStore.js";import{FeatureCommandQueue as I}from"../support/FeatureCommandQueue.js";import{UpdateTracking2D as L}from"../support/UpdateTracking2D.js";class R{static getOrCreate(e,t,n){let r=t.get(e.id);return r||(r=new R(e,n),t.set(e.id,r)),r}static fromItems(e,t,n){let r=new R(e,n);for(let e of t)r.append(e);return r}constructor(e,t){this.tile=e,this.metadata=t,this.addedOrModified=[],this.removed=[],this.objectIdMap=null}get reader(){return this._reader||=P.from(this.addedOrModified,this.tile,this.metadata),this._reader}append(e){this.addedOrModified.push(e),e.hasAnimations&&(this.objectIdMap=this.objectIdMap||{},this.objectIdMap[e.displayId]=e.objectId)}}let z=class extends r(t){constructor(e){super(e),this._attached=!1,this._tiles=new Map,this._controller=new AbortController,this._highlightFlagsByObjectId=new Map,this._hashToSymbolInfo=new Map,this._lastCleanup=performance.now(),this._cleanupRequired=!0,this.lastUpdateId=-1,this.renderer=null,this._updateTracking=new L({debugName:`GraphicsView2D`}),this.updateRequested=!1,this.defaultPointSymbolEnabled=!0,this._commandQueue=new I({process:e=>{switch(e.type){case`update`:return this._update();default:throw Error(`InternalError: Unsupported command`)}}}),this.graphicUpdateHandler=this.graphicUpdateHandler.bind(this)}destroy(){this.container.destroy(),this.view=null,this.renderer=null,this._set(`graphics`,null),this._controller.abort(),this._graphicStore.clear(),this._graphicStore.destroy(),this._attributeStore=null,this._hashToSymbolInfo.clear(),this._updateTracking.destroy(),this._commandQueue.destroy()}_initAttributeStore(){this._storage=new M({spatialReference:this.view.spatialReference,fields:new h}),this._attributeStore=new j({isLocal:!0,update:e=>{has(`esri-2d-update-debug`)&&console.debug(`[Id: ${this.layerId}] GraphicsView2D.AttributeStoreView.updateStart`,{message:e}),this.container.attributeView.requestUpdate(e),this.container.requestRender(),has(`esri-2d-update-debug`)&&console.debug(`[Id: ${this.layerId}] GraphicsView2D.AttributeStoreView.updateEnd`,{message:e})}});let e=A(null,[]);this._attributeStore.update(e,this._storage,null,0,{dependencies:[],timeZoneChanged:!1,currentUserChanged:!1})}initialize(){this._initAttributeStore(),this._metadata=N.createGraphics(this.view.spatialReference),this._resourceProxy=new D({fetch:e=>Promise.all(e.map(e=>this.view.stage.textureManager.rasterizeItem(e))),fetchDictionary:e=>{throw Error(`InternalError: Graphics do not support Dictionary requests`)},fetchMesh:e=>{throw Error(`InternalError: Graphics do not support Mesh requests`)}}),this.addHandles([s(()=>this._effectiveRenderer,()=>this._pushUpdate()),this.view.graphicsTileStore.on(`update`,this._onTileUpdate.bind(this)),this.container.on(`attach`,()=>{this.addHandles([this.graphics.on(`change`,()=>this._pushUpdate())]),this._graphicStore?.destroy(),this._graphicStore=new F(this.view.spatialReference,this._cimResourceManager,this.view.featuresTilingScheme,this.view.state.scale,this._attributeStore),this._attached=!0,this.requestUpdate(),this._pushUpdate()})]),this._updateTracking.addUpdateTracking(`CommandQueue`,this._commandQueue.updateTracking);let e=this.view.graphicsTileStore.tiles;this._onTileUpdate({added:e,removed:[]})}get _effectiveRenderer(){return typeof this.renderer==`function`?this.renderer():this.renderer}get _cimResourceManager(){return this.view.stage.textureManager.resourceManager}get updating(){return!this._attached||this._updateTracking.updating}hitTest(e,t){if(!this.view||this.view.suspended)return[];let{resolution:r,rotation:i}=this.view.state,a=this._graphicStore.hitTest(e,t,r,i),o=new Set(a),s=this.graphics.items.reduce((e,t)=>(o.has(t.uid)&&e.set(t.uid,t),e),new Map);return a.map(e=>s.get(e)).filter(n)}requestUpdate(){this.updateRequested||(this.updateRequested=!0,this.requestUpdateCallback()),this.notifyChange(`updating`)}processUpdate(e){this.updateRequested&&(this.updateRequested=!1,this.update(e))}viewChange(){this.requestUpdate()}setHighlightFilters(e){this._highlightFlagsByObjectId.clear();for(let{order:t,filters:n}of e){let e=1<<t;for(let t of n)for(let n of t.objectIds??[]){let t=this._highlightFlagsByObjectId.get(n)??0;this._highlightFlagsByObjectId.set(n,t|e)}}if(this.container.setHighlightActive(this._highlightFlagsByObjectId.size>0),this._attached)for(let e of this._graphicStore.items())this._setFilterState(e);this._pushUpdate()}graphicUpdateHandler(e){this._pushUpdate()}update(e){this.updateRequested=!1,this._attached&&this._graphicStore.updateLevel(e.state.resolution)&&this.pushUpdate()}pushUpdate(){this._pushUpdate()}_pushUpdate(){a(this._commandQueue.push({type:`update`}))}async _update(){try{if(has(`esri-2d-update-debug`)&&console.debug(`[Id: ${this.layerId}] GraphicsView._update start`),this.graphics.destroyed)return;let e=await this._graphicStore.update(this.graphics,e=>this._getSymbolForGraphic(e),e=>this._ensureSymbolResource(e));for(let t of e.updated)this.container.restartAnimation(t.objectId);if(!e.hasAnyUpdate()){this._attributeStore.sendUpdates();return}e.removed.length&&(this._cleanupRequired=!0),has(`esri-2d-update-debug`)&&console.debug(`[Id: ${this.layerId}] GraphicsView updateMessage`,e);let t=this._createTileMessages(e);await this._densifyItemsForDisplay(t),await this._fetchResources(t),this._write(t);for(let t of e.added)this._setFilterState(t);for(let t of e.updated)this._setFilterState(t);has(`esri-2d-update-debug`)&&console.debug(`[Id: ${this.layerId}] GraphicsView sendUpdate`,e),this._attributeStore.sendUpdates(),has(`esri-2d-update-debug`)&&console.debug(`[Id: ${this.layerId}] GraphicsView sendUpdate.await`,e)}catch{}this._cleanupSharedResources()}_createTileMessages(e){let t=new Map;for(let n of e.added){let e=this.view.graphicsTileStore.getIntersectingTiles(n.symbolBounds);for(let r of e)R.getOrCreate(r,t,this._metadata).append(n)}for(let n of e.updated){let e=this.view.graphicsTileStore.getIntersectingTiles(n.prevSymbolBounds),r=this.view.graphicsTileStore.getIntersectingTiles(n.symbolBounds);for(let r of e)R.getOrCreate(r,t,this._metadata).removed.push(n.displayId);for(let e of r)R.getOrCreate(e,t,this._metadata).append(n)}for(let n of e.removed){let e=this.view.graphicsTileStore.getIntersectingTiles(n.symbolBounds);for(let r of e)R.getOrCreate(r,t,this._metadata).removed.push(n.displayId)}return Array.from(t.values())}async _densifyItemsForDisplay(e){let t=new Map;for(let n of e)for(let e of n.addedOrModified)t.has(e)||t.set(e,e.densifyCurvedGeometryForDisplay(this.view.spatialReference));await Promise.all(t.values())}async _fetchResources(e){let t={timeZone:null,timeExtent:null};for(let{tile:n,reader:r}of e){has(`esri-2d-update-debug`)&&console.debug(`Id[${this.layerId}] Tile[${n.id}] GraphicsView fetchResources`,e);let i=r.getCursor();for(;i.next();)for(let e of i.getMeshWriters().writers)e.enqueueRequest(this._resourceProxy,i,n.createArcadeEvaluationOptions(t))}await this._resourceProxy.fetchEnqueuedResources()}_write(e){for(let t of e){has(`esri-2d-update-debug`)&&console.debug(`Id[${this.layerId}] Tile[${t.tile.id}] GraphicsView write`,t);let e=this._writeMeshes(t),n=this._tiles.get(t.tile.key);n||=this._createFeatureTile(t.tile.key),has(`esri-2d-update-debug`)&&console.debug(`Id[${this.layerId}] Tile[${t.tile.id}] GraphicsView onTileData`,t),this.container.onTileData(n,{type:`update`,modify:e,remove:t.removed,end:!1,attributeEpoch:this._attributeStore.epoch,objectIdMap:t.objectIdMap}),this.container.requestRender()}}_writeMeshes(e){let t={timeZone:null,timeExtent:null},n=new w(e.tile.id),r=e.reader.getCursor();for(;r.next();)n.entityStart(r.getDisplayId(),r.getZOrder()),new E({out:n,proxy:this._resourceProxy,feature:r,options:e.tile.createArcadeEvaluationOptions(t),level:e.tile.level,coordinatorFactories:[T]}).coordinateAndWrite(r.getMeshWriters()),n.entityEnd();return{...n.serialize().message,tileId:e.tile.id,requiresRefresh:!1}}_setFilterState(e){let t=e.displayId,n=this._highlightFlagsByObjectId.get(e.objectId)??0;this._attributeStore.setData(t,0,0,n|(e.visible?S:0))}_getSymbolForGraphic(e){return e.symbol==null?this._effectiveRenderer==null?this._getNullSymbol(e):this._effectiveRenderer.getSymbol(e):e.symbol}async _ensureSymbolResource(e){if(!e.symbol)return;let t=await this._getSymbolInfo(e.symbol);if(!t)return;let n=t.linearCIM.filter(e=>e.type===`text`);e.symbolResource=n.length>0?{symbolInfo:t,textInfo:await this._getTextResources(e,n)}:{symbolInfo:t}}_getSymbolInfo(e){let t=e.hash();return this._hashToSymbolInfo.has(t)||this._hashToSymbolInfo.set(t,this._createSymbolInfo(t,e).catch(e=>null)),this._hashToSymbolInfo.get(t)}async _createSymbolInfo(e,t){let n=await this._convertToCIMSymbol(t),r=await this._createLinearCIM(n);return{hash:e,cimSymbol:n,linearCIM:r,meshWriters:await this._createMeshWriters(n,r,t.type===`text`)}}async _convertToCIMSymbol(e){let t=g(e);return t.type===`web-style`?this._convertToCIMSymbol(await t.fetchSymbol({acceptedFormats:[`cim`,`web`]})):t}async _createLinearCIM(e){return await _.normalizeSymbolAndFetchResources(e.symbol,this._cimResourceManager),this.view.stage.cimAnalyzer.analyzeSymbolReference(e,!1)}async _createMeshWriters(e,t,n){o(this._controller.signal);let r=this.container.instanceStore,i=this.view.stage.meshWriterRegistry,a=await O(e,t,r,n),s=await Promise.all(a.map(e=>i.createMeshWriter(this._storage,this._resourceProxy,{tileInfo:this.view.featuresTilingScheme.tileInfo},e,null)));return k(s,a)}_onTileUpdate(e){if(e.added&&e.added.length>0)for(let t of e.added)this._updateTracking.consumePromise(this._addTile(t));if(e.removed&&e.removed.length>0)for(let t of e.removed)this._removeTile(t.key)}_createFeatureTile(e){let t=this.view.featuresTilingScheme.getTileBounds(u(),e),n=this.view.featuresTilingScheme.getTileResolution(e.level),r=new C(e,n,t[0],t[3],this.container.labelStore);return r.presenting=!0,this._tiles.set(e,r),this.container.addChild(r),r}async _addTile(e){if(!this._attached)return;let t=this._graphicStore.queryItems(e);if(!t.length)return;let n=this._createFeatureTile(e.key),r=R.fromItems(e,t,this._metadata);await this._densifyItemsForDisplay([r]),await this._fetchResources([r]);let i=this._writeMeshes(r);n.update({type:`append`,append:i,end:!0,attributeEpoch:this._attributeStore.epoch,objectIdMap:r.objectIdMap})}_removeTile(e){if(!this._tiles.has(e))return;let t=this._tiles.get(e);this.container.removeChild(t),t.destroy(),this._tiles.delete(e)}_getNullSymbol(e){let t=e.geometry;return t?d(t)?b:f(t)||p(t)?x:this.defaultPointSymbolEnabled?y:null:this.defaultPointSymbolEnabled?y:null}async _getTextResources(e,t){let n=[],r=[];for(let i=0;i<t.length;i++){let a=t[i],{resource:o,overrides:s}=a.textRasterizationParam;if(s?.length>0){let t=v.resolveSymbolOverrides({type:`CIMSymbolReference`,primitiveOverrides:s,symbol:{type:`CIMPointSymbol`,symbolLayers:[{type:`CIMVectorMarker`,enable:!0,size:o.symbol.height,anchorPointUnits:`Relative`,frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:`CIMMarkerGraphic`,geometry:{x:0,y:0},symbol:o.symbol,textString:o.textString}],scaleSymbolsProportionally:!0,respectFrame:!0}]}},e,this.view.spatialReference,null,m(e.projectedGeometry),null,null);t.then(e=>{let{textString:t}=e.symbolLayers[0].markerGraphics[0];r.push({type:`cim-rasterization-info`,resource:{type:`text`,textString:t||``,font:o.font}}),a.text=o.textString=t||``}),n.push(t)}else r.push({type:`cim-rasterization-info`,resource:o})}n.length>0&&await Promise.all(n);let a=r.map(e=>this.view.stage.textureManager.rasterizeItem(e)),o=await Promise.all(a);i(o);let s=new Map;for(let e=0;e<t.length;e++){let n=t[e];s.set(n.textRasterizationParam.resource.symbol,{text:n.text,glyphMosaicItems:o[e]})}return s}_cleanupSharedResources(){if(!this._cleanupRequired)return;let e=performance.now();if(e-this._lastCleanup<5e3)return;this._cleanupRequired=!1,this._lastCleanup=e;let t=new Set;for(let e of this._graphicStore.items()){let n=e.symbolResource?.symbolInfo.hash;t.add(n)}let n=new Set(this._hashToSymbolInfo.keys());for(let e of n.values())t.has(e)||this._hashToSymbolInfo.delete(e)}};e([c()],z.prototype,`_effectiveRenderer`,null),e([c({constructOnly:!0})],z.prototype,`layerId`,void 0),e([c({constructOnly:!0})],z.prototype,`requestUpdateCallback`,void 0),e([c()],z.prototype,`container`,void 0),e([c({constructOnly:!0})],z.prototype,`graphics`,void 0),e([c()],z.prototype,`renderer`,void 0),e([c()],z.prototype,`_updateTracking`,void 0),e([c()],z.prototype,`updating`,null),e([c()],z.prototype,`view`,void 0),e([c()],z.prototype,`updateRequested`,void 0),e([c()],z.prototype,`defaultPointSymbolEnabled`,void 0),z=e([l(`esri.views.2d.layers.graphics.GraphicsView2D`)],z);const B=z;export{B as default};
|