@arcgis/core 4.34.0-next.34 → 4.34.0-next.35
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/Graphic.js +1 -1
- package/arcade/ArcadeDate.js +1 -1
- package/arcade/ArcadeModuleResolver.js +1 -1
- package/arcade/featureset/actions/GroupBy.js +1 -1
- package/arcade/functions/date.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{28e04ef3575f164f611a.js → 00870a35b254295bc408.js} +1 -1
- package/assets/esri/core/workers/chunks/017adbbb77c9c9b4d49f.js +1 -0
- package/assets/esri/core/workers/chunks/{b4b30a7f1b673461dc55.js → 0997e09fe5b0aba1f804.js} +1 -1
- package/assets/esri/core/workers/chunks/{9bc6d974b0fce9db64ef.js → 15a5a89cd228a9364332.js} +1 -1
- package/assets/esri/core/workers/chunks/{847455bf4fc33d6e6efc.js → 1dc410bc070cabb7198d.js} +1 -1
- package/assets/esri/core/workers/chunks/{94a3474e3f45efa4a4fe.js → 2c816d3a737e39e6eb84.js} +1 -1
- package/assets/esri/core/workers/chunks/2de11a8e5d426c381991.js +1 -0
- package/assets/esri/core/workers/chunks/3a7e43675163f7bed6ac.js +1 -0
- package/assets/esri/core/workers/chunks/40b0c5368b8322498189.js +1 -0
- package/assets/esri/core/workers/chunks/{4778acd0cfaf0cebeec7.js → 439128f23fa091633d2d.js} +1 -1
- package/assets/esri/core/workers/chunks/6000a302369799ea42a6.js +1 -0
- package/assets/esri/core/workers/chunks/{5d0c92aaa5891e6cb8f0.js → 641ca71d7c1a07bde66a.js} +1 -1
- package/assets/esri/core/workers/chunks/646227b500b92999f2c8.js +1 -0
- package/assets/esri/core/workers/chunks/{98f6d4ea026ed96fd3f3.js → 773feb0e0fad26df57ef.js} +1 -1
- package/assets/esri/core/workers/chunks/7b1d14a921d30c95d68b.js +1 -0
- package/assets/esri/core/workers/chunks/{b78d00c4e493086741e1.js → 7d25f57299c642e727a6.js} +1 -1
- package/assets/esri/core/workers/chunks/8b7f6f2d1692b6b6dbd5.js +1 -0
- package/assets/esri/core/workers/chunks/91d48c32bf11ad1405c8.js +1 -0
- package/assets/esri/core/workers/chunks/9228f760129e48585b54.js +1 -0
- package/assets/esri/core/workers/chunks/a36be186ad10200c420c.js +1 -0
- package/assets/esri/core/workers/chunks/aa12ba96fb8c91105473.js +1 -0
- package/assets/esri/core/workers/chunks/{ea240d9e594bfbd8af68.js → aaf696a1026de569c82d.js} +1 -1
- package/assets/esri/core/workers/chunks/b331543767c35e5edcc6.js +1 -0
- package/assets/esri/core/workers/chunks/{7d852617e91b51121ea7.js → ba29c535128c4e8ae2d3.js} +1 -1
- package/assets/esri/core/workers/chunks/bf60d4da0dff1e14da8e.js +1 -0
- package/assets/esri/core/workers/chunks/{39bff604d4b4a1295038.js → c038472cb7f60af9426e.js} +1 -1
- package/assets/esri/core/workers/chunks/{ca46f78aac1133d127fa.js → c1e5e2a6e7e2d7a1d63c.js} +1 -1
- package/assets/esri/core/workers/chunks/{a809042fdce7ced2a415.js → cc3ca1729af33688c1e3.js} +1 -1
- package/assets/esri/core/workers/chunks/cde79c3644166d4798a8.js +1 -0
- package/assets/esri/core/workers/chunks/{181f8bbe670b4468307a.js → ce8f0ed9179c0d314df8.js} +1 -1
- package/assets/esri/core/workers/chunks/{ac30cf2f9a94597f7665.js → d6b2ab614f308db50c4a.js} +2 -2
- package/assets/esri/core/workers/chunks/{abe2cdfc2eda46b00812.js → d9045b964f536695840b.js} +1 -1
- package/assets/esri/core/workers/chunks/dde6000aa2f69f6ecad0.js +1 -0
- package/assets/esri/core/workers/chunks/dec9656997683ef01ba6.js +1 -0
- package/assets/esri/core/workers/chunks/e18bb372457cedbf4f8c.js +1 -0
- package/assets/esri/core/workers/chunks/e892ed8b0b990d7eba28.js +1 -0
- package/assets/esri/core/workers/chunks/{dc5a8cf2a44a5ac201c5.js → ed05399f9a07fea66685.js} +1 -1
- package/config.js +1 -1
- package/core/BidiEngine.js +1 -1
- package/core/Promise.js +1 -1
- package/core/promiseUtils.js +1 -1
- package/core/sql/SqlInterval.js +1 -1
- package/core/sql/sqlDateParsingUtils.js +1 -1
- package/core/unitUtils.js +1 -1
- package/geometry/support/coordinateSystem.js +1 -1
- package/graphic/BuildingGraphicOrigin.d.ts +4 -0
- package/graphic/BuildingGraphicOrigin.js +5 -0
- package/graphic/CSVGraphicOrigin.d.ts +4 -0
- package/graphic/CSVGraphicOrigin.js +5 -0
- package/graphic/CatalogGraphicOrigin.d.ts +4 -0
- package/graphic/CatalogGraphicOrigin.js +5 -0
- package/graphic/FeatureGraphicOrigin.d.ts +4 -0
- package/graphic/FeatureGraphicOrigin.js +5 -0
- package/graphic/GeoJSONGraphicOrigin.d.ts +4 -0
- package/graphic/GeoJSONGraphicOrigin.js +5 -0
- package/graphic/GraphicOrigin.d.ts +4 -0
- package/graphic/GraphicOrigin.js +5 -0
- package/graphic/IntegratedMesh3DTilesGraphicOrigin.d.ts +4 -0
- package/graphic/IntegratedMesh3DTilesGraphicOrigin.js +5 -0
- package/graphic/IntegratedMeshGraphicOrigin.d.ts +4 -0
- package/graphic/IntegratedMeshGraphicOrigin.js +5 -0
- package/graphic/OGCFeatureGraphicOrigin.d.ts +4 -0
- package/graphic/OGCFeatureGraphicOrigin.js +5 -0
- package/graphic/PointCloudGraphicOrigin.d.ts +4 -0
- package/graphic/PointCloudGraphicOrigin.js +5 -0
- package/graphic/SceneGraphicOrigin.d.ts +4 -0
- package/graphic/SceneGraphicOrigin.js +5 -0
- package/graphic/StreamGraphicOrigin.d.ts +4 -0
- package/graphic/StreamGraphicOrigin.js +5 -0
- package/graphic/VectorTileGraphicOrigin.d.ts +4 -0
- package/graphic/VectorTileGraphicOrigin.js +5 -0
- package/graphic/VoxelGraphicOrigin.d.ts +4 -0
- package/graphic/VoxelGraphicOrigin.js +5 -0
- package/graphic/WFSGraphicOrigin.d.ts +4 -0
- package/graphic/WFSGraphicOrigin.js +5 -0
- package/graphic/graphicOriginUtils.js +5 -0
- package/graphic/graphicOrigins.d.ts +14 -0
- package/graphic/graphicOrigins.js +5 -0
- package/graphic/isBuildingGraphicOrigin.js +5 -0
- package/graphic/isCSVGraphicOrigin.js +5 -0
- package/graphic/isCatalogGraphicOrigin.js +5 -0
- package/graphic/isFeatureGraphicOrigin.js +5 -0
- package/graphic/isGeoJSONGraphicOrigin.js +5 -0
- package/graphic/isIntegratedMesh3DTilesGraphicOrigin.js +5 -0
- package/graphic/isIntegratedMeshGraphicOrigin.js +5 -0
- package/graphic/isOGCFeatureGraphicOrigin.js +5 -0
- package/graphic/isPointCloudGraphicOrigin.js +5 -0
- package/graphic/isSceneGraphicOrigin.js +5 -0
- package/graphic/isStreamGraphicOrigin.js +5 -0
- package/graphic/isVectorTileGraphicOrigin.js +5 -0
- package/graphic/isVoxelGraphicOrigin.js +5 -0
- package/graphic/isWFSGraphicOrigin.js +5 -0
- package/interfaces.d.ts +354 -13
- package/kernel.js +1 -1
- package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
- package/layers/support/Field.js +1 -1
- package/layers/support/featurePopupQueryUtils.js +1 -1
- package/layers/voxel/NCTimeParser.js +1 -1
- package/package.json +1 -1
- package/rest/knowledgeGraphService.js +1 -1
- package/smartMapping/statistics/support/utils.js +1 -1
- package/support/arcadeExpressionUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/support/svgUtils.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileFeatureIndex.js +1 -1
- package/views/2d/engine/webgl/FeatureDisplayList.js +1 -1
- package/views/2d/engine/webgl/Painter.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/segmentUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelTechnique.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/VectorTileLayerView2D.js +1 -1
- package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/CutFillVolumeMeasurementComputation.js +5 -0
- package/views/3d/analysis/VolumeMeasurement/CutFillVolumeMeasurementController.js +1 -1
- package/views/3d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles3D.js +1 -1
- package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
- package/views/3d/layers/CSVLayerView3D.js +1 -1
- package/views/3d/layers/CatalogFootprintLayerView3D.js +1 -1
- package/views/3d/layers/FeatureLayerView3D.js +1 -1
- package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/GeoJSONLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
- package/views/3d/layers/OGCFeatureLayerView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/SceneLayerView3D.js +1 -1
- package/views/3d/layers/StreamLayerView3D.js +1 -1
- package/views/3d/layers/WFSLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
- package/views/3d/layers/graphics/StreamController.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +1 -1
- package/views/3d/layers/graphics/pipeline/Tile3DManager.js +1 -1
- package/views/3d/layers/support/FeatureTileDescriptor.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3DContext.js +1 -1
- package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
- package/views/3d/layers/support/FeatureTileTree3D.js +1 -1
- package/views/3d/layers/support/FeatureTileTree3DDebugger.js +1 -1
- package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
- package/views/3d/layers/support/Tiles3DIntersectionHandler.js +1 -1
- package/views/3d/state/ConstraintsManager.js +1 -1
- package/views/3d/support/flow/geometryUtils.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/interactive/Tooltip.js +1 -1
- package/views/layers/FeatureLayerView.js +1 -1
- package/views/layers/support/popupUtils.js +1 -1
- package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
- package/assets/esri/core/workers/chunks/07b2cc0f6b064277632f.js +0 -1
- package/assets/esri/core/workers/chunks/13f9e92e7e5d44d9f95c.js +0 -1
- package/assets/esri/core/workers/chunks/140efe4735605258ecc9.js +0 -1
- package/assets/esri/core/workers/chunks/2b76e716f478468b6798.js +0 -1
- package/assets/esri/core/workers/chunks/386ab72a45102c2d47f2.js +0 -1
- package/assets/esri/core/workers/chunks/3fb6146d914f9b410c2e.js +0 -1
- package/assets/esri/core/workers/chunks/432365fcd7becd508541.js +0 -1
- package/assets/esri/core/workers/chunks/439ce953a25b2776cb7f.js +0 -1
- package/assets/esri/core/workers/chunks/4c8d2334fcdb1354ff43.js +0 -1
- package/assets/esri/core/workers/chunks/5f321be63ed5447b04a1.js +0 -1
- package/assets/esri/core/workers/chunks/6006fbdb90c3bfc493a6.js +0 -1
- package/assets/esri/core/workers/chunks/700c641347853b1034d9.js +0 -1
- package/assets/esri/core/workers/chunks/7c35c61e3673cf94cdfd.js +0 -1
- package/assets/esri/core/workers/chunks/7c75876a0c6460585055.js +0 -1
- package/assets/esri/core/workers/chunks/949dc266ac6f3505d357.js +0 -1
- package/assets/esri/core/workers/chunks/a84af1b8b64b86b49bd3.js +0 -1
- package/assets/esri/core/workers/chunks/a9d83a442d8d7a376fc0.js +0 -1
- package/assets/esri/core/workers/chunks/ba1b21a90b257ac9a342.js +0 -1
- package/assets/esri/core/workers/chunks/f9ad37dfbe1d14c6a352.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{clone as t}from"../../../core/lang.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{isAbortError as r}from"../../../core/promiseUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{diff as n,hasDiff as o}from"../../../core/accessorSupport/diffUtils.js";import h from"../../../geometry/Point.js";import{create as u}from"../../../geometry/support/aaBoundingRect.js";import{equals as y}from"../../../geometry/support/spatialReferenceUtils.js";import{TileHandler as c}from"../engine/vectorTiles/TileHandler.js";import{TileManager as d}from"../engine/vectorTiles/TileManager.js";import{VectorTile as p}from"../engine/vectorTiles/VectorTile.js";import{VectorTileContainer as _}from"../engine/vectorTiles/VectorTileContainer.js";import f from"../engine/vectorTiles/VectorTileFeatureIndex.js";import g from"../engine/vectorTiles/style/StyleRepository.js";import{LayerView2DMixin as m}from"./LayerView2D.js";import T from"../tiling/TileInfoViewPOT.js";import C from"../tiling/TileQueue.js";import v from"../../layers/LayerView.js";import w from"../../layers/RefreshableLayerView.js";import{TaskPriority as R}from"../../support/Scheduler.js";const H=2,I=8,Q=512;let S=class extends(w(m(v))){constructor(){super(...arguments),this._styleChanges=[],this._fetchQueue=null,this._parseQueue=null,this._tileHandlerPromise=null,this._isTileHandlerReady=!1,this._styeChanged=!1,this._spriteSourceChanged=!1}get fading(){return this._vectorTileContainer?.fading??!1}get hasVisibleFeatures(){const e=this._vectorTileContainer.children;for(const t of e)if(t.hasFeatures())return!0;return!1}get spriteSourceChanged(){return this._spriteSourceChanged}get styleChanged(){return this._styeChanged}async hitTest(e,t){const i=this._tileHandlerPromise,s=this._vectorTileContainer?.symbolFader;if(!i||!this._isTileHandlerReady||!s)return;await i;let r=null;const a=this._vectorTileContainer?.symbolRepository;a&&(r=a.querySymbols(t,H,s.decluttererOffset,{}));const l=this.view.state,n=this._tileManager.getIntersectingTiles(t.x,t.y,H,l,r);if((!n||0===n.length)&&0===r?.length)return null;e=e.clone().normalize();const o=[],h=[];for(const u of n)o.push(this._queryTile(h,e,H,this.view.state.rotation,u,r?.filter(e=>e.tileKey.id===u.id)));return await Promise.all(o),h}update(e){if(this._tileHandlerPromise&&this._isTileHandlerReady)return e.pixelRatio!==this._tileHandler.devicePixelRatio?(this._tileHandler.devicePixelRatio=e.pixelRatio,void this._loadStyle()):void(this._styleChanges.length>0?this._tileHandlerPromise=this._applyStyleChanges():(this._pauseQueues(),this._fetchQueue.state=e.state,this._parseQueue.state=e.state,this._tileManager.update(e)||this.requestUpdate(),this._resumeQueues()))}attach(){const{style:e}=this.layer.currentStyleInfo;this._styleRepository=new g(e),this._tileInfoView=new T(this.layer.tileInfo,this.layer.fullExtent),this._vectorTileContainer=new _(this._tileInfoView),this._tileHandler=new c(this.layer,this._styleRepository,window.devicePixelRatio||1,this.layer.tileInfo.lods.length-1),this.container.addChild(this._vectorTileContainer),this._start(),this.addAttachHandles([this.layer.on("paint-change",e=>{if(this._styeChanged=!0,e.isDataDriven)this._styleChanges.push({type:0,data:e}),this.requestUpdate();else{const t=this._styleRepository,i=t.getLayerById(e.layer);if(!i)return;const s=3===i.type;t.setPaintProperties(e.layer,e.paint),s&&this._vectorTileContainer?.restartDeclutter(),this._vectorTileContainer?.requestRender()}}),this.layer.on("layout-change",e=>{const t=this._styleRepository,i=t.getLayerById(e.layer);if(!i)return;this._styeChanged=!0;const s=n(i.layout,e.layout);if(null!=s){if(o(s,"visibility")&&1===P(s))return t.setLayoutProperties(e.layer,e.layout),3===i.type&&this._vectorTileContainer?.restartDeclutter(),void this._vectorTileContainer?.requestRender();this._styleChanges.push({type:1,data:e}),this.requestUpdate()}}),this.layer.on("style-layer-visibility-change",e=>{const t=this._styleRepository,i=t.getLayerById(e.layer);i&&(this._styeChanged=!0,t.setStyleLayerVisibility(e.layer,e.visibility),3===i.type&&this._vectorTileContainer?.restartDeclutter(),this._vectorTileContainer?.requestRender())}),this.layer.on("style-layer-change",e=>{this._styleChanges.push({type:2,data:e}),this._styeChanged=!0,this.requestUpdate()}),this.layer.on("delete-style-layer",e=>{this._styleChanges.push({type:3,data:e}),this._styeChanged=!0,this.requestUpdate()}),this.layer.on("load-style",()=>this._loadStyle()),this.layer.on("spriteSource-change",e=>{this._spriteSourceChanged=!0,this._styleChanges.push({type:4,data:e});const t=this._styleRepository.layers;for(const i of t)switch(i.type){case 3:i.getLayoutProperty("icon-image")&&this._styleChanges.push({type:1,data:{layer:i.id,layout:i.layout}});break;case 2:i.getPaintProperty("line-pattern")&&this._styleChanges.push({type:0,data:{layer:i.id,paint:i.paint,isDataDriven:i.isPainterDataDriven()}});break;case 1:i.getLayoutProperty("fill-pattern")&&this._styleChanges.push({type:0,data:{layer:i.id,paint:i.paint,isDataDriven:i.isPainterDataDriven()}})}this.requestUpdate()})])}detach(){this._stop(),this.container.removeAllChildren(),this._vectorTileContainer=s(this._vectorTileContainer),this._tileHandler=s(this._tileHandler)}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}supportsSpatialReference(e){return y(this.layer.tileInfo?.spatialReference,e)}canResume(){let e=super.canResume();const{currentStyleInfo:t}=this.layer;if(e&&t?.layerDefinition){const i=this.view.scale,{minScale:s,maxScale:r}=t.layerDefinition;t?.layerDefinition&&(s&&s<i&&(e=!1),r&&r>i&&(e=!1))}return e}isUpdating(){return this.fading}acquireTile(e){const t=this._createVectorTile(e);return this._updatingHandles.addPromise(this._fetchQueue.push(t.key).then(e=>this._parseQueue.push({key:t.key,data:e})).then(e=>{t.once("attach",()=>this.requestUpdate()),t.setData(e),this.requestUpdate()}).catch(e=>{r(e)||i.getLogger(this).error(e)})),t}releaseTile(e){const t=e.key.id;this._fetchQueue.abort(t),this._parseQueue.abort(t),this.requestUpdate()}async doRefresh(){if(!this.attached)return;if(this.suspended)return this._tileManager.clear(),void this.requestUpdate();this._isTileHandlerReady=!1,this._pauseQueues(),this._clearQueues(),this._tileManager.clearCache(),this._resumeQueues();const e=this._vectorTileContainer.children,t=[];try{for(const i of e){const e=this._updatingHandles.addPromise(this._fetchQueue.push(i.key).then(e=>this._parseQueue.push({key:i.key,data:e})).then(e=>i.setData(e)).finally(()=>i.featureIndex=null));t.push(e)}await Promise.all(t)}catch(s){i.getLogger(this).error("error refreshing vector-tiles layer-view",s),this._resumeQueues(),this._isTileHandlerReady=!0}this._isTileHandlerReady=!0,this.requestUpdate()}_start(){if(this._stop(),this._tileManager=new d({acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView},this._vectorTileContainer),!this.layer.currentStyleInfo)return;const e=new AbortController,t=this._tileHandler.start({signal:e.signal}).then(()=>{this._fetchQueue=new C({tileInfoView:this._tileInfoView,process:(e,t)=>this._getTileData(e,t),concurrency:15,scheduler:this.scheduler,priority:R.MAPVIEW_FETCH_QUEUE}),this._parseQueue=new C({tileInfoView:this._tileInfoView,process:(e,t)=>this._parseTileData(e,t),concurrency:8,scheduler:this.scheduler,priority:R.MAPVIEW_VECTOR_TILE_PARSING_QUEUE}),this.requestUpdate(),this._isTileHandlerReady=!0});this._tileHandler.spriteMosaic.then(e=>{this._vectorTileContainer.setStyleResources(e,this._tileHandler.glyphMosaic,this._styleRepository,this._tileInfoView),this.requestUpdate()}),this._tileHandlerAbortController=e,this._tileHandlerPromise=t}_stop(){if(!this._tileHandlerAbortController||!this._vectorTileContainer)return;const e=this._tileHandlerAbortController;e&&e.abort(),this._tileHandlerPromise=null,this._isTileHandlerReady=!1,this._fetchQueue=s(this._fetchQueue),this._parseQueue=s(this._parseQueue),this._tileManager=s(this._tileManager),this._vectorTileContainer.removeAllChildren()}async _getTileData(e,t){return this._tileHandler.fetchTileData(e,t)}async _parseTileData(e,t){return this._tileHandler.parseTileData(e,t)}async _applyStyleChanges(){this._isTileHandlerReady=!1,this._pauseQueues(),this._clearQueues(),this._tileManager.clearCache();const e=this._styleChanges;try{await this._tileHandler.updateStyle(e)}catch(l){i.getLogger(this).error("error applying vector-tiles style update",l.message),this._resumeQueues(),this._isTileHandlerReady=!0}const t=this._styleRepository,s=new Set;e.forEach(e=>{if(3!==e.type)return;const i=e.data,r=t.getLayerById(i.layer);r&&s.add(r.uid)});const r=new Set;e.forEach(e=>{let i;switch(e.type){case 0:t.setPaintProperties(e.data.layer,e.data.paint),i=e.data.layer;break;case 1:t.setLayoutProperties(e.data.layer,e.data.layout),i=e.data.layer;break;case 3:return void t.deleteStyleLayer(e.data.layer);case 2:t.setStyleLayer(e.data.layer,e.data.index),i=e.data.layer.id;break;case 4:this._vectorTileContainer.setSpriteMosaic(this._tileHandler.setSpriteSource(e.data.spriteSource))}if(i){const e=t.getLayerById(i);e&&r.add(e.uid)}});const a=this._vectorTileContainer.children;if(s.size>0){const e=Array.from(s);this._vectorTileContainer.deleteStyleLayers(e);for(const t of a)t.deleteLayerData(e)}if(this._resumeQueues(),r.size>0){const e=Array.from(r),t=[];for(const i of a){const s=this._updatingHandles.addPromise(this._fetchQueue.push(i.key).then(t=>this._parseQueue.push({key:i.key,data:t,styleLayerUIDs:e})).then(e=>i.setData(e)).finally(()=>i.featureIndex=null));t.push(s)}await Promise.all(t)}this._styleChanges=[],this._isTileHandlerReady=!0,this.requestUpdate()}async _loadStyle(){const{style:e}=this.layer.currentStyleInfo,i=t(e);this._isTileHandlerReady=!1,this._pauseQueues(),this._clearQueues(),this._styleRepository=new g(i),this._vectorTileContainer.destroy(),this._tileManager.clear(),this._tileHandlerAbortController.abort(),this._tileHandlerAbortController=new AbortController;const{signal:s}=this._tileHandlerAbortController;try{this._tileHandlerPromise=this._tileHandler.setStyle(this._styleRepository,i,this.layer.tileInfo.lods.length-1),await this._tileHandlerPromise}catch(n){if(!r(n))throw n}if(s.aborted)return this._resumeQueues(),this._isTileHandlerReady=!0,this._styeChanged=!1,this._spriteSourceChanged=!1,void this.requestUpdate();const a=await this._tileHandler.spriteMosaic,l=this._vectorTileContainer;this._tileInfoView=new T(this.layer.tileInfo,this.layer.fullExtent),l.setStyleResources(a,this._tileHandler.glyphMosaic,this._styleRepository,this._tileInfoView),this._tileManager=new d({acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView},this._vectorTileContainer),this._resumeQueues(),this._isTileHandlerReady=!0,this.requestUpdate(),this._styeChanged=!1,this._spriteSourceChanged=!1}_createVectorTile(e){const t=this._tileInfoView.getTileBounds(u(),e),i=this._tileInfoView.getTileResolution(e.level);return new p(e,i,t[0],t[3],512,512,this._styleRepository)}async _queryTile(e,t,i,s,r,a){if(0===r.layerData.size)return;const l=this._ensureTileIndex(r),n=this._tileInfoView.getTileBounds(u(),r.key,!0),o=I*Q*((t.x-n[0])/(n[2]-n[0])),h=I*Q*(1-(t.y-n[1])/(n[3]-n[1])),y=await l.queryAttributes(o,h,i,s,a);for(const u of y)u.graphic.geometry=this._tileToMapPoint(u.tilePoint,r.transforms.tileUnitsToPixels),e.push({type:"graphic",layer:this.layer,graphic:u.graphic,mapPoint:t.clone()});e.sort((e,t)=>t.graphic.origin.layerIndex-e.graphic.origin.layerIndex)}_tileToMapPoint(e,t){if(!e)return null;const i=e[0]*t[0]+e[1]*t[3]+t[6],s=e[0]*t[1]+e[1]*t[4]+t[7],r=this.view.state,a=[0,0];return r.toMap(a,[i,s]),new h({x:a[0],y:a[1],spatialReference:r.spatialReference})}_ensureTileIndex(e){let t=e.featureIndex;return t||(t=f.create(e.key,e.layerData,this._styleRepository,this._tileHandler,this.layer),e.featureIndex=t),t}_pauseQueues(){this._fetchQueue.pause(),this._parseQueue.pause()}_resumeQueues(){this._fetchQueue.resume(),this._parseQueue.resume()}_clearQueues(){this._fetchQueue.clear(),this._parseQueue.clear()}};function P(e){if(null==e)return 0;switch(e.type){case"partial":return Object.keys(e.diff).length;case"complete":return Math.max(Object.keys(e.oldValue).length,Object.keys(e.newValue).length);case"collection":return Object.keys(e.added).length+Object.keys(e.changed).length+Object.keys(e.removed).length}}e([a()],S.prototype,"_isTileHandlerReady",void 0),S=e([l("esri.views.2d.layers.VectorTileLayerView2D")],S);const b=S;export{b as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import{clone as t}from"../../../core/lang.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{isAbortError as r}from"../../../core/promiseUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{diff as n,hasDiff as o}from"../../../core/accessorSupport/diffUtils.js";import h from"../../../geometry/Point.js";import{create as u}from"../../../geometry/support/aaBoundingRect.js";import{equals as c}from"../../../geometry/support/spatialReferenceUtils.js";import{isVectorTileGraphicOrigin as y}from"../../../graphic/isVectorTileGraphicOrigin.js";import{TileHandler as d}from"../engine/vectorTiles/TileHandler.js";import{TileManager as p}from"../engine/vectorTiles/TileManager.js";import{VectorTile as _}from"../engine/vectorTiles/VectorTile.js";import{VectorTileContainer as f}from"../engine/vectorTiles/VectorTileContainer.js";import g from"../engine/vectorTiles/VectorTileFeatureIndex.js";import m from"../engine/vectorTiles/style/StyleRepository.js";import{LayerView2DMixin as T}from"./LayerView2D.js";import C from"../tiling/TileInfoViewPOT.js";import v from"../tiling/TileQueue.js";import w from"../../layers/LayerView.js";import R from"../../layers/RefreshableLayerView.js";import{TaskPriority as H}from"../../support/Scheduler.js";const I=2,Q=8,S=512;let P=class extends(R(T(w))){constructor(){super(...arguments),this._styleChanges=[],this._fetchQueue=null,this._parseQueue=null,this._tileHandlerPromise=null,this._isTileHandlerReady=!1,this._styeChanged=!1,this._spriteSourceChanged=!1}get fading(){return this._vectorTileContainer?.fading??!1}get hasVisibleFeatures(){const e=this._vectorTileContainer.children;for(const t of e)if(t.hasFeatures())return!0;return!1}get spriteSourceChanged(){return this._spriteSourceChanged}get styleChanged(){return this._styeChanged}async hitTest(e,t){const i=this._tileHandlerPromise,s=this._vectorTileContainer?.symbolFader;if(!i||!this._isTileHandlerReady||!s)return;await i;let r=null;const a=this._vectorTileContainer?.symbolRepository;a&&(r=a.querySymbols(t,I,s.decluttererOffset,{}));const l=this.view.state,n=this._tileManager.getIntersectingTiles(t.x,t.y,I,l,r);if((!n||0===n.length)&&0===r?.length)return null;e=e.clone().normalize();const o=[],h=[];for(const u of n)o.push(this._queryTile(h,e,I,this.view.state.rotation,u,r?.filter(e=>e.tileKey.id===u.id)));return await Promise.all(o),h}update(e){if(this._tileHandlerPromise&&this._isTileHandlerReady)return e.pixelRatio!==this._tileHandler.devicePixelRatio?(this._tileHandler.devicePixelRatio=e.pixelRatio,void this._loadStyle()):void(this._styleChanges.length>0?this._tileHandlerPromise=this._applyStyleChanges():(this._pauseQueues(),this._fetchQueue.state=e.state,this._parseQueue.state=e.state,this._tileManager.update(e)||this.requestUpdate(),this._resumeQueues()))}attach(){const{style:e}=this.layer.currentStyleInfo;this._styleRepository=new m(e),this._tileInfoView=new C(this.layer.tileInfo,this.layer.fullExtent),this._vectorTileContainer=new f(this._tileInfoView),this._tileHandler=new d(this.layer,this._styleRepository,window.devicePixelRatio||1,this.layer.tileInfo.lods.length-1),this.container.addChild(this._vectorTileContainer),this._start(),this.addAttachHandles([this.layer.on("paint-change",e=>{if(this._styeChanged=!0,e.isDataDriven)this._styleChanges.push({type:0,data:e}),this.requestUpdate();else{const t=this._styleRepository,i=t.getLayerById(e.layer);if(!i)return;const s=3===i.type;t.setPaintProperties(e.layer,e.paint),s&&this._vectorTileContainer?.restartDeclutter(),this._vectorTileContainer?.requestRender()}}),this.layer.on("layout-change",e=>{const t=this._styleRepository,i=t.getLayerById(e.layer);if(!i)return;this._styeChanged=!0;const s=n(i.layout,e.layout);if(null!=s){if(o(s,"visibility")&&1===b(s))return t.setLayoutProperties(e.layer,e.layout),3===i.type&&this._vectorTileContainer?.restartDeclutter(),void this._vectorTileContainer?.requestRender();this._styleChanges.push({type:1,data:e}),this.requestUpdate()}}),this.layer.on("style-layer-visibility-change",e=>{const t=this._styleRepository,i=t.getLayerById(e.layer);i&&(this._styeChanged=!0,t.setStyleLayerVisibility(e.layer,e.visibility),3===i.type&&this._vectorTileContainer?.restartDeclutter(),this._vectorTileContainer?.requestRender())}),this.layer.on("style-layer-change",e=>{this._styleChanges.push({type:2,data:e}),this._styeChanged=!0,this.requestUpdate()}),this.layer.on("delete-style-layer",e=>{this._styleChanges.push({type:3,data:e}),this._styeChanged=!0,this.requestUpdate()}),this.layer.on("load-style",()=>this._loadStyle()),this.layer.on("spriteSource-change",e=>{this._spriteSourceChanged=!0,this._styleChanges.push({type:4,data:e});const t=this._styleRepository.layers;for(const i of t)switch(i.type){case 3:i.getLayoutProperty("icon-image")&&this._styleChanges.push({type:1,data:{layer:i.id,layout:i.layout}});break;case 2:i.getPaintProperty("line-pattern")&&this._styleChanges.push({type:0,data:{layer:i.id,paint:i.paint,isDataDriven:i.isPainterDataDriven()}});break;case 1:i.getLayoutProperty("fill-pattern")&&this._styleChanges.push({type:0,data:{layer:i.id,paint:i.paint,isDataDriven:i.isPainterDataDriven()}})}this.requestUpdate()})])}detach(){this._stop(),this.container.removeAllChildren(),this._vectorTileContainer=s(this._vectorTileContainer),this._tileHandler=s(this._tileHandler)}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}supportsSpatialReference(e){return c(this.layer.tileInfo?.spatialReference,e)}canResume(){let e=super.canResume();const{currentStyleInfo:t}=this.layer;if(e&&t?.layerDefinition){const i=this.view.scale,{minScale:s,maxScale:r}=t.layerDefinition;t?.layerDefinition&&(s&&s<i&&(e=!1),r&&r>i&&(e=!1))}return e}isUpdating(){return this.fading}acquireTile(e){const t=this._createVectorTile(e);return this._updatingHandles.addPromise(this._fetchQueue.push(t.key).then(e=>this._parseQueue.push({key:t.key,data:e})).then(e=>{t.once("attach",()=>this.requestUpdate()),t.setData(e),this.requestUpdate()}).catch(e=>{r(e)||i.getLogger(this).error(e)})),t}releaseTile(e){const t=e.key.id;this._fetchQueue.abort(t),this._parseQueue.abort(t),this.requestUpdate()}async doRefresh(){if(!this.attached)return;if(this.suspended)return this._tileManager.clear(),void this.requestUpdate();this._isTileHandlerReady=!1,this._pauseQueues(),this._clearQueues(),this._tileManager.clearCache(),this._resumeQueues();const e=this._vectorTileContainer.children,t=[];try{for(const i of e){const e=this._updatingHandles.addPromise(this._fetchQueue.push(i.key).then(e=>this._parseQueue.push({key:i.key,data:e})).then(e=>i.setData(e)).finally(()=>i.featureIndex=null));t.push(e)}await Promise.all(t)}catch(s){i.getLogger(this).error("error refreshing vector-tiles layer-view",s),this._resumeQueues(),this._isTileHandlerReady=!0}this._isTileHandlerReady=!0,this.requestUpdate()}_start(){if(this._stop(),this._tileManager=new p({acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView},this._vectorTileContainer),!this.layer.currentStyleInfo)return;const e=new AbortController,t=this._tileHandler.start({signal:e.signal}).then(()=>{this._fetchQueue=new v({tileInfoView:this._tileInfoView,process:(e,t)=>this._getTileData(e,t),concurrency:15,scheduler:this.scheduler,priority:H.MAPVIEW_FETCH_QUEUE}),this._parseQueue=new v({tileInfoView:this._tileInfoView,process:(e,t)=>this._parseTileData(e,t),concurrency:8,scheduler:this.scheduler,priority:H.MAPVIEW_VECTOR_TILE_PARSING_QUEUE}),this.requestUpdate(),this._isTileHandlerReady=!0});this._tileHandler.spriteMosaic.then(e=>{this._vectorTileContainer.setStyleResources(e,this._tileHandler.glyphMosaic,this._styleRepository,this._tileInfoView),this.requestUpdate()}),this._tileHandlerAbortController=e,this._tileHandlerPromise=t}_stop(){if(!this._tileHandlerAbortController||!this._vectorTileContainer)return;const e=this._tileHandlerAbortController;e&&e.abort(),this._tileHandlerPromise=null,this._isTileHandlerReady=!1,this._fetchQueue=s(this._fetchQueue),this._parseQueue=s(this._parseQueue),this._tileManager=s(this._tileManager),this._vectorTileContainer.removeAllChildren()}async _getTileData(e,t){return this._tileHandler.fetchTileData(e,t)}async _parseTileData(e,t){return this._tileHandler.parseTileData(e,t)}async _applyStyleChanges(){this._isTileHandlerReady=!1,this._pauseQueues(),this._clearQueues(),this._tileManager.clearCache();const e=this._styleChanges;try{await this._tileHandler.updateStyle(e)}catch(l){i.getLogger(this).error("error applying vector-tiles style update",l.message),this._resumeQueues(),this._isTileHandlerReady=!0}const t=this._styleRepository,s=new Set;e.forEach(e=>{if(3!==e.type)return;const i=e.data,r=t.getLayerById(i.layer);r&&s.add(r.uid)});const r=new Set;e.forEach(e=>{let i;switch(e.type){case 0:t.setPaintProperties(e.data.layer,e.data.paint),i=e.data.layer;break;case 1:t.setLayoutProperties(e.data.layer,e.data.layout),i=e.data.layer;break;case 3:return void t.deleteStyleLayer(e.data.layer);case 2:t.setStyleLayer(e.data.layer,e.data.index),i=e.data.layer.id;break;case 4:this._vectorTileContainer.setSpriteMosaic(this._tileHandler.setSpriteSource(e.data.spriteSource))}if(i){const e=t.getLayerById(i);e&&r.add(e.uid)}});const a=this._vectorTileContainer.children;if(s.size>0){const e=Array.from(s);this._vectorTileContainer.deleteStyleLayers(e);for(const t of a)t.deleteLayerData(e)}if(this._resumeQueues(),r.size>0){const e=Array.from(r),t=[];for(const i of a){const s=this._updatingHandles.addPromise(this._fetchQueue.push(i.key).then(t=>this._parseQueue.push({key:i.key,data:t,styleLayerUIDs:e})).then(e=>i.setData(e)).finally(()=>i.featureIndex=null));t.push(s)}await Promise.all(t)}this._styleChanges=[],this._isTileHandlerReady=!0,this.requestUpdate()}async _loadStyle(){const{style:e}=this.layer.currentStyleInfo,i=t(e);this._isTileHandlerReady=!1,this._pauseQueues(),this._clearQueues(),this._styleRepository=new m(i),this._vectorTileContainer.destroy(),this._tileManager.clear(),this._tileHandlerAbortController.abort(),this._tileHandlerAbortController=new AbortController;const{signal:s}=this._tileHandlerAbortController;try{this._tileHandlerPromise=this._tileHandler.setStyle(this._styleRepository,i,this.layer.tileInfo.lods.length-1),await this._tileHandlerPromise}catch(n){if(!r(n))throw n}if(s.aborted)return this._resumeQueues(),this._isTileHandlerReady=!0,this._styeChanged=!1,this._spriteSourceChanged=!1,void this.requestUpdate();const a=await this._tileHandler.spriteMosaic,l=this._vectorTileContainer;this._tileInfoView=new C(this.layer.tileInfo,this.layer.fullExtent),l.setStyleResources(a,this._tileHandler.glyphMosaic,this._styleRepository,this._tileInfoView),this._tileManager=new p({acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView},this._vectorTileContainer),this._resumeQueues(),this._isTileHandlerReady=!0,this.requestUpdate(),this._styeChanged=!1,this._spriteSourceChanged=!1}_createVectorTile(e){const t=this._tileInfoView.getTileBounds(u(),e),i=this._tileInfoView.getTileResolution(e.level);return new _(e,i,t[0],t[3],512,512,this._styleRepository)}async _queryTile(e,t,i,s,r,a){if(0===r.layerData.size)return;const l=this._ensureTileIndex(r),n=this._tileInfoView.getTileBounds(u(),r.key,!0),o=Q*S*((t.x-n[0])/(n[2]-n[0])),h=Q*S*(1-(t.y-n[1])/(n[3]-n[1])),c=await l.queryAttributes(o,h,i,s,a);for(const u of c)u.graphic.geometry=this._tileToMapPoint(u.tilePoint,r.transforms.tileUnitsToPixels),e.push({type:"graphic",layer:this.layer,graphic:u.graphic,mapPoint:t.clone()});e.sort((e,t)=>(y(t.graphic.origin)?t.graphic.origin.layerIndex:0)-(y(e.graphic.origin)?e.graphic.origin.layerIndex:0))}_tileToMapPoint(e,t){if(!e)return null;const i=e[0]*t[0]+e[1]*t[3]+t[6],s=e[0]*t[1]+e[1]*t[4]+t[7],r=this.view.state,a=[0,0];return r.toMap(a,[i,s]),new h({x:a[0],y:a[1],spatialReference:r.spatialReference})}_ensureTileIndex(e){let t=e.featureIndex;return t||(t=g.create(e.key,e.layerData,this._styleRepository,this._tileHandler,this.layer),e.featureIndex=t),t}_pauseQueues(){this._fetchQueue.pause(),this._parseQueue.pause()}_resumeQueues(){this._fetchQueue.resume(),this._parseQueue.resume()}_clearQueues(){this._fetchQueue.clear(),this._parseQueue.clear()}};function b(e){if(null==e)return 0;switch(e.type){case"partial":return Object.keys(e.diff).length;case"complete":return Math.max(Object.keys(e.oldValue).length,Object.keys(e.newValue).length);case"collection":return Object.keys(e.added).length+Object.keys(e.changed).length+Object.keys(e.removed).length}}e([a()],P.prototype,"_isTileHandlerReady",void 0),P=e([l("esri.views.2d.layers.VectorTileLayerView2D")],P);const V=P;export{V 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{clone as e}from"../../../../../core/lang.js";import{isHostedAgolService as t}from"../../../../../layers/support/arcgisLayerUrl.js";import{getServiceGeometryType as
|
|
5
|
+
import{clone as e}from"../../../../../core/lang.js";import r from"../../../../../graphic/CatalogGraphicOrigin.js";import{isHostedAgolService as t}from"../../../../../layers/support/arcgisLayerUrl.js";import{getServiceGeometryType as i}from"./geometryUtils.js";import{getLayerDeconflictionEnabled as o,createLabelVVEvaluator as s}from"./labelingUtils.js";import{createFeatureSourceSchema as a}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as l}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as n}from"../support/rendererUtils.js";class p{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const r=this.layer,t=o(r);return[{vvEvaluators:{0:s(r.renderer)},deconflictionEnabled:t}]}async createServiceOptions(r){const o=this.layer,{capabilities:s,editingInfo:a,objectIdField:l,globalIdField:n,datesInUnknownTimezone:p,dateFieldsTimeZone:d,orderBy:c,parsedUrl:u}=o,m=o.fieldsIndex.toJSON(),y=i(o),f=o.timeInfo?.toJSON(),h=o.spatialReference.toJSON(),g=e(u);let I=l;if(c?.length){const e=!c[0].valueExpression&&c[0].field;e&&(I=e)}const b=t(g.path),F=r.spatialReference.toJSON();return{type:"feature-service",source:g,isSourceHosted:b,orderByFields:I,outSpatialReference:F,metadata:{timeReferenceUnknownClient:p,dateFieldsTimeZone:d,globalIdField:n,fieldsIndex:m,geometryType:y,featureIdInfo:{type:"object-id",fieldName:l},timeInfo:f,spatialReference:h,outSpatialReference:F,subtypeField:null,subtypes:null,typeIdField:null,types:null},queryMetadata:{maxRecordCount:s.query.maxRecordCount,supportsCompactGeometry:s.query.supportsCompactGeometry,supportsDefaultSpatialReference:s.query.supportsDefaultSpatialReference,supportsFormatPBF:s.query.supportsFormatPBF,supportsMaxRecordCountFactor:s.query.supportsMaxRecordCountFactor,supportsQuantization:s.query.supportsQuantization,lastEditDate:a?.lastEditDate?.getTime(),snapshotInfo:null}}}createSourceSchema(e,r){const{definitionExpression:t,displayFilterInfo:i,customParameters:o,timeExtent:s,apiKey:l}=this.layer;return a({definitionExpression:t,displayFilterInfo:i,customParameters:o,timeExtent:s},e,r,l)}createProcessorSchema(e,r,t){const{fields:i,geometryType:o,orderBy:s,objectIdField:a,renderer:n,labelingInfo:p,labelsVisible:d}=this.layer,c={featureReduction:null,layerId:this.layer.id,fields:i.map(e=>e.toJSON()),geometryType:o,labelingInfo:p,labelsVisible:d,objectIdField:a,orderBy:s??"default",renderer:n?.clone()};return l(e,r,c,t)}get hasRequiredSupport(){return n(this.layer.renderer)}get timeOptions(){return this.layer}getUpdateHashProperties(e){return[()=>this.layer.apiKey,()=>this.layer.customParameters,()=>this.layer.definitionExpression,()=>this.layer.outFields,()=>this.layer.renderer,()=>this.layer.labelsVisible?this.layer.labelingInfo:null,()=>this.layer.orderBy]}setGraphicOrigin(e){e.origin=new r(this.layer)}}export{p as CatalogFootprintLayerAdapter};
|
|
@@ -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
|
+
import{__decorate as e}from"tslib";import r from"../../../../core/Accessor.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 t}from"../../../../core/accessorSupport/decorators/subclass.js";import{i as s}from"../../../../chunks/vec32.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as i,width as a,height as c,expand as p}from"../../../../geometry/support/aaBoundingRect.js";import{vectorCoordinates as m}from"../../../../geometry/support/coordinateSystem.js";let d=class extends r{constructor(e){super(e)}get cameraPositionRenderSpace(){const{extent:e,renderCoordsHelper:r}=this,o=n();return r.toRenderCoords(e.center,o),r.setAltitude(o,h),o}get cameraDimensions(){const{extent:e}=this,r=i();this._expandBoundingRect(e.xmin,e.ymin,r),this._expandBoundingRect(e.xmax,e.ymin,r),this._expandBoundingRect(e.xmin,e.ymax,r),this._expandBoundingRect(e.xmax,e.ymax,r);return{width:a(r),height:c(r)}}get cameraNearFar(){return{near:x,far:g}}get upVector(){return this.renderCoordsHelper.worldBasisAtPosition(this.cameraPositionRenderSpace,2,n())}get northVector(){return this.renderCoordsHelper.worldBasisAtPosition(this.cameraPositionRenderSpace,1,n())}get eastVector(){return this.renderCoordsHelper.worldBasisAtPosition(this.cameraPositionRenderSpace,0,n())}_expandBoundingRect(e,r,o){const{extent:t,eastVector:n,northVector:i,upVector:a,renderCoordsHelper:c}=this,d=t.center.z??0;s(u,e,r,d),c.toRenderCoords(u,t.spatialReference,u),m(u,n,i,a,l),p(o,l,o)}};e([o()],d.prototype,"renderCoordsHelper",void 0),e([o()],d.prototype,"extent",void 0),e([o()],d.prototype,"cameraPositionRenderSpace",null),e([o()],d.prototype,"cameraDimensions",null),e([o()],d.prototype,"upVector",null),e([o()],d.prototype,"northVector",null),e([o()],d.prototype,"eastVector",null),d=e([t("esri.views.3d.analysis.VolumeMeasurement.CutFillVolumeMeasurementComputation")],d);const u=n(),l=n(),h=9e3,x=0,g=2e4;export{d as CutFillVolumeMeasurementComputation};
|
|
@@ -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 t from"../../../../core/Accessor.js";import i from"../../../../core/Logger.js";import{syncAndInitial as o,watch as
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import i from"../../../../core/Logger.js";import{syncAndInitial as o,watch as n,initial as a}from"../../../../core/reactiveUtils.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as l}from"../../../../core/support/UpdatingHandles.js";import{projectOrLoad as p}from"../../../../geometry/projectionUtils.js";import{projectBoundingRect as m}from"../../../../geometry/projection/projectBoundingRect.js";import{fromExtent as d,empty as u,intersects as c}from"../../../../geometry/support/aaBoundingRect.js";import{logFailedGeometryProjectionError as y}from"../support/projectionUtils.js";import{CutFillVolumeMeasurementComputation as g}from"./CutFillVolumeMeasurementComputation.js";import{getElevationAtPoint as h}from"../../support/ElevationProvider.js";let v=class extends t{constructor(e){super(e),this._updatingHandles=new l,this._computation=null}initialize(){this._updatingHandles.add(()=>({geometry:this.analysis.geometry,projectedGeometry:p(this.analysis.geometry,this.view.spatialReference)}),({geometry:e,projectedGeometry:t})=>{null==t.pending?this._onGeometryChange(e,t.geometry):this._updatingHandles.addPromise(t.pending)},o),this.addHandles([this._createElevationUpdateHandle(),n(()=>[this.analysis.measureType,this.analysisViewData.elevationAlignedGeometry,this.analysisViewData.effectiveTargetElevation],()=>this._updateTargetGeometry()),n(()=>this.analysisViewData.elevationAlignedGeometry?.extent,e=>{e?this._updateComputation(e):this._removeComputation()},a)])}destroy(){this._updatingHandles.destroy()}get updating(){return this._updatingHandles.updating}_createComputation(e){const{renderCoordsHelper:t}=this.view;this._computation=new g({extent:e,renderCoordsHelper:t})}_updateComputation(e){this._computation?this._computation.extent=e:this._createComputation(e)}_removeComputation(){this._computation=null}_createElevationUpdateHandle(){const e=t=>{const i=this.analysis.geometry;if(null==i)return;const o=p(i,this.view.spatialReference);if(null!=o.pending)return this._updatingHandles.addPromise(o.pending),void o.pending.finally(()=>e(t));const n=o.geometry;null!=n&&null!=n.extent&&(m(t.extent,t.spatialReference,_,this.view.spatialReference),d(n.extent,w),c(_,w)&&this._onGeometryChange(i,n))};return this.view.elevationProvider.on("elevation-change",t=>e(t))}_onGeometryChange(e,t){const{elevationProvider:o}=this.view,{valid:n}=this.analysis;if(null==e||!n)return void(this.analysisViewData.elevationAlignedGeometry=null);if(null==t)return y(this.analysis,e.spatialReference,i.getLogger(this)),void(this.analysisViewData.elevationAlignedGeometry=null);const a=t.clone();f(o,a),this.analysisViewData.elevationAlignedGeometry=a}_updateTargetGeometry(){const{measureType:e}=this.analysis,{elevationAlignedGeometry:t,effectiveTargetElevation:i}=this.analysisViewData;if(!t)return void(this.analysisViewData.targetGeometry=null);if("stockpile"===e||!i)return void(this.analysisViewData.targetGeometry=t);const o=t.clone();o.rings[0].forEach(e=>{e[2]=i}),this.analysisViewData.targetGeometry=o}};function f(e,t){t.rings[0].forEach(t=>{t[2]=h(e,t,"ground")??0})}e([r({constructOnly:!0})],v.prototype,"analysis",void 0),e([r({constructOnly:!0})],v.prototype,"analysisViewData",void 0),e([r({constructOnly:!0})],v.prototype,"view",void 0),e([r()],v.prototype,"updating",null),e([r({readOnly:!0})],v.prototype,"_updatingHandles",void 0),e([r()],v.prototype,"_computation",void 0),v=e([s("esri.views.3d.analysis.VolumeMeasurement.CutFillVolumeMeasurementController")],v);const _=u(),w=u();export{v as CutFillVolumeMeasurementController};
|
package/views/3d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles3D.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../../../../core/Accessor.js";import{equals as r}from"../../../../../../core/arrayUtils.js";import{watch as i
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../../../../core/Accessor.js";import{equals as r}from"../../../../../../core/arrayUtils.js";import{watch as i}from"../../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/has.js";import"../../../../../../core/Logger.js";import{subclass as s}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{TileKey as n}from"../../../../../../layers/support/TileKey.js";import{distanceToTile as l}from"../../../../../interactive/snapping/featureSources/featureServiceSource/tileUtils.js";let p=class extends t{get _sortedTilesCoveringView(){const e=(this.view.featureTiles?.tiles?.toArray()??[]).map(c),t=this._effectivePointOfInterest;return null!=t&&e.sort((e,r)=>l(t,e)-l(t,r)),e}get tileInfo(){return this.view.featureTiles?.tilingScheme?.toTileInfo()??null}get tileSize(){return this.view.featureTiles?.tileSize??256}get _effectivePointOfInterest(){const e=this.pointOfInterest;return null!=e?e:this.view.pointsOfInterest?.focus.location}constructor(e){super(e),this.tiles=[],this.pointOfInterest=null}initialize(){this.addHandles([this.view.enableFeatureTiles(),i(()=>this._sortedTilesCoveringView,e=>this._set("tiles",e),{initial:!0,equals:(e,t)=>r(e,t,(e,t)=>e.id===t.id)})])}};function c({lij:[e,t,r],extent:i}){return new n(`${e}/${t}/${r}`,e,t,r,i)}e([o({readOnly:!0})],p.prototype,"tiles",void 0),e([o({readOnly:!0})],p.prototype,"_sortedTilesCoveringView",null),e([o({readOnly:!0})],p.prototype,"tileInfo",null),e([o({readOnly:!0})],p.prototype,"tileSize",null),e([o({constructOnly:!0})],p.prototype,"view",void 0),e([o()],p.prototype,"pointOfInterest",void 0),e([o()],p.prototype,"_effectivePointOfInterest",null),p=e([s("esri.views.3d.interactive.snapping.featureSources.featureServiceSource.FeatureServiceTiles3D")],p);export{p as FeatureServiceTiles3D};
|
|
@@ -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"../../../Graphic.js";import t from"../../../core/Error.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as l,throwIfAbortError as a}from"../../../core/promiseUtils.js";import{syncAndInitial as
|
|
5
|
+
import{__decorate as e}from"tslib";import r from"../../../Graphic.js";import t from"../../../core/Error.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as l,throwIfAbortError as a}from"../../../core/promiseUtils.js";import{syncAndInitial as n,initial as o}from"../../../core/reactiveUtils.js";import{property as u}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import p from"../../../core/sql/WhereClause.js";import h from"../../../graphic/BuildingGraphicOrigin.js";import"../../../layers/buildingSublayers/BuildingComponentSublayer.js";import y from"../../../layers/support/FeatureFilter.js";import{fixFields as c,unpackFieldNames as g,populateMissingFields as f}from"../../../layers/support/fieldUtils.js";import m from"../../../rest/support/Query.js";import{isNumber as F}from"../../../support/guards.js";import{BuildingSublayerView3DMixin as b}from"./BuildingSublayerView3D.js";import{I3SMeshView3D as _}from"./I3SMeshView3D.js";import{applyFilterMode as w}from"./i3s/BuildingFilterUtil.js";import{createGetFeatureExtent as E}from"./i3s/I3SGeometryUtil.js";import{I3SMeshViewFilter as x}from"./i3s/I3SMeshViewFilter.js";import{I3SQueryEngine as S}from"./i3s/I3SQueryEngine.js";import{I3SQueryFeatureAdapter as j,I3SQueryFeature as v}from"./i3s/I3SQueryFeatureAdapter.js";import{I3SQueryFeatureStore as I}from"./i3s/I3SQueryFeatureStore.js";import{findFieldsCaseInsensitive as Q,getIndexCrs as q}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as R}from"./support/DefinitionExpressionSceneLayerView.js";import{TemporalSceneLayerView as L}from"./support/TemporalSceneLayerView.js";import O from"../../layers/BuildingComponentSublayerView.js";import{hasPopupTemplate as V,getRequiredFields as U,getFetchPopupTemplate as C}from"../../layers/support/popupUtils.js";import{isInEffectiveScaleRange as A}from"../../support/layerViewUtils.js";import{TaskPriority as H}from"../../support/Scheduler.js";let G=class extends(L(R(_(b(O))))){constructor(e){super(e),this.type="building-component-sublayer-3d",this._elevationContext="scene",this._supportsLabeling=!1,this.requiredFields=[],this.progressiveLoadFactor=1,this._queryEngine=null}get i3slayer(){return this.sublayer}get layerViewUid(){return this.layerView.uid}get layerId(){return this.sublayer.layer.id}get sublayerId(){return this.sublayer.id}get layerPopupEnabledAndHasTemplate(){return this.sublayer.popupEnabled&&V(this.sublayer,this.layerView.view.popup?.defaultPopupTemplateEnabled)}initialize(){this._updatingHandles.add(()=>this.mergedFilter,e=>{null!=e&&x.checkSupport(e)?null==this._i3sFilter?this._i3sFilter=new x({viewFilter:e,layerFieldsIndex:this.sublayer.fieldsIndex,loadAsyncModule:e=>this._loadAsyncModule(e),addSqlFilter:(e,r)=>this.addSqlFilter(e,r,this.logError),addTimeFilter:(e,r)=>this.addTimeFilter(e,r)}):this._i3sFilter.viewFilter=e:this._i3sFilter=s(this._i3sFilter)},n),this._updatingHandles.add(()=>[this.sublayer.renderer,this.definitionExpressionFields,this.filterExpressionFields],()=>this._updateRequiredFields()),this._updatingHandles.add(()=>this.sublayer.renderer,e=>this._rendererChange(e),o);const e=()=>this._filterChange();this._updatingHandles.add(()=>this.parsedDefinitionExpression,e),this._updatingHandles.add(()=>this._i3sFilter?.sortedObjectIds,e),this._updatingHandles.add(()=>this._i3sFilter?.parsedWhereClause,e),this._updatingHandles.add(()=>this.getTimeFilterDependencies(),e),this._updatingHandles.add(()=>this.mergedFilter,e),this._updatingHandles.add(()=>[this._i3sFilter?.parsedGeometry,this.filter?.spatialRelationship],()=>this._geometryFilterChange()),this._updatingHandles.add(()=>this.parsedFilterExpressions,()=>this._updateSymbologyOverride(),o),this.addResolvingPromise(this._updateRequiredFields())}get lodFactor(){return this.view.qualitySettings.sceneService.object.lodFactor}get parsedFilterExpressions(){return"Overview"===this.sublayer.modelName?[]:this.layerView.filterExpressions.map(([e,r])=>{let t;try{t=p.create(e,{fieldsIndex:this.sublayer.fieldsIndex})}catch(a){return i.getLogger(this).error("Failed to parse filterExpression: "+a),null}if(!t.isStandardized)return i.getLogger(this).error("filterExpression is using non standard function"),null;const s=[],l=t.fieldNames;return Q(l,this.sublayer.fieldsIndex,{missingFields:s}),s.length>0?(i.getLogger(this).error(`filterExpression references unknown fields: ${s.join(", ")}`),null):[t,r]}).filter(e=>null!=e)}get filter(){return this._get("filter")}set filter(e){this._set("filter",x.checkSupport(e)?e:null)}isUpdating(){return super.isUpdating()||(this._i3sFilter?.updating??!1)}_updateSymbologyOverride(){const e=this.parsedFilterExpressions;e.length>0?this._setSymbologyOverride((r,t)=>{for(const[s,l]of e)try{if(s.testFeature(r))return w(t,l)}catch(i){this.logError(i)}return w(t,null)},this.filterExpressionFields):this._setSymbologyOverride(null,null)}get filterExpressionFields(){return c(this.sublayer.fieldsIndex,this.parsedFilterExpressions.reduce((e,[r])=>e.concat(r.fieldNames),new Array))}get availableFields(){const e=this.sublayer,r=e.fieldsIndex;let t=this.requiredFields;if(e.outFields||e.layer.outFields){const i=[...e.outFields||[],...e.layer.outFields||[]];t=[...g(r,i),...t]}return c(r,t)}get _graphicOrigin(){return new h(this.sublayer)}_createLayerGraphic(e){return new r({attributes:e,layer:this.sublayer.layer,sourceLayer:this.sublayer,origin:this._graphicOrigin})}canResume(){return super.canResume()&&A(this.i3slayer.effectiveScaleRange,this.view.scale)&&(!this._controller||this._controller.rootNodeVisible)}async fetchPopupFeaturesFromGraphics(e,r){const t=this._validateFetchPopupFeatures(r);if(t)throw t;if(0===e.length)return[];const s=[],n=[],o=null!=this.sublayer.associatedLayer?await this.sublayer.associatedLayer.load(r):this.sublayer,u=g(this.sublayer.fieldsIndex,await U(o,C(this.sublayer,r)));l(r);const d=new Set;for(const i of e)f(i,u,d)?n.push(i):s.push(i);return 0===n.length?s:(null!=this.sublayer.associatedLayer&&await this.sublayer.associatedLayer.load().catch(()=>i.getLogger(this).warn("Failed to load associated feature layer. Displaying popup attributes from cached attributes.")),this.whenGraphicAttributes(n,Array.from(d)).catch(e=>(a(e),n)).then(e=>s.concat(e)))}async _updateRequiredFields(){const e=c(this.sublayer.fieldsIndex,[...this.sublayer.renderer?await this.sublayer.renderer.getRequiredFields(this.sublayer.fieldsIndex):[],...this.definitionExpressionFields,...this.filterExpressionFields]);this._set("requiredFields",e)}_validateFetchPopupFeatures(e){const{sublayer:r}=this,{popupEnabled:i}=r;return i?C(r,e)?void 0:new t("buildingscenelayerview3d:fetchPopupFeatures","Layer does not define a popup template",{sublayer:r}):new t("buildingscenelayerview3d:fetchPopupFeatures","Popups are disabled",{sublayer:r})}getFilters(){const e=super.getFilters();return this.addSqlFilter(e,this.parsedDefinitionExpression,this.logError),this._i3sFilter?.addFilters(e,this.view,this._controller.crsIndex,this._collection),e}createQuery(){const e={outFields:["*"],returnGeometry:!1,outSpatialReference:this.view.spatialReference};return null!=this.filter?this.filter.createQuery(e):new m(e)}queryExtent(e,r){return this._ensureQueryEngine().executeQueryForExtent(this._ensureQuery(e),r?.signal)}queryFeatureCount(e,r){return this._ensureQueryEngine().executeQueryForCount(this._ensureQuery(e),r?.signal)}queryFeatures(e,r){return this._ensureQueryEngine().executeQuery(this._ensureQuery(e),r?.signal).then(e=>{if(!e?.features)return e;const r=this.sublayer,t=r.layer,i=new h(r);for(const s of e.features)s.layer=t,s.sourceLayer=r,s.origin=i;return e})}async queryObjectIds(e,r){return(await this._ensureQueryEngine().executeQueryForIds(this._ensureQuery(e),r?.signal)).filter(F)}_ensureQueryEngine(){return this._queryEngine??=this._createQueryEngine(),this._queryEngine}_createQueryEngine(){const e=E(this.view.spatialReference,this.view.renderSpatialReference,this._collection);return new S({layerView:this,priority:H.FEATURE_QUERY_ENGINE,spatialIndex:new I({featureAdapter:new j({objectIdField:this.sublayer.objectIdField,attributeStorageInfo:this.sublayer.attributeStorageInfo,getFeatureExtent:e}),forAllFeatures:(e,r)=>this._forAllFeatures((r,t,i)=>e(new v(r,t,i)),r,2),getFeatureExtent:e,sourceSpatialReference:q(this.sublayer),viewSpatialReference:this.view.spatialReference})})}_ensureQuery(e){return this._addDefinitionExpressionToQuery(null==e?this.createQuery():m.from(e))}};e([u()],G.prototype,"i3slayer",null),e([u()],G.prototype,"layerView",void 0),e([u()],G.prototype,"lodFactor",null),e([u({readOnly:!0})],G.prototype,"parsedFilterExpressions",null),e([u({type:y})],G.prototype,"filter",null),e([u()],G.prototype,"_i3sFilter",void 0),e([u({type:[String],readOnly:!0})],G.prototype,"filterExpressionFields",null),e([u({type:[String],readOnly:!0})],G.prototype,"requiredFields",void 0),e([u({type:[String],readOnly:!0})],G.prototype,"availableFields",null),e([u()],G.prototype,"_graphicOrigin",null),G=e([d("esri.views.3d.layers.BuildingComponentSublayerView3D")],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
|
-
import{__decorate as r}from"tslib";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 e}from"../../../core/accessorSupport/decorators/subclass.js";import s from"./FeatureLayerViewBase3D.js";let
|
|
5
|
+
import{__decorate as r}from"tslib";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 e}from"../../../core/accessorSupport/decorators/subclass.js";import s from"../../../graphic/CSVGraphicOrigin.js";import t from"./FeatureLayerViewBase3D.js";let i=class extends t{constructor(){super(...arguments),this.type="csv-3d"}get graphicOrigin(){return new s(this.layer)}};r([o()],i.prototype,"layer",void 0),r([o()],i.prototype,"graphicOrigin",null),i=r([e("esri.views.3d.layers.CSVLayerView3D")],i);const p=i;export{p 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
|
|
5
|
+
import{__decorate as r}from"tslib";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 t}from"../../../core/accessorSupport/decorators/subclass.js";import e from"../../../graphic/CatalogGraphicOrigin.js";import s from"./FeatureLayerViewBase3D.js";import a from"../../layers/CatalogFootprintLayerView.js";let i=class extends(a(s)){constructor(){super(...arguments),this.type="catalog-footprint-3d"}get graphicOrigin(){return new e(this.layer)}};r([o()],i.prototype,"parent",void 0),r([o()],i.prototype,"graphicOrigin",null),i=r([t("esri.views.3d.layers.CatalogFootprintLayerView3D")],i);const p=i;export{p 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{property as t}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{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{canProjectWithoutEngine as o}from"../../../geometry/projectionUtils.js";import s from"../../../graphic/FeatureGraphicOrigin.js";import{getEffectiveLayerCapabilities as a}from"../../../layers/support/layerUtils.js";import p from"./FeatureLayerViewBase3D.js";let l=class extends p{constructor(){super(...arguments),this.type="feature-3d"}initialize(){const{layer:e,view:t}=this;a(e)?.operations.supportsQuery||this.addResolvingPromise(Promise.reject(new r("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e}))),null!=e.infoFor3D&&this.addResolvingPromise(Promise.reject(new r("featurelayerview3d:unsupported-geometry-type",`Unsupported geometry type ${e.geometryType}`))),"mesh"!==e.geometryType||o(e.spatialReference,t.spatialReference)||this.addResolvingPromise(Promise.reject(new r("layerview:spatial-reference-incompatible","The spatial references of the feature layer is incompatible with the spatial reference of the view")))}get graphicOrigin(){return new s(this.layer)}get featureSpatialReference(){return this.view.featureTiles?.tilingScheme?.spatialReference}};e([t()],l.prototype,"layer",void 0),e([t()],l.prototype,"graphicOrigin",null),l=e([i("esri.views.3d.layers.FeatureLayerView3D")],l);const c=l;export{c as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import i from"../../../core/Error.js";import{makeHandle as r}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import{destroyMaybe as s}from"../../../core/maybe.js";import n from"../../../core/ReactiveMap.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{hydrateGraphic as p}from"../../../layers/graphics/hydratedFeatures.js";import{combineTimeExtent as a}from"../../../layers/support/timeSupport.js";import h from"../../../rest/support/Query.js";import{isGraphic as u}from"../../../support/guards.js";import{attributeLookup as g}from"./support/attributeUtils.js";import{normalizeHighlightTarget as c,emptyHighlightHandle as y,isObjectId as d}from"./support/highlightUtils.js";import{getHighlightName as m}from"../../support/highlightOptionsUtils.js";import{isInEffectiveScaleRange as f,hasLayerBasedScaleVisibility as P}from"../../support/layerViewUtils.js";import{projectWithZConversionSilent as b}from"../../support/projectionUtils.js";const v=v=>{const w=v;let I=class extends w{constructor(){super(...arguments),this.highlightOptions=null,this.updatePolicy=1,this.slicePlaneEnabled=!1,this._highlightCounter=new n,this.fullExtentInLocalViewSpatialReference=null,this.supportsHeightUnitConversion=!0}initialize(){const e=this.layer;"isTable"in e&&e.isTable?this.addResolvingPromise(Promise.reject(new i("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e}))):(this.addResolvingPromise(this._validateGeometryType()),this.addResolvingPromise((async()=>{if(this.destroyed)return;this.fullExtentInLocalViewSpatialReference="local"===this.view.viewingMode?await b(this.layer.fullExtent,this.view.spatialReference):null;const e=await this.createGraphicsPipeline();this.destroyed?e.destroy():(this.graphicsPipeline=e,await e.when())})()),this.notifyChange("updating"))}destroy(){this.graphicsPipeline=s(this.graphicsPipeline)}get dataUpdating(){return!!this.graphicsPipeline?.dataUpdating}get legendEnabled(){return this.canResume()&&this.graphicsPipeline?.legendEnabled}get visibleAtCurrentScale(){return P()?f(this.layer.effectiveScaleRange,this.view.scale):!this.graphicsPipeline?.scaleVisibilitySuspended}get symbologySnappingSupported(){return this.graphicsPipeline.symbologySnappingSupported}get hasAllFeatures(){return this.graphicsPipeline.hasAllFeatures}get hasAllFeaturesInView(){return this.graphicsPipeline.hasAllFeaturesInView}get hasFullGeometries(){return this.graphicsPipeline.hasFullGeometries}get timeExtent(){return a(this.layer,this.view?.timeExtent,this._get("timeExtent"))}get highlightIds(){return Array.from(this._highlightCounter.keys())}get hasHighlight(){return this._highlightCounter.size>0}getHit(e){if(has("feature-pipeline-3d-test"))return this._getHitMock(e);const t=this.graphicsPipeline.findGraphic(t=>t.uid===e);if(null==t)return null;const i=p(t,this.layer);return{type:"graphic",graphic:i,layer:i.layer}}_getHitMock(e){const i=this.layer,r={};r[this.layer.objectIdField]=e;const s=new t({layer:i,sourceLayer:i,visible:!0,symbol:null,attributes:r,geometry:null});return{type:"graphic",graphic:s,layer:s.layer}}whenGraphicBounds(e,t){return this.graphicsPipeline?.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.graphicsPipeline?.computeAttachmentOrigin(e,t)}async elevationAlignPointsInFeatures(e,t){return this.graphicsPipeline.elevationAlignPointsInFeatures(e,t)}async queryForSymbologySnapping(e,t){return this.graphicsPipeline.graphicsQuery.queryForSymbologySnapping(e,t)}queryFeatures(e,t){return this.graphicsPipeline.graphicsQuery.executeQuery(this._ensureQuery(e),t?.signal)}queryObjectIds(e,t){return this.graphicsPipeline.graphicsQuery.executeQueryForIds(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this.graphicsPipeline.graphicsQuery.executeQueryForCount(this._ensureQuery(e),t?.signal)}queryExtent(e,t){return this.graphicsPipeline.graphicsQuery.executeQueryForExtent(this._ensureQuery(e),t?.signal)}_ensureQuery(e){return null==e?this.createQuery():h.from(e)}_addHighlightIds(e){for(const t of e){const e=this._highlightCounter.get(t)??0;this._highlightCounter.set(t,e+1)}}_removeHighlightIds(e){for(const t of e){let e=this._highlightCounter.get(t);null!=e&&(e--,e>0?this._highlightCounter.set(t,e):this._highlightCounter.delete(t))}}highlight(e,t){const i=m(t),s=this.layer.objectIdField,n=c(e);if(0===n.length)return y;if(u(n[0])){const e=n;if(null!=g(this.layer.fieldsIndex,e[0].attributes,s)){const t=e.map(e=>g(this.layer.fieldsIndex,e.attributes,s)),n=this.graphicsPipeline.highlightByObjectIds(t,i);return this._addHighlightIds(t),r(()=>{this._removeHighlightIds(t),n.remove()})}return this.graphicsPipeline.highlightByGraphics(e,i)}if(d(n[0])){const e=n;this._addHighlightIds(e);const t=this.graphicsPipeline.highlightByObjectIds(e,i);return r(()=>{t.remove(),this._removeHighlightIds(e)})}return y}maskOccludee(e){return this.graphicsPipeline.maskOccludee(e)}getSuspendInfo(){return{...super.getSuspendInfo(),...this.graphicsPipeline.suspendInfo}}isUpdating(){return!(!this.graphicsPipeline||this.graphicsPipeline.destroyed)&&!(!this.graphicsPipeline?.updating&&this.view?.basemapTerrain?.ready)}async _validateGeometryType(){switch(this.layer.geometryType){case"multipatch":case"multipoint":throw new i("featurelayerview3d:unsupported-geometry-type","Unsupported geometry type ${geometryType}",{geometryType:this.layer.geometryType})}}get performanceInfo(){return this.graphicsPipeline.performanceInfo}queryAttributeBins(){throw new Error("Not implemented")}queryAggregates(){throw new Error("Not implemented")}};return e([o()],I.prototype,"graphicsPipeline",void 0),e([o({readOnly:!0})],I.prototype,"dataUpdating",null),e([o()],I.prototype,"highlightOptions",void 0),e([o()],I.prototype,"suspended",void 0),e([o({readOnly:!0})],I.prototype,"legendEnabled",null),e([o({readOnly:!0})],I.prototype,"visibleAtCurrentScale",null),e([o()],I.prototype,"updating",void 0),e([o({readOnly:!0})],I.prototype,"updatePolicy",void 0),e([o({type:Boolean})],I.prototype,"slicePlaneEnabled",void 0),e([o({readOnly:!0})],I.prototype,"suspendInfo",void 0),e([o()],I.prototype,"symbologySnappingSupported",null),e([o({readOnly:!0})],I.prototype,"hasAllFeatures",null),e([o({readOnly:!0})],I.prototype,"hasAllFeaturesInView",null),e([o({readOnly:!0})],I.prototype,"hasFullGeometries",null),e([o({readOnly:!0})],I.prototype,"timeExtent",null),I=e([l("esri.views.3d.layers.FeatureLikeLayerView3D")],I),I};export{v as FeatureLikeLayerView3D};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import i from"../../../core/Error.js";import{makeHandle as r}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import{destroyMaybe as s}from"../../../core/maybe.js";import n from"../../../core/ReactiveMap.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{hydrateGraphic as p}from"../../../layers/graphics/hydratedFeatures.js";import{combineTimeExtent as a}from"../../../layers/support/timeSupport.js";import h from"../../../rest/support/Query.js";import{isGraphic as u}from"../../../support/guards.js";import{attributeLookup as g}from"./support/attributeUtils.js";import{normalizeHighlightTarget as c,emptyHighlightHandle as y,isObjectId as d}from"./support/highlightUtils.js";import{getHighlightName as m}from"../../support/highlightOptionsUtils.js";import{isInEffectiveScaleRange as f,hasLayerBasedScaleVisibility as P}from"../../support/layerViewUtils.js";import{projectWithZConversionSilent as b}from"../../support/projectionUtils.js";const v=v=>{const w=v;let I=class extends w{constructor(){super(...arguments),this.highlightOptions=null,this.updatePolicy=1,this.slicePlaneEnabled=!1,this._highlightCounter=new n,this.fullExtentInLocalViewSpatialReference=null,this.supportsHeightUnitConversion=!0}initialize(){const e=this.layer;"isTable"in e&&e.isTable?this.addResolvingPromise(Promise.reject(new i("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e}))):(this.addResolvingPromise(this._validateGeometryType()),this.addResolvingPromise((async()=>{if(this.destroyed)return;this.fullExtentInLocalViewSpatialReference="local"===this.view.viewingMode?await b(this.layer.fullExtent,this.view.spatialReference):null;const e=await this.createGraphicsPipeline();this.destroyed?e.destroy():(this.graphicsPipeline=e,await e.when())})()),this.notifyChange("updating"))}destroy(){this.graphicsPipeline=s(this.graphicsPipeline)}get dataUpdating(){return!!this.graphicsPipeline?.dataUpdating}get legendEnabled(){return this.canResume()&&this.graphicsPipeline?.legendEnabled}get visibleAtCurrentScale(){return P()?f(this.layer.effectiveScaleRange,this.view.scale):!this.graphicsPipeline?.scaleVisibilitySuspended}get symbologySnappingSupported(){return this.graphicsPipeline.symbologySnappingSupported}get hasAllFeatures(){return this.graphicsPipeline.hasAllFeatures}get hasAllFeaturesInView(){return this.graphicsPipeline.hasAllFeaturesInView}get hasFullGeometries(){return this.graphicsPipeline.hasFullGeometries}get timeExtent(){return a(this.layer,this.view?.timeExtent,this._get("timeExtent"))}get highlightIds(){return Array.from(this._highlightCounter.keys())}get hasHighlight(){return this._highlightCounter.size>0}getHit(e){if(has("feature-pipeline-3d-test"))return this._getHitMock(e);const t=this.graphicsPipeline.findGraphic(t=>t.uid===e);if(null==t)return null;const i=p(t,this.layer);return{type:"graphic",graphic:i,layer:i.layer}}_getHitMock(e){const i=this.layer,r={};r[this.layer.objectIdField]=e;const s=new t({layer:i,sourceLayer:i,origin:this.graphicOrigin,visible:!0,symbol:null,attributes:r,geometry:null});return{type:"graphic",graphic:s,layer:s.layer}}whenGraphicBounds(e,t){return this.graphicsPipeline?.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.graphicsPipeline?.computeAttachmentOrigin(e,t)}async elevationAlignPointsInFeatures(e,t){return this.graphicsPipeline.elevationAlignPointsInFeatures(e,t)}async queryForSymbologySnapping(e,t){return this.graphicsPipeline.graphicsQuery.queryForSymbologySnapping(e,t)}queryFeatures(e,t){return this.graphicsPipeline.graphicsQuery.executeQuery(this._ensureQuery(e),t?.signal)}queryObjectIds(e,t){return this.graphicsPipeline.graphicsQuery.executeQueryForIds(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this.graphicsPipeline.graphicsQuery.executeQueryForCount(this._ensureQuery(e),t?.signal)}queryExtent(e,t){return this.graphicsPipeline.graphicsQuery.executeQueryForExtent(this._ensureQuery(e),t?.signal)}_ensureQuery(e){return null==e?this.createQuery():h.from(e)}_addHighlightIds(e){for(const t of e){const e=this._highlightCounter.get(t)??0;this._highlightCounter.set(t,e+1)}}_removeHighlightIds(e){for(const t of e){let e=this._highlightCounter.get(t);null!=e&&(e--,e>0?this._highlightCounter.set(t,e):this._highlightCounter.delete(t))}}highlight(e,t){const i=m(t),s=this.layer.objectIdField,n=c(e);if(0===n.length)return y;if(u(n[0])){const e=n;if(null!=g(this.layer.fieldsIndex,e[0].attributes,s)){const t=e.map(e=>g(this.layer.fieldsIndex,e.attributes,s)),n=this.graphicsPipeline.highlightByObjectIds(t,i);return this._addHighlightIds(t),r(()=>{this._removeHighlightIds(t),n.remove()})}return this.graphicsPipeline.highlightByGraphics(e,i)}if(d(n[0])){const e=n;this._addHighlightIds(e);const t=this.graphicsPipeline.highlightByObjectIds(e,i);return r(()=>{t.remove(),this._removeHighlightIds(e)})}return y}maskOccludee(e){return this.graphicsPipeline.maskOccludee(e)}getSuspendInfo(){return{...super.getSuspendInfo(),...this.graphicsPipeline.suspendInfo}}isUpdating(){return!(!this.graphicsPipeline||this.graphicsPipeline.destroyed)&&!(!this.graphicsPipeline?.updating&&this.view?.basemapTerrain?.ready)}async _validateGeometryType(){switch(this.layer.geometryType){case"multipatch":case"multipoint":throw new i("featurelayerview3d:unsupported-geometry-type","Unsupported geometry type ${geometryType}",{geometryType:this.layer.geometryType})}}get performanceInfo(){return this.graphicsPipeline.performanceInfo}queryAttributeBins(){throw new Error("Not implemented")}queryAggregates(){throw new Error("Not implemented")}};return e([o()],I.prototype,"graphicsPipeline",void 0),e([o({readOnly:!0})],I.prototype,"dataUpdating",null),e([o()],I.prototype,"highlightOptions",void 0),e([o()],I.prototype,"suspended",void 0),e([o({readOnly:!0})],I.prototype,"legendEnabled",null),e([o({readOnly:!0})],I.prototype,"visibleAtCurrentScale",null),e([o()],I.prototype,"updating",void 0),e([o({readOnly:!0})],I.prototype,"updatePolicy",void 0),e([o({type:Boolean})],I.prototype,"slicePlaneEnabled",void 0),e([o({readOnly:!0})],I.prototype,"suspendInfo",void 0),e([o()],I.prototype,"symbologySnappingSupported",null),e([o({readOnly:!0})],I.prototype,"hasAllFeatures",null),e([o({readOnly:!0})],I.prototype,"hasAllFeaturesInView",null),e([o({readOnly:!0})],I.prototype,"hasFullGeometries",null),e([o({readOnly:!0})],I.prototype,"timeExtent",null),I=e([l("esri.views.3d.layers.FeatureLikeLayerView3D")],I),I};export{v as FeatureLikeLayerView3D};
|
|
@@ -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"../../../core/has.js";import{abortMaybe as t}from"../../../core/maybe.js";import{debounce as r,throwIfAborted as o,ignoreAbortErrors as s}from"../../../core/promiseUtils.js";import i from"../../../core/RandomLCG.js";import{watch as
|
|
5
|
+
import{__decorate as e}from"tslib";import"../../../core/has.js";import{abortMaybe as t}from"../../../core/maybe.js";import{debounce as r,throwIfAborted as o,ignoreAbortErrors as s}from"../../../core/promiseUtils.js";import i from"../../../core/RandomLCG.js";import{watch as n}from"../../../core/reactiveUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{projectOrLoad as u}from"../../../geometry/projectionUtils.js";import{fromExtent as d,toExtent as p}from"../../../geometry/support/aaBoundingRect.js";import h from"../../../symbols/support/ElevationInfo.js";import{simulationSettingsEqual as m,getFlowSimulationSettings as c}from"../../2d/engine/flow/utils.js";import f from"./SubView3D.js";import{makeScheduleFunction as g}from"./support/makeScheduleFunction.js";import{FlowWorkerHandle as w}from"../support/flow/FlowWorkerHandle.js";import{materialParametersFromRenderer as y,createStreamlineGeometry as _}from"../support/flow/geometryUtils.js";import{boundingRectOfTiles as v}from"../support/flow/loadUtils.js";import{StreamlinesResources3D as S}from"../support/flow/StreamlinesResources3D.js";import b from"../support/flow/VisualQuery3D.js";import{RibbonLineMaterial as j}from"../webgl-engine/materials/RibbonLineMaterial.js";import{TaskPriority as R}from"../../support/Scheduler.js";let T=class extends f{constructor(e){super(e),this.type="flow",this.renderedTiles=null,this._abortController=null,this._frameTask=null,this.workerHandle=null,this.emissiveStrength=0,this._overrideSimulationSettings=null,this._debouncedLoad=r(async e=>{const{view:t}=this;if(0===e.size)return;const r=this._computeExtent(e);if(null==r)return;const s=new b(r,this.layer.timeExtent,this._viewSizeWithEqualRatio(r),t.state.contentPixelRatio);null==this._abortController&&(this._abortController=new AbortController);const i=this._abortController,n=await this._load(s,i.signal);o(i.signal),null!=n&&(this._resources?.detach(),n.attach(t.stage),this._resources=n)}),this._debugStopLoading=!1}initialize(){const{surface:e}=this,{resourceController:t}=this.view;this.workerHandle=new w(g(t)),this._frameTask=t.scheduler.registerTask(R.FLOW_GENERATOR),this.addHandles([n(()=>this.simulationSettings,()=>this.triggerLoad(),{sync:!0,equals:(e,t)=>null==e&&null==t||null!=e&&null!=t&&m(e,t)}),n(()=>y(this._flowRenderer,this.emissiveStrength),e=>this._resources?.setMaterialParameters(e)),e.on("tiles-changed",({allTiles:e})=>{this._updateRenderedTiles(e)})]),this._updateRenderedTiles(e.allTiles)}destroy(){this.abort(),this.clear()}abort(){this._abortController=t(this._abortController)}get _dataBounds(){const e=u(this.layer.fullExtent,this.surface.spatialReference).geometry;return null==e?null:d(e)}get elevationInfo(){return this.layer.elevationInfo??x}get _flowRenderer(){const e=this.layer.renderer;return"flow"!==e?.type?null:e}get layer(){return this.layerView.layer}get simulationSettings(){const{_flowRenderer:e,_overrideSimulationSettings:t}=this;if(null==e)return null;let r=c(e);return null!=t&&(r={...r,...t}),r}get surface(){return this.view.basemapTerrain}doRefresh(){return this.triggerLoad()}clear(){this._resources?.detach(),this._resources=null}async triggerLoad(){const{renderedTiles:e}=this;if(null==e||0===e.size||this._debugStopLoading)return;const t=this._debouncedLoad(e);return this.updatingHandles.addPromise(s(t))}async _load(e,t){const r=await this.fetchDataAndGenerateStreamlines(e,t);if(null==r||0===r.length)return null;const o=await this._createGeometry(e,r);return new S(r,o)}async fetchDataAndGenerateStreamlines(e,t){return null}async _createGeometry(e,t){const r=new j(y(this._flowRenderer,this.emissiveStrength)),o=new Array,s=new i(1),{view:n,elevationInfo:l}=this;let a=0;const u=async i=>{for(;a<t.length&&!i.done;++a)o.push(_(n,e,t[a],l,r,s)),i.madeProgress();a<t.length&&await this._frameTask.schedule(u)};return await this._frameTask.schedule(u),o}_computeExtent(e){const{_dataBounds:t,surface:{spatialReference:r}}=this;if(null==r||null==t)return null;const o=v(e,t);return null==o?null:p(o,r)}_updateRenderedTiles(e){this.renderedTiles=new Set(e.filter(e=>e.rendered&&e.visible))}_viewSizeWithEqualRatio(e){const t=(e.xmax-e.xmin)/(e.ymax-e.ymin),[r,o]=this.view.size;return r<o?[r,Math.floor(r/t)]:[Math.floor(o*t),o]}get test(){}};e([l()],T.prototype,"type",void 0),e([l()],T.prototype,"renderedTiles",void 0),e([l()],T.prototype,"emissiveStrength",void 0),e([l()],T.prototype,"_dataBounds",null),e([l()],T.prototype,"elevationInfo",null),e([l()],T.prototype,"_flowRenderer",null),e([l()],T.prototype,"layer",null),e([l()],T.prototype,"_overrideSimulationSettings",void 0),e([l()],T.prototype,"simulationSettings",null),e([l()],T.prototype,"surface",null),T=e([a("esri.views.3d.layers.FlowSubView3D")],T);const x=new h({mode:"relative-to-ground",offset:100});export{T 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 r}from"tslib";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 e}from"../../../core/accessorSupport/decorators/subclass.js";import s from"./FeatureLayerViewBase3D.js";let
|
|
5
|
+
import{__decorate as r}from"tslib";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 e}from"../../../core/accessorSupport/decorators/subclass.js";import s from"../../../graphic/GeoJSONGraphicOrigin.js";import t from"./FeatureLayerViewBase3D.js";let i=class extends t{constructor(){super(...arguments),this.type="geojson-3d"}get graphicOrigin(){return new s(this.layer)}};r([o()],i.prototype,"layer",void 0),r([o()],i.prototype,"graphicOrigin",null),i=r([e("esri.views.3d.layers.GeoJSONLayerView3D")],i);const p=i;export{p 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"../../../Graphic.js";import has from"../../../core/has.js";import{initial as t}from"../../../core/reactiveUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{I3SMeshView3D as
|
|
5
|
+
import{__decorate as e}from"tslib";import r from"../../../Graphic.js";import has from"../../../core/has.js";import{initial as t}from"../../../core/reactiveUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import s from"../../../graphic/IntegratedMeshGraphicOrigin.js";import{I3SMeshView3D as a}from"./I3SMeshView3D.js";import{LayerView3D as n}from"./LayerView3D.js";import{updatingProgress as l}from"../support/updatingProperties.js";import p from"../../layers/LayerView.js";import{isInEffectiveScaleRange as d}from"../../support/layerViewUtils.js";const c=.2;let h=class extends(a(n(p))){constructor(){super(...arguments),this.type="integrated-mesh-3d",this._elevationContext="im",this._supportsLabeling=!1,this._applySSAO=!has("disable-feature:im-ssao"),this._shadeNormals=!!has("enable-feature:im-shading"),this.drapeTargetType=1}get i3slayer(){return this.layer}get updatingProgressValue(){return this._controller?.updatingProgress??0}get lodFactor(){return this.view?.qualitySettings?.sceneService?.integratedMesh?.lodFactor??1}get progressiveLoadFactor(){return this.lodFactor>=1?c:1}get visibleAtCurrentScale(){return d(this.i3slayer.effectiveScaleRange,this.view.scale)}get _graphicOrigin(){return new s(this.layer)}get layerPopupEnabledAndHasTemplate(){return!1}initialize(){this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),t),this.view.basemapTerrain.overlayManager.registerDrapeTarget(this)}destroy(){this.view.basemapTerrain.overlayManager.unregisterDrapeTarget(this)}_createLayerGraphic(){return new r({layer:this.layer,sourceLayer:this.layer,origin:this._graphicOrigin})}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>this._modifications=e.toArray(),t),"modifications")}};e([i()],h.prototype,"layer",void 0),e([i()],h.prototype,"i3slayer",null),e([i(l)],h.prototype,"updatingProgress",void 0),e([i()],h.prototype,"updatingProgressValue",null),e([i()],h.prototype,"lodFactor",null),e([i({readOnly:!0})],h.prototype,"progressiveLoadFactor",null),e([i({readOnly:!0})],h.prototype,"visibleAtCurrentScale",null),e([i()],h.prototype,"_graphicOrigin",null),h=e([o("esri.views.3d.layers.IntegratedMeshLayerView3D")],h);const g=h;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
|
-
import{__decorate as e}from"tslib";import r from"../../../core/Error.js";import{property as
|
|
5
|
+
import{__decorate as e}from"tslib";import r from"../../../core/Error.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import o from"../../../graphic/OGCFeatureGraphicOrigin.js";import s from"./FeatureLayerViewBase3D.js";import a from"../../layers/OGCFeatureLayerView.js";let p=class extends(a(s)){constructor(){super(...arguments),this.type="ogc-feature-3d"}get graphicOrigin(){return new o(this.layer)}initialize(){this.layer.serviceSupportsSpatialReference(this.view.spatialReference)||this.addResolvingPromise(Promise.reject(new r("layerview:spatial-reference-incompatible","The spatial references supported by this OGC layer are incompatible with the spatial reference of the view",{layer:this.layer})))}};e([t()],p.prototype,"layer",void 0),e([t()],p.prototype,"graphicOrigin",null),p=e([i("esri.views.3d.layers.OGCFeatureLayerView3D")],p);const c=p;export{c as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import{result as r,forEach as s}from"../../../core/asyncUtils.js";import"../../../core/has.js";import o from"../../../core/Logger.js";import{destroyMaybe as n,abortMaybe as a}from"../../../core/maybe.js";import{estimateNumberArrayMemory as d,baseObjectMemory as l,estimateNumberMemory as u,estimateFixedArrayMemory as h,baseArrayMemory as p}from"../../../core/memoryEstimations.js";import{isAbortError as c,allSettledValues as _,throwIfAborted as m}from"../../../core/promiseUtils.js";import{initial as g,watch as f,sync as y}from"../../../core/reactiveUtils.js";import{pt2px as b}from"../../../core/screenUtils.js";import{isArrayBuffer as w}from"../../../core/typedArrayUtil.js";import{property as N}from"../../../core/accessorSupport/decorators/property.js";import{subclass as P}from"../../../core/accessorSupport/decorators/subclass.js";import{l as x,f as v,e as C,c as S}from"../../../chunks/vec32.js";import{clone as I}from"../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{fromValues as A}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import R from"../../../geometry/Extent.js";import j from"../../../geometry/Point.js";import{projectBoundingSphere as k}from"../../../geometry/projection/projectBoundingSphere.js";import{projectVectorToVector as V}from"../../../geometry/projection/projectVectorToVector.js";import{create as Q,fromMinMax as F}from"../../../geometry/support/aaBoundingBox.js";import{fromNormalAndOffset as L,create as E}from"../../../geometry/support/plane.js";import{f as D}from"../../../chunks/sphere.js";import U from"../../../layers/graphics/OptimizedGeometry.js";import{QueryEngine as O}from"../../../layers/graphics/data/QueryEngine.js";import{CodedValue as q}from"../../../layers/support/CodedValue.js";import M from"../../../layers/support/CodedValueDomain.js";import"../../../layers/support/Domain.js";import"../../../layers/support/InheritedDomain.js";import"../../../layers/support/RangeDomain.js";import{unpackFieldNames as W}from"../../../layers/support/fieldUtils.js";import{PromiseQueue as G}from"../../../layers/support/PromiseQueue.js";import z from"../../../rest/support/FeatureSet.js";import H from"../../../rest/support/Query.js";import{getElevationOffset as B}from"../../../support/elevationInfoUtils.js";import{LayerView3D as T}from"./LayerView3D.js";import{PointCloudLayerViewPerformanceInfo as $,QueuePerformanceInfo as J}from"./PointCloudLayerViewPerformanceInfo.js";import{PointCloudWorkerHandle as K}from"./PointCloudWorkerHandle.js";import{I3SQueryFeatureStore as Z}from"./i3s/I3SQueryFeatureStore.js";import{checkPointCloudLayerValid as Y,checkPointCloudLayerCompatibleWithView as X}from"./i3s/I3SUtil.js";import{nodeDiff as ee,sortFrontToBack as te,splitWorkEntries as ie}from"./i3s/LoDUtil.js";import{PagedNodeIndex as re}from"./i3s/PagedNodeIndex.js";import{PointCloudGraphic as se}from"./i3s/PointCloudGraphic.js";import{PointCloudRenderer as oe}from"./i3s/PointCloudRenderer.js";import{isPointRendererNode as ne,PointCloudRendererNode as ae}from"./i3s/PointCloudRendererNode.js";import{getSplatSizeAlgorithm as de,getFixedSizeAlgorithm as le,getRendererInfo as ue,getFilterInfo as he,rendererUsesFixedSizes as pe,getAttributeInfo as ce}from"./i3s/PointCloudRendererUtil.js";import{getAttributeValues as _e,readGeometry as me,elevationFromPositions as ge}from"./i3s/PointCloudWorkerUtil.js";import{normalizeHighlightTarget as fe,emptyHighlightHandle as ye}from"./support/highlightUtils.js";import{PopupSceneLayerView as be}from"./support/PopupSceneLayerView.js";import{projectToBoundingBox as we}from"../support/extentUtils.js";import{computeMapPointFromVec3d as Ne}from"../support/hitTest.js";import{Obb as Pe}from"../support/orientedBoundingBox.js";import{updatingProgress as xe}from"../support/updatingProperties.js";import ve from"../../layers/LayerView.js";import Ce from"../../layers/PointCloudLayerView.js";import{getHighlightName as Se}from"../../support/highlightOptionsUtils.js";import{isInEffectiveScaleRange as Ie}from"../../support/layerViewUtils.js";import{TaskPriority as Ae}from"../../support/Scheduler.js";const Re=8,je=E();let ke=class extends(Ce(be(T(ve)))){constructor(){super(...arguments),this.type="point-cloud-3d",this.maximumPointCount=4e6,this.slicePlaneEnabled=!1,this._renderer=null,this._rendererAdded=!1,this._renderedNodes=new Set,this._updateViewNeeded=!0,this._lodFactor=1,this._maxLoggedBoxWarnings=5,this._pageMultiplier=1,this._nodeLoadEpoch=0,this._indexQueue=[],this._workQueue=new Array,this._idleQueue=new G,this._indexPagesLoading=new Map,this._loadingNodes=new Map,this._recalcWork=!0,this._layerIsVisible=!1,this._codedDomainPopulationPromise=null,this._codedDomainPopulationAbortController=null,this._totalWork=0,this._index=null,this._loadingInitNodePage=!1,this._nodeIdArray=[],this.ignoresMemoryFactor=!1}get baseUrl(){return this.layer.parsedUrl?.path??""}get pointScale(){const e=de(this.layer?.renderer),t=1;return null!=e?.scaleFactor?e.scaleFactor:t}get useRealWorldSymbolSizes(){const e=le(this.layer?.renderer),t=!1;return null!=e?.useRealWorldSymbolSizes?e.useRealWorldSymbolSizes:t}get pointSize(){const e=le(this.layer?.renderer),t=0;return null!=e?.size?e.size:t}get inverseDensity(){const e=96;return this.layer?.renderer?1*e/this.layer.renderer.pointsPerInch:5}get availableFields(){const e=ue(this.layer),t=new Set;e.primaryAttribute&&t.add(e.primaryAttribute.name),e.modulationAttribute&&t.add(e.modulationAttribute.name);const i=he(this.layer);if(i)for(const r of i)r.attributeInfo&&t.add(r.attributeInfo.name);if(this.layer.outFields)for(const r of W(this.layer.fieldsIndex,this.layer.outFields))t.add(r);return Array.from(t)}get _clippingBox(){if(!this.view||!this.view.clippingArea)return null;const e=Q(),t=this.view.renderSpatialReference;return we(this.view.clippingArea,e,t)?e:null}get _elevationOffset(){const e=this.layer&&this.layer.elevationInfo;return e&&"absolute-height"===e.mode?B(e,this.layer.spatialReference):0}initialize(){const e=this.view.resourceController,t=Ee(e);this._worker=new K(t),this.addResolvingPromise(this._worker.promise),Y(this.layer),X(this.layer,this.view),this._indexRequester=e.createStreamDataRequester(2),this._dataRequester=e.createStreamDataRequester(3),this._initRenderer();const i=this._initNodePages(),r=this.view.resourceController.memoryController;this._memCache=r.newCache(`pcl-${this.layer.uid}`),this._queryFeaturesCache=r.newCache(`pcl-query-features-${this.layer.uid};`),this._updatingHandles.add(()=>this._clippingBox,()=>this._setUpdateViewNeeded(),g),this._updatingHandles.add(()=>this._elevationOffset,()=>this._elevationOffsetChanged(),g),this._updatingHandles.add(()=>this.layer.renderer,()=>this._rendererChanged(),g),this._updatingHandles.add(()=>this.layer.filters,()=>this._reload(),g),this._updatingHandles.add(()=>this.layer.outFields,()=>this._reload(),g),this._updatingHandles.add(()=>this.layer.effectiveScaleRange,()=>this._setUpdateViewNeeded()),this._updatingHandles.add(()=>this.view.state.contentCamera,()=>this._setUpdateViewNeeded()),this.addHandles([f(()=>this.view.quality,()=>this._setUpdateViewNeeded(),y)]),this.addResolvingPromise(i),this.when(()=>{this.addHandles([e.scheduler.registerTask(Ae.POINT_CLOUD_LAYER,this),e.scheduler.registerIdleStateCallbacks(()=>this._idleBegin(),()=>this._idleEnd()),this._updatingHandles.add(()=>this.suspended,e=>{e?this._clearNodeState():this._setUpdateViewNeeded()},g)])},()=>{this._updatingHandles.removeAll(),this.removeAllHandles()})}_setUpdateViewNeeded(){this._updateViewNeeded=!0,this._updateLoading()}destroy(){this.cancelLoading(),this._worker=n(this._worker),this._destroyRenderer(),this._memCache=n(this._memCache),this._queryFeaturesCache=n(this._queryFeaturesCache),this._queryEngine=n(this._queryEngine),this._codedDomainPopulationAbortController=a(this._codedDomainPopulationAbortController),this._codedDomainPopulationPromise=null}_initRenderer(){this._renderer=new oe({createGraphic:(e,t,i)=>this._createGraphic(e,t,i)}),this._renderer.layerViewUid=this.uid,this._updatingHandles.add(()=>this._clippingBox,e=>this._renderer.clippingBox=e,g),this._updatingHandles.add(()=>this.suspended,e=>this._setPointsVisible(!e),g),this._updatingHandles.add(()=>this.pointScale,e=>this._renderer.scaleFactor=e,g),this._renderer.minSizePx=Math.sqrt(2),this._updatingHandles.add(()=>this.useRealWorldSymbolSizes,e=>this._renderer.useRealWorldSymbolSizes=e,g),this._updatingHandles.add(()=>this.pointSize,e=>{const t=b(e);this._renderer.size=e,this._renderer.sizePx=t},g),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._renderer.slicePlaneEnabled=e,g),this._updatingHandles.add(()=>this.inverseDensity,()=>this._setUpdateViewNeeded(),g),this._updatingHandles.add(()=>this.maximumPointCount,()=>this._setUpdateViewNeeded(),g),this._updatingHandles.add(()=>this.view.qualitySettings.sceneService.pointCloud.lodFactor,e=>{this._lodFactor=e,this._setUpdateViewNeeded()},g)}_destroyRenderer(){this._renderer.removeAll(),this._setPointsVisible(!1)}_createGraphic(e,t,i,r){const s=null!=e.pointIdFilterMap?e.pointIdFilterMap[t]:t,o=i?"declaredClass"in i?i:Ne(this.view,i):null;return r??=this._createGraphicAttributes(e,s),new se({pointCloudMetadata:{nodeId:e.id,pointIndexInNode:t,attributePointIndexInNode:s,epoch:this._nodeLoadEpoch},geometry:o,attributes:r,layer:this.layer,sourceLayer:this.layer})}_createGraphicAttributes(e,t){const i={};for(const r of e.attributes)this._encodeGraphicAttribute(r.attributeInfo,r.values,t,i);return i}_getGraphicAttribute(e,t,i){const r=e.storageInfo?.attributeValues,s=r?.valuesPerElement??1;if(1===s)return t[i];if("UInt8"===r?.valueType&&s<=4){let e=0;const r=i*s;for(let i=r;i<r+s;i++)e=(e<<8)+t[i];return e}}_encodeGraphicAttribute(e,t,i,r){r[e.name]=this._getGraphicAttribute(e,t,i)}_setPointsVisible(e){e&&!this._rendererAdded?(this.view.stage.addRenderPlugin(this._renderer),this._rendererAdded=!0):!e&&this._rendererAdded&&(this.view.stage.removeRenderPlugin(this._renderer),this._rendererAdded=!1)}_rendererChanged(){this._renderer.useFixedSizes=pe(this.layer.renderer),this._reload()}_reload(){this._clearNodeState(),this._memCache.clear(),this._setUpdateViewNeeded()}_elevationOffsetChanged(){this._clearNodeState(),this._memCache.clear(),this._initNodePages()}_displayNodes(e){this._workQueue=ee([...this._renderedNodes],e,this._index),te(this._workQueue,this.view.state.contentCamera.viewForward,this._index),ie(this._workQueue,Re,this._index),this._updateQueues(),this._totalWork=this._computeWork(),this._updateLoading(),this._layerIsVisible=e.length>0||this._loadingInitNodePage,this.notifyChange("suspended")}cancelLoading(){this._cancelNodeLoading(),this._cancelIndexLoading()}_cancelNodeLoading(){const e=new Array;this._loadingNodes.forEach(({abortController:t})=>e.push(t)),this._loadingNodes.clear();for(const t of e)t.abort();this._workQueue=[],this._idleQueue.cancelAll(),this._totalWork=this._computeWork(),this._updateLoading()}_updateQueues(){const e=new Set;this._workQueue.forEach(t=>t.load.forEach(t=>e.add(t)));const t=new Array,i=new Map;this._loadingNodes.forEach((r,s)=>{e.has(s)?i.set(s,r):t.push(r)}),this._loadingNodes=i;for(const{abortController:r}of t)r.abort();this._workQueue=this._workQueue.filter(e=>{for(const t of e.load)if(this._loadingNodes.has(t))return this._recalcWork=!0,!1;return!0}),this._totalWork=this._computeWork(),this._updateLoading()}_cancelIndexLoading(){this._indexQueue=[],this._indexPagesLoading.forEach(({abortController:e})=>e.abort()),this._indexPagesLoading.clear(),this._totalWork=this._computeWork(),this._updateLoading()}_clearNodeState(){this._nodeLoadEpoch++,this._renderedNodes.forEach(e=>this._removeFromRenderer(e)),this._cancelNodeLoading()}_idleBegin(){this._setUpdateViewNeeded()}_idleEnd(){this._setUpdateViewNeeded()}get running(){return this.suspended?this._updateViewNeeded:this._updateViewNeeded||this._indexQueue.length>0||this._workQueue.length>0||this._idleQueue.running}runTask(e){if(this.suspended){if(this._updateViewNeeded){this._updateViewNeeded=!1;const e=this._isRootNodeVisible();e!==this._layerIsVisible&&(this._layerIsVisible=e,this.notifyChange("suspended")),this._updateLoading()}}else{for(e.run(()=>this._updateWorkQueues());this._indexQueue.length>0&&e.run(()=>this._processIndexQueue()););this._processWorkQueue(e),this._idleQueue.runTask(e)}}_processIndexQueue(){const e=this._indexQueue.shift(),t=this._loadNodePage(e);return this._indexPagesLoading.set(e,t),t.promise.then(t=>{this._index.addPage(e,t,this._elevationOffset),this._setUpdateViewNeeded()}).then(()=>{this._indexPagesLoading.delete(e)},()=>{this._indexPagesLoading.delete(e)}),!0}_processWorkQueue(e){for(;!e.done;){const t=this._scheduleWorkEntry();if(null==t)return void e.madeProgress();this._processWorkEntry(t),e.madeProgress()}}_scheduleWorkEntry(){let e=this._workQueue.length;for(;e--;){const e=this._workQueue.shift();if(!e.remove.find(e=>!this._renderedNodes.has(e)))return e;this._workQueue.push(e)}return null}_processWorkEntry(e){if(0!==e.load.length)Promise.all(e.load.map(e=>{const t=new AbortController,i=this._memCache.pop(e.toString());return null!=i?this._loadingNodes.set(e,{abortController:t,promise:Promise.resolve(i)}):this._loadingNodes.has(e)||this._loadingNodes.set(e,{abortController:t,promise:this._loadNode(e,t.signal)}),this._loadingNodes.get(e).promise})).then(t=>{for(let i=0;i<e.load.length;i++)if(t[i]){const r=this._setupRendererData(e.load[i],t[i]);this._addToRenderer(r)}for(const i of e.remove)this._removeFromRenderer(i)}).catch(()=>{}).then(()=>{for(const t of e.load)this._loadingNodes.delete(t);this._updateLoading(),this._recalcWork&&!this._idleQueue.updating&&0===this._indexQueue.length&&0===this._loadingNodes.size&&(this._recalcWork=!1,this._setUpdateViewNeeded())}),this._updateLoading();else for(const t of e.remove)this._removeFromRenderer(t)}async _populateClassCodeCodedDomain(e,t){const i="CLASS_CODE",s=this.layer.fieldsIndex.get(i);if(!s||s.domain)return;if(!e.includes(s.name))return;const o=await r(this.layer.queryCachedStatistics(i,{signal:t}));if(!1===o.ok)return;const n=o.value?.stats?.labels?.labels;n&&Array.isArray(n)&&(s.domain=new M({name:"CLASS_CODE",codedValues:n.map(e=>new q({code:e.value,name:e.label}))}))}async prepareFetchPopupFeatures(e){return this._codedDomainPopulationPromise||(this._codedDomainPopulationAbortController=new AbortController,this._codedDomainPopulationPromise=this._populateClassCodeCodedDomain(e,this._codedDomainPopulationAbortController.signal).then(()=>{this._codedDomainPopulationAbortController=null})),this._codedDomainPopulationPromise}async whenGraphicAttributes(e,t){const r=this._splitGraphicsPerNode(e),o=this.layer.attributeStorageInfo,n=t.map(e=>ce(o,e)).filter(i),a=async(e,t)=>{const i=this._index.getNode(t);await s(n,async t=>{const r=t.useElevation?await this._loadElevationAttributeFromGeometry(i.resourceId):await this._loadAndParseAttribute(i,t);if(r)for(const i of e)if(this._isValidPointGraphic(i)){const e=i.pointCloudMetadata.attributePointIndexInNode;this._encodeGraphicAttribute(t,r,e,i.attributes)}})},d=[];return r.forEach((e,t)=>{d.push(a(e,t))}),await Promise.allSettled(d),e}_isValidPointGraphic(e){return e instanceof se&&e.pointCloudMetadata?.epoch===this._nodeLoadEpoch}_splitGraphicsPerNode(e){const t=new Map;for(const i of e){if(!this._isValidPointGraphic(i))continue;const e=i.pointCloudMetadata,r=t.get(e.nodeId);r?r.push(i):t.set(e.nodeId,[i])}return t}async _loadAndParseAttribute(e,t){const i=await this._loadAttribute(e.resourceId,t,null);return i?_e({attributeInfo:t,buffer:i},null,e.vertexCount):null}async _loadElevationAttributeFromGeometry(e){const t=this.layer.store.defaultGeometrySchema,i=me(t,await this._loadGeometry(e,null));return ge(i,i.length/3)}highlight(e,i){const r=fe(e);if(0===r.length)return ye;if(!(r[0]instanceof t))return ye;const s=r;return this._renderer.highlight(s.map(e=>this._graphicToPointDefinition(e)),Se(i))}_graphicToPointDefinition(e){if(!this._isValidPointGraphic(e))return null;const{nodeId:t,pointIndexInNode:i}=e.pointCloudMetadata;return null!=t&&null!=i?{nodeId:t,pointId:i}:null}_computeWork(){let e=0;for(const t of this._workQueue)e+=t.load.length+t.remove.length;return e+=this._loadingNodes.size,e+=(this._indexQueue.length+this._indexPagesLoading.size)*this._index.pageSize,e+=this._loadingInitNodePage?100:0,e+=this._updateViewNeeded?100:0,e}get updatingProgressValue(){if(this.suspended)return this._updateViewNeeded?0:1;const e=this._computeWork();return 1-Math.min(this._totalWork,e)/this._totalWork}_updateLoading(){this.notifyChange("updating"),this.notifyChange("updatingProgressValue")}canResume(){return super.canResume()&&this._layerIsVisible}isUpdating(){return this.suspended?this._updateViewNeeded:this._computeWork()>0}get visibleAtCurrentScale(){return Ie(this.layer.effectiveScaleRange,this.view.scale)}async queryFeatures(e,i){const r=await this._ensureQueryEngine().executeQuery(this._ensureQueryJSON(e),i?.signal),s=r.features;r.features=[];const o=z.fromJSON(r),n=this.view.spatialReference;return o.features=s.map(e=>{const{attributes:i,metadata:r}=e;if(!r){const i=t.fromJSON(e);return i.geometry&&(i.geometry.spatialReference=o.spatialReference??n),i}const s=j.fromJSON(e.geometry);return s.spatialReference=o.spatialReference??n,this._createGraphic(r.node,r.pointId,s,i)}),o}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference,returnZ:!0};return new H(e)}async queryFeatureCount(e,t){return await this._ensureQueryEngine().executeQueryForCount(this._ensureQueryJSON(e),t?.signal)}async queryExtent(e,t){const{count:i,extent:r}=await this._ensureQueryEngine().executeQueryForExtent(this._ensureQueryJSON(e),t?.signal);return{count:i,extent:R.fromJSON(r)}}_ensureQueryJSON(e){return null==e?new H({outSpatialReference:this.view.spatialReference}).toJSON():H.from(e).toJSON()}_ensureQueryEngine(){if(this._queryEngine)return this._queryEngine;const{spatialReference:e}=this.view;return this._queryEngine=new O({fieldsIndex:this.layer.fieldsIndex.toJSON(),geometryType:"esriGeometryPoint",spatialReference:e,featureIdInfo:{type:"object-id",fieldName:"objectId"},hasZ:!0,featureStore:new Z({sourceSpatialReference:e,viewSpatialReference:e,forAllFeatures:(e,t)=>{let i=!1;this._renderer.forEachNode(r=>{if(i)return;if(t){const e=r.obb,s=D(e.center[0],e.center[1],e.center[2],x(e.halfSize));k(s,this.view.renderSpatialReference,s,this.view.spatialReference);const o=t(s);if(2===o)return;if(i=0===o,i)return}let s=this._queryFeaturesCache.get(`${r.id}`);s||(s=this._createQueryPointFeatures(r),this._queryFeaturesCache.put(`${r.id}`,s)),s.features.forEach(e)})},getFeatureExtent:({point:e},t)=>F(e,e,t),featureAdapter:{cloneWithGeometry:(e,t)=>new Qe(e.node,e.pointId,t.coords),getAttribute:({node:e,attributePointId:t},i)=>{for(const r of e.attributes)if(r.attributeInfo.name===i)return this._getGraphicAttribute(r.attributeInfo,r.values,t)},getAttributes:({node:e,attributePointId:t})=>this._createGraphicAttributes(e,t),getCentroid:e=>e.getGeometry(),getGeometry:e=>e.getGeometry(),getObjectId:()=>{},getMetadata:e=>e}})}),this._queryEngine}_createQueryPointFeatures(e){const t=e.coordinates,i=new Array;for(let r=0;r<t.length/3;r++){const s=3*r,o=A(t[s+0],t[s+1],t[s+2]);v(o,o,e.origin),V(o,this.view.renderSpatialReference,o,this.view.spatialReference);const n=new Qe(e,r,o);i.push(n)}return new Fe(i)}_initNodePages(){const e=this.layer.store.index,t=e.nodesPerPage||e.nodePerIndexBlock;return this._index=new re(this.layer.spatialReference,this.view.renderCoordsHelper.spatialReference,t),this._cancelIndexLoading(),this._traverseVisible=this._index.createVisibilityTraverse(),this._loadingInitNodePage=!0,this._layerIsVisible=!0,this.notifyChange("suspended"),this._updateLoading(),this._pageMultiplier=null!=e.nodesPerPage?1:e.nodePerIndexBlock,this._loadNodePage(0).promise.then(e=>{this._index.addPage(0,e,this._elevationOffset),this._loadingInitNodePage=!1,this._setUpdateViewNeeded()})}_loadNodePage(e){const t=new AbortController,i=`${this.baseUrl}/nodepages/${e*this._pageMultiplier}`;return{promise:this._requestNodePage(i,t.signal).then(t=>t.nodes.map((t,i)=>({resourceId:null!=t.resourceId?t.resourceId:e*this._index.pageSize+i,obb:Pe.fromJSON(t.obb),obbInRenderSR:new Pe,firstChild:t.firstChild,childCount:t.childCount,vertexCount:t.vertexCount??t.pointCount,lodThreshold:t.lodThreshold??t.effectiveArea}))),abortController:t}}_updateWorkQueues(){if(!this._updateViewNeeded)return!1;const e=this.view.quality;let t=this.inverseDensity/this._lodFactor*e;const i=this.maximumPointCount*this._lodFactor*e;let r=this._computeNodesForMinimumDensity(t),s=this._computePointCount(r),o=Math.sqrt(s/(.75*i));for(;s>i;)t*=o,r=this._computeNodesForMinimumDensity(t),s=this._computePointCount(r),o=Math.sqrt(2);return this._displayNodes(r),this._updateViewNeeded=!1,this._updateLoading(),!0}_computePointCount(e){let t=0;for(let i=0;i<e.length;i++){const r=this._index.getNode(e[i]);r&&(t+=r.vertexCount)}return t}_isRootNodeVisible(){let e=!1;return this._traverseVisible({frustum:this.view.state.contentCamera.frustum,clippingBox:this._clippingBox},{predicate:(t,i,r)=>(e=r,!1),pageMiss:()=>{}}),e}_computeNodesForMinimumDensity(e){const t=this.view.state.contentCamera,i=t.frustum,r=this._clippingBox,s=t.viewForward,o=C(s,t.eye),n=L(s,-o,je),a=t.perScreenPixelRatio/2,d=e*e,l=this._nodeIdArray;l.length=0;const u=e=>l.push(e);return this._traverseVisible({frustum:i,clippingBox:r},{predicate:(e,t,i)=>{if(!i)return!1;if(0===t.childCount)return u(e),!1;const r=this._index.getRenderObb(e);return!(this._computeAveragePixelArea(r,t.lodThreshold,t.vertexCount,n,a)<=d)||(u(e),!1)},pageMiss:(e,t)=>{u(e),this._indexQueue.includes(t)||this._indexQueue.push(t)}}),l}_computeAveragePixelArea(e,t,i,r,s){const o=1e-7,n=Math.max(o,e.minimumDistancePlane(r));return t/(n*n)/(4*s*s)/i}_loadNode(e,t){try{return this._loadNodeAsync(e,t)}catch(i){throw c(i)||o.getLogger(this).error(i),i}}async _loadAdditionalUserAttributes(e,t,r){const s=this.layer.outFields;if(!s)return[];const o=W(this.layer.fieldsIndex,s),n=new Set(e.map(e=>null!=e?e.name:null)),a=this.layer.attributeStorageInfo,d=[];for(const i of o){if(n.has(i))continue;const e=ce(a,i);e&&d.push(t(e))}const l=await _(d);return m(r),l.filter(i)}async _loadNodeAsync(e,t){const i=this._index.getNode(e),r=ue(this.layer),s=he(this.layer),o=i.resourceId,n=async e=>{if(!e)return null;if(e.useElevation)return{attributeInfo:e,buffer:null};const i=await this._loadAttribute(o,e,t);return null!=i?{attributeInfo:e,buffer:i}:null};return this._idleQueue.push(async()=>{const i=this._loadGeometry(o,t),{primaryAttribute:a,modulationAttribute:d}=r,l=n(a),u=n(d),h=s.map(e=>e.attributeInfo),p=h.map(e=>n(e)),c=this._loadAdditionalUserAttributes([a,d,...h],n,t),[_,g,f,y,b]=await Promise.all([i,l,u,Promise.all(p),c]);m(t);const w={geometryBuffer:_,primaryAttributeData:g,modulationAttributeData:f,filterAttributesData:y,userAttributesData:b,schema:this.layer.store.defaultGeometrySchema,rendererInfo:r,filterInfo:s,obbData:this._index.getRenderObb(e).data,elevationOffset:this._elevationOffset,inSR:this.layer.spatialReference.toJSON(),outSR:this.view.renderCoordsHelper.spatialReference.toJSON()};return this._worker.invoke(w,t)},t)}async _loadGeometry(e,t){return this._requestData(`${this.baseUrl}/nodes/${e}/geometries/0`,t)}async _loadAttribute(e,t,i){if(!t?.storageInfo)return null;const r=t.storageInfo.key;return this._requestData(`${this.baseUrl}/nodes/${e}/attributes/${r}`,i)}_requestNodePage(e,t){const i={f:"json",...this.layer.customParameters,token:this.layer.apiKey};return this._indexRequester.request(e,0,{query:i,signal:t})}_requestData(e,t){return this._dataRequester.request(e,1,{query:{...this.layer.customParameters,token:this.layer.apiKey},signal:t})}_removeFromRenderer(e){if(this._renderedNodes.has(e)){const t=this._renderer.removeNode(e);this._renderedNodes.delete(e),this._memCache.put(t.id.toString(),t)}}_addToRenderer(e){this._renderedNodes.has(e.id)||(this._renderedNodes.add(e.id),this._renderer.addNode(e))}_setupRendererData(e,t){const i=this._index.getNode(e),r=Math.sqrt(i.lodThreshold/i.vertexCount),s=this._index.getRenderObb(e);if(ne(t))return t.splatSize=r,t.obb=s,S(t.origin,t.obb.center),t;const n=Pe.fromData(t.obbData),a=n.halfSize,d=s.halfSize,l=.01*Math.max(d[0],d[1],d[2]);if(a[0]>d[0]+l||a[1]>d[1]+l||a[2]>d[2]+l){if(this._maxLoggedBoxWarnings>0){const t=e=>`[${e.halfSize[0]}, ${e.halfSize[1]}, ${e.halfSize[2]}]`;o.getLogger(this).warn(`Node ${e} reported bounding box too small. got ${t(s)} but points cover ${t(n)}`),0===--this._maxLoggedBoxWarnings&&o.getLogger(this).warn(" Too many bounding box errors, stopping reporting for this layer.")}this._index.setRenderObb(e,n)}return new ae(e,r,I(s.center),s,0===i.childCount,t.points,t.rgb,t.attributes,t.pointIdFilterMap)}get usedMemory(){let e=0;return this._renderer.forEachNode(t=>{e+=Le,e+=d(t.coordinates);for(const i of t.attributes){const t=i.values;w(t.buffer)&&(e+=d(t))}}),e}get unloadedMemory(){const e=this._renderedNodes.size;if(e<4)return 0;const t=[...this._renderedNodes].reduce((e,t)=>e+this._index.getNode(t).vertexCount);let i=this._loadingNodes.size;for(let r=0;r<this._workQueue.length;r++)i+=this._workQueue[r].load.length,i-=this._workQueue[r].remove.length;if(i<0)return 0;return i*t/e*((this.usedMemory-e*Le)/t)+i*Le}get performanceInfo(){return new $(this.usedMemory,this._renderedNodes.size,[...this._renderedNodes].reduce((e,t)=>e+this._index.getNode(t).vertexCount,0),this.maximumPointCount,new J(this._loadingNodes.size,this._indexQueue.length,this._workQueue.length,this._idleQueue.length))}get test(){}};e([N()],ke.prototype,"layer",void 0),e([N()],ke.prototype,"baseUrl",null),e([N()],ke.prototype,"pointScale",null),e([N()],ke.prototype,"useRealWorldSymbolSizes",null),e([N()],ke.prototype,"pointSize",null),e([N()],ke.prototype,"inverseDensity",null),e([N()],ke.prototype,"maximumPointCount",void 0),e([N({readOnly:!0})],ke.prototype,"availableFields",null),e([N({readOnly:!0})],ke.prototype,"_clippingBox",null),e([N({readOnly:!0})],ke.prototype,"_elevationOffset",null),e([N({type:Boolean})],ke.prototype,"slicePlaneEnabled",void 0),e([N()],ke.prototype,"updating",void 0),e([N(xe)],ke.prototype,"updatingProgress",void 0),e([N({readOnly:!0})],ke.prototype,"updatingProgressValue",null),e([N({readOnly:!0})],ke.prototype,"visibleAtCurrentScale",null),ke=e([P("esri.views.3d.layers.PointCloudLayerView3D")],ke);const Ve=ke;class Qe{constructor(e,t,i){this.node=e,this.pointId=t,this.point=i}getGeometry(){return new U([1],Array.from(this.point))}get attributePointId(){const{node:e,pointId:t}=this;return null!=e.pointIdFilterMap?e.pointIdFilterMap[t]:t}get usedMemory(){return l+l+u+h(this.point,u)}}class Fe{constructor(e){this.features=e}get cachedMemory(){return this.features.reduce((e,t)=>e+t.usedMemory,l+p)}}const Le=160;function Ee(e){return t=>e.immediate.schedule(t)}export{Ve as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import{result as r,forEach as s}from"../../../core/asyncUtils.js";import"../../../core/has.js";import o from"../../../core/Logger.js";import{destroyMaybe as n,abortMaybe as a}from"../../../core/maybe.js";import{estimateNumberArrayMemory as d,baseObjectMemory as l,estimateNumberMemory as u,estimateFixedArrayMemory as h,baseArrayMemory as p}from"../../../core/memoryEstimations.js";import{isAbortError as c,allSettledValues as _,throwIfAborted as m}from"../../../core/promiseUtils.js";import{initial as g,watch as f,sync as y}from"../../../core/reactiveUtils.js";import{pt2px as b}from"../../../core/screenUtils.js";import{isArrayBuffer as w}from"../../../core/typedArrayUtil.js";import{property as P}from"../../../core/accessorSupport/decorators/property.js";import{subclass as N}from"../../../core/accessorSupport/decorators/subclass.js";import{l as x,f as v,e as C,c as S}from"../../../chunks/vec32.js";import{clone as I}from"../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{fromValues as A}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import R from"../../../geometry/Extent.js";import j from"../../../geometry/Point.js";import{projectBoundingSphere as k}from"../../../geometry/projection/projectBoundingSphere.js";import{projectVectorToVector as V}from"../../../geometry/projection/projectVectorToVector.js";import{create as Q,fromMinMax as F}from"../../../geometry/support/aaBoundingBox.js";import{fromNormalAndOffset as L,create as E}from"../../../geometry/support/plane.js";import{f as D}from"../../../chunks/sphere.js";import O from"../../../graphic/PointCloudGraphicOrigin.js";import U from"../../../layers/graphics/OptimizedGeometry.js";import{QueryEngine as q}from"../../../layers/graphics/data/QueryEngine.js";import{CodedValue as G}from"../../../layers/support/CodedValue.js";import M from"../../../layers/support/CodedValueDomain.js";import"../../../layers/support/Domain.js";import"../../../layers/support/InheritedDomain.js";import"../../../layers/support/RangeDomain.js";import{unpackFieldNames as W}from"../../../layers/support/fieldUtils.js";import{PromiseQueue as z}from"../../../layers/support/PromiseQueue.js";import H from"../../../rest/support/FeatureSet.js";import B from"../../../rest/support/Query.js";import{getElevationOffset as T}from"../../../support/elevationInfoUtils.js";import{LayerView3D as $}from"./LayerView3D.js";import{PointCloudLayerViewPerformanceInfo as J,QueuePerformanceInfo as K}from"./PointCloudLayerViewPerformanceInfo.js";import{PointCloudWorkerHandle as Z}from"./PointCloudWorkerHandle.js";import{I3SQueryFeatureStore as Y}from"./i3s/I3SQueryFeatureStore.js";import{checkPointCloudLayerValid as X,checkPointCloudLayerCompatibleWithView as ee}from"./i3s/I3SUtil.js";import{nodeDiff as te,sortFrontToBack as ie,splitWorkEntries as re}from"./i3s/LoDUtil.js";import{PagedNodeIndex as se}from"./i3s/PagedNodeIndex.js";import{PointCloudGraphic as oe}from"./i3s/PointCloudGraphic.js";import{PointCloudRenderer as ne}from"./i3s/PointCloudRenderer.js";import{isPointRendererNode as ae,PointCloudRendererNode as de}from"./i3s/PointCloudRendererNode.js";import{getSplatSizeAlgorithm as le,getFixedSizeAlgorithm as ue,getRendererInfo as he,getFilterInfo as pe,rendererUsesFixedSizes as ce,getAttributeInfo as _e}from"./i3s/PointCloudRendererUtil.js";import{getAttributeValues as me,readGeometry as ge,elevationFromPositions as fe}from"./i3s/PointCloudWorkerUtil.js";import{normalizeHighlightTarget as ye,emptyHighlightHandle as be}from"./support/highlightUtils.js";import{PopupSceneLayerView as we}from"./support/PopupSceneLayerView.js";import{projectToBoundingBox as Pe}from"../support/extentUtils.js";import{computeMapPointFromVec3d as Ne}from"../support/hitTest.js";import{Obb as xe}from"../support/orientedBoundingBox.js";import{updatingProgress as ve}from"../support/updatingProperties.js";import Ce from"../../layers/LayerView.js";import Se from"../../layers/PointCloudLayerView.js";import{getHighlightName as Ie}from"../../support/highlightOptionsUtils.js";import{isInEffectiveScaleRange as Ae}from"../../support/layerViewUtils.js";import{TaskPriority as Re}from"../../support/Scheduler.js";const je=8,ke=E();let Ve=class extends(Se(we($(Ce)))){constructor(){super(...arguments),this.type="point-cloud-3d",this.maximumPointCount=4e6,this.slicePlaneEnabled=!1,this._renderer=null,this._rendererAdded=!1,this._renderedNodes=new Set,this._updateViewNeeded=!0,this._lodFactor=1,this._maxLoggedBoxWarnings=5,this._pageMultiplier=1,this._nodeLoadEpoch=0,this._indexQueue=[],this._workQueue=new Array,this._idleQueue=new z,this._indexPagesLoading=new Map,this._loadingNodes=new Map,this._recalcWork=!0,this._layerIsVisible=!1,this._codedDomainPopulationPromise=null,this._codedDomainPopulationAbortController=null,this._totalWork=0,this._index=null,this._loadingInitNodePage=!1,this._nodeIdArray=[],this.ignoresMemoryFactor=!1}get baseUrl(){return this.layer.parsedUrl?.path??""}get pointScale(){const e=le(this.layer?.renderer),t=1;return null!=e?.scaleFactor?e.scaleFactor:t}get useRealWorldSymbolSizes(){const e=ue(this.layer?.renderer),t=!1;return null!=e?.useRealWorldSymbolSizes?e.useRealWorldSymbolSizes:t}get pointSize(){const e=ue(this.layer?.renderer),t=0;return null!=e?.size?e.size:t}get inverseDensity(){const e=96;return this.layer?.renderer?1*e/this.layer.renderer.pointsPerInch:5}get availableFields(){const e=he(this.layer),t=new Set;e.primaryAttribute&&t.add(e.primaryAttribute.name),e.modulationAttribute&&t.add(e.modulationAttribute.name);const i=pe(this.layer);if(i)for(const r of i)r.attributeInfo&&t.add(r.attributeInfo.name);if(this.layer.outFields)for(const r of W(this.layer.fieldsIndex,this.layer.outFields))t.add(r);return Array.from(t)}get _clippingBox(){if(!this.view||!this.view.clippingArea)return null;const e=Q(),t=this.view.renderSpatialReference;return Pe(this.view.clippingArea,e,t)?e:null}get _elevationOffset(){const e=this.layer&&this.layer.elevationInfo;return e&&"absolute-height"===e.mode?T(e,this.layer.spatialReference):0}get _graphicOrigin(){return new O(this.layer)}initialize(){const e=this.view.resourceController,t=De(e);this._worker=new Z(t),this.addResolvingPromise(this._worker.promise),X(this.layer),ee(this.layer,this.view),this._indexRequester=e.createStreamDataRequester(2),this._dataRequester=e.createStreamDataRequester(3),this._initRenderer();const i=this._initNodePages(),r=this.view.resourceController.memoryController;this._memCache=r.newCache(`pcl-${this.layer.uid}`),this._queryFeaturesCache=r.newCache(`pcl-query-features-${this.layer.uid};`),this._updatingHandles.add(()=>this._clippingBox,()=>this._setUpdateViewNeeded(),g),this._updatingHandles.add(()=>this._elevationOffset,()=>this._elevationOffsetChanged(),g),this._updatingHandles.add(()=>this.layer.renderer,()=>this._rendererChanged(),g),this._updatingHandles.add(()=>this.layer.filters,()=>this._reload(),g),this._updatingHandles.add(()=>this.layer.outFields,()=>this._reload(),g),this._updatingHandles.add(()=>this.layer.effectiveScaleRange,()=>this._setUpdateViewNeeded()),this._updatingHandles.add(()=>this.view.state.contentCamera,()=>this._setUpdateViewNeeded()),this.addHandles([f(()=>this.view.quality,()=>this._setUpdateViewNeeded(),y)]),this.addResolvingPromise(i),this.when(()=>{this.addHandles([e.scheduler.registerTask(Re.POINT_CLOUD_LAYER,this),e.scheduler.registerIdleStateCallbacks(()=>this._idleBegin(),()=>this._idleEnd()),this._updatingHandles.add(()=>this.suspended,e=>{e?this._clearNodeState():this._setUpdateViewNeeded()},g)])},()=>{this._updatingHandles.removeAll(),this.removeAllHandles()})}_setUpdateViewNeeded(){this._updateViewNeeded=!0,this._updateLoading()}destroy(){this.cancelLoading(),this._worker=n(this._worker),this._destroyRenderer(),this._memCache=n(this._memCache),this._queryFeaturesCache=n(this._queryFeaturesCache),this._queryEngine=n(this._queryEngine),this._codedDomainPopulationAbortController=a(this._codedDomainPopulationAbortController),this._codedDomainPopulationPromise=null}_initRenderer(){this._renderer=new ne({createGraphic:(e,t,i)=>this._createGraphic(e,t,i)}),this._renderer.layerViewUid=this.uid,this._updatingHandles.add(()=>this._clippingBox,e=>this._renderer.clippingBox=e,g),this._updatingHandles.add(()=>this.suspended,e=>this._setPointsVisible(!e),g),this._updatingHandles.add(()=>this.pointScale,e=>this._renderer.scaleFactor=e,g),this._renderer.minSizePx=Math.sqrt(2),this._updatingHandles.add(()=>this.useRealWorldSymbolSizes,e=>this._renderer.useRealWorldSymbolSizes=e,g),this._updatingHandles.add(()=>this.pointSize,e=>{const t=b(e);this._renderer.size=e,this._renderer.sizePx=t},g),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._renderer.slicePlaneEnabled=e,g),this._updatingHandles.add(()=>this.inverseDensity,()=>this._setUpdateViewNeeded(),g),this._updatingHandles.add(()=>this.maximumPointCount,()=>this._setUpdateViewNeeded(),g),this._updatingHandles.add(()=>this.view.qualitySettings.sceneService.pointCloud.lodFactor,e=>{this._lodFactor=e,this._setUpdateViewNeeded()},g)}_destroyRenderer(){this._renderer.removeAll(),this._setPointsVisible(!1)}_createGraphic(e,t,i,r){const s=null!=e.pointIdFilterMap?e.pointIdFilterMap[t]:t,o=i?"declaredClass"in i?i:Ne(this.view,i):null;return r??=this._createGraphicAttributes(e,s),new oe({pointCloudMetadata:{nodeId:e.id,pointIndexInNode:t,attributePointIndexInNode:s,epoch:this._nodeLoadEpoch},geometry:o,attributes:r,layer:this.layer,sourceLayer:this.layer,origin:this._graphicOrigin})}_createGraphicAttributes(e,t){const i={};for(const r of e.attributes)this._encodeGraphicAttribute(r.attributeInfo,r.values,t,i);return i}_getGraphicAttribute(e,t,i){const r=e.storageInfo?.attributeValues,s=r?.valuesPerElement??1;if(1===s)return t[i];if("UInt8"===r?.valueType&&s<=4){let e=0;const r=i*s;for(let i=r;i<r+s;i++)e=(e<<8)+t[i];return e}}_encodeGraphicAttribute(e,t,i,r){r[e.name]=this._getGraphicAttribute(e,t,i)}_setPointsVisible(e){e&&!this._rendererAdded?(this.view.stage.addRenderPlugin(this._renderer),this._rendererAdded=!0):!e&&this._rendererAdded&&(this.view.stage.removeRenderPlugin(this._renderer),this._rendererAdded=!1)}_rendererChanged(){this._renderer.useFixedSizes=ce(this.layer.renderer),this._reload()}_reload(){this._clearNodeState(),this._memCache.clear(),this._setUpdateViewNeeded()}_elevationOffsetChanged(){this._clearNodeState(),this._memCache.clear(),this._initNodePages()}_displayNodes(e){this._workQueue=te([...this._renderedNodes],e,this._index),ie(this._workQueue,this.view.state.contentCamera.viewForward,this._index),re(this._workQueue,je,this._index),this._updateQueues(),this._totalWork=this._computeWork(),this._updateLoading(),this._layerIsVisible=e.length>0||this._loadingInitNodePage,this.notifyChange("suspended")}cancelLoading(){this._cancelNodeLoading(),this._cancelIndexLoading()}_cancelNodeLoading(){const e=new Array;this._loadingNodes.forEach(({abortController:t})=>e.push(t)),this._loadingNodes.clear();for(const t of e)t.abort();this._workQueue=[],this._idleQueue.cancelAll(),this._totalWork=this._computeWork(),this._updateLoading()}_updateQueues(){const e=new Set;this._workQueue.forEach(t=>t.load.forEach(t=>e.add(t)));const t=new Array,i=new Map;this._loadingNodes.forEach((r,s)=>{e.has(s)?i.set(s,r):t.push(r)}),this._loadingNodes=i;for(const{abortController:r}of t)r.abort();this._workQueue=this._workQueue.filter(e=>{for(const t of e.load)if(this._loadingNodes.has(t))return this._recalcWork=!0,!1;return!0}),this._totalWork=this._computeWork(),this._updateLoading()}_cancelIndexLoading(){this._indexQueue=[],this._indexPagesLoading.forEach(({abortController:e})=>e.abort()),this._indexPagesLoading.clear(),this._totalWork=this._computeWork(),this._updateLoading()}_clearNodeState(){this._nodeLoadEpoch++,this._renderedNodes.forEach(e=>this._removeFromRenderer(e)),this._cancelNodeLoading()}_idleBegin(){this._setUpdateViewNeeded()}_idleEnd(){this._setUpdateViewNeeded()}get running(){return this.suspended?this._updateViewNeeded:this._updateViewNeeded||this._indexQueue.length>0||this._workQueue.length>0||this._idleQueue.running}runTask(e){if(this.suspended){if(this._updateViewNeeded){this._updateViewNeeded=!1;const e=this._isRootNodeVisible();e!==this._layerIsVisible&&(this._layerIsVisible=e,this.notifyChange("suspended")),this._updateLoading()}}else{for(e.run(()=>this._updateWorkQueues());this._indexQueue.length>0&&e.run(()=>this._processIndexQueue()););this._processWorkQueue(e),this._idleQueue.runTask(e)}}_processIndexQueue(){const e=this._indexQueue.shift(),t=this._loadNodePage(e);return this._indexPagesLoading.set(e,t),t.promise.then(t=>{this._index.addPage(e,t,this._elevationOffset),this._setUpdateViewNeeded()}).then(()=>{this._indexPagesLoading.delete(e)},()=>{this._indexPagesLoading.delete(e)}),!0}_processWorkQueue(e){for(;!e.done;){const t=this._scheduleWorkEntry();if(null==t)return void e.madeProgress();this._processWorkEntry(t),e.madeProgress()}}_scheduleWorkEntry(){let e=this._workQueue.length;for(;e--;){const e=this._workQueue.shift();if(!e.remove.find(e=>!this._renderedNodes.has(e)))return e;this._workQueue.push(e)}return null}_processWorkEntry(e){if(0!==e.load.length)Promise.all(e.load.map(e=>{const t=new AbortController,i=this._memCache.pop(e.toString());return null!=i?this._loadingNodes.set(e,{abortController:t,promise:Promise.resolve(i)}):this._loadingNodes.has(e)||this._loadingNodes.set(e,{abortController:t,promise:this._loadNode(e,t.signal)}),this._loadingNodes.get(e).promise})).then(t=>{for(let i=0;i<e.load.length;i++)if(t[i]){const r=this._setupRendererData(e.load[i],t[i]);this._addToRenderer(r)}for(const i of e.remove)this._removeFromRenderer(i)}).catch(()=>{}).then(()=>{for(const t of e.load)this._loadingNodes.delete(t);this._updateLoading(),this._recalcWork&&!this._idleQueue.updating&&0===this._indexQueue.length&&0===this._loadingNodes.size&&(this._recalcWork=!1,this._setUpdateViewNeeded())}),this._updateLoading();else for(const t of e.remove)this._removeFromRenderer(t)}async _populateClassCodeCodedDomain(e,t){const i="CLASS_CODE",s=this.layer.fieldsIndex.get(i);if(!s||s.domain)return;if(!e.includes(s.name))return;const o=await r(this.layer.queryCachedStatistics(i,{signal:t}));if(!1===o.ok)return;const n=o.value?.stats?.labels?.labels;n&&Array.isArray(n)&&(s.domain=new M({name:"CLASS_CODE",codedValues:n.map(e=>new G({code:e.value,name:e.label}))}))}async prepareFetchPopupFeatures(e){return this._codedDomainPopulationPromise||(this._codedDomainPopulationAbortController=new AbortController,this._codedDomainPopulationPromise=this._populateClassCodeCodedDomain(e,this._codedDomainPopulationAbortController.signal).then(()=>{this._codedDomainPopulationAbortController=null})),this._codedDomainPopulationPromise}async whenGraphicAttributes(e,t){const r=this._splitGraphicsPerNode(e),o=this.layer.attributeStorageInfo,n=t.map(e=>_e(o,e)).filter(i),a=async(e,t)=>{const i=this._index.getNode(t);await s(n,async t=>{const r=t.useElevation?await this._loadElevationAttributeFromGeometry(i.resourceId):await this._loadAndParseAttribute(i,t);if(r)for(const i of e)if(this._isValidPointGraphic(i)){const e=i.pointCloudMetadata.attributePointIndexInNode;this._encodeGraphicAttribute(t,r,e,i.attributes)}})},d=[];return r.forEach((e,t)=>{d.push(a(e,t))}),await Promise.allSettled(d),e}_isValidPointGraphic(e){return e instanceof oe&&e.pointCloudMetadata?.epoch===this._nodeLoadEpoch}_splitGraphicsPerNode(e){const t=new Map;for(const i of e){if(!this._isValidPointGraphic(i))continue;const e=i.pointCloudMetadata,r=t.get(e.nodeId);r?r.push(i):t.set(e.nodeId,[i])}return t}async _loadAndParseAttribute(e,t){const i=await this._loadAttribute(e.resourceId,t,null);return i?me({attributeInfo:t,buffer:i},null,e.vertexCount):null}async _loadElevationAttributeFromGeometry(e){const t=this.layer.store.defaultGeometrySchema,i=ge(t,await this._loadGeometry(e,null));return fe(i,i.length/3)}highlight(e,i){const r=ye(e);if(0===r.length)return be;if(!(r[0]instanceof t))return be;const s=r;return this._renderer.highlight(s.map(e=>this._graphicToPointDefinition(e)),Ie(i))}_graphicToPointDefinition(e){if(!this._isValidPointGraphic(e))return null;const{nodeId:t,pointIndexInNode:i}=e.pointCloudMetadata;return null!=t&&null!=i?{nodeId:t,pointId:i}:null}_computeWork(){let e=0;for(const t of this._workQueue)e+=t.load.length+t.remove.length;return e+=this._loadingNodes.size,e+=(this._indexQueue.length+this._indexPagesLoading.size)*this._index.pageSize,e+=this._loadingInitNodePage?100:0,e+=this._updateViewNeeded?100:0,e}get updatingProgressValue(){if(this.suspended)return this._updateViewNeeded?0:1;const e=this._computeWork();return 1-Math.min(this._totalWork,e)/this._totalWork}_updateLoading(){this.notifyChange("updating"),this.notifyChange("updatingProgressValue")}canResume(){return super.canResume()&&this._layerIsVisible}isUpdating(){return this.suspended?this._updateViewNeeded:this._computeWork()>0}get visibleAtCurrentScale(){return Ae(this.layer.effectiveScaleRange,this.view.scale)}async queryFeatures(e,i){const r=await this._ensureQueryEngine().executeQuery(this._ensureQueryJSON(e),i?.signal),s=r.features;r.features=[];const o=H.fromJSON(r),n=this.view.spatialReference;return o.features=s.map(e=>{const{attributes:i,metadata:r}=e;if(!r){const i=t.fromJSON(e);return i.geometry&&(i.geometry.spatialReference=o.spatialReference??n),i}const s=j.fromJSON(e.geometry);return s.spatialReference=o.spatialReference??n,this._createGraphic(r.node,r.pointId,s,i)}),o}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference,returnZ:!0};return new B(e)}async queryFeatureCount(e,t){return await this._ensureQueryEngine().executeQueryForCount(this._ensureQueryJSON(e),t?.signal)}async queryExtent(e,t){const{count:i,extent:r}=await this._ensureQueryEngine().executeQueryForExtent(this._ensureQueryJSON(e),t?.signal);return{count:i,extent:R.fromJSON(r)}}_ensureQueryJSON(e){return null==e?new B({outSpatialReference:this.view.spatialReference}).toJSON():B.from(e).toJSON()}_ensureQueryEngine(){if(this._queryEngine)return this._queryEngine;const{spatialReference:e}=this.view;return this._queryEngine=new q({fieldsIndex:this.layer.fieldsIndex.toJSON(),geometryType:"esriGeometryPoint",spatialReference:e,featureIdInfo:{type:"object-id",fieldName:"objectId"},hasZ:!0,featureStore:new Y({sourceSpatialReference:e,viewSpatialReference:e,forAllFeatures:(e,t)=>{let i=!1;this._renderer.forEachNode(r=>{if(i)return;if(t){const e=r.obb,s=D(e.center[0],e.center[1],e.center[2],x(e.halfSize));k(s,this.view.renderSpatialReference,s,this.view.spatialReference);const o=t(s);if(2===o)return;if(i=0===o,i)return}let s=this._queryFeaturesCache.get(`${r.id}`);s||(s=this._createQueryPointFeatures(r),this._queryFeaturesCache.put(`${r.id}`,s)),s.features.forEach(e)})},getFeatureExtent:({point:e},t)=>F(e,e,t),featureAdapter:{cloneWithGeometry:(e,t)=>new Fe(e.node,e.pointId,t.coords),getAttribute:({node:e,attributePointId:t},i)=>{for(const r of e.attributes)if(r.attributeInfo.name===i)return this._getGraphicAttribute(r.attributeInfo,r.values,t)},getAttributes:({node:e,attributePointId:t})=>this._createGraphicAttributes(e,t),getCentroid:e=>e.getGeometry(),getGeometry:e=>e.getGeometry(),getObjectId:()=>{},getMetadata:e=>e}})}),this._queryEngine}_createQueryPointFeatures(e){const t=e.coordinates,i=new Array;for(let r=0;r<t.length/3;r++){const s=3*r,o=A(t[s+0],t[s+1],t[s+2]);v(o,o,e.origin),V(o,this.view.renderSpatialReference,o,this.view.spatialReference);const n=new Fe(e,r,o);i.push(n)}return new Le(i)}_initNodePages(){const e=this.layer.store.index,t=e.nodesPerPage||e.nodePerIndexBlock;return this._index=new se(this.layer.spatialReference,this.view.renderCoordsHelper.spatialReference,t),this._cancelIndexLoading(),this._traverseVisible=this._index.createVisibilityTraverse(),this._loadingInitNodePage=!0,this._layerIsVisible=!0,this.notifyChange("suspended"),this._updateLoading(),this._pageMultiplier=null!=e.nodesPerPage?1:e.nodePerIndexBlock,this._loadNodePage(0).promise.then(e=>{this._index.addPage(0,e,this._elevationOffset),this._loadingInitNodePage=!1,this._setUpdateViewNeeded()})}_loadNodePage(e){const t=new AbortController,i=`${this.baseUrl}/nodepages/${e*this._pageMultiplier}`;return{promise:this._requestNodePage(i,t.signal).then(t=>t.nodes.map((t,i)=>({resourceId:null!=t.resourceId?t.resourceId:e*this._index.pageSize+i,obb:xe.fromJSON(t.obb),obbInRenderSR:new xe,firstChild:t.firstChild,childCount:t.childCount,vertexCount:t.vertexCount??t.pointCount,lodThreshold:t.lodThreshold??t.effectiveArea}))),abortController:t}}_updateWorkQueues(){if(!this._updateViewNeeded)return!1;const e=this.view.quality;let t=this.inverseDensity/this._lodFactor*e;const i=this.maximumPointCount*this._lodFactor*e;let r=this._computeNodesForMinimumDensity(t),s=this._computePointCount(r),o=Math.sqrt(s/(.75*i));for(;s>i;)t*=o,r=this._computeNodesForMinimumDensity(t),s=this._computePointCount(r),o=Math.sqrt(2);return this._displayNodes(r),this._updateViewNeeded=!1,this._updateLoading(),!0}_computePointCount(e){let t=0;for(let i=0;i<e.length;i++){const r=this._index.getNode(e[i]);r&&(t+=r.vertexCount)}return t}_isRootNodeVisible(){let e=!1;return this._traverseVisible({frustum:this.view.state.contentCamera.frustum,clippingBox:this._clippingBox},{predicate:(t,i,r)=>(e=r,!1),pageMiss:()=>{}}),e}_computeNodesForMinimumDensity(e){const t=this.view.state.contentCamera,i=t.frustum,r=this._clippingBox,s=t.viewForward,o=C(s,t.eye),n=L(s,-o,ke),a=t.perScreenPixelRatio/2,d=e*e,l=this._nodeIdArray;l.length=0;const u=e=>l.push(e);return this._traverseVisible({frustum:i,clippingBox:r},{predicate:(e,t,i)=>{if(!i)return!1;if(0===t.childCount)return u(e),!1;const r=this._index.getRenderObb(e);return!(this._computeAveragePixelArea(r,t.lodThreshold,t.vertexCount,n,a)<=d)||(u(e),!1)},pageMiss:(e,t)=>{u(e),this._indexQueue.includes(t)||this._indexQueue.push(t)}}),l}_computeAveragePixelArea(e,t,i,r,s){const o=1e-7,n=Math.max(o,e.minimumDistancePlane(r));return t/(n*n)/(4*s*s)/i}_loadNode(e,t){try{return this._loadNodeAsync(e,t)}catch(i){throw c(i)||o.getLogger(this).error(i),i}}async _loadAdditionalUserAttributes(e,t,r){const s=this.layer.outFields;if(!s)return[];const o=W(this.layer.fieldsIndex,s),n=new Set(e.map(e=>null!=e?e.name:null)),a=this.layer.attributeStorageInfo,d=[];for(const i of o){if(n.has(i))continue;const e=_e(a,i);e&&d.push(t(e))}const l=await _(d);return m(r),l.filter(i)}async _loadNodeAsync(e,t){const i=this._index.getNode(e),r=he(this.layer),s=pe(this.layer),o=i.resourceId,n=async e=>{if(!e)return null;if(e.useElevation)return{attributeInfo:e,buffer:null};const i=await this._loadAttribute(o,e,t);return null!=i?{attributeInfo:e,buffer:i}:null};return this._idleQueue.push(async()=>{const i=this._loadGeometry(o,t),{primaryAttribute:a,modulationAttribute:d}=r,l=n(a),u=n(d),h=s.map(e=>e.attributeInfo),p=h.map(e=>n(e)),c=this._loadAdditionalUserAttributes([a,d,...h],n,t),[_,g,f,y,b]=await Promise.all([i,l,u,Promise.all(p),c]);m(t);const w={geometryBuffer:_,primaryAttributeData:g,modulationAttributeData:f,filterAttributesData:y,userAttributesData:b,schema:this.layer.store.defaultGeometrySchema,rendererInfo:r,filterInfo:s,obbData:this._index.getRenderObb(e).data,elevationOffset:this._elevationOffset,inSR:this.layer.spatialReference.toJSON(),outSR:this.view.renderCoordsHelper.spatialReference.toJSON()};return this._worker.invoke(w,t)},t)}async _loadGeometry(e,t){return this._requestData(`${this.baseUrl}/nodes/${e}/geometries/0`,t)}async _loadAttribute(e,t,i){if(!t?.storageInfo)return null;const r=t.storageInfo.key;return this._requestData(`${this.baseUrl}/nodes/${e}/attributes/${r}`,i)}_requestNodePage(e,t){const i={f:"json",...this.layer.customParameters,token:this.layer.apiKey};return this._indexRequester.request(e,0,{query:i,signal:t})}_requestData(e,t){return this._dataRequester.request(e,1,{query:{...this.layer.customParameters,token:this.layer.apiKey},signal:t})}_removeFromRenderer(e){if(this._renderedNodes.has(e)){const t=this._renderer.removeNode(e);this._renderedNodes.delete(e),this._memCache.put(t.id.toString(),t)}}_addToRenderer(e){this._renderedNodes.has(e.id)||(this._renderedNodes.add(e.id),this._renderer.addNode(e))}_setupRendererData(e,t){const i=this._index.getNode(e),r=Math.sqrt(i.lodThreshold/i.vertexCount),s=this._index.getRenderObb(e);if(ae(t))return t.splatSize=r,t.obb=s,S(t.origin,t.obb.center),t;const n=xe.fromData(t.obbData),a=n.halfSize,d=s.halfSize,l=.01*Math.max(d[0],d[1],d[2]);if(a[0]>d[0]+l||a[1]>d[1]+l||a[2]>d[2]+l){if(this._maxLoggedBoxWarnings>0){const t=e=>`[${e.halfSize[0]}, ${e.halfSize[1]}, ${e.halfSize[2]}]`;o.getLogger(this).warn(`Node ${e} reported bounding box too small. got ${t(s)} but points cover ${t(n)}`),0===--this._maxLoggedBoxWarnings&&o.getLogger(this).warn(" Too many bounding box errors, stopping reporting for this layer.")}this._index.setRenderObb(e,n)}return new de(e,r,I(s.center),s,0===i.childCount,t.points,t.rgb,t.attributes,t.pointIdFilterMap)}get usedMemory(){let e=0;return this._renderer.forEachNode(t=>{e+=Ee,e+=d(t.coordinates);for(const i of t.attributes){const t=i.values;w(t.buffer)&&(e+=d(t))}}),e}get unloadedMemory(){const e=this._renderedNodes.size;if(e<4)return 0;const t=[...this._renderedNodes].reduce((e,t)=>e+this._index.getNode(t).vertexCount);let i=this._loadingNodes.size;for(let r=0;r<this._workQueue.length;r++)i+=this._workQueue[r].load.length,i-=this._workQueue[r].remove.length;if(i<0)return 0;return i*t/e*((this.usedMemory-e*Ee)/t)+i*Ee}get performanceInfo(){return new J(this.usedMemory,this._renderedNodes.size,[...this._renderedNodes].reduce((e,t)=>e+this._index.getNode(t).vertexCount,0),this.maximumPointCount,new K(this._loadingNodes.size,this._indexQueue.length,this._workQueue.length,this._idleQueue.length))}get test(){}};e([P()],Ve.prototype,"layer",void 0),e([P()],Ve.prototype,"baseUrl",null),e([P()],Ve.prototype,"pointScale",null),e([P()],Ve.prototype,"useRealWorldSymbolSizes",null),e([P()],Ve.prototype,"pointSize",null),e([P()],Ve.prototype,"inverseDensity",null),e([P()],Ve.prototype,"maximumPointCount",void 0),e([P({readOnly:!0})],Ve.prototype,"availableFields",null),e([P({readOnly:!0})],Ve.prototype,"_clippingBox",null),e([P({readOnly:!0})],Ve.prototype,"_elevationOffset",null),e([P({type:Boolean})],Ve.prototype,"slicePlaneEnabled",void 0),e([P()],Ve.prototype,"_graphicOrigin",null),e([P()],Ve.prototype,"updating",void 0),e([P(ve)],Ve.prototype,"updatingProgress",void 0),e([P({readOnly:!0})],Ve.prototype,"updatingProgressValue",null),e([P({readOnly:!0})],Ve.prototype,"visibleAtCurrentScale",null),Ve=e([N("esri.views.3d.layers.PointCloudLayerView3D")],Ve);const Qe=Ve;class Fe{constructor(e,t,i){this.node=e,this.pointId=t,this.point=i}getGeometry(){return new U([1],Array.from(this.point))}get attributePointId(){const{node:e,pointId:t}=this;return null!=e.pointIdFilterMap?e.pointIdFilterMap[t]:t}get usedMemory(){return l+l+u+h(this.point,u)}}class Le{constructor(e){this.features=e}get cachedMemory(){return this.features.reduce((e,t)=>e+t.usedMemory,l+p)}}const Ee=160;function De(e){return t=>e.immediate.schedule(t)}export{Qe as default};
|