@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 4.37 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
*/
import{_ as e}from"../chunks/tslib.es6.js";import o from"../config.js";import r from"../request.js";import{MultiOriginJSONMixin as t}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as s}from"../core/promiseUtils.js";import{getFilename as i}from"../core/urlUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{reader as n}from"../core/accessorSupport/decorators/reader.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import a from"../geometry/Extent.js";import{isWGS84 as m}from"../geometry/support/spatialReferenceUtils.js";import y from"./Layer.js";import{BlendLayer as c}from"./mixins/BlendLayer.js";import{OperationalLayer as u}from"./mixins/OperationalLayer.js";import{PortalLayer as d}from"./mixins/PortalLayer.js";import{RefreshableLayer as f}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as h}from"./mixins/ScaleRangeLayer.js";import{id as S,legendEnabled as g,url as j}from"./support/commonProperties.js";import v from"../symbols/PictureMarkerSymbol.js";import b from"../symbols/SimpleFillSymbol.js";import x from"../symbols/SimpleLineSymbol.js";import C from"../symbols/SimpleMarkerSymbol.js";import L from"../symbols/Symbol.js";const G=["atom","xml"],P={base:L,key:"type",typeMap:{"simple-line":x},errorContext:"symbol"},R={base:L,key:"type",typeMap:{"picture-marker":v,"simple-marker":C},errorContext:"symbol"},k={base:L,key:"type",typeMap:{"simple-fill":b},errorContext:"symbol"};let _=class extends(c(f(u(d(h(t(y))))))){constructor(...e){super(...e),this.description=null,this.fullExtent=null,this.legendEnabled=!0,this.lineSymbol=null,this.pointSymbol=null,this.polygonSymbol=null,this.operationalLayerType="GeoRSS",this.url=null,this.type="geo-rss"}normalizeCtorArgs(e,o){return"string"==typeof e?{url:e,...o}:e}readFeatureCollections(e,o){return o.featureCollection.layers.forEach((e=>{const o=e.layerDefinition.drawingInfo.renderer.symbol;o&&"esriSFS"===o.type&&o.outline?.style.includes("esriSFS")&&(o.outline.style="esriSLSSolid")})),o.featureCollection.layers}get hasPoints(){return this._hasGeometry("esriGeometryPoint")}get hasPolylines(){return this._hasGeometry("esriGeometryPolyline")}get hasPolygons(){return this._hasGeometry("esriGeometryPolygon")}get title(){const e=this._get("title");return e&&"defaults"!==this.originOf("title")?e:this.url?i(this.url,G)||"GeoRSS":e}set title(e){this._set("title",e)}load(e){const o=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Map Service","Feature Service","Feature Collection","Scene Service"]},e).catch(s).then((()=>this._fetchService(o))).then((e=>{this.read(e,{origin:"service"})}))),Promise.resolve(this)}async hasDataChanged(){const e=await this._fetchService();return this.read(e,{origin:"service",ignoreDefaults:!0}),!0}async _fetchService(e){const t=this.spatialReference,{data:s}=await r(o.geoRSSServiceUrl,{query:{url:this.url,refresh:!!this.loaded||void 0,outSR:m(t)?void 0:t.wkid??JSON.stringify(t)},signal:e});return s}_hasGeometry(e){return this.featureCollections?.some((o=>o.featureSet?.geometryType===e&&o.featureSet.features?.length>0))??!1}};e([l()],_.prototype,"description",void 0),e([l()],_.prototype,"featureCollections",void 0),e([n("service","featureCollections",["featureCollection.layers"])],_.prototype,"readFeatureCollections",null),e([l({type:a,json:{name:"lookAtExtent"}})],_.prototype,"fullExtent",void 0),e([l(S)],_.prototype,"id",void 0),e([l(g)],_.prototype,"legendEnabled",void 0),e([l({types:P,json:{write:!0}})],_.prototype,"lineSymbol",void 0),e([l({type:["show","hide"]})],_.prototype,"listMode",void 0),e([l({types:R,json:{write:!0}})],_.prototype,"pointSymbol",void 0),e([l({types:k,json:{write:!0}})],_.prototype,"polygonSymbol",void 0),e([l({type:["GeoRSS"]})],_.prototype,"operationalLayerType",void 0),e([l(j)],_.prototype,"url",void 0),e([l({json:{origins:{service:{read:{source:"name",reader:e=>e||void 0}}}}})],_.prototype,"title",null),e([l({readOnly:!0,json:{read:!1},value:"geo-rss"})],_.prototype,"type",void 0),_=e([p("esri.layers.GeoRSSLayer")],_);const w=_;export{w as default};