@arcgis/core 4.29.1 → 4.29.3
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/7427d03e693f32a81377.js +1 -0
- package/assets/esri/core/workers/chunks/8a9387483b19a5ec5b86.js +1 -0
- package/geohash/geohashUtils.js +1 -1
- package/interfaces.d.ts +15 -9
- package/kernel.js +1 -1
- package/layers/graphics/data/StreamFeatureManager.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
- package/views/2d/engine/webgl/collisions/CollisionEngine.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/createTestMeshData.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/VectorTileLayerView2D.js +1 -1
- package/views/2d/layers/features/Processor.js +1 -1
- package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
- package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
- package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
- package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
- package/views/2d/layers/features/schema/processor/SimpleProcessorSchema.js +1 -1
- package/views/2d/layers/features/schema/processor/SubtypeProcessorSchema.js +1 -1
- package/views/2d/layers/features/sources/strategies/StreamLoadStrategy.js +1 -1
- package/views/2d/layers/features/support/FeatureMetadata.js +1 -1
- package/views/2d/layers/features/support/Tile.js +1 -1
- package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
- package/views/3d/webgl-engine/effects/RenderNodes.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Feature/support/arcadeFeatureUtils.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/Legend/LegendViewModel.js +1 -1
- package/widgets/Search/SearchViewModel.js +1 -1
- package/widgets/TableList.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
- package/widgets/VersionManagement/VersionManagementViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/58723274ef657fe212eb.js +0 -1
- package/assets/esri/core/workers/chunks/8c360923cd1850767d3e.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import"../../../geometry.js";import r from"../../../Graphic.js";import{isSome as s}from"../../../core/arrayUtils.js";import i from"../../../core/Collection.js";import{neverReached as a}from"../../../core/compilerUtils.js";import o from"../../../core/Error.js";import{makeHandle as n}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import u from"../../../core/Logger.js";import{destroyMaybe as l}from"../../../core/maybe.js";import{debounce as h,throwIfNotAbortError as c,isAbortError as p}from"../../../core/promiseUtils.js";import{watch as d,initial as y}from"../../../core/reactiveUtils.js";import{property as g}from"../../../core/accessorSupport/decorators/property.js";import{subclass as f}from"../../../core/accessorSupport/decorators/subclass.js";import{diff as m}from"../../../core/accessorSupport/diffUtils.js";import _ from"../../../layers/effects/FeatureEffectView.js";import w from"../../../layers/support/FeatureFilter.js";import{packFields as v}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as b}from"../../../layers/support/layerUtils.js";import S from"../../../rest/support/AggregateFeatureSet.js";import F from"../../../rest/support/FeatureSet.js";import A from"../../../rest/support/Query.js";import{getHighlightBits as E}from"../engine/highlightReasons.js";import{LayerView2DMixin as V}from"./LayerView2D.js";import{FeatureContainer as C}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as R}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as U}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as j}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as x}from"./features/layerAdapters/FeatureLayerAdapter.js";import{InMemoryLayerAdapter as q}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as Q}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as k}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as I}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{StreamLayerAdapter as O}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as L}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as H}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import D from"./support/FeatureCommandQueue.js";import{HighlightCounter as J}from"./support/HighlightCounter.js";import{FeatureTileSubscriptionManager as N}from"../tiling/FeatureTileSubscriptionManager.js";import T from"../../layers/FeatureLayerView.js";import M from"../../layers/LayerView.js";import $ from"../../layers/RefreshableLayerView.js";import G from"../../../geometry/Extent.js";function P(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 z="esri.views.2d.layers.FeatureLayerView2D",B=4294967294;async function K(e,t){try{return await e}catch(r){if("no-queryEngine"!==r.name)throw r;return t}}let Z=class extends(T($(V(M)))){constructor(){super(...arguments),this._commandsQueue=new D({process:e=>{switch(e.type){case"processed-edit":return this._doEdit(e);case"update":return this._doUpdate()}}}),this._visibilityOverrides=new Set,this._highlightCounter=new J,this._updateHighlight=h((async()=>{const e=[];for(const t of this._highlightCounter.ids()){const r=this._highlightCounter.getHighestReason(t),s=E(r);e.push({objectId:t,highlightFlags:s})}this._worker.pipeline.updateHighlight({highlights:e})})),this._lastAvailableFields=[],this.eventLog=new U,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._fields=null,this.featureEffectView=new _}destroy(){this._worker?.destroy(),this._commandsQueue.destroy()}initialize(){this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransitions()}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("mesh"===e.geometryType)throw new o("featurelayerview:geometry-type-not-supported",`Geometry type of ${e.geometryType} is not supported`,{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===b(e)?.operations.supportsQuery)throw new o("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._worker&&this._worker.destroy();const t=this._createClientOptions();this._worker=await R(t)}get hasAllFeatures(){return this.layer.visible&&this.eventLog.hasAllFeatures}get hasAllFeaturesInView(){return this.layer.visible&&this.eventLog.hasAllFeaturesInView}get hasFullGeometries(){return this.layer.visible&&this.eventLog.hasFullGeometries}get labelingCollisionInfos(){const e=this.layerAdapter.getLabelingDeconflictionInfo(this.view),t=this.layer.geometryType,r=!this.suspended;return e.map((({vvEvaluators:e,deconflictionEnabled:s})=>({container:this.featureContainer,vvEvaluators:e,deconflictionEnabled:s,geometryType:t,visible:r})))}get layerAdapter(){switch(this.layer.type){case"feature":return"memory"===this.layer.source.type?new q(this.layer):new x(this.layer);case"geojson":case"csv":case"wfs":return new q(this.layer);case"subtype-group":return new L(this.layer);case"ogc-feature":return new k(this.layer);case"stream":return new O(this.layer);case"oriented-imagery":return new I(this.layer);case"knowledge-graph-sublayer":return new Q(this.layer);case"catalog-footprint":return new j(this.layer);default:a(this.layer)}return null}get updateHash(){if(!this.layerAdapter)return null;const{availableFields:e,_displayRefreshVersion:t,timeExtent:r,clips:s,filter:i,featureEffect:a,_sourceRefreshVersion:o,view:{timeZone:n}}=this,u=JSON.stringify(s),l=a?.toJSON(),h=i?.toJSON();return JSON.stringify({availableFields:e,clipsHash:u,displayRefreshVersion:t,effectHash:l,filterHash:h,sourceRefreshVersion:o,timeExtent:r,timeZone:n,...this.layerAdapter.getUpdateHashProperties(this.view)})}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}async queryHeatmapStatistics(e){return this._worker.pipeline.queryHeatmapStatistics(e)}highlight(e,t="highlight"){let a;e instanceof r?a=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?a=[e]:i.isCollection(e)&&e.length>0?a=e.map((e=>e?.getObjectId())).toArray():Array.isArray(e)&&e.length>0&&(a="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())));const o=a?.filter(s);return o?.length?(this._addHighlight(o,t),n((()=>this._removeHighlight(o,t)))):n()}getHighlightIds(){return Array.from(this._highlightCounter.ids())}hasHighlight(){return!this._highlightCounter.empty}async hitTest(e,s){const i=await this.featureContainer.hitTest(s);if(0===i.length)return null;const{features:a,aggregates:o}=await this._worker.pipeline.getDisplayFeatures(i),n=this.featureContainer.getSortKeys(i),u=({displayId:e},{displayId:t})=>n.has(e)&&n.has(t)?n.get(e)-n.get(t):e-t;return a.sort(u).reverse(),o.sort(u).reverse(),[...o.map((r=>this._createGraphicHit(e,t.fromJSON(r)))),...a.map((t=>this._createGraphicHit(e,r.fromJSON(t))))]}queryStatistics(){return K(this._worker.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}querySummaryStatistics(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),s,r),{})}async queryAggregateSummaryStatistics(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),s,r),{})}async queryUniqueValues(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.features.executeQueryForUniqueValues(this._cleanUpQuery(e),s,r),{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),s,r),{uniqueValueInfos:[]})}async queryClassBreaks(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.features.executeQueryForClassBreaks(this._cleanUpQuery(e),s,r),{classBreakInfos:[]})}async queryAggregateClassBreaks(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),s,r),{classBreakInfos:[]})}async queryHistogram(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.features.executeQueryForHistogram(this._cleanUpQuery(e),s,r),{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateHistogram(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),s,r),{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=F.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}async queryVisibleFeatures(e,t){const r=this._worker.pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),s=await K(r,{features:[]}),i=F.fromJSON(s);return i.features.forEach((e=>this._setLayersForFeature(e))),i}async queryAggregates(e,t){const r=this._worker.aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),s=await K(r,{features:[]}),i=S.fromJSON(s);return i.features.forEach((e=>this._setLayersForFeature(e))),i}queryAggregateIds(e,t){return K(this._worker.aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t),[])}queryAggregateCount(e,t){return K(this._worker.aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t),0)}queryAggregateJSON(e,t){return K(this._worker.aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),{features:[]})}async queryFeaturesJSON(e,t){return K(this._worker.features.executeQuery(this._cleanUpQuery(e),t),{features:[]})}queryObjectIds(e,t){return K(this._worker.features.executeQueryForIds(this._cleanUpQuery(e),t),[])}queryFeatureCount(e,t){return K(this._worker.features.executeQueryForCount(this._cleanUpQuery(e),t),0)}async queryExtent(e,t){const r=this._worker.features.executeQueryForExtent(this._cleanUpQuery(e),t),s=await K(r,{count:0,extent:null});return{count:s.count,extent:G.fromJSON(s.extent)}}async getSampleFeatures(e){return this._worker.pipeline.getSampleFeatures(e)}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._subscriptionManager)return;const t=this._subscriptionManager.update(e);this.featureContainer.setVisibleTiles(t)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),this.featureContainer=new C(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptionManager=new N({tileInfoView:this.view.featuresTilingScheme,updateSubscriptions:e=>{this.featureContainer.updateSubscriptions(e),this._worker.pipeline.updateSubscriptions(e)},isDone:e=>this.featureContainer.isDone(e)}),this.requestUpdate(),this.addAttachHandles([d((()=>this.updateHash),(()=>this._update()),y),d((()=>this.updateSuspended),(e=>{e||this._subscriptionManager.resume()}))]),"stream"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",(e=>this._edit(e))))}detach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.detach"),this._fields=null,this.featureContainer.destroy(),this._commandsQueue.clear(),this.container.removeAllChildren(),this._subscriptionManager=l(this._subscriptionManager),this._worker.pipeline.onDetach()}moveStart(){this.requestUpdate()}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredFieldsPromise,s=this.featureContainer.updatingHandles.updating,i=e&&(t||r)||s||this._pipelineUpdating||this.dataUpdating;if(has("esri-2d-log-updating")){console.log(`Updating FLV2D (${this.layer.id}): ${i}\n -> hasRenderer ${e}\n -> updatingRequiredFields ${r}\n -> hasPendingCommand ${t}\n -> dataUpdating ${this.dataUpdating}\n -> processing ${this._pipelineUpdating}\n -> updatingContainer ${s}\n`);for(const e of this.featureContainer.subscriptions())console.log(` -> Tile[${e.id}] Done: ${e.done}`)}return i}_createClientOptions(){const e=this;return{get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("dataUpdating",e.data)},emitEvent:e=>{this.emit(e.name,e.event)},get eventLog(){return e.eventLog},fetch:t=>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 s={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 i=r.visualVariableUniforms,a=await t.getSymbolAsync(e.feature,{fields:this._fields});if(!a||!a.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await H(a.data,{uniforms:i,path:"renderer",schemaOptions:s})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=A.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=A.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const s of t.aggregateIds??[])r.push(s);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}async _edit(e){if(this.updateSuspended)return void this._subscriptionManager.suspend();return this._validateEdit(e)?this._commandsQueue.push({type:"edit",edits:e}).catch(c):void 0}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%B+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%B+1}_validateEdit(e){const t="globalIdField"in this.layer&&this.layer.globalIdField,r=e.deletedFeatures.some((e=>-1===e.objectId||!e.objectId)),s=t&&this.availableFields.includes(t);return r&&!s?(u.getLogger(this).error(new o("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected on the map`)),null):e}async _doUpdate(){"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 this._updateRequiredFields(),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this._subscriptionManager)return;const e=this.featureContainer.instanceStore;this.featureContainer.attributeView.lockTextureUploads(),e.updateStart();const t=this.featureEffect,r={store:e,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},s=await this.layerAdapter.createServiceOptions(this.view),i=this._createViewSchemaConfig(),a={source:this.layerAdapter.createSourceSchema(s,i,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(r,i,this._displayRefreshVersion)},o=!!m(this._lastSchema?.source.mutable,a.source.mutable)||!!m(this._lastSchema?.processor,a.processor);if(!o)return this.featureContainer.requestRender(),this.featureContainer.attributeView.unlockTextureUploads(),e.updateEnd(),void(this.featureEffectView.featureEffect=t);this._lastSchema=a,this._fields=null;const n=Math.round(performance.now());has("esri-2d-update-debug")&&console.debug(`Id[${this.layer.uid}] Version[${n}] FeatureLayerView2D._doUpdate`,{changes:o});let u=[];Array.isArray(s.source)&&(u=s.source),await this._worker.pipeline.updateSchema(a,n,{transferList:u}),e.updateEnd(),this.featureEffectView.featureEffect=t,this.featureEffectView.endTransitions(),this.featureContainer.attributeView.unlockTextureUploads(),this.featureContainer.swapRenderState(),this.featureContainer.requestRender(),has("esri-2d-update-debug")&&console.debug(`Version[${n}] FeatureLayerView2D.updateEnd`),this.requestUpdate()}catch(e){has("esri-2d-update-debug")&&console.error("Encountered an error during update",e)}}async _doEdit(e){try{this.featureContainer.editStart(),await this._worker.pipeline.onEdits(e),this.featureContainer.editEnd()}catch(t){p(t),0}}get hasFilter(){const e=this.layerAdapter.hasFilters?.(this.view)??!1;return null!=this.filter||null!=this.timeExtent||this._visibilityOverrides.size>0||e}_getEffectiveAvailableFields(e){const t=P(this._lastAvailableFields,e);return this._lastAvailableFields=t,v(this.layer.fieldsIndex,t)}_createViewSchemaConfig(){const e=[W(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),filters:e,outSpatialReference:this.view.spatialReference,tileInfoJSON:this.view.featuresTilingScheme.tileInfo.toJSON(),scale:this.view.scale}}_addHighlight(e,t){this._highlightCounter.addReason(e,t),this._updateHighlight().catch((e=>{p(e)||u.getLogger(this).error(e)}))}_removeHighlight(e,t){this._highlightCounter.deleteReason(e,t),this._updateHighlight().catch((e=>{p(e)||u.getLogger(this).error(e)}))}_setLayersForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin&&this.layerAdapter.setGraphicOrigin(e)}_createGraphicHit(e,t){return this._setLayersForFeature(t),null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function W(e,t,r,s,i){i&&(i=i.clone());const a=null!=i?i.timeExtent:null,o=null!=r&&null!=a?r.intersection(a):r||a;o&&(i??=new w,i.timeExtent=o),i=t.addFilters?.(i,e)??i;let n=i?.toJSON()??null;return s.size&&(n??=(new w).toJSON(),n.hiddenIds=Array.from(s)),n}e([g()],Z.prototype,"_worker",void 0),e([g()],Z.prototype,"_commandsQueue",void 0),e([g()],Z.prototype,"_sourceRefreshVersion",void 0),e([g()],Z.prototype,"_displayRefreshVersion",void 0),e([g({readOnly:!0})],Z.prototype,"_pipelineUpdating",void 0),e([g({readOnly:!0})],Z.prototype,"hasAllFeatures",null),e([g({readOnly:!0})],Z.prototype,"hasAllFeaturesInView",null),e([g({readOnly:!0})],Z.prototype,"hasFullGeometries",null),e([g()],Z.prototype,"featureEffectView",void 0),e([g()],Z.prototype,"labelingCollisionInfos",null),e([g()],Z.prototype,"layerAdapter",null),e([g()],Z.prototype,"updateHash",null),e([g()],Z.prototype,"updating",void 0),Z=e([f(z)],Z);const X=Z;export{X as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import"../../../geometry.js";import r from"../../../Graphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import s from"../../../core/Collection.js";import{neverReached as a}from"../../../core/compilerUtils.js";import o from"../../../core/Error.js";import{makeHandle as n}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import u from"../../../core/Logger.js";import{destroyMaybe as l}from"../../../core/maybe.js";import{debounce as h,throwIfNotAbortError as c,isAbortError as p}from"../../../core/promiseUtils.js";import{watch as d,initial as y}from"../../../core/reactiveUtils.js";import{property as g}from"../../../core/accessorSupport/decorators/property.js";import{subclass as f}from"../../../core/accessorSupport/decorators/subclass.js";import{diff as m}from"../../../core/accessorSupport/diffUtils.js";import _ from"../../../layers/effects/FeatureEffectView.js";import w from"../../../layers/support/FeatureFilter.js";import{packFields as v}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as b}from"../../../layers/support/layerUtils.js";import S from"../../../rest/support/AggregateFeatureSet.js";import F from"../../../rest/support/FeatureSet.js";import A from"../../../rest/support/Query.js";import{getHighlightBits as E}from"../engine/highlightReasons.js";import{LayerView2DMixin as V}from"./LayerView2D.js";import{FeatureContainer as C}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as R}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as U}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as j}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as x}from"./features/layerAdapters/FeatureLayerAdapter.js";import{InMemoryLayerAdapter as q}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as Q}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as k}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as I}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{StreamLayerAdapter as O}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as L}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as H}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import D from"./support/FeatureCommandQueue.js";import{HighlightCounter as J}from"./support/HighlightCounter.js";import{FeatureTileSubscriptionManager as N}from"../tiling/FeatureTileSubscriptionManager.js";import T from"../../layers/FeatureLayerView.js";import M from"../../layers/LayerView.js";import $ from"../../layers/RefreshableLayerView.js";import G from"../../../geometry/Extent.js";function P(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 z="esri.views.2d.layers.FeatureLayerView2D",B=4294967294;async function Z(e,t){try{return await e}catch(r){if("no-queryEngine"!==r.name)throw r;return t}}let K=class extends(T($(V(M)))){constructor(){super(...arguments),this._commandsQueue=new D({process:e=>{switch(e.type){case"processed-edit":return this._doEdit(e);case"update":return this._doUpdate()}}}),this._visibilityOverrides=new Set,this._highlightCounter=new J,this._updateHighlight=h((async()=>{const e=[];for(const t of this._highlightCounter.ids()){const r=this._highlightCounter.getHighestReason(t),i=E(r);e.push({objectId:t,highlightFlags:i})}this._worker.pipeline.updateHighlight({highlights:e})})),this._lastAvailableFields=[],this.eventLog=new U,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._fields=null,this.featureEffectView=new _}destroy(){this._worker?.destroy(),this._commandsQueue.destroy()}initialize(){this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransitions()}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("mesh"===e.geometryType)throw new o("featurelayerview:geometry-type-not-supported",`Geometry type of ${e.geometryType} is not supported`,{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===b(e)?.operations.supportsQuery)throw new o("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._worker&&this._worker.destroy();const t=this._createClientOptions();this._worker=await R(t)}get hasAllFeatures(){return this.layer.visible&&this.eventLog.hasAllFeatures}get hasAllFeaturesInView(){return this.layer.visible&&this.eventLog.hasAllFeaturesInView}get hasFullGeometries(){return this.layer.visible&&this.eventLog.hasFullGeometries}get labelingCollisionInfos(){const e=this.layerAdapter.getLabelingDeconflictionInfo(this.view),t=this.layer.geometryType,r=!this.suspended;return e.map((({vvEvaluators:e,deconflictionEnabled:i})=>({container:this.featureContainer,vvEvaluators:e,deconflictionEnabled:i,geometryType:t,visible:r})))}get layerAdapter(){switch(this.layer.type){case"feature":return"memory"===this.layer.source.type?new q(this.layer):new x(this.layer);case"geojson":case"csv":case"wfs":return new q(this.layer);case"subtype-group":return new L(this.layer);case"ogc-feature":return new k(this.layer);case"stream":return new O(this.layer);case"oriented-imagery":return new I(this.layer);case"knowledge-graph-sublayer":return new Q(this.layer);case"catalog-footprint":return new j(this.layer);default:a(this.layer)}return null}get updateHash(){if(!this.layerAdapter)return null;const{availableFields:e,_displayRefreshVersion:t,timeExtent:r,clips:i,filter:s,featureEffect:a,_sourceRefreshVersion:o,view:{timeZone:n}}=this,u=JSON.stringify(i),l=a?.toJSON(),h=s?.toJSON();return JSON.stringify({availableFields:e,clipsHash:u,displayRefreshVersion:t,effectHash:l,filterHash:h,sourceRefreshVersion:o,timeExtent:r,timeZone:n,...this.layerAdapter.getUpdateHashProperties(this.view)})}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}async queryHeatmapStatistics(e){return this._worker.pipeline.queryHeatmapStatistics(e)}highlight(e,t="highlight"){let a;e instanceof r?a=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?a=[e]:s.isCollection(e)&&e.length>0?a=e.map((e=>e?.getObjectId())).toArray():Array.isArray(e)&&e.length>0&&(a="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())));const o=a?.filter(i);return o?.length?(this._addHighlight(o,t),n((()=>this._removeHighlight(o,t)))):n()}getHighlightIds(){return Array.from(this._highlightCounter.ids())}hasHighlight(){return!this._highlightCounter.empty}async hitTest(e,i){const s=await this.featureContainer.hitTest(i);if(0===s.length)return null;const{features:a,aggregates:o}=await this._worker.pipeline.getDisplayFeatures(s),n=this.featureContainer.getSortKeys(s),u=({displayId:e},{displayId:t})=>n.has(e)&&n.has(t)?n.get(e)-n.get(t):e-t;return a.sort(u).reverse(),o.sort(u).reverse(),[...o.map((r=>this._createGraphicHit(e,t.fromJSON(r)))),...a.map((t=>this._createGraphicHit(e,r.fromJSON(t))))]}queryStatistics(){return Z(this._worker.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}querySummaryStatistics(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),i,r),{})}async queryAggregateSummaryStatistics(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),i,r),{})}async queryUniqueValues(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.features.executeQueryForUniqueValues(this._cleanUpQuery(e),i,r),{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),i,r),{uniqueValueInfos:[]})}async queryClassBreaks(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.features.executeQueryForClassBreaks(this._cleanUpQuery(e),i,r),{classBreakInfos:[]})}async queryAggregateClassBreaks(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),i,r),{classBreakInfos:[]})}async queryHistogram(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.features.executeQueryForHistogram(this._cleanUpQuery(e),i,r),{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateHistogram(e,t,r){const i={...t,scale:this.view.scale};return Z(this._worker.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),i,r),{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=F.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}async queryVisibleFeatures(e,t){const r=this._worker.pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),i=await Z(r,{features:[]}),s=F.fromJSON(i);return s.features.forEach((e=>this._setLayersForFeature(e))),s}async queryAggregates(e,t){const r=this._worker.aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),i=await Z(r,{features:[]}),s=S.fromJSON(i);return s.features.forEach((e=>this._setLayersForFeature(e))),s}queryAggregateIds(e,t){return Z(this._worker.aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t),[])}queryAggregateCount(e,t){return Z(this._worker.aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t),0)}queryAggregateJSON(e,t){return Z(this._worker.aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),{features:[]})}async queryFeaturesJSON(e,t){return Z(this._worker.features.executeQuery(this._cleanUpQuery(e),t),{features:[]})}queryObjectIds(e,t){return Z(this._worker.features.executeQueryForIds(this._cleanUpQuery(e),t),[])}queryFeatureCount(e,t){return Z(this._worker.features.executeQueryForCount(this._cleanUpQuery(e),t),0)}async queryExtent(e,t){const r=this._worker.features.executeQueryForExtent(this._cleanUpQuery(e),t),i=await Z(r,{count:0,extent:null});return{count:i.count,extent:G.fromJSON(i.extent)}}async getSampleFeatures(e){return this._worker.pipeline.getSampleFeatures(e)}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._subscriptionManager)return;const t=this._subscriptionManager.update(e);this.featureContainer.setVisibleTiles(t)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),this.featureContainer=new C(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptionManager=new N({tileInfoView:this.view.featuresTilingScheme,updateSubscriptions:e=>{this.featureContainer.updateSubscriptions(e),this._worker.pipeline.updateSubscriptions(e)},isDone:e=>this.featureContainer.isDone(e)}),this.requestUpdate(),this.addAttachHandles([d((()=>this.updateHash),(()=>this._update()),y),d((()=>this.updateSuspended),(e=>{e||this._subscriptionManager.resume()}))]),"stream"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",(e=>this._edit(e))))}detach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.detach"),this._fields=null,this.featureContainer.destroy(),this._commandsQueue.clear(),this.container.removeAllChildren(),this._subscriptionManager=l(this._subscriptionManager),this._worker.pipeline.onDetach()}moveStart(){this.requestUpdate()}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredFieldsPromise,i=this.featureContainer.updatingHandles.updating,s=e&&(t||r)||i||this._pipelineUpdating||this.dataUpdating;if(has("esri-2d-log-updating")){console.log(`Updating FLV2D (${this.layer.id}): ${s}\n -> hasRenderer ${e}\n -> updatingRequiredFields ${r}\n -> hasPendingCommand ${t}\n -> dataUpdating ${this.dataUpdating}\n -> processing ${this._pipelineUpdating}\n -> updatingContainer ${i}\n`);for(const e of this.featureContainer.subscriptions())console.log(` -> Tile[${e.id}] Done: ${e.done}`)}return s}_createClientOptions(){const e=this;return{get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("dataUpdating",e.data)},emitEvent:e=>{this.emit(e.name,e.event)},get eventLog(){return e.eventLog},fetch:t=>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=await t.getSymbolAsync(e.feature,{fields:this._fields});if(!a||!a.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await H(a.data,{uniforms:s,path:"renderer",schemaOptions:i})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=A.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=A.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"})}async _edit(e){if(this.updateSuspended)return void this._subscriptionManager.suspend();return this._validateEdit(e)?this._commandsQueue.push({type:"edit",edits:e}).catch(c):void 0}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%B+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%B+1}_validateEdit(e){const t="globalIdField"in this.layer&&this.layer.globalIdField,r=e.deletedFeatures.some((e=>-1===e.objectId||!e.objectId)),i=t&&this.availableFields.includes(t);return r&&!i?(u.getLogger(this).error(new o("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected on the map`)),null):e}async _doUpdate(){"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 this._updateRequiredFields(),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this._subscriptionManager)return;const e=this.featureContainer.instanceStore;this.featureContainer.attributeView.lockTextureUploads(),e.updateStart();const t=this.featureEffect,r={store:e,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},i=await this.layerAdapter.createServiceOptions(this.view),s=this._createViewSchemaConfig(),a={source:this.layerAdapter.createSourceSchema(i,s,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(r,s,this._displayRefreshVersion)},o=!!m(this._lastSchema?.source.mutable,a.source.mutable)||!!m(this._lastSchema?.processor,a.processor);if(!o)return this.featureContainer.requestRender(),this.featureContainer.attributeView.unlockTextureUploads(),e.updateEnd(),void(this.featureEffectView.featureEffect=t);this._lastSchema=a,this._fields=null;const n=Math.round(performance.now());has("esri-2d-update-debug")&&console.debug(`Id[${this.layer.uid}] Version[${n}] FeatureLayerView2D._doUpdate`,{changes:o});let u=[];Array.isArray(i.source)&&(u=i.source),await this._worker.pipeline.updateSchema(a,n,{transferList:u}),e.updateEnd(),this.featureEffectView.featureEffect=t,this.featureEffectView.endTransitions(),this.featureContainer.attributeView.unlockTextureUploads(),this.featureContainer.swapRenderState(),this.featureContainer.requestRender(),has("esri-2d-update-debug")&&console.debug(`Version[${n}] FeatureLayerView2D.updateEnd`),this.requestUpdate()}catch(e){has("esri-2d-update-debug")&&console.error("Encountered an error during update",e)}}async _doEdit(e){try{this.featureContainer.editStart(),await this._worker.pipeline.onEdits(e),this.featureContainer.editEnd()}catch(t){p(t),0}}get hasFilter(){const e=this.layerAdapter.hasFilters?.(this.view)??!1;return null!=this.filter||null!=this.timeExtent||this._visibilityOverrides.size>0||e}_getEffectiveAvailableFields(e){const t=P(this._lastAvailableFields,e);return this._lastAvailableFields=t,v(this.layer.fieldsIndex,t)}_createViewSchemaConfig(){const e=[W(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),filters:e,outSpatialReference:this.view.spatialReference,tileInfoJSON:this.view.featuresTilingScheme.tileInfo.toJSON(),scale:this.view.scale,timeZone:this.view.timeZone}}_addHighlight(e,t){this._highlightCounter.addReason(e,t),this._updateHighlight().catch((e=>{p(e)||u.getLogger(this).error(e)}))}_removeHighlight(e,t){this._highlightCounter.deleteReason(e,t),this._updateHighlight().catch((e=>{p(e)||u.getLogger(this).error(e)}))}_setLayersForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin&&this.layerAdapter.setGraphicOrigin(e)}_createGraphicHit(e,t){return this._setLayersForFeature(t),null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function W(e,t,r,i,s){s&&(s=s.clone());const a=null!=s?s.timeExtent:null,o=null!=r&&null!=a?r.intersection(a):r||a;o&&(s??=new w,s.timeExtent=o),s=t.addFilters?.(s,e)??s;let n=s?.toJSON()??null;return i.size&&(n??=(new w).toJSON(),n.hiddenIds=Array.from(i)),n}e([g()],K.prototype,"_worker",void 0),e([g()],K.prototype,"_commandsQueue",void 0),e([g()],K.prototype,"_sourceRefreshVersion",void 0),e([g()],K.prototype,"_displayRefreshVersion",void 0),e([g({readOnly:!0})],K.prototype,"_pipelineUpdating",void 0),e([g({readOnly:!0})],K.prototype,"hasAllFeatures",null),e([g({readOnly:!0})],K.prototype,"hasAllFeaturesInView",null),e([g({readOnly:!0})],K.prototype,"hasFullGeometries",null),e([g()],K.prototype,"featureEffectView",void 0),e([g()],K.prototype,"labelingCollisionInfos",null),e([g()],K.prototype,"layerAdapter",null),e([g()],K.prototype,"updateHash",null),e([g()],K.prototype,"updating",void 0),K=e([f(z)],K);const X=K;export{X as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import{clone as t}from"../../../core/lang.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{isAbortError as r}from"../../../core/promiseUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{diff as n,hasDiff as o}from"../../../core/accessorSupport/diffUtils.js";import h from"../../../geometry/Point.js";import{create as u}from"../../../geometry/support/aaBoundingRect.js";import{equals as c}from"../../../geometry/support/spatialReferenceUtils.js";import{StyleUpdateType as y}from"../engine/vectorTiles/enums.js";import{TileHandler as p}from"../engine/vectorTiles/TileHandler.js";import{TileManager as d}from"../engine/vectorTiles/TileManager.js";import{VectorTile as _}from"../engine/vectorTiles/VectorTile.js";import{VectorTileContainer as f}from"../engine/vectorTiles/VectorTileContainer.js";import g from"../engine/vectorTiles/VectorTileFeatureIndex.js";import{StyleLayerType as m}from"../engine/vectorTiles/style/StyleDefinition.js";import T from"../engine/vectorTiles/style/StyleRepository.js";import{LayerView2DMixin as v}from"./LayerView2D.js";import C from"../tiling/TileInfoViewPOT.js";import R from"../tiling/TileQueue.js";import w from"../../layers/LayerView.js";const H=2,I=8,D=512;let S=class extends(v(w)){constructor(){super(...arguments),this._styleChanges=[],this._fetchQueue=null,this._parseQueue=null,this._tileHandlerPromise=null,this._isTileHandlerReady=!1}get fading(){return this._vectorTileContainer?.fading??!1}async hitTest(e,t){const i=this._tileHandlerPromise,s=this._vectorTileContainer?.symbolFader;if(!i||!this._isTileHandlerReady||!s)return;await i;let r=null;const a=this._vectorTileContainer?.symbolRepository;a&&(r=a.querySymbols(t,H,s.decluttererOffset,{}));const l=this.view.state,n=this._tileManager.getIntersectingTiles(t.x,t.y,H,l,r);if((!n||0===n.length)&&0===r?.length)return null;e=e.clone().normalize();const o=[],h=[];for(const u of n)o.push(this._queryTile(h,e,H,this.view.state.rotation,u,r?.filter((e=>e.tileKey.id===u.id))));return await Promise.all(o),h}update(e){if(this._tileHandlerPromise&&this._isTileHandlerReady)return e.pixelRatio!==this._tileHandler.devicePixelRatio?(this._start(),void(this._tileHandler.devicePixelRatio=e.pixelRatio)):void(this._styleChanges.length>0?this._tileHandlerPromise=this._applyStyleChanges():(this._fetchQueue.pause(),this._parseQueue.pause(),this._fetchQueue.state=e.state,this._parseQueue.state=e.state,this._tileManager.update(e)||this.requestUpdate(),this._parseQueue.resume(),this._fetchQueue.resume()))}attach(){const{style:e}=this.layer.currentStyleInfo;this._styleRepository=new T(e),this._tileInfoView=new C(this.layer.tileInfo,this.layer.fullExtent),this._vectorTileContainer=new f(this.view.featuresTilingScheme,this._tileInfoView),this._tileHandler=new p(this.layer,this._styleRepository,window.devicePixelRatio||1,this.layer.tileInfo.lods.length-1),this.container.addChild(this._vectorTileContainer),this._start(),this.addAttachHandles([this.layer.on("paint-change",(e=>{if(e.isDataDriven)this._styleChanges.push({type:y.PAINTER_CHANGED,data:e}),this.requestUpdate();else{const t=this._styleRepository,i=t.getLayerById(e.layer);if(!i)return;const s=i.type===m.SYMBOL;t.setPaintProperties(e.layer,e.paint),s&&this._vectorTileContainer?.restartDeclutter(),this._vectorTileContainer?.requestRender()}})),this.layer.on("layout-change",(e=>{const t=this._styleRepository,i=t.getLayerById(e.layer);if(!i)return;const s=n(i.layout,e.layout);if(null!=s){if(o(s,"visibility")&&1===P(s))return t.setLayoutProperties(e.layer,e.layout),i.type===m.SYMBOL&&this._vectorTileContainer?.restartDeclutter(),void this._vectorTileContainer?.requestRender();this._styleChanges.push({type:y.LAYOUT_CHANGED,data:e}),this.requestUpdate()}})),this.layer.on("style-layer-visibility-change",(e=>{const t=this._styleRepository,i=t.getLayerById(e.layer);i&&(t.setStyleLayerVisibility(e.layer,e.visibility),i.type===m.SYMBOL&&this._vectorTileContainer?.restartDeclutter(),this._vectorTileContainer?.requestRender())})),this.layer.on("style-layer-change",(e=>{this._styleChanges.push({type:y.LAYER_CHANGED,data:e}),this.requestUpdate()})),this.layer.on("delete-style-layer",(e=>{this._styleChanges.push({type:y.LAYER_REMOVED,data:e}),this.requestUpdate()})),this.layer.on("load-style",(()=>this._loadStyle())),this.layer.on("spriteSource-change",(e=>{this._styleChanges.push({type:y.SPRITES_CHANGED,data:e});const t=this._styleRepository.layers;for(const i of t)switch(i.type){case m.SYMBOL:i.getLayoutProperty("icon-image")&&this._styleChanges.push({type:y.LAYOUT_CHANGED,data:{layer:i.id,layout:i.layout}});break;case m.LINE:i.getPaintProperty("line-pattern")&&this._styleChanges.push({type:y.PAINTER_CHANGED,data:{layer:i.id,paint:i.paint,isDataDriven:i.isPainterDataDriven()}});break;case m.FILL:i.getLayoutProperty("fill-pattern")&&this._styleChanges.push({type:y.PAINTER_CHANGED,data:{layer:i.id,paint:i.paint,isDataDriven:i.isPainterDataDriven()}})}this.requestUpdate()}))])}detach(){this._stop(),this.container.removeAllChildren(),this._vectorTileContainer=s(this._vectorTileContainer),this._tileHandler=s(this._tileHandler)}moveStart(){this.requestUpdate()}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}supportsSpatialReference(e){return c(this.layer.tileInfo?.spatialReference,e)}canResume(){let e=super.canResume();const{currentStyleInfo:t}=this.layer;if(e&&t?.layerDefinition){const i=this.view.scale,{minScale:s,maxScale:r}=t.layerDefinition;t?.layerDefinition&&(s&&s<i&&(e=!1),r&&r>i&&(e=!1))}return e}isUpdating(){return this.fading}acquireTile(e){const t=this._createVectorTile(e);return this._updatingHandles.addPromise(this._fetchQueue.push(t.key).then((e=>this._parseQueue.push({key:t.key,data:e}))).then((e=>{t.once("attach",(()=>this.requestUpdate())),t.setData(e),this.requestUpdate()})).catch((e=>{r(e)||i.getLogger(this).error(e)}))),t}releaseTile(e){const t=e.key.id;this._fetchQueue.abort(t),this._parseQueue.abort(t),this.requestUpdate()}_start(){if(this._stop(),this._tileManager=new d({acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView},this._vectorTileContainer),!this.layer.currentStyleInfo)return;const e=new AbortController,t=this._tileHandler.start({signal:e.signal}).then((()=>{this._fetchQueue=new R({tileInfoView:this._tileInfoView,process:(e,t)=>this._getTileData(e,t),concurrency:15}),this._parseQueue=new R({tileInfoView:this._tileInfoView,process:(e,t)=>this._parseTileData(e,t),concurrency:8}),this.requestUpdate(),this._isTileHandlerReady=!0}));this._tileHandler.spriteMosaic.then((e=>{this._vectorTileContainer.setStyleResources(e,this._tileHandler.glyphMosaic,this._styleRepository,this._tileInfoView,this.view.featuresTilingScheme),this.requestUpdate()})),this._tileHandlerAbortController=e,this._tileHandlerPromise=t}_stop(){if(!this._tileHandlerAbortController||!this._vectorTileContainer)return;const e=this._tileHandlerAbortController;e&&e.abort(),this._tileHandlerPromise=null,this._isTileHandlerReady=!1,this._fetchQueue=s(this._fetchQueue),this._parseQueue=s(this._parseQueue),this._tileManager=s(this._tileManager),this._vectorTileContainer.removeAllChildren()}async _getTileData(e,t){return this._tileHandler.fetchTileData(e,t)}async _parseTileData(e,t){return this._tileHandler.parseTileData(e,t)}async _applyStyleChanges(){this._isTileHandlerReady=!1,this._fetchQueue.pause(),this._parseQueue.pause(),this._fetchQueue.clear(),this._parseQueue.clear(),this._tileManager.clearCache();const e=this._styleChanges;try{await this._tileHandler.updateStyle(e)}catch(l){i.getLogger(this).error("error applying vector-tiles style update",l.message),this._fetchQueue.resume(),this._parseQueue.resume(),this._isTileHandlerReady=!0}const t=this._styleRepository,s=new Set;e.forEach((e=>{if(e.type!==y.LAYER_REMOVED)return;const i=e.data,r=t.getLayerById(i.layer);r&&s.add(r.uid)}));const r=new Set;e.forEach((e=>{let i;switch(e.type){case y.PAINTER_CHANGED:t.setPaintProperties(e.data.layer,e.data.paint),i=e.data.layer;break;case y.LAYOUT_CHANGED:t.setLayoutProperties(e.data.layer,e.data.layout),i=e.data.layer;break;case y.LAYER_REMOVED:return void t.deleteStyleLayer(e.data.layer);case y.LAYER_CHANGED:t.setStyleLayer(e.data.layer,e.data.index),i=e.data.layer.id;break;case y.SPRITES_CHANGED:this._vectorTileContainer.setSpriteMosaic(this._tileHandler.setSpriteSource(e.data.spriteSource))}if(i){const e=t.getLayerById(i);e&&r.add(e.uid)}}));const a=this._vectorTileContainer.children;if(s.size>0){const e=Array.from(s);this._vectorTileContainer.deleteStyleLayers(e);for(const t of a)t.deleteLayerData(e)}if(this._fetchQueue.resume(),this._parseQueue.resume(),r.size>0){const e=Array.from(r),t=[];for(const i of a){const s=this._updatingHandles.addPromise(this._fetchQueue.push(i.key).then((t=>this._parseQueue.push({key:i.key,data:t,styleLayerUIDs:e}))).then((e=>i.setData(e))));t.push(s)}await Promise.all(t)}this._styleChanges=[],this._isTileHandlerReady=!0,this.requestUpdate()}async _loadStyle(){const{style:e}=this.layer.currentStyleInfo,i=t(e);this._isTileHandlerReady=!1,this._fetchQueue.pause(),this._parseQueue.pause(),this._fetchQueue.clear(),this._parseQueue.clear(),this._styleRepository=new T(i),this._vectorTileContainer.destroy(),this._tileManager.clear(),this._tileHandlerAbortController.abort(),this._tileHandlerAbortController=new AbortController;const{signal:s}=this._tileHandlerAbortController;try{this._tileHandlerPromise=this._tileHandler.setStyle(this._styleRepository,i,this.layer.tileInfo.lods.length-1),await this._tileHandlerPromise}catch(n){if(!r(n))throw n}if(s.aborted)return this._fetchQueue.resume(),this._parseQueue.resume(),this._isTileHandlerReady=!0,void this.requestUpdate();const a=await this._tileHandler.spriteMosaic,l=this._vectorTileContainer;this._tileInfoView=new C(this.layer.tileInfo,this.layer.fullExtent),l.setStyleResources(a,this._tileHandler.glyphMosaic,this._styleRepository,this._tileInfoView,this.view.featuresTilingScheme),this._tileManager=new d({acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView},this._vectorTileContainer),this._fetchQueue.resume(),this._parseQueue.resume(),this._isTileHandlerReady=!0,this.requestUpdate()}_createVectorTile(e){const t=this._tileInfoView.getTileBounds(u(),e),i=this._tileInfoView.getTileResolution(e.level);return new _(e,i,t[0],t[3],512,512,this._styleRepository)}async _queryTile(e,t,i,s,r,a){if(0===r.layerData.size)return;const l=this._ensureTileIndex(r),n=this._tileInfoView.getTileBounds(u(),r.key,!0),o=I*D*((t.x-n[0])/(n[2]-n[0])),h=I*D*(1-(t.y-n[1])/(n[3]-n[1])),c=await l.queryAttributes(o,h,i,s,a);for(const u of c)u.graphic.geometry=this._tileToMapPoint(u.tilePoint,r.transforms.tileUnitsToPixels),e.push({type:"graphic",layer:this.layer,graphic:u.graphic,mapPoint:t.clone()});e.sort(((e,t)=>t.graphic.origin.layerIndex-e.graphic.origin.layerIndex))}_tileToMapPoint(e,t){if(!e)return null;const i=e[0]*t[0]+e[1]*t[3]+t[6],s=e[0]*t[1]+e[1]*t[4]+t[7],r=this.view.state,a=[0,0];return r.toMap(a,[i,s]),new h({x:a[0],y:a[1],spatialReference:r.spatialReference})}_ensureTileIndex(e){let t=e.featureIndex;return t||(t=g.create(e.key,e.layerData,this._styleRepository,this._tileHandler,this.layer),e.featureIndex=t),t}};function P(e){if(null==e)return 0;switch(e.type){case"partial":return Object.keys(e.diff).length;case"complete":return Math.max(Object.keys(e.oldValue).length,Object.keys(e.newValue).length);case"collection":return Object.keys(e.added).length+Object.keys(e.changed).length+Object.keys(e.removed).length}}e([a()],S.prototype,"_isTileHandlerReady",void 0),S=e([l("esri.views.2d.layers.VectorTileLayerView2D")],S);const A=S;export{A as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import{clone as t}from"../../../core/lang.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{isAbortError as r}from"../../../core/promiseUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{diff as n,hasDiff as o}from"../../../core/accessorSupport/diffUtils.js";import h from"../../../geometry/Point.js";import{create as y}from"../../../geometry/support/aaBoundingRect.js";import{equals as u}from"../../../geometry/support/spatialReferenceUtils.js";import{StyleUpdateType as c}from"../engine/vectorTiles/enums.js";import{TileHandler as p}from"../engine/vectorTiles/TileHandler.js";import{TileManager as d}from"../engine/vectorTiles/TileManager.js";import{VectorTile as _}from"../engine/vectorTiles/VectorTile.js";import{VectorTileContainer as f}from"../engine/vectorTiles/VectorTileContainer.js";import g from"../engine/vectorTiles/VectorTileFeatureIndex.js";import{StyleLayerType as m}from"../engine/vectorTiles/style/StyleDefinition.js";import T from"../engine/vectorTiles/style/StyleRepository.js";import{LayerView2DMixin as C}from"./LayerView2D.js";import v from"../tiling/TileInfoViewPOT.js";import R from"../tiling/TileQueue.js";import H from"../../layers/LayerView.js";const w=2,I=8,D=512;let S=class extends(C(H)){constructor(){super(...arguments),this._styleChanges=[],this._fetchQueue=null,this._parseQueue=null,this._tileHandlerPromise=null,this._isTileHandlerReady=!1}get fading(){return this._vectorTileContainer?.fading??!1}async hitTest(e,t){const i=this._tileHandlerPromise,s=this._vectorTileContainer?.symbolFader;if(!i||!this._isTileHandlerReady||!s)return;await i;let r=null;const a=this._vectorTileContainer?.symbolRepository;a&&(r=a.querySymbols(t,w,s.decluttererOffset,{}));const l=this.view.state,n=this._tileManager.getIntersectingTiles(t.x,t.y,w,l,r);if((!n||0===n.length)&&0===r?.length)return null;e=e.clone().normalize();const o=[],h=[];for(const y of n)o.push(this._queryTile(h,e,w,this.view.state.rotation,y,r?.filter((e=>e.tileKey.id===y.id))));return await Promise.all(o),h}update(e){if(this._tileHandlerPromise&&this._isTileHandlerReady)return e.pixelRatio!==this._tileHandler.devicePixelRatio?(this._start(),void(this._tileHandler.devicePixelRatio=e.pixelRatio)):void(this._styleChanges.length>0?this._tileHandlerPromise=this._applyStyleChanges():(this._fetchQueue.pause(),this._parseQueue.pause(),this._fetchQueue.state=e.state,this._parseQueue.state=e.state,this._tileManager.update(e)||this.requestUpdate(),this._parseQueue.resume(),this._fetchQueue.resume()))}attach(){const{style:e}=this.layer.currentStyleInfo;this._styleRepository=new T(e),this._tileInfoView=new v(this.layer.tileInfo,this.layer.fullExtent),this._vectorTileContainer=new f(this._tileInfoView),this._tileHandler=new p(this.layer,this._styleRepository,window.devicePixelRatio||1,this.layer.tileInfo.lods.length-1),this.container.addChild(this._vectorTileContainer),this._start(),this.addAttachHandles([this.layer.on("paint-change",(e=>{if(e.isDataDriven)this._styleChanges.push({type:c.PAINTER_CHANGED,data:e}),this.requestUpdate();else{const t=this._styleRepository,i=t.getLayerById(e.layer);if(!i)return;const s=i.type===m.SYMBOL;t.setPaintProperties(e.layer,e.paint),s&&this._vectorTileContainer?.restartDeclutter(),this._vectorTileContainer?.requestRender()}})),this.layer.on("layout-change",(e=>{const t=this._styleRepository,i=t.getLayerById(e.layer);if(!i)return;const s=n(i.layout,e.layout);if(null!=s){if(o(s,"visibility")&&1===P(s))return t.setLayoutProperties(e.layer,e.layout),i.type===m.SYMBOL&&this._vectorTileContainer?.restartDeclutter(),void this._vectorTileContainer?.requestRender();this._styleChanges.push({type:c.LAYOUT_CHANGED,data:e}),this.requestUpdate()}})),this.layer.on("style-layer-visibility-change",(e=>{const t=this._styleRepository,i=t.getLayerById(e.layer);i&&(t.setStyleLayerVisibility(e.layer,e.visibility),i.type===m.SYMBOL&&this._vectorTileContainer?.restartDeclutter(),this._vectorTileContainer?.requestRender())})),this.layer.on("style-layer-change",(e=>{this._styleChanges.push({type:c.LAYER_CHANGED,data:e}),this.requestUpdate()})),this.layer.on("delete-style-layer",(e=>{this._styleChanges.push({type:c.LAYER_REMOVED,data:e}),this.requestUpdate()})),this.layer.on("load-style",(()=>this._loadStyle())),this.layer.on("spriteSource-change",(e=>{this._styleChanges.push({type:c.SPRITES_CHANGED,data:e});const t=this._styleRepository.layers;for(const i of t)switch(i.type){case m.SYMBOL:i.getLayoutProperty("icon-image")&&this._styleChanges.push({type:c.LAYOUT_CHANGED,data:{layer:i.id,layout:i.layout}});break;case m.LINE:i.getPaintProperty("line-pattern")&&this._styleChanges.push({type:c.PAINTER_CHANGED,data:{layer:i.id,paint:i.paint,isDataDriven:i.isPainterDataDriven()}});break;case m.FILL:i.getLayoutProperty("fill-pattern")&&this._styleChanges.push({type:c.PAINTER_CHANGED,data:{layer:i.id,paint:i.paint,isDataDriven:i.isPainterDataDriven()}})}this.requestUpdate()}))])}detach(){this._stop(),this.container.removeAllChildren(),this._vectorTileContainer=s(this._vectorTileContainer),this._tileHandler=s(this._tileHandler)}moveStart(){this.requestUpdate()}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}supportsSpatialReference(e){return u(this.layer.tileInfo?.spatialReference,e)}canResume(){let e=super.canResume();const{currentStyleInfo:t}=this.layer;if(e&&t?.layerDefinition){const i=this.view.scale,{minScale:s,maxScale:r}=t.layerDefinition;t?.layerDefinition&&(s&&s<i&&(e=!1),r&&r>i&&(e=!1))}return e}isUpdating(){return this.fading}acquireTile(e){const t=this._createVectorTile(e);return this._updatingHandles.addPromise(this._fetchQueue.push(t.key).then((e=>this._parseQueue.push({key:t.key,data:e}))).then((e=>{t.once("attach",(()=>this.requestUpdate())),t.setData(e),this.requestUpdate()})).catch((e=>{r(e)||i.getLogger(this).error(e)}))),t}releaseTile(e){const t=e.key.id;this._fetchQueue.abort(t),this._parseQueue.abort(t),this.requestUpdate()}_start(){if(this._stop(),this._tileManager=new d({acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView},this._vectorTileContainer),!this.layer.currentStyleInfo)return;const e=new AbortController,t=this._tileHandler.start({signal:e.signal}).then((()=>{this._fetchQueue=new R({tileInfoView:this._tileInfoView,process:(e,t)=>this._getTileData(e,t),concurrency:15}),this._parseQueue=new R({tileInfoView:this._tileInfoView,process:(e,t)=>this._parseTileData(e,t),concurrency:8}),this.requestUpdate(),this._isTileHandlerReady=!0}));this._tileHandler.spriteMosaic.then((e=>{this._vectorTileContainer.setStyleResources(e,this._tileHandler.glyphMosaic,this._styleRepository,this._tileInfoView),this.requestUpdate()})),this._tileHandlerAbortController=e,this._tileHandlerPromise=t}_stop(){if(!this._tileHandlerAbortController||!this._vectorTileContainer)return;const e=this._tileHandlerAbortController;e&&e.abort(),this._tileHandlerPromise=null,this._isTileHandlerReady=!1,this._fetchQueue=s(this._fetchQueue),this._parseQueue=s(this._parseQueue),this._tileManager=s(this._tileManager),this._vectorTileContainer.removeAllChildren()}async _getTileData(e,t){return this._tileHandler.fetchTileData(e,t)}async _parseTileData(e,t){return this._tileHandler.parseTileData(e,t)}async _applyStyleChanges(){this._isTileHandlerReady=!1,this._fetchQueue.pause(),this._parseQueue.pause(),this._fetchQueue.clear(),this._parseQueue.clear(),this._tileManager.clearCache();const e=this._styleChanges;try{await this._tileHandler.updateStyle(e)}catch(l){i.getLogger(this).error("error applying vector-tiles style update",l.message),this._fetchQueue.resume(),this._parseQueue.resume(),this._isTileHandlerReady=!0}const t=this._styleRepository,s=new Set;e.forEach((e=>{if(e.type!==c.LAYER_REMOVED)return;const i=e.data,r=t.getLayerById(i.layer);r&&s.add(r.uid)}));const r=new Set;e.forEach((e=>{let i;switch(e.type){case c.PAINTER_CHANGED:t.setPaintProperties(e.data.layer,e.data.paint),i=e.data.layer;break;case c.LAYOUT_CHANGED:t.setLayoutProperties(e.data.layer,e.data.layout),i=e.data.layer;break;case c.LAYER_REMOVED:return void t.deleteStyleLayer(e.data.layer);case c.LAYER_CHANGED:t.setStyleLayer(e.data.layer,e.data.index),i=e.data.layer.id;break;case c.SPRITES_CHANGED:this._vectorTileContainer.setSpriteMosaic(this._tileHandler.setSpriteSource(e.data.spriteSource))}if(i){const e=t.getLayerById(i);e&&r.add(e.uid)}}));const a=this._vectorTileContainer.children;if(s.size>0){const e=Array.from(s);this._vectorTileContainer.deleteStyleLayers(e);for(const t of a)t.deleteLayerData(e)}if(this._fetchQueue.resume(),this._parseQueue.resume(),r.size>0){const e=Array.from(r),t=[];for(const i of a){const s=this._updatingHandles.addPromise(this._fetchQueue.push(i.key).then((t=>this._parseQueue.push({key:i.key,data:t,styleLayerUIDs:e}))).then((e=>i.setData(e))));t.push(s)}await Promise.all(t)}this._styleChanges=[],this._isTileHandlerReady=!0,this.requestUpdate()}async _loadStyle(){const{style:e}=this.layer.currentStyleInfo,i=t(e);this._isTileHandlerReady=!1,this._fetchQueue.pause(),this._parseQueue.pause(),this._fetchQueue.clear(),this._parseQueue.clear(),this._styleRepository=new T(i),this._vectorTileContainer.destroy(),this._tileManager.clear(),this._tileHandlerAbortController.abort(),this._tileHandlerAbortController=new AbortController;const{signal:s}=this._tileHandlerAbortController;try{this._tileHandlerPromise=this._tileHandler.setStyle(this._styleRepository,i,this.layer.tileInfo.lods.length-1),await this._tileHandlerPromise}catch(n){if(!r(n))throw n}if(s.aborted)return this._fetchQueue.resume(),this._parseQueue.resume(),this._isTileHandlerReady=!0,void this.requestUpdate();const a=await this._tileHandler.spriteMosaic,l=this._vectorTileContainer;this._tileInfoView=new v(this.layer.tileInfo,this.layer.fullExtent),l.setStyleResources(a,this._tileHandler.glyphMosaic,this._styleRepository,this._tileInfoView),this._tileManager=new d({acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView},this._vectorTileContainer),this._fetchQueue.resume(),this._parseQueue.resume(),this._isTileHandlerReady=!0,this.requestUpdate()}_createVectorTile(e){const t=this._tileInfoView.getTileBounds(y(),e),i=this._tileInfoView.getTileResolution(e.level);return new _(e,i,t[0],t[3],512,512,this._styleRepository)}async _queryTile(e,t,i,s,r,a){if(0===r.layerData.size)return;const l=this._ensureTileIndex(r),n=this._tileInfoView.getTileBounds(y(),r.key,!0),o=I*D*((t.x-n[0])/(n[2]-n[0])),h=I*D*(1-(t.y-n[1])/(n[3]-n[1])),u=await l.queryAttributes(o,h,i,s,a);for(const y of u)y.graphic.geometry=this._tileToMapPoint(y.tilePoint,r.transforms.tileUnitsToPixels),e.push({type:"graphic",layer:this.layer,graphic:y.graphic,mapPoint:t.clone()});e.sort(((e,t)=>t.graphic.origin.layerIndex-e.graphic.origin.layerIndex))}_tileToMapPoint(e,t){if(!e)return null;const i=e[0]*t[0]+e[1]*t[3]+t[6],s=e[0]*t[1]+e[1]*t[4]+t[7],r=this.view.state,a=[0,0];return r.toMap(a,[i,s]),new h({x:a[0],y:a[1],spatialReference:r.spatialReference})}_ensureTileIndex(e){let t=e.featureIndex;return t||(t=g.create(e.key,e.layerData,this._styleRepository,this._tileHandler,this.layer),e.featureIndex=t),t}};function P(e){if(null==e)return 0;switch(e.type){case"partial":return Object.keys(e.diff).length;case"complete":return Math.max(Object.keys(e.oldValue).length,Object.keys(e.newValue).length);case"collection":return Object.keys(e.added).length+Object.keys(e.changed).length+Object.keys(e.removed).length}}e([a()],S.prototype,"_isTileHandlerReady",void 0),S=e([l("esri.views.2d.layers.VectorTileLayerView2D")],S);const A=S;export{A as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../../../core/has.js";import{destroyMaybe as t}from"../../../../core/maybe.js";import{ignoreAbortErrors as e,throwIfNotAbortError as s,throwIfAborted as r}from"../../../../core/promiseUtils.js";import{diff as i,hasDiff as a}from"../../../../core/accessorSupport/diffUtils.js";import o from"../../../../geometry/SpatialReference.js";import{MultiTileMeshData as n}from"../../engine/webgl/mesh/MultiTileMeshData.js";import{FeatureMeshFactory as c}from"../../engine/webgl/mesh/factories/FeatureMeshFactory.js";import{ResourceProxy as h}from"../../engine/webgl/mesh/factories/ResourceProxy.js";import{BinningStrategy as u}from"./processor/BinningStrategy.js";import{ClusterStrategy as g}from"./processor/ClusterStrategy.js";import{FeatureUpdateStrategy as d}from"./processor/FeatureUpdateStrategy.js";import{AttributeStore as y}from"./support/AttributeStore.js";import{ComputedAttributeStorage as _}from"./support/ComputedAttributeStorage.js";import{QueueProcessor as p}from"../../../support/QueueProcessor.js";class l{constructor(t,s){this._connection=t,this._source=s,this._version=1,this._queue=new p({concurrency:1,process:t=>this._process(t)}),this._proxy=new h({fetch:(t,e)=>this._connection.layerView.fetch(t,e),fetchDictionary:(t,e)=>this._connection.layerView.fetchDictionary(t,e)}),this._attributeStore=new y({isLocal:!1,update:t=>e(this._connection.container.updateAttributeView(t))})}destroy(){this._proxy.destory(),this._strategy?.destroy(),this._attributeStore.destroy()}get aggregateQueryEngine(){return this._strategy?.aggregateQueryEngine}getDisplayFeatures(t){return this._strategy?this._strategy.getDisplayFeatures(t):{features:[],aggregates:[]}}getFeatureObjectIdsForAggregate(t){return this._strategy?this._strategy.getFeatureObjectIdsForAggregate(t):[]}onSubscribe(t){this._strategy?.onSubscribe(t)}onUnsubscribe(t){this._strategy?.onUnsubscribe(t)}async update(t,e,s,r,n){const h=t.processor,u=i(this._schema,h);if(!u&&!r)return;has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] SymbolProcessor.update`,{changes:u,schema:h}),this._schema=h;const g=o.fromJSON(t.source.mutable.dataFilter.outSpatialReference),d=new _({fields:this._source.metadata.fieldsIndex,spatialReference:g});return await this._attributeStore.update(h.storage,d,this._source.metadata,g,e),this._strategy?.invalidateAttributeData(),r||a(u,"mesh")?(a(u,"mesh.strategy")&&await this._updateStrategy(h.mesh.strategy,g,n),this._updateSortKey(d,"sortKey"in h.mesh?h.mesh.sortKey:null),(a(u,"mesh.factory")||"dictionary"===h.mesh.factory.symbology.type)&&(this._factory=await c.create(d,this._proxy,h.mesh.factory,s)),this._invalidate(),this._version=e,this._connection.container.updateRenderState(this._version)):void 0}async applyOverride(t){if(!this._strategy)return;const e=this._strategy.applyOverride(t);for await(const r of e)try{await this._process(r)}catch(s){}this._source.applyOverride(t)}async updateChunks(){return this._doUpdateChunks()}async removeChunks(t){this._strategy?.removeChunks(t),this._attributeStore.incrementDisplayIdGeneration()}updateHighlight({highlights:t}){if(!this._strategy)return void this._attributeStore.setHighlight(t.map((({objectId:t,highlightFlags:e})=>({objectId:t,highlightFlags:e,displayId:-1}))),t);const e=this._strategy.displayMap(t,(({objectId:t})=>t),((t,{highlightFlags:e},s)=>({objectId:s,displayId:t,highlightFlags:e})));this._attributeStore.setHighlight(e,t)}async _doUpdateChunks(){if(!this._strategy)return;const t=this._strategy.updateChunks(),e=[];for await(const i of t){const t=this._queue.push(i).catch((t=>s(t)));e.push(t)}try{await Promise.all(e)}catch(r){}has("esri-2d-update-debug")&&console.log("SendUpdates"),await this._attributeStore.sendUpdates(),has("esri-2d-update-debug")&&console.log("SendUpdates.await")}async _updateStrategy(t,e,s){switch(this._strategy?.destroy(),t.type){case"feature":this._strategy=new d(this._source,this._attributeStore);break;case"binning":this._strategy=await u.create(t,e,this._source,this._attributeStore);break;case"cluster":this._strategy=await g.create(this._connection,t,e,this._source,this._attributeStore)}for(const
|
|
5
|
+
import has from"../../../../core/has.js";import{destroyMaybe as t}from"../../../../core/maybe.js";import{ignoreAbortErrors as e,throwIfNotAbortError as s,throwIfAborted as r}from"../../../../core/promiseUtils.js";import{diff as i,hasDiff as a}from"../../../../core/accessorSupport/diffUtils.js";import o from"../../../../geometry/SpatialReference.js";import{MultiTileMeshData as n}from"../../engine/webgl/mesh/MultiTileMeshData.js";import{FeatureMeshFactory as c}from"../../engine/webgl/mesh/factories/FeatureMeshFactory.js";import{ResourceProxy as h}from"../../engine/webgl/mesh/factories/ResourceProxy.js";import{BinningStrategy as u}from"./processor/BinningStrategy.js";import{ClusterStrategy as g}from"./processor/ClusterStrategy.js";import{FeatureUpdateStrategy as d}from"./processor/FeatureUpdateStrategy.js";import{AttributeStore as y}from"./support/AttributeStore.js";import{ComputedAttributeStorage as _}from"./support/ComputedAttributeStorage.js";import{QueueProcessor as p}from"../../../support/QueueProcessor.js";class l{constructor(t,s){this._connection=t,this._source=s,this._version=1,this._queue=new p({concurrency:1,process:t=>this._process(t)}),this._proxy=new h({fetch:(t,e)=>this._connection.layerView.fetch(t,e),fetchDictionary:(t,e)=>this._connection.layerView.fetchDictionary(t,e)}),this._attributeStore=new y({isLocal:!1,update:t=>e(this._connection.container.updateAttributeView(t))})}destroy(){this._proxy.destory(),this._strategy?.destroy(),this._attributeStore.destroy()}get aggregateQueryEngine(){return this._strategy?.aggregateQueryEngine}getDisplayFeatures(t){return this._strategy?this._strategy.getDisplayFeatures(t):{features:[],aggregates:[]}}getFeatureObjectIdsForAggregate(t){return this._strategy?this._strategy.getFeatureObjectIdsForAggregate(t):[]}onSubscribe(t){this._strategy?.onSubscribe(t)}onUnsubscribe(t){this._strategy?.onUnsubscribe(t)}async update(t,e,s,r,n){const h=t.processor,u=i(this._schema,h);if(!u&&!r)return;has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] SymbolProcessor.update`,{changes:u,schema:h}),this._schema=h;const g=o.fromJSON(t.source.mutable.dataFilter.outSpatialReference),d=new _({fields:this._source.metadata.fieldsIndex,spatialReference:g});return await this._attributeStore.update(h.storage,d,this._source.metadata,g,e),this._strategy?.invalidateAttributeData(),r||a(u,"mesh")?(a(u,"mesh.strategy")&&await this._updateStrategy(h.mesh.strategy,g,n,h.mesh.timeZone),this._updateSortKey(d,"sortKey"in h.mesh?h.mesh.sortKey:null),(a(u,"mesh.factory")||"dictionary"===h.mesh.factory.symbology.type)&&(this._factory=await c.create(d,this._proxy,h.mesh.factory,s)),this._invalidate(),this._version=e,this._connection.container.updateRenderState(this._version)):void 0}async applyOverride(t){if(!this._strategy)return;const e=this._strategy.applyOverride(t);for await(const r of e)try{await this._process(r)}catch(s){}this._source.applyOverride(t)}async updateChunks(){return this._doUpdateChunks()}async removeChunks(t){this._strategy?.removeChunks(t),this._attributeStore.incrementDisplayIdGeneration()}updateHighlight({highlights:t}){if(!this._strategy)return void this._attributeStore.setHighlight(t.map((({objectId:t,highlightFlags:e})=>({objectId:t,highlightFlags:e,displayId:-1}))),t);const e=this._strategy.displayMap(t,(({objectId:t})=>t),((t,{highlightFlags:e},s)=>({objectId:s,displayId:t,highlightFlags:e})));this._attributeStore.setHighlight(e,t)}async _doUpdateChunks(){if(!this._strategy)return;const t=this._strategy.updateChunks(),e=[];for await(const i of t){const t=this._queue.push(i).catch((t=>s(t)));e.push(t)}try{await Promise.all(e)}catch(r){}has("esri-2d-update-debug")&&console.log("SendUpdates"),await this._attributeStore.sendUpdates(),has("esri-2d-update-debug")&&console.log("SendUpdates.await")}async _updateStrategy(t,e,s,r){switch(this._strategy?.destroy(),t.type){case"feature":this._strategy=new d(this._source,this._attributeStore,r);break;case"binning":this._strategy=await u.create(t,e,this._source,this._attributeStore,r);break;case"cluster":this._strategy=await g.create(this._connection,t,e,this._source,this._attributeStore,r)}for(const i of s)this._strategy.onSubscribe(i)}async _updateSortKey(e,s){if(this._sortInfo=t(this._sortInfo?.computed),null!=s){const t=s.byRenderer?null:await e.createComputedField(s);this._sortInfo={...s,computed:t}}}_invalidate(){this._strategy&&this._strategy.invalidate()}async _process(t){const e=t.subscription;if(has("esri-2d-update-debug")){const s=e.tile;console.debug(`Version[${this._version}] Tile[${s.key.id}, end=${t.end}] Processor._process`)}await this._fetchResources(t),r(e.signal);const s=await this._write(t,e.tile.createArcadeEvaluationOptions(this._schema.mesh.timeZone)),i=e.tile.tileInfoView.tileInfo.isWrappable,{message:a,transferList:o}=s.serialize(i),n=t.createMessage(a,this._version,this._attributeStore.epoch);if(r(e.signal),await this._connection.container.onMessage(n,{signal:e.signal,transferList:o}),await this._attributeStore.sendUpdates(),has("esri-2d-update-debug")){const s=e.tile;console.debug(`Version[${this._version}] Tile[${s.key.id}, end=${t.end}] Processor._process.await`)}}async _fetchResources(t){await this._fetchMatcherResources(t),await this._fetchWriterResources(t)}async _fetchMatcherResources(t){if(t.reader)return this._factory.enqueueMatcherRequests(this._proxy,t.reader)}async _fetchWriterResources(t){if(!t.reader)return;const e=t.reader.getCursor(),s=t.subscription.tile.createArcadeEvaluationOptions(this._schema.mesh.timeZone);for(;e.next();)this._factory.enqueueWriterRequests(this._proxy,e,s);await this._proxy.fetchEnqueuedResources()}async _write(t,e){const s=t.subscription.tile,r=t.reader?.getCursor(),i=r?.getSize()??0,a=new n(s.key.id,this._strategy.enablePixelBuffering,i);if(!r)return a;const o=s.createArcadeEvaluationOptions(this._schema.mesh.timeZone);for(;r.next();){const t=this._getSortKeyValue(r,e);a.entityStart(r.getDisplayId(),t),this._factory.write(a,this._proxy,r,o,s.level),a.entityEnd()}return a}_getSortKeyValue(t,e){if(!this._sortInfo)return 0;const{computed:s,order:r,byRenderer:i}=this._sortInfo,a=i?this._factory.getSortKey(t,e):s?.read(t,e);return null==a||isNaN(a)?0:a*("asc"===r?-1:1)}}export{l as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{clone as e}from"../../../../../core/lang.js";import{isHostedAgolService as r}from"../../../../../layers/support/arcgisLayerUrl.js";import{getEffectiveLayerCapabilities as t}from"../../../../../layers/support/layerUtils.js";import{getEffectiveGeometryType as i}from"./geometryUtils.js";import{getLayerDeconflictionEnabled as s,createLabelVVEvaluator as o}from"./labelingUtils.js";import{createFeatureSourceSchema as
|
|
5
|
+
import{clone as e}from"../../../../../core/lang.js";import{isHostedAgolService as r}from"../../../../../layers/support/arcgisLayerUrl.js";import{getEffectiveLayerCapabilities as t}from"../../../../../layers/support/layerUtils.js";import{getEffectiveGeometryType as i}from"./geometryUtils.js";import{getLayerDeconflictionEnabled as s,createLabelVVEvaluator as o}from"./labelingUtils.js";import{createFeatureSourceSchema as a}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as l}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as n}from"../support/rendererUtils.js";class d{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const r=this.layer,t=s(r);return[{vvEvaluators:{0:o(r.renderer)},deconflictionEnabled:t}]}async createServiceOptions(s){const o=this.layer,a=o.parent,l=t(a),{capabilities:n,editingInfo:d,objectIdField:p,globalIdField:c,datesInUnknownTimezone:m,orderBy:y,subtypeField:f,parsedUrl:u}=a,b=a.fieldsIndex.toJSON(),g=i(o),h=a.timeInfo?.toJSON(),I=o.spatialReference.toJSON(),S=e(u);let j=p;if(y?.length){const e=!y[0].valueExpression&&y[0].field;e&&(j=e)}return{type:"feature-service",source:S,isSourceHosted:r(S.path),orderByFields:j,metadata:{timeReferenceUnknownClient:m,subtypeField:f,globalIdField:c,fieldsIndex:b,geometryType:g,objectIdField:p,timeInfo:h,spatialReference:I,subtypes:null,typeIdField:null,types:null},queryMetadata:{capabilities:n,effectiveCapabilities:l,lastEditDate:d?.lastEditDate?.getTime(),snapshotInfo:null}}}createSourceSchema(e,r,t){const{definitionExpression:i,customParameters:s,timeExtent:o,apiKey:l}=this.layer.parent;return a(e,{definitionExpression:i,customParameters:s,timeExtent:o},r,t,l)}createProcessorSchema(e,r,t){const{parent:{fields:i,geometryType:s,orderBy:o,objectIdField:a},renderer:n,labelingInfo:d,labelsVisible:p}=this.layer,c={featureReduction:null,fields:i.map((e=>e.toJSON())),geometryType:s,labelingInfo:d,labelsVisible:p,objectIdField:a,orderBy:o??"default",renderer:n?.clone()};return l(e,r,c,t)}get hasRequiredSupport(){return n(this.layer.renderer)}getUpdateHashProperties(e){const r=this.layer,{parent:t,parent:{definitionExpression:i,apiKey:s},renderer:o}=r,a=this.layer.labelsVisible?this.layer.labelingInfo:null;return{apiKey:s,customParameters:JSON.stringify(t.customParameters),definitionExpression:i,labelingInfo:a,orderBy:JSON.stringify(t.orderBy),renderer:o}}setGraphicOrigin(e){e.origin={type:"catalog",layer:this.layer}}}export{d as CatalogFootprintLayerAdapter};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../../../../core/has.js";import{clone as e}from"../../../../../core/lang.js";import{isHostedAgolService as t}from"../../../../../layers/support/arcgisLayerUrl.js";import{getEffectiveLayerCapabilities as r}from"../../../../../layers/support/layerUtils.js";import{getEffectiveFeatureReduction as s}from"./featureReductionUtils.js";import{exceedsMinimumSnapshotCoverage as i}from"./featureServiceUtils.js";import{hasFloorFilter as o,addFloorFilter as a}from"./floorFilterUtils.js";import{getEffectiveGeometryType as l}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as n,getLayerDeconflictionEnabled as d,createLabelVVEvaluator as p}from"./labelingUtils.js";import{createFeatureSourceSchema as
|
|
5
|
+
import has from"../../../../../core/has.js";import{clone as e}from"../../../../../core/lang.js";import{isHostedAgolService as t}from"../../../../../layers/support/arcgisLayerUrl.js";import{getEffectiveLayerCapabilities as r}from"../../../../../layers/support/layerUtils.js";import{getEffectiveFeatureReduction as s}from"./featureReductionUtils.js";import{exceedsMinimumSnapshotCoverage as i}from"./featureServiceUtils.js";import{hasFloorFilter as o,addFloorFilter as a}from"./floorFilterUtils.js";import{getEffectiveGeometryType as l}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as n,getLayerDeconflictionEnabled as d,createLabelVVEvaluator as p}from"./labelingUtils.js";import{createFeatureSourceSchema as y}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as m}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as c}from"../support/rendererUtils.js";class u{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const t=this.layer,r=n(t,e)??d(t);return[{vvEvaluators:{0:p(t.renderer)},deconflictionEnabled:r}]}async createServiceOptions(s){const o=this.layer,a=r(o),{capabilities:n,editingInfo:d,objectIdField:p,typeIdField:y,globalIdField:m,datesInUnknownTimezone:c,orderBy:u,subtypeField:f,refreshInterval:h}=o,b=o.fieldsIndex.toJSON(),g=b.fields,S=l(o),I=o.timeInfo?.toJSON(),j=o.spatialReference.toJSON(),F=o.types?.map((e=>e.toJSON())),x=e(this.layer.parsedUrl);this.layer.dynamicDataSource&&(x.query={layer:JSON.stringify({source:this.layer.dynamicDataSource})});let E=this.layer.objectIdField;if(u?.length){const e=!u[0].valueExpression&&u[0].field;e&&(E=e)}const U=!(null!=d?.lastEditDate)&&h>0,v=has("featurelayer-snapshot-enabled")&&"point"===o.geometryType&&n?.query.supportsPagination&&!n?.operations.supportsEditing&&!U,O=v&&i(s,o.fullExtent);return{type:"feature-service",source:x,isSourceHosted:t(x.path),orderByFields:E,metadata:{typeIdField:y??void 0,types:F,timeReferenceUnknownClient:c,subtypeField:f,globalIdField:m,fields:g,fieldsIndex:b,geometryType:S,objectIdField:p,timeInfo:I,spatialReference:j,subtypes:this.layer.subtypes?.map((e=>e.toJSON()))},queryMetadata:{capabilities:n,effectiveCapabilities:a,lastEditDate:d?.lastEditDate?.getTime(),snapshotInfo:{supportsSnapshotMinThreshold:v,supportsSnapshotMaxThreshold:O,snapshotCountThresholds:{min:has("featurelayer-snapshot-point-min-threshold"),max:has("featurelayer-snapshot-point-max-threshold")}}}}}createSourceSchema(e,t,r){const{definitionExpression:s,customParameters:i,gdbVersion:o,historicMoment:a,subtypeCode:l,subtypeField:n,timeExtent:d,apiKey:p}=this.layer;return y(e,{definitionExpression:s,customParameters:i,gdbVersion:o,historicMoment:a,subtypeCode:l,subtypeField:n,timeExtent:d},t,r,p)}createProcessorSchema(e,t,r){const{fields:i,renderer:o,geometryType:a,labelingInfo:l,labelsVisible:n,orderBy:d,objectIdField:p}=this.layer,y={fields:i.map((e=>e.toJSON())),renderer:o?.clone(),featureReduction:s(this.layer,t),geometryType:a,labelingInfo:l,labelsVisible:n,objectIdField:p,orderBy:d??"default"};return m(e,t,y,r)}get hasRequiredSupport(){return c(this.layer.renderer)}hasFilters(e){return o(this.layer,e)}addFilters(e,t){return a(this.layer,e,t)}getUpdateHashProperties(e){const t=this.layer,{definitionExpression:r,renderer:i,gdbVersion:a,apiKey:l,subtypeCode:n}=t,d=this.layer.labelsVisible?this.layer.labelingInfo:null,p=t.historicMoment?.getTime()??void 0,y=JSON.stringify(t.customParameters),m=s(t,e)?.toJSON(),c=JSON.stringify(t.orderBy);return{apiKey:l,customParameters:y,definitionExpression:r,featureReduction:m,floors:o(this.layer,e)?e.floors:null,gdbVersion:a,historicMoment:p,labelingInfo:d,orderBy:c,renderer:i,subtypeCode:n}}}export{u as FeatureLayerAdapter};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../../core/Error.js";import{getEffectiveLayerCapabilities as r}from"../../../../../layers/support/layerUtils.js";import{getEffectiveFeatureReduction as t}from"./featureReductionUtils.js";import{getEffectiveGeometryType as i}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as o,getLayerDeconflictionEnabled as
|
|
5
|
+
import e from"../../../../../core/Error.js";import{getEffectiveLayerCapabilities as r}from"../../../../../layers/support/layerUtils.js";import{getEffectiveFeatureReduction as t}from"./featureReductionUtils.js";import{getEffectiveGeometryType as i}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as o,getLayerDeconflictionEnabled as s,createLabelVVEvaluator as l}from"./labelingUtils.js";import{createFeatureSourceSchema as n}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as a}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as c}from"../support/rendererUtils.js";function d(r){if(!("openPorts"in r))throw new e("source-not-supported")}class p{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const r=this.layer,t=o(r,e)??s(r);return[{vvEvaluators:{0:l(r.renderer)},deconflictionEnabled:t}]}async createServiceOptions(e){const t=this.layer,o=r(t),{capabilities:s,objectIdField:l}=t,n=t.fieldsIndex.toJSON(),a=i(t),c=t.timeInfo?.toJSON(),p=t.spatialReference.toJSON();d(t.source);return{type:"memory",source:await t.source.openPorts(),orderByFields:l,metadata:{fieldsIndex:n,geometryType:a,objectIdField:l,timeInfo:c,spatialReference:p,subtypes:null,subtypeField:null,globalIdField:null,typeIdField:null,types:null,timeReferenceUnknownClient:null},queryMetadata:{capabilities:s,effectiveCapabilities:o,lastEditDate:null,snapshotInfo:null}}}createSourceSchema(e,r,t){const{definitionExpression:i,timeExtent:o}=this.layer;return n(e,{definitionExpression:i,timeExtent:o,customParameters:null},r,t,null)}createProcessorSchema(e,r,i){const{fields:o,renderer:s,geometryType:l,labelingInfo:n,labelsVisible:c,orderBy:d,objectIdField:p}=this.layer,u={fields:o.map((e=>e.toJSON())),renderer:s?.clone(),featureReduction:t(this.layer,r),geometryType:l,labelingInfo:n,labelsVisible:c,objectIdField:p,orderBy:d??"default"};return a(e,r,u,i)}get hasRequiredSupport(){return c(this.layer.renderer)}getUpdateHashProperties(e){const r=this.layer,{definitionExpression:i,renderer:o}=r,s=this.layer.labelsVisible?this.layer.labelingInfo:null,l=t(r,e)?.toJSON();return{orderBy:JSON.stringify(r.orderBy),definitionExpression:i,renderer:o,labelingInfo:s,featureReduction:l}}}export{p as InMemoryLayerAdapter};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{getEffectiveLayerCapabilities as e}from"../../../../../layers/support/layerUtils.js";import{getEffectiveFeatureReduction as r}from"./featureReductionUtils.js";import{getEffectiveGeometryType as t}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as i,getLayerDeconflictionEnabled as l,createLabelVVEvaluator as
|
|
5
|
+
import{getEffectiveLayerCapabilities as e}from"../../../../../layers/support/layerUtils.js";import{getEffectiveFeatureReduction as r}from"./featureReductionUtils.js";import{getEffectiveGeometryType as t}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as i,getLayerDeconflictionEnabled as l,createLabelVVEvaluator as s}from"./labelingUtils.js";import{createFeatureSourceSchema as o}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as n}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as a}from"../support/rendererUtils.js";class c{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const r=this.layer,t=i(r,e)??l(r);return[{vvEvaluators:{0:s(r.renderer)},deconflictionEnabled:t}]}async createServiceOptions(r){const i=this.layer,l=e(i),{capabilities:s,objectIdField:o}=i,n=i.fieldsIndex.toJSON(),a=t(i),c=i.spatialReference.toJSON();return{type:"memory",source:await i.source.openPorts(),orderByFields:o,metadata:{fieldsIndex:n,geometryType:a,objectIdField:o,spatialReference:c,globalIdField:null,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,typeIdField:null,types:null},queryMetadata:{capabilities:s,effectiveCapabilities:l,lastEditDate:null,snapshotInfo:null}}}createSourceSchema(e,r,t){const{definitionExpression:i}=this.layer;return o(e,{definitionExpression:i,customParameters:null},r,t,null)}createProcessorSchema(e,t,i){const{fields:l,renderer:s,geometryType:o,labelingInfo:a,labelsVisible:c,objectIdField:d}=this.layer,p={fields:l.map((e=>e.toJSON())),renderer:s?.clone(),featureReduction:r(this.layer,t),geometryType:o,labelingInfo:a,labelsVisible:c,objectIdField:d,orderBy:"default"};return n(e,t,p,i)}get hasRequiredSupport(){return a(this.layer.renderer)}getUpdateHashProperties(e){const t=this.layer,{definitionExpression:i,renderer:l}=t,s=this.layer.labelsVisible?this.layer.labelingInfo:null,o=r(t,e)?.toJSON();return{definitionExpression:i,renderer:l,labelingInfo:s,featureReduction:o}}}export{c as KnowledgeGraphSublayerAdapter};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{clone as e}from"../../../../../core/lang.js";import{getEffectiveLayerCapabilities as r}from"../../../../../layers/support/layerUtils.js";import{getEffectiveFeatureReduction as t}from"./featureReductionUtils.js";import{getEffectiveGeometryType as o}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as i,getLayerDeconflictionEnabled as l,createLabelVVEvaluator as s}from"./labelingUtils.js";import{createFeatureSourceSchema as a}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as n}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as c}from"../support/rendererUtils.js";class d{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const r=this.layer,t=i(r,e)??l(r);return[{vvEvaluators:{0:s(r.renderer)},deconflictionEnabled:t}]}async createServiceOptions(t){const i=this.layer,l=r(i),{capabilities:s,objectIdField:a}=i,n=i.fieldsIndex.toJSON(),c=o(i),d=i.timeInfo?.toJSON(),m=i.spatialReference.toJSON(),u=i.source.getSource(),p=this.layer.objectIdField,y=e(s);return y.query.maxRecordCount=u.maxRecordCount,{type:"ogc",source:u,orderByFields:p,metadata:{fieldsIndex:n,geometryType:c,objectIdField:a,timeInfo:d,spatialReference:m,globalIdField:null,subtypeField:null,subtypes:null,timeReferenceUnknownClient:null,typeIdField:null,types:null
|
|
5
|
+
import{clone as e}from"../../../../../core/lang.js";import{getEffectiveLayerCapabilities as r}from"../../../../../layers/support/layerUtils.js";import{getEffectiveFeatureReduction as t}from"./featureReductionUtils.js";import{getEffectiveGeometryType as o}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as i,getLayerDeconflictionEnabled as l,createLabelVVEvaluator as s}from"./labelingUtils.js";import{createFeatureSourceSchema as a}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as n}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as c}from"../support/rendererUtils.js";class d{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const r=this.layer,t=i(r,e)??l(r);return[{vvEvaluators:{0:s(r.renderer)},deconflictionEnabled:t}]}async createServiceOptions(t){const i=this.layer,l=r(i),{capabilities:s,objectIdField:a}=i,n=i.fieldsIndex.toJSON(),c=o(i),d=i.timeInfo?.toJSON(),m=i.spatialReference.toJSON(),u=i.source.getSource(),p=this.layer.objectIdField,y=e(s);return y.query.maxRecordCount=u.maxRecordCount,{type:"ogc",source:u,orderByFields:p,metadata:{fieldsIndex:n,geometryType:c,objectIdField:a,timeInfo:d,spatialReference:m,globalIdField:null,subtypeField:null,subtypes:null,timeReferenceUnknownClient:null,typeIdField:null,types:null},queryMetadata:{capabilities:y,effectiveCapabilities:l,lastEditDate:null,snapshotInfo:null}}}createSourceSchema(e,r,t){const{customParameters:o,timeExtent:i,apiKey:l}=this.layer;return a(e,{customParameters:o,timeExtent:i},r,t,l)}createProcessorSchema(e,r,o){const{fields:i,renderer:l,geometryType:s,labelingInfo:a,labelsVisible:c,orderBy:d,objectIdField:m}=this.layer,u={fields:i.map((e=>e.toJSON())),renderer:l?.clone(),featureReduction:t(this.layer,r),geometryType:s,labelingInfo:a,labelsVisible:c,objectIdField:m,orderBy:d??"default"};return n(e,r,u,o)}get hasRequiredSupport(){return c(this.layer.renderer)}getUpdateHashProperties(e){const r=this.layer,{renderer:o,apiKey:i}=r,l=this.layer.labelsVisible?this.layer.labelingInfo:null,s=JSON.stringify(r.customParameters),a=t(r,e)?.toJSON();return{apiKey:i,customParameters:s,featureReduction:a,labelingInfo:l,orderBy:JSON.stringify(r.orderBy),renderer:o}}}export{d as OGCFeatureLayerAdapter};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../../../../core/has.js";import{clone as e}from"../../../../../core/lang.js";import{isHostedAgolService as r}from"../../../../../layers/support/arcgisLayerUrl.js";import{getEffectiveLayerCapabilities as t}from"../../../../../layers/support/layerUtils.js";import{getEffectiveFeatureReduction as s}from"./featureReductionUtils.js";import{exceedsMinimumSnapshotCoverage as o}from"./featureServiceUtils.js";import{hasFloorFilter as i,addFloorFilter as l}from"./floorFilterUtils.js";import{getEffectiveGeometryType as a}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as n,getLayerDeconflictionEnabled as p,createLabelVVEvaluator as d}from"./labelingUtils.js";import{createFeatureSourceSchema as
|
|
5
|
+
import has from"../../../../../core/has.js";import{clone as e}from"../../../../../core/lang.js";import{isHostedAgolService as r}from"../../../../../layers/support/arcgisLayerUrl.js";import{getEffectiveLayerCapabilities as t}from"../../../../../layers/support/layerUtils.js";import{getEffectiveFeatureReduction as s}from"./featureReductionUtils.js";import{exceedsMinimumSnapshotCoverage as o}from"./featureServiceUtils.js";import{hasFloorFilter as i,addFloorFilter as l}from"./floorFilterUtils.js";import{getEffectiveGeometryType as a}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as n,getLayerDeconflictionEnabled as p,createLabelVVEvaluator as d}from"./labelingUtils.js";import{createFeatureSourceSchema as c}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as f}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as m}from"../support/rendererUtils.js";class u{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const r=this.layer,t=n(r,e)??p(r);return[{vvEvaluators:{0:d(r.renderer)},deconflictionEnabled:t}]}async createServiceOptions(s){const i=this.layer,l=t(i),{capabilities:n,objectIdField:p,globalIdField:d,orderBy:c,refreshInterval:f}=i,m=i.fieldsIndex.toJSON(),u=m.fields,y=a(i),h=i.timeInfo?.toJSON(),b=i.spatialReference.toJSON(),g=e(this.layer.parsedUrl);let S=this.layer.objectIdField;if(c?.length){const e=!c[0].valueExpression&&c[0].field;e&&(S=e)}const I=f>0,j=has("featurelayer-snapshot-enabled")&&"point"===i.geometryType&&n?.query.supportsPagination&&!n?.operations.supportsEditing&&!I,x=j&&o(s,i.fullExtent);return{type:"feature-service",source:g,isSourceHosted:r(g.path),orderByFields:S,metadata:{globalIdField:d,fields:u,fieldsIndex:m,geometryType:y,objectIdField:p,timeInfo:h,spatialReference:b,timeReferenceUnknownClient:!1,subtypeField:null,subtypes:null,typeIdField:null,types:null},queryMetadata:{capabilities:n,effectiveCapabilities:l,lastEditDate:null,snapshotInfo:{supportsSnapshotMinThreshold:j,supportsSnapshotMaxThreshold:x,snapshotCountThresholds:{min:has("featurelayer-snapshot-point-min-threshold"),max:has("featurelayer-snapshot-point-max-threshold")}}}}}createSourceSchema(e,r,t){const{definitionExpression:s,customParameters:o,timeExtent:i}=this.layer;return c(e,{definitionExpression:s,customParameters:o,timeExtent:i},r,t,null)}createProcessorSchema(e,r,t){const{fields:o,renderer:i,geometryType:l,labelingInfo:a,labelsVisible:n,orderBy:p,objectIdField:d}=this.layer,c={fields:o.map((e=>e.toJSON())),renderer:i?.clone(),featureReduction:s(this.layer,r),geometryType:l,labelingInfo:a,labelsVisible:n,objectIdField:d,orderBy:p??"default"};return f(e,r,c,t)}get hasRequiredSupport(){return m(this.layer.renderer)}hasFilters(e){return i(this.layer,e)}addFilters(e,r){return l(this.layer,e,r)}getUpdateHashProperties(e){const r=this.layer,{definitionExpression:t,renderer:o}=r,l=this.layer.labelsVisible?this.layer.labelingInfo:null,a=JSON.stringify(r.customParameters),n=s(r,e)?.toJSON();return{orderBy:JSON.stringify(r.orderBy),definitionExpression:t,renderer:o,labelingInfo:l,featureReduction:n,customParameters:a,floors:i(this.layer,e)?e.floors:null}}}export{u as OrientedImageryLayerAdapter};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{getEffectiveFeatureReduction as e}from"./featureReductionUtils.js";import{getEffectiveGeometryType as t}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as r,getLayerDeconflictionEnabled as i,createLabelVVEvaluator as n}from"./labelingUtils.js";import{createSimpleProcessorSchema as o}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as l}from"../support/rendererUtils.js";class s{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const t=this.layer,o=r(t,e)??i(t);return[{vvEvaluators:{0:n(t.renderer)},deconflictionEnabled:o}]}async createServiceOptions(e){const r=this.layer,{objectIdField:i}=r,n=t(r),o=r.timeInfo?.toJSON()||null,l=r.spatialReference?r.spatialReference.toJSON():null;return{source:this.layer.parsedUrl,metadata:{fieldsIndex:this.layer.fieldsIndex.toJSON(),geometryType:n,objectIdField:i,timeInfo:o,timeReferenceUnknownClient:null,spatialReference:l,subtypeField:null,subtypes:null,globalIdField:null,typeIdField:null,types:null
|
|
5
|
+
import{getEffectiveFeatureReduction as e}from"./featureReductionUtils.js";import{getEffectiveGeometryType as t}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as r,getLayerDeconflictionEnabled as i,createLabelVVEvaluator as n}from"./labelingUtils.js";import{createSimpleProcessorSchema as o}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as l}from"../support/rendererUtils.js";class s{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const t=this.layer,o=r(t,e)??i(t);return[{vvEvaluators:{0:n(t.renderer)},deconflictionEnabled:o}]}async createServiceOptions(e){const r=this.layer,{objectIdField:i}=r,n=t(r),o=r.timeInfo?.toJSON()||null,l=r.spatialReference?r.spatialReference.toJSON():null;return{source:this.layer.parsedUrl,metadata:{fieldsIndex:this.layer.fieldsIndex.toJSON(),geometryType:n,objectIdField:i,timeInfo:o,timeReferenceUnknownClient:null,spatialReference:l,subtypeField:null,subtypes:null,globalIdField:null,typeIdField:null,types:null}}}createSourceSchema(e,t,r){const{definitionExpression:i,geometryDefinition:n,customParameters:o}=this.layer;return{type:"stream",service:e,tileInfoJSON:t.tileInfoJSON,mutable:{sourceRefreshVersion:r,availableFields:t.availableFields,dataFilter:{geometryDefinition:n?.toJSON(),definitionExpression:i,outSpatialReference:t.outSpatialReference.toJSON(),customParameters:o??null,maxReconnectionAttempts:this.layer.maxReconnectionAttempts,maxReconnectionInterval:this.layer.maxReconnectionInterval,purgeOptions:this.layer.purgeOptions.toJSON()}}}}createProcessorSchema(t,r,i){const{fields:n,renderer:l,geometryType:s,labelingInfo:a,labelsVisible:c,objectIdField:d}=this.layer,m={fields:n.map((e=>e.toJSON())),renderer:l?.clone(),featureReduction:e(this.layer,r),geometryType:s,labelingInfo:a,labelsVisible:c,objectIdField:d,orderBy:"default"};return o(t,r,m,i)}get hasRequiredSupport(){return l(this.layer.renderer)}getUpdateHashProperties(t){const r=this.layer,{definitionExpression:i,renderer:n}=r,o=this.layer.labelsVisible?this.layer.labelingInfo:null,l=JSON.stringify(r.customParameters),s=e(r,t)?.toJSON();return{definitionExpression:i,renderer:n,labelingInfo:o,featureReduction:s,customParameters:l,streamFilter:`${JSON.stringify(r.geometryDefinition)}${r.definitionExpression}`}}}export{s as StreamLayerAdapter};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../../../../core/has.js";import{clone as e}from"../../../../../core/lang.js";import{floatEqualAbsolute as t}from"../../../../../core/mathUtils.js";import{sqlAnd as r}from"../../../../../core/sql.js";import{isHostedAgolService as s}from"../../../../../layers/support/arcgisLayerUrl.js";import i from"../../../../../layers/support/FeatureFilter.js";import{getEffectiveLayerCapabilities as a}from"../../../../../layers/support/layerUtils.js";import{exceedsMinimumSnapshotCoverage as o}from"./featureServiceUtils.js";import{hasFloorFilter as l,addFloorFilter as n}from"./floorFilterUtils.js";import{getEffectiveGeometryType as p}from"./geometryUtils.js";import{getLayerDeconflictionEnabled as y}from"./labelingUtils.js";import{createFeatureSourceSchema as u}from"../schema/SourceSchema.js";import{createSubtypeProcessorSchema as m}from"../schema/processor/SubtypeProcessorSchema.js";class c{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){return[{vvEvaluators:{},deconflictionEnabled:this.layer.sublayers.every((e=>y(e)))}]}async createServiceOptions(t){const r=this.layer,i=a(r),{capabilities:l,datesInUnknownTimezone:n,editingInfo:y,globalIdField:u,objectIdField:m,refreshInterval:c,subtypeField:d}=r,h=r.fieldsIndex.toJSON(),b=p(r),f=r.timeInfo?.toJSON(),g=r.spatialReference.toJSON(),S=e(this.layer.parsedUrl),F=m,I=!(null!=y?.lastEditDate)&&c>0,j=has("featurelayer-snapshot-enabled")&&"point"===r.geometryType&&l?.query.supportsPagination&&!l?.operations.supportsEditing&&!I,x=j&&o(t,r.fullExtent);return{type:"feature-service",source:S,isSourceHosted:s(S.path),orderByFields:F,metadata:{timeReferenceUnknownClient:n,subtypeField:d,globalIdField:u,fieldsIndex:h,geometryType:b,objectIdField:m,timeInfo:f,
|
|
5
|
+
import has from"../../../../../core/has.js";import{clone as e}from"../../../../../core/lang.js";import{floatEqualAbsolute as t}from"../../../../../core/mathUtils.js";import{sqlAnd as r}from"../../../../../core/sql.js";import{isHostedAgolService as s}from"../../../../../layers/support/arcgisLayerUrl.js";import i from"../../../../../layers/support/FeatureFilter.js";import{getEffectiveLayerCapabilities as a}from"../../../../../layers/support/layerUtils.js";import{exceedsMinimumSnapshotCoverage as o}from"./featureServiceUtils.js";import{hasFloorFilter as l,addFloorFilter as n}from"./floorFilterUtils.js";import{getEffectiveGeometryType as p}from"./geometryUtils.js";import{getLayerDeconflictionEnabled as y}from"./labelingUtils.js";import{createFeatureSourceSchema as u}from"../schema/SourceSchema.js";import{createSubtypeProcessorSchema as m}from"../schema/processor/SubtypeProcessorSchema.js";class c{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){return[{vvEvaluators:{},deconflictionEnabled:this.layer.sublayers.every((e=>y(e)))}]}async createServiceOptions(t){const r=this.layer,i=a(r),{capabilities:l,datesInUnknownTimezone:n,editingInfo:y,globalIdField:u,objectIdField:m,refreshInterval:c,subtypeField:d}=r,h=r.fieldsIndex.toJSON(),b=p(r),f=r.timeInfo?.toJSON(),g=r.spatialReference.toJSON(),S=e(this.layer.parsedUrl),F=m,I=!(null!=y?.lastEditDate)&&c>0,j=has("featurelayer-snapshot-enabled")&&"point"===r.geometryType&&l?.query.supportsPagination&&!l?.operations.supportsEditing&&!I,x=j&&o(t,r.fullExtent);return{type:"feature-service",source:S,isSourceHosted:s(S.path),orderByFields:F,metadata:{timeReferenceUnknownClient:n,subtypeField:d,globalIdField:u,fieldsIndex:h,geometryType:b,objectIdField:m,timeInfo:f,spatialReference:g,subtypes:this.layer.subtypes?.map((e=>e.toJSON())),typeIdField:null,types:null},queryMetadata:{capabilities:l,effectiveCapabilities:i,lastEditDate:y?.lastEditDate?.getTime(),snapshotInfo:{supportsSnapshotMinThreshold:j,supportsSnapshotMaxThreshold:x,snapshotCountThresholds:{min:has("featurelayer-snapshot-point-min-threshold"),max:has("featurelayer-snapshot-point-max-threshold")}}}}}createSourceSchema(e,t,s){const{definitionExpression:i,customParameters:a,gdbVersion:o,historicMoment:l,subtypeField:n,timeExtent:p,apiKey:y}=this.layer,m=this.layer.sublayers.map((e=>e.subtypeCode)).join(","),c=this.layer.sublayers.length?`${this.layer.subtypeField} IN (${m})`:"1=2",d={definitionExpression:r(i,c),customParameters:a,gdbVersion:o,historicMoment:l,subtypeField:n,timeExtent:p};return u(e,d,t,s,y)}createProcessorSchema(e,t,r){const s={subtypeField:this.layer.subtypeField,sublayers:Array.from(this.layer.sublayers,(e=>({featureReduction:null,geometryType:this.layer.geometryType,labelingInfo:e.labelingInfo,labelsVisible:e.labelsVisible,renderer:e.renderer,subtypeCode:e.subtypeCode,orderBy:null})))};return m(e,t,s,r)}hasFilters(e){return l(this.layer,e)||d(this.layer,e)}addFilters(e,t){e=n(this.layer,e,t);const s=this.layer.sublayers.filter((e=>!h(e,t))).map((e=>e.subtypeCode));if(!s.length)return e;e??=new i;const a=`NOT ${this.layer.subtypeField} IN (${s.join(",")})`;return e.where=r(e.where,a),e}get hasRequiredSupport(){return!0}getUpdateHashProperties(e){const t=this.layer,{definitionExpression:r,gdbVersion:s,apiKey:i}=t,a=t.historicMoment?.getTime()??void 0,o=JSON.stringify(t.customParameters),n=l(this.layer,e)?e.floors:null;return{gdbVersion:s,definitionExpression:r,historicMoment:a,customParameters:o,apiKey:i,sublayerHash:"sublayers"in this.layer&&this.layer.sublayers.items.reduce(((e,t)=>e+`${t.visible?1:0}.${JSON.stringify(t.renderer)}.${t.labelsVisible}\n.${JSON.stringify(t.labelingInfo)}`),""),floors:n}}setGraphicOrigin(e){const t=this.layer.fieldsIndex.get(this.layer.subtypeField),r=e.attributes[t.name],s=this.layer.sublayers.find((e=>e.subtypeCode===r));e.layer=e.sourceLayer=s}}function d(e,t){return e.sublayers.some((e=>!h(e,t)))}function h(e,r){return e.visible&&(0===e.minScale||t(r.scale,e.minScale)||r.scale<e.minScale)&&(0===e.maxScale||t(r.scale,e.maxScale)||r.scale>e.maxScale)}export{c as SubtypeGroupLayerAdapter};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{getGeohashBounds as e}from"../../../../../geohash/geohashUtils.js";import{unquantizeOptimizedGeometry as t,convertToFeature as s}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as r}from"../../../../../layers/graphics/OptimizedFeature.js";import{ComputedAggregateField as a}from"../aggregation/ComputedAggregateField.js";import{AAggregateStrategy as
|
|
5
|
+
import"../../../../../geometry.js";import{getGeohashBounds as e}from"../../../../../geohash/geohashUtils.js";import{unquantizeOptimizedGeometry as t,convertToFeature as s}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as r}from"../../../../../layers/graphics/OptimizedFeature.js";import{checkProjectionSupport as o}from"../../../../../layers/graphics/data/projectionSupport.js";import{ComputedAggregateField as a}from"../aggregation/ComputedAggregateField.js";import{AAggregateStrategy as i}from"./AAggregateStrategy.js";import{ASendState as n}from"./AProcessorStrategy.js";import{FeatureTileUpdateMessage as l}from"../sources/FeatureSourceMessage.js";import{ComputedAttributeStorage as d}from"../support/ComputedAttributeStorage.js";import c from"../support/FeatureFilter.js";import{FeatureMetadata as u}from"../support/FeatureMetadata.js";import{FeatureSetReaderJSON as p}from"../support/FeatureSetReaderJSON.js";import f from"../../../tiling/TileKey.js";import h from"../../../../../geometry/SpatialReference.js";class m extends n{constructor(e,t){super(e),this.bins=new Map,this.done=!1,this._store=t}reset(){this.destroy(),this.bins.clear(),this.done=!1,this.handledChunks.clear()}destroy(){const e=this.subscription.tile.key.level;for(const t of this.bins.values()){const s=t.cachedFeature?.objectId;null!=s&&this._store.releaseDisplayIdForObjectId(`${s}.${e}`)}}*featuresWorldSpace(){for(const e of this.bins.values()){const s=e.cachedFeature;if(s){const e=s.clone();t(e.geometry,e.geometry,!1,!1,this.subscription.tile.transform),yield e}}}getGeohashBounds(t,s){const r=this.subscription.tile;return e(r.extent,r.resolution,s,t)}}class g extends i{static async create(e,t,s,r,i){const n=new d({spatialReference:t}),l=e.fixedBinLevel,u=await Promise.all(e.fields.map((async e=>a.create(n,e)))),p=e.featureFilter?await c.create({geometryType:s.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:s.metadata.timeInfo,fieldsIndex:s.metadata.fieldsIndex,spatialReference:t,filterJSON:e.featureFilter}):null;return await o(t,h.WGS84),new g({fields:u,geohashLevel:l,spatialReference:t,featureFilter:p,timeZone:i},e.fields,s,r)}constructor(e,t,s,r){super(s,r,e.spatialReference,e.fields),this._indexOptions=e,this._metadata=new u({geometryType:"esriGeometryPolygon",objectIdField:"aggregateId",fields:t,globalIdField:null,spatialReference:s.metadata.spatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,typeIdField:null,types:null})}createState(e){return new m(e,this._attributeStore)}async*applyOverride(e){for(const t of this._sendStates.values())t.reset()}displayMap(e,t,s){const r=new Map(e.map((e=>[t(e),e]))),o=[];for(const a of this._sendStates.values())for(const e of a.featuresWorldSpace()){const{objectId:t,displayId:a}=e,i=r.get(t);if(null!=i){const e=s(a,i,t);o.push(e),r.delete(t)}}return o}getDisplayFeatures(e){const t=new Set(e),r=new Set,o=[];for(const a of this._sendStates.values())for(const e of a.featuresWorldSpace())t.has(e.displayId)&&!r.has(e.objectId)&&(e.geometry&&o.push({...s(e,this._metadata.geometryType,!1,!1),displayId:e.displayId}),r.add(e.objectId));return{features:[],aggregates:o}}getFeatureObjectIdsForAggregate(e){for(const t of this._sendStates.values())for(const s of t.bins.values())if(s.id===e)return Array.from(s.objectIds);return[]}async*updateChunks(){if(this._source.chunks().length)for(const e of this._sendStates.values())yield*this._update(e,this._source)}forEachAggregateWorldSpace(e){for(const t of this._sendStates.values())for(const s of t.featuresWorldSpace())e(s)}async*_update(e,t){const{handledChunks:s,subscription:o,bins:a}=e,{spatialReference:i,geohashLevel:n}=this._indexOptions,d=o.tile;if(e.done)return;for(const r of t.chunks()){if(s.has(r.chunkId))continue;s.add(r.chunkId);const t=r.queryInfo;if("tileId"in t){const e=new f(t.tileId);if(e.level!==d.level||e.world!==d.key.world)continue}const o=r.getGeohashIndex(this._indexOptions),l=e.getGeohashBounds(i,n);null!=l&&o.putBins(a,l)}const c=[],u=o.tile.transform,h=o.tile.key.level;for(const l of a.values()){if(l.cachedFeature)l.cachedFeature.attributes=l.getAttributes();else{const e=l.getGeometry(this.spatialReference,u),t=new r(e,l.getAttributes(),null);e||(t.centroid=l.getGeometryCentroid(this.spatialReference,u)),t.objectId=l.id,t.displayId=this._attributeStore.createDisplayIdForObjectId(`${t.objectId}.${h}`),l.cachedFeature=t}c.push(l.cachedFeature)}this.events.emit("changed"),e.done=!t.updateTracking.updating;const m=p.fromOptimizedFeatures(c,this._metadata,u),g=m.getCursor(),y=e.subscription.tile.createArcadeEvaluationOptions(this._indexOptions.timeZone);for(;g.next();)this._attributeStore.setAttributeData(g.getDisplayId(),g,y);const b=new l(e.subscription,m,[],e.done,{});yield b}}export{m as BinningState,g as BinningStrategy};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{convertToFeature as e}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as t}from"../../../../../layers/graphics/OptimizedFeature.js";import{tileSize as s}from"../../../engine/webgl/definitions.js";import{ComputedAggregateField as i}from"../aggregation/ComputedAggregateField.js";import{GridCell as r}from"../aggregation/GridCell.js";import{pixelsPerMapUnit as a}from"../aggregation/GridSpatialIndex.js";import{AAggregateStrategy as n}from"./AAggregateStrategy.js";import{ASendState as l}from"./AProcessorStrategy.js";import{WithDisplayId as o}from"./support/WithDisplayId.js";import{FeatureTileAppendMessage as d}from"../sources/FeatureSourceMessage.js";import{ComputedAttributeStorage as c}from"../support/ComputedAttributeStorage.js";import u from"../support/FeatureFilter.js";import{FeatureMetadata as h}from"../support/FeatureMetadata.js";import{FeatureSetReaderJSON as p}from"../support/FeatureSetReaderJSON.js";import f from"../../../tiling/TileKey.js";const g=128;class
|
|
5
|
+
import{convertToFeature as e}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as t}from"../../../../../layers/graphics/OptimizedFeature.js";import{tileSize as s}from"../../../engine/webgl/definitions.js";import{ComputedAggregateField as i}from"../aggregation/ComputedAggregateField.js";import{GridCell as r}from"../aggregation/GridCell.js";import{pixelsPerMapUnit as a}from"../aggregation/GridSpatialIndex.js";import{AAggregateStrategy as n}from"./AAggregateStrategy.js";import{ASendState as l}from"./AProcessorStrategy.js";import{WithDisplayId as o}from"./support/WithDisplayId.js";import{FeatureTileAppendMessage as d}from"../sources/FeatureSourceMessage.js";import{ComputedAttributeStorage as c}from"../support/ComputedAttributeStorage.js";import u from"../support/FeatureFilter.js";import{FeatureMetadata as h}from"../support/FeatureMetadata.js";import{FeatureSetReaderJSON as p}from"../support/FeatureSetReaderJSON.js";import f from"../../../tiling/TileKey.js";const g=128;class _ extends l{constructor(e){super(e),this.didSend=!1,this.done=!1}}class m{constructor(e,t,s,i,r){this._level=e,this._scale=t,this._indexOptions=s,this._clusterRadius=i,this._store=r,this._cells=new Map,this._handledChunks=new Set,this._statistics=new Map,this._clusters=new Map}destroy(){this._clearClusters()}_clearClusters(){for(const e of this._clusters.values())this._store.releaseDisplayIdForObjectId(e.inner.id);this._clusters.clear()}*aggregatesWorldSpace(){for(const e of this._clusters.values()){const s=e.inner.getCentroid(null),i=new t(s,e.inner.getAttributes(),null);i.objectId=e.inner.id,i.displayId=e.displayId,yield i}}clusters(){return this._clusters.values()}updateChunks(e){let t=!1;for(const s of e){const e=s.queryInfo;if("tileId"in e){if(new f(e.tileId).level!==this._level)continue}if(!this._handledChunks.has(s.normalizedChunkId)){this._handledChunks.add(s.normalizedChunkId),t=!0;s.getGridIndex({...this._indexOptions,scale:this._scale}).putCells(this._cells)}}return t&&this._clusterCells(),t}async updateStatistics(e){let t=!1;for(const s of this._clusters.values())s.inner.count>1&&(t=this._updateAggregateStatistics(this._statistics,s.inner)||t);if(t){const t=Array.from(this._statistics.entries()).map((([e,t])=>({fieldName:e,minValue:t.minValue,maxValue:t.maxValue})));await e.container.updateStatistics(this._level,t)}}createAggregateFeatures(e,i){const r=e.subscription,a=[],n=r.tile.transform;for(const l of this._clusters.values()){const e=l.inner.getCentroid(n),i=new t(e,l.inner.getAttributes(),null);i.objectId=l.inner.id,i.displayId=l.displayId;const o=i.geometry.coords,d=r.tile.lod,c=d.wrap?d.worldSize[0]:null;if(null!=c)if(1===c){const e=i.clone();e.geometry.coords[0]-=s,a.push(e);const t=i.clone();t.geometry.coords[0]+=s,a.push(t)}else o[0]>s+s/2?o[0]-=c*s:o[0]<-s/2&&(o[0]+=c*s);const[u,h]=i.geometry.coords;u<s+g&&u>=-g&&h<s+g&&h>=-g&&a.push(i)}return p.fromOptimizedFeatures(a,i,r.tile.transform)}_clusterCells(){let e=Array.from(this._cells.values());e=e.sort(((e,t)=>t.count-e.count));const t=[];for(const i of this._clusters.values())t.push(i.inner.id);this._clusters.clear();const s=new Set;for(const i of e){if(s.has(i.id))continue;const e=this._store.createDisplayIdForObjectId(i.id),t=new o(i.clone(),e);s.add(i.id),this._clusters.set(i.id,t);const n=this._clusterRadius*(1/a(this._indexOptions.spatialReference,this._scale)),l=1+this._clusterRadius/this._indexOptions.cellSize,d=i.centroidXWorld,c=i.centroidYWorld;for(let a=i.gridY-l;a<=i.gridY+l;a++)for(let e=i.gridX-l;e<=i.gridX+l;e++){if(a===i.gridY&&e===i.gridX)continue;const l=this._cells.get(r.createId(e,a));if(!l||s.has(l.id))continue;const o=Math.abs(l.centroidXWorld-d),u=Math.abs(l.centroidYWorld-c);o<n&&u<n&&(t.inner.merge(l),s.add(l.id))}}for(const i of t)this._store.releaseDisplayIdForObjectId(i)}_updateAggregateStatistics(e,t){let s=!1;for(const i of t.statistics.values()){if("esriFieldTypeString"===i.field.type)continue;const t=i.value,r=i.field,a=e.get(r.name);if(a){const{minValue:e,maxValue:i}=a,r=Math.min(a.minValue,t),n=Math.max(a.maxValue,t);e===r&&i===n||(a.minValue=r,a.maxValue=n,s=!0)}else e.set(r.name,{minValue:t,maxValue:t}),s=!0}return s}}class y extends n{static async create(e,t,s,r,a,n){const l=new c({spatialReference:s}),o={fields:await Promise.all(t.fields.map((async e=>i.create(l,e)))),spatialReference:s,featureFilter:t.featureFilter?await u.create({geometryType:r.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:r.metadata.timeInfo,fieldsIndex:r.metadata.fieldsIndex,spatialReference:s,filterJSON:t.featureFilter}):null,cellSize:t.clusterRadius/4,timeZone:n};return new y(e,t.clusterRadius,o,t.fields,r,a)}constructor(e,t,s,i,r,a){super(r,a,s.spatialReference,s.fields),this._connection=e,this._clusterRadius=t,this._indexOptions=s,this._cellsPerScale=new Map,this._metadata=new h({geometryType:"esriGeometryPoint",objectIdField:"aggregateId",fields:[...i,...this._source.metadata.fieldsIndex.fields,{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}],globalIdField:null,spatialReference:r.metadata.spatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,typeIdField:null,types:null})}get enablePixelBuffering(){return!1}invalidate(){super.invalidate();for(const e of this._cellsPerScale.values())e.destroy();this._cellsPerScale.clear()}onSubscribe(e){super.onSubscribe(e),this._requiredLevel=e.tile.level,this._requiredScale=e.tile.scale}createState(e){return new _(e)}async*applyOverride(e){for(const t of this._cellsPerScale.values())t.destroy();this._cellsPerScale.clear();for(const t of this._sendStates.values())t.done=!1}displayMap(e,t,s){const i=new Map(e.map((e=>[t(e),e]))),r=[],a=this._getClusterState(this._requiredLevel,this._requiredScale);for(const n of a.clusters()){const e=i.get(n.inner.id);if(null==e){if(1===n.inner.count){const e=i.get(n.inner.firstObjectId);if(null!=e){const t=s(n.displayId,e,n.inner.firstObjectId);r.push(t),i.delete(n.inner.firstObjectId)}}}else{const t=s(n.displayId,e,n.inner.id);r.push(t),i.delete(n.inner.id)}}return r}getDisplayFeatures(t){const s=new Set(t),i=new Set,r=[],a=[],n=this._getClusterState(this._requiredLevel,this._requiredScale);for(const l of n.aggregatesWorldSpace())if(s.has(l.displayId)&&!i.has(l.displayId)){const t=e(l,this._metadata.geometryType,!1,!1);if(i.add(l.displayId),1===t.attributes.cluster_count){r.push({...t,displayId:l.displayId});continue}a.push({...t,displayId:l.displayId})}return{features:r,aggregates:a}}getFeatureObjectIdsForAggregate(e){const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of t.clusters())if(s.inner.id===e)return Array.from(s.inner.objectIds);return[]}async*updateChunks(){const e=this._source.chunks();if(!e.length)return;const t=this._getClusterState(this._requiredLevel,this._requiredScale);if(t.updateChunks(e)||!this._source.updateTracking.updating)for(const r of this._sendStates.values())r.subscription.tile.level===this._requiredLevel&&(r.didSend=!1,r.done=!1);const s=Array.from(this._sendStates.values()).filter((e=>e.done)).map((e=>e.subscription.tile.key)),i=new Set(s);for(const r of this._sendStates.values()){if(this._source.updateTracking.updating){if(s.some((e=>e.containsChild(r.subscription.tile.key))))continue;if(r.subscription.tile.key.getChildKeys().every((e=>i.has(e))))continue}r.didSend||r.subscription.tile.level!==this._requiredLevel||(r.didSend=!0,yield*this._update(r,t,this._source))}await t.updateStatistics(this._connection)}forEachAggregateWorldSpace(e){if(null==this._requiredLevel||null==this._requiredScale)return;const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of t.aggregatesWorldSpace())e(s)}_getClusterState(e,t){if(null==e||null==t)throw new Error("InternalError: Level and scale must be defined");let s=this._cellsPerScale.get(t);return s||(s=new m(e,t,this._indexOptions,this._clusterRadius,this._attributeStore),this._cellsPerScale.set(t,s)),s}async*_update(e,t,s){if(e.done)return;const i=t.createAggregateFeatures(e,this._metadata);this.events.emit("changed"),e.done=!s.updateTracking.updating;const r=i.getCursor(),a=e.subscription.tile.createArcadeEvaluationOptions(this._indexOptions.timeZone);for(;r.next();)this._attributeStore.setAttributeData(r.getDisplayId(),r,a);const n=new d(e.subscription,i,!0,e.done,{});yield n}}export{_ as ClusterState,y as ClusterStrategy};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ASendState as t,AProcessorStrategy as e}from"./AProcessorStrategy.js";import{FeatureTileUpdateMessage as s,FeatureTileAppendMessage as r}from"../sources/FeatureSourceMessage.js";import{OverrideChunk as n}from"../sources/strategies/chunks/OverrideChunk.js";class o extends t{}class a extends e{constructor(t,e){super(t,e),this.handledChunks=new Set,this.handledChunksForIdCreation=new Set,this.handledChunksForAttributeData=new Set}destroy(){super.destroy();for(const t of this._source.chunks())this._cleanupChunkIds(t)}invalidateAttributeData(){this.handledChunksForAttributeData.clear()}onSubscribe(t){super.onSubscribe(t),this._evalOptions=
|
|
5
|
+
import{ASendState as t,AProcessorStrategy as e}from"./AProcessorStrategy.js";import{FeatureTileUpdateMessage as s,FeatureTileAppendMessage as r}from"../sources/FeatureSourceMessage.js";import{OverrideChunk as n}from"../sources/strategies/chunks/OverrideChunk.js";class o extends t{}class a extends e{constructor(t,e,s){super(t,e),this._timeZone=s,this.handledChunks=new Set,this.handledChunksForIdCreation=new Set,this.handledChunksForAttributeData=new Set}destroy(){super.destroy();for(const t of this._source.chunks())this._cleanupChunkIds(t)}invalidateAttributeData(){this.handledChunksForAttributeData.clear()}onSubscribe(t){super.onSubscribe(t),this._evalOptions=t.tile.createArcadeEvaluationOptions(this._timeZone)}createState(t){return new o(t)}get aggregateQueryEngine(){return null}displayMap(t,e,s){const r=new Map(t.map((t=>[e(t),t]))),n=[];for(const o of this._source.chunks()){const t=o.reader.getCursor();for(;t.next();){const e=t.getObjectId(),o=t.getDisplayId(),a=r.get(e);if(null!=a){const t=s(o,a,e);n.push(t),r.delete(e)}}}return n}getDisplayFeatures(t){const e=new Set(t),s=new Set,r=[];for(const n of this._source.chunks()){const t=n.reader.getCursor();for(;t.next();){const n=t.getObjectId(),o=t.getDisplayId();e.has(o)&&!s.has(n)&&(r.push({...t.readLegacyFeatureWorldSpace(),displayId:o}),s.add(n))}}return{features:r,aggregates:[]}}async*applyOverride(t){const e=[],r=t.reader.getCursor();for(;r.next();){const t=r.getObjectId();e.push(t);const s=this._attributeStore.createDisplayIdForObjectId(t);r.setDisplayId(s),this._attributeStore.setAttributeData(s,r,this._evalOptions)}const o=this.getDisplayIds(e),a=this.getDisplayIds(t.removed),i=new n;i.applyOverrides(t);for(const n of this._sendStates.values())yield new s(n.subscription,null,o,!1,i.queryInfo);for(const n of this._sendStates.values()){const t=i.getTileReader(n.subscription.tile);yield new s(n.subscription,t,a,!1,i.queryInfo)}for(const s of t.removed)this._attributeStore.releaseDisplayIdForObjectId(s)}async*updateChunks(){if(this._source.chunks().length){await this._updateAttributeData();for(const t of this._sendStates.values())yield*this._update(t)}}removeChunks(t){for(const e of t)this.handledChunks.delete(e.chunkId),this.handledChunksForAttributeData.delete(e.chunkId),this._cleanupChunkIds(e)}_cleanupChunkIds(t){if(this.handledChunksForIdCreation.has(t.chunkId)){const e=t.reader.getCursor();for(;e.next();){const t=e.getObjectId();this._attributeStore.releaseDisplayIdForObjectId(t)}this.handledChunksForIdCreation.delete(t.chunkId)}}async _updateAttributeData(){for(const t of this._source.chunks()){const{chunkId:e,reader:s}=t;if(!this.handledChunksForIdCreation.has(e)){this.handledChunksForIdCreation.add(e);const t=s.getCursor();for(;t.next();){const e=this._attributeStore.createDisplayIdForObjectId(t.getObjectId());t.setDisplayId(e)}}}for(const t of this._source.chunks())if(!this.handledChunksForAttributeData.has(t.chunkId)){this.handledChunksForAttributeData.add(t.chunkId);const e=t.reader.getCursor();for(;e.next();){const t=e.getDisplayId();this._attributeStore.setAttributeData(t,e,this._evalOptions)}}}*_update(t){const{subscription:e,handledChunks:s}=t;for(const n of this._source.chunks()){const{chunkId:o}=n;if(s.has(o))continue;s.add(o);const a=n.getTileReader(e.tile);a&&(yield new r(t.subscription,a,!1,n.end,n.queryInfo))}}}export{o as DefaultSendState,a as FeatureUpdateStrategy};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{pt2px as e}from"../../../../../../core/screenUtils.js";import r from"../../../../../../layers/support/OrderByInfo.js";import{createLabelMatcherSchema as t}from"./LabelMatcherSchema.js";import{createMatcherSchema as s}from"./MatcherSchema.js";import{createStorageSchema as i}from"./StorageSchema.js";import{createVisualVariableUniforms as n}from"./VisualVariablesSchema.js";async function l(e,r){const i=r.renderer,l=n(i);return{symbology:await s(e,i),labels:await t(e,r,l)}}async function a(e,r,t,s){const n=t.featureReduction;if(n)switch(n.type){case"binning":return u(n,e,r,t,s);case"cluster":return f(n,e,r,t,s)}const a=d(t.orderBy,t.renderer,t.objectIdField);return{storage:i(t.renderer,r.filters),mesh:{displayRefreshVersion:s,strategy:{type:"feature"},factory:await l(e,t),sortKey:a}}}function o(e,r){return e.fields.map((e=>({...e.toJSON(),type:c(e,r)})))}function c(e,r){const{onStatisticExpression:t,onStatisticField:s,statisticType:i}=e;switch(i){case"min":case"max":case"avg":case"avg_angle":case"sum":case"count":return"esriFieldTypeDouble";case"mode":{if(t){const{returnType:e}=t;return e?"string"===e?"esriFieldTypeString":"esriFieldTypeDouble":"esriFieldTypeString"}const e=r.find((e=>e.name===s));return e?e.type:"esriFieldTypeString"}}}async function u(e,r,l,a,c){const u=o(e,a.fields),f=e.renderer,d=await s(r,f),y=i(f,[null,null]),p=n(f),
|
|
5
|
+
import{pt2px as e}from"../../../../../../core/screenUtils.js";import r from"../../../../../../layers/support/OrderByInfo.js";import{createLabelMatcherSchema as t}from"./LabelMatcherSchema.js";import{createMatcherSchema as s}from"./MatcherSchema.js";import{createStorageSchema as i}from"./StorageSchema.js";import{createVisualVariableUniforms as n}from"./VisualVariablesSchema.js";async function l(e,r){const i=r.renderer,l=n(i);return{symbology:await s(e,i),labels:await t(e,r,l)}}async function a(e,r,t,s){const n=t.featureReduction;if(n)switch(n.type){case"binning":return u(n,e,r,t,s);case"cluster":return f(n,e,r,t,s)}const a=d(t.orderBy,t.renderer,t.objectIdField);return{storage:i(t.renderer,r.filters),mesh:{displayRefreshVersion:s,strategy:{type:"feature"},factory:await l(e,t),sortKey:a,timeZone:r.timeZone}}}function o(e,r){return e.fields.map((e=>({...e.toJSON(),type:c(e,r)})))}function c(e,r){const{onStatisticExpression:t,onStatisticField:s,statisticType:i}=e;switch(i){case"min":case"max":case"avg":case"avg_angle":case"sum":case"count":return"esriFieldTypeDouble";case"mode":{if(t){const{returnType:e}=t;return e?"string"===e?"esriFieldTypeString":"esriFieldTypeDouble":"esriFieldTypeString"}const e=r.find((e=>e.name===s));return e?e.type:"esriFieldTypeString"}}}async function u(e,r,l,a,c){const u=o(e,a.fields),f=e.renderer,d=await s(r,f),y=i(f,[null,null]),p=n(f),m=await t(r,{geometryType:"polygon",labelingInfo:e.labelingInfo,labelsVisible:e.labelsVisible},p);return{storage:y,mesh:{displayRefreshVersion:c,strategy:{type:"binning",fields:u,fixedBinLevel:e.fixedBinLevel,featureFilter:l.filters[0]},factory:{labels:m,symbology:d},sortKey:null,timeZone:l.timeZone}}}async function f(r,l,a,c,u){const f=o(r,c.fields),d={type:"cluster",feature:await s(l,r.effectiveFeatureRenderer),cluster:await s(l,r.effectiveClusterRenderer)},y=n(r.effectiveFeatureRenderer),p={type:"cluster",feature:await t(l,c,y),cluster:await t(l,{geometryType:"point",labelingInfo:r.labelingInfo,labelsVisible:r.labelsVisible},y)};return{storage:i(r.effectiveFeatureRenderer,[null,null]),mesh:{displayRefreshVersion:u,strategy:{type:"cluster",fields:f,featureFilter:a.filters[0],clusterRadius:e(r.clusterRadius/2)},factory:{labels:p,symbology:d},sortKey:null,timeZone:a.timeZone}}}function d(e,t,s){const i=null!=t&&"unique-value"===t.type&&t.orderByClassesEnabled;if("default"!==e||i||(e=[new r({field:s,order:"descending"})]),"default"!==e&&e.length){e.length;const r=e[0],t="ascending"===r.order?"asc":"desc";return r.field?{field:r.field,order:t}:r.valueExpression?{expression:r.valueExpression,order:t}:null}if(i){return{byRenderer:!0,order:"asc"}}return null}export{a as createSimpleProcessorSchema,o as getAggregateFields};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{createLabelMatcherSchema as e}from"./LabelMatcherSchema.js";import{createMatcherSchema as r}from"./MatcherSchema.js";import{createVVBindings as t}from"./StorageSchema.js";import{createVisualVariableUniforms as s}from"./VisualVariablesSchema.js";import{getWebGLCapabilities as a}from"../../../../../webgl/capabilities.js";async function i(e,{subtypeField:t,sublayers:s}){const a=await Promise.all(s.map((({renderer:t})=>r(e,t))));return{type:"subtype",subtypeField:t,renderers:s.reduce(((e,{subtypeCode:r},t)=>({...e,[r]:a[t]})),{})}}function
|
|
5
|
+
import{createLabelMatcherSchema as e}from"./LabelMatcherSchema.js";import{createMatcherSchema as r}from"./MatcherSchema.js";import{createVVBindings as t}from"./StorageSchema.js";import{createVisualVariableUniforms as s}from"./VisualVariablesSchema.js";import{getWebGLCapabilities as a}from"../../../../../webgl/capabilities.js";async function i(e,{subtypeField:t,sublayers:s}){const a=await Promise.all(s.map((({renderer:t})=>r(e,t))));return{type:"subtype",subtypeField:t,renderers:s.reduce(((e,{subtypeCode:r},t)=>({...e,[r]:a[t]})),{})}}function o(e,r){const s=a();return{type:"subtype",filters:e.filters,capabilities:{maxTextureSize:s.maxTextureSize},subtypeField:r.subtypeField,target:"feature",bindings:r.sublayers.reduce(((e,{renderer:r,subtypeCode:s})=>({...e,[s]:t(r)})),{})}}async function u(r,{subtypeField:t,sublayers:a}){const i=await Promise.all(a.map((t=>{const a=s(t.renderer),i={...t,geometryType:t.geometryType??null};return e(r,i,a)})));return{type:"subtype",subtypeField:t,renderers:a.reduce(((e,{subtypeCode:r},t)=>({...e,[r]:i[t]})),{})}}async function n(e,r,t,s){return{storage:o(r,t),mesh:{displayRefreshVersion:s,strategy:{type:"feature"},factory:{symbology:await i(e,t),labels:await u(e,t)},sortKey:null,timeZone:r.timeZone}}}export{n as createSubtypeProcessorSchema};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../../../core/Evented.js";import{handlesGroup as t}from"../../../../../../core/handleUtils.js";import"../../../../../../core/has.js";import{destroyMaybe as s}from"../../../../../../core/maybe.js";import{StreamFeatureManager as n}from"../../../../../../layers/graphics/data/StreamFeatureManager.js";import{createConnection as o}from"../../../../../../layers/graphics/sources/connections/createConnection.js";import{StreamConnectionState as i}from"../StreamConnectionState.js";import{StreamFeatureStore as r}from"../StreamFeatureStore.js";import{ALoadStrategy as a}from"./ALoadStrategy.js";import{StreamSourceChunk as c}from"./chunks/StreamSourceChunk.js";class h extends a{constructor(t,s,o,a,c){super(o),this._service=t,this._dataFilter=s,this._streamOptions=a,this._metadata=c,this._connectionState=new i,this.events=new e;const{objectIdField:h,timeInfo:m}=this._metadata,{purgeOptions:d}=s;this._stagingStore=new r(this._metadata,(e=>this.events.emit("features-updated",e))),this._manager=new n(this._stagingStore,h,m,d),this.connect()}destroy(){super.destroy(),this.disconnect()}get about(){return{willQueryAllFeatures:!1,willQueryFullResolutionGeometry:!1}}get connectionStatus(){return this._connectionState.connectionStatus}get errorString(){return this._connectionState?.errorString}async refresh(){this._manager.checkForUpdates()
|
|
5
|
+
import e from"../../../../../../core/Evented.js";import{handlesGroup as t}from"../../../../../../core/handleUtils.js";import"../../../../../../core/has.js";import{destroyMaybe as s}from"../../../../../../core/maybe.js";import{StreamFeatureManager as n}from"../../../../../../layers/graphics/data/StreamFeatureManager.js";import{createConnection as o}from"../../../../../../layers/graphics/sources/connections/createConnection.js";import{StreamConnectionState as i}from"../StreamConnectionState.js";import{StreamFeatureStore as r}from"../StreamFeatureStore.js";import{ALoadStrategy as a}from"./ALoadStrategy.js";import{StreamSourceChunk as c}from"./chunks/StreamSourceChunk.js";class h extends a{constructor(t,s,o,a,c){super(o),this._service=t,this._dataFilter=s,this._streamOptions=a,this._metadata=c,this._connectionState=new i,this._forceRefresh=!1,this.events=new e;const{objectIdField:h,timeInfo:m}=this._metadata,{purgeOptions:d}=s;this._stagingStore=new r(this._metadata,(e=>this.events.emit("features-updated",e))),this._manager=new n(this._stagingStore,h,m,d),this.connect()}destroy(){super.destroy(),this.disconnect()}get about(){return{willQueryAllFeatures:!1,willQueryFullResolutionGeometry:!1}}get connectionStatus(){return this._connectionState.connectionStatus}get errorString(){return this._connectionState?.errorString}async refresh(){const e=null!=this._chunk;this._manager.checkForUpdates()||!e||this._forceRefresh?(this._chunk&&this._store.remove(this._chunk),this._forceRefresh=!1,this._chunk=new c(this._stagingStore.reader),this._store.insert(this._chunk),this.events.emit("tick")):this.events.emit("tick")}async updateFields(e){throw new Error("Updating available fields not supported for StreamLayer")}async load(e){}unload(e){}disconnect(){this._connection=s(this._connection),this._connectionState.connection=null,this._handlesGroup?.remove()}connect(){if(null!=this._connection)return;const{geometryType:e,spatialReference:s}=this._metadata,{maxReconnectionAttempts:n,maxReconnectionInterval:i,geometryDefinition:r,definitionExpression:a,customParameters:c}=this._dataFilter;this._connection=o(this._service.source,s,this._streamOptions.outSR,e,a,r,n,i,c),this._handlesGroup=t([this._connection.on("data-received",(e=>this._onFeature(e))),this._connection.on("message-received",(e=>this._onWebSocketMessage(e)))]),this._connectionState.connection=this._connection}clear(){this._manager.checkForUpdates(),this._stagingStore.clear(),this._forceRefresh=!0}updateCustomParameters(e){this._connection?.updateCustomParameters(e)}sendMessageToSocket(e){this._connection?.sendMessageToSocket(e)}sendMessageToClient(e){this._connection?.sendMessageToClient(e)}_onWebSocketMessage(e){if("type"in e)switch(e.type){case"delete":if(e.objectIds)for(const t of e.objectIds)this._manager.removeById(t);if(e.trackIds)for(const t of e.trackIds)this._manager.removeByTrackId(t);break;case"clear":this.clear()}this.events.emit("message-received",e)}_onFeature(e){try{this._manager.add(e),this.events.emit("data-received",e)}catch(t){}}}export{h as StreamLoadStrategy};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../../geometry/SpatialReference.js";import t from"../../../../../layers/support/FieldsIndex.js";class i{constructor(i){this._options=i,this._fieldsIndex="fieldsIndex"in i?t.fromJSON(i.fieldsIndex):new t(i.fields),i.spatialReference&&(this._spatialReference=e.fromJSON(i.spatialReference)),this._arcadeSchema={fields:this.fieldsIndex.fields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,objectIdField:this.objectIdField,globalIdField:this._options.globalIdField,spatialReference:this._spatialReference,timeInfo:this._options.timeInfo,typeIdField:this._options.typeIdField??void 0,types:this._options.types??void 0,subtypeField:this._options.subtypeField,subtypes:this._options.subtypes??void 0}}
|
|
5
|
+
import e from"../../../../../geometry/SpatialReference.js";import t from"../../../../../layers/support/FieldsIndex.js";class i{constructor(i){this._options=i,this._fieldsIndex="fieldsIndex"in i?t.fromJSON(i.fieldsIndex):new t(i.fields),i.spatialReference&&(this._spatialReference=e.fromJSON(i.spatialReference)),this._arcadeSchema={fields:this.fieldsIndex.fields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,objectIdField:this.objectIdField,globalIdField:this._options.globalIdField,spatialReference:this._spatialReference,timeInfo:this._options.timeInfo,typeIdField:this._options.typeIdField??void 0,types:this._options.types??void 0,subtypeField:this._options.subtypeField,subtypes:this._options.subtypes??void 0}}get fieldsIndex(){return this._fieldsIndex}get geometryType(){return this._options.geometryType}get timeInfo(){return this._options.timeInfo}get objectIdField(){return this._options.objectIdField}get globalIdField(){return this._options.globalIdField}get arcadeSchema(){return this._arcadeSchema}get spatialReference(){return this._spatialReference}get timeReferenceUnknownClient(){return this._options.timeReferenceUnknownClient}}class s extends i{static create(e){return new s({fields:[],objectIdField:"uid",geometryType:null,spatialReference:e,globalIdField:null,subtypeField:null,subtypes:null,timeInfo:null,typeIdField:null,types:null,timeReferenceUnknownClient:null})}}export{i as FeatureMetadata,s as GraphicsMetadata};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import e from"../../../../../core/ArrayPool.js";import t from"../../../../../geometry/Extent.js";import{create as i}from"../../../../../geometry/support/aaBoundingRect.js";import s from"../../../../../rest/support/QuantizationParameters.js";import o from"../../../tiling/TileKey.js";class n{constructor(e,t){this.key=new o(0,0,0,0),this.bounds=i(),this.objectIds=new Set,this.key.set(t);const s=e.getLODInfoAt(this.key);this.tileInfoView=e,this.tileInfoView.getTileBounds(this.bounds,this.key,!0),this.resolution=s.resolution,this.scale=s.scale,this.level=s.level}get lod(){return this.tileInfoView.getLODInfoAt(this.key)}get id(){return this.key.id}get extent(){return t.fromBounds(this.bounds,this.tileInfoView.tileInfo.spatialReference)}get transform(){return{originPosition:"upperLeft",scale:[this.resolution,this.resolution],translate:[this.bounds[0],this.bounds[3]]}}createArcadeEvaluationOptions(e){return{$view:{scale:this.scale,timeZone:e}}}createChildTiles(){const t=this.key.getChildKeys(),i=e.acquire();for(let e=0;e<t.length;e++)i[e]=new n(this.tileInfoView,t[e]);return i}getQuantizationParameters(){return s.fromJSON({mode:"view",originPosition:"upperLeft",tolerance:this.resolution,extent:{xmin:this.bounds[0],ymin:this.bounds[1],xmax:this.bounds[2],ymax:this.bounds[3],spatialReference:this.tileInfoView.tileInfo.spatialReference}})}}export{n as Tile};
|