@arcgis/core 4.32.0-next.20250218 → 4.32.0-next.20250220
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/applications/ExperienceBuilder/sketchUtils.d.ts +1 -0
- package/applications/ExperienceBuilder/sketchUtils.js +1 -1
- package/arcade/treeAnalysis.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0c3930e40fc9f8a84599.js +2 -0
- package/assets/esri/core/workers/chunks/{ccee343fb8c415b59ce3.js.LICENSE.txt → 0c3930e40fc9f8a84599.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{5f1af0a190f3425aa049.js → 0e178ec7ee6a7301c6a7.js} +1 -1
- package/assets/esri/core/workers/chunks/{a42ae5d5e5f66d120b4d.js → 21c7265f1f2a718de7c6.js} +1 -1
- package/assets/esri/core/workers/chunks/{36978fd30b24e721c6ba.js → 2def7db73a776e759dae.js} +1 -1
- package/assets/esri/core/workers/chunks/4289635b2fabad2c16fd.js +1 -0
- package/assets/esri/core/workers/chunks/486df1e042204b90b0dd.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{c2d539359f321bba3432.js → 52c13b3c074c9f6dadde.js} +2 -2
- package/assets/esri/core/workers/chunks/{c2d539359f321bba3432.js.LICENSE.txt → 52c13b3c074c9f6dadde.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/5693d9ce4472a4c5959f.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/5984ab09ea8010f8a874.js +1 -0
- package/assets/esri/core/workers/chunks/5b56b271afb0fadf48b4.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/6518954889df2e781c47.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{f1c9595096c047e93145.js → 7b07410fe98015b80c74.js} +1 -1
- package/assets/esri/core/workers/chunks/a5acbdb8347a809a26c0.js +1 -0
- package/assets/esri/core/workers/chunks/a5c9f0102b25170bb348.js +1 -0
- package/assets/esri/core/workers/chunks/aadd13261b245116d958.js +1 -0
- package/assets/esri/core/workers/chunks/b0952b81d5be214262dd.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{c9aed9a43d9935e7c768.js → bc25e34a1db735967dc5.js} +1 -1
- package/assets/esri/core/workers/chunks/{841b62c0603962d4aa75.js → bd3487b587851b20ff2a.js} +1 -1
- package/assets/esri/core/workers/chunks/bef2a1096b1b0e646e32.js +1 -0
- package/assets/esri/core/workers/chunks/cf285e45c18cd4399dde.js +1 -0
- package/assets/esri/core/workers/chunks/{2479be4fbc1abe5bf404.js → d4e7de3eb7c0cf6efc19.js} +13 -12
- package/assets/esri/core/workers/chunks/ebe832bd57a316364ca1.js +1 -0
- package/assets/esri/core/workers/chunks/f664cc15238c8e9856a0.js +1 -0
- package/assets/esri/core/workers/chunks/fbf42597b2af21eb0de4.js +1 -0
- package/assets/esri/themes/base/widgets/_Editor.scss +7 -0
- package/assets/esri/themes/base/widgets/_ResponsiveToolbar.scss +9 -3
- package/assets/esri/themes/base/widgets/_Sketch.scss +32 -24
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ar.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bg.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bs.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ca.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_cs.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_da.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_de.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_el.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_en.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_es.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_et.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fi.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_he.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hu.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_id.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_it.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ja.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ko.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lt.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lv.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_nl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_no.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-BR.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-PT.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ro.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ru.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sk.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sv.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_th.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_tr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_uk.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_vi.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-CN.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-HK.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-TW.json +1 -1
- package/chunks/RealisticTree.glsl.js +18 -17
- package/copyright.txt +20 -0
- package/geometry/support/meshUtils/elevation.js +1 -1
- package/interfaces.d.ts +400 -58
- package/layers/BuildingSceneLayer.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/IntegratedMeshLayer.js +1 -1
- package/layers/OrientedImageryLayer.js +1 -1
- package/layers/PointCloudLayer.js +1 -1
- package/layers/RouteLayer.js +1 -1
- package/layers/support/rasterFunctionUtils.d.ts +11 -0
- package/networks/UtilityNetwork.js +1 -1
- package/package.json +2 -2
- package/portal/Portal.js +1 -1
- package/rest/route.js +1 -1
- package/rest/support/AttributeBinsQuery.js +1 -1
- package/rest/support/RouteParameters.js +1 -1
- package/rest/support/RouteSolveResult.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/webgl/TextureManager.js +1 -1
- package/views/2d/engine/webgl/Utils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
- package/views/3d/camera/constraintUtils/tilt.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/support/FeatureTile.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/webmap/utils.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/contingentValuesUtils.js +5 -0
- package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/CatalogLayerList.js +1 -1
- package/widgets/Directions/DirectionsViewModel.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/Editor/components/Prompt.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/ElevationProfile/components/LegendItem.js +1 -1
- package/widgets/ElevationProfile/components/SettingsButton.js +1 -1
- package/widgets/Feature/FeatureUtilityNetworkAssociations.js +1 -1
- package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
- package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
- package/widgets/FeatureForm/featureFormUtils.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/Legend/styles/support/utils.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageOverlays.js +1 -1
- package/widgets/OrientedImageryViewer/digitizationUtils.js +1 -1
- package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Sketch/support/ResponsiveToolbar/OverflowGroup.js +1 -1
- package/widgets/Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js +1 -1
- package/widgets/Sketch/support/ResponsiveToolbar/SplitButton.js +1 -1
- package/widgets/Sketch/support/sketchUtils.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/widgets/support/UtilityNetworkAssociations/utilityNetworkUtils.js +1 -1
- package/assets/esri/core/workers/chunks/05ef9aee26bd91af7d72.js +0 -1
- package/assets/esri/core/workers/chunks/1bf646c9fc352f98d1ca.js +0 -1
- package/assets/esri/core/workers/chunks/25e093b845aa995c7b38.js +0 -1
- package/assets/esri/core/workers/chunks/3c591f76e7d6204b7780.js +0 -1
- package/assets/esri/core/workers/chunks/4b588886f11df145d74c.js +0 -1
- package/assets/esri/core/workers/chunks/6039da57a2adedd3b83f.js +0 -1
- package/assets/esri/core/workers/chunks/802a390c67f4cdf3d8d9.js +0 -1
- package/assets/esri/core/workers/chunks/842db06ce62758fab1e7.js +0 -1
- package/assets/esri/core/workers/chunks/86f3a004addc087ad6c6.js +0 -1
- package/assets/esri/core/workers/chunks/ccee343fb8c415b59ce3.js +0 -2
- package/assets/esri/core/workers/chunks/cf498c621dc1f865530e.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import r from"../core/Collection.js";import t from"../core/CollectionFlattener.js";import s from"../core/Error.js";import{clone as i}from"../core/lang.js";import{loadAll as o}from"../core/loadAll.js";import a from"../core/Logger.js";import{MultiOriginJSONMixin as l}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as n}from"../core/promiseUtils.js";import{join as p}from"../core/urlUtils.js";import{property as u}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import{reader as y}from"../core/accessorSupport/decorators/reader.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import d from"../geometry/SpatialReference.js";import m from"./Layer.js";import h from"./buildingSublayers/BuildingComponentSublayer.js";import f from"./buildingSublayers/BuildingGroupSublayer.js";import{APIKeyMixin as b}from"./mixins/APIKeyMixin.js";import{ArcGISService as g}from"./mixins/ArcGISService.js";import{CustomParametersMixin as S}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as v}from"./mixins/OperationalLayer.js";import{PortalLayer as j}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as w}from"./mixins/ScaleRangeLayer.js";import{SceneService as _,SaveOperationType as I}from"./mixins/SceneService.js";import{findAssociatedFeatureService as L}from"./support/associatedFeatureServiceUtils.js";import O from"./support/BuildingFilter.js";import T from"./support/BuildingSummaryStatistics.js";import{sceneLayerFullExtent as x,legendEnabled as A,readOnlyService as E,elevationInfo as F}from"./support/commonProperties.js";import{logInvalidElevationInfoWarning as P,elevationModeRequiredMessage as B,featureExpressionUnsupportedMessage as K}from"../support/elevationInfoUtils.js";const C=r.ofType(O),R=i(f.sublayersProperty),M=R.json?.origins;M&&(M["web-scene"]={type:[h],write:{enabled:!0,overridePolicy:()=>({enabled:!1})}},M["portal-item"]={type:[h],write:{enabled:!0,overridePolicy:()=>({enabled:!1})}});let U=class extends(_(g(v(j(w(l(S(b(m))))))))){constructor(e){super(e),this.operationalLayerType="BuildingSceneLayer",this.allSublayers=new t({getCollections:()=>[this.sublayers],getChildrenFunction:e=>"building-group"===e.type?e.sublayers:null}),this.sublayers=null,this._allSublayerOverrides=null,this.filters=new C,this.activeFilterId=null,this.summaryStatistics=null,this.outFields=null,this.legendEnabled=!0,this.type="building-scene"}normalizeCtorArgs(e){return"string"==typeof e?{url:e}:e??{}}destroy(){this.allSublayers.destroy()}readSublayers(e,r,t){const s=f.readSublayers(e,r,t);return f.forEachSublayer(s,(e=>e.layer=this)),this._allSublayerOverrides&&(H(s,this._allSublayerOverrides),this._allSublayerOverrides=null),s}write(e,r){return e=super.write(e,r),!r||"web-scene"!==r.origin&&"portal-item"!==r.origin||(this.sublayers?G(this.sublayers,e,r):this._allSublayerOverrides&&V(this._allSublayerOverrides,e,r)),e}read(e,r){if(super.read(e,r),("web-scene"===r?.origin||"portal-item"===r?.origin)&&Array.isArray(e?.sublayers)){const t=k(e.sublayers,r);this.sublayers?N(this.sublayers,t):(this._allSublayerOverrides??=new Map,this._allSublayerOverrides.set(r.origin,t))}}readSummaryStatistics(e,r){if("string"==typeof r.statisticsHRef){const e=p(this.parsedUrl?.path,r.statisticsHRef);return new T({url:e})}return null}set elevationInfo(e){this._set("elevationInfo",e),this._validateElevationInfo()}load(e){const r=null!=e?e.signal:null,t=this.loadFromPortal({supportedTypes:["Scene Service"]},e).catch(n).then((()=>this._fetchService(r))).then((()=>this._fetchAssociatedFeatureService(r)));return this.addResolvingPromise(t),Promise.resolve(this)}loadAll(){return o(this,(e=>{f.forEachSublayer(this.sublayers,(r=>{"building-group"!==r.type&&e(r)})),this.summaryStatistics&&e(this.summaryStatistics)}))}async saveAs(e,r){return this._debouncedSaveOperations(I.SAVE_AS,{...r,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"building-scene"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"building-scene"};return this._debouncedSaveOperations(I.SAVE,e)}validateLayer(e){if(!e.layerType||"Building"!==e.layerType)throw new s("buildingscenelayer:layer-type-not-supported","BuildingSceneLayer does not support this layer type",{layerType:e.layerType})}_getTypeKeywords(){return["Building"]}async _fetchAssociatedFeatureService(e){try{const{portalItem:r}=await L(`${this.url}/layers/${this.layerId}`,{sceneLayerItem:this.portalItem,customParameters:this.customParameters,apiKey:this.apiKey,signal:e});this.associatedFeatureServiceItem=r}catch(r){a.getLogger(this).warn("Associated feature service item could not be loaded",r)}}_validateElevationInfo(){const
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import r from"../core/Collection.js";import t from"../core/CollectionFlattener.js";import s from"../core/Error.js";import{clone as i}from"../core/lang.js";import{loadAll as o}from"../core/loadAll.js";import a from"../core/Logger.js";import{MultiOriginJSONMixin as l}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as n}from"../core/promiseUtils.js";import{join as p}from"../core/urlUtils.js";import{property as u}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import{reader as y}from"../core/accessorSupport/decorators/reader.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import d from"../geometry/SpatialReference.js";import m from"./Layer.js";import h from"./buildingSublayers/BuildingComponentSublayer.js";import f from"./buildingSublayers/BuildingGroupSublayer.js";import{APIKeyMixin as b}from"./mixins/APIKeyMixin.js";import{ArcGISService as g}from"./mixins/ArcGISService.js";import{CustomParametersMixin as S}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as v}from"./mixins/OperationalLayer.js";import{PortalLayer as j}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as w}from"./mixins/ScaleRangeLayer.js";import{SceneService as _,SaveOperationType as I}from"./mixins/SceneService.js";import{findAssociatedFeatureService as L}from"./support/associatedFeatureServiceUtils.js";import O from"./support/BuildingFilter.js";import T from"./support/BuildingSummaryStatistics.js";import{sceneLayerFullExtent as x,legendEnabled as A,readOnlyService as E,elevationInfo as F}from"./support/commonProperties.js";import{logInvalidElevationInfoWarning as P,elevationModeRequiredMessage as B,featureExpressionUnsupportedMessage as K}from"../support/elevationInfoUtils.js";const C=r.ofType(O),R=i(f.sublayersProperty),M=R.json?.origins;M&&(M["web-scene"]={type:[h],write:{enabled:!0,overridePolicy:()=>({enabled:!1})}},M["portal-item"]={type:[h],write:{enabled:!0,overridePolicy:()=>({enabled:!1})}});let U=class extends(_(g(v(j(w(l(S(b(m))))))))){constructor(e){super(e),this.operationalLayerType="BuildingSceneLayer",this.allSublayers=new t({getCollections:()=>[this.sublayers],getChildrenFunction:e=>"building-group"===e.type?e.sublayers:null}),this.sublayers=null,this._allSublayerOverrides=null,this.filters=new C,this.activeFilterId=null,this.summaryStatistics=null,this.outFields=null,this.legendEnabled=!0,this.type="building-scene"}normalizeCtorArgs(e){return"string"==typeof e?{url:e}:e??{}}destroy(){this.allSublayers.destroy()}readSublayers(e,r,t){const s=f.readSublayers(e,r,t);return f.forEachSublayer(s,(e=>e.layer=this)),this._allSublayerOverrides&&(H(s,this._allSublayerOverrides),this._allSublayerOverrides=null),s}write(e,r){return e=super.write(e,r),!r||"web-scene"!==r.origin&&"portal-item"!==r.origin||(this.sublayers?G(this.sublayers,e,r):this._allSublayerOverrides&&V(this._allSublayerOverrides,e,r)),e}read(e,r){if(super.read(e,r),("web-scene"===r?.origin||"portal-item"===r?.origin)&&Array.isArray(e?.sublayers)){const t=k(e.sublayers,r);this.sublayers?N(this.sublayers,t):(this._allSublayerOverrides??=new Map,this._allSublayerOverrides.set(r.origin,t))}}readSummaryStatistics(e,r){if("string"==typeof r.statisticsHRef){const e=p(this.parsedUrl?.path,r.statisticsHRef);return new T({url:e})}return null}set elevationInfo(e){null!=e&&"absolute-height"!==e.mode||this._set("elevationInfo",e),this._validateElevationInfo(e)}load(e){const r=null!=e?e.signal:null,t=this.loadFromPortal({supportedTypes:["Scene Service"]},e).catch(n).then((()=>this._fetchService(r))).then((()=>this._fetchAssociatedFeatureService(r)));return this.addResolvingPromise(t),Promise.resolve(this)}loadAll(){return o(this,(e=>{f.forEachSublayer(this.sublayers,(r=>{"building-group"!==r.type&&e(r)})),this.summaryStatistics&&e(this.summaryStatistics)}))}async saveAs(e,r){return this._debouncedSaveOperations(I.SAVE_AS,{...r,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"building-scene"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"building-scene"};return this._debouncedSaveOperations(I.SAVE,e)}validateLayer(e){if(!e.layerType||"Building"!==e.layerType)throw new s("buildingscenelayer:layer-type-not-supported","BuildingSceneLayer does not support this layer type",{layerType:e.layerType})}_getTypeKeywords(){return["Building"]}async _fetchAssociatedFeatureService(e){try{const{portalItem:r}=await L(`${this.url}/layers/${this.layerId}`,{sceneLayerItem:this.portalItem,customParameters:this.customParameters,apiKey:this.apiKey,signal:e});this.associatedFeatureServiceItem=r}catch(r){a.getLogger(this).warn("Associated feature service item could not be loaded",r)}}_validateElevationInfo(e){const r="Building scene layers";P(a.getLogger(this),B(r,"absolute-height",e)),P(a.getLogger(this),K(r,e))}};function H(e,r){r.forEach((r=>N(e,r)))}function N(e,r){const{overrides:t,context:s}=r;f.forEachSublayer(e,(e=>e.read(t.get(e.id),s)))}function k(e,r){const t=new Map;for(const i of e)null!=i&&"object"==typeof i&&"number"==typeof i.id?t.set(i.id,i):r.messages?.push(new s("building-scene-layer:invalid-sublayer-override","Invalid value for sublayer override. Not an object or no id specified.",{value:i}));return{overrides:t,context:r}}function G(e,r,t){const s=[];f.forEachSublayer(e,(e=>{const r=e.write({},t);Object.keys(r).length>1&&s.push(r)})),s.length>0&&(r.sublayers=s)}function V(e,r,t){const s=t?.origin&&e.get(t.origin);s&&(r.sublayers=[],s.overrides.forEach((e=>{r.sublayers.push(i(e))})))}e([u({type:["BuildingSceneLayer"]})],U.prototype,"operationalLayerType",void 0),e([u({readOnly:!0})],U.prototype,"allSublayers",void 0),e([u(R)],U.prototype,"sublayers",void 0),e([y("service","sublayers")],U.prototype,"readSublayers",null),e([u({type:C,nonNullable:!0,json:{write:!0}})],U.prototype,"filters",void 0),e([u({type:String,json:{write:!0}})],U.prototype,"activeFilterId",void 0),e([u({readOnly:!0,type:T})],U.prototype,"summaryStatistics",void 0),e([y("summaryStatistics",["statisticsHRef"])],U.prototype,"readSummaryStatistics",null),e([u({type:[String],json:{read:!1}})],U.prototype,"outFields",void 0),e([u(x)],U.prototype,"fullExtent",void 0),e([u(A)],U.prototype,"legendEnabled",void 0),e([u({type:["show","hide","hide-children"]})],U.prototype,"listMode",void 0),e([u(E(d))],U.prototype,"spatialReference",void 0),e([u(F)],U.prototype,"elevationInfo",null),e([u({json:{read:!1},readOnly:!0})],U.prototype,"type",void 0),e([u()],U.prototype,"associatedFeatureServiceItem",void 0),U=e([c("esri.layers.BuildingSceneLayer")],U);const $=U;export{$ as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../request.js";import r from"../core/Error.js";import i from"../core/Logger.js";import{rad2deg as o}from"../core/mathUtils.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as a}from"../core/promiseUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import{d as p,g as l,t as c,c as f,A as y,D as h,a as
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../request.js";import r from"../core/Error.js";import i from"../core/Logger.js";import{rad2deg as o}from"../core/mathUtils.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as a}from"../core/promiseUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import{d as p,g as l,t as c,c as f,A as y,D as h,a as u}from"../chunks/vec32.js";import{fromValues as d,create as x}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{WGS84ECEFSpatialReferenceLike as g}from"../geometry/ellipsoidUtils.js";import v from"../geometry/Extent.js";import j from"../geometry/SpatialReference.js";import{projectBuffer as A}from"../geometry/projection/projectBuffer.js";import b from"./Layer.js";import{APIKeyMixin as L}from"./mixins/APIKeyMixin.js";import{ArcGISService as S}from"./mixins/ArcGISService.js";import{CustomParametersMixin as _}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as w}from"./mixins/OperationalLayer.js";import{PortalLayer as E}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as I}from"./mixins/ScaleRangeLayer.js";import{elevationInfo as M,url as R}from"./support/commonProperties.js";import{logInvalidElevationInfoWarning as T,elevationModeRequiredMessage as U,featureExpressionUnsupportedMessage as D}from"../support/elevationInfoUtils.js";let N=class extends(S(w(E(I(s(_(L(b)))))))){constructor(e){super(e),this.operationalLayerType="IntegratedMesh3DTilesLayer",this.spatialReference=new j({wkid:4326,vcsWkid:115700}),this.fullExtent=new v(-180,-90,180,90,this.spatialReference),this.url=null,this.type="integrated-mesh-3dtiles",this.path=null,this.minScale=0,this.maxScale=0}set elevationInfo(e){null!=e&&"absolute-height"!==e.mode||this._set("elevationInfo",e),this._validateElevationInfo(e)}_verifyArray(e,t){if(!Array.isArray(e)||e.length<t)return!1;for(const r of e)if("number"!=typeof r)return!1;return!0}_initFullExtent(e){const t=e.root?.boundingVolume;if(!t)return;if(t.box){const e=t?.box;if(e[3]>7972671&&e[7]>7972671&&e[11]>7945940)return}const r=e.root?.transform,i=x();if(t.region&&this._verifyArray(t.region,6)){const e=t.region,r=o(e[0]),i=o(e[1]),s=e[4],a=o(e[2]),n=o(e[3]),m=e[5];this.fullExtent=new v({xmin:r,ymin:i,zmin:s,xmax:a,ymax:n,zmax:m,spatialReference:this.spatialReference})}else if(t.sphere&&this._verifyArray(t.sphere,4)){const e=t.sphere,o=d(e[0],e[1],e[2]),s=e[3]/Math.sqrt(3),a=x();p(a,o,d(s,s,s));const n=x();if(l(n,o,d(s,s,s)),r&&this._verifyArray(r,16)){const e=r;c(i,a,e),f(a,i),c(i,n,e),f(n,i)}A(a,g,0,a,j.WGS84,0),A(n,g,0,n,j.WGS84,0);const m=x(),u=x();y(m,a,n),h(u,a,n),this.fullExtent=new v({xmin:m[0],ymin:m[1],zmin:m[2],xmax:u[0],ymax:u[1],zmax:u[2],spatialReference:this.spatialReference})}else if(t.box&&this._verifyArray(t.box,12)){const e=t.box,i=d(e[0],e[1],e[2]),o=d(e[3],e[4],e[5]),s=d(e[6],e[7],e[8]),a=d(e[9],e[10],e[11]),n=[];for(let t=0;t<8;++t)n.push(x());if(l(n[0],i,o),l(n[0],n[0],s),l(n[0],n[0],a),u(n[1],i,o),l(n[1],n[1],s),l(n[1],n[1],a),l(n[2],i,o),u(n[2],n[2],s),l(n[2],n[2],a),u(n[3],i,o),u(n[3],n[3],s),l(n[3],n[3],a),l(n[4],i,o),l(n[4],n[4],s),u(n[4],n[4],a),u(n[5],i,o),l(n[5],n[5],s),u(n[5],n[5],a),l(n[6],i,o),u(n[6],n[6],s),u(n[6],n[6],a),u(n[7],i,o),u(n[7],n[7],s),u(n[7],n[7],a),r&&this._verifyArray(r,16)){const e=r;for(let t=0;t<8;++t)c(n[t],n[t],e)}const m=d(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),p=d(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE);for(let t=0;t<8;++t)A(n[t],g,0,n[t],j.WGS84,0),y(p,p,n[t]),h(m,m,n[t]);this.fullExtent=new v({xmin:p[0],ymin:p[1],zmin:p[2],xmax:m[0],ymax:m[1],zmax:m[2],spatialReference:this.spatialReference})}}async load(e){return this.addResolvingPromise(this._doLoad(e)),this}async _doLoad(e){const i=null!=e?e.signal:null;try{await this.loadFromPortal({supportedTypes:["3DTiles Service"],validateItem:e=>{if(e.typeKeywords?.includes("IntegratedMesh"))return!0;throw new r("portal:invalid-layer-item-type","Invalid layer item, expected '${expectedType}' ",{expectedType:"3DTiles Service containing IntegratedMesh"})}},e)}catch(o){a(o)}if(this.url){const e=t(this.url,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:i}).then((e=>{this._initFullExtent(e.data)}),(e=>{a(e)}));await e}}async fetchAttributionData(){return this.load().then((()=>({})))}_validateElevationInfo(e){const t="Integrated mesh 3d tiles layers";T(i.getLogger(this),U(t,"absolute-height",e)),T(i.getLogger(this),D(t,e))}};e([n({type:["IntegratedMesh3DTilesLayer"]})],N.prototype,"operationalLayerType",void 0),e([n({type:j})],N.prototype,"spatialReference",void 0),e([n({type:v})],N.prototype,"fullExtent",void 0),e([n(M)],N.prototype,"elevationInfo",null),e([n({type:["show","hide"]})],N.prototype,"listMode",void 0),e([n(R)],N.prototype,"url",void 0),e([n({readOnly:!0})],N.prototype,"type",void 0),e([n({type:String,json:{origins:{"web-scene":{read:!0,write:!0},"portal-item":{read:!0,write:!0}},read:!1}})],N.prototype,"path",void 0),e([n({type:Number,json:{name:"layerDefinition.minScale",write:!0,origins:{service:{read:!1,write:!1}}}})],N.prototype,"minScale",void 0),e([n({type:Number,json:{name:"layerDefinition.maxScale",write:!0,origins:{service:{read:!1,write:!1}}}})],N.prototype,"maxScale",void 0),N=e([m("esri.layers.IntegratedMesh3DTilesLayer")],N);const P=N;export{P as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Error.js";import o from"../core/Logger.js";import{MultiOriginJSONMixin as i}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as r}from"../core/promiseUtils.js";import{on as s,sync as n}from"../core/reactiveUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{reader as p}from"../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import{persistable as d}from"../core/accessorSupport/decorators/persistable.js";import l from"./Layer.js";import{APIKeyMixin as c}from"./mixins/APIKeyMixin.js";import{ArcGISService as y}from"./mixins/ArcGISService.js";import{CustomParametersMixin as h}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as f}from"./mixins/OperationalLayer.js";import{PortalLayer as u}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as v}from"./mixins/ScaleRangeLayer.js";import{SceneService as g,SaveOperationType as S}from"./mixins/SceneService.js";import{elevationInfo as j}from"./support/commonProperties.js";import{I3SNodePageDefinition as w,I3SMaterialDefinition as x,I3STextureSetDefinition as L,I3SGeometryDefinition as _}from"./support/I3SLayerDefinitions.js";import I from"./support/SceneModifications.js";import{logInvalidElevationInfoWarning as T,elevationModeRequiredMessage as M,featureExpressionUnsupportedMessage as O}from"../support/elevationInfoUtils.js";import{f as b}from"../chunks/persistableUrlUtils.js";let A=class extends(g(y(f(u(v(i(h(c(l))))))))){constructor(...e){super(...e),this.geometryType="mesh",this.operationalLayerType="IntegratedMeshLayer",this.type="integrated-mesh",this.nodePages=null,this.materialDefinitions=null,this.textureSetDefinitions=null,this.geometryDefinitions=null,this.serviceUpdateTimeStamp=null,this.profile="mesh-pyramids",this.modifications=null,this._modificationsSource=null,this.path=null,this.definitionExpression=null}initialize(){this.addHandles(s((()=>this.modifications),"after-changes",(()=>this.modifications=this.modifications),n))}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}readModifications(e,t,o){this._modificationsSource={url:b(e,o),context:o}}set elevationInfo(e){this._set("elevationInfo",e),this._validateElevationInfo()}async load(e){return this.addResolvingPromise(this._doLoad(e)),this}async _doLoad(e){const t=e?.signal;try{await this.loadFromPortal({supportedTypes:["Scene Service"]},e)}catch(o){r(o)}if(await this._fetchService(t),null!=this._modificationsSource){const t=await I.fromUrl(this._modificationsSource.url,this.spatialReference,e);this.setAtOrigin("modifications",t,this._modificationsSource.context.origin),this._modificationsSource=null}await this._fetchIndexAndUpdateExtent(this.nodePages,t)}beforeSave(){if(null!=this._modificationsSource)return this.load().then((()=>{}),(()=>{}))}async saveAs(e,t){return this._debouncedSaveOperations(S.SAVE_AS,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"integrated-mesh"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"integrated-mesh"};return this._debouncedSaveOperations(S.SAVE,e)}validateLayer(e){if(e.layerType&&"IntegratedMesh"!==e.layerType)throw new t("integrated-mesh-layer:layer-type-not-supported","IntegratedMeshLayer does not support this layer type",{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new t("layer:service-version-not-supported","Service version is not supported.",{serviceVersion:this.version.versionString,supportedVersions:"1.x"});if(this.version.major>1)throw new t("layer:service-version-too-new","Service version is too new.",{serviceVersion:this.version.versionString,supportedVersions:"1.x"})}_getTypeKeywords(){return["IntegratedMeshLayer"]}_validateElevationInfo(){const
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Error.js";import o from"../core/Logger.js";import{MultiOriginJSONMixin as i}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as r}from"../core/promiseUtils.js";import{on as s,sync as n}from"../core/reactiveUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{reader as p}from"../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import{persistable as d}from"../core/accessorSupport/decorators/persistable.js";import l from"./Layer.js";import{APIKeyMixin as c}from"./mixins/APIKeyMixin.js";import{ArcGISService as y}from"./mixins/ArcGISService.js";import{CustomParametersMixin as h}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as f}from"./mixins/OperationalLayer.js";import{PortalLayer as u}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as v}from"./mixins/ScaleRangeLayer.js";import{SceneService as g,SaveOperationType as S}from"./mixins/SceneService.js";import{elevationInfo as j}from"./support/commonProperties.js";import{I3SNodePageDefinition as w,I3SMaterialDefinition as x,I3STextureSetDefinition as L,I3SGeometryDefinition as _}from"./support/I3SLayerDefinitions.js";import I from"./support/SceneModifications.js";import{logInvalidElevationInfoWarning as T,elevationModeRequiredMessage as M,featureExpressionUnsupportedMessage as O}from"../support/elevationInfoUtils.js";import{f as b}from"../chunks/persistableUrlUtils.js";let A=class extends(g(y(f(u(v(i(h(c(l))))))))){constructor(...e){super(...e),this.geometryType="mesh",this.operationalLayerType="IntegratedMeshLayer",this.type="integrated-mesh",this.nodePages=null,this.materialDefinitions=null,this.textureSetDefinitions=null,this.geometryDefinitions=null,this.serviceUpdateTimeStamp=null,this.profile="mesh-pyramids",this.modifications=null,this._modificationsSource=null,this.path=null,this.definitionExpression=null}initialize(){this.addHandles(s((()=>this.modifications),"after-changes",(()=>this.modifications=this.modifications),n))}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}readModifications(e,t,o){this._modificationsSource={url:b(e,o),context:o}}set elevationInfo(e){null!=e&&"absolute-height"!==e.mode||this._set("elevationInfo",e),this._validateElevationInfo(e)}async load(e){return this.addResolvingPromise(this._doLoad(e)),this}async _doLoad(e){const t=e?.signal;try{await this.loadFromPortal({supportedTypes:["Scene Service"]},e)}catch(o){r(o)}if(await this._fetchService(t),null!=this._modificationsSource){const t=await I.fromUrl(this._modificationsSource.url,this.spatialReference,e);this.setAtOrigin("modifications",t,this._modificationsSource.context.origin),this._modificationsSource=null}await this._fetchIndexAndUpdateExtent(this.nodePages,t)}beforeSave(){if(null!=this._modificationsSource)return this.load().then((()=>{}),(()=>{}))}async saveAs(e,t){return this._debouncedSaveOperations(S.SAVE_AS,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"integrated-mesh"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"integrated-mesh"};return this._debouncedSaveOperations(S.SAVE,e)}validateLayer(e){if(e.layerType&&"IntegratedMesh"!==e.layerType)throw new t("integrated-mesh-layer:layer-type-not-supported","IntegratedMeshLayer does not support this layer type",{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new t("layer:service-version-not-supported","Service version is not supported.",{serviceVersion:this.version.versionString,supportedVersions:"1.x"});if(this.version.major>1)throw new t("layer:service-version-too-new","Service version is too new.",{serviceVersion:this.version.versionString,supportedVersions:"1.x"})}_getTypeKeywords(){return["IntegratedMeshLayer"]}_validateElevationInfo(e){const t="Integrated mesh layers";T(o.getLogger(this),M(t,"absolute-height",e)),T(o.getLogger(this),O(t,e))}};e([a({type:String,readOnly:!0})],A.prototype,"geometryType",void 0),e([a({type:["show","hide"]})],A.prototype,"listMode",void 0),e([a({type:["IntegratedMeshLayer"]})],A.prototype,"operationalLayerType",void 0),e([a({json:{read:!1},readOnly:!0})],A.prototype,"type",void 0),e([a({type:w,readOnly:!0})],A.prototype,"nodePages",void 0),e([a({type:[x],readOnly:!0})],A.prototype,"materialDefinitions",void 0),e([a({type:[L],readOnly:!0})],A.prototype,"textureSetDefinitions",void 0),e([a({type:[_],readOnly:!0})],A.prototype,"geometryDefinitions",void 0),e([a({readOnly:!0})],A.prototype,"serviceUpdateTimeStamp",void 0),e([a({type:I}),d({origins:["web-scene","portal-item"],type:"resource",prefix:"modifications"})],A.prototype,"modifications",void 0),e([p(["web-scene","portal-item"],"modifications")],A.prototype,"readModifications",null),e([a(j)],A.prototype,"elevationInfo",null),e([a({type:String,json:{origins:{"web-scene":{read:!0,write:!0},"portal-item":{read:!0,write:!0}},read:!1}})],A.prototype,"path",void 0),A=e([m("esri.layers.IntegratedMeshLayer")],A);const P=A;export{P as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Error.js";import{clone as i}from"../core/lang.js";import{setDeepValue as r}from"../core/object.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import n from"./FeatureLayer.js";import{useViewTimeProperty as s}from"./mixins/TemporalLayer.js";import{orientedImageryTypeMap as p,timeIntervalUnitTypeMap as m,verticalMeasurementTypeMap as y,getEffectiveElevationSource as l,isOrientationAccuracy as d}from"./orientedImagery/core/utils.js";import u from"../time/TimeExtent.js";import{SaveOperationType as c}from"../webdoc/interfaces.js";const h=new Set(["demPathPrefix","demPathSuffix","depthImagePathPrefix","depthImagePathSuffix","elevationSource","horizontalMeasurementUnit","verticalMeasurementUnit","videoPathPrefix","videoPathSuffix","timeAnimation","visibilityTimeExtent"]),
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Error.js";import{clone as i}from"../core/lang.js";import{setDeepValue as r}from"../core/object.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import n from"./FeatureLayer.js";import{useViewTimeProperty as s}from"./mixins/TemporalLayer.js";import{orientedImageryTypeMap as p,timeIntervalUnitTypeMap as m,verticalMeasurementTypeMap as y,getEffectiveElevationSource as l,isOrientationAccuracy as d}from"./orientedImagery/core/utils.js";import u from"../time/TimeExtent.js";import{SaveOperationType as c}from"../webdoc/interfaces.js";const h=new Set(["demPathPrefix","demPathSuffix","depthImagePathPrefix","depthImagePathSuffix","elevationSource","horizontalMeasurementUnit","imageGeometryField","imageReferenceField","verticalMeasurementUnit","videoPathPrefix","videoPathSuffix","timeAnimation","visibilityTimeExtent"]),g=(e,t)=>!h.has(t)&&e,f=(e,t,i)=>{const r=`orientedImageryProperties.${e}`;return{name:r,write:t?{ignoreOrigin:!0,target:r,writer:t}:{ignoreOrigin:!0},read:i?{ignoreOrigin:!0,source:r,reader:i}:{ignoreOrigin:!0}}};function v(e){return e.json?(e.json.origins=e.json.origins??{},e.json.origins["web-scene"]={write:!1,read:!1},e):e}function j(e,t,i,r){const{name:o,write:a,read:n}=f(e,t,i),s={name:o,write:a,read:n,origins:{service:{name:`orientedImageryInfo.${o}`,write:t,read:i},"web-scene":{name:o,write:g(a,e),read:g(n,e)},"web-map":{name:o,write:a,read:n}}};return r&&s.origins?(s.type=r,s.origins["web-map"].type=r,s.origins["web-scene"].type=r,s):s}let P=class extends n{constructor(){super(...arguments),this.cameraHeading=null,this.cameraHeight=null,this.cameraPitch=null,this.cameraRoll=null,this.coveragePercent=null,this.demPathPrefix=null,this.demPathSuffix=null,this.depthImagePathPrefix=null,this.depthImagePathSuffix=null,this.elevationSource=null,this.farDistance=null,this.geometryType="point",this.horizontalFieldOfView=null,this.horizontalMeasurementUnit=null,this.imageGeometryField="ImageGeometry",this.imagePathPrefix=null,this.imagePathSuffix=null,this.imageReferenceField="OIObjectID",this.imageRotation=null,this.maximumDistance=null,this.nearDistance=null,this.operationalLayerType="OrientedImageryLayer",this.orientationAccuracy=null,this.orientedImageryType=null,this.supportedSourceTypes=new Set(["Oriented Imagery Layer"]),this.type="oriented-imagery",this.timeIntervalUnit="days",this.useViewTime=!0,this.verticalFieldOfView=null,this.verticalMeasurementUnit=null,this.videoPathPrefix=null,this.videoPathSuffix=null,this.visibilityTimeExtent=null}get effectiveElevationSource(){const{elevationSource:e,demPathPrefix:t,demPathSuffix:i}=this;return l(e,t,i)}async save(e){return this._debouncedSaveOperations(c.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(c.SAVE_AS,t,e)}findFirstValidLayerId(e){return e.layers?.find((e=>this.supportedSourceTypes.has(e.type)))?.id}_verifySource(){if(super._verifySource(),"point"!==this.geometryType)throw new t("oriented-imagery-layer:invalid-geometry-type","OrientedImageryLayer only supports point geometry type")}};e([o({type:Number,json:j("cameraHeading")})],P.prototype,"cameraHeading",void 0),e([o({type:Number,json:j("cameraHeight")})],P.prototype,"cameraHeight",void 0),e([o({type:Number,json:j("cameraPitch")})],P.prototype,"cameraPitch",void 0),e([o({type:Number,json:j("cameraRoll")})],P.prototype,"cameraRoll",void 0),e([o({type:Number,json:j("coveragePercent")})],P.prototype,"coveragePercent",void 0),e([o({type:String,json:j("demPathPrefix")})],P.prototype,"demPathPrefix",void 0),e([o({type:String,json:j("demPathSuffix")})],P.prototype,"demPathSuffix",void 0),e([o({type:String,json:j("depthImagePathPrefix")})],P.prototype,"depthImagePathPrefix",void 0),e([o({type:String,json:j("depthImagePathSuffix")})],P.prototype,"depthImagePathSuffix",void 0),e([o({type:Object,json:j("elevationSource")})],P.prototype,"elevationSource",void 0),e([o({readOnly:!0})],P.prototype,"effectiveElevationSource",null),e([o({type:Number,json:j("farDistance")})],P.prototype,"farDistance",void 0),e([o()],P.prototype,"geometryType",void 0),e([o({type:Number,json:j("horizontalFieldOfView")})],P.prototype,"horizontalFieldOfView",void 0),e([o({type:String,json:j("horizontalMeasurementUnit")})],P.prototype,"horizontalMeasurementUnit",void 0),e([o({type:String,json:{...j("imageGeometryField"),default:"ImageGeometry"}})],P.prototype,"imageGeometryField",void 0),e([o({type:String,json:j("imagePathPrefix")})],P.prototype,"imagePathPrefix",void 0),e([o({type:String,json:j("imagePathSuffix")})],P.prototype,"imagePathSuffix",void 0),e([o({type:String,json:{...j("imageReferenceField"),default:"OIObjectID"}})],P.prototype,"imageReferenceField",void 0),e([o({type:Number,json:j("imageRotation")})],P.prototype,"imageRotation",void 0),e([o({type:Number,json:j("maximumDistance")})],P.prototype,"maximumDistance",void 0),e([o({type:Number,json:j("nearDistance")})],P.prototype,"nearDistance",void 0),e([o({type:["OrientedImageryLayer"],json:{origins:{"portal-item":{name:"layerType",write:{enabled:!0,ignoreOrigin:!0}}}}})],P.prototype,"operationalLayerType",void 0),e([o({json:{...j("orientationAccuracy",((e,t,i)=>{r(i,e.join(";"),t)}),(e=>{const t=e?.split(";")?.map(Number);return d(t)?t:[0,0,0,0,0,0,0,0,0]}),String)}})],P.prototype,"orientationAccuracy",void 0),e([o({json:{...j("orientedImageryType",p.write,p.read,p.jsonValues.slice(1))}})],P.prototype,"orientedImageryType",void 0),e([o({json:{read:!1},value:"oriented-imagery",readOnly:!0})],P.prototype,"type",void 0),e([o({type:m.apiValues,json:{...j("timeIntervalUnit",m.write,m.read,m.jsonValues)}})],P.prototype,"timeIntervalUnit",void 0),e([o(v(i(s)))],P.prototype,"useViewTime",void 0),e([o({type:Number,json:j("verticalFieldOfView")})],P.prototype,"verticalFieldOfView",void 0),e([o({type:y.apiValues,json:{...j("verticalMeasurementUnit",y.write,y.read,y.jsonValues)}})],P.prototype,"verticalMeasurementUnit",void 0),e([o({type:String,json:j("videoPathPrefix")})],P.prototype,"videoPathPrefix",void 0),e([o({type:String,json:j("videoPathSuffix")})],P.prototype,"videoPathSuffix",void 0),e([o({type:u,json:{origins:{"web-scene":{write:!1,read:!1}}}})],P.prototype,"visibilityTimeExtent",void 0),P=e([a("esri.layers.OrientedImageryLayer")],P);const S=P;export{S as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import r from"../PopupTemplate.js";import t from"../request.js";import o from"../core/Error.js";import{clone as i}from"../core/lang.js";import s from"../core/Logger.js";import{MultiOriginJSONMixin as n}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as a}from"../core/object.js";import{throwIfAbortError as p}from"../core/promiseUtils.js";import{join as l}from"../core/urlUtils.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import{reader as u}from"../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import{writer as c}from"../core/accessorSupport/decorators/writer.js";import
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import r from"../PopupTemplate.js";import t from"../request.js";import o from"../core/Error.js";import{clone as i}from"../core/lang.js";import s from"../core/Logger.js";import{MultiOriginJSONMixin as n}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as a}from"../core/object.js";import{throwIfAbortError as p}from"../core/promiseUtils.js";import{join as l}from"../core/urlUtils.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import{reader as u}from"../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import{writer as c}from"../core/accessorSupport/decorators/writer.js";import y from"./Layer.js";import{APIKeyMixin as f}from"./mixins/APIKeyMixin.js";import{ArcGISService as h}from"./mixins/ArcGISService.js";import{CustomParametersMixin as g}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as v}from"./mixins/OperationalLayer.js";import{PortalLayer as j}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as w}from"./mixins/ScaleRangeLayer.js";import{SceneService as I,SaveOperationType as S}from"./mixins/SceneService.js";import{types as b}from"./pointCloudFilters/typeUtils.js";import{popupEnabled as x,elevationInfo as T,legendEnabled as P}from"./support/commonProperties.js";import F from"./support/Field.js";import{defineFieldProperties as L}from"./support/fieldProperties.js";import _ from"../popup/ExpressionInfo.js";import{types as C}from"../renderers/support/pointCloud/typeUtils.js";import{logInvalidElevationInfoWarning as E,elevationModeRequiredMessage as A,featureExpressionUnsupportedMessage as N}from"../support/elevationInfoUtils.js";import{createPopupTemplate as R}from"../support/popupUtils.js";const O=L();let V=class extends(I(h(v(j(w(n(g(f(y))))))))){constructor(...e){super(...e),this.operationalLayerType="PointCloudLayer",this.popupEnabled=!0,this.popupTemplate=null,this.opacity=1,this.filters=[],this.fields=null,this.fieldsIndex=null,this.outFields=null,this.path=null,this.legendEnabled=!0,this.renderer=null,this.type="point-cloud"}normalizeCtorArgs(e,r){return"string"==typeof e?{url:e,...r}:e}get defaultPopupTemplate(){return this.attributeStorageInfo?this.createPopupTemplate():null}getFieldDomain(e){const r=this.fieldsIndex.get(e);return r?.domain?r.domain:null}readServiceFields(e,r,t){return Array.isArray(e)?e.map((e=>{const r=new F;return"FieldTypeInteger"===e.type&&((e=i(e)).type="esriFieldTypeInteger"),r.read(e,t),r})):Array.isArray(r.attributeStorageInfo)?r.attributeStorageInfo.map((e=>new F({name:e.name,type:"ELEVATION"===e.name?"double":"integer"}))):null}set elevationInfo(e){null!=e&&"absolute-height"!==e.mode||this._set("elevationInfo",e),this._validateElevationInfo(e)}writeRenderer(e,r,t,o){a("layerDefinition.drawingInfo.renderer",e.write({},o),r)}load(e){const r=null!=e?e.signal:null,t=this.loadFromPortal({supportedTypes:["Scene Service"]},e).catch(p).then((()=>this._fetchService(r)));return this.addResolvingPromise(t),Promise.resolve(this)}createPopupTemplate(e){const r=R(this,e);return r&&(this._formatPopupTemplateReturnsField(r),this._formatPopupTemplateRGBField(r)),r}_formatPopupTemplateReturnsField(e){const r=this.fieldsIndex.get("RETURNS");if(!r)return;const t=e.fieldInfos?.find((e=>e.fieldName===r.name));if(!t)return;const o=new _({name:"pcl-returns-decoded",title:r.alias||r.name,expression:`\n var returnValue = $feature.${r.name};\n return (returnValue % 16) + " / " + Floor(returnValue / 16);\n `});e.expressionInfos=[...e.expressionInfos||[],o],t.fieldName="expression/pcl-returns-decoded"}_formatPopupTemplateRGBField(e){const r=this.fieldsIndex.get("RGB");if(!r)return;const t=e.fieldInfos?.find((e=>e.fieldName===r.name));if(!t)return;const o=new _({name:"pcl-rgb-decoded",title:r.alias||r.name,expression:`\n var rgb = $feature.${r.name};\n var red = Floor(rgb / 65536, 0);\n var green = Floor((rgb - (red * 65536)) / 256,0);\n var blue = rgb - (red * 65536) - (green * 256);\n\n return "rgb(" + red + "," + green + "," + blue + ")";\n `});e.expressionInfos=[...e.expressionInfos||[],o],t.fieldName="expression/pcl-rgb-decoded"}async queryCachedStatistics(e,r){if(await this.load(r),!this.attributeStorageInfo)throw new o("scenelayer:no-cached-statistics","Cached statistics are not available for this layer");const i=this.fieldsIndex.get(e);if(!i)throw new o("pointcloudlayer:field-unexisting",`Field '${e}' does not exist on the layer`);for(const o of this.attributeStorageInfo)if(o.name===i.name){const e=l(this.parsedUrl?.path??"",`./statistics/${o.key}`);return t(e,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:r?r.signal:null}).then((e=>e.data))}throw new o("pointcloudlayer:no-cached-statistics","Cached statistics for this attribute are not available")}async saveAs(e,r){return this._debouncedSaveOperations(S.SAVE_AS,{...r,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"point-cloud"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"point-cloud"};return this._debouncedSaveOperations(S.SAVE,e)}validateLayer(e){if(e.layerType&&"PointCloud"!==e.layerType)throw new o("pointcloudlayer:layer-type-not-supported","PointCloudLayer does not support this layer type",{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new o("layer:service-version-not-supported","Service version is not supported.",{serviceVersion:this.version.versionString,supportedVersions:"1.x-2.x"});if(this.version.major>2)throw new o("layer:service-version-too-new","Service version is too new.",{serviceVersion:this.version.versionString,supportedVersions:"1.x-2.x"})}hasCachedStatistics(e){return null!=this.attributeStorageInfo&&this.attributeStorageInfo.some((r=>r.name===e))}_getTypeKeywords(){return["PointCloud"]}_validateElevationInfo(e){E(s.getLogger(this),A("Point cloud layers","absolute-height",e)),E(s.getLogger(this),N("Point cloud layers",e))}};e([d({type:["PointCloudLayer"]})],V.prototype,"operationalLayerType",void 0),e([d(x)],V.prototype,"popupEnabled",void 0),e([d({type:r,json:{name:"popupInfo",write:!0}})],V.prototype,"popupTemplate",void 0),e([d({readOnly:!0,json:{read:!1}})],V.prototype,"defaultPopupTemplate",null),e([d({readOnly:!0,json:{write:!1,read:!1,origins:{"web-document":{write:!1,read:!1}}}})],V.prototype,"opacity",void 0),e([d({type:["show","hide"]})],V.prototype,"listMode",void 0),e([d({types:[b],json:{origins:{service:{read:{source:"filters"}}},name:"layerDefinition.filters",write:!0}})],V.prototype,"filters",void 0),e([d({type:[F]})],V.prototype,"fields",void 0),e([d(O.fieldsIndex)],V.prototype,"fieldsIndex",void 0),e([u("service","fields",["fields","attributeStorageInfo"])],V.prototype,"readServiceFields",null),e([d(O.outFields)],V.prototype,"outFields",void 0),e([d({readOnly:!0})],V.prototype,"attributeStorageInfo",void 0),e([d(T)],V.prototype,"elevationInfo",null),e([d({type:String,json:{origins:{"web-scene":{read:!0,write:!0},"portal-item":{read:!0,write:!0}},read:!1}})],V.prototype,"path",void 0),e([d(P)],V.prototype,"legendEnabled",void 0),e([d({types:C,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:{target:{"layerDefinition.drawingInfo.renderer":{types:C},"layerDefinition.drawingInfo.transparency":{type:Number}}}}})],V.prototype,"renderer",void 0),e([c("renderer")],V.prototype,"writeRenderer",null),e([d({json:{read:!1},readOnly:!0})],V.prototype,"type",void 0),V=e([m("esri.layers.PointCloudLayer")],V);const U=V;export{U as default};
|
package/layers/RouteLayer.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../config.js";import r from"../Graphic.js";import o from"../PopupTemplate.js";import i from"../core/Collection.js";import s from"../core/Error.js";import n from"../core/Logger.js";import{MultiOriginJSONMixin as l}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as a}from"../core/object.js";import{isAbortError as u}from"../core/promiseUtils.js";import{on as p}from"../core/reactiveUtils.js";import{convertUnit as c}from"../core/unitUtils.js";import{urlToObject as m}from"../core/urlUtils.js";import{property as y}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{reader as f}from"../core/accessorSupport/decorators/reader.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import{writer as h}from"../core/accessorSupport/decorators/writer.js";import{updateOrigins as w}from"../core/accessorSupport/originUtils.js";import S from"../geometry/Extent.js";import g from"../geometry/Multipoint.js";import{initializeProjection as b,project as v}from"../geometry/projection.js";import B from"../geometry/SpatialReference.js";import{wgs84 as P}from"../geometry/support/spatialReferenceUtils.js";import N from"./Layer.js";import{BlendLayer as _}from"./mixins/BlendLayer.js";import{OperationalLayer as j}from"./mixins/OperationalLayer.js";import{PortalLayer as L}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as I}from"./mixins/ScaleRangeLayer.js";import{sanitizeUrl as C}from"./support/arcgisLayerUrl.js";import R from"./support/RouteSymbols.js";import D from"../portal/Portal.js";import O from"../portal/PortalItem.js";import{typeKeyword as F}from"../portal/support/portalItemUtils.js";import{read as x}from"../renderers/support/jsonUtils.js";import{fetchServiceDescription as T}from"../rest/networkService.js";import{solve as k}from"../rest/route.js";import A from"../rest/support/DirectionLine.js";import G from"../rest/support/DirectionPoint.js";import J from"../rest/support/PointBarrier.js";import M from"../rest/support/PolygonBarrier.js";import U from"../rest/support/PolylineBarrier.js";import q from"../rest/support/RouteInfo.js";import E from"../rest/support/RouteParameters.js";import W from"../rest/support/RouteSettings.js";import V from"../rest/support/Stop.js";function z(e){return e.length?e:null}function K(e){switch(e){case"esriGeometryPoint":return{type:"esriSMS",style:"esriSMSCircle",size:12,color:[0,0,0,0],outline:K("esriGeometryPolyline")};case"esriGeometryPolyline":return{type:"esriSLS",style:"esriSLSSolid",width:1,color:[0,0,0,0]};case"esriGeometryPolygon":return{type:"esriSFS",style:"esriSFSNull",outline:K("esriGeometryPolyline")}}}function H(e){return"layers"in e}function Q(e){return"esri.rest.support.FeatureSet"===e.declaredClass}function Y(e){return"esri.rest.support.NetworkFeatureSet"===e.declaredClass}function Z(e,t,r){const o=t.networkDataset?.networkAttributes,i=o?.filter((({usageType:e})=>"cost"===e))??[],n=r.travelMode??t.defaultTravelMode;if(null==n)return void ue().warn("route-layer:missing-travel-mode","The routing service must have a default travel mode or one must be specified in the route parameter.");const{timeAttributeName:l,distanceAttributeName:a}=n,u=i.find((({name:e})=>e===l)),p=i.find((({name:e})=>e===a)),c=r.travelMode?.impedanceAttributeName??r.impedanceAttribute??t.impedance,m=u?.units,y=p?.units;if(!m||!y)throw new s("routelayer:unknown-impedance-units","the units of either the distance or time impedance are unknown");const f=r.directionsLanguage??t.directionsLanguage,d=r.accumulateAttributes??t.accumulateAttributeNames??[],h=new Set(i.filter((({name:e})=>e===l||e===a||e===c||null!=e&&d.includes(e))).map((({name:e})=>e))),w=e=>{for(const t in e)h.has(t)||delete e[t]};for(const s of e.pointBarriers)null!=s.costs&&(s.addedCost=s.costs[c]??0,w(s.costs));for(const s of e.polygonBarriers)null!=s.costs&&(s.scaleFactor=s.costs[c]??1,w(s.costs));for(const s of e.polylineBarriers)null!=s.costs&&(s.scaleFactor=s.costs[c]??1,w(s.costs));const{routeInfo:S}=e,{findBestSequence:g,preserveFirstStop:b,preserveLastStop:v,startTimeIsUTC:B,timeWindowsAreUTC:P}=r;S.analysisSettings=new W({accumulateAttributes:d,directionsLanguage:f,findBestSequence:g,preserveFirstStop:b,preserveLastStop:v,startTimeIsUTC:B,timeWindowsAreUTC:P,travelMode:n}),S.totalDuration=X(S.totalCosts?.[l]??0,m),S.totalDistance=ee(S.totalCosts?.[a]??0,y),S.totalLateDuration=X(S.totalViolations?.[l]??0,m),S.totalWaitDuration=X(S.totalWait?.[l]??0,m),null!=S.totalCosts&&w(S.totalCosts),null!=S.totalViolations&&w(S.totalViolations),null!=S.totalWait&&w(S.totalWait);for(const s of e.stops)null!=s.serviceCosts&&(s.serviceDuration=X(s.serviceCosts[l]??0,m),s.serviceDistance=ee(s.serviceCosts[a]??0,y),w(s.serviceCosts)),null!=s.cumulativeCosts&&(s.cumulativeDuration=X(s.cumulativeCosts[l]??0,m),s.cumulativeDistance=ee(s.cumulativeCosts[a]??0,y),w(s.cumulativeCosts)),null!=s.violations&&(s.lateDuration=X(s.violations[l]??0,m),w(s.violations)),null!=s.wait&&(s.waitDuration=X(s.wait[l]??0,m),w(s.wait))}async function $(e){const t=B.WGS84;return await b(e.spatialReference,t),v(e,t)}function X(e,t){switch(t){case"seconds":return e/60;case"hours":return 60*e;case"days":return 60*e*24;default:return e}}function ee(e,t){return"decimal-degrees"===t||"points"===t||"unknown"===t?e:c(e,t,"meters")}function te(e){const{attributes:t,geometry:r,popupTemplate:o,symbol:i}=e.toGraphic().toJSON();return{attributes:t,geometry:r,popupInfo:o,symbol:i}}const re=i.ofType(A),oe=i.ofType(G),ie=i.ofType(J),se=i.ofType(M),ne=i.ofType(U),le=i.ofType(V),ae="esri.layers.RouteLayer",ue=()=>n.getLogger(ae);let pe=class extends(_(I(j(L(l(N)))))){constructor(e){super(e),this._cachedServiceDescription=null,this._featureCollection=null,this._type="Feature Collection",this.defaultSymbols=new R,this.directionLines=null,this.directionPoints=null,this.featureCollectionType="route",this.legendEnabled=!1,this.maxScale=0,this.minScale=0,this.pointBarriers=new ie,this.polygonBarriers=new se,this.polylineBarriers=new ne,this.routeInfo=null,this.spatialReference=B.WGS84,this.stops=new le,this.type="route";const t=()=>{this._setStopSymbol(this.stops)};this.addHandles(p((()=>this.stops),"change",t,{sync:!0,onListenerAdd:t}))}writeFeatureCollectionWebmap(e,t,r,o){const i=[this._writePolygonBarriers(),this._writePolylineBarriers(),this._writePointBarriers(),this._writeRouteInfo(),this._writeDirectionLines(),this._writeDirectionPoints(),this._writeStops()].filter((e=>!!e)),s=i.map(((e,t)=>t)),n="web-map"===o.origin?"featureCollection.layers":"layers";a(n,i,t),t.opacity=this.opacity,t.visibility=this.visible,t.visibleLayers=s}readDirectionLines(e,t){return this._getNetworkFeatures(t,"DirectionLines",(e=>A.fromGraphic(e)))}readDirectionPoints(e,t){return this._getNetworkFeatures(t,"DirectionPoints",(e=>G.fromGraphic(e)))}get fullExtent(){const e=new S({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:B.WGS84});if(null!=this.routeInfo?.geometry)return this.routeInfo.geometry.extent??e;if(null==this.stops)return e;const t=this.stops.filter((e=>null!=e.geometry));if(t.length<2)return e;const{spatialReference:r}=t.at(0).geometry;if(null==r)return e;const o=t.toArray().map((e=>{const t=e.geometry;return[t.x,t.y]}));return new g({points:o,spatialReference:r}).extent}readMaxScale(e,t){const r=H(t)?t.layers:t.featureCollection?.layers,o=r?.find((e=>null!=e.layerDefinition.maxScale));return o?.layerDefinition.maxScale??0}readMinScale(e,t){const r=H(t)?t.layers:t.featureCollection?.layers,o=r?.find((e=>null!=e.layerDefinition.minScale));return o?.layerDefinition.minScale??0}readPointBarriers(e,t){return this._getNetworkFeatures(t,"Barriers",(e=>J.fromGraphic(e)))}readPolygonBarriers(e,t){return this._getNetworkFeatures(t,"PolygonBarriers",(e=>M.fromGraphic(e)))}readPolylineBarriers(e,t){return this._getNetworkFeatures(t,"PolylineBarriers",(e=>U.fromGraphic(e)))}readRouteInfo(e,t){return this._getNetworkFeatures(t,"RouteInfo",(e=>q.fromGraphic(e))).at(0)??null}readSpatialReference(e,t){const r=H(t)?t.layers:t.featureCollection?.layers;if(!r?.length)return B.WGS84;const{layerDefinition:o,featureSet:i}=r[0],s=i.features[0],n=s?.geometry?.spatialReference??i.spatialReference??o.spatialReference??o.extent.spatialReference??P;return B.fromJSON(n)}readStops(e,t){return this._getNetworkFeatures(t,"Stops",(e=>V.fromGraphic(e)),(e=>this._setStopSymbol(e)))}get title(){return this.routeInfo?.name??"Route"}set title(e){this._overrideIfSome("title",e)}get url(){return t.routeServiceUrl}set url(e){null!=e?this._set("url",C(e,ue())):this._set("url",t.routeServiceUrl)}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Feature Collection"]},e)),Promise.resolve(this)}removeAll(){this.removeResult(),this.pointBarriers.removeAll(),this.polygonBarriers.removeAll(),this.polylineBarriers.removeAll(),this.stops.removeAll()}removeResult(){null!=this.directionLines&&(this.directionLines.removeAll(),this._set("directionLines",null)),null!=this.directionPoints&&(this.directionPoints.removeAll(),this._set("directionPoints",null)),null!=this.routeInfo&&this._set("routeInfo",null)}async save(){await this.load();const{fullExtent:e,portalItem:t}=this;if(!t)throw new s("routelayer:portal-item-not-set","save() requires to the layer to have a portal item");if(!t.id)throw new s("routelayer:portal-item-not-saved","Please use saveAs() first to save the routelayer");if("Feature Collection"!==t.type)throw new s("routelayer:portal-item-wrong-type",'Portal item needs to have type "Feature Collection"');if(null==this.routeInfo)throw new s("routelayer:route-unsolved","save() requires a solved route");const{portal:r}=t;await r.signIn(),r.user||await t.reload();const{itemUrl:o,itemControl:i}=t;if("admin"!==i&&"update"!==i)throw new s("routelayer:insufficient-permissions","To save this layer, you need to be the owner or an administrator of your organization");const n={messages:[],origin:"portal-item",portal:r,url:o?m(o):void 0,writtenProperties:[]},l=this.write(void 0,n);return t.extent=await $(e),t.title=this.title,await t.update({data:l}),t}async saveAs(e,t={}){if(await this.load(),null==this.routeInfo)throw new s("routelayer:route-unsolved","saveAs() requires a solved route");const r=O.from(e).clone();r.extent??=await $(this.fullExtent),r.id=null,r.portal??=D.getDefault(),r.title??=this.title,r.type="Feature Collection",r.typeKeywords=["Data","Feature Collection",F.MULTI_LAYER,"Route Layer"];const{portal:o}=r,i={messages:[],origin:"portal-item",portal:o,url:null,writtenProperties:[]};await o.signIn();const n=t?.folder,l=this.write(void 0,i);return await o.user.addItem({item:r,folder:n,data:l}),this.portalItem=r,w(i),i.portalItem=r,r}async solve(e,t){const r=e?.stops??this.stops,o=e?.pointBarriers??z(this.pointBarriers),n=e?.polylineBarriers??z(this.polylineBarriers),l=e?.polygonBarriers??z(this.polygonBarriers);if(null==r)throw new s("routelayer:undefined-stops","the route layer must have stops defined in the route parameters.");if((Q(r)||Y(r))&&r.features.length<2||i.isCollection(r)&&r.length<2)throw new s("routelayer:insufficent-stops","the route layer must have two or more stops to solve a route.");if(i.isCollection(r))for(const i of r)i.routeName=null;const a=e?.apiKey,p=this.url,c=await this._getServiceDescription(p,a,t),m=e?.travelMode??c.defaultTravelMode,y=e?.accumulateAttributes??[];null!=m&&(y.push(m.distanceAttributeName),m.timeAttributeName&&y.push(m.timeAttributeName));const f={accumulateAttributes:y,directionsOutputType:"featuresets",ignoreInvalidLocations:!0,pointBarriers:o,polylineBarriers:n,polygonBarriers:l,returnBarriers:!!o,returnDirections:!0,returnPolygonBarriers:!!l,returnPolylineBarriers:!!n,returnRoutes:!0,returnStops:!0,stops:r},d=E.from(e??{});let h;d.set(f);try{h=await k(p,d,t)}catch(S){throw u(S)?S:new s("routelayer:failed-route-request","the routing request failed",{error:S})}const w=this._toRouteLayerSolution(h);return this._isOverridden("title")||(this.title=w.routeInfo.name??"Route"),Z(w,c,d),w}update(e){const{stops:t,directionLines:r,directionPoints:o,pointBarriers:i,polylineBarriers:s,polygonBarriers:n,routeInfo:l}=e;this.set({stops:t,pointBarriers:i,polylineBarriers:s,polygonBarriers:n}),this._set("directionLines",r),this._set("directionPoints",o),this._set("routeInfo",l),null!=l.geometry&&(this.spatialReference=l.geometry.spatialReference)}_getNetworkFeatures(e,t,s,n){const l=H(e)?e.layers:e.featureCollection?.layers,a=l?.find((e=>e.layerDefinition.name===t));if(null==a)return new i;const{layerDefinition:u,popupInfo:p,featureSet:c}=a,m=u.drawingInfo.renderer,{features:y}=c,f=c.spatialReference??u.spatialReference??u.extent.spatialReference??P,d=m&&x(m),h=B.fromJSON(f),w=y.map((e=>{const i=r.fromJSON(e);null!=i.geometry&&null!=e.geometry&&null==e.geometry.spatialReference&&(i.geometry.spatialReference=h);const n=s(i);return n.symbol??=d?.getSymbol(i)??this._getNetworkSymbol(t),n.popupTemplate??=p&&o.fromJSON(p),n}));return n&&w.some((({symbol:e})=>!e))&&n(w),new i(w)}_getNetworkSymbol(e){switch(e){case"Barriers":return this.defaultSymbols.pointBarriers;case"DirectionPoints":return this.defaultSymbols.directionPoints;case"DirectionLines":return this.defaultSymbols.directionLines;case"PolylineBarriers":return this.defaultSymbols.polylineBarriers;case"PolygonBarriers":return this.defaultSymbols.polygonBarriers;case"RouteInfo":return this.defaultSymbols.routeInfo;case"Stops":return null}}async _getServiceDescription(e,t,r){if(null!=this._cachedServiceDescription&&this._cachedServiceDescription.url===e)return this._cachedServiceDescription.serviceDescription;const o=await T(e,t,r);return this._cachedServiceDescription={serviceDescription:o,url:e},o}_setStopSymbol(e){if(!e||0===e.length)return;if(null==this.defaultSymbols.stops)return;if(e.every((({symbol:e})=>null!=e)))return;const{first:t,last:r,middle:o,unlocated:i,waypoint:s,break:n}=this.defaultSymbols.stops;if(null==this.routeInfo||1===e.length)return void e.forEach(((i,s)=>{switch(s){case 0:i.symbol=t;break;case e.length-1:i.symbol=r;break;default:i.symbol=o}}));const l=e.map((({sequence:e})=>e)).filter((e=>null!=e)),a=Math.min(...l),u=Math.max(...l);for(const p of e)p.sequence!==a?p.sequence!==u?"ok"===p.status||"not-located-on-closest"===p.status?"waypoint"!==p.locationType?"break"!==p.locationType?p.symbol=o:p.symbol=n:p.symbol=s:p.symbol=i:p.symbol=r:p.symbol=t}_toRouteLayerSolution(e){const t=e.routeResults[0].stops?.map((e=>V.fromJSON(e.toJSON())));this._setStopSymbol(t);const r=new le(t),o=new se(e.polygonBarriers?.map((e=>{const t=M.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.polygonBarriers,t}))),i=new ne(e.polylineBarriers?.map((e=>{const t=U.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.polylineBarriers,t}))),s=new ie(e.pointBarriers?.map((e=>{const t=J.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.pointBarriers,t}))),n=e.routeResults[0].route?.toJSON(),l=q.fromJSON(n);l.symbol=this.defaultSymbols.routeInfo;const a=new oe(e.routeResults[0].directionPoints?.features.map((e=>{const t=G.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.directionPoints,t})));return{directionLines:new re(e.routeResults[0].directionLines?.features.map((e=>{const t=A.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.directionLines,t}))),directionPoints:a,pointBarriers:s,polygonBarriers:o,polylineBarriers:i,routeInfo:l,stops:r}}_writeDirectionLines(){return this._writeNetworkFeatures(this.directionLines,this.defaultSymbols.directionLines,"esriGeometryPolyline",A.fields,"DirectionLines","Direction Lines")}_writeDirectionPoints(){return this._writeNetworkFeatures(this.directionPoints,this.defaultSymbols.directionPoints,"esriGeometryPoint",G.fields,"DirectionPoints","Direction Points")}_writeNetworkFeatures(e,t,r,o,i,s){if(!e?.length)return null;const n=this.spatialReference.toJSON(),{fullExtent:l,maxScale:a,minScale:u}=this;return{featureSet:{features:e.toArray().map((e=>te(e))),geometryType:r,spatialReference:n},layerDefinition:{capabilities:"Query,Update,Editing",drawingInfo:{renderer:{type:"simple",symbol:null!=t?t.toJSON():K(r)}},extent:l.toJSON(),fields:o,geometryType:r,hasM:!1,hasZ:!1,maxScale:a,minScale:u,name:i,objectIdField:"ObjectID",spatialReference:n,title:s,type:"Feature Layer",typeIdField:""}}}_writePointBarriers(){return this._writeNetworkFeatures(this.pointBarriers,this.defaultSymbols.pointBarriers,"esriGeometryPoint",J.fields,"Barriers","Point Barriers")}_writePolygonBarriers(){return this._writeNetworkFeatures(this.polygonBarriers,this.defaultSymbols.polygonBarriers,"esriGeometryPolygon",M.fields,"PolygonBarriers","Polygon Barriers")}_writePolylineBarriers(){return this._writeNetworkFeatures(this.polylineBarriers,this.defaultSymbols.polylineBarriers,"esriGeometryPolyline",U.fields,"PolylineBarriers","Line Barriers")}_writeRouteInfo(){return this._writeNetworkFeatures(null!=this.routeInfo?new i([this.routeInfo]):null,this.defaultSymbols.routeInfo,"esriGeometryPolyline",q.fields,"RouteInfo","Route Details")}_writeStops(){const e=this._writeNetworkFeatures(this.stops,null,"esriGeometryPoint",V.fields,"Stops","Stops");if(null==e)return null;const{stops:t}=this.defaultSymbols,r=t?.first?.toJSON(),o=t?.middle?.toJSON(),i=t?.last?.toJSON();return e.layerDefinition.drawingInfo.renderer={type:"uniqueValue",field1:"Sequence",defaultSymbol:o,uniqueValueInfos:[{value:"1",symbol:r,label:"First Stop"},{value:`${this.stops.length}`,symbol:i,label:"Last Stop"}]},e}};e([y({readOnly:!0,json:{read:!1,origins:{"portal-item":{write:{allowNull:!0,ignoreOrigin:!0}},"web-map":{write:{overridePolicy(){return{allowNull:!0,ignoreOrigin:null==this.portalItem}}}}}}})],pe.prototype,"_featureCollection",void 0),e([h(["web-map","portal-item"],"_featureCollection")],pe.prototype,"writeFeatureCollectionWebmap",null),e([y({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{target:"type",overridePolicy(){return{ignoreOrigin:null!=this.portalItem}}}}}}})],pe.prototype,"_type",void 0),e([y({nonNullable:!0,type:R})],pe.prototype,"defaultSymbols",void 0),e([y({readOnly:!0})],pe.prototype,"directionLines",void 0),e([f(["web-map","portal-item"],"directionLines",["layers","featureCollection.layers"])],pe.prototype,"readDirectionLines",null),e([y({readOnly:!0})],pe.prototype,"directionPoints",void 0),e([f(["web-map","portal-item"],"directionPoints",["layers","featureCollection.layers"])],pe.prototype,"readDirectionPoints",null),e([y({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{ignoreOrigin:!0}}}}})],pe.prototype,"featureCollectionType",void 0),e([y({readOnly:!0})],pe.prototype,"fullExtent",null),e([y({json:{origins:{"web-map":{name:"featureCollection.showLegend"}},write:!0}})],pe.prototype,"legendEnabled",void 0),e([y({type:["show","hide"]})],pe.prototype,"listMode",void 0),e([y({type:Number,nonNullable:!0,json:{write:!1}})],pe.prototype,"maxScale",void 0),e([f(["web-map","portal-item"],"maxScale",["layers","featureCollection.layers"])],pe.prototype,"readMaxScale",null),e([y({type:Number,nonNullable:!0,json:{write:!1}})],pe.prototype,"minScale",void 0),e([f(["web-map","portal-item"],"minScale",["layers","featureCollection.layers"])],pe.prototype,"readMinScale",null),e([y({type:["ArcGISFeatureLayer"],value:"ArcGISFeatureLayer"})],pe.prototype,"operationalLayerType",void 0),e([y({nonNullable:!0,type:i.ofType(J)})],pe.prototype,"pointBarriers",void 0),e([f(["web-map","portal-item"],"pointBarriers",["layers","featureCollection.layers"])],pe.prototype,"readPointBarriers",null),e([y({nonNullable:!0,type:i.ofType(M)})],pe.prototype,"polygonBarriers",void 0),e([f(["web-map","portal-item"],"polygonBarriers",["layers","featureCollection.layers"])],pe.prototype,"readPolygonBarriers",null),e([y({nonNullable:!0,type:i.ofType(U)})],pe.prototype,"polylineBarriers",void 0),e([f(["web-map","portal-item"],"polylineBarriers",["layers","featureCollection.layers"])],pe.prototype,"readPolylineBarriers",null),e([y({readOnly:!0})],pe.prototype,"routeInfo",void 0),e([f(["web-map","portal-item"],"routeInfo",["layers","featureCollection.layers"])],pe.prototype,"readRouteInfo",null),e([y({type:B})],pe.prototype,"spatialReference",void 0),e([f(["web-map","portal-item"],"spatialReference",["layers","featureCollection.layers"])],pe.prototype,"readSpatialReference",null),e([y({nonNullable:!0,type:i.ofType(V)})],pe.prototype,"stops",void 0),e([f(["web-map","portal-item"],"stops",["layers","featureCollection.layers"])],pe.prototype,"readStops",null),e([y()],pe.prototype,"title",null),e([y({readOnly:!0,json:{read:!1}})],pe.prototype,"type",void 0),e([y()],pe.prototype,"url",null),pe=e([d(ae)],pe);const ce=pe;export{ce as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../config.js";import r from"../Graphic.js";import o from"../PopupTemplate.js";import i from"../core/Collection.js";import s from"../core/Error.js";import n from"../core/Logger.js";import{MultiOriginJSONMixin as l}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as a}from"../core/object.js";import{isAbortError as u}from"../core/promiseUtils.js";import{on as p}from"../core/reactiveUtils.js";import{convertUnit as c}from"../core/unitUtils.js";import{urlToObject as m}from"../core/urlUtils.js";import{property as y}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{reader as f}from"../core/accessorSupport/decorators/reader.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import{writer as h}from"../core/accessorSupport/decorators/writer.js";import{updateOrigins as w}from"../core/accessorSupport/originUtils.js";import S from"../geometry/Extent.js";import g from"../geometry/Multipoint.js";import{initializeProjection as b,project as v}from"../geometry/projection.js";import B from"../geometry/SpatialReference.js";import{wgs84 as P}from"../geometry/support/spatialReferenceUtils.js";import N from"./Layer.js";import{BlendLayer as _}from"./mixins/BlendLayer.js";import{OperationalLayer as j}from"./mixins/OperationalLayer.js";import{PortalLayer as L}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as I}from"./mixins/ScaleRangeLayer.js";import{sanitizeUrl as C}from"./support/arcgisLayerUrl.js";import D from"./support/RouteSymbols.js";import R from"../portal/Portal.js";import O from"../portal/PortalItem.js";import{typeKeyword as k}from"../portal/support/portalItemUtils.js";import{read as F}from"../renderers/support/jsonUtils.js";import{fetchServiceDescription as x}from"../rest/networkService.js";import{solve as T}from"../rest/route.js";import A from"../rest/support/DirectionLine.js";import G from"../rest/support/DirectionPoint.js";import J from"../rest/support/PointBarrier.js";import M from"../rest/support/PolygonBarrier.js";import U from"../rest/support/PolylineBarrier.js";import q from"../rest/support/RouteInfo.js";import E from"../rest/support/RouteParameters.js";import W from"../rest/support/RouteSettings.js";import V from"../rest/support/Stop.js";function z(e){return e.length?e:null}function K(e){switch(e){case"esriGeometryPoint":return{type:"esriSMS",style:"esriSMSCircle",size:12,color:[0,0,0,0],outline:K("esriGeometryPolyline")};case"esriGeometryPolyline":return{type:"esriSLS",style:"esriSLSSolid",width:1,color:[0,0,0,0]};case"esriGeometryPolygon":return{type:"esriSFS",style:"esriSFSNull",outline:K("esriGeometryPolyline")}}}function H(e){return"layers"in e}function Q(e){return"esri.rest.support.FeatureSet"===e.declaredClass}function Y(e){return"esri.rest.support.NetworkFeatureSet"===e.declaredClass}function Z(e,t,r){const o=t.networkDataset?.networkAttributes,i=o?.filter((({usageType:e})=>"cost"===e))??[],n=r.travelMode??t.defaultTravelMode;if(null==n)return void ue().warn("route-layer:missing-travel-mode","The routing service must have a default travel mode or one must be specified in the route parameter.");const{timeAttributeName:l,distanceAttributeName:a}=n,u=i.find((({name:e})=>e===l)),p=i.find((({name:e})=>e===a)),c=r.travelMode?.impedanceAttributeName??r.impedanceAttribute??t.impedance,m=u?.units,y=p?.units;if(!m||!y)throw new s("routelayer:unknown-impedance-units","the units of either the distance or time impedance are unknown");const f=r.directionsLanguage??t.directionsLanguage,d=r.accumulateAttributes??t.accumulateAttributeNames??[],h=new Set(i.filter((({name:e})=>e===l||e===a||e===c||null!=e&&d.includes(e))).map((({name:e})=>e))),w=e=>{for(const t in e)h.has(t)||delete e[t]};for(const s of e.pointBarriers)null!=s.costs&&(s.addedCost=s.costs[c]??0,w(s.costs));for(const s of e.polygonBarriers)null!=s.costs&&(s.scaleFactor=s.costs[c]??1,w(s.costs));for(const s of e.polylineBarriers)null!=s.costs&&(s.scaleFactor=s.costs[c]??1,w(s.costs));const{routeInfo:S}=e,{findBestSequence:g,preserveFirstStop:b,preserveLastStop:v,startTimeIsUTC:B,timeWindowsAreUTC:P}=r;S.analysisSettings=new W({accumulateAttributes:d,directionsLanguage:f,findBestSequence:g,preserveFirstStop:b,preserveLastStop:v,startTimeIsUTC:B,timeWindowsAreUTC:P,travelMode:n}),S.totalDuration=X(S.totalCosts?.[l]??0,m),S.totalDistance=ee(S.totalCosts?.[a]??0,y),S.totalLateDuration=X(S.totalViolations?.[l]??0,m),S.totalWaitDuration=X(S.totalWait?.[l]??0,m),null!=S.totalCosts&&w(S.totalCosts),null!=S.totalViolations&&w(S.totalViolations),null!=S.totalWait&&w(S.totalWait);for(const s of e.stops)null!=s.serviceCosts&&(s.serviceDuration=X(s.serviceCosts[l]??0,m),s.serviceDistance=ee(s.serviceCosts[a]??0,y),w(s.serviceCosts)),null!=s.cumulativeCosts&&(s.cumulativeDuration=X(s.cumulativeCosts[l]??0,m),s.cumulativeDistance=ee(s.cumulativeCosts[a]??0,y),w(s.cumulativeCosts)),null!=s.violations&&(s.lateDuration=X(s.violations[l]??0,m),w(s.violations)),null!=s.wait&&(s.waitDuration=X(s.wait[l]??0,m),w(s.wait))}async function $(e){const t=B.WGS84;return await b(e.spatialReference,t),v(e,t)}function X(e,t){switch(t){case"seconds":return e/60;case"hours":return 60*e;case"days":return 60*e*24;default:return e}}function ee(e,t){return"decimal-degrees"===t||"points"===t||"unknown"===t?e:c(e,t,"meters")}function te(e){const{attributes:t,geometry:r,popupTemplate:o,symbol:i}=e.toGraphic().toJSON();return{attributes:t,geometry:r,popupInfo:o,symbol:i}}const re=i.ofType(A),oe=i.ofType(G),ie=i.ofType(J),se=i.ofType(M),ne=i.ofType(U),le=i.ofType(V),ae="esri.layers.RouteLayer",ue=()=>n.getLogger(ae);let pe=class extends(_(I(j(L(l(N)))))){constructor(e){super(e),this._cachedServiceDescription=null,this._featureCollection=null,this._type="Feature Collection",this.checksum=null,this.defaultSymbols=new D,this.directionLines=null,this.directionPoints=null,this.featureCollectionType="route",this.legendEnabled=!1,this.maxScale=0,this.minScale=0,this.pointBarriers=new ie,this.polygonBarriers=new se,this.polylineBarriers=new ne,this.routeInfo=null,this.spatialReference=B.WGS84,this.stops=new le,this.type="route";const t=()=>{this._setStopSymbol(this.stops)};this.addHandles(p((()=>this.stops),"change",t,{sync:!0,onListenerAdd:t}))}writeFeatureCollectionWebmap(e,t,r,o){const i=[this._writePolygonBarriers(),this._writePolylineBarriers(),this._writePointBarriers(),this._writeRouteInfo(),this._writeDirectionLines(),this._writeDirectionPoints(),this._writeStops()].filter((e=>!!e)),s=i.map(((e,t)=>t)),n="web-map"===o.origin?"featureCollection.layers":"layers";a(n,i,t),t.opacity=this.opacity,t.visibility=this.visible,t.visibleLayers=s}readDirectionLines(e,t){return this._getNetworkFeatures(t,"DirectionLines",(e=>A.fromGraphic(e)))}readDirectionPoints(e,t){return this._getNetworkFeatures(t,"DirectionPoints",(e=>G.fromGraphic(e)))}get fullExtent(){const e=new S({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:B.WGS84});if(null!=this.routeInfo?.geometry)return this.routeInfo.geometry.extent??e;if(null==this.stops)return e;const t=this.stops.filter((e=>null!=e.geometry));if(t.length<2)return e;const{spatialReference:r}=t.at(0).geometry;if(null==r)return e;const o=t.toArray().map((e=>{const t=e.geometry;return[t.x,t.y]}));return new g({points:o,spatialReference:r}).extent}readMaxScale(e,t){const r=H(t)?t.layers:t.featureCollection?.layers,o=r?.find((e=>null!=e.layerDefinition.maxScale));return o?.layerDefinition.maxScale??0}readMinScale(e,t){const r=H(t)?t.layers:t.featureCollection?.layers,o=r?.find((e=>null!=e.layerDefinition.minScale));return o?.layerDefinition.minScale??0}readPointBarriers(e,t){return this._getNetworkFeatures(t,"Barriers",(e=>J.fromGraphic(e)))}readPolygonBarriers(e,t){return this._getNetworkFeatures(t,"PolygonBarriers",(e=>M.fromGraphic(e)))}readPolylineBarriers(e,t){return this._getNetworkFeatures(t,"PolylineBarriers",(e=>U.fromGraphic(e)))}readRouteInfo(e,t){return this._getNetworkFeatures(t,"RouteInfo",(e=>q.fromGraphic(e))).at(0)??null}readSpatialReference(e,t){const r=H(t)?t.layers:t.featureCollection?.layers;if(!r?.length)return B.WGS84;const{layerDefinition:o,featureSet:i}=r[0],s=i.features[0],n=s?.geometry?.spatialReference??i.spatialReference??o.spatialReference??o.extent.spatialReference??P;return B.fromJSON(n)}readStops(e,t){return this._getNetworkFeatures(t,"Stops",(e=>V.fromGraphic(e)),(e=>this._setStopSymbol(e)))}get title(){return this.routeInfo?.name??"Route"}set title(e){this._overrideIfSome("title",e)}get url(){return t.routeServiceUrl}set url(e){null!=e?this._set("url",C(e,ue())):this._set("url",t.routeServiceUrl)}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Feature Collection"]},e)),Promise.resolve(this)}removeAll(){this.removeResult(),this.pointBarriers.removeAll(),this.polygonBarriers.removeAll(),this.polylineBarriers.removeAll(),this.stops.removeAll()}removeResult(){null!=this.directionLines&&(this.directionLines.removeAll(),this._set("directionLines",null)),null!=this.directionPoints&&(this.directionPoints.removeAll(),this._set("directionPoints",null)),null!=this.routeInfo&&this._set("routeInfo",null)}async save(){await this.load();const{fullExtent:e,portalItem:t}=this;if(!t)throw new s("routelayer:portal-item-not-set","save() requires to the layer to have a portal item");if(!t.id)throw new s("routelayer:portal-item-not-saved","Please use saveAs() first to save the routelayer");if("Feature Collection"!==t.type)throw new s("routelayer:portal-item-wrong-type",'Portal item needs to have type "Feature Collection"');if(null==this.routeInfo)throw new s("routelayer:route-unsolved","save() requires a solved route");const{portal:r}=t;await r.signIn(),r.user||await t.reload();const{itemUrl:o,itemControl:i}=t;if("admin"!==i&&"update"!==i)throw new s("routelayer:insufficient-permissions","To save this layer, you need to be the owner or an administrator of your organization");const n={messages:[],origin:"portal-item",portal:r,url:o?m(o):void 0,writtenProperties:[]},l=this.write(void 0,n);return t.extent=await $(e),t.title=this.title,await t.update({data:l}),t}async saveAs(e,t={}){if(await this.load(),null==this.routeInfo)throw new s("routelayer:route-unsolved","saveAs() requires a solved route");const r=O.from(e).clone();r.extent??=await $(this.fullExtent),r.id=null,r.portal??=R.getDefault(),r.title??=this.title,r.type="Feature Collection",r.typeKeywords=["Data","Feature Collection",k.MULTI_LAYER,"Route Layer"];const{portal:o}=r,i={messages:[],origin:"portal-item",portal:o,url:null,writtenProperties:[]};await o.signIn();const n=t?.folder,l=this.write(void 0,i);return await o.user.addItem({item:r,folder:n,data:l}),this.portalItem=r,w(i),i.portalItem=r,r}async solve(e,t){const r=e?.stops??this.stops,o=e?.pointBarriers??z(this.pointBarriers),n=e?.polylineBarriers??z(this.polylineBarriers),l=e?.polygonBarriers??z(this.polygonBarriers);if(null==r)throw new s("routelayer:undefined-stops","the route layer must have stops defined in the route parameters.");if((Q(r)||Y(r))&&r.features.length<2||i.isCollection(r)&&r.length<2)throw new s("routelayer:insufficent-stops","the route layer must have two or more stops to solve a route.");if(i.isCollection(r))for(const i of r)i.routeName=null;const a=e?.apiKey,{checksum:p,url:c}=this,m=await this._getServiceDescription(c,a,t),y=e?.travelMode??m.defaultTravelMode,f=e?.accumulateAttributes??[];null!=y&&(f.push(y.distanceAttributeName),y.timeAttributeName&&f.push(y.timeAttributeName));const d={accumulateAttributes:f,checksum:p,directionsOutputType:"featuresets",ignoreInvalidLocations:!0,pointBarriers:o,polylineBarriers:n,polygonBarriers:l,returnBarriers:!!o,returnDirections:!0,returnPolygonBarriers:!!l,returnPolylineBarriers:!!n,returnRoutes:!0,returnStops:!0,stops:r},h=E.from(e??{});let w;h.set(d);try{w=await T(c,h,t)}catch(g){throw u(g)?g:new s("routelayer:failed-route-request","the routing request failed",{error:g})}const S=this._toRouteLayerSolution(w);return this._isOverridden("title")||(this.title=S.routeInfo.name??"Route"),Z(S,m,h),S}update(e){const{checksum:t,directionLines:r,directionPoints:o,pointBarriers:i,polygonBarriers:s,polylineBarriers:n,routeInfo:l,stops:a}=e;this.set({stops:a,checksum:t,pointBarriers:i,polylineBarriers:n,polygonBarriers:s}),this._set("directionLines",r),this._set("directionPoints",o),this._set("routeInfo",l),null!=l.geometry&&(this.spatialReference=l.geometry.spatialReference)}_getNetworkFeatures(e,t,s,n){const l=H(e)?e.layers:e.featureCollection?.layers,a=l?.find((e=>e.layerDefinition.name===t));if(null==a)return new i;const{layerDefinition:u,popupInfo:p,featureSet:c}=a,m=u.drawingInfo.renderer,{features:y}=c,f=c.spatialReference??u.spatialReference??u.extent.spatialReference??P,d=m&&F(m),h=B.fromJSON(f),w=y.map((e=>{const i=r.fromJSON(e);null!=i.geometry&&null!=e.geometry&&null==e.geometry.spatialReference&&(i.geometry.spatialReference=h);const n=s(i);return n.symbol??=d?.getSymbol(i)??this._getNetworkSymbol(t),n.popupTemplate??=p&&o.fromJSON(p),n}));return n&&w.some((({symbol:e})=>!e))&&n(w),new i(w)}_getNetworkSymbol(e){switch(e){case"Barriers":return this.defaultSymbols.pointBarriers;case"DirectionPoints":return this.defaultSymbols.directionPoints;case"DirectionLines":return this.defaultSymbols.directionLines;case"PolylineBarriers":return this.defaultSymbols.polylineBarriers;case"PolygonBarriers":return this.defaultSymbols.polygonBarriers;case"RouteInfo":return this.defaultSymbols.routeInfo;case"Stops":return null}}async _getServiceDescription(e,t,r){if(null!=this._cachedServiceDescription&&this._cachedServiceDescription.url===e)return this._cachedServiceDescription.serviceDescription;const o=await x(e,t,r);return this._cachedServiceDescription={serviceDescription:o,url:e},o}_setStopSymbol(e){if(!e||0===e.length)return;if(null==this.defaultSymbols.stops)return;if(e.every((({symbol:e})=>null!=e)))return;const{first:t,last:r,middle:o,unlocated:i,waypoint:s,break:n}=this.defaultSymbols.stops;if(null==this.routeInfo||1===e.length)return void e.forEach(((i,s)=>{switch(s){case 0:i.symbol=t;break;case e.length-1:i.symbol=r;break;default:i.symbol=o}}));const l=e.map((({sequence:e})=>e)).filter((e=>null!=e)),a=Math.min(...l),u=Math.max(...l);for(const p of e)p.sequence!==a?p.sequence!==u?"ok"===p.status||"not-located-on-closest"===p.status?"waypoint"!==p.locationType?"break"!==p.locationType?p.symbol=o:p.symbol=n:p.symbol=s:p.symbol=i:p.symbol=r:p.symbol=t}_toRouteLayerSolution(e){const{checksum:t,routeResults:r}=e,o=r[0].stops?.map((e=>V.fromJSON(e.toJSON())));this._setStopSymbol(o);const i=new le(o),s=new se(e.polygonBarriers?.map((e=>{const t=M.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.polygonBarriers,t}))),n=new ne(e.polylineBarriers?.map((e=>{const t=U.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.polylineBarriers,t}))),l=new ie(e.pointBarriers?.map((e=>{const t=J.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.pointBarriers,t}))),a=r[0].route?.toJSON(),u=q.fromJSON(a);u.symbol=this.defaultSymbols.routeInfo;const p=new oe(r[0].directionPoints?.features.map((e=>{const t=G.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.directionPoints,t})));return{checksum:t,directionLines:new re(r[0].directionLines?.features.map((e=>{const t=A.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.directionLines,t}))),directionPoints:p,pointBarriers:l,polygonBarriers:s,polylineBarriers:n,routeInfo:u,stops:i}}_writeDirectionLines(){return this._writeNetworkFeatures(this.directionLines,this.defaultSymbols.directionLines,"esriGeometryPolyline",A.fields,"DirectionLines","Direction Lines")}_writeDirectionPoints(){return this._writeNetworkFeatures(this.directionPoints,this.defaultSymbols.directionPoints,"esriGeometryPoint",G.fields,"DirectionPoints","Direction Points")}_writeNetworkFeatures(e,t,r,o,i,s){if(!e?.length)return null;const n=this.spatialReference.toJSON(),{fullExtent:l,maxScale:a,minScale:u}=this;return{featureSet:{features:e.toArray().map((e=>te(e))),geometryType:r,spatialReference:n},layerDefinition:{capabilities:"Query,Update,Editing",drawingInfo:{renderer:{type:"simple",symbol:null!=t?t.toJSON():K(r)}},extent:l.toJSON(),fields:o,geometryType:r,hasM:!1,hasZ:!1,maxScale:a,minScale:u,name:i,objectIdField:"ObjectID",spatialReference:n,title:s,type:"Feature Layer",typeIdField:""}}}_writePointBarriers(){return this._writeNetworkFeatures(this.pointBarriers,this.defaultSymbols.pointBarriers,"esriGeometryPoint",J.fields,"Barriers","Point Barriers")}_writePolygonBarriers(){return this._writeNetworkFeatures(this.polygonBarriers,this.defaultSymbols.polygonBarriers,"esriGeometryPolygon",M.fields,"PolygonBarriers","Polygon Barriers")}_writePolylineBarriers(){return this._writeNetworkFeatures(this.polylineBarriers,this.defaultSymbols.polylineBarriers,"esriGeometryPolyline",U.fields,"PolylineBarriers","Line Barriers")}_writeRouteInfo(){return this._writeNetworkFeatures(null!=this.routeInfo?new i([this.routeInfo]):null,this.defaultSymbols.routeInfo,"esriGeometryPolyline",q.fields,"RouteInfo","Route Details")}_writeStops(){const e=this._writeNetworkFeatures(this.stops,null,"esriGeometryPoint",V.fields,"Stops","Stops");if(null==e)return null;const{stops:t}=this.defaultSymbols,r=t?.first?.toJSON(),o=t?.middle?.toJSON(),i=t?.last?.toJSON();return e.layerDefinition.drawingInfo.renderer={type:"uniqueValue",field1:"Sequence",defaultSymbol:o,uniqueValueInfos:[{value:"1",symbol:r,label:"First Stop"},{value:`${this.stops.length}`,symbol:i,label:"Last Stop"}]},e}};e([y({readOnly:!0,json:{read:!1,origins:{"portal-item":{write:{allowNull:!0,ignoreOrigin:!0}},"web-map":{write:{overridePolicy(){return{allowNull:!0,ignoreOrigin:null==this.portalItem}}}}}}})],pe.prototype,"_featureCollection",void 0),e([h(["web-map","portal-item"],"_featureCollection")],pe.prototype,"writeFeatureCollectionWebmap",null),e([y({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{target:"type",overridePolicy(){return{ignoreOrigin:null!=this.portalItem}}}}}}})],pe.prototype,"_type",void 0),e([y({type:String})],pe.prototype,"checksum",void 0),e([y({nonNullable:!0,type:D})],pe.prototype,"defaultSymbols",void 0),e([y({readOnly:!0})],pe.prototype,"directionLines",void 0),e([f(["web-map","portal-item"],"directionLines",["layers","featureCollection.layers"])],pe.prototype,"readDirectionLines",null),e([y({readOnly:!0})],pe.prototype,"directionPoints",void 0),e([f(["web-map","portal-item"],"directionPoints",["layers","featureCollection.layers"])],pe.prototype,"readDirectionPoints",null),e([y({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{ignoreOrigin:!0}}}}})],pe.prototype,"featureCollectionType",void 0),e([y({readOnly:!0})],pe.prototype,"fullExtent",null),e([y({json:{origins:{"web-map":{name:"featureCollection.showLegend"}},write:!0}})],pe.prototype,"legendEnabled",void 0),e([y({type:["show","hide"]})],pe.prototype,"listMode",void 0),e([y({type:Number,nonNullable:!0,json:{write:!1}})],pe.prototype,"maxScale",void 0),e([f(["web-map","portal-item"],"maxScale",["layers","featureCollection.layers"])],pe.prototype,"readMaxScale",null),e([y({type:Number,nonNullable:!0,json:{write:!1}})],pe.prototype,"minScale",void 0),e([f(["web-map","portal-item"],"minScale",["layers","featureCollection.layers"])],pe.prototype,"readMinScale",null),e([y({type:["ArcGISFeatureLayer"],value:"ArcGISFeatureLayer"})],pe.prototype,"operationalLayerType",void 0),e([y({nonNullable:!0,type:i.ofType(J)})],pe.prototype,"pointBarriers",void 0),e([f(["web-map","portal-item"],"pointBarriers",["layers","featureCollection.layers"])],pe.prototype,"readPointBarriers",null),e([y({nonNullable:!0,type:i.ofType(M)})],pe.prototype,"polygonBarriers",void 0),e([f(["web-map","portal-item"],"polygonBarriers",["layers","featureCollection.layers"])],pe.prototype,"readPolygonBarriers",null),e([y({nonNullable:!0,type:i.ofType(U)})],pe.prototype,"polylineBarriers",void 0),e([f(["web-map","portal-item"],"polylineBarriers",["layers","featureCollection.layers"])],pe.prototype,"readPolylineBarriers",null),e([y({readOnly:!0})],pe.prototype,"routeInfo",void 0),e([f(["web-map","portal-item"],"routeInfo",["layers","featureCollection.layers"])],pe.prototype,"readRouteInfo",null),e([y({type:B})],pe.prototype,"spatialReference",void 0),e([f(["web-map","portal-item"],"spatialReference",["layers","featureCollection.layers"])],pe.prototype,"readSpatialReference",null),e([y({nonNullable:!0,type:i.ofType(V)})],pe.prototype,"stops",void 0),e([f(["web-map","portal-item"],"stops",["layers","featureCollection.layers"])],pe.prototype,"readStops",null),e([y()],pe.prototype,"title",null),e([y({readOnly:!0,json:{read:!1}})],pe.prototype,"type",void 0),e([y()],pe.prototype,"url",null),pe=e([d(ae)],pe);const ce=pe;export{ce as default};
|
|
@@ -4,6 +4,7 @@ export const defaultRaster: __esri.rasterFunctionUtils["defaultRaster"];
|
|
|
4
4
|
export const abs: __esri.rasterFunctionUtils["abs"];
|
|
5
5
|
export const acos: __esri.rasterFunctionUtils["acos"];
|
|
6
6
|
export const acosh: __esri.rasterFunctionUtils["acosh"];
|
|
7
|
+
export const argStatistics: __esri.rasterFunctionUtils["argStatistics"];
|
|
7
8
|
export const asin: __esri.rasterFunctionUtils["asin"];
|
|
8
9
|
export const asinh: __esri.rasterFunctionUtils["asinh"];
|
|
9
10
|
export const aspect: __esri.rasterFunctionUtils["aspect"];
|
|
@@ -50,16 +51,20 @@ export const booleanAnd: __esri.rasterFunctionUtils["booleanAnd"];
|
|
|
50
51
|
export const booleanNot: __esri.rasterFunctionUtils["booleanNot"];
|
|
51
52
|
export const booleanOr: __esri.rasterFunctionUtils["booleanOr"];
|
|
52
53
|
export const booleanXor: __esri.rasterFunctionUtils["booleanXor"];
|
|
54
|
+
export const calculate: __esri.rasterFunctionUtils["calculate"];
|
|
53
55
|
export const cellStatistics: __esri.rasterFunctionUtils["cellStatistics"];
|
|
54
56
|
export const clip: __esri.rasterFunctionUtils["clip"];
|
|
55
57
|
export const colormap: __esri.rasterFunctionUtils["colormap"];
|
|
56
58
|
export const colormapToRGB: __esri.rasterFunctionUtils["colormapToRGB"];
|
|
59
|
+
export const colorspaceConversion: __esri.rasterFunctionUtils["colorspaceConversion"];
|
|
57
60
|
export const compositeBand: __esri.rasterFunctionUtils["compositeBand"];
|
|
61
|
+
export const computeChange: __esri.rasterFunctionUtils["computeChange"];
|
|
58
62
|
export const conditional: __esri.rasterFunctionUtils["conditional"];
|
|
59
63
|
export const contrastBrightness: __esri.rasterFunctionUtils["contrastBrightness"];
|
|
60
64
|
export const convolution: __esri.rasterFunctionUtils["convolution"];
|
|
61
65
|
export const cos: __esri.rasterFunctionUtils["cos"];
|
|
62
66
|
export const cosh: __esri.rasterFunctionUtils["cosh"];
|
|
67
|
+
export const createColorComposite: __esri.rasterFunctionUtils["createColorComposite"];
|
|
63
68
|
export const curvature: __esri.rasterFunctionUtils["curvature"];
|
|
64
69
|
export const divide: __esri.rasterFunctionUtils["divide"];
|
|
65
70
|
export const equalTo: __esri.rasterFunctionUtils["equalTo"];
|
|
@@ -94,6 +99,7 @@ export const shadedRelief: __esri.rasterFunctionUtils["shadedRelief"];
|
|
|
94
99
|
export const sin: __esri.rasterFunctionUtils["sin"];
|
|
95
100
|
export const sinh: __esri.rasterFunctionUtils["sinh"];
|
|
96
101
|
export const slope: __esri.rasterFunctionUtils["slope"];
|
|
102
|
+
export const spectralConversion: __esri.rasterFunctionUtils["spectralConversion"];
|
|
97
103
|
export const sqrt: __esri.rasterFunctionUtils["sqrt"];
|
|
98
104
|
export const square: __esri.rasterFunctionUtils["square"];
|
|
99
105
|
export const statistics: __esri.rasterFunctionUtils["statistics"];
|
|
@@ -105,4 +111,9 @@ export const stretchStandardDeviation: __esri.rasterFunctionUtils["stretchStanda
|
|
|
105
111
|
export const table: __esri.rasterFunctionUtils["table"];
|
|
106
112
|
export const tan: __esri.rasterFunctionUtils["tan"];
|
|
107
113
|
export const tanh: __esri.rasterFunctionUtils["tanh"];
|
|
114
|
+
export const tasseledCap: __esri.rasterFunctionUtils["tasseledCap"];
|
|
115
|
+
export const threshold: __esri.rasterFunctionUtils["threshold"];
|
|
108
116
|
export const times: __esri.rasterFunctionUtils["times"];
|
|
117
|
+
export const transposeBits: __esri.rasterFunctionUtils["transposeBits"];
|
|
118
|
+
export const weightedOverlay: __esri.rasterFunctionUtils["weightedOverlay"];
|
|
119
|
+
export const weightedSum: __esri.rasterFunctionUtils["weightedSum"];
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import o from"../layers/FeatureLayer.js";import{queryAllJSON as a}from"../layers/support/featureQueryAll.js";import i from"./Network.js";import n from"./RulesTable.js";import l from"./support/NamedTraceConfiguration.js";import u from"./support/NetworkSystemLayers.js";import d from"./support/TerminalConfiguration.js";import m from"./support/TraceJobInfo.js";import{AssociationTypeEnum as c,RuleType as p}from"./support/typeUtils.js";import y from"../rest/support/Query.js";let f=class extends i{constructor(e){super(e),this.sharedNamedTraceConfigurations=[],this.type="utility",this._terminalById=new Map}get serviceTerritoryFeatureLayerId(){return this.dataElement?.serviceTerritoryFeatureLayerId??null}get networkSystemLayers(){return new u({rulesTableId:this.sourceJSON?.systemLayers.rulesTableId,rulesTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.rulesTableId}`:null,subnetworksTableId:this.sourceJSON?.systemLayers.subnetworksTableId,subnetworksTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.subnetworksTableId}`:null,dirtyAreasLayerId:this.sourceJSON?.systemLayers.dirtyAreasLayerId,dirtyAreasLayerUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.dirtyAreasLayerId}`:null,associationsTableId:this.sourceJSON?.systemLayers.associationsTableId,associationsTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.associationsTableId}`:null})}get terminalConfigurations(){return this.dataElement?.terminalConfigurations.map((e=>d.fromJSON(e)))||[]}get domainNetworkNames(){return this.dataElement?.domainNetworks.map((e=>e.domainNetworkName))||[]}get _utilityLayerList(){const e=new Set;return this.dataElement?.domainNetworks?.map((t=>{t?.edgeSources?.map((({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)})),t?.junctionSources?.map((({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)}))})),e}async load(e){return this.addResolvingPromise(super.load(e)),this.addResolvingPromise(this._loadNamedTraceConfigurationsFromNetwork(e)),this}getTerminalConfiguration(e){let t=null,r=null;const s=e.layer;let o=null;if("feature"===s?.type){if(o=s.layerId,null===o)return null}else{if("subtype-sublayer"!==s?.type)return null;if(o=s?.parent?.layerId??null,null===o)return null}const a=e.attributes;if(null==a)return null;for(const l of Object.keys(a))"ASSETGROUP"===l.toUpperCase()&&(t=e.getAttribute(l)),"ASSETTYPE"===l.toUpperCase()&&(r=e.getAttribute(l));if(!this.dataElement)return null;let i=null;const n=this.dataElement.domainNetworks;for(const l of n){const e=l.junctionSources?.find((e=>e.layerId===o));if(e){const s=e.assetGroups?.find((e=>e.assetGroupCode===t));if(s){const e=s.assetTypes?.find((e=>e.assetTypeCode===r));if(e?.isTerminalConfigurationSupported){i=e.terminalConfigurationId;break}}}}if(null!=i){const e=this.dataElement.terminalConfigurations,t=e?.find((e=>e.terminalConfigurationId===i));return t?d.fromJSON(t):null}return null}getTierNames(e){const t=this.dataElement?.domainNetworks.find((t=>t.domainNetworkName===e));return t?.tiers.map((e=>e.name))||[]}async getRulesTable(){return this._sharedRulesTable||(this._sharedRulesTable=this._createRulesTable()),await this._sharedRulesTable}getTerminalById(e){if(!this.dataElement||null==e)return null;const t=this._terminalById.get(e);return null!=t?t:(this.terminalConfigurations.forEach((e=>{e.terminals.forEach((e=>{this._terminalById.set(e.id,e)}))})),this._terminalById.get(e))}isUtilityLayer(e){return"layerId"in e?this._utilityLayerList.has(e?.layerId)&&(e.url?.startsWith(this.featureServiceUrl)??!1):!("subtype-sublayer"!==e.type||!e.parent)&&(this._utilityLayerList.has(e.parent.layerId)&&(e.parent.url?.startsWith(this.featureServiceUrl)??!1))}async queryAssociations(e,t){const[{queryAssociations:r},{default:s}]=await Promise.all([import("../rest/networks/queryAssociations.js"),import("../rest/networks/support/QueryAssociationsParameters.js")]),o=s.from(e);o.gdbVersion=this.gdbVersion,o.moment=this.historicMoment;return(await r(this.networkServiceUrl,o,t)).associations}async synthesizeAssociationGeometries(e){const[{synthesizeAssociationGeometries:t},{default:r}]=await Promise.all([import("../rest/networks/synthesizeAssociationGeometries.js"),import("../rest/networks/support/SynthesizeAssociationGeometriesParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async trace(e){const[{trace:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async submitTraceJob(e){const[{submitTraceJob:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment;const o=await t(this.networkServiceUrl,s);return new m({statusUrl:o})}async canAddAssociation(e){const t=await this.getRulesTable();if(!t)return!1;await t.load();const r=(e,t)=>e?1===e.terminalId?!t?.terminalId||t?.terminalId===e.terminalId:e.terminalId===t?.terminalId:!t?.terminalId,s=(e,t)=>e.fromNetworkSource?.sourceId===t.fromNetworkElement?.networkSourceId&&e.toNetworkSource?.sourceId===t.toNetworkElement?.networkSourceId&&e.fromAssetGroup?.assetGroupCode===t.fromNetworkElement?.assetGroupCode&&e.fromAssetType?.assetTypeCode===t.fromNetworkElement?.assetTypeCode&&e.toAssetGroup?.assetGroupCode===t.toNetworkElement?.assetGroupCode&&e.toAssetType?.assetTypeCode===t.toNetworkElement?.assetTypeCode&&r(e.fromTerminal,t.fromNetworkElement)&&r(e.toTerminal,t.toNetworkElement);if("containment"===e.associationType){return t.rulesCategorized.containment.some((t=>s(t,e)))}if("attachment"===e.associationType){return t.rulesCategorized.attachment.some((t=>s(t,e)))}return t.rulesCategorized.connectivity.some((t=>t.viaNetworkSource?t.fromNetworkSource?.sourceId===e.fromNetworkElement?.networkSourceId&&t.viaNetworkSource?.sourceId===e.toNetworkElement?.networkSourceId&&t.fromAssetGroup?.assetGroupCode===e.fromNetworkElement?.assetGroupCode&&t.fromAssetType?.assetTypeCode===e.fromNetworkElement?.assetTypeCode&&t.viaAssetGroup?.assetGroupCode===e.toNetworkElement?.assetGroupCode&&t.viaAssetType?.assetTypeCode===e.toNetworkElement?.assetTypeCode&&r(t.fromTerminal,e.fromNetworkElement)&&r(t.viaTerminal,e.toNetworkElement)||t.viaNetworkSource?.sourceId===e.fromNetworkElement?.networkSourceId&&t.toNetworkSource?.sourceId===e.toNetworkElement?.networkSourceId&&t.viaAssetGroup?.assetGroupCode===e.fromNetworkElement?.assetGroupCode&&t.viaAssetType?.assetTypeCode===e.fromNetworkElement?.assetTypeCode&&t.toAssetGroup?.assetGroupCode===e.toNetworkElement?.assetGroupCode&&t.toAssetType?.assetTypeCode===e.toNetworkElement?.assetTypeCode&&r(t.viaTerminal,e.fromNetworkElement)&&r(t.toTerminal,e.toNetworkElement):s(t,e)))}generateAddAssociations(e){return{addFeatures:e.map((e=>new t({attributes:{fromnetworksourceid:e.fromNetworkElement?.networkSourceId,fromglobalid:e.fromNetworkElement?.globalId,fromterminalid:e.fromNetworkElement?.terminalId,tonetworksourceid:e.toNetworkElement?.networkSourceId,toglobalid:e.toNetworkElement?.globalId,toterminalid:e.toNetworkElement?.terminalId,associationtype:c[e.associationType],iscontentvisible:null==e.isContentVisible?void 0:e.isContentVisible?1:0,percentalong:e.percentAlong,globalid:e.globalId}}))),id:this.networkSystemLayers.associationsTableId,identifierFields:{globalIdField:"globalid",objectIdField:"objectid"}}}generateDeleteAssociations(e){return{deleteFeatures:e.map((e=>({globalId:e.globalId}))),id:this.networkSystemLayers.associationsTableId,identifierFields:{globalIdField:"globalid",objectIdField:"objectid"}}}async _loadNamedTraceConfigurationsFromNetwork(e){if(0===this.sharedNamedTraceConfigurations?.length)return;const t=this.sharedNamedTraceConfigurations.map((e=>e.globalId)),r=await this.queryNamedTraceConfigurations({globalIds:t},e);for(const s of this.sharedNamedTraceConfigurations){const e=r?.find((e=>e.globalId===s.globalId));if(e){const t=e.write({},{origin:"service"});s.read(t,{origin:"service"})}}}async _createRulesTable(){const e=this.networkSystemLayers.rulesTableUrl,t=new o({url:e});await t.load();const r=this.dataElement?.domainNetworks;if(!r)return null;const s=r.flatMap((e=>[...e.edgeSources||[],...e.junctionSources||[]])),a=(await w(t)).map((e=>this._hydrateRuleInfo(t,s,e)));return new n({rulesLayer:t,rules:a})}_hydrateRuleInfo(e,t,r){const s=e.fieldsIndex,o=s.get("RULETYPE"),a=s.get("CREATIONDATE"),i=s.get("FROMNETWORKSOURCEID"),n=s.get("FROMASSETGROUP"),l=s.get("FROMASSETTYPE"),u=s.get("FROMTERMINALID"),d=s.get("TONETWORKSOURCEID"),m=s.get("TOASSETGROUP"),c=s.get("TOASSETTYPE"),y=s.get("TOTERMINALID"),f=s.get("VIANETWORKSOURCEID"),w=s.get("VIAASSETGROUP"),I=s.get("VIAASSETTYPE"),T=s.get("VIATERMINALID"),h=r.attributes[o.name],g=new Date(r.attributes[a.name]),k=[{networkSourceId:r.attributes[i.name],assetGroupId:r.attributes[n.name],assetTypeId:r.attributes[l.name],terminalId:r.attributes[u.name]},{networkSourceId:r.attributes[d.name],assetGroupId:r.attributes[m.name],assetTypeId:r.attributes[c.name],terminalId:r.attributes[y.name]},{networkSourceId:r.attributes[f.name],assetGroupId:r.attributes[w.name],assetTypeId:r.attributes[I.name],terminalId:r.attributes[T.name]}];let b;!function(e){e[e.from=0]="from",e[e.to=1]="to",e[e.via=2]="via"}(b||(b={}));const N={ruleType:h,creationDate:g};for(const S of[b.from,b.to,b.via]){if(h!==p.RTEdgeJunctionEdgeConnectivity&&S===b.via)continue;const e=k[S],r=t.find((t=>t.sourceId===e.networkSourceId)),s=r?.assetGroups.find((t=>t.assetGroupCode===e.assetGroupId)),o=s?.assetTypes.find((t=>t.assetTypeCode===e.assetTypeId)),a=this._getTerminal(o,e);let i="";switch(S){case b.from:i="from";break;case b.to:i="to";break;case b.via:i="via"}N[`${i}NetworkSource`]=r,N[`${i}AssetGroup`]=s,N[`${i}AssetType`]=o,N[`${i}Terminal`]=a?.toJSON()}return N}_getTerminal(e,t){const r=e?.terminalConfigurationId,s=this.terminalConfigurations?.find((e=>e.id===r));return s?.terminals?.find((e=>e.id===t.terminalId))??null}};async function w(e){const t=new y({where:"1=1",outFields:["*"]});return(await a(e,t)).features}e([r({type:[l],json:{origins:{"web-map":{read:{source:"traceConfigurations"},write:{target:"traceConfigurations"}},service:{read:{source:"traceConfigurations"}}},read:!1}})],f.prototype,"sharedNamedTraceConfigurations",void 0),e([r({type:["utility"],readOnly:!0,json:{read:!1,write:!1}})],f.prototype,"type",void 0),e([r({readOnly:!0})],f.prototype,"serviceTerritoryFeatureLayerId",null),e([r({readOnly:!0})],f.prototype,"networkSystemLayers",null),e([r({readOnly:!0})],f.prototype,"terminalConfigurations",null),e([r({readOnly:!0})],f.prototype,"domainNetworkNames",null),f=e([s("esri.networks.UtilityNetwork")],f);const I=f;export{I as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import o from"../layers/FeatureLayer.js";import{queryAllJSON as a}from"../layers/support/featureQueryAll.js";import i from"./Network.js";import n from"./RulesTable.js";import l from"./support/NamedTraceConfiguration.js";import u from"./support/NetworkSystemLayers.js";import m from"./support/TerminalConfiguration.js";import d from"./support/TraceJobInfo.js";import{RuleType as c,AssociationTypeEnum as y}from"./support/typeUtils.js";import p from"../rest/support/Query.js";let f=class extends i{constructor(e){super(e),this.sharedNamedTraceConfigurations=[],this.type="utility",this._terminalById=new Map}get serviceTerritoryFeatureLayerId(){return this.dataElement?.serviceTerritoryFeatureLayerId??null}get networkSystemLayers(){return new u({rulesTableId:this.sourceJSON?.systemLayers.rulesTableId,rulesTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.rulesTableId}`:null,subnetworksTableId:this.sourceJSON?.systemLayers.subnetworksTableId,subnetworksTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.subnetworksTableId}`:null,dirtyAreasLayerId:this.sourceJSON?.systemLayers.dirtyAreasLayerId,dirtyAreasLayerUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.dirtyAreasLayerId}`:null,associationsTableId:this.sourceJSON?.systemLayers.associationsTableId,associationsTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.associationsTableId}`:null})}get terminalConfigurations(){return this.dataElement?.terminalConfigurations.map((e=>m.fromJSON(e)))||[]}get domainNetworkNames(){return this.dataElement?.domainNetworks.map((e=>e.domainNetworkName))||[]}get _utilityLayerList(){const e=new Set;return this.dataElement?.domainNetworks?.map((t=>{t?.edgeSources?.map((({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)})),t?.junctionSources?.map((({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)}))})),e}async load(e){return this.addResolvingPromise(super.load(e)),this.addResolvingPromise(this._loadNamedTraceConfigurationsFromNetwork(e)),this}getTerminalConfiguration(e){let t=null,r=null;const s=e.layer;let o=null;if("feature"===s?.type){if(o=s.layerId,null===o)return null}else{if("subtype-sublayer"!==s?.type)return null;if(o=s?.parent?.layerId??null,null===o)return null}const a=e.attributes;if(null==a)return null;for(const l of Object.keys(a))"ASSETGROUP"===l.toUpperCase()&&(t=e.getAttribute(l)),"ASSETTYPE"===l.toUpperCase()&&(r=e.getAttribute(l));if(!this.dataElement)return null;let i=null;const n=this.dataElement.domainNetworks;for(const l of n){const e=l.junctionSources?.find((e=>e.layerId===o));if(e){const s=e.assetGroups?.find((e=>e.assetGroupCode===t));if(s){const e=s.assetTypes?.find((e=>e.assetTypeCode===r));if(e?.isTerminalConfigurationSupported){i=e.terminalConfigurationId;break}}}}if(null!=i){const e=this.dataElement.terminalConfigurations,t=e?.find((e=>e.terminalConfigurationId===i));return t?m.fromJSON(t):null}return null}getTierNames(e){const t=this.dataElement?.domainNetworks.find((t=>t.domainNetworkName===e));return t?.tiers.map((e=>e.name))||[]}async getRulesTable(){return this._sharedRulesTable||(this._sharedRulesTable=this._createRulesTable()),await this._sharedRulesTable}getTerminalById(e){if(!this.dataElement||null==e)return null;const t=this._terminalById.get(e);return null!=t?t:(this.terminalConfigurations.forEach((e=>{e.terminals.forEach((e=>{this._terminalById.set(e.id,e)}))})),this._terminalById.get(e))}isUtilityLayer(e){return"layerId"in e?this._utilityLayerList.has(e?.layerId)&&(e.url?.startsWith(this.featureServiceUrl)??!1):!("subtype-sublayer"!==e.type||!e.parent)&&(this._utilityLayerList.has(e.parent.layerId)&&(e.parent.url?.startsWith(this.featureServiceUrl)??!1))}async queryAssociations(e,t){const[{queryAssociations:r},{default:s}]=await Promise.all([import("../rest/networks/queryAssociations.js"),import("../rest/networks/support/QueryAssociationsParameters.js")]),o=s.from(e);o.gdbVersion=this.gdbVersion,o.moment=this.historicMoment;return(await r(this.networkServiceUrl,o,t)).associations}async synthesizeAssociationGeometries(e){const[{synthesizeAssociationGeometries:t},{default:r}]=await Promise.all([import("../rest/networks/synthesizeAssociationGeometries.js"),import("../rest/networks/support/SynthesizeAssociationGeometriesParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async trace(e){const[{trace:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async submitTraceJob(e){const[{submitTraceJob:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment;const o=await t(this.networkServiceUrl,s);return new d({statusUrl:o})}async canAddAssociation(e){const t=await this.getRulesTable();if(!t)return!1;await t.load();const r=(e,t)=>e?1===e.terminalId?!t?.terminalId||t?.terminalId===e.terminalId:e.terminalId===t?.terminalId:!t?.terminalId,s=e=>({fromRuleElement:{networkSource:e.fromNetworkSource,assetGroup:e.fromAssetGroup,assetType:e.fromAssetType,terminal:e.fromTerminal},viaRuleElement:e.viaNetworkSource?{networkSource:e.viaNetworkSource,assetGroup:e.viaAssetGroup,assetType:e.viaAssetType,terminal:e.viaTerminal}:void 0,toRuleElement:{networkSource:e.toNetworkSource,assetGroup:e.toAssetGroup,assetType:e.toAssetType,terminal:e.toTerminal}}),o=(e,t,s=!0)=>e.networkSource?.sourceId===t.networkSourceId&&e.assetGroup?.assetGroupCode===t.assetGroupCode&&e.assetType?.assetTypeCode===t.assetTypeCode&&(!s||r(e.terminal,t)),a=(e,t)=>{const{fromRuleElement:r,toRuleElement:a}=s(e);return o(r,t.fromNetworkElement,!1)&&o(a,t.toNetworkElement,!1)},i=(e,t)=>{const{fromRuleElement:r,toRuleElement:a}=s(e);return o(r,t.fromNetworkElement)&&o(a,t.toNetworkElement)||o(r,t.toNetworkElement)&&o(a,t.fromNetworkElement)},n=(e,t)=>{const{fromRuleElement:r,toRuleElement:a,viaRuleElement:i}=s(e);return o(r,t.fromNetworkElement)&&o(i,t.toNetworkElement)||o(r,t.toNetworkElement)&&o(i,t.fromNetworkElement)||o(i,t.fromNetworkElement)&&o(a,t.toNetworkElement)||o(i,t.toNetworkElement)&&o(a,t.fromNetworkElement)};if("containment"===e.associationType){return t.rulesCategorized.containment.some((t=>a(t,e)))}if("attachment"===e.associationType){return t.rulesCategorized.attachment.some((t=>a(t,e)))}return t.rulesCategorized.connectivity.some((t=>t.ruleType===c.RTEdgeJunctionEdgeConnectivity?n(t,e):i(t,e)))}generateAddAssociations(e){return{addFeatures:e.map((e=>new t({attributes:{fromnetworksourceid:e.fromNetworkElement?.networkSourceId,fromglobalid:e.fromNetworkElement?.globalId,fromterminalid:e.fromNetworkElement?.terminalId,tonetworksourceid:e.toNetworkElement?.networkSourceId,toglobalid:e.toNetworkElement?.globalId,toterminalid:e.toNetworkElement?.terminalId,associationtype:y[e.associationType],iscontentvisible:null==e.isContentVisible?void 0:e.isContentVisible?1:0,percentalong:e.percentAlong,globalid:e.globalId}}))),id:this.networkSystemLayers.associationsTableId,identifierFields:{globalIdField:"globalid",objectIdField:"objectid"}}}generateDeleteAssociations(e){return{deleteFeatures:e.map((e=>({globalId:e.globalId}))),id:this.networkSystemLayers.associationsTableId,identifierFields:{globalIdField:"globalid",objectIdField:"objectid"}}}async _loadNamedTraceConfigurationsFromNetwork(e){if(0===this.sharedNamedTraceConfigurations?.length)return;const t=this.sharedNamedTraceConfigurations.map((e=>e.globalId)),r=await this.queryNamedTraceConfigurations({globalIds:t},e);for(const s of this.sharedNamedTraceConfigurations){const e=r?.find((e=>e.globalId===s.globalId));if(e){const t=e.write({},{origin:"service"});s.read(t,{origin:"service"})}}}async _createRulesTable(){const e=this.networkSystemLayers.rulesTableUrl,t=new o({url:e});await t.load();const r=this.dataElement?.domainNetworks;if(!r)return null;const s=r.flatMap((e=>[...e.edgeSources||[],...e.junctionSources||[]])),a=(await h(t)).map((e=>this._hydrateRuleInfo(t,s,e)));return new n({rulesLayer:t,rules:a})}_hydrateRuleInfo(e,t,r){const s=e.fieldsIndex,o=s.get("RULETYPE"),a=s.get("CREATIONDATE"),i=s.get("FROMNETWORKSOURCEID"),n=s.get("FROMASSETGROUP"),l=s.get("FROMASSETTYPE"),u=s.get("FROMTERMINALID"),m=s.get("TONETWORKSOURCEID"),d=s.get("TOASSETGROUP"),y=s.get("TOASSETTYPE"),p=s.get("TOTERMINALID"),f=s.get("VIANETWORKSOURCEID"),h=s.get("VIAASSETGROUP"),I=s.get("VIAASSETTYPE"),w=s.get("VIATERMINALID"),T=r.attributes[o.name],g=new Date(r.attributes[a.name]),b=[{networkSourceId:r.attributes[i.name],assetGroupId:r.attributes[n.name],assetTypeId:r.attributes[l.name],terminalId:r.attributes[u.name]},{networkSourceId:r.attributes[m.name],assetGroupId:r.attributes[d.name],assetTypeId:r.attributes[y.name],terminalId:r.attributes[p.name]},{networkSourceId:r.attributes[f.name],assetGroupId:r.attributes[h.name],assetTypeId:r.attributes[I.name],terminalId:r.attributes[w.name]}];let k;!function(e){e[e.from=0]="from",e[e.to=1]="to",e[e.via=2]="via"}(k||(k={}));const S={ruleType:T,creationDate:g};for(const N of[k.from,k.to,k.via]){if(T!==c.RTEdgeJunctionEdgeConnectivity&&N===k.via)continue;const e=b[N],r=t.find((t=>t.sourceId===e.networkSourceId)),s=r?.assetGroups.find((t=>t.assetGroupCode===e.assetGroupId)),o=s?.assetTypes.find((t=>t.assetTypeCode===e.assetTypeId)),a=this._getTerminal(o,e);let i="";switch(N){case k.from:i="from";break;case k.to:i="to";break;case k.via:i="via"}S[`${i}NetworkSource`]=r,S[`${i}AssetGroup`]=s,S[`${i}AssetType`]=o,S[`${i}Terminal`]=a?.toJSON()}return S}_getTerminal(e,t){const r=e?.terminalConfigurationId,s=this.terminalConfigurations?.find((e=>e.id===r));return s?.terminals?.find((e=>e.id===t.terminalId))??null}};async function h(e){const t=new p({where:"1=1",outFields:["*"]});return(await a(e,t)).features}e([r({type:[l],json:{origins:{"web-map":{read:{source:"traceConfigurations"},write:{target:"traceConfigurations"}},service:{read:{source:"traceConfigurations"}}},read:!1}})],f.prototype,"sharedNamedTraceConfigurations",void 0),e([r({type:["utility"],readOnly:!0,json:{read:!1,write:!1}})],f.prototype,"type",void 0),e([r({readOnly:!0})],f.prototype,"serviceTerritoryFeatureLayerId",null),e([r({readOnly:!0})],f.prototype,"networkSystemLayers",null),e([r({readOnly:!0})],f.prototype,"terminalConfigurations",null),e([r({readOnly:!0})],f.prototype,"domainNetworkNames",null),f=e([s("esri.networks.UtilityNetwork")],f);const I=f;export{I as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/core",
|
|
3
|
-
"version": "4.32.0-next.
|
|
3
|
+
"version": "4.32.0-next.20250220",
|
|
4
4
|
"homepage": "https://js.arcgis.com",
|
|
5
5
|
"description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
|
|
6
6
|
"keywords": [
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@esri/arcgis-html-sanitizer": "~4.1.0",
|
|
29
|
-
"@esri/calcite-components": "^3.0.
|
|
29
|
+
"@esri/calcite-components": "^3.0.3",
|
|
30
30
|
"@vaadin/grid": "~24.6.4",
|
|
31
31
|
"@zip.js/zip.js": "~2.7.57",
|
|
32
32
|
"luxon": "~3.5.0",
|
package/portal/Portal.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../config.js";import{id as r}from"../kernel.js";import o from"../request.js";import s from"../core/Error.js";import a from"../core/JSONSupport.js";import i from"../core/Loadable.js";import{destroyMaybe as l,removeMaybe as u}from"../core/maybe.js";import{throwIfAborted as n,isAborted as p,createAbortError as h,throwIfAbortError as d}from"../core/promiseUtils.js";import{property as y}from"../core/accessorSupport/decorators/property.js";import{ensureType as c}from"../core/accessorSupport/ensureType.js";import"../core/has.js";import"../core/RandomLCG.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import v from"../geometry/Extent.js";import{getLocale as S}from"../intl/locale.js";import{ensureDefaultPortalInstance as P}from"./portalDefault.js";import g from"./PortalGroup.js";import O from"./PortalQueryParams.js";import B from"./PortalQueryResult.js";import D from"./PortalUser.js";import{isApiKeyApplicable as G}from"../support/apiKeyUtils.js";var _;let M;const Q={PortalGroup:()=>Promise.resolve({default:g}),PortalItem:()=>import("./PortalItem.js"),PortalUser:()=>Promise.resolve({default:D})};let U=_=class extends(a.JSONSupportMixin(i)){constructor(e){super(e),this._esriIdCredentialCreateHandle=null,this.access=null,this.allSSL=!1,this.authMode="auto",this.authorizedCrossOriginDomains=null,this.basemapGalleryGroupQuery=null,this.basemapGalleryGroupQuery3D=null,this.bingKey=null,this.canListApps=!1,this.canListData=!1,this.canListPreProvisionedItems=!1,this.canProvisionDirectPurchase=!1,this.canSearchPublic=!0,this.canShareBingPublic=!1,this.canSharePublic=!1,this.canSignInArcGIS=!1,this.canSignInIDP=!1,this.colorSetsGroupQuery=null,this.commentsEnabled=!1,this.created=null,this.culture=null,this.customBaseUrl=null,this.default3DBasemapQuery=null,this.defaultBasemap=null,this.defaultDevBasemap=null,this.defaultExtent=null,this.defaultVectorBasemap=null,this.description=null,this.devBasemapGalleryGroupQuery=null,this.eueiEnabled=null,this.featuredGroups=null,this.featuredItemsGroupQuery=null,this.galleryTemplatesGroupQuery=null,this.layoutGroupQuery=null,this.livingAtlasGroupQuery=null,this.hasCategorySchema=!1,this.hasClassificationSchema=!1,this.helperServices=null,this.homePageFeaturedContent=null,this.homePageFeaturedContentCount=null,this.httpPort=null,this.httpsPort=null,this.id=null,this.ipCntryCode=null,this.isPortal=!1,this.isReadOnly=!1,this.layerTemplatesGroupQuery=null,this.maxTokenExpirationMinutes=null,this.modified=null,this.name=null,this.portalHostname=null,this.portalMode=null,this.portalProperties=null,this.region=null,this.recycleBinEnabled=!1,this.rotatorPanels=null,this.showHomePageDescription=!1,this.sourceJSON=null,this.supportsHostedServices=!1,this.symbolSetsGroupQuery=null,this.templatesGroupQuery=null,this.units=null,this.url=t.portalUrl,this.urlKey=null,this.user=null,this.use3dBasemaps=!0,this.useDefault3dBasemap=!1,this.useStandardizedQuery=!1,this.useVectorBasemaps=!1,this.vectorBasemapGalleryGroupQuery=null}normalizeCtorArgs(e){return"string"==typeof e?{url:e}:e}destroy(){C.unregister(this),this.defaultBasemap=l(this.defaultBasemap),this.defaultDevBasemap=l(this.defaultDevBasemap),this.defaultVectorBasemap=l(this.defaultVectorBasemap),this._esriIdCredentialCreateHandle=u(this._esriIdCredentialCreateHandle)}readAuthorizedCrossOriginDomains(e){if(e)for(const r of e)t.request.trustedServers.includes(r)||t.request.trustedServers.push(r);return e}readDefaultBasemap(e){return this._readBasemap(e)}readDefaultDevBasemap(e){return this._readBasemap(e)}readDefaultVectorBasemap(e){return this._readBasemap(e)}get extraQuery(){const e=this.user?.orgId,t=!e||this.canSearchPublic;return this.id&&!t?` AND orgid:${this.id}`:null}get hasAPIKey(){return G(this.url)}get isOrganization(){return!!this.access}get itemPageUrl(){return this.url?`${this.url}/home/item.html`:null}get restUrl(){let e=this.url;if(e){const t=e.indexOf("/sharing");e=t>0?e.slice(0,t):this.url.replace(/\/+$/,""),e+="/sharing/rest"}return e}get thumbnailUrl(){const e=this.restUrl,t=this.thumbnail;return e&&t?this._normalizeSSL(e+"/portals/self/resources/"+t):null}readUrlKey(e){return e?e.toLowerCase():e}readUser(e){let t=null;return e&&(t=D.fromJSON(e),t.portal=this),t}load(e){const t=import("../Basemap.js").then((({default:t})=>{n(e),M=t})).then((()=>this.sourceJSON?this.sourceJSON:this.fetchSelf(this.authMode,!1,e))).then((e=>{if(!this.hasAPIKey&&r){const e=r;this.credential=e.findCredential(this.restUrl),this.credential||this.authMode!==_.AUTH_MODE_AUTO&&this.authMode!==_.AUTH_MODE_NO_PROMPT||(this._esriIdCredentialCreateHandle?.remove(),this._esriIdCredentialCreateHandle=e.on("credential-create",w(new WeakRef(this))),C.register(this,this._esriIdCredentialCreateHandle,this))}this.sourceJSON=e,this.read(e)}));return this.addResolvingPromise(t),Promise.resolve(this)}async createElevationLayers(){await this.load();const e=this._getHelperService("defaultElevationLayers"),t=(await import("../layers/ElevationLayer.js")).default;return e?e.map((e=>new t({id:e.id,url:e.url}))):[]}async fetchBasemaps(e,t){const r=await this._fetchBasemaps(e,t);if(!0===t?.include3d&&!1!==this.use3dBasemaps){const o=await this._fetchBasemaps3D(e,t);r.unshift(...o)}return r}async fetchDefault3DBasemap(e){if(!this.useDefault3dBasemap||!this.default3DBasemapQuery||"none"===this.default3DBasemapQuery)return null;const t=new O;t.query=this.default3DBasemapQuery,t.disableExtraQuery=!0;const r=(await this.queryItems(t,e)).results.find((e=>"Web Scene"===e.type));return r?new M({portalItem:r}):null}fetchCategorySchema(e){return this.hasCategorySchema?this.request(this.restUrl+"/portals/self/categorySchema",e).then((e=>e.categorySchema)):p(e)?Promise.reject(h()):Promise.resolve([])}fetchFeaturedGroups(e){const t=this.featuredGroups,r=new O({num:100,sortField:"title"});if(t?.length){const o=[];for(const e of t)o.push(`(title:"${e.title}" AND owner:${e.owner})`);return r.query=o.join(" OR "),this.queryGroups(r,e).then((e=>e.results))}return p(e)?Promise.reject(h()):Promise.resolve([])}fetchRegions(e){const t=this.user?.culture||this.culture||S();return this.request(this.restUrl+"/portals/regions",{...e,query:{culture:t}})}fetchSettings(e){const t=this.user?.culture||this.culture||S();return this.request(this.restUrl+"/portals/self/settings",{...e,query:{culture:t}})}static getDefault(){return P((()=>new _))}queryGroups(e,t){return this.queryPortal("/community/groups",e,"PortalGroup",t)}queryItems(e,t){return this.queryPortal("/search",e,"PortalItem",t)}queryUsers(e,t){return e.sortField||(e.sortField="username"),this.queryPortal("/community/users",e,"PortalUser",t)}fetchSelf(e=this.authMode,t=!1,r){const o=this.restUrl+"/portals/self",s={authMode:e,query:{culture:S().toLowerCase()},withCredentials:!0,...r};return"auto"===s.authMode&&(s.authMode="no-prompt"),t&&(s.query.default=!0),this.request(o,s)}queryPortal(e,t,r,o){const s=c(O,t),a=t=>this.request(this.restUrl+e,{...s.toRequestOptions(this),...o}).then((e=>{const r=s.clone();return r.start=e.nextStart,new B({nextQueryParams:r,queryParams:s,total:e.total,results:_._resultsToTypedArray(t,{portal:this},e,o)})})).then((e=>Promise.all(e.results.map((t=>"function"==typeof t.when?t.when():e))).then((()=>e),(t=>(d(t),e)))));return r&&Q[r]?Q[r]().then((({default:e})=>(n(o),a(e)))):a()}signIn(){if(this.hasAPIKey)return this.load().then((()=>{if(!this.user)throw new s("portal:not-authenticated","Unable to authenticate user. Portal.user is missing")}));if(this.authMode===_.AUTH_MODE_ANONYMOUS||this.authMode===_.AUTH_MODE_NO_PROMPT&&!r)return Promise.reject(new s("portal:invalid-auth-mode",`Current "authMode"' is "${this.authMode}"`));if("failed"===this.loadStatus)return Promise.reject(this.loadError);const e=e=>Promise.resolve().then((()=>"not-loaded"===this.loadStatus?(e||(this.authMode="immediate"),this.load().then((()=>null))):"loading"===this.loadStatus?this.load().then((()=>this.credential?null:(this.credential=e,this.fetchSelf("immediate")))):this.user&&this.credential===e?null:(this.credential=e,this.fetchSelf("immediate")))).then((e=>{e&&(this.sourceJSON=e,this.read(e))}));return r?r.getCredential(this.restUrl,{prompt:this.authMode!==_.AUTH_MODE_NO_PROMPT}).then((t=>e(t))):e(this.credential)}normalizeUrl(e){const t=this.credential?.token;return this._normalizeSSL(t?e+(e.includes("?")?"&":"?")+"token="+t:e)}requestToTypedArray(e,t,r){return this.request(e,t).then((e=>{const t=_._resultsToTypedArray(r,{portal:this},e);return Promise.all(t.map((t=>"function"==typeof t.when?t.when():e))).then((()=>t),(()=>t))}))}request(e,t={}){const r={f:"json",...t.query},{authMode:s=(this.authMode===_.AUTH_MODE_ANONYMOUS||this.authMode===_.AUTH_MODE_NO_PROMPT?this.authMode:"auto"),body:a=null,cacheBust:i=!1,method:l="auto",responseType:u="json",signal:n}=t,p={authMode:s,body:a,cacheBust:i,method:l,query:r,responseType:u,timeout:0,signal:n};return t.withCredentials&&(p.withCredentials=!0),o(this._normalizeSSL(e),p).then((e=>e.data))}toJSON(){throw new s("internal:not-yet-implemented","Portal.toJSON is not yet implemented")}static fromJSON(e){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");return new _({sourceJSON:e})}_getHelperService(e){const t=this.helperServices&&this.helperServices[e];if(!t)throw new s("portal:service-not-found",`The \`helperServices\` do not include an entry named "${e}"`);return t}async _fetchBasemaps(e,t){const r=new O;r.query=e||(this.hasAPIKey?this.devBasemapGalleryGroupQuery:this.useVectorBasemaps?this.vectorBasemapGalleryGroupQuery:this.basemapGalleryGroupQuery),r.disableExtraQuery=!0;const o=await this.queryGroups(r,t);if(!o.total)return[];const s=o.results[0];r.num=100,r.query='type:"Web Map" -type:"Web Application"',r.sortField=s.sortField||"name",r.sortOrder=s.sortOrder||"desc";const a=await s.queryItems(r,t);if(!a.total)return[];return a.results.filter((e=>"Web Map"===e.type)).map((e=>new M({portalItem:e})))}async _fetchBasemaps3D(e,t){const r=e||this.basemapGalleryGroupQuery3D;if(!r)return[];if(this.hasAPIKey)return[];const o=new O({query:r,disableExtraQuery:!0}),s=await this.queryGroups(o,t);if(!s.total)return[];const a=s.results[0];o.num=100,o.query='type:"Web Scene"',o.sortField=a.sortField||"name",o.sortOrder=a.sortOrder||"desc";const i=await a.queryItems(o,t);if(!i.total)return[];return i.results.filter((e=>"Web Scene"===e.type)).map((e=>new M({portalItem:e})))}_normalizeSSL(e){return e.replace(/^http:/i,"https:").replace(":7080",":7443")}_readBasemap(e){if(e){const t=M.fromJSON(e);return t.portalItem={portal:this},t}return null}static _resultsToTypedArray(e,t,r,o){let s;if(r){const a=null!=o?o.signal:null;s=r.listings||r.notifications||r.userInvitations||r.tags||r.items||r.groups||r.comments||r.provisions||r.results||r.relatedItems||r,(e||t)&&(s=s.map((r=>{const o=Object.assign(e?e.fromJSON(r):r,t);return"function"==typeof o.load&&o.load(a),o})))}else s=[];return s}};U.AUTH_MODE_ANONYMOUS="anonymous",U.AUTH_MODE_AUTO="auto",U.AUTH_MODE_IMMEDIATE="immediate",U.AUTH_MODE_NO_PROMPT="no-prompt",e([y()],U.prototype,"access",void 0),e([y()],U.prototype,"allSSL",void 0),e([y()],U.prototype,"authMode",void 0),e([y()],U.prototype,"authorizedCrossOriginDomains",void 0),e([m("authorizedCrossOriginDomains")],U.prototype,"readAuthorizedCrossOriginDomains",null),e([y()],U.prototype,"basemapGalleryGroupQuery",void 0),e([y({json:{name:"3DBasemapGalleryGroupQuery"}})],U.prototype,"basemapGalleryGroupQuery3D",void 0),e([y()],U.prototype,"bingKey",void 0),e([y()],U.prototype,"canListApps",void 0),e([y()],U.prototype,"canListData",void 0),e([y()],U.prototype,"canListPreProvisionedItems",void 0),e([y()],U.prototype,"canProvisionDirectPurchase",void 0),e([y()],U.prototype,"canSearchPublic",void 0),e([y()],U.prototype,"canShareBingPublic",void 0),e([y()],U.prototype,"canSharePublic",void 0),e([y()],U.prototype,"canSignInArcGIS",void 0),e([y()],U.prototype,"canSignInIDP",void 0),e([y()],U.prototype,"colorSetsGroupQuery",void 0),e([y()],U.prototype,"commentsEnabled",void 0),e([y({type:Date})],U.prototype,"created",void 0),e([y()],U.prototype,"credential",void 0),e([y()],U.prototype,"culture",void 0),e([y()],U.prototype,"currentVersion",void 0),e([y()],U.prototype,"customBaseUrl",void 0),e([y()],U.prototype,"default3DBasemapQuery",void 0),e([y()],U.prototype,"defaultBasemap",void 0),e([m("defaultBasemap")],U.prototype,"readDefaultBasemap",null),e([y()],U.prototype,"defaultDevBasemap",void 0),e([m("defaultDevBasemap")],U.prototype,"readDefaultDevBasemap",null),e([y({type:v})],U.prototype,"defaultExtent",void 0),e([y()],U.prototype,"defaultVectorBasemap",void 0),e([m("defaultVectorBasemap")],U.prototype,"readDefaultVectorBasemap",null),e([y()],U.prototype,"description",void 0),e([y()],U.prototype,"devBasemapGalleryGroupQuery",void 0),e([y()],U.prototype,"eueiEnabled",void 0),e([y({readOnly:!0})],U.prototype,"extraQuery",null),e([y()],U.prototype,"featuredGroups",void 0),e([y()],U.prototype,"featuredItemsGroupQuery",void 0),e([y()],U.prototype,"galleryTemplatesGroupQuery",void 0),e([y()],U.prototype,"layoutGroupQuery",void 0),e([y()],U.prototype,"livingAtlasGroupQuery",void 0),e([y({readOnly:!0})],U.prototype,"hasAPIKey",null),e([y()],U.prototype,"hasCategorySchema",void 0),e([y()],U.prototype,"hasClassificationSchema",void 0),e([y()],U.prototype,"helpBase",void 0),e([y()],U.prototype,"helperServices",void 0),e([y()],U.prototype,"helpMap",void 0),e([y()],U.prototype,"homePageFeaturedContent",void 0),e([y()],U.prototype,"homePageFeaturedContentCount",void 0),e([y()],U.prototype,"httpPort",void 0),e([y()],U.prototype,"httpsPort",void 0),e([y()],U.prototype,"id",void 0),e([y()],U.prototype,"ipCntryCode",void 0),e([y({readOnly:!0})],U.prototype,"isOrganization",null),e([y()],U.prototype,"isPortal",void 0),e([y()],U.prototype,"isReadOnly",void 0),e([y({readOnly:!0})],U.prototype,"itemPageUrl",null),e([y()],U.prototype,"layerTemplatesGroupQuery",void 0),e([y()],U.prototype,"maxTokenExpirationMinutes",void 0),e([y({type:Date})],U.prototype,"modified",void 0),e([y()],U.prototype,"name",void 0),e([y()],U.prototype,"portalHostname",void 0),e([y()],U.prototype,"portalMode",void 0),e([y()],U.prototype,"portalProperties",void 0),e([y()],U.prototype,"region",void 0),e([y()],U.prototype,"recycleBinEnabled",void 0),e([y({readOnly:!0})],U.prototype,"restUrl",null),e([y()],U.prototype,"rotatorPanels",void 0),e([y()],U.prototype,"showHomePageDescription",void 0),e([y()],U.prototype,"sourceJSON",void 0),e([y()],U.prototype,"staticImagesUrl",void 0),e([y({json:{name:"2DStylesGroupQuery"}})],U.prototype,"stylesGroupQuery2d",void 0),e([y({json:{name:"stylesGroupQuery"}})],U.prototype,"stylesGroupQuery3d",void 0),e([y()],U.prototype,"supportsHostedServices",void 0),e([y()],U.prototype,"symbolSetsGroupQuery",void 0),e([y()],U.prototype,"templatesGroupQuery",void 0),e([y()],U.prototype,"thumbnail",void 0),e([y({readOnly:!0})],U.prototype,"thumbnailUrl",null),e([y()],U.prototype,"units",void 0),e([y()],U.prototype,"url",void 0),e([y()],U.prototype,"urlKey",void 0),e([m("urlKey")],U.prototype,"readUrlKey",null),e([y()],U.prototype,"user",void 0),e([m("user")],U.prototype,"readUser",null),e([y()],U.prototype,"use3dBasemaps",void 0),e([y()],U.prototype,"useDefault3dBasemap",void 0),e([y()],U.prototype,"useStandardizedQuery",void 0),e([y()],U.prototype,"useVectorBasemaps",void 0),e([y()],U.prototype,"vectorBasemapGalleryGroupQuery",void 0),U=_=e([f("esri.portal.Portal")],U);const b=U,C=new FinalizationRegistry((e=>{e.remove()}));function w(e){const t=r;return()=>{const r=e.deref();r&&t.findCredential(r.restUrl)&&r.signIn().catch((()=>{}))}}export{b as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../config.js";import{id as r}from"../kernel.js";import o from"../request.js";import s from"../core/Error.js";import a from"../core/JSONSupport.js";import i from"../core/Loadable.js";import{destroyMaybe as l,removeMaybe as u}from"../core/maybe.js";import{throwIfAborted as n,isAborted as p,createAbortError as h,throwIfAbortError as d}from"../core/promiseUtils.js";import{property as y}from"../core/accessorSupport/decorators/property.js";import{ensureType as c}from"../core/accessorSupport/ensureType.js";import"../core/has.js";import"../core/RandomLCG.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import v from"../geometry/Extent.js";import{getLocale as S}from"../intl/locale.js";import{ensureDefaultPortalInstance as P}from"./portalDefault.js";import g from"./PortalGroup.js";import O from"./PortalQueryParams.js";import B from"./PortalQueryResult.js";import D from"./PortalUser.js";import{isApiKeyApplicable as G}from"../support/apiKeyUtils.js";var _;let M;const Q={PortalGroup:()=>Promise.resolve({default:g}),PortalItem:()=>import("./PortalItem.js"),PortalUser:()=>Promise.resolve({default:D})};let U=_=class extends(a.JSONSupportMixin(i)){constructor(e){super(e),this._esriIdCredentialCreateHandle=null,this.access=null,this.allSSL=!1,this.authMode="auto",this.authorizedCrossOriginDomains=null,this.basemapGalleryGroupQuery=null,this.basemapGalleryGroupQuery3D=null,this.bingKey=null,this.canListApps=!1,this.canListData=!1,this.canListPreProvisionedItems=!1,this.canProvisionDirectPurchase=!1,this.canSearchPublic=!0,this.canShareBingPublic=!1,this.canSharePublic=!1,this.canSignInArcGIS=!1,this.canSignInIDP=!1,this.colorSetsGroupQuery=null,this.commentsEnabled=!1,this.created=null,this.culture=null,this.customBaseUrl=null,this.default3DBasemapQuery=null,this.defaultBasemap=null,this.defaultDevBasemap=null,this.defaultExtent=null,this.defaultVectorBasemap=null,this.description=null,this.devBasemapGalleryGroupQuery=null,this.eueiEnabled=null,this.featuredGroups=null,this.featuredItemsGroupQuery=null,this.galleryTemplatesGroupQuery=null,this.layoutGroupQuery=null,this.livingAtlasGroupQuery=null,this.hasCategorySchema=!1,this.hasClassificationSchema=!1,this.helperServices=null,this.homePageFeaturedContent=null,this.homePageFeaturedContentCount=null,this.httpPort=null,this.httpsPort=null,this.id=null,this.ipCntryCode=null,this.isPortal=!1,this.isReadOnly=!1,this.layerTemplatesGroupQuery=null,this.maxTokenExpirationMinutes=null,this.modified=null,this.name=null,this.portalHostname=null,this.portalMode=null,this.portalProperties=null,this.region=null,this.recycleBinEnabled=!1,this.rotatorPanels=null,this.showHomePageDescription=!1,this.sourceJSON=null,this.supportsHostedServices=!1,this.symbolSetsGroupQuery=null,this.templatesGroupQuery=null,this.units=null,this.url=t.portalUrl,this.urlKey=null,this.user=null,this.use3dBasemaps=!0,this.useDefault3dBasemap=!1,this.useStandardizedQuery=!1,this.useVectorBasemaps=!1,this.vectorBasemapGalleryGroupQuery=null}normalizeCtorArgs(e){return"string"==typeof e?{url:e}:e}destroy(){b.unregister(this),this.defaultBasemap=l(this.defaultBasemap),this.defaultDevBasemap=l(this.defaultDevBasemap),this.defaultVectorBasemap=l(this.defaultVectorBasemap),this._esriIdCredentialCreateHandle=u(this._esriIdCredentialCreateHandle)}readAuthorizedCrossOriginDomains(e){if(e)for(const r of e)t.request.trustedServers.includes(r)||t.request.trustedServers.push(r);return e}readDefaultBasemap(e){return this._readBasemap(e)}readDefaultDevBasemap(e){return this._readBasemap(e)}readDefaultVectorBasemap(e){return this._readBasemap(e)}get extraQuery(){const e=this.user?.orgId,t=!e||this.canSearchPublic;return this.id&&!t?` AND orgid:${this.id}`:null}get hasAPIKey(){return G(this.url)}get isOrganization(){return!!this.access}get itemPageUrl(){return this.url?`${this.url}/home/item.html`:null}get restUrl(){let e=this.url;if(e){const t=e.indexOf("/sharing");e=t>0?e.slice(0,t):this.url.replace(/\/+$/,""),e+="/sharing/rest"}return e}get thumbnailUrl(){const e=this.restUrl,t=this.thumbnail;return e&&t?this._normalizeSSL(e+"/portals/self/resources/"+t):null}readUrlKey(e){return e?e.toLowerCase():e}readUser(e){let t=null;return e&&(t=D.fromJSON(e),t.portal=this),t}load(e){const t=import("../Basemap.js").then((({default:t})=>{n(e),M=t})).then((()=>this.sourceJSON?this.sourceJSON:this.fetchSelf(this.authMode,!1,e))).then((e=>{if(!this.hasAPIKey&&r){const e=r;this.credential=e.findCredential(this.restUrl),this.credential||this.authMode!==_.AUTH_MODE_AUTO&&this.authMode!==_.AUTH_MODE_NO_PROMPT||(this._esriIdCredentialCreateHandle?.remove(),this._esriIdCredentialCreateHandle=e.on("credential-create",w(new WeakRef(this))),b.register(this,this._esriIdCredentialCreateHandle,this))}this.sourceJSON=e,this.read(e)}));return this.addResolvingPromise(t),Promise.resolve(this)}async createElevationLayers(){await this.load();const e=this._getHelperService("defaultElevationLayers"),t=(await import("../layers/ElevationLayer.js")).default;return e?e.map((e=>new t({id:e.id,url:e.url}))):[]}async fetchBasemaps(e,t){const r=await this._fetchBasemaps(e,t);if(!0===t?.include3d&&!1!==this.use3dBasemaps){const o=await this._fetchBasemaps3D(e,t);r.unshift(...o)}return r}async fetchDefault3DBasemap(e){if(!this.useDefault3dBasemap||!this.default3DBasemapQuery||"none"===this.default3DBasemapQuery)return null;const t=new O;t.query=this.default3DBasemapQuery,t.disableExtraQuery=!0;const r=(await this.queryItems(t,e)).results.find((e=>"Web Scene"===e.type));return r?new M({portalItem:r}):null}fetchCategorySchema(e){return this.hasCategorySchema?this.request(this.restUrl+"/portals/self/categorySchema",e).then((e=>e.categorySchema)):p(e)?Promise.reject(h()):Promise.resolve([])}async fetchClassificationSchema(e){return this.hasClassificationSchema?this.request(this.restUrl+"/portals/self/classification/classificationSchema",e).then((e=>e.classificationSchema)):null}fetchFeaturedGroups(e){const t=this.featuredGroups,r=new O({num:100,sortField:"title"});if(t?.length){const o=[];for(const e of t)o.push(`(title:"${e.title}" AND owner:${e.owner})`);return r.query=o.join(" OR "),this.queryGroups(r,e).then((e=>e.results))}return p(e)?Promise.reject(h()):Promise.resolve([])}fetchRegions(e){const t=this.user?.culture||this.culture||S();return this.request(this.restUrl+"/portals/regions",{...e,query:{culture:t}})}fetchSettings(e){const t=this.user?.culture||this.culture||S();return this.request(this.restUrl+"/portals/self/settings",{...e,query:{culture:t}})}static getDefault(){return P((()=>new _))}queryGroups(e,t){return this.queryPortal("/community/groups",e,"PortalGroup",t)}queryItems(e,t){return this.queryPortal("/search",e,"PortalItem",t)}queryUsers(e,t){return e.sortField||(e.sortField="username"),this.queryPortal("/community/users",e,"PortalUser",t)}fetchSelf(e=this.authMode,t=!1,r){const o=this.restUrl+"/portals/self",s={authMode:e,query:{culture:S().toLowerCase()},withCredentials:!0,...r};return"auto"===s.authMode&&(s.authMode="no-prompt"),t&&(s.query.default=!0),this.request(o,s)}queryPortal(e,t,r,o){const s=c(O,t),a=t=>this.request(this.restUrl+e,{...s.toRequestOptions(this),...o}).then((e=>{const r=s.clone();return r.start=e.nextStart,new B({nextQueryParams:r,queryParams:s,total:e.total,results:_._resultsToTypedArray(t,{portal:this},e,o)})})).then((e=>Promise.all(e.results.map((t=>"function"==typeof t.when?t.when():e))).then((()=>e),(t=>(d(t),e)))));return r&&Q[r]?Q[r]().then((({default:e})=>(n(o),a(e)))):a()}signIn(){if(this.hasAPIKey)return this.load().then((()=>{if(!this.user)throw new s("portal:not-authenticated","Unable to authenticate user. Portal.user is missing")}));if(this.authMode===_.AUTH_MODE_ANONYMOUS||this.authMode===_.AUTH_MODE_NO_PROMPT&&!r)return Promise.reject(new s("portal:invalid-auth-mode",`Current "authMode"' is "${this.authMode}"`));if("failed"===this.loadStatus)return Promise.reject(this.loadError);const e=e=>Promise.resolve().then((()=>"not-loaded"===this.loadStatus?(e||(this.authMode="immediate"),this.load().then((()=>null))):"loading"===this.loadStatus?this.load().then((()=>this.credential?null:(this.credential=e,this.fetchSelf("immediate")))):this.user&&this.credential===e?null:(this.credential=e,this.fetchSelf("immediate")))).then((e=>{e&&(this.sourceJSON=e,this.read(e))}));return r?r.getCredential(this.restUrl,{prompt:this.authMode!==_.AUTH_MODE_NO_PROMPT}).then((t=>e(t))):e(this.credential)}normalizeUrl(e){const t=this.credential?.token;return this._normalizeSSL(t?e+(e.includes("?")?"&":"?")+"token="+t:e)}requestToTypedArray(e,t,r){return this.request(e,t).then((e=>{const t=_._resultsToTypedArray(r,{portal:this},e);return Promise.all(t.map((t=>"function"==typeof t.when?t.when():e))).then((()=>t),(()=>t))}))}request(e,t={}){const r={f:"json",...t.query},{authMode:s=(this.authMode===_.AUTH_MODE_ANONYMOUS||this.authMode===_.AUTH_MODE_NO_PROMPT?this.authMode:"auto"),body:a=null,cacheBust:i=!1,method:l="auto",responseType:u="json",signal:n}=t,p={authMode:s,body:a,cacheBust:i,method:l,query:r,responseType:u,timeout:0,signal:n};return t.withCredentials&&(p.withCredentials=!0),o(this._normalizeSSL(e),p).then((e=>e.data))}toJSON(){throw new s("internal:not-yet-implemented","Portal.toJSON is not yet implemented")}static fromJSON(e){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");return new _({sourceJSON:e})}_getHelperService(e){const t=this.helperServices&&this.helperServices[e];if(!t)throw new s("portal:service-not-found",`The \`helperServices\` do not include an entry named "${e}"`);return t}async _fetchBasemaps(e,t){const r=new O;r.query=e||(this.hasAPIKey?this.devBasemapGalleryGroupQuery:this.useVectorBasemaps?this.vectorBasemapGalleryGroupQuery:this.basemapGalleryGroupQuery),r.disableExtraQuery=!0;const o=await this.queryGroups(r,t);if(!o.total)return[];const s=o.results[0];r.num=100,r.query='type:"Web Map" -type:"Web Application"',r.sortField=s.sortField||"name",r.sortOrder=s.sortOrder||"desc";const a=await s.queryItems(r,t);if(!a.total)return[];return a.results.filter((e=>"Web Map"===e.type)).map((e=>new M({portalItem:e})))}async _fetchBasemaps3D(e,t){const r=e||this.basemapGalleryGroupQuery3D;if(!r)return[];if(this.hasAPIKey)return[];const o=new O({query:r,disableExtraQuery:!0}),s=await this.queryGroups(o,t);if(!s.total)return[];const a=s.results[0];o.num=100,o.query='type:"Web Scene"',o.sortField=a.sortField||"name",o.sortOrder=a.sortOrder||"desc";const i=await a.queryItems(o,t);if(!i.total)return[];return i.results.filter((e=>"Web Scene"===e.type)).map((e=>new M({portalItem:e})))}_normalizeSSL(e){return e.replace(/^http:/i,"https:").replace(":7080",":7443")}_readBasemap(e){if(e){const t=M.fromJSON(e);return t.portalItem={portal:this},t}return null}static _resultsToTypedArray(e,t,r,o){let s;if(r){const a=null!=o?o.signal:null;s=r.listings||r.notifications||r.userInvitations||r.tags||r.items||r.groups||r.comments||r.provisions||r.results||r.relatedItems||r,(e||t)&&(s=s.map((r=>{const o=Object.assign(e?e.fromJSON(r):r,t);return"function"==typeof o.load&&o.load(a),o})))}else s=[];return s}};U.AUTH_MODE_ANONYMOUS="anonymous",U.AUTH_MODE_AUTO="auto",U.AUTH_MODE_IMMEDIATE="immediate",U.AUTH_MODE_NO_PROMPT="no-prompt",e([y()],U.prototype,"access",void 0),e([y()],U.prototype,"allSSL",void 0),e([y()],U.prototype,"authMode",void 0),e([y()],U.prototype,"authorizedCrossOriginDomains",void 0),e([m("authorizedCrossOriginDomains")],U.prototype,"readAuthorizedCrossOriginDomains",null),e([y()],U.prototype,"basemapGalleryGroupQuery",void 0),e([y({json:{name:"3DBasemapGalleryGroupQuery"}})],U.prototype,"basemapGalleryGroupQuery3D",void 0),e([y()],U.prototype,"bingKey",void 0),e([y()],U.prototype,"canListApps",void 0),e([y()],U.prototype,"canListData",void 0),e([y()],U.prototype,"canListPreProvisionedItems",void 0),e([y()],U.prototype,"canProvisionDirectPurchase",void 0),e([y()],U.prototype,"canSearchPublic",void 0),e([y()],U.prototype,"canShareBingPublic",void 0),e([y()],U.prototype,"canSharePublic",void 0),e([y()],U.prototype,"canSignInArcGIS",void 0),e([y()],U.prototype,"canSignInIDP",void 0),e([y()],U.prototype,"colorSetsGroupQuery",void 0),e([y()],U.prototype,"commentsEnabled",void 0),e([y({type:Date})],U.prototype,"created",void 0),e([y()],U.prototype,"credential",void 0),e([y()],U.prototype,"culture",void 0),e([y()],U.prototype,"currentVersion",void 0),e([y()],U.prototype,"customBaseUrl",void 0),e([y()],U.prototype,"default3DBasemapQuery",void 0),e([y()],U.prototype,"defaultBasemap",void 0),e([m("defaultBasemap")],U.prototype,"readDefaultBasemap",null),e([y()],U.prototype,"defaultDevBasemap",void 0),e([m("defaultDevBasemap")],U.prototype,"readDefaultDevBasemap",null),e([y({type:v})],U.prototype,"defaultExtent",void 0),e([y()],U.prototype,"defaultVectorBasemap",void 0),e([m("defaultVectorBasemap")],U.prototype,"readDefaultVectorBasemap",null),e([y()],U.prototype,"description",void 0),e([y()],U.prototype,"devBasemapGalleryGroupQuery",void 0),e([y()],U.prototype,"eueiEnabled",void 0),e([y({readOnly:!0})],U.prototype,"extraQuery",null),e([y()],U.prototype,"featuredGroups",void 0),e([y()],U.prototype,"featuredItemsGroupQuery",void 0),e([y()],U.prototype,"galleryTemplatesGroupQuery",void 0),e([y()],U.prototype,"layoutGroupQuery",void 0),e([y()],U.prototype,"livingAtlasGroupQuery",void 0),e([y({readOnly:!0})],U.prototype,"hasAPIKey",null),e([y()],U.prototype,"hasCategorySchema",void 0),e([y()],U.prototype,"hasClassificationSchema",void 0),e([y()],U.prototype,"helpBase",void 0),e([y()],U.prototype,"helperServices",void 0),e([y()],U.prototype,"helpMap",void 0),e([y()],U.prototype,"homePageFeaturedContent",void 0),e([y()],U.prototype,"homePageFeaturedContentCount",void 0),e([y()],U.prototype,"httpPort",void 0),e([y()],U.prototype,"httpsPort",void 0),e([y()],U.prototype,"id",void 0),e([y()],U.prototype,"ipCntryCode",void 0),e([y({readOnly:!0})],U.prototype,"isOrganization",null),e([y()],U.prototype,"isPortal",void 0),e([y()],U.prototype,"isReadOnly",void 0),e([y({readOnly:!0})],U.prototype,"itemPageUrl",null),e([y()],U.prototype,"layerTemplatesGroupQuery",void 0),e([y()],U.prototype,"maxTokenExpirationMinutes",void 0),e([y({type:Date})],U.prototype,"modified",void 0),e([y()],U.prototype,"name",void 0),e([y()],U.prototype,"portalHostname",void 0),e([y()],U.prototype,"portalMode",void 0),e([y()],U.prototype,"portalProperties",void 0),e([y()],U.prototype,"region",void 0),e([y()],U.prototype,"recycleBinEnabled",void 0),e([y({readOnly:!0})],U.prototype,"restUrl",null),e([y()],U.prototype,"rotatorPanels",void 0),e([y()],U.prototype,"showHomePageDescription",void 0),e([y()],U.prototype,"sourceJSON",void 0),e([y()],U.prototype,"staticImagesUrl",void 0),e([y({json:{name:"2DStylesGroupQuery"}})],U.prototype,"stylesGroupQuery2d",void 0),e([y({json:{name:"stylesGroupQuery"}})],U.prototype,"stylesGroupQuery3d",void 0),e([y()],U.prototype,"supportsHostedServices",void 0),e([y()],U.prototype,"symbolSetsGroupQuery",void 0),e([y()],U.prototype,"templatesGroupQuery",void 0),e([y()],U.prototype,"thumbnail",void 0),e([y({readOnly:!0})],U.prototype,"thumbnailUrl",null),e([y()],U.prototype,"units",void 0),e([y()],U.prototype,"url",void 0),e([y()],U.prototype,"urlKey",void 0),e([m("urlKey")],U.prototype,"readUrlKey",null),e([y()],U.prototype,"user",void 0),e([m("user")],U.prototype,"readUser",null),e([y()],U.prototype,"use3dBasemaps",void 0),e([y()],U.prototype,"useDefault3dBasemap",void 0),e([y()],U.prototype,"useStandardizedQuery",void 0),e([y()],U.prototype,"useVectorBasemaps",void 0),e([y()],U.prototype,"vectorBasemapGalleryGroupQuery",void 0),U=_=e([f("esri.portal.Portal")],U);const C=U,b=new FinalizationRegistry((e=>{e.remove()}));function w(e){const t=r;return()=>{const r=e.deref();r&&t.findCredential(r.restUrl)&&r.signIn().catch((()=>{}))}}export{C as default};
|
package/rest/route.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../request.js";import{get as r}from"../core/accessorSupport/get.js";import{normalizeCentralMeridian as t}from"../geometry/support/normalizeUtils.js";import{collectGeometries as s,isInputGeometryZAware as o,fetchServiceDescription as a,dropZValuesOffInputGeometry as
|
|
5
|
+
import e from"../request.js";import{get as r}from"../core/accessorSupport/get.js";import{normalizeCentralMeridian as t}from"../geometry/support/normalizeUtils.js";import{collectGeometries as s,isInputGeometryZAware as o,fetchServiceDescription as a,dropZValuesOffInputGeometry as u}from"./networkService.js";import{parseUrl as i}from"./utils.js";import{routeParametersToQueryParameters as n}from"./route/utils.js";import c from"./support/FeatureSet.js";import f from"./support/RouteSolveResult.js";function p(e){return e instanceof c}async function l(c,f,l){const y=[],d=[],h={},g={},R=i(c),{path:v}=R;p(f.stops)&&s(f.stops.features,d,"stops.features",h),p(f.pointBarriers)&&s(f.pointBarriers.features,d,"pointBarriers.features",h),p(f.polylineBarriers)&&s(f.polylineBarriers.features,d,"polylineBarriers.features",h),p(f.polygonBarriers)&&s(f.polygonBarriers.features,d,"polygonBarriers.features",h);const B=await t(d);for(const e in h){const r=h[e];y.push(e),g[e]=B.slice(r[0],r[1])}if(o(g,y)){let e=null;try{e=await a(v,f.apiKey,l)}catch{}e&&!e.hasZ&&u(g,y)}for(const e in g)g[e].forEach(((t,s)=>{r(f,e)[s].geometry=t}));const E={...l,query:{...R.query,...n(f),f:"json"}},T=v.endsWith("/solve")?v:`${v}/solve`,{data:b}=await e(T,E);return m(b)}function m(e){const{barriers:r,checksum:t,directionLines:s,directionPoints:o,directions:a,messages:u,polygonBarriers:i,polylineBarriers:n,routes:c,stops:p,traversedEdges:l,traversedJunctions:m,traversedTurns:y}=e,d=e=>{const r=g.find((r=>r.routeName===e));if(null!=r)return r;const t={routeId:g.length+1,routeName:e};return g.push(t),t},h=e=>{const r=g.find((r=>r.routeId===e));if(null!=r)return r;const t={routeId:e,routeName:null};return g.push(t),t},g=[];c?.features.forEach(((e,r)=>{e.geometry.spatialReference=c.spatialReference??void 0;const t=e.attributes.Name,s=r+1;g.push({routeId:s,routeName:t,route:e})})),a?.forEach((e=>{const{routeName:r}=e;d(r).directions=e}));const R=(p?.features.every((e=>null==e.attributes.RouteName))??!1)&&g.length>0?g[0].routeName:null;return p?.features.forEach((e=>{e.geometry&&(e.geometry.spatialReference??=p.spatialReference??void 0);const r=R??e.attributes.RouteName,t=d(r);t.stops??=[],t.stops.push(e)})),s?.features.forEach((e=>{const r=e.attributes.RouteID,t=h(r),{geometryType:o,spatialReference:a}=s;t.directionLines??={features:[],geometryType:o,spatialReference:a},t.directionLines.features.push(e)})),o?.features.forEach((e=>{const r=e.attributes.RouteID,t=h(r),{geometryType:s,spatialReference:a}=o;t.directionPoints??={features:[],geometryType:s,spatialReference:a},t.directionPoints.features.push(e)})),l?.features.forEach((e=>{const r=e.attributes.RouteID,t=h(r),{geometryType:s,spatialReference:o}=l;t.traversedEdges??={features:[],geometryType:s,spatialReference:o},t.traversedEdges.features.push(e)})),m?.features.forEach((e=>{const r=e.attributes.RouteID,t=h(r),{geometryType:s,spatialReference:o}=m;t.traversedJunctions??={features:[],geometryType:s,spatialReference:o},t.traversedJunctions.features.push(e)})),y?.features.forEach((e=>{const r=e.attributes.RouteID,t=h(r);t.traversedTurns??={features:[]},t.traversedTurns.features.push(e)})),f.fromJSON({barriers:r,checksum:t,messages:u,polygonBarriers:i,polylineBarriers:n,routeResults:g})}export{l as solve};
|