@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 3.63 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 has from"../../../../../core/has.js";import{clone as e}from"../../../../../core/lang.js";import{isHostedAgolService as t}from"../../../../../layers/support/arcgisLayerUrl.js";import{getEffectiveFeatureReduction as r}from"./featureReductionUtils.js";import{exceedsMinimumSnapshotCoverage as o}from"./featureServiceUtils.js";import{addFloorFilter as s,hasFloorFilter as i}from"./floorFilterUtils.js";import{getServiceGeometryType as a}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as l,getLayerDeconflictionEnabled as n,createLabelVVEvaluator as p}from"./labelingUtils.js";import{createFeatureSourceSchema as u}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as d}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as c}from"../support/rendererUtils.js";class m{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const t=this.layer,r=l(t,e)??n(t);return[{vvEvaluators:{0:p(t.renderer)},deconflictionEnabled:r}]}async createServiceOptions(r){const s=this.layer,{capabilities:i,objectIdField:l,globalIdField:n,orderBy:p,refreshInterval:u}=s,d=s.fieldsIndex.toJSON(),c=a(s),m=s.timeInfo?.toJSON(),y=s.spatialReference.toJSON(),f=e(this.layer.parsedUrl);let h=this.layer.objectIdField;if(p?.length){const e=!p[0].valueExpression&&p[0].field;e&&(h=e)}const b=u>0,F=!!has("featurelayer-snapshot-enabled")&&"point"===s.geometryType&&i?.query.supportsPagination&&!i?.operations.supportsEditing&&!b,S=F&&o(r,s.fullExtent),g=t(f.path),I=r.spatialReference.toJSON();return{type:"feature-service",source:f,isSourceHosted:g,orderByFields:h,outSpatialReference:I,metadata:{globalIdField:n,fieldsIndex:d,geometryType:c,objectIdField:l,timeInfo:m,spatialReference:y,outSpatialReference:I,timeReferenceUnknownClient:s.datesInUnknownTimezone,dateFieldsTimeZone:s.dateFieldsTimeZone,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:null,snapshotInfo:{supportsSnapshotMinThreshold:F,supportsSnapshotMaxThreshold:S,snapshotCountThresholds:{min:has("featurelayer-snapshot-point-min-threshold"),max:has("featurelayer-snapshot-point-max-threshold")}}}}}createSourceSchema(e,t){const{definitionExpression:r,displayFilterInfo:o,customParameters:s,timeExtent:i}=this.layer;return u({definitionExpression:r,displayFilterInfo:o,customParameters:s,timeExtent:i},e,t,null)}createProcessorSchema(e,t,o){const{fields:s,renderer:i,geometryType:a,labelingInfo:l,labelsVisible:n,orderBy:p,objectIdField:u}=this.layer,c={fields:s.map((e=>e.toJSON())),renderer:i?.clone(),featureReduction:r(this.layer,t),geometryType:a,labelingInfo:l,labelsVisible:n,objectIdField:u,orderBy:p??"default"};return d(e,t,c,o)}get hasRequiredSupport(){return c(this.layer.renderer)}get timeOptions(){return this.layer}addFilters(e,t){return s(this.layer,e,t)}getUpdateHashProperties(e){return[()=>this.layer.outFields,()=>this.layer.orderBy,()=>this.layer.definitionExpression,()=>this.layer.renderer,()=>this.layer.labelsVisible?this.layer.labelingInfo:null,()=>r(this.layer,e),()=>this.layer.customParameters,()=>i(this.layer,e)?e.floors:null]}}export{m as OrientedImageryLayerAdapter};