@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 2.66 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{clone as e}from"../../../../../core/lang.js";import{getEffectiveFeatureReduction as t}from"./featureReductionUtils.js";import{getServiceGeometryType as r}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as o,getLayerDeconflictionEnabled as s,createLabelVVEvaluator as a}from"./labelingUtils.js";import{createFeatureSourceSchema as l}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as i}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as n}from"../support/rendererUtils.js";class u{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const t=this.layer,r=o(t,e)??s(t);return[{vvEvaluators:{0:a(t.renderer)},deconflictionEnabled:r}]}async createServiceOptions(t){const o=this.layer,{capabilities:s,objectIdField:a}=o,l=o.fieldsIndex.toJSON(),i=r(o),n=o.timeInfo?.toJSON(),u=o.spatialReference.toJSON(),c=o.source.getSource(),p=this.layer.objectIdField,d=e(s);d.query.maxRecordCount=c.maxRecordCount;const m=t.spatialReference.toJSON();return{type:"ogc",source:c,orderByFields:p,outSpatialReference:m,metadata:{fieldsIndex:l,geometryType:i,objectIdField:a,timeInfo:n,spatialReference:u,outSpatialReference:m,globalIdField:null,subtypeField:null,subtypes:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null},queryMetadata:{maxRecordCount:d.query.maxRecordCount,supportsCompactGeometry:d.query.supportsCompactGeometry,supportsDefaultSpatialReference:d.query.supportsDefaultSpatialReference,supportsFormatPBF:d.query.supportsFormatPBF,supportsMaxRecordCountFactor:d.query.supportsMaxRecordCountFactor,supportsQuantization:d.query.supportsQuantization,lastEditDate:null,snapshotInfo:null}}}createSourceSchema(e,t){const{customParameters:r,timeExtent:o,apiKey:s}=this.layer;return l({customParameters:r,timeExtent:o},e,t,s)}createProcessorSchema(e,r,o){const{fields:s,renderer:a,geometryType:l,labelingInfo:n,labelsVisible:u,orderBy:c,objectIdField:p}=this.layer,d={fields:s.map((e=>e.toJSON())),renderer:a?.clone(),featureReduction:t(this.layer,r),geometryType:l,labelingInfo:n,labelsVisible:u,objectIdField:p,orderBy:c??"default"};return i(e,r,d,o)}get hasRequiredSupport(){return n(this.layer.renderer)}get timeOptions(){return this.layer}getUpdateHashProperties(e){return[()=>this.layer.apiKey,()=>this.layer.customParameters,()=>t(this.layer,e),()=>this.layer.labelsVisible?this.layer.labelingInfo:null,()=>this.layer.orderBy,()=>this.layer.renderer]}}export{u as OGCFeatureLayerAdapter};