@arcgis/core 5.1.0-next.89 → 5.1.0-next.90
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/arcade/arcadeAsyncRuntime.js +1 -1
- package/arcade/arcadeCompiler.js +1 -1
- package/arcade/arcadeRuntime.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/014a5fad55f97b9b5166.js +1 -0
- package/assets/esri/core/workers/chunks/{9d10db72e342fe63c981.js → 36f6673b23579b88d8f7.js} +1 -1
- package/assets/esri/core/workers/chunks/53ef72edc3ed80bf558c.js +1 -0
- package/assets/esri/core/workers/chunks/{456d269e3982c437010a.js → 71cfab6305f275cfb04e.js} +1 -1
- package/assets/esri/core/workers/chunks/740588250eaffb7301fd.js +1 -0
- package/assets/esri/core/workers/chunks/{7160e3e7340beb7fdb42.js → bea170f08f5261e22d29.js} +1 -1
- package/assets/esri/core/workers/chunks/{d5ad036d282df54b9ddc.js → f971dcfd04af1fd652b4.js} +1 -1
- package/chunks/array.js +1 -1
- package/config.js +1 -1
- package/core/workers/workerFactory.js +1 -1
- package/kernel.js +1 -1
- package/layers/graphics/featureConversionUtils.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/placements/PlacementAtMeasuredUnits.js +1 -1
- package/views/2d/FrameTask.js +1 -1
- package/views/2d/LabelManager.js +1 -1
- package/views/2d/engine/DisplayObject.js +1 -1
- package/views/2d/engine/Stage.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/input/MapViewInputManager.js +1 -1
- package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
- package/views/2d/layers/ImageryLayerView2D.js +1 -1
- package/views/2d/layers/LayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/SubtypeGroupLayerView2D.js +1 -1
- package/views/2d/layers/features/FeatureContainer.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
- package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
- package/views/2d/layers/imagery/ImageryView2D.js +1 -1
- package/views/2d/layers/support/UpdateTracking2D.js +1 -1
- package/views/VideoView.js +1 -1
- package/views/View2D.js +1 -1
- package/views/support/waitForResources.js +1 -1
- package/assets/esri/core/workers/chunks/0e3dcf99382478181366.js +0 -1
- package/assets/esri/core/workers/chunks/48acd146bf0241d87647.js +0 -1
- package/assets/esri/core/workers/chunks/e0fcb5fa0e9f21fde2b6.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../AggregateGraphic.js";import r from"../../../Graphic.js";import i from"../../../TrackGraphic.js";import{isSome as s}from"../../../core/arrayUtils.js";import a from"../../../core/Collection.js";import o from"../../../core/Error.js";import{makeHandle as n,handlesGroup as u}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import l from"../../../core/Logger.js";import{destroyMaybe as h}from"../../../core/maybe.js";import{notDeepEqual as c}from"../../../core/object.js";import{createAbortError as p,ignoreAbortErrors as d,throwIfNotAbortError as y,isAbortError as g}from"../../../core/promiseUtils.js";import{watch as f,initial as m,sync as w}from"../../../core/reactiveUtils.js";import{sqlAnd as v}from"../../../core/sql.js";import{getMetersPerUnitForSR as _}from"../../../core/units.js";import{property as b,subclass as S}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as A}from"../../../core/support/UpdatingHandles.js";import F from"../../../geometry/Extent.js";import j from"../../../geometry/support/rotate.js";import{isCurvedGeometry as x}from"../../../geometry/support/curves/curveUtils.js";import{densifyCurvedGeometry as E}from"../../../geometry/support/curves/densifyCurvedGeometry.js";import U from"../../../layers/effects/FeatureEffectView.js";import{convertFromFeature as k}from"../../../layers/graphics/featureConversionUtils.js";import I from"../../../layers/support/FeatureFilter.js";import{checkServiceCurrentUserSupport as R}from"../../../layers/support/featureLayerUtils.js";import{packFields as O}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as q}from"../../../layers/support/layerUtils.js";import{combineTimeExtent as C}from"../../../layers/support/timeSupport.js";import Q from"../../../rest/support/AggregateFeatureSet.js";import V from"../../../rest/support/AttributeBinsFeatureSet.js";import L from"../../../rest/support/AttributeBinsQuery.js";import P from"../../../rest/support/FeatureSet.js";import T from"../../../rest/support/Query.js";import{LayerView2D as W}from"./LayerView2D.js";import{FeatureContainer as H}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as M}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as G}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as D}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as N}from"./features/layerAdapters/FeatureLayerAdapter.js";import{createFeatureIdInfo as J}from"./features/layerAdapters/featureServiceUtils.js";import{InMemoryLayerAdapter as B}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as z}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as $}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as Z}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{ParquetLayerAdapter as K}from"./features/layerAdapters/ParquetLayerAdapter.js";import{StreamLayerAdapter as X}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as Y}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as ee}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import{DebouncedFeatureOverride as te}from"./support/DebouncedFeatureOverride.js";import{FeatureCommandQueue as re}from"./support/FeatureCommandQueue.js";import{handleNoEngineError as ie}from"./support/handleNoEngineError.js";import{toJSONGeometryType as se}from"./support/util.js";import{isScreenRect as ae}from"../support/hitTestUtils.js";import{FeatureTileSubscriptionManager as oe}from"../tiling/FeatureTileSubscriptionManager.js";import{RefreshableLayerView as ne}from"../../layers/RefreshableLayerView.js";import{getHighlightName as ue}from"../../support/highlightOptionsUtils.js";function le(e,t){const r=new Set;return e&&e.forEach(e=>r.add(e)),t&&t.forEach(e=>r.add(e)),r.has("*")?["*"]:Array.from(r)}const he=4294967294;function ce(e,t){return u(e.map(e=>f(()=>{const t=e();return t&&"object"==typeof t?"getTime"in t&&"function"==typeof t.getTime?t.getTime():JSON.stringify(t):t},t,w)))}function pe(e){if(!e.geometry)return e;if(!x(e.geometry))return e;const t=.001/_(e.geometry.spatialReference),r=100;return{geometry:E(e.geometry,{maxSegmentsPerCurve:12e3,maxSegmentLength:r*t,maxDeviation:0}),attributes:e.attributes}}const de=u=>{const w=ne(W(u));let _=class extends w{constructor(){super(...arguments),this._commandsQueue=new re({process:e=>{switch(e.type){case"override-batch":return this._doOverride(e);case"update":return this._doUpdate();case"highlight":return this._updateHighlights()}}}),this._visibilityOverrides=new Set,this._lastAvailableFields=[],this._lastTargetState=null,this._lastRequiredLevel=0,this.eventLog=new G,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._editUpdatingHandles=new A,this._fields=null,this._sourceUpdating=!1,this.featureEffectView=new U}destroy(){this._editUpdatingHandles.destroy(),this._workerProxy?.destroy(),this._workerAttached.reject(p()),this._commandsQueue.destroy()}initialize(){this._workerAttached=Promise.withResolvers(),d(this._workerAttached.promise),this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransition()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new o("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===q(e)?.operations.supportsQuery)throw new o("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._workerProxy&&this._workerProxy.destroy();const t=this._createClientOptions();this._workerProxy=await M(t)}async _attachProxy(){const e=j(this.view.extent,this.view.rotation,this.view.center),t=this.view.featuresTilingScheme.getClosestInfoForScale(this.view.scale).level;t!==this._lastRequiredLevel&&(this._lastRequiredLevel=t);const r={tileInfoJSON:this.view?.featuresTilingScheme?.tileInfo?.toJSON(),initialViewExtent:e.toJSON(),requiredLevel:t,requiredScale:this.view.scale};try{await this._workerProxy.pipeline.onAttach(r),this._workerAttached.resolve()}catch(i){this._workerAttached.reject(p()),y(i)}}async _detachProxy(){return this._workerProxy.pipeline.onDetach()}async getWorker(){return await this._workerAttached.promise,this._workerProxy}get dataUpdating(){return this._sourceUpdating||this._editUpdatingHandles.updating}get hasAllFeatures(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&this.eventLog.willQueryAllFeatures}get hasAllFeaturesInView(){const e=this.effectiveDisplayFilter?.where||null,t=!this.eventLog.willQueryAllFeatures&&null!=e&&"1=1"!==e;return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&!t}get hasFullGeometries(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&this.eventLog.willQueryFullResolutionGeometry}get layerAdapter(){switch(this.layer.type){case"feature":return"memory"===this.layer.source.type?new B(this.layer):new N(this.layer);case"geojson":case"csv":case"wfs":return new B(this.layer);case"parquet":return new K(this.layer);case"subtype-group":return new Y(this.layer);case"ogc-feature":return new $(this.layer);case"stream":return new X(this.layer);case"oriented-imagery":return new Z(this.layer);case"knowledge-graph-sublayer":return new z(this.layer);case"catalog-footprint":return new D(this.layer);default:this.layer}return null}get timeExtent(){return C(this.layerAdapter.timeOptions,this.view?.timeExtent,this._get("timeExtent"))}get usedMemory(){return this.container.usedMemory+this.eventLog.pipelineStatistics.usedMemory}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}highlight(e,t){let i;e instanceof r?i=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?i=[e]:a.isCollection(e)&&e.length>0?i=e.map(e=>e?.getObjectId()).toArray():Array.isArray(e)&&e.length>0&&(i="number"==typeof e[0]||"string"==typeof e[0]?e:e.map(e=>e?.getObjectId()));const o=i?.filter(s);if(!o?.length)return n();const u=ue(t);return this._addHighlights(o,u),n(()=>!this.destroyed&&this._removeHighlights(o,u))}async hitTest(e,s){const a=ae(s),o=await this.featureContainer.hitTest(s);if(0===o.length)return null;const n=await this.getWorker(),{features:u,aggregates:l,tracks:h}=await n.pipeline.getDisplayFeatures(o),c=this.featureContainer.getSortKeys(o),p=({displayId:e},{displayId:t})=>c.has(e)&&c.has(t)?c.get(e)-c.get(t):e-t;u.sort(p).reverse(),l.sort(p).reverse();const d=has("parquetlayer-hittest-max-feature-count")??1;return"parquet"===this.layer.type&&u.length>d&&(u.length=d),[...l.map(r=>this._createAggregateGraphicHit(e,t.fromJSON(r))),...h.map(t=>this._createTrackGraphicHit(e,i.fromJSON(t))),...u.map(t=>this._createFeatureGraphicHit(a?null:e,r.fromJSON(t)))]}async queryAggregateSummaryStatistics(e,t,r){const i={...t,scale:this.view.scale},s=(await this.getWorker()).aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),i,r);return ie(s,{})}async queryUniqueValues(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForUniqueValues(this._cleanUpQuery(e),s,r);return ie(a,{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),s,r);return ie(a,{uniqueValueInfos:[]})}async queryAggregateClassBreaks(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),s,r);return ie(a,{classBreakInfos:[]})}async queryHistogram(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForHistogram(this._cleanUpQuery(e),s,r);return ie(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateCount(e,t){const r=(await this.getWorker()).aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t);return ie(r,0)}async queryAggregateHistogram(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),s,r);return ie(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateIds(e,t){const r=(await this.getWorker()).aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t);return ie(r,[])}async queryAggregateJSON(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t);return ie(r,{features:[]})}async queryAttributeBins(e,t){const r=(await this.getWorker()).features.executeAttributeBinsQuery(this._cleanUpAttributeBinsQuery(e),t),i=await ie(r,{features:[]});return V.fromJSON(i)}async queryAggregates(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),i=await ie(r,{features:[]}),s=Q.fromJSON(i);return s.features.forEach(e=>this.layerAdapter.setAggregateGraphicOrigin?.(e)),s}async queryClassBreaks(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForClassBreaks(this._cleanUpQuery(e),s,r);return ie(a,{classBreakInfos:[]})}async queryExtent(e,t){const r=(await this.getWorker()).features.executeQueryForExtent(this._cleanUpQuery(e),t),i=await ie(r,{count:0,extent:null});return{count:i.count,extent:F.fromJSON(i.extent)}}async queryFeatureCount(e,t){const r=(await this.getWorker()).features.executeQueryForCount(this._cleanUpQuery(e),t);return ie(r,0)}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then(e=>{const t=P.fromJSON(e);return t.features.forEach(e=>this._setOriginForFeature(e)),t})}async queryFeaturesJSON(e,t){const r=(await this.getWorker()).features.executeQuery(this._cleanUpQuery(e),t);return ie(r,{features:[]})}async queryHeatmapStatistics(e){return(await this.getWorker()).pipeline.queryHeatmapStatistics(e)}async queryObjectIds(e,t){const r=(await this.getWorker()).features.executeQueryForIds(this._cleanUpQuery(e),t);return ie(r,[])}async queryStatistics(){const e=await this.getWorker();return ie(e.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}async querySummaryStatistics(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),s,r);return ie(a,{})}async queryVisibleFeatures(e,t){const r=(await this.getWorker()).pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),i=await ie(r,{features:[]}),s=P.fromJSON(i);return s.features.forEach(e=>this._setOriginForFeature(e)),s}async getSampleFeatures(e){return(await this.getWorker()).pipeline.getSampleFeatures(e)}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._subscriptions)return;this.view.animation&&!this._lastTargetState&&(this._lastTargetState=e.state.clone()),!this.view.animation&&this._lastTargetState&&(this._lastTargetState=null);const t=this.featureContainer.getPresenting(),r=this._subscriptions.update(e.targetState,this._lastTargetState,t);r&&(this.featureContainer.updateSubscriptions(r),d(this._updatingHandles.addPromise(this.getWorker().then(e=>e.pipeline.updateSubscriptions(r))))),this._subscriptions.coverage&&this.featureContainer.setCoverage(this._subscriptions.coverage)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),d(this._updatingHandles.addPromise(this._workerAttached.promise)),d(this._attachProxy()),this.featureContainer=new H(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptions=new oe(this.view.featuresTilingScheme),this.requestUpdate(),this.addAttachHandles([ce([()=>this._displayRefreshVersion,()=>"displayFilterInfo"in this.layer&&this.layer.displayFilterInfo,()=>this.timeExtent,()=>this.clips,()=>this.filter,()=>this.effectiveDisplayFilterClause,()=>this.featureEffect,()=>this._sourceRefreshVersion,()=>this.view.timeZone,()=>this.view.timeExtent,...this.layerAdapter.getUpdateHashProperties(this.view)],()=>this._update()),f(()=>this.updateSuspended,e=>{e||this._subscriptions.resume(this.featureContainer.getPresenting())}),f(()=>this.view.scale,async e=>{const t=this.view.featuresTilingScheme.getClosestInfoForScale(e).level;if(t!==this._lastRequiredLevel){this._lastRequiredLevel=t;(await this.getWorker()).pipeline.updateRequiredLevel(t,e)}},m),f(()=>this.view.stationary,async e=>{if(e){const e=await this.getWorker(),t=j(this.view.extent,this.view.rotation,this.view.center);e.pipeline.updateStationaryExtent(t.toJSON(),this.featureContainer.requiresRefresh)}})]),this._update(),"stream"!==this.layer.type&&"parquet"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",e=>this._editUpdatingHandles.addPromise(this._edit(e))))}detach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.detach"),this._detachProxy(),this._fields=null,this.featureContainer.destroy(),this.featureContainer=null,this._commandsQueue.clear(),this.container.removeAllChildren(),this._subscriptions=h(this._subscriptions),this._workerProxy.pipeline.onDetach(),this._workerAttached=Promise.withResolvers(),d(this._workerAttached.promise),this._lastAvailableFields=[],this._lastSchema=null}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}addOverrides(e){return this._commandsQueue.push({type:"override",options:{...e,release:[]}})}removeOverrides(e){for(const r of e)if(null==r)throw new o("featurelayerview:bad-override","Tried to remove an override for an invalid objectId",{objectId:r});const t={added:[],updated:[],removed:[],release:e,isWeak:!1,historicMoment:null};return this._commandsQueue.push({type:"override",options:t})}onProxyClientEvent(e){}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredPromise,i=this.featureContainer.updating,s=this.updateRequested||e&&(t||r)||i||this._pipelineUpdating||this.dataUpdating;return has("esri-2d-log-updating")&&console.log(`Updating FLV2D (${this.layer.id}): ${s}\n -> updateRequested ${this.updateRequested}\n -> hasRenderer ${e}\n -> updatingRequiredFields ${r}\n -> hasPendingCommand ${t}\n -> dataUpdating ${this.dataUpdating}\n -> processing ${this._pipelineUpdating}\n -> updatingContainer ${i}\n`),s}_createClientOptions(){const e=this;return{updateSchemaStart:()=>e.updateSchemaStart(),updateSchemaEnd:t=>e.updateSchemaEnd(t),openMemoryPorts:async()=>{if(this.layerAdapter?.openMessagePorts){const e=await this.layerAdapter.openMessagePorts();return{result:e,transferList:e}}throw new Error("InternalError: Layer adapter does not support opening message ports")},get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("_sourceUpdating",e.source)},emitEvent:e=>{this.onProxyClientEvent(e)},get eventLog(){return e.eventLog},fetch:async t=>{if(has("esri-2d-stabilize-glyphs")){const r=[];for(const i of t)r.push(await e.view.stage.painter.textureManager.rasterizeItem(i));return r}return Promise.all(t.map(t=>e.view.stage.painter.textureManager.rasterizeItem(t)))},fetchDictionary:e=>Promise.all(e.map(e=>this._fetchDictionaryRequest(e)))}}async _fetchDictionaryRequest(e){try{if("subtype-group"===this.layer.type)throw new Error("InternalError: SubtypeGroupLayer does not support dictionary renderer");const t=this.layer.renderer;if(!t||"dictionary"!==t.type)throw new Error("InternalError: Expected layer to have a DictionaryRenderer");const r=this._lastSchema.processor.mesh.factory.symbology;if("dictionary"!==r.type)throw new Error("InternalError: Expected schema to be of type 'dictionary'");const i={cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,store:this.featureContainer.instanceStore,scaleExpression:r.scaleExpression};this._fields||(this._fields=this.layer.fields.map(e=>e.toJSON()));const s=r.visualVariableUniforms,a=se(this.layer.geometryType),o=await t.getSymbolForControlString(e.controlString,a,!1);if(!o||!o.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await ee({...o.data,hasTextStringTemplates:!0},{uniforms:s,path:"renderer",schemaOptions:i})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=T.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),"returnZ"in this.layer&&(t.returnZ??=this.layer.returnZ),"returnM"in this.layer&&(t.returnM??=this.layer.returnM),t.toJSON()}_cleanUpAttributeBinsQuery(e){const t=L.from(e);return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=T.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const i of t.aggregateIds??[])r.push(i);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}_edit(e){return this._commandsQueue.push({type:"edit",event:e})}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%he+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%he+1}async _resolveIdenifiers(e){const t=[],r=[];for(const a of e)null==a.objectId||-1===a.objectId?null==a.globalId?l.getLogger(this).warn("mapview-apply-edits","A feature identifier must contain either a GlobalId or ObjectId. Ignoring",{identifier:a}):r.push(a.globalId):t.push(a.objectId);const i="globalIdField"in this.layer&&this.layer.globalIdField,s=i&&this.availableFields.includes(i);if(r.length&&!s)return l.getLogger(this).error(new o("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${i} to be included the layer's outFields for updates to be reflected on the map`)),t;if(r.length){const e=await this._workerProxy.pipeline.getObjectIdsFromGlobalIds(r);for(const r of e)t.push(r)}return t}_resolveOverrides(e){const t=!1,r=!1,i=se(this.layer.geometryType),s=J(this.layer),a=[];for(const n of e.added){const e=k(pe(n),i,t,r,s);if(null==e.objectId)throw new o("featurelayerview:bad-override","Feature does not have an objectId",{feature:n});a.push(e)}for(const n of e.updated){const e=k(pe(n),i,t,r,s);if(null==e.objectId)throw new o("featurelayerview:bad-override","Feature does not have an objectId",{feature:n});a.push(e)}for(const n of e.removed)if(null==n)throw new o("featurelayerview:bad-override","Tried to remove an invalid objectId",{objectId:n});return{type:"override",updates:a,removed:e.removed,release:e.release,isWeak:e.isWeak??!1,historicMoment:e.historicMoment??null}}async _resolveEdit(e){const t=this.layer,r=e.historicMoment?.getTime()??null,i="layerId"in t&&e.editedFeatures?.find(e=>e.layerId===t.layerId);if(i&&this._canEditByFeature(i)){const{adds:e,deletes:t,updates:s}=i.editedFeatures,a=this.layer.objectIdField,o=s.map(e=>e.current),n=t.map(e=>"attributes"in e?{objectId:a?e.attributes[a]:null}:e),u=await this._resolveIdenifiers(n);return this._resolveOverrides({added:e,updated:o,removed:u,historicMoment:r,isWeak:!0,release:[]})}const[s,a,o]=await Promise.all([this._resolveIdenifiers(e.addedFeatures),this._resolveIdenifiers(e.updatedFeatures),this._resolveIdenifiers(e.deletedFeatures)]);return{type:"override-by-id",updates:[...s,...a],removed:o,historicMoment:r,isWeak:!0}}_canEditByFeature(e){const{adds:t,updates:r}=e.editedFeatures;return t.every(e=>this.view.spatialReference.equals(e.geometry?.spatialReference))&&r.every(e=>this.view.spatialReference.equals(e.current.geometry?.spatialReference))}async updateSchemaStart(){"featureReduction"in this.layer&&this.layer.featureReduction&&this.layer.featureReduction!==this._lastFeatureReduction&&(this.layer.featureReduction=this.layer.featureReduction?.clone(),this._lastFeatureReduction=this.layer.featureReduction);try{if(await Promise.allSettled([this._handleChange(),R(this.layer)]),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this._subscriptions)return null;const e=this.featureContainer.updateStart("subtype-group"===this.layer.type);this._lastFeatureEffect=this.featureEffect;const t={store:e,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},r=await this._createViewSchemaConfig(),i={source:await this.layerAdapter.createSourceSchema(r,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(t,r,this._displayRefreshVersion)};return c(this._lastSchema?.source.strategy,i.source.strategy)||c(this._lastSchema?.processor,i.processor)?(this._lastSchema=i,this._fields=null,i):null}catch(e){}return null}async updateSchemaEnd(e){try{this.featureEffectView.featureEffect=this._lastFeatureEffect,e&&this.featureEffectView.endTransition(),await this.featureContainer.updateEnd(this._lastSchema.processor,this.layerAdapter.getLabelingDeconflictionInfo(),e),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.updateEnd")}catch(t){}}async _doUpdate(){const e=Math.round(performance.now()),t=await this.getWorker();await t.pipeline.updateSchema(e),this.requestUpdate()}async _doOverride(e){const t=await this.getWorker();try{let r=new te;for(const i of e.messages)switch(i.type){case"edit":r.tryAdd(await this._resolveEdit(i.event))||(await t.pipeline.onOverride(r.toMessage()),r=new te,r.tryAdd(await this._resolveEdit(i.event)));break;case"override":r.tryAdd(this._resolveOverrides(i.options))||(await t.pipeline.onOverride(r.toMessage()),r=new te,r.tryAdd(this._resolveOverrides(i.options)));break}await t.pipeline.onOverride(r.toMessage())}catch(r){g(r),0}}_getEffectiveAvailableFields(e){const t=le(this._lastAvailableFields,e);return this._lastAvailableFields=t,O(this.layer.fieldsIndex,t)}async _createViewSchemaConfig(){const e=this.requiresCurrentUser?await this.signedInUser:null,t=[x(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter,this.effectiveDisplayFilterClause),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),displayFilterEnabled:this.displayFilterEnabled,filters:t,scale:this.view.scale,timeZone:this.view.timeZone,timeExtent:this.view.timeExtent,currentUser:e,spatialReference:this.view.spatialReference,extent:this.view.extent,returnZ:this.hasZ,returnM:this.hasM}}_processHighlight(){this._commandsQueue.push({type:"highlight"})}async _updateHighlights(){const e=this._getHighlights(),t=await this.getWorker();if(this.destroyed)return;const r=t.pipeline.updateHighlight({highlights:e}).catch(e=>{g(e)||l.getLogger(this).error(e)});this._updatingHandles.consumePromise(r)}_setOriginForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin(e)}_createFeatureGraphicHit(e,t){return this._setOriginForFeature(t),this._createGraphicHit(e,t)}_createTrackGraphicHit(e,t){return t.layer=t.sourceLayer=this.layer,this.layerAdapter.setTrackGraphicOrigin?.(t),this._createGraphicHit(e,t)}_createAggregateGraphicHit(e,t){return t.layer=t.sourceLayer=this.layer,this.layerAdapter.setAggregateGraphicOrigin?.(t),this._createGraphicHit(e,t)}_createGraphicHit(e,t){return null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function x(e,t,r,i,s,a){s&&(s=s.clone());const o=null!=s?s.timeExtent:null,n=null!=r&&null!=o?r.intersection(o):r||o;n&&(s??=new I,s.timeExtent=n),s=t.addFilters?.(s,e)??s,a&&(s??=new I,s.where=v(s.where,a));let u=s?.toJSON()??null;return i.size&&(u??=(new I).toJSON(),u.hiddenIds=Array.from(i)),u}return e([b()],_.prototype,"_commandsQueue",void 0),e([b()],_.prototype,"_sourceRefreshVersion",void 0),e([b()],_.prototype,"_displayRefreshVersion",void 0),e([b({readOnly:!0})],_.prototype,"_pipelineUpdating",void 0),e([b()],_.prototype,"_sourceUpdating",void 0),e([b({readOnly:!0})],_.prototype,"dataUpdating",null),e([b({readOnly:!0})],_.prototype,"hasAllFeatures",null),e([b({readOnly:!0})],_.prototype,"hasAllFeaturesInView",null),e([b({readOnly:!0})],_.prototype,"hasFullGeometries",null),e([b()],_.prototype,"featureEffectView",void 0),e([b()],_.prototype,"layerAdapter",null),e([b({readOnly:!0})],_.prototype,"timeExtent",null),_=e([S("esri.views.2d.layers.FeatureLikeLayerView2D")],_),_};export{de as FeatureLikeLayerView2D};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../AggregateGraphic.js";import r from"../../../Graphic.js";import i from"../../../TrackGraphic.js";import{isSome as s}from"../../../core/arrayUtils.js";import a from"../../../core/Collection.js";import o from"../../../core/Error.js";import{makeHandle as n,handlesGroup as u}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import l from"../../../core/Logger.js";import{destroyMaybe as h}from"../../../core/maybe.js";import{notDeepEqual as c}from"../../../core/object.js";import{createAbortError as p,ignoreAbortErrors as d,throwIfNotAbortError as y,isAbortError as g}from"../../../core/promiseUtils.js";import{watch as f,initial as m,sync as w}from"../../../core/reactiveUtils.js";import{sqlAnd as v}from"../../../core/sql.js";import{getMetersPerUnitForSR as _}from"../../../core/units.js";import{property as b,subclass as S}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as A}from"../../../core/support/UpdatingHandles.js";import F from"../../../geometry/Extent.js";import j from"../../../geometry/support/rotate.js";import{isCurvedGeometry as x}from"../../../geometry/support/curves/curveUtils.js";import{densifyCurvedGeometry as E}from"../../../geometry/support/curves/densifyCurvedGeometry.js";import k from"../../../layers/effects/FeatureEffectView.js";import{convertFromFeature as I}from"../../../layers/graphics/featureConversionUtils.js";import O from"../../../layers/support/FeatureFilter.js";import{checkServiceCurrentUserSupport as U}from"../../../layers/support/featureLayerUtils.js";import{packFields as R}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as q}from"../../../layers/support/layerUtils.js";import{combineTimeExtent as Q}from"../../../layers/support/timeSupport.js";import C from"../../../rest/support/AggregateFeatureSet.js";import V from"../../../rest/support/AttributeBinsFeatureSet.js";import L from"../../../rest/support/AttributeBinsQuery.js";import P from"../../../rest/support/FeatureSet.js";import T from"../../../rest/support/Query.js";import{LayerView2D as W}from"./LayerView2D.js";import{FeatureContainer as H}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as M}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as G}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as D}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as N}from"./features/layerAdapters/FeatureLayerAdapter.js";import{createFeatureIdInfo as J}from"./features/layerAdapters/featureServiceUtils.js";import{InMemoryLayerAdapter as B}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as z}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as Z}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as K}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{ParquetLayerAdapter as $}from"./features/layerAdapters/ParquetLayerAdapter.js";import{StreamLayerAdapter as X}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as Y}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as ee}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import{DebouncedFeatureOverride as te}from"./support/DebouncedFeatureOverride.js";import{FeatureCommandQueue as re}from"./support/FeatureCommandQueue.js";import{handleNoEngineError as ie}from"./support/handleNoEngineError.js";import{toJSONGeometryType as se}from"./support/util.js";import{isScreenRect as ae}from"../support/hitTestUtils.js";import{FeatureTileSubscriptionManager as oe}from"../tiling/FeatureTileSubscriptionManager.js";import{RefreshableLayerView as ne}from"../../layers/RefreshableLayerView.js";import{getHighlightName as ue}from"../../support/highlightOptionsUtils.js";function le(e,t){const r=new Set;return e&&e.forEach(e=>r.add(e)),t&&t.forEach(e=>r.add(e)),r.has("*")?["*"]:Array.from(r)}const he=4294967294;function ce(e,t){return u(e.map(e=>f(()=>{const t=e();return t&&"object"==typeof t?"getTime"in t&&"function"==typeof t.getTime?t.getTime():JSON.stringify(t):t},t,w)))}function pe(e){if(!e.geometry)return e;if(!x(e.geometry))return e;const t=.001/_(e.geometry.spatialReference),r=100;return{geometry:E(e.geometry,{maxSegmentsPerCurve:12e3,maxSegmentLength:r*t,maxDeviation:0}),attributes:e.attributes}}const de=u=>{const w=ne(W(u));let _=class extends w{constructor(){super(...arguments),this._commandsQueue=new re({process:e=>{switch(e.type){case"override-batch":return this._doOverride(e);case"update":return this._doUpdate();case"highlight":return this._updateHighlights()}}}),this._visibilityOverrides=new Set,this._lastAvailableFields=[],this._lastTargetState=null,this._lastRequiredLevel=0,this.eventLog=new G,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._editUpdatingHandles=new A,this._fields=null,this._sourceUpdating=!1,this.featureEffectView=new k}destroy(){this._editUpdatingHandles.destroy(),this._workerProxy?.destroy(),this._workerAttached.reject(p()),this._commandsQueue.destroy()}initialize(){this._workerAttached=Promise.withResolvers(),d(this._workerAttached.promise),this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransition()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new o("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===q(e)?.operations.supportsQuery)throw new o("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._workerProxy&&this._workerProxy.destroy();const t=this._createClientOptions();this._workerProxy=await M(t)}async _attachProxy(){const e=j(this.view.extent,this.view.rotation,this.view.center),t=this.view.featuresTilingScheme.getClosestInfoForScale(this.view.scale).level;t!==this._lastRequiredLevel&&(this._lastRequiredLevel=t);const r={tileInfoJSON:this.view?.featuresTilingScheme?.tileInfo?.toJSON(),initialViewExtent:e.toJSON(),requiredLevel:t,requiredScale:this.view.scale};try{await this._workerProxy.pipeline.onAttach(r),this._workerAttached.resolve()}catch(i){this._workerAttached.reject(p()),y(i)}}async _detachProxy(){return this._workerProxy.pipeline.onDetach()}async getWorker(){return await this._workerAttached.promise,this._workerProxy}get dataUpdating(){return this._sourceUpdating||this._editUpdatingHandles.updating}get hasAllFeatures(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&this.eventLog.willQueryAllFeatures}get hasAllFeaturesInView(){const e=this.effectiveDisplayFilter?.where||null,t=!this.eventLog.willQueryAllFeatures&&null!=e&&"1=1"!==e;return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&!t}get hasFullGeometries(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&this.eventLog.willQueryFullResolutionGeometry}get layerAdapter(){switch(this.layer.type){case"feature":return"memory"===this.layer.source.type?new B(this.layer):new N(this.layer);case"geojson":case"csv":case"wfs":return new B(this.layer);case"parquet":return new $(this.layer);case"subtype-group":return new Y(this.layer);case"ogc-feature":return new Z(this.layer);case"stream":return new X(this.layer);case"oriented-imagery":return new K(this.layer);case"knowledge-graph-sublayer":return new z(this.layer);case"catalog-footprint":return new D(this.layer);default:this.layer}return null}get timeExtent(){return Q(this.layerAdapter.timeOptions,this.view?.timeExtent,this._get("timeExtent"))}get usedMemory(){return this.container.usedMemory+this.eventLog.pipelineStatistics.usedMemory}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}highlight(e,t){let i;e instanceof r?i=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?i=[e]:a.isCollection(e)&&e.length>0?i=e.map(e=>e?.getObjectId()).toArray():Array.isArray(e)&&e.length>0&&(i="number"==typeof e[0]||"string"==typeof e[0]?e:e.map(e=>e?.getObjectId()));const o=i?.filter(s);if(!o?.length)return n();const u=ue(t);return this._addHighlights(o,u),n(()=>!this.destroyed&&this._removeHighlights(o,u))}async hitTest(e,s){const a=ae(s),o=await this.featureContainer.hitTest(s);if(0===o.length)return null;const n=await this.getWorker(),{features:u,aggregates:l,tracks:h}=await n.pipeline.getDisplayFeatures(o),c=this.featureContainer.getSortKeys(o),p=({displayId:e},{displayId:t})=>c.has(e)&&c.has(t)?c.get(e)-c.get(t):e-t;u.sort(p).reverse(),l.sort(p).reverse();const d=has("parquetlayer-hittest-max-feature-count")??1;return"parquet"===this.layer.type&&u.length>d&&(u.length=d),[...l.map(r=>this._createAggregateGraphicHit(e,t.fromJSON(r))),...h.map(t=>this._createTrackGraphicHit(e,i.fromJSON(t))),...u.map(t=>this._createFeatureGraphicHit(a?null:e,r.fromJSON(t)))]}async queryAggregateSummaryStatistics(e,t,r){const i={...t,scale:this.view.scale},s=(await this.getWorker()).aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),i,r);return ie(s,{})}async queryUniqueValues(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForUniqueValues(this._cleanUpQuery(e),s,r);return ie(a,{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),s,r);return ie(a,{uniqueValueInfos:[]})}async queryAggregateClassBreaks(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),s,r);return ie(a,{classBreakInfos:[]})}async queryHistogram(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForHistogram(this._cleanUpQuery(e),s,r);return ie(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateCount(e,t){const r=(await this.getWorker()).aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t);return ie(r,0)}async queryAggregateHistogram(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),s,r);return ie(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateIds(e,t){const r=(await this.getWorker()).aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t);return ie(r,[])}async queryAggregateJSON(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t);return ie(r,{features:[]})}async queryAttributeBins(e,t){const r=(await this.getWorker()).features.executeAttributeBinsQuery(this._cleanUpAttributeBinsQuery(e),t),i=await ie(r,{features:[]});return V.fromJSON(i)}async queryAggregates(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),i=await ie(r,{features:[]}),s=C.fromJSON(i);return s.features.forEach(e=>this.layerAdapter.setAggregateGraphicOrigin?.(e)),s}async queryClassBreaks(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForClassBreaks(this._cleanUpQuery(e),s,r);return ie(a,{classBreakInfos:[]})}async queryExtent(e,t){const r=(await this.getWorker()).features.executeQueryForExtent(this._cleanUpQuery(e),t),i=await ie(r,{count:0,extent:null});return{count:i.count,extent:F.fromJSON(i.extent)}}async queryFeatureCount(e,t){const r=(await this.getWorker()).features.executeQueryForCount(this._cleanUpQuery(e),t);return ie(r,0)}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then(e=>{const t=P.fromJSON(e);return t.features.forEach(e=>this._setOriginForFeature(e)),t})}async queryFeaturesJSON(e,t){const r=(await this.getWorker()).features.executeQuery(this._cleanUpQuery(e),t);return ie(r,{features:[]})}async queryHeatmapStatistics(e){return(await this.getWorker()).pipeline.queryHeatmapStatistics(e)}async queryObjectIds(e,t){const r=(await this.getWorker()).features.executeQueryForIds(this._cleanUpQuery(e),t);return ie(r,[])}async queryStatistics(){const e=await this.getWorker();return ie(e.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}async querySummaryStatistics(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),s,r);return ie(a,{})}async queryVisibleFeatures(e,t){const r=(await this.getWorker()).pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),i=await ie(r,{features:[]}),s=P.fromJSON(i);return s.features.forEach(e=>this._setOriginForFeature(e)),s}async getSampleFeatures(e){return(await this.getWorker()).pipeline.getSampleFeatures(e)}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._subscriptions)return;this.view.animation&&!this._lastTargetState&&(this._lastTargetState=e.state.clone()),!this.view.animation&&this._lastTargetState&&(this._lastTargetState=null);const t=this.featureContainer.getPresenting(),r=this._subscriptions.update(e.targetState,this._lastTargetState,t);r&&(this.featureContainer.updateSubscriptions(r),d(this._updatingHandles.addPromise(this.getWorker().then(e=>e.pipeline.updateSubscriptions(r))))),this._subscriptions.coverage&&this.featureContainer.setCoverage(this._subscriptions.coverage)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),d(this._updatingHandles.addPromise(this._workerAttached.promise)),d(this._attachProxy()),this.featureContainer=new H(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptions=new oe(this.view.featuresTilingScheme),this.requestUpdate(),this.addAttachHandles([ce([()=>this._displayRefreshVersion,()=>"displayFilterInfo"in this.layer&&this.layer.displayFilterInfo,()=>this.timeExtent,()=>this.clips,()=>this.filter,()=>this.effectiveDisplayFilterClause,()=>this.featureEffect,()=>this._sourceRefreshVersion,()=>this.view.timeZone,()=>this.view.timeExtent,...this.layerAdapter.getUpdateHashProperties(this.view)],()=>this._update()),f(()=>this.updateSuspended,e=>{e||this._subscriptions.resume(this.featureContainer.getPresenting())}),f(()=>this.view.scale,async e=>{const t=this.view.featuresTilingScheme.getClosestInfoForScale(e).level;if(t!==this._lastRequiredLevel){this._lastRequiredLevel=t;(await this.getWorker()).pipeline.updateRequiredLevel(t,e)}},m),f(()=>this.view.stationary,async e=>{if(e){const e=await this.getWorker(),t=j(this.view.extent,this.view.rotation,this.view.center);e.pipeline.updateStationaryExtent(t.toJSON(),this.featureContainer.requiresRefresh)}})]),this._update(),"stream"!==this.layer.type&&"parquet"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",e=>this._editUpdatingHandles.addPromise(this._edit(e))))}detach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.detach"),this._detachProxy(),this._fields=null,this.featureContainer.destroy(),this.featureContainer=null,this._commandsQueue.clear(),this.container.removeAllChildren(),this._subscriptions=h(this._subscriptions),this._workerProxy.pipeline.onDetach(),this._workerAttached=Promise.withResolvers(),d(this._workerAttached.promise),this._lastAvailableFields=[],this._lastSchema=null}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}addOverrides(e){return this._commandsQueue.push({type:"override",options:{...e,release:[]}})}removeOverrides(e){for(const r of e)if(null==r)throw new o("featurelayerview:bad-override","Tried to remove an override for an invalid objectId",{objectId:r});const t={added:[],updated:[],removed:[],release:e,isWeak:!1,historicMoment:null};return this._commandsQueue.push({type:"override",options:t})}onProxyClientEvent(e){}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredPromise,i=this.featureContainer.updating;return this.updateRequested||e&&(t||r)||i||this._pipelineUpdating||this.dataUpdating}_createClientOptions(){const e=this;return{updateSchemaStart:()=>e.updateSchemaStart(),updateSchemaEnd:t=>e.updateSchemaEnd(t),openMemoryPorts:async()=>{if(this.layerAdapter?.openMessagePorts){const e=await this.layerAdapter.openMessagePorts();return{result:e,transferList:e}}throw new Error("InternalError: Layer adapter does not support opening message ports")},get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("_sourceUpdating",e.source)},emitEvent:e=>{this.onProxyClientEvent(e)},get eventLog(){return e.eventLog},fetch:async t=>{if(has("esri-2d-stabilize-glyphs")){const r=[];for(const i of t)r.push(await e.view.stage.painter.textureManager.rasterizeItem(i));return r}return Promise.all(t.map(t=>e.view.stage.painter.textureManager.rasterizeItem(t)))},fetchDictionary:e=>Promise.all(e.map(e=>this._fetchDictionaryRequest(e)))}}async _fetchDictionaryRequest(e){try{if("subtype-group"===this.layer.type)throw new Error("InternalError: SubtypeGroupLayer does not support dictionary renderer");const t=this.layer.renderer;if(!t||"dictionary"!==t.type)throw new Error("InternalError: Expected layer to have a DictionaryRenderer");const r=this._lastSchema.processor.mesh.factory.symbology;if("dictionary"!==r.type)throw new Error("InternalError: Expected schema to be of type 'dictionary'");const i={cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,store:this.featureContainer.instanceStore,scaleExpression:r.scaleExpression};this._fields||(this._fields=this.layer.fields.map(e=>e.toJSON()));const s=r.visualVariableUniforms,a=se(this.layer.geometryType),o=await t.getSymbolForControlString(e.controlString,a,!1);if(!o||!o.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await ee({...o.data,hasTextStringTemplates:!0},{uniforms:s,path:"renderer",schemaOptions:i})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=T.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),"returnZ"in this.layer&&(t.returnZ??=this.layer.returnZ),"returnM"in this.layer&&(t.returnM??=this.layer.returnM),t.toJSON()}_cleanUpAttributeBinsQuery(e){const t=L.from(e);return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=T.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const i of t.aggregateIds??[])r.push(i);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}_edit(e){return this._commandsQueue.push({type:"edit",event:e})}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%he+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%he+1}async _resolveIdenifiers(e){const t=[],r=[];for(const a of e)null==a.objectId||-1===a.objectId?null==a.globalId?l.getLogger(this).warn("mapview-apply-edits","A feature identifier must contain either a GlobalId or ObjectId. Ignoring",{identifier:a}):r.push(a.globalId):t.push(a.objectId);const i="globalIdField"in this.layer&&this.layer.globalIdField,s=i&&this.availableFields.includes(i);if(r.length&&!s)return l.getLogger(this).error(new o("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${i} to be included the layer's outFields for updates to be reflected on the map`)),t;if(r.length){const e=await this._workerProxy.pipeline.getObjectIdsFromGlobalIds(r);for(const r of e)t.push(r)}return t}_resolveOverrides(e){const t=!1,r=!1,i=se(this.layer.geometryType),s=J(this.layer),a=[];for(const n of e.added){const e=I(pe(n),i,t,r,s);if(null==e.objectId)throw new o("featurelayerview:bad-override","Feature does not have an objectId",{feature:n});a.push(e)}for(const n of e.updated){const e=I(pe(n),i,t,r,s);if(null==e.objectId)throw new o("featurelayerview:bad-override","Feature does not have an objectId",{feature:n});a.push(e)}for(const n of e.removed)if(null==n)throw new o("featurelayerview:bad-override","Tried to remove an invalid objectId",{objectId:n});return{type:"override",updates:a,removed:e.removed,release:e.release,isWeak:e.isWeak??!1,historicMoment:e.historicMoment??null}}async _resolveEdit(e){const t=this.layer,r=e.historicMoment?.getTime()??null,i="layerId"in t&&e.editedFeatures?.find(e=>e.layerId===t.layerId);if(i&&this._canEditByFeature(i)){const{adds:e,deletes:t,updates:s}=i.editedFeatures,a=this.layer.objectIdField,o=s.map(e=>e.current),n=t.map(e=>"attributes"in e?{objectId:a?e.attributes[a]:null}:e),u=await this._resolveIdenifiers(n);return this._resolveOverrides({added:e,updated:o,removed:u,historicMoment:r,isWeak:!0,release:[]})}const[s,a,o]=await Promise.all([this._resolveIdenifiers(e.addedFeatures),this._resolveIdenifiers(e.updatedFeatures),this._resolveIdenifiers(e.deletedFeatures)]);return{type:"override-by-id",updates:[...s,...a],removed:o,historicMoment:r,isWeak:!0}}_canEditByFeature(e){const{adds:t,updates:r}=e.editedFeatures;return t.every(e=>this.view.spatialReference.equals(e.geometry?.spatialReference))&&r.every(e=>this.view.spatialReference.equals(e.current.geometry?.spatialReference))}async updateSchemaStart(){"featureReduction"in this.layer&&this.layer.featureReduction&&this.layer.featureReduction!==this._lastFeatureReduction&&(this.layer.featureReduction=this.layer.featureReduction?.clone(),this._lastFeatureReduction=this.layer.featureReduction);try{if(await Promise.allSettled([this._handleChange(),U(this.layer)]),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this._subscriptions)return null;const e=this.featureContainer.updateStart("subtype-group"===this.layer.type);this._lastFeatureEffect=this.featureEffect;const t={store:e,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},r=await this._createViewSchemaConfig(),i={source:await this.layerAdapter.createSourceSchema(r,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(t,r,this._displayRefreshVersion)};return c(this._lastSchema?.source.strategy,i.source.strategy)||c(this._lastSchema?.processor,i.processor)?(this._lastSchema=i,this._fields=null,i):null}catch(e){}return null}async updateSchemaEnd(e){try{this.featureEffectView.featureEffect=this._lastFeatureEffect,e&&this.featureEffectView.endTransition(),await this.featureContainer.updateEnd(this._lastSchema.processor,this.layerAdapter.getLabelingDeconflictionInfo(),e),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.updateEnd")}catch(t){}}async _doUpdate(){const e=Math.round(performance.now()),t=await this.getWorker();await t.pipeline.updateSchema(e),this.requestUpdate()}async _doOverride(e){const t=await this.getWorker();try{let r=new te;for(const i of e.messages)switch(i.type){case"edit":r.tryAdd(await this._resolveEdit(i.event))||(await t.pipeline.onOverride(r.toMessage()),r=new te,r.tryAdd(await this._resolveEdit(i.event)));break;case"override":r.tryAdd(this._resolveOverrides(i.options))||(await t.pipeline.onOverride(r.toMessage()),r=new te,r.tryAdd(this._resolveOverrides(i.options)));break}await t.pipeline.onOverride(r.toMessage())}catch(r){g(r),0}}_getEffectiveAvailableFields(e){const t=le(this._lastAvailableFields,e);return this._lastAvailableFields=t,R(this.layer.fieldsIndex,t)}async _createViewSchemaConfig(){const e=this.requiresCurrentUser?await this.signedInUser:null,t=[x(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter,this.effectiveDisplayFilterClause),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),displayFilterEnabled:this.displayFilterEnabled,filters:t,scale:this.view.scale,timeZone:this.view.timeZone,timeExtent:this.view.timeExtent,currentUser:e,spatialReference:this.view.spatialReference,extent:this.view.extent,returnZ:this.hasZ,returnM:this.hasM}}_processHighlight(){this._commandsQueue.push({type:"highlight"})}async _updateHighlights(){const e=this._getHighlights(),t=await this.getWorker();if(this.destroyed)return;const r=t.pipeline.updateHighlight({highlights:e}).catch(e=>{g(e)||l.getLogger(this).error(e)});this._updatingHandles.consumePromise(r)}_setOriginForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin(e)}_createFeatureGraphicHit(e,t){return this._setOriginForFeature(t),this._createGraphicHit(e,t)}_createTrackGraphicHit(e,t){return t.layer=t.sourceLayer=this.layer,this.layerAdapter.setTrackGraphicOrigin?.(t),this._createGraphicHit(e,t)}_createAggregateGraphicHit(e,t){return t.layer=t.sourceLayer=this.layer,this.layerAdapter.setAggregateGraphicOrigin?.(t),this._createGraphicHit(e,t)}_createGraphicHit(e,t){return null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function x(e,t,r,i,s,a){s&&(s=s.clone());const o=null!=s?s.timeExtent:null,n=null!=r&&null!=o?r.intersection(o):r||o;n&&(s??=new O,s.timeExtent=n),s=t.addFilters?.(s,e)??s,a&&(s??=new O,s.where=v(s.where,a));let u=s?.toJSON()??null;return i.size&&(u??=(new O).toJSON(),u.hiddenIds=Array.from(i)),u}return e([b()],_.prototype,"_commandsQueue",void 0),e([b()],_.prototype,"_sourceRefreshVersion",void 0),e([b()],_.prototype,"_displayRefreshVersion",void 0),e([b({readOnly:!0})],_.prototype,"_pipelineUpdating",void 0),e([b()],_.prototype,"_sourceUpdating",void 0),e([b({readOnly:!0})],_.prototype,"dataUpdating",null),e([b({readOnly:!0})],_.prototype,"hasAllFeatures",null),e([b({readOnly:!0})],_.prototype,"hasAllFeaturesInView",null),e([b({readOnly:!0})],_.prototype,"hasFullGeometries",null),e([b()],_.prototype,"featureEffectView",void 0),e([b()],_.prototype,"layerAdapter",null),e([b({readOnly:!0})],_.prototype,"timeExtent",null),_=e([S("esri.views.2d.layers.FeatureLikeLayerView2D")],_),_};export{de as FeatureLikeLayerView2D};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as
|
|
2
|
+
import{__decorate as t}from"tslib";import i from"../../../Graphic.js";import{isSome as e}from"../../../core/arrayUtils.js";import s from"../../../core/Collection.js";import{makeHandle as r}from"../../../core/handleUtils.js";import"../../../core/has.js";import{QueueProcessor as h}from"../../../core/QueueProcessor.js";import{watch as a,sync as o}from"../../../core/reactiveUtils.js";import{property as n,subclass as l}from"../../../core/accessorSupport/decorators.js";import{convertGeometryToMask as g}from"../../../layers/raster/functions/clipUtils.js";import{GraphicsCollection as p}from"../../../support/GraphicsCollection.js";import d from"../engine/flow/FlowView2D.js";import{LayerView2D as c}from"./LayerView2D.js";import u from"./graphics/GraphicsView2D.js";import m from"./graphics/HighlightGraphicContainer.js";import w from"./imagery/ImageryView2D.js";import y from"./imagery/VectorFieldView2D.js";import f from"../../layers/ImageryLayerView.js";import{RefreshableLayerView as v}from"../../layers/RefreshableLayerView.js";import{isPixelHighlightTarget as _,isEmptyPixelRanges as b}from"../../layers/support/highlightUtils.js";import{defaultColor as x}from"../../support/HighlightDefaults.js";import{getHighlightName as H}from"../../support/highlightOptionsUtils.js";let V=class extends(v(c(f))){constructor(){super(...arguments),this._exportImageVersion=-1,this._highlightGraphics=new p,this._highlightView=void 0,this._pixelHighlights=[],this.layer=null,this.subview=null}get pixelData(){const{subview:t}=this;return this.updating||!t?null:"getPixelData"in t?t.getPixelData():null}update(t){this.subview?.update(t)}attach(){this.layer.increaseRasterJobHandlerUsage(),this._setSubView(),this.view&&(this._highlightView=new u({view:this.view,graphics:this._highlightGraphics,requestUpdateCallback:()=>this.requestUpdate(),container:new m(this.view.featuresTilingScheme)}),this.container.addChild(this._highlightView.container)),this.addAttachHandles([a(()=>this.layer.exportImageServiceParameters.version,t=>{t&&this._exportImageVersion!==t&&(this._exportImageVersion=t,this.requestUpdate())},o),a(()=>this.timeExtent,t=>{const{subview:i}=this;i&&(i.timeExtent=t,"redraw"in i?this.requestUpdate():i.redrawOrRefetch())},o),this.layer.on("redraw",()=>{const{subview:t}=this;t&&("redraw"in t?t.redraw():t.redrawOrRefetch())}),a(()=>this.layer.renderer,()=>this._setSubView()),a(()=>this.view.highlights.items.map(({name:t,color:i})=>({name:t,color:i})),()=>this._updateHighlightOptions(this.subview))])}detach(){this.layer.decreaseRasterJobHandlerUsage(),this.container.removeAllChildren(),this._detachSubview(this.subview),this.subview?.destroy(),this.subview=null,this._highlightView?.destroy(),this._exportImageVersion=-1}viewChange(){}moveEnd(){this.requestUpdate()}async hitTest(t){const{layer:i,subview:e}=this;if(!i.loaded||!this.attached||!e?.attached)return null;const s=await e.hitTest(t);return null==s?null:[{type:"raster",layer:i,mapPoint:t,...s}]}highlight(t,h){if(_(t))return b(t)?r():this._highlightPixels(t,h);if("number"==typeof t||"string"==typeof t)return this._highlightByImageIds([t],h);const a=Array.isArray(t)||s.isCollection(t)?t.at(0):t;if("number"==typeof a||"string"==typeof a)return this._highlightByImageIds(t,h);if(!(a instanceof i))return r();let o=[];Array.isArray(t)||s.isCollection(t)?o=t.map(t=>t.clone()):t instanceof i&&(o=[t.clone()]);const n=o?.filter(e);if(!n?.length)return r();const l=H(h);return this._addHighlightGraphics(o,l),r(()=>!this.destroyed&&this._removeHighlightGraphics(o,l))}_highlightByImageIds(t,i){const e=H(i),s=new AbortController,{signal:a}=s,o=this.layer.sourceJSON.maxRecordCount??1e3,n=Math.ceil(t.length/o),l=[],g=[],p=new h({concurrency:4,process:t=>this.layer.queryFeatures({objectIds:t.ids,returnGeometry:!0,outSpatialReference:this.view.spatialReference},{signal:a}).then(t=>g.push(...t.features)).catch(()=>{})});for(let r=0;r<n;r++)l.push(p.push({ids:t.slice(r*o,(r+1)*o)}));return Promise.allSettled(l).then(()=>{g.length&&!a.aborted&&(this._addHighlightGraphics(g,e),a.addEventListener("abort",()=>{this._removeHighlightGraphics(g,e)}))}),r(()=>s.abort())}_highlightPixels(t,i){const e={target:t,options:i};return this._pixelHighlights.push(e),this._updateHighlightOptions(this.subview),r(()=>{const t=this._pixelHighlights.indexOf(e);t>-1&&(this._pixelHighlights.splice(t,1),this._updateHighlightOptions(this.subview))})}_addHighlightGraphics(t,i){this._highlightGraphics.addMany(t),this._addHighlights(t.map(t=>t.uid),i)}_removeHighlightGraphics(t,i){this._highlightGraphics.removeMany(t),this._removeHighlights(t.map(t=>t.uid),i)}async doRefresh(){this.requestUpdate()}isUpdating(){return!this.subview||this.subview.updating||!!this._highlightView?.updating}_processHighlight(){const t=this._getHighlights();this._highlightView?.setHighlight(t)}_setSubView(){if(!this.view)return;const t=this.layer.renderer?.type;let i="imagery";if("vector-field"===t?i="imageryVF":"flow"===t&&(i="flow"),this.subview){const{type:t}=this.subview;if(t===i)return this._attachSubview(this.subview),void("flow"===t?this.subview.redrawOrRefetch():"imagery"===t&&"lerc"===this.layer.format?this.subview.redraw():this.requestUpdate());this._detachSubview(this.subview),this.subview?.destroy()}"imagery"===i?(this.subview=new w({layer:this.layer,view:this.view,timeExtent:this.timeExtent,updatingHandles:this._updatingHandles}),this._updateHighlightOptions(this.subview)):this.subview="imageryVF"===i?new y({layer:this.layer,view:this.view,timeExtent:this.timeExtent}):new d({layer:this.layer,layerView:this}),this._attachSubview(this.subview),this.requestUpdate()}_attachSubview(t){t&&!t.attached&&(t.attach(),t.attached=!0,this.container.addChildAt(t.container,0))}_detachSubview(t){t?.attached&&(this.container.removeChild(t.container),t.detach(),t.attached=!1)}_updateHighlightOptions(t){const i=this.view.highlights;this._pixelHighlights.sort((t,e)=>i.findIndex(({name:t})=>t===H(e.options))-i.findIndex(({name:i})=>i===H(t.options)));const s=this._pixelHighlights.map(({target:t,options:e})=>I(t,i,e)).filter(e);"imagery"===t?.type&&(t.pixelHighlights=s,t.attached&&("lerc"===this.layer.format?t.redraw():this.requestUpdate()))}};function I(t,i,e){const s=H(e),r=(i.find(t=>t.name===s)?.color??x).toArray(),{pixelRanges:h}=t;if(Array.isArray(h))return{ranges:h,bandId:t.bandId??0,color:r};const a="extent"===h.type?h:h.extent;if(!a)return;const o=[a.xmin,a.xmax],n=[a.ymin,a.ymax],{xBandId:l,yBandId:p}=t,d=1024,c=1024;return{xBandId:l,yBandId:p,xBandRange:o,yBandRange:n,color:r,width:d,height:c,xyMask:"polygon"===h.type?g({srcExtent:a,geometry:h,size:[d,c]}):void 0}}t([n()],V.prototype,"pixelData",null),t([n()],V.prototype,"subview",void 0),V=t([l("esri.views.2d.layers.ImageryLayerView2D")],V);const j=V;export{j as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../../../core/Collection.js";import{referenceSetter as i}from"../../../core/collectionUtils.js";import{deprecatedFunction as s}from"../../../core/deprecate.js";import h from"../../../core/Error.js";import"../../../core/has.js";import r from"../../../core/Logger.js";import{watch as o,syncAndInitial as a}from"../../../core/reactiveUtils.js";import{property as n,subclass as l}from"../../../core/accessorSupport/decorators.js";import{isLinkChartView as p}from"../../../linkChart/utils.js";import{Container as c}from"../engine/Container.js";import{ClipMesh as g}from"../engine/webgl/ClipMesh.js";import{HighlightCounter as d}from"./support/HighlightCounter.js";import{createOrReuseHighlightGradient as u}from"./support/util.js";import f from"../../layers/support/ClipRect.js";import m from"../../layers/support/GeometryClipArea.js";import y from"../../layers/support/Path.js";import{defaultHighlightName as v}from"../../support/HighlightDefaults.js";import w from"../../support/HighlightOptions.js";import{isInEffectiveScaleRange as R}from"../../support/layerViewUtils.js";const _=e.ofType({key:"type",base:null,typeMap:{rect:f,path:y,geometry:m}}),H=new(e.ofType(w)),S=f=>{const m=f;let y=class extends m{constructor(){super(...arguments),this._highlightCounter=new d,this.attached=!1,this.clips=new _,this.highlights=null,this.lastUpdateId=-1,this.moving=!1,this.updateRequested=!1,this._visibleAtCurrentScale=!0}initialize(){const t=this.view?.spatialReferenceLocked??!0,e=this.view?.spatialReference;e&&t&&!this.spatialReferenceSupported?this.addResolvingPromise(Promise.reject(new h("layerview:spatial-reference-incompatible","The spatial reference of this layer does not meet the requirements of the view",{layer:this.layer}))):(this.container||(this.container=new c),this.container.fadeTransitionEnabled=!0,this.container.visible=!1,this.container.endTransitions(),this.addHandles([o(()=>this.suspended,t=>{this.container&&(this.container.visible=!t)},a),o(()=>this.updateSuspended,t=>{this.view&&!t&&this.updateRequested&&this.view.requestUpdate()},a),o(()=>this.layer?.opacity??1,t=>{this.container&&(this.container.opacity=t)},a),o(()=>this.layer&&"blendMode"in this.layer?this.layer.blendMode:"normal",t=>{this.container&&(this.container.blendMode=t)},a),o(()=>this.layer&&"effect"in this.layer?this.layer.effect:null,t=>{this.container&&(this.container.effect=t)},a),o(()=>this._mergedHighlights.items.map(t=>({name:t.name,options:{fillColor:t.color,haloColor:t.haloColor,fillOpacity:t.fillOpacity,haloOpacity:t.haloOpacity,haloWidth:t.haloWidth,haloBlur:t.haloBlur}})),()=>{this.container.highlightGradient=u(this.container.highlightGradient,this._mergedHighlights.items)},a),o(()=>this._mergedHighlights.items.map(t=>t.name),()=>{this._processHighlight()}),o(()=>this.clips.map(t=>t.version),async()=>{if(this.container){const t=this.view.spatialReference,e=await this._updatingHandles.addPromise(Promise.all(this.clips.items.map(e=>g.create(e,t))));for(const i of this.container.clips)i.destroy();this.container.clips=e.filter(t=>!!t)}},a),o(()=>({scale:this.view?.scale,scaleRange:this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null}),({scale:t,scaleRange:e})=>{const i=R(e,t);i!==this._visibleAtCurrentScale&&(this._visibleAtCurrentScale=i)},a)],"constructor"),this.view?.whenLayerView?this.view.whenLayerView(this.layer).then(t=>{t===this&&this.processAttach()},()=>{}):this.when().then(()=>{this.processAttach()},()=>{}))}destroy(){this.processDetach(),this.updateRequested=!1;for(const t of this.container?.clips??[])t.destroy()}get highlightOptions(){return this._logHighlightOptionsDeprecation(),this.highlights?.find(({name:t})=>t===v)}set highlightOptions(t){if(this._logHighlightOptionsDeprecation(),!this.highlights){if(!t)return;this.highlights=new e([new w])}const i=this.highlights.find(({name:t})=>t===v);t?i?.assignFrom(t):(this.highlights.remove(i),0===this.highlights.length&&(this.highlights=null))}_logHighlightOptionsDeprecation(){s(r.getLogger(this),"`LayerView.highlightOptions` is deprecated in favor of View.highlights",{replacement:"View.highlights",version:"4.34",see:"https://arcg.is/inbTa1#highlights",warnOnce:!0})}get hasHighlight(){return this._highlightCounter.size>0}get _mergedHighlights(){if(!this.view)return H;if(!this.highlights)return this.view.highlights;const t=this.view.highlights.clone();for(const e of this.highlights){const i=t.find(t=>t.name===e.name);i&&i.assignFrom(e)}return t}get highlightIds(){return Array.from(this._highlightCounter.objectIds)}get scheduler(){return this.view.scheduler}get spatialReferenceSupported(){const t=this.view?.spatialReference;return null==t||this.supportsSpatialReference(t)}get updating(){if(!this.spatialReferenceSupported)return!1;if(!this.attached)return!0;if(this.suspended)return!1;return this.updateRequested||this.isUpdating()||this._updatingHandles?.updating||this.container.transitioning}get visibleAtCurrentScale(){return this._visibleAtCurrentScale}processAttach(){this.isResolved()&&!this.attached&&!this.destroyed&&this.spatialReferenceSupported&&(this.attach(),this.attached=!0,this.requestUpdate())}processDetach(){this.attached&&(this.attached=!1,this.removeHandles("attach"),this.detach(),this.updateRequested=!1)}requestUpdate(){this.destroyed||this.updateRequested||(this.updateRequested=!0,this.updateSuspended||this.view.requestUpdate())}processUpdate(t){!this.isFulfilled()||this.isResolved()?(this._set("updateParameters",t),this.updateRequested&&!this.updateSuspended&&(this.updateRequested=!1,this.update(t))):this.updateRequested=!1}hitTest(t,e){return Promise.resolve(null)}supportsSpatialReference(t){return!0}canResume(){if(!this.spatialReferenceSupported)return!1;switch(this.layer?.type){case"link-chart":case"knowledge-graph-sublayer":case"graphics":break;default:if(p(this.view)&&!this.view.inGeographicLayout)return!1}return!!super.canResume()&&this.visibleAtCurrentScale}getSuspendInfo(){const t=super.getSuspendInfo(),e=!this.spatialReferenceSupported;return e&&(t.spatialReferenceNotSupported=e),t}addAttachHandles(t){this.addHandles(t,"attach")}_addHighlights(t,e){this._highlightCounter.add(t,e)&&this._processHighlight()}_removeHighlights(t,e){this._highlightCounter.delete(t,e)&&this._processHighlight()}_processHighlight(){}_getHighlights(){const t=[];for(const[e,i]of this._highlightCounter.highlightNamesByObjectId){const s=this._getHighlightBits(i);t.push({objectId:e,highlightFlags:s})}return t}_getHighlightBits(t){const e=new Set(t);let i=1,s=0;if(!this.view)return 0;const h=this._mergedHighlights;for(const{name:r}of h)e.delete(r)&&(s=i),i<<=1;return s}};return t([n()],y.prototype,"attached",void 0),t([n({type:_,set(t){const e=i(t,this._get("clips"),_);this._set("clips",e)}})],y.prototype,"clips",void 0),t([n()],y.prototype,"container",void 0),t([n({type:w})],y.prototype,"highlightOptions",null),t([n({type:e.ofType(w)})],y.prototype,"highlights",void 0),t([n()],y.prototype,"_mergedHighlights",null),t([n()],y.prototype,"moving",void 0),t([n({readOnly:!0})],y.prototype,"spatialReferenceSupported",null),t([n({readOnly:!0})],y.prototype,"updateParameters",void 0),t([n()],y.prototype,"updateRequested",void 0),t([n()],y.prototype,"updating",null),t([n()],y.prototype,"view",void 0),t([n()],y.prototype,"_visibleAtCurrentScale",void 0),t([n({readOnly:!0})],y.prototype,"visibleAtCurrentScale",null),y=t([l("esri.views.2d.layers.LayerView2D")],y),y};export{S as LayerView2D};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import"../../../Graphic.js";import t from"../../../core/Collection.js";import i from"../../../core/Error.js";import"../../../core/has.js";import r from"../../../core/Logger.js";import{getOrCreateMapValue as
|
|
2
|
+
import{__decorate as e}from"tslib";import"../../../Graphic.js";import t from"../../../core/Collection.js";import i from"../../../core/Error.js";import"../../../core/has.js";import{some as r}from"../../../core/iteratorUtils.js";import s from"../../../core/Logger.js";import{getOrCreateMapValue as n}from"../../../core/MapUtils.js";import{isAbortError as o}from"../../../core/promiseUtils.js";import l from"../../../core/ReactiveMap.js";import{watch as a,syncAndInitial as m,on as c}from"../../../core/reactiveUtils.js";import{property as h,subclass as p}from"../../../core/accessorSupport/decorators.js";import d from"../../../geometry/Extent.js";import{create as u}from"../../../geometry/support/aaBoundingRect.js";import{ringsContainsCoords as g}from"../../../geometry/support/contains.js";import{extentIntersectsPolygon as f}from"../../../geometry/support/intersectsBase.js";import{MediaElementView as y}from"../../../layers/support/MediaElementView.js";import"../../../renderers/SimpleRenderer.js";import"../../../symbols/SimpleFillSymbol.js";import"../engine/Stage.js";import"../../../Color.js";import"../../../core/Accessor.js";import"../../../core/mathUtils.js";import"../../../core/libs/gl-matrix-2/factories/vec4f32.js";import"../../../geometry/Point.js";import"../../../chunks/pe.js";import"../../../core/units.js";import"../../../geometry/ellipsoidUtils.js";import"../../../geometry/support/spatialReferenceUtils.js";import"../../../core/RandomLCG.js";import"../engine/transitions/FadeTransition.js";import"../../webgl/BufferObject.js";import"../../webgl/FramebufferObject.js";import"../../webgl/Program.js";import"../../webgl/Renderbuffer.js";import"../../webgl/Texture.js";import"../../webgl/enums.js";import"../../webgl/Util.js";import"../engine/webgl/meshing/definitions.js";import"../engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"../LabelManager.js";import"./graphics/GraphicsView2D.js";import"../../../layers/effects/EffectView.js";import"../engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js";import"../engine/webgl/AFeatureTile.js";import"../engine/webgl/DisplayEntity.js";import"../../../core/libs/gl-matrix-2/factories/vec2f32.js";import"../engine/webgl/number.js";import"../engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"../engine/webgl/cpuMapped/GpuMeshState.js";import"../engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/TileStencilShader.js";import"../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"../../../core/libs/gl-matrix-2/factories/vec3f32.js";import"../../../geometry/support/normalizeUtils.js";import"./support/util.js";import"../navigation/MapViewNavigation.js";import"../../../request.js";import"../../../core/asyncUtils.js";import"../../../core/support/UpdatingHandles.js";import"../../../core/urlUtils.js";import"../engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../../../geometry/Geometry.js";import"../../../geometry/Multipoint.js";import"../../../geometry/Polygon.js";import"../../../geometry/Polyline.js";import"../../../geometry/SpatialReference.js";import"../../../geometry/spatialReferenceEllipsoidUtils.js";import"../../../geometry/operators/support/GeographicTransformation.js";import"../../../geometry/projection/projectors.js";import"../engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../../../geometry/support/geodesicConstants.js";import"../../../geometry/support/Ellipsoid.js";import"../tiling/TileInfoView.js";import"../tiling/TileKey.js";import j from"../tiling/TileQueue.js";import _ from"../tiling/TileStrategy.js";import w from"../engine/webgl/Overlay.js";import v from"../engine/webgl/OverlayContainer.js";import{LayerView2D as b}from"./LayerView2D.js";import E from"../../layers/MediaLayerView.js";import{TaskPriority as S}from"../../support/Scheduler.js";let R=class extends(b(E)){constructor(){super(...arguments),this._overlayContainer=null,this._fetchQueue=null,this._tileStrategy=null,this._elementReferences=new l,this._debugGraphicsView=null,this._interaction=null,this.elements=new t}initialize(){this.addHandles([a(()=>[this.interactive,this.suspended],async()=>{if(this.interactive&&!this._interaction){const{MediaLayerInteraction:e}=await this._updatingHandles.addPromise(import("./support/MediaLayerInteraction.js"));if(this.destroyed)return;this._interaction=new e({view:this.view,layer:this.layer}),this.selectedElement!==this._interaction.selectedElement&&(this._interaction.selectedElement=this.selectedElement),this.interactionOptions!==this._interaction.options&&(this._interaction.options=this.interactionOptions)}this._interaction&&(this._interaction.enabled=!this.suspended&&this.interactive)},m),a(()=>this.interactionOptions,e=>{this._interaction&&(this._interaction.options=e)},m),a(()=>this.selectedElement,e=>{this._interaction&&(this._interaction.selectedElement=e)},m)])}isUpdating(){return!0===this._interaction?.updating||r(this._elementReferences.values(),({overlay:e})=>!e.isReady)}attach(){this.addAttachHandles([c(()=>this.layer.effectiveSource,"refresh",()=>{this._tileStrategy.refresh(e=>this._updateTile(e)),this.requestUpdate()}),c(()=>this.layer.effectiveSource,"change",({element:e})=>this._elementUpdateHandler(e))]),this._overlayContainer=new v,this.container.addChild(this._overlayContainer),this._fetchQueue=new j({tileInfoView:this.view.featuresTilingScheme,concurrency:10,process:(e,t)=>this._queryElements(e,t),scheduler:this.scheduler,priority:S.MAPVIEW_FETCH_QUEUE}),this._tileStrategy=new _({cachePolicy:"purge",resampling:!0,acquireTile:e=>this._acquireTile(e),releaseTile:e=>this._releaseTile(e),tileInfoView:this.view.featuresTilingScheme}),this.requestUpdate()}detach(){this.elements.removeAll(),this._tileStrategy.destroy(),this._fetchQueue.destroy(),this._overlayContainer.removeAllChildren(),this.container.removeAllChildren(),this._elementReferences.clear(),this._debugGraphicsView?.destroy()}supportsSpatialReference(e){return!0}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}update(e){this._tileStrategy.update(e),this._debugGraphicsView?.update(e)}async hitTest(e,t){const i=[],r=e.normalize(),s=[r.x,r.y];for(const{elementView:{normalizedCoords:n,element:o}}of this._elementReferences.values())null!=n&&g(n.rings,s)&&i.push({type:"media",element:o,layer:this.layer,mapPoint:e,sourcePoint:o.toSource(e)});return i.reverse()}canResume(){return null!=this.layer.source&&super.canResume()}async doRefresh(){this._fetchQueue.reset(),this._tileStrategy.refresh(e=>this._updateTile(e))}_acquireTile(e){const t=new C(e.clone());return this._updateTile(t),t}_updateTile(e){this._updatingHandles.consumePromise(this._fetchQueue.push(e.key).then(t=>{const[i,r]=e.setElements(t);this._referenceElements(e,i),this._dereferenceElements(e,r),this.requestUpdate()},e=>{o(e)||s.getLogger(this).error(e)}))}_releaseTile(e){this._fetchQueue.abort(e.key.id),e.elements&&this._dereferenceElements(e,e.elements),this.requestUpdate()}async _queryElements(e,t){const i=this.layer.effectiveSource;if(null==i)return[];this.view.featuresTilingScheme.getTileBounds(T,e,!0);const r=new d({xmin:T[0],ymin:T[1],xmax:T[2],ymax:T[3],spatialReference:this.view.spatialReference});return i.queryElements(r,t)}_referenceElements(e,t){if(null!=this.layer.source)for(const i of t)this._referenceElement(e,i)}_referenceElement(e,t){n(this._elementReferences,t.uid,()=>{const e=new y({element:t,spatialReference:this.view.spatialReference}),r=new w(e);return this._overlayContainer.addChild(r),this.elements.add(t),this._updatingHandles.consumePromise(t.load().catch(e=>{s.getLogger("esri.views.2d.layers.MediaLayerView2D").error(new i("element-load-error","Element cannot be displayed",{element:t,error:e}))})),{debugGraphic:null,elementView:e,overlay:r,tiles:new Set}}).tiles.add(e)}_dereferenceElements(e,t){for(const i of t)this._dereferenceElement(e,i)}_dereferenceElement(e,t){const i=this._elementReferences.get(t.uid);i.tiles.delete(e),i.tiles.size||(this._overlayContainer.removeChild(i.overlay),i.overlay.destroy(),i.elementView.destroy(),this._elementReferences.delete(t.uid),this.elements.remove(t),this._debugGraphicsView?.graphics.remove(i.debugGraphic))}_elementUpdateHandler(e){let t=this._elementReferences.get(e.uid);if(t){const i=t.elementView.normalizedCoords;if(null==i)return this._overlayContainer.removeChild(t.overlay),t.overlay.destroy(),t.elementView.destroy(),this._elementReferences.delete(e.uid),this.elements.remove(e),void this._debugGraphicsView?.graphics.remove(t.debugGraphic);const r=[],s=[];for(const e of this._tileStrategy.tiles){const n=U(this.view.featuresTilingScheme,e,i);t.tiles.has(e)?n||s.push(e):n&&r.push(e)}for(const t of r)this._referenceElement(t,e);for(const t of s)this._dereferenceElement(t,e);return t=this._elementReferences.get(e.uid),void(t?.debugGraphic&&(t.debugGraphic.geometry=t.elementView.normalizedCoords,this._debugGraphicsView.graphicUpdateHandler({graphic:t.debugGraphic,property:"geometry"})))}const i=new y({element:e,spatialReference:this.view.spatialReference}).normalizedCoords;if(null!=i)for(const r of this._tileStrategy.tiles){U(this.view.featuresTilingScheme,r,i)&&this._referenceElement(r,e)}}};e([h({readOnly:!0})],R.prototype,"elements",void 0),R=e([p("esri.views.2d.layers.MediaLayerView2D")],R);const T=u(),G={xmin:0,ymin:0,xmax:0,ymax:0};function U(e,t,i){return e.getTileBounds(T,t.key,!0),G.xmin=T[0],G.ymin=T[1],G.xmax=T[2],G.ymax=T[3],f(G,i)}class C{constructor(e){this.key=e,this.elements=null,this.isReady=!1,this.visible=!0}setElements(e){const t=[],i=new Set(this.elements);this.elements=e;for(const r of e)i.has(r)?i.delete(r):t.push(r);return this.isReady=!0,[t,Array.from(i)]}destroy(){}}const V=R;export{V as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import
|
|
2
|
+
import{__decorate as e}from"tslib";import"../../../core/has.js";import{watch as r,initial as t}from"../../../core/reactiveUtils.js";import{subclass as s}from"../../../core/accessorSupport/decorators.js";import{FeatureLikeLayerView2D as i}from"./FeatureLikeLayerView2D.js";import o from"../../layers/SubtypeGroupLayerView.js";let a=class extends(i(o)){initialize(){this.addHandles([r(()=>this.view.scale,()=>this._update(),t)],"constructor")}isUpdating(){const e=this.layer.sublayers.some(e=>null!=e.renderer),r=this._commandsQueue.updateTracking.updating,t=null!=this._updatingRequiredPromise,s=!this._workerProxy,i=this.dataUpdating;return e&&(r||t||s||i)}};a=e([s("esri.views.2d.layers.SubtypeGroupLayerView2D")],a);const p=a;export{p as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import has from"../../../../core/has.js";import{destroyMaybe as e}from"../../../../core/maybe.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{signal as s}from"../../../../core/signal.js";import{AFeatureContainer as r}from"../../engine/AFeatureContainer.js";import{effectFlag0 as i,filterFlag0 as n}from"../../engine/webgl/definitions.js";import a from"../../engine/webgl/shaderGraph/techniques/FeatureInstanceStore.js";import{Techniques as o}from"../../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import{FeatureTilePresentStrategy as h}from"./FeatureTilePresentStrategy.js";import{RenderState as u}from"./RenderState.js";import{renderHighlight as l}from"../support/util.js";import{createHittestQuery as d}from"../../support/hitTestUtils.js";class c{constructor(e){this.inner=e,this.resolver=Promise.withResolvers()}}class p{constructor(e,t){this.id=e,this.version=t}}class f extends r{constructor(e){super(e.view.featuresTilingScheme),this._updatingChildren=s(!1),this._hitTestsRequests=[],this._renderState=s(null),this._renderStateNext=s(null),this._store=new a,this._subscriptions=new Map,this._presentation=new h,this._updateStatisticsRequests=[],this._lockStatisticUpdates=!1,this._supportsInstanceCleanup=!0,this._shouldUnlockAttributeView=!1,this._layerView=e,this.addTransitionable(this._layerView.featureEffectView)}destroy(){super.destroy(),this._renderState.value=e(this._renderState.value),this._renderStateNext.value=e(this._renderStateNext.value)}get batching(){return has("featurelayer-strict-draw-order")?1:has("featurelayer-force-marker-text-draw-order")?2:0}get updating(){const e=this._updatingChildren.value,t=!this._renderState.value||this._renderState.value.updating,s=!!this._renderStateNext.value,r=this.attributeView.updating,i=e||t||s||r;if(has("esri-2d-log-updating")){console.log(`Updating FeatureContainr: ${i}\n -> updatingChildren ${e}\n -> updatingRenderState ${t}\n -> hasPendingRenderState ${s}\n -> updatingAttributeView ${r}\n`);for(const e of this.children)console.log(` -> Tile[${e.id}] Ended: ${e.ended} Presenting: ${e.presenting}`)}return i}subscriptions(){return this._subscriptions.values()}get hasLabels(){return null!==this.labelSchema}get hasHighlight(){return this._layerView.hasHighlight}get children(){return this._renderState.value?this._renderState.value.tiles().filter(e=>e.presenting):[]}get usedMemory(){let e=0;return this._renderState.value&&(e+=this._renderState.value.usedMemory),this._renderStateNext.value&&(e+=this._renderStateNext.value.usedMemory),e+=this.attributeView.usedMemory,e}get instanceStore(){return this._store}get labelingCollisionInfos(){if(!this._deconflictionInfo)throw new Error("InternalError: DeconflictionInfo not defined. Was update called?");return this._deconflictionInfo}get labelSchema(){return this._schema?.mesh.factory.labels??null}get layerOrder(){return this._layerView.view.allLayerViews.items.indexOf(this._layerView)}get tiles(){return this._renderState.value?.tiles()}get requiresRefresh(){return!!this._renderState.value?.requiresRefresh}get _instanceStore(){return this._store}_getHeatmapInstance(e){if(null==this._instanceStore||!(e.drawPhase&o.heatmap.drawPhase))return null;for(const t of this._instanceStore.values())if(_(t))return t;return null}update(e,t){this._schema=e,this._deconflictionInfo=t}setCoverage(e){this._presentation.updateCoverage(e)}getPresenting(){const e=new Set;for(const t of this._renderState.value?.tiles()??[])t.presenting&&e.add(t.id);return e}beforeRender(e){if(super.beforeRender(e),this._renderState.value){for(const t of this._renderState.value.tiles())t.setTransform(e.state);if(!e.decluttering){this._presentation.update(this._renderState.value.tiles());for(const e of this._renderState.value.tiles())e.upload(this._instanceStore,this.batching)}this._updatingChildren.value=!this.children.every(e=>e.ended&&e.presenting)}}renderChildren(e){switch(super.renderChildren(e),e.drawPhase){case 1:return this._renderMapPhase(e);case 16:return this._renderHighlightPhase(e);case 2:return this._renderLabelPhase(e)}}afterRender(e){super.afterRender(e),e.decluttering||(this._finializeUpdate(),this._updateAttributeView(),this._handleSwapRenderState(),this._renderState.value?.update(this.attributeView.currentEpoch)),this._hitTestsRequests.length&&this.requestRender()}updateStart(e){return this.attributeView.lockTextureUploads(),this._supportsInstanceCleanup=!e&&"dictionary"!==this._schema?.mesh.factory.symbology.type,this.instanceStore.updateStart(this._supportsInstanceCleanup),this.instanceStore}async updateEnd(e,t,s){return this._updateResolver=new c({schema:e,deconflictionInfo:t,invalidateMesh:s}),this.requestRender(),this._updateResolver.resolver.promise}updateAttributeView(e){this.requestRender(),this.attributeView.requestUpdate(e),this.hasLabels&&this.requestDeclutter()}updateSubscriptions(e){for(const{tileId:t,version:s}of e.subscribe){if(!this._subscriptions.has(t)){const e=new p(t,s);this._subscriptions.set(t,e);continue}this._subscriptions.get(t).version=s}for(const t of e.unsubscribe)this._subscriptions.delete(t),this.removeTile(t)}isFeatureFiltered(e){const t=this.attributeView.getFilterFlags(e),s=t&n,r=null==this._layerView.featureEffectView.featureEffect||this._layerView.featureEffectView.featureEffect.excludedLabelsVisible||t&i;return!(s&&r)}getDisplayStatistics(e,t){const s=this._statisticsByLevel.get(e);return s?s.get(t):null}updateStatistics(e,t){if(this._lockStatisticUpdates)return void this._updateStatisticsRequests.push({level:e,statistics:t});let s=this._statisticsByLevel.get(e);s||(s=new Map,this._statisticsByLevel.set(e,s));for(const r of t)s.set(r.fieldName,{minValue:r.minValue,maxValue:r.maxValue})}lockForOverrides(){this._renderState.value?.lockUploads(),this._lockStatisticUpdates=!0,this.attributeView.locked||(this.attributeView.lockTextureUploads(),this._shouldUnlockAttributeView=!0)}unlockForOverrides(){this._renderState.value?.unlockUploads(),this._shouldUnlockAttributeView&&(this.attributeView.unlockTextureUploads(),this._shouldUnlockAttributeView=!1),this._lockStatisticUpdates=!1;for(const e of this._updateStatisticsRequests)this.updateStatistics(e.level,e.statistics);this._updateStatisticsRequests=[],this._renderState.value?.flush(this.attributeView.currentEpoch),this.requestRender()}async updateRenderState(e){if(this._renderStateNext.value)throw new Error("InternalError: renderStateNext already exists");has("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureContainer.updateRenderState`),this._renderStateNext.value=new u(()=>this._stage,e=>this._subscriptions.get(e)?.version,e,this,this.tilingScheme)}async swapRenderState(){if(!this._renderStateNext.value)throw new Error("InternalError: renderStateNext not yet created");if(this._renderStateSwapResolver)throw new Error("InternalError: renderState swap already in progress");this._renderStateSwapResolver=Promise.withResolvers(),await this._renderStateSwapResolver.promise}async onMessage(e,s){t(s);const r=e.inner;if(!this._subscriptions.has(r.id))return;const i=this._subscriptions.get(r.id);if(i.version!==r.subscriptionVesrion){if(has("esri-2d-update-debug")){const e=`${r.subscriptionVesrion} != ${i.version}`;console.debug(`Version[${e}] Tile[${r.id}] FeatureContainer - Dropping message, outdated version]`,r)}return}const n=this._renderStateNext.value??this._renderState.value;if(!n)throw new Error("InternalError: No renderState defined");n.version!==r.version&&console.error(`InternalError: Version mismatch. [renderState: ${n.version}, message: ${r.version}]`),n.enqueueUpdate(e),this.requestRender()}removeTile(e){(this._renderState.value||this._renderStateNext.value)&&(this._renderState.value&&this._renderState.value.removeTile(e),this._renderStateNext.value&&this._renderStateNext.value.removeTile(e))}hitTest(e){const t=d(e);if(!t)return console.warn("Unexpected hittest input:",e),Promise.resolve([]);let s=this._hitTestsRequests.find(({query:e})=>t.hittestType===e.hittestType&&t.input===e.input);const r=Promise.withResolvers();return s?s.resolvers.push(r):(s={query:t,resolvers:[r]},this._hitTestsRequests.push(s)),this.requestRender(),r.promise}getSortKeys(e){const t=new Set(e),s=new Map;for(const r of this.children)if(r.getSortKeys(t).forEach((e,t)=>s.set(t,e)),s.size===t.size)break;return s}get hasAnimation(){return this.hasLabels}doRender(e){const{minScale:t,maxScale:s}=this._layerView.layer.effectiveScaleRange,r=e.state.scale;r<=(t||1/0)&&r>=s&&super.doRender(e)}setStencilReference(e){if(null==this._getHeatmapInstance(e))super.setStencilReference(e);else for(const t of this.children)t.stencilRef=o.heatmap.getStencilReference(t)}_finializeUpdate(){if(!this._updateResolver)return;const{schema:e,deconflictionInfo:t,invalidateMesh:s}=this._updateResolver.inner;this._schema=e,this._deconflictionInfo=t,this.attributeView.unlockTextureUploads(),this.instanceStore.updateEnd(this._supportsInstanceCleanup),s&&(this.restartAllAnimations(),this.swapRenderState());const r="heatmap"===e.mesh.factory.symbology.type?"target-defer":"eager";this._presentation.updateStrategy(r),this._updateResolver.resolver.resolve(),this._updateResolver=null,this.requestRender()}_handleSwapRenderState(){if(this._renderStateSwapResolver&&this._renderStateNext.value){has("esri-2d-update-debug")&&console.debug(`Version[${this._renderStateNext.value}] FeatureContainer.update.swapRenderState`);const e=this._renderState.value,t=new Set,s=new Set;for(const r of e?.tiles()??[])r.decluttering&&t.add(r.id),r.presenting&&s.add(r.id);this._renderState.value=this._renderStateNext.value,this._renderStateNext.value=null,this._renderState.value.flush(this.attributeView.currentEpoch),e?.destroy(),this._renderStateSwapResolver.resolve(),this._renderStateSwapResolver=null;for(const r of this._renderState.value.tiles())t.has(r.id)&&(r.decluttering=!0),s.has(r.id)&&(r.presenting=!0);this.requestRender(),this.hasLabels&&this.requestDeclutter()}}_renderMapPhase(e){this._layerView.featureEffectView.hasEffects?(this._renderOutsideEffect(e),this._renderInsideEffect(e)):this._renderFeatures(e,0),this._hitTestsRequests.length>0&&this._renderHittest(e)}_renderHighlightPhase(e){this.hasHighlight&&l(e,!1,e=>{this._renderFeatures(e,1)})}_renderLabelPhase(e){this._renderFeatures(e,0)}_renderInsideEffect(e){const t=e.painter.effects.insideEffect;t.bind(e),this._renderFeatures(e,2),t.draw(e,this._layerView.featureEffectView.includedEffects),t.unbind()}_renderOutsideEffect(e){const t=e.painter.effects.outsideEffect;t.bind(e),this._renderFeatures(e,3),t.draw(e,this._layerView.featureEffectView.excludedEffects),t.unbind()}_renderHittest(e){const{context:t}=e,s=e.painter.effects.hittest,r=t.boundFramebuffer,i=t.getViewport(),n=e.passOptions,a=e.drawPhase;s.bind(e),e.passOptions=s.createOptions(e,this._hitTestsRequests),e.drawPhase=8;const{distance:o,smallSymbolDistance:h}=e.passOptions,u=Math.max(o,h),l=e.passOptions.hittestType;for(const d of this.children)d.visible&&("rect"===l?d.containsScreenRect(e.state,e.passOptions.tlbr)&&this._renderTile(d,e,0):d.containsScreenPoint(e.state,e.passOptions.position,2*u)&&this._renderTile(d,e,0));s.draw(e),s.unbind(),t.bindFramebuffer(r),t.restoreViewport(i),e.passOptions=n,e.drawPhase=a}_renderFeatures(e,t){const s=this._getHeatmapInstance(e);null!=s?this._renderHeatmapFeatures(e,t,s):this._renderGeometryFeatures(e,t)}_renderGeometryFeatures(e,t){for(const s of this.children)s.visible&&this._renderTile(s,e,t)}_renderHeatmapFeatures(e,t,s){for(const r of this.children)r.visible&&this._renderTile(r,e,t,19);s.techniqueRef.renderResolvePass(e,s)}_renderTile(e,t,s,r){t.selection=s,e.getDisplayList()?.render(t,r)}}function _(e){return 19===e.techniqueRef.type}export{f as FeatureContainer};
|
|
2
|
+
import has from"../../../../core/has.js";import{destroyMaybe as e}from"../../../../core/maybe.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{signal as s}from"../../../../core/signal.js";import{AFeatureContainer as r}from"../../engine/AFeatureContainer.js";import{effectFlag0 as i,filterFlag0 as n}from"../../engine/webgl/definitions.js";import a from"../../engine/webgl/shaderGraph/techniques/FeatureInstanceStore.js";import{Techniques as o}from"../../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import{FeatureTilePresentStrategy as h}from"./FeatureTilePresentStrategy.js";import{RenderState as u}from"./RenderState.js";import{renderHighlight as l}from"../support/util.js";import{createHittestQuery as d}from"../../support/hitTestUtils.js";class c{constructor(e){this.inner=e,this.resolver=Promise.withResolvers()}}class p{constructor(e,t){this.id=e,this.version=t}}class f extends r{constructor(e){super(e.view.featuresTilingScheme),this._updatingChildren=s(!1),this._hitTestsRequests=[],this._renderState=s(null),this._renderStateNext=s(null),this._store=new a,this._subscriptions=new Map,this._presentation=new h,this._updateStatisticsRequests=[],this._lockStatisticUpdates=!1,this._supportsInstanceCleanup=!0,this._shouldUnlockAttributeView=!1,this._layerView=e,this.addTransitionable(this._layerView.featureEffectView)}destroy(){super.destroy(),this._renderState.value=e(this._renderState.value),this._renderStateNext.value=e(this._renderStateNext.value)}get batching(){return has("featurelayer-strict-draw-order")?1:has("featurelayer-force-marker-text-draw-order")?2:0}get updating(){const e=this._updatingChildren.value,t=!this._renderState.value||this._renderState.value.updating,s=!!this._renderStateNext.value,r=this.attributeView.updating;return e||t||s||r}subscriptions(){return this._subscriptions.values()}get hasLabels(){return null!==this.labelSchema}get hasHighlight(){return this._layerView.hasHighlight}get children(){return this._renderState.value?this._renderState.value.tiles().filter(e=>e.presenting):[]}get usedMemory(){let e=0;return this._renderState.value&&(e+=this._renderState.value.usedMemory),this._renderStateNext.value&&(e+=this._renderStateNext.value.usedMemory),e+=this.attributeView.usedMemory,e}get instanceStore(){return this._store}get labelingCollisionInfos(){if(!this._deconflictionInfo)throw new Error("InternalError: DeconflictionInfo not defined. Was update called?");return this._deconflictionInfo}get labelSchema(){return this._schema?.mesh.factory.labels??null}get layerOrder(){return this._layerView.view.allLayerViews.items.indexOf(this._layerView)}get tiles(){return this._renderState.value?.tiles()}get requiresRefresh(){return!!this._renderState.value?.requiresRefresh}get _instanceStore(){return this._store}_getHeatmapInstance(e){if(null==this._instanceStore||!(e.drawPhase&o.heatmap.drawPhase))return null;for(const t of this._instanceStore.values())if(_(t))return t;return null}update(e,t){this._schema=e,this._deconflictionInfo=t}setCoverage(e){this._presentation.updateCoverage(e)}getPresenting(){const e=new Set;for(const t of this._renderState.value?.tiles()??[])t.presenting&&e.add(t.id);return e}beforeRender(e){if(super.beforeRender(e),this._renderState.value){for(const t of this._renderState.value.tiles())t.setTransform(e.state);if(!e.decluttering){this._presentation.update(this._renderState.value.tiles());for(const e of this._renderState.value.tiles())e.upload(this._instanceStore,this.batching)}this._updatingChildren.value=!this.children.every(e=>e.ended&&e.presenting)}}renderChildren(e){switch(super.renderChildren(e),e.drawPhase){case 1:return this._renderMapPhase(e);case 16:return this._renderHighlightPhase(e);case 2:return this._renderLabelPhase(e)}}afterRender(e){super.afterRender(e),e.decluttering||(this._finializeUpdate(),this._updateAttributeView(),this._handleSwapRenderState(),this._renderState.value?.update(this.attributeView.currentEpoch)),this._hitTestsRequests.length&&this.requestRender()}updateStart(e){return this.attributeView.lockTextureUploads(),this._supportsInstanceCleanup=!e&&"dictionary"!==this._schema?.mesh.factory.symbology.type,this.instanceStore.updateStart(this._supportsInstanceCleanup),this.instanceStore}async updateEnd(e,t,s){return this._updateResolver=new c({schema:e,deconflictionInfo:t,invalidateMesh:s}),this.requestRender(),this._updateResolver.resolver.promise}updateAttributeView(e){this.requestRender(),this.attributeView.requestUpdate(e),this.hasLabels&&this.requestDeclutter()}updateSubscriptions(e){for(const{tileId:t,version:s}of e.subscribe){if(!this._subscriptions.has(t)){const e=new p(t,s);this._subscriptions.set(t,e);continue}this._subscriptions.get(t).version=s}for(const t of e.unsubscribe)this._subscriptions.delete(t),this.removeTile(t)}isFeatureFiltered(e){const t=this.attributeView.getFilterFlags(e),s=t&n,r=null==this._layerView.featureEffectView.featureEffect||this._layerView.featureEffectView.featureEffect.excludedLabelsVisible||t&i;return!(s&&r)}getDisplayStatistics(e,t){const s=this._statisticsByLevel.get(e);return s?s.get(t):null}updateStatistics(e,t){if(this._lockStatisticUpdates)return void this._updateStatisticsRequests.push({level:e,statistics:t});let s=this._statisticsByLevel.get(e);s||(s=new Map,this._statisticsByLevel.set(e,s));for(const r of t)s.set(r.fieldName,{minValue:r.minValue,maxValue:r.maxValue})}lockForOverrides(){this._renderState.value?.lockUploads(),this._lockStatisticUpdates=!0,this.attributeView.locked||(this.attributeView.lockTextureUploads(),this._shouldUnlockAttributeView=!0)}unlockForOverrides(){this._renderState.value?.unlockUploads(),this._shouldUnlockAttributeView&&(this.attributeView.unlockTextureUploads(),this._shouldUnlockAttributeView=!1),this._lockStatisticUpdates=!1;for(const e of this._updateStatisticsRequests)this.updateStatistics(e.level,e.statistics);this._updateStatisticsRequests=[],this._renderState.value?.flush(this.attributeView.currentEpoch),this.requestRender()}async updateRenderState(e){if(this._renderStateNext.value)throw new Error("InternalError: renderStateNext already exists");has("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureContainer.updateRenderState`),this._renderStateNext.value=new u(()=>this._stage,e=>this._subscriptions.get(e)?.version,e,this,this.tilingScheme)}async swapRenderState(){if(!this._renderStateNext.value)throw new Error("InternalError: renderStateNext not yet created");if(this._renderStateSwapResolver)throw new Error("InternalError: renderState swap already in progress");this._renderStateSwapResolver=Promise.withResolvers(),await this._renderStateSwapResolver.promise}async onMessage(e,s){t(s);const r=e.inner;if(!this._subscriptions.has(r.id))return;const i=this._subscriptions.get(r.id);if(i.version!==r.subscriptionVesrion){if(has("esri-2d-update-debug")){const e=`${r.subscriptionVesrion} != ${i.version}`;console.debug(`Version[${e}] Tile[${r.id}] FeatureContainer - Dropping message, outdated version]`,r)}return}const n=this._renderStateNext.value??this._renderState.value;if(!n)throw new Error("InternalError: No renderState defined");n.version!==r.version&&console.error(`InternalError: Version mismatch. [renderState: ${n.version}, message: ${r.version}]`),n.enqueueUpdate(e),this.requestRender()}removeTile(e){(this._renderState.value||this._renderStateNext.value)&&(this._renderState.value&&this._renderState.value.removeTile(e),this._renderStateNext.value&&this._renderStateNext.value.removeTile(e))}hitTest(e){const t=d(e);if(!t)return console.warn("Unexpected hittest input:",e),Promise.resolve([]);let s=this._hitTestsRequests.find(({query:e})=>t.hittestType===e.hittestType&&t.input===e.input);const r=Promise.withResolvers();return s?s.resolvers.push(r):(s={query:t,resolvers:[r]},this._hitTestsRequests.push(s)),this.requestRender(),r.promise}getSortKeys(e){const t=new Set(e),s=new Map;for(const r of this.children)if(r.getSortKeys(t).forEach((e,t)=>s.set(t,e)),s.size===t.size)break;return s}get hasAnimation(){return this.hasLabels}doRender(e){const{minScale:t,maxScale:s}=this._layerView.layer.effectiveScaleRange,r=e.state.scale;r<=(t||1/0)&&r>=s&&super.doRender(e)}setStencilReference(e){if(null==this._getHeatmapInstance(e))super.setStencilReference(e);else for(const t of this.children)t.stencilRef=o.heatmap.getStencilReference(t)}_finializeUpdate(){if(!this._updateResolver)return;const{schema:e,deconflictionInfo:t,invalidateMesh:s}=this._updateResolver.inner;this._schema=e,this._deconflictionInfo=t,this.attributeView.unlockTextureUploads(),this.instanceStore.updateEnd(this._supportsInstanceCleanup),s&&(this.restartAllAnimations(),this.swapRenderState());const r="heatmap"===e.mesh.factory.symbology.type?"target-defer":"eager";this._presentation.updateStrategy(r),this._updateResolver.resolver.resolve(),this._updateResolver=null,this.requestRender()}_handleSwapRenderState(){if(this._renderStateSwapResolver&&this._renderStateNext.value){has("esri-2d-update-debug")&&console.debug(`Version[${this._renderStateNext.value}] FeatureContainer.update.swapRenderState`);const e=this._renderState.value,t=new Set,s=new Set;for(const r of e?.tiles()??[])r.decluttering&&t.add(r.id),r.presenting&&s.add(r.id);this._renderState.value=this._renderStateNext.value,this._renderStateNext.value=null,this._renderState.value.flush(this.attributeView.currentEpoch),e?.destroy(),this._renderStateSwapResolver.resolve(),this._renderStateSwapResolver=null;for(const r of this._renderState.value.tiles())t.has(r.id)&&(r.decluttering=!0),s.has(r.id)&&(r.presenting=!0);this.requestRender(),this.hasLabels&&this.requestDeclutter()}}_renderMapPhase(e){this._layerView.featureEffectView.hasEffects?(this._renderOutsideEffect(e),this._renderInsideEffect(e)):this._renderFeatures(e,0),this._hitTestsRequests.length>0&&this._renderHittest(e)}_renderHighlightPhase(e){this.hasHighlight&&l(e,!1,e=>{this._renderFeatures(e,1)})}_renderLabelPhase(e){this._renderFeatures(e,0)}_renderInsideEffect(e){const t=e.painter.effects.insideEffect;t.bind(e),this._renderFeatures(e,2),t.draw(e,this._layerView.featureEffectView.includedEffects),t.unbind()}_renderOutsideEffect(e){const t=e.painter.effects.outsideEffect;t.bind(e),this._renderFeatures(e,3),t.draw(e,this._layerView.featureEffectView.excludedEffects),t.unbind()}_renderHittest(e){const{context:t}=e,s=e.painter.effects.hittest,r=t.boundFramebuffer,i=t.getViewport(),n=e.passOptions,a=e.drawPhase;s.bind(e),e.passOptions=s.createOptions(e,this._hitTestsRequests),e.drawPhase=8;const{distance:o,smallSymbolDistance:h}=e.passOptions,u=Math.max(o,h),l=e.passOptions.hittestType;for(const d of this.children)d.visible&&("rect"===l?d.containsScreenRect(e.state,e.passOptions.tlbr)&&this._renderTile(d,e,0):d.containsScreenPoint(e.state,e.passOptions.position,2*u)&&this._renderTile(d,e,0));s.draw(e),s.unbind(),t.bindFramebuffer(r),t.restoreViewport(i),e.passOptions=n,e.drawPhase=a}_renderFeatures(e,t){const s=this._getHeatmapInstance(e);null!=s?this._renderHeatmapFeatures(e,t,s):this._renderGeometryFeatures(e,t)}_renderGeometryFeatures(e,t){for(const s of this.children)s.visible&&this._renderTile(s,e,t)}_renderHeatmapFeatures(e,t,s){for(const r of this.children)r.visible&&this._renderTile(r,e,t,19);s.techniqueRef.renderResolvePass(e,s)}_renderTile(e,t,s,r){t.selection=s,e.getDisplayList()?.render(t,r)}}function _(e){return 19===e.techniqueRef.type}export{f as FeatureContainer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import t from"../../../../../core/Error.js";import has from"../../../../../core/has.js";import e from"../../../../../core/Logger.js";import{diff as i}from"../../../../../core/accessorSupport/diffUtils.js";import{collectExpressionDependencies as s}from"../../../../../support/ArcadeExpression.js";import{attributeStoreInitialSize as r,maxHighlightReasons as a}from"../../../engine/webgl/definitions.js";import{getDisplayIdTexel as n}from"../../../engine/webgl/DisplayId.js";import{getPixelArrayCtor as o}from"../../../engine/webgl/Utils.js";import{nanMagicNumber as l}from"../../../engine/webgl/shaderGraph/techniques/shaders/constants.js";import{createDebugLogger as h,DEBUG_ATTR_UPDATES as d}from"../../../engine/webgl/util/debug.js";import{DisplayIdGenerator as c}from"./DisplayIdGenerator.js";import u from"./FeatureFilterEvaluator.js";import{PixelType as p}from"../../../../webgl/enums.js";function g(t,e){if(!t||!e)return t;switch(e){case"radius":case"distance":return 2*t;case"diameter":case"width":return t;case"area":return Math.sqrt(t)}return t}const f=()=>e.getLogger("esri.views.layers.2d.features.support.AttributeStore"),_=h(d,f()),y={sharedArrayBuffer:has("esri-shared-array-buffer"),atomics:has("esri-atomics")};class m{constructor(t,e,i){this.size=0,this.texelSize=4,this.dirtyStart=0,this.dirtyEnd=0;const{pixelType:s,layout:r,textureOnly:a}=e;this.textureOnly=a||!1,this.pixelType=s,this.layout=r,this._resetRange(),this.size=t,this.isLocal=i,a||(this.data=this._initData(s,t))}get usedMemory(){return this.data?.byteLength??0}get buffer(){return this.data?.buffer}unsetComponentAllTexels(t,e){const i=this.data;for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]&=~e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponentAllTexels(t,e){const i=this.data;for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]|=255&e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponent(t,e,i){const s=this.data;for(const r of i)s[r*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r)}setComponentTexel(t,e,i){this.data[i*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}unsetComponentTexel(t,e,i){this.data[i*this.texelSize+t]&=~e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}getData(t,e){const i=n(t);return this.data[i*this.texelSize+e]}setData(t,e,i){const s=n(t),r=1<<e;0!==(this.layout&r)?null!=this.data&&(this.data[s*this.texelSize+e]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s)):f().error("mapview-attributes-store","Tried to set a value for a texel's readonly component")}expand(t){if(this.size=t,!this.textureOnly){const e=this._initData(this.pixelType,t),i=this.data;e.set(i),this.data=e}}toMessage(){const t=this.dirtyStart,e=this.dirtyEnd,i=this.texelSize;if(t>e)return null;this._resetRange();const s=!this.isLocal,r=this.pixelType,a=this.layout,n=this.data;return{start:t,end:e,data:s&&n.slice(t*i,(e+1)*i)||null,pixelType:r,layout:a}}_initData(t,e){const i=ArrayBuffer,s=o(t),r=new s(new i(e*e*4*s.BYTES_PER_ELEMENT));for(let a=0;a<r.length;a+=4)r[a+1]=255;return r}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}}class b{constructor(t){this._client=t,this._filters=[],this._blocks=new Array,this._attributeComputeInfo=null,this._abortController=new AbortController,this._size=r,this._idsToHighlight=new Map,this._arcadeDependencies=new Set,this._initialized=!1,this.version=0,this._idGenerator=new c,this._epoch=1}destroy(){this._abortController.abort()}_initialize(){if(null!=this._blockDescriptors)return;const t=p.FLOAT;_(`Creating AttributeStore ${y.sharedArrayBuffer?"with":"without"} shared memory`),this._blockDescriptors=[{pixelType:p.UNSIGNED_BYTE,layout:1},{pixelType:p.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:p.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:p.FLOAT,layout:15}],this._blocks=this._blockDescriptors.map(()=>null)}get usedMemory(){let t=0;for(const e of this._blocks)e&&(t+=e.usedMemory);return t+=this._idGenerator.usedMemory,t}get hasHighlight(){return this._idsToHighlight.size>0}createDisplayIdForObjectId(t){return this._idGenerator.createIdForObjectId(t)}releaseDisplayIdForObjectId(t){return this._idGenerator.releaseIdForObjectId(t)}getDisplayIdForObjectId(t){return this._idGenerator.getDisplayIdForObjectId(t)}incrementDisplayIdGeneration(){this._idGenerator.incrementGeneration()}hasArcadeDependency(t){return this._arcadeDependencies.has(t)}releaseAllIds(){this._idGenerator.releaseAll()}async update(t,e,s,r=0){const a=i(this._schema,t);if(this.version=r,a&&(has("esri-2d-update-debug")&&console.debug(`Version[${r}] AttributeStore.update`,{changed:a}),this._schema=t,this._attributeComputeInfo=null,this._initialize(),null!=t))if(s&&(this._filters=await Promise.all(t.filters.map(t=>t?u.create({geometryType:s.geometryType,hasM:!1,hasZ:!1,timeInfo:s.timeInfo,fieldsIndex:s.fieldsIndex,spatialReference:s.outSpatialReference,filterJSON:t}):null))),"multi"!==t.type)this._attributeComputeInfo={type:"feature",map:new Map},await Promise.all(t.bindings.map(async t=>{const i=await this._bind(e,t);this._updateReferences(i)}));else{this._attributeComputeInfo={type:"multi",keyField:t.keyField,map:new Map};for(const i in t.bindings){const s=t.bindings[i];await Promise.all(s.map(async t=>{const s=await this._bind(e,t,parseInt(i,10));this._updateReferences(s)}))}}}setHighlight(t,e){let i=null;0===t.length&&0===e.length&&(i=this._getBlock(0),i.unsetComponentAllTexels(0,(1<<a)-1));for(const{displayId:s,highlightFlags:r}of t){if(null==s||-1===s)continue;i||(i=this._getBlock(0),i.unsetComponentAllTexels(0,(1<<a)-1));const t=n(s);i.setComponent(0,r,[t])}this._idsToHighlight.clear();for(const{objectId:s,highlightFlags:r}of t)this._idsToHighlight.set(s,r);for(const{objectId:s,highlightFlags:r}of e)this._idsToHighlight.set(s,r)}setData(t,e,i,s){const r=n(t);this._ensureSizeForTexel(r),this._getBlock(e).setData(t,i,s)}getData(t,e,i){return this._getBlock(e).getData(t,i)}getHighlightFlags(t){return this._idsToHighlight.get(t)||0}unsetAttributeData(t){const e=n(t);this._getBlock(0).setData(e,0,0)}referencesScale(){const t=this._attributeComputeInfo;if(!t)return!1;if("multi"===t.type){for(const e of t.map.values())for(const{field:t}of e.values())if(t?.hasArcadeDependency("scale"))return!0}else for(const{field:e}of t.map.values())if(e?.hasArcadeDependency("scale"))return!0;return!1}setAttributeData(t,e,i,s){const r=n(t);this._ensureSizeForTexel(r),this._getBlock(0).setData(r,0,this.getFilterFlags(e,s));const a=this._attributeComputeInfo,o=1,h=4;let d=null;a&&(d="multi"===a.type?a.map.get(e.readAttribute(a.keyField)):a.map,d?.size&&d.forEach((t,s)=>{const a=s*o%h,n=Math.floor(s*o/h),d=this._getBlock(n+3);let c=t.field?.read(e,i);t.valueRepresentation&&(c=g(c,t.valueRepresentation));(null===c||isNaN(c)||c===1/0||c===-1/0)&&(c=l),d.setData(r,a,c)}))}get epoch(){return this._epoch}sendUpdates(){const t=this._blocks.map(t=>null!=t?t.toMessage():null),e=this._getInitArgs();
|
|
2
|
+
import t from"../../../../../core/Error.js";import has from"../../../../../core/has.js";import e from"../../../../../core/Logger.js";import{diff as i}from"../../../../../core/accessorSupport/diffUtils.js";import{collectExpressionDependencies as s}from"../../../../../support/ArcadeExpression.js";import{attributeStoreInitialSize as r,maxHighlightReasons as a}from"../../../engine/webgl/definitions.js";import{getDisplayIdTexel as n}from"../../../engine/webgl/DisplayId.js";import{getPixelArrayCtor as o}from"../../../engine/webgl/Utils.js";import{nanMagicNumber as l}from"../../../engine/webgl/shaderGraph/techniques/shaders/constants.js";import{createDebugLogger as h,DEBUG_ATTR_UPDATES as d}from"../../../engine/webgl/util/debug.js";import{DisplayIdGenerator as c}from"./DisplayIdGenerator.js";import u from"./FeatureFilterEvaluator.js";import{PixelType as p}from"../../../../webgl/enums.js";function g(t,e){if(!t||!e)return t;switch(e){case"radius":case"distance":return 2*t;case"diameter":case"width":return t;case"area":return Math.sqrt(t)}return t}const f=()=>e.getLogger("esri.views.layers.2d.features.support.AttributeStore"),_=h(d,f()),y={sharedArrayBuffer:has("esri-shared-array-buffer"),atomics:has("esri-atomics")};class m{constructor(t,e,i){this.size=0,this.texelSize=4,this.dirtyStart=0,this.dirtyEnd=0;const{pixelType:s,layout:r,textureOnly:a}=e;this.textureOnly=a||!1,this.pixelType=s,this.layout=r,this._resetRange(),this.size=t,this.isLocal=i,a||(this.data=this._initData(s,t))}get usedMemory(){return this.data?.byteLength??0}get buffer(){return this.data?.buffer}unsetComponentAllTexels(t,e){const i=this.data;for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]&=~e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponentAllTexels(t,e){const i=this.data;for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]|=255&e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponent(t,e,i){const s=this.data;for(const r of i)s[r*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r)}setComponentTexel(t,e,i){this.data[i*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}unsetComponentTexel(t,e,i){this.data[i*this.texelSize+t]&=~e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}getData(t,e){const i=n(t);return this.data[i*this.texelSize+e]}setData(t,e,i){const s=n(t),r=1<<e;0!==(this.layout&r)?null!=this.data&&(this.data[s*this.texelSize+e]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s)):f().error("mapview-attributes-store","Tried to set a value for a texel's readonly component")}expand(t){if(this.size=t,!this.textureOnly){const e=this._initData(this.pixelType,t),i=this.data;e.set(i),this.data=e}}toMessage(){const t=this.dirtyStart,e=this.dirtyEnd,i=this.texelSize;if(t>e)return null;this._resetRange();const s=!this.isLocal,r=this.pixelType,a=this.layout,n=this.data;return{start:t,end:e,data:s&&n.slice(t*i,(e+1)*i)||null,pixelType:r,layout:a}}_initData(t,e){const i=ArrayBuffer,s=o(t),r=new s(new i(e*e*4*s.BYTES_PER_ELEMENT));for(let a=0;a<r.length;a+=4)r[a+1]=255;return r}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}}class b{constructor(t){this._client=t,this._filters=[],this._blocks=new Array,this._attributeComputeInfo=null,this._abortController=new AbortController,this._size=r,this._idsToHighlight=new Map,this._arcadeDependencies=new Set,this._initialized=!1,this.version=0,this._idGenerator=new c,this._epoch=1}destroy(){this._abortController.abort()}_initialize(){if(null!=this._blockDescriptors)return;const t=p.FLOAT;_(`Creating AttributeStore ${y.sharedArrayBuffer?"with":"without"} shared memory`),this._blockDescriptors=[{pixelType:p.UNSIGNED_BYTE,layout:1},{pixelType:p.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:p.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:p.FLOAT,layout:15}],this._blocks=this._blockDescriptors.map(()=>null)}get usedMemory(){let t=0;for(const e of this._blocks)e&&(t+=e.usedMemory);return t+=this._idGenerator.usedMemory,t}get hasHighlight(){return this._idsToHighlight.size>0}createDisplayIdForObjectId(t){return this._idGenerator.createIdForObjectId(t)}releaseDisplayIdForObjectId(t){return this._idGenerator.releaseIdForObjectId(t)}getDisplayIdForObjectId(t){return this._idGenerator.getDisplayIdForObjectId(t)}incrementDisplayIdGeneration(){this._idGenerator.incrementGeneration()}hasArcadeDependency(t){return this._arcadeDependencies.has(t)}releaseAllIds(){this._idGenerator.releaseAll()}async update(t,e,s,r=0){const a=i(this._schema,t);if(this.version=r,a&&(has("esri-2d-update-debug")&&console.debug(`Version[${r}] AttributeStore.update`,{changed:a}),this._schema=t,this._attributeComputeInfo=null,this._initialize(),null!=t))if(s&&(this._filters=await Promise.all(t.filters.map(t=>t?u.create({geometryType:s.geometryType,hasM:!1,hasZ:!1,timeInfo:s.timeInfo,fieldsIndex:s.fieldsIndex,spatialReference:s.outSpatialReference,filterJSON:t}):null))),"multi"!==t.type)this._attributeComputeInfo={type:"feature",map:new Map},await Promise.all(t.bindings.map(async t=>{const i=await this._bind(e,t);this._updateReferences(i)}));else{this._attributeComputeInfo={type:"multi",keyField:t.keyField,map:new Map};for(const i in t.bindings){const s=t.bindings[i];await Promise.all(s.map(async t=>{const s=await this._bind(e,t,parseInt(i,10));this._updateReferences(s)}))}}}setHighlight(t,e){let i=null;0===t.length&&0===e.length&&(i=this._getBlock(0),i.unsetComponentAllTexels(0,(1<<a)-1));for(const{displayId:s,highlightFlags:r}of t){if(null==s||-1===s)continue;i||(i=this._getBlock(0),i.unsetComponentAllTexels(0,(1<<a)-1));const t=n(s);i.setComponent(0,r,[t])}this._idsToHighlight.clear();for(const{objectId:s,highlightFlags:r}of t)this._idsToHighlight.set(s,r);for(const{objectId:s,highlightFlags:r}of e)this._idsToHighlight.set(s,r)}setData(t,e,i,s){const r=n(t);this._ensureSizeForTexel(r),this._getBlock(e).setData(t,i,s)}getData(t,e,i){return this._getBlock(e).getData(t,i)}getHighlightFlags(t){return this._idsToHighlight.get(t)||0}unsetAttributeData(t){const e=n(t);this._getBlock(0).setData(e,0,0)}referencesScale(){const t=this._attributeComputeInfo;if(!t)return!1;if("multi"===t.type){for(const e of t.map.values())for(const{field:t}of e.values())if(t?.hasArcadeDependency("scale"))return!0}else for(const{field:e}of t.map.values())if(e?.hasArcadeDependency("scale"))return!0;return!1}setAttributeData(t,e,i,s){const r=n(t);this._ensureSizeForTexel(r),this._getBlock(0).setData(r,0,this.getFilterFlags(e,s));const a=this._attributeComputeInfo,o=1,h=4;let d=null;a&&(d="multi"===a.type?a.map.get(e.readAttribute(a.keyField)):a.map,d?.size&&d.forEach((t,s)=>{const a=s*o%h,n=Math.floor(s*o/h),d=this._getBlock(n+3);let c=t.field?.read(e,i);t.valueRepresentation&&(c=g(c,t.valueRepresentation));(null===c||isNaN(c)||c===1/0||c===-1/0)&&(c=l),d.setData(r,a,c)}))}get epoch(){return this._epoch}sendUpdates(){const t=this._blocks.map(t=>null!=t?t.toMessage():null),e=this._getInitArgs();this._client.update({initArgs:e,blockData:t,version:this.version,sendUpdateEpoch:this._epoch}),this._epoch+=1}_ensureSizeForTexel(t){for(;t>=this._size*this._size;)if(this._expand())return}async _bind(t,e,i){const s=await t.createComputedField(e),{valueRepresentation:r}=e,a=this._attributeComputeInfo;if("multi"===a.type){const t=a.map.get(i)??new Map;t.set(e.binding,{field:s,valueRepresentation:r}),a.map.set(i,t)}else a.map.set(e.binding,{field:s,valueRepresentation:r});return s}_getInitArgs(){return this._initialized?null:(this._initialized=!0,this._getBlock(1),this._getBlock(2),this._getBlock(7),{blockSize:this._size,blockDescriptors:this._blocks.map(t=>null!=t?{textureOnly:t.textureOnly,buffer:t.buffer,pixelType:t.pixelType}:null)})}_getBlock(t){const e=this._blocks[t];if(null!=e)return e;_(`Initializing AttributeBlock at index ${t}`);const i=new m(this._size,this._blockDescriptors[t],this._client.isLocal);return this._blocks[t]=i,this._initialized=!1,i}_expand(){if(this._size<this._schema.capabilities.maxTextureSize){const t=this._size<<=1;_("Expanding block size to",t,this._blocks);for(const e of this._blocks)e?.expand(t);return this._initialized=!1,this._size=t,0}return f().error(new t("mapview-limitations","Maximum number of onscreen features exceeded.")),-1}_updateReferences(t){s(this._arcadeDependencies,t)}isVisible(t){return!!(this._getBlock(0).getData(t,0)&1<<a)}getFilterFlags(t,e){let i=0;for(let r=0;r<this._filters.length;r++){const s=!!(1<<r),a=this._filters[r];i|=(!s||null==a||a.check(t,e)?1:0)<<r}let s=0;if(this._idsToHighlight.size){const e=t.getObjectId();s=this.getHighlightFlags(e)}return i<<a|s}}export{b as AttributeStore,g as getVisualVariableSizeValueRepresentationRatio};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{ArcadeDate as e}from"../../../../../arcade/ArcadeDate.js";import has from"../../../../../core/has.js";import{estimateNumberArrayMemory as t}from"../../../../../core/memoryEstimations.js";import{DateOnly as r}from"../../../../../core/sql/DateOnly.js";import{TimeOnly as s}from"../../../../../core/sql/TimeOnly.js";import{GeometryCursor as i}from"../../../../../geometry/GeometryCursor.js";import{fromRectValues as o}from"../../../../../geometry/support/aaBoundingBox.js";import{fromJSON as a}from"../../../../../geometry/support/jsonUtils.js";import{getLabelPoint as n}from"../../../../../geometry/support/labelPoint.js";import{quantizeX as d,quantizeY as u}from"../../../../../geometry/support/quantizationUtils.js";import{getCentroidOptimizedGeometry as c}from"../../../../../layers/graphics/centroid.js";import{convertToGeometry as h,generalizeOptimizedGeometry as l,quantizeForDisplay as m,unquantizeOptimizedGeometryInPlace as y}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as f}from"../../../../../layers/graphics/OptimizedFeature.js";import p from"../../../../../layers/graphics/OptimizedGeometry.js";import{system as g,unknown as _}from"../../../../../time/constants.js";import{FeatureSetCache as b}from"./FeatureSetCache.js";const x=has("featurelayer-simplify-thresholds")??[.5,.5,.5,.5],D=x[0],T=x[1],F=x[2],I=x[3],A=has("featurelayer-simplify-payload-size-factors")??[1,2,4],S=A[0],B=A[1],j=A[2],G=has("featurelayer-simplify-mobile-factor")??2,C=has("esri-mobile"),v=4294967295;function M(e,t,r){if(!(e.length>t))for(;e.length<=t;)e.push(r)}class O{constructor(e){this.metadata=e,this.type="FeatureSetReader",this._overrides=null,this._postQueryFilteredIds=new Set,this._joined=[],this._objectIdToIndex=null,this._boundsBuffer=[],this._caches=new Map,this.arcadeDeclaredClass="esri.arcade.Feature",this._contextTimeZone=null}destroy(){}[Symbol.dispose](){this.destroy()}getAreaSimplificationThreshold(e,t){let r=1;const s=C?G:1;t>4e6?r=j*s:t>1e6?r=B*s:t>5e5?r=S*s:t>1e5&&(r=s);let i=0;return e>4e3?i=I*r:e>2e3?i=F*r:e>100?i=T:e>15&&(i=D),i}getBounds(e){M(this._boundsBuffer,4*this.getIndex()+4,0);const t=this.getBoundsXMin();if(t===v||!isFinite(t))return!1;if(0===this.getBoundsXMin()){const t=this.readGeometryWorldSpace();if(t?.isPoint&&0===t.coords[0]&&0===t.coords[1])return o(e,0,0,0,0),!0;if(!t)return this.setBoundsXMin(v),!1;let r=1/0,s=1/0,i=-1/0,a=-1/0;return t.forEachVertex((e,t)=>{r=Math.min(r,e),s=Math.min(s,t),i=Math.max(i,e),a=Math.max(a,t)}),this.setBoundsXMin(r),this.setBoundsYMin(s),this.setBoundsXMax(i),this.setBoundsYMax(a),o(e,r,s,i,a),!0}const r=this.getBoundsXMin(),s=this.getBoundsYMin(),i=this.getBoundsXMax(),a=this.getBoundsYMax();return o(e,r,s,i,a),!0}getBoundsXMin(){return this._boundsBuffer[4*this.getIndex()]}setBoundsXMin(e){this._boundsBuffer[4*this.getIndex()]=e}getBoundsYMin(){return this._boundsBuffer[4*this.getIndex()+1]}setBoundsYMin(e){this._boundsBuffer[4*this.getIndex()+1]=e}getBoundsXMax(){return this._boundsBuffer[4*this.getIndex()+2]}setBoundsXMax(e){this._boundsBuffer[4*this.getIndex()+2]=e}getBoundsYMax(){return this._boundsBuffer[4*this.getIndex()+3]}setBoundsYMax(e){this._boundsBuffer[4*this.getIndex()+3]=e}readAttributeAsTimestamp(e){const t=this.readAttribute(e);return"string"==typeof t?new Date(t).getTime():"number"==typeof t||null==t?t:null}readAttribute(e,t=!1){const r=this._readAttribute(e,t);if(void 0!==r)return r;for(const s of this._joined){s.setIndex(this.getIndex());const r=s._readAttribute(e,t);if(void 0!==r)return r}}readAttributes(){const e=this._readAttributes();for(const t of this._joined){t.setIndex(this.getIndex());const r=t._readAttributes();for(const t of Object.keys(r))e[t]=r[t]}return e}joinAttributes(e){this._joined.push(e)}registerOverrides(e){this._overrides=e}withoutOverrides(){const e=this.copy();return e._overrides=null,e}readOptimizedFeatureWorldSpace(){const e=this.readGeometryWorldSpace(),t=this.readAttributes(),r=this.readCentroidWorldSpace();return new f(e,t,r,this.getObjectId(),this.getDisplayId())}readLegacyFeatureForDisplay(){const e=this.readCentroidForDisplay();return{attributes:this.readAttributes(),geometry:this.readLegacyGeometryForDisplay(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyFeatureWorldSpace(){const e=this.readCentroidWorldSpace();return{attributes:this.readAttributes(),geometry:this._readLegacyGeometryWorldSpace(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyGeometryForDisplay(){const e=this.readGeometryForDisplay();return h(e,this.geometryType,!1,!1)}readXForDisplay(){return this._readX()}readYForDisplay(){return this._readY()}readXWorldSpace(){const e=this._readX(),t=this.getInTransform();return null==t?e:e*t.scale[0]+t.translate[0]}readYWorldSpace(){const e=this._readY(),t=this.getInTransform();return null==t?e:t.translate[1]-e*t.scale[1]}readGeometryForDisplay(){const e=this._readGeometryDeltaDecoded(!0);if(!e){const e=this._createDeltaQuantizedGeometryFromServerCentroid();return e?e.deltaDecode():null}return e}readGeometryForDisplayTransformed(e){let t=this.readGeometryForDisplay();if(t&&"esriGeometryPolyline"===this.metadata.geometryType&&(t=l(t,this.metadata.geometryType,e.scale[0])),t&&(t=m(t,e,this.metadata.geometryType)),!t){const t=this.readCentroidForDisplay();if(!t)return null;const r=d(e,t.coords[0]),s=u(e,t.coords[1]);return this._createDeltaQuantizedExtrudedGeometry(r,s).deltaDecode()}return t}readGeometryWorldSpace(){let e=this._readGeometry();if(e||(e=this._createDeltaQuantizedGeometryFromServerCentroid()),!e)return null;const t=e.clone(),r=this.getInTransform();return null!=r&&y(t,r),t}readCentroidForDisplay(){const e=this.readGeometryForDisplay();return e?this._computeDisplayCentroid(e):this._readServerCentroid()}readCentroidWorldSpace(){const e=this.readGeometryForDisplay(),t=e?this._computeDisplayCentroid(e):this._readServerCentroid();if(!t)return null;const r=t.clone(),s=this.getInTransform();return null!=s&&y(r,s),r}setCache(e){let t=this._caches.get(e);null==t&&(t=new b(this.getSize()),this._caches.set(e,t)),this._activeCache=t}setCachedValue(e){this._activeCache.set(this.getIndex(),e)}hasCachedValue(){return this._activeCache.has(this.getIndex())}getCachedValue(){return this._activeCache.get(this.getIndex())}get underlyingMemory(){let e=0;e+=t(this._boundsBuffer);for(const t of this._caches.values())e+=t.usedMemory;return e}_readGeometryDeltaDecoded(e){const t=this._readGeometry(e);if("esriGeometryPoint"===this.geometryType||!t)return t;const r=this.getInTransform();if(!t||!r)return t;const s=r.scale[2]??1,i=r.translate[2]??0,o=r.scale[3]??1,a=r.translate[3]??0,{hasZ:n,hasM:d,stride:u,size:c,coords:h}=t,l=n&&(1!==s||0!==i),m=d&&(1!==o||0!==a);if(l||m){const e=2,t=n?3:2;for(let r=0,n=u*c;r<n;r+=u)l&&(h[r+e]=s*h[r+e]+i),m&&(h[r+t]=o*h[r+t]+a)}return t.deltaDecode()}get contextTimeZone(){return this._contextTimeZone}set contextTimeZone(e){this._contextTimeZone=e}readArcadeFeature(){return this}hasField(e){return this.fields.has(e)||this._joined.some(t=>t.hasField(e))}geometry(){const e=this.readGeometryWorldSpace(),t=h(e,this.geometryType,this.hasZ,this.hasM),r=a(t);if(r){if(!this.metadata.outSpatialReference)throw new Error("InternalError: Expected spatial reference to be defined");r.spatialReference=this.metadata.outSpatialReference}return r}autocastArcadeDate(t,r){return r&&r instanceof Date?this.isUnknownDateTimeField(t)?e.unknownDateJSToArcadeDate(r):e.dateJSAndZoneToArcadeDate(r,this.contextTimeZone??g):r}isUnknownDateTimeField(e){return this.metadata.fieldsIndex.getTimeZone(e)===_}field(t){let i=this.fields.get(t);if(i)switch(i.type){case"date-only":case"esriFieldTypeDateOnly":return r.fromReader(this.readAttribute(t,!1));case"time-only":case"esriFieldTypeTimeOnly":return s.fromReader(this.readAttribute(t,!1));case"esriFieldTypeTimestampOffset":case"timestamp-offset":return e.fromReaderAsTimeStampOffset(this.readAttribute(t,!1));case"date":case"esriFieldTypeDate":return this.autocastArcadeDate(t,this.readAttribute(t,!0));default:return this.readAttribute(t,!1)}for(const o of this._joined)if(o.setIndex(this.getIndex()),i=o.fields.get(t),i)switch(i.type){case"date-only":case"esriFieldTypeDateOnly":return r.fromReader(o._readAttribute(t,!1));case"time-only":case"esriFieldTypeTimeOnly":return s.fromReader(o._readAttribute(t,!1));case"esriFieldTypeTimestampOffset":case"timestamp-offset":return e.fromReaderAsTimeStampOffset(o._readAttribute(t,!1));case"date":case"esriFieldTypeDate":return this.autocastArcadeDate(t,o._readAttribute(t,!0));default:return this.readAttribute(t,!1)}throw new Error(`Field ${t} does not exist`)}setField(e,t){throw new Error("Unable to update feature attribute values, feature is readonly")}keys(){return this.fields.fields.map(e=>e.name)}isEmpty(){return this.fields.fields.length<=0&&null==this.geometry()}castToText(e=!1){if(!e)return JSON.stringify(this.readLegacyFeatureForDisplay());const t=this.readLegacyFeatureForDisplay();if(!t)return JSON.stringify(null);const r={geometry:t.geometry,attributes:{...t.attributes}};for(const s in r.attributes){const e=r.attributes[s];e instanceof Date&&(r.attributes[s]=e.getTime())}return JSON.stringify(r)}gdbVersion(){return null}fullSchema(){return this.metadata.arcadeSchema}castAsJson(e=null){return{attributes:this._readAttributes(),geometry:!0===e?.keepGeometryType?this.geometry():this.geometry()?.toJSON()??null}}castAsJsonAsync(e=null,t=null){return Promise.resolve(this.castAsJson(t))}applyPostQueryFilter(e){if(this._postQueryFilteredIds.clear(),!e)return;const t=this.getCursor();for(;t.next();){e.check(t,{currentUser:null})||this._postQueryFilteredIds.add(t.getObjectId())}}_getExists(){if(this._overrides){const e=this.getObjectId();return!this._overrides.hasOverride(e)}return!this._postQueryFilteredIds.has(this.getObjectId())}_computeDisplayCentroid(e){if(null==this.getInTransform())return c(e);const t=i.fromOptimized(e,this.geometryType);t.yFactor*=-1;const r=n(t);return r?isNaN(r[0])||isNaN(r[1])?c(e):(r[1]*=-1,new p([],r)):null}copyInto(e){e._joined=this._joined,e._overrides=this._overrides,e._objectIdToIndex=this._objectIdToIndex,e._boundsBuffer=this._boundsBuffer,e._activeCache=this._activeCache,e._caches=this._caches,e._contextTimeZone=this._contextTimeZone,e._postQueryFilteredIds=this._postQueryFilteredIds}_readLegacyGeometryWorldSpace(){const e=this.readGeometryWorldSpace();return h(e,this.geometryType,!1,!1)}_createDeltaQuantizedGeometryFromServerCentroid(){const e=this._readServerCentroid();if(!e)return null;const[t,r]=e.coords;return this._createDeltaQuantizedExtrudedGeometry(t,r)}_createDeltaQuantizedExtrudedGeometry(e,t){return"esriGeometryPolyline"===this.geometryType?this._createDeltaQuantizedExtrudedLine(e,t):this._createDeltaQuantizedExtrudedQuad(e,t)}_createDeltaQuantizedExtrudedQuad(e,t){return new p([5],[e-1,t,1,-1,1,1,-1,1,-1,-1])}_createDeltaQuantizedExtrudedLine(e,t){return new p([2],[e-1,t+1,1,-1])}}export{O as FeatureSetReader};
|
|
2
|
+
import{ArcadeDate as e}from"../../../../../arcade/ArcadeDate.js";import has from"../../../../../core/has.js";import{estimateNumberArrayMemory as t}from"../../../../../core/memoryEstimations.js";import{DateOnly as r}from"../../../../../core/sql/DateOnly.js";import{TimeOnly as s}from"../../../../../core/sql/TimeOnly.js";import{GeometryCursor as i}from"../../../../../geometry/GeometryCursor.js";import{fromRectValues as o}from"../../../../../geometry/support/aaBoundingBox.js";import{fromJSON as a}from"../../../../../geometry/support/jsonUtils.js";import{getLabelPoint as n}from"../../../../../geometry/support/labelPoint.js";import{quantizeX as d,quantizeY as u}from"../../../../../geometry/support/quantizationUtils.js";import{getCentroidOptimizedGeometry as c}from"../../../../../layers/graphics/centroid.js";import{convertToGeometry as h,generalizeOptimizedGeometry as l,quantizeOptimizedGeometry as m,unquantizeOptimizedGeometryInPlace as y}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as f}from"../../../../../layers/graphics/OptimizedFeature.js";import p from"../../../../../layers/graphics/OptimizedGeometry.js";import{system as g,unknown as _}from"../../../../../time/constants.js";import{FeatureSetCache as b}from"./FeatureSetCache.js";const x=has("featurelayer-simplify-thresholds")??[.5,.5,.5,.5],D=x[0],T=x[1],F=x[2],I=x[3],A=has("featurelayer-simplify-payload-size-factors")??[1,2,4],S=A[0],B=A[1],j=A[2],G=has("featurelayer-simplify-mobile-factor")??2,C=has("esri-mobile"),M=4294967295;function v(e,t,r){if(!(e.length>t))for(;e.length<=t;)e.push(r)}class O{constructor(e){this.metadata=e,this.type="FeatureSetReader",this._overrides=null,this._postQueryFilteredIds=new Set,this._joined=[],this._objectIdToIndex=null,this._boundsBuffer=[],this._caches=new Map,this.arcadeDeclaredClass="esri.arcade.Feature",this._contextTimeZone=null}destroy(){}[Symbol.dispose](){this.destroy()}getAreaSimplificationThreshold(e,t){let r=1;const s=C?G:1;t>4e6?r=j*s:t>1e6?r=B*s:t>5e5?r=S*s:t>1e5&&(r=s);let i=0;return e>4e3?i=I*r:e>2e3?i=F*r:e>100?i=T:e>15&&(i=D),i}getBounds(e){v(this._boundsBuffer,4*this.getIndex()+4,0);const t=this.getBoundsXMin();if(t===M||!isFinite(t))return!1;if(0===this.getBoundsXMin()){const t=this.readGeometryWorldSpace();if(t?.isPoint&&0===t.coords[0]&&0===t.coords[1])return o(e,0,0,0,0),!0;if(!t)return this.setBoundsXMin(M),!1;let r=1/0,s=1/0,i=-1/0,a=-1/0;return t.forEachVertex((e,t)=>{r=Math.min(r,e),s=Math.min(s,t),i=Math.max(i,e),a=Math.max(a,t)}),this.setBoundsXMin(r),this.setBoundsYMin(s),this.setBoundsXMax(i),this.setBoundsYMax(a),o(e,r,s,i,a),!0}const r=this.getBoundsXMin(),s=this.getBoundsYMin(),i=this.getBoundsXMax(),a=this.getBoundsYMax();return o(e,r,s,i,a),!0}getBoundsXMin(){return this._boundsBuffer[4*this.getIndex()]}setBoundsXMin(e){this._boundsBuffer[4*this.getIndex()]=e}getBoundsYMin(){return this._boundsBuffer[4*this.getIndex()+1]}setBoundsYMin(e){this._boundsBuffer[4*this.getIndex()+1]=e}getBoundsXMax(){return this._boundsBuffer[4*this.getIndex()+2]}setBoundsXMax(e){this._boundsBuffer[4*this.getIndex()+2]=e}getBoundsYMax(){return this._boundsBuffer[4*this.getIndex()+3]}setBoundsYMax(e){this._boundsBuffer[4*this.getIndex()+3]=e}readAttributeAsTimestamp(e){const t=this.readAttribute(e);return"string"==typeof t?new Date(t).getTime():"number"==typeof t||null==t?t:null}readAttribute(e,t=!1){const r=this._readAttribute(e,t);if(void 0!==r)return r;for(const s of this._joined){s.setIndex(this.getIndex());const r=s._readAttribute(e,t);if(void 0!==r)return r}}readAttributes(){const e=this._readAttributes();for(const t of this._joined){t.setIndex(this.getIndex());const r=t._readAttributes();for(const t of Object.keys(r))e[t]=r[t]}return e}joinAttributes(e){this._joined.push(e)}registerOverrides(e){this._overrides=e}withoutOverrides(){const e=this.copy();return e._overrides=null,e}readOptimizedFeatureWorldSpace(){const e=this.readGeometryWorldSpace(),t=this.readAttributes(),r=this.readCentroidWorldSpace();return new f(e,t,r,this.getObjectId(),this.getDisplayId())}readLegacyFeatureForDisplay(){const e=this.readCentroidForDisplay();return{attributes:this.readAttributes(),geometry:this.readLegacyGeometryForDisplay(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyFeatureWorldSpace(){const e=this.readCentroidWorldSpace();return{attributes:this.readAttributes(),geometry:this._readLegacyGeometryWorldSpace(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyGeometryForDisplay(){const e=this.readGeometryForDisplay();return h(e,this.geometryType,!1,!1)}readXForDisplay(){return this._readX()}readYForDisplay(){return this._readY()}readXWorldSpace(){const e=this._readX(),t=this.getInTransform();return null==t?e:e*t.scale[0]+t.translate[0]}readYWorldSpace(){const e=this._readY(),t=this.getInTransform();return null==t?e:t.translate[1]-e*t.scale[1]}readGeometryForDisplay(){const e=this._readGeometryDeltaDecoded(!0);if(!e){const e=this._createDeltaQuantizedGeometryFromServerCentroid();return e?e.deltaDecode():null}return e}readGeometryForDisplayTransformed(e){let t=this.readGeometryForDisplay();if(t&&"esriGeometryPolyline"===this.metadata.geometryType&&(t=l(t,this.metadata.geometryType,e.scale[0])),t&&(t=m(t,this.metadata.geometryType,e,t.hasZ,t.hasM,!0)),!t){const t=this.readCentroidForDisplay();if(!t)return null;const r=d(e,t.coords[0]),s=u(e,t.coords[1]);return this._createDeltaQuantizedExtrudedGeometry(r,s).deltaDecode()}return t}readGeometryWorldSpace(){let e=this._readGeometry();if(e||(e=this._createDeltaQuantizedGeometryFromServerCentroid()),!e)return null;const t=e.clone(),r=this.getInTransform();return null!=r&&y(t,r),t}readCentroidForDisplay(){const e=this.readGeometryForDisplay();return e?this._computeDisplayCentroid(e):this._readServerCentroid()}readCentroidWorldSpace(){const e=this.readGeometryForDisplay(),t=e?this._computeDisplayCentroid(e):this._readServerCentroid();if(!t)return null;const r=t.clone(),s=this.getInTransform();return null!=s&&y(r,s),r}setCache(e){let t=this._caches.get(e);null==t&&(t=new b(this.getSize()),this._caches.set(e,t)),this._activeCache=t}setCachedValue(e){this._activeCache.set(this.getIndex(),e)}hasCachedValue(){return this._activeCache.has(this.getIndex())}getCachedValue(){return this._activeCache.get(this.getIndex())}get underlyingMemory(){let e=0;e+=t(this._boundsBuffer);for(const t of this._caches.values())e+=t.usedMemory;return e}_readGeometryDeltaDecoded(e){const t=this._readGeometry(e);if("esriGeometryPoint"===this.geometryType||!t)return t;const r=this.getInTransform();if(!t||!r)return t;const s=r.scale[2]??1,i=r.translate[2]??0,o=r.scale[3]??1,a=r.translate[3]??0,{hasZ:n,hasM:d,stride:u,size:c,coords:h}=t,l=n&&(1!==s||0!==i),m=d&&(1!==o||0!==a);if(l||m){const e=2,t=n?3:2;for(let r=0,n=u*c;r<n;r+=u)l&&(h[r+e]=s*h[r+e]+i),m&&(h[r+t]=o*h[r+t]+a)}return t.deltaDecode()}get contextTimeZone(){return this._contextTimeZone}set contextTimeZone(e){this._contextTimeZone=e}readArcadeFeature(){return this}hasField(e){return this.fields.has(e)||this._joined.some(t=>t.hasField(e))}geometry(){const e=this.readGeometryWorldSpace(),t=h(e,this.geometryType,this.hasZ,this.hasM),r=a(t);if(r){if(!this.metadata.outSpatialReference)throw new Error("InternalError: Expected spatial reference to be defined");r.spatialReference=this.metadata.outSpatialReference}return r}autocastArcadeDate(t,r){return r&&r instanceof Date?this.isUnknownDateTimeField(t)?e.unknownDateJSToArcadeDate(r):e.dateJSAndZoneToArcadeDate(r,this.contextTimeZone??g):r}isUnknownDateTimeField(e){return this.metadata.fieldsIndex.getTimeZone(e)===_}field(t){let i=this.fields.get(t);if(i)switch(i.type){case"date-only":case"esriFieldTypeDateOnly":return r.fromReader(this.readAttribute(t,!1));case"time-only":case"esriFieldTypeTimeOnly":return s.fromReader(this.readAttribute(t,!1));case"esriFieldTypeTimestampOffset":case"timestamp-offset":return e.fromReaderAsTimeStampOffset(this.readAttribute(t,!1));case"date":case"esriFieldTypeDate":return this.autocastArcadeDate(t,this.readAttribute(t,!0));default:return this.readAttribute(t,!1)}for(const o of this._joined)if(o.setIndex(this.getIndex()),i=o.fields.get(t),i)switch(i.type){case"date-only":case"esriFieldTypeDateOnly":return r.fromReader(o._readAttribute(t,!1));case"time-only":case"esriFieldTypeTimeOnly":return s.fromReader(o._readAttribute(t,!1));case"esriFieldTypeTimestampOffset":case"timestamp-offset":return e.fromReaderAsTimeStampOffset(o._readAttribute(t,!1));case"date":case"esriFieldTypeDate":return this.autocastArcadeDate(t,o._readAttribute(t,!0));default:return this.readAttribute(t,!1)}throw new Error(`Field ${t} does not exist`)}setField(e,t){throw new Error("Unable to update feature attribute values, feature is readonly")}keys(){return this.fields.fields.map(e=>e.name)}isEmpty(){return this.fields.fields.length<=0&&null==this.geometry()}castToText(e=!1){if(!e)return JSON.stringify(this.readLegacyFeatureForDisplay());const t=this.readLegacyFeatureForDisplay();if(!t)return JSON.stringify(null);const r={geometry:t.geometry,attributes:{...t.attributes}};for(const s in r.attributes){const e=r.attributes[s];e instanceof Date&&(r.attributes[s]=e.getTime())}return JSON.stringify(r)}gdbVersion(){return null}fullSchema(){return this.metadata.arcadeSchema}castAsJson(e=null){return{attributes:this._readAttributes(),geometry:!0===e?.keepGeometryType?this.geometry():this.geometry()?.toJSON()??null}}castAsJsonAsync(e=null,t=null){return Promise.resolve(this.castAsJson(t))}applyPostQueryFilter(e){if(this._postQueryFilteredIds.clear(),!e)return;const t=this.getCursor();for(;t.next();){e.check(t,{currentUser:null})||this._postQueryFilteredIds.add(t.getObjectId())}}_getExists(){if(this._overrides){const e=this.getObjectId();return!this._overrides.hasOverride(e)}return!this._postQueryFilteredIds.has(this.getObjectId())}_computeDisplayCentroid(e){if(null==this.getInTransform())return c(e);const t=i.fromOptimized(e,this.geometryType);t.yFactor*=-1;const r=n(t);return r?isNaN(r[0])||isNaN(r[1])?c(e):(r[1]*=-1,new p([],r)):null}copyInto(e){e._joined=this._joined,e._overrides=this._overrides,e._objectIdToIndex=this._objectIdToIndex,e._boundsBuffer=this._boundsBuffer,e._activeCache=this._activeCache,e._caches=this._caches,e._contextTimeZone=this._contextTimeZone,e._postQueryFilteredIds=this._postQueryFilteredIds}_readLegacyGeometryWorldSpace(){const e=this.readGeometryWorldSpace();return h(e,this.geometryType,!1,!1)}_createDeltaQuantizedGeometryFromServerCentroid(){const e=this._readServerCentroid();if(!e)return null;const[t,r]=e.coords;return this._createDeltaQuantizedExtrudedGeometry(t,r)}_createDeltaQuantizedExtrudedGeometry(e,t){return"esriGeometryPolyline"===this.geometryType?this._createDeltaQuantizedExtrudedLine(e,t):this._createDeltaQuantizedExtrudedQuad(e,t)}_createDeltaQuantizedExtrudedQuad(e,t){return new p([5],[e-1,t,1,-1,1,1,-1,1,-1,-1])}_createDeltaQuantizedExtrudedLine(e,t){return new p([2],[e-1,t+1,1,-1])}}export{O as FeatureSetReader};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{isSome as s}from"../../../../core/arrayUtils.js";import has from"../../../../core/has.js";import{IdentifiableMixin as r}from"../../../../core/Identifiable.js";import{assertIsSome as i}from"../../../../core/maybe.js";import{ignoreAbortErrors as o,throwIfAborted as a}from"../../../../core/promiseUtils.js";import{watch as n}from"../../../../core/reactiveUtils.js";import{property as h,subclass as d}from"../../../../core/accessorSupport/decorators.js";import{create as c}from"../../../../geometry/support/aaBoundingRect.js";import{isPolyline as l,isPolygon as p,isExtent as u,getJsonType as m}from"../../../../geometry/support/jsonTypeUtils.js";import g from"../../../../layers/support/FieldsIndex.js";import{symbolToCIM as f,CIMSymbolHelper as y}from"../../../../symbols/cim/CIMSymbolHelper.js";import{OverrideHelper as _}from"../../../../symbols/cim/OverrideHelper.js";import{errorPointSymbol2D as b,errorPolylineSymbol2D as w,errorPolygonSymbol2D as S}from"../../../../symbols/support/defaults.js";import{filterFlag0 as I}from"../../engine/webgl/definitions.js";import{FeatureTile as v}from"../../engine/webgl/FeatureTile.js";import{MeshData as T}from"../../engine/webgl/mesh/MeshData.js";import{ResourceProxy as M}from"../../engine/webgl/mesh/factories/ResourceProxy.js";import{createGraphicSymbolMeshSchemas as R}from"../../engine/webgl/shaderGraph/techniques/createGraphicSymbolMeshSchemas.js";import{createStorageSchema as j}from"../features/schema/processor/StorageSchema.js";import{AttributeStore as U}from"../features/support/AttributeStore.js";import{ComputedAttributeStorage as x}from"../features/support/ComputedAttributeStorage.js";import{GraphicsMetadata as C}from"../features/support/FeatureMetadata.js";import{GraphicsReader as q}from"../features/support/GraphicsReader.js";import G from"./GraphicStore.js";import{FeatureCommandQueue as k}from"../support/FeatureCommandQueue.js";import{UpdateTracking2D as F}from"../support/UpdateTracking2D.js";class P{static getOrCreate(e,t,s){let r=t.get(e.id);return r||(r=new P(e,s),t.set(e.id,r)),r}static fromItems(e,t,s){const r=new P(e,s);for(const i of t)r.append(i);return r}constructor(e,t){this.tile=e,this.metadata=t,this.addedOrModified=[],this.removed=[],this.objectIdMap=null}get reader(){return this._reader||(this._reader=q.from(this.addedOrModified,this.tile,this.metadata)),this._reader}append(e){this.addedOrModified.push(e),e.hasAnimations&&(this.objectIdMap=this.objectIdMap||{},this.objectIdMap[e.displayId]=e.objectId)}}let A=class extends(r(t)){constructor(e){super(e),this._attached=!1,this._tiles=new Map,this._controller=new AbortController,this._hashToSymbolInfo=new Map,this._lastCleanup=performance.now(),this._cleanupRequired=!0,this.lastUpdateId=-1,this.renderer=null,this._updateTracking=new F({debugName:"GraphicsView2D"}),this.updateRequested=!1,this.defaultPointSymbolEnabled=!0,this._commandQueue=new k({process:e=>{if("update"===e.type)return this._update();throw new Error("InternalError: Unsupported command")}}),this.graphicUpdateHandler=this.graphicUpdateHandler.bind(this)}destroy(){this.container.destroy(),this.view=null,this.renderer=null,this._set("graphics",null),this._controller.abort(),this._graphicStore.clear(),this._graphicStore.destroy(),this._attributeStore=null,this._hashToSymbolInfo.clear(),this._updateTracking.destroy(),this._commandQueue.destroy()}_initAttributeStore(){this._storage=new x({spatialReference:this.view.spatialReference,fields:new g}),this._attributeStore=new U({isLocal:!0,update:e=>{has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView2D.AttributeStoreView.updateStart`,{message:e}),this.container.attributeView.requestUpdate(e),this.container.requestRender(),has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView2D.AttributeStoreView.updateEnd`,{message:e})}});const e=j(null,[]);this._attributeStore.update(e,this._storage,null),this.container.checkHighlight=()=>this._attributeStore.hasHighlight}initialize(){this._initAttributeStore(),this._metadata=C.createGraphics(this.view.spatialReference),this._resourceProxy=new M({fetch:e=>Promise.all(e.map(e=>this.view.stage.textureManager.rasterizeItem(e))),fetchDictionary:e=>{throw new Error("InternalError: Graphics do not support Dictionary requests")}}),this.addHandles([n(()=>this._effectiveRenderer,()=>this._pushUpdate()),this.view.graphicsTileStore.on("update",this._onTileUpdate.bind(this)),this.container.on("attach",()=>{this.addHandles([this.graphics.on("change",()=>this._pushUpdate())]),this._graphicStore?.destroy(),this._graphicStore=new G(this.view.spatialReference,this._cimResourceManager,this.view.featuresTilingScheme,this.view.state.scale,this._attributeStore),this._attached=!0,this.requestUpdate(),this._pushUpdate()})]),this._updateTracking.addUpdateTracking("CommandQueue",this._commandQueue.updateTracking);const e=this.view.graphicsTileStore.tiles;this._onTileUpdate({added:e,removed:[]})}get _effectiveRenderer(){return"function"==typeof this.renderer?this.renderer():this.renderer}get _cimResourceManager(){return this.view.stage.textureManager.resourceManager}get updating(){const e=!this._attached||this._updateTracking.updating;return has("esri-2d-log-updating")&&console.log(`Updating GraphicsView2D: ${e}\n -> attaching ${!this._attached}\n -> updateTracking ${this._updateTracking.updating}`),e}hitTest(e,t){if(!this.view||this.view.suspended)return[];const{resolution:r,rotation:i}=this.view.state,o=this._graphicStore.hitTest(e,t,r,i),a=new Set(o),n=this.graphics.items.reduce((e,t)=>(a.has(t.uid)&&e.set(t.uid,t),e),new Map);return o.map(e=>n.get(e)).filter(s)}requestUpdate(){this.updateRequested||(this.updateRequested=!0,this.requestUpdateCallback()),this.notifyChange("updating")}processUpdate(e){this.updateRequested&&(this.updateRequested=!1,this.update(e))}viewChange(){this.requestUpdate()}setHighlight(e){const t=[];for(const{objectId:s,highlightFlags:r}of e){const e=this._graphicStore.getItem(s)?.displayId;t.push({objectId:s,highlightFlags:r,displayId:e})}this._attributeStore.setHighlight(t,e),this._pushUpdate()}graphicUpdateHandler(e){this._pushUpdate()}update(e){this.updateRequested=!1,this._attached&&this._graphicStore.updateLevel(e.state.resolution)&&this.pushUpdate()}pushUpdate(){this._pushUpdate()}_pushUpdate(){o(this._commandQueue.push({type:"update"}))}async _update(){try{if(has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView._update start`),this.graphics.destroyed)return;const e=await this._graphicStore.update(this.graphics,e=>this._getSymbolForGraphic(e),e=>this._ensureSymbolResource(e));for(const s of e.updated)this.container.restartAnimation(s.objectId);if(!e.hasAnyUpdate())return void this._attributeStore.sendUpdates();e.removed.length&&(this._cleanupRequired=!0),has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView updateMessage`,e);const t=this._createTileMessages(e);await this._densifyItemsForDisplay(t),await this._fetchResources(t),this._write(t);for(const s of e.added)this._setFilterState(s);for(const s of e.updated)this._setFilterState(s);has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView sendUpdate`,e),this._attributeStore.sendUpdates(),has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView sendUpdate.await`,e)}catch(e){}this._cleanupSharedResources()}_createTileMessages(e){const t=new Map;for(const s of e.added){const e=this.view.graphicsTileStore.getIntersectingTiles(s.symbolBounds);for(const r of e){P.getOrCreate(r,t,this._metadata).append(s)}}for(const s of e.updated){const e=this.view.graphicsTileStore.getIntersectingTiles(s.prevSymbolBounds),r=this.view.graphicsTileStore.getIntersectingTiles(s.symbolBounds);for(const i of e){P.getOrCreate(i,t,this._metadata).removed.push(s.displayId)}for(const i of r){P.getOrCreate(i,t,this._metadata).append(s)}}for(const s of e.removed){const e=this.view.graphicsTileStore.getIntersectingTiles(s.symbolBounds);for(const r of e){P.getOrCreate(r,t,this._metadata).removed.push(s.displayId)}}return Array.from(t.values())}async _densifyItemsForDisplay(e){const t=new Map;for(const s of e)for(const e of s.addedOrModified)t.has(e)||t.set(e,e.densifyCurvedGeometryForDisplay(this.view.spatialReference));await Promise.all(t.values())}async _fetchResources(e){const t={timeZone:null,timeExtent:null};for(const{tile:s,reader:r}of e){has("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${s.id}] GraphicsView fetchResources`,e);const i=r.getCursor();for(;i.next();)for(const e of i.getMeshWriters())e.enqueueRequest(this._resourceProxy,i,s.createArcadeEvaluationOptions(t))}await this._resourceProxy.fetchEnqueuedResources()}_write(e){for(const t of e){has("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${t.tile.id}] GraphicsView write`,t);const e=this._writeMeshes(t);let s=this._tiles.get(t.tile.key);s||(s=this._createFeatureTile(t.tile.key)),has("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${t.tile.id}] GraphicsView onTileData`,t),this.container.onTileData(s,{type:"update",modify:e,remove:t.removed,end:!1,attributeEpoch:this._attributeStore.epoch,objectIdMap:t.objectIdMap}),this.container.requestRender()}}_writeMeshes(e){const t={timeZone:null,timeExtent:null},s=new T(e.tile.id),r=e.reader.getCursor();for(;r.next();){s.entityStart(r.getDisplayId(),r.getZOrder());for(const i of r.getMeshWriters())i.write(s,this._resourceProxy,r,e.tile.createArcadeEvaluationOptions(t),e.tile.level);s.entityEnd()}return{...s.serialize().message,tileId:e.tile.id,requiresRefresh:!1}}_setFilterState(e){const t=e.displayId,s=this._attributeStore.getHighlightFlags(e.objectId);this._attributeStore.setData(t,0,0,s|(e.visible?I:0))}_getSymbolForGraphic(e){return null!=e.symbol?e.symbol:null!=this._effectiveRenderer?this._effectiveRenderer.getSymbol(e):this._getNullSymbol(e)}async _ensureSymbolResource(e){if(!e.symbol)return;const t=await this._getSymbolInfo(e.symbol);if(!t)return;const s=t.linearCIM.filter(e=>"text"===e.type);if(s.length>0){const r=await this._getTextResources(e,s);return void(e.symbolResource={symbolInfo:t,textInfo:r})}e.symbolResource={symbolInfo:t}}_getSymbolInfo(e){const t=e.hash();return this._hashToSymbolInfo.has(t)||this._hashToSymbolInfo.set(t,this._createSymbolInfo(t,e).catch(e=>null)),this._hashToSymbolInfo.get(t)}async _createSymbolInfo(e,t){const s=await this._convertToCIMSymbol(t),r=await this._createLinearCIM(s);return{hash:e,cimSymbol:s,linearCIM:r,meshWriters:await this._createMeshWriters(s,r)}}async _convertToCIMSymbol(e){const t=f(e);return"web-style"===t.type?this._convertToCIMSymbol(await t.fetchSymbol({acceptedFormats:["cim","web"]})):t}async _createLinearCIM(e){return await y.normalizeSymbolAndFetchResources(e.symbol,this._cimResourceManager),this.view.stage.cimAnalyzer.analyzeSymbolReference(e,!1)}async _createMeshWriters(e,t){a(this._controller.signal);const s=this.container.instanceStore,r=this.view.stage.meshWriterRegistry,i=await R(e,t,s);return Promise.all(i.map(e=>r.createMeshWriter(this._storage,this._resourceProxy,{tileInfo:this.view.featuresTilingScheme.tileInfo},e,null)))}_onTileUpdate(e){if(e.added&&e.added.length>0)for(const t of e.added)this._updateTracking.consumePromise(this._addTile(t));if(e.removed&&e.removed.length>0)for(const t of e.removed)this._removeTile(t.key)}_createFeatureTile(e){const t=this.view.featuresTilingScheme.getTileBounds(c(),e),s=this.view.featuresTilingScheme.getTileResolution(e.level),r=new v(e,s,t[0],t[3]);return r.presenting=!0,this._tiles.set(e,r),this.container.addChild(r),r}async _addTile(e){if(!this._attached)return;const t=this._graphicStore.queryItems(e);if(!t.length)return;const s=this._createFeatureTile(e.key),r=P.fromItems(e,t,this._metadata);await this._densifyItemsForDisplay([r]),await this._fetchResources([r]);const i=this._writeMeshes(r);s.update({type:"append",append:i,end:!0,attributeEpoch:this._attributeStore.epoch,objectIdMap:r.objectIdMap})}_removeTile(e){if(!this._tiles.has(e))return;const t=this._tiles.get(e);this.container.removeChild(t),t.destroy(),this._tiles.delete(e)}_getNullSymbol(e){const t=e.geometry;return t?l(t)?w:p(t)||u(t)?S:this.defaultPointSymbolEnabled?b:null:this.defaultPointSymbolEnabled?b:null}async _getTextResources(e,t){const s=new Array,r=new Array;for(let i=0;i<t.length;i++){const o=t[i],{resource:a,overrides:n}=o.textRasterizationParam;if(n?.length>0){const t=_.resolveSymbolOverrides({type:"CIMSymbolReference",primitiveOverrides:n,symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,size:a.symbol.height,anchorPointUnits:"Relative",frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{x:0,y:0},symbol:a.symbol,textString:a.textString}],scaleSymbolsProportionally:!0,respectFrame:!0}]}},e,this.view.spatialReference,null,m(e.projectedGeometry),null,null);t.then(e=>{const t=e.symbolLayers[0],{textString:s}=t.markerGraphics[0];r.push({type:"cim-rasterization-info",resource:{type:"text",textString:s||"",font:a.font}}),o.text=a.textString=s||""}),s.push(t)}else r.push({type:"cim-rasterization-info",resource:a})}s.length>0&&await Promise.all(s);const o=r.map(e=>this.view.stage.textureManager.rasterizeItem(e)),a=await Promise.all(o);i(a);const n=new Map;for(let i=0;i<t.length;i++){const e=t[i];n.set(e.textRasterizationParam.resource.symbol,{text:e.text,glyphMosaicItems:a[i]})}return n}_cleanupSharedResources(){if(!this._cleanupRequired)return;const e=performance.now();if(e-this._lastCleanup<5e3)return;this._cleanupRequired=!1,this._lastCleanup=e;const t=new Set;for(const r of this._graphicStore.items()){const e=r.symbolResource?.symbolInfo.hash;t.add(e)}const s=new Set(this._hashToSymbolInfo.keys());for(const r of s.values())t.has(r)||this._hashToSymbolInfo.delete(r)}};e([h()],A.prototype,"_effectiveRenderer",null),e([h({constructOnly:!0})],A.prototype,"layerId",void 0),e([h({constructOnly:!0})],A.prototype,"requestUpdateCallback",void 0),e([h()],A.prototype,"container",void 0),e([h({constructOnly:!0})],A.prototype,"graphics",void 0),e([h()],A.prototype,"renderer",void 0),e([h()],A.prototype,"_updateTracking",void 0),e([h()],A.prototype,"updating",null),e([h()],A.prototype,"view",void 0),e([h()],A.prototype,"updateRequested",void 0),e([h()],A.prototype,"defaultPointSymbolEnabled",void 0),A=e([d("esri.views.2d.layers.graphics.GraphicsView2D")],A);export{A as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{isSome as s}from"../../../../core/arrayUtils.js";import has from"../../../../core/has.js";import{IdentifiableMixin as r}from"../../../../core/Identifiable.js";import{assertIsSome as i}from"../../../../core/maybe.js";import{ignoreAbortErrors as o,throwIfAborted as a}from"../../../../core/promiseUtils.js";import{watch as n}from"../../../../core/reactiveUtils.js";import{property as h,subclass as d}from"../../../../core/accessorSupport/decorators.js";import{create as c}from"../../../../geometry/support/aaBoundingRect.js";import{isPolyline as l,isPolygon as p,isExtent as u,getJsonType as m}from"../../../../geometry/support/jsonTypeUtils.js";import g from"../../../../layers/support/FieldsIndex.js";import{symbolToCIM as f,CIMSymbolHelper as y}from"../../../../symbols/cim/CIMSymbolHelper.js";import{OverrideHelper as _}from"../../../../symbols/cim/OverrideHelper.js";import{errorPointSymbol2D as b,errorPolylineSymbol2D as w,errorPolygonSymbol2D as S}from"../../../../symbols/support/defaults.js";import{filterFlag0 as I}from"../../engine/webgl/definitions.js";import{FeatureTile as v}from"../../engine/webgl/FeatureTile.js";import{MeshData as T}from"../../engine/webgl/mesh/MeshData.js";import{ResourceProxy as M}from"../../engine/webgl/mesh/factories/ResourceProxy.js";import{createGraphicSymbolMeshSchemas as R}from"../../engine/webgl/shaderGraph/techniques/createGraphicSymbolMeshSchemas.js";import{createStorageSchema as j}from"../features/schema/processor/StorageSchema.js";import{AttributeStore as x}from"../features/support/AttributeStore.js";import{ComputedAttributeStorage as U}from"../features/support/ComputedAttributeStorage.js";import{GraphicsMetadata as C}from"../features/support/FeatureMetadata.js";import{GraphicsReader as q}from"../features/support/GraphicsReader.js";import G from"./GraphicStore.js";import{FeatureCommandQueue as F}from"../support/FeatureCommandQueue.js";import{UpdateTracking2D as k}from"../support/UpdateTracking2D.js";class P{static getOrCreate(e,t,s){let r=t.get(e.id);return r||(r=new P(e,s),t.set(e.id,r)),r}static fromItems(e,t,s){const r=new P(e,s);for(const i of t)r.append(i);return r}constructor(e,t){this.tile=e,this.metadata=t,this.addedOrModified=[],this.removed=[],this.objectIdMap=null}get reader(){return this._reader||(this._reader=q.from(this.addedOrModified,this.tile,this.metadata)),this._reader}append(e){this.addedOrModified.push(e),e.hasAnimations&&(this.objectIdMap=this.objectIdMap||{},this.objectIdMap[e.displayId]=e.objectId)}}let A=class extends(r(t)){constructor(e){super(e),this._attached=!1,this._tiles=new Map,this._controller=new AbortController,this._hashToSymbolInfo=new Map,this._lastCleanup=performance.now(),this._cleanupRequired=!0,this.lastUpdateId=-1,this.renderer=null,this._updateTracking=new k({debugName:"GraphicsView2D"}),this.updateRequested=!1,this.defaultPointSymbolEnabled=!0,this._commandQueue=new F({process:e=>{if("update"===e.type)return this._update();throw new Error("InternalError: Unsupported command")}}),this.graphicUpdateHandler=this.graphicUpdateHandler.bind(this)}destroy(){this.container.destroy(),this.view=null,this.renderer=null,this._set("graphics",null),this._controller.abort(),this._graphicStore.clear(),this._graphicStore.destroy(),this._attributeStore=null,this._hashToSymbolInfo.clear(),this._updateTracking.destroy(),this._commandQueue.destroy()}_initAttributeStore(){this._storage=new U({spatialReference:this.view.spatialReference,fields:new g}),this._attributeStore=new x({isLocal:!0,update:e=>{has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView2D.AttributeStoreView.updateStart`,{message:e}),this.container.attributeView.requestUpdate(e),this.container.requestRender(),has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView2D.AttributeStoreView.updateEnd`,{message:e})}});const e=j(null,[]);this._attributeStore.update(e,this._storage,null),this.container.checkHighlight=()=>this._attributeStore.hasHighlight}initialize(){this._initAttributeStore(),this._metadata=C.createGraphics(this.view.spatialReference),this._resourceProxy=new M({fetch:e=>Promise.all(e.map(e=>this.view.stage.textureManager.rasterizeItem(e))),fetchDictionary:e=>{throw new Error("InternalError: Graphics do not support Dictionary requests")}}),this.addHandles([n(()=>this._effectiveRenderer,()=>this._pushUpdate()),this.view.graphicsTileStore.on("update",this._onTileUpdate.bind(this)),this.container.on("attach",()=>{this.addHandles([this.graphics.on("change",()=>this._pushUpdate())]),this._graphicStore?.destroy(),this._graphicStore=new G(this.view.spatialReference,this._cimResourceManager,this.view.featuresTilingScheme,this.view.state.scale,this._attributeStore),this._attached=!0,this.requestUpdate(),this._pushUpdate()})]),this._updateTracking.addUpdateTracking("CommandQueue",this._commandQueue.updateTracking);const e=this.view.graphicsTileStore.tiles;this._onTileUpdate({added:e,removed:[]})}get _effectiveRenderer(){return"function"==typeof this.renderer?this.renderer():this.renderer}get _cimResourceManager(){return this.view.stage.textureManager.resourceManager}get updating(){return!this._attached||this._updateTracking.updating}hitTest(e,t){if(!this.view||this.view.suspended)return[];const{resolution:r,rotation:i}=this.view.state,o=this._graphicStore.hitTest(e,t,r,i),a=new Set(o),n=this.graphics.items.reduce((e,t)=>(a.has(t.uid)&&e.set(t.uid,t),e),new Map);return o.map(e=>n.get(e)).filter(s)}requestUpdate(){this.updateRequested||(this.updateRequested=!0,this.requestUpdateCallback()),this.notifyChange("updating")}processUpdate(e){this.updateRequested&&(this.updateRequested=!1,this.update(e))}viewChange(){this.requestUpdate()}setHighlight(e){const t=[];for(const{objectId:s,highlightFlags:r}of e){const e=this._graphicStore.getItem(s)?.displayId;t.push({objectId:s,highlightFlags:r,displayId:e})}this._attributeStore.setHighlight(t,e),this._pushUpdate()}graphicUpdateHandler(e){this._pushUpdate()}update(e){this.updateRequested=!1,this._attached&&this._graphicStore.updateLevel(e.state.resolution)&&this.pushUpdate()}pushUpdate(){this._pushUpdate()}_pushUpdate(){o(this._commandQueue.push({type:"update"}))}async _update(){try{if(has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView._update start`),this.graphics.destroyed)return;const e=await this._graphicStore.update(this.graphics,e=>this._getSymbolForGraphic(e),e=>this._ensureSymbolResource(e));for(const s of e.updated)this.container.restartAnimation(s.objectId);if(!e.hasAnyUpdate())return void this._attributeStore.sendUpdates();e.removed.length&&(this._cleanupRequired=!0),has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView updateMessage`,e);const t=this._createTileMessages(e);await this._densifyItemsForDisplay(t),await this._fetchResources(t),this._write(t);for(const s of e.added)this._setFilterState(s);for(const s of e.updated)this._setFilterState(s);has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView sendUpdate`,e),this._attributeStore.sendUpdates(),has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView sendUpdate.await`,e)}catch(e){}this._cleanupSharedResources()}_createTileMessages(e){const t=new Map;for(const s of e.added){const e=this.view.graphicsTileStore.getIntersectingTiles(s.symbolBounds);for(const r of e){P.getOrCreate(r,t,this._metadata).append(s)}}for(const s of e.updated){const e=this.view.graphicsTileStore.getIntersectingTiles(s.prevSymbolBounds),r=this.view.graphicsTileStore.getIntersectingTiles(s.symbolBounds);for(const i of e){P.getOrCreate(i,t,this._metadata).removed.push(s.displayId)}for(const i of r){P.getOrCreate(i,t,this._metadata).append(s)}}for(const s of e.removed){const e=this.view.graphicsTileStore.getIntersectingTiles(s.symbolBounds);for(const r of e){P.getOrCreate(r,t,this._metadata).removed.push(s.displayId)}}return Array.from(t.values())}async _densifyItemsForDisplay(e){const t=new Map;for(const s of e)for(const e of s.addedOrModified)t.has(e)||t.set(e,e.densifyCurvedGeometryForDisplay(this.view.spatialReference));await Promise.all(t.values())}async _fetchResources(e){const t={timeZone:null,timeExtent:null};for(const{tile:s,reader:r}of e){has("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${s.id}] GraphicsView fetchResources`,e);const i=r.getCursor();for(;i.next();)for(const e of i.getMeshWriters())e.enqueueRequest(this._resourceProxy,i,s.createArcadeEvaluationOptions(t))}await this._resourceProxy.fetchEnqueuedResources()}_write(e){for(const t of e){has("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${t.tile.id}] GraphicsView write`,t);const e=this._writeMeshes(t);let s=this._tiles.get(t.tile.key);s||(s=this._createFeatureTile(t.tile.key)),has("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${t.tile.id}] GraphicsView onTileData`,t),this.container.onTileData(s,{type:"update",modify:e,remove:t.removed,end:!1,attributeEpoch:this._attributeStore.epoch,objectIdMap:t.objectIdMap}),this.container.requestRender()}}_writeMeshes(e){const t={timeZone:null,timeExtent:null},s=new T(e.tile.id),r=e.reader.getCursor();for(;r.next();){s.entityStart(r.getDisplayId(),r.getZOrder());for(const i of r.getMeshWriters())i.write(s,this._resourceProxy,r,e.tile.createArcadeEvaluationOptions(t),e.tile.level);s.entityEnd()}return{...s.serialize().message,tileId:e.tile.id,requiresRefresh:!1}}_setFilterState(e){const t=e.displayId,s=this._attributeStore.getHighlightFlags(e.objectId);this._attributeStore.setData(t,0,0,s|(e.visible?I:0))}_getSymbolForGraphic(e){return null!=e.symbol?e.symbol:null!=this._effectiveRenderer?this._effectiveRenderer.getSymbol(e):this._getNullSymbol(e)}async _ensureSymbolResource(e){if(!e.symbol)return;const t=await this._getSymbolInfo(e.symbol);if(!t)return;const s=t.linearCIM.filter(e=>"text"===e.type);if(s.length>0){const r=await this._getTextResources(e,s);return void(e.symbolResource={symbolInfo:t,textInfo:r})}e.symbolResource={symbolInfo:t}}_getSymbolInfo(e){const t=e.hash();return this._hashToSymbolInfo.has(t)||this._hashToSymbolInfo.set(t,this._createSymbolInfo(t,e).catch(e=>null)),this._hashToSymbolInfo.get(t)}async _createSymbolInfo(e,t){const s=await this._convertToCIMSymbol(t),r=await this._createLinearCIM(s);return{hash:e,cimSymbol:s,linearCIM:r,meshWriters:await this._createMeshWriters(s,r)}}async _convertToCIMSymbol(e){const t=f(e);return"web-style"===t.type?this._convertToCIMSymbol(await t.fetchSymbol({acceptedFormats:["cim","web"]})):t}async _createLinearCIM(e){return await y.normalizeSymbolAndFetchResources(e.symbol,this._cimResourceManager),this.view.stage.cimAnalyzer.analyzeSymbolReference(e,!1)}async _createMeshWriters(e,t){a(this._controller.signal);const s=this.container.instanceStore,r=this.view.stage.meshWriterRegistry,i=await R(e,t,s);return Promise.all(i.map(e=>r.createMeshWriter(this._storage,this._resourceProxy,{tileInfo:this.view.featuresTilingScheme.tileInfo},e,null)))}_onTileUpdate(e){if(e.added&&e.added.length>0)for(const t of e.added)this._updateTracking.consumePromise(this._addTile(t));if(e.removed&&e.removed.length>0)for(const t of e.removed)this._removeTile(t.key)}_createFeatureTile(e){const t=this.view.featuresTilingScheme.getTileBounds(c(),e),s=this.view.featuresTilingScheme.getTileResolution(e.level),r=new v(e,s,t[0],t[3]);return r.presenting=!0,this._tiles.set(e,r),this.container.addChild(r),r}async _addTile(e){if(!this._attached)return;const t=this._graphicStore.queryItems(e);if(!t.length)return;const s=this._createFeatureTile(e.key),r=P.fromItems(e,t,this._metadata);await this._densifyItemsForDisplay([r]),await this._fetchResources([r]);const i=this._writeMeshes(r);s.update({type:"append",append:i,end:!0,attributeEpoch:this._attributeStore.epoch,objectIdMap:r.objectIdMap})}_removeTile(e){if(!this._tiles.has(e))return;const t=this._tiles.get(e);this.container.removeChild(t),t.destroy(),this._tiles.delete(e)}_getNullSymbol(e){const t=e.geometry;return t?l(t)?w:p(t)||u(t)?S:this.defaultPointSymbolEnabled?b:null:this.defaultPointSymbolEnabled?b:null}async _getTextResources(e,t){const s=new Array,r=new Array;for(let i=0;i<t.length;i++){const o=t[i],{resource:a,overrides:n}=o.textRasterizationParam;if(n?.length>0){const t=_.resolveSymbolOverrides({type:"CIMSymbolReference",primitiveOverrides:n,symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,size:a.symbol.height,anchorPointUnits:"Relative",frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{x:0,y:0},symbol:a.symbol,textString:a.textString}],scaleSymbolsProportionally:!0,respectFrame:!0}]}},e,this.view.spatialReference,null,m(e.projectedGeometry),null,null);t.then(e=>{const t=e.symbolLayers[0],{textString:s}=t.markerGraphics[0];r.push({type:"cim-rasterization-info",resource:{type:"text",textString:s||"",font:a.font}}),o.text=a.textString=s||""}),s.push(t)}else r.push({type:"cim-rasterization-info",resource:a})}s.length>0&&await Promise.all(s);const o=r.map(e=>this.view.stage.textureManager.rasterizeItem(e)),a=await Promise.all(o);i(a);const n=new Map;for(let i=0;i<t.length;i++){const e=t[i];n.set(e.textRasterizationParam.resource.symbol,{text:e.text,glyphMosaicItems:a[i]})}return n}_cleanupSharedResources(){if(!this._cleanupRequired)return;const e=performance.now();if(e-this._lastCleanup<5e3)return;this._cleanupRequired=!1,this._lastCleanup=e;const t=new Set;for(const r of this._graphicStore.items()){const e=r.symbolResource?.symbolInfo.hash;t.add(e)}const s=new Set(this._hashToSymbolInfo.keys());for(const r of s.values())t.has(r)||this._hashToSymbolInfo.delete(r)}};e([h()],A.prototype,"_effectiveRenderer",null),e([h({constructOnly:!0})],A.prototype,"layerId",void 0),e([h({constructOnly:!0})],A.prototype,"requestUpdateCallback",void 0),e([h()],A.prototype,"container",void 0),e([h({constructOnly:!0})],A.prototype,"graphics",void 0),e([h()],A.prototype,"renderer",void 0),e([h()],A.prototype,"_updateTracking",void 0),e([h()],A.prototype,"updating",null),e([h()],A.prototype,"view",void 0),e([h()],A.prototype,"updateRequested",void 0),e([h()],A.prototype,"defaultPointSymbolEnabled",void 0),A=e([d("esri.views.2d.layers.graphics.GraphicsView2D")],A);export{A as default};
|