@arcgis/core 4.26.0-next.20221220 → 4.26.0-next.20221221
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/{39ba00c44253a590a717.js → 51b298a6f0550feb44e7.js} +1 -1
- package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
- package/assets/esri/widgets/Slice/t9n/Slice.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_en.json +1 -1
- package/chunks/vxlLayer.js +1 -1
- package/layers/VoxelLayer.js +1 -1
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/layers/voxel/VoxelIsosurface.js +1 -1
- package/libs/vxl/enums.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/3d/layers/VoxelLayerView3D.js +1 -1
- package/views/3d/layers/i3s/Intersector.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/webgl-engine/lib/IntersectorInterfaces.js +1 -1
- package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
- package/widgets/Slice.js +1 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../request.js";import has from"../core/has.js";import t from"../core/Logger.js";import{isSome as r,removeMaybe as s}from"../core/maybe.js";import{isAbortError as i}from"../core/promiseUtils.js";import{watch as a}from"../core/reactiveUtils.js";import{renderSRFromViewSR as n}from"../geometry/support/coordinateSystem.js";import{PointIndex as o,PlaneIndex as l}from"../geometry/support/frustum.js";import{WasmCullMode as h,VoxelRequestType as _,UpdateFlags as d,ContainerType as u}from"../libs/vxl/enums.js";import{loadVoxelWASM as c}from"../libs/vxl/VxlModule.js";import{ViewingMode as m}from"../views/ViewingMode.js";import{Frustum as g}from"../views/3d/state/Frustum.js";import{RenderCoordsHelper as x}from"../views/3d/support/RenderCoordsHelper.js";import{ShaderOutput as f}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js";import{RenderSlot as p}from"../views/3d/webgl-engine/lib/RenderSlot.js";import{RenderStateFeature as y}from"../views/3d/webgl-engine/lib/RenderStateFeature.js";import{ContextType as v}from"../views/webgl/context-util.js";import{CompareFunction as b,Face as T,StencilOperation as w}from"../views/webgl/enums.js";const R=t.getLogger("esri.layers.VoxelWasmPerSceneView");var E;!function(e){e[e.Lifetime=1]="Lifetime",e[e.RequestResponse=2]="RequestResponse",e[e.Rendering=3]="Rendering",e[e.Error=4]="Error"}(E||(E={}));class C{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=f.Color,this._renderSlot=p.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._view=e,this._initialize()}get canRender(){return!!this._vxl&&"local"===this._view.viewingMode}_dbg(e,t){this._dbgFlags.has(e)&&(e===E.Error?R.error(t):R.warn(t))}_removeRenderPlugin(){this._pluginIsActive&&this._view._stage&&(this._dbg(E.Lifetime,"--removeRenderPlugin--"),this._view._stage.removeRenderPlugin(this)),this._pluginIsActive=!1}_initialize(){this._dbg(E.Lifetime,"--initialize--");for(const e of this._wasmMemBlockSizes)this._wasmMemBlocks.set(e,0);this._readyWatchHandle=a((()=>this._view.ready),(e=>{e&&"local"===this._view.viewingMode?(this._dbg(E.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(E.Lifetime,"view ready status changed, not ready or not a local view!"),this._removeRenderPlugin())}),{initial:!0}),this._qualityWatchHandle=a((()=>this._view?.qualityProfile),(e=>{this._dbg(E.Rendering,"qualityProfile changed to "+e),this._vxl&&this._vxl.set_quality(this._toWasmQuality(e))}),{initial:!0}),this._timeExtentWatchHandle=a((()=>this._view?.timeExtent),(()=>{if(this._vxl){const e=this._getTimeArgs(this._view?.timeExtent);this._dbg(E.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=a((()=>this._view?.stationary),(e=>{this._vxl&&e&&!this._lastFrameWasStationary&&this._renderPluginContext.requestRender()}))}initializeRenderContext(e){this._dbg(E.Lifetime,"--initializeRenderContext--");const t=e.renderContext.rctx;t.type===v.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(E.Error,"WebGL 1 context only!")}uninitializeRenderContext(){this._renderPluginContext=null,this._rctx=null,this._dbg(E.Lifetime,"--uninitializeRenderContext--")}_restoreFramebuffer(){if(!this._renderTargetToRestore)return;const e=this._renderTargetToRestore.fbo;if(!!!this._rctx)return void this._dbg(E.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,s=!!this._renderTargetToRestore;if(!r||!s)return 0;const i=this._renderTargetToRestore.fbo.depthStencilTexture;return i?(0===t?this._rctx.bindTexture(null,e,!0):this._rctx.bindTexture(i,e,!0),1):(this._dbg(E.Error,"no depth/stencil texture exists!"),0)}_modifyResourceCount(e,t,r){if(!this._rctx)return void this._dbg(E.Error,"modifyAllocation callback has no rendering context!");const s=e;1===r?this._rctx.instanceCounter.increment(s,t):this._rctx.instanceCounter.decrement(s,t)}_setBlendState(e,t,r,s){this._rctx?(this._rctx.setBlendingEnabled(1===e),this._rctx.setBlendFunction(t,r),this._rctx.setBlendEquation(s)):this._dbg(E.Error,"setBlendState callback has no rendering context!")}_setFrontFace(e){this._rctx?this._rctx.setFrontFace(e):this._dbg(E.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(b.ALWAYS,0,255),this._rctx.setStencilOpSeparate(T.FRONT,w.KEEP,w.INCR,w.KEEP),this._rctx.setStencilOpSeparate(T.BACK,w.KEEP,w.DECR,w.KEEP)):this._dbg(E.Error,"setDepthStencilStateFunction callback has no rendering context!")}_setRasterizerState(e){if(this._rctx)switch(e){case h.None:this._rctx.setFaceCullingEnabled(!1);break;case h.Back:this._rctx.setCullFace(T.BACK),this._rctx.setFaceCullingEnabled(!0);break;case h.Front:this._rctx.setCullFace(T.FRONT),this._rctx.setFaceCullingEnabled(!0)}else this._dbg(E.Error,"setRasterizerState callback has no rendering context!")}_setViewport(e,t,r,s){this._rctx?this._rctx.setViewport(e,t,r,s):this._dbg(E.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(((t,r)=>{const s=[];t.responses.forEach(((e,i)=>{s.push(i),this._dbg(E.RequestResponse,"responding for requestID:"+i+" size:"+e.size),this._vxl.respond(r,i,e),e.requestType!==_.TreeIndex&&e.requestType!==_.Section||(t.needMemoryUsageUpdate=!0)}));const a=t.responses;for(const e of s)a.delete(e);const n=this._vxl.get_new_requests(r),o=t.abortController.signal;for(const l in n){t.outstandingRequestCount+=1,1===t.outstandingRequestCount&&t.layerView.updatingFlagChanged();const r=n[l],s={responseType:"array-buffer",signal:o};this._dbg(E.RequestResponse,"making requestID:"+l+" url:"+r.url),e(r.url,s).then((e=>{t.outstandingRequestCount-=1,0===t.outstandingRequestCount&&t.layerView.updatingFlagChanged(),this._dbg(E.RequestResponse,"have response for requestID:"+l);let s=0;if(e.data.byteLength>0){s=this._vxl._malloc(e.data.byteLength);const t=new Uint8Array(this._vxl.HEAPU8.buffer,s,e.data.byteLength),r=new Uint8Array(e.data);for(let s=0;s<e.data.byteLength;++s)t[s]=r[s]}a.set(+l,{responseType:r.responseType,ptr:s,size:e.data.byteLength,success:!0,requestType:r.requestType})})).catch((e=>{t.outstandingRequestCount-=1,0===t.outstandingRequestCount&&t.layerView.updatingFlagChanged(),i(e)||(this._dbg(E.Error,`requestID:${l} failed, error=${e.toString()}`),a.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,s)=>{if(r.layerView.wasmLayerId===e.wasmLayerId){const r=this._vxl.get_layer_epoch_times(s,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,s)=>{r.layerView.wasmLayerId===e.wasmLayerId&&(t=this._vxl.get_layer_current_time_id(s))})),t}setEnabled(e,t){this._layers.forEach(((r,s)=>{r.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl.set_enabled(s,t),r.needMemoryUsageUpdate=!0,this._renderPluginContext.requestRender())}))}setStaticSections(e,t){const r={mask:d.StaticSections,staticSections:t};return this._doMaskedUIUpdate(e,r,!0)}setCurrentVariable(e,t){const r={mask:d.CurrentVariable,currentVariable:t};return this._doMaskedUIUpdate(e,r,!0)}setRenderMode(e,t){const r={mask:d.RenderMode,renderMode:t};return this._doMaskedUIUpdate(e,r,!0)}setVerticalExaggerationAndOffset(e,t,r,s){const i={mask:d.ExaggerationAndOffset,volStyleDesc:{volumeId:t,verticalExaggeration:r,verticalOffset:s}};return this._doMaskedUIUpdate(e,i,!0)}setVariableStyles(e,t){const r={mask:d.VariableStyles,variableStyles:t};return this._doMaskedUIUpdate(e,r,!0)}setVolumeStyles(e,t){const r={mask:d.VolumeStyles,volumeStyles:t};return this._doMaskedUIUpdate(e,r,!0)}setEnableDynamicSections(e,t){const r={mask:d.ContainerVisibility,containerIsVisible:t,container:u.DynamicSections};return this._doMaskedUIUpdate(e,r,!0)}setEnableIsosurfaces(e,t){const r={mask:d.ContainerVisibility,containerIsVisible:t,container:u.Isosurfaces};return this._doMaskedUIUpdate(e,r,!0)}setEnableSections(e,t){const r={mask:d.ContainerVisibility,containerIsVisible:t,container:u.StaticSections};return this._doMaskedUIUpdate(e,r,!0)}_doMaskedUIUpdate(e,t,r){if(!this._vxl)return!1;let s=!1;return this._layers.forEach(((r,i)=>{if(r.layerView.wasmLayerId===e.wasmLayerId){const e={str:JSON.stringify(t),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(s=1===this._vxl.handle_masked_ui_update(i,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}})),s&&r&&this._renderPluginContext.requestRender(),s}_addTriangleToWasmBuffer(e,t,r,s,i){return e[3*t+0]=r[0],e[3*t+1]=r[1],e[3*t+2]=r[2],e[3*(t+=1)+0]=s[0],e[3*t+1]=s[1],e[3*t+2]=s[2],e[3*(t+=1)+0]=i[0],e[3*t+1]=i[1],e[3*t+2]=i[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),s=new Float32Array(this._vxl.HEAPF32.buffer,r,3*e),i=this._vxl._malloc(3*t*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(this._vxl.HEAPF32.buffer,i,e),n=this._frustum.points[o.NEAR_BOTTOM_LEFT],h=this._frustum.points[o.NEAR_BOTTOM_RIGHT],_=this._frustum.points[o.NEAR_TOP_RIGHT],d=this._frustum.points[o.NEAR_TOP_LEFT],u=this._frustum.points[o.FAR_BOTTOM_LEFT],c=this._frustum.points[o.FAR_BOTTOM_RIGHT],m=this._frustum.points[o.FAR_TOP_RIGHT],g=this._frustum.points[o.FAR_TOP_LEFT];let x=0,f=0;const p=this._frustum.planes[l.NEAR];x=this._addTriangleToWasmBuffer(s,x,_,h,n),f=this._addNormalToWasmBuffer(a,f,p),x=this._addTriangleToWasmBuffer(s,x,n,d,_),f=this._addNormalToWasmBuffer(a,f,p);const y=this._frustum.planes[l.FAR];x=this._addTriangleToWasmBuffer(s,x,u,c,m),f=this._addNormalToWasmBuffer(a,f,y),x=this._addTriangleToWasmBuffer(s,x,m,g,u),f=this._addNormalToWasmBuffer(a,f,y);const v=this._frustum.planes[l.TOP];x=this._addTriangleToWasmBuffer(s,x,m,_,d),f=this._addNormalToWasmBuffer(a,f,v),x=this._addTriangleToWasmBuffer(s,x,d,g,m),f=this._addNormalToWasmBuffer(a,f,v);const b=this._frustum.planes[l.BOTTOM];x=this._addTriangleToWasmBuffer(s,x,n,h,c),f=this._addNormalToWasmBuffer(a,f,b),x=this._addTriangleToWasmBuffer(s,x,c,u,n),f=this._addNormalToWasmBuffer(a,f,b);const T=this._frustum.planes[l.LEFT];x=this._addTriangleToWasmBuffer(s,x,d,n,u),f=this._addNormalToWasmBuffer(a,f,T),x=this._addTriangleToWasmBuffer(s,x,u,g,d),f=this._addNormalToWasmBuffer(a,f,T);const w=this._frustum.planes[l.RIGHT];x=this._addTriangleToWasmBuffer(s,x,_,m,c),f=this._addNormalToWasmBuffer(a,f,w),x=this._addTriangleToWasmBuffer(s,x,c,h,_),f=this._addNormalToWasmBuffer(a,f,w),-1!==this._frustumRenderableId&&this._vxl.remove_generic_mesh(this._frustumRenderableId),this._frustumRenderableId=this._vxl.add_generic_mesh(r,3*e,i,e,255,0,0,64),this._vxl._free(r),this._vxl._free(i),this._captureFrustum=!1,this._renderPluginContext.requestRender()}captureFrustum(){null===this._renderCoordsHelper&&(this._renderCoordsHelper=x.create(m.Local,n(!1,this._view.spatialReference))),null===this._frustum&&(this._frustum=new g(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(E.Lifetime," no voxel layers left after removing a layer, removing RenderPlugin and destroying"),this.destroy()),r}let t=-1;this._layers.forEach(((r,s)=>{r.layerView.wasmLayerId===e.wasmLayerId&&(t=s,r.abortController.abort(),this._vxl.remove_layer(t))})),t>=0&&this._layers.delete(t);const r=this._layers.size;return 0===r&&(this._dbg(E.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,s=Number.MAX_VALUE,i=!1;return r(e)&&(e.isAllTime?i=!0:(r(e.start)&&(i=!0,t=e.start.getTime()/1e3),r(e.end)&&(i=!0,s=e.end.getTime()/1e3))),{startTime:t,endTime:s,useTime:i}}_addVoxelLayer(e){const t=e.layer;let r=-1;const s=t.getConfiguration();if(s.length<1)return-1;const i={str:s,byteCount:0,ptr:0,isReusable:!1};if(!this._allocateBlock(i))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,i.ptr,i.byteCount,n,n,a.startTime,a.endTime,a.useTime,this._toWasmQuality(this._view.qualityProfile)),i.isReusable||this._vxl._free(i.ptr),r>=0){const t=new AbortController;if(this._layers.set(r,{layerView:e,responses:new Map,outstandingRequestCount:0,abortController:t,needMemoryUsageUpdate:!1}),!this._halfIntTexturesAvailable||has("mac")){const t=[];let r="";for(const s of e.layer.variables)"Int16"!==s.renderingFormat.type&&"UInt16"!==s.renderingFormat.type||(t.push(s.name),s.id===e.layer.currentVariableId&&(r=s.name));""!==r&&R.error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${r}' in this browser`),t.length>0&&R.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 s of e.layer.variables)"Float32"===s.renderingFormat.type&&(t.push(s.name),s.id===e.layer.currentVariableId&&(r=s.name));""!==r&&R.error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${r}' in this browser`),t.length>0&&R.warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}return has("esri-mobile")&&R.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 s=this._vxl.cull();this._dbg(E.RequestResponse,"missingResourceCount="+s),this._moreToLoad=s>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(E.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(y.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(E.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(E.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=c(e).then((e=>{if(this._vxl=e,this._vxlPromise=null,this._newLayers.length<=0)return this._dbg(E.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"),s=this._vxl.addFunction(this._setBlendState.bind(this),"viiii"),i=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"),_=this._halfIntTexturesAvailable&&!has("mac"),d=this._textureFloatLinearAvailable;this._vxl.initialize_voxel_wasm(r,s,i,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(E.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 s=r.viewport[3]-t;if(e<0||e>r.viewport[2]||t<0||t>r.viewport[3])return this._dbg(E.Error,`pickDepth: outOfRange, screenXY=[${e}, ${s}], vp=[${r.viewport.toString()}]`),null;this._renderTargetToRestore={fbo:this._rctx.getBoundFramebufferObject(),viewport:this._rctx.getViewport()};const i=r.viewForward,a=r.eye;this._vxl.update_camera_pos_and_direction(a[0],a[1],a[2],i[0],i[1],i[2]),this.updateWasmCamera(r),this._vxl.begin_frame();const n=this._vxl.pick_depth(e,s);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}_toWasmQuality(e){switch(e){case"low":return 0;case"medium":return 1;case"high":return 2}}}export{C 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 f}from"../libs/vxl/VxlModule.js";import{ViewingMode as p}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 F}from"../views/3d/webgl-engine/lib/RenderSlot.js";import{RenderStateFeature as C}from"../views/3d/webgl-engine/lib/RenderStateFeature.js";import{ContextType as L}from"../views/webgl/context-util.js";import{CompareFunction as V,Face as S,StencilOperation as P}from"../views/webgl/enums.js";const U=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?U.error(t):U.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===L.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,P.KEEP,P.INCR,P.KEEP),this._rctx.setStencilOpSeparate(S.BACK,P.KEEP,P.DECR,P.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,f=0;const p=this._frustum.planes[u.NEAR];x=this._addTriangleToWasmBuffer(i,x,l,o,n),f=this._addNormalToWasmBuffer(a,f,p),x=this._addTriangleToWasmBuffer(i,x,n,h,l),f=this._addNormalToWasmBuffer(a,f,p);const y=this._frustum.planes[u.FAR];x=this._addTriangleToWasmBuffer(i,x,d,c,m),f=this._addNormalToWasmBuffer(a,f,y),x=this._addTriangleToWasmBuffer(i,x,m,g,d),f=this._addNormalToWasmBuffer(a,f,y);const v=this._frustum.planes[u.TOP];x=this._addTriangleToWasmBuffer(i,x,m,l,h),f=this._addNormalToWasmBuffer(a,f,v),x=this._addTriangleToWasmBuffer(i,x,h,g,m),f=this._addNormalToWasmBuffer(a,f,v);const b=this._frustum.planes[u.BOTTOM];x=this._addTriangleToWasmBuffer(i,x,n,o,c),f=this._addNormalToWasmBuffer(a,f,b),x=this._addTriangleToWasmBuffer(i,x,c,d,n),f=this._addNormalToWasmBuffer(a,f,b);const w=this._frustum.planes[u.LEFT];x=this._addTriangleToWasmBuffer(i,x,h,n,d),f=this._addNormalToWasmBuffer(a,f,w),x=this._addTriangleToWasmBuffer(i,x,d,g,h),f=this._addNormalToWasmBuffer(a,f,w);const T=this._frustum.planes[u.RIGHT];x=this._addTriangleToWasmBuffer(i,x,l,m,c),f=this._addNormalToWasmBuffer(a,f,T),x=this._addTriangleToWasmBuffer(i,x,c,o,l),f=this._addNormalToWasmBuffer(a,f,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(p.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){const t=new AbortController;if(this._layers.set(r,{layerView:e,responses:new Map,outstandingRequestCount:0,abortController:t,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&&U.error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${r}' in this browser`),t.length>0&&U.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&&U.error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${r}' in this browser`),t.length>0&&U.warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}return has("esri-mobile")&&U.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(C.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=f(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;if(e<0||e>r.viewport[2]||t<0||t>r.viewport[3])return this._dbg(I.Error,`[js] pickObject: outOfRange, screenXY=[${e}, ${t}], vp=[${r.viewport.toString()}]`),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();let n=null;if(0===i.length)n=this._vxl.pick_object(e,t,0,0);else{const r={str:JSON.stringify({layerIds:i}),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(r)&&(n=this._vxl.pick_object(e,t,r.ptr,r.byteCount),r.isReusable||this._vxl._free(r.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(),n}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={};n.value=o.vxlValue,n.variable=o.vxlVariableName;const _=e=>{const r=new y(a,t,(()=>this._createVoxelGraphic(a,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,i){const s=this._view.computeMapPointFromVec3d(t);return new e({geometry:s,layer:r,sourceLayer:r,attributes:i})}_toWasmQuality(e){switch(e){case"low":return 0;case"medium":return 1;case"high":return 2}}}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 o}from"../../chunks/tslib.es6.js";import e from"../../Color.js";import{ClonableMixin as r}from"../../core/Clonable.js";import{JSONSupport as t}from"../../core/JSONSupport.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import{Integer as p}from"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";let l=class extends(r(t)){constructor(){super(...arguments),this.color=e.fromArray([0,0,0,0]),this.value=0,this.enabled=!0,this.label="",this.colorLocked=!
|
|
5
|
+
import{_ as o}from"../../chunks/tslib.es6.js";import e from"../../Color.js";import{ClonableMixin as r}from"../../core/Clonable.js";import{JSONSupport as t}from"../../core/JSONSupport.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import{Integer as p}from"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";let l=class extends(r(t)){constructor(){super(...arguments),this.color=e.fromArray([0,0,0,0]),this.value=0,this.enabled=!0,this.label="",this.colorLocked=!1}};o([s({type:e,json:{type:[p],write:{enabled:!0,isRequired:!0}}})],l.prototype,"color",void 0),o([s({type:Number,json:{write:{enabled:!0,isRequired:!0}}})],l.prototype,"value",void 0),o([s({type:Boolean,json:{default:!0,write:!0}})],l.prototype,"enabled",void 0),o([s({type:String,json:{write:!0}})],l.prototype,"label",void 0),o([s({type:Boolean,json:{default:!1}})],l.prototype,"colorLocked",void 0),l=o([i("esri.layers.voxel.VoxelIsosurface")],l);const a=l;export{a as default};
|
package/libs/vxl/enums.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
|
-
var e,t,
|
|
5
|
+
var e,i,t,n,a,o;!function(e){e[e.Binary=0]="Binary",e[e.JSON=1]="JSON"}(e||(e={})),function(e){e[e.TreeIndex=0]="TreeIndex",e[e.TreeStats=1]="TreeStats",e[e.TreeData=2]="TreeData",e[e.BrickBundles=3]="BrickBundles",e[e.Section=4]="Section",e[e.VariableStats=5]="VariableStats"}(i||(i={})),function(e){e[e.None=1]="None",e[e.Front=2]="Front",e[e.Back=3]="Back"}(t||(t={})),function(e){e[e.Low=0]="Low",e[e.Medium=1]="Medium",e[e.High=2]="High"}(n||(n={})),function(e){e[e.None=0]="None",e[e.StaticSections=1]="StaticSections",e[e.Slices=2]="Slices",e[e.DynamicSections=4]="DynamicSections",e[e.GhostShell=8]="GhostShell",e[e.Isosurface=16]="Isosurface",e[e.Quality=32]="Quality",e[e.SunLocation=64]="SunLocation",e[e.StaticSectionSelection=128]="StaticSectionSelection",e[e.ExaggerationAndOffset=256]="ExaggerationAndOffset",e[e.CurrentTime=512]="CurrentTime",e[e.CurrentVariable=1024]="CurrentVariable",e[e.DeleteIsosurface=2048]="DeleteIsosurface",e[e.ContainerVisibility=4096]="ContainerVisibility",e[e.RenderMode=8192]="RenderMode",e[e.Optimization=16384]="Optimization",e[e.VariableStyles=32768]="VariableStyles",e[e.VolumeStyles=65536]="VolumeStyles",e[e.AnalysisSlice=131072]="AnalysisSlice"}(a||(a={})),function(e){e[e.Isosurfaces=0]="Isosurfaces",e[e.DynamicSections=1]="DynamicSections",e[e.StaticSections=2]="StaticSections"}(o||(o={}));export{o as ContainerType,a as UpdateFlags,i as VoxelRequestType,t as WasmCullMode,n as WasmRenderingQuality,e as WasmResponseType};
|
package/package.json
CHANGED
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
|
|
5
|
+
const f="20221221",c="160f62fdfa8a5975504cb68e652f8b4dce2fbec6";export{f as buildDate,c as commitHash};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import s from"../../../core/Error.js";import t from"../../../core/Handles.js";import
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import s from"../../../core/Error.js";import t from"../../../core/Handles.js";import a from"../../../core/Logger.js";import{isSome as i,destroyMaybe as o}from"../../../core/maybe.js";import{watch as r,initial as l}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{f as d,n as c,s as m}from"../../../chunks/vec3.js";import{c as u}from"../../../chunks/vec3f64.js";import{equals as y}from"../../../geometry/support/spatialReferenceUtils.js";import{LayerView3D as p}from"./LayerView3D.js";import b from"../../layers/LayerView.js";import{ContextType as _}from"../../webgl/context-util.js";var V;!function(e){e[e.API=1]="API",e[e.VerboseAPI=2]="VerboseAPI",e[e.Error=3]="Error"}(V||(V={}));const w=u();let v=class extends(p(b)){constructor(){super(...arguments),this._usedMemory=0,this._futureMemory=0,this.type="voxel-3d",this.slicePlaneEnabled=!1,this._wasmLayerId=-1,this._handles=new t,this._dbgFlags=new Set}get baseUrl(){return this.layer.parsedUrl?.path??""}get wasmLayerId(){return this._wasmLayerId}initialize(){if(this._dbgFlags.add(V.Error),"local"!==this.view.viewingMode)throw new s("voxel:unsupported-viewingMode","Voxel layers support local viewingMode only.",{});if(this.view._stage.renderView.renderingContext.type!==_.WEBGL2)throw new s("voxel:unsupported-context","Voxel layers are supported in WebGL2 rendering contexts only.",{});if(!!!this.view._stage.renderView.renderingContext.capabilities.colorBufferFloat?.textureFloat)throw new s("voxel:missing-color-buffer-float","Voxel layers require the WebGL2 extension EXT_color_buffer_float",{});const e=this.layer.spatialReference;if(!y(e,this.view.spatialReference))throw new s("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{});const t=this.layer.currentVariableId,a=this.layer.getVolume(t),o=this.layer.getVariable(t);if(i(a)&&i(o)){const e=a.dimensions[0],s=a.dimensions[1],t=a.zDimension;if(t>1){const i=a.dimensions[t],r=e.size*s.size*i.size;let l=1;switch(o.renderingFormat.type){case"Int16":case"UInt16":l=2;break;case"Int32":case"UInt32":case"Float32":l=4}this._futureMemory=l*r}}const n=this.view.addVoxelLayerViewToWasm(this).then((e=>{this._wasmLayerId=e,this._suspendedHandle=r((()=>this.suspended),(e=>{const s=this.view.voxelWasm;i(s)&&s.setEnabled(this,!e)}),l),this._handles.add([r((()=>this.layer.renderMode),(e=>this._pushRenderModeToWasm(e))),r((()=>this.layer.currentVariableId),(e=>this._pushCurrentVariableIdToWasm(e))),r((()=>this.layer.getSections()),(e=>this._pushSectionsToWasm(e))),r((()=>this.layer.getVariableStyles()),(e=>this._pushVariableStylesToWasm(e))),r((()=>this.layer.getVolumeStyles()),(e=>this._pushVolumeStylesToWasm(e))),r((()=>this.layer.enableDynamicSections),(e=>this._pushEnableDynamicSectionsToWasm(e))),r((()=>this.layer.enableIsosurfaces),(e=>this._pushEnableIsosurfacesToWasm(e))),r((()=>this.layer.enableSections),(e=>this._pushEnableSectionsToWasm(e))),r((()=>this.layer.enableSlices),(e=>this._pushEnableSlicesToWasm(e))),r((()=>this.slicePlaneEnabled),(e=>this._pushAnalysisSliceToWasm(e,this.view.slicePlane))),r((()=>this.view.slicePlane),(e=>this._pushAnalysisSliceToWasm(this.slicePlaneEnabled,e)))])})).catch((e=>{if(this.view.removeVoxelLayerViewFromWasm(this),this._wasmLayerId=-1,-1===e)throw new s("voxel:addLayer-failure","The voxel layer description was invalid.",{});if(-2===e)throw new s("voxel:addLayer-failure","The voxel layer web assembly module failed to download.",{})}));this.addResolvingPromise(n)}destroy(){this.view.removeVoxelLayerViewFromWasm(this),this._suspendedHandle&&(this._suspendedHandle.remove(),this._suspendedHandle=null),this._handles=o(this._handles)}isUpdating(){const e=this.view.voxelWasm;return!(this._wasmLayerId<0||!i(e))&&e.isUpdating(this._wasmLayerId)}updatingFlagChanged(){this.notifyChange("updating")}getUsedMemory(){return this._usedMemory}getUnloadedMemory(){return this._futureMemory}ignoresMemoryFactor(){return!0}get performanceInfo(){return{nodes:0,displayedNumberOfFeatures:0,maximumNumberOfFeatures:0,totalNumberOfFeatures:0,core:null}}setUsedMemory(e){this._usedMemory=e,this._futureMemory=0}captureFrustum(){const e=this.view.voxelWasm;i(e)&&e.captureFrustum()}toggleFullVolumeExtentDraw(){const e=this.view.voxelWasm;i(e)&&e.toggleFullVolumeExtentDraw(this)}getLayerTimes(){let e=[];const s=this.view.voxelWasm;return i(s)&&(e=s.getLayerTimes(this)),e}getCurrentLayerTimeIndex(){let e=0;const s=this.view.voxelWasm;return i(s)&&(e=s.getCurrentLayerTimeIndex(this)),e}_pushRenderModeToWasm(e){const s=this.view.voxelWasm;this._dbg(V.VerboseAPI,"VoxelLayerView3D._pushRenderModeToWasm() called, "+(i(s)?"have WASM":"don't have WASM!!!"));!!i(s)&&s.setRenderMode(this,e)||this._dbg(V.Error,"VoxelLayerView3D._pushRenderModeToWasm() failed!")}_pushSectionsToWasm(e){const s=this.view.voxelWasm;this._dbg(V.VerboseAPI,"VoxelLayerView3D._pushSectionsToWasm() called, "+(i(s)?"have WASM":"don't have WASM!!!"));!!i(s)&&s.setStaticSections(this,e)||this._dbg(V.Error,"VoxelLayerView3D._pushSectionsToWasm() failed!")}_pushCurrentVariableIdToWasm(e){const s=this.view.voxelWasm;this._dbg(V.VerboseAPI,"VoxelLayerView3D._pushCurrentVariableIdToWasm() called!, "+(i(s)?"have WASM":"don't have WASM!!!"));!!i(s)&&s.setCurrentVariable(this,e)||this._dbg(V.Error,"VoxelLayerView3D._pushCurrentVariableIdToWasm() failed!")}_pushVariableStylesToWasm(e){const s=this.view.voxelWasm;this._dbg(V.VerboseAPI,"VoxelLayerView3D._pushVariableStylesToWasm() called, "+(i(s)?"have WASM":"don't have WASM!!!"));let t=!1;i(s)&&(t=s.setVariableStyles(this,e),t||this._dbg(V.Error,"VoxelLayerView3D._pushVariableStylesToWasm() failed!"))}_accountForEnableSlices(e,s){const t=i(s)?s:this.layer.enableSlices;for(let a=0;a<e.length;++a){const s=e[a];for(const e of s.slices)e.enabled=e.enabled&&t}}_pushVolumeStylesToWasm(e){const s=this.view.voxelWasm;this._dbg(V.VerboseAPI,"VoxelLayerView3D._pushVolumeStylesToWasm() called, "+(i(s)?"have WASM":"don't have WASM!!!"));let t=!1;i(s)&&(this._accountForEnableSlices(e,null),t=s.setVolumeStyles(this,e),t||this._dbg(V.Error,"VoxelLayerView3D._pushVolumeStylesToWasm() failed!"))}_pushAnalysisSliceToWasm(e,s){const t=this.view.voxelWasm;this._dbg(V.VerboseAPI,"VoxelLayerView3D._pushAnalysisSliceToWasm() called, "+(i(t)?"have WASM":"don't have WASM!!!"));let a=!1;if(i(t)){if(i(s)){const i=s.origin;d(w,s.basis1,s.basis2),c(w,w),a=t.setAnalysisSlice(this,e,i,w)}else m(w,0,0,1),a=t.setAnalysisSlice(this,!1,w,w);a||this._dbg(V.Error,"VoxelLayerView3D._pushAnalysisSliceToWasm() failed!")}}_pushEnableDynamicSectionsToWasm(e){const s=this.view.voxelWasm;this._dbg(V.VerboseAPI,"VoxelLayerView3D._pushEnableDynamicSectionsToWasm() called, "+(i(s)?"have WASM":"don't have WASM!!!"));let t=!1;i(s)&&(t=s.setEnableDynamicSections(this,e),t||this._dbg(V.Error,"VoxelLayerView3D._pushEnableDynamicSectionsToWasm() failed!"))}_pushEnableSlicesToWasm(e){const s=this.view.voxelWasm;this._dbg(V.VerboseAPI,"VoxelLayerView3D._pushEnableSlicesToWasm() called, "+(i(s)?"have WASM":"don't have WASM!!!"));let t=!1;if(i(s)){const a=this.layer.getVolumeStyles();this._accountForEnableSlices(a,e),t=s.setVolumeStyles(this,a),t||this._dbg(V.Error,"VoxelLayerView3D._pushEnableSlicesToWasm() failed!")}}_pushEnableIsosurfacesToWasm(e){const s=this.view.voxelWasm;this._dbg(V.VerboseAPI,"VoxelLayerView3D._pushEnableIsosurfacesToWasm() called, "+(i(s)?"have WASM":"don't have WASM!!!"));let t=!1;i(s)&&(t=s.setEnableIsosurfaces(this,e),t||this._dbg(V.Error,"VoxelLayerView3D._pushEnableIsosurfacesToWasm() failed!"))}_pushEnableSectionsToWasm(e){const s=this.view.voxelWasm;this._dbg(V.VerboseAPI,"VoxelLayerView3D._pushEnableSectionsToWasm() called, "+(i(s)?"have WASM":"don't have WASM!!!"));let t=!1;i(s)&&(t=s.setEnableSections(this,e),t||this._dbg(V.Error,"VoxelLayerView3D._pushEnableSectionsToWasm() failed!"))}_dbg(e,s){this._dbgFlags.has(e)&&(e===V.Error?a.getLogger(this.declaredClass).error(s):a.getLogger(this.declaredClass).warn(s))}};e([n()],v.prototype,"layer",void 0),e([n()],v.prototype,"baseUrl",null),e([n({type:Boolean})],v.prototype,"slicePlaneEnabled",void 0),v=e([h("esri.views.3d.layers.VoxelLayerView3D")],v);const W=v;export{W 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{IntersectorType as
|
|
5
|
+
import{IntersectorType as t}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{Graphic3DTarget as e,LayerTarget as r}from"../../webgl-engine/lib/IntersectorTarget.js";import{isValidIntersectorResult as n}from"../../webgl-engine/lib/intersectorUtils.js";class s extends e{constructor(t,e,r,n){super(e,r),this.point=t,this.createGraphic=n}}function i(e){return n(e)&&e.intersector===t.PCL&&!!e.target}class o extends r{constructor(t,e,r,n,s){super(t),this.layerUid=t,this.sublayerUid=e,this.nodeIndex=r,this.componentIndex=n,this.triangleNr=s}}class c extends e{constructor(t,e,r){super(e,null),this.point=t,this.createVoxelGraphic=r}}function l(e){return n(e)&&e.intersector===t.I3S&&!!e.target}function a(e){return n(e)&&e.intersector===t.VOXEL&&!!e.target}export{o as I3sTarget,s as PclTarget,c as VoxelTarget,l as isI3sIntersectorResult,i as isPclIntersectorResult,a as isVoxelIntersectorResult};
|
|
@@ -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{isNone as e,isSome as t,unwrapOr as r}from"../../../../core/maybe.js";import i from"../../../../core/PooledArray.js";import{castRenderScreenPointArray3 as n,createRenderScreenPointArray3 as s}from"../../../../core/screenUtils.js";import{a as o,n as a}from"../../../../chunks/vec3.js";import{c}from"../../../../chunks/vec3f64.js";import{create as l,copy as h,NEGATIVE_INFINITY as u,width as d,height as p,expandPointInPlace as m}from"../../../../geometry/support/aaBoundingRect.js";import{create as y}from"../../../../geometry/support/ray.js";import{sv3d as g}from"../../../../geometry/support/vectorStacks.js";import{ViewingMode as f}from"../../../ViewingMode.js";import{fromRenderAtEye as _,fromScreen as R}from"../../support/geometryUtils/ray.js";import{DEFAULT_TOLERANCE as v,newIntersector as I}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as b,IntersectorType as w}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as P,sliceFilterPredicate as M}from"../../webgl-engine/lib/intersectorUtils.js";class j{constructor(e,t,r){this.viewingMode=e,this._forEachLayer=t,this._view=r,this._externalIntersectionHandlers=new i,this._tolerance=v,this._tmpRay=y(),this._tmpRegion=l(),this._validateHUDIntersector=I(this.viewingMode),this._validateHUDIntersector.options.hud=!1}intersectScreen(e,t,r){return this.intersectRay(this._getPickRay(e,this._tmpRay),
|
|
5
|
+
import{isNone as e,isSome as t,unwrapOr as r}from"../../../../core/maybe.js";import i from"../../../../core/PooledArray.js";import{castRenderScreenPointArray3 as n,createRenderScreenPointArray3 as s}from"../../../../core/screenUtils.js";import{a as o,n as a}from"../../../../chunks/vec3.js";import{c}from"../../../../chunks/vec3f64.js";import{create as l,copy as h,NEGATIVE_INFINITY as u,width as d,height as p,expandPointInPlace as m}from"../../../../geometry/support/aaBoundingRect.js";import{create as y}from"../../../../geometry/support/ray.js";import{sv3d as g}from"../../../../geometry/support/vectorStacks.js";import{ViewingMode as f}from"../../../ViewingMode.js";import{fromRenderAtEye as _,fromScreen as R}from"../../support/geometryUtils/ray.js";import{DEFAULT_TOLERANCE as v,newIntersector as I}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as b,IntersectorType as w}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as P,sliceFilterPredicate as M}from"../../webgl-engine/lib/intersectorUtils.js";class j{constructor(e,t,r){this.viewingMode=e,this._forEachLayer=t,this._view=r,this._externalIntersectionHandlers=new i,this._tolerance=v,this._tmpRay=y(),this._tmpRegion=l(),this._validateHUDIntersector=I(this.viewingMode),this._validateHUDIntersector.options.hud=!1}intersectScreen(e,t,r){return this.intersectRay(this._getPickRay(e,this._tmpRay),L(this.viewingMode),t,r)}intersectScreenFreePointFallback(e,t,r){return this.intersectRayFreePointFallback(this._getPickRay(e,this._tmpRay),t,r)}intersectRayFreePointFallback(e,t,r){return this.intersectRay(e,L(this.viewingMode),t,r)||this._intersectRayFreePointLocal(e,t)}intersectRay(e,t,r,i){return t.options.selectionMode=!1,t.options.store=b.MIN,this.computeIntersection(e,t,i),!!t.results.min&&t.results.min.getIntersectionPoint(r)}getCenterRayWithSubpixelOffset(e,t,r=.5,i=.5){return e.getRenderCenter(F,r,i),F[0]+=.0466,F[1]-=.0123,_(e,F,t)}intersectIntersectorScreen(e,t,r){this.computeIntersection(this._getPickRay(e,this._tmpRay),t,r)}intersectToolIntersectorScreen(e,t,r){const i=this._getPickRay(e,this._tmpRay);this.intersectToolIntersectorRay(i,t,r)}intersectToolIntersectorRay(e,t,r){t.options.selectionMode=!0,this.computeIntersection(e,t,r);const i=t.results.min;!!this._view.basemapTerrain&&this._view.basemapTerrain.opaque||P(i)&&i.intersector!==w.TERRAIN||(t.options.selectionMode=!1,this.computeIntersection(e,t,r))}setTolerance(e=v){this._tolerance=e}addIntersectionHandler(e){this._externalIntersectionHandlers.push(e),this._externalIntersectionHandlers.sort(((e,t)=>e.type===w.TERRAIN?1:t.type===w.TERRAIN?-1:0))}removeIntersectionHandler(e){null!=this._externalIntersectionHandlers.removeUnordered(e)&&this._externalIntersectionHandlers.sort(((e,t)=>e.type===w.TERRAIN?1:t.type===w.TERRAIN?-1:0))}_getPickRay(e,t){const r=this._view.state.camera;return R(r,e,t)}_intersectRayFreePointLocal(t,r){return this.viewingMode!==f.Local||e(t)||o(r,t.origin,a(g.get(),t.direction)),!1}intersectElevationFromScreen(e,t,r=0,i=null){return this._intersectElevation(this._getPickRay(e,this._tmpRay),t,r,i)}_intersectElevation(i,s,a=0,c=null){if(e(i))return null;const l=t(s)?s.mode:"absolute-height",h=t(s)?r(s.offset,0):0,u="on-the-ground"!==l?h+a:0,d=u/this._view.renderCoordsHelper.unitInMeters;if("absolute-height"===l){if(this._view.renderCoordsHelper.intersectInfiniteManifold(i,u,A)){const e=this._view.computeMapPointFromVec3d(A);return e.z??(e.z=0),e.z-=h,e}return null}const p=this._view.state.camera,m=n(g.get());p.projectToRenderScreen(i.origin,m);const y=new T(null,this._forEachLayer),f=this._view.slicePlane,_=t(f)?M(f):null,R=I(this.viewingMode);R.options.store=b.MIN,R.options.verticalOffset=d;const v=i.origin,P=o(g.get(),v,i.direction);R.reset(v,P,p),R.point=m;const j=t(c)?"type"in c&&"graphics"===c.type?e=>e.metadata?.layerUid!==c.uid:e=>e.metadata?.graphicUid!==c.uid:null;switch(l){case"relative-to-scene":{const t=t=>(e(j)||j(t))&&!!t.metadata?.isElevationSource;R.intersect(y.layers,m,this._tolerance,null,t),this._externalIntersectionHandlers.forAll((e=>{if(e.type===w.I3S||e.type===w.TERRAIN){const t=e.slicePlaneEnabled?_:null;e.intersect(R,t,R.rayBegin,R.rayEnd,m)}}))}break;case"on-the-ground":case"relative-to-ground":this._externalIntersectionHandlers.forAll((e=>{if(e.isGround){const t=e.slicePlaneEnabled?_:null;e.intersect(R,t,R.rayBegin,R.rayEnd,m)}}))}if(R.results.min.getIntersectionPoint(A)){const e=this._view.computeMapPointFromVec3d(A);return e.z=a,e}return null}computeIntersection(i,s,a){if(e(i))return;const c=this._view.state.camera,l=n(g.get());c.projectToRenderScreen(i.origin,l);const h=new T(a,this._forEachLayer);s.options.selectOpaqueTerrainOnly=!a||!("include"in a||"exclude"in a);const u=i.origin,d=o(g.get(),i.origin,i.direction);s.reset(u,d,c),s.intersect(h.layers,l,this._tolerance);const p=this._view.slicePlane,m=t(p)?M(p):null;s.intersect(h.sliceableLayers,l,this._tolerance,m);const y=a&&(a.requiresGroundFeedback||a.enableDraped);this._externalIntersectionHandlers.forAll((e=>{const t=e.layerUid,r=Array.isArray(t),i=r?t:[t];r&&(s.options.filteredLayerUids=[]);let n=!1;for(const o of i){!h.filterLayerUid(o)?r&&s.options.filteredLayerUids.push(o):n=!0}if(s.options.isFiltered=!n,e.isGround&&y||!s.options.isFiltered){const t=e.slicePlaneEnabled?m:null;e.intersect(s,t,u,d,l)}}));const f=g.get(),_=this._view.basemapTerrain;if(a&&a.enableDraped&&t(_.spatialReference)&&s.results.ground.getIntersectionPoint(f)){const e=_.overlayManager.renderer,t=this._view.renderCoordsHelper.spatialReference,i=g.get();this._view.renderCoordsHelper.fromRenderCoords(f,i,_.spatialReference),i[2]=r(this._view.elevationProvider?.getElevation(f[0],f[1],f[2],t,"ground"),0),e.intersect(s,i,s.results.ground,(e=>h.filterRenderGeometry(e)))}s.sortResults(),this._processHUDResults(s)}_processHUDResults(r){const i=r.results.hud;h(this._tmpRegion,u);const n=this._view.state.camera,s=[],o=this._tmpRegion,a=e=>{const t=new H(e);n.projectToRenderScreen(e.target.center,t.screenPoint),t.screenPoint[0]=Math.floor(t.screenPoint[0]),t.screenPoint[1]=Math.floor(t.screenPoint[1]),s.push(t),m(o,t.screenPoint)};r.sortResults(i.all),t(i.min.dist)&&a(i.min);for(const e of i.all)i.min.target.object!==e.target.object&&i.max.target.object!==e.target.object&&a(e);if(t(i.max.dist)&&i.max.target.object!==i.min.target.object&&a(i.max),!s.length)return;o[0]===o[2]&&(o[2]+=1),o[1]===o[3]&&(o[3]+=1);const c=n.fullWidth,l=n.fullHeight,y=Math.max(0,o[0]-x),g=Math.max(0,o[1]-x),f=Math.min(d(o)+2*x,c-y),_=Math.min(p(o)+2*x,l-g),R=new Uint8Array(f*_*4);this._view._stage.renderer.readHUDVisibility(y,g,f,_,R);let v=!0;const I=e(r.results.max.dist);let w=0;for(const e of s)for(const t of U){if(R[4*(Math.min(e.screenPoint[0]+t[0],c)-o[0]+(Math.min(e.screenPoint[1]+t[1],l)-o[1])*f)]){v&&(r.results.min.copy(e.result),v=!1),I&&r.results.max.copy(e.result),r.options.store===b.ALL&&r.results.all.splice(w++,0,e.result);break}}}}const x=1,U=(()=>{const e=[],t=x;for(let r=-t;r<=t;r++)for(let i=-t;i<=t;i++)e.push([i+t,r+t]);return e})();class H{constructor(e){this.result=e,this.screenPoint=s()}}let E;function L(e){return E&&E.viewingMode===e||(E=I(e)),E}class T{constructor(e,t){this.layers=new Array,this.sliceableLayers=new Array,this.include=e?.include,this.exclude=e?.exclude,t((e=>{e.pickable&&this.filterLayerUid(e.apiLayerUid)&&(e.sliceable?this.sliceableLayers:this.layers).push(e)}))}filterLayerUid(t){const{include:r,exclude:i}=this;return e(t)?null==r&&null==i:(null==r||r.has(t))&&(null==i||!i.has(t))}filterRenderGeometry(e){return this.filterLayerUid(e.layerUid)}}function k(e){return"object"==typeof e&&"intersect"in e}const A=c(),F=s();export{j as SceneIntersectionHelper,k as isIntersectionHandler};
|
|
@@ -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
|
-
var i,t;!function(i){i[i.OBJECT=0]="OBJECT",i[i.HUD=1]="HUD",i[i.TERRAIN=2]="TERRAIN",i[i.OVERLAY=3]="OVERLAY",i[i.I3S=4]="I3S",i[i.PCL=5]="PCL",i[i.LOD=6]="LOD",i[i.VOXEL=7]="VOXEL"}(i||(i={}));class
|
|
5
|
+
var i,t;!function(i){i[i.OBJECT=0]="OBJECT",i[i.HUD=1]="HUD",i[i.TERRAIN=2]="TERRAIN",i[i.OVERLAY=3]="OVERLAY",i[i.I3S=4]="I3S",i[i.PCL=5]="PCL",i[i.LOD=6]="LOD",i[i.VOXEL=7]="VOXEL"}(i||(i={}));class e{constructor(){this.verticalOffset=0,this.selectionMode=!1,this.hud=!0,this.selectOpaqueTerrainOnly=!0,this.invisibleTerrain=!1,this.backfacesTerrain=!0,this.isFiltered=!1,this.filteredLayerUids=[],this.store=t.ALL}}!function(i){i[i.MIN=0]="MIN",i[i.MINMAX=1]="MINMAX",i[i.ALL=2]="ALL"}(t||(t={}));export{e as IntersectorOptions,i as IntersectorType,t as StoreResults};
|
|
@@ -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{isSome as r,isNone as t,applySome as e}from"../../../../core/maybe.js";import{l as n}from"../../../../chunks/mat4.js";import{c as i}from"../../../../chunks/vec3f64.js";import{diameter as a}from"../../../../geometry/support/aaBoundingBox.js";import{a as o}from"../../../../chunks/sphere.js";import{isPclIntersectorResult as
|
|
5
|
+
import{isSome as r,isNone as t,applySome as e}from"../../../../core/maybe.js";import{l as n}from"../../../../chunks/mat4.js";import{c as i}from"../../../../chunks/vec3f64.js";import{diameter as a}from"../../../../geometry/support/aaBoundingBox.js";import{a as o}from"../../../../chunks/sphere.js";import{isPclIntersectorResult as c,isI3sIntersectorResult as u,isVoxelIntersectorResult as s}from"../../layers/i3s/Intersector.js";import{isTerrainIntersectorResult as l,isOverlayIntersectorResult as p}from"../../terrain/Intersector.js";import{isObjectIntersectorResult as g,isHudIntersectorResult as f}from"./intersectorUtils.js";import{isLodIntersectorResult as m}from"./lodRendering/Intersector.js";function d(r,t){return g(r)||f(r)?B(r.target?.object.metadata,t):l(r)?t.map?.ground:c(r)||u(r)||p(r)||s(r)?B(r.target,t):null}function h(t,e){const n=y(t,e);return r(n)&&"graphic"===n.type?n.graphic:null}function y(r,e){if(t(r))return null;if(g(r)||f(r))return j(r.target?.object.metadata,e);if(c(r)){const t=r.target.createGraphic();return{type:"graphic",graphic:t,layer:t.layer}}if(s(r)){const t=r.target.createVoxelGraphic();return{type:"graphic",graphic:t,layer:t.layer}}return p(r)||m(r)?j(r.target,e):u(r)?U(r.target,e):null}function j(r,e){if(t(r)||t(r.graphicUid))return null;const n=B(r,e);if(t(n))return null;if(n===e.graphics)return t(e.graphicsView)||"number"!=typeof r.graphicUid?null:e.graphicsView.getHit(r.graphicUid);const i=e.allLayerViews.find((r=>r.layer===n));return!i||i.suspended||t(r.graphicUid)?null:"getHit"in i?i.getHit(r.graphicUid):null}function U(r,e){const n=B(r,e);if(t(n))return null;const i=e.allLayerViews.find((r=>r.layer===n));return i&&!i.suspended&&"getGraphicFromIntersectorTarget"in i?b(i.getGraphicFromIntersectorTarget(r)):null}function V(r,e){const n=B(r,e);if(t(n))return null;const i=e.allLayerViews.find((r=>r.layer===n));return i&&!i.suspended&&"getAABBFromIntersectorTarget"in i?i.getAABBFromIntersectorTarget(r):null}function b(t){return r(t)?{type:"graphic",graphic:t,layer:t.layer}:null}function B(e,n){return!e||t(e.layerUid)?null:r(n.graphicsView)&&e.layerUid===n.graphicsView.processor.layer.id?n.graphics:n.map.findLayerByUid(e.layerUid)}function w(r,t){if(g(r)||f(r))return o(r.target.object.boundingVolumeWorldSpace.bounds);if(m(r)){n(L,r.transformation);const t=Math.max(L[0],L[1],L[2]);return r.target.baseBoundingSphere.radius*t}return u(r)?e(V(r.target,t),(r=>.5*a(r))):null}function I(r){return!g(r)&&!f(r)&&(m(r)?r.target.numLodLevels>1:!!u(r))}const L=i();export{w as getIntersectedFeatureBSRadius,I as hasLod,h as toGraphic,y as toHit,d as toOwner};
|
package/widgets/Slice.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{_ as e}from"../chunks/tslib.es6.js";import{
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import{isSome as t}from"../core/maybe.js";import{ignoreAbortErrors as s}from"../core/promiseUtils.js";import{property as i}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import r from"./Widget.js";import o from"./Slice/SliceViewModel.js";import{Heading as n}from"./support/Heading.js";import"./support/widgetUtils.js";import{messageBundle as c}from"./support/decorators/messageBundle.js";import{tsx as a}from"./support/jsxFactory.js";const d="esri-slice",u={buttonDisabled:"esri-button--disabled",layerIncludeButton:`${d}__cross`,widgetIcon:"esri-icon-slice",base:`${d} esri-widget esri-widget--panel`,layerList:`${d}__settings`,layerListHeading:`${d}__settings-title`,layerItem:`${d}__layer-item`,layerItemTitle:`${d}__layer-item__title`,container:`${d}__container`,actionSection:`${d}__actions`,hint:`${d}__hint`,hintText:`${d}__hint-text`,panelError:`${d}__panel--error`,newSliceButton:`${d}__clear-button esri-button esri-button--primary`,excludeButton:`${d}__exclude-button esri-button esri-button--secondary`,cancelButton:`${d}__cancel-button esri-button esri-button--secondary`};let p=class extends r{constructor(e,t){super(e,t),this.headingLevel=3,this.iconClass=u.widgetIcon,this.messages=null,this.viewModel=new o}loadDependencies(){return import("@esri/calcite-components/dist/components/calcite-button.js")}get active(){return this.viewModel.active}get analysis(){return this.viewModel.analysis}set analysis(e){this.viewModel.analysis=e}get excludedLayers(){return this.viewModel.excludedLayers}set excludedLayers(e){this.viewModel.excludedLayers=e}get excludeGroundSurface(){return this.viewModel.excludeGroundSurface}set excludeGroundSurface(e){this.viewModel.excludeGroundSurface=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}render(){const e=this.viewModel.supported,s=this.viewModel.active,i="disabled"===this.viewModel.state,l="ready"===this.viewModel.state,r="slicing"===this.viewModel.state||"sliced"===this.viewModel.state,o="exclude"===this.viewModel.layersMode,{messages:c}=this,d=i&&u.buttonDisabled,p=!!t(this.viewModel.view)&&this.viewModel.view.allLayerViews.some((e=>"voxel-3d"===e.type)),y=s&&!r||o?null:a("button",{disabled:i,class:this.classes(u.newSliceButton,d),bind:this,onclick:this._onNewSliceClick,key:"esri-slice__clear",type:"button"},c.newSlice),h=r&&!o?a("button",{class:this.classes(u.excludeButton,d),bind:this,onclick:()=>{this.viewModel.enterExcludeLayerMode()},key:"esri-slice__exclude",type:"button"},c.excludeLayer):null,v=s&&o?a("button",{class:this.classes(u.cancelButton,d),bind:this,onclick:()=>{this.viewModel.exitExcludeLayerMode()},key:"esri-slice__cancel-exclude",type:"button"},c.cancel):null;let m=null;s&&(o?m=c.excludeHint:l&&(m=p?c.voxelHint:c.hint));const w=m?a("div",{class:u.hint,key:"esri-slice__hint"},a("p",{class:u.hintText},m)):null,_=this.excludedLayers?this.excludedLayers.toArray().map((e=>this._renderLayerItem({uid:e.uid,title:e.title,onClick:()=>(this.excludedLayers.remove(e),!1)}))):[];this.excludeGroundSurface&&_.push(this._renderLayerItem({uid:"ground",title:c.ground,onClick:()=>(this.excludeGroundSurface=!1,!1)}));const b=!o&&r&&_.length>0?a("div",{class:u.layerList,key:"esri-slice__settings"},a(n,{class:u.layerListHeading,level:this.headingLevel},c.excludedLayers),a("ul",null,_)):null,x=a("div",{class:u.panelError,key:"esri-slice__unsupported"},a("p",null,c.unsupported)),g=a("div",{class:u.actionSection},h,v,y),M=this.visible?a("div",{class:u.container},e?[w,b,g]:x):null;return a("div",{class:u.base,role:"presentation"},M)}_renderLayerItem(e){return a("li",{class:u.layerItem,key:e.uid},a("calcite-button",{appearance:"transparent",class:u.layerIncludeButton,"icon-start":"x",scale:"s",title:this.messages.includeLayer,bind:this,onclick:e.onClick}),a("div",{class:u.layerItemTitle},e.title))}_onNewSliceClick(){s(this.viewModel.start())}};e([i()],p.prototype,"active",null),e([i({constructOnly:!0,nonNullable:!0})],p.prototype,"analysis",null),e([i()],p.prototype,"excludedLayers",null),e([i()],p.prototype,"excludeGroundSurface",null),e([i()],p.prototype,"headingLevel",void 0),e([i()],p.prototype,"iconClass",void 0),e([i()],p.prototype,"label",null),e([i(),c("esri/widgets/Slice/t9n/Slice")],p.prototype,"messages",void 0),e([i()],p.prototype,"view",null),e([i({type:o})],p.prototype,"viewModel",void 0),e([i()],p.prototype,"visible",null),p=e([l("esri.widgets.Slice")],p);const y=p;export{y as default};
|