@arcgis/core 6.0.0-next.54 → 6.0.0-next.56
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/WebScene.js +2 -2
- package/applications/Components/OrientedImageryViewer/shared/constants.js +1 -1
- package/applications/SceneViewer/sceneViewerUtils.js +1 -1
- package/arcade/arcadeAsyncRuntime.js +1 -1
- package/arcade/arcadeCompiler.js +1 -1
- package/arcade/arcadeRuntime.js +1 -1
- package/arcade/featureset/support/sqlUtils.js +1 -1
- package/arcade/validation/arcadeValidator.js +1 -1
- package/arcgisGlobal.d.ts +1 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0329fa3aa3403f1c243b.js +1 -0
- package/assets/esri/core/workers/chunks/033b9fcd9833db3b6e7d.js +1 -0
- package/assets/esri/core/workers/chunks/{6602310c3fcd91fb6a2f.js → 07c8ac092e4b9e8d5b3c.js} +1 -1
- package/assets/esri/core/workers/chunks/0978e12dd6a1cbc50b80.js +1 -0
- package/assets/esri/core/workers/chunks/0a97b1974367382cfdf5.js +1 -0
- package/assets/esri/core/workers/chunks/{db0a7671ab5cbe8afd72.js → 123661019bb69c53f2d3.js} +1 -1
- package/assets/esri/core/workers/chunks/{e956845255bce0910944.js → 1507297550c3cd1268e2.js} +1 -1
- package/assets/esri/core/workers/chunks/{1b41ba050cde068d2860.js → 193a73a2c7f4f8482c21.js} +1 -1
- package/assets/esri/core/workers/chunks/1c0f5c42331fb6fc26cb.js +1 -0
- package/assets/esri/core/workers/chunks/20acb6f3ed5140b6c6c6.js +1 -0
- package/assets/esri/core/workers/chunks/2cd2fcf4a37d180d5d5c.js +1 -0
- package/assets/esri/core/workers/chunks/2f9adf0b809ce8797ebf.js +1 -0
- package/assets/esri/core/workers/chunks/{afb4dfb89fbc8a342cc5.js → 3354f1fa90f8ce4c8fde.js} +1 -1
- package/assets/esri/core/workers/chunks/3982409149571a827390.js +1 -0
- package/assets/esri/core/workers/chunks/{9b458b0d1627f22fdd93.js → 3b11e4d2e69b7aea1d65.js} +1 -1
- package/assets/esri/core/workers/chunks/3d851710f7fcc27c5b60.js +2 -0
- package/assets/esri/core/workers/chunks/3e8d70039800f2395d66.js +1 -0
- package/assets/esri/core/workers/chunks/41694ee8990e799da225.js +1 -0
- package/assets/esri/core/workers/chunks/4d8539674fc2e4fea03c.js +1 -0
- package/assets/esri/core/workers/chunks/{12add2003631fa314f25.js → 5060be52a380fc4920f8.js} +1 -1
- package/assets/esri/core/workers/chunks/{2aa6be0b047a1b25a520.js → 53bbb9aa6e4e4a0a8121.js} +1 -1
- package/assets/esri/core/workers/chunks/{c6d82397044e403a1f61.js → 5954f02c3901b28d8e73.js} +1 -1
- package/assets/esri/core/workers/chunks/5ba6007c3c49a8153256.js +1 -0
- package/assets/esri/core/workers/chunks/5bdd95eeb8f34dbf26f2.js +2 -0
- package/assets/esri/core/workers/chunks/{4707aedcc1b3bdf5e987.js → 5c34d49a6c9cc34b7626.js} +1 -1
- package/assets/esri/core/workers/chunks/{ced5dfb2bf46fc5eac8c.js → 5e47026c681238038955.js} +2 -2
- package/assets/esri/core/workers/chunks/{2baf35b1b19482d603b5.js → 5f7505ada0991cfbdd84.js} +1 -1
- package/assets/esri/core/workers/chunks/{976303f47c342b9d1cc0.js → 62ddd3a82864e26f009a.js} +1 -1
- package/assets/esri/core/workers/chunks/69a09c6acb5ae03c67f6.js +1 -0
- package/assets/esri/core/workers/chunks/{542a9c414c99d84d52ab.js → 6a202ef9ba9b89e09153.js} +1 -1
- package/assets/esri/core/workers/chunks/{0826feebdca8a31eb630.js → 6ba6fece5c11fe2a6ace.js} +1 -1
- package/assets/esri/core/workers/chunks/{5eb69e2895e5aec81051.js → 6fd10891506925560443.js} +1 -1
- package/assets/esri/core/workers/chunks/7b156905d168bf973518.js +1 -0
- package/assets/esri/core/workers/chunks/7b6fd287e7043ad50f4e.js +1 -0
- package/assets/esri/core/workers/chunks/7baa49055bc31618b56e.js +1 -0
- package/assets/esri/core/workers/chunks/8570e3df90fb76a8741a.js +1 -0
- package/assets/esri/core/workers/chunks/{c3c0f24a9e0047232ae1.js → 8679dfc0c53355b6feb0.js} +1 -1
- package/assets/esri/core/workers/chunks/8a636dc51372e14c98f5.js +1 -0
- package/assets/esri/core/workers/chunks/{d14732a57c8e63948c60.js → 9117c9b720c9ba6e7a6e.js} +1 -1
- package/assets/esri/core/workers/chunks/{f7e33d37dd11fb08f3f8.js → 97107e64407fa6825620.js} +1 -1
- package/assets/esri/core/workers/chunks/{5118c7269b706089c88e.js → a05a2c2aaf0c288f9681.js} +1 -1
- package/assets/esri/core/workers/chunks/{944f17e9c9f681b971fb.js → a12e2a345005189c64be.js} +1 -1
- package/assets/esri/core/workers/chunks/a22458e5272332d86cb9.js +1 -0
- package/assets/esri/core/workers/chunks/{15b3386ad92a0b4149b8.js → a24dc5350af001db417a.js} +1 -1
- package/assets/esri/core/workers/chunks/{10967a36c77c5188690d.js → a66d6298236d59a615db.js} +1 -1
- package/assets/esri/core/workers/chunks/{3ea480cebf8ee56228a5.js → a7dfca326883384d2751.js} +1 -1
- package/assets/esri/core/workers/chunks/{723d8316f5d4b6ce2942.js → a9539393e2f1812a973a.js} +1 -1
- package/assets/esri/core/workers/chunks/{ac8d38016e4bee37a77c.js → ab784764ddf9d7f693a1.js} +1 -1
- package/assets/esri/core/workers/chunks/{255f5b45c4d32f97f86c.js → ac0861014b3d2f1a1de2.js} +1 -1
- package/assets/esri/core/workers/chunks/ace210d313ce53f3ae10.js +1 -0
- package/assets/esri/core/workers/chunks/ae48ee283cfa5b3c14b0.js +1 -0
- package/assets/esri/core/workers/chunks/b38b6fe08a367e9de4f5.js +1 -0
- package/assets/esri/core/workers/chunks/{4e651869e9a196494694.js → b6e628b5d2643af4c19b.js} +1 -1
- package/assets/esri/core/workers/chunks/{b37ab6b1cb4cfc85cd9d.js → b7828d7e2c5b75644057.js} +1 -1
- package/assets/esri/core/workers/chunks/bbd8fcb0bbba7bde3d9b.js +1 -0
- package/assets/esri/core/workers/chunks/{ec465abb0344ad719e9d.js → bd8e329ec74d921d311a.js} +1 -1
- package/assets/esri/core/workers/chunks/{56e6e70aa40e51827290.js → c3f94024c6c9eed9f273.js} +1 -1
- package/assets/esri/core/workers/chunks/{6d17b45022dfd2548098.js → c5ddf8b347c31fe772a3.js} +1 -1
- package/assets/esri/core/workers/chunks/{ee9af58ae202b803bba7.js → c7a0c4ca37ebd1d98cf1.js} +1 -1
- package/assets/esri/core/workers/chunks/d0659f1b0495734be4b3.js +1 -0
- package/assets/esri/core/workers/chunks/d7763c42754152510e13.js +2 -0
- package/assets/esri/core/workers/chunks/{b9a2b05ede02c305e865.js → d8ffb1502def5c85740b.js} +1 -1
- package/assets/esri/core/workers/chunks/{7dfe1e78d2e66de6be22.js → d9ef244019954d5a8a27.js} +1 -1
- package/assets/esri/core/workers/chunks/{95403bb27a4ea0a4b7b1.js → ddbfa664e69612295785.js} +1 -1
- package/assets/esri/core/workers/chunks/dfa1b0308e5e82d1ddfe.js +1120 -0
- package/assets/esri/core/workers/chunks/e566102c7ed7a8ebf89e.js +1 -0
- package/assets/esri/core/workers/chunks/e74586b074d0fa6abb4b.js +1 -0
- package/assets/esri/core/workers/chunks/e7dff025780726d5feae.js +1 -0
- package/assets/esri/core/workers/chunks/e96fa029acba59c04e4e.js +2 -0
- package/assets/esri/core/workers/chunks/{55d28d3f5b8ced061e39.js → eaf73ce60f39a48ddd2a.js} +1 -1
- package/assets/esri/core/workers/chunks/ed2f2a5da830d058e339.js +1 -0
- package/assets/esri/core/workers/chunks/{e592f2483db71230e8e5.js → efd6ea0966f60ab19520.js} +1 -1
- package/assets/esri/core/workers/chunks/{944cb751c85d3a127f49.js → f52d081bbde5c95265cf.js} +1 -1
- package/assets/esri/core/workers/chunks/{1de9be7b65109c207bd5.js → fbd5f3b81cd9f061824d.js} +1 -1
- package/assets/esri/core/workers/chunks/fdfbd201be372d3796bf.js +2 -0
- package/assets/esri/core/workers/chunks/ff0a0819bba5e8264c47.js +1 -0
- package/assets/esri/layers/raster/formats/blosc-wasm.wasm +0 -0
- package/assets/esri/libs/librust-parquet/pkg/parquet_bg.wasm +0 -0
- package/basemapGallery/support/basemapCompatibilityUtils.js +1 -1
- package/chunks/BlendLayers.glsl.js +1 -1
- package/chunks/ColorMaterial.glsl.js +14 -14
- package/chunks/Component.glsl.js +37 -37
- package/chunks/CypherParser.js +1 -1
- package/chunks/DefaultMaterial.glsl.js +15 -15
- package/chunks/GeodeticDistanceCalculator-zRp89-dW.js +1 -1
- package/chunks/HUDMaterial.glsl.js +3 -3
- package/chunks/MultiPathImpl.js +1 -1
- package/chunks/OperatorGeodesicBuffer.js +1 -1
- package/chunks/Path.glsl.js +15 -15
- package/chunks/Pattern.glsl.js +20 -20
- package/chunks/RasterColorizer.glsl.js +1 -1
- package/chunks/ShadowHighlight.glsl.js +1 -1
- package/chunks/Terrain.glsl.js +24 -24
- package/chunks/UnitFactory.js +1 -1
- package/chunks/Water.glsl.js +29 -20
- package/chunks/blosc-wasm.js +2 -0
- package/chunks/cameraUtilsSpherical.js +1 -1
- package/chunks/parquet.js +1 -1
- package/chunks/pdf.js +57 -0
- package/chunks/text.js +1 -1
- package/config.js +1 -1
- package/core/accessorSupport/write.js +1 -1
- package/core/scheduling.js +1 -1
- package/core/sql/SqlInterval.js +1 -1
- package/core/urlUtils.js +1 -1
- package/geometry/geometryEngine.js +1 -1
- package/geometry/operators/gx/operatorOffset.js +1 -1
- package/geometry/support/Ellipsoid.js +1 -1
- package/geometry/support/curves/ellipticArc7Utils.js +1 -1
- package/geometry/support/geodesicConstants.js +1 -1
- package/geometry/support/meshUtils/primitives.js +1 -1
- package/kernel.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/layers/effects/parser.js +1 -1
- package/layers/geospatialPDF/GeospatialPDFFrame.js +1 -1
- package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +1 -56
- package/layers/geospatialPDF/GeospatialPDFWorkerClient.js +1 -1
- package/layers/geospatialPDF/parserUtils.js +2 -0
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/parquet.js +1 -1
- package/layers/raster/datasets/ZarrRaster.js +1 -1
- package/layers/raster/datasets/wcsCoverageParser.js +1 -1
- package/layers/raster/formats/RasterCodec.js +1 -1
- package/layers/raster/formats/blosc.js +2 -0
- package/layers/support/BuildingFilter.js +1 -1
- package/layers/support/ControlPoint.js +1 -1
- package/layers/support/ControlPointsGeoreference.js +1 -1
- package/layers/support/IntegratedMeshSemantics.js +1 -1
- package/layers/support/commonProperties.js +1 -1
- package/layers/support/fieldUtils.d.ts +23 -87
- package/layers/support/fieldUtils.js +1 -1
- package/layers/support/geospatialPDFUtils.d.ts +63 -0
- package/layers/support/geospatialPDFUtils.js +2 -0
- package/layers/support/layersMapping.js +1 -1
- package/layers/video/VideoController.js +1 -1
- package/legend/ActiveLayerInfo.js +1 -1
- package/libs/ajv/ajv.bundle-wrapper.js +1 -1
- package/package.json +6 -6
- package/renderers/types.d.ts +1 -1
- package/rest/knowledgeGraphService.js +1 -1
- package/rest/query/operations/pbfFeatureServiceParser.js +1 -1
- package/smartMapping/statistics/support/attributeDensity.js +1 -1
- package/smartMapping/support/adapters/support/utils.js +1 -1
- package/support/tests/serviceMockDependencies.js +1 -1
- package/symbols/CIMSymbol.d.ts +9 -9
- package/symbols/PathSymbol3DLayer.d.ts +1 -1
- package/symbols/WaterSymbol3DLayer.d.ts +13 -1
- package/symbols/WaterSymbol3DLayer.js +1 -1
- package/symbols/cim/CIMEffects.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/symbols/cim/effects/EffectControlMeasureLine.js +1 -1
- package/symbols/cim/placements/PlacementInsidePolygon.js +1 -1
- package/symbols/cim/rasterizingUtils.js +1 -1
- package/views/2d/PaddedViewState.js +1 -1
- package/views/2d/engine/vectorTiles/buckets/FillBucket.js +1 -1
- package/views/2d/engine/vectorTiles/constants.js +1 -1
- package/views/2d/engine/vectorTiles/style/geoJSONVectorTileUtils.js +1 -1
- package/views/2d/engine/webgl/effects/HighlightEffect.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/segmentUtils.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/constants.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
- package/views/2d/interactive/editingTools/ControlPointsTransformTool.js +1 -1
- package/views/2d/interactive/editingTools/TransformTool.js +1 -1
- package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
- package/views/2d/layers/ParquetLayerView2D.js +1 -1
- package/views/2d/layers/features/Processor.js +1 -1
- package/views/2d/layers/features/aggregation/GridSpatialIndex.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/graphics/GraphicsView2D.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementPathHelper.js +1 -1
- package/views/3d/analysis/Dimension/DimensionTool.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/ElevationProfile/ElevationProfileLineSceneComputation.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightItemManipulatedObject3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedObserverManipulatedObject3D.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSnappingController.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillComputation.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementVisualization.js +1 -1
- package/views/3d/animation/pointToPoint/Camera.js +1 -1
- package/views/3d/camera/constraintUtils/tilt.js +1 -1
- package/views/3d/camera/constraintUtils.js +1 -1
- package/views/3d/camera/intersectionUtils.js +1 -1
- package/views/3d/environment/EnvironmentView.js +1 -1
- package/views/3d/focusAreaUtils.js +1 -1
- package/views/3d/input/handlers/ground/GroundNavigation.js +1 -1
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/interactive/Manipulator3DBase.js +1 -1
- package/views/3d/interactive/editingTools/ManipulatedObject3DGraphic.js +1 -1
- package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
- package/views/3d/interactive/editingTools/manipulations/config.js +1 -1
- package/views/3d/interactive/editingTools/media/MediaElementControllerControlPoints.js +1 -1
- package/views/3d/interactive/editingTools/media/MediaElementControllerShape.js +1 -1
- package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
- package/views/3d/interactive/editingTools/transform/ScaleRotateMeshAdapter.js +1 -1
- package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DView.js +1 -1
- package/views/3d/interactive/visualElements/Object3DVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
- package/views/3d/layers/DrapedSubView3D.js +1 -1
- package/views/3d/layers/DynamicLayerView3D.js +1 -1
- package/views/3d/layers/FeatureLikeLayerViewBase3D.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/GraphicsLayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/RouteLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/TiledLayerView3D.js +1 -1
- package/views/3d/layers/VectorTileLayerView3D.js +1 -1
- package/views/3d/layers/VoxelLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFrustumVisibility.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolFactory.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/LabelInfo.js +1 -1
- package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
- package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
- package/views/3d/layers/i3s/I3SNode.js +1 -1
- package/views/3d/layers/i3s/I3SOverrides.js +1 -1
- package/views/3d/layers/i3s/I3SUtil.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3DContext.js +1 -1
- package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
- package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
- package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
- package/views/3d/layers/support/Tiles3DBVH.js +1 -1
- package/views/3d/layers/support/Tiles3DLayerViewRegistration.js +1 -1
- package/views/3d/layers/support/createTileBVHForLayer.js +1 -1
- package/views/3d/layers/support/selectTiles3DSpatialReference.js +1 -1
- package/views/3d/layers/support/uvUtils.js +1 -1
- package/views/3d/state/Constraints.js +1 -1
- package/views/3d/state/ConstraintsManager.js +1 -1
- package/views/3d/state/NearFarHeuristic.js +1 -1
- package/views/3d/state/ViewState.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
- package/views/3d/state/controllers/PointToPointAnimationController.js +1 -1
- package/views/3d/state/controllers/RotateController.js +1 -1
- package/views/3d/state/controllers/ZoomControllerGlobal.js +1 -1
- package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
- package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/state/utils/OffsetCorrectionController.js +1 -1
- package/views/3d/state/utils/groundNavigationUtils.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/support/FrustumExtentIntersection.js +1 -1
- package/views/3d/support/QualityProfile.js +1 -1
- package/views/3d/support/QualitySettings.js +1 -1
- package/views/3d/support/RenderCoordsHelper.js +1 -1
- package/views/3d/support/SweptSphereVolume.js +1 -1
- package/views/3d/support/cameraUtils.js +1 -1
- package/views/3d/support/elevationUpdateExtentUtils.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/support/engineContent/marker.js +1 -1
- package/views/3d/support/flow/StreamlineResources3DShape.js +1 -1
- package/views/3d/support/hitTest.js +1 -1
- package/views/3d/support/orientedBoundingBox.js +1 -1
- package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
- package/views/3d/support/pointsOfInterest/SurfaceGeometryUpdates.js +1 -1
- package/views/3d/support/sunUtils.js +1 -1
- package/views/3d/terrain/BlendLayersTechniqueConfiguration.js +1 -1
- package/views/3d/terrain/ExtentHelper.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/PatchGeometryFactory.js +1 -1
- package/views/3d/terrain/RasterColorizerTechniqueConfiguration.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/terrain/TilingSchemeLogic.js +1 -1
- package/views/3d/terrain/terrainUtils.js +1 -1
- package/views/3d/webgl/RenderCamera.js +1 -1
- package/views/3d/webgl-engine/Stage.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticBVH.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticComponentGeometryBVH.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ElevationAgnosticBVH.js +1 -1
- package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/Component.glsl.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialRepository.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/clampShadowPosition.glsl.js +2 -0
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +14 -14
- package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/TileComposite.glsl.js +2 -3
- package/views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/MarsAtmosphere.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserlinePathData.js +1 -1
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/BufferGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/BufferObject3D.js +1 -1
- package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
- package/views/3d/webgl-engine/lib/Intersector.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/Program.js +1 -1
- package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
- package/views/3d/webgl-engine/lib/TextRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
- package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/strokes.js +1 -1
- package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultLayouts.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/Path.glsl.js +1 -1
- package/views/3d/webgl-engine/materials/PolygonOffset.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/Water.glsl.js +1 -1
- package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
- package/views/3d/webgl-engine/parts/Model.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Pattern.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
- package/views/Attribution.js +5 -5
- package/views/DOMContainer.d.ts +2 -1
- package/views/MapView.d.ts +1 -0
- package/views/SceneView.js +1 -1
- package/views/View2D.js +1 -1
- package/views/ViewingMode.js +1 -1
- package/views/analysis/ElevationProfile/elevationProfileChartBoundsUtils.js +1 -1
- package/views/analysis/ElevationProfile/elevationProfileGeometryUtils.js +1 -1
- package/views/draw/DrawAction.js +1 -1
- package/views/draw/DrawGraphicTool.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/draw/DrawTool.js +1 -1
- package/views/draw/SegmentDrawAction.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/helpMessageUtils.js +1 -1
- package/views/draw/support/managers/EditSessionManager.js +1 -1
- package/views/draw/support/surfaceCoordinateSystems.js +1 -1
- package/views/interactive/dragEventPipeline.js +1 -1
- package/views/interactive/editGeometry/EditGeometry.js +1 -1
- package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
- package/views/interactive/editGeometry/operations/AddOrUpdatePart.js +1 -1
- package/views/layers/support/editableLayerViews.js +1 -1
- package/views/overlay/TextOverlayItem.js +1 -1
- package/views/support/DefaultsFromMap.js +1 -1
- package/views/support/Scheduler.js +1 -1
- package/views/support/spatialReferenceSupport.js +1 -1
- package/views/webgl/Program.js +3 -3
- package/views/webgl/ShaderBuilder.js +23 -23
- package/views/webgl/ShaderTranspiler.js +2 -2
- package/webscene/Slide.js +1 -1
- package/webscene/VirtualLighting.d.ts +2 -4
- package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
- package/widgets/BasemapGallery/support/basemapCompatibilityUtils.js +1 -1
- package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +17 -1
- package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/inputUtils.d.ts +7 -0
- package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileLineView.js +1 -1
- package/widgets/ElevationProfile/support/chartUtils.js +1 -1
- package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/Legend/styles/card/ColorRamp.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Measurement.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageLocationWidget.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageMeasurementWidget.js +1 -1
- package/widgets/Search/support/layerSearchUtils.js +1 -1
- package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
- package/widgets/UtilityNetworkAssociations.js +1 -1
- package/widgets/Weather/WeatherViewModel.js +1 -1
- package/widgets/Weather/css.js +1 -1
- package/widgets/Weather.js +1 -1
- package/widgets/support/ContingentValuesManager.js +1 -1
- package/widgets/support/forms/types.d.ts +23 -1
- package/assets/esri/core/workers/chunks/021bd07b9a3e70598840.js +0 -1
- package/assets/esri/core/workers/chunks/032733b863426c5bde00.js +0 -1121
- package/assets/esri/core/workers/chunks/144f18a3dd2c8cf07cf7.js +0 -1
- package/assets/esri/core/workers/chunks/170e68624b71ac96de4a.js +0 -1
- package/assets/esri/core/workers/chunks/23fc1c1ed483ed3b2298.js +0 -1
- package/assets/esri/core/workers/chunks/2634927d26cb1139c6d0.js +0 -1
- package/assets/esri/core/workers/chunks/2d1b8154ee40afc9d40b.js +0 -1
- package/assets/esri/core/workers/chunks/2d3e977f3b75474d7ebc.js +0 -1
- package/assets/esri/core/workers/chunks/4a41bf3d1e2e9bb79771.js +0 -2
- package/assets/esri/core/workers/chunks/5f324d88785ffcb73ae0.js +0 -1
- package/assets/esri/core/workers/chunks/70695e0fb53018d48e7b.js +0 -2
- package/assets/esri/core/workers/chunks/723c9ad4c25be2b82476.js +0 -1
- package/assets/esri/core/workers/chunks/766a1357be2ed7f4e125.js +0 -1
- package/assets/esri/core/workers/chunks/817bf487df056da1e6ec.js +0 -1
- package/assets/esri/core/workers/chunks/89e55895683369b5277a.js +0 -1
- package/assets/esri/core/workers/chunks/8a820e303941b351de81.js +0 -1
- package/assets/esri/core/workers/chunks/8c94e987754b3919181e.js +0 -1
- package/assets/esri/core/workers/chunks/90d567e920b6982b402d.js +0 -1
- package/assets/esri/core/workers/chunks/919115788da38049aea7.js +0 -2
- package/assets/esri/core/workers/chunks/97cdcedfe853280f6258.js +0 -1
- package/assets/esri/core/workers/chunks/9ebc6026934400fc1e1f.js +0 -1
- package/assets/esri/core/workers/chunks/b33e7e74cf8fa3926617.js +0 -1
- package/assets/esri/core/workers/chunks/b4a325dcf50e276751d7.js +0 -1
- package/assets/esri/core/workers/chunks/bb2af16e55cb39163827.js +0 -1
- package/assets/esri/core/workers/chunks/be5857b0d1b00faf430b.js +0 -1
- package/assets/esri/core/workers/chunks/cd9100a7c8309dfa7569.js +0 -1
- package/assets/esri/core/workers/chunks/d5bb9f9b7b341c671525.js +0 -1
- package/assets/esri/core/workers/chunks/d96e63d66f7b1f4ea54a.js +0 -2
- package/assets/esri/core/workers/chunks/e3bcd2e356f75afc316a.js +0 -1
- package/assets/esri/core/workers/chunks/e507dfc4788295d9c244.js +0 -1
- package/assets/esri/core/workers/chunks/e58f51618251f74aaafd.js +0 -1
- package/assets/esri/core/workers/chunks/e80526571f1a34de3278.js +0 -1
- package/assets/esri/core/workers/chunks/e83806797979138fd22a.js +0 -1
- package/assets/esri/core/workers/chunks/ea71850ba87ae6038000.js +0 -1
- package/assets/esri/core/workers/chunks/f537a5e808dc546813c7.js +0 -1
- package/assets/esri/core/workers/chunks/fe811d651d201f698b8f.js +0 -2
- package/chunks/NativeLine.glsl.js +0 -8
- package/layers/geospatialPDF/geospatialPDFParserUtils.js +0 -2
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +0 -2
- package/views/3d/webgl-engine/shaders/NativeLine.glsl.js +0 -2
- package/views/3d/webgl-engine/shaders/NativeLineTechnique.js +0 -2
- package/views/3d/webgl-engine/shaders/NativeLineTechniqueConfiguration.js +0 -2
- /package/assets/esri/core/workers/chunks/{919115788da38049aea7.js.LICENSE.txt → 3d851710f7fcc27c5b60.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{fe811d651d201f698b8f.js.LICENSE.txt → 5bdd95eeb8f34dbf26f2.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{ced5dfb2bf46fc5eac8c.js.LICENSE.txt → 5e47026c681238038955.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{4a41bf3d1e2e9bb79771.js.LICENSE.txt → d7763c42754152510e13.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{d96e63d66f7b1f4ea54a.js.LICENSE.txt → e96fa029acba59c04e4e.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{70695e0fb53018d48e7b.js.LICENSE.txt → fdfbd201be372d3796bf.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{binaryIndexOf as e}from"../../../../core/arrayUtils.js";import t from"../../../../core/Error.js";import has from"../../../../core/has.js";import{invert as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as i,copy as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectVectorToVector as s}from"../../../../geometry/projection/projectVectorToVector.js";import{canProjectWithoutEngine as c}from"../../../../geometry/projectionUtils.js";import l from"../../../../geometry/SpatialReference.js";import{create as u,empty as d,expandPointInPlace as f,intersects as p}from"../../../../geometry/support/aaBoundingRect.js";import{fetchFeaturePopupFeatures as m}from"../../../../layers/support/featurePopupQueryUtils.js";import h from"../../../../request.js";import g from"../../../../rest/support/Query.js";import{spatialReferenceIncompatibleError as _}from"../../../support/layerViewUtils.js";import{Obb as v,compute as ee}from"../../support/orientedBoundingBox.js";import{emissiveStrengthDefault as y}from"../../webgl-engine/core/shaderLibrary/output/getEmissions.glsl.js";import{createSolidEdgeMaterial as b,createMaterialFromEdges as te}from"../support/edgeUtils.js";import{parseColorMixMode as x}from"../support/symbolColorUtils.js";import{readBinaryAttribute as S,getCachedAttributeValue as C}from"./I3SBinaryReader.js";import{computeGlobalTransformation as w}from"./I3SProjectionUtil.js";function T(e){return e?parseInt(e.slice(e.lastIndexOf(`/`)+1),10):void 0}function E(e){if(has(`disable-feature:i3s-draco`)||!e)return!1;for(let t of e)for(let e of t.geometryBuffers)if(e.compressedAttributes?.encoding===`draco`)return!0;return!1}function ne(e,t,n,r,i){n.traverse(t,t=>i.intersectsElevationUpdate(e,t)?(r(t),!0):!1)}function re(e,t,n){let r=0,i=0;for(let a=0;a<t.length&&r<e.length;a++)e[r]===t[a]&&(n(a)&&(e[i]=e[r],i++),r++);e.length=i}function ie(t,n,r){let i=0,a=0;for(;i<r.length;)e(t,r[i])>=0===n&&(r[a]=r[i],a++),i++;r.length=a}function ae(e,t){if(t.rotationScale[1]===0&&t.rotationScale[2]===0&&t.rotationScale[3]===0&&t.rotationScale[5]===0&&t.rotationScale[6]===0&&t.rotationScale[7]===0)return D[0]=(e[0]-t.position[0])/t.rotationScale[0],D[1]=(e[1]-t.position[1])/t.rotationScale[4],D[2]=(e[2]-t.position[0])/t.rotationScale[0],D[3]=(e[3]-t.position[1])/t.rotationScale[4],D}const D=u();function oe(e,t){let n=t.center[0],r=t.center[1],i=t.radius,a=e[0]-n,o=n-e[2],s=e[1]-r,c=r-e[3],l=Math.max(a,o,0),u=Math.max(s,c,0),d=l*l+u*u;return d>i*i?0:d>0?1:-Math.max(a,o,s,c)>i?3:2}function O(e,t,n){let r=[],i=n?.missingFields,a=n?.originalFields,o=!1;for(let n of e){let e=t?.get(n);e?(a?.push(n),r.push(e.name),n!==e.name&&(o=!0)):i?.push(n)}return n&&`hasMismatchedCasing`in n&&(n.hasMismatchedCasing=o),r}async function se(e,n,r,i,a,o){if(n.length===0)return[];let s=e.attributeStorageInfo;if(e.associatedLayer!=null)try{return await j(e.associatedLayer,n,i,o)}catch(t){if(e.associatedLayer.loaded)throw t}if(s){let t=k(e,n,r,a),c=e.parsedUrl.path;return await Promise.allSettled(t.map(t=>M(c,s,t.node,t.indices,i,e.apiKey,e.customParameters,o).then(e=>{for(let n=0;n<t.graphics.length;n++){let r=t.graphics[n],i=e[n];if(r.attributes)for(let e in r.attributes)e in i||(i[e]=r.attributes[e]);r.attributes=i}}))),n}throw new t(`scenelayer:no-attribute-source`,`This scene layer does not have a source for attributes available`)}function k({globalIdField:e},t,n,r){let i=new Map,a=[],o=r();for(let r of t){let t=r.attributes?.[n],s=t==null?r.getGlobalId():void 0;for(let n=0;n<o.length;n++){let c=o[n],l=A(c,t,e,s);if(l<0)continue;let u=i.get(c.node);u||(u={node:c.node,indices:[],graphics:[]},a.push(u),i.set(c.node,u)),u.indices.push(l),u.graphics.push(r);for(let e=n;e>0;e--)o[e]=o[e-1];o[0]=c;break}}return a}function A(e,t,n,r){if(t!=null&&typeof t==`number`)return e.featureIds.indexOf(t);if(r==null||n==null)return-1;let i=e.attributeInfo?.attributeData?.[n];return i?i.indexOf(r):-1}async function j(e,t,n,r){let i=[],a={hasMismatchedCasing:!1,originalFields:i},o=O(n,e.fieldsIndex,a),s=new g({outFields:[...o]});if(await m(e,t,s,{updateSourceAttributes:!0,...r}),!a.hasMismatchedCasing)return t;for(let e=0;e<t.length;e++){let n=t[e];if(n.attributes)for(let e=0;e<i.length;e++){let t=i[e],r=o[e];r in n.attributes&&(n.attributes[t]=n.attributes[r],delete n.attributes[r])}}return t}function M(e,t,n,r,i,a,o,s){return N(e,t,n.resources.attributes,r,i,a,o,s)}async function N(e,t,n,r,i,a,o,s){let c=[];for(let r of t)if(r&&i.includes(r.name)){let t=`${e}/nodes/${n}/attributes/${r.key}/0`;c.push({url:t,storageInfo:r})}let l=await Promise.allSettled(c.map(e=>h(e.url,{responseType:`array-buffer`,query:{...o,token:a},signal:s?.signal}).then(t=>S(e.storageInfo,t.data)))),u=[];for(let e of r){let t={};for(let n=0;n<l.length;n++){let r=l[n];if(r.status===`fulfilled`){let i=r.value;t[c[n].storageInfo.name]=C(i,e)}}u.push(t)}return u}function P(e){let n=e.store,r=n.indexCRS||n.geographicCRS,i=r===void 0?n.indexWKT:void 0;if(i){if(e.spatialReference){if(i!==e.spatialReference.wkt)throw new t(`layerview:store-spatial-reference-wkt-index-incompatible`,`The indexWKT of the scene layer store does not match the WKT of the layer spatial reference`,{})}else throw new t(`layerview:no-store-spatial-reference-wkt-index-and-no-layer-spatial-reference`,`Found indexWKT in the scene layer store but no layer spatial reference`,{})}let a=r?new l(T(r)):e.spatialReference;return a.equals(e.spatialReference)?e.spatialReference:a}function F(e){let n=e.store,r=n.vertexCRS||n.projectedCRS,i=r===void 0?n.vertexWKT:void 0;if(i){if(e.spatialReference){if(i!==e.spatialReference.wkt)throw new t(`layerview:store-spatial-reference-wkt-vertex-incompatible`,`The vertexWKT of the scene layer store does not match the WKT of the layer spatial reference`,{})}else throw new t(`layerview:no-store-spatial-reference-wkt-vertex-and-no-layer-spatial-reference`,`Found vertexWKT in the scene layer store but no layer spatial reference`,{})}let a=r?new l(T(r)):e.spatialReference;return a.equals(e.spatialReference)?e.spatialReference:a}function I(e,t,n){if(!c(e,t)||n===`local`&&!R(e,t))throw _(`scene layer`,e?.wkid,t?.wkid)}function L(e,n,r){if(e.serviceUpdateTimeStamp?.lastUpdate!==n.serviceUpdateTimeStamp?.lastUpdate||!r.isEmpty||e.associatedLayer?.url!==n.associatedLayer?.url)throw new t(`layerview:recycle-failed`,`Could not recycle layerview`)}function R(e,t){return e.equals(t)||e.isWGS84&&t.isWebMercator||e.isWebMercator&&t.isWGS84}function z(e,t,n){let r=P(e),i=F(e);I(r,t,n),I(i,t,n)}function B(e){return!(e.geometryType!=null&&e.geometryType!==`triangles`||e.topology!=null&&e.topology!==`PerAttributeArray`||e.vertexAttributes?.position==null)}function V(e){if(e.store?.defaultGeometrySchema==null||!B(e.store.defaultGeometrySchema))throw new t(`scenelayer:unsupported-geometry-schema`,`The geometry schema of this scene layer is not supported.`,{url:e.parsedUrl.path})}function H(e,t){z(e,t.spatialReference,t.viewingMode)}function U(e){return!(e.geometryType==null||e.geometryType!==`points`||e.topology!=null&&e.topology!==`PerAttributeArray`||e.encoding!=null&&e.encoding!==``&&e.encoding!==`lepcc-xyz`||e.vertexAttributes?.position==null)}function W(e){if(e.store?.defaultGeometrySchema==null||!U(e.store.defaultGeometrySchema))throw new t(`pointcloud:unsupported-geometry-schema`,`The geometry schema of this point cloud scene layer is not supported.`,{})}function G(e,t){I(e.spatialReference,t.spatialReference,t.viewingMode)}function ce(e){return e.type===`simple`||e.type===`class-breaks`||e.type===`unique-value`}function le(e){return e.type===`mesh-3d`}function ue(e){if(e==null||!ce(e)||(e.type===`unique-value`||e.type===`class-breaks`)&&e.defaultSymbol==null)return!0;let t=e.symbols;if(t.length===0)return!0;for(let e of t){if(!le(e)||e.symbolLayers.length===0)return!0;for(let t of e.symbolLayers.items)if(t.type!==`fill`||t.material?.color==null||t.material.colorMixMode!==`replace`)return!0}return!1}const de=b({color:[0,0,0,0],opacity:0});class K{constructor(){this.edgeMaterial=null,this.material=null,this.castShadows=!0}}function fe(e){let t=new K,n=!1,r=!1;for(let i of e.symbolLayers.items)if(i.type===`fill`&&i.enabled){let e=i.material,a=i.edges;if(e!=null&&!n){let r=e.color,a=x(e.colorMixMode),o={strength:e.emissive?.strength??y,source:+(e.emissive?.source===`color`)};t.material=r==null?{color:[1,1,1],alpha:1,colorMixMode:1,emissive:o}:{color:[r.r/255,r.g/255,r.b/255],alpha:r.a,colorMixMode:a,emissive:o},t.castShadows=i.castShadows,n=!0}a!=null&&!r&&(t.edgeMaterial=te(a,{}),r=!0)}return t.material||={color:[1,1,1],alpha:1,colorMixMode:1,emissive:{strength:y,source:0}},t}function q(e,t){return(e|0)+(t|0)|0}function pe(e,t,r,o,c,l,u){if(!l||l.length===0||t==null||!e.serviceMbsInIndexSR)return null;let m=w(e.serviceMbsInIndexSR,c,`none`,r,t);n($,m);let h=null,g=()=>{if(!h){if(h=me,d(Y),e.serviceObbInIndexSR!=null){e.serviceObbInIndexSR.transform(X,r,t,c,u),X.getCorners(h);for(let e of h)i(e,e,$),f(Y,e)}else{let n=e.serviceMbsInIndexSR;if(!n)return;let o=n.radius;s(n.center,r,Z,t),i(Z,Z,$),Z[2]+=c;for(let e=0;e<8;++e){let t=e&1?o:-o,n=e&2?o:-o,r=e&4?o:-o,i=h[e];a(i,[Z[0]+t,Z[1]+n,Z[2]+r]),f(Y,i)}}}},_=1/0,v=-1/0,y=e=>{if(e.type!==`replace`)return;let n=e.geometry;if(!n?.hasZ)return;d(J);let r=n.spatialReference||o,a=n.rings.reduce((e,n)=>n.reduce((e,n)=>(s(n,r,Z,t),i(Z,Z,$),f(J,Z),Math.min(Z[2],e)),e),1/0);g(),p(Y,J)&&(_=Math.min(_,a),v=Math.max(v,a))};if(l.forEach(e=>y(e)),_===1/0)return null;let b=(e,t,n)=>{i(Z,n,m),e[t]=Z[0],e[t+1]=Z[1],e[t+2]=Z[2],t+=24,n[2]=_,i(Z,n,m),e[t]=Z[0],e[t+1]=Z[1],e[t+2]=Z[2],t+=24,n[2]=v,i(Z,n,m),e[t]=Z[0],e[t+1]=Z[1],e[t+2]=Z[2]};for(let e=0;e<8;++e)b(Q.data,e*3,h[e]);return ee(Q)}const me=[o(),o(),o(),o(),o(),o(),o(),o()],J=u(),Y=u(),X=new v,Z=o(),Q={data:Array(72),size:3,exclusive:!0,stride:3},$=r();export{K as SymbolInfo,q as addWraparound,G as checkPointCloudLayerCompatibleWithView,W as checkPointCloudLayerValid,L as checkRecyclable,H as checkSceneLayerCompatibleWithView,V as checkSceneLayerValid,I as checkSpatialReference,z as checkSpatialReferences,pe as computeVisibilityObb,E as containsDraco,T as extractWkid,re as filterInPlace,O as findFieldsCaseInsensitive,ne as findIntersectingNodes,ae as getClipRect,P as getIndexCrs,fe as getSymbolInfo,F as getVertexCrs,oe as intersectBoundingRectWithMbs,R as isSupportedLocalModeProjection,ie as objectIdFilter,N as queryAttributesFromCachedAttributesId,ue as rendererNeedsTextures,de as transparentEdgeMaterial,se as whenGraphicAttributes};
|
|
2
|
+
import{binaryIndexOf as e}from"../../../../core/arrayUtils.js";import t from"../../../../core/Error.js";import has from"../../../../core/has.js";import{invert as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as i,transformMat4 as a,copy as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectVectorToVector as c}from"../../../../geometry/projection/projectVectorToVector.js";import{canProjectWithoutEngine as l}from"../../../../geometry/projectionUtils.js";import u from"../../../../geometry/SpatialReference.js";import{fromBuffer as d}from"../../../../geometry/support/aaBoundingBox.js";import{create as f,intersects as p,empty as m,expandPointInPlace as h}from"../../../../geometry/support/aaBoundingRect.js";import{fetchFeaturePopupFeatures as g}from"../../../../layers/support/featurePopupQueryUtils.js";import _ from"../../../../request.js";import v from"../../../../rest/support/Query.js";import{spatialReferenceIncompatibleError as y}from"../../../support/layerViewUtils.js";import{Obb as b,compute as ee}from"../../support/orientedBoundingBox.js";import{emissiveStrengthDefault as x}from"../../webgl-engine/core/shaderLibrary/output/getEmissions.glsl.js";import{createSolidEdgeMaterial as te,createMaterialFromEdges as S}from"../support/edgeUtils.js";import{parseColorMixMode as C}from"../support/symbolColorUtils.js";import{readBinaryAttribute as w,getCachedAttributeValue as ne}from"./I3SBinaryReader.js";import{computeGlobalTransformation as re}from"./I3SProjectionUtil.js";function T(e){return e?parseInt(e.slice(e.lastIndexOf(`/`)+1),10):void 0}function E(e){if(has(`disable-feature:i3s-draco`)||!e)return!1;for(let t of e)for(let e of t.geometryBuffers)if(e.compressedAttributes?.encoding===`draco`)return!0;return!1}function D(e,t,n,r,i){n.traverse(t,t=>i.intersectsElevationUpdate(e,t)?(r(t),!0):!1)}function O(e,t,n){let r=0,i=0;for(let a=0;a<t.length&&r<e.length;a++)e[r]===t[a]&&(n(a)&&(e[i]=e[r],i++),r++);e.length=i}function k(t,n,r){let i=0,a=0;for(;i<r.length;)e(t,r[i])>=0===n&&(r[a]=r[i],a++),i++;r.length=a}function ie(e,t){if(t.rotationScale[1]===0&&t.rotationScale[2]===0&&t.rotationScale[3]===0&&t.rotationScale[5]===0&&t.rotationScale[6]===0&&t.rotationScale[7]===0)return A[0]=(e[0]-t.position[0])/t.rotationScale[0],A[1]=(e[1]-t.position[1])/t.rotationScale[4],A[2]=(e[2]-t.position[0])/t.rotationScale[0],A[3]=(e[3]-t.position[1])/t.rotationScale[4],A}const A=f();function ae(e,t){let n=t.center[0],r=t.center[1],i=t.radius,a=e[0]-n,o=n-e[2],s=e[1]-r,c=r-e[3],l=Math.max(a,o,0),u=Math.max(s,c,0),d=l*l+u*u;return d>i*i?0:d>0?1:-Math.max(a,o,s,c)>i?3:2}function j(e,t,n){let r=[],i=n?.missingFields,a=n?.originalFields,o=!1;for(let n of e){let e=t?.get(n);e?(a?.push(n),r.push(e.name),n!==e.name&&(o=!0)):i?.push(n)}return n&&`hasMismatchedCasing`in n&&(n.hasMismatchedCasing=o),r}async function oe(e,n,r,i,a,o){if(n.length===0)return[];let s=e.attributeStorageInfo;if(e.associatedLayer!=null)try{return await N(e.associatedLayer,n,i,o)}catch(t){if(e.associatedLayer.loaded)throw t}if(s){let t=se(e,n,r,a),c=e.parsedUrl.path;return await Promise.allSettled(t.map(t=>P(c,s,t.node,t.indices,i,e.apiKey,e.customParameters,o).then(e=>{for(let n=0;n<t.graphics.length;n++){let r=t.graphics[n],i=e[n];if(r.attributes)for(let e in r.attributes)e in i||(i[e]=r.attributes[e]);r.attributes=i}}))),n}throw new t(`scenelayer:no-attribute-source`,`This scene layer does not have a source for attributes available`)}function se({globalIdField:e},t,n,r){let i=new Map,a=[],o=r();for(let r of t){let t=r.attributes?.[n],s=t==null?r.getGlobalId():void 0;for(let n=0;n<o.length;n++){let c=o[n],l=M(c,t,e,s);if(l<0)continue;let u=i.get(c.node);u||(u={node:c.node,indices:[],graphics:[]},a.push(u),i.set(c.node,u)),u.indices.push(l),u.graphics.push(r);for(let e=n;e>0;e--)o[e]=o[e-1];o[0]=c;break}}return a}function M(e,t,n,r){if(t!=null&&typeof t==`number`)return e.featureIds.indexOf(t);if(r==null||n==null)return-1;let i=e.attributeInfo?.attributeData?.[n];return i?i.indexOf(r):-1}async function N(e,t,n,r){let i=[],a={hasMismatchedCasing:!1,originalFields:i},o=j(n,e.fieldsIndex,a),s=new v({outFields:[...o]});if(await g(e,t,s,{updateSourceAttributes:!0,...r}),!a.hasMismatchedCasing)return t;for(let e=0;e<t.length;e++){let n=t[e];if(n.attributes)for(let e=0;e<i.length;e++){let t=i[e],r=o[e];r in n.attributes&&(n.attributes[t]=n.attributes[r],delete n.attributes[r])}}return t}function P(e,t,n,r,i,a,o,s){return F(e,t,n.resources.attributes,r,i,a,o,s)}async function F(e,t,n,r,i,a,o,s){let c=[];for(let r of t)if(r&&i.includes(r.name)){let t=`${e}/nodes/${n}/attributes/${r.key}/0`;c.push({url:t,storageInfo:r})}let l=await Promise.allSettled(c.map(e=>_(e.url,{responseType:`array-buffer`,query:{...o,token:a},signal:s?.signal}).then(t=>w(e.storageInfo,t.data)))),u=[];for(let e of r){let t={};for(let n=0;n<l.length;n++){let r=l[n];if(r.status===`fulfilled`){let i=r.value;t[c[n].storageInfo.name]=ne(i,e)}}u.push(t)}return u}function I(e){let n=e.store,r=n.indexCRS||n.geographicCRS,i=r===void 0?n.indexWKT:void 0;if(i){if(e.spatialReference){if(i!==e.spatialReference.wkt)throw new t(`layerview:store-spatial-reference-wkt-index-incompatible`,`The indexWKT of the scene layer store does not match the WKT of the layer spatial reference`,{})}else throw new t(`layerview:no-store-spatial-reference-wkt-index-and-no-layer-spatial-reference`,`Found indexWKT in the scene layer store but no layer spatial reference`,{})}let a=r?new u(T(r)):e.spatialReference;return a.equals(e.spatialReference)?e.spatialReference:a}function L(e){let n=e.store,r=n.vertexCRS||n.projectedCRS,i=r===void 0?n.vertexWKT:void 0;if(i){if(e.spatialReference){if(i!==e.spatialReference.wkt)throw new t(`layerview:store-spatial-reference-wkt-vertex-incompatible`,`The vertexWKT of the scene layer store does not match the WKT of the layer spatial reference`,{})}else throw new t(`layerview:no-store-spatial-reference-wkt-vertex-and-no-layer-spatial-reference`,`Found vertexWKT in the scene layer store but no layer spatial reference`,{})}let a=r?new u(T(r)):e.spatialReference;return a.equals(e.spatialReference)?e.spatialReference:a}function R(e,t,n){if(!l(e,t)||!n&&!B(e,t))throw y(`scene layer`,e?.wkid,t?.wkid)}function z(e,n,r){if(e.serviceUpdateTimeStamp?.lastUpdate!==n.serviceUpdateTimeStamp?.lastUpdate||!r.isEmpty||e.associatedLayer?.url!==n.associatedLayer?.url)throw new t(`layerview:recycle-failed`,`Could not recycle layerview`)}function B(e,t){return e.equals(t)||e.isWGS84&&t.isWebMercator||e.isWebMercator&&t.isWGS84}function V(e,t,n){let r=I(e),i=L(e);R(r,t,n),R(i,t,n)}function H(e){return!(e.geometryType!=null&&e.geometryType!==`triangles`||e.topology!=null&&e.topology!==`PerAttributeArray`||e.vertexAttributes?.position==null)}function U(e){if(e.store?.defaultGeometrySchema==null||!H(e.store.defaultGeometrySchema))throw new t(`scenelayer:unsupported-geometry-schema`,`The geometry schema of this scene layer is not supported.`,{url:e.parsedUrl.path})}function W(e,t){V(e,t.spatialReference,t.state.isGlobal)}function G(e){return!(e.geometryType==null||e.geometryType!==`points`||e.topology!=null&&e.topology!==`PerAttributeArray`||e.encoding!=null&&e.encoding!==``&&e.encoding!==`lepcc-xyz`||e.vertexAttributes?.position==null)}function K(e){if(e.store?.defaultGeometrySchema==null||!G(e.store.defaultGeometrySchema))throw new t(`pointcloud:unsupported-geometry-schema`,`The geometry schema of this point cloud scene layer is not supported.`,{})}function ce(e,t){R(e.spatialReference,t.spatialReference,t.state.isGlobal)}function le(e){return e.type===`simple`||e.type===`class-breaks`||e.type===`unique-value`}function ue(e){return e.type===`mesh-3d`}function de(e){if(e==null||!le(e)||(e.type===`unique-value`||e.type===`class-breaks`)&&e.defaultSymbol==null)return!0;let t=e.symbols;if(t.length===0)return!0;for(let e of t){if(!ue(e)||e.symbolLayers.length===0)return!0;for(let t of e.symbolLayers.items)if(t.type!==`fill`||t.material?.color==null||t.material.colorMixMode!==`replace`)return!0}return!1}const fe=te({color:[0,0,0,0],opacity:0});class q{constructor(){this.edgeMaterial=null,this.material=null,this.castShadows=!0}}function pe(e){let t=new q,n=!1,r=!1;for(let i of e.symbolLayers.items)if(i.type===`fill`&&i.enabled){let e=i.material,a=i.edges;if(e!=null&&!n){let r=e.color,a=C(e.colorMixMode),o={strength:e.emissive?.strength??x,source:+(e.emissive?.source===`color`)};t.material=r==null?{color:[1,1,1],alpha:1,colorMixMode:1,emissive:o}:{color:[r.r/255,r.g/255,r.b/255],alpha:r.a,colorMixMode:a,emissive:o},t.castShadows=i.castShadows,n=!0}a!=null&&!r&&(t.edgeMaterial=S(a,{}),r=!0)}return t.material||={color:[1,1,1],alpha:1,colorMixMode:1,emissive:{strength:x,source:0}},t}function me(e,t){return(e|0)+(t|0)|0}function he(e,t,n){let r=[];if(n==null)return r;for(let i of e){let e=i.geometry;if(i.type!==`replace`||!e?.hasZ)continue;let a=e.rings,o=new Float64Array(a.reduce((e,t)=>e+t.length,0)*3),s=e.spatialReference||t,l=0;for(let e of a)for(let t of e)c(t,s,Z,n),o.set(Z,l),l+=3;o.length>0&&r.push({vertices:o,bounds:d(o)})}return r}function ge(e,t,r,s,l,u){if(!l||l.length===0||t==null||!e.serviceMbsInIndexSR)return null;let d=re(e.serviceMbsInIndexSR,s,`none`,r,t);n($,d);let f=null,g=()=>{if(!f){if(f=_e,m(Y),e.serviceObbInIndexSR!=null){e.serviceObbInIndexSR.transform(X,r,t,s,u),X.getCorners(f);for(let e of f)a(e,e,$),h(Y,e)}else{let n=e.serviceMbsInIndexSR;if(!n)return;let i=n.radius;c(n.center,r,Z,t),a(Z,Z,$),Z[2]+=s;for(let e=0;e<8;++e){let t=e&1?i:-i,n=e&2?i:-i,r=e&4?i:-i,a=f[e];o(a,[Z[0]+t,Z[1]+n,Z[2]+r]),h(Y,a)}}}},_=1/0,v=-1/0,y=({vertices:e,bounds:t})=>{for(let e=0;e<2;++e){let n=$[e],r=$[e+4],i=$[e+8],a=$[e+12];J[e]=n*t[n<0?3:0]+r*t[r<0?4:1]+i*t[i<0?5:2]+a,J[e+2]=n*t[n<0?0:3]+r*t[r<0?1:4]+i*t[i<0?2:5]+a}if(g(),!p(Y,J))return;m(J);let n=1/0;for(let t=0;t<e.length;t+=3)i(Z,e[t],e[t+1],e[t+2]),a(Z,Z,$),h(J,Z),n=Math.min(n,Z[2]);p(Y,J)&&(_=Math.min(_,n),v=Math.max(v,n))};if(l.forEach(e=>y(e)),_===1/0)return null;let b=(e,t,n)=>{a(Z,n,d),e[t]=Z[0],e[t+1]=Z[1],e[t+2]=Z[2],t+=24,n[2]=_,a(Z,n,d),e[t]=Z[0],e[t+1]=Z[1],e[t+2]=Z[2],t+=24,n[2]=v,a(Z,n,d),e[t]=Z[0],e[t+1]=Z[1],e[t+2]=Z[2]};for(let e=0;e<8;++e)b(Q.data,e*3,f[e]);return ee(Q)}const _e=[s(),s(),s(),s(),s(),s(),s(),s()],J=f(),Y=f(),X=new b,Z=s(),Q={data:Array(72),size:3,exclusive:!0,stride:3},$=r();export{q as SymbolInfo,me as addWraparound,ce as checkPointCloudLayerCompatibleWithView,K as checkPointCloudLayerValid,z as checkRecyclable,W as checkSceneLayerCompatibleWithView,U as checkSceneLayerValid,R as checkSpatialReference,V as checkSpatialReferences,ge as computeVisibilityObb,E as containsDraco,T as extractWkid,O as filterInPlace,j as findFieldsCaseInsensitive,D as findIntersectingNodes,ie as getClipRect,I as getIndexCrs,pe as getSymbolInfo,L as getVertexCrs,ae as intersectBoundingRectWithMbs,B as isSupportedLocalModeProjection,k as objectIdFilter,he as projectVisibilityModifications,F as queryAttributesFromCachedAttributesId,de as rendererNeedsTextures,fe as transparentEdgeMaterial,oe as whenGraphicAttributes};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import"../../../../core/has.js";import{normalize as e,add as t,scale as n,length as r,set as i,equals as a,subtract as o,dot as s,len as c,sqrDist as l,copy as u,sub as d,scaleAndAdd as f,distance as p,squaredLength as m,squaredDistance as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as _}from"../../../../geometry/ellipsoidUtils.js";import v from"../../../../geometry/Point.js";import{projectBoundingRect as y}from"../../../../geometry/projection/projectBoundingRect.js";import{projectBoundingSphere as b}from"../../../../geometry/projection/projectBoundingSphere.js";import{getProjector as ee}from"../../../../geometry/projection/projectors.js";import te from"../../../../geometry/SpatialReference.js";import{getSphericalPCPF as x}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{create as ne,fromValues as S}from"../../../../geometry/support/aaBoundingRect.js";import{create as C,fromPoints as re,distance2 as ie}from"../../../../geometry/support/lineSegment.js";import{signedDistance as w,getNormal as T}from"../../../../geometry/support/plane.js";import{isPlateCarree as E,webMercatorValid as D}from"../../../../geometry/support/spatialReferenceUtils.js";import{Sphere as O}from"../../../../geometry/support/sphere.js";import{Frustum as ae}from"../../state/Frustum.js";import{groundNavigationConstants as oe}from"../../state/utils/groundNavigationUtils.js";import"../../support/elevationUpdateExtentUtils.js";import{Obb as k,computeOffsetObb as se}from"../../support/orientedBoundingBox.js";import{SweptSphereCylindricalVolume as ce,SphereGlobal as le,SweptSphereConicalVolume as ue}from"../../support/SweptSphereVolume.js";import{evaluateElevationAlignmentAtPoint as de}from"../graphics/elevationAlignmentUtils.js";import{ElevationContext as fe}from"../graphics/ElevationContext.js";import{createContextWithoutExpressionSupport as pe,extractExpressionInfo as me}from"../graphics/featureExpressionInfoUtils.js";import{intersectBoundingRectWithMbs as A}from"./I3SUtil.js";import{sphereToGeographicExtent as j,intersectsGeographicExtent as M}from"../../support/sphereExtentUtils.js";const N=1e5;class P{get _frustumPlanes(){return this._frustum.planes}constructor(e,t,n,r,i,a,o,s,c={}){this._indexSR=e,this._renderCoordsHelper=t,this._clippingArea=i,this._elevationProvider=a,this._viewingMode=o,this._options=c,this._viewDirection=g(),this._useFrustumCulling=!1,this._poi=g(),this._cameraPOIDirection=g(),this._elevationContext=null,this._checkBelowSegmentEnd=g(),this.minCenterDistance=1/0,this.maxCenterDistance=0,this.maxLodLevel=2,this._screenspaceErrorBias=c.screenspaceErrorBias||1,this._progressiveLoadFactor=c.progressiveLoadFactor||1,this._frustum=new ae(t),this.updateCamera(n,r);let l=this._renderCoordsHelper.spatialReference;this._renderSR=l,this._renderSRSphericalPCPF=x(l),this._isGlobalMode=this._viewingMode===1,this.elevationIntersectionSpatialReference=this._isGlobalMode?this._indexSR.isWebMercator?this._indexSR:this._elevationProvider.spatialReference:l,this.updateElevationInfo(s),this._isECEFOBBInLocalMode=this._indexSR.isWGS84&&(l.isWebMercator||E(l)),this._indexSREllipsoidRadius=_(this._indexSR).radius,this._indexSRSphericalPCPF=x(e),this._projectorIndexSRToIndexSRSphericalPCPF=ee(this._indexSR,this._indexSRSphericalPCPF),this._groundNavigationCheckDistance=oe.i3sNodeDownwardCheckDistanceInMeters/this._renderCoordsHelper.unitInMeters}updateElevationInfo(e){e==null?this._elevationContext=null:(this._elevationContext=fe.fromElevationInfo(e),this._elevationContext.setFeatureExpressionInfoContext(pe(me(e,!1))))}updateCamera(r,i){this._useFrustumCulling=i,e(this._viewDirection,r.viewForward),i&&this._frustum.update(r),this._halfScreenPixelSizePerDistance=r.screenPixelSizePerDistance/2,this._camPos=r.eye,this._updateCameraPOIDirection(),this.minCenterDistance=1/0,this.maxCenterDistance=0,t(this._checkBelowSegmentEnd,this._camPos,n(this._checkBelowSegmentEnd,this._renderCoordsHelper.worldUpAtPosition(this._camPos,this._checkBelowSegmentEnd),-this._groundNavigationCheckDistance))}setPointOfInterest(e){this._poi=e,this._updateCameraPOIDirection()}updateScreenSpaceErrorBias(e){let t=this._screenspaceErrorBias;return this._screenspaceErrorBias=e,t}updateClippingArea(e){this._clippingArea=e}expandElevationRange(e,t,n){if(this._elevationContext==null)return;let r=e.serviceMbsInIndexSR;if(!r)return;let i=this._elevationContext.mode===`relative-to-scene`?`scene`:`ground`,a=this._elevationProvider;if(a.getSphereElevationRange){let e=a.getSphereElevationRange(r,this._indexSR,i);if(e){n.expandElevationRange(e);return}}let[o,s,c]=r.center,l=a.getElevation(o,s,c,this._indexSR,i);l&&n.expandElevationRangeValues(l,l);let u=t?null:a.getRootElevationRange?.();u&&n.expandElevationRange(u)}calculateServiceMbsInRenderSR(e){let{serviceMbsInRenderSR:t}=e;if(t.isValid)return t;let{serviceMbsInIndexSR:n}=e;if(!n?.isValid)return t;let r=G;return b(n,this._indexSR,r,this._renderSR),e.updateServiceMbsInRenderSR(r)}intersectsElevationUpdate(e,t){if(this._isGlobalMode&&this._indexSR.isWebMercator){let n=t.serviceMbsInIndexSR;if(!n?.isValid)return!0;let[r,i]=D,a=i-r,o=e[2]-e[0]>=a,s=o?0:Math.round((n.center[0]-(e[0]+e[2])/2)/a)*a;return S(o?-1/0:e[0]+s,e[1],o?1/0:e[2]+s,e[3],K),A(K,n)!==0}let n=this.calculateServiceMbsInRenderSR(t);if(!n.isValid)return!0;if(!this._isGlobalMode)return A(e,n)!==0;let r=t.serviceMbsElevationUpdateExtent;return r[0]>r[2]&&(j(n,r),this.elevationIntersectionSpatialReference.isWebMercator&&Number.isFinite(r[0])&&(r[1]=Math.max(-90,r[1]),r[3]=Math.min(90,r[3]),y(r,te.WGS84,r,this.elevationIntersectionSpatialReference)||S(-1/0,-1/0,1/0,1/0,r))),M(e,r,this.elevationIntersectionSpatialReference)}_evaluateElevationAlignmentInIndexSR(e,t){return V.x=e[0],V.y=e[1],V.z=e[2],V.spatialReference=this._indexSR,de(V,this._elevationProvider,t,this._renderCoordsHelper)}calculateServiceMbsInRenderSRElevationAdjusted(e){let{serviceMbsInRenderSRElevationAdjusted:t}=e;if(t.isValid)return t;let{serviceMbsInIndexSR:n}=e,r=this.calculateServiceMbsInRenderSR(e);if(!r.isValid||!n?.isValid)return t;let i=G;i.copyFrom(r);let{_elevationContext:a}=this;if(a){let{minElevation:t}=e,{_renderCoordsHelper:r}=this,o=n.center,s=0;if(Number.isFinite(t)){let n=0,c=0,{maxElevation:l}=e,u=o[2];switch(a.mode){case`relative-to-ground`:case`relative-to-scene`:n=a.geometryZWithOffset(u,r)+t-u,c=l-t;break;case`on-the-ground`:n=t-u,c=l-t}s=n+.5*c,i.radius+=.5*c}else i.radius<N&&(s=this._evaluateElevationAlignmentInIndexSR(o,a)-o[2]);s&&ye(i,s,this._viewingMode)}return e.updateServiceMbsInRenderSRElevationAdjusted(i)}_isGlobalMbsContainingPlanetCenter(e){return this._viewingMode===1&&r(e.center)<=e.radius}calculateMbsConeInRenderSR(e){let{mbsConeInRenderSR:t}=e;if(t)return t;if(!e.elevationRangeValid)return null;let{minElevation:n,maxElevation:r}=e;if(!Number.isFinite(n)||!(n<r))return null;let i=this.calculateServiceMbsInRenderSR(e);if(!i.isValid)return null;let a=this._elevationContext;if(a?.mode===`relative-to-ground`||a?.mode===`relative-to-scene`){let t=e.serviceMbsInIndexSR;if(!t?.isValid)return null;let i=t.center[2],o=a.geometryZWithOffset(i,this._renderCoordsHelper);if(this._viewingMode===2)n+=o,r+=o;else{let e=o-i;n+=e,r+=e}}let o=this._renderCoordsHelper.referenceEllipsoid.radius,s=this._viewingMode===2?new ce(i,n,r):this._isGlobalMbsContainingPlanetCenter(i)?new le(i,o+n,o+r):new ue(i,o+n,o+r);return e.updateMbsConeInRenderSR(s)}getAndUpdateVisibilityObbInRenderSR(e){{let t=e.visibilityObbInRenderSR;if(t)return t}let t=this._indexSREllipsoidRadius*.01,{serviceMbsInIndexSR:n,serviceObbInIndexSR:r}=e;if(r==null||!n||!r.isValid||this._isECEFOBBInLocalMode&&(r.halfSizeX>t||r.halfSizeY>t||r.halfSizeZ>t))return null;{let t=e.serviceObbInRenderSR;if(t==null)t=new k,e.serviceObbInRenderSR=t;else if(t.isValid)return t;let a=n.radius,o=0,s=0,c=r.centerZ,l=this._renderCoordsHelper,u=this._elevationContext;if(u&&e.elevationRangeValid){let{minElevation:t,maxElevation:n}=e;switch(u.mode){case`relative-to-ground`:case`relative-to-scene`:o=u.geometryZWithOffset(c,l)+t-c,s=n-t;break;case`on-the-ground`:o=t-c,s=n-t}}else if(u&&a<N){let e=i(B,r.centerX,r.centerY,c);o=this._evaluateElevationAlignmentInIndexSR(e,u)-c}let d=s>0,f=d?z:t;return r.transform(f,this._indexSR,this._renderSR,o,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),d&&se(f,0,s,this._viewingMode,t),t}}getNodeObbInRenderSRIndependentOfElevationOffset(e){{let t=e.visibilityObbInRenderSR??e.serviceObbInRenderSR??null;if(t?.isValid)return t}let t=e.serviceObbInIndexSR;return t?this._viewingMode===2&&Math.max(t.halfSizeX,t.halfSizeY,t.halfSizeZ)>.2*this._indexSREllipsoidRadius?null:(t.transform(z,this._indexSR,this._renderSR,void 0,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),z):null}ensureElevationAgnosticBoundingVolume(e){return!e.elevationAgnosticBoundingVolume.valid&&e.level>0&&(this._viewingMode===1?this._updateElevationAgnosticBoundingVolumeGlobal(e):this._updateElevationAgnosticBoundingVolumeLocal(e)),e.elevationAgnosticBoundingVolume}_updateCameraPOIDirection(){a(this._poi,this._camPos)?this._cameraPOIDirection=this._viewDirection:(o(this._cameraPOIDirection,this._camPos,this._poi),e(this._cameraPOIDirection,this._cameraPOIDirection))}_updateElevationAgnosticBoundingVolumeGlobal(t){let n=this.getNodeObbInRenderSRIndependentOfElevationOffset(t),r=t.elevationAgnosticBoundingVolume,i=-1,a;if(n){let t=B;n.getCenter(t),e(t,t),a=t,n.getCorners(H);for(let n of H){e(n,n);let a=s(n,t);if(a<=0){r.invalidate();return}let o=Math.sqrt(Math.max(0,1-a*a));i=Math.max(i,o)}}else{let n=t.serviceMbsInRenderSR;if(!n.isValid){r.invalidate();return}let{center:o,radius:s}=n,l=c(o);if(l<s){r.invalidate();return}i=s/l,a=e(W,o)}r.set(a,i+we)}_updateElevationAgnosticBoundingVolumeLocal(e){let t=e.elevationAgnosticBoundingVolume,n=this.getNodeObbInRenderSRIndependentOfElevationOffset(e);if(n){let e=n.getCenter(B);e[2]=0;let r=0;n.getCorners(H);for(let t of H){t[2]=0;let n=l(e,t);r=Math.max(r,n)}t.set(e,Math.sqrt(r))}else{let n=e.serviceMbsInRenderSR;if(n.isValid){let e=u(B,n.center);e[2]=0,t.set(e,n.radius)}}}isNodeVisible(e,t=!1){if(!this._isMBSinClippingArea(this.calculateServiceMbsInRenderSR(e)))return!1;if(!this._useFrustumCulling||t&&this.isNodeCloseBelowCamera(e))return!0;let n=this.getAndUpdateVisibilityObbInRenderSR(e);return n?n.intersectsFrustumConservativeApproximation(this._frustumPlanes):this._frustum.intersectsSphere(this.calculateServiceMbsInRenderSRElevationAdjusted(e))}isNodeCloseBelowCamera(e){let t=this.getAndUpdateVisibilityObbInRenderSR(e);if(t?.isValid)return t.intersectSegment(this._camPos,this._checkBelowSegmentEnd);let n=this.calculateServiceMbsInRenderSRElevationAdjusted(e);if(!n.isValid)return!0;let r=re(this._camPos,this._checkBelowSegmentEnd,ge);return ie(r,n.center)<=n.radius**2}isElevationAgnosticBoundingVolumeVisible(e,t){return!this._useFrustumCulling||!e.valid?!0:e.intersectsFrustumConservative(this._frustum,this._viewingMode,1+t)?this._viewingMode!==1||this._isConeVisibleInFrustum(e):!1}_isConeVisibleInFrustum(t){let r=t.radius;if(r>Se)return!0;let i=this._frustumPlanes,{center:a,radius:o}=this._frustum.boundingSphere,c=t.getAxis(W),l=s(c,a),u=o+1,p=l-u,m=l+u;if(p<=0)return!0;let h=n(I,c,p),g=n(L,c,m),_=r/Math.sqrt(1-r*r);for(let t of i){let r=T(t),i=e(R,r),a=s(i,c);if(Math.abs(1-a)<Ce)continue;let o=_e;n(o,c,a),d(o,o,i),e(o,o);let l=ve;if(f(l,h,o,p*_),!(w(t,l)<=0)&&(f(l,g,o,m*_),!(w(t,l)<=0)))return!1}return!0}isObbVisibleIndependentOfElevation(e,t){if(!this._useFrustumCulling||!e.valid)return!0;let{center:r,radius:i}=this._frustum.boundingSphere,a=i+1,o=this._frustumPlanes,c=H;if(t.getCorners(c),this._viewingMode===1){let t=e.getAxis(W),i=s(t,r),l=i-a,u=i+a;if(l<=0)return!0;for(let e of o){let r=!0;for(let i of c){let a=s(i,t),o=U;if(n(o,i,l/a),w(e,o)<=0){r=!1;break}let c=U;if(n(c,i,u/a),w(e,c)<=0){r=!1;break}}if(r)return!1}}else{let e=r[2]-a,t=r[2]+a;for(let n of o){let r=!0,i=T(n),a=i[0],o=i[1],s=i[2],l=n[3];for(let n of c){let i=a*n[0]+o*n[1]+l;if(i+s*e<=0||i+s*t<=0){r=!1;break}}if(r)return!1}}return!0}isGeometryVisible(e,t){if(!this._useFrustumCulling)return!0;let n=e.geometryObbInRenderSR;return!n?.isValid||n.intersectsFrustumConservativeApproximation(this._frustumPlanes)||t&&n.intersectSegment(this._camPos,this._checkBelowSegmentEnd)}_isMBSinClippingArea(e){return this._clippingArea==null||A(this._clippingArea,e)!==0}_screenSpaceDiameterMbs(e,t){let n=this.calcCameraDistanceToSurfaceAndUpdateMinmaxWithCenterDistance(e);return n<0?be:t/n/this._halfScreenPixelSizePerDistance}calcCameraDistanceToSurfaceAndUpdateMinmaxWithCenterDistance(e){let t=this.calculateMbsConeInRenderSR(e);if(t==null)return this.calcCameraDistanceToSurfaceAndUpdateMinmaxWithSphere(e);let n=t.calculateSurfaceDistanceFromPoint(this._camPos),r=t.calculateCenterDistanceFromPoint(this._camPos);return this._updateMinMaxDistanceToCenter(r),n}calcCameraDistanceToSurfaceAndUpdateMinmaxWithSphere(e){return this.calcCameraDistanceToCenterAndUpdateMinmax(e)-this.calculateServiceMbsInRenderSRElevationAdjusted(e).radius}calcCameraDistanceToCenterAndUpdateMinmax(e){let t=this.calculateServiceMbsInRenderSRElevationAdjusted(e),n=p(t.center,this._camPos);return this._updateMinMaxDistanceToCenter(n),n}_calculateAngleDependentLoDForSphere(e,t){let n=d(he,e,this._camPos),i=r(e),a=r(n);if(i===0||a===0)return 1;let o=(Math.abs(s(e,n))/i+t)/a;return Math.min(1,o)}calcAngleDependentLoD(e){let t=this.calculateMbsConeInRenderSR(e);if(t==null){let{center:t,radius:n}=this.calculateServiceMbsInRenderSRElevationAdjusted(e);return this._calculateAngleDependentLoDForSphere(t,n)}let{center:i,radius:a}=this.calculateServiceMbsInRenderSR(e);if(this._viewingMode===2)u(q,i),q[2]=t.lowerCenterHeight,u(J,i),J[2]=t.upperCenterHeight;else{let e=r(i);if(e===0)return 1;n(q,i,t.lowerCenterHeight/e),n(J,i,t.upperCenterHeight/e)}let o=this._calculateAngleDependentLoDForSphere(q,a),c=this._calculateAngleDependentLoDForSphere(J,a);if(this._viewingMode===2)u(Y,i),Y[2]=Math.max(t.lowerCenterHeight,Math.min(t.upperCenterHeight,this._camPos[2]));else{let e=r(i);if(e===0)return Math.max(o,c);let a=Math.max(t.lowerCenterHeight,Math.min(t.upperCenterHeight,s(this._camPos,i)/e));n(Y,i,a/e)}return Math.max(o,c,this._calculateAngleDependentLoDForSphere(Y,a))}hasLOD(e){return e.lodMetric!==0}_getDistanceToSurfaceGlobeMode(e,i){let a=r(i.center),c=r(e)-a;n(q,e,s(e,i.center)/m(e));let l=h(i.center,q),u=i.radius;if(l<=u*u)return Math.abs(c);let d=n(q,i.center,1/a),f=u*u/(2*a),g=n(J,d,a-f),_=o(Y,e,g),v=o(Y,_,n(X,d,s(d,_))),y=t(Y,g,n(Y,v,u/r(v))),b=p(e,y);if(c>=Z){let t=o(J,e,y),n=s(t,d)/r(t);n<Q&&(n=$),b/=n}return b}_getDistanceToSurface(e,t){return this._isGlobalMode?this._getDistanceToSurfaceGlobeMode(e,t):F(e,t)}_applyGlobalFlatAngleCorrectionToConeDistance(e,t){t.calculateClosestCenterToPoint(this._camPos,X);let n=r(X);if(n===0||r(this._camPos)-n<Z)return e;let i=o(Y,this._camPos,X),a=r(i);if(a===0)return e;let c=s(i,X)/(a*n);return e/(c<Q?$:c)}calculateScreenSpaceRelativeSphere(e){let t=this.calculateServiceMbsInRenderSRElevationAdjusted(e),n=this._getDistanceToSurface(this._camPos,t),r=n+t.radius;return this._updateMinMaxDistanceToCenter(r),2*n*this._halfScreenPixelSizePerDistance}calculateScreenSpaceRelativeCone(e){let t=e.calculateCenterDistanceFromPoint(this._camPos);this._updateMinMaxDistanceToCenter(t);let n=e.calculateSurfaceDistanceFromPoint(this._camPos);return 2*(this._isGlobalMode?this._applyGlobalFlatAngleCorrectionToConeDistance(n,e):n)*this._halfScreenPixelSizePerDistance}_updateMinMaxDistanceToCenter(e){e>0?(this.minCenterDistance=Math.min(this.minCenterDistance,e),this.maxCenterDistance=Math.max(this.maxCenterDistance,e)):(this.minCenterDistance=0,this.maxCenterDistance=Math.max(this.maxCenterDistance,-e))}getLodLevel(e){if(e.lodMetric===0)return 0;if(e.childCount===0)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){let t=this._progressiveLoadFactor*this._screenspaceErrorBias,n=this._screenspaceErrorBias;return this.evaluateLODmetric(e,t)?this.evaluateLODmetric(e,n)?2:1:0}return this.evaluateLODmetric(e,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(e,t){switch(e.lodMetric){case 1:{let n=this._screenSpaceDiameterMbs(e,(e.serviceMbsInIndexSR?.radius??0)*t);return this._options.angleDependentLoD&&(n*=this.calcAngleDependentLoD(e)),n<e.maxError}case 2:{let n=this.calculateMbsConeInRenderSR(e),r=n?this.calculateScreenSpaceRelativeCone(n):this.calculateScreenSpaceRelativeSphere(e);return e.maxError*t<=r}case 3:return this._screenSpaceDiameterMbs(e,e.maxError)*t<xe;case 4:return this.calcCameraDistanceToSurfaceAndUpdateMinmaxWithCenterDistance(e)>e.maxError*t}return!1}distToCameraPOIRay(e){if(e==null)return 0;let t=this.calculateServiceMbsInRenderSRElevationAdjusted(e),n=t.center,r=s(n,this._cameraPOIDirection),i=r*r,a=m(n)-i;return Math.sqrt(a)-t.radius}distCameraToPOI(){return p(this._camPos,this._poi)}}function F(e,t){let n=e[0]-t.center[0],r=e[1]-t.center[1],i=e[2]-t.center[2],a=n*n+r*r,o=t.radius;if(a<=o*o)return Math.abs(i);let s=Math.sqrt(a)-o;return Math.sqrt(i*i+s*s)}const I=g(),L=g(),R=g(),z=new k,B=g(),V=new v,H=[g(),g(),g(),g(),g(),g(),g(),g()],he=g(),ge=C(),_e=g(),ve=g(),U=g(),W=g(),G=new O,K=ne(),q=g(),J=g(),Y=g(),X=g();function ye(e,t,i){if(i===2)e.center[2]+=t;else{let i=r(e.center);if(i===0){e.radius+=Math.abs(t);return}n(e.center,e.center,1+t/i)}}const be=.5*Number.MAX_VALUE,xe=10,Z=2e5,Q=.08,$=1e-4,Se=.9,Ce=.01,we=.001;export{P as default};
|
|
2
|
+
import"../../../../core/has.js";import{normalize as e,add as t,scale as n,length as r,set as i,equals as a,subtract as o,dot as s,len as c,sqrDist as l,copy as u,sub as d,scaleAndAdd as f,distance as p,squaredLength as m,squaredDistance as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as _}from"../../../../geometry/ellipsoidUtils.js";import v from"../../../../geometry/Point.js";import{projectBoundingRect as y}from"../../../../geometry/projection/projectBoundingRect.js";import{projectBoundingSphere as b}from"../../../../geometry/projection/projectBoundingSphere.js";import{getProjector as ee}from"../../../../geometry/projection/projectors.js";import te from"../../../../geometry/SpatialReference.js";import{getSphericalPCPF as x}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{create as ne,fromValues as S}from"../../../../geometry/support/aaBoundingRect.js";import{create as C,fromPoints as re,distance2 as ie}from"../../../../geometry/support/lineSegment.js";import{signedDistance as w,getNormal as T}from"../../../../geometry/support/plane.js";import{isPlateCarree as E,webMercatorValid as D}from"../../../../geometry/support/spatialReferenceUtils.js";import{Sphere as O}from"../../../../geometry/support/sphere.js";import{Frustum as ae}from"../../state/Frustum.js";import{groundNavigationConstants as oe}from"../../state/utils/groundNavigationUtils.js";import"../../support/elevationUpdateExtentUtils.js";import{Obb as k,computeOffsetObb as se}from"../../support/orientedBoundingBox.js";import{SphereGlobal as ce,SweptSphereConicalVolume as le,SweptSphereCylindricalVolume as ue}from"../../support/SweptSphereVolume.js";import{evaluateElevationAlignmentAtPoint as de}from"../graphics/elevationAlignmentUtils.js";import{ElevationContext as fe}from"../graphics/ElevationContext.js";import{createContextWithoutExpressionSupport as pe,extractExpressionInfo as me}from"../graphics/featureExpressionInfoUtils.js";import{intersectBoundingRectWithMbs as A}from"./I3SUtil.js";import{sphereToGeographicExtent as j,intersectsGeographicExtent as M}from"../../support/sphereExtentUtils.js";const N=1e5;class P{get _frustumPlanes(){return this._frustum.planes}constructor(e,t,n,r,i,a,o,s,c={}){this._indexSR=e,this._renderCoordsHelper=t,this._clippingArea=i,this._elevationProvider=a,this._isGlobal=o,this._options=c,this._viewDirection=g(),this._useFrustumCulling=!1,this._poi=g(),this._cameraPOIDirection=g(),this._elevationContext=null,this._checkBelowSegmentEnd=g(),this.minCenterDistance=1/0,this.maxCenterDistance=0,this.maxLodLevel=2,this._screenspaceErrorBias=c.screenspaceErrorBias||1,this._progressiveLoadFactor=c.progressiveLoadFactor||1,this._frustum=new ae(t),this.updateCamera(n,r);let l=this._renderCoordsHelper.spatialReference;this._renderSR=l,this._renderSRSphericalPCPF=x(l),this.elevationIntersectionSpatialReference=this._isGlobal?this._indexSR.isWebMercator?this._indexSR:this._elevationProvider.spatialReference:l,this.updateElevationInfo(s),this._isECEFOBBInLocalMode=this._indexSR.isWGS84&&(l.isWebMercator||E(l)),this._indexSREllipsoidRadius=_(this._indexSR).radius,this._indexSRSphericalPCPF=x(e),this._projectorIndexSRToIndexSRSphericalPCPF=ee(this._indexSR,this._indexSRSphericalPCPF),this._groundNavigationCheckDistance=oe.i3sNodeDownwardCheckDistanceInMeters/this._renderCoordsHelper.unitInMeters}updateElevationInfo(e){e==null?this._elevationContext=null:(this._elevationContext=fe.fromElevationInfo(e),this._elevationContext.setFeatureExpressionInfoContext(pe(me(e,!1))))}updateCamera(r,i){this._useFrustumCulling=i,e(this._viewDirection,r.viewForward),i&&this._frustum.update(r),this._halfScreenPixelSizePerDistance=r.screenPixelSizePerDistance/2,this._camPos=r.eye,this._updateCameraPOIDirection(),this.minCenterDistance=1/0,this.maxCenterDistance=0,t(this._checkBelowSegmentEnd,this._camPos,n(this._checkBelowSegmentEnd,this._renderCoordsHelper.worldUpAtPosition(this._camPos,this._checkBelowSegmentEnd),-this._groundNavigationCheckDistance))}setPointOfInterest(e){this._poi=e,this._updateCameraPOIDirection()}updateScreenSpaceErrorBias(e){let t=this._screenspaceErrorBias;return this._screenspaceErrorBias=e,t}updateClippingArea(e){this._clippingArea=e}expandElevationRange(e,t,n){if(this._elevationContext==null)return;let r=e.serviceMbsInIndexSR;if(!r)return;let i=this._elevationContext.mode===`relative-to-scene`?`scene`:`ground`,a=this._elevationProvider;if(a.getSphereElevationRange){let e=a.getSphereElevationRange(r,this._indexSR,i);if(e){n.expandElevationRange(e);return}}let[o,s,c]=r.center,l=a.getElevation(o,s,c,this._indexSR,i);l&&n.expandElevationRangeValues(l,l);let u=t?null:a.getRootElevationRange?.();u&&n.expandElevationRange(u)}calculateServiceMbsInRenderSR(e){let{serviceMbsInRenderSR:t}=e;if(t.isValid)return t;let{serviceMbsInIndexSR:n}=e;if(!n?.isValid)return t;let r=G;return b(n,this._indexSR,r,this._renderSR),e.updateServiceMbsInRenderSR(r)}intersectsElevationUpdate(e,t){if(this._isGlobal&&this._indexSR.isWebMercator){let n=t.serviceMbsInIndexSR;if(!n?.isValid)return!0;let[r,i]=D,a=i-r,o=e[2]-e[0]>=a,s=o?0:Math.round((n.center[0]-(e[0]+e[2])/2)/a)*a;return S(o?-1/0:e[0]+s,e[1],o?1/0:e[2]+s,e[3],K),A(K,n)!==0}let n=this.calculateServiceMbsInRenderSR(t);if(!n.isValid)return!0;if(!this._isGlobal)return A(e,n)!==0;let r=t.serviceMbsElevationUpdateExtent;return r[0]>r[2]&&(j(n,r),this.elevationIntersectionSpatialReference.isWebMercator&&Number.isFinite(r[0])&&(r[1]=Math.max(-90,r[1]),r[3]=Math.min(90,r[3]),y(r,te.WGS84,r,this.elevationIntersectionSpatialReference)||S(-1/0,-1/0,1/0,1/0,r))),M(e,r,this.elevationIntersectionSpatialReference)}_evaluateElevationAlignmentInIndexSR(e,t){return V.x=e[0],V.y=e[1],V.z=e[2],V.spatialReference=this._indexSR,de(V,this._elevationProvider,t,this._renderCoordsHelper)}calculateServiceMbsInRenderSRElevationAdjusted(e){let{serviceMbsInRenderSRElevationAdjusted:t}=e;if(t.isValid)return t;let{serviceMbsInIndexSR:n}=e,r=this.calculateServiceMbsInRenderSR(e);if(!r.isValid||!n?.isValid)return t;let i=G;i.copyFrom(r);let{_elevationContext:a}=this;if(a){let{minElevation:t}=e,{_renderCoordsHelper:r}=this,o=n.center,s=0;if(Number.isFinite(t)){let n=0,c=0,{maxElevation:l}=e,u=o[2];switch(a.mode){case`relative-to-ground`:case`relative-to-scene`:n=a.geometryZWithOffset(u,r)+t-u,c=l-t;break;case`on-the-ground`:n=t-u,c=l-t}s=n+.5*c,i.radius+=.5*c}else i.radius<N&&(s=this._evaluateElevationAlignmentInIndexSR(o,a)-o[2]);s&&ye(i,s,this._isGlobal)}return e.updateServiceMbsInRenderSRElevationAdjusted(i)}_isGlobalMbsContainingPlanetCenter(e){return this._isGlobal&&r(e.center)<=e.radius}calculateMbsConeInRenderSR(e){let{mbsConeInRenderSR:t}=e;if(t)return t;if(!e.elevationRangeValid)return null;let{minElevation:n,maxElevation:r}=e;if(!Number.isFinite(n)||!(n<r))return null;let i=this.calculateServiceMbsInRenderSR(e);if(!i.isValid)return null;let a=this._elevationContext;if(a?.mode===`relative-to-ground`||a?.mode===`relative-to-scene`){let t=e.serviceMbsInIndexSR;if(!t?.isValid)return null;let i=t.center[2],o=a.geometryZWithOffset(i,this._renderCoordsHelper);if(this._isGlobal){let e=o-i;n+=e,r+=e}else n+=o,r+=o}let o=this._renderCoordsHelper.referenceEllipsoid.radius,s=this._isGlobal?this._isGlobalMbsContainingPlanetCenter(i)?new ce(i,o+n,o+r):new le(i,o+n,o+r):new ue(i,n,r);return e.updateMbsConeInRenderSR(s)}getAndUpdateVisibilityObbInRenderSR(e){{let t=e.visibilityObbInRenderSR;if(t)return t}let t=this._indexSREllipsoidRadius*.01,{serviceMbsInIndexSR:n,serviceObbInIndexSR:r}=e;if(r==null||!n||!r.isValid||this._isECEFOBBInLocalMode&&(r.halfSizeX>t||r.halfSizeY>t||r.halfSizeZ>t))return null;{let t=e.serviceObbInRenderSR;if(t==null)t=new k,e.serviceObbInRenderSR=t;else if(t.isValid)return t;let a=n.radius,o=0,s=0,c=r.centerZ,l=this._renderCoordsHelper,u=this._elevationContext;if(u&&e.elevationRangeValid){let{minElevation:t,maxElevation:n}=e;switch(u.mode){case`relative-to-ground`:case`relative-to-scene`:o=u.geometryZWithOffset(c,l)+t-c,s=n-t;break;case`on-the-ground`:o=t-c,s=n-t}}else if(u&&a<N){let e=i(B,r.centerX,r.centerY,c);o=this._evaluateElevationAlignmentInIndexSR(e,u)-c}let d=s>0,f=d?z:t;return r.transform(f,this._indexSR,this._renderSR,o,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),d&&se(f,0,s,this._isGlobal,t),t}}getNodeObbInRenderSRIndependentOfElevationOffset(e){{let t=e.visibilityObbInRenderSR??e.serviceObbInRenderSR??null;if(t?.isValid)return t}let t=e.serviceObbInIndexSR;return t?!this._isGlobal&&Math.max(t.halfSizeX,t.halfSizeY,t.halfSizeZ)>.2*this._indexSREllipsoidRadius?null:(t.transform(z,this._indexSR,this._renderSR,void 0,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),z):null}ensureElevationAgnosticBoundingVolume(e){return!e.elevationAgnosticBoundingVolume.valid&&e.level>0&&(this._isGlobal?this._updateElevationAgnosticBoundingVolumeGlobal(e):this._updateElevationAgnosticBoundingVolumeLocal(e)),e.elevationAgnosticBoundingVolume}_updateCameraPOIDirection(){a(this._poi,this._camPos)?this._cameraPOIDirection=this._viewDirection:(o(this._cameraPOIDirection,this._camPos,this._poi),e(this._cameraPOIDirection,this._cameraPOIDirection))}_updateElevationAgnosticBoundingVolumeGlobal(t){let n=this.getNodeObbInRenderSRIndependentOfElevationOffset(t),r=t.elevationAgnosticBoundingVolume,i=-1,a;if(n){let t=B;n.getCenter(t),e(t,t),a=t,n.getCorners(H);for(let n of H){e(n,n);let a=s(n,t);if(a<=0){r.invalidate();return}let o=Math.sqrt(Math.max(0,1-a*a));i=Math.max(i,o)}}else{let n=t.serviceMbsInRenderSR;if(!n.isValid){r.invalidate();return}let{center:o,radius:s}=n,l=c(o);if(l<s){r.invalidate();return}i=s/l,a=e(W,o)}r.set(a,i+we)}_updateElevationAgnosticBoundingVolumeLocal(e){let t=e.elevationAgnosticBoundingVolume,n=this.getNodeObbInRenderSRIndependentOfElevationOffset(e);if(n){let e=n.getCenter(B);e[2]=0;let r=0;n.getCorners(H);for(let t of H){t[2]=0;let n=l(e,t);r=Math.max(r,n)}t.set(e,Math.sqrt(r))}else{let n=e.serviceMbsInRenderSR;if(n.isValid){let e=u(B,n.center);e[2]=0,t.set(e,n.radius)}}}isNodeVisible(e,t=!1){if(!this._isMBSinClippingArea(this.calculateServiceMbsInRenderSR(e)))return!1;if(!this._useFrustumCulling||t&&this.isNodeCloseBelowCamera(e))return!0;let n=this.getAndUpdateVisibilityObbInRenderSR(e);return n?n.intersectsFrustumConservativeApproximation(this._frustumPlanes):this._frustum.intersectsSphere(this.calculateServiceMbsInRenderSRElevationAdjusted(e))}isNodeCloseBelowCamera(e){let t=this.getAndUpdateVisibilityObbInRenderSR(e);if(t?.isValid)return t.intersectSegment(this._camPos,this._checkBelowSegmentEnd);let n=this.calculateServiceMbsInRenderSRElevationAdjusted(e);if(!n.isValid)return!0;let r=re(this._camPos,this._checkBelowSegmentEnd,ge);return ie(r,n.center)<=n.radius**2}isElevationAgnosticBoundingVolumeVisible(e,t){return!this._useFrustumCulling||!e.valid?!0:e.intersectsFrustumConservative(this._frustum,this._isGlobal,1+t)?!this._isGlobal||this._isConeVisibleInFrustum(e):!1}_isConeVisibleInFrustum(t){let r=t.radius;if(r>Se)return!0;let i=this._frustumPlanes,{center:a,radius:o}=this._frustum.boundingSphere,c=t.getAxis(W),l=s(c,a),u=o+1,p=l-u,m=l+u;if(p<=0)return!0;let h=n(I,c,p),g=n(L,c,m),_=r/Math.sqrt(1-r*r);for(let t of i){let r=T(t),i=e(R,r),a=s(i,c);if(Math.abs(1-a)<Ce)continue;let o=_e;n(o,c,a),d(o,o,i),e(o,o);let l=ve;if(f(l,h,o,p*_),!(w(t,l)<=0)&&(f(l,g,o,m*_),!(w(t,l)<=0)))return!1}return!0}isObbVisibleIndependentOfElevation(e,t){if(!this._useFrustumCulling||!e.valid)return!0;let{center:r,radius:i}=this._frustum.boundingSphere,a=i+1,o=this._frustumPlanes,c=H;if(t.getCorners(c),this._isGlobal){let t=e.getAxis(W),i=s(t,r),l=i-a,u=i+a;if(l<=0)return!0;for(let e of o){let r=!0;for(let i of c){let a=s(i,t),o=U;if(n(o,i,l/a),w(e,o)<=0){r=!1;break}let c=U;if(n(c,i,u/a),w(e,c)<=0){r=!1;break}}if(r)return!1}}else{let e=r[2]-a,t=r[2]+a;for(let n of o){let r=!0,i=T(n),a=i[0],o=i[1],s=i[2],l=n[3];for(let n of c){let i=a*n[0]+o*n[1]+l;if(i+s*e<=0||i+s*t<=0){r=!1;break}}if(r)return!1}}return!0}isGeometryVisible(e,t){if(!this._useFrustumCulling)return!0;let n=e.geometryObbInRenderSR;return!n?.isValid||n.intersectsFrustumConservativeApproximation(this._frustumPlanes)||t&&n.intersectSegment(this._camPos,this._checkBelowSegmentEnd)}_isMBSinClippingArea(e){return this._clippingArea==null||A(this._clippingArea,e)!==0}_screenSpaceDiameterMbs(e,t){let n=this.calcCameraDistanceToSurfaceAndUpdateMinmaxWithCenterDistance(e);return n<0?be:t/n/this._halfScreenPixelSizePerDistance}calcCameraDistanceToSurfaceAndUpdateMinmaxWithCenterDistance(e){let t=this.calculateMbsConeInRenderSR(e);if(t==null)return this.calcCameraDistanceToSurfaceAndUpdateMinmaxWithSphere(e);let n=t.calculateSurfaceDistanceFromPoint(this._camPos),r=t.calculateCenterDistanceFromPoint(this._camPos);return this._updateMinMaxDistanceToCenter(r),n}calcCameraDistanceToSurfaceAndUpdateMinmaxWithSphere(e){return this.calcCameraDistanceToCenterAndUpdateMinmax(e)-this.calculateServiceMbsInRenderSRElevationAdjusted(e).radius}calcCameraDistanceToCenterAndUpdateMinmax(e){let t=this.calculateServiceMbsInRenderSRElevationAdjusted(e),n=p(t.center,this._camPos);return this._updateMinMaxDistanceToCenter(n),n}_calculateAngleDependentLoDForSphere(e,t){let n=d(he,e,this._camPos),i=r(e),a=r(n);if(i===0||a===0)return 1;let o=(Math.abs(s(e,n))/i+t)/a;return Math.min(1,o)}calcAngleDependentLoD(e){let t=this.calculateMbsConeInRenderSR(e);if(t==null){let{center:t,radius:n}=this.calculateServiceMbsInRenderSRElevationAdjusted(e);return this._calculateAngleDependentLoDForSphere(t,n)}let{center:i,radius:a}=this.calculateServiceMbsInRenderSR(e);if(this._isGlobal){let e=r(i);if(e===0)return 1;n(q,i,t.lowerCenterHeight/e),n(J,i,t.upperCenterHeight/e)}else u(q,i),q[2]=t.lowerCenterHeight,u(J,i),J[2]=t.upperCenterHeight;let o=this._calculateAngleDependentLoDForSphere(q,a),c=this._calculateAngleDependentLoDForSphere(J,a);if(this._isGlobal){let e=r(i);if(e===0)return Math.max(o,c);let a=Math.max(t.lowerCenterHeight,Math.min(t.upperCenterHeight,s(this._camPos,i)/e));n(Y,i,a/e)}else u(Y,i),Y[2]=Math.max(t.lowerCenterHeight,Math.min(t.upperCenterHeight,this._camPos[2]));return Math.max(o,c,this._calculateAngleDependentLoDForSphere(Y,a))}hasLOD(e){return e.lodMetric!==0}_getDistanceToSurfaceGlobeMode(e,i){let a=r(i.center),c=r(e)-a;n(q,e,s(e,i.center)/m(e));let l=h(i.center,q),u=i.radius;if(l<=u*u)return Math.abs(c);let d=n(q,i.center,1/a),f=u*u/(2*a),g=n(J,d,a-f),_=o(Y,e,g),v=o(Y,_,n(X,d,s(d,_))),y=t(Y,g,n(Y,v,u/r(v))),b=p(e,y);if(c>=Z){let t=o(J,e,y),n=s(t,d)/r(t);n<Q&&(n=$),b/=n}return b}_getDistanceToSurface(e,t){return this._isGlobal?this._getDistanceToSurfaceGlobeMode(e,t):F(e,t)}_applyGlobalFlatAngleCorrectionToConeDistance(e,t){t.calculateClosestCenterToPoint(this._camPos,X);let n=r(X);if(n===0||r(this._camPos)-n<Z)return e;let i=o(Y,this._camPos,X),a=r(i);if(a===0)return e;let c=s(i,X)/(a*n);return e/(c<Q?$:c)}calculateScreenSpaceRelativeSphere(e){let t=this.calculateServiceMbsInRenderSRElevationAdjusted(e),n=this._getDistanceToSurface(this._camPos,t),r=n+t.radius;return this._updateMinMaxDistanceToCenter(r),2*n*this._halfScreenPixelSizePerDistance}calculateScreenSpaceRelativeCone(e){let t=e.calculateCenterDistanceFromPoint(this._camPos);this._updateMinMaxDistanceToCenter(t);let n=e.calculateSurfaceDistanceFromPoint(this._camPos);return 2*(this._isGlobal?this._applyGlobalFlatAngleCorrectionToConeDistance(n,e):n)*this._halfScreenPixelSizePerDistance}_updateMinMaxDistanceToCenter(e){e>0?(this.minCenterDistance=Math.min(this.minCenterDistance,e),this.maxCenterDistance=Math.max(this.maxCenterDistance,e)):(this.minCenterDistance=0,this.maxCenterDistance=Math.max(this.maxCenterDistance,-e))}getLodLevel(e){if(e.lodMetric===0)return 0;if(e.childCount===0)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){let t=this._progressiveLoadFactor*this._screenspaceErrorBias,n=this._screenspaceErrorBias;return this.evaluateLODmetric(e,t)?this.evaluateLODmetric(e,n)?2:1:0}return this.evaluateLODmetric(e,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(e,t){switch(e.lodMetric){case 1:{let n=this._screenSpaceDiameterMbs(e,(e.serviceMbsInIndexSR?.radius??0)*t);return this._options.angleDependentLoD&&(n*=this.calcAngleDependentLoD(e)),n<e.maxError}case 2:{let n=this.calculateMbsConeInRenderSR(e),r=n?this.calculateScreenSpaceRelativeCone(n):this.calculateScreenSpaceRelativeSphere(e);return e.maxError*t<=r}case 3:return this._screenSpaceDiameterMbs(e,e.maxError)*t<xe;case 4:return this.calcCameraDistanceToSurfaceAndUpdateMinmaxWithCenterDistance(e)>e.maxError*t}return!1}distToCameraPOIRay(e){if(e==null)return 0;let t=this.calculateServiceMbsInRenderSRElevationAdjusted(e),n=t.center,r=s(n,this._cameraPOIDirection),i=r*r,a=m(n)-i;return Math.sqrt(a)-t.radius}distCameraToPOI(){return p(this._camPos,this._poi)}}function F(e,t){let n=e[0]-t.center[0],r=e[1]-t.center[1],i=e[2]-t.center[2],a=n*n+r*r,o=t.radius;if(a<=o*o)return Math.abs(i);let s=Math.sqrt(a)-o;return Math.sqrt(i*i+s*s)}const I=g(),L=g(),R=g(),z=new k,B=g(),V=new v,H=[g(),g(),g(),g(),g(),g(),g(),g()],he=g(),ge=C(),_e=g(),ve=g(),U=g(),W=g(),G=new O,K=ne(),q=g(),J=g(),Y=g(),X=g();function ye(e,t,i){if(i){let i=r(e.center);if(i===0){e.radius+=Math.abs(t);return}n(e.center,e.center,1+t/i)}else e.center[2]+=t}const be=.5*Number.MAX_VALUE,xe=10,Z=2e5,Q=.08,$=1e-4,Se=.9,Ce=.01,we=.001;export{P as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{EventedAccessor as r}from"../../../../core/Evented.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/quatf64.js";import{set as a,transformQuatValues as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import c from"../../../../core/Logger.js";import{projectBoundingRect as l}from"../../../../geometry/projection/projectBoundingRect.js";import{projectBoundingSphere as u}from"../../../../geometry/projection/projectBoundingSphere.js";import{canProjectWithoutEngine as d}from"../../../../geometry/projectionUtils.js";import{create as f,allFinite as p,fromExtent as m}from"../../../../geometry/support/aaBoundingRect.js";import{getInfo as h}from"../../../../geometry/support/spatialReferenceUtils.js";import{Sphere as g}from"../../../../geometry/support/sphere.js";import{ElevationRange as _}from"../../support/ElevationRange.js";import{ElevationUpdateEvent as v}from"../../support/ElevationUpdateEvent.js";import{ProjectedElevationUpdateExtent as y,calculateElevationUpdateExtents as b,fullWorldElevationUpdateExtent as x,planetCenterProximityToleranceMeters as S}from"../../support/elevationUpdateExtentUtils.js";import{Intersector as C}from"../../webgl-engine/lib/Intersector.js";let w=class extends r{constructor(e){super(e),this._renderCoordsHelper=e.view.renderCoordsHelper,this._renderSR=this._renderCoordsHelper.spatialReference,this._layerElevationSource=e.layerElevationSource,this._projectedExtent=new y(this._renderCoordsHelper)}initialize(){this._intersector=new C(this.view.state.
|
|
2
|
+
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{EventedAccessor as r}from"../../../../core/Evented.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/quatf64.js";import{set as a,transformQuatValues as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import c from"../../../../core/Logger.js";import{projectBoundingRect as l}from"../../../../geometry/projection/projectBoundingRect.js";import{projectBoundingSphere as u}from"../../../../geometry/projection/projectBoundingSphere.js";import{canProjectWithoutEngine as d}from"../../../../geometry/projectionUtils.js";import{create as f,allFinite as p,fromExtent as m}from"../../../../geometry/support/aaBoundingRect.js";import{getInfo as h}from"../../../../geometry/support/spatialReferenceUtils.js";import{Sphere as g}from"../../../../geometry/support/sphere.js";import{ElevationRange as _}from"../../support/ElevationRange.js";import{ElevationUpdateEvent as v}from"../../support/ElevationUpdateEvent.js";import{ProjectedElevationUpdateExtent as y,calculateElevationUpdateExtents as b,fullWorldElevationUpdateExtent as x,planetCenterProximityToleranceMeters as S}from"../../support/elevationUpdateExtentUtils.js";import{Intersector as C}from"../../webgl-engine/lib/Intersector.js";let w=class extends r{constructor(e){super(e),this._renderCoordsHelper=e.view.renderCoordsHelper,this._renderSR=this._renderCoordsHelper.spatialReference,this._layerElevationSource=e.layerElevationSource,this._projectedExtent=new y(this._renderCoordsHelper)}initialize(){this._intersector=new C(this.view.state.isGlobal),this._intersector.options.store=0,this._intersector.options.normalRequired=!1}get spatialReference(){return this.view?.elevationProvider?.spatialReference}getElevation(e,t,n,r){let i=this._renderCoordsHelper,o=a(E,e,t,n);if(!i.toRenderCoords(o,r,o))return c.getLogger(this).error(`could not project point to compute elevation`),null;let{layerElevationSource:s,_intersector:l,intersectionHandler:u}=this,d=s.elevationRange;if(d==null||d.isEmpty)return null;let f=d.minElevation,p=d.maxElevation,m=Math.max(1,(p-f)/2),h=i.setAltitude(k,p+m,o),g=i.setAltitude(A,f-m,o);return l.reset(h,g,this.view.state.camera),u.intersectRay(l,null,h,g,null,!0),l.results.min.getIntersectionPoint(o)?i.getAltitude(o):null}getElevations(e,t,n){let{groundSpatialReference:r}=this.view;for(let i=0;i<t;++i){let t=i*3,a=e[t],o=e[t+1],s=this.getElevation(a,o,0,r);n(i,s)}}getSphereElevationRange(e,t){return u(e,t,T,this._renderSR),this._layerElevationSource.getElevationRange(T)}getRootElevationRange(){let e=this.layerElevationSource.fullExtent;return e?.hasZ?new _(e.zmin,e.zmax):null}notifyObjectsChanged(e){this._notifyObjectsChanged(e.length,t=>{for(let n of e)if(!t(n))break})}notifyObjectsChangedFunctional(e,t){this._notifyObjectsChanged(e,t)}notifyObjectChanged(e){this._notifyObjectsChanged(1,t=>{t(e)})}_notifyObjectsChanged(e,t){if(e===0)return;let n=this.spatialReference;if(n==null)return;if(!d(this._renderSR,n)){this._emitFullExtentElevationChange(n);return}let r=new Float64Array(4*e),i=!1,a=0;t(e=>this._computeObjectExtent(e,r,a,n)?(a++,!0):(i=!0,!1)),i?this._emitFullExtentElevationChange(n):this._emitElevationChangeEvents(r,n)}_computeObjectExtent(e,t,n,r){if(this.view.state.isGlobal&&P(e))return!1;let i=this._projectedExtent;return E[0]=e.centerX,E[1]=e.centerY,E[2]=e.centerZ,i.reset(E,e.radius,r),!this._expandExtent(e,i,r)||!p(i.extent)?!1:(t.set(i.extent,4*n),!0)}_emitElevationChangeEvents(e,t){for(let n of b(e,t))this._emitElevationChangeEvent(n,t)}_emitFullExtentElevationChange(e){let t=f(),n=this._layerElevationSource.fullExtent;if(n!=null&&l(m(n,M),n.spatialReference,t,e)&&p(t)){this._emitElevationChangeEvent(t,e);return}let r=h(e);r!=null&&this._emitElevationChangeEvent(x(e,r),e)}_emitElevationChangeEvent(e,t){let n=new v(t,e,this.intersectionHandler.isGround?`ground`:`scene`);this.emit(`elevation-change`,n)}_expandExtent(e,t,n){e.getCorners(O);for(let e=0;e<8;++e){let r=O[e];if(t.addRenderPoint(r,n)==null)return!1}for(let e=0;e<D.length;e+=2)if(!t.addRenderEdge(O[D[e]],O[D[e+1]],n))return!1;return!0}};e([t({constructOnly:!0})],w.prototype,`layerElevationSource`,void 0),e([t({constructOnly:!0})],w.prototype,`intersectionHandler`,void 0),e([t({constructOnly:!0})],w.prototype,`view`,void 0),e([t()],w.prototype,`spatialReference`,null),w=e([n(`esri.views.3d.layers.i3s.LayerElevationProvider`)],w);const T=new g,E=s(),D=[0,1,2,3,4,5,6,7,0,2,1,3,4,6,5,7,0,4,1,5,2,6,3,7],O=Array.from({length:8},()=>s()),k=s(),A=s(),j=i(),M=f(),N=s();function P(e){N[0]=-e.centerX,N[1]=-e.centerY,N[2]=-e.centerZ,e.getQuaternion(j),o(N,N,-j[0],-j[1],-j[2],j[3]);let t=Math.max(Math.abs(N[0])-e.halfSizeX,0),n=Math.max(Math.abs(N[1])-e.halfSizeY,0),r=Math.max(Math.abs(N[2])-e.halfSizeZ,0);return t*t+n*n+r*r<=S*S}export{w as LayerElevationProvider};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{property as n,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{filterInPlace as i}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{getEpsilon as a}from"../../../../core/libs/gl-matrix-2/math/common.js";import o from"../../../../core/Logger.js";import{getOrCreateMapValue as s}from"../../../../core/MapUtils.js";import{isAbortError as c,throwIfAborted as l}from"../../../../core/promiseUtils.js";import u from"../../../../core/ReactiveMap.js";import{on as d,watch as f}from"../../../../core/reactiveUtils.js";import{schedule as p}from"../../../../core/scheduling.js";import{signal as m}from"../../../../core/signal.js";import{sqlAnd as ee}from"../../../../core/sql.js";import{generateUID as h}from"../../../../core/uid.js";import{create as g,equals as _,clone as v,expand as y,toExtent as b,width as x,height as S}from"../../../../geometry/support/aaBoundingRect.js";import{getObjectId as C,DehydratedFeatureClass as w,hasVertices as T,computeAABR as te}from"../../../../layers/graphics/dehydratedFeatures.js";import{geometryKey as ne,transferGeometryKey as re,identicalTransferGeometry as ie,completeDehydratedFeatureFromTransfer as E}from"../../../../layers/graphics/transferFeatures.js";import D from"../../../../rest/support/QuantizationParameters.js";import O from"../../../../rest/support/Query.js";import{isGraphic as k}from"../../../../support/graphicInstanceUtils.js";import{ImmediateTask as A,TaskPriority as j}from"../../../support/Scheduler.js";import{tilesAreRelated as M}from"../../terrain/tileUtils.js";import{FeatureMemory as N}from"./FeatureMemory.js";import{MultiFeatureReference as P,SingleFeatureReference as F}from"./featureReference.js";import{failedFeatureCount as I,FeatureTile as L}from"./FeatureTile.js";import{virtualDisplayFilterHighlightTileId as R,virtualSnapshotTileId as z}from"./FeatureTileDescriptor.js";let B=class extends t{set maximumNumberOfFeatures(e){e||=1/0;let t=this._get(`maximumNumberOfFeatures`);e===t||e<1||(this._set(`maximumNumberOfFeatures`,e),this._maximumFeaturesUpdated(t,e))}set memoryFactor(e){this.memoryFactor!==e&&(this._set(`memoryFactor`,e),this._setDirty())}set lodFactor(e){this.lodFactor!==e&&(this._set(`lodFactor`,e),this._supportsResolution&&this.refetch())}get useTileCount(){return this._useTileCount&&this.context.query.queryFeatureCount!=null}set useTileCount(e){this._useTileCount=e,this.notifyChange(`useTileCount`)}get updating(){return this._dirty||!!this._pendingEdits||this._isFetching||(this.tileDescriptors?.updating??!1)}get readyToRun(){return this._dirty}get usedMemory(){return this._memory.usedMemory}get usedMemoryPerFeature(){return this._memory.usedMemoryPerFeature}get totalVertices(){let e=0;return this._featureTiles.forEach(t=>e+=t.numVertices),e}get totalFeatures(){let e=0;return this._featureTiles.forEach(t=>e+=t.numFeatures),e}get showsAllFeatures(){if(this._paused||this.dataUpdating)return!1;for(let e of this._featureTiles.values())if(!this.hasFullGeometries&&e.emptyFeatureRatio!==0||!e.showsAllFeatures)return!1;return!0}get hasFullGeometries(){return!this._supportsResolution||this.tileDescriptors?.some(V)||!this.context.capabilities.supportsQuantization&&this.context.geometryType!==`polyline`}set filterExtent(e){if(e!=null&&this.context.tilingScheme&&!e.spatialReference.equals(this.context.tilingScheme.spatialReference)){o.getLogger(this).error(`#filterExtent=`,`extent needs to be in the same spatial reference as the tiling scheme`);return}let t=this._get(`filterExtent`);if(t===e||t!=null&&e&&t.equals(e))return;let n=e==null?null:e.clone();this._set(`filterExtent`,n),this._reclip(n,t)}_updateTileZQuantization(e){if(this.context.viewingMode===1){let t=e.computeZQuantizationFactor();this._zQuantizationFactor.value<t&&(this._zQuantizationFactor.value=t)}}get _tileZQuantization(){return this.context.isDraped?1:this._zQuantizationFactor.value}constructor(e){super(e),this._useTileCount=!1,this.dataUpdating=!1,this.updatingTotal=0,this.updatingRemaining=0,this.expectedFeatureDiff=0,this.maximumNumberOfFeaturesExceeded=!1,this._fullRatio=1,this._farRatio=1,this._zQuantizationFactor=m(1),this._changes={updates:{adds:[],removes:[]},adds:[],removes:[]},this._featureTiles=new u,this._displayingFeatureReferences=new Map,this._numDisplayingFeatureReferences=0,this._memory=new N(ne),this._dirty=!1,this._suspended=!0,this._pendingEdits=null,this._applyEditsTilesUpdated=!1,this.snappingComplexityExceeded=!0,this._isFetching=!1;let t=e.context;this._frameTask=t.scheduler?.registerTask(j.FEATURE_TILE_FETCHER,this)??A,this.FeatureReferenceClass=t.capabilities.supportsMultipleResolutions?P:F,this._objectIdField=t.objectIdField}initialize(){this.addHandles([d(()=>this.tileDescriptors,`change`,()=>this._setDirty(),{onListenerAdd:()=>this._setDirty(),onListenerRemove:()=>this._setDirty()}),f(()=>this._tileZQuantization,()=>this.refetch())]),this._setDirty()}destroy(){this._frameTask.remove(),this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._removeTile(e)}),this._featureTiles.clear(),this._displayingFeatureReferences.clear(),this._pendingEdits?.controller.abort(),this._pendingEdits=null}get _paused(){return this._suspended||!!this._pendingEdits}restart(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._clearTile(e),this._resetFetchTile(e)}),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._setDirty()}refetch(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._resetFetchTile(e)}),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._setDirty()}refetchAttributes(){this._featureTiles.forEach(e=>{let t=e.isFetched||e.needsAttributesFetching;this._cancelFetchTile(e),e.features?.length&&t?e.requestAttributes():this._resetFetchTile(e)}),this.context.memoryCache?.clear(),this._setDirty()}refetchDisplayFilterHighlightTile(){let e=this._featureTiles.get(R);e&&(this._cancelFetchTile(e),this._resetFetchTile(e),this._setDirty())}suspend(){this._suspended||(this._suspended=!0,this._pause(),this._setDirty())}resume(){this._suspended&&(this._suspended=!1,this._unpause())}getMissingAttributesForFeature(e){for(let t of this._featureTiles.values()){let n=t.missingAttributes?.get(e);if(n!=null)return n}}hasMissingAttributes(e){return this._featureTiles.values().some(t=>t?.missingAttributes?.values().some(t=>e.some(e=>t.has(e))))}_pause(){this._paused&&(this._featureTiles.forEach(e=>this._cancelFetchTile(e)),this._updated())}_unpause(){this._paused||this._setDirty()}get availableFields(){let e=null;return this._featureTiles.forEach(t=>{t.displayingFeatures!=null&&t.displayingFeatures.length!==0&&(e==null?e=new Set(t.availableFields):e.forEach(n=>{t.availableFields?.has(n)||e.delete(n)}))}),e??new Set}applyEdits(e){this._pendingEdits||(this._pendingEdits={edits:Promise.resolve(),count:0,controller:new AbortController},this._pause());let t=this._pendingEdits;t.count++;let n=t.edits.then(()=>e.result.catch(e=>{if(c(e))throw e;return null}).then(e=>e&&(this._applyEditsDeleteFeatures(e.deletedFeatures),this._applyEditsAddUpdateFeatures(e.addedFeatures,e.updatedFeatures,t.controller.signal).then(()=>e))).then(e=>(--t.count===0&&(this._pendingEdits===t&&(this._pendingEdits=null),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._applyEditsTilesUpdated=!1,this._unpause()),e)));return t.edits=n,this._updated(),n}_applyEditsDeleteFeatures(e){if(e.length===0)return;let t=this.context.globalIdField,n=t&&this.availableFields.has(t),r=new Set,i=this._objectIdField;e.forEach(({objectId:e,globalId:a})=>{(!e||e<0)&&t&&a&&(n||o.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected in the view`),e=this._objectIdFromGlobalId(a,i,t)),e!=null&&e>=0&&r.add(e)}),this._featureTiles.forEach(e=>{if(!e.features)return;let t=e.features.filter(e=>!r.has(C(e,this._objectIdField)));t.length!==e.features.length&&(this._applyEditsTileUpdated(),e.setFeatures(t,0,e.availableFields,e.missingAttributes),this._updateTileZQuantization(e),this._invalidateCounts())})}_objectIdFromGlobalId(e,t,n){if(e==null)return null;let r=this.features.find(t=>t.attributes?.[n]===e);return r?C(r,t):null}async _applyEditsAddUpdateFeatures(e,t,n){let{objectIdField:r,globalIdField:i}=this.context,a=i&&this.availableFields.has(i),s=new Set,c=new Set;for(let t of e){let e=t.objectId;e!=null&&s.add(e)}for(let{objectId:e,globalId:n}of t){let t=e;(t==null||t<0)&&i&&(a||o.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${i} to be included the layer's outFields for updates to be reflected in the view`),t=this._objectIdFromGlobalId(n,r,i)),t!=null&&t>=0&&(s.add(t),c.add(t))}if(s.size===0)return;let l=[];this._featureTiles.forEach(e=>{let t=this._applyEditsAddUpdateTile(e,s,c,n);l.push(t)}),this._updated(),await Promise.allSettled(l)}async _applyEditsAddUpdateTile(e,t,n,r){if(!e.features)return;e.fetchingResolution=e.descriptor.resolution;let i=this._createQuery(e);i.resultType=void 0,i.cacheHint=!1,i.objectIds=Array.from(t);let a=await this.context.query.queryFeaturesDehydrated(i,{signal:r,timeout:$}),o=null;if(n.size>0){let t=e.features.filter(e=>!n.has(C(e,this._objectIdField)));t.length!==e.features.length&&(o=t)}if(a.features.length>0){o||=e.features.slice();for(let e of a.features)o.push(e)}o&&(e.hasPreciseFeatureCount&&(e.numFeatures=Math.max(e.numFeatures,o.length)),this._applyEditsTileUpdated(),e.setFeatures(o,0,q(e.availableFields,a.fields),J(e.missingAttributes,a.missingAttributes),void 0,!1),this._updateTileZQuantization(e),this._invalidateCounts())}_applyEditsTileUpdated(){this._applyEditsTilesUpdated||(this._applyEditsTilesUpdated=!0,this._updated())}_queryFeatures(e,t,n){return this.context.query.queryFeaturesDehydrated(e,{signal:n,timeout:$,completeFeatureFromTransfer:(e,n,r)=>{let i=re(e.geometry,n,t),a=this._memory.findGeometry(i,t=>ie(e.geometry,n,t));a?e.geometry=a:E(e,n,r)}})}_setDirty(){this._dirty=!0,this._updated()}runTask(e){let t=this._frameTask.processQueue(e);if(!this._dirty||!this.initialized)return t;this._dirty=!1;let n=this._featureTilesArray;if(this._markTilesNotAlive(n),!e.run(()=>this._addTiles(n,e))||!e.run(()=>this._filterExtentTiles(n,e))||!e.run(()=>this._removeTiles(n,e))||e.done){this._setDirty();return}let r=this._sortTiles(n);e.run(()=>this._showTiles(r,e))&&e.run(()=>this._fetchTiles(r,e))&&e.run(()=>this._updateMemoryEstimates(r,e))||this._setDirty(),this._updated(),this.updating||(this._updateMaximumNumberOfFeaturesExceeded(),this._updateSnappingComplexityExceeded(r))}_updateSnappingComplexityExceeded(e){let t=se;for(let n of e){if(V(n)||t<=0)break;if(!H(n)&&(t--,n.sampledDensityEstimate>oe)){this.snappingComplexityExceeded=!0;return}}this.snappingComplexityExceeded=this._featureTiles.size===0}_markTilesNotAlive(e){for(let t of e)t.alive=!1}_addTiles(e,t){return this._suspended||!this.tileDescriptors?!1:(this.tileDescriptors.forEach(n=>{let r=this._featureTiles.get(n.id);r?r.alive=!0:t.done||(e.push(this._addTile(n)),t.madeProgress())}),t.hasProgressed)}_filterExtentTiles(e,t){for(let n of e){if(t.done)break;n.alive&&(n.filtered=!n.intersects(this.filterExtent),n.filtered&&(this._clearTile(n),t.madeProgress()))}return t.hasProgressed}_removeTiles(e,t){for(let n=e.length-1;n>=0&&!t.done;n--){let r=e[n];r.alive||(this._removeTile(r),n!==e.length-1&&(e[n]=e[e.length-1]),e.pop(),t.madeProgress())}return t.hasProgressed}_sortTiles(e){return e.sort((e,t)=>e.descriptor.loadPriority-t.descriptor.loadPriority),e}_showTiles(e,t){let n=this._updateRatio(e),r=e=>{let t=this._fullRatio<1?n(e)*this._farRatio:1;e.reduceFeatures(t,this.memoryFactor,this._objectIdField,this._reduceMode)&&this._setDirty();let{numFeatures:r,fetchingResolution:i,descriptor:a,isFetched:o}=e;return this._supportsResolution&&r>0&&i!==a.resolution&&o&&(e.requestRefetch(),this._setDirty()),this._showTile(e)};for(let n of e)if(!t.run(()=>r(n))){this._setDirty();break}return t.hasProgressed}_fetchTiles(e,t){if(this._paused)return!1;let n=!1;for(let r of e){if(!r.needsFetch)continue;let e=this.context.memoryCache==null?null:this.context.memoryCache.pop(r.id);if(e?.resolution===r.displayingResolution)r.cache=e,r.numFeatures&&this._notifyDataUpdating(),this._setDirty(),this._scheduleUpdated(),t.madeProgress();else{if(this._needsNumFeatures(r)){let e=new AbortController,i=this._fetchTileCount(r,e.signal);this._handleRequest(r,i,e,()=>r.resetFetching(),()=>r.numFeatures=I),n=!0,t.madeProgress()}if(t.done)return!0}}if(n)return t.hasProgressed;for(let n of e){if(!n.needsFetch)continue;let e=new AbortController,r=this._fetchTile(n,e.signal);if(this._handleRequest(n,r,e,e=>n.fetchDone(e),e=>{n.fetchFailed=!0,this.context.logFetchError(o.getLogger(this),e)}),t.madeProgress(),t.done)return!0}return t.hasProgressed}_updateMemoryEstimates(e,t){return e.some(e=>!t.run(()=>e.updateEstimates())&&(this._setDirty(),!0)),t.hasProgressed}_reclip(e,t){if(!this.initialized)return;let n=[];this._featureTiles.forEach(r=>{r.displayingFeatures!=null&&r.displayingFeatures.length!==0&&(r.intersectionIncludingBorrowed(t,X),r.intersectionIncludingBorrowed(e,Z),_(X,Z)||n.push(r))}),this._refreshDisplayingFeatures(n),this._updated()}_refreshDisplayingFeatures(e){let t=new Set,n=this._changes.updates;for(let r of e)if(r.displayingFeatures!=null)for(let e of r.displayingFeatures){let r=C(e,this._objectIdField);if(t.has(r))continue;t.add(r);let i=this._displayingFeatureReferences.get(r).feature;n.removes.push(i),n.adds.push(i)}this._applyChanges()}_updated(){let e=0;if(this._paused||this._featureTiles.forEach(t=>t.isFetching?++e:0),this._isFetching=e>0,e>0||this._applyEditsTilesUpdated?this._notifyDataUpdating():this._dirty||this._set(`dataUpdating`,!1),this.updating){let t=0,n=0,r=0,i=0,a=0,o=this._displayingFeatureReferences.size/this._numDisplayingFeatureReferences;this._featureTiles.forEach(e=>{if(++n,e.isFetching&&e.hasPreciseFeatureCount){let t=this._maximumFeaturesForTile(e)*(1-e.emptyFeatureRatio),n=e.displayingFeatures==null?0:e.displayingFeatures.length*o;a+=t-n}e.needsFetch?++i:e.numFeatures>0&&(++r,t+=e.numFeatures)}),i+=e;let s=0,c=0;t?(c=t,s=Math.min(i*t/r,t)):(c=n,s=i),a=Math.min(this.maximumNumberOfFeatures-this.features.length,a),this._set(`updatingTotal`,c),this._set(`updatingRemaining`,s),this._set(`expectedFeatureDiff`,a)}else this._set(`updatingTotal`,0),this._set(`updatingRemaining`,0),this._set(`expectedFeatureDiff`,0);this.debugger?.update()}_updateMaximumNumberOfFeaturesExceeded(){for(let{perTileMaximumNumberOfFeaturesExceeded:e}of this._featureTiles.values())if(e){this._set(`maximumNumberOfFeaturesExceeded`,!0);return}this._set(`maximumNumberOfFeaturesExceeded`,!1)}_updateRatio(e){let t=W(e),n=e=>1/(1<<Math.max(0,t-e.descriptor.lij[0])),r=0,i=0;for(let t of e){let e=t.numFeatures;r+=e,i+=e*n(t)}return this._fullRatio=Math.min(1,this.maximumNumberOfFeatures/r),this._farRatio=this.maximumNumberOfFeatures/i,this._scheduleUpdated(),n}_maximumFeaturesUpdated(e,t){e!==t&&(t>e&&this._featureTiles.forEach(e=>{if(!e.featuresMissing)return;let t=this._maximumFeaturesForTile(e);e.isFullyFetched(t)||(this._cancelFetchTile(e),this._resetFetchTile(e))}),this._setDirty())}_addTile(e){let t=new L(e,this._memory);return this._featureTiles.set(t.id,t),this._resetFetchTile(t),this._referenceDisplayingFeaturesFromRelatedTiles(t),t}_referenceDisplayingFeaturesFromRelatedTiles(e){let t=e.displayingResolution,n=new Set;this._featureTiles.forEach(r=>{if(r.displayingFeatures!=null&&e!==r&&M(e.descriptor.lij,r.descriptor.lij)){e.displayingFeatures??=[],e.descriptor.extent&&r.descriptor.extent&&(e.extentIncludingBorrowedFeatures??=v(e.descriptor.extent),y(e.extentIncludingBorrowedFeatures,r.descriptor.extent,e.extentIncludingBorrowedFeatures));for(let i of r.displayingFeatures){let r=C(i,this._objectIdField);if(n.has(r))continue;n.add(r),e.displayingFeatures.push(i),this._memory.ref(i);let a=this._displayingFeatureReferences.get(r);a.ref(this._memory,a.feature,t),this._numDisplayingFeatureReferences++}}})}_removeTile(e){this._clearTile(e),this._featureTiles.delete(e.id)}_resetFetchTile(e){e.filtered=!e.intersects(this.filterExtent),e.filtered?e.needsFetch&&e.fetchDone(8):e.requestFetch()}_cancelFetchTile(e){let t=e.requestController;t!=null&&(e.requestController=null,e.resetFetching(),t.abort())}async _fetchTileCount(e,t){e.numFeatures=await this.context.query.queryFeatureCount(this._createFeatureCountQuery(e),{signal:t}),this._updateRatio(this._featureTilesArray)}async _fetchTile(e,t){if(e.fetchFailed=!1,e.needsAttributesFetching&&e.features?.length)return this._fetchTileAttributes(e,t);let n=this._maximumFeaturesForTile(e);if(n<=0)return e.hasPreciseFeatureCount&&e.numFeatures===0||(e.fetchFailed=!0),G(e),e.fetchInformation.value=`Empty tile`,8;let r=this._getMaxRecordCount(e),i=Math.ceil(n/r);if(e.fetchingResolution=e.descriptor.resolution,U(e)||!this.context.capabilities.supportsMaxRecordCountFactor||e.numFeatures<=n&&i>O.MAX_MAX_RECORD_COUNT_FACTOR)return this._fetchPagedTile(e,t);let a=this._createQuery(e);if(a.maxRecordCountFactor=i,e.isRefetching&&e.features&&e.features.length>0){let t=Math.ceil(e.features.length/(1-e.emptyFeatureRatio)/r);a.maxRecordCountFactor=Math.max(t+1,a.maxRecordCountFactor)}e.fetchInformation.value=`Single fetch\n${n} features`;let{features:o,exceededTransferLimit:s,fields:c,missingAttributes:u}=await this._queryFeatures(a,e.fetchingResolution,t),d=s||a.maxRecordCountFactor>=O.MAX_MAX_RECORD_COUNT_FACTOR||n===this._totalFeaturesForTile(e)?9:8,f=await this._frameTask.schedule(()=>{e.exceededTransferLimit.value=!!s;let t=this._removeEmptyFeatures(o,this._getEffectiveTileResolution(e));return e.fetchInformation.value=`Single fetch\n${o.length}/${n} features`,e.setFeatures(o,t,K(c),J(void 0,u)),this._updateTileZQuantization(e),this._maximumFeaturesForTile(e)>n?1:d},t);return l(t),this._invalidateCounts(),f}async _fetchTileAttributes(e,t){let n=e.features,r=new Set(this.context.requiredFields),i=new Set;for(let t of e.missingAttributes?.values()??[])i=i.union(t.intersection(r));let a=this.context.availableFields.filter(t=>!e.availableFields?.has(t)||i.has(t));if(!a.length)return e.attributeRefetchCompletionStatus;a.includes(this._objectIdField)||a.push(this._objectIdField);let o=new Set(n.map(e=>C(e,this._objectIdField))),s=new Map,c=Math.ceil(n.length/(1-e.emptyFeatureRatio)),u=new Set(e.availableFields),d=e.missingAttributes==null?void 0:new Map(Array.from(e.missingAttributes,([e,t])=>[e,new Set(t)])),f=this._queryFeaturePages(e,()=>c,t,{returnGeometry:!1,outFields:a});for await(let e of f){for(let t of e.features){let e=C(t,this._objectIdField);if(o.delete(e)){s.set(e,t);let n=d?.get(e);for(let e of a)Object.hasOwn(t.attributes,e)&&n?.delete(e);n?.size===0&&d?.delete(e)}}for(let{name:t}of e.fields??[])u.add(t);if(d=J(d,e.missingAttributes?.filter(({objectId:e})=>s.has(e))),!o.size)break}return o.size?(e.requestRefetch(),e.startFetch(),this._fetchTile(e,t)):(await this._frameTask.schedule(()=>{l(t);let r=n.map(e=>{let t={...e.attributes,...s.get(C(e,this._objectIdField)).attributes};if(k(e)){let n=e.cloneShallow();return n.attributes=t,n}let n=new w(h(),e.geometry,t);return n.objectId=C(e,this._objectIdField),n.centroid=e.centroid,n}),i=Math.round(n.length*e.emptyFeatureRatio/(1-e.emptyFeatureRatio));e.setFeatures(r,i,u,d),this._setDirty()},t),l(t),e.attributeRefetchCompletionStatus)}async _fetchPagedTile(e,t){let n=0,r,i=this._maximumFeaturesForTile(e),a=null,o,s=this._queryFeaturePages(e,()=>(e.fetchInformation.value=`Paged fetch\n${e.features?.length}/${i} features`,i),t),c=!1;for await(let u of s){let{features:s,fields:d,missingAttributes:f}=u;if(c=!!u.exceededTransferLimit,await this._frameTask.schedule(()=>{n+=this._removeEmptyFeatures(s,this._getEffectiveTileResolution(e)),e.exceededTransferLimit.value=!!c,r=r?.concat(s)??s,a=q(a,d),o=J(o,f),e.setFeatures(r,n,a,o),this._updateTileZQuantization(e),this._invalidateCounts(),this._setDirty()},t),l(t),i=this._maximumFeaturesForTile(e)-(r?.length??0),i<=0)break}return c?8:9}async*_queryFeaturePages(e,t,n,r={}){let i=this._createQuery(e,r.returnGeometry);i.returnGeometry||(i.returnCentroid=!1),r.outFields&&(i.outFields=r.outFields);let a=this._getMaxRecordCount(e),o=0;for(;;){l(n);let r=this._setPagingParameters(i,o,t(),a),s=await this._queryFeatures(i,e.fetchingResolution,n);l(n);let c=s.features.length>0;if(yield s,!r||!s.exceededTransferLimit||!c)return;o+=i.num}}_createFeatureCountQuery(e){let t=this._createQuery(e);return this.context.capabilities.supportsCacheHint&&(t.resultType=void 0,t.cacheHint=!0),t}_createQuery(e,t){let n=this.context.createQuery();if(t!==void 0&&(n.returnGeometry=t),n.resultType=this._resultType(e),!U(e)&&e.descriptor.extent&&this.context.tilingScheme&&(n.geometry=b(e.descriptor.extent,this.context.tilingScheme.spatialReference)),n.returnGeometry&&this._setResolutionParams(n,e),n.resultType!==`tile`&&this.context.capabilities.supportsCacheHint&&(n.cacheHint=!0),H(e)){let{highlightIds:e}=this.context;e&&e.length>Y&&o.getLogger(this).warn(`highlight-too-many-features`,`highlight is limited to ${Y} features on large layers configured with a display filter to avoid performance issues`),n.objectIds=e?.slice(0,Y)}else!V(e)&&this.context.effectiveDisplayFilter&&(n.where=ee(n.where,this.context.effectiveDisplayFilter.where));return n}_setPagingParameters(e,t,n,r){let i=n>0&&this.context.capabilities.supportsMaxRecordCountFactor;return i&&(e.maxRecordCountFactor=Math.ceil(n/r)),this.context.capabilities.supportsPagination?(e.start=t,e.num=i?Math.min(e.maxRecordCountFactor*r,n):Math.min(r),!0):!1}_getEffectiveTileResolution(e){if(U(e)||!this._supportsResolution)return null;let t=this.context.viewingMode===1&&this.context.tilingScheme?this.context.tilingScheme.resolutionAtLevel(3):1/0;return Math.min(e.fetchingResolution,t)/this.lodFactor/this._tileZQuantization}get _supportsResolution(){return this.context.capabilities.supportsMultipleResolutions&&this.context.geometryType!==`point`}_setResolutionParams(e,t){let n=this._getEffectiveTileResolution(t);n!=null&&(this.context.capabilities.supportsQuantization?e.quantizationParameters=new D({mode:`view`,originPosition:`upper-left`,tolerance:n,extent:this.context.fullExtent}):this.context.geometryType===`polyline`&&(e.maxAllowableOffset=n))}_removeEmptyFeatures(e,t){let n=e.length;if(t&&this._supportsResolution){let n=t*(1+a());i(e,({geometry:e})=>!e||!T(e)?!1:(te(e,Q),x(Q)>n||S(Q)>n))}else i(e,({geometry:e})=>T(e));return n-e.length}_needsNumFeatures(e){return this.useTileCount&&e.needsFeatureCount&&!V(e)}_getMaxRecordCount(e){switch(this._resultType(e)){case`tile`:if(this.context.tileMaxRecordCount)return this.context.tileMaxRecordCount;break;case`standard`:if(this.context.standardMaxRecordCount)return this.context.standardMaxRecordCount}return this.context.maxRecordCount||Y}_resultType(e){if(this.context.capabilities.supportsResultType)return V(e)?`standard`:`tile`}get _reduceMode(){let e=this.context.geometryType;return e===`polygon`||e===`polyline`?0:1}_handleRequest(e,t,n,r,i){e.startFetch(),e.requestController=n;let a=!1;t.then(t=>{l(n.signal),e.requestController=null,r(t)}).catch(t=>{e.requestController===n&&(e.requestController=null,e.fetchDone(8)),c(t)?a=!0:i(t)}).then(()=>{a||this._setDirty(),this._scheduleUpdated()})}_scheduleUpdated(){this.hasHandles(`scheduleUpdated`)||this.addHandles(p(()=>{this.removeHandles(`scheduleUpdated`),this._updated()}),`scheduleUpdated`)}_showTile(e){if(e.displayingFeatures&&!e.needsDisplayUpdate)return!1;let t=e.features;if(e.featureLimit===0||!t){let t=e.displayingFeatures!=null&&e.displayingFeatures.length>0;return this._hideTileFeatures(e),e.displayingFeatures=[],t}let n=e.fetchingResolution,{adds:r,updates:i}=this._changes,a=Math.min(e.featureLimit,t.length);for(let e=0;e<a;++e){let a=t[e],o=C(a,this._objectIdField),s=this._displayingFeatureReferences.get(o);if(this._memory.ref(a),s){let{oldVersion:e,newVersion:t}=s.ref(this._memory,a,n);e!==t&&(e&&i.removes.push(e),t&&i.adds.push(t))}else this._displayingFeatureReferences.set(o,new this.FeatureReferenceClass(a,n,this._memory)),r.push(a);this._numDisplayingFeatureReferences++}return this._hideTileFeatures(e),e.displayingResolution=e.fetchingResolution,this._applyChanges(),e.displayingFeatures=t.slice(0,a),!0}_hideTile(e){this._cancelFetchTile(e),this._hideTileFeatures(e)}_hideTileFeatures(e){if(e.displayingFeatures==null)return;let{updates:t,removes:n}=this._changes;for(let r of e.displayingFeatures){this._memory.unref(r);let i=C(r,this._objectIdField),a=this._displayingFeatureReferences.get(i);if(!a)continue;let{oldVersion:o,newVersion:s}=a.unref(this._memory,e.displayingResolution);this._numDisplayingFeatureReferences--,o!==s&&(s==null?(this._displayingFeatureReferences.delete(i),o&&n.push(o)):(t.adds.push(s),o&&t.removes.push(o)))}this._applyChanges(),e.displayingFeatures=null}_notifyDataUpdating(){this._get(`dataUpdating`)||this._set(`dataUpdating`,!0)}_applyChanges(){let e=this._changes.updates;e.removes.length>0&&(this._notifyDataUpdating(),this.features.removeMany(e.removes),e.removes.length=0),e.adds.length>0&&(this._notifyDataUpdating(),this.features.addMany(e.adds),e.adds.length=0);let t=this._changes.adds,n=this._changes.removes,r=Math.min(t.length,n.length),i=0;for(;i<r;){let e=Math.min(i+ae,r);this._notifyDataUpdating(),this.features.addMany(t.slice(i,e)),this.features.removeMany(n.slice(i,e)),i=e}t.length>r&&(this._notifyDataUpdating(),this.features.addMany(i===0?t:t.slice(i))),n.length>r&&(this._notifyDataUpdating(),this.features.removeMany(i===0?n:n.slice(i))),t.length=0,n.length=0}_clearTile(e){this._hideTile(e),e.features&&this.context.memoryCache!=null&&this.context.memoryCache.put(e.id,e.cache),e.setFeatures(null,0,null,void 0),this._invalidateCounts()}_invalidateCounts(){this.notifyChange(`totalVertices`),this.notifyChange(`totalFeatures`)}get _featureTilesArray(){return Array.from(this._featureTiles.values())}get featureTiles(){return this._featureTiles}get storedFeatures(){return this._featureTilesArray.reduce((e,t)=>e+(t.features?t.features.length:0),0)}get missingTiles(){return this._featureTiles.values().reduce((e,t)=>e+(t.needsFetch||t.isFetching?1:0),0)}_totalFeaturesForTile(e){return e.hasPreciseFeatureCount?e.numFeatures:this.maximumNumberOfFeatures}_maximumFeaturesForTile(e){let t=this._totalFeaturesForTile(e),n=this._fullRatio<1?this._farRatio:1;return Math.min(Math.ceil(t*n/(1-e.emptyFeatureRatio)),t)}get test(){}};e([n({constructOnly:!0})],B.prototype,`features`,void 0),e([n({constructOnly:!0})],B.prototype,`context`,void 0),e([n()],B.prototype,`tileDescriptors`,void 0),e([n({value:1/0})],B.prototype,`maximumNumberOfFeatures`,null),e([n({value:1})],B.prototype,`memoryFactor`,null),e([n({value:1})],B.prototype,`lodFactor`,null),e([n()],B.prototype,`useTileCount`,null),e([n({readOnly:!0})],B.prototype,`updating`,null),e([n({readOnly:!0})],B.prototype,`dataUpdating`,void 0),e([n({readOnly:!0})],B.prototype,`updatingTotal`,void 0),e([n({readOnly:!0})],B.prototype,`updatingRemaining`,void 0),e([n({readOnly:!0})],B.prototype,`expectedFeatureDiff`,void 0),e([n()],B.prototype,`usedMemory`,null),e([n()],B.prototype,`usedMemoryPerFeature`,null),e([n({readOnly:!0})],B.prototype,`maximumNumberOfFeaturesExceeded`,void 0),e([n({readOnly:!0})],B.prototype,`totalVertices`,null),e([n({readOnly:!0})],B.prototype,`totalFeatures`,null),e([n({readOnly:!0})],B.prototype,`showsAllFeatures`,null),e([n({readOnly:!0})],B.prototype,`hasFullGeometries`,null),e([n()],B.prototype,`filterExtent`,null),e([n()],B.prototype,`_dirty`,void 0),e([n()],B.prototype,`_suspended`,void 0),e([n()],B.prototype,`_pendingEdits`,void 0),e([n()],B.prototype,`_applyEditsTilesUpdated`,void 0),e([n()],B.prototype,`_paused`,null),e([n()],B.prototype,`snappingComplexityExceeded`,void 0),e([n()],B.prototype,`_isFetching`,void 0),B=e([r(`esri.views.3d.layers.support.FeatureTileFetcher3D`)],B);function V(e){return e.id===z}function H(e){return e.id===R}function U(e){return V(e)||H(e)}function W(e){let t=0;for(let n of e)n.features&&n.features.length>0&&n.alive&&(t=Math.max(t,n.descriptor.lij[0]));return t}function G(e){e.setFeatures([],0,null,void 0)}function K(e){return e==null?new Set:new Set(e.map(e=>e.name))}function q(e,t){if(e==null||t==null)return K(t);let n=new Set;for(let{name:r}of t)e.has(r)&&n.add(r);return n}function J(e,t){if(!t?.length)return e;e??=new Map;let n=()=>new Set;for(let{objectId:r,attribute:i}of t)s(e,r,n).add(i);return e}const Y=2e3,X=g(),Z=g(),Q=g(),$=6e5,ae=200,oe=.95,se=10;export{B as FeatureTileFetcher3D};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{property as n,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{filterInPlace as i}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{getEpsilon as a}from"../../../../core/libs/gl-matrix-2/math/common.js";import o from"../../../../core/Logger.js";import{getOrCreateMapValue as s}from"../../../../core/MapUtils.js";import{isAbortError as c,throwIfAborted as l}from"../../../../core/promiseUtils.js";import u from"../../../../core/ReactiveMap.js";import{on as d,watch as f}from"../../../../core/reactiveUtils.js";import{schedule as p}from"../../../../core/scheduling.js";import{signal as m}from"../../../../core/signal.js";import{sqlAnd as ee}from"../../../../core/sql.js";import{generateUID as h}from"../../../../core/uid.js";import{create as g,equals as _,clone as v,expand as y,toExtent as b,width as x,height as S}from"../../../../geometry/support/aaBoundingRect.js";import{getObjectId as C,DehydratedFeatureClass as w,hasVertices as T,computeAABR as te}from"../../../../layers/graphics/dehydratedFeatures.js";import{geometryKey as ne,transferGeometryKey as re,identicalTransferGeometry as ie,completeDehydratedFeatureFromTransfer as E}from"../../../../layers/graphics/transferFeatures.js";import D from"../../../../rest/support/QuantizationParameters.js";import O from"../../../../rest/support/Query.js";import{isGraphic as k}from"../../../../support/graphicInstanceUtils.js";import{ImmediateTask as A,TaskPriority as j}from"../../../support/Scheduler.js";import{tilesAreRelated as M}from"../../terrain/tileUtils.js";import{FeatureMemory as N}from"./FeatureMemory.js";import{MultiFeatureReference as P,SingleFeatureReference as F}from"./featureReference.js";import{failedFeatureCount as I,FeatureTile as L}from"./FeatureTile.js";import{virtualDisplayFilterHighlightTileId as R,virtualSnapshotTileId as z}from"./FeatureTileDescriptor.js";let B=class extends t{set maximumNumberOfFeatures(e){e||=1/0;let t=this._get(`maximumNumberOfFeatures`);e===t||e<1||(this._set(`maximumNumberOfFeatures`,e),this._maximumFeaturesUpdated(t,e))}set memoryFactor(e){this.memoryFactor!==e&&(this._set(`memoryFactor`,e),this._setDirty())}set lodFactor(e){this.lodFactor!==e&&(this._set(`lodFactor`,e),this._supportsResolution&&this.refetch())}get useTileCount(){return this._useTileCount&&this.context.query.queryFeatureCount!=null}set useTileCount(e){this._useTileCount=e,this.notifyChange(`useTileCount`)}get updating(){return this._dirty||!!this._pendingEdits||this._isFetching||(this.tileDescriptors?.updating??!1)}get readyToRun(){return this._dirty}get usedMemory(){return this._memory.usedMemory}get usedMemoryPerFeature(){return this._memory.usedMemoryPerFeature}get totalVertices(){let e=0;return this._featureTiles.forEach(t=>e+=t.numVertices),e}get totalFeatures(){let e=0;return this._featureTiles.forEach(t=>e+=t.numFeatures),e}get showsAllFeatures(){if(this._paused||this.dataUpdating)return!1;for(let e of this._featureTiles.values())if(!this.hasFullGeometries&&e.emptyFeatureRatio!==0||!e.showsAllFeatures)return!1;return!0}get hasFullGeometries(){return!this._supportsResolution||this.tileDescriptors?.some(V)||!this.context.capabilities.supportsQuantization&&this.context.geometryType!==`polyline`}set filterExtent(e){if(e!=null&&this.context.tilingScheme&&!e.spatialReference.equals(this.context.tilingScheme.spatialReference)){o.getLogger(this).error(`#filterExtent=`,`extent needs to be in the same spatial reference as the tiling scheme`);return}let t=this._get(`filterExtent`);if(t===e||t!=null&&e&&t.equals(e))return;let n=e==null?null:e.clone();this._set(`filterExtent`,n),this._reclip(n,t)}_updateTileZQuantization(e){if(this.context.isGlobal){let t=e.computeZQuantizationFactor();this._zQuantizationFactor.value<t&&(this._zQuantizationFactor.value=t)}}get _tileZQuantization(){return this.context.isDraped?1:this._zQuantizationFactor.value}constructor(e){super(e),this._useTileCount=!1,this.dataUpdating=!1,this.updatingTotal=0,this.updatingRemaining=0,this.expectedFeatureDiff=0,this.maximumNumberOfFeaturesExceeded=!1,this._fullRatio=1,this._farRatio=1,this._zQuantizationFactor=m(1),this._changes={updates:{adds:[],removes:[]},adds:[],removes:[]},this._featureTiles=new u,this._displayingFeatureReferences=new Map,this._numDisplayingFeatureReferences=0,this._memory=new N(ne),this._dirty=!1,this._suspended=!0,this._pendingEdits=null,this._applyEditsTilesUpdated=!1,this.snappingComplexityExceeded=!0,this._isFetching=!1;let t=e.context;this._frameTask=t.scheduler?.registerTask(j.FEATURE_TILE_FETCHER,this)??A,this.FeatureReferenceClass=t.capabilities.supportsMultipleResolutions?P:F,this._objectIdField=t.objectIdField}initialize(){this.addHandles([d(()=>this.tileDescriptors,`change`,()=>this._setDirty(),{onListenerAdd:()=>this._setDirty(),onListenerRemove:()=>this._setDirty()}),f(()=>this._tileZQuantization,()=>this.refetch())]),this._setDirty()}destroy(){this._frameTask.remove(),this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._removeTile(e)}),this._featureTiles.clear(),this._displayingFeatureReferences.clear(),this._pendingEdits?.controller.abort(),this._pendingEdits=null}get _paused(){return this._suspended||!!this._pendingEdits}restart(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._clearTile(e),this._resetFetchTile(e)}),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._setDirty()}refetch(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._resetFetchTile(e)}),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._setDirty()}refetchAttributes(){this._featureTiles.forEach(e=>{let t=e.isFetched||e.needsAttributesFetching;this._cancelFetchTile(e),e.features?.length&&t?e.requestAttributes():this._resetFetchTile(e)}),this.context.memoryCache?.clear(),this._setDirty()}refetchDisplayFilterHighlightTile(){let e=this._featureTiles.get(R);e&&(this._cancelFetchTile(e),this._resetFetchTile(e),this._setDirty())}suspend(){this._suspended||(this._suspended=!0,this._pause(),this._setDirty())}resume(){this._suspended&&(this._suspended=!1,this._unpause())}getMissingAttributesForFeature(e){for(let t of this._featureTiles.values()){let n=t.missingAttributes?.get(e);if(n!=null)return n}}hasMissingAttributes(e){return this._featureTiles.values().some(t=>t?.missingAttributes?.values().some(t=>e.some(e=>t.has(e))))}_pause(){this._paused&&(this._featureTiles.forEach(e=>this._cancelFetchTile(e)),this._updated())}_unpause(){this._paused||this._setDirty()}get availableFields(){let e=null;return this._featureTiles.forEach(t=>{t.displayingFeatures!=null&&t.displayingFeatures.length!==0&&(e==null?e=new Set(t.availableFields):e.forEach(n=>{t.availableFields?.has(n)||e.delete(n)}))}),e??new Set}applyEdits(e){this._pendingEdits||(this._pendingEdits={edits:Promise.resolve(),count:0,controller:new AbortController},this._pause());let t=this._pendingEdits;t.count++;let n=t.edits.then(()=>e.result.catch(e=>{if(c(e))throw e;return null}).then(e=>e&&(this._applyEditsDeleteFeatures(e.deletedFeatures),this._applyEditsAddUpdateFeatures(e.addedFeatures,e.updatedFeatures,t.controller.signal).then(()=>e))).then(e=>(--t.count===0&&(this._pendingEdits===t&&(this._pendingEdits=null),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._applyEditsTilesUpdated=!1,this._unpause()),e)));return t.edits=n,this._updated(),n}_applyEditsDeleteFeatures(e){if(e.length===0)return;let t=this.context.globalIdField,n=t&&this.availableFields.has(t),r=new Set,i=this._objectIdField;e.forEach(({objectId:e,globalId:a})=>{(!e||e<0)&&t&&a&&(n||o.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected in the view`),e=this._objectIdFromGlobalId(a,i,t)),e!=null&&e>=0&&r.add(e)}),this._featureTiles.forEach(e=>{if(!e.features)return;let t=e.features.filter(e=>!r.has(C(e,this._objectIdField)));t.length!==e.features.length&&(this._applyEditsTileUpdated(),e.setFeatures(t,0,e.availableFields,e.missingAttributes),this._updateTileZQuantization(e),this._invalidateCounts())})}_objectIdFromGlobalId(e,t,n){if(e==null)return null;let r=this.features.find(t=>t.attributes?.[n]===e);return r?C(r,t):null}async _applyEditsAddUpdateFeatures(e,t,n){let{objectIdField:r,globalIdField:i}=this.context,a=i&&this.availableFields.has(i),s=new Set,c=new Set;for(let t of e){let e=t.objectId;e!=null&&s.add(e)}for(let{objectId:e,globalId:n}of t){let t=e;(t==null||t<0)&&i&&(a||o.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${i} to be included the layer's outFields for updates to be reflected in the view`),t=this._objectIdFromGlobalId(n,r,i)),t!=null&&t>=0&&(s.add(t),c.add(t))}if(s.size===0)return;let l=[];this._featureTiles.forEach(e=>{let t=this._applyEditsAddUpdateTile(e,s,c,n);l.push(t)}),this._updated(),await Promise.allSettled(l)}async _applyEditsAddUpdateTile(e,t,n,r){if(!e.features)return;e.fetchingResolution=e.descriptor.resolution;let i=this._createQuery(e);i.resultType=void 0,i.cacheHint=!1,i.objectIds=Array.from(t);let a=await this.context.query.queryFeaturesDehydrated(i,{signal:r,timeout:$}),o=null;if(n.size>0){let t=e.features.filter(e=>!n.has(C(e,this._objectIdField)));t.length!==e.features.length&&(o=t)}if(a.features.length>0){o||=e.features.slice();for(let e of a.features)o.push(e)}o&&(e.hasPreciseFeatureCount&&(e.numFeatures=Math.max(e.numFeatures,o.length)),this._applyEditsTileUpdated(),e.setFeatures(o,0,q(e.availableFields,a.fields),J(e.missingAttributes,a.missingAttributes),void 0,!1),this._updateTileZQuantization(e),this._invalidateCounts())}_applyEditsTileUpdated(){this._applyEditsTilesUpdated||(this._applyEditsTilesUpdated=!0,this._updated())}_queryFeatures(e,t,n){return this.context.query.queryFeaturesDehydrated(e,{signal:n,timeout:$,completeFeatureFromTransfer:(e,n,r)=>{let i=re(e.geometry,n,t),a=this._memory.findGeometry(i,t=>ie(e.geometry,n,t));a?e.geometry=a:E(e,n,r)}})}_setDirty(){this._dirty=!0,this._updated()}runTask(e){let t=this._frameTask.processQueue(e);if(!this._dirty||!this.initialized)return t;this._dirty=!1;let n=this._featureTilesArray;if(this._markTilesNotAlive(n),!e.run(()=>this._addTiles(n,e))||!e.run(()=>this._filterExtentTiles(n,e))||!e.run(()=>this._removeTiles(n,e))||e.done){this._setDirty();return}let r=this._sortTiles(n);e.run(()=>this._showTiles(r,e))&&e.run(()=>this._fetchTiles(r,e))&&e.run(()=>this._updateMemoryEstimates(r,e))||this._setDirty(),this._updated(),this.updating||(this._updateMaximumNumberOfFeaturesExceeded(),this._updateSnappingComplexityExceeded(r))}_updateSnappingComplexityExceeded(e){let t=se;for(let n of e){if(V(n)||t<=0)break;if(!H(n)&&(t--,n.sampledDensityEstimate>oe)){this.snappingComplexityExceeded=!0;return}}this.snappingComplexityExceeded=this._featureTiles.size===0}_markTilesNotAlive(e){for(let t of e)t.alive=!1}_addTiles(e,t){return this._suspended||!this.tileDescriptors?!1:(this.tileDescriptors.forEach(n=>{let r=this._featureTiles.get(n.id);r?r.alive=!0:t.done||(e.push(this._addTile(n)),t.madeProgress())}),t.hasProgressed)}_filterExtentTiles(e,t){for(let n of e){if(t.done)break;n.alive&&(n.filtered=!n.intersects(this.filterExtent),n.filtered&&(this._clearTile(n),t.madeProgress()))}return t.hasProgressed}_removeTiles(e,t){for(let n=e.length-1;n>=0&&!t.done;n--){let r=e[n];r.alive||(this._removeTile(r),n!==e.length-1&&(e[n]=e[e.length-1]),e.pop(),t.madeProgress())}return t.hasProgressed}_sortTiles(e){return e.sort((e,t)=>e.descriptor.loadPriority-t.descriptor.loadPriority),e}_showTiles(e,t){let n=this._updateRatio(e),r=e=>{let t=this._fullRatio<1?n(e)*this._farRatio:1;e.reduceFeatures(t,this.memoryFactor,this._objectIdField,this._reduceMode)&&this._setDirty();let{numFeatures:r,fetchingResolution:i,descriptor:a,isFetched:o}=e;return this._supportsResolution&&r>0&&i!==a.resolution&&o&&(e.requestRefetch(),this._setDirty()),this._showTile(e)};for(let n of e)if(!t.run(()=>r(n))){this._setDirty();break}return t.hasProgressed}_fetchTiles(e,t){if(this._paused)return!1;let n=!1;for(let r of e){if(!r.needsFetch)continue;let e=this.context.memoryCache==null?null:this.context.memoryCache.pop(r.id);if(e?.resolution===r.displayingResolution)r.cache=e,r.numFeatures&&this._notifyDataUpdating(),this._setDirty(),this._scheduleUpdated(),t.madeProgress();else{if(this._needsNumFeatures(r)){let e=new AbortController,i=this._fetchTileCount(r,e.signal);this._handleRequest(r,i,e,()=>r.resetFetching(),()=>r.numFeatures=I),n=!0,t.madeProgress()}if(t.done)return!0}}if(n)return t.hasProgressed;for(let n of e){if(!n.needsFetch)continue;let e=new AbortController,r=this._fetchTile(n,e.signal);if(this._handleRequest(n,r,e,e=>n.fetchDone(e),e=>{n.fetchFailed=!0,this.context.logFetchError(o.getLogger(this),e)}),t.madeProgress(),t.done)return!0}return t.hasProgressed}_updateMemoryEstimates(e,t){return e.some(e=>!t.run(()=>e.updateEstimates())&&(this._setDirty(),!0)),t.hasProgressed}_reclip(e,t){if(!this.initialized)return;let n=[];this._featureTiles.forEach(r=>{r.displayingFeatures!=null&&r.displayingFeatures.length!==0&&(r.intersectionIncludingBorrowed(t,X),r.intersectionIncludingBorrowed(e,Z),_(X,Z)||n.push(r))}),this._refreshDisplayingFeatures(n),this._updated()}_refreshDisplayingFeatures(e){let t=new Set,n=this._changes.updates;for(let r of e)if(r.displayingFeatures!=null)for(let e of r.displayingFeatures){let r=C(e,this._objectIdField);if(t.has(r))continue;t.add(r);let i=this._displayingFeatureReferences.get(r).feature;n.removes.push(i),n.adds.push(i)}this._applyChanges()}_updated(){let e=0;if(this._paused||this._featureTiles.forEach(t=>t.isFetching?++e:0),this._isFetching=e>0,e>0||this._applyEditsTilesUpdated?this._notifyDataUpdating():this._dirty||this._set(`dataUpdating`,!1),this.updating){let t=0,n=0,r=0,i=0,a=0,o=this._displayingFeatureReferences.size/this._numDisplayingFeatureReferences;this._featureTiles.forEach(e=>{if(++n,e.isFetching&&e.hasPreciseFeatureCount){let t=this._maximumFeaturesForTile(e)*(1-e.emptyFeatureRatio),n=e.displayingFeatures==null?0:e.displayingFeatures.length*o;a+=t-n}e.needsFetch?++i:e.numFeatures>0&&(++r,t+=e.numFeatures)}),i+=e;let s=0,c=0;t?(c=t,s=Math.min(i*t/r,t)):(c=n,s=i),a=Math.min(this.maximumNumberOfFeatures-this.features.length,a),this._set(`updatingTotal`,c),this._set(`updatingRemaining`,s),this._set(`expectedFeatureDiff`,a)}else this._set(`updatingTotal`,0),this._set(`updatingRemaining`,0),this._set(`expectedFeatureDiff`,0);this.debugger?.update()}_updateMaximumNumberOfFeaturesExceeded(){for(let{perTileMaximumNumberOfFeaturesExceeded:e}of this._featureTiles.values())if(e){this._set(`maximumNumberOfFeaturesExceeded`,!0);return}this._set(`maximumNumberOfFeaturesExceeded`,!1)}_updateRatio(e){let t=W(e),n=e=>1/(1<<Math.max(0,t-e.descriptor.lij[0])),r=0,i=0;for(let t of e){let e=t.numFeatures;r+=e,i+=e*n(t)}return this._fullRatio=Math.min(1,this.maximumNumberOfFeatures/r),this._farRatio=this.maximumNumberOfFeatures/i,this._scheduleUpdated(),n}_maximumFeaturesUpdated(e,t){e!==t&&(t>e&&this._featureTiles.forEach(e=>{if(!e.featuresMissing)return;let t=this._maximumFeaturesForTile(e);e.isFullyFetched(t)||(this._cancelFetchTile(e),this._resetFetchTile(e))}),this._setDirty())}_addTile(e){let t=new L(e,this._memory);return this._featureTiles.set(t.id,t),this._resetFetchTile(t),this._referenceDisplayingFeaturesFromRelatedTiles(t),t}_referenceDisplayingFeaturesFromRelatedTiles(e){let t=e.displayingResolution,n=new Set;this._featureTiles.forEach(r=>{if(r.displayingFeatures!=null&&e!==r&&M(e.descriptor.lij,r.descriptor.lij)){e.displayingFeatures??=[],e.descriptor.extent&&r.descriptor.extent&&(e.extentIncludingBorrowedFeatures??=v(e.descriptor.extent),y(e.extentIncludingBorrowedFeatures,r.descriptor.extent,e.extentIncludingBorrowedFeatures));for(let i of r.displayingFeatures){let r=C(i,this._objectIdField);if(n.has(r))continue;n.add(r),e.displayingFeatures.push(i),this._memory.ref(i);let a=this._displayingFeatureReferences.get(r);a.ref(this._memory,a.feature,t),this._numDisplayingFeatureReferences++}}})}_removeTile(e){this._clearTile(e),this._featureTiles.delete(e.id)}_resetFetchTile(e){e.filtered=!e.intersects(this.filterExtent),e.filtered?e.needsFetch&&e.fetchDone(8):e.requestFetch()}_cancelFetchTile(e){let t=e.requestController;t!=null&&(e.requestController=null,e.resetFetching(),t.abort())}async _fetchTileCount(e,t){e.numFeatures=await this.context.query.queryFeatureCount(this._createFeatureCountQuery(e),{signal:t}),this._updateRatio(this._featureTilesArray)}async _fetchTile(e,t){if(e.fetchFailed=!1,e.needsAttributesFetching&&e.features?.length)return this._fetchTileAttributes(e,t);let n=this._maximumFeaturesForTile(e);if(n<=0)return e.hasPreciseFeatureCount&&e.numFeatures===0||(e.fetchFailed=!0),G(e),e.fetchInformation.value=`Empty tile`,8;let r=this._getMaxRecordCount(e),i=Math.ceil(n/r);if(e.fetchingResolution=e.descriptor.resolution,U(e)||!this.context.capabilities.supportsMaxRecordCountFactor||e.numFeatures<=n&&i>O.MAX_MAX_RECORD_COUNT_FACTOR)return this._fetchPagedTile(e,t);let a=this._createQuery(e);if(a.maxRecordCountFactor=i,e.isRefetching&&e.features&&e.features.length>0){let t=Math.ceil(e.features.length/(1-e.emptyFeatureRatio)/r);a.maxRecordCountFactor=Math.max(t+1,a.maxRecordCountFactor)}e.fetchInformation.value=`Single fetch\n${n} features`;let{features:o,exceededTransferLimit:s,fields:c,missingAttributes:u}=await this._queryFeatures(a,e.fetchingResolution,t),d=s||a.maxRecordCountFactor>=O.MAX_MAX_RECORD_COUNT_FACTOR||n===this._totalFeaturesForTile(e)?9:8,f=await this._frameTask.schedule(()=>{e.exceededTransferLimit.value=!!s;let t=this._removeEmptyFeatures(o,this._getEffectiveTileResolution(e));return e.fetchInformation.value=`Single fetch\n${o.length}/${n} features`,e.setFeatures(o,t,K(c),J(void 0,u)),this._updateTileZQuantization(e),this._maximumFeaturesForTile(e)>n?1:d},t);return l(t),this._invalidateCounts(),f}async _fetchTileAttributes(e,t){let n=e.features,r=new Set(this.context.requiredFields),i=new Set;for(let t of e.missingAttributes?.values()??[])i=i.union(t.intersection(r));let a=this.context.availableFields.filter(t=>!e.availableFields?.has(t)||i.has(t));if(!a.length)return e.attributeRefetchCompletionStatus;a.includes(this._objectIdField)||a.push(this._objectIdField);let o=new Set(n.map(e=>C(e,this._objectIdField))),s=new Map,c=Math.ceil(n.length/(1-e.emptyFeatureRatio)),u=new Set(e.availableFields),d=e.missingAttributes==null?void 0:new Map(Array.from(e.missingAttributes,([e,t])=>[e,new Set(t)])),f=this._queryFeaturePages(e,()=>c,t,{returnGeometry:!1,outFields:a});for await(let e of f){for(let t of e.features){let e=C(t,this._objectIdField);if(o.delete(e)){s.set(e,t);let n=d?.get(e);for(let e of a)Object.hasOwn(t.attributes,e)&&n?.delete(e);n?.size===0&&d?.delete(e)}}for(let{name:t}of e.fields??[])u.add(t);if(d=J(d,e.missingAttributes?.filter(({objectId:e})=>s.has(e))),!o.size)break}return o.size?(e.requestRefetch(),e.startFetch(),this._fetchTile(e,t)):(await this._frameTask.schedule(()=>{l(t);let r=n.map(e=>{let t={...e.attributes,...s.get(C(e,this._objectIdField)).attributes};if(k(e)){let n=e.cloneShallow();return n.attributes=t,n}let n=new w(h(),e.geometry,t);return n.objectId=C(e,this._objectIdField),n.centroid=e.centroid,n}),i=Math.round(n.length*e.emptyFeatureRatio/(1-e.emptyFeatureRatio));e.setFeatures(r,i,u,d),this._setDirty()},t),l(t),e.attributeRefetchCompletionStatus)}async _fetchPagedTile(e,t){let n=0,r,i=this._maximumFeaturesForTile(e),a=null,o,s=this._queryFeaturePages(e,()=>(e.fetchInformation.value=`Paged fetch\n${e.features?.length}/${i} features`,i),t),c=!1;for await(let u of s){let{features:s,fields:d,missingAttributes:f}=u;if(c=!!u.exceededTransferLimit,await this._frameTask.schedule(()=>{n+=this._removeEmptyFeatures(s,this._getEffectiveTileResolution(e)),e.exceededTransferLimit.value=!!c,r=r?.concat(s)??s,a=q(a,d),o=J(o,f),e.setFeatures(r,n,a,o),this._updateTileZQuantization(e),this._invalidateCounts(),this._setDirty()},t),l(t),i=this._maximumFeaturesForTile(e)-(r?.length??0),i<=0)break}return c?8:9}async*_queryFeaturePages(e,t,n,r={}){let i=this._createQuery(e,r.returnGeometry);i.returnGeometry||(i.returnCentroid=!1),r.outFields&&(i.outFields=r.outFields);let a=this._getMaxRecordCount(e),o=0;for(;;){l(n);let r=this._setPagingParameters(i,o,t(),a),s=await this._queryFeatures(i,e.fetchingResolution,n);l(n);let c=s.features.length>0;if(yield s,!r||!s.exceededTransferLimit||!c)return;o+=i.num}}_createFeatureCountQuery(e){let t=this._createQuery(e);return this.context.capabilities.supportsCacheHint&&(t.resultType=void 0,t.cacheHint=!0),t}_createQuery(e,t){let n=this.context.createQuery();if(t!==void 0&&(n.returnGeometry=t),n.resultType=this._resultType(e),!U(e)&&e.descriptor.extent&&this.context.tilingScheme&&(n.geometry=b(e.descriptor.extent,this.context.tilingScheme.spatialReference)),n.returnGeometry&&this._setResolutionParams(n,e),n.resultType!==`tile`&&this.context.capabilities.supportsCacheHint&&(n.cacheHint=!0),H(e)){let{highlightIds:e}=this.context;e&&e.length>Y&&o.getLogger(this).warn(`highlight-too-many-features`,`highlight is limited to ${Y} features on large layers configured with a display filter to avoid performance issues`),n.objectIds=e?.slice(0,Y)}else!V(e)&&this.context.effectiveDisplayFilter&&(n.where=ee(n.where,this.context.effectiveDisplayFilter.where));return n}_setPagingParameters(e,t,n,r){let i=n>0&&this.context.capabilities.supportsMaxRecordCountFactor;return i&&(e.maxRecordCountFactor=Math.ceil(n/r)),this.context.capabilities.supportsPagination?(e.start=t,e.num=i?Math.min(e.maxRecordCountFactor*r,n):Math.min(r),!0):!1}_getEffectiveTileResolution(e){if(U(e)||!this._supportsResolution)return null;let t=this.context.isGlobal&&this.context.tilingScheme?this.context.tilingScheme.resolutionAtLevel(3):1/0;return Math.min(e.fetchingResolution,t)/this.lodFactor/this._tileZQuantization}get _supportsResolution(){return this.context.capabilities.supportsMultipleResolutions&&this.context.geometryType!==`point`}_setResolutionParams(e,t){let n=this._getEffectiveTileResolution(t);n!=null&&(this.context.capabilities.supportsQuantization?e.quantizationParameters=new D({mode:`view`,originPosition:`upper-left`,tolerance:n,extent:this.context.fullExtent}):this.context.geometryType===`polyline`&&(e.maxAllowableOffset=n))}_removeEmptyFeatures(e,t){let n=e.length;if(t&&this._supportsResolution){let n=t*(1+a());i(e,({geometry:e})=>!e||!T(e)?!1:(te(e,Q),x(Q)>n||S(Q)>n))}else i(e,({geometry:e})=>T(e));return n-e.length}_needsNumFeatures(e){return this.useTileCount&&e.needsFeatureCount&&!V(e)}_getMaxRecordCount(e){switch(this._resultType(e)){case`tile`:if(this.context.tileMaxRecordCount)return this.context.tileMaxRecordCount;break;case`standard`:if(this.context.standardMaxRecordCount)return this.context.standardMaxRecordCount}return this.context.maxRecordCount||Y}_resultType(e){if(this.context.capabilities.supportsResultType)return V(e)?`standard`:`tile`}get _reduceMode(){let e=this.context.geometryType;return e===`polygon`||e===`polyline`?0:1}_handleRequest(e,t,n,r,i){e.startFetch(),e.requestController=n;let a=!1;t.then(t=>{l(n.signal),e.requestController=null,r(t)}).catch(t=>{e.requestController===n&&(e.requestController=null,e.fetchDone(8)),c(t)?a=!0:i(t)}).then(()=>{a||this._setDirty(),this._scheduleUpdated()})}_scheduleUpdated(){this.hasHandles(`scheduleUpdated`)||this.addHandles(p(()=>{this.removeHandles(`scheduleUpdated`),this._updated()}),`scheduleUpdated`)}_showTile(e){if(e.displayingFeatures&&!e.needsDisplayUpdate)return!1;let t=e.features;if(e.featureLimit===0||!t){let t=e.displayingFeatures!=null&&e.displayingFeatures.length>0;return this._hideTileFeatures(e),e.displayingFeatures=[],t}let n=e.fetchingResolution,{adds:r,updates:i}=this._changes,a=Math.min(e.featureLimit,t.length);for(let e=0;e<a;++e){let a=t[e],o=C(a,this._objectIdField),s=this._displayingFeatureReferences.get(o);if(this._memory.ref(a),s){let{oldVersion:e,newVersion:t}=s.ref(this._memory,a,n);e!==t&&(e&&i.removes.push(e),t&&i.adds.push(t))}else this._displayingFeatureReferences.set(o,new this.FeatureReferenceClass(a,n,this._memory)),r.push(a);this._numDisplayingFeatureReferences++}return this._hideTileFeatures(e),e.displayingResolution=e.fetchingResolution,this._applyChanges(),e.displayingFeatures=t.slice(0,a),!0}_hideTile(e){this._cancelFetchTile(e),this._hideTileFeatures(e)}_hideTileFeatures(e){if(e.displayingFeatures==null)return;let{updates:t,removes:n}=this._changes;for(let r of e.displayingFeatures){this._memory.unref(r);let i=C(r,this._objectIdField),a=this._displayingFeatureReferences.get(i);if(!a)continue;let{oldVersion:o,newVersion:s}=a.unref(this._memory,e.displayingResolution);this._numDisplayingFeatureReferences--,o!==s&&(s==null?(this._displayingFeatureReferences.delete(i),o&&n.push(o)):(t.adds.push(s),o&&t.removes.push(o)))}this._applyChanges(),e.displayingFeatures=null}_notifyDataUpdating(){this._get(`dataUpdating`)||this._set(`dataUpdating`,!0)}_applyChanges(){let e=this._changes.updates;e.removes.length>0&&(this._notifyDataUpdating(),this.features.removeMany(e.removes),e.removes.length=0),e.adds.length>0&&(this._notifyDataUpdating(),this.features.addMany(e.adds),e.adds.length=0);let t=this._changes.adds,n=this._changes.removes,r=Math.min(t.length,n.length),i=0;for(;i<r;){let e=Math.min(i+ae,r);this._notifyDataUpdating(),this.features.addMany(t.slice(i,e)),this.features.removeMany(n.slice(i,e)),i=e}t.length>r&&(this._notifyDataUpdating(),this.features.addMany(i===0?t:t.slice(i))),n.length>r&&(this._notifyDataUpdating(),this.features.removeMany(i===0?n:n.slice(i))),t.length=0,n.length=0}_clearTile(e){this._hideTile(e),e.features&&this.context.memoryCache!=null&&this.context.memoryCache.put(e.id,e.cache),e.setFeatures(null,0,null,void 0),this._invalidateCounts()}_invalidateCounts(){this.notifyChange(`totalVertices`),this.notifyChange(`totalFeatures`)}get _featureTilesArray(){return Array.from(this._featureTiles.values())}get featureTiles(){return this._featureTiles}get storedFeatures(){return this._featureTilesArray.reduce((e,t)=>e+(t.features?t.features.length:0),0)}get missingTiles(){return this._featureTiles.values().reduce((e,t)=>e+(t.needsFetch||t.isFetching?1:0),0)}_totalFeaturesForTile(e){return e.hasPreciseFeatureCount?e.numFeatures:this.maximumNumberOfFeatures}_maximumFeaturesForTile(e){let t=this._totalFeaturesForTile(e),n=this._fullRatio<1?this._farRatio:1;return Math.min(Math.ceil(t*n/(1-e.emptyFeatureRatio)),t)}get test(){}};e([n({constructOnly:!0})],B.prototype,`features`,void 0),e([n({constructOnly:!0})],B.prototype,`context`,void 0),e([n()],B.prototype,`tileDescriptors`,void 0),e([n({value:1/0})],B.prototype,`maximumNumberOfFeatures`,null),e([n({value:1})],B.prototype,`memoryFactor`,null),e([n({value:1})],B.prototype,`lodFactor`,null),e([n()],B.prototype,`useTileCount`,null),e([n({readOnly:!0})],B.prototype,`updating`,null),e([n({readOnly:!0})],B.prototype,`dataUpdating`,void 0),e([n({readOnly:!0})],B.prototype,`updatingTotal`,void 0),e([n({readOnly:!0})],B.prototype,`updatingRemaining`,void 0),e([n({readOnly:!0})],B.prototype,`expectedFeatureDiff`,void 0),e([n()],B.prototype,`usedMemory`,null),e([n()],B.prototype,`usedMemoryPerFeature`,null),e([n({readOnly:!0})],B.prototype,`maximumNumberOfFeaturesExceeded`,void 0),e([n({readOnly:!0})],B.prototype,`totalVertices`,null),e([n({readOnly:!0})],B.prototype,`totalFeatures`,null),e([n({readOnly:!0})],B.prototype,`showsAllFeatures`,null),e([n({readOnly:!0})],B.prototype,`hasFullGeometries`,null),e([n()],B.prototype,`filterExtent`,null),e([n()],B.prototype,`_dirty`,void 0),e([n()],B.prototype,`_suspended`,void 0),e([n()],B.prototype,`_pendingEdits`,void 0),e([n()],B.prototype,`_applyEditsTilesUpdated`,void 0),e([n()],B.prototype,`_paused`,null),e([n()],B.prototype,`snappingComplexityExceeded`,void 0),e([n()],B.prototype,`_isFetching`,void 0),B=e([r(`esri.views.3d.layers.support.FeatureTileFetcher3D`)],B);function V(e){return e.id===z}function H(e){return e.id===R}function U(e){return V(e)||H(e)}function W(e){let t=0;for(let n of e)n.features&&n.features.length>0&&n.alive&&(t=Math.max(t,n.descriptor.lij[0]));return t}function G(e){e.setFeatures([],0,null,void 0)}function K(e){return e==null?new Set:new Set(e.map(e=>e.name))}function q(e,t){if(e==null||t==null)return K(t);let n=new Set;for(let{name:r}of t)e.has(r)&&n.add(r);return n}function J(e,t){if(!t?.length)return e;e??=new Map;let n=()=>new Set;for(let{objectId:r,attribute:i}of t)s(e,r,n).add(i);return e}const Y=2e3,X=g(),Z=g(),Q=g(),$=6e5,ae=200,oe=.95,se=10;export{B as FeatureTileFetcher3D};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{destroyMaybe as e}from"../../../../core/maybe.js";import{createFeatureTileQuery3D as t}from"./featureTileQuery3D.js";class n{constructor(e){this._memoryCache=null;let{layerView:n,returnZ:r,returnM:i}=e,a=n.layer;this._layerView=n,this.objectIdField=a.objectIdField,this.globalIdField=`globalIdField`in a?a.globalIdField:null,this._returnZ=r,this._returnM=i;let o=n.view.resourceController;this.query=t(n,o.normal),this._memoryCacheEnabled&&(this._memoryCache=o.memoryController.newCache(`fl-${a.uid}`))}get _memoryCacheEnabled(){switch(this._layerView.layer.source.type){case`feature-layer`:case`ogc-feature`:case`oriented-imagery`:return!0;case`csv`:case`parquet`:case`geojson`:case`memory`:case`wfs`:return!1}}destroy(){this._memoryCache=e(this._memoryCache),this.query.destroy()}createQuery(){let e=this._layerView.layer.createQuery();return e.outFields=this._layerView.availableFieldsForQuery,e.returnZ=this._returnZ,e.returnM=this._returnM,e.outSpatialReference=this.tilingScheme?.spatialReference??this._layerView.view.spatialReference,e}get availableFields(){return this._layerView.availableFields}get requiredFields(){return this._layerView.requiredFields}get memoryCache(){return this._memoryCache}get
|
|
2
|
+
import{destroyMaybe as e}from"../../../../core/maybe.js";import{createFeatureTileQuery3D as t}from"./featureTileQuery3D.js";class n{constructor(e){this._memoryCache=null;let{layerView:n,returnZ:r,returnM:i}=e,a=n.layer;this._layerView=n,this.objectIdField=a.objectIdField,this.globalIdField=`globalIdField`in a?a.globalIdField:null,this._returnZ=r,this._returnM=i;let o=n.view.resourceController;this.query=t(n,o.normal),this._memoryCacheEnabled&&(this._memoryCache=o.memoryController.newCache(`fl-${a.uid}`))}get _memoryCacheEnabled(){switch(this._layerView.layer.source.type){case`feature-layer`:case`ogc-feature`:case`oriented-imagery`:return!0;case`csv`:case`parquet`:case`geojson`:case`memory`:case`wfs`:return!1}}destroy(){this._memoryCache=e(this._memoryCache),this.query.destroy()}createQuery(){let e=this._layerView.layer.createQuery();return e.outFields=this._layerView.availableFieldsForQuery,e.returnZ=this._returnZ,e.returnM=this._returnM,e.outSpatialReference=this.tilingScheme?.spatialReference??this._layerView.view.spatialReference,e}get availableFields(){return this._layerView.availableFields}get requiredFields(){return this._layerView.requiredFields}get memoryCache(){return this._memoryCache}get isGlobal(){return this._layerView.view.state.isGlobal}get tilingScheme(){return this._layerView.view.featureTiles?.tilingScheme}get scheduler(){return this._layerView.view.resourceController?.scheduler}get geometryType(){return this._layerView.layer.geometryType}get fullExtent(){return this._layerView.layer.fullExtent}get tileMaxRecordCount(){return this._layerView.layer.capabilities.query.tileMaxRecordCount}get standardMaxRecordCount(){return this._layerView.layer.capabilities.query.standardMaxRecordCount}get maxRecordCount(){return this._layerView.layer.capabilities.query.maxRecordCount}get isDraped(){return this._layerView.layer.elevationInfo?.mode===`on-the-ground`}get effectiveDisplayFilter(){return this._layerView.displayFilterEnabled?this._layerView.effectiveDisplayFilter:null}get highlightIds(){return this._layerView.displayFilterEnabled?this._layerView.highlightIds:null}get capabilities(){return this._capabilities??=r(this._layerView.layer),this._capabilities}logFetchError(e,t){e.error(`#fetchTile()`,this._layerView.layer,t?.message??t)}}function r(e){let t=e.capabilities.query;return{supportsMultipleResolutions:i(e),supportsPagination:!!(t&&t.supportsPagination),supportsResultType:!!(t&&t.supportsResultType),supportsCacheHint:!!(t&&t.supportsCacheHint),supportsQuantization:!!(t&&t.supportsQuantization),supportsQuantizationEditMode:!!(t&&t.supportsQuantizationEditMode),supportsMaxRecordCountFactor:!!(t&&t.supportsMaxRecordCountFactor),supportsFormatPBF:!!(t&&t.supportsFormatPBF)}}function i(e){switch(e.geometryType){case`polyline`:return!0;case`polygon`:return e.capabilities&&e.capabilities.query&&e.capabilities.query.supportsQuantization;default:return!1}}export{n as FeatureTileFetcher3DContext,r as contextCapabilitiesFromLayer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{len as e,set as t,normalize as n,dot as r,scale as i,copy as a,dist as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as s,freeze as c,create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{distance as u}from"../../../../geometry/support/aaBoundingRect.js";import{intersectsPoint as d}from"../../../../geometry/support/frustumPlanes.js";import{fromValues as f}from"../../../../geometry/support/ray.js";import p from"../../webgl/RenderCamera.js";import{FeatureTileVisibility3D as m,minTileLOD as h}from"./FeatureTileVisibility3D.js";class g{constructor(e,t,n){this._renderCoordsHelper=e,this._tilingScheme=t,this._camera=new p,this._surfaceElevation=0,this._focusOnMap=[0,0],this._visibility=new m(e,n)}set opaqueGround(e){this._visibility.opaqueGround=e}setup(e,t,n){this._camera.copyFrom(e),this._surfaceElevation=n,this._focusOnMap[0]=t.x,this._focusOnMap[1]=t.y,this._visibility.setup(this._camera)}done(){this._visibility.done()}update(e){let{measures:t,extent:n,level:r}=e;n&&(t.visible=this._visibility.compute(e),t.distance=u(n,this._focusOnMap),t.mergeable=!0,t.lodLevel=h,t.splitPriority=Math.max(0,h-r),t.visible&&(this._isGlobal?this._updateSplitAndLodGlobal(e):this._updateSplitAndLodLocal(e)))}_updateSplitAndLodGlobal(a){let o=a.level,s=this._renderCoordsHelper,{eye:c,fov:l}=this._camera,u=s.referenceEllipsoid.radius,d=e(c)-u;if(Math.atan(u/d)*2<l&&d>0){a.measures.lodLevel=Math.max(o,h);return}let f=_,{extent:p}=a;if(!p)return;let{_surfaceElevation:m}=this;t(f[0],p[0],p[1],m),t(f[1],p[2],p[1],m),t(f[2],p[2],p[3],m),t(f[3],p[0],p[3],m);let g=t(v,.5*(p[0]+p[2]),.5*(p[1]+p[3]),m),y=this._tilingScheme.spatialReference;for(let e=0;e<4;++e)s.toRenderCoords(f[e],y,f[e]);s.toRenderCoords(g,y,g);let x=n(S.direction,g),C=r(c,x),w=i(b,x,C);this._updateSplitAndLod(a,f,g,w)}_updateSplitAndLodLocal(e){let n=_,{extent:r}=e;if(!r)return;let{_surfaceElevation:i}=this;t(n[0],r[0],r[1],i),t(n[1],r[2],r[1],i),t(n[2],r[2],r[3],i),t(n[3],r[0],r[3],i);let o=this._tilingScheme.spatialReference;for(let e=0;e<4;++e)this._renderCoordsHelper.toRenderCoords(n[e],o,n[e]);let s=t(v,.5*(n[0][0]+n[2][0]),.5*(n[0][1]+n[2][1]),.25*(n[0][2]+n[1][2]+n[2][2]+n[3][2])),c=t(y,s[0],s[1],0),{eye:l,far:u}=this._camera,d=t(b,c[0],c[1],l[2]);t(S.origin,c[0],c[1],l[2]-2*u),a(S.direction,x),this._updateSplitAndLod(e,n,s,d)}_updateSplitAndLod(e,t,n,i){let a=Math.max(o(t[0],t[2]),o(t[1],t[3]),o(t[0],n)+o(n,t[2]),o(t[1],n)+o(n,t[3])),{eye:s,near:c,fov:l,viewForward:u,width:f,height:p,pixelRatio:m,frustum:h}=this._camera,g=r(s,u),_=r(n,u)-g,v=o(n,s),y=_,b=_,x=v,S=v,O=E(v,_);for(let e of t){let t=r(e,u)-g;y=Math.min(y,t),b=Math.max(b,t);let n=o(e,s);S=Math.max(S,n),x=Math.min(x,n);let i=E(n,t);O=Math.min(O,i)}if(b<c){e.measures.lodLevel=0;return}let k=o(s,i);D(O,l)&&k>w*a&&(b=T*S,y=T*x);let A=.5*Math.sqrt(f*f+p*p)/m,j=2*Math.tan(.5*l),M=e=>Math.max(c,e)*C/A*j,N=e.level,P=a*2**N*Math.max(1,j),F=M(y),I=Math.ceil(Math.log2(Math.max(1,P/F)));if(e.measures.lodLevel=Math.max(I,e.measures.lodLevel),e.measures.splitPriority+=e.measures.lodLevel-N,N<I){let n=+d(h,t[0])+ +d(h,t[1])+ +d(h,t[2])+ +d(h,t[3]);e.measures.splitPriority+=n}let L=M(b)/F;L>2.5&&(e.measures.splitPriority+=L)}get _isGlobal(){return this._renderCoordsHelper.
|
|
2
|
+
import{len as e,set as t,normalize as n,dot as r,scale as i,copy as a,dist as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as s,freeze as c,create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{distance as u}from"../../../../geometry/support/aaBoundingRect.js";import{intersectsPoint as d}from"../../../../geometry/support/frustumPlanes.js";import{fromValues as f}from"../../../../geometry/support/ray.js";import p from"../../webgl/RenderCamera.js";import{FeatureTileVisibility3D as m,minTileLOD as h}from"./FeatureTileVisibility3D.js";class g{constructor(e,t,n){this._renderCoordsHelper=e,this._tilingScheme=t,this._camera=new p,this._surfaceElevation=0,this._focusOnMap=[0,0],this._visibility=new m(e,n)}set opaqueGround(e){this._visibility.opaqueGround=e}setup(e,t,n){this._camera.copyFrom(e),this._surfaceElevation=n,this._focusOnMap[0]=t.x,this._focusOnMap[1]=t.y,this._visibility.setup(this._camera)}done(){this._visibility.done()}update(e){let{measures:t,extent:n,level:r}=e;n&&(t.visible=this._visibility.compute(e),t.distance=u(n,this._focusOnMap),t.mergeable=!0,t.lodLevel=h,t.splitPriority=Math.max(0,h-r),t.visible&&(this._isGlobal?this._updateSplitAndLodGlobal(e):this._updateSplitAndLodLocal(e)))}_updateSplitAndLodGlobal(a){let o=a.level,s=this._renderCoordsHelper,{eye:c,fov:l}=this._camera,u=s.referenceEllipsoid.radius,d=e(c)-u;if(Math.atan(u/d)*2<l&&d>0){a.measures.lodLevel=Math.max(o,h);return}let f=_,{extent:p}=a;if(!p)return;let{_surfaceElevation:m}=this;t(f[0],p[0],p[1],m),t(f[1],p[2],p[1],m),t(f[2],p[2],p[3],m),t(f[3],p[0],p[3],m);let g=t(v,.5*(p[0]+p[2]),.5*(p[1]+p[3]),m),y=this._tilingScheme.spatialReference;for(let e=0;e<4;++e)s.toRenderCoords(f[e],y,f[e]);s.toRenderCoords(g,y,g);let x=n(S.direction,g),C=r(c,x),w=i(b,x,C);this._updateSplitAndLod(a,f,g,w)}_updateSplitAndLodLocal(e){let n=_,{extent:r}=e;if(!r)return;let{_surfaceElevation:i}=this;t(n[0],r[0],r[1],i),t(n[1],r[2],r[1],i),t(n[2],r[2],r[3],i),t(n[3],r[0],r[3],i);let o=this._tilingScheme.spatialReference;for(let e=0;e<4;++e)this._renderCoordsHelper.toRenderCoords(n[e],o,n[e]);let s=t(v,.5*(n[0][0]+n[2][0]),.5*(n[0][1]+n[2][1]),.25*(n[0][2]+n[1][2]+n[2][2]+n[3][2])),c=t(y,s[0],s[1],0),{eye:l,far:u}=this._camera,d=t(b,c[0],c[1],l[2]);t(S.origin,c[0],c[1],l[2]-2*u),a(S.direction,x),this._updateSplitAndLod(e,n,s,d)}_updateSplitAndLod(e,t,n,i){let a=Math.max(o(t[0],t[2]),o(t[1],t[3]),o(t[0],n)+o(n,t[2]),o(t[1],n)+o(n,t[3])),{eye:s,near:c,fov:l,viewForward:u,width:f,height:p,pixelRatio:m,frustum:h}=this._camera,g=r(s,u),_=r(n,u)-g,v=o(n,s),y=_,b=_,x=v,S=v,O=E(v,_);for(let e of t){let t=r(e,u)-g;y=Math.min(y,t),b=Math.max(b,t);let n=o(e,s);S=Math.max(S,n),x=Math.min(x,n);let i=E(n,t);O=Math.min(O,i)}if(b<c){e.measures.lodLevel=0;return}let k=o(s,i);D(O,l)&&k>w*a&&(b=T*S,y=T*x);let A=.5*Math.sqrt(f*f+p*p)/m,j=2*Math.tan(.5*l),M=e=>Math.max(c,e)*C/A*j,N=e.level,P=a*2**N*Math.max(1,j),F=M(y),I=Math.ceil(Math.log2(Math.max(1,P/F)));if(e.measures.lodLevel=Math.max(I,e.measures.lodLevel),e.measures.splitPriority+=e.measures.lodLevel-N,N<I){let n=+d(h,t[0])+ +d(h,t[1])+ +d(h,t[2])+ +d(h,t[3]);e.measures.splitPriority+=n}let L=M(b)/F;L>2.5&&(e.measures.splitPriority+=L)}get _isGlobal(){return this._renderCoordsHelper.isGlobal}}const _=[l(),l(),l(),l()],v=l(),y=l(),b=l(),x=c(0,0,1),S=f(s,x),C=312,w=.5,T=2;function E(e,t){return t<=0?1/0:Math.sqrt(e*e-t*t)/t}function D(e,t){return e>Math.tan(.5*t)}export{g as FeatureTileMeasurements3D,E as calcForwardTan,D as isForwardTanOutsideView};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{normalize as e,copy as t,set as n,dist as r,sub as i,dot as a,scaleAndAdd as o,scale as s,cross as c,len as l,direction as u,crossAndNormalize as d}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f,fromValues as p,freeze as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as h}from"../../../../geometry/ellipsoidUtils.js";import{projectBuffer as g}from"../../../../geometry/projection/projectBuffer.js";import{projectVec3Array as _}from"../../../../geometry/projection/projectVec3Array.js";import{getSphericalPCPF as v}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{isAnyPointInConvexPolyhedron as y,lineSegmentIntersectsConvexPolyhedron as b}from"../../../../geometry/support/convexPolyhedron.js";import{fromValues as x,signedDistance as S}from"../../../../geometry/support/plane.js";import{Frustum as C}from"../../state/Frustum.js";import{sphereIntersectsInfiniteVerticalCylinderConservative as w,sphereIntersectsInfiniteRadialConeConservative as T}from"../../support/ElevationAgnosticVisibility.js";import{correctSphericalTileCornersForLatitude as E,computeSmallestSphericalTileCone as D,getSphericalTilePole as O}from"../../support/sphericalTileUtils.js";class k{constructor(e,t){this._renderCoordsHelper=e,this.opaqueGround=t,this._cache=new Map,this._cameraForward=f(),this._cameraEye=f(),this._cameraFovY=55*Math.PI/180,this._frustum=new C(e),this._renderSR=e.spatialReference;let n=v(this._renderSR);this._renderSREllipsoidRadius=h(n).radius}setup(n){this._aboveGround=n.aboveGround,this._frustum.update(n),e(this._cameraForward,n.viewForward),t(this._cameraEye,n.eye),this._cameraFovY=n.fovY}done(){this._cache.clear()}compute(e){if(this._cache.has(e.id))return this._cache.get(e.id);let t=this._isVisibleInFrustum(e);return this._cache.set(e.id,t),t}_isVisibleInFrustum(e){return this._renderCoordsHelper.
|
|
2
|
+
import{normalize as e,copy as t,set as n,dist as r,sub as i,dot as a,scaleAndAdd as o,scale as s,cross as c,len as l,direction as u,crossAndNormalize as d}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f,fromValues as p,freeze as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as h}from"../../../../geometry/ellipsoidUtils.js";import{projectBuffer as g}from"../../../../geometry/projection/projectBuffer.js";import{projectVec3Array as _}from"../../../../geometry/projection/projectVec3Array.js";import{getSphericalPCPF as v}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{isAnyPointInConvexPolyhedron as y,lineSegmentIntersectsConvexPolyhedron as b}from"../../../../geometry/support/convexPolyhedron.js";import{fromValues as x,signedDistance as S}from"../../../../geometry/support/plane.js";import{Frustum as C}from"../../state/Frustum.js";import{sphereIntersectsInfiniteVerticalCylinderConservative as w,sphereIntersectsInfiniteRadialConeConservative as T}from"../../support/ElevationAgnosticVisibility.js";import{correctSphericalTileCornersForLatitude as E,computeSmallestSphericalTileCone as D,getSphericalTilePole as O}from"../../support/sphericalTileUtils.js";class k{constructor(e,t){this._renderCoordsHelper=e,this.opaqueGround=t,this._cache=new Map,this._cameraForward=f(),this._cameraEye=f(),this._cameraFovY=55*Math.PI/180,this._frustum=new C(e),this._renderSR=e.spatialReference;let n=v(this._renderSR);this._renderSREllipsoidRadius=h(n).radius}setup(n){this._aboveGround=n.aboveGround,this._frustum.update(n),e(this._cameraForward,n.viewForward),t(this._cameraEye,n.eye),this._cameraFovY=n.fovY}done(){this._cache.clear()}compute(e){if(this._cache.has(e.id))return this._cache.get(e.id);let t=this._isVisibleInFrustum(e);return this._cache.set(e.id,t),t}_isVisibleInFrustum(e){return this._renderCoordsHelper.isGlobal?this._isTileVisibleInFrustumGlobal(e):this._isTileVisibleInFrustumLocal(e)}_isTileVisibleInFrustumLocal(e){let t=e.spatialReference,s=e.extent,c=this._renderSR;if(!s)return!0;if(N[0]=s[0],N[1]=s[1],N[2]=0,N[3]=s[2],N[4]=s[3],N[5]=0,!g(N,t,0,N,c,0))return!1;n(P[0],N[0],N[1],0),n(P[1],N[3],N[1],0),n(P[2],N[3],N[4],0),n(P[3],N[0],N[4],0),n(F,.5*(N[0]+N[3]),.5*(N[1]+N[4]),.5*(N[2]+N[5]));let l=G,u=.5*r(P[0],P[2]),d=this._frustum,{center:f,radius:p}=d.boundingSphere,m=p+J,h=L;i(h,f,F);let _=a(l,h);if(o(I,F,l,_),!w(F,u,f,m))return!1;let v=this._cameraForward,x=a(v,G),S=this._cameraFovY,C=this._cameraEye;if(Math.abs(x)<Math.abs(Math.cos(.5*S))){let e=!0,t=n(K,v[0],v[1],0),r=a(C,t);for(let n=0;n<4;++n){let i=P[n];if(a(i,t)-r>0){e=!1;break}}if(e)return!1}{let e=P[0],t=P[2];if(e[0]<=C[0]&&C[0]<=t[0]&&e[1]<=C[1]&&C[1]<=t[1])return!0}let T=M,E=this.opaqueGround&&this._aboveGround,D=this.opaqueGround&&!this._aboveGround,O=Math.min(D?W:1/0,_+m),k=Math.max(E?-W:-1/0,_-m);for(let e=0;e<4;++e)o(T[e],P[e],l,O),o(T[e+4],P[e],l,k);if(d.isConvexHullOutsideViewPyramid(T,8))return!1;if(y(d.planes,T,8))return!0;for(let e=0;e<4;++e){let t=T[e],n=T[e+4];if(d.lineSegmentIntersectsViewPyramid(t,n))return!0;let r=T[(e+1)%4];if(d.lineSegmentIntersectsViewPyramid(t,r))return!0;let i=T[4+(e+1)%4];if(d.lineSegmentIntersectsViewPyramid(n,i))return!0}if(q[0][3]=+P[0][0],q[1][3]=-P[2][0],q[2][3]=+P[0][1],q[3][3]=-P[2][1],q[4][3]=+k,q[5][3]=-O,y(q,d.points))return!0;for(let e=0;e<4;++e){let t=C,n=d.points[e+4];if(b(q,t,n))return!0;let r=d.points[4+(e+1)%4];if(b(q,n,r))return!0}return!1}_isTileVisibleInFrustumGlobal(t){if(t.level<A)return!0;let o=t.spatialReference,f=t.extent;if(!f||!o)return!0;let p=this.opaqueGround&&this._aboveGround,m=this.opaqueGround&&!this._aboveGround,h=P,g=.5*(f[0]+f[2]);if(n(h[0],f[0],f[1],0),n(h[1],f[2],f[1],0),n(h[2],f[2],f[3],0),n(h[3],f[0],f[3],0),n(h[4],g,f[1],0),n(h[5],g,f[3],0),!_(h,o,0,h,this._renderSR,0,6))return!1;let v=this._renderSREllipsoidRadius;E(h,v);let y=F,b=this._frustum,{center:x,radius:C}=b.boundingSphere,w=C+J,k=b.planes,j=te,M=D(h[0],h[1],h[2],h[3],j);s(y,j,v);let N=Math.sqrt(1-M*M),I=b.origin,L=b.points,z=!1;if(p){z=!0;let t=e(_e,I);for(let n=0;n<4;++n){let r=L[4+n],o=i(ye,r,I);e(o,o);let s=c(be,t,o);e(s,s);let l=c(xe,o,s);if(e(l,l),a(I,l)>v){z=!1;break}}if(z&&a(I,j)<v*N-W||a(t,j)<-M)return!1;{let t=e(ve,b.direction);if(a(t,j)>Se)return!1}}if(M>.9)return!0;let B=!1;if(l(x)<=w&&!k.some(e=>S(e,R)>0)){if(p)B=!0;else return!0}if(!B&&!T(j,M,x,w))return!1;if(!z&&(h.some(e=>b.intersectsPoint(e))||b.intersectsPoint(y)))return!0;let V=re;i(V,x,R);let H=a(V,j),G=ne;s(G,j,H);let K=r(G,x),q=O(t.lij,o),Y=q===1||q===3,X=q===2||q===3,Ce=X?me:Y?fe:ue,we=X?he:Y?pe:de;if(!B){let e=h,t=ge,n=oe,r=se,i=R;for(let o of Ce){let c=e[o],l=e[(o+1)%4];if(u(n,l,c),u(r,i,c),d(t,r,n),a(t,j)>0&&s(t,t,-1),ee(t,L,1))return!1}}let Z=null;if(!p&&H<1.01*w){let e=2.5*w;if(K>N*e+w)return!1;let t=ae,r=e/N;for(let e=0;e<4;++e)s(t[e],h[e],r/v);n(t[4],0,0,0),Z=t}else{let e=H+w,t=H-w,n=(m?v+W:e)/N,r=p?v-W:t/N,i=ie;for(let e=0;e<4;++e){let t=h[e];s(i[e],t,r/v),s(i[e+4],t,n/v)}Z=i}if(b.isConvexHullOutsideViewPyramid(Z,Z.length))return!1;let Te=b.lines,Q=ce,$=le;for(let t of Te){e($,t.direction);for(let t of we){let n=Z[t];if(e(Q,n),U($,Q,Z,L))return!1;let r=(t+1)%4;if(p){let t=Z[r];if(i(Q,t,n),e(Q,Q),U($,Q,Z,L))return!1}if(m){let n=Z[4+t],a=Z[4+r];if(i(Q,a,n),e(Q,Q),U($,Q,Z,L))return!1}}}return!0}}const A=2,j=4;function ee(e,t,n){for(let r of t)if(a(r,e)<n)return!1;return!0}const M=[f(),f(),f(),f(),f(),f(),f(),f()],N=[0,0,0,0,0,0],P=[f(),f(),f(),f(),f(),f()],F=f(),te=f(),ne=f(),I=f(),L=f(),R=m(0,0,0),re=f(),ie=[f(),f(),f(),f(),f(),f(),f(),f()],ae=[f(),f(),f(),f(),f()],oe=f(),se=f(),ce=f(),le=f(),z=f(),ue=[0,1,2,3],de=[0,1,2,3],fe=[0,1,3],pe=[0,1,3],me=[1,2,3],he=[1,2,3],ge=f();function B(e,t,n){let r=1/0,i=-1/0;for(let e of n){let n=a(t,e);r=Math.min(r,n),i=Math.max(i,n)}e[0]=r,e[1]=i}function V(e,t,n,r){let i=1/0,o=-1/0;for(let s of r){let r=a(n,s);if(i=Math.min(i,r),o=Math.max(o,r),i<=t&&o>=e)return!1}return!0}const H=[0,0];function U(e,t,n,r){let i=n.length,a=r.length;if(i===0||a===0)return!0;let o=z;d(o,e,t);let s=a<i,c=s?r:n,l=s?n:r,u=H;return B(u,o,c),V(u[0],u[1],o,l)}const W=430,_e=f(),ve=f(),ye=f(),be=f(),xe=f(),Se=Math.cos(.25*Math.PI),G=p(0,0,1),K=f(),q=[x(-1,0,0,1),x(1,0,0,-1),x(0,-1,0,1),x(0,1,0,-1),x(0,0,-1,1),x(0,0,1,-1)],J=1;export{k as FeatureTileVisibility3D,j as maxLODLevelDelta,A as minTileLOD};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{EventedAccessor as r}from"../../../../core/Evented.js";import{copy as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a,ZEROS as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import s from"../../../../core/Logger.js";import{getMetersPerVerticalUnitForSR as c}from"../../../../core/units.js";import{isEmpty as l,copy as u,center as d,diameter as f,squaredDistanceToPoint as p}from"../../../../geometry/support/aaBoundingBox.js";import{allFinite as m}from"../../../../geometry/support/aaBoundingRect.js";import{getInfo as h}from"../../../../geometry/support/spatialReferenceUtils.js";import{getMetersPerUnit as g}from"../../../../symbols/support/unitConversionUtils.js";import{ElevationUpdateEvent as _}from"../../support/ElevationUpdateEvent.js";import{ProjectedElevationUpdateExtent as v,calculateElevationUpdateExtents as y,fullWorldElevationUpdateExtent as b,planetCenterProximityToleranceMeters as x}from"../../support/elevationUpdateExtentUtils.js";import{affectsGeometry as S}from"../../webgl-engine/lib/affectsGeometry.js";import{Intersector as C}from"../../webgl-engine/lib/Intersector.js";const w=Symbol(`layerHandles`);let T=class extends r{get spatialReference(){return this.view.spatialReference}constructor(e){super(e),this._elevationOffset=0}initialize(){this._renderCoordsHelper=this.view.renderCoordsHelper,this._projectedExtent=new v(this._renderCoordsHelper),this._intersectLayers=[this.stageLayer],this._intersector=new C(this.view.state.
|
|
2
|
+
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{EventedAccessor as r}from"../../../../core/Evented.js";import{copy as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a,ZEROS as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import s from"../../../../core/Logger.js";import{getMetersPerVerticalUnitForSR as c}from"../../../../core/units.js";import{isEmpty as l,copy as u,center as d,diameter as f,squaredDistanceToPoint as p}from"../../../../geometry/support/aaBoundingBox.js";import{allFinite as m}from"../../../../geometry/support/aaBoundingRect.js";import{getInfo as h}from"../../../../geometry/support/spatialReferenceUtils.js";import{getMetersPerUnit as g}from"../../../../symbols/support/unitConversionUtils.js";import{ElevationUpdateEvent as _}from"../../support/ElevationUpdateEvent.js";import{ProjectedElevationUpdateExtent as v,calculateElevationUpdateExtents as y,fullWorldElevationUpdateExtent as b,planetCenterProximityToleranceMeters as x}from"../../support/elevationUpdateExtentUtils.js";import{affectsGeometry as S}from"../../webgl-engine/lib/affectsGeometry.js";import{Intersector as C}from"../../webgl-engine/lib/Intersector.js";const w=Symbol(`layerHandles`);let T=class extends r{get spatialReference(){return this.view.spatialReference}constructor(e){super(e),this._elevationOffset=0}initialize(){this._renderCoordsHelper=this.view.renderCoordsHelper,this._projectedExtent=new v(this._renderCoordsHelper),this._intersectLayers=[this.stageLayer],this._intersector=new C(this.view.state.isGlobal),this._intersector.options.store=0;let[e,t]=this._computeLayerElevationRange(this.spatialReference,this.stageLayer);this._zmin=e,this._zmax=t;let n=this.stageLayer.events;this.addHandles([n.on([`layerObjectAdded`,`layerObjectRemoved`,`transformationChanged`,`shaderTransformationChanged`],e=>this._objectChanged(e)),n.on(`geometriesChanged`,({object:e})=>this._objectChanged(e)),n.on(`attributesChanged`,({attribute:e,object:t})=>S(e)&&this._objectChanged(t))],w)}destroy(){this.removeHandles(w)}elevationInfoChanged(){let e=this.layer==null?null:this.layer.elevationInfo;if(e!=null&&e.mode!==`on-the-ground`){let t=c(this.layer.spatialReference),n=g(e.unit??`meters`);this._elevationOffset=(e.offset??0)*n/t}else this._elevationOffset=0}getElevation(e,t,n,r){if(j[0]=e,j[1]=t,j[2]=n,!this._renderCoordsHelper.toRenderCoords(j,r,j))return s.getLogger(this).error(`could not project point for elevation alignment`),null;let i=this._elevationOffset,a=this._zmin+i,o=this._zmax+i;return this._renderCoordsHelper.setAltitude(N,o,j),this._renderCoordsHelper.setAltitude(P,a,j),this._intersector.reset(N,P,this.stageLayer.stage.view.state.camera),this._intersector.intersect(this._intersectLayers,null,1,null,e=>!!e.lastValidElevationBB),this._intersector.results.min.getIntersectionPoint(j)?this._renderCoordsHelper.getAltitude(j):null}_objectChanged(e){let t=this.spatialReference;if(!e.lastValidElevationBB||!t)return;let n=e.lastValidElevationBB,{box:r,sphere:i}=e.boundingVolumeWorldSpace;if(this.view.state.isGlobal&&(!l(n)&&E(n)||E(r))){this._emitFullExtentElevationChange(t),u(n,r);return}let a=!l(n),o=new Float64Array(a?8:4),s=1/0,c=-1/0,d=!1;if(a&&(this._resetProjectedExtent(n,t),this._expandExtent(t,n,k,this._projectedExtent)||(d=!0),m(this._projectedExtent.extent)?(s=Math.min(s,k[0]),c=Math.max(c,k[1]),o.set(this._projectedExtent.extent)):d=!0),this._projectedExtent.reset(i.center,i.radius,t),this._expandExtent(t,r,D,this._projectedExtent)||(d=!0),m(this._projectedExtent.extent)?(s=Math.min(s,D[0]),c=Math.max(c,D[1]),o.set(this._projectedExtent.extent,a?4:0)):d=!0,d){this._emitFullExtentElevationChange(t),u(n,r);return}let f=y(o,t);f.length>0&&(this._zmin=Math.min(this._zmin,s),this._zmax=Math.max(this._zmax,c));for(let e of f)this._emitElevationChangeEvent(e,t);u(n,r)}_computeLayerElevationRange(e,t){let n=1/0,r=-1/0;return e!=null&&t.objects.forEach(t=>{this._expandExtent(e,t.boundingVolumeWorldSpace.box,O)&&(n=Math.min(n,O[0]),r=Math.max(r,O[1]))}),[n,r]}_expandExtent(e,t,n,r=null){n[0]=1/0,n[1]=-1/0;for(let a=0;a<8;++a){j[0]=t[a&1?0:3],j[1]=t[a&2?1:4],j[2]=t[a&4?2:5];let o=r==null?this._renderCoordsHelper.fromRenderCoords(j,j,e):r.addRenderPoint(j,e);if(o!=null)n[0]=Math.min(n[0],o[2]),n[1]=Math.max(n[1],o[2]);else if(r!=null)return!1;if(r!=null){for(let n=0;n<3;++n)if(!(a&1<<n)&&(i(M,j),M[n]=t[n],!r.addRenderEdge(j,M,e)))return!1}}return!0}_emitFullExtentElevationChange(e){let t=h(e);t!=null&&this._emitElevationChangeEvent(b(e,t),e)}_emitElevationChangeEvent(e,t){let n=new _(t,e);this.emit(`elevation-change`,n)}_resetProjectedExtent(e,t){d(e,A),this._projectedExtent.reset(A,.5*f(e),t)}};e([t({constructOnly:!0})],T.prototype,`layer`,void 0),e([t({constructOnly:!0})],T.prototype,`stageLayer`,void 0),e([t({constructOnly:!0})],T.prototype,`view`,void 0),e([t()],T.prototype,`spatialReference`,null),T=e([n(`esri.views.3d.layers.support.StageLayerElevationProvider`)],T);function E(e){return p(e,o)<=x*x}const D=new Float64Array(2),O=new Float64Array(2),k=new Float64Array(2),A=a(),j=a(),M=a(),N=a(),P=a();export{T as StageLayerElevationProvider};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{sub as e,normalize as t,len as n,dot as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as i,create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import o from"../../../../core/Logger.js";import{getOrCreateMapValue as s}from"../../../../core/MapUtils.js";import{fromValues as c,isEmpty as l,containedBySphere as u,setEmpty as d,intersectsSphere as f,intersectsRay as p,copy as m,exactEquals as h}from"../../../../geometry/support/aaBoundingBox.js";import{fromValues as g}from"../../../../geometry/support/aaBoundingRect.js";import{earth as _}from"../../../../geometry/support/Ellipsoid.js";import{ElevationRange as v}from"../../support/ElevationRange.js";function y(e,t){return e===`local`?new x(t):new S(t)}class b{constructor(e,t){this.viewingMode=e,this.layerExtent=t,this._rootNode=null,this._intersectionGeneration=0,this._tileMap=new Map}get elevationRange(){return this._rootNode?.subtreeElevationRange}destroy(){this._rootNode?.clear(),this._tileMap.clear()}_nextIntersectionGeneration(){return this._intersectionGeneration++,this._intersectionGeneration}addTile(e){let{obb:t}=e,n=[this._ensureRootNode()],r=[],i=s(this._tileMap,e,()=>new Set),a=t=>{if(i.has(t))return;let n=t.addOwnTile(e);T(r,t.parent,n),i.add(t)};for(;n.length>0;){let r=n.pop(),i=this._getSizeStopLength(r);if(r.treeDepth>=U||A(e.obb)>=.5*i){a(r);continue}let{hPlane:o,vPlane:s}=r,c=t.signedDistancePlane(o.normal,o.distance),l=t.signedDistancePlane(s.normal,s.distance);c===0&&l===0?a(r):w(r,c,l,(e,t)=>{n.push(this._ensureChild(e,t))})}this._propagateSummaryUpdates(r)}removeTile(e){if(!this._rootNode){o.getLogger(`Tiles3DBVH`).error(`Tiles3DBVH: Attempted to remove a tile that is not loaded (no root node)`);return}let t=this._tileMap.get(e);if(!t||t.size===0){o.getLogger(`Tiles3DBVH`).error(`Tiles3DBVH internal error: Attempted to remove a tile that is not loaded (not in tile map)`);return}let n=[];this._tileMap.delete(e);for(let r of t){r.removeOwnTile(e);let t=r.updateOwnSummaries();T(n,r.parent,t)}this._propagateSummaryUpdates(n)}_propagateSummaryUpdates(e){if(e.length===0)return;e.sort((e,t)=>e.node.treeDepth-t.node.treeDepth);let t=new Map,n=-1,r=()=>e.length>0?e[e.length-1].node.treeDepth:-1;for(;e.length>0||t.size>0;){let i=t.size>0?n:r(),a=t;for(t=new Map;e.length>0&&r()===i;){let{node:t,childrenUpdateKind:n}=e.pop();E(a,t,n)}for(let[e,n]of a){let r=0;for(let t=0;t<4;t++){let n=e.children[t];n&&n.isLeaf&&!n.hasTiles&&(n.clear(),e.children[t]=null,r=3)}r|=e.updateSubtreeSummaries(n|r),E(t,e.parent,r)}t.size>0&&(n=i-1)}}forEachTileIntersectingRay(e,t,n,r){r?this._forEachTileIntersectingVerticalRay(e,t,n):this._forEachTileIntersectingRayGeneral(e,t,n)}_forEachTileIntersectingRayGeneral(n,r,i){let a=this._rootNode;if(!a)return;e(B,r,n);let o=t(B,B);if(!a.subtreeIntersectsRay(n,o,{tMin:0,tMax:1/0}))return;let s=this._nextIntersectionGeneration(),c=[a],l=H;l.length=0,l.push(0,1/0);let u={tMin:0,tMax:1/0};for(;c.length>0;){let e=c.pop();u.tMax=l.pop(),u.tMin=l.pop(),e.forEachOwnTileIntersectingRay(n,o,u,s,i);let{hPlane:t,vPlane:r}=e;for(let i=0;i<4;i++){let a=e.children[i];if(a==null)continue;let s=i,d=s===0||s===2,f=s===0||s===1,p=N(n,o,N(n,o,u,r,!d),t,!f);p&&a.subtreeIntersectsRay(n,o,p)&&(c.push(a),l.push(p.tMin,p.tMax))}}}_forEachTileIntersectingVerticalRay(r,i,a){let o=this._rootNode;if(!o)return;e(B,i,r);let s=t(B,B),c={tMin:0,tMax:this.viewingMode===`global`?n(r):1/0};if(!o.subtreeIntersectsRay(r,s,c))return;let l=this._nextIntersectionGeneration(),u=[o];for(;u.length>0;){let e=u.pop();e.forEachOwnTileIntersectingRay(r,s,c,l,a),e.isLeaf||w(e,k(e.hPlane,r),k(e.vPlane,r),(e,t)=>{let n=e.children[t];n&&n.subtreeIntersectsRay(r,s,c)&&u.push(n)},1)}}getElevationRangeIntersectingSphere(e){let t=this._rootNode;if(!t||!t.subtreeIntersectsSphere(e))return null;let n=this._nextIntersectionGeneration(),r=new v,i=[t];for(;i.length>0;){let t=i.pop();if(!r.contains(t.subtreeElevationRange)){if(t.subtreeContainedBySphere(e))r.expandElevationRange(t.subtreeElevationRange);else{if(t.ownIntersectsSphere(e))for(let i of t.ownTiles){if(i.bvhIntersectionGeneration===n||(i.bvhIntersectionGeneration=n,!(i.boundingVolumeIntersectsSphere?.(e)??i.obb.intersectSphere(e))))continue;let t=i.elevationRange;r.contains(t)||r.expandElevationRange(t)}t.isLeaf||w(t,O(e.center,e.radius,t.hPlane),O(e.center,e.radius,t.vPlane),(t,n)=>{let a=t.children[n];if(a&&a.subtreeIntersectsSphere(e)){if(r.contains(a.subtreeElevationRange))return;i.push(a)}})}}}return r.isEmpty?null:r}}class x extends b{constructor(e){super(`local`,e)}_getSizeStopLength(e){return e.sideLength}_ensureRootNode(){if(!this._rootNode){let e=this.layerExtent,t=Math.max(Math.abs(e[0]),Math.abs(e[1]),Math.abs(e[2]),Math.abs(e[3])),n=2**Math.max(1,Math.ceil(Math.log2(t))),r=new C(null,0,g(-n,-n,n,n),new D(i(0,1,0),0),new D(i(1,0,0),0),n*2,c(-n,-n,-1/0,n,n,1/0));this._rootNode=r}return this._rootNode}_ensureChild(e,t){if(e.treeDepth>=U){let e=`Internal error: attempted to create a child node for a node that is already at max depth`;throw o.getLogger(`Tiles3DBVH`).error(e),Error(e)}let n=e.children[t];if(n===null){let{extent:r,hPlane:i,vPlane:a,treeDepth:o,sideLength:s}=e,l=.5*(r[0]+r[2]),u=.5*(r[1]+r[3]),d=t===0||t===1,f=t===2||t===0,p=g(f?r[0]:l,d?r[1]:u,f?l:r[2],d?u:r[3]),m=new D(i.normal,-.5*(p[1]+p[3])),h=new D(a.normal,-.5*(p[0]+p[2]));n=new C(e,o+1,p,m,h,s*.5,c(p[0],p[1],-1/0,p[2],p[3],1/0)),e.children[t]=n}return n}}class S extends b{constructor(e){super(`global`,e)}_getSizeStopLength(e){return M(e.extent)}_ensureRootNode(){if(!this._rootNode){let e=new C(null,0,g(-Math.PI,-Math.PI/2,Math.PI,Math.PI/2),new D(i(0,0,1),0),new D(i(0,1,0),0),Math.PI*_.radius);this._rootNode=e}return this._rootNode}_ensureChild(e,t){if(e.treeDepth>=U){let e=`Attempted to create a child node for a node that is already at max depth`;throw o.getLogger(`Tiles3DBVH`).error(e),Error(e)}let n=e.children[t];if(n===null){let{extent:r,treeDepth:a}=e,o=.5*(r[0]+r[2]),s=.5*(r[1]+r[3]),c=t===0||t===1,l=t===2||t===0,u=g(l?r[0]:o,c?r[1]:s,l?o:r[2],c?s:r[3]),d=.5*(u[0]+u[2]),f=.5*(u[1]+u[3]),p=Math.cos(d),m=Math.sin(d),h=Math.cos(f),_=Math.sin(f),v=i(-_*p,-_*m,h),y=new D(v,0),b=new D(i(-m,p,0),0),x=j(u);n=new C(e,a+1,u,y,b,x),e.children[t]=n}return n}}class C{constructor(e,t,n,r,i,a,o){this.parent=e,this._treeDepth=t,this.extent=n,this.hPlane=r,this.vPlane=i,this.sideLength=a,this.bounds=o,this._ownAABB=c(1/0,1/0,1/0,-1/0,-1/0,-1/0),this._subtreeAABB=c(1/0,1/0,1/0,-1/0,-1/0,-1/0),this._ownElevationRange=new v,this._subtreeElevationRange=new v,this._ownTiles=[],this.children=[null,null,null,null]}get subtreeAABB(){return this._subtreeAABB}get subtreeElevationRange(){return this._subtreeElevationRange}subtreeContainedBySphere(e){let t=this._subtreeAABB;return l(t)?!0:u(t,e)}clear(){for(let e=0;e<4;e++)this.children[e]?.clear(),this.children[e]=null;this._ownTiles.length=0,d(this._ownAABB),d(this._subtreeAABB),this._ownElevationRange.initializeEmpty(),this._subtreeElevationRange.initializeEmpty()}get isLeaf(){return this.children.every(e=>e==null)}get treeDepth(){return this._treeDepth}subtreeIntersectsSphere(e){return f(this.subtreeAABB,e)}ownIntersectsSphere(e){return this.hasTiles&&f(this._ownAABB,e)}subtreeIntersectsRay(e,t,n){return p(this._subtreeAABB,e,t,n)}ownIntersectsRay(e,t,n){return this.hasTiles?p(this._ownAABB,e,t,n):null}forEachOwnTileIntersectingRay(e,t,n,r,i){if(this.ownIntersectsRay(e,t,n))for(let n of this.ownTiles)n.bvhIntersectionGeneration!==r&&(n.bvhIntersectionGeneration=r,(n.boundingVolumeIntersectsRay?.(e,t)??n.obb.intersectRay(e,t))&&i(n))}addOwnTile(e){this._ownTiles.push(e);let t=P(this._ownAABB,e,this.bounds)&&F(this._subtreeAABB,this._ownAABB,this.bounds),n=this._ownElevationRange.expandElevationRange(e.elevationRange)&&this._subtreeElevationRange.expandElevationRange(e.elevationRange);return!!t|(n?2:0)}removeOwnTile(e){let t=this._ownTiles,n=t.indexOf(e);if(n===-1){o.getLogger(`Tiles3DBVH`).error(`BVNode: Attempted to remove a tile that is not in the node`);return}let r=t.length-1;n<r&&(t[n]=t[r]),t.length=r}updateOwnSummaries(){let e=I(this._ownAABB,this.ownTiles,this.bounds),t=L(this._ownElevationRange,this.ownTiles),n=!!e|(t?2:0);return this.updateSubtreeSummaries(n)}updateSubtreeSummaries(e){if(this.isLeaf&&!this.hasTiles)return d(this._subtreeAABB),this._subtreeElevationRange.initializeEmpty(),3;let t=0;if(e&1){m(R,this._subtreeAABB),d(this._subtreeAABB),F(this._subtreeAABB,this._ownAABB,this.bounds);for(let e of this.children)e&&F(this._subtreeAABB,e.subtreeAABB,this.bounds);h(this._subtreeAABB,R)||(t|=1)}if(e&2){z.setElevationRange(this._subtreeElevationRange),this._subtreeElevationRange.initializeEmpty(),this._subtreeElevationRange.expandElevationRange(this._ownElevationRange);for(let e of this.children)e&&this._subtreeElevationRange.expandElevationRange(e.subtreeElevationRange);this._subtreeElevationRange.equals(z)||(t|=2)}return t}get ownTiles(){return this._ownTiles}get hasTiles(){return this._ownTiles.length>0}}function w(e,t,n,r,i=1e-12){t<=i&&(n<=i&&r(e,0),n>=-i&&r(e,1)),t>=-i&&(n<=i&&r(e,2),n>=-i&&r(e,3))}function T(e,t,n){t!=null&&n!==0&&e.push({node:t,childrenUpdateKind:n})}function E(e,t,n){if(t==null||n===0)return;let r=e.get(t)??0;e.set(t,r|n)}class D{constructor(e=[0,0,0],t=0){this.normal=e,this.distance=t}}function O(e,t,n){let i=r(n.normal,e)+n.distance;return i<0?Math.min(i+t,0):Math.max(i-t,0)}function k(e,t){return r(e.normal,t)+e.distance}function A(e){return 2*Math.max(e.halfSizeX,e.halfSizeY,e.halfSizeZ)}function j(e){let t=Math.abs(e[2]-e[0]),n=Math.abs(e[3]-e[1]),r=.5*(e[1]+e[3]),i=_.radius*Math.abs(Math.cos(r))*t,a=_.radius*n;return Math.max(i,a)}function M(e){let t=Math.abs(e[2]-e[0]),n=Math.abs(e[3]-e[1]),r=.5*(e[1]+e[3]),i=_.radius*Math.abs(Math.cos(r))*t,a=_.radius*n;return Math.min(i,a)}function N(e,t,n,i,a){if(!n)return null;let o=1e-12,s=r(i.normal,t),c=k(i,e)+n.tMin*s;if(Math.abs(s)<o)return(a?c>=-1e-12:c<=o)?n:null;let l=n.tMin-c/s,u=a===s>0?{tMin:Math.max(n.tMin,l),tMax:n.tMax}:{tMin:n.tMin,tMax:Math.min(n.tMax,l)};return u.tMin<=u.tMax?u:null}function P(e,t,n){let{obb:r}=t,a=[i(1,0,0),i(0,1,0),i(0,0,1)],o=r.getCenter(V),s=!1;for(let t=0;t<3;t++){let i=r.projectedRadius(a[t]),c=Math.max(n?.[t]??-1/0,o[t]-i),l=Math.min(n?.[t+3]??1/0,o[t]+i);c<e[t]&&(e[t]=c,s=!0),l>e[t+3]&&(e[t+3]=l,s=!0)}return s}function F(e,t,n){if(l(t))return!1;let r=!1;for(let i=0;i<3;i++){let a=Math.max(n?.[i]??-1/0,t[i]),o=Math.min(n?.[i+3]??1/0,t[i+3]);a<e[i]&&(e[i]=a,r=!0),o>e[i+3]&&(e[i+3]=o,r=!0)}return r}function I(e,t,n){m(R,e),d(e);for(let r of t)P(e,r,n);return!h(e,R)}function L(e,t){z.setElevationRange(e),e.initializeEmpty();for(let n of t)e.expandElevationRange(n.elevationRange);return!e.equals(z)}const R=c(0,0,0,0,0,0),z=new v,B=a(),V=a(),H=[],U=30;export{y as createTileBVH};
|
|
2
|
+
import{sub as e,normalize as t,len as n,dot as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as i,create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import o from"../../../../core/Logger.js";import{getOrCreateMapValue as s}from"../../../../core/MapUtils.js";import{fromValues as c,isEmpty as l,containedBySphere as u,setEmpty as d,intersectsSphere as f,intersectsRay as p,copy as m,exactEquals as h}from"../../../../geometry/support/aaBoundingBox.js";import{fromValues as g}from"../../../../geometry/support/aaBoundingRect.js";import{earth as _}from"../../../../geometry/support/Ellipsoid.js";import{ElevationRange as v}from"../../support/ElevationRange.js";function y(e,t){return e?new S(t):new x(t)}class b{constructor(e,t){this.isGlobal=e,this.layerExtent=t,this._rootNode=null,this._intersectionGeneration=0,this._tileMap=new Map}get elevationRange(){return this._rootNode?.subtreeElevationRange}destroy(){this._rootNode?.clear(),this._tileMap.clear()}_nextIntersectionGeneration(){return this._intersectionGeneration++,this._intersectionGeneration}addTile(e){let{obb:t}=e,n=[this._ensureRootNode()],r=[],i=s(this._tileMap,e,()=>new Set),a=t=>{if(i.has(t))return;let n=t.addOwnTile(e);T(r,t.parent,n),i.add(t)};for(;n.length>0;){let r=n.pop(),i=this._getSizeStopLength(r);if(r.treeDepth>=U||A(e.obb)>=.5*i){a(r);continue}let{hPlane:o,vPlane:s}=r,c=t.signedDistancePlane(o.normal,o.distance),l=t.signedDistancePlane(s.normal,s.distance);c===0&&l===0?a(r):w(r,c,l,(e,t)=>{n.push(this._ensureChild(e,t))})}this._propagateSummaryUpdates(r)}removeTile(e){if(!this._rootNode){o.getLogger(`Tiles3DBVH`).error(`Tiles3DBVH: Attempted to remove a tile that is not loaded (no root node)`);return}let t=this._tileMap.get(e);if(!t||t.size===0){o.getLogger(`Tiles3DBVH`).error(`Tiles3DBVH internal error: Attempted to remove a tile that is not loaded (not in tile map)`);return}let n=[];this._tileMap.delete(e);for(let r of t){r.removeOwnTile(e);let t=r.updateOwnSummaries();T(n,r.parent,t)}this._propagateSummaryUpdates(n)}_propagateSummaryUpdates(e){if(e.length===0)return;e.sort((e,t)=>e.node.treeDepth-t.node.treeDepth);let t=new Map,n=-1,r=()=>e.length>0?e[e.length-1].node.treeDepth:-1;for(;e.length>0||t.size>0;){let i=t.size>0?n:r(),a=t;for(t=new Map;e.length>0&&r()===i;){let{node:t,childrenUpdateKind:n}=e.pop();E(a,t,n)}for(let[e,n]of a){let r=0;for(let t=0;t<4;t++){let n=e.children[t];n&&n.isLeaf&&!n.hasTiles&&(n.clear(),e.children[t]=null,r=3)}r|=e.updateSubtreeSummaries(n|r),E(t,e.parent,r)}t.size>0&&(n=i-1)}}forEachTileIntersectingRay(e,t,n,r){r?this._forEachTileIntersectingVerticalRay(e,t,n):this._forEachTileIntersectingRayGeneral(e,t,n)}_forEachTileIntersectingRayGeneral(n,r,i){let a=this._rootNode;if(!a)return;e(B,r,n);let o=t(B,B);if(!a.subtreeIntersectsRay(n,o,{tMin:0,tMax:1/0}))return;let s=this._nextIntersectionGeneration(),c=[a],l=H;l.length=0,l.push(0,1/0);let u={tMin:0,tMax:1/0};for(;c.length>0;){let e=c.pop();u.tMax=l.pop(),u.tMin=l.pop(),e.forEachOwnTileIntersectingRay(n,o,u,s,i);let{hPlane:t,vPlane:r}=e;for(let i=0;i<4;i++){let a=e.children[i];if(a==null)continue;let s=i,d=s===0||s===2,f=s===0||s===1,p=N(n,o,N(n,o,u,r,!d),t,!f);p&&a.subtreeIntersectsRay(n,o,p)&&(c.push(a),l.push(p.tMin,p.tMax))}}}_forEachTileIntersectingVerticalRay(r,i,a){let o=this._rootNode;if(!o)return;e(B,i,r);let s=t(B,B),c={tMin:0,tMax:this.isGlobal?n(r):1/0};if(!o.subtreeIntersectsRay(r,s,c))return;let l=this._nextIntersectionGeneration(),u=[o];for(;u.length>0;){let e=u.pop();e.forEachOwnTileIntersectingRay(r,s,c,l,a),e.isLeaf||w(e,k(e.hPlane,r),k(e.vPlane,r),(e,t)=>{let n=e.children[t];n&&n.subtreeIntersectsRay(r,s,c)&&u.push(n)},1)}}getElevationRangeIntersectingSphere(e){let t=this._rootNode;if(!t||!t.subtreeIntersectsSphere(e))return null;let n=this._nextIntersectionGeneration(),r=new v,i=[t];for(;i.length>0;){let t=i.pop();if(!r.contains(t.subtreeElevationRange)){if(t.subtreeContainedBySphere(e))r.expandElevationRange(t.subtreeElevationRange);else{if(t.ownIntersectsSphere(e))for(let i of t.ownTiles){if(i.bvhIntersectionGeneration===n||(i.bvhIntersectionGeneration=n,!(i.boundingVolumeIntersectsSphere?.(e)??i.obb.intersectSphere(e))))continue;let t=i.elevationRange;r.contains(t)||r.expandElevationRange(t)}t.isLeaf||w(t,O(e.center,e.radius,t.hPlane),O(e.center,e.radius,t.vPlane),(t,n)=>{let a=t.children[n];if(a&&a.subtreeIntersectsSphere(e)){if(r.contains(a.subtreeElevationRange))return;i.push(a)}})}}}return r.isEmpty?null:r}}class x extends b{constructor(e){super(!1,e)}_getSizeStopLength(e){return e.sideLength}_ensureRootNode(){if(!this._rootNode){let e=this.layerExtent,t=Math.max(Math.abs(e[0]),Math.abs(e[1]),Math.abs(e[2]),Math.abs(e[3])),n=2**Math.max(1,Math.ceil(Math.log2(t))),r=new C(null,0,g(-n,-n,n,n),new D(i(0,1,0),0),new D(i(1,0,0),0),n*2,c(-n,-n,-1/0,n,n,1/0));this._rootNode=r}return this._rootNode}_ensureChild(e,t){if(e.treeDepth>=U){let e=`Internal error: attempted to create a child node for a node that is already at max depth`;throw o.getLogger(`Tiles3DBVH`).error(e),Error(e)}let n=e.children[t];if(n===null){let{extent:r,hPlane:i,vPlane:a,treeDepth:o,sideLength:s}=e,l=.5*(r[0]+r[2]),u=.5*(r[1]+r[3]),d=t===0||t===1,f=t===2||t===0,p=g(f?r[0]:l,d?r[1]:u,f?l:r[2],d?u:r[3]),m=new D(i.normal,-.5*(p[1]+p[3])),h=new D(a.normal,-.5*(p[0]+p[2]));n=new C(e,o+1,p,m,h,s*.5,c(p[0],p[1],-1/0,p[2],p[3],1/0)),e.children[t]=n}return n}}class S extends b{constructor(e){super(!0,e)}_getSizeStopLength(e){return M(e.extent)}_ensureRootNode(){if(!this._rootNode){let e=new C(null,0,g(-Math.PI,-Math.PI/2,Math.PI,Math.PI/2),new D(i(0,0,1),0),new D(i(0,1,0),0),Math.PI*_.radius);this._rootNode=e}return this._rootNode}_ensureChild(e,t){if(e.treeDepth>=U){let e=`Attempted to create a child node for a node that is already at max depth`;throw o.getLogger(`Tiles3DBVH`).error(e),Error(e)}let n=e.children[t];if(n===null){let{extent:r,treeDepth:a}=e,o=.5*(r[0]+r[2]),s=.5*(r[1]+r[3]),c=t===0||t===1,l=t===2||t===0,u=g(l?r[0]:o,c?r[1]:s,l?o:r[2],c?s:r[3]),d=.5*(u[0]+u[2]),f=.5*(u[1]+u[3]),p=Math.cos(d),m=Math.sin(d),h=Math.cos(f),_=Math.sin(f),v=i(-_*p,-_*m,h),y=new D(v,0),b=new D(i(-m,p,0),0),x=j(u);n=new C(e,a+1,u,y,b,x),e.children[t]=n}return n}}class C{constructor(e,t,n,r,i,a,o){this.parent=e,this._treeDepth=t,this.extent=n,this.hPlane=r,this.vPlane=i,this.sideLength=a,this.bounds=o,this._ownAABB=c(1/0,1/0,1/0,-1/0,-1/0,-1/0),this._subtreeAABB=c(1/0,1/0,1/0,-1/0,-1/0,-1/0),this._ownElevationRange=new v,this._subtreeElevationRange=new v,this._ownTiles=[],this.children=[null,null,null,null]}get subtreeAABB(){return this._subtreeAABB}get subtreeElevationRange(){return this._subtreeElevationRange}subtreeContainedBySphere(e){let t=this._subtreeAABB;return l(t)?!0:u(t,e)}clear(){for(let e=0;e<4;e++)this.children[e]?.clear(),this.children[e]=null;this._ownTiles.length=0,d(this._ownAABB),d(this._subtreeAABB),this._ownElevationRange.initializeEmpty(),this._subtreeElevationRange.initializeEmpty()}get isLeaf(){return this.children.every(e=>e==null)}get treeDepth(){return this._treeDepth}subtreeIntersectsSphere(e){return f(this.subtreeAABB,e)}ownIntersectsSphere(e){return this.hasTiles&&f(this._ownAABB,e)}subtreeIntersectsRay(e,t,n){return p(this._subtreeAABB,e,t,n)}ownIntersectsRay(e,t,n){return this.hasTiles?p(this._ownAABB,e,t,n):null}forEachOwnTileIntersectingRay(e,t,n,r,i){if(this.ownIntersectsRay(e,t,n))for(let n of this.ownTiles)n.bvhIntersectionGeneration!==r&&(n.bvhIntersectionGeneration=r,(n.boundingVolumeIntersectsRay?.(e,t)??n.obb.intersectRay(e,t))&&i(n))}addOwnTile(e){this._ownTiles.push(e);let t=P(this._ownAABB,e,this.bounds)&&F(this._subtreeAABB,this._ownAABB,this.bounds),n=this._ownElevationRange.expandElevationRange(e.elevationRange)&&this._subtreeElevationRange.expandElevationRange(e.elevationRange);return!!t|(n?2:0)}removeOwnTile(e){let t=this._ownTiles,n=t.indexOf(e);if(n===-1){o.getLogger(`Tiles3DBVH`).error(`BVNode: Attempted to remove a tile that is not in the node`);return}let r=t.length-1;n<r&&(t[n]=t[r]),t.length=r}updateOwnSummaries(){let e=I(this._ownAABB,this.ownTiles,this.bounds),t=L(this._ownElevationRange,this.ownTiles),n=!!e|(t?2:0);return this.updateSubtreeSummaries(n)}updateSubtreeSummaries(e){if(this.isLeaf&&!this.hasTiles)return d(this._subtreeAABB),this._subtreeElevationRange.initializeEmpty(),3;let t=0;if(e&1){m(R,this._subtreeAABB),d(this._subtreeAABB),F(this._subtreeAABB,this._ownAABB,this.bounds);for(let e of this.children)e&&F(this._subtreeAABB,e.subtreeAABB,this.bounds);h(this._subtreeAABB,R)||(t|=1)}if(e&2){z.setElevationRange(this._subtreeElevationRange),this._subtreeElevationRange.initializeEmpty(),this._subtreeElevationRange.expandElevationRange(this._ownElevationRange);for(let e of this.children)e&&this._subtreeElevationRange.expandElevationRange(e.subtreeElevationRange);this._subtreeElevationRange.equals(z)||(t|=2)}return t}get ownTiles(){return this._ownTiles}get hasTiles(){return this._ownTiles.length>0}}function w(e,t,n,r,i=1e-12){t<=i&&(n<=i&&r(e,0),n>=-i&&r(e,1)),t>=-i&&(n<=i&&r(e,2),n>=-i&&r(e,3))}function T(e,t,n){t!=null&&n!==0&&e.push({node:t,childrenUpdateKind:n})}function E(e,t,n){if(t==null||n===0)return;let r=e.get(t)??0;e.set(t,r|n)}class D{constructor(e=[0,0,0],t=0){this.normal=e,this.distance=t}}function O(e,t,n){let i=r(n.normal,e)+n.distance;return i<0?Math.min(i+t,0):Math.max(i-t,0)}function k(e,t){return r(e.normal,t)+e.distance}function A(e){return 2*Math.max(e.halfSizeX,e.halfSizeY,e.halfSizeZ)}function j(e){let t=Math.abs(e[2]-e[0]),n=Math.abs(e[3]-e[1]),r=.5*(e[1]+e[3]),i=_.radius*Math.abs(Math.cos(r))*t,a=_.radius*n;return Math.max(i,a)}function M(e){let t=Math.abs(e[2]-e[0]),n=Math.abs(e[3]-e[1]),r=.5*(e[1]+e[3]),i=_.radius*Math.abs(Math.cos(r))*t,a=_.radius*n;return Math.min(i,a)}function N(e,t,n,i,a){if(!n)return null;let o=1e-12,s=r(i.normal,t),c=k(i,e)+n.tMin*s;if(Math.abs(s)<o)return(a?c>=-1e-12:c<=o)?n:null;let l=n.tMin-c/s,u=a===s>0?{tMin:Math.max(n.tMin,l),tMax:n.tMax}:{tMin:n.tMin,tMax:Math.min(n.tMax,l)};return u.tMin<=u.tMax?u:null}function P(e,t,n){let{obb:r}=t,a=[i(1,0,0),i(0,1,0),i(0,0,1)],o=r.getCenter(V),s=!1;for(let t=0;t<3;t++){let i=r.projectedRadius(a[t]),c=Math.max(n?.[t]??-1/0,o[t]-i),l=Math.min(n?.[t+3]??1/0,o[t]+i);c<e[t]&&(e[t]=c,s=!0),l>e[t+3]&&(e[t+3]=l,s=!0)}return s}function F(e,t,n){if(l(t))return!1;let r=!1;for(let i=0;i<3;i++){let a=Math.max(n?.[i]??-1/0,t[i]),o=Math.min(n?.[i+3]??1/0,t[i+3]);a<e[i]&&(e[i]=a,r=!0),o>e[i+3]&&(e[i+3]=o,r=!0)}return r}function I(e,t,n){m(R,e),d(e);for(let r of t)P(e,r,n);return!h(e,R)}function L(e,t){z.setElevationRange(e),e.initializeEmpty();for(let n of t)e.expandElevationRange(n.elevationRange);return!e.equals(z)}const R=c(0,0,0,0,0,0),z=new v,B=a(),V=a(),H=[],U=30;export{y as createTileBVH};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{removeMaybe as e}from"../../../../core/maybe.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{whenOnce as n,watch as r,initial as i}from"../../../../core/reactiveUtils.js";import{spatialReferenceIncompatibleError as a}from"../../../support/layerViewUtils.js";import{LayerElevationProvider as o}from"../i3s/LayerElevationProvider.js";import{addLayerViewToWasm as s,getLyr3DWasm as c,removeLayerViewFromWasm as l}from"../Lyr3DWasm.js";import{selectTiles3DSpatialReference as u}from"./selectTiles3DSpatialReference.js";class d{constructor(e){this._layerView=e,this._wasmLayerId=-1,this._useEsriCrs=!1,this._metersPerVCSUnit=1,this._intersectionHandler=null,this._suspendedHandle=null}get wasmLayerId(){return this._wasmLayerId}get useEsriCrs(){return this._useEsriCrs}get metersPerVCSUnit(){return this._metersPerVCSUnit}get elevationProvider(){return this._elevationProvider}async initialize(e,r){let i=this._layerView,{view:o}=i;await n(()=>o.defaultsFromMap.heightModelInfoReady,e),t(e);let c=u({
|
|
2
|
+
import{removeMaybe as e}from"../../../../core/maybe.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{whenOnce as n,watch as r,initial as i}from"../../../../core/reactiveUtils.js";import{spatialReferenceIncompatibleError as a}from"../../../support/layerViewUtils.js";import{LayerElevationProvider as o}from"../i3s/LayerElevationProvider.js";import{addLayerViewToWasm as s,getLyr3DWasm as c,removeLayerViewFromWasm as l}from"../Lyr3DWasm.js";import{selectTiles3DSpatialReference as u}from"./selectTiles3DSpatialReference.js";class d{constructor(e){this._layerView=e,this._wasmLayerId=-1,this._useEsriCrs=!1,this._metersPerVCSUnit=1,this._intersectionHandler=null,this._suspendedHandle=null}get wasmLayerId(){return this._wasmLayerId}get useEsriCrs(){return this._useEsriCrs}get metersPerVCSUnit(){return this._metersPerVCSUnit}get elevationProvider(){return this._elevationProvider}async initialize(e,r){let i=this._layerView,{view:o}=i;await n(()=>o.defaultsFromMap.heightModelInfoReady,e),t(e);let c=u({isGlobal:o.state.isGlobal,renderSpatialReference:o.renderSpatialReference,esriCrsSpatialReference:i.layer.esriCrsSpatialReference,heightModelInfo:o.heightModelInfo});if(!c)throw a(`layer`,i.layer.spatialReference.wkid,o.renderSpatialReference?.wkid);this._useEsriCrs=c.useEsriCrs,this._metersPerVCSUnit=c.metersPerVCSUnit,c.useEsriCrs&&(i.fullExtentInLocalViewSpatialReference=i.layer.esriCrsFullExtent),this._wasmLayerId=await s(i,e),e.aborted&&this.unregisterWasm(),t(e),r()}synchronizeSuspension(){let e=this._layerView;this._suspendedHandle=r(()=>e.suspended,t=>c(e.view)?.setEnabled(e,!t),i)}registerQueries(e,t){let n=this._layerView,{view:r}=n;this._intersectionHandler=e,r.sceneIntersectionHelper.addIntersectionHandler(e),this._elevationProvider=new o({view:r,layerElevationSource:n,intersectionHandler:e}),r.elevationProvider.register(t,this._elevationProvider)}setElevationContext(e){let{elevationProvider:t}=this._layerView.view;t.unregister(this._elevationProvider),t.register(e,this._elevationProvider)}unregisterWasm(){l(this._layerView),this._suspendedHandle=e(this._suspendedHandle)}unregisterQueries(e){let{view:t}=this._layerView;this._intersectionHandler&&=(t.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler.destroy(),null),this._elevationProvider&&t.elevationProvider&&(e(this._elevationProvider),t.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null)}}export{d as Tiles3DLayerViewRegistration};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{project as e}from"../../../../geometry/projectionUtils.js";import{fromExtent as t}from"../../../../geometry/support/aaBoundingRect.js";import{createTileBVH as n}from"./Tiles3DBVH.js";function r(r){let{view:i}=r,a=r.useEsriCrs?r.fullExtentInLocalViewSpatialReference:r.layer.fullExtent?e(r.layer.fullExtent,i.renderSpatialReference):void 0;return n(i.
|
|
2
|
+
import{project as e}from"../../../../geometry/projectionUtils.js";import{fromExtent as t}from"../../../../geometry/support/aaBoundingRect.js";import{createTileBVH as n}from"./Tiles3DBVH.js";function r(r){let{view:i}=r,a=r.useEsriCrs?r.fullExtentInLocalViewSpatialReference:r.layer.fullExtent?e(r.layer.fullExtent,i.renderSpatialReference):void 0;return n(i.state.isGlobal,t(a??i.extent))}export{r as createTileBVHForLayer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{unitFromRESTJSON as e,convertUnit as t}from"../../../../core/units.js";import n from"../../../../geometry/HeightModelInfo.js";import{isCompatible as r}from"../../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as i,isWebMercator as a,equals as o,isGeographic as s}from"../../../../geometry/support/spatialReferenceUtils.js";import c from"../../../../geometry/support/WKIDUnitConversion.js";import{getHeightModelInfoFromVCS as l}from"../../../../layers/support/tiles3DUtils.js";function u({
|
|
2
|
+
import{unitFromRESTJSON as e,convertUnit as t}from"../../../../core/units.js";import n from"../../../../geometry/HeightModelInfo.js";import{isCompatible as r}from"../../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as i,isWebMercator as a,equals as o,isGeographic as s}from"../../../../geometry/support/spatialReferenceUtils.js";import c from"../../../../geometry/support/WKIDUnitConversion.js";import{getHeightModelInfoFromVCS as l}from"../../../../layers/support/tiles3DUtils.js";function u({isGlobal:u,renderSpatialReference:d,esriCrsSpatialReference:f,heightModelInfo:p}){if(u||i(d)||a(d))return{useEsriCrs:!1,metersPerVCSUnit:1};if(!f||!o(f,d)||f.vcsWkid===115700)return null;let m=l(f);if(!m){let t=f,r=`meters`;!s(t)&&t.wkid&&t.wkid!==-1&&(r=e(c.units[c[t.wkid]])),r&&(m=new n({heightModel:`gravity-related-height`,heightUnit:r}))}return r(m,p,!1)===0?{useEsriCrs:!0,metersPerVCSUnit:m?t(1,m.heightUnit,`meters`):1}:null}export{u as selectTiles3DSpatialReference};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{getReferenceEllipsoid as e}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as t}from"../../../../geometry/projection/projectors.js";import{newDoubleArray as n}from"../../../../geometry/support/DoubleArray.js";import{computeVertexConnectedTriangleComponents as r}from"../../support/meshProcessing.js";import{computeUVCellStart as i,UVWorkspace as a}from"./UVWorkspace.js";function o(r,a,o,s,c=1){if(a.length===0)return;if(o.isGeographic&&s
|
|
2
|
+
import{getReferenceEllipsoid as e}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as t}from"../../../../geometry/projection/projectors.js";import{newDoubleArray as n}from"../../../../geometry/support/DoubleArray.js";import{computeVertexConnectedTriangleComponents as r}from"../../support/meshProcessing.js";import{computeUVCellStart as i,UVWorkspace as a}from"./UVWorkspace.js";function o(r,a,o,s,c=1){if(a.length===0)return;if(o.isGeographic&&s){let r=n(a.length),i=a.length,s=e(o);for(let e=0;e<i;e+=3)t(a,e,r,e,s);a=r}let l=1/0,u=1/0;for(let e=0;e<a.length;e+=3)l=Math.min(l,a[e]),u=Math.min(u,a[e+1]);let[d,f]=i(l,u,c);for(let e=0;e<a.length;e+=3){let t=e/3*4;r[t]=(a[e]-d)/c,r[t+1]=(a[e+1]-f)/c,r[t+2]=d/c,r[t+3]=f/c}}function s(e,t,n,r,i=1){if(n.length===0)return;let a=d,[o,s]=a.prepareUVFrame(n,r,i);a.writeMapSpaceUVs(e,n,o,s,i),a.writeBoundingRect(t,0)}function c(e,t,n,i,a,o,s=1){let c=i.length/3,f=Math.floor(a.length/3);if(c===0||f===0)return 0;let p=d,[m,h]=r(a,f,c),g=[];for(let e=0;e<h;++e)g[e]=[];for(let e=0;e<c;++e)n[e]=-1;for(let e=0;e<f;++e){let t=m[e],r=a[3*e],i=a[3*e+1],o=a[3*e+2];l(n,g[t],r,t),l(n,g[t],i,t),l(n,g[t],o,t)}for(let e=0;e<c;++e)n[e]<0&&(n[e]=0,g[0].push(e));for(let n=0;n<h;++n)u(i,g[n],e,t,n,o,s,p);return h}function l(e,t,n,r){e[n]===-1&&(e[n]=r,t.push(n))}function u(e,t,n,r,i,a,o,s){let[c,l]=s.prepareUVFrame(e,a,o,t);s.writeMapSpaceUVs(n,e,c,l,o,t),s.writeBoundingRect(r,i*9)}const d=new a;export{s as writeMapSpaceUVCoords,o as writeMapSpaceUVCoordsDraped,c as writeMapSpaceUVCoordsPerConnectedPart};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{property as n,subclass as r}from"../../../core/accessorSupport/decorators.js";import i from"../../../core/Logger.js";import{clamp as a,deg2rad as o}from"../../../core/mathUtils.js";import{earth as s}from"../../../geometry/support/Ellipsoid.js";import{makePiecewiseLinearFunction as c}from"../support/mathUtils.js";let l=class extends t{constructor(e){super(e),this.collision=new m,this.distance=1/0,this.minimumPoiDistance=4,this.tilt=null}get altitude(){return this.
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{property as n,subclass as r}from"../../../core/accessorSupport/decorators.js";import i from"../../../core/Logger.js";import{clamp as a,deg2rad as o}from"../../../core/mathUtils.js";import{earth as s}from"../../../geometry/support/Ellipsoid.js";import{makePiecewiseLinearFunction as c}from"../support/mathUtils.js";let l=class extends t{constructor(e){super(e),this.collision=new m,this.distance=1/0,this.minimumPoiDistance=4,this.tilt=null}get altitude(){return this.isGlobal?this._get(`altitude`):null}set altitude(e){this.isGlobal?this._set(`altitude`,e):i.getLogger(this).warn(`Altitude constraint is ignored in local scenes`)}get isGlobal(){return this.state.isGlobal}clampAltitude(e){return this.altitude?a(e,this.altitude.min,this.altitude.max):e}clampTilt(e,t){if(!this.tilt)return t;let n=this.tilt(e);return a(t,n.min,n.max)}clampDistance(e){return Math.min(e,this.distance)}createDefaultTilt(){return this.isGlobal?this._createDefaultTiltGlobal():this._createDefaultTiltLocal()}createConstantMaxTilt(e){return(t,n=p)=>(n.min=f.min,n.max=e,n)}_createDefaultTiltLocal(){let e=this.collision.enabled?c([[4e3,f.max],[1e4,o(88)],[6e6,o(88)]]):()=>f.max;return(t,n=p)=>(n.min=f.min,n.max=e(t),n)}_createDefaultTiltGlobal(){let e=this.collision.enabled?c([[4e3,f.max],[5e4,o(88)],[6e6,o(88)],[2e7,f.min]]):c([[3e5,f.max],[3e6,o(88)],[6e6,o(88)],[2e7,f.min]]);return(t,n=p)=>(n.min=f.min,n.max=e(t),n)}};e([n()],l.prototype,`altitude`,null),e([n({readOnly:!0})],l.prototype,`collision`,void 0),e([n()],l.prototype,`distance`,void 0),e([n({readOnly:!0})],l.prototype,`minimumPoiDistance`,void 0),e([n()],l.prototype,`tilt`,void 0),e([n({constructOnly:!0})],l.prototype,`state`,void 0),l=e([r(`esri.views.3d.state.Constraints`)],l);function u(e){return{min:-2e5,max:4*e.radius}}const d=u(s),f={min:o(.5),max:o(179.5)},p={min:0,max:0};let m=class extends t{constructor(){super(...arguments),this.enabled=!0,this.elevationMargin=1}};e([n({type:Boolean})],m.prototype,`enabled`,void 0),e([n({type:Number})],m.prototype,`elevationMargin`,void 0),m=e([r(`esri.views.3d.state.Constraints.CollisionConstraint`)],m);export{l as Constraints,f as TiltRange,d as earthAltitudeConstraint};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{property as n,subclass as r}from"../../../core/accessorSupport/decorators.js";import{deg2rad as i,rad2deg as a}from"../../../core/mathUtils.js";import{watch as o,sync as s,initial as c}from"../../../core/reactiveUtils.js";import{applyAll as l}from"../camera/constraintUtils.js";import{ConstraintOptions as u}from"../camera/constraintUtils/ConstraintOptions.js";import{surfaceElevationBelowRenderLocation as d}from"../camera/intersectionUtils.js";import{createNearFarHeuristic as f}from"./NearFarHeuristic.js";import{SurfaceCollisionConstraint as p}from"./SurfaceCollisionConstraint.js";let m=class extends t{constructor(e){super(e),this.nearFarHeuristic=f(e.view.state.
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{property as n,subclass as r}from"../../../core/accessorSupport/decorators.js";import{deg2rad as i,rad2deg as a}from"../../../core/mathUtils.js";import{watch as o,sync as s,initial as c}from"../../../core/reactiveUtils.js";import{applyAll as l}from"../camera/constraintUtils.js";import{ConstraintOptions as u}from"../camera/constraintUtils/ConstraintOptions.js";import{surfaceElevationBelowRenderLocation as d}from"../camera/intersectionUtils.js";import{createNearFarHeuristic as f}from"./NearFarHeuristic.js";import{SurfaceCollisionConstraint as p}from"./SurfaceCollisionConstraint.js";let m=class extends t{constructor(e){super(e),this.nearFarHeuristic=f(e.view.state.isGlobal,e.view.groundView,e.view.renderCoordsHelper.spatialReference)}initialize(){let e=()=>this._updateNearFar();this.addHandles([o(()=>[this.view.constraints.clipDistance.near,this.view.constraints.clipDistance.far],()=>this._clipDistanceNearFarChanged()),this.view.state.events.on(`before-camera-change`,({camera:e,sceneDepthRange:t})=>this._updateCameraNearFar(e,t)),o(()=>this.view.constraints.clipDistance.mode,e),o(()=>this.view.navigation.mode,e,s),o(()=>this.view.stage.renderer.sceneDepthRange.value,e,s),o(()=>this.view.renderDataExtent,e,s),o(()=>this.view.groundView.visibleElevationRange,e,s),o(()=>[this.view.constraints.altitude.min,this.view.constraints.altitude.max],()=>this._updateAltitude(),s),o(()=>this.view.constraints.tilt.max,()=>this._updateTiltMax(),s),o(()=>this.view.constraints.tilt.mode,()=>this._updateTilt(),s),o(()=>this.view.state?.camera,()=>this._updateTiltAutoMax(),s),o(()=>[this.view.map?.ground?.navigationConstraint?.type,this.view.state.constraints.collision.enabled],()=>this._updateCollision(),s)]),this.view.state.isLocal&&this.addHandles(o(()=>this.view.renderDataExtent,e=>this._updateLocalSurfaceDistance(e),c)),this._updateNearFar(),this.view.state.isGlobal&&this._updateAltitude(),this._updateTilt(),this._updateCollision(),this._set(`surfaceCollisionConstraint`,new p({view:this.view}))}destroy(){this.surfaceCollisionConstraint&&(this.surfaceCollisionConstraint.destroy(),this._set(`surfaceCollisionConstraint`,null))}_clipDistanceNearFarChanged(){let e=this.view.constraints.clipDistance;e.mode!==`auto`&&this.view.state.updateCamera(t=>h(t,e))}_updateNearFar(){let{state:e}=this.view;e.updateCamera(e=>this._updateCameraNearFar(e)),e.updateContentCameraIfPresent()}_updateCameraNearFar(e,t){let n=this.view.constraints.clipDistance;n.mode===`manual`?h(e,n):this._updateCameraNearFarAuto(e,n,t)}_updateCameraNearFarAuto(e,t,n=this.view.stage.renderer.sceneDepthRange.value){if(this.view.navigation.mode.type===`ground`)e.near=this.view.navigation.mode.nearOverride,e.far=this.view.navigation.mode.farOverride;else{let t=d(this.view,e.eye),r=this.nearFarHeuristic.compute(e,this.view.renderDataExtent,n,t);e.near=r.near,e.far=r.far}t&&t.autoUpdate(e.near,e.far)}_updateCollision(){let e=this.view.map?.ground?.navigationConstraint?.type,t=!e||e===`stay-above`,n=this.view.state.constraints.collision;t!==n.enabled&&(n.enabled=t,t&&this._reapplyConstraints(8),this.view.constraints.tilt.mode===`auto`&&this._updateTiltAuto())}_updateAltitude(){let e=this.view.constraints.altitude;this.view.state.isGlobal?this.view.state.constraints.altitude={min:e.min,max:e.max}:this.view.state.constraints.altitude=null,this._reapplyConstraints()}_updateTiltMax(){let e=this.view.constraints.tilt;e.mode!==`auto`&&(this._updateTiltManual(e),this._reapplyConstraints())}_updateTilt(){let e=this.view.constraints.tilt;e.mode===`manual`?this._updateTiltManual(e):this._updateTiltAuto(),this._reapplyConstraints()}_updateTiltManual(e){let t=this.view.state.constraints;t.tilt=t.createConstantMaxTilt(i(e.max))}_updateTiltAuto(){let e=this.view.state.constraints;e.tilt=e.createDefaultTilt(),this._updateTiltAutoMax()}_updateTiltAutoMax(){let e=this.view.constraints.tilt;if(e.mode!==`auto`)return;let t=this.view.state.constraints;if(t.tilt){let n=t.tilt(this.view.state.camera.distance).max;e.autoUpdate(a(n))}}_updateLocalSurfaceDistance(e){if(e==null)return;let t=Math.max(e.width,e.height);if(t<=0)return;e.zmax!=null&&e.zmin!=null&&(t=Math.max(t,e.zmax-e.zmin));let n=this.view.state,r=3*t/Math.atan(n.camera.fov/2);r!==n.constraints.distance&&(n.constraints.distance=r)}_reapplyConstraints(e=15){this.view.state.updateCamera(t=>{let n=t.clone();l(this.view,t,new u(e,0,null),t,n),this.surfaceCollisionConstraint?.setSourceCamera(n)})}};e([n({constructOnly:!0})],m.prototype,`view`,void 0),e([n({readOnly:!0})],m.prototype,`surfaceCollisionConstraint`,void 0),m=e([r(`esri.views.3d.state.ConstraintsManager`)],m);function h(e,t){t&&(e.near=t.near,e.far=t.far)}export{m as ConstraintsManager};
|