@arcgis/core 4.28.0-next.20230621 → 4.28.0-next.20230623
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/Basemap.js +1 -1
- package/arcade/ArcadeModuleResolver.js +1 -1
- package/arcade/Feature.js +1 -1
- package/arcade/arcadeCompiler.js +1 -1
- package/arcade/arcadeTimeUtils.js +1 -1
- package/arcade/featureset/actions/GroupBy.js +1 -1
- package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
- package/arcade/featureset/support/sqlUtils.js +1 -1
- package/arcade/functions/date.js +1 -1
- package/arcade/functions/geomasync.js +1 -1
- package/arcade/functions/geometry.js +1 -1
- package/arcade/functions/geomsync.js +1 -1
- package/arcade/functions/string.js +1 -1
- package/arcade/languageUtils.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0380e9f61b6f3ca85139.js +1 -0
- package/assets/esri/core/workers/chunks/0bd95f46a0a9005a19f9.js +1 -0
- package/assets/esri/core/workers/chunks/0c621046b7211cdde980.js +1 -0
- package/assets/esri/core/workers/chunks/0e0267739728e5413f1d.js +1 -0
- package/assets/esri/core/workers/chunks/{39079bcfd35ed73c4e34.js → 156e801a3262f0ac79c0.js} +1 -1
- package/assets/esri/core/workers/chunks/19b4f02fb2392d964582.js +1 -0
- package/assets/esri/core/workers/chunks/1ae75f5282e983f6d768.js +1 -0
- package/assets/esri/core/workers/chunks/2179b3e9e532ca8ef982.js +1 -0
- package/assets/esri/core/workers/chunks/21aaa7fa0e5482670010.js +1 -0
- package/assets/esri/core/workers/chunks/26212a08ea383547335b.js +1 -0
- package/assets/esri/core/workers/chunks/{2420ec029236ab31d908.js → 2882a55a971af1f7858b.js} +1 -1
- package/assets/esri/core/workers/chunks/294285f2822c101326ec.js +1 -0
- package/assets/esri/core/workers/chunks/29f9a380610e4fd98a7c.js +1 -0
- package/assets/esri/core/workers/chunks/303238fc2fcdbb277981.js +1 -0
- package/assets/esri/core/workers/chunks/{3db8ae98799c752afe60.js → 34958516e604d487c625.js} +1 -1
- package/assets/esri/core/workers/chunks/3bee743f4c9370045a5d.js +1 -0
- package/assets/esri/core/workers/chunks/{8e08968505483dc58e00.js → 40ee4e0a5000a08c3abd.js} +1 -1
- package/assets/esri/core/workers/chunks/4128e45e17c9e5280e11.js +1 -0
- package/assets/esri/core/workers/chunks/4f88c4d1d2103843aca8.js +1 -0
- package/assets/esri/core/workers/chunks/505792ce8cbbddd2e815.js +1 -0
- package/assets/esri/core/workers/chunks/{3d42fa4ab5f8632d690a.js → 5237b3938be0d4bc6045.js} +1 -1
- package/assets/esri/core/workers/chunks/{57077e608f20d3a931e8.js → 570e94f4fbefc856d303.js} +1 -1
- package/assets/esri/core/workers/chunks/{4b235d1b6a72773cd4f4.js → 57bb8516fa998a0fba78.js} +1 -1
- package/assets/esri/core/workers/chunks/57bf3ff01d738cedc292.js +1 -0
- package/assets/esri/core/workers/chunks/{1e9e68312cd865358260.js → 60486acc5dacf73f851a.js} +1 -1
- package/assets/esri/core/workers/chunks/6208f2dfa9dfd3bca000.js +1 -0
- package/assets/esri/core/workers/chunks/64008bde5d3ffd9f2499.js +1 -0
- package/assets/esri/core/workers/chunks/69f51a7768bf51c9e346.js +1 -0
- package/assets/esri/core/workers/chunks/719f741a0e45c3e694ba.js +1 -0
- package/assets/esri/core/workers/chunks/{cfe379a78a983373b3ac.js → 7304f45f5622a68253e4.js} +1 -1
- package/assets/esri/core/workers/chunks/733b70d6e5c466a67e9c.js +1 -0
- package/assets/esri/core/workers/chunks/7694521b44681d52b713.js +1 -0
- package/assets/esri/core/workers/chunks/840fd05ceaa038c476d6.js +1 -0
- package/assets/esri/core/workers/chunks/89f7fd2ab92aa14fe0c0.js +1 -0
- package/assets/esri/core/workers/chunks/8a6f29f2ebd59783bb1b.js +1 -0
- package/assets/esri/core/workers/chunks/9d487b7817ccf5bceff6.js +1 -0
- package/assets/esri/core/workers/chunks/{42b6315e21c4c1345ba5.js → 9f5337a80963e0b3c009.js} +1 -1
- package/assets/esri/core/workers/chunks/a0face18b3ea567999ef.js +1 -0
- package/assets/esri/core/workers/chunks/b773c8854e98384ac8ac.js +1 -0
- package/assets/esri/core/workers/chunks/{fb44d872b9dbadcf8ccf.js → b9ef05c22bc3e395bcb3.js} +1 -1
- package/assets/esri/core/workers/chunks/bc5e34200776cfc83d5b.js +1 -0
- package/assets/esri/core/workers/chunks/{cfc3dcca2b69d20d5375.js → c0b9cc091efd5db827de.js} +1 -1
- package/assets/esri/core/workers/chunks/c9f5e949830196ad9458.js +1 -0
- package/assets/esri/core/workers/chunks/{036301f545aba2b8e485.js → cc15e28a99694120556d.js} +1 -1
- package/assets/esri/core/workers/chunks/ce7f575a6c2053c7ca17.js +1 -0
- package/assets/esri/core/workers/chunks/ce9c99cee3d1a3963e7c.js +1 -0
- package/assets/esri/core/workers/chunks/cf9a87b53ea74bae6a37.js +1 -0
- package/assets/esri/core/workers/chunks/d16850b98a53ade0de10.js +1 -0
- package/assets/esri/core/workers/chunks/d24f7ef6eca8c91b90b4.js +1 -0
- package/assets/esri/core/workers/chunks/dbd86e4b7983873cbe7c.js +1 -0
- package/assets/esri/core/workers/chunks/{3c3f65913006b84b2289.js → de20572d334abd4a7d82.js} +1 -1
- package/assets/esri/core/workers/chunks/e009e7f074a572894f48.js +1 -0
- package/assets/esri/core/workers/chunks/{cb004c492e22c50f9bfa.js → f3eb89cff63e00f036c6.js} +1 -1
- package/assets/esri/core/workers/chunks/{b2a423d9ce8bb784267c.js → f53f20c7100092823487.js} +1 -1
- package/assets/esri/core/workers/chunks/f6040205c50e2795a1a0.js +1 -0
- package/assets/esri/core/workers/chunks/{915734255a79bff3ef0f.js → fcd54e9e64c2864f183c.js} +1 -1
- package/assets/esri/t9n/common.json +1 -1
- package/assets/esri/t9n/common_en.json +1 -1
- package/assets/esri/themes/base/_core.scss +6 -2
- package/assets/esri/themes/base/_mixins.scss +0 -147
- package/assets/esri/themes/base/widgets/_AreaMeasurement2D.scss +0 -8
- package/assets/esri/themes/base/widgets/_AreaMeasurement3D.scss +0 -8
- package/assets/esri/themes/base/widgets/_DirectLineMeasurement3D.scss +0 -1
- package/assets/esri/themes/base/widgets/_DistanceMeasurement2D.scss +0 -1
- package/assets/esri/themes/base/widgets/_MeasurementWidgetContent.scss +67 -0
- package/assets/esri/themes/base/widgets/_Slice.scss +17 -54
- package/assets/esri/themes/base/widgets/_UnitSelect.scss +14 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/AreaMeasurement2D/t9n/AreaMeasurement2D.json +1 -1
- package/assets/esri/widgets/AreaMeasurement2D/t9n/AreaMeasurement2D_en.json +1 -1
- package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D.json +1 -1
- package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_en.json +1 -1
- package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D.json +1 -1
- package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_en.json +1 -1
- package/assets/esri/widgets/DistanceMeasurement2D/t9n/DistanceMeasurement2D.json +1 -1
- package/assets/esri/widgets/DistanceMeasurement2D/t9n/DistanceMeasurement2D_en.json +1 -1
- package/chunks/HUDMaterial.glsl.js +39 -39
- package/chunks/HighlightBlur.glsl.js +2 -2
- package/chunks/ShadowHighlight.glsl.js +1 -1
- package/chunks/arcade.js +1 -1
- package/chunks/languageUtils.js +1 -1
- package/core/HandleOwner.js +1 -1
- package/core/promiseUtils.js +1 -1
- package/core/support/{WatchUpdatingTracking.js → UpdatingHandles.js} +1 -1
- package/core/workers/workerFactory.js +1 -1
- package/geometry/projection.js +1 -1
- package/interfaces.d.ts +270 -5
- package/kernel.js +1 -1
- package/layers/Layer.js +1 -1
- package/layers/LinkChartLayer.d.ts +4 -0
- package/layers/LinkChartLayer.js +1 -1
- package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
- package/layers/mixins/PortalLayer.js +1 -1
- package/layers/support/TileInfoTilemapCache.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/views/2d/layers/features/controllers/FeatureController2D.js +1 -1
- package/views/2d/layers/features/sources/DataTileSource.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
- package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightVisualization.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/CloudsGenerator.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/environment/Precipitation.js +1 -1
- package/views/3d/environment/SceneViewEnvironmentManager.js +1 -1
- package/views/3d/environment/Stars.js +1 -1
- package/views/3d/interactive/editingTools/moveGraphic/GraphicMoveTool.js +1 -1
- package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/GraphicTransformTool.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
- package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFeatureProcessor.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/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DScaleVisibility.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.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/GraphicsProcessor.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/graphics/labelPlacement.js +1 -1
- package/views/3d/layers/support/FeatureTileTree3DDebugger.js +1 -1
- package/views/3d/layers/support/FeatureVisibilityFilter.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/state/ViewState.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/support/DisplayQualityProfile.js +1 -1
- package/views/3d/support/MemoryController.js +1 -1
- package/views/3d/support/SceneViewPerformanceInfo.js +1 -1
- package/views/3d/support/cameraUtils.js +1 -1
- package/views/3d/support/viewpointUtils.js +1 -1
- package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/Stage.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/hud/HUDOcclusionPass.glsl.js +6 -7
- package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js +1 -1
- package/views/3d/webgl-engine/lib/Highlight.js +1 -1
- package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
- package/views/3d/webgl-engine/lib/RenderPluginManager.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/SSAOHelper.js +1 -1
- package/views/3d/webgl-engine/lib/SmaaRenderPass.js +1 -1
- package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/LayerViewManager.js +1 -1
- package/views/ToolViewManager.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/draw/PointDrawAction.js +1 -1
- package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
- package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
- package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
- package/views/interactive/snapping/featureSources/I3SSnappingSource.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorkerHandle.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
- package/views/layers/LayerView.js +1 -1
- package/views/overlay/ViewOverlay.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/widgets/AreaMeasurement2D.js +1 -1
- package/widgets/AreaMeasurement3D.js +1 -1
- package/widgets/DirectLineMeasurement3D.js +1 -1
- package/widgets/DistanceMeasurement2D.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/Workflow.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm/FieldInput.js +1 -1
- package/widgets/FeatureForm/FormExpressionArcadeExecutor.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/Slice.js +1 -1
- package/widgets/UtilityNetworkValidateTopology/UtilityNetworkValidateTopologyViewModel.js +1 -1
- package/widgets/support/MeasurementWidgetContent.js +5 -0
- package/widgets/support/UnitSelect.js +5 -0
- package/assets/esri/core/workers/chunks/0254165377538522c830.js +0 -1
- package/assets/esri/core/workers/chunks/07f16ea775b39a1a4a7b.js +0 -1
- package/assets/esri/core/workers/chunks/170c72126d10b1fdb2b0.js +0 -1
- package/assets/esri/core/workers/chunks/1bbc868d2430103951eb.js +0 -1
- package/assets/esri/core/workers/chunks/1d2ef88a8d028adef102.js +0 -1
- package/assets/esri/core/workers/chunks/2ef70c9b2484a11b7435.js +0 -1
- package/assets/esri/core/workers/chunks/39ae4b9b766f674bc6f2.js +0 -1
- package/assets/esri/core/workers/chunks/3b3d676b609c47a77164.js +0 -1
- package/assets/esri/core/workers/chunks/3d9a8cb638cf9b8ca4b3.js +0 -1
- package/assets/esri/core/workers/chunks/42f3421740a5479559dc.js +0 -1
- package/assets/esri/core/workers/chunks/45629ff775e77234b227.js +0 -1
- package/assets/esri/core/workers/chunks/52315f93a6f0ad59bd90.js +0 -1
- package/assets/esri/core/workers/chunks/5bb96e602d7cecbecf54.js +0 -1
- package/assets/esri/core/workers/chunks/63322229183f1d4eaa70.js +0 -1
- package/assets/esri/core/workers/chunks/642510b0371311ff8e16.js +0 -1
- package/assets/esri/core/workers/chunks/6995ace1d25d67c98d0e.js +0 -1
- package/assets/esri/core/workers/chunks/7e4013f8c31c9a9438c6.js +0 -1
- package/assets/esri/core/workers/chunks/82939ead43848a13f765.js +0 -1
- package/assets/esri/core/workers/chunks/8b6b963230df56850580.js +0 -1
- package/assets/esri/core/workers/chunks/95ff92d7caa34664d58f.js +0 -1
- package/assets/esri/core/workers/chunks/9e570cd4a48c30c83ae6.js +0 -1
- package/assets/esri/core/workers/chunks/a9e9297267614c4c4f3b.js +0 -1
- package/assets/esri/core/workers/chunks/b052463ffb7cb32306dc.js +0 -1
- package/assets/esri/core/workers/chunks/b31974524932e638df8c.js +0 -1
- package/assets/esri/core/workers/chunks/b75b4b132dbd9cb9d372.js +0 -1
- package/assets/esri/core/workers/chunks/c1dfbda75abc748a6ca4.js +0 -1
- package/assets/esri/core/workers/chunks/c8702e53a8ad6cf6ab85.js +0 -1
- package/assets/esri/core/workers/chunks/c90416e7bf29eb1d4536.js +0 -1
- package/assets/esri/core/workers/chunks/cad7a2092ea7f51dbd8b.js +0 -1
- package/assets/esri/core/workers/chunks/d0e2b42dca51711f2c6f.js +0 -1
- package/assets/esri/core/workers/chunks/d2a127f7bb0e2ba14a13.js +0 -1
- package/assets/esri/core/workers/chunks/df96824a6f76bad1370c.js +0 -1
- package/assets/esri/core/workers/chunks/e097f41bbfac00250477.js +0 -1
- package/assets/esri/core/workers/chunks/e3243d120a23a9b48392.js +0 -1
- package/assets/esri/core/workers/chunks/e55f80b774e090a0aa04.js +0 -1
- package/assets/esri/core/workers/chunks/e668c7e2e61aae6ca6e0.js +0 -1
- package/assets/esri/core/workers/chunks/ef900614353505afb210.js +0 -1
- package/assets/esri/core/workers/chunks/f0299d93a95f40ea7cf7.js +0 -1
- package/assets/esri/core/workers/chunks/f23b95d7e51a144ad065.js +0 -1
- package/assets/esri/core/workers/chunks/f263e73a25fae4beffae.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../Graphic.js";import i from"../../../../core/Accessor.js";import s from"../../../../core/Collection.js";import{makeHandle as r}from"../../../../core/handleUtils.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{isAbortError as o}from"../../../../core/promiseUtils.js";import{watch as a,sync as l,syncAndInitial as p}from"../../../../core/reactiveUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as h}from"../../../../core/accessorSupport/decorators/subclass.js";import{diff as u}from"../../../../core/accessorSupport/diffUtils.js";import{UpdatingHandles as d}from"../../../../core/support/UpdatingHandles.js";import y from"../../../../layers/Layer.js";import{hydrateGraphic as g}from"../../../../layers/graphics/hydratedFeatures.js";import{getRenderingInfo as m,getRenderingInfoAsync as f}from"../../../../renderers/support/renderingInfoUtils.js";import b from"../../../../rest/support/Query.js";import{DrapeSourceType as C}from"../interfaces.js";import{SUSPEND_RESUME_EXTENT_OPTIMISM as j}from"./constants.js";import{Graphics3DCore as w}from"./Graphics3DCore.js";import S from"./Graphics3DElevationAlignment.js";import v from"./Graphics3DFrustumVisibility.js";import{Graphics3DObjectStates as V}from"./Graphics3DObjectStates.js";import E from"./Graphics3DScaleVisibility.js";import{enlargeExtent as G}from"./graphicUtils.js";import{Object3DState as _}from"../../webgl-engine/lib/basicInterfaces.js";import{UpdatePolicy as x}from"../../webgl-engine/lib/UpdatePolicy.js";let O=class extends i{constructor(t){super(t),this.type="graphics-3d",this.graphicsCore=null,this.drapeSourceType=C.Features,this.scaleVisibilityEnabled=!1,this.frustumVisibilityEnabled=!1,this._suspendResumeExtent=null,this._updatingHandles=new d}initialize(){const{layer:t}=this,e="effectiveScaleRange"in t?t:null,i=this.scaleVisibilityEnabled&&null!=e,s=new w({owner:this,layer:this.owner.layer,preferredUpdatePolicy:x.SYNC,graphicSymbolSupported:!0,componentFactories:{elevationAlignment:(t,e)=>new S({graphicsCoreOwner:this,graphicsCore:t,queryGraphicUIDsInExtent:e,elevationProvider:this.view.elevationProvider}),scaleVisibility:i?(t,i)=>new E({graphicsCoreOwner:this,layer:e,queryGraphicUIDsInExtent:i,graphicsCore:t,basemapTerrain:this.owner.view.basemapTerrain}):null,objectStates:t=>new V(t)}});if(this._set("graphicsCore",s),this.frustumVisibilityEnabled&&this._set("frustumVisibility",new v({graphicsCoreOwner:this})),"fullOpacity"in this.owner){const t=this.owner;this._updatingHandles.add((()=>t.fullOpacity),(()=>this.graphicsCore.opacityChange()))}if("elevationInfo"in t){const e=t;this._updatingHandles.add((()=>e.elevationInfo),((t,e)=>{u(t,e)&&this._updatingHandles.addPromise(this.graphicsCore.elevationInfoChange())}))}this._set("initializePromise",this._initializeAsync()),this._updatingHandles.addPromise(this.initializePromise)}async _initializeAsync(){try{await this.graphicsCore.initializePromise}catch(t){if(o(t))return;throw t}this.destroyed||(this.addHandles(a((()=>this.view.clippingArea),(()=>this._updateClippingExtent()),l)),this._updateClippingExtent(),this._setupSuspendResumeExtent(),this.graphicsCore.startCreateGraphics())}destroy(){this.removeAllHandles(),this._updatingHandles.destroy(),this._set("frustumVisibility",n(this.frustumVisibility)),this._set("graphicsCore",n(this.graphicsCore))}get layer(){return this.owner.layer}get view(){return this.owner.view}get scaleVisibility(){return this.graphicsCore?.scaleVisibility}get elevationAlignment(){return this.graphicsCore?.elevationAlignment}get objectStates(){return this.graphicsCore?.objectStates}get scaleVisibilitySuspended(){return!(null==this.scaleVisibility||!this.scaleVisibility.suspended)}get frustumVisibilitySuspended(){return null!=this.frustumVisibility&&this.frustumVisibility.suspended}get suspended(){return this.owner.suspended??!1}get updating(){return!!(this.graphicsCore?.updating||null!=this.scaleVisibility&&this.scaleVisibility.updating||null!=this.frustumVisibility&&this.frustumVisibility.updating||this._updatingHandles.updating)}get graphics3DGraphics(){return this.graphicsCore?.graphics3DGraphics}get graphics3DGraphicsByObjectID(){return this.graphicsCore?.graphics3DGraphicsByObjectID}get loadedGraphics(){return this.owner.loadedGraphics}get fullOpacity(){return this.owner.fullOpacity??1}get slicePlaneEnabled(){return this.owner.slicePlaneEnabled}get updatePolicy(){return this.owner.updatePolicy}notifyGraphicGeometryChanged(t){this.graphicsCore.notifyGraphicGeometryChanged(t)}notifyGraphicVisibilityChanged(t){this.graphicsCore.notifyGraphicVisibilityChanged(t)}getRenderingInfo(t,e,i){const s=m(t,{renderer:e,arcade:i});if(null!=s&&s.color){const t=s.color;t[0]=t[0]/255,t[1]=t[1]/255,t[2]=t[2]/255}return s}getRenderingInfoAsync(t,e,i,s){return f(t,{renderer:e,arcade:i,...s})}getHit(t){if(this.owner.loadedGraphics){const e=this.owner.loadedGraphics.find((e=>e.uid===t));if(e){const t=this.layer instanceof y?this.layer:null,i=g(e,t);return{type:"graphic",graphic:i,layer:i.layer}}}return null}whenGraphicBounds(t,e){return this.graphicsCore?this.graphicsCore.whenGraphicBounds(t,e):Promise.reject()}computeAttachmentOrigin(t,e){return this.graphicsCore?this.graphicsCore.computeAttachmentOrigin(t,e):null}getSymbolLayerSize(t,e){return this.graphicsCore?this.graphicsCore.getSymbolLayerSize(t,e):null}maskOccludee(t){const{set:e,handle:i}=this.objectStates.acquireSet(_.MaskOccludee,null);return this.objectStates.setUid(e,t.uid),i}highlight(t){if(t instanceof b)return P;if("number"==typeof t)return this.highlight([t]);if(t instanceof e)return this.highlight([t]);if(t instanceof s&&(t=t.toArray()),Array.isArray(t)&&t.length>0){if(t[0]instanceof e){const e=t.map((t=>t.uid)),{set:i,handle:s}=this.objectStates.acquireSet(_.Highlight,null);return this.objectStates.setUids(i,e),s}if("number"==typeof t[0]){const e=t,{set:i,handle:s}=this.objectStates.acquireSet(_.Highlight,null);return this.objectStates.setObjectIds(i,e),s}}return P}_setupSuspendResumeExtent(){const{scaleVisibility:t,frustumVisibility:e}=this;if(null==t&&null==e)return;const i=({computedExtent:i,extentPadding:s})=>{this._suspendResumeExtent=G(i,this._suspendResumeExtent,j,s),null!=t&&t.setExtent(this._suspendResumeExtent),null!=e&&e.setExtent(this._suspendResumeExtent)};this.addHandles(a((()=>({computedExtent:this.graphicsCore?.computedExtent,extentPadding:this.graphicsCore?.extentPadding})),(t=>i(t)),p))}_updateClippingExtent(){const t=this.view.clippingArea;this.graphicsCore.setClippingExtent(t,this.view.spatialReference)&&this.graphicsCore.recreateAllGraphics()}};t([c()],O.prototype,"type",void 0),t([c({constructOnly:!0})],O.prototype,"owner",void 0),t([c()],O.prototype,"layer",null),t([c()],O.prototype,"view",null),t([c({constructOnly:!0})],O.prototype,"graphicsCore",void 0),t([c()],O.prototype,"scaleVisibility",null),t([c({constructOnly:!0})],O.prototype,"frustumVisibility",void 0),t([c()],O.prototype,"elevationAlignment",null),t([c()],O.prototype,"objectStates",null),t([c()],O.prototype,"scaleVisibilitySuspended",null),t([c({readOnly:!0})],O.prototype,"frustumVisibilitySuspended",null),t([c()],O.prototype,"suspended",null),t([c({readOnly:!0})],O.prototype,"updating",null),t([c()],O.prototype,"loadedGraphics",null),t([c()],O.prototype,"fullOpacity",null),t([c()],O.prototype,"slicePlaneEnabled",null),t([c()],O.prototype,"drapeSourceType",void 0),t([c()],O.prototype,"updatePolicy",null),t([c({constructOnly:!0})],O.prototype,"scaleVisibilityEnabled",void 0),t([c({constructOnly:!0})],O.prototype,"frustumVisibilityEnabled",void 0),t([c()],O.prototype,"initializePromise",void 0),O=t([h("esri.views.3d.layers.graphics.GraphicsProcessor")],O);const P=r();export{O as GraphicsProcessor};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{forEach as s,result as l}from"../../../../core/asyncUtils.js";import i from"../../../../core/Logger.js";import{someMap as a}from"../../../../core/MapUtils.js";import{disposeMaybe as r,abortMaybe as o}from"../../../../core/maybe.js";import{throwIfAborted as n,isAbortError as c}from"../../../../core/promiseUtils.js";import{watch as h}from"../../../../core/reactiveUtils.js";import{property as b}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{hydrateGraphic as p}from"../../../../layers/graphics/hydratedFeatures.js";import{createLabelFunction as u}from"../../../../layers/support/labelFormatUtils.js";import{hasCalloutSupport as y}from"../../../../symbols/callouts/calloutUtils.js";import{CreateLabelParameters as g}from"./CreateLabelParameters.js";import{VisibilityGroup as f,VisibilityFlag as m}from"./enums.js";import{make as _}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutSymbolLayerRenderingInfo as C,LineCalloutCreationContext as x}from"./Graphics3DLineCalloutSymbolLayer.js";import{getGraphics3DSymbol as L}from"./graphicSymbolUtils.js";import{get as v}from"./labelPlacement.js";import{horizontalPlacementFromAnchor as T,verticalPlacementFromAnchor as A,textRenderAlignmentFromHorizontalPlacement as D}from"./placementUtils.js";import{MaterialCollection as G}from"../../webgl-engine/lib/MaterialCollection.js";import{TextRenderer as w}from"../../webgl-engine/lib/TextRenderer.js";import{TextRenderParameters as I}from"../../webgl-engine/lib/TextRenderParameters.js";import{TextTextureAtlas as R}from"../../webgl-engine/lib/TextTextureAtlas.js";import{WebGLLayer as P}from"../../webgl-engine/lib/WebGLLayer.js";import{TaskPriority as S,Task as j}from"../../../support/Scheduler.js";class O{constructor(e,t){this.labelingContext=e,this.graphics3DGraphic=t,this.hasGraphics3DResources=!1,this.visible=!1,this.rendered=!1,this.textInitialized=!1,this.textRenderers=new Array,this.textLabelPlacements=new Array}}class E{constructor(e,t,s,l,i){this.labelClass=e,this.graphics3DSymbol=t,this.graphics3DCalloutSymbolLayer=s,this.textRenderParameters=l,this.labelFunction=i,this.calloutSymbolLayerIndex=0}}class z{constructor(e,t,s,l,i,a,r,o){this.layer=t,this.graphics3DCore=s,this.scaleVisibility=l,this.emptySymbolLabelSupported=i,this.elevationInfoOverride=a,this.disablePlacement=r,this.active=o,this.labelClassAbortController=new AbortController,this.labelClassContexts=new Array,this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new P(e,{pickable:!0,disableOctree:!0},t.uid)}destroy(){this.stageLayer.destroy()}}let M=class extends t{constructor(e){super(e),this._dirty=!1,this._labels=new Map,this._labelsToAdd=new Map,this._labelsToRemove=new Map,this._labelingContexts=new Array}setup(){this.dispose(),this.addHandles([h((()=>this.view.state?.camera),(()=>this.setDirty())),h((()=>this.view.state?.rasterPixelRatio),(()=>this._resetAllLabels())),this.view.resourceController.scheduler.registerTask(S.LABELER,this)]),this._textTextureAtlas=new R({view:this.view}),this._hudMaterialCollection=new G(this.view._stage),this._calloutMaterialCollection=new G(this.view._stage)}dispose(){this.removeAllHandles(),this._textTextureAtlas=r(this._textTextureAtlas),this._hudMaterialCollection=r(this._hudMaterialCollection),this._calloutMaterialCollection=r(this._calloutMaterialCollection),this._labelingContexts.length=0,this._labels.clear(),this._labelsToAdd.clear(),this._labelsToRemove.clear()}destroy(){this.dispose(),k.graphic=null,k.renderingInfo=null,k.layer=null}_activateLabelingContext(e){e.graphics.forEach(((t,s)=>{const l=new O(e,t);this._labels.set(s,l),e.labelsToInitialize.set(s,l),t.setVisibilityFlag(f.LABEL,m.USER,!0)})),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach(((e,t)=>{e.setVisibilityFlag(f.LABEL,m.USER,!1),this.setLabelGraphicVisibility(e,!1),this._labels.delete(t)})),e.active=!1}_addLabelTextureToAtlas(e){for(const t of e.graphics3DGraphic.labelLayers){if(!t._labelClass)continue;const s=e.textRenderers[t._labelIndex];s&&this._textTextureAtlas.addTextTexture(s,t.stageObject)}e.rendered=!0}_removeLabelTextureFromAtlas(e){for(const t of e.graphics3DGraphic.labelLayers){if(!t._labelClass)continue;const s=e.textRenderers[t._labelIndex];null!=s&&this._textTextureAtlas.removeTextTexture(s,t.stageObject)}e.rendered=!1}get running(){return this.view.ready&&(this._dirty||this.deconflictor.running)}runTask(e){return this._updateLabels(e),!this._dirty&&this.deconflictor.running&&this.deconflictor.runTask(e),j.YIELD}_updateLabels(e){if(this._dirty){this._dirty=!1;for(const t of this._labelingContexts)if(t.active)if(V(t))this._dirty=!0;else if(F(t.labelClassContexts)){if(null===t.labelClassContexts){this._deactivateLabelingContext(t);continue}this._createLabelClassContext(t),this._dirty=!0}else a(t.labelsToInitialize,((s,l)=>(this._ensureGraphics3DResources(s)&&(this._labels.set(l,s),this.deconflictor.setDirty(),e.madeProgress()),(s.visible&&s.textInitialized||!s.visible&&s.hasGraphics3DResources)&&(t.labelsToInitialize.delete(l),e.madeProgress()),e.done)))&&(this._dirty=!0);this._labelsToRemove.forEach((e=>this._removeLabelTextureFromAtlas(e))),this._labelsToAdd.forEach((e=>this._addLabelTextureToAtlas(e))),this._labelsToRemove.clear(),this._labelsToAdd.clear(),this._dirty||this.notifyChange("updating")}}async _createLabelClassContextAsync(e){const t=e.labelClassAbortController?.signal;await(e.layer.when?.()),n(t),e.scaleVisibility&&e.scaleVisibility.updateScaleRangeActive();const a=e.graphics3DCore,r=a.layer,o=r.labelingInfo&&r.labelingInfo.filter((e=>!!e.symbol));if(!o||0===o.length)return;let c=!1;await s(o,(async(s,r)=>{const o=s.symbol,h=L(a.getOrCreateGraphics3DSymbol(o));if(null==h)return void i.getLogger(this).error("Failed to create Graphics3DSymbol for label");await h.load(),n(t);let b=null;y(o)&&o.hasVisibleCallout()&&(b=_(o,a.symbolCreationContext),await b.load(),n(t));const d=await l(u(s,e.layer.fieldsIndex,this.view.spatialReference));if(n(t),!0===d.ok){const l=await this._createTextRenderParameters(h.symbol);n(t),e.labelClassContexts[r]=new E(s,h,b,l,d.value)}else i.getLogger(this).error(`Label expression failed to evaluate: ${d.error}`),c=!0})),n(t)}async _createLabelClassContext(e){return null==e.labelClassPromise&&(e.labelClassPromise=this._createLabelClassContextAsync(e).catch((t=>{if(c(t))throw t;e.labelClassContexts.length=0})).then((()=>{e.labelClassAbortController=null,this.notifyChange("updating")})).catch((()=>{})),this.notifyChange("updating")),e.labelClassPromise}async _createTextRenderParameters(e){const t=e.symbolLayers.at(0);return"text"!==t?.type?null:I.fromSymbol(t,this.view.state.rasterPixelRatio)}_destroyLabelClassContext(e){for(const s of e.labelClassContexts)--s.graphics3DSymbol.referenced;const t=e.labelClassAbortController;e.labelClassAbortController=new AbortController,o(t),e.labelClassContexts.length=0,e.labelClassPromise=null,this.notifyChange("updating")}_createTextSymbolGraphic(e,t,s,l,i){const a=new g(s.verticalOffset,T(s.anchor),A(s.anchor),e.text,s.translation,s.elevationOffset,s.centerOffset,s.screenOffset,s.centerOffsetUnits,e.displayWidth,e.displayHeight);return k.graphic=t,k.renderingInfo=null,k.layer=l,i.createLabel(k,a,this._hudMaterialCollection,this._textTextureAtlas)}_createLineCalloutGraphic(e,t,s,l,i){return k.graphic=e,k.layer=i,k.renderingInfo=new C(null,t,l.translation,l.centerOffset,l.screenOffset,l.centerOffsetUnits,l.elevationOffset,this._calloutMaterialCollection),s.createGraphics3DGraphic(k)}_ensureGraphics3DResources(e){if(e.hasGraphics3DResources)return!1;const t=e.graphics3DGraphic;if(t.destroyed)return!1;this._ensureTextTextureResources(e);const s=e.labelingContext,l=s.labelClassContexts;if(F(l)||!s.emptySymbolLabelSupported&&0===t.layers.length)return!1;let i=!1;const a=t.graphic,r=s.layer,o=U(s.layer);for(let n=0;n<l.length;n++){const c=e.textRenderers[n],h=e.textLabelPlacements[n];if(null==c||null==h)continue;const b=l[n],d=b.graphics3DSymbol,p=d.symbol&&"label-3d"===d.symbol.type?d.symbol:null,u=d.symbolLayers[0];if(!u)continue;u.setElevationInfoOverride(s.elevationInfoOverride);const y=this._createTextSymbolGraphic(c,a,h,r,u);if(null==y)return!1;y._labelClass=b.labelClass,y._labelIndex=n,t.addLabelGraphic(y,s.stageLayer),t.deconflictionPriority=b.textRenderParameters?.definition.size??0,t.setVisibilityFlag(f.LABEL,m.USER,o),t.setVisibilityFlag(f.LABEL,m.SCALE_RANGE,!0),t.setVisibilityFlag(f.LABEL,m.DECONFLICTION,!1),i=!0;const g=b.graphics3DCalloutSymbolLayer;if(g&&h.hasLabelVerticalOffset){g.setElevationInfoOverride(s.elevationInfoOverride);const e=this._createLineCalloutGraphic(a,p,g,h,r);null!=e&&(b.calloutSymbolLayerIndex=t.labelLayers.length,t.addLabelGraphic(e,s.stageLayer))}break}return s.scaleVisibility&&i&&s.scaleVisibility.updateGraphicLabelScaleVisibility(t),e.hasGraphics3DResources=!0,!0}_destroyGraphics3DResources(e){const t=e.labelingContext.labelClassContexts;for(const s of e.graphics3DGraphic.labelLayers){if(null==s._labelClass)continue;const e=t[s._labelIndex].graphics3DSymbol.symbolLayers[0];null!=e&&e.onRemoveGraphic(s)}e.graphics3DGraphic.deconflictionPriority=0,e.graphics3DGraphic.clearLabelGraphics(),e.hasGraphics3DResources=!1}_ensureTextTextureResources(e){if(e.textInitialized)return;const t=e.labelingContext,s=t.labelClassContexts;if(F(s))return;const l=e.graphics3DGraphic.graphic;for(let a=0;a<s.length;a++){const r=s[a];if(e.textRenderers[a]=null,e.textLabelPlacements[a]=null,null==r?.textRenderParameters)continue;const o=r.labelFunction;let n;if("arcade"===o.type)try{const e=o.needsHydrationToEvaluate()?p(l,t.layer):l;n=o.evaluate(e)}catch(i){n=null}else n=o.evaluate(l);if(null==n||""===n||/^\s+$/.test(n))continue;const c=r.graphics3DSymbol,h="label-3d"===c.symbol?.type?c.symbol:null;if(!c.symbolLayers[0])continue;const b=e.graphics3DGraphic,d=r.labelClass,u=t.disablePlacement,y=v({graphics3DGraphic:b,labelSymbol:h,labelClass:d,disablePlacement:u});if(null==y)continue;const g=T(y.anchor),f=D(g);e.textRenderers[a]=new w(n,f,r.textRenderParameters),e.textLabelPlacements[a]=y}e.textInitialized=!0}_destroyTextTextureResources(e){e.textInitialized=!1,e.textRenderers.length=0,e.textLabelPlacements.length=0}_addGraphic(e,t){const s=t.graphic.uid;if(e.graphics.set(s,t),e.active){const l=new O(e,t);this._labels.set(s,l),e.labelsToInitialize.set(s,l)}this.setDirty(),this.deconflictor.setDirty()}_removeGraphic(e,t){const s=t.graphic.uid,l=this._labels.get(s);e.graphics.delete(s),l&&(this._destroyGraphic(l,s),e.labelsToInitialize.delete(s),this.setDirty(),this.deconflictor.setDirty())}_destroyGraphic(e,t){this._labels.has(t)&&(this._labels.delete(t),this._labelsToAdd.delete(t),this._labelsToRemove.delete(t)),e.textInitialized&&(this._removeLabelTextureFromAtlas(e),this._destroyTextTextureResources(e)),e.hasGraphics3DResources&&this._destroyGraphics3DResources(e)}async _labelingInfoChange(e,t){if(!t)return this._visibilityInfoChange(e),this._resetLabels(e),this._createLabelClassContext(e);for(const s of t){const t=e.graphics.get(s);t&&(this._removeGraphic(e,t),this._addGraphic(e,t))}}_globalPropertyChanged(e,t){for(const s of t.labelClassContexts){const l=new Map;t.graphics.forEach((e=>l.set(e.graphic.uid,e)));const i=e=>e.labelLayers[0];if(s.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,l,i),s.graphics3DCalloutSymbolLayer){const t=e=>e.labelLayers[s.calloutSymbolLayerIndex];s.graphics3DCalloutSymbolLayer.globalPropertyChanged(e,l,t)}}}_visibilityInfoChange(e){const t=U(e.layer);t&&!e.active&&this._activateLabelingContext(e),!t&&e.active&&this._deactivateLabelingContext(e),this.setDirty()}_resetAllLabels(){for(const e of this._labelingContexts)this._resetLabels(e)}_resetLabels(e){e.graphics.forEach(((t,s)=>{const l=this._labels.get(s);l&&(this._destroyGraphic(l,s),l.visible=!1,l.rendered=!1,e.labelsToInitialize.set(s,l))})),this._destroyLabelClassContext(e),this.setDirty(),this.deconflictor.setDirty()}_findLabelingContext(e){for(const t of this._labelingContexts)if(t.graphics3DCore===e)return t;return null}addGraphicsOwner(e,t,s){const l=s&&s.emptySymbolLabelSupported||!1,i=s&&s.elevationInfoOverride||null,a=s&&s.disablePlacement||null;if(this._findLabelingContext(e))return;const r=e.layer,o=new z(this.view._stage,r,e,t,l,i,a,U(r));return this._labelingContexts.push(o),this.setDirty(),{addGraphic:e=>this._addGraphic(o,e),removeGraphic:e=>this._removeGraphic(o,e),featureReductionChange:()=>{},layerLabelsEnabled:()=>U(o.layer),labelingInfoChange:e=>this._labelingInfoChange(o,e),elevationInfoChange:()=>this._globalPropertyChanged("elevationInfo",o),slicePlaneEnabledChange:()=>this._globalPropertyChanged("slicePlaneEnabled",o),visibilityInfoChange:()=>this._visibilityInfoChange(o),reset:()=>this._resetLabels(o),clear:()=>{}}}removeGraphicsOwner(e){const t=this._findLabelingContext(e);if(!t)return;const s=this._labelingContexts.indexOf(t);this._labelingContexts.splice(s,1),t.graphics.forEach((e=>this._removeGraphic(t,e))),t.destroy(),this.setDirty()}setLabelGraphicVisibility(e,t){const s=e.graphic.uid,l=this._labels.get(s);l&&l.visible!==t&&(t&&!l.rendered?(this._labelsToAdd.set(s,l),this._labelsToRemove.delete(s),l.textInitialized||l.labelingContext.labelsToInitialize.set(s,l)):!t&&l.rendered&&(this._labelsToRemove.set(s,l),this._labelsToAdd.delete(s)),l.visible=t,this.setDirty())}setDirty(){!this._dirty&&this._labelingContexts.length>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._dirty||this._textTextureAtlas?.updating||this.deconflictor.updating||this._labelingContexts.some((e=>V(e)))}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;const e=this._labelingContexts.length>0?this._labelingContexts.reduce(((e,t)=>e+(V(t)?0:1)),0)/this._labelingContexts.length:1;return(this._dirty?0:.3)+(this._textTextureAtlas.updating?0:.1)+.1*e+.5*this.deconflictor.updatingProgress}get test(){return{textTextureAtlas:this._textTextureAtlas,resetAllLabels:()=>this._resetAllLabels()}}};function V(e){return!!e.labelClassPromise&&!!e.labelClassAbortController}function F(e){return!e||0===e.length}function U(e){return!0===e.labelsVisible&&!!e.labelingInfo?.some((e=>!!e.symbol))}e([b({constructOnly:!0})],M.prototype,"view",void 0),e([b({constructOnly:!0})],M.prototype,"deconflictor",void 0),e([b()],M.prototype,"_textTextureAtlas",void 0),e([b({type:Boolean,readOnly:!0})],M.prototype,"updating",null),M=e([d("esri.views.3d.layers.graphics.Labeler")],M);const k=new x(null,null,null);export{M as Labeler,U as areLabelsVisible};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{forEach as s,result as l}from"../../../../core/asyncUtils.js";import i from"../../../../core/Logger.js";import{someMap as a}from"../../../../core/MapUtils.js";import{disposeMaybe as r,abortMaybe as o}from"../../../../core/maybe.js";import{throwIfAborted as n,isAbortError as c}from"../../../../core/promiseUtils.js";import{watch as h}from"../../../../core/reactiveUtils.js";import{property as b}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{hydrateGraphic as p}from"../../../../layers/graphics/hydratedFeatures.js";import{createLabelFunction as u}from"../../../../layers/support/labelFormatUtils.js";import{hasCalloutSupport as y}from"../../../../symbols/callouts/calloutUtils.js";import{CreateLabelParameters as g}from"./CreateLabelParameters.js";import{VisibilityGroup as f,VisibilityFlag as m}from"./enums.js";import{make as _}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutSymbolLayerRenderingInfo as C,LineCalloutCreationContext as x}from"./Graphics3DLineCalloutSymbolLayer.js";import{getGraphics3DSymbol as L}from"./graphicSymbolUtils.js";import{getLabelPlacement as v}from"./labelPlacement.js";import{horizontalPlacementFromAnchor as T,verticalPlacementFromAnchor as A,textRenderAlignmentFromHorizontalPlacement as D}from"./placementUtils.js";import{MaterialCollection as G}from"../../webgl-engine/lib/MaterialCollection.js";import{TextRenderer as w}from"../../webgl-engine/lib/TextRenderer.js";import{TextRenderParameters as I}from"../../webgl-engine/lib/TextRenderParameters.js";import{TextTextureAtlas as R}from"../../webgl-engine/lib/TextTextureAtlas.js";import{WebGLLayer as P}from"../../webgl-engine/lib/WebGLLayer.js";import{TaskPriority as S,Task as j}from"../../../support/Scheduler.js";class O{constructor(e,t){this.labelingContext=e,this.graphics3DGraphic=t,this.hasGraphics3DResources=!1,this.visible=!1,this.rendered=!1,this.textInitialized=!1,this.textRenderers=new Array,this.textLabelPlacements=new Array}}class E{constructor(e,t,s,l,i){this.labelClass=e,this.graphics3DSymbol=t,this.graphics3DCalloutSymbolLayer=s,this.textRenderParameters=l,this.labelFunction=i,this.calloutSymbolLayerIndex=0}}class z{constructor(e,t,s,l,i,a,r,o){this.layer=t,this.graphics3DCore=s,this.scaleVisibility=l,this.emptySymbolLabelSupported=i,this.elevationInfoOverride=a,this.disablePlacement=r,this.active=o,this.labelClassAbortController=new AbortController,this.labelClassContexts=new Array,this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new P(e,{pickable:!0,disableOctree:!0},t.uid)}destroy(){this.stageLayer.destroy()}}let M=class extends t{constructor(e){super(e),this._dirty=!1,this._labels=new Map,this._labelsToAdd=new Map,this._labelsToRemove=new Map,this._labelingContexts=new Array}setup(){this.dispose(),this.addHandles([h((()=>this.view.state?.camera),(()=>this.setDirty())),h((()=>this.view.state?.rasterPixelRatio),(()=>this._resetAllLabels())),this.view.resourceController.scheduler.registerTask(S.LABELER,this)]),this._textTextureAtlas=new R({view:this.view}),this._hudMaterialCollection=new G(this.view._stage),this._calloutMaterialCollection=new G(this.view._stage)}dispose(){this.removeAllHandles(),this._textTextureAtlas=r(this._textTextureAtlas),this._hudMaterialCollection=r(this._hudMaterialCollection),this._calloutMaterialCollection=r(this._calloutMaterialCollection),this._labelingContexts.length=0,this._labels.clear(),this._labelsToAdd.clear(),this._labelsToRemove.clear()}destroy(){this.dispose(),k.graphic=null,k.renderingInfo=null,k.layer=null}_activateLabelingContext(e){e.graphics.forEach(((t,s)=>{const l=new O(e,t);this._labels.set(s,l),e.labelsToInitialize.set(s,l),t.setVisibilityFlag(f.LABEL,m.USER,!0)})),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach(((e,t)=>{e.setVisibilityFlag(f.LABEL,m.USER,!1),this.setLabelGraphicVisibility(e,!1),this._labels.delete(t)})),e.active=!1}_addLabelTextureToAtlas(e){for(const t of e.graphics3DGraphic.labelLayers){if(!t._labelClass)continue;const s=e.textRenderers[t._labelIndex];s&&this._textTextureAtlas.addTextTexture(s,t.stageObject)}e.rendered=!0}_removeLabelTextureFromAtlas(e){for(const t of e.graphics3DGraphic.labelLayers){if(!t._labelClass)continue;const s=e.textRenderers[t._labelIndex];null!=s&&this._textTextureAtlas.removeTextTexture(s,t.stageObject)}e.rendered=!1}get running(){return this.view.ready&&(this._dirty||this.deconflictor.running)}runTask(e){return this._updateLabels(e),!this._dirty&&this.deconflictor.running&&this.deconflictor.runTask(e),j.YIELD}_updateLabels(e){if(this._dirty){this._dirty=!1;for(const t of this._labelingContexts)if(t.active)if(V(t))this._dirty=!0;else if(F(t.labelClassContexts)){if(null===t.labelClassContexts){this._deactivateLabelingContext(t);continue}this._createLabelClassContext(t),this._dirty=!0}else a(t.labelsToInitialize,((s,l)=>(this._ensureGraphics3DResources(s)&&(this._labels.set(l,s),this.deconflictor.setDirty(),e.madeProgress()),(s.visible&&s.textInitialized||!s.visible&&s.hasGraphics3DResources)&&(t.labelsToInitialize.delete(l),e.madeProgress()),e.done)))&&(this._dirty=!0);this._labelsToRemove.forEach((e=>this._removeLabelTextureFromAtlas(e))),this._labelsToAdd.forEach((e=>this._addLabelTextureToAtlas(e))),this._labelsToRemove.clear(),this._labelsToAdd.clear(),this._dirty||this.notifyChange("updating")}}async _createLabelClassContextAsync(e){const t=e.labelClassAbortController?.signal;await(e.layer.when?.()),n(t),e.scaleVisibility&&e.scaleVisibility.updateScaleRangeActive();const a=e.graphics3DCore,r=a.layer,o=r.labelingInfo&&r.labelingInfo.filter((e=>!!e.symbol));if(!o||0===o.length)return;let c=!1;await s(o,(async(s,r)=>{const o=s.symbol,h=L(a.getOrCreateGraphics3DSymbol(o));if(null==h)return void i.getLogger(this).error("Failed to create Graphics3DSymbol for label");await h.load(),n(t);let b=null;y(o)&&o.hasVisibleCallout()&&(b=_(o,a.symbolCreationContext),await b.load(),n(t));const d=await l(u(s,e.layer.fieldsIndex,this.view.spatialReference));if(n(t),!0===d.ok){const l=await this._createTextRenderParameters(h.symbol);n(t),e.labelClassContexts[r]=new E(s,h,b,l,d.value)}else i.getLogger(this).error(`Label expression failed to evaluate: ${d.error}`),c=!0})),n(t)}async _createLabelClassContext(e){return null==e.labelClassPromise&&(e.labelClassPromise=this._createLabelClassContextAsync(e).catch((t=>{if(c(t))throw t;e.labelClassContexts.length=0})).then((()=>{e.labelClassAbortController=null,this.notifyChange("updating")})).catch((()=>{})),this.notifyChange("updating")),e.labelClassPromise}async _createTextRenderParameters(e){const t=e.symbolLayers.at(0);return"text"!==t?.type?null:I.fromSymbol(t,this.view.state.rasterPixelRatio)}_destroyLabelClassContext(e){for(const s of e.labelClassContexts)--s.graphics3DSymbol.referenced;const t=e.labelClassAbortController;e.labelClassAbortController=new AbortController,o(t),e.labelClassContexts.length=0,e.labelClassPromise=null,this.notifyChange("updating")}_createTextSymbolGraphic(e,t,s,l,i){const a=new g(s.verticalOffset,T(s.anchor),A(s.anchor),e.text,s.translation,s.elevationOffset,s.centerOffset,s.screenOffset,s.centerOffsetUnits,e.displayWidth,e.displayHeight);return k.graphic=t,k.renderingInfo=null,k.layer=l,i.createLabel(k,a,this._hudMaterialCollection,this._textTextureAtlas)}_createLineCalloutGraphic(e,t,s,l,i){return k.graphic=e,k.layer=i,k.renderingInfo=new C(null,t,l.translation,l.centerOffset,l.screenOffset,l.centerOffsetUnits,l.elevationOffset,this._calloutMaterialCollection),s.createGraphics3DGraphic(k)}_ensureGraphics3DResources(e){if(e.hasGraphics3DResources)return!1;const t=e.graphics3DGraphic;if(t.destroyed)return!1;this._ensureTextTextureResources(e);const s=e.labelingContext,l=s.labelClassContexts;if(F(l)||!s.emptySymbolLabelSupported&&0===t.layers.length)return!1;let i=!1;const a=t.graphic,r=s.layer,o=U(s.layer);for(let n=0;n<l.length;n++){const c=e.textRenderers[n],h=e.textLabelPlacements[n];if(null==c||null==h)continue;const b=l[n],d=b.graphics3DSymbol,p=d.symbol&&"label-3d"===d.symbol.type?d.symbol:null,u=d.symbolLayers[0];if(!u)continue;u.setElevationInfoOverride(s.elevationInfoOverride);const y=this._createTextSymbolGraphic(c,a,h,r,u);if(null==y)return!1;y._labelClass=b.labelClass,y._labelIndex=n,t.addLabelGraphic(y,s.stageLayer),t.deconflictionPriority=b.textRenderParameters?.definition.size??0,t.setVisibilityFlag(f.LABEL,m.USER,o),t.setVisibilityFlag(f.LABEL,m.SCALE_RANGE,!0),t.setVisibilityFlag(f.LABEL,m.DECONFLICTION,!1),i=!0;const g=b.graphics3DCalloutSymbolLayer;if(g&&h.hasLabelVerticalOffset){g.setElevationInfoOverride(s.elevationInfoOverride);const e=this._createLineCalloutGraphic(a,p,g,h,r);null!=e&&(b.calloutSymbolLayerIndex=t.labelLayers.length,t.addLabelGraphic(e,s.stageLayer))}break}return s.scaleVisibility&&i&&s.scaleVisibility.updateGraphicLabelScaleVisibility(t),e.hasGraphics3DResources=!0,!0}_destroyGraphics3DResources(e){const t=e.labelingContext.labelClassContexts;for(const s of e.graphics3DGraphic.labelLayers){if(null==s._labelClass)continue;const e=t[s._labelIndex].graphics3DSymbol.symbolLayers[0];null!=e&&e.onRemoveGraphic(s)}e.graphics3DGraphic.deconflictionPriority=0,e.graphics3DGraphic.clearLabelGraphics(),e.hasGraphics3DResources=!1}_ensureTextTextureResources(e){if(e.textInitialized)return;const t=e.labelingContext,s=t.labelClassContexts;if(F(s))return;const l=e.graphics3DGraphic.graphic;for(let a=0;a<s.length;a++){const r=s[a];if(e.textRenderers[a]=null,e.textLabelPlacements[a]=null,null==r?.textRenderParameters)continue;const o=r.labelFunction;let n;if("arcade"===o.type)try{const e=o.needsHydrationToEvaluate()?p(l,t.layer):l;n=o.evaluate(e)}catch(i){n=null}else n=o.evaluate(l);if(null==n||""===n||/^\s+$/.test(n))continue;const c=r.graphics3DSymbol,h="label-3d"===c.symbol?.type?c.symbol:null;if(!c.symbolLayers[0])continue;const b=e.graphics3DGraphic,d=r.labelClass,u=t.disablePlacement,y=v({graphics3DGraphic:b,labelSymbol:h,labelClass:d,disablePlacement:u});if(null==y)continue;const g=T(y.anchor),f=D(g);e.textRenderers[a]=new w(n,f,r.textRenderParameters),e.textLabelPlacements[a]=y}e.textInitialized=!0}_destroyTextTextureResources(e){e.textInitialized=!1,e.textRenderers.length=0,e.textLabelPlacements.length=0}_addGraphic(e,t){const s=t.graphic.uid;if(e.graphics.set(s,t),e.active){const l=new O(e,t);this._labels.set(s,l),e.labelsToInitialize.set(s,l)}this.setDirty(),this.deconflictor.setDirty()}_removeGraphic(e,t){const s=t.graphic.uid,l=this._labels.get(s);e.graphics.delete(s),l&&(this._destroyGraphic(l,s),e.labelsToInitialize.delete(s),this.setDirty(),this.deconflictor.setDirty())}_destroyGraphic(e,t){this._labels.has(t)&&(this._labels.delete(t),this._labelsToAdd.delete(t),this._labelsToRemove.delete(t)),e.textInitialized&&(this._removeLabelTextureFromAtlas(e),this._destroyTextTextureResources(e)),e.hasGraphics3DResources&&this._destroyGraphics3DResources(e)}async _labelingInfoChange(e,t){if(!t)return this._visibilityInfoChange(e),this._resetLabels(e),this._createLabelClassContext(e);for(const s of t){const t=e.graphics.get(s);t&&(this._removeGraphic(e,t),this._addGraphic(e,t))}}_globalPropertyChanged(e,t){for(const s of t.labelClassContexts){const l=new Map;t.graphics.forEach((e=>l.set(e.graphic.uid,e)));const i=e=>e.labelLayers[0];if(s.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,l,i),s.graphics3DCalloutSymbolLayer){const t=e=>e.labelLayers[s.calloutSymbolLayerIndex];s.graphics3DCalloutSymbolLayer.globalPropertyChanged(e,l,t)}}}_visibilityInfoChange(e){const t=U(e.layer);t&&!e.active&&this._activateLabelingContext(e),!t&&e.active&&this._deactivateLabelingContext(e),this.setDirty()}_resetAllLabels(){for(const e of this._labelingContexts)this._resetLabels(e)}_resetLabels(e){e.graphics.forEach(((t,s)=>{const l=this._labels.get(s);l&&(this._destroyGraphic(l,s),l.visible=!1,l.rendered=!1,e.labelsToInitialize.set(s,l))})),this._destroyLabelClassContext(e),this.setDirty(),this.deconflictor.setDirty()}_findLabelingContext(e){for(const t of this._labelingContexts)if(t.graphics3DCore===e)return t;return null}addGraphicsOwner(e,t,s){const l=s&&s.emptySymbolLabelSupported||!1,i=s&&s.elevationInfoOverride||null,a=s&&s.disablePlacement||null;if(this._findLabelingContext(e))return;const r=e.layer,o=new z(this.view._stage,r,e,t,l,i,a,U(r));return this._labelingContexts.push(o),this.setDirty(),{addGraphic:e=>this._addGraphic(o,e),removeGraphic:e=>this._removeGraphic(o,e),featureReductionChange:()=>{},layerLabelsEnabled:()=>U(o.layer),labelingInfoChange:e=>this._labelingInfoChange(o,e),elevationInfoChange:()=>this._globalPropertyChanged("elevationInfo",o),slicePlaneEnabledChange:()=>this._globalPropertyChanged("slicePlaneEnabled",o),visibilityInfoChange:()=>this._visibilityInfoChange(o),reset:()=>this._resetLabels(o),clear:()=>{}}}removeGraphicsOwner(e){const t=this._findLabelingContext(e);if(!t)return;const s=this._labelingContexts.indexOf(t);this._labelingContexts.splice(s,1),t.graphics.forEach((e=>this._removeGraphic(t,e))),t.destroy(),this.setDirty()}setLabelGraphicVisibility(e,t){const s=e.graphic.uid,l=this._labels.get(s);l&&l.visible!==t&&(t&&!l.rendered?(this._labelsToAdd.set(s,l),this._labelsToRemove.delete(s),l.textInitialized||l.labelingContext.labelsToInitialize.set(s,l)):!t&&l.rendered&&(this._labelsToRemove.set(s,l),this._labelsToAdd.delete(s)),l.visible=t,this.setDirty())}setDirty(){!this._dirty&&this._labelingContexts.length>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._dirty||this._textTextureAtlas?.updating||this.deconflictor.updating||this._labelingContexts.some((e=>V(e)))}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;const e=this._labelingContexts.length>0?this._labelingContexts.reduce(((e,t)=>e+(V(t)?0:1)),0)/this._labelingContexts.length:1;return(this._dirty?0:.3)+(this._textTextureAtlas.updating?0:.1)+.1*e+.5*this.deconflictor.updatingProgress}get test(){return{textTextureAtlas:this._textTextureAtlas,resetAllLabels:()=>this._resetAllLabels()}}};function V(e){return!!e.labelClassPromise&&!!e.labelClassAbortController}function F(e){return!e||0===e.length}function U(e){return!0===e.labelsVisible&&!!e.labelingInfo?.some((e=>!!e.symbol))}e([b({constructOnly:!0})],M.prototype,"view",void 0),e([b({constructOnly:!0})],M.prototype,"deconflictor",void 0),e([b()],M.prototype,"_textTextureAtlas",void 0),e([b({type:Boolean,readOnly:!0})],M.prototype,"updating",null),M=e([d("esri.views.3d.layers.graphics.Labeler")],M);const k=new x(null,null,null);export{M as Labeler,U as areLabelsVisible};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../core/has.js";import e from"../../../../core/Logger.js";import{a as t}from"../../../../chunks/vec2f64.js";import{s as n,l as r}from"../../../../chunks/vec3.js";import{f as l,c as a}from"../../../../chunks/vec3f64.js";import{f as c}from"../../../../chunks/vec4f64.js";import{create as s,center as o,height as i}from"../../../../geometry/support/aaBoundingBox.js";import{getGraphics3DSymbol as f}from"./graphicSymbolUtils.js";import{HUDMaterial as u}from"../../webgl-engine/materials/HUDMaterial.js";const m=e.getLogger("esri.views.3d.layers.graphics.labelPlacement");function p(e){const n=j(e);if(null==n)return null;const r=h(e,n);if(null==r)return null;const l=r.anchor,s=!!n.hasLabelVerticalOffset;return v({anchor:l,verticalOffset:n.verticalOffset,screenOffset:t(),centerOffset:c(0,0,0,-1),centerOffsetUnits:"world",translation:a(),elevationOffset:0,hasLabelVerticalOffset:s},r,e)}function h(e,t){if(t.anchor)return t;const n=e.labelClass.labelPlacement,r=k[n],l=r||d(e);return n&&!r&&m.warnOncePerTick(`the requested label placement '${n}' is currently unsupported in SceneView.`),g(l,e)}function b(e){const t=e.graphics3DGraphic.graphics3DSymbol,n=f(t);return null!=n?n.symbol.symbolLayers.at(0):null}function g(e,t){const n=t.graphics3DGraphic.graphic.geometry;if(null==n)return null;if(null!=t.disablePlacement){return t.labelClass.labelPlacement?(m.warnOncePerTick(O(e?.placement,t.disablePlacement.logEntityDescription)),d(t)):e}const r=n.type;switch(r){case"polyline":case"polygon":case"extent":case"multipoint":if(t.labelClass.labelPlacement)return m.warnOncePerTick(O(e?.placement,`'${r}' geometries`)),d(t);break;case"point":case"mesh":return e}return e}function O(e,t){return`the requested label placement '${e}' is currently unsupported for ${t} in SceneView.`}function d(e){const t=e.graphics3DGraphic.graphic.geometry;if(null==t)return null;switch(t.type){case"polyline":case"extent":case"multipoint":return{placement:"center-center",normalizedOffset:null,anchor:"center"};case"polygon":{const t=b(e);return null!=t&&"extrude"===t.type?k["above-center"]:{placement:"center-center",normalizedOffset:null,anchor:"center"}}case"point":case"mesh":return k["above-center"];default:return}}function v(e,t,n){const r=n.graphics3DGraphic.graphic.geometry;if(null==r)return null;switch(r.type){case"point":P(e,t,n);break;case"polygon":y(e,t,n);break;case"mesh":z(e,t,n.graphics3DGraphic.layers[0])}return e}function y(e,t,r){const l=b(r);if(null!=l)switch(l.type){case"extrude":{const l=r.graphics3DGraphic.layers[0];null!=l?(l.getBoundingBoxObjectSpace(x),o(x,e.translation),e.translation[2]=i(x)/2):n(e.translation,0,0,0),z(e,t,l);break}}}function P(e,t,r){const l=b(r);if(null==l)return;const a=r.graphics3DGraphic.layers[0];switch(null!=a?a.getCenterObjectSpace(e.translation):n(e.translation,0,0,0),l.type){case"icon":case"text":w(e,t,r,a);break;case"object":z(e,t,a)}}function w(e,t,n,r){const{graphics3DGraphic:l}=n,a=null!=r?r.getScreenSize():null;if(l.isDraped||null==a)e.hasLabelVerticalOffset||"center"===e.anchor||(k[n.labelClass.labelPlacement]&&m.warnOncePerTick(`the requested placement '${t.placement}' is currently unsupported for draped graphics`),e.anchor="center");else{const r=L(n);e.screenOffset[0]=a[0]/2*(t.normalizedOffset[0]-r[0]);const l=a[1]/2*(t.normalizedOffset[1]-r[1]);e.hasLabelVerticalOffset?(e.centerOffset[1]=l,e.centerOffsetUnits="screen"):e.screenOffset[1]=l}}function L(e,t=V){const{graphics3DGraphic:n}=e,r=n.layers[0],l=null!=r?r.stageObject.geometries[0].material:null;if(l&&l instanceof u){const e=l.parameters.anchorPosition;t[0]=2*(e[0]-.5),t[1]=2*(e[1]-.5)}else t[0]=0,t[1]=0;return t}function z(e,t,n){const a=null!=n?n.getBoundingBoxObjectSpace(x):x,c=l(a[3]-a[0],a[4]-a[1],a[5]-a[2]),s=Math.sqrt(c[0]*c[0]+c[1]*c[1]);e.centerOffset[0]=s/2*t.normalizedOffset[0];const o=e.translation[2],i=c[2]/2*t.normalizedOffset[1];e.translation[2]=0,e.elevationOffset=o+i;const f=r(c);e.centerOffset[2]=f/2*t.normalizedOffset[2]}function S(e){return"above-center"===e}function j(e){const t=e.labelClass.labelPlacement,{labelSymbol:n,graphics3DGraphic:r}=e,l=f(r.graphics3DSymbol),a="point-3d"===l?.symbol.type?l.symbol:null,c=k[t]||d(e);return null!=a&&a.supportsCallout()&&a.hasVisibleVerticalOffset()&&!r.isDraped?{placement:null,hasLabelVerticalOffset:!1,verticalOffset:D(a.verticalOffset),anchor:null,normalizedOffset:null}:!n||!n.hasVisibleVerticalOffset()||null!=a&&a.supportsCallout()&&a.verticalOffset&&!r.isDraped?{placement:null,verticalOffset:null,anchor:null,normalizedOffset:null,hasLabelVerticalOffset:!1}:c&&S(c.placement)?{placement:"above-center",verticalOffset:D(n.verticalOffset),anchor:"bottom",normalizedOffset:[0,c.normalizedOffset[1],0],hasLabelVerticalOffset:!0}:(m.errorOncePerTick("Callouts and vertical offset on labels are currently only supported with 'above-center' label placement (not with "+t+" placement)"),null)}function D(e){const{screenLength:t,minWorldLength:n,maxWorldLength:r}=e;return{screenLength:t,minWorldLength:n,maxWorldLength:r}}const k={"above-center":{placement:"above-center",normalizedOffset:[0,1,0],anchor:"bottom"},"above-left":{placement:"above-left",normalizedOffset:[-1,1,0],anchor:"bottom-right"},"above-right":{placement:"above-right",normalizedOffset:[1,1,0],anchor:"bottom-left"},"below-center":{placement:"below-center",normalizedOffset:[0,-1,2],anchor:"top"},"below-left":{placement:"below-left",normalizedOffset:[-1,-1,0],anchor:"top-right"},"below-right":{placement:"below-right",normalizedOffset:[1,-1,0],anchor:"top-left"},"center-center":{placement:"center-center",normalizedOffset:[0,0,1],anchor:"center"},"center-left":{placement:"center-left",normalizedOffset:[-1,0,0],anchor:"right"},"center-right":{placement:"center-right",normalizedOffset:[1,0,0],anchor:"left"}},C={"above-center":["default","esriServerPointLabelPlacementAboveCenter"],"above-left":["esriServerPointLabelPlacementAboveLeft"],"above-right":["esriServerPointLabelPlacementAboveRight"],"below-center":["esriServerPointLabelPlacementBelowCenter"],"below-left":["esriServerPointLabelPlacementBelowLeft"],"below-right":["esriServerPointLabelPlacementBelowRight"],"center-center":["esriServerPointLabelPlacementCenterCenter"],"center-left":["esriServerPointLabelPlacementCenterLeft"],"center-right":["esriServerPointLabelPlacementCenterRight"]};for(const G in C){const e=C[G],t=k[G];e.forEach((e=>{k[e]=t}))}Object.freeze&&(Object.freeze(k),Object.keys(k).forEach((e=>{Object.freeze(k[e]),Object.freeze(k[e]?.normalizedOffset)})));const V=[0,0],x=s();export{p as
|
|
5
|
+
import"../../../../core/has.js";import e from"../../../../core/Logger.js";import{a as t}from"../../../../chunks/vec2f64.js";import{s as n,l as r}from"../../../../chunks/vec3.js";import{f as l,c as a}from"../../../../chunks/vec3f64.js";import{f as c}from"../../../../chunks/vec4f64.js";import{create as s,center as o,height as i}from"../../../../geometry/support/aaBoundingBox.js";import{getGraphics3DSymbol as f}from"./graphicSymbolUtils.js";import{HUDMaterial as u}from"../../webgl-engine/materials/HUDMaterial.js";const m=e.getLogger("esri.views.3d.layers.graphics.labelPlacement");function p(e){const n=j(e);if(null==n)return null;const r=h(e,n);if(null==r)return null;const l=r.anchor,s=!!n.hasLabelVerticalOffset;return v({anchor:l,verticalOffset:n.verticalOffset,screenOffset:t(),centerOffset:c(0,0,0,-1),centerOffsetUnits:"world",translation:a(),elevationOffset:0,hasLabelVerticalOffset:s},r,e)}function h(e,t){if(t.anchor)return t;const n=e.labelClass.labelPlacement,r=k[n],l=r||d(e);return n&&!r&&m.warnOncePerTick(`the requested label placement '${n}' is currently unsupported in SceneView.`),g(l,e)}function b(e){const t=e.graphics3DGraphic.graphics3DSymbol,n=f(t);return null!=n?n.symbol.symbolLayers.at(0):null}function g(e,t){const n=t.graphics3DGraphic.graphic.geometry;if(null==n)return null;if(null!=t.disablePlacement){return t.labelClass.labelPlacement?(m.warnOncePerTick(O(e?.placement,t.disablePlacement.logEntityDescription)),d(t)):e}const r=n.type;switch(r){case"polyline":case"polygon":case"extent":case"multipoint":if(t.labelClass.labelPlacement)return m.warnOncePerTick(O(e?.placement,`'${r}' geometries`)),d(t);break;case"point":case"mesh":return e}return e}function O(e,t){return`the requested label placement '${e}' is currently unsupported for ${t} in SceneView.`}function d(e){const t=e.graphics3DGraphic.graphic.geometry;if(null==t)return null;switch(t.type){case"polyline":case"extent":case"multipoint":return{placement:"center-center",normalizedOffset:null,anchor:"center"};case"polygon":{const t=b(e);return null!=t&&"extrude"===t.type?k["above-center"]:{placement:"center-center",normalizedOffset:null,anchor:"center"}}case"point":case"mesh":return k["above-center"];default:return}}function v(e,t,n){const r=n.graphics3DGraphic.graphic.geometry;if(null==r)return null;switch(r.type){case"point":P(e,t,n);break;case"polygon":y(e,t,n);break;case"mesh":z(e,t,n.graphics3DGraphic.layers[0])}return e}function y(e,t,r){const l=b(r);if(null!=l)switch(l.type){case"extrude":{const l=r.graphics3DGraphic.layers[0];null!=l?(l.getBoundingBoxObjectSpace(x),o(x,e.translation),e.translation[2]=i(x)/2):n(e.translation,0,0,0),z(e,t,l);break}}}function P(e,t,r){const l=b(r);if(null==l)return;const a=r.graphics3DGraphic.layers[0];switch(null!=a?a.getCenterObjectSpace(e.translation):n(e.translation,0,0,0),l.type){case"icon":case"text":w(e,t,r,a);break;case"object":z(e,t,a)}}function w(e,t,n,r){const{graphics3DGraphic:l}=n,a=null!=r?r.getScreenSize():null;if(l.isDraped||null==a)e.hasLabelVerticalOffset||"center"===e.anchor||(k[n.labelClass.labelPlacement]&&m.warnOncePerTick(`the requested placement '${t.placement}' is currently unsupported for draped graphics`),e.anchor="center");else{const r=L(n);e.screenOffset[0]=a[0]/2*(t.normalizedOffset[0]-r[0]);const l=a[1]/2*(t.normalizedOffset[1]-r[1]);e.hasLabelVerticalOffset?(e.centerOffset[1]=l,e.centerOffsetUnits="screen"):e.screenOffset[1]=l}}function L(e,t=V){const{graphics3DGraphic:n}=e,r=n.layers[0],l=null!=r?r.stageObject.geometries[0].material:null;if(l&&l instanceof u){const e=l.parameters.anchorPosition;t[0]=2*(e[0]-.5),t[1]=2*(e[1]-.5)}else t[0]=0,t[1]=0;return t}function z(e,t,n){const a=null!=n?n.getBoundingBoxObjectSpace(x):x,c=l(a[3]-a[0],a[4]-a[1],a[5]-a[2]),s=Math.sqrt(c[0]*c[0]+c[1]*c[1]);e.centerOffset[0]=s/2*t.normalizedOffset[0];const o=e.translation[2],i=c[2]/2*t.normalizedOffset[1];e.translation[2]=0,e.elevationOffset=o+i;const f=r(c);e.centerOffset[2]=f/2*t.normalizedOffset[2]}function S(e){return"above-center"===e}function j(e){const t=e.labelClass.labelPlacement,{labelSymbol:n,graphics3DGraphic:r}=e,l=f(r.graphics3DSymbol),a="point-3d"===l?.symbol.type?l.symbol:null,c=k[t]||d(e);return null!=a&&a.supportsCallout()&&a.hasVisibleVerticalOffset()&&!r.isDraped?{placement:null,hasLabelVerticalOffset:!1,verticalOffset:D(a.verticalOffset),anchor:null,normalizedOffset:null}:!n||!n.hasVisibleVerticalOffset()||null!=a&&a.supportsCallout()&&a.verticalOffset&&!r.isDraped?{placement:null,verticalOffset:null,anchor:null,normalizedOffset:null,hasLabelVerticalOffset:!1}:c&&S(c.placement)?{placement:"above-center",verticalOffset:D(n.verticalOffset),anchor:"bottom",normalizedOffset:[0,c.normalizedOffset[1],0],hasLabelVerticalOffset:!0}:(m.errorOncePerTick("Callouts and vertical offset on labels are currently only supported with 'above-center' label placement (not with "+t+" placement)"),null)}function D(e){const{screenLength:t,minWorldLength:n,maxWorldLength:r}=e;return{screenLength:t,minWorldLength:n,maxWorldLength:r}}const k={"above-center":{placement:"above-center",normalizedOffset:[0,1,0],anchor:"bottom"},"above-left":{placement:"above-left",normalizedOffset:[-1,1,0],anchor:"bottom-right"},"above-right":{placement:"above-right",normalizedOffset:[1,1,0],anchor:"bottom-left"},"below-center":{placement:"below-center",normalizedOffset:[0,-1,2],anchor:"top"},"below-left":{placement:"below-left",normalizedOffset:[-1,-1,0],anchor:"top-right"},"below-right":{placement:"below-right",normalizedOffset:[1,-1,0],anchor:"top-left"},"center-center":{placement:"center-center",normalizedOffset:[0,0,1],anchor:"center"},"center-left":{placement:"center-left",normalizedOffset:[-1,0,0],anchor:"right"},"center-right":{placement:"center-right",normalizedOffset:[1,0,0],anchor:"left"}},C={"above-center":["default","esriServerPointLabelPlacementAboveCenter"],"above-left":["esriServerPointLabelPlacementAboveLeft"],"above-right":["esriServerPointLabelPlacementAboveRight"],"below-center":["esriServerPointLabelPlacementBelowCenter"],"below-left":["esriServerPointLabelPlacementBelowLeft"],"below-right":["esriServerPointLabelPlacementBelowRight"],"center-center":["esriServerPointLabelPlacementCenterCenter"],"center-left":["esriServerPointLabelPlacementCenterLeft"],"center-right":["esriServerPointLabelPlacementCenterRight"]};for(const G in C){const e=C[G],t=k[G];e.forEach((e=>{k[e]=t}))}Object.freeze&&(Object.freeze(k),Object.keys(k).forEach((e=>{Object.freeze(k[e]),Object.freeze(k[e]?.normalizedOffset)})));const V=[0,0],x=s();export{p as getLabelPlacement};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import e from"../../../../core/Handles.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{initial as o}from"../../../../core/reactiveUtils.js";import{property as
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import e from"../../../../core/Handles.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{initial as o}from"../../../../core/reactiveUtils.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as a}from"../../../../core/support/UpdatingHandles.js";import{TileTreeDebugger as p}from"../../../support/TileTreeDebugger.js";import n from"../../../../geometry/Polygon.js";let c=class extends p{get updating(){return this._watchUpdatingTracking?.updating??!1}constructor(t){super(t),this._watchUpdatingTracking=new a,this._handles=new e}initialize(){const{featureTiles:t}=this.view;this._handles.add(t.addClient()),this._watchUpdatingTracking.addOnCollectionChange((()=>t?.tiles),(()=>this.update()),o)}destroy(){this._handles=r(this._handles),this._watchUpdatingTracking.destroy()}getTiles(){const t=t=>{const[e,r,o]=t.lij;return n.fromExtent(this.view.featureTiles.tilingScheme.getExtentGeometry(e,r,o))};return this.view.featureTiles.tiles.toArray().sort(((t,e)=>t.loadPriority-e.loadPriority)).map((e=>({...e,geometry:t(e)})))}};t([s()],c.prototype,"_watchUpdatingTracking",void 0),t([s()],c.prototype,"updating",null),t([s()],c.prototype,"view",void 0),c=t([i("esri.views.3d.layers.support.FeatureTileTree3DDebugger")],c);export{c as FeatureTileTree3DDebugger};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{createTask as r}from"../../../../core/asyncUtils.js";import i from"../../../../core/Logger.js";import{abortMaybe as s,removeMaybe as l,destroyMaybe as a}from"../../../../core/maybe.js";import{throwIfAbortError as o}from"../../../../core/promiseUtils.js";import{initial as n}from"../../../../core/reactiveUtils.js";import{property as u}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as p}from"../../../../core/accessorSupport/decorators/subclass.js";import{
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{createTask as r}from"../../../../core/asyncUtils.js";import i from"../../../../core/Logger.js";import{abortMaybe as s,removeMaybe as l,destroyMaybe as a}from"../../../../core/maybe.js";import{throwIfAbortError as o}from"../../../../core/promiseUtils.js";import{initial as n}from"../../../../core/reactiveUtils.js";import{property as u}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as p}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as h}from"../../../../core/support/UpdatingHandles.js";import c from"../../../../layers/support/FeatureFilter.js";import{getFloorFilterClause as _}from"../../../../layers/support/floorFilterUtils.js";import{QueryEngine as d}from"../graphics/QueryEngine.js";import{TaskPriority as y}from"../../../support/Scheduler.js";let m=class extends t{constructor(e){super(e),this._updateTask=null,this._frameTask=null,this._queryEngine=null,this._updateRequested=!0,this._updatingHandles=new h,this._updateVisibility=async e=>{if(null==this._compositedFeatureFilter&&null==this._sceneFilter||0===this.context.getFeatureCount())return this._frameTask.schedule((()=>this.clear()),e);try{const t=await this._queryEngine.executeQueryForIdSet(this._compositedFeatureFilter,this._sceneFilter,e);return this._frameTask.schedule((()=>{this.context.updateFeatureVisibilities((e=>t.has(e)))}),e)}catch(t){return o(t),i.getLogger(this).warn(`FeatureFilter query failed: ${t}`,{error:t}),this._frameTask.schedule((()=>{this.context.setAllFeaturesVisibility(!0)}),e)}}}initialize(){const e=y.FILTER_VISIBILITY,{layer:t,view:r}=this._layerView,{featureStore:i}=this.context,s="hasZ"in this._layerView&&this._layerView.hasZ,l="hasM"in this._layerView&&this._layerView.hasM;this._queryEngine=new d({context:{spatialReference:r.spatialReference,layer:t,scheduler:r.resourceController.scheduler,featureStore:i,hasM:l,hasZ:s},priority:e}),this._frameTask=this._layerView.view.resourceController.scheduler.registerTask(e,this),this._updatingHandles.add((()=>[this._compositedFeatureFilter,this._sceneFilter]),(()=>this.reapply()),n)}destroy(){this._updateRequested=!1,this.removeAllHandles(),this._updatingHandles.destroy(),this.clear(),this._updateTask=s(this._updateTask),this._frameTask=l(this._frameTask),this._queryEngine=a(this._queryEngine),this._set("context",null)}get updating(){return this.running||this._updatingHandles.updating||null!=this._updateTask&&!this._updateTask.finished}get running(){return this._updateRequested||this._frameTask.updating}get defaultVisibility(){return null==this._compositedFeatureFilter&&null==this._sceneFilter}get _featureFilter(){return"filter"in this._layerView?this._layerView.filter:null}get _sceneFilter(){return"layerFilter"in this._layerView?this._layerView.layerFilter:null}get _floorFilter(){return _(this._layerView)}get _timeExtent(){return"timeExtent"in this._layerView?this._layerView.timeExtent:null}get _compositedFeatureFilter(){const{_featureFilter:e,_timeExtent:t,_floorFilter:r}=this;if(null==t&&null==r)return e;const i=null!=e?e.clone():new c;if(null!=t&&(i.timeExtent=null!=i.timeExtent?i.timeExtent.intersection(t):t),null!=r){const e=null==i.where||""===i.where;i.where=e?r:`(${i.where}) AND (${r})`}return i}get _layerView(){return this.context.layerView}reapply(){this._updateRequested=!0}clear(){this._queryEngine.clear(),this.context.clearFeaturesVisibility()}runTask(e){this._updateRequested&&(this._updateTask=s(this._updateTask),this._updateTask=r(this._updateVisibility),this._updateRequested=!1,e.madeProgress()),this._frameTask.processQueue(e)}};e([u({constructOnly:!0})],m.prototype,"context",void 0),e([u()],m.prototype,"updating",null),e([u()],m.prototype,"running",null),e([u()],m.prototype,"defaultVisibility",null),e([u()],m.prototype,"_featureFilter",null),e([u()],m.prototype,"_sceneFilter",null),e([u()],m.prototype,"_floorFilter",null),e([u()],m.prototype,"_timeExtent",null),e([u()],m.prototype,"_compositedFeatureFilter",null),e([u()],m.prototype,"_layerView",null),e([u()],m.prototype,"_updateTask",void 0),e([u()],m.prototype,"_updateRequested",void 0),m=e([p("esri.views.3d.layers.support.FeatureVisibilityFilter")],m);export{m as FeatureVisibilityFilter};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{isSome as r}from"../../../../core/arrayUtils.js";import{estimateAttributesObjectSize as i,estimateFixedArraySize as a,estimateNumberByteSize as s}from"../../../../core/byteSizeEstimations.js";import{makeHandle as o}from"../../../../core/handleUtils.js";import l from"../../../../core/Logger.js";import{disposeMaybe as n}from"../../../../core/maybe.js";import{initial as p,sync as d,watch as u}from"../../../../core/reactiveUtils.js";import{pt2px as m}from"../../../../core/screenUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/has.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as y}from"../../../../chunks/vec3f64.js";import{WatchUpdatingTracking as _}from"../../../../core/support/WatchUpdatingTracking.js";import{projectPointToVector as f}from"../../../../geometry/projection.js";import{getResolutionForScale as g}from"../../../../geometry/support/scaleUtils.js";import{getObjectId as F}from"../../../../layers/graphics/dehydratedFeatures.js";import{convertFromPoint as R}from"../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as b}from"../../../../layers/graphics/OptimizedFeature.js";import v from"../../../../layers/graphics/OptimizedGeometry.js";import S from"../../../../layers/graphics/data/FeatureStore.js";import{isNumericField as w}from"../../../../layers/support/fieldUtils.js";import{generateGradient as P}from"../../../../renderers/support/heatmapUtils.js";import{DrapeSourceType as j}from"../interfaces.js";import{FeatureVisibilityFilter as T}from"./FeatureVisibilityFilter.js";import{DRAPED_Z as V}from"../../terrain/OverlayRenderer.js";import{Attribute as x}from"../../webgl-engine/lib/Attribute.js";import{ContentObjectType as G}from"../../webgl-engine/lib/ContentObjectType.js";import{DrapedHeatmapRenderer as M}from"../../webgl-engine/lib/DrapedHeatmapRenderer.js";import{Geometry as I}from"../../webgl-engine/lib/Geometry.js";import{DirtyOperation as N,DirtyState as A}from"../../webgl-engine/lib/ModelDirtyTypes.js";import{RenderGeometry as O}from"../../webgl-engine/lib/RenderGeometry.js";import{UpdatePolicy as U}from"../../webgl-engine/lib/UpdatePolicy.js";import{VertexAttribute as H}from"../../webgl-engine/lib/VertexAttribute.js";import{HeatmapDensityMaterial as C}from"../../webgl-engine/materials/HeatmapDensityMaterial.js";import{scaleBoundsPredicate as E,isScaleRangeActive as D}from"../../../support/layerViewUtils.js";import{PixelType as L,PixelFormat as W}from"../../../webgl/enums.js";import{loadHeatmapTextureConfiguration as B}from"../../../webgl/heatmapTextureUtils.js";const Z="esri.views.3d.layers.support.HeatmapFeatureProcessor",z=l.getLogger(Z),$=112;let k=class extends t{constructor(e){super(e),this.type="heatmap",this.preferredUpdatePolicy=U.ASYNC,this.dataExtent=null,this.drapeSourceType=j.Features,this._renderGeometries=new Map,this._fieldTotal=0,this._drapeSourceRenderer=null,this._dataType=L.HALF_FLOAT,this._pixelFormat=W.RGBA,this._updatingHandles=new _,this.initializePromise=Promise.resolve()}initialize(){this._featureStore=new S({geometryType:"esriGeometryPoint",hasZ:this.hasZ,hasM:this.hasM});const{dataType:e,samplingMode:t,pixelFormat:r,internalFormat:i}=B(this._renderView.renderingContext,z);this._dataType=e,this._pixelFormat=r;const a=e!==L.FLOAT;this._drapeSourceRenderer=this.view.basemapTerrain.overlayManager.registerDrapeSource(this,M,{...this._rendererParameters,dataType:e,samplingMode:t,pixelFormat:r,internalFormat:i}),this._material=new C({usesHalfFloats:a}),this._materialWithField=new C({usesHalfFloats:a,isAttributeDriven:!0}),this._filterVisibility=new T({context:{layerView:this.owner,featureStore:this.featureStore,getFeatureCount:()=>this._loadedPointGraphics.length,setAllFeaturesVisibility:e=>this._setAllFeaturesVisibility(e),clearFeaturesVisibility:()=>this._setAllFeaturesVisibility(!0),updateFeatureVisibilities:e=>this._updateFeatureVisibilities(e)}}),this._updatingHandles.addOnCollectionChange((()=>this._loadedPointGraphics),(e=>this._onLoadedFeaturesChange(e)),p),this._updatingHandles.addWhen((()=>this._materialParameters),(e=>this._forEachMaterial((t=>t.setParameters(e)))),p),this._updatingHandles.add((()=>this._rendererParameters),(e=>this._drapeSourceRenderer.set(e))),this._updatingHandles.add((()=>this._heatmapRendererField),(()=>{this._recreate()}),d),this._updatingHandles.add((()=>({fieldName:this._heatmapRendererFieldName,numeric:this._heatmapRendererFieldIsNumeric})),(({fieldName:e,numeric:t})=>{if(null!=e&&t){let t=0;this._featureStore.forEach((r=>t+=r.attributes[e]??0)),this._fieldTotal=t}else this._fieldTotal=this._featureStore.numFeatures}),p),this.addHandles([u((()=>({fieldName:this._heatmapRendererFieldName,field:this._heatmapRendererField})),(({fieldName:e,field:t})=>{e&&!t&&z.warn(`Heatmap renderer field '${e}' for layer '${this.layer.title??this.layer.id}' not found`)})),u((()=>({field:this._heatmapRendererField,numeric:this._heatmapRendererFieldIsNumeric})),(({field:e,numeric:t})=>{null==e||t||z.warn(`Heatmap renderer field '${e.name}' for layer '${this.layer.title??this.layer.id}' does not contain numeric values and cannot be used to drive the heatmap density`)})),o((()=>this.view.basemapTerrain.overlayManager.unregisterDrapeSource(this)))])}destroy(){this._renderGeometries.clear(),this._material=n(this._material),this._materialWithField=n(this._materialWithField),this._featureStore.clear(),this._featureStore=null,this._updatingHandles.destroy()}get layer(){return this.owner.layer}get featureStore(){return this._featureStore}get updating(){return this._updatingHandles.updating||this.filterVisibility.updating}get updatingRemaining(){return 0}get suspendInfo(){return{}}get legendEnabled(){return!0}get filterVisibility(){return this._filterVisibility}get displayFeatureLimit(){const e=this.owner?.view?.resourceController?.memoryController?.memoryFactor??1,t=this.owner?.view?.qualitySettings,r=t?Math.ceil(t.heatmap.maxTotalNumberOfFeatures*e):0;return{minimumTotalNumberOfFeatures:0,maximumTotalNumberOfFeatures:r,maximumTotalNumberOfPrimitives:r*2,maximumNumberOfFeatures:r}}get hasZ(){return"hasZ"in this.layer&&this.layer.hasZ}get hasM(){return"hasM"in this.layer&&this.layer.hasM}get view(){return this.owner.view}get fullOpacity(){return this.owner.fullOpacity}get updatePolicy(){return this.owner.updatePolicy}get scaleVisibilitySuspended(){if(!this._isScaleRangeActive)return!1;const{minScale:e,maxScale:t}=this.layer.effectiveScaleRange,{scale:r}=this.view;return!E(r,e??0,t??0)}get usedMemory(){const e=this.usedMemoryPerFeature*this._featureStore.numFeatures,t=this._pixelFormat===W.RED?1:4,r=this._dataType===L.FLOAT?4:2,i=Math.ceil((this._overlayRenderer?.overlays[0]?.resolution??0)*this._densityMapPixelRatio)??0;return i*i*t*r+e}get usedMemoryPerFeature(){const e=this._loadedPointGraphics.find((()=>!0));if(null==e)return 0;const t=i(e),r=s(),o=6;return o*a([0,0,0],r)+o*a([0,0],r)+(this._heatmapRendererFieldIsNumeric?o*r:0)+t}get loadedFeatures(){return this._featureStore.numFeatures}get unprocessedMemoryEstimate(){return 0}get performanceInfo(){return{core:{visible:this._visibleFeatures,missing:0,pending:0},elevationUpdating:!1,visibilityFrustum:!0,visibilityScale:!0}}get renderer(){return this._heatmapRenderer}get _overlayRenderer(){return this.view.basemapTerrain.overlayManager.renderer}get _overlaySpatialReference(){return this._overlayRenderer.spatialReference}get _rendererParameters(){return{...this._radiusParameter,...this._densityParameters,...this._colorRampParameter,...this._pixelRatioParameter}}get _materialParameters(){return{...this._radiusParameter,...this._resolutionForScaleParameter}}get _densityParameters(){const e=this._heatmapRenderer;if(null==e)return null;const{minDensity:t,maxDensity:r}=e;return{minDensity:t,maxDensity:r,fieldTotal:this._fieldTotal}}get _radiusParameter(){const e=this._heatmapRenderer;return e?{searchRadius:m(this._clampSearchRadius(e.radius))}:null}get _resolutionForScaleParameter(){const e=this._heatmapRenderer;if(!e)return null;const{referenceScale:t}=e;return{resolutionForScale:0===t?0:g(t,this.view.spatialReference)}}get _colorRampParameter(){const e=this._heatmapRenderer;return e?{colorRampData:P(e.colorStops)}:null}get _pixelRatioParameter(){return{pixelRatio:this._densityMapPixelRatio}}get _densityMapPixelRatio(){const e=this.owner?.view?.resourceController?.memoryController?.memoryFactor??1;return(this.owner?.view?.qualitySettings.heatmap.pixelRatio??1)*Math.sqrt(e)}get _renderView(){return this.view._stage.renderView}get _featuresArePoints(){return"point"===this.layer.geometryType}get _loadedPointGraphics(){return this.owner.loadedGraphics}get _heatmapRenderer(){const e=this.layer.renderer;return"heatmap"===e?.type?e:null}get _heatmapRendererFieldName(){return this._heatmapRenderer?.field}get _heatmapRendererField(){const e=this._heatmapRendererFieldName;return null!=e?this.layer.fieldsIndex.get(e):null}get _heatmapRendererFieldIsNumeric(){const e=this._heatmapRendererField;return null!=e&&w(e)}get _isScaleRangeActive(){const{layer:e}=this;if(!("effectiveScaleRange"in e))return!1;const{minScale:t,maxScale:r}=e.effectiveScaleRange;return D(t,r)}get _visibleFeatures(){let e=0;return this._renderGeometries.forEach((t=>{t.visible&&++e})),e}async whenGraphicBounds(){return null}computeAttachmentOrigin(){return null}highlight(){return o()}maskOccludee(){return o()}setObjectIdVisibility(){}refreshFilter(){this.filterVisibility.reapply()}_onLoadedFeaturesChange(e){if(!this._featuresArePoints)return;const{objectIdField:t}=this.layer;this._featureStore.removeManyById(e.removed.map((e=>F(e,t)))),this._featureStore.addMany(e.added.map((e=>{const{attributes:r,centroid:i,geometry:a}=e,s=new b(R(new v,a),r,i?R(new v,i):null,F(e,t));return s.displayId=e.uid,s})));const i=e.added,a=e.removed;this._fieldTotal+=this._computeFieldTotalChange(i,a);const s=a.map((({uid:e})=>{const t=this._renderGeometries.get(e);return this._renderGeometries.delete(e),t})).filter(r),o=i.map((e=>{const t=this._pointGraphicToRenderGeometry(e);return this._renderGeometries.set(e.uid,t),t}));s.length>0&&this._drapeSourceRenderer.removeGeometries(s,N.REMOVE),o.length>0&&this._drapeSourceRenderer.addGeometries(o,N.ADD),(o.length>0||s.length>0)&&(this.filterVisibility.reapply(),this._renderView.requestRender())}_recreate(){if(!this._loadedPointGraphics)return;const e=this._loadedPointGraphics.toArray();this._onLoadedFeaturesChange({added:e,removed:e})}_pointGraphicToRenderGeometry(e){const t=this._heatmapRendererFieldName,r=null!=t?this._materialWithField:this._material,i=y();f(e.geometry,i,this._overlaySpatialReference),i[2]=V;const a=[[H.POSITION,new x(i,i.length)]],s=this._heatmapRendererFieldIsNumeric;null!=t&&a.push([H.FEATUREATTRIBUTE,new x([s?e.attributes[t]??0:0],1)]);const o=new O(new I(r,a,null,null,G.Point),{layerUid:this.layer.uid,graphicUid:e.uid});return o.visible=this.filterVisibility.defaultVisibility,o}_forEachMaterial(e){e(this._material),e(this._materialWithField)}_computeFieldTotalChange(e,t){if(null==this._heatmapRendererFieldName||!this._heatmapRendererFieldIsNumeric)return e.length-t.length;const r=this._heatmapRendererFieldName,i=(e,t)=>e+(t.attributes[r]??0);return e.reduce(i,0)-t.reduce(i,0)}_clampSearchRadius(e){return e>$&&z.warnOnce(`SceneView supports a maximum radius of ${$} pt for HeatmapRenderer.`),Math.min(e,$)}_updateFeatureVisibilities(e){const t=[];this._featureStore.forEach((({objectId:r,displayId:i})=>{const a=e(r),s=this._renderGeometries.get(i);s&&s.visible!==a&&(t.push(s),s.visible=a)})),this._drapeSourceRenderer.modifyGeometries(t,A.VISIBILITY)}_setAllFeaturesVisibility(e){const t=[];for(const r of this._renderGeometries.values())r.visible!==e&&(t.push(r),r.visible=e);this._drapeSourceRenderer.modifyGeometries(t,A.VISIBILITY)}get test(){return{visibleFeatureCount:this._visibleFeatures}}};e([h()],k.prototype,"type",void 0),e([h({constructOnly:!0})],k.prototype,"owner",void 0),e([h()],k.prototype,"layer",null),e([h()],k.prototype,"featureStore",null),e([h()],k.prototype,"updating",null),e([h()],k.prototype,"updatingRemaining",null),e([h()],k.prototype,"suspendInfo",null),e([h()],k.prototype,"legendEnabled",null),e([h()],k.prototype,"filterVisibility",null),e([h()],k.prototype,"displayFeatureLimit",null),e([h()],k.prototype,"preferredUpdatePolicy",void 0),e([h()],k.prototype,"hasZ",null),e([h()],k.prototype,"hasM",null),e([h()],k.prototype,"dataExtent",void 0),e([h()],k.prototype,"view",null),e([h()],k.prototype,"fullOpacity",null),e([h()],k.prototype,"updatePolicy",null),e([h()],k.prototype,"drapeSourceType",void 0),e([h()],k.prototype,"scaleVisibilitySuspended",null),e([h()],k.prototype,"renderer",null),e([h()],k.prototype,"_featureStore",void 0),e([h()],k.prototype,"_filterVisibility",void 0),e([h()],k.prototype,"_overlayRenderer",null),e([h()],k.prototype,"_overlaySpatialReference",null),e([h()],k.prototype,"_rendererParameters",null),e([h()],k.prototype,"_materialParameters",null),e([h()],k.prototype,"_densityParameters",null),e([h()],k.prototype,"_radiusParameter",null),e([h()],k.prototype,"_resolutionForScaleParameter",null),e([h()],k.prototype,"_colorRampParameter",null),e([h()],k.prototype,"_pixelRatioParameter",null),e([h()],k.prototype,"_densityMapPixelRatio",null),e([h()],k.prototype,"_renderGeometries",void 0),e([h()],k.prototype,"_material",void 0),e([h()],k.prototype,"_materialWithField",void 0),e([h()],k.prototype,"_renderView",null),e([h()],k.prototype,"_featuresArePoints",null),e([h()],k.prototype,"_loadedPointGraphics",null),e([h()],k.prototype,"_heatmapRenderer",null),e([h()],k.prototype,"_heatmapRendererFieldName",null),e([h()],k.prototype,"_heatmapRendererField",null),e([h()],k.prototype,"_heatmapRendererFieldIsNumeric",null),e([h()],k.prototype,"_fieldTotal",void 0),e([h()],k.prototype,"_drapeSourceRenderer",void 0),e([h()],k.prototype,"_isScaleRangeActive",null),k=e([c(Z)],k);export{k as HeatmapFeatureProcessor,$ as MAX_RADIUS_PT};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{isSome as r}from"../../../../core/arrayUtils.js";import{estimateAttributesObjectSize as i,estimateFixedArraySize as a,estimateNumberByteSize as s}from"../../../../core/byteSizeEstimations.js";import{makeHandle as o}from"../../../../core/handleUtils.js";import l from"../../../../core/Logger.js";import{disposeMaybe as n}from"../../../../core/maybe.js";import{initial as p,sync as d,watch as u}from"../../../../core/reactiveUtils.js";import{pt2px as m}from"../../../../core/screenUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/has.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as y}from"../../../../chunks/vec3f64.js";import{UpdatingHandles as _}from"../../../../core/support/UpdatingHandles.js";import{projectPointToVector as f}from"../../../../geometry/projection.js";import{getResolutionForScale as g}from"../../../../geometry/support/scaleUtils.js";import{getObjectId as F}from"../../../../layers/graphics/dehydratedFeatures.js";import{convertFromPoint as R}from"../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as b}from"../../../../layers/graphics/OptimizedFeature.js";import v from"../../../../layers/graphics/OptimizedGeometry.js";import S from"../../../../layers/graphics/data/FeatureStore.js";import{isNumericField as w}from"../../../../layers/support/fieldUtils.js";import{generateGradient as P}from"../../../../renderers/support/heatmapUtils.js";import{DrapeSourceType as j}from"../interfaces.js";import{FeatureVisibilityFilter as T}from"./FeatureVisibilityFilter.js";import{DRAPED_Z as V}from"../../terrain/OverlayRenderer.js";import{Attribute as x}from"../../webgl-engine/lib/Attribute.js";import{ContentObjectType as G}from"../../webgl-engine/lib/ContentObjectType.js";import{DrapedHeatmapRenderer as M}from"../../webgl-engine/lib/DrapedHeatmapRenderer.js";import{Geometry as I}from"../../webgl-engine/lib/Geometry.js";import{DirtyOperation as N,DirtyState as A}from"../../webgl-engine/lib/ModelDirtyTypes.js";import{RenderGeometry as O}from"../../webgl-engine/lib/RenderGeometry.js";import{UpdatePolicy as H}from"../../webgl-engine/lib/UpdatePolicy.js";import{VertexAttribute as U}from"../../webgl-engine/lib/VertexAttribute.js";import{HeatmapDensityMaterial as C}from"../../webgl-engine/materials/HeatmapDensityMaterial.js";import{scaleBoundsPredicate as E,isScaleRangeActive as D}from"../../../support/layerViewUtils.js";import{PixelType as L,PixelFormat as W}from"../../../webgl/enums.js";import{loadHeatmapTextureConfiguration as B}from"../../../webgl/heatmapTextureUtils.js";const Z="esri.views.3d.layers.support.HeatmapFeatureProcessor",z=l.getLogger(Z),$=112;let q=class extends t{constructor(e){super(e),this.type="heatmap",this.preferredUpdatePolicy=H.ASYNC,this.dataExtent=null,this.drapeSourceType=j.Features,this._renderGeometries=new Map,this._fieldTotal=0,this._drapeSourceRenderer=null,this._dataType=L.HALF_FLOAT,this._pixelFormat=W.RGBA,this._updatingHandles=new _,this.initializePromise=Promise.resolve()}initialize(){this._featureStore=new S({geometryType:"esriGeometryPoint",hasZ:this.hasZ,hasM:this.hasM});const{dataType:e,samplingMode:t,pixelFormat:r,internalFormat:i}=B(this._renderView.renderingContext,z);this._dataType=e,this._pixelFormat=r;const a=e!==L.FLOAT;this._drapeSourceRenderer=this.view.basemapTerrain.overlayManager.registerDrapeSource(this,M,{...this._rendererParameters,dataType:e,samplingMode:t,pixelFormat:r,internalFormat:i}),this._material=new C({usesHalfFloats:a}),this._materialWithField=new C({usesHalfFloats:a,isAttributeDriven:!0}),this._filterVisibility=new T({context:{layerView:this.owner,featureStore:this.featureStore,getFeatureCount:()=>this._loadedPointGraphics.length,setAllFeaturesVisibility:e=>this._setAllFeaturesVisibility(e),clearFeaturesVisibility:()=>this._setAllFeaturesVisibility(!0),updateFeatureVisibilities:e=>this._updateFeatureVisibilities(e)}}),this._updatingHandles.addOnCollectionChange((()=>this._loadedPointGraphics),(e=>this._onLoadedFeaturesChange(e)),p),this._updatingHandles.addWhen((()=>this._materialParameters),(e=>this._forEachMaterial((t=>t.setParameters(e)))),p),this._updatingHandles.add((()=>this._rendererParameters),(e=>this._drapeSourceRenderer.set(e))),this._updatingHandles.add((()=>this._heatmapRendererField),(()=>{this._recreate()}),d),this._updatingHandles.add((()=>({fieldName:this._heatmapRendererFieldName,numeric:this._heatmapRendererFieldIsNumeric})),(({fieldName:e,numeric:t})=>{if(null!=e&&t){let t=0;this._featureStore.forEach((r=>t+=r.attributes[e]??0)),this._fieldTotal=t}else this._fieldTotal=this._featureStore.numFeatures}),p),this.addHandles([u((()=>({fieldName:this._heatmapRendererFieldName,field:this._heatmapRendererField})),(({fieldName:e,field:t})=>{e&&!t&&z.warn(`Heatmap renderer field '${e}' for layer '${this.layer.title??this.layer.id}' not found`)})),u((()=>({field:this._heatmapRendererField,numeric:this._heatmapRendererFieldIsNumeric})),(({field:e,numeric:t})=>{null==e||t||z.warn(`Heatmap renderer field '${e.name}' for layer '${this.layer.title??this.layer.id}' does not contain numeric values and cannot be used to drive the heatmap density`)})),o((()=>this.view.basemapTerrain.overlayManager.unregisterDrapeSource(this)))])}destroy(){this._renderGeometries.clear(),this._material=n(this._material),this._materialWithField=n(this._materialWithField),this._featureStore.clear(),this._featureStore=null,this._updatingHandles.destroy()}get layer(){return this.owner.layer}get featureStore(){return this._featureStore}get updating(){return this._updatingHandles.updating||this.filterVisibility.updating}get updatingRemaining(){return 0}get suspendInfo(){return{}}get legendEnabled(){return!0}get filterVisibility(){return this._filterVisibility}get displayFeatureLimit(){const e=this.owner?.view?.resourceController?.memoryController?.memoryFactor??1,t=this.owner?.view?.qualitySettings,r=t?Math.ceil(t.heatmap.maxTotalNumberOfFeatures*e):0;return{minimumTotalNumberOfFeatures:0,maximumTotalNumberOfFeatures:r,maximumTotalNumberOfPrimitives:r*2,maximumNumberOfFeatures:r}}get hasZ(){return"hasZ"in this.layer&&this.layer.hasZ}get hasM(){return"hasM"in this.layer&&this.layer.hasM}get view(){return this.owner.view}get fullOpacity(){return this.owner.fullOpacity}get updatePolicy(){return this.owner.updatePolicy}get scaleVisibilitySuspended(){if(!this._isScaleRangeActive)return!1;const{minScale:e,maxScale:t}=this.layer.effectiveScaleRange,{scale:r}=this.view;return!E(r,e??0,t??0)}get usedMemory(){const e=this.usedMemoryPerFeature*this._featureStore.numFeatures,t=this._pixelFormat===W.RED?1:4,r=this._dataType===L.FLOAT?4:2,i=Math.ceil((this._overlayRenderer?.overlays[0]?.resolution??0)*this._densityMapPixelRatio)??0;return i*i*t*r+e}get usedMemoryPerFeature(){const e=this._loadedPointGraphics.find((()=>!0));if(null==e)return 0;const t=i(e),r=s(),o=6;return o*a([0,0,0],r)+o*a([0,0],r)+(this._heatmapRendererFieldIsNumeric?o*r:0)+t}get loadedFeatures(){return this._featureStore.numFeatures}get unprocessedMemoryEstimate(){return 0}get performanceInfo(){return{core:{visible:this._visibleFeatures,missing:0,pending:0},elevationUpdating:!1,visibilityFrustum:!0,visibilityScale:!0}}get renderer(){return this._heatmapRenderer}get _overlayRenderer(){return this.view.basemapTerrain.overlayManager.renderer}get _overlaySpatialReference(){return this._overlayRenderer.spatialReference}get _rendererParameters(){return{...this._radiusParameter,...this._densityParameters,...this._colorRampParameter,...this._pixelRatioParameter}}get _materialParameters(){return{...this._radiusParameter,...this._resolutionForScaleParameter}}get _densityParameters(){const e=this._heatmapRenderer;if(null==e)return null;const{minDensity:t,maxDensity:r}=e;return{minDensity:t,maxDensity:r,fieldTotal:this._fieldTotal}}get _radiusParameter(){const e=this._heatmapRenderer;return e?{searchRadius:m(this._clampSearchRadius(e.radius))}:null}get _resolutionForScaleParameter(){const e=this._heatmapRenderer;if(!e)return null;const{referenceScale:t}=e;return{resolutionForScale:0===t?0:g(t,this.view.spatialReference)}}get _colorRampParameter(){const e=this._heatmapRenderer;return e?{colorRampData:P(e.colorStops)}:null}get _pixelRatioParameter(){return{pixelRatio:this._densityMapPixelRatio}}get _densityMapPixelRatio(){const e=this.owner?.view?.resourceController?.memoryController?.memoryFactor??1;return(this.owner?.view?.qualitySettings.heatmap.pixelRatio??1)*Math.sqrt(e)}get _renderView(){return this.view._stage.renderView}get _featuresArePoints(){return"point"===this.layer.geometryType}get _loadedPointGraphics(){return this.owner.loadedGraphics}get _heatmapRenderer(){const e=this.layer.renderer;return"heatmap"===e?.type?e:null}get _heatmapRendererFieldName(){return this._heatmapRenderer?.field}get _heatmapRendererField(){const e=this._heatmapRendererFieldName;return null!=e?this.layer.fieldsIndex.get(e):null}get _heatmapRendererFieldIsNumeric(){const e=this._heatmapRendererField;return null!=e&&w(e)}get _isScaleRangeActive(){const{layer:e}=this;if(!("effectiveScaleRange"in e))return!1;const{minScale:t,maxScale:r}=e.effectiveScaleRange;return D(t,r)}get _visibleFeatures(){let e=0;return this._renderGeometries.forEach((t=>{t.visible&&++e})),e}async whenGraphicBounds(){return null}computeAttachmentOrigin(){return null}highlight(){return o()}maskOccludee(){return o()}setObjectIdVisibility(){}refreshFilter(){this.filterVisibility.reapply()}_onLoadedFeaturesChange(e){if(!this._featuresArePoints)return;const{objectIdField:t}=this.layer;this._featureStore.removeManyById(e.removed.map((e=>F(e,t)))),this._featureStore.addMany(e.added.map((e=>{const{attributes:r,centroid:i,geometry:a}=e,s=new b(R(new v,a),r,i?R(new v,i):null,F(e,t));return s.displayId=e.uid,s})));const i=e.added,a=e.removed;this._fieldTotal+=this._computeFieldTotalChange(i,a);const s=a.map((({uid:e})=>{const t=this._renderGeometries.get(e);return this._renderGeometries.delete(e),t})).filter(r),o=i.map((e=>{const t=this._pointGraphicToRenderGeometry(e);return this._renderGeometries.set(e.uid,t),t}));s.length>0&&this._drapeSourceRenderer.removeGeometries(s,N.REMOVE),o.length>0&&this._drapeSourceRenderer.addGeometries(o,N.ADD),(o.length>0||s.length>0)&&(this.filterVisibility.reapply(),this._renderView.requestRender())}_recreate(){if(!this._loadedPointGraphics)return;const e=this._loadedPointGraphics.toArray();this._onLoadedFeaturesChange({added:e,removed:e})}_pointGraphicToRenderGeometry(e){const t=this._heatmapRendererFieldName,r=null!=t?this._materialWithField:this._material,i=y();f(e.geometry,i,this._overlaySpatialReference),i[2]=V;const a=[[U.POSITION,new x(i,i.length)]],s=this._heatmapRendererFieldIsNumeric;null!=t&&a.push([U.FEATUREATTRIBUTE,new x([s?e.attributes[t]??0:0],1)]);const o=new O(new I(r,a,null,null,G.Point),{layerUid:this.layer.uid,graphicUid:e.uid});return o.visible=this.filterVisibility.defaultVisibility,o}_forEachMaterial(e){e(this._material),e(this._materialWithField)}_computeFieldTotalChange(e,t){if(null==this._heatmapRendererFieldName||!this._heatmapRendererFieldIsNumeric)return e.length-t.length;const r=this._heatmapRendererFieldName,i=(e,t)=>e+(t.attributes[r]??0);return e.reduce(i,0)-t.reduce(i,0)}_clampSearchRadius(e){return e>$&&z.warnOnce(`SceneView supports a maximum radius of ${$} pt for HeatmapRenderer.`),Math.min(e,$)}_updateFeatureVisibilities(e){const t=[];this._featureStore.forEach((({objectId:r,displayId:i})=>{const a=e(r),s=this._renderGeometries.get(i);s&&s.visible!==a&&(t.push(s),s.visible=a)})),this._drapeSourceRenderer.modifyGeometries(t,A.VISIBILITY)}_setAllFeaturesVisibility(e){const t=[];for(const r of this._renderGeometries.values())r.visible!==e&&(t.push(r),r.visible=e);this._drapeSourceRenderer.modifyGeometries(t,A.VISIBILITY)}get test(){return{visibleFeatureCount:this._visibleFeatures}}};e([h()],q.prototype,"type",void 0),e([h({constructOnly:!0})],q.prototype,"owner",void 0),e([h()],q.prototype,"layer",null),e([h()],q.prototype,"featureStore",null),e([h()],q.prototype,"updating",null),e([h()],q.prototype,"updatingRemaining",null),e([h()],q.prototype,"suspendInfo",null),e([h()],q.prototype,"legendEnabled",null),e([h()],q.prototype,"filterVisibility",null),e([h()],q.prototype,"displayFeatureLimit",null),e([h()],q.prototype,"preferredUpdatePolicy",void 0),e([h()],q.prototype,"hasZ",null),e([h()],q.prototype,"hasM",null),e([h()],q.prototype,"dataExtent",void 0),e([h()],q.prototype,"view",null),e([h()],q.prototype,"fullOpacity",null),e([h()],q.prototype,"updatePolicy",null),e([h()],q.prototype,"drapeSourceType",void 0),e([h()],q.prototype,"scaleVisibilitySuspended",null),e([h()],q.prototype,"renderer",null),e([h()],q.prototype,"_featureStore",void 0),e([h()],q.prototype,"_filterVisibility",void 0),e([h()],q.prototype,"_overlayRenderer",null),e([h()],q.prototype,"_overlaySpatialReference",null),e([h()],q.prototype,"_rendererParameters",null),e([h()],q.prototype,"_materialParameters",null),e([h()],q.prototype,"_densityParameters",null),e([h()],q.prototype,"_radiusParameter",null),e([h()],q.prototype,"_resolutionForScaleParameter",null),e([h()],q.prototype,"_colorRampParameter",null),e([h()],q.prototype,"_pixelRatioParameter",null),e([h()],q.prototype,"_densityMapPixelRatio",null),e([h()],q.prototype,"_renderGeometries",void 0),e([h()],q.prototype,"_material",void 0),e([h()],q.prototype,"_materialWithField",void 0),e([h()],q.prototype,"_renderView",null),e([h()],q.prototype,"_featuresArePoints",null),e([h()],q.prototype,"_loadedPointGraphics",null),e([h()],q.prototype,"_heatmapRenderer",null),e([h()],q.prototype,"_heatmapRendererFieldName",null),e([h()],q.prototype,"_heatmapRendererField",null),e([h()],q.prototype,"_heatmapRendererFieldIsNumeric",null),e([h()],q.prototype,"_fieldTotal",void 0),e([h()],q.prototype,"_drapeSourceRenderer",void 0),e([h()],q.prototype,"_isScaleRangeActive",null),q=e([c(Z)],q);export{q as HeatmapFeatureProcessor,$ as MAX_RADIUS_PT};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import r from"../../../core/Evented.js";import{when as o}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{afterDispatch as s}from"../../../core/accessorSupport/watch.js";import{f as n}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as l}from"../../../geometry/ellipsoidUtils.js";import p from"../../ViewAnimation.js";import{ViewingMode as c}from"../../ViewingMode.js";import{Constraints as m}from"./Constraints.js";import{AnimationController as h}from"./controllers/AnimationController.js";import{State as d}from"./controllers/CameraController.js";import{PropertiesPool as u}from"../support/PropertiesPool.js";import{Camera as g,PaddingSide as C}from"../webgl-engine/lib/Camera.js";import{RenderState as y}from"../../support/RenderState.js";let _=class extends t{constructor(){super(...arguments),this._propertiesPool=new u({camera:g},this),this._lastSeenCameraProjectionValues=new g,this.mode=y.ANIMATING,this._cssCamera=new g,this._camera=new g,this.rasterPixelRatio=1,this.contentPixelRatio=1,this.events=new r,this.viewingMode=c.Global,this._cameraChanged=!1,this._updateQueue=new Array,this._processingUpdates=!1}init(e,t){this._set("viewingMode",e),this._set("spatialReference",t),this._set("constraints",new m({mode:this.viewingMode}))}exit(){this.cameraController=null,this._propertiesPool.destroy(),this._propertiesPool=new u({camera:g},this)}destroy(){this.cameraController=null,this._propertiesPool?.destroy(),this._propertiesPool=null}createInitialCamera(){if(this.viewingMode===c.Global){const e=l(this.spatialReference).radius;this.camera=new g({eye:n(4*e,0,0),center:n(e,0,0),up:n(0,0,1)})}else this.camera=new g({eye:n(0,0,100),center:n(0,0,0),up:n(0,1,0)})}get animation(){return this.cameraController instanceof h&&null!=this.cameraController.viewAnimation?this.cameraController.viewAnimation:null}get camera(){return this._camera}get cssCamera(){const e=this._cssCamera.copyFrom(this.camera),{height:t,width:r,pixelRatio:o}=this.camera;return e.pixelRatio=1,e.height=Math.round(t/o),e.width=Math.round(r/o),e}set camera(e){e!==v&&v.copyFrom(e),v.computeUp(this.viewingMode),this.events.emit("before-camera-change",v);const t=this._camera;if(this._cameraProjectionChanged(this._lastSeenCameraProjectionValues,v)&&(this._lastSeenCameraProjectionValues.copyFrom(v),this.events.emit("camera-projection-changed",this._lastSeenCameraProjectionValues)),!t.equals(v)&&(this._camera=this._propertiesPool.get("camera").copyFrom(v),this._cameraChanged=!t.almostEquals(v),this._cameraChanged)){const e=s((()=>{this._cameraChanged=!1,e.remove()}))}}get pixelRatio(){return this.camera.pixelRatio}get alignPixelEnabled(){return this.pixelRatio===this.rasterPixelRatio&&this.mode===y.IDLE}get updating(){return
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import r from"../../../core/Evented.js";import{when as o}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{afterDispatch as s}from"../../../core/accessorSupport/watch.js";import{f as n}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as l}from"../../../geometry/ellipsoidUtils.js";import p from"../../ViewAnimation.js";import{ViewingMode as c}from"../../ViewingMode.js";import{Constraints as m}from"./Constraints.js";import{AnimationController as h}from"./controllers/AnimationController.js";import{State as d}from"./controllers/CameraController.js";import{PropertiesPool as u}from"../support/PropertiesPool.js";import{Camera as g,PaddingSide as C}from"../webgl-engine/lib/Camera.js";import{RenderState as y}from"../../support/RenderState.js";let _=class extends t{constructor(){super(...arguments),this._propertiesPool=new u({camera:g},this),this._lastSeenCameraProjectionValues=new g,this.mode=y.ANIMATING,this._cssCamera=new g,this._camera=new g,this.rasterPixelRatio=1,this.contentPixelRatio=1,this.events=new r,this.viewingMode=c.Global,this._cameraChanged=!1,this._updateQueue=new Array,this._processingUpdates=!1}init(e,t){this._set("viewingMode",e),this._set("spatialReference",t),this._set("constraints",new m({mode:this.viewingMode}))}exit(){this.cameraController=null,this._propertiesPool.destroy(),this._propertiesPool=new u({camera:g},this)}destroy(){this.cameraController=null,this._propertiesPool?.destroy(),this._propertiesPool=null}createInitialCamera(){if(this.viewingMode===c.Global){const e=l(this.spatialReference).radius;this.camera=new g({eye:n(4*e,0,0),center:n(e,0,0),up:n(0,0,1)})}else this.camera=new g({eye:n(0,0,100),center:n(0,0,0),up:n(0,1,0)})}get animation(){return this.cameraController instanceof h&&null!=this.cameraController.viewAnimation?this.cameraController.viewAnimation:null}get camera(){return this._camera}get cssCamera(){const e=this._cssCamera.copyFrom(this.camera),{height:t,width:r,pixelRatio:o}=this.camera;return e.pixelRatio=1,e.height=Math.round(t/o),e.width=Math.round(r/o),e}set camera(e){e!==v&&v.copyFrom(e),v.computeUp(this.viewingMode),this.events.emit("before-camera-change",v);const t=this._camera;if(this._cameraProjectionChanged(this._lastSeenCameraProjectionValues,v)&&(this._lastSeenCameraProjectionValues.copyFrom(v),this.events.emit("camera-projection-changed",this._lastSeenCameraProjectionValues)),!t.equals(v)&&(this._camera=this._propertiesPool.get("camera").copyFrom(v),this._cameraChanged=!t.almostEquals(v),this._cameraChanged)){const e=s((()=>{this._cameraChanged=!1,e.remove()}))}}get pixelRatio(){return this.camera.pixelRatio}get alignPixelEnabled(){return this.pixelRatio===this.rasterPixelRatio&&this.mode===y.IDLE}get updating(){return this.mode!==y.IDLE}get contentCamera(){return this._contentCamera??this.camera}set contentCamera(e){this._contentCamera=null!=e?e.clone():null}get fixedContentCamera(){return null!=this._contentCamera}get isGlobal(){return this.viewingMode===c.Global}get isLocal(){return this.viewingMode===c.Local}get navigating(){return!(!this.cameraController||!this.cameraController.isInteractive)}get stationary(){return!this._cameraChanged&&!this.navigating}get cameraController(){return this._get("cameraController")}set cameraController(e){this.stopActiveCameraController()?(this.cameraController?.destroy(),e&&(this.removeHandles(w),this.addHandles(o((()=>e.state===d.Finished||e.state===d.Stopped),(()=>{this._set("cameraController",null),this.updateCamera((t=>e.onControllerEnd(t)))}),{sync:!0,once:!0}),w),e.onControllerStart(this.camera)),this._set("cameraController",e)):e&&(e.state=d.Rejected)}switchCameraController(e){return this.cameraController=e,e.state!==d.Rejected}stopActiveCameraController(){return!(this.cameraController&&!this.cameraController.stopController())}updateCamera(e){this._updateQueue.push(e),this._processUpdateQueue()}_processUpdateQueue(){if(0===this._updateQueue.length||this._processingUpdates)return;this._processingUpdates=!0;const e=this._updateQueue.shift();v.copyFrom(this._get("camera")),e(v),this.camera=v,this._processingUpdates=!1,this._processUpdateQueue()}_cameraProjectionChanged(e,t){return e.fov!==t.fov||(e.fullViewport[0]!==t.fullViewport[0]||e.fullViewport[1]!==t.fullViewport[1]||e.fullViewport[2]!==t.fullViewport[2]||e.fullViewport[3]!==t.fullViewport[3]||(e.padding[C.TOP]!==t.padding[C.TOP]||e.padding[C.RIGHT]!==t.padding[C.RIGHT]||e.padding[C.BOTTOM]!==t.padding[C.BOTTOM]||e.padding[C.LEFT]!==t.padding[C.LEFT]))}};e([a()],_.prototype,"mode",void 0),e([a({readOnly:!0,type:p})],_.prototype,"animation",null),e([a({type:g})],_.prototype,"camera",null),e([a({type:g})],_.prototype,"cssCamera",null),e([a()],_.prototype,"_cssCamera",void 0),e([a()],_.prototype,"_camera",void 0),e([a({readOnly:!0})],_.prototype,"pixelRatio",null),e([a()],_.prototype,"rasterPixelRatio",void 0),e([a()],_.prototype,"contentPixelRatio",void 0),e([a({readOnly:!0})],_.prototype,"alignPixelEnabled",null),e([a({readOnly:!0})],_.prototype,"updating",null),e([a({})],_.prototype,"_contentCamera",void 0),e([a({type:g})],_.prototype,"contentCamera",null),e([a({readOnly:!0})],_.prototype,"fixedContentCamera",null),e([a({readOnly:!0})],_.prototype,"constraints",void 0),e([a({readOnly:!0})],_.prototype,"events",void 0),e([a({readOnly:!0})],_.prototype,"isGlobal",null),e([a({readOnly:!0})],_.prototype,"isLocal",null),e([a({readOnly:!0})],_.prototype,"viewingMode",void 0),e([a({readOnly:!0})],_.prototype,"spatialReference",void 0),e([a()],_.prototype,"navigating",null),e([a()],_.prototype,"stationary",null),e([a()],_.prototype,"_cameraChanged",void 0),e([a()],_.prototype,"cameraController",null),_=e([i("esri.views.3d.state.ViewState")],_);const f=_,v=new g,w="ViewStateHandles";export{f 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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Camera.js";import i from"../../../Viewpoint.js";import a from"../../../core/Accessor.js";import r from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{watch as n,on as o,sync as h,when as l}from"../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../core/scheduling.js";import{createScreenPoint as c}from"../../../core/screenUtils.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{d as v}from"../../../chunks/vec3.js";import{g as u}from"../../../chunks/vec3f64.js";import{s as w}from"../../../chunks/vec4.js";import{c as g}from"../../../chunks/vec4f64.js";import y from"../../../geometry/Extent.js";import _ from"../../../geometry/Point.js";import{canProject as C}from"../../../geometry/support/webMercatorUtils.js";import{ViewingMode as f}from"../../ViewingMode.js";import{applyAll as R}from"../camera/constraintUtils.js";import{cameraOnContentAlongViewDirection as x,surfaceElevationBelowRenderLocation as P}from"../camera/intersectionUtils.js";import{ConstraintsManager as S}from"./ConstraintsManager.js";import{Frustum as O}from"./Frustum.js";import{GoToOperation as T}from"./GoToOperation.js";import{SurfaceCollisionCorrectionController as b}from"./controllers/SurfaceCollisionCorrectionController.js";import{internalToExternal as I,externalToInternal as j,toExtent as z,distanceToScale as M,scaleToZoom as E,fromExtent as A,OrientationMode as N,getObserverForPointAtDistance as H,scaleToDistance as L,zoomToScale as B}from"../support/cameraUtils.js";import{PropertiesPool as D}from"../support/PropertiesPool.js";import{fromCamera as U,toCamera as V}from"../support/viewpointUtils.js";import{Camera as k,PaddingSide as F}from"../webgl-engine/lib/Camera.js";import{RenderFeature as G}from"../webgl-engine/lib/RenderFeature.js";import{RenderState as q}from"../../support/RenderState.js";import{ensureAttachmentMaxSize as W}from"../../webgl/FramebufferObject.js";let J=class extends a{get camera(){const e=this._get("camera");if(!this.ready)return e;const t=I(this.view,this.view.state.camera,Z);return t&&e&&t.equals(e)?e:t.clone()}set camera(e){this._updatePropertyBeforeReady("camera",e)||(this.view.elevationProvider?.enableElevationCache(!0),this.setStateCamera(j(this.view,e),{applyConstraints:!1})||r.getLogger(this).error("#camera=","Invalid camera",e),this.view.elevationProvider?.enableElevationCache(!1))}get contentCamera(){const e=this._get("contentCamera");if(!this.ready)return e;const t=I(this.view,this.view.state.contentCamera,Z);return t&&e&&t.equals(e)?e:t.clone()}set contentCamera(e){if(this._updatePropertyBeforeReady("contentCamera",e))return;const t=j(this.view,e);null!=t?(this._updateElevation(t),this.view.state.contentCamera=t):this.view.state.contentCamera=null}installContentCameraReset(e){if(this.removeHandles(ie),this.test.contentCameraResetState.clear(),!this.view.state.fixedContentCamera)return!1;const t=this.zoom,i=this.view.state.camera.distance**2,a=u(this.view.state.camera.center),r=e.sticky?this.contentCamera.clone():null;return this.addHandles([n((()=>this.contentCamera),(()=>{e.sticky||(this.removeHandles(ie),this.test.contentCameraResetState.clear())})),n((()=>this.zoom),(e=>{void 0!==e&&void 0!==t&&(this.test.contentCameraResetState.set("view.zoom",Math.abs(e-t)/2),Math.abs(e-t)>2?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=r))})),n((()=>this.view.state.camera),(e=>{const t=v(a,e.center);this.test.contentCameraResetState.set("camera.center",t/i),t>i?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=r)}))],ie),!0}get center(){return this.ready?this.view.pointsOfInterest.centerOnContent.location:this._get("center")}set center(e){this._updatePropertyBeforeReady("center",e)||(e?this.isCompatible(e)?this.setStateCamera(this._centerToCamera(e),{applyConstraints:!0})?this.view.pointsOfInterest.centerOnContent.runTask():r.getLogger(this).error("#center=","Invalid center",e):r.getLogger(this).error("#center=","Center has an incompatible spatial reference (center: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):r.getLogger(this).error("#center=","Center may not be null or undefined"))}get extent(){if(!this.ready)return this._get("extent");const e=this.view,t=z(e,e.state.camera,e.pointsOfInterest.centerOnContent.renderLocation);return null!=t?t:this._get("extent")}set extent(e){this._updatePropertyBeforeReady("extent",e)||(e?this.isCompatible(e)?this.setStateCamera(this._extentToCamera(e),{applyConstraints:!0})||r.getLogger(this).error("#extent=","Invalid extent",e):r.getLogger(this).error("#extent=","Extent has an incompatible spatial reference (extent: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):r.getLogger(this).error("#extent=","Extent may not be null or undefined"))}get frustum(){const e=this._propertiesPool.get("frustum");return e.renderCoordsHelper=this.view.renderCoordsHelper,e.update(this.view.state.camera),e}get hasInitialView(){return!!this.view.get("map.initialViewProperties.viewpoint")}get scale(){if(this.ready){const e=this.view.pointsOfInterest.centerOnContent;return M(this.view,e.distance,e.location.latitude)}return this._get("scale")}set scale(e){this._updatePropertyBeforeReady("scale",e)||this.setStateCamera(this._scaleToCamera(e),{applyConstraints:!0})||r.getLogger(this).error("#scale=","Invalid scale",e)}get padding(){if(!this.ready)return this._get("padding");const e=this.view.state.camera,t=e.padding,i=e.pixelRatio,a=this._get("padding"),r=Math.round(t[F.TOP]/i),s=Math.round(t[F.RIGHT]/i),n=Math.round(t[F.BOTTOM]/i),o=Math.round(t[F.LEFT]/i);return null!=a&&a.top===r&&a.right===s&&a.bottom===n&&a.left===o?a:{top:r,right:s,bottom:n,left:o}}set padding(e){this._updatePropertyBeforeReady("padding",e)||(this._paddingToArray(e,this.view.state.camera.pixelRatio,ee),this.view.state.updateCamera((e=>e.padding=ee)))}_paddingToArray(e,t,i){e?w(i,e.top||0,e.right||0,e.bottom||0,e.left||0):w(i,0,0,0,0);for(let a=0;a<4;a++)i[a]=Math.round(i[a]*t)}get screenCenter(){const e=this.padding;return c((this.view.width-(e.left+e.right))/2+e.left,(this.view.height-(e.top+e.bottom))/2+e.top)}get viewpoint(){return this.ready?U(this.view,this.camera):this._get("viewpoint")}set viewpoint(e){if(!this._updatePropertyBeforeReady("viewpoint",e))if(e)if(this.isCompatible(e))this.setStateCamera(this._viewpointToCamera(e),{applyConstraints:!e.camera})||r.getLogger(this).error("#viewpoint=","Invalid viewpoint",e);else{const t=null!=e.camera?e.camera.position:e.targetGeometry,i=null!=t&&t.spatialReference;r.getLogger(this).error("#viewpoint=","Viewpoint has an incompatible spatial reference (viewpoint: "+(i?i.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e)}else r.getLogger(this).error("#viewpoint=","Viewpoint may not be null or undefined")}get zoom(){return this.ready?E(this.view,this.scale):this._get("zoom")}set zoom(e){this._updatePropertyBeforeReady("zoom",e)||void 0===e||this.setStateCamera(this._zoomToCamera(e),{applyConstraints:!0})||r.getLogger(this).error("#zoom=","Invalid zoom",e)}_computeCanvasSize(){if(this._devicePixelRatioOverride)return this.view.state.contentPixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*this._devicePixelRatioOverride),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*this._devicePixelRatioOverride),this._tmpCanvasSize.pixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize;const e=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio),t=this._usePhysicalPixelRendering?this._windowDevicePixelRatio:e;this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*t),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*t);const i=this.view._stage.renderView.renderingContext.parameters.maxTextureSize;return W(this._tmpCanvasSize,i)?this._tmpCanvasSize.pixelRatio=t:this._tmpCanvasSize.pixelRatio=this._tmpCanvasSize.width>0?this._tmpCanvasSize.width/this.view.surface.clientWidth:t,this.view.state&&(this.view.state.contentPixelRatio=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)),this._tmpCanvasSize}get _rasterPixelRatio(){return null!=this._devicePixelRatioOverride?this._devicePixelRatioOverride:this._usePhysicalPixelRenderingAny?this._windowDevicePixelRatio:Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)}get _usePhysicalPixelRendering(){return this.view?._stage?.renderer.isFeatureEnabled(G.PhysicalPixelRendering)??!1}get _usePhysicalPixelRenderingAny(){const e=this.view?._stage?.renderer;return e&&(e.isFeatureEnabled(G.PhysicalPixelRendering,q.IDLE)||e.isFeatureEnabled(G.PhysicalPixelRendering,q.INTERACTING)||e.isFeatureEnabled(G.PhysicalPixelRendering,q.ANIMATING))}constructor(e){super(e),this.constraintsManager=null,this.ready=!1,this._windowDevicePixelRatio=1,this._devicePixelRatioOverride=null,this._updatingIgnoreRenderState=!1,this.test={viewStateManager:this,contentCameraResetState:new Map,setDevicePixelRatio:e=>this._devicePixelRatioOverride=e,renderState:null,get maximumPixelRatio(){return this.viewStateManager.view.qualitySettings.maximumPixelRatio},set updatingIgnoreRenderState(e){this.viewStateManager._updatingIgnoreRenderState=e},get updatingIgnoreRenderState(){return this.viewStateManager._updatingIgnoreRenderState||null!=this.renderState}},this._propertiesPool=new D({frustum:O},this),this._cameraSetByUser=!1,this._gotoOperation=null,this._cameraChangeTime=0,this._tmpCanvasSize=new K}initialize(){this._cameraChangeTime=performance.now(),this.addHandles([o((()=>this.view.state.events),"before-camera-change",(e=>e&&this._updateElevation(e))),n((()=>this.view.state?.camera),((e,t)=>this._cameraChangedHandler(e,t)),h)]),l((()=>this.view.state?.camera),(e=>this._updateElevation(e)),{once:!0,sync:!0}),this.addHandles([p({prepare:()=>this._prepareFrame()}),n((()=>this.view.state.cameraController),(()=>{this._cameraSetByUser=!0,this.removeHandles(te)})),o((()=>this.view.state.events),"camera-projection-changed",(()=>this.notifyChange("scale")))])}destroy(){this.exit(),this._propertiesPool=s(this._propertiesPool)}init(){this.constraintsManager=new S({view:this.view}),this._prepareFrame();const e=this._getInitialProperties();this._cameraSetByUser=!1,this._set("ready",!0);for(const t of e)this.set(t.name,t.value);if(!this._cameraSetByUser){const e=this.view.get("map.initialViewProperties.viewpoint")||this.view.initialExtent;e&&this.isCompatible(e)?this._setInitialView(e):this.view.state.viewingMode===f.Local&&this.addHandles(l((()=>this.view.basemapTerrain.ready),(()=>{this.removeHandles(te),this._setInitialView(this.view.dataExtent)}),{once:!0,initial:!0}),te)}}exit(){this._cancelGoToOperation(),this.ready&&(this._override("padding",this.padding),this._set("ready",!1),this._clearOverride("hasInitialView"),this._cameraSetByUser=!1,this.removeHandles(te),this.constraintsManager=s(this.constraintsManager))}async goTo(e,t){const i={animate:!0,...t};return null!=this._gotoOperation&&this._gotoOperation.abort(i.animate),this._gotoOperation=new T(e,i,this.view),this.view.resourceController.scheduler.stopFrame(),this._gotoOperation.promise}debugSetCameraOnContent(){this.setStateCamera(x(this.view),{applyConstraints:!1})}step(e){const t=this.view.state,i=t?.cameraController;i&&(t.updateCamera((t=>i.stepController(e,t))),i.steppingFinished&&i.finishController())}_cancelGoToOperation(){null!=this._gotoOperation&&(this._gotoOperation.abort(),this._gotoOperation=null)}_getInitialProperties(){const e=new Set,t=[];for(const{propertyName:i,overrides:a}of X){const r=e.has(i),s=this._isOverridden(i);!r&&s&&t.push({name:i,value:this._get(i)}),this._clearOverride(i),(r||s)&&a.forEach((t=>e.add(t)))}return t}_setInitialView(e){if(null==e||this._cameraSetByUser)return;if(e instanceof t)return void this.setStateCamera(j(this.view,e),{applyConstraints:!1});if(e instanceof i){if(e.targetGeometry instanceof y){const t=A(this.view,e.targetGeometry,0,.5,N.LOCKED);return void(null!=t&&this.setStateCamera(j(this.view,t),{applyConstraints:!0}))}const t={applyConstraints:!e.camera},i=this._viewpointToCamera(e);return void this.setStateCamera(i,t)}const a=A(this.view,e,0,.5,N.LOCKED);null!=a&&this.setStateCamera(j(this.view,a),{applyConstraints:!0})}_updatePropertyBeforeReady(e,t){return!this.ready&&(this._override(e,t),t&&Q.includes(e)&&this._override("hasInitialView",!0),!0)}isCompatible(e){return null!=e&&(e instanceof i?e.camera?this.isCompatible(e.camera):this.isCompatible(e.targetGeometry):e instanceof t?this.isCompatible(e.position):e.spatialReference&&C(e.spatialReference,this.view.spatialReference))}_getPreservingHeadingTilt(e=Y){return this._cameraSetByUser?(e.heading=this.camera.heading,e.tilt=this.camera.tilt):(e.heading=0,e.tilt=.5),e}_centerPointAtDistanceToCamera(e,t,i=$){const{heading:a,tilt:r}=this._getPreservingHeadingTilt(),s=H(this.view,a,r,e,t,N.ADJUST);return null==s?null:(i.copyFrom(this.view.state.camera),i.eye=s.eye,i.center=s.center,i.up=s.up,i)}_centerToCamera(e){const t=this.view.pointsOfInterest.centerOnContent;t.runTask();const i=t.distance;return this._centerPointAtDistanceToCamera(e,i)}_extentToCamera(e){const{heading:t,tilt:i}=this._getPreservingHeadingTilt(),a=A(this.view,e,t,i,N.ADJUST,Z);return a?j(this.view,a):null}_scaleToCamera(e){if(null==e)return null;const t=this.view.pointsOfInterest.centerOnContent;t.runTask();const i=t.renderLocation,a=t.location.latitude;if(null==a)return null;const r=L(this.view,e,a);return this._centerPointAtDistanceToCamera(i,r)}_zoomToCamera(e){return this._scaleToCamera(B(this.view,e))}_viewpointToCamera(e){return j(this.view,V(this.view,e))}setStateCamera(e,t){return!(null==e||!this.view.state.stopActiveCameraController())&&(this._cameraSetByUser=!0,t.doNotCancelGoToOperation||this._cancelGoToOperation(),this.view.state.updateCamera((i=>{t.positionAndOrientationOnly?(i.eye=e.eye,i.center=e.center,i.up=e.up):i.copyFrom(e),t.applyConstraints&&R(this.view,i)})),t.applyConstraints||(this.view.state.cameraController=new b({view:this.view,desiredCamera:e})),!0)}_prepareFrame(){const{surface:e,canvas:t}=this.view;if(!e||!t)return;this._windowDevicePixelRatio=window.devicePixelRatio;const i=this._computeCanvasSize();if(0!==i.width&&0!==i.height&&(t.width===i.width&&t.height===i.height||(t.width=i.width,t.height=i.height),this.view.state)){const e=this.view.state.camera;e.fullWidth===i.width&&e.fullHeight===i.height&&e.pixelRatio===i.pixelRatio||($.copyFrom(e),$.pixelRatio!==i.pixelRatio&&(this._paddingToArray(this.padding,i.pixelRatio,ee),$.padding=ee),$.fullWidth=i.width,$.fullHeight=i.height,$.pixelRatio=i.pixelRatio,this.view.state.camera=$),this._updateViewState()}}_updateElevation(e){const t=this.view.basemapTerrain&&this.view.basemapTerrain.spatialReference,i=this.view.renderCoordsHelper?.getAltitude(e.eye)??0,a=t?P(this.view,e.eye):0;e.relativeElevation=i-a}_updateViewState(){null!=this.test.renderState?this.view.state.mode=this.test.renderState:this.view.animation?this.view.state.mode=q.ANIMATING:this.view.interacting?this.view.state.mode=q.INTERACTING:(this.view.state.mode===q.ANIMATING&&(this._cameraChangeTime=0),performance.now()-this._cameraChangeTime<=ae?this.view.state.mode=q.INTERACTING:this.view.state.mode=q.IDLE),this.view.state.rasterPixelRatio=this._rasterPixelRatio}_cameraChangedHandler(e,t){e&&t&&e.almostEquals(t)||(this._cameraChangeTime=performance.now(),this._updateViewState())}};e([m({type:t,dependsOn:["view.state.camera","ready"]})],J.prototype,"camera",null),e([m({type:t,dependsOn:["view.state.contentCamera","ready"]})],J.prototype,"contentCamera",null),e([m({type:_})],J.prototype,"center",null),e([m({type:y})],J.prototype,"extent",null),e([m({readOnly:!0})],J.prototype,"frustum",null),e([m({readOnly:!0})],J.prototype,"hasInitialView",null),e([m({readOnly:!0,type:Boolean})],J.prototype,"ready",void 0),e([m({type:Number})],J.prototype,"scale",null),e([m()],J.prototype,"padding",null),e([m({readOnly:!0})],J.prototype,"screenCenter",null),e([m({constructOnly:!0})],J.prototype,"view",void 0),e([m({type:i})],J.prototype,"viewpoint",null),e([m({type:Number})],J.prototype,"zoom",null),e([m({readOnly:!0})],J.prototype,"_rasterPixelRatio",null),e([m({readOnly:!0})],J.prototype,"_usePhysicalPixelRendering",null),e([m({readOnly:!0})],J.prototype,"_usePhysicalPixelRenderingAny",null),e([m()],J.prototype,"_windowDevicePixelRatio",void 0),e([m()],J.prototype,"_devicePixelRatioOverride",void 0),J=e([d("esri.views.3d.state.ViewStateManager")],J);class K{constructor(){this.width=0,this.height=0,this.pixelRatio=1}}const Q=["camera","viewpoint","extent","scale","center","zoom"],X=[{propertyName:"camera",overrides:["viewpoint"]},{propertyName:"viewpoint",overrides:["extent"]},{propertyName:"extent",overrides:["center","scale"]},{propertyName:"center",overrides:[]},{propertyName:"scale",overrides:["zoom"]},{propertyName:"zoom",overrides:[]},{propertyName:"padding",overrides:[]}],Y={heading:0,tilt:0},Z=new t,$=new k,ee=g(),te="pending-initial-view",ie="content-camera-reset",ae=300,re=100;export{re as INTERACTING_TIMEOUT,J as ViewStateManager};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Camera.js";import i from"../../../Viewpoint.js";import r from"../../../core/Accessor.js";import a from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{watch as n,on as o,sync as h,when as l}from"../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../core/scheduling.js";import{createScreenPoint as c}from"../../../core/screenUtils.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{d as v}from"../../../chunks/vec3.js";import{g as u}from"../../../chunks/vec3f64.js";import{s as w}from"../../../chunks/vec4.js";import{c as g}from"../../../chunks/vec4f64.js";import y from"../../../geometry/Extent.js";import C from"../../../geometry/Point.js";import{canProject as _}from"../../../geometry/support/webMercatorUtils.js";import{ViewingMode as f}from"../../ViewingMode.js";import{applyAll as R}from"../camera/constraintUtils.js";import{cameraOnContentAlongViewDirection as x,surfaceElevationBelowRenderLocation as P}from"../camera/intersectionUtils.js";import{ConstraintsManager as S}from"./ConstraintsManager.js";import{Frustum as O}from"./Frustum.js";import{GoToOperation as T}from"./GoToOperation.js";import{SurfaceCollisionCorrectionController as b}from"./controllers/SurfaceCollisionCorrectionController.js";import{internalToExternal as I,externalToInternal as j,toExtent as M,distanceToScale as z,scaleToZoom as E,fromExtent as A,OrientationMode as N,getObserverForPointAtDistance as H,scaleToDistance as L,zoomToScale as B}from"../support/cameraUtils.js";import{PropertiesPool as D}from"../support/PropertiesPool.js";import{fromCamera as U,toCamera as V}from"../support/viewpointUtils.js";import{Camera as F,PaddingSide as k}from"../webgl-engine/lib/Camera.js";import{RenderFeature as G}from"../webgl-engine/lib/RenderFeature.js";import{RenderState as q}from"../../support/RenderState.js";import{ensureAttachmentMaxSize as W}from"../../webgl/FramebufferObject.js";let J=class extends r{get camera(){const e=this._get("camera");if(!this.ready)return e;const t=I(this.view,this.view.state.camera,Z);return t&&e&&t.equals(e)?e:t.clone()}set camera(e){this._updatePropertyBeforeReady("camera",e)||(this.view.elevationProvider?.enableElevationCache(!0),this.setStateCamera(j(this.view,e),{applyConstraints:!1})||a.getLogger(this).error("#camera=","Invalid camera",e),this.view.elevationProvider?.enableElevationCache(!1))}get contentCamera(){const e=this._get("contentCamera");if(!this.ready)return e;const t=I(this.view,this.view.state.contentCamera,Z);return t&&e&&t.equals(e)?e:t.clone()}set contentCamera(e){if(this._updatePropertyBeforeReady("contentCamera",e))return;const t=j(this.view,e);null!=t?(this._updateElevation(t),this.view.state.contentCamera=t):this.view.state.contentCamera=null}installContentCameraReset(e){if(this.removeHandles(ie),this.test.contentCameraResetState.clear(),!this.view.state.fixedContentCamera)return!1;const t=this.zoom,i=this.view.state.camera.distance**2,r=u(this.view.state.camera.center),a=e.sticky?this.contentCamera.clone():null;return this.addHandles([n((()=>this.contentCamera),(()=>{e.sticky||(this.removeHandles(ie),this.test.contentCameraResetState.clear())})),n((()=>this.zoom),(e=>{void 0!==e&&void 0!==t&&(this.test.contentCameraResetState.set("view.zoom",Math.abs(e-t)/2),Math.abs(e-t)>2?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=a))})),n((()=>this.view.state.camera),(e=>{const t=v(r,e.center);this.test.contentCameraResetState.set("camera.center",t/i),t>i?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=a)}))],ie),!0}get center(){return this.ready?this.view.pointsOfInterest.centerOnContent.location:this._get("center")}set center(e){this._updatePropertyBeforeReady("center",e)||(e?this.isCompatible(e)?this.setStateCamera(this._centerToCamera(e),{applyConstraints:!0})?this.view.pointsOfInterest.centerOnContent.runTask():a.getLogger(this).error("#center=","Invalid center",e):a.getLogger(this).error("#center=","Center has an incompatible spatial reference (center: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):a.getLogger(this).error("#center=","Center may not be null or undefined"))}get extent(){if(!this.ready)return this._get("extent");const e=this.view,t=M(e,e.state.camera,e.pointsOfInterest.centerOnContent.renderLocation);return null!=t?t:this._get("extent")}set extent(e){this._updatePropertyBeforeReady("extent",e)||(e?this.isCompatible(e)?this.setStateCamera(this._extentToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#extent=","Invalid extent",e):a.getLogger(this).error("#extent=","Extent has an incompatible spatial reference (extent: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):a.getLogger(this).error("#extent=","Extent may not be null or undefined"))}get frustum(){const e=this._propertiesPool.get("frustum");return e.renderCoordsHelper=this.view.renderCoordsHelper,e.update(this.view.state.camera),e}get hasInitialView(){return!!this.view.get("map.initialViewProperties.viewpoint")}get scale(){if(this.ready){const e=this.view.pointsOfInterest.centerOnContent;return z(this.view,e.distance,e.location.latitude)}return this._get("scale")}set scale(e){this._updatePropertyBeforeReady("scale",e)||this.setStateCamera(this._scaleToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#scale=","Invalid scale",e)}get padding(){if(!this.ready)return this._get("padding");const e=this.view.state.camera,t=e.padding,i=e.pixelRatio,r=this._get("padding"),a=Math.round(t[k.TOP]/i),s=Math.round(t[k.RIGHT]/i),n=Math.round(t[k.BOTTOM]/i),o=Math.round(t[k.LEFT]/i);return null!=r&&r.top===a&&r.right===s&&r.bottom===n&&r.left===o?r:{top:a,right:s,bottom:n,left:o}}set padding(e){this._updatePropertyBeforeReady("padding",e)||(this._paddingToArray(e,this.view.state.camera.pixelRatio,ee),this.view.state.updateCamera((e=>e.padding=ee)))}_paddingToArray(e,t,i){e?w(i,e.top||0,e.right||0,e.bottom||0,e.left||0):w(i,0,0,0,0);for(let r=0;r<4;r++)i[r]=Math.round(i[r]*t)}get screenCenter(){const e=this.padding;return c((this.view.width-(e.left+e.right))/2+e.left,(this.view.height-(e.top+e.bottom))/2+e.top)}get viewpoint(){return this.ready?U(this.view,this.camera):this._get("viewpoint")}set viewpoint(e){if(!this._updatePropertyBeforeReady("viewpoint",e))if(e)if(this.isCompatible(e))this.setStateCamera(this._viewpointToCamera(e),{applyConstraints:!e.camera})||a.getLogger(this).error("#viewpoint=","Invalid viewpoint",e);else{const t=null!=e.camera?e.camera.position:e.targetGeometry,i=null!=t&&t.spatialReference;a.getLogger(this).error("#viewpoint=","Viewpoint has an incompatible spatial reference (viewpoint: "+(i?i.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e)}else a.getLogger(this).error("#viewpoint=","Viewpoint may not be null or undefined")}get zoom(){return this.ready?E(this.view,this.scale):this._get("zoom")}set zoom(e){this._updatePropertyBeforeReady("zoom",e)||void 0===e||this.setStateCamera(this._zoomToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#zoom=","Invalid zoom",e)}_computeCanvasSize(){if(this._devicePixelRatioOverride)return this.view.state.contentPixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*this._devicePixelRatioOverride),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*this._devicePixelRatioOverride),this._tmpCanvasSize.pixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize;const e=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio),t=this._usePhysicalPixelRendering?this._windowDevicePixelRatio:e,i=Math.min(1,this.view.resourceController.memoryController.memoryFactor/.75),r=t*Math.sqrt(i);this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*r),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*r);const a=this.view._stage.renderView.renderingContext.parameters.maxTextureSize;return W(this._tmpCanvasSize,a)?this._tmpCanvasSize.pixelRatio=r:this._tmpCanvasSize.pixelRatio=this._tmpCanvasSize.width>0?this._tmpCanvasSize.width/this.view.surface.clientWidth:r,this.view.state&&(this.view.state.contentPixelRatio=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)),this._tmpCanvasSize}get _rasterPixelRatio(){return null!=this._devicePixelRatioOverride?this._devicePixelRatioOverride:this._usePhysicalPixelRenderingAny?this._windowDevicePixelRatio:Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)}get _usePhysicalPixelRendering(){return this.view?._stage?.renderer.isFeatureEnabled(G.PhysicalPixelRendering)??!1}get _usePhysicalPixelRenderingAny(){const e=this.view?._stage?.renderer;return e&&(e.isFeatureEnabled(G.PhysicalPixelRendering,q.IDLE)||e.isFeatureEnabled(G.PhysicalPixelRendering,q.INTERACTING)||e.isFeatureEnabled(G.PhysicalPixelRendering,q.ANIMATING))}constructor(e){super(e),this.constraintsManager=null,this.ready=!1,this._windowDevicePixelRatio=1,this._devicePixelRatioOverride=null,this._updatingIgnoreRenderState=!1,this.test={viewStateManager:this,contentCameraResetState:new Map,setDevicePixelRatio:e=>this._devicePixelRatioOverride=e,renderState:null,get maximumPixelRatio(){return this.viewStateManager.view.qualitySettings.maximumPixelRatio},set updatingIgnoreRenderState(e){this.viewStateManager._updatingIgnoreRenderState=e},get updatingIgnoreRenderState(){return this.viewStateManager._updatingIgnoreRenderState||null!=this.renderState}},this._propertiesPool=new D({frustum:O},this),this._cameraSetByUser=!1,this._gotoOperation=null,this._cameraChangeTime=0,this._tmpCanvasSize=new K}initialize(){this._cameraChangeTime=performance.now(),this.addHandles([o((()=>this.view.state.events),"before-camera-change",(e=>e&&this._updateElevation(e))),n((()=>this.view.state?.camera),((e,t)=>this._cameraChangedHandler(e,t)),h)]),l((()=>this.view.state?.camera),(e=>this._updateElevation(e)),{once:!0,sync:!0}),this.addHandles([p({prepare:()=>this._prepareFrame()}),n((()=>this.view.state.cameraController),(()=>{this._cameraSetByUser=!0,this.removeHandles(te)})),o((()=>this.view.state.events),"camera-projection-changed",(()=>this.notifyChange("scale")))])}destroy(){this.exit(),this._propertiesPool=s(this._propertiesPool)}init(){this.constraintsManager=new S({view:this.view}),this._prepareFrame();const e=this._getInitialProperties();this._cameraSetByUser=!1,this._set("ready",!0);for(const t of e)this.set(t.name,t.value);if(!this._cameraSetByUser){const e=this.view.get("map.initialViewProperties.viewpoint")||this.view.initialExtent;e&&this.isCompatible(e)?this._setInitialView(e):this.view.state.viewingMode===f.Local&&this.addHandles(l((()=>this.view.basemapTerrain.ready),(()=>{this.removeHandles(te),this._setInitialView(this.view.dataExtent)}),{once:!0,initial:!0}),te)}}exit(){this._cancelGoToOperation(),this.ready&&(this._override("padding",this.padding),this._set("ready",!1),this._clearOverride("hasInitialView"),this._cameraSetByUser=!1,this.removeHandles(te),this.constraintsManager=s(this.constraintsManager))}async goTo(e,t){const i={animate:!0,...t};return null!=this._gotoOperation&&this._gotoOperation.abort(i.animate),this._gotoOperation=new T(e,i,this.view),this.view.resourceController.scheduler.stopFrame(),this._gotoOperation.promise}debugSetCameraOnContent(){this.setStateCamera(x(this.view),{applyConstraints:!1})}step(e){const t=this.view.state,i=t?.cameraController;i&&(t.updateCamera((t=>i.stepController(e,t))),i.steppingFinished&&i.finishController())}_cancelGoToOperation(){null!=this._gotoOperation&&(this._gotoOperation.abort(),this._gotoOperation=null)}_getInitialProperties(){const e=new Set,t=[];for(const{propertyName:i,overrides:r}of X){const a=e.has(i),s=this._isOverridden(i);!a&&s&&t.push({name:i,value:this._get(i)}),this._clearOverride(i),(a||s)&&r.forEach((t=>e.add(t)))}return t}_setInitialView(e){if(null==e||this._cameraSetByUser)return;if(e instanceof t)return void this.setStateCamera(j(this.view,e),{applyConstraints:!1});if(e instanceof i){if(e.targetGeometry instanceof y){const t=A(this.view,e.targetGeometry,0,.5,N.LOCKED);return void(null!=t&&this.setStateCamera(j(this.view,t),{applyConstraints:!0}))}const t={applyConstraints:!e.camera},i=this._viewpointToCamera(e);return void this.setStateCamera(i,t)}const r=A(this.view,e,0,.5,N.LOCKED);null!=r&&this.setStateCamera(j(this.view,r),{applyConstraints:!0})}_updatePropertyBeforeReady(e,t){return!this.ready&&(this._override(e,t),t&&Q.includes(e)&&this._override("hasInitialView",!0),!0)}isCompatible(e){return null!=e&&(e instanceof i?e.camera?this.isCompatible(e.camera):this.isCompatible(e.targetGeometry):e instanceof t?this.isCompatible(e.position):e.spatialReference&&_(e.spatialReference,this.view.spatialReference))}_getPreservingHeadingTilt(e=Y){return this._cameraSetByUser?(e.heading=this.camera.heading,e.tilt=this.camera.tilt):(e.heading=0,e.tilt=.5),e}_centerPointAtDistanceToCamera(e,t,i=$){const{heading:r,tilt:a}=this._getPreservingHeadingTilt(),s=H(this.view,r,a,e,t,N.ADJUST);return null==s?null:(i.copyFrom(this.view.state.camera),i.eye=s.eye,i.center=s.center,i.up=s.up,i)}_centerToCamera(e){const t=this.view.pointsOfInterest.centerOnContent;t.runTask();const i=t.distance;return this._centerPointAtDistanceToCamera(e,i)}_extentToCamera(e){const{heading:t,tilt:i}=this._getPreservingHeadingTilt(),r=A(this.view,e,t,i,N.ADJUST,Z);return r?j(this.view,r):null}_scaleToCamera(e){if(null==e)return null;const t=this.view.pointsOfInterest.centerOnContent;t.runTask();const i=t.renderLocation,r=t.location.latitude;if(null==r)return null;const a=L(this.view,e,r);return this._centerPointAtDistanceToCamera(i,a)}_zoomToCamera(e){return this._scaleToCamera(B(this.view,e))}_viewpointToCamera(e){return j(this.view,V(this.view,e))}setStateCamera(e,t){return!(null==e||!this.view.state.stopActiveCameraController())&&(this._cameraSetByUser=!0,t.doNotCancelGoToOperation||this._cancelGoToOperation(),this.view.state.updateCamera((i=>{t.positionAndOrientationOnly?(i.eye=e.eye,i.center=e.center,i.up=e.up):i.copyFrom(e),t.applyConstraints&&R(this.view,i)})),t.applyConstraints||(this.view.state.cameraController=new b({view:this.view,desiredCamera:e})),!0)}_prepareFrame(){const{surface:e,canvas:t}=this.view;if(!e||!t)return;this._windowDevicePixelRatio=window.devicePixelRatio;const i=this._computeCanvasSize();if(0!==i.width&&0!==i.height&&(t.width===i.width&&t.height===i.height||(t.width=i.width,t.height=i.height),this.view.state)){const e=this.view.state.camera;e.fullWidth===i.width&&e.fullHeight===i.height&&e.pixelRatio===i.pixelRatio||($.copyFrom(e),$.pixelRatio!==i.pixelRatio&&(this._paddingToArray(this.padding,i.pixelRatio,ee),$.padding=ee),$.fullWidth=i.width,$.fullHeight=i.height,$.pixelRatio=i.pixelRatio,this.view.state.camera=$),this._updateViewState()}}_updateElevation(e){const t=this.view.basemapTerrain&&this.view.basemapTerrain.spatialReference,i=this.view.renderCoordsHelper?.getAltitude(e.eye)??0,r=t?P(this.view,e.eye):0;e.relativeElevation=i-r}_updateViewState(){null!=this.test.renderState?this.view.state.mode=this.test.renderState:this.view.animation?this.view.state.mode=q.ANIMATING:this.view.interacting?this.view.state.mode=q.INTERACTING:(this.view.state.mode===q.ANIMATING&&(this._cameraChangeTime=0),performance.now()-this._cameraChangeTime<=re?this.view.state.mode=q.INTERACTING:this.view.state.mode=q.IDLE),this.view.state.rasterPixelRatio=this._rasterPixelRatio}_cameraChangedHandler(e,t){e&&t&&e.almostEquals(t)||(this._cameraChangeTime=performance.now(),this._updateViewState())}};e([m({type:t,dependsOn:["view.state.camera","ready"]})],J.prototype,"camera",null),e([m({type:t,dependsOn:["view.state.contentCamera","ready"]})],J.prototype,"contentCamera",null),e([m({type:C})],J.prototype,"center",null),e([m({type:y})],J.prototype,"extent",null),e([m({readOnly:!0})],J.prototype,"frustum",null),e([m({readOnly:!0})],J.prototype,"hasInitialView",null),e([m({readOnly:!0,type:Boolean})],J.prototype,"ready",void 0),e([m({type:Number})],J.prototype,"scale",null),e([m()],J.prototype,"padding",null),e([m({readOnly:!0})],J.prototype,"screenCenter",null),e([m({constructOnly:!0})],J.prototype,"view",void 0),e([m({type:i})],J.prototype,"viewpoint",null),e([m({type:Number})],J.prototype,"zoom",null),e([m({readOnly:!0})],J.prototype,"_rasterPixelRatio",null),e([m({readOnly:!0})],J.prototype,"_usePhysicalPixelRendering",null),e([m({readOnly:!0})],J.prototype,"_usePhysicalPixelRenderingAny",null),e([m()],J.prototype,"_windowDevicePixelRatio",void 0),e([m()],J.prototype,"_devicePixelRatioOverride",void 0),J=e([d("esri.views.3d.state.ViewStateManager")],J);class K{constructor(){this.width=0,this.height=0,this.pixelRatio=1}}const Q=["camera","viewpoint","extent","scale","center","zoom"],X=[{propertyName:"camera",overrides:["viewpoint"]},{propertyName:"viewpoint",overrides:["extent"]},{propertyName:"extent",overrides:["center","scale"]},{propertyName:"center",overrides:[]},{propertyName:"scale",overrides:["zoom"]},{propertyName:"zoom",overrides:[]},{propertyName:"padding",overrides:[]}],Y={heading:0,tilt:0},Z=new t,$=new F,ee=g(),te="pending-initial-view",ie="content-camera-reset",re=300,ae=100;export{ae as INTERACTING_TIMEOUT,J as ViewStateManager};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../../core/has.js";import{Milliseconds as e}from"../../../core/time.js";class a{static isValidProfile(e){return e in a.profiles}static getDefaultProfile(){return has("esri-iPhone")?"low":"medium"}static apply(e,
|
|
5
|
+
import has from"../../../core/has.js";import{Milliseconds as e}from"../../../core/time.js";class a{static isValidProfile(e){return e in a.profiles}static getDefaultProfile(){return has("esri-iPhone")?"low":"medium"}static apply(e,o){const i=a.profiles[e];o.graphics3D.maxTotalNumberOfFeatures=i.graphics3D.maxTotalNumberOfFeatures,o.graphics3D.maxTotalNumberOfPrimitives=i.graphics3D.maxTotalNumberOfPrimitives,o.graphics3D.polygonLodFactor=i.graphics3D.polygonLodFactor,o.graphics3D.polylineLodFactor=i.graphics3D.polylineLodFactor,o.graphics3D.snapshotAvailable=i.graphics3D.snapshotAvailable,o.graphics3D.skipHighSymbolLods=i.graphics3D.skipHighSymbolLods;const t=o.sceneService.object,r=i.sceneService.object;t.lodFactor=r.lodFactor,t.lodCrossfadeinDuration=r.lodCrossfadeinDuration,t.lodCrossfadeoutDuration=r.lodCrossfadeoutDuration,t.lodCrossfadeUncoveredDuration=r.lodCrossfadeUncoveredDuration,o.sceneService.point.lodFactor=i.sceneService.point.lodFactor,o.sceneService.integratedMesh.lodFactor=i.sceneService.integratedMesh.lodFactor,o.sceneService.pointCloud.lodFactor=i.sceneService.pointCloud.lodFactor,o.sceneService.uncompressedTextureDownsamplingEnabled=i.sceneService.uncompressedTextureDownsamplingEnabled,o.tiledSurface.lodBias=i.tiledSurface.lodBias,o.tiledSurface.angledSplitBias=i.tiledSurface.angledSplitBias,o.tiledSurface.reduceTileLevelDifferences=i.tiledSurface.reduceTileLevelDifferences,o.tiledSurface.textureFadeDuration=i.tiledSurface.textureFadeDuration,o.heatmap.pixelRatio=i.heatmap.pixelRatio,o.heatmap.maxTotalNumberOfFeatures=i.heatmap.maxTotalNumberOfFeatures,o.fadeDuration=i.fadeDuration,o.antialiasingEnabled=i.antialiasingEnabled,o.physicallyBasedRenderingEnabled=i.physicalBasedRenderingEnabled,o.highQualityTransparency=i.highQualityTransparency,o.highResolutionAtmosphere=i.highResolutionAtmosphere,o.reflections=i.reflections,o.ambientOcclusion=i.ambientOcclusion,o.memoryLimit=i.memoryLimit,o.additionalCacheMemory=i.additionalCacheMemory,o.frameRate=i.frameRate,o.maximumPixelRatio=i.maximumPixelRatio}}a.test={reset(){const e=i();for(const o of Object.keys(e))a.profiles[o]=e[o]}};const o={IPhone12Pro:120,GalaxyS20:200,FullHD:240,SurfacePro7:300,FullHDRetina:430};function i(){const a=!!has("esri-mobile"),i=!!has("ios"),t=e(400);return{low:{graphics3D:{maxTotalNumberOfFeatures:25e3,maxTotalNumberOfPrimitives:85e4,polygonLodFactor:.5,polylineLodFactor:1,snapshotAvailable:!1,skipHighSymbolLods:!0},heatmap:{pixelRatio:.125,maxTotalNumberOfFeatures:25e3},sceneService:{object:{lodFactor:.2,lodCrossfadeinDuration:e(0),lodCrossfadeoutDuration:e(0),lodCrossfadeUncoveredDuration:e(0)},point:{lodFactor:1},integratedMesh:{lodFactor:.6},pointCloud:{lodFactor:.5},uncompressedTextureDownsamplingEnabled:!0},tiledSurface:{lodBias:-1,angledSplitBias:.5,reduceTileLevelDifferences:!1,textureFadeDuration:e(0)},fadeDuration:e(0),antialiasingEnabled:!1,physicalBasedRenderingEnabled:!1,highQualityTransparency:!1,highResolutionAtmosphere:!1,reflections:!1,ambientOcclusion:!1,memoryLimit:200+o.IPhone12Pro,additionalCacheMemory:0,frameRate:0,maximumPixelRatio:1},medium:{graphics3D:{maxTotalNumberOfFeatures:5e4,maxTotalNumberOfPrimitives:17e5,polygonLodFactor:a?.8:1,polylineLodFactor:a?1.2:1.5,snapshotAvailable:!i,skipHighSymbolLods:!1},heatmap:{pixelRatio:.25,maxTotalNumberOfFeatures:5e4},sceneService:{object:{lodFactor:1,lodCrossfadeinDuration:e(0),lodCrossfadeoutDuration:e(0),lodCrossfadeUncoveredDuration:t},point:{lodFactor:1},integratedMesh:{lodFactor:1},pointCloud:{lodFactor:1},uncompressedTextureDownsamplingEnabled:a},tiledSurface:{lodBias:0,angledSplitBias:1,reduceTileLevelDifferences:!has("disable-feature:reduce-map-tile-levels"),textureFadeDuration:t},fadeDuration:t,antialiasingEnabled:!0,physicalBasedRenderingEnabled:!0,highQualityTransparency:!0,highResolutionAtmosphere:!1,reflections:!1,ambientOcclusion:!1,memoryLimit:a?600+o.GalaxyS20:750+o.FullHD,additionalCacheMemory:a?-100:150,frameRate:0,maximumPixelRatio:1},high:{graphics3D:{maxTotalNumberOfFeatures:5e4,maxTotalNumberOfPrimitives:17e5,polygonLodFactor:a?1.2:2,polylineLodFactor:a?1.2:2,snapshotAvailable:!i,skipHighSymbolLods:!1},heatmap:{pixelRatio:.5,maxTotalNumberOfFeatures:5e4},sceneService:{object:{lodFactor:1,lodCrossfadeinDuration:e(0),lodCrossfadeoutDuration:e(0),lodCrossfadeUncoveredDuration:t},point:{lodFactor:1},integratedMesh:{lodFactor:1},pointCloud:{lodFactor:1},uncompressedTextureDownsamplingEnabled:!1},tiledSurface:{lodBias:0,angledSplitBias:1,reduceTileLevelDifferences:!has("disable-feature:reduce-map-tile-levels"),textureFadeDuration:t},fadeDuration:t,antialiasingEnabled:!0,physicalBasedRenderingEnabled:!0,highQualityTransparency:!0,highResolutionAtmosphere:!0,reflections:!0,ambientOcclusion:!0,memoryLimit:a?900+o.SurfacePro7:1500+o.FullHDRetina,additionalCacheMemory:a?-150:0,frameRate:0,maximumPixelRatio:a?1:1/0}}}!function(e){e.profiles=i()}(a||(a={}));const t=a;export{t 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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Accessor.js";import i from"../../../core/Logger.js";import{MemCacheStorage as s,MemCache as a}from"../../../core/MemCache.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{isMemoryManagedView as h}from"./MemoryManagedView.js";function y(t){return new c({view:t})}const u=1,l=1,m=.75,n=.6,d=1.3;let c=class extends e{constructor(t){super(t),this._quality=1,this._usedMemory=0,this._updating=!1,this.minQuality=.1,this._stableQuality=0,this._downscaleMemoryUsed=0,this._canFastRecover=!1,this._memoryPredicted=0,this._cacheStorage=new s,this._warnMemoryUsage=null,this._numQualityChanges=0,this._maxMemory=750,this._additionalCacheMemory=0}destroy(){this._cacheStorage.destroy()}get maxMemory(){return this._maxMemory}set maxMemory(t){null==t||t<=0||(this._stableQuality=0,this._canFastRecover=!1,this._maxMemory<t&&this._updateQuality(u),this._maxMemory=t)}get additionalCacheMemory(){return this._additionalCacheMemory}set additionalCacheMemory(t){null!=t&&(this._additionalCacheMemory=t)}get memoryFactor(){return this._quality}get updating(){return this._updating}get usedMemory(){return this._usedMemory}get usedCacheMemory(){return this._cacheStorage.size}newCache(t,e){return new a(t,this._cacheStorage,e)}resetStableQuality(){this._stableQuality=0}disableMemCache(){this.additionalCacheMemory=-4096}update(){if(this._updateMemory(),this._memoryPredicted<=0&&!this._updating)return;let t=this._layersUpdating();if(this._memoryPredicted<n&&this._canFastRecover)this._downscaleMemoryUsed=0,this._stableQuality=0,this._canFastRecover=!1,this._updateQuality(u);else if(t)(this._memoryPredicted>1.1*l||this._usedMemory>l)&&(this._stableQuality>0?(this._downscaleMemoryUsed=0,this._updateQuality(this._stableQuality)):this._quality>this.minQuality&&this._downscaleMemoryUsed<this._usedMemory&&(this._updateQuality(this._quality/d),this._downscaleMemoryUsed=this._usedMemory,this._canFastRecover=!1));else if(this._downscaleMemoryUsed=0,this._usedMemory>l)this._stableQuality=0,this._canFastRecover=!1,t=this._updateQuality(this._quality/d),this._downscaleMemoryUsed=this._memoryPredicted;else if(this._stableQuality!==this._quality)if(this._usedMemory<m&&this._quality<u){this._stableQuality=this._quality;const e=.05;t=this._updateQuality(this._quality+e)}else this._quality<1&&(this._canFastRecover=!0);this._updating=t}_updateQuality(t){return(t=Math.min(Math.max(t,this.minQuality),u))!==this._quality&&(this._quality=t,++this._numQualityChanges,!0)}_layersUpdating(){return this.view.allLayerViews.some((t=>!!t.updating))}_updateMemory(){if(!this.view)return;let t=(this.view.basemapTerrain?.usedMemory??0)+(this.view._stage?.renderer?.usedMemory??0)+(this.view.environmentManager?.usedMemory??0),e=0;this.view.allLayerViews&&this.view.allLayerViews.forEach((i=>{if(h(i)){const s=i.ignoresMemoryFactor?this._quality:1;t+=i.usedMemory*s,e+=i.unloadedMemory*s}}));const s=null==this._warnMemoryUsage||Math.round(10*t)!==Math.round(10*this._warnMemoryUsage),a=1048576*this.maxMemory;if(t>a&&s){this._warnMemoryUsage=t;const s=t=>(t/1048576).toLocaleString(void 0,{maximumFractionDigits:1})+" MB",r=Math.round(100*this._quality);i.getLogger(this).warn(`Memory Limit exceeded! Limit: ${s(a)} Current: ${s(t)} Projected: ${s(t+e)} Quality: ${r}%`)}this._usedMemory=t/a,this._memoryPredicted=(t+e)/a;const r=a-t;this._cacheStorage.maxSize=Math.max(0,r+1048576*this.additionalCacheMemory)}get test(){const t=this;return{cacheStorage:this._cacheStorage,resetQualityChanges:()=>{const e=t._numQualityChanges;return t._numQualityChanges=0,e}}}};t([r({constructOnly:!0})],c.prototype,"view",void 0),t([r()],c.prototype,"maxMemory",null),t([r()],c.prototype,"additionalCacheMemory",null),t([r({readOnly:!0})],c.prototype,"memoryFactor",null),t([r({readOnly:!0})],c.prototype,"updating",null),t([r({readOnly:!0})],c.prototype,"usedMemory",null),t([r({readOnly:!0})],c.prototype,"usedCacheMemory",null),t([r()],c.prototype,"_quality",void 0),t([r()],c.prototype,"_usedMemory",void 0),t([r()],c.prototype,"_updating",void 0),t([r()],c.prototype,"_stableQuality",void 0),t([r()],c.prototype,"_maxMemory",void 0),t([r()],c.prototype,"_additionalCacheMemory",void 0),c=t([o("esri.views.3d.support.MemoryController")],c);export{y as newMemoryController};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ByteSizeUnit as e}from"../../../core/ByteSizeUnit.js";import{isMemoryManagedLayerView as r}from"../layers/support/MemoryManagedLayerView.js";import o from"./LayerPerformanceInfo.js";import{isSurfaceLayerView as s}from"../terrain/terrainUtils.js";class t{constructor(t){if(this.totalMemory=0,this.usedMemory=0,this.quality=1,this.load=0,this.terrainMemory=0,this.edgesMemory=0,this.layerPerformanceInfos=new Array,this.cachedMemory=0,this.fboMemory=0,null!=t.resourceController){const r=t.resourceController.memoryController;this.totalMemory=(r.maxMemory??0)*e.MEGABYTES,this.usedMemory=Math.round(r.usedMemory*this.totalMemory),this.quality=r.memoryFactor,this.load=t.resourceController.scheduler.load,this.cachedMemory=r.usedCacheMemory}this.terrainMemory=t.basemapTerrain?.usedMemory??0,this.edgesMemory=t?._stage?.renderer?.edgeView?.usedMemory??0;const a=t?._stage?.renderer?.
|
|
5
|
+
import{ByteSizeUnit as e}from"../../../core/ByteSizeUnit.js";import{isMemoryManagedLayerView as r}from"../layers/support/MemoryManagedLayerView.js";import o from"./LayerPerformanceInfo.js";import{isSurfaceLayerView as s}from"../terrain/terrainUtils.js";class t{constructor(t){if(this.totalMemory=0,this.usedMemory=0,this.quality=1,this.load=0,this.terrainMemory=0,this.edgesMemory=0,this.layerPerformanceInfos=new Array,this.cachedMemory=0,this.fboMemory=0,null!=t.resourceController){const r=t.resourceController.memoryController;this.totalMemory=(r.maxMemory??0)*e.MEGABYTES,this.usedMemory=Math.round(r.usedMemory*this.totalMemory),this.quality=r.memoryFactor,this.load=t.resourceController.scheduler.load,this.cachedMemory=r.usedCacheMemory}this.terrainMemory=t.basemapTerrain?.usedMemory??0,this.edgesMemory=t?._stage?.renderer?.edgeView?.usedMemory??0;const a=t?._stage?.renderer?.memoryInfo;a&&(this.fboMemory=a.fbo+a.highlights+a.shadows+a.ssao),t.allLayerViews.items.forEach((e=>{(r(e)||s(e))&&this.layerPerformanceInfos.push(new o(e,t))})),this.layerPerformanceInfos.sort(((e,r)=>r.memory-e.memory))}}export{t 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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../Camera.js";import{Cyclical as n}from"../../../core/Cyclical.js";import t from"../../../core/Logger.js";import{deg2rad as r,rad2deg as i}from"../../../core/mathUtils.js";import{createResolver as
|
|
5
|
+
import e from"../../../Camera.js";import{Cyclical as n}from"../../../core/Cyclical.js";import t from"../../../core/Logger.js";import{deg2rad as r,rad2deg as i}from"../../../core/mathUtils.js";import{settleWithPromise as o,createResolver as a,throwIfAborted as l}from"../../../core/promiseUtils.js";import{g as s,a as c,j as u,c as f}from"../../../chunks/vec3.js";import{a as m,c as p}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as d}from"../../../geometry/ellipsoidUtils.js";import v from"../../../geometry/Point.js";import{projectPointToVector as h,projectVectorToVector as g,projectVectorToPoint as y,projectPointToVectorWithEngine as R,projectWithZConversion as w,project as x}from"../../../geometry/projection.js";import M from"../../../geometry/SpatialReference.js";import{ViewingMode as S}from"../../ViewingMode.js";import{cameraOnContentAlongViewDirection as T}from"../camera/intersectionUtils.js";import{t as j,c as z}from"../../../chunks/cameraUtilsPlanar.js";import{t as C,c as b}from"../../../chunks/cameraUtilsSpherical.js";import{getGreatCircleSpanAt as U}from"./earthUtils.js";import{getElevationAtPoint as P}from"./ElevationProvider.js";import{isSpatialReferenceSupported as A}from"../../support/spatialReferenceSupport.js";const D=t.getLogger("esri.views.3d.support.cameraUtils"),H=39.37,L=96,G=1,E=8,O=5,k=1,q=p(),I={heading:0,tilt:0},F=new v,J=new n(-20037508.342788905,20037508.342788905),W=new n(-180,180);var X;function K(e){return e.spatialReference||M.WGS84}function Y(e){return"global"===e.viewingMode?b:z}function N(e,n,t,r,i){return Y(e).headingTiltToDirectionUp(n,t,r,i)}function V(e,n){if(null==n)return null;const t=e.renderSpatialReference,i=Y(e).headingTiltToDirectionUp,o=p();if(!h(n.position,o,t))return null;const a=i(o,n.heading,n.tilt);s(a.direction,a.direction,e.state.camera.distance),c(a.direction,a.direction,o);const l=T(e,o,a.direction,a.up);return l.fov=r(n.fov),l}!function(e){e[e.LOCKED=0]="LOCKED",e[e.ADJUST=1]="ADJUST"}(X||(X={}));const Z=p();function B(n,t,r){const o=n.renderSpatialReference,a=ne(n,t.eye,t.viewForward,t.up,I);let l=K(n);return g(t.eye,o,Z,l)||(l=M.WGS84,g(t.eye,o,Z,l)),null==r?new e(new v(Z,l),a.heading,a.tilt,i(t.fov)):(r.position.x=Z[0],r.position.y=Z[1],r.position.z=Z[2],r.position.spatialReference=l,r.heading=a.heading,r.tilt=a.tilt,r.fov=i(t.fov),r)}function Q(e,n,t){const i=e.state.camera,o=i.width/2/i.pixelRatio;e.renderCoordsHelper.viewingMode===S.Global&&null!=t&&(n*=Math.cos(r(t))),n/=e.renderCoordsHelper.unitInMeters;return o/(L*H/n)/Math.tan(i.fovX/2)}function $(e,n,t){const i=e.state.camera,o=n*Math.tan(i.fovX/2),a=i.width/2/i.pixelRatio;let l=L*H/(a/o);return e.renderCoordsHelper.viewingMode===S.Global&&null!=t&&(l/=Math.cos(r(t))),l*e.renderCoordsHelper.unitInMeters}function _(e,n,t,r,i,o){return ee(e,n,Q(e,t,n.latitude),r,i,o)}function ee(e,n,t,r,i,o=null){if(ze(o)){const a=new je(o.signal);return ae(e,r.heading,r.tilt,n,t,i,a),void a.resolver.promise.then((n=>{const t=xe(e,n,r.fov);if(null!=t)return o.resolver.resolve(t);o.resolver.reject()}),(e=>o.resolver.reject(e)))}const a=ae(e,r.heading,r.tilt,n,t,i);return xe(e,a,r.fov,o)}function ne(e,n,t,r,i){return Y(e).directionToHeadingTilt(n,t,r,i)}function te(e,n){return!!(e.basemapTerrain&&e.renderCoordsHelper.fromRenderCoords(n,F,e.spatialReference)&&e.elevationProvider&&(P(e.elevationProvider,F)??0)>(F.z??0)-k)}async function re(e,n,t){if(!e.renderCoordsHelper.fromRenderCoords(n,F,e.spatialReference)||!e.elevationProvider)return!1;const r=F.z??0;return(await e.elevationProvider.queryElevation(F.x,F.y,r,F.spatialReference,"ground",t)??0)>r-k}async function ie(e,n,t){const r=p();if(n)if(n instanceof v){const{renderSpatialReference:i,basemapTerrain:o,elevationProvider:a}=e,l=n.spatialReference;if(await R(n,r,i,0,{signal:t}),null==n.z&&null!=o&&null!=a){const i=await a.queryElevation(n.x,n.y,n.z??0,l,"ground",t);return null!=i&&e.renderCoordsHelper.setAltitude(r,i),r}}else f(r,n);else f(r,e.state.camera.center);return r}function oe(e,n){const t=p();if(n&&n instanceof v){if(h(n,t,e.renderSpatialReference),null==n.z&&null!=e.basemapTerrain&&null!=e.elevationProvider){const r=P(e.elevationProvider,n);null!=r&&e.renderCoordsHelper.setAltitude(t,r)}}else f(t,n||e.state.camera.center);return t}function ae(e,n,t,r,i,o,a){const l=r&&r instanceof v?r:null;if(ze(a))return ie(e,r,a.signal).then((r=>{le(e,n,t,l,r,i,o,a)}),(e=>a.resolver.reject(e))),null;const s=oe(e,r);return le(e,n,t,l,s,i,o,a)}function le(e,n,t,r,i,o,a,l){if(null==r){const n=e.renderSpatialReference;if(null==(r=y(i,n,K(e))))return null}o=Math.max(o,e.state.constraints.minimumPoiDistance);const s=ve(e,n,t,i,o,a),c=(0,Y(e).eyeForCenterWithHeadingTilt)(i,o,s.heading,s.tilt);if(a===X.ADJUST&&"global"===e.viewingMode&&t>0){const s=()=>{const s=Re(e,i,o,ye(e,o,t,i));return a=t-s<1?X.LOCKED:X.ADJUST,le(e,n,s,r,i,o,a,l)},u=e.map.ground.navigationConstraint;if(!u||"stay-above"===u.type){if(te(e,c.eye))return s();if(ze(l))return re(e,c.eye,l.signal).then((e=>e?s():(l.resolver.resolve({eye:c.eye,up:c.up,center:m(i),heading:c.heading,tilt:c.tilt}),null))),null}}const u=!l||ze(l)?{center:p(),eye:p(),up:p(),tilt:0,heading:0}:l;return u.eye=c.eye,u.up=c.up,u.center=m(i),u.heading=c.heading,u.tilt=c.tilt,ze(l)&&l.resolver.resolve(u),u}function se(e,n){const{state:t,spatialReference:r}=e,i=n.spatialReference;return t.isGlobal&&A(i,S.Global)||t.isLocal&&r.equals(i)}function ce(e,n){let t,r,i;if(e.state.isGlobal){const e=new v(n.xmin,n.ymin,n.spatialReference),o=new v(n.xmax,n.ymax,n.spatialReference),a=n.spatialReference.isGeographic?W:J;t=new v({x:a.center(e.x,o.x),y:(o.y+e.y)/2,z:null!=n.zmax&&null!=n.zmin?(n.zmax+n.zmin)/2:void 0,spatialReference:n.spatialReference});const l=d(n.spatialReference),s=U(t,e,o);r=s.lon,i=s.lat,a.diff(e.x,o.x)>a.range/2&&(r+=l.halfCircumference),r=Math.min(r,l.halfCircumference),i=Math.min(i,l.halfCircumference)}else{const o=e.renderSpatialReference??n.spatialReference;o.equals(n.spatialReference)||(n=x(n,o)),r=n.xmax-n.xmin,i=n.ymax-n.ymin;const a=null!=n.zmax&&null!=n.zmin?(n.zmax+n.zmin)/2:void 0;t=new v({x:n.xmin+.5*r,y:n.ymin+.5*i,z:a,spatialReference:o})}const o=null!=n.zmax&&null!=n.zmin?n.zmax-n.zmin:0,a=e.state.camera,l=1/Math.tan(a.fovX/2),s=1/Math.tan(a.fovY/2),c=1/Math.tan(a.fov/2);return{center:t,distance:Math.max(.5*r*l,.5*i*s,.5*o*c)/G}}async function ue(e,n,t,r,i,o){const a=se(e,n)?n:await w(n,e.spatialReference,o);l(o);const{center:s,distance:c}=ce(e,a),u=new je(o?.signal);ae(e,t,r,s,c,i,u);const f=await u.resolver.promise;l(o);const m=xe(e,f,e.camera.fov);if(null==m)throw new Error("Failed to compute camera from observer.");return m}function fe(e,n,t,r,i,o=null){let a;try{a=se(e,n)?n:x(n,e.spatialReference)}catch(c){return null}const{center:l,distance:s}=ce(e,a);return xe(e,ae(e,t,r,l,s,i),e.camera.fov,o)}function me(e,n,t,r,i,a=null){return ze(a)?(o(a.resolver,ue(e,n,t,r,i,a)),null):fe(e,n,t,r,i,a)}function pe(e,n,t){const r=e.renderSpatialReference,i=y(t,r,K(e));if(null==i)return null;const o=Math.tan(n.fovX/2),a=Math.tan(n.fovY/2),l=u(n.eye,t),s=2*l*o*G,c=2*l*a*G;return"global"===e.viewingMode?C(e,i,s,c):j(e,i,s,c)}function de(e,n,t){const r=e.pointsOfInterest.centerOnSurfaceFrequent.distance;if(Math.log(t/r)/Math.LN2>E)return!0;const i=e.renderSpatialReference,o=K(e),a=y(n,i,o),l=y(e.pointsOfInterest.centerOnSurfaceFrequent.renderLocation,i,o);if(null==a||null==l)return!1;const s=Math.tan(.5*e.state.camera.fov)*r;return l.distance(a)/s>O}function ve(e,n,t,r,i,o){let a=0;return o===X.ADJUST&&de(e,r,i)?(n=0,a=ge(e,i,t,r)):a=we(e,r,i,t),a=e.state.constraints.clampTilt(i,a),{heading:n,tilt:t=Re(e,r,i,a)}}const he=.7;function ge(e,n,t,r){const i=we(e,r,n,t);if(!e.state.constraints.tilt)return i;const o=e.state.constraints.tilt(n);o.max=Math.min(o.max,.5*Math.PI);const a=o.min*(1-he)+o.max*he;return Math.min(i,a)}function ye(e,n,t,r){let i=we(e,r,n,t);if(!e.state.constraints.tilt)return i;const o=e.state.constraints.tilt(n);return i=Math.min(i,.5*Math.PI),o.min*(1-he)+i*he}function Re(e,n,t,r){return Y(e).lookAtTiltToEyeTilt(r,n,t)}function we(e,n,t,r){return Y(e).eyeTiltToLookAtTilt(r,n,t)}function xe(n,t,r,i){if(null==t)return null;const o=n.renderSpatialReference,a=y(t.eye,o,K(n));return null==a?null:null!=i?(i.position=a,i.heading=t.heading,i.tilt=t.tilt,i.fov=r,i):new e(a,t.heading,t.tilt,r)}function Me(e,n){const t=e.basemapTerrain?.tilingScheme;if(t)return t.levelAtScale(n);D.error("#scaleToZoom()","Cannot compute zoom from scale without a tiling scheme")}function Se(e,n){const t=e.basemapTerrain?.tilingScheme;if(t)return t.scaleAtLevel(n);D.error("#zoomToScale()","Cannot compute scale from zoom without a tiling scheme")}function Te(e,n){return g(n.center,e.renderSpatialReference,q,M.WGS84),$(e,n.distance,q[1])}class je{constructor(e){this.signal=e,this.resolver=a()}}function ze(e){return e&&"resolver"in e}export{je as AsyncContext,X as OrientationMode,Te as computeScale,ne as directionToHeadingTilt,$ as distanceToScale,V as externalToInternal,ee as fromCenterDistance,_ as fromCenterScale,me as fromExtent,ae as getObserverForPointAtDistance,N as headingTiltToDirectionUp,B as internalToExternal,ze as isAsyncContext,xe as observerToCamera,Q as scaleToDistance,Me as scaleToZoom,pe as toExtent,Se as zoomToScale};
|