@arcgis/core 4.24.0-next.20220329 → 4.24.0-next.20220401
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/PopupTemplate.js +1 -1
- package/WebMap.js +1 -1
- package/WebScene.js +1 -1
- package/analysis/LineOfSightAnalysisObserver.js +1 -1
- package/analysis/LineOfSightAnalysisTarget.js +1 -1
- package/arcade/featureset/actions/Adapted.js +1 -1
- package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
- package/arcade/featureset/sources/FeatureLayerMemory.js +1 -1
- package/arcade/featureset/sources/FeatureLayerRelated.js +1 -1
- package/arcade/featureset/support/FeatureSet.js +1 -1
- package/arcade/featureset/support/RecentlyUsedCache.js +1 -1
- package/arcade/featureset/support/shared.js +1 -1
- package/arcade/functions/convertdirection.js +1 -1
- package/arcade/lib/character.js +1 -1
- package/arcade/lib/scanner.js +1 -1
- package/arcade/lib/tokenizer.js +1 -1
- package/arcade/request.js +1 -1
- package/arcade/treeAnalysis.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0bfedb1dbdff8205e468.js +1 -0
- package/assets/esri/core/workers/chunks/{5e472c89a38d6a42b84d.js → 0e29250c24a3a7b1ce13.js} +1 -1
- package/assets/esri/core/workers/chunks/0eb9c9477d36cd212f8b.js +1 -0
- package/assets/esri/core/workers/chunks/10779a256841c37f2429.js +1 -0
- package/assets/esri/core/workers/chunks/10a119889d1ab13402a3.js +1 -0
- package/assets/esri/core/workers/chunks/125b14c2ccd96d7c20c2.js +1 -0
- package/assets/esri/core/workers/chunks/23ec33a30db201e8b2c3.js +1 -0
- package/assets/esri/core/workers/chunks/2530e8ccf6e12787ce76.js +1 -0
- package/assets/esri/core/workers/chunks/2d9e97ba5b50aec4dd01.js +1 -0
- package/assets/esri/core/workers/chunks/365dc146398420f13f82.js +1 -0
- package/assets/esri/core/workers/chunks/3ae2827e8d55d6713d20.js +1 -0
- package/assets/esri/core/workers/chunks/3e3eebaa0844742db2f2.js +1 -0
- package/assets/esri/core/workers/chunks/3fd5b2d6eccd9098d492.js +1 -0
- package/assets/esri/core/workers/chunks/404f1d7bce014c7e6965.js +1 -0
- package/assets/esri/core/workers/chunks/411b7777bb5e943c156f.js +1 -0
- package/assets/esri/core/workers/chunks/{12ca192a5233bb2875d0.js → 4312902ab6e42fbe119b.js} +1 -1
- package/assets/esri/core/workers/chunks/{4ef07f50da39f8607c1c.js → 44e95e87bd9e820aeb53.js} +1 -1
- package/assets/esri/core/workers/chunks/{4d4c5e535d8b9ceb865a.js → 4810edf605838d07e5c5.js} +1 -1
- package/assets/esri/core/workers/chunks/4bce446391176a9d4588.js +1 -0
- package/assets/esri/core/workers/chunks/52a0e387073ea264e194.js +1 -0
- package/assets/esri/core/workers/chunks/560234694f3e53802aff.js +1 -0
- package/assets/esri/core/workers/chunks/5633710daeb3bbb79bcf.js +1 -0
- package/assets/esri/core/workers/chunks/5682039666f874836451.js +1 -0
- package/assets/esri/core/workers/chunks/6f01905936396fe87865.js +1 -0
- package/assets/esri/core/workers/chunks/6f7917da7166e8c6854b.js +1 -0
- package/assets/esri/core/workers/chunks/7388824eac8da01ea03d.js +1 -0
- package/assets/esri/core/workers/chunks/7745efef7d5119d0b087.js +1 -0
- package/assets/esri/core/workers/chunks/794b47764ebb0257ed41.js +1 -0
- package/assets/esri/core/workers/chunks/{da64dedf9270b64f42b2.js → 79bdb26244ec7b4472fe.js} +1 -1
- package/assets/esri/core/workers/chunks/79ec28b3e3c57fe026aa.js +1 -0
- package/assets/esri/core/workers/chunks/81e9d860a044acec74ce.js +1 -0
- package/assets/esri/core/workers/chunks/831dc0187f71e658550c.js +1 -0
- package/assets/esri/core/workers/chunks/86ad6b020c01850d9095.js +1 -0
- package/assets/esri/core/workers/chunks/{fb7397da8d4ec2ae4587.js → 87458fbf395338511662.js} +1 -1
- package/assets/esri/core/workers/chunks/{1a859be598ad96bb4719.js → 8771296b537f366596c4.js} +18 -18
- package/assets/esri/core/workers/chunks/8958cd555f4887526e8b.js +1 -0
- package/assets/esri/core/workers/chunks/{e57b71ba70f088a3a052.js → 90dcd86cdef90099abfa.js} +1 -1
- package/assets/esri/core/workers/chunks/93067e27eea5844edc6c.js +1 -0
- package/assets/esri/core/workers/chunks/{9fbee2d9bf50c4c148c6.js → 9a146c9e9b4bf7fba88f.js} +1 -1
- package/assets/esri/core/workers/chunks/9b9821772b6cbe189fe0.js +1 -0
- package/assets/esri/core/workers/chunks/{6c4ce530b493c6f7c430.js → 9df2f9f7c28b31866be8.js} +1 -1
- package/assets/esri/core/workers/chunks/{d0620ce99b620621d8bc.js → a0552044e123a3c51ddf.js} +1 -1
- package/assets/esri/core/workers/chunks/acc1a4acd57f5657e782.js +1 -0
- package/assets/esri/core/workers/chunks/b055ae7c54796751b64c.js +1 -0
- package/assets/esri/core/workers/chunks/{acc2cfb116fee7f82ae9.js → b26bd8fde2fc65bb67fb.js} +1 -1
- package/assets/esri/core/workers/chunks/{9b45b94c4dbdc8d2c5fd.js → b34ba22c7a5adce8a7a2.js} +1 -1
- package/assets/esri/core/workers/chunks/b75665d0bf417c6ef24a.js +1 -0
- package/assets/esri/core/workers/chunks/bd50ec30688463b821d1.js +1 -0
- package/assets/esri/core/workers/chunks/c28f7ae4756ad1ba94bd.js +1 -0
- package/assets/esri/core/workers/chunks/c4f713959d4115b87c6c.js +1 -0
- package/assets/esri/core/workers/chunks/c58aa209492bd94b7aad.js +1 -0
- package/assets/esri/core/workers/chunks/{9b117097b7be0efd21d4.js → c59b0b58e24e6a60cf3e.js} +1 -1
- package/assets/esri/core/workers/chunks/c7bd5a4d318299388645.js +1 -0
- package/assets/esri/core/workers/chunks/c7cee13a962396b23a5e.js +1 -0
- package/assets/esri/core/workers/chunks/{3bbff5ea1ea0e955c592.js → cd3679fa86129ebabfdf.js} +1 -1
- package/assets/esri/core/workers/chunks/{1a36dc0daffd536ea44d.js → cee7ce362860717713bf.js} +1 -1
- package/assets/esri/core/workers/chunks/cf463d6309f14df2f2fa.js +1 -0
- package/assets/esri/core/workers/chunks/{224c0e64160bdc170051.js → d076627bb7dadea89e89.js} +1 -1
- package/assets/esri/core/workers/chunks/{fff4200bc61b82dd6193.js → d1d1c45243af614f2e74.js} +1 -1
- package/assets/esri/core/workers/chunks/{1e0498dc9836658d9aba.js → d5fd12ea541c1a6b7fce.js} +1 -1
- package/assets/esri/core/workers/chunks/{10322d990cda5aedf2f0.js → d6e32ca237ad9309c76a.js} +1 -1
- package/assets/esri/core/workers/chunks/e06ad3a3d71154fed654.js +1 -0
- package/assets/esri/core/workers/chunks/{7a77d4cd27c30f1a5cae.js → ee3387a43dfbb3df23e1.js} +1 -1
- package/assets/esri/core/workers/chunks/{5d5fa2b1fc48a17eb9ab.js → f4fc165420d449e442b8.js} +1 -1
- package/assets/esri/core/workers/chunks/{3d6d9906a534ddd8fa37.js → f5ee03f3fca7a75192de.js} +1 -1
- package/assets/esri/themes/base/widgets/_Daylight.scss +1 -1
- package/assets/esri/themes/base/widgets/_ElevationProfile.scss +1 -1
- package/assets/esri/themes/base/widgets/_Weather.scss +1 -1
- package/assets/esri/themes/base/widgets/_Widget.scss +12 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/dark-blue/main.css +1 -1
- package/assets/esri/themes/dark-green/main.css +1 -1
- package/assets/esri/themes/dark-purple/main.css +1 -1
- package/assets/esri/themes/dark-red/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/themes/light-blue/main.css +1 -1
- package/assets/esri/themes/light-green/main.css +1 -1
- package/assets/esri/themes/light-purple/main.css +1 -1
- package/assets/esri/themes/light-red/main.css +1 -1
- package/chunks/ComponentShader.glsl.js +25 -25
- package/chunks/HighlightApply.glsl.js +36 -0
- package/chunks/HighlightBlur.glsl.js +26 -0
- package/chunks/HighlightDownsample.glsl.js +12 -0
- package/chunks/ImageMaterial.glsl.js +8 -8
- package/chunks/LineCallout.glsl.js +1 -1
- package/chunks/Pattern.glsl.js +2 -2
- package/chunks/SimpleAtmosphere.glsl.js +7 -7
- package/chunks/Stars.glsl.js +1 -1
- package/chunks/arcade.js +1 -1
- package/chunks/color.js +1 -1
- package/chunks/languageUtils.js +1 -1
- package/chunks/mat3.js +1 -1
- package/copyright.txt +2 -2
- package/core/AsyncUpdate.js +1 -1
- package/core/Evented.js +1 -1
- package/core/PooledArray.js +1 -1
- package/core/accessorSupport/diffUtils.js +1 -1
- package/core/accessorSupport/get.js +1 -1
- package/core/accessorSupport/read.js +1 -1
- package/core/accessorSupport/set.js +1 -1
- package/core/accessorSupport/tracking.js +1 -1
- package/core/accessorSupport/utils.js +1 -1
- package/core/arrayUtils.js +1 -1
- package/core/libs/gl-matrix-2/mat3.js +1 -1
- package/core/libs/gl-matrix-2/math/mat3.js +1 -1
- package/core/number.js +1 -1
- package/core/object.js +1 -1
- package/core/string.js +1 -1
- package/core/unitUtils.js +1 -1
- package/core/watchUtils.js +1 -1
- package/core/workers/RemoteClient.js +1 -1
- package/exports/csv.js +1 -1
- package/geometry/support/heightModelInfoUtils.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/geometry.js +1 -1
- package/geometry/support/normalizeUtils.js +1 -1
- package/identity/IdentityManagerBase.js +1 -1
- package/interfaces.d.ts +155 -20
- package/layers/ImageryLayer.js +1 -1
- package/layers/MapImageLayer.js +1 -1
- package/layers/RouteLayer.js +1 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/SubtypeGroupLayer.js +1 -1
- package/layers/TileLayer.js +1 -1
- package/layers/VectorTileLayer.js +1 -1
- package/layers/WMSLayer.js +1 -1
- package/layers/WMTSLayer.js +1 -1
- package/layers/WebTileLayer.js +1 -1
- package/layers/graphics/data/AttributesBuilder.js +1 -1
- package/layers/graphics/data/QueryEngine.js +1 -1
- package/layers/graphics/editingSupport.js +1 -1
- package/layers/graphics/sources/connections/GeoEventConnection.js +1 -1
- package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
- package/layers/graphics/sources/support/inferenceUtils.js +1 -1
- package/layers/mixins/ArcGISCachedService.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/ogc/ogcFeatureUtils.js +1 -1
- package/layers/support/ExportImageServiceParameters.js +1 -1
- package/layers/support/PixelBlock.js +1 -1
- package/layers/support/RasterJobHandler.js +1 -1
- package/layers/support/SpriteSource.js +1 -1
- package/layers/support/Sublayer.js +1 -1
- package/layers/support/TilemapCache.js +1 -1
- package/layers/support/WMTSSublayer.js +1 -1
- package/layers/support/arcgisLayerUrl.js +1 -1
- package/layers/support/fieldUtils.js +1 -1
- package/layers/support/kmlUtils.js +1 -1
- package/layers/support/layerUtils.js +1 -1
- package/layers/support/rasterDatasets/ImageAuxRaster.js +1 -1
- package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
- package/layers/support/rasterDatasets/RasterFactory.js +1 -1
- package/layers/support/rasterDatasets/WCSRaster.js +1 -1
- package/layers/support/rasterDatasets/multipartParser.js +1 -1
- package/layers/support/rasterDatasets/wcsCoverageParser.js +1 -1
- package/layers/support/rasterDatasets/xmlUtilities.js +1 -1
- package/layers/support/rasterFormats/RasterCodec.js +1 -1
- package/layers/support/rasterFormats/TiffDecoder.js +1 -1
- package/layers/support/rasterFunctions/pixelUtils.js +1 -1
- package/layers/support/vectorTileLayerLoader.js +1 -1
- package/layers/support/wmsUtils.js +1 -1
- package/layers/support/wmtsUtils.js +1 -1
- package/libs/i3s/I3SModule.js +1 -1
- package/libs/vxl/VxlModule.js +1 -1
- package/package.json +1 -1
- package/portal/Portal.js +1 -1
- package/portal/PortalItem.js +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/portal/support/layersLoader.js +1 -1
- package/portal/support/portalItemUtils.js +1 -1
- package/portal/support/portalLayers.js +1 -1
- package/renderers/support/AuthoringInfoVisualVariable.js +1 -1
- package/renderers/support/DictionaryLoader.js +1 -1
- package/renderers/support/RasterSymbolizer.js +1 -1
- package/renderers/support/numberUtils.js +1 -1
- package/renderers/support/rasterRendererHelper.js +1 -1
- package/renderers/support/utils.js +1 -1
- package/request.js +1 -1
- package/rest/imageService.js +1 -1
- package/rest/operations/find.js +1 -1
- package/rest/query/operations/query.js +1 -1
- package/rest/query/operations/queryRelatedRecords.js +1 -1
- package/rest/query/operations/queryTopFeatures.js +1 -1
- package/rest/support/DirectionLine.js +1 -1
- package/rest/support/DirectionPoint.js +1 -1
- package/rest/support/PointBarrier.js +1 -1
- package/rest/support/PolygonBarrier.js +1 -1
- package/rest/support/PolylineBarrier.js +1 -1
- package/rest/support/RouteInfo.js +1 -1
- package/rest/support/Stop.js +1 -1
- package/smartMapping/labels/clusters.js +1 -1
- package/smartMapping/popup/dotDensity.js +1 -1
- package/smartMapping/popup/support/clusterUtils.js +1 -1
- package/smartMapping/popup/support/utils.js +1 -1
- package/smartMapping/raster/support/utils.js +1 -1
- package/smartMapping/renderers/color.js +1 -1
- package/smartMapping/renderers/location.js +1 -1
- package/smartMapping/renderers/predominance.js +1 -1
- package/smartMapping/renderers/relationship.js +1 -1
- package/smartMapping/renderers/size.js +1 -1
- package/smartMapping/renderers/support/utils.js +1 -1
- package/smartMapping/renderers/type.js +1 -1
- package/smartMapping/renderers/univariateColorSize.js +1 -1
- package/smartMapping/statistics/summaryStatisticsForAge.js +1 -1
- package/smartMapping/statistics/support/ageUtils.js +1 -1
- package/smartMapping/statistics/support/utils.js +1 -1
- package/smartMapping/support/adapters/SceneLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/support/utils.js +1 -1
- package/smartMapping/support/utils.js +1 -1
- package/smartMapping/symbology/support/Theme.js +1 -1
- package/smartMapping/symbology/support/colorRamps.js +1 -1
- package/smartMapping/symbology/support/symbologyUtils.js +1 -1
- package/smartMapping/symbology/support/utils.js +1 -1
- package/statistics/utils.js +1 -1
- package/support/basemapDefinitions.js +1 -1
- package/support/basemapUtils.js +1 -1
- package/support/elevationInfoUtils.js +1 -1
- package/support/popupUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMSymbolRasterizer.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/symbols/cim/utils.js +1 -1
- package/symbols/support/previewSymbol3D.js +1 -1
- package/symbols/support/renderUtils.js +1 -1
- package/symbols/support/symbolLayerUtils.js +1 -1
- package/views/2d/engine/Bitmap.js +1 -1
- package/views/2d/engine/flow/FlowDisplayObject.js +1 -1
- package/views/2d/engine/imagery/RasterBitmap.js +1 -1
- package/views/2d/engine/imagery/RasterVFDisplayObject.js +1 -1
- package/views/2d/engine/vectorTiles/TextShaping.js +1 -1
- package/views/2d/engine/vectorTiles/TileParser.js +1 -1
- package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +1 -1
- package/views/2d/engine/vectorTiles/expression/expression.js +1 -1
- package/views/2d/engine/vectorTiles/shaders/VTLMaterial.js +1 -1
- package/views/2d/engine/webgl/Profiler.js +1 -1
- package/views/2d/engine/webgl/Utils.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLGeometryBrush.js +1 -1
- package/views/2d/engine/webgl/definitions.js +1 -1
- package/views/2d/engine/webgl/effects/HittestEffect.js +1 -1
- package/views/2d/engine/webgl/effects/HittestEffectVTL.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLTemplateStore.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/engine/webgl/util/Lock.js +1 -1
- package/views/2d/layers/RouteLayerView2D.js +1 -1
- package/views/2d/layers/features/schemaUtils.js +1 -1
- package/views/2d/layers/features/sources/SnapshotFeatureSource.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
- package/views/2d/layers/features/tileRenderers/SymbolTileRenderer.js +1 -1
- package/views/2d/layers/support/webStyleUtils.js +1 -1
- package/views/2d/support/Timeline.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
- package/views/3d/analysis/Slice/SliceController.js +1 -1
- package/views/3d/environment/PanoramicAtmosphere.js +1 -1
- package/views/3d/environment/SceneViewAtmosphere.js +1 -1
- package/views/3d/environment/StarsTechnique.js +1 -1
- package/views/3d/externalRenderers/ExternalRendererStore.js +1 -1
- package/views/3d/glTF/loader.js +1 -1
- package/views/3d/interactive/analysisTools/lineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/interactive/analysisTools/slice/SliceTool.js +1 -1
- package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
- package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/ImageryLayerView3D.js +1 -1
- package/views/3d/layers/LayerView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/RouteLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/VectorTileLayerView3D.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
- package/views/3d/layers/i3s/I3SNodeLoader.js +1 -1
- package/views/3d/layers/i3s/I3SUtil.js +1 -1
- package/views/3d/layers/i3s/IDBMockCache.js +5 -0
- package/views/3d/layers/i3s/PointCloudWorkerUtil.js +1 -1
- package/views/3d/layers/support/PopupSceneLayerView.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/state/controllers/RotateController.js +1 -1
- package/views/3d/state/controllers/global/PinchAndPanController.js +1 -1
- package/views/3d/state/controllers/global/ZoomController.js +1 -1
- package/views/3d/state/controllers/global/ZoomStepController.js +1 -1
- package/views/3d/state/controllers/local/PinchAndPanController.js +1 -1
- package/views/3d/state/controllers/local/ZoomController.js +1 -1
- package/views/3d/support/HighlightOptions.js +1 -1
- package/views/3d/support/buffer/InterleavedLayout.js +1 -1
- package/views/3d/support/debugFlags.js +1 -1
- package/views/3d/support/orientedBoundingBox.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/Stage.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/collections/Component/DepthRange.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +5 -5
- package/views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/HighlightHelper.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeShaderParameters.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
- package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
- package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
- package/views/3d/webgl-engine/shaders/HighlightApply.glsl.js +5 -0
- package/views/3d/webgl-engine/shaders/HighlightApplyTechnique.js +5 -0
- package/views/3d/webgl-engine/shaders/HighlightBlur.glsl.js +5 -0
- package/views/3d/webgl-engine/shaders/HighlightBlurTechnique.js +5 -0
- package/views/3d/webgl-engine/shaders/HighlightDownsample.glsl.js +5 -0
- package/views/3d/webgl-engine/shaders/HighlightDownsampleTechnique.js +5 -0
- package/views/3d/webgl-engine/shaders/HighlightOptions.js +4 -0
- package/views/3d/webgl-engine/shaders/HighlightPassParameters.js +5 -0
- package/views/3d/webgl-engine/shaders/ImageMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/NativeLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/AdjustProjectedPosition.glsl.js +5 -7
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeUtil.glsl.js +14 -14
- package/views/SceneView.js +1 -1
- package/views/draw/support/GraphicMover.js +1 -1
- package/views/input/InputHandler.js +1 -1
- package/views/input/InputManager.js +1 -1
- package/views/layers/ImageryTileLayerView.js +1 -1
- package/views/layers/MapImageLayerView.js +1 -1
- package/views/layers/TileLayerView.js +1 -1
- package/views/layers/support/popupUtils.js +1 -1
- package/views/support/DefaultsFromMap.js +1 -1
- package/views/support/Scheduler.js +1 -1
- package/views/support/screenshotUtils.js +1 -1
- package/views/ui/DefaultUI.js +1 -1
- package/views/webgl/ShaderTranspiler.js +1 -1
- package/webscene/Slide.js +1 -1
- package/webscene/spec-certification/spec.js +1 -1
- package/widgets/AreaMeasurement3D/AreaMeasurement3DViewModel.js +1 -1
- package/widgets/Attachments/support/attachmentUtils.js +1 -1
- package/widgets/Attachments.js +1 -1
- package/widgets/Attribution.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/Bookmarks/BookmarksViewModel.js +1 -1
- package/widgets/Bookmarks.js +1 -1
- package/widgets/BuildingExplorer/support/filterUtils.js +1 -1
- package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
- package/widgets/CoordinateConversion/support/coordinateConversionUtils.js +1 -1
- package/widgets/CoordinateConversion/support/formatUtils.js +1 -1
- package/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js +1 -1
- package/widgets/Directions/DirectionsViewModel.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileViewModel.js +1 -1
- package/widgets/Feature/FeatureMedia.js +1 -1
- package/widgets/Feature/support/featureUtils.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm/InputField.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/FeatureTemplates.js +1 -1
- package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
- package/widgets/LayerList/ListItemPanel.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/Legend/LegendViewModel.js +1 -1
- package/widgets/Legend/styles/Card.js +1 -1
- package/widgets/Legend/styles/Classic.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Legend/support/colorRampUtils.js +1 -1
- package/widgets/Legend/support/relationshipRampUtils.js +1 -1
- package/widgets/Legend/support/sizeRampUtils.js +1 -1
- package/widgets/Popup/PopupViewModel.js +1 -1
- package/widgets/Popup/actionUtils.js +1 -1
- package/widgets/Print/PrintViewModel.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/ScaleBar/ScaleBarViewModel.js +1 -1
- package/widgets/Search/SearchViewModel.js +1 -1
- package/widgets/Search/support/layerSearchUtils.js +1 -1
- package/widgets/Slider.js +1 -1
- package/widgets/Swipe.js +1 -1
- package/widgets/TableList.js +1 -1
- package/widgets/TimeSlider/TimeSliderViewModel.js +1 -1
- package/widgets/TimeSlider.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
- package/widgets/support/DatePicker.js +1 -1
- package/widgets/support/Popover.js +1 -1
- package/widgets/support/SnappingControls.js +1 -1
- package/widgets/support/TimePicker.js +1 -1
- package/widgets/support/timeWidgetUtils.js +1 -1
- package/assets/esri/core/workers/chunks/083a5d10f8e243641cb9.js +0 -1
- package/assets/esri/core/workers/chunks/0872812ce4d0ec8faf8f.js +0 -1
- package/assets/esri/core/workers/chunks/0bc26899780c33637746.js +0 -1
- package/assets/esri/core/workers/chunks/113362697da1b69deaed.js +0 -1
- package/assets/esri/core/workers/chunks/11a2f9708938eac98815.js +0 -1
- package/assets/esri/core/workers/chunks/11a45709b703be84caaf.js +0 -1
- package/assets/esri/core/workers/chunks/1c1294ff1ebbd8f774f7.js +0 -1
- package/assets/esri/core/workers/chunks/1c915cc9a9d5729b6f17.js +0 -1
- package/assets/esri/core/workers/chunks/31786756b3d44540f8c0.js +0 -1
- package/assets/esri/core/workers/chunks/36a6f34fe40785beff5d.js +0 -1
- package/assets/esri/core/workers/chunks/373c16f8b8093d001064.js +0 -1
- package/assets/esri/core/workers/chunks/382a331a592abb61267f.js +0 -1
- package/assets/esri/core/workers/chunks/3bf106fe34e3992032c4.js +0 -1
- package/assets/esri/core/workers/chunks/3dcec610f1c1497d87bc.js +0 -1
- package/assets/esri/core/workers/chunks/46495e726d8739260d44.js +0 -1
- package/assets/esri/core/workers/chunks/4a82a6a473b3d540d0be.js +0 -1
- package/assets/esri/core/workers/chunks/4b6719377a95ac10fa43.js +0 -1
- package/assets/esri/core/workers/chunks/4d2ef57ff3a5cfc1313f.js +0 -1
- package/assets/esri/core/workers/chunks/4fd2b8153d62592210a2.js +0 -1
- package/assets/esri/core/workers/chunks/56e6a1079269e2964b02.js +0 -1
- package/assets/esri/core/workers/chunks/5b4d9786c010d265346c.js +0 -1
- package/assets/esri/core/workers/chunks/604637e1c3937b376a0d.js +0 -1
- package/assets/esri/core/workers/chunks/60f83257e361f87fa6fd.js +0 -1
- package/assets/esri/core/workers/chunks/6d3f80be6fceb2c18b5d.js +0 -1
- package/assets/esri/core/workers/chunks/6f827a32646bab0a8777.js +0 -1
- package/assets/esri/core/workers/chunks/70bd2ab42e3801ef5974.js +0 -1
- package/assets/esri/core/workers/chunks/746222184b361b50d6ba.js +0 -1
- package/assets/esri/core/workers/chunks/7fb72b2d11e8d840f982.js +0 -1
- package/assets/esri/core/workers/chunks/85bb6a1a7704fcdcbec2.js +0 -1
- package/assets/esri/core/workers/chunks/8b4c76cebb100e6c06f8.js +0 -1
- package/assets/esri/core/workers/chunks/9586a6b320edb1922926.js +0 -1
- package/assets/esri/core/workers/chunks/99638697ffda9022ce92.js +0 -1
- package/assets/esri/core/workers/chunks/a9da1cb118ca62a9581d.js +0 -1
- package/assets/esri/core/workers/chunks/aaa41a5013eef713c032.js +0 -1
- package/assets/esri/core/workers/chunks/ac321f939dd488ff6ce4.js +0 -1
- package/assets/esri/core/workers/chunks/add6027a96398ecf69de.js +0 -1
- package/assets/esri/core/workers/chunks/b75206b46ba81606087c.js +0 -1
- package/assets/esri/core/workers/chunks/bf8456828e38a768eba3.js +0 -1
- package/assets/esri/core/workers/chunks/c0720d0d8adcba6738d4.js +0 -1
- package/assets/esri/core/workers/chunks/c5bb712d5cf8c05a4e13.js +0 -1
- package/assets/esri/core/workers/chunks/d343f05a3366f95e0494.js +0 -1
- package/assets/esri/core/workers/chunks/d8b1f00075983d769985.js +0 -1
- package/chunks/Highlight.glsl.js +0 -88
- package/views/3d/webgl-engine/shaders/Highlight.glsl.js +0 -5
- package/views/3d/webgl-engine/shaders/HighlightTechnique.js +0 -5
- package/views/3d/webgl-engine/shaders/HighlightTechniqueConfiguration.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import{result as t,forEach as i}from"../../../core/asyncUtils.js";import r from"../../../core/Collection.js";import s from"../../../core/Logger.js";import{unwrapOr as o,isSome as n,isNone as a,mapSome as d}from"../../../core/maybe.js";import{eachAlways as l,isAbortError as h,eachAlwaysValues as u,throwIfAborted as p}from"../../../core/promiseUtils.js";import{initial as c,watch as _,sync as m}from"../../../core/reactiveUtils.js";import{pt2px as g}from"../../../core/screenUtils.js";import{estimateSize as f,isArrayBuffer as y}from"../../../core/typedArrayUtil.js";import{getMetersPerVerticalUnitForSR as b}from"../../../core/unitUtils.js";import{property as w}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as N}from"../../../core/accessorSupport/decorators/subclass.js";import{e as x}from"../../../chunks/vec3.js";import{a as P}from"../../../chunks/vec3f32.js";import{projectBoundingRect as v}from"../../../geometry/projection.js";import{create as C}from"../../../geometry/support/aaBoundingBox.js";import{containsPoint as S,create as A}from"../../../geometry/support/aaBoundingRect.js";import{create as I,fromNormalAndOffset as k}from"../../../geometry/support/plane.js";import{makeDehydratedPoint as V}from"../../../layers/graphics/dehydratedFeatures.js";import{CodedValue as R}from"../../../layers/support/CodedValue.js";import L from"../../../layers/support/CodedValueDomain.js";import"../../../layers/support/Domain.js";import"../../../layers/support/InheritedDomain.js";import"../../../layers/support/RangeDomain.js";import{unpackFieldNames as j}from"../../../layers/support/fieldUtils.js";import{PromiseQueue as U}from"../../../layers/support/PromiseQueue.js";import{getMetersPerUnit as D}from"../../../symbols/support/unitConversionUtils.js";import{LayerView3D as Q}from"./LayerView3D.js";import{PointCloudWorkerHandle as F}from"./PointCloudWorkerHandle.js";import{checkPointCloudLayerValid as z,checkPointCloudLayerCompatibleWithView as M}from"./i3s/I3SUtil.js";import{nodeDiff as W,sortFrontToBack as O,splitWorkEntries as E}from"./i3s/LoDUtil.js";import B from"./i3s/PagedNodeIndex.js";import{getSplatSizeAlgorithm as G,getFixedSizeAlgorithm as H,getRendererInfo as q,getFilterInfo as T,rendererUsesFixedSizes as $,getAttributeInfo as J}from"./i3s/PointCloudRendererUtil.js";import{getAttributeValues as K,readGeometry as X,elevationFromPositions as Y}from"./i3s/PointCloudWorkerUtil.js";import{PointGraphic as Z}from"./i3s/PointGraphic.js";import{PointRenderer as ee,isInstanceOfNode as te}from"./i3s/PointRenderer.js";import{PopupSceneLayerView as ie}from"./support/PopupSceneLayerView.js";import{projectToBoundingBox as re}from"../support/extentUtils.js";import{ClientType as se}from"../support/index.js";import{minimumDistancePlane as oe}from"../support/orientedBoundingBox.js";import{updatingProgress as ne}from"../support/updatingProperties.js";import{RenderSlot as ae}from"../webgl-engine/lib/RenderSlot.js";import de from"../../layers/LayerView.js";import{isScaleRangeActive as le,extractSafeScaleBounds as he,scaleBoundsPredicate as ue}from"../../support/layerViewUtils.js";import{TaskPriority as pe}from"../../support/Scheduler.js";const ce=s.getLogger("esri.views.3d.layers.PointCloudLayerView3D"),_e=8,me=I();let ge=class extends(ie(Q(de))){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._nodeScales=new Map,this._updateViewNeeded=!0,this._lodFactor=1,this._maxLoggedBoxWarnings=5,this._pageMultiplier=1,this._nodeLoadEpoch=0,this._indexQueue=[],this._workQueue=new Array,this._idleQueue=new U,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=[]}get pointScale(){const e=G(this.layer&&this.layer.renderer),t=1;return e&&null!=e.scaleFactor?e.scaleFactor:t}get useRealWorldSymbolSizes(){const e=H(this.layer&&this.layer.renderer),t=!1;return e&&null!=e.useRealWorldSymbolSizes?e.useRealWorldSymbolSizes:t}get pointSize(){const e=H(this.layer&&this.layer.renderer),t=0;return e&&null!=e.size?e.size:t}get inverseDensity(){const e=96;return this.layer&&this.layer.renderer?1*e/this.layer.renderer.pointsPerInch:5}get availableFields(){const e=q(this.layer),t=new Set;e.primaryAttribute&&t.add(e.primaryAttribute.name),e.modulationAttribute&&t.add(e.primaryAttribute.name);const i=T(this.layer);if(i)for(const r of i)t.add(r.attributeInfo.name);if(this.layer.outFields)for(const r of j(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=C(),t=this.view.renderSpatialReference;return re(this.view.clippingArea,e,t)?e:null}get _elevationOffset(){const e=this.layer&&this.layer.elevationInfo;if(e&&"absolute-height"===e.mode){const t=b(this.layer.spatialReference),i=D(e.unit);return o(e.offset,0)*i/t}return 0}initialize(){const e=this.view.resourceController;this._worker=new F((t=>e.schedule(t))),this.addResolvingPromise(this._worker.promise),this._tmpPoint=V(0,0,0,this.layer.spatialReference),z(this.layer),M(this.layer,this.view),this._indexRequester=e.createStreamDataRequester(se.I3S_INDEX),this._dataRequester=e.createStreamDataRequester(se.I3S_DATA),this._initRenderer();const t=this._initNodePages(),i=this.view.resourceController.memoryController;this._memCache=i.newCache(this.layer.uid),this.updatingHandles.add((()=>this._clippingBox),(()=>this._setUpdateViewNeeded()),c),this.updatingHandles.add((()=>this._elevationOffset),(()=>this._elevationOffsetChanged()),c),this.updatingHandles.add((()=>this.layer.renderer),(()=>this._rendererChanged()),c),this.updatingHandles.add((()=>this.layer.filters),(()=>this._reload()),c),this.updatingHandles.add((()=>this.layer.outFields),(()=>this._reload()),c),this.updatingHandles.add((()=>this.layer.effectiveScaleRange),(()=>this._setUpdateViewNeeded())),this.updatingHandles.add((()=>this.view.state.contentCamera),(()=>this._setUpdateViewNeeded())),this.handles.add([this.view.basemapTerrain.on("scale-change",(e=>this._scaleUpdateHandler(e))),_((()=>i.memoryFactor),(()=>this._setUpdateViewNeeded()),m)]),this.addResolvingPromise(t),this.when((()=>{this.handles.add([e.scheduler.registerTask(pe.POINT_CLOUD_LAYER,this),e.scheduler.registerIdleStateCallbacks((()=>this._idleBegin()),(()=>this._idleEnd())),this.updatingHandles.add((()=>this.suspended),(e=>{e?this._clearNodeState():this._setUpdateViewNeeded()}),c)])}),(()=>{this.updatingHandles.removeAll(),this.handles.removeAll()}))}_setUpdateViewNeeded(){this._updateViewNeeded=!0,this._updateLoading()}destroy(){this.cancelLoading(),this._worker&&(this._worker.destroy(),this._worker=null),this._destroyRenderer(),this._memCache.destroy(),this._memCache=null,this._codedDomainPopulationAbortController&&(this._codedDomainPopulationAbortController.abort(),this._codedDomainPopulationAbortController=null),this._codedDomainPopulationPromise=null}_initRenderer(){this._renderer=new ee({createGraphic:(e,t,i)=>this._createGraphic(e,t,i)}),this._renderer.layerUid=this.layer.uid,this.updatingHandles.add((()=>this._clippingBox),(e=>this._renderer.clippingBox=e),c),this.updatingHandles.add((()=>this.suspended),(e=>this._setPointsVisible(!e)),c),this.updatingHandles.add((()=>this.pointScale),(e=>this._renderer.scaleFactor=e),c),this._renderer.minSizePx=Math.sqrt(2),this.updatingHandles.add((()=>this.useRealWorldSymbolSizes),(e=>this._renderer.useRealWorldSymbolSizes=e),c),this.updatingHandles.add((()=>this.pointSize),(e=>{const t=g(e);this._renderer.size=e,this._renderer.sizePx=t}),c),this.updatingHandles.add((()=>this.slicePlaneEnabled),(e=>this._renderer.slicePlaneEnabled=e),c),this.updatingHandles.add((()=>this.inverseDensity),(()=>this._setUpdateViewNeeded()),c),this.updatingHandles.add((()=>this.maximumPointCount),(()=>this._setUpdateViewNeeded()),c),this.updatingHandles.add((()=>this.view.qualitySettings.sceneService.pointCloud.lodFactor),(e=>{this._lodFactor=e,this._setUpdateViewNeeded()}),c)}_destroyRenderer(){this._renderer.removeAll(),this._setPointsVisible(!1)}_createGraphic(e,t,i){const r=n(e.pointIdFilterMap)?e.pointIdFilterMap[t]:t,s=this.view.computeMapPointFromVec3d(i),o=this._createGraphicAttributes(e,r);return new Z({pointCloudMetadata:{nodeId:e.id,pointIndexInNode:t,attributePointIndexInNode:r,epoch:this._nodeLoadEpoch},geometry:s,attributes:o,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}_encodeGraphicAttribute(e,t,i,r){const s=e.storageInfo&&e.storageInfo.attributeValues,o=s?s.valuesPerElement:1;if(1===o)r[e.name]=t[i];else if("UInt8"===s.valueType&&o<=4){let s=0;const n=i*o;for(let e=n;e<n+o;e++)s=(s<<8)+t[e];r[e.name]=s}else r[e.name]=void 0}_setPointsVisible(e){e&&!this._rendererAdded?(this.view._stage.addRenderPlugin([ae.OPAQUE_MATERIAL],this._renderer),this._rendererAdded=!0):!e&&this._rendererAdded&&(this.view._stage.removeRenderPlugin(this._renderer),this._rendererAdded=!1)}_rendererChanged(){this._renderer.useFixedSizes=$(this.layer.renderer),this._reload()}_reload(){this._clearNodeState(),this._memCache.clear(),this._setUpdateViewNeeded()}_elevationOffsetChanged(){this._clearNodeState(),this._memCache.clear(),this._initNodePages()}_scaleUpdateHandler(e){const t=this.layer.effectiveScaleRange;le(t.minScale,t.maxScale)?v(e.extent,e.spatialReference,be,this.layer.spatialReference)&&(this._nodeScales.forEach(((t,i)=>{if(!this._renderedNodes.has(i))return void this._nodeScales.delete(i);const r=this._index.getNode(i);S(be,r.obb.center)&&this._nodeScales.set(i,e.scale)})),this._setUpdateViewNeeded()):this._nodeScales.clear()}_displayNodes(e){this._workQueue=W([...this._renderedNodes],e,this._index),O(this._workQueue,this.view.state.contentCamera.viewForward,this._index),E(this._workQueue,_e,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(a(t))return;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 n(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.running&&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,i){const r="CLASS_CODE",s=this.layer.fieldsIndex.get(r);if(!s||s.domain)return;if(-1===e.indexOf(s.name))return;const o=await t(this.layer.queryCachedStatistics(r,{signal:i}));if(!1===o.ok)return;const n=o.value,a=n&&n.labels&&n.labels.labels;a&&Array.isArray(a)&&(s.domain=new L({name:"CLASS_CODE",codedValues:a.map((e=>new R({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),s=this.layer.attributeStorageInfo,o=t.map((e=>J(s,e))),n=async(e,t)=>{const r=this._index.getNode(t);await i(o,(async t=>{const i=t.useElevation?await this._loadElevationAttributeFromGeometry(r.resourceId):await this._loadAndParseAttribute(r,t);if(i)for(const r of e)if(this._isValidPointGraphic(r)){const e=r.pointCloudMetadata.attributePointIndexInNode;this._encodeGraphicAttribute(t,i,e,r.attributes)}}))},a=[];return r.forEach(((e,t)=>{a.push(n(e,t))})),await l(a),e}_isValidPointGraphic(e){return e instanceof Z&&e.pointCloudMetadata&&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 n(i)?K({attributeInfo:t,buffer:i},null,e.vertexCount):null}async _loadElevationAttributeFromGeometry(e){const t=this.layer.store.defaultGeometrySchema,i=X(t,await this._loadGeometry(e,null));return Y(i,i.length/3)}highlight(e){if(!e)return{remove(){}};const t=r.isCollection(e)?e.toArray():Array.isArray(e)?e:[e];return this._renderer.highlight(t.map((e=>this._graphicToPointDefinition(e))))}_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}_initNodePages(){const e=this.layer.store.index,t=e.nodesPerPage||e.nodePerIndexBlock;return this._index=new B(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:t.obb,firstChild:t.firstChild,childCount:t.childCount,vertexCount:null!=t.vertexCount?t.vertexCount:t.pointCount,lodThreshold:null!=t.lodThreshold?t.lodThreshold:t.effectiveArea}))))),abortController:t}}_updateWorkQueues(){if(!this._updateViewNeeded)return!1;let e=this.inverseDensity/this._lodFactor*this._getLodMemoryFactor();const t=this.maximumPointCount*this._lodFactor*this._getLodMemoryFactor();let i=this._computeNodesForMinimumDensity(e),r=this._computePointCount(i),s=Math.sqrt(r/(.75*t));for(;r>t;)e*=s,i=this._computeNodesForMinimumDensity(e),r=this._computePointCount(i),s=Math.sqrt(2);return this._displayNodes(i),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}_getLodMemoryFactor(){return this.view.resourceController.memoryController.memoryFactor}_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=x(s,t.eye),n=k(s,-o,me),a=t.perScreenPixelRatio/2,d=e*e,l=this._nodeIdArray;l.length=0;const{minScale:h,maxScale:u}=he(this.layer),p=0===h&&0===u?e=>l.push(e):e=>{const t=this._getScale(e);ue(t,h,u)&&l.push(e)};return this._traverseVisible({frustum:i,clippingBox:r},{predicate:(e,t,i)=>{if(!i)return!1;if(0===t.childCount)return p(e),!1;const r=this._index.getRenderObb(e);return!(this._computeAveragePixelArea(r,t.lodThreshold,t.vertexCount,n,a)<=d)||(p(e),!1)},pageMiss:(e,t)=>{p(e),this._indexQueue.indexOf(t)<0&&this._indexQueue.push(t)}}),l}_getScale(e){let t=this._nodeScales.get(e);if(null==t){const i=this._index.getNode(e).obb.center;this._tmpPoint.x=i[0],this._tmpPoint.y=i[1],this._tmpPoint.z=i[2],t=this.view.basemapTerrain.getScale(this._tmpPoint),this._nodeScales.set(e,t)}return t}_computeAveragePixelArea(e,t,i,r,s){const o=1e-7,n=Math.max(o,oe(e,r));return t/(n*n)/(4*s*s)/i}_loadNode(e,t){try{return this._loadNodeAsync(e,t)}catch(i){throw h(i)||ce.error(i),i}}async _loadAdditionalUserAttributes(e,t,i){const r=this.layer.outFields;if(!r)return[];const s=j(this.layer.fieldsIndex,r),o=new Set(e.map((e=>n(e)?e.name:null))),a=this.layer.attributeStorageInfo,l=[];for(const n of s){if(o.has(n))continue;const e=J(a,n);e&&l.push(t(e))}const h=await u(l);return p(i),d(h,(e=>e))}async _loadNodeAsync(e,t){const i=this._index.getNode(e),r=q(this.layer),s=T(this.layer),o=i.resourceId,d=async e=>{if(a(e))return null;if(e.useElevation)return{attributeInfo:e,buffer:null};const i=await this._loadAttribute(o,e,t);return n(i)?{attributeInfo:e,buffer:i}:null};return this._idleQueue.push((async()=>{const i=this._loadGeometry(o,t),{primaryAttribute:n,modulationAttribute:a}=r,l=d(n),h=d(a),u=s.map((e=>e.attributeInfo)),c=u.map((e=>d(e))),_=this._loadAdditionalUserAttributes([n,a,...u],d,t),[m,g,f,y,b]=await Promise.all([i,l,h,Promise.all(c),_]);p(t);const w={geometryBuffer:m,primaryAttributeData:g,modulationAttributeData:f,filterAttributesData:y,userAttributesData:b,schema:this.layer.store.defaultGeometrySchema,rendererInfo:r,filterInfo:s,obb:this._index.getRenderObb(e),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(a(t)||!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",token:this.layer.apiKey};return this._indexRequester.request(e,"json",{query:i,signal:t})}_requestData(e,t){return this._dataRequester.request(e,"binary",{query:{token:this.layer.apiKey},signal:t})}_removeFromRenderer(e){if(this._renderedNodes.has(e)){const t=this._renderer.removeNode(e);this._renderedNodes.delete(e),this._nodeScales.delete(e),this._memCache.put(t.id.toString(),t,ye(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(te(t))return t.splatSize=r,t.obb=s,t.origin=P(t.obb.center),t;const o=.01*Math.max(s.halfSize[0],s.halfSize[1],s.halfSize[2]);if(t.obb.halfSize[0]>s.halfSize[0]+o||t.obb.halfSize[1]>s.halfSize[1]+o||t.obb.halfSize[2]>s.halfSize[2]+o){if(this._maxLoggedBoxWarnings>0){const i=e=>`[${e.halfSize[0]}, ${e.halfSize[1]}, ${e.halfSize[2]}]`;ce.warn(`Node ${e} reported bounding box too small. got ${i(s)} but points cover ${i(t.obb)}`),0==--this._maxLoggedBoxWarnings&&ce.warn(" Too many bounding box errors, stopping reporting for this layer.")}this._index.setRenderObb(e,t.obb)}return{id:e,coordinates:t.points,origin:P(s.center),rgb:t.rgb,attributes:t.attributes,pointIdFilterMap:t.pointIdFilterMap,highlights:null,splatSize:r,obb:s,isLeaf:0===i.childCount}}getUsedMemory(){let e=0;return this._renderer.forEachNode((t=>{e+=we,e+=f(t.coordinates);for(const i of t.attributes){const t=i.values;y(t.buffer)&&(e+=f(t))}})),e}getUnloadedMemory(){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.getUsedMemory()-e*we)/t)+i*we}ignoresMemoryFactor(){return!1}get performanceInfo(){return{nodes:this._renderedNodes.size,displayedNumberOfFeatures:[...this._renderedNodes].reduce(((e,t)=>e+this._index.getNode(t).vertexCount),0),maximumNumberOfFeatures:this.maximumPointCount,totalNumberOfFeatures:-1,core:null,"Loading Nodes":this._loadingNodes.size,"Index Queue":this._indexQueue.length,"Work Queue":this._workQueue.length,"Idle Queue":this._idleQueue.length}}get test(){return{index:this._index,visibleNodes:this._renderedNodes}}};e([w()],ge.prototype,"layer",void 0),e([w({readOnly:!0,aliasOf:"layer.parsedUrl.path"})],ge.prototype,"baseUrl",void 0),e([w({readOnly:!0})],ge.prototype,"pointScale",null),e([w({readOnly:!0})],ge.prototype,"useRealWorldSymbolSizes",null),e([w({readOnly:!0})],ge.prototype,"pointSize",null),e([w({readOnly:!0})],ge.prototype,"inverseDensity",null),e([w()],ge.prototype,"maximumPointCount",void 0),e([w({readOnly:!0})],ge.prototype,"availableFields",null),e([w({readOnly:!0})],ge.prototype,"_clippingBox",null),e([w({readOnly:!0})],ge.prototype,"_elevationOffset",null),e([w({type:Boolean})],ge.prototype,"slicePlaneEnabled",void 0),e([w()],ge.prototype,"updating",void 0),e([w(ne)],ge.prototype,"updatingProgress",void 0),e([w({readOnly:!0})],ge.prototype,"updatingProgressValue",null),ge=e([N("esri.views.3d.layers.PointCloudLayerView3D")],ge);const fe=ge;function ye(e){return 5*e.coordinates.length+128}const be=A(),we=160;export{fe as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import{result as t,forEach as i}from"../../../core/asyncUtils.js";import r from"../../../core/Collection.js";import s from"../../../core/Logger.js";import{unwrapOr as o,isSome as n,isNone as a,mapSome as d}from"../../../core/maybe.js";import{eachAlways as l,isAbortError as h,eachAlwaysValues as u,throwIfAborted as p}from"../../../core/promiseUtils.js";import{initial as c,watch as _,sync as m}from"../../../core/reactiveUtils.js";import{pt2px as g}from"../../../core/screenUtils.js";import{estimateSize as f,isArrayBuffer as y}from"../../../core/typedArrayUtil.js";import{getMetersPerVerticalUnitForSR as b}from"../../../core/unitUtils.js";import{property as w}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as N}from"../../../core/accessorSupport/decorators/subclass.js";import{e as P}from"../../../chunks/vec3.js";import{a as x}from"../../../chunks/vec3f32.js";import{projectBoundingRect as v}from"../../../geometry/projection.js";import{create as C}from"../../../geometry/support/aaBoundingBox.js";import{containsPoint as S,create as A}from"../../../geometry/support/aaBoundingRect.js";import{create as I,fromNormalAndOffset as k}from"../../../geometry/support/plane.js";import{makeDehydratedPoint as V}from"../../../layers/graphics/dehydratedFeatures.js";import{CodedValue as R}from"../../../layers/support/CodedValue.js";import L from"../../../layers/support/CodedValueDomain.js";import"../../../layers/support/Domain.js";import"../../../layers/support/InheritedDomain.js";import"../../../layers/support/RangeDomain.js";import{unpackFieldNames as j}from"../../../layers/support/fieldUtils.js";import{PromiseQueue as U}from"../../../layers/support/PromiseQueue.js";import{getMetersPerUnit as D}from"../../../symbols/support/unitConversionUtils.js";import{LayerView3D as Q}from"./LayerView3D.js";import{PointCloudWorkerHandle as F}from"./PointCloudWorkerHandle.js";import{checkPointCloudLayerValid as z,checkPointCloudLayerCompatibleWithView as M}from"./i3s/I3SUtil.js";import{nodeDiff as W,sortFrontToBack as E,splitWorkEntries as O}from"./i3s/LoDUtil.js";import B from"./i3s/PagedNodeIndex.js";import{getSplatSizeAlgorithm as G,getFixedSizeAlgorithm as H,getRendererInfo as q,getFilterInfo as T,rendererUsesFixedSizes as $,getAttributeInfo as J}from"./i3s/PointCloudRendererUtil.js";import{getAttributeValues as K,readGeometry as X,elevationFromPositions as Y}from"./i3s/PointCloudWorkerUtil.js";import{PointGraphic as Z}from"./i3s/PointGraphic.js";import{PointRenderer as ee,isInstanceOfNode as te}from"./i3s/PointRenderer.js";import{PopupSceneLayerView as ie}from"./support/PopupSceneLayerView.js";import{projectToBoundingBox as re}from"../support/extentUtils.js";import{ClientType as se}from"../support/index.js";import{minimumDistancePlane as oe}from"../support/orientedBoundingBox.js";import{updatingProgress as ne}from"../support/updatingProperties.js";import{RenderSlot as ae}from"../webgl-engine/lib/RenderSlot.js";import de from"../../layers/LayerView.js";import{isScaleRangeActive as le,extractSafeScaleBounds as he,scaleBoundsPredicate as ue}from"../../support/layerViewUtils.js";import{TaskPriority as pe}from"../../support/Scheduler.js";const ce=s.getLogger("esri.views.3d.layers.PointCloudLayerView3D"),_e=8,me=I();let ge=class extends(ie(Q(de))){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._nodeScales=new Map,this._updateViewNeeded=!0,this._lodFactor=1,this._maxLoggedBoxWarnings=5,this._pageMultiplier=1,this._nodeLoadEpoch=0,this._indexQueue=[],this._workQueue=new Array,this._idleQueue=new U,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=[]}get pointScale(){const e=G(this.layer&&this.layer.renderer),t=1;return e&&null!=e.scaleFactor?e.scaleFactor:t}get useRealWorldSymbolSizes(){const e=H(this.layer&&this.layer.renderer),t=!1;return e&&null!=e.useRealWorldSymbolSizes?e.useRealWorldSymbolSizes:t}get pointSize(){const e=H(this.layer&&this.layer.renderer),t=0;return e&&null!=e.size?e.size:t}get inverseDensity(){const e=96;return this.layer&&this.layer.renderer?1*e/this.layer.renderer.pointsPerInch:5}get availableFields(){const e=q(this.layer),t=new Set;e.primaryAttribute&&t.add(e.primaryAttribute.name),e.modulationAttribute&&t.add(e.primaryAttribute.name);const i=T(this.layer);if(i)for(const r of i)t.add(r.attributeInfo.name);if(this.layer.outFields)for(const r of j(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=C(),t=this.view.renderSpatialReference;return re(this.view.clippingArea,e,t)?e:null}get _elevationOffset(){const e=this.layer&&this.layer.elevationInfo;if(e&&"absolute-height"===e.mode){const t=b(this.layer.spatialReference),i=D(e.unit);return o(e.offset,0)*i/t}return 0}initialize(){const e=this.view.resourceController;this._worker=new F((t=>e.schedule(t))),this.addResolvingPromise(this._worker.promise),this._tmpPoint=V(0,0,0,this.layer.spatialReference),z(this.layer),M(this.layer,this.view),this._indexRequester=e.createStreamDataRequester(se.I3S_INDEX),this._dataRequester=e.createStreamDataRequester(se.I3S_DATA),this._initRenderer();const t=this._initNodePages(),i=this.view.resourceController.memoryController;this._memCache=i.newCache(this.layer.uid),this.updatingHandles.add((()=>this._clippingBox),(()=>this._setUpdateViewNeeded()),c),this.updatingHandles.add((()=>this._elevationOffset),(()=>this._elevationOffsetChanged()),c),this.updatingHandles.add((()=>this.layer.renderer),(()=>this._rendererChanged()),c),this.updatingHandles.add((()=>this.layer.filters),(()=>this._reload()),c),this.updatingHandles.add((()=>this.layer.outFields),(()=>this._reload()),c),this.updatingHandles.add((()=>this.layer.effectiveScaleRange),(()=>this._setUpdateViewNeeded())),this.updatingHandles.add((()=>this.view.state.contentCamera),(()=>this._setUpdateViewNeeded())),this.handles.add([this.view.basemapTerrain.on("scale-change",(e=>this._scaleUpdateHandler(e))),_((()=>i.memoryFactor),(()=>this._setUpdateViewNeeded()),m)]),this.addResolvingPromise(t),this.when((()=>{this.handles.add([e.scheduler.registerTask(pe.POINT_CLOUD_LAYER,this),e.scheduler.registerIdleStateCallbacks((()=>this._idleBegin()),(()=>this._idleEnd())),this.updatingHandles.add((()=>this.suspended),(e=>{e?this._clearNodeState():this._setUpdateViewNeeded()}),c)])}),(()=>{this.updatingHandles.removeAll(),this.handles.removeAll()}))}_setUpdateViewNeeded(){this._updateViewNeeded=!0,this._updateLoading()}destroy(){this.cancelLoading(),this._worker&&(this._worker.destroy(),this._worker=null),this._destroyRenderer(),this._memCache.destroy(),this._memCache=null,this._codedDomainPopulationAbortController&&(this._codedDomainPopulationAbortController.abort(),this._codedDomainPopulationAbortController=null),this._codedDomainPopulationPromise=null}_initRenderer(){this._renderer=new ee({createGraphic:(e,t,i)=>this._createGraphic(e,t,i)}),this._renderer.layerUid=this.layer.uid,this.updatingHandles.add((()=>this._clippingBox),(e=>this._renderer.clippingBox=e),c),this.updatingHandles.add((()=>this.suspended),(e=>this._setPointsVisible(!e)),c),this.updatingHandles.add((()=>this.pointScale),(e=>this._renderer.scaleFactor=e),c),this._renderer.minSizePx=Math.sqrt(2),this.updatingHandles.add((()=>this.useRealWorldSymbolSizes),(e=>this._renderer.useRealWorldSymbolSizes=e),c),this.updatingHandles.add((()=>this.pointSize),(e=>{const t=g(e);this._renderer.size=e,this._renderer.sizePx=t}),c),this.updatingHandles.add((()=>this.slicePlaneEnabled),(e=>this._renderer.slicePlaneEnabled=e),c),this.updatingHandles.add((()=>this.inverseDensity),(()=>this._setUpdateViewNeeded()),c),this.updatingHandles.add((()=>this.maximumPointCount),(()=>this._setUpdateViewNeeded()),c),this.updatingHandles.add((()=>this.view.qualitySettings.sceneService.pointCloud.lodFactor),(e=>{this._lodFactor=e,this._setUpdateViewNeeded()}),c)}_destroyRenderer(){this._renderer.removeAll(),this._setPointsVisible(!1)}_createGraphic(e,t,i){const r=n(e.pointIdFilterMap)?e.pointIdFilterMap[t]:t,s=this.view.computeMapPointFromVec3d(i),o=this._createGraphicAttributes(e,r);return new Z({pointCloudMetadata:{nodeId:e.id,pointIndexInNode:t,attributePointIndexInNode:r,epoch:this._nodeLoadEpoch},geometry:s,attributes:o,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}_encodeGraphicAttribute(e,t,i,r){const s=e.storageInfo&&e.storageInfo.attributeValues,o=s?s.valuesPerElement:1;if(1===o)r[e.name]=t[i];else if("UInt8"===s.valueType&&o<=4){let s=0;const n=i*o;for(let e=n;e<n+o;e++)s=(s<<8)+t[e];r[e.name]=s}else r[e.name]=void 0}_setPointsVisible(e){e&&!this._rendererAdded?(this.view._stage.addRenderPlugin([ae.OPAQUE_MATERIAL],this._renderer),this._rendererAdded=!0):!e&&this._rendererAdded&&(this.view._stage.removeRenderPlugin(this._renderer),this._rendererAdded=!1)}_rendererChanged(){this._renderer.useFixedSizes=$(this.layer.renderer),this._reload()}_reload(){this._clearNodeState(),this._memCache.clear(),this._setUpdateViewNeeded()}_elevationOffsetChanged(){this._clearNodeState(),this._memCache.clear(),this._initNodePages()}_scaleUpdateHandler(e){const t=this.layer.effectiveScaleRange;le(t.minScale,t.maxScale)?v(e.extent,e.spatialReference,be,this.layer.spatialReference)&&(this._nodeScales.forEach(((t,i)=>{if(!this._renderedNodes.has(i))return void this._nodeScales.delete(i);const r=this._index.getNode(i);S(be,r.obb.center)&&this._nodeScales.set(i,e.scale)})),this._setUpdateViewNeeded()):this._nodeScales.clear()}_displayNodes(e){this._workQueue=W([...this._renderedNodes],e,this._index),E(this._workQueue,this.view.state.contentCamera.viewForward,this._index),O(this._workQueue,_e,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(a(t))return;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 n(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.running&&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,i){const r="CLASS_CODE",s=this.layer.fieldsIndex.get(r);if(!s||s.domain)return;if(!e.includes(s.name))return;const o=await t(this.layer.queryCachedStatistics(r,{signal:i}));if(!1===o.ok)return;const n=o.value,a=n&&n.labels&&n.labels.labels;a&&Array.isArray(a)&&(s.domain=new L({name:"CLASS_CODE",codedValues:a.map((e=>new R({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),s=this.layer.attributeStorageInfo,o=t.map((e=>J(s,e))),n=async(e,t)=>{const r=this._index.getNode(t);await i(o,(async t=>{const i=t.useElevation?await this._loadElevationAttributeFromGeometry(r.resourceId):await this._loadAndParseAttribute(r,t);if(i)for(const r of e)if(this._isValidPointGraphic(r)){const e=r.pointCloudMetadata.attributePointIndexInNode;this._encodeGraphicAttribute(t,i,e,r.attributes)}}))},a=[];return r.forEach(((e,t)=>{a.push(n(e,t))})),await l(a),e}_isValidPointGraphic(e){return e instanceof Z&&e.pointCloudMetadata&&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 n(i)?K({attributeInfo:t,buffer:i},null,e.vertexCount):null}async _loadElevationAttributeFromGeometry(e){const t=this.layer.store.defaultGeometrySchema,i=X(t,await this._loadGeometry(e,null));return Y(i,i.length/3)}highlight(e){if(!e)return{remove(){}};const t=r.isCollection(e)?e.toArray():Array.isArray(e)?e:[e];return this._renderer.highlight(t.map((e=>this._graphicToPointDefinition(e))))}_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}_initNodePages(){const e=this.layer.store.index,t=e.nodesPerPage||e.nodePerIndexBlock;return this._index=new B(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:t.obb,firstChild:t.firstChild,childCount:t.childCount,vertexCount:null!=t.vertexCount?t.vertexCount:t.pointCount,lodThreshold:null!=t.lodThreshold?t.lodThreshold:t.effectiveArea}))))),abortController:t}}_updateWorkQueues(){if(!this._updateViewNeeded)return!1;let e=this.inverseDensity/this._lodFactor*this._getLodMemoryFactor();const t=this.maximumPointCount*this._lodFactor*this._getLodMemoryFactor();let i=this._computeNodesForMinimumDensity(e),r=this._computePointCount(i),s=Math.sqrt(r/(.75*t));for(;r>t;)e*=s,i=this._computeNodesForMinimumDensity(e),r=this._computePointCount(i),s=Math.sqrt(2);return this._displayNodes(i),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}_getLodMemoryFactor(){return this.view.resourceController.memoryController.memoryFactor}_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=P(s,t.eye),n=k(s,-o,me),a=t.perScreenPixelRatio/2,d=e*e,l=this._nodeIdArray;l.length=0;const{minScale:h,maxScale:u}=he(this.layer),p=0===h&&0===u?e=>l.push(e):e=>{const t=this._getScale(e);ue(t,h,u)&&l.push(e)};return this._traverseVisible({frustum:i,clippingBox:r},{predicate:(e,t,i)=>{if(!i)return!1;if(0===t.childCount)return p(e),!1;const r=this._index.getRenderObb(e);return!(this._computeAveragePixelArea(r,t.lodThreshold,t.vertexCount,n,a)<=d)||(p(e),!1)},pageMiss:(e,t)=>{p(e),this._indexQueue.includes(t)||this._indexQueue.push(t)}}),l}_getScale(e){let t=this._nodeScales.get(e);if(null==t){const i=this._index.getNode(e).obb.center;this._tmpPoint.x=i[0],this._tmpPoint.y=i[1],this._tmpPoint.z=i[2],t=this.view.basemapTerrain.getScale(this._tmpPoint),this._nodeScales.set(e,t)}return t}_computeAveragePixelArea(e,t,i,r,s){const o=1e-7,n=Math.max(o,oe(e,r));return t/(n*n)/(4*s*s)/i}_loadNode(e,t){try{return this._loadNodeAsync(e,t)}catch(i){throw h(i)||ce.error(i),i}}async _loadAdditionalUserAttributes(e,t,i){const r=this.layer.outFields;if(!r)return[];const s=j(this.layer.fieldsIndex,r),o=new Set(e.map((e=>n(e)?e.name:null))),a=this.layer.attributeStorageInfo,l=[];for(const n of s){if(o.has(n))continue;const e=J(a,n);e&&l.push(t(e))}const h=await u(l);return p(i),d(h,(e=>e))}async _loadNodeAsync(e,t){const i=this._index.getNode(e),r=q(this.layer),s=T(this.layer),o=i.resourceId,d=async e=>{if(a(e))return null;if(e.useElevation)return{attributeInfo:e,buffer:null};const i=await this._loadAttribute(o,e,t);return n(i)?{attributeInfo:e,buffer:i}:null};return this._idleQueue.push((async()=>{const i=this._loadGeometry(o,t),{primaryAttribute:n,modulationAttribute:a}=r,l=d(n),h=d(a),u=s.map((e=>e.attributeInfo)),c=u.map((e=>d(e))),_=this._loadAdditionalUserAttributes([n,a,...u],d,t),[m,g,f,y,b]=await Promise.all([i,l,h,Promise.all(c),_]);p(t);const w={geometryBuffer:m,primaryAttributeData:g,modulationAttributeData:f,filterAttributesData:y,userAttributesData:b,schema:this.layer.store.defaultGeometrySchema,rendererInfo:r,filterInfo:s,obb:this._index.getRenderObb(e),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(a(t)||!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",token:this.layer.apiKey};return this._indexRequester.request(e,"json",{query:i,signal:t})}_requestData(e,t){return this._dataRequester.request(e,"binary",{query:{token:this.layer.apiKey},signal:t})}_removeFromRenderer(e){if(this._renderedNodes.has(e)){const t=this._renderer.removeNode(e);this._renderedNodes.delete(e),this._nodeScales.delete(e),this._memCache.put(t.id.toString(),t,ye(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(te(t))return t.splatSize=r,t.obb=s,t.origin=x(t.obb.center),t;const o=.01*Math.max(s.halfSize[0],s.halfSize[1],s.halfSize[2]);if(t.obb.halfSize[0]>s.halfSize[0]+o||t.obb.halfSize[1]>s.halfSize[1]+o||t.obb.halfSize[2]>s.halfSize[2]+o){if(this._maxLoggedBoxWarnings>0){const i=e=>`[${e.halfSize[0]}, ${e.halfSize[1]}, ${e.halfSize[2]}]`;ce.warn(`Node ${e} reported bounding box too small. got ${i(s)} but points cover ${i(t.obb)}`),0==--this._maxLoggedBoxWarnings&&ce.warn(" Too many bounding box errors, stopping reporting for this layer.")}this._index.setRenderObb(e,t.obb)}return{id:e,coordinates:t.points,origin:x(s.center),rgb:t.rgb,attributes:t.attributes,pointIdFilterMap:t.pointIdFilterMap,highlights:null,splatSize:r,obb:s,isLeaf:0===i.childCount}}getUsedMemory(){let e=0;return this._renderer.forEachNode((t=>{e+=we,e+=f(t.coordinates);for(const i of t.attributes){const t=i.values;y(t.buffer)&&(e+=f(t))}})),e}getUnloadedMemory(){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.getUsedMemory()-e*we)/t)+i*we}ignoresMemoryFactor(){return!1}get performanceInfo(){return{nodes:this._renderedNodes.size,displayedNumberOfFeatures:[...this._renderedNodes].reduce(((e,t)=>e+this._index.getNode(t).vertexCount),0),maximumNumberOfFeatures:this.maximumPointCount,totalNumberOfFeatures:-1,core:null,"Loading Nodes":this._loadingNodes.size,"Index Queue":this._indexQueue.length,"Work Queue":this._workQueue.length,"Idle Queue":this._idleQueue.length}}get test(){return{index:this._index,visibleNodes:this._renderedNodes}}};e([w()],ge.prototype,"layer",void 0),e([w({readOnly:!0,aliasOf:"layer.parsedUrl.path"})],ge.prototype,"baseUrl",void 0),e([w({readOnly:!0})],ge.prototype,"pointScale",null),e([w({readOnly:!0})],ge.prototype,"useRealWorldSymbolSizes",null),e([w({readOnly:!0})],ge.prototype,"pointSize",null),e([w({readOnly:!0})],ge.prototype,"inverseDensity",null),e([w()],ge.prototype,"maximumPointCount",void 0),e([w({readOnly:!0})],ge.prototype,"availableFields",null),e([w({readOnly:!0})],ge.prototype,"_clippingBox",null),e([w({readOnly:!0})],ge.prototype,"_elevationOffset",null),e([w({type:Boolean})],ge.prototype,"slicePlaneEnabled",void 0),e([w()],ge.prototype,"updating",void 0),e([w(ne)],ge.prototype,"updatingProgress",void 0),e([w({readOnly:!0})],ge.prototype,"updatingProgressValue",null),ge=e([N("esri.views.3d.layers.PointCloudLayerView3D")],ge);const fe=ge;function ye(e){return 5*e.coordinates.length+128}const be=A(),we=160;export{fe 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.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Collection.js";import t from"../../../core/CollectionFlattener.js";import{destroyMaybe as s,isSome as i}from"../../../core/maybe.js";import{when as o}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{DrapeSourceType as l}from"./interfaces.js";import{LayerView3D as p}from"./LayerView3D.js";import{GraphicsProcessor as u}from"./graphics/GraphicsProcessor.js";import{toViewIfLocal as c}from"./support/projectExtentUtils.js";import{EventedSet as d}from"../support/EventedSet.js";import{UpdatePolicy as h}from"../webgl-engine/lib/basicInterfaces.js";import m from"../../layers/LayerView.js";let y=class extends(p(m)){constructor(){super(...arguments),this.type="route-3d",this.loadedGraphics=new d,this._byObjectID=new Map,this.slicePlaneEnabled=!1,this.drapeSourceType=l.Features,this.fullExtentInLocalViewSpatialReference=null}initialize(){this._set("processor",new u({owner:this,scaleVisibilityEnabled:!0,frustumVisibilityEnabled:!0})),this.addResolvingPromise(this.processor.setup()),this.updatingHandles.addOnCollectionChange((()=>this._routeItems),(e=>this._routeItemsChanged(e)),{initial:!0}),this.addResolvingPromise(c(this).then((e=>this.fullExtentInLocalViewSpatialReference=e))),this.handles.add(o((()=>{var e,r;return null==(e=this.view)||null==(r=e.basemapTerrain)?void 0:r.ready}),(()=>()=>this.notifyChange("updating")),{once:!0}))}destroy(){this.handles.removeAll(),this.updatingHandles.removeAll(),this._set("processor",s(this.processor))}get _routeItems(){return new t({getCollections:()=>[this.layer.pointBarriers,this.layer.polygonBarriers,this.layer.polylineBarriers,this.layer.stops,this.layer.directionLines,this.layer.directionPoints,i(this.layer.routeInfo)?new r([this.layer.routeInfo]):null]})}_routeItemsChanged(e){e.removed.length&&this.loadedGraphics.removeMany(e.removed.map((e=>{const r=this._byObjectID.get(e);return this._byObjectID.delete(e),r}))),this.loadedGraphics.addMany(e.added.map((e=>{const r=e.toGraphic();return this._byObjectID.set(e,r),r})))}get legendEnabled(){var e;return this.canResume()&&!(null!=(e=this.processor)&&e.frustumVisibilitySuspended)}getSuspendInfo(){var e,r,t,s;const i=super.getSuspendInfo();return i.outsideScaleRange=null!=(e=null==(r=this.processor)?void 0:r.scaleVisibilitySuspended)&&e,i.outsideOfView=null!=(t=null==(s=this.processor)?void 0:s.frustumVisibilitySuspended)&&t,i}async fetchPopupFeatures(e,r){return i(r)?r.clientGraphics:null}getGraphicFromGraphicUid(e){return this.processor.getGraphicFromGraphicUid(e)}whenGraphicBounds(e,r){return this.processor.whenGraphicBounds(e,r)}computeAttachmentOrigin(e,r){var t;return null==(t=this.processor)?void 0:t.computeAttachmentOrigin(e,r)}getSymbolLayerSize(e,r){return this.processor.getSymbolLayerSize(e,r)}async queryGraphics(){return new r(this.loadedGraphics.toArray())}maskOccludee(e){return this.processor.maskOccludee(e)}highlight(e){return this.processor.highlight(e)}get updatePolicy(){var e;return(null==(e=this.processor)?void 0:e.graphicsCore.effectiveUpdatePolicy)||h.SYNC}canResume(){var e;return super.canResume()&&!(null!=(e=this.processor)&&e.scaleVisibilitySuspended)}isUpdating(){var e,r,t;return!(!(null!=(e=this.processor)&&e.updating||null==(r=this.view)||null==(t=r.basemapTerrain))&&t.ready)}get performanceInfo(){var e,r,t;return{displayedNumberOfFeatures:this.loadedGraphics.length,maximumNumberOfFeatures:-1,totalNumberOfFeatures:-1,nodes:0,core:null,updating:this.updating,elevationUpdating:null!=(e=null==(r=this.processor)?void 0:r.elevationAlignment.updating)&&e,visibilityFrustum:!(null!=(t=this.processor)&&t.frustumVisibilitySuspended)}}};e([n()],y.prototype,"_routeItems",null),e([n()],y.prototype,"loadedGraphics",void 0),e([n({readOnly:!0})],y.prototype,"legendEnabled",null),e([n()],y.prototype,"layer",void 0),e([n({readOnly:!0})],y.prototype,"processor",void 0),e([n({type:Boolean})],y.prototype,"slicePlaneEnabled",void 0),y=e([a("esri.views.3d.layers.RouteLayerView3D")],y);const g=y;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.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import{binaryIndexOf as r}from"../../../core/arrayUtils.js";import i from"../../../core/Logger.js";import{destroyMaybe as s,isNone as o,isSome as a,unwrap as n}from"../../../core/maybe.js";import{initial as d,watch as l}from"../../../core/reactiveUtils.js";import{property as u}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{a as c}from"../../../chunks/vec3.js";import{f as p,c as g}from"../../../chunks/vec3f64.js";import{projectBuffer as m,projectVectorToVector as f,projectBoundingRect as y}from"../../../geometry/projection.js";import{create as _}from"../../../geometry/support/aaBoundingRect.js";import{extentContainsCoords3D as b}from"../../../geometry/support/contains.js";import{getGeometryZScaler as v}from"../../../geometry/support/zscale.js";import{makeDehydratedPoint as E,estimateSize as x}from"../../../layers/graphics/dehydratedFeatures.js";import{hydrateGraphic as I}from"../../../layers/graphics/hydratedFeatures.js";import S from"../../../layers/graphics/controllers/I3SOnDemandController.js";import w from"../../../layers/support/FeatureFilter.js";import D from"../../../rest/support/Query.js";import{I3SPointsWorkerHandle as O}from"./I3SPointsWorkerHandle.js";import{DrapeSourceType as F}from"./interfaces.js";import{LayerView3D as j}from"./LayerView3D.js";import A from"./graphics/Graphics3DFeatureProcessor.js";import{QueryEngine as C}from"./graphics/QueryEngine.js";import{createInteractiveEditSession as N,processAttributeEdits as T}from"./i3s/attributeEditing.js";import{I3SAttributeOverrides as V}from"./i3s/I3SAttributeOverrides.js";import{checkSpatialReferences as G,containsDraco as M,whenGraphicAttributes as P,getCachedAttributeValue as R}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as L}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as H}from"./support/fieldProperties.js";import{PopupSceneLayerView as q}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as U}from"./support/SceneLayerViewRequiredFields.js";import Q from"../support/debugFlags.js";import{GraphicsMap as k}from"../support/GraphicsMap.js";import{compute as B}from"../support/orientedBoundingBox.js";import{updatingProgress as z}from"../support/updatingProperties.js";import{UpdatePolicy as W}from"../webgl-engine/lib/basicInterfaces.js";import K from"../../layers/SceneLayerView.js";import{TaskPriority as Z}from"../../support/Scheduler.js";const Y=i.getLogger("esri.views.3d.layers.SceneLayerGraphicsView3D"),J=H();let $=class extends(L(q(j(K)))){constructor(){super(...arguments),this.type="scene-layer-graphics-3d",this._nodesAddedToStage=new Map,this.drapeSourceType=F.Features,this._queryEngine=null,this._memCache=null,this._interactiveEditingSessions=new Map,this.loadedGraphics=new k,this.holeFilling="always",this.progressiveLoadFactor=1,this.supportsHeightUnitConversion=!0,this._coordinatesOutsideExtentErrors=0,this._maxCoordinatesOutsideExtentErrors=20}initialize(){var e,t;const r=this.layer;this.addResolvingPromise(r.indexInfo),this._attributeOverrides=new V(this.layer,null==(e=this.view.resourceController)?void 0:e.memoryController),G(r,this.view.spatialReference,this.view.viewingMode),this.fieldsHelper=new U({layerView:this}),this.updatingHandles.add((()=>r.rangeInfos),(e=>this._rangeInfosChanged(e)),d),this.updatingHandles.add((()=>r.renderer),((e,t)=>this._rendererChange(e,t))),this.updatingHandles.add((()=>[this.parsedDefinitionExpression,this.excludeObjectIdsSorted]),(()=>this._filterChange())),this.updatingHandles.add((()=>this.view.floors),(()=>this.processor.filterVisibility.filterChanged())),this.handles.add(l((()=>Q.I3S_TREE_SHOW_TILES),(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&Q.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||!this._treeDebugger||Q.I3S_TREE_SHOW_TILES||(this._treeDebugger.destroy(),this._treeDebugger=null)}),d)),this._set("processor",new A({owner:this,preferredUpdatePolicy:W.ASYNC,scaleVisibilityEnabled:!0,filterVisibilityEnabled:!0,timeExtentVisibilityEnabled:!1,frustumVisibilityEnabled:!1,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!1,dataExtent:r.fullExtent,updateClippingExtent:e=>this._updateClippingExtent(e)})),null==(t=this.processor.elevationAlignment)||t.events.on("invalidate-elevation",(e=>this._invalidateElevation(e))),this.supportsHeightUnitConversion&&(this._verticalScale=v("point",r.spatialReference,this.view.spatialReference)),this.addResolvingPromise(this.processor.setup()),this._memCache=this.view.resourceController.memoryController.newCache(r.uid),this._controller=new S({layerView:this,scaleVisibilityEnabled:!1}),M(this.layer.geometryDefinitions)&&(this._worker=new O((e=>this.view.resourceController.schedule(e)))),this.handles.add(this.layer.on("apply-edits",(e=>this.updatingHandles.addPromise(e.result)))),this.handles.add(this.layer.on("edits",(e=>this._handleEdits(e)))),this.when((()=>{this._queryEngine=new C({layerView:this,priority:Z.FEATURE_QUERY_ENGINE}),this.updatingHandles.add((()=>this.maximumNumberOfFeatures),(e=>this._controller.featureTarget=e),d),this.updatingHandles.add((()=>this.suspended),(e=>{e&&this._removeAllNodeData()}))}))}destroy(){this._treeDebugger=s(this._treeDebugger),this._attributeOverrides=s(this._attributeOverrides),this._set("processor",s(this.processor)),this._controller=s(this._controller),this._queryEngine=s(this._queryEngine),this._worker=s(this._worker),this._memCache=s(this._memCache),this._nodesAddedToStage.clear(),this.fieldsHelper=s(this.fieldsHelper)}get requiredFields(){var e,t;return null!=(e=null==(t=this.fieldsHelper)?void 0:t.requiredFields)?e:[]}get maximumNumberOfFeatures(){var e,t,r;const i=null==(e=this.processor)||null==(t=e.graphicsCore)?void 0:t.displayFeatureLimit;return null!=(r=null==i?void 0:i.maximumNumberOfFeatures)?r:0}set maximumNumberOfFeatures(e){null!=e?(this._override("maximumNumberOfFeatures",e),this._controller.fixedFeatureTarget=!0):(this._clearOverride("maximumNumberOfFeatures"),this._controller.fixedFeatureTarget=!1)}get maximumNumberOfFeaturesExceeded(){var e;return!this.suspended&&!(null==(e=this._controller)||!e.useMaximumNumberOfFeatures||this._controller.leavesReached)}get excludeObjectIdsSorted(){const e=this.layer.excludeObjectIds;return e.length?e.toArray().sort(((e,t)=>e-t)):null}get hasM(){return!1}get hasZ(){return!0}async whenGraphicAttributes(e,t){return P(this.layer,e,this._getObjectIdField(),t,(()=>[...this._nodesAddedToStage.values()]))}getGraphicFromGraphicUid(e){if(!this.loadedGraphics)return null;const t=I(this.loadedGraphics.find((t=>t.uid===e)),this.layer),r=this._getObjectIdField();return t&&t.attributes&&t.attributes[r]?(t.layer=this.layer,t.sourceLayer=this.layer,t):null}whenGraphicBounds(e,t){return this.processor.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.processor.computeAttachmentOrigin(e,t)}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}isUpdating(){var e,t,r;return!!(null!=(e=this._controller)&&e.updating||null!=(t=this.processor)&&t.updating||null!=(r=this.fieldsHelper)&&r.updating)}highlight(e){return this.processor.highlight(e,this.layer.objectIdField)}get updatePolicy(){return this.processor.graphicsCore.effectiveUpdatePolicy}createInteractiveEditSession(e){return N(this.attributeEditingContext,e)}async _extractBinaryPointData(e,t){const r={geometryBuffer:e.geometryBuffer};return o(this._worker)&&(this._worker=new O((e=>this.view.resourceController.schedule(e)))),this._worker.invoke(r,t).then((e=>{if(a(e)){return{positionData:e.positions,featureIds:e.featureIds}}throw new Error("Failed to decompress Draco point data")}))}_checkExtent(e,t){e&&!b(e,t)&&(this._coordinatesOutsideExtentErrors<this._maxCoordinatesOutsideExtentErrors&&Y.error("Service Error: Coordinates outside of layer extent"),this._coordinatesOutsideExtentErrors+1===this._maxCoordinatesOutsideExtentErrors&&Y.error("Maximum number of errors reached. Further errors are ignored."),this._coordinatesOutsideExtentErrors++)}async addNode(e,t,r){if(!te(t)&&!ee(t))return Promise.reject();if(this._nodesAddedToStage.has(e.index))return void Y.error("I3S node "+e.id+" already added");const i=a(this.layer.fullExtent)?ie(this.layer.fullExtent.clone(),.5):null,s=this._controller.crsVertex,o=[],n={graphics:null,featureIds:null,attributeInfo:t.attributeDataInfo,node:e};if(te(t)?await this._addNodeBinaryPointData(e,n,t,i,o,r):ee(t)&&this._addNodeLegacyPointData(e,n,t,i,o),await this._attributeOverrides.apply(n.featureIds,t.attributeDataInfo,r),e.numFeatures=n.graphics.length,this._updateNodeMemory(e),re(n),o.length>0&&(this._computeObb(e,o,s),this._controller.updateVisibility(e.index)),!this._controller.isGeometryVisible(e))return this._cacheNodeData(n),Promise.resolve();if(a(this._verticalScale))for(const a of n.graphics)this._verticalScale(a.geometry);return this._nodesAddedToStage.set(e.index,n),this.loadedGraphics.addMany(n.graphics),this._filterNode(n),this._treeDebugger&&this._treeDebugger.update(),Promise.resolve()}_computeObb(e,t,r){const i=this._controller.crsIndex,s=i.isGeographic?this.view.renderSpatialReference:i;m(t,r,0,t,s,0,t.length/3);const o={data:t,size:3};e.serviceObb=B(o),i.isGeographic&&f(e.serviceObb.center,s,e.serviceObb.center,i)}isNodeLoaded(e){return this._nodesAddedToStage.has(e)}isNodeReloading(){return!1}updateNodeState(){}async _addNodeBinaryPointData(e,r,i,s,o,d){const l=await this._extractBinaryPointData(i,d);if(null==l)return Promise.reject();const u=this._getObjectIdField(),h=this._controller.crsVertex,g=this.view.spatialReference,f=this.processor.graphicsCore,{positionData:y,featureIds:_}=l,b=3,v=y.length/b,x=new Array;for(let I=0;I<v;I++){const r=a(e.serviceObb)?e.serviceObb.center:[0,0,0],i=I*b,d=p(y[i+0],y[i+1],y[i+2]);c(d,d,r),e.serviceObb||o.push(d[0],d[1],d[2]),a(s)&&this._checkExtent(s,d);const l=_[I],v={};null!=l&&(v[u]=l);const S=null==l?t.generateUID():l;m(d,h,0,oe,g,0,1);const w=E(oe[0],oe[1],oe[2],g),D=this.loadedGraphics.get(S);if(a(D))D.level<e.level&&(ae.property="geometry",ae.graphic=D,ae.oldValue=n(D.geometry),ae.newValue=w,D.geometry=w,f.graphicUpdateHandler(ae)),x.push(D);else{const r=t.generateUID();x.push({objectId:S,uid:r,geometry:w,attributes:v,visible:!0,level:e.level})}}r.graphics=x,r.featureIds=Array.from(_)}_addNodeLegacyPointData(e,r,i,s,o){const n=this._getObjectIdField(),d=this._controller.crsVertex,l=this.view.spatialReference,u=[0,0,0],h=new Array,c=new Array;for(const p of i.pointData){const r=p.featureDataPosition,i=r.length,g=p.geometries&&p.geometries[0]||se[i],f=p.featureIds[0];if("points"!==g.params.type)continue;a(s)&&this._checkExtent(s,r);const y={};null!=f&&(y[n]=f);const _=null==f?t.generateUID():f;let b;"Embedded"===g.type&&(b=g.params.vertexAttributes.position);for(let s=0;s<b.length;s+=i){for(let e=0;e<i;e++)u[e]=r[e]+b[s+e];const n=3===i;e.serviceObb||o.push(u[0],u[1],n?u[2]:0),m(u,d,0,oe,l,0,1);const h=E(oe[0],oe[1],n?oe[2]:void 0,l),p=this.loadedGraphics.get(_);a(p)?c.push(p):c.push({objectId:_,uid:t.generateUID(),geometry:h,attributes:y,visible:!0})}h.push(f)}r.graphics=c,r.featureIds=h}_updateNodeMemory(e){e.memory=4096+(a(e.numFeatures)?e.numFeatures*this.processor.graphicsCore.usedMemoryPerGraphic:0)}_cacheNodeData(e){const t=e.graphics.reduce(((e,t)=>x(t)+e),512+8*e.featureIds.length+1024);this._memCache.put(this._getMemCacheKey(e.node),e,t)}_getMemCacheKey(e){return`${e.index}`}_removeAllNodeData(){this._nodesAddedToStage.forEach((e=>{if(e){const t=e.node;this._updateNodeMemory(t),this._cacheNodeData(e)}})),this._nodesAddedToStage.clear(),this._treeDebugger&&this._treeDebugger.update(),this.loadedGraphics.clear()}removeNode(e){const t=this._removeNodeStageData(e);t&&(this._updateNodeMemory(t.node),this._cacheNodeData(t))}_removeNodeStageData(e){const t=this._nodesAddedToStage.get(e);return t?(this.loadedGraphics.removeMany(t.graphics),this._nodesAddedToStage.delete(e),this._treeDebugger&&this._treeDebugger.update(),t):null}async loadCachedNodeData(e){return this._memCache.pop(this._getMemCacheKey(e))}async addCachedNodeData(e,t,r,i){if(!this._nodesAddedToStage.has(e.index))return this.loadedGraphics.addMany(t.graphics),this._nodesAddedToStage.set(e.index,t),this._updateNodeMemory(e),await this.updateAttributes(e.index,r,i),this._filterNode(t),this._treeDebugger&&this._treeDebugger.update(),Promise.resolve();Y.error("I3S node "+e.id+" already added")}getLoadedNodeIds(){const e=[];return this._nodesAddedToStage.forEach((t=>e.push(t.node.id))),e.sort()}getVisibleNodes(){const e=new Array;return this._nodesAddedToStage.forEach((t=>e.push(t.node))),e}getLoadedNodeIndices(e){this._nodesAddedToStage.forEach(((t,r)=>e.push(r)))}getLoadedAttributes(e){const t=this._nodesAddedToStage.get(e);if(t&&a(t.attributeInfo))return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodesAddedToStage.get(e);if(t&&a(t.attributeInfo))return t.attributeInfo.attributeData}_setAttributeData(e,t){const r=this._nodesAddedToStage.get(e);r&&!o(r.attributeInfo)&&(r.attributeInfo.attributeData=t,this._attributeValuesChanged(r))}async updateAttributes(e,t,r){const i=this._nodesAddedToStage.get(e);i&&(await this._attributeOverrides.apply(i.featureIds,t,r),i.attributeInfo=t,this._attributeValuesChanged(i))}_attributeValuesChanged(e){if(re(e),this._filterNode(e),this.processor.graphicsCore.labelsEnabled){const t=e.graphics.map((e=>e.uid));this.processor.graphicsCore.updateLabelingInfo(t)}}_updateClippingExtent(e){return this._controller&&this._controller.updateClippingArea(e),!1}_getObjectIdField(){return this.layer.objectIdField||"OBJECTID"}async _rendererChange(e,t){const{layer:{fieldsIndex:r}}=this,i=new Set;let s,o;e?(await e.collectRequiredFields(i,r),s=Array.from(i).sort()):s=[],i.clear(),t?(await t.collectRequiredFields(i,r),o=Array.from(i).sort()):o=[],s.length===o.length&&s.every(((e,t)=>s[t]===o[t]))||this._reloadAllNodes()}_rangeInfosChanged(e){null!=e&&e.length>0&&Y.warn("Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.")}_filterChange(){this._nodesAddedToStage.forEach((e=>this._filterNode(e)))}_reloadAllNodes(){this._removeAllNodeData(),this._controller&&this._controller.restartNodeLoading()}_filterNode(e){const t=this.parsedDefinitionExpression,i=this.excludeObjectIdsSorted,s=this._getObjectIdField();for(const a of e.graphics){const e=a.visible,n=!t||this._evaluateClause(t,a),d=o(i)||r(i,a.attributes[s])<0;a.visible=n&&d,e!==a.visible&&(ae.graphic=a,ae.property="visible",ae.oldValue=e,ae.newValue=a.visible,this.processor.graphicsCore.graphicUpdateHandler(ae))}}_invalidateElevation(e){const t=this._controller.crsIndex;y(e.extent,e.spatialReference,ne,t),this._controller.updateElevationChanged(ne,t)}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return a(this.filter)?this.filter.createQuery(e):new D(e)}queryFeatures(e,t){return this._queryEngine.executeQuery(this._ensureQuery(e),null==t?void 0:t.signal)}queryObjectIds(e,t){return this._queryEngine.executeQueryForIds(this._ensureQuery(e),null==t?void 0:t.signal)}queryFeatureCount(e,t){return this._queryEngine.executeQueryForCount(this._ensureQuery(e),null==t?void 0:t.signal)}queryExtent(e,t){return this._queryEngine.executeQueryForExtent(this._ensureQuery(e),null==t?void 0:t.signal)}_ensureQuery(e){return this._addDefinitionExpressionToQuery(o(e)?this.createQuery():D.from(e))}getUsedMemory(){var e,t,r;return null!=(e=null==(t=this.processor)||null==(r=t.graphicsCore)?void 0:r.usedMemory)?e:0}getUnloadedMemory(){var e,t,r,i,s;return.8*((null!=(e=null==(t=this._controller)?void 0:t.unloadedMemoryEstimate)?e:0)+(null!=(r=null==(i=this.processor)||null==(s=i.graphicsCore)?void 0:s.unprocessedMemoryEstimate)?r:0))}ignoresMemoryFactor(){return this._controller&&this._controller.fixedFeatureTarget}_handleEdits(e){T(this.attributeEditingContext,e)}get attributeEditingContext(){const e=this._getObjectIdField();return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:e,forEachNode:e=>this._nodesAddedToStage.forEach((t=>e(t.node,t.featureIds))),attributeStorageInfo:this.i3slayer.attributeStorageInfo,attributeOverrides:this._attributeOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(t,r,i)=>{this._setAttributeData(t,r);const s=this._nodesAddedToStage.get(t);if(a(i)){const t=this.loadedGraphics.get(i.attributes[e]);a(t)&&this.processor.graphicsCore.recreateGraphics([t])}else a(s)&&this.processor.graphicsCore.recreateGraphics(s.graphics)},clearMemCache:()=>{}}}get performanceInfo(){const e={displayedNumberOfFeatures:this.loadedGraphics.length,maximumNumberOfFeatures:this.maximumNumberOfFeatures,totalNumberOfFeatures:-1,nodes:this._nodesAddedToStage.size,core:this.processor.graphicsCore.performanceInfo};return this._controller&&this._controller.updateStats(e),e}get test(){return{controller:this._controller,numNodes:this._nodesAddedToStage.size,numFeatures:this.loadedGraphics.length}}};e([u()],$.prototype,"processor",void 0),e([u({type:w})],$.prototype,"filter",void 0),e([u()],$.prototype,"loadedGraphics",void 0),e([u({aliasOf:"layer"})],$.prototype,"i3slayer",void 0),e([u()],$.prototype,"_controller",void 0),e([u()],$.prototype,"updating",void 0),e([u()],$.prototype,"suspended",void 0),e([u()],$.prototype,"holeFilling",void 0),e([u(z)],$.prototype,"updatingProgress",void 0),e([u({aliasOf:"_controller.updatingProgress"})],$.prototype,"updatingProgressValue",void 0),e([u(J.requiredFields)],$.prototype,"requiredFields",null),e([u(J.availableFields)],$.prototype,"availableFields",void 0),e([u()],$.prototype,"fieldsHelper",void 0),e([u({type:Number})],$.prototype,"maximumNumberOfFeatures",null),e([u({readOnly:!0})],$.prototype,"maximumNumberOfFeaturesExceeded",null),e([u()],$.prototype,"excludeObjectIdsSorted",null),e([u({readOnly:!0,aliasOf:"view.qualitySettings.sceneService.point.lodFactor"})],$.prototype,"lodFactor",void 0),e([u({readOnly:!0})],$.prototype,"hasM",null),e([u({readOnly:!0})],$.prototype,"hasZ",null),$=e([h("esri.views.3d.layers.SceneLayerGraphicsView3D")],$);const X=$;function ee(e){return"pointData"in e}function te(e){return"geometryBuffer"in e&&null!==e.geometryBuffer}function re(e){const t=e.attributeInfo;for(let r=0;r<e.graphics.length;r++){const i=e.graphics[r];if(i.attributes||(i.attributes={}),a(t)&&a(t.loadedAttributes))for(const{name:e}of t.loadedAttributes)t.attributeData[e]&&(i.attributes[e]=R(t.attributeData[e],r))}}function ie(e,t){return e.xmin-=t,e.ymin-=t,e.xmax+=t,e.ymax+=t,e.hasZ&&(e.zmin-=t,e.zmax+=t),e.hasM&&(e.mmin-=t,e.mmax+=t),e}const se={2:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0]}}},3:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0,0]}}}},oe=g(),ae={graphic:null,property:null,oldValue:null,newValue:null},ne=_();export{X as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import{binaryIndexOf as r}from"../../../core/arrayUtils.js";import i from"../../../core/Logger.js";import{destroyMaybe as s,isNone as o,isSome as a,unwrap as n}from"../../../core/maybe.js";import{initial as d,watch as l}from"../../../core/reactiveUtils.js";import{property as u}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{a as c}from"../../../chunks/vec3.js";import{f as p,c as g}from"../../../chunks/vec3f64.js";import{projectBuffer as m,projectVectorToVector as f,projectBoundingRect as y}from"../../../geometry/projection.js";import{create as _}from"../../../geometry/support/aaBoundingRect.js";import{extentContainsCoords3D as b}from"../../../geometry/support/contains.js";import{getGeometryZScaler as v}from"../../../geometry/support/zscale.js";import{makeDehydratedPoint as E,estimateSize as x}from"../../../layers/graphics/dehydratedFeatures.js";import{hydrateGraphic as I}from"../../../layers/graphics/hydratedFeatures.js";import w from"../../../layers/graphics/controllers/I3SOnDemandController.js";import S from"../../../layers/support/FeatureFilter.js";import D from"../../../rest/support/Query.js";import{I3SPointsWorkerHandle as O}from"./I3SPointsWorkerHandle.js";import{DrapeSourceType as F}from"./interfaces.js";import{LayerView3D as A}from"./LayerView3D.js";import C from"./graphics/Graphics3DFeatureProcessor.js";import{QueryEngine as j}from"./graphics/QueryEngine.js";import{createInteractiveEditSession as N,processAttributeEdits as T}from"./i3s/attributeEditing.js";import{I3SAttributeOverrides as V}from"./i3s/I3SAttributeOverrides.js";import{checkSpatialReferences as G,containsDraco as M,whenGraphicAttributes as R,getCachedAttributeValue as L}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as P}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as H}from"./support/fieldProperties.js";import{PopupSceneLayerView as q}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as U}from"./support/SceneLayerViewRequiredFields.js";import Q from"../support/debugFlags.js";import{GraphicsMap as k}from"../support/GraphicsMap.js";import{compute as B}from"../support/orientedBoundingBox.js";import{updatingProgress as z}from"../support/updatingProperties.js";import{UpdatePolicy as W}from"../webgl-engine/lib/basicInterfaces.js";import K from"../../layers/SceneLayerView.js";import{TaskPriority as Z}from"../../support/Scheduler.js";const Y=i.getLogger("esri.views.3d.layers.SceneLayerGraphicsView3D"),J=H();let $=class extends(P(q(A(K)))){constructor(){super(...arguments),this.type="scene-layer-graphics-3d",this._nodesAddedToStage=new Map,this.drapeSourceType=F.Features,this._queryEngine=null,this._memCache=null,this._interactiveEditingSessions=new Map,this.loadedGraphics=new k,this.holeFilling="always",this.progressiveLoadFactor=1,this.supportsHeightUnitConversion=!0,this._coordinatesOutsideExtentErrors=0,this._maxCoordinatesOutsideExtentErrors=20}initialize(){var e,t;const r=this.layer;this.addResolvingPromise(r.indexInfo),this._attributeOverrides=new V(this.layer,null==(e=this.view.resourceController)?void 0:e.memoryController),G(r,this.view.spatialReference,this.view.viewingMode),this.fieldsHelper=new U({layerView:this}),this.updatingHandles.add((()=>r.rangeInfos),(e=>this._rangeInfosChanged(e)),d),this.updatingHandles.add((()=>r.renderer),((e,t)=>this._rendererChange(e,t))),this.updatingHandles.add((()=>[this.parsedDefinitionExpression,this.excludeObjectIdsSorted]),(()=>this._filterChange())),this.updatingHandles.add((()=>this.view.floors),(()=>this.processor.filterVisibility.filterChanged())),this.handles.add(l((()=>Q.I3S_TREE_SHOW_TILES),(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&Q.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||!this._treeDebugger||Q.I3S_TREE_SHOW_TILES||(this._treeDebugger.destroy(),this._treeDebugger=null)}),d)),this._set("processor",new C({owner:this,preferredUpdatePolicy:W.ASYNC,scaleVisibilityEnabled:!0,filterVisibilityEnabled:!0,timeExtentVisibilityEnabled:!1,frustumVisibilityEnabled:!1,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!1,dataExtent:r.fullExtent,updateClippingExtent:e=>this._updateClippingExtent(e)})),null==(t=this.processor.elevationAlignment)||t.events.on("invalidate-elevation",(e=>this._invalidateElevation(e))),this.supportsHeightUnitConversion&&(this._verticalScale=v("point",r.spatialReference,this.view.spatialReference)),this.addResolvingPromise(this.processor.setup()),this._memCache=this.view.resourceController.memoryController.newCache(r.uid),this._controller=new w({layerView:this,scaleVisibilityEnabled:!1}),M(this.layer.geometryDefinitions)&&(this._worker=new O((e=>this.view.resourceController.schedule(e)))),this.handles.add(this.layer.on("apply-edits",(e=>this.updatingHandles.addPromise(e.result)))),this.handles.add(this.layer.on("edits",(e=>this._handleEdits(e)))),this.when((()=>{this._queryEngine=new j({layerView:this,priority:Z.FEATURE_QUERY_ENGINE}),this.updatingHandles.add((()=>this.maximumNumberOfFeatures),(e=>this._controller.featureTarget=e),d),this.updatingHandles.add((()=>this.suspended),(e=>{e&&this._removeAllNodeData()}))}))}destroy(){this._treeDebugger=s(this._treeDebugger),this._attributeOverrides=s(this._attributeOverrides),this._set("processor",s(this.processor)),this._controller=s(this._controller),this._queryEngine=s(this._queryEngine),this._worker=s(this._worker),this._memCache=s(this._memCache),this._nodesAddedToStage.clear(),this.fieldsHelper=s(this.fieldsHelper)}get requiredFields(){var e,t;return null!=(e=null==(t=this.fieldsHelper)?void 0:t.requiredFields)?e:[]}get maximumNumberOfFeatures(){var e,t,r;const i=null==(e=this.processor)||null==(t=e.graphicsCore)?void 0:t.displayFeatureLimit;return null!=(r=null==i?void 0:i.maximumNumberOfFeatures)?r:0}set maximumNumberOfFeatures(e){null!=e?(this._override("maximumNumberOfFeatures",e),this._controller.fixedFeatureTarget=!0):(this._clearOverride("maximumNumberOfFeatures"),this._controller.fixedFeatureTarget=!1)}get maximumNumberOfFeaturesExceeded(){var e;return!this.suspended&&!(null==(e=this._controller)||!e.useMaximumNumberOfFeatures||this._controller.leavesReached)}get excludeObjectIdsSorted(){const e=this.layer.excludeObjectIds;return e.length?e.toArray().sort(((e,t)=>e-t)):null}get hasM(){return!1}get hasZ(){return!0}async whenGraphicAttributes(e,t){return R(this.layer,e,this._getObjectIdField(),t,(()=>[...this._nodesAddedToStage.values()]))}getGraphicFromGraphicUid(e){if(!this.loadedGraphics)return null;const t=I(this.loadedGraphics.find((t=>t.uid===e)),this.layer),r=this._getObjectIdField();return t&&t.attributes&&t.attributes[r]?(t.layer=this.layer,t.sourceLayer=this.layer,t):null}whenGraphicBounds(e,t){return this.processor.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.processor.computeAttachmentOrigin(e,t)}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}isUpdating(){var e,t,r;return!!(null!=(e=this._controller)&&e.updating||null!=(t=this.processor)&&t.updating||null!=(r=this.fieldsHelper)&&r.updating)}highlight(e){return this.processor.highlight(e,this.layer.objectIdField)}get updatePolicy(){return this.processor.graphicsCore.effectiveUpdatePolicy}createInteractiveEditSession(e){return N(this.attributeEditingContext,e)}async _extractBinaryPointData(e,t){const r={geometryBuffer:e.geometryBuffer};return o(this._worker)&&(this._worker=new O((e=>this.view.resourceController.schedule(e)))),this._worker.invoke(r,t).then((e=>{if(a(e)){return{positionData:e.positions,featureIds:e.featureIds}}throw new Error("Failed to decompress Draco point data")}))}_checkExtent(e,t){e&&!b(e,t)&&(this._coordinatesOutsideExtentErrors<this._maxCoordinatesOutsideExtentErrors&&Y.error("Service Error: Coordinates outside of layer extent"),this._coordinatesOutsideExtentErrors+1===this._maxCoordinatesOutsideExtentErrors&&Y.error("Maximum number of errors reached. Further errors are ignored."),this._coordinatesOutsideExtentErrors++)}async addNode(e,t,r){if(!te(t)&&!ee(t))throw new Error;if(this._nodesAddedToStage.has(e.index))return void Y.error("I3S node "+e.id+" already added");const i=a(this.layer.fullExtent)?ie(this.layer.fullExtent.clone(),.5):null,s=this._controller.crsVertex,o=[],n={graphics:null,featureIds:null,attributeInfo:t.attributeDataInfo,node:e};if(te(t)?await this._addNodeBinaryPointData(e,n,t,i,o,r):ee(t)&&this._addNodeLegacyPointData(e,n,t,i,o),await this._attributeOverrides.apply(n.featureIds,t.attributeDataInfo,r),e.numFeatures=n.graphics.length,this._updateNodeMemory(e),re(n),o.length>0&&(this._computeObb(e,o,s),this._controller.updateVisibility(e.index)),this._controller.isGeometryVisible(e)){if(a(this._verticalScale))for(const e of n.graphics)this._verticalScale(e.geometry);this._nodesAddedToStage.set(e.index,n),this.loadedGraphics.addMany(n.graphics),this._filterNode(n),this._treeDebugger&&this._treeDebugger.update()}else this._cacheNodeData(n)}_computeObb(e,t,r){const i=this._controller.crsIndex,s=i.isGeographic?this.view.renderSpatialReference:i;m(t,r,0,t,s,0,t.length/3);const o={data:t,size:3};e.serviceObb=B(o),i.isGeographic&&f(e.serviceObb.center,s,e.serviceObb.center,i)}isNodeLoaded(e){return this._nodesAddedToStage.has(e)}isNodeReloading(){return!1}updateNodeState(){}async _addNodeBinaryPointData(e,r,i,s,o,d){const l=await this._extractBinaryPointData(i,d);if(null==l)throw new Error;const u=this._getObjectIdField(),h=this._controller.crsVertex,g=this.view.spatialReference,f=this.processor.graphicsCore,{positionData:y,featureIds:_}=l,b=3,v=y.length/b,x=new Array;for(let I=0;I<v;I++){const r=a(e.serviceObb)?e.serviceObb.center:[0,0,0],i=I*b,d=p(y[i+0],y[i+1],y[i+2]);c(d,d,r),e.serviceObb||o.push(d[0],d[1],d[2]),a(s)&&this._checkExtent(s,d);const l=_[I],v={};null!=l&&(v[u]=l);const w=null==l?t.generateUID():l;m(d,h,0,oe,g,0,1);const S=E(oe[0],oe[1],oe[2],g),D=this.loadedGraphics.get(w);if(a(D))D.level<e.level&&(ae.property="geometry",ae.graphic=D,ae.oldValue=n(D.geometry),ae.newValue=S,D.geometry=S,f.graphicUpdateHandler(ae)),x.push(D);else{const r=t.generateUID();x.push({objectId:w,uid:r,geometry:S,attributes:v,visible:!0,level:e.level})}}r.graphics=x,r.featureIds=Array.from(_)}_addNodeLegacyPointData(e,r,i,s,o){const n=this._getObjectIdField(),d=this._controller.crsVertex,l=this.view.spatialReference,u=[0,0,0],h=new Array,c=new Array;for(const p of i.pointData){const r=p.featureDataPosition,i=r.length,g=p.geometries&&p.geometries[0]||se[i],f=p.featureIds[0];if("points"!==g.params.type)continue;a(s)&&this._checkExtent(s,r);const y={};null!=f&&(y[n]=f);const _=null==f?t.generateUID():f;let b;"Embedded"===g.type&&(b=g.params.vertexAttributes.position);for(let s=0;s<b.length;s+=i){for(let e=0;e<i;e++)u[e]=r[e]+b[s+e];const n=3===i;e.serviceObb||o.push(u[0],u[1],n?u[2]:0),m(u,d,0,oe,l,0,1);const h=E(oe[0],oe[1],n?oe[2]:void 0,l),p=this.loadedGraphics.get(_);a(p)?c.push(p):c.push({objectId:_,uid:t.generateUID(),geometry:h,attributes:y,visible:!0})}h.push(f)}r.graphics=c,r.featureIds=h}_updateNodeMemory(e){e.memory=4096+(a(e.numFeatures)?e.numFeatures*this.processor.graphicsCore.usedMemoryPerGraphic:0)}_cacheNodeData(e){const t=e.graphics.reduce(((e,t)=>x(t)+e),512+8*e.featureIds.length+1024);this._memCache.put(this._getMemCacheKey(e.node),e,t)}_getMemCacheKey(e){return`${e.index}`}_removeAllNodeData(){this._nodesAddedToStage.forEach((e=>{if(e){const t=e.node;this._updateNodeMemory(t),this._cacheNodeData(e)}})),this._nodesAddedToStage.clear(),this._treeDebugger&&this._treeDebugger.update(),this.loadedGraphics.clear()}removeNode(e){const t=this._removeNodeStageData(e);t&&(this._updateNodeMemory(t.node),this._cacheNodeData(t))}_removeNodeStageData(e){const t=this._nodesAddedToStage.get(e);return t?(this.loadedGraphics.removeMany(t.graphics),this._nodesAddedToStage.delete(e),this._treeDebugger&&this._treeDebugger.update(),t):null}async loadCachedNodeData(e){return this._memCache.pop(this._getMemCacheKey(e))}async addCachedNodeData(e,t,r,i){this._nodesAddedToStage.has(e.index)?Y.error("I3S node "+e.id+" already added"):(this.loadedGraphics.addMany(t.graphics),this._nodesAddedToStage.set(e.index,t),this._updateNodeMemory(e),await this.updateAttributes(e.index,r,i),this._filterNode(t),this._treeDebugger&&this._treeDebugger.update())}getLoadedNodeIds(){const e=[];return this._nodesAddedToStage.forEach((t=>e.push(t.node.id))),e.sort()}getVisibleNodes(){const e=new Array;return this._nodesAddedToStage.forEach((t=>e.push(t.node))),e}getLoadedNodeIndices(e){this._nodesAddedToStage.forEach(((t,r)=>e.push(r)))}getLoadedAttributes(e){const t=this._nodesAddedToStage.get(e);if(t&&a(t.attributeInfo))return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodesAddedToStage.get(e);if(t&&a(t.attributeInfo))return t.attributeInfo.attributeData}_setAttributeData(e,t){const r=this._nodesAddedToStage.get(e);r&&!o(r.attributeInfo)&&(r.attributeInfo.attributeData=t,this._attributeValuesChanged(r))}async updateAttributes(e,t,r){const i=this._nodesAddedToStage.get(e);i&&(await this._attributeOverrides.apply(i.featureIds,t,r),i.attributeInfo=t,this._attributeValuesChanged(i))}_attributeValuesChanged(e){if(re(e),this._filterNode(e),this.processor.graphicsCore.labelsEnabled){const t=e.graphics.map((e=>e.uid));this.processor.graphicsCore.updateLabelingInfo(t)}}_updateClippingExtent(e){return this._controller&&this._controller.updateClippingArea(e),!1}_getObjectIdField(){return this.layer.objectIdField||"OBJECTID"}async _rendererChange(e,t){const{layer:{fieldsIndex:r}}=this,i=new Set;let s,o;e?(await e.collectRequiredFields(i,r),s=Array.from(i).sort()):s=[],i.clear(),t?(await t.collectRequiredFields(i,r),o=Array.from(i).sort()):o=[],s.length===o.length&&s.every(((e,t)=>s[t]===o[t]))||this._reloadAllNodes()}_rangeInfosChanged(e){null!=e&&e.length>0&&Y.warn("Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.")}_filterChange(){this._nodesAddedToStage.forEach((e=>this._filterNode(e)))}_reloadAllNodes(){this._removeAllNodeData(),this._controller&&this._controller.restartNodeLoading()}_filterNode(e){const t=this.parsedDefinitionExpression,i=this.excludeObjectIdsSorted,s=this._getObjectIdField();for(const a of e.graphics){const e=a.visible,n=!t||this._evaluateClause(t,a),d=o(i)||r(i,a.attributes[s])<0;a.visible=n&&d,e!==a.visible&&(ae.graphic=a,ae.property="visible",ae.oldValue=e,ae.newValue=a.visible,this.processor.graphicsCore.graphicUpdateHandler(ae))}}_invalidateElevation(e){const t=this._controller.crsIndex;y(e.extent,e.spatialReference,ne,t),this._controller.updateElevationChanged(ne,t)}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return a(this.filter)?this.filter.createQuery(e):new D(e)}queryFeatures(e,t){return this._queryEngine.executeQuery(this._ensureQuery(e),null==t?void 0:t.signal)}queryObjectIds(e,t){return this._queryEngine.executeQueryForIds(this._ensureQuery(e),null==t?void 0:t.signal)}queryFeatureCount(e,t){return this._queryEngine.executeQueryForCount(this._ensureQuery(e),null==t?void 0:t.signal)}queryExtent(e,t){return this._queryEngine.executeQueryForExtent(this._ensureQuery(e),null==t?void 0:t.signal)}_ensureQuery(e){return this._addDefinitionExpressionToQuery(o(e)?this.createQuery():D.from(e))}getUsedMemory(){var e,t,r;return null!=(e=null==(t=this.processor)||null==(r=t.graphicsCore)?void 0:r.usedMemory)?e:0}getUnloadedMemory(){var e,t,r,i,s;return.8*((null!=(e=null==(t=this._controller)?void 0:t.unloadedMemoryEstimate)?e:0)+(null!=(r=null==(i=this.processor)||null==(s=i.graphicsCore)?void 0:s.unprocessedMemoryEstimate)?r:0))}ignoresMemoryFactor(){return this._controller&&this._controller.fixedFeatureTarget}_handleEdits(e){T(this.attributeEditingContext,e)}get attributeEditingContext(){const e=this._getObjectIdField();return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:e,forEachNode:e=>this._nodesAddedToStage.forEach((t=>e(t.node,t.featureIds))),attributeStorageInfo:this.i3slayer.attributeStorageInfo,attributeOverrides:this._attributeOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(t,r,i)=>{this._setAttributeData(t,r);const s=this._nodesAddedToStage.get(t);if(a(i)){const t=this.loadedGraphics.get(i.attributes[e]);a(t)&&this.processor.graphicsCore.recreateGraphics([t])}else a(s)&&this.processor.graphicsCore.recreateGraphics(s.graphics)},clearMemCache:()=>{}}}get performanceInfo(){const e={displayedNumberOfFeatures:this.loadedGraphics.length,maximumNumberOfFeatures:this.maximumNumberOfFeatures,totalNumberOfFeatures:-1,nodes:this._nodesAddedToStage.size,core:this.processor.graphicsCore.performanceInfo};return this._controller&&this._controller.updateStats(e),e}get test(){return{controller:this._controller,numNodes:this._nodesAddedToStage.size,numFeatures:this.loadedGraphics.length}}};e([u()],$.prototype,"processor",void 0),e([u({type:S})],$.prototype,"filter",void 0),e([u()],$.prototype,"loadedGraphics",void 0),e([u({aliasOf:"layer"})],$.prototype,"i3slayer",void 0),e([u()],$.prototype,"_controller",void 0),e([u()],$.prototype,"updating",void 0),e([u()],$.prototype,"suspended",void 0),e([u()],$.prototype,"holeFilling",void 0),e([u(z)],$.prototype,"updatingProgress",void 0),e([u({aliasOf:"_controller.updatingProgress"})],$.prototype,"updatingProgressValue",void 0),e([u(J.requiredFields)],$.prototype,"requiredFields",null),e([u(J.availableFields)],$.prototype,"availableFields",void 0),e([u()],$.prototype,"fieldsHelper",void 0),e([u({type:Number})],$.prototype,"maximumNumberOfFeatures",null),e([u({readOnly:!0})],$.prototype,"maximumNumberOfFeaturesExceeded",null),e([u()],$.prototype,"excludeObjectIdsSorted",null),e([u({readOnly:!0,aliasOf:"view.qualitySettings.sceneService.point.lodFactor"})],$.prototype,"lodFactor",void 0),e([u({readOnly:!0})],$.prototype,"hasM",null),e([u({readOnly:!0})],$.prototype,"hasZ",null),$=e([h("esri.views.3d.layers.SceneLayerGraphicsView3D")],$);const X=$;function ee(e){return"pointData"in e}function te(e){return"geometryBuffer"in e&&null!==e.geometryBuffer}function re(e){const t=e.attributeInfo;for(let r=0;r<e.graphics.length;r++){const i=e.graphics[r];if(i.attributes||(i.attributes={}),a(t)&&a(t.loadedAttributes))for(const{name:e}of t.loadedAttributes)t.attributeData[e]&&(i.attributes[e]=L(t.attributeData[e],r))}}function ie(e,t){return e.xmin-=t,e.ymin-=t,e.xmax+=t,e.ymax+=t,e.hasZ&&(e.zmin-=t,e.zmax+=t),e.hasM&&(e.mmin-=t,e.mmax+=t),e}const se={2:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0]}}},3:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0,0]}}}},oe=g(),ae={graphic:null,property:null,oldValue:null,newValue:null},ne=_();export{X 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.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{isNone as r,isSome as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{equalsShallow as i}from"../../../core/lang.js";import{isNone as r,isSome as l,disposeMaybe as s,destroyMaybe as o}from"../../../core/maybe.js";import{isAborted as a}from"../../../core/promiseUtils.js";import{whenOnce as n}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{SchemaHelper as p}from"../../2d/engine/vectorTiles/SchemaHelper.js";import m from"../../2d/engine/vectorTiles/TileHandler3D.js";import d from"../../2d/engine/vectorTiles/VTLPainter3D.js";import f from"../../2d/engine/vectorTiles/style/StyleRepository.js";import{LayerView3D as y}from"./LayerView3D.js";import{TiledLayerView3D as u}from"./TiledLayerView3D.js";import{vtlAssumes256PixelSizeAsDefault as g,test as v}from"../terrain/terrainUtils.js";import _ from"../../layers/LayerView.js";let C=class extends(u(y(_))){constructor(){super(...arguments),this.type="vector-tile-3d"}initialize(){if(r(this.layer.fullExtent))return void this.addResolvingPromise(Promise.reject(new t("vectortilelayerview:full-extent-undefined","This layer view's layer does not define a fullExtent.")));const{basemapTerrain:e,spatialReference:s,state:o,viewingMode:h}=this.view,{pixelRatio:c}=o,y="local"===h&&!g(s)||v.force512VTL,u=this.layer.tileInfo.spatialReference.isGeographic,_=y?this.layer.tileInfo:this.layer.tileInfo.getOrCreateCompatible(256,u?1:2),C=this._getTileInfoSupportError(_,this.layer.fullExtent);if(l(C))return this.addResolvingPromise(Promise.reject(C));const H=n((()=>{var e,t;return null==(e=this.view)||null==(t=e.basemapTerrain)?void 0:t.tilingSchemeLocked})).then((()=>{const t=e.tilingScheme,i=t.pixelSize;let r;if(this.schemaHelper=new p(i,e.spatialReference.isGeographic),256===i){const e=this.layer.tileInfo.spatialReference.isGeographic;r=this.layer.tileInfo.getOrCreateCompatible(256,e?1:2)}else r=this.view.spatialReference.isGeographic?this.layer.tileInfo.getOrCreateCompatible(512,.5):this.layer.tileInfo;const l=this._getTileInfoCompatibilityError(r,t);if(l)throw l;this.tileInfo=r}));this._tileHandlerController=new AbortController;const w=this.view.resourceController;this._memCache=w.memoryController.newCache(this.layer.uid,(e=>{e.release()}));const{style:j}=this.layer.currentStyleInfo,R=new f(j),T=e.mapTileRequester;this._tileHandler=new m(this.layer,R,c,this._memCache,T);const I=this._tileHandlerController.signal,b=e=>w.schedule(e),S=this._tileHandler.start({signal:I,schedule:b}),x=this._tileHandler.spriteMosaic;x.then((e=>{!a(I)&&this._tileHandler&&(this.painter=new d(e,this._tileHandler.glyphMosaic))})),S.then((()=>this._tileHandlerController=null)),this.updatingHandles.add((()=>{var e;return{style:this.layer.currentStyleInfo,pixelRatio:null==(e=this.view.state)?void 0:e.pixelRatio}}),(({style:e,pixelRatio:t})=>{this._tileHandlerController&&this._tileHandlerController.abort(),this._tileHandlerController=new AbortController,this._memCache.clear();const i=new f(e),r=new m(this.layer,i,t,this._memCache,T),l=r.start({signal:this._tileHandlerController.signal,schedule:b}),s=r.spriteMosaic;l.then((()=>this._tileHandlerController=null)),this.updatingHandles.addPromise(Promise.all([l,s]).then((([,e])=>{const t=this._tileHandler,i=this.painter;this.painter=new d(e,r.glyphMosaic),this._tileHandler=r,this.emit("data-changed"),t.destroy(),i&&i.dispose()})))}),{equals:i});const L=Promise.all([H,S,x]);this.addResolvingPromise(L)}destroy(){this.painter=s(this.painter),this._tileHandlerController&&(this._tileHandlerController.abort(),this._tileHandlerController=null),o(this._tileHandler),this._memCache=o(this._memCache),this._tileHandler=null}get dataLevelRange(){const e=this.tileInfo.lods,t=e[0].scale,i=e[e.length-1].scale,r=this.levelRangeFromScaleRange(t,i);return 1===r.minLevel&&256===this.tileInfo.size[0]&&(r.minLevel=0),r}async fetchTile(e,t,i,r){return this._tileHandler.getVectorTile(e,t,i,r)}};e([h()],C.prototype,"layer",void 0),e([h()],C.prototype,"dataLevelRange",null),e([h()],C.prototype,"updatingProgressValue",void 0),C=e([c("esri.views.3d.layers.VectorTileLayerView3D")],C);const H=C;export{H 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.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{adjustStaticAGOUrl as e}from"../../../../core/devEnvironmentUtils.js";import{get as t,isSome as r,isNone as s}from"../../../../core/maybe.js";import{a as o}from"../../../../chunks/mat3.js";import{c as i}from"../../../../chunks/mat3f64.js";import{a}from"../../../../chunks/mat4.js";import{c as u}from"../../../../chunks/mat4f64.js";import{m as n,b as l,E as c,l as m,n as d,h as f}from"../../../../chunks/vec3.js";import{c as p}from"../../../../chunks/vec3f64.js";import{empty as x,expandWithVec3 as g}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as h,BufferViewVec4f as b,BufferViewVec2f as R,BufferViewVec4u8 as v,BufferViewVec4u16 as B,BufferViewVec3u8 as M,BufferViewVec3u16 as T}from"../../../../geometry/support/buffer/BufferView.js";import{t as w,a as y,s as j}from"../../../../chunks/vec32.js";import{t as
|
|
5
|
+
import{adjustStaticAGOUrl as e}from"../../../../core/devEnvironmentUtils.js";import{get as t,isSome as r,isNone as s}from"../../../../core/maybe.js";import{a as o}from"../../../../chunks/mat3.js";import{c as i}from"../../../../chunks/mat3f64.js";import{a}from"../../../../chunks/mat4.js";import{c as u}from"../../../../chunks/mat4f64.js";import{m as n,b as l,E as c,l as m,n as d,h as f}from"../../../../chunks/vec3.js";import{c as p}from"../../../../chunks/vec3f64.js";import{empty as x,expandWithVec3 as g}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as h,BufferViewVec4f as b,BufferViewVec2f as R,BufferViewVec4u8 as v,BufferViewVec4u16 as B,BufferViewVec3u8 as M,BufferViewVec3u16 as T}from"../../../../geometry/support/buffer/BufferView.js";import{t as w,a as y,s as j}from"../../../../chunks/vec32.js";import{t as E,s as O}from"../../../../chunks/vec42.js";import{createBuffer as C}from"../../../../geometry/support/buffer/utils.js";import{DefaultLoadingContext as S}from"../../glTF/DefaultLoadingContext.js";import{load as A}from"../../glTF/loader.js";import{triangleFanToTriangles as N,triangleStripToTriangles as I,trianglesToTriangles as L}from"../../glTF/internal/indexUtils.js";import{load as F,processLoadResult as k}from"./wosrLoader.js";import{AlphaDiscardMode as P,DepthTestFunction as V,CullFaceOptions as _}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as G}from"../../webgl-engine/lib/Geometry.js";import{Texture as D}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as z}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as U}from"../../webgl-engine/materials/DefaultMaterial.js";import{COLOR_GAMMA as q}from"../../webgl-engine/materials/DefaultMaterial_COLOR_GAMMA.js";import{PrimitiveType as W}from"../../../webgl/enums.js";import{n as $}from"../../../../chunks/vec22.js";import{c as K,f as Q}from"../../../../chunks/vec43.js";import{c as H}from"../../../../chunks/vec33.js";async function J(s,o){const i=X(e(s));if("wosr"===i.fileType){const e=await(o.cache?o.cache.loadWOSR(i.url,o):F(i.url,o)),t=k(e,o);return{lods:[t],referenceBoundingBox:t.boundingBox,isEsriSymbolResource:!1,isWosr:!0,remove:e.remove}}const a=await(o.cache?o.cache.loadGLTF(i.url,o,o.usePBR):A(new S(o.streamDataRequester),i.url,o,o.usePBR)),u=t(a.model.meta,"ESRI_proxyEllipsoid");a.meta.isEsriSymbolResource&&r(u)&&a.meta.uri.includes("/RealisticTrees/")&&te(a,u);const n=a.meta.isEsriSymbolResource?{usePBR:o.usePBR,isSchematic:!1,treeRendering:a.customMeta.esriTreeRendering,mrrFactors:[0,1,.2]}:{usePBR:o.usePBR,isSchematic:!1,mrrFactors:[0,1,.5]},l={...o.materialParamsMixin,treeRendering:a.customMeta.esriTreeRendering};if(null!=i.specifiedLodIndex){const e=Y(a,n,l,i.specifiedLodIndex);let t=e[0].boundingBox;if(0!==i.specifiedLodIndex){t=Y(a,n,l,0)[0].boundingBox}return{lods:e,referenceBoundingBox:t,isEsriSymbolResource:a.meta.isEsriSymbolResource,isWosr:!1,remove:a.remove}}const c=Y(a,n,l);return{lods:c,referenceBoundingBox:c[0].boundingBox,isEsriSymbolResource:a.meta.isEsriSymbolResource,isWosr:!1,remove:a.remove}}function X(e){const t=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);if(t)return{fileType:"gltf",url:t[1],specifiedLodIndex:null!=t[4]?Number(t[4]):null};return e.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:e,specifiedLodIndex:null}:{fileType:"unknown",url:e,specifiedLodIndex:null}}function Y(e,t,s,a){const u=e.model,n=i(),l=new Array,c=new Map,m=new Map;return u.lods.forEach(((e,i)=>{if(void 0!==a&&i!==a)return;const d={name:e.name,stageResources:{textures:new Array,materials:new Array,geometries:new Array},lodThreshold:r(e.lodThreshold)?e.lodThreshold:null,pivotOffset:[0,0,0],numberOfVertices:0,boundingBox:x()};l.push(d),e.parts.forEach((e=>{const i=e.material+(e.attributes.normal?"_normal":"")+(e.attributes.color?"_color":"")+(e.attributes.texCoord0?"_texCoord0":"")+(e.attributes.tangent?"_tangent":""),a=u.materials.get(e.material),l=r(e.attributes.texCoord0),f=r(e.attributes.normal),p=Z(a.alphaMode);if(!c.has(i)){if(l){if(r(a.textureColor)&&!m.has(a.textureColor)){const e=u.textures.get(a.textureColor),t={...e.parameters,preMultiplyAlpha:p!==P.Opaque};m.set(a.textureColor,new D(e.data,t))}if(r(a.textureNormal)&&!m.has(a.textureNormal)){const e=u.textures.get(a.textureNormal);m.set(a.textureNormal,new D(e.data,e.parameters))}if(r(a.textureOcclusion)&&!m.has(a.textureOcclusion)){const e=u.textures.get(a.textureOcclusion);m.set(a.textureOcclusion,new D(e.data,e.parameters))}if(r(a.textureEmissive)&&!m.has(a.textureEmissive)){const e=u.textures.get(a.textureEmissive);m.set(a.textureEmissive,new D(e.data,e.parameters))}if(r(a.textureMetallicRoughness)&&!m.has(a.textureMetallicRoughness)){const e=u.textures.get(a.textureMetallicRoughness);m.set(a.textureMetallicRoughness,new D(e.data,e.parameters))}}const o=a.color[0]**(1/q),n=a.color[1]**(1/q),d=a.color[2]**(1/q),x=a.emissiveFactor[0]**(1/q),g=a.emissiveFactor[1]**(1/q),h=a.emissiveFactor[2]**(1/q),b=r(a.textureColor)&&l?m.get(a.textureColor):null;c.set(i,new U({...t,transparent:p===P.Blend,customDepthTest:V.Lequal,textureAlphaMode:p,textureAlphaCutoff:a.alphaCutoff,diffuse:[o,n,d],ambient:[o,n,d],opacity:a.opacity,doubleSided:a.doubleSided,doubleSidedType:"winding-order",cullFace:a.doubleSided?_.None:_.Back,hasVertexColors:!!e.attributes.color,hasVertexTangents:!!e.attributes.tangent,normals:f?"default":"screenDerivative",castShadows:!0,receiveSSAO:!0,enableFillLights:!0,textureId:r(b)?b.id:void 0,colorMixMode:a.colorMixMode,normalTextureId:r(a.textureNormal)&&l?m.get(a.textureNormal).id:void 0,textureAlphaPremultiplied:r(b)&&!!b.params.preMultiplyAlpha,occlusionTextureId:r(a.textureOcclusion)&&l?m.get(a.textureOcclusion).id:void 0,emissiveTextureId:r(a.textureEmissive)&&l?m.get(a.textureEmissive).id:void 0,metallicRoughnessTextureId:r(a.textureMetallicRoughness)&&l?m.get(a.textureMetallicRoughness).id:void 0,emissiveFactor:[x,g,h],mrrFactors:[a.metallicFactor,a.roughnessFactor,t.mrrFactors[2]],isSchematic:!1,...s}))}const x=ee(e.indices||e.attributes.position.count,e.primitiveType),S=e.attributes.position.count,A=C(h,S);w(A,e.attributes.position,e.transform);const N=[[z.POSITION,{data:A.typedBuffer,size:A.elementCount,exclusive:!0}]],I=[[z.POSITION,x]];if(r(e.attributes.normal)){const t=C(h,S);o(n,e.transform),y(t,e.attributes.normal,n),N.push([z.NORMAL,{data:t.typedBuffer,size:t.elementCount,exclusive:!0}]),I.push([z.NORMAL,x])}if(r(e.attributes.tangent)){const t=C(b,S);o(n,e.transform),E(t,e.attributes.tangent,n),N.push([z.TANGENT,{data:t.typedBuffer,size:t.elementCount,exclusive:!0}]),I.push([z.TANGENT,x])}if(r(e.attributes.texCoord0)){const t=C(R,S);$(t,e.attributes.texCoord0),N.push([z.UV0,{data:t.typedBuffer,size:t.elementCount,exclusive:!0}]),I.push([z.UV0,x])}if(r(e.attributes.color)){const t=C(v,S);if(4===e.attributes.color.elementCount)e.attributes.color instanceof b?O(t,e.attributes.color,255):e.attributes.color instanceof v?K(t,e.attributes.color):e.attributes.color instanceof B&&O(t,e.attributes.color,1/256);else{Q(t,255,255,255,255);const r=new M(t.buffer,0,4);e.attributes.color instanceof h?j(r,e.attributes.color,255):e.attributes.color instanceof M?H(r,e.attributes.color):e.attributes.color instanceof T&&j(r,e.attributes.color,1/256)}N.push([z.COLOR,{data:t.typedBuffer,size:t.elementCount,exclusive:!0}]),I.push([z.COLOR,x])}const L=new G(N,I);d.stageResources.geometries.push(L),d.stageResources.materials.push(c.get(i)),l&&(r(a.textureColor)&&d.stageResources.textures.push(m.get(a.textureColor)),r(a.textureNormal)&&d.stageResources.textures.push(m.get(a.textureNormal)),r(a.textureOcclusion)&&d.stageResources.textures.push(m.get(a.textureOcclusion)),r(a.textureEmissive)&&d.stageResources.textures.push(m.get(a.textureEmissive)),r(a.textureMetallicRoughness)&&d.stageResources.textures.push(m.get(a.textureMetallicRoughness))),d.numberOfVertices+=S;const F=L.boundingInfo;r(F)&&(g(d.boundingBox,F.getBBMin()),g(d.boundingBox,F.getBBMax()))}))})),l}function Z(e){switch(e){case"BLEND":return P.Blend;case"MASK":return P.Mask;case"OPAQUE":case null:case void 0:return P.Opaque}}function ee(e,t){switch(t){case W.TRIANGLES:return L(e);case W.TRIANGLE_STRIP:return I(e);case W.TRIANGLE_FAN:return N(e)}}function te(e,t){for(let r=0;r<e.model.lods.length;++r){const o=e.model.lods[r];e.customMeta.esriTreeRendering=!0;for(const i of o.parts){const o=i.attributes.normal;if(s(o))return;const x=i.attributes.position,g=x.count,b=p(),R=p(),B=p(),M=C(v,g),T=C(h,g),w=a(u(),i.transform);for(let s=0;s<g;s++){x.getVec(s,R),o.getVec(s,b),n(R,R,i.transform),l(B,R,t.center),c(B,B,t.radius);const a=B[2],u=m(B),p=Math.min(.45+.55*u*u,1);c(B,B,t.radius),n(B,B,w),d(B,B),r+1!==e.model.lods.length&&e.model.lods.length>1&&f(B,B,b,a>-1?.2:Math.min(-4*a-3.8,1)),T.setVec(s,B),M.set(s,0,255*p),M.set(s,1,255*p),M.set(s,2,255*p),M.set(s,3,255)}i.attributes.normal=T,i.attributes.color=M}}}export{J as fetch,Y as gltfToEngineResources,X as parseUrl};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isSome as e,isNone as t,unwrap as i}from"../../../../core/maybe.js";import s from"../../../../core/PooledArray.js";import{isAbortError as r}from"../../../../core/promiseUtils.js";import{l as n}from"../../../../chunks/vec3.js";import{d as o}from"../../../../chunks/vec4f64.js";import{LodMetric as a,NodeBase as d,Node as l,NodeFilterImpact as h,NodeIMModificationImpact as u,NodeTraversalState as c}from"./I3SNode.js";import{addWraparound as g}from"./I3SUtil.js";import{clone as _}from"../../support/orientedBoundingBox.js";class m{constructor(e,t,i,s,r){this.childOffset=e,this.childCount=t,this.visibilityCache=i,this.ref=s,this.node=r,this.useAsHole=0,this.filterImpact=h.NotChecked}}class f{constructor(e,t,i,r,n,o,d,l,h,u,c,g,_,m){this.streamDataController=i,this.viewportQueries=r,this.logger=n,this.holeFilling=o,this._isLoaded=d,this._isReloading=l,this._isSelected=h,this._enable=u,this._needsUpdate=c,this._canRequest=g,this._computeVisibilityObb=_,this._computeNodeFiltering=m,this._dirty=!0,this._nodePages=[],this.nodeCount=0,this.nodesPerPage=0,this.rootIndex=0,this.lodMetric=a.None,this._lodConversion=e=>e,this.urlPrefix="",this._loading=new Set,this._failedNodes=new Set,this._failedPages=new Set,this._indexMissing=1,this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.POSITIVE_INFINITY,this._nodeTraversalState=new Map,this._version=P(0),this._visibilityCacheVersion=P(0),this._maxLevel=1,this._featureEstimate={estimate:0,leavesReached:!1},this._unloadedMemoryEstimate=0,this._missing=new s({deallocator:null}),this._prefetch=new s({deallocator:null}),this._updates=new b(this._missing),this._imModificationUncategorized=new s({deallocator:null}),this.ignoreServiceObb=!1,this.progressiveLoadPenalty=0,this._pageQueue=[],this.layerHasModifications=!1,this._layerHasFilter=!1,this.logLayer=e,e.serviceUpdateTimeStamp&&e.serviceUpdateTimeStamp.lastUpdate&&(this.lastUpdate=`${e.serviceUpdateTimeStamp.lastUpdate}`),this._maxLodLevel=this.viewportQueries?this.viewportQueries.maxLodLevel:1,this._init(t)}_init(e){if("page"===e.type){switch(this.urlPrefix=e.urlPrefix,this.nodesPerPage=e.pageSize,this.rootIndex=e.rootIndex,e.lodMetric){case"maxScreenThreshold":this.lodMetric=a.MaxScreenThreshold;break;case"maxScreenThresholdSQ":this.lodMetric=a.MaxScreenThreshold,this._lodConversion=L}this._addPage(C(this.rootIndex,this.nodesPerPage),e.rootPage),this._updateParentsAndLevel()}else if("node"===e.type){this.urlPrefix=e.urlPrefix,this._nodePages.push({nodes:[],children:[],parents:[]}),this._makeRefNode(new d(e.rootNode.id,null),-1);const t=this._validateNode(e.rootNode.id,e.rootNode);t&&this._addNode(t,0)}}_loadPage(e){this._loading.add(e);const t=this.urlPrefix+e;this.streamDataController.request(t,"json").then((t=>{this._pageQueue.push({pageIndex:e,page:t})})).catch((t=>{this._loading.delete(e),r(t)||(this._failedPages.add(e),this.logger.error("#loadPage()",this.logLayer,`Error when loading page ${e}`,t))}))}_addQueuedPages(e){for(;this._pageQueue.length>0&&!e.done;){const{pageIndex:t,page:i}=this._pageQueue.shift();this._addPage(t,i),this._loading.delete(t),e.madeProgress()}this._updateParentsAndLevel()}_addPage(e,t){for(let n=this._nodePages.length;n<e;n++)this._nodePages[n]=null;const i=[],s=[],r=t.nodes.map(((t,r)=>{const a=i.length,d=t.children?t.children.length:0;s.push(-1);for(let e=0;e<d;e++)i.push(t.children[e]);const h=`${t.index}`,u=_(t.obb),c=o([u.center[0],u.center[1],u.center[2],n(u.halfSize)]),g=t.mesh&&t.mesh.attribute,f=t.mesh&&t.mesh.geometry,v=t.mesh&&t.mesh.material,b={hasSharedResource:!1,hasFeatureData:!!f,attributes:g&&null!=g.resource?`${g.resource}`:null,geometry:f&&null!=f.resource?`${f.resource}`:null,texture:v&&null!=v.resource?`${v.resource}`:null,geometryDefinition:f?f.definition:-1,materialDefinition:v?v.definition:-1},p=new l(h,e*this.nodesPerPage+r,c,d,0,b,this.lastUpdate,this.lodMetric,this._lodConversion(t.lodThreshold),f?f.featureCount:null);return p.serviceObb=u,p.visibilityObb=this._computeVisibilityObb(p),p.vertexCount=f?f.vertexCount:0,new m(a,d,y(this._visibilityCacheVersion),null,p)}));this._nodePages[e]={nodes:r,children:i,parents:s},this.nodeCount+=r.length}_updateParentsAndLevel(){const t=new Array,i=(i,s,r)=>{const n=this._getPage(i);if(e(n)){const o=w(i,this.nodesPerPage);n.parents[o]=s;const a=n.nodes[o].node;e(a)&&(a.level=r,t.push(i))}};for(i(this.rootIndex,-1,0);t.length;){const s=t.pop(),r=this.getNode(s);if(e(r))for(let e=0;e<r.childCount;e++){i(this.getChildIndex(r,e),s,r.level+1),this._maxLevel=Math.max(this._maxLevel,r.level+1)}}}_getPage(e){return this._nodePages[C(e,this.nodesPerPage)]}_getNodeInternal(e){const i=this._getPage(e);return t(i)?null:i.nodes[w(e,this.nodesPerPage)]}_addNode(t,s){null!=t.children&&this.populateChildren(s,t.children);const r=this.getParent(s),n=e(r)?r.level+1:0;this._maxLevel=Math.max(this._maxLevel,t.children?n+1:n);const{lodMetric:a,maxError:d}=S(t.lodSelection),h=i(this._getNodeInternal(s));return h.node=new l(t.id,s,o(t.mbs),h.childCount,n,t.resources,t.version,a,d,t.numFeatures),t.obb&&(h.node.serviceObb=_(t.obb)),h.node.visibilityObb=this._computeVisibilityObb(h.node),e(h.ref)&&(null==h.ref.mbs&&(h.ref.mbs=t.mbs),h.node.renderMbs=h.ref.renderMbs,h.node.serviceObbInRenderSR=h.ref.serviceObbInRenderSR,h.ref.visibilityObb=h.node.visibilityObb),h.node}_makeRefNode(t,i){const s=this._nodePages[0],r=s.nodes.length;return s.nodes.push(new m(0,0,y(this._visibilityCacheVersion),t,null)),this.nodeCount++,s.parents.push(i),t.renderMbs[3]=-1,e(t.serviceObbInRenderSR)&&(t.serviceObbInRenderSR.halfSize[0]=-1),r}populateChildren(e,t){const s=i(this._getNodeInternal(e)),r=i(this._getPage(e));s.childOffset=r.children.length,s.childCount=t.length;for(let i=0;i<t.length;i++){const s=this._makeRefNode(t[i],e);r.children.push(s)}}getNode(t){const i=this._getNodeInternal(t);return e(i)?i.node:null}getIndexById(t){let i;return this._forAllNodes(((s,r)=>{(e(s.node)&&s.node.id===t||e(s.ref)&&s.ref.id===t)&&(i=r)})),i}getNodeById(e){const t=this.getIndexById(e);return t>=0?this.getNode(t):null}getChildIndex(e,i){const s=this._getPage(e.index);if(t(s))return-1;const r=s.nodes[w(e.index,this.nodesPerPage)];return s.children[r.childOffset+i]}getParentIndex(t){const i=this._getPage(t);return e(i)?i.parents[w(t,this.nodesPerPage)]:-1}getParent(e){return(e=this.getParentIndex(e))>=0?this.getNode(e):null}isLeaf(t){const i=this._getNodeInternal(t);return e(i)&&0===i.childCount}get rootNode(){return this.getNode(this.rootIndex)}get size(){return this.nodeCount}invalidateVisibilityCache(){this._visibilityCacheVersion=P(this._visibilityCacheVersion)}invalidateNodeVisibilityCache(t){const i=this._getNodeInternal(t);e(i)&&this.invalidateNodeVisibilityCacheInternal(i)}invalidateNodeVisibilityCacheInternal(e){e.visibilityCache=y(this._visibilityCacheVersion)}invalidateBoundingVolumeCache(t){const i=this._getNodeInternal(t);e(i)&&(p(i),this.invalidateNodeVisibilityCacheInternal(i))}invalidateGeometryVisibility(t){const i=this._getNodeInternal(t);e(i)&&e(i.node)&&(i.node.geometryObb=null,i.node.renderMbs[3]=-1,e(i.node.serviceObbInRenderSR)&&(i.node.serviceObbInRenderSR.halfSize[0]=-1))}invalidateVisibilityObbs(){t(this.rootNode)||this.traverse(this.rootNode,(e=>(e.visibilityObb=this._computeVisibilityObb(e),e.geometryObb=null,!0)))}isNodeVisible(i){const s=this._getNodeInternal(i);if(t(s)||e(s.ref)&&!s.ref.mbs)return!0;if(!x(s.visibilityCache,this._visibilityCacheVersion)){const i=s.node,r=e(i)&&(t(s.ref)||e(i.visibilityObb))?i:e(s.ref)?s.ref:null;if(this._layerHasFilter&&this._computeNodeFiltering&&(e(i)||e(s.ref))&&s.filterImpact===h.NotChecked){const t=e(i)?i.mbs:e(s.ref)?s.ref.mbs:null;s.filterImpact=null!=t?this._computeNodeFiltering(t):h.Unmodified}const n=e(i)&&s.filterImpact===h.Culled,o=!(e(i)&&i.imModificationImpact===u.Culled)&&(!r||this.viewportQueries.isNodeVisible(r))&&!n;return s.visibilityCache=N(o,this._visibilityCacheVersion),o}return I(s.visibilityCache)}isGeometryVisible(t){if(!this.isNodeVisible(t))return!1;const i=this._getNodeInternal(t);return!(e(i)&&e(i.node)&&e(i.node.geometryObb)&&(!this.layerHasModifications||i.node.imModificationImpact!==u.NotChecked))||this.viewportQueries.isGeometryVisible(i.node)}_traverseCoverage(s,r,n,o,a){const d=this._getPage(s);if(t(d)||0===r.childCount)return;const l=r.childOffset+r.childCount,h=new Array;for(let t=r.childOffset;t<l;++t){const i=d.children[t],s=this._getNodeInternal(i);e(s)&&e(s.node)&&this.isGeometryVisible(i)&&h.push(s)}o/=h.length;for(const e of h){const t=i(e.node).index;this._isLoaded(t)||this._isReloading(t)?(a.delta=Math.max(a.delta,n),a.coverage+=o):this._traverseCoverage(t,e,n+1,o,a)}}useNodeAsHole(e){if("off"===this.holeFilling)return!1;const i=this._getNodeInternal(e);if(t(i))return!1;if("always"===this.holeFilling)return!0;if(x(i.useAsHole,this._version))return I(i.useAsHole);const s={delta:0,coverage:0};this._traverseCoverage(e,i,0,1,s);const r=s.delta*s.coverage<=.5;return i.useAsHole=N(r,this._version),r}get maxLevel(){return this._maxLevel}get dirty(){return this._dirty}destroy(){this._updates.add.prune(),this._updates.update.prune()}requestUpdate(){this._dirty=!0,this._indexMissing=1,this._version=P(this._version)}imModificationsChanged(t){this.layerHasModifications=t,this._forAllNodes((({node:t})=>{e(t)&&(t.imModificationImpact=u.NotChecked,t.visibilityObb=this._computeVisibilityObb(t),t.hasModifications&&this.invalidateGeometryVisibility(t.index))})),this.invalidateVisibilityCache()}layerFilterChanged(t){this._layerHasFilter=t,this._forAllNodes((t=>{if(e(t)){t.filterImpact=h.NotChecked;const i=t.node;e(i)&&this.invalidateNodeVisibilityCache(i.index)}})),this.invalidateVisibilityCache()}update(s,r,n){if(!this._dirty)return;this._pageQueue.length>0&&this._addQueuedPages(r),this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.NEGATIVE_INFINITY,this._missing.clear(),this._prefetch.clear(),this._updates.reset(s),v.clear();let o=!0;const a=new O,d=new O,l=this._imModificationUncategorized;l.clear();const h=new Set,c=(c,g,_)=>{if(t(g)){let e=this._entryPriority(c);e===1/0&&(e=this._entryPriority(_));const t=C(c,this.nodesPerPage);return v.set(t,Math.max(e,v.get(t)||0)),this._loading.has(t)||this._failedPages.has(t)||this._missing.push(t),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e))}const m=g.node;if(this._updateNodeFeatureEstimate(m,d),t(m)){const e=this._entryPriority(c);return this._loading.has(c)||this._failedNodes.has(c)||(this._missing.push(c),v.set(c,e)),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e))}const f=i(this._getPage(c));if(0===this._missing.length&&0===this.nodesPerPage)for(let t=0;t<g.childCount;t++){const i=f.children[g.childOffset+t],s=this._getNodeInternal(i);!e(s)||s.node||this._loading.has(i)||this._failedNodes.has(i)||(v.set(i,this._entryPriority(i)),this._prefetch.push(i))}if(m.failed)return;if(h.add(m.id),this._isLoaded(c)){if(a.known+=m.memory,++a.knownNodes,this._isSelected(m)?g.childCount>0&&(o=!1):(a.unremoved+=m.memory,o=!1),this._needsUpdate(m)){const e=this._entryPriority(c);v.set(c,e),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e),this._updates.update.push(c)}return}if(m.memory&&(a.known+=m.memory,++a.knownNodes),!this._isSelected(m))return void(this._isReloading(c)&&this._updates.remove.push(c));if(g.childCount>0&&(o=!1),m.memory?(a.missing+=m.memory,a.known+=m.memory,++a.knownNodes):++a.missingNodes,s.indexOf(m.index)>=0)return this._maxProcessingPrio=Math.max(this._maxProcessingPrio,this._entryPriority(c)),void(this._updates.cancel=this._updates.cancel.filter((e=>e!==m.index)));if(!r.done&&this._enable(m))return void r.madeProgress();const b=this._entryPriority(c);v.set(c,b),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,b),this._updates.add.push(c),this.layerHasModifications&&n&&e(m)&&m.imModificationImpact===u.NotChecked&&l.push(c)};this.traverseVisible(c);const g=this._updates.add;g.length>0&&this.layerHasModifications&&(l.length>0&&n(l),g.filterInPlace((e=>{const i=this._getNodeInternal(e),s=t(i)||t(i.node)||i.node.imModificationImpact!==u.Culled;return s||this.invalidateNodeVisibilityCache(e),s}))),this._unloadedMemoryEstimate=a.missing-a.unremoved,a.knownNodes>3&&a.missingNodes>0&&(this._unloadedMemoryEstimate+=a.known/a.knownNodes*a.missingNodes),this._unloadedMemoryEstimate=.8*Math.max(0,this._unloadedMemoryEstimate),this._featureEstimate.estimate=this._computeFeatureEstimate(d),this._featureEstimate.leavesReached=o,this._missing.sort(((e,t)=>e-t)),this._missing.filterInPlace(((e,t)=>t<1||this._missing.data[t-1]!==e)),this._missing.sort(((e,t)=>v.get(e)-v.get(t))),this._missing.length>0&&(this._maxUnloadedPrio=v.get(this._missing.back()),this._prefetch.clear()),this._updates.add.filterInPlace((e=>v.get(e)>=this._maxUnloadedPrio)).sort(((e,t)=>v.get(e)-v.get(t))),this._updates.update.sort(((e,t)=>v.get(e)-v.get(t))),this._indexMissing=this._loading.size+this._missing.length,this._dirty=this._indexMissing>0,v.clear()}checkFeatureTarget(e,t){const i=this.viewportQueries.updateScreenSpaceErrorBias(t);let s=t,r=t,n=i,o=10;for(;o--;){const i=new O;this._updateFeatureEstimate(s,i);if(this._computeFeatureEstimate(i)<=e){if(s>=t||i.missingNodes>0||0===o)break;n=s,s=.5*(s+r)}else r=s,s=.5*(s+n)}return this._version=P(this._version),this.viewportQueries.updateScreenSpaceErrorBias(i),Math.min(t,s)}_updateFeatureEstimate(t,i){this._version=P(this._version),this.viewportQueries.updateScreenSpaceErrorBias(t),this.traverseVisible(((t,s)=>this._updateNodeFeatureEstimate(e(s)&&s.node,i)))}_updateNodeFeatureEstimate(i,s){if(!(t(i)||i.failed||t(i.numFeatures)))return this._isLoaded(i.index)?(s.known+=i.numFeatures,++s.knownNodes,void(this._isSelected(i)||(s.unremoved+=i.numFeatures))):void(this._isSelected(i)&&(e(i.numFeatures)?(s.missing+=i.numFeatures,s.known+=i.numFeatures,++s.knownNodes):++s.missingNodes))}_computeFeatureEstimate(e){let t=e.known-e.unremoved;return e.knownNodes>3&&e.missingNodes>0&&(t+=e.known/e.knownNodes*e.missingNodes),Math.max(0,t)}load(){return this._load(this._missing)}prefetch(){return this._prefetch.sort(((e,t)=>v.get(e)-v.get(t))),this._load(this._prefetch)}_load(e){if(0===e.length||!this._canRequest())return!1;for(;e.length>0&&this._canRequest();)0===this.nodesPerPage?this._loadNode(e.pop()):this._loadPage(e.pop());return!0}isLoading(){return this._indexMissing>0}getIndexLoading(){return this._loading.size}getIndexMissing(){return this._indexMissing}getUnloadedMemoryEstimate(){return this._unloadedMemoryEstimate}get updates(){return this._updates}get featureEstimate(){return this._featureEstimate}nodeTraversalState(e){if(t(e))return null;let i=this._nodeTraversalState.get(e.index);if(i&&x(i.version,this._version))return i;const s=this.viewportQueries.getLodLevel(e),r=this.viewportQueries.hasLOD(e);let n=!0;if(r){const t=this.getParentIndex(e.index);if(t>=0){const e=this._nodeTraversalState.get(t);n=e&&s>e.lodLevel}else n=s>0}else n=0===e.childCount;return i?(i.lodLevel=s,i.isChosen=n,i.version=N(!0,this._version),i):(i=new c(r,n,s,N(!0,this._version)),this._nodeTraversalState.set(e.index,i),i)}_loadNode(e){this._loading.add(e);const s=i(this._getNodeInternal(e)).ref;if(t(s))return void this._failedNodes.add(e);const n=s.id,o=this.urlPrefix+n,a=()=>{this._loading.delete(e),0===this._missing.length&&0===this._loading.size&&this.requestUpdate()};this.streamDataController.request(o,"json").then((t=>{a();const i=this._validateNode(n,t);if(null==i)return;i.obb&&this.invalidateNodeVisibilityCache(e);const s=this._addNode(i,e);this.nodeTraversalState(s)}),(t=>{a(),r(t)||(this.logger.error("#loadNode()",this.logLayer,"Error loading node: "+o),this._failedNodes.add(e))}))}_validateNode(e,t){if(null==t||"object"!=typeof t||t.id!==e)return this.logger.error("#validateNode()",this.logLayer,`Invalid node. Wrong type or wrong id "${e}"`),null;if(!Array.isArray(t.mbs))return this.logger.error("#validateNode()",this.logLayer,`Invalid bounding volume on node ${e}.`),null;t.sharedResource&&"./shared"!==t.sharedResource.href&&"./shared/"!==t.sharedResource.href&&this.logger.warn("#validateNode()",this.logLayer,`Invalid shared resource href on node "${e}"`),null==t.geometryData||Array.isArray(t.geometryData)&&1===t.geometryData.length&&"./geometries/0"===t.geometryData[0].href||this.logger.warn("#validateNode()",this.logLayer,`Invalid geometry data on node "${e}"`),null==t.attributeData||Array.isArray(t.attributeData)&&!t.attributeData.some(((e,t)=>e.href!==`./attributes/f_${t}/0`))||this.logger.warn("#validateNode()",this.logLayer,`Invalid attribute data on node "${e}"`),t.featureData&&t.featureData.length>1&&this.logger.warn("#validateNode()",this.logLayer,`Node ${e} has ${t.featureData.length} bundles. Only the first bundle will be loaded.`);const i=t.hasOwnProperty("obb")&&!this.ignoreServiceObb?t.obb:null,s=t.featureData&&1===t.featureData.length&&t.featureData[0].featureRange?t.featureData[0].featureRange[1]-t.featureData[0].featureRange[0]+1:null,r=t=>{if(null==t)return null;const i=t=>this.logger.error("#validateNode()",this.logLayer,`Invalid node reference on node ${e}: ${t}`);if("number"==typeof t.id)i(`id ${t.id} is a number instead of a string.`);else if("string"!=typeof t.id||!Array.isArray(t.mbs))return i("Missing or invalid id."),null;if(!Array.isArray(t.mbs))return i(`Invalid bounding volume on reference ${t.id}.`),null;t.href&&t.href!=="../"+t.id&&this.logger.error("#validateNode()",this.logLayer,`Invalid node href on node "${e}"`);const s=t.hasOwnProperty("obb")&&!this.ignoreServiceObb?t.obb:null,r=new d(`${t.id}`,t.mbs);return r.serviceObb=s,r.visibilityObb=this._computeVisibilityObb(r),r},n=Array.isArray(t.children)?t.children.map(r).filter((e=>null!=e)):null;return{id:e,mbs:t.mbs,obb:i,children:n,resources:{hasFeatureData:t.featureData&&t.featureData.length>0,hasSharedResource:null!=t.sharedResource,attributes:t.attributeData?e:null,texture:t.textureData&&t.textureData.length>0?e:null,geometry:null!=t.geometryData?e:null},version:"string"==typeof t.version?t.version:null,lodSelection:Array.isArray(t.lodSelection)?t.lodSelection:null,numFeatures:s}}resetFailedNodes(){this._failedNodes.clear(),this._failedPages.clear(),this._forAllNodes((t=>{e(t.node)&&(t.node.failed=!1)}))}_entryPriority(i){const s=this._getNodeInternal(i),r=this.getParentIndex(i);if(t(s)||r<0&&null==s.node)return r<0?1/0:this._entryPriority(r);let n=0;if(s.node&&r>=0){const e=this._nodeTraversalState.get(r);null!=e&&(n=e.lodLevel)}let o=this.progressiveLoadPenalty;for(let e=i;e>=0;e=this.getParentIndex(e))if(this._isLoaded(e)){o=0;break}const a=e(s.ref)?this.viewportQueries.distToPOI(s.ref):e(s.node)?this.viewportQueries.distToPOI(s.node):0;return-a-n*(a+this.progressiveLoadPenalty)+o}traverseVisible(e){const i=this._getNodeInternal(this.rootIndex);t(i)?e(this.rootIndex,null,null):this._traverseVisible(this.rootIndex,-1,i,e)}_traverseVisible(t,s,r,n){if(r.node&&0===r.childCount)return void(this.isGeometryVisible(t)&&n(t,r,s));if(!this.isNodeVisible(t))return;if(n(t,r,s),null==r.node)return;const o=this.nodeTraversalState(r.node);if(o.nodeHasLOD&&o.lodLevel===this._maxLodLevel)return;const a=i(this._getPage(t));for(let i=0;i<r.childCount;i++){const s=a.children[r.childOffset+i],o=this._getNodeInternal(s);e(o)?this._traverseVisible(s,t,o,n):n(s,null,t)}}traverse(e,t){t(e)&&this.traverseChildren(e,t)}traverseChildren(t,i){const s=t.index,r=this._getNodeInternal(s);e(r)&&this._traverseChildren(s,r,i)}_traverseChildren(i,s,r){const n=this._getPage(i);if(t(n))return;const o=s.childOffset+s.childCount;for(let t=s.childOffset;t<o;++t){const i=n.children[t],s=this._getNodeInternal(i);e(s)&&e(s.node)&&r(s.node)&&this._traverseChildren(i,s,r)}}updateStats(e){if(this._updates.add.length>0&&(e.nodes+=" + "+this._updates.add.length),(this._indexMissing||this._prefetch.length>0)&&(e.index+=" + "+this._indexMissing||this._prefetch.length),e.prio=this._maxProcessingPrio,this._featureEstimate.estimate){const t=this._featureEstimate.estimate-e.features;t>0?e.features+=" + "+t:t<0&&(e.features+=" - "+-t)}}getPriority(){return Math.max(this._maxProcessingPrio,this._maxUnloadedPrio)}updateElevationInfo(e){this._forAllNodes(p),this.viewportQueries.updateElevationInfo(e)}_forAllNodes(e){for(let t=0;t<this._nodePages.length;t++){const i=this._nodePages[t];if(i){const s=t*this.nodesPerPage;for(let t=0;t<i.nodes.length;t++)e(i.nodes[t],s+t)}}}get test(){return{addNode:(e,t)=>this._addNode(e,t)}}}const v=new Map;class b{constructor(e){this.missing=e,this.update=new s({deallocator:null}),this.add=new s({deallocator:null}),this.remove=new s({deallocator:null}),this.cancel=[]}reset(e){this.add.clear(),this.update.clear(),this.cancel=e}}function p(t){e(t.node)&&(t.node.renderMbs[3]=-1,e(t.node.serviceObbInRenderSR)&&(t.node.serviceObbInRenderSR.halfSize[0]=-1)),e(t.ref)&&(t.ref.renderMbs[3]=-1,e(t.ref.serviceObbInRenderSR)&&(t.ref.serviceObbInRenderSR.halfSize[0]=-1))}function y(e){return g(e,-2)}function P(e){return g(e,2)}function N(e,t){return t+(e?1:0)}function x(e,t){return(-2&e)===t}function I(e){return 1==(1&e)}function C(e,t){return 0===t?0:e/t|0}function w(e,t){return 0===t?e:e%t}const M=[["maxScreenThreshold",a.MaxScreenThreshold],["screenSpaceRelative",a.ScreenSpaceRelative],["removedFeatureDiameter",a.RemovedFeatureDiameter],["distanceRangeFromDefaultCamera",a.DistanceRangeFromDefaultCamera]];function S(e){if(e)for(let t=0;t<e.length;t++)for(const i of M)if(i[0]===e[t].metricType)return{lodMetric:i[1],maxError:e[t].maxError};return{lodMetric:a.None,maxError:0}}class O{constructor(){this.known=0,this.knownNodes=0,this.missing=0,this.missingNodes=0,this.unremoved=0}}function L(e){return Math.sqrt(e*(4/Math.PI))}export{f as I3SIndex,S as selectErrorMetric};
|
|
5
|
+
import{isSome as e,isNone as t,unwrap as i}from"../../../../core/maybe.js";import s from"../../../../core/PooledArray.js";import{isAbortError as r}from"../../../../core/promiseUtils.js";import{l as n}from"../../../../chunks/vec3.js";import{d as o}from"../../../../chunks/vec4f64.js";import{LodMetric as a,NodeBase as d,Node as l,NodeFilterImpact as h,NodeIMModificationImpact as u,NodeTraversalState as c}from"./I3SNode.js";import{addWraparound as g}from"./I3SUtil.js";import{clone as _}from"../../support/orientedBoundingBox.js";class m{constructor(e,t,i,s,r){this.childOffset=e,this.childCount=t,this.visibilityCache=i,this.ref=s,this.node=r,this.useAsHole=0,this.filterImpact=h.NotChecked}}class f{constructor(e,t,i,r,n,o,d,l,h,u,c,g,_,m){this.streamDataController=i,this.viewportQueries=r,this.logger=n,this.holeFilling=o,this._isLoaded=d,this._isReloading=l,this._isSelected=h,this._enable=u,this._needsUpdate=c,this._canRequest=g,this._computeVisibilityObb=_,this._computeNodeFiltering=m,this._dirty=!0,this._nodePages=[],this.nodeCount=0,this.nodesPerPage=0,this.rootIndex=0,this.lodMetric=a.None,this._lodConversion=e=>e,this.urlPrefix="",this._loading=new Set,this._failedNodes=new Set,this._failedPages=new Set,this._indexMissing=1,this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.POSITIVE_INFINITY,this._nodeTraversalState=new Map,this._version=P(0),this._visibilityCacheVersion=P(0),this._maxLevel=1,this._featureEstimate={estimate:0,leavesReached:!1},this._unloadedMemoryEstimate=0,this._missing=new s({deallocator:null}),this._prefetch=new s({deallocator:null}),this._updates=new b(this._missing),this._imModificationUncategorized=new s({deallocator:null}),this.ignoreServiceObb=!1,this.progressiveLoadPenalty=0,this._pageQueue=[],this.layerHasModifications=!1,this._layerHasFilter=!1,this.logLayer=e,e.serviceUpdateTimeStamp&&e.serviceUpdateTimeStamp.lastUpdate&&(this.lastUpdate=`${e.serviceUpdateTimeStamp.lastUpdate}`),this._maxLodLevel=this.viewportQueries?this.viewportQueries.maxLodLevel:1,this._init(t)}_init(e){if("page"===e.type){switch(this.urlPrefix=e.urlPrefix,this.nodesPerPage=e.pageSize,this.rootIndex=e.rootIndex,e.lodMetric){case"maxScreenThreshold":this.lodMetric=a.MaxScreenThreshold;break;case"maxScreenThresholdSQ":this.lodMetric=a.MaxScreenThreshold,this._lodConversion=L}this._addPage(C(this.rootIndex,this.nodesPerPage),e.rootPage),this._updateParentsAndLevel()}else if("node"===e.type){this.urlPrefix=e.urlPrefix,this._nodePages.push({nodes:[],children:[],parents:[]}),this._makeRefNode(new d(e.rootNode.id,null),-1);const t=this._validateNode(e.rootNode.id,e.rootNode);t&&this._addNode(t,0)}}_loadPage(e){this._loading.add(e);const t=this.urlPrefix+e;this.streamDataController.request(t,"json").then((t=>{this._pageQueue.push({pageIndex:e,page:t})})).catch((t=>{this._loading.delete(e),r(t)||(this._failedPages.add(e),this.logger.error("#loadPage()",this.logLayer,`Error when loading page ${e}`,t))}))}_addQueuedPages(e){for(;this._pageQueue.length>0&&!e.done;){const{pageIndex:t,page:i}=this._pageQueue.shift();this._addPage(t,i),this._loading.delete(t),e.madeProgress()}this._updateParentsAndLevel()}_addPage(e,t){for(let n=this._nodePages.length;n<e;n++)this._nodePages[n]=null;const i=[],s=[],r=t.nodes.map(((t,r)=>{const a=i.length,d=t.children?t.children.length:0;s.push(-1);for(let e=0;e<d;e++)i.push(t.children[e]);const h=`${t.index}`,u=_(t.obb),c=o([u.center[0],u.center[1],u.center[2],n(u.halfSize)]),g=t.mesh&&t.mesh.attribute,f=t.mesh&&t.mesh.geometry,v=t.mesh&&t.mesh.material,b={hasSharedResource:!1,hasFeatureData:!!f,attributes:g&&null!=g.resource?`${g.resource}`:null,geometry:f&&null!=f.resource?`${f.resource}`:null,texture:v&&null!=v.resource?`${v.resource}`:null,geometryDefinition:f?f.definition:-1,materialDefinition:v?v.definition:-1},p=new l(h,e*this.nodesPerPage+r,c,d,0,b,this.lastUpdate,this.lodMetric,this._lodConversion(t.lodThreshold),f?f.featureCount:null);return p.serviceObb=u,p.visibilityObb=this._computeVisibilityObb(p),p.vertexCount=f?f.vertexCount:0,new m(a,d,y(this._visibilityCacheVersion),null,p)}));this._nodePages[e]={nodes:r,children:i,parents:s},this.nodeCount+=r.length}_updateParentsAndLevel(){const t=new Array,i=(i,s,r)=>{const n=this._getPage(i);if(e(n)){const o=w(i,this.nodesPerPage);n.parents[o]=s;const a=n.nodes[o].node;e(a)&&(a.level=r,t.push(i))}};for(i(this.rootIndex,-1,0);t.length;){const s=t.pop(),r=this.getNode(s);if(e(r))for(let e=0;e<r.childCount;e++){i(this.getChildIndex(r,e),s,r.level+1),this._maxLevel=Math.max(this._maxLevel,r.level+1)}}}_getPage(e){return this._nodePages[C(e,this.nodesPerPage)]}_getNodeInternal(e){const i=this._getPage(e);return t(i)?null:i.nodes[w(e,this.nodesPerPage)]}_addNode(t,s){null!=t.children&&this.populateChildren(s,t.children);const r=this.getParent(s),n=e(r)?r.level+1:0;this._maxLevel=Math.max(this._maxLevel,t.children?n+1:n);const{lodMetric:a,maxError:d}=S(t.lodSelection),h=i(this._getNodeInternal(s));return h.node=new l(t.id,s,o(t.mbs),h.childCount,n,t.resources,t.version,a,d,t.numFeatures),t.obb&&(h.node.serviceObb=_(t.obb)),h.node.visibilityObb=this._computeVisibilityObb(h.node),e(h.ref)&&(null==h.ref.mbs&&(h.ref.mbs=t.mbs),h.node.renderMbs=h.ref.renderMbs,h.node.serviceObbInRenderSR=h.ref.serviceObbInRenderSR,h.ref.visibilityObb=h.node.visibilityObb),h.node}_makeRefNode(t,i){const s=this._nodePages[0],r=s.nodes.length;return s.nodes.push(new m(0,0,y(this._visibilityCacheVersion),t,null)),this.nodeCount++,s.parents.push(i),t.renderMbs[3]=-1,e(t.serviceObbInRenderSR)&&(t.serviceObbInRenderSR.halfSize[0]=-1),r}populateChildren(e,t){const s=i(this._getNodeInternal(e)),r=i(this._getPage(e));s.childOffset=r.children.length,s.childCount=t.length;for(let i=0;i<t.length;i++){const s=this._makeRefNode(t[i],e);r.children.push(s)}}getNode(t){const i=this._getNodeInternal(t);return e(i)?i.node:null}getIndexById(t){let i;return this._forAllNodes(((s,r)=>{(e(s.node)&&s.node.id===t||e(s.ref)&&s.ref.id===t)&&(i=r)})),i}getNodeById(e){const t=this.getIndexById(e);return t>=0?this.getNode(t):null}getChildIndex(e,i){const s=this._getPage(e.index);if(t(s))return-1;const r=s.nodes[w(e.index,this.nodesPerPage)];return s.children[r.childOffset+i]}getParentIndex(t){const i=this._getPage(t);return e(i)?i.parents[w(t,this.nodesPerPage)]:-1}getParent(e){return(e=this.getParentIndex(e))>=0?this.getNode(e):null}isLeaf(t){const i=this._getNodeInternal(t);return e(i)&&0===i.childCount}get rootNode(){return this.getNode(this.rootIndex)}get size(){return this.nodeCount}invalidateVisibilityCache(){this._visibilityCacheVersion=P(this._visibilityCacheVersion)}invalidateNodeVisibilityCache(t){const i=this._getNodeInternal(t);e(i)&&this.invalidateNodeVisibilityCacheInternal(i)}invalidateNodeVisibilityCacheInternal(e){e.visibilityCache=y(this._visibilityCacheVersion)}invalidateBoundingVolumeCache(t){const i=this._getNodeInternal(t);e(i)&&(p(i),this.invalidateNodeVisibilityCacheInternal(i))}invalidateGeometryVisibility(t){const i=this._getNodeInternal(t);e(i)&&e(i.node)&&(i.node.geometryObb=null,i.node.renderMbs[3]=-1,e(i.node.serviceObbInRenderSR)&&(i.node.serviceObbInRenderSR.halfSize[0]=-1))}invalidateVisibilityObbs(){t(this.rootNode)||this.traverse(this.rootNode,(e=>(e.visibilityObb=this._computeVisibilityObb(e),e.geometryObb=null,!0)))}isNodeVisible(i){const s=this._getNodeInternal(i);if(t(s)||e(s.ref)&&!s.ref.mbs)return!0;if(!x(s.visibilityCache,this._visibilityCacheVersion)){const i=s.node,r=e(i)&&(t(s.ref)||e(i.visibilityObb))?i:e(s.ref)?s.ref:null;if(this._layerHasFilter&&this._computeNodeFiltering&&(e(i)||e(s.ref))&&s.filterImpact===h.NotChecked){const t=e(i)?i.mbs:e(s.ref)?s.ref.mbs:null;s.filterImpact=null!=t?this._computeNodeFiltering(t):h.Unmodified}const n=e(i)&&s.filterImpact===h.Culled,o=!(e(i)&&i.imModificationImpact===u.Culled)&&(!r||this.viewportQueries.isNodeVisible(r))&&!n;return s.visibilityCache=N(o,this._visibilityCacheVersion),o}return I(s.visibilityCache)}isGeometryVisible(t){if(!this.isNodeVisible(t))return!1;const i=this._getNodeInternal(t);return!(e(i)&&e(i.node)&&e(i.node.geometryObb)&&(!this.layerHasModifications||i.node.imModificationImpact!==u.NotChecked))||this.viewportQueries.isGeometryVisible(i.node)}_traverseCoverage(s,r,n,o,a){const d=this._getPage(s);if(t(d)||0===r.childCount)return;const l=r.childOffset+r.childCount,h=new Array;for(let t=r.childOffset;t<l;++t){const i=d.children[t],s=this._getNodeInternal(i);e(s)&&e(s.node)&&this.isGeometryVisible(i)&&h.push(s)}o/=h.length;for(const e of h){const t=i(e.node).index;this._isLoaded(t)||this._isReloading(t)?(a.delta=Math.max(a.delta,n),a.coverage+=o):this._traverseCoverage(t,e,n+1,o,a)}}useNodeAsHole(e){if("off"===this.holeFilling)return!1;const i=this._getNodeInternal(e);if(t(i))return!1;if("always"===this.holeFilling)return!0;if(x(i.useAsHole,this._version))return I(i.useAsHole);const s={delta:0,coverage:0};this._traverseCoverage(e,i,0,1,s);const r=s.delta*s.coverage<=.5;return i.useAsHole=N(r,this._version),r}get maxLevel(){return this._maxLevel}get dirty(){return this._dirty}destroy(){this._updates.add.prune(),this._updates.update.prune()}requestUpdate(){this._dirty=!0,this._indexMissing=1,this._version=P(this._version)}imModificationsChanged(t){this.layerHasModifications=t,this._forAllNodes((({node:t})=>{e(t)&&(t.imModificationImpact=u.NotChecked,t.visibilityObb=this._computeVisibilityObb(t),t.hasModifications&&this.invalidateGeometryVisibility(t.index))})),this.invalidateVisibilityCache()}layerFilterChanged(t){this._layerHasFilter=t,this._forAllNodes((t=>{if(e(t)){t.filterImpact=h.NotChecked;const i=t.node;e(i)&&this.invalidateNodeVisibilityCache(i.index)}})),this.invalidateVisibilityCache()}update(s,r,n){if(!this._dirty)return;this._pageQueue.length>0&&this._addQueuedPages(r),this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.NEGATIVE_INFINITY,this._missing.clear(),this._prefetch.clear(),this._updates.reset(s),v.clear();let o=!0;const a=new O,d=new O,l=this._imModificationUncategorized;l.clear();const h=new Set,c=(c,g,_)=>{if(t(g)){let e=this._entryPriority(c);e===1/0&&(e=this._entryPriority(_));const t=C(c,this.nodesPerPage);return v.set(t,Math.max(e,v.get(t)||0)),this._loading.has(t)||this._failedPages.has(t)||this._missing.push(t),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e))}const m=g.node;if(this._updateNodeFeatureEstimate(m,d),t(m)){const e=this._entryPriority(c);return this._loading.has(c)||this._failedNodes.has(c)||(this._missing.push(c),v.set(c,e)),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e))}const f=i(this._getPage(c));if(0===this._missing.length&&0===this.nodesPerPage)for(let t=0;t<g.childCount;t++){const i=f.children[g.childOffset+t],s=this._getNodeInternal(i);!e(s)||s.node||this._loading.has(i)||this._failedNodes.has(i)||(v.set(i,this._entryPriority(i)),this._prefetch.push(i))}if(m.failed)return;if(h.add(m.id),this._isLoaded(c)){if(a.known+=m.memory,++a.knownNodes,this._isSelected(m)?g.childCount>0&&(o=!1):(a.unremoved+=m.memory,o=!1),this._needsUpdate(m)){const e=this._entryPriority(c);v.set(c,e),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e),this._updates.update.push(c)}return}if(m.memory&&(a.known+=m.memory,++a.knownNodes),!this._isSelected(m))return void(this._isReloading(c)&&this._updates.remove.push(c));if(g.childCount>0&&(o=!1),m.memory?(a.missing+=m.memory,a.known+=m.memory,++a.knownNodes):++a.missingNodes,s.includes(m.index))return this._maxProcessingPrio=Math.max(this._maxProcessingPrio,this._entryPriority(c)),void(this._updates.cancel=this._updates.cancel.filter((e=>e!==m.index)));if(!r.done&&this._enable(m))return void r.madeProgress();const b=this._entryPriority(c);v.set(c,b),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,b),this._updates.add.push(c),this.layerHasModifications&&n&&e(m)&&m.imModificationImpact===u.NotChecked&&l.push(c)};this.traverseVisible(c);const g=this._updates.add;g.length>0&&this.layerHasModifications&&(l.length>0&&n(l),g.filterInPlace((e=>{const i=this._getNodeInternal(e),s=t(i)||t(i.node)||i.node.imModificationImpact!==u.Culled;return s||this.invalidateNodeVisibilityCache(e),s}))),this._unloadedMemoryEstimate=a.missing-a.unremoved,a.knownNodes>3&&a.missingNodes>0&&(this._unloadedMemoryEstimate+=a.known/a.knownNodes*a.missingNodes),this._unloadedMemoryEstimate=.8*Math.max(0,this._unloadedMemoryEstimate),this._featureEstimate.estimate=this._computeFeatureEstimate(d),this._featureEstimate.leavesReached=o,this._missing.sort(((e,t)=>e-t)),this._missing.filterInPlace(((e,t)=>t<1||this._missing.data[t-1]!==e)),this._missing.sort(((e,t)=>v.get(e)-v.get(t))),this._missing.length>0&&(this._maxUnloadedPrio=v.get(this._missing.back()),this._prefetch.clear()),this._updates.add.filterInPlace((e=>v.get(e)>=this._maxUnloadedPrio)).sort(((e,t)=>v.get(e)-v.get(t))),this._updates.update.sort(((e,t)=>v.get(e)-v.get(t))),this._indexMissing=this._loading.size+this._missing.length,this._dirty=this._indexMissing>0,v.clear()}checkFeatureTarget(e,t){const i=this.viewportQueries.updateScreenSpaceErrorBias(t);let s=t,r=t,n=i,o=10;for(;o--;){const i=new O;this._updateFeatureEstimate(s,i);if(this._computeFeatureEstimate(i)<=e){if(s>=t||i.missingNodes>0||0===o)break;n=s,s=.5*(s+r)}else r=s,s=.5*(s+n)}return this._version=P(this._version),this.viewportQueries.updateScreenSpaceErrorBias(i),Math.min(t,s)}_updateFeatureEstimate(t,i){this._version=P(this._version),this.viewportQueries.updateScreenSpaceErrorBias(t),this.traverseVisible(((t,s)=>this._updateNodeFeatureEstimate(e(s)&&s.node,i)))}_updateNodeFeatureEstimate(i,s){if(!(t(i)||i.failed||t(i.numFeatures)))return this._isLoaded(i.index)?(s.known+=i.numFeatures,++s.knownNodes,void(this._isSelected(i)||(s.unremoved+=i.numFeatures))):void(this._isSelected(i)&&(e(i.numFeatures)?(s.missing+=i.numFeatures,s.known+=i.numFeatures,++s.knownNodes):++s.missingNodes))}_computeFeatureEstimate(e){let t=e.known-e.unremoved;return e.knownNodes>3&&e.missingNodes>0&&(t+=e.known/e.knownNodes*e.missingNodes),Math.max(0,t)}load(){return this._load(this._missing)}prefetch(){return this._prefetch.sort(((e,t)=>v.get(e)-v.get(t))),this._load(this._prefetch)}_load(e){if(0===e.length||!this._canRequest())return!1;for(;e.length>0&&this._canRequest();)0===this.nodesPerPage?this._loadNode(e.pop()):this._loadPage(e.pop());return!0}isLoading(){return this._indexMissing>0}getIndexLoading(){return this._loading.size}getIndexMissing(){return this._indexMissing}getUnloadedMemoryEstimate(){return this._unloadedMemoryEstimate}get updates(){return this._updates}get featureEstimate(){return this._featureEstimate}nodeTraversalState(e){if(t(e))return null;let i=this._nodeTraversalState.get(e.index);if(i&&x(i.version,this._version))return i;const s=this.viewportQueries.getLodLevel(e),r=this.viewportQueries.hasLOD(e);let n=!0;if(r){const t=this.getParentIndex(e.index);if(t>=0){const e=this._nodeTraversalState.get(t);n=e&&s>e.lodLevel}else n=s>0}else n=0===e.childCount;return i?(i.lodLevel=s,i.isChosen=n,i.version=N(!0,this._version),i):(i=new c(r,n,s,N(!0,this._version)),this._nodeTraversalState.set(e.index,i),i)}_loadNode(e){this._loading.add(e);const s=i(this._getNodeInternal(e)).ref;if(t(s))return void this._failedNodes.add(e);const n=s.id,o=this.urlPrefix+n,a=()=>{this._loading.delete(e),0===this._missing.length&&0===this._loading.size&&this.requestUpdate()};this.streamDataController.request(o,"json").then((t=>{a();const i=this._validateNode(n,t);if(null==i)return;i.obb&&this.invalidateNodeVisibilityCache(e);const s=this._addNode(i,e);this.nodeTraversalState(s)}),(t=>{a(),r(t)||(this.logger.error("#loadNode()",this.logLayer,"Error loading node: "+o),this._failedNodes.add(e))}))}_validateNode(e,t){if(null==t||"object"!=typeof t||t.id!==e)return this.logger.error("#validateNode()",this.logLayer,`Invalid node. Wrong type or wrong id "${e}"`),null;if(!Array.isArray(t.mbs))return this.logger.error("#validateNode()",this.logLayer,`Invalid bounding volume on node ${e}.`),null;t.sharedResource&&"./shared"!==t.sharedResource.href&&"./shared/"!==t.sharedResource.href&&this.logger.warn("#validateNode()",this.logLayer,`Invalid shared resource href on node "${e}"`),null==t.geometryData||Array.isArray(t.geometryData)&&1===t.geometryData.length&&"./geometries/0"===t.geometryData[0].href||this.logger.warn("#validateNode()",this.logLayer,`Invalid geometry data on node "${e}"`),null==t.attributeData||Array.isArray(t.attributeData)&&!t.attributeData.some(((e,t)=>e.href!==`./attributes/f_${t}/0`))||this.logger.warn("#validateNode()",this.logLayer,`Invalid attribute data on node "${e}"`),t.featureData&&t.featureData.length>1&&this.logger.warn("#validateNode()",this.logLayer,`Node ${e} has ${t.featureData.length} bundles. Only the first bundle will be loaded.`);const i=t.hasOwnProperty("obb")&&!this.ignoreServiceObb?t.obb:null,s=t.featureData&&1===t.featureData.length&&t.featureData[0].featureRange?t.featureData[0].featureRange[1]-t.featureData[0].featureRange[0]+1:null,r=t=>{if(null==t)return null;const i=t=>this.logger.error("#validateNode()",this.logLayer,`Invalid node reference on node ${e}: ${t}`);if("number"==typeof t.id)i(`id ${t.id} is a number instead of a string.`);else if("string"!=typeof t.id||!Array.isArray(t.mbs))return i("Missing or invalid id."),null;if(!Array.isArray(t.mbs))return i(`Invalid bounding volume on reference ${t.id}.`),null;t.href&&t.href!=="../"+t.id&&this.logger.error("#validateNode()",this.logLayer,`Invalid node href on node "${e}"`);const s=t.hasOwnProperty("obb")&&!this.ignoreServiceObb?t.obb:null,r=new d(`${t.id}`,t.mbs);return r.serviceObb=s,r.visibilityObb=this._computeVisibilityObb(r),r},n=Array.isArray(t.children)?t.children.map(r).filter((e=>null!=e)):null;return{id:e,mbs:t.mbs,obb:i,children:n,resources:{hasFeatureData:t.featureData&&t.featureData.length>0,hasSharedResource:null!=t.sharedResource,attributes:t.attributeData?e:null,texture:t.textureData&&t.textureData.length>0?e:null,geometry:null!=t.geometryData?e:null},version:"string"==typeof t.version?t.version:null,lodSelection:Array.isArray(t.lodSelection)?t.lodSelection:null,numFeatures:s}}resetFailedNodes(){this._failedNodes.clear(),this._failedPages.clear(),this._forAllNodes((t=>{e(t.node)&&(t.node.failed=!1)}))}_entryPriority(i){const s=this._getNodeInternal(i),r=this.getParentIndex(i);if(t(s)||r<0&&null==s.node)return r<0?1/0:this._entryPriority(r);let n=0;if(s.node&&r>=0){const e=this._nodeTraversalState.get(r);null!=e&&(n=e.lodLevel)}let o=this.progressiveLoadPenalty;for(let e=i;e>=0;e=this.getParentIndex(e))if(this._isLoaded(e)){o=0;break}const a=e(s.ref)?this.viewportQueries.distToPOI(s.ref):e(s.node)?this.viewportQueries.distToPOI(s.node):0;return-a-n*(a+this.progressiveLoadPenalty)+o}traverseVisible(e){const i=this._getNodeInternal(this.rootIndex);t(i)?e(this.rootIndex,null,null):this._traverseVisible(this.rootIndex,-1,i,e)}_traverseVisible(t,s,r,n){if(r.node&&0===r.childCount)return void(this.isGeometryVisible(t)&&n(t,r,s));if(!this.isNodeVisible(t))return;if(n(t,r,s),null==r.node)return;const o=this.nodeTraversalState(r.node);if(o.nodeHasLOD&&o.lodLevel===this._maxLodLevel)return;const a=i(this._getPage(t));for(let i=0;i<r.childCount;i++){const s=a.children[r.childOffset+i],o=this._getNodeInternal(s);e(o)?this._traverseVisible(s,t,o,n):n(s,null,t)}}traverse(e,t){t(e)&&this.traverseChildren(e,t)}traverseChildren(t,i){const s=t.index,r=this._getNodeInternal(s);e(r)&&this._traverseChildren(s,r,i)}_traverseChildren(i,s,r){const n=this._getPage(i);if(t(n))return;const o=s.childOffset+s.childCount;for(let t=s.childOffset;t<o;++t){const i=n.children[t],s=this._getNodeInternal(i);e(s)&&e(s.node)&&r(s.node)&&this._traverseChildren(i,s,r)}}updateStats(e){if(this._updates.add.length>0&&(e.nodes+=" + "+this._updates.add.length),(this._indexMissing||this._prefetch.length>0)&&(e.index+=" + "+this._indexMissing||this._prefetch.length),e.prio=this._maxProcessingPrio,this._featureEstimate.estimate){const t=this._featureEstimate.estimate-e.features;t>0?e.features+=" + "+t:t<0&&(e.features+=" - "+-t)}}getPriority(){return Math.max(this._maxProcessingPrio,this._maxUnloadedPrio)}updateElevationInfo(e){this._forAllNodes(p),this.viewportQueries.updateElevationInfo(e)}_forAllNodes(e){for(let t=0;t<this._nodePages.length;t++){const i=this._nodePages[t];if(i){const s=t*this.nodesPerPage;for(let t=0;t<i.nodes.length;t++)e(i.nodes[t],s+t)}}}get test(){return{addNode:(e,t)=>this._addNode(e,t)}}}const v=new Map;class b{constructor(e){this.missing=e,this.update=new s({deallocator:null}),this.add=new s({deallocator:null}),this.remove=new s({deallocator:null}),this.cancel=[]}reset(e){this.add.clear(),this.update.clear(),this.cancel=e}}function p(t){e(t.node)&&(t.node.renderMbs[3]=-1,e(t.node.serviceObbInRenderSR)&&(t.node.serviceObbInRenderSR.halfSize[0]=-1)),e(t.ref)&&(t.ref.renderMbs[3]=-1,e(t.ref.serviceObbInRenderSR)&&(t.ref.serviceObbInRenderSR.halfSize[0]=-1))}function y(e){return g(e,-2)}function P(e){return g(e,2)}function N(e,t){return t+(e?1:0)}function x(e,t){return(-2&e)===t}function I(e){return 1==(1&e)}function C(e,t){return 0===t?0:e/t|0}function w(e,t){return 0===t?e:e%t}const M=[["maxScreenThreshold",a.MaxScreenThreshold],["screenSpaceRelative",a.ScreenSpaceRelative],["removedFeatureDiameter",a.RemovedFeatureDiameter],["distanceRangeFromDefaultCamera",a.DistanceRangeFromDefaultCamera]];function S(e){if(e)for(let t=0;t<e.length;t++)for(const i of M)if(i[0]===e[t].metricType)return{lodMetric:i[1],maxError:e[t].maxError};return{lodMetric:a.None,maxError:0}}class O{constructor(){this.known=0,this.knownNodes=0,this.missing=0,this.missingNodes=0,this.unremoved=0}}function L(e){return Math.sqrt(e*(4/Math.PI))}export{f as I3SIndex,S as selectErrorMetric};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import t from"../../../../core/Accessor.js";import{PositionHint as r,indexOf as s}from"../../../../core/arrayUtils.js";import i from"../../../../core/Logger.js";import{clamp as n}from"../../../../core/mathUtils.js";import{isNone as o,isSome as a}from"../../../../core/maybe.js";import{whenOnce as c}from"../../../../core/reactiveUtils.js";import{getUnitString as l}from"../../../../core/unitUtils.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as u}from"../../../../core/accessorSupport/decorators/subclass.js";import{t as f,a as d,s as g}from"../../../../chunks/vec3.js";import{WhereClause as h}from"../../../../core/sql/WhereClause.js";import{projectBoundingSphere as m,load as y,project as S,projectVectorToVector as j}from"../../../../geometry/projection.js";import{create as b}from"../../../../geometry/support/aaBoundingBox.js";import{fromValues as R,expandWithNestedArray as E,expand as w}from"../../../../geometry/support/aaBoundingRect.js";import{earth as I}from"../../../../geometry/support/Ellipsoid.js";import{project as T}from"../../../../geometry/support/webMercatorUtils.js";import D from"../../../../layers/support/FeatureFilter.js";import{objectIdFilter as C,filterInPlace as v}from"./I3SUtil.js";import A from"../../../../geometry/SpatialReference.js";const F=i.getLogger("esri.views.3d.layers.i3s.I3SMeshViewFilter");let
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import t from"../../../../core/Accessor.js";import{PositionHint as r,indexOf as s}from"../../../../core/arrayUtils.js";import i from"../../../../core/Logger.js";import{clamp as n}from"../../../../core/mathUtils.js";import{isNone as o,isSome as a}from"../../../../core/maybe.js";import{whenOnce as c}from"../../../../core/reactiveUtils.js";import{getUnitString as l}from"../../../../core/unitUtils.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as u}from"../../../../core/accessorSupport/decorators/subclass.js";import{t as f,a as d,s as g}from"../../../../chunks/vec3.js";import{WhereClause as h}from"../../../../core/sql/WhereClause.js";import{projectBoundingSphere as m,load as y,project as S,projectVectorToVector as j}from"../../../../geometry/projection.js";import{create as b}from"../../../../geometry/support/aaBoundingBox.js";import{fromValues as R,expandWithNestedArray as E,expand as w}from"../../../../geometry/support/aaBoundingRect.js";import{earth as I}from"../../../../geometry/support/Ellipsoid.js";import{project as T}from"../../../../geometry/support/webMercatorUtils.js";import D from"../../../../layers/support/FeatureFilter.js";import{objectIdFilter as C,filterInPlace as v}from"./I3SUtil.js";import A from"../../../../geometry/SpatialReference.js";const F=i.getLogger("esri.views.3d.layers.i3s.I3SMeshViewFilter");let M,_=class extends t{constructor(e){super(e),this._projectionEngineLoaded=!1}initialize(){c((()=>{var e;return null==(e=this.filter)?void 0:e.geometry})).then((()=>this.loadAsyncModule(k().then((e=>{this.destroyed||(this._geometryEngine=e,this.applyFilters())})))))}get sortedObjectIds(){if(o(this.filter.objectIds))return null;const e=new Float64Array(this.filter.objectIds);return e.sort(),e}get parsedWhereClause(){const e=a(this.filter)?this.filter.where:null;if(o(e)||!e)return null;try{return h.create(e,this.layerFieldsIndex)}catch(t){F.error(`Failed to parse filter where clause: ${t}`)}return null}addFilters(e,t,r,s){const i=this.sortedObjectIds;a(i)&&e.push((e=>C(i,!0,e))),this.addSqlFilter(e,this.parsedWhereClause);const n=this.parsedGeometry;if(a(n)){const i=this.spatialRelationship;e.push(((e,o)=>P(e,o,s,t,r,n,i)))}}isMBSGeoemtryVisible(e,t,r){const s=this.parsedGeometry;if(a(s)){const i=this.spatialRelationship,n=s[0].spatialReference||t;if(!m(e,r,K,n))return F.warnOnce("SceneLayerView.filter.geometry is using unsupported SpatialReference, skipping geometry filter for MBS"),!0;return L(K,s,n,i)}return!0}get parsedGeometry(){if(o(this.filter))return null;if(!this._geometryEngine)return null;const{geometry:e}=this.filter;if(o(e))return null;const{distance:t,units:r}=this.filter,s=this.spatialRelationship,i="mesh"===e.type?e.extent:e;if(o(t)||0===t)return B(i,s);const n=r||l(i.spatialReference);if(i.spatialReference.isWGS84){return B(this._geometryEngine.geodesicBuffer(i,t,n),s)}const c=T(i,A.WGS84);if(a(c)){return B(T(this._geometryEngine.geodesicBuffer(c,t,n),i.spatialReference),s)}if(!this._projectionEngineLoaded&&(this.loadAsyncModule(y().then((()=>this._projectionEngineLoaded=!0))),!this._projectionEngineLoaded))return null;let p=null;try{p=S(i,A.WGS84)}catch(u){}if(p)try{p=S(this._geometryEngine.geodesicBuffer(p,t,n),i.spatialReference)}catch(u){p=null}return p||F.error(`Filter by geodesic buffer (distance) unsupported, failed to project input geometry (${i.spatialReference.wkid}) to WGS84.`),B(p,s)}get spatialRelationship(){return a(this.filter)?this.filter.spatialRelationship:"intersects"}static checkSupport(e){return e.timeExtent?(F.warn("Filters with a timeExtent are not supported for mesh scene layers"),!1):!!G(e.spatialRelationship)||(F.warn(`Filters with spatialRelationship other than ${O.join(", ")} are not supported for mesh scene layers`),!1)}};function x(){return!!M}async function k(){return x()||(M=await import("../../../../geometry/geometryEngine.js")),M}e([p({type:D})],_.prototype,"filter",void 0),e([p()],_.prototype,"layerFieldsIndex",void 0),e([p()],_.prototype,"loadAsyncModule",void 0),e([p()],_.prototype,"applyFilters",void 0),e([p()],_.prototype,"addSqlFilter",void 0),e([p({readOnly:!0})],_.prototype,"sortedObjectIds",null),e([p({readOnly:!0})],_.prototype,"parsedWhereClause",null),e([p({readOnly:!0})],_.prototype,"parsedGeometry",null),e([p({readOnly:!0})],_.prototype,"spatialRelationship",null),e([p()],_.prototype,"_projectionEngineLoaded",void 0),e([p()],_.prototype,"_geometryEngine",void 0),_=e([u("esri.views.3d.layers.i3s.I3SMeshViewFilter")],_);const O=(e=>e)(["contains","intersects","disjoint"]);function G(e){return null!=e&&O.includes(e)}var W;function B(e,t){if(o(e))return null;if("disjoint"===t&&"polygon"===e.type){const t=new Array(e.rings.length);for(let r=0;r<e.rings.length;++r){const s=R(1/0,1/0,-1/0,-1/0);E(s,e.rings[r]),t[r]={type:"polygon",rings:[e.rings[r]],spatialReference:e.spatialReference,aabr:s}}t.sort(((e,t)=>e.aabr[0]-t.aabr[0]));const i=new Set,n=new r;for(let e=0;e<t.length;++e){const r=t[e];for(let s=e+1;s<t.length;++s){const e=t[s];if(e.aabr[0]>=r.aabr[2])break;i.add(e)}i.forEach((e=>{if(r!==e)if(e.aabr[2]<=r.aabr[0])i.delete(e);else if(M.intersects(r,e)){r.rings=r.rings.concat(e.rings),w(r.aabr,e.aabr,r.aabr),delete r._geVersion,i.delete(e);const o=s(t,e,t.length,n);t.splice(o,1)}})),i.add(r)}for(const e of t)delete e.aabr;return t}return[e]}function L(e,t,r,s){const i=U(e,r);return t.every((e=>q(e,i,s)!==W.DISCARD))}function P(e,t,r,s,i,n,o){const a=n[0].spatialReference||s.spatialReference;if(!m(t.node.mbs,i,K,a))return void F.warnOnce("SceneLayerView.filter.geometry is using unsupported SpatialReference, skipping geometry filter");const c=U(K,a),l=V(o,s,a,r,t.objectHandle);for(const p of n){if(0===e.length)return;switch(q(p,c,o)){case W.DISCARD:return void(e.length=0);case W.KEEP:continue}v(e,t.featureIds,(e=>z(p,e,l)))}}!function(e){e[e.KEEP=0]="KEEP",e[e.DISCARD=1]="DISCARD",e[e.TEST=2]="TEST"}(W||(W={}));const K=[0,0,0,0];function V(e,t,r,s,i){const n=t.renderSpatialReference,o=new Map,a={rings:[[[0,0,0],[0,0,0],[0,0,0],[0,0,0]]],hasZ:!1,hasM:!1,type:"polygon",spatialReference:r};a.rings[0][3]=a.rings[0][0];const c={indices:null,data:null,stride:0,startIndex:0,endIndex:0};let l,p;switch(e){case"intersects":l=(e,t)=>M.intersects(e,t)?W.KEEP:W.TEST,p=N;break;case"contains":l=(e,t)=>M.contains(e,t)?W.TEST:W.DISCARD,p=N;break;default:l=(e,t)=>M.disjoint(e,t)?W.TEST:W.DISCARD,p=Z}return{collection:s,object:i,type:e,maskSR:r,renderSR:n,aabbCache:o,triangle:a,positions:c,triangleTest:l,geometryTest:p}}function U(e,t){const r={x:e[0],y:e[1],hasZ:!1,hasM:!1,type:"point",spatialReference:t},s=!t.isWGS84&&!t.isWebMercator,i=Number.isNaN(e[3])?0:n(e[3],0,2*I.radius),o=s?M.buffer(r,i,1):M.geodesicBuffer(r,i,1);return o.type="polygon",o}function q(e,t,r){switch(r){case"intersects":case"contains":return N(e,t);case"disjoint":return Z(e,t)}}function N(e,t){return M.intersects(e,t)?M.contains(e,t)?W.KEEP:W.TEST:W.DISCARD}function Z(e,t){return M.intersects(e,t)?M.contains(e,t)?W.DISCARD:W.TEST:W.KEEP}const $=2**-32;function z(e,t,r){const{collection:s,object:i,renderSR:n,maskSR:o,geometryTest:a,aabbCache:c}=r;let l=c.get(t);if(!l){const e=s.getObjectTransform(i);s.getComponentAabb(i,t,H);const r=[[H[0],H[1],0],[H[0],H[4],0],[H[3],H[4],0],[H[3],H[1],0]];for(let t=0;t<4;++t)f(r[t],r[t],e.rotationScale),d(r[t],r[t],e.position),j(r[t],n,r[t],o);l={rings:[r],hasZ:!1,hasM:!1,type:"polygon",spatialReference:o},l.rings[0][4]=l.rings[0][0],c.set(t,l)}switch(a(e,l)){case W.DISCARD:return!1;case W.KEEP:return!0}const{triangle:p,triangleTest:u,positions:h}=r,m=p.rings[0][0],y=p.rings[0][1],S=p.rings[0][2],b=s.getObjectTransform(i);s.getComponentPositions(i,t,h);const{indices:R,data:E,stride:w,startIndex:I,endIndex:T}=h;for(let D=I;D<T;D+=3){const t=w*R[D+0],r=w*R[D+1],s=w*R[D+2];g(m,E[t+0],E[t+1],E[t+2]),g(y,E[r+0],E[r+1],E[r+2]),g(S,E[s+0],E[s+1],E[s+2]),f(m,m,b.rotationScale),f(y,y,b.rotationScale),f(S,S,b.rotationScale),d(m,m,b.position),d(y,y,b.position),d(S,S,b.position),j(m,n,m,o),j(y,n,y,o),j(S,n,S,o);const i=y[0]-m[0],a=y[1]-m[1],c=S[0]-m[0],l=S[1]-m[1];if(!(Math.abs(i*l-a*c)<$))switch(delete p._geVersion,u(e,p)){case W.DISCARD:return!1;case W.KEEP:return!0}}return"intersects"!==r.type}const H=b();export{_ as I3SMeshViewFilter};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{result as e,assertResult as t}from"../../../../core/asyncUtils.js";import r from"../../../../core/has.js";import{clone as i}from"../../../../core/lang.js";import{isNone as o,isSome as
|
|
5
|
+
import{result as e,assertResult as t}from"../../../../core/asyncUtils.js";import r from"../../../../core/has.js";import{clone as i}from"../../../../core/lang.js";import{isNone as o,isSome as n}from"../../../../core/maybe.js";import{eachAlways as s,isAbortError as a}from"../../../../core/promiseUtils.js";import{makeAbsolute as u}from"../../../../core/urlUtils.js";import{TextureEncoding as l}from"./enums.js";import{readBinaryAttribute as f,createGeometryDescriptor as d}from"./I3SBinaryReader.js";import{getMaterialAndTextures as c,getMaterialAndTexturesFromShared as m,selectEncoding as h}from"./I3SMaterialUtil.js";class g{constructor(e,t,r,i,o,n){if(this.streamDataController=t,this.logger=r,this.defaultGeometrySchema=i,this.requiredAttributes=o,this.options=n,this.logLayer=e,this.layerUrl=e.parsedUrl.path,this.geometryDefinitions=e.geometryDefinitions,e.materialDefinitions){const t=e.textureSetDefinitions;this.materialAndTextures=e.materialDefinitions.map((e=>c(t,e)))}}_load(e,t,r){return this.streamDataController.request(e,t,r)}_loadAttribute(e,t,r){const i=`${this.layerUrl}/nodes/${e.resources.attributes}/attributes/${t.key}/0`;return this._load(i,"binary",r).then((e=>f(t,e)))}loadAttributes(e,t,r){return s(t.map((t=>this._loadAttribute(e,t.attributeStorageInfo,r)))).then((r=>{const i={};for(let o=0;o<t.length;++o)if(r[o].value)i[t[o].name]=r[o].value;else{if(a(r[o].error))throw r[o].error;this.logger.error("#loadAttributes",this.logLayer,`Failed to load attributeData for '${t[o].name}' on node '${e.id}'`,r[o].error)}return i}))}async loadNodeData(r,i){const s=null!=this.requiredAttributes&&r.resources.attributes?e(this.loadAttributes(r,this.requiredAttributes,i)):null,{bufferDefinition:a,bufferIndex:u}=x(this.geometryDefinitions,r),l=!!r.resources.geometry,f=l?e(this._loadGeometry(r.resources.geometry,u,i)):null,c=r.resources.hasSharedResource?await this._loadShared(r,i):null,h=this.materialAndTextures&&r.resources.materialDefinition>=0?this.materialAndTextures[r.resources.materialDefinition]:null!=c?m(c):null,g=h&&h.material,A=h&&h.textures,_=`${r.id}`,w=!l&&this.options.loadFeatureData,T=w?await this._loadFeatureData(_,i):null,$=w?b(T):y(g),j=o($)&&D(T),I=null!=A&&A.length>0?e(this.loadTextures(r,A,i)):null;let U=null,S=null;if(f){U=t(await f);const e=p(this.defaultGeometrySchema,c);S=d(a,e)}const q=I?t(await I):null,v=s?t(await s):{},B=v?{attributeData:v,loadedAttributes:this.requiredAttributes}:null;if(n($))return{geometryData:$,attributeDataInfo:B,geometryBuffer:U,geometryDescriptor:S,requiredTextures:A,textureData:q};if(n(j))return{pointData:j,attributeDataInfo:B,geometryBuffer:U,geometryDescriptor:S,requiredTextures:A,textureData:q};throw new Error}static _addAbsoluteHrefTexture(e,t){const r=e.textureDefinitions;if(null!=r)for(const i of Object.keys(r))for(const e of r[i].images)Array.isArray(e.href)?e.hrefConcat=e.href.map((e=>u(e,t))):e.hrefConcat=u(e.href,t)}static _fixTextureEncodings(e){const t=e.textureDefinitions;if(null!=t)for(const r in t){const e=t[r];if(Array.isArray(e.encoding))for(let t=0;t<e.encoding.length;t++){const r=e.encoding[t];"data:"===r.substring(0,5)&&(e.encoding[t]=r.substring(5))}else{const t=e.encoding;"data:"===t.substring(0,5)&&(e.encoding=t.substring(5))}}}_loadShared(e,t){const r=`${this.layerUrl}/nodes/${e.resources.geometry}/shared`;return this._load(r,"json",t).then((e=>(g._fixTextureEncodings(e),g._addAbsoluteHrefTexture(e,r),e)))}_loadTexture(e,t,r,i,o,n){let s=!1;return o===l.DDS_S3TC||o===l.KTX2||o===l.Basis?this._load(e,"binary",n).then((e=>({id:t,usage:r,data:e,encoding:o,downsampled:s}))):this._load(e,"image",n).then((e=>{let n=e;const a=4096,u=2;if(i&&e.width*e.height>=a){const t=Math.ceil(e.width/u),r=Math.ceil(e.height/u),i=document.createElement("canvas");i.width=t,i.height=r;i.getContext("2d").drawImage(e,0,0,t,r),n=i,s=!0}return{id:t,usage:r,data:n,encoding:o,downsampled:s}}))}loadTextures(e,t,r){const i=this.options.uncompressedTextureDownsamplingEnabled,o=this.options.textureUsageMask;return Promise.all(t.map((t=>{if(0==(t.usage&o))return null;const n=h(t.encodings,this.options.textureEncodings);if(null==n)return this.logger.error("#loadTextures",this.logLayer,`No known encoding for texture found on node ${e.id}`),Promise.reject();const s=e.resources.texture||e.id,a=`${this.layerUrl}/nodes/${s}/textures/${n.name}`;return this._loadTexture(a,t.id,t.usage,i,n.encoding,r)})))}_loadFeatureData(e,t){const r=`${this.layerUrl}/nodes/${e}/features/0`;return this._load(r,"json",t)}_loadGeometry(e,t,r){const i=`${this.layerUrl}/nodes/${e}/geometries/${t}`;return this._load(i,"binary",r)}}function y(e){return{featureIds:[],geometries:[{type:"ArrayBufferView",params:{material:e}}],featureDataPosition:[0,0,0]}}function b(e){for(const t of e.featureData){const e=t.geometries;if(null!=e)for(const r of e)return{featureIds:[t.id],featureDataPosition:t.position,geometries:[r]}}return null}function D(e){const t=new Array;for(const r of e.featureData)null!=r.position&&t.push({featureIds:[r.id],featureDataPosition:r.position,geometries:null});return t}function p(e,t){if(!e||!t||!t.materialDefinitions)return e;const r=Object.keys(t.materialDefinitions)[0];return!t.materialDefinitions[r].params.vertexRegions&&e.vertexAttributes.region&&delete(e=i(e)).vertexAttributes.region,e}function x(e,t){const i={bufferDefinition:null,bufferIndex:0};if(null==e||t.resources.geometryDefinition<0)return i;const o=t.resources.geometryDefinition>=0?e[t.resources.geometryDefinition].geometryBuffers:null;if(null==o)return i;for(let n=0;n<o.length;n++){const e=o[n];if(null==e.compressedAttributes)i.bufferIndex=n,i.bufferDefinition=o[n];else if("draco"===e.compressedAttributes.encoding&&!r("disable-feature:i3s-draco"))return i.bufferIndex=n,i.bufferDefinition=e,i}return i}export{g as default};
|