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.
18 lines
7.9 KiB
18 lines
7.9 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("require ../chunks/tslib.es6 ../geometry ../Graphic ../request ../core/Error ../core/Loadable ../core/Logger ../core/MultiOriginJSONSupport ../core/promiseUtils ../core/urlUtils ../core/accessorSupport/decorators/property ../core/has ../core/RandomLCG ../core/accessorSupport/decorators/subclass ../geometry/Extent ../geometry/support/jsonUtils ../layers/mixins/EditBusLayer ../layers/support/arcgisLayerUrl ./support/TopologyValidationJobInfo ./support/utils ../versionManagement/support/versionManagementUtils ../geometry/SpatialReference".split(" "), |
|
function(q,e,d,z,u,w,A,B,C,D,E,f,K,L,F,G,H,r,x,I,J,p,y){function t(a,b){return new z({attributes:a.attributes,geometry:H.fromJSON({...a.geometry,spatialReference:b})})}const v=a=>Object.freeze(Object.defineProperty({__proto__:null,default:a},Symbol.toStringTag,{value:"Module"}));d=class extends C.MultiOriginJSONMixin(A){static fromPortalItem(a){return J.networkFromPortalItem(a)}constructor(a){super(a);this.historicMoment=this.gdbVersion=this.sourceJSON=this.type=this.spatialReference=this.fullExtent= |
|
this.dataElement=this.layerUrl=this.title=this.id=null;this._applyEditsHandler=b=>{const {serviceUrl:c,gdbVersion:g,result:l}=b;b=c===this.featureServiceUrl;const h=r.versionMatches(c,g,this.gdbVersion);b&&h&&l.then(k=>{p.isVersionInEditSession(c,g)&&(this.historicMoment=k.historicMoment)})};this._updateMomentHandler=b=>{const {serviceUrl:c,gdbVersion:g,moment:l}=b;b=c===this.featureServiceUrl;const h=r.versionMatches(c,g,this.gdbVersion);b&&h&&(this.historicMoment=l)};this.when().then(()=>{this.addHandles([r.onApplyEditsEvent(this._applyEditsHandler), |
|
r.onUpdateMomentEvent(this._updateMomentHandler)])},()=>{})}initialize(){this.when().catch(a=>{D.isAbortError(a)||B.getLogger(this).error("#load()",`Failed to load layer (title: '${this.title??"no title"}', id: '${this.id??"no id"}')`,{error:a})})}get datasetName(){return this.dataElement?.name??null}get owner(){return this.dataElement?.userIdentity??null}get schemaGeneration(){return this.dataElement?.schemaGeneration??null}get parsedUrl(){return E.urlToObject(this.layerUrl)}get featureServiceUrl(){return x.parse(this.parsedUrl.path).url.path}get networkServiceUrl(){return this.featureServiceUrl.replace(/\/FeatureServer/i, |
|
"/UtilityNetworkServer")}get layerId(){return x.parse(this.parsedUrl.path).sublayer}get networkSystemLayers(){return null}async load(a){this.addResolvingPromise(this._fetchDataElement(this.featureServiceUrl,this.layerId.toString(),a));this.addResolvingPromise(this._fetchLayerMetaData(this.layerUrl,a));return this}getLayerIdBySourceId(a){if(this.dataElement){const b=this.dataElement.domainNetworks;for(const c of b){for(const g of c.edgeSources??[])if(g.sourceId===a)return g.layerId;for(const g of c.junctionSources?? |
|
[])if(g.sourceId===a)return g.layerId}}return null}async queryNamedTraceConfigurations(a,b){const [{queryNamedTraceConfigurations:c},{default:g}]=await Promise.all([new Promise((h,k)=>q(["../rest/networks/queryNamedTraceConfigurations"],h,k)),new Promise((h,k)=>q(["../rest/networks/support/QueryNamedTraceConfigurationsParameters"],m=>h(v(m)),k))]),l=this.networkServiceUrl;a=g.from(a);return(await c(l,a,{...b}))?.namedTraceConfigurations}async validateTopology(a,b){if(!a.validateArea)throw new w("network:undefined-validateArea", |
|
"the network must have validateArea defined in the validate network topology parameters.");const [{validateNetworkTopology:c},{default:g}]=await Promise.all([new Promise((k,m)=>q(["../rest/networks/validateNetworkTopology"],k,m)),new Promise((k,m)=>q(["../rest/networks/support/ValidateNetworkTopologyParameters"],n=>k(v(n)),m))]);var l=g.from(a);p.isVersionInEditSession(this.featureServiceUrl,this.gdbVersion||null)?(l.sessionID=p.currentSessionId,await p.isSafeToEditVersion(this.featureServiceUrl, |
|
this.gdbVersion,!0)):l.sessionID=null;l.gdbVersion=this.gdbVersion;var h=this.networkServiceUrl;a=r.emitApplyEditsEvent(this.featureServiceUrl,null,this.gdbVersion,!0);b=await c(h,l,{...b});if(b?.serviceEdits){l=[];for(const k of b.serviceEdits){({editedFeatures:h}=k);const m=h?.spatialReference?new y(h.spatialReference):null;l.push({layerId:k.layerId,editedFeatures:{adds:h?.adds?.map(n=>t(n,m))||[],updates:h?.updates?.map(n=>({original:t(n[0],m),current:t(n[1],m)}))||[],deletes:h?.deletes?.map(n=> |
|
t(n,m))||[],spatialReference:m}})}a.resolve({edits:null,addedFeatures:[],updatedFeatures:[],deletedFeatures:[],addedAttachments:[],updatedAttachments:[],deletedAttachments:[],editedFeatures:l,exceededTransferLimit:!1,historicMoment:b.moment})}return b}async submitTopologyValidationJob(a,b){var c=null;if(!a.validateArea)throw new w("network:undefined-validateArea","the network must have validateArea defined in the validate network topology parameters.");this.gdbVersion||(c=this.layerUrl.replace(/\/FeatureServer/i, |
|
"/VersionManagementServer").replace(/\/\d*$/,""),c=(await u(c,{responseType:"json",query:{f:"json"}})).data.defaultVersionName);const [{submitValidateNetworkTopologyJob:g},{default:l}]=await Promise.all([new Promise((k,m)=>q(["../rest/networks/validateNetworkTopology"],k,m)),new Promise((k,m)=>q(["../rest/networks/support/ValidateNetworkTopologyParameters"],n=>k(v(n)),m))]);a=l.from(a);p.isVersionInEditSession(this.featureServiceUrl,this.gdbVersion||null)?(a.sessionID=p.currentSessionId,await p.isSafeToEditVersion(this.featureServiceUrl, |
|
this.gdbVersion,!0)):a.sessionID=null;a.gdbVersion=this.gdbVersion||c;const h=this.networkServiceUrl;c=this.featureServiceUrl?r.emitApplyEditsEvent(this.featureServiceUrl,null,this.gdbVersion,!0):void 0;b=await g(h,a,{...b});return new I({statusUrl:b,editsResolver:c})}async _fetchLayerMetaData(a,b){a=await u(a,{responseType:"json",query:{f:"json"},...b});this.sourceJSON=a.data;this.read(a.data,{origin:"service"})}async _fetchDataElement(a,b,c){this.dataElement||(a=await u(`${a}/queryDataElements`, |
|
{responseType:"json",query:{layers:JSON.stringify([b]),f:"json"},...c}).then(g=>g.data.layerDataElements?.[0]))&&this.read(a,{origin:"service"})}};e.__decorate([f.property({type:String,nonNullable:!0,json:{origins:{"web-map":{read:!0,write:{isRequired:!0}},service:{read:!0}},read:!1}})],d.prototype,"id",void 0);e.__decorate([f.property({type:String,nonNullable:!0,json:{origins:{"web-map":{read:!0,write:{isRequired:!0}},service:{read:{source:"name"}}},read:!1}})],d.prototype,"title",void 0);e.__decorate([f.property({type:String, |
|
nonNullable:!0,json:{origins:{"web-map":{read:{source:"url"},write:{target:"url",isRequired:!0}}},read:!1}})],d.prototype,"layerUrl",void 0);e.__decorate([f.property({type:Object,json:{origins:{service:{read:!0}},read:!1}})],d.prototype,"dataElement",void 0);e.__decorate([f.property({type:G,json:{origins:{service:{read:{source:"extent"}}},read:!1}})],d.prototype,"fullExtent",void 0);e.__decorate([f.property({type:y,json:{origins:{service:{read:{source:"extent.spatialReference"}}},read:!1}})],d.prototype, |
|
"spatialReference",void 0);e.__decorate([f.property({type:["utility","trace"],readOnly:!0,json:{read:!1,write:!1}})],d.prototype,"type",void 0);e.__decorate([f.property({readOnly:!0})],d.prototype,"datasetName",null);e.__decorate([f.property({readOnly:!0})],d.prototype,"owner",null);e.__decorate([f.property({readOnly:!0})],d.prototype,"schemaGeneration",null);e.__decorate([f.property({readOnly:!0})],d.prototype,"parsedUrl",null);e.__decorate([f.property({readOnly:!0})],d.prototype,"featureServiceUrl", |
|
null);e.__decorate([f.property({readOnly:!0})],d.prototype,"networkServiceUrl",null);e.__decorate([f.property({readOnly:!0})],d.prototype,"layerId",null);e.__decorate([f.property()],d.prototype,"sourceJSON",void 0);e.__decorate([f.property({readOnly:!0})],d.prototype,"networkSystemLayers",null);e.__decorate([f.property()],d.prototype,"gdbVersion",void 0);e.__decorate([f.property({type:Date})],d.prototype,"historicMoment",void 0);return d=e.__decorate([F.subclass("esri.networks.Network")],d)}); |