// All material copyright Esri, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.30/esri/copyright.txt for details. //>>built define("../../../chunks/tslib.es6 ../../../geometry ../../../core/Error ../../../core/Logger ../../../core/reactiveUtils ../../../core/accessorSupport/decorators/property ../../../core/has ../../../core/RandomLCG ../../../core/accessorSupport/decorators/subclass ../../../chunks/vec32 ../../../core/libs/gl-matrix-2/factories/vec3f64 ../../../geometry/projection/projectVectorToVector ../../../geometry/support/aaBoundingBox ../../../geometry/support/spatialReferenceUtils ./LayerView3D ./VoxelWasm ./support/LayerViewPerformanceInfo ./support/PopupSceneLayerView ../../layers/LayerView ../../support/layerViewUtils ../../../geometry/SpatialReference".split(" "), function(m,k,n,r,g,p,G,H,x,q,t,y,u,z,A,e,B,C,D,E,F){var d;(function(a){a[a.API=1]="API";a[a.VerboseAPI=2]="VerboseAPI";a[a.Error=3]="Error"})(d||={});const l=t.create(),v=t.create();k=class extends C.PopupSceneLayerView(A.LayerView3D(D)){constructor(){super(...arguments);this._suspendedHandle=null;this._futureMemory=this._usedMemory=0;this.type="voxel-3d";this.slicePlaneEnabled=!1;this._wasmLayerId=-1;this.ignoresMemoryFactor=!0;this._dbgFlags=new Set}get baseUrl(){return this.layer.parsedUrl?.path?? ""}get wasmLayerId(){return this._wasmLayerId}initialize(){this._dbgFlags.add(d.Error);if("local"!==this.view.viewingMode)throw new n("voxel:unsupported-viewingMode","Voxel layers support local viewingMode only.",{});if(!this.view._stage.renderView.renderingContext.capabilities.colorBufferFloat?.textureFloat)throw new n("voxel:missing-color-buffer-float","Voxel layers require the WebGL2 extension EXT_color_buffer_float",{});if(!z.equals(this.layer.spatialReference,this.view.spatialReference))throw new n("layerview:spatial-reference-incompatible", "The spatial reference of this scene layer is incompatible with the spatial reference of the view",{});var a=this.layer.currentVariableId,b=this.layer.getVolume(a);a=this.layer.getVariable(a);if(null!=b&&null!=a){var f=b.dimensions[0];const h=b.dimensions[1],c=b.zDimension;if(1{this._wasmLayerId= h;this._suspendedHandle=g.watch(()=>this.suspended,c=>{const w=e.getVoxelWasm(this.view);w&&w.setEnabled(this,!c)},g.initial);this.addHandles([g.watch(()=>this.layer.renderMode,c=>this._pushRenderModeToWasm(c)),g.watch(()=>this.layer.currentVariableId,c=>this._pushCurrentVariableIdToWasm(c)),g.watch(()=>this.layer.getSections(),c=>this._pushSectionsToWasm(c)),g.watch(()=>this.layer.getVariableStyles(),c=>this._pushVariableStylesToWasm(c)),g.watch(()=>this.layer.getVolumeStyles(),c=>this._pushVolumeStylesToWasm(c)), g.watch(()=>this.layer.enableDynamicSections,c=>this._pushEnableDynamicSectionsToWasm(c)),g.watch(()=>this.layer.enableIsosurfaces,c=>this._pushEnableIsosurfacesToWasm(c)),g.watch(()=>this.layer.enableSections,c=>this._pushEnableSectionsToWasm(c)),g.watch(()=>this.layer.enableSlices,c=>this._pushEnableSlicesToWasm(c)),g.watch(()=>[this.layer.timeOffset,this.layer.timeExtent,this.layer.useViewTime],()=>this._updateLayerTimeProperties()),g.watch(()=>this.slicePlaneEnabled,c=>this._pushAnalysisSliceToWasm(c, this.view.slicePlane)),g.watch(()=>this.view.slicePlane,c=>this._pushAnalysisSliceToWasm(this.slicePlaneEnabled,c))])}).catch(h=>{e.removeLayerViewFromWasm(this);this._wasmLayerId=-1;if(-1===h)throw new n("voxel:addLayer-failure","The voxel layer description was invalid.",{});if(-2===h)throw new n("voxel:addLayer-failure","The voxel layer web assembly module failed to download.",{});});this.addResolvingPromise(a)}destroy(){e.removeLayerViewFromWasm(this);this._suspendedHandle&&(this._suspendedHandle.remove(), this._suspendedHandle=null)}isUpdating(){const a=e.getVoxelWasm(this.view);return 0>this._wasmLayerId||null==a?!1:a.isUpdating(this._wasmLayerId)}updatingFlagChanged(){this.notifyChange("updating")}get usedMemory(){return this._usedMemory}get unloadedMemory(){return this._futureMemory}get performanceInfo(){return new B.LayerViewPerformanceInfo(this.usedMemory)}get visibleAtCurrentScale(){return E.isInEffectiveScaleRange(this.layer.effectiveScaleRange,this.view.terrainScale)}whenGraphicBounds(a,b){if(b= a.attributes["Voxel.WorldPosition"])if(a=u.empty(),b=JSON.parse(b),y.projectVectorToVector(b,this.view.renderSpatialReference,v,this.view.spatialReference||F.WGS84))return u.expandWithVec3(a,v),Promise.resolve({boundingBox:a,screenSpaceObjects:[]});return Promise.reject()}setUsedMemory(a){this._usedMemory=a;this._futureMemory=0}captureFrustum(){e.getVoxelWasm(this.view)?.captureFrustum()}toggleFullVolumeExtentDraw(){e.getVoxelWasm(this.view)?.toggleFullVolumeExtentDraw(this)}getLayerTimes(){return e.getVoxelWasm(this.view)?.getLayerTimes(this)?? []}getCurrentLayerTimeIndex(){return e.getVoxelWasm(this.view)?.getCurrentLayerTimeIndex(this)??0}_pushRenderModeToWasm(a){const b=e.getVoxelWasm(this.view);this._dbg(d.VerboseAPI,`VoxelLayerView3D._pushRenderModeToWasm() called, ${b?"have WASM":"don't have WASM!!!"}`);b?.setRenderMode(this,a)||this._dbg(d.Error,"VoxelLayerView3D._pushRenderModeToWasm() failed!")}_pushSectionsToWasm(a){const b=e.getVoxelWasm(this.view);this._dbg(d.VerboseAPI,`VoxelLayerView3D._pushSectionsToWasm() called, ${b?"have WASM": "don't have WASM!!!"}`);b?.setStaticSections(this,a)||this._dbg(d.Error,"VoxelLayerView3D._pushSectionsToWasm() failed!")}_pushCurrentVariableIdToWasm(a){const b=e.getVoxelWasm(this.view);this._dbg(d.VerboseAPI,`VoxelLayerView3D._pushCurrentVariableIdToWasm() called!, ${b?"have WASM":"don't have WASM!!!"}`);b?.setCurrentVariable(this,a)||this._dbg(d.Error,"VoxelLayerView3D._pushCurrentVariableIdToWasm() failed!")}_pushVariableStylesToWasm(a){const b=e.getVoxelWasm(this.view);this._dbg(d.VerboseAPI, `VoxelLayerView3D._pushVariableStylesToWasm() called, ${b?"have WASM":"don't have WASM!!!"}`);b?.setVariableStyles(this,a)||this._dbg(d.Error,"VoxelLayerView3D._pushVariableStylesToWasm() failed!")}_accountForEnableSlices(a,b){b=null!=b?b:this.layer.enableSlices;for(let f=0;f