@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 2.49 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
*/
import{getEffectiveFeatureReduction as e}from"./featureReductionUtils.js";import{getServiceGeometryType as t}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as r,getLayerDeconflictionEnabled as i,createLabelVVEvaluator as l}from"./labelingUtils.js";import{createSimpleProcessorSchema as n}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as s}from"../support/rendererUtils.js";class o{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const t=this.layer,n=r(t,e)??i(t);return[{vvEvaluators:{0:l(t.renderer)},deconflictionEnabled:n}]}async createServiceOptions(e){const r=this.layer,{objectIdField:i}=r,l=t(r),n=r.timeInfo?.toJSON()||null,s=r.spatialReference?r.spatialReference.toJSON():null,o=e.spatialReference.toJSON();return{type:"stream",source:this.layer.parsedUrl,outSpatialReference:o,metadata:{fieldsIndex:this.layer.fieldsIndex.toJSON(),geometryType:l,objectIdField:i,timeInfo:n,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,spatialReference:s,outSpatialReference:o,subtypeField:null,subtypes:null,globalIdField:null,typeIdField:null,types:null}}}createSourceSchema(e,t){const{definitionExpression:r,geometryDefinition:i,customParameters:l}=this.layer;return{type:"stream",mutable:{sourceRefreshVersion:t,availableFields:e.availableFields,dataFilter:{geometryDefinition:i?.toJSON(),definitionExpression:r,customParameters:l??null,maxReconnectionAttempts:this.layer.maxReconnectionAttempts,maxReconnectionInterval:this.layer.maxReconnectionInterval,purgeOptions:this.layer.purgeOptions.toJSON()}}}}createProcessorSchema(t,r,i){const{fields:l,renderer:s,geometryType:o,labelingInfo:a,labelsVisible:c,objectIdField:d,trackInfo:m}=this.layer,p={fields:l.map((e=>e.toJSON())),renderer:s?.clone(),featureReduction:e(this.layer,r),geometryType:o,labelingInfo:a,labelsVisible:c,objectIdField:d,orderBy:"default",trackInfo:m};return n(t,r,p,i)}get hasRequiredSupport(){return s(this.layer.renderer)}get timeOptions(){return this.layer}getUpdateHashProperties(t){return[()=>this.layer.definitionExpression,()=>this.layer.renderer,()=>this.layer.labelsVisible?this.layer.labelingInfo:null,()=>e(this.layer,t),()=>this.layer.customParameters,()=>this.layer.geometryDefinition,()=>this.layer.definitionExpression,()=>this.layer.trackInfo]}}export{o as StreamLayerAdapter};