@arcgis/core 4.22.0-next.20211021 → 4.22.0-next.20211025
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/00ac1ce56f9885a8be83.js +1 -0
- package/assets/esri/core/workers/chunks/01c9afe41ab4ccc597c9.js +1 -0
- package/assets/esri/core/workers/chunks/02a3d14adc504a51fa24.js +1 -0
- package/assets/esri/core/workers/chunks/035a9ab0202d5386b782.js +1 -0
- package/assets/esri/core/workers/chunks/062bace5505f13689c7d.js +1 -0
- package/assets/esri/core/workers/chunks/06c7745d813bcb540ce8.js +1 -0
- package/assets/esri/core/workers/chunks/0950b488a60b2abc21fc.js +1 -0
- package/assets/esri/core/workers/chunks/0af396f2e0de681113ef.js +1 -0
- package/assets/esri/core/workers/chunks/131838059f0f81d8eaee.js +1 -0
- package/assets/esri/core/workers/chunks/146cba0d172ec2f4eba2.js +1 -0
- package/assets/esri/core/workers/chunks/17e49c0dfa5a5a6213e2.js +1 -0
- package/assets/esri/core/workers/chunks/1a0b08190274725dc956.js +1 -0
- package/assets/esri/core/workers/chunks/1add7f0779accdf8d204.js +1 -0
- package/assets/esri/core/workers/chunks/20b81d11e6286d347bfc.js +1 -0
- package/assets/esri/core/workers/chunks/{e596bd3de960d1dc1c57.js → 2207580a78ee292ed9b8.js} +1 -1
- package/assets/esri/core/workers/chunks/2d3646a83465c75986f9.js +1 -0
- package/assets/esri/core/workers/chunks/2d38ee3ef3ebe32a1194.js +1 -0
- package/assets/esri/core/workers/chunks/3737dcc3c0dea3ca05d5.js +1 -0
- package/assets/esri/core/workers/chunks/3e2042e70647c1afa6aa.js +1 -0
- package/assets/esri/core/workers/chunks/3ebfaab2855a2236a95d.js +1 -0
- package/assets/esri/core/workers/chunks/{d6fe616192a8efbfbc3e.js → 440f8101402a4c0d7019.js} +1 -1
- package/assets/esri/core/workers/chunks/4587d770767966985e22.js +1 -0
- package/assets/esri/core/workers/chunks/487b8892fae85810a8c0.js +1 -0
- package/assets/esri/core/workers/chunks/4901a78f32c3ea6b823b.js +1 -0
- package/assets/esri/core/workers/chunks/496fe47fc4d28e1a716d.js +1 -0
- package/assets/esri/core/workers/chunks/{9f22f47d4b2e72d7bdcf.js → 4c010119c24510ea31bb.js} +2 -2
- package/assets/esri/core/workers/chunks/{9f22f47d4b2e72d7bdcf.js.LICENSE.txt → 4c010119c24510ea31bb.js.LICENSE.txt} +0 -0
- package/assets/esri/core/workers/chunks/4f5076e1f2b18ce8156d.js +1 -0
- package/assets/esri/core/workers/chunks/{f291ebc4b089bd1f0a3f.js → 50e86a6bb13042b1dbac.js} +1 -1
- package/assets/esri/core/workers/chunks/{64d9a062c1f1ac08a3ac.js → 565020b1c02a8cb33c2b.js} +1 -1
- package/assets/esri/core/workers/chunks/{d78c60a22f76df7c48c7.js → 59640d78295e2e363f18.js} +1 -1
- package/assets/esri/core/workers/chunks/{a0356f320a1b2fbd03f0.js → 5ac2b2598245aa17cdbd.js} +1 -1
- package/assets/esri/core/workers/chunks/5b4a8cce5601cc92c8a3.js +1 -0
- package/assets/esri/core/workers/chunks/5b92d5d4049622531109.js +1 -0
- package/assets/esri/core/workers/chunks/{751c1a2838b54a74a9a6.js → 5f3caa0ddb215342c728.js} +2 -2
- package/assets/esri/core/workers/chunks/615e995d5ce8fa044b09.js +1 -0
- package/assets/esri/core/workers/chunks/62a2453699e0dd2393b9.js +1 -0
- package/assets/esri/core/workers/chunks/67013547be1a7ae1670a.js +1 -0
- package/assets/esri/core/workers/chunks/67eddf4808f8888faeb4.js +1 -0
- package/assets/esri/core/workers/chunks/695dbedff2340aa019ba.js +1 -0
- package/assets/esri/core/workers/chunks/6a7e388c94206d2f61ff.js +1 -0
- package/assets/esri/core/workers/chunks/6e22b69d55e791ab3d9a.js +1 -0
- package/assets/esri/core/workers/chunks/71e6c0c5ef0aa7eb1703.js +1 -0
- package/assets/esri/core/workers/chunks/7a74e230439c5111f852.js +1 -0
- package/assets/esri/core/workers/chunks/7e76a8e6fa67e607d09e.js +1 -0
- package/assets/esri/core/workers/chunks/7fe4985ca0cb3e6d35c6.js +1 -0
- package/assets/esri/core/workers/chunks/8027330714ff5ffb020e.js +1 -0
- package/assets/esri/core/workers/chunks/844b564d1a422a17f6ac.js +1 -0
- package/assets/esri/core/workers/chunks/856f9281a08cb032238e.js +1 -0
- package/assets/esri/core/workers/chunks/89b4983de872780e9aa1.js +1 -0
- package/assets/esri/core/workers/chunks/8f3bc0cd2c2b01ab80cd.js +1 -0
- package/assets/esri/core/workers/chunks/8fd912e325ccd48b98a9.js +1 -0
- package/assets/esri/core/workers/chunks/901907a5c01f0fd1478f.js +1 -0
- package/assets/esri/core/workers/chunks/92a0b88a14c92239df8a.js +1 -0
- package/assets/esri/core/workers/chunks/972e9aeb3c29c9bf441a.js +1 -0
- package/assets/esri/core/workers/chunks/9758c34ce61c3714515a.js +1 -0
- package/assets/esri/core/workers/chunks/{457ea4feaa006d60c6b1.js → 9a04d087a29f0f3937a3.js} +1 -1
- package/assets/esri/core/workers/chunks/9b0bb171224b35ce2031.js +1 -0
- package/assets/esri/core/workers/chunks/9cbe7afdaef8720dfc8d.js +1 -0
- package/assets/esri/core/workers/chunks/9ccde5b6562f0007fe45.js +1 -0
- package/assets/esri/core/workers/chunks/9d320bbeedeea15522ab.js +1 -0
- package/assets/esri/core/workers/chunks/a001b3b4527817548094.js +1 -0
- package/assets/esri/core/workers/chunks/{197b72bca45065e0eb4a.js → a0c580d4a1915ddd3fe4.js} +1 -1
- package/assets/esri/core/workers/chunks/a4a9c15929b43d83701f.js +1 -0
- package/assets/esri/core/workers/chunks/a54d11f44721f808b82f.js +1 -0
- package/assets/esri/core/workers/chunks/a646a11673d513c00e7a.js +1 -0
- package/assets/esri/core/workers/chunks/a792e2bc7cafdc29f05e.js +1 -0
- package/assets/esri/core/workers/chunks/acae1771697034f265b1.js +1 -0
- package/assets/esri/core/workers/chunks/af2ee804a9c63eea610c.js +1 -0
- package/assets/esri/core/workers/chunks/b28b487047da3aeef3fd.js +1 -0
- package/assets/esri/core/workers/chunks/b3e57824a5855cb37a96.js +1 -0
- package/assets/esri/core/workers/chunks/b89449ead32e4cd21edd.js +1 -0
- package/assets/esri/core/workers/chunks/b99891ed5a02cab02173.js +1 -0
- package/assets/esri/core/workers/chunks/bac84bc621be73a7a4bc.js +1 -0
- package/assets/esri/core/workers/chunks/{25037dcf8a0c72b7b647.js → bbe068388167e9dd0c11.js} +1 -1
- package/assets/esri/core/workers/chunks/c271a1857bcc4e9a36dd.js +1 -0
- package/assets/esri/core/workers/chunks/{eb3035e49a45ecc82575.js → c5030664720fcdc6d85e.js} +1 -1
- package/assets/esri/core/workers/chunks/c534ed122f8a1202d3a3.js +1 -0
- package/assets/esri/core/workers/chunks/c5ef2e28b0c539ddb6a7.js +1 -0
- package/assets/esri/core/workers/chunks/c65e5ccfae03d148d82b.js +1 -0
- package/assets/esri/core/workers/chunks/c91660f3982be4e03705.js +1 -0
- package/assets/esri/core/workers/chunks/ce93113b99bdbeddd07b.js +1 -0
- package/assets/esri/core/workers/chunks/cf2d408e669cfa2c65be.js +1 -0
- package/assets/esri/core/workers/chunks/d08f63ffeecefa02ad91.js +1 -0
- package/assets/esri/core/workers/chunks/{8d33644192c01e5416b4.js → d1a71b58ef62e71979c5.js} +1 -1
- package/assets/esri/core/workers/chunks/d30eade5afecd334f6cb.js +1 -0
- package/assets/esri/core/workers/chunks/d8782d0856b9d815cb6c.js +1 -0
- package/assets/esri/core/workers/chunks/db16c21b650001502e6c.js +1 -0
- package/assets/esri/core/workers/chunks/db18110c57253a31ac96.js +1 -0
- package/assets/esri/core/workers/chunks/dbaa5fb466d6c0214f24.js +1 -0
- package/assets/esri/core/workers/chunks/deae370788a7aacf4dd5.js +1 -0
- package/assets/esri/core/workers/chunks/e6ca132e1eeea3aa174e.js +1 -0
- package/assets/esri/core/workers/chunks/e878ccc431729ef3360f.js +1 -0
- package/assets/esri/core/workers/chunks/eb124f15ad4b9193f00a.js +1 -0
- package/assets/esri/core/workers/chunks/ebc71c06c1c22aaef54e.js +1 -0
- package/assets/esri/core/workers/chunks/f183da283af0836421ab.js +1 -0
- package/assets/esri/core/workers/chunks/f42bdc2a134833d33b4e.js +1 -0
- package/assets/esri/core/workers/chunks/{736d628cda4e02d40337.js → f8612c2fc5739e98be58.js} +1 -1
- package/assets/esri/core/workers/chunks/f965e3e5f6f4f9ba54ac.js +1 -0
- package/assets/esri/core/workers/chunks/fa4089640f480b69962e.js +1 -0
- package/assets/esri/core/workers/chunks/fb219563e5169ea67d68.js +1 -0
- package/assets/esri/libs/i3s/i3s.wasm +0 -0
- package/chunks/ChapmanAtmosphere.glsl.js +56 -77
- package/chunks/Clouds.glsl.js +1 -1
- package/chunks/Pattern.glsl.js +9 -11
- package/chunks/RibbonLine.glsl.js +60 -68
- package/chunks/i3s.js +1 -1
- package/chunks/mat4.js +1 -1
- package/chunks/vec3.js +1 -1
- package/core/Collection.js +1 -1
- package/core/Loadable.js +1 -1
- package/core/accessorSupport/ensureType.js +1 -1
- package/core/promiseUtils.js +1 -1
- package/core/support/OwningCollection.js +1 -1
- package/core/workers/RemoteClient.js +1 -1
- package/core/workers/WorkerOwner.js +1 -1
- package/core/workers/workers.js +2 -2
- package/geometry/projection.js +1 -1
- package/identity/IdentityManagerBase.js +1 -1
- package/interfaces.d.ts +205 -497
- package/layers/ElevationLayer.js +1 -1
- package/layers/GeoJSONLayer.js +1 -1
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/VectorTileLayer.js +1 -1
- package/layers/VoxelWasmPerScene.js +1 -1
- package/layers/WCSLayer.js +1 -1
- package/layers/analyses/AreaMeasurement3D.js +1 -1
- package/layers/analyses/DirectLineMeasurement3D.js +1 -1
- package/layers/analyses/Slice.js +1 -1
- package/layers/effects/EffectList.js +1 -1
- package/layers/effects/effects.js +1 -1
- package/layers/effects/jsonUtils.js +1 -1
- package/layers/effects/parser.js +1 -1
- package/layers/effects/utils.js +5 -0
- package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/graphics/data/QueryEngine.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/sources/connections/GeoEventConnection.js +1 -1
- package/layers/mixins/ImageryTileMixin.js +1 -1
- package/layers/support/RasterWorker.js +1 -1
- package/layers/support/TilemapCache.js +1 -1
- package/layers/support/rasterDatasets/BaseRaster.js +1 -1
- package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
- package/layers/support/rasterDatasets/WCSRaster.js +1 -1
- package/layers/support/rasterFunctions/pixelUtils.js +1 -1
- package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
- package/package.json +2 -2
- package/portal/support/portalLayers.js +1 -1
- package/request.js +1 -1
- package/smartMapping/renderers/support/utils.js +1 -1
- package/smartMapping/statistics/support/WorkerClient.js +1 -1
- package/smartMapping/statistics/support/statsWorker.js +1 -1
- package/smartMapping/statistics/support/utils.js +1 -1
- package/smartMapping/support/adapters/CSVLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/SceneLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/support/utils.js +1 -1
- package/statistics/utils.js +1 -1
- package/support/GraphicsCollection.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/FillSymbol3DLayer.js +1 -1
- package/symbols/IconSymbol3DLayer.js +1 -1
- package/symbols/LineSymbol3DLayer.js +1 -1
- package/symbols/patterns/LinePattern3D.js +5 -0
- package/symbols/patterns/LineStylePattern3D.d.ts +4 -0
- package/symbols/patterns/LineStylePattern3D.js +5 -0
- package/symbols/patterns/StylePattern3D.js +1 -1
- package/symbols/patterns/lineStyles.js +5 -0
- package/symbols/patterns/utils.js +1 -1
- package/symbols/support/Symbol3DFillMaterial.js +1 -1
- package/symbols/support/Symbol3DIconOutline.js +5 -0
- package/symbols/support/Symbol3DMaterial.js +1 -1
- package/symbols/support/Symbol3DOutline.js +1 -1
- package/symbols/support/defaults3D.js +1 -1
- package/symbols/support/previewSymbol3D.js +1 -1
- package/symbols/support/symbolLayerUtils3D.js +1 -1
- package/views/2d/engine/vectorTiles/TileParser.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
- package/views/2d/engine/vectorTiles/style/StyleRepository.js +1 -1
- package/views/2d/engine/webgl/effects/HittestEffect.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/ImageryLayerView2D.js +1 -1
- package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
- package/views/2d/layers/VectorTileLayerView2D.js +1 -1
- package/views/2d/layers/features/controllers/EditsQueue.js +1 -1
- package/views/2d/layers/features/controllers/FeatureController2D.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
- package/views/2d/layers/support/FeatureLayerProxy.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/ChapmanAtmosphereTechnique.js +1 -1
- package/views/3d/environment/CloudsGenerator.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/environment/PanoramicAtmosphere.js +1 -1
- package/views/3d/environment/SimpleAtmosphere.js +1 -1
- package/views/3d/externalRenderers/ExternalRendererStore.js +1 -1
- package/views/3d/externalRenderers.js +1 -1
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/interactive/analysisTools/slice/SliceTool.js +1 -1
- package/views/3d/interactive/analysisTools/slice/images/Factory.js +5 -0
- package/views/3d/interactive/analysisTools/slice/sliceToolConfig.js +1 -1
- package/views/3d/interactive/analysisTools/slice/sliceToolUtils.js +1 -1
- package/views/3d/interactive/editingTools/settings.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/ExtentTransformTool.js +1 -1
- package/views/3d/interactive/graphics/Slice/SliceController.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DView.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/LaserlineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/SlicePlaneVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/VerticesVisualElement.js +1 -1
- package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
- package/views/3d/layers/DynamicLayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/VectorTileLayerView3D.js +1 -1
- package/views/3d/layers/analyses/AreaMeasurement3D/AreaMeasurementView3D.js +1 -1
- package/views/3d/layers/analyses/AreaMeasurement3D/support/AreaMeasurementPathHelper.js +1 -1
- package/views/3d/layers/analyses/AreaMeasurement3D/support/AreaMeasurementVisualization.js +1 -1
- package/views/3d/layers/analyses/DirectLineMeasurement3D/DirectLineMeasurementView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/ElevationAligners.js +1 -1
- package/views/3d/layers/graphics/ElevationQuery.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLodInstanceGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
- package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/graphics/Loadable.js +1 -1
- package/views/3d/layers/graphics/ObjectResourceCache.js +1 -1
- package/views/3d/layers/graphics/elevationAlignmentUtils.js +1 -1
- package/views/3d/layers/graphics/graphicUtils.js +1 -1
- package/views/3d/layers/graphics/labelPlacement.js +1 -1
- package/views/3d/layers/graphics/pointUtils.js +1 -1
- package/views/3d/layers/i3s/I3SAttributeOverrides.js +1 -1
- package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
- package/views/3d/layers/i3s/I3SStreamDataController.js +1 -1
- package/views/3d/layers/i3s/PointRenderer.js +1 -1
- package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/patternUtils.js +1 -1
- package/views/3d/state/GoToOperation.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/support/LaserLineRenderer.js +1 -1
- package/views/3d/support/SharedSymbolResources.js +1 -1
- package/views/3d/support/StreamDataLoader.js +1 -1
- package/views/3d/support/StreamTextureCollection.js +5 -0
- package/views/3d/support/TextureCollection.js +1 -1
- package/views/3d/support/debugFlags.js +1 -1
- package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/StableSurfaceCenter.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/OverlayRenderTarget.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/webgl-engine/Stage.js +1 -1
- package/views/3d/webgl-engine/core/material/RenderTexture.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +13 -12
- package/views/3d/webgl-engine/core/shaderLibrary/shading/Reprojection.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +10 -3
- package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueRepository.js +1 -1
- package/views/3d/webgl-engine/lib/Camera.js +1 -1
- package/views/3d/webgl-engine/lib/GLMaterialRepository.js +1 -1
- package/views/3d/webgl-engine/lib/GLMaterialTexture.js +1 -1
- package/views/3d/webgl-engine/lib/GLMaterials.js +1 -1
- package/views/3d/webgl-engine/lib/Material.js +1 -1
- package/views/3d/webgl-engine/lib/ModelDirtySet.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/SmaaRenderPass.js +1 -1
- package/views/3d/webgl-engine/lib/TextTexture.js +1 -1
- package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/lib/Texture.js +1 -1
- package/views/3d/webgl-engine/lib/TextureRepository.js +1 -1
- package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodComponentData.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodLevel.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
- package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterGLMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/lineStippleUtils.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/parts/Model.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
- package/views/LayerViewManager.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/ToolViewManager.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
- package/views/support/AllocationTracer.js +1 -1
- package/views/support/DefaultsFromMap.js +1 -1
- package/views/support/QueueProcessor.js +1 -1
- package/views/webgl/capabilities/load.js +1 -1
- package/webscene/Slide.js +1 -1
- package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
- package/widgets/AreaMeasurement3D/AreaMeasurement3DViewModel.js +1 -1
- package/widgets/BuildingExplorer/support/layerUtils.js +1 -1
- package/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js +1 -1
- package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Feature/FeatureViewModel.js +1 -1
- package/widgets/Home/HomeViewModel.js +1 -1
- package/widgets/Locate/LocateViewModel.js +1 -1
- package/widgets/Popup/PopupViewModel.js +1 -1
- package/widgets/Search/SearchViewModel.js +1 -1
- package/widgets/Search.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Slice/SliceViewModel.js +1 -1
- package/widgets/TimeSlider/TimeSliderViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/0283801d442984997abe.js +0 -1
- package/assets/esri/core/workers/chunks/0419e14a520b8fcf3e7a.js +0 -1
- package/assets/esri/core/workers/chunks/05318446b6a40caea361.js +0 -1
- package/assets/esri/core/workers/chunks/09e714d4381649348ac9.js +0 -1
- package/assets/esri/core/workers/chunks/0cecd668b9d5d3f83293.js +0 -1
- package/assets/esri/core/workers/chunks/13a73a88efd4f464173e.js +0 -1
- package/assets/esri/core/workers/chunks/1576727e8174d672555b.js +0 -1
- package/assets/esri/core/workers/chunks/1a3cbeb0a53d03a51dad.js +0 -1
- package/assets/esri/core/workers/chunks/1b8524b617bfc6fe422c.js +0 -1
- package/assets/esri/core/workers/chunks/1dc1d750046912ff6cef.js +0 -1
- package/assets/esri/core/workers/chunks/21fa174c114640be5e40.js +0 -1
- package/assets/esri/core/workers/chunks/2a3f6e56079620421a02.js +0 -1
- package/assets/esri/core/workers/chunks/2a5bcc73e55986ad93fe.js +0 -1
- package/assets/esri/core/workers/chunks/2a6f2e3d639aae491171.js +0 -1
- package/assets/esri/core/workers/chunks/2c17d1bad17bcee53f7d.js +0 -1
- package/assets/esri/core/workers/chunks/2cea27a0d07aa9a88ad4.js +0 -1
- package/assets/esri/core/workers/chunks/2e193d97d199b29b00c2.js +0 -1
- package/assets/esri/core/workers/chunks/2eb41fdf0d0a3b0c3232.js +0 -1
- package/assets/esri/core/workers/chunks/2f09ea639ca5d1d6ca7e.js +0 -1
- package/assets/esri/core/workers/chunks/2fb847ab1440bd1bdf15.js +0 -1
- package/assets/esri/core/workers/chunks/402d22ebbae608760b4f.js +0 -1
- package/assets/esri/core/workers/chunks/44daef7f0cbc6f6af09f.js +0 -1
- package/assets/esri/core/workers/chunks/46899156159e398c693f.js +0 -1
- package/assets/esri/core/workers/chunks/46bf8921db25845c63c0.js +0 -1
- package/assets/esri/core/workers/chunks/4eb23554e375350f73b5.js +0 -1
- package/assets/esri/core/workers/chunks/551917be63a513dfa4de.js +0 -1
- package/assets/esri/core/workers/chunks/564f6f5484bcb13ebb2b.js +0 -1
- package/assets/esri/core/workers/chunks/61df67ae47b7fb5875d9.js +0 -1
- package/assets/esri/core/workers/chunks/62642a8fc7bafe339984.js +0 -1
- package/assets/esri/core/workers/chunks/6304f4e53027df04eb8f.js +0 -1
- package/assets/esri/core/workers/chunks/6331987617ad166ea098.js +0 -1
- package/assets/esri/core/workers/chunks/6b13fcbc71c0088d317e.js +0 -1
- package/assets/esri/core/workers/chunks/6f7a6841e7269d2764ad.js +0 -1
- package/assets/esri/core/workers/chunks/70110efd2de23d9a5263.js +0 -1
- package/assets/esri/core/workers/chunks/7eae3f0588cde44fce39.js +0 -1
- package/assets/esri/core/workers/chunks/80d3c7a429c6412f1a8d.js +0 -1
- package/assets/esri/core/workers/chunks/80deebdf54bea04a0889.js +0 -1
- package/assets/esri/core/workers/chunks/81aa5fe7dcb4fdeb0974.js +0 -1
- package/assets/esri/core/workers/chunks/840d08b41913cad4df89.js +0 -1
- package/assets/esri/core/workers/chunks/85d154aeb511c5d70bb1.js +0 -1
- package/assets/esri/core/workers/chunks/8681e99e2bc9ece61c43.js +0 -1
- package/assets/esri/core/workers/chunks/8e5ef967f6518f4c93b1.js +0 -1
- package/assets/esri/core/workers/chunks/8edd7f70c8b95c34125c.js +0 -1
- package/assets/esri/core/workers/chunks/9044a7b90a53312b6392.js +0 -1
- package/assets/esri/core/workers/chunks/905b4dfc1ce57a225fa4.js +0 -1
- package/assets/esri/core/workers/chunks/945f90b31ebfae623ea0.js +0 -1
- package/assets/esri/core/workers/chunks/9943fd69b67cd1871d68.js +0 -1
- package/assets/esri/core/workers/chunks/9ad91c23480ffb656030.js +0 -1
- package/assets/esri/core/workers/chunks/9d103681372ab01a4147.js +0 -1
- package/assets/esri/core/workers/chunks/9d3230f59b4c4d1b2713.js +0 -1
- package/assets/esri/core/workers/chunks/9db75bc0980d16b730a1.js +0 -1
- package/assets/esri/core/workers/chunks/a0659b8bdc067da7badd.js +0 -1
- package/assets/esri/core/workers/chunks/a480ee9a994410177961.js +0 -1
- package/assets/esri/core/workers/chunks/a9b279975d7df0f295d7.js +0 -1
- package/assets/esri/core/workers/chunks/aa3abaa5ad4a5a3bcb84.js +0 -1
- package/assets/esri/core/workers/chunks/aa8e607f908297786675.js +0 -1
- package/assets/esri/core/workers/chunks/ab5a302b5f62d38293f9.js +0 -1
- package/assets/esri/core/workers/chunks/abd6a84396e0eb3f01ad.js +0 -1
- package/assets/esri/core/workers/chunks/abe9f8516b03a3fb0477.js +0 -1
- package/assets/esri/core/workers/chunks/aff6aa5c7f75f8e052d9.js +0 -1
- package/assets/esri/core/workers/chunks/b601cc5304b132536239.js +0 -1
- package/assets/esri/core/workers/chunks/b85f614ddbddd3c3007e.js +0 -1
- package/assets/esri/core/workers/chunks/b944f4ab25a691b3e611.js +0 -1
- package/assets/esri/core/workers/chunks/bbdacddb61e651ca0098.js +0 -1
- package/assets/esri/core/workers/chunks/c2fa728e805637a1783e.js +0 -1
- package/assets/esri/core/workers/chunks/c901f5f85d962254fc2c.js +0 -1
- package/assets/esri/core/workers/chunks/ca173b908d89a4e334f6.js +0 -1
- package/assets/esri/core/workers/chunks/cc2ef3bfa1f614d7452c.js +0 -1
- package/assets/esri/core/workers/chunks/cdb32a9ac9f5804c4212.js +0 -1
- package/assets/esri/core/workers/chunks/ce9a4997973da80141a5.js +0 -1
- package/assets/esri/core/workers/chunks/d0674b50a358d3bb9db2.js +0 -1
- package/assets/esri/core/workers/chunks/d18b7b4b3b9bea7204b0.js +0 -1
- package/assets/esri/core/workers/chunks/d2ce983f7babdf18a0ed.js +0 -1
- package/assets/esri/core/workers/chunks/d38a0d867dc6cecdc551.js +0 -1
- package/assets/esri/core/workers/chunks/e39ca33e9e463c1d6060.js +0 -1
- package/assets/esri/core/workers/chunks/e471d103205018a5cf7f.js +0 -1
- package/assets/esri/core/workers/chunks/e542fb044fc96f7e8af2.js +0 -1
- package/assets/esri/core/workers/chunks/e94e00a28591337b2def.js +0 -1
- package/assets/esri/core/workers/chunks/eb2709ccbc001f42ac1b.js +0 -1
- package/assets/esri/core/workers/chunks/f905511ca5f9b59fc17f.js +0 -1
- package/assets/esri/core/workers/chunks/f910e80dd87727af5184.js +0 -1
- package/assets/esri/core/workers/chunks/f9300a24305b0af1d227.js +0 -1
- package/assets/esri/core/workers/chunks/fa1e1ac5b3ef7bdf8a78.js +0 -1
- package/assets/esri/core/workers/chunks/fce76a84c7d25d8d47e8.js +0 -1
- package/assets/esri/core/workers/chunks/fef4f97fbe861a1b60e8.js +0 -1
- package/layers/AreaMeasurementLayer.d.ts +0 -4
- package/layers/DirectLineMeasurementLayer.d.ts +0 -4
- package/symbols/support/symbolPreview.d.ts +0 -4
- package/symbols/support/symbolPreview.js +0 -5
- package/views/3d/layers/AreaMeasurementLayerView3D.d.ts +0 -4
- package/views/3d/layers/DirectLineMeasurementLayerView3D.d.ts +0 -4
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.22/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/Accessor.js";import{HandleOwnerMixin as i}from"../../../../core/HandleOwner.js";import"../../../../core/has.js";import{isSome as s,isNone as r}from"../../../../core/maybe.js";import{throwIfAborted as a,isAbortError as o,createAbortController as h}from"../../../../core/promiseUtils.js";import{createScreenPoint as n}from"../../../../core/screenUtils.js";import{property as d}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../../../core/accessorSupport/decorators/subclass.js";import l from"../../../../geometry/Polygon.js";import c from"../../../../geometry/SpatialReference.js";import{width as g,height as u,create as m}from"../../../../geometry/support/aaBoundingRect.js";import{closeRingsAndFixWinding as _}from"../../../../geometry/support/coordsUtils.js";import{getJsonType as f,isPolygon as y,isPolyline as w,isExtent as S,isPoint as b,isMultipoint as T}from"../../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridianSync as v}from"../../../../geometry/support/normalizeUtilsSync.js";import{getInfo as I}from"../../../../geometry/support/spatialReferenceUtils.js";import{checkProjectionSupport as G,project as U}from"../../../../layers/graphics/data/projectionSupport.js";import{expandSymbol as j}from"../../../../symbols/cim/cimSymbolUtils.js";import{errorPolylineSymbol2D as C,errorPolygonSymbol2D as P,errorPointSymbol2D as x}from"../../../../symbols/support/defaults.js";import{FILTER_FLAG_0 as A}from"../../engine/webgl/definitions.js";import{GraphicTile as M}from"../../engine/webgl/GraphicTile.js";import{TileData as R}from"../../engine/webgl/TileData.js";import F from"../../engine/webgl/WGLDisplayObject.js";import{MeshData as q}from"../../engine/webgl/mesh/MeshData.js";import{WGLMeshFactory as z}from"../../engine/webgl/mesh/factories/WGLMeshFactory.js";import{WGLTemplateStore as D}from"../../engine/webgl/mesh/templates/WGLTemplateStore.js";import{bidiText as O}from"../../engine/webgl/util/BidiText.js";import{createMatcher as H}from"../../engine/webgl/util/Matcher.js";import{createMatcherSchema as k,createSymbolSchema as E}from"../features/schemaUtils.js";import N from"../features/support/AttributeStore.js";import{ComputedAttributeStorage as V}from"../features/support/ComputedAttributeStorage.js";import{GraphicsReader as L}from"../features/support/GraphicsReader.js";import B from"./GraphicStore.js";import{intersectingInternationalDateline as W,isMarkerSymbol as J,isTextSymbol as Z,TILE_SIZE as K,PIXEL_BUFFER as Q}from"./graphicsUtils.js";import{GraphicsView as X}from"../../../layers/GraphicsView.js";import Y from"../../../webgl/capabilities.js";function $(t,e,i){if(i.has(t))return i.get(t);const s={tile:e,addedOrModified:[],removed:[]};return i.set(t,s),s}let tt=class extends(X(i(e))){constructor(t){super(t),this._storage=new V,this._displayIds=new Map,this._controller=new AbortController,this._tiles=new Map,this._graphicStoreUpdate=!1,this._graphicsSet=new Set,this._matcher=Promise.resolve(null),this._tileUpdateSet=new Set,this._tilesToUpdate=new Map,this._graphicIdToAbortController=new Map,this._attached=!1,this._highlightIds=new Map,this._updatingGraphicsTimer=null,this._hashToExpandedSymbol=new Map,this._hashTpExpandedSymbolPromise=new Map,this._processing=!1,this._needsProcessing=!1,this._pendingUpdate={added:new Set,updated:new Set,removed:new Set},this.lastUpdateId=-1,this.updateRequested=!1,this.graphicUpdateHandler=this.graphicUpdateHandler.bind(this)}_createMatcher(t,e){if(t){const i=k({indexCount:0,fields:{}},"feature",t);this._matcher=H(i,e,null)}}_createDisplayId(t){return this._displayIds.has(t)||this._displayIds.set(t,this._storage.createDisplayId()),this._displayIds.get(t)}initialize(){this._attributeStore=new N({type:"local",initialize:t=>Promise.resolve(this.container.attributeView.initialize(t)),update:t=>this.container.attributeView.requestUpdate(t),render:()=>this.container.requestRender()},Y()),this.container.hasHighlight=()=>!!this._highlightIds.size;const t=t=>{this._createDisplayId(t.uid),this._setFilterState(t.uid,t.visible)},e=t=>{const e=this._displayIds.get(t.uid);this._displayIds.delete(t.uid),this._storage.releaseDisplayId(e)};this._graphicStore=new B(this.view.featuresTilingScheme,this.view.state.scale,this.uid,this.graphics,t,e);const i=new D(this.container.getMaterialItems.bind(this.container),this.view.featuresTilingScheme.tileInfo);this._createMatcher(this.renderer,i),this._meshFactory=new z(null,this.uid,i),this._templateStore=i,this.handles.add([this.watch("renderer",(t=>{this._createMatcher(t,i);for(const e of this.graphics)this._pendingUpdate.updated.add(e);this.requestUpdate()})),this.view.graphicsTileStore.on("update",this._onTileUpdate.bind(this)),this.container.on("attach",(()=>{this.graphics.items.length>0&&this._graphicsChangeHandler({target:this.graphics,added:this.graphics.items,removed:[],moved:[]}),this.handles.add(this.graphics.on("change",(t=>this._graphicsChangeHandler(t))),"graphics"),this._attached=!0,this.notifyChange("updating")}))]);const s=this.view.graphicsTileStore.tiles;this._onTileUpdate({added:s,removed:[]})}destroy(){this._updatingGraphicsTimer&&(clearTimeout(this._updatingGraphicsTimer),this._updatingGraphicsTimer=null,this.notifyChange("updating")),this._controller.abort(),this.container.destroy(),this._set("graphics",null),this._graphicStore.clear(),this._attributeStore=null,this._hashToExpandedSymbol.clear(),this.view=null,this.renderer=null}get updating(){return!this._attached||null!==this._updatingGraphicsTimer||this._tileUpdateSet.size>0||this._tilesToUpdate.size>0}hitTest(t,e){if(!this.view||!this.view.position)return Promise.resolve(null);const i=this.view.toMap(n(t,e));return this.searchFeatures(i).then((t=>t&&t.length?t[0]:null))}async searchFeatures(t,e=2){return this._graphicStore.hitTest(t.x,t.y,e,this.view.state.resolution,this.view.state.rotation)}update(t){a(this._controller.signal);const e=t.state,i=this.view.featuresTilingScheme.getClosestInfoForScale(e.scale).level;if(this._graphicStore.updateLevel(i),this._graphicStoreUpdate=!0,this.updateRequested=!1,this._pendingUpdate.updated.size>0){if(!this._processing)return void this._updateGraphics();this._needsProcessing=!0}}viewChange(){this.requestUpdate()}requestUpdate(){this.updateRequested||(this.updateRequested=!0,this.requestUpdateCallback())}processUpdate(t){this.updateRequested&&(this.updateRequested=!1,this.update(t))}graphicUpdateHandler(t){const{graphic:e,property:i,newValue:s}=t;switch(i){case"attributes":break;case"geometry":case"symbol":this._pendingUpdate.updated.add(e),this.requestUpdate();break;case"visible":this._setFilterState(e.uid,s),this._attributeStore.sendUpdates()}}addHighlight(t){for(const e of t)if(this._highlightIds.has(e)){const t=this._highlightIds.get(e);this._highlightIds.set(e,t+1)}else this._highlightIds.set(e,1);this._updateHighlight()}removeHighlight(t){for(const e of t)if(this._highlightIds.has(e)){const t=this._highlightIds.get(e)-1;0===t?this._highlightIds.delete(e):this._highlightIds.set(e,t)}this._updateHighlight()}_updateHighlight(){const t=Array.from(this._highlightIds.keys()),e=t.map((t=>this._displayIds.get(t)));this._attributeStore.setHighlight(t,e)}_getIntersectingTiles(t){const e=this._graphicStore.getBounds(t);if(!e||0===g(e)||0===u(e))return[];const i=W(e,this.view.spatialReference);return s(i)?[...new Set([...this.view.graphicsTileStore.boundsIntersections(i[0]),...this.view.graphicsTileStore.boundsIntersections(i[1])])]:this.view.graphicsTileStore.boundsIntersections(e)}async _updateTile(t){a(this._controller.signal);const e=t.tile,i=this._getGraphicsData(this._templateStore,e,t.addedOrModified),s=await this._processGraphics(e,i);return a(this._controller.signal),this._patchTile(e.key,{type:"update",addOrUpdate:s,remove:t.removed,end:!0,clear:!1,sort:!1}),s}_patchTile(t,e){if(!this._tiles.has(t))return;const i=this._tiles.get(t);this.container.onTileData(i,e),this.container.requestRender()}_graphicsChangeHandler(t){const e=this._pendingUpdate;for(const i of t.added)e.added.add(i);for(const i of t.moved)e.updated.add(i);for(const i of t.removed)this._pendingUpdate.added.has(i)?e.added.delete(i):e.removed.add(i);this._processing?this._needsProcessing=!0:this._updateGraphics()}_getGraphicsToUpdate(){const t={added:[],removed:[],updated:[]};if(!this.graphics)return t;const e=this._pendingUpdate;for(const i of this.graphics.items)e.added.has(i)?t.added.push(i):e.updated.has(i)&&t.updated.push(i);for(const i of e.removed)this._graphicStore.has(i)&&t.removed.push(i);return e.added.clear(),e.removed.clear(),e.updated.clear(),t}async _updateGraphics(){this._processing=!0;const{added:t,removed:e,updated:i}=this._getGraphicsToUpdate(),s=this._tilesToUpdate;let r;try{if(!this._graphicStoreUpdate){const t=this.view.state,e=this.view.featuresTilingScheme.getClosestInfoForScale(t.scale).level;this._graphicStore.updateLevel(e)}const a=[],o=new Array(t.length+e.length);for(let t=0;t<i.length;t++){const e=i[t],h=this._getIntersectingTiles(e);for(const t of h){r=t.id;$(r,t,s).removed.push(this._displayIds.get(e.uid))}a.push(this._updateGraphic(e,null)),o[t]=e}const h=i.length;for(let e=0;e<t.length;e++){const i=t[e];o[h+e]=i,this._graphicsSet.add(i),a.push(this._addGraphic(i))}for(const t of e){this._abortProcessingGraphic(t.uid);const e=this._getIntersectingTiles(t);for(const i of e){r=i.id;$(r,i,s).removed.push(this._displayIds.get(t.uid))}this._graphicsSet.delete(t),this._graphicStore.remove(t)}let n;this._flipUpdatingGraphics(),await Promise.all(a);for(let t=0;t<o.length;t++){n=o[t];const e=this._getIntersectingTiles(n);for(const t of e){r=t.id;$(r,t,s).addedOrModified.push(n)}}this._graphicStore.updateZ();const d=[];for(const[t,e]of s)d.push(this._updateTile(e));await Promise.all(d)}catch(a){o(a),0}for(const h of e)try{const t=await this._getSymbolForGraphic(h,{});t&&this._hashToExpandedSymbol.delete(t.hash())}catch(a){o(a),0}s.clear(),this.notifyChange("updating"),this._processing=!1,this._needsProcessing&&(this._needsProcessing=!1,this._updateGraphics())}_getArcadeInfo(t){const e=(t.attributes?Object.keys(t.attributes):[]).map((e=>({name:e,alias:e,type:"string"==typeof t.attributes[e]?"esriFieldTypeString":"esriFieldTypeDouble"})));return r(t.geometry)?null:{geometryType:f(t.geometry),spatialReference:c.fromJSON(t.geometry.spatialReference),fields:e}}async _getSymbolForGraphic(t,e){return a(this._controller.signal),s(t.symbol)?t.symbol:s(this.renderer)?this.renderer.getSymbolAsync(t,{scale:this.view.scale,abortOptions:e}):this._getNullSymbol(t)}async _getSymbolResources(t,e){if(a(this._controller.signal),!this.container.stage)return null;const i=await this._getSymbolForGraphic(t,e),s=i.hash();let r=this._hashToExpandedSymbol.get(s);if(!r){let h=this._hashTpExpandedSymbolPromise.get(s);if(h)r=await h,a(this._controller.signal);else{const n=this._getArcadeInfo(t),d=E(i);h=j(d,n,e),this._hashTpExpandedSymbolPromise.set(s,h);try{r=await h,this._hashTpExpandedSymbolPromise.delete(s),this._hashToExpandedSymbol.set(s,r)}catch(o){this._hashTpExpandedSymbolPromise.delete(s),a(o)}}}if("esriTS"===r.type){const t=[],[e]=O(r.text);for(let r=0;r<e.length;r++)t.push(e.charCodeAt(r));const i={symbol:r,id:0,glyphIds:t},[{mosaicItem:s}]=await this.container.getMaterialItems([i]);return{symbol:r,mosaicItem:s}}return{symbol:r,mosaicItem:null}}async _projectAndNormalizeGeometry(t,e){if(a(this._controller.signal),r(t.geometry)||"mesh"===t.geometry.type)return null;let i=t.geometry;if(y(i)){const t=i.rings;i.rings=t}else if(w(i)){const t=i.paths;i.paths=t}else if(S(i)){const s=await this._getSymbolForGraphic(t,e);if(a(this._controller.signal),J(s.type)||Z(s.type)){i=i.center}else i=l.fromExtent(i)}await G(i.spatialReference,this.view.spatialReference);const s=v(i),o=U(s,i.spatialReference,this.view.spatialReference);return _(o),o}_onTileUpdate(t){const e=I(this.view.spatialReference);if(t.added&&t.added.length>0)for(const i of t.added)this._addNewTile(i,e);if(t.removed&&t.removed.length>0)for(const i of t.removed)this._removeTile(i.key)}async _addGraphic(t){this._abortProcessingGraphic(t.uid),a(this._controller.signal);const e=h();this._graphicIdToAbortController.set(t.uid,e);const i={signal:e.signal};try{await this._addOrUpdateGraphic(t,i),a(this._controller.signal),this._graphicIdToAbortController.delete(t.uid)}catch(s){if(this._graphicIdToAbortController.delete(t.uid),!o(s))throw s}}async _updateGraphic(t,e){a(this._controller.signal);const i=this._projectAndNormalizeGeometry(t,e),s=this._getSymbolResources(t,e),[r,o]=await Promise.all([i,s]);a(this._controller.signal),this._graphicStore.addOrModify(t,o,r)}async _addOrUpdateGraphic(t,e){a(this._controller.signal);const i=this._projectAndNormalizeGeometry(t,e),s=this._getSymbolResources(t,e);try{const[e,r]=await Promise.all([i,s]);a(this._controller.signal),this._addProjectedGraphic(t,r,e)}catch(r){if(!o(r))throw r}}_addProjectedGraphic(t,e,i){this._graphicsSet.has(t)&&this._graphicStore.addOrModify(t,e,i)}_addTile(t){const e=this.view.featuresTilingScheme.getTileBounds(m(),t),i=new M(t,e[0],e[3]);return this._tiles.set(t,i),this.container.addChild(i),i}async _addNewTile(t,e){const i=this._addTile(t.key),s=this._graphicStore.queryTileData(this._templateStore,t);if(0===s.length)return;if(e){const i=Math.round((e.valid[1]-e.valid[0])/t.resolution);for(const t of s)t.geometry&&(b(t.geometry)||T(t.geometry))&&this._wrapPoints(t,i)}const r=t.key;this._tileUpdateSet.add(t.key),this.notifyChange("updating");try{const e={type:"update",clear:!1,addOrUpdate:await this._processGraphics(t,s),remove:[],end:!0,sort:!1};i.patch(e),this._tileUpdateSet.delete(r),this.notifyChange("updating")}catch(a){if(this._tileUpdateSet.delete(r),this.notifyChange("updating"),!o(a))throw a}}_removeTile(t){if(!this._tiles.has(t))return;const e=this._tiles.get(t);this.container.removeChild(e),e.destroy(),this._tiles.delete(t)}_setFilterState(t,e){const i=this._displayIds.get(t),s=this._attributeStore.getHighlightFlag(t);this._attributeStore.setData(i,0,0,s|(e?A:0))}_getGraphicsData(t,e,i){const s=I(this.view.spatialReference),r=this._graphicStore.getGraphicsData(t,e,i);if(s){const t=Math.round((s.valid[1]-s.valid[0])/e.resolution);for(const e of r)e.geometry&&(b(e.geometry)||T(e.geometry))&&this._wrapPoints(e,t)}return r}_wrapPoints(t,e){const i=t.geometry;T(i)?this._wrapMultipoint(i,e):this._wrapPoint(t,e)}_wrapMultipoint(t,e){const i=t.points,s=[];let r=0,a=0;for(const[o,h]of i){if(s.push([o+r,h]),r=0,e===K){const t=5*Q;o+a<t?(s.push([e,0]),r=-e):o+a>K-t&&(s.push([-e,0]),r=e)}else o+a<-Q?(s.push([e,0]),r=-e):o+a>K+Q&&(s.push([-e,0]),r=e);a+=o}t.points=s}_wrapPoint(t,e){const i=t.geometry;if(e===K){const s=5*Q;i.x<s?t.geometry={points:[[i.x,i.y],[e,0]]}:i.x>K-s&&(t.geometry={points:[[i.x,i.y],[-e,0]]})}else i.x<-Q?t.geometry={points:[[i.x,i.y],[e,0]]}:i.x>K+Q&&(t.geometry={points:[[i.x,i.y],[-e,0]]})}async _processGraphics(t,e,i){if(!(e&&e.length)||!this._meshFactory)return null;const s=L.from(e),r=this._meshFactory,a=await this._matcher;return await r.analyzeGraphics(s,a,null,null,i),this._attributeStore.sendUpdates(),this._processAnalyzedGraphics(t,s)}_processAnalyzedGraphics(t,e){const i=this._meshFactory,s=e.getSize(),r=e.getCursor(),a={features:s,records:s,metrics:0},o=new q(t.key.id,a,!1,!1,!1),h=[];for(;r.next();){const e=r.readGraphic();e.insertAfter=-1===e.insertAfter?-1:this._displayIds.get(e.insertAfter),e.displayId=this._displayIds.get(e.attributes[this.uid]);const s=new F(e.displayId);s.insertAfter=e.insertAfter,h.push(s),i.writeGraphic(o,r,t.level)}const n=t.tileInfoView.tileInfo.isWrappable,d=o.serialize(n);if(1!==d.length)return new R;const p=d[0].message;return R.fromVertexData(p,h)}_abortProcessingGraphic(t){if(this._graphicIdToAbortController.has(t)){this._graphicIdToAbortController.get(t).abort()}}_getNullSymbol(t){const e=t.geometry;return w(e)?C:y(e)||S(e)?P:x}_flipUpdatingGraphics(){this._updatingGraphicsTimer&&clearTimeout(this._updatingGraphicsTimer),this._updatingGraphicsTimer=setTimeout((()=>{this._updatingGraphicsTimer=null,this.notifyChange("updating")}),160),this.notifyChange("updating")}};t([d({constructOnly:!0})],tt.prototype,"requestUpdateCallback",void 0),t([d()],tt.prototype,"container",void 0),t([d({constructOnly:!0})],tt.prototype,"graphics",void 0),t([d()],tt.prototype,"updating",null),t([d()],tt.prototype,"view",void 0),t([d()],tt.prototype,"updateRequested",void 0),tt=t([p("esri.views.2d.layers.support.GraphicsView2D")],tt);const et=tt;export{et as default};
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/Accessor.js";import{HandleOwnerMixin as i}from"../../../../core/HandleOwner.js";import"../../../../core/has.js";import{isSome as s,isNone as r}from"../../../../core/maybe.js";import{throwIfAborted as a,isAbortError as o}from"../../../../core/promiseUtils.js";import{createScreenPoint as h}from"../../../../core/screenUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import p from"../../../../geometry/Polygon.js";import l from"../../../../geometry/SpatialReference.js";import{width as c,height as g,create as u}from"../../../../geometry/support/aaBoundingRect.js";import{closeRingsAndFixWinding as m}from"../../../../geometry/support/coordsUtils.js";import{getJsonType as _,isPolygon as f,isPolyline as y,isExtent as w,isPoint as S,isMultipoint as b}from"../../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridianSync as T}from"../../../../geometry/support/normalizeUtilsSync.js";import{getInfo as v}from"../../../../geometry/support/spatialReferenceUtils.js";import{checkProjectionSupport as I,project as G}from"../../../../layers/graphics/data/projectionSupport.js";import{expandSymbol as U}from"../../../../symbols/cim/cimSymbolUtils.js";import{errorPolylineSymbol2D as j,errorPolygonSymbol2D as C,errorPointSymbol2D as P}from"../../../../symbols/support/defaults.js";import{FILTER_FLAG_0 as x}from"../../engine/webgl/definitions.js";import{GraphicTile as A}from"../../engine/webgl/GraphicTile.js";import{TileData as M}from"../../engine/webgl/TileData.js";import R from"../../engine/webgl/WGLDisplayObject.js";import{MeshData as F}from"../../engine/webgl/mesh/MeshData.js";import{WGLMeshFactory as q}from"../../engine/webgl/mesh/factories/WGLMeshFactory.js";import{WGLTemplateStore as z}from"../../engine/webgl/mesh/templates/WGLTemplateStore.js";import{bidiText as D}from"../../engine/webgl/util/BidiText.js";import{createMatcher as O}from"../../engine/webgl/util/Matcher.js";import{createMatcherSchema as H,createSymbolSchema as k}from"../features/schemaUtils.js";import E from"../features/support/AttributeStore.js";import{ComputedAttributeStorage as N}from"../features/support/ComputedAttributeStorage.js";import{GraphicsReader as V}from"../features/support/GraphicsReader.js";import L from"./GraphicStore.js";import{intersectingInternationalDateline as B,isMarkerSymbol as W,isTextSymbol as J,TILE_SIZE as Z,PIXEL_BUFFER as K}from"./graphicsUtils.js";import{GraphicsView as Q}from"../../../layers/GraphicsView.js";import X from"../../../webgl/capabilities.js";function Y(t,e,i){if(i.has(t))return i.get(t);const s={tile:e,addedOrModified:[],removed:[]};return i.set(t,s),s}let $=class extends(Q(i(e))){constructor(t){super(t),this._storage=new N,this._displayIds=new Map,this._controller=new AbortController,this._tiles=new Map,this._graphicStoreUpdate=!1,this._graphicsSet=new Set,this._matcher=Promise.resolve(null),this._tileUpdateSet=new Set,this._tilesToUpdate=new Map,this._graphicIdToAbortController=new Map,this._attached=!1,this._highlightIds=new Map,this._updatingGraphicsTimer=null,this._hashToExpandedSymbol=new Map,this._hashTpExpandedSymbolPromise=new Map,this._processing=!1,this._needsProcessing=!1,this._pendingUpdate={added:new Set,updated:new Set,removed:new Set},this.lastUpdateId=-1,this.updateRequested=!1,this.graphicUpdateHandler=this.graphicUpdateHandler.bind(this)}_createMatcher(t,e){if(t){const i=H({indexCount:0,fields:{}},"feature",t);this._matcher=O(i,e,null)}}_createDisplayId(t){return this._displayIds.has(t)||this._displayIds.set(t,this._storage.createDisplayId()),this._displayIds.get(t)}initialize(){this._attributeStore=new E({type:"local",initialize:t=>Promise.resolve(this.container.attributeView.initialize(t)),update:t=>this.container.attributeView.requestUpdate(t),render:()=>this.container.requestRender()},X()),this.container.hasHighlight=()=>!!this._highlightIds.size;const t=t=>{this._createDisplayId(t.uid),this._setFilterState(t.uid,t.visible)},e=t=>{const e=this._displayIds.get(t.uid);this._displayIds.delete(t.uid),this._storage.releaseDisplayId(e)};this._graphicStore=new L(this.view.featuresTilingScheme,this.view.state.scale,this.uid,this.graphics,t,e);const i=new z(this.container.getMaterialItems.bind(this.container),this.view.featuresTilingScheme.tileInfo);this._createMatcher(this.renderer,i),this._meshFactory=new q(null,this.uid,i),this._templateStore=i,this.handles.add([this.watch("renderer",(t=>{this._createMatcher(t,i);for(const e of this.graphics)this._pendingUpdate.updated.add(e);this.requestUpdate()})),this.view.graphicsTileStore.on("update",this._onTileUpdate.bind(this)),this.container.on("attach",(()=>{this.graphics.items.length>0&&this._graphicsChangeHandler({target:this.graphics,added:this.graphics.items,removed:[],moved:[]}),this.handles.add(this.graphics.on("change",(t=>this._graphicsChangeHandler(t))),"graphics"),this._attached=!0,this.notifyChange("updating")}))]);const s=this.view.graphicsTileStore.tiles;this._onTileUpdate({added:s,removed:[]})}destroy(){this._updatingGraphicsTimer&&(clearTimeout(this._updatingGraphicsTimer),this._updatingGraphicsTimer=null,this.notifyChange("updating")),this._controller.abort(),this.container.destroy(),this._set("graphics",null),this._graphicStore.clear(),this._attributeStore=null,this._hashToExpandedSymbol.clear(),this.view=null,this.renderer=null}get updating(){return!this._attached||null!==this._updatingGraphicsTimer||this._tileUpdateSet.size>0||this._tilesToUpdate.size>0}hitTest(t,e){if(!this.view||!this.view.position)return Promise.resolve(null);const i=this.view.toMap(h(t,e));return this.searchFeatures(i).then((t=>t&&t.length?t[0]:null))}async searchFeatures(t,e=2){return this._graphicStore.hitTest(t.x,t.y,e,this.view.state.resolution,this.view.state.rotation)}update(t){a(this._controller.signal);const e=t.state,i=this.view.featuresTilingScheme.getClosestInfoForScale(e.scale).level;if(this._graphicStore.updateLevel(i),this._graphicStoreUpdate=!0,this.updateRequested=!1,this._pendingUpdate.updated.size>0){if(!this._processing)return void this._updateGraphics();this._needsProcessing=!0}}viewChange(){this.requestUpdate()}requestUpdate(){this.updateRequested||(this.updateRequested=!0,this.requestUpdateCallback())}processUpdate(t){this.updateRequested&&(this.updateRequested=!1,this.update(t))}graphicUpdateHandler(t){const{graphic:e,property:i,newValue:s}=t;switch(i){case"attributes":break;case"geometry":case"symbol":this._pendingUpdate.updated.add(e),this.requestUpdate();break;case"visible":this._setFilterState(e.uid,s),this._attributeStore.sendUpdates()}}addHighlight(t){for(const e of t)if(this._highlightIds.has(e)){const t=this._highlightIds.get(e);this._highlightIds.set(e,t+1)}else this._highlightIds.set(e,1);this._updateHighlight()}removeHighlight(t){for(const e of t)if(this._highlightIds.has(e)){const t=this._highlightIds.get(e)-1;0===t?this._highlightIds.delete(e):this._highlightIds.set(e,t)}this._updateHighlight()}_updateHighlight(){const t=Array.from(this._highlightIds.keys()),e=t.map((t=>this._displayIds.get(t)));this._attributeStore.setHighlight(t,e)}_getIntersectingTiles(t){const e=this._graphicStore.getBounds(t);if(!e||0===c(e)||0===g(e))return[];const i=B(e,this.view.spatialReference);return s(i)?[...new Set([...this.view.graphicsTileStore.boundsIntersections(i[0]),...this.view.graphicsTileStore.boundsIntersections(i[1])])]:this.view.graphicsTileStore.boundsIntersections(e)}async _updateTile(t){a(this._controller.signal);const e=t.tile,i=this._getGraphicsData(this._templateStore,e,t.addedOrModified),s=await this._processGraphics(e,i);return a(this._controller.signal),this._patchTile(e.key,{type:"update",addOrUpdate:s,remove:t.removed,end:!0,clear:!1,sort:!1}),s}_patchTile(t,e){if(!this._tiles.has(t))return;const i=this._tiles.get(t);this.container.onTileData(i,e),this.container.requestRender()}_graphicsChangeHandler(t){const e=this._pendingUpdate;for(const i of t.added)e.added.add(i);for(const i of t.moved)e.updated.add(i);for(const i of t.removed)this._pendingUpdate.added.has(i)?e.added.delete(i):e.removed.add(i);this._processing?this._needsProcessing=!0:this._updateGraphics()}_getGraphicsToUpdate(){const t={added:[],removed:[],updated:[]};if(!this.graphics)return t;const e=this._pendingUpdate;for(const i of this.graphics.items)e.added.has(i)?t.added.push(i):e.updated.has(i)&&t.updated.push(i);for(const i of e.removed)this._graphicStore.has(i)&&t.removed.push(i);return e.added.clear(),e.removed.clear(),e.updated.clear(),t}async _updateGraphics(){this._processing=!0;const{added:t,removed:e,updated:i}=this._getGraphicsToUpdate(),s=this._tilesToUpdate;let r;try{if(!this._graphicStoreUpdate){const t=this.view.state,e=this.view.featuresTilingScheme.getClosestInfoForScale(t.scale).level;this._graphicStore.updateLevel(e)}const a=[],o=new Array(t.length+e.length);for(let t=0;t<i.length;t++){const e=i[t],h=this._getIntersectingTiles(e);for(const t of h){r=t.id;Y(r,t,s).removed.push(this._displayIds.get(e.uid))}a.push(this._updateGraphic(e,null)),o[t]=e}const h=i.length;for(let e=0;e<t.length;e++){const i=t[e];o[h+e]=i,this._graphicsSet.add(i),a.push(this._addGraphic(i))}for(const t of e){this._abortProcessingGraphic(t.uid);const e=this._getIntersectingTiles(t);for(const i of e){r=i.id;Y(r,i,s).removed.push(this._displayIds.get(t.uid))}this._graphicsSet.delete(t),this._graphicStore.remove(t)}let n;this._flipUpdatingGraphics(),await Promise.all(a);for(let t=0;t<o.length;t++){n=o[t];const e=this._getIntersectingTiles(n);for(const t of e){r=t.id;Y(r,t,s).addedOrModified.push(n)}}this._graphicStore.updateZ();const d=[];for(const[t,e]of s)d.push(this._updateTile(e));await Promise.all(d)}catch(a){o(a),0}for(const h of e)try{const t=await this._getSymbolForGraphic(h,{});t&&this._hashToExpandedSymbol.delete(t.hash())}catch(a){o(a),0}s.clear(),this.notifyChange("updating"),this._processing=!1,this._needsProcessing&&(this._needsProcessing=!1,this._updateGraphics())}_getArcadeInfo(t){const e=(t.attributes?Object.keys(t.attributes):[]).map((e=>({name:e,alias:e,type:"string"==typeof t.attributes[e]?"esriFieldTypeString":"esriFieldTypeDouble"})));return r(t.geometry)?null:{geometryType:_(t.geometry),spatialReference:l.fromJSON(t.geometry.spatialReference),fields:e}}async _getSymbolForGraphic(t,e){return a(this._controller.signal),s(t.symbol)?t.symbol:s(this.renderer)?this.renderer.getSymbolAsync(t,{scale:this.view.scale,abortOptions:e}):this._getNullSymbol(t)}async _getSymbolResources(t,e){if(a(this._controller.signal),!this.container.stage)return null;const i=await this._getSymbolForGraphic(t,e),s=i.hash();let r=this._hashToExpandedSymbol.get(s);if(!r){let h=this._hashTpExpandedSymbolPromise.get(s);if(h)r=await h,a(this._controller.signal);else{const n=this._getArcadeInfo(t),d=k(i);h=U(d,n,e),this._hashTpExpandedSymbolPromise.set(s,h);try{r=await h,this._hashTpExpandedSymbolPromise.delete(s),this._hashToExpandedSymbol.set(s,r)}catch(o){this._hashTpExpandedSymbolPromise.delete(s),a(o)}}}if("esriTS"===r.type){const t=[],[e]=D(r.text);for(let r=0;r<e.length;r++)t.push(e.charCodeAt(r));const i={symbol:r,id:0,glyphIds:t},[{mosaicItem:s}]=await this.container.getMaterialItems([i]);return{symbol:r,mosaicItem:s}}return{symbol:r,mosaicItem:null}}async _projectAndNormalizeGeometry(t,e){if(a(this._controller.signal),r(t.geometry)||"mesh"===t.geometry.type)return null;let i=t.geometry;if(f(i)){const t=i.rings;i.rings=t}else if(y(i)){const t=i.paths;i.paths=t}else if(w(i)){const s=await this._getSymbolForGraphic(t,e);if(a(this._controller.signal),W(s.type)||J(s.type)){i=i.center}else i=p.fromExtent(i)}await I(i.spatialReference,this.view.spatialReference);const s=T(i),o=G(s,i.spatialReference,this.view.spatialReference);return m(o),o}_onTileUpdate(t){const e=v(this.view.spatialReference);if(t.added&&t.added.length>0)for(const i of t.added)this._addNewTile(i,e);if(t.removed&&t.removed.length>0)for(const i of t.removed)this._removeTile(i.key)}async _addGraphic(t){this._abortProcessingGraphic(t.uid),a(this._controller.signal);const e=new AbortController;this._graphicIdToAbortController.set(t.uid,e);const i={signal:e.signal};try{await this._addOrUpdateGraphic(t,i),a(this._controller.signal),this._graphicIdToAbortController.delete(t.uid)}catch(s){if(this._graphicIdToAbortController.delete(t.uid),!o(s))throw s}}async _updateGraphic(t,e){a(this._controller.signal);const i=this._projectAndNormalizeGeometry(t,e),s=this._getSymbolResources(t,e),[r,o]=await Promise.all([i,s]);a(this._controller.signal),this._graphicStore.addOrModify(t,o,r)}async _addOrUpdateGraphic(t,e){a(this._controller.signal);const i=this._projectAndNormalizeGeometry(t,e),s=this._getSymbolResources(t,e);try{const[e,r]=await Promise.all([i,s]);a(this._controller.signal),this._addProjectedGraphic(t,r,e)}catch(r){if(!o(r))throw r}}_addProjectedGraphic(t,e,i){this._graphicsSet.has(t)&&this._graphicStore.addOrModify(t,e,i)}_addTile(t){const e=this.view.featuresTilingScheme.getTileBounds(u(),t),i=new A(t,e[0],e[3]);return this._tiles.set(t,i),this.container.addChild(i),i}async _addNewTile(t,e){const i=this._addTile(t.key),s=this._graphicStore.queryTileData(this._templateStore,t);if(0===s.length)return;if(e){const i=Math.round((e.valid[1]-e.valid[0])/t.resolution);for(const t of s)t.geometry&&(S(t.geometry)||b(t.geometry))&&this._wrapPoints(t,i)}const r=t.key;this._tileUpdateSet.add(t.key),this.notifyChange("updating");try{const e={type:"update",clear:!1,addOrUpdate:await this._processGraphics(t,s),remove:[],end:!0,sort:!1};i.patch(e),this._tileUpdateSet.delete(r),this.notifyChange("updating")}catch(a){if(this._tileUpdateSet.delete(r),this.notifyChange("updating"),!o(a))throw a}}_removeTile(t){if(!this._tiles.has(t))return;const e=this._tiles.get(t);this.container.removeChild(e),e.destroy(),this._tiles.delete(t)}_setFilterState(t,e){const i=this._displayIds.get(t),s=this._attributeStore.getHighlightFlag(t);this._attributeStore.setData(i,0,0,s|(e?x:0))}_getGraphicsData(t,e,i){const s=v(this.view.spatialReference),r=this._graphicStore.getGraphicsData(t,e,i);if(s){const t=Math.round((s.valid[1]-s.valid[0])/e.resolution);for(const e of r)e.geometry&&(S(e.geometry)||b(e.geometry))&&this._wrapPoints(e,t)}return r}_wrapPoints(t,e){const i=t.geometry;b(i)?this._wrapMultipoint(i,e):this._wrapPoint(t,e)}_wrapMultipoint(t,e){const i=t.points,s=[];let r=0,a=0;for(const[o,h]of i){if(s.push([o+r,h]),r=0,e===Z){const t=5*K;o+a<t?(s.push([e,0]),r=-e):o+a>Z-t&&(s.push([-e,0]),r=e)}else o+a<-K?(s.push([e,0]),r=-e):o+a>Z+K&&(s.push([-e,0]),r=e);a+=o}t.points=s}_wrapPoint(t,e){const i=t.geometry;if(e===Z){const s=5*K;i.x<s?t.geometry={points:[[i.x,i.y],[e,0]]}:i.x>Z-s&&(t.geometry={points:[[i.x,i.y],[-e,0]]})}else i.x<-K?t.geometry={points:[[i.x,i.y],[e,0]]}:i.x>Z+K&&(t.geometry={points:[[i.x,i.y],[-e,0]]})}async _processGraphics(t,e,i){if(!(e&&e.length)||!this._meshFactory)return null;const s=V.from(e),r=this._meshFactory,a=await this._matcher;return await r.analyzeGraphics(s,a,null,null,i),this._attributeStore.sendUpdates(),this._processAnalyzedGraphics(t,s)}_processAnalyzedGraphics(t,e){const i=this._meshFactory,s=e.getSize(),r=e.getCursor(),a={features:s,records:s,metrics:0},o=new F(t.key.id,a,!1,!1,!1),h=[];for(;r.next();){const e=r.readGraphic();e.insertAfter=-1===e.insertAfter?-1:this._displayIds.get(e.insertAfter),e.displayId=this._displayIds.get(e.attributes[this.uid]);const s=new R(e.displayId);s.insertAfter=e.insertAfter,h.push(s),i.writeGraphic(o,r,t.level)}const n=t.tileInfoView.tileInfo.isWrappable,d=o.serialize(n);if(1!==d.length)return new M;const p=d[0].message;return M.fromVertexData(p,h)}_abortProcessingGraphic(t){if(this._graphicIdToAbortController.has(t)){this._graphicIdToAbortController.get(t).abort()}}_getNullSymbol(t){const e=t.geometry;return y(e)?j:f(e)||w(e)?C:P}_flipUpdatingGraphics(){this._updatingGraphicsTimer&&clearTimeout(this._updatingGraphicsTimer),this._updatingGraphicsTimer=setTimeout((()=>{this._updatingGraphicsTimer=null,this.notifyChange("updating")}),160),this.notifyChange("updating")}};t([n({constructOnly:!0})],$.prototype,"requestUpdateCallback",void 0),t([n()],$.prototype,"container",void 0),t([n({constructOnly:!0})],$.prototype,"graphics",void 0),t([n()],$.prototype,"updating",null),t([n()],$.prototype,"view",void 0),t([n()],$.prototype,"updateRequested",void 0),$=t([d("esri.views.2d.layers.support.GraphicsView2D")],$);const tt=$;export{tt as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.22/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import{EsriPromise as e}from"../../../../core/Promise.js";import{createResolver as r,
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import{EsriPromise as e}from"../../../../core/Promise.js";import{createResolver as r,ignoreAbortErrors as s,throwIfNotAbortError as o}from"../../../../core/promiseUtils.js";import{open as i}from"../../../../core/workers/workers.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";function c(t){return Array.isArray(t)}let l=class extends e{constructor(t){super(t),this._startupResolver=r(),this.isReady=!1}initialize(){this._controller=new AbortController,this.addResolvingPromise(this._startWorker(this._controller.signal))}destroy(){this._controller.abort(),this._connection&&this._connection.close()}set tileRenderer(t){this.client.tileRenderer=t}get closed(){return this._connection.closed}async startup(t,e,r,s){await this.when();const o=this._controller.signal,i=c(r.source)?{transferList:r.source,signal:o}:void 0,n={service:r,config:e,tileInfo:t.tileInfo.toJSON(),tiles:s};await this._connection.invoke("startup",n,i),this._startupResolver.resolve(),this._set("isReady",!0)}async updateTiles(t){return await this._startupResolver.promise,s(this._connection.invoke("updateTiles",t))}async update(t){const e={config:t};return await this._startupResolver.promise,this._connection.invoke("update",e)}async applyUpdate(t){return await this._startupResolver.promise,this._connection.invoke("applyUpdate",t)}async setHighlight(t){return await this._startupResolver.promise,s(this._connection.invoke("controller.setHighlight",t))}async refresh(){return await this._startupResolver.promise,s(this._connection.invoke("controller.refresh"))}async querySummaryStatistics(t,e,r){return await this._startupResolver.promise,this._connection.invoke("controller.querySummaryStatistics",{query:t.toJSON(),params:e},r)}async queryUniqueValues(t,e,r){return await this._startupResolver.promise,this._connection.invoke("controller.queryUniqueValues",{query:t.toJSON(),params:e},r)}async queryClassBreaks(t,e,r){return await this._startupResolver.promise,this._connection.invoke("controller.queryClassBreaks",{query:t.toJSON(),params:e},r)}async queryFeatures(t,e){return await this._startupResolver.promise,this._connection.invoke("controller.queryFeatures",t.toJSON(),e)}async queryObjectIds(t,e){return await this._startupResolver.promise,this._connection.invoke("controller.queryObjectIds",t.toJSON(),e)}async queryFeatureCount(t,e){return await this._startupResolver.promise,this._connection.invoke("controller.queryFeatureCount",t.toJSON(),e)}async queryExtent(t,e){return this._connection.invoke("controller.queryExtent",t.toJSON(),e)}async queryLatestObservations(t,e){return await this._startupResolver.promise,this._connection.invoke("controller.queryLatestObservations",t.toJSON(),e)}async queryStatistics(t){return await this._startupResolver.promise,this._connection.invoke("controller.queryStatistics",t)}async getObjectId(t){return await this._startupResolver.promise,this._connection.invoke("controller.getObjectId",t)}async getDisplayId(t){return await this._startupResolver.promise,this._connection.invoke("controller.getDisplayId",t)}async getFeature(t){return await this._startupResolver.promise,this._connection.invoke("controller.getFeature",t)}async getAggregate(t){return await this._startupResolver.promise,this._connection.invoke("controller.getAggregate",t)}async getAggregates(){return await this._startupResolver.promise,this._connection.invoke("controller.getAggregates")}async getAggregateValueRanges(){return await this._startupResolver.promise,this._connection.invoke("controller.getAggregateValueRanges")}async mapValidDisplayIds(t){return await this._startupResolver.promise,this._connection.invoke("controller.mapValidDisplayIds",t)}async onEdits(t){return await this._startupResolver.promise,s(this._connection.invoke("controller.onEdits",t))}async enableEvent(t,e){return await this._startupResolver.promise,s(this._connection.invoke("controller.enableEvent",{name:t,value:e}))}async _startWorker(t){try{this._connection=await i("Pipeline",{client:this.client,strategy:"dedicated",signal:t})}catch(e){o(e)}}};t([n()],l.prototype,"isReady",void 0),t([n()],l.prototype,"client",void 0),t([n()],l.prototype,"tileRenderer",null),l=t([a("esri.views.2d.layers.support.FeatureLayerProxy")],l);const u=l;export{u as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.22/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../core/Handles.js";import{releaseMaybe as t,disposeMaybe as i,destroyMaybe as s,isSome as a,isNone as r,unwrapOr as h}from"../../../core/maybe.js";import{on as
|
|
5
|
+
import e from"../../../core/Handles.js";import{releaseMaybe as t,disposeMaybe as i,destroyMaybe as s,isSome as a,isNone as r,unwrapOr as h}from"../../../core/maybe.js";import{on as o}from"../../../core/watchUtils.js";import{b as n}from"../../../chunks/mat4.js";import{c as _}from"../../../chunks/mat4f64.js";import{s as d}from"../../../chunks/vec2.js";import{a as m}from"../../../chunks/vec2f64.js";import{s as u,l as c,g as l}from"../../../chunks/vec3.js";import{c as p}from"../../../chunks/vec3f64.js";import{c as f,f as v}from"../../../chunks/vec4f64.js";import{earth as g}from"../../../geometry/support/Ellipsoid.js";import{rayLeighScaleHeight as b,atmosphereHeight as T,betaRayleigh as w,betaOzone as R,betaMie as j,innerAtmosphereDepth as x,computeInnerAltitudeFade as H}from"./atmosphereUtils.js";import{ChapmanAtmosphereTechniqueConfiguration as q,ChapmanAtmosphereTechnique as E}from"./ChapmanAtmosphereTechnique.js";import{Pos2Tex as y}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{createQuadVAO as U}from"../webgl-engine/lib/glUtil3D.js";class B{constructor(e){this._view=e,this.canRender=!0,this._skyslot=12,this._hazeSlot=13,this._cameraPosition=p(),this._projectionInverse=_(),this._viewInverse=_(),this._heightParameters=f(),this._betasRayleigh=p(),this._betasCombined=p(),this._scaleHeight=0,this._radii=m(),this._nearFar=m(),this._cameraHeight=0,this._cameraHeightSq=0,this._cAtmosphere=0,this._innerFadeDistance=0,this._altitudeFade=0,this._lowerElevationBoundRadius=0,this._lowerBoundEarthRadius=g.radius,this._updateRadius(g.radius)}destroy(){this._atmosphereTechnique=t(this._atmosphereTechnique),this._atmosphereHazeTechnique=t(this._atmosphereHazeTechnique),this._vao=i(this._vao),this._handles=s(this._handles)}when(){return Promise.resolve()}initializeRenderContext(t){const i=t.renderContext.rctx;this._handles=new e,a(this._view.basemapTerrain.rootTiles)&&this._updateElevation({spatialReference:this._view.basemapTerrain.spatialReference,tile:this._view.basemapTerrain.rootTiles[0],extent:this._view.basemapTerrain.rootTiles[0].extent,context:"ground"}),this._handles.add(o(this._view,"basemapTerrain","elevation-change",(e=>this._updateElevation(e)),(()=>this._updateElevation()))),this._handles.add(o(this._view,"basemapTerrain","elevation-bounds-change",(()=>this._updateVisibleElevationBounds())));const s=new q;s.haze=!1,this._atmosphereTechnique=t.shaderTechniqueRep.acquire(E,s),s.haze=!0,this._atmosphereHazeTechnique=t.shaderTechniqueRep.acquire(E,s),this._vao=U(i,y),this._scaleHeight=b*T,u(this._betasRayleigh,w[0],w[1],w[2]),u(this._betasCombined,w[0]+R[0],w[1]+R[1],w[2]+R[2])}uninitializeRenderContext(){this.destroy()}render(e){if(e.slot!==this._hazeSlot&&e.slot!==this._skyslot||0!==e.pass)return!1;this._update(e.camera);const t=e.rctx,i=e.offscreenRenderingHelper,s=e.slot===this._skyslot?this._atmosphereTechnique:this._atmosphereHazeTechnique,a=e.slot===this._skyslot?i.depthTexture:i.linearDepthTexture;return t.useProgram(s.program),s.bindPipelineState(t),i.renderDepthDetached((()=>{s.program.bindTexture(a,"depthTex"),this._renderCommon(s.program,e)})),!0}_renderCommon(e,t){if(r(this._vao))return!1;const i=t.rctx;return t.scenelightingData.setLightDirectionUniform(e),e.setUniform4fv("heightParameters",this._heightParameters),e.setUniform3fv("cameraPosition",this._cameraPosition),e.setUniformMatrix4fv("projectionInverse",this._projectionInverse),e.setUniformMatrix4fv("viewInverse",this._viewInverse),e.setUniform2fv("nearFar",this._nearFar),e.setUniform2fv("radii",this._radii),e.setUniform1f("scaleHeight",this._scaleHeight),e.setUniform1f("betaMie",j),e.setUniform3fv("betaRayleigh",this._betasRayleigh),e.setUniform3fv("betaCombined",this._betasCombined),e.setUniform1f("innerFadeDistance",this._innerFadeDistance),e.setUniform1f("altitudeFade",this._altitudeFade),i.bindVAO(this._vao),e.assertCompatibleVertexAttributeLocations(this._vao),i.drawArrays(5,0,4),!0}_adjustRadiusForTesselation(e){return e*Math.cos(Math.PI/16/16)}_updateElevation(e){const t=e?e.tile:h(this._view.basemapTerrain.rootTiles,[null])[0];if(r(t)||0!==t.lij[0])return;const i=this._adjustRadiusForTesselation(g.radius+t.elevationBounds[0]);i!==this._lowerElevationBoundRadius&&(this._lowerElevationBoundRadius=i,this._lowerBoundEarthRadius=-1,this._updateVisibleElevationBounds())}_updateVisibleElevationBounds(){const e=this._adjustRadiusForTesselation(g.radius+this._view.basemapTerrain.elevationBounds.min);(this._lowerBoundEarthRadius<0||e<this._lowerBoundEarthRadius)&&this._updateRadius(e)}_updateRadius(e){this._lowerBoundEarthRadius=e,d(this._radii,e,e+T),this._innerFadeDistance=2*Math.sqrt((2*e-x)*x)}_update(e){if(r(e))return;this._cameraHeight=c(e.eye),this._cameraHeightSq=this._cameraHeight*this._cameraHeight,this._cAtmosphere=this._cameraHeightSq-this._radii[1]*this._radii[1];const t=Math.min(1,Math.max(0,(this._cameraHeight-this._radii[0])/T));this._heightParameters=v(this._cameraHeight,this._cameraHeightSq,this._cAtmosphere,t),l(this._cameraPosition,e.eye),n(this._projectionInverse,e.projectionMatrix),n(this._viewInverse,e.viewMatrix),d(this._nearFar,e.near,e.far),this._altitudeFade=H(this._cameraHeight-this._lowerBoundEarthRadius)}static isSupported(e){return e.renderContext.rctx.capabilities.depthTexture}}export{B as ChapmanAtmosphere};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.22/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import{C as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import{C as r}from"../../../chunks/ChapmanAtmosphere.glsl.js";import{ReloadableShaderModule as i}from"../webgl-engine/core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as o}from"../webgl-engine/core/shaderTechnique/ShaderTechnique.js";import{parameter as t,ShaderTechniqueConfiguration as n}from"../webgl-engine/core/shaderTechnique/ShaderTechniqueConfiguration.js";import{Default3D as s}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{Program as a}from"../webgl-engine/lib/Program.js";import{makePipelineState as h,separateBlendingParams as l,defaultColorWriteParams as m}from"../../webgl/renderState.js";class c extends o{initializeProgram(e){const r=c.shader.get(),i=this.configuration,o=r.build({haze:i.haze});return new a(e.rctx,o,s)}initializePipeline(){return this.configuration.haze?h({blending:l(1,0,769,1),colorWrite:m}):h({blending:l(770,1,771,771),depthTest:{func:515},colorWrite:m})}}c.shader=new i(r,(()=>import("./ChapmanAtmosphere.glsl.js")));class g extends n{constructor(){super(...arguments),this.haze=!1}}e([t()],g.prototype,"haze",void 0);export{c as ChapmanAtmosphereTechnique,g as ChapmanAtmosphereTechniqueConfiguration};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.22/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{releaseMaybe as e,disposeMaybe as t,destroyMaybe as i,isNone as s}from"../../../core/maybe.js";import{f as r}from"../../../chunks/mat3.js";import{c as h}from"../../../chunks/mat3f64.js";import{n as o}from"../../../chunks/mat4.js";import{c as a}from"../../../chunks/mat4f64.js";import{z as n,f as u}from"../../../chunks/vec3f32.js";import{getReferenceEllipsoid as c}from"../../../geometry/projectionEllipsoid.js";import{CloudsTechnique as d}from"./CloudsTechnique.js";import{NoiseTextureAtlas as m}from"./NoiseTextureAtlas.js";import{createQuadVAO as _}from"../webgl-engine/lib/glUtil3D.js";import l from"../../webgl/FramebufferObject.js";class f{constructor(e,t){this.rctx=e,this._cubeMapSize=2048,this._viewMat3=h(),this._eye=n(),this._didRenderFaces=!1,this.viewDirections=[u(1,0,0),u(-1,0,0),u(0,1,0),u(0,-1,0),u(0,0,1)],this.upDirections=[u(0,1,0),u(0,1,0),u(0,0,-1),u(0,0,1),u(0,1,0)],this._cloudRadius=0,this._viewMatrix=a(),this.coverage=.4,this.density=.5,this.cloudSize=.5,this.detailSize=.5,this.smoothness=.7,this.absorption=0,this.cloudHeight=1,this._noiseTextureAtlas=new m(e,t),this._noiseTextureAtlas.render(128,e);const
|
|
5
|
+
import{releaseMaybe as e,disposeMaybe as t,destroyMaybe as i,isNone as s}from"../../../core/maybe.js";import{f as r}from"../../../chunks/mat3.js";import{c as h}from"../../../chunks/mat3f64.js";import{n as o}from"../../../chunks/mat4.js";import{c as a}from"../../../chunks/mat4f64.js";import{z as n,f as u}from"../../../chunks/vec3f32.js";import{getReferenceEllipsoid as c}from"../../../geometry/projectionEllipsoid.js";import{CloudsTechnique as d}from"./CloudsTechnique.js";import{NoiseTextureAtlas as m}from"./NoiseTextureAtlas.js";import{createQuadVAO as _}from"../webgl-engine/lib/glUtil3D.js";import l from"../../webgl/FramebufferObject.js";class f{constructor(e,t,i){this.rctx=e,this.requestRender=i,this._cubeMapSize=2048,this._viewMat3=h(),this._eye=n(),this._didRenderFaces=!1,this.viewDirections=[u(1,0,0),u(-1,0,0),u(0,1,0),u(0,-1,0),u(0,0,1)],this.upDirections=[u(0,1,0),u(0,1,0),u(0,0,-1),u(0,0,1),u(0,1,0)],this._cloudRadius=0,this._viewMatrix=a(),this.coverage=.4,this.density=.5,this.cloudSize=.5,this.detailSize=.5,this.smoothness=.7,this.absorption=0,this.cloudHeight=1,this._noiseTextureAtlas=new m(e,t),this._noiseTextureAtlas.render(128,e);const s={target:34067,pixelFormat:6408,dataType:5121,wrapMode:33071,samplingMode:9729,hasMipmap:!1,width:this._cubeMapSize,height:this._cubeMapSize};this._frameBufferCube=new l(e,{colorTarget:2,width:this._cubeMapSize,height:this._cubeMapSize},s),this._vao=_(e),this._technique=new d({rctx:e,viewingMode:t.state.viewingMode},null);const r=c(t.spatialReference);this._cloudRadius=.5*r.radius,this.resetRenderFlags()}set coverage(e){this._coverage=e,this.resetRenderFlags()}get coverage(){return this._coverage}set density(e){this._density=this.remap(e,0,1,0,.3),this.resetRenderFlags()}get density(){return this._density}set cloudSize(e){this._cloudSize=this.remap(Math.max(.01,1-e),0,1,0,.02),this.resetRenderFlags()}get cloudSize(){return this._cloudSize}set detailSize(e){this._detailSize=this.remap(Math.max(.01,1-e),0,1,0,.2),this.resetRenderFlags()}get detailSize(){return this._detailSize}set smoothness(e){this._smoothness=this.remap(1-e,0,1,0,.5),this.resetRenderFlags()}get smoothness(){return this._smoothness}set absorption(e){this._sigmaE=1+e,this._power=this.remap(e,0,1,35,70),this.resetRenderFlags()}get absorption(){return this._power}set cloudHeight(e){this._cloudHeight=this.remap(e,0,1,0,1500),this.resetRenderFlags()}get cloudHeight(){return this._cloudHeight}destroy(){this._technique=e(this._technique),this._frameBufferCube=t(this._frameBufferCube),this._vao=t(this._vao),this._noiseTextureAtlas=i(this._noiseTextureAtlas)}resetRenderFlags(){this._didRenderFaces=!1}remap(e,t,i,s,r){return s+(e-t)*(r-s)/(i-t)}get running(){return!this._didRenderFaces}runTask(e){if(e.done)return;if(s(this._vao)||this._didRenderFaces)return;const t=this.rctx.getViewport();this.rctx.setViewport(0,0,this._cubeMapSize,this._cubeMapSize),this.rctx.bindFramebuffer(this._frameBufferCube,!1,34069);const i=this._technique.program;this.rctx.useProgram(i),i.bindTexture(this._noiseTextureAtlas.textureAtlas,"cloudShapeTexture"),i.setUniform1f("cloudRadius",this._cloudRadius),i.setUniform1f("halfCubeMapSize",.5*this._cubeMapSize),i.setUniform1f("power",this._power),i.setUniform1f("sigmaE",this._sigmaE),i.setUniform1f("density",this._density),i.setUniform1f("cloudSize",this._cloudSize),i.setUniform1f("detailSize",this._detailSize),i.setUniform1f("smoothness",this._smoothness),i.setUniform1f("cloudHeight",this._cloudHeight),i.setUniform1f("coverage",this._coverage),this.rctx.bindVAO(this._vao),i.assertCompatibleVertexAttributeLocations(this._vao),this._technique.bindPipelineState(this.rctx);for(let s=0;s<5;s++){const e=this.viewDirections[s],t=this.upDirections[s];o(this._viewMatrix,this._eye,e,t),r(this._viewMat3,this._viewMatrix),i.setUniformMatrix3fv("viewMatrix",this._viewMat3);const h=34069+s;this._frameBufferCube.framebufferTexture2D(this._frameBufferCube.colorAttachment.glName,this.rctx.gl,36064,h),this.rctx.gl.drawArrays(this.rctx.gl.TRIANGLE_STRIP,0,4),this.rctx.gl.flush()}this._didRenderFaces=!0,this.rctx.setViewport(t.x,t.y,t.width,t.height),e.madeProgress(),this.requestRender()}get test(){return{power:this._power,density:this._density,cloudHeight:this._cloudHeight,cloudSize:this._cloudSize,detailSize:this._detailSize,smoothness:this._smoothness}}}export{f as CloudsGenerator};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.22/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import s from"../../../core/has.js";import i from"../../../core/Handles.js";import{equalsShallow as r}from"../../../core/lang.js";import{isSome as o,destroyMaybe as n,applySome as a,isNone as h}from"../../../core/maybe.js";import{react as p,syncAndInitial as l}from"../../../core/reactiveUtils.js";import{when as d}from"../../../core/watchUtils.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{getReferenceEllipsoid as _}from"../../../geometry/projectionEllipsoid.js";import{isEarth as c,isMoon as v,isMars as g}from"../../../geometry/support/spatialReferenceUtils.js";import{enableNewAtmosphere as w}from"../../../support/featureFlags.js";import{ChapmanAtmosphere as y}from"./ChapmanAtmosphere.js";import{CloudsComposition as f}from"./CloudsComposition.js";import{CloudsGenerator as C}from"./CloudsGenerator.js";import{PanoramicAtmosphere as A}from"./PanoramicAtmosphere.js";import{RealisticAtmosphere as R}from"./RealisticAtmosphere.js";import b from"./SimpleAtmosphere.js";import{Stars as x}from"./Stars.js";import{TaskPriority as j}from"../../support/Scheduler.js";const T=[12,13];let
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import s from"../../../core/has.js";import i from"../../../core/Handles.js";import{equalsShallow as r}from"../../../core/lang.js";import{isSome as o,destroyMaybe as n,applySome as a,isNone as h}from"../../../core/maybe.js";import{react as p,syncAndInitial as l}from"../../../core/reactiveUtils.js";import{when as d}from"../../../core/watchUtils.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{getReferenceEllipsoid as _}from"../../../geometry/projectionEllipsoid.js";import{isEarth as c,isMoon as v,isMars as g}from"../../../geometry/support/spatialReferenceUtils.js";import{enableNewAtmosphere as w}from"../../../support/featureFlags.js";import{ChapmanAtmosphere as y}from"./ChapmanAtmosphere.js";import{CloudsComposition as f}from"./CloudsComposition.js";import{CloudsGenerator as C}from"./CloudsGenerator.js";import{PanoramicAtmosphere as A}from"./PanoramicAtmosphere.js";import{RealisticAtmosphere as R}from"./RealisticAtmosphere.js";import b from"./SimpleAtmosphere.js";import{Stars as x}from"./Stars.js";import{TaskPriority as j}from"../../support/Scheduler.js";const T=[12,13];let N=class extends t{constructor(){super(...arguments),this._handles=new i,this._context=null,this._enableNewAtmosphere=w(),this._pendingAtmosphere=null,this._atmosphere=null,this._stars=null,this._clouds=null,this._cloudComposition=null}get canRender(){return!(!this.view.basemapTerrain||!this.view.basemapTerrain.renderer.canRender)||"global"!==this.view.viewingMode}get updating(){return o(this._pendingAtmosphere)||o(this._stars)&&this._stars.updating}get cloudsEnabled(){var e,t,i;const r=null!==(null==(e=this.view)||null==(t=e.environment)?void 0:t.clouds),o=s("enable-feature:enable-clouds");return(r||o)&&c(null==(i=this.view)?void 0:i.spatialReference)}renderCubeMap(){o(this._clouds)&&o(this._context)&&(this._clouds.resetRenderFlags(),this._context.requestRender())}initialize(){this.view._stage.addRenderPlugin(T,this)}destroy(){this._pendingAtmosphere=n(this._pendingAtmosphere),this._atmosphere=n(this._atmosphere),this._stars=n(this._stars),this._handles=n(this._handles),this._clouds=n(this._clouds),this._cloudComposition=n(this._cloudComposition),this.view&&null!=this.view._stage&&(this.view._stage.removeRenderPlugin(this),this._set("view",null))}initializeRenderContext(e=null){this._context=e,this._handles.add([d(this.view,"basemapTerrain",(()=>this._updateBasemapTerrain()),!0),p((()=>({viewingMode:this.view.viewingMode,atmosphereEnabled:this.view.environment.atmosphereEnabled,atmosphereQuality:this.view.environment.atmosphere.quality})),(()=>this._updateAtmosphere()),l),p((()=>this._starsUpdateParameters),(e=>this._updateStars(e)),{sync:!0,initial:!0,equals:r}),p((()=>this._cloudsCreationParameters),(e=>this._createOrDestroyClouds(e)),{sync:!0,initial:!0,equals:r}),p((()=>({clouds:this._clouds,parameters:this._cloudsUpdateParameters})),(e=>this._updateClouds(e)),l)])}uninitializeRenderContext(){o(this._stars)&&(this._stars.destroy(),this._stars=null),o(this._atmosphere)&&(this._atmosphere.uninitializeRenderContext(),this._atmosphere.destroy(),this._atmosphere=null),this._clouds=n(this._clouds),this._cloudComposition=n(this._cloudComposition)}render(e){let t=!0;return o(this._stars)&&this._stars.canRender&&12===e.slot&&0===e.pass&&(t=this._stars.render(e.rctx,e.camera)&&t),o(this._atmosphere)&&this._atmosphere.canRender&&(t=this._atmosphere.render(e)&&t),o(this._clouds)&&!this._clouds.running&&o(this._cloudComposition)&&12===e.slot&&0===e.pass&&(t=this._cloudComposition.render(e,this._clouds._frameBufferCube)&&t,this._cloudComposition.isFading()&&this._setNeedsRender()),t}get _cloudsCreationParameters(){return this.cloudsEnabled?{view:this.view,viewingMode:this.view.state.viewingMode,rctx:o(this._context)?this._context.renderContext.rctx:null,radius:_(this.view.spatialReference).radius}:null}_createOrDestroyClouds(e){this._clouds=n(this._clouds),this._cloudComposition=n(this._cloudComposition),a(e,(({view:e,viewingMode:t,rctx:s,radius:i})=>{this._clouds=new C(s,e,(()=>this._setNeedsRender()));const r=this.view.resourceController.scheduler;this._handles.add(r.registerTask(j.CLOUDS_GENERATOR,this._clouds)),this._cloudComposition=new f(s,t,i)})),this._setNeedsRender()}get _cloudsUpdateParameters(){var e,t;const s=null==(e=this.view)||null==(t=e.environment)?void 0:t.clouds;return s?{absorption:s.absorption,cloudHeight:s.cloudHeight,cloudSize:s.cloudSize,coverage:s.coverage,density:s.density,detailSize:s.detailSize,smoothness:s.smoothness}:null}_updateClouds({clouds:e,parameters:t}){if(!h(e)&&!h(t))for(const s in t){const i=s;e[i]=t[i]}}_setNeedsRender(){o(this._context)&&this._context.requestRender()}get _starsUpdateParameters(){var e,t,s;return{view:this.view,starsEnabled:null!=(e=null==(t=this.view)||null==(s=t.environment)?void 0:s.starsEnabled)&&e}}_updateStars({view:e,starsEnabled:t}){t&&h(this._stars)?(this._stars=new x({view:e,requestRender:()=>this._setNeedsRender()}),this._setNeedsRender()):!t&&o(this._stars)&&(this._stars.destroy(),this._stars=null,this._setNeedsRender())}_updateAtmosphere(){const e=this._getAtmosphereType();if(this.atmosphereType===e)return;this.atmosphereType=e,o(this._pendingAtmosphere)&&(this._pendingAtmosphere!==this._atmosphere&&this._pendingAtmosphere.destroy(),this._pendingAtmosphere=null);const t=this._getAtmosphereClass();if(!t)return o(this._atmosphere)&&(this._atmosphere.destroy(),this._atmosphere=null,this._setNeedsRender()),void this._updateBasemapTerrain();const s=new t(this.view);o(this._context)&&s.initializeRenderContext(this._context),h(this._atmosphere)&&(this._atmosphere=s,this._setNeedsRender()),this._pendingAtmosphere=s,s.when().then((()=>{o(this._atmosphere)&&this._pendingAtmosphere!==this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=this._pendingAtmosphere),this._pendingAtmosphere=null,this._setNeedsRender(),this._updateBasemapTerrain()})).catch((()=>{this._pendingAtmosphere===s&&(this._pendingAtmosphere=null)}))}_getAtmosphereClass(){const e=this._getAtmosphereType();if(this.atmosphereClassFromType)return this.atmosphereClassFromType(e);switch(e){case"none":return null;case"chapman":return y;case"realistic":return R;case"panoramic":return A;case"simple":return b;default:return}}_getAtmosphereType(){const e=this.view.get("environment.atmosphereEnabled"),t=this.view.get("environment.atmosphere.quality"),s=this.view.viewingMode;return!e||null==t||v(this.view.spatialReference)?"none":"local"===s?"panoramic":"high"===t&&this._enableNewAtmosphere&&o(this._context)&&y.isSupported(this._context)&&!g(this.view.spatialReference)?"chapman":"high"===t&&o(this._context)&&R.isSupported(this._context)&&!g(this.view.spatialReference)?"realistic":"simple"}_updateBasemapTerrain(){this.view.basemapTerrain&&(this.view.basemapTerrain.velvetOverground=o(this._atmosphere)&&"simple"===this.atmosphereType)}get test(){return{atmosphere:this._atmosphere,clouds:this._clouds,enableNewAtmosphere:e=>{this._enableNewAtmosphere=e},updateAtmosphere:()=>{this._updateAtmosphere()}}}};e([m({constructOnly:!0})],N.prototype,"view",void 0),e([m({constructOnly:!0})],N.prototype,"atmosphereClassFromType",void 0),e([m({type:Boolean,readOnly:!0})],N.prototype,"updating",null),e([m()],N.prototype,"_pendingAtmosphere",void 0),e([m()],N.prototype,"_stars",void 0),e([m()],N.prototype,"_clouds",void 0),e([m()],N.prototype,"_cloudComposition",void 0),e([m()],N.prototype,"cloudsEnabled",null),e([m()],N.prototype,"_cloudsCreationParameters",null),e([m()],N.prototype,"_cloudsUpdateParameters",null),e([m()],N.prototype,"_starsUpdateParameters",null),N=e([u("esri.views.3d.environment.EnvironmentRenderer")],N);export{N as EnvironmentRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.22/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../core/Logger.js";import{disposeMaybe as t,abortMaybe as r}from"../../../core/maybe.js";import{createResolver as o,
|
|
5
|
+
import e from"../../../core/Logger.js";import{disposeMaybe as t,abortMaybe as r}from"../../../core/maybe.js";import{createResolver as o,isAbortError as i}from"../../../core/promiseUtils.js";import{e as s}from"../../../chunks/mat4.js";import{c as n}from"../../../chunks/mat4f64.js";import{requestImage as a}from"../../../support/requestImageUtils.js";import{SimpleAtmosphereTechniqueConfiguration as m,SimpleAtmosphereTechnique as l}from"./SimpleAtmosphereTechnique.js";import h from"./resources/SimpleAtmosphereTexture.js";import{glLayout as c}from"../support/buffer/glUtil.js";import{newLayout as p}from"../support/buffer/InterleavedLayout.js";import{bindProjectionMatrix as u}from"../webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Default3D as f}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import g from"../webgl-engine/lib/GeometryUtil.js";import d from"../../webgl/BufferObject.js";import _ from"../../webgl/Texture.js";import{vertexCount as b}from"../../webgl/Util.js";import y from"../../webgl/VertexArrayObject.js";const x=e.getLogger("esri.views.3d.environment.PanoramicAtmosphere");class j{constructor(){this.slot=12,this._atmosphereTechniqueConfig=new m,this._readyResolver=o(),this._readyController=new AbortController}get canRender(){return null!=this._texture}destroy(){this._readyResolver.reject(),this._texture=t(this._texture),this._vao=t(this._vao),this._readyController=r(this._readyController)}when(){return this._readyResolver.promise}initializeRenderContext(e){this._atmosphereTechniqueConfig.geometry=1,this._atmosphereTechnique=e.shaderTechniqueRep.acquire(l,this._atmosphereTechniqueConfig);const t=e.renderContext.rctx;this._vao=this._createVertexArrayObject(t),this._vaoCount=b(this._vao,"geometry"),a(h,{signal:this._readyController.signal}).then((r=>{this._texture=new _(t,{pixelFormat:6408,dataType:5121,wrapMode:33071,samplingMode:9729,flipped:!0},r),e.requestRender(),this._readyController=null,this._readyResolver.resolve()})).catch((e=>{i(e)||x.error("Unable to initialize atmosphere: image request failed",e),this._readyResolver.reject()}))}uninitializeRenderContext(){this.destroy()}render(e){if(e.slot!==this.slot||0!==e.pass)return!1;const t=e.rctx,r=this._atmosphereTechnique.program;return t.useProgram(r),this._atmosphereTechnique.bindPipelineState(t),r.bindTexture(this._texture,"tex"),u(r,e.camera.projectionMatrix),v(w,e.camera.viewMatrix),r.setUniformMatrix4fv("view",w),r.setUniform4f("color",1,1,1,1),e.scenelightingData.setLightDirectionUniform(r),t.bindVAO(this._vao),r.assertCompatibleVertexAttributeLocations(this._vao),t.drawArrays(4,0,this._vaoCount),!0}_createVertexArrayObject(e){const t=g.createPolySphereGeometry(1,2,!1),r=t.indices.get("position");for(let n=0;n<r.length;n+=3){const e=r[n];r[n]=r[n+2],r[n+2]=e}const o=t.vertexAttributes.get("position").data,i=C.createBuffer(r.length),s=i.position;for(let n=0;n<r.length;++n){const e=3*r[n];s.set(n,0,o[e]),s.set(n,1,o[e+1]),s.set(n,2,o[e+2])}return new y(e,f,{geometry:c(C)},{geometry:d.createVertex(e,35044,i.buffer)})}}function v(e,t){s(e,t),e[12]=0,e[13]=0,e[14]=0,e[15]=1}const w=n(),C=p().vec3f("position");export{j as PanoramicAtmosphere};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.22/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../core/Logger.js";import{lerp as t,clamp as r}from"../../../core/mathUtils.js";import{removeMaybe as i,disposeMaybe as s,abortMaybe as o,isNone as a}from"../../../core/maybe.js";import{createResolver as n,
|
|
5
|
+
import e from"../../../core/Logger.js";import{lerp as t,clamp as r}from"../../../core/mathUtils.js";import{removeMaybe as i,disposeMaybe as s,abortMaybe as o,isNone as a}from"../../../core/maybe.js";import{createResolver as n,isAbortError as h}from"../../../core/promiseUtils.js";import{init as l}from"../../../core/watchUtils.js";import{l as m}from"../../../chunks/mat4.js";import{c}from"../../../chunks/mat4f64.js";import{s as d}from"../../../chunks/vec2.js";import{a as u}from"../../../chunks/vec2f64.js";import{l as p,a as f,b as _,i as g,c as x,p as C}from"../../../chunks/vec3.js";import{c as R}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as V}from"../../../geometry/projectionEllipsoid.js";import{isMars as j}from"../../../geometry/support/spatialReferenceUtils.js";import{requestImage as y}from"../../../support/requestImageUtils.js";import{computeInnerAltitudeFade as v,innerAtmosphereDepth as U}from"./atmosphereUtils.js";import{SimpleAtmosphereTechniqueConfiguration as b,SimpleAtmosphereTechnique as q}from"./SimpleAtmosphereTechnique.js";import w from"./resources/MarsAtmosphereTexture.js";import D from"./resources/SimpleAtmosphereTexture.js";import{makePiecewiseLinearFunction as A}from"../support/mathUtils.js";import{glLayout as T}from"../support/buffer/glUtil.js";import{newLayout as F}from"../support/buffer/InterleavedLayout.js";import{Default3D as M}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{createQuadVAO as S}from"../webgl-engine/lib/glUtil3D.js";import{project as W}from"../webgl-engine/lib/Util.js";import k from"../../webgl/BufferObject.js";import L from"../../webgl/Texture.js";import{vertexCount as O}from"../../webgl/Util.js";import P from"../../webgl/VertexArrayObject.js";const z=e.getLogger("esri.views.3d.environment.SimpleAtmosphere"),H=128,B=-U,I=0,E=50,G=()=>1-511/512,J=A([[50,.1015625],[500,.21875],[5e3,1-250/512],[5e4,.4140625]]);class K{constructor(e){this.view=e,this.slot=12,this._renderData={texV:u(),silCircleCenter:R(),silCircleV1:R(),silCircleV2:R(),altitudeFade:0,innerScale:0,undergroundFadeAlpha:0},this._fadeVaoCount=0,this._readyResolver=n(),this._readyController=new AbortController,this.texV1=1,this.isOnMars=j(e.spatialReference);const t=V(e.spatialReference);this.planetRadius=t.radius,this.outerRimWidth=t.outerAtmosphereRimWidth,this.innerRimFactor=(this.planetRadius+B)/this.planetRadius,this.middleRimFactor=(this.planetRadius+I)/this.planetRadius,this.outerRimFactor=(this.planetRadius+this.outerRimWidth)/this.planetRadius,this.texV0=I/this.outerRimWidth,this.texVScale=this.texV1-this.texV0}get canRender(){return null!=this._texture}destroy(){this._readyResolver.reject(),this._cameraChangeHandle=i(this._cameraChangeHandle),this._texture=s(this._texture),this._fadeVao=s(this._fadeVao),this._vao=s(this._vao),this._readyController=o(this._readyController)}when(){return this._readyResolver.promise}initializeRenderContext(e){this._shaderTechniqueRepository=e.shaderTechniqueRep;const t=e.renderContext.rctx;this._cameraChangeHandle=l(this.view,"state.camera",(()=>e.requestRender()),!0),this._vao=this._createRibbon(t),this._vaoCount=O(this._vao,"geometry"),this._fadeVao=S(t),this._fadeVaoCount=O(this._fadeVao,"geometry"),y(this.isOnMars?w:D,{signal:this._readyController.signal}).then((r=>{this._texture=new L(t,{pixelFormat:6408,dataType:5121,wrapMode:33071,samplingMode:9729,flipped:!0},r),e.requestRender(),this._readyController=null,this._readyResolver.resolve()})).catch((e=>{h(e)||z.error("Unable to initialize simple atmosphere: image request failed",e),this._readyResolver.reject()}))}uninitializeRenderContext(){this.destroy()}get atmosphereConeTechnique(){if(a(this._atmosphereConeTechnique)){const e=new b;e.geometry=0,this._atmosphereConeTechnique=this._shaderTechniqueRepository.acquire(q,e)}return this._atmosphereConeTechnique}get atmosphereUndergroundTechnique(){if(a(this._atmosphereUndergroundTechnique)){const e=new b;e.geometry=2,this._atmosphereUndergroundTechnique=this._shaderTechniqueRepository.acquire(q,e)}return this._atmosphereUndergroundTechnique}render(e){if(e.slot!==this.slot||0!==e.pass)return!1;this._update(e.camera);const t=e.rctx;if(this.atmosphereConeTechnique.bindPipelineState(t),this._renderData.undergroundFadeAlpha<1){const r=this.atmosphereConeTechnique.program;t.useProgram(r),r.setUniformMatrix4fv("proj",e.camera.projectionMatrix),r.setUniformMatrix4fv("view",e.camera.viewMatrix),r.setUniform3fv("silCircleCenter",this._renderData.silCircleCenter),r.setUniform3fv("silCircleV1",this._renderData.silCircleV1),r.setUniform3fv("silCircleV2",this._renderData.silCircleV2),r.setUniform2fv("texV",this._renderData.texV),r.bindTexture(this._texture,"tex"),e.scenelightingData.setLightDirectionUniform(r),r.setUniform1f("altitudeFade",this._renderData.altitudeFade),r.setUniform1f("innerScale",this._renderData.innerScale),t.bindVAO(this._vao),t.drawArrays(4,0,this._vaoCount)}if(this._renderData.undergroundFadeAlpha>0){const r=this.atmosphereUndergroundTechnique.program;t.useProgram(r),r.setUniform1f("undergroundFadeAlpha",this._renderData.undergroundFadeAlpha),e.scenelightingData.setLightDirectionUniform(r),r.setUniform3fv("cameraPosition",e.camera.eye),t.bindVAO(this._fadeVao),t.drawArrays(5,0,this._fadeVaoCount)}return!0}_update(e){const i=R(),s=this.planetRadius,o=p(e.eye),a=o-s;if(a<0){const e=Math.min(-a/5e3,1);this._renderData.undergroundFadeAlpha=e}else this._renderData.undergroundFadeAlpha=0;const n=Math.max(E,a),h=s+B;this._renderData.innerScale=Z(s+n,s,h)-1,this._renderData.altitudeFade=v(a),f(i,e.eye,(s+E)/o),N(i,e.center,e.up,s,this._renderData);const l=this._computeScreenRimWidth(e,i,e.up,this._renderData),m=G(),c=J(a);let u=this.texV0+m*this.texVScale,_=this.texV0+l*c*this.texVScale;if(a>E){N(e.eye,e.center,e.up,s,this._renderData);const i=this._computeScreenRimWidth(e,e.eye,e.up,this._renderData),o=r((i-1.5)/(l-1.5),0,1);u=this.texV0+o*m*this.texVScale,_=this.texV0+t(this.texV1,l*c,o)*this.texVScale}d(this._renderData.texV,u,_)}_createRibbon(e){const t=new Float32Array(3+3*H*3),r=new Uint32Array(3*H*5);t[0]=0,t[1]=0,t[2]=-1;for(let o=0;o<H;o++){const e=9*o+3;t[e+0]=o,t[e+1]=this.innerRimFactor,t[e+2]=-1,t[e+3]=o,t[e+4]=this.middleRimFactor,t[e+5]=0,t[e+6]=o,t[e+7]=this.outerRimFactor,t[e+8]=1;const i=3*o+1,s=o===H-1?1:i+3,a=15*o;r[a+0]=i,r[a+1]=i+1,r[a+2]=s+1,r[a+3]=s+1,r[a+4]=s,r[a+5]=i,r[a+6]=i+1,r[a+7]=i+2,r[a+8]=s+2,r[a+9]=s+2,r[a+10]=s+1,r[a+11]=i+1,r[a+12]=i,r[a+13]=s,r[a+14]=0}const i=$.createBuffer(r.length),s=i.position;for(let o=0;o<r.length;++o){const e=3*r[o];s.set(o,0,t[e]),s.set(o,1,t[e+1]),s.set(o,2,t[e+2])}return new P(e,M,{geometry:T($)},{geometry:k.createVertex(e,35044,i.buffer)})}_computeScreenRimWidth(e,t,r,i){return _(X,i.silCircleCenter,i.silCircleV2),f(Y,X,this.outerRimFactor),m(Q,t,X,r),W(X,Q,e.projectionMatrix,e.viewport),W(Y,Q,e.projectionMatrix,e.viewport),g(X,Y)/e.height}}function N(e,t,r,i,s){const o=p(e),a=i*Math.sqrt(o*o-i*i)/o,n=Math.sqrt(i*i-a*a),h=s.silCircleV1,l=s.silCircleV2;return f(s.silCircleCenter,e,n/o),x(h,e,t),C(h)<1&&x(h,e,r),f(h,h,a/p(h)),x(l,h,e),f(l,l,a/p(l)),a}const Q=c(),X=R(),Y=R();function Z(e,t,r){return e*e/(Math.sqrt(e*e-t*t)*Math.sqrt(e*e-r*r)+t*r)}const $=F().vec3f("position");export{K as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.22/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../core/Collection.js";import t from"../../../core/Logger.js";import{init as r}from"../../../core/watchUtils.js";import{g as n}from"../../../chunks/vec3.js";import s from"./RenderContext.js";const i=t.getLogger("esri.views.3d.externalRenderers.ExternalRendererStore");class d{constructor(){this._renderers=new e}add(e,t){this._findOrCreateStageRenderer(e).add(t)}remove(e,t){const r=this._findStageRenderer(e);r&&r.remove(t),0===r.renderers.length&&(r.destroy(),this._renderers.remove(r))}_findStageRenderer(e){return this._renderers.find((t=>t.view===e))}_findOrCreateStageRenderer(e){let t=this._findStageRenderer(e);return t||(t=new o(e),this._renderers.add(t)),t}}class o{constructor(t){this.view=t,this.canRender=!0,this.renderers=new e,this._readyWatchHandle=r(t,"ready",(e=>{e?(this.context=new s(this.view),this.view._stage.addRenderPlugin([3,5],this)):(this.renderers.forEach((e=>a(e,"dispose",this.context))),this.context=null)}))}destroy(){this.renderers.drain((e=>{this.context&&a(e,"dispose",this.context)})),this.view._stage&&this.view._stage.removeRenderPlugin(this),this._readyWatchHandle&&(this._readyWatchHandle.remove(),this._readyWatchHandle=null),this.context=null}add(e){-1===this.renderers.indexOf(e)?(this.renderers.add(e),this.context&&(this._webglStateReset(),a(e,"setup",this.context),this.view._stage.renderView.
|
|
5
|
+
import e from"../../../core/Collection.js";import t from"../../../core/Logger.js";import{init as r}from"../../../core/watchUtils.js";import{g as n}from"../../../chunks/vec3.js";import s from"./RenderContext.js";const i=t.getLogger("esri.views.3d.externalRenderers.ExternalRendererStore");class d{constructor(){this._renderers=new e}add(e,t){this._findOrCreateStageRenderer(e).add(t)}remove(e,t){const r=this._findStageRenderer(e);r&&r.remove(t),0===r.renderers.length&&(r.destroy(),this._renderers.remove(r))}_findStageRenderer(e){return this._renderers.find((t=>t.view===e))}_findOrCreateStageRenderer(e){let t=this._findStageRenderer(e);return t||(t=new o(e),this._renderers.add(t)),t}}class o{constructor(t){this.view=t,this.canRender=!0,this.renderers=new e,this._readyWatchHandle=r(t,"ready",(e=>{e?(this.context=new s(this.view),this.view._stage.addRenderPlugin([3,5],this)):(this.renderers.forEach((e=>a(e,"dispose",this.context))),this.context=null)}))}destroy(){this.renderers.drain((e=>{this.context&&a(e,"dispose",this.context)})),this.view._stage&&this.view._stage.removeRenderPlugin(this),this._readyWatchHandle&&(this._readyWatchHandle.remove(),this._readyWatchHandle=null),this.context=null}add(e){-1===this.renderers.indexOf(e)?(this.renderers.add(e),this.context&&(this._webglStateReset(),a(e,"setup",this.context),this.view._stage.renderView.requestRender())):i.warn("add(): Cannot add external renderer: renderer has already been added")}remove(e){const t=this.renderers.indexOf(e);-1!==t&&(this.renderers.removeAt(t),this.context&&(a(e,"dispose",this.context),this.view._stage.renderView.requestRender()))}initializeRenderContext(e){this.context.gl=e.renderContext.rctx.gl,this.context.rctx=e.renderContext.rctx,this.renderers.length>0&&this._webglStateReset(),this.renderers.forEach((e=>a(e,"setup",this.context)))}uninitializeRenderContext(){}render(e){return 0!==e.pass||(this._updateContext(e),this.renderers.length>0&&this._webglStateReset(),this.renderers.forEach((t=>{switch(e.slot){case 3:a(t,"render",this.context);break;case 5:a(t,"renderTransparent",this.context)}}))),!0}_updateContext(e){this.context.camera.copyFrom(e.camera),n(this.context.sunLight.direction,e.scenelightingData.old.direction),n(this.context.sunLight.diffuse.color,e.scenelightingData.old.diffuse.color),n(this.context.sunLight.ambient.color,e.scenelightingData.old.ambient.color),this.context._renderTargetHelper=e.offscreenRenderingHelper}_webglStateReset(){this.context.rctx.resetState(),this.context._renderTargetHelper&&this.context._renderTargetHelper.bindFramebuffer()}}function a(e,t,r){"function"==typeof e[t]&&e[t](r)}export{d as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.22/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../core/has.js";import{c as r}from"../../chunks/mat4f64.js";import{projectBuffer as n,computeTranslationToOriginAndRotation as t}from"../../geometry/projection.js";import o from"./externalRenderers/ExternalRendererStore.js";const i=new o;function s(e,r){i.add(e,r)}function d(e,r){i.remove(e,r)}function a(e){e._stage.renderView.
|
|
5
|
+
import e from"../../core/has.js";import{c as r}from"../../chunks/mat4f64.js";import{projectBuffer as n,computeTranslationToOriginAndRotation as t}from"../../geometry/projection.js";import o from"./externalRenderers/ExternalRendererStore.js";const i=new o;function s(e,r){i.add(e,r)}function d(e,r){i.remove(e,r)}function a(e){e._stage.renderView.requestRender()}function c(e,r,t,o,i,s,d){return o=o||e.spatialReference,n(r,o,t,i,e.renderCoordsHelper.spatialReference,s,d)?i:null}function f(e,r,t,o,i,s,d){return s=s||e.spatialReference,n(r,e.renderCoordsHelper.spatialReference,t,o,s,i,d)?o:null}function u(e,n,o,i){return i||(i=r()),o=o||e.spatialReference,t(o,n,i,e.renderCoordsHelper.spatialReference)?i:null}function l(e){return e.state.camera.clone()}function m(e){return{add:s.bind(this,e),remove:d.bind(this,e),requestRender:a.bind(this,e),toRenderCoordinates:c.bind(this,e),fromRenderCoordinates:f.bind(this,e),renderCoordinateTransformAt:u.bind(this,e)}}function p(r){e.add("esri-force-webgl",r)}export{s as add,m as bind,p as forceWebGLContext,f as fromRenderCoordinates,l as getRenderCamera,d as remove,u as renderCoordinateTransformAt,a as requestRender,c as toRenderCoordinates};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.22/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../geometry.js";import{neverReached as e}from"../../../core/compilerUtils.js";import t from"../../../core/Evented.js";import{deg2rad as i}from"../../../core/mathUtils.js";import{isSome as s,isNone as o,unwrapOr as r,unwrap as n}from"../../../core/maybe.js";import{createScreenPointArray as a,createRenderScreenPointArray3 as c,screenPointObjectToArray as l,castRenderScreenPointArray as h}from"../../../core/screenUtils.js";import{once as d}from"../../../core/accessorSupport/utils.js";import{f as u}from"../../../chunks/mat3.js";import{c as _}from"../../../chunks/mat3f64.js";import{e as g,s as m,m as f,i as p}from"../../../chunks/mat4.js";import{c as v}from"../../../chunks/mat4f64.js";import{j as b}from"../../../chunks/vec2.js";import{b as y,t as j,m as L,a as S,g as R,h as w,s as O,f as T}from"../../../chunks/vec3.js";import{c as E,Z as A}from"../../../chunks/vec3f64.js";import{canProjectWithoutEngine as D,projectPoint as F,sphericalPCPFtoLonLatElevation as z,computeENUToSphericalPCPFLocalRotation as k}from"../../../geometry/projection.js";import{getReferenceEllipsoid as P}from"../../../geometry/projectionEllipsoid.js";import{containsPointObject as I}from"../../../geometry/support/aaBoundingRect.js";import{create as M,distance2 as C,fromPoints as x,closestRayDistance2 as B}from"../../../geometry/support/lineSegment.js";import{create as W,fromPositionAndNormal as V,intersectRay as H}from"../../../geometry/support/plane.js";import{create as U}from"../../../geometry/support/ray.js";import{sv3d as G}from"../../../geometry/support/vectorStacks.js";import{clonePoint as Z}from"../../../layers/graphics/hydratedFeatures.js";import{getElevationAtPoint as q}from"../support/ElevationProvider.js";import{fromScreen as J}from"../support/geometryUtils/ray.js";import K from"../webgl-engine/lib/Camera.js";import{Object3D as N}from"../webgl-engine/lib/Object3D.js";import{WebGLLayer as Q}from"../webgl-engine/lib/WebGLLayer.js";import X from"../../../geometry/Point.js";class Y{constructor(e){this.idHint=0,this.camera=new K,this._elevation={offset:0,override:null},this.collisionType={type:"point"},this.collisionPriority=0,this._renderObjects=[],this.autoScaleRenderObjects=!0,this._available=!0,this._noDisplayCount=0,this._radius=10,this._worldSized=!1,this.focusMultiplier=2,this.touchMultiplier=2.5,this.worldOriented=!1,this._modelTransform=v(),this._worldFrame=null,this._renderLocation=E(),this._renderLocationDirty=!0,this._location=new X({x:0,y:0,z:0}),this._elevationAlignedLocation=new X,this._elevationAlignedLocationDirty=!0,this.interactive=!0,this.selectable=!1,this.grabbable=!0,this.cursor=null,this._grabbing=!1,this.dragging=!1,this._hovering=!1,this._selected=!1,this._state=0,this._focused=!1,this.events=new t.EventEmitter,this._screenLocation={screenPointArray:a(),renderScreenPointArray:c(),pixelSize:0},this._screenLocationDirty=!0,this._applyObjectTransform=null,this._engineResourcesAddedToStage=!1,this._engineResources=null,this._attached=!1,this._engineLayer=null,this._materialIdReferences=null,this._location.spatialReference=e.view.spatialReference;for(const t in e)this[t]=e[t];this.view.state&&this.view.state.camera&&this.camera.copyFrom(this.view.state.camera)}destroy(){this._removeResourcesFromStage(),this._engineResources=null,this.view=null,this.camera=null}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this._elevationAlignedLocationDirty=!0,this._renderLocationDirty=!0,this._updateEngineObject()}get renderObjects(){return this._renderObjects}set renderObjects(e){this._removeResourcesFromStage(),this._engineResources=null,this._renderObjects=e.slice(),this._updateEngineObject()}set available(e){e!==this._available&&(this._available=e,this._updateEngineObject())}get available(){return this._available}disableDisplay(){return this._noDisplayCount++,1===this._noDisplayCount&&this._updateEngineObject(),{remove:d((()=>{this._noDisplayCount--,0===this._noDisplayCount&&this._updateEngineObject()}))}}set radius(e){e!==this._radius&&(this._radius=e,this._updateEngineObject())}get radius(){return this._radius}set worldSized(e){e!==this._worldSized&&(this._worldSized=e,this._updateEngineObject())}get worldSized(){return this._worldSized}get modelTransform(){return this._modelTransform}set modelTransform(e){$(e)&&(this._screenLocationDirty=!0),g(this._modelTransform,e),this._updateEngineObject()}get renderLocation(){return this._renderLocationDirty&&(this._renderLocationDirty=!1,this.view.renderCoordsHelper.toRenderCoords(this.elevationAlignedLocation,this._renderLocation),this.worldOriented?(this._worldFrame||(this._worldFrame=v()),ee(this.view,this._renderLocation,this._worldFrame)):this._worldFrame&&(this._worldFrame=null)),this._renderLocation}set renderLocation(e){this.view.renderCoordsHelper.fromRenderCoords(e,this._location),this.elevationAlignedLocation=this._location}get location(){return this._location}set location(e){Z(e,this._location),this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!0,this._updateEngineObject(),this.events.emit("location-update",{location:this._location})}get elevationAlignedLocation(){return this._elevationAlignedLocationDirty?(this._evaluateElevationAlignment(),this._updateElevationAlignedLocation(),this._elevationAlignedLocation):this._elevationAlignedLocation}set elevationAlignedLocation(e){Z(e,this._location),this._evaluateElevationAlignment(),this._location.z-=this._elevation.offset,this._updateElevationAlignedLocation(),this._updateEngineObject(),this.events.emit("location-update",{location:this._location})}_updateElevationAlignedLocation(){this._elevationAlignedLocation.x=this.location.x,this._elevationAlignedLocation.y=this.location.y;const e=s(this._elevation.override)?this._elevation.override:this.location.z||0;this._elevationAlignedLocation.z=e+this._elevation.offset,this._elevationAlignedLocation.spatialReference=this.location.spatialReference,this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!1}grabbableForEvent(){return!0}get grabbing(){return this._grabbing}set grabbing(e){e!==this._grabbing&&(this._grabbing=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get hovering(){return this._hovering}set hovering(e){e!==this._hovering&&(this._hovering=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get selected(){return this._selected}set selected(e){e!==this._selected&&(this._selected=e,this._updateEngineObject(),this.events.emit("select-changed",{action:e?"select":"deselect"}))}get state(){return this._state}set state(e){e!==this._state&&(this._state=e,this._updateEngineObject())}updateStateEnabled(e,t){t?this.state|=e:this.state&=~e}_setFocused(e){e!==this._focused&&(this._focused=e,this.events.emit("focus-changed",{action:!0===e?"focus":"unfocus"}))}get focused(){return this._focused}get screenLocation(){return this.ensureScreenLocation(),this._screenLocation}ensureScreenLocation(){if(!this._screenLocationDirty)return;this._screenLocation.pixelSize=this.camera.computeScreenPixelSizeAt(this.renderLocation),this._screenLocationDirty=!1;let e;if($(this._modelTransform)){const t=this._calculateModelTransformOffset(_e);e=y(t,t,this.renderLocation)}else e=this.renderLocation;this.camera.projectToRenderScreen(e,this._screenLocation.renderScreenPointArray),this.camera.renderToScreen(this._screenLocation.renderScreenPointArray,this._screenLocation.screenPointArray)}get applyObjectTransform(){return this._applyObjectTransform}set applyObjectTransform(e){this._applyObjectTransform=e,this._screenLocationDirty=!0,this._updateEngineObject()}intersectionDistance(t,i){if(!this.available)return null;const s=l(t,te),r=this._getCollisionRadius(i),n=-1*this.collisionPriority;switch(this.collisionType.type){case"point":if(b(this.screenLocation.screenPointArray,s)<r*r)return this.screenLocation.renderScreenPointArray[2]+n;break;case"line":{const e=this.collisionType.paths,t=this._getWorldToScreenObjectScale(),i=this._calculateObjectTransform(t,ne),a=r*this.screenLocation.pixelSize,c=J(this.camera,s,se);if(o(c))return null;for(const s of e){if(0===s.length)continue;const e=L(ce,s[0],i);for(let t=1;t<s.length;t++){const o=L(le,s[t],i),r=B(x(e,o,ie),c);if(null!=r&&r<a*a){const t=y(G.get(),e,o);S(t,t,.5);const i=h(G.get());return this.camera.projectToRenderScreen(t,i),i[2]+n}R(e,o)}}break}case"disc":{var a;const e=this.collisionType.direction,t=null!=(a=this.collisionType.offset)?a:A,i=this._getWorldToScreenObjectScale(),c=this._calculateObjectTransform(i,ne),l=r*this.screenLocation.pixelSize,h=J(this.camera,s,se);if(o(h))return null;const d=u(oe,c),_=j(de,e,d),g=L(ue,t,c);V(g,_,ae);const m=he;if(H(ae,h,m)&&w(m,g)<l*l)return this.screenLocation.renderScreenPointArray[2]+n;break}case"ribbon":{const{paths:e,direction:t}=this.collisionType,i=this._getWorldToScreenObjectScale(),a=this._calculateObjectTransform(i,ne),c=r*this.camera.computeScreenPixelSizeAt(this.renderLocation),l=J(this.camera,s,se);if(o(l))return null;const d=u(oe,a),_=j(de,t,d),g=this._calculateModelTransformPosition(ue);V(g,_,ae);const m=he;if(!H(ae,l,m))break;for(const s of e){if(0===s.length)continue;const e=L(ce,s[0],a);for(let t=1;t<s.length;t++){const i=L(le,s[t],a),o=C(x(e,i,ie),m);if(null!=o&&o<c*c){const t=y(G.get(),e,i);S(t,t,.5);const s=h(G.get());return this.camera.projectToRenderScreen(t,s),s[2]+n}R(e,i)}}break}default:e(this.collisionType)}return null}attach(e={manipulator3D:{}}){var t;if(!this.view._stage)return;const i=e.manipulator3D;if(o(i.engineLayerId)){const e=new Q({isPickable:!1,updatePolicy:1});this.view._stage.add(e),i.engineLayerId=e.id,this._engineLayer=e}else null!=(t=this.view._stage)&&t.getObject&&(this._engineLayer=this.view._stage.getObject(i.engineLayerId));i.engineLayerReferences=(i.engineLayerReferences||0)+1,this._materialIdReferences=i.materialIdReferences,o(this._materialIdReferences)&&(this._materialIdReferences=new Map,i.materialIdReferences=this._materialIdReferences),this.camera.copyFrom(this.view.state.camera),this._attached=!0,this._updateEngineObject(),D(this._location.spatialReference,this.view.spatialReference)||(this.location=new X({x:0,y:0,z:0,spatialReference:this.view.spatialReference}))}detach(e={manipulator3D:{}}){const t=e.manipulator3D;t.engineLayerReferences--;const i=0===t.engineLayerReferences;i&&(t.engineLayerId=null),this._removeResourcesFromStage(i),this._engineResources=null,this._engineLayer=null,this._materialIdReferences=null,this._attached=!1}onViewChange(){this.camera.copyFrom(this.view.state.camera),this._screenLocationDirty=!0,this._updateEngineObject()}onElevationChange(e){F(this.location,ge,e.spatialReference),I(e.extent,ge)&&(this.location=this._location)}_evaluateElevationAlignment(e=this.location){if(o(this.elevationInfo))return!1;let t=null,i=0;const s=r(this.elevationInfo.offset,0);switch(this.elevationInfo.mode){case"on-the-ground":t=r(q(this.view.elevationProvider,e,"ground"),0);break;case"relative-to-ground":i=r(q(this.view.elevationProvider,e,"ground"),0)+s;break;case"relative-to-scene":i=r(q(this.view.elevationProvider,e,"scene"),0)+s;break;case"absolute-height":i=s}return(i!==this._elevation.offset||t!==this._elevation.override)&&(this._elevation.offset=i,this._elevation.override=t,!0)}_updateEngineObject(){if(!this._attached)return;if(!this.available)return void this._removeResourcesFromStage();const e=this._getWorldToScreenObjectScale(),t=ne;if(!0===this.autoScaleRenderObjects){const i=this._getFocusedSize(this._radius,this.focused)*e;this._calculateObjectTransform(i,t)}else this._calculateObjectTransform(e,t);const{objectsByState:i}=this._ensureEngineResources(),s=(this.focused?2:1)|(this.selected?8:4),o=this._noDisplayCount>0;for(const{stateMask:r,objects:n}of i){if(o){for(const e of n)e.setVisible(!1);continue}const e=!(0!=(15&r))||(s&r)==(15&r),i=!(0!=(65520&r))||(this.state&r)==(65520&r);if(e&&i)for(const s of n)s.setVisible(!0),s.transformation=t;else for(const t of n)t.setVisible(!1)}}_ensureEngineResources(){if(o(this._engineResources)){const e=n(this._engineLayer),t=[],i=new Set;this.renderObjects.forEach((({material:e})=>{i.has(e)||(t.push(e),i.add(e))}));const s=(e,t)=>{const{geometry:i,material:s,transform:o}=t;Array.isArray(i)?i.forEach((t=>e.addGeometry(t,s,o))):e.addGeometry(i,s,o)},o=new Map;this._renderObjects.forEach((e=>{const t=new N({castShadow:!1});s(t,e);const i=e.stateMask||0,r=o.get(i)||[];r.push(t),o.set(i,r)}));const r=[];o.forEach(((e,t)=>r.push({stateMask:t,objects:e}))),this._engineResources={objectsByState:r,layer:e,materials:t}}return this._addResourcesToStage(),this._engineResources}_addResourcesToStage(){if(this._engineResourcesAddedToStage||o(this._engineResources))return;const{objectsByState:e,layer:t,materials:i}=this._engineResources;i.forEach((e=>{const t=n(this._materialIdReferences),i=t.get(e.id)||0;0===i&&this.view._stage.add(e),t.set(e.id,i+1)})),e.forEach((({objects:e})=>{t.addMany(e),this.view._stage.addMany(e)})),this._engineResourcesAddedToStage=!0}_removeResourcesFromStage(e=!1){if(!this._engineResourcesAddedToStage||o(this._engineResources))return;const{objectsByState:t,layer:i,materials:s}=this._engineResources;t.forEach((({objects:e})=>{i.removeMany(e),this.view._stage.removeMany(e)})),s.forEach((e=>{const t=n(this._materialIdReferences),i=t.get(e.id);1===i?(this.view._stage.remove(e),t.delete(e.id)):t.set(e.id,i-1)})),e&&this.view._stage.remove(i),this._engineResourcesAddedToStage=!1}_getCollisionRadius(e){return this._getFocusedSize(this.radius,!0)*("touch"===e?this.touchMultiplier:1)}_getFocusedSize(e,t){return e*(t?this.focusMultiplier:1)}_getWorldToScreenObjectScale(){return this._worldSized?1:this.screenLocation.pixelSize}_calculateModelTransformPosition(e){const t=this._getWorldToScreenObjectScale(),i=this._calculateObjectTransform(t,re);return O(e,i[12],i[13],i[14])}_calculateModelTransformOffset(e){const t=this._calculateModelTransformPosition(e);return T(e,t,this.renderLocation)}_calculateObjectTransform(e,t){return m(t,e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1),this._worldFrame&&f(t,t,this._worldFrame),f(t,t,this._modelTransform),t[12]+=this.renderLocation[0],t[13]+=this.renderLocation[1],t[14]+=this.renderLocation[2],t[15]=1,s(this._applyObjectTransform)&&this._applyObjectTransform(t),t}get test(){let e=!1;if(s(this._engineResources))for(const t in this._engineResources.objectsByState){const i=this._engineResources.objectsByState[t];for(const t of i.objects)if(t.isVisible){e=!0;break}if(e)break}return{areAnyResourcesVisible:e}}}function $(e){return 0!==e[12]||0!==e[13]||0!==e[14]}function ee(e,t,s){switch(e.viewingMode){case"local":return p(s),!0;case"global":{const o=P(e.renderCoordsHelper.spatialReference);return z(t,0,ce,0,o.radius),k(i(ce[0]),i(ce[1]),s),!0}}}const te=a(),ie=M(),se=U(),oe=_(),re=v(),ne=v(),ae=W(),ce=E(),le=E(),he=E(),de=E(),ue=E(),_e=E(),ge=new X({x:0,y:0,z:0,spatialReference:null});export{Y as Manipulator3D};
|
|
5
|
+
import"../../../geometry.js";import{neverReached as e}from"../../../core/compilerUtils.js";import t from"../../../core/Evented.js";import{deg2rad as i}from"../../../core/mathUtils.js";import{isSome as s,isNone as o,unwrapOr as r,unwrap as n}from"../../../core/maybe.js";import{createScreenPointArray as a,createRenderScreenPointArray3 as c,screenPointObjectToArray as l,castRenderScreenPointArray as h}from"../../../core/screenUtils.js";import{once as d}from"../../../core/accessorSupport/utils.js";import{f as u}from"../../../chunks/mat3.js";import{c as _}from"../../../chunks/mat3f64.js";import{e as g,s as m,m as f,i as p}from"../../../chunks/mat4.js";import{c as v}from"../../../chunks/mat4f64.js";import{j as b}from"../../../chunks/vec2.js";import{b as y,t as j,m as L,a as S,g as R,h as w,s as O,f as T}from"../../../chunks/vec3.js";import{c as E,Z as A}from"../../../chunks/vec3f64.js";import{canProjectWithoutEngine as D,projectPoint as F,sphericalPCPFtoLonLatElevation as z,computeENUToSphericalPCPFLocalRotation as k}from"../../../geometry/projection.js";import{getReferenceEllipsoid as P}from"../../../geometry/projectionEllipsoid.js";import{containsPointObject as I}from"../../../geometry/support/aaBoundingRect.js";import{create as M,distance2 as C,fromPoints as x,closestRayDistance2 as B}from"../../../geometry/support/lineSegment.js";import{create as W,fromPositionAndNormal as V,intersectRay as U}from"../../../geometry/support/plane.js";import{create as G}from"../../../geometry/support/ray.js";import{sv3d as H}from"../../../geometry/support/vectorStacks.js";import{clonePoint as Z}from"../../../layers/graphics/hydratedFeatures.js";import{getElevationAtPoint as q}from"../support/ElevationProvider.js";import{fromScreen as J}from"../support/geometryUtils/ray.js";import K from"../webgl-engine/lib/Camera.js";import{Object3D as N}from"../webgl-engine/lib/Object3D.js";import{WebGLLayer as Q}from"../webgl-engine/lib/WebGLLayer.js";import X from"../../../geometry/Point.js";class Y{constructor(e){this.camera=new K,this._elevation={offset:0,override:null},this.collisionType={type:"point"},this.collisionPriority=0,this._renderObjects=[],this.autoScaleRenderObjects=!0,this._available=!0,this._noDisplayCount=0,this._radius=10,this._worldSized=!1,this.focusMultiplier=2,this.touchMultiplier=2.5,this.worldOriented=!1,this._modelTransform=v(),this._worldFrame=null,this._renderLocation=E(),this._renderLocationDirty=!0,this._location=new X({x:0,y:0,z:0}),this._elevationAlignedLocation=new X,this._elevationAlignedLocationDirty=!0,this.interactive=!0,this.selectable=!1,this.grabbable=!0,this.cursor=null,this._grabbing=!1,this.dragging=!1,this._hovering=!1,this._selected=!1,this._state=0,this._focused=!1,this.events=new t.EventEmitter,this._screenLocation={screenPointArray:a(),renderScreenPointArray:c(),pixelSize:0},this._screenLocationDirty=!0,this._applyObjectTransform=null,this._engineResourcesAddedToStage=!1,this._engineResources=null,this._attached=!1,this._engineLayer=null,this._materialIdReferences=null,this._location.spatialReference=e.view.spatialReference;for(const t in e)this[t]=e[t];this.view.state&&this.view.state.camera&&this.camera.copyFrom(this.view.state.camera)}destroy(){this._removeResourcesFromStage(),this._engineResources=null,this.view=null,this.camera=null}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this._elevationAlignedLocationDirty=!0,this._renderLocationDirty=!0,this._updateEngineObject()}get renderObjects(){return this._renderObjects}set renderObjects(e){this._removeResourcesFromStage(),this._engineResources=null,this._renderObjects=e.slice(),this._updateEngineObject()}set available(e){e!==this._available&&(this._available=e,this._updateEngineObject())}get available(){return this._available}disableDisplay(){return this._noDisplayCount++,1===this._noDisplayCount&&this._updateEngineObject(),{remove:d((()=>{this._noDisplayCount--,0===this._noDisplayCount&&this._updateEngineObject()}))}}set radius(e){e!==this._radius&&(this._radius=e,this._updateEngineObject())}get radius(){return this._radius}set worldSized(e){e!==this._worldSized&&(this._worldSized=e,this._updateEngineObject())}get worldSized(){return this._worldSized}get modelTransform(){return this._modelTransform}set modelTransform(e){$(e)&&(this._screenLocationDirty=!0),g(this._modelTransform,e),this._updateEngineObject()}get renderLocation(){return this._renderLocationDirty&&(this._renderLocationDirty=!1,this.view.renderCoordsHelper.toRenderCoords(this.elevationAlignedLocation,this._renderLocation),this.worldOriented?(this._worldFrame||(this._worldFrame=v()),ee(this.view,this._renderLocation,this._worldFrame)):this._worldFrame&&(this._worldFrame=null)),this._renderLocation}set renderLocation(e){this.view.renderCoordsHelper.fromRenderCoords(e,this._location),this.elevationAlignedLocation=this._location}get location(){return this._location}set location(e){Z(e,this._location),this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!0,this._updateEngineObject(),this.events.emit("location-update",{location:this._location})}get elevationAlignedLocation(){return this._elevationAlignedLocationDirty?(this._evaluateElevationAlignment(),this._updateElevationAlignedLocation(),this._elevationAlignedLocation):this._elevationAlignedLocation}set elevationAlignedLocation(e){Z(e,this._location),this._evaluateElevationAlignment(),this._location.z-=this._elevation.offset,this._updateElevationAlignedLocation(),this._updateEngineObject(),this.events.emit("location-update",{location:this._location})}_updateElevationAlignedLocation(){this._elevationAlignedLocation.x=this.location.x,this._elevationAlignedLocation.y=this.location.y;const e=s(this._elevation.override)?this._elevation.override:this.location.z||0;this._elevationAlignedLocation.z=e+this._elevation.offset,this._elevationAlignedLocation.spatialReference=this.location.spatialReference,this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!1}grabbableForEvent(){return!0}get grabbing(){return this._grabbing}set grabbing(e){e!==this._grabbing&&(this._grabbing=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get hovering(){return this._hovering}set hovering(e){e!==this._hovering&&(this._hovering=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get selected(){return this._selected}set selected(e){e!==this._selected&&(this._selected=e,this._updateEngineObject(),this.events.emit("select-changed",{action:e?"select":"deselect"}))}get state(){return this._state}set state(e){e!==this._state&&(this._state=e,this._updateEngineObject())}updateStateEnabled(e,t){t?this.state|=e:this.state&=~e}_setFocused(e){e!==this._focused&&(this._focused=e,this.events.emit("focus-changed",{action:!0===e?"focus":"unfocus"}))}get focused(){return this._focused}get screenLocation(){return this.ensureScreenLocation(),this._screenLocation}ensureScreenLocation(){if(!this._screenLocationDirty)return;this._screenLocation.pixelSize=this.camera.computeScreenPixelSizeAt(this.renderLocation),this._screenLocationDirty=!1;let e;if($(this._modelTransform)){const t=this._calculateModelTransformOffset(_e);e=y(t,t,this.renderLocation)}else e=this.renderLocation;this.camera.projectToRenderScreen(e,this._screenLocation.renderScreenPointArray),this.camera.renderToScreen(this._screenLocation.renderScreenPointArray,this._screenLocation.screenPointArray)}get applyObjectTransform(){return this._applyObjectTransform}set applyObjectTransform(e){this._applyObjectTransform=e,this._screenLocationDirty=!0,this._updateEngineObject()}intersectionDistance(t,i){if(!this.available)return null;const s=l(t,te),r=this._getCollisionRadius(i),n=-1*this.collisionPriority;switch(this.collisionType.type){case"point":if(b(this.screenLocation.screenPointArray,s)<r*r)return this.screenLocation.renderScreenPointArray[2]+n;break;case"line":{const e=this.collisionType.paths,t=this._getWorldToScreenObjectScale(),i=this._calculateObjectTransform(t,ne),a=r*this.screenLocation.pixelSize,c=J(this.camera,s,se);if(o(c))return null;for(const s of e){if(0===s.length)continue;const e=L(ce,s[0],i);for(let t=1;t<s.length;t++){const o=L(le,s[t],i),r=B(x(e,o,ie),c);if(null!=r&&r<a*a){const t=y(H.get(),e,o);S(t,t,.5);const i=h(H.get());return this.camera.projectToRenderScreen(t,i),i[2]+n}R(e,o)}}break}case"disc":{var a;const e=this.collisionType.direction,t=null!=(a=this.collisionType.offset)?a:A,i=this._getWorldToScreenObjectScale(),c=this._calculateObjectTransform(i,ne),l=r*this.screenLocation.pixelSize,h=J(this.camera,s,se);if(o(h))return null;const d=u(oe,c),_=j(de,e,d),g=L(ue,t,c);V(g,_,ae);const m=he;if(U(ae,h,m)&&w(m,g)<l*l)return this.screenLocation.renderScreenPointArray[2]+n;break}case"ribbon":{const{paths:e,direction:t}=this.collisionType,i=this._getWorldToScreenObjectScale(),a=this._calculateObjectTransform(i,ne),c=r*this.camera.computeScreenPixelSizeAt(this.renderLocation),l=J(this.camera,s,se);if(o(l))return null;const d=u(oe,a),_=j(de,t,d),g=this._calculateModelTransformPosition(ue);V(g,_,ae);const m=he;if(!U(ae,l,m))break;for(const s of e){if(0===s.length)continue;const e=L(ce,s[0],a);for(let t=1;t<s.length;t++){const i=L(le,s[t],a),o=C(x(e,i,ie),m);if(null!=o&&o<c*c){const t=y(H.get(),e,i);S(t,t,.5);const s=h(H.get());return this.camera.projectToRenderScreen(t,s),s[2]+n}R(e,i)}}break}default:e(this.collisionType)}return null}attach(e={manipulator3D:{}}){var t;if(!this.view._stage)return;const i=e.manipulator3D;if(o(i.engineLayerId)){const e=new Q({isPickable:!1,updatePolicy:1});this.view._stage.add(e),i.engineLayerId=e.id,this._engineLayer=e}else null!=(t=this.view._stage)&&t.getObject&&(this._engineLayer=this.view._stage.getObject(i.engineLayerId));i.engineLayerReferences=(i.engineLayerReferences||0)+1,this._materialIdReferences=i.materialIdReferences,o(this._materialIdReferences)&&(this._materialIdReferences=new Map,i.materialIdReferences=this._materialIdReferences),this.camera.copyFrom(this.view.state.camera),this._attached=!0,this._updateEngineObject(),D(this._location.spatialReference,this.view.spatialReference)||(this.location=new X({x:0,y:0,z:0,spatialReference:this.view.spatialReference}))}detach(e={manipulator3D:{}}){const t=e.manipulator3D;t.engineLayerReferences--;const i=0===t.engineLayerReferences;i&&(t.engineLayerId=null),this._removeResourcesFromStage(i),this._engineResources=null,this._engineLayer=null,this._materialIdReferences=null,this._attached=!1}onViewChange(){this.camera.copyFrom(this.view.state.camera),this._screenLocationDirty=!0,this._updateEngineObject()}onElevationChange(e){F(this.location,ge,e.spatialReference),I(e.extent,ge)&&(this.location=this._location)}_evaluateElevationAlignment(e=this.location){if(o(this.elevationInfo))return!1;let t=null,i=0;const s=r(this.elevationInfo.offset,0);switch(this.elevationInfo.mode){case"on-the-ground":t=r(q(this.view.elevationProvider,e,"ground"),0);break;case"relative-to-ground":i=r(q(this.view.elevationProvider,e,"ground"),0)+s;break;case"relative-to-scene":i=r(q(this.view.elevationProvider,e,"scene"),0)+s;break;case"absolute-height":i=s}return(i!==this._elevation.offset||t!==this._elevation.override)&&(this._elevation.offset=i,this._elevation.override=t,!0)}_updateEngineObject(){if(!this._attached)return;if(!this.available)return void this._removeResourcesFromStage();const e=this._getWorldToScreenObjectScale(),t=ne;if(!0===this.autoScaleRenderObjects){const i=this._getFocusedSize(this._radius,this.focused)*e;this._calculateObjectTransform(i,t)}else this._calculateObjectTransform(e,t);const{objectsByState:i}=this._ensureEngineResources(),s=(this.focused?2:1)|(this.selected?8:4),o=this._noDisplayCount>0;for(const{stateMask:r,objects:n}of i){if(o){for(const e of n)e.setVisible(!1);continue}const e=!(0!=(15&r))||(s&r)==(15&r),i=!(0!=(65520&r))||(this.state&r)==(65520&r);if(e&&i)for(const s of n)s.setVisible(!0),s.transformation=t;else for(const t of n)t.setVisible(!1)}}_ensureEngineResources(){if(o(this._engineResources)){const e=n(this._engineLayer),t=[],i=new Set;this.renderObjects.forEach((({material:e})=>{i.has(e)||(t.push(e),i.add(e))}));const s=(e,t)=>{const{geometry:i,material:s,transform:o}=t;Array.isArray(i)?i.forEach((t=>e.addGeometry(t,s,o))):e.addGeometry(i,s,o)},o=new Map;this._renderObjects.forEach((e=>{const t=new N({castShadow:!1});s(t,e);const i=e.stateMask||0,r=o.get(i)||[];r.push(t),o.set(i,r)}));const r=[];o.forEach(((e,t)=>r.push({stateMask:t,objects:e}))),this._engineResources={objectsByState:r,layer:e,materials:t}}return this._addResourcesToStage(),this._engineResources}_addResourcesToStage(){if(this._engineResourcesAddedToStage||o(this._engineResources))return;const{objectsByState:e,layer:t,materials:i}=this._engineResources;i.forEach((e=>{const t=n(this._materialIdReferences),i=t.get(e.id)||0;0===i&&this.view._stage.add(e),t.set(e.id,i+1)})),e.forEach((({objects:e})=>{t.addMany(e),this.view._stage.addMany(e)})),this._engineResourcesAddedToStage=!0}_removeResourcesFromStage(e=!1){if(!this._engineResourcesAddedToStage||o(this._engineResources))return;const{objectsByState:t,layer:i,materials:s}=this._engineResources;t.forEach((({objects:e})=>{i.removeMany(e),this.view._stage.removeMany(e)})),s.forEach((e=>{const t=n(this._materialIdReferences),i=t.get(e.id);1===i?(this.view._stage.remove(e),t.delete(e.id)):t.set(e.id,i-1)})),e&&this.view._stage.remove(i),this._engineResourcesAddedToStage=!1}_getCollisionRadius(e){return this._getFocusedSize(this.radius,!0)*("touch"===e?this.touchMultiplier:1)}_getFocusedSize(e,t){return e*(t?this.focusMultiplier:1)}_getWorldToScreenObjectScale(){return this._worldSized?1:this.screenLocation.pixelSize}_calculateModelTransformPosition(e){const t=this._getWorldToScreenObjectScale(),i=this._calculateObjectTransform(t,re);return O(e,i[12],i[13],i[14])}_calculateModelTransformOffset(e){const t=this._calculateModelTransformPosition(e);return T(e,t,this.renderLocation)}_calculateObjectTransform(e,t){return m(t,e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1),this._worldFrame&&f(t,t,this._worldFrame),f(t,t,this._modelTransform),t[12]+=this.renderLocation[0],t[13]+=this.renderLocation[1],t[14]+=this.renderLocation[2],t[15]=1,s(this._applyObjectTransform)&&this._applyObjectTransform(t),t}get test(){let e=!1;if(s(this._engineResources))for(const t in this._engineResources.objectsByState){const i=this._engineResources.objectsByState[t];for(const t of i.objects)if(t.isVisible){e=!0;break}if(e)break}return{areAnyResourcesVisible:e}}}function $(e){return 0!==e[12]||0!==e[13]||0!==e[14]}function ee(e,t,s){switch(e.viewingMode){case"local":return p(s),!0;case"global":{const o=P(e.renderCoordsHelper.spatialReference);return z(t,0,ce,0,o.radius),k(i(ce[0]),i(ce[1]),s),!0}}}const te=a(),ie=M(),se=G(),oe=_(),re=v(),ne=v(),ae=W(),ce=E(),le=E(),he=E(),de=E(),ue=E(),_e=E(),ge=new X({x:0,y:0,z:0,spatialReference:null});export{Y as Manipulator3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.22/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/clock.js";import i from"../../../../../core/Handles.js";import{isNone as a,destroyMaybe as s,isSome as n,removeMaybe as r}from"../../../../../core/maybe.js";import{addFrameTask as l}from"../../../../../core/scheduling.js";import{createScreenPoint as o,screenPointObjectToArray as h,createScreenPointArray as p}from"../../../../../core/screenUtils.js";import{property as u}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as d}from"../../../../../core/accessorSupport/decorators/subclass.js";import{i as c,d as _,v,m as y}from"../../../../../chunks/mat4.js";import{d as w,l as P,g,a as m,b as f,m as M,n as V,s as b}from"../../../../../chunks/vec3.js";import{a as D,c as T}from"../../../../../chunks/vec3f64.js";import{a as k,c as E,n as S,f as x}from"../../../../../chunks/boundedPlane.js";import{signedDistance as H,create as j,intersectRay as C,normal as R}from"../../../../../geometry/support/plane.js";import{create as z}from"../../../../../geometry/support/ray.js";import{sv3d as O,sm4d as G,sv2d as I}from"../../../../../geometry/support/vectorStacks.js";import{calculateInputRotationTransform as U}from"../../manipulatorUtils.js";import{PLANE_PREVIEW_OUTLINE_WIDTH as K,forceVerticalModifier as B,forceHorizontalModifier as A,PREVIEW_FADE_DURATION_SECONDS as L,POINTER_MOVE_TIMER_MS as F,PLANE_OUTLINE_COLOR as q,PLANE_BACKGROUND_COLOR as N,PREVIEW_FADE_DOT_THRESHOLD as J,INITIAL_DEPTH_OFFSET_FRAC as Q}from"./sliceToolConfig.js";import{createShiftManipulator as W,createRotateManipulator as X,createResizeManipulator as Y,createGridVisualElement as Z,createOutlineVisualElement as $,planeToShape as tt,createRotatePlane as et,resizePlane as it,calculatePlaneHalfSize as at,createPlane as st,DidPointerMoveRecentlyFlag as nt,calculateBoundedPlaneTranslateRotate as rt,updateShiftRestartHandle as lt,updateRotateHeadingHandle as ot,updateRotateTiltHandle as ht,updateResizeHandle as pt,createShiftPlane as ut}from"./sliceToolUtils.js";import dt from"./images/heading-rotate-png.js";import ct from"./images/tilt-rotate-png.js";import{screenToRenderPlane as _t}from"../../editingTools/dragEventPipeline3D.js";import{fromScreen as vt}from"../../../support/geometryUtils/ray.js";import{Intersector as yt}from"../../../webgl-engine/lib/Intersector.js";import{Texture as wt}from"../../../webgl-engine/lib/Texture.js";import{createManipulatorDragEventPipeline as Pt}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as gt}from"../../../../interactive/InteractiveToolBase.js";import{createScreenPointFromEvent as mt}from"../../../../support/screenUtils.js";import ft from"../../../../../widgets/Slice/SlicePlane.js";let Mt=class extends gt{constructor(t){super(t),this.clock=e,this._previewPlaneOpacity=1,this.analysisView=null,this.layersMode="none",this.tiltEnabled=!1,this.shiftManipulator=null,this.rotateHeadingManipulator=null,this.rotateTiltManipulator=null,this.resizeManipulators=null,this.disableEngineLayers=!1,this._handles=new i,this._viewHandles=new i,this._frameTask=null,this._prevPointerMoveTimeout=null,this._previewPlaneGridVisualElement=null,this._previewPlaneOutlineVisualElement=null,this._startPlane=k(),this._previewPlane=null,this._activeKeyModifiers={},this._lastCursorPosition=o(),this._resizeHandles=[{direction:[1,0]},{direction:[1,1]},{direction:[0,1]},{direction:[-1,1]},{direction:[-1,0]},{direction:[-1,-1]},{direction:[0,-1]},{direction:[1,-1]}],this._intersector=new yt(t.view.state.viewingMode),this._intersector.options.store=0}onAttach(){this.created&&this.visible&&this._updateManipulators()}initialize(){this._initialize()}async _initialize(){const t=()=>{if("creating"===this.toolState||"created"===this.toolState)throw new Error("Unexpected toolState");return!this.destroyed};if(!t())return;if(this.analysisView=await this.view.whenAnalysisView(this.analysis),!t())return;if(null==this.analysis)throw new Error("SliceTool requires valid model, but null was provided.");if(a(this.analysisView.analysisViewData))throw new Error("expected internal object to be defined.");this.analysisViewData=this.analysisView.analysisViewData,this.rotateHeadingTexture=new wt(dt,{width:64,height:64,mipmap:!0,preMultiplyAlpha:!0}),this.rotateTiltTexture=new wt(ct,{width:64,height:64,mipmap:!0,preMultiplyAlpha:!0}),this.view._stage&&(this.view._stage.add(this.rotateHeadingTexture),this.view._stage.add(this.rotateTiltTexture));const e=this.watch("state",(t=>{switch(t){case"ready":case"slicing":this.finishToolCreation();break;case"sliced":this.complete()}}),!0);"sliced"===this.state?this.complete():this.startToolCreation(),this._handles.add([e,this.view.state.watch("camera",(()=>this._onCameraChange()))]);const i=t=>{this.updateManipulatorsInteractive(t),t.grabbing||(n(this.analysisViewData.plane)&&E(this.analysisViewData.plane,this._startPlane),this.inputState=null)};this.shiftManipulator=W(this.view),this.manipulators.add(this.shiftManipulator),this.shiftManipulator.events.on("grab-changed",(t=>{this._onShiftGrab(t),i(this.shiftManipulator)})),this._handles.add(this._createShiftDragPipeline(this.shiftManipulator)),this.rotateHeadingManipulator=X(this.view,this.rotateHeadingTexture),this.manipulators.add(this.rotateHeadingManipulator),this.rotateHeadingManipulator.events.on("grab-changed",(t=>{this._onRotateHeadingGrab(t),i(this.rotateHeadingManipulator)})),this._handles.add(this._createRotateHeadingDragPipeline(this.rotateHeadingManipulator)),this.rotateTiltManipulator=X(this.view,this.rotateTiltTexture),this.manipulators.add(this.rotateTiltManipulator),this.rotateTiltManipulator.events.on("grab-changed",(t=>{this._onRotateTiltGrab(t),i(this.rotateTiltManipulator)})),this._handles.add(this._createRotateTiltDragPipeline(this.rotateTiltManipulator)),this.resizeManipulators=this._resizeHandles.map(((t,e)=>{const a=Y(this.view,t);return a.events.on("grab-changed",(t=>{this._onResizeGrab(t,e),i(a)})),this._handles.add(this._createResizeDragPipeline(a)),a})),this.manipulators.addMany(this.resizeManipulators),this._previewPlaneGridVisualElement=Z(this.view),this._previewPlaneOutlineVisualElement=$(this.view),this._previewPlaneOutlineVisualElement.width=K,this._handles.add(this.analysisViewData.watch("plane",(()=>this._updateManipulators()),!0)),this._updateManipulators(),this._updateVisibility(this.visible)}destroy(){if("pending"===this.toolState)return this._handles=s(this._handles),void(this._viewHandles=s(this._viewHandles));this.view._stage&&(this.view._stage.remove(this.rotateHeadingTexture),this.view._stage.remove(this.rotateTiltTexture)),this.attached&&this.detach(),this._handles=s(this._handles),this._viewHandles=s(this._viewHandles),this._removeFrameTask(),this._clearPointerMoveTimeout(),this._previewPlaneOutlineVisualElement=s(this._previewPlaneOutlineVisualElement),this._previewPlaneGridVisualElement=s(this._previewPlaneGridVisualElement)}get state(){const t=!!this.analysisViewData.plane,e=!!this.inputState;return t?t&&e?"slicing":t&&!e?"sliced":"ready":"ready"}get cursor(){return this._get("cursor")}set analysis(t){if(null==t)throw new Error("SliceTool requires valid model, but null was provided.");this._handles.remove("analysis"),this._set("analysis",t)}get inputState(){return this._get("inputState")}set inputState(t){this._set("inputState",t),this.analysisView.showGrid=n(t)&&"resize"===t.type,this._updateMaterials()}get _isPlacingSlicePlane(){return!this.inputState&&!this.analysisViewData.plane&&this.active}get _creatingPointerId(){return n(this.inputState)&&"shift"===this.inputState.type?this.inputState.creatingPointerId:null}enterExcludeLayerMode(){a(this.analysisViewData.plane)||(this._set("layersMode","exclude"),this.active||(this.view.activeTool=this))}exitExcludeLayerMode(){a(this.analysisViewData.plane)||(this._set("layersMode","none"),this.active&&(this.view.activeTool=null))}onDeactivate(){this._updateMouseCursor(),this._set("layersMode","none"),this._updatePreviewPlane(null)}onDetach(){this.created&&this._set("layersMode","none")}onShow(){this._updateVisibility(!0)}onHide(){this._updateVisibility(!1)}_updateVisibility(t){this.analysis.visible=t,this.created&&(this._updateMouseCursor(),this._updateManipulators(),t||this._clearPointerMoveTimeout())}onInputEvent(t){switch(t.type){case"pointer-drag":if(!bt(t))return;this._isPlacingSlicePlane?this._onClickPlacePlane(t)&&(t.stopPropagation(),this._updateMouseCursor()):this._onPointerDrag(t)&&t.stopPropagation();break;case"pointer-move":this._onPointerMove(t),this._updateMouseCursor();break;case"pointer-up":this._onPointerUp(t)&&t.stopPropagation();break;case"immediate-click":if(!bt(t))return;this._onClickPlacePlane(t)&&(t.stopPropagation(),this._updateMouseCursor());break;case"click":if(!bt(t))return;this._onClickExcludeLayer(t)&&t.stopPropagation();break;case"drag":this.inputState&&t.stopPropagation();break;case"key-down":this._onKeyDown(t)&&t.stopPropagation();break;case"key-up":this._onKeyUp(t)&&t.stopPropagation()}}onEditableChange(){this.analysisView&&(this.analysisView.editable=this.editable)}_onPointerDrag(t){const e=this.inputState;if(t.pointerId===this._creatingPointerId&&n(e)&&"shift"===e.type){const i=mt(t);return this.shiftManipulator.events.emit("drag",{action:e.hasBeenDragged?"update":"start",pointerType:t.pointerType,start:i,screenPoint:i}),e.hasBeenDragged=!0,!0}return!1}_onPointerMove(t){this._lastCursorPosition.x=t.x,this._lastCursorPosition.y=t.y,this._resetPointerMoveTimeout(),"touch"!==t.pointerType&&this._updatePreviewPlane(mt(t),this._activeKeyModifiers)}_onCameraChange(){this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),this._updateManipulators()}_onPointerUp(t){if(t.pointerId===this._creatingPointerId&&n(this.analysisViewData.plane)){const e=mt(t);return this.shiftManipulator.events.emit("drag",{action:"end",start:e,screenPoint:e}),E(this.analysisViewData.plane,this._startPlane),this.inputState=null,!0}return!1}_onClickPlacePlane(t){if("exclude"===this.layersMode)return!1;if(this._isPlacingSlicePlane){const e=mt(t),i=k();if(this._pickPlane(e,!1,this._activeKeyModifiers,i)){if(E(i,this._startPlane),this.analysis.plane=tt(i,this.view.renderCoordsHelper,this.view.spatialReference,new ft),"pointer-drag"===t.type){const a=this._calculatePickRay(e);this.inputState=Vt(a,t.pointerId,i.origin,i)}return!0}}return!1}_onClickExcludeLayer(t){return!("exclude"!==this.layersMode||!this.created)&&(this.view.hitTest(mt(t)).then((t=>{if(t.results.length){const e=t.results[0],i=e&&e.graphic;if(i){const t=i.sourceLayer||i.layer;t&&this.analysisViewData.excludedLayers.push(t)}}else t.ground.layer?this.analysisViewData.excludedLayers.push(t.ground.layer):this.analysisViewData.excludeGroundSurface=!0})),this._set("layersMode","none"),this.active&&(this.view.activeTool=null),!0)}_onKeyDown(t){return(t.key===B||t.key===A)&&(this._activeKeyModifiers[t.key]=!0,n(this._previewPlane)&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onKeyUp(t){return!(t.key!==B&&t.key!==A||!this._activeKeyModifiers[t.key])&&(delete this._activeKeyModifiers[t.key],n(this._previewPlane)&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onShiftGrab(t){if("start"!==t.action||a(this.analysisViewData.plane))return;const e=this._calculatePickRay(t.screenPoint);E(this.analysisViewData.plane,this._startPlane),this.inputState=Vt(e,null,this.shiftManipulator.renderLocation,this.analysisViewData.plane)}_createShiftDragPipeline(t){return Pt(t,((t,e,i)=>{const s=this.inputState;if(a(s)||"shift"!==s.type)return;const r=n(this.analysisViewData.plane)?E(this.analysisViewData.plane,k()):null;e.next(_t(this.view,s.shiftPlane)).next(this._shiftDragAdjustSensitivity(s)).next(this._shiftDragUpdatePlane(s)),i.next((()=>{n(r)&&this._updateBoundedPlane(r)}))}))}_shiftDragAdjustSensitivity(t){return e=>{if(a(this.analysisViewData.plane))return null;const i=.001,s=Math.min((1-Math.abs(w(S(this.analysisViewData.plane),e.ray.direction)/P(e.ray.direction)))/i,1),n=-H(this._startPlane.plane,e.renderEnd),r=-H(this._startPlane.plane,t.startPoint);return t.depth=t.depth*(1-s)+n*s-r,e}}_shiftDragUpdatePlane(t){return()=>{if(a(this.analysisViewData.plane))return;const e=g(O.get(),this._startPlane.origin),i=g(O.get(),S(this._startPlane));m(i,i,-t.depth),f(i,i,e);const s=x(i,this.analysisViewData.plane.basis1,this.analysisViewData.plane.basis2,k());this._updateBoundedPlane(s)}}_onRotateHeadingGrab(t){if("start"!==t.action||a(this.analysisViewData.plane))return;const e=et(this.analysisViewData.plane,this.view.renderCoordsHelper,1,j()),i=this._calculatePickRay(t.screenPoint),s=T();C(e,i,s)&&(E(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:s})}_createRotateHeadingDragPipeline(t){return Pt(t,((t,e,i)=>{const s=this.inputState;if(a(s)||"rotate"!==s.type)return;const r=n(this.analysisViewData.plane)?E(this.analysisViewData.plane,k()):null;e.next(_t(this.view,s.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(s)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{n(r)&&this._updateBoundedPlane(r)}))}))}_onRotateTiltGrab(t){if("start"!==t.action||a(this.analysisViewData.plane))return;const e=et(this.analysisViewData.plane,this.view.renderCoordsHelper,2,j()),i=this._calculatePickRay(t.screenPoint),s=T();C(e,i,s)&&(E(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:s})}_createRotateTiltDragPipeline(t){return Pt(t,((t,e,i)=>{const s=this.inputState;if(a(s)||"rotate"!==s.type)return;const r=n(this.analysisViewData.plane)?E(this.analysisViewData.plane,k()):null;e.next(_t(this.view,s.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(s)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{n(r)&&this._updateBoundedPlane(r)}))}))}_rotateDragRenderPlaneToRotate(t){return e=>{if(a(this.analysisViewData.plane))return null;const i=R(t.rotatePlane),s=U(t.startPoint,e.renderEnd,this.analysisViewData.plane.origin,i);return{...e,rotateAxis:i,rotateAngle:s}}}_rotateDragUpdatePlaneFromRotate(){return t=>{if(a(this.analysisViewData.plane))return;const e=c(G.get());_(e,e,t.rotateAngle,t.rotateAxis);const i=M(O.get(),this._startPlane.basis1,e),s=M(O.get(),this._startPlane.basis2,e),n=x(this.analysisViewData.plane.origin,i,s,k());this._updateBoundedPlane(n)}}_onResizeGrab(t,e){if("start"!==t.action||a(this.analysisViewData.plane))return;const i=this._calculatePickRay(t.screenPoint),s=O.get();C(this.analysisViewData.plane.plane,i,s)&&(E(this.analysisViewData.plane,this._startPlane),this.inputState={type:"resize",activeHandleIdx:e,startPoint:D(s)})}_createResizeDragPipeline(t){return Pt(t,((t,e,i)=>{const s=this.inputState;if(a(s)||"resize"!==s.type||a(this.analysisViewData.plane))return;const n=E(this.analysisViewData.plane,k());e.next(_t(this.view,this.analysisViewData.plane.plane)).next(this._resizeDragUpdatePlane(s)),i.next((()=>{this._updateBoundedPlane(n)}))}))}_resizeDragUpdatePlane(t){return e=>{if(a(this.analysisViewData.plane))return;const i=this._resizeHandles[t.activeHandleIdx],s=it(i,t.startPoint,e.renderEnd,this.view.state.camera,this._startPlane,E(this.analysisViewData.plane));this._updateBoundedPlane(s)}}_updateBoundedPlane(t){const e=this.analysisViewData;if(!n(e))throw new Error("valid internal object expected");e.plane=t}_updatePreviewPlane(t,e={}){let i=this._previewPlane;if(this._previewPlane=null,a(t))return this._removeFrameTask(),void this._updateManipulators();if(!this.analysisViewData.plane&&this.active){const a=n(i)?i:k();if(i=n(i)?E(i,Dt):null,this._pickPlane(t,!0,e,a)){const t=J;let e=!1;n(i)&&(e=w(i.plane,a.plane)<t||w(V(O.get(),i.basis1),V(O.get(),a.basis1))<t),e&&(this._previewPlaneOpacity=0),this._previewPlane=a}}n(this._previewPlane)&&a(this._frameTask)&&0===this._previewPlaneOpacity?this._frameTask=l({update:({deltaTime:t})=>{this._previewPlaneOpacity=Math.min(this._previewPlaneOpacity+t/(1e3*L),1),this._updateManipulators(),1===this._previewPlaneOpacity&&this._removeFrameTask()}}):a(this._previewPlane)&&n(this._frameTask)?this._removeFrameTask():n(this._previewPlane)&&this._updateManipulators()}_removeFrameTask(){this._frameTask=r(this._frameTask)}_calculatePickRay(t){const e=z(),i=h(t,Tt);return vt(this.view.state.camera,i,e),V(e.direction,e.direction),e}_pickMinResult(t){const e=h(t,I.get());return this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(e,this._intersector),this._intersector.results.min}_pickPlane(t,e,i,a){const s=this._pickMinResult(t),n=O.get();if(!s.getIntersectionPoint(n))return!1;const r=s.getTransformedNormal(O.get()),l=this.view.state.camera;w(r,l.viewForward)>0&&m(r,r,-1);const o=at(n,l),h=(e?1:-1)*o*Q,p=m(O.get(),r,h);f(p,p,n);const u=this.tiltEnabled?3:0,d=i[B]?2:i[A]?1:u;return st(p,r,o,o,l,d,this.view.renderCoordsHelper,a),!0}_updateMouseCursor(){this._set("cursor",null),this._isPlacingSlicePlane||"exclude"===this.layersMode?this._set("cursor","crosshair"):n(this._creatingPointerId)&&this._set("cursor","grabbing")}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=r(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.shiftManipulator.state|=nt,this.rotateHeadingManipulator.state|=nt,this.rotateTiltManipulator.state|=nt,this._prevPointerMoveTimeout=this.clock.setTimeout((()=>{this.shiftManipulator.state&=~nt,this.rotateHeadingManipulator.state&=~nt,this.rotateTiltManipulator.state&=~nt}),F)}_updateManipulators(){if(this.disableEngineLayers)return;let t=null,e=!1;if(n(this.analysisViewData.plane))t=this.analysisViewData.plane,e=!1;else{if(!n(this._previewPlane))return this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.visible=!1,void(this._previewPlaneGridVisualElement.visible=!1);t=this._previewPlane,e=!0}const i=rt(t,G.get());e?(this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.visible=!0,this._previewPlaneGridVisualElement.visible=!0):(this.shiftManipulator.available=!0,this.rotateHeadingManipulator.available=!0,this.rotateTiltManipulator.available=this.tiltEnabled,this.resizeManipulators.forEach((t=>t.available=!0)),lt(this.shiftManipulator,i,t,this.view.state.camera),ot(this.rotateHeadingManipulator,i,t,this.view.renderCoordsHelper),ht(this.rotateTiltManipulator,i,t),this.resizeManipulators.forEach(((e,a)=>pt(e,this._resizeHandles[a],i,t))),this._previewPlaneOutlineVisualElement.visible=!1,this._previewPlaneGridVisualElement.visible=!1);const a=b(O.get(),P(t.basis1),P(t.basis2),1),s=v(G.get(),a),r=y(s,i,s);this._previewPlaneOutlineVisualElement.transform=r,this._previewPlaneGridVisualElement.transform=r,this._updateMaterials()}_updateMaterials(){const t=[q[0],q[1],q[2],q[3]*this._previewPlaneOpacity];this._previewPlaneOutlineVisualElement.color=t;const e=[N[0],N[1],N[2],N[3]*this._previewPlaneOpacity],i=[0,0,0,0];this._previewPlaneGridVisualElement.backgroundColor=e,this._previewPlaneGridVisualElement.gridColor=i}updateManipulatorsInteractive(t){if(!t.grabbing)return this.shiftManipulator.interactive=!0,this.rotateHeadingManipulator.interactive=!0,this.rotateTiltManipulator.interactive=!0,void this.resizeManipulators.forEach((t=>{t.interactive=!0}));this.shiftManipulator.interactive=this.shiftManipulator===t,this.rotateHeadingManipulator.interactive=this.rotateHeadingManipulator===t,this.rotateTiltManipulator.interactive=this.rotateTiltManipulator===t,this.resizeManipulators.forEach((e=>{e.interactive=e===t}))}testData(){return{plane:n(this.analysisViewData.plane)?this.analysisViewData.plane:null}}};function Vt(t,e,i,a){const s=ut(i,S(a),t.direction,j()),n=T();return C(s,t,n)?{type:"shift",creatingPointerId:e,hasBeenDragged:!1,shiftPlane:s,depth:0,startPoint:n}:null}function bt(t){return"mouse"!==t.pointerType||0===t.button}t([u()],Mt.prototype,"clock",void 0),t([u({constructOnly:!0})],Mt.prototype,"view",void 0),t([u()],Mt.prototype,"analysisView",void 0),t([u()],Mt.prototype,"analysisViewData",void 0),t([u({readOnly:!0})],Mt.prototype,"state",null),t([u({readOnly:!0,value:null})],Mt.prototype,"cursor",null),t([u()],Mt.prototype,"analysis",null),t([u({readOnly:!0})],Mt.prototype,"layersMode",void 0),t([u({aliasOf:"analysis.tiltEnabled"})],Mt.prototype,"tiltEnabled",void 0),t([u({value:null})],Mt.prototype,"inputState",null),Mt=t([d("esri.views.3d.interactive.analysisTools.slice.SliceTool")],Mt);const Dt=k(),Tt=p(),kt=Mt;export{kt as default};
|
|
5
|
+
import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/clock.js";import i from"../../../../../core/Handles.js";import{isNone as a,destroyMaybe as s,isSome as n,removeMaybe as r}from"../../../../../core/maybe.js";import{addFrameTask as l}from"../../../../../core/scheduling.js";import{createScreenPoint as o,screenPointObjectToArray as h,createScreenPointArray as p}from"../../../../../core/screenUtils.js";import{property as u}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{i as d,d as _,v,m as y}from"../../../../../chunks/mat4.js";import{d as w,l as P,g,a as m,b as f,m as M,n as V,s as D}from"../../../../../chunks/vec3.js";import{a as b,c as T}from"../../../../../chunks/vec3f64.js";import{a as k,c as E,n as S,f as x}from"../../../../../chunks/boundedPlane.js";import{signedDistance as H,create as j,intersectRay as C,normal as R}from"../../../../../geometry/support/plane.js";import{create as z}from"../../../../../geometry/support/ray.js";import{sv3d as I,sm4d as O,sv2d as G}from"../../../../../geometry/support/vectorStacks.js";import{calculateInputRotationTransform as U}from"../../manipulatorUtils.js";import{PLANE_PREVIEW_OUTLINE_WIDTH as K,forceVerticalModifier as B,forceHorizontalModifier as F,PREVIEW_FADE_DURATION_SECONDS as L,POINTER_MOVE_TIMER_MS as A,PLANE_OUTLINE_COLOR as q,PLANE_BACKGROUND_COLOR as N,PREVIEW_FADE_DOT_THRESHOLD as J,INITIAL_DEPTH_OFFSET_FRAC as Q}from"./sliceToolConfig.js";import{createShiftManipulator as W,createRotateManipulator as X,createResizeManipulator as Y,createGridVisualElement as Z,createOutlineVisualElement as $,planeToShape as tt,createRotatePlane as et,resizePlane as it,calculatePlaneHalfSize as at,createPlane as st,DidPointerMoveRecentlyFlag as nt,calculateBoundedPlaneTranslateRotate as rt,updateShiftRestartHandle as lt,updateRotateHeadingHandle as ot,updateRotateTiltHandle as ht,updateResizeHandle as pt,createShiftPlane as ut}from"./sliceToolUtils.js";import{getRotateHeadingTexture as ct,getTiltRotateTexture as dt}from"./images/Factory.js";import{screenToRenderPlane as _t}from"../../editingTools/dragEventPipeline3D.js";import{fromScreen as vt}from"../../../support/geometryUtils/ray.js";import{Intersector as yt}from"../../../webgl-engine/lib/Intersector.js";import{createManipulatorDragEventPipeline as wt}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as Pt}from"../../../../interactive/InteractiveToolBase.js";import{createScreenPointFromEvent as gt}from"../../../../support/screenUtils.js";import mt from"../../../../../widgets/Slice/SlicePlane.js";let ft=class extends Pt{constructor(t){super(t),this.clock=e,this._previewPlaneOpacity=1,this.analysisView=null,this.layersMode="none",this.tiltEnabled=!1,this.shiftManipulator=null,this.rotateHeadingManipulator=null,this.rotateTiltManipulator=null,this.resizeManipulators=null,this.disableEngineLayers=!1,this._handles=new i,this._viewHandles=new i,this._frameTask=null,this._prevPointerMoveTimeout=null,this._previewPlaneGridVisualElement=null,this._previewPlaneOutlineVisualElement=null,this._startPlane=k(),this._previewPlane=null,this._activeKeyModifiers={},this._lastCursorPosition=o(),this._resizeHandles=[{direction:[1,0]},{direction:[1,1]},{direction:[0,1]},{direction:[-1,1]},{direction:[-1,0]},{direction:[-1,-1]},{direction:[0,-1]},{direction:[1,-1]}],this._intersector=new yt(t.view.state.viewingMode),this._intersector.options.store=0}onAttach(){this.created&&this.visible&&this._updateManipulators()}initialize(){this._initialize()}async _initialize(){const t=()=>{if("creating"===this.toolState||"created"===this.toolState)throw new Error("Unexpected toolState");return!this.destroyed};if(!t())return;if(this.analysisView=await this.view.whenAnalysisView(this.analysis),!t())return;if(null==this.analysis)throw new Error("SliceTool requires valid model, but null was provided.");if(a(this.analysisView.analysisViewData))throw new Error("expected internal object to be defined.");this.analysisViewData=this.analysisView.analysisViewData,this.rotateHeadingImage=ct(this.view.toolViewManager.textures),this.rotateTiltImage=dt(this.view.toolViewManager.textures);const e=this.watch("state",(t=>{switch(t){case"ready":case"slicing":this.finishToolCreation();break;case"sliced":this.complete()}}),!0);"sliced"===this.state?this.complete():this.startToolCreation(),this._handles.add([e,this.view.state.watch("camera",(()=>this._onCameraChange()))]);const i=t=>{this.updateManipulatorsInteractive(t),t.grabbing||(n(this.analysisViewData.plane)&&E(this.analysisViewData.plane,this._startPlane),this.inputState=null)};this.shiftManipulator=W(this.view),this.manipulators.add(this.shiftManipulator),this.shiftManipulator.events.on("grab-changed",(t=>{this._onShiftGrab(t),i(this.shiftManipulator)})),this._handles.add(this._createShiftDragPipeline(this.shiftManipulator)),this.rotateHeadingManipulator=X(this.view,this.rotateHeadingImage.texture),this.manipulators.add(this.rotateHeadingManipulator),this.rotateHeadingManipulator.events.on("grab-changed",(t=>{this._onRotateHeadingGrab(t),i(this.rotateHeadingManipulator)})),this._handles.add(this._createRotateHeadingDragPipeline(this.rotateHeadingManipulator)),this.rotateTiltManipulator=X(this.view,this.rotateTiltImage.texture),this.manipulators.add(this.rotateTiltManipulator),this.rotateTiltManipulator.events.on("grab-changed",(t=>{this._onRotateTiltGrab(t),i(this.rotateTiltManipulator)})),this._handles.add(this._createRotateTiltDragPipeline(this.rotateTiltManipulator)),this.resizeManipulators=this._resizeHandles.map(((t,e)=>{const a=Y(this.view,t);return a.events.on("grab-changed",(t=>{this._onResizeGrab(t,e),i(a)})),this._handles.add(this._createResizeDragPipeline(a)),a})),this.manipulators.addMany(this.resizeManipulators),this._previewPlaneGridVisualElement=Z(this.view),this._previewPlaneOutlineVisualElement=$(this.view),this._previewPlaneOutlineVisualElement.width=K,this._handles.add(this.analysisViewData.watch("plane",(()=>this._updateManipulators()),!0)),this._updateManipulators(),this._updateVisibility(this.visible)}destroy(){if("pending"===this.toolState)return this._handles=s(this._handles),void(this._viewHandles=s(this._viewHandles));this.rotateHeadingImage.release(),this.rotateTiltImage.release(),this.attached&&this.detach(),this._handles=s(this._handles),this._viewHandles=s(this._viewHandles),this._removeFrameTask(),this._clearPointerMoveTimeout(),this._previewPlaneOutlineVisualElement=s(this._previewPlaneOutlineVisualElement),this._previewPlaneGridVisualElement=s(this._previewPlaneGridVisualElement)}get state(){const t=!!this.analysisViewData.plane,e=!!this.inputState;return t?t&&e?"slicing":t&&!e?"sliced":"ready":"ready"}get cursor(){return this._get("cursor")}set analysis(t){if(null==t)throw new Error("SliceTool requires valid model, but null was provided.");this._handles.remove("analysis"),this._set("analysis",t)}get inputState(){return this._get("inputState")}set inputState(t){this._set("inputState",t),this.analysisView.showGrid=n(t)&&"resize"===t.type,this._updateMaterials()}get _isPlacingSlicePlane(){return!this.inputState&&!this.analysisViewData.plane&&this.active}get _creatingPointerId(){return n(this.inputState)&&"shift"===this.inputState.type?this.inputState.creatingPointerId:null}enterExcludeLayerMode(){a(this.analysisViewData.plane)||(this._set("layersMode","exclude"),this.active||(this.view.activeTool=this))}exitExcludeLayerMode(){a(this.analysisViewData.plane)||(this._set("layersMode","none"),this.active&&(this.view.activeTool=null))}onDeactivate(){this._updateMouseCursor(),this._set("layersMode","none"),this._updatePreviewPlane(null)}onDetach(){this.created&&this._set("layersMode","none")}onShow(){this._updateVisibility(!0)}onHide(){this._updateVisibility(!1)}_updateVisibility(t){this.analysis.visible=t,this.created&&(this._updateMouseCursor(),this._updateManipulators(),t||this._clearPointerMoveTimeout())}onInputEvent(t){switch(t.type){case"pointer-drag":if(!Vt(t))return;this._isPlacingSlicePlane?this._onClickPlacePlane(t)&&(t.stopPropagation(),this._updateMouseCursor()):this._onPointerDrag(t)&&t.stopPropagation();break;case"pointer-move":this._onPointerMove(t),this._updateMouseCursor();break;case"pointer-up":this._onPointerUp(t)&&t.stopPropagation();break;case"immediate-click":if(!Vt(t))return;this._onClickPlacePlane(t)&&(t.stopPropagation(),this._updateMouseCursor());break;case"click":if(!Vt(t))return;this._onClickExcludeLayer(t)&&t.stopPropagation();break;case"drag":this.inputState&&t.stopPropagation();break;case"key-down":this._onKeyDown(t)&&t.stopPropagation();break;case"key-up":this._onKeyUp(t)&&t.stopPropagation()}}onEditableChange(){this.analysisView&&(this.analysisView.editable=this.editable)}_onPointerDrag(t){const e=this.inputState;if(t.pointerId===this._creatingPointerId&&n(e)&&"shift"===e.type){const i=gt(t);return this.shiftManipulator.events.emit("drag",{action:e.hasBeenDragged?"update":"start",pointerType:t.pointerType,start:i,screenPoint:i}),e.hasBeenDragged=!0,!0}return!1}_onPointerMove(t){this._lastCursorPosition.x=t.x,this._lastCursorPosition.y=t.y,this._resetPointerMoveTimeout(),"touch"!==t.pointerType&&this._updatePreviewPlane(gt(t),this._activeKeyModifiers)}_onCameraChange(){this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),this._updateManipulators()}_onPointerUp(t){if(t.pointerId===this._creatingPointerId&&n(this.analysisViewData.plane)){const e=gt(t);return this.shiftManipulator.events.emit("drag",{action:"end",start:e,screenPoint:e}),E(this.analysisViewData.plane,this._startPlane),this.inputState=null,!0}return!1}_onClickPlacePlane(t){if("exclude"===this.layersMode)return!1;if(this._isPlacingSlicePlane){const e=gt(t),i=k();if(this._pickPlane(e,!1,this._activeKeyModifiers,i)){if(E(i,this._startPlane),this.analysis.shape=tt(i,this.view.renderCoordsHelper,this.view.spatialReference,new mt),"pointer-drag"===t.type){const a=this._calculatePickRay(e);this.inputState=Mt(a,t.pointerId,i.origin,i)}return!0}}return!1}_onClickExcludeLayer(t){return!("exclude"!==this.layersMode||!this.created)&&(this.view.hitTest(gt(t)).then((t=>{if(t.results.length){const e=t.results[0],i=e&&e.graphic;if(i){const t=i.sourceLayer||i.layer;t&&this.analysisViewData.excludedLayers.push(t)}}else t.ground.layer?this.analysisViewData.excludedLayers.push(t.ground.layer):this.analysisViewData.excludeGroundSurface=!0})),this._set("layersMode","none"),this.active&&(this.view.activeTool=null),!0)}_onKeyDown(t){return(t.key===B||t.key===F)&&(this._activeKeyModifiers[t.key]=!0,n(this._previewPlane)&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onKeyUp(t){return!(t.key!==B&&t.key!==F||!this._activeKeyModifiers[t.key])&&(delete this._activeKeyModifiers[t.key],n(this._previewPlane)&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onShiftGrab(t){if("start"!==t.action||a(this.analysisViewData.plane))return;const e=this._calculatePickRay(t.screenPoint);E(this.analysisViewData.plane,this._startPlane),this.inputState=Mt(e,null,this.shiftManipulator.renderLocation,this.analysisViewData.plane)}_createShiftDragPipeline(t){return wt(t,((t,e,i)=>{const s=this.inputState;if(a(s)||"shift"!==s.type)return;const r=n(this.analysisViewData.plane)?E(this.analysisViewData.plane,k()):null;e.next(_t(this.view,s.shiftPlane)).next(this._shiftDragAdjustSensitivity(s)).next(this._shiftDragUpdatePlane(s)),i.next((()=>{n(r)&&this._updateBoundedPlane(r)}))}))}_shiftDragAdjustSensitivity(t){return e=>{if(a(this.analysisViewData.plane))return null;const i=.001,s=Math.min((1-Math.abs(w(S(this.analysisViewData.plane),e.ray.direction)/P(e.ray.direction)))/i,1),n=-H(this._startPlane.plane,e.renderEnd),r=-H(this._startPlane.plane,t.startPoint);return t.depth=t.depth*(1-s)+n*s-r,e}}_shiftDragUpdatePlane(t){return()=>{if(a(this.analysisViewData.plane))return;const e=g(I.get(),this._startPlane.origin),i=g(I.get(),S(this._startPlane));m(i,i,-t.depth),f(i,i,e);const s=x(i,this.analysisViewData.plane.basis1,this.analysisViewData.plane.basis2,k());this._updateBoundedPlane(s)}}_onRotateHeadingGrab(t){if("start"!==t.action||a(this.analysisViewData.plane))return;const e=et(this.analysisViewData.plane,this.view.renderCoordsHelper,1,j()),i=this._calculatePickRay(t.screenPoint),s=T();C(e,i,s)&&(E(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:s})}_createRotateHeadingDragPipeline(t){return wt(t,((t,e,i)=>{const s=this.inputState;if(a(s)||"rotate"!==s.type)return;const r=n(this.analysisViewData.plane)?E(this.analysisViewData.plane,k()):null;e.next(_t(this.view,s.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(s)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{n(r)&&this._updateBoundedPlane(r)}))}))}_onRotateTiltGrab(t){if("start"!==t.action||a(this.analysisViewData.plane))return;const e=et(this.analysisViewData.plane,this.view.renderCoordsHelper,2,j()),i=this._calculatePickRay(t.screenPoint),s=T();C(e,i,s)&&(E(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:s})}_createRotateTiltDragPipeline(t){return wt(t,((t,e,i)=>{const s=this.inputState;if(a(s)||"rotate"!==s.type)return;const r=n(this.analysisViewData.plane)?E(this.analysisViewData.plane,k()):null;e.next(_t(this.view,s.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(s)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{n(r)&&this._updateBoundedPlane(r)}))}))}_rotateDragRenderPlaneToRotate(t){return e=>{if(a(this.analysisViewData.plane))return null;const i=R(t.rotatePlane),s=U(t.startPoint,e.renderEnd,this.analysisViewData.plane.origin,i);return{...e,rotateAxis:i,rotateAngle:s}}}_rotateDragUpdatePlaneFromRotate(){return t=>{if(a(this.analysisViewData.plane))return;const e=d(O.get());_(e,e,t.rotateAngle,t.rotateAxis);const i=M(I.get(),this._startPlane.basis1,e),s=M(I.get(),this._startPlane.basis2,e),n=x(this.analysisViewData.plane.origin,i,s,k());this._updateBoundedPlane(n)}}_onResizeGrab(t,e){if("start"!==t.action||a(this.analysisViewData.plane))return;const i=this._calculatePickRay(t.screenPoint),s=I.get();C(this.analysisViewData.plane.plane,i,s)&&(E(this.analysisViewData.plane,this._startPlane),this.inputState={type:"resize",activeHandleIdx:e,startPoint:b(s)})}_createResizeDragPipeline(t){return wt(t,((t,e,i)=>{const s=this.inputState;if(a(s)||"resize"!==s.type||a(this.analysisViewData.plane))return;const n=E(this.analysisViewData.plane,k());e.next(_t(this.view,this.analysisViewData.plane.plane)).next(this._resizeDragUpdatePlane(s)),i.next((()=>{this._updateBoundedPlane(n)}))}))}_resizeDragUpdatePlane(t){return e=>{if(a(this.analysisViewData.plane))return;const i=this._resizeHandles[t.activeHandleIdx],s=it(i,t.startPoint,e.renderEnd,this.view.state.camera,this._startPlane,E(this.analysisViewData.plane));this._updateBoundedPlane(s)}}_updateBoundedPlane(t){const e=this.analysisViewData;if(!n(e))throw new Error("valid internal object expected");e.plane=t}_updatePreviewPlane(t,e={}){let i=this._previewPlane;if(this._previewPlane=null,a(t))return this._removeFrameTask(),void this._updateManipulators();if(!this.analysisViewData.plane&&this.active){const a=n(i)?i:k();if(i=n(i)?E(i,Dt):null,this._pickPlane(t,!0,e,a)){const t=J;let e=!1;n(i)&&(e=w(i.plane,a.plane)<t||w(V(I.get(),i.basis1),V(I.get(),a.basis1))<t),e&&(this._previewPlaneOpacity=0),this._previewPlane=a}}n(this._previewPlane)&&a(this._frameTask)&&0===this._previewPlaneOpacity?this._frameTask=l({update:({deltaTime:t})=>{this._previewPlaneOpacity=Math.min(this._previewPlaneOpacity+t/(1e3*L),1),this._updateManipulators(),1===this._previewPlaneOpacity&&this._removeFrameTask()}}):a(this._previewPlane)&&n(this._frameTask)?this._removeFrameTask():n(this._previewPlane)&&this._updateManipulators()}_removeFrameTask(){this._frameTask=r(this._frameTask)}_calculatePickRay(t){const e=z(),i=h(t,bt);return vt(this.view.state.camera,i,e),V(e.direction,e.direction),e}_pickMinResult(t){const e=h(t,G.get());return this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(e,this._intersector),this._intersector.results.min}_pickPlane(t,e,i,a){const s=this._pickMinResult(t),n=I.get();if(!s.getIntersectionPoint(n))return!1;const r=s.getTransformedNormal(I.get()),l=this.view.state.camera;w(r,l.viewForward)>0&&m(r,r,-1);const o=at(n,l),h=(e?1:-1)*o*Q,p=m(I.get(),r,h);f(p,p,n);const u=this.tiltEnabled?3:0,c=i[B]?2:i[F]?1:u;return st(p,r,o,o,l,c,this.view.renderCoordsHelper,a),!0}_updateMouseCursor(){this._set("cursor",null),this._isPlacingSlicePlane||"exclude"===this.layersMode?this._set("cursor","crosshair"):n(this._creatingPointerId)&&this._set("cursor","grabbing")}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=r(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.shiftManipulator.state|=nt,this.rotateHeadingManipulator.state|=nt,this.rotateTiltManipulator.state|=nt,this._prevPointerMoveTimeout=this.clock.setTimeout((()=>{this.shiftManipulator.state&=~nt,this.rotateHeadingManipulator.state&=~nt,this.rotateTiltManipulator.state&=~nt}),A)}_updateManipulators(){if(this.disableEngineLayers)return;let t=null,e=!1;if(n(this.analysisViewData.plane))t=this.analysisViewData.plane,e=!1;else{if(!n(this._previewPlane))return this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.visible=!1,void(this._previewPlaneGridVisualElement.visible=!1);t=this._previewPlane,e=!0}const i=rt(t,O.get());e?(this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.visible=!0,this._previewPlaneGridVisualElement.visible=!0):(this.shiftManipulator.available=!0,this.rotateHeadingManipulator.available=!0,this.rotateTiltManipulator.available=this.tiltEnabled,this.resizeManipulators.forEach((t=>t.available=!0)),lt(this.shiftManipulator,i,t,this.view.state.camera),ot(this.rotateHeadingManipulator,i,t,this.view.renderCoordsHelper),ht(this.rotateTiltManipulator,i,t),this.resizeManipulators.forEach(((e,a)=>pt(e,this._resizeHandles[a],i,t))),this._previewPlaneOutlineVisualElement.visible=!1,this._previewPlaneGridVisualElement.visible=!1);const a=D(I.get(),P(t.basis1),P(t.basis2),1),s=v(O.get(),a),r=y(s,i,s);this._previewPlaneOutlineVisualElement.transform=r,this._previewPlaneGridVisualElement.transform=r,this._updateMaterials()}_updateMaterials(){const t=[q[0],q[1],q[2],q[3]*this._previewPlaneOpacity];this._previewPlaneOutlineVisualElement.color=t;const e=[N[0],N[1],N[2],N[3]*this._previewPlaneOpacity],i=[0,0,0,0];this._previewPlaneGridVisualElement.backgroundColor=e,this._previewPlaneGridVisualElement.gridColor=i}updateManipulatorsInteractive(t){if(!t.grabbing)return this.shiftManipulator.interactive=!0,this.rotateHeadingManipulator.interactive=!0,this.rotateTiltManipulator.interactive=!0,void this.resizeManipulators.forEach((t=>{t.interactive=!0}));this.shiftManipulator.interactive=this.shiftManipulator===t,this.rotateHeadingManipulator.interactive=this.rotateHeadingManipulator===t,this.rotateTiltManipulator.interactive=this.rotateTiltManipulator===t,this.resizeManipulators.forEach((e=>{e.interactive=e===t}))}testData(){return{plane:n(this.analysisViewData.plane)?this.analysisViewData.plane:null}}};function Mt(t,e,i,a){const s=ut(i,S(a),t.direction,j()),n=T();return C(s,t,n)?{type:"shift",creatingPointerId:e,hasBeenDragged:!1,shiftPlane:s,depth:0,startPoint:n}:null}function Vt(t){return"mouse"!==t.pointerType||0===t.button}t([u()],ft.prototype,"clock",void 0),t([u({constructOnly:!0})],ft.prototype,"view",void 0),t([u()],ft.prototype,"analysisView",void 0),t([u()],ft.prototype,"analysisViewData",void 0),t([u({readOnly:!0})],ft.prototype,"state",null),t([u({readOnly:!0,value:null})],ft.prototype,"cursor",null),t([u()],ft.prototype,"analysis",null),t([u({readOnly:!0})],ft.prototype,"layersMode",void 0),t([u({aliasOf:"analysis.tiltEnabled"})],ft.prototype,"tiltEnabled",void 0),t([u({value:null})],ft.prototype,"inputState",null),ft=t([c("esri.views.3d.interactive.analysisTools.slice.SliceTool")],ft);const Dt=k(),bt=p(),Tt=ft;export{Tt as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.22/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import t from"./heading-rotate-png.js";import r from"./tilt-rotate-png.js";import{Texture as e}from"../../../../webgl-engine/lib/Texture.js";const n={mipmap:!0,preMultiplyAlpha:!0,width:64,height:64};function o(r){return r.fromData(t,(()=>new e(t,n)))}function i(t){return t.fromData(r,(()=>new e(r,n)))}export{o as getRotateHeadingTexture,i as getTiltRotateTexture};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.22/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import o from"../../../../../core/has.js";import{deg2rad as t}from"../../../../../core/mathUtils.js";const r=o("mac")?"Meta":"Control",s="Shift",a=2,c=1.15,m=1.15,h=1.1,e=2500,i=.02,f=Math.cos(t(45)),p=Math.cos(t(5)),M=.95,j=.3,l=.7,n=[1,.5,0],x=2,C=1,S=[...n,l],U=[0,0,0,.04],b=[...n,.5],d=[...n,1],g=[1,1,1,1],k=[1,.8,.6,1],q=[1,.93,.86,1],u=[...n,1],v=[...n,1],w=3,y=11,z=22.5,A=40,B=48,D=2.25,E=
|
|
5
|
+
import o from"../../../../../core/has.js";import{deg2rad as t}from"../../../../../core/mathUtils.js";const r=o("mac")?"Meta":"Control",s="Shift",a=2,c=1.15,m=1.15,h=1.1,e=2500,i=.02,f=Math.cos(t(45)),p=Math.cos(t(5)),M=.95,j=.3,l=.7,n=[1,.5,0],x=2,C=1,S=[...n,l],U=[0,0,0,.04],b=[...n,.5],d=[...n,1],g=[1,1,1,1],k=[1,.8,.6,1],q=[1,.93,.86,1],u=[...n,1],v=[...n,1],w=3,y=11,z=22.5,A=40,B=48,D=2.25,E=[...n,1],F=4,G=1,H=.3,I=6,J=4,K=12,L=40,N=27,O=1600,P=.4;export{a as DISPLAY_FOCUS_MULTIPLIER,b as GRID_COLOR,i as INITIAL_DEPTH_OFFSET_FRAC,P as INITIAL_PLANE_HALF_SIZE_VIEW_PROPORTION,U as PLANE_BACKGROUND_COLOR,O as PLANE_MIN_BASIS_SCREEN_LEN2,S as PLANE_OUTLINE_COLOR,C as PLANE_OUTLINE_WIDTH,x as PLANE_PREVIEW_OUTLINE_WIDTH,e as POINTER_MOVE_TIMER_MS,M as PREVIEW_FADE_DOT_THRESHOLD,j as PREVIEW_FADE_DURATION_SECONDS,E as RESIZE_HANDLE_COLOR,I as RESIZE_HANDLE_CORNER_INPUT_RADIUS,F as RESIZE_HANDLE_CORNER_WIDTH,J as RESIZE_HANDLE_EDGE_INPUT_RADIUS,H as RESIZE_HANDLE_EDGE_PADDING_FRAC,G as RESIZE_HANDLE_EDGE_WIDTH,d as ROTATE_HEADING_CALLOUT_COLOR,N as ROTATE_HEADING_DISC_RADIUS,h as ROTATE_HEADING_DISC_RADIUS_FOCUS_MULTIPLIER,L as ROTATE_HEADING_OFFSET_DISTANCE,K as ROTATE_HEADING_TIP_LENGTH,k as SHIFT_RESTART_ARROW_CAP_COLOR,B as SHIFT_RESTART_ARROW_LENGTH,D as SHIFT_RESTART_ARROW_OUTLINE_WIDTH,g as SHIFT_RESTART_ARROW_TIP_COLOR,u as SHIFT_RESTART_CALLOUT_COLOR,A as SHIFT_RESTART_OFFSET_DISTANCE,v as SHIFT_RESTART_OUTLINE_COLOR,m as SHIFT_RESTART_TIP_FOCUS_MULTIPLIER,z as SHIFT_RESTART_TIP_LENGTH,y as SHIFT_RESTART_TIP_RADIUS,q as SHIFT_RESTART_TUBE_COLOR,c as SHIFT_RESTART_TUBE_FOCUS_MULTIPLIER,w as SHIFT_RESTART_TUBE_RADIUS,p as SMALL_ANGLE_DOT_THRESHOLD,f as VERTICAL_DOT_THRESHOLD,r as forceHorizontalModifier,s as forceVerticalModifier};
|