@arcgis/core 5.0.0-next.57 → 5.0.0-next.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Graphic.d.ts +2 -2
- package/Viewpoint.d.ts +1 -1
- package/applications/Components/arcadeFeatureUtils.d.ts +20 -1
- package/applications/Components/arcadeFeatureUtils.js +1 -1
- package/applications/Urban/meshUtils.d.ts +2 -2
- package/arcade.d.ts +1 -1
- package/arcade.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0bd73a66baea2f52e8a6.js +1 -0
- package/assets/esri/core/workers/chunks/18ce7b1559a45d017c45.js +1 -0
- package/assets/esri/core/workers/chunks/262c5794650853457acc.js +1 -0
- package/assets/esri/core/workers/chunks/3405a23973f9e701a4d6.js +1 -0
- package/assets/esri/core/workers/chunks/352c674730c7b7258ae3.js +1 -0
- package/assets/esri/core/workers/chunks/55a9ea536c64976c3409.js +1 -0
- package/assets/esri/core/workers/chunks/62752cd6821959cf6751.js +1 -0
- package/assets/esri/core/workers/chunks/72e3a48aa365542b0689.js +1 -0
- package/assets/esri/core/workers/chunks/{5f9e64f00329cb646f0c.js → 741d170187e58e81584d.js} +1 -1
- package/assets/esri/core/workers/chunks/a6b1e3ec30f6d641aea9.js +1 -0
- package/assets/esri/core/workers/chunks/{da2c41ac0f82f32013c1.js → a7aa87e2c4197ba595ef.js} +10 -10
- package/assets/esri/core/workers/chunks/{d76513a6260d9ec4ea25.js → bf82bb1cdd8b31e7f2aa.js} +1 -1
- package/assets/esri/layers/raster/formats/lerc-wasm.wasm +0 -0
- package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
- package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
- package/assets/esri/themes/base/widgets/_Attribution.scss +2 -2
- package/assets/esri/themes/base/widgets/_FeatureTable.scss +24 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ar.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bg.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bs.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ca.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_cs.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_da.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_de.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_el.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_en.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_es.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_et.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fi.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fr.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_he.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hr.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hu.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_id.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_it.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ja.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ko.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lt.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lv.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_nl.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_no.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pl.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-BR.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-PT.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ro.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ru.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sk.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sl.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sr.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sv.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_th.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_tr.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_uk.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_vi.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-CN.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-HK.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-TW.json +1 -1
- package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_fr.json +1 -1
- package/chunks/lerc-wasm.js +1 -1
- package/config.js +1 -1
- package/core/workers/workerFactory.js +1 -1
- package/editing/sharedTemplates/executor/builders/offsetLine.js +1 -1
- package/editing/sharedTemplates/executor/builders/offsetPrimaryLine.js +1 -1
- package/editing/sharedTemplates/executor/builders/polygonBoundary.js +1 -1
- package/editing/sharedTemplates/executor/builders/polygonBoundaryTwoPoint.js +1 -1
- package/editing/sharedTemplates/executor/builders/polygonVertices.js +1 -1
- package/editing/sharedTemplates/executor/builders/support/builderUtils.js +1 -1
- package/editing/sharedTemplates/executor/builders/support/shapeUtils.js +1 -1
- package/editing/sharedTemplates/executor/support/createFeatureServiceEdit.js +1 -1
- package/editing/sharedTemplates/executor/support/createPresetServiceEdit.js +1 -1
- package/geometry/Extent.d.ts +1 -1
- package/geometry/Mesh.d.ts +2 -2
- package/geometry/SpatialReference.js +1 -1
- package/geometry/geometryEngine.d.ts +3 -3
- package/geometry/{geometryEngineInterfaces.d.ts → geometryEngineTypes.d.ts} +1 -1
- package/geometry/operators/affineTransformOperator.d.ts +3 -3
- package/geometry/operators/alphaShapeOperator.d.ts +1 -1
- package/geometry/operators/areaOperator.d.ts +1 -1
- package/geometry/operators/boundaryOperator.d.ts +3 -3
- package/geometry/operators/bufferOperator.d.ts +1 -1
- package/geometry/operators/centroidOperator.d.ts +1 -1
- package/geometry/operators/clipOperator.d.ts +3 -3
- package/geometry/operators/containsOperator.d.ts +1 -1
- package/geometry/operators/convexHullOperator.d.ts +3 -3
- package/geometry/operators/crossesOperator.d.ts +1 -1
- package/geometry/operators/cutOperator.d.ts +2 -2
- package/geometry/operators/densifyOperator.d.ts +3 -3
- package/geometry/operators/differenceOperator.d.ts +3 -3
- package/geometry/operators/disjointOperator.d.ts +1 -1
- package/geometry/operators/distanceOperator.d.ts +1 -1
- package/geometry/operators/equalsOperator.d.ts +1 -1
- package/geometry/operators/generalizeOperator.d.ts +3 -3
- package/geometry/operators/geodesicBufferOperator.d.ts +1 -2
- package/geometry/operators/geodesicProximityOperator.d.ts +2 -5
- package/geometry/operators/geodeticAreaOperator.d.ts +1 -2
- package/geometry/operators/geodeticDensifyOperator.d.ts +3 -4
- package/geometry/operators/geodeticDistanceOperator.d.ts +1 -2
- package/geometry/operators/geodeticLengthOperator.d.ts +1 -2
- package/geometry/operators/geodeticUtilsOperator.d.ts +1 -1
- package/geometry/operators/graphicBufferOperator.d.ts +1 -1
- package/geometry/operators/integrateOperator.d.ts +2 -2
- package/geometry/operators/intersectionOperator.d.ts +3 -3
- package/geometry/operators/intersectsOperator.d.ts +1 -1
- package/geometry/operators/isNearOperator.d.ts +1 -1
- package/geometry/operators/labelPointOperator.d.ts +1 -1
- package/geometry/operators/lengthOperator.d.ts +1 -1
- package/geometry/operators/linesToPolygonsOperator.d.ts +1 -1
- package/geometry/operators/locateBetweenOperator.d.ts +2 -2
- package/geometry/operators/minimumBoundingCircleOperator.d.ts +1 -1
- package/geometry/operators/multiPartToSinglePartOperator.d.ts +2 -2
- package/geometry/operators/offsetOperator.d.ts +3 -3
- package/geometry/operators/overlapsOperator.d.ts +1 -1
- package/geometry/operators/projectOperator.d.ts +4 -6
- package/geometry/operators/proximityOperator.d.ts +2 -2
- package/geometry/operators/relateOperator.d.ts +1 -1
- package/geometry/operators/shapePreservingProjectOperator.d.ts +3 -3
- package/geometry/operators/simplifyOGCOperator.d.ts +3 -3
- package/geometry/operators/simplifyOperator.d.ts +3 -3
- package/geometry/operators/symmetricDifferenceOperator.d.ts +3 -3
- package/geometry/operators/touchesOperator.d.ts +1 -1
- package/geometry/operators/{support/proximityResult.d.ts → types.d.ts} +18 -3
- package/geometry/operators/unionOperator.d.ts +3 -3
- package/geometry/operators/withinOperator.d.ts +1 -1
- package/geometry/projection/projectBoundingSphere.js +1 -1
- package/geometry/support/curves/curveUtils.js +1 -1
- package/geometry/support/geodesicUtils.d.ts +15 -2
- package/geometry/support/jsonUtils.d.ts +1 -1
- package/geometry/support/meshUtils/types.d.ts +34 -0
- package/geometry/support/meshUtils.d.ts +4 -7
- package/geometry/support/sphere.js +1 -1
- package/geometry/support/webMercatorUtils.d.ts +1 -1
- package/geometry/types.d.ts +23 -1
- package/geometry.d.ts +1 -1
- package/interfaces.d.ts +69 -72
- package/kernel.js +1 -1
- package/layers/CSVLayer.d.ts +0 -2
- package/layers/CatalogLayer.d.ts +1 -1
- package/layers/FeatureLayer.d.ts +1 -1
- package/layers/GeoJSONLayer.d.ts +1 -1
- package/layers/KnowledgeGraphLayer.js +1 -1
- package/layers/LinkChartLayer.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/OGCFeatureLayer.d.ts +1 -1
- package/layers/OrientedImageryLayer.d.ts +1 -3
- package/layers/ParquetLayer.d.ts +1 -1
- package/layers/WFSLayer.d.ts +1 -1
- package/layers/catalog/CatalogFootprintLayer.d.ts +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphSublayer.d.ts +3 -3
- package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
- package/layers/knowledgeGraph/layerUtils.js +1 -1
- package/layers/mixins/APIKeyMixin.d.ts +2 -2
- package/layers/mixins/ArcGISImageService.d.ts +4 -3
- package/layers/mixins/BlendLayer.d.ts +16 -15
- package/layers/mixins/DisplayFilteredLayer.d.ts +6 -3
- package/layers/mixins/FeatureEffectLayer.d.ts +23 -21
- package/layers/mixins/FeatureLayerBase.d.ts +23 -20
- package/layers/mixins/ImageryTileMixin.d.ts +5 -5
- package/layers/mixins/PortalLayer.d.ts +7 -7
- package/layers/mixins/RasterPresetRendererMixin.d.ts +6 -3
- package/layers/mixins/SceneService.d.ts +2 -2
- package/layers/mixins/TemporalLayer.d.ts +8 -7
- package/layers/mixins/TemporalSceneLayer.d.ts +2 -2
- package/layers/mixins/TrackableLayer.d.ts +4 -4
- package/layers/ogc/wfsUtils.d.ts +1 -1
- package/layers/raster/formats/Lerc.js +1 -1
- package/layers/raster/functions/creators/createSurfaceFunctions.d.ts +2 -2
- package/layers/support/DisplayFilterInfo.d.ts +7 -7
- package/layers/support/FeatureReductionCluster.d.ts +5 -5
- package/layers/support/FieldsIndex.d.ts +1 -2
- package/layers/support/RasterBandInfo.d.ts +1 -1
- package/layers/support/RasterInfo.d.ts +2 -2
- package/layers/support/RasterSensorInfo.d.ts +1 -1
- package/layers/support/Sublayer.d.ts +3 -3
- package/layers/support/SubtypeSublayer.d.ts +1 -1
- package/layers/support/TrackInfo.d.ts +2 -2
- package/layers/support/arcgisLayerUrl.js +1 -1
- package/layers/support/fieldUtils.d.ts +0 -1
- package/layers/support/source/QueryTableDataSource.d.ts +2 -2
- package/layers/support/types.d.ts +2 -2
- package/layers/types.d.ts +1 -1
- package/package.json +2 -2
- package/popup/FieldInfo.d.ts +8 -8
- package/popup/content/AttachmentsContent.d.ts +2 -2
- package/popup/content/CustomContent.d.ts +1 -1
- package/portal/interfaces.d.ts +2 -2
- package/portal/support/resourceUtils.d.ts +6 -7
- package/rest/featureService/types.d.ts +1 -1
- package/rest/geometryService.d.ts +2 -2
- package/rest/imageService.d.ts +1 -1
- package/rest/knowledgeGraph/GraphAnyValue.d.ts +1 -1
- package/rest/query/support/AttachmentInfo.d.ts +1 -1
- package/rest/query.d.ts +1 -1
- package/rest/support/BufferParameters.d.ts +1 -1
- package/rest/support/DataLayer.d.ts +1 -1
- package/rest/support/DensifyParameters.d.ts +1 -1
- package/rest/support/DistanceParameters.d.ts +1 -1
- package/rest/support/FeatureSet.d.ts +2 -2
- package/rest/support/FindImagesParameters.d.ts +1 -1
- package/rest/support/GeneralizeParameters.d.ts +1 -1
- package/rest/support/IdentifyParameters.d.ts +1 -1
- package/rest/support/ImageGPSInfoParameters.d.ts +1 -1
- package/rest/support/ImageMeasureResultAreaValue.d.ts +1 -1
- package/rest/support/ImageToMapMultirayParameters.d.ts +1 -1
- package/rest/support/OffsetParameters.d.ts +1 -1
- package/rest/support/ProjectParameters.d.ts +1 -1
- package/rest/support/Query.d.ts +1 -1
- package/rest/support/QueryMixin.d.ts +1 -1
- package/rest/support/RelationParameters.d.ts +1 -1
- package/rest/support/RelationshipQuery.d.ts +1 -1
- package/rest/support/TopFeaturesQuery.d.ts +1 -1
- package/smartMapping/labels/bins.d.ts +3 -6
- package/smartMapping/labels/clusters.d.ts +2 -2
- package/smartMapping/popup/clusters.d.ts +4 -4
- package/smartMapping/popup/templates.d.ts +4 -4
- package/smartMapping/renderers/color.d.ts +6 -6
- package/smartMapping/renderers/size.d.ts +6 -6
- package/smartMapping/statistics/support/ageUtils.d.ts +5 -5
- package/smartMapping/statistics/types.d.ts +5 -5
- package/smartMapping/types.d.ts +9 -1
- package/support/revision.js +1 -1
- package/unionTypes.d.ts +1 -1
- package/views/2d/MapViewConstraints.d.ts +5 -4
- package/views/2d/engine/webgl/Painter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/GLSLShaderModule.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/GraphShaderModule.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/graph/GlslGraphWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/graph/ShaderGraphContext.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/typed/TypedShaderProgram.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/features/PipelineConnectionHandlers.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.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/I3SNode.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/support/Tiles3DIntersectionHandler.js +1 -1
- package/views/3d/support/ElevationRange.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/lib/Octree.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/BreakpointsOwner.d.ts +1 -1
- package/views/LinkChartView.d.ts +1 -2
- package/views/MapView.d.ts +1 -2
- package/views/SceneView.d.ts +1 -2
- package/views/View.d.ts +1 -1
- package/views/Viewport2DMixin.d.ts +1 -1
- package/views/draw/MultipointDrawAction.d.ts +1 -1
- package/views/draw/MultipointDrawAction.js +1 -1
- package/views/draw/PointDrawAction.d.ts +1 -1
- package/views/draw/PointDrawAction.js +1 -1
- package/views/draw/PolygonDrawAction.d.ts +1 -1
- package/views/draw/PolygonDrawAction.js +1 -1
- package/views/draw/PolylineDrawAction.d.ts +1 -1
- package/views/draw/PolylineDrawAction.js +1 -1
- package/views/draw/SegmentDrawAction.d.ts +1 -1
- package/views/draw/SegmentDrawAction.js +1 -1
- package/views/input/{IViewEvents.js → mouseButtons.js} +1 -1
- package/views/input/types.d.ts +602 -1
- package/views/layers/BuildingSceneLayerView.d.ts +1 -1
- package/views/layers/FeatureLayerViewMixin.d.ts +1 -1
- package/views/layers/ImageryLayerViewMixin.d.ts +1 -1
- package/views/layers/MediaLayerViewMixin.d.ts +1 -1
- package/views/layers/PointCloudLayerView.d.ts +1 -1
- package/views/layers/SceneLayerView.d.ts +2 -2
- package/views/types.d.ts +148 -2
- package/webdoc/geotriggersInfo/FeatureFilter.d.ts +1 -1
- package/webscene/support/FeatureReferenceObjectId.d.ts +1 -1
- package/widgets/BasemapLayerList/BasemapLayerListViewModel.d.ts +1 -2
- package/widgets/BasemapLayerList.d.ts +3 -4
- package/widgets/CatalogLayerList/CatalogLayerListViewModel.d.ts +1 -1
- package/widgets/CatalogLayerList.d.ts +2 -4
- package/widgets/Directions/DirectionsViewModel.d.ts +1 -1
- package/widgets/Editor/types.d.ts +1 -1
- package/widgets/Feature/support/arcadeFeatureUtils.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.d.ts +46 -5
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/FieldColumn.js +1 -1
- package/widgets/FeatureTable/Grid/EditorColumn.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
- package/widgets/FeatureTable/VisibleElements.d.ts +30 -9
- package/widgets/FeatureTable/VisibleElements.js +1 -1
- package/widgets/FeatureTable/support/AttachmentsViewOptions.d.ts +1 -1
- package/widgets/FeatureTable/support/FeatureStore.d.ts +1 -0
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/FeatureTable/support/interfaces.d.ts +2 -2
- package/widgets/FeatureTable.d.ts +46 -5
- package/widgets/FeatureTable.js +1 -1
- package/widgets/LayerList/LayerListViewModel.d.ts +9 -10
- package/widgets/LayerList/ListItem.d.ts +9 -11
- package/widgets/LayerList/ListItemPanel.d.ts +1 -1
- package/widgets/LayerList.d.ts +7 -4
- package/widgets/Legend/LegendViewModel.d.ts +5 -5
- package/widgets/Legend/support/ActiveLayerInfo.d.ts +5 -5
- package/widgets/Legend.d.ts +4 -4
- package/widgets/Popup/types.d.ts +3 -3
- package/widgets/Popup.d.ts +3 -3
- package/widgets/TableList/TableListViewModel.d.ts +2 -4
- package/widgets/TableList.d.ts +1 -1
- package/widgets/UtilityNetworkTrace/types.d.ts +1 -1
- package/assets/esri/core/workers/chunks/052ded41dc06c93ec0a7.js +0 -1
- package/assets/esri/core/workers/chunks/30184e39129d9c66ea54.js +0 -1
- package/assets/esri/core/workers/chunks/5340887a4a48bde3407a.js +0 -1
- package/assets/esri/core/workers/chunks/537de53ef1e9101468f5.js +0 -1
- package/assets/esri/core/workers/chunks/94f02082a006003ef5a9.js +0 -1
- package/assets/esri/core/workers/chunks/a1f264abbd6354c333bf.js +0 -1
- package/assets/esri/core/workers/chunks/d3db7244fac7398cc700.js +0 -1
- package/assets/esri/core/workers/chunks/d94a2ad5a91de7086fbe.js +0 -1
- package/assets/esri/core/workers/chunks/ed38c1043e6a83f49f93.js +0 -1
- package/geometry/geodesicUtils.d.ts +0 -19
- package/geometry/operators/support/geodeticCurveType.d.ts +0 -2
- package/geometry/operators/support/projectionTransformation.d.ts +0 -16
- package/geometry/support/MeshVertexSpace.d.ts +0 -4
- package/geometry/support/meshUtils/elevation.d.ts +0 -16
- package/geometry/support/meshUtils/elevationSampler.d.ts +0 -9
- package/geometry/support/meshUtils/georeference.d.ts +0 -10
- package/geometry/support/typeUtils.d.ts +0 -16
- package/smartMapping/popup/support/utils.d.ts +0 -13
- package/smartMapping/support/binningUtils.d.ts +0 -11
- package/smartMapping/support/clusterUtils.d.ts +0 -11
- package/smartMapping/support/utils.d.ts +0 -4
- package/views/2d/constraints/GeometryConstraint.d.ts +0 -4
- package/views/HitTestItem3D.d.ts +0 -20
- package/views/HitTestOptions.d.ts +0 -25
- package/views/IBreakpointsOwner.d.ts +0 -55
- package/views/IObjectId.d.ts +0 -2
- package/views/ISceneView.d.ts +0 -5
- package/views/IView.d.ts +0 -43
- package/views/input/IViewEvents.d.ts +0 -602
- /package/views/draw/input/{CursorUpdateEvents.d.ts → CursorUpdateEvent.d.ts} +0 -0
- /package/views/draw/input/{CursorUpdateEvents.js → CursorUpdateEvent.js} +0 -0
- /package/views/layers/{HighlightableLayerView.d.ts → types.d.ts} +0 -0
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../Color.js";import{filterInPlace as i,difference as r}from"../../../core/arrayUtils.js";import s from"../../../core/CollectionFlattener.js";import{toConst as a}from"../../../core/compilerUtils.js";import{EventedAccessor as n}from"../../../core/Evented.js";import"../../../core/has.js";import l from"../../../core/Logger.js";import{clamp as o}from"../../../core/mathUtils.js";import{destroyMaybe as h}from"../../../core/maybe.js";import{MemCachePool as d}from"../../../core/MemCachePool.js";import p from"../../../core/ObjectPool.js";import u from"../../../core/PooledArray.js";import{throwIfAborted as c,isAbortError as g,isAborted as m}from"../../../core/promiseUtils.js";import{watch as _,syncAndInitial as y,sync as f,initial as T}from"../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as v}from"../../../core/units.js";import{property as w,subclass as C}from"../../../core/accessorSupport/decorators.js";import{m as S,h as b,d as E}from"../../../chunks/vec32.js";import{create as x}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as L}from"../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as P,radiusModifier as R}from"../../../geometry/ellipsoidUtils.js";import U from"../../../geometry/SpatialReference.js";import{getProjector as M}from"../../../geometry/projection/projectors.js";import{projectPointToVector as D}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as j}from"../../../geometry/projection/projectVectorToVector.js";import{create as I,equals as k,intersection as V,intersectsSphere as A,empty as B,expand as O}from"../../../geometry/support/aaBoundingRect.js";import{copy as G,create as N}from"../../../geometry/support/frustum.js";import{createSpatialReferenceCyclical as q}from"../../../geometry/support/normalizeUtils.js";import{isPlateCarree as F}from"../../../geometry/support/spatialReferenceUtils.js";import{Sphere as W}from"../../../geometry/support/sphere.js";import{ElevationQueryTileCache as H}from"../../../layers/support/ElevationQueryTileCache.js";import{isBaseLayer as $}from"../../../layers/support/layerUtils.js";import{debugFlags as Q}from"../support/debugFlags.js";import{ElevationRange as z}from"../support/ElevationRange.js";import{toBoundingRect as Y}from"../support/extentUtils.js";import{updatingProgress as X}from"../support/updatingProperties.js";import{ElevationBounds as K}from"./ElevationBounds.js";import{ElevationData as J,sampleElevation as Z}from"./ElevationData.js";import{ElevationUpdateEventImplementation as ee}from"./ElevationUpdateEvent.js";import{create as te}from"./ExtentHelper.js";import{LayerClasses as ie}from"./LayerClass.js";import{OverlayManager as re}from"./OverlayManager.js";import{PlanarPatch as se}from"./PlanarPatch.js";import{Queue as ae}from"./Queue.js";import{ScaleRangeQueries as ne}from"./ScaleRangeQueries.js";import{SphericalPatch as le}from"./SphericalPatch.js";import{SplitLimits as oe}from"./SplitLimits.js";import{maxRootTiles as he,tooManyRootTilesAfterChangeError as de,tooManyRootTilesForLayerError as pe,maxTileNeighborLevelDelta as ue,maxMemoryLodBias as ce}from"./TerrainConst.js";import{TerrainRenderer as ge}from"./TerrainRenderer.js";import me from"./TerrainSurfacePerformanceInfo.js";import{weakAssert as _e,isVectorTileLayerView as ye,neighborEdgeIndices as fe,internalAssert as Te,oppositeEdge as ve,isSurfaceLayerView as we,isGroupLayerView as Ce,isMapTileLayerView as Se,isBlendableLayerView as be,isElevationLayerView as Ee,releaseTerrainData as xe,enableTerrainInternalChecks as Le,oppositeCorner as Pe,enableWaterproofTests as Re,enableInternalTerrainChecks as Ue,enableTerrainWaterproofChecks as Me,neighborCornerIndices as De}from"./terrainUtils.js";import{Tile as je,lijEquals as Ie}from"./Tile.js";import{printAllocations as ke}from"./TilePerLayerInfo.js";import{sortTiles as Ve,IteratorPreorder as Ae,IteratorPostorder as Be,compareTilesByLij as Oe,hasLoadableSiblings as Ge,sortTilesByPOI as Ne}from"./tileUtils.js";import{TilingSchemeLogic as qe}from"./TilingSchemeLogic.js";import{UpsampleInfo as Fe}from"./UpsampleInfo.js";import{isCompositeBlendMode as We,blendModeFromString as He}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{hasLayerBasedScaleVisibility as $e}from"../../support/layerViewUtils.js";import{ImmediateTask as Qe,TaskPriority as ze,noBudget as Ye}from"../../support/Scheduler.js";import{TextureCompressionTracker as Xe}from"../../support/TextureCompressionTracker.js";import{Yield as Ke}from"../../support/Yield.js";var Je;let Ze=class extends n{static{Je=this}get allTilesCreated(){return this._allTilesCreated}get allTiles(){return a(this._allTiles)}get renderedTiles(){return Ve(i(this._allTiles.toArray(),e=>e.visible&&e.rendered))}get demResolution(){const{_allTiles:e,tilingScheme:t}=this;if(0===e.length)return{min:1,max:1};const i=v(t.spatialReference);let r=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;for(const a of e){const e=t.resolutionAtLevel(a.level)*i;r=Math.min(r,e),s=Math.max(s,e)}return{min:r,max:s}}constructor(e){super(e),this.terrainTextureCompressionTracker=new Xe,this._iteratorPool=new p(()=>new Ae,e=>e.remove=()=>this._iteratorPool.release(e)),this._postorderIterator=new Be,this._hasPendingUpdates=!1,this._pendingUpdates=0,this._asyncWorkItems=0,this._allTilesDirty=!0,this._allTilesSorted=!0,this._allTilesCreated=!1,this._usedMemory=null,this._performanceInfo=new me,this._viewChanged=!1,this.heading=0,this._inFrameTask=!1,this._viewChangeUpdateDirty=!1,this._eyePosRenderSR=x(),this._eyePosSurfaceSR=x(),this._splitLimits=new oe,this._layerViews=[new Array,new Array],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._watchUpdatingTracking=new L,this._frameTask=Qe,this._allTiles=new u,this._upsampleInfoPool=new p(()=>new Fe),this._shouldEmitChangeEvent=!1,this._rootTilesExtent=I(),this.updatingProgress=.5,this._maxNumUpdating=1,this.maxTextureScale=1.2,this._spatialReference=U.WebMercator,this._elevationProjectorCache=new Map,this.visibleElevationRange=new z(1/0,-1/0),this._rootTileElevationRange=new z(1/0,-1/0),this._projectorCache=new Map,this._tilingSchemeSpatialReference=null,this._updatingRootTiles=!1,this._pendingTilesForElevationUpdateEvent=new Set,this._pendingTilesToUpdate=new Set,this.totalGeometryUpdates=0,this.totalTileUpdates=0,this._oneBatchPerFrameTask=!0,this._layerViewsDirty=!1,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._isWebMercator=!1,this._isWebMercatorOnPlateCarree=!1,this.enabled=!0;const{view:t}=e;this.overlayManager=new re({...e,terrainSurface:this}),this._isGlobal=!t.state?.isLocal,this._isGeographic=this._spatialReference?.isGeographic??!1,this._tileConstructor=this._isGlobal?le:se,this._ellipsoid=P(t.spatialReference),this._renderer=new ge(this.overlayManager.renderer,t.stage,this._allTiles,this.terrainTextureCompressionTracker,t.resourceController.memoryController),$e()||(this._scaleRangeQueries=new ne)}initialize(){const{view:e}=this,{resourceController:t}=e,{memoryController:i}=t;this._tileCache=new d((e,t)=>i.newCache(e,t),"terrain-tile"),this._upsampleMapCache=i.newCache("terrain-upsample",({tile:e})=>e.unloadMapData()),this._elevationQueryCache=new H(i.newCache("elevation-query"));const r=this.overlayManager;this.addHandles([_(()=>r.renderer.isEmpty,()=>this._evaluateTransparency()),_(()=>this.renderer.visible,e=>this.suspended=!e),_(()=>this.heading,e=>{this._renderer.updateHeading(e),this._updateTileTextures(0)}),_(()=>({heading:e.camera?.heading,state:e.state?.mode}),({heading:e,state:t})=>{if(null==e)return;if(this.isGlobal&&this.isGeographic||this.isWebMercatorOnPlateCarree)return void(this.heading=90*Math.round(e/90)%360);const i=Math.round(e)%360,r=Math.abs(i-this.heading);(2===t||Math.min(r,360-r)>=30)&&(this.heading=i)})],"overlayManager"),this.addHandles([_(()=>this.baseOpacity,()=>{this._handleLayerViewChanges(),this._updateTileTextures(this._evaluateTransparency()?1:2)},y),_(()=>this.hasCompositeBlendMode,()=>this._updateTileTextures(this._evaluateTransparency()?1:2),y),_(()=>this.backgroundColor,(e,t)=>{e?.equals(t)||(this._handleLayerViewChanges(),this._renderer.updateTileBackground(e))},f),_(()=>this.snapLevel,()=>this._viewChanged=!0,f),_(()=>this.view.pointsOfInterest,e=>{this._renderer.pointsOfInterest=e,this._watchUpdatingTracking.removeAll(),e&&this._watchUpdatingTracking.add(()=>e.focus?.renderLocation,()=>this._allTilesSorted=!1,{equals:S})}),_(()=>Q.TERRAIN_TILE_TREE_SHOW_TILES,t=>{t&&!this._treeDebugger?import("../layers/support/TerrainTileTree3DDebugger.js").then(({TerrainTileTree3DDebugger:t})=>{!this._treeDebugger&&Q.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new t({view:e}))}):t||(this._treeDebugger=h(this._treeDebugger))},T)]);const{spatialReference:a}=e;this._extentHelper=te(this.viewingMode,{layers:e.map.allLayers,layerViews:e.allLayerViews,viewSpatialReference:a});const n=new s({getCollections:()=>e.defaultsFromMap?.mapCollections?.map(({layers:e})=>e),getChildrenFunction:e=>e&&"layers"in e?e.layers:null}),l=new qe({layers:n,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:a});this._set("tilingSchemeLogic",l),this._updateTilingScheme();const o=t.scheduler;this._frameTask=o.registerTask(ze.TERRAIN_SURFACE,this),this.addHandles([_(()=>this._extentHelper.stencilEnabledExtents,e=>this._renderer.setStencilEnabledLayerExtents(e),T),_(()=>this.tilingSchemeLogic.tilingScheme,()=>this._updateTilingScheme(),f),_(()=>this.groundExtent,()=>this._updateRootTiles(),T),e.on("resize",()=>this._viewChangeUpdate()),_(()=>{const t=e.state;return[this._lodBias,this.lodSnappingEnabled,e.quality,t.camera,t.contentCamera,t.fixedContentCamera]},()=>this._viewChangeUpdate(),y),_(()=>e.qualitySettings?.fadeDuration,e=>this._renderer.textureFadingEnabled=e>0,T),_(()=>e.qualitySettings?.physicallyBasedRenderingEnabled,e=>this._renderer.pbrMode=e?5:0,T),_(()=>e.qualitySettings?.tiledSurface.elevationLevelDelta,()=>this._updateAllTileGeometries()),_(()=>this.userClippingExtent,()=>this._updateClippingExtent(),f)]),this.addHandles(e.allLayerViews.on("after-changes",()=>this._layerViewsDirty=!0)),this._layerViewsDirty=!0,this._handleLayerViewChanges(),this._renderer.updateTileBackground(this.backgroundColor)}clearHandles(){this._watchUpdatingTracking?.removeAll(),this.removeAllHandles(),this._basemapLayerViewHandles.forEach((e,t)=>this._unregisterTiledLayerView(t)),this._basemapLayerViewHandles.clear()}destroy(){this._frameTask.remove(),this._frameTask=Qe,this._watchUpdatingTracking?.destroy(),this._removeAllTiles(),this._set("tilingSchemeLogic",h(this.tilingSchemeLogic)),this._basemapLayerViewHandles.forEach((e,t)=>this._unregisterTiledLayerView(t)),this._basemapLayerViewHandles.clear(),this._set("overlayManager",h(this.overlayManager)),this._tileCache=h(this._tileCache),this._allTiles.prune(),je.prune(),this._treeDebugger=h(this._treeDebugger),this._renderer.destroyed||this._renderer.destroy(),this._renderer=null,this._iteratorPool=h(this._iteratorPool),this._upsampleMapCache=h(this._upsampleMapCache),this._elevationQueryCache=h(this._elevationQueryCache),this._set("view",null),this._extentHelper=h(this._extentHelper),this._upsampleInfoPool=h(this._upsampleInfoPool),ke(),this._layerViews.forEach(e=>e.length=0),this._performanceInfo=null}get renderer(){return this._renderer}get frustum(){return this.view.state.camera.frustum}get snapLevel(){return this.lodSnappingEnabled?this.view.terrainLevel:null}get lodSnappingEnabled(){return this.view.qualitySettings.tiledSurface.reduceTileLevelDifferences}get upsampleInfoPool(){return this._upsampleInfoPool}get upsampleMapCache(){return this._upsampleMapCache}get elevationQueryCache(){return this._elevationQueryCache}get hasStencilEnabledExtents(){return this._extentHelper.stencilEnabledExtents.length>0}get userClippingExtent(){const{spatialReference:e}=this,t=this.view?.clippingArea;if(null==t||null==e)return null;const i=I(),r=Y(t,i,e)?i:null,s=this._get("userClippingExtent");return k(r,s)?s:r}get rootTilesExtent(){return this._rootTilesExtent}get groundExtent(){const e=V(this.fullGroundExtent,this.userClippingExtent,I()),t=this._get("groundExtent");return k(e,t)?t:e}get fullGroundExtent(){return null!=this._tilingSchemeExtent?this._tilingSchemeExtent:this._rootTilesExtent}get _tilingSchemeExtent(){return this.tilingSchemeLogic?.extent}get updating(){return this._hasPendingUpdates||(this._maxNumUpdating=1),this.enabled&&!!((this.readyToRun||this._watchUpdatingTracking?.updating||this._asyncWorkItems>0)&&this.ready&&!this.suspended||this.overlayManager?.updating||this.terrainTextureCompressionTracker.compressing)}get readyToRun(){return this.enabled&&(this._hasPendingUpdates||this._viewChanged||this._allTilesDirty||!this._allTilesSorted||this._layerViewsDirty||this._scaleRangeQueries?.updating||this._frameTask.updating)&&this.ready&&!this.suspended}get updatingProgressValue(){return this._maxNumUpdating=Math.max(this._pendingUpdates,this._maxNumUpdating),1-this._pendingUpdates/this._maxNumUpdating}get baseOpacity(){return this.view?.map?.ground?.opacity??1}set baseOpacity(e){this.view.map.ground.opacity=e}get viewingMode(){return this.view.state.viewingMode}get ready(){return!this.enabled||null!=this._rootTiles}get rootTiles(){return this._rootTiles}get spatialReference(){return this.tilingScheme?.spatialReference??null}get backgroundColor(){return this.view?.map?.ground?.surfaceColor}set backgroundColor(e){this.view.map.ground.surfaceColor=e}set slicePlaneEnabled(e){this._renderer.slicePlaneEnabled=e,this._set("slicePlaneEnabled",e),this._evaluateTransparency()}get tilingSchemeLocked(){return this.tilingSchemeLogic?.tilingSchemeLocked??!1}get wireframe(){return this._renderer?.wireframe}set wireframe(e){e!==this._renderer.wireframe&&(this._renderer.wireframe=e,this._updateAllTileGeometries())}get opaque(){return 0===this._renderer.transparency}get invisible(){return 3===this._renderer.transparency}set suspended(e){this._set("suspended",e),this._viewChangeUpdate()}get fadeDuration(){return this.view.qualitySettings.fadeDuration??0}intersect(e,t,i,r){this._renderer.intersect(e,t,i,r)}getElevationLevelDelta(e){return e<4?3:this.view.qualitySettings.tiledSurface.elevationLevelDelta}get _xNormalizer(){return q(this._spatialReference)}getElevation(e,t,i,r){const s=this._rootTiles;if(!s?.length||!this.enabled)return null;if(0===s[0].layerInfo[0].length)return null;let a=this._elevationProjectorCache.get(r);if(void 0===a&&(a=M(r,this._spatialReference)??null,this._elevationProjectorCache.set(r,a)),null==a)return l.getLogger(this).error("TerrainSurface.getElevation(): could not project given point to tiling scheme coordinate system"),null;const n=b(tt,e,t,i);a(n,0,n,0);return lt(s,this._xNormalizer?.normalize(n[0])??n[0],n[1])}getElevations(e,t,i){const r=this._rootTiles,s=r?r[0].layerInfo[0].length:0;if(r?.length&&0!==s&&this.enabled)for(let a=0;a<t;++a){const t=3*a;i(a,lt(r,e[t],e[t+1]))}else for(let a=0;a<t;++a)i(a,null)}getLayerIndexByUID(e,t){return this._layerIndexByUid[e].get(t)}getScale(e){if(!this.tilingScheme)return null;if(!D(e,tt,this.spatialReference))return l.getLogger(this).error("TerrainSurface.getScale(): could not project given point to tiling scheme coordinate system"),null;const t=this._rootTiles;if(null!=t)for(const i of t)if(i?.containsPoint(tt)){let e=i;for(;e.children[0]&&!e.rendered;){const t=e.children[0].extent;let i=0;tt[0]>t[2]&&(i+=1),tt[1]<t[1]&&(i+=2),e=e.children[i]}return this._getLodBiasCorrectedScale(e.level)}return 1/0}_ensureProjector(e){const t=this._projectorCache.get(e);if(t)return t;const i=M(e,this._tilingSchemeSpatialReference)??null;return this._projectorCache.set(e,i),i}getSphereElevationRange(e,t){if(!this.enabled||null==this._rootTiles)return null;const i=this._ensureProjector(t);if(null==i)return l.getLogger(this).error("TerrainSurface.getSphereElevationRange(): could not project given point to tiling scheme coordinate system"),null;it.copy(e),i(it.center,0,it.center,0);const r=new z,s=this._rootTiles;if(null!=s){const e=[];for(const i of s)e.push(i);let t=0;for(;t<e.length;){const i=e[t];if(++t,!A(i.extent,it))continue;const s=i.children;if(null==s[0]||i.rendered)r.expandElevationRangeValues(i.elevationBoundsMin,i.elevationBoundsMax);else for(const t of s)e.push(t)}}return r}getRootElevationRange(){return this.enabled&&null!=this._rootTiles?new z(this._rootTileElevationRange.minElevation,this._rootTileElevationRange.maxElevation):null}getLowerBoundRadius(){const e=(this._ellipsoid.radius+this.visibleElevationRange.minElevation)*R;return Math.min(e,this._ellipsoid.radius)}getSphereScale(e,t){if(!this.tilingScheme)return null;if(!D(e,it.center,this.spatialReference))return l.getLogger(this).error("TerrainSurface.getSphereScale(): could not project given point to tiling scheme coordinate system"),null;it.radius=t;let i=null;const r=e=>{if(e&&A(e.extent,it)){const t=e.children;if(t[0]&&!e.rendered)for(const e of t)r(e);else{const t=this._getLodBiasCorrectedScale(e.level);i=null==i?t:Math.min(i,t)}}},s=this._rootTiles;if(null!=s)for(const a of s)r(a);return i}queryVisibleScaleRange(e,t,i,r){if(!this._scaleRangeQueries)return;const s=t?this.tilingScheme.levelAtScale(t):0,a=i?this.tilingScheme.levelAtScale(i):1/0,n=this._lodBias;this._scaleRangeQueries.queryVisibleLevelRange(e,s+n,a+n,r)}_evaluateTransparency(){const e=this.baseOpacity,t=this.overlayManager.renderer.isEmpty,i=this._renderer.transparency,r=this._isFullyTransparent?t?3:2:e>=1&&!this.hasCompositeBlendMode&&!this._renderer.slicePlaneEnabled?0:1;return this._renderer.transparency=r,i!==r&&(this.notifyChange("opaque"),this.notifyChange("invisible"),!0)}_updateTilingScheme(){const{tilingScheme:e}=this.tilingSchemeLogic;if(!(e!==this.tilingScheme))return;_e(!!e,"tiling scheme cannot be reset to undefined"),this._isGlobal=!this.view?.state?.isLocal,this.tilingScheme&&this._removeAllTiles();const t=e?.spatialReference??U.WebMercator;this._spatialReference=t,this._isWebMercator=!!t?.isWebMercator,this._isWebMercatorOnPlateCarree=this._isWebMercator&&F(this.view?.renderSpatialReference),this._isGeographic=t?.isGeographic??!1,this._set("tilingScheme",e),this._tilingSchemeSpatialReference=this.tilingScheme?.spatialReference,this._projectorCache.clear(),this._updateClippingExtent(),e&&(this._updateTiledLayers(),this._renderer.tileSize=e.pixelSize,this.overlayManager.spatialReference=e.spatialReference,this._updateRootTiles())}static{this._tileMemcacheKey="TerrainTileMemcache"}_acquireTile(e,t,i,r){const s=this._tileCache.pop(Je._tileMemcacheKey);return s?(s.init(e,t,i,r,this),s):new this._tileConstructor(e,t,i,r,this)}get updatingRootTiles(){return this._updatingRootTiles}_updateRootTiles(){const{groundExtent:e,tilingScheme:t}=this;if(!t)return;if(!this.enabled)return void this._setRootTiles(null);const i=rt;let s=t.rootTilesInExtent(e,i,5*he);if(null!=this._rootTiles){if(s.length>he)return void l.getLogger(this).warn(de);const e=this._rootTiles.map(e=>e.lij),t=r(e,s,Ie);if(this._updatingRootTiles=!0,t.removed.length>0||t.added.length>0){const e=this._rootTiles.filter(e=>!(t.removed.findIndex(t=>Ie(t,e.lij))>-1)||(this._purgeTile(e),!1));t.added.forEach(t=>e.push(this._newRootTile(t))),this._setRootTiles(e)}}else this._updatingRootTiles=!0,s.length>he&&(l.getLogger(this).warn(pe),s=t.rootTilesInExtent(e,i,he)),this._setRootTiles(s.map(e=>this._newRootTile(e)));k(i,this._rootTilesExtent)||(this._rootTilesExtent=I(i)),this.renderer.visible=!0,this._viewChangeUpdate(),this.overlayManager.setPlacementDirty(),this.notifyChange("ready"),this._updateAllTileGeometries(),this._updatingRootTiles=!1,this.checkAllTilesWaterproofness()}_updateAllTileGeometries(){const e=this._allTiles.filter(e=>e.loaded&&e.intersectsClippingArea);e.sort(Oe),e.forEach(e=>this._renderer.updateTileGeometryState(e)),e.forEach(e=>e.renderData.updateNeighborData()),this._updateTilesGeometries(e),this._pendingTilesToUpdate.clear()}_updateTilesGeometries(e){if(0===e.length)return;e.sort(Oe);const t=this.renderer;e.forEach(e=>t.updateGeometryIfNeeded(e)),e.forEach(e=>this._pendingTilesForElevationUpdateEvent.add(e))}_shouldSplit(e){return 1===e.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.snapLevel)}_newRootTile(e){const t=this._acquireTile(0,e[1],e[2],null);return this._shouldSplit(t)&&t.setPendingUpdate(1),this._loadTile(t),this._markTileToUpdate(t),this._updateRootTileElevationRange(),t}_setRootTiles(e){if(this._rootTiles=e,this._allTiles.clear(),null!=e){const t=this._iteratorPool.acquire();for(t.reset(e);!t.done;)this._allTiles.push(t.next());t.remove()}this._renderer.setRootTiles(this._rootTiles),this._updateTilesVisibility(e),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles})}_runViewChangeUpdateIfDirty(){this._viewChangeUpdateDirty&&(this._viewChangeUpdateDirty=!1,this._viewChangeUpdate())}_viewChangeUpdate(){this.view&&!this.suspended&&this.tilingScheme&&this.renderer.visible&&(this._inFrameTask?this._viewChangeUpdateDirty=!0:(this._viewChangeUpdateDirty=!1,this._updateViewDependentParameters(),this._updateTilesVisibility(this._rootTiles)))}_updateClippingStatus(e){e.updateClippingStatus(this.groundExtent)&&e.resetPendingUpdate(8)&&this._updateTileGeometryState(e)}_updateTilesVisibility(e){if(null==e)return;const t=Ge(e),i=this.visibleElevationRange;let r=t?i.minElevation:1/0,s=t?i.maxElevation:-1/0;const a=this.groundExtent,n=this.view.state.contentCamera.viewProjectionMatrix;this.setTileTreeDirty(!1);const l=this._iteratorPool.acquire();for(l.reset(e);!l.done;){const e=l.next();e.updateClippingStatus(a)&&e.resetPendingUpdate(8)&&this._updateTileGeometryState(e),e.computeVisibility(),e.updateScreenDepth(n),e.renderData&&(r=Math.min(e.elevationBoundsMin,r),s=Math.max(e.elevationBoundsMax,s))}l.remove(),this._viewChanged=!0,this._allTilesDirty=!0,this._updatePendingTileGeometries(),isFinite(r)&&isFinite(s)&&(i.minElevation!==r||i.maxElevation!==s)&&(this.visibleElevationRange=new K(r,s))}_updateRootTileElevationRange(){let e=1/0,t=-1/0;const i=this._rootTiles;null!=i&&i.forEach(({elevationBoundsMin:i,elevationBoundsMax:r})=>{e=Math.min(e,i),t=Math.max(t,r)});const r=this._rootTileElevationRange;r.minElevation===e&&r.maxElevation===t||(this._rootTileElevationRange=new K(e,t))}_updateViewDependentParameters(){const{camera:e,contentCamera:t}=this.view.state,i=Math.tan(.5*t.fovX),r=Math.tan(.5*t.fovY),s=this.tilingScheme.pixelSize,a=2**-this._lodBias*e.pixelRatio;this._splitLimits.aboveGround=e.aboveGround,this._splitLimits.fovX=i,this._splitLimits.fovY=r,this._splitLimits.relativeWidthLimit=s/e.width*this.maxTextureScale*a,this._splitLimits.relativeHeightLimit=s/e.height*this.maxTextureScale*a,this._splitLimits.maxLod=this.tilingScheme.getMaxLod(),this._splitLimits.angledSplitBias=this.view.qualitySettings.tiledSurface.angledSplitBias,this.view.state.fixedContentCamera?this._splitLimits.frustum=G(this._splitLimits.frustum??N(),t.frustum):this._splitLimits.frustum=null,E(this._eyePosRenderSR,t.eye),j(e.eye,this.view.renderSpatialReference,this._eyePosSurfaceSR,this.spatialReference)}_updateTileGeometryState(e){e.updateVisibility();this._renderer.updateTileGeometryState(e)&&this._markTileToUpdate(e),this.setMemoryDirty()}_markAllTileNeighborsForUpdate(e){e.forEachLoadedNeighbor(e=>{this._layerViews[1].some(ye)&&e.setPendingUpdate(32),this._pendingTilesToUpdate.add(e)})}_updateTileTexture(e,t){const i=e.resetPendingUpdate(32)?32:!!e.resetPendingUpdate(16)&&16;i&&(this._renderer.updateTileTexture(e,i),this._usedMemory=null,t.madeProgress())}_emitElevationUpdateEventForTiles(){if(!this._shouldEmitChangeEvent)return;const e=at.extent;B(e),this._pendingTilesForElevationUpdateEvent.forEach(t=>O(e,t.extent,e)),this._pendingTilesForElevationUpdateEvent.clear(),at.spatialReference=this.spatialReference,this.emit("elevation-change",at),this._shouldEmitChangeEvent=!1}runTask(e){this._handleLayerViewChanges(e),this._frameTask.processQueue(e),this.renderer.processScaleRangeQueries(this._scaleRangeQueries,e),this._inFrameTask=!0,this._pendingUpdates=0,this._hasPendingUpdates=!1,this._updateAllTilesStatus(e),this._sortTiles(e);const t=!this.view.state.fixedContentCamera;if(this._mergeAndSplit(e,t),this._updateElevation(e),this._updateTextures(e),t||this._mergeAndSplit(e,!0),this._inFrameTask=!1,this._runViewChangeUpdateIfDirty(),this._updatePendingTileGeometries(),this._emitElevationUpdateEventForTiles(),e.done&&e.hasProgressed&&this.requestUpdate(),this.notifyChange("updatingProgressValue"),Le&&this._checkTileInvariant(),!e.hasProgressed)return Ke}_checkTileInvariant(){const e=new Map;this._allTiles.forAll(t=>e.set(t,new Set)),this._allTiles.forAll(t=>{if(_e(t.rendered===t.leaf,` rendered ${t.rendered} != ${t.leaf} leaf`),!t.leaf){const e=e=>0===e.unmergableChildCount&&0===e.maxLevelDeltaNeighborCount,i=t.children.reduce((t,i)=>t+(e(i)?0:1),0);if(_e(t.unmergableChildCount===i,` Tile[${t.lij.toString()}] unmergeable child count mismatch: actual ${t.unmergableChildCount} vs ${i}`),t.hasPendingUpdate(4)){_e(!t.hasPendingUpdate(1),"Tile can be both split and merge at the same time");for(const e of t.children)_e(e.leaf||e.hasPendingUpdate(4),"Child of tile to merge must also merge")}}for(let i=0;i<4;++i){if(t.rendered){const e=t.renderData?.geometryState.edgePeerNeighbors[i];if(null!=e){{const r=t.level-e.level<=ue;r||(console.log(`tile level delta [${t.lij.toString()}] vs [${e.lij.toString()}] > ${ue} (edge[${i}])`),_e(r,`tile level delta [${t.level}] vs [${e.level}] > ${ue}`))}_e(t.level-e.level<=ue,`Max tile lod delta exceeded: [${t.lij.toString()}] vs [${e.lij.toString()}]`)}}const r=t.level-ue,s=e=>e.leaf||e.level===t.level,a=t.findNeighborTile(fe[i],s);if(null!=a){if(t.leaf&&t.level>=ue){let i=a;for(;t.level-i.level<ue;)i=i.parent;const s=[r,t.lij[1]>>ue,t.lij[2]>>ue];if(!Ie(s,i.lij)){const r=e.get(i);_e(!r.has(t),"Cannot already have neighbor"),r.add(t)}}_e(a.rendered||a.level===t.level,"Non-same-level-neighbor of rendered must be rendered"),_e(t.level-a.level<=ue,`Tile level delta [${t.level}] vs [${a.level}] > ${ue}`)}}}),this._allTiles.forAll(t=>{const i=t.maxLevelDeltaNeighborCount,r=e.get(t);_e(i===r.size,`Tile[${t.lij.toString()}] merge-blocker mismatch: actual ${i} vs ${r.size}`)})}_updateAllTilesStatus(e){if(!this._viewChanged||!this._rootTiles||e.done)return;this._viewChanged=!1;const t=new ae(this._allTiles.length);t.pushAll(this._rootTiles);const i=this.snapLevel,r=this._splitLimits,s=this._eyePosRenderSR;this._allTiles.forAll(e=>{e.maxLevelDeltaNeighborCount=0,e.unmergableChildCount=0});const a=this.view.state.contentCamera.viewProjectionMatrix;for(;!t.empty;){const e=t.pop(),n=e.parent,l=n?.hasPendingUpdate(4),o=l?4:e.shouldSplit(r,s,i),h=1===o;e.leaf?ot(e,h):t.pushAll(e.children),l?(e.resetPendingUpdate(1),e.leaf||e.setPendingUpdate(4),this._updateClippingStatus(e),e.updateVisibility(),e.updateScreenDepth(a)):h?(e.resetPendingUpdate(4),e.leaf&&e.setPendingUpdate(1)):(e.resetPendingUpdate(1)&&e.updateAgentSuspension(),2===o&&e.updateAgents(0),e.leaf||(e.setPendingUpdate(4),e.resetPendingUpdate(1)))}this.requestUpdate(),(this._shortBatches||!this._oneBatchPerFrameTask)&&this._updatePendingTileGeometries(),e.madeProgress()}_sortTiles(e){e.done||this._allTilesSorted||!this.view.pointsOfInterest?.focus||(Ne(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,this._treeDebugger?.update(),e.madeProgress())}_markTileToUpdate(e){Te(e.loaded),e.intersectsClippingArea&&(this._pendingTilesToUpdate.add(e),this._markAllTileNeighborsForUpdate(e))}_updatePendingTileGeometries(){const e=this._pendingTilesToUpdate,t=Array.from(e.keys()).filter(e=>e.loaded&&e.intersectsClippingArea);if(0===t.length)return void e.clear();const i=(i,r)=>{!r?.loaded||!r.intersectsClippingArea||r.level<i.level||e.has(r)||(e.add(r),t.push(r),r.renderData.updateNeighborData())};t.sort(Oe);const r=t.length;for(let s=0;s<r;++s){const r=t[s];Te(r.loaded),Te(r.intersectsClippingArea);const a=r.renderData;a.updateNeighborData();const n=a.dirtyEdgeResolutions,l=a.geometryState,o=e=>{const t=De[e];i(r,l.cornerPeerNeighbors[e]?.findCorner(Pe(t),e=>e.loaded))};for(let t=0;t<4;++t)if(n&1<<t){const s=a.geometryState.edgePeerNeighbors[t];s&&s?.level>=r.level&&s.forAllSubtreeOnSide(ve(fe[t]),t=>!(!t.loaded||!t.intersectsClippingArea)&&(Te(e.has(t)||Oe(r,t)<0),i(r,t),!0)),o((t+1)%4),o(t)}}e.clear(),this._updateTilesGeometries(t),this._shouldEmitChangeEvent=!0,Le&&Re&&this.checkAllTilesWaterproofness()}_mergeAndSplit(e,t){if(this.suspended||e.done||!this._allTilesDirty)return;this._allTilesDirty=!1,this.requestUpdate();let i=!1;const r=this.view.state.fixedContentCamera;let s=!1;for(;!e.done;){s=!0;let a=!1;const n=!this._allTiles.some(s=>{if(!i&&!r&&!s.visible)return e.done;let n=s;if(s.hasPendingUpdate(4)){if(!t||s.unmergableChildCount>0)return e.done;for(s.resetPendingUpdate(4);null!=n.parent&&0===n.parent.unmergableChildCount&&n.parent.resetPendingUpdate(4);)n=n.parent;this._mergeTile(n),a=!0,e.madeProgress()}else if(s.resetPendingUpdate(1)){let t=!0;const i=s.level;if(i>=ue){const e=e=>e.leaf||i-e.level<ue;for(let r=0;r<4;++r){const a=s.findNeighborTile(fe[r],e);null!=a&&i-a.level===ue&&(t=!1,Le&&(Te(a.leaf),Te(a.hasPendingUpdate(1))))}}t?(this._splitTile(s),e.madeProgress(),a=!0):s.setPendingUpdate(1)}return e.done});if(a&&(this._allTilesSorted=!1,this._allTilesDirty=!0,!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries()),n){if(!i){i=!0;continue}if(!a)break}else this._allTilesDirty=!0}s?e.madeProgress():this._allTilesDirty=!0,!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries(),this._allTilesCreated=!this.allTiles.some(e=>e.hasPendingUpdate(1)||e.hasPendingUpdate(4)),this._sortTiles(e)}_updateElevation(e){e.done||(this._allTiles.some(t=>(t.resetPendingUpdate(8)&&(this._updateTileGeometryState(t),this._shortBatches&&this._updatePendingTileGeometries(),e.madeProgress()),e.done)),!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries())}_updateTextures(e){e.done||this._allTiles.some(t=>(this._updateTileTexture(t,e),e.done))}_updateClippingExtent(){this.spatialReference&&(this.updateOverlayParameters(),this.requestRender(1),this.overlayManager.setPlacementDirty(),this._updateRootTiles())}get _lodBias(){return this.view.qualitySettings.tiledSurface.lodBias-(1-this.view.quality)*ce}_getLodBiasCorrectedScale(e){const t=this.tilingScheme.levels,i=o(e-this._lodBias,0,t.length-1),r=i-Math.floor(i);return t[Math.floor(i)].scale*(1-r)+t[Math.ceil(i)].scale*r}_removeAllTiles(){null!=this._rootTiles&&(this._rootTiles.forEach(e=>this._purgeTile(e)),this._setRootTiles(null),this.notifyChange("ready")),this._allTiles.clear(),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles}),this.renderer.visible=!1}_purgeSubtree(e){const t=e.children;t[0]&&(this._purgeTile(t[0]),this._purgeTile(t[1]),this._purgeTile(t[2]),this._purgeTile(t[3]),e.clearChildren())}_purgeTile(e){e.leaf?dt(e):this._purgeSubtree(e),this._allTiles.removeUnordered(e),this._unloadTile(e),e.dispose(),this._tileCache.put(Je._tileMemcacheKey,e),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles})}_unloadTile(e){this._pendingTilesToUpdate.delete(e),this._pendingTilesForElevationUpdateEvent.delete(e),e.unload()}_splitTile(e){_e(e.leaf,"Tile that is already split should not be split again!"),_e(e.rendered,"Tile marked to split is not rendered"),dt(e);const t=e.createChildren();this._allTiles.pushArray(t),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles}),e.updateAgentSuspension(),_e(e.rendered,"parent should be rendered"),t.forEach(e=>this._loadTile(e)),t.forEach(e=>this._pendingTilesToUpdate.add(e)),this._unloadTile(e),this._markAllTileNeighborsForUpdate(e),this._emitTileScaleChange(e,e.level+1),this._allTilesDirty=!0,this._shortBatches&&this._updatePendingTileGeometries(),t.forEach(e=>ot(e,e.hasPendingUpdate(1))),++this._performanceInfo.numSplit}_emitTileScaleChange(e,t=e.level){nt.spatialReference=this.spatialReference,nt.extent=e.extent,nt.scale=this._getLodBiasCorrectedScale(t),this.emit("scale-change",nt)}createTile(e,t,i,r){_e(!!r,"createTile sanity check");const s=this._acquireTile(e,t,i,r);return s.updateClippingStatus(this.groundExtent),s.updateScreenDepth(this.view.state.contentCamera.viewProjectionMatrix),this._shouldSplit(s)&&s.setPendingUpdate(1),s}get _shortBatches(){return 2!==this.view.state.mode}_mergeTile(e){_e(!e.hasPendingUpdate(1),"_mergeTile sanity check"),_e(!e.leaf,"Cannot merge a leaf"),e.leaf||(this._purgeSubtree(e),_e(!e.renderData,"Merging tile with existing render data?"),this._loadTile(e),this._markTileToUpdate(e),this._emitTileScaleChange(e),this._shortBatches&&this._updatePendingTileGeometries(),ot(e,!1),this._allTilesDirty=!0,++this._performanceInfo.numMerged)}_loadTile(e){e.load(),this.requestUpdate(),this._allTilesDirty=!0,this.overlayManager?.hasOverlays&&e.updateOverlayParameters(this.overlayManager)}_handleLayerViewChanges(e=Ye){if(!this._layerViewsDirty)return;this._layerViewsDirty=!1;let t=!1;const i=new Set;let r=-1;for(let s=this.view.allLayerViews.length-1;s>=0;s--){const e=this.view.allLayerViews.items[s];if(i.add(e.uid),we(e)||Ce(e))if(this._basemapLayerViewHandles.has(e.uid)&&!Ce(e)){const i=this._layerClassFromLayerView(e),s=this.getLayerIndexByUID(i,e.uid);null!=s&&((s<r||null==r)&&(t=!0),r=s)}else this._registerTiledLayerView(e),e.layer.loaded&&(t=!0)}this._basemapLayerViewHandles.forEach((e,r)=>{i.has(r)||(this._unregisterTiledLayerView(r),t=!0)}),t&&this._updateTiledLayers(),this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._evaluateTransparency(),e.madeProgress()}get _isFullyTransparent(){if(this.view.map?.ground?.opacity>0)return!1;for(const e of this.view.allLayerViews.items)if(Se(e)&&!$(e.layer)&&0!==e.fullOpacity)return!1;return!0}_hasCompositeBlendMode(){for(const e of this.view.allLayerViews.items)if((be(e)||Ce(e))&&We(He[e.layer.blendMode]))return!0;return!1}_layerClassFromLayerView(e){return Ee(e)?0:1}_registerTiledLayerView(e){const t=[];if((be(e)||Ce(e))&&t.push(_(()=>e.layer.blendMode,()=>{this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._updateTileTextures(2)})),!Ce(e)){const i=this._layerClassFromLayerView(e);t.push(_(()=>!e.destroyed&&e.suspended,()=>this._updateTiledLayers())),t.push(_(()=>!e.destroyed&&e.fullOpacity,()=>this._updateTileTextures(2)));const{layer:r}=e;"effectiveScaleRange"in r&&t.push(_(()=>!e.destroyed&&r.effectiveScaleRange,()=>this._restartAllAgents(i))),t.push(e.on("data-changed",()=>{const t=this.getLayerIndexByUID(i,e.uid);null!=t&&this._invalidateLayerData(t,i)}))}this._unregisterTiledLayerView(e.uid),this._basemapLayerViewHandles.set(e.uid,t)}_unregisterTiledLayerView(e){const t=this._basemapLayerViewHandles.get(e);if(t){for(const e of t)e.remove();this._basemapLayerViewHandles.delete(e)}}_updateTiledLayers(){if(!this.tilingScheme||this.view.suspended)return;const e=this.view.allLayerViews,t=[[],[]];let i=null;e.forEach(e=>{if(!e.layer||e.suspended||!we(e)||!e.fullExtent)return;const r=this._layerClassFromLayerView(e);if(1===r){const t=e.displayLevelRange.maxLevel;t!==1/0&&(null===i||t>i)&&(i=t)}t[r].push(e)});for(const r of ie){const e=this._layerViews[r],i=t[r];i.reverse();const s=i.length;let a=e.length!==s;const n=new Array(s),l=new Array(e.length);this._layerIndexByUid[r].clear();for(let t=0;t<s;t++){const s=i[t].uid;this._layerIndexByUid[r].set(s,t);const o=e.indexOf(i[t]);n[t]=o,t!==o&&(a=!0),o>-1&&(l[o]=t)}if(a){const e=this._postorderIterator;for(e.reset(this._rootTiles);!e.done;)e.next().modifyLayers(l,n,r);this._layerViews[r]=i,this._restartAllAgents(r),this._updateTilesVisibility(this._rootTiles)}}this.tilingScheme.ensureMaxLod(i)&&(this._viewChangeUpdate(),this.notifyChange("tilingScheme"))}_restartAllAgents(e){const t=this._postorderIterator;for(t.reset(this._rootTiles);!t.done;){const i=t.next();i.restartAgents(e),0===e&&i.computeElevationBounds()}this._updateRootTileElevationRange()}layerViewByIndex(e,t){return this._layerViews[t][e]}numLayers(e){return this._layerViews[e].length}_updateTileTextures(e){this._allTiles.forAll(t=>{t.updateAgents(1),1===e?this.renderer.updateTileTexture(t,16):t.updateRenderData(1,e)}),this._evaluateTransparency()}_invalidateLayerData(e,t){this._allTiles.forAll(i=>i.removeLayerAgent(e,t)),this._allTiles.forAll(i=>i.invalidateLayerData(e,t))}setTileTreeDirty(e){this._allTilesDirty=!0,e&&(this._allTilesCreated=!1)}requestRender(e=1){this.renderer.setNeedsRender(e)}requestUpdate(){1===++this._pendingUpdates&&(this._hasPendingUpdates=!0)}requestTileData(e,t,i,r){const s=this.layerViewByIndex(t,i),a=s.layer;return!a.tilemapCache||ye(s)?this._requestTileData(e,i,s,r):(++this._asyncWorkItems,a.tilemapCache.fetchAvailability(e.level,e.lij[1],e.lij[2],{...r,timeout:6e3}).then(()=>--this._asyncWorkItems).catch(t=>{throw--this._asyncWorkItems,c(r),g(t)||this._dataMissing(e,i,s),t}).then(()=>this._frameTask.schedule(()=>this._requestTileData(e,i,s,r),r.signal)))}_requestTileData(e,t,i,r){if(this.destroying)return Promise.resolve();return 0===t?Ee(i)?this._requestElevationTileData(e,i,r):Promise.reject():Se(i)?this._requestMapTileData(e,i,r):Promise.reject()}_requestElevationTileData(e,t,i){++this._asyncWorkItems;const r=r=>{!m(i)&&r&&(this.setMemoryDirty(),this.requestUpdate(),this._elevationDataArrived(e,t,r))},s=i=>{g(i)||(l.getLogger(this).error(`Tile ${e.lij.toString()} layer 0/${t.uid} error ${i}`),this._dataMissing(e,0,t),this.requestUpdate())};return t.fetchElevationTile(e,i).then(e=>this._frameTask.schedule(()=>r(e)),s).finally(()=>--this._asyncWorkItems)}_elevationDataArrived(e,t,i){const r=this._layerIndexByUid[0].get(t.uid);if(null==r)return void l.getLogger(this).warn("TerrainSurface: received data from unknown layer %d %s",0,e.lij.toString());const s=new J(e.lij,e.extent,i);e.dataArrived(r,0,s),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:0});const a=[e],n=e.level,o=this._iteratorPool.acquire();for(o.reset(a);!o.done;){const e=o.next();e.findElevationBoundsForLayer(r,n),e.computeElevationBounds()}0===n&&this._updateRootTileElevationRange(),o.remove(),this._updateTilesVisibility(a)}_requestMapTileData(e,t,i){++this._asyncWorkItems;const r=(r,s)=>{xe(s),m(i)||(console.error(`Tile ${e.lij.toString()} layer 1/${t.uid} error ${r}`),this._dataMissing(e,1,t),this.requestUpdate())},s=e=>t=>r(t,e),a=r=>this._frameTask.schedule(()=>{this.requestUpdate(),m(i)?xe(r):this._mapTileDataArrived(e,t,r)},i.signal,s(r)).catch(s(r)),n=(e,t=null)=>this._frameTask.schedule(()=>r(e,t));return t.fetchTile(e.lij,i).then(a,n).finally(()=>--this._asyncWorkItems)}_mapTileDataArrived(e,t,i){const r=this.getLayerIndexByUID(1,t.uid);if(null==r)return xe(i),void l.getLogger(this).warn("TerrainSurface: received data from unknown layer");e.dataArrived(r,1,i),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:1})}_dataMissing(e,t,i){const r=this.getLayerIndexByUID(t,i.uid);null!=r?(e.dataMissing(r,t),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:t})):l.getLogger(this).warn("TerrainSurface: received data from unknown layer")}get performanceInfo(){const e=this._performanceInfo;return e.numNodes=this._allTiles.length,e.numLeaves=e.numVisible=e.numRendered=e.numLoadedPerLevel.length=e.numRenderedPerLevel.length=0,this._allTiles.forAll(t=>{t.leaf&&e.numLeaves++;const i=t.level;t.renderData&&(e.numLoadedPerLevel[i]=(e.numLoadedPerLevel[i]||0)+1),t.visible&&(e.numVisible++,t.rendered&&(e.numRenderedPerLevel[i]=(e.numRenderedPerLevel[i]||0)+1,e.numRendered++))}),e}setMemoryDirty(){this._usedMemory=null}get usedMemory(){return this.tilingScheme?(null==this._usedMemory&&(this._usedMemory=this._recalculateUsedMemory()),this._usedMemory??0):0}_recalculateUsedMemory(){return this.tilingScheme?Math.round(this._allTiles.reduce((e,t)=>e+t.usedMemory,0)):null}getUsedMemoryForLayerView(e){let t=0;const i=this._layerClassFromLayerView(e),r=this.getLayerIndexByUID(i,e.uid);return null!=r&&this._allTiles.forAll(e=>t+=e.getUsedMemoryForLayer(i,r)),t}get renderPatchBorders(){return this._renderer.renderPatchBorders}set renderPatchBorders(e){this._renderer.renderPatchBorders=e}get renderingDisabled(){return this._renderer.renderingDisabled}set renderingDisabled(e){this._renderer.renderingDisabled=e}get test(){}checkAllTilesWaterproofness(){if(!Re)return;const e=this._rootTiles;if(null==e)return;const t=e=>e?.renderData?.geometry?.indices?.length>0,i=(e,i)=>{t(e)&&console.error("Tile[",e.lij,"] has geometry although parent[",i.lij,"] has geom")},r=e=>{if(e.intersectsClippingArea)if(e.renderData&&!e.renderData.geometryState&&console.error("Tile[",e.lij,"] has renderData but not geometryState"),e.renderData&&!e.renderData.geometry&&console.error("Tile[",e.lij,"] has renderData but not geometryInfo"),!e.renderData?.geometry||(e.renderData.geometry.indices?.length??0)>0||console.error("Tile[",e.lij,"] has renderData but no indices - geometryInfo: ",e.renderData.geometry),t(e)){e.checkGeometryWaterproofness();for(const t of e.children)i(t,e)}else if(e.leaf)console.error("Tile[",e.lij,"] has no geometry and no children, from root to leaf");else for(const t of e.children)r(t)},s=e=>{const t=e.parent?.visible??!0,i=e.visible;e.computeVisibility();const r=e.visible;if(i!==r&&t&&console.error(" Tile[",e.lij,"] has out of date visibility: ",i," instead of ",r),!e.leaf)for(const a of e.children)s(a)};for(const a of e)r(a),s(a)}get isGlobal(){return this._isGlobal}get isGeographic(){return this._isGeographic}get isWebMercator(){return this._isWebMercator}get isWebMercatorOnPlateCarree(){return this._isWebMercatorOnPlateCarree}isEastEndWrap(e){return this._isGlobal&&e[2]===this.lijEastEnd(e[0])-1}isWestEndWrap(e){return this._isGlobal&&0===e[2]}lijEastEnd(e){return 1<<e+(this._isGeographic?1:0)}wrapEastWest(e){const t=this.lijEastEnd(e[0]),i=e[2];if(0<=i&&i<t)return e;if(!this._isGlobal)return null;const r=(i+(i<0?t:0))%t;return[e[0],e[1],r]}enableInternalChecks(e){Ue(e)}enableWaterproofnessChecks(e){Me(e)}static cleanupTerrainSurface(){st.prune()}enable(e){e!==this.enabled&&(this._set("enabled",e),e?(this._updateRootTiles(),this.suspended=!1):(this.suspended=!0,this._removeAllTiles(),this._setRootTiles(null)),this.notifyChange("ready"))}updateOverlayParameters(){const{overlayManager:e}=this;this.allTiles.forAll(t=>t.updateOverlayParameters(e))}};e([w()],Ze.prototype,"_renderer",void 0),e([w({constructOnly:!0})],Ze.prototype,"_scaleRangeQueries",void 0),e([w({constructOnly:!0})],Ze.prototype,"view",void 0),e([w({constructOnly:!0})],Ze.prototype,"overlayManager",void 0),e([w({constructOnly:!0})],Ze.prototype,"terrainTextureCompressionTracker",void 0),e([w()],Ze.prototype,"_hasPendingUpdates",void 0),e([w()],Ze.prototype,"_asyncWorkItems",void 0),e([w()],Ze.prototype,"_allTilesDirty",void 0),e([w()],Ze.prototype,"_allTilesSorted",void 0),e([w()],Ze.prototype,"allTilesCreated",null),e([w()],Ze.prototype,"_allTilesCreated",void 0),e([w()],Ze.prototype,"_viewChanged",void 0),e([w({type:Number})],Ze.prototype,"heading",void 0),e([w()],Ze.prototype,"_splitLimits",void 0),e([w({readOnly:!0})],Ze.prototype,"_watchUpdatingTracking",void 0),e([w()],Ze.prototype,"_frameTask",void 0),e([w()],Ze.prototype,"demResolution",null),e([w({readOnly:!0})],Ze.prototype,"snapLevel",null),e([w({readOnly:!0})],Ze.prototype,"lodSnappingEnabled",null),e([w({readOnly:!0})],Ze.prototype,"userClippingExtent",null),e([w()],Ze.prototype,"_rootTilesExtent",void 0),e([w({readOnly:!0})],Ze.prototype,"groundExtent",null),e([w({readOnly:!0})],Ze.prototype,"fullGroundExtent",null),e([w({readOnly:!0})],Ze.prototype,"_tilingSchemeExtent",null),e([w({readOnly:!0})],Ze.prototype,"updating",null),e([w({readOnly:!0})],Ze.prototype,"readyToRun",null),e([w(X)],Ze.prototype,"updatingProgress",void 0),e([w({readOnly:!0})],Ze.prototype,"updatingProgressValue",null),e([w()],Ze.prototype,"_maxNumUpdating",void 0),e([w()],Ze.prototype,"baseOpacity",null),e([w()],Ze.prototype,"hasCompositeBlendMode",void 0),e([w({readOnly:!0})],Ze.prototype,"viewingMode",null),e([w()],Ze.prototype,"maxTextureScale",void 0),e([w({readOnly:!0})],Ze.prototype,"ready",null),e([w({readOnly:!0})],Ze.prototype,"rootTiles",null),e([w()],Ze.prototype,"_rootTiles",void 0),e([w({readOnly:!0})],Ze.prototype,"spatialReference",null),e([w({type:t})],Ze.prototype,"backgroundColor",null),e([w({value:!1})],Ze.prototype,"slicePlaneEnabled",null),e([w({readOnly:!0})],Ze.prototype,"tilingScheme",void 0),e([w({readOnly:!0})],Ze.prototype,"tilingSchemeLocked",null),e([w({readOnly:!0})],Ze.prototype,"tilingSchemeLogic",void 0),e([w()],Ze.prototype,"wireframe",null),e([w()],Ze.prototype,"opaque",null),e([w()],Ze.prototype,"invisible",null),e([w({value:!1})],Ze.prototype,"suspended",null),e([w()],Ze.prototype,"fadeDuration",null),e([w()],Ze.prototype,"_xNormalizer",null),e([w()],Ze.prototype,"visibleElevationRange",void 0),e([w()],Ze.prototype,"_rootTileElevationRange",void 0),e([w()],Ze.prototype,"_layerViewsDirty",void 0),e([w()],Ze.prototype,"renderPatchBorders",null),e([w()],Ze.prototype,"renderingDisabled",null),e([w({readOnly:!0})],Ze.prototype,"enabled",void 0),Ze=Je=e([C("esri.views.3d.terrain.TerrainSurface")],Ze);const et=Ze,tt=x(),it=new W,rt=I(),st=new u,at=new ee("ground"),nt={spatialReference:null,extent:null,scale:0};function lt(e,t,i){for(const r of e){if(!r.containsPointXY(t,i))continue;let e=r;for(;e&&!e.renderData;){const r=(t>e.extentMidX?1:0)+(i<e.extentMidY?2:0);e=e.children[r]}const s=e?.renderData?.geometryState.samplerData??null;return Z(t,i,s)}return null}function ot(e,t){!e.leaf||e.level<ue||ut(e,e=>{t&&ht(e);const i=pt(e);if(e.maxLevelDeltaNeighborCount++,i){let t=e.parent;for(;t;){const e=pt(t);if(t.unmergableChildCount++,!e)break;t=t.parent}}})}function ht(e){if(e.hasPendingUpdate(1))return;let t=e.parent;for(;t?.resetPendingUpdate(4);)t=t.parent;e.resetPendingUpdate(4),e.leaf&&e.setPendingUpdate(1),e.level<ue||ut(e,e=>{ht(e)})}function dt(e){e.level<ue||ut(e,e=>{if(e.maxLevelDeltaNeighborCount--,0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount){let t=e.parent;for(;t&&(t.unmergableChildCount--,pt(t));)t=t.parent}})}function pt(e){return 0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount}function ut(e,t){if(e.level<ue)return;const i=e.level-ue,r=e.lij[1]>>ue,s=e.lij[2]>>ue,a=e=>e.leaf||e.level===i;for(let n=0;n<4;++n){const l=e.findNeighborTile(fe[n],a);if(!l||l.level!==i)continue;const o=l.lij;o[1]===r&&o[2]===s||t(l)}}export{et as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../Color.js";import{filterInPlace as i,difference as r}from"../../../core/arrayUtils.js";import s from"../../../core/CollectionFlattener.js";import{toConst as a}from"../../../core/compilerUtils.js";import{EventedAccessor as n}from"../../../core/Evented.js";import"../../../core/has.js";import l from"../../../core/Logger.js";import{clamp as o}from"../../../core/mathUtils.js";import{destroyMaybe as h}from"../../../core/maybe.js";import{MemCachePool as d}from"../../../core/MemCachePool.js";import p from"../../../core/ObjectPool.js";import u from"../../../core/PooledArray.js";import{throwIfAborted as c,isAbortError as g,isAborted as m}from"../../../core/promiseUtils.js";import{watch as _,syncAndInitial as y,sync as f,initial as T}from"../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as v}from"../../../core/units.js";import{property as w,subclass as C}from"../../../core/accessorSupport/decorators.js";import{m as S,h as b,d as E}from"../../../chunks/vec32.js";import{create as x}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as L}from"../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as P,radiusModifier as R}from"../../../geometry/ellipsoidUtils.js";import U from"../../../geometry/SpatialReference.js";import{getProjector as M}from"../../../geometry/projection/projectors.js";import{projectPointToVector as D}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as j}from"../../../geometry/projection/projectVectorToVector.js";import{create as I,equals as k,intersection as V,intersectsSphere as A,empty as B,expand as O}from"../../../geometry/support/aaBoundingRect.js";import{copy as G,create as N}from"../../../geometry/support/frustum.js";import{createSpatialReferenceCyclical as q}from"../../../geometry/support/normalizeUtils.js";import{isPlateCarree as F}from"../../../geometry/support/spatialReferenceUtils.js";import{Sphere as W}from"../../../geometry/support/sphere.js";import{ElevationQueryTileCache as H}from"../../../layers/support/ElevationQueryTileCache.js";import{isBaseLayer as $}from"../../../layers/support/layerUtils.js";import{debugFlags as Q}from"../support/debugFlags.js";import{ElevationRange as z}from"../support/ElevationRange.js";import{toBoundingRect as Y}from"../support/extentUtils.js";import{updatingProgress as X}from"../support/updatingProperties.js";import{ElevationBounds as K}from"./ElevationBounds.js";import{ElevationData as J,sampleElevation as Z}from"./ElevationData.js";import{ElevationUpdateEventImplementation as ee}from"./ElevationUpdateEvent.js";import{create as te}from"./ExtentHelper.js";import{LayerClasses as ie}from"./LayerClass.js";import{OverlayManager as re}from"./OverlayManager.js";import{PlanarPatch as se}from"./PlanarPatch.js";import{Queue as ae}from"./Queue.js";import{ScaleRangeQueries as ne}from"./ScaleRangeQueries.js";import{SphericalPatch as le}from"./SphericalPatch.js";import{SplitLimits as oe}from"./SplitLimits.js";import{maxRootTiles as he,tooManyRootTilesAfterChangeError as de,tooManyRootTilesForLayerError as pe,maxTileNeighborLevelDelta as ue,maxMemoryLodBias as ce}from"./TerrainConst.js";import{TerrainRenderer as ge}from"./TerrainRenderer.js";import me from"./TerrainSurfacePerformanceInfo.js";import{weakAssert as _e,isVectorTileLayerView as ye,neighborEdgeIndices as fe,internalAssert as Te,oppositeEdge as ve,isSurfaceLayerView as we,isGroupLayerView as Ce,isMapTileLayerView as Se,isBlendableLayerView as be,isElevationLayerView as Ee,releaseTerrainData as xe,enableTerrainInternalChecks as Le,oppositeCorner as Pe,enableWaterproofTests as Re,enableInternalTerrainChecks as Ue,enableTerrainWaterproofChecks as Me,neighborCornerIndices as De}from"./terrainUtils.js";import{Tile as je,lijEquals as Ie}from"./Tile.js";import{printAllocations as ke}from"./TilePerLayerInfo.js";import{sortTiles as Ve,IteratorPreorder as Ae,IteratorPostorder as Be,compareTilesByLij as Oe,hasLoadableSiblings as Ge,sortTilesByPOI as Ne}from"./tileUtils.js";import{TilingSchemeLogic as qe}from"./TilingSchemeLogic.js";import{UpsampleInfo as Fe}from"./UpsampleInfo.js";import{isCompositeBlendMode as We,blendModeFromString as He}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{hasLayerBasedScaleVisibility as $e}from"../../support/layerViewUtils.js";import{ImmediateTask as Qe,TaskPriority as ze,noBudget as Ye}from"../../support/Scheduler.js";import{TextureCompressionTracker as Xe}from"../../support/TextureCompressionTracker.js";import{Yield as Ke}from"../../support/Yield.js";var Je;let Ze=class extends n{static{Je=this}get allTilesCreated(){return this._allTilesCreated}get allTiles(){return a(this._allTiles)}get renderedTiles(){return Ve(i(this._allTiles.toArray(),e=>e.visible&&e.rendered))}get demResolution(){const{_allTiles:e,tilingScheme:t}=this;if(0===e.length)return{min:1,max:1};const i=v(t.spatialReference);let r=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;for(const a of e){const e=t.resolutionAtLevel(a.level)*i;r=Math.min(r,e),s=Math.max(s,e)}return{min:r,max:s}}constructor(e){super(e),this.terrainTextureCompressionTracker=new Xe,this._iteratorPool=new p(()=>new Ae,e=>e.remove=()=>this._iteratorPool.release(e)),this._postorderIterator=new Be,this._hasPendingUpdates=!1,this._pendingUpdates=0,this._asyncWorkItems=0,this._allTilesDirty=!0,this._allTilesSorted=!0,this._allTilesCreated=!1,this._usedMemory=null,this._performanceInfo=new me,this._viewChanged=!1,this.heading=0,this._inFrameTask=!1,this._viewChangeUpdateDirty=!1,this._eyePosRenderSR=x(),this._eyePosSurfaceSR=x(),this._splitLimits=new oe,this._layerViews=[new Array,new Array],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._watchUpdatingTracking=new L,this._frameTask=Qe,this._allTiles=new u,this._upsampleInfoPool=new p(()=>new Fe),this._shouldEmitChangeEvent=!1,this._rootTilesExtent=I(),this.updatingProgress=.5,this._maxNumUpdating=1,this.maxTextureScale=1.2,this._spatialReference=U.WebMercator,this._elevationProjectorCache=new Map,this.visibleElevationRange=new z(1/0,-1/0),this._rootTileElevationRange=new z(1/0,-1/0),this._projectorCache=new Map,this._tilingSchemeSpatialReference=null,this._updatingRootTiles=!1,this._pendingTilesForElevationUpdateEvent=new Set,this._pendingTilesToUpdate=new Set,this.totalGeometryUpdates=0,this.totalTileUpdates=0,this._oneBatchPerFrameTask=!0,this._layerViewsDirty=!1,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._isWebMercator=!1,this._isWebMercatorOnPlateCarree=!1,this.enabled=!0;const{view:t}=e;this.overlayManager=new re({...e,terrainSurface:this}),this._isGlobal=!t.state?.isLocal,this._isGeographic=this._spatialReference?.isGeographic??!1,this._tileConstructor=this._isGlobal?le:se,this._ellipsoid=P(t.spatialReference),this._renderer=new ge(this.overlayManager.renderer,t.stage,this._allTiles,this.terrainTextureCompressionTracker,t.resourceController.memoryController),$e()||(this._scaleRangeQueries=new ne)}initialize(){const{view:e}=this,{resourceController:t}=e,{memoryController:i}=t;this._tileCache=new d((e,t)=>i.newCache(e,t),"terrain-tile"),this._upsampleMapCache=i.newCache("terrain-upsample",({tile:e})=>e.unloadMapData()),this._elevationQueryCache=new H(i.newCache("elevation-query"));const r=this.overlayManager;this.addHandles([_(()=>r.renderer.isEmpty,()=>this._evaluateTransparency()),_(()=>this.renderer.visible,e=>this.suspended=!e),_(()=>this.heading,e=>{this._renderer.updateHeading(e),this._updateTileTextures(0)}),_(()=>({heading:e.camera?.heading,state:e.state?.mode}),({heading:e,state:t})=>{if(null==e)return;if(this.isGlobal&&this.isGeographic||this.isWebMercatorOnPlateCarree)return void(this.heading=90*Math.round(e/90)%360);const i=Math.round(e)%360,r=Math.abs(i-this.heading);(2===t||Math.min(r,360-r)>=30)&&(this.heading=i)})],"overlayManager"),this.addHandles([_(()=>this.baseOpacity,()=>{this._handleLayerViewChanges(),this._updateTileTextures(this._evaluateTransparency()?1:2)},y),_(()=>this.hasCompositeBlendMode,()=>this._updateTileTextures(this._evaluateTransparency()?1:2),y),_(()=>this.backgroundColor,(e,t)=>{e?.equals(t)||(this._handleLayerViewChanges(),this._renderer.updateTileBackground(e))},f),_(()=>this.snapLevel,()=>this._viewChanged=!0,f),_(()=>this.view.pointsOfInterest,e=>{this._renderer.pointsOfInterest=e,this._watchUpdatingTracking.removeAll(),e&&this._watchUpdatingTracking.add(()=>e.focus?.renderLocation,()=>this._allTilesSorted=!1,{equals:S})}),_(()=>Q.TERRAIN_TILE_TREE_SHOW_TILES,t=>{t&&!this._treeDebugger?import("../layers/support/TerrainTileTree3DDebugger.js").then(({TerrainTileTree3DDebugger:t})=>{!this._treeDebugger&&Q.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new t({view:e}))}):t||(this._treeDebugger=h(this._treeDebugger))},T)]);const{spatialReference:a}=e;this._extentHelper=te(this.viewingMode,{layers:e.map.allLayers,layerViews:e.allLayerViews,viewSpatialReference:a});const n=new s({getCollections:()=>e.defaultsFromMap?.mapCollections?.map(({layers:e})=>e),getChildrenFunction:e=>e&&"layers"in e?e.layers:null}),l=new qe({layers:n,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:a});this._set("tilingSchemeLogic",l),this._updateTilingScheme();const o=t.scheduler;this._frameTask=o.registerTask(ze.TERRAIN_SURFACE,this),this.addHandles([_(()=>this._extentHelper.stencilEnabledExtents,e=>this._renderer.setStencilEnabledLayerExtents(e),T),_(()=>this.tilingSchemeLogic.tilingScheme,()=>this._updateTilingScheme(),f),_(()=>this.groundExtent,()=>this._updateRootTiles(),T),e.on("resize",()=>this._viewChangeUpdate()),_(()=>{const t=e.state;return[this._lodBias,this.lodSnappingEnabled,e.quality,t.camera,t.contentCamera,t.fixedContentCamera]},()=>this._viewChangeUpdate(),y),_(()=>e.qualitySettings?.fadeDuration,e=>this._renderer.textureFadingEnabled=e>0,T),_(()=>e.qualitySettings?.physicallyBasedRenderingEnabled,e=>this._renderer.pbrMode=e?5:0,T),_(()=>e.qualitySettings?.tiledSurface.elevationLevelDelta,()=>this._updateAllTileGeometries()),_(()=>this.userClippingExtent,()=>this._updateClippingExtent(),f)]),this.addHandles(e.allLayerViews.on("after-changes",()=>this._layerViewsDirty=!0)),this._layerViewsDirty=!0,this._handleLayerViewChanges(),this._renderer.updateTileBackground(this.backgroundColor)}clearHandles(){this._watchUpdatingTracking?.removeAll(),this.removeAllHandles(),this._basemapLayerViewHandles.forEach((e,t)=>this._unregisterTiledLayerView(t)),this._basemapLayerViewHandles.clear()}destroy(){this._frameTask.remove(),this._frameTask=Qe,this._watchUpdatingTracking?.destroy(),this._removeAllTiles(),this._set("tilingSchemeLogic",h(this.tilingSchemeLogic)),this._basemapLayerViewHandles.forEach((e,t)=>this._unregisterTiledLayerView(t)),this._basemapLayerViewHandles.clear(),this._set("overlayManager",h(this.overlayManager)),this._tileCache=h(this._tileCache),this._allTiles.prune(),je.prune(),this._treeDebugger=h(this._treeDebugger),this._renderer.destroyed||this._renderer.destroy(),this._renderer=null,this._iteratorPool=h(this._iteratorPool),this._upsampleMapCache=h(this._upsampleMapCache),this._elevationQueryCache=h(this._elevationQueryCache),this._set("view",null),this._extentHelper=h(this._extentHelper),this._upsampleInfoPool=h(this._upsampleInfoPool),ke(),this._layerViews.forEach(e=>e.length=0),this._performanceInfo=null}get renderer(){return this._renderer}get frustum(){return this.view.state.camera.frustum}get snapLevel(){return this.lodSnappingEnabled?this.view.terrainLevel:null}get lodSnappingEnabled(){return this.view.qualitySettings.tiledSurface.reduceTileLevelDifferences}get upsampleInfoPool(){return this._upsampleInfoPool}get upsampleMapCache(){return this._upsampleMapCache}get elevationQueryCache(){return this._elevationQueryCache}get hasStencilEnabledExtents(){return this._extentHelper.stencilEnabledExtents.length>0}get userClippingExtent(){const{spatialReference:e}=this,t=this.view?.clippingArea;if(null==t||null==e)return null;const i=I(),r=Y(t,i,e)?i:null,s=this._get("userClippingExtent");return k(r,s)?s:r}get rootTilesExtent(){return this._rootTilesExtent}get groundExtent(){const e=V(this.fullGroundExtent,this.userClippingExtent,I()),t=this._get("groundExtent");return k(e,t)?t:e}get fullGroundExtent(){return null!=this._tilingSchemeExtent?this._tilingSchemeExtent:this._rootTilesExtent}get _tilingSchemeExtent(){return this.tilingSchemeLogic?.extent}get updating(){return this._hasPendingUpdates||(this._maxNumUpdating=1),this.enabled&&!!((this.readyToRun||this._watchUpdatingTracking?.updating||this._asyncWorkItems>0)&&this.ready&&!this.suspended||this.overlayManager?.updating||this.terrainTextureCompressionTracker.compressing)}get readyToRun(){return this.enabled&&(this._hasPendingUpdates||this._viewChanged||this._allTilesDirty||!this._allTilesSorted||this._layerViewsDirty||this._scaleRangeQueries?.updating||this._frameTask.updating)&&this.ready&&!this.suspended}get updatingProgressValue(){return this._maxNumUpdating=Math.max(this._pendingUpdates,this._maxNumUpdating),1-this._pendingUpdates/this._maxNumUpdating}get baseOpacity(){return this.view?.map?.ground?.opacity??1}set baseOpacity(e){this.view.map.ground.opacity=e}get viewingMode(){return this.view.state.viewingMode}get ready(){return!this.enabled||null!=this._rootTiles}get rootTiles(){return this._rootTiles}get spatialReference(){return this.tilingScheme?.spatialReference??null}get backgroundColor(){return this.view?.map?.ground?.surfaceColor}set backgroundColor(e){this.view.map.ground.surfaceColor=e}set slicePlaneEnabled(e){this._renderer.slicePlaneEnabled=e,this._set("slicePlaneEnabled",e),this._evaluateTransparency()}get tilingSchemeLocked(){return this.tilingSchemeLogic?.tilingSchemeLocked??!1}get wireframe(){return this._renderer?.wireframe}set wireframe(e){e!==this._renderer.wireframe&&(this._renderer.wireframe=e,this._updateAllTileGeometries())}get opaque(){return 0===this._renderer.transparency}get invisible(){return 3===this._renderer.transparency}set suspended(e){this._set("suspended",e),this._viewChangeUpdate()}get fadeDuration(){return this.view.qualitySettings.fadeDuration??0}intersect(e,t,i,r){this._renderer.intersect(e,t,i,r)}getElevationLevelDelta(e){return e<4?3:this.view.qualitySettings.tiledSurface.elevationLevelDelta}get _xNormalizer(){return q(this._spatialReference)}getElevation(e,t,i,r){const s=this._rootTiles;if(!s?.length||!this.enabled)return null;if(0===s[0].layerInfo[0].length)return null;let a=this._elevationProjectorCache.get(r);if(void 0===a&&(a=M(r,this._spatialReference)??null,this._elevationProjectorCache.set(r,a)),null==a)return l.getLogger(this).error("TerrainSurface.getElevation(): could not project given point to tiling scheme coordinate system"),null;const n=b(tt,e,t,i);a(n,0,n,0);return lt(s,this._xNormalizer?.normalize(n[0])??n[0],n[1])}getElevations(e,t,i){const r=this._rootTiles,s=r?r[0].layerInfo[0].length:0;if(r?.length&&0!==s&&this.enabled)for(let a=0;a<t;++a){const t=3*a;i(a,lt(r,e[t],e[t+1]))}else for(let a=0;a<t;++a)i(a,null)}getLayerIndexByUID(e,t){return this._layerIndexByUid[e].get(t)}getScale(e){if(!this.tilingScheme)return null;if(!D(e,tt,this.spatialReference))return l.getLogger(this).error("TerrainSurface.getScale(): could not project given point to tiling scheme coordinate system"),null;const t=this._rootTiles;if(null!=t)for(const i of t)if(i?.containsPoint(tt)){let e=i;for(;e.children[0]&&!e.rendered;){const t=e.children[0].extent;let i=0;tt[0]>t[2]&&(i+=1),tt[1]<t[1]&&(i+=2),e=e.children[i]}return this._getLodBiasCorrectedScale(e.level)}return 1/0}_ensureProjector(e){const t=this._projectorCache.get(e);if(t)return t;const i=M(e,this._tilingSchemeSpatialReference)??null;return this._projectorCache.set(e,i),i}getSphereElevationRange(e,t){if(!this.enabled||null==this._rootTiles)return null;const i=this._ensureProjector(t);if(null==i)return l.getLogger(this).error("TerrainSurface.getSphereElevationRange(): could not project given point to tiling scheme coordinate system"),null;it.copyFrom(e),i(it.center,0,it.center,0);const r=new z,s=this._rootTiles;if(null!=s){const e=[];for(const i of s)e.push(i);let t=0;for(;t<e.length;){const i=e[t];if(++t,!A(i.extent,it))continue;const s=i.children;if(null==s[0]||i.rendered)r.expandElevationRangeValues(i.elevationBoundsMin,i.elevationBoundsMax);else for(const t of s)e.push(t)}}return r}getRootElevationRange(){return this.enabled&&null!=this._rootTiles?new z(this._rootTileElevationRange.minElevation,this._rootTileElevationRange.maxElevation):null}getLowerBoundRadius(){const e=(this._ellipsoid.radius+this.visibleElevationRange.minElevation)*R;return Math.min(e,this._ellipsoid.radius)}getSphereScale(e,t){if(!this.tilingScheme)return null;if(!D(e,it.center,this.spatialReference))return l.getLogger(this).error("TerrainSurface.getSphereScale(): could not project given point to tiling scheme coordinate system"),null;it.radius=t;let i=null;const r=e=>{if(e&&A(e.extent,it)){const t=e.children;if(t[0]&&!e.rendered)for(const e of t)r(e);else{const t=this._getLodBiasCorrectedScale(e.level);i=null==i?t:Math.min(i,t)}}},s=this._rootTiles;if(null!=s)for(const a of s)r(a);return i}queryVisibleScaleRange(e,t,i,r){if(!this._scaleRangeQueries)return;const s=t?this.tilingScheme.levelAtScale(t):0,a=i?this.tilingScheme.levelAtScale(i):1/0,n=this._lodBias;this._scaleRangeQueries.queryVisibleLevelRange(e,s+n,a+n,r)}_evaluateTransparency(){const e=this.baseOpacity,t=this.overlayManager.renderer.isEmpty,i=this._renderer.transparency,r=this._isFullyTransparent?t?3:2:e>=1&&!this.hasCompositeBlendMode&&!this._renderer.slicePlaneEnabled?0:1;return this._renderer.transparency=r,i!==r&&(this.notifyChange("opaque"),this.notifyChange("invisible"),!0)}_updateTilingScheme(){const{tilingScheme:e}=this.tilingSchemeLogic;if(!(e!==this.tilingScheme))return;_e(!!e,"tiling scheme cannot be reset to undefined"),this._isGlobal=!this.view?.state?.isLocal,this.tilingScheme&&this._removeAllTiles();const t=e?.spatialReference??U.WebMercator;this._spatialReference=t,this._isWebMercator=!!t?.isWebMercator,this._isWebMercatorOnPlateCarree=this._isWebMercator&&F(this.view?.renderSpatialReference),this._isGeographic=t?.isGeographic??!1,this._set("tilingScheme",e),this._tilingSchemeSpatialReference=this.tilingScheme?.spatialReference,this._projectorCache.clear(),this._updateClippingExtent(),e&&(this._updateTiledLayers(),this._renderer.tileSize=e.pixelSize,this.overlayManager.spatialReference=e.spatialReference,this._updateRootTiles())}static{this._tileMemcacheKey="TerrainTileMemcache"}_acquireTile(e,t,i,r){const s=this._tileCache.pop(Je._tileMemcacheKey);return s?(s.init(e,t,i,r,this),s):new this._tileConstructor(e,t,i,r,this)}get updatingRootTiles(){return this._updatingRootTiles}_updateRootTiles(){const{groundExtent:e,tilingScheme:t}=this;if(!t)return;if(!this.enabled)return void this._setRootTiles(null);const i=rt;let s=t.rootTilesInExtent(e,i,5*he);if(null!=this._rootTiles){if(s.length>he)return void l.getLogger(this).warn(de);const e=this._rootTiles.map(e=>e.lij),t=r(e,s,Ie);if(this._updatingRootTiles=!0,t.removed.length>0||t.added.length>0){const e=this._rootTiles.filter(e=>!(t.removed.findIndex(t=>Ie(t,e.lij))>-1)||(this._purgeTile(e),!1));t.added.forEach(t=>e.push(this._newRootTile(t))),this._setRootTiles(e)}}else this._updatingRootTiles=!0,s.length>he&&(l.getLogger(this).warn(pe),s=t.rootTilesInExtent(e,i,he)),this._setRootTiles(s.map(e=>this._newRootTile(e)));k(i,this._rootTilesExtent)||(this._rootTilesExtent=I(i)),this.renderer.visible=!0,this._viewChangeUpdate(),this.overlayManager.setPlacementDirty(),this.notifyChange("ready"),this._updateAllTileGeometries(),this._updatingRootTiles=!1,this.checkAllTilesWaterproofness()}_updateAllTileGeometries(){const e=this._allTiles.filter(e=>e.loaded&&e.intersectsClippingArea);e.sort(Oe),e.forEach(e=>this._renderer.updateTileGeometryState(e)),e.forEach(e=>e.renderData.updateNeighborData()),this._updateTilesGeometries(e),this._pendingTilesToUpdate.clear()}_updateTilesGeometries(e){if(0===e.length)return;e.sort(Oe);const t=this.renderer;e.forEach(e=>t.updateGeometryIfNeeded(e)),e.forEach(e=>this._pendingTilesForElevationUpdateEvent.add(e))}_shouldSplit(e){return 1===e.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.snapLevel)}_newRootTile(e){const t=this._acquireTile(0,e[1],e[2],null);return this._shouldSplit(t)&&t.setPendingUpdate(1),this._loadTile(t),this._markTileToUpdate(t),this._updateRootTileElevationRange(),t}_setRootTiles(e){if(this._rootTiles=e,this._allTiles.clear(),null!=e){const t=this._iteratorPool.acquire();for(t.reset(e);!t.done;)this._allTiles.push(t.next());t.remove()}this._renderer.setRootTiles(this._rootTiles),this._updateTilesVisibility(e),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles})}_runViewChangeUpdateIfDirty(){this._viewChangeUpdateDirty&&(this._viewChangeUpdateDirty=!1,this._viewChangeUpdate())}_viewChangeUpdate(){this.view&&!this.suspended&&this.tilingScheme&&this.renderer.visible&&(this._inFrameTask?this._viewChangeUpdateDirty=!0:(this._viewChangeUpdateDirty=!1,this._updateViewDependentParameters(),this._updateTilesVisibility(this._rootTiles)))}_updateClippingStatus(e){e.updateClippingStatus(this.groundExtent)&&e.resetPendingUpdate(8)&&this._updateTileGeometryState(e)}_updateTilesVisibility(e){if(null==e)return;const t=Ge(e),i=this.visibleElevationRange;let r=t?i.minElevation:1/0,s=t?i.maxElevation:-1/0;const a=this.groundExtent,n=this.view.state.contentCamera.viewProjectionMatrix;this.setTileTreeDirty(!1);const l=this._iteratorPool.acquire();for(l.reset(e);!l.done;){const e=l.next();e.updateClippingStatus(a)&&e.resetPendingUpdate(8)&&this._updateTileGeometryState(e),e.computeVisibility(),e.updateScreenDepth(n),e.renderData&&(r=Math.min(e.elevationBoundsMin,r),s=Math.max(e.elevationBoundsMax,s))}l.remove(),this._viewChanged=!0,this._allTilesDirty=!0,this._updatePendingTileGeometries(),isFinite(r)&&isFinite(s)&&(i.minElevation!==r||i.maxElevation!==s)&&(this.visibleElevationRange=new K(r,s))}_updateRootTileElevationRange(){let e=1/0,t=-1/0;const i=this._rootTiles;null!=i&&i.forEach(({elevationBoundsMin:i,elevationBoundsMax:r})=>{e=Math.min(e,i),t=Math.max(t,r)});const r=this._rootTileElevationRange;r.minElevation===e&&r.maxElevation===t||(this._rootTileElevationRange=new K(e,t))}_updateViewDependentParameters(){const{camera:e,contentCamera:t}=this.view.state,i=Math.tan(.5*t.fovX),r=Math.tan(.5*t.fovY),s=this.tilingScheme.pixelSize,a=2**-this._lodBias*e.pixelRatio;this._splitLimits.aboveGround=e.aboveGround,this._splitLimits.fovX=i,this._splitLimits.fovY=r,this._splitLimits.relativeWidthLimit=s/e.width*this.maxTextureScale*a,this._splitLimits.relativeHeightLimit=s/e.height*this.maxTextureScale*a,this._splitLimits.maxLod=this.tilingScheme.getMaxLod(),this._splitLimits.angledSplitBias=this.view.qualitySettings.tiledSurface.angledSplitBias,this.view.state.fixedContentCamera?this._splitLimits.frustum=G(this._splitLimits.frustum??N(),t.frustum):this._splitLimits.frustum=null,E(this._eyePosRenderSR,t.eye),j(e.eye,this.view.renderSpatialReference,this._eyePosSurfaceSR,this.spatialReference)}_updateTileGeometryState(e){e.updateVisibility();this._renderer.updateTileGeometryState(e)&&this._markTileToUpdate(e),this.setMemoryDirty()}_markAllTileNeighborsForUpdate(e){e.forEachLoadedNeighbor(e=>{this._layerViews[1].some(ye)&&e.setPendingUpdate(32),this._pendingTilesToUpdate.add(e)})}_updateTileTexture(e,t){const i=e.resetPendingUpdate(32)?32:!!e.resetPendingUpdate(16)&&16;i&&(this._renderer.updateTileTexture(e,i),this._usedMemory=null,t.madeProgress())}_emitElevationUpdateEventForTiles(){if(!this._shouldEmitChangeEvent)return;const e=at.extent;B(e),this._pendingTilesForElevationUpdateEvent.forEach(t=>O(e,t.extent,e)),this._pendingTilesForElevationUpdateEvent.clear(),at.spatialReference=this.spatialReference,this.emit("elevation-change",at),this._shouldEmitChangeEvent=!1}runTask(e){this._handleLayerViewChanges(e),this._frameTask.processQueue(e),this.renderer.processScaleRangeQueries(this._scaleRangeQueries,e),this._inFrameTask=!0,this._pendingUpdates=0,this._hasPendingUpdates=!1,this._updateAllTilesStatus(e),this._sortTiles(e);const t=!this.view.state.fixedContentCamera;if(this._mergeAndSplit(e,t),this._updateElevation(e),this._updateTextures(e),t||this._mergeAndSplit(e,!0),this._inFrameTask=!1,this._runViewChangeUpdateIfDirty(),this._updatePendingTileGeometries(),this._emitElevationUpdateEventForTiles(),e.done&&e.hasProgressed&&this.requestUpdate(),this.notifyChange("updatingProgressValue"),Le&&this._checkTileInvariant(),!e.hasProgressed)return Ke}_checkTileInvariant(){const e=new Map;this._allTiles.forAll(t=>e.set(t,new Set)),this._allTiles.forAll(t=>{if(_e(t.rendered===t.leaf,` rendered ${t.rendered} != ${t.leaf} leaf`),!t.leaf){const e=e=>0===e.unmergableChildCount&&0===e.maxLevelDeltaNeighborCount,i=t.children.reduce((t,i)=>t+(e(i)?0:1),0);if(_e(t.unmergableChildCount===i,` Tile[${t.lij.toString()}] unmergeable child count mismatch: actual ${t.unmergableChildCount} vs ${i}`),t.hasPendingUpdate(4)){_e(!t.hasPendingUpdate(1),"Tile can be both split and merge at the same time");for(const e of t.children)_e(e.leaf||e.hasPendingUpdate(4),"Child of tile to merge must also merge")}}for(let i=0;i<4;++i){if(t.rendered){const e=t.renderData?.geometryState.edgePeerNeighbors[i];if(null!=e){{const r=t.level-e.level<=ue;r||(console.log(`tile level delta [${t.lij.toString()}] vs [${e.lij.toString()}] > ${ue} (edge[${i}])`),_e(r,`tile level delta [${t.level}] vs [${e.level}] > ${ue}`))}_e(t.level-e.level<=ue,`Max tile lod delta exceeded: [${t.lij.toString()}] vs [${e.lij.toString()}]`)}}const r=t.level-ue,s=e=>e.leaf||e.level===t.level,a=t.findNeighborTile(fe[i],s);if(null!=a){if(t.leaf&&t.level>=ue){let i=a;for(;t.level-i.level<ue;)i=i.parent;const s=[r,t.lij[1]>>ue,t.lij[2]>>ue];if(!Ie(s,i.lij)){const r=e.get(i);_e(!r.has(t),"Cannot already have neighbor"),r.add(t)}}_e(a.rendered||a.level===t.level,"Non-same-level-neighbor of rendered must be rendered"),_e(t.level-a.level<=ue,`Tile level delta [${t.level}] vs [${a.level}] > ${ue}`)}}}),this._allTiles.forAll(t=>{const i=t.maxLevelDeltaNeighborCount,r=e.get(t);_e(i===r.size,`Tile[${t.lij.toString()}] merge-blocker mismatch: actual ${i} vs ${r.size}`)})}_updateAllTilesStatus(e){if(!this._viewChanged||!this._rootTiles||e.done)return;this._viewChanged=!1;const t=new ae(this._allTiles.length);t.pushAll(this._rootTiles);const i=this.snapLevel,r=this._splitLimits,s=this._eyePosRenderSR;this._allTiles.forAll(e=>{e.maxLevelDeltaNeighborCount=0,e.unmergableChildCount=0});const a=this.view.state.contentCamera.viewProjectionMatrix;for(;!t.empty;){const e=t.pop(),n=e.parent,l=n?.hasPendingUpdate(4),o=l?4:e.shouldSplit(r,s,i),h=1===o;e.leaf?ot(e,h):t.pushAll(e.children),l?(e.resetPendingUpdate(1),e.leaf||e.setPendingUpdate(4),this._updateClippingStatus(e),e.updateVisibility(),e.updateScreenDepth(a)):h?(e.resetPendingUpdate(4),e.leaf&&e.setPendingUpdate(1)):(e.resetPendingUpdate(1)&&e.updateAgentSuspension(),2===o&&e.updateAgents(0),e.leaf||(e.setPendingUpdate(4),e.resetPendingUpdate(1)))}this.requestUpdate(),(this._shortBatches||!this._oneBatchPerFrameTask)&&this._updatePendingTileGeometries(),e.madeProgress()}_sortTiles(e){e.done||this._allTilesSorted||!this.view.pointsOfInterest?.focus||(Ne(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,this._treeDebugger?.update(),e.madeProgress())}_markTileToUpdate(e){Te(e.loaded),e.intersectsClippingArea&&(this._pendingTilesToUpdate.add(e),this._markAllTileNeighborsForUpdate(e))}_updatePendingTileGeometries(){const e=this._pendingTilesToUpdate,t=Array.from(e.keys()).filter(e=>e.loaded&&e.intersectsClippingArea);if(0===t.length)return void e.clear();const i=(i,r)=>{!r?.loaded||!r.intersectsClippingArea||r.level<i.level||e.has(r)||(e.add(r),t.push(r),r.renderData.updateNeighborData())};t.sort(Oe);const r=t.length;for(let s=0;s<r;++s){const r=t[s];Te(r.loaded),Te(r.intersectsClippingArea);const a=r.renderData;a.updateNeighborData();const n=a.dirtyEdgeResolutions,l=a.geometryState,o=e=>{const t=De[e];i(r,l.cornerPeerNeighbors[e]?.findCorner(Pe(t),e=>e.loaded))};for(let t=0;t<4;++t)if(n&1<<t){const s=a.geometryState.edgePeerNeighbors[t];s&&s?.level>=r.level&&s.forAllSubtreeOnSide(ve(fe[t]),t=>!(!t.loaded||!t.intersectsClippingArea)&&(Te(e.has(t)||Oe(r,t)<0),i(r,t),!0)),o((t+1)%4),o(t)}}e.clear(),this._updateTilesGeometries(t),this._shouldEmitChangeEvent=!0,Le&&Re&&this.checkAllTilesWaterproofness()}_mergeAndSplit(e,t){if(this.suspended||e.done||!this._allTilesDirty)return;this._allTilesDirty=!1,this.requestUpdate();let i=!1;const r=this.view.state.fixedContentCamera;let s=!1;for(;!e.done;){s=!0;let a=!1;const n=!this._allTiles.some(s=>{if(!i&&!r&&!s.visible)return e.done;let n=s;if(s.hasPendingUpdate(4)){if(!t||s.unmergableChildCount>0)return e.done;for(s.resetPendingUpdate(4);null!=n.parent&&0===n.parent.unmergableChildCount&&n.parent.resetPendingUpdate(4);)n=n.parent;this._mergeTile(n),a=!0,e.madeProgress()}else if(s.resetPendingUpdate(1)){let t=!0;const i=s.level;if(i>=ue){const e=e=>e.leaf||i-e.level<ue;for(let r=0;r<4;++r){const a=s.findNeighborTile(fe[r],e);null!=a&&i-a.level===ue&&(t=!1,Le&&(Te(a.leaf),Te(a.hasPendingUpdate(1))))}}t?(this._splitTile(s),e.madeProgress(),a=!0):s.setPendingUpdate(1)}return e.done});if(a&&(this._allTilesSorted=!1,this._allTilesDirty=!0,!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries()),n){if(!i){i=!0;continue}if(!a)break}else this._allTilesDirty=!0}s?e.madeProgress():this._allTilesDirty=!0,!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries(),this._allTilesCreated=!this.allTiles.some(e=>e.hasPendingUpdate(1)||e.hasPendingUpdate(4)),this._sortTiles(e)}_updateElevation(e){e.done||(this._allTiles.some(t=>(t.resetPendingUpdate(8)&&(this._updateTileGeometryState(t),this._shortBatches&&this._updatePendingTileGeometries(),e.madeProgress()),e.done)),!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries())}_updateTextures(e){e.done||this._allTiles.some(t=>(this._updateTileTexture(t,e),e.done))}_updateClippingExtent(){this.spatialReference&&(this.updateOverlayParameters(),this.requestRender(1),this.overlayManager.setPlacementDirty(),this._updateRootTiles())}get _lodBias(){return this.view.qualitySettings.tiledSurface.lodBias-(1-this.view.quality)*ce}_getLodBiasCorrectedScale(e){const t=this.tilingScheme.levels,i=o(e-this._lodBias,0,t.length-1),r=i-Math.floor(i);return t[Math.floor(i)].scale*(1-r)+t[Math.ceil(i)].scale*r}_removeAllTiles(){null!=this._rootTiles&&(this._rootTiles.forEach(e=>this._purgeTile(e)),this._setRootTiles(null),this.notifyChange("ready")),this._allTiles.clear(),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles}),this.renderer.visible=!1}_purgeSubtree(e){const t=e.children;t[0]&&(this._purgeTile(t[0]),this._purgeTile(t[1]),this._purgeTile(t[2]),this._purgeTile(t[3]),e.clearChildren())}_purgeTile(e){e.leaf?dt(e):this._purgeSubtree(e),this._allTiles.removeUnordered(e),this._unloadTile(e),e.dispose(),this._tileCache.put(Je._tileMemcacheKey,e),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles})}_unloadTile(e){this._pendingTilesToUpdate.delete(e),this._pendingTilesForElevationUpdateEvent.delete(e),e.unload()}_splitTile(e){_e(e.leaf,"Tile that is already split should not be split again!"),_e(e.rendered,"Tile marked to split is not rendered"),dt(e);const t=e.createChildren();this._allTiles.pushArray(t),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles}),e.updateAgentSuspension(),_e(e.rendered,"parent should be rendered"),t.forEach(e=>this._loadTile(e)),t.forEach(e=>this._pendingTilesToUpdate.add(e)),this._unloadTile(e),this._markAllTileNeighborsForUpdate(e),this._emitTileScaleChange(e,e.level+1),this._allTilesDirty=!0,this._shortBatches&&this._updatePendingTileGeometries(),t.forEach(e=>ot(e,e.hasPendingUpdate(1))),++this._performanceInfo.numSplit}_emitTileScaleChange(e,t=e.level){nt.spatialReference=this.spatialReference,nt.extent=e.extent,nt.scale=this._getLodBiasCorrectedScale(t),this.emit("scale-change",nt)}createTile(e,t,i,r){_e(!!r,"createTile sanity check");const s=this._acquireTile(e,t,i,r);return s.updateClippingStatus(this.groundExtent),s.updateScreenDepth(this.view.state.contentCamera.viewProjectionMatrix),this._shouldSplit(s)&&s.setPendingUpdate(1),s}get _shortBatches(){return 2!==this.view.state.mode}_mergeTile(e){_e(!e.hasPendingUpdate(1),"_mergeTile sanity check"),_e(!e.leaf,"Cannot merge a leaf"),e.leaf||(this._purgeSubtree(e),_e(!e.renderData,"Merging tile with existing render data?"),this._loadTile(e),this._markTileToUpdate(e),this._emitTileScaleChange(e),this._shortBatches&&this._updatePendingTileGeometries(),ot(e,!1),this._allTilesDirty=!0,++this._performanceInfo.numMerged)}_loadTile(e){e.load(),this.requestUpdate(),this._allTilesDirty=!0,this.overlayManager?.hasOverlays&&e.updateOverlayParameters(this.overlayManager)}_handleLayerViewChanges(e=Ye){if(!this._layerViewsDirty)return;this._layerViewsDirty=!1;let t=!1;const i=new Set;let r=-1;for(let s=this.view.allLayerViews.length-1;s>=0;s--){const e=this.view.allLayerViews.items[s];if(i.add(e.uid),we(e)||Ce(e))if(this._basemapLayerViewHandles.has(e.uid)&&!Ce(e)){const i=this._layerClassFromLayerView(e),s=this.getLayerIndexByUID(i,e.uid);null!=s&&((s<r||null==r)&&(t=!0),r=s)}else this._registerTiledLayerView(e),e.layer.loaded&&(t=!0)}this._basemapLayerViewHandles.forEach((e,r)=>{i.has(r)||(this._unregisterTiledLayerView(r),t=!0)}),t&&this._updateTiledLayers(),this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._evaluateTransparency(),e.madeProgress()}get _isFullyTransparent(){if(this.view.map?.ground?.opacity>0)return!1;for(const e of this.view.allLayerViews.items)if(Se(e)&&!$(e.layer)&&0!==e.fullOpacity)return!1;return!0}_hasCompositeBlendMode(){for(const e of this.view.allLayerViews.items)if((be(e)||Ce(e))&&We(He[e.layer.blendMode]))return!0;return!1}_layerClassFromLayerView(e){return Ee(e)?0:1}_registerTiledLayerView(e){const t=[];if((be(e)||Ce(e))&&t.push(_(()=>e.layer.blendMode,()=>{this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._updateTileTextures(2)})),!Ce(e)){const i=this._layerClassFromLayerView(e);t.push(_(()=>!e.destroyed&&e.suspended,()=>this._updateTiledLayers())),t.push(_(()=>!e.destroyed&&e.fullOpacity,()=>this._updateTileTextures(2)));const{layer:r}=e;"effectiveScaleRange"in r&&t.push(_(()=>!e.destroyed&&r.effectiveScaleRange,()=>this._restartAllAgents(i))),t.push(e.on("data-changed",()=>{const t=this.getLayerIndexByUID(i,e.uid);null!=t&&this._invalidateLayerData(t,i)}))}this._unregisterTiledLayerView(e.uid),this._basemapLayerViewHandles.set(e.uid,t)}_unregisterTiledLayerView(e){const t=this._basemapLayerViewHandles.get(e);if(t){for(const e of t)e.remove();this._basemapLayerViewHandles.delete(e)}}_updateTiledLayers(){if(!this.tilingScheme||this.view.suspended)return;const e=this.view.allLayerViews,t=[[],[]];let i=null;e.forEach(e=>{if(!e.layer||e.suspended||!we(e)||!e.fullExtent)return;const r=this._layerClassFromLayerView(e);if(1===r){const t=e.displayLevelRange.maxLevel;t!==1/0&&(null===i||t>i)&&(i=t)}t[r].push(e)});for(const r of ie){const e=this._layerViews[r],i=t[r];i.reverse();const s=i.length;let a=e.length!==s;const n=new Array(s),l=new Array(e.length);this._layerIndexByUid[r].clear();for(let t=0;t<s;t++){const s=i[t].uid;this._layerIndexByUid[r].set(s,t);const o=e.indexOf(i[t]);n[t]=o,t!==o&&(a=!0),o>-1&&(l[o]=t)}if(a){const e=this._postorderIterator;for(e.reset(this._rootTiles);!e.done;)e.next().modifyLayers(l,n,r);this._layerViews[r]=i,this._restartAllAgents(r),this._updateTilesVisibility(this._rootTiles)}}this.tilingScheme.ensureMaxLod(i)&&(this._viewChangeUpdate(),this.notifyChange("tilingScheme"))}_restartAllAgents(e){const t=this._postorderIterator;for(t.reset(this._rootTiles);!t.done;){const i=t.next();i.restartAgents(e),0===e&&i.computeElevationBounds()}this._updateRootTileElevationRange()}layerViewByIndex(e,t){return this._layerViews[t][e]}numLayers(e){return this._layerViews[e].length}_updateTileTextures(e){this._allTiles.forAll(t=>{t.updateAgents(1),1===e?this.renderer.updateTileTexture(t,16):t.updateRenderData(1,e)}),this._evaluateTransparency()}_invalidateLayerData(e,t){this._allTiles.forAll(i=>i.removeLayerAgent(e,t)),this._allTiles.forAll(i=>i.invalidateLayerData(e,t))}setTileTreeDirty(e){this._allTilesDirty=!0,e&&(this._allTilesCreated=!1)}requestRender(e=1){this.renderer.setNeedsRender(e)}requestUpdate(){1===++this._pendingUpdates&&(this._hasPendingUpdates=!0)}requestTileData(e,t,i,r){const s=this.layerViewByIndex(t,i),a=s.layer;return!a.tilemapCache||ye(s)?this._requestTileData(e,i,s,r):(++this._asyncWorkItems,a.tilemapCache.fetchAvailability(e.level,e.lij[1],e.lij[2],{...r,timeout:6e3}).then(()=>--this._asyncWorkItems).catch(t=>{throw--this._asyncWorkItems,c(r),g(t)||this._dataMissing(e,i,s),t}).then(()=>this._frameTask.schedule(()=>this._requestTileData(e,i,s,r),r.signal)))}_requestTileData(e,t,i,r){if(this.destroying)return Promise.resolve();return 0===t?Ee(i)?this._requestElevationTileData(e,i,r):Promise.reject():Se(i)?this._requestMapTileData(e,i,r):Promise.reject()}_requestElevationTileData(e,t,i){++this._asyncWorkItems;const r=r=>{!m(i)&&r&&(this.setMemoryDirty(),this.requestUpdate(),this._elevationDataArrived(e,t,r))},s=i=>{g(i)||(l.getLogger(this).error(`Tile ${e.lij.toString()} layer 0/${t.uid} error ${i}`),this._dataMissing(e,0,t),this.requestUpdate())};return t.fetchElevationTile(e,i).then(e=>this._frameTask.schedule(()=>r(e)),s).finally(()=>--this._asyncWorkItems)}_elevationDataArrived(e,t,i){const r=this._layerIndexByUid[0].get(t.uid);if(null==r)return void l.getLogger(this).warn("TerrainSurface: received data from unknown layer %d %s",0,e.lij.toString());const s=new J(e.lij,e.extent,i);e.dataArrived(r,0,s),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:0});const a=[e],n=e.level,o=this._iteratorPool.acquire();for(o.reset(a);!o.done;){const e=o.next();e.findElevationBoundsForLayer(r,n),e.computeElevationBounds()}0===n&&this._updateRootTileElevationRange(),o.remove(),this._updateTilesVisibility(a)}_requestMapTileData(e,t,i){++this._asyncWorkItems;const r=(r,s)=>{xe(s),m(i)||(console.error(`Tile ${e.lij.toString()} layer 1/${t.uid} error ${r}`),this._dataMissing(e,1,t),this.requestUpdate())},s=e=>t=>r(t,e),a=r=>this._frameTask.schedule(()=>{this.requestUpdate(),m(i)?xe(r):this._mapTileDataArrived(e,t,r)},i.signal,s(r)).catch(s(r)),n=(e,t=null)=>this._frameTask.schedule(()=>r(e,t));return t.fetchTile(e.lij,i).then(a,n).finally(()=>--this._asyncWorkItems)}_mapTileDataArrived(e,t,i){const r=this.getLayerIndexByUID(1,t.uid);if(null==r)return xe(i),void l.getLogger(this).warn("TerrainSurface: received data from unknown layer");e.dataArrived(r,1,i),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:1})}_dataMissing(e,t,i){const r=this.getLayerIndexByUID(t,i.uid);null!=r?(e.dataMissing(r,t),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:t})):l.getLogger(this).warn("TerrainSurface: received data from unknown layer")}get performanceInfo(){const e=this._performanceInfo;return e.numNodes=this._allTiles.length,e.numLeaves=e.numVisible=e.numRendered=e.numLoadedPerLevel.length=e.numRenderedPerLevel.length=0,this._allTiles.forAll(t=>{t.leaf&&e.numLeaves++;const i=t.level;t.renderData&&(e.numLoadedPerLevel[i]=(e.numLoadedPerLevel[i]||0)+1),t.visible&&(e.numVisible++,t.rendered&&(e.numRenderedPerLevel[i]=(e.numRenderedPerLevel[i]||0)+1,e.numRendered++))}),e}setMemoryDirty(){this._usedMemory=null}get usedMemory(){return this.tilingScheme?(null==this._usedMemory&&(this._usedMemory=this._recalculateUsedMemory()),this._usedMemory??0):0}_recalculateUsedMemory(){return this.tilingScheme?Math.round(this._allTiles.reduce((e,t)=>e+t.usedMemory,0)):null}getUsedMemoryForLayerView(e){let t=0;const i=this._layerClassFromLayerView(e),r=this.getLayerIndexByUID(i,e.uid);return null!=r&&this._allTiles.forAll(e=>t+=e.getUsedMemoryForLayer(i,r)),t}get renderPatchBorders(){return this._renderer.renderPatchBorders}set renderPatchBorders(e){this._renderer.renderPatchBorders=e}get renderingDisabled(){return this._renderer.renderingDisabled}set renderingDisabled(e){this._renderer.renderingDisabled=e}get test(){}checkAllTilesWaterproofness(){if(!Re)return;const e=this._rootTiles;if(null==e)return;const t=e=>e?.renderData?.geometry?.indices?.length>0,i=(e,i)=>{t(e)&&console.error("Tile[",e.lij,"] has geometry although parent[",i.lij,"] has geom")},r=e=>{if(e.intersectsClippingArea)if(e.renderData&&!e.renderData.geometryState&&console.error("Tile[",e.lij,"] has renderData but not geometryState"),e.renderData&&!e.renderData.geometry&&console.error("Tile[",e.lij,"] has renderData but not geometryInfo"),!e.renderData?.geometry||(e.renderData.geometry.indices?.length??0)>0||console.error("Tile[",e.lij,"] has renderData but no indices - geometryInfo: ",e.renderData.geometry),t(e)){e.checkGeometryWaterproofness();for(const t of e.children)i(t,e)}else if(e.leaf)console.error("Tile[",e.lij,"] has no geometry and no children, from root to leaf");else for(const t of e.children)r(t)},s=e=>{const t=e.parent?.visible??!0,i=e.visible;e.computeVisibility();const r=e.visible;if(i!==r&&t&&console.error(" Tile[",e.lij,"] has out of date visibility: ",i," instead of ",r),!e.leaf)for(const a of e.children)s(a)};for(const a of e)r(a),s(a)}get isGlobal(){return this._isGlobal}get isGeographic(){return this._isGeographic}get isWebMercator(){return this._isWebMercator}get isWebMercatorOnPlateCarree(){return this._isWebMercatorOnPlateCarree}isEastEndWrap(e){return this._isGlobal&&e[2]===this.lijEastEnd(e[0])-1}isWestEndWrap(e){return this._isGlobal&&0===e[2]}lijEastEnd(e){return 1<<e+(this._isGeographic?1:0)}wrapEastWest(e){const t=this.lijEastEnd(e[0]),i=e[2];if(0<=i&&i<t)return e;if(!this._isGlobal)return null;const r=(i+(i<0?t:0))%t;return[e[0],e[1],r]}enableInternalChecks(e){Ue(e)}enableWaterproofnessChecks(e){Me(e)}static cleanupTerrainSurface(){st.prune()}enable(e){e!==this.enabled&&(this._set("enabled",e),e?(this._updateRootTiles(),this.suspended=!1):(this.suspended=!0,this._removeAllTiles(),this._setRootTiles(null)),this.notifyChange("ready"))}updateOverlayParameters(){const{overlayManager:e}=this;this.allTiles.forAll(t=>t.updateOverlayParameters(e))}};e([w()],Ze.prototype,"_renderer",void 0),e([w({constructOnly:!0})],Ze.prototype,"_scaleRangeQueries",void 0),e([w({constructOnly:!0})],Ze.prototype,"view",void 0),e([w({constructOnly:!0})],Ze.prototype,"overlayManager",void 0),e([w({constructOnly:!0})],Ze.prototype,"terrainTextureCompressionTracker",void 0),e([w()],Ze.prototype,"_hasPendingUpdates",void 0),e([w()],Ze.prototype,"_asyncWorkItems",void 0),e([w()],Ze.prototype,"_allTilesDirty",void 0),e([w()],Ze.prototype,"_allTilesSorted",void 0),e([w()],Ze.prototype,"allTilesCreated",null),e([w()],Ze.prototype,"_allTilesCreated",void 0),e([w()],Ze.prototype,"_viewChanged",void 0),e([w({type:Number})],Ze.prototype,"heading",void 0),e([w()],Ze.prototype,"_splitLimits",void 0),e([w({readOnly:!0})],Ze.prototype,"_watchUpdatingTracking",void 0),e([w()],Ze.prototype,"_frameTask",void 0),e([w()],Ze.prototype,"demResolution",null),e([w({readOnly:!0})],Ze.prototype,"snapLevel",null),e([w({readOnly:!0})],Ze.prototype,"lodSnappingEnabled",null),e([w({readOnly:!0})],Ze.prototype,"userClippingExtent",null),e([w()],Ze.prototype,"_rootTilesExtent",void 0),e([w({readOnly:!0})],Ze.prototype,"groundExtent",null),e([w({readOnly:!0})],Ze.prototype,"fullGroundExtent",null),e([w({readOnly:!0})],Ze.prototype,"_tilingSchemeExtent",null),e([w({readOnly:!0})],Ze.prototype,"updating",null),e([w({readOnly:!0})],Ze.prototype,"readyToRun",null),e([w(X)],Ze.prototype,"updatingProgress",void 0),e([w({readOnly:!0})],Ze.prototype,"updatingProgressValue",null),e([w()],Ze.prototype,"_maxNumUpdating",void 0),e([w()],Ze.prototype,"baseOpacity",null),e([w()],Ze.prototype,"hasCompositeBlendMode",void 0),e([w({readOnly:!0})],Ze.prototype,"viewingMode",null),e([w()],Ze.prototype,"maxTextureScale",void 0),e([w({readOnly:!0})],Ze.prototype,"ready",null),e([w({readOnly:!0})],Ze.prototype,"rootTiles",null),e([w()],Ze.prototype,"_rootTiles",void 0),e([w({readOnly:!0})],Ze.prototype,"spatialReference",null),e([w({type:t})],Ze.prototype,"backgroundColor",null),e([w({value:!1})],Ze.prototype,"slicePlaneEnabled",null),e([w({readOnly:!0})],Ze.prototype,"tilingScheme",void 0),e([w({readOnly:!0})],Ze.prototype,"tilingSchemeLocked",null),e([w({readOnly:!0})],Ze.prototype,"tilingSchemeLogic",void 0),e([w()],Ze.prototype,"wireframe",null),e([w()],Ze.prototype,"opaque",null),e([w()],Ze.prototype,"invisible",null),e([w({value:!1})],Ze.prototype,"suspended",null),e([w()],Ze.prototype,"fadeDuration",null),e([w()],Ze.prototype,"_xNormalizer",null),e([w()],Ze.prototype,"visibleElevationRange",void 0),e([w()],Ze.prototype,"_rootTileElevationRange",void 0),e([w()],Ze.prototype,"_layerViewsDirty",void 0),e([w()],Ze.prototype,"renderPatchBorders",null),e([w()],Ze.prototype,"renderingDisabled",null),e([w({readOnly:!0})],Ze.prototype,"enabled",void 0),Ze=Je=e([C("esri.views.3d.terrain.TerrainSurface")],Ze);const et=Ze,tt=x(),it=new W,rt=I(),st=new u,at=new ee("ground"),nt={spatialReference:null,extent:null,scale:0};function lt(e,t,i){for(const r of e){if(!r.containsPointXY(t,i))continue;let e=r;for(;e&&!e.renderData;){const r=(t>e.extentMidX?1:0)+(i<e.extentMidY?2:0);e=e.children[r]}const s=e?.renderData?.geometryState.samplerData??null;return Z(t,i,s)}return null}function ot(e,t){!e.leaf||e.level<ue||ut(e,e=>{t&&ht(e);const i=pt(e);if(e.maxLevelDeltaNeighborCount++,i){let t=e.parent;for(;t;){const e=pt(t);if(t.unmergableChildCount++,!e)break;t=t.parent}}})}function ht(e){if(e.hasPendingUpdate(1))return;let t=e.parent;for(;t?.resetPendingUpdate(4);)t=t.parent;e.resetPendingUpdate(4),e.leaf&&e.setPendingUpdate(1),e.level<ue||ut(e,e=>{ht(e)})}function dt(e){e.level<ue||ut(e,e=>{if(e.maxLevelDeltaNeighborCount--,0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount){let t=e.parent;for(;t&&(t.unmergableChildCount--,pt(t));)t=t.parent}})}function pt(e){return 0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount}function ut(e,t){if(e.level<ue)return;const i=e.level-ue,r=e.lij[1]>>ue,s=e.lij[2]>>ue,a=e=>e.leaf||e.level===i;for(let n=0;n<4;++n){const l=e.findNeighborTile(fe[n],a);if(!l||l.level!==i)continue;const o=l.lij;o[1]===r&&o[2]===s||t(l)}}export{et as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../../core/Error.js";import{ShaderTechniqueConfigurationKey as t}from"./ShaderTechniqueConfigurationKey.js";import{NoParameters as r}from"../../../../webgl/NoParameters.js";class a extends r{constructor(){super(),this._parameterBits=this._parameterBits?.map(()=>0)??[],this._parameterNames??=[]}get key(){return this._key??=new t(this._parameterBits),this._key}decode(e=this.key){const t=this._parameterBits;this._parameterBits=[...e.bits];const r=this._parameterNames.map(e=>` ${e}: ${this[e]}`).join("\n");return this._parameterBits=t,r}}function i(t={}){return(r,a)=>{r.hasOwnProperty("_parameterNames")||Object.defineProperty(r,"_parameterNames",{value:r._parameterNames?.slice()??[],configurable:!0,writable:!0}),r.hasOwnProperty("_parameterBits")||Object.defineProperty(r,"_parameterBits",{value:r._parameterBits?.slice()??[0],configurable:!0,writable:!0}),r._parameterNames.push(a);const i=t.count||2,s=Math.ceil(Math.log2(i)),o=r._parameterBits;let n=0;for(;o[n]+s>16;)n++,n>=o.length&&o.push(0);const p=o[n],m=(1<<s)-1<<p;o[n]+=s,t.count?Object.defineProperty(r,a,{get(){return(this._parameterBits[n]&m)>>p},set(r){
|
|
5
|
+
import e from"../../../../../core/Error.js";import{ShaderTechniqueConfigurationKey as t}from"./ShaderTechniqueConfigurationKey.js";import{NoParameters as r}from"../../../../webgl/NoParameters.js";class a extends r{constructor(){super(),this._parameterBits=this._parameterBits?.map(()=>0)??[],this._parameterNames??=[]}get key(){return this._key??=new t(this._parameterBits),this._key}decode(e=this.key){const t=this._parameterBits;this._parameterBits=[...e.bits];const r=this._parameterNames.map(e=>` ${e}: ${this[e]}`).join("\n");return this._parameterBits=t,r}}function i(t={}){return(r,a)=>{r.hasOwnProperty("_parameterNames")||Object.defineProperty(r,"_parameterNames",{value:r._parameterNames?.slice()??[],configurable:!0,writable:!0}),r.hasOwnProperty("_parameterBits")||Object.defineProperty(r,"_parameterBits",{value:r._parameterBits?.slice()??[0],configurable:!0,writable:!0}),r._parameterNames.push(a);const i=t.count||2,s=Math.ceil(Math.log2(i)),o=r._parameterBits;let n=0;for(;o[n]+s>16;)n++,n>=o.length&&o.push(0);const p=o[n],m=(1<<s)-1<<p;o[n]+=s,t.count?Object.defineProperty(r,a,{get(){return(this._parameterBits[n]&m)>>p},set(r){const i=this._parameterBits[n];if((i&m)>>p!==r){if(this._key=null,this._parameterBits[n]=i&~m|+r<<p&m,"number"!=typeof r)throw new e("internal:invalid-shader-configuration",`Configuration value for ${a} must be a number, got ${typeof r}`);if(null==t.count)throw new e("internal:invalid-shader-configuration",`Configuration value for ${a} must provide a count option`)}}}):Object.defineProperty(r,a,{get(){return!!((this._parameterBits[n]&m)>>p)},set(t){const r=this._parameterBits[n];if(!!((r&m)>>p)!==t&&(this._key=null,this._parameterBits[n]=r&~m|+t<<p,"boolean"!=typeof t))throw new e("internal:invalid-shader-configurationx",`Configuration value for ${a} must be boolean, got ${typeof t}`)}})}}export{a as ShaderTechniqueConfiguration,i as parameter};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/ObjectPool.js";import t from"../../../../core/PooledArray.js";import{l as n,s as r,j as i,i as o}from"../../../../chunks/vec32.js";import{fromValues as s,create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{intersectsSphere as h}from"../../../../geometry/support/frustum.js";import{wrap as d}from"../../../../geometry/support/ray.js";import{Sphere as u}from"../../../../geometry/support/sphere.js";import{rayBoxTest as c}from"./Util.js";class l{get bounds(){return this._root.bounds}get halfSize(){return this._root.halfSize}get root(){return this._root.node}get maximumObjectsPerNode(){return this._maximumObjectsPerNode}get maximumDepth(){return this._maximumDepth}get objectCount(){return this._objectCount}constructor(e,t){this.objectToBoundingSphere=e,this._maximumObjectsPerNode=10,this._maximumDepth=20,this._degenerateObjects=new Set,this._root=new f,this._objectCount=0,t&&(void 0!==t.maximumObjectsPerNode&&(this._maximumObjectsPerNode=t.maximumObjectsPerNode),void 0!==t.maximumDepth&&(this._maximumDepth=t.maximumDepth))}destroy(){this._degenerateObjects.clear(),f.clearPool(),R[0]=null,k.prune(),J.prune()}add(e){const t=Array.from(e);this._grow(t);const n=f.acquire();for(const r of t)++this._objectCount,this._isDegenerate(r)?this._degenerateObjects.add(r):(n.init(this._root),this._add(r,n));f.release(n)}remove(e,t=null){this._objectCount-=e.length;const n=f.acquire();for(const r of e){const e=t??this.objectToBoundingSphere(r);A(e.radius)?(n.init(this._root),p(r,e,n)):this._degenerateObjects.delete(r)}f.release(n),this._shrink()}update(e,t){if(!A(t.radius)&&this._isDegenerate(e))return;const n=v(e);this.remove(n,t),this.add(n)}forEachAlongRay(e,t,n){const r=d(e,t);m(this._root,e=>{if(!g(r,e))return!1;const t=e.node;return t.terminals.forAll(e=>{this._intersectsObject(r,e)&&n(e)}),null!==t.residents&&t.residents.forAll(e=>{this._intersectsObject(r,e)&&n(e)}),!0})}forEachAlongRayWithVerticalOffset(e,t,n,r){const i=d(e,t);m(this._root,e=>{if(!S(i,e,r))return!1;const t=e.node;return t.terminals.forAll(e=>{this._intersectsObjectWithOffset(i,e,r)&&n(e)}),null!==t.residents&&t.residents.forAll(e=>{this._intersectsObjectWithOffset(i,e,r)&&n(e)}),!0})}forEach(e){m(this._root,t=>{const n=t.node;return n.terminals.forAll(e),null!==n.residents&&n.residents.forAll(e),!0}),this._degenerateObjects.forEach(e)}forEachDegenerateObject(e){this._degenerateObjects.forEach(e)}findClosest(e,t,n,r=()=>!0,s=1/0){let a=1/0,d=1/0,u=null;const c=T(e,t),l=i=>{if(--s,!r(i))return;const o=this.objectToBoundingSphere(i);if(!h(n,o))return;const c=D(e,t,o.center),l=c-o.radius,f=c+o.radius;l<a&&(a=l,d=f,u=i)};return _(this._root,r=>{if(s<=0||!h(n,r.bounds))return!1;i(P,c,r.halfSize),o(P,P,r.bounds.center);if(D(e,t,P)>d)return!1;const a=r.node;return a.terminals.forAll(e=>l(e)),null!==a.residents&&a.residents.forAll(e=>l(e)),!0},e,t),u}forEachInDepthRange(e,t,n,r,s,a,d){let u=-1/0,c=1/0;const l={setRange:e=>{1===n?(u=Math.max(u,e.near),c=Math.min(c,e.far)):(u=Math.max(u,-e.far),c=Math.min(c,-e.near))}};l.setRange(r);const f=D(t,n,e),m=T(t,n),p=T(t,-n),b=e=>{if(!d(e))return;const r=this.objectToBoundingSphere(e),i=D(t,n,r.center)-f,o=i-r.radius,m=i+r.radius;o>c||m<u||!h(a,r)||s(e,l)};_(this._root,e=>{if(!h(a,e.bounds))return!1;i(P,m,e.halfSize),o(P,P,e.bounds.center);if(D(t,n,P)-f>c)return!1;i(P,p,e.halfSize),o(P,P,e.bounds.center);if(D(t,n,P)-f<u)return!1;const r=e.node;return r.terminals.forAll(e=>b(e)),null!==r.residents&&r.residents.forAll(e=>b(e)),!0},t,n)}forEachNode(e){m(this._root,t=>e(t.node,t.bounds,t.halfSize,t.depth))}forEachNeighbor(e,t){const n=t.radius,i=t.center,o=t=>{const o=this.objectToBoundingSphere(t),s=o.radius,a=n+s;return!(r(o.center,i)-a*a<=0)||e(t)};let s=!0;const a=e=>{s&&(s=o(e))};m(this._root,e=>{const t=e.bounds.radius,o=n+t;if(r(e.bounds.center,i)-o*o>0)return!1;const h=e.node;return h.terminals.forAll(a),s&&null!==h.residents&&h.residents.forAll(a),s}),s&&this.forEachDegenerateObject(a)}_intersectsObject(e,t){const n=this.objectToBoundingSphere(t);return!(n.radius>0)||n.intersectRay(e)}_intersectsObjectWithOffset(e,t,n){const r=this.objectToBoundingSphere(t);return!(r.radius>0)||n.applyToBoundingSphere(r).intersectRay(e)}_add(e,t){t.advanceTo(this.objectToBoundingSphere(e))?t.node.terminals.push(e):(t.node.residents.push(e),t.node.residents.length>this._maximumObjectsPerNode&&t.depth<this._maximumDepth&&this._split(t))}_split(e){const t=e.node.residents;e.node.residents=null;for(let n=0;n<t.length;n++){const r=f.acquire().init(e);this._add(t.at(n),r),f.release(r)}}_grow(e){if(M(e,e=>this.objectToBoundingSphere(e),C),A(C.radius)&&!this._fitsInsideTree(C))if(j(this._root.node))this._root.bounds.copy(C),this._root.halfSize=1.25*this._root.bounds.radius,this._root.updateBoundsRadiusFromHalfSize();else{const e=this._rootBoundsForRootAsSubNode(C);this._placingRootViolatesMaxDepth(e)?this._rebuildTree(C,e):this._growRootAsSubNode(e),f.release(e)}}_rebuildTree(e,t){I.center=t.bounds.center,I.radius=t.halfSize,M([e,I],e=>e,L);const n=f.acquire().init(this._root);this._root.initFrom(null,L,L.radius),this._root.increaseHalfSize(1.25),m(n,e=>(this.add(e.node.terminals.data),null!==e.node.residents&&this.add(e.node.residents.data),!0)),f.release(n)}_placingRootViolatesMaxDepth(e){const t=Math.log(e.halfSize/this._root.halfSize)*Math.LOG2E;let n=0;return m(this._root,e=>(n=Math.max(n,e.depth),n+t<=this._maximumDepth)),n+t>this._maximumDepth}_rootBoundsForRootAsSubNode(e){const t=e.radius,n=e.center;let r=-1/0;const i=this._root.bounds.center,o=this._root.halfSize;for(let a=0;a<3;a++){const e=i[a]-o-(n[a]-t),s=n[a]+t-(i[a]+o),h=Math.max(0,Math.ceil(e/(2*o))),d=Math.max(0,Math.ceil(s/(2*o)))+1,u=2**Math.ceil(Math.log(h+d)*Math.LOG2E);r=Math.max(r,u),H[a].min=h,H[a].max=d}for(let a=0;a<3;a++){let e=H[a].min,t=H[a].max;const n=(r-(e+t))/2;e+=Math.ceil(n),t+=Math.floor(n);const s=i[a]-o-e*o*2;E.center[a]=s+(t+e)*o}const s=r*o;return E.radius=s*y,f.acquire().initFrom(null,E,s,0)}_growRootAsSubNode(e){const t=this._root.node;C.center=this._root.bounds.center,C.radius=this._root.halfSize,this._root.init(e),e.advanceTo(C,null,!0),e.node.children=t.children,e.node.residents=t.residents,e.node.terminals=t.terminals}_shrink(){for(;;){const e=this._findShrinkIndex();if(-1===e)break;this._root.advance(e),this._root.depth=0}}_findShrinkIndex(){if(0!==this._root.node.terminals.length||this._root.isLeaf())return-1;let e=null;const t=this._root.node.children;let n=0,r=0;for(;r<t.length&&null==e;)n=r++,e=t[n];for(;r<t.length;)if(t[r++])return-1;return n}_isDegenerate(e){return!A(this.objectToBoundingSphere(e).radius)}_fitsInsideTree(e){const t=this._root.bounds,n=this._root.halfSize;return e.radius<=n&&e.center[0]>=t.center[0]-n&&e.center[0]<=t.center[0]+n&&e.center[1]>=t.center[1]-n&&e.center[1]<=t.center[1]+n&&e.center[2]>=t.center[2]-n&&e.center[2]<=t.center[2]+n}toJSON(){const{maximumDepth:e,maximumObjectsPerNode:t,_objectCount:n}=this,r=this._nodeToJSON(this._root.node);return{maximumDepth:e,maximumObjectsPerNode:t,objectCount:n,root:{bounds:this._root.bounds,halfSize:this._root.halfSize,depth:this._root.depth,node:r}}}_nodeToJSON(e){const t=e.children.map(e=>e?this._nodeToJSON(e):null),n=e.residents?.map(e=>this.objectToBoundingSphere(e)),r=e.terminals?.map(e=>this.objectToBoundingSphere(e));return{children:t,residents:n,terminals:r}}static fromJSON(e){const t=new l(e=>e,{maximumDepth:e.maximumDepth,maximumObjectsPerNode:e.maximumObjectsPerNode});return t._objectCount=e.objectCount,t._root.initFrom(e.root.node,e.root.bounds,e.root.halfSize,e.root.depth),t}}class f{constructor(){this.bounds=new u,this.halfSize=0,this.initFrom(null,null,0,0)}init(e){return this.initFrom(e.node,e.bounds,e.halfSize,e.depth)}initFrom(e,t,n,r=this.depth){return this.node=null!=e?e:f.createEmptyNode(),t&&this.bounds.copy(t),this.halfSize=n,this.depth=r,this}increaseHalfSize(e){this.halfSize*=e,this.updateBoundsRadiusFromHalfSize()}updateBoundsRadiusFromHalfSize(){this.bounds.radius=this.halfSize*y}advance(e){let t=this.node.children[e];t||(t=f.createEmptyNode(),this.node.children[e]=t),this.node=t,this.halfSize/=2,this.depth++;const n=w[e];return this.bounds.center[0]+=n[0]*this.halfSize,this.bounds.center[1]+=n[1]*this.halfSize,this.bounds.center[2]+=n[2]*this.halfSize,this.updateBoundsRadiusFromHalfSize(),this}advanceTo(e,t,n=!1){for(;;){if(this.isTerminalFor(e))return t?.(this,-1),!0;if(this.isLeaf()){if(!n)return t?.(this,-1),!1;this.node.residents=null}const r=this._childIndex(e);t?.(this,r),this.advance(r)}}isLeaf(){return null!=this.node.residents}isTerminalFor(e){return e.radius>this.halfSize/2}_childIndex(e){const t=this.bounds.center;return(t[0]<e.center[0]?1:0)+(t[1]<e.center[1]?2:0)+(t[2]<e.center[2]?4:0)}static createEmptyNode(){return{children:[null,null,null,null,null,null,null,null],terminals:new t({shrink:!0}),residents:new t({shrink:!0})}}static{this._pool=new e(()=>new f)}static acquire(){return f._pool.acquire()}static release(e){f._pool.release(e)}static clearPool(){f._pool.prune()}}function m(e,t){let n=f.acquire().init(e);const r=[n];for(;0!==r.length;){if(n=r.pop(),t(n)&&!n.isLeaf())for(let e=0;e<n.node.children.length;e++){n.node.children[e]&&r.push(f.acquire().init(n).advance(e))}f.release(n)}}function _(e,t,n,r=1){let i=f.acquire().init(e);const o=[i];for(N(n,r,W);0!==o.length;){if(i=o.pop(),t(i)&&!i.isLeaf())for(let e=7;e>=0;--e){const t=W[e];i.node.children[t]&&o.push(f.acquire().init(i).advance(t))}f.release(i)}}function p(e,t,n){k.clear();const r=n.advanceTo(t,(e,t)=>{k.push(e.node),k.push(t)})?n.node.terminals:n.node.residents;if(r.removeUnordered(e),0===r.length)for(let i=k.length-2;i>=0;i-=2){if(!b(k.data[i],k.data[i+1]))break}}function b(e,n){return n>=0&&(e.children[n]=null),!!j(e)&&(null===e.residents&&(e.residents=new t({shrink:!0})),!0)}function g(e,t){return z(t.bounds.center,2*-t.halfSize,F),z(t.bounds.center,2*t.halfSize,q),c(e.origin,e.direction,F,q)}function S(e,t,n){return z(t.bounds.center,2*-t.halfSize,F),z(t.bounds.center,2*t.halfSize,q),n.applyToMinMax(F,q),c(e.origin,e.direction,F,q)}function j(e){if(0!==e.terminals.length)return!1;if(null!==e.residents)return 0===e.residents.length;for(let t=0;t<e.children.length;t++)if(e.children[t])return!1;return!0}function x(e,t){e[0]=Math.min(e[0],t.center[0]-t.radius),e[1]=Math.min(e[1],t.center[1]-t.radius),e[2]=Math.min(e[2],t.center[2]-t.radius)}function O(e,t){e[0]=Math.max(e[0],t.center[0]+t.radius),e[1]=Math.max(e[1],t.center[1]+t.radius),e[2]=Math.max(e[2],t.center[2]+t.radius)}function z(e,t,n){n[0]=e[0]+t,n[1]=e[1]+t,n[2]=e[2]+t}function M(e,t,r){F[0]=1/0,F[1]=1/0,F[2]=1/0,q[0]=-1/0,q[1]=-1/0,q[2]=-1/0;for(const n of e){const e=t(n);A(e.radius)&&(x(F,e),O(q,e))}n(r.center,F,q,.5),r.radius=Math.max(q[0]-F[0],q[1]-F[1],q[2]-F[2])/2}function N(e,t,n){if(!J.length)for(let r=0;r<8;++r)J.push({index:0,distance:0});for(let r=0;r<8;++r){const n=w[r];J.data[r].index=r,J.data[r].distance=D(e,t,n)}J.sort((e,t)=>e.distance-t.distance);for(let r=0;r<8;++r)n[r]=J.data[r].index}function T(e,t){let n,r=1/0;for(let i=0;i<8;++i){const o=D(e,t,B[i]);o<r&&(r=o,n=B[i])}return n}function D(e,t,n){return t*(e[0]*n[0]+e[1]*n[1]+e[2]*n[2])}function A(e){return!isNaN(e)&&e!==-1/0&&e!==1/0&&e>0}const w=[s(-1,-1,-1),s(1,-1,-1),s(-1,1,-1),s(1,1,-1),s(-1,-1,1),s(1,-1,1),s(-1,1,1),s(1,1,1)],B=[s(-1,-1,-1),s(-1,-1,1),s(-1,1,-1),s(-1,1,1),s(1,-1,-1),s(1,-1,1),s(1,1,-1),s(1,1,1)],y=Math.sqrt(3),R=[null];function v(e){return R[0]=e,R}const E=new u,P=a(),F=a(),q=a(),k=new t,C=new u,I=new u,L=new u,H=[{min:0,max:0},{min:0,max:0},{min:0,max:0}],J=new t,W=[0,0,0,0,0,0,0,0];export{l as Octree};
|
|
5
|
+
import e from"../../../../core/ObjectPool.js";import t from"../../../../core/PooledArray.js";import{l as n,s as r,j as i,i as o}from"../../../../chunks/vec32.js";import{fromValues as s,create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{intersectsSphere as h}from"../../../../geometry/support/frustum.js";import{wrap as d}from"../../../../geometry/support/ray.js";import{Sphere as u}from"../../../../geometry/support/sphere.js";import{rayBoxTest as c}from"./Util.js";class l{get bounds(){return this._root.bounds}get halfSize(){return this._root.halfSize}get root(){return this._root.node}get maximumObjectsPerNode(){return this._maximumObjectsPerNode}get maximumDepth(){return this._maximumDepth}get objectCount(){return this._objectCount}constructor(e,t){this.objectToBoundingSphere=e,this._maximumObjectsPerNode=10,this._maximumDepth=20,this._degenerateObjects=new Set,this._root=new f,this._objectCount=0,t&&(void 0!==t.maximumObjectsPerNode&&(this._maximumObjectsPerNode=t.maximumObjectsPerNode),void 0!==t.maximumDepth&&(this._maximumDepth=t.maximumDepth))}destroy(){this._degenerateObjects.clear(),f.clearPool(),R[0]=null,k.prune(),J.prune()}add(e){const t=Array.from(e);this._grow(t);const n=f.acquire();for(const r of t)++this._objectCount,this._isDegenerate(r)?this._degenerateObjects.add(r):(n.init(this._root),this._add(r,n));f.release(n)}remove(e,t=null){this._objectCount-=e.length;const n=f.acquire();for(const r of e){const e=t??this.objectToBoundingSphere(r);A(e.radius)?(n.init(this._root),p(r,e,n)):this._degenerateObjects.delete(r)}f.release(n),this._shrink()}update(e,t){if(!A(t.radius)&&this._isDegenerate(e))return;const n=v(e);this.remove(n,t),this.add(n)}forEachAlongRay(e,t,n){const r=d(e,t);m(this._root,e=>{if(!g(r,e))return!1;const t=e.node;return t.terminals.forAll(e=>{this._intersectsObject(r,e)&&n(e)}),null!==t.residents&&t.residents.forAll(e=>{this._intersectsObject(r,e)&&n(e)}),!0})}forEachAlongRayWithVerticalOffset(e,t,n,r){const i=d(e,t);m(this._root,e=>{if(!S(i,e,r))return!1;const t=e.node;return t.terminals.forAll(e=>{this._intersectsObjectWithOffset(i,e,r)&&n(e)}),null!==t.residents&&t.residents.forAll(e=>{this._intersectsObjectWithOffset(i,e,r)&&n(e)}),!0})}forEach(e){m(this._root,t=>{const n=t.node;return n.terminals.forAll(e),null!==n.residents&&n.residents.forAll(e),!0}),this._degenerateObjects.forEach(e)}forEachDegenerateObject(e){this._degenerateObjects.forEach(e)}findClosest(e,t,n,r=()=>!0,s=1/0){let a=1/0,d=1/0,u=null;const c=T(e,t),l=i=>{if(--s,!r(i))return;const o=this.objectToBoundingSphere(i);if(!h(n,o))return;const c=D(e,t,o.center),l=c-o.radius,f=c+o.radius;l<a&&(a=l,d=f,u=i)};return _(this._root,r=>{if(s<=0||!h(n,r.bounds))return!1;i(E,c,r.halfSize),o(E,E,r.bounds.center);if(D(e,t,E)>d)return!1;const a=r.node;return a.terminals.forAll(e=>l(e)),null!==a.residents&&a.residents.forAll(e=>l(e)),!0},e,t),u}forEachInDepthRange(e,t,n,r,s,a,d){let u=-1/0,c=1/0;const l={setRange:e=>{1===n?(u=Math.max(u,e.near),c=Math.min(c,e.far)):(u=Math.max(u,-e.far),c=Math.min(c,-e.near))}};l.setRange(r);const f=D(t,n,e),m=T(t,n),p=T(t,-n),b=e=>{if(!d(e))return;const r=this.objectToBoundingSphere(e),i=D(t,n,r.center)-f,o=i-r.radius,m=i+r.radius;o>c||m<u||!h(a,r)||s(e,l)};_(this._root,e=>{if(!h(a,e.bounds))return!1;i(E,m,e.halfSize),o(E,E,e.bounds.center);if(D(t,n,E)-f>c)return!1;i(E,p,e.halfSize),o(E,E,e.bounds.center);if(D(t,n,E)-f<u)return!1;const r=e.node;return r.terminals.forAll(e=>b(e)),null!==r.residents&&r.residents.forAll(e=>b(e)),!0},t,n)}forEachNode(e){m(this._root,t=>e(t.node,t.bounds,t.halfSize,t.depth))}forEachNeighbor(e,t){const n=t.radius,i=t.center,o=t=>{const o=this.objectToBoundingSphere(t),s=o.radius,a=n+s;return!(r(o.center,i)-a*a<=0)||e(t)};let s=!0;const a=e=>{s&&(s=o(e))};m(this._root,e=>{const t=e.bounds.radius,o=n+t;if(r(e.bounds.center,i)-o*o>0)return!1;const h=e.node;return h.terminals.forAll(a),s&&null!==h.residents&&h.residents.forAll(a),s}),s&&this.forEachDegenerateObject(a)}_intersectsObject(e,t){const n=this.objectToBoundingSphere(t);return!(n.radius>0)||n.intersectRay(e)}_intersectsObjectWithOffset(e,t,n){const r=this.objectToBoundingSphere(t);return!(r.radius>0)||n.applyToBoundingSphere(r).intersectRay(e)}_add(e,t){t.advanceTo(this.objectToBoundingSphere(e))?t.node.terminals.push(e):(t.node.residents.push(e),t.node.residents.length>this._maximumObjectsPerNode&&t.depth<this._maximumDepth&&this._split(t))}_split(e){const t=e.node.residents;e.node.residents=null;for(let n=0;n<t.length;n++){const r=f.acquire().init(e);this._add(t.at(n),r),f.release(r)}}_grow(e){if(M(e,e=>this.objectToBoundingSphere(e),C),A(C.radius)&&!this._fitsInsideTree(C))if(j(this._root.node))this._root.bounds.copyFrom(C),this._root.halfSize=1.25*this._root.bounds.radius,this._root.updateBoundsRadiusFromHalfSize();else{const e=this._rootBoundsForRootAsSubNode(C);this._placingRootViolatesMaxDepth(e)?this._rebuildTree(C,e):this._growRootAsSubNode(e),f.release(e)}}_rebuildTree(e,t){I.center=t.bounds.center,I.radius=t.halfSize,M([e,I],e=>e,L);const n=f.acquire().init(this._root);this._root.initFrom(null,L,L.radius),this._root.increaseHalfSize(1.25),m(n,e=>(this.add(e.node.terminals.data),null!==e.node.residents&&this.add(e.node.residents.data),!0)),f.release(n)}_placingRootViolatesMaxDepth(e){const t=Math.log(e.halfSize/this._root.halfSize)*Math.LOG2E;let n=0;return m(this._root,e=>(n=Math.max(n,e.depth),n+t<=this._maximumDepth)),n+t>this._maximumDepth}_rootBoundsForRootAsSubNode(e){const t=e.radius,n=e.center;let r=-1/0;const i=this._root.bounds.center,o=this._root.halfSize;for(let a=0;a<3;a++){const e=i[a]-o-(n[a]-t),s=n[a]+t-(i[a]+o),h=Math.max(0,Math.ceil(e/(2*o))),d=Math.max(0,Math.ceil(s/(2*o)))+1,u=2**Math.ceil(Math.log(h+d)*Math.LOG2E);r=Math.max(r,u),H[a].min=h,H[a].max=d}for(let a=0;a<3;a++){let e=H[a].min,t=H[a].max;const n=(r-(e+t))/2;e+=Math.ceil(n),t+=Math.floor(n);const s=i[a]-o-e*o*2;F.center[a]=s+(t+e)*o}const s=r*o;return F.radius=s*y,f.acquire().initFrom(null,F,s,0)}_growRootAsSubNode(e){const t=this._root.node;C.center=this._root.bounds.center,C.radius=this._root.halfSize,this._root.init(e),e.advanceTo(C,null,!0),e.node.children=t.children,e.node.residents=t.residents,e.node.terminals=t.terminals}_shrink(){for(;;){const e=this._findShrinkIndex();if(-1===e)break;this._root.advance(e),this._root.depth=0}}_findShrinkIndex(){if(0!==this._root.node.terminals.length||this._root.isLeaf())return-1;let e=null;const t=this._root.node.children;let n=0,r=0;for(;r<t.length&&null==e;)n=r++,e=t[n];for(;r<t.length;)if(t[r++])return-1;return n}_isDegenerate(e){return!A(this.objectToBoundingSphere(e).radius)}_fitsInsideTree(e){const t=this._root.bounds,n=this._root.halfSize;return e.radius<=n&&e.center[0]>=t.center[0]-n&&e.center[0]<=t.center[0]+n&&e.center[1]>=t.center[1]-n&&e.center[1]<=t.center[1]+n&&e.center[2]>=t.center[2]-n&&e.center[2]<=t.center[2]+n}toJSON(){const{maximumDepth:e,maximumObjectsPerNode:t,_objectCount:n}=this,r=this._nodeToJSON(this._root.node);return{maximumDepth:e,maximumObjectsPerNode:t,objectCount:n,root:{bounds:this._root.bounds,halfSize:this._root.halfSize,depth:this._root.depth,node:r}}}_nodeToJSON(e){const t=e.children.map(e=>e?this._nodeToJSON(e):null),n=e.residents?.map(e=>this.objectToBoundingSphere(e)),r=e.terminals?.map(e=>this.objectToBoundingSphere(e));return{children:t,residents:n,terminals:r}}static fromJSON(e){const t=new l(e=>e,{maximumDepth:e.maximumDepth,maximumObjectsPerNode:e.maximumObjectsPerNode});return t._objectCount=e.objectCount,t._root.initFrom(e.root.node,e.root.bounds,e.root.halfSize,e.root.depth),t}}class f{constructor(){this.bounds=new u,this.halfSize=0,this.initFrom(null,null,0,0)}init(e){return this.initFrom(e.node,e.bounds,e.halfSize,e.depth)}initFrom(e,t,n,r=this.depth){return this.node=null!=e?e:f.createEmptyNode(),t&&this.bounds.copyFrom(t),this.halfSize=n,this.depth=r,this}increaseHalfSize(e){this.halfSize*=e,this.updateBoundsRadiusFromHalfSize()}updateBoundsRadiusFromHalfSize(){this.bounds.radius=this.halfSize*y}advance(e){let t=this.node.children[e];t||(t=f.createEmptyNode(),this.node.children[e]=t),this.node=t,this.halfSize/=2,this.depth++;const n=w[e];return this.bounds.center[0]+=n[0]*this.halfSize,this.bounds.center[1]+=n[1]*this.halfSize,this.bounds.center[2]+=n[2]*this.halfSize,this.updateBoundsRadiusFromHalfSize(),this}advanceTo(e,t,n=!1){for(;;){if(this.isTerminalFor(e))return t?.(this,-1),!0;if(this.isLeaf()){if(!n)return t?.(this,-1),!1;this.node.residents=null}const r=this._childIndex(e);t?.(this,r),this.advance(r)}}isLeaf(){return null!=this.node.residents}isTerminalFor(e){return e.radius>this.halfSize/2}_childIndex(e){const t=this.bounds.center;return(t[0]<e.center[0]?1:0)+(t[1]<e.center[1]?2:0)+(t[2]<e.center[2]?4:0)}static createEmptyNode(){return{children:[null,null,null,null,null,null,null,null],terminals:new t({shrink:!0}),residents:new t({shrink:!0})}}static{this._pool=new e(()=>new f)}static acquire(){return f._pool.acquire()}static release(e){f._pool.release(e)}static clearPool(){f._pool.prune()}}function m(e,t){let n=f.acquire().init(e);const r=[n];for(;0!==r.length;){if(n=r.pop(),t(n)&&!n.isLeaf())for(let e=0;e<n.node.children.length;e++){n.node.children[e]&&r.push(f.acquire().init(n).advance(e))}f.release(n)}}function _(e,t,n,r=1){let i=f.acquire().init(e);const o=[i];for(N(n,r,W);0!==o.length;){if(i=o.pop(),t(i)&&!i.isLeaf())for(let e=7;e>=0;--e){const t=W[e];i.node.children[t]&&o.push(f.acquire().init(i).advance(t))}f.release(i)}}function p(e,t,n){k.clear();const r=n.advanceTo(t,(e,t)=>{k.push(e.node),k.push(t)})?n.node.terminals:n.node.residents;if(r.removeUnordered(e),0===r.length)for(let i=k.length-2;i>=0;i-=2){if(!b(k.data[i],k.data[i+1]))break}}function b(e,n){return n>=0&&(e.children[n]=null),!!j(e)&&(null===e.residents&&(e.residents=new t({shrink:!0})),!0)}function g(e,t){return z(t.bounds.center,2*-t.halfSize,P),z(t.bounds.center,2*t.halfSize,q),c(e.origin,e.direction,P,q)}function S(e,t,n){return z(t.bounds.center,2*-t.halfSize,P),z(t.bounds.center,2*t.halfSize,q),n.applyToMinMax(P,q),c(e.origin,e.direction,P,q)}function j(e){if(0!==e.terminals.length)return!1;if(null!==e.residents)return 0===e.residents.length;for(let t=0;t<e.children.length;t++)if(e.children[t])return!1;return!0}function x(e,t){e[0]=Math.min(e[0],t.center[0]-t.radius),e[1]=Math.min(e[1],t.center[1]-t.radius),e[2]=Math.min(e[2],t.center[2]-t.radius)}function O(e,t){e[0]=Math.max(e[0],t.center[0]+t.radius),e[1]=Math.max(e[1],t.center[1]+t.radius),e[2]=Math.max(e[2],t.center[2]+t.radius)}function z(e,t,n){n[0]=e[0]+t,n[1]=e[1]+t,n[2]=e[2]+t}function M(e,t,r){P[0]=1/0,P[1]=1/0,P[2]=1/0,q[0]=-1/0,q[1]=-1/0,q[2]=-1/0;for(const n of e){const e=t(n);A(e.radius)&&(x(P,e),O(q,e))}n(r.center,P,q,.5),r.radius=Math.max(q[0]-P[0],q[1]-P[1],q[2]-P[2])/2}function N(e,t,n){if(!J.length)for(let r=0;r<8;++r)J.push({index:0,distance:0});for(let r=0;r<8;++r){const n=w[r];J.data[r].index=r,J.data[r].distance=D(e,t,n)}J.sort((e,t)=>e.distance-t.distance);for(let r=0;r<8;++r)n[r]=J.data[r].index}function T(e,t){let n,r=1/0;for(let i=0;i<8;++i){const o=D(e,t,B[i]);o<r&&(r=o,n=B[i])}return n}function D(e,t,n){return t*(e[0]*n[0]+e[1]*n[1]+e[2]*n[2])}function A(e){return!isNaN(e)&&e!==-1/0&&e!==1/0&&e>0}const w=[s(-1,-1,-1),s(1,-1,-1),s(-1,1,-1),s(1,1,-1),s(-1,-1,1),s(1,-1,1),s(-1,1,1),s(1,1,1)],B=[s(-1,-1,-1),s(-1,-1,1),s(-1,1,-1),s(-1,1,1),s(1,-1,-1),s(1,-1,1),s(1,1,-1),s(1,1,1)],y=Math.sqrt(3),R=[null];function v(e){return R[0]=e,R}const F=new u,E=a(),P=a(),q=a(),k=new t,C=new u,I=new u,L=new u,H=[{min:0,max:0},{min:0,max:0},{min:0,max:0}],J=new t,W=[0,0,0,0,0,0,0,0];export{l as Octree};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{m as e,h as
|
|
5
|
+
import{m as e,h as r,d as t,n as s,e as a,b as i,j as o,g as n,t as l}from"../../../../chunks/vec32.js";import{ZEROS as u,create as c,fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{is3DGeometryOutputMRT as m,isShadowLikeOutput as p,isColor as d}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as f}from"../lib/GLTextureMaterial.js";import{Material as T}from"../lib/Material.js";import{intersectTriangleGeometry as x}from"../lib/RayIntersections.js";import{getVerticalOffsetObject3D as g}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as v}from"./DefaultBufferWriter.js";import{verticalOffsetAtDistance as S}from"./internal/MaterialUtil.js";import{getLayout as b,DefaultMaterialPassParameters as M,DefaultMaterialTechnique as O}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as C}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as w}from"../shaders/RealisticTreeTechnique.js";import{alphaCutoff as y}from"../../../../webscene/support/AlphaCutoff.js";class R extends T{constructor(e,r){super(e,D),this.materialType="default",this.supportsEdges=!0,this.intersectDraped=void 0,this.produces=new Map([[2,e=>(m(e)||p(e))&&!this.transparent],[4,e=>(m(e)||p(e))&&this.transparent&&this.parameters.writeDepth],[9,e=>(m(e)||p(e))&&this.transparent&&!this.parameters.writeDepth]]),this._layout=b(this.parameters),this._configuration=new C(r.spherical)}isVisibleForOutput(e){return 3!==e&&5!==e&&4!==e||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:r,opacity:t,externalColor:s}=this.parameters;return e*("replace"===r?1:t)*("ignore"===r||isNaN(s[3])?1:s[3])>=y}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveBaseColor,u)}get hasEmissions(){return this.parameters.emissiveStrength>0&&(0===this.parameters.emissiveSource&&this._hasEmissiveBase||1===this.parameters.emissiveSource)}getConfiguration(e,r){const{parameters:t,_configuration:s}=this,{treeRendering:a,doubleSided:i,doubleSidedType:o}=t;return super.getConfiguration(e,r,this._configuration),s.hasNormalTexture=t.hasNormalTexture,s.hasColorTexture=t.hasColorTexture,s.hasMetallicRoughnessTexture=t.hasMetallicRoughnessTexture,s.hasOcclusionTexture=t.hasOcclusionTexture,s.hasVertexTangents=!a&&t.hasVertexTangents,s.instanced=t.instanced,s.instancedDoublePrecision=t.instancedDoublePrecision,s.hasVVColor=!!t.vvColor,s.hasVVSize=!!t.vvSize,s.hasVerticalOffset=null!=t.verticalOffset,s.hasScreenSizePerspective=null!=t.screenSizePerspective,s.hasSlicePlane=t.hasSlicePlane,s.alphaDiscardMode=t.textureAlphaMode,s.normalType=a?0:t.normalType,s.transparent=this.transparent,s.writeDepth=t.writeDepth,s.customDepthTest=t.customDepthTest??0,s.hasOccludees=r.hasOccludees,s.cullFace=t.hasSlicePlane?0:t.cullFace,s.cullAboveTerrain=r.cullAboveTerrain,s.hasModelTransformation=!a&&null!=t.modelTransformation,s.hasVertexColors=t.hasVertexColors,s.hasSymbolColors=t.hasSymbolColors,s.doubleSidedMode=a?2:i&&"normal"===o?1:i&&"winding-order"===o?2:0,s.instancedFeatureAttribute=t.instancedFeatureAttribute,s.instancedColor=t.instancedColor,d(e)?(s.terrainDepthTest=r.terrainDepthTest,s.receiveShadows=t.receiveShadows,s.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&null!=r.ssao):(s.terrainDepthTest=!1,s.receiveShadows=s.receiveAmbientOcclusion=!1),s.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,s.pbrMode=t.usePBR?t.isSchematic?2:1:0,s.emissionSource=t.emissionSource,s.offsetBackfaces=!(!this.transparent||!t.offsetTransparentBackfaces),s.oitPass=r.oitPass,s.enableOffset=r.enableOffset,s.snowCover=r.snowCover>0,s.hasColorTextureTransform=!!t.colorTextureTransformMatrix,s.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,s.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,s.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,s.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix,s}intersect(e,u,c,h,m,p){if(null!=this.parameters.verticalOffset){const e=c.camera;r(N,u[12],u[13],u[14]);let p=null;switch(c.viewingMode){case 1:p=s(_,N);break;case 2:p=t(_,I)}const d=a(z,N,e.eye),f=i(d),T=o(d,d,1/f);let x=null;this.parameters.screenSizePerspective&&(x=n(p,T));const g=S(e,f,this.parameters.verticalOffset,x??0,this.parameters.screenSizePerspective,null);o(p,p,g),l(B,p,c.transform.inverseRotation),h=a(A,h,B),m=a(V,m,B)}x(e,c,h,m,g(c.verticalOffset),p)}createGLMaterial(e){return new P(e)}createBufferWriter(){return new v(this._layout)}get transparent(){return j(this.parameters)}}class P extends f{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const t=this._material.parameters;this.updateTexture(t.textureId);const s=e.camera.viewInverseTransposeMatrix;return r(t.origin,s[3],s[7],s[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?w:O,e)}}class D extends M{constructor(){super(...arguments),this.treeRendering=!1,this.hasVertexTangents=!1}get hasNormalTexture(){return!this.treeRendering&&!!this.normalTextureId}get hasColorTexture(){return!!this.textureId}get hasMetallicRoughnessTexture(){return!this.treeRendering&&!!this.metallicRoughnessTextureId}get hasOcclusionTexture(){return!this.treeRendering&&!!this.occlusionTextureId}get emissiveStrength(){return this.emissiveStrengthFromSymbol*this.emissiveStrengthKHR}get emissionSource(){return this.treeRendering?0:null!=this.emissiveTextureId&&0===this.emissiveSource?3:0===this.emissiveSource?2:1}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}}function j(e){const{drivenOpacity:r,opacity:t,externalColor:s,layerOpacity:a,texture:i,textureId:o,textureAlphaMode:n,colorMixMode:l}=e,u=s[3];return r||t<1&&"replace"!==l||u<1&&"ignore"!==l||a<1||(null!=i||null!=o)&&1!==n&&2!==n&&"replace"!==l}const A=c(),V=c(),I=h(0,0,1),_=c(),B=c(),N=c(),z=c();export{P as DefaultGLMaterial,R as DefaultMaterial,D as DefaultMaterialParameters,j as isTransparent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BreakpointOrientation, Breakpoints, BreakpointSize } from "./
|
|
1
|
+
import type { BreakpointOrientation, Breakpoints, BreakpointSize } from "./types.js";
|
|
2
2
|
|
|
3
3
|
export interface BreakpointsOwnerProperties extends Partial<Pick<BreakpointsOwner, "breakpoints" | "heightBreakpoint" | "widthBreakpoint">> {}
|
|
4
4
|
|
package/views/LinkChartView.d.ts
CHANGED
|
@@ -2,8 +2,7 @@ import type WebLinkChart from "../WebLinkChart.js";
|
|
|
2
2
|
import type View2D from "./View2D.js";
|
|
3
3
|
import type ColorBackground from "../webmap/background/ColorBackground.js";
|
|
4
4
|
import type { ScreenPoint } from "../core/types.js";
|
|
5
|
-
import type { HitTestOptions } from "./
|
|
6
|
-
import type { ViewHitTestResult } from "./types.js";
|
|
5
|
+
import type { HitTestOptions, ViewHitTestResult } from "./types.js";
|
|
7
6
|
import type { ColorBackgroundProperties } from "../webmap/background/ColorBackground.js";
|
|
8
7
|
import type { WebLinkChartProperties } from "../WebLinkChart.js";
|
|
9
8
|
import type { View2DProperties } from "./View2D.js";
|
package/views/MapView.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type View2D from "./View2D.js";
|
|
2
2
|
import type { ScreenPoint } from "../core/types.js";
|
|
3
|
-
import type { HitTestOptions } from "./
|
|
4
|
-
import type { ViewHitTestResult, Screenshot, UserSettings } from "./types.js";
|
|
3
|
+
import type { HitTestOptions, ViewHitTestResult, Screenshot, UserSettings } from "./types.js";
|
|
5
4
|
import type { View2DProperties } from "./View2D.js";
|
|
6
5
|
|
|
7
6
|
export interface MapViewProperties extends View2DProperties {}
|
package/views/SceneView.d.ts
CHANGED
|
@@ -22,9 +22,8 @@ import type { ResourceHandle } from "../core/Handles.js";
|
|
|
22
22
|
import type { ScreenPoint } from "../core/types.js";
|
|
23
23
|
import type { BreakpointsOwner, BreakpointsOwnerProperties } from "./BreakpointsOwner.js";
|
|
24
24
|
import type { DOMContainer, DOMContainerProperties } from "./DOMContainer.js";
|
|
25
|
-
import type { HitTestOptions3D } from "./HitTestItem3D.js";
|
|
26
25
|
import type { PopupView, PopupViewProperties } from "./PopupView.js";
|
|
27
|
-
import type { SceneViewHitTestResult, GoToTarget3D, GoToOptions3D, UserSettings as ScreenshotUserSettings, Screenshot } from "./types.js";
|
|
26
|
+
import type { HitTestOptions3D, SceneViewHitTestResult, GoToTarget3D, GoToOptions3D, UserSettings as ScreenshotUserSettings, Screenshot } from "./types.js";
|
|
28
27
|
import type { LayerView3DFor } from "./3d/types.js";
|
|
29
28
|
import type { AnalysisView3DFor } from "./3d/analysis/types.js";
|
|
30
29
|
import type { Constraints, ConstraintsProperties } from "./3d/constraints/Constraints.js";
|
package/views/View.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ import type { ReadonlyArrayOrCollection, ReadonlyCollection } from "../core/Coll
|
|
|
18
18
|
import type { EventedMixin, EventedMixinProperties } from "../core/Evented.js";
|
|
19
19
|
import type { EsriPromise, EsriPromiseMixinProperties } from "../core/Promise.js";
|
|
20
20
|
import type { SpatialReferenceProperties } from "../geometry/SpatialReference.js";
|
|
21
|
-
import type { SceneViewEventTypes } from "./
|
|
21
|
+
import type { SceneViewEventTypes } from "./types.js";
|
|
22
22
|
import type { Padding } from "./ui/types.js";
|
|
23
23
|
import type { GraphicProperties } from "../Graphic.js";
|
|
24
24
|
import type { HighlightOptionsProperties } from "./support/HighlightOptions.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EventNames } from "../core/Evented.js";
|
|
2
2
|
import type { ResourceHandle } from "../core/Handles.js";
|
|
3
|
-
import type { SceneViewEventTypes } from "./
|
|
3
|
+
import type { SceneViewEventTypes } from "./types.js";
|
|
4
4
|
|
|
5
5
|
export interface Viewport2DMixinProperties {}
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type DrawAction from "./DrawAction.js";
|
|
2
|
-
import type { CursorUpdateEvent } from "./input/
|
|
2
|
+
import type { CursorUpdateEvent } from "./input/CursorUpdateEvent.js";
|
|
3
3
|
import type { DrawCompleteEvent } from "./input/DrawCompleteEvent.js";
|
|
4
4
|
import type { VertexAddEvent } from "./input/VertexAddEvent.js";
|
|
5
5
|
import type { VertexRemoveEvent } from "./input/VertexRemoveEvent.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{subclass as t}from"../../core/accessorSupport/decorators.js";import i from"../../geometry/Point.js";import o from"./DrawAction.js";import{CursorUpdateEvent as r}from"./input/
|
|
5
|
+
import{__decorate as e}from"tslib";import{subclass as t}from"../../core/accessorSupport/decorators.js";import i from"../../geometry/Point.js";import o from"./DrawAction.js";import{CursorUpdateEvent as r}from"./input/CursorUpdateEvent.js";import{DrawCompleteEvent as s}from"./input/DrawCompleteEvent.js";import{VertexAddEvent as n}from"./input/VertexAddEvent.js";import{VertexRemoveEvent as a}from"./input/VertexRemoveEvent.js";import{ViewEventPriorities as d}from"../input/InputManager.js";import{sketchKeys as p}from"../interactive/keybindings.js";import{createScreenPointFromEvent as h}from"../support/screenUtils.js";const l=Symbol("view-handles"),c=Symbol("undo-redo-handles");let _=class extends o{constructor(e){super(e),this._popVertexOnPointerMove=!1,this._addVertexOnPointerUp=!1}initialize(){this._addViewHandles(),this._addUndoRedoHandles()}destroy(){this._removeViewHandles(),this._removeUndoRedoHandles(),this.emit("destroy")}undo(){super.undo(),this.notifyChange("vertices")}redo(){super.redo(),this.notifyChange("vertices")}complete(){this._completeDrawing()}_addViewHandles(){this._removeViewHandles(),this.addHandles([this.view.on("click",e=>{e.stopPropagation()},d.TOOL),this.view.on("pointer-down",e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._activePointerId=e.pointerId,this._addVertexOnPointerUp=!0,this._cursorScreenPoint=h(e),"touch"===e.pointerType&&this._updateCursor())},d.TOOL),this.view.on("pointer-move",e=>{this._popVertexOnPointerMove&&(this.undo(),this._popVertexOnPointerMove=!1),this._abortSnapping(),this._cursorScreenPoint=h(e),"touch"!==e.pointerType&&this._updateCursor()},d.TOOL),this.view.on("pointer-drag",e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._addVertexOnPointerUp=!1)},d.TOOL),this.view.on("pointer-up",e=>{if(this._shouldHandlePointerEvent(e)){if(this._abortSnapping(),this._activePointerId=null,!this._addVertexOnPointerUp){const t="touch"===e.pointerType;return void this._updateCursor(t)}this._vertexAddHandler(e)}},d.TOOL),this.view.on("drag",["Shift"],e=>{e.stopPropagation()},d.TOOL),this.view.on("double-click",e=>{e.stopPropagation(),this._drawCompleteHandler(e)},d.TOOL),this.view.on("double-click",["Control"],e=>{e.stopPropagation(),this._drawCompleteHandler(e)},d.TOOL),this.view.on("key-down",e=>{const{key:t,repeat:i}=e;t===p.vertexAdd&&!i&&this._cursorScreenPoint?(e.stopPropagation(),this._abortSnapping(),this._vertexAddHandler(e)):t!==p.complete||i?t!==p.undo||this.interactiveUndoDisabled||i?t!==p.redo||this.interactiveUndoDisabled||i?t!==p.pan||i||e.stopPropagation():(e.stopPropagation(),this.redo()):(e.stopPropagation(),this.undo()):(e.stopPropagation(),this._drawCompleteHandler(e))},d.TOOL),this.view.on("key-up",e=>{e.key===p.pan&&e.stopPropagation()},d.TOOL)],l)}_addUndoRedoHandles(){this._removeUndoRedoHandles(),this.addHandles([this._editGeometryOperations.on("vertex-remove",e=>{if(this.notifyChange("vertices"),"undo"===e.operation){const t=[...this._committedVertices];null!=this._stagedVertex&&t.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("undo",new a(this.view,e.vertices[0].index,t))}}),this._editGeometryOperations.on("vertex-add",e=>{if(this.notifyChange("vertices"),"apply"===e.operation){const e=this._committedVertices.length-1,t=new n(this.view,e,this.vertices);this.emit("vertex-add",t),t.defaultPrevented&&(this._popVertexOnPointerMove=!0)}else if("redo"===e.operation){const t=[...this._committedVertices];null!=this._stagedVertex&&t.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("redo",new n(this.view,e.vertices[0].index,t))}})],c)}_removeViewHandles(){this.removeHandles(l)}_removeUndoRedoHandles(){this.removeHandles(c)}_addVertex(e){const t=this._coordinateHelper.arrayToVector(e);this._isDuplicateOfLastVertex(t)||this._editGeometryOperations.appendVertexToFirstPart(t)}_updateCursor(e=!1){if(this._popCursorVertex(),!this._cursorScreenPoint)return;const t=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);null==t||e||this._pushCursorVertex(t.vertex,()=>this.emit("cursor-update",new r(this.view,this._activeComponent.vertices.length,this.vertices,null!=this._stagedVertex?new i(this._stagedVertex):null)))}_completeDrawing(){if(this._activePointerId=null,this._popCursorVertex(),this._abortSnapping(),null!=this._snappingManager&&this._snappingManager.doneSnapping(),this.vertices.length<1)return;const e=new s(this.vertices);this.emit("draw-complete",e),e.defaultPrevented||this._removeViewHandles()}};_=e([t("esri.views.draw.MultipointDrawAction")],_);const u=_;export{u as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type DrawAction from "./DrawAction.js";
|
|
2
|
-
import type { CursorUpdateEvent } from "./input/
|
|
2
|
+
import type { CursorUpdateEvent } from "./input/CursorUpdateEvent.js";
|
|
3
3
|
import type { DrawCompleteEvent } from "./input/DrawCompleteEvent.js";
|
|
4
4
|
import type { DrawActionProperties } from "./DrawAction.js";
|
|
5
5
|
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{subclass as e}from"../../core/accessorSupport/decorators.js";import i from"../../geometry/Point.js";import o from"./DrawAction.js";import{CursorUpdateEvent as r}from"./input/
|
|
5
|
+
import{__decorate as t}from"tslib";import{subclass as e}from"../../core/accessorSupport/decorators.js";import i from"../../geometry/Point.js";import o from"./DrawAction.js";import{CursorUpdateEvent as r}from"./input/CursorUpdateEvent.js";import{DrawCompleteEvent as s}from"./input/DrawCompleteEvent.js";import{ViewEventPriorities as n}from"../input/InputManager.js";import{sketchKeys as a}from"../interactive/keybindings.js";import{loadAutomaticLengthMeasurementUtils as d}from"../support/automaticLengthMeasurementUtils.js";import{createScreenPointFromEvent as p}from"../support/screenUtils.js";let h=class extends o{constructor(t){super(t),this._addVertexOnPointerUp=!1,this._drawTool=null}initialize(){this._addViewHandles(),"3d"===this.view.type&&this.addResolvingPromise(this._addDrawTool())}destroy(){this._removeDrawTool(),this.emit("destroy")}complete(){this._completeDrawing()}_addViewHandles(){this._addViewHandles2DOnly(),this.addHandles([this.view.on("key-down",t=>{t.key===a.complete&&(this._drawTool?this.complete():(this._abortSnapping(),this._vertexAddHandler(t)))},n.TOOL)])}_addViewHandles2DOnly(){"2d"===this.view.type&&this.addHandles([this.view.on("pointer-down",t=>{this._shouldHandlePointerEvent(t)&&(this._abortSnapping(),this._activePointerId=t.pointerId,this._addVertexOnPointerUp=!0,this._cursorScreenPoint=p(t),"touch"===t.pointerType&&this._updateCursor())},n.TOOL),this.view.on("pointer-move",t=>{this._abortSnapping(),this._cursorScreenPoint=p(t),"touch"!==t.pointerType&&this._updateCursor()},n.TOOL),this.view.on("pointer-drag",t=>{this._shouldHandlePointerEvent(t)&&(this._abortSnapping(),this._addVertexOnPointerUp=!1)},n.TOOL),this.view.on("pointer-up",t=>{if(this._shouldHandlePointerEvent(t)){if(this._abortSnapping(),this._activePointerId=null,!this._addVertexOnPointerUp){const e="touch"===t.pointerType;return void this._updateCursor(e)}t.stopPropagation(),this._vertexAddHandler(t)}},n.TOOL),this.view.on("drag",["Shift"],t=>{t.stopPropagation()},n.TOOL)])}async _addDrawTool(){const[{LegacyDrawTool:t},e]=await Promise.all([import("./LegacyDrawTool.js"),d()]),i=new t({view:this.view,elevationInfo:this.elevationInfo,hasZ:this.hasZ,geometryType:"point",mode:"click",automaticLengthMeasurementUtils:e});this.destroyed?i.destroy():(this._drawTool=i,this.view.addAndActivateTool(i),this.addHandles([i.on("cursor-update",t=>{1===t.vertices.length&&this.emit("cursor-update",new r(this.view,t.vertices[0].vertexIndex,i.getVertexCoords()))}),i.on("complete",t=>{this.emit("draw-complete",new s(i.getVertexCoords())),this._removeDrawTool(),this.removeAllHandles()})]))}_removeDrawTool(){this._drawTool&&(this.view.tools.remove(this._drawTool),this._drawTool=null)}_addVertex(t){const e=this._coordinateHelper.arrayToVector(t);this._isDuplicateOfLastVertex(e)||(this._lastVertexUnsnapped=this._stagedVertexUnsnapped,this._popCursorVertex(),this._editGeometryOperations.appendVertexToFirstPart(e),this.notifyChange("vertices"),this._completeDrawing())}_updateCursor(t=!1){if(this._popCursorVertex(),!this._cursorScreenPoint)return;const e=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);null==e||t||this._pushCursorVertex(e.vertex,()=>this.emit("cursor-update",new r(this.view,this._activeComponent.vertices.length,this.vertices,null!=this._stagedVertex?new i(this._stagedVertex):null)))}_completeDrawing(){if(this._drawTool)return void this._drawTool.completeCreateOperation();this._activePointerId=null,this._popCursorVertex(),this._abortSnapping(),null!=this._snappingManager&&this._snappingManager.doneSnapping();const t=new s(this.vertices);this.emit("draw-complete",t),t.defaultPrevented||this.removeAllHandles()}};h=t([e("esri.views.draw.PointDrawAction")],h);const l=h;export{l as default};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type DrawAction from "./DrawAction.js";
|
|
2
2
|
import type { DrawingMode } from "./types.js";
|
|
3
|
-
import type { CursorUpdateEvent } from "./input/
|
|
3
|
+
import type { CursorUpdateEvent } from "./input/CursorUpdateEvent.js";
|
|
4
4
|
import type { DrawCompleteEvent } from "./input/DrawCompleteEvent.js";
|
|
5
5
|
import type { VertexAddEvent } from "./input/VertexAddEvent.js";
|
|
6
6
|
import type { VertexRemoveEvent } from "./input/VertexRemoveEvent.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{property as t,subclass as i}from"../../core/accessorSupport/decorators.js";import o from"../../geometry/Point.js";import r from"./DrawAction.js";import{drawingModes as s,defaultDrawingMode as n}from"./drawingModes.js";import{CursorUpdateEvent as a}from"./input/
|
|
5
|
+
import{__decorate as e}from"tslib";import{property as t,subclass as i}from"../../core/accessorSupport/decorators.js";import o from"../../geometry/Point.js";import r from"./DrawAction.js";import{drawingModes as s,defaultDrawingMode as n}from"./drawingModes.js";import{CursorUpdateEvent as a}from"./input/CursorUpdateEvent.js";import{DrawCompleteEvent as d}from"./input/DrawCompleteEvent.js";import{VertexAddEvent as h}from"./input/VertexAddEvent.js";import{VertexRemoveEvent as p}from"./input/VertexRemoveEvent.js";import{ViewEventPriorities as l}from"../input/InputManager.js";import{sketchKeys as c}from"../interactive/keybindings.js";import{loadAutomaticLengthMeasurementUtils as _}from"../support/automaticLengthMeasurementUtils.js";import{createScreenPointFromEvent as v}from"../support/screenUtils.js";let u=class extends r{constructor(e){super(e),this._panEnabled=!1,this._popVertexOnPointerMove=!1,this._addVertexOnPointerUp=!1,this._drawTool=null,this.mode=n}initialize(){this._addViewHandles(),"3d"===this.view.type&&this.addResolvingPromise(this._addDrawTool())}destroy(){this._removeDrawTool(),this.emit("destroy")}get _dragEnabled(){return"freehand"===this.mode||"hybrid"===this.mode}get _clickEnabled(){return"click"===this.mode||"hybrid"===this.mode}undo(){this._drawTool?this._drawTool.undo():(super.undo(),this.notifyChange("vertices"))}redo(){this._drawTool?this._drawTool.redo():(super.redo(),this.notifyChange("vertices"))}canUndo(){return this._drawTool?.canUndo()??super.canUndo()}canRedo(){return this._drawTool?.canRedo()??super.canRedo()}complete(){this._completeDrawing()}_getGeometryZValue(){return this.hasZ&&this.vertices.length>0?this.vertices[0][2]:this.defaultZ}_addViewHandles(){this._addViewHandles2DOnly(),this.addHandles(this.view.on("key-down",e=>{const{key:t,repeat:i}=e;t!==c.vertexAdd||i?t!==c.complete||i?t!==c.undo||this.interactiveUndoDisabled||i?t!==c.redo||this.interactiveUndoDisabled||i||(e.stopPropagation(),this.redo()):(e.stopPropagation(),this.undo()):(e.stopPropagation(),this._drawCompleteHandler(e)):(e.stopPropagation(),this._handleVertexAddKey(e))},l.TOOL))}_addViewHandles2DOnly(){"2d"===this.view.type&&(this.addHandles([this.view.on("click",e=>{e.stopPropagation()},l.TOOL),this.view.on("pointer-down",e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._activePointerId=e.pointerId,this._addVertexOnPointerUp=!0,this._cursorScreenPoint=v(e),"touch"===e.pointerType&&this._updateCursor())},l.TOOL),this.view.on("pointer-move",e=>{this._abortSnapping(),this._popVertexOnPointerMove&&(this.undo(),this._popVertexOnPointerMove=!1),this._cursorScreenPoint=v(e),"touch"!==e.pointerType&&this._updateCursor()},l.TOOL),this.view.on("pointer-drag",e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._cursorScreenPoint=v(e),this._dragEnabled&&!this._panEnabled?this._vertexAddHandler(e):this._addVertexOnPointerUp=!1)},l.TOOL),this.view.on("pointer-up",e=>{if(this._shouldHandlePointerEvent(e)){if(this._abortSnapping(),this._activePointerId=null,!this._addVertexOnPointerUp){const t="touch"===e.pointerType;return void this._updateCursor(t)}if(!this._clickEnabled)return 1===this.vertices.length&&this.vertices.pop(),void this._drawCompleteHandler(e);this._vertexAddHandler(e)}},l.TOOL),this.view.on("drag",e=>{this._dragEnabled&&null!=this._activePointerId&&!this._panEnabled&&e.stopPropagation()},l.TOOL),this.view.on("drag",["Shift"],e=>{e.stopPropagation()},l.TOOL),this.view.on("double-click",e=>{e.stopPropagation(),this._drawCompleteHandler(e)},l.TOOL),this.view.on("double-click",["Control"],e=>{e.stopPropagation(),this._drawCompleteHandler(e)},l.TOOL),this.view.on("key-down",e=>{const{key:t,repeat:i}=e;t!==c.pan||i||(e.stopPropagation(),this._panEnabled=!0)},l.TOOL),this.view.on("key-up",e=>{e.key===c.pan&&(e.stopPropagation(),this._panEnabled=!1)},l.TOOL)]),this._addUndoRedoHandles())}_handleVertexAddKey(e){this._drawTool?this._drawTool.drawOperation.commitStagedVertex():this._cursorScreenPoint&&(this._abortSnapping(),this._vertexAddHandler(e))}_addUndoRedoHandles(){this.addHandles([this._editGeometryOperations.on("vertex-remove",e=>{if(this.notifyChange("vertices"),"undo"===e.operation){const t=[...this._committedVertices];null!=this._stagedVertex&&t.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("undo",new p(this.view,e.vertices[0].index,t))}}),this._editGeometryOperations.on("vertex-add",e=>{if(this.notifyChange("vertices"),"apply"===e.operation){const e=this._committedVertices.length-1,t=new h(this.view,e,this.vertices);this.emit("vertex-add",t),t.defaultPrevented&&(this._popVertexOnPointerMove=!0)}else if("redo"===e.operation){const t=[...this._committedVertices];null!=this._stagedVertex&&t.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("redo",new h(this.view,e.vertices[0].index,t))}})])}async _addDrawTool(){const[{LegacyDrawTool:e},t]=await Promise.all([import("./LegacyDrawTool.js"),_()]),i=new e({view:this.view,elevationInfo:this.elevationInfo,hasZ:this.hasZ,geometryType:"polygon",mode:this.mode,automaticLengthMeasurementUtils:t});this.destroyed?i.destroy():(this._drawTool=i,this.view.addAndActivateTool(i),i.on("vertex-add",e=>{if(1===e.vertices.length){const{view:t}=this,o=e.vertices[0].vertexIndex,r=i.getVertexCoords();this.emit("vertex-add",new h(t,o,r)),"undo"!==e.operation&&"redo"!==e.operation||this.emit(e.operation,new h(t,o,r))}}),i.on("vertex-remove",e=>{if(1===e.vertices.length){const{view:t}=this,o=e.vertices[0].vertexIndex,r=i.getVertexCoords();this.emit("vertex-remove",new p(t,o,r)),"undo"!==e.operation&&"redo"!==e.operation||this.emit(e.operation,new p(t,o,r))}}),i.on("cursor-update",e=>{1===e.vertices.length&&this.emit("cursor-update",new a(this.view,e.vertices[0].vertexIndex,i.getVertexCoords()))}),i.on("complete",e=>{this.emit("draw-complete",new d(i.getVertexCoords())),this._removeDrawTool(),this.removeAllHandles()}))}_removeDrawTool(){this._drawTool&&(this.view.tools.remove(this._drawTool),this._drawTool=null)}_addVertex(e){const t=this._coordinateHelper.arrayToVector(e);this._isDuplicateOfLastVertex(t)||(this._lastVertexUnsnapped=this._stagedVertexUnsnapped,this._popCursorVertex(),this._editGeometryOperations.appendVertexToFirstPart(t))}_updateCursor(e=!1){if(this._popCursorVertex(),!this._cursorScreenPoint)return;const t=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);null==t||e||this._pushCursorVertex(t.vertex,()=>this.emit("cursor-update",new a(this.view,this._activeComponent.vertices.length,this.vertices,null!=this._stagedVertex?new o(this._stagedVertex):null)))}_completeDrawing(){if(this._drawTool)return void this._drawTool.completeCreateOperation();if(this._activePointerId=null,this._popCursorVertex(),this._committedVertices.length<3)return;this._abortSnapping(),null!=this._snappingManager&&this._snappingManager.doneSnapping();const e=new d(this.vertices);this.emit("draw-complete",e),e.defaultPrevented||this.removeAllHandles()}};e([t()],u.prototype,"_dragEnabled",null),e([t()],u.prototype,"_clickEnabled",null),e([t({type:s})],u.prototype,"mode",void 0),u=e([i("esri.views.draw.PolygonDrawAction")],u);const m=u;export{m as default};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type DrawAction from "./DrawAction.js";
|
|
2
2
|
import type { DrawingMode } from "./types.js";
|
|
3
|
-
import type { CursorUpdateEvent } from "./input/
|
|
3
|
+
import type { CursorUpdateEvent } from "./input/CursorUpdateEvent.js";
|
|
4
4
|
import type { DrawCompleteEvent } from "./input/DrawCompleteEvent.js";
|
|
5
5
|
import type { VertexAddEvent } from "./input/VertexAddEvent.js";
|
|
6
6
|
import type { VertexRemoveEvent } from "./input/VertexRemoveEvent.js";
|