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 t 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 r,webSceneRendererTypes as i}from"../renderers/support/types.js";import{isSome as o}from"../core/maybe.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as p}from"../core/promiseUtils.js";import{urlToObject as n}from"../core/urlUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/accessorSupport/ensureType.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import{featureGeometryTypeKebabDictionary as d}from"../geometry/support/typeUtils.js";import u from"./Layer.js";import{GeoJSONSource as m}from"./graphics/sources/GeoJSONSource.js";import{BlendLayer as y}from"./mixins/BlendLayer.js";import{CustomParametersMixin as h}from"./mixins/CustomParametersMixin.js";import{FeatureEffectLayer as c}from"./mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as f}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as j}from"./mixins/OperationalLayer.js";import{OrderedLayer as g}from"./mixins/OrderedLayer.js";import{PortalLayer as v}from"./mixins/PortalLayer.js";import{RefreshableLayer as b}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as x}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as I}from"./mixins/TemporalLayer.js";import{elevationInfo as O,id as S,labelsVisible as E,legendEnabled as F,opacity as P,popupEnabled as w,screenSizePerspectiveEnabled as T,url as L}from"./support/commonProperties.js";import R from"./support/FeatureTemplate.js";import D from"./support/FeatureType.js";import q from"./support/Field.js";import{defineFieldProperties as U}from"./support/fieldProperties.js";import{fixRendererFields as J,fixTimeInfoFields as N}from"./support/fieldUtils.js";import Q from"./support/LabelClass.js";import{reader as C}from"./support/labelingInfo.js";import G from"../rest/support/Query.js";import{createPopupTemplate as _}from"../support/popupUtils.js";import V from"../geometry/SpatialReference.js";import B from"../geometry/Extent.js";const Z=U();let M=class extends(g(h(f(c(y(I(x(b(j(v(s(u)))))))))))){constructor(e){super(e),this.copyright=null,this.definitionExpression=null,this.displayField=null,this.editingEnabled=!1,this.elevationInfo=null,this.fields=null,this.fieldsIndex=null,this.fullExtent=null,this.geometryType=null,this.hasZ=void 0,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.objectIdField=null,this.operationalLayerType="GeoJSON",this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.source=new m({layer:this}),this.spatialReference=V.WGS84,this.templates=null,this.title="GeoJSON",this.type="geojson",this.typeIdField=null,this.types=null}destroy(){this.source?.destroy()}load(e){const t=this.loadFromPortal({supportedTypes:["GeoJson"],supportsData:!1},e).catch(p).then((()=>this.source.load(e))).then((()=>{this.read(this.source.sourceJSON,{origin:"service",url:this.parsedUrl}),this.revert(["objectIdField","fields","timeInfo"],"service"),J(this.renderer,this.fieldsIndex),N(this.timeInfo,this.fieldsIndex)}));return this.addResolvingPromise(t),Promise.resolve(this)}get capabilities(){return this.source?this.source.capabilities:null}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("capabilities"),(this._get("createQueryVersion")||0)+1}get defaultPopupTemplate(){return this.createPopupTemplate()}get isTable(){return this.loaded&&null==this.geometryType}get parsedUrl(){return this.url?n(this.url):null}set renderer(e){J(e,this.fieldsIndex),this._set("renderer",e)}set url(e){if(!e)return void this._set("url",e);const t=n(e);this._set("url",t.path),t.query&&(this.customParameters={...this.customParameters,...t.query})}async applyEdits(e,t){const r=await import("./graphics/editingSupport.js");await this.load();const i=await r.applyEdits(this,this.source,e,t);return this.read({extent:this.source.sourceJSON.extent,timeInfo:this.source.sourceJSON.timeInfo},{origin:"service",ignoreDefaults:!0}),i}on(e,t){return super.on(e,t)}createPopupTemplate(e){return _(this,e)}createQuery(){const e=new G,t=this.get("capabilities.data");e.returnGeometry=!0,t&&t.supportsZ&&(e.returnZ=!0),e.outFields=["*"],e.where=this.definitionExpression||"1=1";const{timeOffset:r,timeExtent:i}=this;return e.timeExtent=null!=r&&null!=i?i.offset(-r.value,r.unit):i||null,e}getFieldDomain(e,t){let r,i=!1;const o=t&&t.feature,s=o&&o.attributes,p=this.typeIdField&&s&&s[this.typeIdField];return null!=p&&this.types&&(i=this.types.some((t=>t.id==p&&(r=t.domains&&t.domains[e],r&&"inherited"===r.type&&(r=this._getLayerDomain(e)),!0)))),i||r||(r=this._getLayerDomain(e)),r}getField(e){return this.fieldsIndex.get(e)}queryFeatures(e,t){return this.load().then((()=>this.source.queryFeatures(G.from(e)||this.createQuery(),t))).then((e=>{if(e?.features)for(const t of e.features)t.layer=t.sourceLayer=this;return e}))}queryObjectIds(e,t){return this.load().then((()=>this.source.queryObjectIds(G.from(e)||this.createQuery(),t)))}queryFeatureCount(e,t){return this.load().then((()=>this.source.queryFeatureCount(G.from(e)||this.createQuery(),t)))}queryExtent(e,t){return this.load().then((()=>this.source.queryExtent(G.from(e)||this.createQuery(),t)))}async hasDataChanged(){try{const{dataChanged:e,updates:t}=await this.source.refresh(this.customParameters);return o(t)&&this.read(t,{origin:"service",url:this.parsedUrl,ignoreDefaults:!0}),e}catch{}return!1}_getLayerDomain(e){if(!this.fields)return null;let t=null;return this.fields.some((r=>(r.name===e&&(t=r.domain),!!t))),t}};e([l({readOnly:!0,json:{read:!1,write:!1}})],M.prototype,"capabilities",null),e([l({type:String})],M.prototype,"copyright",void 0),e([l({readOnly:!0})],M.prototype,"createQueryVersion",null),e([l({readOnly:!0})],M.prototype,"defaultPopupTemplate",null),e([l({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],M.prototype,"definitionExpression",void 0),e([l({type:String})],M.prototype,"displayField",void 0),e([l({type:Boolean})],M.prototype,"editingEnabled",void 0),e([l(O)],M.prototype,"elevationInfo",void 0),e([l({type:[q],json:{name:"layerDefinition.fields",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"fields"}}}})],M.prototype,"fields",void 0),e([l(Z.fieldsIndex)],M.prototype,"fieldsIndex",void 0),e([l({type:B,json:{name:"extent"}})],M.prototype,"fullExtent",void 0),e([l({type:["point","polygon","polyline","multipoint"],json:{read:{reader:d.read}}})],M.prototype,"geometryType",void 0),e([l({type:Boolean})],M.prototype,"hasZ",void 0),e([l(S)],M.prototype,"id",void 0),e([l({type:Boolean,readOnly:!0})],M.prototype,"isTable",null),e([l(E)],M.prototype,"labelsVisible",void 0),e([l({type:[Q],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:C},write:!0}})],M.prototype,"labelingInfo",void 0),e([l(F)],M.prototype,"legendEnabled",void 0),e([l({type:["show","hide"]})],M.prototype,"listMode",void 0),e([l({type:String,json:{name:"layerDefinition.objectIdField",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"objectIdField"}}}})],M.prototype,"objectIdField",void 0),e([l(P)],M.prototype,"opacity",void 0),e([l({type:["GeoJSON"]})],M.prototype,"operationalLayerType",void 0),e([l({readOnly:!0})],M.prototype,"parsedUrl",null),e([l(w)],M.prototype,"popupEnabled",void 0),e([l({type:t,json:{name:"popupInfo",write:!0}})],M.prototype,"popupTemplate",void 0),e([l({types:r,json:{name:"layerDefinition.drawingInfo.renderer",write:!0,origins:{service:{name:"drawingInfo.renderer"},"web-scene":{types:i}}}})],M.prototype,"renderer",null),e([l(T)],M.prototype,"screenSizePerspectiveEnabled",void 0),e([l({readOnly:!0})],M.prototype,"source",void 0),e([l({type:V})],M.prototype,"spatialReference",void 0),e([l({type:[R]})],M.prototype,"templates",void 0),e([l()],M.prototype,"title",void 0),e([l({json:{read:!1},readOnly:!0})],M.prototype,"type",void 0),e([l({type:String,readOnly:!0})],M.prototype,"typeIdField",void 0),e([l({type:[D]})],M.prototype,"types",void 0),e([l(L)],M.prototype,"url",null),M=e([a("esri.layers.GeoJSONLayer")],M);const k=M;export{k as default};
|