@arcgis/core 4.33.0-next.20250219 → 4.33.0-next.20250221
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/featureSetUtils.js +1 -1
- package/arcade/functions/featuresetbase.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/333bb93a28209c997d8b.js +314 -0
- package/assets/esri/core/workers/chunks/469c50c49447f0d602c0.js +1 -0
- package/assets/esri/core/workers/chunks/486df1e042204b90b0dd.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/4f764b952c6463fc7c88.js +1 -0
- 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/5b56b271afb0fadf48b4.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/63d8d507f073a8ed42d2.js +1 -0
- package/assets/esri/core/workers/chunks/6518954889df2e781c47.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/68322a63ec92d33701ea.js +1 -0
- package/assets/esri/core/workers/chunks/70574e0e3de729187d98.js +1 -0
- package/assets/esri/core/workers/chunks/78c066e8fe167d4ab817.js +1 -0
- package/assets/esri/core/workers/chunks/875a200f215e472d147e.js +1 -0
- package/assets/esri/core/workers/chunks/{f976233ad5e5b718ba83.js → 8d1f49927738ad3601d2.js} +1 -1
- package/assets/esri/core/workers/chunks/9050dad7e4f093568026.js +1 -0
- package/assets/esri/core/workers/chunks/930544d3b2c1d9c035c7.js +1 -0
- package/assets/esri/core/workers/chunks/{962cad03be1b7aa52ebe.js → 95835a62712fe4f24205.js} +1 -1
- package/assets/esri/core/workers/chunks/{030384851fa745908a6e.js → 9dbdb88cdac993104740.js} +2 -2
- package/assets/esri/core/workers/chunks/aacebda644be06ad1a61.js +1 -0
- package/assets/esri/core/workers/chunks/b0952b81d5be214262dd.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/b7c6d0ff4c085c8d0596.js +1 -0
- package/assets/esri/core/workers/chunks/e0cd4815149d1ff4d31e.js +1 -0
- package/assets/esri/core/workers/chunks/e2df18662cc4d6e47715.js +1 -0
- package/assets/esri/core/workers/chunks/{0a82c13828ffd4780419.js → f51fc2370fb486233499.js} +1 -1
- package/assets/esri/core/workers/chunks/fcbe65256a71b34ac9cf.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_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_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/ColorMaterial.glsl.js +1 -1
- package/chunks/DefaultMaterial.glsl.js +1 -1
- package/chunks/ImageMaterial.glsl.js +3 -3
- package/chunks/LineMarker.glsl.js +11 -11
- package/chunks/NativeLine.glsl.js +1 -1
- package/chunks/Path.glsl.js +11 -11
- package/chunks/Pattern.glsl.js +2 -2
- package/chunks/RealisticTree.glsl.js +1 -1
- package/chunks/RibbonLine.glsl.js +1 -1
- package/chunks/Terrain.glsl.js +1 -1
- package/chunks/WaterSurface.glsl.js +9 -9
- package/copyright.txt +20 -0
- package/editing/sharedTemplates/SharedTemplate.js +1 -1
- package/editing/sharedTemplates/SharedTemplateMetadata.js +1 -1
- package/editing/sharedTemplates/SharedTemplateProvider.js +1 -1
- package/editing/sharedTemplates/executor/support/createServiceEdit.js +1 -1
- package/editing/sharedTemplates/support/sharedTemplateErrors.js +1 -1
- package/editing/sharedTemplates/templateDefinitions/FeatureTemplateDefinition.js +1 -1
- package/editing/sharedTemplates/templateDefinitions/GroupTemplateDefinition.js +1 -1
- package/editing/sharedTemplates/templateDefinitions/PresetTemplateDefinition.js +1 -1
- package/editing/sharedTemplates/templateDefinitions/TemplateDefinitionBase.js +1 -1
- package/editing/sharedTemplates/templateDefinitions/parts/FeatureTemplateRelationshipPart.js +1 -1
- package/editing/sharedTemplates/templateDefinitions/parts/GroupTemplatePart.js +1 -1
- package/editing/sharedTemplates/templateDefinitions/parts/TemplatePartBase.js +1 -1
- package/interfaces.d.ts +427 -93
- package/layers/ImageryLayer.js +1 -1
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/RouteLayer.js +1 -1
- package/layers/WCSLayer.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/mixins/ImageryTileMixin.js +1 -1
- package/layers/mixins/RasterJobHandlerMixin.js +5 -0
- package/layers/orientedImagery/transformations/utils.js +1 -1
- package/layers/orientedImagery/transformations/worldToImage.js +1 -1
- package/layers/support/Relationship.js +1 -1
- package/layers/support/rasterFunctionUtils.d.ts +11 -0
- package/networks/UtilityNetwork.js +1 -1
- package/package.json +2 -2
- package/rest/route.js +1 -1
- package/rest/support/RouteParameters.js +1 -1
- package/rest/support/RouteSolveResult.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMEffects.js +1 -1
- package/symbols/cim/effects/EffectAddControlPoints.js +1 -1
- package/symbols/cim/effects/EffectBuffer.js +1 -1
- package/symbols/cim/effects/EffectDonut.js +1 -1
- package/symbols/cim/effects/EffectOffset.js +1 -1
- package/undoredo/support/Services.js +1 -1
- package/views/2d/AnimationManager.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/markers/MarkerMeshWriter.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/2d/layers/imagery/VectorFieldTileView2D.js +1 -1
- package/views/2d/layers/imagery/VectorFieldView2D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
- package/views/3d/layers/graphics/pipeline/Tile.js +1 -1
- package/views/3d/layers/graphics/pipeline/Tile3DManager.js +1 -1
- package/views/3d/layers/graphics/pipeline/featureData/FeatureData.js +1 -1
- package/views/3d/layers/graphics/pipeline/featureData/FeatureDataSubset.js +5 -0
- package/views/3d/layers/graphics/pipeline/featureData/processingUtils.js +1 -1
- package/views/3d/layers/graphics/pipeline/featureSet/PBFPointFeatureSetView.js +1 -1
- package/views/3d/layers/graphics/pipeline/featureSet/TiledFeatureStore.js +1 -1
- package/views/3d/layers/graphics/pipeline/fetching/Tile3DFetcher.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/TestObjectSymbol.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/TestSymbol.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/UniqueValueFeatureRenderer.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticComponentBVH.js +1 -1
- package/views/3d/webgl-engine/collections/Component/IndexRange/ComponentRange.js +5 -0
- package/views/3d/webgl-engine/lib/ComponentUtils.js +1 -1
- package/views/View.js +1 -1
- package/views/animation/easing.js +1 -1
- package/views/webgl/ShaderBuilder.js +1 -1
- package/webmap/utils.js +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Directions/DirectionsViewModel.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/components/Prompt.js +1 -1
- package/widgets/Editor/workflowUtils.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/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/Legend/styles/support/utils.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
- package/widgets/OrientedImageryViewer/symbols.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/FilterCondition.js +1 -1
- package/widgets/support/GoTo.js +1 -1
- package/widgets/support/UtilityNetworkAssociations/utilityNetworkUtils.js +1 -1
- package/widgets/support/goToUtils.js +1 -1
- package/assets/esri/core/workers/chunks/0c85731e9bf3eaeb96a2.js +0 -1
- package/assets/esri/core/workers/chunks/1b36d4400ab841c978c8.js +0 -1
- package/assets/esri/core/workers/chunks/3c44b4bf7fe407ec1d70.js +0 -1
- package/assets/esri/core/workers/chunks/4e3e141b3fd8bb652798.js +0 -1
- package/assets/esri/core/workers/chunks/544ad8fa4777ba8ec177.js +0 -1
- package/assets/esri/core/workers/chunks/717d7e9912d948e44d8d.js +0 -1
- package/assets/esri/core/workers/chunks/7bf9ebff90bb02bec8e7.js +0 -1
- package/assets/esri/core/workers/chunks/905cf2bb280479cd4f80.js +0 -1
- package/assets/esri/core/workers/chunks/b8fae500c69ca2cff62a.js +0 -1
- package/assets/esri/core/workers/chunks/b90b7ffc1e9363ed18e0.js +0 -1
- package/assets/esri/core/workers/chunks/bdc9dec6a359d2e3705c.js +0 -1
- package/assets/esri/core/workers/chunks/bf127fe767174e2715b5.js +0 -1
- package/assets/esri/core/workers/chunks/ccee343fb8c415b59ce3.js +0 -2
- package/assets/esri/core/workers/chunks/dc68246df91af766593a.js +0 -1
- package/assets/esri/core/workers/chunks/e862f1b9ecafc6c92b86.js +0 -314
- package/assets/esri/core/workers/chunks/f06231c14c0c0e5525bd.js +0 -1
- package/views/3d/layers/graphics/pipeline/featureData/FeatureDataStore.js +0 -5
- package/views/3d/webgl-engine/collections/Component/IndexRange/ComponentRangeRunLengthEncoded.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/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{property as s}from"../../core/accessorSupport/decorators/property.js";import{Integer as n,ensureClass as o}from"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{enumeration as a}from"../../core/accessorSupport/decorators/enumeration.js";import{reader as l}from"../../core/accessorSupport/decorators/reader.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import u from"../../geometry/Point.js";import m from"../../geometry/SpatialReference.js";import{getInfo as d}from"../../geometry/support/spatialReferenceUtils.js";import{sanitizeUrl as p}from"../support/arcgisLayerUrl.js";import{url as h}from"../support/commonProperties.js";import f from"../support/DimensionalDefinition.js";import y from"../support/MultidimensionalSubset.js";import{interpolationKebab as b}from"../support/rasterEnums.js";import g from"../support/RasterFunction.js";import R from"../support/RasterJobHandler.js";import I from"../support/TileInfo.js";import{isFunctionRaster as S}from"../support/rasterDatasets/datasetUtils.js";import _ from"../support/rasterDatasets/FunctionRaster.js";import{getEffectiveMultidimensionalDefinition as w,getDefaultVariableInfo as F,isMultiSliceOrRangeDefinition as v,convertOleDateTimeToEpoch as x,getSubsetVariablesFromMdInfo as J,getDefaultMultidimensionalDefinition as j}from"../support/rasterDatasets/multidimensionalUtils.js";import{snapToRaster as D,clip as H}from"../support/rasterFunctions/clipUtils.js";import{create as N}from"../support/rasterFunctions/rasterFunctionHelper.js";import{load as T,projectExtent as O,projectPolygon as P}from"../support/rasterFunctions/rasterProjectionHelper.js";import{computeStatisticsHistograms as z}from"../support/rasterFunctions/stretchUtils.js";import{convertVectorFieldData as C}from"../support/rasterFunctions/vectorFieldUtils.js";import{normalizeRendererJSON as E,getVariableRasterInfo as U,getDefaultInterpolation as M,matchPresetRenderer as L,getDefaultBandCombination as k,getFunctionColorRamp as q,createDefaultRenderer as A}from"../../renderers/support/rasterRendererHelper.js";import V from"../../renderers/support/RasterSymbolizer.js";import{rasterRendererTypes as B,websceneRasterRendererTypes as $,read as G}from"../../renderers/support/rasterTypeUtils.js";import W from"../../rest/support/ImageHistogramParameters.js";import K from"../../rest/support/ImageSample.js";import Q from"../../rest/support/ImageSampleParameters.js";import X from"../../rest/support/ImageSampleResult.js";import{createFlowMesh as Y}from"../../views/2d/engine/flow/dataUtils.js";const Z=1e3,ee=ee=>{let te=class extends ee{constructor(...e){super(...e),this._isConstructedFromFunctionRaster=!1,this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this.bandIds=null,this.copyright=null,this.interpolation=null,this.multidimensionalSubset=null,this.raster=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.spatialReference=null,this.symbolizer=null,this._isConstructedFromFunctionRaster=S(e[0]?.raster)}get fullExtent(){return this.serviceRasterInfo?.extent}set multidimensionalDefinition(e){this._set("multidimensionalDefinition",e),this.updateRenderer()}set rasterFunction(e){"none"===e?.functionName?.toLowerCase()&&(e=void 0),this._set("rasterFunction",e),this.updateRasterFunction()}set url(e){this._set("url",p(e,i.getLogger(this)))}get renderer(){if("imagery-tile"!==this.type)return this.internalRenderer;const{activePresetRendererName:e,presetRenderers:t}=this;if(e){const r=t?.find((({name:t})=>t===e));return r?.renderer.clone()}return this.internalRenderer}set renderer(e){"imagery-tile"===this.type&&(this.activePresetRendererName=null),this.internalRenderer=e}set internalRenderer(e){null==e&&null==this.rasterFunction?this._configDefaultRenderer("override"):(this._set("internalRenderer",e),this.updateRenderer())}readRenderer(e,t,r){const i=t?.layerDefinition?.drawingInfo?.renderer;return G(i,r)||void 0}async convertVectorFieldData(e,t){const{serviceRasterInfo:r}=this;if(null==e||!r)return null;const i=this._rasterJobHandler.instance,s=r.dataType;return i?i.convertVectorFieldData({pixelBlock:e,dataType:s},t):C(e,s)}async computeStatisticsHistograms(e,t){await this.load(t),e=o(W,e).clone();const{serviceRasterInfo:i}=this;if(null==i)throw new r("imagery-tile-mixin:compute-statistics-histograms","serviceRasterInfo must be specified");const{geometry:s}=e;if(null==s)throw new r("imagery-tile-mixin:compute-statistics-histograms","geometry must be specified");let n=s;const{spatialReference:a}=i;s.spatialReference.equals(a)||(await T(),n="extent"===s.type?O(s,a):P(s,a));const l=e.pixelSize??new u({x:i.pixelSize.x,y:i.pixelSize.y,spatialReference:a}),{extent:c,width:m,height:d}=D(i,n,l),p=await this.fetchPixels(c,m,d,{...t,interpolation:"nearest"});if(null==p.pixelBlock)throw new r("imagery-tile-mixin:compute-statistics-histograms","failed to fetch pixels");const h=await H(p.pixelBlock,c,n),f=this._rasterJobHandler.instance;return f?f.computeStatisticsHistograms({pixelBlock:h},t):z(h)}async createFlowMesh(e,t){const r=this._rasterJobHandler.instance;return r?r.createFlowMesh(e,t):Y(e.meshType,e.simulationSettings,e.flowData,null!=t.signal?t.signal:(new AbortController).signal)}normalizeRasterFetchOptions(e){const{multidimensionalInfo:t}=this.serviceRasterInfo??{};if(null==t)return e;const r=w({rasterInfo:this.raster.rasterInfo,multidimensionalDefinition:e.multidimensionalDefinition||this.multidimensionalDefinition,timeExtent:e.timeExtent??this.timeExtent,multidimensionalSubset:this.multidimensionalSubset});return{...e,multidimensionalDefinition:r}}async updateRasterFunction(){return this.loaded&&"imagery-tile"===this.type&&(this.rasterFunction||this._cachedRasterFunctionJson)&&JSON.stringify(this.rasterFunction)!==JSON.stringify(this._cachedRasterFunctionJson)?(this._cachedRasterFunctionJson=this.rasterFunction?.toJSON(),this._rasterFunctionUpdatePromise=this._updateRasterFunction(),this._rasterFunctionUpdatePromise):this._rasterFunctionUpdatePromise}async updateRenderer(){const{loaded:e,symbolizer:t}=this;if(!e||!t||!this.renderer)return;const{rasterInfo:r}=this.raster,i=F(r,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),s=i?.name,n=E({...this.renderer.toJSON(),variableName:s});if(JSON.stringify(this._cachedRendererJson)===JSON.stringify(n))return;const o=this._rasterJobHandler.instance;o&&(t.rasterInfo=U(r,s),t.rendererJSON=n,t.bind(),await o.updateSymbolizer(t),this._cachedRendererJson=n)}async applyRenderer(e,t){const r=e?.pixelBlock;if(!(null!=r&&r.pixels&&r.pixels.length>0))return null;let i;await this.updateRenderer();const s=this._rasterJobHandler.instance,n=this.bandIds??[];return i=s?await s.symbolize({...e,simpleStretchParams:t,bandIds:n}):this.symbolizer.symbolize({...e,simpleStretchParams:t,bandIds:n}),i}getTileUrl(e,t,r){return"RasterTileServer"===this.raster.datasetFormat?`${this.url}/tile/${e}/${t}/${r}`:""}getCompatibleTileInfo(e,t,r=!1){if(!this.loaded||null==t)return null;if(r&&e.equals(this.spatialReference))return this.tileInfo;const i=d(e);return I.create({size:256,spatialReference:e,origin:i?{x:i.origin[0],y:i.origin[1]}:{x:t.xmin,y:t.ymax}})}getCompatibleFullExtent(e){return this.loaded?(this._compatibleFullExtent?.spatialReference.equals(e)||(this._compatibleFullExtent=this.raster.computeExtent(e)),this._compatibleFullExtent):null}async fetchTile(e,r,i,s={}){if(re(this),s.requestAsImageElement){const n=this.getTileUrl(e,r,i);return t(n,{responseType:"image",query:{...this.refreshParameters,...this.raster.ioConfig.customFetchParameters},signal:s.signal}).then((e=>e.data))}const{serviceRasterInfo:n}=this;if(null!=n.multidimensionalInfo&&null==(s=this.normalizeRasterFetchOptions(s)).multidimensionalDefinition){const t=s.tileInfo||n.storageInfo.tileInfo;return{extent:this.raster.getTileExtentFromTileInfo(e,r,i,t),pixelBlock:null}}return await this._initJobHandler(),await this.updateRasterFunction(),"raster-shaded-relief"===this.renderer?.type&&(s={...s,buffer:{cols:1,rows:1}}),this.raster.fetchTile(e,r,i,s)}async fetchPixels(e,t,r,i={}){return null!=this.serviceRasterInfo.multidimensionalInfo&&null==(i=this.normalizeRasterFetchOptions(i)).multidimensionalDefinition?{extent:e,pixelBlock:null}:(await this._initJobHandler(),await this.updateRasterFunction(),t=Math.round(t),r=Math.round(r),this.raster.fetchPixels(e,t,r,i))}async getSamples(e,t){if(await this.load(),(e=o(Q,e).clone()).interpolation&&"nearest"!==e.interpolation)throw new r("imagery-tile-mixin:get-samples","only nearest interpolation is currently supported");const i=e.mosaicRule?.multidimensionalDefinition,s={...t,multidimensionalDefinition:i},n=(await this._getSampleLocations(e)).map((e=>this.identify(e,s).then((t=>(t.location=e,t))))),a=(await Promise.all(n)).flatMap(((e,t)=>this._convertRasterIdentifyResultToSample(e,t)));return new X({samples:a})}async identify(e,t={}){await this.load();const{raster:i,serviceRasterInfo:s}=this;if(null!=s?.multidimensionalInfo){if(!(s.hasMultidimensionalTranspose&&!!(v(t.multidimensionalDefinition)||t.transposedVariableName||t.timeExtent))&&null==(t=this.normalizeRasterFetchOptions(t)).multidimensionalDefinition)return{location:e,value:null}}const n=this.multidimensionalSubset?.areaOfInterest;if(n&&!n.contains(e))throw new r("imagery-tile-mixin:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");return i.identify(e,t)}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}hasStandardTime(){const e=this.serviceRasterInfo?.multidimensionalInfo;if(null==e||"standard-time"!==this.serviceRasterInfo?.dataType)return!1;const t=this.multidimensionalDefinition,r=t?.[0]?.variableName;return e.variables.some((e=>e.name===r&&(!t?.[0].dimensionName||e.dimensions.some((e=>"StdTime"===e.name)))))}getStandardTimeValue(e){return new Date(x(e)).toISOString()}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo?.multidimensionalInfo;return J(this.multidimensionalSubset,t)}_configDefaultSettings(){this._configDefaultInterpolation(),this.multidimensionalDefinition||(this.multidimensionalDefinition=j(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset})),this.rasterFunction&&S(this.raster)&&(this._cachedRasterFunctionJson=this.rasterFunction.toJSON()),this._configDefaultRenderer()}_initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new R;return this._rasterJobHandler.connectionPromise=e.initialize().then((async()=>{re(this),this._rasterJobHandler.instance=e;const{raster:t}=this;t.rasterJobHandler=e,S(t)&&t.syncJobHandler(),this.rasterFunction&&await this.updateRasterFunction().catch((()=>{})),this.renderer&&this.updateRenderer()})).catch((()=>{})),this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null,this.raster&&(this.raster.rasterJobHandler=null)}async _getSampleLocations(e){const{geometry:t}=e;if("point"===t.type)return[t];const{spatialReference:r,type:i}=t;if("multipoint"===i)return t.points.map((e=>new u({x:e[0],y:e[1],spatialReference:r})));if("polyline"===i){let i=t;if(e.sampleCount||e.sampleDistance){const r=await import("../../geometry/operators/densifyOperator.js"),s=(await import("../../geometry/operators/lengthOperator.js")).execute(t,{unit:"meters"}),n=Math.min(e.sampleCount||100,Z);let o=e.sampleDistance;if(!o){o=s/(n+(2===i.paths[0].length?1:0))}i=r.execute(t,o,{unit:"meters"})}return i.paths.flatMap((e=>e.map((e=>new u({x:e[0],y:e[1],spatialReference:r})))))}const s=Math.min(e.sampleCount||100,Z),n="extent"===t.type,o=n?t:t.extent,a=Math.sqrt(o.width*o.height/s),l=o.height/a,c=o.width/a,{xmin:m,ymax:d}=o,p=[];for(let h=0;h<l;h++)for(let e=0;e<c;e++){const i=new u({x:m+(e+.5)*a,y:d-(h+.5)*a,spatialReference:r});(n||t.contains(i))&&p.push(i)}return p}_configDefaultInterpolation(){if(null==this.interpolation){re(this);const{raster:e}=this,t=M(e.rasterInfo,e.tileType,this.sourceJSON?.defaultResamplingMethod);this._set("interpolation",t)}}_configDefaultRenderer(e="no"){re(this);const{rasterInfo:t}=this.raster,r=F(t,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),s=r?.name,n=L({variableName:s,rasterFunctionName:this.rasterFunction?.functionName,presetRenderers:this.presetRenderers});if(!this.bandIds&&t.bandCount>1&&(this.bandIds=n?.bandIds??k(t)),!this.renderer||"override"===e){const e=q(this.raster),r=n?.renderer??A(t,{bandIds:this.bandIds,variableName:s,rasterFunctionColorRamp:e}),i=t.statistics,o=i&&i.length>0?i[0]:null,a=o?.max??0,l=o?.min??0;"WCSServer"===this.raster.datasetFormat&&"raster-stretch"===r.type&&(a>1e24||l<-1e24)&&(r.dynamicRangeAdjustment=!0,r.customStatistics=null,"none"===r.stretchType&&(r.stretchType="min-max")),this.renderer=r}const o=E({...this.renderer.toJSON(),variableName:s}),a=U(t,s);this.symbolizer?(this.symbolizer.rendererJSON=o,this.symbolizer.rasterInfo=a):this.symbolizer=new V({rendererJSON:o,rasterInfo:a});const l=this.symbolizer.bind();if(l.success){if("auto"===e){const{colormap:e}=this.raster.rasterInfo,t=this.renderer;if(null!=e&&"raster-colormap"===t.type){const e=A(this.raster.rasterInfo);JSON.stringify(e)!==JSON.stringify(t)&&this._configDefaultRenderer("override")}else if("raster-stretch"===t.type){const e=this.bandIds?.length,r=t.customStatistics?.length;!t.dynamicRangeAdjustment&&r&&e&&r!==e&&this._configDefaultRenderer("override")}}}else i.getLogger(this).warn("imagery-tile-mixin",l.error||"The given renderer is not supported by the layer."),"auto"===e&&this._configDefaultRenderer("override")}async _updateRasterFunction(){if(this._isConstructedFromFunctionRaster&&S(this.raster)){const e=this.raster.rasterFunction.toJSON();return void(!this.rasterFunction&&e&&this._set("rasterFunction",g.fromJSON(e)))}let e,t=this.raster,r=!1;S(t)?(e=t.primaryRasters.rasters,t=e[0],r=!0):e=[t];const{rasterFunction:i}=this;if(i){const r={raster:t};e.length>1&&e.forEach((e=>r[e.url]=e));const s=N(i.functionDefinition?.toJSON()??i.toJSON(),r),n=new _({rasterFunction:s});n.rasterJobHandler=this._rasterJobHandler.instance,await n.open(),this.raster=n}else this.raster=t,await t.open();if(this._cachedRendererJson=null,!r&&!i)return;const{bandIds:s}=this,{bandCount:n}=this.raster.rasterInfo,o=s?.length?s.some((e=>e>=n)):n>=3;s&&(o||this.renderer&&"raster-stretch"!==this.renderer.type)&&this._set("bandIds",null),this._configDefaultRenderer("auto")}_convertRasterIdentifyResultToSample(e,t){const{rasterInfo:r}=this.raster,i=r.storageInfo.pyramidScalingFactor**(e.pyramidLevel??0),s=(r.pixelSize.x+r.pixelSize.y)/2*i;if(!e.dataSeries?.length)return[new K({location:e.location,pixelValue:e.value,locationId:t,resolution:s})];const n=[];return e.dataSeries.forEach((({value:r,multidimensionalDefinition:i},o)=>{const a={Variables:i[0].variableName,Dimensions:i.flatMap((({dimensionName:e})=>e)).join(",")};for(const{dimensionName:e,values:t}of i){a[e]=Array.isArray(t[0])?t[0][0]:t[0];const r=t[t.length-1];a[`${e}_Max`]=Array.isArray(r)?r[r.length-1]:r}const l=new K({location:e.location,pixelValue:r,rasterId:o,locationId:t,resolution:s,attributes:a});n.push(l)})),n}};function re(e){if(!e.raster||!e.serviceRasterInfo)throw new r("imagery-tile","no raster")}return e([s({clonable:!1})],te.prototype,"_cachedRendererJson",void 0),e([s({clonable:!1})],te.prototype,"_cachedRasterFunctionJson",void 0),e([s({clonable:!1})],te.prototype,"_compatibleFullExtent",void 0),e([s({clonable:!1})],te.prototype,"_isConstructedFromFunctionRaster",void 0),e([s({clonable:!1})],te.prototype,"_rasterJobHandler",void 0),e([s({clonable:!1})],te.prototype,"_rasterFunctionUpdatePromise",void 0),e([s({type:[n],json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"0,1,2"!==this.bandIds?.join(",")}}}}})],te.prototype,"bandIds",void 0),e([s({json:{origins:{service:{read:{source:"copyrightText"}}}}})],te.prototype,"copyright",void 0),e([s({json:{read:!1}})],te.prototype,"fullExtent",null),e([s({json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"bilinear"!==this.interpolation}}}}}),a(b)],te.prototype,"interpolation",void 0),e([s()],te.prototype,"ioConfig",void 0),e([s({type:[f],json:{write:!0}})],te.prototype,"multidimensionalDefinition",null),e([s({type:y,json:{write:!0}})],te.prototype,"multidimensionalSubset",void 0),e([s()],te.prototype,"raster",void 0),e([s({type:g})],te.prototype,"rasterFunction",null),e([s()],te.prototype,"serviceRasterInfo",void 0),e([s()],te.prototype,"sourceJSON",void 0),e([s({readOnly:!0,type:m,json:{read:!1}})],te.prototype,"spatialReference",void 0),e([s({type:I})],te.prototype,"tileInfo",void 0),e([s(h)],te.prototype,"url",null),e([s()],te.prototype,"renderer",null),e([s({types:B,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy(){const e="raster-stretch"===this.renderer?.type&&"none"===this.renderer.stretchType&&!this.renderer.useGamma;return{enabled:!this.loaded||"Raster"===this.raster.tileType||!e}}},origins:{"web-scene":{types:$,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],te.prototype,"internalRenderer",null),e([l("internalRenderer")],te.prototype,"readRenderer",null),e([s({clonable:!1})],te.prototype,"symbolizer",void 0),te=e([c("esri.layers.mixins.ImageryTileMixin")],te),te};export{ee as ImageryTileMixin};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../request.js";import i from"../../core/Error.js";import r from"../../core/Logger.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import{Integer as n,ensureClass as o}from"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{enumeration as a}from"../../core/accessorSupport/decorators/enumeration.js";import{reader as l}from"../../core/accessorSupport/decorators/reader.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import m from"../../geometry/Point.js";import p from"../../geometry/SpatialReference.js";import{getInfo as c}from"../../geometry/support/spatialReferenceUtils.js";import{sanitizeUrl as d}from"../support/arcgisLayerUrl.js";import{url as h}from"../support/commonProperties.js";import f from"../support/DimensionalDefinition.js";import y from"../support/MultidimensionalSubset.js";import{interpolationKebab as g}from"../support/rasterEnums.js";import R from"../support/RasterFunction.js";import b from"../support/TileInfo.js";import{isFunctionRaster as I}from"../support/rasterDatasets/datasetUtils.js";import x from"../support/rasterDatasets/FunctionRaster.js";import{getEffectiveMultidimensionalDefinition as S,getDefaultVariableInfo as F,isMultiSliceOrRangeDefinition as v,convertOleDateTimeToEpoch as w,getSubsetVariablesFromMdInfo as _,getDefaultMultidimensionalDefinition as j}from"../support/rasterDatasets/multidimensionalUtils.js";import{snapToRaster as D,clip as J}from"../support/rasterFunctions/clipUtils.js";import{create as N}from"../support/rasterFunctions/rasterFunctionHelper.js";import{load as T,projectExtent as O,projectPolygon as z}from"../support/rasterFunctions/rasterProjectionHelper.js";import{computeStatisticsHistograms as P}from"../support/rasterFunctions/stretchUtils.js";import{getVariableRasterInfo as H,getDefaultInterpolation as E,matchPresetRenderer as C,getDefaultBandCombination as M,getFunctionColorRamp as U,createDefaultRenderer as L,normalizeRendererJSON as k}from"../../renderers/support/rasterRendererHelper.js";import q from"../../renderers/support/RasterSymbolizer.js";import{rasterRendererTypes as A,websceneRasterRendererTypes as B,read as V}from"../../renderers/support/rasterTypeUtils.js";import $ from"../../rest/support/ImageHistogramParameters.js";import G from"../../rest/support/ImageSample.js";import W from"../../rest/support/ImageSampleParameters.js";import K from"../../rest/support/ImageSampleResult.js";const Q=1e3,X=X=>{let Y=class extends X{constructor(...e){super(...e),this._isConstructedFromFunctionRaster=!1,this.bandIds=null,this.copyright=null,this.interpolation=null,this.multidimensionalSubset=null,this.raster=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.spatialReference=null,this.symbolizer=null,this._isConstructedFromFunctionRaster=I(e[0]?.raster)}get fullExtent(){return this.serviceRasterInfo?.extent}set multidimensionalDefinition(e){this._set("multidimensionalDefinition",e),this.updateRenderer()}set rasterFunction(e){"none"===e?.functionName?.toLowerCase()&&(e=void 0),this._set("rasterFunction",e),this.updateRasterFunction()}set url(e){this._set("url",d(e,r.getLogger(this)))}get renderer(){if("imagery-tile"!==this.type)return this.internalRenderer;const{activePresetRendererName:e,presetRenderers:t}=this;if(e){const i=t?.find((({name:t})=>t===e));return i?.renderer.clone()}return this.internalRenderer}set renderer(e){"imagery-tile"===this.type&&(this.activePresetRendererName=null),this.internalRenderer=e}set internalRenderer(e){null==e&&null==this.rasterFunction?this._configDefaultRenderer("override"):(this._set("internalRenderer",e),this.updateRenderer())}readRenderer(e,t,i){const r=t?.layerDefinition?.drawingInfo?.renderer;return V(r,i)||void 0}async computeStatisticsHistograms(e,t){await this.load(t),e=o($,e).clone();const{serviceRasterInfo:r}=this;if(null==r)throw new i("imagery-tile-mixin:compute-statistics-histograms","serviceRasterInfo must be specified");const{geometry:s}=e;if(null==s)throw new i("imagery-tile-mixin:compute-statistics-histograms","geometry must be specified");let n=s;const{spatialReference:a}=r;s.spatialReference.equals(a)||(await T(),n="extent"===s.type?O(s,a):z(s,a));const l=e.pixelSize??new m({x:r.pixelSize.x,y:r.pixelSize.y,spatialReference:a}),{extent:u,width:p,height:c}=D(r,n,l),d=await this.fetchPixels(u,p,c,{...t,interpolation:"nearest"});if(null==d.pixelBlock)throw new i("imagery-tile-mixin:compute-statistics-histograms","failed to fetch pixels");const h=await J(d.pixelBlock,u,n),f=this._rasterJobHandler;return f?f.computeStatisticsHistograms({pixelBlock:h},t):P(h)}normalizeRasterFetchOptions(e){const{multidimensionalInfo:t}=this.serviceRasterInfo??{};if(null==t)return e;const i=S({rasterInfo:this.raster.rasterInfo,multidimensionalDefinition:e.multidimensionalDefinition||this.multidimensionalDefinition,timeExtent:e.timeExtent??this.timeExtent,multidimensionalSubset:this.multidimensionalSubset});return{...e,multidimensionalDefinition:i}}async updateRasterFunction(){return this.loaded&&"imagery-tile"===this.type&&(this.rasterFunction||this._cachedRasterFunctionJson)&&JSON.stringify(this.rasterFunction)!==JSON.stringify(this._cachedRasterFunctionJson)?(this._cachedRasterFunctionJson=this.rasterFunction?.toJSON(),this._rasterFunctionUpdatePromise=this._updateRasterFunction(),this._rasterFunctionUpdatePromise):this._rasterFunctionUpdatePromise}async updateRenderer(){const{loaded:e,symbolizer:t,renderer:i}=this;if(!e||!t||!i)return;const{rasterInfo:r}=this.raster,s=F(r,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),n=s?.name,o=H(r,n);return this._updateSymbolizer(t,i,n,o)}async applyRenderer(e,t,i){const r=e?.pixelBlock;if(!(null!=r&&r.pixels&&r.pixels.length>0))return null;await this.updateRenderer();const s=this.bandIds??[],{pixelBlock:n}=await this._symbolize({pixelData:e,simpleStretchParams:t,bandIds:s,symbolizer:this.symbolizer},i);return n}getTileUrl(e,t,i){return"RasterTileServer"===this.raster.datasetFormat?`${this.url}/tile/${e}/${t}/${i}`:""}getCompatibleTileInfo(e,t,i=!1){if(!this.loaded||null==t)return null;if(i&&e.equals(this.spatialReference))return this.tileInfo;const r=c(e);return b.create({size:256,spatialReference:e,origin:r?{x:r.origin[0],y:r.origin[1]}:{x:t.xmin,y:t.ymax}})}getCompatibleFullExtent(e){return this.loaded?(this._compatibleFullExtent?.spatialReference.equals(e)||(this._compatibleFullExtent=this.raster.computeExtent(e)),this._compatibleFullExtent):null}async fetchTile(e,i,r,s={}){if(Z(this),s.requestAsImageElement){const n=this.getTileUrl(e,i,r);return t(n,{responseType:"image",query:{...this.refreshParameters,...this.raster.ioConfig.customFetchParameters},signal:s.signal}).then((e=>e.data))}const{serviceRasterInfo:n}=this;if(null!=n.multidimensionalInfo&&null==(s=this.normalizeRasterFetchOptions(s)).multidimensionalDefinition){const t=s.tileInfo||n.storageInfo.tileInfo;return{extent:this.raster.getTileExtentFromTileInfo(e,i,r,t),pixelBlock:null}}return await this._initJobHandler(),await this.updateRasterFunction(),"raster-shaded-relief"===this.renderer?.type&&(s={...s,buffer:{cols:1,rows:1}}),this.raster.fetchTile(e,i,r,s)}async fetchPixels(e,t,i,r={}){return null!=this.serviceRasterInfo.multidimensionalInfo&&null==(r=this.normalizeRasterFetchOptions(r)).multidimensionalDefinition?{extent:e,pixelBlock:null}:(await this._initJobHandler(),await this.updateRasterFunction(),t=Math.round(t),i=Math.round(i),this.raster.fetchPixels(e,t,i,r))}async getSamples(e,t){if(await this.load(),(e=o(W,e).clone()).interpolation&&"nearest"!==e.interpolation)throw new i("imagery-tile-mixin:get-samples","only nearest interpolation is currently supported");const r=e.mosaicRule?.multidimensionalDefinition,s={...t,multidimensionalDefinition:r},n=(await this._getSampleLocations(e)).map((e=>this.identify(e,s).then((t=>(t.location=e,t))))),a=(await Promise.all(n)).flatMap(((e,t)=>this._convertRasterIdentifyResultToSample(e,t)));return new K({samples:a})}async identify(e,t={}){await this.load();const{raster:r,serviceRasterInfo:s}=this;if(null!=s?.multidimensionalInfo){if(!(s.hasMultidimensionalTranspose&&!!(v(t.multidimensionalDefinition)||t.transposedVariableName||t.timeExtent))&&null==(t=this.normalizeRasterFetchOptions(t)).multidimensionalDefinition)return{location:e,value:null}}const n=this.multidimensionalSubset?.areaOfInterest;if(n&&!n.contains(e))throw new i("imagery-tile-mixin:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");return r.identify(e,t)}hasStandardTime(){const e=this.serviceRasterInfo?.multidimensionalInfo;if(null==e||"standard-time"!==this.serviceRasterInfo?.dataType)return!1;const t=this.multidimensionalDefinition,i=t?.[0]?.variableName;return e.variables.some((e=>e.name===i&&(!t?.[0].dimensionName||e.dimensions.some((e=>"StdTime"===e.name)))))}getStandardTimeValue(e){return new Date(w(e)).toISOString()}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo?.multidimensionalInfo;return _(this.multidimensionalSubset,t)}_configDefaultSettings(){this._configDefaultInterpolation(),this.multidimensionalDefinition||(this.multidimensionalDefinition=j(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset})),this.rasterFunction&&I(this.raster)&&(this._cachedRasterFunctionJson=this.rasterFunction.toJSON()),this._configDefaultRenderer()}async _initJobHandler(){if(!this._rasterJobHandler)return super._initJobHandler().then((async()=>{if(!this._rasterJobHandler)return;Z(this);const{raster:e}=this;e.rasterJobHandler=this._rasterJobHandler,I(e)&&e.syncJobHandler(),this.rasterFunction&&await this.updateRasterFunction().catch((()=>{})),this.renderer&&this.updateRenderer()})).catch((()=>{}))}_shutdownJobHandler(){super._shutdownJobHandler(),this.raster&&(this.raster.rasterJobHandler=null)}async _getSampleLocations(e){const{geometry:t}=e;if("point"===t.type)return[t];const{spatialReference:i,type:r}=t;if("multipoint"===r)return t.points.map((e=>new m({x:e[0],y:e[1],spatialReference:i})));if("polyline"===r){let r=t;if(e.sampleCount||e.sampleDistance){const i=await import("../../geometry/operators/densifyOperator.js"),s=(await import("../../geometry/operators/lengthOperator.js")).execute(t,{unit:"meters"}),n=Math.min(e.sampleCount||100,Q);let o=e.sampleDistance;if(!o){o=s/(n+(2===r.paths[0].length?1:0))}r=i.execute(t,o,{unit:"meters"})}return r.paths.flatMap((e=>e.map((e=>new m({x:e[0],y:e[1],spatialReference:i})))))}const s=Math.min(e.sampleCount||100,Q),n="extent"===t.type,o=n?t:t.extent,a=Math.sqrt(o.width*o.height/s),l=o.height/a,u=o.width/a,{xmin:p,ymax:c}=o,d=[];for(let h=0;h<l;h++)for(let e=0;e<u;e++){const r=new m({x:p+(e+.5)*a,y:c-(h+.5)*a,spatialReference:i});(n||t.contains(r))&&d.push(r)}return d}_configDefaultInterpolation(){if(null==this.interpolation){Z(this);const{raster:e}=this,t=E(e.rasterInfo,e.tileType,this.sourceJSON?.defaultResamplingMethod);this._set("interpolation",t)}}_configDefaultRenderer(e="no"){Z(this);const{rasterInfo:t}=this.raster,i=F(t,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),s=i?.name,n=C({variableName:s,rasterFunctionName:this.rasterFunction?.functionName,presetRenderers:this.presetRenderers});if(!this.bandIds&&t.bandCount>1&&(this.bandIds=n?.bandIds??M(t)),!this.renderer||"override"===e){const e=U(this.raster),i=n?.renderer??L(t,{bandIds:this.bandIds,variableName:s,rasterFunctionColorRamp:e}),r=t.statistics,o=r&&r.length>0?r[0]:null,a=o?.max??0,l=o?.min??0;"WCSServer"===this.raster.datasetFormat&&"raster-stretch"===i.type&&(a>1e24||l<-1e24)&&(i.dynamicRangeAdjustment=!0,i.customStatistics=null,"none"===i.stretchType&&(i.stretchType="min-max")),this.renderer=i}const o=k({...this.renderer.toJSON(),variableName:s}),a=H(t,s);this.symbolizer?(this.symbolizer.rendererJSON=o,this.symbolizer.rasterInfo=a):this.symbolizer=new q({rendererJSON:o,rasterInfo:a});const l=this.symbolizer.bind();if(l.success){if("auto"===e){const{colormap:e}=this.raster.rasterInfo,t=this.renderer;if(null!=e&&"raster-colormap"===t.type){const e=L(this.raster.rasterInfo);JSON.stringify(e)!==JSON.stringify(t)&&this._configDefaultRenderer("override")}else if("raster-stretch"===t.type){const e=this.bandIds?.length,i=t.customStatistics?.length;!t.dynamicRangeAdjustment&&i&&e&&i!==e&&this._configDefaultRenderer("override")}}}else r.getLogger(this).warn("imagery-tile-mixin",l.error||"The given renderer is not supported by the layer."),"auto"===e&&this._configDefaultRenderer("override")}async _updateRasterFunction(){if(this._isConstructedFromFunctionRaster&&I(this.raster)){const e=this.raster.rasterFunction.toJSON();return void(!this.rasterFunction&&e&&this._set("rasterFunction",R.fromJSON(e)))}let e,t=this.raster,i=!1;I(t)?(e=t.primaryRasters.rasters,t=e[0],i=!0):e=[t];const{rasterFunction:r}=this;if(r){const i={raster:t};e.length>1&&e.forEach((e=>i[e.url]=e));const s=N(r.functionDefinition?.toJSON()??r.toJSON(),i),n=new x({rasterFunction:s});n.rasterJobHandler=this._rasterJobHandler,await n.open(),this.raster=n}else this.raster=t,await t.open();if(this._cachedRendererJson=void 0,!i&&!r)return;const{bandIds:s}=this,{bandCount:n}=this.raster.rasterInfo,o=s?.length?s.some((e=>e>=n)):n>=3;s&&(o||this.renderer&&"raster-stretch"!==this.renderer.type)&&this._set("bandIds",null),this._configDefaultRenderer("auto")}_convertRasterIdentifyResultToSample(e,t){const{rasterInfo:i}=this.raster,r=i.storageInfo.pyramidScalingFactor**(e.pyramidLevel??0),s=(i.pixelSize.x+i.pixelSize.y)/2*r;if(!e.dataSeries?.length)return[new G({location:e.location,pixelValue:e.value,locationId:t,resolution:s})];const n=[];return e.dataSeries.forEach((({value:i,multidimensionalDefinition:r},o)=>{const a={Variables:r[0].variableName,Dimensions:r.flatMap((({dimensionName:e})=>e)).join(",")};for(const{dimensionName:e,values:t}of r){a[e]=Array.isArray(t[0])?t[0][0]:t[0];const i=t[t.length-1];a[`${e}_Max`]=Array.isArray(i)?i[i.length-1]:i}const l=new G({location:e.location,pixelValue:i,rasterId:o,locationId:t,resolution:s,attributes:a});n.push(l)})),n}};function Z(e){if(!e.raster||!e.serviceRasterInfo)throw new i("imagery-tile","no raster")}return e([s({clonable:!1})],Y.prototype,"_cachedRasterFunctionJson",void 0),e([s({clonable:!1})],Y.prototype,"_compatibleFullExtent",void 0),e([s({clonable:!1})],Y.prototype,"_isConstructedFromFunctionRaster",void 0),e([s({clonable:!1})],Y.prototype,"_rasterFunctionUpdatePromise",void 0),e([s({type:[n],json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"0,1,2"!==this.bandIds?.join(",")}}}}})],Y.prototype,"bandIds",void 0),e([s({json:{origins:{service:{read:{source:"copyrightText"}}}}})],Y.prototype,"copyright",void 0),e([s({json:{read:!1}})],Y.prototype,"fullExtent",null),e([s({json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"bilinear"!==this.interpolation}}}}}),a(g)],Y.prototype,"interpolation",void 0),e([s()],Y.prototype,"ioConfig",void 0),e([s({type:[f],json:{write:!0}})],Y.prototype,"multidimensionalDefinition",null),e([s({type:y,json:{write:!0}})],Y.prototype,"multidimensionalSubset",void 0),e([s()],Y.prototype,"raster",void 0),e([s({type:R})],Y.prototype,"rasterFunction",null),e([s()],Y.prototype,"serviceRasterInfo",void 0),e([s()],Y.prototype,"sourceJSON",void 0),e([s({readOnly:!0,type:p,json:{read:!1}})],Y.prototype,"spatialReference",void 0),e([s({type:b})],Y.prototype,"tileInfo",void 0),e([s(h)],Y.prototype,"url",null),e([s()],Y.prototype,"renderer",null),e([s({types:A,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy(){const e="raster-stretch"===this.renderer?.type&&"none"===this.renderer.stretchType&&!this.renderer.useGamma;return{enabled:!this.loaded||"Raster"===this.raster.tileType||!e}}},origins:{"web-scene":{types:B,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],Y.prototype,"internalRenderer",null),e([l("internalRenderer")],Y.prototype,"readRenderer",null),e([s({clonable:!1})],Y.prototype,"symbolizer",void 0),Y=e([u("esri.layers.mixins.ImageryTileMixin")],Y),Y};export{X as ImageryTileMixin};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.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 t}from"../../core/accessorSupport/decorators/subclass.js";import n from"../support/RasterJobHandler.js";import{convertVectorFieldData as o}from"../support/rasterFunctions/vectorFieldUtils.js";import{normalizeRendererJSON as s}from"../../renderers/support/rasterRendererHelper.js";import{createFlowMesh as a}from"../../views/2d/engine/flow/dataUtils.js";const i=i=>{let l=class extends i{constructor(){super(...arguments),this._rasterJobHandlerConfig={instance:null,refCount:0,connectionPromise:null}}get _rasterJobHandler(){return this._rasterJobHandlerConfig.instance}increaseRasterJobHandlerUsage(){this._rasterJobHandlerConfig.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandlerConfig.refCount--,this._rasterJobHandlerConfig.refCount<=0&&this._shutdownJobHandler()}async convertVectorFieldData(e,r,t){if(null==e)return null;const n=this._rasterJobHandler;return n?n.convertVectorFieldData({pixelBlock:e,dataType:r},t):o(e,r)}async createFlowMesh(e,r){const t=this._rasterJobHandler;return t?t.createFlowMesh(e,r):a(e.meshType,e.simulationSettings,e.flowData,null!=r.signal?r.signal:(new AbortController).signal)}_initJobHandler(){const{_rasterJobHandlerConfig:e}=this;if(e.connectionPromise)return e.connectionPromise;const r=new n;return e.connectionPromise=r.initialize().then((()=>{e.instance=r,this.notifyChange("_rasterJobHandler")}),(()=>{})),e.connectionPromise}_shutdownJobHandler(){const{_rasterJobHandlerConfig:e}=this;e.instance?.destroy(),e.instance=null,e.connectionPromise=null,e.refCount=0,this.notifyChange("_rasterJobHandler"),this._cachedRendererJson=void 0}async _updateSymbolizer(e,r,t,n){const o=this._rasterJobHandlerConfig.instance;if(!o)return;const a=s({...r.toJSON(),variableName:t});JSON.stringify(this._cachedRendererJson)!==JSON.stringify(a)&&(n&&(e.rasterInfo=n),e.rendererJSON=a,e.bind(),await o.updateSymbolizer(e),this._cachedRendererJson=r.toJSON())}async _symbolize(e,r){const{pixelData:t,bandIds:n,simpleStretchParams:o}=e,s=this._rasterJobHandler;if(s){const e=await s.symbolize({...t,simpleStretchParams:o,bandIds:n},r);return{extent:t.extent,pixelBlock:e}}const a=e.symbolizer.symbolize({...t,simpleStretchParams:o,bandIds:n});return{extent:t.extent,pixelBlock:a}}};return e([r({clonable:!1})],l.prototype,"_rasterJobHandler",null),e([r({clonable:!1})],l.prototype,"_cachedRendererJson",void 0),e([r({clonable:!1})],l.prototype,"_rasterJobHandlerConfig",void 0),l=e([t("esri.layers.mixins.RasterJobHandlerMixin")],l),l};export{i as RasterJobHandlerMixin};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../../core/Error.js";import n from"../../../core/JSONSupport.js";import{deg2rad as a,rad2deg as i}from"../../../core/mathUtils.js";import{create as e}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as o,fromValues as r}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromArray as c}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{zeros as s}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{multiply as l,transpose as f}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{invertOrIdentity as h,mul as u}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{a as m,g as p}from"../../../chunks/vec32.js";import M from"../../../geometry/Point.js";import{projectWithZConversion as g}from"../../../geometry/projection.js";import{earth as v}from"../../../geometry/support/Ellipsoid.js";import{isWebMercator as d}from"../../../geometry/support/spatialReferenceUtils.js";import{a as x}from"../../../chunks/vec3.js";import{isElevationSource as w,isConstantElevation as y,ConstantElevation as O}from"../core/ElevationSourceDefinitions.js";import{getElevationSampler as b}from"./updateElevationUtils.js";import{isNumber as j}from"../../../support/guards.js";import{defaultImageSphereSize as E}from"../../../widgets/PanoramicViewer/constants.js";function S(t,n,a){const[i,e,r,c]=n,[s,l,f,m]=a;z(i,e,r,c);const p=z(s,l,f,m),M=V(i,e,r,c),g=V(s,l,f,m),v=h(o(),M),d=u(o(),v,g),[x,w,y,O]=P(t,d);return[x/O,w/O,p?0:y/O]}function z(t,n,a,i){return 0===t[2]&&0===n[2]&&0===a[2]&&0===i[2]&&(t[2]=n[2]=a[2]=i[2]=1,!0)}function F(t){return 0===t?1:t}function P(t,n){const[a,i,e]=t,o=[0,0,0,0];return o[0]=a*n[0]+i*n[1]+e*n[2]+n[3],o[1]=a*n[4]+i*n[5]+e*n[6]+n[7],o[2]=a*n[8]+i*n[9]+e*n[10]+n[11],o[3]=F(a*n[12]+i*n[13]+e*n[14]+n[15]),o}function V(t,n,a,i){const e=D(c([...i,1]),h(new Array(16),r(t[0],n[0],a[0],0,t[1],n[1],a[1],0,t[2],n[2],a[2],0,1,1,1,1))),s=e[0],l=e[1],f=e[2],u=o();return u[0]=s*t[0],u[1]=l*n[0],u[2]=f*a[0],u[3]=0,u[4]=s*t[1],u[5]=l*n[1],u[6]=f*a[1],u[7]=0,u[8]=s*t[2],u[9]=l*n[2],u[10]=f*a[2],u[11]=0,u[12]=s,u[13]=l,u[14]=f,u[15]=1,u}function C(t,n,a,i,e=s()){return e[0]=t[0]+n[0]*a,e[1]=t[1]+n[1]*a,e[2]=t[2]+n[2]*(a/i),e}function R(t,n,a){const i=s();return i[0]=t[0]*n,i[1]=t[1]*n,i[2]=t[2]*(n/a),i}function L(t,n){const[a,i,e]=t,o=s();return o[0]=a*n[0]+i*n[3]+e*n[6],o[1]=a*n[1]+i*n[4]+e*n[7],o[2]=a*n[2]+i*n[5]+e*n[8],o}function D(t,n){const[a,i,e,o]=t,r=new Array(4);return r[0]=a*n[0]+i*n[1]+e*n[2]+o*n[3],r[1]=a*n[4]+i*n[5]+e*n[6]+o*n[7],r[2]=a*n[8]+i*n[9]+e*n[10]+o*n[11],r[3]=a*n[12]+i*n[13]+e*n[14]+o*n[15],r}function I(n,i,o,r=!0){if(!Number.isFinite(n))throw new t("InvalidRotationAngle","Please specify a valid angle for rotation");const c=o*(r?a(n):n),s=Math.cos(c),l=Math.sin(c),f=e();switch(i){case 0:f[4]=s,f[5]=-l,f[7]=l,f[8]=s;break;case 1:f[0]=s,f[2]=l,f[6]=-l,f[8]=s;break;case 2:f[0]=s,f[1]=-l,f[3]=l,f[4]=s;break;default:throw new t("InvalidRotationAxis","Please specify either 0, 1 or 2 for X, Y or Z axis respectively")}return f}const N={HPR:[[2,-1],[0,1],[2,-1]],OPK:[[0,1],[1,1],[2,1]]};function H(n,a,i=!0){if(3!==n?.length||3!==a?.length)throw new t("InvalidRotationAngles","Please specify three angles with config for rotation");const o=e();for(let t=0;t<3;t++){const[e,r]=a[t],c=I(n[t],e,r,i);l(o,c,o)}return o}function q(t,n=!0){return H(t,N.OPK,n)}function k(t,n=!0){return H(t,N.HPR,n)}function A(t,n,i){const e=Math.sin(a(i)),o=Math.cos(a(i)),r=[[t,0],[t,n],[0,n]];r.forEach(((t,n)=>{r[n]=[o*t[0]-e*t[1],e*t[0]+o*t[1]]}));const c={xmin:Math.min(0,r[0][0],r[1][0],r[2][0]),xmax:Math.max(0,r[0][0],r[1][0],r[2][0]),ymin:Math.min(0,r[0][1],r[1][1],r[2][1]),ymax:Math.max(0,r[0][1],r[1][1],r[2][1])};return{hfov:Math.abs(c.xmax-c.xmin),vfov:Math.abs(c.ymax-c.ymin)}}function K(t,n){const i=a(t[1]),e=a(t[0]),o=t[2],[r,c,s,l]=n,f=a(r),h=a(c),u=s/Math.sqrt(1-l*Math.sin(f)**2),m=e-h,p=s/Math.sqrt(1-l*Math.sin(f)**2),M=l*(u*Math.sin(f)-p*Math.sin(i));return[(p+o)*Math.cos(i)*Math.sin(m),(p+o)*(Math.sin(i)*Math.cos(f)-Math.sin(f)*Math.cos(f)*Math.cos(m))+M*Math.cos(f),(p+o)*(Math.sin(i)*Math.sin(f)+Math.cos(f)*Math.cos(i)*Math.cos(m))-u+M*Math.sin(f)]}function W(t,n){const e=Number(t[0]),o=Number(t[1]),r=Number(t[2]),[c,s,l,f]=n,h=a(c),u=a(s),m=l/Math.sqrt(1-f*Math.sin(h)**2),p=e/m,M=o/m,g=r/m,v=Math.cos(h)-Math.sin(h)*M+Math.cos(h)*g,d=Math.sin(h)+Math.cos(h)*M+Math.sin(h)*g,x=Math.sqrt(v**2+p**2),w=f*m*Math.sin(h),y=(t,n=5)=>{if(0===n)return t;const a=y(t,n-1);return Math.atan(d/x-(w-f*(l/Math.sqrt(1-f*Math.sin(a)**2))*Math.sin(a))/(m*x))},O=y(h),b=Math.atan(e/(m*v))+u,j=i(O);return[i(b),j,e/(Math.cos(O)*Math.sin(b-u))-l/Math.sqrt(1-f*Math.sin(O)**2)]}function U(t,n,a){const i=360/n,e=180/a;return{heading:(t.x-n/2)*i,pitch:90-(t.y-a/2)*e}}function T(t,n,a,i=E/2){const{heading:e,pitch:o}=X(t,i);return J(e,o,n,a)}function J(t,n,a,i){return{x:a/2+t/(360/a),y:i-n/(180/i),heading:t,pitch:n}}function X(t,n){const a=i(Math.acos(-t.z/n));return{heading:i(Math.atan2(t.x,t.y)),pitch:a}}function Y(t,n,i=E/2){return[i*(Math.sin(a(t))*Math.sin(a(n))),i*(Math.cos(a(t))*Math.sin(a(n))),i*Math.cos(a(180-n))]}async function Z(t,n,a){const e=await g(n,t.spatialReference,a);let o=i(Math.atan2(e.y-t.y,e.x-t.x));return o=o>=0&&o<=90?90-o:o>90&&o<=180?360-o+90:90+Math.abs(o),o}function $(t,n,a){const i=Math.cos(a),e=Math.sin(a),o=[1,0,0,1,0,0],r=o[0]*i+o[2]*e,c=o[1]*i+o[3]*e,s=-o[0]*e+o[2]*i,l=-o[1]*e+o[3]*i;o[0]=r,o[1]=c,o[2]=s,o[3]=l;return[t*o[0]+n*o[2]+o[4],t*o[1]+n*o[3]+o[5]]}const B=t=>t.toArray(),G=(...t)=>t.some((t=>t));function Q(t,n){if(G(0===t.length,t.some((({x:t,y:n})=>G(null==t,null==n))),!n.hasZ))throw new Error("Input pixels must have x, y and camera location must have z value")}function _(t,n){if(t.some((t=>null==t.z))||null==n.z)throw new Error("Input points and camera location must have z value")}function tt(t){if(9!==t?.length)throw new Error("Rotation matrix is not provided or is not a valid 3x3 matrix")}function nt(t,n){return d(n)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*t/v.radius))):1}const at=t=>n=>new M(n,t),it=t=>null!=t&&"queryExtent"in t;function et(t,n,a,i){return[[-n,-n],[+n,-n],[+n,+n],[-n,+n]].map((([n,e])=>S(x(s(),a,[n,e,0]),i,t)))}function ot({a0:t,a1:n,a2:a,b0:i,b1:e,b2:o},r,c,s){const l=[t??r/2-.5,n,a??0,i??c/2-.5,e??0,o].map(rt);return null!=s&&ct(l)?{affines:l,focalLength:s}:{affines:[r/2-.5,1,0,c/2-.5,0,-1]}}function rt(t,n){if(null==t)return null;const a=parseFloat(`${t}`);return isNaN(a)?null:a}function ct(t){return null!=t[1]&&null!=t[5]}function st(t,n,a){const{cameraHeight:i,cameraPitch:e,cameraRoll:o,elevation:r,farDistance:c,horizontalFieldOfView:s,location:l,verticalFieldOfView:f}=t,h=r??(l.z??0)-i;return{...ht(t,n,a),averageElevation:h,cameraPitch:e,cameraRoll:o??0,farDistance:c,horizontalFieldOfView:s,verticalFieldOfView:f}}function lt(t,n,a,i){return xt(i)?q([i.omega,i.phi,i.kappa]):wt(i)?k([i.heading,i.pitch,i.roll]):k([t,n,a??0])}function ft(t,n,a){const{cameraHeading:i,cameraHeight:e,elevation:o,farDistance:r,horizontalFieldOfView:c,location:s,verticalFieldOfView:l}=t;return{averageElevation:o??(s.z??0)-e,cameraLocation:s,cameraHeading:i,farDistance:r,horizontalFieldOfView:c,imageHeight:a,imageWidth:n,verticalFieldOfView:l}}function ht(t,n,a){const{a0:i,a1:e,a2:o,b0:r,b1:c,b2:s,cameraHeading:l,cameraOrientation:f,cameraPitch:h,cameraRoll:u,focalLength:m,horizontalFieldOfView:p,location:M,matrix:g,principalX:v,principalY:d,radial:x,tangential:w,verticalFieldOfView:y}=t,{affines:O,focalLength:b}=ot({a0:i,a1:e,a2:o,b0:r,b1:c,b2:s},n,a,m),j=g??lt(l,h,u,f),E=null!=v&&null!=d?[v,d]:void 0;return{affineTransformations:f?.affineTransformations??O,cameraLocation:M.clone(),focalLength:f?.focalLength??b,horizontalFieldOfView:p,imageHeight:a,imageWidth:n,principalOffsetPoint:f?.principalOffsetPoint??E,radialDistortionCoefficients:f?.radialDistortionCoefficients??x,rotationMatrix:j,tangentialDistortionCoefficients:f?.tangentialDistortionCoefficients??w,verticalFieldOfView:y}}const ut=t=>null!=t&&"elevationSample"in t&&null!=t.elevationSample,mt=t=>w(t?.elevationSource)&&null!=t?.extent,pt=t=>y(t?.elevationSource),Mt=async(t,a)=>null!=a&&(ut(a)||pt(a))?a:mt(a)?{elevationSample:await b({...n.isSerializable(a.elevationSource)?a.elevationSource.toJSON():a.elevationSource,extent:a.extent}),elevationSource:new O({constantElevation:t})}:{elevationSource:new O({constantElevation:t})},gt=t=>j(t?.heading)&&j(t?.pitch),vt=(t,n)=>[[-t,-n],[t,-n],[t,n],[-t,n]];function dt(t){const{cameraLocation:n,farDistance:i,horizontalFieldOfView:o,rotationMatrix:r,scalingFactor:c,verticalFieldOfView:l}=t,h=e();f(h,r);const u=2*Math.tan(a(l)/2)*i*c,M=2*Math.tan(a(o)/2)*i*c,g=L([0,0,-1],h),v=C([n.x,n.y,n.z],g,t.farDistance*c,c),d=L([0,1,0],h),x=L([1,0,0],h),w=R(d,u/2,c),y=R(x,M/2,c),O=m(s(),w,y),b=p(s(),w,y);return[p(s(),v,O),p(s(),v,b),m(s(),v,O),m(s(),v,b)]}const xt=t=>2===t?.type,wt=t=>1===t?.type;function yt(t,n,a){if("panoramic"===t){const[t,i]=a;return T({x:n.x,y:n.y,z:n.z},t,i)}return{x:n.x+.5,y:.5-n.y}}var Ot;!function(t){t[t.CLOCKWISE=-1]="CLOCKWISE",t[t.COUNTERCLOCKWISE=1]="COUNTERCLOCKWISE"}(Ot||(Ot={}));export{dt as computeFarplaneVertices,A as computeHFOVAndVFOV,et as computeNewReferenceCoordinates,Y as convertHeadingPitchToSphereVertex,J as convertOrientationToPixelLocation,U as convertPixelToHeadingPitch,X as convertSphereVertexToOrientation,T as convertSphereVertexToPixelLocation,H as createRotationMatrix,k as createRotationMatrixFromHPR,q as createRotationMatrixFromOPK,K as geographicToLTP,ot as getAffinesAndFocalLength,ft as getImageToWorldPanoramicProperties,st as getImageToWorldProperties,Z as getInitialAngle,Mt as getUpdateElevationProps,nt as getWebMercatorScalingFactor,ht as getWorldToImageProperties,gt as hasAngles,wt as hasHeadingPitchRoll,xt as hasOmegaPhiKappa,it as isElevationSampler,ut as isUpdateElevationWithElevationSampler,mt as isUpdateElevationWithElevationSource,pt as isUpdateUsingConstantElevation,ct as isValidAffines,V as linearEquationSolve,W as ltpToGeographic,G as or,B as pointToArray,S as projectiveTransform,vt as reducerFn,$ as rotatePixel,C as scaleAndAddWithFactor,R as scaleWithFactor,yt as transformGraphicCoordinatesToPixel,L as transformMat3,D as transformMat4,Q as validatePixelsToTransform,_ as validatePointsToTransform,tt as validateRotationMatrix,at as vecToPoint};
|
|
5
|
+
import t from"../../../core/Error.js";import n from"../../../core/JSONSupport.js";import{deg2rad as a,rad2deg as i}from"../../../core/mathUtils.js";import{create as e}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as o,fromValues as r}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromArray as c}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{zeros as s}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{multiply as l,transpose as f}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{invertOrIdentity as h,mul as u}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{a as m,g as p}from"../../../chunks/vec32.js";import M from"../../../geometry/Point.js";import{projectWithZConversion as g}from"../../../geometry/projection.js";import{earth as v}from"../../../geometry/support/Ellipsoid.js";import{isWebMercator as d}from"../../../geometry/support/spatialReferenceUtils.js";import{a as x}from"../../../chunks/vec3.js";import{isElevationSource as w,isConstantElevation as y,ConstantElevation as O}from"../core/ElevationSourceDefinitions.js";import{getElevationSampler as b}from"./updateElevationUtils.js";import{isNumber as j}from"../../../support/guards.js";import{defaultImageSphereSize as E}from"../../../widgets/PanoramicViewer/constants.js";function S(t,n,a){const[i,e,r,c]=n,[s,l,f,m]=a;z(i,e,r,c);const p=z(s,l,f,m),M=V(i,e,r,c),g=V(s,l,f,m),v=h(o(),M),d=u(o(),v,g),[x,w,y,O]=P(t,d);return[x/O,w/O,p?0:y/O]}function z(t,n,a,i){return 0===t[2]&&0===n[2]&&0===a[2]&&0===i[2]&&(t[2]=n[2]=a[2]=i[2]=1,!0)}function F(t){return 0===t?1:t}function P(t,n){const[a,i,e]=t,o=[0,0,0,0];return o[0]=a*n[0]+i*n[1]+e*n[2]+n[3],o[1]=a*n[4]+i*n[5]+e*n[6]+n[7],o[2]=a*n[8]+i*n[9]+e*n[10]+n[11],o[3]=F(a*n[12]+i*n[13]+e*n[14]+n[15]),o}function V(t,n,a,i){const e=D(c([...i,1]),h(new Array(16),r(t[0],n[0],a[0],0,t[1],n[1],a[1],0,t[2],n[2],a[2],0,1,1,1,1))),s=e[0],l=e[1],f=e[2],u=o();return u[0]=s*t[0],u[1]=l*n[0],u[2]=f*a[0],u[3]=0,u[4]=s*t[1],u[5]=l*n[1],u[6]=f*a[1],u[7]=0,u[8]=s*t[2],u[9]=l*n[2],u[10]=f*a[2],u[11]=0,u[12]=s,u[13]=l,u[14]=f,u[15]=1,u}function C(t,n,a,i,e=s()){return e[0]=t[0]+n[0]*a,e[1]=t[1]+n[1]*a,e[2]=t[2]+n[2]*(a/i),e}function R(t,n,a){const i=s();return i[0]=t[0]*n,i[1]=t[1]*n,i[2]=t[2]*(n/a),i}function L(t,n){const[a,i,e]=t,o=s();return o[0]=a*n[0]+i*n[3]+e*n[6],o[1]=a*n[1]+i*n[4]+e*n[7],o[2]=a*n[2]+i*n[5]+e*n[8],o}function D(t,n){const[a,i,e,o]=t,r=new Array(4);return r[0]=a*n[0]+i*n[1]+e*n[2]+o*n[3],r[1]=a*n[4]+i*n[5]+e*n[6]+o*n[7],r[2]=a*n[8]+i*n[9]+e*n[10]+o*n[11],r[3]=a*n[12]+i*n[13]+e*n[14]+o*n[15],r}function I(n,i,o,r=!0){if(!Number.isFinite(n))throw new t("InvalidRotationAngle","Please specify a valid angle for rotation");const c=o*(r?a(n):n),s=Math.cos(c),l=Math.sin(c),f=e();switch(i){case 0:f[4]=s,f[5]=-l,f[7]=l,f[8]=s;break;case 1:f[0]=s,f[2]=l,f[6]=-l,f[8]=s;break;case 2:f[0]=s,f[1]=-l,f[3]=l,f[4]=s;break;default:throw new t("InvalidRotationAxis","Please specify either 0, 1 or 2 for X, Y or Z axis respectively")}return f}const N={HPR:[[2,-1],[0,1],[2,-1]],OPK:[[0,1],[1,1],[2,1]]};function H(n,a,i=!0){if(3!==n?.length||3!==a?.length)throw new t("InvalidRotationAngles","Please specify three angles with config for rotation");const o=e();for(let t=0;t<3;t++){const[e,r]=a[t],c=I(n[t],e,r,i);l(o,c,o)}return o}function q(t,n=!0){return H(t,N.OPK,n)}function k(t,n=!0){return H(t,N.HPR,n)}function A(t,n,i){const e=Math.sin(a(i)),o=Math.cos(a(i)),r=[[t,0],[t,n],[0,n]];r.forEach(((t,n)=>{r[n]=[o*t[0]-e*t[1],e*t[0]+o*t[1]]}));const c={xmin:Math.min(0,r[0][0],r[1][0],r[2][0]),xmax:Math.max(0,r[0][0],r[1][0],r[2][0]),ymin:Math.min(0,r[0][1],r[1][1],r[2][1]),ymax:Math.max(0,r[0][1],r[1][1],r[2][1])};return{hfov:Math.abs(c.xmax-c.xmin),vfov:Math.abs(c.ymax-c.ymin)}}function K(t,n){const i=a(t[1]),e=a(t[0]),o=t[2],[r,c,s,l]=n,f=a(r),h=a(c),u=s/Math.sqrt(1-l*Math.sin(f)**2),m=e-h,p=s/Math.sqrt(1-l*Math.sin(f)**2),M=l*(u*Math.sin(f)-p*Math.sin(i));return[(p+o)*Math.cos(i)*Math.sin(m),(p+o)*(Math.sin(i)*Math.cos(f)-Math.sin(f)*Math.cos(f)*Math.cos(m))+M*Math.cos(f),(p+o)*(Math.sin(i)*Math.sin(f)+Math.cos(f)*Math.cos(i)*Math.cos(m))-u+M*Math.sin(f)]}function W(t,n){const e=Number(t[0]),o=Number(t[1]),r=Number(t[2]),[c,s,l,f]=n,h=a(c),u=a(s),m=l/Math.sqrt(1-f*Math.sin(h)**2),p=e/m,M=o/m,g=r/m,v=Math.cos(h)-Math.sin(h)*M+Math.cos(h)*g,d=Math.sin(h)+Math.cos(h)*M+Math.sin(h)*g,x=Math.sqrt(v**2+p**2),w=f*m*Math.sin(h),y=(t,n=5)=>{if(0===n)return t;const a=y(t,n-1);return Math.atan(d/x-(w-f*(l/Math.sqrt(1-f*Math.sin(a)**2))*Math.sin(a))/(m*x))},O=y(h),b=Math.atan(e/(m*v))+u,j=i(O);return[i(b),j,e/(Math.cos(O)*Math.sin(b-u))-l/Math.sqrt(1-f*Math.sin(O)**2)]}function U(t,n,a){const i=360/n,e=180/a;return{heading:(t.x-n/2)*i,pitch:90-(t.y-a/2)*e}}function T(t,n,a,i=E/2){const{heading:e,pitch:o}=X(t,i);return J(e,o,n,a)}function J(t,n,a,i){return{x:a/2+t/(360/a),y:i-n/(180/i),heading:t,pitch:n}}function X(t,n){const a=i(Math.acos(-t.z/n));return{heading:i(Math.atan2(t.x,t.y)),pitch:a}}function Y(t,n,i=E/2){return[i*(Math.sin(a(t))*Math.sin(a(n))),i*(Math.cos(a(t))*Math.sin(a(n))),i*Math.cos(a(180-n))]}async function Z(t,n,a){const e=await g(n,t.spatialReference,a);let o=i(Math.atan2(e.y-t.y,e.x-t.x));return o=o>=0&&o<=90?90-o:o>90&&o<=180?360-o+90:90+Math.abs(o),o}function $(t,n,a){const i=Math.cos(a),e=Math.sin(a),o=[1,0,0,1,0,0],r=o[0]*i+o[2]*e,c=o[1]*i+o[3]*e,s=-o[0]*e+o[2]*i,l=-o[1]*e+o[3]*i;o[0]=r,o[1]=c,o[2]=s,o[3]=l;return[t*o[0]+n*o[2]+o[4],t*o[1]+n*o[3]+o[5]]}const B=t=>t.toArray(),G=(...t)=>t.some((t=>t));function Q(t,n){if(G(0===t.length,t.some((({x:t,y:n})=>G(null==t,null==n))),!n.hasZ))throw new Error("Input pixels must have x, y and camera location must have z value")}function _(t,n){if(t.some((t=>null==t.z))||null==n.z)throw new Error("Input points and camera location must have z value")}function tt(t){if(9!==t?.length)throw new Error("Rotation matrix is not provided or is not a valid 3x3 matrix")}function nt(t,n){return d(n)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*t/v.radius))):1}const at=t=>n=>new M(n,t),it=t=>null!=t&&"queryExtent"in t;function et(t,n,a,i){return[[-n,-n],[+n,-n],[+n,+n],[-n,+n]].map((([n,e])=>S(x(s(),a,[n,e,0]),i,t)))}function ot({a0:t,a1:n,a2:a,b0:i,b1:e,b2:o},r,c,s){const l=[t??r/2-.5,n,a??0,i??c/2-.5,e??0,o].map(rt);return null!=s&&ct(l)?{affines:l,focalLength:s}:{affines:[r/2-.5,1,0,c/2-.5,0,-1]}}function rt(t,n){if(null==t)return null;const a=parseFloat(`${t}`);return isNaN(a)?null:a}function ct(t){return null!=t[1]&&null!=t[5]}function st(t,n,a){const{cameraHeight:i,cameraPitch:e,cameraRoll:o,elevation:r,farDistance:c,horizontalFieldOfView:s,location:l,verticalFieldOfView:f}=t,h=r??(l.z??0)-i;return{...ht(t,n,a),averageElevation:h,cameraPitch:e,cameraRoll:o??0,farDistance:c,horizontalFieldOfView:s,verticalFieldOfView:f}}function lt(t,n,a,i){return xt(i)?q([i.omega,i.phi,i.kappa]):wt(i)?k([i.heading,i.pitch,i.roll]):k([t,n,a??0])}function ft(t,n,a){const{cameraHeading:i,cameraHeight:e,elevation:o,farDistance:r,horizontalFieldOfView:c,location:s,verticalFieldOfView:l}=t;return{averageElevation:o??(s.z??0)-e,cameraLocation:s,cameraHeading:i,farDistance:r,horizontalFieldOfView:c,imageHeight:a,imageWidth:n,verticalFieldOfView:l}}function ht(t,n,a){const{a0:i,a1:e,a2:o,b0:r,b1:c,b2:s,cameraHeading:l,cameraOrientation:f,cameraPitch:h,cameraRoll:u,focalLength:m,horizontalFieldOfView:p,location:M,matrix:g,principalX:v,principalY:d,radial:x,tangential:w,verticalFieldOfView:y}=t,{affines:O,focalLength:b}=ot({a0:i,a1:e,a2:o,b0:r,b1:c,b2:s},n,a,m),j=g??lt(l,h,u,f),E=null!=v&&null!=d?[v,d]:void 0;return{affineTransformations:f?.affineTransformations??O,cameraLocation:M.clone(),focalLength:f?.focalLength??b,horizontalFieldOfView:p,imageHeight:a,imageWidth:n,principalOffsetPoint:f?.principalOffsetPoint??E,radialDistortionCoefficients:f?.radialDistortionCoefficients??x,rotationMatrix:j,tangentialDistortionCoefficients:f?.tangentialDistortionCoefficients??w,verticalFieldOfView:y}}const ut=t=>null!=t&&"elevationSample"in t&&null!=t.elevationSample,mt=t=>w(t?.elevationSource)&&null!=t?.extent,pt=t=>y(t?.elevationSource),Mt=async(t,a)=>null!=a&&(ut(a)||pt(a))?a:mt(a)?{elevationSample:await b({...n.isSerializable(a.elevationSource)?a.elevationSource.toJSON():a.elevationSource,extent:a.extent}),elevationSource:new O({constantElevation:t})}:{elevationSource:new O({constantElevation:t})},gt=t=>j(t?.heading)&&j(t?.pitch),vt=(t,n)=>[[-t,-n],[t,-n],[t,n],[-t,n]];function dt(t){const{cameraLocation:n,farDistance:i,horizontalFieldOfView:o,rotationMatrix:r,scalingFactor:c,verticalFieldOfView:l}=t,h=e();f(h,r);const u=2*Math.tan(a(l)/2)*i*c,M=2*Math.tan(a(o)/2)*i*c,g=L([0,0,-1],h),v=C([n.x,n.y,n.z],g,t.farDistance*c,c),d=L([0,1,0],h),x=L([1,0,0],h),w=R(d,u/2,c),y=R(x,M/2,c),O=m(s(),w,y),b=p(s(),w,y);return[p(s(),v,O),p(s(),v,b),m(s(),v,O),m(s(),v,b)]}const xt=t=>2===t?.type,wt=t=>1===t?.type;function yt(t){return(t+360)%360}function Ot(t,n,a){if("panoramic"===t){const[t,i]=a;return T({x:n.x,y:n.y,z:n.z},t,i)}return{x:n.x+.5,y:.5-n.y}}var bt;!function(t){t[t.CLOCKWISE=-1]="CLOCKWISE",t[t.COUNTERCLOCKWISE=1]="COUNTERCLOCKWISE"}(bt||(bt={}));export{dt as computeFarplaneVertices,A as computeHFOVAndVFOV,et as computeNewReferenceCoordinates,Y as convertHeadingPitchToSphereVertex,J as convertOrientationToPixelLocation,U as convertPixelToHeadingPitch,X as convertSphereVertexToOrientation,T as convertSphereVertexToPixelLocation,H as createRotationMatrix,k as createRotationMatrixFromHPR,q as createRotationMatrixFromOPK,K as geographicToLTP,ot as getAffinesAndFocalLength,ft as getImageToWorldPanoramicProperties,st as getImageToWorldProperties,Z as getInitialAngle,Mt as getUpdateElevationProps,nt as getWebMercatorScalingFactor,ht as getWorldToImageProperties,gt as hasAngles,wt as hasHeadingPitchRoll,xt as hasOmegaPhiKappa,it as isElevationSampler,ut as isUpdateElevationWithElevationSampler,mt as isUpdateElevationWithElevationSource,pt as isUpdateUsingConstantElevation,ct as isValidAffines,V as linearEquationSolve,W as ltpToGeographic,yt as normalizeHeading,G as or,B as pointToArray,S as projectiveTransform,vt as reducerFn,$ as rotatePixel,C as scaleAndAddWithFactor,R as scaleWithFactor,Ot as transformGraphicCoordinatesToPixel,L as transformMat3,D as transformMat4,Q as validatePixelsToTransform,_ as validatePointsToTransform,tt as validateRotationMatrix,at as vecToPoint};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{rad2deg as t,deg2rad as a}from"../../../core/mathUtils.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as o,j as n}from"../../../chunks/vec32.js";import{webMercatorToGeographic as e}from"../../../geometry/support/webMercatorUtils.js";import{
|
|
5
|
+
import{rad2deg as t,deg2rad as a}from"../../../core/mathUtils.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as o,j as n}from"../../../chunks/vec32.js";import{webMercatorToGeographic as e}from"../../../geometry/support/webMercatorUtils.js";import{normalizeHeading as i,convertOrientationToPixelLocation as c,validatePointsToTransform as s,validateRotationMatrix as f,getWebMercatorScalingFactor as m}from"./utils.js";function l(t,a){const{cameraLocation:r,pointsToTransform:o,scalingFactor:n}=g(t,a.cameraLocation,a.rotationMatrix),e=new Array;return p(o,e,{...a,cameraLocation:r,scalingFactor:n,...T(a)}),Array.isArray(t)?e:e[0]}function u(t,a,r){return l(t?a.map((t=>e(t))):a,r).map((t=>({...t,z:1})))}function p(t,a,n){const{affineTransformations:e,cameraLocation:i,focalLengthX:c,focalLengthY:s,principalOffsetPoint:f,radialDistortionCoefficients:m,rotationMatrix:l,scalingFactor:u,tangentialDistortionCoefficients:p}=n;for(const h of t){const t=r();o(t,h,i),t[0]=t[0]/u,t[1]=t[1]/u;const n=-c*((l[0]*t[0]+l[3]*t[1]+l[6]*t[2])/(l[2]*t[0]+l[5]*t[1]+l[8]*t[2])),g=-s*((l[1]*t[0]+l[4]*t[1]+l[7]*t[2])/(l[2]*t[0]+l[5]*t[1]+l[8]*t[2])),y=n*n+g*g;let L=0,A=0,T=0,b=0,d=0,w=0,M=0;m&&(L=m[0]??0,A=m[1]??0,T=m[2]??0),p&&(b=p[0],d=p[1]),f&&(w=f[0]??0,M=f[1]??0);const j=1+L*y+A*y*y+T*y*y*y;let F=n*j+b*(y+2*n**2)+2*d*n*g,N=g*j+d*(y+2*g**2)+2*b*n*g;F+=w,N+=M;const x=Number(e[0])+Number(e[1])*F+Number(e[2])*N,v=Number(e[3])+Number(e[4])*F+Number(e[5])*N;a.push({x,y:v})}}function h(a,r){const{cameraHeading:o,imageHeight:e,imageWidth:s}=r,{cameraLocation:f,pointsToTransform:m}=y(a,r.cameraLocation),l=new Array;for(const u of m){const a=n(f,u),r=i(t(Math.atan2(u[0]-f[0],u[1]-f[1]))-o),m=t(Math.acos((f[2]-u[2])/a));l.push(c(r,m,s,e))}return Array.isArray(a)?l:l[0]}function g(t,a,r){const o=Array.isArray(t)||"items"in t?t:[t];s(o,a),L(o,a),f(r);const n=m(a.y,a.spatialReference);return{pointsToTransform:o.map((t=>t.toArray())),scalingFactor:n,cameraLocation:a.toArray()}}function y(t,a){const r=Array.isArray(t)||"items"in t?t:[t];return s(r,a),L(r,a),{pointsToTransform:r.map((t=>t.toArray())),cameraLocation:a.toArray()}}function L(t,a){if(t.some((t=>!t.spatialReference.equals(a.spatialReference))))throw new Error("Input points and camera location must have the same spatial reference")}function A(t){return null!=t?.focalLength}function T(t){if(A(t))return{focalLengthX:t.focalLength,focalLengthY:t.focalLength};const{imageWidth:r,imageHeight:o,horizontalFieldOfView:n,verticalFieldOfView:e}=t;return{focalLengthX:r/(2*Math.tan(a(n)/2)),focalLengthY:o/(2*Math.tan(a(e)/2))}}export{l as worldToImage,h as worldToImagePanoramic,u as worldToImageWithLTPFlag};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as
|
|
5
|
+
import{_ as o}from"../../chunks/tslib.es6.js";import e from"../../core/Clonable.js";import{JSONMap as r}from"../../core/jsonMap.js";import t from"../../core/JSONSupport.js";import{property as i}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";const a=new r({esriRelCardinalityOneToOne:"one-to-one",esriRelCardinalityOneToMany:"one-to-many",esriRelCardinalityManyToMany:"many-to-many"}),n=new r({esriRelRoleOrigin:"origin",esriRelRoleDestination:"destination"});let l=class extends(e.ClonableMixin(t)){constructor(o){super(o),this.cardinality=null,this.catalogId=null,this.composite=null,this.id=null,this.keyField=null,this.keyFieldInRelationshipTable=null,this.name=null,this.relatedTableId=null,this.relationshipTableId=null,this.role=null}};o([i({json:{read:a.read,write:a.write}})],l.prototype,"cardinality",void 0),o([i({json:{name:"catalogID"}})],l.prototype,"catalogId",void 0),o([i({json:{read:!0,write:!0}})],l.prototype,"composite",void 0),o([i({json:{read:!0,write:!0}})],l.prototype,"id",void 0),o([i({json:{read:!0,write:!0}})],l.prototype,"keyField",void 0),o([i({json:{read:!0,write:!0}})],l.prototype,"keyFieldInRelationshipTable",void 0),o([i({json:{read:!0,write:!0}})],l.prototype,"name",void 0),o([i({json:{read:!0,write:!0}})],l.prototype,"relatedTableId",void 0),o([i({json:{read:!0,write:!0}})],l.prototype,"relationshipTableId",void 0),o([i({json:{read:n.read,write:n.write}})],l.prototype,"role",void 0),l=o([s("esri.layers.support.Relationship")],l);const p=l;export{p 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.33/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.33.0-next.
|
|
3
|
+
"version": "4.33.0-next.20250221",
|
|
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/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.33/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};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Clonable.js";import r from"../../core/Collection.js";import o from"../../core/JSONSupport.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import{ensureClass as s}from"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{enumeration as n}from"../../core/accessorSupport/decorators/enumeration.js";import{reader as p}from"../../core/accessorSupport/decorators/reader.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../../core/accessorSupport/decorators/writer.js";import a from"../../geometry/SpatialReference.js";import{apiKey as y}from"./commonProperties.js";import
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Clonable.js";import r from"../../core/Collection.js";import o from"../../core/JSONSupport.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import{ensureClass as s}from"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{enumeration as n}from"../../core/accessorSupport/decorators/enumeration.js";import{reader as p}from"../../core/accessorSupport/decorators/reader.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../../core/accessorSupport/decorators/writer.js";import a from"../../geometry/SpatialReference.js";import{apiKey as y}from"./commonProperties.js";import c from"./DataLayer.js";import m from"./FeatureSet.js";import{impedanceAttributeNameJsonMap as d,restrictionAttributeNameJsonMap as v,directionsLengthUnitJsonMap as w,directionsOutputTypeJsonMap as j,directionsStyleNameJsonMap as h,durationImpedanceAttributeNameJsonMap as S,lengthUnitJsonMap as B,outputLineJsonMap as f,restrictUTurnJsonMap as b}from"./networkEnums.js";import T from"./NetworkFeatureSet.js";import g from"./NetworkUrl.js";import A from"./TravelMode.js";var N;let P=class extends(e.ClonableMixin(o)){static{N=this}constructor(t){super(t),this.accumulateAttributes=null,this.apiKey=null,this.attributeParameterValues=null,this.checksum=null,this.directionsLanguage=null,this.directionsLengthUnits=null,this.directionsOutputType=null,this.directionsStyleName=null,this.directionsTimeAttribute=null,this.findBestSequence=null,this.geometryPrecision=null,this.geometryPrecisionM=null,this.geometryPrecisionZ=null,this.ignoreInvalidLocations=null,this.impedanceAttribute=null,this.outputGeometryPrecision=null,this.outputGeometryPrecisionUnits=null,this.outputLines="true-shape",this.outSpatialReference=null,this.overrides=null,this.pointBarriers=null,this.polygonBarriers=null,this.polylineBarriers=null,this.preserveFirstStop=null,this.preserveLastStop=null,this.preserveObjectID=null,this.restrictionAttributes=null,this.restrictUTurns=null,this.returnBarriers=!1,this.returnDirections=!1,this.returnPolygonBarriers=!1,this.returnPolylineBarriers=!1,this.returnRoutes=!0,this.returnStops=!1,this.returnTraversedEdges=null,this.returnTraversedJunctions=null,this.returnTraversedTurns=null,this.returnZ=!0,this.startTime=null,this.startTimeIsUTC=!0,this.stops=null,this.timeWindowsAreUTC=null,this.travelMode=null,this.useHierarchy=null,this.useTimeWindows=null}static from(t){return s(N,t)}readAccumulateAttributes(t){return null==t?null:t.map((t=>d.fromJSON(t)))}writeAccumulateAttributes(t,e,r){t?.length&&(e[r]=t.map((t=>d.toJSON(t))))}writePointBarriers(t,e,r){k(t,e,r)}writePolygonBarrier(t,e,r){k(t,e,r)}writePolylineBarrier(t,e,r){k(t,e,r)}readRestrictionAttributes(t){return null==t?null:t.map((t=>v.fromJSON(t)))}writeRestrictionAttributes(t,e,r){t?.length&&(e[r]=t.map((t=>v.toJSON(t))))}readStartTime(t,e){const{startTime:r}=e;return null==r?null:"now"===r?"now":new Date(r)}writeStartTime(t,e){null!=t&&(e.startTime="now"===t?"now":t.getTime())}readStops(t,e){return C(e.stops)}writeStops(t,e,r){k(t,e,r)}};t([i({type:[String],json:{name:"accumulateAttributeNames",write:!0}})],P.prototype,"accumulateAttributes",void 0),t([p("accumulateAttributes")],P.prototype,"readAccumulateAttributes",null),t([l("accumulateAttributes")],P.prototype,"writeAccumulateAttributes",null),t([i(y)],P.prototype,"apiKey",void 0),t([i({json:{write:!0}})],P.prototype,"attributeParameterValues",void 0),t([i({type:String,json:{write:!0}})],P.prototype,"checksum",void 0),t([i({type:String,json:{write:!0}})],P.prototype,"directionsLanguage",void 0),t([n(w)],P.prototype,"directionsLengthUnits",void 0),t([n(j)],P.prototype,"directionsOutputType",void 0),t([n(h)],P.prototype,"directionsStyleName",void 0),t([n(S,{name:"directionsTimeAttributeName",ignoreUnknown:!1})],P.prototype,"directionsTimeAttribute",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"findBestSequence",void 0),t([i({type:Number,json:{write:!0}})],P.prototype,"geometryPrecision",void 0),t([i({type:Number,json:{write:!0}})],P.prototype,"geometryPrecisionM",void 0),t([i({type:Number,json:{write:!0}})],P.prototype,"geometryPrecisionZ",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"ignoreInvalidLocations",void 0),t([n(d,{name:"impedanceAttributeName",ignoreUnknown:!1})],P.prototype,"impedanceAttribute",void 0),t([i({type:Number,json:{write:!0}})],P.prototype,"outputGeometryPrecision",void 0),t([n(B)],P.prototype,"outputGeometryPrecisionUnits",void 0),t([n(f)],P.prototype,"outputLines",void 0),t([i({type:a,json:{name:"outSR",write:!0}})],P.prototype,"outSpatialReference",void 0),t([i({json:{write:!0}})],P.prototype,"overrides",void 0),t([i({json:{name:"barriers",write:!0}})],P.prototype,"pointBarriers",void 0),t([l("pointBarriers")],P.prototype,"writePointBarriers",null),t([i({json:{write:!0}})],P.prototype,"polygonBarriers",void 0),t([l("polygonBarriers")],P.prototype,"writePolygonBarrier",null),t([i({json:{write:!0}})],P.prototype,"polylineBarriers",void 0),t([l("polylineBarriers")],P.prototype,"writePolylineBarrier",null),t([i({type:Boolean,json:{write:!0}})],P.prototype,"preserveFirstStop",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"preserveLastStop",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"preserveObjectID",void 0),t([i({type:[String],json:{name:"restrictionAttributeNames",write:!0}})],P.prototype,"restrictionAttributes",void 0),t([p("restrictionAttributes")],P.prototype,"readRestrictionAttributes",null),t([l("restrictionAttributes")],P.prototype,"writeRestrictionAttributes",null),t([n(b)],P.prototype,"restrictUTurns",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnBarriers",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnDirections",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnPolygonBarriers",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnPolylineBarriers",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnRoutes",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnStops",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnTraversedEdges",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnTraversedJunctions",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnTraversedTurns",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnZ",void 0),t([i({json:{write:!0}})],P.prototype,"startTime",void 0),t([p("startTime")],P.prototype,"readStartTime",null),t([l("startTime")],P.prototype,"writeStartTime",null),t([i({type:Boolean,json:{write:!0}})],P.prototype,"startTimeIsUTC",void 0),t([i({json:{write:!0}})],P.prototype,"stops",void 0),t([p("stops")],P.prototype,"readStops",null),t([l("stops")],P.prototype,"writeStops",null),t([i({type:Boolean,json:{write:!0}})],P.prototype,"timeWindowsAreUTC",void 0),t([i({type:A,json:{write:!0}})],P.prototype,"travelMode",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"useHierarchy",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"useTimeWindows",void 0),P=N=t([u("esri.rest.support.RouteParameters")],P);const O=P;function J(t){return t&&"type"in t}function L(t){return t&&"features"in t&&"doNotLocateOnRestrictedElements"in t}function R(t){return t&&"url"in t}function U(t){return t&&"features"in t}function C(t){return J(t)?c.fromJSON(t):R(t)?g.fromJSON(t):L(t)?T.fromJSON(t):U(t)?m.fromJSON(t):null}function k(t,e,o){null!=t&&(e[o]=r.isCollection(t)?{features:t.toArray().map((t=>t.toJSON()))}:t.toJSON())}export{O 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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as r}from"../../chunks/tslib.es6.js";import o from"../../Graphic.js";import{isSome as e}from"../../core/arrayUtils.js";import t from"../../core/JSONSupport.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{reader as p}from"../../core/accessorSupport/decorators/reader.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import
|
|
5
|
+
import{_ as r}from"../../chunks/tslib.es6.js";import o from"../../Graphic.js";import{isSome as e}from"../../core/arrayUtils.js";import t from"../../core/JSONSupport.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{reader as p}from"../../core/accessorSupport/decorators/reader.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import l from"./FeatureSet.js";import a from"./NAMessage.js";import u from"./RouteResult.js";function n(r){return r?l.fromJSON(r).features.filter(e):[]}let c=class extends t{constructor(r){super(r),this.checksum=null,this.messages=null,this.pointBarriers=null,this.polylineBarriers=null,this.polygonBarriers=null,this.routeResults=null}readPointBarriers(r,o){return n(o.barriers)}readPolylineBarriers(r){return n(r)}readPolygonBarriers(r){return n(r)}};r([s({type:String})],c.prototype,"checksum",void 0),r([s({type:[a]})],c.prototype,"messages",void 0),r([s({type:[o]})],c.prototype,"pointBarriers",void 0),r([p("pointBarriers",["barriers"])],c.prototype,"readPointBarriers",null),r([s({type:[o]})],c.prototype,"polylineBarriers",void 0),r([p("polylineBarriers")],c.prototype,"readPolylineBarriers",null),r([s({type:[o]})],c.prototype,"polygonBarriers",void 0),r([p("polygonBarriers")],c.prototype,"readPolygonBarriers",null),r([s({type:[u]})],c.prototype,"routeResults",void 0),c=r([i("esri.rest.support.RouteSolveResult")],c);const m=c;export{m as default};
|
package/support/revision.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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const a="20250221",b="765a8753790d1e182128246b9ae32288abb05d01";export{a as buildDate,b as commitHash};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{GeometryCursor as t}from"../../geometry/GeometryCursor.js";import{GeometryType as e,TileClipper as o}from"../../geometry/support/TileClipper.js";const r=512;let n;class s{constructor(t){this._geometry=t}next(){const t=this._geometry;return this._geometry=null,t}}function i(s,i){n||(n=new o(0,0,0,1));const y="esriGeometryPolygon"===s.geometryType,m
|
|
5
|
+
import{GeometryCursor as t}from"../../geometry/GeometryCursor.js";import{GeometryType as e,TileClipper as o}from"../../geometry/support/TileClipper.js";const r=512;let n;class s{constructor(t){this._geometry=t}next(){const t=this._geometry;return this._geometry=null,t}}function i(s,i,l){if(!s)return null;n||(n=new o(0,0,0,1));const y=l?-1:1,m="esriGeometryPolygon"===s.geometryType,c=m?e.Polygon:e.LineString,p=m?3:2;let u,f;for(n.reset(c),n.setPixelMargin(i+1),n.setExtent(r);s.nextPath();)if(!(s.pathSize<p)){for(s.nextPoint(),u=s.x,f=y*s.y,n.moveTo(u,f);s.nextPoint();)u=s.x,f=y*s.y,n.lineTo(u,f);m&&n.close()}const g=n.result(!1);if(g){const e=t.createEmptyOptimizedCIM(s.geometryType);for(const t of g){e.startPath();for(const o of t)e.pushXY(o.x,y*o.y)}return e.reset(),e}return null}export{s as SimpleEffectCursor,i as clipCursorToTileExtent};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
class e{static{this.instance=null}static local(){return null===e.instance&&(e.instance=new e),e.instance}execute(e,s,
|
|
5
|
+
class e{static{this.instance=null}static local(){return null===e.instance&&(e.instance=new e),e.instance}execute(e,s,n,i){return new t(e,s)}}class t{constructor(e,t){this._inputGeometries=e,this._angleTolerance=void 0!==t.angleTolerance?t.angleTolerance:120,this._maxCosAngle=Math.cos((1-Math.abs(this._angleTolerance)/180)*Math.PI)}next(){let e=this._inputGeometries.next();if(!e)return null;for(;e;){if("esriGeometryPolygon"===e.geometryType)this._isClosed=!0;else if("esriGeometryPolyline"===e.geometryType)this._isClosed=!1;else{if("esriGeometryEnvelope"!==e.geometryType){e=this._inputGeometries.next();continue}if(this._maxCosAngle)return e;this._isClosed=!0}for(;e.nextPath();)this._processPath(e);return e.reset(),e}return null}_processPath(e){if(e.nextPoint()){const t=e.x,s=e.y;let n=t,i=s,o=e.pathSize,l=0,r=0,a=0,h=0,c=0,_=0;this._isClosed&&++o;for(let u=1;e.nextPoint()||u<o;++u){let x,m;this._isClosed&&u===o-1?(x=t,m=s):(x=e.x,m=e.y);const y=x-n,g=m-i,C=Math.sqrt(y*y+g*g);if(u>1&&C>0&&a>0){(l*y+r*g)/C/a<=this._maxCosAngle&&e.setControlPointAt(u-1)}1===u&&(h=y,c=g,_=C),C>0&&(n=x,i=m,l=y,r=g,a=C)}if(this._isClosed&&a>0&&_>0){(l*h+r*c)/_/a<=this._maxCosAngle&&e.setControlPointAt(0)}}}}export{e as EffectAddControlPoints};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{GeometryCursor as e}from"../../../geometry/GeometryCursor.js";import{collectMultipath as t}from"../../../geometry/geometryCursorCollectUtils.js";import i from"../../../geometry/SpatialReference.js";import{clipCursorToTileExtent as s}from"../CIMEffects.js";import{CurveHelper as r,pixelTolerance as n}from"../CurveHelper.js";import{GeometricEffectOffsetMethod as o}from"../enums.js";class m{static{this.instance=null}static local(){return null===m.instance&&(m.instance=new m),m.instance}execute(e,t,i,s,r,n,o){return new l(e,t,i,s,r,n,o)}}class l{constructor(e,t,i,s,o,m,l){this._preventClipping=l,this._inputGeometries=e,this._tileKey=s,this._geometryEngine=o,this._curveHelper=new r,this._size=(void 0!==t.size?t.size:1)*i,this._maxInflateSize=m*i,this._offsetFlattenError=n*i}next(){let r;for(;r=this._inputGeometries.next();){if(0===this._size)return r;if("esriGeometryEnvelope"===r.geometryType)if(this._size>0){const i=e.createEmptyOptimizedCIM(r.geometryType),s=t(r)[0],n=this._curveHelper.offset(s,this._size,o.Rounded,4,this._offsetFlattenError);if(n)return i.pushPath(n),i}else if(this._size<0){const t=r.asJSON();if(Math.min(t.xmax-t.xmin,t.ymax-t.ymin)+2*this._size>0)return e.fromJSONCIM({xmin:t.xmin-this._size,xmax:t.xmax+this._size,ymin:t.ymin-this._size,ymax:t.ymax+this._size})}const n=this._geometryEngine;if(null==n)return null;const m=!this._preventClipping&&this._tileKey?s(r,this._maxInflateSize):r;if(!m)continue;const l=n.buffer(i.WebMercator,m.asJSON(),this._size,1);return l?e.fromJSONCIM(l):null}return null}}export{m as EffectBuffer};
|
|
5
|
+
import{GeometryCursor as e}from"../../../geometry/GeometryCursor.js";import{collectMultipath as t}from"../../../geometry/geometryCursorCollectUtils.js";import i from"../../../geometry/SpatialReference.js";import{clipCursorToTileExtent as s}from"../CIMEffects.js";import{CurveHelper as r,pixelTolerance as n}from"../CurveHelper.js";import{GeometricEffectOffsetMethod as o}from"../enums.js";class m{static{this.instance=null}static local(){return null===m.instance&&(m.instance=new m),m.instance}execute(e,t,i,s,r,n,o){return new l(e,t,i,s,r,n,o)}}class l{constructor(e,t,i,s,o,m,l){this._preventClipping=l,this._inputGeometries=e,this._tileKey=s,this._geometryEngine=o,this._curveHelper=new r,this._size=(void 0!==t.size?t.size:1)*i,this._maxInflateSize=m*i,this._offsetFlattenError=n*i}next(){let r;for(;r=this._inputGeometries.next();){if(0===this._size)return r;if("esriGeometryEnvelope"===r.geometryType)if(this._size>0){const i=e.createEmptyOptimizedCIM(r.geometryType),s=t(r)[0],n=this._curveHelper.offset(s,this._size,o.Rounded,4,this._offsetFlattenError);if(n)return i.pushPath(n),i}else if(this._size<0){const t=r.asJSON();if(Math.min(t.xmax-t.xmin,t.ymax-t.ymin)+2*this._size>0)return e.fromJSONCIM({xmin:t.xmin-this._size,xmax:t.xmax+this._size,ymin:t.ymin-this._size,ymax:t.ymax+this._size})}const n=this._geometryEngine;if(null==n)return null;const m=!this._preventClipping&&this._tileKey?s(r,this._maxInflateSize,!0):r;if(!m)continue;const l=n.buffer(i.WebMercator,m.asJSON(),this._size,1);return l?e.fromJSONCIM(l):null}return null}}export{m as EffectBuffer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{GeometryCursor as t}from"../../../geometry/GeometryCursor.js";import i from"../../../geometry/SpatialReference.js";import{clipCursorToTileExtent as e}from"../CIMEffects.js";import{GeometricEffectDonutMethod as n}from"../enums.js";class s{static{this.instance=null}static local(){return null===s.instance&&(s.instance=new s),s.instance}execute(t,i,e,n,s,o,h){return new r(t,i,e,n,s,o,h)}}class r{constructor(t,i,e,s,r,o,h){switch(this._preventClipping=h,this._inputGeometries=t,this._tileKey=s,this._geometryEngine=r,this._maxInflateSize=o*e,this._width=(void 0!==i.width?i.width:2)*e,i.method){case n.Mitered:case n.Bevelled:case n.Rounded:case n.TrueBuffer:case n.Square:}this._option=i.option}next(){let n;for(;n=this._inputGeometries.next();){if("esriGeometryEnvelope"===n.geometryType&&this._width>0){const i=n.asJSON();return Math.min(i.xmax-i.xmin,i.ymax-i.ymin)-2*this._width<0?n:t.fromJSONCIM({paths:[[[i.xmin+this._width,i.ymin+this._width],[i.xmax-this._width,i.ymin+this._width],[i.xmax-this._width,i.ymax-this._width],[i.xmin+this._width,i.ymax-this._width],[i.xmin+this._width,i.ymin+this._width]],[[i.xmin,i.ymin],[i.xmin,i.ymax],[i.xmax,i.ymax],[i.xmax,i.ymin],[i.xmin,i.ymin]]]})}if("esriGeometryPolygon"===n.geometryType){if(0===this._width)return n.clone();const t=this._geometryEngine;if(null==t)return null;const s=!this._preventClipping&&this._tileKey?e(n,this._maxInflateSize):n.clone();if(!s)continue;const r=t.buffer(i.WebMercator,s.asJSON(),-this._width,1);if(r)for(const i of r.rings)if(i){s.startPath();for(const t of i.reverse())s.pushXY(t[0],s.yFactor*t[1])}return s}}return null}}export{s as EffectDonut};
|
|
5
|
+
import{GeometryCursor as t}from"../../../geometry/GeometryCursor.js";import i from"../../../geometry/SpatialReference.js";import{clipCursorToTileExtent as e}from"../CIMEffects.js";import{GeometricEffectDonutMethod as n}from"../enums.js";class s{static{this.instance=null}static local(){return null===s.instance&&(s.instance=new s),s.instance}execute(t,i,e,n,s,o,h){return new r(t,i,e,n,s,o,h)}}class r{constructor(t,i,e,s,r,o,h){switch(this._preventClipping=h,this._inputGeometries=t,this._tileKey=s,this._geometryEngine=r,this._maxInflateSize=o*e,this._width=(void 0!==i.width?i.width:2)*e,i.method){case n.Mitered:case n.Bevelled:case n.Rounded:case n.TrueBuffer:case n.Square:}this._option=i.option}next(){let n;for(;n=this._inputGeometries.next();){if("esriGeometryEnvelope"===n.geometryType&&this._width>0){const i=n.asJSON();return Math.min(i.xmax-i.xmin,i.ymax-i.ymin)-2*this._width<0?n:t.fromJSONCIM({paths:[[[i.xmin+this._width,i.ymin+this._width],[i.xmax-this._width,i.ymin+this._width],[i.xmax-this._width,i.ymax-this._width],[i.xmin+this._width,i.ymax-this._width],[i.xmin+this._width,i.ymin+this._width]],[[i.xmin,i.ymin],[i.xmin,i.ymax],[i.xmax,i.ymax],[i.xmax,i.ymin],[i.xmin,i.ymin]]]})}if("esriGeometryPolygon"===n.geometryType){if(0===this._width)return n.clone();const t=this._geometryEngine;if(null==t)return null;const s=!this._preventClipping&&this._tileKey?e(n,this._maxInflateSize,!0):n.clone();if(!s)continue;const r=t.buffer(i.WebMercator,s.asJSON(),-this._width,1);if(r)for(const i of r.rings)if(i){s.startPath();for(const t of i.reverse())s.pushXY(t[0],s.yFactor*t[1])}return s}}return null}}export{s as EffectDonut};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{GeometryCursor as t}from"../../../geometry/GeometryCursor.js";import{collectPath as e}from"../../../geometry/geometryCursorCollectUtils.js";import s from"../../../geometry/SpatialReference.js";import{isExtent as i}from"../../../geometry/support/jsonUtils.js";import{clipCursorToTileExtent as o}from"../CIMEffects.js";import{CurveHelper as r,pixelTolerance as n}from"../CurveHelper.js";import{GeometricEffectOffsetMethod as f}from"../enums.js";const m=10;class h{static{this.instance=null}static local(){return null===h.instance&&(h.instance=new h),h.instance}execute(t,e,s,i,o,r,n){return new l(t,e,s,i,o,r,n)}}class l{constructor(t,e,s,i,o,f,h){this._preventClipping=h,this._inputGeometries=t,this._tileKey=i,this._geometryEngine=o,this._curveHelper=new r,this._offset=(e.offset??1)*s,this._method=e.method,this._maxInflateSize=Math.max(Math.abs(f*s),m),this._option=e.option,this._offsetFlattenError=n*s}next(){let r;for(;r=this._inputGeometries.next();){if(0===this._offset)return r.clone();if("esriGeometryEnvelope"===r.geometryType){if(this._method===f.Rounded&&this._offset>0){const s=e(r),i=this._curveHelper.offset(s,-this._offset,this._method,4,this._offsetFlattenError);if(i){const e=t.createEmptyOptimizedCIM(r.geometryType);return e.pushPath(i),e}return null}const s=r.asJSON();if(i(s)&&Math.min(s.xmax-s.xmin,s.ymax-s.ymin)+2*this._offset>0)return t.fromJSONCIM({xmin:s.xmin-this._offset,xmax:s.xmax+this._offset,ymin:s.ymin-this._offset,ymax:s.ymax+this._offset})}const n=this._geometryEngine;if(null==n)continue;const m=!this._preventClipping&&this._tileKey?o(r,this._maxInflateSize):r.clone();if(!m)continue;const h=n.offset(s.WebMercator,m.asJSON(),-this._offset,1,this._method,4,this._offsetFlattenError);return h?t.fromJSONCIM(h):null}return null}}export{h as EffectOffset};
|
|
5
|
+
import{GeometryCursor as t}from"../../../geometry/GeometryCursor.js";import{collectPath as e}from"../../../geometry/geometryCursorCollectUtils.js";import s from"../../../geometry/SpatialReference.js";import{isExtent as i}from"../../../geometry/support/jsonUtils.js";import{clipCursorToTileExtent as o}from"../CIMEffects.js";import{CurveHelper as r,pixelTolerance as n}from"../CurveHelper.js";import{GeometricEffectOffsetMethod as f}from"../enums.js";const m=10;class h{static{this.instance=null}static local(){return null===h.instance&&(h.instance=new h),h.instance}execute(t,e,s,i,o,r,n){return new l(t,e,s,i,o,r,n)}}class l{constructor(t,e,s,i,o,f,h){this._preventClipping=h,this._inputGeometries=t,this._tileKey=i,this._geometryEngine=o,this._curveHelper=new r,this._offset=(e.offset??1)*s,this._method=e.method,this._maxInflateSize=Math.max(Math.abs(f*s),m),this._option=e.option,this._offsetFlattenError=n*s}next(){let r;for(;r=this._inputGeometries.next();){if(0===this._offset)return r.clone();if("esriGeometryEnvelope"===r.geometryType){if(this._method===f.Rounded&&this._offset>0){const s=e(r),i=this._curveHelper.offset(s,-this._offset,this._method,4,this._offsetFlattenError);if(i){const e=t.createEmptyOptimizedCIM(r.geometryType);return e.pushPath(i),e}return null}const s=r.asJSON();if(i(s)&&Math.min(s.xmax-s.xmin,s.ymax-s.ymin)+2*this._offset>0)return t.fromJSONCIM({xmin:s.xmin-this._offset,xmax:s.xmax+this._offset,ymin:s.ymin-this._offset,ymax:s.ymax+this._offset})}const n=this._geometryEngine;if(null==n)continue;const m=!this._preventClipping&&this._tileKey?o(r,this._maxInflateSize,!0):r.clone();if(!m)continue;const h=n.offset(s.WebMercator,m.asJSON(),-this._offset,1,this._method,4,this._offsetFlattenError);return h?t.fromJSONCIM(h):null}return null}}export{h as EffectOffset};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import{id as i}from"../../kernel.js";import r from"../../core/Collection.js";import s from"../../core/Error.js";import n from"../../core/Evented.js";import t from"../../core/Loadable.js";import o from"../../core/Logger.js";import{getOrCreateMapValue as a}from"../../core/MapUtils.js";import d from"../../core/Promise.js";import{debounce as c,throwIfAborted as v}from"../../core/promiseUtils.js";import l from"../../core/ReactiveMap.js";import{watch as p,whenOnce as u}from"../../core/reactiveUtils.js";import{normalize as f}from"../../core/urlUtils.js";import{property as m}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as g}from"../../core/support/UpdatingHandles.js";import{parse as w}from"../../layers/support/arcgisLayerUrl.js";import{isSubtypeGroupLayer as y,isFeatureLayer as S}from"../../layers/support/layerUtils.js";import I from"../../portal/Portal.js";import{hasUserTypeExtension as _}from"../../portal/support/utils.js";import b from"../../rest/featureService/FeatureService.js";import{ServiceVersionInfo as L}from"./ServiceVersionInfo.js";import V from"../../versionManagement/VersionManagementService.js";function U(e){return!e||0===e.trim().length}const A=new Map;function T(e){return a(A,e,(()=>{const i=new j({view:e});return e.addHandles({remove(){A.delete(e),i.destroy()}}),i.load().catch((e=>{o.getLogger("esri.views.Services").error("Failed to load service metadata",e)})),i}))}let j=class extends(t.LoadableMixin(d.EsriPromiseMixin(n.EventedAccessor))){constructor(e){super(e),this._updatingHandles=new g,this.items=new r,this.tablesAndLayersLookup=new l,this.additionalLayers=new r,this._debouncedCheckAndUpdateServiceInfos=c((async()=>{const e=[];for(const i of this.items){if(0===i.layersAndTables.length)continue;const r=i.layersAndTables.getItemAt(0);r?.gdbVersion!==i.versionInfo?.versionIdentifier.name&&e.push(i)}0!==e.length&&(await u((()=>!this.updating)),await this._updateVersionInfos(e))})),this._debouncedLayersChanged=c((async()=>{const e=this._detectNewLayersAndTables();0!==e.length&&(await u((()=>!this._updatingHandles.updating)),await this._updatingHandles.addPromise((async()=>{for(const
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import{id as i}from"../../kernel.js";import r from"../../core/Collection.js";import s from"../../core/Error.js";import n from"../../core/Evented.js";import t from"../../core/Loadable.js";import o from"../../core/Logger.js";import{getOrCreateMapValue as a}from"../../core/MapUtils.js";import d from"../../core/Promise.js";import{debounce as c,throwIfAborted as v}from"../../core/promiseUtils.js";import l from"../../core/ReactiveMap.js";import{watch as p,whenOnce as u}from"../../core/reactiveUtils.js";import{normalize as f}from"../../core/urlUtils.js";import{property as m}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as g}from"../../core/support/UpdatingHandles.js";import{parse as w}from"../../layers/support/arcgisLayerUrl.js";import{isSubtypeGroupLayer as y,isFeatureLayer as S}from"../../layers/support/layerUtils.js";import I from"../../portal/Portal.js";import{hasUserTypeExtension as _}from"../../portal/support/utils.js";import b from"../../rest/featureService/FeatureService.js";import{ServiceVersionInfo as L}from"./ServiceVersionInfo.js";import V from"../../versionManagement/VersionManagementService.js";function U(e){return!e||0===e.trim().length}const A=new Map;function T(e){return a(A,e,(()=>{const i=new j({view:e});return e.addHandles({remove(){A.delete(e),i.destroy()}}),i.load().catch((e=>{o.getLogger("esri.views.Services").error("Failed to load service metadata",e)})),i}))}let j=class extends(t.LoadableMixin(d.EsriPromiseMixin(n.EventedAccessor))){constructor(e){super(e),this._updatingHandles=new g,this.items=new r,this.tablesAndLayersLookup=new l,this.additionalLayers=new r,this._debouncedCheckAndUpdateServiceInfos=c((async()=>{const e=[];for(const i of this.items){if(0===i.layersAndTables.length)continue;const r=i.layersAndTables.getItemAt(0);r?.gdbVersion!==i.versionInfo?.versionIdentifier.name&&e.push(i)}0!==e.length&&(await u((()=>!this.updating)),await this._updateVersionInfos(e))})),this._debouncedLayersChanged=c((async()=>{const e=this._detectNewLayersAndTables();0!==e.length&&(await u((()=>!this._updatingHandles.updating)),await this._updatingHandles.addPromise((async()=>{const i=new Set;for(const s of e)if("feature"===s.type||"subtype-group"===s.type){if(!s.url)continue;const e=w(s.url).url.path,n=this._findServiceInfo(e);if(n)this.tablesAndLayersLookup.set(s,n),s.isTable?n.tables.push(s):n.layers.push(s);else if(!i.has(e))try{await this._addServiceInfo(e,s)}catch(r){o.getLogger(this).error(`Failed to load feature service: ${e}`,r)}finally{i.add(e)}}})()))})),this._processed=new Set}destroy(){this._set("view",null),this.items.removeAll(),this.tablesAndLayersLookup.clear()}async load(e){return v(e),this.addHandles([p((()=>this._allLayersAndTables),(()=>{this._debouncedLayersChanged().catch((e=>{o.getLogger(this).warn("Failed to update service info",e)}))})),p((()=>this.items.map((e=>e.layersAndTables.map((e=>e.gdbVersion??"")).join(",")))),(()=>{this.checkAndUpdateServiceInfos().catch((e=>{o.getLogger(this).warn("Failed to update service info",e)}))}))]),this.addResolvingPromise(this._debouncedLayersChanged()),this}get updating(){return"loading"===this.loadStatus||this._updatingHandles.updating}checkAndUpdateServiceInfos(){return this._debouncedCheckAndUpdateServiceInfos()}changeVersion(e,i,r){return this._updatingHandles.addPromise((async()=>{await this._changeVersionInternal(e,i,r)})())}createVersion(e){return this._updatingHandles.addPromise((async()=>{const i=e.featureServerUrl,r=this._findServiceInfo(i);if(!r?.versionService)throw new s("services:no-version-management-service");const n=r.hasAdvancedEditingUserTypeExtension,t=r.loggedInServiceUser.toUpperCase(),o=U(e.ownerName)?t:e.ownerName?.trim().toUpperCase();if(o!==t){if(r.featureServiceVersion<=11.1)throw new s("services:versioning-api-error");if(!n)throw new s("services:no-advanced-editing-user-type-extension")}if("SDE"===o?.toUpperCase()&&"DEFAULT"===e.versionName.toUpperCase())throw new s("services:no-valid-version-name");{const i=await r.versionService.getVersionInfos();if(i?.find((i=>i.versionIdentifier.name.toUpperCase()===(o+"."+e.versionName).toUpperCase()||i.versionIdentifier.name.toUpperCase()===(t+"."+e.versionName).toUpperCase())))throw new s("services:no-valid-version-name")}const a=await r.versionService.createVersion({versionName:e.versionName,access:o!==t?"public":e.access,description:e.description});if(o!==t){const{guid:i,name:s}=a.versionIdentifier;await r.versionService.alterVersion({guid:i,name:s},{ownerName:o,access:e.access})}e.switchToVersion&&await this._changeVersionInternal(i,a.versionIdentifier.name,a.versionIdentifier.guid),this.emit("version-created",{versionIdentifier:a.versionIdentifier,versionManagementService:r.versionService})})())}deleteVersion(e,i,r){return this._updatingHandles.addPromise((async()=>{const n=this._findServiceInfo(e);if(!n?.versionService)throw new s("services:no-version-management-service");if(n.featureServiceVersion<=11.1)throw new s("services:versioning-api-error");if(!n.hasAdvancedEditingUserTypeExtension)throw new s("services:no-advanced-editing-user-type-extension");const t={name:i,guid:r};await n.versionService.deleteVersion(t)&&(await this._updateVersionInfo(n),this.emit("version-deleted",{versionIdentifier:t,versionManagementService:n.versionService}))})())}startEditing(e){return this._updatingHandles.addPromise((async()=>{const i=this._findServiceInfo(e);if(!i?.versionService)throw new s("services:no-version-management-service");if(!i.hasAdvancedEditingUserTypeExtension)throw new s("services:no-advanced-editing-user-type-extension");const r=i.versionInfo?.versionIdentifier??{name:i.versionService.defaultVersionIdentifier.name,guid:i.versionService.defaultVersionIdentifier.guid};let n=!0;("none"!==i.versionService.getLockType(r)||(n=await i.versionService.startReading(r),n))&&(n=await i.versionService.startEditing(r),i.updateLockType())})())}finishEditing(e,i){return this._updatingHandles.addPromise((async()=>{const r=this._findServiceInfo(e);if(!r?.versionService)throw new s("services:no-version-management-service");if(!r.hasAdvancedEditingUserTypeExtension)throw new s("services:no-advanced-editing-user-type-extension");const n=r.versionInfo?.versionIdentifier??{name:r.versionService.defaultVersionIdentifier.name,guid:r.versionService.defaultVersionIdentifier.guid},t=r.versionService.getLockType(n);if("none"!==t)return"read"===t?(await r.versionService.stopReading(n),void r.updateLockType()):"edit"===t?(await r.versionService.stopEditing(n,i),await r.versionService.stopReading(n),void r.updateLockType()):void 0})())}async _changeVersionInternal(e,i,r){const n=this._findServiceInfo(e);if(!n?.versionService)throw new s("services:no-version-management-service");const t=n.versionInfo?.versionIdentifier??{name:n.versionService.defaultVersionIdentifier.name,guid:n.versionService.defaultVersionIdentifier.guid},o={name:i,guid:r};await n.versionService.changeVersion(this.view?.map,t,o)&&await this._updateVersionInfo(n)}async _updateVersionInfo(e){const i=e.versionService;if(!i)return;if(0===e.layersAndTables.length)return;const r=e.layersAndTables.getItemAt(0)?.gdbVersion,s=r?await i.getVersionIdentifierFromName(r):i.defaultVersionIdentifier;e.versionInfo=await i.getVersionInfoExtended(s)}_findServiceInfo(e){return this.items.find((i=>i.featureService.url===e))??null}_removeFeatureService(e){this.items.remove(e)}async _findPortal(e){const r=i?.findServerInfo(e??"");if(!r?.owningSystemUrl)return null;const s=`${r.owningSystemUrl}/sharing/rest`,n=I.getDefault();if(n?.loaded&&f(n.restUrl)===f(s))return n;return new I({authMode:"immediate",url:r.owningSystemUrl}).load()}_updateVersionInfos(e){return this._updatingHandles.addPromise((async()=>{for(const i of e)await this._updateVersionInfo(i).catch((e=>{o.getLogger(this).error("Failed to update version details",e)}))})())}async _addServiceInfo(e,i){const s=new b({url:e});await s.load();const n=await this._findPortal(e),t=n?.user?.username;let o=!1;t&&(o=await _(n,t,"advediting"));let a=null;s.versionManagementServiceUrl&&(a=new V({url:s.versionManagementServiceUrl}),await a.load());const d=i.isTable?[]:[i],c=i.isTable?[i]:[],v=new L({loggedInServiceUser:t??"",hasAdvancedEditingUserTypeExtension:o,versionInfo:null,lockType:"none",canEditVersionedData:!0,canCreateVersion:!0,featureService:s,versionService:a,layers:new r(d),tables:new r(c)});return a&&await this._updateVersionInfo(v),this.items.push(v),this.tablesAndLayersLookup.set(i,v),i.isTable?v.tables.push(i):v.layers.push(i),v}get _allLayersAndTables(){return[...this.view.map.allLayers,...this.view.map.allTables,...this.additionalLayers]}_detectNewLayersAndTables(){const e=new Set(this._allLayersAndTables),i=[];for(const r of e)"feature"!==r.type&&"subtype-group"!==r.type||this._processed.has(r)||i.push(r);for(const r of this._processed)if(!e.has(r)&&(y(r)||S(r))){const e=this.tablesAndLayersLookup.get(r);if(!e)continue;this.tablesAndLayersLookup.delete(r),r.isTable?e.tables.remove(r):e.layers.remove(r),0===e.layersAndTables.length&&this._removeFeatureService(e)}return this._processed=e,i}};e([m({constructOnly:!0})],j.prototype,"view",void 0),e([m()],j.prototype,"items",void 0),e([m()],j.prototype,"tablesAndLayersLookup",void 0),e([m()],j.prototype,"additionalLayers",void 0),e([m()],j.prototype,"updating",null),e([m()],j.prototype,"_allLayersAndTables",null),j=e([h("esri.undoredo.support.Services")],j);export{j as Services,T as getServices};
|