@arcgis/core 4.27.0-next.20230419 → 4.27.0-next.20230421
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/WebMap.js +1 -1
- package/WebScene.js +1 -1
- package/arcade/arcadeAsyncRuntime.js +1 -1
- package/arcade/arcadeCompiler.js +1 -1
- package/arcade/arcadeRuntime.js +1 -1
- package/arcade/executionError.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{f64f95623d9296a91f95.js → 059ec6fd9b971de4b4c1.js} +1 -1
- package/assets/esri/core/workers/chunks/0d805fd9cd9ff3a636ca.js +1 -0
- package/assets/esri/core/workers/chunks/{1fe31a412479815e5e2d.js → 10770939900946feb20d.js} +1 -1
- package/assets/esri/core/workers/chunks/{5252f3cc244204edc299.js → 1216e939d363f96b6cc6.js} +1 -1
- package/assets/esri/core/workers/chunks/156dad2b7fed6749bae7.js +1 -0
- package/assets/esri/core/workers/chunks/15a97d3e42b00ac42984.js +1 -0
- package/assets/esri/core/workers/chunks/{d72c0c97cc4e30f1e4f2.js → 18704903814b9d73c708.js} +1 -1
- package/assets/esri/core/workers/chunks/1db5e4c8244dbc21590c.js +1 -0
- package/assets/esri/core/workers/chunks/2a1a5a1969e80a10dcca.js +1 -0
- package/assets/esri/core/workers/chunks/33b735faa582e6f39e9a.js +1 -0
- package/assets/esri/core/workers/chunks/34025ac04ca02531923a.js +1 -0
- package/assets/esri/core/workers/chunks/3e9f3479fd8558d9e3e3.js +1 -0
- package/assets/esri/core/workers/chunks/{d59274ac695dfcff1143.js → 46090b69e9161bc05141.js} +1 -1
- package/assets/esri/core/workers/chunks/{f7aa972cb3903847b3bf.js → 47bf38d910e71ac39bb8.js} +1 -1
- package/assets/esri/core/workers/chunks/{3978f4f68ada540ee3a3.js → 4f8a09b61267e5e26712.js} +1 -1
- package/assets/esri/core/workers/chunks/5183ecab7eddae7b70e8.js +1 -0
- package/assets/esri/core/workers/chunks/{a5c33b24b7ee042cb473.js → 51a0d1dabe7415515c77.js} +2 -2
- package/assets/esri/core/workers/chunks/541e6efc3b491e507410.js +1 -0
- package/assets/esri/core/workers/chunks/588256e65685ff21d2e9.js +1 -0
- package/assets/esri/core/workers/chunks/5c64fd3bf057a1a5527f.js +1 -0
- package/assets/esri/core/workers/chunks/6047bdaf4855506f8fdb.js +1 -0
- package/assets/esri/core/workers/chunks/6adb58f1bffc5d1c03bd.js +1 -0
- package/assets/esri/core/workers/chunks/770940417e6ddbdbb9d6.js +1 -0
- package/assets/esri/core/workers/chunks/{1c1d8be85297c483a606.js → 77c98121223a144170e3.js} +1 -1
- package/assets/esri/core/workers/chunks/80117007d86be4eb3bc3.js +1 -0
- package/assets/esri/core/workers/chunks/812cba53143565a825f1.js +1 -0
- package/assets/esri/core/workers/chunks/838849b751805615833a.js +1 -0
- package/assets/esri/core/workers/chunks/{9ca395f7bc8d397b5240.js → 88197520501fcc20b6e8.js} +1 -1
- package/assets/esri/core/workers/chunks/88f9dededcf60fd011ef.js +1 -0
- package/assets/esri/core/workers/chunks/88fdd288ef799a7ac48a.js +1 -0
- package/assets/esri/core/workers/chunks/8ae7fea9f7fda38dd207.js +1 -0
- package/assets/esri/core/workers/chunks/{0d080dd1ca6a71597409.js → 9265d4e9cfab2c7bbce5.js} +1 -1
- package/assets/esri/core/workers/chunks/{8d41305509fedb3603ac.js → 94041a9ced04aa281d40.js} +1 -1
- package/assets/esri/core/workers/chunks/98540791fcef86069e44.js +1 -0
- package/assets/esri/core/workers/chunks/9c1b2f82877ff79969f5.js +1 -0
- package/assets/esri/core/workers/chunks/a7b3cd537c9127b5e65e.js +1 -0
- package/assets/esri/core/workers/chunks/{3d1c697182237807ab49.js → abea316f2eac0f3086ab.js} +1 -1
- package/assets/esri/core/workers/chunks/ad85ade6a2cfb56cf328.js +1 -0
- package/assets/esri/core/workers/chunks/b833b4ea2973bb16792e.js +1 -0
- package/assets/esri/core/workers/chunks/be4aa835a7abfc809126.js +1 -0
- package/assets/esri/core/workers/chunks/c2ec6e904f96173a7b83.js +1 -0
- package/assets/esri/core/workers/chunks/{c25aa08b869f2777dc26.js → c4488a8d857c765da30e.js} +1 -1
- package/assets/esri/core/workers/chunks/c5c56b6d99db96a6755a.js +2 -0
- package/assets/esri/core/workers/chunks/{7f3b0856f594df2b044e.js → c727d38f71e52bee17e1.js} +1 -1
- package/assets/esri/core/workers/chunks/cf315d255f0dc8d50f21.js +1 -0
- package/assets/esri/core/workers/chunks/cf7676fdc09ad4835680.js +1 -0
- package/assets/esri/core/workers/chunks/cfad34c949cbe8a31ef8.js +1 -0
- package/assets/esri/core/workers/chunks/{edb4568fe281b5609092.js → d244e50c981146f018d2.js} +1 -1
- package/assets/esri/core/workers/chunks/{a2c9cb23f3e35e88da1d.js → d399b1b9cbf0737d1735.js} +1 -1
- package/assets/esri/core/workers/chunks/{df7dcd035997881cf2ef.js → d5c8119d6d34628d3126.js} +1 -1
- package/assets/esri/core/workers/chunks/d6b6bb8aecc85d2a3f6b.js +1 -0
- package/assets/esri/core/workers/chunks/{8dfa32cc8453f85faab0.js → dd1f8bade9c5c3b7929b.js} +1 -1
- package/assets/esri/core/workers/chunks/e11e60759821746259c6.js +1 -0
- package/assets/esri/core/workers/chunks/{e4b65c5a4575a5c1c49f.js → e356c576f9a7521a49b3.js} +1 -1
- package/assets/esri/core/workers/chunks/f02edf71645eb33bf92f.js +1 -0
- package/assets/esri/core/workers/chunks/f1a4165c2710ca90e5ea.js +1 -0
- package/assets/esri/core/workers/chunks/f57a3ee17869ced3dd33.js +1 -0
- package/assets/esri/core/workers/chunks/fc07f6e103d7f69a9909.js +1 -0
- package/chunks/WaterSurface.glsl.js +35 -20
- package/chunks/index.js +1 -1
- package/core/Loadable.js +1 -1
- package/core/Promise.js +1 -1
- package/core/accessorSupport/ensureType.js +1 -1
- package/core/accessorSupport/watch.js +1 -1
- package/core/accessorSupport/write.js +1 -1
- package/core/promiseUtils.js +1 -1
- package/core/watchUtils.js +1 -1
- package/core/workers/Connection.js +1 -1
- package/core/workers/RemoteClient.js +1 -1
- package/core/workers/workerFactory.js +1 -1
- package/geometry/support/geodesicUtils.js +1 -1
- package/geometry/support/meshUtils/External.js +1 -1
- package/geometry/support/meshUtils/Metadata.js +1 -1
- package/intl/messages.js +1 -1
- package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/graphics/data/attributeSupport.js +1 -1
- package/layers/graphics/sources/FeatureLayerSource.js +1 -1
- package/layers/mixins/ArcGISMapService.js +1 -1
- package/layers/support/PromiseQueue.js +1 -1
- package/layers/support/Sublayer.js +1 -1
- package/layers/support/TileKey.js +1 -1
- package/layers/support/rasterFormats/TiffDecoder.js +1 -1
- package/networks/Network.js +1 -1
- package/package.json +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/renderers/support/RasterSymbolizer.js +1 -1
- package/renderers/support/rasterRendererChecks.js +5 -0
- package/renderers/support/rasterRendererHelper.js +1 -1
- package/request.js +1 -1
- package/rest/query/operations/query.js +1 -1
- package/smartMapping/raster/renderers/uniqueValue.js +1 -1
- package/support/featureFlags.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/support/previewSymbol3D.js +1 -1
- package/symbols/support/styleUtils.js +1 -1
- package/symbols/support/symbolLayerUtils.js +1 -1
- package/symbols/support/utils.js +1 -1
- package/symbols/support/webStyleSymbolUtils.js +1 -1
- package/views/2d/engine/webgl/TextureManager.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/features/controllers/FeatureController2D.js +1 -1
- package/views/2d/layers/features/sources/DataTileSource.js +1 -1
- package/views/2d/layers/features/sources/DataTileSubscription.js +1 -1
- package/views/2d/layers/features/sources/DrillDownFeatureSource.js +1 -1
- package/views/2d/layers/features/sources/PagedFeatureSource.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
- package/views/2d/layers/features/tileRenderers/HeatmapTileRenderer.js +1 -1
- package/views/2d/layers/features/tileRenderers/SymbolTileRenderer.js +1 -1
- package/views/2d/layers/features/tileRenderers.js +1 -1
- package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
- package/views/2d/layers/support/webStyleUtils.js +1 -1
- package/views/3d/input/SceneInputManager.js +1 -1
- package/views/3d/interactive/manipulatorUtils.js +1 -1
- package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
- package/views/3d/layers/GraphicsView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/graphics/ElevationQuery.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/polygonUtils.js +1 -1
- package/views/3d/layers/graphics/symbolComplexity.js +1 -1
- package/views/3d/layers/graphics/webStyleUtils.js +5 -0
- package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SOverrides.js +1 -1
- package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/WaterSurface.glsl.js +1 -1
- package/views/LayerViewManager.js +1 -1
- package/views/PopupView.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/ViewAnimation.js +1 -1
- package/views/input/BrowserEventSource.js +1 -1
- package/views/input/InputManager.js +1 -1
- package/views/interactive/coordinateHelper.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js +1 -1
- package/views/layers/support/MapServiceLayerViewHelper.js +1 -1
- package/views/support/QueueProcessor.js +1 -1
- package/views/ui/DefaultUI.js +1 -1
- package/views/ui/UI.js +1 -1
- package/widgets/BasemapGallery/support/PortalBasemapsSource.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/Upload.js +1 -1
- package/widgets/Editor/deprecationUtils.js +1 -1
- package/widgets/Editor/modelUploadUtils.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/Feature/FeatureExpression/FeatureExpressionViewModel.js +1 -1
- package/widgets/Feature/FeatureRelationship/FeatureRelationshipViewModel.js +1 -1
- package/widgets/Feature/FeatureViewModel.js +1 -1
- package/widgets/Feature/support/featureUtils.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/Popup.js +1 -1
- package/widgets/support/decorators/accessibleHandler.js +1 -1
- package/assets/esri/core/workers/chunks/0948a40569b2408edefb.js +0 -1
- package/assets/esri/core/workers/chunks/192e3eeed50768c77c65.js +0 -1
- package/assets/esri/core/workers/chunks/1d1b9856f2f44d0c2144.js +0 -1
- package/assets/esri/core/workers/chunks/203115cc836e7b364eec.js +0 -1
- package/assets/esri/core/workers/chunks/20ad44b1a7adfed4c6c4.js +0 -1
- package/assets/esri/core/workers/chunks/27353056c3e4e8d8b8d3.js +0 -1
- package/assets/esri/core/workers/chunks/41ae9037c70461d5fdc7.js +0 -1
- package/assets/esri/core/workers/chunks/4b6a903d4aeeb4eeb615.js +0 -1
- package/assets/esri/core/workers/chunks/4bf9bc8b52d618f395c5.js +0 -1
- package/assets/esri/core/workers/chunks/5ec4fedbbcbb0053cf74.js +0 -2
- package/assets/esri/core/workers/chunks/60e29d172a2dcf45e8d0.js +0 -1
- package/assets/esri/core/workers/chunks/68a15cc7c51645d31572.js +0 -1
- package/assets/esri/core/workers/chunks/6b065e581bcf743079cf.js +0 -1
- package/assets/esri/core/workers/chunks/6c54579981a7bd483f1a.js +0 -1
- package/assets/esri/core/workers/chunks/778ecf61f07dafc51bbc.js +0 -1
- package/assets/esri/core/workers/chunks/7da1fd3629362b81b43c.js +0 -1
- package/assets/esri/core/workers/chunks/80d335bec34d60b7bbdc.js +0 -1
- package/assets/esri/core/workers/chunks/810da30f13151b72a293.js +0 -1
- package/assets/esri/core/workers/chunks/81485a5056aed94b3d8d.js +0 -1
- package/assets/esri/core/workers/chunks/8374d89e995f0d15c042.js +0 -1
- package/assets/esri/core/workers/chunks/8ebda132068f6b962dd9.js +0 -1
- package/assets/esri/core/workers/chunks/8f553ae2f1aba4e0371f.js +0 -1
- package/assets/esri/core/workers/chunks/8fec9979ae2b0e3a878f.js +0 -1
- package/assets/esri/core/workers/chunks/979ea2e3b1b164334634.js +0 -1
- package/assets/esri/core/workers/chunks/a0e92dd27c8f6b642dbf.js +0 -1
- package/assets/esri/core/workers/chunks/a6240bf258b3886a6661.js +0 -1
- package/assets/esri/core/workers/chunks/b059cd03f31ead61abb4.js +0 -1
- package/assets/esri/core/workers/chunks/b1a8024bf8cdd0cd3884.js +0 -1
- package/assets/esri/core/workers/chunks/b366e0db9b5f27dd53a3.js +0 -1
- package/assets/esri/core/workers/chunks/b976d5599672665561ec.js +0 -1
- package/assets/esri/core/workers/chunks/c260ac058e63a5c0cf60.js +0 -1
- package/assets/esri/core/workers/chunks/c646dc9da08b509e39d6.js +0 -1
- package/assets/esri/core/workers/chunks/db5598944b691e43f13e.js +0 -1
- package/assets/esri/core/workers/chunks/eb163a2ddeb27c690308.js +0 -1
- package/assets/esri/core/workers/chunks/eec12b5666819bf2119d.js +0 -1
- package/assets/esri/core/workers/chunks/ef05496c1faf08d247f1.js +0 -1
- package/assets/esri/core/workers/chunks/f05634909c9449533193.js +0 -1
- package/assets/esri/core/workers/chunks/fcebd70b089dea833c75.js +0 -1
- package/views/layers/GraphicsView.js +0 -5
- /package/assets/esri/core/workers/chunks/{a5c33b24b7ee042cb473.js.LICENSE.txt → 51a0d1dabe7415515c77.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{5ec4fedbbcbb0053cf74.js.LICENSE.txt → c5c56b6d99db96a6755a.js.LICENSE.txt} +0 -0
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import"../../../geometry.js";import r from"../../../Graphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import s from"../../../core/Collection.js";import a from"../../../core/Error.js";import has from"../../../core/has.js";import{clone as n}from"../../../core/lang.js";import o from"../../../core/Logger.js";import{applySome as l,destroyMaybe as u,removeMaybe as d}from"../../../core/maybe.js";import{debounce as h,isAbortError as p}from"../../../core/promiseUtils.js";import{watch as c,syncAndInitial as y,initial as g}from"../../../core/reactiveUtils.js";import{property as f}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as m}from"../../../core/accessorSupport/decorators/subclass.js";import _ from"../../../layers/effects/FeatureEffectView.js";import v from"../../../layers/support/FeatureFilter.js";import{getEffectiveLayerCapabilities as b}from"../../../layers/support/layerUtils.js";import R from"../../../rest/support/AggregateFeatureSet.js";import w from"../../../rest/support/FeatureSet.js";import S from"../../../rest/support/Query.js";import{MAX_FILTERS as x}from"../engine/webgl/definitions.js";import{LayerView2DMixin as F}from"./LayerView2D.js";import{createSchema as U}from"./features/schemaUtils.js";import{createOrReuseTileRenderer as C}from"./features/tileRenderers.js";import{isRendererSupported as q}from"./features/support/rendererUtils.js";import{findSizeVV as I,createClusterCountSizeVariable as O,injectDynamicLevelDependentSizeVisualVariable as V,isClusterCompatibleRenderer as E,createClusterRenderer as T}from"./support/clusterUtils.js";import j from"./support/FeatureCommandQueue.js";import A from"./support/FeatureLayerProxy.js";import{toJSONGeometryType as L}from"./support/util.js";import{TileManager as N}from"../tiling/TileManager.js";import Q from"../../layers/FeatureLayerView.js";import k from"../../layers/LayerView.js";import H from"../../layers/RefreshableLayerView.js";import{getWebGLCapabilities as P}from"../../webgl/capabilities.js";import J from"../../../geometry/Extent.js";function z(e){return e&&"openPorts"in e}let D=class extends(Q(H(F(k)))){constructor(){super(...arguments),this._pipelineIsUpdating=!0,this._commandsQueue=new j({process:e=>{switch(e.type){case"processed-edit":return this._doEdit(e);case"refresh":return this._doRefresh(e.dataChanged);case"update":return this._doUpdate()}}}),this._visibilityOverrides=new Set,this._highlightIds=new Map,this._updateHighlight=h((async()=>this._proxy.setHighlight(Array.from(this._highlightIds.keys())))),this._uploadsLocked=!1,this._needsClusterSizeUpdate=!1,this.featureEffectView=new _,this._lastDefinitionExpression=null}destroy(){l(this._updateClusterSizeTask,(e=>e.remove())),this._proxy?.destroy(),this._commandsQueue.destroy()}initialize(){this.addResolvingPromise(Promise.all([this._initProxy(),this._initServiceOptions()])),this.addHandles([this.on("valueRangesChanged",(e=>{this._set("_aggregateValueRanges",e.valueRanges)})),c((()=>this.featureEffect),(e=>{this.featureEffectView.featureEffect=e}),y)],"constructor"),this.featureEffectView.endTransitions()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new a("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:this.layer});if(("feature"===e.type||"subtype-group"===e.type)&&!b(e)?.operations.supportsQuery)throw new a("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._proxy&&this._proxy.destroy();const t=this._createClientOptions();return this._set("_proxy",new A({client:t})),this._proxy.when()}async _initServiceOptions(){return this._set("_serviceOptions",await this._createServiceOptions()),this._serviceOptions}get _effectiveFeatureReduction(){if(!("featureReduction"in this.layer))return null;const e=this.layer.featureReduction;return e&&(!("maxScale"in e)||!e.maxScale||e.maxScale<this.view.scale)?e:null}get orderByFields(){return"stream"!==this._serviceOptions?.type?this._serviceOptions?.orderByFields:void 0}get labelsVisible(){const e="subtype-group"===this.layer.type?this.layer.sublayers.items:[this.layer];return!this.suspended&&e.some((e=>e.labelingInfo&&e.labelsVisible))}get queryMode(){return this._serviceOptions?.type}get renderingConfigHash(){if(!this.layer)return null;const e=this.availableFields,t=this.layer,r=this.view.floors,{definitionExpression:i}=t,s="subtype-group"!==this.layer.type&&this.layer.labelsVisible&&this.layer.labelingInfo,a="renderer"in t&&t.renderer,n="gdbVersion"in t?t.gdbVersion:void 0,o="historicMoment"in t?t.historicMoment?.getTime():void 0,{timeExtent:l}=this,u="customParameters"in t?JSON.stringify(t.customParameters):void 0,d="apiKey"in t?t.apiKey:void 0,h="stream"===t.type?`${JSON.stringify(t.geometryDefinition)}${t.definitionExpression}`:null,p=JSON.stringify(this.clips),c=this._effectiveFeatureReduction?.toJSON(),y="orderBy"in this.layer&&JSON.stringify(this.layer.orderBy),g="sublayers"in this.layer&&this.layer.sublayers.items.reduce(((e,t)=>e+`${t.visible?1:0}.${JSON.stringify(t.renderer)}.${t.labelsVisible}\n.${JSON.stringify(t.labelingInfo)}`),""),f="subtypeCode"in this.layer&&this.layer.subtypeCode;return JSON.stringify({orderBy:y,sublayerHash:g,subtypeCode:f,filterHash:null!=this.filter&&this.filter.toJSON(),effectHash:null!=this.featureEffect&&this.featureEffect.toJSON(),streamFilter:h,gdbVersion:n,definitionExpression:i,historicMoment:o,availableFields:e,renderer:a,labelingInfo:s,timeExtent:l,floors:r,clipsHash:p,featureReduction:c,customParameters:u,apiKey:d})}highlight(e){let t;e instanceof r?t=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?t=[e]:s.isCollection(e)&&e.length>0?t=e.map((e=>e?.getObjectId())).toArray():Array.isArray(e)&&e.length>0&&(t="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())));const a=t?.filter(i);return a&&a.length?(this._addHighlight(a),{remove:()=>this._removeHighlight(a)}):{remove:()=>{}}}hasHighlight(){return!!this._highlightIds.size}async hitTest(e,i){if(!this.tileRenderer)return null;const s=await this.tileRenderer.hitTest(i);if(0===s.length)return null;const{features:a,aggregates:n}=await this._proxy.getFeatures(s);return[...n.map((r=>this._createGraphicHit(e,t.fromJSON(r)))),...a.map((t=>this._createGraphicHit(e,r.fromJSON(t))))]}queryStatistics(){return this._proxy.queryStatistics()}async querySummaryStatistics(e,t,r){const i={...t,scale:this.view.scale};return this._proxy.querySummaryStatistics(this._cleanUpQuery(e),i,r)}async queryAggregateSummaryStatistics(e,t,r){const i={...t,scale:this.view.scale};return this._proxy.queryAggregateSummaryStatistics(this._cleanUpAggregateQuery(e),i,r)}async queryUniqueValues(e,t,r){const i={...t,scale:this.view.scale};return this._proxy.queryUniqueValues(this._cleanUpQuery(e),i,r)}async queryAggregateUniqueValues(e,t,r){const i={...t,scale:this.view.scale};return this._proxy.queryAggregateUniqueValues(this._cleanUpAggregateQuery(e),i,r)}async queryClassBreaks(e,t,r){const i={...t,scale:this.view.scale};return this._proxy.queryClassBreaks(this._cleanUpQuery(e),i,r)}async queryAggregateClassBreaks(e,t,r){const i={...t,scale:this.view.scale};return this._proxy.queryAggregateClassBreaks(this._cleanUpAggregateQuery(e),i,r)}async queryHistogram(e,t,r){const i={...t,scale:this.view.scale};return this._proxy.queryHistogram(this._cleanUpQuery(e),i,r)}async queryAggregateHistogram(e,t,r){const i={...t,scale:this.view.scale};return this._proxy.queryAggregateHistogram(this._cleanUpAggregateQuery(e),i,r)}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=w.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}queryVisibleFeatures(e,t){return this._proxy.queryVisibleFeatures(this._cleanUpQuery(e),t).then((e=>{const t=w.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}async queryAggregates(e,t){const r=await this._proxy.queryAggregates(this._cleanUpAggregateQuery(e),t),i=R.fromJSON(r);return i.features.forEach((e=>this._setLayersForFeature(e))),i}queryAggregateIds(e,t){return this._proxy.queryAggregateIds(this._cleanUpAggregateQuery(e),t)}queryAggregateCount(e,t){return this._proxy.queryAggregateCount(this._cleanUpAggregateQuery(e),t)}queryAggregateJSON(e,t){return this._proxy.queryAggregates(this._cleanUpAggregateQuery(e),t)}queryFeaturesJSON(e,t){return this._proxy.queryFeatures(this._cleanUpQuery(e),t)}queryObjectIds(e,t){return this._proxy.queryObjectIds(this._cleanUpQuery(e),t)}queryFeatureCount(e,t){return this._proxy.queryFeatureCount(this._cleanUpQuery(e),t)}queryExtent(e,t){return this._proxy.queryExtent(this._cleanUpQuery(e),t).then((e=>({count:e.count,extent:J.fromJSON(e.extent)})))}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._tileStrategy||!this.tileRenderer)return;const{hasMissingTiles:t,added:r,removed:i}=this._tileStrategy.update(e);(r.length||i.length)&&this._proxy.updateTiles({added:r,removed:i}),t&&this.requestUpdate(),this.notifyChange("updating")}attach(){this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._tileStrategy=new N({acquireTile:e=>this._acquireTile(e),releaseTile:e=>this._releaseTile(e),tileInfoView:this.view.featuresTilingScheme,buffer:0}),this.addAttachHandles(c((()=>this.renderingConfigHash),(()=>this._update()),g)),"stream"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",(e=>this._edit(e))))}detach(){this._commandsQueue.clear(),this._proxy?.stop(),this.container.removeAllChildren(),this.tileRenderer?.uninstall(this.container),this.tileRenderer=null,this._tileStrategy=u(this._tileStrategy),this._tileRendererHash=null}moveStart(){this.requestUpdate()}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updating,r=null!=this._updatingRequiredFieldsPromise,i=!this._proxy||!this._proxy.isReady,s=this._pipelineIsUpdating,a=null==this.tileRenderer||this.tileRenderer?.updating,n=e&&(t||r||i||s||a);return has("esri-2d-log-updating")&&console.log(`Updating FLV2D: ${n}\n -> hasRenderer ${e}\n -> hasPendingCommand ${t}\n -> updatingRequiredFields ${r}\n -> updatingProxy ${i}\n -> updatingPipeline ${s}\n -> updatingTileRenderer ${a}\n`),n}_createClientOptions(){return{setUpdating:e=>{this._set("_pipelineIsUpdating",e)},emitEvent:e=>{this.emit(e.name,e.event)}}}async _detectQueryMode(e){const t="path"in e,{layer:r}=this,i="editingInfo"in r&&r.editingInfo?.lastEditDate,s="refreshInterval"in r&&!!r.refreshInterval,a=!i&&s,n=b(r);if(t&&("feature"===r.type||"subtype-group"===r.type)&&"point"===r.geometryType&&n?.query.supportsPagination&&!n?.operations.supportsEditing&&!a&&has("featurelayer-snapshot-enabled"))try{const e=await r.queryFeatureCount();if(e<=has("featurelayer-snapshot-point-min-threshold"))return{mode:"snapshot",featureCount:e};const t=has("featurelayer-snapshot-point-max-threshold"),i=has("featurelayer-snapshot-point-coverage"),s=this.view.extent,a=r.fullExtent,n=a?.clone().intersection(s),o=null!=n?n.width*n.height:0,l=a?.width*a?.height;if(e<=t&&(0===l?0:o/l)>=i)return{mode:"snapshot",featureCount:e}}catch(l){o.getLogger(this.declaredClass).warn("mapview-feature-layer","Encountered an error when querying for featureCount",{error:l})}return{mode:"on-demand"}}async _createServiceOptions(){const e=this.layer;if("stream"===e.type)return null;const t=b(e),{capabilities:r,objectIdField:i}=e,s=e.fields.map((e=>e.toJSON())),a=null!=e.fullExtent?e.fullExtent.toJSON():null,o=L(e.geometryType),l="timeInfo"in e&&e.timeInfo&&e.timeInfo.toJSON()||null,u=e.spatialReference?e.spatialReference.toJSON():null,d="feature"===e.type?e.globalIdField:null;let h;"ogc-feature"===e.type?h=e.source.getSource():z(e.source)?h=await e.source.openPorts():e.parsedUrl&&(h=n(e.parsedUrl),"dynamicDataSource"in e&&e.dynamicDataSource&&(h.query={layer:JSON.stringify({source:e.dynamicDataSource})}));const p="datesInUnknownTimezone"in this.layer&&this.layer.datesInUnknownTimezone,c=("subtypeField"in this.layer?this.layer.subtypeField:null)??null,{mode:y,featureCount:g}=await this._detectQueryMode(h);let f=this.layer.objectIdField;if("feature"===this.layer.type&&null!=this.layer.orderBy&&this.layer.orderBy.length){const e=!this.layer.orderBy[0].valueExpression&&this.layer.orderBy[0].field;e&&(f=e)}return{type:y,timeReferenceUnknownClient:p,subtypeField:c,featureCount:g,globalIdField:d,maxRecordCount:r.query.maxRecordCount,tileMaxRecordCount:r.query.tileMaxRecordCount,capabilities:r,effectiveCapabilities:t,fields:s,fullExtent:a,geometryType:o,objectIdField:i,source:h,timeInfo:l,spatialReference:u,orderByFields:f,datesInUnknownTimezone:p,dateFieldsTimeReference:("dateFieldsTimeReference"in this.layer?this.layer.dateFieldsTimeReference?.toJSON():null)||null,preferredTimeReference:("preferredTimeReference"in this.layer?this.layer.preferredTimeReference?.toJSON():null)||null,editFieldsInfo:"editFieldsInfo"in this.layer?this.layer.editFieldsInfo?.toJSON():null}}async _createMemoryServiceOptions(e){const t=await e.openPorts();return{...this._createServiceOptions(),type:"memory",source:t}}_cleanUpQuery(e){const t=S.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t}_cleanUpAggregateQuery(e){const t=S.from(e)||this.createAggregateQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t}async _update(){return this._commandsQueue.push({type:"update"})}async _edit(e){if(this.suspended)return void this._clearTiles();return this._validateEdit(e)?this._commandsQueue.push({type:"edit",edits:e}):void 0}async doRefresh(e){if(this.attached&&this._tileStrategy.tileKeys().length)return this.suspended&&e?void this._clearTiles():this._commandsQueue.push({type:"refresh",dataChanged:e})}_clearTiles(){this._tileStrategy.tileKeys().length&&(this._proxy.updateTiles({added:[],removed:this._tileStrategy.tileKeys()}),this._tileStrategy.clear(),this.requestUpdate(),this._commandsQueue.clear(),this._update())}_validateEdit(e){const t="globalIdField"in this.layer&&this.layer.globalIdField,r=e.deletedFeatures.some((e=>-1===e.objectId||!e.objectId)),i=t&&this.availableFields.includes(t);return r&&!i?(o.getLogger(this.declaredClass).error(new a("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected on the map`)),null):e}async _doUpdate(){try{if(this.destroyed||!this._hasRequiredSupport(this.layer)||!this._tileStrategy)return;const{featureEffectView:t,filter:r}=this;if(await this._updateRequiredFields(),this.destroyed)return;const{renderer:i}=this._getEffectiveRenderer();this._set("_effectiveRenderer",i);const s=this._createSchemaConfig(),a=this._createConfiguration(s,r,t.filter),n=this._lastDefinitionExpression!==a.schema.source.definitionExpression;this._lastDefinitionExpression=a.schema.source.definitionExpression;const l=a.schema.tileRenderer,u=this._createTileRendererHash(l);if("snapshot"===this._serviceOptions.type&&(a.schema.source.initialFeatureCount=this._serviceOptions.featureCount),u!==this._tileRendererHash){await this._initTileRenderer(l,i);const e=this.layer,t="stream"===e.type?await this._initServiceOptions():this._serviceOptions;this.tileRenderer.onConfigUpdate(i),"stream"!==e.type&&z(e.source)&&(t.source=await e.source.openPorts());const r={added:this._tileStrategy.tileKeys(),removed:[]};has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Proxy startup"),await this._proxy.startup(this.view.featuresTilingScheme,a,t,r),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Finished proxy startup"),this.hasHighlight()&&(has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Updating highlight"),await this._proxy.setHighlight(Array.from(this._highlightIds.keys())),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Finished highlight update")),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: onConfigUpdate start"),this.tileRenderer.onConfigUpdate(i),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: onConfigUpdate end")}else{"snapshot"===this._serviceOptions.type&&n&&(a.schema.source.changedFeatureCount=await this.layer.queryFeatureCount()),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Updating proxy");const t=await this._proxy.update(a);has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Finished proxy update"),(t.mesh||t.targets?.aggregate)&&(has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Locking GPU Uploads"),this._lockGPUUploads());try{has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Applying update to proxy"),await this._proxy.applyUpdate(t),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Finished applying update to proxy")}catch(e){p(e)||o.getLogger(this.declaredClass).error(e)}(t.mesh||t.targets?.aggregate)&&this._unlockGPUUploads(),this.tileRenderer.onConfigUpdate(i),this._updateClusterSizeVariable(),this._forceAttributeTextureUpload()}this._tileRendererHash=u,this.tileRenderer.invalidateLabels(),this.requestUpdate()}catch(e){}}async _doEdit(e){try{await this._proxy.onEdits(e)}catch(t){p(t),0}}async _doRefresh(e){this._lockGPUUploads();try{let t;e&&"snapshot"===this.queryMode&&"queryFeatureCount"in this.layer&&(t=await this.layer.queryFeatureCount()),await this._proxy.refresh({dataChanged:e,featureCount:t})}catch(t){p(t),0}this._unlockGPUUploads(),this._effectiveFeatureReduction&&this._updateClusterSizeVariable()}_updateClusterSizeVariable(){this._needsClusterSizeUpdate&&(this.tileRenderer.onConfigUpdate(this._effectiveRenderer),this._needsClusterSizeUpdate=!1)}_createUpdateClusterSizeTask(e,t){return c((()=>this._aggregateValueRanges),(r=>{this._updateClusterEffectiveRendererSizeVariable(e,t,r),this._needsClusterSizeUpdate=!0,this._uploadsLocked||this._updateClusterSizeVariable()}))}async _updateClusterEffectiveRendererSizeVariable(e,t,r){if(e.dynamicClusterSize&&"visualVariables"in e&&e.visualVariables){const i=I(e.visualVariables);if(null!=i&&"cluster_count"===i.field){const s=e.visualVariables.indexOf(i);e.visualVariables[s]=O(t,r);const a=e.clone();a.dynamicClusterSize=!0,this._set("_effectiveRenderer",a)}}}_getEffectiveRenderer(){const e=this.layer,t="renderer"in e?e.renderer:null,r=this._effectiveFeatureReduction;if(this._updateClusterSizeTask=d(this._updateClusterSizeTask),r&&"renderer"in r&&r.renderer&&!r.renderer.authoringInfo?.isAutoGenerated){const e=r.fields;if("cluster"===r.type){const{renderer:t,didInject:i}=V(r.renderer,r,this._aggregateValueRanges);return i&&(this._updateClusterSizeTask=this._createUpdateClusterSizeTask(t,r)),{renderer:t,aggregateFields:e,featureReduction:r}}return{renderer:r.renderer,aggregateFields:e,featureReduction:r}}if(r&&"cluster"===r.type&&t&&E(t)){const e=r,i=[],s=T(i,t,e,this._aggregateValueRanges,!0);return this._updateClusterSizeTask=this._createUpdateClusterSizeTask(s,e),{renderer:s,aggregateFields:i,featureReduction:r}}return{renderer:t,aggregateFields:[],featureReduction:null}}_acquireTile(e){const t=this.tileRenderer.acquireTile(e);return t.once("attach",(()=>{this.requestUpdate()})),t}_releaseTile(e){this.tileRenderer.releaseTile(e)}async _initTileRenderer(e,t){const r=await C(e,{layerView:this,tileInfoView:this.view.featuresTilingScheme,layer:this.layer});return this.tileRenderer&&(this._tileStrategy.clear(),this.tileRenderer.uninstall(this.container),this.tileRenderer=u(this.tileRenderer)),this.destroyed?null:(this._proxy.tileRenderer=r,this._set("tileRenderer",r),this.tileRenderer.install(this.container),this.tileRenderer.onConfigUpdate(t),this.requestUpdate(),this.tileRenderer)}_createTileRendererHash(e){return`${e.type}`}get hasFilter(){const e=!!("floorInfo"in this.layer&&this.layer.floorInfo&&this.view.floors&&this.view.floors.length);return!!this.filter||e||!!this._visibilityOverrides.size||!!this.timeExtent}_injectOverrides(e){const t=null!=e?e.timeExtent:null,r=null!=this.timeExtent&&null!=t?this.timeExtent.intersection(t):this.timeExtent||t;let i=null;const s="floorInfo"in this.layer&&this.layer.floorInfo;if(s){const t=null!=e?e.where:null;i=this._addFloorFilterClause(t)}if(!this._visibilityOverrides.size&&!r&&!s)return null!=e?e.toJSON():null;(e=null!=e&&e.clone()||new v).timeExtent=r,i&&(e.where=i);const a=e.toJSON();return a.hiddenIds=Array.from(this._visibilityOverrides),a}_addFloorFilterClause(e){const t=this.layer;let r=e||"";if("floorInfo"in t&&t.floorInfo){let e=this.view.floors;if(!e||!e.length)return r;t.floorInfo.viewAllLevelIds?.length&&(e=t.floorInfo.viewAllLevelIds);const i=e.filter((e=>""!==e)).map((e=>"'"+e+"'"));i.push("''");const s=t.floorInfo.floorField;let a="("+s+" IN ({ids}) OR "+s+" IS NULL)";if(a=a.replace("{ids}",i.join(", ")),null!=r&&r.includes(s)){let e=new RegExp("AND \\("+s+".*NULL\\)","g");r=r.replace(e,""),e=new RegExp("\\("+s+".*NULL\\)","g"),r=r.replace(e,""),r=r.replace(/\s+/g," ").trim()}r=""!==r?"("+r+") AND "+a:a}return""!==r?r:null}_createConfiguration(e,t,r){const i="feature"===this.layer.type&&this.layer.historicMoment?this.layer.historicMoment.getTime():void 0,s="feature"===this.layer.type?this.layer.gdbVersion??void 0:void 0,a=new Array(x),n=this._injectOverrides(t);a[0]=n,a[1]=null!=r?r.toJSON():null;const o=U(e);if(null==o)return null;const l=P("2d");return{availableFields:this.availableFields,gdbVersion:s,historicMoment:i,devicePixelRatio:window.devicePixelRatio||1,filters:a,schema:o,supportsTextureFloat:l.supportsTextureFloat,maxTextureSize:l.maxTextureSize}}_hasRequiredSupport(e){return!("renderer"in e)||q(e.renderer)}_lockGPUUploads(){this.tileRenderer&&(this._uploadsLocked=!0,this.tileRenderer.lockGPUUploads())}_unlockGPUUploads(){this.tileRenderer&&(this._uploadsLocked=!1,this.tileRenderer.unlockGPUUploads())}_forceAttributeTextureUpload(){this.tileRenderer&&this.tileRenderer.forceAttributeTextureUpload()}_createSchemaConfig(){const e=this.layer;return{renderer:"renderer"in e?e.renderer:null,spatialReference:e.spatialReference,timeExtent:"timeExtent"in e?e.timeExtent:null,definitionExpression:e.definitionExpression,featureReduction:this._effectiveFeatureReduction,fields:e.fields,geometryType:e.geometryType,historicMoment:"historicMoment"in e?e.historicMoment:null,labelsVisible:"labelsVisible"in e&&e.labelsVisible,labelingInfo:"labelingInfo"in e?e.labelingInfo:null,availableFields:this.availableFields,featureEffect:this.featureEffect,filter:this.filter,gdbVersion:"gdbVersion"in e?e.gdbVersion:null,pixelBuffer:0,orderBy:"orderBy"in e&&e.orderBy?e.orderBy:null,customParameters:{..."customParameters"in e?e.customParameters:void 0,token:"apiKey"in e?e.apiKey??void 0:void 0},subtypeCode:"subtypeCode"in e?e.subtypeCode:void 0,subtypeField:"subtypeField"in e?e.subtypeField:void 0}}_addHighlight(e){for(const t of e)if(this._highlightIds.has(t)){const e=this._highlightIds.get(t);this._highlightIds.set(t,e+1)}else this._highlightIds.set(t,1);this._updateHighlight().catch((e=>{p(e)||o.getLogger(this.declaredClass).error(e)}))}_removeHighlight(e){for(const t of e)if(this._highlightIds.has(t)){const e=this._highlightIds.get(t)-1;0===e?this._highlightIds.delete(t):this._highlightIds.set(t,e)}this._updateHighlight().catch((e=>{p(e)||o.getLogger(this.declaredClass).error(e)}))}_setLayersForFeature(e){const t=this.layer;e.layer=t,e.sourceLayer=t}_createGraphicHit(e,t){return this._setLayersForFeature(t),null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};e([f()],D.prototype,"_serviceOptions",void 0),e([f()],D.prototype,"_proxy",void 0),e([f()],D.prototype,"_pipelineIsUpdating",void 0),e([f()],D.prototype,"_effectiveRenderer",void 0),e([f()],D.prototype,"_effectiveFeatureReduction",null),e([f()],D.prototype,"_aggregateValueRanges",void 0),e([f()],D.prototype,"_commandsQueue",void 0),e([f()],D.prototype,"featureEffectView",void 0),e([f()],D.prototype,"labelsVisible",null),e([f({readOnly:!0})],D.prototype,"queryMode",null),e([f()],D.prototype,"renderingConfigHash",null),e([f()],D.prototype,"tileRenderer",void 0),e([f()],D.prototype,"updating",void 0),D=e([m("esri.views.2d.layers.FeatureLayerView2D")],D);const M=D;export{M as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import"../../../geometry.js";import r from"../../../Graphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import s from"../../../core/Collection.js";import a from"../../../core/Error.js";import has from"../../../core/has.js";import{clone as n}from"../../../core/lang.js";import o from"../../../core/Logger.js";import{applySome as l,destroyMaybe as u,removeMaybe as d}from"../../../core/maybe.js";import{debounce as h,isAbortError as p}from"../../../core/promiseUtils.js";import{watch as c,syncAndInitial as y,initial as g}from"../../../core/reactiveUtils.js";import{property as f}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as m}from"../../../core/accessorSupport/decorators/subclass.js";import _ from"../../../layers/effects/FeatureEffectView.js";import v from"../../../layers/support/FeatureFilter.js";import{getEffectiveLayerCapabilities as b}from"../../../layers/support/layerUtils.js";import R from"../../../rest/support/AggregateFeatureSet.js";import S from"../../../rest/support/FeatureSet.js";import w from"../../../rest/support/Query.js";import{MAX_FILTERS as x}from"../engine/webgl/definitions.js";import{LayerView2DMixin as F}from"./LayerView2D.js";import{createSchema as U}from"./features/schemaUtils.js";import{createOrReuseTileRenderer as C}from"./features/tileRenderers.js";import{isRendererSupported as q}from"./features/support/rendererUtils.js";import{findSizeVV as I,createClusterCountSizeVariable as O,injectDynamicLevelDependentSizeVisualVariable as V,isClusterCompatibleRenderer as E,createClusterRenderer as T}from"./support/clusterUtils.js";import j from"./support/FeatureCommandQueue.js";import A from"./support/FeatureLayerProxy.js";import{toJSONGeometryType as L}from"./support/util.js";import{TileManager as N}from"../tiling/TileManager.js";import Q from"../../layers/FeatureLayerView.js";import k from"../../layers/LayerView.js";import H from"../../layers/RefreshableLayerView.js";import{getWebGLCapabilities as P}from"../../webgl/capabilities.js";import J from"../../../geometry/Extent.js";function z(e){return e&&"openPorts"in e}let D=class extends(Q(H(F(k)))){constructor(){super(...arguments),this._pipelineIsUpdating=!0,this._commandsQueue=new j({process:e=>{switch(e.type){case"processed-edit":return this._doEdit(e);case"refresh":return this._doRefresh(e.dataChanged);case"update":return this._doUpdate()}}}),this._visibilityOverrides=new Set,this._highlightIds=new Map,this._updateHighlight=h((async()=>this._proxy.setHighlight(Array.from(this._highlightIds.keys())))),this._uploadsLocked=!1,this._needsClusterSizeUpdate=!1,this.featureEffectView=new _,this._lastDefinitionExpression=null}destroy(){l(this._updateClusterSizeTask,(e=>e.remove())),this._proxy?.destroy(),this._commandsQueue.destroy()}initialize(){this.addResolvingPromise(Promise.all([this._initProxy(),this._initServiceOptions()])),this.addHandles([this.on("valueRangesChanged",(e=>{this._set("_aggregateValueRanges",e.valueRanges)})),c((()=>this.featureEffect),(e=>{this.featureEffectView.featureEffect=e}),y)],"constructor"),this.featureEffectView.endTransitions()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new a("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:this.layer});if(("feature"===e.type||"subtype-group"===e.type)&&!b(e)?.operations.supportsQuery)throw new a("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._proxy&&this._proxy.destroy();const t=this._createClientOptions();return this._set("_proxy",new A({client:t})),this._proxy.when()}async _initServiceOptions(){return this._set("_serviceOptions",await this._createServiceOptions()),this._serviceOptions}get _effectiveFeatureReduction(){if(!("featureReduction"in this.layer))return null;const e=this.layer.featureReduction;return e&&(!("maxScale"in e)||!e.maxScale||e.maxScale<this.view.scale)?e:null}get orderByFields(){return"stream"!==this._serviceOptions?.type?this._serviceOptions?.orderByFields:void 0}get labelsVisible(){const e="subtype-group"===this.layer.type?this.layer.sublayers.items:[this.layer];return!this.suspended&&e.some((e=>e.labelingInfo&&e.labelsVisible))}get queryMode(){return this._serviceOptions?.type}get renderingConfigHash(){if(!this.layer)return null;const e=this.availableFields,t=this.layer,r=this.view.floors,{definitionExpression:i}=t,s="subtype-group"!==this.layer.type&&this.layer.labelsVisible&&this.layer.labelingInfo,a="renderer"in t&&t.renderer,n="gdbVersion"in t?t.gdbVersion:void 0,o="historicMoment"in t?t.historicMoment?.getTime():void 0,{timeExtent:l}=this,u="customParameters"in t?JSON.stringify(t.customParameters):void 0,d="apiKey"in t?t.apiKey:void 0,h="stream"===t.type?`${JSON.stringify(t.geometryDefinition)}${t.definitionExpression}`:null,p=JSON.stringify(this.clips),c=this._effectiveFeatureReduction?.toJSON(),y="orderBy"in this.layer&&JSON.stringify(this.layer.orderBy),g="sublayers"in this.layer&&this.layer.sublayers.items.reduce(((e,t)=>e+`${t.visible?1:0}.${JSON.stringify(t.renderer)}.${t.labelsVisible}\n.${JSON.stringify(t.labelingInfo)}`),""),f="subtypeCode"in this.layer&&this.layer.subtypeCode;return JSON.stringify({orderBy:y,sublayerHash:g,subtypeCode:f,filterHash:null!=this.filter&&this.filter.toJSON(),effectHash:null!=this.featureEffect&&this.featureEffect.toJSON(),streamFilter:h,gdbVersion:n,definitionExpression:i,historicMoment:o,availableFields:e,renderer:a,labelingInfo:s,timeExtent:l,floors:r,clipsHash:p,featureReduction:c,customParameters:u,apiKey:d})}highlight(e){let t;e instanceof r?t=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?t=[e]:s.isCollection(e)&&e.length>0?t=e.map((e=>e?.getObjectId())).toArray():Array.isArray(e)&&e.length>0&&(t="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())));const a=t?.filter(i);return a&&a.length?(this._addHighlight(a),{remove:()=>this._removeHighlight(a)}):{remove:()=>{}}}hasHighlight(){return!!this._highlightIds.size}async hitTest(e,i){if(!this.tileRenderer)return null;const s=await this.tileRenderer.hitTest(i);if(0===s.length)return null;const{features:a,aggregates:n}=await this._proxy.getFeatures(s);return[...n.map((r=>this._createGraphicHit(e,t.fromJSON(r)))),...a.map((t=>this._createGraphicHit(e,r.fromJSON(t))))]}queryStatistics(){return this._proxy.queryStatistics()}async querySummaryStatistics(e,t,r){const i={...t,scale:this.view.scale};return this._proxy.querySummaryStatistics(this._cleanUpQuery(e),i,r)}async queryAggregateSummaryStatistics(e,t,r){const i={...t,scale:this.view.scale};return this._proxy.queryAggregateSummaryStatistics(this._cleanUpAggregateQuery(e),i,r)}async queryUniqueValues(e,t,r){const i={...t,scale:this.view.scale};return this._proxy.queryUniqueValues(this._cleanUpQuery(e),i,r)}async queryAggregateUniqueValues(e,t,r){const i={...t,scale:this.view.scale};return this._proxy.queryAggregateUniqueValues(this._cleanUpAggregateQuery(e),i,r)}async queryClassBreaks(e,t,r){const i={...t,scale:this.view.scale};return this._proxy.queryClassBreaks(this._cleanUpQuery(e),i,r)}async queryAggregateClassBreaks(e,t,r){const i={...t,scale:this.view.scale};return this._proxy.queryAggregateClassBreaks(this._cleanUpAggregateQuery(e),i,r)}async queryHistogram(e,t,r){const i={...t,scale:this.view.scale};return this._proxy.queryHistogram(this._cleanUpQuery(e),i,r)}async queryAggregateHistogram(e,t,r){const i={...t,scale:this.view.scale};return this._proxy.queryAggregateHistogram(this._cleanUpAggregateQuery(e),i,r)}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=S.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}queryVisibleFeatures(e,t){return this._proxy.queryVisibleFeatures(this._cleanUpQuery(e),t).then((e=>{const t=S.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}async queryAggregates(e,t){const r=await this._proxy.queryAggregates(this._cleanUpAggregateQuery(e),t),i=R.fromJSON(r);return i.features.forEach((e=>this._setLayersForFeature(e))),i}queryAggregateIds(e,t){return this._proxy.queryAggregateIds(this._cleanUpAggregateQuery(e),t)}queryAggregateCount(e,t){return this._proxy.queryAggregateCount(this._cleanUpAggregateQuery(e),t)}queryAggregateJSON(e,t){return this._proxy.queryAggregates(this._cleanUpAggregateQuery(e),t)}queryFeaturesJSON(e,t){return this._proxy.queryFeatures(this._cleanUpQuery(e),t)}queryObjectIds(e,t){return this._proxy.queryObjectIds(this._cleanUpQuery(e),t)}queryFeatureCount(e,t){return this._proxy.queryFeatureCount(this._cleanUpQuery(e),t)}queryExtent(e,t){return this._proxy.queryExtent(this._cleanUpQuery(e),t).then((e=>({count:e.count,extent:J.fromJSON(e.extent)})))}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._tileStrategy||!this.tileRenderer)return;const{hasMissingTiles:t,added:r,removed:i}=this._tileStrategy.update(e);(r.length||i.length)&&this._proxy.updateTiles({added:r,removed:i}),t&&this.requestUpdate(),this.notifyChange("updating")}attach(){this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._tileStrategy=new N({acquireTile:e=>this._acquireTile(e),releaseTile:e=>this._releaseTile(e),tileInfoView:this.view.featuresTilingScheme,buffer:0}),this.addAttachHandles(c((()=>this.renderingConfigHash),(()=>this._update()),g)),"stream"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",(e=>this._edit(e))))}detach(){this._commandsQueue.clear(),this._proxy?.stop(),this.container.removeAllChildren(),this.tileRenderer?.uninstall(this.container),this.tileRenderer=null,this._tileStrategy=u(this._tileStrategy),this._tileRendererHash=null}moveStart(){this.requestUpdate()}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updating,r=null!=this._updatingRequiredFieldsPromise,i=!this._proxy||!this._proxy.isReady,s=this._pipelineIsUpdating,a=null==this.tileRenderer||this.tileRenderer?.updating,n=e&&(t||r||i||s||a);return has("esri-2d-log-updating")&&console.log(`Updating FLV2D (${this.layer.id}): ${n}\n -> hasRenderer ${e}\n -> hasPendingCommand ${t}\n -> updatingRequiredFields ${r}\n -> updatingProxy ${i}\n -> updatingPipeline ${s}\n -> updatingTileRenderer ${a}\n`),n}_createClientOptions(){return{setUpdating:e=>{this._set("_pipelineIsUpdating",e)},emitEvent:e=>{this.emit(e.name,e.event)}}}async _detectQueryMode(e){const t="path"in e,{layer:r}=this,i="editingInfo"in r&&r.editingInfo?.lastEditDate,s="refreshInterval"in r&&!!r.refreshInterval,a=!i&&s,n=b(r);if(t&&("feature"===r.type||"subtype-group"===r.type)&&"point"===r.geometryType&&n?.query.supportsPagination&&!n?.operations.supportsEditing&&!a&&has("featurelayer-snapshot-enabled"))try{const e=await r.queryFeatureCount();if(e<=has("featurelayer-snapshot-point-min-threshold"))return{mode:"snapshot",featureCount:e};const t=has("featurelayer-snapshot-point-max-threshold"),i=has("featurelayer-snapshot-point-coverage"),s=this.view.extent,a=r.fullExtent,n=a?.clone().intersection(s),o=null!=n?n.width*n.height:0,l=a?.width*a?.height;if(e<=t&&(0===l?0:o/l)>=i)return{mode:"snapshot",featureCount:e}}catch(l){o.getLogger(this.declaredClass).warn("mapview-feature-layer","Encountered an error when querying for featureCount",{error:l})}return{mode:"on-demand"}}async _createServiceOptions(){const e=this.layer;if("stream"===e.type)return null;const t=b(e),{capabilities:r,objectIdField:i}=e,s=e.fields.map((e=>e.toJSON())),a=null!=e.fullExtent?e.fullExtent.toJSON():null,o=L(e.geometryType),l="timeInfo"in e&&e.timeInfo&&e.timeInfo.toJSON()||null,u=e.spatialReference?e.spatialReference.toJSON():null,d="feature"===e.type?e.globalIdField:null;let h;"ogc-feature"===e.type?h=e.source.getSource():z(e.source)?h=await e.source.openPorts():e.parsedUrl&&(h=n(e.parsedUrl),"dynamicDataSource"in e&&e.dynamicDataSource&&(h.query={layer:JSON.stringify({source:e.dynamicDataSource})}));const p="datesInUnknownTimezone"in this.layer&&this.layer.datesInUnknownTimezone,c=("subtypeField"in this.layer?this.layer.subtypeField:null)??null,{mode:y,featureCount:g}=await this._detectQueryMode(h);let f=this.layer.objectIdField;if("feature"===this.layer.type&&null!=this.layer.orderBy&&this.layer.orderBy.length){const e=!this.layer.orderBy[0].valueExpression&&this.layer.orderBy[0].field;e&&(f=e)}return{type:y,timeReferenceUnknownClient:p,subtypeField:c,featureCount:g,globalIdField:d,maxRecordCount:r.query.maxRecordCount,tileMaxRecordCount:r.query.tileMaxRecordCount,capabilities:r,effectiveCapabilities:t,fields:s,fullExtent:a,geometryType:o,objectIdField:i,source:h,timeInfo:l,spatialReference:u,orderByFields:f,datesInUnknownTimezone:p,dateFieldsTimeReference:("dateFieldsTimeReference"in this.layer?this.layer.dateFieldsTimeReference?.toJSON():null)||null,preferredTimeReference:("preferredTimeReference"in this.layer?this.layer.preferredTimeReference?.toJSON():null)||null,editFieldsInfo:"editFieldsInfo"in this.layer?this.layer.editFieldsInfo?.toJSON():null}}async _createMemoryServiceOptions(e){const t=await e.openPorts();return{...this._createServiceOptions(),type:"memory",source:t}}_cleanUpQuery(e){const t=w.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t}_cleanUpAggregateQuery(e){const t=w.from(e)||this.createAggregateQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t}async _update(){return this._commandsQueue.push({type:"update"})}async _edit(e){if(this.suspended)return void this._clearTiles();return this._validateEdit(e)?this._commandsQueue.push({type:"edit",edits:e}):void 0}async doRefresh(e){if(this.attached&&this._tileStrategy.tileKeys().length)return this.suspended&&e?void this._clearTiles():this._commandsQueue.push({type:"refresh",dataChanged:e})}_clearTiles(){this._tileStrategy.tileKeys().length&&(this._proxy.updateTiles({added:[],removed:this._tileStrategy.tileKeys()}),this._tileStrategy.clear(),this.requestUpdate(),this._commandsQueue.clear(),this._update())}_validateEdit(e){const t="globalIdField"in this.layer&&this.layer.globalIdField,r=e.deletedFeatures.some((e=>-1===e.objectId||!e.objectId)),i=t&&this.availableFields.includes(t);return r&&!i?(o.getLogger(this.declaredClass).error(new a("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected on the map`)),null):e}async _doUpdate(){try{if(this.destroyed||!this._hasRequiredSupport(this.layer)||!this._tileStrategy)return;const{featureEffectView:t,filter:r}=this;if(await this._updateRequiredFields(),this.destroyed)return;const{renderer:i}=this._getEffectiveRenderer();this._set("_effectiveRenderer",i);const s=this._createSchemaConfig(),a=this._createConfiguration(s,r,t.filter),n=this._lastDefinitionExpression!==a.schema.source.definitionExpression;this._lastDefinitionExpression=a.schema.source.definitionExpression;const l=a.schema.tileRenderer,u=this._createTileRendererHash(l);if("snapshot"===this._serviceOptions.type&&(a.schema.source.initialFeatureCount=this._serviceOptions.featureCount),u!==this._tileRendererHash){this._initTileRenderer(l,i);const e=this.layer,t="stream"===e.type?await this._initServiceOptions():this._serviceOptions;this.tileRenderer.onConfigUpdate(i),"stream"!==e.type&&z(e.source)&&(t.source=await e.source.openPorts());const r={added:this._tileStrategy.tileKeys(),removed:[]};has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Proxy startup"),await this._proxy.startup(this.view.featuresTilingScheme,a,t,r),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Finished proxy startup"),this.hasHighlight()&&(has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Updating highlight"),await this._proxy.setHighlight(Array.from(this._highlightIds.keys())),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Finished highlight update")),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: onConfigUpdate start"),this.tileRenderer.onConfigUpdate(i),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: onConfigUpdate end")}else{"snapshot"===this._serviceOptions.type&&n&&(a.schema.source.changedFeatureCount=await this.layer.queryFeatureCount()),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Updating proxy");const t=await this._proxy.update(a);has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Finished proxy update"),(t.mesh||t.targets?.aggregate)&&(has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Locking GPU Uploads"),this._lockGPUUploads());try{has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Applying update to proxy"),await this._proxy.applyUpdate(t),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D: Finished applying update to proxy")}catch(e){p(e)||o.getLogger(this.declaredClass).error(e)}(t.mesh||t.targets?.aggregate)&&this._unlockGPUUploads(),this.tileRenderer.onConfigUpdate(i),this._updateClusterSizeVariable(),this._forceAttributeTextureUpload()}this._tileRendererHash=u,this.tileRenderer.invalidateLabels(),this.requestUpdate()}catch(e){}}async _doEdit(e){try{await this._proxy.onEdits(e)}catch(t){p(t),0}}async _doRefresh(e){this._lockGPUUploads();try{let t;e&&"snapshot"===this.queryMode&&"queryFeatureCount"in this.layer&&(t=await this.layer.queryFeatureCount()),await this._proxy.refresh({dataChanged:e,featureCount:t})}catch(t){p(t),0}this._unlockGPUUploads(),this._effectiveFeatureReduction&&this._updateClusterSizeVariable()}_updateClusterSizeVariable(){this._needsClusterSizeUpdate&&(this.tileRenderer.onConfigUpdate(this._effectiveRenderer),this._needsClusterSizeUpdate=!1)}_createUpdateClusterSizeTask(e,t){return c((()=>this._aggregateValueRanges),(r=>{this._updateClusterEffectiveRendererSizeVariable(e,t,r),this._needsClusterSizeUpdate=!0,this._uploadsLocked||this._updateClusterSizeVariable()}))}async _updateClusterEffectiveRendererSizeVariable(e,t,r){if(e.dynamicClusterSize&&"visualVariables"in e&&e.visualVariables){const i=I(e.visualVariables);if(null!=i&&"cluster_count"===i.field){const s=e.visualVariables.indexOf(i);e.visualVariables[s]=O(t,r);const a=e.clone();a.dynamicClusterSize=!0,this._set("_effectiveRenderer",a)}}}_getEffectiveRenderer(){const e=this.layer,t="renderer"in e?e.renderer:null,r=this._effectiveFeatureReduction;if(this._updateClusterSizeTask=d(this._updateClusterSizeTask),r&&"renderer"in r&&r.renderer&&!r.renderer.authoringInfo?.isAutoGenerated){const e=r.fields;if("cluster"===r.type){const{renderer:t,didInject:i}=V(r.renderer,r,this._aggregateValueRanges);return i&&(this._updateClusterSizeTask=this._createUpdateClusterSizeTask(t,r)),{renderer:t,aggregateFields:e,featureReduction:r}}return{renderer:r.renderer,aggregateFields:e,featureReduction:r}}if(r&&"cluster"===r.type&&t&&E(t)){const e=r,i=[],s=T(i,t,e,this._aggregateValueRanges,!0);return this._updateClusterSizeTask=this._createUpdateClusterSizeTask(s,e),{renderer:s,aggregateFields:i,featureReduction:r}}return{renderer:t,aggregateFields:[],featureReduction:null}}_acquireTile(e){const t=this.tileRenderer.acquireTile(e);return t.once("attach",(()=>{this.requestUpdate()})),t}_releaseTile(e){this.tileRenderer.releaseTile(e)}_initTileRenderer(e,t){const r=C(e,{layerView:this,tileInfoView:this.view.featuresTilingScheme,layer:this.layer});return this.tileRenderer&&(this._tileStrategy.clear(),this.tileRenderer.uninstall(this.container),this.tileRenderer=u(this.tileRenderer)),this.destroyed?null:(this._proxy.tileRenderer=r,this._set("tileRenderer",r),this.tileRenderer.install(this.container),this.tileRenderer.onConfigUpdate(t),this.requestUpdate(),this.tileRenderer)}_createTileRendererHash(e){return`${e.type}`}get hasFilter(){const e=!!("floorInfo"in this.layer&&this.layer.floorInfo&&this.view.floors&&this.view.floors.length);return!!this.filter||e||!!this._visibilityOverrides.size||!!this.timeExtent}_injectOverrides(e){const t=null!=e?e.timeExtent:null,r=null!=this.timeExtent&&null!=t?this.timeExtent.intersection(t):this.timeExtent||t;let i=null;const s="floorInfo"in this.layer&&this.layer.floorInfo;if(s){const t=null!=e?e.where:null;i=this._addFloorFilterClause(t)}if(!this._visibilityOverrides.size&&!r&&!s)return null!=e?e.toJSON():null;(e=null!=e&&e.clone()||new v).timeExtent=r,i&&(e.where=i);const a=e.toJSON();return a.hiddenIds=Array.from(this._visibilityOverrides),a}_addFloorFilterClause(e){const t=this.layer;let r=e||"";if("floorInfo"in t&&t.floorInfo){let e=this.view.floors;if(!e||!e.length)return r;t.floorInfo.viewAllLevelIds?.length&&(e=t.floorInfo.viewAllLevelIds);const i=e.filter((e=>""!==e)).map((e=>"'"+e+"'"));i.push("''");const s=t.floorInfo.floorField;let a="("+s+" IN ({ids}) OR "+s+" IS NULL)";if(a=a.replace("{ids}",i.join(", ")),null!=r&&r.includes(s)){let e=new RegExp("AND \\("+s+".*NULL\\)","g");r=r.replace(e,""),e=new RegExp("\\("+s+".*NULL\\)","g"),r=r.replace(e,""),r=r.replace(/\s+/g," ").trim()}r=""!==r?"("+r+") AND "+a:a}return""!==r?r:null}_createConfiguration(e,t,r){const i="feature"===this.layer.type&&this.layer.historicMoment?this.layer.historicMoment.getTime():void 0,s="feature"===this.layer.type?this.layer.gdbVersion??void 0:void 0,a=new Array(x),n=this._injectOverrides(t);a[0]=n,a[1]=null!=r?r.toJSON():null;const o=U(e);if(null==o)return null;const l=P("2d");return{availableFields:this.availableFields,gdbVersion:s,historicMoment:i,devicePixelRatio:window.devicePixelRatio||1,filters:a,schema:o,supportsTextureFloat:l.supportsTextureFloat,maxTextureSize:l.maxTextureSize}}_hasRequiredSupport(e){return!("renderer"in e)||q(e.renderer)}_lockGPUUploads(){this.tileRenderer&&(this._uploadsLocked=!0,this.tileRenderer.lockGPUUploads())}_unlockGPUUploads(){this.tileRenderer&&(this._uploadsLocked=!1,this.tileRenderer.unlockGPUUploads())}_forceAttributeTextureUpload(){this.tileRenderer&&this.tileRenderer.forceAttributeTextureUpload()}_createSchemaConfig(){const e=this.layer;return{renderer:"renderer"in e?e.renderer:null,spatialReference:e.spatialReference,timeExtent:"timeExtent"in e?e.timeExtent:null,definitionExpression:e.definitionExpression,featureReduction:this._effectiveFeatureReduction,fields:e.fields,geometryType:e.geometryType,historicMoment:"historicMoment"in e?e.historicMoment:null,labelsVisible:"labelsVisible"in e&&e.labelsVisible,labelingInfo:"labelingInfo"in e?e.labelingInfo:null,availableFields:this.availableFields,featureEffect:this.featureEffect,filter:this.filter,gdbVersion:"gdbVersion"in e?e.gdbVersion:null,pixelBuffer:0,orderBy:"orderBy"in e&&e.orderBy?e.orderBy:null,customParameters:{..."customParameters"in e?e.customParameters:void 0,token:"apiKey"in e?e.apiKey??void 0:void 0},subtypeCode:"subtypeCode"in e?e.subtypeCode:void 0,subtypeField:"subtypeField"in e?e.subtypeField:void 0}}_addHighlight(e){for(const t of e)if(this._highlightIds.has(t)){const e=this._highlightIds.get(t);this._highlightIds.set(t,e+1)}else this._highlightIds.set(t,1);this._updateHighlight().catch((e=>{p(e)||o.getLogger(this.declaredClass).error(e)}))}_removeHighlight(e){for(const t of e)if(this._highlightIds.has(t)){const e=this._highlightIds.get(t)-1;0===e?this._highlightIds.delete(t):this._highlightIds.set(t,e)}this._updateHighlight().catch((e=>{p(e)||o.getLogger(this.declaredClass).error(e)}))}_setLayersForFeature(e){const t=this.layer;e.layer=t,e.sourceLayer=t}_createGraphicHit(e,t){return this._setLayersForFeature(t),null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};e([f()],D.prototype,"_serviceOptions",void 0),e([f()],D.prototype,"_proxy",void 0),e([f()],D.prototype,"_pipelineIsUpdating",void 0),e([f()],D.prototype,"_effectiveRenderer",void 0),e([f()],D.prototype,"_effectiveFeatureReduction",null),e([f()],D.prototype,"_aggregateValueRanges",void 0),e([f()],D.prototype,"_commandsQueue",void 0),e([f()],D.prototype,"featureEffectView",void 0),e([f()],D.prototype,"labelsVisible",null),e([f({readOnly:!0})],D.prototype,"queryMode",null),e([f()],D.prototype,"renderingConfigHash",null),e([f()],D.prototype,"tileRenderer",void 0),e([f()],D.prototype,"updating",void 0),D=e([m("esri.views.2d.layers.FeatureLayerView2D")],D);const M=D;export{M as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{isSome as t}from"../../../../../core/arrayUtils.js";import{HandleOwner as r}from"../../../../../core/HandleOwner.js";import has from"../../../../../core/has.js";import{applySome as s}from"../../../../../core/maybe.js";import{ignoreAbortErrors as i,after as a,throwIfAborted as o,throwIfNotAbortError as n,isAbortError as u}from"../../../../../core/promiseUtils.js";import{when as g,watch as l,whenOnce as d}from"../../../../../core/reactiveUtils.js";import{property as h}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{convertToGeometry as p}from"../../../../../layers/graphics/featureConversionUtils.js";import{QueryEngine as y}from"../../../../../layers/graphics/data/QueryEngine.js";import f from"../../../../../layers/support/FieldsIndex.js";import{FeatureStore2D as m}from"../FeatureStore2D.js";import{createSource as S}from"../sources/createSource.js";import _ from"../support/AttributeStore.js";import{BinStore as b}from"../support/BinStore.js";import{ClusterStore as v}from"../support/ClusterStore.js";import{ComputedAttributeStorage as I}from"../support/ComputedAttributeStorage.js";import{FeatureSetReaderJSON as Q}from"../support/FeatureSetReaderJSON.js";import{UpdateToken as C}from"../support/UpdateToken.js";import{QueueProcessor as F}from"../../../../support/QueueProcessor.js";const w=5e3,E="tileRenderer.featuresView.attributeView.initialize",T="tileRenderer.featuresView.attributeView.requestUpdate",k="tileRenderer.featuresView.requestRender";function j(e){return"worker:port-closed"===e.name}function x(e){if(!u(e)&&!j(e))throw e}function U(e){return"feature"===e.type&&"snapshot"===e.mode}let R=class extends r{constructor(){super(...arguments),this._storage=new I,this._markedIdsBufId=this._storage.createBitset(),this._lastCleanup=performance.now(),this._cleanupNeeded=!1,this._invalidated=!1,this._tileToResolver=new Map,this._didEdit=!1,this._updateVersion=1,this.tileStore=null,this.config=null,this.processor=null,this.remoteClient=null,this.service=null}initialize(){this._initStores(),this._initSource(),this._updateQueue=new F({concurrency:"stream"===this._source.type?1:4,process:(e,t)=>this._onTileMessage(e,{signal:t})}),this.addHandles([this.tileStore.on("update",this.onTileUpdate.bind(this)),g((()=>!this.updating),(()=>this.onIdle()))])}_initSource(){const e=this.tileStore.tileScheme,t=()=>this._updateQueue&&this._updateQueue.length<50,r=(e,t)=>(this._invalidated=!0,this._patchTile(e,t));this._source=S(this.service,this.spatialReference,e,r,t,this.featureStore),this._proxyEvents()}_proxyEvents(){if("stream"===this._source.type){const e=this._source.events,t=this._source;this.addHandles([l((()=>t.connectionStatus),(e=>this.remoteClient.invoke("setProperty",{propertyName:"connectionStatus",value:e}).catch(x)),{initial:!0}),l((()=>t.errorString),(e=>this.remoteClient.invoke("setProperty",{propertyName:"errorString",value:e}).catch(x)),{initial:!0}),e.on("data-received",(e=>this.remoteClient.invoke("emitEvent",{name:"data-received",event:{attributes:e.attributes,centroid:e.centroid,geometry:e.geometry}}).catch(x))),e.on("message-received",(e=>this.remoteClient.invoke("emitEvent",{name:"message-received",event:e}).catch(x))),e.on("updateRate",(e=>this.remoteClient.invoke("emitEvent",{name:"update-rate",event:{...e}}).catch(x)))])}}_initAttributeStore(e){this.attributeStore||(this.attributeStore=new _({type:"remote",initialize:(e,t)=>i(this.remoteClient.invoke(E,e,{signal:t}).catch(x)),update:(e,t)=>i(this.remoteClient.invoke(T,e,{signal:t}).catch(x)),render:e=>i(this.remoteClient.invoke(k,void 0,{signal:e}).catch(x))},e))}_initStores(){const e="snapshot"===this.service.type?"snapshot":"on-demand",t={geometryInfo:{geometryType:this.service.geometryType,hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.featureStore=new m(t,this._storage,e)}_initQueryEngine(e){const t=this;this.featureQueryEngine?.destroy(),this.featureQueryEngine=new y({definitionExpression:e.schema.source.definitionExpression??void 0,fields:this.service.fields,geometryType:this.service.geometryType,objectIdField:this.service.objectIdField,hasM:!1,hasZ:!1,spatialReference:this.spatialReference.toJSON(),cacheSpatialQueries:!0,featureStore:this.featureStore,aggregateAdapter:{getFeatureObjectIds(e){if(null==t.aggregateStore)return[];return t.aggregateStore.getFeatureDisplayIdsForAggregate(e).map((e=>t.getObjectId(e)))}},timeInfo:this.service.timeInfo})}_initAggregateQueryEngine(e,t){if(this.aggregateQueryEngine?.destroy(),null==e)return;const r=t.targets.aggregate.params.fields.slice();this.aggregateQueryEngine=new y({definitionExpression:void 0,fields:r,geometryType:e.geometryInfo.geometryType,objectIdField:e.objectIdField,hasM:e.geometryInfo.hasM,hasZ:e.geometryInfo.hasZ,spatialReference:this.spatialReference.toJSON(),cacheSpatialQueries:!1,featureStore:e,aggregateAdapter:{getFeatureObjectIds:e=>[]}})}destroy(){this._updateQueue.destroy(),this._source.destroy(),this.featureQueryEngine?.destroy(),this.aggregateQueryEngine?.destroy(),this.attributeStore?.destroy();for(const e of this.tileStore.tiles)this._source.unsubscribe(e);clearInterval(this._checkUpdating)}get fieldsIndex(){return new f(this.service.fields)}get spatialReference(){return this.tileStore.tileScheme.spatialReference}get updating(){return this.isUpdating()}isUpdating(){const e=this._source.updatingHandles.updating,t=!this.attributeStore||this.attributeStore.updatingHandles.updating,r=e||t||this.updatingHandles.updating;return has("esri-2d-log-updating")&&console.log(`Updating FeatureController2D: ${r}\n -> updatingSource ${e}\n -> updatingAttributeStore ${t}\n -> updatingHandles ${this.updatingHandles.updating} (queue: ${this._updateQueue.length})\n`),r}updateCustomParameters(e){"stream"===this._source.type&&this._source.updateCustomParameters(e)}enableEvent(e){this._source.enableEvent(e.name,e.value)}pause(){this._updateQueue.pause(),this._updateQueue.clear()}resume(){this._updateQueue.resume()}pauseStream(){"stream"===this._source.type&&this._source.pauseStream()}resumeStream(){"stream"===this._source.type&&this._source.resumeStream()}sendMessageToSocket(e){"stream"===this._source.type&&this._source.sendMessageToSocket(e)}sendMessageToClient(e){"stream"===this._source.type&&this._source.sendMessageToClient(e)}_initAggregateStore(e){const t=e.schema.targets?.aggregate?.type,r=s(this.config,(e=>e.schema.targets?.aggregate?.type));if(r!==t&&(null!=this.aggregateStore&&(this.removeHandles("valueRangesChanged"),this.aggregateStore.destroy(),this.aggregateStore=null),t)){switch(t){case"cluster":{const e={geometryInfo:{geometryType:"esriGeometryPoint",hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.aggregateStore=new v(e,this.spatialReference,this._storage,this.service),this.addHandles(this.aggregateStore.events.on("valueRangesChanged",(e=>{this.remoteClient.invoke("emitEvent",{name:"valueRangesChanged",event:{valueRanges:e.valueRanges}}).catch(x)})),"valueRangesChanged");break}case"bin":{const e={geometryInfo:{geometryType:"esriGeometryPolygon",hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.aggregateStore=new b(e,this.spatialReference,this._storage,this.service);break}}this.aggregateStore.onTileUpdate({added:this.tileStore.tiles,removed:[]})}}async update(e,t){this._updateVersion++,has("esri-2d-update-debug")&&console.debug(`FeatureController2D::update: Token version ${this._updateVersion}`),this._initQueryEngine(t),this._initAttributeStore(t),this.pause(),await Promise.all([this._source.update(e,t.schema.source),this.featureStore.updateSchema(e,t.schema.targets.feature),this.attributeStore.update(e,t),this.attributeStore.updateFilters(e,t,this)]),this._initAggregateStore(t),null!=this.aggregateStore&&await this.aggregateStore.updateSchema(e,t.schema.targets.aggregate),this._initAggregateQueryEngine(this.aggregateStore,t.schema),has("esri-2d-update-debug")&&e.describe(),this._set("config",t)}async applyUpdate(e){e.version=this._updateVersion,has("esri-2d-update-debug")&&console.debug(`FeatureController2D::applyUpdate: Token version ${e.version}`),e.mesh&&this.clearTiles(),this._updateQueue.resume(),await this._source.applyUpdate(e),has("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Waiting for source update to finish"),this.notifyChange("updating"),await d((()=>!this.updating)),has("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Source update finsihed"),null!=this.aggregateStore&&(await a(10),has("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Waiting for aggregate idle call"),await d((()=>!this.updating)),has("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Aggregate idle called")),has("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Update finished")}async onEdits({edits:e}){has("esri-2d-update-debug")&&console.debug("Applying Edit:",e),this._didEdit=!0;try{const t=e.removed.map((e=>e.objectId&&-1!==e.objectId?e.objectId:this._lookupObjectIdByGlobalId(e.globalId))),r=e.addOrModified.map((({objectId:e})=>e));this.featureStore.invalidate(),await this._source.edit(r,t),this.clearTiles(),this.notifyChange("updating"),null!=this.aggregateStore&&this.aggregateStore.clear(),await this._source.resend(),await d((()=>!this.updating))}catch(t){}}async refresh(e){if(!e.dataChanged){const e=C.empty();return e.storage.filters=!0,this.applyUpdate(e)}this.featureStore.invalidate(),this.clearTiles(),this._source.refresh(this._updateVersion,e),this._cleanupNeeded=!0,this.notifyChange("updating"),await d((()=>!this.updating))}clearTiles(){for(const e of this.tileStore.tiles)this.processor.onTileClear(e)}onTileUpdate(e){null!=this.aggregateStore&&this.aggregateStore.onTileUpdate(e);for(const t of e.added)this._source.subscribe(t,this._updateVersion),this._level=t.level;for(const t of e.removed)this._source.unsubscribe(t),this._cleanupNeeded=!0,this._tileToResolver.has(t.id)&&(this._tileToResolver.get(t.id).resolve(),this._tileToResolver.delete(t.id));this.notifyChange("updating")}async onIdle(){this._invalidated&&(this._invalidated=!1,null==this.aggregateStore&&"heatmap"!==this.processor.type||await this._repushCurrentLevelTiles()),this._markAndSweep()}async querySummaryStatistics({query:e,params:t}){return this.featureQueryEngine.executeQueryForSummaryStatistics(e,t)}async queryAggregateSummaryStatistics({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForSummaryStatistics(e,t)}async queryUniqueValues({query:e,params:t}){return this.featureQueryEngine.executeQueryForUniqueValues(e,t)}async queryAggregateUniqueValues({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForUniqueValues(e,t)}async queryClassBreaks({query:e,params:t}){return this.featureQueryEngine.executeQueryForClassBreaks(e,t)}async queryAggregateClassBreaks({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForClassBreaks(e,t)}async queryHistogram({query:e,params:t}){return this.featureQueryEngine.executeQueryForHistogram(e,t)}async queryAggregateHistogram({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForHistogram(e,t)}queryExtent(e){return this.featureQueryEngine.executeQueryForExtent(e)}queryAggregates(e){return this.aggregateQueryEngine.executeQuery(e)}queryAggregateCount(e){return this.aggregateQueryEngine.executeQueryForCount(e)}queryAggregateIds(e){return this.aggregateQueryEngine.executeQueryForIds(e)}queryFeatures(e){return this.featureQueryEngine.executeQuery(e)}async queryVisibleFeatures(e){const t=await this.featureQueryEngine.executeQuery(e),r=t.objectIdFieldName;return t.features=t.features.filter((e=>{const t=e.attributes[r],i=this.getDisplayId(t);return s(i,(e=>this.attributeStore.isVisible(e)))})),t}queryFeatureCount(e){return this.featureQueryEngine.executeQueryForCount(e)}queryLatestObservations(e){return this.featureQueryEngine.executeQueryForLatestObservations(e)}queryObjectIds(e){return this.featureQueryEngine.executeQueryForIds(e)}async queryStatistics(){return this.featureStore.storeStatistics}getObjectId(e){return this.featureStore.lookupObjectId(e,this._storage)}getDisplayId(e){if(null!=this.aggregateStore){const t=this.aggregateStore.getDisplayId(e);if(null==t){const t=this.featureStore.lookupDisplayId(e);return this.aggregateStore.getDisplayIdForReferenceId(t)}return t}return this.featureStore.lookupDisplayId(e)}getFeatures(e){const t=[],r=[];for(const s of e){const e=null!=this.aggregateStore?this.getAggregate(s):null;if(null!=e)if(null!=e.attributes.referenceId){const r=this.getFeature(e.attributes.referenceId);null!=r&&t.push(r)}else r.push(e);else{const e=this.getFeature(s);null!=e&&t.push(e)}}return{features:t,aggregates:r}}getFeature(e){const t=this.featureStore.lookupFeatureByDisplayId(e,this._storage);if(null==t)return null;const r=t.readHydratedGeometry(),s=p(r,t.geometryType,t.hasZ,t.hasM);return{attributes:t.readAttributes(),geometry:s}}getAggregate(e){return null==this.aggregateStore?null:this.aggregateStore.getAggregate(e)}getAggregates(){return null==this.aggregateStore?[]:this.aggregateStore.getAggregates()}async setHighlight(e){const r=e.map((e=>this.getDisplayId(e))).filter(t);return this.attributeStore.setHighlight(e,r)}_lookupObjectIdByGlobalId(e){const t=this.service.globalIdField;if(null==t)throw new Error("Expected globalIdField to be defined");let r=null;if(this.featureStore.forEach((s=>{e===s.readAttribute(t)&&(r=s.getObjectId())})),null==r)throw new Error(`Expected to find a feature with globalId ${e}`);return r}async _repushCurrentLevelTiles(){const e=this.tileStore.tiles.filter((e=>e.level===this._level));e.map((async e=>this._patchTile({type:"append",id:e.key.id,clear:!0,addOrUpdate:null,end:!1})));const t=e.map((async e=>this._patchTile({type:"append",id:e.key.id,addOrUpdate:Q.fromOptimizedFeatures([],this.service),remove:[],end:!0,isRepush:!0,status:C.empty()})));await Promise.all(t)}_maybeForceCleanup(){performance.now()-this._lastCleanup>w&&this._markAndSweep()}_patchTile(e,t){const r=this._updateQueue.push(e,t).catch((e=>{}));return this.updatingHandles.addPromise(r)}async _onTileMessage(e,t){if(o(t),has("esri-2d-update-debug")){const t=s(e.addOrUpdate,(e=>e.hasFeatures));console.debug(e.id,`FeatureController:onTileMessage: [clear:${e.clear}, end:${e.end}, features: ${t}]`)}const r=this.tileStore.get(e.id);if(!r)return;if(e.clear)return this.processor.onTileClear(r);const i=e.status;this._cleanupNeeded=!0;const a=[];for(const s of e.remove??[]){const e=this.featureStore.lookupDisplayId(s);e&&a.push(e)}e.remove=a;try{if(null==e.addOrUpdate)return void this.processor.onTileMessage(r,{...e,addOrUpdate:null},null!=this.aggregateStore,t).catch(n);if(e.addOrUpdate.setArcadeSpatialReference(this.spatialReference),this.featureStore.hasInstance(e.addOrUpdate.instance)&&i.targets.feature||(i.targets.feature=!0,this.featureStore.onTileData(r,e)),!i.storage.data||!i.storage.filters){i.storage.data=!0,i.storage.filters=!0,this.attributeStore.onTileData(r,e);"stream"===this._source.type||this._didEdit?(await this.attributeStore.sendUpdates(),o(t)):this.attributeStore.sendUpdates()}if(null!=this.aggregateStore&&!i.targets.aggregate){i.targets.aggregate=!0;const t=U(this._source)&&this._source.loading,s=!U(this._source)||t||e.end;if(this.aggregateStore.onTileData(r,e,this._storage,this.attributeStore,s),!s)return;i.mesh||(this.attributeStore.onTileData(r,e),await this.attributeStore.sendUpdates())}if(!i.mesh){i.mesh=!0;const s=null!=this.aggregateStore&&"cluster"===this.aggregateStore.type;await this.processor.onTileMessage(r,e,s,t),o(t)}this._maybeForceCleanup()}catch(u){n(u)}}_mark(e,t,r){const s=(4294901760&this._storage.getInstanceId(e))>>>16;e&&(t.add(s),r.set(e))}_markAndSweep(){this._lastCleanup=performance.now();if(!(!("feature"===this._source.type&&"snapshot"===this._source.mode)&&("stream"===this._source.type||this._cleanupNeeded)))return;this._cleanupNeeded=!1;const e=this._storage.getBitset(this._markedIdsBufId),t=new Set;e.clear();for(const r of this.tileStore.tiles)for(const s of this._source.readers(r.id)){const r=s.getCursor();for(;r.next();){let s=r.getDisplayId();if(!s){const e=r.getObjectId();s=this.featureStore.lookupDisplayId(e)}this._mark(s,t,e)}}"symbol"===this.processor.type&&this.processor.forEachBufferId((r=>{this._mark(r,t,e)})),this._updateQueue.forEach((r=>{for(const s of r.remove??[]){const r=this.featureStore.lookupDisplayId(s);this._mark(r,t,e)}})),null!=this.aggregateStore&&(this.aggregateStore.sweepFeatures(e,this.featureStore),"sweepAggregates"in this.aggregateStore&&this.aggregateStore.sweepAggregates(this._storage,this.attributeStore,this._level)),this.featureStore.sweepFeatures(e,this._storage,this.attributeStore),this.featureStore.sweepFeatureSets(t)}};e([h({constructOnly:!0})],R.prototype,"tileStore",void 0),e([h()],R.prototype,"config",void 0),e([h({readOnly:!0})],R.prototype,"fieldsIndex",null),e([h()],R.prototype,"processor",void 0),e([h({constructOnly:!0})],R.prototype,"remoteClient",void 0),e([h({constructOnly:!0})],R.prototype,"service",void 0),e([h()],R.prototype,"spatialReference",null),e([h()],R.prototype,"updating",null),R=e([c("esri.views.2d.layers.features.controllers.FeatureController2D")],R);const A=R;export{A as default};
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{isSome as t}from"../../../../../core/arrayUtils.js";import{HandleOwner as r}from"../../../../../core/HandleOwner.js";import has from"../../../../../core/has.js";import{applySome as s}from"../../../../../core/maybe.js";import{ignoreAbortErrors as i,after as a,throwIfAborted as o,throwIfNotAbortError as n,isAbortError as u}from"../../../../../core/promiseUtils.js";import{when as g,watch as l,whenOnce as d}from"../../../../../core/reactiveUtils.js";import{property as h}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{convertToGeometry as p}from"../../../../../layers/graphics/featureConversionUtils.js";import{QueryEngine as y}from"../../../../../layers/graphics/data/QueryEngine.js";import f from"../../../../../layers/support/FieldsIndex.js";import{FeatureStore2D as m}from"../FeatureStore2D.js";import{createSource as S}from"../sources/createSource.js";import _ from"../support/AttributeStore.js";import{BinStore as b}from"../support/BinStore.js";import{ClusterStore as v}from"../support/ClusterStore.js";import{ComputedAttributeStorage as I}from"../support/ComputedAttributeStorage.js";import{FeatureSetReaderJSON as Q}from"../support/FeatureSetReaderJSON.js";import{UpdateToken as C}from"../support/UpdateToken.js";import{QueueProcessor as F}from"../../../../support/QueueProcessor.js";const w=5e3,E="tileRenderer.featuresView.attributeView.initialize",T="tileRenderer.featuresView.attributeView.requestUpdate",k="tileRenderer.featuresView.requestRender";function j(e){return"worker:port-closed"===e.name}function x(e){if(!u(e)&&!j(e))throw e}function U(e){return"feature"===e.type&&"snapshot"===e.mode}let R=class extends r{constructor(){super(...arguments),this._storage=new I,this._markedIdsBufId=this._storage.createBitset(),this._lastCleanup=performance.now(),this._cleanupNeeded=!1,this._invalidated=!1,this._tileToResolver=new Map,this._didEdit=!1,this._updateVersion=1,this.tileStore=null,this.config=null,this.processor=null,this.remoteClient=null,this.service=null}initialize(){this._initStores(),this._initSource(),this._updateQueue=new F({concurrency:"stream"===this._source.type?1:4,process:(e,t)=>this._onTileMessage(e,{signal:t})}),this.addHandles([this.tileStore.on("update",this.onTileUpdate.bind(this)),g((()=>!this.updating),(()=>this.onIdle()))])}_initSource(){const e=this.tileStore.tileScheme,t=()=>this._updateQueue&&this._updateQueue.length<50,r=(e,t)=>(this._invalidated=!0,this._patchTile(e,t));this._source=S(this.service,this.spatialReference,e,r,t,this.featureStore),this._proxyEvents()}_proxyEvents(){if("stream"===this._source.type){const e=this._source.events,t=this._source;this.addHandles([l((()=>t.connectionStatus),(e=>this.remoteClient.invoke("setProperty",{propertyName:"connectionStatus",value:e}).catch(x)),{initial:!0}),l((()=>t.errorString),(e=>this.remoteClient.invoke("setProperty",{propertyName:"errorString",value:e}).catch(x)),{initial:!0}),e.on("data-received",(e=>this.remoteClient.invoke("emitEvent",{name:"data-received",event:{attributes:e.attributes,centroid:e.centroid,geometry:e.geometry}}).catch(x))),e.on("message-received",(e=>this.remoteClient.invoke("emitEvent",{name:"message-received",event:e}).catch(x))),e.on("updateRate",(e=>this.remoteClient.invoke("emitEvent",{name:"update-rate",event:{...e}}).catch(x)))])}}_initAttributeStore(e){this.attributeStore||(this.attributeStore=new _({type:"remote",initialize:(e,t)=>i(this.remoteClient.invoke(E,e,{signal:t}).catch(x)),update:(e,t)=>i(this.remoteClient.invoke(T,e,{signal:t}).catch(x)),render:e=>i(this.remoteClient.invoke(k,void 0,{signal:e}).catch(x))},e))}_initStores(){const e="snapshot"===this.service.type?"snapshot":"on-demand",t={geometryInfo:{geometryType:this.service.geometryType,hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.featureStore=new m(t,this._storage,e)}_initQueryEngine(e){const t=this;this.featureQueryEngine?.destroy(),this.featureQueryEngine=new y({definitionExpression:e.schema.source.definitionExpression??void 0,fields:this.service.fields,geometryType:this.service.geometryType,objectIdField:this.service.objectIdField,hasM:!1,hasZ:!1,spatialReference:this.spatialReference.toJSON(),cacheSpatialQueries:!0,featureStore:this.featureStore,aggregateAdapter:{getFeatureObjectIds(e){if(null==t.aggregateStore)return[];return t.aggregateStore.getFeatureDisplayIdsForAggregate(e).map((e=>t.getObjectId(e)))}},timeInfo:this.service.timeInfo})}_initAggregateQueryEngine(e,t){if(this.aggregateQueryEngine?.destroy(),null==e)return;const r=t.targets.aggregate.params.fields.slice();this.aggregateQueryEngine=new y({definitionExpression:void 0,fields:r,geometryType:e.geometryInfo.geometryType,objectIdField:e.objectIdField,hasM:e.geometryInfo.hasM,hasZ:e.geometryInfo.hasZ,spatialReference:this.spatialReference.toJSON(),cacheSpatialQueries:!1,featureStore:e,aggregateAdapter:{getFeatureObjectIds:e=>[]}})}destroy(){this._updateQueue.destroy(),this._source.destroy(),this.featureQueryEngine?.destroy(),this.aggregateQueryEngine?.destroy(),this.attributeStore?.destroy();for(const e of this.tileStore.tiles)this._source.unsubscribe(e);clearInterval(this._checkUpdating)}get fieldsIndex(){return new f(this.service.fields)}get spatialReference(){return this.tileStore.tileScheme.spatialReference}get updating(){return this.isUpdating()}isUpdating(){const e=this._source.updatingHandles.updating,t=!this.attributeStore||this.attributeStore.updatingHandles.updating,r=e||t||this.updatingHandles.updating;if(has("esri-2d-log-updating")){let s=`Updating FeatureController2D: ${r}\n`;s+=` -> updatingSource ${e}\n`;for(const e of this._source.subscriptions)s+=` ${e.tile.id} ${e.isDone}\n`;s+=` -> updatingAttributeStore ${t}\n`,s+=` -> updatingHandles ${this.updatingHandles.updating} (queue: ${this._updateQueue.length})\n`,console.log(s)}return r}updateCustomParameters(e){"stream"===this._source.type&&this._source.updateCustomParameters(e)}enableEvent(e){this._source.enableEvent(e.name,e.value)}pause(){this._updateQueue.pause(),this._updateQueue.clear()}resume(){this._updateQueue.resume()}pauseStream(){"stream"===this._source.type&&this._source.pauseStream()}resumeStream(){"stream"===this._source.type&&this._source.resumeStream()}sendMessageToSocket(e){"stream"===this._source.type&&this._source.sendMessageToSocket(e)}sendMessageToClient(e){"stream"===this._source.type&&this._source.sendMessageToClient(e)}_initAggregateStore(e){const t=e.schema.targets?.aggregate?.type,r=s(this.config,(e=>e.schema.targets?.aggregate?.type));if(r!==t&&(null!=this.aggregateStore&&(this.removeHandles("valueRangesChanged"),this.aggregateStore.destroy(),this.aggregateStore=null),t)){switch(t){case"cluster":{const e={geometryInfo:{geometryType:"esriGeometryPoint",hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.aggregateStore=new v(e,this.spatialReference,this._storage,this.service),this.addHandles(this.aggregateStore.events.on("valueRangesChanged",(e=>{this.remoteClient.invoke("emitEvent",{name:"valueRangesChanged",event:{valueRanges:e.valueRanges}}).catch(x)})),"valueRangesChanged");break}case"bin":{const e={geometryInfo:{geometryType:"esriGeometryPolygon",hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.aggregateStore=new b(e,this.spatialReference,this._storage,this.service);break}}this.aggregateStore.onTileUpdate({added:this.tileStore.tiles,removed:[]})}}async update(e,t){this._updateVersion++,has("esri-2d-update-debug")&&console.debug(`FeatureController2D::update: Token version ${this._updateVersion}`),this._initQueryEngine(t),this._initAttributeStore(t),this.pause(),await Promise.all([this._source.update(e,t.schema.source),this.featureStore.updateSchema(e,t.schema.targets.feature),this.attributeStore.update(e,t),this.attributeStore.updateFilters(e,t,this)]),this._initAggregateStore(t),null!=this.aggregateStore&&await this.aggregateStore.updateSchema(e,t.schema.targets.aggregate),this._initAggregateQueryEngine(this.aggregateStore,t.schema),has("esri-2d-update-debug")&&e.describe(),this._set("config",t)}async applyUpdate(e){e.version=this._updateVersion,has("esri-2d-update-debug")&&console.debug(`FeatureController2D::applyUpdate: Token version ${e.version}`),e.mesh&&this.clearTiles(),this._updateQueue.resume(),await this._source.applyUpdate(e),has("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Waiting for source update to finish"),this.notifyChange("updating"),await d((()=>!this.updating)),has("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Source update finsihed"),null!=this.aggregateStore&&(await a(10),has("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Waiting for aggregate idle call"),await d((()=>!this.updating)),has("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Aggregate idle called")),has("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Update finished")}async onEdits({edits:e}){has("esri-2d-update-debug")&&console.debug("Applying Edit:",e),this._didEdit=!0;try{const t=e.removed.map((e=>e.objectId&&-1!==e.objectId?e.objectId:this._lookupObjectIdByGlobalId(e.globalId))),r=e.addOrModified.map((({objectId:e})=>e));this.featureStore.invalidate(),await this._source.edit(r,t),this.clearTiles(),this.notifyChange("updating"),null!=this.aggregateStore&&this.aggregateStore.clear(),await this._source.resend(),await d((()=>!this.updating))}catch(t){}}async refresh(e){if(!e.dataChanged){const e=C.empty();return e.storage.filters=!0,this.applyUpdate(e)}this.featureStore.invalidate(),this.clearTiles(),this._source.refresh(this._updateVersion,e),this._cleanupNeeded=!0,this.notifyChange("updating"),await d((()=>!this.updating))}clearTiles(){for(const e of this.tileStore.tiles)this.processor.onTileClear(e)}onTileUpdate(e){null!=this.aggregateStore&&this.aggregateStore.onTileUpdate(e);for(const t of e.added)this._source.subscribe(t,this._updateVersion),this._level=t.level;for(const t of e.removed)this._source.unsubscribe(t),this._cleanupNeeded=!0,this._tileToResolver.has(t.id)&&(this._tileToResolver.get(t.id).resolve(),this._tileToResolver.delete(t.id));this.notifyChange("updating")}async onIdle(){this._invalidated&&(this._invalidated=!1,null==this.aggregateStore&&"heatmap"!==this.processor.type||await this._repushCurrentLevelTiles()),this._markAndSweep()}async querySummaryStatistics({query:e,params:t}){return this.featureQueryEngine.executeQueryForSummaryStatistics(e,t)}async queryAggregateSummaryStatistics({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForSummaryStatistics(e,t)}async queryUniqueValues({query:e,params:t}){return this.featureQueryEngine.executeQueryForUniqueValues(e,t)}async queryAggregateUniqueValues({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForUniqueValues(e,t)}async queryClassBreaks({query:e,params:t}){return this.featureQueryEngine.executeQueryForClassBreaks(e,t)}async queryAggregateClassBreaks({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForClassBreaks(e,t)}async queryHistogram({query:e,params:t}){return this.featureQueryEngine.executeQueryForHistogram(e,t)}async queryAggregateHistogram({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForHistogram(e,t)}queryExtent(e){return this.featureQueryEngine.executeQueryForExtent(e)}queryAggregates(e){return this.aggregateQueryEngine.executeQuery(e)}queryAggregateCount(e){return this.aggregateQueryEngine.executeQueryForCount(e)}queryAggregateIds(e){return this.aggregateQueryEngine.executeQueryForIds(e)}queryFeatures(e){return this.featureQueryEngine.executeQuery(e)}async queryVisibleFeatures(e){const t=await this.featureQueryEngine.executeQuery(e),r=t.objectIdFieldName;return t.features=t.features.filter((e=>{const t=e.attributes[r],i=this.getDisplayId(t);return s(i,(e=>this.attributeStore.isVisible(e)))})),t}queryFeatureCount(e){return this.featureQueryEngine.executeQueryForCount(e)}queryLatestObservations(e){return this.featureQueryEngine.executeQueryForLatestObservations(e)}queryObjectIds(e){return this.featureQueryEngine.executeQueryForIds(e)}async queryStatistics(){return this.featureStore.storeStatistics}getObjectId(e){return this.featureStore.lookupObjectId(e,this._storage)}getDisplayId(e){if(null!=this.aggregateStore){const t=this.aggregateStore.getDisplayId(e);if(null==t){const t=this.featureStore.lookupDisplayId(e);return this.aggregateStore.getDisplayIdForReferenceId(t)}return t}return this.featureStore.lookupDisplayId(e)}getFeatures(e){const t=[],r=[];for(const s of e){const e=null!=this.aggregateStore?this.getAggregate(s):null;if(null!=e)if(null!=e.attributes.referenceId){const r=this.getFeature(e.attributes.referenceId);null!=r&&t.push(r)}else r.push(e);else{const e=this.getFeature(s);null!=e&&t.push(e)}}return{features:t,aggregates:r}}getFeature(e){const t=this.featureStore.lookupFeatureByDisplayId(e,this._storage);if(null==t)return null;const r=t.readHydratedGeometry(),s=p(r,t.geometryType,t.hasZ,t.hasM);return{attributes:t.readAttributes(),geometry:s}}getAggregate(e){return null==this.aggregateStore?null:this.aggregateStore.getAggregate(e)}getAggregates(){return null==this.aggregateStore?[]:this.aggregateStore.getAggregates()}async setHighlight(e){const r=e.map((e=>this.getDisplayId(e))).filter(t);return this.attributeStore.setHighlight(e,r)}_lookupObjectIdByGlobalId(e){const t=this.service.globalIdField;if(null==t)throw new Error("Expected globalIdField to be defined");let r=null;if(this.featureStore.forEach((s=>{e===s.readAttribute(t)&&(r=s.getObjectId())})),null==r)throw new Error(`Expected to find a feature with globalId ${e}`);return r}async _repushCurrentLevelTiles(){const e=this.tileStore.tiles.filter((e=>e.level===this._level));e.map((async e=>this._patchTile({type:"append",id:e.key.id,clear:!0,addOrUpdate:null,end:!1})));const t=e.map((async e=>this._patchTile({type:"append",id:e.key.id,addOrUpdate:Q.fromOptimizedFeatures([],this.service),remove:[],end:!0,isRepush:!0,status:C.empty()})));await Promise.all(t)}_maybeForceCleanup(){performance.now()-this._lastCleanup>w&&this._markAndSweep()}_patchTile(e,t){const r=this._updateQueue.push(e,t).catch((e=>{}));return this.updatingHandles.addPromise(r)}async _onTileMessage(e,t){if(o(t),has("esri-2d-update-debug")){const t=s(e.addOrUpdate,(e=>e.hasFeatures));console.debug(e.id,`FeatureController:onTileMessage: [clear:${e.clear}, end:${e.end}, features: ${t}]`)}const r=this.tileStore.get(e.id);if(!r)return;if(e.clear)return this.processor.onTileClear(r);const i=e.status;this._cleanupNeeded=!0;const a=[];for(const s of e.remove??[]){const e=this.featureStore.lookupDisplayId(s);e&&a.push(e)}e.remove=a;try{if(null==e.addOrUpdate)return void this.processor.onTileMessage(r,{...e,addOrUpdate:null},null!=this.aggregateStore,t).catch(n);if(e.addOrUpdate.setArcadeSpatialReference(this.spatialReference),this.featureStore.hasInstance(e.addOrUpdate.instance)&&i.targets.feature||(i.targets.feature=!0,this.featureStore.onTileData(r,e)),!i.storage.data||!i.storage.filters){i.storage.data=!0,i.storage.filters=!0,this.attributeStore.onTileData(r,e);"stream"===this._source.type||this._didEdit?(await this.attributeStore.sendUpdates(),o(t)):this.attributeStore.sendUpdates()}if(null!=this.aggregateStore&&!i.targets.aggregate){i.targets.aggregate=!0;const t=U(this._source)&&this._source.loading,s=!U(this._source)||t||e.end;if(this.aggregateStore.onTileData(r,e,this._storage,this.attributeStore,s),!s)return;i.mesh||(this.attributeStore.onTileData(r,e),await this.attributeStore.sendUpdates())}if(!i.mesh){i.mesh=!0;const s=null!=this.aggregateStore&&"cluster"===this.aggregateStore.type;await this.processor.onTileMessage(r,e,s,t),o(t)}this._maybeForceCleanup()}catch(u){n(u)}}_mark(e,t,r){const s=(4294901760&this._storage.getInstanceId(e))>>>16;e&&(t.add(s),r.set(e))}_markAndSweep(){this._lastCleanup=performance.now();if(!(!("feature"===this._source.type&&"snapshot"===this._source.mode)&&("stream"===this._source.type||this._cleanupNeeded)))return;this._cleanupNeeded=!1;const e=this._storage.getBitset(this._markedIdsBufId),t=new Set;e.clear();for(const r of this.tileStore.tiles)for(const s of this._source.readers(r.id)){const r=s.getCursor();for(;r.next();){let s=r.getDisplayId();if(!s){const e=r.getObjectId();s=this.featureStore.lookupDisplayId(e)}this._mark(s,t,e)}}"symbol"===this.processor.type&&this.processor.forEachBufferId((r=>{this._mark(r,t,e)})),this._updateQueue.forEach((r=>{for(const s of r.remove??[]){const r=this.featureStore.lookupDisplayId(s);this._mark(r,t,e)}})),null!=this.aggregateStore&&(this.aggregateStore.sweepFeatures(e,this.featureStore),"sweepAggregates"in this.aggregateStore&&this.aggregateStore.sweepAggregates(this._storage,this.attributeStore,this._level)),this.featureStore.sweepFeatures(e,this._storage,this.attributeStore),this.featureStore.sweepFeatureSets(t)}};e([h({constructOnly:!0})],R.prototype,"tileStore",void 0),e([h()],R.prototype,"config",void 0),e([h({readOnly:!0})],R.prototype,"fieldsIndex",null),e([h()],R.prototype,"processor",void 0),e([h({constructOnly:!0})],R.prototype,"remoteClient",void 0),e([h({constructOnly:!0})],R.prototype,"service",void 0),e([h()],R.prototype,"spatialReference",null),e([h()],R.prototype,"updating",null),R=e([c("esri.views.2d.layers.features.controllers.FeatureController2D")],R);const A=R;export{A as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../../TimeExtent.js";import
|
|
5
|
+
import e from"../../../../../TimeExtent.js";import s from"../../../../../core/Evented.js";import has from"../../../../../core/has.js";import{createResolver as t,ignoreAbortErrors as i,eachAlwaysValues as r,eachAlways as o}from"../../../../../core/promiseUtils.js";import{diff as n,hasDiff as u,hasDiffAny as c}from"../../../../../core/accessorSupport/diffUtils.js";import{WatchUpdatingTracking as a}from"../../../../../core/support/WatchUpdatingTracking.js";import d from"../../../../../rest/support/Query.js";import{DataTileSubscription as h}from"./DataTileSubscription.js";import{UpdateToken as p}from"../support/UpdateToken.js";function l(e,s){const t=new Set;return e&&e.forEach((e=>t.add(e))),s&&s.forEach((e=>t.add(e))),t.has("*")?["*"]:Array.from(t)}class m{constructor(e){this.updatingHandles=new a,this.events=new s,this._resolver=t(),this._didEdit=!1,this._subscriptions=new Map,this._outSR=e.outSR,this._serviceInfo=e.serviceInfo,this._onTileUpdateMessage=e.onMessage}destroy(){for(const e of this._subscriptions.values())e.abort();this.updatingHandles.destroy()}get subscriptions(){return this._subscriptions.values()}async _onMessage(e){const s=this._subscriptions.get(e.id);if(!s)return;const t={...e,remove:e.remove??[],status:e.status??p.empty()};return i(this._onTileUpdateMessage(t,s.options))}update(s,t){const i=t.fields.length;t.outFields=l(this._schema?.outFields,t.outFields),t.outFields=t.outFields.length>=.75*i?["*"]:t.outFields,t.outFields.sort();const r=n(this._schema,t);if(!r)return;has("esri-2d-update-debug")&&console.debug("Applying Update - Source:",r);const o="orderByFields"in this._serviceInfo&&this._serviceInfo.orderByFields?this._serviceInfo.orderByFields:this._serviceInfo.objectIdField+" ASC",a={returnCentroid:"esriGeometryPolygon"===this._serviceInfo.geometryType,returnGeometry:!0,timeReferenceUnknownClient:"stream"!==this._serviceInfo.type&&this._serviceInfo.timeReferenceUnknownClient,outFields:t.outFields,outSpatialReference:this._outSR,orderByFields:[o],where:t.definitionExpression||"1=1",gdbVersion:t.gdbVersion,historicMoment:t.historicMoment,timeExtent:t.timeExtent?e.fromJSON(t.timeExtent):null},d=this._schema&&u(r,"outFields");this._schema&&c(r,["timeExtent","definitionExpression","gdbVersion","historicMoment","customParameters"])&&(s.why.mesh.push("Layer filter and/or custom parameters changed"),s.why.source.push("Layer filter and/or custom parameters changed"),s.mesh=!0,s.source=!0,s.queryFilter=!0),d&&(s.why.source.push("Layer required fields changed"),s.source=!0),n(a,this._queryInfo)&&(this._queryInfo=a),this._schema=t,this._resolver.resolve()}whenInitialized(){return this._resolver.promise}async applyUpdate(e){if(e.queryFilter||e.source&&this._didEdit)return this.refresh(e.version),void(this._didEdit=!1);this._subscriptions.forEach((s=>s.applyUpdate(e))),await this.resend()}refresh(e,s){for(const t of this._tiles())this.unsubscribe(t),this.subscribe(t,e)}subscribe(e,s){const t=new h(e,s);this._subscriptions.set(e.id,t),this.updatingHandles.addPromise(t.done)}unsubscribe(e){const s=this.getSubscription(e.id);null!=s&&s.abort(),this._subscriptions.delete(e.id)}createQuery(e={}){const s=this._queryInfo.historicMoment?new Date(this._queryInfo.historicMoment):null;return new d({...this._queryInfo,historicMoment:s,...e})}getSubscription(e){return this._subscriptions.has(e)?this._subscriptions.get(e):null}async queryLastEditDate(){throw new Error("Service does not support query type")}async query(e,s){throw new Error("Service does not support query")}*_tiles(){const e=Array.from(this._subscriptions.values());for(const s of e)yield s.tile}async edit(e,s){const t=Array.from(this._subscriptions.values()),i=t.map((({tile:e})=>e));for(const r of t)r.removeIds(s);if(e.length){const t=i.map((s=>{const t=this.createTileQuery(s);return t.objectIds=e,{tile:s,query:t}})).map((async({tile:e,query:s})=>({tile:e,result:await this.query(s,{query:{tile:has("esri-tiles-debug")?e.id.replace(/\//g,"."):void 0}}),query:s}))),n=(await r(t)).map((async({tile:t,result:i})=>{if(!i.hasFeatures&&!s.length&&!e.length)return;const r=this._subscriptions.get(t.key.id);r&&r.edit(i,e)}));await o(n)}this._didEdit=!0}}export{m as DataTileSource};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isSome as e}from"../../../../../core/arrayUtils.js";import s from"../../../../../core/CircularArray.js";import has from"../../../../../core/has.js";import{createResolver as t}from"../../../../../core/promiseUtils.js";import{FeatureSetReaderJSON as r}from"../support/FeatureSetReaderJSON.js";import{UpdateToken as i}from"../support/UpdateToken.js";class d{constructor(e,r){this.requests={done:new Array,stream:new s(10)},this._edits=null,this._abortController=new AbortController,this._version=0,this._resolver=t(),this.didSend=!1,this.tile=e,this._version=r}get signal(){return this._abortController.signal}get options(){return{signal:this._abortController.signal}}get empty(){return!this.requests.done.length&&null==this.edits}get edits(){return this._edits}get done(){return this._resolver.promise}resolve(){this._resolver.resolve()}clear(){this.requests.done=[]}applyUpdate(e){this.requests.done.forEach((s=>s.message.status.unset(e))),this._version=e.version,null!=this._edits&&this._edits.status.unset(e)}add(e){e.message.status=e.message.status??i.empty(),e.message.status.version=this._version,has("esri-2d-update-debug")&&console.debug(this.tile.id,"DataTileSubscription:add",this._version),e.message.end&&(this.requests.done.forEach((e=>{null!=e.message&&e.message.end&&(e.message.end=!1)})),this._resolver.resolve()),this.requests.done.push(e)}edit(s,t){const d=s.getQuantizationTransform(),o=s.fullSchema(),a=Array.from(s.features()).filter(e),n=[...t,...a.map((e=>e.objectId))];if(this.removeIds(n),this._invalidate(),null==this._edits)return void(this._edits={type:"append",addOrUpdate:r.fromOptimizedFeatures(a,o,d),id:this.tile.id,status:i.empty(),end:!0});this.requests.done.forEach((e=>e.message.end=!1));this._edits.addOrUpdate.append(s.features())}*readers(){for(const{message:e}of this.requests.done)null!=e.addOrUpdate&&(yield e.addOrUpdate);null!=this._edits&&null!=this._edits.addOrUpdate&&(yield this._edits.addOrUpdate)}_invalidate(){for(const e of this.requests.done)e.message.status=i.empty();null!=this._edits&&(this._edits.status=i.empty())}removeIds(e){this._invalidate();for(const{message:s}of this.requests.done){const t=s.addOrUpdate;null!=t&&(t.removeIds(e),t.isEmpty&&(has("esri-2d-update-debug")&&console.debug("Removing FeatureSetReader"),s.addOrUpdate=null))}null!=this._edits&&null!=this._edits.addOrUpdate&&this._edits.addOrUpdate.removeIds(e),this.requests.done=this.requests.done.filter((e=>e.message.addOrUpdate||e.message.end))}abort(){this._abortController.abort(),this._resolver.reject()}}export{d as DataTileSubscription};
|
|
5
|
+
import{isSome as e}from"../../../../../core/arrayUtils.js";import s from"../../../../../core/CircularArray.js";import has from"../../../../../core/has.js";import{createResolver as t}from"../../../../../core/promiseUtils.js";import{FeatureSetReaderJSON as r}from"../support/FeatureSetReaderJSON.js";import{UpdateToken as i}from"../support/UpdateToken.js";class d{constructor(e,r){this.requests={done:new Array,stream:new s(10)},this._edits=null,this._abortController=new AbortController,this._version=0,this._resolver=t(),this._isDone=!1,this.didSend=!1,this.tile=e,this._version=r}get signal(){return this._abortController.signal}get options(){return{signal:this._abortController.signal}}get empty(){return!this.requests.done.length&&null==this.edits}get edits(){return this._edits}get done(){return this._resolver.promise}get isDone(){return this._isDone}resolve(){this._isDone=!0,this._resolver.resolve()}clear(){this.requests.done=[]}applyUpdate(e){this.requests.done.forEach((s=>s.message.status.unset(e))),this._version=e.version,null!=this._edits&&this._edits.status.unset(e)}add(e){e.message.status=e.message.status??i.empty(),e.message.status.version=this._version,has("esri-2d-update-debug")&&console.debug(this.tile.id,"DataTileSubscription:add",this._version),e.message.end&&(this.requests.done.forEach((e=>{null!=e.message&&e.message.end&&(e.message.end=!1)})),this._resolver.resolve(),this._isDone=!0),this.requests.done.push(e)}edit(s,t){const d=s.getQuantizationTransform(),o=s.fullSchema(),a=Array.from(s.features()).filter(e),n=[...t,...a.map((e=>e.objectId))];if(this.removeIds(n),this._invalidate(),null==this._edits)return void(this._edits={type:"append",addOrUpdate:r.fromOptimizedFeatures(a,o,d),id:this.tile.id,status:i.empty(),end:!0});this.requests.done.forEach((e=>e.message.end=!1));this._edits.addOrUpdate.append(s.features())}*readers(){for(const{message:e}of this.requests.done)null!=e.addOrUpdate&&(yield e.addOrUpdate);null!=this._edits&&null!=this._edits.addOrUpdate&&(yield this._edits.addOrUpdate)}_invalidate(){for(const e of this.requests.done)e.message.status=i.empty();null!=this._edits&&(this._edits.status=i.empty())}removeIds(e){this._invalidate();for(const{message:s}of this.requests.done){const t=s.addOrUpdate;null!=t&&(t.removeIds(e),t.isEmpty&&(has("esri-2d-update-debug")&&console.debug("Removing FeatureSetReader"),s.addOrUpdate=null))}null!=this._edits&&null!=this._edits.addOrUpdate&&this._edits.addOrUpdate.removeIds(e),this.requests.done=this.requests.done.filter((e=>e.message.addOrUpdate||e.message.end))}abort(){this._abortController.abort(),this._resolver.reject()}}export{d as DataTileSubscription};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../../../../core/has.js";import{throwIfAborted as e,isAbortError as t}from"../../../../../core/promiseUtils.js";import{BaseFeatureSource as r}from"./BaseFeatureSource.js";const s=has("esri-mobile"),i={maxDrillLevel:s?1:4,maxRecordCountFactor:s?1:3};class a extends r{constructor(e){super(e)}async _fetchDataTile(r){const s=this._serviceInfo.capabilities.query.supportsMaxRecordCountFactor,a=this._subscriptions.get(r.key.id),o=a.signal,n=r.getQuantizationParameters();let c=0;const d=async(u,l)=>{const
|
|
5
|
+
import has from"../../../../../core/has.js";import{throwIfAborted as e,isAbortError as t}from"../../../../../core/promiseUtils.js";import{BaseFeatureSource as r}from"./BaseFeatureSource.js";const s=has("esri-mobile"),i={maxDrillLevel:s?1:4,maxRecordCountFactor:s?1:3};class a extends r{constructor(e){super(e)}async _fetchDataTile(r){const s=this._serviceInfo.capabilities.query.supportsMaxRecordCountFactor,a=this._subscriptions.get(r.key.id),o=a.signal,n=r.getQuantizationParameters();let c=0;const d=async(u,l)=>{const m=this._queryInfo,p=this.createTileQuery(u,{maxRecordCountFactor:s?i.maxRecordCountFactor:void 0,returnExceededLimitFeatures:!1,quantizationParameters:n});c++;try{const t=await this.enqueueQuery({tile:r,query:p,signal:o,depth:l});if(c--,e(o),!t)return;if(m!==this._queryInfo)return void d(u,l);if(t.exceededTransferLimit&&l<i.maxDrillLevel){for(const e of u.createChildTiles())d(e,l+1);return}const s={id:r.id,addOrUpdate:t,end:0===c,type:"append"};a.add({query:p,message:s}),this._onMessage(s)}catch(f){if(!t(f)){const e={id:r.id,addOrUpdate:null,end:!0,type:"append"};a.add({query:p,message:e}),this._onMessage(e)}}};d(r,0)}}export{a as DrillDownFeatureSource};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../../core/Error.js";import t from"../../../../../core/Logger.js";import{isAbortError as r,throwIfAborted as a,throwIfNotAbortError as s}from"../../../../../core/promiseUtils.js";import{BaseFeatureSource as i}from"./BaseFeatureSource.js";class o extends i{constructor(e){super(e)}async _fetchDataTile(s){const i=6,o=20,n=this._subscriptions.get(s.key.id);let d=!1,c=0,u=0;const
|
|
5
|
+
import e from"../../../../../core/Error.js";import t from"../../../../../core/Logger.js";import{isAbortError as r,throwIfAborted as a,throwIfNotAbortError as s}from"../../../../../core/promiseUtils.js";import{BaseFeatureSource as i}from"./BaseFeatureSource.js";class o extends i{constructor(e){super(e)}async _fetchDataTile(s){const i=6,o=20,n=this._subscriptions.get(s.key.id);let d=!1,c=0,u=0;const h=(e,t)=>{u--,a(n);const r=s.id,i=e.reader,o=e.query;if(!i.exceededTransferLimit){if(d=!0,0!==t&&!i.hasFeatures){const e={id:r,addOrUpdate:i,end:0===u,type:"append"};return n.add({message:e,query:o}),void this._onMessage(e)}const e={id:r,addOrUpdate:i,end:0===u,type:"append"};return n.add({message:e,query:o}),void this._onMessage(e)}const c={id:r,addOrUpdate:i,end:d&&0===u,type:"append"};n.add({message:c,query:o}),this._onMessage(c)};let m=0,p=0;for(;!d&&p++<o;){let o;for(let a=0;a<m+1;a++){const a=c++;u++,o=this._fetchDataTilePage(s,a,n).then((e=>e&&h(e,a))).catch((a=>{if(d=!0,!r(a)){t.getLogger("esri.views.2d.layers.features.sources.PagedFeatureSource").error(new e("mapview-query-error","Encountered error when fetching tile",{tile:s,error:a}));const r={id:s.id,addOrUpdate:null,end:d,type:"append"},i={start:this.pageSize*c,num:this.pageSize,returnExceededLimitFeatures:!0,quantizationParameters:s.getQuantizationParameters()};null!=this.maxRecordCountFactor&&(i.maxRecordCountFactor=this.maxRecordCountFactor);const o=this.createTileQuery(s,i);n.add({message:r,query:o}),this._onMessage(r)}}))}await o,a(n),m=Math.min(m+2,i)}}async _fetchDataTilePage(e,t,r){a(r);const i=this._queryInfo,o={start:this.pageSize*t,num:this.pageSize,returnExceededLimitFeatures:!0,quantizationParameters:e.getQuantizationParameters()};null!=this.maxRecordCountFactor&&(o.maxRecordCountFactor=this.maxRecordCountFactor);const n=this.createTileQuery(e,o);try{const s=r.signal,o=await this.enqueueQuery({tile:e,query:n,signal:s,depth:t});return a(r),o?i!==this._queryInfo?this._fetchDataTilePage(e,t,r):{reader:o,query:n}:null}catch(d){return s(d),null}}}export{o as PagedFeatureSource};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../../core/Error.js";import t from"../../../../../layers/support/FieldsIndex.js";import{parseField as s,parseTransform as r}from"../../../../../rest/query/operations/pbfFeatureServiceParser.js";const n=268435455;class o{constructor(){this.hasFeatures=!1,this.exceededTransferLimit=!1,this.fieldCount=0,this.featureCount=0,this.objectIdFieldIndex=0,this.vertexCount=0,this.offsets={attributes:new Array,geometry:new Array},this.centroid=new Array}}function a(a,i,c=!1){const f=1,d=3,u=9,g=12,l=13,p=15,h=a.asUnsafe(),b=h.pos(),w=new o;let m=0,y=0;const k=1,x=2,I=4,L=3;let A=null,F=null,C=null,S=!1;const j=[];for(;h.next();)switch(h.tag()){case f:A=h.getString();break;case d:F=h.getString();break;case g:C=h.processMessage(r);break;case u:if(w.exceededTransferLimit=h.getBool(),w.exceededTransferLimit){w.offsets.geometry=c?new Float64Array(8e3):new Int32Array(8e3),w.centroid=c?new Float64Array(16e3):new Int32Array(16e3);for(let e=0;e<w.centroid.length;e++)w.centroid[e]=n}break;case l:{const e=h.processMessage(s);e.index=m++,j.push(e);break}case p:{const e=h.getLength(),t=h.pos()+e;if(!w.exceededTransferLimit){const e=w.offsets.geometry,t=w.centroid;e.push(0),t.push(n),t.push(n)}!S&&w.exceededTransferLimit&&(S=!0,w.offsets.attributes=c?new Float64Array(8e3*m):new Uint32Array(8e3*m));let s=y*m;for(;h.pos()<t&&h.next();)switch(h.tag()){case k:{if(S)w.offsets.attributes[s++]=h.pos();else{w.offsets.attributes.push(h.pos())}const e=h.getLength();h.skipLen(e);break}case x:if(i){const e=h.getLength(),t=h.pos()+e;for(;h.pos()<t&&h.next();)switch(h.tag()){case L:{h.getUInt32();const e=h.getSInt64(),t=h.getSInt64();w.centroid[2*y]=e,w.centroid[2*y+1]=t;break}default:h.skip()}}else{w.offsets.geometry[y]=h.pos();const e=h.getLength();w.vertexCount+=e,h.skipLen(e)}break;case I:{const e=h.getLength(),t=h.pos()+e;for(;h.pos()<t&&h.next();)switch(h.tag()){case L:{h.getUInt32();const e=h.getSInt64(),t=h.getSInt64();w.centroid[2*y]=e,w.centroid[2*y+1]=t;break}default:h.skip()}break}default:h.skip()}y++,w.hasFeatures=!0;break}default:h.skip()}const U=A||F;if(!U)throw new e("FeatureSet has no objectId or globalId field name");return w.fields=new t(j),w.featureCount=y,w.fieldCount=m,w.objectIdFieldIndex=w.fields.get(U)
|
|
5
|
+
import e from"../../../../../core/Error.js";import t from"../../../../../layers/support/FieldsIndex.js";import{parseField as s,parseTransform as r}from"../../../../../rest/query/operations/pbfFeatureServiceParser.js";const n=268435455;class o{constructor(){this.hasFeatures=!1,this.exceededTransferLimit=!1,this.fieldCount=0,this.featureCount=0,this.objectIdFieldIndex=0,this.vertexCount=0,this.offsets={attributes:new Array,geometry:new Array},this.centroid=new Array}}function a(a,i,c=!1){const f=1,d=3,u=9,g=12,l=13,p=15,h=a.asUnsafe(),b=h.pos(),w=new o;let m=0,y=0;const k=1,x=2,I=4,L=3;let A=null,F=null,C=null,S=!1;const j=[];for(;h.next();)switch(h.tag()){case f:A=h.getString();break;case d:F=h.getString();break;case g:C=h.processMessage(r);break;case u:if(w.exceededTransferLimit=h.getBool(),w.exceededTransferLimit){w.offsets.geometry=c?new Float64Array(8e3):new Int32Array(8e3),w.centroid=c?new Float64Array(16e3):new Int32Array(16e3);for(let e=0;e<w.centroid.length;e++)w.centroid[e]=n}break;case l:{const e=h.processMessage(s);e.index=m++,j.push(e);break}case p:{const e=h.getLength(),t=h.pos()+e;if(!w.exceededTransferLimit){const e=w.offsets.geometry,t=w.centroid;e.push(0),t.push(n),t.push(n)}!S&&w.exceededTransferLimit&&(S=!0,w.offsets.attributes=c?new Float64Array(8e3*m):new Uint32Array(8e3*m));let s=y*m;for(;h.pos()<t&&h.next();)switch(h.tag()){case k:{if(S)w.offsets.attributes[s++]=h.pos();else{w.offsets.attributes.push(h.pos())}const e=h.getLength();h.skipLen(e);break}case x:if(i){const e=h.getLength(),t=h.pos()+e;for(;h.pos()<t&&h.next();)switch(h.tag()){case L:{h.getUInt32();const e=h.getSInt64(),t=h.getSInt64();w.centroid[2*y]=e,w.centroid[2*y+1]=t;break}default:h.skip()}}else{w.offsets.geometry[y]=h.pos();const e=h.getLength();w.vertexCount+=e,h.skipLen(e)}break;case I:{const e=h.getLength(),t=h.pos()+e;for(;h.pos()<t&&h.next();)switch(h.tag()){case L:{h.getUInt32();const e=h.getSInt64(),t=h.getSInt64();w.centroid[2*y]=e,w.centroid[2*y+1]=t;break}default:h.skip()}break}default:h.skip()}y++,w.hasFeatures=!0;break}default:h.skip()}const U=A||F;if(!U)throw new e("FeatureSet has no objectId or globalId field name");return w.fields=new t(j),w.featureCount=y,w.fieldCount=m,w.objectIdFieldIndex=w.fields.get(U)?.index,w.transform=C,w.displayIds=new Uint32Array(w.featureCount),w.groupIds=new Uint16Array(w.featureCount),h.move(b),w}export{o as FeatureSetHeader,a as parseHeader};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../core/Logger.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import"../../../../../core/Error.js";import{subclass as t}from"../../../../../core/accessorSupport/decorators/subclass.js";import{generateGradient as i}from"../../../../../renderers/support/heatmapUtils.js";import{BitmapTileContainer as r}from"../../../engine/BitmapTileContainer.js";import s from"./BaseTileRenderer.js";import{HeatmapSource as n}from"./support/HeatmapSource.js";let o=class extends s{constructor(e){super(e),this._intensityInfo={minDensity:0,maxDensity:0},this.type="heatmap",this.featuresView={attributeView:{initialize:()=>{},requestUpdate:()=>{}},requestRender:()=>{}},this._container=new r(e.tileInfoView)}createTile(e){const t=this._container.createTile(e);return this.tileInfoView.getTileCoords(t.bitmap,e),t.bitmap.resolution=this.tileInfoView.getTileResolution(e),t}onConfigUpdate(){const e=this.layer.renderer;if("heatmap"===e.type){const{minDensity:t,maxDensity:r,colorStops:s}=e;this._intensityInfo.minDensity=t,this._intensityInfo.maxDensity=r,this._gradient=i(s),this.tiles.forEach((e=>{const i=e.bitmap.source;i&&(i.minDensity=t,i.maxDensity=r,i.gradient=this._gradient,e.bitmap.invalidateTexture())}))}}hitTest(){return Promise.resolve([])}install(e){e.addChild(this._container)}uninstall(e){this._container.removeAllChildren(),e.removeChild(this._container)}disposeTile(e){this._container.removeChild(e),e.destroy()}supportsRenderer(e){return e&&"heatmap"===e.type}onTileData(e){const t=this.tiles.get(e.tileKey);if(!t)return;const i=e.intensityInfo,{minDensity:r,maxDensity:s}=this._intensityInfo,o=t.bitmap.source||new n;o.intensities=i&&i.matrix||null,o.minDensity=r,o.maxDensity=s,o.gradient=this._gradient,t.bitmap.source=o,this._container.addChild(t),this._container.requestRender(),this.requestUpdate()}onTileError(e){console.error(e)}lockGPUUploads(){}unlockGPUUploads(){}fetchResource(e,t){return console.error(e),Promise.reject()}};o=e([t("esri.views.2d.layers.features.tileRenderers.HeatmapTileRenderer")],o);
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../core/Logger.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import"../../../../../core/Error.js";import{subclass as t}from"../../../../../core/accessorSupport/decorators/subclass.js";import{generateGradient as i}from"../../../../../renderers/support/heatmapUtils.js";import{BitmapTileContainer as r}from"../../../engine/BitmapTileContainer.js";import s from"./BaseTileRenderer.js";import{HeatmapSource as n}from"./support/HeatmapSource.js";let o=class extends s{constructor(e){super(e),this._intensityInfo={minDensity:0,maxDensity:0},this.type="heatmap",this.featuresView={attributeView:{initialize:()=>{},requestUpdate:()=>{}},requestRender:()=>{}},this._container=new r(e.tileInfoView)}createTile(e){const t=this._container.createTile(e);return this.tileInfoView.getTileCoords(t.bitmap,e),t.bitmap.resolution=this.tileInfoView.getTileResolution(e),t}onConfigUpdate(){const e=this.layer.renderer;if("heatmap"===e.type){const{minDensity:t,maxDensity:r,colorStops:s}=e;this._intensityInfo.minDensity=t,this._intensityInfo.maxDensity=r,this._gradient=i(s),this.tiles.forEach((e=>{const i=e.bitmap.source;i&&(i.minDensity=t,i.maxDensity=r,i.gradient=this._gradient,e.bitmap.invalidateTexture())}))}}hitTest(){return Promise.resolve([])}install(e){e.addChild(this._container)}uninstall(e){this._container.removeAllChildren(),e.removeChild(this._container)}disposeTile(e){this._container.removeChild(e),e.destroy()}supportsRenderer(e){return e&&"heatmap"===e.type}onTileData(e){const t=this.tiles.get(e.tileKey);if(!t)return;const i=e.intensityInfo,{minDensity:r,maxDensity:s}=this._intensityInfo,o=t.bitmap.source||new n;o.intensities=i&&i.matrix||null,o.minDensity=r,o.maxDensity=s,o.gradient=this._gradient,t.bitmap.source=o,this._container.addChild(t),this._container.requestRender(),this.requestUpdate()}onTileError(e){console.error(e)}lockGPUUploads(){}unlockGPUUploads(){}fetchResource(e,t){return console.error(e),Promise.reject()}};o=e([t("esri.views.2d.layers.features.tileRenderers.HeatmapTileRenderer")],o);export{o as HeatmapTileRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import has from"../../../../../core/has.js";import{destroyMaybe as t}from"../../../../../core/maybe.js";import{isAbortError as i}from"../../../../../core/promiseUtils.js";import"../../../../../core/Logger.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/Error.js";import{subclass as
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import has from"../../../../../core/has.js";import{destroyMaybe as t}from"../../../../../core/maybe.js";import{isAbortError as i}from"../../../../../core/promiseUtils.js";import"../../../../../core/Logger.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/Error.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as s}from"../../../../../geometry/support/aaBoundingRect.js";import{FeatureTile as a}from"../../../engine/webgl/FeatureTile.js";import{simplifyVVRenderer as o}from"../support/rendererUtils.js";import l from"./BaseTileRenderer.js";import{convertVisualVariables as n}from"./support/visualVariablesUtils.js";import{WGLFeatureView as u}from"./support/WGLFeatureView.js";let p=class extends l{constructor(){super(...arguments),this.type="symbol"}install(e){const t=()=>this.notifyChange("updating"),i=new u(this.tileInfoView,this.layerView,this.layer,t);this.featuresView=i,e.addChild(i)}uninstall(e){e.removeChild(this.featuresView),this.featuresView=t(this.featuresView)}fetchResource(e,t){const{url:r}=e,s=this.featuresView.stage;try{return s.resourceManager.fetchResource(r,{signal:t.signal})}catch(a){return i(a)?Promise.resolve({width:0,height:0}):Promise.reject(a)}}isUpdating(){const e=super.isUpdating(),t=!this.featuresView||this.featuresView.isUpdating(),i=this.featuresView?.hasEmptyAttributeView(),r=e||t||e&&i;return has("esri-2d-log-updating")&&console.log(`Updating SymbolTileRenderer ${r}\n -> updatingTiles ${e}\n -> hasFeaturesView ${!!this.featuresView}\n -> updatingFeaturesView ${t}`),r}hitTest(e){return this.featuresView.hitTest(e)}supportsRenderer(e){return null!=e&&["simple","class-breaks","unique-value","dot-density","dictionary","heatmap","pie-chart"].includes(e.type)}onConfigUpdate(e){let t=null;if(e&&"visualVariables"in e){const i=(o(e).visualVariables||[]).map((e=>{const t=e.clone();return"normalizationField"in e&&(t.normalizationField=null),e.valueExpression&&"$view.scale"!==e.valueExpression&&(t.valueExpression=null,t.field="nop"),t}));t=n(i)}this.featuresView.setRendererInfo(e,t,this.layerView.featureEffect)}onTileData(e){const t=this.tiles.get(e.tileKey);t&&e.data&&this.featuresView.onTileData(t,e.data),this.layerView.view.labelManager.requestUpdate()}onTileError(e){const t=this.tiles.get(e.tileKey);t&&this.featuresView.onTileError(t)}forceAttributeTextureUpload(){this.featuresView.attributeView.forceTextureUpload()}lockGPUUploads(){this.featuresView.attributeView.lockTextureUpload(),this.tiles.forEach((e=>e.lock()))}unlockGPUUploads(){this.featuresView.attributeView.unlockTextureUpload(),this.tiles.forEach((e=>e.unlock()))}async getMaterialItems(e){return this.featuresView.getMaterialItems(e)}invalidateLabels(){this.featuresView.hasLabels&&this.layerView.view.labelManager.requestUpdate()}createTile(e){const t=this.tileInfoView.getTileBounds(s(),e),i=()=>this.layerView.view.labelManager.requestUpdate(),r=this.tileInfoView.getTileResolution(e.level),o=this.featuresView.attributeView;return new a(e,r,t[0],t[3],o,i)}disposeTile(e){this.featuresView.removeChild(e),e.destroy(),this.layerView.view.labelManager.requestUpdate()}};p=e([r("esri.views.2d.layers.features.tileRenderers.SymbolTileRenderer")],p);export{p as SymbolTileRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
import{HeatmapTileRenderer as e}from"./tileRenderers/HeatmapTileRenderer.js";import{SymbolTileRenderer as r}from"./tileRenderers/SymbolTileRenderer.js";function t(t,n){if(!t)return null;switch(t.type){case"symbol":return new r(n);case"heatmap":return new e(n)}}export{t as createOrReuseTileRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{isSome as s}from"../../../../core/arrayUtils.js";import{bidiText as i}from"../../../../core/BidiText.js";import{HandleOwnerMixin as r}from"../../../../core/HandleOwner.js";import has from"../../../../core/has.js";import{assertIsSome as o}from"../../../../core/maybe.js";import{throwIfAborted as a,isAbortError as n,throwIfAbortError as h}from"../../../../core/promiseUtils.js";import{watch as l}from"../../../../core/reactiveUtils.js";import{property as d}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../../../core/accessorSupport/decorators/subclass.js";import c from"../../../../geometry/SpatialReference.js";import{width as g,height as u,create as m}from"../../../../geometry/support/aaBoundingRect.js";import{closeRingsAndFixWinding as _}from"../../../../geometry/support/coordsUtils.js";import{getJsonType as f,isPolygon as y,isPolyline as b,isExtent as S,isPoint as w,isMultipoint as T}from"../../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridianForDisplay as v}from"../../../../geometry/support/normalizeUtilsSync.js";import{getInfo as I}from"../../../../geometry/support/spatialReferenceUtils.js";import{checkProjectionSupport as U,project as G}from"../../../../layers/graphics/data/projectionSupport.js";import{symbolToCIM as M}from"../../../../symbols/cim/CIMSymbolHelper.js";import{errorPolylineSymbol2D as j,errorPolygonSymbol2D as C,errorPointSymbol2D as P}from"../../../../symbols/support/defaults.js";import{FILTER_FLAG_0 as x}from"../../engine/webgl/definitions.js";import{WGLSymbologyType as R}from"../../engine/webgl/enums.js";import{GraphicTile as A}from"../../engine/webgl/GraphicTile.js";import{TileData as z}from"../../engine/webgl/TileData.js";import q from"../../engine/webgl/WGLDisplayObject.js";import{MeshData as D}from"../../engine/webgl/mesh/MeshData.js";import{WGLMeshFactory as F}from"../../engine/webgl/mesh/factories/WGLMeshFactory.js";import{WGLTemplateStore as O}from"../../engine/webgl/mesh/templates/WGLTemplateStore.js";import{createMatcher as E}from"../../engine/webgl/util/Matcher.js";import{createSymbolSchemaOptions as H,createMatcherSchema as k}from"../features/schemaUtils.js";import N from"../features/support/AttributeStore.js";import{ComputedAttributeStorage as B}from"../features/support/ComputedAttributeStorage.js";import{GraphicsReader as L}from"../features/support/GraphicsReader.js";import V from"./GraphicStore.js";import{intersectingInternationalDateline as W,isMarkerSymbol as J,isTextSymbol as Z,polygonFromExtent as K,TILE_SIZE as Q,PIXEL_BUFFER as X}from"./graphicsUtils.js";import{expandSymbol as Y}from"../support/cimSymbolUtils.js";import{GraphicsView as $}from"../../../layers/GraphicsView.js";import{getWebGLCapabilities as ee}from"../../../webgl/capabilities.js";import{createSymbolSchema as te}from"../features/createSymbolSchema.js";const se=has("esri-2d-graphic-debug");function ie(e,t,s){let i=s.get(e);return i||(i={tile:t,addedOrModified:[],removed:[]},s.set(e,i)),i}let re=class extends($(r(t))){constructor(e){super(e),this._storage=new B,this._displayIds=new Map,this._controller=new AbortController,this._tiles=new Map,this._graphicStoreUpdate=!1,this._graphicsSet=new Set,this._matcher=Promise.resolve(null),this._tileUpdateSet=new Set,this._tilesToUpdate=new Map,this._graphicIdToAbortController=new Map,this._attached=!1,this._updatingGraphicsTimer=null,this._hashToExpandedSymbol=new Map,this._hashToExpandedSymbolPromise=new Map,this._hashToCIMSymbolPromise=new Map,this._hashToCIM=new Map,this._processing=!1,this._needsProcessing=!1,this._pendingUpdate={added:new Set,updated:new Set,removed:new Set},this.lastUpdateId=-1,this.updateRequested=!1,this.defaultPointSymbolEnabled=!0,this.graphicUpdateHandler=this.graphicUpdateHandler.bind(this)}destroy(){this._updatingGraphicsTimer&&(clearTimeout(this._updatingGraphicsTimer),this._updatingGraphicsTimer=null,this.notifyChange("updating")),this._controller.abort(),this.container.destroy(),this._set("graphics",null),this._graphicStore.clear(),this._attributeStore=null,this._hashToExpandedSymbol.clear(),this.view=null,this.renderer=null,this._hashToCIM.clear(),this._hashToCIMSymbolPromise.clear(),this._hashToExpandedSymbolPromise.clear()}_createMatcher(e,t,s){if(e){const i=H(e),r=k({indexCount:0,fields:{}},"feature",e,i);this._matcher=E(r,t,null,s)}}_createDisplayId(e){let t=this._displayIds.get(e);return t||(t=this._storage.createDisplayId(),this._displayIds.set(e,t)),t}initialize(){this._attributeStore=new N({type:"local",initialize:e=>Promise.resolve(this.container.attributeView.initialize(e)),update:e=>this.container.attributeView.requestUpdate(e),render:()=>this.container.requestRender()},ee("2d")),this.container.hasHighlight=()=>this._attributeStore.hasHighlight;const e=e=>{this._createDisplayId(e.uid),this._setFilterState(e.uid,e.visible)},t=e=>{const t=this._displayIds.get(e.uid);this._displayIds.delete(e.uid),this._storage.releaseDisplayId(t)},s=new O(this.container.getMaterialItems.bind(this.container),this.view.featuresTilingScheme.tileInfo);this._graphicStore=new V(this.view.featuresTilingScheme,this.view.state.scale,this.uid,this.graphics,e,t,this._hashToCIM),this._meshFactory=new F(null,this.uid,s),this._templateStore=s,this.handles.add([l((()=>this.renderer),(e=>{this._createMatcher(e,s,this.container.stage.resourceManager);for(const t of this.graphics)this._pendingUpdate.updated.add(t);this.requestUpdate()})),this.view.graphicsTileStore.on("update",this._onTileUpdate.bind(this)),this.container.on("attach",(()=>{se&&this.container.enableRenderingBounds((()=>this._graphicStore.getAllBounds())),this.graphics.items.length>0&&this._graphicsChangeHandler({target:this.graphics,added:this.graphics.items,removed:[],moved:[]}),this.handles.add(this.graphics.on("change",(e=>this._graphicsChangeHandler(e))),"graphics");const e=this.container.stage.resourceManager;this._createMatcher(this.renderer,s,e),this._graphicStore.setResourceManager(e),this._attached=!0,this.notifyChange("updating")}))]);const i=this.view.graphicsTileStore.tiles;this._onTileUpdate({added:i,removed:[]})}get updating(){return!this._attached||null!==this._updatingGraphicsTimer||this._pendingUpdate.added.size>0||this._pendingUpdate.removed.size>0||this._pendingUpdate.updated.size>0||this._tileUpdateSet.size>0||this._tilesToUpdate.size>0||this._attributeStore?.updatingHandles.updating||this._processing}hitTest(e){if(!this.view||!this.view.position)return[];const{resolution:t,rotation:s}=this.view.state;return this._graphicStore.hitTest(e.x,e.y,2,t,s)}update(e){a(this._controller.signal);const t=e.state,{resolution:s}=t;if(this._graphicStore.updateLevel(s),this._graphicStoreUpdate=!0,this.updateRequested=!1,this._pendingUpdate.updated.size>0){if(!this._processing)return void this._updateGraphics();this._needsProcessing=!0}}viewChange(){this.requestUpdate()}requestUpdate(){this.updateRequested||(this.updateRequested=!0,this.requestUpdateCallback())}processUpdate(e){this.updateRequested&&(this.updateRequested=!1,this.update(e))}graphicUpdateHandler(e){const{graphic:t,property:s}=e;switch(s){case"attributes":case"geometry":case"symbol":this._pendingUpdate.updated.add(t),this.requestUpdate();break;case"visible":this._setFilterState(t.uid,t.visible),this._attributeStore.sendUpdates()}}setHighlight(e){const t=e.map((e=>this._displayIds.get(e))).filter(s);this._attributeStore.setHighlight(e,t)}_getIntersectingTiles(e){const t=this._graphicStore.getBounds(e);if(!t||0===g(t)||0===u(t))return[];const s=W(t,this.view.spatialReference);return null!=s?[...new Set([...this.view.graphicsTileStore.boundsIntersections(s[0]),...this.view.graphicsTileStore.boundsIntersections(s[1])])]:this.view.graphicsTileStore.boundsIntersections(t)}async _updateTile(e){a(this._controller.signal);const t=e.tile,s=this._getGraphicsData(this._templateStore,t,e.addedOrModified),i=await this._processGraphics(t,s);return a(this._controller.signal),this._patchTile(t.key,{type:"update",addOrUpdate:i,remove:e.removed,end:!0,clear:!1,sort:!1}),i}_patchTile(e,t){const s=this._tiles.get(e);s&&(this.container.onTileData(s,t),this.container.requestRender())}_graphicsChangeHandler(e){const t=this._pendingUpdate;for(const s of e.added)t.added.add(s);for(const s of e.moved)t.updated.add(s);for(const s of e.removed)this._pendingUpdate.added.has(s)?t.added.delete(s):t.removed.add(s);this._processing?this._needsProcessing=!0:this._updateGraphics()}_getGraphicsToUpdate(){const e={added:[],removed:[],updated:[]};if(!this.graphics)return e;const t=this._pendingUpdate;for(const s of this.graphics.items)t.added.has(s)?e.added.push(s):t.updated.has(s)&&e.updated.push(s);for(const s of t.removed)this._graphicStore.has(s)&&e.removed.push(s);return t.added.clear(),t.removed.clear(),t.updated.clear(),e}async _updateGraphics(){this._processing=!0;const{added:e,removed:t,updated:s}=this._getGraphicsToUpdate(),i=this._tilesToUpdate;let r;try{if(!this._graphicStoreUpdate){const e=this.view.state,{resolution:t}=e;this._graphicStore.updateLevel(t)}const o=[],a=new Array(e.length+t.length);for(let e=0;e<s.length;e++){const t=s[e],n=this._getIntersectingTiles(t);for(const e of n){r=e.id;ie(r,e,i).removed.push(this._displayIds.get(t.uid))}o.push(this._updateGraphic(t,null)),a[e]=t}const n=s.length;for(let t=0;t<e.length;t++){const s=e[t];a[n+t]=s,this._graphicsSet.add(s),o.push(this._addGraphic(s))}for(const e of t){this._abortProcessingGraphic(e.uid);const t=this._getIntersectingTiles(e);for(const s of t){r=s.id;ie(r,s,i).removed.push(this._displayIds.get(e.uid))}this._graphicsSet.delete(e),this._graphicStore.remove(e)}let h;this._flipUpdatingGraphics(),await Promise.all(o);for(let e=0;e<a.length;e++){h=a[e];const t=this._getIntersectingTiles(h);for(const e of t){r=e.id;ie(r,e,i).addedOrModified.push(h)}}this._graphicStore.updateZ();const l=[];for(const[e,t]of i)l.push(this._updateTile(t));await Promise.all(l)}catch(o){n(o),0}for(const a of t)try{const e=await this._getSymbolForGraphic(a,null);if(e){const t=e.hash();this._hashToExpandedSymbol.delete(t)}}catch(o){n(o),0}i.clear(),this.notifyChange("updating"),this._processing=!1,this._needsProcessing&&(this._needsProcessing=!1,this._updateGraphics())}_getArcadeInfo(e){const t=(e.attributes?Object.keys(e.attributes):[]).map((t=>({name:t,alias:t,type:"string"==typeof e.attributes[t]?"esriFieldTypeString":"esriFieldTypeDouble"})));return null==e.geometry?null:{geometryType:f(e.geometry),spatialReference:c.fromJSON(e.geometry.spatialReference),fields:t}}_getSymbolForGraphic(e,t){return a(this._controller.signal),null!=e.symbol?Promise.resolve(e.symbol):null!=this.renderer?this.renderer.getSymbolAsync(e,{scale:this.view.scale,signal:null!=t?t.signal:null}):Promise.resolve(this._getNullSymbol(e))}_getCIMSymbol(e,t,s){let i=this._hashToCIM.get(t);if(i)return Promise.resolve(i);const r=M(e);if(null!=r){if("CIMSymbolReference"===r.type)return i=r,this._hashToCIM.set(t,i),Promise.resolve(i);let e=this._hashToCIMSymbolPromise.get(t);return e||(e=r.fetchCIMSymbol(s).then((e=>(this._hashToCIM.set(t,e.data),this._hashToCIMSymbolPromise.delete(t),e))).catch((e=>(this._hashToCIMSymbolPromise.delete(t),h(e),null))),this._hashToCIMSymbolPromise.set(t,e),e)}return Promise.resolve(null)}_expandCIMSymbol(e,t,s,i){const r=this._hashToExpandedSymbol.get(s);if(r)return Promise.resolve(r);let o=this._hashToExpandedSymbolPromise.get(s);if(o)return o;const a=this.container.stage,n=this._getArcadeInfo(t),h=H(null),l=te(e,h);return o=Y(l,n,a.resourceManager,i),this._hashToExpandedSymbolPromise.set(s,o),o.then((e=>(this._hashToExpandedSymbol.set(s,e),this._hashToExpandedSymbolPromise.delete(s),e))),o}async _getSymbolResources(e,t){a(this._controller.signal);return this.container.stage?this._getSymbolForGraphic(e,t).then((s=>{if(!s)return null;const r=s.hash();return this._getCIMSymbol(s,r,t).then((s=>null==s?null:this._expandCIMSymbol(s,e,r,t).then((e=>{const t=e.layers.filter((e=>"text"===e.type&&"string"==typeof e.text));if(t&&t.length>0){const s=new Array(t.length);for(let e=0;e<t.length;e++){const r=t[e],o=[],[a]=i(r.text);r.text=a;for(let e=0;e<a.length;e++)o.push(a.charCodeAt(e));s[e]={symbol:r,id:e,glyphIds:o}}const a=new Map;return this.container.getMaterialItems(s).then((s=>{o(s);for(let e=0;e<t.length;e++){const i=t[e];a.set(i.cim,{text:i.text,mosaicItem:s[e].mosaicItem})}return{symbol:e,textInfo:a,hash:r}}))}return{symbol:e,hash:r}}))))})).catch((e=>(h(e),null))):null}async _projectAndNormalizeGeometry(e,t){if(a(this._controller.signal),null==e.geometry||"mesh"===e.geometry.type)return null;let s=e.geometry;if(y(s)){const e=s.rings;s.rings=e}else if(b(s)){const e=s.paths;s.paths=e}else if(S(s)){const i=await this._getSymbolForGraphic(e,t);if(a(this._controller.signal),i&&(J(i.type)||Z(i.type))){s=s.center}else s=K(s)}await U(s.spatialReference,this.view.spatialReference);const i=v(s),r=G(i,s.spatialReference,this.view.spatialReference);return r&&_(r),r}_onTileUpdate(e){const t=I(this.view.spatialReference);if(e.added&&e.added.length>0)for(const s of e.added)this._addNewTile(s,t);if(e.removed&&e.removed.length>0)for(const s of e.removed)this._removeTile(s.key)}async _addGraphic(e){this._abortProcessingGraphic(e.uid),a(this._controller.signal);const t=new AbortController;this._graphicIdToAbortController.set(e.uid,t);const s={signal:t.signal};try{await this._addOrUpdateGraphic(e,s),a(this._controller.signal),this._graphicIdToAbortController.delete(e.uid)}catch(i){if(this._graphicIdToAbortController.delete(e.uid),!n(i))throw i}}_updateGraphic(e,t){a(this._controller.signal);const s=this._projectAndNormalizeGeometry(e,t),i=this._getSymbolResources(e,t);return Promise.all([s,i]).then((([t,s])=>{a(this._controller.signal),this._graphicStore.addOrModify(e,s,t)}))}_addOrUpdateGraphic(e,t){a(this._controller.signal);const s=this._projectAndNormalizeGeometry(e,t),i=this._getSymbolResources(e,t);return Promise.all([s,i]).then((([t,s])=>{a(this._controller.signal),this._graphicsSet.has(e)&&this._graphicStore.addOrModify(e,s,t)}))}_addTile(e){const t=this.view.featuresTilingScheme.getTileBounds(m(),e),s=this.view.featuresTilingScheme.getTileResolution(e.level),i=new A(e,s,t[0],t[3]);return this._tiles.set(e,i),this.container.addChild(i),i}async _addNewTile(e,t){const s=this._addTile(e.key),i=this._graphicStore.queryTileData(this._templateStore,e);if(0===i.length)return;if(t){const s=Math.round((t.valid[1]-t.valid[0])/e.resolution);for(const e of i)e.geometry&&(w(e.geometry)||T(e.geometry))&&this._wrapPoints(e,s)}const r=e.key;this._tileUpdateSet.add(e.key),this.notifyChange("updating");try{const t={type:"update",clear:!1,addOrUpdate:await this._processGraphics(e,i),remove:[],end:!0,sort:!1};s.patch(t),this._tileUpdateSet.delete(r),this.notifyChange("updating")}catch(o){if(this._tileUpdateSet.delete(r),this.notifyChange("updating"),!n(o))throw o}}_removeTile(e){if(!this._tiles.has(e))return;const t=this._tiles.get(e);this.container.removeChild(t),t.destroy(),this._tiles.delete(e)}_setFilterState(e,t){const s=this._displayIds.get(e),i=this._attributeStore.getHighlightFlag(e);this._attributeStore.setData(s,0,0,i|(t?x:0))}_getGraphicsData(e,t,s){const i=this.view,r=I(i.spatialReference),o=this._graphicStore.getGraphicsData(e,t,s);if(r){const e=Math.round((r.valid[1]-r.valid[0])/t.resolution);for(const t of o)t.geometry&&(w(t.geometry)||T(t.geometry))&&this._wrapPoints(t,e)}return o}_wrapPoints(e,t){const s=e.geometry;T(s)?this._wrapMultipoint(s,t):this._wrapPoint(e,t)}_wrapMultipoint(e,t){const s=e.points,i=[];let r=0,o=0;for(const[a,n]of s){if(i.push([a+r,n]),r=0,t===Q){const e=5*X;a+o<e?(i.push([t,0]),r=-t):a+o>Q-e&&(i.push([-t,0]),r=t)}else a+o<-X?(i.push([t,0]),r=-t):a+o>Q+X&&(i.push([-t,0]),r=t);o+=a}e.points=i}_wrapPoint(e,t){const s=e.geometry;if(t===Q){const i=5*X;s.x<i?e.geometry={points:[[s.x,s.y],[t,0]]}:s.x>Q-i&&(e.geometry={points:[[s.x,s.y],[-t,0]]})}else s.x<-X?e.geometry={points:[[s.x,s.y],[t,0]]}:s.x>Q+X&&(e.geometry={points:[[s.x,s.y],[-t,0]]})}_processGraphics(e,t,s){if(!(t&&t.length)||!this._meshFactory)return Promise.resolve(null);const i=L.from(t,this.uid,e.transform),r=this._meshFactory;return this._matcher.then((t=>r.analyzeGraphics(i,this.container.stage.resourceManager,t,null,null,s).then((()=>(this._attributeStore.sendUpdates(),this._processAnalyzedGraphics(e,i))))))}_processAnalyzedGraphics(e,t){const s=this._meshFactory,i=t.getSize(),r=t.getCursor(),o={features:i,records:i,metrics:0},a=new D(e.key.id,o,R.DEFAULT,!1,!1),n=[];for(;r.next();){const t=r.readGraphic();t.insertAfter=-1===t.insertAfter?-1:this._displayIds.get(t.insertAfter),t.displayId=this._displayIds.get(t.attributes[this.uid]);const i=new q(t.displayId);i.insertAfter=t.insertAfter,n.push(i),s.writeGraphic(a,r,e.level,this.container.stage.resourceManager)}const h=e.tileInfoView.tileInfo.isWrappable,l=a.serialize(h);if(1!==l.length)return new z;const d=l[0].message;return z.fromVertexData(d,n)}_abortProcessingGraphic(e){this._graphicIdToAbortController.get(e)?.abort()}_getNullSymbol(e){const t=e.geometry;return b(t)?j:y(t)||S(t)?C:this.defaultPointSymbolEnabled?P:null}_flipUpdatingGraphics(){this._updatingGraphicsTimer&&clearTimeout(this._updatingGraphicsTimer),this._updatingGraphicsTimer=setTimeout((()=>{this._updatingGraphicsTimer=null,this.notifyChange("updating")}),160),this.notifyChange("updating")}};e([d({constructOnly:!0})],re.prototype,"requestUpdateCallback",void 0),e([d()],re.prototype,"container",void 0),e([d({constructOnly:!0})],re.prototype,"graphics",void 0),e([d()],re.prototype,"updating",null),e([d()],re.prototype,"view",void 0),e([d()],re.prototype,"updateRequested",void 0),e([d()],re.prototype,"defaultPointSymbolEnabled",void 0),re=e([p("esri.views.2d.layers.support.GraphicsView2D")],re);const oe=re;export{oe as default};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{isSome as i}from"../../../../core/arrayUtils.js";import{bidiText as s}from"../../../../core/BidiText.js";import{HandleOwnerMixin as r}from"../../../../core/HandleOwner.js";import has from"../../../../core/has.js";import{IdentifiableMixin as o}from"../../../../core/Identifiable.js";import{assertIsSome as a}from"../../../../core/maybe.js";import{throwIfAborted as n,isAbortError as h,throwIfAbortError as l}from"../../../../core/promiseUtils.js";import{watch as d}from"../../../../core/reactiveUtils.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import g from"../../../../geometry/SpatialReference.js";import{width as u,height as m,create as _}from"../../../../geometry/support/aaBoundingRect.js";import{closeRingsAndFixWinding as f}from"../../../../geometry/support/coordsUtils.js";import{getJsonType as y,isPolygon as b,isPolyline as S,isExtent as w,isPoint as v,isMultipoint as T}from"../../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridianForDisplay as I}from"../../../../geometry/support/normalizeUtilsSync.js";import{getInfo as U}from"../../../../geometry/support/spatialReferenceUtils.js";import{checkProjectionSupport as G,project as M}from"../../../../layers/graphics/data/projectionSupport.js";import{symbolToCIM as j}from"../../../../symbols/cim/CIMSymbolHelper.js";import{errorPolylineSymbol2D as C,errorPolygonSymbol2D as P,errorPointSymbol2D as R}from"../../../../symbols/support/defaults.js";import{FILTER_FLAG_0 as x}from"../../engine/webgl/definitions.js";import{WGLSymbologyType as A}from"../../engine/webgl/enums.js";import{GraphicTile as z}from"../../engine/webgl/GraphicTile.js";import{TileData as q}from"../../engine/webgl/TileData.js";import D from"../../engine/webgl/WGLDisplayObject.js";import{MeshData as F}from"../../engine/webgl/mesh/MeshData.js";import{WGLMeshFactory as O}from"../../engine/webgl/mesh/factories/WGLMeshFactory.js";import{WGLTemplateStore as E}from"../../engine/webgl/mesh/templates/WGLTemplateStore.js";import{createMatcher as H}from"../../engine/webgl/util/Matcher.js";import{createSymbolSchemaOptions as k,createMatcherSchema as N}from"../features/schemaUtils.js";import B from"../features/support/AttributeStore.js";import{ComputedAttributeStorage as L}from"../features/support/ComputedAttributeStorage.js";import{GraphicsReader as V}from"../features/support/GraphicsReader.js";import W from"./GraphicStore.js";import{intersectingInternationalDateline as J,isMarkerSymbol as Z,isTextSymbol as K,polygonFromExtent as Q,TILE_SIZE as X,PIXEL_BUFFER as Y}from"./graphicsUtils.js";import{expandSymbol as $}from"../support/cimSymbolUtils.js";import{getWebGLCapabilities as ee}from"../../../webgl/capabilities.js";import{createSymbolSchema as te}from"../features/createSymbolSchema.js";const ie=has("esri-2d-graphic-debug");function se(e,t,i){let s=i.get(e);return s||(s={tile:t,addedOrModified:[],removed:[]},i.set(e,s)),s}let re=class extends(o(r(t))){constructor(e){super(e),this._storage=new L,this._displayIds=new Map,this._controller=new AbortController,this._tiles=new Map,this._graphicStoreUpdate=!1,this._graphicsSet=new Set,this._matcher=Promise.resolve(null),this._tileUpdateSet=new Set,this._tilesToUpdate=new Map,this._graphicIdToAbortController=new Map,this._attached=!1,this._updatingGraphicsTimer=null,this._hashToExpandedSymbol=new Map,this._hashToExpandedSymbolPromise=new Map,this._hashToCIMSymbolPromise=new Map,this._hashToCIM=new Map,this._processing=!1,this._needsProcessing=!1,this._pendingUpdate={added:new Set,updated:new Set,removed:new Set},this.lastUpdateId=-1,this.renderer=null,this.updateRequested=!1,this.defaultPointSymbolEnabled=!0,this.graphicUpdateHandler=this.graphicUpdateHandler.bind(this)}destroy(){this._updatingGraphicsTimer&&(clearTimeout(this._updatingGraphicsTimer),this._updatingGraphicsTimer=null,this.notifyChange("updating")),this._controller.abort(),this.container.destroy(),this._set("graphics",null),this._graphicStore.clear(),this._attributeStore=null,this._hashToExpandedSymbol.clear(),this.view=null,this.renderer=null,this._hashToCIM.clear(),this._hashToCIMSymbolPromise.clear(),this._hashToExpandedSymbolPromise.clear()}_createMatcher(e,t,i){if(e){const s=k(e),r=N({indexCount:0,fields:{}},"feature",e,s);this._matcher=H(r,t,null,i)}}_createDisplayId(e){let t=this._displayIds.get(e);return t||(t=this._storage.createDisplayId(),this._displayIds.set(e,t)),t}initialize(){this._attributeStore=new B({type:"local",initialize:e=>Promise.resolve(this.container.attributeView.initialize(e)),update:e=>this.container.attributeView.requestUpdate(e),render:()=>this.container.requestRender()},ee("2d")),this.container.hasHighlight=()=>this._attributeStore.hasHighlight;const e=e=>{this._createDisplayId(e.uid),this._setFilterState(e.uid,e.visible)},t=e=>{const t=this._displayIds.get(e.uid);this._displayIds.delete(e.uid),this._storage.releaseDisplayId(t)},i=new E(this.container.getMaterialItems.bind(this.container),this.view.featuresTilingScheme.tileInfo);this._graphicStore=new W(this.view.featuresTilingScheme,this.view.state.scale,this.uid,this.graphics,e,t,this._hashToCIM),this._meshFactory=new O(null,this.uid,i),this._templateStore=i,this.handles.add([d((()=>this._effectiveRenderer),(e=>{this._createMatcher(e,i,this.container.stage.resourceManager);for(const t of this.graphics)this._pendingUpdate.updated.add(t);this.requestUpdate()})),this.view.graphicsTileStore.on("update",this._onTileUpdate.bind(this)),this.container.on("attach",(()=>{ie&&this.container.enableRenderingBounds((()=>this._graphicStore.getAllBounds())),this.graphics.items.length>0&&this._graphicsChangeHandler({target:this.graphics,added:this.graphics.items,removed:[],moved:[]}),this.handles.add(this.graphics.on("change",(e=>this._graphicsChangeHandler(e))),"graphics");const e=this.container.stage.resourceManager;this._createMatcher(this._effectiveRenderer,i,e),this._graphicStore.setResourceManager(e),this._attached=!0,this.notifyChange("updating")}))]);const s=this.view.graphicsTileStore.tiles;this._onTileUpdate({added:s,removed:[]})}get _effectiveRenderer(){return"function"==typeof this.renderer?this.renderer():this.renderer}get updating(){return!this._attached||null!==this._updatingGraphicsTimer||this._pendingUpdate.added.size>0||this._pendingUpdate.removed.size>0||this._pendingUpdate.updated.size>0||this._tileUpdateSet.size>0||this._tilesToUpdate.size>0||this._attributeStore?.updatingHandles.updating||this._processing}hitTest(e){if(!this.view||!this.view.position)return[];const{resolution:t,rotation:i}=this.view.state;return this._graphicStore.hitTest(e.x,e.y,2,t,i)}update(e){n(this._controller.signal);const t=e.state,{resolution:i}=t;if(this._graphicStore.updateLevel(i),this._graphicStoreUpdate=!0,this.updateRequested=!1,this._pendingUpdate.updated.size>0){if(!this._processing)return void this._updateGraphics();this._needsProcessing=!0}}viewChange(){this.requestUpdate()}requestUpdate(){this.updateRequested||(this.updateRequested=!0,this.requestUpdateCallback())}processUpdate(e){this.updateRequested&&(this.updateRequested=!1,this.update(e))}graphicUpdateHandler(e){const{graphic:t,property:i}=e;switch(i){case"attributes":case"geometry":case"symbol":this._pendingUpdate.updated.add(t),this.requestUpdate();break;case"visible":this._setFilterState(t.uid,t.visible),this._attributeStore.sendUpdates()}}setHighlight(e){const t=e.map((e=>this._displayIds.get(e))).filter(i);this._attributeStore.setHighlight(e,t)}_getIntersectingTiles(e){const t=this._graphicStore.getBounds(e);if(!t||0===u(t)||0===m(t))return[];const i=J(t,this.view.spatialReference);return null!=i?[...new Set([...this.view.graphicsTileStore.boundsIntersections(i[0]),...this.view.graphicsTileStore.boundsIntersections(i[1])])]:this.view.graphicsTileStore.boundsIntersections(t)}async _updateTile(e){n(this._controller.signal);const t=e.tile,i=this._getGraphicsData(this._templateStore,t,e.addedOrModified),s=await this._processGraphics(t,i);return n(this._controller.signal),this._patchTile(t.key,{type:"update",addOrUpdate:s,remove:e.removed,end:!0,clear:!1,sort:!1}),s}_patchTile(e,t){const i=this._tiles.get(e);i&&(this.container.onTileData(i,t),this.container.requestRender())}_graphicsChangeHandler(e){const t=this._pendingUpdate;for(const i of e.added)t.added.add(i);for(const i of e.moved)t.updated.add(i);for(const i of e.removed)this._pendingUpdate.added.has(i)?t.added.delete(i):t.removed.add(i);this._processing?this._needsProcessing=!0:this._updateGraphics()}_getGraphicsToUpdate(){const e={added:[],removed:[],updated:[]};if(!this.graphics)return e;const t=this._pendingUpdate;for(const i of this.graphics.items)t.added.has(i)?e.added.push(i):t.updated.has(i)&&e.updated.push(i);for(const i of t.removed)this._graphicStore.has(i)&&e.removed.push(i);return t.added.clear(),t.removed.clear(),t.updated.clear(),e}async _updateGraphics(){this._processing=!0;const{added:e,removed:t,updated:i}=this._getGraphicsToUpdate(),s=this._tilesToUpdate;let r;try{if(!this._graphicStoreUpdate){const e=this.view.state,{resolution:t}=e;this._graphicStore.updateLevel(t)}const o=[],a=new Array(e.length+t.length);for(let e=0;e<i.length;e++){const t=i[e],n=this._getIntersectingTiles(t);for(const e of n){r=e.id;se(r,e,s).removed.push(this._displayIds.get(t.uid))}o.push(this._updateGraphic(t,null)),a[e]=t}const n=i.length;for(let t=0;t<e.length;t++){const i=e[t];a[n+t]=i,this._graphicsSet.add(i),o.push(this._addGraphic(i))}for(const e of t){this._abortProcessingGraphic(e.uid);const t=this._getIntersectingTiles(e);for(const i of t){r=i.id;se(r,i,s).removed.push(this._displayIds.get(e.uid))}this._graphicsSet.delete(e),this._graphicStore.remove(e)}let h;this._flipUpdatingGraphics(),await Promise.all(o);for(let e=0;e<a.length;e++){h=a[e];const t=this._getIntersectingTiles(h);for(const e of t){r=e.id;se(r,e,s).addedOrModified.push(h)}}this._graphicStore.updateZ();const l=[];for(const[e,t]of s)l.push(this._updateTile(t));await Promise.all(l)}catch(o){h(o),0}for(const a of t)try{const e=await this._getSymbolForGraphic(a,null);if(e){const t=e.hash();this._hashToExpandedSymbol.delete(t)}}catch(o){h(o),0}s.clear(),this.notifyChange("updating"),this._processing=!1,this._needsProcessing&&(this._needsProcessing=!1,this._updateGraphics())}_getArcadeInfo(e){const t=(e.attributes?Object.keys(e.attributes):[]).map((t=>({name:t,alias:t,type:"string"==typeof e.attributes[t]?"esriFieldTypeString":"esriFieldTypeDouble"})));return null==e.geometry?null:{geometryType:y(e.geometry),spatialReference:g.fromJSON(e.geometry.spatialReference),fields:t}}_getSymbolForGraphic(e,t){return n(this._controller.signal),null!=e.symbol?Promise.resolve(e.symbol):null!=this._effectiveRenderer?this._effectiveRenderer.getSymbolAsync(e,{scale:this.view.scale,signal:null!=t?t.signal:null}):Promise.resolve(this._getNullSymbol(e))}_getCIMSymbol(e,t,i){let s=this._hashToCIM.get(t);if(s)return Promise.resolve(s);const r=j(e);if(null!=r){if("CIMSymbolReference"===r.type)return s=r,this._hashToCIM.set(t,s),Promise.resolve(s);let e=this._hashToCIMSymbolPromise.get(t);return e||(e=r.fetchCIMSymbol(i).then((e=>(this._hashToCIM.set(t,e.data),this._hashToCIMSymbolPromise.delete(t),e))).catch((e=>(this._hashToCIMSymbolPromise.delete(t),l(e),null))),this._hashToCIMSymbolPromise.set(t,e),e)}return Promise.resolve(null)}_expandCIMSymbol(e,t,i,s){const r=this._hashToExpandedSymbol.get(i);if(r)return Promise.resolve(r);let o=this._hashToExpandedSymbolPromise.get(i);if(o)return o;const a=this.container.stage,n=this._getArcadeInfo(t),h=k(null),l=te(e,h);return o=$(l,n,a.resourceManager,s),this._hashToExpandedSymbolPromise.set(i,o),o.then((e=>(this._hashToExpandedSymbol.set(i,e),this._hashToExpandedSymbolPromise.delete(i),e))),o}async _getSymbolResources(e,t){n(this._controller.signal);return this.container.stage?this._getSymbolForGraphic(e,t).then((i=>{if(!i)return null;const r=i.hash();return this._getCIMSymbol(i,r,t).then((i=>null==i?null:this._expandCIMSymbol(i,e,r,t).then((e=>{const t=e.layers.filter((e=>"text"===e.type&&"string"==typeof e.text));if(t&&t.length>0){const i=new Array(t.length);for(let e=0;e<t.length;e++){const r=t[e],o=[],[a]=s(r.text);r.text=a;for(let e=0;e<a.length;e++)o.push(a.charCodeAt(e));i[e]={symbol:r,id:e,glyphIds:o}}const o=new Map;return this.container.getMaterialItems(i).then((i=>{a(i);for(let e=0;e<t.length;e++){const s=t[e];o.set(s.cim,{text:s.text,mosaicItem:i[e].mosaicItem})}return{symbol:e,textInfo:o,hash:r}}))}return{symbol:e,hash:r}}))))})).catch((e=>(l(e),null))):null}async _projectAndNormalizeGeometry(e,t){if(n(this._controller.signal),null==e.geometry||"mesh"===e.geometry.type)return null;let i=e.geometry;if(b(i)){const e=i.rings;i.rings=e}else if(S(i)){const e=i.paths;i.paths=e}else if(w(i)){const s=await this._getSymbolForGraphic(e,t);if(n(this._controller.signal),s&&(Z(s.type)||K(s.type))){i=i.center}else i=Q(i)}await G(i.spatialReference,this.view.spatialReference);const s=I(i),r=M(s,i.spatialReference,this.view.spatialReference);return r&&f(r),r}_onTileUpdate(e){const t=U(this.view.spatialReference);if(e.added&&e.added.length>0)for(const i of e.added)this._addNewTile(i,t);if(e.removed&&e.removed.length>0)for(const i of e.removed)this._removeTile(i.key)}async _addGraphic(e){this._abortProcessingGraphic(e.uid),n(this._controller.signal);const t=new AbortController;this._graphicIdToAbortController.set(e.uid,t);const i={signal:t.signal};try{await this._addOrUpdateGraphic(e,i),n(this._controller.signal),this._graphicIdToAbortController.delete(e.uid)}catch(s){if(this._graphicIdToAbortController.delete(e.uid),!h(s))throw s}}_updateGraphic(e,t){n(this._controller.signal);const i=this._projectAndNormalizeGeometry(e,t),s=this._getSymbolResources(e,t);return Promise.all([i,s]).then((([t,i])=>{n(this._controller.signal),this._graphicStore.addOrModify(e,i,t)}))}_addOrUpdateGraphic(e,t){n(this._controller.signal);const i=this._projectAndNormalizeGeometry(e,t),s=this._getSymbolResources(e,t);return Promise.all([i,s]).then((([t,i])=>{n(this._controller.signal),this._graphicsSet.has(e)&&this._graphicStore.addOrModify(e,i,t)}))}_addTile(e){const t=this.view.featuresTilingScheme.getTileBounds(_(),e),i=this.view.featuresTilingScheme.getTileResolution(e.level),s=new z(e,i,t[0],t[3]);return this._tiles.set(e,s),this.container.addChild(s),s}async _addNewTile(e,t){const i=this._addTile(e.key),s=this._graphicStore.queryTileData(this._templateStore,e);if(0===s.length)return;if(t){const i=Math.round((t.valid[1]-t.valid[0])/e.resolution);for(const e of s)e.geometry&&(v(e.geometry)||T(e.geometry))&&this._wrapPoints(e,i)}const r=e.key;this._tileUpdateSet.add(e.key),this.notifyChange("updating");try{const t={type:"update",clear:!1,addOrUpdate:await this._processGraphics(e,s),remove:[],end:!0,sort:!1};i.patch(t),this._tileUpdateSet.delete(r),this.notifyChange("updating")}catch(o){if(this._tileUpdateSet.delete(r),this.notifyChange("updating"),!h(o))throw o}}_removeTile(e){if(!this._tiles.has(e))return;const t=this._tiles.get(e);this.container.removeChild(t),t.destroy(),this._tiles.delete(e)}_setFilterState(e,t){const i=this._displayIds.get(e),s=this._attributeStore.getHighlightFlag(e);this._attributeStore.setData(i,0,0,s|(t?x:0))}_getGraphicsData(e,t,i){const s=this.view,r=U(s.spatialReference),o=this._graphicStore.getGraphicsData(e,t,i);if(r){const e=Math.round((r.valid[1]-r.valid[0])/t.resolution);for(const t of o)t.geometry&&(v(t.geometry)||T(t.geometry))&&this._wrapPoints(t,e)}return o}_wrapPoints(e,t){const i=e.geometry;T(i)?this._wrapMultipoint(i,t):this._wrapPoint(e,t)}_wrapMultipoint(e,t){const i=e.points,s=[];let r=0,o=0;for(const[a,n]of i){if(s.push([a+r,n]),r=0,t===X){const e=5*Y;a+o<e?(s.push([t,0]),r=-t):a+o>X-e&&(s.push([-t,0]),r=t)}else a+o<-Y?(s.push([t,0]),r=-t):a+o>X+Y&&(s.push([-t,0]),r=t);o+=a}e.points=s}_wrapPoint(e,t){const i=e.geometry;if(t===X){const s=5*Y;i.x<s?e.geometry={points:[[i.x,i.y],[t,0]]}:i.x>X-s&&(e.geometry={points:[[i.x,i.y],[-t,0]]})}else i.x<-Y?e.geometry={points:[[i.x,i.y],[t,0]]}:i.x>X+Y&&(e.geometry={points:[[i.x,i.y],[-t,0]]})}_processGraphics(e,t,i){if(!(t&&t.length)||!this._meshFactory)return Promise.resolve(null);const s=V.from(t,this.uid,e.transform),r=this._meshFactory;return this._matcher.then((t=>r.analyzeGraphics(s,this.container.stage.resourceManager,t,null,null,i).then((()=>(this._attributeStore.sendUpdates(),this._processAnalyzedGraphics(e,s))))))}_processAnalyzedGraphics(e,t){const i=this._meshFactory,s=t.getSize(),r=t.getCursor(),o={features:s,records:s,metrics:0},a=new F(e.key.id,o,A.DEFAULT,!1,!1),n=[];for(;r.next();){const t=r.readGraphic();t.insertAfter=-1===t.insertAfter?-1:this._displayIds.get(t.insertAfter),t.displayId=this._displayIds.get(t.attributes[this.uid]);const s=new D(t.displayId);s.insertAfter=t.insertAfter,n.push(s),i.writeGraphic(a,r,e.level,this.container.stage.resourceManager)}const h=e.tileInfoView.tileInfo.isWrappable,l=a.serialize(h);if(1!==l.length)return new q;const d=l[0].message;return q.fromVertexData(d,n)}_abortProcessingGraphic(e){this._graphicIdToAbortController.get(e)?.abort()}_getNullSymbol(e){const t=e.geometry;return S(t)?C:b(t)||w(t)?P:this.defaultPointSymbolEnabled?R:null}_flipUpdatingGraphics(){this._updatingGraphicsTimer&&clearTimeout(this._updatingGraphicsTimer),this._updatingGraphicsTimer=setTimeout((()=>{this._updatingGraphicsTimer=null,this.notifyChange("updating")}),160),this.notifyChange("updating")}};e([p()],re.prototype,"_effectiveRenderer",null),e([p({constructOnly:!0})],re.prototype,"requestUpdateCallback",void 0),e([p()],re.prototype,"container",void 0),e([p({constructOnly:!0})],re.prototype,"graphics",void 0),e([p()],re.prototype,"renderer",void 0),e([p()],re.prototype,"updating",null),e([p()],re.prototype,"view",void 0),e([p()],re.prototype,"updateRequested",void 0),e([p()],re.prototype,"defaultPointSymbolEnabled",void 0),re=e([c("esri.views.2d.layers.support.GraphicsView2D")],re);const oe=re;export{oe as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isDevEnvironment as t,adjustStaticAGOUrl as r}from"../../../../core/devEnvironmentUtils.js";import
|
|
5
|
+
import{isDevEnvironment as t,adjustStaticAGOUrl as r}from"../../../../core/devEnvironmentUtils.js";import o from"../../../../core/Error.js";import{throwIfAbortError as e}from"../../../../core/promiseUtils.js";import{urlToObject as s}from"../../../../core/urlUtils.js";import l from"../../../../portal/Portal.js";import{f as n}from"../../../../chunks/persistableUrlUtils.js";import{fetchStyle as m,Style2DUrlTemplate as a,requestJSON as i,makeCIMSymbolRef as c,symbolUrlFromStyleItem as y}from"../../../../symbols/support/styleUtils.js";import{getStyleItemFromStyle as u}from"../../../../symbols/support/webStyleSymbolUtils.js";async function f(t,r,s){if(!t.name)throw new o("style-symbol-reference-name-missing","Missing name in style symbol reference");if(t.styleName&&"Esri2DPointSymbolsStyle"===t.styleName)return p(t,s);try{return b(await m(t,r,s),t.name,r,s)}catch(l){return e(l),null}}async function p(t,r){const o=a.replace(/\{SymbolName\}/gi,t.name);try{const t=await i(o,r);return c(t.data)}catch(s){return e(s),null}}async function b(m,a,f,p){const b={portal:f&&null!=f.portal?f.portal:l.getDefault(),url:s(m.baseUrl),origin:"portal-item"},j=u(a,m.data);if(!j){throw new o("symbolstyleutils:symbol-name-not-found",`The symbol name '${a}' could not be found`,{symbolName:a})}let w=n(y(j,"cimRef"),b);t()&&(w=r(w));try{const t=await i(w,p);return c(t.data)}catch(U){return e(U),null}}export{f as fetchCIMSymbolReference};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Accessor.js";import r from"../../../core/Handles.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{watch as n,initial as i}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{DoubleClickZoom as p}from"./handlers/DoubleClickZoom.js";import{DragRotate as m}from"./handlers/DragRotate.js";import{DragZoom as d}from"./handlers/DragZoom.js";import{GamepadNavigation as c}from"./handlers/GamepadNavigation.js";import{KeyboardNavigation as l}from"./handlers/KeyboardNavigation.js";import{MouseWheelZoom as g}from"./handlers/MouseWheelZoom.js";import{PinchAndPanNavigation as u}from"./handlers/PinchAndPanNavigation.js";import{PointerDownCancelAnimation as h}from"./handlers/PointerDownCancelAnimation.js";import{SingleKeyResetHeading as w}from"./handlers/SingleKeyResetHeading.js";import{SingleKeyResetTilt as y}from"./handlers/SingleKeyResetTilt.js";import{TwoFingerTilt as _}from"./handlers/TwoFingerTilt.js";import{BrowserEventSource as f}from"../../input/BrowserEventSource.js";import{InputManager as D,ViewEventPriorities as j}from"../../input/InputManager.js";import{PreventContextMenu as v}from"../../input/handlers/PreventContextMenu.js";import{Drag as A}from"../../input/recognizers/Drag.js";import{ImmediateDoubleClick as
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Accessor.js";import r from"../../../core/Handles.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{watch as n,initial as i}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{DoubleClickZoom as p}from"./handlers/DoubleClickZoom.js";import{DragRotate as m}from"./handlers/DragRotate.js";import{DragZoom as d}from"./handlers/DragZoom.js";import{GamepadNavigation as c}from"./handlers/GamepadNavigation.js";import{KeyboardNavigation as l}from"./handlers/KeyboardNavigation.js";import{MouseWheelZoom as g}from"./handlers/MouseWheelZoom.js";import{PinchAndPanNavigation as u}from"./handlers/PinchAndPanNavigation.js";import{PointerDownCancelAnimation as h}from"./handlers/PointerDownCancelAnimation.js";import{SingleKeyResetHeading as w}from"./handlers/SingleKeyResetHeading.js";import{SingleKeyResetTilt as y}from"./handlers/SingleKeyResetTilt.js";import{TwoFingerTilt as _}from"./handlers/TwoFingerTilt.js";import{BrowserEventSource as f}from"../../input/BrowserEventSource.js";import{InputManager as D,ViewEventPriorities as j}from"../../input/InputManager.js";import{PreventContextMenu as v}from"../../input/handlers/PreventContextMenu.js";import{Drag as A}from"../../input/recognizers/Drag.js";import{ImmediateDoubleClick as M}from"../../input/recognizers/ImmediateDoubleClick.js";import{PointerClickHoldAndDrag as P}from"../../input/recognizers/PointerClickHoldAndDrag.js";import{SingleAndDoubleClick as T}from"../../input/recognizers/SingleAndDoubleClick.js";import{VerticalTwoFingerDrag as R}from"../../input/recognizers/VerticalTwoFingerDrag.js";import{PivotPoint as b}from"../state/controllers/RotateController.js";let z=class extends e{constructor(){super(...arguments),this._handles=new r}destroy(){this._handles=o(this._handles),this.disconnect()}get primaryDragAction(){return this._get("primaryDragAction")}set primaryDragAction(t){"pan"!==t&&"rotate"!==t||t===this._get("primaryDragAction")||(this._set("primaryDragAction",t),this._updateMode())}get mode(){return this._get("mode")}set mode(t){"default"!==t&&"pro"!==t||t===this._get("mode")||(this._set("mode",t),this._updateMode())}get updating(){return!!this._inputManager?.updating}get latestPointerType(){return this._inputManager?.latestPointerType}get latestPointerLocation(){return this._inputManager?.latestPointerLocation}get multiTouchActive(){return this._inputManager?.multiTouchActive??!1}disconnect(){this.view.viewEvents.disconnect(),this._inputManager=o(this._inputManager)}connect(){const t=this.view;this._source=new f(this.view.surface,t.input);const e=[new M,new P,new T,new A(this.view.navigation),new R],r=new D({eventSource:this._source,recognizers:e});this._inputManager=r,r.installHandlers("prevent-context-menu",[new v],j.INTERNAL),this._modeDragPan=new u(t,"primary"),this._modeDragRotate=new m(t,"secondary",b.CENTER),this._modeDragZoom=new d(t,"tertiary");const o={lookAround:"b",pan:{left:"ArrowLeft",right:"ArrowRight",forward:"ArrowUp",backward:"ArrowDown",up:"u",down:"j",headingLeft:"a",headingRight:"d",tiltUp:"w",tiltDown:"s",zoomIn:"+",zoomOut:"-"},resetHeading:"n",resetTilt:"p"};r.installHandlers("navigation",[new h(t),new p(t),new c(t),new l(t,o.pan),new g(t),new y(t,o.resetTilt),new w(t,o.resetHeading),new m(t,"primary",b.EYE,[o.lookAround]),new m(t,"secondary",b.CENTER,[o.lookAround]),new u(t,"tertiary",[o.lookAround]),this._modeDragRotate,this._modeDragZoom,this._modeDragPan,new _(t)],j.INTERNAL),this.view.viewEvents.connect(r),this._updateMode(),this._handles.add(n((()=>this.view.navigation?.browserTouchPanEnabled),(t=>{this._source.browserTouchPanningEnabled=!t}),i))}_updateMode(){const t=this.mode,e=this.primaryDragAction,r=E.get(t)?.get(e);r&&(this._modeDragPan&&(this._modeDragPan.pointerAction=r.pan),this._modeDragRotate&&(this._modeDragRotate.pointerAction=r.rotate),this._modeDragZoom&&(this._modeDragZoom.pointerAction=r.zoom))}get test(){return{inputManager:this._inputManager,modeDragPan:this._modeDragPan,modeDragRotate:this._modeDragRotate,modeDragZoom:this._modeDragZoom}}};t([a()],z.prototype,"view",void 0),t([a({value:"pan"})],z.prototype,"primaryDragAction",null),t([a({value:"default"})],z.prototype,"mode",null),t([a({readOnly:!0})],z.prototype,"updating",null),t([a()],z.prototype,"latestPointerType",null),t([a()],z.prototype,"latestPointerLocation",null),t([a()],z.prototype,"multiTouchActive",null),t([a()],z.prototype,"_inputManager",void 0),z=t([s("esri.views.3d.input.SceneInputManager")],z);const E=new Map,k=new Map,C=new Map;k.set("pan",{pan:"primary",rotate:"secondary",zoom:"tertiary"}),k.set("rotate",{pan:"secondary",rotate:"primary",zoom:"tertiary"}),C.set("pan",{pan:"primary",rotate:"tertiary",zoom:"secondary"}),C.set("rotate",{pan:"tertiary",rotate:"primary",zoom:"secondary"}),E.set("default",k),E.set("pro",C);const N=z;export{N as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{a as e}from"../../../chunks/mat4.js";import{b as t,f as r,m as n,n as o}from"../../../chunks/vec3.js";import{f as i}from"../../../chunks/vec4f64.js";import{sv3d as a,sm4d as c}from"../../../geometry/support/vectorStacks.js";import{hydrateGeometry as l}from"../../../layers/graphics/hydratedFeatures.js";import{Manipulator3D as s}from"./Manipulator3D.js";import{RenderObject as u}from"./RenderObject.js";import{computeCentroid as m}from"../layers/graphics/graphicUtils.js";import{Attribute as d}from"../webgl-engine/lib/Attribute.js";import{CullFaceOptions as p}from"../webgl-engine/lib/basicInterfaces.js";import{Geometry as f}from"../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as g,createSphereGeometry as w}from"../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as b}from"../webgl-engine/lib/Material.js";import{VertexAttribute as h}from"../webgl-engine/lib/VertexAttribute.js";import{ColorMaterial as j}from"../webgl-engine/materials/ColorMaterial.js";import{ImageMaterial as O}from"../webgl-engine/materials/ImageMaterial.js";import{NativeLineMaterial as M}from"../webgl-engine/materials/NativeLineMaterial.js";import{RibbonLineMaterial as y}from"../webgl-engine/materials/RibbonLineMaterial.js";import{ShadedColorMaterial as S}from"../webgl-engine/materials/ShadedColorMaterial.js";import{ManipulatorStateCustomFlags as v,ManipulatorStateFlags as A}from"../../interactive/interfaces.js";function F(e,t=b.OccludeAndTransparent,r=!0){const n=i(e[0],e[1],e[2],e.length>3?e[3]:1),o=e[3]<1;return r?new S({color:n,transparent:o,writeDepth
|
|
5
|
+
import{a as e}from"../../../chunks/mat4.js";import{b as t,f as r,m as n,n as o}from"../../../chunks/vec3.js";import{f as i}from"../../../chunks/vec4f64.js";import{sv3d as a,sm4d as c}from"../../../geometry/support/vectorStacks.js";import{hydrateGeometry as l}from"../../../layers/graphics/hydratedFeatures.js";import{Manipulator3D as s}from"./Manipulator3D.js";import{RenderObject as u}from"./RenderObject.js";import{computeCentroid as m}from"../layers/graphics/graphicUtils.js";import{Attribute as d}from"../webgl-engine/lib/Attribute.js";import{CullFaceOptions as p}from"../webgl-engine/lib/basicInterfaces.js";import{Geometry as f}from"../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as g,createSphereGeometry as w}from"../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as b}from"../webgl-engine/lib/Material.js";import{VertexAttribute as h}from"../webgl-engine/lib/VertexAttribute.js";import{ColorMaterial as j}from"../webgl-engine/materials/ColorMaterial.js";import{ImageMaterial as O}from"../webgl-engine/materials/ImageMaterial.js";import{NativeLineMaterial as M}from"../webgl-engine/materials/NativeLineMaterial.js";import{RibbonLineMaterial as y}from"../webgl-engine/materials/RibbonLineMaterial.js";import{ShadedColorMaterial as S}from"../webgl-engine/materials/ShadedColorMaterial.js";import{ManipulatorStateCustomFlags as v,ManipulatorStateFlags as A}from"../../interactive/interfaces.js";function F(e,t=b.OccludeAndTransparent,r=!0){const n=i(e[0],e[1],e[2],e.length>3?e[3]:1),o=e[3]<1,a=!o;return r?new S({color:n,transparent:o,writeDepth:a,cullFace:p.Back,renderOccluded:t}):new j({color:n,transparent:o,writeDepth:a,cullFace:p.Back,renderOccluded:t})}function k(e,t=b.OccludeAndTransparent){const r=i(e[0],e[1],e[2],4===e.length?e[3]:1);return new j({color:r,transparent:!0,writeDepth:!0,cullFace:p.Front,renderOccluded:t})}const I=Object.freeze({calloutLength:40,calloutWidth:1,discRadius:27,focusMultiplier:1.1});function R(e,t){const r=new s({view:e,autoScaleRenderObjects:!1,collisionPriority:1,metadata:t.metadata});return L(r,t),r}function L(e,t){const r=t.material??new O({transparent:!0,writeDepth:!1,textureId:t.texture?.id,renderOccluded:b.Opaque}),n=t.focusMultiplier??I.focusMultiplier,o=t.calloutLength??I.calloutLength,i=I.discRadius*(t.discScale??1),a=i*n,c=(e,t)=>{const r=[0,1,2,2,3,0];return new f(t,[[h.POSITION,new d([o-e,-e,0,o+e,-e,0,o+e,e,0,o-e,e,0],3,!0)],[h.UV0,new d([0,0,1,0,1,1,0,1],2,!0)]],[[h.POSITION,r],[h.UV0,r]])},l=t.calloutWidth??I.calloutWidth,s=new(l>1?y:M)({width:l,color:t.calloutColor,renderOccluded:b.OccludeAndTransparent}),m=g(s,[[0,0,0],[o-i,0,0]]),p=g(s,[[0,0,0],[o-a,0,0]]),w=t.customStateMask??v.None;e.collisionType={type:"disc",direction:[0,0,1],offset:[o,0,0]},e.focusMultiplier=n,e.metadata=t.metadata,e.radius=i,e.renderObjects=[new u(c(i,r),A.Unfocused|w),new u(m,A.Unfocused|w),new u(c(a,r),A.Focused|w),new u(p,A.Focused|w)]}function T(e,t,r=v.None){const n=F(t),o=[new u(w(n,1,32,32),r)];return new s({view:e,renderObjects:o})}const U=Object.freeze({autoScaleRenderObjects:!1,worldSized:!0});function D(o,i,l,s){const u=t(a.get(),o,l),m=N(u,r(a.get(),s,u),l,c.get());e(m,m);const d=n(a.get(),i,m);return Math.atan2(d[1],d[0])}function N(e,t,n,i){const c=o(a.get(),e),l=o(a.get(),t),s=r(a.get(),c,l);return i[0]=c[0],i[1]=c[1],i[2]=c[2],i[3]=0,i[4]=l[0],i[5]=l[1],i[6]=l[2],i[7]=0,i[8]=s[0],i[9]=s[1],i[10]=s[2],i[11]=0,i[12]=n[0],i[13]=n[1],i[14]=n[2],i[15]=1,i}function x(e,t){const r=e.getViewForGraphic(t);return null!=r&&"computeAttachmentOrigin"in r?r.computeAttachmentOrigin(t,e.spatialReference):null}function V(e,t,r){const n=x(e,r);null==n?z(t,r.geometry):t.elevationAlignedLocation=n}function z(e,t){if(null==t)return;const r="mesh"===t.type?t.anchor:m(t);null!=r&&(e.location=l(r))}export{D as calculateInputRotationTransform,N as calculateTranslateRotateFromBases,F as createManipulatorMaterial,k as createManipulatorOutlineMaterial,R as createRotateManipulator,T as createSphereManipulator,x as getGraphicAttachmentOrigin,V as placeAtGraphic,L as updateRotateManipulator,U as worldScaledManipulatorSettings};
|