@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 2.81 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.19/LICENSE.txt */
import{getEffectiveFeatureReduction as e}from"./featureReductionUtils.js";import{getServiceGeometryType as r}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as t,getLayerDeconflictionEnabled as i,createLabelVVEvaluator as l}from"./labelingUtils.js";import{createSimpleProcessorSchema as a}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as n}from"../support/rendererUtils.js";class s{constructor(e){this.layer=e}getLabelingDeconflictionInfo(r){const a=this.layer,n=t(a,r)??i(a),s=e(a,r),o=[...a.labelingInfo||[],...s?.labelingInfo||[]];return[{vvEvaluators:{0:l(a.renderer)},deconflictionEnabled:n,labelingInfo:o}]}async createSourceSchema(e,r){return{type:"stream",service:this._createServiceInfo(e),strategy:{type:"stream",partial:{sourceRefreshVersion:r},full:{availableFields:e.availableFields,geometryDefinition:this.layer.geometryDefinition?.toJSON(),definitionExpression:this.layer.definitionExpression,customParameters:this.layer.customParameters,maxReconnectionAttempts:this.layer.maxReconnectionAttempts,maxReconnectionInterval:this.layer.maxReconnectionInterval,purgeOptions:this.layer.purgeOptions.toJSON()}}}}createProcessorSchema(r,t,i){const{fields:l,renderer:n,geometryType:s,labelingInfo:o,labelsVisible:c,objectIdField:y,trackInfo:p}=this.layer,f={fields:l.map(e=>e.toJSON()),renderer:n?.clone(),labelingInfoSource:this.layer.id,featureReduction:e(this.layer,t),geometryType:s,labelingInfo:o,labelsVisible:c,objectIdField:y,orderBy:"default",trackInfo:p};return a(r,t,f,i)}get hasRequiredSupport(){return n(this.layer.renderer)}get timeOptions(){return this.layer}getUpdateHashProperties(r){return[()=>this.layer.definitionExpression,()=>this.layer.renderer,()=>this.layer.labelsVisible?this.layer.labelingInfo:null,()=>e(this.layer,r),()=>this.layer.customParameters,()=>this.layer.geometryDefinition,()=>this.layer.definitionExpression,()=>this.layer.trackInfo]}setGraphicOrigin(e){e.origin=this.layer.graphicOrigin}setAggregateGraphicOrigin(e){e.origin=this.layer.aggregateGraphicOrigin}setTrackGraphicOrigin(e){e.origin=this.layer.trackGraphicOrigin}_createServiceInfo(e){const t=r(this.layer),i=this.layer.timeInfo?.toJSON()||null,l=this.layer.spatialReference?this.layer.spatialReference.toJSON():null,a=e.spatialReference.toJSON();return{type:"stream",source:this.layer.parsedUrl,outSpatialReference:a,metadata:{fieldsIndex:this.layer.fieldsIndex.toJSON(),geometryType:t,featureIdInfo:{type:"object-id",fieldName:this.layer.objectIdField},timeInfo:i,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,spatialReference:l,outSpatialReference:a,subtypeField:null,subtypes:null,globalIdField:null,typeIdField:null,types:null}}}}export{s as StreamLayerAdapter};