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.
26 lines
12 KiB
26 lines
12 KiB
// All material copyright Esri, All Rights Reserved, unless otherwise specified. |
|
// See https://js.arcgis.com/4.30/esri/copyright.txt for details. |
|
//>>built |
|
define("exports ../request ./featureSetCollection ../chunks/languageUtils ./featureset/actions/AttributeFilter ./featureset/actions/GroupBy ./featureset/actions/OrderBy ./featureset/actions/SpatialFilter ./featureset/actions/Top ./featureset/sources/FeatureLayerDynamic ./featureset/sources/FeatureLayerMemory ./featureset/sources/FeatureLayerRelated ./featureset/support/cache ./featureset/support/errorsupport ./featureset/support/shared ../core/Loadable ../core/sql/WhereClause ../layers/FeatureLayer ../layers/Layer ../portal/PortalItem".split(" "), |
|
function(p,v,x,y,F,G,H,I,J,K,L,M,k,z,t,A,B,r,N,O){async function u(a,d,b){if(k.applicationCache){if(b=k.applicationCache.getLayerInfo(a))return b=await b,new r({url:a,outFields:d,sourceJSON:b});const c=new r({url:a,outFields:d});d=(async()=>{await c.load();return c.sourceJSON})();if(k.applicationCache){k.applicationCache.setLayerInfo(a,d);try{return await d,c}catch(e){throw k.applicationCache.clearLayerInfo(a),e;}}await d;return c}if(null!=b){const c=b.getCachedLayerMetadata(a);if(c)return b=await c, |
|
new r({url:a,outFields:d,sourceJSON:b});const e=new r({url:a,outFields:d});d=(async()=>{await e.load();return e.sourceJSON})();b.setCachedLayerMetadata(a,d);try{return await d,e}catch(f){throw b.removeCachedLayerMetadata(a,d),f;}}return new r({url:a,outFields:d})}async function w(a,d,b,c,e,f=null){a=await u(a,["*"],e);return l(a,d,b,c,e,f)}function l(a,d=null,b=null,c=!0,e=null,f=null){if("catalog-footprint"===a.type)return l(a.parent,d,b,c,e,f);if("subtype-sublayer"===a.type)return d=l(a.parent, |
|
d,b,c,e,f),d.filter(B.WhereClause.create(a.parent.subtypeField+"\x3d"+a.subtypeCode.toString(),a.parent.fieldsIndex,d.dateFieldsTimeZoneDefaultUTC));if(t.isSupportedSourceLayer(a))return d={layer:a,spatialReference:d,outFields:b,includeGeometry:c,lrucache:e,interceptor:f},!0===!(a.url||!a.source)?new L(d):new K(d);throw Error(`Unsupported layer type: ${a.type}`);}async function P(a){if(null!==k.applicationCache){var d=k.applicationCache.getLayerInfo(a);if(null!==d)return d}d=(async()=>{const b=await v(a, |
|
{responseType:"json",query:{f:"json"}});return b.data?b.data:null})();if(null!==k.applicationCache){k.applicationCache.setLayerInfo(a,d);try{return await d}catch(b){throw k.applicationCache.clearLayerInfo(a),b;}}return d}async function Q(a,d){const b="QUERYDATAELEMTS:"+d.toString()+":"+a;if(null!==k.applicationCache){var c=k.applicationCache.getLayerInfo(b);if(null!==c)return c}c=(async()=>{var e=await v(a+"/queryDataElements",{method:"post",responseType:"json",query:{layers:JSON.stringify([d.toString()]), |
|
f:"json"}});if(e.data&&(e=e.data,e.layerDataElements?.[0]))return e.layerDataElements[0];throw new z.FeatureSetError(z.FeatureSetErrorCodes.DataElementsNotFound);})();if(null!==k.applicationCache){k.applicationCache.setLayerInfo(b,c);try{return await c}catch(e){throw k.applicationCache.clearLayerInfo(b),e;}}return c}async function C(a,d){if(null!==k.applicationCache){var b=k.applicationCache.getLayerInfo(a);if(null!==b)return b}if(null!=d&&(b=d.getCachedServiceMetadata(a),null!=b))return b;b=(async()=> |
|
{var c=await v(a,{responseType:"json",query:{f:"json"}});return c.data?(c=c.data,c.layers||(c.layers=[]),c.tables||(c.tables=[]),c):{layers:[],tables:[]}})();if(null!==k.applicationCache){k.applicationCache.setLayerInfo(a,b);try{return await b}catch(c){throw k.applicationCache.clearLayerInfo(a),c;}}if(null!=d){d.setCachedServiceMetadata(a,b);try{return await b}catch(c){throw d.removeCachedServiceMetadata(a,b),c;}}return b}F.registerAction();G.registerAction();H.registerAction();I.registerAction(); |
|
J.registerAction();class R extends x{constructor(a,d=null,b=null,c=null){super();this._map=a;this._overridespref=d;this._lrucache=b;this._interceptor=c;this._instantLayers=[]}_makeAndAddFeatureSet(a,d=!0,b=null){const c=l(a,this._overridespref,null===b?["*"]:b,d,this._lrucache,this._interceptor);this._instantLayers.push({featureset:c,opitem:a,includeGeometry:d,outFields:JSON.stringify(b)});return c}async featureSetByName(a,d=!0,b=null){if(A.isLoadable(this._map)&&!this._map.loaded)return await this._map.load(), |
|
this.featureSetByName(a,d,b);null===b&&(b=["*"]);b=b.slice(0);b=b.sort();var c=JSON.stringify(b);for(let e=0;e<this._instantLayers.length;e++){const f=this._instantLayers[e];if(f.opitem.title===a&&f.includeGeometry===d&&f.outFields===c)return this._instantLayers[e].featureset}c=this._map.allLayers.find(e=>t.isSupportedLayer(e)&&e.title===a);if(null!=c)return this._makeAndAddFeatureSet(c,d,b);if(this._map.tables&&(c=this._map.tables.find(e=>e.title===a),null!=c)){if(c instanceof r)return this._makeAndAddFeatureSet(c, |
|
d,b);null==c._materializedTable&&(c._materializedTable=new r(c.outFields?c:{...c,outFields:["*"]}));await c._materializedTable.load();return this._makeAndAddFeatureSet(c._materializedTable,d,b)}return null}async featureSetById(a,d=!0,b=["*"]){if(A.isLoadable(this._map)&&!this._map.loaded)return await this._map.load(),this.featureSetById(a,d,b);null===b&&(b=["*"]);b=b.slice(0);b=b.sort();var c=JSON.stringify(b);for(let e=0;e<this._instantLayers.length;e++){const f=this._instantLayers[e];if(f.opitem.id=== |
|
a&&f.includeGeometry===d&&f.outFields===c)return this._instantLayers[e].featureset}if(c=this._map.allLayers.find(e=>t.isSupportedLayer(e)&&e.id===a))return this._makeAndAddFeatureSet(c,d,b);if(this._map.tables&&(c=this._map.tables.find(e=>e.id===a),null!=c)){if(c instanceof r)return this._makeAndAddFeatureSet(c,d,b);null==c._materializedTable&&(c._materializedTable=new r({...c,outFields:["*"]}));await c._materializedTable.load();return this._makeAndAddFeatureSet(c._materializedTable,d,b)}return null}} |
|
class D extends x{constructor(a,d=null,b=null,c=null){super();this._url=a;this._overridespref=d;this._lrucache=b;this._interceptor=c;this.metadata=null;this._instantLayers=[]}get url(){return this._url}_makeAndAddFeatureSet(a,d=!0,b=null){const c=l(a,this._overridespref,null===b?["*"]:b,d,this._lrucache);this._instantLayers.push({featureset:c,opitem:a,includeGeometry:d,outFields:JSON.stringify(b)});return c}async _loadMetaData(){const a=await C(this._url,this._lrucache);return this.metadata=a}load(){return this._loadMetaData()}clone(){return new D(this._url, |
|
this._overridespref,this._lrucache,this._interceptor)}async featureSetByName(a,d=!0,b=null){null===b&&(b=["*"]);b=b.slice(0);b=b.sort();var c=JSON.stringify(b);for(var e=0;e<this._instantLayers.length;e++){const f=this._instantLayers[e];if(f.opitem.title===a&&f.includeGeometry===d&&f.outFields===c)return this._instantLayers[e].featureset}c=await this._loadMetaData();e=null;for(const f of c.layers??[])f.name===a&&(e=f);if(!e)for(const f of c.tables??[])f.name===a&&(e=f);return e?(a=await u(this._url+ |
|
"/"+e.id,["*"],this._lrucache),this._makeAndAddFeatureSet(a,d,b)):null}async featureSetById(a,d=!0,b=["*"]){null===b&&(b=["*"]);b=b.slice(0);b=b.sort();var c=JSON.stringify(b);a=null!==a&&void 0!==a?a.toString():"";for(var e=0;e<this._instantLayers.length;e++){const f=this._instantLayers[e];if(f.opitem.id===a&&f.includeGeometry===d&&f.outFields===c)return this._instantLayers[e].featureset}c=await this._loadMetaData();e=null;for(const f of c.layers??[])null!==f.id&&void 0!==f.id&&f.id.toString()=== |
|
a&&(e=f);if(!e)for(const f of c.tables??[])null!==f.id&&void 0!==f.id&&f.id.toString()===a&&(e=f);return e?(a=await u(this._url+"/"+e.id,["*"],this._lrucache),this._makeAndAddFeatureSet(a,d,b)):null}}p.constructAssociationMetaDataFeatureSetFromUrl=async function(a,d){var b=3,c=[],e=null,f={},h=null;h=await C(a,null);if(void 0!==h.controllerDatasetLayers?.utilityNetworkLayerId&&null!==h.controllerDatasetLayers.utilityNetworkLayerId){if(h.layers)for(var m of h.layers)f[m.id]=m.name;if(h.tables)for(var g of h.tables)f[g.id]= |
|
g.name;m=h.controllerDatasetLayers.utilityNetworkLayerId;if(h=await Q(a,m)){e=h;e?.dataElement&&void 0!==e.dataElement.schemaGeneration&&(b=e.dataElement.schemaGeneration);h={};e.dataElement.domainNetworks||(e.dataElement.domainNetworks=[]);for(var q of e.dataElement.domainNetworks){for(const n of q.edgeSources??[])g={layerId:n.layerId,sourceId:n.sourceId,className:f[n.layerId]??null},g.className&&(h[g.className]=g);for(const n of q.junctionSources??[])g={layerId:n.layerId,sourceId:n.sourceId,className:f[n.layerId]?? |
|
null},g.className&&(h[g.className]=g)}if(e.dataElement.terminalConfigurations)for(const n of e.dataElement.terminalConfigurations)for(const E of n.terminals)c.push({terminalId:E.terminalId,terminalName:E.terminalName});f=await P(a+"/"+m);if(void 0!==f.systemLayers?.associationsTableId&&null!==f.systemLayers.associationsTableId)return q=[],4<=b&&(q.push("STATUS"),q.push("PERCENTALONG")),a=await w(a+"/"+f.systemLayers.associationsTableId.toString(),d,["OBJECTID","FROMNETWORKSOURCEID","TONETWORKSOURCEID", |
|
"FROMGLOBALID","TOGLOBALID","TOTERMINALID","FROMTERMINALID","ASSOCIATIONTYPE","ISCONTENTVISIBLE","GLOBALID",...q],!1,null,null),await a.load(),4<=b&&(a=a.filter(B.WhereClause.create("STATUS NOT IN (1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62, 63)",a.getFieldsIndex(),a.dateFieldsTimeZoneDefaultUTC)),await a.load()),{lkp:h,associations:a, |
|
unVersion:b,terminals:c}}}return{associations:null,unVersion:b,lkp:null,terminals:[]}};p.constructFeatureSet=l;p.constructFeatureSetFromPortalItem=async function(a,d,b,c,e,f,h,m=null){if(k.applicationCache){var g=k.applicationCache.getLayerInfo(a+":"+f.url);if(g)return a=await g,d=await u(t.extractServiceUrl(a.url??"")+"/"+d,["*"],h),l(d,b,c,e,h,m)}if(null!=h&&(g=h.getCachedPortalItem(f.url,a),null!=g))return a=await g,d=await u(t.extractServiceUrl(a.url??"")+"/"+d,["*"],h),l(d,b,c,e,h,m);g=(new O({id:a, |
|
portal:f})).load();k.applicationCache?k.applicationCache.setLayerInfo(a+":"+f.url,g):null!=h&&h.setCachedPortalItem(f.url,a,g);try{const q=await g,n=await u(t.extractServiceUrl(q.url??"")+"/"+d,["*"],h);return l(n,b,c,e,h,m)}catch(q){throw k.applicationCache&&k.applicationCache.clearLayerInfo(a+":"+f.url),null!=h&&h.removeCachedPortalItem(f.url,a,g),q;}};p.constructFeatureSetFromRelationship=async function(a,d,b,c=null,e=null,f=!0,h=null,m=null){var g=a.serviceUrl();if(!g)return null;g="/"===g.charAt(g.length- |
|
1)?g+d.relatedTableId.toString():g+"/"+d.relatedTableId.toString();g=await w(g,c,e,f,h,m);return new M({layer:a,relatedLayer:g,relationship:d,objectId:b,spatialReference:c,outFields:e,includeGeometry:f,lrucache:h,interceptor:m})};p.constructFeatureSetFromUrl=w;p.convertToFeatureSet=function(a,d,b,c,e){if(null===a)return null;if(y.isFeatureSet(a)){switch(d){case "datasource":return a.getDataSourceFeatureSet();case "parent":return a;case "root":return a.getRootFeatureSet()}return null}if(a instanceof |
|
N&&t.isSupportedSourceLayer(a)){switch(d){case "datasource":return l(a,e,a.outFields,!0,b,c).getDataSourceFeatureSet();case "parent":return l(a,e,a.outFields,!0,b,c);case "root":return l(a,e,a.outFields,!0,b,c)}return null}if(y.isSubtypeSublayer(a))switch(d){case "datasource":return l(a.parent,e,a.parent.outFields,!0,b,c).getDataSourceFeatureSet();case "parent":return l(a,e,a.parent.outFields,!0,b,c);case "root":return l(a,e,a.parent.outFields,!0,b,c)}return null};p.createFeatureSetCollectionFromMap= |
|
function(a,d,b=null,c=null){return new R(a,d,b,c)};p.createFeatureSetCollectionFromService=function(a,d,b=null,c=null){return new D(a,d,b,c)};p.initialiseMetaDataCache=function(){null===k.applicationCache&&(k.applicationCache=new k)};Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})}); |