You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
14 KiB
29 lines
14 KiB
// All material copyright Esri, All Rights Reserved, unless otherwise specified. |
|
// See https://js.arcgis.com/4.30/esri/copyright.txt for details. |
|
//>>built |
|
require({cache:{"esri/layers/graphics/sources/GeoJSONSource":function(){define("exports ../../../chunks/tslib.es6 ../../../geometry ../../../core/Error ../../../core/has ../../../core/Loadable ../../../core/Logger ../../../core/promiseUtils ../../../core/workers/workers ../../../core/accessorSupport/decorators/property ../../../core/RandomLCG ../../../core/accessorSupport/decorators/subclass ./support/clientSideDefaults ../../../rest/support/FeatureSet ../../../geometry/Extent ../../../geometry/Polygon ../../../geometry/support/typeUtils".split(" "), |
|
function(k,c,y,z,G,H,C,I,J,v,N,K,L,A,d,D,B){k.GeoJSONSource=class extends H{constructor(){super(...arguments);this.type="geojson";this.refresh=I.debounce(async a=>{await this.load();const {extent:e,timeExtent:h}=await this._connection.invoke("refresh",a);this.sourceJSON.extent=e;h&&(this.sourceJSON.timeInfo.timeExtent=[h.start,h.end]);return{dataChanged:!0,updates:{extent:this.sourceJSON.extent,timeInfo:this.sourceJSON.timeInfo}}})}load(a){this.addResolvingPromise(this._startWorker(null!=a?a.signal: |
|
null));return Promise.resolve(this)}destroy(){this._connection?.close();this._connection=null}applyEdits(a){return this.load().then(()=>this._applyEdits(a))}openPorts(){return this.load().then(()=>this._connection.openPorts())}queryFeatures(a,e={}){return this.load(e).then(()=>this._connection.invoke("queryFeatures",a?a.toJSON():null,e)).then(h=>A.fromJSON(h))}queryFeaturesJSON(a,e={}){return this.load(e).then(()=>this._connection.invoke("queryFeatures",a?a.toJSON():null,e))}queryFeatureCount(a,e= |
|
{}){return this.load(e).then(()=>this._connection.invoke("queryFeatureCount",a?a.toJSON():null,e))}queryObjectIds(a,e={}){return this.load(e).then(()=>this._connection.invoke("queryObjectIds",a?a.toJSON():null,e))}queryExtent(a,e={}){return this.load(e).then(()=>this._connection.invoke("queryExtent",a?a.toJSON():null,e)).then(h=>({count:h.count,extent:d.fromJSON(h.extent)}))}querySnapping(a,e={}){return this.load(e).then(()=>this._connection.invoke("querySnapping",a,e))}_applyEdits(a){if(!this._connection)throw new z("geojson-layer-source:edit-failure", |
|
"Memory source not loaded");const e=this.layer.objectIdField,h=[],q=[],r=[];if(a.addFeatures)for(const g of a.addFeatures)h.push(this._serializeFeature(g));if(a.deleteFeatures)for(const g of a.deleteFeatures)"objectId"in g&&null!=g.objectId?q.push(g.objectId):"attributes"in g&&null!=g.attributes[e]&&q.push(g.attributes[e]);if(a.updateFeatures)for(const g of a.updateFeatures)r.push(this._serializeFeature(g));return this._connection.invoke("applyEdits",{adds:h,updates:r,deletes:q}).then(({extent:g, |
|
timeExtent:p,featureEditResults:t})=>{this.sourceJSON.extent=g;p&&(this.sourceJSON.timeInfo.timeExtent=[p.start,p.end]);return this._createEditsResult(t)})}_createEditsResult(a){return{addFeatureResults:a.addResults?a.addResults.map(this._createFeatureEditResult,this):[],updateFeatureResults:a.updateResults?a.updateResults.map(this._createFeatureEditResult,this):[],deleteFeatureResults:a.deleteResults?a.deleteResults.map(this._createFeatureEditResult,this):[],addAttachmentResults:[],updateAttachmentResults:[], |
|
deleteAttachmentResults:[]}}_createFeatureEditResult(a){const e=!0===a.success?null:a.error||{code:void 0,description:void 0};return{objectId:a.objectId,globalId:a.globalId,error:e?new z("geojson-layer-source:edit-failure",e.description,{code:e.code}):null}}_serializeFeature(a){const {attributes:e}=a;return(a=this._geometryForSerialization(a))?{geometry:a.toJSON(),attributes:e}:{attributes:e}}_geometryForSerialization(a){({geometry:a}=a);return null==a?null:"mesh"===a.type||"extent"===a.type?D.fromExtent(a.extent): |
|
a}async _startWorker(a){this._connection=await J.open("GeoJSONSourceWorker",{strategy:G("feature-layers-workers")?"dedicated":"local",signal:a,registryTarget:this});const {fields:e,spatialReference:h,hasZ:q,geometryType:r,objectIdField:g,url:p,timeInfo:t,customParameters:E}=this.layer;var w="defaults"===this.layer.originOf("spatialReference");w={url:p,customParameters:E,fields:e&&e.map(u=>u.toJSON()),geometryType:B.featureGeometryTypeKebabDictionary.toJSON(r),hasZ:q,objectIdField:g,timeInfo:t?t.toJSON(): |
|
null,spatialReference:w?null:h&&h.toJSON()};a=await this._connection.invoke("load",w,{signal:a});for(const u of a.warnings)C.getLogger(this.layer).warn("#load()",`$${u.message} (title: '${this.layer.title||"no title"}', id: '${this.layer.id??"no id"}')`,{warning:u});a.featureErrors.length&&C.getLogger(this.layer).warn("#load()",`Encountered ${a.featureErrors.length} validation errors while loading features. (title: '${this.layer.title||"no title"}', id: '${this.layer.id??"no id"}')`,{errors:a.featureErrors}); |
|
this.sourceJSON=a.layerDefinition;this.capabilities=L.createCapabilities(this.sourceJSON.hasZ,!0)}};c.__decorate([v.property()],k.GeoJSONSource.prototype,"capabilities",void 0);c.__decorate([v.property()],k.GeoJSONSource.prototype,"type",void 0);c.__decorate([v.property({constructOnly:!0})],k.GeoJSONSource.prototype,"layer",void 0);c.__decorate([v.property()],k.GeoJSONSource.prototype,"sourceJSON",void 0);k.GeoJSONSource=c.__decorate([K.subclass("esri.layers.graphics.sources.GeoJSONSource")],k.GeoJSONSource); |
|
Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})})},"*noref":1}}); |
|
define("require ../chunks/tslib.es6 ../geometry ../PopupTemplate ../renderers/ClassBreaksRenderer ../renderers/DictionaryRenderer ../renderers/DotDensityRenderer ../renderers/HeatmapRenderer ../renderers/PieChartRenderer ../renderers/Renderer ../renderers/SimpleRenderer ../renderers/UniqueValueRenderer ../renderers/support/jsonUtils ../renderers/support/types ../core/MultiOriginJSONSupport ../core/promiseUtils ../core/urlUtils ../core/accessorSupport/decorators/property ../core/has ../core/Logger ../core/RandomLCG ../core/accessorSupport/decorators/subclass ../geometry/support/typeUtils ./Layer ./graphics/sources/GeoJSONSource ./mixins/BlendLayer ./mixins/CustomParametersMixin ./mixins/FeatureEffectLayer ./mixins/FeatureReductionLayer ./mixins/OperationalLayer ./mixins/OrderedLayer ./mixins/PortalLayer ./mixins/RefreshableLayer ./mixins/ScaleRangeLayer ./mixins/TemporalLayer ./support/commonProperties ./support/FeatureTemplate ./support/Field ./support/fieldProperties ./support/fieldUtils ./support/LabelClass ./support/labelingInfo ../rest/support/Query ../support/popupUtils ../time/timeZoneUtils ../geometry/SpatialReference ../geometry/Extent".split(" "),function(k, |
|
c,y,z,G,H,C,I,J,v,N,K,L,A,d,D,B,a,e,h,q,r,g,p,t,E,w,u,O,P,Q,R,S,T,U,m,V,W,X,F,Y,Z,x,aa,ba,M,ca){y=X.defineFieldProperties();d=class extends Q.OrderedLayer(w.CustomParametersMixin(O.FeatureReductionLayer(u.FeatureEffectLayer(E.BlendLayer(U.TemporalLayer(T.ScaleRangeLayer(S.RefreshableLayer(P.OperationalLayer(R.PortalLayer(d.MultiOriginJSONMixin(p))))))))))){constructor(b){super(b);this.displayField=this.definitionExpression=this.dateFieldsTimeZone=this.copyright=null;this.editingEnabled=!1;this.geometryType= |
|
this.fullExtent=this.fieldsIndex=this.fields=this.elevationInfo=null;this.hasZ=void 0;this.labelsVisible=!0;this.labelingInfo=null;this.legendEnabled=!0;this.objectIdField=null;this.operationalLayerType="GeoJSON";this.outFields=null;this.popupEnabled=!0;this.popupTemplate=null;this.screenSizePerspectiveEnabled=!0;this.source=new t.GeoJSONSource({layer:this});this.spatialReference=M.WGS84;this.templates=null;this.title="GeoJSON";this.type="geojson"}destroy(){this.source?.destroy()}load(b){const f= |
|
this.loadFromPortal({supportedTypes:["GeoJson"],supportsData:!1},b).catch(D.throwIfAbortError).then(()=>this.source.load(b)).then(()=>{this.read(this.source.sourceJSON,{origin:"service",url:this.parsedUrl});this.revert(["objectIdField","fields","timeInfo"],"service");F.fixRendererFields(this.renderer,this.fieldsIndex);F.fixTimeInfoFields(this.timeInfo,this.fieldsIndex)});this.addResolvingPromise(f);return Promise.resolve(this)}get capabilities(){return this.source?this.source.capabilities:null}get createQueryVersion(){this.commitProperty("definitionExpression"); |
|
this.commitProperty("timeExtent");this.commitProperty("timeOffset");this.commitProperty("geometryType");this.commitProperty("capabilities");return(this._get("createQueryVersion")||0)+1}get defaultPopupTemplate(){return this.createPopupTemplate()}get isTable(){return this.loaded&&null==this.geometryType}get parsedUrl(){return this.url?B.urlToObject(this.url):null}set renderer(b){F.fixRendererFields(b,this.fieldsIndex);this._set("renderer",b)}set url(b){b?(b=B.urlToObject(b),this._set("url",b.path), |
|
b.query&&(this.customParameters={...this.customParameters,...b.query})):this._set("url",b)}async applyEdits(b,f){const {applyEdits:l}=await new Promise((n,da)=>k(["./graphics/editingSupport"],n,da));await this.load();b=await l(this,this.source,b,f);this.read({extent:this.source.sourceJSON.extent,timeInfo:this.source.sourceJSON.timeInfo},{origin:"service",ignoreDefaults:!0});return b}on(b,f){return super.on(b,f)}createPopupTemplate(b){return aa.createPopupTemplate(this,b)}createQuery(){const b=new x, |
|
f=this.capabilities?.data;b.returnGeometry=!0;f&&f.supportsZ&&(b.returnZ=!0);b.outFields=["*"];b.where=this.definitionExpression||"1\x3d1";const {timeOffset:l,timeExtent:n}=this;b.timeExtent=null!=l&&null!=n?n.offset(-l.value,l.unit):n||null;return b}getFieldDomain(b,f){return this.getField(b)?.domain}getField(b){return this.fieldsIndex.get(b)}queryFeatures(b,f){return this.load().then(()=>this.source.queryFeatures(x.from(b)||this.createQuery(),f)).then(l=>{if(l?.features)for(const n of l.features)n.layer= |
|
n.sourceLayer=this;return l})}queryObjectIds(b,f){return this.load().then(()=>this.source.queryObjectIds(x.from(b)||this.createQuery(),f))}queryFeatureCount(b,f){return this.load().then(()=>this.source.queryFeatureCount(x.from(b)||this.createQuery(),f))}queryExtent(b,f){return this.load().then(()=>this.source.queryExtent(x.from(b)||this.createQuery(),f))}async hasDataChanged(){try{const {dataChanged:b,updates:f}=await this.source.refresh(this.customParameters);null!=f&&this.read(f,{origin:"service", |
|
url:this.parsedUrl,ignoreDefaults:!0});return b}catch{}return!1}};c.__decorate([a.property({readOnly:!0,json:{read:!1,write:!1}})],d.prototype,"capabilities",null);c.__decorate([a.property({type:String})],d.prototype,"copyright",void 0);c.__decorate([a.property({readOnly:!0})],d.prototype,"createQueryVersion",null);c.__decorate([a.property(ba.timeZoneProperty("dateFieldsTimeReference"))],d.prototype,"dateFieldsTimeZone",void 0);c.__decorate([a.property({readOnly:!0})],d.prototype,"defaultPopupTemplate", |
|
null);c.__decorate([a.property({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],d.prototype,"definitionExpression",void 0);c.__decorate([a.property({type:String})],d.prototype,"displayField",void 0);c.__decorate([a.property({type:Boolean})],d.prototype,"editingEnabled",void 0);c.__decorate([a.property(m.elevationInfo)],d.prototype,"elevationInfo",void 0);c.__decorate([a.property({type:[W],json:{name:"layerDefinition.fields",write:{ignoreOrigin:!0, |
|
isRequired:!0},origins:{service:{name:"fields"}}}})],d.prototype,"fields",void 0);c.__decorate([a.property(y.fieldsIndex)],d.prototype,"fieldsIndex",void 0);c.__decorate([a.property({type:ca,json:{name:"extent"}})],d.prototype,"fullExtent",void 0);c.__decorate([a.property({type:["point","polygon","polyline","multipoint"],json:{read:{reader:g.featureGeometryTypeKebabDictionary.read}}})],d.prototype,"geometryType",void 0);c.__decorate([a.property({type:Boolean})],d.prototype,"hasZ",void 0);c.__decorate([a.property(m.id)], |
|
d.prototype,"id",void 0);c.__decorate([a.property({type:Boolean,readOnly:!0})],d.prototype,"isTable",null);c.__decorate([a.property(m.labelsVisible)],d.prototype,"labelsVisible",void 0);c.__decorate([a.property({type:[Y],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:Z.reader},write:!0}})],d.prototype,"labelingInfo",void 0);c.__decorate([a.property(m.legendEnabled)],d.prototype,"legendEnabled",void 0);c.__decorate([a.property({type:["show","hide"]})],d.prototype,"listMode",void 0); |
|
c.__decorate([a.property({type:String,json:{name:"layerDefinition.objectIdField",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"objectIdField"}}}})],d.prototype,"objectIdField",void 0);c.__decorate([a.property(m.opacity)],d.prototype,"opacity",void 0);c.__decorate([a.property({type:["GeoJSON"]})],d.prototype,"operationalLayerType",void 0);c.__decorate([a.property(y.outFields)],d.prototype,"outFields",void 0);c.__decorate([a.property({readOnly:!0})],d.prototype,"parsedUrl",null);c.__decorate([a.property(m.popupEnabled)], |
|
d.prototype,"popupEnabled",void 0);c.__decorate([a.property({type:z,json:{name:"popupInfo",write:!0}})],d.prototype,"popupTemplate",void 0);c.__decorate([a.property({types:A.rendererTypes,json:{name:"layerDefinition.drawingInfo.renderer",write:!0,origins:{service:{name:"drawingInfo.renderer"},"web-scene":{types:A.webSceneRendererTypes}}}})],d.prototype,"renderer",null);c.__decorate([a.property(m.screenSizePerspectiveEnabled)],d.prototype,"screenSizePerspectiveEnabled",void 0);c.__decorate([a.property({readOnly:!0})], |
|
d.prototype,"source",void 0);c.__decorate([a.property({type:M})],d.prototype,"spatialReference",void 0);c.__decorate([a.property({type:[V]})],d.prototype,"templates",void 0);c.__decorate([a.property()],d.prototype,"title",void 0);c.__decorate([a.property({json:{read:!1},readOnly:!0})],d.prototype,"type",void 0);c.__decorate([a.property(m.url)],d.prototype,"url",null);return d=c.__decorate([r.subclass("esri.layers.GeoJSONLayer")],d)}); |