@arcgis/core 6.0.0-next.14 → 6.0.0-next.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analysis/LineOfSightAnalysis.d.ts +49 -32
- package/analysis/LineOfSightAnalysisObserver.d.ts +19 -3
- package/analysis/LineOfSightAnalysisTarget.d.ts +19 -3
- package/analysis/Viewshed.d.ts +23 -3
- package/analysis/ViewshedAnalysis.d.ts +33 -13
- package/arcade/geometry/operatorsWorkerConnection.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/00d66e3fba5ab4d2aa3c.js +1 -0
- package/assets/esri/core/workers/chunks/{d994bcf0a65d1c07160f.js → 0320cbd825f9a4222042.js} +1 -1
- package/assets/esri/core/workers/chunks/08fe248e412bb170210d.js +1 -0
- package/assets/esri/core/workers/chunks/{fb444954be74c1962ced.js → 10d80e793019dfb45ca2.js} +1 -1
- package/assets/esri/core/workers/chunks/14d5d219e7fe017f23f0.js +1 -0
- package/assets/esri/core/workers/chunks/164e74d586297946a717.js +1 -0
- package/assets/esri/core/workers/chunks/{1bca39e0e651426bdbb5.js → 1b1d3f6916d2cb751435.js} +1 -1
- package/assets/esri/core/workers/chunks/{ed6e9d7f71bfd2691717.js → 1c77de1e79860f8d2228.js} +1 -1
- package/assets/esri/core/workers/chunks/1e40a26dcce4d1dadc28.js +1 -0
- package/assets/esri/core/workers/chunks/237a1f68a0efbfe5b77c.js +1 -0
- package/assets/esri/core/workers/chunks/23c43f09c4a4749516e1.js +1 -0
- package/assets/esri/core/workers/chunks/{3418877328f4f0830300.js → 24dac4970526a4e0ae63.js} +1 -1
- package/assets/esri/core/workers/chunks/26ceb0ff8d93dbb9b84f.js +1 -0
- package/assets/esri/core/workers/chunks/2acf2952cef69e382a35.js +1 -0
- package/assets/esri/core/workers/chunks/{481589c3eddad6e026ad.js → 369780276b2755361f7d.js} +1 -1
- package/assets/esri/core/workers/chunks/{4df6cb1bee5d0720a43e.js → 36cbd614454581aaf334.js} +1 -1
- package/assets/esri/core/workers/chunks/{1e0d2715d603f48a7e0b.js → 370aad23df597db80d65.js} +1 -1
- package/assets/esri/core/workers/chunks/3baa4a9c52f41bfd6abb.js +1 -0
- package/assets/esri/core/workers/chunks/42d44c7d532df5ee70e9.js +1 -0
- package/assets/esri/core/workers/chunks/42e985a576d7aaeed0cf.js +1 -0
- package/assets/esri/core/workers/chunks/{6400446b7615b97c3521.js → 45f826554499c38968c6.js} +1 -1
- package/assets/esri/core/workers/chunks/48cc58890fddbcf69cef.js +1 -0
- package/assets/esri/core/workers/chunks/494bd434fee9032e1d02.js +1 -0
- package/assets/esri/core/workers/chunks/{33e4ff228a8c81b99022.js → 4abd3753cd9b80e4d937.js} +1 -1
- package/assets/esri/core/workers/chunks/4bbe1f28f5f16a6bef05.js +1 -0
- package/assets/esri/core/workers/chunks/4c389472b8cdb0c55154.js +1 -0
- package/assets/esri/core/workers/chunks/4e4f747de424941a0bfa.js +1 -0
- package/assets/esri/core/workers/chunks/5529831dd891382c79df.js +1 -0
- package/assets/esri/core/workers/chunks/5736feefa261589b6273.js +1 -0
- package/assets/esri/core/workers/chunks/576248e9ae2654569420.js +1 -0
- package/assets/esri/core/workers/chunks/5acb422fe3cf693d9d4f.js +1 -0
- package/assets/esri/core/workers/chunks/{aeaaff7a4b1a99540f52.js → 5cb26bbaa08114aec5ce.js} +1 -1
- package/assets/esri/core/workers/chunks/661c6324529dd17b297e.js +1 -0
- package/assets/esri/core/workers/chunks/68dd1fd2025c7125ead1.js +1 -0
- package/assets/esri/core/workers/chunks/{89e76de5ae3328d821a4.js → 69f6d5997b8ff1326e39.js} +1 -1
- package/assets/esri/core/workers/chunks/6a8dd8b18b0b825b0c1b.js +1 -0
- package/assets/esri/core/workers/chunks/{a40b6d8b5c73e06e14d4.js → 6c255c029d67423e4dac.js} +1 -1
- package/assets/esri/core/workers/chunks/7446d0dfebf93e86c098.js +1 -0
- package/assets/esri/core/workers/chunks/{688f2dbf784e66082308.js → 74c866e0b66e61751861.js} +1 -1
- package/assets/esri/core/workers/chunks/{3ffda5bf0b91700dc308.js → 78643f116677950ea29a.js} +1 -1
- package/assets/esri/core/workers/chunks/{916b363c342b61ba5461.js → 787c1a8bda7d745633f2.js} +1 -1
- package/assets/esri/core/workers/chunks/7b5f3c79e0605c32b267.js +1 -0
- package/assets/esri/core/workers/chunks/7bbfe9ff352afc566367.js +1 -0
- package/assets/esri/core/workers/chunks/{ac5a6603f7fa78d3e4c8.js → 7e8611cb709f105946f5.js} +1 -1
- package/assets/esri/core/workers/chunks/{05cd33d41d91f8d09633.js → 7fb7493f483cd9878bfa.js} +1 -1
- package/assets/esri/core/workers/chunks/{acfa03c65ba3ca6c5685.js → 8715661a838361d4211a.js} +1 -1
- package/assets/esri/core/workers/chunks/{601e1d020b8115497944.js → 8a485130781b49dbf608.js} +1 -1
- package/assets/esri/core/workers/chunks/{0ccab50877b24f862d6e.js → 8ac2098ecdc40ad41055.js} +1 -1
- package/assets/esri/core/workers/chunks/{a655ebdb4bf0660615a2.js → 8b4e9fd88c0c313416d4.js} +1 -1
- package/assets/esri/core/workers/chunks/{4e544de61f07ca660236.js → 8c12269d26f5a4c753cb.js} +1 -1
- package/assets/esri/core/workers/chunks/8e19629899a5becf8e19.js +1 -0
- package/assets/esri/core/workers/chunks/91dd65cf877c8f2e01a7.js +1 -0
- package/assets/esri/core/workers/chunks/{46b4fb6a7fe4877b0efc.js → 94baa354e50c03b82b25.js} +2 -2
- package/assets/esri/core/workers/chunks/950d4578dc450467404c.js +1 -0
- package/assets/esri/core/workers/chunks/{68be3fb88ca61f82fb90.js → 95dbbddac6581b9d671f.js} +1 -1
- package/assets/esri/core/workers/chunks/98be2f621801e230aa01.js +1 -0
- package/assets/esri/core/workers/chunks/9b051745d24d1f43480b.js +1 -0
- package/assets/esri/core/workers/chunks/9d61740ef8bdcc162be1.js +1 -0
- package/assets/esri/core/workers/chunks/{eb04e1717a1002cda3ab.js → 9f06ec95bdf0d0b52b41.js} +1 -1
- package/assets/esri/core/workers/chunks/{fafb92ca2c5e4b0b2c23.js → a09d2e1e2540921e4717.js} +1 -1
- package/assets/esri/core/workers/chunks/{3b3e519f15ed52c83f0c.js → a49fe94933b65b4b64f8.js} +1 -1
- package/assets/esri/core/workers/chunks/{1819c45655c836b9a8d7.js → a4d3944700f1cc240176.js} +1 -1
- package/assets/esri/core/workers/chunks/{90bdf86f553e2742d67c.js → a7bd5ba4d7d97411fd33.js} +1 -1
- package/assets/esri/core/workers/chunks/{900181f68449d8f82eeb.js → aa1ac7954e4f0fefe15b.js} +1 -1
- package/assets/esri/core/workers/chunks/ac24b4370dc7194a3107.js +1 -0
- package/assets/esri/core/workers/chunks/{b8337492e2b753aefac4.js → ace41659a5ca0e5abfc3.js} +1 -1
- package/assets/esri/core/workers/chunks/{3c0ed15b544df6fb0903.js → b48952e1fb4cb7360dd0.js} +1 -1
- package/assets/esri/core/workers/chunks/b5e7475cc5fbf31289d3.js +1 -0
- package/assets/esri/core/workers/chunks/{f3da30d7300b92bd8bb0.js → befa32b9e7b3fbdd431e.js} +1 -1
- package/assets/esri/core/workers/chunks/{0f617980c7dd9ad0444f.js → bf35927979fc5e7e0478.js} +1 -1
- package/assets/esri/core/workers/chunks/c4ddac23bd649d24f3f2.js +1 -0
- package/assets/esri/core/workers/chunks/{4e6f40cbdb8c508e6df1.js → c5a9e77977e867a75ff2.js} +1 -1
- package/assets/esri/core/workers/chunks/{25f19fc929f25ddd628c.js → c79934cd6883307203f8.js} +1 -1
- package/assets/esri/core/workers/chunks/cddc3e285f763ccf33c2.js +1 -0
- package/assets/esri/core/workers/chunks/d08ff41e2a9bcd58b64a.js +1 -0
- package/assets/esri/core/workers/chunks/d311ff96a5a2791d8cfc.js +1 -0
- package/assets/esri/core/workers/chunks/d62afb71f4ece4283994.js +1 -0
- package/assets/esri/core/workers/chunks/dc1761cba0454fda3cf9.js +1 -0
- package/assets/esri/core/workers/chunks/{4ac1d3e49e242e373a92.js → e0650b1408197d3ac862.js} +1 -1
- package/assets/esri/core/workers/chunks/{3ff6d1ed3c0f1285f3e7.js → e0d9dc97985561320bd4.js} +1 -1
- package/assets/esri/core/workers/chunks/eaddffcc7004101fc230.js +1 -0
- package/assets/esri/core/workers/chunks/eb2652ec48faa78de3c5.js +1 -0
- package/assets/esri/core/workers/chunks/eca44e53bcee9b08d70a.js +1 -0
- package/assets/esri/core/workers/chunks/f00458654c7c34c369ef.js +1 -0
- package/assets/esri/core/workers/chunks/f3cd610084e3f4d8656b.js +1 -0
- package/assets/esri/core/workers/chunks/f47fe4433b05fca5c3ad.js +1 -0
- package/assets/esri/core/workers/chunks/f7bfa3d33b05b250ce33.js +1 -0
- package/assets/esri/core/workers/chunks/f91bc1cb1014e05be763.js +1 -0
- package/assets/esri/core/workers/chunks/{aadfe34a99c9ec7a0e11.js → f9c5aa0bbf23e780fecc.js} +1 -1
- package/assets/esri/core/workers/chunks/f9ff27cfcf0538ac5e26.js +1 -0
- package/assets/esri/core/workers/chunks/{19676b2c5f8b0a5ee680.js → facd1ff23203fed67686.js} +1 -1
- package/assets/esri/core/workers/chunks/{40a584cb952e94326e9e.js → fcb86d24fc7e0666b564.js} +1 -1
- package/assets/esri/libs/pdfjs/wasm/openjpeg_nowasm_fallback.js +1 -0
- package/chunks/Distance2DCalculator-DjIp2uQi.js +1 -1
- package/chunks/Envelope.js +1 -1
- package/chunks/MultiPathImpl.js +1 -1
- package/chunks/OperatorGeodeticArea.js +1 -1
- package/chunks/OperatorShapePreservingLength.js +1 -1
- package/chunks/OperatorShapePreservingProject.js +1 -1
- package/chunks/UnitFactory.js +1 -1
- package/chunks/basis_encoder.js +1 -1
- package/chunks/basis_transcoder.js +1 -1
- package/chunks/index.js +1 -1
- package/chunks/lclayout.js +1 -1
- package/config.d.ts +2 -0
- package/config.js +1 -1
- package/core/ObjectPool.js +1 -1
- package/core/PooledArray.js +1 -1
- package/core/accessorSupport/DefaultsStore.js +1 -1
- package/core/accessorSupport/MultiOriginStore.js +1 -1
- package/core/accessorSupport/Store.js +1 -1
- package/core/accessorSupport/decorators/reader.js +1 -1
- package/core/accessorSupport/decorators/writer.js +1 -1
- package/core/accessorSupport/tracking/SimpleTrackingTarget.js +1 -1
- package/core/workers/WorkerOwner.js +1 -1
- package/core/workers/workerFactory.js +1 -1
- package/core/workers/workers.js +2 -2
- package/core/workers.d.ts +9 -0
- package/form/elements/inputs/DynamicChoiceInput.d.ts +4 -2
- package/geometry/Mesh.js +1 -1
- package/geometry/operators/gx/operatorAlphaShape.js +1 -1
- package/geometry/operators/gx/operatorOffset.js +1 -1
- package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
- package/geometry/operators/support/jsonConverter.js +1 -1
- package/geometry/support/buffer/BufferPool.js +1 -1
- package/geometry/support/coordsUtils.js +1 -1
- package/geometry/support/curves/bezierCurveUtils.js +1 -1
- package/geometry/support/curves/ellipticArc7Utils.js +1 -1
- package/geometry/support/meshUtils/merge.js +1 -1
- package/geometry/support/meshUtils/rotate.js +1 -1
- package/geometry/support/meshUtils.d.ts +5 -6
- package/geometry/support/polygonExtentClipping.js +1 -1
- package/identity/Credential.js +1 -1
- package/interfaces.d.ts +18 -9
- package/kernel.js +1 -1
- package/layers/AnnotationFeatureLayer.d.ts +2 -2
- package/layers/AnnotationFeatureLayer.js +1 -1
- package/layers/CatalogLayer.d.ts +2 -2
- package/layers/CatalogLayer.js +1 -1
- package/layers/DimensionFeatureLayer.d.ts +2 -2
- package/layers/DimensionFeatureLayer.js +1 -1
- package/layers/FeatureLayer.d.ts +4 -4
- package/layers/FeatureLayer.js +1 -1
- package/layers/GeospatialPDFLayer.d.ts +154 -4
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/Layer.d.ts +2 -0
- package/layers/LineOfSightLayer.d.ts +10 -8
- package/layers/SceneLayer.js +1 -1
- package/layers/SubtypeGroupLayer.d.ts +2 -2
- package/layers/SubtypeGroupLayer.js +1 -1
- package/layers/ViewshedLayer.d.ts +1 -1
- package/layers/VoxelLayer.js +1 -1
- package/layers/WMSLayer.js +1 -1
- package/layers/geospatialPDF/GeospatialPDFFrame.js +1 -1
- package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +9 -9
- package/layers/geospatialPDF/GeospatialPDFWorkerClient.js +1 -1
- package/layers/geospatialPDF/LGIDictMapFrame.js +1 -1
- package/layers/geospatialPDF/ViewportMeasureFrame.js +1 -1
- package/layers/geospatialPDF/geospatialPDFParserUtils.js +1 -1
- package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/sources/connections/WebSocketConnection.js +1 -1
- package/layers/graphics/sources/parquet/FileProvider.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/mixins/{FeatureLayerReload.d.ts → ReloadableLayer.d.ts} +5 -3
- package/layers/mixins/ReloadableLayer.js +2 -0
- package/layers/raster/datasets/BaseRaster.js +1 -1
- package/layers/raster/datasets/GeospatialPDFRaster.js +1 -1
- package/layers/raster/datasets/ImageAuxRaster.js +2 -2
- package/layers/raster/datasets/ImageServerRaster.js +1 -1
- package/layers/raster/datasets/InMemoryRaster.js +1 -1
- package/layers/raster/datasets/MRFRaster.js +1 -1
- package/layers/raster/datasets/TIFFRaster.js +1 -1
- package/layers/raster/datasets/WCSRaster.js +1 -1
- package/layers/raster/formats/ImageCanvasDecoder.js +1 -1
- package/layers/raster/formats/RasterCodec.js +1 -1
- package/layers/raster/formats/TiffDecoder.js +1 -1
- package/layers/raster/formats/Zlib.js +1 -1
- package/layers/raster/functions/stretchUtils.js +1 -1
- package/layers/raster/functions/vectorFieldUtils.js +1 -1
- package/layers/support/FieldsIndex.js +1 -1
- package/layers/support/LabelClass.d.ts +3 -2
- package/layers/support/PortalItemData.d.ts +31 -8
- package/layers/support/RasterWorker.js +1 -1
- package/layers/support/featureReductionProperties.js +1 -1
- package/layers/support/kmlUtils.js +1 -1
- package/layers/support/types.d.ts +4 -1
- package/layers/video/VideoController.js +10 -10
- package/libs/maquette/projection.js +1 -1
- package/networks/UtilityNetworkTraceAnalysis.js +1 -1
- package/package.json +5 -5
- package/popup/FeatureModel.js +1 -1
- package/popup/FeaturesModel.js +1 -1
- package/portal/Portal.js +1 -1
- package/request/process.js +1 -1
- package/request/types.d.ts +7 -0
- package/rest/knowledgeGraph/ObjectValue.js +1 -1
- package/rest/knowledgeGraphService.js +1 -1
- package/rest/networks/trace.js +1 -1
- package/rest/query/executeQuery.js +1 -1
- package/smartMapping/raster/renderers/shadedRelief.js +1 -1
- package/smartMapping/renderers/univariateColorSize.js +1 -1
- package/smartMapping/statistics/support/statsWorker.js +1 -1
- package/smartMapping/statistics/support/utils.js +1 -1
- package/smartMapping/support/clusterUtils.js +1 -1
- package/statistics/utils.js +1 -1
- package/symbols/cim/CIMCursor.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/symbols/support/ElevationInfo.d.ts +4 -3
- package/undoredo/support/Services.js +1 -1
- package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +2 -2
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/grid/GridView2D.js +1 -1
- package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
- package/views/2d/layers/features/sources/strategies/FeatureHybridTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/FeaturePagedTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/FeatureSnapshotLoadStrategy.js +1 -1
- package/views/2d/viewpointUtils.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
- package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightItemTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightPlacementController.js +1 -1
- package/views/3d/analysis/LineOfSight/{LineOfSightRootPlugin.js → LineOfSightPlacementRootPlugin.js} +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/analysis/LineOfSight/types.d.ts +14 -3
- package/views/3d/analysis/LineOfSightAnalysisView3D.d.ts +39 -13
- package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/analysis/Viewshed/types.d.ts +7 -0
- package/views/3d/analysis/ViewshedAnalysisView3D.d.ts +43 -15
- package/views/3d/input/handlers/KeyboardNavigation.js +1 -1
- package/views/3d/interactive/editingTools/ManipulatedObject3DGraphic.js +1 -1
- package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
- package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
- package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/SpatialIndex2D.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/i3s/LayerElevationProvider.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3DDebugger.js +1 -1
- package/views/3d/layers/support/ImageHighlightHelper3D.js +1 -1
- package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/support/MemoryController.js +1 -1
- package/views/3d/support/elevationUpdateExtentUtils.js +1 -1
- package/views/3d/support/elevationUpdateUtils.js +1 -1
- package/views/3d/support/pointsOfInterest/Focus.js +1 -1
- package/views/3d/support/sphereExtentUtils.js +2 -0
- package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/terrain/TerrainData.js +1 -1
- package/views/3d/terrain/terrainUtils.js +1 -1
- package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
- package/views/3d/webgl-engine/effects/geometry/RenderOccluded.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
- package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/PathCapBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/PathEvaluator.js +1 -1
- package/views/3d/webgl-engine/lib/PathExtruder.js +1 -1
- package/views/3d/webgl-engine/lib/PathProfile.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/pathGeometryUtils.js +1 -1
- package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/ToolViewManager.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/draw/support/InteractiveHandle.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/createUtils.js +1 -1
- package/views/draw/support/editingSessionUtils.js +1 -1
- package/views/draw/support/managers/InteractiveHandleManager.js +1 -1
- package/views/interactive/SegmentLabels.js +1 -1
- package/views/interactive/editGeometry/EditGeometry.js +1 -1
- package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
- package/views/interactive/editGeometry/operations/SetAllVertexPositions.js +1 -1
- package/views/interactive/editGeometry/operations/UndoGroup.js +1 -1
- package/views/interactive/options/TooltipOptions.d.ts +2 -0
- package/views/interactive/sketch/SketchTooltipOptions.d.ts +2 -0
- package/views/interactive/sketch/constraintUtils.js +1 -1
- package/views/interactive/snapping/SnappingDragPipelineStep.js +1 -1
- package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
- package/views/layers/LayerView.js +1 -1
- package/views/layers/LineOfSightLayerView.d.ts +35 -13
- package/views/layers/SketchLayerView.d.ts +1 -0
- package/views/layers/ViewshedLayerView.d.ts +36 -12
- package/views/webgl/Program.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/DynamicChoiceController.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/EditorViewModel.d.ts +10 -1
- package/widgets/Editor/legacy/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor.d.ts +10 -1
- package/widgets/ElevationProfile/support/chartUtils.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/FeatureTable/support/GroupColumnTemplate.js +1 -1
- package/widgets/FeatureTable/support/TableTemplate.js +1 -1
- package/widgets/HistogramRangeSlider.d.ts +2 -2
- package/widgets/HistogramRangeSlider.js +1 -1
- package/widgets/Legend.d.ts +1 -0
- package/widgets/Print.js +1 -1
- package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.d.ts +5 -2
- package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
- package/widgets/ScaleRangeSlider.js +1 -1
- package/widgets/Slice.js +1 -1
- package/widgets/UtilityNetworkTraceAnalysis/UtilityNetworkTraceAnalysisViewModel.js +1 -1
- package/widgets/ValuePicker/ValuePickerBaseComponent.d.ts +5 -1
- package/widgets/ValuePicker/ValuePickerCollection.d.ts +2 -0
- package/widgets/ValuePicker/ValuePickerCombobox.d.ts +7 -1
- package/widgets/ValuePicker/ValuePickerLabel.d.ts +7 -1
- package/widgets/ValuePicker/ValuePickerSlider.d.ts +2 -0
- package/widgets/ValuePicker/ValuePickerSliderVisibleElements.d.ts +5 -1
- package/widgets/ValuePicker/ValuePickerVisibleElements.d.ts +5 -1
- package/widgets/ValuePicker/types.d.ts +2 -0
- package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
- package/widgets/support/SelectionList.js +1 -1
- package/widgets/support/componentsUtils.js +1 -1
- package/assets/esri/core/workers/chunks/024b44c0c8876627f904.js +0 -1
- package/assets/esri/core/workers/chunks/02c5d027bdaee67869cf.js +0 -1
- package/assets/esri/core/workers/chunks/03261b9451e293a0fac8.js +0 -1
- package/assets/esri/core/workers/chunks/037a8cc19debbaaa4e10.js +0 -1
- package/assets/esri/core/workers/chunks/0c8c01097847617261b9.js +0 -1
- package/assets/esri/core/workers/chunks/0d931c7579b6409a696d.js +0 -1
- package/assets/esri/core/workers/chunks/12c154342fff876f2f1e.js +0 -1
- package/assets/esri/core/workers/chunks/1c65ab9ed611c322ce27.js +0 -1
- package/assets/esri/core/workers/chunks/1e11d2e97d17685b878a.js +0 -1
- package/assets/esri/core/workers/chunks/1f339247b68b061ab0a4.js +0 -1
- package/assets/esri/core/workers/chunks/21ddb26526bcb2b122c3.js +0 -1
- package/assets/esri/core/workers/chunks/22e8c0aad2fe75943865.js +0 -1
- package/assets/esri/core/workers/chunks/2eae542fe7f0f6576ac1.js +0 -1
- package/assets/esri/core/workers/chunks/408e81c8f1eff8a7b379.js +0 -1
- package/assets/esri/core/workers/chunks/444e5f214abce3d607cd.js +0 -1
- package/assets/esri/core/workers/chunks/46a7da93a63663878583.js +0 -1
- package/assets/esri/core/workers/chunks/4a1e23e021bac37a88ab.js +0 -1
- package/assets/esri/core/workers/chunks/4c4117e28ea358a32088.js +0 -1
- package/assets/esri/core/workers/chunks/54b18559280a7d2a8d93.js +0 -1
- package/assets/esri/core/workers/chunks/59b216b60464611742d4.js +0 -1
- package/assets/esri/core/workers/chunks/5bfea0c55aca826de536.js +0 -1
- package/assets/esri/core/workers/chunks/62ac588f7dd1d24d0c9d.js +0 -1
- package/assets/esri/core/workers/chunks/62c8c9ad09e0166207fd.js +0 -1
- package/assets/esri/core/workers/chunks/62d6e101e9bd9557a410.js +0 -1
- package/assets/esri/core/workers/chunks/6558488ea96620439f34.js +0 -1
- package/assets/esri/core/workers/chunks/665e31c494d2af505acc.js +0 -1
- package/assets/esri/core/workers/chunks/6f4e6022a52de0c54aab.js +0 -1
- package/assets/esri/core/workers/chunks/7267b17de212207142c9.js +0 -1
- package/assets/esri/core/workers/chunks/7ef182e24cad50815b4e.js +0 -1
- package/assets/esri/core/workers/chunks/8293600f94553afc8c38.js +0 -1
- package/assets/esri/core/workers/chunks/8431ca60ad33d594e323.js +0 -1
- package/assets/esri/core/workers/chunks/876f7633c15f1e31078d.js +0 -1
- package/assets/esri/core/workers/chunks/8ca9648eacb894283513.js +0 -1
- package/assets/esri/core/workers/chunks/91ebb2ccab1889eb7e81.js +0 -1
- package/assets/esri/core/workers/chunks/9ce91a909eccc4dfe388.js +0 -1
- package/assets/esri/core/workers/chunks/9e1a3b6a08c96dcefdde.js +0 -1
- package/assets/esri/core/workers/chunks/9e3e442a9874ed23a043.js +0 -1
- package/assets/esri/core/workers/chunks/ad76f7ab2f3e6d5a5b3c.js +0 -1
- package/assets/esri/core/workers/chunks/aff32980d91dab07dfb7.js +0 -1
- package/assets/esri/core/workers/chunks/bbf993dba74850bbf9d7.js +0 -1
- package/assets/esri/core/workers/chunks/d8f1cefcad02d7353d4b.js +0 -1
- package/assets/esri/core/workers/chunks/d938987344bce83cc660.js +0 -1
- package/assets/esri/core/workers/chunks/ddf0671976648f621269.js +0 -1
- package/assets/esri/core/workers/chunks/de02f60258e6985ef676.js +0 -1
- package/assets/esri/core/workers/chunks/e10b57aefcc89671116e.js +0 -1
- package/assets/esri/core/workers/chunks/e65dfa19f030ec298437.js +0 -1
- package/assets/esri/core/workers/chunks/f122c18af10e56f9ec2b.js +0 -1
- package/assets/esri/core/workers/chunks/f92364afaefbac7e8f77.js +0 -1
- package/assets/esri/core/workers/chunks/fd9663952d5a94f3a83f.js +0 -1
- package/assets/esri/core/workers/chunks/fe9879ecd69ac4329291.js +0 -1
- package/layers/mixins/FeatureLayerReload.js +0 -2
- /package/views/3d/analysis/LineOfSight/{lineOfSightPlacementUtils.js → placementUtils.js} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{result as e,createTask as t}from"../../../../core/asyncUtils.js";import n from"../../../../core/Error.js";import{clone as r}from"../../../../core/lang.js";import{abortMaybe as i,releaseMaybe as a}from"../../../../core/maybe.js";import{throwIfAbortError as o,throwIfAborted as s}from"../../../../core/promiseUtils.js";import{pt2px as c,onePixelInPoints as l}from"../../../../core/screenUtils.js";import{numericHash as u}from"../../../../core/string.js";import{dataComponents as d}from"../../../../core/urlUtils.js";import{fromValues as f,fromArray as p,create as m,ONES as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as g,create as _,ZEROS as ee}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as te,ZEROS as ne}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectPointToVector as v}from"../../../../geometry/projection/projectPointToVector.js";import{containsPoint as y}from"../../../../geometry/support/aaBoundingBox.js";import b from"../../../../layers/support/FieldsIndex.js";import{createRendererExpression as re}from"../../../../support/ArcadeExpression.js";import{CIMSymbolHelper as x,CIMSymbolInflatedSizeHelper as S}from"../../../../symbols/cim/CIMSymbolHelper.js";import{evaluateValueOrFunction as C}from"../../../../symbols/cim/utils.js";import{scaleCIMSymbol as ie}from"../../../../symbols/support/cimSymbolUtils.js";import{defaultIconPrimitive as ae}from"../../../../symbols/support/primitives.js";import oe from"../../../../symbols/support/Symbol3DAnchorPosition2D.js";import{getIconHref as se}from"../../../../symbols/support/utils.js";import{transparentUnit as ce}from"./constants.js";import{perBufferPointElevationAligner as le}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as ue,needsElevationUpdates2D as w}from"./elevationAlignmentUtils.js";import{Graphics3DBufferGraphicLayer as de}from"./Graphics3DBufferGraphicLayer.js";import{Graphics3DDrapedBufferGraphicLayer as fe}from"./Graphics3DDrapedBufferGraphicLayer.js";import{Graphics3DSymbolLayer as T}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as E}from"./graphicUtils.js";import{namedAnchorToHUDMaterialAnchorPos as D}from"./placementUtils.js";import{placePointOnGeometry as O,updateBufferStageObjectGeometry as k,extendPointGraphicElevationContext as A,getLocalOriginForPoint as j,createBufferStageObject as M}from"./pointUtils.js";import{hasTransparencyModeSymbol as N}from"./transparencyUtils.js";import{initFastSymbolUpdatesState as P,updateFastSymbolUpdatesState as F,evaluateModelTransformScale as I,ConvertOptions as L}from"../support/FastSymbolUpdates.js";import{createTexture as R,requiresHalfTexelOffset as z,defaultBoundingBox as pe,defaultSymbolSizeRatio as B,defaultTexSize as V}from"../../support/engineContent/sdfPrimitives.js";import{drapedZ as me}from"../../terrain/DrapedZ.js";import{VerticalOffsetParameters as he}from"../../webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js";import{createPointBufferGeometry as H}from"../../webgl-engine/lib/GeometryUtil.js";import{ManagedTexture as U}from"../../webgl-engine/lib/ManagedTexture.js";import{HUDMaterial as W}from"../../webgl-engine/materials/HUDMaterial.js";var G;const K=g(0,0,1),ge=[V*B,V*B];class q extends T{static{G=N}static{this.PRIMITIVE_SIZE=ge}getCachedSize(){return{size:this._getIconSize()}}static{this.elevationModeChangeTypes={definedChanged:1,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,n,r){super(e,t,n,r,ve(t)),this._cimData=null,this._overrideHelperClass=null,this._arcadeInfo=null,this._cimSymbolMaterials=new Map,this._cimSymbolTextures=new Map,this._cimMaterialParametersInfo=null,this._cimScaleFactorOrFunction=null,this._size=[1,1],this._symbolTextureRatio=1,this._outlineSize=0,this._textureHandle=null,this._patchTask=null,this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!0},this[G]=!0}async doLoad(e){this._validateOrThrow();let t=this._prepareMaterialParameters(),n=this._getPrimitive();if(n!=null)this._prepareResourcesPrimitive(t,n);else{let n=se(this.symbolLayer),r=Y(n);r==null?await this._prepareResourcesHref(t,n,e):await this._prepareResourcesCIM(t,JSON.parse(r),e)}}_validateOrThrow(){if(this._drivenProperties.size)return;let e=E(this._getIconSize());if(e)throw new n(`graphics3diconsymbollayer:invalid-size`,e)}_getIconSize(){let e=this.symbolLayer,t=Math.round(e.size==null?16:c(e.size));return this._drivenProperties.size?Math.max(t,64):t}_generateTextureCIM(e,t){let n=this._overrideHelperClass,i=this._cimData;if((!n||!i||!i.symbol)&&this.logger.error(`Can't create texture, CIM data is undefined`),i.primitiveOverrides){i=r(i);let a=i.primitiveOverrides;n.evaluateOverrides(a,e,this._arcadeInfo.geometryType,null,null,t.layer.fieldsIndex),n.applyOverrides(i.symbol,a)}let a=u(JSON.stringify(i)),o=this._cimSymbolTextures.get(a);if(o)return o;let s=this._context.sharedResources.cimSymbolRasterizer,l=this._context.renderer&&this._context.renderer.type===`dictionary`?this._context.renderer.fieldMap:null;l&&n.applyDictionaryTextOverrides(i.symbol,e,l,null);let d=this._cimScaleFactorOrFunction==null?1:C(this._cimScaleFactorOrFunction,e);d!==1&&i.symbol&&ie(i.symbol,d,!0);let f=x.getEnvelope(i,null,s.resourceManager);if(f?.width&&f.height){let e=f.x+f.width/2,t=f.y+f.height/2,n=i.symbol?.type===`CIMPointSymbol`?S.getPointSymbolHaloPadding(i.symbol,s.resourceManager):0,r=this._context.graphicsCoreOwner.view.state.rasterPixelRatio,a=n>0?Math.ceil((c(n)+1)*r):0,l=s.rasterize({type:`cim`,data:i},f.width,f.height,e,t,1,`esriGeometryPoint`,a,null,r),u=new oe({x:-f.x/f.width-.5,y:(f.height+f.y)/f.height-.5});this._cimMaterialParametersInfo.anchorPosition=X(`relative`,u),o=new U(l,{width:l?.width??1,height:l?.height??1,reloadable:!0})}else o=new U(new ImageData(1,1),{width:1,height:1,reloadable:!0});return this._cimSymbolTextures.set(a,o),this._context.stage.addTexture(o),o}_prepareMaterialParameters(){let{symbolLayer:e,symbol:t,_context:n,_drivenProperties:r,view:i}=this,a=this.symbolLayer.occludedVisibility?.mode??`hidden`;return{anchorPosition:X(e.anchor,e.anchorPosition),rotation:e.angle,hasRotation:e.angle!==0||r.rotation,hasVertexRotation:r.rotation,occludedFragmentOpacity:a===`hidden`?void 0:i.state.ensureOccludedFragmentOpacity(!1,a),hasSlicePlane:n.slicePlaneEnabled,verticalOffset:_e(t)?new he(t.verticalOffset):void 0,screenSizePerspective:n.screenSizePerspectiveEnabled?i.screenSizePerspective.parameters:void 0}}_prepareResourcesPrimitive(e,t){let n=this._getOutlineSize();if(J(t)&&n===0)throw Error(`Nothing to render`);if(this._outlineSize=n,e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,this._context.sharedResources.textures!=null){let n=this._context.sharedResources.textures.fromData(`${t}-icon`,()=>R(t));this._textureHandle=n,e.textureId=n.managedTexture.id}e.textureIsSignedDistanceField=!0,e.sampleSignedDistanceFieldTexelCenter=z(t),e.distanceFieldBoundingBox=pe;let r=this._getIconSize();this._size=[r,r],this._symbolTextureRatio=1/B,e.size=f(r*this._symbolTextureRatio,r*this._symbolTextureRatio),this._createMaterials(e)}async _prepareResourcesHref(t,r,i){this._outlineSize=this._getOutlineSize(),t.color=this._getFillColor(),t.outlineColor=this._getOutlineColor(),t.outlineSize=this._outlineSize,t.textureIsSignedDistanceField=!1;let a=this._getIconSize(),s=a*this._context.graphicsCoreOwner.view.state.rasterPixelRatio;if(this._context.sharedResources.textures!=null){let c=await e(this._context.sharedResources.textures.fromUrl(r,s,{signal:i}));if(c.ok===!1){o(c.error);let e=`Failed to load (Request for icon resource failed: ${r})`;throw new n(`graphics3diconsymbollayer:request-failed`,e)}this._textureHandle=c.value;let l=c.value.managedTexture;this._size=Z(l,a),t.size=p(this._size),t.textureId=l.id}this._createMaterials(t)}async _prepareResourcesCIM(e,t,n){let{OverrideHelper:r}=await import(`../../../../symbols/cim/OverrideHelper.js`);if(this._overrideHelperClass=r,this._cimData=t,!this._context.sharedResources.cimSymbolRasterizer){let e=(await import(`../../../../symbols/cim/CIMSymbolRasterizer.js`)).CIMSymbolRasterizer;s(n),this._context.sharedResources.cimSymbolRasterizer??=new e(this._context.renderCoordsHelper.spatialReference)}let i=this._context.sharedResources.cimSymbolRasterizer,a=t,o=a?.symbol,c=[x.normalizeSymbolAndFetchResources(o,i.resourceManager,n)],l=this._context.layer.fields?this._context.layer.fields.map(e=>e.toJSON()):[],u=this._context.renderCoordsHelper.spatialReference;if(this._arcadeInfo={spatialReference:u,fields:l,geometryType:`esriGeometryPoint`},a?.primitiveOverrides&&c.push(r.createRenderExpressions(a.primitiveOverrides,this._arcadeInfo)),c.length>0&&(await Promise.all(c),s(n)),this._context.renderer&&this._context.renderer.type===`dictionary`&&this._context.renderer.scaleExpression){let e=this._context.renderer;if(e.scaleExpression){let t=e.scaleExpression,n=await re(t,this._context.layer.spatialReference),{default:r}=await import(`../../../2d/arcade/callExpressionWithFeature.js`),i=new b(l);this._cimScaleFactorOrFunction=(e,t,a)=>{let o=r(n,e,{$view:a},`esriGeometryPoint`,i,t);return o===null?1:o}}}s(n),this._cimMaterialParametersInfo=e,this._cimMaterialParametersInfo.color=this._getFillColor(),this._cimMaterialParametersInfo.outlineColor=[0,0,0,0],this._cimMaterialParametersInfo.outlineSize=0,this._cimMaterialParametersInfo.textureIsSignedDistanceField=!1}_getPrimitive(){return Q(this.symbolLayer)}_getOutlineSize(){let e=0,t=this.symbolLayer;return t.outline?.size==null?(e=J(this._getPrimitive())?1.5:0,Math.max(e,0)):Math.max(c(t.outline.size),0)}_getOutlineColor(){let e=this._getLayerOpacity(),t=this.symbolLayer?.outline?.color;if(t!=null){let n=t.toUnitRGB(),r=t.a*e;return[n[0],n[1],n[2],r]}return[0,0,0,0]}_getFillColor(){if(J(this._getPrimitive()))return ce;let e=this._getPrimitive()==null,t=this._materialColor;return this._getCombinedOpacityAndColor(t,{hasIntrinsicColor:e})}get _materialColor(){return this.symbolLayer.material?.color}get _fastVisualVariableFallbackColor(){let e=this._materialColor;return e==null?this._getPrimitive()==null?te:ne:e.toUnitRGBA()}_getFallbackSize(){let e=this._getIconSize(),{symbolLayer:{size:t}}=this;return(t==null?16:Math.round(c(t)))/e}_createCimMaterials(e){let t=e.textureId?this._cimSymbolMaterials.get(e.textureId):null;if(t)return t;let n=$([],e,this._context.focusAreaStyle,this._context.spherical);return this._cimSymbolMaterials.set(e.textureId??0,n),n}_createMaterials(e){this._fastUpdates=P(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastUpdates&&(e={...e,...this._fastUpdates.materialParameters}),e.hasVertexColor=this._drivenProperties.color&&!this._fastUpdates?.visualVariables.color||this._drivenProperties.opacity&&!this._fastUpdates?.visualVariables.opacity,e.hasVertexSize=this._drivenProperties.size&&!this._fastUpdates?.visualVariables.size,$(this._materials,e,this._context.focusAreaStyle,this._context.spherical)}_setDrapingDependentMaterialParameters(){this.draped&&(this._forEachMaterial(e=>{e.setParameters({verticalOffset:null,screenSizePerspective:null,hasSlicePlane:!1,shaderPolygonOffset:0,draped:this.draped})}),this.layerOpacityChanged())}destroy(){super.destroy(),this._patchTask=i(this._patchTask),this._materials.length=0,this._cimSymbolMaterials.clear(),this._cimSymbolTextures.forEach(e=>this._context.stage.removeTexture(e)),this._cimSymbolTextures.clear(),this._textureHandle=a(this._textureHandle)}_getScaleFactor({size:e},t){if(!this._drivenProperties.size)return 1;if(e==null)return this._getFallbackSize();let[n,r,i]=e.output;return n===`symbol-value`?1:typeof n==`number`&&isFinite(n)?c(n)/t:typeof i==`number`&&isFinite(i)?c(i)/t:1}_getDrivenRotation(e){return this._drivenProperties.rotation?e.heading?.output??0:null}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry))return null;let n=O(t.geometry);if(n==null)return this.logger.warn(`unsupported geometry type for text symbol: ${t.geometry.type}`),null;let r=this._materials,i=this.view.focusAreasView?.containsGeometry(n)??!0;if(this._cimData){if(!this._cimData.symbol)return null;let n=this._context.graphicsCoreOwner.view.state.rasterPixelRatio,i=this._generateTextureCIM(t,e),a=f(i.parameters.width/n,i.parameters.height/n);r=this._createCimMaterials({textureId:i.id,size:a,...this._cimMaterialParametersInfo})}let a=r[i?0:2];if(n==null)return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;let o=this._getPrimitive()==null,s=e.renderingInfo,c=this._hasDrivenColorOrOpacity?this._getDrivenUInt8Color(s,this._materialColor,o):null,l=this._getDrivenRotation(s),u=null;if(!this._fastUpdates?.visualVariables.size){let e=this._size,t=e[0]>e[1]?e[0]:e[1];u=this._getScaleFactor(s,t)}let d=u==null?null:f(u,u),p=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus(p.mode===`on-the-ground`)&&this._setDrapingDependentMaterialParameters(),this.draped?this._createAsOverlay(s,n,a,c,l,d,t.uid):this._createAs3DShape(s,n,a,c,l,d,p,t.uid)}terrainTransparencyChanged(){return this.draped}layerOpacityChanged(){let e=this._getFillColor(),t=this._getOutlineColor();this._forEachMaterial(n=>{n.setParameters({color:e}),n.setParameters({outlineColor:t})})}layerScreenSizePerspectiveChanged(){let e=this._context.screenSizePerspectiveEnabled&&!this.draped?this.view.screenSizePerspective.parameters:null;this._forEachMaterial(t=>{t.setParameters({screenSizePerspective:e})})}updateTransparentMode(e,t){let n=e.stageObject.geometries[0]?.material,r=this._cimData?n?.parameters.textureId:null,i=r?this._cimSymbolMaterials.get(r):this._materials,a=(i?.indexOf(n)??-1)<2,o=i?.[t?a?1:3:a?0:2];o&&o!==n&&e.updateMaterial(o)}updateGeometry(e,t){let n=e.geometry;if(t.type!==`buffer`||this.draped||!n||!this._validateGeometry(n))return!1;let{elevationContext:r,stageObject:i}=t;if(r.mode!==this.getGeometryElevationMode(n))return!1;let a=O(n);if(!a)return!1;r.updateFeatureExpressionFeature(e,this._context.layer);let o=k(i,this._context,a,r);return o!=null&&(t.alignedSampledElevation=o,A(t,a,this._context.elevationProvider),!0)}layerElevationInfoChanged(e,t,n){let r=this._elevationContext.mode,i=ue(q.elevationModeChangeTypes,n,r);if(i!==1)return i;let a=w(r)||r===`absolute-height`;return this.updateGraphics3DGraphicElevationInfo(e,t,()=>a)}slicePlaneEnabledChanged(){return this.draped||this._forEachMaterial(e=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),!0}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return this._getPrimitive()!=null}applyRendererDiff(e,t){for(let n in e.diff)switch(n){case`visualVariables`:if(F(this._fastUpdates,t,this._fastVisualVariableConvertOptions())){let e=this._fastUpdates;this._materials.forEach(t=>t?.setParameters(e.materialParameters))}else return 0;break;default:return 0}return 2}get needsUpdateFocus(){return!0}prepareSymbolLayerPatch(e){if(this._patchTask?.abort(),e.diff.type!==`partial`)return;let t=e.diff.diff;this._preparePatchResource(e,t),this._preparePatchRotation(e,t)}_preparePatchResource(r,c){if(!c.resource||c.resource.type!==`partial`)return;let l=c.resource.diff;if(l?.href?.type!==`complete`)return;let u=l.href.newValue,{textures:d}=this._context.sharedResources;if(u==null||d==null||Y(u)!=null)return;let f=this._getIconSize(),p=f*this._context.graphicsCoreOwner.view.state.pixelRatio;r.symbolLayerStatePatches.push(()=>{this._patchTask=i(this._patchTask),this._patchTask=t(t=>this._context.schedule(async(t,r)=>{let i=await e(d.fromUrl(u,p,{signal:r}));s(r);let c=!i.ok;if(c&&o(i.error),this._textureHandle=a(this._textureHandle),this._patchTask=null,c){this._forEachMaterial(e=>{e.visible=!1,e.setParameters({textureId:null})});let e=`Failed to load (Request for icon resource failed: ${u})`;this.logger.error(new n(`graphics3diconsymbollayer:request-failed`,e));return}this._textureHandle=i.value;let l=i.value.managedTexture;this._size=Z(l,f),this._forEachMaterial(e=>{e.setParameters({textureId:l.id}),e.visible=!0})},t))}),delete l.href}_preparePatchRotation(e,t){if(!t.angle||t.angle.type!==`complete`)return;let n=t.angle.newValue??0,r=n!==0||this._drivenProperties.rotation;e.symbolLayerStatePatches.push(()=>{this._forEachMaterial(e=>e.setParameters({rotation:n,hasRotation:r}))}),delete t.angle}_defaultElevationInfoNoZ(){return ye}_createAs3DShape(e,t,n,r,i,a,o,s){let c=this.getFastUpdateAttrValues(e),l=this._context.layerViewUid,u=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:s,layerViewUid:l}),d=j(this._context,t),f=H(n,d,{normal:K,color:r,rotation:i,size:a,centerOffset:ee,groundDistance:1,featureAttribute:c,olidColor:u}),p=M(this._context,t,f,o,s);if(p==null)return null;let m=new de(this,p.object,null,le,o);return m.setOccludedVisibilityMode(this.symbolLayer.occludedVisibility?.mode),m.hiddenIfDeconflicted=!0,m.alignedSampledElevation=p.sampledElevation,m.needsElevationUpdates=w(o.mode)||o.mode===`absolute-height`,m.getScreenSize=this._createScreenSizeGetter(a,c),m.calculateRelativeScreenBounds=e=>n.calculateRelativeScreenBounds(m.getScreenSize(),1,e),A(m,t,this._context.elevationProvider),m}_createAsOverlay(e,t,n,r,i,a,o){n.renderPriority=this._renderPriority;let s=_();v(t,s,this._context.overlaySR),s[2]=me;let c=this._context.clippingExtent;if(c!=null&&!y(c,s))return null;let l=this.getFastUpdateAttrValues(e),u=this._context.layerViewUid,d=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:o,layerViewUid:u}),f=this._context.drapeSourceRenderer.rendererContext.localOriginFactory.getOrigin(s),p=H(n,f,{normal:K,position:s,groundDistance:0,color:r,rotation:i,size:a,featureAttribute:l,olidColor:d});p.layerViewUid=u,p.graphicUid=o;let m=new fe(this,[p],null,this._context.drapeSourceRenderer);return m.getScreenSize=this._createScreenSizeGetter(a,l),m.calculateRelativeScreenBounds=e=>n.calculateRelativeScreenBounds(m.getScreenSize(),1,e),m}_createScreenSizeGetter(e,t){e??=h;let n=this._outlineSize+2;if(this._fastUpdates&&t){let r=e[0]*this._size[0],i=e[1]*this._size[1];return(e=m())=>{let[a,o]=I(be,this._fastUpdates.materialParameters,t);return e[0]=a*r+n,e[1]=o*i+n,e}}let r=e[0]*this._size[0]+n,i=e[1]*this._size[1]+n;return(e=m())=>(e[0]=r,e[1]=i,e)}_fastVisualVariableConvertOptions(){let e=Math.max(this._size[0],this._size[1]),t=g(e,e,e),n=l,r=e*n,i=g(r,r,r),a=this._getFallbackSize();return new L({supports:{size:!0,color:!0,rotation:!0,opacity:!1},modelSize:t,symbolSize:i,unitInMeters:n,fallbackColor:this._fastVisualVariableFallbackColor,fallbackSize:g(a,a,a)})}_forEachMaterial(e){this._materials.forEach(e),this._cimSymbolMaterials.forEach(t=>t.forEach(e))}test(){return{...super.test(),material:this._materials[0]}}}function _e(e){return e&&e.type===`point-3d`&&e.hasVisibleVerticalOffset()}function J(e){return e==null?!1:e===`cross`||e===`x`}function Y(e){let t=d(e);return t?.mediaType===`application/json`?t.data:void 0}function X(e,t){return e===`relative`?f((t.x||0)+.5,-(t.y||0)+.5):e in D?D[e]:D.center}function Z({parameters:e},t){let n=(e.width??1)/(e.height??1);return n>1?[t,Math.round(t/n)]:[Math.round(t*n),t]}function Q(e){return e.resource?.href?null:e.resource?.primitive??ae}function ve(e){return(e.material?.color?.a??1)===1&&Q(e)!=null}const ye={mode:`relative-to-ground`,offset:0},be=_();function $(e,t,n,r){let i={...t,focusAreaStyle:n};return e[0]=new W(t,r),e[1]=new W(t,r,!0),e[2]=new W(i,r),e[3]=new W(i,r,!0),e}export{q as Graphics3DIconSymbolLayer};
|
|
2
|
+
import{result as e,createTask as t}from"../../../../core/asyncUtils.js";import n from"../../../../core/Error.js";import{clone as r}from"../../../../core/lang.js";import{abortMaybe as i,releaseMaybe as a}from"../../../../core/maybe.js";import{throwIfAbortError as o,throwIfAborted as s}from"../../../../core/promiseUtils.js";import{pt2px as c,onePixelInPoints as l}from"../../../../core/screenUtils.js";import{numericHash as u}from"../../../../core/string.js";import{dataComponents as d}from"../../../../core/urlUtils.js";import{fromValues as f,fromArray as p,create as m,ONES as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as g,create as _,ZEROS as ee}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as te,ZEROS as ne}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectPointToVector as v}from"../../../../geometry/projection/projectPointToVector.js";import{containsPoint as y}from"../../../../geometry/support/aaBoundingBox.js";import b from"../../../../layers/support/FieldsIndex.js";import{createRendererExpression as re}from"../../../../support/ArcadeExpression.js";import{CIMSymbolHelper as x,CIMSymbolInflatedSizeHelper as S}from"../../../../symbols/cim/CIMSymbolHelper.js";import{evaluateValueOrFunction as C}from"../../../../symbols/cim/utils.js";import{scaleCIMSymbol as ie}from"../../../../symbols/support/cimSymbolUtils.js";import{defaultIconPrimitive as ae}from"../../../../symbols/support/primitives.js";import oe from"../../../../symbols/support/Symbol3DAnchorPosition2D.js";import{getIconHref as se}from"../../../../symbols/support/utils.js";import{transparentUnit as ce}from"./constants.js";import{perBufferPointElevationAligner as le}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as ue,needsElevationUpdates2D as w}from"./elevationAlignmentUtils.js";import{Graphics3DBufferGraphicLayer as de}from"./Graphics3DBufferGraphicLayer.js";import{Graphics3DDrapedBufferGraphicLayer as fe}from"./Graphics3DDrapedBufferGraphicLayer.js";import{Graphics3DSymbolLayer as T}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as E}from"./graphicUtils.js";import{namedAnchorToHUDMaterialAnchorPos as D}from"./placementUtils.js";import{placePointOnGeometry as O,updateBufferStageObjectGeometry as k,extendPointGraphicElevationContext as A,getLocalOriginForPoint as j,createBufferStageObject as M}from"./pointUtils.js";import{hasTransparencyModeSymbol as N}from"./transparencyUtils.js";import{initFastSymbolUpdatesState as P,updateFastSymbolUpdatesState as F,evaluateModelTransformScale as I,ConvertOptions as L}from"../support/FastSymbolUpdates.js";import{createTexture as R,requiresHalfTexelOffset as z,defaultBoundingBox as pe,defaultSymbolSizeRatio as B,defaultTexSize as V}from"../../support/engineContent/sdfPrimitives.js";import{drapedZ as me}from"../../terrain/DrapedZ.js";import{VerticalOffsetParameters as he}from"../../webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js";import{createPointBufferGeometry as H}from"../../webgl-engine/lib/GeometryUtil.js";import{ManagedTexture as U}from"../../webgl-engine/lib/ManagedTexture.js";import{HUDMaterial as W}from"../../webgl-engine/materials/HUDMaterial.js";var G;const K=g(0,0,1),ge=[V*B,V*B];class q extends T{static{G=N}static{this.PRIMITIVE_SIZE=ge}getCachedSize(){return{size:this._getIconSize()}}static{this.elevationModeChangeTypes={definedChanged:1,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,n,r){super(e,t,n,r,ve(t)),this._cimData=null,this._overrideHelperClass=null,this._arcadeInfo=null,this._cimSymbolMaterials=new Map,this._cimSymbolTextures=new Map,this._cimMaterialParametersInfo=null,this._cimScaleFactorOrFunction=null,this._size=[1,1],this._symbolTextureRatio=1,this._outlineSize=0,this._textureHandle=null,this._patchTask=null,this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!0},this[G]=!0}async doLoad(e){this._validateOrThrow();let t=this._prepareMaterialParameters(),n=this._getPrimitive();if(n!=null)this._prepareResourcesPrimitive(t,n);else{let n=se(this.symbolLayer),r=Y(n);r==null?await this._prepareResourcesHref(t,n,e):await this._prepareResourcesCIM(t,JSON.parse(r),e)}}_validateOrThrow(){if(this._drivenProperties.size)return;let e=E(this._getIconSize());if(e)throw new n(`graphics3diconsymbollayer:invalid-size`,e)}_getIconSize(){let e=this.symbolLayer,t=Math.round(e.size==null?16:c(e.size));return this._drivenProperties.size?Math.max(t,64):t}_generateTextureCIM(e,t){let n=this._overrideHelperClass,i=this._cimData;if(n&&i&&i.symbol||this.logger.error(`Can't create texture, CIM data is undefined`),i.primitiveOverrides){i=r(i);let a=i.primitiveOverrides;n.evaluateOverrides(a,e,this._arcadeInfo.geometryType,null,null,t.layer.fieldsIndex),n.applyOverrides(i.symbol,a)}let a=u(JSON.stringify(i)),o=this._cimSymbolTextures.get(a);if(o)return o;let s=this._context.sharedResources.cimSymbolRasterizer,l=this._context.renderer&&this._context.renderer.type===`dictionary`?this._context.renderer.fieldMap:null;l&&n.applyDictionaryTextOverrides(i.symbol,e,l,null);let d=this._cimScaleFactorOrFunction==null?1:C(this._cimScaleFactorOrFunction,e);d!==1&&i.symbol&&ie(i.symbol,d,!0);let f=x.getEnvelope(i,null,s.resourceManager);if(f?.width&&f.height){let e=f.x+f.width/2,t=f.y+f.height/2,n=i.symbol?.type===`CIMPointSymbol`?S.getPointSymbolHaloPadding(i.symbol,s.resourceManager):0,r=this._context.graphicsCoreOwner.view.state.rasterPixelRatio,a=n>0?Math.ceil((c(n)+1)*r):0,l=s.rasterize({type:`cim`,data:i},f.width,f.height,e,t,1,`esriGeometryPoint`,a,null,r),u=new oe({x:-f.x/f.width-.5,y:(f.height+f.y)/f.height-.5});this._cimMaterialParametersInfo.anchorPosition=X(`relative`,u),o=new U(l,{width:l?.width??1,height:l?.height??1,reloadable:!0})}else o=new U(new ImageData(1,1),{width:1,height:1,reloadable:!0});return this._cimSymbolTextures.set(a,o),this._context.stage.addTexture(o),o}_prepareMaterialParameters(){let{symbolLayer:e,symbol:t,_context:n,_drivenProperties:r,view:i}=this,a=this.symbolLayer.occludedVisibility?.mode??`hidden`;return{anchorPosition:X(e.anchor,e.anchorPosition),rotation:e.angle,hasRotation:e.angle!==0||r.rotation,hasVertexRotation:r.rotation,occludedFragmentOpacity:a===`hidden`?void 0:i.state.ensureOccludedFragmentOpacity(!1,a),hasSlicePlane:n.slicePlaneEnabled,verticalOffset:_e(t)?new he(t.verticalOffset):void 0,screenSizePerspective:n.screenSizePerspectiveEnabled?i.screenSizePerspective.parameters:void 0}}_prepareResourcesPrimitive(e,t){let n=this._getOutlineSize();if(J(t)&&n===0)throw Error(`Nothing to render`);if(this._outlineSize=n,e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,this._context.sharedResources.textures!=null){let n=this._context.sharedResources.textures.fromData(`${t}-icon`,()=>R(t));this._textureHandle=n,e.textureId=n.managedTexture.id}e.textureIsSignedDistanceField=!0,e.sampleSignedDistanceFieldTexelCenter=z(t),e.distanceFieldBoundingBox=pe;let r=this._getIconSize();this._size=[r,r],this._symbolTextureRatio=1/B,e.size=f(r*this._symbolTextureRatio,r*this._symbolTextureRatio),this._createMaterials(e)}async _prepareResourcesHref(t,r,i){this._outlineSize=this._getOutlineSize(),t.color=this._getFillColor(),t.outlineColor=this._getOutlineColor(),t.outlineSize=this._outlineSize,t.textureIsSignedDistanceField=!1;let a=this._getIconSize(),s=a*this._context.graphicsCoreOwner.view.state.rasterPixelRatio;if(this._context.sharedResources.textures!=null){let c=await e(this._context.sharedResources.textures.fromUrl(r,s,{signal:i}));if(c.ok===!1){o(c.error);let e=`Failed to load (Request for icon resource failed: ${r})`;throw new n(`graphics3diconsymbollayer:request-failed`,e)}this._textureHandle=c.value;let l=c.value.managedTexture;this._size=Z(l,a),t.size=p(this._size),t.textureId=l.id}this._createMaterials(t)}async _prepareResourcesCIM(e,t,n){let{OverrideHelper:r}=await import(`../../../../symbols/cim/OverrideHelper.js`);if(this._overrideHelperClass=r,this._cimData=t,!this._context.sharedResources.cimSymbolRasterizer){let e=(await import(`../../../../symbols/cim/CIMSymbolRasterizer.js`)).CIMSymbolRasterizer;s(n),this._context.sharedResources.cimSymbolRasterizer??=new e(this._context.renderCoordsHelper.spatialReference)}let i=this._context.sharedResources.cimSymbolRasterizer,a=t,o=a?.symbol,c=[x.normalizeSymbolAndFetchResources(o,i.resourceManager,n)],l=this._context.layer.fields?this._context.layer.fields.map(e=>e.toJSON()):[],u=this._context.renderCoordsHelper.spatialReference;if(this._arcadeInfo={spatialReference:u,fields:l,geometryType:`esriGeometryPoint`},a?.primitiveOverrides&&c.push(r.createRenderExpressions(a.primitiveOverrides,this._arcadeInfo)),c.length>0&&(await Promise.all(c),s(n)),this._context.renderer&&this._context.renderer.type===`dictionary`&&this._context.renderer.scaleExpression){let e=this._context.renderer;if(e.scaleExpression){let t=e.scaleExpression,n=await re(t,this._context.layer.spatialReference),{default:r}=await import(`../../../2d/arcade/callExpressionWithFeature.js`),i=new b(l);this._cimScaleFactorOrFunction=(e,t,a)=>{let o=r(n,e,{$view:a},`esriGeometryPoint`,i,t);return o===null?1:o}}}s(n),this._cimMaterialParametersInfo=e,this._cimMaterialParametersInfo.color=this._getFillColor(),this._cimMaterialParametersInfo.outlineColor=[0,0,0,0],this._cimMaterialParametersInfo.outlineSize=0,this._cimMaterialParametersInfo.textureIsSignedDistanceField=!1}_getPrimitive(){return Q(this.symbolLayer)}_getOutlineSize(){let e=0,t=this.symbolLayer;return t.outline?.size==null?(e=J(this._getPrimitive())?1.5:0,Math.max(e,0)):Math.max(c(t.outline.size),0)}_getOutlineColor(){let e=this._getLayerOpacity(),t=this.symbolLayer?.outline?.color;if(t!=null){let n=t.toUnitRGB(),r=t.a*e;return[n[0],n[1],n[2],r]}return[0,0,0,0]}_getFillColor(){if(J(this._getPrimitive()))return ce;let e=this._getPrimitive()==null,t=this._materialColor;return this._getCombinedOpacityAndColor(t,{hasIntrinsicColor:e})}get _materialColor(){return this.symbolLayer.material?.color}get _fastVisualVariableFallbackColor(){let e=this._materialColor;return e==null?this._getPrimitive()==null?te:ne:e.toUnitRGBA()}_getFallbackSize(){let e=this._getIconSize(),{symbolLayer:{size:t}}=this;return(t==null?16:Math.round(c(t)))/e}_createCimMaterials(e){let t=e.textureId?this._cimSymbolMaterials.get(e.textureId):null;if(t)return t;let n=$([],e,this._context.focusAreaStyle,this._context.spherical);return this._cimSymbolMaterials.set(e.textureId??0,n),n}_createMaterials(e){this._fastUpdates=P(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastUpdates&&(e={...e,...this._fastUpdates.materialParameters}),e.hasVertexColor=this._drivenProperties.color&&!this._fastUpdates?.visualVariables.color||this._drivenProperties.opacity&&!this._fastUpdates?.visualVariables.opacity,e.hasVertexSize=this._drivenProperties.size&&!this._fastUpdates?.visualVariables.size,$(this._materials,e,this._context.focusAreaStyle,this._context.spherical)}_setDrapingDependentMaterialParameters(){this.draped&&(this._forEachMaterial(e=>{e.setParameters({verticalOffset:null,screenSizePerspective:null,hasSlicePlane:!1,shaderPolygonOffset:0,draped:this.draped})}),this.layerOpacityChanged())}destroy(){super.destroy(),this._patchTask=i(this._patchTask),this._materials.length=0,this._cimSymbolMaterials.clear(),this._cimSymbolTextures.forEach(e=>this._context.stage.removeTexture(e)),this._cimSymbolTextures.clear(),this._textureHandle=a(this._textureHandle)}_getScaleFactor({size:e},t){if(!this._drivenProperties.size)return 1;if(e==null)return this._getFallbackSize();let[n,r,i]=e.output;return n===`symbol-value`?1:typeof n==`number`&&isFinite(n)?c(n)/t:typeof i==`number`&&isFinite(i)?c(i)/t:1}_getDrivenRotation(e){return this._drivenProperties.rotation?e.heading?.output??0:null}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry))return null;let n=O(t.geometry);if(n==null)return this.logger.warn(`unsupported geometry type for text symbol: ${t.geometry.type}`),null;let r=this._materials,i=this.view.focusAreasView?.containsGeometry(n)??!0;if(this._cimData){if(!this._cimData.symbol)return null;let n=this._context.graphicsCoreOwner.view.state.rasterPixelRatio,i=this._generateTextureCIM(t,e),a=f(i.parameters.width/n,i.parameters.height/n);r=this._createCimMaterials({textureId:i.id,size:a,...this._cimMaterialParametersInfo})}let a=r[i?0:2];if(n==null)return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;let o=this._getPrimitive()==null,s=e.renderingInfo,c=this._hasDrivenColorOrOpacity?this._getDrivenUInt8Color(s,this._materialColor,o):null,l=this._getDrivenRotation(s),u=null;if(!this._fastUpdates?.visualVariables.size){let e=this._size,t=e[0]>e[1]?e[0]:e[1];u=this._getScaleFactor(s,t)}let d=u==null?null:f(u,u),p=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus(p.mode===`on-the-ground`)&&this._setDrapingDependentMaterialParameters(),this.draped?this._createAsOverlay(s,n,a,c,l,d,t.uid):this._createAs3DShape(s,n,a,c,l,d,p,t.uid)}terrainTransparencyChanged(){return this.draped}layerOpacityChanged(){let e=this._getFillColor(),t=this._getOutlineColor();this._forEachMaterial(n=>{n.setParameters({color:e}),n.setParameters({outlineColor:t})})}layerScreenSizePerspectiveChanged(){let e=this._context.screenSizePerspectiveEnabled&&!this.draped?this.view.screenSizePerspective.parameters:null;this._forEachMaterial(t=>{t.setParameters({screenSizePerspective:e})})}updateTransparentMode(e,t){let n=e.stageObject.geometries[0]?.material,r=this._cimData?n?.parameters.textureId:null,i=r?this._cimSymbolMaterials.get(r):this._materials,a=(i?.indexOf(n)??-1)<2,o=i?.[t?a?1:3:a?0:2];o&&o!==n&&e.updateMaterial(o)}updateGeometry(e,t){let n=e.geometry;if(t.type!==`buffer`||this.draped||!n||!this._validateGeometry(n))return!1;let{elevationContext:r,stageObject:i}=t;if(r.mode!==this.getGeometryElevationMode(n))return!1;let a=O(n);if(!a)return!1;r.updateFeatureExpressionFeature(e,this._context.layer);let o=k(i,this._context,a,r);return o!=null&&(t.alignedSampledElevation=o,A(t,a,this._context.elevationProvider),!0)}layerElevationInfoChanged(e,t,n){let r=this._elevationContext.mode,i=ue(q.elevationModeChangeTypes,n,r);if(i!==1)return i;let a=w(r)||r===`absolute-height`;return this.updateGraphics3DGraphicElevationInfo(e,t,()=>a)}slicePlaneEnabledChanged(){return this.draped||this._forEachMaterial(e=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),!0}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return this._getPrimitive()!=null}applyRendererDiff(e,t){for(let n in e.diff)switch(n){case`visualVariables`:if(F(this._fastUpdates,t,this._fastVisualVariableConvertOptions())){let e=this._fastUpdates;this._materials.forEach(t=>t?.setParameters(e.materialParameters))}else return 0;break;default:return 0}return 2}get needsUpdateFocus(){return!0}prepareSymbolLayerPatch(e){if(this._patchTask?.abort(),e.diff.type!==`partial`)return;let t=e.diff.diff;this._preparePatchResource(e,t),this._preparePatchRotation(e,t)}_preparePatchResource(r,c){if(!c.resource||c.resource.type!==`partial`)return;let l=c.resource.diff;if(l?.href?.type!==`complete`)return;let u=l.href.newValue,{textures:d}=this._context.sharedResources;if(u==null||d==null||Y(u)!=null)return;let f=this._getIconSize(),p=f*this._context.graphicsCoreOwner.view.state.pixelRatio;r.symbolLayerStatePatches.push(()=>{this._patchTask=i(this._patchTask),this._patchTask=t(t=>this._context.schedule(async(t,r)=>{let i=await e(d.fromUrl(u,p,{signal:r}));s(r);let c=!i.ok;if(c&&o(i.error),this._textureHandle=a(this._textureHandle),this._patchTask=null,c){this._forEachMaterial(e=>{e.visible=!1,e.setParameters({textureId:null})});let e=`Failed to load (Request for icon resource failed: ${u})`;this.logger.error(new n(`graphics3diconsymbollayer:request-failed`,e));return}this._textureHandle=i.value;let l=i.value.managedTexture;this._size=Z(l,f),this._forEachMaterial(e=>{e.setParameters({textureId:l.id}),e.visible=!0})},t))}),delete l.href}_preparePatchRotation(e,t){if(!t.angle||t.angle.type!==`complete`)return;let n=t.angle.newValue??0,r=n!==0||this._drivenProperties.rotation;e.symbolLayerStatePatches.push(()=>{this._forEachMaterial(e=>e.setParameters({rotation:n,hasRotation:r}))}),delete t.angle}_defaultElevationInfoNoZ(){return ye}_createAs3DShape(e,t,n,r,i,a,o,s){let c=this.getFastUpdateAttrValues(e),l=this._context.layerViewUid,u=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:s,layerViewUid:l}),d=j(this._context,t),f=H(n,d,{normal:K,color:r,rotation:i,size:a,centerOffset:ee,groundDistance:1,featureAttribute:c,olidColor:u}),p=M(this._context,t,f,o,s);if(p==null)return null;let m=new de(this,p.object,null,le,o);return m.setOccludedVisibilityMode(this.symbolLayer.occludedVisibility?.mode),m.hiddenIfDeconflicted=!0,m.alignedSampledElevation=p.sampledElevation,m.needsElevationUpdates=w(o.mode)||o.mode===`absolute-height`,m.getScreenSize=this._createScreenSizeGetter(a,c),m.calculateRelativeScreenBounds=e=>n.calculateRelativeScreenBounds(m.getScreenSize(),1,e),A(m,t,this._context.elevationProvider),m}_createAsOverlay(e,t,n,r,i,a,o){n.renderPriority=this._renderPriority;let s=_();v(t,s,this._context.overlaySR),s[2]=me;let c=this._context.clippingExtent;if(c!=null&&!y(c,s))return null;let l=this.getFastUpdateAttrValues(e),u=this._context.layerViewUid,d=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:o,layerViewUid:u}),f=this._context.drapeSourceRenderer.rendererContext.localOriginFactory.getOrigin(s),p=H(n,f,{normal:K,position:s,groundDistance:0,color:r,rotation:i,size:a,featureAttribute:l,olidColor:d});p.layerViewUid=u,p.graphicUid=o;let m=new fe(this,[p],null,this._context.drapeSourceRenderer);return m.getScreenSize=this._createScreenSizeGetter(a,l),m.calculateRelativeScreenBounds=e=>n.calculateRelativeScreenBounds(m.getScreenSize(),1,e),m}_createScreenSizeGetter(e,t){e??=h;let n=this._outlineSize+2;if(this._fastUpdates&&t){let r=e[0]*this._size[0],i=e[1]*this._size[1];return(e=m())=>{let[a,o]=I(be,this._fastUpdates.materialParameters,t);return e[0]=a*r+n,e[1]=o*i+n,e}}let r=e[0]*this._size[0]+n,i=e[1]*this._size[1]+n;return(e=m())=>(e[0]=r,e[1]=i,e)}_fastVisualVariableConvertOptions(){let e=Math.max(this._size[0],this._size[1]),t=g(e,e,e),n=l,r=e*n,i=g(r,r,r),a=this._getFallbackSize();return new L({supports:{size:!0,color:!0,rotation:!0,opacity:!1},modelSize:t,symbolSize:i,unitInMeters:n,fallbackColor:this._fastVisualVariableFallbackColor,fallbackSize:g(a,a,a)})}_forEachMaterial(e){this._materials.forEach(e),this._cimSymbolMaterials.forEach(t=>t.forEach(e))}test(){return{...super.test(),material:this._materials[0]}}}function _e(e){return e&&e.type===`point-3d`&&e.hasVisibleVerticalOffset()}function J(e){return e==null?!1:e===`cross`||e===`x`}function Y(e){let t=d(e);return t?.mediaType===`application/json`?t.data:void 0}function X(e,t){return e===`relative`?f((t.x||0)+.5,-(t.y||0)+.5):e in D?D[e]:D.center}function Z({parameters:e},t){let n=(e.width??1)/(e.height??1);return n>1?[t,Math.round(t/n)]:[Math.round(t*n),t]}function Q(e){return e.resource?.href?null:e.resource?.primitive??ae}function ve(e){return(e.material?.color?.a??1)===1&&Q(e)!=null}const ye={mode:`relative-to-ground`,offset:0},be=_();function $(e,t,n,r){let i={...t,focusAreaStyle:n};return e[0]=new W(t,r),e[1]=new W(t,r,!0),e[2]=new W(i,r),e[3]=new W(i,r,!0),e}export{q as Graphics3DIconSymbolLayer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__addDisposableResource as e,__disposeResources as t}from"tslib";import n from"../../../../core/Error.js";import{disposable as r}from"../../../../core/handleUtils.js";import{translate as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as a,create as o}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as s,scale as c,multiply as l}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as u,fromArray as d}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromArray as p,create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBuffer as h}from"../../../../geometry/projection/projectBuffer.js";import{create as g,fromSubBuffer as _,intersectsClippingArea as v}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as y,doubleArrayFrom as b}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as x}from"../../../../geometry/support/FloatArray.js";import{getCoordinateEquals as S}from"../../../../geometry/support/geometryUtils.js";import{isDrivenOpacityFallbackAlwaysOpaque as C}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{needsElevationUpdates3D as w,evaluateElevationAlignmentAtPoint as ee,SampleElevationInfo as T}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as E}from"./Graphics3DObject3DGraphicLayer.js";import{maxPathLength as D}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as O,nanFallbackColor as k}from"./Graphics3DSymbolLayer.js";import{isValidSize as A}from"./graphicUtils.js";import{ConvertOptions as te,initFastSymbolUpdatesState as ne,updateFastSymbolUpdatesState as re,getSizeAttributeValue as ie,getAttributeValue as j}from"../support/FastSymbolUpdates.js";import{SamplePosition as M}from"../../support/ElevationProvider.js";import{Object3D as N}from"../../webgl-engine/lib/Object3D.js";import{Path as P}from"../../webgl-engine/lib/Path.js";import{PathBuilder as F}from"../../webgl-engine/lib/PathBuilder.js";import{RoundCapBuilder as I,TriangulationCapBuilder as L,NoCapBuilder as R}from"../../webgl-engine/lib/PathCapBuilder.js";import{PathExtruder as z}from"../../webgl-engine/lib/PathExtruder.js";import{PathGeometry as B,isPathGeometry as V}from"../../webgl-engine/lib/PathGeometry.js";import{computeMinimumRotationTangentFrame as H}from"../../webgl-engine/lib/pathGeometryUtils.js";import{quadProfiles as U,circleProfiles as W}from"../../webgl-engine/lib/PathProfile.js";import{newPathVertex as G}from"../../webgl-engine/lib/PathVertex.js";import{PathMaterial as K}from"../../webgl-engine/materials/PathMaterial.js";const q=[`polyline`];class J extends O{constructor(e,t,n,r){super(e,t,n,r,C(t)),this._intrinsicSize=u(1,1),this._upVectorAlignment=1,this.ensureDrapedStatus(!1)}_validateGeometry(e,t,n){return!super._validateGeometry(e,t,n)||e.type!==`polyline`?!1:!e.paths.some(e=>e.length>D)||(this.logger.warn(`Geometry has a path longer than ${D} vertices and cannot be displayed by PathSymbol3DLayer`),!1)}async doLoad(){let e=this.symbolLayer,t=e.width==null?e.height:e.width,r=e.height==null?t:e.height;this._vvConvertOptions=new te({supports:{size:!0,color:!0,rotation:!1,opacity:!0},modelSize:[1,1,1],symbolSize:[t,1,r],unitInMeters:this._context.renderCoordsHelper.unitInMeters,fallbackColor:this._getFallbackOpacityAndColor(k),fallbackSize:[t,1,r]});let i=this._context.renderer?.visualVariables;this._fastUpdates=i?.length?ne(this._context.renderer,this._vvConvertOptions):null;let a=e.anchor||`center`;this._upVectorAlignment=e.profileRotation===`heading`?0:1;let o=e.profile||`circle`;switch(o){default:case`circle`:this._profile=W[a];break;case`quad`:this._profile=U[a]}switch(e.join){case`round`:this._extruder=new z(2);break;default:case`bevel`:this._extruder=new z(1);break;case`miter`:this._extruder=new z(0)}switch(this._cap){case`none`:this._capBuilder=new R;break;case`butt`:default:this._capBuilder=new L(this._profile,1);break;case`square`:this._capBuilder=new L(this._profile,2);break;case`round`:{let e=o===`quad`;this._capBuilder=new I(this._profile,e);break}}let l=this._materialColor,u=this._getCombinedOpacityAndColor(l),f=p(u),m=u[3],h=this.needsDrivenTransparentPass,g=e.material?.emissive,_={diffuse:f,ambient:f,emissiveStrength:(g?.source===`color`?g?.strength:void 0)??0,emissiveSource:1,opacity:m,drivenOpacity:h,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows};if(!this._drivenProperties.size&&(s(this._intrinsicSize,t,r),!(A(this._intrinsicSize[0])&&A(this._intrinsicSize[1]))))throw new n(`graphics3dpathsymbollayer:invalid-size`,`Symbol sizes may not be negative values`);this._fastUpdates?.visualVariables.size||c(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters);let v=this._fastUpdates!=null,y=new K({..._,...this._fastUpdates?.materialParameters,size:d(this._intrinsicSize),upVectorAlignment:this._upVectorAlignment,profile:this._profile,pathCapType:this._capBuilder.type,cutoffAngle:this._extruder.cutoffAngle,pathJoinType:this._extruder.join,hasPathColor:!v&&this._drivenProperties.color,hasPathOpacity:!v&&this._drivenProperties.opacity&&!this._drivenProperties.color,hasPathSize:!v&&this._drivenProperties.size,usePBR:this._context.physicalBasedRenderingEnabled},this._context);this._materials[0]=y,this._updateTransparentDepedentMaterialParameters()}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry,q,this.symbolLayer.type))return null;let n=this.createElevationContextForGraphic(t);return this._createAs3DShape(e,n)}layerOpacityChanged(){let e=this._materialColor,t=this._getCombinedOpacity(e),n=this._materials[0];n&&(n.setParameters({opacity:t}),this._updateTransparentDepedentMaterialParameters())}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,w)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return this._materials[0]?.setParameters({usePBR:this._context.physicalBasedRenderingEnabled}),!0}applyRendererDiff(e,t){for(let n in e.diff)switch(n){case`visualVariables`:if(re(this._fastUpdates,t,this._vvConvertOptions))this._materials[0]?.setParameters(this._fastUpdates.materialParameters);else return 0;break;default:return 0}return 2}_getVertexData(n){let r=0,i=n.paths,a=[],o=n.spatialReference,s=this._context.elevationProvider.spatialReference,c=this._context.renderCoordsHelper.spatialReference,l=S(n.hasZ),u=i.map(n=>{let r={stack:[],error:void 0,hasError:!1};try{let t=$;e(r,se,!1);for(let e=1;e<n.length;++e)l(n[e],n[e-1])&&t.add(e);return t.size===0?n:n.filter((e,n)=>!t.has(n))}catch(e){r.error=e,r.hasError=!0}finally{t(r)}});for(let e of u)r+=e.length;let d=y(r*3),f=0;for(let e of u){a.push({offset:f,numVertices:e.length});for(let t of e)d[f++]=t[0],d[f++]=t[1],d[f++]=n.hasZ?t[2]:0}if(s!=null&&!o.equals(s)&&!h(d,o,0,d,s,0,r))return null;let p;return s!=null&&!s.equals(c)?(p=y(r*3),h(d,s,0,p,c,0,r)):p=b(d),{pathVertexDataInfos:a,vertexDataES:d,vertexDataRS:p}}_createAs3DShape(e,t){let{graphic:n,renderingInfo:r}=e,s=n.geometry,c=this._getVertexData(s);if(c==null)return this.logger.warn(`PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)`),null;if(c.pathVertexDataInfos.length===0)return(s.paths.length===0||!s.paths.some(e=>e.length>0))&&this.logger.warn(`PathSymbol3DLayer geometry failed to be created (no paths were defined)`),null;let l=[],u=g(),d=this._context.renderCoordsHelper,p=new M(c.vertexDataES),m=n.uid,h=x(c.vertexDataRS.length);for(let e of c.pathVertexDataInfos){let n=e.numVertices;if(n<2)continue;let s=e.offset;if(this._context.clippingExtent!=null&&(_(c.vertexDataES,s,n,u),!v(u,this._context.clippingExtent)))continue;let g=[],y=s+n*3;for(let e=s;e<y;e+=3){p.offset=e;let n=ee(p,this._context.elevationProvider,t,d);f(Z,c.vertexDataRS[e],c.vertexDataRS[e+1],c.vertexDataRS[e+2]),d.setAltitude(Z,n),c.vertexDataRS[e]=Z[0],c.vertexDataRS[e+1]=Z[1],c.vertexDataRS[e+2]=Z[2],g.push(G(this._upVectorAlignment))}let b=new P(g,c.vertexDataES,c.vertexDataRS,s,h);Y(b,this._upVectorAlignment,this._context.renderCoordsHelper);let x=new F(b,this._profile,this._extruder,this._capBuilder,this._upVectorAlignment),S=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:m,layerViewUid:this._context.layerViewUid}),C=new B(this._materials[0],x,this._getVisualVariableData(r),S);C.transformation=i(o(),a,x.path.origin),l.push(C)}if(l.length===0)return null;let y=new N({geometries:l,layerViewUid:this._context.layerViewUid,graphicUid:m}),b=new E(this,y,null,(e,t,n,r,i)=>oe(e,t,r,i,this._upVectorAlignment),t,null);return b.alignedSampledElevation=0,b.needsElevationUpdates=w(t.mode),b}_getVisualVariableData(e){if(this._fastUpdates){let{size:t,color:n,opacity:r}=this._fastUpdates.visualVariables;return{sizeAttributeValue:ie(t,e.size),colorAttributeValue:j(n,e.color),opacityAttributeValue:j(r,e.opacity)}}return{size:this._getDrivenSize(e),color:this._getDrivenColor(e),opacity:this._getDrivenOpacity(e)}}_getDrivenSize(e){if(!this._drivenProperties.size)return null;let t=e.size?.output??[`symbol-value`,`symbol-value`,`symbol-value`],n=u(X(t[0],t[2]===`symbol-value`?this.symbolLayer.height||0:t[2],this.symbolLayer.width||0),X(t[2],t[0]===`symbol-value`?this.symbolLayer.width||0:t[0],this.symbolLayer.height||0));return l(n,n,this._intrinsicSize),n}_getDrivenColor(e){return this._drivenProperties.color?this._getDrivenUInt8Color(e,this._materialColor,!1):null}_getDrivenOpacity(e){return this._drivenProperties.opacity&&!this._drivenProperties.color?e.opacity?.output??this._materialColor?.a??0:null}get _materialColor(){return this.symbolLayer.material?.color}_getFallbackOpacityAndColor(e){return this._materialColor?.toUnitRGBA()??e}get _cap(){return this.symbolLayer.cap||`butt`}_updateTransparentDepedentMaterialParameters(){let e=this._materials[0];e&&e.setParameters({cullFace:e.transparent||this._cap===`none`?0:2})}}function Y(e,t,n){let{origin:r,positions:i}=e,a=e.offset;switch(t){default:case 0:for(let t of e.vertices)Z[0]=i[a++]+r[0],Z[1]=i[a++]+r[1],Z[2]=i[a++]+r[2],n.worldUpAtPosition(Z,Z),t.setFrameFromUpVector(Z);break;case 1:Z[0]=i[a]+r[0],Z[1]=i[a+1]+r[1],Z[2]=i[a+2]+r[2],n.worldUpAtPosition(Z,Z),H(e,Z)}}function X(e,t,n){switch(e){case`symbol-value`:return n;case`proportional`:return t;default:return e}}function ae(e,t,n,r){let i=0,{origin:a,vertices:o,positions:s,positionsES:c}=e,l=e.offset+o.length*3;for(let t=e.offset;t<l;t+=3)f(Z,c[t],c[t+1],c[t+2]),n(Z,Q),i+=Q.sampledElevation,Z[0]=s[t]+a[0],Z[1]=s[t+1]+a[1],Z[2]=s[t+2]+a[2],r.setAltitude(Z,Q.z),s[t]=Z[0]-a[0],s[t+1]=Z[1]-a[1],s[t+2]=Z[2]-a[2];return e.updatePathVertexInformation(),i/o.length}function oe(e,t,n,r,i){let a=e.stageObject,o=a.geometries,s=0;for(let e of o){if(!V(e))continue;let o=e.builder.path;s+=ae(o,t,n,r),i!==0&&Y(o,i,r),e.onPathChanged(),a.geometryVertexAttributeUpdated(e,`position`)}return s/o.length}const Z=m(),Q=new T,$=new Set,se=r({remove:()=>$.clear()});export{J as Graphics3DPathSymbolLayer};
|
|
2
|
+
import{__addDisposableResource as e,__disposeResources as t}from"tslib";import n from"../../../../core/Error.js";import{disposable as r}from"../../../../core/handleUtils.js";import{translate as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as a,create as o}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as s,scale as c,multiply as l}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as u,fromArray as d}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromArray as p,create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBuffer as h}from"../../../../geometry/projection/projectBuffer.js";import{create as g,fromSubBuffer as _,intersectsClippingArea as v}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as y,doubleArrayFrom as b}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as x}from"../../../../geometry/support/FloatArray.js";import{getCoordinateEquals as S}from"../../../../geometry/support/geometryUtils.js";import{isDrivenOpacityFallbackAlwaysOpaque as C}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{needsElevationUpdates3D as w,evaluateElevationAlignmentAtPoint as ee,SampleElevationInfo as T}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as E}from"./Graphics3DObject3DGraphicLayer.js";import{maxPathLength as D}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as O,nanFallbackColor as k}from"./Graphics3DSymbolLayer.js";import{isValidSize as A}from"./graphicUtils.js";import{ConvertOptions as te,initFastSymbolUpdatesState as ne,updateFastSymbolUpdatesState as re,getSizeAttributeValue as ie,getAttributeValue as j}from"../support/FastSymbolUpdates.js";import{SamplePosition as M}from"../../support/ElevationProvider.js";import{Object3D as N}from"../../webgl-engine/lib/Object3D.js";import{Path as P}from"../../webgl-engine/lib/Path.js";import{PathBuilder as F}from"../../webgl-engine/lib/PathBuilder.js";import{RoundCapBuilder as I,TriangulationCapBuilder as L,NoCapBuilder as R}from"../../webgl-engine/lib/PathCapBuilder.js";import{PathExtruder as z}from"../../webgl-engine/lib/PathExtruder.js";import{PathGeometry as B,isPathGeometry as V}from"../../webgl-engine/lib/PathGeometry.js";import{computeMinimumRotationTangentFrame as H}from"../../webgl-engine/lib/pathGeometryUtils.js";import{quadProfiles as U,circleProfiles as W}from"../../webgl-engine/lib/PathProfile.js";import{newPathVertex as G}from"../../webgl-engine/lib/PathVertex.js";import{PathMaterial as K}from"../../webgl-engine/materials/PathMaterial.js";const q=[`polyline`];class J extends O{constructor(e,t,n,r){super(e,t,n,r,C(t)),this._intrinsicSize=u(1,1),this._upVectorAlignment=1,this.ensureDrapedStatus(!1)}_validateGeometry(e,t,n){return!super._validateGeometry(e,t,n)||e.type!==`polyline`?!1:!e.paths.some(e=>e.length>D)||(this.logger.warn(`Geometry has a path longer than ${D} vertices and cannot be displayed by PathSymbol3DLayer`),!1)}async doLoad(){let e=this.symbolLayer,t=e.width==null?e.height:e.width,r=e.height==null?t:e.height;this._vvConvertOptions=new te({supports:{size:!0,color:!0,rotation:!1,opacity:!0},modelSize:[1,1,1],symbolSize:[t,1,r],unitInMeters:this._context.renderCoordsHelper.unitInMeters,fallbackColor:this._getFallbackOpacityAndColor(k),fallbackSize:[t,1,r]});let i=this._context.renderer?.visualVariables;this._fastUpdates=i?.length?ne(this._context.renderer,this._vvConvertOptions):null;let a=e.anchor||`center`;this._upVectorAlignment=e.profileRotation===`heading`?0:1;let o=e.profile||`circle`;switch(o){default:case`circle`:this._profile=W[a];break;case`quad`:this._profile=U[a]}switch(e.join){case`round`:this._extruder=new z(2);break;default:case`bevel`:this._extruder=new z(1);break;case`miter`:this._extruder=new z(0)}switch(this._cap){case`none`:this._capBuilder=new R;break;case`butt`:default:this._capBuilder=new L(this._profile,1);break;case`square`:this._capBuilder=new L(this._profile,2);break;case`round`:{let e=o===`quad`;this._capBuilder=new I(this._profile,e);break}}let l=this._materialColor,u=this._getCombinedOpacityAndColor(l),f=p(u),m=u[3],h=this.needsDrivenTransparentPass,g=e.material?.emissive,_={diffuse:f,ambient:f,emissiveStrength:(g?.source===`color`?g?.strength:void 0)??0,emissiveSource:1,opacity:m,drivenOpacity:h,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows};if(!this._drivenProperties.size&&(s(this._intrinsicSize,t,r),!(A(this._intrinsicSize[0])&&A(this._intrinsicSize[1]))))throw new n(`graphics3dpathsymbollayer:invalid-size`,`Symbol sizes may not be negative values`);this._fastUpdates?.visualVariables.size||c(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters);let v=this._fastUpdates!=null,y=new K({..._,...this._fastUpdates?.materialParameters,size:d(this._intrinsicSize),upVectorAlignment:this._upVectorAlignment,profile:this._profile,pathCapType:this._capBuilder.type,cutoffAngle:this._extruder.cutoffAngle,pathJoinType:this._extruder.join,hasPathColor:!v&&this._drivenProperties.color,hasPathOpacity:!v&&this._drivenProperties.opacity&&!this._drivenProperties.color,hasPathSize:!v&&this._drivenProperties.size,usePBR:this._context.physicalBasedRenderingEnabled},this._context);this._materials[0]=y,this._updateTransparentDepedentMaterialParameters()}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry,q,this.symbolLayer.type))return null;let n=this.createElevationContextForGraphic(t);return this._createAs3DShape(e,n)}layerOpacityChanged(){let e=this._materialColor,t=this._getCombinedOpacity(e),n=this._materials[0];n&&(n.setParameters({opacity:t}),this._updateTransparentDepedentMaterialParameters())}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,w)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return this._materials[0]?.setParameters({usePBR:this._context.physicalBasedRenderingEnabled}),!0}applyRendererDiff(e,t){for(let n in e.diff)switch(n){case`visualVariables`:if(re(this._fastUpdates,t,this._vvConvertOptions))this._materials[0]?.setParameters(this._fastUpdates.materialParameters);else return 0;break;default:return 0}return 2}_getVertexData(n){let r=0,i=n.paths,a=[],o=n.spatialReference,s=this._context.elevationProvider.spatialReference,c=this._context.renderCoordsHelper.spatialReference,l=S(n.hasZ),u=i.map(n=>{let r={stack:[],error:void 0,hasError:!1};try{let t=$;e(r,se,!1);for(let e=1;e<n.length;++e)l(n[e],n[e-1])&&t.add(e);return t.size===0?n:n.filter((e,n)=>!t.has(n))}catch(e){r.error=e,r.hasError=!0}finally{t(r)}});for(let e of u)r+=e.length;let d=y(r*3),f=0;for(let e of u){a.push({offset:f,numVertices:e.length});for(let t of e)d[f++]=t[0],d[f++]=t[1],d[f++]=n.hasZ?t[2]:0}if(s!=null&&!o.equals(s)&&!h(d,o,0,d,s,0,r))return null;let p;return s!=null&&!s.equals(c)?(p=y(r*3),h(d,s,0,p,c,0,r)):p=b(d),{pathVertexDataInfos:a,vertexDataES:d,vertexDataRS:p}}_createAs3DShape(e,t){let{graphic:n,renderingInfo:r}=e,s=n.geometry,c=this._getVertexData(s);if(c==null)return this.logger.warn(`PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)`),null;if(c.pathVertexDataInfos.length===0)return s.paths.length!==0&&s.paths.some(e=>e.length>0)||this.logger.warn(`PathSymbol3DLayer geometry failed to be created (no paths were defined)`),null;let l=[],u=g(),d=this._context.renderCoordsHelper,p=new M(c.vertexDataES),m=n.uid,h=x(c.vertexDataRS.length);for(let e of c.pathVertexDataInfos){let n=e.numVertices;if(n<2)continue;let s=e.offset;if(this._context.clippingExtent!=null&&(_(c.vertexDataES,s,n,u),!v(u,this._context.clippingExtent)))continue;let g=[],y=s+n*3;for(let e=s;e<y;e+=3){p.offset=e;let n=ee(p,this._context.elevationProvider,t,d);f(Z,c.vertexDataRS[e],c.vertexDataRS[e+1],c.vertexDataRS[e+2]),d.setAltitude(Z,n),c.vertexDataRS[e]=Z[0],c.vertexDataRS[e+1]=Z[1],c.vertexDataRS[e+2]=Z[2],g.push(G(this._upVectorAlignment))}let b=new P(g,c.vertexDataES,c.vertexDataRS,s,h);Y(b,this._upVectorAlignment,this._context.renderCoordsHelper);let x=new F(b,this._profile,this._extruder,this._capBuilder,this._upVectorAlignment),S=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:m,layerViewUid:this._context.layerViewUid}),C=new B(this._materials[0],x,this._getVisualVariableData(r),S);C.transformation=i(o(),a,x.path.origin),l.push(C)}if(l.length===0)return null;let y=new N({geometries:l,layerViewUid:this._context.layerViewUid,graphicUid:m}),b=new E(this,y,null,(e,t,n,r,i)=>oe(e,t,r,i,this._upVectorAlignment),t,null);return b.alignedSampledElevation=0,b.needsElevationUpdates=w(t.mode),b}_getVisualVariableData(e){if(this._fastUpdates){let{size:t,color:n,opacity:r}=this._fastUpdates.visualVariables;return{sizeAttributeValue:ie(t,e.size),colorAttributeValue:j(n,e.color),opacityAttributeValue:j(r,e.opacity)}}return{size:this._getDrivenSize(e),color:this._getDrivenColor(e),opacity:this._getDrivenOpacity(e)}}_getDrivenSize(e){if(!this._drivenProperties.size)return null;let t=e.size?.output??[`symbol-value`,`symbol-value`,`symbol-value`],n=u(X(t[0],t[2]===`symbol-value`?this.symbolLayer.height||0:t[2],this.symbolLayer.width||0),X(t[2],t[0]===`symbol-value`?this.symbolLayer.width||0:t[0],this.symbolLayer.height||0));return l(n,n,this._intrinsicSize),n}_getDrivenColor(e){return this._drivenProperties.color?this._getDrivenUInt8Color(e,this._materialColor,!1):null}_getDrivenOpacity(e){return this._drivenProperties.opacity&&!this._drivenProperties.color?e.opacity?.output??this._materialColor?.a??0:null}get _materialColor(){return this.symbolLayer.material?.color}_getFallbackOpacityAndColor(e){return this._materialColor?.toUnitRGBA()??e}get _cap(){return this.symbolLayer.cap||`butt`}_updateTransparentDepedentMaterialParameters(){let e=this._materials[0];e&&e.setParameters({cullFace:e.transparent||this._cap===`none`?0:2})}}function Y(e,t,n){let{origin:r,positions:i}=e,a=e.offset;switch(t){default:case 0:for(let t of e.vertices)Z[0]=i[a++]+r[0],Z[1]=i[a++]+r[1],Z[2]=i[a++]+r[2],n.worldUpAtPosition(Z,Z),t.setFrameFromUpVector(Z);break;case 1:Z[0]=i[a]+r[0],Z[1]=i[a+1]+r[1],Z[2]=i[a+2]+r[2],n.worldUpAtPosition(Z,Z),H(e,Z)}}function X(e,t,n){switch(e){case`symbol-value`:return n;case`proportional`:return t;default:return e}}function ae(e,t,n,r){let i=0,{origin:a,vertices:o,positions:s,positionsES:c}=e,l=e.offset+o.length*3;for(let t=e.offset;t<l;t+=3)f(Z,c[t],c[t+1],c[t+2]),n(Z,Q),i+=Q.sampledElevation,Z[0]=s[t]+a[0],Z[1]=s[t+1]+a[1],Z[2]=s[t+2]+a[2],r.setAltitude(Z,Q.z),s[t]=Z[0]-a[0],s[t+1]=Z[1]-a[1],s[t+2]=Z[2]-a[2];return e.updatePathVertexInformation(),i/o.length}function oe(e,t,n,r,i){let a=e.stageObject,o=a.geometries,s=0;for(let e of o){if(!V(e))continue;let o=e.builder.path;s+=ae(o,t,n,r),i!==0&&Y(o,i,r),e.onPathChanged(),a.geometryVertexAttributeUpdated(e,`position`)}return s/o.length}const Z=m(),Q=new T,$=new Set,se=r({remove:()=>$.clear()});export{J as Graphics3DPathSymbolLayer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import has from"../../../../core/has.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{PooledRBush as a}from"../../../../core/libs/rbush/PooledRBush.js";import{fromRect as o}from"../../../../geometry/support/aaBoundingBox.js";import{fromValues as s,create as c}from"../../../../geometry/support/aaBoundingRect.js";import{getInfo as l}from"../../../../geometry/support/spatialReferenceUtils.js";import{getObjectId as u}from"../../../../layers/graphics/dehydratedFeatures.js";let d=class extends t{constructor(e){super(e),this._index=new a(9,has(`esri-csp-restrictions`)?e=>({minX:e.extent[0],minY:e.extent[1],maxX:e.extent[2],maxY:e.extent[3]}):[`.extent[0]`,`.extent[1]`,`.extent[2]`,`.extent[3]`]),this._missing=new Set,this._boundsByFeature=new Map,this.spatialReference=null,this.hasZ=null,this.hasM=null,this.objectIdField=null,this.updating=!1}setup(e){this._addMany(e)}destroy(){this._missing.clear(),this._index=n(this._index),this._boundsByFeature.clear(),this._boundsByFeature=null}update(){this._missing.size>0&&(this._addMany(Array.from(this._missing.values())),this.updating=!1,this._missing.clear())}get updatingRemaining(){return this._missing.size}queryGraphicUIDsInExtent(e,t,n){t!=null&&t.equals(this.spatialReference)&&(this.update(),this._forEachInBounds(e,e=>n(e.graphic.uid)))}add(e){this._missing.add(e),this.updating=!0}remove(e){if(this._missing.delete(e)){this.updating=this._missing.size>0;return}if(!e.extent)return;this._index.remove(e);let t=u(e.graphic,this._get(`objectIdField`));t!=null&&this._boundsByFeature.delete(t)}_addMany(e){if(e.length===0)return;let t=this._get(`objectIdField`);for(let n of e){n.computeExtent(this.spatialReference);let e=u(n.graphic,t);e!=null&&this._boundsByFeature.set(e,n.extent)}this._index.load(e)}clear(){this._index.clear(),this._missing.clear(),this._boundsByFeature.clear(),this.updating=!1}forEachInBounds(e,t){this.update(),this._forEachInBounds(e,t)}_forEachInBounds(e,t){let n=l(this.spatialReference);if(n==null){p(this._index,e,t);return}let r=n.valid;if(e[0]
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import has from"../../../../core/has.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{PooledRBush as a}from"../../../../core/libs/rbush/PooledRBush.js";import{fromRect as o}from"../../../../geometry/support/aaBoundingBox.js";import{fromValues as s,create as c}from"../../../../geometry/support/aaBoundingRect.js";import{getInfo as l}from"../../../../geometry/support/spatialReferenceUtils.js";import{getObjectId as u}from"../../../../layers/graphics/dehydratedFeatures.js";let d=class extends t{constructor(e){super(e),this._index=new a(9,has(`esri-csp-restrictions`)?e=>({minX:e.extent[0],minY:e.extent[1],maxX:e.extent[2],maxY:e.extent[3]}):[`.extent[0]`,`.extent[1]`,`.extent[2]`,`.extent[3]`]),this._missing=new Set,this._boundsByFeature=new Map,this.spatialReference=null,this.hasZ=null,this.hasM=null,this.objectIdField=null,this.updating=!1}setup(e){this._addMany(e)}destroy(){this._missing.clear(),this._index=n(this._index),this._boundsByFeature.clear(),this._boundsByFeature=null}update(){this._missing.size>0&&(this._addMany(Array.from(this._missing.values())),this.updating=!1,this._missing.clear())}get updatingRemaining(){return this._missing.size}queryGraphicUIDsInExtent(e,t,n){t!=null&&t.equals(this.spatialReference)&&(this.update(),this._forEachInBounds(e,e=>n(e.graphic.uid)))}add(e){this._missing.add(e),this.updating=!0}remove(e){if(this._missing.delete(e)){this.updating=this._missing.size>0;return}if(!e.extent)return;this._index.remove(e);let t=u(e.graphic,this._get(`objectIdField`));t!=null&&this._boundsByFeature.delete(t)}_addMany(e){if(e.length===0)return;let t=this._get(`objectIdField`);for(let n of e){n.computeExtent(this.spatialReference);let e=u(n.graphic,t);e!=null&&this._boundsByFeature.set(e,n.extent)}this._index.load(e)}clear(){this._index.clear(),this._missing.clear(),this._boundsByFeature.clear(),this.updating=!1}forEachInBounds(e,t){this.update(),this._forEachInBounds(e,t)}_forEachInBounds(e,t){let n=l(this.spatialReference);if(n==null){p(this._index,e,t);return}let r=n.valid[1]-n.valid[0];if(e[2]-e[0]>=r){p(this._index,s(-1/0,e[1],1/0,e[3],h),t);return}let i=-Math.floor((e[0]-n.valid[0])/r)*r,a=this._index.toJSON(),o=Math.max(-1,Math.ceil((a.minX-(e[2]+i))/r)),c=Math.min(1,Math.floor((a.maxX-(e[0]+i))/r)),u=-i/r,d=u<o||u>c;if(o===0&&c===0&&!d){p(this._index,m(e,i,h),t);return}let f=new Set,g=e=>{let{uid:n}=e.graphic;f.has(n)||(f.add(n),t(e))};d&&p(this._index,e,g);for(let t=o;t<=c;++t)p(this._index,m(e,i+t*r,h),g)}getBounds(e,t){this.update();let n=this._boundsByFeature.get(e);return n?o(t,n):null}};e([r({constructOnly:!0})],d.prototype,`spatialReference`,void 0),e([r({constructOnly:!0})],d.prototype,`hasZ`,void 0),e([r({constructOnly:!0})],d.prototype,`hasM`,void 0),e([r({constructOnly:!0})],d.prototype,`objectIdField`,void 0),e([r()],d.prototype,`updating`,void 0),e([r({readOnly:!0})],d.prototype,`updatingRemaining`,null),d=e([i(`esri.views.3d.layers.graphics.SpatialIndex2D`)],d);const f={minX:0,minY:0,maxX:0,maxY:0};function p(e,t,n){f.minX=t[0],f.minY=t[1],f.maxX=t[2],f.maxY=t[3],e.search(f,n)}function m(e,t,n){return s(e[0]+t,e[1],e[2]+t,e[3],n)}const h=c();export{d as SpatialIndex2D};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{
|
|
2
|
+
import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as t}from"../../../../geometry/support/aaBoundingRect.js";import{Sphere as n}from"../../../../geometry/support/sphere.js";import{sphereIntersectsInfiniteRadialConeConservative as r,sphereIntersectsInfiniteVerticalCylinderConservative as i,finiteVerticalCylinderIntersectsFrustumConservative as a}from"../../support/ElevationAgnosticVisibility.js";import{ElevationRange as o}from"../../support/ElevationRange.js";class s extends o{constructor(e,t){super(NaN,NaN),this.id=e,this.serviceMbsInIndexSR=t,this._serviceMbsInRenderSRElevationAdjusted=new n(0,0,0,-1),this._serviceMbsInRenderSR=new n(0,0,0,-1),this._serviceMbsElevationUpdateExtent=null,this._mbsConeInRenderSR=null}get serviceMbsInRenderSRElevationAdjusted(){return this._serviceMbsInRenderSRElevationAdjusted}updateServiceMbsInRenderSRElevationAdjusted(e){return this._serviceMbsInRenderSRElevationAdjusted.copyFrom(e),this._serviceMbsInRenderSRElevationAdjusted}get serviceMbsInRenderSR(){return this._serviceMbsInRenderSR}updateServiceMbsInRenderSR(e){return this._serviceMbsInRenderSR.copyFrom(e),this._serviceMbsElevationUpdateExtent!=null&&t(this._serviceMbsElevationUpdateExtent),this._serviceMbsInRenderSR}get serviceMbsElevationUpdateExtent(){return this._serviceMbsElevationUpdateExtent??=t()}get mbsConeInRenderSR(){return this._mbsConeInRenderSR}updateMbsConeInRenderSR(e){return this._mbsConeInRenderSR=e.clone(),this._mbsConeInRenderSR}invalidateServiceBVsInRenderSR(){this._serviceMbsInRenderSRElevationAdjusted.invalidate(),this._serviceMbsInRenderSR.invalidate(),this._serviceMbsElevationUpdateExtent!=null&&t(this._serviceMbsElevationUpdateExtent),this._mbsConeInRenderSR=null,this.serviceObbInRenderSR?.invalidate()}shareServiceBVsInRenderSRWith(e){this.serviceObbInRenderSR=e.serviceObbInRenderSR,this._serviceMbsInRenderSRElevationAdjusted=e._serviceMbsInRenderSRElevationAdjusted,this._serviceMbsInRenderSR=e._serviceMbsInRenderSR,this._serviceMbsElevationUpdateExtent=e._serviceMbsElevationUpdateExtent??=t(),this._mbsConeInRenderSR=e._mbsConeInRenderSR}}class c extends s{constructor(e,t,n,r,i,a,o,s,c,l,d){super(e,n),this.index=t,this.childCount=r,this.level=i,this.resources=a,this.version=o,this.lodMetric=s,this.maxError=c,this.numFeatures=l,this.failed=!1,this.cacheState=0,this.vertexCount=0,this.memory=0,this.childrenLoaded=0,this.hasModifications=!1,this.imModificationImpact=4,this.elevationAgnosticBoundingVolume=new u,this.serviceObbInIndexSR=d}invalidateServiceBVsInRenderSR(){super.invalidateServiceBVsInRenderSR(),this.elevationAgnosticBoundingVolume.invalidate()}}class l{constructor(e,t,n,r){this.nodeHasLOD=e,this.isChosen=t,this.lodLevel=n,this.version=r}}class u{constructor(){this._data=[0,0,0,u.invalidRadius]}static{this.invalidRadius=-2}invalidate(){this._data[3]=u.invalidRadius}get valid(){return this._data[3]!==u.invalidRadius}get radius(){return this._data[3]}getAxis(e){return e[0]=this._data[0],e[1]=this._data[1],e[2]=this._data[2],e}set(e,t){this._data[0]=e[0],this._data[1]=e[1],this._data[2]=e[2],this._data[3]=t}intersectsFrustumConservative(e,t,n){if(!this.valid)return!0;let o=this.getAxis(d),{center:s,radius:c}=e.boundingSphere,l=c+n;return t===1?this.radius>f||r(o,this.radius,s,l):i(o,this.radius,s,l)&&a(o,this.radius,s[2]-l,s[2]+l,e.planes)}}const d=e(),f=.9;export{u as ElevationAgnosticBoundingVolume,c as Node,s as NodeBoundingData,l as NodeTraversalState};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../../request.js";import{binaryIndexOf as t}from"../../../../core/arrayUtils.js";import n from"../../../../core/Error.js";import has from"../../../../core/has.js";import{invert as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as a,copy as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as c}from"../../../../geometry/projectionUtils.js";import l from"../../../../geometry/SpatialReference.js";import{projectVectorToVector as u}from"../../../../geometry/projection/projectVectorToVector.js";import{create as d,empty as f,expandPointInPlace as p,intersects as m}from"../../../../geometry/support/aaBoundingRect.js";import{fetchFeaturePopupFeatures as h}from"../../../../layers/support/featurePopupQueryUtils.js";import g from"../../../../rest/support/Query.js";import{readBinaryAttribute as _,getCachedAttributeValue as v}from"./I3SBinaryReader.js";import{computeGlobalTransformation as y}from"./I3SProjectionUtil.js";import{createSolidEdgeMaterial as b,createMaterialFromEdges as x}from"../support/edgeUtils.js";import{parseColorMixMode as ee}from"../support/symbolColorUtils.js";import{Obb as te,compute as ne}from"../../support/orientedBoundingBox.js";import{emissiveStrengthDefault as S}from"../../webgl-engine/core/shaderLibrary/output/getEmissions.glsl.js";import{spatialReferenceIncompatibleError as C}from"../../../support/layerViewUtils.js";function w(e){return e?parseInt(e.slice(e.lastIndexOf(`/`)+1),10):void 0}function T(e){if(has(`disable-feature:i3s-draco`)||!e)return!1;for(let t of e)for(let e of t.geometryBuffers)if(e.compressedAttributes?.encoding===`draco`)return!0;return!1}function E(e,t,n,r){n.traverse(t,t=>{let n=t.serviceMbsInIndexSR;return(n!=null&&k(e,n))!==0&&(r(t),!0)})}function D(e,t,n){let r=0,i=0;for(let a=0;a<t.length&&r<e.length;a++)e[r]===t[a]&&(n(a)&&(e[i]=e[r],i++),r++);e.length=i}function re(e,n,r){let i=0,a=0;for(;i<r.length;)t(e,r[i])>=0===n&&(r[a]=r[i],a++),i++;r.length=a}function ie(e,t){if(t.rotationScale[1]===0&&t.rotationScale[2]===0&&t.rotationScale[3]===0&&t.rotationScale[5]===0&&t.rotationScale[6]===0&&t.rotationScale[7]===0)return O[0]=(e[0]-t.position[0])/t.rotationScale[0],O[1]=(e[1]-t.position[1])/t.rotationScale[4],O[2]=(e[2]-t.position[0])/t.rotationScale[0],O[3]=(e[3]-t.position[1])/t.rotationScale[4],O}const O=d();function k(e,t){let n=t.center[0],r=t.center[1],i=t.radius,a=e[0]-n,o=n-e[2],s=e[1]-r,c=r-e[3],l=Math.max(a,o,0),u=Math.max(s,c,0),d=l*l+u*u;return d>i*i?0:d>0?1:-Math.max(a,o,s,c)>i?3:2}function A(e,t,n){let r=[],i=n?.missingFields,a=n?.originalFields,o=!1;for(let n of e){let e=t?.get(n);e?(a?.push(n),r.push(e.name),n!==e.name&&(o=!0)):i?.push(n)}return n&&`hasMismatchedCasing`in n&&(n.hasMismatchedCasing=o),r}async function ae(e,t,r,i,a,o){if(t.length===0)return[];let s=e.attributeStorageInfo;if(e.associatedLayer!=null)try{return await j(e.associatedLayer,t,i,o)}catch(t){if(e.associatedLayer.loaded)throw t}if(s){let n=oe(e,t,r,a),c=e.parsedUrl.path;return await Promise.allSettled(n.map(t=>M(c,s,t.node,t.indices,i,e.apiKey,e.customParameters,o).then(e=>{for(let n=0;n<t.graphics.length;n++){let r=t.graphics[n],i=e[n];if(r.attributes)for(let e in r.attributes)e in i||(i[e]=r.attributes[e]);r.attributes=i}}))),t}throw new n(`scenelayer:no-attribute-source`,`This scene layer does not have a source for attributes available`)}function oe({globalIdField:e},t,n,r){let i=new Map,a=[],o=r();for(let r of t){let t=r.attributes?.[n],s=t==null?r.getGlobalId():void 0;for(let n=0;n<o.length;n++){let c=o[n],l=se(c,t,e,s);if(l<0)continue;let u=i.get(c.node);u||(u={node:c.node,indices:[],graphics:[]},a.push(u),i.set(c.node,u)),u.indices.push(l),u.graphics.push(r);for(let e=n;e>0;e--)o[e]=o[e-1];o[0]=c;break}}return a}function se(e,t,n,r){if(t!=null&&typeof t==`number`)return e.featureIds.indexOf(t);if(r==null||n==null)return-1;let i=e.attributeInfo?.attributeData?.[n];return i?i.indexOf(r):-1}async function j(e,t,n,r){let i=[],a={hasMismatchedCasing:!1,originalFields:i},o=A(n,e.fieldsIndex,a),s=new g({outFields:[...o]});if(await h(e,t,s,{updateSourceAttributes:!0,...r}),!a.hasMismatchedCasing)return t;for(let e=0;e<t.length;e++){let n=t[e];if(n.attributes)for(let e=0;e<i.length;e++){let t=i[e],r=o[e];r in n.attributes&&(n.attributes[t]=n.attributes[r],delete n.attributes[r])}}return t}function M(e,t,n,r,i,a,o,s){return N(e,t,n.resources.attributes,r,i,a,o,s)}async function N(t,n,r,i,a,o,s,c){let l=[];for(let e of n)if(e&&a.includes(e.name)){let n=`${t}/nodes/${r}/attributes/${e.key}/0`;l.push({url:n,storageInfo:e})}let u=await Promise.allSettled(l.map(t=>e(t.url,{responseType:`array-buffer`,query:{...s,token:o},signal:c?.signal}).then(e=>_(t.storageInfo,e.data)))),d=[];for(let e of i){let t={};for(let n=0;n<u.length;n++){let r=u[n];if(r.status===`fulfilled`){let i=r.value;t[l[n].storageInfo.name]=v(i,e)}}d.push(t)}return d}function P(e){let t=e.store,r=t.indexCRS||t.geographicCRS,i=r===void 0?t.indexWKT:void 0;if(i){if(e.spatialReference){if(i!==e.spatialReference.wkt)throw new n(`layerview:store-spatial-reference-wkt-index-incompatible`,`The indexWKT of the scene layer store does not match the WKT of the layer spatial reference`,{})}else throw new n(`layerview:no-store-spatial-reference-wkt-index-and-no-layer-spatial-reference`,`Found indexWKT in the scene layer store but no layer spatial reference`,{})}let a=r?new l(w(r)):e.spatialReference;return a.equals(e.spatialReference)?e.spatialReference:a}function F(e){let t=e.store,r=t.vertexCRS||t.projectedCRS,i=r===void 0?t.vertexWKT:void 0;if(i){if(e.spatialReference){if(i!==e.spatialReference.wkt)throw new n(`layerview:store-spatial-reference-wkt-vertex-incompatible`,`The vertexWKT of the scene layer store does not match the WKT of the layer spatial reference`,{})}else throw new n(`layerview:no-store-spatial-reference-wkt-vertex-and-no-layer-spatial-reference`,`Found vertexWKT in the scene layer store but no layer spatial reference`,{})}let a=r?new l(w(r)):e.spatialReference;return a.equals(e.spatialReference)?e.spatialReference:a}function I(e,t,n){if(!c(e,t)||n===`local`&&!R(e,t))throw C(`scene layer`,e?.wkid,t?.wkid)}function L(e,t,r){if(e.serviceUpdateTimeStamp?.lastUpdate!==t.serviceUpdateTimeStamp?.lastUpdate||!r.isEmpty||e.associatedLayer?.url!==t.associatedLayer?.url)throw new n(`layerview:recycle-failed`,`Could not recycle layerview`)}function R(e,t){return e.equals(t)||e.isWGS84&&t.isWebMercator||e.isWebMercator&&t.isWGS84}function z(e,t,n){let r=P(e),i=F(e);I(r,t,n),I(i,t,n)}function B(e){return!(e.geometryType!=null&&e.geometryType!==`triangles`||e.topology!=null&&e.topology!==`PerAttributeArray`||e.vertexAttributes?.position==null)}function V(e){if(e.store?.defaultGeometrySchema==null||!B(e.store.defaultGeometrySchema))throw new n(`scenelayer:unsupported-geometry-schema`,`The geometry schema of this scene layer is not supported.`,{url:e.parsedUrl.path})}function H(e,t){z(e,t.spatialReference,t.viewingMode)}function U(e){return!(e.geometryType==null||e.geometryType!==`points`||e.topology!=null&&e.topology!==`PerAttributeArray`||e.encoding!=null&&e.encoding!==``&&e.encoding!==`lepcc-xyz`||e.vertexAttributes?.position==null)}function W(e){if(e.store?.defaultGeometrySchema==null||!U(e.store.defaultGeometrySchema))throw new n(`pointcloud:unsupported-geometry-schema`,`The geometry schema of this point cloud scene layer is not supported.`,{})}function G(e,t){I(e.spatialReference,t.spatialReference,t.viewingMode)}function ce(e){return e.type===`simple`||e.type===`class-breaks`||e.type===`unique-value`}function le(e){return e.type===`mesh-3d`}function ue(e){if(e==null||!ce(e)||(e.type===`unique-value`||e.type===`class-breaks`)&&e.defaultSymbol==null)return!0;let t=e.symbols;if(t.length===0)return!0;for(let e of t){if(!le(e)||e.symbolLayers.length===0)return!0;for(let t of e.symbolLayers.items)if(t.type!==`fill`||t.material?.color==null||t.material.colorMixMode!==`replace`)return!0}return!1}const de=b({color:[0,0,0,0],opacity:0});class K{constructor(){this.edgeMaterial=null,this.material=null,this.castShadows=!0}}function fe(e){let t=new K,n=!1,r=!1;for(let i of e.symbolLayers.items)if(i.type===`fill`&&i.enabled){let e=i.material,a=i.edges;if(e!=null&&!n){let r=e.color,a=ee(e.colorMixMode),o={strength:e.emissive?.strength??S,source:+(e.emissive?.source===`color`)};t.material=r==null?{color:[1,1,1],alpha:1,colorMixMode:1,emissive:o}:{color:[r.r/255,r.g/255,r.b/255],alpha:r.a,colorMixMode:a,emissive:o},t.castShadows=i.castShadows,n=!0}a!=null&&!r&&(t.edgeMaterial=x(a,{}),r=!0)}return t.material||={color:[1,1,1],alpha:1,colorMixMode:1,emissive:{strength:S,source:0}},t}function q(e,t){return(e|0)+(t|0)|0}function pe(e,t,n,i,s,c,l){if(!c||c.length===0||t==null||!e.serviceMbsInIndexSR)return null;let d=y(e.serviceMbsInIndexSR,s,`none`,n,t);r($,d);let h=null,g=()=>{if(!h){if(h=me,f(Y),e.serviceObbInIndexSR!=null){e.serviceObbInIndexSR.transform(X,n,t,s,l),X.getCorners(h);for(let e of h)a(e,e,$),p(Y,e)}else{let r=e.serviceMbsInIndexSR;if(!r)return;let i=r.radius;u(r.center,n,Z,t),a(Z,Z,$),Z[2]+=s;for(let e=0;e<8;++e){let t=e&1?i:-i,n=e&2?i:-i,r=e&4?i:-i,a=h[e];o(a,[Z[0]+t,Z[1]+n,Z[2]+r]),p(Y,a)}}}},_=1/0,v=-1/0,b=e=>{if(e.type!==`replace`)return;let n=e.geometry;if(!n?.hasZ)return;f(J);let r=n.spatialReference||i,o=n.rings.reduce((e,n)=>n.reduce((e,n)=>(u(n,r,Z,t),a(Z,Z,$),p(J,Z),Math.min(Z[2],e)),e),1/0);g(),m(Y,J)&&(_=Math.min(_,o),v=Math.max(v,o))};if(c.forEach(e=>b(e)),_===1/0)return null;let x=(e,t,n)=>{a(Z,n,d),e[t]=Z[0],e[t+1]=Z[1],e[t+2]=Z[2],t+=24,n[2]=_,a(Z,n,d),e[t]=Z[0],e[t+1]=Z[1],e[t+2]=Z[2],t+=24,n[2]=v,a(Z,n,d),e[t]=Z[0],e[t+1]=Z[1],e[t+2]=Z[2]};for(let e=0;e<8;++e)x(Q.data,e*3,h[e]);return ne(Q)}const me=[s(),s(),s(),s(),s(),s(),s(),s()],J=d(),Y=d(),X=new te,Z=s(),Q={data:Array(72),size:3,exclusive:!0,stride:3},$=i();export{K as SymbolInfo,q as addWraparound,G as checkPointCloudLayerCompatibleWithView,W as checkPointCloudLayerValid,L as checkRecyclable,H as checkSceneLayerCompatibleWithView,V as checkSceneLayerValid,I as checkSpatialReference,z as checkSpatialReferences,pe as computeVisibilityObb,T as containsDraco,w as extractWkid,D as filterInPlace,A as findFieldsCaseInsensitive,E as findIntersectingNodes,ie as getClipRect,P as getIndexCrs,fe as getSymbolInfo,F as getVertexCrs,k as intersectBoundingRectWithMbs,R as isSupportedLocalModeProjection,re as objectIdFilter,N as queryAttributesFromCachedAttributesId,ue as rendererNeedsTextures,de as transparentEdgeMaterial,ae as whenGraphicAttributes};
|
|
2
|
+
import e from"../../../../request.js";import{binaryIndexOf as t}from"../../../../core/arrayUtils.js";import n from"../../../../core/Error.js";import has from"../../../../core/has.js";import{invert as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as a,copy as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as c}from"../../../../geometry/projectionUtils.js";import l from"../../../../geometry/SpatialReference.js";import{projectVectorToVector as u}from"../../../../geometry/projection/projectVectorToVector.js";import{create as d,empty as f,expandPointInPlace as p,intersects as m}from"../../../../geometry/support/aaBoundingRect.js";import{fetchFeaturePopupFeatures as h}from"../../../../layers/support/featurePopupQueryUtils.js";import g from"../../../../rest/support/Query.js";import{readBinaryAttribute as _,getCachedAttributeValue as v}from"./I3SBinaryReader.js";import{computeGlobalTransformation as y}from"./I3SProjectionUtil.js";import{createSolidEdgeMaterial as b,createMaterialFromEdges as x}from"../support/edgeUtils.js";import{parseColorMixMode as ee}from"../support/symbolColorUtils.js";import{Obb as te,compute as S}from"../../support/orientedBoundingBox.js";import{emissiveStrengthDefault as C}from"../../webgl-engine/core/shaderLibrary/output/getEmissions.glsl.js";import{spatialReferenceIncompatibleError as w}from"../../../support/layerViewUtils.js";function T(e){return e?parseInt(e.slice(e.lastIndexOf(`/`)+1),10):void 0}function E(e){if(has(`disable-feature:i3s-draco`)||!e)return!1;for(let t of e)for(let e of t.geometryBuffers)if(e.compressedAttributes?.encoding===`draco`)return!0;return!1}function D(e,t,n,r,i){n.traverse(t,t=>i.intersectsElevationUpdate(e,t)?(r(t),!0):!1)}function ne(e,t,n){let r=0,i=0;for(let a=0;a<t.length&&r<e.length;a++)e[r]===t[a]&&(n(a)&&(e[i]=e[r],i++),r++);e.length=i}function re(e,n,r){let i=0,a=0;for(;i<r.length;)t(e,r[i])>=0===n&&(r[a]=r[i],a++),i++;r.length=a}function ie(e,t){if(t.rotationScale[1]===0&&t.rotationScale[2]===0&&t.rotationScale[3]===0&&t.rotationScale[5]===0&&t.rotationScale[6]===0&&t.rotationScale[7]===0)return O[0]=(e[0]-t.position[0])/t.rotationScale[0],O[1]=(e[1]-t.position[1])/t.rotationScale[4],O[2]=(e[2]-t.position[0])/t.rotationScale[0],O[3]=(e[3]-t.position[1])/t.rotationScale[4],O}const O=d();function ae(e,t){let n=t.center[0],r=t.center[1],i=t.radius,a=e[0]-n,o=n-e[2],s=e[1]-r,c=r-e[3],l=Math.max(a,o,0),u=Math.max(s,c,0),d=l*l+u*u;return d>i*i?0:d>0?1:-Math.max(a,o,s,c)>i?3:2}function k(e,t,n){let r=[],i=n?.missingFields,a=n?.originalFields,o=!1;for(let n of e){let e=t?.get(n);e?(a?.push(n),r.push(e.name),n!==e.name&&(o=!0)):i?.push(n)}return n&&`hasMismatchedCasing`in n&&(n.hasMismatchedCasing=o),r}async function oe(e,t,r,i,a,o){if(t.length===0)return[];let s=e.attributeStorageInfo;if(e.associatedLayer!=null)try{return await j(e.associatedLayer,t,i,o)}catch(t){if(e.associatedLayer.loaded)throw t}if(s){let n=se(e,t,r,a),c=e.parsedUrl.path;return await Promise.allSettled(n.map(t=>M(c,s,t.node,t.indices,i,e.apiKey,e.customParameters,o).then(e=>{for(let n=0;n<t.graphics.length;n++){let r=t.graphics[n],i=e[n];if(r.attributes)for(let e in r.attributes)e in i||(i[e]=r.attributes[e]);r.attributes=i}}))),t}throw new n(`scenelayer:no-attribute-source`,`This scene layer does not have a source for attributes available`)}function se({globalIdField:e},t,n,r){let i=new Map,a=[],o=r();for(let r of t){let t=r.attributes?.[n],s=t==null?r.getGlobalId():void 0;for(let n=0;n<o.length;n++){let c=o[n],l=A(c,t,e,s);if(l<0)continue;let u=i.get(c.node);u||(u={node:c.node,indices:[],graphics:[]},a.push(u),i.set(c.node,u)),u.indices.push(l),u.graphics.push(r);for(let e=n;e>0;e--)o[e]=o[e-1];o[0]=c;break}}return a}function A(e,t,n,r){if(t!=null&&typeof t==`number`)return e.featureIds.indexOf(t);if(r==null||n==null)return-1;let i=e.attributeInfo?.attributeData?.[n];return i?i.indexOf(r):-1}async function j(e,t,n,r){let i=[],a={hasMismatchedCasing:!1,originalFields:i},o=k(n,e.fieldsIndex,a),s=new g({outFields:[...o]});if(await h(e,t,s,{updateSourceAttributes:!0,...r}),!a.hasMismatchedCasing)return t;for(let e=0;e<t.length;e++){let n=t[e];if(n.attributes)for(let e=0;e<i.length;e++){let t=i[e],r=o[e];r in n.attributes&&(n.attributes[t]=n.attributes[r],delete n.attributes[r])}}return t}function M(e,t,n,r,i,a,o,s){return N(e,t,n.resources.attributes,r,i,a,o,s)}async function N(t,n,r,i,a,o,s,c){let l=[];for(let e of n)if(e&&a.includes(e.name)){let n=`${t}/nodes/${r}/attributes/${e.key}/0`;l.push({url:n,storageInfo:e})}let u=await Promise.allSettled(l.map(t=>e(t.url,{responseType:`array-buffer`,query:{...s,token:o},signal:c?.signal}).then(e=>_(t.storageInfo,e.data)))),d=[];for(let e of i){let t={};for(let n=0;n<u.length;n++){let r=u[n];if(r.status===`fulfilled`){let i=r.value;t[l[n].storageInfo.name]=v(i,e)}}d.push(t)}return d}function P(e){let t=e.store,r=t.indexCRS||t.geographicCRS,i=r===void 0?t.indexWKT:void 0;if(i){if(e.spatialReference){if(i!==e.spatialReference.wkt)throw new n(`layerview:store-spatial-reference-wkt-index-incompatible`,`The indexWKT of the scene layer store does not match the WKT of the layer spatial reference`,{})}else throw new n(`layerview:no-store-spatial-reference-wkt-index-and-no-layer-spatial-reference`,`Found indexWKT in the scene layer store but no layer spatial reference`,{})}let a=r?new l(T(r)):e.spatialReference;return a.equals(e.spatialReference)?e.spatialReference:a}function F(e){let t=e.store,r=t.vertexCRS||t.projectedCRS,i=r===void 0?t.vertexWKT:void 0;if(i){if(e.spatialReference){if(i!==e.spatialReference.wkt)throw new n(`layerview:store-spatial-reference-wkt-vertex-incompatible`,`The vertexWKT of the scene layer store does not match the WKT of the layer spatial reference`,{})}else throw new n(`layerview:no-store-spatial-reference-wkt-vertex-and-no-layer-spatial-reference`,`Found vertexWKT in the scene layer store but no layer spatial reference`,{})}let a=r?new l(T(r)):e.spatialReference;return a.equals(e.spatialReference)?e.spatialReference:a}function I(e,t,n){if(!c(e,t)||n===`local`&&!R(e,t))throw w(`scene layer`,e?.wkid,t?.wkid)}function L(e,t,r){if(e.serviceUpdateTimeStamp?.lastUpdate!==t.serviceUpdateTimeStamp?.lastUpdate||!r.isEmpty||e.associatedLayer?.url!==t.associatedLayer?.url)throw new n(`layerview:recycle-failed`,`Could not recycle layerview`)}function R(e,t){return e.equals(t)||e.isWGS84&&t.isWebMercator||e.isWebMercator&&t.isWGS84}function z(e,t,n){let r=P(e),i=F(e);I(r,t,n),I(i,t,n)}function B(e){return!(e.geometryType!=null&&e.geometryType!==`triangles`||e.topology!=null&&e.topology!==`PerAttributeArray`||e.vertexAttributes?.position==null)}function V(e){if(e.store?.defaultGeometrySchema==null||!B(e.store.defaultGeometrySchema))throw new n(`scenelayer:unsupported-geometry-schema`,`The geometry schema of this scene layer is not supported.`,{url:e.parsedUrl.path})}function H(e,t){z(e,t.spatialReference,t.viewingMode)}function U(e){return!(e.geometryType==null||e.geometryType!==`points`||e.topology!=null&&e.topology!==`PerAttributeArray`||e.encoding!=null&&e.encoding!==``&&e.encoding!==`lepcc-xyz`||e.vertexAttributes?.position==null)}function W(e){if(e.store?.defaultGeometrySchema==null||!U(e.store.defaultGeometrySchema))throw new n(`pointcloud:unsupported-geometry-schema`,`The geometry schema of this point cloud scene layer is not supported.`,{})}function G(e,t){I(e.spatialReference,t.spatialReference,t.viewingMode)}function ce(e){return e.type===`simple`||e.type===`class-breaks`||e.type===`unique-value`}function le(e){return e.type===`mesh-3d`}function ue(e){if(e==null||!ce(e)||(e.type===`unique-value`||e.type===`class-breaks`)&&e.defaultSymbol==null)return!0;let t=e.symbols;if(t.length===0)return!0;for(let e of t){if(!le(e)||e.symbolLayers.length===0)return!0;for(let t of e.symbolLayers.items)if(t.type!==`fill`||t.material?.color==null||t.material.colorMixMode!==`replace`)return!0}return!1}const de=b({color:[0,0,0,0],opacity:0});class K{constructor(){this.edgeMaterial=null,this.material=null,this.castShadows=!0}}function fe(e){let t=new K,n=!1,r=!1;for(let i of e.symbolLayers.items)if(i.type===`fill`&&i.enabled){let e=i.material,a=i.edges;if(e!=null&&!n){let r=e.color,a=ee(e.colorMixMode),o={strength:e.emissive?.strength??C,source:+(e.emissive?.source===`color`)};t.material=r==null?{color:[1,1,1],alpha:1,colorMixMode:1,emissive:o}:{color:[r.r/255,r.g/255,r.b/255],alpha:r.a,colorMixMode:a,emissive:o},t.castShadows=i.castShadows,n=!0}a!=null&&!r&&(t.edgeMaterial=x(a,{}),r=!0)}return t.material||={color:[1,1,1],alpha:1,colorMixMode:1,emissive:{strength:C,source:0}},t}function q(e,t){return(e|0)+(t|0)|0}function pe(e,t,n,i,s,c,l){if(!c||c.length===0||t==null||!e.serviceMbsInIndexSR)return null;let d=y(e.serviceMbsInIndexSR,s,`none`,n,t);r($,d);let h=null,g=()=>{if(!h){if(h=me,f(Y),e.serviceObbInIndexSR!=null){e.serviceObbInIndexSR.transform(X,n,t,s,l),X.getCorners(h);for(let e of h)a(e,e,$),p(Y,e)}else{let r=e.serviceMbsInIndexSR;if(!r)return;let i=r.radius;u(r.center,n,Z,t),a(Z,Z,$),Z[2]+=s;for(let e=0;e<8;++e){let t=e&1?i:-i,n=e&2?i:-i,r=e&4?i:-i,a=h[e];o(a,[Z[0]+t,Z[1]+n,Z[2]+r]),p(Y,a)}}}},_=1/0,v=-1/0,b=e=>{if(e.type!==`replace`)return;let n=e.geometry;if(!n?.hasZ)return;f(J);let r=n.spatialReference||i,o=n.rings.reduce((e,n)=>n.reduce((e,n)=>(u(n,r,Z,t),a(Z,Z,$),p(J,Z),Math.min(Z[2],e)),e),1/0);g(),m(Y,J)&&(_=Math.min(_,o),v=Math.max(v,o))};if(c.forEach(e=>b(e)),_===1/0)return null;let x=(e,t,n)=>{a(Z,n,d),e[t]=Z[0],e[t+1]=Z[1],e[t+2]=Z[2],t+=24,n[2]=_,a(Z,n,d),e[t]=Z[0],e[t+1]=Z[1],e[t+2]=Z[2],t+=24,n[2]=v,a(Z,n,d),e[t]=Z[0],e[t+1]=Z[1],e[t+2]=Z[2]};for(let e=0;e<8;++e)x(Q.data,e*3,h[e]);return S(Q)}const me=[s(),s(),s(),s(),s(),s(),s(),s()],J=d(),Y=d(),X=new te,Z=s(),Q={data:Array(72),size:3,exclusive:!0,stride:3},$=i();export{K as SymbolInfo,q as addWraparound,G as checkPointCloudLayerCompatibleWithView,W as checkPointCloudLayerValid,L as checkRecyclable,H as checkSceneLayerCompatibleWithView,V as checkSceneLayerValid,I as checkSpatialReference,z as checkSpatialReferences,pe as computeVisibilityObb,E as containsDraco,T as extractWkid,ne as filterInPlace,k as findFieldsCaseInsensitive,D as findIntersectingNodes,ie as getClipRect,P as getIndexCrs,fe as getSymbolInfo,F as getVertexCrs,ae as intersectBoundingRectWithMbs,R as isSupportedLocalModeProjection,re as objectIdFilter,N as queryAttributesFromCachedAttributesId,ue as rendererNeedsTextures,de as transparentEdgeMaterial,oe as whenGraphicAttributes};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{normalize as e,length as t,set as n,equals as r,subtract as i,dot as a,len as o,sqrDist as s,copy as c,scale as l,sub as u,scaleAndAdd as d,distance as f,squaredLength as p,squaredDistance as m,add as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as _}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as v}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingSphere as y}from"../../../../geometry/projection/projectBoundingSphere.js";import{getProjector as b}from"../../../../geometry/projection/projectors.js";import{signedDistance as x,getNormal as S}from"../../../../geometry/support/plane.js";import{isPlateCarree as ee}from"../../../../geometry/support/spatialReferenceUtils.js";import{Sphere as C}from"../../../../geometry/support/sphere.js";import{evaluateElevationAlignmentAtPoint as w}from"../graphics/elevationAlignmentUtils.js";import{ElevationContext as T}from"../graphics/ElevationContext.js";import{createContextWithoutExpressionSupport as E,extractExpressionInfo as D}from"../graphics/featureExpressionInfoUtils.js";import{intersectBoundingRectWithMbs as O}from"./I3SUtil.js";import{Frustum as k}from"../../state/Frustum.js";import{Obb as A,computeOffsetObb as j}from"../../support/orientedBoundingBox.js";import{SweptSphereCylindricalVolume as M,SphereGlobal as N,SweptSphereConicalVolume as P}from"../../support/SweptSphereVolume.js";const F=1e5;class te{get _frustumPlanes(){return this._frustum.planes}constructor(e,t,n,r,i,a,o,s,c={}){this._indexSR=e,this._renderCoordsHelper=t,this._clippingArea=i,this._elevationProvider=a,this._viewingMode=o,this._options=c,this._viewDirection=g(),this._useFrustumCulling=!1,this._poi=g(),this._cameraPOIDirection=g(),this._elevationContext=null,this.minCenterDistance=1/0,this.maxCenterDistance=0,this.maxLodLevel=2,this._screenspaceErrorBias=c.screenspaceErrorBias||1,this._progressiveLoadFactor=c.progressiveLoadFactor||1,this._frustum=new k(t),this.updateCamera(n,r);let l=this._renderCoordsHelper.spatialReference;this._renderSR=l,this._renderSRSphericalPCPF=v(l),this._isGlobalMode=l===this._renderSRSphericalPCPF,this.updateElevationInfo(s),this._isECEFOBBInLocalMode=this._indexSR.isWGS84&&(l.isWebMercator||ee(l)),this._indexSREllipsoidRadius=_(this._indexSR).radius,this._indexSRSphericalPCPF=v(e),this._projectorIndexSRToIndexSRSphericalPCPF=b(this._indexSR,this._indexSRSphericalPCPF)}updateElevationInfo(e){e==null?this._elevationContext=null:(this._elevationContext=T.fromElevationInfo(e),this._elevationContext.setFeatureExpressionInfoContext(E(D(e,!1))))}updateCamera(t,n){this._useFrustumCulling=n,e(this._viewDirection,t.viewForward),n&&this._frustum.update(t),this._halfScreenPixelSizePerDistance=t.screenPixelSizePerDistance/2,this._camPos=t.eye,this._updateCameraPOIDirection(),this.minCenterDistance=1/0,this.maxCenterDistance=0}setPointOfInterest(e){this._poi=e,this._updateCameraPOIDirection()}updateScreenSpaceErrorBias(e){let t=this._screenspaceErrorBias;return this._screenspaceErrorBias=e,t}updateClippingArea(e){this._clippingArea=e}expandElevationRange(e,t,n){if(this._elevationContext==null)return;let r=e.serviceMbsInIndexSR;if(!r)return;let i=this._elevationContext.mode===`relative-to-scene`?`scene`:`ground`,a=this._elevationProvider;if(a.getSphereElevationRange){let e=a.getSphereElevationRange(r,this._indexSR,i);if(e){n.expandElevationRange(e);return}}let[o,s,c]=r.center,l=a.getElevation(o,s,c,this._indexSR,i);l&&n.expandElevationRangeValues(l,l);let u=t?null:a.getRootElevationRange?.();u&&n.expandElevationRange(u)}calculateServiceMbsInRenderSR(e){let{serviceMbsInRenderSR:t}=e;if(t.isValid)return t;let{serviceMbsInIndexSR:n}=e;if(!n?.isValid)return t;let r=G;return y(n,this._indexSR,r,this._renderSR),e.updateServiceMbsInRenderSR(r)}calculateServiceMbsInRenderSRElevationAdjusted(e){let{serviceMbsInRenderSRElevationAdjusted:t}=e;if(t.isValid)return t;let{serviceMbsInIndexSR:n}=e,r=this.calculateServiceMbsInRenderSR(e);if(!r.isValid||!n?.isValid)return t;let i=G;i.copyFrom(r);let{_elevationContext:a}=this;if(a){let{minElevation:t}=e,{_renderCoordsHelper:r}=this,o=n.center,s=0;if(Number.isFinite(t)){let n=0,c=0,{maxElevation:l}=e,u=o[2];switch(a.mode){case`relative-to-ground`:case`relative-to-scene`:n=a.geometryZWithOffset(u,r)+t-u,c=l-t;break;case`on-the-ground`:n=t-u,c=l-t}s=n+.5*c,i.radius+=.5*c}else i.radius<F&&(s=w(o,this._elevationProvider,a,r)-o[2]);s&&ae(i,s,this._viewingMode)}return e.updateServiceMbsInRenderSRElevationAdjusted(i)}_isGlobalMbsContainingPlanetCenter(e){return this._viewingMode===1&&t(e.center)<=e.radius}calculateMbsConeInRenderSR(e){let{mbsConeInRenderSR:t}=e;if(t)return t;if(!e.elevationRangeValid)return null;let{minElevation:n,maxElevation:r}=e;if(!Number.isFinite(n)||!(n<r))return null;let i=this.calculateServiceMbsInRenderSR(e);if(!i.isValid)return null;let a=this._elevationContext;if(a?.mode===`relative-to-ground`||a?.mode===`relative-to-scene`){let t=e.serviceMbsInIndexSR;if(!t?.isValid)return null;let i=t.center[2],o=a.geometryZWithOffset(i,this._renderCoordsHelper);if(this._viewingMode===2)n+=o,r+=o;else{let e=o-i;n+=e,r+=e}}let o=this._renderCoordsHelper.referenceEllipsoid.radius,s=this._viewingMode===2?new M(i,n,r):this._isGlobalMbsContainingPlanetCenter(i)?new N(i,o+n,o+r):new P(i,o+n,o+r);return e.updateMbsConeInRenderSR(s)}getAndUpdateVisibilityObbInRenderSR(e){{let t=e.visibilityObbInRenderSR;if(t)return t}let t=this._indexSREllipsoidRadius*.01,{serviceMbsInIndexSR:r,serviceObbInIndexSR:i}=e;if(i==null||!r||!i.isValid||this._isECEFOBBInLocalMode&&(i.halfSizeX>t||i.halfSizeY>t||i.halfSizeZ>t))return null;{let t=e.serviceObbInRenderSR;if(t==null)t=new A,e.serviceObbInRenderSR=t;else if(t.isValid)return t;let a=r.radius,o=0,s=0,c=i.centerZ,l=this._renderCoordsHelper,u=this._elevationContext;if(u&&e.elevationRangeValid){let{minElevation:t,maxElevation:n}=e;switch(u.mode){case`relative-to-ground`:case`relative-to-scene`:o=u.geometryZWithOffset(c,l)+t-c,s=n-t;break;case`on-the-ground`:o=t-c,s=n-t}}else if(u&&a<F){let e=n(R,i.centerX,i.centerY,c);o=w(e,this._elevationProvider,u,l)-c}let d=s>0,f=d?L:t;return i.transform(f,this._indexSR,this._renderSR,o,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),d&&j(f,0,s,this._viewingMode,t),t}}getNodeObbInRenderSRIndependentOfElevationOffset(e){{let t=e.visibilityObbInRenderSR??e.serviceObbInRenderSR??null;if(t?.isValid)return t}let t=e.serviceObbInIndexSR;return t?this._viewingMode===2&&Math.max(t.halfSizeX,t.halfSizeY,t.halfSizeZ)>.2*this._indexSREllipsoidRadius?null:(t.transform(L,this._indexSR,this._renderSR,void 0,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),L):null}ensureElevationAgnosticBoundingVolume(e){return!e.elevationAgnosticBoundingVolume.valid&&e.level>0&&(this._viewingMode===1?this._updateElevationAgnosticBoundingVolumeGlobal(e):this._updateElevationAgnosticBoundingVolumeLocal(e)),e.elevationAgnosticBoundingVolume}_updateCameraPOIDirection(){r(this._poi,this._camPos)?this._cameraPOIDirection=this._viewDirection:(i(this._cameraPOIDirection,this._camPos,this._poi),e(this._cameraPOIDirection,this._cameraPOIDirection))}_updateElevationAgnosticBoundingVolumeGlobal(t){let n=this.getNodeObbInRenderSRIndependentOfElevationOffset(t),r=t.elevationAgnosticBoundingVolume,i=-1,s;if(n){let t=R;n.getCenter(t),e(t,t),s=t,n.getCorners(z);for(let n of z){e(n,n);let o=a(n,t);if(o<=0){r.invalidate();return}let s=Math.sqrt(Math.max(0,1-o*o));i=Math.max(i,s)}}else{let n=t.serviceMbsInRenderSR;if(!n.isValid){r.invalidate();return}let{center:a,radius:c}=n,l=o(a);if(l<c){r.invalidate();return}i=c/l,s=e(W,a)}r.set(s,i+$)}_updateElevationAgnosticBoundingVolumeLocal(e){let t=e.elevationAgnosticBoundingVolume,n=this.getNodeObbInRenderSRIndependentOfElevationOffset(e);if(n){let e=n.getCenter(R);e[2]=0;let r=0,i=B;n.getCorners(z);for(let e of z){e[2]=0;let t=s(i,e);r=Math.max(r,t)}t.set(e,Math.sqrt(r))}else{let n=e.serviceMbsInRenderSR;if(n.isValid){let e=c(R,n.center);e[2]=0,t.set(e,n.radius)}}}isNodeVisible(e){if(!this._isMBSinClippingArea(this.calculateServiceMbsInRenderSR(e)))return!1;if(!this._useFrustumCulling)return!0;let t=this.getAndUpdateVisibilityObbInRenderSR(e);return t?t.intersectsFrustumConservativeApproximation(this._frustumPlanes):this._frustum.intersectsSphere(this.calculateServiceMbsInRenderSRElevationAdjusted(e))}isElevationAgnosticBoundingVolumeVisible(e){return!this._useFrustumCulling||!e.valid?!0:e.intersectsFrustumConservative(this._frustum,this._viewingMode,1)?this._viewingMode!==1||this._isConeVisibleInFrustum(e):!1}_isConeVisibleInFrustum(t){let n=t.radius;if(n>ce)return!0;let r=this._frustumPlanes,{center:i,radius:o}=this._frustum.boundingSphere,s=t.getAxis(W),c=a(s,i),f=o+1,p=c-f,m=c+f;if(p<=0)return!0;let h=l(re,s,p),g=l(ie,s,m),_=n/Math.sqrt(1-n*n);for(let t of r){let n=S(t),r=e(I,n),i=a(r,s);if(Math.abs(1-i)<le)continue;let o=V;l(o,s,i),u(o,o,r),e(o,o);let c=H;if(d(c,h,o,p*_),!(x(t,c)<=0)&&(d(c,g,o,m*_),!(x(t,c)<=0)))return!1}return!0}isObbVisibleIndependentOfElevation(e,t){if(!this._useFrustumCulling||!e.valid)return!0;let{center:n,radius:r}=this._frustum.boundingSphere,i=r+1,o=this._frustumPlanes,s=z;if(t.getCorners(s),this._viewingMode===1){let t=e.getAxis(W),r=a(t,n),c=r-i,u=r+i;if(c<=0)return!0;for(let e of o){let n=!0;for(let r of s){let i=a(r,t),o=U;if(l(o,r,c/i),x(e,o)<=0){n=!1;break}let s=U;if(l(s,r,u/i),x(e,s)<=0){n=!1;break}}if(n)return!1}}else{let e=n[2]-i,t=n[2]+i;for(let n of o){let r=!0,i=S(n),a=i[0],o=i[1],c=i[2],l=n[3];for(let n of s){let i=a*n[0]+o*n[1]+l;if(i+c*e<=0||i+c*t<=0){r=!1;break}}if(r)return!1}}return!0}isGeometryVisible(e){return this._useFrustumCulling?e.geometryObbInRenderSR?.intersectsFrustumConservativeApproximation(this._frustumPlanes)??this.isNodeVisible(e):!0}_isMBSinClippingArea(e){return this._clippingArea==null||O(this._clippingArea,e)!==0}_screenSpaceDiameterMbs(e,t){let n=this.calcCameraDistanceToSurfaceAndUpdateMinmaxWithCenterDistance(e);return n<0?oe:t/n/this._halfScreenPixelSizePerDistance}calcCameraDistanceToSurfaceAndUpdateMinmaxWithCenterDistance(e){let t=this.calculateMbsConeInRenderSR(e);if(t==null)return this.calcCameraDistanceToSurfaceAndUpdateMinmaxWithSphere(e);let n=t.calculateSurfaceDistanceFromPoint(this._camPos),r=t.calculateCenterDistanceFromPoint(this._camPos);return this._updateMinMaxDistanceToCenter(r),n}calcCameraDistanceToSurfaceAndUpdateMinmaxWithSphere(e){return this.calcCameraDistanceToCenterAndUpdateMinmax(e)-this.calculateServiceMbsInRenderSRElevationAdjusted(e).radius}calcCameraDistanceToCenterAndUpdateMinmax(e){let t=this.calculateServiceMbsInRenderSRElevationAdjusted(e),n=f(t.center,this._camPos);return this._updateMinMaxDistanceToCenter(n),n}_calculateAngleDependentLoDForSphere(e,n){let r=u(B,e,this._camPos),i=t(e),o=t(r);if(i===0||o===0)return 1;let s=(Math.abs(a(e,r))/i+n)/o;return Math.min(1,s)}calcAngleDependentLoD(e){let n=this.calculateMbsConeInRenderSR(e);if(n==null){let{center:t,radius:n}=this.calculateServiceMbsInRenderSRElevationAdjusted(e);return this._calculateAngleDependentLoDForSphere(t,n)}let{center:r,radius:i}=this.calculateServiceMbsInRenderSR(e);if(this._viewingMode===2)c(K,r),K[2]=n.lowerCenterHeight,c(q,r),q[2]=n.upperCenterHeight;else{let e=t(r);if(e===0)return 1;l(K,r,n.lowerCenterHeight/e),l(q,r,n.upperCenterHeight/e)}let o=this._calculateAngleDependentLoDForSphere(K,i),s=this._calculateAngleDependentLoDForSphere(q,i);if(this._viewingMode===2)c(J,r),J[2]=Math.max(n.lowerCenterHeight,Math.min(n.upperCenterHeight,this._camPos[2]));else{let e=t(r);if(e===0)return Math.max(o,s);let i=Math.max(n.lowerCenterHeight,Math.min(n.upperCenterHeight,a(this._camPos,r)/e));l(J,r,i/e)}return Math.max(o,s,this._calculateAngleDependentLoDForSphere(J,i))}hasLOD(e){return e.lodMetric!==0}_getDistanceToSurfaceGlobeMode(e,n){let r=t(n.center),o=t(e)-r;l(K,e,a(e,n.center)/p(e));let s=m(n.center,K),c=n.radius;if(s<=c*c)return Math.abs(o);let u=l(K,n.center,1/r),d=c*c/(2*r),g=l(q,u,r-d),_=i(J,e,g),v=i(J,_,l(Y,u,a(u,_))),y=h(J,g,l(J,v,c/t(v))),b=f(e,y);if(o>=X){let n=i(q,e,y),r=a(n,u)/t(n);r<Z&&(r=Q),b/=r}return b}_getDistanceToSurface(e,t){return this._isGlobalMode?this._getDistanceToSurfaceGlobeMode(e,t):ne(e,t)}_applyGlobalFlatAngleCorrectionToConeDistance(e,n){n.calculateClosestCenterToPoint(this._camPos,Y);let r=t(Y);if(r===0||t(this._camPos)-r<X)return e;let o=i(J,this._camPos,Y),s=t(o);if(s===0)return e;let c=a(o,Y)/(s*r);return e/(c<Z?Q:c)}calculateScreenSpaceRelativeSphere(e){let t=this.calculateServiceMbsInRenderSRElevationAdjusted(e),n=this._getDistanceToSurface(this._camPos,t),r=n+t.radius;return this._updateMinMaxDistanceToCenter(r),2*n*this._halfScreenPixelSizePerDistance}calculateScreenSpaceRelativeCone(e){let t=e.calculateCenterDistanceFromPoint(this._camPos);this._updateMinMaxDistanceToCenter(t);let n=e.calculateSurfaceDistanceFromPoint(this._camPos);return 2*(this._isGlobalMode?this._applyGlobalFlatAngleCorrectionToConeDistance(n,e):n)*this._halfScreenPixelSizePerDistance}_updateMinMaxDistanceToCenter(e){e>0?(this.minCenterDistance=Math.min(this.minCenterDistance,e),this.maxCenterDistance=Math.max(this.maxCenterDistance,e)):(this.minCenterDistance=0,this.maxCenterDistance=Math.max(this.maxCenterDistance,-e))}getLodLevel(e){if(e.lodMetric===0)return 0;if(e.childCount===0)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){let t=this._progressiveLoadFactor*this._screenspaceErrorBias,n=this._screenspaceErrorBias;return this.evaluateLODmetric(e,t)?this.evaluateLODmetric(e,n)?2:1:0}return this.evaluateLODmetric(e,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(e,t){switch(e.lodMetric){case 1:{let n=this._screenSpaceDiameterMbs(e,(e.serviceMbsInIndexSR?.radius??0)*t);return this._options.angleDependentLoD&&(n*=this.calcAngleDependentLoD(e)),n<e.maxError}case 2:{let n=this.calculateMbsConeInRenderSR(e),r=n?this.calculateScreenSpaceRelativeCone(n):this.calculateScreenSpaceRelativeSphere(e);return e.maxError*t<=r}case 3:return this._screenSpaceDiameterMbs(e,e.maxError)*t<se;case 4:return this.calcCameraDistanceToSurfaceAndUpdateMinmaxWithCenterDistance(e)>e.maxError*t}return!1}distToCameraPOIRay(e){if(e==null)return 0;let t=this.calculateServiceMbsInRenderSRElevationAdjusted(e),n=t.center,r=a(n,this._cameraPOIDirection),i=r*r,o=p(n)-i;return Math.sqrt(o)-t.radius}distCameraToPOI(){return f(this._camPos,this._poi)}}function ne(e,t){let n=e[0]-t.center[0],r=e[1]-t.center[1],i=e[2]-t.center[2],a=n*n+r*r,o=t.radius;if(a<=o*o)return Math.abs(i);let s=Math.sqrt(a)-o;return Math.sqrt(i*i+s*s)}const re=g(),ie=g(),I=g(),L=new A,R=g(),z=[g(),g(),g(),g(),g(),g(),g(),g()],B=g(),V=g(),H=g(),U=g(),W=g(),G=new C,K=g(),q=g(),J=g(),Y=g();function ae(e,n,r){if(r===2)e.center[2]+=n;else{let r=t(e.center);if(r===0){e.radius+=Math.abs(n);return}l(e.center,e.center,1+n/r)}}const oe=.5*Number.MAX_VALUE,se=10,X=2e5,Z=.08,Q=1e-4,ce=.9,le=.01,$=.001;export{te as default};
|
|
2
|
+
import"../../../../core/has.js";import{normalize as e,length as t,set as n,equals as r,subtract as i,dot as a,len as o,sqrDist as s,copy as c,scale as l,sub as u,scaleAndAdd as d,distance as f,squaredLength as p,squaredDistance as m,add as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as _}from"../../../../geometry/ellipsoidUtils.js";import v from"../../../../geometry/SpatialReference.js";import{getSphericalPCPF as y}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingRect as b}from"../../../../geometry/projection/projectBoundingRect.js";import{projectBoundingSphere as x}from"../../../../geometry/projection/projectBoundingSphere.js";import{getProjector as ee}from"../../../../geometry/projection/projectors.js";import{create as S,fromValues as C}from"../../../../geometry/support/aaBoundingRect.js";import{signedDistance as w,getNormal as T}from"../../../../geometry/support/plane.js";import{isPlateCarree as te,webMercatorValid as ne}from"../../../../geometry/support/spatialReferenceUtils.js";import{Sphere as re}from"../../../../geometry/support/sphere.js";import{evaluateElevationAlignmentAtPoint as E}from"../graphics/elevationAlignmentUtils.js";import{ElevationContext as D}from"../graphics/ElevationContext.js";import{createContextWithoutExpressionSupport as O,extractExpressionInfo as ie}from"../graphics/featureExpressionInfoUtils.js";import{intersectBoundingRectWithMbs as k}from"./I3SUtil.js";import{Frustum as A}from"../../state/Frustum.js";import"../../support/elevationUpdateExtentUtils.js";import{Obb as j,computeOffsetObb as ae}from"../../support/orientedBoundingBox.js";import{SweptSphereCylindricalVolume as oe,SphereGlobal as se,SweptSphereConicalVolume as ce}from"../../support/SweptSphereVolume.js";import{sphereToGeographicExtent as le,intersectsGeographicExtent as ue}from"../../support/sphereExtentUtils.js";const M=1e5;class N{get _frustumPlanes(){return this._frustum.planes}constructor(e,t,n,r,i,a,o,s,c={}){this._indexSR=e,this._renderCoordsHelper=t,this._clippingArea=i,this._elevationProvider=a,this._viewingMode=o,this._options=c,this._viewDirection=g(),this._useFrustumCulling=!1,this._poi=g(),this._cameraPOIDirection=g(),this._elevationContext=null,this.minCenterDistance=1/0,this.maxCenterDistance=0,this.maxLodLevel=2,this._screenspaceErrorBias=c.screenspaceErrorBias||1,this._progressiveLoadFactor=c.progressiveLoadFactor||1,this._frustum=new A(t),this.updateCamera(n,r);let l=this._renderCoordsHelper.spatialReference;this._renderSR=l,this._renderSRSphericalPCPF=y(l),this._isGlobalMode=this._viewingMode===1,this.elevationIntersectionSpatialReference=this._isGlobalMode?this._indexSR.isWebMercator?this._indexSR:this._elevationProvider.spatialReference:l,this.updateElevationInfo(s),this._isECEFOBBInLocalMode=this._indexSR.isWGS84&&(l.isWebMercator||te(l)),this._indexSREllipsoidRadius=_(this._indexSR).radius,this._indexSRSphericalPCPF=y(e),this._projectorIndexSRToIndexSRSphericalPCPF=ee(this._indexSR,this._indexSRSphericalPCPF)}updateElevationInfo(e){e==null?this._elevationContext=null:(this._elevationContext=D.fromElevationInfo(e),this._elevationContext.setFeatureExpressionInfoContext(O(ie(e,!1))))}updateCamera(t,n){this._useFrustumCulling=n,e(this._viewDirection,t.viewForward),n&&this._frustum.update(t),this._halfScreenPixelSizePerDistance=t.screenPixelSizePerDistance/2,this._camPos=t.eye,this._updateCameraPOIDirection(),this.minCenterDistance=1/0,this.maxCenterDistance=0}setPointOfInterest(e){this._poi=e,this._updateCameraPOIDirection()}updateScreenSpaceErrorBias(e){let t=this._screenspaceErrorBias;return this._screenspaceErrorBias=e,t}updateClippingArea(e){this._clippingArea=e}expandElevationRange(e,t,n){if(this._elevationContext==null)return;let r=e.serviceMbsInIndexSR;if(!r)return;let i=this._elevationContext.mode===`relative-to-scene`?`scene`:`ground`,a=this._elevationProvider;if(a.getSphereElevationRange){let e=a.getSphereElevationRange(r,this._indexSR,i);if(e){n.expandElevationRange(e);return}}let[o,s,c]=r.center,l=a.getElevation(o,s,c,this._indexSR,i);l&&n.expandElevationRangeValues(l,l);let u=t?null:a.getRootElevationRange?.();u&&n.expandElevationRange(u)}calculateServiceMbsInRenderSR(e){let{serviceMbsInRenderSR:t}=e;if(t.isValid)return t;let{serviceMbsInIndexSR:n}=e;if(!n?.isValid)return t;let r=G;return x(n,this._indexSR,r,this._renderSR),e.updateServiceMbsInRenderSR(r)}intersectsElevationUpdate(e,t){if(this._isGlobalMode&&this._indexSR.isWebMercator){let n=t.serviceMbsInIndexSR;if(!n?.isValid)return!0;let[r,i]=ne,a=i-r,o=e[2]-e[0]>=a,s=o?0:Math.round((n.center[0]-(e[0]+e[2])/2)/a)*a;return C(o?-1/0:e[0]+s,e[1],o?1/0:e[2]+s,e[3],K),k(K,n)!==0}let n=this.calculateServiceMbsInRenderSR(t);if(!n.isValid)return!0;if(!this._isGlobalMode)return k(e,n)!==0;let r=t.serviceMbsElevationUpdateExtent;return r[0]>r[2]&&(le(n,r),this.elevationIntersectionSpatialReference.isWebMercator&&Number.isFinite(r[0])&&(r[1]=Math.max(-90,r[1]),r[3]=Math.min(90,r[3]),b(r,v.WGS84,r,this.elevationIntersectionSpatialReference)||C(-1/0,-1/0,1/0,1/0,r))),ue(e,r,this.elevationIntersectionSpatialReference)}calculateServiceMbsInRenderSRElevationAdjusted(e){let{serviceMbsInRenderSRElevationAdjusted:t}=e;if(t.isValid)return t;let{serviceMbsInIndexSR:n}=e,r=this.calculateServiceMbsInRenderSR(e);if(!r.isValid||!n?.isValid)return t;let i=G;i.copyFrom(r);let{_elevationContext:a}=this;if(a){let{minElevation:t}=e,{_renderCoordsHelper:r}=this,o=n.center,s=0;if(Number.isFinite(t)){let n=0,c=0,{maxElevation:l}=e,u=o[2];switch(a.mode){case`relative-to-ground`:case`relative-to-scene`:n=a.geometryZWithOffset(u,r)+t-u,c=l-t;break;case`on-the-ground`:n=t-u,c=l-t}s=n+.5*c,i.radius+=.5*c}else i.radius<M&&(s=E(o,this._elevationProvider,a,r)-o[2]);s&&fe(i,s,this._viewingMode)}return e.updateServiceMbsInRenderSRElevationAdjusted(i)}_isGlobalMbsContainingPlanetCenter(e){return this._viewingMode===1&&t(e.center)<=e.radius}calculateMbsConeInRenderSR(e){let{mbsConeInRenderSR:t}=e;if(t)return t;if(!e.elevationRangeValid)return null;let{minElevation:n,maxElevation:r}=e;if(!Number.isFinite(n)||!(n<r))return null;let i=this.calculateServiceMbsInRenderSR(e);if(!i.isValid)return null;let a=this._elevationContext;if(a?.mode===`relative-to-ground`||a?.mode===`relative-to-scene`){let t=e.serviceMbsInIndexSR;if(!t?.isValid)return null;let i=t.center[2],o=a.geometryZWithOffset(i,this._renderCoordsHelper);if(this._viewingMode===2)n+=o,r+=o;else{let e=o-i;n+=e,r+=e}}let o=this._renderCoordsHelper.referenceEllipsoid.radius,s=this._viewingMode===2?new oe(i,n,r):this._isGlobalMbsContainingPlanetCenter(i)?new se(i,o+n,o+r):new ce(i,o+n,o+r);return e.updateMbsConeInRenderSR(s)}getAndUpdateVisibilityObbInRenderSR(e){{let t=e.visibilityObbInRenderSR;if(t)return t}let t=this._indexSREllipsoidRadius*.01,{serviceMbsInIndexSR:r,serviceObbInIndexSR:i}=e;if(i==null||!r||!i.isValid||this._isECEFOBBInLocalMode&&(i.halfSizeX>t||i.halfSizeY>t||i.halfSizeZ>t))return null;{let t=e.serviceObbInRenderSR;if(t==null)t=new j,e.serviceObbInRenderSR=t;else if(t.isValid)return t;let a=r.radius,o=0,s=0,c=i.centerZ,l=this._renderCoordsHelper,u=this._elevationContext;if(u&&e.elevationRangeValid){let{minElevation:t,maxElevation:n}=e;switch(u.mode){case`relative-to-ground`:case`relative-to-scene`:o=u.geometryZWithOffset(c,l)+t-c,s=n-t;break;case`on-the-ground`:o=t-c,s=n-t}}else if(u&&a<M){let e=n(z,i.centerX,i.centerY,c);o=E(e,this._elevationProvider,u,l)-c}let d=s>0,f=d?R:t;return i.transform(f,this._indexSR,this._renderSR,o,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),d&&ae(f,0,s,this._viewingMode,t),t}}getNodeObbInRenderSRIndependentOfElevationOffset(e){{let t=e.visibilityObbInRenderSR??e.serviceObbInRenderSR??null;if(t?.isValid)return t}let t=e.serviceObbInIndexSR;return t?this._viewingMode===2&&Math.max(t.halfSizeX,t.halfSizeY,t.halfSizeZ)>.2*this._indexSREllipsoidRadius?null:(t.transform(R,this._indexSR,this._renderSR,void 0,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),R):null}ensureElevationAgnosticBoundingVolume(e){return!e.elevationAgnosticBoundingVolume.valid&&e.level>0&&(this._viewingMode===1?this._updateElevationAgnosticBoundingVolumeGlobal(e):this._updateElevationAgnosticBoundingVolumeLocal(e)),e.elevationAgnosticBoundingVolume}_updateCameraPOIDirection(){r(this._poi,this._camPos)?this._cameraPOIDirection=this._viewDirection:(i(this._cameraPOIDirection,this._camPos,this._poi),e(this._cameraPOIDirection,this._cameraPOIDirection))}_updateElevationAgnosticBoundingVolumeGlobal(t){let n=this.getNodeObbInRenderSRIndependentOfElevationOffset(t),r=t.elevationAgnosticBoundingVolume,i=-1,s;if(n){let t=z;n.getCenter(t),e(t,t),s=t,n.getCorners(B);for(let n of B){e(n,n);let o=a(n,t);if(o<=0){r.invalidate();return}let s=Math.sqrt(Math.max(0,1-o*o));i=Math.max(i,s)}}else{let n=t.serviceMbsInRenderSR;if(!n.isValid){r.invalidate();return}let{center:a,radius:c}=n,l=o(a);if(l<c){r.invalidate();return}i=c/l,s=e(W,a)}r.set(s,i+_e)}_updateElevationAgnosticBoundingVolumeLocal(e){let t=e.elevationAgnosticBoundingVolume,n=this.getNodeObbInRenderSRIndependentOfElevationOffset(e);if(n){let e=n.getCenter(z);e[2]=0;let r=0,i=V;n.getCorners(B);for(let e of B){e[2]=0;let t=s(i,e);r=Math.max(r,t)}t.set(e,Math.sqrt(r))}else{let n=e.serviceMbsInRenderSR;if(n.isValid){let e=c(z,n.center);e[2]=0,t.set(e,n.radius)}}}isNodeVisible(e){if(!this._isMBSinClippingArea(this.calculateServiceMbsInRenderSR(e)))return!1;if(!this._useFrustumCulling)return!0;let t=this.getAndUpdateVisibilityObbInRenderSR(e);return t?t.intersectsFrustumConservativeApproximation(this._frustumPlanes):this._frustum.intersectsSphere(this.calculateServiceMbsInRenderSRElevationAdjusted(e))}isElevationAgnosticBoundingVolumeVisible(e){return!this._useFrustumCulling||!e.valid?!0:e.intersectsFrustumConservative(this._frustum,this._viewingMode,1)?this._viewingMode!==1||this._isConeVisibleInFrustum(e):!1}_isConeVisibleInFrustum(t){let n=t.radius;if(n>he)return!0;let r=this._frustumPlanes,{center:i,radius:o}=this._frustum.boundingSphere,s=t.getAxis(W),c=a(s,i),f=o+1,p=c-f,m=c+f;if(p<=0)return!0;let h=l(F,s,p),g=l(I,s,m),_=n/Math.sqrt(1-n*n);for(let t of r){let n=T(t),r=e(L,n),i=a(r,s);if(Math.abs(1-i)<ge)continue;let o=H;l(o,s,i),u(o,o,r),e(o,o);let c=de;if(d(c,h,o,p*_),!(w(t,c)<=0)&&(d(c,g,o,m*_),!(w(t,c)<=0)))return!1}return!0}isObbVisibleIndependentOfElevation(e,t){if(!this._useFrustumCulling||!e.valid)return!0;let{center:n,radius:r}=this._frustum.boundingSphere,i=r+1,o=this._frustumPlanes,s=B;if(t.getCorners(s),this._viewingMode===1){let t=e.getAxis(W),r=a(t,n),c=r-i,u=r+i;if(c<=0)return!0;for(let e of o){let n=!0;for(let r of s){let i=a(r,t),o=U;if(l(o,r,c/i),w(e,o)<=0){n=!1;break}let s=U;if(l(s,r,u/i),w(e,s)<=0){n=!1;break}}if(n)return!1}}else{let e=n[2]-i,t=n[2]+i;for(let n of o){let r=!0,i=T(n),a=i[0],o=i[1],c=i[2],l=n[3];for(let n of s){let i=a*n[0]+o*n[1]+l;if(i+c*e<=0||i+c*t<=0){r=!1;break}}if(r)return!1}}return!0}isGeometryVisible(e){return this._useFrustumCulling?e.geometryObbInRenderSR?.intersectsFrustumConservativeApproximation(this._frustumPlanes)??this.isNodeVisible(e):!0}_isMBSinClippingArea(e){return this._clippingArea==null||k(this._clippingArea,e)!==0}_screenSpaceDiameterMbs(e,t){let n=this.calcCameraDistanceToSurfaceAndUpdateMinmaxWithCenterDistance(e);return n<0?pe:t/n/this._halfScreenPixelSizePerDistance}calcCameraDistanceToSurfaceAndUpdateMinmaxWithCenterDistance(e){let t=this.calculateMbsConeInRenderSR(e);if(t==null)return this.calcCameraDistanceToSurfaceAndUpdateMinmaxWithSphere(e);let n=t.calculateSurfaceDistanceFromPoint(this._camPos),r=t.calculateCenterDistanceFromPoint(this._camPos);return this._updateMinMaxDistanceToCenter(r),n}calcCameraDistanceToSurfaceAndUpdateMinmaxWithSphere(e){return this.calcCameraDistanceToCenterAndUpdateMinmax(e)-this.calculateServiceMbsInRenderSRElevationAdjusted(e).radius}calcCameraDistanceToCenterAndUpdateMinmax(e){let t=this.calculateServiceMbsInRenderSRElevationAdjusted(e),n=f(t.center,this._camPos);return this._updateMinMaxDistanceToCenter(n),n}_calculateAngleDependentLoDForSphere(e,n){let r=u(V,e,this._camPos),i=t(e),o=t(r);if(i===0||o===0)return 1;let s=(Math.abs(a(e,r))/i+n)/o;return Math.min(1,s)}calcAngleDependentLoD(e){let n=this.calculateMbsConeInRenderSR(e);if(n==null){let{center:t,radius:n}=this.calculateServiceMbsInRenderSRElevationAdjusted(e);return this._calculateAngleDependentLoDForSphere(t,n)}let{center:r,radius:i}=this.calculateServiceMbsInRenderSR(e);if(this._viewingMode===2)c(q,r),q[2]=n.lowerCenterHeight,c(J,r),J[2]=n.upperCenterHeight;else{let e=t(r);if(e===0)return 1;l(q,r,n.lowerCenterHeight/e),l(J,r,n.upperCenterHeight/e)}let o=this._calculateAngleDependentLoDForSphere(q,i),s=this._calculateAngleDependentLoDForSphere(J,i);if(this._viewingMode===2)c(Y,r),Y[2]=Math.max(n.lowerCenterHeight,Math.min(n.upperCenterHeight,this._camPos[2]));else{let e=t(r);if(e===0)return Math.max(o,s);let i=Math.max(n.lowerCenterHeight,Math.min(n.upperCenterHeight,a(this._camPos,r)/e));l(Y,r,i/e)}return Math.max(o,s,this._calculateAngleDependentLoDForSphere(Y,i))}hasLOD(e){return e.lodMetric!==0}_getDistanceToSurfaceGlobeMode(e,n){let r=t(n.center),o=t(e)-r;l(q,e,a(e,n.center)/p(e));let s=m(n.center,q),c=n.radius;if(s<=c*c)return Math.abs(o);let u=l(q,n.center,1/r),d=c*c/(2*r),g=l(J,u,r-d),_=i(Y,e,g),v=i(Y,_,l(X,u,a(u,_))),y=h(Y,g,l(Y,v,c/t(v))),b=f(e,y);if(o>=Z){let n=i(J,e,y),r=a(n,u)/t(n);r<Q&&(r=$),b/=r}return b}_getDistanceToSurface(e,t){return this._isGlobalMode?this._getDistanceToSurfaceGlobeMode(e,t):P(e,t)}_applyGlobalFlatAngleCorrectionToConeDistance(e,n){n.calculateClosestCenterToPoint(this._camPos,X);let r=t(X);if(r===0||t(this._camPos)-r<Z)return e;let o=i(Y,this._camPos,X),s=t(o);if(s===0)return e;let c=a(o,X)/(s*r);return e/(c<Q?$:c)}calculateScreenSpaceRelativeSphere(e){let t=this.calculateServiceMbsInRenderSRElevationAdjusted(e),n=this._getDistanceToSurface(this._camPos,t),r=n+t.radius;return this._updateMinMaxDistanceToCenter(r),2*n*this._halfScreenPixelSizePerDistance}calculateScreenSpaceRelativeCone(e){let t=e.calculateCenterDistanceFromPoint(this._camPos);this._updateMinMaxDistanceToCenter(t);let n=e.calculateSurfaceDistanceFromPoint(this._camPos);return 2*(this._isGlobalMode?this._applyGlobalFlatAngleCorrectionToConeDistance(n,e):n)*this._halfScreenPixelSizePerDistance}_updateMinMaxDistanceToCenter(e){e>0?(this.minCenterDistance=Math.min(this.minCenterDistance,e),this.maxCenterDistance=Math.max(this.maxCenterDistance,e)):(this.minCenterDistance=0,this.maxCenterDistance=Math.max(this.maxCenterDistance,-e))}getLodLevel(e){if(e.lodMetric===0)return 0;if(e.childCount===0)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){let t=this._progressiveLoadFactor*this._screenspaceErrorBias,n=this._screenspaceErrorBias;return this.evaluateLODmetric(e,t)?this.evaluateLODmetric(e,n)?2:1:0}return this.evaluateLODmetric(e,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(e,t){switch(e.lodMetric){case 1:{let n=this._screenSpaceDiameterMbs(e,(e.serviceMbsInIndexSR?.radius??0)*t);return this._options.angleDependentLoD&&(n*=this.calcAngleDependentLoD(e)),n<e.maxError}case 2:{let n=this.calculateMbsConeInRenderSR(e),r=n?this.calculateScreenSpaceRelativeCone(n):this.calculateScreenSpaceRelativeSphere(e);return e.maxError*t<=r}case 3:return this._screenSpaceDiameterMbs(e,e.maxError)*t<me;case 4:return this.calcCameraDistanceToSurfaceAndUpdateMinmaxWithCenterDistance(e)>e.maxError*t}return!1}distToCameraPOIRay(e){if(e==null)return 0;let t=this.calculateServiceMbsInRenderSRElevationAdjusted(e),n=t.center,r=a(n,this._cameraPOIDirection),i=r*r,o=p(n)-i;return Math.sqrt(o)-t.radius}distCameraToPOI(){return f(this._camPos,this._poi)}}function P(e,t){let n=e[0]-t.center[0],r=e[1]-t.center[1],i=e[2]-t.center[2],a=n*n+r*r,o=t.radius;if(a<=o*o)return Math.abs(i);let s=Math.sqrt(a)-o;return Math.sqrt(i*i+s*s)}const F=g(),I=g(),L=g(),R=new j,z=g(),B=[g(),g(),g(),g(),g(),g(),g(),g()],V=g(),H=g(),de=g(),U=g(),W=g(),G=new re,K=S(),q=g(),J=g(),Y=g(),X=g();function fe(e,n,r){if(r===2)e.center[2]+=n;else{let r=t(e.center);if(r===0){e.radius+=Math.abs(n);return}l(e.center,e.center,1+n/r)}}const pe=.5*Number.MAX_VALUE,me=10,Z=2e5,Q=.08,$=1e-4,he=.9,ge=.01,_e=.001;export{N as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../core/Evented.js";import n from"../../../../core/Logger.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{
|
|
2
|
+
import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../core/Evented.js";import n from"../../../../core/Logger.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/quatf64.js";import{set as o,transformQuatValues as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as l}from"../../../../geometry/projectionUtils.js";import{projectBoundingRect as u}from"../../../../geometry/projection/projectBoundingRect.js";import{projectBoundingSphere as d}from"../../../../geometry/projection/projectBoundingSphere.js";import{create as f,allFinite as p,fromExtent as m}from"../../../../geometry/support/aaBoundingRect.js";import{getInfo as h}from"../../../../geometry/support/spatialReferenceUtils.js";import{Sphere as g}from"../../../../geometry/support/sphere.js";import{ElevationRange as _}from"../../support/ElevationRange.js";import{ElevationUpdateEvent as v}from"../../support/ElevationUpdateEvent.js";import{ProjectedElevationUpdateExtent as y,calculateElevationUpdateExtents as b,fullWorldElevationUpdateExtent as x,planetCenterProximityToleranceMeters as S}from"../../support/elevationUpdateExtentUtils.js";import{Intersector as C}from"../../webgl-engine/lib/Intersector.js";let w=class extends t{constructor(e){super(e),this._renderCoordsHelper=e.view.renderCoordsHelper,this._renderSR=this._renderCoordsHelper.spatialReference,this._layerElevationSource=e.layerElevationSource,this._projectedExtent=new y(this._renderCoordsHelper)}initialize(){this._intersector=new C(this.view.state.viewingMode),this._intersector.options.store=0,this._intersector.options.normalRequired=!1}get spatialReference(){return this.view?.elevationProvider?.spatialReference}getElevation(e,t,r,i){let a=this._renderCoordsHelper,s=o(E,e,t,r);if(!a.toRenderCoords(s,i,s))return n.getLogger(this).error(`could not project point to compute elevation`),null;let{layerElevationSource:c,_intersector:l,intersectionHandler:u}=this,d=c.fullExtent,f=d!=null&&Number.isFinite(d.xmin)&&Number.isFinite(d.xmax)&&Number.isFinite(d.ymin)&&Number.isFinite(d.ymax)&&Number.isFinite(d.zmin)&&Number.isFinite(d.zmax)?new _(d.zmin,d.zmax):c.elevationRange;if(f==null)return null;let p=c.elevationOffset,m=f.minElevation+p,h=f.maxElevation+p,g=a.setAltitude(k,h,s),v=a.setAltitude(A,m,s);return l.reset(g,v,this.view.state.camera),u.intersectRay(l,null,g,v,null,!0),l.results.min.getIntersectionPoint(s)?a.getAltitude(s):null}getElevations(e,t,n){let{groundSpatialReference:r}=this.view;for(let i=0;i<t;++i){let t=i*3,a=e[t],o=e[t+1],s=this.getElevation(a,o,0,r);n(i,s)}}getSphereElevationRange(e,t){return d(e,t,T,this._renderSR),this._layerElevationSource.getElevationRange(T)}getRootElevationRange(){let e=this.layerElevationSource.fullExtent;return e?.hasZ?new _(e.zmin,e.zmax):null}notifyObjectsChanged(e){this._notifyObjectsChanged(e.length,t=>{for(let n of e)if(!t(n))break})}notifyObjectsChangedFunctional(e,t){this._notifyObjectsChanged(e,t)}notifyObjectChanged(e){this._notifyObjectsChanged(1,t=>{t(e)})}_notifyObjectsChanged(e,t){if(e===0)return;let n=this.spatialReference;if(n==null)return;if(!l(this._renderSR,n)){this._emitFullExtentElevationChange(n);return}let r=new Float64Array(4*e),i=!1,a=0;t(e=>this._computeObjectExtent(e,r,a,n)?(a++,!0):(i=!0,!1)),i?this._emitFullExtentElevationChange(n):this._emitElevationChangeEvents(r,n)}_computeObjectExtent(e,t,n,r){if(this.view.state.viewingMode===1&&P(e))return!1;let i=this._projectedExtent;return E[0]=e.centerX,E[1]=e.centerY,E[2]=e.centerZ,i.reset(E,e.radius,r),!this._expandExtent(e,i,r)||!p(i.extent)?!1:(t.set(i.extent,4*n),!0)}_emitElevationChangeEvents(e,t){for(let n of b(e,t))this._emitElevationChangeEvent(n,t)}_emitFullExtentElevationChange(e){let t=f(),n=this._layerElevationSource.fullExtent;if(n!=null&&u(m(n,M),n.spatialReference,t,e)&&p(t)){this._emitElevationChangeEvent(t,e);return}let r=h(e);r!=null&&this._emitElevationChangeEvent(x(e,r),e)}_emitElevationChangeEvent(e,t){let n=new v(t,e,this.intersectionHandler.isGround?`ground`:`scene`);this.emit(`elevation-change`,n)}_expandExtent(e,t,n){e.getCorners(O);for(let e=0;e<8;++e){let r=O[e];if(t.addRenderPoint(r,n)==null)return!1}for(let e=0;e<D.length;e+=2)if(!t.addRenderEdge(O[D[e]],O[D[e+1]],n))return!1;return!0}};e([r({constructOnly:!0})],w.prototype,`layerElevationSource`,void 0),e([r({constructOnly:!0})],w.prototype,`intersectionHandler`,void 0),e([r({constructOnly:!0})],w.prototype,`view`,void 0),e([r()],w.prototype,`spatialReference`,null),w=e([i(`esri.views.3d.layers.i3s.LayerElevationProvider`)],w);const T=new g,E=c(),D=[0,1,2,3,4,5,6,7,0,2,1,3,4,6,5,7,0,4,1,5,2,6,3,7],O=Array.from({length:8},()=>c()),k=c(),A=c(),j=a(),M=f(),N=c();function P(e){N[0]=-e.centerX,N[1]=-e.centerY,N[2]=-e.centerZ,e.getQuaternion(j),s(N,N,-j[0],-j[1],-j[2],j[3]);let t=Math.max(Math.abs(N[0])-e.halfSizeX,0),n=Math.max(Math.abs(N[1])-e.halfSizeY,0),r=Math.max(Math.abs(N[2])-e.halfSizeZ,0);return t*t+n*n+r*r<=S*S}export{w as LayerElevationProvider};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{filterInPlace as n}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import r from"../../../../core/Logger.js";import{getOrCreateMapValue as i}from"../../../../core/MapUtils.js";import{isAbortError as a,throwIfAborted as o}from"../../../../core/promiseUtils.js";import s from"../../../../core/ReactiveMap.js";import{on as c,watch as l}from"../../../../core/reactiveUtils.js";import{schedule as u}from"../../../../core/scheduling.js";import{signal as d}from"../../../../core/signal.js";import{sqlAnd as f}from"../../../../core/sql.js";import{property as p,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{getEpsilon as h}from"../../../../core/libs/gl-matrix-2/math/common.js";import{create as g,equals as _,clone as v,expand as y,toExtent as b,width as x,height as S}from"../../../../geometry/support/aaBoundingRect.js";import{getObjectId as C,hasVertices as w,computeAABR as T}from"../../../../layers/graphics/dehydratedFeatures.js";import{geometryKey as E,transferGeometryKey as D,identicalTransferGeometry as O,completeDehydratedFeatureFromTransfer as k}from"../../../../layers/graphics/transferFeatures.js";import A from"../../../../rest/support/QuantizationParameters.js";import j from"../../../../rest/support/Query.js";import{FeatureMemory as M}from"./FeatureMemory.js";import{MultiFeatureReference as ee,SingleFeatureReference as te}from"./featureReference.js";import{failedFeatureCount as N,FeatureTile as P}from"./FeatureTile.js";import{virtualDisplayFilterHighlightTileId as F,virtualSnapshotTileId as I}from"./FeatureTileDescriptor.js";import{tilesAreRelated as L}from"../../terrain/tileUtils.js";import{ImmediateTask as R,TaskPriority as z}from"../../../support/Scheduler.js";let B=class extends t{set maximumNumberOfFeatures(e){e||=1/0;let t=this._get(`maximumNumberOfFeatures`);e===t||e<1||(this._set(`maximumNumberOfFeatures`,e),this._maximumFeaturesUpdated(t,e))}set memoryFactor(e){this.memoryFactor!==e&&(this._set(`memoryFactor`,e),this._setDirty())}set lodFactor(e){this.lodFactor!==e&&(this._set(`lodFactor`,e),this._supportsResolution&&this.refetch())}get useTileCount(){return this._useTileCount&&this.context.query.queryFeatureCount!=null}set useTileCount(e){this._useTileCount=e,this.notifyChange(`useTileCount`)}get updating(){return this._dirty||!!this._pendingEdits||this._isFetching||(this.tileDescriptors?.updating??!1)}get readyToRun(){return this._dirty}get usedMemory(){return this._memory.usedMemory}get usedMemoryPerFeature(){return this._memory.usedMemoryPerFeature}get totalVertices(){let e=0;return this._featureTiles.forEach(t=>e+=t.numVertices),e}get totalFeatures(){let e=0;return this._featureTiles.forEach(t=>e+=t.numFeatures),e}get showsAllFeatures(){if(this._paused||this.dataUpdating)return!1;for(let e of this._featureTiles.values())if(!this.hasFullGeometries&&e.emptyFeatureRatio!==0||!e.showsAllFeatures)return!1;return!0}get hasFullGeometries(){return!this._supportsResolution||this.tileDescriptors?.some(V)||!this.context.capabilities.supportsQuantization&&this.context.geometryType!==`polyline`}set filterExtent(e){if(e!=null&&this.context.tilingScheme&&!e.spatialReference.equals(this.context.tilingScheme.spatialReference)){r.getLogger(this).error(`#filterExtent=`,`extent needs to be in the same spatial reference as the tiling scheme`);return}let t=this._get(`filterExtent`);if(t===e||t!=null&&e&&t.equals(e))return;let n=e==null?null:e.clone();this._set(`filterExtent`,n),this._reclip(n,t)}_updateTileZQuantization(e){if(this.context.viewingMode===1){let t=e.computeZQuantizationFactor();this._zQuantizationFactor.value<t&&(this._zQuantizationFactor.value=t)}}get _tileZQuantization(){return this.context.isDraped?1:this._zQuantizationFactor.value}constructor(e){super(e),this._useTileCount=!1,this.dataUpdating=!1,this.updatingTotal=0,this.updatingRemaining=0,this.expectedFeatureDiff=0,this.maximumNumberOfFeaturesExceeded=!1,this._fullRatio=1,this._farRatio=1,this._zQuantizationFactor=d(1),this._changes={updates:{adds:[],removes:[]},adds:[],removes:[]},this._featureTiles=new s,this._displayingFeatureReferences=new Map,this._numDisplayingFeatureReferences=0,this._memory=new M(E),this._dirty=!1,this._suspended=!0,this._pendingEdits=null,this._applyEditsTilesUpdated=!1,this.snappingComplexityExceeded=!0,this._isFetching=!1;let t=e.context;this._frameTask=t.scheduler?.registerTask(z.FEATURE_TILE_FETCHER,this)??R,this.FeatureReferenceClass=t.capabilities.supportsMultipleResolutions?ee:te,this._objectIdField=t.objectIdField}initialize(){this.addHandles([c(()=>this.tileDescriptors,`change`,()=>this._setDirty(),{onListenerAdd:()=>this._setDirty(),onListenerRemove:()=>this._setDirty()}),l(()=>this._tileZQuantization,()=>this.refetch())]),this._setDirty()}destroy(){this._frameTask.remove(),this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._removeTile(e)}),this._featureTiles.clear(),this._displayingFeatureReferences.clear(),this._pendingEdits?.controller.abort(),this._pendingEdits=null}get _paused(){return this._suspended||!!this._pendingEdits}restart(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._clearTile(e),this._resetFetchTile(e)}),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._setDirty()}refetch(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._resetFetchTile(e)}),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._setDirty()}refetchDisplayFilterHighlightTile(){let e=this._featureTiles.get(F);e&&(this._cancelFetchTile(e),this._resetFetchTile(e),this._setDirty())}suspend(){this._suspended||(this._suspended=!0,this._pause(),this._setDirty())}resume(){this._suspended&&(this._suspended=!1,this._unpause())}getMissingAttributesForFeature(e){for(let t of this._featureTiles.values()){let n=t.missingAttributes?.get(e);if(n!=null)return n}}_pause(){this._paused&&(this._featureTiles.forEach(e=>this._cancelFetchTile(e)),this._updated())}_unpause(){this._paused||this._setDirty()}get availableFields(){let e=null;return this._featureTiles.forEach(t=>{t.displayingFeatures!=null&&t.displayingFeatures.length!==0&&(e==null?e=new Set(t.availableFields):e.forEach(n=>{t.availableFields?.has(n)||e.delete(n)}))}),e??new Set}applyEdits(e){this._pendingEdits||(this._pendingEdits={edits:Promise.resolve(),count:0,controller:new AbortController},this._pause());let t=this._pendingEdits;t.count++;let n=t.edits.then(()=>e.result.catch(e=>{if(a(e))throw e;return null}).then(e=>e&&(this._applyEditsDeleteFeatures(e.deletedFeatures),this._applyEditsAddUpdateFeatures(e.addedFeatures,e.updatedFeatures,t.controller.signal).then(()=>e))).then(e=>(--t.count===0&&(this._pendingEdits===t&&(this._pendingEdits=null),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._applyEditsTilesUpdated=!1,this._unpause()),e)));return t.edits=n,this._updated(),n}_applyEditsDeleteFeatures(e){if(e.length===0)return;let t=this.context.globalIdField,n=t&&this.availableFields.has(t),i=new Set,a=this._objectIdField;e.forEach(({objectId:e,globalId:o})=>{(!e||e<0)&&t&&o&&(n||r.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected in the view`),e=this._objectIdFromGlobalId(o,a,t)),e!=null&&e>=0&&i.add(e)}),this._featureTiles.forEach(e=>{if(!e.features)return;let t=e.features.filter(e=>!i.has(C(e,this._objectIdField)));t.length!==e.features.length&&(this._applyEditsTileUpdated(),e.setFeatures(t,0,e.availableFields,e.missingAttributes),this._updateTileZQuantization(e),this._invalidateCounts())})}_objectIdFromGlobalId(e,t,n){if(e==null)return null;let r=this.features.find(t=>t.attributes?.[n]===e);return r?C(r,t):null}async _applyEditsAddUpdateFeatures(e,t,n){let{objectIdField:i,globalIdField:a}=this.context,o=a&&this.availableFields.has(a),s=new Set,c=new Set;for(let t of e){let e=t.objectId;e!=null&&s.add(e)}for(let{objectId:e,globalId:n}of t){let t=e;(t==null||t<0)&&a&&(o||r.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${a} to be included the layer's outFields for updates to be reflected in the view`),t=this._objectIdFromGlobalId(n,i,a)),t!=null&&t>=0&&(s.add(t),c.add(t))}if(s.size===0)return;let l=[];this._featureTiles.forEach(e=>{let t=this._applyEditsAddUpdateTile(e,s,c,n);l.push(t)}),this._updated(),await Promise.allSettled(l)}async _applyEditsAddUpdateTile(e,t,n,r){if(!e.features)return;e.fetchingResolution=e.descriptor.resolution;let i=this._createQuery(e);i.resultType=void 0,i.cacheHint=!1,i.objectIds=Array.from(t);let a=await this.context.query.queryFeaturesDehydrated(i,{signal:r,timeout:$}),o=null;if(n.size>0){let t=e.features.filter(e=>!n.has(C(e,this._objectIdField)));t.length!==e.features.length&&(o=t)}if(a.features.length>0){o||=e.features.slice();for(let e of a.features)o.push(e)}o&&(e.hasPreciseFeatureCount&&(e.numFeatures=Math.max(e.numFeatures,o.length)),this._applyEditsTileUpdated(),e.setFeatures(o,0,q(e.availableFields,a.fields),J(e.missingAttributes,a.missingAttributes),void 0,!1),this._updateTileZQuantization(e),this._invalidateCounts())}_applyEditsTileUpdated(){this._applyEditsTilesUpdated||(this._applyEditsTilesUpdated=!0,this._updated())}_queryFeatures(e,t,n){return this.context.query.queryFeaturesDehydrated(e,{signal:n,timeout:$,completeFeatureFromTransfer:(e,n,r)=>{let i=D(e.geometry,n,t),a=this._memory.findGeometry(i,t=>O(e.geometry,n,t));a?e.geometry=a:k(e,n,r)}})}_setDirty(){this._dirty=!0,this._updated()}runTask(e){let t=this._frameTask.processQueue(e);if(!this._dirty||!this.initialized)return t;this._dirty=!1;let n=this._featureTilesArray;if(this._markTilesNotAlive(n),!e.run(()=>this._addTiles(n,e))||!e.run(()=>this._filterExtentTiles(n,e))||!e.run(()=>this._removeTiles(n,e))||e.done){this._setDirty();return}let r=this._sortTiles(n);(!e.run(()=>this._showTiles(r,e))||!e.run(()=>this._fetchTiles(r,e))||!e.run(()=>this._updateMemoryEstimates(r,e)))&&this._setDirty(),this._updated(),this.updating||(this._updateMaximumNumberOfFeaturesExceeded(),this._updateSnappingComplexityExceeded(r))}_updateSnappingComplexityExceeded(e){let t=ie;for(let n of e){if(V(n)||t<=0)break;if(!H(n)&&(t--,n.sampledDensityEstimate>re)){this.snappingComplexityExceeded=!0;return}}this.snappingComplexityExceeded=this._featureTiles.size===0}_markTilesNotAlive(e){for(let t of e)t.alive=!1}_addTiles(e,t){return this._suspended||!this.tileDescriptors?!1:(this.tileDescriptors.forEach(n=>{let r=this._featureTiles.get(n.id);r?r.alive=!0:t.done||(e.push(this._addTile(n)),t.madeProgress())}),t.hasProgressed)}_filterExtentTiles(e,t){for(let n of e){if(t.done)break;n.alive&&(n.filtered=!n.intersects(this.filterExtent),n.filtered&&(this._clearTile(n),t.madeProgress()))}return t.hasProgressed}_removeTiles(e,t){for(let n=e.length-1;n>=0&&!t.done;n--){let r=e[n];r.alive||(this._removeTile(r),n!==e.length-1&&(e[n]=e[e.length-1]),e.pop(),t.madeProgress())}return t.hasProgressed}_sortTiles(e){return e.sort((e,t)=>e.descriptor.loadPriority-t.descriptor.loadPriority),e}_showTiles(e,t){let n=this._updateRatio(e),r=e=>{let t=this._fullRatio<1?n(e)*this._farRatio:1;e.reduceFeatures(t,this.memoryFactor,this._objectIdField,this._reduceMode)&&this._setDirty();let{numFeatures:r,fetchingResolution:i,descriptor:a,isFetched:o}=e;return this._supportsResolution&&r>0&&i!==a.resolution&&o&&(e.requestRefetch(),this._setDirty()),this._showTile(e)};for(let n of e)if(!t.run(()=>r(n))){this._setDirty();break}return t.hasProgressed}_fetchTiles(e,t){if(this._paused)return!1;let n=!1;for(let r of e){if(!r.needsFetch)continue;let e=this.context.memoryCache==null?null:this.context.memoryCache.pop(r.id);if(e?.resolution===r.displayingResolution)r.cache=e,r.numFeatures&&this._notifyDataUpdating(),this._setDirty(),this._scheduleUpdated(),t.madeProgress();else{if(this._needsNumFeatures(r)){let e=new AbortController,i=this._fetchTileCount(r,e.signal);this._handleRequest(r,i,e,()=>r.resetFetching(),()=>r.numFeatures=N),n=!0,t.madeProgress()}if(t.done)return!0}}if(n)return t.hasProgressed;for(let n of e){if(!n.needsFetch)continue;let e=new AbortController,i=this._fetchTile(n,e.signal);if(this._handleRequest(n,i,e,e=>n.fetchDone(e),e=>{n.fetchFailed=!0,this.context.logFetchError(r.getLogger(this),e)}),t.madeProgress(),t.done)return!0}return t.hasProgressed}_updateMemoryEstimates(e,t){return e.some(e=>!t.run(()=>e.updateEstimates())&&(this._setDirty(),!0)),t.hasProgressed}_reclip(e,t){if(!this.initialized)return;let n=[];this._featureTiles.forEach(r=>{r.displayingFeatures!=null&&r.displayingFeatures.length!==0&&(r.intersectionIncludingBorrowed(t,X),r.intersectionIncludingBorrowed(e,Z),_(X,Z)||n.push(r))}),this._refreshDisplayingFeatures(n),this._updated()}_refreshDisplayingFeatures(e){let t=new Set,n=this._changes.updates;for(let r of e)if(r.displayingFeatures!=null)for(let e of r.displayingFeatures){let r=C(e,this._objectIdField);if(t.has(r))continue;t.add(r);let i=this._displayingFeatureReferences.get(r).feature;n.removes.push(i),n.adds.push(i)}this._applyChanges()}_updated(){let e=0;if(this._paused||this._featureTiles.forEach(t=>t.isFetching?++e:0),this._isFetching=e>0,e>0||this._applyEditsTilesUpdated?this._notifyDataUpdating():this._dirty||this._set(`dataUpdating`,!1),this.updating){let t=0,n=0,r=0,i=0,a=0,o=this._displayingFeatureReferences.size/this._numDisplayingFeatureReferences;this._featureTiles.forEach(e=>{if(++n,e.isFetching&&e.hasPreciseFeatureCount){let t=this._maximumFeaturesForTile(e)*(1-e.emptyFeatureRatio),n=e.displayingFeatures==null?0:e.displayingFeatures.length*o;a+=t-n}e.needsFetch?++i:e.numFeatures>0&&(++r,t+=e.numFeatures)}),i+=e;let s=0,c=0;t?(c=t,s=Math.min(i*t/r,t)):(c=n,s=i),a=Math.min(this.maximumNumberOfFeatures-this.features.length,a),this._set(`updatingTotal`,c),this._set(`updatingRemaining`,s),this._set(`expectedFeatureDiff`,a)}else this._set(`updatingTotal`,0),this._set(`updatingRemaining`,0),this._set(`expectedFeatureDiff`,0);this.debugger?.update()}_updateMaximumNumberOfFeaturesExceeded(){for(let{perTileMaximumNumberOfFeaturesExceeded:e}of this._featureTiles.values())if(e){this._set(`maximumNumberOfFeaturesExceeded`,!0);return}this._set(`maximumNumberOfFeaturesExceeded`,!1)}_updateRatio(e){let t=W(e),n=e=>1/(1<<Math.max(0,t-e.descriptor.lij[0])),r=0,i=0;for(let t of e){let e=t.numFeatures;r+=e,i+=e*n(t)}return this._fullRatio=Math.min(1,this.maximumNumberOfFeatures/r),this._farRatio=this.maximumNumberOfFeatures/i,this._scheduleUpdated(),n}_maximumFeaturesUpdated(e,t){e!==t&&(t>e&&this._featureTiles.forEach(e=>{if(!e.featuresMissing)return;let t=this._maximumFeaturesForTile(e);e.isFullyFetched(t)||(this._cancelFetchTile(e),this._resetFetchTile(e))}),this._setDirty())}_addTile(e){let t=new P(e,this._memory);return this._featureTiles.set(t.id,t),this._resetFetchTile(t),this._referenceDisplayingFeaturesFromRelatedTiles(t),t}_referenceDisplayingFeaturesFromRelatedTiles(e){let t=e.displayingResolution;this._featureTiles.forEach(n=>{if(n.displayingFeatures!=null&&e!==n&&L(e.descriptor.lij,n.descriptor.lij)){e.displayingFeatures??=[],e.descriptor.extent&&n.descriptor.extent&&(e.extentIncludingBorrowedFeatures??=v(e.descriptor.extent),y(e.extentIncludingBorrowedFeatures,n.descriptor.extent,e.extentIncludingBorrowedFeatures));for(let r of n.displayingFeatures){e.displayingFeatures.push(r),this._memory.ref(r);let n=this._displayingFeatureReferences.get(C(r,this._objectIdField));n.ref(this._memory,n.feature,t),this._numDisplayingFeatureReferences++}}})}_removeTile(e){this._clearTile(e),this._featureTiles.delete(e.id)}_resetFetchTile(e){e.filtered=!e.intersects(this.filterExtent),e.filtered?e.needsFetch&&e.fetchDone(4):e.requestFetch()}_cancelFetchTile(e){let t=e.requestController;t!=null&&(e.requestController=null,e.resetFetching(),t.abort())}async _fetchTileCount(e,t){e.numFeatures=await this.context.query.queryFeatureCount(this._createFeatureCountQuery(e),{signal:t}),this._updateRatio(this._featureTilesArray)}async _fetchTile(e,t){e.fetchFailed=!1;let n=this._maximumFeaturesForTile(e);if(n<=0)return(!e.hasPreciseFeatureCount||e.numFeatures!==0)&&(e.fetchFailed=!0),G(e),e.fetchInformation.value=`Empty tile`,4;let r=this._getMaxRecordCount(e),i=Math.ceil(n/r);if(e.fetchingResolution=e.descriptor.resolution,U(e)||!this.context.capabilities.supportsMaxRecordCountFactor||e.numFeatures<=n&&i>j.MAX_MAX_RECORD_COUNT_FACTOR)return this._fetchPagedTile(e,t);let a=this._createQuery(e);if(a.maxRecordCountFactor=i,e.isRefetching&&e.features&&e.features.length>0){let t=Math.ceil(e.features.length/(1-e.emptyFeatureRatio)/r);a.maxRecordCountFactor=Math.max(t+1,a.maxRecordCountFactor)}e.fetchInformation.value=`Single fetch\n${n} features`;let{features:s,exceededTransferLimit:c,fields:l,missingAttributes:u}=await this._queryFeatures(a,e.fetchingResolution,t),d=c||a.maxRecordCountFactor>=j.MAX_MAX_RECORD_COUNT_FACTOR||n===this._totalFeaturesForTile(e)?5:4,f=await this._frameTask.schedule(()=>{e.exceededTransferLimit.value=!!c;let t=this._removeEmptyFeatures(s,this._getEffectiveTileResolution(e));return e.fetchInformation.value=`Single fetch\n${s.length}/${n} features`,e.setFeatures(s,t,K(l),J(void 0,u)),this._updateTileZQuantization(e),this._maximumFeaturesForTile(e)>n?1:d},t);return o(t),this._invalidateCounts(),f}async _fetchPagedTile(e,t){let n=0,r=0,i,a=0,s=this._maximumFeaturesForTile(e)-a,c=this._getMaxRecordCount(e),l=null,u;for(;;){let d=this._createQuery(e),f=this._setPagingParameters(d,n,s,c);e.fetchInformation.value=`Paged fetch\n${e.features?.length}/${s} features`;let{features:p,exceededTransferLimit:m,fields:h,missingAttributes:g}=await this._queryFeatures(d,e.fetchingResolution,t);if(await this._frameTask.schedule(()=>{f&&(n+=d.num),a+=p.length,r+=this._removeEmptyFeatures(p,this._getEffectiveTileResolution(e)),e.exceededTransferLimit.value=!!m,i=i?.concat(p)??p,l=q(l,h),u=J(u,g),e.setFeatures(i,r,l,u),this._updateTileZQuantization(e),this._invalidateCounts(),this._setDirty()},t),o(t),s=this._maximumFeaturesForTile(e)-(i?.length??0),!f||!m||s<=0)return m?4:5}}_createFeatureCountQuery(e){let t=this._createQuery(e);return this.context.capabilities.supportsCacheHint&&(t.resultType=void 0,t.cacheHint=!0),t}_createQuery(e){let t=this.context.createQuery();if(t.resultType=this._resultType(e),!U(e)&&e.descriptor.extent&&this.context.tilingScheme&&(t.geometry=b(e.descriptor.extent,this.context.tilingScheme.spatialReference)),this._setResolutionParams(t,e),t.resultType!==`tile`&&this.context.capabilities.supportsCacheHint&&(t.cacheHint=!0),H(e)){let{highlightIds:e}=this.context;e&&e.length>Y&&r.getLogger(this).warn(`highlight-too-many-features`,`highlight is limited to ${Y} features on large layers configured with a display filter to avoid performance issues`),t.objectIds=e?.slice(0,Y)}else!V(e)&&this.context.effectiveDisplayFilter&&(t.where=f(t.where,this.context.effectiveDisplayFilter.where));return t}_setPagingParameters(e,t,n,r){return this.context.capabilities.supportsPagination?(e.start=t,n>0&&this.context.capabilities.supportsMaxRecordCountFactor?(e.maxRecordCountFactor=Math.ceil(n/r),e.num=Math.min(e.maxRecordCountFactor*r,n)):e.num=Math.min(r),!0):!1}_getEffectiveTileResolution(e){if(U(e)||!this._supportsResolution)return null;let t=this.context.viewingMode===1&&this.context.tilingScheme?this.context.tilingScheme.resolutionAtLevel(3):1/0;return Math.min(e.fetchingResolution,t)/this.lodFactor/this._tileZQuantization}get _supportsResolution(){return this.context.capabilities.supportsMultipleResolutions&&this.context.geometryType!==`point`}_setResolutionParams(e,t){let n=this._getEffectiveTileResolution(t);n!=null&&(this.context.capabilities.supportsQuantization?e.quantizationParameters=new A({mode:`view`,originPosition:`upper-left`,tolerance:n,extent:this.context.fullExtent}):this.context.geometryType===`polyline`&&(e.maxAllowableOffset=n))}_removeEmptyFeatures(e,t){let r=e.length;if(t&&this._supportsResolution){let r=t*(1+h());n(e,({geometry:e})=>!e||!w(e)?!1:(T(e,Q),x(Q)>r||S(Q)>r))}else n(e,({geometry:e})=>w(e));return r-e.length}_needsNumFeatures(e){return this.useTileCount&&e.needsFeatureCount&&!V(e)}_getMaxRecordCount(e){switch(this._resultType(e)){case`tile`:if(this.context.tileMaxRecordCount)return this.context.tileMaxRecordCount;break;case`standard`:if(this.context.standardMaxRecordCount)return this.context.standardMaxRecordCount}return this.context.maxRecordCount||Y}_resultType(e){if(this.context.capabilities.supportsResultType)return V(e)?`standard`:`tile`}get _reduceMode(){let e=this.context.geometryType;return e===`polygon`||e===`polyline`?0:1}_handleRequest(e,t,n,r,i){e.startFetch(),e.requestController=n;let o=!1;t.then(t=>{e.requestController=null,r(t)}).catch(t=>{e.requestController===n&&(e.requestController=null,e.fetchDone(4)),a(t)?o=!0:i(t)}).then(()=>{o||this._setDirty(),this._scheduleUpdated()})}_scheduleUpdated(){this.hasHandles(`scheduleUpdated`)||this.addHandles(u(()=>{this.removeHandles(`scheduleUpdated`),this._updated()}),`scheduleUpdated`)}_showTile(e){if(e.displayingFeatures&&!e.needsDisplayUpdate)return!1;let t=e.features;if(e.featureLimit===0||!t){let t=e.displayingFeatures!=null&&e.displayingFeatures.length>0;return this._hideTileFeatures(e),e.displayingFeatures=[],t}let n=e.fetchingResolution,{adds:r,updates:i}=this._changes,a=Math.min(e.featureLimit,t.length);for(let e=0;e<a;++e){let a=t[e],o=C(a,this._objectIdField),s=this._displayingFeatureReferences.get(o);if(this._memory.ref(a),s){let{oldVersion:e,newVersion:t}=s.ref(this._memory,a,n);e!==t&&(e&&i.removes.push(e),t&&i.adds.push(t))}else this._displayingFeatureReferences.set(o,new this.FeatureReferenceClass(a,n,this._memory)),r.push(a);this._numDisplayingFeatureReferences++}return this._hideTileFeatures(e),e.displayingResolution=e.fetchingResolution,this._applyChanges(),e.displayingFeatures=t.slice(0,a),!0}_hideTile(e){this._cancelFetchTile(e),this._hideTileFeatures(e)}_hideTileFeatures(e){if(e.displayingFeatures==null)return;let{updates:t,removes:n}=this._changes;for(let r of e.displayingFeatures){this._memory.unref(r);let i=C(r,this._objectIdField),a=this._displayingFeatureReferences.get(i);if(!a)continue;let{oldVersion:o,newVersion:s}=a.unref(this._memory,e.displayingResolution);this._numDisplayingFeatureReferences--,o!==s&&(s==null?(this._displayingFeatureReferences.delete(i),o&&n.push(o)):(t.adds.push(s),o&&t.removes.push(o)))}this._applyChanges(),e.displayingFeatures=null}_notifyDataUpdating(){this._get(`dataUpdating`)||this._set(`dataUpdating`,!0)}_applyChanges(){let e=this._changes.updates;e.removes.length>0&&(this._notifyDataUpdating(),this.features.removeMany(e.removes),e.removes.length=0),e.adds.length>0&&(this._notifyDataUpdating(),this.features.addMany(e.adds),e.adds.length=0);let t=this._changes.adds,n=this._changes.removes,r=Math.min(t.length,n.length),i=0;for(;i<r;){let e=Math.min(i+ne,r);this._notifyDataUpdating(),this.features.addMany(t.slice(i,e)),this.features.removeMany(n.slice(i,e)),i=e}t.length>r&&(this._notifyDataUpdating(),this.features.addMany(i===0?t:t.slice(i))),n.length>r&&(this._notifyDataUpdating(),this.features.removeMany(i===0?n:n.slice(i))),t.length=0,n.length=0}_clearTile(e){this._hideTile(e),e.features&&this.context.memoryCache!=null&&this.context.memoryCache.put(e.id,e.cache),e.setFeatures(null,0,null,void 0),this._invalidateCounts()}_invalidateCounts(){this.notifyChange(`totalVertices`),this.notifyChange(`totalFeatures`)}get _featureTilesArray(){return Array.from(this._featureTiles.values())}get featureTiles(){return this._featureTiles}get storedFeatures(){return this._featureTilesArray.reduce((e,t)=>e+(t.features?t.features.length:0),0)}get missingTiles(){return this._featureTiles.values().reduce((e,t)=>e+(t.needsFetch||t.isFetching?1:0),0)}_totalFeaturesForTile(e){return e.hasPreciseFeatureCount?e.numFeatures:this.maximumNumberOfFeatures}_maximumFeaturesForTile(e){let t=this._totalFeaturesForTile(e),n=this._fullRatio<1?this._farRatio:1;return Math.min(Math.ceil(t*n/(1-e.emptyFeatureRatio)),t)}get test(){}};e([p({constructOnly:!0})],B.prototype,`features`,void 0),e([p({constructOnly:!0})],B.prototype,`context`,void 0),e([p()],B.prototype,`tileDescriptors`,void 0),e([p({value:1/0})],B.prototype,`maximumNumberOfFeatures`,null),e([p({value:1})],B.prototype,`memoryFactor`,null),e([p({value:1})],B.prototype,`lodFactor`,null),e([p()],B.prototype,`useTileCount`,null),e([p({readOnly:!0})],B.prototype,`updating`,null),e([p({readOnly:!0})],B.prototype,`dataUpdating`,void 0),e([p({readOnly:!0})],B.prototype,`updatingTotal`,void 0),e([p({readOnly:!0})],B.prototype,`updatingRemaining`,void 0),e([p({readOnly:!0})],B.prototype,`expectedFeatureDiff`,void 0),e([p()],B.prototype,`usedMemory`,null),e([p()],B.prototype,`usedMemoryPerFeature`,null),e([p({readOnly:!0})],B.prototype,`maximumNumberOfFeaturesExceeded`,void 0),e([p({readOnly:!0})],B.prototype,`totalVertices`,null),e([p({readOnly:!0})],B.prototype,`totalFeatures`,null),e([p({readOnly:!0})],B.prototype,`showsAllFeatures`,null),e([p({readOnly:!0})],B.prototype,`hasFullGeometries`,null),e([p()],B.prototype,`filterExtent`,null),e([p()],B.prototype,`_dirty`,void 0),e([p()],B.prototype,`_suspended`,void 0),e([p()],B.prototype,`_pendingEdits`,void 0),e([p()],B.prototype,`_applyEditsTilesUpdated`,void 0),e([p()],B.prototype,`_paused`,null),e([p()],B.prototype,`snappingComplexityExceeded`,void 0),e([p()],B.prototype,`_isFetching`,void 0),B=e([m(`esri.views.3d.layers.support.FeatureTileFetcher3D`)],B);function V(e){return e.id===I}function H(e){return e.id===F}function U(e){return V(e)||H(e)}function W(e){let t=0;for(let n of e)n.features&&n.features.length>0&&n.alive&&(t=Math.max(t,n.descriptor.lij[0]));return t}function G(e){e.setFeatures([],0,null,void 0)}function K(e){return e==null?new Set:new Set(e.map(e=>e.name))}function q(e,t){if(e==null||t==null)return K(t);let n=new Set;for(let{name:r}of t)e.has(r)&&n.add(r);return n}function J(e,t){if(!t?.length)return e;e??=new Map;let n=()=>new Set;for(let{objectId:r,attribute:a}of t)i(e,r,n).add(a);return e}const Y=2e3,X=g(),Z=g(),Q=g(),$=6e5,ne=200,re=.95,ie=10;export{B as FeatureTileFetcher3D};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{filterInPlace as n}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import r from"../../../../core/Logger.js";import{getOrCreateMapValue as i}from"../../../../core/MapUtils.js";import{isAbortError as a,throwIfAborted as o}from"../../../../core/promiseUtils.js";import s from"../../../../core/ReactiveMap.js";import{on as c,watch as l}from"../../../../core/reactiveUtils.js";import{schedule as u}from"../../../../core/scheduling.js";import{signal as d}from"../../../../core/signal.js";import{sqlAnd as f}from"../../../../core/sql.js";import{property as p,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{getEpsilon as h}from"../../../../core/libs/gl-matrix-2/math/common.js";import{create as g,equals as _,clone as v,expand as y,toExtent as b,width as x,height as S}from"../../../../geometry/support/aaBoundingRect.js";import{getObjectId as C,hasVertices as w,computeAABR as T}from"../../../../layers/graphics/dehydratedFeatures.js";import{geometryKey as E,transferGeometryKey as D,identicalTransferGeometry as O,completeDehydratedFeatureFromTransfer as k}from"../../../../layers/graphics/transferFeatures.js";import A from"../../../../rest/support/QuantizationParameters.js";import j from"../../../../rest/support/Query.js";import{FeatureMemory as M}from"./FeatureMemory.js";import{MultiFeatureReference as ee,SingleFeatureReference as te}from"./featureReference.js";import{failedFeatureCount as N,FeatureTile as P}from"./FeatureTile.js";import{virtualDisplayFilterHighlightTileId as F,virtualSnapshotTileId as I}from"./FeatureTileDescriptor.js";import{tilesAreRelated as L}from"../../terrain/tileUtils.js";import{ImmediateTask as R,TaskPriority as z}from"../../../support/Scheduler.js";let B=class extends t{set maximumNumberOfFeatures(e){e||=1/0;let t=this._get(`maximumNumberOfFeatures`);e===t||e<1||(this._set(`maximumNumberOfFeatures`,e),this._maximumFeaturesUpdated(t,e))}set memoryFactor(e){this.memoryFactor!==e&&(this._set(`memoryFactor`,e),this._setDirty())}set lodFactor(e){this.lodFactor!==e&&(this._set(`lodFactor`,e),this._supportsResolution&&this.refetch())}get useTileCount(){return this._useTileCount&&this.context.query.queryFeatureCount!=null}set useTileCount(e){this._useTileCount=e,this.notifyChange(`useTileCount`)}get updating(){return this._dirty||!!this._pendingEdits||this._isFetching||(this.tileDescriptors?.updating??!1)}get readyToRun(){return this._dirty}get usedMemory(){return this._memory.usedMemory}get usedMemoryPerFeature(){return this._memory.usedMemoryPerFeature}get totalVertices(){let e=0;return this._featureTiles.forEach(t=>e+=t.numVertices),e}get totalFeatures(){let e=0;return this._featureTiles.forEach(t=>e+=t.numFeatures),e}get showsAllFeatures(){if(this._paused||this.dataUpdating)return!1;for(let e of this._featureTiles.values())if(!this.hasFullGeometries&&e.emptyFeatureRatio!==0||!e.showsAllFeatures)return!1;return!0}get hasFullGeometries(){return!this._supportsResolution||this.tileDescriptors?.some(V)||!this.context.capabilities.supportsQuantization&&this.context.geometryType!==`polyline`}set filterExtent(e){if(e!=null&&this.context.tilingScheme&&!e.spatialReference.equals(this.context.tilingScheme.spatialReference)){r.getLogger(this).error(`#filterExtent=`,`extent needs to be in the same spatial reference as the tiling scheme`);return}let t=this._get(`filterExtent`);if(t===e||t!=null&&e&&t.equals(e))return;let n=e==null?null:e.clone();this._set(`filterExtent`,n),this._reclip(n,t)}_updateTileZQuantization(e){if(this.context.viewingMode===1){let t=e.computeZQuantizationFactor();this._zQuantizationFactor.value<t&&(this._zQuantizationFactor.value=t)}}get _tileZQuantization(){return this.context.isDraped?1:this._zQuantizationFactor.value}constructor(e){super(e),this._useTileCount=!1,this.dataUpdating=!1,this.updatingTotal=0,this.updatingRemaining=0,this.expectedFeatureDiff=0,this.maximumNumberOfFeaturesExceeded=!1,this._fullRatio=1,this._farRatio=1,this._zQuantizationFactor=d(1),this._changes={updates:{adds:[],removes:[]},adds:[],removes:[]},this._featureTiles=new s,this._displayingFeatureReferences=new Map,this._numDisplayingFeatureReferences=0,this._memory=new M(E),this._dirty=!1,this._suspended=!0,this._pendingEdits=null,this._applyEditsTilesUpdated=!1,this.snappingComplexityExceeded=!0,this._isFetching=!1;let t=e.context;this._frameTask=t.scheduler?.registerTask(z.FEATURE_TILE_FETCHER,this)??R,this.FeatureReferenceClass=t.capabilities.supportsMultipleResolutions?ee:te,this._objectIdField=t.objectIdField}initialize(){this.addHandles([c(()=>this.tileDescriptors,`change`,()=>this._setDirty(),{onListenerAdd:()=>this._setDirty(),onListenerRemove:()=>this._setDirty()}),l(()=>this._tileZQuantization,()=>this.refetch())]),this._setDirty()}destroy(){this._frameTask.remove(),this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._removeTile(e)}),this._featureTiles.clear(),this._displayingFeatureReferences.clear(),this._pendingEdits?.controller.abort(),this._pendingEdits=null}get _paused(){return this._suspended||!!this._pendingEdits}restart(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._clearTile(e),this._resetFetchTile(e)}),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._setDirty()}refetch(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._resetFetchTile(e)}),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._setDirty()}refetchDisplayFilterHighlightTile(){let e=this._featureTiles.get(F);e&&(this._cancelFetchTile(e),this._resetFetchTile(e),this._setDirty())}suspend(){this._suspended||(this._suspended=!0,this._pause(),this._setDirty())}resume(){this._suspended&&(this._suspended=!1,this._unpause())}getMissingAttributesForFeature(e){for(let t of this._featureTiles.values()){let n=t.missingAttributes?.get(e);if(n!=null)return n}}_pause(){this._paused&&(this._featureTiles.forEach(e=>this._cancelFetchTile(e)),this._updated())}_unpause(){this._paused||this._setDirty()}get availableFields(){let e=null;return this._featureTiles.forEach(t=>{t.displayingFeatures!=null&&t.displayingFeatures.length!==0&&(e==null?e=new Set(t.availableFields):e.forEach(n=>{t.availableFields?.has(n)||e.delete(n)}))}),e??new Set}applyEdits(e){this._pendingEdits||(this._pendingEdits={edits:Promise.resolve(),count:0,controller:new AbortController},this._pause());let t=this._pendingEdits;t.count++;let n=t.edits.then(()=>e.result.catch(e=>{if(a(e))throw e;return null}).then(e=>e&&(this._applyEditsDeleteFeatures(e.deletedFeatures),this._applyEditsAddUpdateFeatures(e.addedFeatures,e.updatedFeatures,t.controller.signal).then(()=>e))).then(e=>(--t.count===0&&(this._pendingEdits===t&&(this._pendingEdits=null),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._applyEditsTilesUpdated=!1,this._unpause()),e)));return t.edits=n,this._updated(),n}_applyEditsDeleteFeatures(e){if(e.length===0)return;let t=this.context.globalIdField,n=t&&this.availableFields.has(t),i=new Set,a=this._objectIdField;e.forEach(({objectId:e,globalId:o})=>{(!e||e<0)&&t&&o&&(n||r.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected in the view`),e=this._objectIdFromGlobalId(o,a,t)),e!=null&&e>=0&&i.add(e)}),this._featureTiles.forEach(e=>{if(!e.features)return;let t=e.features.filter(e=>!i.has(C(e,this._objectIdField)));t.length!==e.features.length&&(this._applyEditsTileUpdated(),e.setFeatures(t,0,e.availableFields,e.missingAttributes),this._updateTileZQuantization(e),this._invalidateCounts())})}_objectIdFromGlobalId(e,t,n){if(e==null)return null;let r=this.features.find(t=>t.attributes?.[n]===e);return r?C(r,t):null}async _applyEditsAddUpdateFeatures(e,t,n){let{objectIdField:i,globalIdField:a}=this.context,o=a&&this.availableFields.has(a),s=new Set,c=new Set;for(let t of e){let e=t.objectId;e!=null&&s.add(e)}for(let{objectId:e,globalId:n}of t){let t=e;(t==null||t<0)&&a&&(o||r.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${a} to be included the layer's outFields for updates to be reflected in the view`),t=this._objectIdFromGlobalId(n,i,a)),t!=null&&t>=0&&(s.add(t),c.add(t))}if(s.size===0)return;let l=[];this._featureTiles.forEach(e=>{let t=this._applyEditsAddUpdateTile(e,s,c,n);l.push(t)}),this._updated(),await Promise.allSettled(l)}async _applyEditsAddUpdateTile(e,t,n,r){if(!e.features)return;e.fetchingResolution=e.descriptor.resolution;let i=this._createQuery(e);i.resultType=void 0,i.cacheHint=!1,i.objectIds=Array.from(t);let a=await this.context.query.queryFeaturesDehydrated(i,{signal:r,timeout:$}),o=null;if(n.size>0){let t=e.features.filter(e=>!n.has(C(e,this._objectIdField)));t.length!==e.features.length&&(o=t)}if(a.features.length>0){o||=e.features.slice();for(let e of a.features)o.push(e)}o&&(e.hasPreciseFeatureCount&&(e.numFeatures=Math.max(e.numFeatures,o.length)),this._applyEditsTileUpdated(),e.setFeatures(o,0,q(e.availableFields,a.fields),J(e.missingAttributes,a.missingAttributes),void 0,!1),this._updateTileZQuantization(e),this._invalidateCounts())}_applyEditsTileUpdated(){this._applyEditsTilesUpdated||(this._applyEditsTilesUpdated=!0,this._updated())}_queryFeatures(e,t,n){return this.context.query.queryFeaturesDehydrated(e,{signal:n,timeout:$,completeFeatureFromTransfer:(e,n,r)=>{let i=D(e.geometry,n,t),a=this._memory.findGeometry(i,t=>O(e.geometry,n,t));a?e.geometry=a:k(e,n,r)}})}_setDirty(){this._dirty=!0,this._updated()}runTask(e){let t=this._frameTask.processQueue(e);if(!this._dirty||!this.initialized)return t;this._dirty=!1;let n=this._featureTilesArray;if(this._markTilesNotAlive(n),!e.run(()=>this._addTiles(n,e))||!e.run(()=>this._filterExtentTiles(n,e))||!e.run(()=>this._removeTiles(n,e))||e.done){this._setDirty();return}let r=this._sortTiles(n);e.run(()=>this._showTiles(r,e))&&e.run(()=>this._fetchTiles(r,e))&&e.run(()=>this._updateMemoryEstimates(r,e))||this._setDirty(),this._updated(),this.updating||(this._updateMaximumNumberOfFeaturesExceeded(),this._updateSnappingComplexityExceeded(r))}_updateSnappingComplexityExceeded(e){let t=ie;for(let n of e){if(V(n)||t<=0)break;if(!H(n)&&(t--,n.sampledDensityEstimate>re)){this.snappingComplexityExceeded=!0;return}}this.snappingComplexityExceeded=this._featureTiles.size===0}_markTilesNotAlive(e){for(let t of e)t.alive=!1}_addTiles(e,t){return this._suspended||!this.tileDescriptors?!1:(this.tileDescriptors.forEach(n=>{let r=this._featureTiles.get(n.id);r?r.alive=!0:t.done||(e.push(this._addTile(n)),t.madeProgress())}),t.hasProgressed)}_filterExtentTiles(e,t){for(let n of e){if(t.done)break;n.alive&&(n.filtered=!n.intersects(this.filterExtent),n.filtered&&(this._clearTile(n),t.madeProgress()))}return t.hasProgressed}_removeTiles(e,t){for(let n=e.length-1;n>=0&&!t.done;n--){let r=e[n];r.alive||(this._removeTile(r),n!==e.length-1&&(e[n]=e[e.length-1]),e.pop(),t.madeProgress())}return t.hasProgressed}_sortTiles(e){return e.sort((e,t)=>e.descriptor.loadPriority-t.descriptor.loadPriority),e}_showTiles(e,t){let n=this._updateRatio(e),r=e=>{let t=this._fullRatio<1?n(e)*this._farRatio:1;e.reduceFeatures(t,this.memoryFactor,this._objectIdField,this._reduceMode)&&this._setDirty();let{numFeatures:r,fetchingResolution:i,descriptor:a,isFetched:o}=e;return this._supportsResolution&&r>0&&i!==a.resolution&&o&&(e.requestRefetch(),this._setDirty()),this._showTile(e)};for(let n of e)if(!t.run(()=>r(n))){this._setDirty();break}return t.hasProgressed}_fetchTiles(e,t){if(this._paused)return!1;let n=!1;for(let r of e){if(!r.needsFetch)continue;let e=this.context.memoryCache==null?null:this.context.memoryCache.pop(r.id);if(e?.resolution===r.displayingResolution)r.cache=e,r.numFeatures&&this._notifyDataUpdating(),this._setDirty(),this._scheduleUpdated(),t.madeProgress();else{if(this._needsNumFeatures(r)){let e=new AbortController,i=this._fetchTileCount(r,e.signal);this._handleRequest(r,i,e,()=>r.resetFetching(),()=>r.numFeatures=N),n=!0,t.madeProgress()}if(t.done)return!0}}if(n)return t.hasProgressed;for(let n of e){if(!n.needsFetch)continue;let e=new AbortController,i=this._fetchTile(n,e.signal);if(this._handleRequest(n,i,e,e=>n.fetchDone(e),e=>{n.fetchFailed=!0,this.context.logFetchError(r.getLogger(this),e)}),t.madeProgress(),t.done)return!0}return t.hasProgressed}_updateMemoryEstimates(e,t){return e.some(e=>!t.run(()=>e.updateEstimates())&&(this._setDirty(),!0)),t.hasProgressed}_reclip(e,t){if(!this.initialized)return;let n=[];this._featureTiles.forEach(r=>{r.displayingFeatures!=null&&r.displayingFeatures.length!==0&&(r.intersectionIncludingBorrowed(t,X),r.intersectionIncludingBorrowed(e,Z),_(X,Z)||n.push(r))}),this._refreshDisplayingFeatures(n),this._updated()}_refreshDisplayingFeatures(e){let t=new Set,n=this._changes.updates;for(let r of e)if(r.displayingFeatures!=null)for(let e of r.displayingFeatures){let r=C(e,this._objectIdField);if(t.has(r))continue;t.add(r);let i=this._displayingFeatureReferences.get(r).feature;n.removes.push(i),n.adds.push(i)}this._applyChanges()}_updated(){let e=0;if(this._paused||this._featureTiles.forEach(t=>t.isFetching?++e:0),this._isFetching=e>0,e>0||this._applyEditsTilesUpdated?this._notifyDataUpdating():this._dirty||this._set(`dataUpdating`,!1),this.updating){let t=0,n=0,r=0,i=0,a=0,o=this._displayingFeatureReferences.size/this._numDisplayingFeatureReferences;this._featureTiles.forEach(e=>{if(++n,e.isFetching&&e.hasPreciseFeatureCount){let t=this._maximumFeaturesForTile(e)*(1-e.emptyFeatureRatio),n=e.displayingFeatures==null?0:e.displayingFeatures.length*o;a+=t-n}e.needsFetch?++i:e.numFeatures>0&&(++r,t+=e.numFeatures)}),i+=e;let s=0,c=0;t?(c=t,s=Math.min(i*t/r,t)):(c=n,s=i),a=Math.min(this.maximumNumberOfFeatures-this.features.length,a),this._set(`updatingTotal`,c),this._set(`updatingRemaining`,s),this._set(`expectedFeatureDiff`,a)}else this._set(`updatingTotal`,0),this._set(`updatingRemaining`,0),this._set(`expectedFeatureDiff`,0);this.debugger?.update()}_updateMaximumNumberOfFeaturesExceeded(){for(let{perTileMaximumNumberOfFeaturesExceeded:e}of this._featureTiles.values())if(e){this._set(`maximumNumberOfFeaturesExceeded`,!0);return}this._set(`maximumNumberOfFeaturesExceeded`,!1)}_updateRatio(e){let t=W(e),n=e=>1/(1<<Math.max(0,t-e.descriptor.lij[0])),r=0,i=0;for(let t of e){let e=t.numFeatures;r+=e,i+=e*n(t)}return this._fullRatio=Math.min(1,this.maximumNumberOfFeatures/r),this._farRatio=this.maximumNumberOfFeatures/i,this._scheduleUpdated(),n}_maximumFeaturesUpdated(e,t){e!==t&&(t>e&&this._featureTiles.forEach(e=>{if(!e.featuresMissing)return;let t=this._maximumFeaturesForTile(e);e.isFullyFetched(t)||(this._cancelFetchTile(e),this._resetFetchTile(e))}),this._setDirty())}_addTile(e){let t=new P(e,this._memory);return this._featureTiles.set(t.id,t),this._resetFetchTile(t),this._referenceDisplayingFeaturesFromRelatedTiles(t),t}_referenceDisplayingFeaturesFromRelatedTiles(e){let t=e.displayingResolution;this._featureTiles.forEach(n=>{if(n.displayingFeatures!=null&&e!==n&&L(e.descriptor.lij,n.descriptor.lij)){e.displayingFeatures??=[],e.descriptor.extent&&n.descriptor.extent&&(e.extentIncludingBorrowedFeatures??=v(e.descriptor.extent),y(e.extentIncludingBorrowedFeatures,n.descriptor.extent,e.extentIncludingBorrowedFeatures));for(let r of n.displayingFeatures){e.displayingFeatures.push(r),this._memory.ref(r);let n=this._displayingFeatureReferences.get(C(r,this._objectIdField));n.ref(this._memory,n.feature,t),this._numDisplayingFeatureReferences++}}})}_removeTile(e){this._clearTile(e),this._featureTiles.delete(e.id)}_resetFetchTile(e){e.filtered=!e.intersects(this.filterExtent),e.filtered?e.needsFetch&&e.fetchDone(4):e.requestFetch()}_cancelFetchTile(e){let t=e.requestController;t!=null&&(e.requestController=null,e.resetFetching(),t.abort())}async _fetchTileCount(e,t){e.numFeatures=await this.context.query.queryFeatureCount(this._createFeatureCountQuery(e),{signal:t}),this._updateRatio(this._featureTilesArray)}async _fetchTile(e,t){e.fetchFailed=!1;let n=this._maximumFeaturesForTile(e);if(n<=0)return e.hasPreciseFeatureCount&&e.numFeatures===0||(e.fetchFailed=!0),G(e),e.fetchInformation.value=`Empty tile`,4;let r=this._getMaxRecordCount(e),i=Math.ceil(n/r);if(e.fetchingResolution=e.descriptor.resolution,U(e)||!this.context.capabilities.supportsMaxRecordCountFactor||e.numFeatures<=n&&i>j.MAX_MAX_RECORD_COUNT_FACTOR)return this._fetchPagedTile(e,t);let a=this._createQuery(e);if(a.maxRecordCountFactor=i,e.isRefetching&&e.features&&e.features.length>0){let t=Math.ceil(e.features.length/(1-e.emptyFeatureRatio)/r);a.maxRecordCountFactor=Math.max(t+1,a.maxRecordCountFactor)}e.fetchInformation.value=`Single fetch\n${n} features`;let{features:s,exceededTransferLimit:c,fields:l,missingAttributes:u}=await this._queryFeatures(a,e.fetchingResolution,t),d=c||a.maxRecordCountFactor>=j.MAX_MAX_RECORD_COUNT_FACTOR||n===this._totalFeaturesForTile(e)?5:4,f=await this._frameTask.schedule(()=>{e.exceededTransferLimit.value=!!c;let t=this._removeEmptyFeatures(s,this._getEffectiveTileResolution(e));return e.fetchInformation.value=`Single fetch\n${s.length}/${n} features`,e.setFeatures(s,t,K(l),J(void 0,u)),this._updateTileZQuantization(e),this._maximumFeaturesForTile(e)>n?1:d},t);return o(t),this._invalidateCounts(),f}async _fetchPagedTile(e,t){let n=0,r=0,i,a=0,s=this._maximumFeaturesForTile(e)-a,c=this._getMaxRecordCount(e),l=null,u;for(;;){let d=this._createQuery(e),f=this._setPagingParameters(d,n,s,c);e.fetchInformation.value=`Paged fetch\n${e.features?.length}/${s} features`;let{features:p,exceededTransferLimit:m,fields:h,missingAttributes:g}=await this._queryFeatures(d,e.fetchingResolution,t);if(await this._frameTask.schedule(()=>{f&&(n+=d.num),a+=p.length,r+=this._removeEmptyFeatures(p,this._getEffectiveTileResolution(e)),e.exceededTransferLimit.value=!!m,i=i?.concat(p)??p,l=q(l,h),u=J(u,g),e.setFeatures(i,r,l,u),this._updateTileZQuantization(e),this._invalidateCounts(),this._setDirty()},t),o(t),s=this._maximumFeaturesForTile(e)-(i?.length??0),!f||!m||s<=0)return m?4:5}}_createFeatureCountQuery(e){let t=this._createQuery(e);return this.context.capabilities.supportsCacheHint&&(t.resultType=void 0,t.cacheHint=!0),t}_createQuery(e){let t=this.context.createQuery();if(t.resultType=this._resultType(e),!U(e)&&e.descriptor.extent&&this.context.tilingScheme&&(t.geometry=b(e.descriptor.extent,this.context.tilingScheme.spatialReference)),this._setResolutionParams(t,e),t.resultType!==`tile`&&this.context.capabilities.supportsCacheHint&&(t.cacheHint=!0),H(e)){let{highlightIds:e}=this.context;e&&e.length>Y&&r.getLogger(this).warn(`highlight-too-many-features`,`highlight is limited to ${Y} features on large layers configured with a display filter to avoid performance issues`),t.objectIds=e?.slice(0,Y)}else!V(e)&&this.context.effectiveDisplayFilter&&(t.where=f(t.where,this.context.effectiveDisplayFilter.where));return t}_setPagingParameters(e,t,n,r){return this.context.capabilities.supportsPagination?(e.start=t,n>0&&this.context.capabilities.supportsMaxRecordCountFactor?(e.maxRecordCountFactor=Math.ceil(n/r),e.num=Math.min(e.maxRecordCountFactor*r,n)):e.num=Math.min(r),!0):!1}_getEffectiveTileResolution(e){if(U(e)||!this._supportsResolution)return null;let t=this.context.viewingMode===1&&this.context.tilingScheme?this.context.tilingScheme.resolutionAtLevel(3):1/0;return Math.min(e.fetchingResolution,t)/this.lodFactor/this._tileZQuantization}get _supportsResolution(){return this.context.capabilities.supportsMultipleResolutions&&this.context.geometryType!==`point`}_setResolutionParams(e,t){let n=this._getEffectiveTileResolution(t);n!=null&&(this.context.capabilities.supportsQuantization?e.quantizationParameters=new A({mode:`view`,originPosition:`upper-left`,tolerance:n,extent:this.context.fullExtent}):this.context.geometryType===`polyline`&&(e.maxAllowableOffset=n))}_removeEmptyFeatures(e,t){let r=e.length;if(t&&this._supportsResolution){let r=t*(1+h());n(e,({geometry:e})=>!e||!w(e)?!1:(T(e,Q),x(Q)>r||S(Q)>r))}else n(e,({geometry:e})=>w(e));return r-e.length}_needsNumFeatures(e){return this.useTileCount&&e.needsFeatureCount&&!V(e)}_getMaxRecordCount(e){switch(this._resultType(e)){case`tile`:if(this.context.tileMaxRecordCount)return this.context.tileMaxRecordCount;break;case`standard`:if(this.context.standardMaxRecordCount)return this.context.standardMaxRecordCount}return this.context.maxRecordCount||Y}_resultType(e){if(this.context.capabilities.supportsResultType)return V(e)?`standard`:`tile`}get _reduceMode(){let e=this.context.geometryType;return e===`polygon`||e===`polyline`?0:1}_handleRequest(e,t,n,r,i){e.startFetch(),e.requestController=n;let o=!1;t.then(t=>{e.requestController=null,r(t)}).catch(t=>{e.requestController===n&&(e.requestController=null,e.fetchDone(4)),a(t)?o=!0:i(t)}).then(()=>{o||this._setDirty(),this._scheduleUpdated()})}_scheduleUpdated(){this.hasHandles(`scheduleUpdated`)||this.addHandles(u(()=>{this.removeHandles(`scheduleUpdated`),this._updated()}),`scheduleUpdated`)}_showTile(e){if(e.displayingFeatures&&!e.needsDisplayUpdate)return!1;let t=e.features;if(e.featureLimit===0||!t){let t=e.displayingFeatures!=null&&e.displayingFeatures.length>0;return this._hideTileFeatures(e),e.displayingFeatures=[],t}let n=e.fetchingResolution,{adds:r,updates:i}=this._changes,a=Math.min(e.featureLimit,t.length);for(let e=0;e<a;++e){let a=t[e],o=C(a,this._objectIdField),s=this._displayingFeatureReferences.get(o);if(this._memory.ref(a),s){let{oldVersion:e,newVersion:t}=s.ref(this._memory,a,n);e!==t&&(e&&i.removes.push(e),t&&i.adds.push(t))}else this._displayingFeatureReferences.set(o,new this.FeatureReferenceClass(a,n,this._memory)),r.push(a);this._numDisplayingFeatureReferences++}return this._hideTileFeatures(e),e.displayingResolution=e.fetchingResolution,this._applyChanges(),e.displayingFeatures=t.slice(0,a),!0}_hideTile(e){this._cancelFetchTile(e),this._hideTileFeatures(e)}_hideTileFeatures(e){if(e.displayingFeatures==null)return;let{updates:t,removes:n}=this._changes;for(let r of e.displayingFeatures){this._memory.unref(r);let i=C(r,this._objectIdField),a=this._displayingFeatureReferences.get(i);if(!a)continue;let{oldVersion:o,newVersion:s}=a.unref(this._memory,e.displayingResolution);this._numDisplayingFeatureReferences--,o!==s&&(s==null?(this._displayingFeatureReferences.delete(i),o&&n.push(o)):(t.adds.push(s),o&&t.removes.push(o)))}this._applyChanges(),e.displayingFeatures=null}_notifyDataUpdating(){this._get(`dataUpdating`)||this._set(`dataUpdating`,!0)}_applyChanges(){let e=this._changes.updates;e.removes.length>0&&(this._notifyDataUpdating(),this.features.removeMany(e.removes),e.removes.length=0),e.adds.length>0&&(this._notifyDataUpdating(),this.features.addMany(e.adds),e.adds.length=0);let t=this._changes.adds,n=this._changes.removes,r=Math.min(t.length,n.length),i=0;for(;i<r;){let e=Math.min(i+ne,r);this._notifyDataUpdating(),this.features.addMany(t.slice(i,e)),this.features.removeMany(n.slice(i,e)),i=e}t.length>r&&(this._notifyDataUpdating(),this.features.addMany(i===0?t:t.slice(i))),n.length>r&&(this._notifyDataUpdating(),this.features.removeMany(i===0?n:n.slice(i))),t.length=0,n.length=0}_clearTile(e){this._hideTile(e),e.features&&this.context.memoryCache!=null&&this.context.memoryCache.put(e.id,e.cache),e.setFeatures(null,0,null,void 0),this._invalidateCounts()}_invalidateCounts(){this.notifyChange(`totalVertices`),this.notifyChange(`totalFeatures`)}get _featureTilesArray(){return Array.from(this._featureTiles.values())}get featureTiles(){return this._featureTiles}get storedFeatures(){return this._featureTilesArray.reduce((e,t)=>e+(t.features?t.features.length:0),0)}get missingTiles(){return this._featureTiles.values().reduce((e,t)=>e+(t.needsFetch||t.isFetching?1:0),0)}_totalFeaturesForTile(e){return e.hasPreciseFeatureCount?e.numFeatures:this.maximumNumberOfFeatures}_maximumFeaturesForTile(e){let t=this._totalFeaturesForTile(e),n=this._fullRatio<1?this._farRatio:1;return Math.min(Math.ceil(t*n/(1-e.emptyFeatureRatio)),t)}get test(){}};e([p({constructOnly:!0})],B.prototype,`features`,void 0),e([p({constructOnly:!0})],B.prototype,`context`,void 0),e([p()],B.prototype,`tileDescriptors`,void 0),e([p({value:1/0})],B.prototype,`maximumNumberOfFeatures`,null),e([p({value:1})],B.prototype,`memoryFactor`,null),e([p({value:1})],B.prototype,`lodFactor`,null),e([p()],B.prototype,`useTileCount`,null),e([p({readOnly:!0})],B.prototype,`updating`,null),e([p({readOnly:!0})],B.prototype,`dataUpdating`,void 0),e([p({readOnly:!0})],B.prototype,`updatingTotal`,void 0),e([p({readOnly:!0})],B.prototype,`updatingRemaining`,void 0),e([p({readOnly:!0})],B.prototype,`expectedFeatureDiff`,void 0),e([p()],B.prototype,`usedMemory`,null),e([p()],B.prototype,`usedMemoryPerFeature`,null),e([p({readOnly:!0})],B.prototype,`maximumNumberOfFeaturesExceeded`,void 0),e([p({readOnly:!0})],B.prototype,`totalVertices`,null),e([p({readOnly:!0})],B.prototype,`totalFeatures`,null),e([p({readOnly:!0})],B.prototype,`showsAllFeatures`,null),e([p({readOnly:!0})],B.prototype,`hasFullGeometries`,null),e([p()],B.prototype,`filterExtent`,null),e([p()],B.prototype,`_dirty`,void 0),e([p()],B.prototype,`_suspended`,void 0),e([p()],B.prototype,`_pendingEdits`,void 0),e([p()],B.prototype,`_applyEditsTilesUpdated`,void 0),e([p()],B.prototype,`_paused`,null),e([p()],B.prototype,`snappingComplexityExceeded`,void 0),e([p()],B.prototype,`_isFetching`,void 0),B=e([m(`esri.views.3d.layers.support.FeatureTileFetcher3D`)],B);function V(e){return e.id===I}function H(e){return e.id===F}function U(e){return V(e)||H(e)}function W(e){let t=0;for(let n of e)n.features&&n.features.length>0&&n.alive&&(t=Math.max(t,n.descriptor.lij[0]));return t}function G(e){e.setFeatures([],0,null,void 0)}function K(e){return e==null?new Set:new Set(e.map(e=>e.name))}function q(e,t){if(e==null||t==null)return K(t);let n=new Set;for(let{name:r}of t)e.has(r)&&n.add(r);return n}function J(e,t){if(!t?.length)return e;e??=new Map;let n=()=>new Set;for(let{objectId:r,attribute:a}of t)i(e,r,n).add(a);return e}const Y=2e3,X=g(),Z=g(),Q=g(),$=6e5,ne=200,re=.95,ie=10;export{B as FeatureTileFetcher3D};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../../Color.js";import t from"../../../../Graphic.js";import n from"../../../../core/Collection.js";import r from"../../../../core/Handles.js";import{watch as i,initial as a}from"../../../../core/reactiveUtils.js";import o from"../../../../geometry/Polygon.js";import s from"../../../../symbols/FillSymbol3DLayer.js";import c from"../../../../symbols/PointSymbol3D.js";import l from"../../../../symbols/PolygonSymbol3D.js";import u from"../../../../symbols/TextSymbol3DLayer.js";import d from"../../../../symbols/callouts/LineCallout3D.js";import f from"../../../../symbols/callouts/LineCallout3DBorder.js";import p from"../../../../symbols/support/Symbol3DVerticalOffset.js";import{TilingScheme as m}from"../../terrain/TilingScheme.js";const h=[[0,179,255],[117,62,128],[0,104,255],[215,189,166],[32,0,193],[98,162,206],[102,112,129],[52,125,0],[142,118,246],[138,83,0],[92,122,255],[122,55,83],[0,142,255],[81,40,179],[0,200,244],[13,24,127],[0,170,147],[19,58,241],[22,44,35]];class g{constructor(e,t,i){this._tileFetcher=e,this._view=i,this._handles=new r,this._loadingGraphics=new Map,this._loadingSymbols=[new l({symbolLayers:new n([new s({material:{color:[200,200,200,.4]},outline:{color:[30,30,30],size:1}})])})],this._loadedGraphics=new Map,this._loadedSymbols=h.map(e=>new l({symbolLayers:new n([new s({material:{color:[e[0],e[1],e[2],.6]},outline:{color:`black`,size:1}})])})),this._pendingGraphics=new Map,this._pendingSymbols=[new l({symbolLayers:new n([new s({material:{color:[100,100,100,.4]},outline:{color:[30,30,30],size:1}})])})],this._dataExtentGraphic=null,this._dataExtentSymbol=new l({symbolLayers:new n([new s({material:{color:[0,0,0,0]},outline:{color:`green`,size:4}})])}),this._enabled=!0,this._tilingScheme=new m(t),this.update()}destroy(){this.enabled=!1,this._handles.destroy()}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this.update()}update(){this._enabled?(this._synchronizeMaps(this._loadingGraphics,{filter:({isFetching:e})=>e,symbols:this._loadingSymbols}),this._synchronizeMaps(this._loadedGraphics,{filter:e=>!e.isFetching,symbols:this._loadedSymbols}),this._synchronizeMaps(this._pendingGraphics,{filter:({isFetching:e})=>!e,symbols:this._pendingSymbols}),this.showDataExtent(this._tileFetcher.filterExtent)):(this._loadingGraphics.forEach(e=>this._view.graphics.removeMany(e)),this._loadingGraphics.clear(),this._loadedGraphics.forEach(e=>this._view.graphics.removeMany(e)),this._loadedGraphics.clear(),this._pendingGraphics.forEach(e=>this._view.graphics.removeMany(e)),this._pendingGraphics.clear(),this._dataExtentGraphic&&=(this._view.graphics.remove(this._dataExtentGraphic),null))}showDataExtent(e){if(this._dataExtentGraphic&&=(this._view.graphics.remove(this._dataExtentGraphic),null),e==null)return;let n=o.fromExtent(e);this._dataExtentGraphic=new t({geometry:n,symbol:this._dataExtentSymbol}),this._view.graphics.add(this._dataExtentGraphic)}_synchronizeMaps(e,t){let n=this._tileFetcher.featureTiles;e.forEach((r,i)=>{let a=n.get(i);
|
|
2
|
+
import e from"../../../../Color.js";import t from"../../../../Graphic.js";import n from"../../../../core/Collection.js";import r from"../../../../core/Handles.js";import{watch as i,initial as a}from"../../../../core/reactiveUtils.js";import o from"../../../../geometry/Polygon.js";import s from"../../../../symbols/FillSymbol3DLayer.js";import c from"../../../../symbols/PointSymbol3D.js";import l from"../../../../symbols/PolygonSymbol3D.js";import u from"../../../../symbols/TextSymbol3DLayer.js";import d from"../../../../symbols/callouts/LineCallout3D.js";import f from"../../../../symbols/callouts/LineCallout3DBorder.js";import p from"../../../../symbols/support/Symbol3DVerticalOffset.js";import{TilingScheme as m}from"../../terrain/TilingScheme.js";const h=[[0,179,255],[117,62,128],[0,104,255],[215,189,166],[32,0,193],[98,162,206],[102,112,129],[52,125,0],[142,118,246],[138,83,0],[92,122,255],[122,55,83],[0,142,255],[81,40,179],[0,200,244],[13,24,127],[0,170,147],[19,58,241],[22,44,35]];class g{constructor(e,t,i){this._tileFetcher=e,this._view=i,this._handles=new r,this._loadingGraphics=new Map,this._loadingSymbols=[new l({symbolLayers:new n([new s({material:{color:[200,200,200,.4]},outline:{color:[30,30,30],size:1}})])})],this._loadedGraphics=new Map,this._loadedSymbols=h.map(e=>new l({symbolLayers:new n([new s({material:{color:[e[0],e[1],e[2],.6]},outline:{color:`black`,size:1}})])})),this._pendingGraphics=new Map,this._pendingSymbols=[new l({symbolLayers:new n([new s({material:{color:[100,100,100,.4]},outline:{color:[30,30,30],size:1}})])})],this._dataExtentGraphic=null,this._dataExtentSymbol=new l({symbolLayers:new n([new s({material:{color:[0,0,0,0]},outline:{color:`green`,size:4}})])}),this._enabled=!0,this._tilingScheme=new m(t),this.update()}destroy(){this.enabled=!1,this._handles.destroy()}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this.update()}update(){this._enabled?(this._synchronizeMaps(this._loadingGraphics,{filter:({isFetching:e})=>e,symbols:this._loadingSymbols}),this._synchronizeMaps(this._loadedGraphics,{filter:e=>!e.isFetching,symbols:this._loadedSymbols}),this._synchronizeMaps(this._pendingGraphics,{filter:({isFetching:e})=>!e,symbols:this._pendingSymbols}),this.showDataExtent(this._tileFetcher.filterExtent)):(this._loadingGraphics.forEach(e=>this._view.graphics.removeMany(e)),this._loadingGraphics.clear(),this._loadedGraphics.forEach(e=>this._view.graphics.removeMany(e)),this._loadedGraphics.clear(),this._pendingGraphics.forEach(e=>this._view.graphics.removeMany(e)),this._pendingGraphics.clear(),this._dataExtentGraphic&&=(this._view.graphics.remove(this._dataExtentGraphic),null))}showDataExtent(e){if(this._dataExtentGraphic&&=(this._view.graphics.remove(this._dataExtentGraphic),null),e==null)return;let n=o.fromExtent(e);this._dataExtentGraphic=new t({geometry:n,symbol:this._dataExtentSymbol}),this._view.graphics.add(this._dataExtentGraphic)}_synchronizeMaps(e,t){let n=this._tileFetcher.featureTiles;e.forEach((r,i)=>{let a=n.get(i);a&&t.filter(a)||(this._view.graphics.removeMany(r),e.delete(i))}),this._handles.removeAll(),n.forEach(n=>{t.filter(n)&&!e.has(n.id)&&this._handles.add(i(()=>n.fetchInformation,()=>this._showTile(n,e,t),a))})}_showTile(r,i,a){let[o,s,l]=r.descriptor.lij,{numFeatures:m,featureLimit:h,features:g}=r;this._tilingScheme.ensureMaxLod(o);let _=this._tilingScheme.getExtentGeometry(o,s,l),v=new t({geometry:_,symbol:a.symbols[o%a.symbols.length]}),y=`Tile ${r.id}\nloaded/limit/total
|
|
3
3
|
${g?.length}/${h}/${m}\nres ${Math.round(r.displayingResolution)} ${r.featuresMissing?`some`:`all`}\n${r.fetchInformation.value}`,b=new t({geometry:_.center,symbol:new c({verticalOffset:new p({screenLength:40/.75}),callout:new d({color:new e(`white`),border:new f({color:new e(`black`)})}),symbolLayers:new n([new u({text:y,halo:{color:`white`,size:1/.75},material:{color:`black`},size:16})])})}),x=i.get(r.id);x&&this._view.graphics.removeMany(x);let S=[v,b];i.set(r.id,S),this._view.graphics.addMany(S)}}export{g as FeatureTileFetcher3DDebugger};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../Color.js";import n from"../../../../core/Accessor.js";import{isSome as r}from"../../../../core/arrayUtils.js";import{makeHandle as i,destroyHandle as a}from"../../../../core/handleUtils.js";import{watch as o,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{assertNotMesh as u}from"../../../../geometry/asserts.js";import{initializeProjection as d,project as f}from"../../../../geometry/projectionUtils.js";import{GraphicsCollection as p}from"../../../../support/GraphicsCollection.js";import m from"../../../../symbols/SimpleFillSymbol.js";import h from"../../../../symbols/SimpleLineSymbol.js";import g from"../../../../symbols/SimpleMarkerSymbol.js";import{getHighlightGraphics as _}from"../../../layers/support/highlightUtils.js";let v=class extends n{get updating(){return this.graphicsView?.updating??!1}constructor(e){super(e),this._highlightCounts=new Map,this._graphicsViewLoader=null,this.graphics=new p,this.graphicsView=null,this.suspended=!1;let n=new t([255,255,255,1/255]);this._symbols=new Map([[`point`,new g({size:`2px`,style:`square`,color:n})],[`polyline`,new h({width:`2px`,color:n})],[`polygon`,new m({outline:null,color:n})]])}highlight(e,t){let n=_(e);if(n.length===0)return i();let r=!1,a;return this.updatingHandles.consumePromise(Promise.all([this._createHighlightGraphics(n),this._ensureGraphicsView3D()]).then(([e,n])=>{!r&&n&&(a=this._addHighlightGraphics(n,e,t))})),i(()=>{r=!0,a?.remove()})}preload(){this._ensureGraphicsView3D()}_addHighlightGraphics(e,t,n){for(let e of t)this._highlightCounts.set(e,(this._highlightCounts.get(e)??0)+1);this.graphics.addMany(t);let r=e.highlight(t,n);return i(()=>{this._removeHighlightGraphics(t),r.remove()})}_removeHighlightGraphics(e){this.graphics.removeMany(e.filter(e=>{let t=Math.max(0,(this._highlightCounts.get(e)??0)-1);return t===0?(this._highlightCounts.delete(e),!0):(this._highlightCounts.set(e,t),!1)}))}async _ensureGraphicsView3D(){if(this.graphicsView)return this.graphicsView;this._graphicsViewLoader||=import(`../GraphicsView3D.js`);let{default:e}=await this._graphicsViewLoader;if(this.destroyed)return null;let t=new e({view:this.view,layer:{type:`graphics-view-3d-dummy`,id:this.layer.id,uid:this.layer.uid,elevationInfo:{mode:`on-the-ground`}},getGraphics:()=>this.graphics,drapeSourcePriorityOffset:.5});return this._set(`graphicsView`,t),this.addHandles([a(this.graphicsView),o(()=>this.suspended,e=>{t.suspended=e},s)]),t}async _createHighlightGraphics(e){let t=e.map(({geometry:e})=>e?.spatialReference).filter(r).reduce((e,t)=>(
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../Color.js";import n from"../../../../core/Accessor.js";import{isSome as r}from"../../../../core/arrayUtils.js";import{makeHandle as i,destroyHandle as a}from"../../../../core/handleUtils.js";import{watch as o,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{assertNotMesh as u}from"../../../../geometry/asserts.js";import{initializeProjection as d,project as f}from"../../../../geometry/projectionUtils.js";import{GraphicsCollection as p}from"../../../../support/GraphicsCollection.js";import m from"../../../../symbols/SimpleFillSymbol.js";import h from"../../../../symbols/SimpleLineSymbol.js";import g from"../../../../symbols/SimpleMarkerSymbol.js";import{getHighlightGraphics as _}from"../../../layers/support/highlightUtils.js";let v=class extends n{get updating(){return this.graphicsView?.updating??!1}constructor(e){super(e),this._highlightCounts=new Map,this._graphicsViewLoader=null,this.graphics=new p,this.graphicsView=null,this.suspended=!1;let n=new t([255,255,255,1/255]);this._symbols=new Map([[`point`,new g({size:`2px`,style:`square`,color:n})],[`polyline`,new h({width:`2px`,color:n})],[`polygon`,new m({outline:null,color:n})]])}highlight(e,t){let n=_(e);if(n.length===0)return i();let r=!1,a;return this.updatingHandles.consumePromise(Promise.all([this._createHighlightGraphics(n),this._ensureGraphicsView3D()]).then(([e,n])=>{!r&&n&&(a=this._addHighlightGraphics(n,e,t))})),i(()=>{r=!0,a?.remove()})}preload(){this._ensureGraphicsView3D()}_addHighlightGraphics(e,t,n){for(let e of t)this._highlightCounts.set(e,(this._highlightCounts.get(e)??0)+1);this.graphics.addMany(t);let r=e.highlight(t,n);return i(()=>{this._removeHighlightGraphics(t),r.remove()})}_removeHighlightGraphics(e){this.graphics.removeMany(e.filter(e=>{let t=Math.max(0,(this._highlightCounts.get(e)??0)-1);return t===0?(this._highlightCounts.delete(e),!0):(this._highlightCounts.set(e,t),!1)}))}async _ensureGraphicsView3D(){if(this.graphicsView)return this.graphicsView;this._graphicsViewLoader||=import(`../GraphicsView3D.js`);let{default:e}=await this._graphicsViewLoader;if(this.destroyed)return null;let t=new e({view:this.view,layer:{type:`graphics-view-3d-dummy`,id:this.layer.id,uid:this.layer.uid,elevationInfo:{mode:`on-the-ground`}},getGraphics:()=>this.graphics,drapeSourcePriorityOffset:.5});return this._set(`graphicsView`,t),this.addHandles([a(this.graphicsView),o(()=>this.suspended,e=>{t.suspended=e},s)]),t}async _createHighlightGraphics(e){let t=e.map(({geometry:e})=>e?.spatialReference).filter(r).reduce((e,t)=>(e.length!==0&&e.at(-1)?.equals(t)||e.push(t),e),[]),n=this.view.spatialReference,i=t.map(e=>({source:e,dest:n}));try{await d(i)}catch{return[]}return e.map(e=>{let{geometry:t}=e;try{u(t);let r=t?f(t,n):null,i=e.cloneShallow();return i.geometry=r,i.symbol=this._symbols.get(r?.type),i}catch{return e}})}};e([c()],v.prototype,`graphics`,void 0),e([c()],v.prototype,`graphicsView`,void 0),e([c()],v.prototype,`view`,void 0),e([c()],v.prototype,`layer`,void 0),e([c()],v.prototype,`updatingHandles`,void 0),e([c()],v.prototype,`suspended`,void 0),e([c()],v.prototype,`updating`,null),v=e([l(`esri.views.3d.layers.support.ImageHighlightHelper3D`)],v);export{v as ImageHighlightHelper3D};
|