12345 |
- /*
- All material copyright ESRI, All Rights Reserved, unless otherwise specified.
- See https://js.arcgis.com/4.25/esri/copyright.txt for details.
- */
- import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import r from"../PopupTemplate.js";import"../renderers/ClassBreaksRenderer.js";import"../renderers/DictionaryRenderer.js";import"../renderers/DotDensityRenderer.js";import"../renderers/HeatmapRenderer.js";import"../renderers/PieChartRenderer.js";import"../renderers/Renderer.js";import"../renderers/SimpleRenderer.js";import"../renderers/UniqueValueRenderer.js";import"../renderers/support/jsonUtils.js";import{rendererTypes as t,webSceneRendererTypes as i}from"../renderers/support/types.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/accessorSupport/ensureType.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import{featureGeometryTypeKebabDictionary as p}from"../geometry/support/typeUtils.js";import l from"./Layer.js";import{OGCFeatureSource as a}from"./graphics/sources/OGCFeatureSource.js";import{APIKeyMixin as d}from"./mixins/APIKeyMixin.js";import{BlendLayer as y}from"./mixins/BlendLayer.js";import{CustomParametersMixin as m}from"./mixins/CustomParametersMixin.js";import{FeatureEffectLayer as u}from"./mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as c}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as f}from"./mixins/OperationalLayer.js";import{OrderedLayer as h}from"./mixins/OrderedLayer.js";import{PortalLayer as j}from"./mixins/PortalLayer.js";import{RefreshableLayer as g}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as v}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as x}from"./mixins/TemporalLayer.js";import{elevationInfo as b,labelsVisible as I,legendEnabled as S,popupEnabled as R,screenSizePerspectiveEnabled as F,url as L}from"./support/commonProperties.js";import O from"./support/FeatureType.js";import T from"./support/Field.js";import{defineFieldProperties as w}from"./support/fieldProperties.js";import{fixRendererFields as D,fixTimeInfoFields as C}from"./support/fieldUtils.js";import P from"./support/LabelClass.js";import{reader as E}from"./support/labelingInfo.js";import _ from"../rest/support/Query.js";import{createPopupTemplate as U}from"../support/popupUtils.js";import q from"../geometry/Extent.js";import G from"../geometry/SpatialReference.js";const M=w();let B=class extends(d(m(c(u(y(h(x(v(f(j(g(o(l))))))))))))){constructor(e){super(e),this.collectionId=null,this.copyright=null,this.definitionExpression=null,this.description=null,this.displayField=null,this.elevationInfo=null,this.fields=null,this.fieldsIndex=null,this.fullExtent=null,this.geometryType=null,this.hasZ=void 0,this.labelingInfo=null,this.labelsVisible=!0,this.legendEnabled=!0,this.maxRecordCount=null,this.objectIdField=null,this.operationalLayerType="OGCFeatureLayer",this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.source=new a({layer:this}),this.spatialReference=null,this.title=null,this.type="ogc-feature",this.typeIdField=null,this.types=null,this.url=null}destroy(){this.source?.destroy()}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["OGCFeatureServer"]},e).then((()=>this._fetchService(e)))),this.when()}get defaultPopupTemplate(){return this.createPopupTemplate()}get effectiveMaxRecordCount(){return this.maxRecordCount??this.capabilities?.query.maxRecordCount??5e3}get isTable(){return this.loaded&&null==this.geometryType}set renderer(e){D(e,this.fieldsIndex),this._set("renderer",e)}on(e,r){return super.on(e,r)}createPopupTemplate(e){return U(this,e)}createQuery(){return new _}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,r){let t,i=!1;const o=r?.feature?.attributes,s=this.typeIdField&&o?.[this.typeIdField];return null!=s&&this.types&&(i=this.types.some((r=>r.id==s&&(t=r.domains?.[e],"inherited"===t?.type&&(t=this._getLayerDomain(e)),!0)))),i||t||(t=this._getLayerDomain(e)),t}queryFeatures(e,r){return this.load().then((()=>this.source.queryFeatures(_.from(e)||this.createQuery(),r))).then((e=>(e?.features?.forEach((e=>{e.layer=e.sourceLayer=this})),e)))}serviceSupportsSpatialReference(e){return this.source?.serviceSupportsSpatialReference(e)??!1}async _fetchService(e){await this.source.load(e),this.read(this.source.featureDefinition,{origin:"service"}),D(this.renderer,this.fieldsIndex),C(this.timeInfo,this.fieldsIndex)}_getLayerDomain(e){if(!this.fields)return null;for(const r of this.fields)if(r.name===e&&r.domain)return r.domain;return null}};e([s({readOnly:!0,json:{origins:{service:{read:!0}}}})],B.prototype,"capabilities",void 0),e([s({type:String,json:{write:!0}})],B.prototype,"collectionId",void 0),e([s({type:String})],B.prototype,"copyright",void 0),e([s({readOnly:!0})],B.prototype,"defaultPopupTemplate",null),e([s({type:String})],B.prototype,"definitionExpression",void 0),e([s({readOnly:!0,type:String,json:{origins:{service:{name:"collection.description"}}}})],B.prototype,"description",void 0),e([s({type:String})],B.prototype,"displayField",void 0),e([s({type:Number})],B.prototype,"effectiveMaxRecordCount",null),e([s(b)],B.prototype,"elevationInfo",void 0),e([s({type:[T],json:{origins:{service:{name:"layerDefinition.fields"}}}})],B.prototype,"fields",void 0),e([s(M.fieldsIndex)],B.prototype,"fieldsIndex",void 0),e([s({readOnly:!0,type:q,json:{origins:{service:{name:"layerDefinition.extent"}}}})],B.prototype,"fullExtent",void 0),e([s({type:p.apiValues,json:{origins:{service:{name:"layerDefinition.geometryType",read:{reader:p.read}}}}})],B.prototype,"geometryType",void 0),e([s({type:Boolean,json:{origins:{service:{name:"layerDefinition.hasZ"}}}})],B.prototype,"hasZ",void 0),e([s({type:Boolean,readOnly:!0})],B.prototype,"isTable",null),e([s({type:[P],json:{origins:{"web-document":{name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:E},write:!0}}}})],B.prototype,"labelingInfo",void 0),e([s(I)],B.prototype,"labelsVisible",void 0),e([s(S)],B.prototype,"legendEnabled",void 0),e([s({type:Number})],B.prototype,"maxRecordCount",void 0),e([s({type:String,json:{origins:{service:{name:"layerDefinition.objectIdField"}}}})],B.prototype,"objectIdField",void 0),e([s({type:["OGCFeatureLayer"]})],B.prototype,"operationalLayerType",void 0),e([s(R)],B.prototype,"popupEnabled",void 0),e([s({type:r,json:{name:"popupInfo",write:!0}})],B.prototype,"popupTemplate",void 0),e([s({types:t,json:{origins:{service:{name:"layerDefinition.drawingInfo.renderer",write:!1},"web-scene":{types:i,name:"layerDefinition.drawingInfo.renderer",write:!0}},name:"layerDefinition.drawingInfo.renderer",write:!0}})],B.prototype,"renderer",null),e([s(F)],B.prototype,"screenSizePerspectiveEnabled",void 0),e([s({readOnly:!0})],B.prototype,"source",void 0),e([s({readOnly:!0,type:G,json:{origins:{service:{read:!0}}}})],B.prototype,"spatialReference",void 0),e([s({type:String,json:{write:{enabled:!0,ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"collection.title"}}}})],B.prototype,"title",void 0),e([s({readOnly:!0,json:{read:!1}})],B.prototype,"type",void 0),e([s({type:String,readOnly:!0})],B.prototype,"typeIdField",void 0),e([s({type:[O]})],B.prototype,"types",void 0),e([s(L)],B.prototype,"url",void 0),B=e([n("esri.layers.OGCFeatureLayer")],B);const V=B;export{V as default};
|