@arcgis/core 4.34.0-next.80 → 4.34.0-next.82
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/analysis/VolumeMeasurement/VolumeMeasurementDisplayUnits.d.ts +4 -0
- package/analysis/VolumeMeasurement/VolumeMeasurementDisplayUnits.js +5 -0
- package/analysis/VolumeMeasurement/VolumeMeasurementInputUnits.d.ts +4 -0
- package/analysis/VolumeMeasurement/VolumeMeasurementInputUnits.js +5 -0
- package/analysis/VolumeMeasurementAnalysis.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{c90571063bd2bb57a5a7.js → 1d491447b13f2f2b4399.js} +1 -1
- package/assets/esri/core/workers/chunks/264a9a916e1e972b69d7.js +1 -0
- package/assets/esri/core/workers/chunks/30c85a1a4f118cc45a25.js +1 -0
- package/assets/esri/core/workers/chunks/3192b68675ff2afcb1d6.js +1 -0
- package/assets/esri/core/workers/chunks/365d63c2aed3a49918f2.js +1 -0
- package/assets/esri/core/workers/chunks/3ef8a7468d7e3b2f0b69.js +351 -0
- package/assets/esri/core/workers/chunks/a1196637268b89281780.js +1 -0
- package/assets/esri/core/workers/chunks/a1b08aab73747f4e7e25.js +1 -0
- package/assets/esri/core/workers/chunks/{b815c2f61fb9c58a2956.js → b6c4712e00fce87bd0f4.js} +1 -1
- package/assets/esri/core/workers/chunks/{db2396bf062468ee8b60.js → b8810711d058300395cd.js} +1 -1
- package/assets/esri/core/workers/chunks/{22bd4255b6b511a43b66.js → c2bc70b65f5c2a2c9671.js} +1 -1
- package/assets/esri/core/workers/chunks/cc579c94438f48a0dbab.js +1 -0
- package/assets/esri/core/workers/chunks/e1b3ae6426886e2fab07.js +1 -0
- package/assets/esri/core/workers/chunks/e4acc3c2b6d865ed1940.js +1 -0
- package/assets/esri/core/workers/chunks/f6513ec888a7d927d948.js +1 -0
- package/assets/esri/core/workers/chunks/{ede479faa4e6920fe673.js → f8f85207b382c1ea038c.js} +17 -9
- package/assets/esri/core/workers/chunks/{23a13fbab9984953a7c6.js → fc06014fb484fc8c697e.js} +1 -1
- package/assets/esri/libs/dracoMeshDecoder/draco_mesh_decoder.wasm +0 -0
- package/chunks/CutFillComposition.glsl.js +8 -0
- package/chunks/CutFillMask.glsl.js +6 -0
- package/chunks/GaussianSplat.glsl.js +2 -2
- package/chunks/HUDMaterial.glsl.js +4 -6
- package/chunks/draco_mesh_decoder.js +5 -0
- package/config.js +1 -1
- package/core/unitUtils.js +1 -1
- package/interfaces.d.ts +147 -13
- package/kernel.js +1 -1
- package/layers/CSVLayer.js +1 -1
- package/layers/FeatureLayer.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/OrientedImageryLayer.js +1 -1
- package/layers/support/ElevationSampler.js +1 -1
- package/layers/support/FieldConfiguration.js +1 -1
- package/layers/support/rasterDatasets/BaseRaster.js +1 -1
- package/layers/support/rasterDatasets/datasetUtils.js +1 -1
- package/libs/dracoMeshDecoder/dracoMeshDecoder.js +5 -0
- package/package.json +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/rest/featureService/FeatureService.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/Stage.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/TextureStatisticsTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsDiffShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsMinMaxSumShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsStdDevShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsSumOfSquaredDiffShader.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillComputation.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementShiftTool.js +1 -1
- package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
- package/views/3d/glTF/internal/Resource.js +1 -1
- package/views/3d/glTF/loader.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/RenderCommandContext.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/IconSymbolLayerRenderer.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/support/buffer/InterleavedLayout.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
- package/views/3d/support/flow/constants.js +1 -1
- package/views/3d/support/flow/geometryUtils.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatQualitySettings.js +5 -0
- package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/MaskedColor.glsl.js +15 -7
- package/views/3d/webgl-engine/lib/CutFillColor.js +5 -0
- package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
- package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterialBaseInstance.js +5 -0
- package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
- package/views/3d/webgl-engine/shaders/CutFillComposition.glsl.js +5 -0
- package/views/3d/webgl-engine/shaders/CutFillCompositionTechnique.js +5 -0
- package/views/3d/webgl-engine/shaders/CutFillMask.glsl.js +5 -0
- package/views/3d/webgl-engine/shaders/CutFillMaskTechnique.js +5 -0
- package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/HeatmapDensityTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
- package/views/3d/webgl.js +1 -1
- package/views/webgl/VertexArrayObject.js +1 -1
- package/widgets/Attribution/AttributionViewModel.js +1 -1
- package/widgets/Feature/FeatureMedia/FeatureMediaViewModel.js +1 -1
- package/widgets/Legend/LegendViewModel.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Search/SearchViewModel.js +1 -1
- package/widgets/Search.js +1 -1
- package/assets/esri/core/workers/chunks/07a355a9c95154971aab.js +0 -1
- package/assets/esri/core/workers/chunks/22a66db7d73e733917e3.js +0 -1
- package/assets/esri/core/workers/chunks/49486c2e12e768b347ed.js +0 -1
- package/assets/esri/core/workers/chunks/66e0bc4acb18f00a433d.js +0 -1
- package/assets/esri/core/workers/chunks/76db75337044de8218c9.js +0 -353
- package/assets/esri/core/workers/chunks/978fab0f0b10edde4ff8.js +0 -1
- package/assets/esri/core/workers/chunks/a07321a901d6847d1a6b.js +0 -1
- package/assets/esri/core/workers/chunks/ae8dce1a43ca7019f81d.js +0 -1
- package/assets/esri/core/workers/chunks/cb3b88959b2f048e54a5.js +0 -1
- package/assets/esri/core/workers/chunks/da1a5537e2f2ca6cc247.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import s from"../../../core/Logger.js";import{removeMaybe as t}from"../../../core/maybe.js";import{watch as
|
|
5
|
+
import{__decorate as e}from"tslib";import s from"../../../core/Logger.js";import{removeMaybe as t}from"../../../core/maybe.js";import{watch as i,syncAndInitial as r}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{fromValues as o}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{isCompatible as l}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as h,isWebMercator as d,equals as u}from"../../../geometry/support/spatialReferenceUtils.js";import{getHeightModelInfoFromVCS as c}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as m}from"../../../support/elevationInfoUtils.js";import{LayerView3D as p}from"./LayerView3D.js";import{addLayerViewToWasm as f,getLyr3DWasm as y,removeLayerViewFromWasm as _}from"./Lyr3DWasm.js";import{Obb as g}from"../support/orientedBoundingBox.js";import{splatPageSizeInU32 as w,elementsPerSplatPage as b,packedGaussianSizeInU32 as M,splatPageSizeInU32WithoutHeader as v,gaussiansPerSplatPage as j,splatAtlasTextureWidth as x}from"../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{GaussianTile as C}from"../support/gaussianSplatting/GaussianTile.js";import{GaussianSplatRenderNode as S}from"../webgl-engine/lib/GaussianSplatRenderNode.js";import U from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as A}from"../../support/layerViewUtils.js";const H=()=>s.getLogger("esri.views.3d.layers.GaussianSPlatLayerView3D");let V=class extends(p(U)){constructor(e){super(e),this.type="gaussian-splat-3d",this._gaussianTileHandles=new Map,this._pageBuffer=new Uint32Array(w),this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this._useEsriCrs=!1,this._suspendedHandle=null,this._conversionBuffer=new ArrayBuffer(4),this._u32View=new Uint32Array(this._conversionBuffer),this._f32View=new Float32Array(this._conversionBuffer),this._memCache=e.view.resourceController.memoryController.newCache(`GaussianSplat-${this.uid}`,e=>this._deleteTile(e)),this._renderNode=new S(e)}initialize(){if(!this._canProjectWithoutEngine())throw A("layer",this.layer.spatialReference.wkid,this.view.renderSpatialReference?.wkid);const e=f(this).then(e=>{this._wasmLayerId=e,this.addHandles([i(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e))]),this._suspendedHandle=i(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),r)});this.addResolvingPromise(e)}get wasmLayerId(){return this._wasmLayerId}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&e.isUpdating(this._wasmLayerId)}updatingFlagChanged(){this.notifyChange("updating")}get _wasm(){return y(this.view)}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get useEsriCrs(){return this._useEsriCrs}async createRenderable(e){const s=e.meshData;if(null==s.data)throw new Error("meshData.data undefined");if(s.desc=JSON.parse(s.desc),null==s.desc)throw new Error("meshData.desc undefined");const t=s.desc.prims[0],i=t.vertexCount,r=t.atrbs[0].view,a=t.atrbs[0].view.byteCount,n=t.atrbs[0].view.byteOffset;let l=null;if("U32"!==r.type)return H().warnOnce("unexpected meshData.data format"),{memUsageBytes:0};l=new Uint32Array(s.data.buffer,n,a/4);const h=this.extractHeader(l),d=Math.ceil(i/j),u=new Uint32Array(i),c=[];for(let o=0;o<d;o++){let e=this._data.textureAtlas.requestPage();if(null===e&&(this._freeInvisibleTiles(),e=this._data.textureAtlas.requestPage()),null===e)return H().warnOnce("ran out of gaussian splat memory"),{memUsageBytes:0};{c.push(e);const s=i-o*j,t=Math.min(s,j),r=o*j;for(let i=0;i<t;i++)u[i+r]=i+b*e;const a=o*v;this._pageBuffer.set(l.subarray(a,a+t*M)),this._pageBuffer.set(h.packedHeader,v);const n=e*b,d=n%x,m=Math.floor(n/x);this._data.textureAtlas.update(d,m,this._pageBuffer)}}const m=new Float64Array(3*i),p=new Float64Array(i),f=2.048,y=h.tileOrigin.x*f,_=h.tileOrigin.y*f,w=h.tileOrigin.z*f,S=h.invPosScale;let U=0,A=0;for(let o=0;o<i;o++){const e=o*M,{rawX:s,rawY:t,rawZ:i}=this._extractGaussianPosition(l,e),r=this._extractGaussianSphericalScale(l,e);m[U]=s*S+y,m[U+1]=t*S+_,m[U+2]=i*S+w,p[o]=r*r,A=Math.max(A,r),U+=3}let V=null;if(s.desc.obb){const e=s.desc.obb.quaternion;V=new g(s.desc.obb.center,s.desc.obb.halfSize,o(...e))}V||(H().warnOnce("encountered tile without a bounding box"),V=new g);const R=new C(e.handle,V,u,c,m,p,A);return this._memCache.put(`${R.handle}`,R),this._gaussianTileHandles.set(e.handle,R),this._cacheMemory+=R.usedMemory,{memUsageBytes:R.usedMemory}}_extractGaussianPosition(e,s){const t=e[s+1];return{rawX:16383&t,rawY:t>>>14&16383,rawZ:t>>>28&15|(1023&e[s+2])<<4}}_extractGaussianSphericalScale(e,s){const t=e[s+2],i=t>>>10&255,r=t>>>18&255,a=t>>>26&63|(3&e[s+3])<<6,n=Math.exp(i/16-10),o=Math.exp(r/16-10),l=Math.exp(a/16-10);return Math.max(n,o,l)}freeRenderable(e){const s=this._gaussianTileHandles.get(e);s&&(s.isVisible?this._usedMemory-=s.usedMemory:this._cacheMemory-=s.usedMemory,s.pageIds.forEach(e=>this._data.textureAtlas.freePage(e)),this.freeObject(s),this._gaussianTileHandles.delete(e)),this._updateGaussians()}freeObject(e){this._memCache.pop(`${e.handle}`)}setRenderableVisibility(e,s,t){for(let i=0;i<t;i++){if(!s[i])continue;const t=e[i],r=this._gaussianTileHandles.get(t);if(r){if(r.isVisible)continue;r.isVisible=!0,this._usedMemory+=r.usedMemory,this._cacheMemory-=r.usedMemory,this._memCache.pop(`${t}`)}}for(let i=0;i<t;i++){if(s[i])continue;const t=e[i],r=this._gaussianTileHandles.get(t);if(r){if(!r.isVisible)continue;r.isVisible=!1,this._usedMemory-=r.usedMemory,this._cacheMemory+=r.usedMemory,this._memCache.put(`${t}`,r)}}this._updateGaussians()}destroy(){_(this),this._suspendedHandle&&(this._suspendedHandle=t(this._suspendedHandle)),this._renderNode.destroy(),this._memCache.destroy()}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(h(this.view.renderSpatialReference)||d(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&u(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){const e=c(this.layer.esriCrsSpatialReference),s=this.view.heightModelInfo;return this._useEsriCrs=0===l(e,s,!1),this._useEsriCrs}return!1}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,m(e))}_updateGaussians(){const e=new Array;for(const s of this._gaussianTileHandles.values())s.isVisible&&e.push(s);this._data.updateGaussianVisibility(e)}_freeInvisibleTiles(){for(const e of this._gaussianTileHandles.values())e.isVisible||this._deleteTile(e)}get _data(){return this._renderNode.data}extractHeader(e){const s=e.length-4,t=this.reinterpretU32AsFloat(e[s]),i=this.reinterpretU32AsFloat(e[s+1]),r=this.reinterpretU32AsFloat(e[s+2]),a=1/(1<<(255&e[s+3]));return{packedHeader:e.subarray(s,s+4),tileOrigin:{x:t,y:i,z:r},invPosScale:a}}_deleteTile(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}reinterpretU32AsFloat(e){return this._u32View[0]=e,this._f32View[0]}};e([a()],V.prototype,"layer",void 0),V=e([n("esri.views.3d.layers.GaussianSplatLayerView3D")],V);const R=V;export{R 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__addDisposableResource as e,__disposeResources as t,__decorate as r}from"tslib";import{EventedAccessor as a}from"../../../../../core/Evented.js";import{throwIfAborted as n}from"../../../../../core/promiseUtils.js";import{watch as i,initial as
|
|
5
|
+
import{__addDisposableResource as e,__disposeResources as t,__decorate as r}from"tslib";import{EventedAccessor as a}from"../../../../../core/Evented.js";import{throwIfAborted as n}from"../../../../../core/promiseUtils.js";import{watch as i,initial as s}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import c from"../../../../../geometry/Extent.js";import{initializeProjection as d,project as m}from"../../../../../geometry/projectionUtils.js";import u from"../../../../../geometry/SpatialReference.js";import{QueryEngine as h}from"../../../../../layers/graphics/data/QueryEngine.js";import y from"../../../../../rest/support/Query.js";import{FeatureProcessingContext as p}from"./FeatureProcessingContext.js";import{PipelineCommand as f}from"./PipelineCommand.js";import{Tile3DManager as _}from"./Tile3DManager.js";import{TileLocks as C}from"./TileLocks.js";import{TiledFeatureStore as w}from"./featureSet/TiledFeatureStore.js";import{Tile3DFetcher as g}from"./fetching/Tile3DFetcher.js";import{RenderCommandContext as x}from"./rendering/RenderCommandContext.js";import{RenderCoordsHelper as v}from"../../../support/RenderCoordsHelper.js";let R=class extends a{constructor(){super(...arguments),this.remoteClient=null,this._featureStore=new w,this._tileLocks=new C,this._tileManager=null,this._renderer=null,this._fetcher=null,this._queryEngine=null,this._defaultQueryJSON=null,this._mainThreadDelegate=null,this._viewSpatialReference=null,this._renderCommandContext=null,this._context=null}get updating(){return this._tileManager.updating}destroy(){this._featureStore.clear(),this._tileManager?.destroy()}async setup({viewSpatialReference:e,renderSpatialReference:t,viewingMode:r,layerInfo:a,layerViewInfo:n}){const o=u.fromJSON(e);this._viewSpatialReference=o;const l=u.fromJSON(t);this._fetcher=new g(this._viewSpatialReference,y.fromJSON(a.baseQuery),a.url,a.objectIdField,a.capabilities),this._queryEngine=new h({hasZ:!0,hasM:!1,geometryType:"esriGeometryPoint",featureIdInfo:{type:"object-id",fieldName:a.objectIdField},fieldsIndex:a.fieldIndex,availableFields:[a.objectIdField],spatialReference:e,featureStore:this._featureStore,timeInfo:a.timeInfo}),this._mainThreadDelegate={createTexture:async(e,t)=>{const r={data:e,parameters:t};return await this.remoteClient.invoke("createTexture",r,{transferList:[e.buffer]})},releaseTexture:async e=>{const t={uid:e};await this.remoteClient.invoke("releaseTexture",t)},createMaterial:async e=>{const t={materialJSON:e};await this.remoteClient.invoke("createMaterial",t)},destroyMaterial:async e=>{const t={materialId:e};await this.remoteClient.invoke("destroyMaterial",t)},createDirectRenderer:async e=>{const t={materialId:e};await this.remoteClient.invoke("createDirectRenderer",t)},destroyDirectRenderer:async e=>{const t={materialId:e};await this.remoteClient.invoke("destroyDirectRenderer",t)},createLodRenderer:async(e,t,r)=>{const a={rendererId:e,lodRenderGeometry:t};await this.remoteClient.invoke("createLoDRenderer",a,{transferList:r})},destroyLodRenderer:async e=>{const t={rendererId:e};await this.remoteClient.invoke("destroyLoDRenderer",t)},executeRenderCommands:async e=>{const t={commands:e.commands};await this.remoteClient.invoke("dispatchRenderCommands",t,{transferList:e.transferList})},applyElevationAlignmentTo:async e=>{const t={mapPoints:e};return await this.remoteClient.invoke("applyElevationAlignment",t,{transferList:[e.buffer]})},setBaseInstance:async(e,t)=>{const r={rendererId:e,baseInstance:t};await this.remoteClient.invoke("setBaseInstance",r,{transferList:null!=t?[t.data]:void 0})}};const f=v.create(r,l),C=new x(r,this._mainThreadDelegate);this._renderCommandContext=C;const w=new p(o,l,this._mainThreadDelegate,f,C,a,n);this._context=w,this._renderer=w.symbolRendererFactory.createSymbolRendererFromJSON(a.renderer),this._defaultQueryJSON=new y({outSpatialReference:o}).toJSON();let R=null;if(null!=a.fullExtent){const e=c.fromJSON(a.fullExtent);await d(e.spatialReference,o),R=m(e,o)}return this._tileManager=new _({loadTile:(e,t)=>this._fetcher.fetch(e,t),createAddCommand:(e,t)=>this._createAddFeatureDataCommand(e,t),createRemoveCommand:e=>this._createRemoveFeatureDataCommand(e),createUpdateCommand:(e,t)=>this._createUpdateFeatureDataVisibilityCommand(e,t),tileLocks:this._tileLocks,extent:R}),this.addHandles(i(()=>this.updating,e=>{this.emit("notify-updating",{updating:e})}),s),null!=this._renderer&&await this._renderer.load(),j}async executeQuery(e,t){return{result:await this._queryEngine.executeQuery(this._ensureQuery(e),t)}}async executeQueryForIds(e,t){const r=await this._queryEngine.executeQueryForIdSet(this._ensureQuery(e),t);return{result:Array.from(r)}}async executeQueryForCount(e,t){return{result:await this._queryEngine.executeQueryForCount(this._ensureQuery(e),t)}}async executeQueryForExtent(e,t){return{result:await this._queryEngine.executeQueryForExtent(this._ensureQuery(e),t)}}async executeQueryForLatestObservations(e,t){return{result:await this._queryEngine.executeQueryForLatestObservations(this._ensureQuery(e),t)}}async executeAttributeBinsQuery(e,t){return{result:await this._queryEngine.executeAttributeBinsQuery(e,t)}}onTileTreeChange(e){return this._tileManager.onTileTreeChange(e),Promise.resolve(j)}async onElevationChange(e){return j}async onLayerViewOpacityChange(e){const{_context:t,_renderer:r}=this;if(t.layerViewInfo.fullOpacity=e,null==r)return j;const a=await r.createUpdateLayerViewOpacityCommand(e);return await a.execute(),j}async onRendererChange(r){const{_context:a}=this,n=a.symbolRendererFactory.createSymbolRendererFromJSON(r);await n.load();const i=this._renderer;this._renderer=n;const s=[...this._tileManager.loadedTiles()],o=s.map(e=>e.tileId);{const r={stack:[],error:void 0,hasError:!1};try{e(r,await this._tileLocks.lock(o),!1);const t=s.flatMap(e=>[i.createRemoveCommand(e.id),n.createAddCommand(e)]),l=await Promise.all(t),c=a.joinPipelineCommands(l);await c.execute()}catch(c){r.error=c,r.hasError=!0}finally{t(r)}}const l=await i.createDestroyCommand();return await l.execute(),j}async _createAddFeatureDataCommand(e,t){const r=this._featureStore,a=this._renderer;let i;return i=null!=a?await a.createAddCommand(e):f.create(this._renderCommandContext),n(t),i.appendPipelineStateCommand(()=>{r.addTile(e)}),i}async _createRemoveFeatureDataCommand(e){const t=this._featureStore,r=this._renderer;let a;return a=null!=r?await r.createRemoveCommand(e):f.create(this._renderCommandContext),a.appendPipelineStateCommand(()=>{t.removeTile(e)}),a}async _createUpdateFeatureDataVisibilityCommand(e,t){const r=this._renderer;let a;return a=null!=r?await r.createUpdateVisibilityCommand(e):f.create(this._renderCommandContext),n(t),a}_ensureQuery(e){return e??this._defaultQueryJSON}};r([o()],R.prototype,"updating",null),R=r([l("esri.views.3d.layers.graphics.pipeline.Feature3DPipelineWorker")],R);const S=R,j={result:void 0};export{S as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import r from"../../../../../core/Error.js";import{EsriPromise as t}from"../../../../../core/Promise.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as
|
|
5
|
+
import{__decorate as e}from"tslib";import r from"../../../../../core/Error.js";import{EsriPromise as t}from"../../../../../core/Promise.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators/subclass.js";import{WorkerHandle as i}from"../../../../../core/workers/WorkerHandle.js";import a from"../../../../../geometry/Extent.js";import{clone as s}from"../../../../../geometry/support/aaBoundingRect.js";import{isFeatureGraphicOrigin as d}from"../../../../../graphic/isFeatureGraphicOrigin.js";import c from"../../../../../rest/support/AttributeBinsFeatureSet.js";import l from"../../../../../rest/support/FeatureSet.js";import{ElevationContext as u}from"../ElevationContext.js";import{applyElevationAlignment as p}from"./utils.js";let y=class extends t{constructor(e){super(e),this.schedule=null,this._workerUpdating=!0}get updating(){return this._workerUpdating}get _graphicOrigin(){const e=this.layer.graphicOrigin;if(!d(e))throw new r("featurelayerview3d:invalid-graphic-origin","Layer's graphic origin is not a FeatureGraphicOrigin");return e}initialize(){const{layer:e,layerView:r,viewSpatialReference:t,renderSpatialReference:o}=this,n=e.elevationInfo;this._elevationContext=u.fromElevationInfo(n),this._workerHandle=new h(this.schedule,{createTexture:async({data:e,parameters:r})=>({result:await this.renderer.createTexture(e,r),transferList:[]}),releaseTexture:async({uid:e})=>(await this.renderer.releaseTexture(e),w),createMaterial:async({materialJSON:e})=>(await this.renderer.createMaterial(e),w),destroyMaterial:async({materialId:e})=>(await this.renderer.destroyMaterial(e),w),createDirectRenderer:async({materialId:e})=>(await this.renderer.createDirectRenderer(e),w),destroyDirectRenderer:async({materialId:e})=>(await this.renderer.destroyDirectRenderer(e),w),createLoDRenderer:async({rendererId:e,lodRenderGeometry:r},t)=>(await this.renderer.createLoDRenderer(e,r,t?.signal??void 0),w),destroyLoDRenderer:async({rendererId:e},r)=>(await this.renderer.destroyLoDRenderer(e,r?.signal??void 0),w),dispatchRenderCommands:async({commands:e})=>(await this.renderer.executeRenderCommands(e),w),applyElevationAlignment:async({mapPoints:e})=>{const{viewSpatialReference:r,elevationProvider:t,renderCoordsHelper:o}=this,n=p(e,r,this._elevationContext,t,o);return{result:n,transferList:[n.buffer]}},setBaseInstance:async({rendererId:e,baseInstance:r})=>(this.renderer.setBaseInstance(e,r),w)}),this.addResolvingPromise((async()=>{await e.load();const i={url:e.parsedUrl?.path??"",baseQuery:e.createQuery().toJSON(),objectIdField:e.objectIdField,capabilities:e.capabilities,fieldIndex:e.fieldsIndex.toJSON(),timeInfo:e.timeInfo?.toJSON(),elevationInfo:n?.toJSON(),fullExtent:e.fullExtent?.toJSON(),renderer:e.renderer?.toJSON()},a={fullOpacity:r.fullOpacity};await this._workerHandle.invokeMethod("setup",{viewSpatialReference:t.toJSON(),renderSpatialReference:o.toJSON(),viewingMode:this.viewingMode,layerInfo:i,layerViewInfo:a})})()),this.addHandles(this._workerHandle.on("notify-updating",({updating:e})=>{this._workerUpdating=e}))}onTileTreeChange(e){this._workerHandle.invokeMethod("onTileTreeChange",{tiles:e.items.map(m)})}onElevationChange(e){this._workerHandle.invokeMethod("onElevationChange",{context:e.context,spatialReference:e.spatialReference?.toJSON(),extent:s(e.extent)})}onLayerViewOpacityChange(e){this._workerHandle.invokeMethod("onLayerViewOpacityChange",e)}onRendererChange(e){const r=e?.toJSON();this._workerHandle.invokeMethod("onRendererChange",r)}async executeQuery(e,r){const t=await this._workerHandle.invokeMethod("executeQuery",e?.toJSON(),r),o=l.fromJSON(t);return this._ensureLayerOnFeatures(o),o}async executeQueryForIds(e,r){return await this._workerHandle.invokeMethod("executeQueryForIds",e?.toJSON(),r)}async executeQueryForCount(e,r){return await this._workerHandle.invokeMethod("executeQueryForCount",e?.toJSON(),r)}async executeQueryForExtent(e,r){const{count:t,extent:o}=await this._workerHandle.invokeMethod("executeQueryForExtent",e?.toJSON(),r);return{count:t,extent:a.fromJSON(o)}}async executeQueryForLatestObservations(e,r){const t=await this._workerHandle.invokeMethod("executeQueryForLatestObservations",e?.toJSON(),r),o=l.fromJSON(t);return this._ensureLayerOnFeatures(o),o}async executeAttributeBinsQuery(e,r){const t=await this._workerHandle.invokeMethod("executeAttributeBinsQuery",e.toJSON(),r);return c.fromJSON(t)}_ensureLayerOnFeatures(e){const{layer:r,_graphicOrigin:t}=this;for(const o of e.features)o.layer=r,o.sourceLayer=r,o.origin=t}};e([o()],y.prototype,"updating",null),e([o({constructOnly:!0})],y.prototype,"schedule",void 0),e([o({constructOnly:!0})],y.prototype,"layer",void 0),e([o({constructOnly:!0})],y.prototype,"layerView",void 0),e([o({constructOnly:!0})],y.prototype,"viewSpatialReference",void 0),e([o({constructOnly:!0})],y.prototype,"renderSpatialReference",void 0),e([o({constructOnly:!0})],y.prototype,"viewingMode",void 0),e([o({constructOnly:!0})],y.prototype,"renderer",void 0),e([o({constructOnly:!0})],y.prototype,"elevationProvider",void 0),e([o({constructOnly:!0})],y.prototype,"renderCoordsHelper",void 0),e([o()],y.prototype,"_workerUpdating",void 0),e([o()],y.prototype,"_graphicOrigin",null),y=e([n("esri.views.3d.layers.graphics.pipeline.Feature3DPipelineWorkerHandle")],y);class h extends i{constructor(e,r){super("Feature3DPipelineWorker","setup",{},e,{strategy:"dedicated",client:r})}}function m({id:e,lij:r,extent:t}){return{id:e,lij:r,extent:t}}const w={result:void 0};export{y as Feature3DPipelineWorkerHandle};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{nullUid as t}from"../../../../../../core/uid.js";import{property as r}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/has.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import{subclass as
|
|
5
|
+
import{__decorate as e}from"tslib";import{nullUid as t}from"../../../../../../core/uid.js";import{property as r}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/has.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{glLayout as i}from"../../../../support/buffer/glUtil.js";import{SyncRenderPlugin as n}from"../../../../webgl-engine/effects/RenderPlugin.js";import{GLMaterials as o}from"../../../../webgl-engine/lib/GLMaterials.js";import{BoundingVolume as a}from"../../../../webgl-engine/lib/Object3D.js";import{VertexArrayObject as l}from"../../../../webgl-engine/lib/VertexArrayObject.js";import{DrawParameters as u}from"../../../../webgl-engine/materials/DrawParameters.js";import{HUDMaterial as c}from"../../../../webgl-engine/materials/HUDMaterial.js";import{bindVertexBufferLayout as m}from"../../../../../webgl/Util.js";import{VertexBuffer as d}from"../../../../../webgl/VertexBuffer.js";let f=class extends n{constructor(e){super(e),this._glMaterials=null,this._produces=new Map,this._renderGeometries=new Map,this._renderContext=null,this._drawParameters=new u,this._bufferWriter=null,this._baseInstance=null,this.slicePlaneEnabled=!1,this.isGround=!1,this.type=e.material instanceof c?1:4,this.layerViewUid=e.layerViewUid}get produces(){return this._produces}get numFeatures(){let e=0;return this._renderGeometries.forEach(t=>e+=t.numElements),e}get usedMemory(){let e=0;return this._renderGeometries.forEach(t=>{e+=t.vao.usedMemory}),e}intersect(e,r,s,i){const{material:n,_bufferWriter:o,layerViewUid:l,_renderGeometries:u}=this;null!=o.intersect&&u.forEach(({buffer:r,localOrigin:u,items:c})=>o.intersect(r.data,n.parameters,u,e,s,i,(r,s,i,o)=>{if(!c.visibilities[i])return;const u=c.objectIds[i];e.handleObjectIntersection({object:{id:t,graphicUid:u,layerViewUid:l,boundingVolumeWorldSpace:new a,geometries:[{material:n}]},geometryId:0,primitiveIndex:i},r,s,null,o)}))}initialize(){this._bufferWriter=this.material.createBufferWriter(),this.material.produces.forEach((e,t)=>{this._produces.set(t,t=>9!==t&&5!==t&&e(t))})}destroy(){this._glMaterials.dispose();const e=this._renderGeometries.keys();for(const t of e)this.removeRenderGeometryBuffer(t);this._baseInstance?.vbo.dispose(),this._baseInstance=null}acquireTechniques(e){const t=this.material;if(!t.shouldRender(e))return null;const{output:r,bind:s}=e,i=t.produces.get(s.slot);if(!i?.(r))return null;if(9===r||5===r)return null;const n=this._glMaterials.load(e.rctx,s.slot,r);return n?.beginSlot(s)}render(e,t){const r=this._renderGeometries;if(0===r.size)return;const{bind:s}=e,i=10===s.slot||11===s.slot?s.slot:null,n=e.rctx;n.runAppleAmdDriverHelper(),n.bindTechnique(t,s,this.material.parameters);const o=t.program,{_baseInstance:a}=this,l=null==a?e=>{n.drawArrays(t.primitiveType,e.start,e.count)}:(e,r)=>{m(n,r.locations,r.buffer("instances"),e.start),n.drawArraysInstanced(t.primitiveType,0,a.buffer.elementCount,e.count)};for(const[u,c]of r){const{vao:e,localOrigin:r,drawCalls:a}=c;this._drawParameters.origin=r,o.bindDraw(s,this.material.parameters,this._drawParameters),t.ensureAttributeLocations(e),n.bindVAO(e),n.setPipelineState(t.getPipeline(!1,i));for(const t of a)l(t,e)}}initializeRenderContext(e){this._glMaterials=new o(this.material,e.materials),this._renderContext=e.renderContext}uninitializeRenderContext(){}addRenderGeometryBuffer(e,t,r,s){this.removeRenderGeometryBuffer(e);const{data:n,elementCount:o}=t,{_baseInstance:a,_bufferWriter:u,_renderContext:{rctx:c}}=this,m=null==a?u.layout:u.instanceLayout;if(!m)throw new Error("Cannot create instance buffer for non-instanced material");const f=new d(c,i(m,null==a?0:1),n);let h;h=new l(c,null==a?new Map([["geometry",f]]):new Map([["geometry",a.vbo],["instances",f]]));const p={localOrigin:s,numElements:o,buffer:t,items:r,vao:h,drawCalls:this._produceDrawCalls(r)};this._renderGeometries.set(e,p)}updateRenderGeometryBuffer(e,t,r,s){const{data:i,elementCount:n}=t,o=this._renderGeometries.get(e);if(null==o)return;const a=o.vao.buffer(null==this._baseInstance?"geometry":"instances");a?.setSize(i.byteLength),a?.setSubData(new Uint8Array(i),0,0,i.byteLength),o.localOrigin=s,o.numElements=n,o.buffer=t,o.items=r,o.drawCalls=this._produceDrawCalls(r)}removeRenderGeometryBuffer(e){const t=this._renderGeometries.get(e);null!=t&&(this._baseInstance?(t.vao.buffer("instances")?.dispose(),t.vao.disposeVAOOnly()):t.vao.dispose(),this._renderGeometries.delete(e))}updateVisibility(e,t){const r=this._renderGeometries.get(e);if(null==r)return;const{items:s}=r;if(s.visibilities.length!==t.length)throw new Error("Unexpected mismatch between old and new visibility flag buffer length.");s.visibilities=t,r.drawCalls=this._produceDrawCalls(s)}setBaseInstance(e){if(this._baseInstance?.vbo.dispose(),null==e)return void(this._baseInstance=null);const{data:t}=e,r=new d(this._renderContext.rctx,i(this._bufferWriter.layout),t);this._baseInstance={buffer:e,vbo:r}}hasHighlight(){return!1}_produceDrawCalls(e){const{visibilities:t,ranges:r}=e,s=[];if(h(r)){if(0===r.numItems)return[];const e=r.numVertices;let i=null;for(let n=0;n<r.numItems;++n){t[n]?null==i?(i={start:n*e,count:e},s.push(i)):i.count+=e:i=null}}else{const e=r.counts,i=e.length;if(0===i)return[];let n=null,o=0;for(let r=0;r<i;++r){const i=t[r],a=e[r];i?null==n?(n={start:o,count:a},s.push(n)):n.count+=a:n=null,o+=a}}return s}};function h(e){return"numItems"in e}e([r({constructOnly:!0})],f.prototype,"material",void 0),f=e([s("esri.views.3d.layers.graphics.pipeline.rendering.DirectRenderer")],f);export{f as DirectRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import r from"../../../../../../core/Accessor.js";import"../../../../../../core/has.js";import{createAbortError as t}from"../../../../../../core/promiseUtils.js";import{property as s}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import{subclass as i}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{ONES as d}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as a}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{DirectRenderer as n}from"./DirectRenderer.js";import{LodRenderer as o}from"./LodRenderer.js";import{Texture as l}from"../../../../webgl-engine/lib/Texture.js";import{DefaultMaterial as c}from"../../../../webgl-engine/materials/DefaultMaterial.js";import{HUDMaterial as u}from"../../../../webgl-engine/materials/HUDMaterial.js";import{schematicMRRFactors as m}from"../../../../webgl-engine/materials/pbrUtils.js";let h=class extends r{constructor(e){super(),this.view=null,this.layerViewUid=null,this._stage=null,this._materials=new Map,this._textures=new Map,this._directRenderers=new Map,this._lodRenderers=new Map,this.totalFeatures=0,this.view=e.view,this.layerViewUid=e.layerViewUid}initialize(){this._stage=this.view.stage}destroy(){this.removeAllHandles(),this._lodRenderers.forEach(e=>e.destroy())}async createTexture(e,r){const{_textures:t,_stage:s}=this,i=new l(e,r);return t.set(i.id,i),s&&(i.load(s.renderView.renderingContext),s.addTexture(i)),i.id}async releaseTexture(e){const{_textures:r,_stage:t}=this,s=r.get(e);s&&(t&&(s.unload(),t.removeTexture(s)),r.delete(e))}_destroyTexture(e){const{_textures:r,_stage:t}=this,s=r.get(e);s&&(t&&(s.unload(),t.removeTexture(s)),r.delete(e))}async createMaterial(e){const{view:r}=this,t=1===r.state.viewingMode;let s=null;switch(e.type){case"default":{const r=e.parameters,i=new c(r,{spherical:t});i.setParameters({cullFace:i.transparent?0:2}),s=i;break}case"hud":{const r=e.parameters;s=new u(r,t)}}this._materials.set(e.materialId,s)}async destroyMaterial(e){this._materials.delete(e)}async updateMaterial(e){}async createDirectRenderer(e){if(this._directRenderers.has(e))return;const r=this._materials.get(e);if(null==r)throw new Error(`material not found ${e}`);const{view:t}=this,s=new n({material:r,layerViewUid:this.layerViewUid});this._directRenderers.set(e,s),t.stage.addRenderPlugin(s),t.stage.renderView.renderer.updateHasFlags()}async destroyDirectRenderer(e){const r=this._directRenderers.get(e);if(null==r)return;const t=this.view;t.stage.removeRenderPlugin(r),this._directRenderers.delete(e),t.stage.renderView.renderer.updateHasFlags()}async createLoDRenderer(e,r,s){const i=new o({view:this.view,layerViewUid:this.layerViewUid}),d=e=>this._materials.get(e);if(await i.doLoad(r,d,s),s?.aborted)throw i.destroy(),t();this._lodRenderers.set(e,i)}async destroyLoDRenderer(e,r){const t=this._lodRenderers.get(e);null!=t&&(t.destroy(),this._lodRenderers.delete(e))}_destroyLodRenderer({rendererId:e}){const r=this._lodRenderers.get(e);null!=r&&(r.destroy(),this._lodRenderers.delete(e))}async executeRenderCommands(e){for(const r of e)switch(r.id){case"destroy-texture":this._destroyTexture(r.textureId);break;case"update-material":this._updateMaterial(r);break;case"destroy-material":this._destroyMaterial(r);break;case"add-direct-renderer-geometry-buffer":this._addDirectRendererGeometryBuffer(r);break;case"update-direct-renderer-geometry-buffer":this._updateDirectRendererGeometryBuffer(r);break;case"remove-direct-renderer-geometry-buffer":this._removeDirectRendererGeometryBuffer(r);break;case"destroy-lod-renderer":this._destroyLodRenderer(r);break;case"add-lod-instances":this._addLodInstances(r);break;case"remove-lod-instances":this._removeLodInstances(r);break;case"update-lod-instance-data":this._updateLodInstanceData(r);break;case"update-visibility":this._updateVisibility(r)}e.length>0&&this._updateFeatureCount()}_updateFeatureCount(){let e=0;for(const r of this._directRenderers.values())e+=r.numFeatures;for(const r of this._lodRenderers.values())e+=r.numFeatures;this._set("totalFeatures",e)}get usedMemory(){let e=0;for(const r of this._directRenderers.values())e+=r.usedMemory;for(const r of this._lodRenderers.values())e+=r.usedMemory;return e}_updateMaterial({materialId:e,parameters:r}){const t=this._materials.get(e);null!=t?t.setParameters(r):console.error("material not found")}_destroyMaterial({materialId:e}){null!=this._materials.get(e)?this._materials.delete(e):console.error("material not found")}_addDirectRendererGeometryBuffer({groupId:e,rendererId:r,renderGeometryBuffer:t,renderGeometryBufferItems:s,localOrigin:i}){const d=this._directRenderers.get(r);null!=d?(d.addRenderGeometryBuffer(e,t,s,i),this.view.stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_updateDirectRendererGeometryBuffer({groupId:e,rendererId:r,renderGeometryBuffer:t,renderGeometryBufferItems:s,localOrigin:i}){const d=this._directRenderers.get(r);null!=d?(d.updateRenderGeometryBuffer(e,t,s,i),this.view.stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_removeDirectRendererGeometryBuffer({groupId:e,rendererId:r}){const t=this._directRenderers.get(r);null!=t?(t.removeRenderGeometryBuffer(e),this.view.stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_addLodInstances({rendererId:e,groupId:r,data:t}){const s=this._lodRenderers.get(e);if(null==s)throw new Error("no lod renderer assigned to provided lod renderer Id");s.addInstances(r,t),this.view.stage.renderView.requestRender()}_removeLodInstances({rendererId:e,groupId:r}){const t=this._lodRenderers.get(e);if(null==t)throw new Error("no lod renderer assigned to provided lod renderer Id");t.removeInstances(r),this.view.stage.renderView.requestRender()}_updateLodInstanceData({rendererId:e,groupId:r,globalTransforms:t}){const s=this._lodRenderers.get(e);if(null==s)throw new Error("No renderer found with the provided id");null!=t&&s.updateGlobalTransforms(r,t),this.view.stage.renderView.requestRender()}_updateVisibility({rendererId:e,groupId:r,visibility:t}){const s=this._directRenderers.get(e)??this._lodRenderers.get(e);if(null==s)throw new Error("No renderer found with the provided id");s.updateVisibility(r,t),this.view.stage.renderView.requestRender()}};function
|
|
5
|
+
import{__decorate as e}from"tslib";import r from"../../../../../../core/Accessor.js";import"../../../../../../core/has.js";import{createAbortError as t}from"../../../../../../core/promiseUtils.js";import{property as s}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import{subclass as i}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{ONES as d}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as a}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{DirectRenderer as n}from"./DirectRenderer.js";import{LodRenderer as o}from"./LodRenderer.js";import{Texture as l}from"../../../../webgl-engine/lib/Texture.js";import{DefaultMaterial as c}from"../../../../webgl-engine/materials/DefaultMaterial.js";import{HUDMaterial as u}from"../../../../webgl-engine/materials/HUDMaterial.js";import{schematicMRRFactors as m}from"../../../../webgl-engine/materials/pbrUtils.js";let h=class extends r{constructor(e){super(),this.view=null,this.layerViewUid=null,this._stage=null,this._materials=new Map,this._textures=new Map,this._directRenderers=new Map,this._lodRenderers=new Map,this.totalFeatures=0,this.view=e.view,this.layerViewUid=e.layerViewUid}initialize(){this._stage=this.view.stage}destroy(){this.removeAllHandles(),this._lodRenderers.forEach(e=>e.destroy())}async createTexture(e,r){const{_textures:t,_stage:s}=this,i=new l(e,r);return t.set(i.id,i),s&&(i.load(s.renderView.renderingContext),s.addTexture(i)),i.id}async releaseTexture(e){const{_textures:r,_stage:t}=this,s=r.get(e);s&&(t&&(s.unload(),t.removeTexture(s)),r.delete(e))}_destroyTexture(e){const{_textures:r,_stage:t}=this,s=r.get(e);s&&(t&&(s.unload(),t.removeTexture(s)),r.delete(e))}async createMaterial(e){const{view:r}=this,t=1===r.state.viewingMode;let s=null;switch(e.type){case"default":{const r=e.parameters,i=new c(r,{spherical:t});i.setParameters({cullFace:i.transparent?0:2}),s=i;break}case"hud":{const r=e.parameters;s=new u(r,t)}}this._materials.set(e.materialId,s)}async destroyMaterial(e){this._materials.delete(e)}async updateMaterial(e){}async createDirectRenderer(e){if(this._directRenderers.has(e))return;const r=this._materials.get(e);if(null==r)throw new Error(`material not found ${e}`);const{view:t}=this,s=new n({material:r,layerViewUid:this.layerViewUid});this._directRenderers.set(e,s),t.stage.addRenderPlugin(s),t.stage.renderView.renderer.updateHasFlags()}setBaseInstance(e,r){const t=this._directRenderers.get(e);if(null==t)throw new Error(`renderer not found ${e}`);t.setBaseInstance(r)}async destroyDirectRenderer(e){const r=this._directRenderers.get(e);if(null==r)return;const t=this.view;t.stage.removeRenderPlugin(r),this._directRenderers.delete(e),t.stage.renderView.renderer.updateHasFlags()}async createLoDRenderer(e,r,s){const i=new o({view:this.view,layerViewUid:this.layerViewUid}),d=e=>this._materials.get(e);if(await i.doLoad(r,d,s),s?.aborted)throw i.destroy(),t();this._lodRenderers.set(e,i)}async destroyLoDRenderer(e,r){const t=this._lodRenderers.get(e);null!=t&&(t.destroy(),this._lodRenderers.delete(e))}_destroyLodRenderer({rendererId:e}){const r=this._lodRenderers.get(e);null!=r&&(r.destroy(),this._lodRenderers.delete(e))}async executeRenderCommands(e){for(const r of e)switch(r.id){case"destroy-texture":this._destroyTexture(r.textureId);break;case"update-material":this._updateMaterial(r);break;case"destroy-material":this._destroyMaterial(r);break;case"add-direct-renderer-geometry-buffer":this._addDirectRendererGeometryBuffer(r);break;case"update-direct-renderer-geometry-buffer":this._updateDirectRendererGeometryBuffer(r);break;case"remove-direct-renderer-geometry-buffer":this._removeDirectRendererGeometryBuffer(r);break;case"destroy-lod-renderer":this._destroyLodRenderer(r);break;case"add-lod-instances":this._addLodInstances(r);break;case"remove-lod-instances":this._removeLodInstances(r);break;case"update-lod-instance-data":this._updateLodInstanceData(r);break;case"update-visibility":this._updateVisibility(r)}e.length>0&&this._updateFeatureCount()}_updateFeatureCount(){let e=0;for(const r of this._directRenderers.values())e+=r.numFeatures;for(const r of this._lodRenderers.values())e+=r.numFeatures;this._set("totalFeatures",e)}get usedMemory(){let e=0;for(const r of this._directRenderers.values())e+=r.usedMemory;for(const r of this._lodRenderers.values())e+=r.usedMemory;return e}_updateMaterial({materialId:e,parameters:r}){const t=this._materials.get(e);null!=t?t.setParameters(r):console.error("material not found")}_destroyMaterial({materialId:e}){null!=this._materials.get(e)?this._materials.delete(e):console.error("material not found")}_addDirectRendererGeometryBuffer({groupId:e,rendererId:r,renderGeometryBuffer:t,renderGeometryBufferItems:s,localOrigin:i}){const d=this._directRenderers.get(r);null!=d?(d.addRenderGeometryBuffer(e,t,s,i),this.view.stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_updateDirectRendererGeometryBuffer({groupId:e,rendererId:r,renderGeometryBuffer:t,renderGeometryBufferItems:s,localOrigin:i}){const d=this._directRenderers.get(r);null!=d?(d.updateRenderGeometryBuffer(e,t,s,i),this.view.stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_removeDirectRendererGeometryBuffer({groupId:e,rendererId:r}){const t=this._directRenderers.get(r);null!=t?(t.removeRenderGeometryBuffer(e),this.view.stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_addLodInstances({rendererId:e,groupId:r,data:t}){const s=this._lodRenderers.get(e);if(null==s)throw new Error("no lod renderer assigned to provided lod renderer Id");s.addInstances(r,t),this.view.stage.renderView.requestRender()}_removeLodInstances({rendererId:e,groupId:r}){const t=this._lodRenderers.get(e);if(null==t)throw new Error("no lod renderer assigned to provided lod renderer Id");t.removeInstances(r),this.view.stage.renderView.requestRender()}_updateLodInstanceData({rendererId:e,groupId:r,globalTransforms:t}){const s=this._lodRenderers.get(e);if(null==s)throw new Error("No renderer found with the provided id");null!=t&&s.updateGlobalTransforms(r,t),this.view.stage.renderView.requestRender()}_updateVisibility({rendererId:e,groupId:r,visibility:t}){const s=this._directRenderers.get(e)??this._lodRenderers.get(e);if(null==s)throw new Error("No renderer found with the provided id");s.updateVisibility(r,t),this.view.stage.renderView.requestRender()}};function f(e,r,t){const s={usePBR:r.physicalBasedRenderingEnabled,isSchematic:!0,mrrFactors:m,ambient:d,diffuse:d,hasSlicePlane:r.slicePlaneEnabled,castShadows:r.castShadows,offsetTransparentBackfaces:!r.isPrimitive};r.screenSizePerspectiveEnabled&&(s.screenSizePerspective=e.screenSizePerspective.parameters),s.externalColor=a,s.instanced=!0;const i=new c(s,{spherical:t});return i.setParameters({cullFace:i.transparent?0:2}),i}e([s({readOnly:!0})],h.prototype,"totalFeatures",void 0),h=e([i("esri.views.3d.layers.graphics.pipeline.rendering.FeaturePipelineRenderManager")],h);export{h as FeaturePipelineRenderManager,f as createDefaultMaterial};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{copy as e,invert as r,transpose as t}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{getContinuousIndexArray as a}from"../../../../../../geometry/support/Indices.js";import{PipelineCommand as i}from"../PipelineCommand.js";import{generateId as s}from"../utils.js";import{BoundingInfo as o}from"../../../../webgl-engine/lib/BoundingInfo.js";import{DefaultMaterial as d}from"../../../../webgl-engine/materials/DefaultMaterial.js";import{HUDMaterial as m}from"../../../../webgl-engine/materials/HUDMaterial.js";class f{constructor(e,r){this._mainThreadDelegate=r,this._bufferWriters=new Map,this.globalViewingMode=1===e}createRenderCommandBuffer(e=[],r=[]){return{commands:e,transferList:r}}mergeRenderCommandBuffers(e){const r=this.createRenderCommandBuffer();for(const t of e)null!=t&&(r.commands.push(...t.commands),r.transferList.push(...t.transferList));return r}async createTexture(e){const{data:r,parameters:t}=e();return await this._mainThreadDelegate.createTexture(r,t)}async releaseTexture(e){const r=this._destroyTexture(e);return new i(this,r,[])}_destroyTexture(e){return{commands:[{id:"destroy-texture",textureId:e}],transferList:[]}}async createMaterial(e){const{type:r,parameters:t}=e,n=s("material");let a,i;switch(r){case"default":a=new d(e.parameters,{spherical:this.globalViewingMode}),i={type:r,materialId:n,parameters:e.parameters};break;case"hud":a=new m(t,this.globalViewingMode),i={type:r,materialId:n,parameters:e.parameters}}return this._bufferWriters.set(n,a.createBufferWriter()),await this._mainThreadDelegate.createMaterial(i),n}destroyMaterial(e){return{commands:[{id:"destroy-material",materialId:e}],transferList:[]}}updateMaterial(e){return{commands:[{...e,id:"update-material"}],transferList:[]}}async createDirectRenderer(e){return await this._mainThreadDelegate.createDirectRenderer(e),e}async destroyDirectRenderer(e){await this._mainThreadDelegate.destroyDirectRenderer(e)}addDirectRendererGeometry(e,r,t){const{materialId:
|
|
5
|
+
import{copy as e,invert as r,transpose as t}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{getContinuousIndexArray as a}from"../../../../../../geometry/support/Indices.js";import{PipelineCommand as i}from"../PipelineCommand.js";import{generateId as s}from"../utils.js";import{BoundingInfo as o}from"../../../../webgl-engine/lib/BoundingInfo.js";import{DefaultMaterial as d}from"../../../../webgl-engine/materials/DefaultMaterial.js";import{HUDMaterial as m}from"../../../../webgl-engine/materials/HUDMaterial.js";class f{constructor(e,r){this._mainThreadDelegate=r,this._bufferWriters=new Map,this.globalViewingMode=1===e}createRenderCommandBuffer(e=[],r=[]){return{commands:e,transferList:r}}mergeRenderCommandBuffers(e){const r=this.createRenderCommandBuffer();for(const t of e)null!=t&&(r.commands.push(...t.commands),r.transferList.push(...t.transferList));return r}async createTexture(e){const{data:r,parameters:t}=e();return await this._mainThreadDelegate.createTexture(r,t)}async releaseTexture(e){const r=this._destroyTexture(e);return new i(this,r,[])}_destroyTexture(e){return{commands:[{id:"destroy-texture",textureId:e}],transferList:[]}}async createMaterial(e){const{type:r,parameters:t}=e,n=s("material");let a,i;switch(r){case"default":a=new d(e.parameters,{spherical:this.globalViewingMode}),i={type:r,materialId:n,parameters:e.parameters};break;case"hud":a=new m(t,this.globalViewingMode),i={type:r,materialId:n,parameters:e.parameters}}return this._bufferWriters.set(n,a.createBufferWriter()),await this._mainThreadDelegate.createMaterial(i),n}destroyMaterial(e){return{commands:[{id:"destroy-material",materialId:e}],transferList:[]}}updateMaterial(e){return{commands:[{...e,id:"update-material"}],transferList:[]}}async createDirectRenderer(e){return await this._mainThreadDelegate.createDirectRenderer(e),e}async destroyDirectRenderer(e){await this._mainThreadDelegate.destroyDirectRenderer(e)}addDirectRendererGeometry(e,r,t,n){const{materialId:a}=r;if(null==this._bufferWriters.get(a))throw new Error(`no bufferwriter found for material ${a}`);const{renderGeometryBuffer:i,renderGeometryBufferItems:s}=this.createRenderGeometryBuffer(r,t,n);return this.addDirectRendererGeometryBuffer(a,e,i,s,t)}updateDirectRendererGeometry(e,r,t,n){const{materialId:a}=r;if(null==this._bufferWriters.get(a))throw new Error(`no bufferwriter found for material ${a}`);const{renderGeometryBuffer:i,renderGeometryBufferItems:s}=this.createRenderGeometryBuffer(r,t,n);return this.updateDirectRendererGeometryBuffer(a,e,i,s,t)}addDirectRendererGeometryBuffer(e,r,t,n,a){const{objectIds:i,visibilities:s}=n;return{commands:[{id:"add-direct-renderer-geometry-buffer",rendererId:e,groupId:r,renderGeometryBuffer:t,renderGeometryBufferItems:n,localOrigin:a}],transferList:[t.data,i.buffer,s.buffer]}}updateDirectRendererGeometryBuffer(e,r,t,n,a){const{objectIds:i,visibilities:s}=n;return{commands:[{id:"update-direct-renderer-geometry-buffer",rendererId:e,groupId:r,renderGeometryBuffer:t,renderGeometryBufferItems:n,localOrigin:a}],transferList:[t.data,i.buffer,s.buffer]}}removeDirectRendererGeometryBuffer(e,r){return{commands:[{id:"remove-direct-renderer-geometry-buffer",rendererId:e,groupId:r}],transferList:[]}}async createLodRenderer(e){const r=s("lod-renderer"),t=new Set,n={levels:e.levels.map(e=>({components:e.components.map(e=>{const r=e.attributes.get("position");if(!r||0===r.indices.length)throw new Error("positions attribute expected");const n=3,i=a(r.indices.length/n),s=new o(i,n,r);if(null==this._bufferWriters.get(e.materialId))throw new Error("writer not found");const{renderGeometryBuffer:d}=this.createRenderGeometryBuffer(e,null);t.add(d.data);return{materialId:e.materialId,renderGeometryBuffer:d,boundingInfo:{bbMax:s.bbMax,bbMin:s.bbMin}}}),minScreenSpaceRadius:e.minScreenSpaceRadius}))};return await this._mainThreadDelegate.createLodRenderer(r,n,Array.from(t)),r}destroyLodRenderer(e){return{commands:[{id:"destroy-lod-renderer",rendererId:e}],transferList:[]}}addLodInstances(e,r,t){return{commands:[{id:"add-lod-instances",rendererId:e,groupId:r,data:t}],transferList:[t.featureIds.buffer,t.globalTransforms.buffer,t.localTransforms.buffer,t.visibility.buffer]}}removeLodInstances(e,r){return{commands:[{id:"remove-lod-instances",rendererId:e,groupId:r}],transferList:[]}}updateLodInstancesData(e,r,t){return{commands:[{id:"update-lod-instance-data",rendererId:e,groupId:r,globalTransforms:t}],transferList:[t.buffer]}}updateVisibility(e,r,t){return{commands:[{id:"update-visibility",rendererId:e,groupId:r,visibility:t}],transferList:[t.buffer]}}async dispatchRenderCommands(e){0!==e.commands.length&&await this._mainThreadDelegate.executeRenderCommands(e)}createRenderGeometryBuffer(n,a,i){const{materialId:s,visibilities:o,objectIds:d}=n,m=this._bufferWriters.get(s);if(null==m)throw new Error("no registered bufferWriter for material found");let f=null;if(n.transformation&&a)e(u,n.transformation),u[12]-=a[0],u[13]-=a[1],u[14]-=a[2],f=u;else{if(a)throw new Error("not implemented");n.transformation&&(f=n.transformation)}let b=null;f&&(r(l,u),t(l,l),b=l);const y=n.attributes,h=m.elementCount(y),p=i?m.instanceLayout:m.layout;if(!p)throw new Error("Missing layout");const g=p.stride/4;h>Math.floor(c/g)&&console.warn("geometry with very large number of elements encountered");const I=p.createBuffer(h),w=0,B=m.write(f,b,y,n.olidColor,I,w);if(null==B)throw new Error("Bufferwriter.write does not provide item information.");if(o.length!==B.numItems||d.length!==B.numItems)throw new Error("Unexpected mismatch between number of RenderGeometryBufferItems and provided objectIds/visibility flags.");return{renderGeometryBuffer:{data:I.buffer,elementCount:h},renderGeometryBufferItems:{objectIds:d,visibilities:o,ranges:{numVertices:B.numVerticesPerItem,numItems:B.numItems}}}}async setBaseInstance(e,r){await this._mainThreadDelegate.setBaseInstance(e,r)}}const u=n(),l=n(),c=16777216/4;export{f as RenderCommandContext};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../../../Color.js";import{create as t}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as r}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as i}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{defaultPrimitive as n}from"../../../../../../symbols/support/IconSymbol3DLayerResource.js";import{mixinColorAndOpacity as o}from"../../graphicUtils.js";import{namedAnchorToHUDMaterialAnchorPos as a}from"../../placementUtils.js";import{PipelineCommand as l}from"../PipelineCommand.js";import{computeTileCenterRenderCoordinates as s,readObjectIds as m,readMapCoordinates as c,projectToRenderCoordinates as d}from"../featureData/processingUtils.js";import{inputAttributesToAttributesMap as u}from"./symbolizationUtils.js";import{createTextureInfo as y,requiresHalfTexelOffset as p,defaultBoundingBox as _}from"../../../../support/engineContent/sdfPrimitives.js";import{Attribute as C}from"../../../../webgl-engine/lib/Attribute.js";class h{constructor(e,t){this._context=null,this._symbolLayer=null,this._draped=!1,this._loaded=!1,this._loadingPromise=null,this._iconTextureID=null,this._materialId=null,this._context=t,this._symbolLayer=e}get loaded(){return this._loaded}load(){return null==this._loadingPromise&&(this._loadingPromise=this._load()),this._loadingPromise}_destroy(){this._iconTextureID=null}async _load(){const e=this._context.renderCommandContext,t=await e.createTexture(()=>y("circle"));this._iconTextureID=t;const r={anchorPosition:a.center,occlusionTest:!0,hasSlicePlane:!1,color:this._getFillColor(),outlineColor:this._getOutlineColor(),outlineSize:1,distanceFieldBoundingBox:_,textureId:t,textureIsSignedDistanceField:!0,sampleSignedDistanceFieldTexelCenter:p("circle")};this._materialId=await e.createMaterial({type:"hud",parameters:r}),await e.createDirectRenderer(this._materialId),this._loaded=!0}async createAddCommand(e){const{_materialId:t,_context:r}=this,{renderCommandContext:i}=r;if(null==t)throw new Error("expected material not to be null");const n=await this._createGeometry(e);if(null==n)return r.createPipelineCommand();const o=s(e,r);return r.createPipelineCommand(i.addDirectRendererGeometry(e.id,n,o))}async _createGeometry(e){const{_materialId:r,_context:i}=this,{mainThreadDelegate:n}=i,{featureCount:o}=e;if(0===o||null==r)return null;const a=m(e),l=c(e),s=await n.applyElevationAlignmentTo(l),y=d(s,i),p=new Float64Array([0,0,1]),_=new Float64Array([255,255,255,255]),h=new Float64Array([24,24]),f=new Float64Array([0,0,0,1]),g=new Float64Array([0
|
|
5
|
+
import e from"../../../../../../Color.js";import{create as t}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as r}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as i}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{defaultPrimitive as n}from"../../../../../../symbols/support/IconSymbol3DLayerResource.js";import{mixinColorAndOpacity as o}from"../../graphicUtils.js";import{namedAnchorToHUDMaterialAnchorPos as a}from"../../placementUtils.js";import{PipelineCommand as l}from"../PipelineCommand.js";import{computeTileCenterRenderCoordinates as s,readObjectIds as m,readMapCoordinates as c,projectToRenderCoordinates as d}from"../featureData/processingUtils.js";import{inputAttributesToAttributesMap as u}from"./symbolizationUtils.js";import{createTextureInfo as y,requiresHalfTexelOffset as p,defaultBoundingBox as _}from"../../../../support/engineContent/sdfPrimitives.js";import{Attribute as C}from"../../../../webgl-engine/lib/Attribute.js";class h{constructor(e,t){this._context=null,this._symbolLayer=null,this._draped=!1,this._loaded=!1,this._loadingPromise=null,this._iconTextureID=null,this._materialId=null,this._context=t,this._symbolLayer=e}get loaded(){return this._loaded}load(){return null==this._loadingPromise&&(this._loadingPromise=this._load()),this._loadingPromise}_destroy(){this._iconTextureID=null}async _load(){const e=this._context.renderCommandContext,t=await e.createTexture(()=>y("circle"));this._iconTextureID=t;const r={anchorPosition:a.center,occlusionTest:!0,hasSlicePlane:!1,color:this._getFillColor(),outlineColor:this._getOutlineColor(),outlineSize:1,distanceFieldBoundingBox:_,textureId:t,textureIsSignedDistanceField:!0,sampleSignedDistanceFieldTexelCenter:p("circle")},i=new Uint8Array(8),n=0,o=255;i[0]=n,i[1]=n,i[2]=n,i[3]=o,i[4]=o,i[5]=n,i[6]=o,i[7]=o,this._materialId=await e.createMaterial({type:"hud",parameters:r}),await e.createDirectRenderer(this._materialId),await e.setBaseInstance(this._materialId,{data:i.buffer,elementCount:4}),this._loaded=!0}async createAddCommand(e){const{_materialId:t,_context:r}=this,{renderCommandContext:i}=r;if(null==t)throw new Error("expected material not to be null");const n=await this._createGeometry(e);if(null==n)return r.createPipelineCommand();const o=s(e,r),a=!0;return r.createPipelineCommand(i.addDirectRendererGeometry(e.id,n,o,a))}async _createGeometry(e){const{_materialId:r,_context:i}=this,{mainThreadDelegate:n}=i,{featureCount:o}=e;if(0===o||null==r)return null;const a=m(e),l=c(e),s=await n.applyElevationAlignmentTo(l),y=d(s,i),p=new Float64Array([0,0,1]),_=new Float64Array([255,255,255,255]),h=new Float64Array([24,24]),f=new Float64Array([0,0,0,1]),g=new Float64Array([0]),x=new Uint32Array(o);for(let t=0;t<o;++t)x[t]=t;const w=new Uint32Array(o);for(let t=0;t<o;++t)w[t]=0;const b=[["position",new C(y,x,3,!0)],["normal",new C(p,w,3,!0)],["color",new C(_,w,4,!0)],["rotation",new C(g,w,1,!0)],["size",new C(h,w,2,!0)],["centerOffsetAndDistance",new C(f,w,4,!0)]],I=new Uint8Array(o);e.getVisibilityArray(I);return{attributes:u(b),olidColor:void 0,transformation:t(),materialId:r,objectIds:a,visibilities:I}}async createRemoveCommand(e){const{_materialId:t,_context:r}=this,i=r.renderCommandContext;return null==t?r.createPipelineCommand():r.createPipelineCommand(i.removeDirectRendererGeometryBuffer(t,e))}async createUpdateVisibilityCommand(e){const{_materialId:t,_context:r}=this,i=r.renderCommandContext;if(null==t)return r.createPipelineCommand();const n=new Uint8Array(e.featureCount);return e.getVisibilityArray(n),r.createPipelineCommand(i.updateVisibility(t,e.id,n))}async createUpdateLayerViewOpacityCommand(e){const{_context:t,_materialId:r}=this,i=t.renderCommandContext;return null==r?t.createPipelineCommand():t.createPipelineCommand(i.updateMaterial({type:"hud",materialId:r,parameters:{color:this._getFillColor(),outlineColor:this._getOutlineColor()}}))}async createUpdateElevationCommand(e){const{_materialId:t,_context:r}=this,{renderCommandContext:i}=r,{featureCount:n,id:o}=e;if(null==t||0===n)return r.createPipelineCommand();const a=await this._createGeometry(e);if(null==a)return r.createPipelineCommand();const l=s(e,r),m=!0;return r.createPipelineCommand(i.updateDirectRendererGeometry(o,a,l,m))}async createDestroyCommand(){const{_iconTextureID:e,_context:t}=this,r=t.renderCommandContext;let i;return i=null!=e?await r.releaseTexture(e):l.create(r),i.appendPipelineStateCommand(()=>this._destroy()),i}_getOutlineColor(){const t=this._getLayerOpacity(),r=this._symbolLayer,i=r?.outline?.color;if(null!=i){const r=e.toUnitRGB(i),n=i.a*t;return[r[0],r[1],r[2],n]}return[0,0,0,0]}_getFillColor(){if(f(this._getPrimitive()))return w;const e=null==this._getPrimitive(),t=this._symbolLayer?.material?.color;return this._getCombinedOpacityAndColor(t,{hasIntrinsicColor:e})}_getLayerOpacity(){return this._context.layerViewInfo.fullOpacity}_getCombinedOpacity(e,t=x){const r=this._draped?1:this._getLayerOpacity();return e?r*e.a:t.hasIntrinsicColor?r:0}_getCombinedOpacityAndColor(t,i=x){const n=this._getCombinedOpacity(t,i),a=null!=t?e.toUnitRGB(t):r;return o(a,n)}_getPrimitive(){return g(this._symbolLayer)}}function f(e){return null!=e&&("cross"===e||"x"===e)}function g(e){return e.resource?.href?null:e.resource?.primitive??n}const x={hasIntrinsicColor:!1},w=i;export{h as IconSymbolLayerRenderer,x as defaultMaterialOptions,g as getPrimitive,f as isOutlineOnly,w as transparentUnit};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{isSome as t}from"../../../../core/arrayUtils.js";import{makeHandle as r}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import i from"../../../../core/Logger.js";import{estimateAttributesMemory as a,estimateFixedArrayMemory as s,estimateNumberMemory as o}from"../../../../core/memoryEstimations.js";import{EsriPromise as n}from"../../../../core/Promise.js";import{initial as l,sync as p,watch as d}from"../../../../core/reactiveUtils.js";import{pt2px as u}from"../../../../core/screenUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as m}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as y}from"../../../../core/support/UpdatingHandles.js";import{projectPointToVector as _}from"../../../../geometry/projection/projectPointToVector.js";import{getContinuousIndexArray as g}from"../../../../geometry/support/Indices.js";import{getResolutionForScale as f}from"../../../../geometry/support/scaleUtils.js";import{getObjectId as R}from"../../../../layers/graphics/dehydratedFeatures.js";import{convertFromPoint as F}from"../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as v}from"../../../../layers/graphics/OptimizedFeature.js";import b from"../../../../layers/graphics/OptimizedGeometry.js";import w from"../../../../layers/graphics/data/FeatureStore.js";import{isNumericField as S}from"../../../../layers/support/fieldUtils.js";import{generateGradient as P}from"../../../../renderers/support/heatmapUtils.js";import{DisplayFeatureLimit as j}from"../graphics/DisplayFeatureLimit.js";import{GraphicsCorePerformanceInfo as G}from"../graphics/GraphicsCorePerformanceInfo.js";import{FeatureVisibilityFilter as V}from"./FeatureVisibilityFilter.js";import{emptyHighlightHandle as x}from"./highlightUtils.js";import{drapedZ as T}from"../../terrain/OverlayRenderer.js";import{Attribute as M}from"../../webgl-engine/lib/Attribute.js";import{DrapedHeatmapRenderer as A}from"../../webgl-engine/lib/DrapedHeatmapRenderer.js";import{Geometry as I}from"../../webgl-engine/lib/Geometry.js";import{RenderGeometry as N}from"../../webgl-engine/lib/RenderGeometry.js";import{HeatmapDensityMaterial as H}from"../../webgl-engine/materials/HeatmapDensityMaterial.js";import{scaleBoundsPredicate as O,isScaleRangeActive as U}from"../../../support/layerViewUtils.js";import{PixelType as L}from"../../../webgl/enums.js";import{loadHeatmapTextureConfiguration as C,fallBackHeatmapConfiguration as D}from"../../../webgl/heatmapTextureUtils.js";const E=112;let W=class extends n{constructor(e){super(e),this.type="heatmap",this.preferredUpdatePolicy=0,this.dataExtent=null,this.drapeSourceType=1,this._renderGeometries=new Map,this._fieldTotal=0,this._drapeSourceRenderer=null,this._dataType=L.HALF_FLOAT,this._pixelFormat=6408,this._updatingHandles=new y}initialize(){let e;try{e=C(this._renderView.renderingContext,i.getLogger(this))}catch(m){this.addResolvingPromise(Promise.reject(m)),e=D}const{dataType:t,samplingMode:a,pixelFormat:s,internalFormat:o}=e;this._featureStore=new w({geometryType:"esriGeometryPoint",hasZ:this.hasZ,hasM:this.hasM}),this._dataType=t,this._pixelFormat=s;const n=t!==L.FLOAT,u=this.view.basemapTerrain.overlayManager,h={...this._rendererParameters,stage:this.view.stage,dataType:t,samplingMode:a,pixelFormat:s,internalFormat:o,rendererContext:u.renderer,drapeSource:this};this._drapeSourceRenderer=new A(h),u.registerDrapeSource(this,this._drapeSourceRenderer),this._material=new H({usesHalfFloats:n}),this._materialWithField=new H({usesHalfFloats:n,isAttributeDriven:!0}),this._filterVisibility=new V({context:{configuration:this.owner,featureStore:this.featureStore,getFeatureCount:()=>this._loadedPointGraphics.length,setAllFeaturesVisibility:e=>this._setAllFeaturesVisibility(e),clearFeaturesVisibility:()=>this._setAllFeaturesVisibility(!0),updateFeatureVisibilities:e=>this._updateFeatureVisibilities(e)}}),this._updatingHandles.addOnCollectionChange(()=>this._loadedPointGraphics,e=>this._onLoadedFeaturesChange(e),l),this._updatingHandles.addWhen(()=>this._materialParameters,e=>this._forEachMaterial(t=>t.setParameters(e)),l),this._updatingHandles.add(()=>this._rendererParameters,e=>this._drapeSourceRenderer.set(e)),this._updatingHandles.add(()=>this._heatmapRendererField,()=>{this._recreate()},p),this._updatingHandles.add(()=>({fieldName:this._heatmapRendererFieldName,numeric:this._heatmapRendererFieldIsNumeric}),({fieldName:e,numeric:t})=>{if(null!=e&&t){let t=0;this._featureStore.forEach(r=>t+=r.attributes[e]??0),this._fieldTotal=t}else this._fieldTotal=this._featureStore.numFeatures},l),this.addHandles([d(()=>({fieldName:this._heatmapRendererFieldName,field:this._heatmapRendererField}),({fieldName:e,field:t})=>{e&&!t&&i.getLogger(this).warn(`Heatmap renderer field '${e}' for layer '${this.layer.title??this.layer.id}' not found`)}),d(()=>({field:this._heatmapRendererField,numeric:this._heatmapRendererFieldIsNumeric}),({field:e,numeric:t})=>{null==e||t||i.getLogger(this).warn(`Heatmap renderer field '${e.name}' for layer '${this.layer.title??this.layer.id}' does not contain numeric values and cannot be used to drive the heatmap density`)}),r(()=>this.view.basemapTerrain.overlayManager.unregisterDrapeSource(this))])}destroy(){this._renderGeometries.clear(),this._material=null,this._materialWithField=null,this._featureStore.clear(),this._featureStore=null,this._updatingHandles.destroy()}get layer(){return this.owner.layer}get featureStore(){return this._featureStore}get updating(){return this._updatingHandles.updating||this.filterVisibility.updating}get updatingRemaining(){return 0}get suspendInfo(){return{}}get legendEnabled(){return!0}get filterVisibility(){return this._filterVisibility}get displayFeatureLimit(){const e=this.owner?.view?.quality??1,t=this.owner?.view?.qualitySettings,r=t?Math.ceil(t.heatmap.maxTotalNumberOfFeatures*e):0;return new j(r*6,r)}get hasZ(){return"hasZ"in this.layer&&!0===this.layer.hasZ}get hasM(){return"hasM"in this.layer&&this.layer.hasM}get view(){return this.owner.view}get fullOpacity(){return this.owner.fullOpacity}get updatePolicy(){return this.owner.updatePolicy}get scaleVisibilitySuspended(){if(!this._isScaleRangeActive)return!1;const{minScale:e,maxScale:t}=this.layer.effectiveScaleRange,{scale:r}=this.view;return!O(r,e??0,t??0)}get usedMemory(){const e=this.usedMemoryPerFeature*this._featureStore.numFeatures,t=6403===this._pixelFormat?1:4,r=this._dataType===L.FLOAT?4:2,i=Math.ceil((this._overlayRenderer?.overlays[0]?.resolution??0)*this._densityMapPixelRatio)??0;return i*i*t*r+e}get usedMemoryPerFeature(){const e=this._loadedPointGraphics.find(()=>!0);if(null==e)return 0;const t=a(e),r=6;return r*s([0,0,0],o)+r*s([0,0],o)+(this._heatmapRendererFieldIsNumeric?r*o:0)+t}get loadedFeatures(){return this._featureStore.numFeatures}get unprocessedMemoryEstimate(){return 0}get performanceInfo(){return new G(this._renderGeometries.size,this._visibleFeatures,0,0)}get renderer(){return this._heatmapRenderer}get _overlayRenderer(){return this.view.basemapTerrain.overlayManager.renderer}get _overlaySpatialReference(){return this._overlayRenderer.spatialReference}get _rendererParameters(){return{...this._radiusParameter,...this._densityParameters,...this._colorRampParameter,...this._pixelRatioParameter}}get _materialParameters(){return{...this._radiusParameter,...this._resolutionForScaleParameter}}get _densityParameters(){const e=this._heatmapRenderer;if(null==e)return null;const{minDensity:t,maxDensity:r}=e;return{minDensity:t,maxDensity:r,fieldTotal:this._fieldTotal}}get _radiusParameter(){const e=this._heatmapRenderer;return e?{searchRadius:u(this._clampSearchRadius(e.radius))}:null}get _resolutionForScaleParameter(){const e=this._heatmapRenderer;if(!e)return null;const{referenceScale:t}=e;return{resolutionForScale:0===t?0:f(t,this.view.spatialReference)}}get _colorRampParameter(){const e=this._heatmapRenderer;return e?{colorRampData:P(e.colorStops)}:null}get _pixelRatioParameter(){return{pixelRatio:this._densityMapPixelRatio}}get _densityMapPixelRatio(){return this.owner?.view?.qualitySettings.heatmap.pixelRatio??1}get _renderView(){return this.view.stage.renderView}get _featuresArePoints(){return"point"===this.layer.geometryType}get _loadedPointGraphics(){return this.owner.loadedGraphics}get _heatmapRenderer(){const e=this.layer.renderer;return"heatmap"===e?.type?e:null}get _heatmapRendererFieldName(){return this._heatmapRenderer?.field}get _heatmapRendererField(){const e=this._heatmapRendererFieldName;return null!=e?this.layer.fieldsIndex.get(e):null}get _heatmapRendererFieldIsNumeric(){const e=this._heatmapRendererField;return null!=e&&S(e)}get _isScaleRangeActive(){const{layer:e}=this;if(!("effectiveScaleRange"in e))return!1;const{minScale:t,maxScale:r}=e.effectiveScaleRange;return U(t,r)}get _visibleFeatures(){return Array.from(this._renderGeometries.values()).reduce((e,{visible:t})=>e+(t?1:0),0)}async whenGraphicBounds(){return null}computeAttachmentOrigin(){return null}highlightByGraphics(){return x}highlightByObjectIds(){return x}maskOccludee(){return r()}setObjectIdVisibility(){}refreshFilter(){this.filterVisibility.reapply()}_onLoadedFeaturesChange(e){if(!this._featuresArePoints)return;const{objectIdField:r}=this.layer;this._featureStore.removeManyById(e.removed.map(e=>R(e,r))),this._featureStore.addMany(e.added.map(e=>{const{attributes:t,centroid:i,geometry:a}=e,s=new v(F(new b,a),t,i?F(new b,i):null,R(e,r));return s.displayId=e.uid,s}));const i=e.added,a=e.removed;this._fieldTotal+=this._computeFieldTotalChange(i,a);const s=a.map(({uid:e})=>{const t=this._renderGeometries.get(e);return this._renderGeometries.delete(e),t}).filter(t),o=i.map(e=>{const t=this._pointGraphicToRenderGeometry(e);return this._renderGeometries.set(e.uid,t),t});s.length>0&&this._drapeSourceRenderer.removeGeometries(s,2),o.length>0&&this._drapeSourceRenderer.addGeometries(o,0),(o.length>0||s.length>0)&&(this.filterVisibility.reapply(),this._renderView.requestRender())}_recreate(){if(!this._loadedPointGraphics)return;const e=this._loadedPointGraphics.toArray();this._onLoadedFeaturesChange({added:e,removed:e})}_pointGraphicToRenderGeometry(e){const t=this._heatmapRendererFieldName,r=null!=t?this._materialWithField:this._material,i=c();_(e.geometry,i,this._overlaySpatialReference),i[2]=T;const a=g(1),s=[["position",new M(i,a,i.length)]],o=this._heatmapRendererFieldIsNumeric;null!=t&&s.push(["featureAttribute",new M([o?e.attributes[t]??0:0],a,1)]);const n=new N(new I(r,s,null,1),{layerViewUid:this.owner.layerViewUid,graphicUid:e.uid});return n.visible=this.filterVisibility.defaultVisibility,n}_forEachMaterial(e){e(this._material),e(this._materialWithField)}_computeFieldTotalChange(e,t){if(null==this._heatmapRendererFieldName||!this._heatmapRendererFieldIsNumeric)return e.length-t.length;const r=this._heatmapRendererFieldName,i=(e,t)=>e+(t.attributes[r]??0);return e.reduce(i,0)-t.reduce(i,0)}_clampSearchRadius(e){return e>E&&i.getLogger(this).warnOnce(`SceneView supports a maximum radius of ${E} pt for HeatmapRenderer.`),Math.min(e,E)}_updateFeatureVisibilities(e){const t=[];this._featureStore.forEach(({objectId:r,displayId:i})=>{const a=e(r),s=this._renderGeometries.get(i);s&&s.visible!==a&&(t.push(s),s.visible=a)}),this._drapeSourceRenderer.modifyGeometries(t,1)}_setAllFeaturesVisibility(e){const t=[];for(const r of this._renderGeometries.values())r.visible!==e&&(t.push(r),r.visible=e);this._drapeSourceRenderer.modifyGeometries(t,1)}get test(){}};e([h()],W.prototype,"type",void 0),e([h({constructOnly:!0})],W.prototype,"owner",void 0),e([h()],W.prototype,"layer",null),e([h()],W.prototype,"featureStore",null),e([h()],W.prototype,"updating",null),e([h()],W.prototype,"updatingRemaining",null),e([h()],W.prototype,"suspendInfo",null),e([h()],W.prototype,"legendEnabled",null),e([h()],W.prototype,"filterVisibility",null),e([h()],W.prototype,"displayFeatureLimit",null),e([h()],W.prototype,"preferredUpdatePolicy",void 0),e([h()],W.prototype,"hasZ",null),e([h()],W.prototype,"hasM",null),e([h()],W.prototype,"dataExtent",void 0),e([h()],W.prototype,"view",null),e([h()],W.prototype,"fullOpacity",null),e([h()],W.prototype,"updatePolicy",null),e([h()],W.prototype,"drapeSourceType",void 0),e([h()],W.prototype,"scaleVisibilitySuspended",null),e([h()],W.prototype,"renderer",null),e([h()],W.prototype,"_featureStore",void 0),e([h()],W.prototype,"_filterVisibility",void 0),e([h()],W.prototype,"_overlayRenderer",null),e([h()],W.prototype,"_overlaySpatialReference",null),e([h()],W.prototype,"_rendererParameters",null),e([h()],W.prototype,"_materialParameters",null),e([h()],W.prototype,"_densityParameters",null),e([h()],W.prototype,"_radiusParameter",null),e([h()],W.prototype,"_resolutionForScaleParameter",null),e([h()],W.prototype,"_colorRampParameter",null),e([h()],W.prototype,"_pixelRatioParameter",null),e([h()],W.prototype,"_densityMapPixelRatio",null),e([h()],W.prototype,"_renderGeometries",void 0),e([h()],W.prototype,"_material",void 0),e([h()],W.prototype,"_materialWithField",void 0),e([h()],W.prototype,"_renderView",null),e([h()],W.prototype,"_featuresArePoints",null),e([h()],W.prototype,"_loadedPointGraphics",null),e([h()],W.prototype,"_heatmapRenderer",null),e([h()],W.prototype,"_heatmapRendererFieldName",null),e([h()],W.prototype,"_heatmapRendererField",null),e([h()],W.prototype,"_heatmapRendererFieldIsNumeric",null),e([h()],W.prototype,"_fieldTotal",void 0),e([h()],W.prototype,"_drapeSourceRenderer",void 0),e([h()],W.prototype,"_isScaleRangeActive",null),W=e([m("esri.views.3d.layers.support.HeatmapFeatureProcessor")],W);export{W as HeatmapFeatureProcessor,E as maxRadiusPt};
|
|
5
|
+
import{__decorate as e}from"tslib";import{isSome as t}from"../../../../core/arrayUtils.js";import{makeHandle as r}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import i from"../../../../core/Logger.js";import{estimateAttributesMemory as a,estimateFixedArrayMemory as s,estimateNumberMemory as o}from"../../../../core/memoryEstimations.js";import{EsriPromise as n}from"../../../../core/Promise.js";import{initial as l,sync as p,watch as d}from"../../../../core/reactiveUtils.js";import{pt2px as u}from"../../../../core/screenUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as m}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as y}from"../../../../core/support/UpdatingHandles.js";import{projectPointToVector as _}from"../../../../geometry/projection/projectPointToVector.js";import{getContinuousIndexArray as g}from"../../../../geometry/support/Indices.js";import{getResolutionForScale as f}from"../../../../geometry/support/scaleUtils.js";import{getObjectId as R}from"../../../../layers/graphics/dehydratedFeatures.js";import{convertFromPoint as F}from"../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as b}from"../../../../layers/graphics/OptimizedFeature.js";import v from"../../../../layers/graphics/OptimizedGeometry.js";import w from"../../../../layers/graphics/data/FeatureStore.js";import{isNumericField as S}from"../../../../layers/support/fieldUtils.js";import{generateGradient as P}from"../../../../renderers/support/heatmapUtils.js";import{DisplayFeatureLimit as j}from"../graphics/DisplayFeatureLimit.js";import{GraphicsCorePerformanceInfo as G}from"../graphics/GraphicsCorePerformanceInfo.js";import{FeatureVisibilityFilter as V}from"./FeatureVisibilityFilter.js";import{emptyHighlightHandle as x}from"./highlightUtils.js";import{drapedZ as T}from"../../terrain/OverlayRenderer.js";import{Attribute as M}from"../../webgl-engine/lib/Attribute.js";import{DrapedHeatmapRenderer as I}from"../../webgl-engine/lib/DrapedHeatmapRenderer.js";import{Geometry as A}from"../../webgl-engine/lib/Geometry.js";import{GeometryBaseInstance as N}from"../../webgl-engine/lib/GeometryBaseInstance.js";import{RenderGeometry as H}from"../../webgl-engine/lib/RenderGeometry.js";import{HeatmapDensityMaterial as O}from"../../webgl-engine/materials/HeatmapDensityMaterial.js";import{scaleBoundsPredicate as U,isScaleRangeActive as L}from"../../../support/layerViewUtils.js";import{PixelType as C}from"../../../webgl/enums.js";import{loadHeatmapTextureConfiguration as D,fallBackHeatmapConfiguration as E}from"../../../webgl/heatmapTextureUtils.js";const W=112;let Z=class extends n{constructor(e){super(e),this.type="heatmap",this.preferredUpdatePolicy=0,this.dataExtent=null,this.drapeSourceType=1,this._renderGeometries=new Map,this._fieldTotal=0,this._drapeSourceRenderer=null,this._dataType=C.HALF_FLOAT,this._pixelFormat=6408,this._baseInstance=new N([]),this._updatingHandles=new y}initialize(){let e;try{e=D(this._renderView.renderingContext,i.getLogger(this))}catch(m){this.addResolvingPromise(Promise.reject(m)),e=E}const{dataType:t,samplingMode:a,pixelFormat:s,internalFormat:o}=e;this._featureStore=new w({geometryType:"esriGeometryPoint",hasZ:this.hasZ,hasM:this.hasM}),this._dataType=t,this._pixelFormat=s;const n=t!==C.FLOAT,u=this.view.basemapTerrain.overlayManager,h={...this._rendererParameters,stage:this.view.stage,dataType:t,samplingMode:a,pixelFormat:s,internalFormat:o,rendererContext:u.renderer,drapeSource:this};this._drapeSourceRenderer=new I(h),u.registerDrapeSource(this,this._drapeSourceRenderer),this._material=new O({usesHalfFloats:n}),this._materialWithField=new O({usesHalfFloats:n,isAttributeDriven:!0}),this._filterVisibility=new V({context:{configuration:this.owner,featureStore:this.featureStore,getFeatureCount:()=>this._loadedPointGraphics.length,setAllFeaturesVisibility:e=>this._setAllFeaturesVisibility(e),clearFeaturesVisibility:()=>this._setAllFeaturesVisibility(!0),updateFeatureVisibilities:e=>this._updateFeatureVisibilities(e)}}),this._updatingHandles.addOnCollectionChange(()=>this._loadedPointGraphics,e=>this._onLoadedFeaturesChange(e),l),this._updatingHandles.addWhen(()=>this._materialParameters,e=>this._forEachMaterial(t=>t.setParameters(e)),l),this._updatingHandles.add(()=>this._rendererParameters,e=>this._drapeSourceRenderer.set(e)),this._updatingHandles.add(()=>this._heatmapRendererField,()=>{this._recreate()},p),this._updatingHandles.add(()=>({fieldName:this._heatmapRendererFieldName,numeric:this._heatmapRendererFieldIsNumeric}),({fieldName:e,numeric:t})=>{if(null!=e&&t){let t=0;this._featureStore.forEach(r=>t+=r.attributes[e]??0),this._fieldTotal=t}else this._fieldTotal=this._featureStore.numFeatures},l),this.addHandles([d(()=>({fieldName:this._heatmapRendererFieldName,field:this._heatmapRendererField}),({fieldName:e,field:t})=>{e&&!t&&i.getLogger(this).warn(`Heatmap renderer field '${e}' for layer '${this.layer.title??this.layer.id}' not found`)}),d(()=>({field:this._heatmapRendererField,numeric:this._heatmapRendererFieldIsNumeric}),({field:e,numeric:t})=>{null==e||t||i.getLogger(this).warn(`Heatmap renderer field '${e.name}' for layer '${this.layer.title??this.layer.id}' does not contain numeric values and cannot be used to drive the heatmap density`)}),r(()=>this.view.basemapTerrain.overlayManager.unregisterDrapeSource(this))])}destroy(){this._renderGeometries.clear(),this._material=null,this._materialWithField=null,this._featureStore.clear(),this._featureStore=null,this._updatingHandles.destroy(),this._baseInstance=null}get layer(){return this.owner.layer}get featureStore(){return this._featureStore}get updating(){return this._updatingHandles.updating||this.filterVisibility.updating}get updatingRemaining(){return 0}get suspendInfo(){return{}}get legendEnabled(){return!0}get filterVisibility(){return this._filterVisibility}get displayFeatureLimit(){const e=this.owner?.view?.quality??1,t=this.owner?.view?.qualitySettings,r=t?Math.ceil(t.heatmap.maxTotalNumberOfFeatures*e):0;return new j(r*6,r)}get hasZ(){return"hasZ"in this.layer&&!0===this.layer.hasZ}get hasM(){return"hasM"in this.layer&&this.layer.hasM}get view(){return this.owner.view}get fullOpacity(){return this.owner.fullOpacity}get updatePolicy(){return this.owner.updatePolicy}get scaleVisibilitySuspended(){if(!this._isScaleRangeActive)return!1;const{minScale:e,maxScale:t}=this.layer.effectiveScaleRange,{scale:r}=this.view;return!U(r,e??0,t??0)}get usedMemory(){const e=this.usedMemoryPerFeature*this._featureStore.numFeatures,t=6403===this._pixelFormat?1:4,r=this._dataType===C.FLOAT?4:2,i=Math.ceil((this._overlayRenderer?.overlays[0]?.resolution??0)*this._densityMapPixelRatio)??0;return i*i*t*r+e}get usedMemoryPerFeature(){const e=this._loadedPointGraphics.find(()=>!0);if(null==e)return 0;const t=a(e),r=6;return r*s([0,0,0],o)+r*s([0,0],o)+(this._heatmapRendererFieldIsNumeric?r*o:0)+t}get loadedFeatures(){return this._featureStore.numFeatures}get unprocessedMemoryEstimate(){return 0}get performanceInfo(){return new G(this._renderGeometries.size,this._visibleFeatures,0,0)}get renderer(){return this._heatmapRenderer}get _overlayRenderer(){return this.view.basemapTerrain.overlayManager.renderer}get _overlaySpatialReference(){return this._overlayRenderer.spatialReference}get _rendererParameters(){return{...this._radiusParameter,...this._densityParameters,...this._colorRampParameter,...this._pixelRatioParameter}}get _materialParameters(){return{...this._radiusParameter,...this._resolutionForScaleParameter}}get _densityParameters(){const e=this._heatmapRenderer;if(null==e)return null;const{minDensity:t,maxDensity:r}=e;return{minDensity:t,maxDensity:r,fieldTotal:this._fieldTotal}}get _radiusParameter(){const e=this._heatmapRenderer;return e?{searchRadius:u(this._clampSearchRadius(e.radius))}:null}get _resolutionForScaleParameter(){const e=this._heatmapRenderer;if(!e)return null;const{referenceScale:t}=e;return{resolutionForScale:0===t?0:f(t,this.view.spatialReference)}}get _colorRampParameter(){const e=this._heatmapRenderer;return e?{colorRampData:P(e.colorStops)}:null}get _pixelRatioParameter(){return{pixelRatio:this._densityMapPixelRatio}}get _densityMapPixelRatio(){return this.owner?.view?.qualitySettings.heatmap.pixelRatio??1}get _renderView(){return this.view.stage.renderView}get _featuresArePoints(){return"point"===this.layer.geometryType}get _loadedPointGraphics(){return this.owner.loadedGraphics}get _heatmapRenderer(){const e=this.layer.renderer;return"heatmap"===e?.type?e:null}get _heatmapRendererFieldName(){return this._heatmapRenderer?.field}get _heatmapRendererField(){const e=this._heatmapRendererFieldName;return null!=e?this.layer.fieldsIndex.get(e):null}get _heatmapRendererFieldIsNumeric(){const e=this._heatmapRendererField;return null!=e&&S(e)}get _isScaleRangeActive(){const{layer:e}=this;if(!("effectiveScaleRange"in e))return!1;const{minScale:t,maxScale:r}=e.effectiveScaleRange;return L(t,r)}get _visibleFeatures(){return Array.from(this._renderGeometries.values()).reduce((e,{visible:t})=>e+(t?1:0),0)}async whenGraphicBounds(){return null}computeAttachmentOrigin(){return null}highlightByGraphics(){return x}highlightByObjectIds(){return x}maskOccludee(){return r()}setObjectIdVisibility(){}refreshFilter(){this.filterVisibility.reapply()}_onLoadedFeaturesChange(e){if(!this._featuresArePoints)return;const{objectIdField:r}=this.layer;this._featureStore.removeManyById(e.removed.map(e=>R(e,r))),this._featureStore.addMany(e.added.map(e=>{const{attributes:t,centroid:i,geometry:a}=e,s=new b(F(new v,a),t,i?F(new v,i):null,R(e,r));return s.displayId=e.uid,s}));const i=e.added,a=e.removed;this._fieldTotal+=this._computeFieldTotalChange(i,a);const s=a.map(({uid:e})=>{const t=this._renderGeometries.get(e);return this._renderGeometries.delete(e),t}).filter(t),o=i.map(e=>{const t=this._pointGraphicToRenderGeometry(e);return this._renderGeometries.set(e.uid,t),t});s.length>0&&this._drapeSourceRenderer.removeGeometries(s,2),o.length>0&&this._drapeSourceRenderer.addGeometries(o,0),(o.length>0||s.length>0)&&(this.filterVisibility.reapply(),this._renderView.requestRender())}_recreate(){if(!this._loadedPointGraphics)return;const e=this._loadedPointGraphics.toArray();this._onLoadedFeaturesChange({added:e,removed:e})}_pointGraphicToRenderGeometry(e){const t=this._heatmapRendererFieldName,r=null!=t?this._materialWithField:this._material,i=c();_(e.geometry,i,this._overlaySpatialReference),i[2]=T;const a=g(1),s=[["position",new M(i,a,i.length)]],o=this._heatmapRendererFieldIsNumeric;null!=t&&s.push(["featureAttribute",new M([o?e.attributes[t]??0:0],a,1)]);const n=new H(new A(r,s,null,1,null,void 0,this._baseInstance),{layerViewUid:this.owner.layerViewUid,graphicUid:e.uid});return n.visible=this.filterVisibility.defaultVisibility,n}_forEachMaterial(e){e(this._material),e(this._materialWithField)}_computeFieldTotalChange(e,t){if(null==this._heatmapRendererFieldName||!this._heatmapRendererFieldIsNumeric)return e.length-t.length;const r=this._heatmapRendererFieldName,i=(e,t)=>e+(t.attributes[r]??0);return e.reduce(i,0)-t.reduce(i,0)}_clampSearchRadius(e){return e>W&&i.getLogger(this).warnOnce(`SceneView supports a maximum radius of ${W} pt for HeatmapRenderer.`),Math.min(e,W)}_updateFeatureVisibilities(e){const t=[];this._featureStore.forEach(({objectId:r,displayId:i})=>{const a=e(r),s=this._renderGeometries.get(i);s&&s.visible!==a&&(t.push(s),s.visible=a)}),this._drapeSourceRenderer.modifyGeometries(t,1)}_setAllFeaturesVisibility(e){const t=[];for(const r of this._renderGeometries.values())r.visible!==e&&(t.push(r),r.visible=e);this._drapeSourceRenderer.modifyGeometries(t,1)}get test(){}};e([h()],Z.prototype,"type",void 0),e([h({constructOnly:!0})],Z.prototype,"owner",void 0),e([h()],Z.prototype,"layer",null),e([h()],Z.prototype,"featureStore",null),e([h()],Z.prototype,"updating",null),e([h()],Z.prototype,"updatingRemaining",null),e([h()],Z.prototype,"suspendInfo",null),e([h()],Z.prototype,"legendEnabled",null),e([h()],Z.prototype,"filterVisibility",null),e([h()],Z.prototype,"displayFeatureLimit",null),e([h()],Z.prototype,"preferredUpdatePolicy",void 0),e([h()],Z.prototype,"hasZ",null),e([h()],Z.prototype,"hasM",null),e([h()],Z.prototype,"dataExtent",void 0),e([h()],Z.prototype,"view",null),e([h()],Z.prototype,"fullOpacity",null),e([h()],Z.prototype,"updatePolicy",null),e([h()],Z.prototype,"drapeSourceType",void 0),e([h()],Z.prototype,"scaleVisibilitySuspended",null),e([h()],Z.prototype,"renderer",null),e([h()],Z.prototype,"_featureStore",void 0),e([h()],Z.prototype,"_filterVisibility",void 0),e([h()],Z.prototype,"_overlayRenderer",null),e([h()],Z.prototype,"_overlaySpatialReference",null),e([h()],Z.prototype,"_rendererParameters",null),e([h()],Z.prototype,"_materialParameters",null),e([h()],Z.prototype,"_densityParameters",null),e([h()],Z.prototype,"_radiusParameter",null),e([h()],Z.prototype,"_resolutionForScaleParameter",null),e([h()],Z.prototype,"_colorRampParameter",null),e([h()],Z.prototype,"_pixelRatioParameter",null),e([h()],Z.prototype,"_densityMapPixelRatio",null),e([h()],Z.prototype,"_renderGeometries",void 0),e([h()],Z.prototype,"_material",void 0),e([h()],Z.prototype,"_materialWithField",void 0),e([h()],Z.prototype,"_renderView",null),e([h()],Z.prototype,"_featuresArePoints",null),e([h()],Z.prototype,"_loadedPointGraphics",null),e([h()],Z.prototype,"_heatmapRenderer",null),e([h()],Z.prototype,"_heatmapRendererFieldName",null),e([h()],Z.prototype,"_heatmapRendererField",null),e([h()],Z.prototype,"_heatmapRendererFieldIsNumeric",null),e([h()],Z.prototype,"_fieldTotal",void 0),e([h()],Z.prototype,"_drapeSourceRenderer",void 0),e([h()],Z.prototype,"_isScaleRangeActive",null),Z=e([m("esri.views.3d.layers.support.HeatmapFeatureProcessor")],Z);export{Z as HeatmapFeatureProcessor,W as maxRadiusPt};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{hasNativeFloat16Array as e}from"../../../../geometry/support/float16.js";import{BufferViewVec2f16 as t,BufferViewVec2f as i,BufferViewVec2f64 as r,BufferViewVec3f16 as s,BufferViewVec3f as n,BufferViewVec3f64 as h,BufferViewVec4f16 as d,BufferViewVec4f as u,BufferViewVec4f64 as f,BufferViewMat3f as o,BufferViewMat3f64 as
|
|
5
|
+
import{hasNativeFloat16Array as e}from"../../../../geometry/support/float16.js";import{BufferViewVec2f16 as t,BufferViewVec2f as i,BufferViewVec2f64 as r,BufferViewVec3f16 as s,BufferViewVec3f as n,BufferViewVec3f64 as h,BufferViewVec4f16 as d,BufferViewVec4f as u,BufferViewVec4f64 as f,BufferViewMat3f as o,BufferViewMat3f64 as p,BufferViewMat4f as l,BufferViewMat4f64 as a,BufferViewVec4u8 as c,BufferViewFloat16 as _,BufferViewFloat as m,BufferViewFloat64 as F,BufferViewUint8 as y,BufferViewUint16 as g,BufferViewInt8 as b,BufferViewVec2i8 as w,BufferViewVec2i16 as v,BufferViewVec2u8 as E,BufferViewVec2u16 as A,BufferViewVec4u16 as M,BufferViewVec4i16 as T,BufferViewUint32 as j,BufferViewVec3u8 as U,BufferViewVec3u16 as B,BufferViewVec2u32 as L,BufferViewVec3u32 as x,BufferViewVec4u32 as C,BufferViewVec3i8 as z,BufferViewVec4i8 as V,BufferViewInt16 as $,BufferViewVec3i16 as k,BufferViewInt32 as q,BufferViewVec2i32 as D,BufferViewVec3i32 as G,BufferViewVec4i32 as H}from"../../../../geometry/support/buffer/BufferView.js";import{elementTypeSize as I}from"../../../../geometry/support/buffer/types.js";import{glLayout as J}from"./glUtil.js";import{assert as K}from"../../webgl-engine/lib/Util.js";import{fromLayout as N}from"../../../webgl/VertexAttributeLocations.js";class O{constructor(e,t){this.layout=e,this.buffer="number"==typeof t?new ArrayBuffer(t*e.stride):t;for(const i of e.fields.keys()){const t=e.fields.get(i);this[i]=new t.constructor(this.buffer,t.offset,this.stride)}}get stride(){return this.layout.stride}get count(){return this.buffer.byteLength/this.stride}get byteLength(){return this.buffer.byteLength}getField(e,t){const i=this[e];return i&&i.elementCount===t.ElementCount&&i.elementType===t.ElementType?i:null}slice(e,t){return new O(this.layout,this.buffer.slice(e*this.stride,t*this.stride))}copyFrom(e,t=0,i=0,r=e.count){const s=this.stride;if(s%4==0){const n=new Uint32Array(e.buffer,t*s,r*s/4);new Uint32Array(this.buffer,i*s,r*s/4).set(n)}else{const n=new Uint8Array(e.buffer,t*s,r*s);new Uint8Array(this.buffer,i*s,r*s).set(n)}return this}get usedMemory(){return this.byteLength}dispose(){}}class P{constructor(e){this._stride=0,this._fields=new Map,e&&(this._stride=e.stride,e.fields.forEach(e=>this._fields.set(e[0],{...e[1],constructor:X(e[1].constructor)})))}freeze(){return this}get locations(){return N(J(this))}vec2f16(r,s){return this._appendField(r,e?t:i,s),this}vec2f(e,t){return this._appendField(e,i,t),this}vec2f64(e,t){return this._appendField(e,r,t),this}vec3f16(t,i){return this._appendField(t,e?s:n,i),this}vec3f(e,t){return this._appendField(e,n,t),this}vec3f64(e,t){return this._appendField(e,h,t),this}vec4f16(t,i){return this._appendField(t,e?d:u,i),this}vec4f(e,t){return this._appendField(e,u,t),this}vec4f64(e,t){return this._appendField(e,f,t),this}mat3f(e,t){return this._appendField(e,o,t),this}mat3f64(e,t){return this._appendField(e,p,t),this}mat4f(e,t){return this._appendField(e,l,t),this}mat4f64(e,t){return this._appendField(e,a,t),this}vec4u8(e,t){return this._appendField(e,c,t),this}f16(t,i){return this._appendField(t,e?_:m,i),this}f32(e,t){return this._appendField(e,m,t),this}f64(e,t){return this._appendField(e,F,t),this}u8(e,t){return this._appendField(e,y,t),this}u16(e,t){return this._appendField(e,g,t),this}i8(e,t){return this._appendField(e,b,t),this}vec2i8(e,t){return this._appendField(e,w,t),this}vec2i16(e,t){return this._appendField(e,v,t),this}vec2u8(e,t){return this._appendField(e,E,t),this}vec2u16(e,t){return this._appendField(e,A,t),this}vec4u16(e,t){return this._appendField(e,M,t),this}vec4i16(e,t){return this._appendField(e,T,t),this}u32(e,t){return this._appendField(e,j,t),this}_appendField(e,t,i){this._fields.has(e)&&K(!1,`${e} already added to vertex buffer layout`);const r=t.ElementCount*I(t.ElementType),s=this._stride;this._fields.set(e,{constructor:t,size:r,offset:s,optional:i}),this._alignFields()}_alignFields(){let e=0,t=1;this._fields.forEach(i=>{const r=I(i.constructor.ElementType);e=Math.floor((e+r-1)/r)*r,i.offset=e,e+=i.size,t=Math.max(t,r)}),e=Math.floor((e+t-1)/t)*t,this._stride=e}createBuffer(e){return new O(this,e)}createView(e){return new O(this,e)}clone(){const e=new P;return e._stride=this._stride,e._fields=new Map,this._fields.forEach((t,i)=>e._fields.set(i,t)),e.BufferType=this.BufferType,e}get stride(){return this._stride}get fields(){return this._fields}}function Q(){return new P}class R{constructor(e){this.fields=new Array,e.fields.forEach((e,t)=>{const i={...e,constructor:W(e.constructor)};this.fields.push([t,i])}),this.stride=e.stride}}const S=[m,i,n,u,o,l,F,r,h,f,p,a,y,E,U,c,g,A,B,M,j,L,x,C,b,w,z,V,$,v,k,T,q,D,G,H];function W(e){return`${e.ElementType}_${e.ElementCount}`}function X(e){return Y.get(e)}const Y=new Map;S.forEach(e=>Y.set(W(e),e));export{O as InterleavedBuffer,P as InterleavedLayout,R as PackedLayout,Q as newLayout};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{set as t,dist as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{ONES as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as n}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as
|
|
5
|
+
import{set as t,dist as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{ONES as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as n}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as i}from"../../../../geometry/projection/projectors.js";import{newDoubleArray as a}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as u}from"../../../../geometry/support/FloatArray.js";import{newHalfFloatArray as s}from"../../../../geometry/support/HalfFloatArray.js";import{getZeroIndexArray as l}from"../../../../geometry/support/Indices.js";import{Attribute as c}from"../../webgl-engine/lib/Attribute.js";import{Geometry as p}from"../../webgl-engine/lib/Geometry.js";function f(t,e,r=null){const o=[],n=e.mapPositions,i=m(e,o),a=i.data,u=i.indices.length,s=l(u);return h(e,o,s),y(e,o,s),g(e,o,s),b(e,o,i.indices,s),w(e,o,i.indices,s),D(e,o),F(e,o,i.indices,s),d(e,o,a),new p(t,o,n,2,r)}function m(t,e){const{attributeData:{position:r},removeDuplicateStartEnd:o}=t,n=j(r)&&o,i=r.length/3-(n?1:0),a=new Array(2*(i-1)),u=n?r.slice(0,-3):r;let s=0;for(let c=0;c<i-1;c++)a[s++]=c,a[s++]=c+1;const l=new c(u,a,3,n);return e.push(["position",l]),l}function h(t,e,r){if(null!=t.attributeData.colorFeature)return;const n=t.attributeData.color;e.push(["color",new c(n??o,r,4)])}function g(t,e,r){t.attributeData.normal&&e.push(["normal",new c(t.attributeData.normal,r,3)])}function b(t,e,r,o){const n=t.attributeData.colorFeature;null!=n&&("number"==typeof n?e.push(["colorFeatureAttribute",new c([n],o,1,!0)]):e.push(["colorFeatureAttribute",new c(n,r,1,!0)]))}function y(t,e,r){null==t.attributeData.sizeFeature&&e.push(["size",new c([t.attributeData.size??1],r,1,!0)])}function w(t,e,r,o){const n=t.attributeData.sizeFeature;null!=n&&("number"==typeof n?e.push(["sizeFeatureAttribute",new c([n],o,1,!0)]):e.push(["sizeFeatureAttribute",new c(n,r,1,!0)]))}function D(t,e){const{attributeData:{position:r,timeStamps:o}}=t;if(!o)return;const n=r.length/3,i=new Array(2*(n-1));let a=0;for(let u=0;u<n-1;u++)i[a++]=u,i[a++]=u+1;e.push(["timeStamps",new c(o,i,z,!0)])}function F(t,e,r,o){const n=t.attributeData.opacityFeature;null!=n&&("number"==typeof n?e.push(["opacityFeatureAttribute",new c([n],o,1,!0)]):e.push(["opacityFeatureAttribute",new c(n,r,1,!0)]))}function d(r,o,s){if(null==r.overlayInfo||1!==r.overlayInfo.renderCoordsHelper.viewingMode||!r.overlayInfo.spatialReference.isGeographic)return;const l=a(s.length),p=n(r.overlayInfo.spatialReference);for(let t=0;t<l.length;t+=3)i(s,t,l,t,p);const f=s.length/3,m=u(f+1);let h=A,g=v,b=0,y=0;t(h,l[y++],l[y++]),y++,m[0]=0;for(let n=1;n<f+1;++n)n===f&&(y=0),t(g,l[y++],l[y++]),y++,b+=e(h,g),m[n]=b,[h,g]=[g,h];o.push(["distanceToStart",new c(m,o[0][1].indices,1,!0)])}function j(t){const e=t.length;return t[0]===t[e-3]&&t[1]===t[e-2]&&t[2]===t[e-1]}const A=r(),v=r(),z=4;function S(t,e,r,o,n){if(null==t||0===t.length)return[];const i=[];return t.forEach((t,u)=>{const s=t.length,l=a(3*s);t.forEach((t,e)=>{l[3*e]=t[0],l[3*e+1]=t[1],l[3*e+2]=t[2]});const c={attributeData:{position:l,normal:e,colorFeature:r?.[u],opacityFeature:o?.[u],sizeFeature:n?.[u]},removeDuplicateStartEnd:!1};i.push(c)}),i}function E(t,e,r,o,n,i){if(null==t||0===t.length)return[];const a=S(t,e,o,n,i);return t.forEach((t,e)=>{const o=r?.[e],n=null!=o?x(o.timeStamps,o.streamlineType):void 0;a[e].attributeData.timeStamps=n}),a}function I(t,e=0,r=.01){const o=s(t.length);o[0]=0;for(let i=1;i<t.length;i++){const e=t[i-1],r=t[i],n=Math.sqrt((r[0]-e[0])**2+(r[1]-e[1])**2+(r[2]-e[2])**2);o[i]=o[i-1]+n}const n=o.map(t=>t*r);if(0!==e&&e<n.length){const t=n[e];for(let e=0;e<n.length;e++)n[e]-=t}return n}function x(t,e){const r=s(t.length*z),o=t[0],n=t[t.length-1];for(let i=0;i<t.length;i++)r[i*z]=t[i],r[i*z+1]=o,r[i*z+2]=n,r[i*z+3]=e;return r}export{E as animatedLineStripsToParameters,f as createGeometry,I as getLinearTimeStamps,S as lineStripsToParameters,z as numTimeStampValuesPerVertex,x as timeStampsToAttribute};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{throttle as e}from"../../../../core/throttle.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as
|
|
5
|
+
import{__decorate as t}from"tslib";import{throttle as e}from"../../../../core/throttle.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromExtent as i,clone as a}from"../../../../geometry/support/aaBoundingRect.js";import{toFlowData as o}from"../../../2d/engine/flow/dataUtils.js";import l from"../../layers/FlowSubView3D.js";import{tilesWaitingTime as n}from"./constants.js";import{tileToKey as d,FlowDataTile as h}from"./loadUtils.js";import{isRasterTile as u}from"../../terrain/TerrainData.js";let g=class extends l{constructor(t){super(t),this._flowDataTiles=c(),this._resetTileData=!0,this._throttledTriggerLoad=null,this._throttling=!1}initialize(){this.addHandles([this.surface.on("tile-data-changed",({tile:t,layerIndex:e,layerClass:s})=>{const{renderedTiles:r}=this;null!=r&&e===this._layerIndex&&1===s&&this._updateFlowDataTile(t)})]),this._throttledTriggerLoad=e(()=>{super.triggerLoad(),this._throttling=!1},()=>this._throttling=!0,n,this),this.addHandles(this._throttledTriggerLoad),this.updatingHandles.add(()=>this.renderedTiles,t=>{const e=c();t?.forEach(t=>{const s=this._flowDataTiles.get(d(t)),r=null==s||"delete"===s?this._getFlowDataCopy(t):s;null!=r&&e.set(d(t),r)}),this._flowDataTiles=e,this._resetTileData=!0,this.triggerLoad()})}abort(){super.abort(),this._throttling=!1}get _layerIndex(){return this.surface.getLayerIndexByUID(1,this.layerView.uid)}get updating(){return this.requireLoad||this.updatingHandles.updating||this._throttling}triggerLoad(){const t=this._numberLoadedTiles===this.renderedTiles?.size,{_throttledTriggerLoad:e}=this;t?(e.hasPendingUpdates()||e(),e.forceUpdate()):e()}async fetchDataAndGenerateStreamlines(t,e){const{needsMagnitude:s,simulationSettings:r,_flowDataTiles:a,workerHandle:o}=this,{size:l}=t;if(null==r||null==o)return;const n=i(t.extent),d=this._resetTileData;this._resetTileData=!1;const h=c();a.forEach((t,e)=>{"delete"===t?(h.set(e,"delete"),a.delete(e)):(d||"on-worker"!==t)&&(h.set(e,t),a.set(e,"on-worker"))});const u={simulationSettings:r,size:l,flowDataTiles:h,reset:d,extent:n,pixelSize:this.surface.tilingScheme.pixelSize,needsMagnitude:s,startPositions:this.startPositions(t)},{streamlines:g}=await o.generateTiledStreamlines(u,e);return g}_getFlowDataCopy(t){const{_layerIndex:e}=this,s=null==t.surface;if(null==e||s)return null;const r=t.getLayerInfo(e,1);if(null==r)return null;if(!t.visible&&null==r.requestAbort)return r.requestAbort=new AbortController,this.surface.requestTileData(t,e,1,r.requestAbort),null;if(r.dataMissing||!t.hasLayerData(e,1))return null;const{data:i}=r;if(!u(i))return null;const l=o(this.layer.serviceRasterInfo.dataType,i.source),n=new Uint8Array(l.width*l.height);for(let a=0;a<n.length;a++)n[a]=l.mask[a];return new h(l.data,n,l.width,l.height,t.lij,a(t.extent))}_updateFlowDataTile(t){const e=this.renderedTiles?.has(t)?this._getFlowDataCopy(t)??"delete":"delete";this._setTileData(t,e)&&this.triggerLoad()}_setTileData(t,e){const s=d(t);return(null!=this._flowDataTiles.get(s)||"delete"!==e)&&(this._flowDataTiles.set(s,e),!0)}get _numberLoadedTiles(){let t=0;for(const e of this._flowDataTiles.values())"delete"!==e&&t++;return t}get test(){return{...super.test,loadedTiles:this._flowDataTiles}}};function c(){return new Map}t([s()],g.prototype,"_throttling",void 0),t([s()],g.prototype,"updating",null),g=t([r("esri.views.3d.support.flow.FlowSubViewTiles3D")],g);export{g 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const e=.1,o=1,t=1,c=1e3,n=3,p=1;export{e as averageLoadingTimeSmoothingFactor,p as defaultTransitionDuration,t as fadeInTime,o as fadeOutTime,c as tilesWaitingTime,n as transitionDurationFactor};
|
|
5
|
+
const e=.1,o=1,t=1,c=1e3,n=3,p=1,r=1.1;export{e as averageLoadingTimeSmoothingFactor,p as defaultTransitionDuration,t as fadeInTime,o as fadeOutTime,r as thresholdForLoadingAllTiles,c as tilesWaitingTime,n as transitionDurationFactor};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../../../Color.js";import{fromValues as
|
|
5
|
+
import t from"../../../../Color.js";import{fromValues as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newFloatArray as r}from"../../../../geometry/support/FloatArray.js";import{newHalfFloatArray as e}from"../../../../geometry/support/HalfFloatArray.js";import{zValueInAbsoluteHeightMode as i}from"../../../../support/elevationInfoUtils.js";import{convertVisualVariables as n,ConvertOptions as s}from"../../layers/support/FastSymbolUpdates.js";import{animatedLineStripsToParameters as a,createGeometry as l}from"../engineContent/line.js";import{valuesPerFlowVertex as p}from"./loadUtils.js";import{drapedZ as m}from"../../terrain/OverlayRenderer.js";function c(t,o,{vertices:i,stage:n,hasMagnitude:s},c,f,d){const{spatialReference:v}=o.extent,y=[],g=p(s);for(let r=0;r<i.length;r+=g){const e=[i[r],i[r+1]],[n,s]=u(e,o),a=d?[n,s,m]:h(n,s,v,t,c);y.push(a)}const j=Math.floor(i.length/g),V=e(j);for(let r=0;r<j;r++)V[r]=i[r*g+2];const{hasVVColor:S,hasVVOpacity:C,hasVVSize:b}=f.parameters;let x,z,w;if(s&&(S||C||b)){const t=r(j);for(let o=0;o<j;o++)t[o]=i[o*g+3];S&&(x=[t]),C&&(z=[t]),b&&(w=[t])}const R=a([y],void 0,[{timeStamps:V,streamlineType:n}],x,z,w);return l(f,R[0])}function f(o,r,e){if(null==o)return{};let i=null;if(o.visualVariables){const t=[],r=o.visualVariables,e=new s({supports:{size:!0,color:!0,rotation:!1,opacity:!0}});i=n(r,e,t)}const a=i?.color?[1,1,1,1]:t.toUnitRGBA(o.color);a[3]*=r;return{color:a,width:o.trailWidth,cap:2,animationSpeed:o.flowSpeed,trailLength:o.trailLength,animation:3,emissiveStrength:e,vvColor:i?.color,vvOpacity:i?.opacity,vvSize:i?.size}}function u([t,o],r){const{extent:e,size:[i,n]}=r;return[t/i*e.width+e.xmin,(n-o)/n*e.height+e.ymin]}function h(t,r,e,n,s){const{absoluteZ:a}=i(t,r,0,e,n,s),l=o(t,r,a);return n.renderCoordsHelper.toRenderCoords(l,e,l),l}export{c as createStreamlineGeometry,f as materialParametersFromRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{makeScheduleFunction as s}from"../../layers/support/makeScheduleFunction.js";import{GaussianSplatSortWorkerHandle as r}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatOrderTexture as t}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as i}from"./GaussianSplatTextureAtlas.js";class a{constructor(e){this.visibleGaussians=0,this._visibleGaussianTiles=new Array,this._workerHandle=null,this._isSorting=!1,this._pendingSortTask=!1,this._bufferCapacity=0,this._renderer=e,this._orderTexture=new t(this._renderer.renderingContext),this._textureAtlas=new i(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache);const{resourceController:a}=this._renderer.view;this._workerHandle=new r(s(a))}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get visibleGaussianTiles(){return this._visibleGaussianTiles}updateGaussianVisibility(e){this._visibleGaussianTiles=e,this.requestSort()}requestSort(){this._isSorting?this._pendingSortTask=!0:(this._isSorting=!0,this._pendingSortTask=!1,this._sortOnWorker().then(()=>{this._isSorting=!1,this._pendingSortTask&&this.requestSort()}).catch(()=>{this._isSorting=!1,this._pendingSortTask&&this.requestSort()}))}destroy(){this._workerHandle?.destroyWorkerAndSelf(),this._textureAtlas.destroy(),this._orderTexture.destroy()}_clearBuffersAndTextures(){this._bufferCapacity=0,this._orderTexture.clear(),this._textureAtlas.clear()}_ensureBufferCapacity(s){if(this._bufferCapacity<s){const r=Math.ceil(s*e);this._atlasIndicesBuffer=new Uint32Array(r),this._sortedAtlasIndicesBuffer=new Uint32Array(r),this._bufferCapacity=r}}async _sortOnWorker(){let e=0;if(this._visibleGaussianTiles.forEach(s=>e+=s.gaussianAtlasIndices.length),0===e
|
|
5
|
+
import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{makeScheduleFunction as s}from"../../layers/support/makeScheduleFunction.js";import{GaussianSplatSortWorkerHandle as r}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatOrderTexture as t}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as i}from"./GaussianSplatTextureAtlas.js";class a{constructor(e){this.visibleGaussians=0,this._visibleGaussianTiles=new Array,this._workerHandle=null,this._isSorting=!1,this._pendingSortTask=!1,this._bufferCapacity=0,this._renderer=e,this._orderTexture=new t(this._renderer.renderingContext),this._textureAtlas=new i(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache);const{resourceController:a}=this._renderer.view;this._workerHandle=new r(s(a))}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get visibleGaussianTiles(){return this._visibleGaussianTiles}updateGaussianVisibility(e){this._visibleGaussianTiles=e,this.requestSort()}requestSort(){this._isSorting?this._pendingSortTask=!0:(this._isSorting=!0,this._pendingSortTask=!1,this._sortOnWorker().then(()=>{this._isSorting=!1,this._pendingSortTask&&this.requestSort()}).catch(()=>{this._isSorting=!1,this._pendingSortTask&&this.requestSort()}))}destroy(){this._workerHandle?.destroyWorkerAndSelf(),this._textureAtlas.destroy(),this._orderTexture.destroy()}_clearBuffersAndTextures(){this._bufferCapacity=0,this._orderTexture.clear(),this._textureAtlas.clear()}_ensureBufferCapacity(s){if(this._bufferCapacity<s){const r=Math.ceil(s*e);this._atlasIndicesBuffer=new Uint32Array(r),this._sortedAtlasIndicesBuffer=new Uint32Array(r),this._bufferCapacity=r}}async _sortOnWorker(){let e=0;if(this._visibleGaussianTiles.forEach(s=>e+=s.gaussianAtlasIndices.length),0===e)return this.visibleGaussians=0,this._clearBuffersAndTextures(),void this._renderer.requestRender(1);this._ensureBufferCapacity(e),this._textureAtlas.ensureTextureAtlas();const s=this._renderer.camera.ray.direction,r=s[0],t=s[1],i=s[2],n=1/Math.sqrt(r*r+t*t+i*i),o=r*n,l=t*n,u=i*n,h=this._atlasIndicesBuffer.subarray(0,e),d=new Float64Array(e);let _=0;this._visibleGaussianTiles.forEach(e=>{const s=e.gaussianAtlasIndices,r=e.positions;for(let t=0;t<s.length;t++){h[_]=s[t];const e=3*t,i=r[e],a=r[e+1],n=r[e+2];d[_]=i*o+a*l+n*u,_++}});const c=new Uint32Array(e);for(let a=0;a<e;a++)c[a]=a;const f={distances:d,sortOrderIndices:c};await(this._workerHandle?.sort(f).then(s=>{const r=this._sortedAtlasIndicesBuffer.subarray(0,e);for(let t=0;t<e;t++)r[t]=h[s.sortedOrderIndices[t]];this._orderTexture.setData(r,e),this.visibleGaussians=Math.min(e,a.maxAllowedVisibleGaussians),this._renderer.requestRender(1)}))}static{this.maxAllowedVisibleGaussians=4194304}}export{a as GaussianSplatDataStore};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
const i=new Map([["low",{minimumSplatPixelRadius:2,minimumOpacity:.05}],["medium",{minimumSplatPixelRadius:1,minimumOpacity:.02}],["high",{minimumSplatPixelRadius:.5,minimumOpacity:.005}]]);function m(m){return i.get(m)}export{m as getGaussianSplatQualitySettings};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{reallocGrowthFactor as t}from"../../../../core/arrayUtils.js";import"../../../webgl/BufferObject.js";import{FramebufferObject as e}from"../../../webgl/FramebufferObject.js";import"../../../webgl/Program.js";import"../../../../core/has.js";import"../../../webgl/Renderbuffer.js";import{Texture as
|
|
5
|
+
import{reallocGrowthFactor as t}from"../../../../core/arrayUtils.js";import"../../../webgl/BufferObject.js";import{FramebufferObject as e}from"../../../webgl/FramebufferObject.js";import"../../../webgl/Program.js";import"../../../../core/has.js";import"../../../webgl/Renderbuffer.js";import{Texture as r}from"../../../webgl/Texture.js";import"../../../../core/Logger.js";import{PixelType as s,SizedPixelFormat as a}from"../../../webgl/enums.js";import"../../../webgl/checkWebGLError.js";import{initialSplatAtlasTextureHeight as i,GaussianSplatAtlasPages as o,splatAtlasTextureWidth as l,elementsPerSplatPage as h}from"./GaussianSplatAtlasPages.js";import{TextureDescriptor as u}from"../../../webgl/TextureDescriptor.js";class p{constructor(t,e,r){this._splatAtlasTextureHeight=i,this.texture=null,this._rctx=t,this._fboCache=r,this.pageAllocator=new o,this._cache=e.newCache("gaussian texture cache",t=>t.dispose())}ensureTextureAtlas(){if(this.texture)return;const t=this._cache.pop("splatTextureAtlas");if(t)return void(this.texture=t);const e=new u;e.height=this._splatAtlasTextureHeight,e.width=l,e.pixelFormat=36249,e.dataType=s.UNSIGNED_INT,e.internalFormat=a.RGBA32UI,e.samplingMode=9728,e.wrapMode=33071,this.texture=new r(this._rctx,e),this._updatePageAllocator()}grow(){if(!this.texture)return this.ensureTextureAtlas(),!1;const r=Math.floor(this._splatAtlasTextureHeight*t);if(r*l>this._rctx.parameters.maxPreferredTexturePixels)return!1;const s=new e(this._rctx,this.texture),a=this._fboCache.acquire(l,r,"gaussian splat atlas resize",11);return this._rctx.blitFramebuffer(s,a.fbo,16384,9728,0,0,l,this._splatAtlasTextureHeight,0,0,l,this._splatAtlasTextureHeight),this.texture?.dispose(),this.texture=a.fbo?.detachColorTexture(),s.dispose(),a.dispose(),this._splatAtlasTextureHeight=r,this._updatePageAllocator(),!0}requestPage(){let t=this.pageAllocator.findFirstFreePage();return null===t&&this.grow()&&(t=this.pageAllocator.findFirstFreePage()),null!==t&&this.pageAllocator.allocate(t),t}freePage(t){this.pageAllocator.free(t)}update(t,e,r){this.ensureTextureAtlas(),this.texture.updateData(0,t,e,h,1,r)}_updatePageAllocator(){const t=l*this._splatAtlasTextureHeight/h;this.pageAllocator.pageCount!==t&&this.pageAllocator.resize(t)}clear(){this.texture&&(this._cache.put("splatTextureAtlas",this.texture),this.texture=null)}destroy(){this._cache.destroy(),this.texture?.dispose()}}export{p as GaussianSplatTextureAtlas};
|
|
@@ -2,17 +2,25 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{glsl as o}from"../../shaderModules/glsl.js";function
|
|
5
|
+
import{glsl as o}from"../../shaderModules/glsl.js";function r(r){r.code.add(o`struct MaskedColor {
|
|
6
6
|
vec4 color;
|
|
7
7
|
bvec4 mask;
|
|
8
|
-
};`)}function
|
|
8
|
+
};`)}function e(e){e.include(r),e.code.add(o`
|
|
9
9
|
MaskedColor createMaskedFromUInt8NaNColor(vec4 color) {
|
|
10
10
|
return MaskedColor(color * ${o.float(1/254)}, equal(color, vec4(255)));
|
|
11
11
|
}
|
|
12
|
-
`)}function c(
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
`)}function c(e){e.include(r),e.code.add(o`vec4 maskedColorSelectOrOne(MaskedColor color) {
|
|
13
|
+
return vec4(
|
|
14
|
+
color.mask.r ? 1.0 : color.color.r,
|
|
15
|
+
color.mask.g ? 1.0 : color.color.g,
|
|
16
|
+
color.mask.b ? 1.0 : color.color.b,
|
|
17
|
+
color.mask.a ? 1.0 : color.color.a
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
MaskedColor multiplyMaskedColors(MaskedColor color1, MaskedColor color2) {
|
|
21
|
+
vec4 masked1 = maskedColorSelectOrOne(color1);
|
|
22
|
+
vec4 masked2 = maskedColorSelectOrOne(color2);
|
|
15
23
|
return MaskedColor(masked1 * masked2, bvec4(ivec4(color1.mask) & ivec4(color2.mask)));
|
|
16
|
-
}`)}function l(
|
|
24
|
+
}`)}function l(e){e.include(r),e.code.add(o`MaskedColor createMaskedFromNaNColor(vec4 color) {
|
|
17
25
|
return MaskedColor(color, isnan(color));
|
|
18
|
-
}`)}export{l as CreateMaskedFromNaNColor,
|
|
26
|
+
}`)}export{l as CreateMaskedFromNaNColor,e as CreateMaskedFromUInt8NaNColor,r as MaskedColorDefinition,c as MultiplyMaskedColors};
|