@arcgis/core 4.26.0-next.20230112 → 4.26.0-next.20230113
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{4abb5627d06d329d2c0d.js → 028f9a133104e78e60d2.js} +1 -1
- package/assets/esri/core/workers/chunks/033e6ae5da6afebd993c.js +1 -0
- package/assets/esri/core/workers/chunks/{c9cc3d601f4a08162b69.js → 05ab092987251d4a1242.js} +1 -1
- package/assets/esri/core/workers/chunks/{6e6c8364baaeca09b501.js → 27ba1889fe9f1812389a.js} +21 -21
- package/assets/esri/core/workers/chunks/{e11e581b626a56adf6c6.js → 3b6748f414437cc6cfde.js} +1 -1
- package/assets/esri/core/workers/chunks/64f137358100a1c818f0.js +1 -0
- package/assets/esri/themes/base/widgets/_Editor.scss +1 -11
- package/assets/esri/themes/base/widgets/_ItemList.scss +0 -13
- 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/chunks/ComponentShader.glsl.js +1 -1
- package/chunks/Path.glsl.js +1 -1
- package/chunks/Terrain.glsl.js +1 -1
- package/interfaces.d.ts +1398 -1313
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/package.json +1 -1
- package/rest/imageService.js +1 -1
- package/rest/support/BaseImageMeasureResult.d.ts +4 -0
- package/rest/support/ImageAreaParameters.d.ts +4 -0
- package/rest/support/{ImageMeasureAreaAndPerimeterParameters.js → ImageAreaParameters.js} +1 -1
- package/rest/support/ImageAreaResult.d.ts +4 -0
- package/rest/support/{ImageMeasureAreaAndPerimeterResult.js → ImageAreaResult.js} +1 -1
- package/rest/support/ImageDistanceParameters.d.ts +4 -0
- package/rest/support/{ImageMeasureDistanceAndAngleParameters.js → ImageDistanceParameters.js} +1 -1
- package/rest/support/ImageDistanceResult.d.ts +4 -0
- package/rest/support/ImageDistanceResult.js +5 -0
- package/rest/support/ImageHeightParameters.d.ts +4 -0
- package/rest/support/{ImageMeasureHeightParameters.js → ImageHeightParameters.js} +1 -1
- package/rest/support/ImageHeightResult.d.ts +4 -0
- package/rest/support/{ImageMeasureHeightResult.js → ImageHeightResult.js} +1 -1
- package/rest/support/ImagePointParameters.d.ts +4 -0
- package/rest/support/{ImageMeasurePointParameters.js → ImagePointParameters.js} +1 -1
- package/rest/support/ImagePointResult.d.ts +4 -0
- package/rest/support/{ImageMeasurePointResult.js → ImagePointResult.js} +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/webgl/Overlay.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/layers/VectorTileLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/state/ViewState.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/terrain/Overlay.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/output/OutputDepth.glsl.js +1 -1
- package/views/3d/webgl-engine/lib/AnimationTimeStep.js +5 -0
- package/views/3d/webgl-engine/lib/AnimationTimer.js +1 -1
- package/views/3d/webgl-engine/lib/GLMaterial.js +1 -1
- package/views/3d/webgl-engine/lib/Material.js +1 -1
- package/views/3d/webgl-engine/lib/RenderFeature.js +5 -0
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/Texture.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/webgl/RenderingContext.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
- package/widgets/FeatureTemplates/ItemList.js +1 -1
- package/widgets/FeatureTemplates/TemplateItem.js +1 -1
- package/widgets/FeatureTemplates/TemplateItemGroup.js +1 -1
- package/widgets/FeatureTemplates.js +1 -1
- package/widgets/support/decorators/accessibleHandler.js +1 -1
- package/assets/esri/core/workers/chunks/080a4be417be4943f6a0.js +0 -1
- package/assets/esri/core/workers/chunks/bf20831b3efe169d4cb8.js +0 -1
- package/rest/support/ImageMeasureDistanceAndAngleResult.js +0 -5
- package/views/3d/support/animationUtils.js +0 -5
- package/views/3d/webgl-engine/lib/RenderStateFeature.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.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../Graphic.js";import t from"../request.js";import has from"../core/has.js";import r from"../core/Logger.js";import{isSome as i,removeMaybe as s,isNone as a}from"../core/maybe.js";import{isAbortError as n}from"../core/promiseUtils.js";import{watch as o}from"../core/reactiveUtils.js";import{i as l}from"../chunks/vec3.js";import{c as h}from"../chunks/vec3f64.js";import{renderSRFromViewSR as d}from"../geometry/support/coordinateSystem.js";import{PointIndex as _,PlaneIndex as u}from"../geometry/support/frustum.js";import{WasmCullMode as c,VoxelRequestType as m,UpdateFlags as g,ContainerType as x}from"../libs/vxl/enums.js";import{loadVoxelWASM as p}from"../libs/vxl/VxlModule.js";import{ViewingMode as f}from"../views/ViewingMode.js";import{VoxelTarget as y}from"../views/3d/layers/i3s/Intersector.js";import{Frustum as v}from"../views/3d/state/Frustum.js";import{RenderCoordsHelper as b}from"../views/3d/support/RenderCoordsHelper.js";import{ShaderOutput as w}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js";import{newIntersectorResult as T}from"../views/3d/webgl-engine/lib/Intersector.js";import{IntersectorType as R,StoreResults as E}from"../views/3d/webgl-engine/lib/IntersectorInterfaces.js";import{RenderSlot as L}from"../views/3d/webgl-engine/lib/RenderSlot.js";import{RenderStateFeature as F}from"../views/3d/webgl-engine/lib/RenderStateFeature.js";import{ContextType as C}from"../views/webgl/context-util.js";import{CompareFunction as V,Face as S,StencilOperation as U}from"../views/webgl/enums.js";const P=r.getLogger("esri.layers.VoxelWasmPerSceneView");var I;!function(e){e[e.Lifetime=1]="Lifetime",e[e.RequestResponse=2]="RequestResponse",e[e.Rendering=3]="Rendering",e[e.Error=4]="Error"}(I||(I={}));class k{constructor(e){this._halfIntTexturesAvailable=!1,this._textureFloatLinearAvailable=!1,this._havePreparedWithAllLayers=!1,this._renderPluginContext=null,this._vxl=null,this._pluginIsActive=!1,this._moreToLoad=!1,this._viewportWidth=-1,this._viewportHeight=-1,this._newLayers=[],this._layers=new Map,this._shaderOutput=w.Color,this._renderSlot=L.VOXEL,this._rctx=null,this._renderTargetToRestore=null,this._lastFrameWasStationary=!1,this._wasmMemBlockSizes=[512,1024,2048,4096,8192,16384,32768,65536],this._wasmMemBlocks=new Map,this._dbgFlags=new Set,this._captureFrustum=!1,this._frustum=null,this._frustumRenderableId=-1,this._renderCoordsHelper=null,this.type=R.VOXEL,this.slicePlaneEnabled=!0,this.isGround=!1,this.layerUid=[],this._view=e,this._initialize()}get canRender(){return!!this._vxl&&"local"===this._view.viewingMode}_dbg(e,t){this._dbgFlags.has(e)&&(e===I.Error?P.error(t):P.warn(t))}_removeRenderPlugin(){this._pluginIsActive&&this._view._stage&&(this._dbg(I.Lifetime,"--removeRenderPlugin--"),this._view._stage.removeRenderPlugin(this)),this._pluginIsActive=!1}_initialize(){this._dbg(I.Lifetime,"--initialize--");for(const e of this._wasmMemBlockSizes)this._wasmMemBlocks.set(e,0);this._readyWatchHandle=o((()=>this._view.ready),(e=>{e&&"local"===this._view.viewingMode?(this._dbg(I.Lifetime,"view ready status changed to ready on a local view, calling addRenderPlugin"),this._view._stage.addRenderPlugin([this._renderSlot],this),this._pluginIsActive=!0):(this._dbg(I.Lifetime,"view ready status changed, not ready or not a local view!"),this._removeRenderPlugin())}),{initial:!0}),this._qualityWatchHandle=o((()=>this._view?.qualityProfile),(e=>{this._dbg(I.Rendering,"qualityProfile changed to "+e),this._vxl&&this._vxl.set_quality(this._toWasmQuality(e))}),{initial:!0}),this._timeExtentWatchHandle=o((()=>this._view?.timeExtent),(()=>{if(this._vxl){const e=this._getTimeArgs(this._view?.timeExtent);this._dbg(I.Rendering,"sceneView timeExtent changed to useTime="+e.useTime+" st="+e.startTime+" et="+e.endTime),this._vxl.set_scene_time_extent(e.startTime,e.endTime,e.useTime),this._renderPluginContext.requestRender()}}),{initial:!0}),this._stationaryWatchHandle=o((()=>this._view?.stationary),(e=>{this._vxl&&e&&!this._lastFrameWasStationary&&this._renderPluginContext.requestRender()}))}initializeRenderContext(e){this._dbg(I.Lifetime,"--initializeRenderContext--");const t=e.renderContext.rctx;t.type===C.WEBGL2?(this._renderPluginContext=e,this._rctx=e.renderContext.rctx,this._halfIntTexturesAvailable=!!this._rctx.capabilities.textureNorm16,this._textureFloatLinearAvailable=this._rctx.capabilities.textureFloatLinear,this._initializeWasm(t.gl)):this._dbg(I.Error,"WebGL 1 context only!")}uninitializeRenderContext(){this._renderPluginContext=null,this._rctx=null,this._dbg(I.Lifetime,"--uninitializeRenderContext--")}_restoreFramebuffer(){if(!this._renderTargetToRestore)return;const e=this._renderTargetToRestore.fbo;if(!!!this._rctx)return void this._dbg(I.Error,"no context in restoreFramebuffer!");this._rctx.bindFramebuffer(e,!0);const t=this._renderTargetToRestore.viewport;this._rctx.setViewport(t.x,t.y,t.width,t.height)}_bindPreviousDepthToSlot(e,t){const r=!!this._rctx,i=!!this._renderTargetToRestore;if(!r||!i)return 0;const s=this._renderTargetToRestore.fbo.depthStencilTexture;return s?(0===t?this._rctx.bindTexture(null,e,!0):this._rctx.bindTexture(s,e,!0),1):(this._dbg(I.Error,"no depth/stencil texture exists!"),0)}_modifyResourceCount(e,t,r){if(!this._rctx)return void this._dbg(I.Error,"modifyAllocation callback has no rendering context!");const i=e;1===r?this._rctx.instanceCounter.increment(i,t):this._rctx.instanceCounter.decrement(i,t)}_setBlendState(e,t,r,i){this._rctx?(this._rctx.setBlendingEnabled(1===e),this._rctx.setBlendFunction(t,r),this._rctx.setBlendEquation(i)):this._dbg(I.Error,"setBlendState callback has no rendering context!")}_setFrontFace(e){this._rctx?this._rctx.setFrontFace(e):this._dbg(I.Error,"setFrontFace callback has no rendering context!")}_setDepthStencilStateFunction(e,t,r){this._rctx?(this._rctx.setDepthFunction(r),this._rctx.setDepthTestEnabled(1===e),this._rctx.setDepthWriteEnabled(1===t),this._rctx.setStencilTestEnabled(!1),this._rctx.setStencilFunction(V.ALWAYS,0,255),this._rctx.setStencilOpSeparate(S.FRONT,U.KEEP,U.INCR,U.KEEP),this._rctx.setStencilOpSeparate(S.BACK,U.KEEP,U.DECR,U.KEEP)):this._dbg(I.Error,"setDepthStencilStateFunction callback has no rendering context!")}_setRasterizerState(e){if(this._rctx)switch(e){case c.None:this._rctx.setFaceCullingEnabled(!1);break;case c.Back:this._rctx.setCullFace(S.BACK),this._rctx.setFaceCullingEnabled(!0);break;case c.Front:this._rctx.setCullFace(S.FRONT),this._rctx.setFaceCullingEnabled(!0)}else this._dbg(I.Error,"setRasterizerState callback has no rendering context!")}_setViewport(e,t,r,i){this._rctx?this._rctx.setViewport(e,t,r,i):this._dbg(I.Error,"setViewport callback has no rendering context!")}_updateMemoryUsage(){this._layers.forEach(((e,t)=>{if(e.needMemoryUsageUpdate){const r=this._vxl.estimate_memory_usage(t);r>=0&&(e.needMemoryUsageUpdate=!1,e.layerView.setUsedMemory(r))}}))}_syncRequestsResponses(){this._layers.forEach(((e,r)=>{const i=[];e.responses.forEach(((t,s)=>{i.push(s),this._dbg(I.RequestResponse,"responding for requestID:"+s+" size:"+t.size),this._vxl.respond(r,s,t),t.requestType!==m.TreeIndex&&t.requestType!==m.Section||(e.needMemoryUsageUpdate=!0)}));const s=e.responses;for(const t of i)s.delete(t);const a=this._vxl.get_new_requests(r),o=e.abortController.signal;for(const l in a){e.outstandingRequestCount+=1,1===e.outstandingRequestCount&&e.layerView.updatingFlagChanged();const r=a[l],i={responseType:"array-buffer",signal:o};this._dbg(I.RequestResponse,"making requestID:"+l+" url:"+r.url),t(r.url,i).then((t=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),this._dbg(I.RequestResponse,"have response for requestID:"+l);let i=0;if(t.data.byteLength>0){i=this._vxl._malloc(t.data.byteLength);const e=new Uint8Array(this._vxl.HEAPU8.buffer,i,t.data.byteLength),r=new Uint8Array(t.data);for(let i=0;i<t.data.byteLength;++i)e[i]=r[i]}s.set(+l,{responseType:r.responseType,ptr:i,size:t.data.byteLength,success:!0,requestType:r.requestType})})).catch((t=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),n(t)||(this._dbg(I.Error,`requestID:${l} failed, error=${t.toString()}`),s.set(+l,{responseType:r.responseType,ptr:0,size:0,success:!1,requestType:r.requestType}))}))}}))}updateWasmCamera(e){this._vxl.set_projection_matrix.apply(this._vxl,e.projectionMatrix),this._vxl.set_view_matrix.apply(this._vxl,e.viewMatrix),this._vxl.set_near_far(e.near,e.far)}isUpdating(e){return!(this._vxl||!this._vxlPromise)||!!this._layers.has(e)&&this._layers.get(e).outstandingRequestCount>0}getLayerTimes(e){const t=[];return this._layers.forEach(((r,i)=>{if(r.layerView.wasmLayerId===e.wasmLayerId){const r=this._vxl.get_layer_epoch_times(i,e.layer.currentVariableId);for(let e=0;e<r.length;++e)t.push(r[e])}})),t}getCurrentLayerTimeIndex(e){let t=0;return this._layers.forEach(((r,i)=>{r.layerView.wasmLayerId===e.wasmLayerId&&(t=this._vxl.get_layer_current_time_id(i))})),t}setEnabled(e,t){this._layers.forEach(((r,i)=>{r.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl.set_enabled(i,t),r.needMemoryUsageUpdate=!0,this._renderPluginContext.requestRender())}))}setStaticSections(e,t){const r={mask:g.StaticSections,staticSections:t};return this._doMaskedUIUpdate(e,r,!0)}setCurrentVariable(e,t){const r={mask:g.CurrentVariable,currentVariable:t};return this._doMaskedUIUpdate(e,r,!0)}setRenderMode(e,t){const r={mask:g.RenderMode,renderMode:t};return this._doMaskedUIUpdate(e,r,!0)}setVerticalExaggerationAndOffset(e,t,r,i){const s={mask:g.ExaggerationAndOffset,volStyleDesc:{volumeId:t,verticalExaggeration:r,verticalOffset:i}};return this._doMaskedUIUpdate(e,s,!0)}setVariableStyles(e,t){const r={mask:g.VariableStyles,variableStyles:t};return this._doMaskedUIUpdate(e,r,!0)}setVolumeStyles(e,t){const r={mask:g.VolumeStyles,volumeStyles:t};return this._doMaskedUIUpdate(e,r,!0)}setEnableDynamicSections(e,t){const r={mask:g.ContainerVisibility,containerIsVisible:t,container:x.DynamicSections};return this._doMaskedUIUpdate(e,r,!0)}setEnableIsosurfaces(e,t){const r={mask:g.ContainerVisibility,containerIsVisible:t,container:x.Isosurfaces};return this._doMaskedUIUpdate(e,r,!0)}setEnableSections(e,t){const r={mask:g.ContainerVisibility,containerIsVisible:t,container:x.StaticSections};return this._doMaskedUIUpdate(e,r,!0)}setAnalysisSlice(e,t,r,i){const s={mask:g.AnalysisSlice,analysisSlice:{point:r,normal:i,enabled:t}};return this._doMaskedUIUpdate(e,s,!0)}_doMaskedUIUpdate(e,t,r){if(!this._vxl)return!1;let i=!1;return this._layers.forEach(((r,s)=>{if(r.layerView.wasmLayerId===e.wasmLayerId){const e={str:JSON.stringify(t),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(i=1===this._vxl.handle_masked_ui_update(s,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}})),i&&r&&this._renderPluginContext.requestRender(),i}_addTriangleToWasmBuffer(e,t,r,i,s){return e[3*t+0]=r[0],e[3*t+1]=r[1],e[3*t+2]=r[2],e[3*(t+=1)+0]=i[0],e[3*t+1]=i[1],e[3*t+2]=i[2],e[3*(t+=1)+0]=s[0],e[3*t+1]=s[1],e[3*t+2]=s[2],t+=1}_addNormalToWasmBuffer(e,t,r){return e[3*t+0]=r[0],e[3*t+1]=r[1],e[3*t+2]=r[2],t+=1}_doCaptureFrustum(){if(!this._vxl)return;const e=36,t=e/3,r=this._vxl._malloc(3*e*Float32Array.BYTES_PER_ELEMENT),i=new Float32Array(this._vxl.HEAPF32.buffer,r,3*e),s=this._vxl._malloc(3*t*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(this._vxl.HEAPF32.buffer,s,e),n=this._frustum.points[_.NEAR_BOTTOM_LEFT],o=this._frustum.points[_.NEAR_BOTTOM_RIGHT],l=this._frustum.points[_.NEAR_TOP_RIGHT],h=this._frustum.points[_.NEAR_TOP_LEFT],d=this._frustum.points[_.FAR_BOTTOM_LEFT],c=this._frustum.points[_.FAR_BOTTOM_RIGHT],m=this._frustum.points[_.FAR_TOP_RIGHT],g=this._frustum.points[_.FAR_TOP_LEFT];let x=0,p=0;const f=this._frustum.planes[u.NEAR];x=this._addTriangleToWasmBuffer(i,x,l,o,n),p=this._addNormalToWasmBuffer(a,p,f),x=this._addTriangleToWasmBuffer(i,x,n,h,l),p=this._addNormalToWasmBuffer(a,p,f);const y=this._frustum.planes[u.FAR];x=this._addTriangleToWasmBuffer(i,x,d,c,m),p=this._addNormalToWasmBuffer(a,p,y),x=this._addTriangleToWasmBuffer(i,x,m,g,d),p=this._addNormalToWasmBuffer(a,p,y);const v=this._frustum.planes[u.TOP];x=this._addTriangleToWasmBuffer(i,x,m,l,h),p=this._addNormalToWasmBuffer(a,p,v),x=this._addTriangleToWasmBuffer(i,x,h,g,m),p=this._addNormalToWasmBuffer(a,p,v);const b=this._frustum.planes[u.BOTTOM];x=this._addTriangleToWasmBuffer(i,x,n,o,c),p=this._addNormalToWasmBuffer(a,p,b),x=this._addTriangleToWasmBuffer(i,x,c,d,n),p=this._addNormalToWasmBuffer(a,p,b);const w=this._frustum.planes[u.LEFT];x=this._addTriangleToWasmBuffer(i,x,h,n,d),p=this._addNormalToWasmBuffer(a,p,w),x=this._addTriangleToWasmBuffer(i,x,d,g,h),p=this._addNormalToWasmBuffer(a,p,w);const T=this._frustum.planes[u.RIGHT];x=this._addTriangleToWasmBuffer(i,x,l,m,c),p=this._addNormalToWasmBuffer(a,p,T),x=this._addTriangleToWasmBuffer(i,x,c,o,l),p=this._addNormalToWasmBuffer(a,p,T),-1!==this._frustumRenderableId&&this._vxl.remove_generic_mesh(this._frustumRenderableId),this._frustumRenderableId=this._vxl.add_generic_mesh(r,3*e,s,e,255,0,0,64),this._vxl._free(r),this._vxl._free(s),this._captureFrustum=!1,this._renderPluginContext.requestRender()}captureFrustum(){null===this._renderCoordsHelper&&(this._renderCoordsHelper=b.create(f.Local,d(!1,this._view.spatialReference))),null===this._frustum&&(this._frustum=new v(this._renderCoordsHelper)),this._captureFrustum=!0,null!==this._renderPluginContext&&this._renderPluginContext.requestRender()}toggleFullVolumeExtentDraw(e){this._vxl&&this._layers.forEach(((t,r)=>{t.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl.toggle_full_volume_extent_draw(r),this._renderPluginContext.requestRender())}))}addVoxelLayer(e){if(!this._vxl){const t={layerView:e,resolveCallback:null,rejectCallback:null},r=new Promise(((e,r)=>{t.resolveCallback=e,t.rejectCallback=r}));return this._newLayers.push(t),r}const t=this._addVoxelLayer(e);return t<0?Promise.reject(-1):Promise.resolve(t)}removeVoxelLayer(e){if(!this._vxl){const t=this._newLayers.findIndex((t=>e.uid===t.layerView.uid));t>=0&&(this._newLayers[t].resolveCallback(-1),this._newLayers.splice(t,1));const r=this._newLayers.length;return 0===r&&(this._dbg(I.Lifetime," no voxel layers left after removing a layer, removing RenderPlugin and destroying"),this.destroy()),r}let t=-1;this._layers.forEach(((r,i)=>{if(r.layerView.wasmLayerId===e.wasmLayerId){t=i,r.abortController.abort(),this._vxl.remove_layer(t);const s=this.layerUid.indexOf(e.layer.uid);-1!==s&&this.layerUid.splice(s,1)}})),t>=0&&this._layers.delete(t);const r=this._layers.size;return 0===r&&(this._dbg(I.Lifetime," no voxel layers left after removing a layer, removing RenderPlugin and destroying"),this.destroy()),r}_getBlockSize(e){for(const t of this._wasmMemBlockSizes)if(e<t)return t;return-1}_allocateBlock(e){e.byteCount=this._vxl.lengthBytesUTF8(e.str)+1;const t=this._getBlockSize(e.byteCount);return t<0?(e.isReusable=!1,e.ptr=this._vxl._malloc(e.byteCount)):(e.isReusable=!0,e.ptr=this._wasmMemBlocks.get(t),0===e.ptr&&(e.ptr=this._vxl._malloc(t),this._wasmMemBlocks.set(t,e.ptr))),0!==e.ptr&&(this._vxl.stringToUTF8(e.str,e.ptr,e.byteCount),!0)}_getTimeArgs(e){let t=-Number.MAX_VALUE,r=Number.MAX_VALUE,s=!1;return i(e)&&(e.isAllTime?s=!0:(i(e.start)&&(s=!0,t=e.start.getTime()/1e3),i(e.end)&&(s=!0,r=e.end.getTime()/1e3))),{startTime:t,endTime:r,useTime:s}}_addVoxelLayer(e){const t=e.layer;let r=-1;const i=t.getConfiguration();if(i.length<1)return-1;const s={str:i,byteCount:0,ptr:0,isReusable:!1};if(!this._allocateBlock(s))return-1;const a=this._getTimeArgs(this._view?.timeExtent),n=this._view.spatialReference.isWGS84&&t.spatialReference.isWGS84?111319.49079327357:1;if(r=this._vxl.add_layer(t.serviceRoot,s.ptr,s.byteCount,n,n,a.startTime,a.endTime,a.useTime,this._toWasmQuality(this._view.qualityProfile)),s.isReusable||this._vxl._free(s.ptr),r>=0){t.test?.constantUpscaling&&(this._setUpscalingLimits(0,.25,.25),this._setUpscalingLimits(1,.5,.5),this._setUpscalingLimits(2,.75,.75));const i=new AbortController;if(this._layers.set(r,{layerView:e,responses:new Map,outstandingRequestCount:0,abortController:i,needMemoryUsageUpdate:!1}),this.layerUid.push(e.layer.uid),!this._halfIntTexturesAvailable||has("mac")){const t=[];let r="";for(const i of e.layer.variables)"Int16"!==i.renderingFormat.type&&"UInt16"!==i.renderingFormat.type||(t.push(i.name),i.id===e.layer.currentVariableId&&(r=i.name));""!==r&&P.error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${r}' in this browser`),t.length>0&&P.warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}if(!this._textureFloatLinearAvailable){const t=[];let r="";for(const i of e.layer.variables)"Float32"===i.renderingFormat.type&&(t.push(i.name),i.id===e.layer.currentVariableId&&(r=i.name));""!==r&&P.error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${r}' in this browser`),t.length>0&&P.warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}return has("esri-mobile")&&P.warnOnce("Mobile support differs across devices. Voxel layer might not display as expected."),r}return-1}prepareRender(e){if(!this._vxl)return;const t=e.bindParameters.camera.viewForward,r=e.bindParameters.camera.eye;this._vxl.update_camera_pos_and_direction(r[0],r[1],r[2],t[0],t[1],t[2]);const i=this._vxl.cull();this._dbg(I.RequestResponse,"missingResourceCount="+i),this._moreToLoad=i>0,this._havePreparedWithAllLayers=0===this._newLayers.length,this._updateMemoryUsage()}render(e){if(!this._vxl||e.output!==this._shaderOutput||e.bindParameters.slot!==this._renderSlot)return;for(const r of this._newLayers){const e=this._addVoxelLayer(r.layerView);-1===e?r.rejectCallback(-1):r.resolveCallback(e)}if(this._newLayers=[],0===this._layers.size)return void this._dbg(I.Error,"No voxel layers but RenderPlugin instance is being asked to render!");this._renderTargetToRestore={fbo:this._rctx.getBoundFramebufferObject(),viewport:this._rctx.getViewport()},this._syncRequestsResponses(),this._lastFrameWasStationary=this._view.stationary,this._rctx.setPolygonOffsetFillEnabled(!1),this._rctx.setScissorTestEnabled(!1),this._rctx.setColorMask(!0,!0,!0,!0),this._vxl.begin_color_frame(!this._view._stage.renderer.isFeatureEnabled(F.HighQualityVoxel),e.bindParameters.lighting.mainLight.direction[0],e.bindParameters.lighting.mainLight.direction[1],e.bindParameters.lighting.mainLight.direction[2]);const t=this._renderTargetToRestore.viewport;t.width===this._viewportWidth&&t.height===this._viewportHeight||(this._viewportWidth=t.width,this._viewportHeight=t.height,this._vxl.set_viewport(t.width,t.height),this._layers.forEach((e=>{e.needMemoryUsageUpdate=!0}))),0===t.x&&0===t.y||this._dbg(I.Error,"Unsupported viewport parameters detected!"),this.updateWasmCamera(e.bindParameters.camera),this._captureFrustum&&(this._frustum.update(e.bindParameters.camera),this._doCaptureFrustum()),this._vxl.draw(),this._renderTargetToRestore.fbo=null,e.rctx.externalTextureUnitUpdate(this._vxl.get_texture_units_bound_in_frame(),this._vxl.get_active_texture_unit()),e.rctx.externalVertexArrayObjectUpdate(),e.rctx.externalVertexBufferUpdate(),this._rctx.externalProgramUpdate(),(this._moreToLoad||!this._havePreparedWithAllLayers&&this._layers.size>0)&&this._renderPluginContext.requestRender()}destroy(){this._dbg(I.Lifetime,"--destroy--"),this._removeRenderPlugin(),this._readyWatchHandle=s(this._readyWatchHandle),this._qualityWatchHandle=s(this._qualityWatchHandle),this._timeExtentWatchHandle=s(this._timeExtentWatchHandle),this._stationaryWatchHandle=s(this._stationaryWatchHandle),this._vxl&&(this._layers.forEach((e=>{e.abortController.abort()})),this._wasmMemBlocks.forEach((e=>{0!==e&&this._vxl._free(e)})),this._vxl.uninitialize_voxel_wasm(),this._vxl=null)}_initializeWasm(e){return this._vxl?Promise.resolve():(this._vxlPromise||(this._vxlPromise=p(e).then((e=>{if(this._vxl=e,this._vxlPromise=null,this._newLayers.length<=0)return this._dbg(I.Lifetime," no voxel layers left after WASM downloaded, removing RenderPlugin and destroying"),void this.destroy();const t=this._getTimeArgs(this._view?.timeExtent),r=this._vxl.addFunction(this._restoreFramebuffer.bind(this),"v"),i=this._vxl.addFunction(this._setBlendState.bind(this),"viiii"),s=this._vxl.addFunction(this._setFrontFace.bind(this),"vi"),a=this._vxl.addFunction(this._setRasterizerState.bind(this),"vi"),n=this._vxl.addFunction(this._setDepthStencilStateFunction.bind(this),"viii"),o=this._vxl.addFunction(this._setViewport.bind(this),"viiii"),l=this._vxl.addFunction(this._bindPreviousDepthToSlot.bind(this),"iii"),h=this._vxl.addFunction(this._modifyResourceCount.bind(this),"viii"),d=this._halfIntTexturesAvailable&&!has("mac"),_=this._textureFloatLinearAvailable;this._vxl.initialize_voxel_wasm(r,i,s,a,n,o,l,h,t.startTime,t.endTime,t.useTime,d,_),this._renderPluginContext&&this._renderPluginContext.requestRender()})).catch((()=>{for(const e of this._newLayers)e.rejectCallback(-2);this._dbg(I.Error," WASM failed to download, removing RenderPlugin and destroying"),this.destroy()}))),this._vxlPromise)}pickDepth(e,t,r){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const i=r.viewport[3]-t;if(e<0||e>r.viewport[2]||t<0||t>r.viewport[3])return this._dbg(I.Error,`[js] pickDepth: outOfRange, screenXY=[${e.toFixed(0)}, ${i.toFixed(0)}]]`),null;this._renderTargetToRestore={fbo:this._rctx.getBoundFramebufferObject(),viewport:this._rctx.getViewport()};const s=r.viewForward,a=r.eye;this._vxl.update_camera_pos_and_direction(a[0],a[1],a[2],s[0],s[1],s[2]),this.updateWasmCamera(r),this._vxl.begin_frame();const n=this._vxl.pick_depth(e,i);if(this._renderTargetToRestore.fbo=null,this._rctx.externalTextureUnitUpdate(this._vxl.get_texture_units_bound_in_frame(),this._vxl.get_active_texture_unit()),this._rctx.externalVertexArrayObjectUpdate(),this._rctx.externalVertexBufferUpdate(),this._rctx.externalProgramUpdate(),n.success){return n.distanceToCamera}return null}pickObject(e,t,r,i){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const s=Math.round(e),a=Math.round(t);if(s<0||s>r.viewport[2]||a<0||a>r.viewport[3])return this._dbg(I.Error,`[js] pickObject: outOfRange, screenXY=[${s}, ${a}], vp=[${r.viewport.toString()}]`),null;this._renderTargetToRestore={fbo:this._rctx.getBoundFramebufferObject(),viewport:this._rctx.getViewport()};const n=r.viewForward,o=r.eye;this._vxl.update_camera_pos_and_direction(o[0],o[1],o[2],n[0],n[1],n[2]),this.updateWasmCamera(r),this._vxl.begin_frame();let l=null;if(0===i.length)l=this._vxl.pick_object(s,a,0,0);else{const e={str:JSON.stringify({layerIds:i}),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(l=this._vxl.pick_object(s,a,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}return this._renderTargetToRestore.fbo=null,this._rctx.externalTextureUnitUpdate(this._vxl.get_texture_units_bound_in_frame(),this._vxl.get_active_texture_unit()),this._rctx.externalVertexArrayObjectUpdate(),this._rctx.externalVertexBufferUpdate(),this._rctx.externalProgramUpdate(),l}intersect(e,t,r,i,s){if(!this._vxl||!this._rctx||0===this._layers.size||!e.options.selectionMode||e.options.isFiltered)return;if(s[0]<0||s[0]>e.camera.viewport[2]||s[1]<0||s[1]>e.camera.viewport[3])return this._dbg(I.Error,`[js] VoxelWasmPerScene.intersect: outOfRange, screenXY=[${s[0].toFixed(0)}, ${s[1].toFixed(0)}]`),null;const n=[];this._layers.forEach((t=>{e.options.filteredLayerUids.includes(t.layerView.layer.uid)&&n.push(t.layerView.wasmLayerId)}));const o=this.pickObject(s[0],s[1],e.camera,n);if(a(o)||-1===o.layerId)return;const d=this._layers.get(o.layerId);if(d){const t=d.layerView.layer.uid,s=o.distanceToCamera/l(r,i),a=h();a[0]=o.worldX,a[1]=o.worldY,a[2]=o.worldZ;const n={};if(0===o.uniqueValue.length?n["Voxel.ServiceValue"]=`${o.continuousValue.toLocaleString()} ${o.continuousValueUnits}`:n["Voxel.ServiceValue"]=o.uniqueValue,n["Voxel.ServiceVariableLabel"]=o.variableLabel,n["Voxel.Position"]=o.voxelSpacePosition,o.nativeTime.length>0){const e=new Date(o.epochTime);n["Voxel.ServiceLocalTime"]=e.toString(),n["Voxel.ServiceNativeTime"]=o.nativeTime}o.hasDepth&&(n["Voxel.ServiceDepth"]=`${o.depth.toLocaleString()} ${o.depthUnits}`);const _=e=>{const r=new y(a,t,(()=>this._createVoxelGraphic(d.layerView.layer,n)));e.set(this.type,r,s,null)},u=e.results,c=e.options.store===E.ALL;if((null==u.min.dist||s<u.min.dist)&&_(u.min),(null==u.max.dist||s>u.max.dist)&&_(u.max),c){const t=T(e.ray);_(t),e.results.all.push(t)}}}_createVoxelGraphic(t,r){return new e({layer:t,sourceLayer:t,attributes:r})}_toWasmQuality(e){switch(e){case"low":return 0;case"medium":return 1;case"high":return 2}}_setUpscalingLimits(e,t,r){this._vxl&&this._vxl.set_upscaling_limits(e,t,r)}}export{k as default};
|
|
5
|
+
import e from"../Graphic.js";import t from"../request.js";import has from"../core/has.js";import r from"../core/Logger.js";import{isSome as i,removeMaybe as s,isNone as a}from"../core/maybe.js";import{isAbortError as n}from"../core/promiseUtils.js";import{watch as o}from"../core/reactiveUtils.js";import{i as l}from"../chunks/vec3.js";import{c as h}from"../chunks/vec3f64.js";import{renderSRFromViewSR as d}from"../geometry/support/coordinateSystem.js";import{PointIndex as _,PlaneIndex as u}from"../geometry/support/frustum.js";import{WasmCullMode as c,VoxelRequestType as m,UpdateFlags as g,ContainerType as x}from"../libs/vxl/enums.js";import{loadVoxelWASM as p}from"../libs/vxl/VxlModule.js";import{ViewingMode as f}from"../views/ViewingMode.js";import{VoxelTarget as y}from"../views/3d/layers/i3s/Intersector.js";import{Frustum as v}from"../views/3d/state/Frustum.js";import{RenderCoordsHelper as b}from"../views/3d/support/RenderCoordsHelper.js";import{ShaderOutput as w}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js";import{newIntersectorResult as T}from"../views/3d/webgl-engine/lib/Intersector.js";import{IntersectorType as R,StoreResults as E}from"../views/3d/webgl-engine/lib/IntersectorInterfaces.js";import{RenderFeature as L}from"../views/3d/webgl-engine/lib/RenderFeature.js";import{RenderSlot as F}from"../views/3d/webgl-engine/lib/RenderSlot.js";import{ContextType as C}from"../views/webgl/context-util.js";import{CompareFunction as V,Face as S,StencilOperation as U}from"../views/webgl/enums.js";const P=r.getLogger("esri.layers.VoxelWasmPerSceneView");var I;!function(e){e[e.Lifetime=1]="Lifetime",e[e.RequestResponse=2]="RequestResponse",e[e.Rendering=3]="Rendering",e[e.Error=4]="Error"}(I||(I={}));class k{constructor(e){this._halfIntTexturesAvailable=!1,this._textureFloatLinearAvailable=!1,this._havePreparedWithAllLayers=!1,this._renderPluginContext=null,this._vxl=null,this._pluginIsActive=!1,this._moreToLoad=!1,this._viewportWidth=-1,this._viewportHeight=-1,this._newLayers=[],this._layers=new Map,this._shaderOutput=w.Color,this._renderSlot=F.VOXEL,this._rctx=null,this._renderTargetToRestore=null,this._lastFrameWasStationary=!1,this._wasmMemBlockSizes=[512,1024,2048,4096,8192,16384,32768,65536],this._wasmMemBlocks=new Map,this._dbgFlags=new Set,this._captureFrustum=!1,this._frustum=null,this._frustumRenderableId=-1,this._renderCoordsHelper=null,this.type=R.VOXEL,this.slicePlaneEnabled=!0,this.isGround=!1,this.layerUid=[],this._view=e,this._initialize()}get canRender(){return!!this._vxl&&"local"===this._view.viewingMode}_dbg(e,t){this._dbgFlags.has(e)&&(e===I.Error?P.error(t):P.warn(t))}_removeRenderPlugin(){this._pluginIsActive&&this._view._stage&&(this._dbg(I.Lifetime,"--removeRenderPlugin--"),this._view._stage.removeRenderPlugin(this)),this._pluginIsActive=!1}_initialize(){this._dbg(I.Lifetime,"--initialize--");for(const e of this._wasmMemBlockSizes)this._wasmMemBlocks.set(e,0);this._readyWatchHandle=o((()=>this._view.ready),(e=>{e&&"local"===this._view.viewingMode?(this._dbg(I.Lifetime,"view ready status changed to ready on a local view, calling addRenderPlugin"),this._view._stage.addRenderPlugin([this._renderSlot],this),this._pluginIsActive=!0):(this._dbg(I.Lifetime,"view ready status changed, not ready or not a local view!"),this._removeRenderPlugin())}),{initial:!0}),this._qualityWatchHandle=o((()=>this._view?.qualityProfile),(e=>{this._dbg(I.Rendering,"qualityProfile changed to "+e),this._vxl&&this._vxl.set_quality(this._toWasmQuality(e))}),{initial:!0}),this._timeExtentWatchHandle=o((()=>this._view?.timeExtent),(()=>{if(this._vxl){const e=this._getTimeArgs(this._view?.timeExtent);this._dbg(I.Rendering,"sceneView timeExtent changed to useTime="+e.useTime+" st="+e.startTime+" et="+e.endTime),this._vxl.set_scene_time_extent(e.startTime,e.endTime,e.useTime),this._renderPluginContext.requestRender()}}),{initial:!0}),this._stationaryWatchHandle=o((()=>this._view?.stationary),(e=>{this._vxl&&e&&!this._lastFrameWasStationary&&this._renderPluginContext.requestRender()}))}initializeRenderContext(e){this._dbg(I.Lifetime,"--initializeRenderContext--");const t=e.renderContext.rctx;t.type===C.WEBGL2?(this._renderPluginContext=e,this._rctx=e.renderContext.rctx,this._halfIntTexturesAvailable=!!this._rctx.capabilities.textureNorm16,this._textureFloatLinearAvailable=this._rctx.capabilities.textureFloatLinear,this._initializeWasm(t.gl)):this._dbg(I.Error,"WebGL 1 context only!")}uninitializeRenderContext(){this._renderPluginContext=null,this._rctx=null,this._dbg(I.Lifetime,"--uninitializeRenderContext--")}_restoreFramebuffer(){if(!this._renderTargetToRestore)return;const e=this._renderTargetToRestore.fbo;if(!!!this._rctx)return void this._dbg(I.Error,"no context in restoreFramebuffer!");this._rctx.bindFramebuffer(e,!0);const t=this._renderTargetToRestore.viewport;this._rctx.setViewport(t.x,t.y,t.width,t.height)}_bindPreviousDepthToSlot(e,t){const r=!!this._rctx,i=!!this._renderTargetToRestore;if(!r||!i)return 0;const s=this._renderTargetToRestore.fbo.depthStencilTexture;return s?(0===t?this._rctx.bindTexture(null,e,!0):this._rctx.bindTexture(s,e,!0),1):(this._dbg(I.Error,"no depth/stencil texture exists!"),0)}_modifyResourceCount(e,t,r){if(!this._rctx)return void this._dbg(I.Error,"modifyAllocation callback has no rendering context!");const i=e;1===r?this._rctx.instanceCounter.increment(i,t):this._rctx.instanceCounter.decrement(i,t)}_setBlendState(e,t,r,i){this._rctx?(this._rctx.setBlendingEnabled(1===e),this._rctx.setBlendFunction(t,r),this._rctx.setBlendEquation(i)):this._dbg(I.Error,"setBlendState callback has no rendering context!")}_setFrontFace(e){this._rctx?this._rctx.setFrontFace(e):this._dbg(I.Error,"setFrontFace callback has no rendering context!")}_setDepthStencilStateFunction(e,t,r){this._rctx?(this._rctx.setDepthFunction(r),this._rctx.setDepthTestEnabled(1===e),this._rctx.setDepthWriteEnabled(1===t),this._rctx.setStencilTestEnabled(!1),this._rctx.setStencilFunction(V.ALWAYS,0,255),this._rctx.setStencilOpSeparate(S.FRONT,U.KEEP,U.INCR,U.KEEP),this._rctx.setStencilOpSeparate(S.BACK,U.KEEP,U.DECR,U.KEEP)):this._dbg(I.Error,"setDepthStencilStateFunction callback has no rendering context!")}_setRasterizerState(e){if(this._rctx)switch(e){case c.None:this._rctx.setFaceCullingEnabled(!1);break;case c.Back:this._rctx.setCullFace(S.BACK),this._rctx.setFaceCullingEnabled(!0);break;case c.Front:this._rctx.setCullFace(S.FRONT),this._rctx.setFaceCullingEnabled(!0)}else this._dbg(I.Error,"setRasterizerState callback has no rendering context!")}_setViewport(e,t,r,i){this._rctx?this._rctx.setViewport(e,t,r,i):this._dbg(I.Error,"setViewport callback has no rendering context!")}_updateMemoryUsage(){this._layers.forEach(((e,t)=>{if(e.needMemoryUsageUpdate){const r=this._vxl.estimate_memory_usage(t);r>=0&&(e.needMemoryUsageUpdate=!1,e.layerView.setUsedMemory(r))}}))}_syncRequestsResponses(){this._layers.forEach(((e,r)=>{const i=[];e.responses.forEach(((t,s)=>{i.push(s),this._dbg(I.RequestResponse,"responding for requestID:"+s+" size:"+t.size),this._vxl.respond(r,s,t),t.requestType!==m.TreeIndex&&t.requestType!==m.Section||(e.needMemoryUsageUpdate=!0)}));const s=e.responses;for(const t of i)s.delete(t);const a=this._vxl.get_new_requests(r),o=e.abortController.signal;for(const l in a){e.outstandingRequestCount+=1,1===e.outstandingRequestCount&&e.layerView.updatingFlagChanged();const r=a[l],i={responseType:"array-buffer",signal:o};this._dbg(I.RequestResponse,"making requestID:"+l+" url:"+r.url),t(r.url,i).then((t=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),this._dbg(I.RequestResponse,"have response for requestID:"+l);let i=0;if(t.data.byteLength>0){i=this._vxl._malloc(t.data.byteLength);const e=new Uint8Array(this._vxl.HEAPU8.buffer,i,t.data.byteLength),r=new Uint8Array(t.data);for(let i=0;i<t.data.byteLength;++i)e[i]=r[i]}s.set(+l,{responseType:r.responseType,ptr:i,size:t.data.byteLength,success:!0,requestType:r.requestType})})).catch((t=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),n(t)||(this._dbg(I.Error,`requestID:${l} failed, error=${t.toString()}`),s.set(+l,{responseType:r.responseType,ptr:0,size:0,success:!1,requestType:r.requestType}))}))}}))}updateWasmCamera(e){this._vxl.set_projection_matrix.apply(this._vxl,e.projectionMatrix),this._vxl.set_view_matrix.apply(this._vxl,e.viewMatrix),this._vxl.set_near_far(e.near,e.far)}isUpdating(e){return!(this._vxl||!this._vxlPromise)||!!this._layers.has(e)&&this._layers.get(e).outstandingRequestCount>0}getLayerTimes(e){const t=[];return this._layers.forEach(((r,i)=>{if(r.layerView.wasmLayerId===e.wasmLayerId){const r=this._vxl.get_layer_epoch_times(i,e.layer.currentVariableId);for(let e=0;e<r.length;++e)t.push(r[e])}})),t}getCurrentLayerTimeIndex(e){let t=0;return this._layers.forEach(((r,i)=>{r.layerView.wasmLayerId===e.wasmLayerId&&(t=this._vxl.get_layer_current_time_id(i))})),t}setEnabled(e,t){this._layers.forEach(((r,i)=>{r.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl.set_enabled(i,t),r.needMemoryUsageUpdate=!0,this._renderPluginContext.requestRender())}))}setStaticSections(e,t){const r={mask:g.StaticSections,staticSections:t};return this._doMaskedUIUpdate(e,r,!0)}setCurrentVariable(e,t){const r={mask:g.CurrentVariable,currentVariable:t};return this._doMaskedUIUpdate(e,r,!0)}setRenderMode(e,t){const r={mask:g.RenderMode,renderMode:t};return this._doMaskedUIUpdate(e,r,!0)}setVerticalExaggerationAndOffset(e,t,r,i){const s={mask:g.ExaggerationAndOffset,volStyleDesc:{volumeId:t,verticalExaggeration:r,verticalOffset:i}};return this._doMaskedUIUpdate(e,s,!0)}setVariableStyles(e,t){const r={mask:g.VariableStyles,variableStyles:t};return this._doMaskedUIUpdate(e,r,!0)}setVolumeStyles(e,t){const r={mask:g.VolumeStyles,volumeStyles:t};return this._doMaskedUIUpdate(e,r,!0)}setEnableDynamicSections(e,t){const r={mask:g.ContainerVisibility,containerIsVisible:t,container:x.DynamicSections};return this._doMaskedUIUpdate(e,r,!0)}setEnableIsosurfaces(e,t){const r={mask:g.ContainerVisibility,containerIsVisible:t,container:x.Isosurfaces};return this._doMaskedUIUpdate(e,r,!0)}setEnableSections(e,t){const r={mask:g.ContainerVisibility,containerIsVisible:t,container:x.StaticSections};return this._doMaskedUIUpdate(e,r,!0)}setAnalysisSlice(e,t,r,i){const s={mask:g.AnalysisSlice,analysisSlice:{point:r,normal:i,enabled:t}};return this._doMaskedUIUpdate(e,s,!0)}_doMaskedUIUpdate(e,t,r){if(!this._vxl)return!1;let i=!1;return this._layers.forEach(((r,s)=>{if(r.layerView.wasmLayerId===e.wasmLayerId){const e={str:JSON.stringify(t),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(i=1===this._vxl.handle_masked_ui_update(s,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}})),i&&r&&this._renderPluginContext.requestRender(),i}_addTriangleToWasmBuffer(e,t,r,i,s){return e[3*t+0]=r[0],e[3*t+1]=r[1],e[3*t+2]=r[2],e[3*(t+=1)+0]=i[0],e[3*t+1]=i[1],e[3*t+2]=i[2],e[3*(t+=1)+0]=s[0],e[3*t+1]=s[1],e[3*t+2]=s[2],t+=1}_addNormalToWasmBuffer(e,t,r){return e[3*t+0]=r[0],e[3*t+1]=r[1],e[3*t+2]=r[2],t+=1}_doCaptureFrustum(){if(!this._vxl)return;const e=36,t=e/3,r=this._vxl._malloc(3*e*Float32Array.BYTES_PER_ELEMENT),i=new Float32Array(this._vxl.HEAPF32.buffer,r,3*e),s=this._vxl._malloc(3*t*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(this._vxl.HEAPF32.buffer,s,e),n=this._frustum.points[_.NEAR_BOTTOM_LEFT],o=this._frustum.points[_.NEAR_BOTTOM_RIGHT],l=this._frustum.points[_.NEAR_TOP_RIGHT],h=this._frustum.points[_.NEAR_TOP_LEFT],d=this._frustum.points[_.FAR_BOTTOM_LEFT],c=this._frustum.points[_.FAR_BOTTOM_RIGHT],m=this._frustum.points[_.FAR_TOP_RIGHT],g=this._frustum.points[_.FAR_TOP_LEFT];let x=0,p=0;const f=this._frustum.planes[u.NEAR];x=this._addTriangleToWasmBuffer(i,x,l,o,n),p=this._addNormalToWasmBuffer(a,p,f),x=this._addTriangleToWasmBuffer(i,x,n,h,l),p=this._addNormalToWasmBuffer(a,p,f);const y=this._frustum.planes[u.FAR];x=this._addTriangleToWasmBuffer(i,x,d,c,m),p=this._addNormalToWasmBuffer(a,p,y),x=this._addTriangleToWasmBuffer(i,x,m,g,d),p=this._addNormalToWasmBuffer(a,p,y);const v=this._frustum.planes[u.TOP];x=this._addTriangleToWasmBuffer(i,x,m,l,h),p=this._addNormalToWasmBuffer(a,p,v),x=this._addTriangleToWasmBuffer(i,x,h,g,m),p=this._addNormalToWasmBuffer(a,p,v);const b=this._frustum.planes[u.BOTTOM];x=this._addTriangleToWasmBuffer(i,x,n,o,c),p=this._addNormalToWasmBuffer(a,p,b),x=this._addTriangleToWasmBuffer(i,x,c,d,n),p=this._addNormalToWasmBuffer(a,p,b);const w=this._frustum.planes[u.LEFT];x=this._addTriangleToWasmBuffer(i,x,h,n,d),p=this._addNormalToWasmBuffer(a,p,w),x=this._addTriangleToWasmBuffer(i,x,d,g,h),p=this._addNormalToWasmBuffer(a,p,w);const T=this._frustum.planes[u.RIGHT];x=this._addTriangleToWasmBuffer(i,x,l,m,c),p=this._addNormalToWasmBuffer(a,p,T),x=this._addTriangleToWasmBuffer(i,x,c,o,l),p=this._addNormalToWasmBuffer(a,p,T),-1!==this._frustumRenderableId&&this._vxl.remove_generic_mesh(this._frustumRenderableId),this._frustumRenderableId=this._vxl.add_generic_mesh(r,3*e,s,e,255,0,0,64),this._vxl._free(r),this._vxl._free(s),this._captureFrustum=!1,this._renderPluginContext.requestRender()}captureFrustum(){null===this._renderCoordsHelper&&(this._renderCoordsHelper=b.create(f.Local,d(!1,this._view.spatialReference))),null===this._frustum&&(this._frustum=new v(this._renderCoordsHelper)),this._captureFrustum=!0,null!==this._renderPluginContext&&this._renderPluginContext.requestRender()}toggleFullVolumeExtentDraw(e){this._vxl&&this._layers.forEach(((t,r)=>{t.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl.toggle_full_volume_extent_draw(r),this._renderPluginContext.requestRender())}))}addVoxelLayer(e){if(!this._vxl){const t={layerView:e,resolveCallback:null,rejectCallback:null},r=new Promise(((e,r)=>{t.resolveCallback=e,t.rejectCallback=r}));return this._newLayers.push(t),r}const t=this._addVoxelLayer(e);return t<0?Promise.reject(-1):Promise.resolve(t)}removeVoxelLayer(e){if(!this._vxl){const t=this._newLayers.findIndex((t=>e.uid===t.layerView.uid));t>=0&&(this._newLayers[t].resolveCallback(-1),this._newLayers.splice(t,1));const r=this._newLayers.length;return 0===r&&(this._dbg(I.Lifetime," no voxel layers left after removing a layer, removing RenderPlugin and destroying"),this.destroy()),r}let t=-1;this._layers.forEach(((r,i)=>{if(r.layerView.wasmLayerId===e.wasmLayerId){t=i,r.abortController.abort(),this._vxl.remove_layer(t);const s=this.layerUid.indexOf(e.layer.uid);-1!==s&&this.layerUid.splice(s,1)}})),t>=0&&this._layers.delete(t);const r=this._layers.size;return 0===r&&(this._dbg(I.Lifetime," no voxel layers left after removing a layer, removing RenderPlugin and destroying"),this.destroy()),r}_getBlockSize(e){for(const t of this._wasmMemBlockSizes)if(e<t)return t;return-1}_allocateBlock(e){e.byteCount=this._vxl.lengthBytesUTF8(e.str)+1;const t=this._getBlockSize(e.byteCount);return t<0?(e.isReusable=!1,e.ptr=this._vxl._malloc(e.byteCount)):(e.isReusable=!0,e.ptr=this._wasmMemBlocks.get(t),0===e.ptr&&(e.ptr=this._vxl._malloc(t),this._wasmMemBlocks.set(t,e.ptr))),0!==e.ptr&&(this._vxl.stringToUTF8(e.str,e.ptr,e.byteCount),!0)}_getTimeArgs(e){let t=-Number.MAX_VALUE,r=Number.MAX_VALUE,s=!1;return i(e)&&(e.isAllTime?s=!0:(i(e.start)&&(s=!0,t=e.start.getTime()/1e3),i(e.end)&&(s=!0,r=e.end.getTime()/1e3))),{startTime:t,endTime:r,useTime:s}}_addVoxelLayer(e){const t=e.layer;let r=-1;const i=t.getConfiguration();if(i.length<1)return-1;const s={str:i,byteCount:0,ptr:0,isReusable:!1};if(!this._allocateBlock(s))return-1;const a=this._getTimeArgs(this._view?.timeExtent),n=this._view.spatialReference.isWGS84&&t.spatialReference.isWGS84?111319.49079327357:1;if(r=this._vxl.add_layer(t.serviceRoot,s.ptr,s.byteCount,n,n,a.startTime,a.endTime,a.useTime,this._toWasmQuality(this._view.qualityProfile)),s.isReusable||this._vxl._free(s.ptr),r>=0){t.test?.constantUpscaling&&(this._setUpscalingLimits(0,.25,.25),this._setUpscalingLimits(1,.5,.5),this._setUpscalingLimits(2,.75,.75));const i=new AbortController;if(this._layers.set(r,{layerView:e,responses:new Map,outstandingRequestCount:0,abortController:i,needMemoryUsageUpdate:!1}),this.layerUid.push(e.layer.uid),!this._halfIntTexturesAvailable||has("mac")){const t=[];let r="";for(const i of e.layer.variables)"Int16"!==i.renderingFormat.type&&"UInt16"!==i.renderingFormat.type||(t.push(i.name),i.id===e.layer.currentVariableId&&(r=i.name));""!==r&&P.error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${r}' in this browser`),t.length>0&&P.warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}if(!this._textureFloatLinearAvailable){const t=[];let r="";for(const i of e.layer.variables)"Float32"===i.renderingFormat.type&&(t.push(i.name),i.id===e.layer.currentVariableId&&(r=i.name));""!==r&&P.error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${r}' in this browser`),t.length>0&&P.warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}return has("esri-mobile")&&P.warnOnce("Mobile support differs across devices. Voxel layer might not display as expected."),r}return-1}prepareRender(e){if(!this._vxl)return;const t=e.bindParameters.camera.viewForward,r=e.bindParameters.camera.eye;this._vxl.update_camera_pos_and_direction(r[0],r[1],r[2],t[0],t[1],t[2]);const i=this._vxl.cull();this._dbg(I.RequestResponse,"missingResourceCount="+i),this._moreToLoad=i>0,this._havePreparedWithAllLayers=0===this._newLayers.length,this._updateMemoryUsage()}render(e){if(!this._vxl||e.output!==this._shaderOutput||e.bindParameters.slot!==this._renderSlot)return;for(const r of this._newLayers){const e=this._addVoxelLayer(r.layerView);-1===e?r.rejectCallback(-1):r.resolveCallback(e)}if(this._newLayers=[],0===this._layers.size)return void this._dbg(I.Error,"No voxel layers but RenderPlugin instance is being asked to render!");this._renderTargetToRestore={fbo:this._rctx.getBoundFramebufferObject(),viewport:this._rctx.getViewport()},this._syncRequestsResponses(),this._lastFrameWasStationary=this._view.stationary,this._rctx.setPolygonOffsetFillEnabled(!1),this._rctx.setScissorTestEnabled(!1),this._rctx.setColorMask(!0,!0,!0,!0),this._vxl.begin_color_frame(!this._view._stage.renderer.isFeatureEnabled(L.HighQualityVoxel),e.bindParameters.lighting.mainLight.direction[0],e.bindParameters.lighting.mainLight.direction[1],e.bindParameters.lighting.mainLight.direction[2]);const t=this._renderTargetToRestore.viewport;t.width===this._viewportWidth&&t.height===this._viewportHeight||(this._viewportWidth=t.width,this._viewportHeight=t.height,this._vxl.set_viewport(t.width,t.height),this._layers.forEach((e=>{e.needMemoryUsageUpdate=!0}))),0===t.x&&0===t.y||this._dbg(I.Error,"Unsupported viewport parameters detected!"),this.updateWasmCamera(e.bindParameters.camera),this._captureFrustum&&(this._frustum.update(e.bindParameters.camera),this._doCaptureFrustum()),this._vxl.draw(),this._renderTargetToRestore.fbo=null,e.rctx.externalTextureUnitUpdate(this._vxl.get_texture_units_bound_in_frame(),this._vxl.get_active_texture_unit()),e.rctx.externalVertexArrayObjectUpdate(),e.rctx.externalVertexBufferUpdate(),this._rctx.externalProgramUpdate(),(this._moreToLoad||!this._havePreparedWithAllLayers&&this._layers.size>0)&&this._renderPluginContext.requestRender()}destroy(){this._dbg(I.Lifetime,"--destroy--"),this._removeRenderPlugin(),this._readyWatchHandle=s(this._readyWatchHandle),this._qualityWatchHandle=s(this._qualityWatchHandle),this._timeExtentWatchHandle=s(this._timeExtentWatchHandle),this._stationaryWatchHandle=s(this._stationaryWatchHandle),this._vxl&&(this._layers.forEach((e=>{e.abortController.abort()})),this._wasmMemBlocks.forEach((e=>{0!==e&&this._vxl._free(e)})),this._vxl.uninitialize_voxel_wasm(),this._vxl=null)}_initializeWasm(e){return this._vxl?Promise.resolve():(this._vxlPromise||(this._vxlPromise=p(e).then((e=>{if(this._vxl=e,this._vxlPromise=null,this._newLayers.length<=0)return this._dbg(I.Lifetime," no voxel layers left after WASM downloaded, removing RenderPlugin and destroying"),void this.destroy();const t=this._getTimeArgs(this._view?.timeExtent),r=this._vxl.addFunction(this._restoreFramebuffer.bind(this),"v"),i=this._vxl.addFunction(this._setBlendState.bind(this),"viiii"),s=this._vxl.addFunction(this._setFrontFace.bind(this),"vi"),a=this._vxl.addFunction(this._setRasterizerState.bind(this),"vi"),n=this._vxl.addFunction(this._setDepthStencilStateFunction.bind(this),"viii"),o=this._vxl.addFunction(this._setViewport.bind(this),"viiii"),l=this._vxl.addFunction(this._bindPreviousDepthToSlot.bind(this),"iii"),h=this._vxl.addFunction(this._modifyResourceCount.bind(this),"viii"),d=this._halfIntTexturesAvailable&&!has("mac"),_=this._textureFloatLinearAvailable;this._vxl.initialize_voxel_wasm(r,i,s,a,n,o,l,h,t.startTime,t.endTime,t.useTime,d,_),this._renderPluginContext&&this._renderPluginContext.requestRender()})).catch((()=>{for(const e of this._newLayers)e.rejectCallback(-2);this._dbg(I.Error," WASM failed to download, removing RenderPlugin and destroying"),this.destroy()}))),this._vxlPromise)}pickDepth(e,t,r){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const i=r.viewport[3]-t;if(e<0||e>r.viewport[2]||t<0||t>r.viewport[3])return this._dbg(I.Error,`[js] pickDepth: outOfRange, screenXY=[${e.toFixed(0)}, ${i.toFixed(0)}]]`),null;this._renderTargetToRestore={fbo:this._rctx.getBoundFramebufferObject(),viewport:this._rctx.getViewport()};const s=r.viewForward,a=r.eye;this._vxl.update_camera_pos_and_direction(a[0],a[1],a[2],s[0],s[1],s[2]),this.updateWasmCamera(r),this._vxl.begin_frame();const n=this._vxl.pick_depth(e,i);if(this._renderTargetToRestore.fbo=null,this._rctx.externalTextureUnitUpdate(this._vxl.get_texture_units_bound_in_frame(),this._vxl.get_active_texture_unit()),this._rctx.externalVertexArrayObjectUpdate(),this._rctx.externalVertexBufferUpdate(),this._rctx.externalProgramUpdate(),n.success){return n.distanceToCamera}return null}pickObject(e,t,r,i){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const s=Math.round(e),a=Math.round(t);if(s<0||s>r.viewport[2]||a<0||a>r.viewport[3])return this._dbg(I.Error,`[js] pickObject: outOfRange, screenXY=[${s}, ${a}], vp=[${r.viewport.toString()}]`),null;this._renderTargetToRestore={fbo:this._rctx.getBoundFramebufferObject(),viewport:this._rctx.getViewport()};const n=r.viewForward,o=r.eye;this._vxl.update_camera_pos_and_direction(o[0],o[1],o[2],n[0],n[1],n[2]),this.updateWasmCamera(r),this._vxl.begin_frame();let l=null;if(0===i.length)l=this._vxl.pick_object(s,a,0,0);else{const e={str:JSON.stringify({layerIds:i}),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(l=this._vxl.pick_object(s,a,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}return this._renderTargetToRestore.fbo=null,this._rctx.externalTextureUnitUpdate(this._vxl.get_texture_units_bound_in_frame(),this._vxl.get_active_texture_unit()),this._rctx.externalVertexArrayObjectUpdate(),this._rctx.externalVertexBufferUpdate(),this._rctx.externalProgramUpdate(),l}intersect(e,t,r,i,s){if(!this._vxl||!this._rctx||0===this._layers.size||!e.options.selectionMode||e.options.isFiltered)return;if(s[0]<0||s[0]>e.camera.viewport[2]||s[1]<0||s[1]>e.camera.viewport[3])return this._dbg(I.Error,`[js] VoxelWasmPerScene.intersect: outOfRange, screenXY=[${s[0].toFixed(0)}, ${s[1].toFixed(0)}]`),null;const n=[];this._layers.forEach((t=>{e.options.filteredLayerUids.includes(t.layerView.layer.uid)&&n.push(t.layerView.wasmLayerId)}));const o=this.pickObject(s[0],s[1],e.camera,n);if(a(o)||-1===o.layerId)return;const d=this._layers.get(o.layerId);if(d){const t=d.layerView.layer.uid,s=o.distanceToCamera/l(r,i),a=h();a[0]=o.worldX,a[1]=o.worldY,a[2]=o.worldZ;const n={};if(0===o.uniqueValue.length?n["Voxel.ServiceValue"]=`${o.continuousValue.toLocaleString()} ${o.continuousValueUnits}`:n["Voxel.ServiceValue"]=o.uniqueValue,n["Voxel.ServiceVariableLabel"]=o.variableLabel,n["Voxel.Position"]=o.voxelSpacePosition,o.nativeTime.length>0){const e=new Date(o.epochTime);n["Voxel.ServiceLocalTime"]=e.toString(),n["Voxel.ServiceNativeTime"]=o.nativeTime}o.hasDepth&&(n["Voxel.ServiceDepth"]=`${o.depth.toLocaleString()} ${o.depthUnits}`);const _=e=>{const r=new y(a,t,(()=>this._createVoxelGraphic(d.layerView.layer,n)));e.set(this.type,r,s,null)},u=e.results,c=e.options.store===E.ALL;if((null==u.min.dist||s<u.min.dist)&&_(u.min),(null==u.max.dist||s>u.max.dist)&&_(u.max),c){const t=T(e.ray);_(t),e.results.all.push(t)}}}_createVoxelGraphic(t,r){return new e({layer:t,sourceLayer:t,attributes:r})}_toWasmQuality(e){switch(e){case"low":return 0;case"medium":return 1;case"high":return 2}}_setUpscalingLimits(e,t,r){this._vxl&&this._vxl.set_upscaling_limits(e,t,r)}}export{k 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.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import{rasterRendererTypes as r,websceneRasterRendererTypes as i,read as s}from"../../rasterRenderers.js";import n from"../../request.js";import o from"../../core/Error.js";import{strict as a}from"../../core/jsonMap.js";import{clone as l}from"../../core/lang.js";import u from"../../core/Logger.js";import{isSome as p,isNone as c,unwrap as m}from"../../core/maybe.js";import{watch as d}from"../../core/reactiveUtils.js";import{urlToObject as h}from"../../core/urlUtils.js";import{property as f,ensureRange as g}from"../../core/accessorSupport/decorators/property.js";import{Integer as y,ensureClass as R,ensureNumber as b}from"../../core/accessorSupport/ensureType.js";import{reader as v}from"../../core/accessorSupport/decorators/reader.js";import{subclass as S}from"../../core/accessorSupport/decorators/subclass.js";import{writer as I}from"../../core/accessorSupport/decorators/writer.js";import{opacity as x,url as w}from"../support/commonProperties.js";import _ from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as F}from"../support/ExportImageServiceParameters.js";import D from"../support/Field.js";import T from"../support/FieldsIndex.js";import{isSupportedRendererType as j}from"../support/imageryRendererUtils.js";import P from"../support/MosaicRule.js";import N from"../support/MultidimensionalSubset.js";import O from"../support/PixelBlock.js";import{interpolationKebab as C,noDataInterpretationKebab as M}from"../support/rasterEnums.js";import A from"../support/RasterFunction.js";import J from"../support/RasterInfo.js";import q from"../support/RasterJobHandler.js";import{hasExcludedVariableOrDimension as V,getSubsetVariablesFromMdInfo as E,getDefaultMultidimensionalDefinition as H}from"../support/rasterDatasets/multidimensionalUtils.js";import{decode as Q,getFormat as U}from"../support/rasterFormats/RasterCodec.js";import{uvComponentToVector as L}from"../support/rasterFunctions/vectorFieldUtils.js";import{getSupportedRendererTypes as z,getDefaultBandCombination as B,createDefaultRenderer as k,normalizeRendererJSON as G}from"../../renderers/support/rasterRendererHelper.js";import W from"../../renderers/support/RasterSymbolizer.js";import{computeAngles as K,computePixelSpaceLocations as X,computeHistograms as $,computeStatisticsHistograms as Y,measureHeight as Z,measureAreaAndPerimeter as ee,measureDistanceAndAngle as te,measurePointOrCentroid as re,getImageSpatialReferenceQueryParameter as ie,getSamples as se,identify as ne}from"../../rest/imageService.js";import"../../core/has.js";import"../support/source/DataLayerSource.js";import{executeQueryJSON as oe}from"../../rest/query/executeQueryJSON.js";import"../../config.js";import"../../kernel.js";import"../../core/unitUtils.js";import"../../geometry/support/spatialReferenceUtils.js";import"../graphics/featureConversionUtils.js";import ae from"../../geometry/Extent.js";import"../../geometry/Geometry.js";import"../../geometry/Multipoint.js";import"../../geometry/Point.js";import le from"../../geometry/Polygon.js";import"../../geometry/Polyline.js";import"../../geometry/support/normalizeUtils.js";import"../../core/pbf.js";import ue from"../../rest/support/FeatureSet.js";import pe from"../../rest/support/Query.js";import"../../rest/query/support/AttachmentInfo.js";import"../../rest/support/AttachmentQuery.js";import{executeForCount as ce}from"../../rest/query/executeForCount.js";import{executeForIds as me}from"../../rest/query/executeForIds.js";import"../../rest/support/RelationshipQuery.js";import"../../rest/support/TopFeaturesQuery.js";import{fetchServiceRasterInfo as de,generateRasterInfo as he}from"../../rest/imageService/fetchRasterInfo.js";import{getCatalogItemRasterInfo as fe}from"../../rest/imageService/getCatalogItemRasterInfo.js";import ge from"../../rest/support/ImageAngleParameters.js";import ye from"../../rest/support/ImageHistogramParameters.js";import Re from"../../rest/support/ImageIdentifyParameters.js";import be from"../../rest/support/ImageMeasureAreaAndPerimeterParameters.js";import ve from"../../rest/support/ImageMeasureDistanceAndAngleParameters.js";import Se from"../../rest/support/ImageMeasureHeightParameters.js";import Ie from"../../rest/support/ImageMeasurePointParameters.js";import xe from"../../rest/support/ImagePixelLocationParameters.js";import we from"../../rest/support/ImageSampleParameters.js";import{createFlowMesh as _e}from"../../views/2d/engine/flow/dataUtils.js";import Fe from"../../geometry/SpatialReference.js";const De=a()({U1:"u1",U2:"u2",U4:"u4",U8:"u8",S8:"s8",U16:"u16",S16:"s16",U32:"u32",S32:"s32",F32:"f32",F64:"f64",C64:"c64",C128:"c128",UNKNOWN:"unknown"}),Te=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),je=g(b,{min:0,max:255});function Pe(e){if(!e)return null;const t=JSON.stringify(e).match(/"rasterFunction":"(.*?")/gi)?.map((e=>e.replace('"rasterFunction":"',"").replace('"',"")));return t?t.join("/"):null}const Ne=a=>{let g=class extends a{constructor(){super(...arguments),this._functionRasterInfos={},this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this._cachedRendererJson=null,this._serviceSupportsMosaicRule=null,this._rasterAttributeTableFieldPrefix="Raster.",this.adjustAspectRatio=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.defaultMosaicRule=null,this.definitionExpression=null,this.exportImageServiceParameters=null,this.rasterInfo=null,this.fields=null,this.fullExtent=null,this.hasMultidimensions=!1,this.imageMaxHeight=4100,this.imageMaxWidth=4100,this.interpolation=void 0,this.minScale=0,this.maxScale=0,this.multidimensionalInfo=null,this.multidimensionalSubset=null,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelFilter=null,this.raster=void 0,this.sourceType=null,this.viewId=void 0,this.symbolizer=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=void 0}initialize(){this._set("exportImageServiceParameters",new F({layer:this}))}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get _rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.length<1||p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.forEach((t=>{e.set(t.name.toLowerCase().replace(/ /gi,"_"),t.name)})),e}readBandIds(e,t){if(Array.isArray(e)&&e.length>0&&e.every((e=>"number"==typeof e)))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,r){null!=e&&"lerc"!==this.format&&(t[r]=e)}writeCompressionTolerance(e,t,r){"lerc"===this.format&&null!=e&&(t[r]=e)}readDefaultMosaicRule(e,t){return this._serviceSupportsMosaicRule?P.fromJSON(t):null}get fieldsIndex(){return this.fields?new T(this.fields):null}set format(e){e&&Te.has(e.toLowerCase())&&this._set("format",e.toLowerCase())}readFormat(e,t){return"esriImageServiceDataTypeVector-UV"===t.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===t.serviceDataType||null!=this.pixelFilter?"lerc":"jpgpng"}readMinScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}readMaxScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}set mosaicRule(e){let t=e;t&&t.mosaicMethod&&(t=P.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const r=e||t.mosaicRule;return r?P.fromJSON(r):this._isMosaicRuleSupported(t)?P.fromJSON(t):null}writeMosaicRule(e,t,r){let i=this.mosaicRule;const s=this.definitionExpression;i?s&&s!==i.where&&(i=i.clone(),i.where=s):s&&(i=new P({where:s})),this._isValidCustomizedMosaicRule(i)&&(t[r]=i.toJSON())}writeNoData(e,t,r){null!=e&&"number"==typeof e&&(t[r]=je(e))}readObjectIdField(e,t){if(!e){const r=t.fields.filter((e=>"esriFieldTypeOID"===e.type||"oid"===e.type));e=r&&r[0]&&r[0].name}return e}get parsedUrl(){return h(this.url)}readSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}set renderer(e){this.loaded&&(e=this._configRenderer(e)),this._set("renderer",e)}readRenderer(e,t,r){const i=t?.layerDefinition?.drawingInfo?.renderer,n=s(i,r);return null==n?null:("vector-field"===n.type&&t.symbolTileSize&&!i.symbolTileSize&&(n.symbolTileSize=t.symbolTileSize),j(n)||u.getLogger(this.declaredClass).warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),n)}writeRenderer(e,t,r){t.layerDefinition=t.layerDefinition||{},t.layerDefinition.drawingInfo=t.layerDefinition.drawingInfo||{},t.layerDefinition.drawingInfo.renderer=e.toJSON(),"vector-field"===e.type&&(t.symbolTileSize=e.symbolTileSize)}get rasterFields(){const e=this._rasterAttributeTableFieldPrefix||"Raster.",t=new D({name:"Raster.ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:"string"}),r=new D({name:"Raster.ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:"string"}),i=new D({name:"Raster.ServicePixelValue.Raw",alias:"Raw Service Pixel Value",domain:null,editable:!1,length:50,type:"string"});let s=this.fields?l(this.fields):[];s.push(r),this.capabilities?.operations.supportsQuery&&this.fields&&this.fields.length>0&&s.push(t),this.version>=10.4&&p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.some((e=>"none"===e.name.toLowerCase()))&&s.push(i),p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.filter((e=>"none"!==e.name.toLowerCase())).forEach((e=>{s.push(new D({name:"Raster.ServicePixelValue."+e.name,alias:e.name,domain:null,editable:!1,length:50,type:"string"}))})),this._isVectorDataSet()&&(s.push(new D({name:"Raster.Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"double"})),s.push(new D({name:"Raster.Direction",alias:"Direction",domain:null,editable:!1,type:"double"})));const{attributeTable:n}=this.rasterInfo??{};if(p(n)){const t=n.fields.filter((e=>"esriFieldTypeOID"!==e.type&&"value"!==e.name.toLowerCase())).map((t=>{const r=l(t);return r.name=e+t.name,r}));s=s.concat(t)}return s}set renderingRule(e){let t=e;t&&t.rasterFunction&&(t=A.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("renderingRule",t)}readRenderingRule(e,t){const r=t.rasterFunctionInfos;return t.renderingRule||r&&r.length&&"None"!==r[0].name?this._isRFTJson(t.renderingRule)?A.fromJSON({rasterFunctionDefinition:t.renderingRule}):A.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}writeRenderingRule(e,t,r){const i=e.toJSON();i.rasterFunctionDefinition?t[r]=i.rasterFunctionDefinition:t[r]=i}readSpatialReference(e,t){const r=e||t.extent.spatialReference;return r?Fe.fromJSON(r):null}readPixelType(e){return De.fromJSON(e)||e}writePixelType(e,t,r){(c(this.serviceRasterInfo)||this.pixelType!==this.serviceRasterInfo.pixelType)&&(t[r]=De.toJSON(e))}readVersion(e,t){let r=t.currentVersion;return r||(r=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),r}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let r=e;const{renderer:i,symbolizer:s,pixelFilter:n,bandIds:o}=this;if(!this._isPicture()&&i&&s&&!n){const n=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(i.toJSON()),a=this._rasterJobHandler.instance;if(a){n&&(s.bind(),await a.updateSymbolizer(s,t),this._cachedRendererJson=i.toJSON());const l=await a.symbolize({bandIds:o,...e},t);r={extent:e.extent,pixelBlock:l}}else r={extent:e.extent,pixelBlock:s.symbolize({bandIds:o,...e})}}return r}destroy(){this._shutdownJobHandler()}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}async computeAngles(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeAngles)throw new o("imagery-layer:compute-angles","this operation is not supported on the input image service");return e=R(ge,e).clone(),K(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputePixelLocation)throw new o("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=R(xe,e).clone(),X(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeHistograms)throw new o("imagery-layer:compute-histograms","this operation is not supported on the input image service");return e=R(ye,e).clone(),this._applyMosaicAndRenderingRules(e),$(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeStatisticsHistograms)throw new o("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");return e=R(ye,e).clone(),this._applyMosaicAndRenderingRules(e),Y(this.url,e,this._getRequestOptions(t))}async measureHeight(e,t){const r=await this._fetchCapabilities(t?.signal);if(!("base-and-top"===e.operationType?r.mensuration.supportsHeightFromBaseAndTop:"base-and-top-shadow"===e.operationType?r.mensuration.supportsHeightFromBaseAndTopShadow:r.mensuration.supportsHeightFromTopAndTopShadow))throw new o("imagery-layer:measure-height","this operation is not supported on the input image service");return e=R(Se,e).clone(),this._applyMosaicAndRenderingRules(e),Z(this.url,e,this._getRequestOptions(t))}async measureAreaAndPerimeter(e,t){const r=await this._fetchCapabilities(t?.signal);if(!(r.mensuration.supportsAreaAndPerimeter&&(!e.is3D||r.mensuration.supports3D)))throw new o("imagery-layer:measure-area-and-perimeter","this operation is not supported on the input image service");return e=R(be,e).clone(),this._applyMosaicAndRenderingRules(e),ee(this.url,e,this._getRequestOptions(t))}async measureDistanceAndAngle(e,t){const r=await this._fetchCapabilities(t?.signal);if(!(r.mensuration.supportsDistanceAndAngle&&(!e.is3D||r.mensuration.supports3D)))throw new o("imagery-layer:measure-distance-and-angle","this operation is not supported on the input image service");return e=R(ve,e).clone(),this._applyMosaicAndRenderingRules(e),te(this.url,e,this._getRequestOptions(t))}async measurePointOrCentroid(e,t){const r=await this._fetchCapabilities(t?.signal);if(!(r.mensuration.supportsPointOrCentroid&&(!e.is3D||r.mensuration.supports3D)))throw new o("imagery-layer:measure-point-or-centroid","this operation is not supported on the input image service");return e=R(Ie,e).clone(),this._applyMosaicAndRenderingRules(e),re(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return p(t)?t.get(e):void 0}getFieldDomain(e,t){const r=this.getField(e);return r?r.domain:null}async fetchImage(e,t,r,i={}){if(null==e||null==t||null==r)throw new o("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required.");if(this.renderer||this.symbolizer){const e=await this.generateRasterInfo(this.renderingRule,{signal:i.signal});e&&(this.rasterInfo=e)}const s=this.getExportImageServiceParameters(e,t,r,i.timeExtent);if(null==s){if(i.requestAsImageElement&&this._canRequestImageElement(this.format)){const e=document.createElement("canvas");return e.width=t,e.height=r,{imageOrCanvasElement:e}}const{bandIds:s,rasterInfo:n}=this,o=(s?.length||n.bandCount)??0,a=t*r,l=n.pixelType,u=[];for(let e=0;e<o;e++)u.push(O.createEmptyBand(l,a));return{pixelData:{pixelBlock:new O({width:t,height:r,pixels:u,mask:new Uint8Array(a),pixelType:l}),extent:e}}}const n={imageServiceParameters:s,imageProps:{extent:e,width:t,height:r,format:this.format},requestAsImageElement:i.requestAsImageElement&&!this.pixelFilter||!1,signal:i.signal};return this._requestArrayBuffer(n)}fetchKeyProperties(e){return n(b(this.parsedUrl)+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.renderingRule:null})}).then((e=>e.data))}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new o("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):n(b(this.parsedUrl)+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.renderingRule:null})}).then((e=>ue.fromJSON(e.data)))}getCatalogItemRasterInfo(e,t){const r={...t,query:this._getQueryParams()};return fe(b(this.parsedUrl),e,r)}async getCatalogItemICSInfo(e,t){const{data:r}=await n(b(this.parsedUrl)+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),i=r&&r.ics;if(!i)return;let s=null;try{s=(await n(b(this.parsedUrl)+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!s||!s.spatialReference)return{ics:i,icsToPixelTransform:null,icsExtent:null,northDirection:null};const o=this.version>=10.7?n(b(this.parsedUrl)+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>({}))):{},a=s.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[s]}),inSR:a.wkid||JSON.stringify(a),outSR:"0:"+e},u=n(b(this.parsedUrl)+"/project",{query:this._getQueryParams(l),...t}).then((e=>e.data)).catch((()=>({}))),p=5,c=(s.xmin+s.xmax)/2,m=(s.ymax-s.ymin)/(p+1),d=s.ymin+m,h=[];for(let n=0;n<p;n++)h.push({x:c,y:d+m*n});const f={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:h}),inSR:a.wkid||JSON.stringify(a),outSR:"0:"+e},g=n(b(this.parsedUrl)+"/project",{query:this._getQueryParams(f),...t}).then((e=>e.data)).catch((()=>({}))),y=await Promise.all([o,u,g]);let R=y[0].ipxf;if(null==R){const e=i.geodataXform?.xf_0;"topup"===e?.name?.toLowerCase()&&6===e?.coefficients?.length&&(R={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const v=ae.fromJSON(y[1]&&y[1].geometries&&y[1].geometries[0]);v&&(v.spatialReference=new Fe({wkid:0,imageCoordinateSystem:i}));const S=y[2].geometries?y[2].geometries.filter((e=>null!=e&&null!=e.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y)):[],I=S.length;if(I<3)return{ics:i,icsToPixelTransform:R,icsExtent:v,northDirection:null};let x=0,w=0,_=0,F=0;for(let n=0;n<I;n++)x+=S[n].x,w+=S[n].y,_+=S[n].x*S[n].x,F+=S[n].x*S[n].y;const D=(I*F-x*w)/(I*_-x*x);let T=0;const j=S[p-1].x>S[0].x,P=S[p-1].y>S[0].y;return D===1/0?T=P?90:270:0===D?T=j?0:180:D>0?T=j?180*Math.atan(D)/Math.PI:180*Math.atan(D)/Math.PI+180:D<0&&(T=P?180+180*Math.atan(D)/Math.PI:360+180*Math.atan(D)/Math.PI),{ics:i,icsToPixelTransform:R,icsExtent:v,northDirection:T}}async generateRasterInfo(e,t){if(this.serviceRasterInfo&&(!e||"none"===e.functionName?.toLowerCase()||this._isVectorFieldResampleFunction(e)))return this.serviceRasterInfo;const r=Pe(e);if(!r)return null;if(this._functionRasterInfos[r])return this._functionRasterInfos[r];const i=this._generateRasterInfo(e,t);this._functionRasterInfos[r]=i;try{return await i}catch{return this._functionRasterInfos[r]=null,null}}getExportImageServiceParameters(e,t,r,i){e=e.clone().shiftCentralMeridian();const s=ie(e.spatialReference,b(this.parsedUrl));this.pixelType!==this.serviceRasterInfo.pixelType&&(this.exportImageServiceParameters.pixelType=this.pixelType);const n=this.exportImageServiceParameters.toJSON(),{bandIds:o,noData:a}=n;let{renderingRule:l}=n;const u=this.renderingRule?.rasterFunctionDefinition,c=!this.renderer||"raster-stretch"===this.renderer.type;if(o?.length&&this._hasRenderingRule(this.renderingRule)&&!u&&c){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:o}};if("Stretch"===l.rasterFunction)e.rasterFunctionArguments.Raster=l.rasterFunctionArguments.Raster,l.rasterFunctionArguments.Raster=e;else if("Colormap"===l.rasterFunction){const t=l.rasterFunctionArguments.Raster;"Stretch"===t?.rasterFunction?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,l.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=l,l=e;n.bandIds=void 0}else n.bandIds=o?.join(",");a instanceof Array&&a.length>0&&(n.noData=a.join(","));const m=this._serviceSupportsMosaicRule?this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,i):null;n.mosaicRule=p(m)?JSON.stringify(m):null;const{multidimensionalSubset:d}=this;if(d&&p(m)&&m.multidimensionalDefinition&&V(m.multidimensionalDefinition,d,!0))return null;n.renderingRule=this._getRenderingRuleString(A.fromJSON(l));const h={};if(i){const{start:e,end:t}=i.toJSON();let r;if(e&&t&&e===t?(h.time=""+e,r=[e]):null==e&&null==t||(h.time=`${e??"null"},${t??"null"}`,r=null!=e&&null!=t?[e,t]:[e??t]),r&&d){const e=d.dimensions.find((({name:e})=>"StdTime"===e));if(2===r.length&&e?.extent.length){if(r[0]=Math.max(r[0],e.extent[0]),r[1]=Math.min(r[1],e.extent[1]??e.extent[0]),r[1]<r[0])return null;h.time=r.join()}const t=new _({variableName:"",dimensionName:"StdTime",isSlice:1===r.length,values:r});if(V([t],d,!0))return null}}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:s,imageSR:s,size:t+","+r,...n,...h}}async getSamples(e,t){if(!(await this._fetchCapabilities(t?.signal))?.operations.supportsGetSamples)throw new o("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=R(we,e).clone();const{raster:r}=this;return r&&null==e.raster&&(e.raster=r),se(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsIdentify)throw new o("imagery-layer:query-rasters","query operation is not supported on the input image service");e=R(Re,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;if(s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule){const t=this._combineMosaicRuleWithTimeExtent(i,e.timeExtent);e.mosaicRule=m(t)}return r&&null==e.raster&&(e.raster=r),ne(this.url,e,this._getRequestOptions(t))}createQuery(){const e=new pe;return e.outFields=["*"],e.returnGeometry=!0,e.where=this.definitionExpression||"1=1",e}async queryRasters(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),oe(this.url,e,t)}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),me(this.url,e,t)}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ce(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new o("imagery-layer: query-visible-rasters","missing query parameter");await this.load();const{pixelSize:r,returnDomainValues:i,returnTopmostRaster:s,showNoDataRecords:n}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let a=!1,l=null,u=null;const m="raster.servicepixelvalue",d=this._rasterFunctionNamesIndex;if(p(e.outFields)&&(a=e.outFields.some((e=>!e.toLowerCase().includes(m))),this.version>=10.4)){const t=e.outFields.filter((e=>e.toLowerCase().includes(m)&&e.length>m.length)).map((e=>{const t=e.slice(m.length+1);return[this._updateRenderingRulesFunctionName(t,d),t]}));l=t.map((e=>new A({functionName:e[0]}))),u=t.map((e=>e[1]));const{renderingRule:r}=this;0===l.length?r?.functionName?(l.push(r),u.push(r.functionName)):l=null:r?.functionName&&!l.some((e=>e.functionName===r.functionName))&&(l.push(r),u.push(r.functionName))}const h=c(e.outSpatialReference)||e.outSpatialReference.equals(this.spatialReference),f=e.timeExtent||this.timeExtent,g=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,f),y=this._getQueryParams({geometry:e.geometry,timeExtent:f,mosaicRule:g,renderingRule:this.version<10.4?this.renderingRule:null,renderingRules:l,pixelSize:r,returnCatalogItems:a,returnGeometry:h,raster:this.raster,maxItemCount:s?1:null});delete y.f;const R=new Re(y);try{await this.generateRasterInfo(this.renderingRule);const r=await ne(this.url,R,{signal:t?.signal,query:{...this.customParameters}}),s=e.outFields,o=null!=r.value&&r.value.toLowerCase().includes("nodata");if(!(a&&!h&&r?.catalogItems?.features.length&&(n||!o)))return this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s});const l=this.objectIdField||"ObjectId",c=r.catalogItems?.features??[],m=c.map((e=>e.attributes?.[l])),d=new pe({objectIds:m,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[l]}),f=await this.queryRasters(d);return f?.features?.length&&f.features.forEach((t=>{c.forEach((r=>{r.attributes[l]===t.attributes[l]&&(r.geometry=new le(t.geometry),p(e.outSpatialReference)&&(r.geometry.spatialReference=e.outSpatialReference))}))})),this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s})}catch{throw new o("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const r=n(b(this.parsedUrl)+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.statistics)),i=n(b(this.parsedUrl)+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.histograms)),s=await Promise.all([r,i]);return s[0]&&s[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:s[0]||null,histograms:s[1]||null}}async createFlowMesh(e,t){const r=this._rasterJobHandler.instance;return r?r.createFlowMesh(e,t):_e(e.meshType,e.simulationSettings,e.flowData,p(t.signal)?t.signal:(new AbortController).signal)}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo.multidimensionalInfo;return E(this.multidimensionalSubset,t)}async _fetchService(e){await this._fetchServiceInfo(e),this.rasterInfo||(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,r=p(this.serviceRasterInfo)?Promise.resolve(this.serviceRasterInfo):de(b(this.parsedUrl),t,{signal:e,query:this._getQueryParams()}).then((e=>(this._set("serviceRasterInfo",e),this._set("multidimensionalInfo",e.multidimensionalInfo),e))),i=this._hasRenderingRule(this.renderingRule)?this.generateRasterInfo(this.renderingRule,{signal:e}):null,s=this._getRasterFunctionInfos();return Promise.all([r,i,s]).then((e=>{e[1]?this._set("rasterInfo",e[1]):this._set("rasterInfo",e[0]),e[2]&&this._set("rasterFunctionInfos",e[2]),this.renderer&&!this._isSupportedRenderer(this.renderer)&&(this._set("renderer",null),u.getLogger(this.declaredClass).warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._set("renderer",this._configRenderer(this.renderer)),this.addHandles([d((()=>this.renderingRule),(e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this.generateRasterInfo(e).then((e=>{e&&(this.rasterInfo=e)}))}))]);const{serviceRasterInfo:t}=this;p(t.multidimensionalInfo)&&this._updateMultidimensionalDefinition(t)}))}_combineMosaicRuleWithTimeExtent(e,t){const r=this.timeInfo,{multidimensionalInfo:i}=this.serviceRasterInfo;if(c(e)||c(i)||c(t)||c(r?.startField))return e;const{startField:s}=r,n=i.variables.some((e=>e.dimensions.some((e=>e.name===s))))?s:"StdTime";if(e=e.clone(),"mosaic-dataset"===this.sourceType)return e.multidimensionalDefinition=e.multidimensionalDefinition?.filter((e=>e.dimensionName!==n)),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const o=e.multidimensionalDefinition.filter((e=>e.dimensionName===n)),a=p(t.start)?t.start.getTime():null,l=p(t.end)?t.end.getTime():null,u=null==a||null==l||a===l,m=u?[a||l]:[[a,l]],d=this.version>=10.8;if(o.length)o.forEach((e=>{e.dimensionName===n&&(d?(e.dimensionName=null,e.isSlice=!1,e.values=[]):(e.isSlice=u,e.values=m))}));else if(!d){const t=e.multidimensionalDefinition.filter((e=>null!=e.variableName&&null==e.dimensionName));t.length?t.forEach((e=>{e.dimensionName=n,e.isSlice=u,e.values=m})):e.multidimensionalDefinition.push(new _({variableName:"",dimensionName:n,isSlice:u,values:m}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return c(e)?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter((e=>!(!e.variableName&&!e.dimensionName))),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this.sourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQuery)throw new o("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=p(e)?R(pe,e):this.createQuery(),t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:e,requestOptions:t}}async _initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new q;this._rasterJobHandler.connectionPromise=e.initialize().then((()=>{this._rasterJobHandler.instance=e}),(()=>{})),await 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}_isSupportedRenderer(e){const{rasterInfo:t,renderingRule:r}=this;return"unique-value"===e.type&&this._hasRenderingRule(r)&&1===t?.bandCount&&["u8","s8"].includes(t.pixelType)||null!=t&&null!=e&&z(t).includes(e.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){let t=this.sourceJSON;if(!t){const{data:r,ssl:i}=await n(b(this.parsedUrl),{query:this._getQueryParams(),signal:e});t=r,this.sourceJSON=t,i&&(this.url=this.url.replace(/^http:/i,"https:"))}if(t.capabilities?.toLowerCase().split(",").map((e=>e.trim())).indexOf("tilesonly")>-1)throw new o("imagery-layer:fetch-service-info","use ImageryTileLayer to open tiles-only image services");this.read(t,{origin:"service",url:this.parsedUrl})}_isMosaicDataset(e){return e.serviceSourceType?"esriImageServiceSourceTypeMosaicDataset"===e.serviceSourceType:e.fields?.length>0}_isMosaicRuleSupported(e){if(!e)return!1;const t=this._isMosaicDataset(e),r=e.currentVersion>=10.71&&e.hasMultidimensions&&!(e.fields?.length>1);return t||r}_isVectorFieldResampleFunction(e){if(c(e))return!1;const{functionName:t,functionArguments:r}=e,i="resample"===t?.toLowerCase(),s=r?.ResampleType||r?.resampleType;return i&&(7===s||10===s)}_isPicture(){return!this.format||this.format.includes("jpg")||this.format.includes("png")}_configRenderer(e){const t=this._isPicture(),{rasterInfo:r}=this;if(!t&&!this.pixelFilter||this._isVectorDataSet()){if(!this.bandIds&&r.bandCount>=3){const e=B(r);!e||3===r.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}e||(e=k(r,{bandIds:this.bandIds,variableName:this.renderingRule?null:this.mosaicRule?.multidimensionalDefinition?.[0].variableName}));const t=G(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=t,this.symbolizer.rasterInfo=r):this.symbolizer=new W({rendererJSON:t,rasterInfo:r}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:p(e.pixelBlock)?e.pixelBlock.clone():null}}_getQueryParams(e){e&&p(e.renderingRule)&&"string"!=typeof e.renderingRule&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));const{raster:t,viewId:r}=this;return{raster:t,viewId:r,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...e?.query,...this.customParameters}}}_decodePixelBlock(e,t,r){return this._rasterJobHandler.instance?this._rasterJobHandler.instance.decode({data:e,options:t}):Q(e,t,r)}async _getRasterFunctionInfos(e){const t=this.sourceJSON.rasterFunctionInfos;if(this.loaded)return t;if(t&&this.version>=10.3){if(1===t.length&&"none"===t[0].name.toLowerCase())return t;return(await n(b(this.parsedUrl)+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e})).data?.rasterFunctionInfos}return null}_canRequestImageElement(e){return!this.pixelFilter&&(!e||e.includes("png"))}async _requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:r,signal:i}=e;if(r&&this._canRequestImageElement(t.format)){return{imageOrCanvasElement:(await n(b(this.parsedUrl)+"/exportImage",{responseType:"image",query:this._getQueryParams({f:"image",...this.refreshParameters,...e.imageServiceParameters}),signal:i})).data,params:t}}const s=this._initJobHandler(),a=n(b(this.parsedUrl)+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:i}),l=(await Promise.all([a,s]))[0].data,u=t.format||"jpgpng";let p=u;if("bsq"!==p&&"bip"!==p&&(p=U(l)),!p)throw new o("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(l)));const c={signal:i},m="gif"===u||"bmp"===u||u.includes("png")&&("png"===p||"jpg"===p)?Q(l,{useCanvas:!0,...t},c):this._decodePixelBlock(l,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:u},c);return{pixelData:{pixelBlock:await m,extent:t.extent},params:t}}_generateRasterInfo(e,t){const r={...t,query:this._getQueryParams()};return he(b(this.parsedUrl),e,r)}_isValidCustomizedMosaicRule(e){return e&&JSON.stringify(e.toJSON())!==JSON.stringify(this.defaultMosaicRule?.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;let t=H(e,{multidimensionalSubset:this.multidimensionalSubset});if(p(t)&&t.length>0){this.mosaicRule=this.mosaicRule||new P;const e=this.mosaicRule.multidimensionalDefinition;!this.sourceJSON.defaultVariableName&&this.renderingRule&&"none"!==this.renderingRule.functionName?.toLowerCase()&&t.forEach((e=>e.variableName="")),t=t.filter((({variableName:e,dimensionName:t})=>e&&"*"!==e||t)),!e?.length&&t.length&&(this.mosaicRule.multidimensionalDefinition=t)}}_processVisibleRastersResponse(e,r){r=r||{};const i=e.value,{templateRRFunctionNames:s,showNoDataRecords:n,returnDomainValues:o,templateFields:a}=r,l=e.processedValues;let u=e.catalogItems&&e.catalogItems.features,c=e.properties&&e.properties.Values&&e.properties.Values.map((e=>e.replace(/ /gi,", ")))||[];const m=this.objectIdField||"ObjectId",d="string"==typeof i&&i.toLowerCase().includes("nodata"),h=[];if(i&&!u&&!d){const e={};e[m]=0;c=[i],u=[new t(this.fullExtent,null,e)]}if(!u)return[];let f,g,y;this._updateResponseFieldNames(u,a),d&&!n&&(u=[]);for(let t=0;t<u.length;t++){if(f=u[t],null!=i){if(g=c[t],y=this.renderingRule&&l&&l.length>0&&s&&s.length>0&&s.includes(this.renderingRule.functionName)?l[s.indexOf(this.renderingRule.functionName)]:i,"nodata"===g.toLowerCase()&&!n)continue;const e="Raster.ItemPixelValue",r="Raster.ServicePixelValue";f.attributes[e]=g,f.attributes[r]=y,this._updateFeatureWithMagDirValues(f,g);const o=this.fields&&this.fields.length>0;let a=this.renderingRule&&p(this.serviceRasterInfo.attributeTable)?o?g:i:y;this.renderingRule||(a=o?g:i),this._updateFeatureWithRasterAttributeTableValues(f,a)}if(f.sourceLayer=f.layer=this,o&&this._updateFeatureWithDomainValues(f),s&&l&&s.length===l.length)for(let e=0;e<s.length;e++){const t="Raster.ServicePixelValue."+s[e];f.attributes[t]=l[e]}h.push(u[t])}return h}_updateFeatureWithRasterAttributeTableValues(e,t){const r=this.rasterInfo.attributeTable||this.serviceRasterInfo.attributeTable;if(c(r))return;const{features:i,fields:s}=r,n=s.map((e=>e.name)).filter((e=>"value"===e.toLowerCase())),o=n&&n[0];if(!o)return;const a=i.filter((e=>e.attributes[o]===(null!=t?parseInt(t,10):null)));a&&a[0]&&s.forEach((t=>{const r=this._rasterAttributeTableFieldPrefix+t.name;e.attributes[r]=a[0].attributes[t.name]}))}_updateFeatureWithMagDirValues(e,t){if(!this._isVectorDataSet())return;const r=t.split(/,\s*/).map((e=>parseFloat(e))),i=r.map((e=>[e])),s=r.map((e=>({minValue:e,maxValue:e,noDataValue:null}))),n=new O({height:1,width:1,pixelType:"f32",pixels:i,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new ae(0,0,0,0,this.spatialReference)});const o="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:L([n.pixels[0][0],n.pixels[1][0]]);e.attributes["Raster.Magnitude"]=o[0],e.attributes["Raster.Direction"]=o[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter((e=>e.domain&&"coded-value"===e.domain.type));null!=t&&t.forEach((t=>{const r=e.attributes[t.name];if(null!=r){const i=t.domain.codedValues.find((e=>e.code===r));i&&(e.attributes[t.name]=i.name)}}))}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const r=this.fieldsIndex;c(r)||e.forEach((e=>{if(e&&e.attributes)for(const i of t){const t=r.get(i)?.name;t&&t!==i&&(e.attributes[i]=e.attributes[t],delete e.attributes[t])}}))}_getRenderingRuleString(e){if(this._hasRenderingRule(e)){let t=e.toJSON();return t=t.rasterFunctionDefinition??t,(t.thumbnail||t.thumbnailEx)&&(t.thumbnail=t.thumbnailEx=null),JSON.stringify(t)}return null}_hasRenderingRule(e){return null!=e&&null!=e.functionName&&"none"!==e.functionName.toLowerCase()}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if("Raw"===e)return e.replace("Raw","None");const r=e.toLowerCase().replace(/ /gi,"_");return t.has(r)?t.get(r):e}_isRFTJson(e){return e&&e.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_isVectorDataSet(){return"esriImageServiceDataTypeVector-UV"===this.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===this.serviceDataType}_applyMosaicAndRenderingRules(e){const{raster:t,mosaicRule:r,renderingRule:i}=this;i&&null==e.renderingRule&&(e.renderingRule=i),r&&null==e.mosaicRule&&(e.mosaicRule=r),t&&null==e.raster&&(e.raster=t)}_readCapabilities(e){const t=e.capabilities?e.capabilities.toLowerCase().split(",").map((e=>e.trim())):["image","catalog"],{currentVersion:r,advancedQueryCapabilities:i,maxRecordCount:s}=e,n=t.includes("image"),o="esriImageServiceDataTypeElevation"===e.serviceDataType,a=!!(e.spatialReference||e.extent&&e.extent.spatialReference),l=t.includes("edit"),u=t.includes("mensuration")&&a,p=null==e.mensurationCapabilities?[]:e.mensurationCapabilities.toLowerCase().split(",").map((e=>e.trim())),c=u&&p.includes("basic");return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:n,supportsExportImage:n,supportsIdentify:n,supportsMeasure:u,supportsDownload:t.includes("download"),supportsQuery:t.includes("catalog")&&e.fields&&e.fields.length>0,supportsGetSamples:r>=10.2&&n,supportsProject:r>=10.3&&n,supportsComputeStatisticsHistograms:r>=10.4&&n,supportsQueryBoundary:r>=10.6&&n,supportsCalculateVolume:r>=10.7&&o,supportsComputePixelLocation:r>=10.7&&t.includes("catalog"),supportsComputeAngles:r>=10.91,supportsAdd:l,supportsDelete:l,supportsEditing:l,supportsUpdate:l,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1,supportsQueryAnalytics:!1,supportsQueryTopFeatures:!1},query:{maxRecordCount:s,maxRecordCountFactor:void 0,supportsStatistics:!!i?.supportsStatistics,supportsOrderBy:!!i?.supportsOrderBy,supportsDistinct:!!i?.supportsDistinct,supportsPagination:!!i?.supportsPagination,supportsStandardizedQueriesOnly:!!i?.useStandardizedQueries,supportsPercentileStatistics:!!i?.supportsPercentileStatistics,supportsCentroid:!!i?.supportsReturningGeometryCentroid,supportsDistance:!!i?.supportsQueryWithDistance,supportsExtent:!!i?.supportsReturningQueryExtent,supportsGeometryProperties:!!i?.supportsReturningGeometryProperties,supportsHavingClause:!!i?.supportsHavingClause,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:!1,supportsTopFeaturesQuery:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!i?.supportsDefaultSR,supportsFullTextSearch:!1,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0},mensuration:{supportsDistanceAndAngle:c,supportsAreaAndPerimeter:c,supportsPointOrCentroid:c,supportsHeightFromBaseAndTop:u&&p.includes("base-top height"),supportsHeightFromBaseAndTopShadow:u&&p.includes("base-top shadow height"),supportsHeightFromTopAndTopShadow:u&&p.includes("top-top shadow height"),supports3D:u&&p.includes("3d")}}}};function b(e){return e?.path??""}return e([f()],g.prototype,"_functionRasterInfos",void 0),e([f()],g.prototype,"_rasterJobHandler",void 0),e([f()],g.prototype,"_cachedRendererJson",void 0),e([f({readOnly:!0})],g.prototype,"_serviceSupportsMosaicRule",void 0),e([v("_serviceSupportsMosaicRule",["currentVersion","fields"])],g.prototype,"readServiceSupportsMosaicRule",null),e([f()],g.prototype,"_rasterAttributeTableFieldPrefix",void 0),e([f({readOnly:!0})],g.prototype,"_rasterFunctionNamesIndex",null),e([f()],g.prototype,"adjustAspectRatio",void 0),e([f({type:[y],json:{write:!0}})],g.prototype,"bandIds",void 0),e([v("bandIds")],g.prototype,"readBandIds",null),e([f({readOnly:!0,json:{read:!1}})],g.prototype,"capabilities",void 0),e([v("service","capabilities",["capabilities","currentVersion","serviceDataType"])],g.prototype,"readCapabilities",null),e([f({type:Number})],g.prototype,"compressionQuality",void 0),e([I("compressionQuality")],g.prototype,"writeCompressionQuality",null),e([f({type:Number})],g.prototype,"compressionTolerance",void 0),e([I("compressionTolerance")],g.prototype,"writeCompressionTolerance",null),e([f({json:{read:{source:"copyrightText"}}})],g.prototype,"copyright",void 0),e([f({readOnly:!0,dependsOn:["_serviceSupportsMosaicRule"]})],g.prototype,"defaultMosaicRule",void 0),e([v("defaultMosaicRule",["defaultMosaicMethod"])],g.prototype,"readDefaultMosaicRule",null),e([f({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],g.prototype,"definitionExpression",void 0),e([f({readOnly:!0,constructOnly:!0})],g.prototype,"exportImageServiceParameters",void 0),e([f()],g.prototype,"rasterInfo",void 0),e([f({readOnly:!0,type:[D]})],g.prototype,"fields",void 0),e([f({readOnly:!0})],g.prototype,"fieldsIndex",null),e([f({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"],json:{write:!0}})],g.prototype,"format",null),e([v("service","format",["serviceDataType"])],g.prototype,"readFormat",null),e([f({type:ae})],g.prototype,"fullExtent",void 0),e([f({readOnly:!0})],g.prototype,"hasMultidimensions",void 0),e([f({json:{read:{source:"maxImageHeight"}}})],g.prototype,"imageMaxHeight",void 0),e([f({json:{read:{source:"maxImageWidth"}}})],g.prototype,"imageMaxWidth",void 0),e([f({type:String,json:{type:C.jsonValues,read:C.read,write:C.write}})],g.prototype,"interpolation",void 0),e([f()],g.prototype,"minScale",void 0),e([v("service","minScale")],g.prototype,"readMinScale",null),e([f()],g.prototype,"maxScale",void 0),e([v("service","maxScale")],g.prototype,"readMaxScale",null),e([f({type:P})],g.prototype,"mosaicRule",null),e([v("mosaicRule",["mosaicRule","defaultMosaicMethod"])],g.prototype,"readMosaicRule",null),e([I("mosaicRule")],g.prototype,"writeMosaicRule",null),e([f()],g.prototype,"multidimensionalInfo",void 0),e([f({type:N,json:{write:!0}})],g.prototype,"multidimensionalSubset",void 0),e([f({json:{type:y}})],g.prototype,"noData",void 0),e([I("noData")],g.prototype,"writeNoData",null),e([f({type:String,json:{type:M.jsonValues,read:M.read,write:M.write}})],g.prototype,"noDataInterpretation",void 0),e([f({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],g.prototype,"objectIdField",void 0),e([v("objectIdField")],g.prototype,"readObjectIdField",null),e([f({})],g.prototype,"geometryType",void 0),e([f({})],g.prototype,"typeIdField",void 0),e([f({})],g.prototype,"types",void 0),e([f({readOnly:!0})],g.prototype,"parsedUrl",null),e([f({type:Function})],g.prototype,"pixelFilter",void 0),e([f()],g.prototype,"raster",void 0),e([f({readOnly:!0})],g.prototype,"sourceType",void 0),e([v("sourceType",["serviceSourceType","fields"])],g.prototype,"readSourceType",null),e([f()],g.prototype,"viewId",void 0),e([f({types:r,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:i,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],g.prototype,"renderer",null),e([v("renderer")],g.prototype,"readRenderer",null),e([I("renderer")],g.prototype,"writeRenderer",null),e([f()],g.prototype,"symbolizer",void 0),e([f(x)],g.prototype,"opacity",void 0),e([f({readOnly:!0})],g.prototype,"rasterFields",null),e([f({constructOnly:!0})],g.prototype,"rasterFunctionInfos",void 0),e([f({type:A})],g.prototype,"renderingRule",null),e([v("renderingRule",["renderingRule","rasterFunctionInfos"])],g.prototype,"readRenderingRule",null),e([I("renderingRule")],g.prototype,"writeRenderingRule",null),e([f()],g.prototype,"serviceDataType",void 0),e([f({readOnly:!0,type:Fe})],g.prototype,"spatialReference",void 0),e([v("spatialReference",["spatialReference","extent"])],g.prototype,"readSpatialReference",null),e([f({json:{type:De.jsonValues}})],g.prototype,"pixelType",void 0),e([v("pixelType")],g.prototype,"readPixelType",null),e([I("pixelType")],g.prototype,"writePixelType",null),e([f({constructOnly:!0,type:J})],g.prototype,"serviceRasterInfo",void 0),e([f()],g.prototype,"sourceJSON",void 0),e([f(w)],g.prototype,"url",void 0),e([f({readOnly:!0})],g.prototype,"version",void 0),e([v("version",["currentVersion","fields","timeInfo"])],g.prototype,"readVersion",null),g=e([S("esri.layers.mixins.ArcGISImageService")],g),g};export{Ne as ArcGISImageService};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import{rasterRendererTypes as r,websceneRasterRendererTypes as i,read as s}from"../../rasterRenderers.js";import n from"../../request.js";import o from"../../core/Error.js";import{strict as a}from"../../core/jsonMap.js";import{clone as l}from"../../core/lang.js";import u from"../../core/Logger.js";import{isSome as p,isNone as c,unwrap as m}from"../../core/maybe.js";import{watch as d}from"../../core/reactiveUtils.js";import{urlToObject as h}from"../../core/urlUtils.js";import{property as f,ensureRange as g}from"../../core/accessorSupport/decorators/property.js";import{Integer as y,ensureClass as R,ensureNumber as b}from"../../core/accessorSupport/ensureType.js";import{reader as v}from"../../core/accessorSupport/decorators/reader.js";import{subclass as S}from"../../core/accessorSupport/decorators/subclass.js";import{writer as I}from"../../core/accessorSupport/decorators/writer.js";import{opacity as x,url as w}from"../support/commonProperties.js";import _ from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as F}from"../support/ExportImageServiceParameters.js";import D from"../support/Field.js";import T from"../support/FieldsIndex.js";import{isSupportedRendererType as j}from"../support/imageryRendererUtils.js";import P from"../support/MosaicRule.js";import N from"../support/MultidimensionalSubset.js";import O from"../support/PixelBlock.js";import{interpolationKebab as C,noDataInterpretationKebab as M}from"../support/rasterEnums.js";import A from"../support/RasterFunction.js";import J from"../support/RasterInfo.js";import q from"../support/RasterJobHandler.js";import{hasExcludedVariableOrDimension as V,getSubsetVariablesFromMdInfo as E,getDefaultMultidimensionalDefinition as H}from"../support/rasterDatasets/multidimensionalUtils.js";import{decode as Q,getFormat as U}from"../support/rasterFormats/RasterCodec.js";import{uvComponentToVector as L}from"../support/rasterFunctions/vectorFieldUtils.js";import{getSupportedRendererTypes as z,getDefaultBandCombination as B,createDefaultRenderer as k,normalizeRendererJSON as G}from"../../renderers/support/rasterRendererHelper.js";import W from"../../renderers/support/RasterSymbolizer.js";import{computeAngles as K,computePixelSpaceLocations as X,computeHistograms as $,computeStatisticsHistograms as Y,measureHeight as Z,measureAreaAndPerimeter as ee,measureDistanceAndAngle as te,measurePointOrCentroid as re,getImageSpatialReferenceQueryParameter as ie,getSamples as se,identify as ne}from"../../rest/imageService.js";import"../../core/has.js";import"../support/source/DataLayerSource.js";import{executeQueryJSON as oe}from"../../rest/query/executeQueryJSON.js";import"../../config.js";import"../../kernel.js";import"../../core/unitUtils.js";import"../../geometry/support/spatialReferenceUtils.js";import"../graphics/featureConversionUtils.js";import ae from"../../geometry/Extent.js";import"../../geometry/Geometry.js";import"../../geometry/Multipoint.js";import"../../geometry/Point.js";import le from"../../geometry/Polygon.js";import"../../geometry/Polyline.js";import"../../geometry/support/normalizeUtils.js";import"../../core/pbf.js";import ue from"../../rest/support/FeatureSet.js";import pe from"../../rest/support/Query.js";import"../../rest/query/support/AttachmentInfo.js";import"../../rest/support/AttachmentQuery.js";import{executeForCount as ce}from"../../rest/query/executeForCount.js";import{executeForIds as me}from"../../rest/query/executeForIds.js";import"../../rest/support/RelationshipQuery.js";import"../../rest/support/TopFeaturesQuery.js";import{fetchServiceRasterInfo as de,generateRasterInfo as he}from"../../rest/imageService/fetchRasterInfo.js";import{getCatalogItemRasterInfo as fe}from"../../rest/imageService/getCatalogItemRasterInfo.js";import ge from"../../rest/support/ImageAngleParameters.js";import ye from"../../rest/support/ImageAreaParameters.js";import Re from"../../rest/support/ImageDistanceParameters.js";import be from"../../rest/support/ImageHeightParameters.js";import ve from"../../rest/support/ImageHistogramParameters.js";import Se from"../../rest/support/ImageIdentifyParameters.js";import Ie from"../../rest/support/ImagePixelLocationParameters.js";import xe from"../../rest/support/ImagePointParameters.js";import we from"../../rest/support/ImageSampleParameters.js";import{createFlowMesh as _e}from"../../views/2d/engine/flow/dataUtils.js";import Fe from"../../geometry/SpatialReference.js";const De=a()({U1:"u1",U2:"u2",U4:"u4",U8:"u8",S8:"s8",U16:"u16",S16:"s16",U32:"u32",S32:"s32",F32:"f32",F64:"f64",C64:"c64",C128:"c128",UNKNOWN:"unknown"}),Te=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),je=g(b,{min:0,max:255});function Pe(e){if(!e)return null;const t=JSON.stringify(e).match(/"rasterFunction":"(.*?")/gi)?.map((e=>e.replace('"rasterFunction":"',"").replace('"',"")));return t?t.join("/"):null}const Ne=a=>{let g=class extends a{constructor(){super(...arguments),this._functionRasterInfos={},this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this._cachedRendererJson=null,this._serviceSupportsMosaicRule=null,this._rasterAttributeTableFieldPrefix="Raster.",this.adjustAspectRatio=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.defaultMosaicRule=null,this.definitionExpression=null,this.exportImageServiceParameters=null,this.rasterInfo=null,this.fields=null,this.fullExtent=null,this.hasMultidimensions=!1,this.imageMaxHeight=4100,this.imageMaxWidth=4100,this.interpolation=void 0,this.minScale=0,this.maxScale=0,this.multidimensionalInfo=null,this.multidimensionalSubset=null,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelFilter=null,this.raster=void 0,this.sourceType=null,this.viewId=void 0,this.symbolizer=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=void 0}initialize(){this._set("exportImageServiceParameters",new F({layer:this}))}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get _rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.length<1||p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.forEach((t=>{e.set(t.name.toLowerCase().replace(/ /gi,"_"),t.name)})),e}readBandIds(e,t){if(Array.isArray(e)&&e.length>0&&e.every((e=>"number"==typeof e)))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,r){null!=e&&"lerc"!==this.format&&(t[r]=e)}writeCompressionTolerance(e,t,r){"lerc"===this.format&&null!=e&&(t[r]=e)}readDefaultMosaicRule(e,t){return this._serviceSupportsMosaicRule?P.fromJSON(t):null}get fieldsIndex(){return this.fields?new T(this.fields):null}set format(e){e&&Te.has(e.toLowerCase())&&this._set("format",e.toLowerCase())}readFormat(e,t){return"esriImageServiceDataTypeVector-UV"===t.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===t.serviceDataType||null!=this.pixelFilter?"lerc":"jpgpng"}readMinScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}readMaxScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}set mosaicRule(e){let t=e;t&&t.mosaicMethod&&(t=P.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const r=e||t.mosaicRule;return r?P.fromJSON(r):this._isMosaicRuleSupported(t)?P.fromJSON(t):null}writeMosaicRule(e,t,r){let i=this.mosaicRule;const s=this.definitionExpression;i?s&&s!==i.where&&(i=i.clone(),i.where=s):s&&(i=new P({where:s})),this._isValidCustomizedMosaicRule(i)&&(t[r]=i.toJSON())}writeNoData(e,t,r){null!=e&&"number"==typeof e&&(t[r]=je(e))}readObjectIdField(e,t){if(!e){const r=t.fields.filter((e=>"esriFieldTypeOID"===e.type||"oid"===e.type));e=r&&r[0]&&r[0].name}return e}get parsedUrl(){return h(this.url)}readSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}set renderer(e){this.loaded&&(e=this._configRenderer(e)),this._set("renderer",e)}readRenderer(e,t,r){const i=t?.layerDefinition?.drawingInfo?.renderer,n=s(i,r);return null==n?null:("vector-field"===n.type&&t.symbolTileSize&&!i.symbolTileSize&&(n.symbolTileSize=t.symbolTileSize),j(n)||u.getLogger(this.declaredClass).warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),n)}writeRenderer(e,t,r){t.layerDefinition=t.layerDefinition||{},t.layerDefinition.drawingInfo=t.layerDefinition.drawingInfo||{},t.layerDefinition.drawingInfo.renderer=e.toJSON(),"vector-field"===e.type&&(t.symbolTileSize=e.symbolTileSize)}get rasterFields(){const e=this._rasterAttributeTableFieldPrefix||"Raster.",t=new D({name:"Raster.ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:"string"}),r=new D({name:"Raster.ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:"string"}),i=new D({name:"Raster.ServicePixelValue.Raw",alias:"Raw Service Pixel Value",domain:null,editable:!1,length:50,type:"string"});let s=this.fields?l(this.fields):[];s.push(r),this.capabilities?.operations.supportsQuery&&this.fields&&this.fields.length>0&&s.push(t),this.version>=10.4&&p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.some((e=>"none"===e.name.toLowerCase()))&&s.push(i),p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.filter((e=>"none"!==e.name.toLowerCase())).forEach((e=>{s.push(new D({name:"Raster.ServicePixelValue."+e.name,alias:e.name,domain:null,editable:!1,length:50,type:"string"}))})),this._isVectorDataSet()&&(s.push(new D({name:"Raster.Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"double"})),s.push(new D({name:"Raster.Direction",alias:"Direction",domain:null,editable:!1,type:"double"})));const{attributeTable:n}=this.rasterInfo??{};if(p(n)){const t=n.fields.filter((e=>"esriFieldTypeOID"!==e.type&&"value"!==e.name.toLowerCase())).map((t=>{const r=l(t);return r.name=e+t.name,r}));s=s.concat(t)}return s}set renderingRule(e){let t=e;t&&t.rasterFunction&&(t=A.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("renderingRule",t)}readRenderingRule(e,t){const r=t.rasterFunctionInfos;return t.renderingRule||r&&r.length&&"None"!==r[0].name?this._isRFTJson(t.renderingRule)?A.fromJSON({rasterFunctionDefinition:t.renderingRule}):A.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}writeRenderingRule(e,t,r){const i=e.toJSON();i.rasterFunctionDefinition?t[r]=i.rasterFunctionDefinition:t[r]=i}readSpatialReference(e,t){const r=e||t.extent.spatialReference;return r?Fe.fromJSON(r):null}readPixelType(e){return De.fromJSON(e)||e}writePixelType(e,t,r){(c(this.serviceRasterInfo)||this.pixelType!==this.serviceRasterInfo.pixelType)&&(t[r]=De.toJSON(e))}readVersion(e,t){let r=t.currentVersion;return r||(r=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),r}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let r=e;const{renderer:i,symbolizer:s,pixelFilter:n,bandIds:o}=this;if(!this._isPicture()&&i&&s&&!n){const n=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(i.toJSON()),a=this._rasterJobHandler.instance;if(a){n&&(s.bind(),await a.updateSymbolizer(s,t),this._cachedRendererJson=i.toJSON());const l=await a.symbolize({bandIds:o,...e},t);r={extent:e.extent,pixelBlock:l}}else r={extent:e.extent,pixelBlock:s.symbolize({bandIds:o,...e})}}return r}destroy(){this._shutdownJobHandler()}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}async computeAngles(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeAngles)throw new o("imagery-layer:compute-angles","this operation is not supported on the input image service");return e=R(ge,e).clone(),K(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputePixelLocation)throw new o("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=R(Ie,e).clone(),X(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeHistograms)throw new o("imagery-layer:compute-histograms","this operation is not supported on the input image service");return e=R(ve,e).clone(),this._applyMosaicAndRenderingRules(e),$(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeStatisticsHistograms)throw new o("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");return e=R(ve,e).clone(),this._applyMosaicAndRenderingRules(e),Y(this.url,e,this._getRequestOptions(t))}async measureHeight(e,t){const r=await this._fetchCapabilities(t?.signal);if(!("base-and-top"===e.operationType?r.mensuration.supportsHeightFromBaseAndTop:"base-and-top-shadow"===e.operationType?r.mensuration.supportsHeightFromBaseAndTopShadow:r.mensuration.supportsHeightFromTopAndTopShadow))throw new o("imagery-layer:measure-height","this operation is not supported on the input image service");return e=R(be,e).clone(),this._applyMosaicAndRenderingRules(e),Z(this.url,e,this._getRequestOptions(t))}async measureAreaAndPerimeter(e,t){const r=await this._fetchCapabilities(t?.signal);if(!(r.mensuration.supportsAreaAndPerimeter&&(!e.is3D||r.mensuration.supports3D)))throw new o("imagery-layer:measure-area-and-perimeter","this operation is not supported on the input image service");return e=R(ye,e).clone(),this._applyMosaicAndRenderingRules(e),ee(this.url,e,this._getRequestOptions(t))}async measureDistanceAndAngle(e,t){const r=await this._fetchCapabilities(t?.signal);if(!(r.mensuration.supportsDistanceAndAngle&&(!e.is3D||r.mensuration.supports3D)))throw new o("imagery-layer:measure-distance-and-angle","this operation is not supported on the input image service");return e=R(Re,e).clone(),this._applyMosaicAndRenderingRules(e),te(this.url,e,this._getRequestOptions(t))}async measurePointOrCentroid(e,t){const r=await this._fetchCapabilities(t?.signal);if(!(r.mensuration.supportsPointOrCentroid&&(!e.is3D||r.mensuration.supports3D)))throw new o("imagery-layer:measure-point-or-centroid","this operation is not supported on the input image service");return e=R(xe,e).clone(),this._applyMosaicAndRenderingRules(e),re(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return p(t)?t.get(e):void 0}getFieldDomain(e,t){const r=this.getField(e);return r?r.domain:null}async fetchImage(e,t,r,i={}){if(null==e||null==t||null==r)throw new o("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required.");if(this.renderer||this.symbolizer){const e=await this.generateRasterInfo(this.renderingRule,{signal:i.signal});e&&(this.rasterInfo=e)}const s=this.getExportImageServiceParameters(e,t,r,i.timeExtent);if(null==s){if(i.requestAsImageElement&&this._canRequestImageElement(this.format)){const e=document.createElement("canvas");return e.width=t,e.height=r,{imageOrCanvasElement:e}}const{bandIds:s,rasterInfo:n}=this,o=(s?.length||n.bandCount)??0,a=t*r,l=n.pixelType,u=[];for(let e=0;e<o;e++)u.push(O.createEmptyBand(l,a));return{pixelData:{pixelBlock:new O({width:t,height:r,pixels:u,mask:new Uint8Array(a),pixelType:l}),extent:e}}}const n={imageServiceParameters:s,imageProps:{extent:e,width:t,height:r,format:this.format},requestAsImageElement:i.requestAsImageElement&&!this.pixelFilter||!1,signal:i.signal};return this._requestArrayBuffer(n)}fetchKeyProperties(e){return n(b(this.parsedUrl)+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.renderingRule:null})}).then((e=>e.data))}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new o("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):n(b(this.parsedUrl)+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.renderingRule:null})}).then((e=>ue.fromJSON(e.data)))}getCatalogItemRasterInfo(e,t){const r={...t,query:this._getQueryParams()};return fe(b(this.parsedUrl),e,r)}async getCatalogItemICSInfo(e,t){const{data:r}=await n(b(this.parsedUrl)+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),i=r&&r.ics;if(!i)return;let s=null;try{s=(await n(b(this.parsedUrl)+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!s||!s.spatialReference)return{ics:i,icsToPixelTransform:null,icsExtent:null,northDirection:null};const o=this.version>=10.7?n(b(this.parsedUrl)+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>({}))):{},a=s.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[s]}),inSR:a.wkid||JSON.stringify(a),outSR:"0:"+e},u=n(b(this.parsedUrl)+"/project",{query:this._getQueryParams(l),...t}).then((e=>e.data)).catch((()=>({}))),p=5,c=(s.xmin+s.xmax)/2,m=(s.ymax-s.ymin)/(p+1),d=s.ymin+m,h=[];for(let n=0;n<p;n++)h.push({x:c,y:d+m*n});const f={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:h}),inSR:a.wkid||JSON.stringify(a),outSR:"0:"+e},g=n(b(this.parsedUrl)+"/project",{query:this._getQueryParams(f),...t}).then((e=>e.data)).catch((()=>({}))),y=await Promise.all([o,u,g]);let R=y[0].ipxf;if(null==R){const e=i.geodataXform?.xf_0;"topup"===e?.name?.toLowerCase()&&6===e?.coefficients?.length&&(R={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const v=ae.fromJSON(y[1]&&y[1].geometries&&y[1].geometries[0]);v&&(v.spatialReference=new Fe({wkid:0,imageCoordinateSystem:i}));const S=y[2].geometries?y[2].geometries.filter((e=>null!=e&&null!=e.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y)):[],I=S.length;if(I<3)return{ics:i,icsToPixelTransform:R,icsExtent:v,northDirection:null};let x=0,w=0,_=0,F=0;for(let n=0;n<I;n++)x+=S[n].x,w+=S[n].y,_+=S[n].x*S[n].x,F+=S[n].x*S[n].y;const D=(I*F-x*w)/(I*_-x*x);let T=0;const j=S[p-1].x>S[0].x,P=S[p-1].y>S[0].y;return D===1/0?T=P?90:270:0===D?T=j?0:180:D>0?T=j?180*Math.atan(D)/Math.PI:180*Math.atan(D)/Math.PI+180:D<0&&(T=P?180+180*Math.atan(D)/Math.PI:360+180*Math.atan(D)/Math.PI),{ics:i,icsToPixelTransform:R,icsExtent:v,northDirection:T}}async generateRasterInfo(e,t){if(this.serviceRasterInfo&&(!e||"none"===e.functionName?.toLowerCase()||this._isVectorFieldResampleFunction(e)))return this.serviceRasterInfo;const r=Pe(e);if(!r)return null;if(this._functionRasterInfos[r])return this._functionRasterInfos[r];const i=this._generateRasterInfo(e,t);this._functionRasterInfos[r]=i;try{return await i}catch{return this._functionRasterInfos[r]=null,null}}getExportImageServiceParameters(e,t,r,i){e=e.clone().shiftCentralMeridian();const s=ie(e.spatialReference,b(this.parsedUrl));this.pixelType!==this.serviceRasterInfo.pixelType&&(this.exportImageServiceParameters.pixelType=this.pixelType);const n=this.exportImageServiceParameters.toJSON(),{bandIds:o,noData:a}=n;let{renderingRule:l}=n;const u=this.renderingRule?.rasterFunctionDefinition,c=!this.renderer||"raster-stretch"===this.renderer.type;if(o?.length&&this._hasRenderingRule(this.renderingRule)&&!u&&c){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:o}};if("Stretch"===l.rasterFunction)e.rasterFunctionArguments.Raster=l.rasterFunctionArguments.Raster,l.rasterFunctionArguments.Raster=e;else if("Colormap"===l.rasterFunction){const t=l.rasterFunctionArguments.Raster;"Stretch"===t?.rasterFunction?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,l.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=l,l=e;n.bandIds=void 0}else n.bandIds=o?.join(",");a instanceof Array&&a.length>0&&(n.noData=a.join(","));const m=this._serviceSupportsMosaicRule?this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,i):null;n.mosaicRule=p(m)?JSON.stringify(m):null;const{multidimensionalSubset:d}=this;if(d&&p(m)&&m.multidimensionalDefinition&&V(m.multidimensionalDefinition,d,!0))return null;n.renderingRule=this._getRenderingRuleString(A.fromJSON(l));const h={};if(i){const{start:e,end:t}=i.toJSON();let r;if(e&&t&&e===t?(h.time=""+e,r=[e]):null==e&&null==t||(h.time=`${e??"null"},${t??"null"}`,r=null!=e&&null!=t?[e,t]:[e??t]),r&&d){const e=d.dimensions.find((({name:e})=>"StdTime"===e));if(2===r.length&&e?.extent.length){if(r[0]=Math.max(r[0],e.extent[0]),r[1]=Math.min(r[1],e.extent[1]??e.extent[0]),r[1]<r[0])return null;h.time=r.join()}const t=new _({variableName:"",dimensionName:"StdTime",isSlice:1===r.length,values:r});if(V([t],d,!0))return null}}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:s,imageSR:s,size:t+","+r,...n,...h}}async getSamples(e,t){if(!(await this._fetchCapabilities(t?.signal))?.operations.supportsGetSamples)throw new o("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=R(we,e).clone();const{raster:r}=this;return r&&null==e.raster&&(e.raster=r),se(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsIdentify)throw new o("imagery-layer:query-rasters","query operation is not supported on the input image service");e=R(Se,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;if(s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule){const t=this._combineMosaicRuleWithTimeExtent(i,e.timeExtent);e.mosaicRule=m(t)}return r&&null==e.raster&&(e.raster=r),ne(this.url,e,this._getRequestOptions(t))}createQuery(){const e=new pe;return e.outFields=["*"],e.returnGeometry=!0,e.where=this.definitionExpression||"1=1",e}async queryRasters(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),oe(this.url,e,t)}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),me(this.url,e,t)}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ce(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new o("imagery-layer: query-visible-rasters","missing query parameter");await this.load();const{pixelSize:r,returnDomainValues:i,returnTopmostRaster:s,showNoDataRecords:n}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let a=!1,l=null,u=null;const m="raster.servicepixelvalue",d=this._rasterFunctionNamesIndex;if(p(e.outFields)&&(a=e.outFields.some((e=>!e.toLowerCase().includes(m))),this.version>=10.4)){const t=e.outFields.filter((e=>e.toLowerCase().includes(m)&&e.length>m.length)).map((e=>{const t=e.slice(m.length+1);return[this._updateRenderingRulesFunctionName(t,d),t]}));l=t.map((e=>new A({functionName:e[0]}))),u=t.map((e=>e[1]));const{renderingRule:r}=this;0===l.length?r?.functionName?(l.push(r),u.push(r.functionName)):l=null:r?.functionName&&!l.some((e=>e.functionName===r.functionName))&&(l.push(r),u.push(r.functionName))}const h=c(e.outSpatialReference)||e.outSpatialReference.equals(this.spatialReference),f=e.timeExtent||this.timeExtent,g=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,f),y=this._getQueryParams({geometry:e.geometry,timeExtent:f,mosaicRule:g,renderingRule:this.version<10.4?this.renderingRule:null,renderingRules:l,pixelSize:r,returnCatalogItems:a,returnGeometry:h,raster:this.raster,maxItemCount:s?1:null});delete y.f;const R=new Se(y);try{await this.generateRasterInfo(this.renderingRule);const r=await ne(this.url,R,{signal:t?.signal,query:{...this.customParameters}}),s=e.outFields,o=null!=r.value&&r.value.toLowerCase().includes("nodata");if(!(a&&!h&&r?.catalogItems?.features.length&&(n||!o)))return this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s});const l=this.objectIdField||"ObjectId",c=r.catalogItems?.features??[],m=c.map((e=>e.attributes?.[l])),d=new pe({objectIds:m,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[l]}),f=await this.queryRasters(d);return f?.features?.length&&f.features.forEach((t=>{c.forEach((r=>{r.attributes[l]===t.attributes[l]&&(r.geometry=new le(t.geometry),p(e.outSpatialReference)&&(r.geometry.spatialReference=e.outSpatialReference))}))})),this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s})}catch{throw new o("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const r=n(b(this.parsedUrl)+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.statistics)),i=n(b(this.parsedUrl)+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.histograms)),s=await Promise.all([r,i]);return s[0]&&s[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:s[0]||null,histograms:s[1]||null}}async createFlowMesh(e,t){const r=this._rasterJobHandler.instance;return r?r.createFlowMesh(e,t):_e(e.meshType,e.simulationSettings,e.flowData,p(t.signal)?t.signal:(new AbortController).signal)}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo.multidimensionalInfo;return E(this.multidimensionalSubset,t)}async _fetchService(e){await this._fetchServiceInfo(e),this.rasterInfo||(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,r=p(this.serviceRasterInfo)?Promise.resolve(this.serviceRasterInfo):de(b(this.parsedUrl),t,{signal:e,query:this._getQueryParams()}).then((e=>(this._set("serviceRasterInfo",e),this._set("multidimensionalInfo",e.multidimensionalInfo),e))),i=this._hasRenderingRule(this.renderingRule)?this.generateRasterInfo(this.renderingRule,{signal:e}):null,s=this._getRasterFunctionInfos();return Promise.all([r,i,s]).then((e=>{e[1]?this._set("rasterInfo",e[1]):this._set("rasterInfo",e[0]),e[2]&&this._set("rasterFunctionInfos",e[2]),this.renderer&&!this._isSupportedRenderer(this.renderer)&&(this._set("renderer",null),u.getLogger(this.declaredClass).warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._set("renderer",this._configRenderer(this.renderer)),this.addHandles([d((()=>this.renderingRule),(e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this.generateRasterInfo(e).then((e=>{e&&(this.rasterInfo=e)}))}))]);const{serviceRasterInfo:t}=this;p(t.multidimensionalInfo)&&this._updateMultidimensionalDefinition(t)}))}_combineMosaicRuleWithTimeExtent(e,t){const r=this.timeInfo,{multidimensionalInfo:i}=this.serviceRasterInfo;if(c(e)||c(i)||c(t)||c(r?.startField))return e;const{startField:s}=r,n=i.variables.some((e=>e.dimensions.some((e=>e.name===s))))?s:"StdTime";if(e=e.clone(),"mosaic-dataset"===this.sourceType)return e.multidimensionalDefinition=e.multidimensionalDefinition?.filter((e=>e.dimensionName!==n)),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const o=e.multidimensionalDefinition.filter((e=>e.dimensionName===n)),a=p(t.start)?t.start.getTime():null,l=p(t.end)?t.end.getTime():null,u=null==a||null==l||a===l,m=u?[a||l]:[[a,l]],d=this.version>=10.8;if(o.length)o.forEach((e=>{e.dimensionName===n&&(d?(e.dimensionName=null,e.isSlice=!1,e.values=[]):(e.isSlice=u,e.values=m))}));else if(!d){const t=e.multidimensionalDefinition.filter((e=>null!=e.variableName&&null==e.dimensionName));t.length?t.forEach((e=>{e.dimensionName=n,e.isSlice=u,e.values=m})):e.multidimensionalDefinition.push(new _({variableName:"",dimensionName:n,isSlice:u,values:m}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return c(e)?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter((e=>!(!e.variableName&&!e.dimensionName))),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this.sourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQuery)throw new o("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=p(e)?R(pe,e):this.createQuery(),t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:e,requestOptions:t}}async _initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new q;this._rasterJobHandler.connectionPromise=e.initialize().then((()=>{this._rasterJobHandler.instance=e}),(()=>{})),await 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}_isSupportedRenderer(e){const{rasterInfo:t,renderingRule:r}=this;return"unique-value"===e.type&&this._hasRenderingRule(r)&&1===t?.bandCount&&["u8","s8"].includes(t.pixelType)||null!=t&&null!=e&&z(t).includes(e.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){let t=this.sourceJSON;if(!t){const{data:r,ssl:i}=await n(b(this.parsedUrl),{query:this._getQueryParams(),signal:e});t=r,this.sourceJSON=t,i&&(this.url=this.url.replace(/^http:/i,"https:"))}if(t.capabilities?.toLowerCase().split(",").map((e=>e.trim())).indexOf("tilesonly")>-1)throw new o("imagery-layer:fetch-service-info","use ImageryTileLayer to open tiles-only image services");this.read(t,{origin:"service",url:this.parsedUrl})}_isMosaicDataset(e){return e.serviceSourceType?"esriImageServiceSourceTypeMosaicDataset"===e.serviceSourceType:e.fields?.length>0}_isMosaicRuleSupported(e){if(!e)return!1;const t=this._isMosaicDataset(e),r=e.currentVersion>=10.71&&e.hasMultidimensions&&!(e.fields?.length>1);return t||r}_isVectorFieldResampleFunction(e){if(c(e))return!1;const{functionName:t,functionArguments:r}=e,i="resample"===t?.toLowerCase(),s=r?.ResampleType||r?.resampleType;return i&&(7===s||10===s)}_isPicture(){return!this.format||this.format.includes("jpg")||this.format.includes("png")}_configRenderer(e){const t=this._isPicture(),{rasterInfo:r}=this;if(!t&&!this.pixelFilter||this._isVectorDataSet()){if(!this.bandIds&&r.bandCount>=3){const e=B(r);!e||3===r.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}e||(e=k(r,{bandIds:this.bandIds,variableName:this.renderingRule?null:this.mosaicRule?.multidimensionalDefinition?.[0].variableName}));const t=G(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=t,this.symbolizer.rasterInfo=r):this.symbolizer=new W({rendererJSON:t,rasterInfo:r}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:p(e.pixelBlock)?e.pixelBlock.clone():null}}_getQueryParams(e){e&&p(e.renderingRule)&&"string"!=typeof e.renderingRule&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));const{raster:t,viewId:r}=this;return{raster:t,viewId:r,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...e?.query,...this.customParameters}}}_decodePixelBlock(e,t,r){return this._rasterJobHandler.instance?this._rasterJobHandler.instance.decode({data:e,options:t}):Q(e,t,r)}async _getRasterFunctionInfos(e){const t=this.sourceJSON.rasterFunctionInfos;if(this.loaded)return t;if(t&&this.version>=10.3){if(1===t.length&&"none"===t[0].name.toLowerCase())return t;return(await n(b(this.parsedUrl)+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e})).data?.rasterFunctionInfos}return null}_canRequestImageElement(e){return!this.pixelFilter&&(!e||e.includes("png"))}async _requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:r,signal:i}=e;if(r&&this._canRequestImageElement(t.format)){return{imageOrCanvasElement:(await n(b(this.parsedUrl)+"/exportImage",{responseType:"image",query:this._getQueryParams({f:"image",...this.refreshParameters,...e.imageServiceParameters}),signal:i})).data,params:t}}const s=this._initJobHandler(),a=n(b(this.parsedUrl)+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:i}),l=(await Promise.all([a,s]))[0].data,u=t.format||"jpgpng";let p=u;if("bsq"!==p&&"bip"!==p&&(p=U(l)),!p)throw new o("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(l)));const c={signal:i},m="gif"===u||"bmp"===u||u.includes("png")&&("png"===p||"jpg"===p)?Q(l,{useCanvas:!0,...t},c):this._decodePixelBlock(l,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:u},c);return{pixelData:{pixelBlock:await m,extent:t.extent},params:t}}_generateRasterInfo(e,t){const r={...t,query:this._getQueryParams()};return he(b(this.parsedUrl),e,r)}_isValidCustomizedMosaicRule(e){return e&&JSON.stringify(e.toJSON())!==JSON.stringify(this.defaultMosaicRule?.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;let t=H(e,{multidimensionalSubset:this.multidimensionalSubset});if(p(t)&&t.length>0){this.mosaicRule=this.mosaicRule||new P;const e=this.mosaicRule.multidimensionalDefinition;!this.sourceJSON.defaultVariableName&&this.renderingRule&&"none"!==this.renderingRule.functionName?.toLowerCase()&&t.forEach((e=>e.variableName="")),t=t.filter((({variableName:e,dimensionName:t})=>e&&"*"!==e||t)),!e?.length&&t.length&&(this.mosaicRule.multidimensionalDefinition=t)}}_processVisibleRastersResponse(e,r){r=r||{};const i=e.value,{templateRRFunctionNames:s,showNoDataRecords:n,returnDomainValues:o,templateFields:a}=r,l=e.processedValues;let u=e.catalogItems&&e.catalogItems.features,c=e.properties&&e.properties.Values&&e.properties.Values.map((e=>e.replace(/ /gi,", ")))||[];const m=this.objectIdField||"ObjectId",d="string"==typeof i&&i.toLowerCase().includes("nodata"),h=[];if(i&&!u&&!d){const e={};e[m]=0;c=[i],u=[new t(this.fullExtent,null,e)]}if(!u)return[];let f,g,y;this._updateResponseFieldNames(u,a),d&&!n&&(u=[]);for(let t=0;t<u.length;t++){if(f=u[t],null!=i){if(g=c[t],y=this.renderingRule&&l&&l.length>0&&s&&s.length>0&&s.includes(this.renderingRule.functionName)?l[s.indexOf(this.renderingRule.functionName)]:i,"nodata"===g.toLowerCase()&&!n)continue;const e="Raster.ItemPixelValue",r="Raster.ServicePixelValue";f.attributes[e]=g,f.attributes[r]=y,this._updateFeatureWithMagDirValues(f,g);const o=this.fields&&this.fields.length>0;let a=this.renderingRule&&p(this.serviceRasterInfo.attributeTable)?o?g:i:y;this.renderingRule||(a=o?g:i),this._updateFeatureWithRasterAttributeTableValues(f,a)}if(f.sourceLayer=f.layer=this,o&&this._updateFeatureWithDomainValues(f),s&&l&&s.length===l.length)for(let e=0;e<s.length;e++){const t="Raster.ServicePixelValue."+s[e];f.attributes[t]=l[e]}h.push(u[t])}return h}_updateFeatureWithRasterAttributeTableValues(e,t){const r=this.rasterInfo.attributeTable||this.serviceRasterInfo.attributeTable;if(c(r))return;const{features:i,fields:s}=r,n=s.map((e=>e.name)).filter((e=>"value"===e.toLowerCase())),o=n&&n[0];if(!o)return;const a=i.filter((e=>e.attributes[o]===(null!=t?parseInt(t,10):null)));a&&a[0]&&s.forEach((t=>{const r=this._rasterAttributeTableFieldPrefix+t.name;e.attributes[r]=a[0].attributes[t.name]}))}_updateFeatureWithMagDirValues(e,t){if(!this._isVectorDataSet())return;const r=t.split(/,\s*/).map((e=>parseFloat(e))),i=r.map((e=>[e])),s=r.map((e=>({minValue:e,maxValue:e,noDataValue:null}))),n=new O({height:1,width:1,pixelType:"f32",pixels:i,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new ae(0,0,0,0,this.spatialReference)});const o="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:L([n.pixels[0][0],n.pixels[1][0]]);e.attributes["Raster.Magnitude"]=o[0],e.attributes["Raster.Direction"]=o[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter((e=>e.domain&&"coded-value"===e.domain.type));null!=t&&t.forEach((t=>{const r=e.attributes[t.name];if(null!=r){const i=t.domain.codedValues.find((e=>e.code===r));i&&(e.attributes[t.name]=i.name)}}))}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const r=this.fieldsIndex;c(r)||e.forEach((e=>{if(e&&e.attributes)for(const i of t){const t=r.get(i)?.name;t&&t!==i&&(e.attributes[i]=e.attributes[t],delete e.attributes[t])}}))}_getRenderingRuleString(e){if(this._hasRenderingRule(e)){let t=e.toJSON();return t=t.rasterFunctionDefinition??t,(t.thumbnail||t.thumbnailEx)&&(t.thumbnail=t.thumbnailEx=null),JSON.stringify(t)}return null}_hasRenderingRule(e){return null!=e&&null!=e.functionName&&"none"!==e.functionName.toLowerCase()}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if("Raw"===e)return e.replace("Raw","None");const r=e.toLowerCase().replace(/ /gi,"_");return t.has(r)?t.get(r):e}_isRFTJson(e){return e&&e.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_isVectorDataSet(){return"esriImageServiceDataTypeVector-UV"===this.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===this.serviceDataType}_applyMosaicAndRenderingRules(e){const{raster:t,mosaicRule:r,renderingRule:i}=this;i&&null==e.renderingRule&&(e.renderingRule=i),r&&null==e.mosaicRule&&(e.mosaicRule=r),t&&null==e.raster&&(e.raster=t)}_readCapabilities(e){const t=e.capabilities?e.capabilities.toLowerCase().split(",").map((e=>e.trim())):["image","catalog"],{currentVersion:r,advancedQueryCapabilities:i,maxRecordCount:s}=e,n=t.includes("image"),o="esriImageServiceDataTypeElevation"===e.serviceDataType,a=!!(e.spatialReference||e.extent&&e.extent.spatialReference),l=t.includes("edit"),u=t.includes("mensuration")&&a,p=null==e.mensurationCapabilities?[]:e.mensurationCapabilities.toLowerCase().split(",").map((e=>e.trim())),c=u&&p.includes("basic");return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:n,supportsExportImage:n,supportsIdentify:n,supportsMeasure:u,supportsDownload:t.includes("download"),supportsQuery:t.includes("catalog")&&e.fields&&e.fields.length>0,supportsGetSamples:r>=10.2&&n,supportsProject:r>=10.3&&n,supportsComputeStatisticsHistograms:r>=10.4&&n,supportsQueryBoundary:r>=10.6&&n,supportsCalculateVolume:r>=10.7&&o,supportsComputePixelLocation:r>=10.7&&t.includes("catalog"),supportsComputeAngles:r>=10.91,supportsAdd:l,supportsDelete:l,supportsEditing:l,supportsUpdate:l,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1,supportsQueryAnalytics:!1,supportsQueryTopFeatures:!1},query:{maxRecordCount:s,maxRecordCountFactor:void 0,supportsStatistics:!!i?.supportsStatistics,supportsOrderBy:!!i?.supportsOrderBy,supportsDistinct:!!i?.supportsDistinct,supportsPagination:!!i?.supportsPagination,supportsStandardizedQueriesOnly:!!i?.useStandardizedQueries,supportsPercentileStatistics:!!i?.supportsPercentileStatistics,supportsCentroid:!!i?.supportsReturningGeometryCentroid,supportsDistance:!!i?.supportsQueryWithDistance,supportsExtent:!!i?.supportsReturningQueryExtent,supportsGeometryProperties:!!i?.supportsReturningGeometryProperties,supportsHavingClause:!!i?.supportsHavingClause,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:!1,supportsTopFeaturesQuery:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!i?.supportsDefaultSR,supportsFullTextSearch:!1,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0},mensuration:{supportsDistanceAndAngle:c,supportsAreaAndPerimeter:c,supportsPointOrCentroid:c,supportsHeightFromBaseAndTop:u&&p.includes("base-top height"),supportsHeightFromBaseAndTopShadow:u&&p.includes("base-top shadow height"),supportsHeightFromTopAndTopShadow:u&&p.includes("top-top shadow height"),supports3D:u&&p.includes("3d")}}}};function b(e){return e?.path??""}return e([f()],g.prototype,"_functionRasterInfos",void 0),e([f()],g.prototype,"_rasterJobHandler",void 0),e([f()],g.prototype,"_cachedRendererJson",void 0),e([f({readOnly:!0})],g.prototype,"_serviceSupportsMosaicRule",void 0),e([v("_serviceSupportsMosaicRule",["currentVersion","fields"])],g.prototype,"readServiceSupportsMosaicRule",null),e([f()],g.prototype,"_rasterAttributeTableFieldPrefix",void 0),e([f({readOnly:!0})],g.prototype,"_rasterFunctionNamesIndex",null),e([f()],g.prototype,"adjustAspectRatio",void 0),e([f({type:[y],json:{write:!0}})],g.prototype,"bandIds",void 0),e([v("bandIds")],g.prototype,"readBandIds",null),e([f({readOnly:!0,json:{read:!1}})],g.prototype,"capabilities",void 0),e([v("service","capabilities",["capabilities","currentVersion","serviceDataType"])],g.prototype,"readCapabilities",null),e([f({type:Number})],g.prototype,"compressionQuality",void 0),e([I("compressionQuality")],g.prototype,"writeCompressionQuality",null),e([f({type:Number})],g.prototype,"compressionTolerance",void 0),e([I("compressionTolerance")],g.prototype,"writeCompressionTolerance",null),e([f({json:{read:{source:"copyrightText"}}})],g.prototype,"copyright",void 0),e([f({readOnly:!0,dependsOn:["_serviceSupportsMosaicRule"]})],g.prototype,"defaultMosaicRule",void 0),e([v("defaultMosaicRule",["defaultMosaicMethod"])],g.prototype,"readDefaultMosaicRule",null),e([f({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],g.prototype,"definitionExpression",void 0),e([f({readOnly:!0,constructOnly:!0})],g.prototype,"exportImageServiceParameters",void 0),e([f()],g.prototype,"rasterInfo",void 0),e([f({readOnly:!0,type:[D]})],g.prototype,"fields",void 0),e([f({readOnly:!0})],g.prototype,"fieldsIndex",null),e([f({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"],json:{write:!0}})],g.prototype,"format",null),e([v("service","format",["serviceDataType"])],g.prototype,"readFormat",null),e([f({type:ae})],g.prototype,"fullExtent",void 0),e([f({readOnly:!0})],g.prototype,"hasMultidimensions",void 0),e([f({json:{read:{source:"maxImageHeight"}}})],g.prototype,"imageMaxHeight",void 0),e([f({json:{read:{source:"maxImageWidth"}}})],g.prototype,"imageMaxWidth",void 0),e([f({type:String,json:{type:C.jsonValues,read:C.read,write:C.write}})],g.prototype,"interpolation",void 0),e([f()],g.prototype,"minScale",void 0),e([v("service","minScale")],g.prototype,"readMinScale",null),e([f()],g.prototype,"maxScale",void 0),e([v("service","maxScale")],g.prototype,"readMaxScale",null),e([f({type:P})],g.prototype,"mosaicRule",null),e([v("mosaicRule",["mosaicRule","defaultMosaicMethod"])],g.prototype,"readMosaicRule",null),e([I("mosaicRule")],g.prototype,"writeMosaicRule",null),e([f()],g.prototype,"multidimensionalInfo",void 0),e([f({type:N,json:{write:!0}})],g.prototype,"multidimensionalSubset",void 0),e([f({json:{type:y}})],g.prototype,"noData",void 0),e([I("noData")],g.prototype,"writeNoData",null),e([f({type:String,json:{type:M.jsonValues,read:M.read,write:M.write}})],g.prototype,"noDataInterpretation",void 0),e([f({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],g.prototype,"objectIdField",void 0),e([v("objectIdField")],g.prototype,"readObjectIdField",null),e([f({})],g.prototype,"geometryType",void 0),e([f({})],g.prototype,"typeIdField",void 0),e([f({})],g.prototype,"types",void 0),e([f({readOnly:!0})],g.prototype,"parsedUrl",null),e([f({type:Function})],g.prototype,"pixelFilter",void 0),e([f()],g.prototype,"raster",void 0),e([f({readOnly:!0})],g.prototype,"sourceType",void 0),e([v("sourceType",["serviceSourceType","fields"])],g.prototype,"readSourceType",null),e([f()],g.prototype,"viewId",void 0),e([f({types:r,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:i,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],g.prototype,"renderer",null),e([v("renderer")],g.prototype,"readRenderer",null),e([I("renderer")],g.prototype,"writeRenderer",null),e([f()],g.prototype,"symbolizer",void 0),e([f(x)],g.prototype,"opacity",void 0),e([f({readOnly:!0})],g.prototype,"rasterFields",null),e([f({constructOnly:!0})],g.prototype,"rasterFunctionInfos",void 0),e([f({type:A})],g.prototype,"renderingRule",null),e([v("renderingRule",["renderingRule","rasterFunctionInfos"])],g.prototype,"readRenderingRule",null),e([I("renderingRule")],g.prototype,"writeRenderingRule",null),e([f()],g.prototype,"serviceDataType",void 0),e([f({readOnly:!0,type:Fe})],g.prototype,"spatialReference",void 0),e([v("spatialReference",["spatialReference","extent"])],g.prototype,"readSpatialReference",null),e([f({json:{type:De.jsonValues}})],g.prototype,"pixelType",void 0),e([v("pixelType")],g.prototype,"readPixelType",null),e([I("pixelType")],g.prototype,"writePixelType",null),e([f({constructOnly:!0,type:J})],g.prototype,"serviceRasterInfo",void 0),e([f()],g.prototype,"sourceJSON",void 0),e([f(w)],g.prototype,"url",void 0),e([f({readOnly:!0})],g.prototype,"version",void 0),e([v("version",["currentVersion","fields","timeInfo"])],g.prototype,"readVersion",null),g=e([S("esri.layers.mixins.ArcGISImageService")],g),g};export{Ne as ArcGISImageService};
|
package/package.json
CHANGED
package/rest/imageService.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.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../geometry.js";import t from"../request.js";import{isSome as e}from"../core/maybe.js";import{normalizeCentralMeridian as o}from"../geometry/support/normalizeUtils.js";import{parseUrl as n,encode as r,asValidOptions as a}from"./utils.js";import s from"./support/ImageAngleResult.js";import i from"./support/
|
|
5
|
+
import"../geometry.js";import t from"../request.js";import{isSome as e}from"../core/maybe.js";import{normalizeCentralMeridian as o}from"../geometry/support/normalizeUtils.js";import{parseUrl as n,encode as r,asValidOptions as a}from"./utils.js";import s from"./support/ImageAngleResult.js";import i from"./support/ImageAreaResult.js";import m from"./support/ImageDistanceResult.js";import c from"./support/ImageHeightResult.js";import u from"./support/ImageIdentifyResult.js";import l from"./support/ImagePixelLocationResult.js";import p from"./support/ImagePointResult.js";import f from"./support/ImageSampleResult.js";import g from"../geometry/SpatialReference.js";function y(t){const e=t?.time;if(e&&(null!=e.start||null!=e.end)){const o=[];null!=e.start&&o.push(e.start),null==e.end||o.includes(e.end)||o.push(e.end),t.time=o.join(",")}}async function N(t,s,i){const m=n(t),c=s.geometry?[s.geometry]:[],u=await o(c),l=s.toJSON();y(l);const p=u&&u[0];e(p)&&(l.geometry=p.toJSON());const f=r({...m.query,f:"json",...l});return a(f,i)}async function S(o,i,m){const c=i.toJSON();e(c.angleName)&&(c.angleName=c.angleName.join(",")),e(i.point)&&i.point.spatialReference?.imageCoordinateSystem&&(c.point.spatialReference=C(i.point.spatialReference)),e(i.spatialReference)&&i.spatialReference.imageCoordinateSystem&&(c.spatialReference=G(i.spatialReference));const u=n(o),l=r({...u.query,f:"json",...c}),p=a(l,m),{data:f}=await t(`${u.path}/computeAngles`,p);return f.spatialReference=f.spatialReference?null!=f.spatialReference.geodataXform?new g({wkid:0,imageCoordinateSystem:f.spatialReference}):g.fromJSON(f.spatialReference):null,"NaN"===f.north&&(f.north=null),"NaN"===f.up&&(f.up=null),new s(f)}async function d(e,o,s){const i=o.toJSON(),{geometries:m}=o;if(m)for(let t=0;t<m.length;t++)m[t].spatialReference?.imageCoordinateSystem&&(i.geometries.geometries[t].spatialReference=C(m[t].spatialReference));const c=n(e),u=r({...c.query,f:"json",...i}),p=a(u,s),{data:f}=await t(`${c.path}/computePixelLocation`,p);return l.fromJSON(f)}async function J(e,o,r){const a=await N(e,o,r),s=n(e),{data:i}=await t(`${s.path}/computeStatisticsHistograms`,a),{statistics:m}=i;return m?.length&&m.forEach((t=>{t.avg=t.mean,t.stddev=t.standardDeviation})),{statistics:m,histograms:i.histograms}}async function O(e,o,r){const a=await N(e,o,r),s=n(e),{data:i}=await t(`${s.path}/computeHistograms`,a);return{histograms:i.histograms}}async function R(s,i,m){const c=i.toJSON();y(c),c.outFields?.length&&(c.outFields=c.outFields.join(","));const u=(await o(i.geometry))?.[0];e(u)&&(c.geometry=u.toJSON());const l=n(s),p=r({...l.query,f:"json",...c}),g=a(p,m),{data:N}=await t(`${l.path}/getSamples`,g),S=N?.samples?.map((t=>{const e="NaN"===t.value||""===t.value?null:t.value.split(" ").map((t=>Number(t)));return{...t,pixelValue:e}}));return f.fromJSON({samples:S})}async function j(s,i,m){const c=n(s),l=i.geometry?[i.geometry]:[];return o(l).then((o=>{const n=i.toJSON(),s=o&&o[0];e(s)&&(n.geometry=JSON.stringify(s.toJSON()));const u=r({...c.query,f:"json",...n}),l=a(u,m);return t(c.path+"/identify",l)})).then((t=>u.fromJSON(t.data)))}async function h(t,e,o){const n=await v(t,e,[e.fromGeometry,e.toGeometry],o);return c.fromJSON(n)}async function w(t,e,o){const n=await v(t,e,[e.geometry],o);return i.fromJSON(n)}async function I(t,e,o){const n=await v(t,e,[e.geometry],o);return p.fromJSON(n)}async function q(t,e,o){const n=await v(t,e,[e.fromGeometry,e.toGeometry],o);return m.fromJSON(n)}async function v(s,i,m,c){const u=n(s),l=await o(m),p=i.toJSON();e(l[0])&&(p.fromGeometry=JSON.stringify(l[0].toJSON())),e(l[1])&&(p.toGeometry=JSON.stringify(l[1].toJSON()));const f=r({...u.query,f:"json",...p}),g=a(f,c),{data:y}=await t(u.path+"/measure",g);return y}function C(t){const{imageCoordinateSystem:e}=t;if(e){const{id:t,referenceServiceName:o}=e;return null!=t?o?{icsid:t,icsns:o}:{icsid:t}:{ics:e}}return t.toJSON()}function G(t,e){const o=C(t),{icsid:n,icsns:r,wkid:a}=o;return null!=n?null==r||e?.toLowerCase().includes("/"+r.toLowerCase()+"/")?`0:${n}`:JSON.stringify(o):a?a.toString():JSON.stringify(o)}export{S as computeAngles,O as computeHistograms,d as computePixelSpaceLocations,J as computeStatisticsHistograms,C as getImageSpatialReferenceJSON,G as getImageSpatialReferenceQueryParameter,R as getSamples,j as identify,w as measureAreaAndPerimeter,q as measureDistanceAndAngle,h as measureHeight,I as measurePointOrCentroid};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import{geometryTypes as r}from"../../geometry.js";import{clone as t}from"../../core/lang.js";import{lengthUnitsJSONMap as o,areaUnitsJSONMap as s}from"../../core/unitUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{writer as p}from"../../core/accessorSupport/decorators/writer.js";import{getJsonType as m}from"../../geometry/support/jsonUtils.js";import{measureOperationJSONMap as n,BaseImageMeasureParameters as
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import{geometryTypes as r}from"../../geometry.js";import{clone as t}from"../../core/lang.js";import{lengthUnitsJSONMap as o,areaUnitsJSONMap as s}from"../../core/unitUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{writer as p}from"../../core/accessorSupport/decorators/writer.js";import{getJsonType as m}from"../../geometry/support/jsonUtils.js";import{measureOperationJSONMap as n,BaseImageMeasureParameters as l}from"./BaseImageMeasureParameters.js";var u;let c=u=class extends l{constructor(){super(...arguments),this.type="area-perimeter",this.geometry=null,this.is3D=!1,this.linearUnit="meters",this.areaUnit="square-meters"}writeGeometry(e,r,t){null!=e&&(r.geometryType=m(e),r[t]=e.toJSON())}get measureOperation(){return this.is3D?"area-and-perimeter-3D":"area-and-perimeter"}clone(){return new u(t({geometry:this.geometry,is3D:this.is3D,linearUnit:this.linearUnit,areaUnit:this.areaUnit,mosaicRule:this.mosaicRule,renderingRule:this.renderingRule,pixelSize:this.pixelSize,raster:this.raster}))}};e([i({types:r,json:{name:"fromGeometry",read:!0,write:!0}})],c.prototype,"geometry",void 0),e([p("geometry")],c.prototype,"writeGeometry",null),e([i({type:n.apiValues,json:{write:n.write}})],c.prototype,"measureOperation",null),e([i({json:{read:!0}})],c.prototype,"is3D",void 0),e([i({type:String,json:{read:o.read,write:o.write}})],c.prototype,"linearUnit",void 0),e([i({type:String,json:{read:s.read,write:s.write}})],c.prototype,"areaUnit",void 0),c=u=e([a("esri.rest.support.ImageAreaParameters")],c);const y=c;export{y 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.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as r}from"../../chunks/tslib.es6.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{BaseImageMeasureResult as o,ImageMeasureResultAreaValue as t,ImageMeasureResultLengthValue as p}from"./BaseImageMeasureResult.js";let a=class extends o{constructor(){super(...arguments),this.area=null,this.perimeter=null}};r([e({type:t,json:{read:!0,write:!0}})],a.prototype,"area",void 0),r([e({type:p,json:{read:!0,write:!0}})],a.prototype,"perimeter",void 0),a=r([s("esri.rest.support.
|
|
5
|
+
import{_ as r}from"../../chunks/tslib.es6.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{BaseImageMeasureResult as o,ImageMeasureResultAreaValue as t,ImageMeasureResultLengthValue as p}from"./BaseImageMeasureResult.js";let a=class extends o{constructor(){super(...arguments),this.area=null,this.perimeter=null}};r([e({type:t,json:{read:!0,write:!0}})],a.prototype,"area",void 0),r([e({type:p,json:{read:!0,write:!0}})],a.prototype,"perimeter",void 0),a=r([s("esri.rest.support.ImageAreaResult")],a);const c=a;export{c as default};
|
package/rest/support/{ImageMeasureDistanceAndAngleParameters.js → ImageDistanceParameters.js}
RENAMED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import{clone as r}from"../../core/lang.js";import{lengthUnitsJSONMap as t,angleUnitsJSONMap as o}from"../../core/unitUtils.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{writer as a}from"../../core/accessorSupport/decorators/writer.js";import{getJsonType as n}from"../../geometry/support/jsonUtils.js";import{measureOperationJSONMap as p,BaseImageMeasureParameters as m}from"./BaseImageMeasureParameters.js";import l from"../../geometry/Point.js";var u;let y=u=class extends m{constructor(){super(...arguments),this.type="distance-angle",this.fromGeometry=null,this.toGeometry=null,this.is3D=!1,this.linearUnit="meters",this.angularUnit="degrees"}writeFromGeometry(e,r,t){null!=e&&(r.geometryType=n(e),r[t]=e.toJSON())}get measureOperation(){return this.is3D?"distance-and-angle-3D":"distance-and-angle"}clone(){return new u(r({fromGeometry:this.fromGeometry,toGeometry:this.toGeometry,is3D:this.is3D,linearUnit:this.linearUnit,angularUnit:this.angularUnit,mosaicRule:this.mosaicRule,renderingRule:this.renderingRule,pixelSize:this.pixelSize,raster:this.raster}))}};e([s({type:l,json:{read:!0,write:!0}})],y.prototype,"fromGeometry",void 0),e([a("fromGeometry")],y.prototype,"writeFromGeometry",null),e([s({type:l,json:{read:!0,write:!0}})],y.prototype,"toGeometry",void 0),e([s({type:p.apiValues,json:{write:p.write}})],y.prototype,"measureOperation",null),e([s({json:{read:!0}})],y.prototype,"is3D",void 0),e([s({type:String,json:{read:t.read,write:t.write}})],y.prototype,"linearUnit",void 0),e([s({type:String,json:{read:o.read,write:o.write}})],y.prototype,"angularUnit",void 0),y=u=e([i("esri.rest.support.
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import{clone as r}from"../../core/lang.js";import{lengthUnitsJSONMap as t,angleUnitsJSONMap as o}from"../../core/unitUtils.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{writer as a}from"../../core/accessorSupport/decorators/writer.js";import{getJsonType as n}from"../../geometry/support/jsonUtils.js";import{measureOperationJSONMap as p,BaseImageMeasureParameters as m}from"./BaseImageMeasureParameters.js";import l from"../../geometry/Point.js";var u;let y=u=class extends m{constructor(){super(...arguments),this.type="distance-angle",this.fromGeometry=null,this.toGeometry=null,this.is3D=!1,this.linearUnit="meters",this.angularUnit="degrees"}writeFromGeometry(e,r,t){null!=e&&(r.geometryType=n(e),r[t]=e.toJSON())}get measureOperation(){return this.is3D?"distance-and-angle-3D":"distance-and-angle"}clone(){return new u(r({fromGeometry:this.fromGeometry,toGeometry:this.toGeometry,is3D:this.is3D,linearUnit:this.linearUnit,angularUnit:this.angularUnit,mosaicRule:this.mosaicRule,renderingRule:this.renderingRule,pixelSize:this.pixelSize,raster:this.raster}))}};e([s({type:l,json:{read:!0,write:!0}})],y.prototype,"fromGeometry",void 0),e([a("fromGeometry")],y.prototype,"writeFromGeometry",null),e([s({type:l,json:{read:!0,write:!0}})],y.prototype,"toGeometry",void 0),e([s({type:p.apiValues,json:{write:p.write}})],y.prototype,"measureOperation",null),e([s({json:{read:!0}})],y.prototype,"is3D",void 0),e([s({type:String,json:{read:t.read,write:t.write}})],y.prototype,"linearUnit",void 0),e([s({type:String,json:{read:o.read,write:o.write}})],y.prototype,"angularUnit",void 0),y=u=e([i("esri.rest.support.ImageDistanceParameters")],y);const c=y;export{c as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import{BaseImageMeasureResult as s,ImageMeasureResultLengthValue as o,ImageMeasureResultAngleValue as p}from"./BaseImageMeasureResult.js";let a=class extends s{constructor(){super(...arguments),this.distance=null,this.azimuthAngle=null,this.elevationAngle=null}};e([t({type:o,json:{read:!0,write:!0}})],a.prototype,"distance",void 0),e([t({type:p,json:{read:!0,write:!0}})],a.prototype,"azimuthAngle",void 0),e([t({type:p,json:{read:!0,write:!0}})],a.prototype,"elevationAngle",void 0),a=e([r("esri.rest.support.ImageDistanceResult")],a);const i=a;export{i 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.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import{clone as r}from"../../core/lang.js";import{lengthUnitsJSONMap as t}from"../../core/unitUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{writer as i}from"../../core/accessorSupport/decorators/writer.js";import{getJsonType as p}from"../../geometry/support/jsonUtils.js";import{measureOperationJSONMap as m,BaseImageMeasureParameters as a}from"./BaseImageMeasureParameters.js";import n from"../../geometry/Point.js";var y;let l=y=class extends a{constructor(){super(...arguments),this.type="height",this.fromGeometry=null,this.toGeometry=null,this.operationType="base-and-top",this.linearUnit="meters"}writeFromGeometry(e,r,t){null!=e&&(r.geometryType=p(e),r[t]=e.toJSON())}get measureOperation(){return this.operationType}clone(){return new y(r({fromGeometry:this.fromGeometry,toGeometry:this.toGeometry,operationType:this.operationType,linearUnit:this.linearUnit,mosaicRule:this.mosaicRule,renderingRule:this.renderingRule,pixelSize:this.pixelSize,raster:this.raster}))}};e([o({type:n,json:{read:!0}})],l.prototype,"fromGeometry",void 0),e([i("fromGeometry")],l.prototype,"writeFromGeometry",null),e([o({type:n,json:{read:!0,write:!0}})],l.prototype,"toGeometry",void 0),e([o({type:m.apiValues,json:{write:m.write}})],l.prototype,"measureOperation",null),e([o({json:{read:!0}})],l.prototype,"operationType",void 0),e([o({type:String,json:{read:t.read,write:t.write}})],l.prototype,"linearUnit",void 0),l=y=e([s("esri.rest.support.
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import{clone as r}from"../../core/lang.js";import{lengthUnitsJSONMap as t}from"../../core/unitUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{writer as i}from"../../core/accessorSupport/decorators/writer.js";import{getJsonType as p}from"../../geometry/support/jsonUtils.js";import{measureOperationJSONMap as m,BaseImageMeasureParameters as a}from"./BaseImageMeasureParameters.js";import n from"../../geometry/Point.js";var y;let l=y=class extends a{constructor(){super(...arguments),this.type="height",this.fromGeometry=null,this.toGeometry=null,this.operationType="base-and-top",this.linearUnit="meters"}writeFromGeometry(e,r,t){null!=e&&(r.geometryType=p(e),r[t]=e.toJSON())}get measureOperation(){return this.operationType}clone(){return new y(r({fromGeometry:this.fromGeometry,toGeometry:this.toGeometry,operationType:this.operationType,linearUnit:this.linearUnit,mosaicRule:this.mosaicRule,renderingRule:this.renderingRule,pixelSize:this.pixelSize,raster:this.raster}))}};e([o({type:n,json:{read:!0}})],l.prototype,"fromGeometry",void 0),e([i("fromGeometry")],l.prototype,"writeFromGeometry",null),e([o({type:n,json:{read:!0,write:!0}})],l.prototype,"toGeometry",void 0),e([o({type:m.apiValues,json:{write:m.write}})],l.prototype,"measureOperation",null),e([o({json:{read:!0}})],l.prototype,"operationType",void 0),e([o({type:String,json:{read:t.read,write:t.write}})],l.prototype,"linearUnit",void 0),l=y=e([s("esri.rest.support.ImageHeightParameters")],l);const u=l;export{u 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.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as r}from"../../chunks/tslib.es6.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";import{BaseImageMeasureResult as o,ImageMeasureResultLengthValue as t}from"./BaseImageMeasureResult.js";let p=class extends o{constructor(){super(...arguments),this.height=null}};r([s({type:t,json:{read:!0,write:!0}})],p.prototype,"height",void 0),p=r([e("esri.rest.support.
|
|
5
|
+
import{_ as r}from"../../chunks/tslib.es6.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";import{BaseImageMeasureResult as o,ImageMeasureResultLengthValue as t}from"./BaseImageMeasureResult.js";let p=class extends o{constructor(){super(...arguments),this.height=null}};r([s({type:t,json:{read:!0,write:!0}})],p.prototype,"height",void 0),p=r([e("esri.rest.support.ImageHeightResult")],p);const c=p;export{c 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.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import{geometryTypes as r}from"../../geometry.js";import{clone as t}from"../../core/lang.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{writer as i}from"../../core/accessorSupport/decorators/writer.js";import{getJsonType as p,fromJSON as m}from"../../geometry/support/jsonUtils.js";import{measureOperationJSONMap as a,BaseImageMeasureParameters as n}from"./BaseImageMeasureParameters.js";var c;let u=c=class extends n{constructor(){super(...arguments),this.type="point",this.geometry=null,this.is3D=!1}writeGeometry(e,r,t){null!=e&&(r.geometryType=p(e),r[t]=e.toJSON())}get measureOperation(){const{is3D:e,geometry:r}=this;return"point"===r.type?e?"point-3D":"point":e?"centroid-3D":"centroid"}clone(){return new c(t({geometry:this.geometry,is3D:this.is3D,mosaicRule:this.mosaicRule,renderingRule:this.renderingRule,pixelSize:this.pixelSize,raster:this.raster}))}};e([o({types:r,json:{name:"fromGeometry",read:m}})],u.prototype,"geometry",void 0),e([i("geometry")],u.prototype,"writeGeometry",null),e([o({type:a.apiValues,json:{read:a.read,write:a.write}})],u.prototype,"measureOperation",null),e([o({json:{read:!0}})],u.prototype,"is3D",void 0),u=c=e([s("esri.rest.support.
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import{geometryTypes as r}from"../../geometry.js";import{clone as t}from"../../core/lang.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{writer as i}from"../../core/accessorSupport/decorators/writer.js";import{getJsonType as p,fromJSON as m}from"../../geometry/support/jsonUtils.js";import{measureOperationJSONMap as a,BaseImageMeasureParameters as n}from"./BaseImageMeasureParameters.js";var c;let u=c=class extends n{constructor(){super(...arguments),this.type="point",this.geometry=null,this.is3D=!1}writeGeometry(e,r,t){null!=e&&(r.geometryType=p(e),r[t]=e.toJSON())}get measureOperation(){const{is3D:e,geometry:r}=this;return"point"===r.type?e?"point-3D":"point":e?"centroid-3D":"centroid"}clone(){return new c(t({geometry:this.geometry,is3D:this.is3D,mosaicRule:this.mosaicRule,renderingRule:this.renderingRule,pixelSize:this.pixelSize,raster:this.raster}))}};e([o({types:r,json:{name:"fromGeometry",read:m}})],u.prototype,"geometry",void 0),e([i("geometry")],u.prototype,"writeGeometry",null),e([o({type:a.apiValues,json:{read:a.read,write:a.write}})],u.prototype,"measureOperation",null),e([o({json:{read:!0}})],u.prototype,"is3D",void 0),u=c=e([s("esri.rest.support.ImagePointParameters")],u);const l=u;export{l 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.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as r}from"../../chunks/tslib.es6.js";import"../../geometry.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{BaseImageMeasureResult as e}from"./BaseImageMeasureResult.js";import t from"../../geometry/Point.js";let p=class extends e{constructor(){super(...arguments),this.point=null}};r([o({type:t,json:{name:"point.value",read:!0,write:!0}})],p.prototype,"point",void 0),p=r([s("esri.rest.support.
|
|
5
|
+
import{_ as r}from"../../chunks/tslib.es6.js";import"../../geometry.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{BaseImageMeasureResult as e}from"./BaseImageMeasureResult.js";import t from"../../geometry/Point.js";let p=class extends e{constructor(){super(...arguments),this.point=null}};r([o({type:t,json:{name:"point.value",read:!0,write:!0}})],p.prototype,"point",void 0),p=r([s("esri.rest.support.ImagePointResult")],p);const a=p;export{a 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.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const a="
|
|
5
|
+
const a="20230113",c="8559a9366e4f2245dac1f05db0ab22559c700ae6";export{a as buildDate,c as commitHash};
|