UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

6 lines (5 loc) 2.94 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.32/esri/copyright.txt for details. */ import{clone as e}from"../../../../../core/lang.js";import{isHostedAgolService as t}from"../../../../../layers/support/arcgisLayerUrl.js";import{getServiceGeometryType as r}from"./geometryUtils.js";import{getLayerDeconflictionEnabled as o,createLabelVVEvaluator as s}from"./labelingUtils.js";import{createFeatureSourceSchema as i}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as a}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as l}from"../support/rendererUtils.js";class n{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const t=this.layer,r=o(t);return[{vvEvaluators:{0:s(t.renderer)},deconflictionEnabled:r}]}async createServiceOptions(o){const s=this.layer,{capabilities:i,editingInfo:a,objectIdField:l,globalIdField:n,datesInUnknownTimezone:p,dateFieldsTimeZone:c,orderBy:d,parsedUrl:u}=s,m=s.fieldsIndex.toJSON(),y=r(s),f=s.timeInfo?.toJSON(),h=s.spatialReference.toJSON(),g=e(u);let b=l;if(d?.length){const e=!d[0].valueExpression&&d[0].field;e&&(b=e)}const F=t(g.path),I=o.spatialReference.toJSON();return{type:"feature-service",source:g,isSourceHosted:F,orderByFields:b,outSpatialReference:I,metadata:{timeReferenceUnknownClient:p,dateFieldsTimeZone:c,globalIdField:n,fieldsIndex:m,geometryType:y,objectIdField:l,timeInfo:f,spatialReference:h,outSpatialReference:I,subtypeField:null,subtypes:null,typeIdField:null,types:null},queryMetadata:{maxRecordCount:i.query.maxRecordCount,supportsCompactGeometry:i.query.supportsCompactGeometry,supportsDefaultSpatialReference:i.query.supportsDefaultSpatialReference,supportsFormatPBF:i.query.supportsFormatPBF,supportsMaxRecordCountFactor:i.query.supportsMaxRecordCountFactor,supportsQuantization:i.query.supportsQuantization,lastEditDate:a?.lastEditDate?.getTime(),snapshotInfo:null}}}createSourceSchema(e,t){const{definitionExpression:r,displayFilterInfo:o,customParameters:s,timeExtent:a,apiKey:l}=this.layer;return i({definitionExpression:r,displayFilterInfo:o,customParameters:s,timeExtent:a},e,t,l)}createProcessorSchema(e,t,r){const{fields:o,geometryType:s,orderBy:i,objectIdField:l,renderer:n,labelingInfo:p,labelsVisible:c}=this.layer,d={featureReduction:null,fields:o.map((e=>e.toJSON())),geometryType:s,labelingInfo:p,labelsVisible:c,objectIdField:l,orderBy:i??"default",renderer:n?.clone()};return a(e,t,d,r)}get hasRequiredSupport(){return l(this.layer.renderer)}get timeOptions(){return this.layer}getUpdateHashProperties(e){return[()=>this.layer.apiKey,()=>this.layer.customParameters,()=>this.layer.definitionExpression,()=>this.layer.outFields,()=>this.layer.renderer,()=>this.layer.labelsVisible?this.layer.labelingInfo:null,()=>this.layer.orderBy]}setGraphicOrigin(e){e.origin={type:"catalog",layer:this.layer}}}export{n as CatalogFootprintLayerAdapter};