@arcgis/core 4.31.0-next.20240821 → 4.31.0-next.20240823
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{24e38b7d1e9984a1472e.js → 033032715c3b04e0fc7d.js} +1 -1
- package/assets/esri/core/workers/chunks/{cfc93bbd35cc4bfde7c0.js → 045336db17aae6eef68f.js} +1 -1
- package/assets/esri/core/workers/chunks/04de7b2937d5ca7c23e2.js +1 -0
- package/assets/esri/core/workers/chunks/12a4b3706162872c2b41.js +769 -0
- package/assets/esri/core/workers/chunks/142b1336533fa2ac470b.js +47 -0
- package/assets/esri/core/workers/chunks/185e596f86767c22f951.js +1 -0
- package/assets/esri/core/workers/chunks/{cd8d595d577b74817623.js → 1a4b3820136fb615b730.js} +1 -1
- package/assets/esri/core/workers/chunks/29b157b41dfa16da886b.js +1 -0
- package/assets/esri/core/workers/chunks/300b57846114fedd12be.js +1 -0
- package/assets/esri/core/workers/chunks/{3f75b7ed24b440b4508a.js → 3d5f37c2f355260e6dc6.js} +1 -1
- package/assets/esri/core/workers/chunks/{a9eba26d62b62592cee1.js → 42861d54a336146753d8.js} +1 -1
- package/assets/esri/core/workers/chunks/4c8deac4bf72a5e2597a.js +1 -0
- package/assets/esri/core/workers/chunks/52107d450c55450f5c04.js +274 -0
- package/assets/esri/core/workers/chunks/6d54222301b6d819c904.js +1 -0
- package/assets/esri/core/workers/chunks/{eb0f180ed20af220a82e.js → 6ddece9cd94b60efe3d7.js} +1 -1
- package/assets/esri/core/workers/chunks/{566844774388a031fd74.js → 7125cff7fd288ff7bd5f.js} +1 -1
- package/assets/esri/core/workers/chunks/74de734a20b4cd2d7efb.js +1 -0
- package/assets/esri/core/workers/chunks/7712a23dc68220edaa64.js +1 -0
- package/assets/esri/core/workers/chunks/{ea561b2460e634a643fc.js → 7f35380809e7de99c302.js} +1 -1
- package/assets/esri/core/workers/chunks/7f3d49b667e9b46449e7.js +1 -0
- package/assets/esri/core/workers/chunks/8a2faf12938e811a9fc9.js +1 -0
- package/assets/esri/core/workers/chunks/{796c64b9caa1303e26ed.js → 8af503fa88c1668872eb.js} +1 -1
- package/assets/esri/core/workers/chunks/{e2a6f77c05d0818e3f74.js → 8e42ce8305cefba5debc.js} +1 -1
- package/assets/esri/core/workers/chunks/93169e55e472fec4bc50.js +1 -0
- package/assets/esri/core/workers/chunks/985c1f42aab564008c0d.js +1 -0
- package/assets/esri/core/workers/chunks/9a32d9d720cb81abfba2.js +1 -0
- package/assets/esri/core/workers/chunks/b171d57b4d0142f687d0.js +1 -0
- package/assets/esri/core/workers/chunks/d5e376893cd47605a438.js +1 -0
- package/assets/esri/core/workers/chunks/df9daac7ea581e9e5ca4.js +1 -0
- package/assets/esri/core/workers/chunks/f11ae249cc8e995bbccc.js +1 -0
- package/assets/esri/core/workers/chunks/{65d8011cf756b066cade.js → f218316de8b4635653b2.js} +1 -1
- package/assets/esri/libs/linkchartlayout/lclayout.wasm +0 -0
- package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
- package/assets/esri/themes/base/_core.scss +2 -0
- package/assets/esri/themes/base/widgets/_Grid.scss +0 -8
- package/assets/esri/themes/base/widgets/_GridControls.scss +86 -0
- package/assets/esri/themes/base/widgets/_Print.scss +13 -15
- 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/Print/t9n/Print.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_ar.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_bg.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_bs.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_ca.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_cs.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_da.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_de.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_el.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_en.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_es.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_et.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_fi.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_fr.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_he.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_hr.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_hu.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_id.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_it.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_ja.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_ko.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_lt.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_lv.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_nb.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_nl.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_pl.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_pt-BR.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_pt-PT.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_ro.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_ru.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_sk.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_sl.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_sr.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_sv.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_th.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_tr.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_uk.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_vi.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_zh-CN.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_zh-HK.json +1 -1
- package/assets/esri/widgets/Print/t9n/Print_zh-TW.json +1 -1
- package/assets/esri/widgets/support/GridControls/t9n/GridControls.json +1 -0
- package/assets/esri/widgets/support/GridControls/t9n/GridControls_en.json +1 -0
- package/chunks/CloudsComposition.glsl.js +3 -3
- package/chunks/ComponentShader.glsl.js +53 -61
- package/chunks/DefaultMaterial.glsl.js +1 -1
- package/chunks/FocusAreaColor.glsl.js +12 -0
- package/chunks/FocusAreaMask.glsl.js +5 -0
- package/chunks/Laserlines.glsl.js +1 -1
- package/chunks/Path.glsl.js +22 -17
- package/chunks/PointRenderer.glsl.js +3 -3
- package/chunks/Precipitation.glsl.js +1 -1
- package/chunks/Terrain.glsl.js +1 -1
- package/chunks/WaterSurface.glsl.js +18 -18
- package/chunks/boundedPlane.js +1 -1
- package/chunks/cameraUtilsPlanar.js +1 -1
- package/chunks/cameraUtilsSpherical.js +1 -1
- package/chunks/sphere.js +1 -1
- package/chunks/terrainUtilsPlanar.js +1 -1
- package/chunks/vec32.js +1 -1
- package/chunks/vxlLayer.js +1 -1
- package/core/libs/gl-matrix-2/math/quat.js +1 -1
- package/core/libs/gl-matrix-2/math/vec3.js +1 -1
- package/core/mathUtils.js +1 -1
- package/core/perspectiveUtils.js +1 -1
- package/exports/csv.js +1 -1
- package/geometry/operators/support/converterAPI.js +1 -1
- package/geometry/projection/localLinearScaleFactors.js +1 -1
- package/geometry/support/buffer/internals/Vec3.js +1 -1
- package/geometry/support/clipRay.js +1 -1
- package/geometry/support/coordinateSystem.js +1 -1
- package/geometry/support/frustum.js +1 -1
- package/geometry/support/heightModelInfoUtils.js +1 -1
- package/geometry/support/lineSegment.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/geometry.js +1 -1
- package/geometry/support/meshUtils/rotate.js +1 -1
- package/geometry/support/meshUtils/scale.js +1 -1
- package/geometry/support/plane.js +1 -1
- package/geometry/support/polygonUtils.js +1 -1
- package/geometry/support/ray.js +1 -1
- package/geometry/support/sphere.js +1 -1
- package/geometry/support/sphereUtils.js +5 -0
- package/geometry/support/triangle.js +1 -1
- package/geometry/support/vector.js +1 -1
- package/interfaces.d.ts +68 -9
- package/layers/FocusAreaLayer.js +5 -0
- package/layers/VoxelLayer.js +1 -1
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/layers/mixins/operationalLayerModuleMap.js +1 -1
- package/layers/orientedImagery/transformations/imageToGroundUtils.js +1 -1
- package/layers/video/VideoCameraSensorModel.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/symbols/support/Symbol3DFillMaterial.js +1 -1
- package/symbols/support/Symbol3DMaterial.js +1 -1
- package/views/2d/engine/webgl/AFeatureTile.js +1 -1
- package/views/2d/engine/webgl/WorldExtentClipRenderer.js +1 -1
- package/views/2d/grid/GridView2D.js +1 -1
- package/views/2d/grid/constants.js +5 -0
- package/views/2d/interactive/editingTools/TransformTool.js +1 -1
- package/views/2d/interactive/editingTools/manipulations/ScaleManipulation.js +1 -1
- package/views/2d/layerViewModuleImportUtils.js +1 -1
- package/views/2d/support/highlightGroupUtils.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
- package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
- package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
- package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
- package/views/3d/analysis/Slice/ShiftManipulator.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/analysis/Slice/SliceVisualization.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/analysis/Viewshed/FieldOfViewManipulation.js +1 -1
- package/views/3d/analysis/Viewshed/ScaleOrientManipulation.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedVisualization.js +1 -1
- package/views/3d/analysis/Viewshed/viewshedToolUtils.js +1 -1
- package/views/3d/analysis/support/measurementUtils.js +1 -1
- package/views/3d/animation/pointToPoint/Animation.js +1 -1
- package/views/3d/animation/pointToPoint/Camera.js +1 -1
- package/views/3d/camera/constraintUtils/common.js +1 -1
- package/views/3d/camera/constraintUtils/surfaceCollision.js +1 -1
- package/views/3d/camera/constraintUtils/tilt.js +1 -1
- package/views/3d/camera/intersectionUtils.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/CloudsComposition.glsl.js +1 -1
- package/views/3d/environment/CloudsParameters.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/environment/Fog.js +1 -1
- package/views/3d/environment/MarsAtmosphere.js +1 -1
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
- package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
- package/views/3d/interactive/editingTools/lineObjectVisualElementUtils.js +1 -1
- package/views/3d/interactive/editingTools/manipulations/MoveXYAxisManipulation.js +1 -1
- package/views/3d/interactive/editingTools/manipulations/MoveXYDiscManipulation.js +1 -1
- package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
- package/views/3d/interactive/editingTools/originGeometryVisualElementUtils.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/extentUtils.js +1 -1
- package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/VerticesVisualElement.js +1 -1
- package/views/3d/layerViewModuleImportUtils.js +1 -1
- package/views/3d/layers/FocusAreaLayerView3D.js +5 -0
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/VoxelGraphic.js +5 -0
- package/views/3d/layers/VoxelLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/ElevationAligners.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DDrapedGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLodInstanceGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/elevationAlignmentUtils.js +1 -1
- package/views/3d/layers/graphics/labelPlacement.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
- package/views/3d/layers/i3s/I3SUtil.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
- package/views/3d/layers/i3s/LoDUtil.js +1 -1
- package/views/3d/layers/i3s/PointRenderer.js +1 -1
- package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
- package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
- package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
- package/views/3d/layers/support/uvUtils.js +1 -1
- package/views/3d/state/NearFarHeuristic.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
- package/views/3d/state/controllers/RotateController.js +1 -1
- package/views/3d/state/controllers/ZoomControllerGlobal.js +1 -1
- package/views/3d/state/controllers/ZoomControllerLocal.js +1 -1
- package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
- package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/state/utils/viewUtils.js +1 -1
- package/views/3d/support/FrustumExtentIntersection.js +1 -1
- package/views/3d/support/cameraUtilsInternal.js +1 -1
- package/views/3d/support/geometryUtils/ray.js +1 -1
- package/views/3d/support/intersectionUtils.js +1 -1
- package/views/3d/support/mathUtils.js +1 -1
- package/views/3d/support/orientedBoundingBox.js +1 -1
- package/views/3d/support/pointsOfInterest/Focus.js +1 -1
- package/views/3d/support/sunUtils.js +1 -1
- package/views/3d/support/viewpointUtils.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/terrain/SphericalPatch.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/terrain/isTerrainSurfaceLayer.js +1 -1
- package/views/3d/webgl/RenderCamera.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/collections/Component/DepthRange.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexNormal.glsl.js +2 -6
- package/views/3d/webgl-engine/core/shaderLibrary/output/Emissions.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeFragmentNormals.glsl.js +13 -0
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateAmbientLighting.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +11 -13
- package/views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js +4 -4
- package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js +1 -4
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadBaseColorTexture.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/Water.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/util/ScreenSizePerspective.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorRenderNodeTechnique.js +5 -0
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskRenderNodeTechnique.js +5 -0
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaParameters.js +5 -0
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaRenderNode.js +5 -0
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserlinePathData.js +1 -1
- package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
- package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
- package/views/3d/webgl-engine/lib/Intersector.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/Octree.js +1 -1
- package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
- package/views/3d/webgl-engine/lib/Path.js +1 -1
- package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
- package/views/3d/webgl-engine/lib/PathVertex.js +1 -1
- package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js +1 -1
- package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/pathGeometryUtils.js +1 -1
- package/views/3d/webgl-engine/lib/triangleIntersectionUtils.js +1 -1
- package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
- package/views/3d/webgl-engine/lighting/SphericalHarmonics.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/FocusAreaColor.glsl.js +5 -0
- package/views/3d/webgl-engine/shaders/FocusAreaMask.glsl.js +5 -0
- package/views/3d/webgl-engine/shaders/OutputColorHighlightOID.glsl.js +8 -8
- package/views/3d/webgl-engine/shaders/Path.glsl.js +1 -1
- package/views/draw/support/helpMessageUtils3d.js +1 -1
- package/views/draw/support/surfaceCoordinateSystems.js +1 -1
- package/views/input/gamepad/GamepadSource.js +1 -1
- package/views/interactive/coordinateHelper.js +1 -1
- package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
- package/views/interactive/sketch/constraints.js +1 -1
- package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
- package/views/interactive/snapping/GridSnappingEngine.js +5 -0
- package/views/interactive/snapping/RightAngleSnapper.js +1 -1
- package/views/interactive/snapping/SnappingOptions.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/tileUtils.js +1 -1
- package/views/interactive/snapping/snappingUtils.js +1 -1
- package/views/navigation/PanPlanarMomentumEstimator.js +1 -1
- package/views/support/angularMeasurementUtils.js +1 -1
- package/views/support/euclideanAreaMeasurementUtils.js +1 -1
- package/views/support/euclideanLengthMeasurementUtils.js +1 -1
- package/views/support/geometry3dUtils.js +1 -1
- package/webscene/Slide.js +1 -1
- package/widgets/CoordinateConversion/support/formatUtils.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileLineView.js +1 -1
- package/widgets/Feature/FeatureMedia.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/Column.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/GridControls/GridControlsViewModel.d.ts +4 -0
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
- package/widgets/Print/CustomTemplate.js +1 -1
- package/widgets/Print/PrintViewModel.js +1 -1
- package/widgets/Print/TemplateOptions.js +1 -1
- package/widgets/Print/utils.js +5 -0
- package/widgets/Print.js +1 -1
- package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
- package/widgets/support/GridControls/GridControlsViewModel.d.ts +4 -0
- package/widgets/support/GridControls/GridControlsViewModel.js +5 -0
- package/widgets/support/GridControls/VisibleElements.js +5 -0
- package/widgets/support/GridControls/gridUtils.js +5 -0
- package/widgets/support/GridControls.d.ts +4 -0
- package/widgets/support/GridControls.js +5 -0
- package/widgets/support/exportUtils.js +1 -1
- package/assets/esri/core/workers/chunks/14dc47896456e3c66b24.js +0 -1
- package/assets/esri/core/workers/chunks/2e88af8ab1e2713e7655.js +0 -1
- package/assets/esri/core/workers/chunks/3b204e75b613bcfbc8b9.js +0 -1
- package/assets/esri/core/workers/chunks/3e57f493d5a9d7aa7a48.js +0 -1
- package/assets/esri/core/workers/chunks/4e5ae81c612543130d9a.js +0 -1
- package/assets/esri/core/workers/chunks/4e746f8fca1d932dd684.js +0 -1
- package/assets/esri/core/workers/chunks/544eec13338b2d71680f.js +0 -1
- package/assets/esri/core/workers/chunks/5e7e12863cbed07451d0.js +0 -1
- package/assets/esri/core/workers/chunks/6c129767cda74aa672e0.js +0 -1
- package/assets/esri/core/workers/chunks/6f7c2d02fbd29870f6ee.js +0 -1
- package/assets/esri/core/workers/chunks/7802e70422f4151b95bc.js +0 -1
- package/assets/esri/core/workers/chunks/920557db2bd107a3c579.js +0 -1
- package/assets/esri/core/workers/chunks/9443b9ec03f25c723c2c.js +0 -47
- package/assets/esri/core/workers/chunks/991295637f51e8207efe.js +0 -1
- package/assets/esri/core/workers/chunks/ace8b6351ed35b03499b.js +0 -1
- package/assets/esri/core/workers/chunks/b1e4896acfae0bf9a9a8.js +0 -1
- package/assets/esri/core/workers/chunks/ca12b1c470e67ca7b30e.js +0 -1
- package/assets/esri/core/workers/chunks/cd9f48dcee2a1fc261ed.js +0 -774
- package/assets/esri/core/workers/chunks/d3626c01d2569d84e01e.js +0 -1
- package/assets/esri/core/workers/chunks/e5474bcde5b8fa037b56.js +0 -278
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeShadingNormal.glsl.js +0 -31
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../geometry.js";import e from"../../../../request.js";import{binaryIndexOf as t,splitIntoChunks as r}from"../../../../core/arrayUtils.js";import o from"../../../../core/Error.js";import has from"../../../../core/has.js";import{isInt16Array as n,isInt32Array as i}from"../../../../core/typedArrayUtil.js";import{invert as a}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as l,h as c,c as u}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as p}from"../../../../geometry/projection.js";import{projectVectorToVector as m}from"../../../../geometry/projection/projectVectorToVector.js";import{create as d,empty as h,expandPointInPlace as y,intersects as g}from"../../../../geometry/support/aaBoundingRect.js";import{g as b}from"../../../../chunks/sphere.js";import S from"../../../../rest/support/Query.js";import{readBinaryAttribute as w}from"./I3SBinaryReader.js";import{computeGlobalTransformation as T}from"./I3SProjectionUtil.js";import{createSolidEdgeMaterial as I,createMaterialFromEdges as v}from"../support/edgeUtils.js";import{parseColorMixMode as E,ColorMixModeEnum as R}from"../support/symbolColorUtils.js";import{Obb as x,compute as M}from"../../support/orientedBoundingBox.js";import j from"../../../../geometry/SpatialReference.js";function C(e){return e?parseInt(e.slice(e.lastIndexOf("/")+1),10):void 0}function N(e){if(has("disable-feature:i3s-draco")||!e)return!1;for(const t of e)for(const e of t.geometryBuffers)if("draco"===e.compressedAttributes?.encoding)return!0;return!1}function U(e,t,r,o){r.traverse(t,(t=>{const r=t.serviceMbsInIndexSR;return(null!=r&&q(e,r))!==O.OUTSIDE&&(o(t),!0)}))}function k(e,t,r){let o=0,n=0;for(let i=0;i<t.length&&o<e.length;i++)e[o]===t[i]&&(r(i)&&(e[n]=e[o],n++),o++);e.length=n}function D(e,r,o){let n=0,i=0;for(;n<o.length;){t(e,o[n])>=0===r&&(o[i]=o[n],i++),n++}o.length=i}const W=d();function _(e,t){if(0===t.rotationScale[1]&&0===t.rotationScale[2]&&0===t.rotationScale[3]&&0===t.rotationScale[5]&&0===t.rotationScale[6]&&0===t.rotationScale[7])return W[0]=(e[0]-t.position[0])/t.rotationScale[0],W[1]=(e[1]-t.position[1])/t.rotationScale[4],W[2]=(e[2]-t.position[0])/t.rotationScale[0],W[3]=(e[3]-t.position[1])/t.rotationScale[4],W}var O;function q(e,t){const r=t[0],o=t[1],n=t[3],i=e[0]-r,a=r-e[2],s=e[1]-o,l=o-e[3],c=Math.max(i,a,0),u=Math.max(s,l,0),f=c*c+u*u;if(f>n*n)return O.OUTSIDE;if(f>0)return O.INTERSECTS_CENTER_OUTSIDE;return-Math.max(i,a,s,l)>n?O.INSIDE:O.INTERSECTS_CENTER_INSIDE}function F(e,t,r){const o=[],n=r?.missingFields,i=r?.originalFields;for(const a of e){const e=a.toLowerCase();let r=!1;for(const n of t)if(e===n.name.toLowerCase()){o.push(n.name),r=!0,i&&i.push(a);break}!r&&n&&n.push(a)}return o}async function L(e,t,r,n,i,a){if(0===t.length)return[];const s=e.attributeStorageInfo;if(null!=e.associatedLayer)try{return await K(e.associatedLayer,t,r,n,a)}catch(l){if(e.associatedLayer.loaded)throw l}if(s){const l=A(t,r,i);if(null==l)throw new o("scenelayer:features-not-loaded","Tried to query attributes for unloaded features");const c=e.parsedUrl.path;return(await Promise.all(l.map((t=>B(c,s,t.node,t.indices,n,e.apiKey,e.customParameters,a).then((e=>{for(let r=0;r<t.graphics.length;r++){const o=t.graphics[r],n=e[r];if(o.attributes)for(const e in o.attributes)e in n||(n[e]=o.attributes[e]);o.attributes=n}return t.graphics})))))).flat()}throw new o("scenelayer:no-attribute-source","This scene layer does not have a source for attributes available")}function A(e,t,r){const o=new Map,n=[],i=r();for(const a of e){const e=a.attributes[t];for(let t=0;t<i.length;t++){const r=i[t],s=r.featureIds.indexOf(e);if(s>=0){let e=o.get(r.node);e||(e={node:r.node,indices:[],graphics:[]},n.push(e),o.set(r.node,e)),e.indices.push(s),e.graphics.push(a);for(let r=t;r>0;r--)i[r]=i[r-1];i[0]=r;break}}}return n}async function K(e,t,r,o,n){t.sort(((e,t)=>e.attributes[r]-t.attributes[r]));const i=t.map((e=>e.attributes[r])),a=[],s=F(o,e.fields,{originalFields:a}),l=await P(e,i,s,n);for(let c=0;c<t.length;c++){const e=t[c],r=l[c],o={};if(e.attributes)for(const t in e.attributes)o[t]=e.attributes[t];for(let t=0;t<a.length;t++)o[a[t]]=r[s[t]];e.attributes=o}return t}function P(e,t,n,i){const a=e.capabilities.query.maxRecordCount;if(null!=a&&t.length>a){const o=r(t,a);return Promise.all(o.map((t=>P(e,t,n,i)))).then((e=>e.flat()))}const s=new S({objectIds:t,outFields:n,orderByFields:[e.objectIdField]});return e.queryFeatures(s,i).then((e=>{if(e&&e.features&&e.features.length===t.length)return e.features.map((e=>e.attributes));throw new o("scenelayer:feature-not-in-associated-layer","Feature not found in associated feature layer")}))}function B(e,t,r,o,n,i,a,s){return G(e,t,r.resources.attributes,o,n,i,a,s)}async function G(t,r,o,n,i,a,s,l){const c=[];for(const e of r)if(e&&i.includes(e.name)){const r=`${t}/nodes/${o}/attributes/${e.key}/0`;c.push({url:r,storageInfo:e})}const u=await Promise.allSettled(c.map((t=>e(t.url,{responseType:"array-buffer",query:{...s,token:a},signal:l?.signal}).then((e=>w(t.storageInfo,e.data)))))),f=[];for(const e of n){const t={};for(let r=0;r<u.length;r++){const o=u[r];if("fulfilled"===o.status){const n=o.value;t[c[r].storageInfo.name]=V(n,e)}}f.push(t)}return f}!function(e){e[e.OUTSIDE=0]="OUTSIDE",e[e.INTERSECTS_CENTER_OUTSIDE=1]="INTERSECTS_CENTER_OUTSIDE",e[e.INTERSECTS_CENTER_INSIDE=2]="INTERSECTS_CENTER_INSIDE",e[e.INSIDE=3]="INSIDE"}(O||(O={}));const $=-32768,z=-(2**31);function V(e,t){if(!e)return null;const r=e[t];if(n(e))return r===$?null:r;if(i(e))return r===z?null:r;return r!=r?null:r}function Q(e){const t=e.store,r=t.indexCRS||t.geographicCRS,n=void 0===r?t.indexWKT:void 0;if(n){if(!e.spatialReference)throw new o("layerview:no-store-spatial-reference-wkt-index-and-no-layer-spatial-reference","Found indexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new o("layerview:store-spatial-reference-wkt-index-incompatible","The indexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const i=r?new j(C(r)):e.spatialReference;return i.equals(e.spatialReference)?e.spatialReference:i}function Z(e){const t=e.store,r=t.vertexCRS||t.projectedCRS,n=void 0===r?t.vertexWKT:void 0;if(n){if(!e.spatialReference)throw new o("layerview:no-store-spatial-reference-wkt-vertex-and-no-layer-spatial-reference","Found vertexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new o("layerview:store-spatial-reference-wkt-vertex-incompatible","The vertexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const i=r?new j(C(r)):e.spatialReference;return i.equals(e.spatialReference)?e.spatialReference:i}function H(e,t,r){if(!p(e,t))throw new o("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{});if("local"===r&&!X(e,t))throw new o("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{})}function J(e,t,r){if(e.serviceUpdateTimeStamp?.lastUpdate!==t.serviceUpdateTimeStamp?.lastUpdate||!r.isEmpty||e.associatedLayer?.url!==t.associatedLayer?.url)throw new o("layerview:recycle-failed")}function X(e,t){return e.equals(t)||e.isWGS84&&t.isWebMercator||e.isWebMercator&&t.isWGS84}function Y(e,t,r){const o=Q(e),n=Z(e);H(o,t,r),H(n,t,r)}function ee(e){return(null==e.geometryType||"triangles"===e.geometryType)&&((null==e.topology||"PerAttributeArray"===e.topology)&&null!=e.vertexAttributes?.position)}function te(e){if(null==e.store?.defaultGeometrySchema||!ee(e.store.defaultGeometrySchema))throw new o("scenelayer:unsupported-geometry-schema","The geometry schema of this scene layer is not supported.",{url:e.parsedUrl.path})}function re(e,t){Y(e,t.spatialReference,t.viewingMode)}function oe(e){return null!=e.geometryType&&"points"===e.geometryType&&((null==e.topology||"PerAttributeArray"===e.topology)&&((null==e.encoding||""===e.encoding||"lepcc-xyz"===e.encoding)&&null!=e.vertexAttributes?.position))}function ne(e){if(null==e.store?.defaultGeometrySchema||!oe(e.store.defaultGeometrySchema))throw new o("pointcloud:unsupported-geometry-schema","The geometry schema of this point cloud scene layer is not supported.",{})}function ie(e,t){H(e.spatialReference,t.spatialReference,t.viewingMode)}function ae(e){return"simple"===e.type||"class-breaks"===e.type||"unique-value"===e.type}function se(e){return"mesh-3d"===e.type}function le(e){if(null==e||!ae(e))return!0;if(("unique-value"===e.type||"class-breaks"===e.type)&&null==e.defaultSymbol)return!0;const t=e.getSymbols();if(0===t.length)return!0;for(const r of t){if(!se(r)||0===r.symbolLayers.length)return!0;for(const e of r.symbolLayers.items)if("fill"!==e.type||null==e.material?.color||"replace"!==e.material.colorMixMode)return!0}return!1}const ce=I({color:[0,0,0,0],opacity:0});class ue{constructor(){this.edgeMaterial=null,this.material=null,this.castShadows=!0}}function fe(e){const t=new ue;let r=!1,o=!1;for(const n of e.symbolLayers.items)if("fill"===n.type&&n.enabled){const e=n.material,i=n.edges;if(null!=e&&!r){const o=e.color,i=E(e.colorMixMode);t.material=null!=o?{color:[o.r/255,o.g/255,o.b/255],alpha:o.a,colorMixMode:i}:{color:[1,1,1],alpha:1,colorMixMode:R.Multiply},t.castShadows=n.castShadows,r=!0}null==i||o||(t.edgeMaterial=v(i,{}),o=!0)}return t.material||(t.material={color:[1,1,1],alpha:1,colorMixMode:R.Multiply}),t}function pe(e,t){return(0|e)+(0|t)|0}function me(e,t,r,o,n,i,s){if(!i||0===i.length||null==t||!e.serviceMbsInIndexSR)return null;const f=T(e.serviceMbsInIndexSR,n,"none",r,t);a(Ie,f);let p=null;const d=()=>{if(!p)if(p=ye,h(be),null!=e.serviceObbInIndexSR){e.serviceObbInIndexSR.transform(Se,r,t,n,s),Se.getCorners(p);for(const e of p)c(e,e,Ie),y(be,e)}else{const o=e.serviceMbsInIndexSR;if(!o)return;const i=o[3];m(b(o),r,we,t),c(we,we,Ie),we[2]+=n;for(let e=0;e<8;++e){const t=1&e?i:-i,r=2&e?i:-i,o=4&e?i:-i,n=p[e];u(n,[we[0]+t,we[1]+r,we[2]+o]),y(be,n)}}};let S=1/0,w=-1/0;const I=e=>{if("replace"!==e.type)return;const r=e.geometry;if(!r?.hasZ)return;h(ge);const n=r.spatialReference||o,i=r.rings.reduce(((e,r)=>r.reduce(((e,r)=>(l(we,r[0],r[1],r[2]),m(we,n,we,t),c(we,we,Ie),y(ge,we),Math.min(we[2],e))),e)),1/0);d(),g(be,ge)&&(S=Math.min(S,i),w=Math.max(w,i))};if(i.forEach((e=>I(e))),S===1/0)return null;const v=(e,t,r)=>{c(we,r,f),e[t]=we[0],e[t+1]=we[1],e[t+2]=we[2],t+=24,r[2]=S,c(we,r,f),e[t]=we[0],e[t+1]=we[1],e[t+2]=we[2],t+=24,r[2]=w,c(we,r,f),e[t]=we[0],e[t+1]=we[1],e[t+2]=we[2]};for(let a=0;a<8;++a)v(Te.data,3*a,p[a]);return M(Te)}function de(e){return e[3]>=0}function he(e){null!=e&&(e[3]=-1)}const ye=[f(),f(),f(),f(),f(),f(),f(),f()],ge=d(),be=d(),Se=new x,we=f(),Te={data:new Array(72),size:3,exclusive:!0,stride:3},Ie=s();export{O as MbsIntersectResult,ue as SymbolInfo,pe as addWraparound,ie as checkPointCloudLayerCompatibleWithView,ne as checkPointCloudLayerValid,J as checkRecyclable,re as checkSceneLayerCompatibleWithView,te as checkSceneLayerValid,H as checkSpatialReference,Y as checkSpatialReferences,me as computeVisibilityObb,N as containsDraco,C as extractWkid,k as filterInPlace,F as findFieldsCaseInsensitive,U as findIntersectingNodes,V as getCachedAttributeValue,_ as getClipRect,Q as getIndexCrs,fe as getSymbolInfo,Z as getVertexCrs,q as intersectBoundingRectWithMbs,he as invalidateMbs,X as isSupportedLocalModeProjection,de as isValidMbs,D as objectIdFilter,G as queryAttributesFromCachedAttributesId,le as rendererNeedsTextures,ce as transparentEdgeMaterial,L as whenGraphicAttributes};
|
|
5
|
+
import"../../../../geometry.js";import e from"../../../../request.js";import{binaryIndexOf as t,splitIntoChunks as r}from"../../../../core/arrayUtils.js";import o from"../../../../core/Error.js";import has from"../../../../core/has.js";import{isInt16Array as n,isInt32Array as a}from"../../../../core/typedArrayUtil.js";import{invert as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{a as l,h as c,c as u}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as p}from"../../../../geometry/projection.js";import{projectVectorToVector as m}from"../../../../geometry/projection/projectVectorToVector.js";import{create as d,empty as h,expandPointInPlace as y,intersects as g}from"../../../../geometry/support/aaBoundingRect.js";import{g as b}from"../../../../chunks/sphere.js";import S from"../../../../rest/support/Query.js";import{readBinaryAttribute as w}from"./I3SBinaryReader.js";import{computeGlobalTransformation as T}from"./I3SProjectionUtil.js";import{createSolidEdgeMaterial as I,createMaterialFromEdges as v}from"../support/edgeUtils.js";import{parseColorMixMode as E,ColorMixModeEnum as R}from"../support/symbolColorUtils.js";import{Obb as x,compute as M}from"../../support/orientedBoundingBox.js";import j from"../../../../geometry/SpatialReference.js";function C(e){return e?parseInt(e.slice(e.lastIndexOf("/")+1),10):void 0}function N(e){if(has("disable-feature:i3s-draco")||!e)return!1;for(const t of e)for(const e of t.geometryBuffers)if("draco"===e.compressedAttributes?.encoding)return!0;return!1}function U(e,t,r,o){r.traverse(t,(t=>{const r=t.serviceMbsInIndexSR;return(null!=r&&q(e,r))!==O.OUTSIDE&&(o(t),!0)}))}function k(e,t,r){let o=0,n=0;for(let a=0;a<t.length&&o<e.length;a++)e[o]===t[a]&&(r(a)&&(e[n]=e[o],n++),o++);e.length=n}function D(e,r,o){let n=0,a=0;for(;n<o.length;){t(e,o[n])>=0===r&&(o[a]=o[n],a++),n++}o.length=a}const W=d();function _(e,t){if(0===t.rotationScale[1]&&0===t.rotationScale[2]&&0===t.rotationScale[3]&&0===t.rotationScale[5]&&0===t.rotationScale[6]&&0===t.rotationScale[7])return W[0]=(e[0]-t.position[0])/t.rotationScale[0],W[1]=(e[1]-t.position[1])/t.rotationScale[4],W[2]=(e[2]-t.position[0])/t.rotationScale[0],W[3]=(e[3]-t.position[1])/t.rotationScale[4],W}var O;function q(e,t){const r=t[0],o=t[1],n=t[3],a=e[0]-r,i=r-e[2],s=e[1]-o,l=o-e[3],c=Math.max(a,i,0),u=Math.max(s,l,0),f=c*c+u*u;if(f>n*n)return O.OUTSIDE;if(f>0)return O.INTERSECTS_CENTER_OUTSIDE;return-Math.max(a,i,s,l)>n?O.INSIDE:O.INTERSECTS_CENTER_INSIDE}function F(e,t,r){const o=[],n=r?.missingFields,a=r?.originalFields;for(const i of e){const e=i.toLowerCase();let r=!1;for(const n of t)if(e===n.name.toLowerCase()){o.push(n.name),r=!0,a&&a.push(i);break}!r&&n&&n.push(i)}return o}async function L(e,t,r,n,a,i){if(0===t.length)return[];const s=e.attributeStorageInfo;if(null!=e.associatedLayer)try{return await K(e.associatedLayer,t,r,n,i)}catch(l){if(e.associatedLayer.loaded)throw l}if(s){const l=A(t,r,a);if(null==l)throw new o("scenelayer:features-not-loaded","Tried to query attributes for unloaded features");const c=e.parsedUrl.path;return(await Promise.all(l.map((t=>B(c,s,t.node,t.indices,n,e.apiKey,e.customParameters,i).then((e=>{for(let r=0;r<t.graphics.length;r++){const o=t.graphics[r],n=e[r];if(o.attributes)for(const e in o.attributes)e in n||(n[e]=o.attributes[e]);o.attributes=n}return t.graphics})))))).flat()}throw new o("scenelayer:no-attribute-source","This scene layer does not have a source for attributes available")}function A(e,t,r){const o=new Map,n=[],a=r();for(const i of e){const e=i.attributes[t];for(let t=0;t<a.length;t++){const r=a[t],s=r.featureIds.indexOf(e);if(s>=0){let e=o.get(r.node);e||(e={node:r.node,indices:[],graphics:[]},n.push(e),o.set(r.node,e)),e.indices.push(s),e.graphics.push(i);for(let r=t;r>0;r--)a[r]=a[r-1];a[0]=r;break}}}return n}async function K(e,t,r,o,n){t.sort(((e,t)=>e.attributes[r]-t.attributes[r]));const a=t.map((e=>e.attributes[r])),i=[],s=F(o,e.fields,{originalFields:i}),l=await P(e,a,s,n);for(let c=0;c<t.length;c++){const e=t[c],r=l[c],o={};if(e.attributes)for(const t in e.attributes)o[t]=e.attributes[t];for(let t=0;t<i.length;t++)o[i[t]]=r[s[t]];e.attributes=o}return t}function P(e,t,n,a){const i=e.capabilities.query.maxRecordCount;if(null!=i&&t.length>i){const o=r(t,i);return Promise.all(o.map((t=>P(e,t,n,a)))).then((e=>e.flat()))}const s=new S({objectIds:t,outFields:n,orderByFields:[e.objectIdField]});return e.queryFeatures(s,a).then((e=>{if(e&&e.features&&e.features.length===t.length)return e.features.map((e=>e.attributes));throw new o("scenelayer:feature-not-in-associated-layer","Feature not found in associated feature layer")}))}function B(e,t,r,o,n,a,i,s){return G(e,t,r.resources.attributes,o,n,a,i,s)}async function G(t,r,o,n,a,i,s,l){const c=[];for(const e of r)if(e&&a.includes(e.name)){const r=`${t}/nodes/${o}/attributes/${e.key}/0`;c.push({url:r,storageInfo:e})}const u=await Promise.allSettled(c.map((t=>e(t.url,{responseType:"array-buffer",query:{...s,token:i},signal:l?.signal}).then((e=>w(t.storageInfo,e.data)))))),f=[];for(const e of n){const t={};for(let r=0;r<u.length;r++){const o=u[r];if("fulfilled"===o.status){const n=o.value;t[c[r].storageInfo.name]=V(n,e)}}f.push(t)}return f}!function(e){e[e.OUTSIDE=0]="OUTSIDE",e[e.INTERSECTS_CENTER_OUTSIDE=1]="INTERSECTS_CENTER_OUTSIDE",e[e.INTERSECTS_CENTER_INSIDE=2]="INTERSECTS_CENTER_INSIDE",e[e.INSIDE=3]="INSIDE"}(O||(O={}));const $=-32768,z=-(2**31);function V(e,t){if(!e)return null;const r=e[t];if(n(e))return r===$?null:r;if(a(e))return r===z?null:r;return r!=r?null:r}function Q(e){const t=e.store,r=t.indexCRS||t.geographicCRS,n=void 0===r?t.indexWKT:void 0;if(n){if(!e.spatialReference)throw new o("layerview:no-store-spatial-reference-wkt-index-and-no-layer-spatial-reference","Found indexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new o("layerview:store-spatial-reference-wkt-index-incompatible","The indexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const a=r?new j(C(r)):e.spatialReference;return a.equals(e.spatialReference)?e.spatialReference:a}function Z(e){const t=e.store,r=t.vertexCRS||t.projectedCRS,n=void 0===r?t.vertexWKT:void 0;if(n){if(!e.spatialReference)throw new o("layerview:no-store-spatial-reference-wkt-vertex-and-no-layer-spatial-reference","Found vertexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new o("layerview:store-spatial-reference-wkt-vertex-incompatible","The vertexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const a=r?new j(C(r)):e.spatialReference;return a.equals(e.spatialReference)?e.spatialReference:a}function H(e,t,r){if(!p(e,t))throw new o("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{});if("local"===r&&!X(e,t))throw new o("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{})}function J(e,t,r){if(e.serviceUpdateTimeStamp?.lastUpdate!==t.serviceUpdateTimeStamp?.lastUpdate||!r.isEmpty||e.associatedLayer?.url!==t.associatedLayer?.url)throw new o("layerview:recycle-failed")}function X(e,t){return e.equals(t)||e.isWGS84&&t.isWebMercator||e.isWebMercator&&t.isWGS84}function Y(e,t,r){const o=Q(e),n=Z(e);H(o,t,r),H(n,t,r)}function ee(e){return(null==e.geometryType||"triangles"===e.geometryType)&&((null==e.topology||"PerAttributeArray"===e.topology)&&null!=e.vertexAttributes?.position)}function te(e){if(null==e.store?.defaultGeometrySchema||!ee(e.store.defaultGeometrySchema))throw new o("scenelayer:unsupported-geometry-schema","The geometry schema of this scene layer is not supported.",{url:e.parsedUrl.path})}function re(e,t){Y(e,t.spatialReference,t.viewingMode)}function oe(e){return null!=e.geometryType&&"points"===e.geometryType&&((null==e.topology||"PerAttributeArray"===e.topology)&&((null==e.encoding||""===e.encoding||"lepcc-xyz"===e.encoding)&&null!=e.vertexAttributes?.position))}function ne(e){if(null==e.store?.defaultGeometrySchema||!oe(e.store.defaultGeometrySchema))throw new o("pointcloud:unsupported-geometry-schema","The geometry schema of this point cloud scene layer is not supported.",{})}function ae(e,t){H(e.spatialReference,t.spatialReference,t.viewingMode)}function ie(e){return"simple"===e.type||"class-breaks"===e.type||"unique-value"===e.type}function se(e){return"mesh-3d"===e.type}function le(e){if(null==e||!ie(e))return!0;if(("unique-value"===e.type||"class-breaks"===e.type)&&null==e.defaultSymbol)return!0;const t=e.getSymbols();if(0===t.length)return!0;for(const r of t){if(!se(r)||0===r.symbolLayers.length)return!0;for(const e of r.symbolLayers.items)if("fill"!==e.type||null==e.material?.color||"replace"!==e.material.colorMixMode)return!0}return!1}const ce=I({color:[0,0,0,0],opacity:0});class ue{constructor(){this.edgeMaterial=null,this.material=null,this.castShadows=!0}}function fe(e){const t=new ue;let r=!1,o=!1;for(const n of e.symbolLayers.items)if("fill"===n.type&&n.enabled){const e=n.material,a=n.edges;if(null!=e&&!r){const o=e.color,a=E(e.colorMixMode);t.material=null!=o?{color:[o.r/255,o.g/255,o.b/255],alpha:o.a,colorMixMode:a}:{color:[1,1,1],alpha:1,colorMixMode:R.Multiply},t.castShadows=n.castShadows,r=!0}null==a||o||(t.edgeMaterial=v(a,{}),o=!0)}return t.material||(t.material={color:[1,1,1],alpha:1,colorMixMode:R.Multiply}),t}function pe(e,t){return(0|e)+(0|t)|0}function me(e,t,r,o,n,a,s){if(!a||0===a.length||null==t||!e.serviceMbsInIndexSR)return null;const f=T(e.serviceMbsInIndexSR,n,"none",r,t);i(Ie,f);let p=null;const d=()=>{if(!p)if(p=ye,h(be),null!=e.serviceObbInIndexSR){e.serviceObbInIndexSR.transform(Se,r,t,n,s),Se.getCorners(p);for(const e of p)c(e,e,Ie),y(be,e)}else{const o=e.serviceMbsInIndexSR;if(!o)return;const a=o[3];m(b(o),r,we,t),c(we,we,Ie),we[2]+=n;for(let e=0;e<8;++e){const t=1&e?a:-a,r=2&e?a:-a,o=4&e?a:-a,n=p[e];u(n,[we[0]+t,we[1]+r,we[2]+o]),y(be,n)}}};let S=1/0,w=-1/0;const I=e=>{if("replace"!==e.type)return;const r=e.geometry;if(!r?.hasZ)return;h(ge);const n=r.spatialReference||o,a=r.rings.reduce(((e,r)=>r.reduce(((e,r)=>(l(we,r[0],r[1],r[2]),m(we,n,we,t),c(we,we,Ie),y(ge,we),Math.min(we[2],e))),e)),1/0);d(),g(be,ge)&&(S=Math.min(S,a),w=Math.max(w,a))};if(a.forEach((e=>I(e))),S===1/0)return null;const v=(e,t,r)=>{c(we,r,f),e[t]=we[0],e[t+1]=we[1],e[t+2]=we[2],t+=24,r[2]=S,c(we,r,f),e[t]=we[0],e[t+1]=we[1],e[t+2]=we[2],t+=24,r[2]=w,c(we,r,f),e[t]=we[0],e[t+1]=we[1],e[t+2]=we[2]};for(let i=0;i<8;++i)v(Te.data,3*i,p[i]);return M(Te)}function de(e){return e[3]>=0}function he(e){null!=e&&(e[3]=-1)}const ye=[f(),f(),f(),f(),f(),f(),f(),f()],ge=d(),be=d(),Se=new x,we=f(),Te={data:new Array(72),size:3,exclusive:!0,stride:3},Ie=s();export{O as MbsIntersectResult,ue as SymbolInfo,pe as addWraparound,ae as checkPointCloudLayerCompatibleWithView,ne as checkPointCloudLayerValid,J as checkRecyclable,re as checkSceneLayerCompatibleWithView,te as checkSceneLayerValid,H as checkSpatialReference,Y as checkSpatialReferences,me as computeVisibilityObb,N as containsDraco,C as extractWkid,k as filterInPlace,F as findFieldsCaseInsensitive,U as findIntersectingNodes,V as getCachedAttributeValue,_ as getClipRect,Q as getIndexCrs,fe as getSymbolInfo,Z as getVertexCrs,q as intersectBoundingRectWithMbs,he as invalidateMbs,X as isSupportedLocalModeProjection,de as isValidMbs,D as objectIdFilter,G as queryAttributesFromCachedAttributesId,le as rendererNeedsTextures,ce as transparentEdgeMaterial,L as whenGraphicAttributes};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{n as e,z as t,m as i,r as s,c as n,G as r,w as o,j as a,F as c,a as u,p as l,l as h,q as d,f as m,g as _}from"../../../../chunks/vec32.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{c as f,i as v}from"../../../../chunks/vec42.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as b}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as R}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingSphere as S}from"../../../../geometry/projection/projectBoundingSphere.js";import{getProjector as M}from"../../../../geometry/projection/projectors.js";import{create as x,fromMatrix as C,intersectsSphere as I,createPoints as P}from"../../../../geometry/support/frustum.js";import{signedDistance as E,getNormal as D}from"../../../../geometry/support/plane.js";import{isPlateCarree as F}from"../../../../geometry/support/spatialReferenceUtils.js";import{g as O,w as B}from"../../../../chunks/sphere.js";import{makeDehydratedPoint as V}from"../../../../layers/graphics/dehydratedPoint.js";import{ViewingMode as j}from"../../../ViewingMode.js";import{evaluateElevationAlignmentAtPoint as A}from"../graphics/elevationAlignmentUtils.js";import{ElevationContext as L}from"../graphics/ElevationContext.js";import{createContextWithoutExpressionSupport as y,extractExpressionInfo as w}from"../graphics/featureExpressionInfoUtils.js";import{LodMetric as G}from"./I3SNode.js";import{isValidMbs as N,intersectBoundingRectWithMbs as U,MbsIntersectResult as q}from"./I3SUtil.js";import{Obb as z,computeOffsetObb as T}from"../../support/orientedBoundingBox.js";const k=1e5;class H{get _frustumMbsCenter(){return this._frustumMbs}get _frustumMbsRadius(){return this._frustumMbs[3]}get _frustumPlanes(){return this._frustum}constructor(e,t,i,s,n,r,o,a,c={}){this._indexSR=e,this._renderCoordsHelper=t,this._clippingArea=n,this._elevationProvider=r,this._viewingMode=o,this._options=c,this._frustum=x(),this._frustumMbs=g(),this._useFrustumCulling=!1,this._poi=p(),this._elevationContext=null,this.minDistance=1/0,this.maxDistance=0,this.maxLodLevel=2,this._tmpObb=new z,this._tmp1=p(),this._tmp2=p(),this._tmp3=p(),this._tmp0=p(),this._screenspaceErrorBias=c.screenspaceErrorBias||1,this._progressiveLoadFactor=c.progressiveLoadFactor||1,this.updateCamera(i,s);const u=this._renderCoordsHelper.spatialReference;this._renderSR=u,this._renderSRSphericalPCPF=R(u),this._isGlobalMode=u===this._renderSRSphericalPCPF,this.updateElevationInfo(a),this._tmpPoint=V(0,0,0,e),this._isECEFOBBInLocalMode=this._indexSR.isWGS84&&(u.isWebMercator||F(u)),this._indexSREllipsoidRadius=b(this._indexSR).radius,this._indexSRSphericalPCPF=R(e),this._projectorIndexSRToIndexSRSphericalPCPF=M(this._indexSR,this._indexSRSphericalPCPF)}updateElevationInfo(e){null!=e?(this._elevationContext=L.fromElevationInfo(e),this._elevationContext.updateFeatureExpressionInfoContext(y(w(e,!1)))):this._elevationContext=null}updateCamera(n,r){if(this._useFrustumCulling=r,r){C(n.viewMatrix,n.projectionMatrix,this._frustum,X);{const r=n.eye,o=Z;e(o,n.viewForward);const a=Y;t(a,X[4],r);const c=.5*i(a,a)/i(o,a),u=this._frustumMbs;s(u,r,o,c);const l=1+c;u[3]=l}}this._screenSizeFactor=1/(n.perScreenPixelRatio/2),this._camPos=n.eye,this.minDistance=1/0,this.maxDistance=0}setPointOfInterest(e){this._poi=e}updateScreenSpaceErrorBias(e){const t=this._screenspaceErrorBias;return this._screenspaceErrorBias=e,t}updateClippingArea(e){this._clippingArea=e}expandElevationRange(e,t,i){if(null==this._elevationContext)return;const s=e.serviceMbsInIndexSR;if(!s)return;const n="relative-to-scene"===this._elevationContext.mode?"scene":"ground";if(this._elevationProvider.getSphereElevationBounds){const e=this._elevationProvider.getSphereElevationBounds(s,this._indexSR,n);return void(e&&i.expandElevationRange(e))}const r=s[0],o=s[1],a=s[2],c=this._elevationProvider.getElevation(r,o,a,this._indexSR,n);c&&i.expandElevationRangeValues(c,c);const u=t?null:this._elevationProvider.getRootElevationBounds?.();u&&i.expandElevationRange(u)}getServiceMbsInRenderSR(e){const t=e.serviceMbsInRenderSR;if(N(t))return t;e.serviceMbsInIndexSR&&f(t,e.serviceMbsInIndexSR);const i=e.elevationRangeMin;if(this._elevationContext&&Number.isFinite(i)){let s=0,n=0;const r=e.elevationRangeMax;switch(this._elevationContext.mode){case"relative-to-ground":case"relative-to-scene":s=this._elevationContext.geometryZWithOffset(t[2],this._renderCoordsHelper)+i-t[2],n=r-i;break;case"on-the-ground":s=i-t[2],n=r-i}t[2]+=s+.5*n,t[3]+=.5*n}else this._elevationContext&&t[3]<k&&(this._tmpPoint.x=t[0],this._tmpPoint.y=t[1],this._tmpPoint.z=t[2],t[2]=A(this._tmpPoint,this._elevationProvider,this._elevationContext,this._renderCoordsHelper));return S(t,this._indexSR,t,this._renderSR),t}getAndUpdateVisibilityObbInRenderSR(e){{const t=e.visibilityObbInRenderSR;if(t)return t}const t=.01*this._indexSREllipsoidRadius,{serviceMbsInIndexSR:i,serviceObbInIndexSR:s}=e;if(null==s||!i||!s.isValid||this._isECEFOBBInLocalMode&&(s.halfSizeX>t||s.halfSizeY>t||s.halfSizeZ>t))return null;{let t=e.serviceObbInRenderSR;if(null==t)t=new z,e.serviceObbInRenderSR=t;else if(t.isValid)return t;const n=i[3];let r=0,o=0;const a=s.centerZ,c=this._renderCoordsHelper,u=this._elevationContext;if(u&&e.elevationRangeValid){const t=e.elevationRangeMin,i=e.elevationRangeMax;switch(u.mode){case"relative-to-ground":case"relative-to-scene":r=u.geometryZWithOffset(a,c)+t-a,o=i-t;break;case"on-the-ground":r=t-a,o=i-t}}else if(u&&n<k){const e=this._tmpPoint;e.x=s.centerX,e.y=s.centerY,e.z=a,r=A(e,this._elevationProvider,u,c)-a}const l=o>0,h=l?this._tmpObb:t;return s.transform(h,this._indexSR,this._renderSR,r,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),l&&T(h,0,o,this._viewingMode,t),t}}getNodeObbInRenderSRIndependentOfElevationOffset(e){{const t=e.visibilityObbInRenderSR??e.serviceObbInRenderSR??null;if(t?.isValid)return t}const t=e.serviceObbInIndexSR;return t?(t.transform(ee,this._indexSR,this._renderSR,void 0,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),ee):null}ensureElevationAgnosticBoundingVolume(e){return-1===e.elevationAgnosticBoundingVolume[3]&&e.level>0&&(this._viewingMode===j.Global?this._updateElevationAgnosticBoundingVolumeGlobal(e):this._updateElevationAgnosticBoundingVolumeLocal(e)),e.elevationAgnosticBoundingVolume}_updateElevationAgnosticBoundingVolumeGlobal(t){const s=this.getNodeObbInRenderSRIndependentOfElevationOffset(t),o=t.elevationAgnosticBoundingVolume;let a,c=-1;if(s){const t=te;s.getCenter(t),e(t,t),a=t,s.getCorners(ie);for(const s of ie){e(s,s);const n=i(s,t);if(n<=0)return void(o[3]=-1);const r=Math.sqrt(1-n*n);c=Math.max(c,r)}}else{const i=t.serviceMbsInRenderSR;if(!N(i))return void(o[3]=-1);{const t=n(te,O(i)),s=i[3],u=r(t);if(u<s)return void(o[3]=-1);c=s/u,e(t,t),a=t}}v(o,a);const u=.001;o[3]=c+u}_updateElevationAgnosticBoundingVolumeLocal(e){const t=e.elevationAgnosticBoundingVolume,i=this.getNodeObbInRenderSRIndependentOfElevationOffset(e);if(i){const e=i.getCenter(te);e[2]=0,v(t,e);let s=0;const n=se;i.getCorners(ie);for(const t of ie){t[2]=0;const e=o(n,t);s=Math.max(s,e)}t[3]=Math.sqrt(s)}else{const i=e.serviceMbsInRenderSR;if(N(i)){const e=n(te,O(i));e[2]=0,v(t,e),t[3]=i[3]}}}isNodeVisible(e){const t=this.getServiceMbsInRenderSR(e);if(!this._isMBSinClippingArea(t))return!1;if(!this._useFrustumCulling)return!0;const i=this.getAndUpdateVisibilityObbInRenderSR(e);return i?i.doesIntersectFrustumConservativeApproximation(this._frustum):I(this._frustum,B(t))}isElevationAgnosticBoundingVolumeVisible(e){return!this._useFrustumCulling||(-1===e[3]||(this._viewingMode===j.Global?this._isConeVisibleInFrustum(e):this._isCylinderVisibleInFrustum(e)))}_isConeVisibleInFrustum(n){if(!this._isConeVisibleInFrustumMbs(n))return!1;const r=n[3];if(-1===r||r>.9)return!0;const o=this._frustumPlanes,c=this._frustumMbsCenter,u=n,l=i(u,c),h=this._frustumMbsRadius,d=l-h,m=l+h;if(d<=0)return!0;const _=a(K,u,d),p=a(Q,u,m),f=r/Math.sqrt(1-r*r);for(const v of o){const n=D(v),r=e($,n),o=i(r,u);if(Math.abs(1-o)<.01)continue;const c=ne;a(c,u,o),t(c,c,r),e(c,c);const l=re;s(l,_,c,d*f);if(E(v,l)<=0)continue;s(l,p,c,m*f);if(E(v,l)<=0)continue;return!1}return!0}_isConeVisibleInFrustumMbs(e){const t=e[3];if(t>.9)return!0;const s=this._frustumMbsRadius,n=this._frustumMbsCenter,o=r(n);if(o<=s)return!0;const u=e,l=i(u,n);{const e=a(J,u,l);if(c(e,n)<s)return!0}const h=l/o;if(l<=0){return-h<s}const d=Math.sqrt(1-h*h);if(d<t)return!0;const m=s/o;return d*Math.sqrt(1-m*m)-m*h<t}isObbVisibleIndependentOfElevation(e,t){if(!this._useFrustumCulling)return!0;if(-1===e[3])return!0;const s=this._frustumMbsRadius,n=this._frustumMbsCenter,r=this._frustumPlanes,o=ie;if(t.getCorners(o),this._viewingMode===j.Global){const t=e,c=i(t,n),u=c-s,l=c+s;if(u<=0)return!0;for(const e of r){let s=!0;for(const n of o){const r=i(n,t),o=oe;if(a(o,n,u/r),E(e,o)<=0){s=!1;break}const c=oe;if(a(c,n,l/r),E(e,c)<=0){s=!1;break}}if(s)return!1}}else{const e=n[2]-s,t=n[2]+s;for(const i of r){let s=!0;const n=D(i),r=n[0],a=n[1],c=n[2],u=i[3];for(const i of o){const n=r*i[0]+a*i[1]+u;if(n+c*e<=0||n+c*t<=0){s=!1;break}}if(s)return!1}}return!0}_isCylinderVisibleInFrustum(e){const t=this._frustumMbsCenter,i=this._frustumMbsRadius,s=n(J,t);s[2]=0;const r=e[3];return c(s,e)<=r+i}isGeometryVisible(e){if(!this._useFrustumCulling)return!0;const t=e.geometryObbInRenderSR;return t?.doesIntersectFrustumConservativeApproximation(this._frustum)??this.isNodeVisible(e)}_isMBSinClippingArea(e){return null==this._clippingArea||U(this._clippingArea,e)!==q.OUTSIDE}_screenSpaceDiameterMbs(e,t){const i=this.getServiceMbsInRenderSR(e),s=Math.sqrt(u(O(i),this._camPos)),n=s-i[3];return this._updateMinMaxDistance(s),n<0?.5*Number.MAX_VALUE:t/n*this._screenSizeFactor}calcCameraDistance(e){return this.calcCameraDistanceToCenter(e)-this.getServiceMbsInRenderSR(e)[3]}calcCameraDistanceToCenter(e){const t=this.getServiceMbsInRenderSR(e),i=l(O(t),this._camPos);return this._updateMinMaxDistance(i),i}calcAngleDependentLoD(e){const t=this.getServiceMbsInRenderSR(e),i=t[3],s=(Math.abs(t[0]*(t[0]-this._camPos[0])+t[1]*(t[1]-this._camPos[1])+t[2]*(t[2]-this._camPos[2]))/h(O(t))+i)/l(O(t),this._camPos);return Math.min(1,s)}hasLOD(e){return e.lodMetric!==G.None}_getDistanceGlobeMode(e,t){const s=h(O(t)),n=h(e)-s;a(this._tmp0,e,i(e,O(t))/d(e));const r=u(O(t),this._tmp0),o=t[3];if(r<=o*o)return Math.abs(n);{const r=a(this._tmp0,O(t),1/s),c=s,u=o*o/2/c,d=a(this._tmp1,r,c-u),p=e,f=m(this._tmp2,p,d),v=m(this._tmp2,f,a(this._tmp3,r,i(r,f))),g=_(this._tmp2,d,a(this._tmp2,v,o/h(v)));let b=l(p,g);if(n>=2e5){const e=m(this._tmp1,p,g);let t=i(e,r)/h(e);t<.08&&(t=1e-4),b/=t}return b}}_getDistance(e,t){return this._isGlobalMode?this._getDistanceGlobeMode(e,t):W(e,t)}_updateMinMaxDistance(e){e>0?(this.minDistance=Math.min(this.minDistance,e),this.maxDistance=Math.max(this.maxDistance,e)):(this.minDistance=0,this.maxDistance=Math.max(this.maxDistance,-e))}getLodLevel(e){if(e.lodMetric===G.None)return 0;if(0===e.childCount)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){const t=this._progressiveLoadFactor*this._screenspaceErrorBias,i=this._screenspaceErrorBias;return this.evaluateLODmetric(e,t)?this.evaluateLODmetric(e,i)?2:1:0}return this.evaluateLODmetric(e,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(e,t){switch(e.lodMetric){case G.ScreenSpaceRelative:{const i=this.getServiceMbsInRenderSR(e),s=this._getDistance(this._camPos,i),n=2*s/this._screenSizeFactor,r=s+i[3];return this._updateMinMaxDistance(r),e.maxError*t<=n}case G.MaxScreenThreshold:{let i=this._screenSpaceDiameterMbs(e,e.serviceMbsInIndexSR[3]*t);return this._options.angleDependentLoD&&(i*=this.calcAngleDependentLoD(e)),i<e.maxError}case G.RemovedFeatureDiameter:return this._screenSpaceDiameterMbs(e,e.maxError)*t<10;case G.DistanceRangeFromDefaultCamera:return this.calcCameraDistance(e)>e.maxError*t}return!1}distToPOI(e){const t=this.getServiceMbsInRenderSR(e);return l(O(t),this._poi)-t[3]}distCameraToPOI(){return l(this._camPos,this._poi)}}function W(e,t){const i=e[0]-t[0],s=e[1]-t[1],n=e[2]-t[2],r=i*i+s*s,o=t[3];if(r<=o*o)return Math.abs(n);const a=Math.sqrt(r)-o;return Math.sqrt(n*n+a*a)}const Z=p(),X=P(),Y=p(),J=p(),K=p(),Q=p(),$=p(),ee=new z,te=p(),ie=[p(),p(),p(),p(),p(),p(),p(),p()],se=p(),ne=p(),re=p(),oe=p();export{H as default};
|
|
5
|
+
import{n as e,z as t,l as i,r as s,c as n,G as r,w as o,j as a,F as c,s as u,p as l,m as h,q as d,f as m,g as _}from"../../../../chunks/vec32.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{c as f,i as v}from"../../../../chunks/vec42.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as b}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as R}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingSphere as S}from"../../../../geometry/projection/projectBoundingSphere.js";import{getProjector as M}from"../../../../geometry/projection/projectors.js";import{create as x,fromMatrix as C,intersectsSphere as I,createPoints as P}from"../../../../geometry/support/frustum.js";import{signedDistance as E,getNormal as D}from"../../../../geometry/support/plane.js";import{isPlateCarree as F}from"../../../../geometry/support/spatialReferenceUtils.js";import{g as O,w as B}from"../../../../chunks/sphere.js";import{makeDehydratedPoint as V}from"../../../../layers/graphics/dehydratedPoint.js";import{ViewingMode as j}from"../../../ViewingMode.js";import{evaluateElevationAlignmentAtPoint as A}from"../graphics/elevationAlignmentUtils.js";import{ElevationContext as L}from"../graphics/ElevationContext.js";import{createContextWithoutExpressionSupport as y,extractExpressionInfo as w}from"../graphics/featureExpressionInfoUtils.js";import{LodMetric as G}from"./I3SNode.js";import{isValidMbs as N,intersectBoundingRectWithMbs as U,MbsIntersectResult as q}from"./I3SUtil.js";import{Obb as z,computeOffsetObb as T}from"../../support/orientedBoundingBox.js";const k=1e5;class H{get _frustumMbsCenter(){return this._frustumMbs}get _frustumMbsRadius(){return this._frustumMbs[3]}get _frustumPlanes(){return this._frustum}constructor(e,t,i,s,n,r,o,a,c={}){this._indexSR=e,this._renderCoordsHelper=t,this._clippingArea=n,this._elevationProvider=r,this._viewingMode=o,this._options=c,this._frustum=x(),this._frustumMbs=g(),this._useFrustumCulling=!1,this._poi=p(),this._elevationContext=null,this.minDistance=1/0,this.maxDistance=0,this.maxLodLevel=2,this._tmpObb=new z,this._tmp1=p(),this._tmp2=p(),this._tmp3=p(),this._tmp0=p(),this._screenspaceErrorBias=c.screenspaceErrorBias||1,this._progressiveLoadFactor=c.progressiveLoadFactor||1,this.updateCamera(i,s);const u=this._renderCoordsHelper.spatialReference;this._renderSR=u,this._renderSRSphericalPCPF=R(u),this._isGlobalMode=u===this._renderSRSphericalPCPF,this.updateElevationInfo(a),this._tmpPoint=V(0,0,0,e),this._isECEFOBBInLocalMode=this._indexSR.isWGS84&&(u.isWebMercator||F(u)),this._indexSREllipsoidRadius=b(this._indexSR).radius,this._indexSRSphericalPCPF=R(e),this._projectorIndexSRToIndexSRSphericalPCPF=M(this._indexSR,this._indexSRSphericalPCPF)}updateElevationInfo(e){null!=e?(this._elevationContext=L.fromElevationInfo(e),this._elevationContext.updateFeatureExpressionInfoContext(y(w(e,!1)))):this._elevationContext=null}updateCamera(n,r){if(this._useFrustumCulling=r,r){C(n.viewMatrix,n.projectionMatrix,this._frustum,X);{const r=n.eye,o=Z;e(o,n.viewForward);const a=Y;t(a,X[4],r);const c=.5*i(a,a)/i(o,a),u=this._frustumMbs;s(u,r,o,c);const l=1+c;u[3]=l}}this._screenSizeFactor=1/(n.perScreenPixelRatio/2),this._camPos=n.eye,this.minDistance=1/0,this.maxDistance=0}setPointOfInterest(e){this._poi=e}updateScreenSpaceErrorBias(e){const t=this._screenspaceErrorBias;return this._screenspaceErrorBias=e,t}updateClippingArea(e){this._clippingArea=e}expandElevationRange(e,t,i){if(null==this._elevationContext)return;const s=e.serviceMbsInIndexSR;if(!s)return;const n="relative-to-scene"===this._elevationContext.mode?"scene":"ground";if(this._elevationProvider.getSphereElevationBounds){const e=this._elevationProvider.getSphereElevationBounds(s,this._indexSR,n);return void(e&&i.expandElevationRange(e))}const r=s[0],o=s[1],a=s[2],c=this._elevationProvider.getElevation(r,o,a,this._indexSR,n);c&&i.expandElevationRangeValues(c,c);const u=t?null:this._elevationProvider.getRootElevationBounds?.();u&&i.expandElevationRange(u)}getServiceMbsInRenderSR(e){const t=e.serviceMbsInRenderSR;if(N(t))return t;e.serviceMbsInIndexSR&&f(t,e.serviceMbsInIndexSR);const i=e.elevationRangeMin;if(this._elevationContext&&Number.isFinite(i)){let s=0,n=0;const r=e.elevationRangeMax;switch(this._elevationContext.mode){case"relative-to-ground":case"relative-to-scene":s=this._elevationContext.geometryZWithOffset(t[2],this._renderCoordsHelper)+i-t[2],n=r-i;break;case"on-the-ground":s=i-t[2],n=r-i}t[2]+=s+.5*n,t[3]+=.5*n}else this._elevationContext&&t[3]<k&&(this._tmpPoint.x=t[0],this._tmpPoint.y=t[1],this._tmpPoint.z=t[2],t[2]=A(this._tmpPoint,this._elevationProvider,this._elevationContext,this._renderCoordsHelper));return S(t,this._indexSR,t,this._renderSR),t}getAndUpdateVisibilityObbInRenderSR(e){{const t=e.visibilityObbInRenderSR;if(t)return t}const t=.01*this._indexSREllipsoidRadius,{serviceMbsInIndexSR:i,serviceObbInIndexSR:s}=e;if(null==s||!i||!s.isValid||this._isECEFOBBInLocalMode&&(s.halfSizeX>t||s.halfSizeY>t||s.halfSizeZ>t))return null;{let t=e.serviceObbInRenderSR;if(null==t)t=new z,e.serviceObbInRenderSR=t;else if(t.isValid)return t;const n=i[3];let r=0,o=0;const a=s.centerZ,c=this._renderCoordsHelper,u=this._elevationContext;if(u&&e.elevationRangeValid){const t=e.elevationRangeMin,i=e.elevationRangeMax;switch(u.mode){case"relative-to-ground":case"relative-to-scene":r=u.geometryZWithOffset(a,c)+t-a,o=i-t;break;case"on-the-ground":r=t-a,o=i-t}}else if(u&&n<k){const e=this._tmpPoint;e.x=s.centerX,e.y=s.centerY,e.z=a,r=A(e,this._elevationProvider,u,c)-a}const l=o>0,h=l?this._tmpObb:t;return s.transform(h,this._indexSR,this._renderSR,r,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),l&&T(h,0,o,this._viewingMode,t),t}}getNodeObbInRenderSRIndependentOfElevationOffset(e){{const t=e.visibilityObbInRenderSR??e.serviceObbInRenderSR??null;if(t?.isValid)return t}const t=e.serviceObbInIndexSR;return t?(t.transform(ee,this._indexSR,this._renderSR,void 0,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),ee):null}ensureElevationAgnosticBoundingVolume(e){return-1===e.elevationAgnosticBoundingVolume[3]&&e.level>0&&(this._viewingMode===j.Global?this._updateElevationAgnosticBoundingVolumeGlobal(e):this._updateElevationAgnosticBoundingVolumeLocal(e)),e.elevationAgnosticBoundingVolume}_updateElevationAgnosticBoundingVolumeGlobal(t){const s=this.getNodeObbInRenderSRIndependentOfElevationOffset(t),o=t.elevationAgnosticBoundingVolume;let a,c=-1;if(s){const t=te;s.getCenter(t),e(t,t),a=t,s.getCorners(ie);for(const s of ie){e(s,s);const n=i(s,t);if(n<=0)return void(o[3]=-1);const r=Math.sqrt(1-n*n);c=Math.max(c,r)}}else{const i=t.serviceMbsInRenderSR;if(!N(i))return void(o[3]=-1);{const t=n(te,O(i)),s=i[3],u=r(t);if(u<s)return void(o[3]=-1);c=s/u,e(t,t),a=t}}v(o,a);const u=.001;o[3]=c+u}_updateElevationAgnosticBoundingVolumeLocal(e){const t=e.elevationAgnosticBoundingVolume,i=this.getNodeObbInRenderSRIndependentOfElevationOffset(e);if(i){const e=i.getCenter(te);e[2]=0,v(t,e);let s=0;const n=se;i.getCorners(ie);for(const t of ie){t[2]=0;const e=o(n,t);s=Math.max(s,e)}t[3]=Math.sqrt(s)}else{const i=e.serviceMbsInRenderSR;if(N(i)){const e=n(te,O(i));e[2]=0,v(t,e),t[3]=i[3]}}}isNodeVisible(e){const t=this.getServiceMbsInRenderSR(e);if(!this._isMBSinClippingArea(t))return!1;if(!this._useFrustumCulling)return!0;const i=this.getAndUpdateVisibilityObbInRenderSR(e);return i?i.doesIntersectFrustumConservativeApproximation(this._frustum):I(this._frustum,B(t))}isElevationAgnosticBoundingVolumeVisible(e){return!this._useFrustumCulling||(-1===e[3]||(this._viewingMode===j.Global?this._isConeVisibleInFrustum(e):this._isCylinderVisibleInFrustum(e)))}_isConeVisibleInFrustum(n){if(!this._isConeVisibleInFrustumMbs(n))return!1;const r=n[3];if(-1===r||r>.9)return!0;const o=this._frustumPlanes,c=this._frustumMbsCenter,u=n,l=i(u,c),h=this._frustumMbsRadius,d=l-h,m=l+h;if(d<=0)return!0;const _=a(K,u,d),p=a(Q,u,m),f=r/Math.sqrt(1-r*r);for(const v of o){const n=D(v),r=e($,n),o=i(r,u);if(Math.abs(1-o)<.01)continue;const c=ne;a(c,u,o),t(c,c,r),e(c,c);const l=re;s(l,_,c,d*f);if(E(v,l)<=0)continue;s(l,p,c,m*f);if(E(v,l)<=0)continue;return!1}return!0}_isConeVisibleInFrustumMbs(e){const t=e[3];if(t>.9)return!0;const s=this._frustumMbsRadius,n=this._frustumMbsCenter,o=r(n);if(o<=s)return!0;const u=e,l=i(u,n);{const e=a(J,u,l);if(c(e,n)<s)return!0}const h=l/o;if(l<=0){return-h<s}const d=Math.sqrt(1-h*h);if(d<t)return!0;const m=s/o;return d*Math.sqrt(1-m*m)-m*h<t}isObbVisibleIndependentOfElevation(e,t){if(!this._useFrustumCulling)return!0;if(-1===e[3])return!0;const s=this._frustumMbsRadius,n=this._frustumMbsCenter,r=this._frustumPlanes,o=ie;if(t.getCorners(o),this._viewingMode===j.Global){const t=e,c=i(t,n),u=c-s,l=c+s;if(u<=0)return!0;for(const e of r){let s=!0;for(const n of o){const r=i(n,t),o=oe;if(a(o,n,u/r),E(e,o)<=0){s=!1;break}const c=oe;if(a(c,n,l/r),E(e,c)<=0){s=!1;break}}if(s)return!1}}else{const e=n[2]-s,t=n[2]+s;for(const i of r){let s=!0;const n=D(i),r=n[0],a=n[1],c=n[2],u=i[3];for(const i of o){const n=r*i[0]+a*i[1]+u;if(n+c*e<=0||n+c*t<=0){s=!1;break}}if(s)return!1}}return!0}_isCylinderVisibleInFrustum(e){const t=this._frustumMbsCenter,i=this._frustumMbsRadius,s=n(J,t);s[2]=0;const r=e[3];return c(s,e)<=r+i}isGeometryVisible(e){if(!this._useFrustumCulling)return!0;const t=e.geometryObbInRenderSR;return t?.doesIntersectFrustumConservativeApproximation(this._frustum)??this.isNodeVisible(e)}_isMBSinClippingArea(e){return null==this._clippingArea||U(this._clippingArea,e)!==q.OUTSIDE}_screenSpaceDiameterMbs(e,t){const i=this.getServiceMbsInRenderSR(e),s=Math.sqrt(u(O(i),this._camPos)),n=s-i[3];return this._updateMinMaxDistance(s),n<0?.5*Number.MAX_VALUE:t/n*this._screenSizeFactor}calcCameraDistance(e){return this.calcCameraDistanceToCenter(e)-this.getServiceMbsInRenderSR(e)[3]}calcCameraDistanceToCenter(e){const t=this.getServiceMbsInRenderSR(e),i=l(O(t),this._camPos);return this._updateMinMaxDistance(i),i}calcAngleDependentLoD(e){const t=this.getServiceMbsInRenderSR(e),i=t[3],s=(Math.abs(t[0]*(t[0]-this._camPos[0])+t[1]*(t[1]-this._camPos[1])+t[2]*(t[2]-this._camPos[2]))/h(O(t))+i)/l(O(t),this._camPos);return Math.min(1,s)}hasLOD(e){return e.lodMetric!==G.None}_getDistanceGlobeMode(e,t){const s=h(O(t)),n=h(e)-s;a(this._tmp0,e,i(e,O(t))/d(e));const r=u(O(t),this._tmp0),o=t[3];if(r<=o*o)return Math.abs(n);{const r=a(this._tmp0,O(t),1/s),c=s,u=o*o/2/c,d=a(this._tmp1,r,c-u),p=e,f=m(this._tmp2,p,d),v=m(this._tmp2,f,a(this._tmp3,r,i(r,f))),g=_(this._tmp2,d,a(this._tmp2,v,o/h(v)));let b=l(p,g);if(n>=2e5){const e=m(this._tmp1,p,g);let t=i(e,r)/h(e);t<.08&&(t=1e-4),b/=t}return b}}_getDistance(e,t){return this._isGlobalMode?this._getDistanceGlobeMode(e,t):W(e,t)}_updateMinMaxDistance(e){e>0?(this.minDistance=Math.min(this.minDistance,e),this.maxDistance=Math.max(this.maxDistance,e)):(this.minDistance=0,this.maxDistance=Math.max(this.maxDistance,-e))}getLodLevel(e){if(e.lodMetric===G.None)return 0;if(0===e.childCount)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){const t=this._progressiveLoadFactor*this._screenspaceErrorBias,i=this._screenspaceErrorBias;return this.evaluateLODmetric(e,t)?this.evaluateLODmetric(e,i)?2:1:0}return this.evaluateLODmetric(e,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(e,t){switch(e.lodMetric){case G.ScreenSpaceRelative:{const i=this.getServiceMbsInRenderSR(e),s=this._getDistance(this._camPos,i),n=2*s/this._screenSizeFactor,r=s+i[3];return this._updateMinMaxDistance(r),e.maxError*t<=n}case G.MaxScreenThreshold:{let i=this._screenSpaceDiameterMbs(e,e.serviceMbsInIndexSR[3]*t);return this._options.angleDependentLoD&&(i*=this.calcAngleDependentLoD(e)),i<e.maxError}case G.RemovedFeatureDiameter:return this._screenSpaceDiameterMbs(e,e.maxError)*t<10;case G.DistanceRangeFromDefaultCamera:return this.calcCameraDistance(e)>e.maxError*t}return!1}distToPOI(e){const t=this.getServiceMbsInRenderSR(e);return l(O(t),this._poi)-t[3]}distCameraToPOI(){return l(this._camPos,this._poi)}}function W(e,t){const i=e[0]-t[0],s=e[1]-t[1],n=e[2]-t[2],r=i*i+s*s,o=t[3];if(r<=o*o)return Math.abs(n);const a=Math.sqrt(r)-o;return Math.sqrt(n*n+a*a)}const Z=p(),X=P(),Y=p(),J=p(),K=p(),Q=p(),$=p(),ee=new z,te=p(),ie=[p(),p(),p(),p(),p(),p(),p(),p()],se=p(),ne=p(),re=p(),oe=p();export{H 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.31/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 o from"../../../../core/Logger.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromQuat as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import r from"../../../../core/Evented.js";import o from"../../../../core/Logger.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromQuat as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{a as l,h as c}from"../../../../chunks/vec32.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBoundingSphere as m}from"../../../../geometry/projection/projectBoundingSphere.js";import{empty as u,expand as h}from"../../../../geometry/support/aaBoundingRect.js";import{f as d}from"../../../../chunks/sphere.js";import{ElevationRange as f}from"../../support/ElevationRange.js";import{ElevationUpdateEvent as v}from"../../support/ElevationUpdateEvent.js";import{newIntersector as g}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as E}from"../../webgl-engine/lib/IntersectorInterfaces.js";let x=class extends(r.EventedMixin(t)){constructor(e){super(e),this._tmpEvent=new v,this._renderCoordsHelper=e.view.renderCoordsHelper,this._renderSR=this._renderCoordsHelper.spatialReference,this._layerElevationSource=e.layerElevationSource}initialize(){this._intersector=g(this.view.state.viewingMode),this._intersector.options.store=E.MIN,this._intersector.options.normalRequired=!1,this._tmpEvent.context=this.intersectionHandler.isGround?"ground":"scene"}get spatialReference(){return this.view?.elevationProvider?.spatialReference}getElevation(e,t,r,n){const i=this._renderCoordsHelper,s=l(R,e,t,r);if(!i.toRenderCoords(s,n,s))return o.getLogger(this).error("could not project point to compute elevation"),null;const{layerElevationSource:a,_intersector:c,intersectionHandler:p}=this,m=a.fullExtent,u=null!=m&&Number.isFinite(m.xmin)&&Number.isFinite(m.xmax)&&Number.isFinite(m.ymin)&&Number.isFinite(m.ymax)&&Number.isFinite(m.zmin)&&Number.isFinite(m.zmax)?new f(m.zmin,m.zmax):a.elevationRange;if(null==u)return null;const h=a.elevationOffset,d=u.elevationRangeMin+h,v=u.elevationRangeMax+h,g=i.setAltitude(y,v,s),E=i.setAltitude(b,d,s);return c.reset(g,E,null),p.intersect(c,null,g,E,null,!0),c.results.min.getIntersectionPoint(s)?i.getAltitude(s):null}getSphereElevationBounds(e,t){return m(e,t,j,this._renderSR),this._layerElevationSource.getElevationRange(j)}getRootElevationBounds(){const e=this.layerElevationSource.fullExtent;return e?.hasZ?new f(e.zmin,e.zmax):null}objectsChanged(e){this.spatialReference&&(this._computeLayerExtent(e,this._tmpEvent.extent),this._tmpEvent.spatialReference=this.spatialReference,this.emit("elevation-change",this._tmpEvent))}objectChanged(e){this.spatialReference&&(this._computeObjectExtent(e,this._tmpEvent.extent),this._tmpEvent.spatialReference=this.spatialReference,this.emit("elevation-change",this._tmpEvent))}_computeObjectExtent(e,t){u(t),this._expandExtent(e,t)}_computeLayerExtent(e,t){u(t);for(const r of e)this._expandExtent(r,t)}_expandExtent(e,t){const r=this.spatialReference;if(null==r)return;if(null==e)return;s(_,e.quaternion),_[12]=e.center[0],_[13]=e.center[1],_[14]=e.center[2];const o=e.halfSize;for(let n=0;n<8;++n)R[0]=1&n?o[0]:-o[0],R[1]=2&n?o[1]:-o[1],R[2]=4&n?o[2]:-o[2],c(R,R,_),this._renderCoordsHelper.fromRenderCoords(R,R,r),h(t,R,t)}};e([n({constructOnly:!0})],x.prototype,"layerElevationSource",void 0),e([n({constructOnly:!0})],x.prototype,"intersectionHandler",void 0),e([n({constructOnly:!0})],x.prototype,"view",void 0),e([n()],x.prototype,"spatialReference",null),x=e([i("esri.views.3d.layers.i3s.LayerElevationProvider")],x);const _=a(),j=d(0,0,0,0),R=p(),y=p(),b=p();export{x as LayerElevationProvider};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{l as e}from"../../../../chunks/vec32.js";function t(e,t,g){for(let n=0;n<t.length;n++)r[n]=!1,o[n]=null;for(let r=0;r<e.length;r++)n[r]=!1,l[r]=null;for(let n=0;n<t.length;n++){const o=h(t[n],e,g);o>=0&&(r[n]=!0,null!=l[o]?l[o].push(t[n]):l[o]=[t[n]])}for(let l=0;l<e.length;l++){const r=h(e[l],t,g);r>=0&&(n[l]=!0,null!=o[r]?o[r].push(e[l]):o[r]=[e[l]])}const u=[];for(let r=0;r<e.length;r++)null!=l[r]||n[r]||u.push({load:[],remove:[e[r]]});for(let n=0;n<t.length;n++)null!=o[n]||r[n]||u.push({load:[t[n]],remove:[]});for(let n=0;n<t.length;n++)null!=o[n]&&(o[n].length>1||o[n][0]!==t[n])&&u.push({load:[t[n]],remove:o[n]});for(let n=0;n<e.length;n++)null!=l[n]&&(l[n].length>1||l[n][0]!==e[n])&&u.push({load:l[n],remove:[e[n]]});return u}const n=[!1],l=[null],r=[!1],o=[null];function h(e,t,n){let l=e;for(;l>0;){const e=t.indexOf(l);if(e>=0)return e;l=n.getParentId(l)}return t.indexOf(l)}function g(t,n,l){return t.sort(((t,r)=>{if(0===t.load.length&&0===r.load.length)return 0;if(0===t.load.length)return-1;if(0===r.load.length)return 1;if(0===t.remove.length&&0===r.remove.length){const o=l.getRenderObb(t.load[0]).center,h=l.getRenderObb(r.load[0]).center;return e(o,n)-e(h,n)}if(0===t.remove.length)return-1;if(0===r.remove.length)return 1;if(1===t.load.length&&1===r.load.length){const o=l.getRenderObb(t.load[0]).center,h=l.getRenderObb(r.load[0]).center;return e(o,n)-e(h,n)}if(1===t.load.length)return-1;if(1===r.load.length)return 1;{const o=l.getRenderObb(t.remove[0]).center,h=l.getRenderObb(r.remove[0]).center;return e(o,n)-e(h,n)}}))}function u(e,t,n){for(let l=0;l<e.length;++l){const r=e[l];r.load.length>t&&1===r.remove.length&&d(e,r,n)}}function d(e,t,n){const l=[t.remove[0]],r=[];for(;1===l.length;){const e=l.pop();r.length=0;for(let o=0;o<t.load.length;o++){let h=t.load[o],g=n.getParentId(h);for(;g!==e;)h=g,g=n.getParentId(h);let u=l.indexOf(h);u<0&&(u=l.length,l.push(h),r.push([])),r[u].push(t.load[o])}}t.load=l;for(let o=0;o<l.length;o++)r[o].length>1?e.push({remove:[l[o]],load:r[o]}):l[o]=r[o][0]}export{t as nodeDiff,g as sortFrontToBack,u as splitWorkEntries,d as splitWorkEntry};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import t from"../../../../core/PooledArray.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{f as n,
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import t from"../../../../core/PooledArray.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{f as n,m as o,j as a,k as l,l as h,q as c}from"../../../../chunks/vec32.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as u}from"../../../../chunks/vec42.js";import{create as m,offset as p,contains as g,containsPoint as _,set as f,positiveInfinity as P,equals as b}from"../../../../geometry/support/aaBoundingBox.js";import{create as S}from"../../../../geometry/support/plane.js";import{fromPoints as x}from"../../../../geometry/support/ray.js";import{PclTarget as w}from"./Intersector.js";import{PointHighlights as z}from"./PointHighlights.js";import{isDepth as R,ShaderOutput as A}from"../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncPrepareRenderPlugin as j}from"../../webgl-engine/effects/RenderPlugin.js";import{Default3D as q}from"../../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{newIntersectorResult as y}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as O,StoreResults as E}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{RenderSlot as I}from"../../webgl-engine/lib/RenderSlot.js";import{VertexArrayObject as v}from"../../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as F}from"../../webgl-engine/lib/VertexAttribute.js";import{P as L,a as N,g as C}from"../../../../chunks/PointRenderer.glsl.js";import{PointRendererTechnique as T}from"../../webgl-engine/shaders/PointRendererTechnique.js";import{PointRendererTechniqueConfiguration as H}from"../../webgl-engine/shaders/PointRendererTechniqueConfiguration.js";import{BufferObject as M}from"../../../webgl/BufferObject.js";import{DataType as B,PrimitiveType as D,Usage as U}from"../../../webgl/enums.js";import{VertexElementDescriptor as V}from"../../../webgl/VertexElementDescriptor.js";const W=new Map([["positions",[new V(F.POSITION,3,B.FLOAT,0,12)]],["colors",[new V(F.COLOR,3,B.UNSIGNED_BYTE,0,3,!0)]]]);let k=class extends j{constructor(e){super(e),this.type=O.PCL,this.isGround=!1,this._passParameters=new L,this._highlights=new z({forEachNode:e=>this.forEachNode(e),addHighlight:(e,s,t)=>this._addHighlight(e,s,t),removeHighlight:(e,s)=>this._removeHighlight(e,s)}),this.produces=new Map([[I.OPAQUE_MATERIAL,e=>!(R(e)||e===A.Highlight&&this._highlights.empty)],[I.OPAQUE_NO_SSAO_DEPTH,e=>R(e)]]),this.layerUid="",this._slicePlaneEnabled=!1,this._techniqueConfig=new H,this._nodes=new t}initializeRenderContext(e){this._context=e,e.requestRender()}uninitializeRenderContext(){}intersect(e,s,t,i){const r=d(),f=d(),P=d(),b=d(),z=S(),R=e.camera.perScreenPixelRatio/2,A=e.camera.near;n(f,i,t);const j=1/o(f);a(f,f,j),l(P,f),u(z,f[0],f[1],f[2],-h(f,t));const q=new ee,O=new ee,I=new Array,v=m(),F=m(this._passParameters.clipBox);p(F,-t[0],-t[1],-t[2],F),this._nodes.forAll((o=>{const a=o.splatSize*this._passParameters.scaleFactor;let l=o.obb.minimumDistancePlane(z),d=o.obb.maximumDistancePlane(z);l-=J(a,l+A,this._passParameters,R,o.isLeaf),d-=J(a,d+A,this._passParameters,R,o.isLeaf);const u=d<0,m=null!=q.dist&&null!=O.dist&&q.dist<l*j&&O.dist>d*j;if(u||m)return;const S=Y(a,d+A,this._passParameters,R,o.isLeaf);if(!o.obb.intersectRay(t,f,S))return;const x=S*S;o.obb.toAaBoundingBox(v),p(v,-t[0],-t[1],-t[2],v);const w=!g(F,v);n(b,o.origin,t);const y=o.coordinates.length/3;for(let n=0;n<y;n++){if(r[0]=b[0]+o.coordinates[3*n],r[1]=b[1]+o.coordinates[3*n+1],r[2]=b[2]+o.coordinates[3*n+2],w&&!_(F,r))continue;const l=h(r,f),d=c(r)-l*l;if(d>x)continue;let u=l+A;const m=J(a,u,this._passParameters,R,o.isLeaf);if(l-m<0)continue;u-=m;const p=Y(a,u,this._passParameters,R,o.isLeaf);if(d>p*p)continue;const g=(l-m)*j,S=e=>(e.point=K(o,n,e.point),e.dist=g,e.normal=P,e.node=o,e.pointId=n,e.layerUid=this.layerUid,e);if((null==q.dist||g<q.dist)&&(null==s||s(t,i,g))&&S(q),e.options.store!==E.MIN&&(null==O.dist||g>O.dist)&&(null==s||s(t,i,g))&&S(O),e.options.store===E.ALL&&(null==s||s(t,i,g))){const e=new ee;I.push(S(e))}}}));const L=e=>{const{layerUid:s,node:t,pointId:i}=e;return new w(e.point,s,i,(()=>this.createGraphic(t,i,e.point)))},N=(e,s)=>{const t=L(s);e.set(this.type,t,s.dist,s.normal)};if(se(q)){const s=e.results.min;(null==s.dist||q.dist<s.dist)&&N(s,q)}if(se(O)&&e.options.store!==E.MIN){const s=e.results.max;(null==s.dist||O.dist>s.dist)&&N(s,O)}if(e.options.store===E.ALL){const s=x(t,i);for(const t of I){const i=y(s);N(i,t),e.results.all.push(i)}}}prepareTechnique(e){return 0!==this._nodes.length&&(e.output===A.Color||R(e.output)&&e.bindParameters.slot===I.OPAQUE_NO_SSAO_DEPTH||e.output===A.Highlight)?(this._nodes.forAll((s=>{null==s.vao&&this._initNode(e,s)})),this._techniqueConfig.drawScreenSize=this._passParameters.drawScreenSpace,this._techniqueConfig.useFixedSizes=this._passParameters.useFixedSizes,this._techniqueConfig.hasSlicePlane=this._slicePlaneEnabled,this._techniqueConfig.hasOccludees=e.bindParameters.hasOccludees,this._techniqueConfig.clippingEnabled=this._clippingEnabled,this._techniqueConfig.output=e.output,this._context.techniques.releaseAndAcquire(T,this._techniqueConfig,this._technique)):null}renderNode(e,s){const t=e.rctx,i=t.bindTechnique(s,e.bindParameters,this._passParameters),r=e.output===A.Highlight;this._nodes.forAll((s=>{0!==s.coordinates.length&&(!r||s.highlights&&0===e.bindParameters.highlightLevel)&&(i.bindDraw(e.bindParameters,this._passParameters,s),t.bindVAO(s.vao),r?this._renderHighlightFragments(t,s):t.drawArrays(D.POINTS,0,s.coordinates.length/3))}))}_renderHighlightFragments(e,s){const t=s.highlights;if(null==t)return;let i=t[0].component,r=i+1;for(let o=1;o<t.length;o++){const s=t[o].component;if(s!==r){const t=r-i;t>0&&e.drawArrays(D.POINTS,i,t),i=s}r=s+1}const n=r-i;n>0&&e.drawArrays(D.POINTS,i,n)}set useFixedSizes(e){this._passParameters.useFixedSizes!==e&&(this._passParameters.useFixedSizes=e,this._requestRender())}get useFixedSizes(){return this._passParameters.useFixedSizes}set scaleFactor(e){this._passParameters.scaleFactor!==e&&(this._passParameters.scaleFactor=e,this._requestRender())}get scaleFactor(){return this._passParameters.scaleFactor}set minSizePx(e){this._passParameters.minSizePx!==e&&(this._passParameters.minSizePx=e,this._requestRender())}get minSizePx(){return this._passParameters.minSizePx}set useRealWorldSymbolSizes(e){this._passParameters.useRealWorldSymbolSizes!==e&&(this._passParameters.useRealWorldSymbolSizes=e,this._requestRender())}get useRealWorldSymbolSizes(){return this._passParameters.useRealWorldSymbolSizes}set size(e){this._passParameters.size!==e&&(this._passParameters.size=e,this._requestRender())}get size(){return this._passParameters.size}set sizePx(e){this._passParameters.sizePx!==e&&(this._passParameters.sizePx=e,this._requestRender())}get sizePx(){return this._passParameters.sizePx}set clippingBox(e){f(this._passParameters.clipBox,e||P)}get _clippingEnabled(){return!b(this._passParameters.clipBox,P,((e,s)=>e===s))}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this._requestRender())}addNode(e){this._nodes.push(e),this._highlights.nodeAdded(e),this._requestRender()}removeNode(e){let t=null;return this._nodes.filterInPlace((i=>i.id!==e||(t=i,i.vao=s(i.vao),this._highlights.nodeRemoved(i),!1))),this._requestRender(),t}forEachNode(e){this._nodes.forAll(e)}removeAll(){this._nodes.forAll((e=>e.vao=s(e.vao))),this._highlights.removeAll(),this._nodes.clear(),this._requestRender()}highlight(e){return this._highlights.add(e)}_addHighlight(e,s,t){e.highlights=Z(e.highlights,s,t),this._requestRender()}_removeHighlight(e,s){e.highlights=$(e.highlights,s),this._requestRender()}_initNode(e,s){const t=e.rctx;s.vao=new v(t,q,W,new Map([["positions",M.createVertex(t,U.STATIC_DRAW,s.coordinates)],["colors",M.createVertex(t,U.STATIC_DRAW,s.rgb)]]))}_requestRender(){this._context&&this._context.requestRender()}};e([i({constructOnly:!0})],k.prototype,"createGraphic",void 0),k=e([r("esri.views.3d.layers.i3s.PointRenderer")],k);class G extends N{constructor(e,s,t,i,r,n,o,a,l=null,h=null){super(t,r,s),this.id=e,this.obb=i,this.coordinates=n,this.rgb=o,this.attributes=a,this.pointIdFilterMap=l,this.highlights=h}}function Q(e){return e.hasOwnProperty("splatSize")}function Y(e,s,t,i,r){if(t.drawScreenSpace)return t.fixedSize*s*i;const n=C(r)*s*i;return t.useFixedSizes?Math.min(t.fixedSize/2,n):t.screenMinSize>0?Math.min(Math.max(t.screenMinSize*s*i,e/2),n):Math.min(e/2,n)}function J(e,s,t,i,r){return t.drawScreenSpace?0:Y(e,s,t,i,r)}function K(e,s,t){return null==t&&(t=d()),t[0]=e.origin[0]+e.coordinates[3*s],t[1]=e.origin[1]+e.coordinates[3*s+1],t[2]=e.origin[2]+e.coordinates[3*s+2],t}function X(e){return null!=e.component?e.component:-1}function Z(e,s,t){null==e&&(e=[]);const i={component:s,id:t};e.push(i);const r=X(i);let n=e.length-1;for(;n>0&&r<X(e[n-1]);)[e[n-1],e[n]]=[e[n],e[n-1]],--n;return e}function $(e,s){if(null==e)return e;const t=e.filter((e=>e.id!==s));return 0===t.length?null:t}class ee{constructor(){this.node=null,this.pointId=null,this.point=null,this.dist=null,this.normal=null,this.layerUid=""}}function se(e){return null!=e.dist&&null!=e.point&&null!=e.pointId&&null!=e.node}export{k as PointRenderer,G as PointRendererNode,Q as isPointRendererNode};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../core/has.js";import{clamp as e}from"../../../../core/mathUtils.js";import{fromMat4 as t}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{identity as i,copy as n,set as s,multiply as r,scale as l,translate as a,rotateZ as u,rotateX as f,rotateY as c}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as d}from"../../../../chunks/vec32.js";import{create as z}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{meterIn as m}from"../../../../renderers/support/lengthUtils.js";import{debugFlags as v}from"../../support/debugFlags.js";import{NoParameters as S}from"../../webgl-engine/core/shaderModules/interfaces.js";var h,y;!function(e){e[e.Undefined=0]="Undefined",e[e.DefinedSize=1]="DefinedSize",e[e.DefinedScale=2]="DefinedScale"}(h||(h={})),function(e){e[e.Undefined=0]="Undefined",e[e.DefinedAngle=1]="DefinedAngle"}(y||(y={}));class x{constructor(e){this.field=e}}class g extends x{constructor(e){super(e),this.minSize=[0,0,0],this.maxSize=[0,0,0],this.offset=[0,0,0],this.factor=[0,0,0],this.type=[h.Undefined,h.Undefined,h.Undefined]}}class b extends x{constructor(e){super(e),this.colors=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.values=[0,0,0,0,0,0,0,0]}}class C extends x{constructor(e){super(e),this.values=[0,0,0,0,0,0,0,0],this.opacityValues=[0,0,0,0,0,0,0,0]}}class D extends x{constructor(e){super(e),this.offset=[0,0,0],this.factor=[1,1,1],this.type=[0,0,0]}}class U{}function w(e){return null!=e}function V(e){return"number"==typeof e}function M(e){return"string"==typeof e}function j(e){return null==e||M(e)}function A(e,t){e&&e.push(t)}function I(e,t,o,i=p()){const n=e||0,s=t||0,r=o||0;return 0!==n&&u(i,i,-n/180*Math.PI),0!==s&&f(i,i,s/180*Math.PI),0!==r&&c(i,i,r/180*Math.PI),i}function T(e,t,o,i,n){const s=e.minSize,r=e.maxSize;if(e.useSymbolValue){const e=i.symbolSize[o];return t.minSize[o]=e,t.maxSize[o]=e,t.offset[o]=t.minSize[o],t.factor[o]=0,t.type[o]=h.DefinedSize,!0}if(w(e.field))return w(e.stops)?2===e.stops.length&&V(e.stops[0].size)&&V(e.stops[1].size)?(F(e.stops[0].size,e.stops[1].size,e.stops[0].value,e.stops[1].value,t,o),t.type[o]=h.DefinedSize,!0):(A(n,"Could not convert size info: stops only supported with 2 elements"),!1):V(s)&&V(r)&&w(e.minDataValue)&&w(e.maxDataValue)?(F(s,r,e.minDataValue,e.maxDataValue,t,o),t.type[o]=h.DefinedSize,!0):"unknown"===e.valueUnit?(A(n,"Could not convert size info: proportional size not supported"),!1):null!=m[e.valueUnit]?(t.minSize[o]=-1/0,t.maxSize[o]=1/0,t.offset[o]=0,t.factor[o]=1/m[e.valueUnit],t.type[o]=h.DefinedSize,!0):(A(n,"Could not convert size info: scale-dependent size not supported"),!1);if(!w(e.field)){if(e.stops?.[0]&&V(e.stops[0].size))return t.minSize[o]=e.stops[0].size,t.maxSize[o]=e.stops[0].size,t.offset[o]=t.minSize[o],t.factor[o]=0,t.type[o]=h.DefinedSize,!0;if(V(s))return t.minSize[o]=s,t.maxSize[o]=s,t.offset[o]=s,t.factor[o]=0,t.type[o]=h.DefinedSize,!0}return A(n,"Could not convert size info: unsupported variant of sizeInfo"),!1}function F(e,t,o,i,n,s){const r=Math.abs(i-o)>0?(t-e)/(i-o):0;n.minSize[s]=r>0?e:t,n.maxSize[s]=r>0?t:e,n.offset[s]=e-o*r,n.factor[s]=r}function P(e,t,o,i){if(e.normalizationField||e.valueRepresentation)return A(i,"Could not convert size info: unsupported property"),null;if(!j(e.field))return A(i,"Could not convert size info: field is not a string"),null;if(t.size){if(e.field)if(t.size.field){if(e.field!==t.size.field)return A(i,"Could not convert size info: multiple fields in use"),null}else t.size.field=e.field}else t.size=new g(e.field);let n;switch(e.axis){case"width":return n=T(e,t.size,0,o,i),n?t:null;case"height":return n=T(e,t.size,2,o,i),n?t:null;case"depth":return n=T(e,t.size,1,o,i),n?t:null;case"width-and-depth":return n=T(e,t.size,0,o,i),n&&T(e,t.size,1,o,i),n?t:null;case null:case void 0:case"all":return n=T(e,t.size,0,o,i),n=n&&T(e,t.size,1,o,i),n=n&&T(e,t.size,2,o,i),n?t:null;default:return A(i,`Could not convert size info: unknown axis "${e.axis}""`),null}}function R(e,t,o){for(let n=0;n<3;++n){let o=t.unitInMeters;e.type[n]===h.DefinedSize&&(o*=t.modelSize[n],e.type[n]=h.DefinedScale),e.minSize[n]=e.minSize[n]/o,e.maxSize[n]=e.maxSize[n]/o,e.offset[n]=e.offset[n]/o,e.factor[n]=e.factor[n]/o}let i;if(e.type[0]!==h.Undefined)i=0;else if(e.type[1]!==h.Undefined)i=1;else{if(e.type[2]===h.Undefined)return A(o,"No size axis contains a valid size or scale"),!1;i=2}for(let n=0;n<3;++n)e.type[n]===h.Undefined&&(e.minSize[n]=e.minSize[i],e.maxSize[n]=e.maxSize[i],e.offset[n]=e.offset[i],e.factor[n]=e.factor[i],e.type[n]=e.type[i]);return!0}function k(e,t,o){e[4*t]=o.r/255,e[4*t+1]=o.g/255,e[4*t+2]=o.b/255,e[4*t+3]=o.a}function E(e,t,o){if(e.normalizationField)return A(o,"Could not convert color info: unsupported property"),null;if(M(e.field)){if(!e.stops)return A(o,"Could not convert color info: missing stops or colors"),null;{if(e.stops.length>8)return A(o,"Could not convert color info: too many color stops"),null;t.color=new b(e.field);const i=e.stops;for(let e=0;e<8;++e){const o=i[Math.min(e,i.length-1)];t.color.values[e]=o.value,k(t.color.colors,e,o.color)}}}else{if(!(e.stops&&e.stops.length>=0))return A(o,"Could not convert color info: no field and no colors/stops"),null;{const o=e.stops&&e.stops.length>=0&&e.stops[0].color;t.color={field:null,values:[0,0,0,0,0,0,0,0],colors:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]};for(let e=0;e<8;e++)t.color.values[e]=1/0,k(t.color.colors,e,o)}}return t}function _(e,t,o){if(e.normalizationField)return A(o,"Could not convert opacity info: unsupported property"),null;if(M(e.field)){if(!e.stops)return A(o,"Could not convert opacity info: missing stops or opacities"),null;{if(e.stops.length>8)return A(o,"Could not convert opacity info: too many opacity stops"),null;t.opacity=new C(e.field);const i=e.stops;for(let e=0;e<8;++e){const o=i[Math.min(e,i.length-1)];t.opacity.values[e]=o.value,t.opacity.opacityValues[e]=o.opacity}}}else{if(!(e.stops&&e.stops.length>=0))return A(o,"Could not convert opacity info: no field and no opacities/stops"),null;{const o=e.stops&&e.stops.length>=0?e.stops[0].opacity:0;t.opacity={field:null,values:[0,0,0,0,0,0,0,0],opacityValues:[0,0,0,0,0,0,0,0]};for(let e=0;e<8;e++)t.opacity.values[e]=1/0,t.opacity.opacityValues[e]=o}}return t}function q(e,t,o){const i=2===o&&"arithmetic"===e.rotationType;t.offset[o]=i?90:0,t.factor[o]=i?-1:1,t.type[o]=1}function $(e,t,o){if(!M(e.field))return A(o,"Could not convert rotation info: field is not a string"),null;if(t.rotation){if(e.field)if(t.rotation.field){if(e.field!==t.rotation.field)return A(o,"Could not convert rotation info: multiple fields in use"),null}else t.rotation.field=e.field}else t.rotation={field:e.field,offset:[0,0,0],factor:[1,1,1],type:[0,0,0]};switch(e.axis){case"tilt":return q(e,t.rotation,0),t;case"roll":return q(e,t.rotation,1),t;case null:case void 0:case"heading":return q(e,t.rotation,2),t;default:return A(o,`Could not convert rotation info: unknown axis "${e.axis}""`),null}}class B{constructor(e,t=[1,1,1],o=[1,1,1],i=1,n=[0,0,0],s=[1,1,1],r=[0,0,0]){this.supports=e,this.modelSize=t,this.symbolSize=o,this.unitInMeters=i,this.anchor=n,this.scale=s,this.rotation=r}}function L(e,t,o){if(!e)return null;const i=e.reduce(((e,i)=>{if(!e)return e;if(i.valueExpression)return A(o,"Could not convert visual variables: arcade expressions not supported"),null;switch(i.type){case"size":return t.supports.size?P(i,e,t,o):e;case"color":return t.supports.color?E(i,e,o):e;case"opacity":return t.supports.opacity?_(i,e,o):null;case"rotation":return t.supports.rotation?$(i,e,o):e;default:return null}}),new U);return!(e.length>0&&i)||i.size||i.color||i.opacity||i.rotation?i?.size&&!R(i.size,t,o)?null:i:null}class N{constructor(e,t,o){this.visualVariables=e,this.materialParameters=t,this.requiresShaderTransformation=o}}function O(e,t){if(!e)return null;if(v.TESTS_DISABLE_FAST_UPDATES)return null;const o=L(e.visualVariables,t);return o?new N(o,K(o,t),!!o.size):null}function G(e,t,o){if(!t||!e)return!1;const i=e.visualVariables,n=L(t.visualVariables,o);return!!n&&(!!(H(i.size,n.size,"size")&&H(i.color,n.color,"color")&&H(i.rotation,n.rotation,"rotation")&&H(i.opacity,n.opacity,"opacity"))&&(e.visualVariables=n,e.materialParameters=K(n,o),e.requiresShaderTransformation=!!n.size,!0))}function H(e,t,o){if(!!e!=!!t)return!1;if(e&&e.field!==t?.field)return!1;if(e&&"rotation"===o){const o=e,i=t;for(let e=0;e<3;e++)if(o.type[e]!==i.type[e]||o.offset[e]!==i.offset[e]||o.factor[e]!==i.factor[e])return!1}return!0}class J extends S{constructor(e){super(),this.vvSize=e?.size??null,this.vvColor=e?.color??null,this.vvOpacity=e?.opacity??null}}function K(e,n){const s=new J(e);return s.vvSize&&(s.vvSymbolAnchor=n.anchor,i(ee),I(n.rotation[2],n.rotation[0],n.rotation[1],ee),s.vvSymbolRotationMatrix=s.vvSymbolRotationMatrix||o(),t(s.vvSymbolRotationMatrix,ee)),s}function Q(t,o,i){if(!t.vvSize)return i;n(Y,i);const u=t.vvSymbolRotationMatrix;s(ee,u[0],u[1],u[2],0,u[3],u[4],u[5],0,u[6],u[7],u[8],0,0,0,0,1),r(Y,Y,ee);for(let n=0;n<3;++n){const i=t.vvSize.offset[n]+o[0]*t.vvSize.factor[n];Z[n]=e(i,t.vvSize.minSize[n],t.vvSize.maxSize[n])}return l(Y,Y,Z),a(Y,Y,t.vvSymbolAnchor),Y}function W(t,o,i){if(!o.vvSize)return d(t,1,1,1),t;for(let n=0;n<3;++n){const s=o.vvSize.offset[n]+i[0]*o.vvSize.factor[n];t[n]=e(s,o.vvSize.minSize[n],o.vvSize.maxSize[n])}return t}function X(e,t){const o=null==e?0:t.attributes[e];return"number"==typeof o&&isFinite(o)?o:0}const Y=p(),Z=z(),ee=p();export{B as ConvertOptions,b as FastColorInfo,C as FastOpacityInfo,D as FastRotationInfo,y as FastRotationType,g as FastSizeInfo,h as FastSizeType,N as FastSymbolUpdatesState,U as FastVisualVariables,J as VisualVariablesParameters,L as convertVisualVariables,Q as evaluateModelTransform,W as evaluateModelTransformScale,X as getAttributeValue,K as getMaterialParameters,O as initFastSymbolUpdatesState,G as updateFastSymbolUpdatesState};
|
|
5
|
+
import"../../../../core/has.js";import{clamp as e}from"../../../../core/mathUtils.js";import{fromMat4 as t}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{identity as i,copy as n,set as s,multiply as r,scale as l,translate as a,rotateZ as u,rotateX as f,rotateY as c}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{a as d}from"../../../../chunks/vec32.js";import{create as z}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{meterIn as m}from"../../../../renderers/support/lengthUtils.js";import{debugFlags as v}from"../../support/debugFlags.js";import{NoParameters as S}from"../../webgl-engine/core/shaderModules/interfaces.js";var h,y;!function(e){e[e.Undefined=0]="Undefined",e[e.DefinedSize=1]="DefinedSize",e[e.DefinedScale=2]="DefinedScale"}(h||(h={})),function(e){e[e.Undefined=0]="Undefined",e[e.DefinedAngle=1]="DefinedAngle"}(y||(y={}));class x{constructor(e){this.field=e}}class g extends x{constructor(e){super(e),this.minSize=[0,0,0],this.maxSize=[0,0,0],this.offset=[0,0,0],this.factor=[0,0,0],this.type=[h.Undefined,h.Undefined,h.Undefined]}}class b extends x{constructor(e){super(e),this.colors=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.values=[0,0,0,0,0,0,0,0]}}class C extends x{constructor(e){super(e),this.values=[0,0,0,0,0,0,0,0],this.opacityValues=[0,0,0,0,0,0,0,0]}}class D extends x{constructor(e){super(e),this.offset=[0,0,0],this.factor=[1,1,1],this.type=[0,0,0]}}class U{}function w(e){return null!=e}function V(e){return"number"==typeof e}function M(e){return"string"==typeof e}function j(e){return null==e||M(e)}function A(e,t){e&&e.push(t)}function I(e,t,o,i=p()){const n=e||0,s=t||0,r=o||0;return 0!==n&&u(i,i,-n/180*Math.PI),0!==s&&f(i,i,s/180*Math.PI),0!==r&&c(i,i,r/180*Math.PI),i}function T(e,t,o,i,n){const s=e.minSize,r=e.maxSize;if(e.useSymbolValue){const e=i.symbolSize[o];return t.minSize[o]=e,t.maxSize[o]=e,t.offset[o]=t.minSize[o],t.factor[o]=0,t.type[o]=h.DefinedSize,!0}if(w(e.field))return w(e.stops)?2===e.stops.length&&V(e.stops[0].size)&&V(e.stops[1].size)?(F(e.stops[0].size,e.stops[1].size,e.stops[0].value,e.stops[1].value,t,o),t.type[o]=h.DefinedSize,!0):(A(n,"Could not convert size info: stops only supported with 2 elements"),!1):V(s)&&V(r)&&w(e.minDataValue)&&w(e.maxDataValue)?(F(s,r,e.minDataValue,e.maxDataValue,t,o),t.type[o]=h.DefinedSize,!0):"unknown"===e.valueUnit?(A(n,"Could not convert size info: proportional size not supported"),!1):null!=m[e.valueUnit]?(t.minSize[o]=-1/0,t.maxSize[o]=1/0,t.offset[o]=0,t.factor[o]=1/m[e.valueUnit],t.type[o]=h.DefinedSize,!0):(A(n,"Could not convert size info: scale-dependent size not supported"),!1);if(!w(e.field)){if(e.stops?.[0]&&V(e.stops[0].size))return t.minSize[o]=e.stops[0].size,t.maxSize[o]=e.stops[0].size,t.offset[o]=t.minSize[o],t.factor[o]=0,t.type[o]=h.DefinedSize,!0;if(V(s))return t.minSize[o]=s,t.maxSize[o]=s,t.offset[o]=s,t.factor[o]=0,t.type[o]=h.DefinedSize,!0}return A(n,"Could not convert size info: unsupported variant of sizeInfo"),!1}function F(e,t,o,i,n,s){const r=Math.abs(i-o)>0?(t-e)/(i-o):0;n.minSize[s]=r>0?e:t,n.maxSize[s]=r>0?t:e,n.offset[s]=e-o*r,n.factor[s]=r}function P(e,t,o,i){if(e.normalizationField||e.valueRepresentation)return A(i,"Could not convert size info: unsupported property"),null;if(!j(e.field))return A(i,"Could not convert size info: field is not a string"),null;if(t.size){if(e.field)if(t.size.field){if(e.field!==t.size.field)return A(i,"Could not convert size info: multiple fields in use"),null}else t.size.field=e.field}else t.size=new g(e.field);let n;switch(e.axis){case"width":return n=T(e,t.size,0,o,i),n?t:null;case"height":return n=T(e,t.size,2,o,i),n?t:null;case"depth":return n=T(e,t.size,1,o,i),n?t:null;case"width-and-depth":return n=T(e,t.size,0,o,i),n&&T(e,t.size,1,o,i),n?t:null;case null:case void 0:case"all":return n=T(e,t.size,0,o,i),n=n&&T(e,t.size,1,o,i),n=n&&T(e,t.size,2,o,i),n?t:null;default:return A(i,`Could not convert size info: unknown axis "${e.axis}""`),null}}function R(e,t,o){for(let n=0;n<3;++n){let o=t.unitInMeters;e.type[n]===h.DefinedSize&&(o*=t.modelSize[n],e.type[n]=h.DefinedScale),e.minSize[n]=e.minSize[n]/o,e.maxSize[n]=e.maxSize[n]/o,e.offset[n]=e.offset[n]/o,e.factor[n]=e.factor[n]/o}let i;if(e.type[0]!==h.Undefined)i=0;else if(e.type[1]!==h.Undefined)i=1;else{if(e.type[2]===h.Undefined)return A(o,"No size axis contains a valid size or scale"),!1;i=2}for(let n=0;n<3;++n)e.type[n]===h.Undefined&&(e.minSize[n]=e.minSize[i],e.maxSize[n]=e.maxSize[i],e.offset[n]=e.offset[i],e.factor[n]=e.factor[i],e.type[n]=e.type[i]);return!0}function k(e,t,o){e[4*t]=o.r/255,e[4*t+1]=o.g/255,e[4*t+2]=o.b/255,e[4*t+3]=o.a}function E(e,t,o){if(e.normalizationField)return A(o,"Could not convert color info: unsupported property"),null;if(M(e.field)){if(!e.stops)return A(o,"Could not convert color info: missing stops or colors"),null;{if(e.stops.length>8)return A(o,"Could not convert color info: too many color stops"),null;t.color=new b(e.field);const i=e.stops;for(let e=0;e<8;++e){const o=i[Math.min(e,i.length-1)];t.color.values[e]=o.value,k(t.color.colors,e,o.color)}}}else{if(!(e.stops&&e.stops.length>=0))return A(o,"Could not convert color info: no field and no colors/stops"),null;{const o=e.stops&&e.stops.length>=0&&e.stops[0].color;t.color={field:null,values:[0,0,0,0,0,0,0,0],colors:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]};for(let e=0;e<8;e++)t.color.values[e]=1/0,k(t.color.colors,e,o)}}return t}function _(e,t,o){if(e.normalizationField)return A(o,"Could not convert opacity info: unsupported property"),null;if(M(e.field)){if(!e.stops)return A(o,"Could not convert opacity info: missing stops or opacities"),null;{if(e.stops.length>8)return A(o,"Could not convert opacity info: too many opacity stops"),null;t.opacity=new C(e.field);const i=e.stops;for(let e=0;e<8;++e){const o=i[Math.min(e,i.length-1)];t.opacity.values[e]=o.value,t.opacity.opacityValues[e]=o.opacity}}}else{if(!(e.stops&&e.stops.length>=0))return A(o,"Could not convert opacity info: no field and no opacities/stops"),null;{const o=e.stops&&e.stops.length>=0?e.stops[0].opacity:0;t.opacity={field:null,values:[0,0,0,0,0,0,0,0],opacityValues:[0,0,0,0,0,0,0,0]};for(let e=0;e<8;e++)t.opacity.values[e]=1/0,t.opacity.opacityValues[e]=o}}return t}function q(e,t,o){const i=2===o&&"arithmetic"===e.rotationType;t.offset[o]=i?90:0,t.factor[o]=i?-1:1,t.type[o]=1}function $(e,t,o){if(!M(e.field))return A(o,"Could not convert rotation info: field is not a string"),null;if(t.rotation){if(e.field)if(t.rotation.field){if(e.field!==t.rotation.field)return A(o,"Could not convert rotation info: multiple fields in use"),null}else t.rotation.field=e.field}else t.rotation={field:e.field,offset:[0,0,0],factor:[1,1,1],type:[0,0,0]};switch(e.axis){case"tilt":return q(e,t.rotation,0),t;case"roll":return q(e,t.rotation,1),t;case null:case void 0:case"heading":return q(e,t.rotation,2),t;default:return A(o,`Could not convert rotation info: unknown axis "${e.axis}""`),null}}class B{constructor(e,t=[1,1,1],o=[1,1,1],i=1,n=[0,0,0],s=[1,1,1],r=[0,0,0]){this.supports=e,this.modelSize=t,this.symbolSize=o,this.unitInMeters=i,this.anchor=n,this.scale=s,this.rotation=r}}function L(e,t,o){if(!e)return null;const i=e.reduce(((e,i)=>{if(!e)return e;if(i.valueExpression)return A(o,"Could not convert visual variables: arcade expressions not supported"),null;switch(i.type){case"size":return t.supports.size?P(i,e,t,o):e;case"color":return t.supports.color?E(i,e,o):e;case"opacity":return t.supports.opacity?_(i,e,o):null;case"rotation":return t.supports.rotation?$(i,e,o):e;default:return null}}),new U);return!(e.length>0&&i)||i.size||i.color||i.opacity||i.rotation?i?.size&&!R(i.size,t,o)?null:i:null}class N{constructor(e,t,o){this.visualVariables=e,this.materialParameters=t,this.requiresShaderTransformation=o}}function O(e,t){if(!e)return null;if(v.TESTS_DISABLE_FAST_UPDATES)return null;const o=L(e.visualVariables,t);return o?new N(o,K(o,t),!!o.size):null}function G(e,t,o){if(!t||!e)return!1;const i=e.visualVariables,n=L(t.visualVariables,o);return!!n&&(!!(H(i.size,n.size,"size")&&H(i.color,n.color,"color")&&H(i.rotation,n.rotation,"rotation")&&H(i.opacity,n.opacity,"opacity"))&&(e.visualVariables=n,e.materialParameters=K(n,o),e.requiresShaderTransformation=!!n.size,!0))}function H(e,t,o){if(!!e!=!!t)return!1;if(e&&e.field!==t?.field)return!1;if(e&&"rotation"===o){const o=e,i=t;for(let e=0;e<3;e++)if(o.type[e]!==i.type[e]||o.offset[e]!==i.offset[e]||o.factor[e]!==i.factor[e])return!1}return!0}class J extends S{constructor(e){super(),this.vvSize=e?.size??null,this.vvColor=e?.color??null,this.vvOpacity=e?.opacity??null}}function K(e,n){const s=new J(e);return s.vvSize&&(s.vvSymbolAnchor=n.anchor,i(ee),I(n.rotation[2],n.rotation[0],n.rotation[1],ee),s.vvSymbolRotationMatrix=s.vvSymbolRotationMatrix||o(),t(s.vvSymbolRotationMatrix,ee)),s}function Q(t,o,i){if(!t.vvSize)return i;n(Y,i);const u=t.vvSymbolRotationMatrix;s(ee,u[0],u[1],u[2],0,u[3],u[4],u[5],0,u[6],u[7],u[8],0,0,0,0,1),r(Y,Y,ee);for(let n=0;n<3;++n){const i=t.vvSize.offset[n]+o[0]*t.vvSize.factor[n];Z[n]=e(i,t.vvSize.minSize[n],t.vvSize.maxSize[n])}return l(Y,Y,Z),a(Y,Y,t.vvSymbolAnchor),Y}function W(t,o,i){if(!o.vvSize)return d(t,1,1,1),t;for(let n=0;n<3;++n){const s=o.vvSize.offset[n]+i[0]*o.vvSize.factor[n];t[n]=e(s,o.vvSize.minSize[n],o.vvSize.maxSize[n])}return t}function X(e,t){const o=null==e?0:t.attributes[e];return"number"==typeof o&&isFinite(o)?o:0}const Y=p(),Z=z(),ee=p();export{B as ConvertOptions,b as FastColorInfo,C as FastOpacityInfo,D as FastRotationInfo,y as FastRotationType,g as FastSizeInfo,h as FastSizeType,N as FastSymbolUpdatesState,U as FastVisualVariables,J as VisualVariablesParameters,L as convertVisualVariables,Q as evaluateModelTransform,W as evaluateModelTransformScale,X as getAttributeValue,K as getMaterialParameters,O as initFastSymbolUpdatesState,G as updateFastSymbolUpdatesState};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{G as e,
|
|
5
|
+
import{G as e,a as t,n as i,l as r,j as o,c as s,F as l,z as a}from"../../../../chunks/vec32.js";import{create as n,fromValues as c,zeros as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{distance as m}from"../../../../geometry/support/aaBoundingRect.js";import{intersectsRay as d,intersectsPoint as h}from"../../../../geometry/support/frustum.js";import{fromValues as p}from"../../../../geometry/support/ray.js";import{ViewingMode as f}from"../../../ViewingMode.js";import{Visibility as _}from"./FeatureTileDescriptor.js";import{FeatureTileVisibility3D as S,globalTileLevelThreshold as g}from"./FeatureTileVisibility3D.js";import b from"../../webgl/RenderCamera.js";class M{constructor(e){this._camera=new b,this._focusOnMap=[0,0],this._renderCoordsHelper=e.renderCoordsHelper,this._tilingScheme=e.tilingScheme,this._visibility=new S(e.renderCoordsHelper,e.getIsGroundOpaque)}begin(e,t){this._camera.copyFrom(e),this._focusOnMap[0]=t.x,this._focusOnMap[1]=t.y,this._visibility.begin(this._camera)}end(){this._visibility.end()}updateTile(e){const{measures:t}=e;t.visibility=this._visibility.calculate(e),t.distance=m(e.extent,this._focusOnMap),t.visibility!==_.INVISIBLE&&this._updateSplitDecisionAndLod(e)}_calculateTileShouldSplitGlobal(l){const a=this._camera,{eye:n}=a,c=e(n),u=this._renderCoordsHelper,m=u.referenceEllipsoid.radius;if(c>2*m)return l.measures.effectiveLevelForLod=0,!1;const d=l.lij[0];if(d<=g)return l.measures.effectiveLevelForLod=d,!0;const h=v,{extent:p}=l;t(h[0],p[0],p[1],0),t(h[1],p[2],p[1],0),t(h[2],p[2],p[3],0),t(h[3],p[0],p[3],0);const f=t(y,.5*(p[0]+p[2]),.5*(p[1]+p[3]),0),_=this._tilingScheme.spatialReference;for(let e=0;e<4;++e)u.toRenderCoords(h[e],_,h[e]);u.toRenderCoords(f,_,f);const S=i(C,f),b=r(n,S),M=o(j,S,b),L=e(n)-m;return s(F.origin,R),s(F.direction,S),this._calculateTileShouldSplitCommon(l,h,f,F,L,i(T,n),M)}_calculateTileShouldSplitLocal(e){const i=v,{extent:r}=e;t(i[0],r[0],r[1],0),t(i[1],r[2],r[1],0),t(i[2],r[2],r[3],0),t(i[3],r[0],r[3],0);const o=this._tilingScheme.spatialReference;for(let t=0;t<4;++t)this._renderCoordsHelper.toRenderCoords(i[t],o,i[t]);const l=t(y,.5*(i[0][0]+i[2][0]),.5*(i[0][1]+i[2][1]),.25*(i[0][2]+i[1][2]+i[2][2]+i[3][2])),a=t(C,l[0],l[1],0),{eye:n,far:c}=this._camera,u=t(j,a[0],a[1],n[2]),m=n[2];return t(F.origin,a[0],a[1],n[2]-2*c),s(F.direction,x),this._calculateTileShouldSplitCommon(e,i,l,F,m,x,u)}_calculateTileShouldSplitCommon(e,t,o,s,n,c,u){const m=Math.max(l(t[0],t[2]),l(t[1],t[3])),p=this._camera,{eye:f,center:_}=p,S=i(L,a(L,_,f)),g=r(f,S),b=r(o,S)-g,{near:M,fovY:v}=p,y=2*Math.tan(.5*v),C=e=>e<=M?1:1/(e*y),j=Math.abs(n)/m,T=C(b),x=e.lij[0],R=b<M?G:H,F=b<M?j:T*m,w=Math.max(0,x+Math.ceil(Math.log2(R*F))-1);e.measures.effectiveLevelForLod=w;const O=r(c,S);if(r(u,S)-g<0&&Math.abs(O)<.5)return j<G;if(l(u,f)<M)return j<G;const{frustum:D}=p,I=d(D,s),V=h(D,o);let A=0;for(let i=0;i<4;++i){const e=t[i];A+=h(D,e)?1:0}if(V&&A>=2)return!1;if(!V&&!I&&A<=2)return j<G;let B=b,E=b;for(let i=0;i<4;++i){const e=t[i],o=r(e,S)-g;E=Math.min(E,o),B=Math.max(B,o)}if(E<=M)return j<G;if(C(E)*m<.3)return!1;return C(B)*m>.9||T*m>H&&A<=2&&!V&&!I}_updateSplitDecisionAndLod(e){e.measures.shouldSplit=this.isGlobalMode?this._calculateTileShouldSplitGlobal(e):this._calculateTileShouldSplitLocal(e),e.updateResolution()}get isGlobalMode(){return this._renderCoordsHelper.viewingMode===f.Global}}const v=[n(),n(),n(),n()],y=n(),C=n(),j=n(),L=n(),T=n(),x=c(0,0,1),R=u(),F=p(u(),x),G=1,H=.9;export{M as FeatureTileMeasurements3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{n as t,c as e,z as i,
|
|
5
|
+
import{n as t,c as e,z as i,l as s,r,a as n,F as o,b as u,g as c,j as a,G as f}from"../../../../chunks/vec32.js";import{create as l,fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as m}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as d}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBuffer as _}from"../../../../geometry/projection/projectBuffer.js";import{projectVec3Array as p}from"../../../../geometry/projection/projectVec3Array.js";import{PlaneIndex as g}from"../../../../geometry/support/frustum.js";import{signedDistance as S}from"../../../../geometry/support/plane.js";import{ViewingMode as b}from"../../../ViewingMode.js";import{Visibility as F}from"./FeatureTileDescriptor.js";import{Frustum as G}from"../../state/Frustum.js";class M{constructor(t,e){this._renderCoordsHelper=t,this._getIsGroundOpaque=e,this._isGroundOpaque=!1,this._cache=new Map,this._cameraForward=l(),this._cameraEye=l(),this._cameraFovY=55*Math.PI/180,this._frustumBoundingSphereCenter=l(),this._frustumBoundingSphereRadius=0,this._frustum=new G(t),this._renderSR=t.spatialReference;const i=d(this._renderSR);this._renderSREllipsoidRadius=m(i).radius}begin(i){this._aboveGround=i.aboveGround,this._isGroundOpaque=this._getIsGroundOpaque(),this._frustum.update(i),t(this._cameraForward,i.viewForward),e(this._cameraEye,i.eye),this._cameraFovY=i.fovY,this._updateFrustumBoundingSphere()}end(){this._cache.clear()}calculate(t){return this._getOrCalculateSingleTileVisibility(t)}_getOrCalculateSingleTileVisibility(t){const e=this._cache.get(t.id);if(null!=e)return e;const i=this._calculateSingleTileVisibility(t);return this._cache.set(t.id,i),i}_calculateSingleTileVisibility(t){return this._calculateSingleTileVisibilitySided(t)}_isTileVisibleInFrustum(t){return this._renderCoordsHelper.viewingMode===b.Local?this._isTileVisibleInFrustumLocal(t):this._isTileVisibleInFrustumGlobal(t)}_updateFrustumBoundingSphere(){const e=this._frustum,n=e.origin,o=A;t(o,e.direction);const u=e.points,c=U;i(c,u[4],n);const a=.5*s(c,c)/s(o,c),f=this._frustumBoundingSphereCenter;r(f,n,o,a);const l=1+a;this._frustumBoundingSphereRadius=l}_isTileVisibleInFrustumLocal(t){const e=t.tilingScheme.spatialReference,u=t.extent,c=this._renderSR,a=q;if(a[0]=u[0],a[1]=u[1],a[2]=0,a[3]=u[2],a[4]=u[3],a[5]=0,!_(a,e,0,a,c,0,2))return!1;const f=w;n(f[0],a[0],a[1],0),n(f[1],a[3],a[1],0),n(f[2],a[3],a[4],0),n(f[3],a[0],a[4],0);const l=E;n(l,.5*(a[0]+a[3]),.5*(a[1]+a[4]),.5*(a[2]+a[5]));const h=C;n(h,0,0,1);const m=.5*o(f[0],f[2]),d=this._frustum,p=this._frustumBoundingSphereRadius,g=this._frustumBoundingSphereCenter,S=D;i(S,g,l);const b=s(h,S),F=z;r(F,l,h,b);if(o(F,g)>m+p)return!1;const G=this._cameraForward,M=s(G,Gt),j=this._cameraFovY;if(Math.abs(M)<Math.abs(Math.cos(.5*j))){let t=!0;const e=this._cameraEye,i=n(Mt,G[0],G[1],0),r=s(e,i);for(let n=0;n<4;++n){const e=f[n];if(s(e,i)-r>0){t=!1;break}}if(t)return!1}const R=O,T=this._isGroundOpaque&&this._aboveGround,y=this._isGroundOpaque&&!this._aboveGround,I=Math.min(y?gt:1/0,b+p),v=Math.max(T?-gt:-1/0,b-p);for(let i=0;i<4;++i)r(R[i],f[i],h,I),r(R[i+4],f[i],h,v);return!V(d.planes,R,8)}_isTileVisibleInFrustumGlobal(e){if(e.lij[0]<v)return!0;const m=e.tilingScheme.spatialReference,d=e.extent,_=this._isGroundOpaque&&this._aboveGround,g=this._isGroundOpaque&&!this._aboveGround,b=w,F=.5*(d[0]+d[2]);if(n(b[0],d[0],d[1],0),n(b[1],d[2],d[1],0),n(b[2],d[2],d[3],0),n(b[3],d[0],d[3],0),n(b[4],F,d[1],0),n(b[5],F,d[3],0),!p(b,m,0,b,this._renderSR,0,6))return!1;const G=b[0][2]>0,M=b[3][2]<0,y=G||M,I=this._renderSREllipsoidRadius;if(y){const t=h(0,0,1),e=L;j(e,t,b[0]);const i=P;if(j(i,t,b[1]),G){const s=x,r=b[4],n=Y;j(n,r,t),j(s,n,r);const o=b[0];u(o,e,s),T(o,I);const c=b[1];u(c,i,s),T(c,I)}else if(M){const s=x,r=b[5],n=Y;j(n,r,t),j(s,r,n);const o=b[3];u(o,s,e),T(o,I);const c=b[2];u(c,s,i),T(c,I)}}const O=E;{const e=i(Q,b[3],b[0]);t(e,e);const n=c(X,b[0],b[3]);a(n,n,.5);const o=-s(n,e),u=c(Z,b[0],b[1]);a(u,u,.5);const f=c($,b[2],b[3]);a(f,f,.5);const l=i(tt,f,u);t(l,l);const h=-(o+s(e,u))/s(e,l);r(O,u,l,h),T(O,I)}const q=this._frustumBoundingSphereRadius,C=this._frustumBoundingSphereCenter,A=this._frustum,U=A.planes,z=k;t(z,O);const D=s(b[0],z)/f(b[0]),nt=A.origin,mt=A.points;let dt=!1;if(_){{dt=!0;const e=t(l(),nt);for(let r=0;r<4;++r){const n=mt[4+r],o=i(l(),n,nt);t(o,o);const c=u(l(),e,o);t(c,c);const a=u(l(),o,c);t(a,a);if(s(nt,a)>I){dt=!1;break}}}if(dt){if(s(nt,z)<I*D-gt)return!1}const e=t(St,A.origin);if(s(e,z)<0)return!1;{const e=t(bt,A.direction);if(s(e,z)>Ft)return!1}}const _t=Math.sqrt(1-D*D);if(_t>.9)return!0;let Gt=!1;{const t=s(z,C),e=f(C);if(e<=q&&!U.some((t=>S(t,N)>0))){if(!_)return!0;Gt=!0}const i=t/e;if(!Gt&&t<=0){if(-t>q)return!1}const r=q/e;if(Math.sqrt(1-i*i)*Math.sqrt(1-r*r)-r*i>_t)return!1}if(!dt){if(b.some((t=>A.intersectsPoint(t))))return!0;if(A.intersectsPoint(O))return!0}const Mt=W;i(Mt,C,N);const jt=s(Mt,z),Rt=H;a(Rt,z,jt);const Tt=o(Rt,C),yt=m.isWGS84,It=e.lij,Vt=yt&&It[2]===2**It[0]-1,vt=yt&&0===It[2],Bt=vt?ft:Vt?ct:ot,Ot=vt?lt:Vt?at:ut;if(!Gt){const t=b,e=ht,i=et,s=it,r=N;for(const n of Bt){const o=t[n];if(R(i,t[(n+1)%4],o),R(s,r,o),j(e,s,i),B(e,mt,1))return!1}}let qt=null;if(!_&&jt<1.01*q){const t=2.5*q;if(Tt>D*t+q)return!1;const e=K,i=t/D;for(let s=0;s<4;++s)a(e[s],b[s],i/I);n(e[4],0,0,0),qt=e}else{const t=(g?I+gt:jt+q)/D,e=_?I-gt:(jt-q)/D,i=J;for(let s=0;s<4;++s){const r=b[s];a(i[s],r,e/I),a(i[s+4],r,t/I)}qt=i}if(V(U,qt,qt.length))return!1;const wt=A.lines,Et=st,Ct=rt;for(const s of wt){t(Ct,s.direction);for(const e of Ot){const s=qt[e];if(t(Et,s),pt(Ct,Et,qt,mt))return!1;const r=(e+1)%4;if(_){const e=qt[r];if(i(Et,e,s),t(Et,Et),pt(Ct,Et,qt,mt))return!1}if(g){const s=qt[4+e],n=qt[4+r];if(i(Et,n,s),t(Et,Et),pt(Ct,Et,qt,mt))return!1}}}return!0}_calculateSingleTileVisibilitySided(t){return this._isTileVisibleInFrustum(t)?F.VISIBLE:F.INVISIBLE}}function j(e,i,s){return u(e,i,s),t(e,e),e}function R(e,s,r){return i(e,s,r),t(e,e),e}function T(t,e){return a(t,t,e/f(t)),t}const y=[g.LEFT,g.RIGHT,g.BOTTOM,g.TOP,g.FAR];function I(t,e,i){for(let s=0;s<i;++s)if(S(t,e[s])<=0)return!1;return!0}function V(t,e,i){for(const s of y)if(I(t[s],e,i))return!0;return!1}const v=2;function B(t,e,i){for(const r of e)if(s(r,t)<i)return!1;return!0}const O=[l(),l(),l(),l(),l(),l(),l(),l()],q=[0,0,0,0,0,0],w=[l(),l(),l(),l(),l(),l()],E=l(),C=l(),x=l(),L=l(),P=l(),Y=l(),k=l(),H=l(),A=l(),U=l(),z=l(),D=l(),N=h(0,0,0),W=l(),J=[l(),l(),l(),l(),l(),l(),l(),l()],K=[l(),l(),l(),l(),l()],Q=l(),X=l(),Z=l(),$=l(),tt=l(),et=l(),it=l(),st=l(),rt=l(),nt=l(),ot=[0,1,2,3],ut=[0,1,2,3],ct=[0,1,3],at=[0,1,3],ft=[1,2,3],lt=[1,2,3],ht=l();function mt(t,e,i){let r=1/0,n=-1/0;for(const o of i){const t=s(e,o);r=Math.min(r,t),n=Math.max(n,t)}t[0]=r,t[1]=n}function dt(t,e,i,r){let n=1/0,o=-1/0;for(const u of r){const r=s(i,u);if(n=Math.min(n,r),o=Math.max(o,r),n<=e&&o>=t)return!1}return!0}const _t=[0,0];function pt(t,e,i,s){if(0===i.length||0===s.length)return!0;const r=nt;j(r,t,e);const n=s[0]<i[0],o=n?i:s,u=_t;return mt(u,r,n?s:i),dt(u[0],u[1],r,o)}const gt=430,St=l(),bt=l(),Ft=Math.cos(.25*Math.PI),Gt=h(0,0,1),Mt=l();export{M as FeatureTileVisibility3D,v as globalTileLevelThreshold,V as isConvexHullOutsideOfFrustum};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{
|
|
5
|
+
import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{a as e,l as s,f as a,j as i,g as m,c as n,r as c,n as l,b as f}from"../../../../chunks/vec32.js";import{create as I}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as p}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as N}from"../../../../geometry/projection/projectors.js";import{newDoubleArray as g}from"../../../../geometry/support/DoubleArray.js";import{create as h,fromArray as b,getNormal as u}from"../../../../geometry/support/plane.js";import{ViewingMode as j}from"../../../ViewingMode.js";function T(t,r,e,s,a=1){if(e.isGeographic&&s===j.Global){const t=g(r.length),o=r.length,s=p(e);for(let e=0;e<o;e+=3)N(r,e,t,e,s);r=t}o(y,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY);for(let o=0;o<r.length;o+=3)y[0]=Math.min(y[0],r[o]),y[1]=Math.min(y[1],r[o+1]);const i=y[0]%a,m=y[1]%a,n=y[0]-i,c=y[1]-m;for(let o=0;o<r.length;o+=3){const e=o/3*4;t[e]=(r[o]-n)/a,t[e+1]=(r[o+1]-c)/a,t[e+2]=n/a,t[e+3]=c/a}}function M(t,r,n,c,l=1){e(F,1,0,0),e(Y,0,1,0),e(_,0,0,1),D(x,n),b(V,n)&&O(V,F,Y,_,c,x),o(y,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),o(P,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(let o=0;o<n.length;o+=3){e(E,n[o],n[o+1],n[o+2]);const t=s(F,E),r=s(Y,E);y[0]=Math.min(y[0],t),y[1]=Math.min(y[1],r),P[0]=Math.max(P[0],t),P[1]=Math.max(P[1],r)}const f=s(_,x);q(v,y[0],y[1],f,F,Y,_),q(A,P[0],y[1],f,F,Y,_),q(G,y[0],P[1],f,F,Y,_),a(A,A,v),i(A,A,.5),a(G,G,v),i(G,G,.5),m(v,v,A),m(v,v,G);const I=y[0]%l,p=y[1]%l,N=y[0]-I,g=y[1]-p;for(let o=0;o<n.length;o+=3){e(E,n[o],n[o+1],n[o+2]);const a=o/3,i=4*a;t[i]=(s(F,E)-N)/l,t[i+1]=(s(Y,E)-g)/l,t[i+2]=N/l,t[i+3]=g/l;const m=9*a;for(let t=0;t<3;t++)r[m+t]=v[t],r[m+t+3]=A[t],r[m+t+6]=G[t]}}const x=I(),E=I(),V=h(),F=I(),Y=I(),_=I(),y=r(),P=r(),v=I(),A=I(),G=I();function O(t,o,r,a,m,I){null!=m?(m.basisMatrixAtPosition(I,S),e(d,S[0],S[1],S[2]),e(k,S[4],S[5],S[6]),e(w,S[8],S[9],S[10])):(e(d,1,0,0),e(k,0,1,0),e(w,0,0,1));const p=u(t);s(p,w)<0&&i(p,p,-1),n(a,p);const N=s(p,k),g=s(p,d);Math.abs(N)>Math.abs(g)?(c(o,d,p,-g),l(o,o),f(r,o,p),l(r,r),i(r,r,-1)):(c(r,k,p,-N),l(r,r),f(o,r,p),l(o,o))}const S=t(),d=I(),k=I(),w=I();function D(t,o){e(U,0,0,0);for(let r=0;r<o.length-3;r+=3)U[0]+=o[r],U[1]+=o[r+1],U[2]+=o[r+2];i(t,U,1/(o.length/3-1))}const U=I();function q(t,o,r,s,a,i,m){e(t,o*a[0]+r*i[0]+s*m[0],o*a[1]+r*i[1]+s*m[1],o*a[2]+r*i[2]+s*m[2])}export{M as createMapSpaceUVCoords,T as createMapSpaceUVCoordsDraped};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{lerp as t,clamp as e}from"../../../core/mathUtils.js";import{getMetersPerUnitForSR as i}from"../../../core/unitUtils.js";import{f as r,n as s,
|
|
5
|
+
import{lerp as t,clamp as e}from"../../../core/mathUtils.js";import{getMetersPerUnitForSR as i}from"../../../core/unitUtils.js";import{f as r,n as s,l as n,m as a}from"../../../chunks/vec32.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as o}from"../../../geometry/ellipsoidUtils.js";import h from"../../../geometry/Extent.js";import{ViewingMode as l}from"../../ViewingMode.js";import{computeInnerAltitudeFade as x}from"../environment/atmosphereUtils.js";function c(t,e,i){return t===l.Global?new M(i):new u(e,i)}class u{constructor(t,e){this._elevationProvider=t,this._referenceEllipsoid=o(e),this._unitInMeters=i(e,this._referenceEllipsoid.metersPerDegree)}compute(i,a,m,o,l){l||(l={near:0,far:0});let x=i[2]*this._unitInMeters;const c=x,u=x-o,M=this._elevationProvider?.visibleElevationBounds;M&&(x=u>=0?c-this._unitInMeters*M.min:this._unitInMeters*M.max-c);const _={x:(m=null!=m?m:new h({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0})).xmax-m.xmin,y:m.ymax-m.ymin,z:4*Math.max(m.xmax-m.xmin,m.ymax-m.ymin)},I=Math.max(_.x,_.y,_.z);r(E,a,i),v[0]=E[0]>0?m.xmax:m.xmin,v[1]=E[1]>0?m.ymax:m.ymin,v[2]=E[2]>0?I/2:-I/2,r(v,v,i),s(E,E);const j=1.1*n(v,E)*this._unitInMeters,g=Math.sqrt(x*(x+2*this._referenceEllipsoid.radius)),b=Math.max(m.xmax-m.xmin,m.ymax-m.ymin),w=b*d*this._unitInMeters,z=b*y*this._unitInMeters,U=e((x-z)/(w-z),0,1)**3,P=Math.min(t(g,j,U),g)*Math.max(Math.log(Math.abs(u)),1);return f(Math.min(P,Math.max(34064e4,I))/this._unitInMeters,p,this._unitInMeters,l)}}class M{constructor(t){this._referenceEllipsoid=o(t)}compute(i,r,s,n,m){m||(m={near:0,far:0});const o=a(i),h=o-this._referenceEllipsoid.radius,l=this._referenceEllipsoid.radius+Math.min(0,n),c=Math.abs(h-n),u=Math.max(c,Math.abs(h)),M=Math.sqrt(u*(u+2*l)),p=o+this._referenceEllipsoid.radius;return f(1.2*t(M,p,x(u)),e(2e4-(Math.log(u)-7.983)/9.011*19900,100,2e4),1,m)}}function f(t,e,i,r){const s=_/i;return t/e>s?(r.far=t,r.near=r.far/e):(r.near=s,r.far=r.near*e),r}const p=2e4,_=2,d=.001,y=1e-4,v=m(),E=m();export{c as createNearFarHeuristic};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Camera.js";import"../../../geometry.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{on as n,watch 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/has.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{a as v}from"../../../chunks/vec32.js";import{fromArray as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as w}from"../../../chunks/vec42.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import _ from"../../../geometry/Extent.js";import y from"../../../geometry/Point.js";import{isLoadedOrLoadFor as f,requiresLoad as C}from"../../../geometry/projection.js";import{ViewingMode as x}from"../../ViewingMode.js";import{applyAll as R}from"../camera/constraintUtils.js";import{cameraOnContentAlongViewDirection as P,surfaceElevationBelowRenderLocation as S}from"../camera/intersectionUtils.js";import{ConstraintsManager as O}from"./ConstraintsManager.js";import{Frustum as T}from"./Frustum.js";import{GoToOperation as b}from"./GoToOperation.js";import{SurfaceCollisionCorrectionController as j}from"./controllers/SurfaceCollisionCorrectionController.js";import{internalToExternal as I,externalToInternal as M,toArea as z,toExtent as A,distanceToScale as E,directionToHeadingTilt as L,scaleToZoom as N,fromExtentSync as H,OrientationMode as V,getObserverForPointAtDistanceSync as B,scaleToDistance as D,zoomToScale as G}from"../support/cameraUtils.js";import{fromCamera as F,toCameraSync as U}from"../support/viewpointUtils.js";import k from"../webgl/RenderCamera.js";import{PaddingSide as q}from"../webgl-engine/lib/rendererUtils.js";import{RenderFeature as W}from"../webgl-engine/lib/RenderFeature.js";import{PropertiesPool as J}from"../../support/PropertiesPool.js";import{RenderState as K}from"../../support/RenderState.js";import{ensureAttachmentMaxSize as Q}from"../../webgl/FramebufferObject.js";import X from"../../../geometry/Polygon.js";let Y=class extends r{constructor(e){super(e),this.ready=!1,this._windowDevicePixelRatio=1,this._devicePixelRatioOverride=null,this._idleTimeout=oe,this.test={viewStateManager:this,contentCameraResetState:new Map,setDevicePixelRatio:e=>this._devicePixelRatioOverride=e,renderState:null,get maximumPixelRatio(){return this.viewStateManager.view.qualitySettings.maximumPixelRatio},get updatingIgnoreRenderState(){return null!=this.renderState},get idleTimeoutEnabled(){return this.viewStateManager._idleTimeout>0},set idleTimeoutEnabled(e){this.viewStateManager._idleTimeout=e?oe:0}},this._propertiesPool=new J({frustum:T},this),this._cameraSetByUser=!1,this._gotoOperation=null,this._cameraChangeTime=0,this._tmpCanvasSize=new Z}initialize(){this._cameraChangeTime=performance.now(),this.addHandles([n((()=>this.view.state.events),"before-camera-change",(e=>e&&this._updateElevation(e))),o((()=>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()}),o((()=>this.view.state.cameraController),(()=>{this._cameraSetByUser=!0,this.removeHandles(se)})),n((()=>this.view.state.events),"camera-projection-changed",(()=>this.notifyChange("scale")))])}destroy(){this.exit(),this._propertiesPool=s(this._propertiesPool)}get camera(){const e=this._get("camera");if(!this.ready)return e;const t=I(this.view,this.view.state.camera,ie);return t&&e&&t.equals(e)?e:t.clone()}set camera(e){this._updatePropertyBeforeReady("camera",e)||(this.view.elevationProvider?.enableCache(!0),this.setStateCamera(M(this.view,e),{applyConstraints:!1})||a.getLogger(this).error("#camera=","Invalid camera",e),this.view.elevationProvider?.enableCache(!1))}get contentCamera(){const e=this._get("contentCamera");if(!this.ready)return e;const t=I(this.view,this.view.state.contentCamera,ie);return t&&e&&t.equals(e)?e:t.clone()}set contentCamera(e){if(this._updatePropertyBeforeReady("contentCamera",e))return;const t=M(this.view,e);null!=t?(this._updateElevation(t),this.view.state.contentCamera=t):this.view.state.contentCamera=null}installContentCameraReset(e){if(this.removeHandles(ne),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([o((()=>this.contentCamera),(()=>{e.sticky||(this.removeHandles(ne),this.test.contentCameraResetState.clear())})),o((()=>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))})),o((()=>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)}))],ne),!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 visibleArea(){if(!this.ready){const e=this._get("extent");return e?X.fromExtent(e):null}return z(this.view,this.view.pointsOfInterest.focus.renderLocation)}get extent(){if(!this.ready)return this._get("extent");const e=this.view,t=A(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 constraintsManager(){return this._constraintsManager}get _initialViewpoint(){const e=this.view.map;return e&&"initialViewProperties"in e?e.initialViewProperties?.viewpoint:void 0}get hasInitialView(){return!!this._initialViewpoint}get scale(){if(this.ready){const e=this.view.pointsOfInterest.centerOnContent.distance;return E(this.view,e)}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 terrainScale(){if(!this.ready)return this._get("scale");const e=this.view,t=e.basemapTerrain.tilingScheme,i=e.pointsOfInterest.cameraOnSurface.scale;if(!t||!i)return this._get("scale");const r=e.state.contentCamera;let a=L(e,r.eye,r.viewForward,r.up).tilt;a>90&&(a=180-a);const s=2*(a/90)**2,n=t.levelAtScale(i)-s;return n<0?this._get("scale"):t.scaleAtLevel(n)}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[q.TOP]/i),s=Math.round(t[q.RIGHT]/i),n=Math.round(t[q.BOTTOM]/i),o=Math.round(t[q.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,ae),this.view.state.updateCamera((e=>e.padding=ae)))}_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?F(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?N(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)*this.view.resolutionScale;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 i&&Q(this._tmpCanvasSize,i),this._tmpCanvasSize.pixelRatio=this._tmpCanvasSize.width>0?this._tmpCanvasSize.width/this.view.surface.clientWidth*.5+this._tmpCanvasSize.height/this.view.surface.clientHeight*.5: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(W.PhysicalPixelRendering)??!1}get _usePhysicalPixelRenderingAny(){const e=this.view?._stage?.renderer;return e&&(e.isFeatureEnabled(W.PhysicalPixelRendering,K.IDLE)||e.isFeatureEnabled(W.PhysicalPixelRendering,K.INTERACTING)||e.isFeatureEnabled(W.PhysicalPixelRendering,K.ANIMATING))}preinit(e){return!(this._isOverridden("center")&&!f(this.center.spatialReference,e))&&(!(this._isOverridden("camera")&&!f(this.camera.position.spatialReference,e))&&(!(this._isOverridden("extent")&&!f(this.extent.spatialReference,e))&&!!(!this._isOverridden("viewpoint")||f(this.viewpoint.targetGeometry?.spatialReference,e)&&f(this.viewpoint.camera?.position?.spatialReference,e))))}init(){this._constraintsManager=new O({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._initialViewpoint||this.view.initialExtent;e&&this.isCompatible(e)?this._setInitialView(e):this.view.state.viewingMode===x.Local&&this.addHandles(l((()=>this.view.basemapTerrain.ready),(()=>{this.removeHandles(se),this._setInitialView(this.view.dataExtent)}),{once:!0,initial:!0}),se)}}exit(){this._cancelGoToOperation(),this.ready&&(this._override("padding",this.padding),this._set("ready",!1),this._clearOverride("hasInitialView"),this._cameraSetByUser=!1,this.removeHandles(se),this._constraintsManager=s(this._constraintsManager))}async goTo(e,t){return t={animate:!0,...t},null!=this._gotoOperation&&this._gotoOperation.abort(t.animate),this._gotoOperation=new b(e,t,this.view),this.view.resourceController.scheduler.stopFrame(),this._gotoOperation.promise}debugSetCameraOnContent(){this.setStateCamera(P(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 ee){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(M(this.view,e),{applyConstraints:!1});if(e instanceof i){if(e.targetGeometry instanceof _){const t=H(this.view,e.targetGeometry,0,.5,V.LOCKED);return void(null!=t&&this.setStateCamera(M(this.view,t),{applyConstraints:!0}))}const t={applyConstraints:!e.camera},i=this._viewpointToCamera(e);return void this.setStateCamera(i,t)}const r=H(this.view,e,0,.5,V.LOCKED);null!=r&&this.setStateCamera(M(this.view,r),{applyConstraints:!0})}_updatePropertyBeforeReady(e,t){return!this.ready&&(this._override(e,t),t&&$.has(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=te){return this._cameraSetByUser?(e.heading=this.camera.heading,e.tilt=this.camera.tilt):(e.heading=0,e.tilt=.5),e}_centerPointAtDistanceToCamera(e,t,i=re){const{heading:r,tilt:a}=this._getPreservingHeadingTilt(),s=B(this.view,r,a,e,t,V.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=H(this.view,e,t,i,V.ADJUST,ie);return r?M(this.view,r):null}_scaleToCamera(e){if(null==e)return null;const t=this.view.pointsOfInterest.centerOnContent;t.runTask();const i=t.renderLocation,r=D(this.view,e);return this._centerPointAtDistanceToCamera(i,r)}_zoomToCamera(e){return this._scaleToCamera(G(this.view,e))}_viewpointToCamera(e){return M(this.view,U(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.fov=e.fov):i.copyFrom(e),t.applyConstraints&&R(this.view,i)})),t.applyConstraints||(this.view.state.cameraController=new j({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||(re.copyFrom(e),re.pixelRatio!==i.pixelRatio&&(this._paddingToArray(this.padding,i.pixelRatio,ae),re.padding=ae),re.fullWidth=i.width,re.fullHeight=i.height,re.pixelRatio=i.pixelRatio,this.view.state.camera=re),this._updateViewState()}}_updateElevation(e){const t=this.view.basemapTerrain?.spatialReference,i=this.view.renderCoordsHelper?.getAltitude(e.eye)??0,r=t?S(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=K.ANIMATING:this.view.interacting?this.view.state.mode=K.INTERACTING:(this.view.state.mode===K.ANIMATING&&(this._cameraChangeTime=0),performance.now()-this._cameraChangeTime<this._idleTimeout?this.view.state.mode=K.INTERACTING:this.view.state.mode=K.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"]})],Y.prototype,"camera",null),e([m({type:t,dependsOn:["view.state.contentCamera","ready"]})],Y.prototype,"contentCamera",null),e([m({type:y})],Y.prototype,"center",null),e([m()],Y.prototype,"visibleArea",null),e([m({type:_})],Y.prototype,"extent",null),e([m({readOnly:!0})],Y.prototype,"frustum",null),e([m()],Y.prototype,"_constraintsManager",void 0),e([m({readOnly:!0})],Y.prototype,"constraintsManager",null),e([m()],Y.prototype,"_initialViewpoint",null),e([m({readOnly:!0})],Y.prototype,"hasInitialView",null),e([m({readOnly:!0,type:Boolean})],Y.prototype,"ready",void 0),e([m({type:Number})],Y.prototype,"scale",null),e([m({type:Number})],Y.prototype,"terrainScale",null),e([m()],Y.prototype,"padding",null),e([m({readOnly:!0})],Y.prototype,"screenCenter",null),e([m({constructOnly:!0})],Y.prototype,"view",void 0),e([m({type:i})],Y.prototype,"viewpoint",null),e([m({type:Number})],Y.prototype,"zoom",null),e([m({readOnly:!0})],Y.prototype,"_rasterPixelRatio",null),e([m({readOnly:!0})],Y.prototype,"_usePhysicalPixelRendering",null),e([m({readOnly:!0})],Y.prototype,"_usePhysicalPixelRenderingAny",null),e([m()],Y.prototype,"_windowDevicePixelRatio",void 0),e([m()],Y.prototype,"_devicePixelRatioOverride",void 0),Y=e([d("esri.views.3d.state.ViewStateManager")],Y);class Z{constructor(){this.width=0,this.height=0,this.pixelRatio=1}}const $=new Set(["camera","viewpoint","extent","scale","center","zoom"]),ee=[{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:[]}],te={heading:0,tilt:0},ie=new t,re=new k,ae=g(),se="pending-initial-view",ne="content-camera-reset",oe=300,he=100;export{Y as ViewStateManager,he as interactingTimeout};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Camera.js";import"../../../geometry.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{on as n,watch 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/has.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{s as v}from"../../../chunks/vec32.js";import{fromArray as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as w}from"../../../chunks/vec42.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import _ from"../../../geometry/Extent.js";import y from"../../../geometry/Point.js";import{isLoadedOrLoadFor as f,requiresLoad as C}from"../../../geometry/projection.js";import{ViewingMode as x}from"../../ViewingMode.js";import{applyAll as R}from"../camera/constraintUtils.js";import{cameraOnContentAlongViewDirection as P,surfaceElevationBelowRenderLocation as S}from"../camera/intersectionUtils.js";import{ConstraintsManager as O}from"./ConstraintsManager.js";import{Frustum as T}from"./Frustum.js";import{GoToOperation as b}from"./GoToOperation.js";import{SurfaceCollisionCorrectionController as j}from"./controllers/SurfaceCollisionCorrectionController.js";import{internalToExternal as I,externalToInternal as M,toArea as z,toExtent as A,distanceToScale as E,directionToHeadingTilt as L,scaleToZoom as N,fromExtentSync as H,OrientationMode as V,getObserverForPointAtDistanceSync as B,scaleToDistance as D,zoomToScale as G}from"../support/cameraUtils.js";import{fromCamera as F,toCameraSync as U}from"../support/viewpointUtils.js";import k from"../webgl/RenderCamera.js";import{PaddingSide as q}from"../webgl-engine/lib/rendererUtils.js";import{RenderFeature as W}from"../webgl-engine/lib/RenderFeature.js";import{PropertiesPool as J}from"../../support/PropertiesPool.js";import{RenderState as K}from"../../support/RenderState.js";import{ensureAttachmentMaxSize as Q}from"../../webgl/FramebufferObject.js";import X from"../../../geometry/Polygon.js";let Y=class extends r{constructor(e){super(e),this.ready=!1,this._windowDevicePixelRatio=1,this._devicePixelRatioOverride=null,this._idleTimeout=oe,this.test={viewStateManager:this,contentCameraResetState:new Map,setDevicePixelRatio:e=>this._devicePixelRatioOverride=e,renderState:null,get maximumPixelRatio(){return this.viewStateManager.view.qualitySettings.maximumPixelRatio},get updatingIgnoreRenderState(){return null!=this.renderState},get idleTimeoutEnabled(){return this.viewStateManager._idleTimeout>0},set idleTimeoutEnabled(e){this.viewStateManager._idleTimeout=e?oe:0}},this._propertiesPool=new J({frustum:T},this),this._cameraSetByUser=!1,this._gotoOperation=null,this._cameraChangeTime=0,this._tmpCanvasSize=new Z}initialize(){this._cameraChangeTime=performance.now(),this.addHandles([n((()=>this.view.state.events),"before-camera-change",(e=>e&&this._updateElevation(e))),o((()=>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()}),o((()=>this.view.state.cameraController),(()=>{this._cameraSetByUser=!0,this.removeHandles(se)})),n((()=>this.view.state.events),"camera-projection-changed",(()=>this.notifyChange("scale")))])}destroy(){this.exit(),this._propertiesPool=s(this._propertiesPool)}get camera(){const e=this._get("camera");if(!this.ready)return e;const t=I(this.view,this.view.state.camera,ie);return t&&e&&t.equals(e)?e:t.clone()}set camera(e){this._updatePropertyBeforeReady("camera",e)||(this.view.elevationProvider?.enableCache(!0),this.setStateCamera(M(this.view,e),{applyConstraints:!1})||a.getLogger(this).error("#camera=","Invalid camera",e),this.view.elevationProvider?.enableCache(!1))}get contentCamera(){const e=this._get("contentCamera");if(!this.ready)return e;const t=I(this.view,this.view.state.contentCamera,ie);return t&&e&&t.equals(e)?e:t.clone()}set contentCamera(e){if(this._updatePropertyBeforeReady("contentCamera",e))return;const t=M(this.view,e);null!=t?(this._updateElevation(t),this.view.state.contentCamera=t):this.view.state.contentCamera=null}installContentCameraReset(e){if(this.removeHandles(ne),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([o((()=>this.contentCamera),(()=>{e.sticky||(this.removeHandles(ne),this.test.contentCameraResetState.clear())})),o((()=>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))})),o((()=>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)}))],ne),!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 visibleArea(){if(!this.ready){const e=this._get("extent");return e?X.fromExtent(e):null}return z(this.view,this.view.pointsOfInterest.focus.renderLocation)}get extent(){if(!this.ready)return this._get("extent");const e=this.view,t=A(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 constraintsManager(){return this._constraintsManager}get _initialViewpoint(){const e=this.view.map;return e&&"initialViewProperties"in e?e.initialViewProperties?.viewpoint:void 0}get hasInitialView(){return!!this._initialViewpoint}get scale(){if(this.ready){const e=this.view.pointsOfInterest.centerOnContent.distance;return E(this.view,e)}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 terrainScale(){if(!this.ready)return this._get("scale");const e=this.view,t=e.basemapTerrain.tilingScheme,i=e.pointsOfInterest.cameraOnSurface.scale;if(!t||!i)return this._get("scale");const r=e.state.contentCamera;let a=L(e,r.eye,r.viewForward,r.up).tilt;a>90&&(a=180-a);const s=2*(a/90)**2,n=t.levelAtScale(i)-s;return n<0?this._get("scale"):t.scaleAtLevel(n)}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[q.TOP]/i),s=Math.round(t[q.RIGHT]/i),n=Math.round(t[q.BOTTOM]/i),o=Math.round(t[q.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,ae),this.view.state.updateCamera((e=>e.padding=ae)))}_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?F(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?N(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)*this.view.resolutionScale;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 i&&Q(this._tmpCanvasSize,i),this._tmpCanvasSize.pixelRatio=this._tmpCanvasSize.width>0?this._tmpCanvasSize.width/this.view.surface.clientWidth*.5+this._tmpCanvasSize.height/this.view.surface.clientHeight*.5: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(W.PhysicalPixelRendering)??!1}get _usePhysicalPixelRenderingAny(){const e=this.view?._stage?.renderer;return e&&(e.isFeatureEnabled(W.PhysicalPixelRendering,K.IDLE)||e.isFeatureEnabled(W.PhysicalPixelRendering,K.INTERACTING)||e.isFeatureEnabled(W.PhysicalPixelRendering,K.ANIMATING))}preinit(e){return!(this._isOverridden("center")&&!f(this.center.spatialReference,e))&&(!(this._isOverridden("camera")&&!f(this.camera.position.spatialReference,e))&&(!(this._isOverridden("extent")&&!f(this.extent.spatialReference,e))&&!!(!this._isOverridden("viewpoint")||f(this.viewpoint.targetGeometry?.spatialReference,e)&&f(this.viewpoint.camera?.position?.spatialReference,e))))}init(){this._constraintsManager=new O({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._initialViewpoint||this.view.initialExtent;e&&this.isCompatible(e)?this._setInitialView(e):this.view.state.viewingMode===x.Local&&this.addHandles(l((()=>this.view.basemapTerrain.ready),(()=>{this.removeHandles(se),this._setInitialView(this.view.dataExtent)}),{once:!0,initial:!0}),se)}}exit(){this._cancelGoToOperation(),this.ready&&(this._override("padding",this.padding),this._set("ready",!1),this._clearOverride("hasInitialView"),this._cameraSetByUser=!1,this.removeHandles(se),this._constraintsManager=s(this._constraintsManager))}async goTo(e,t){return t={animate:!0,...t},null!=this._gotoOperation&&this._gotoOperation.abort(t.animate),this._gotoOperation=new b(e,t,this.view),this.view.resourceController.scheduler.stopFrame(),this._gotoOperation.promise}debugSetCameraOnContent(){this.setStateCamera(P(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 ee){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(M(this.view,e),{applyConstraints:!1});if(e instanceof i){if(e.targetGeometry instanceof _){const t=H(this.view,e.targetGeometry,0,.5,V.LOCKED);return void(null!=t&&this.setStateCamera(M(this.view,t),{applyConstraints:!0}))}const t={applyConstraints:!e.camera},i=this._viewpointToCamera(e);return void this.setStateCamera(i,t)}const r=H(this.view,e,0,.5,V.LOCKED);null!=r&&this.setStateCamera(M(this.view,r),{applyConstraints:!0})}_updatePropertyBeforeReady(e,t){return!this.ready&&(this._override(e,t),t&&$.has(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=te){return this._cameraSetByUser?(e.heading=this.camera.heading,e.tilt=this.camera.tilt):(e.heading=0,e.tilt=.5),e}_centerPointAtDistanceToCamera(e,t,i=re){const{heading:r,tilt:a}=this._getPreservingHeadingTilt(),s=B(this.view,r,a,e,t,V.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=H(this.view,e,t,i,V.ADJUST,ie);return r?M(this.view,r):null}_scaleToCamera(e){if(null==e)return null;const t=this.view.pointsOfInterest.centerOnContent;t.runTask();const i=t.renderLocation,r=D(this.view,e);return this._centerPointAtDistanceToCamera(i,r)}_zoomToCamera(e){return this._scaleToCamera(G(this.view,e))}_viewpointToCamera(e){return M(this.view,U(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.fov=e.fov):i.copyFrom(e),t.applyConstraints&&R(this.view,i)})),t.applyConstraints||(this.view.state.cameraController=new j({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||(re.copyFrom(e),re.pixelRatio!==i.pixelRatio&&(this._paddingToArray(this.padding,i.pixelRatio,ae),re.padding=ae),re.fullWidth=i.width,re.fullHeight=i.height,re.pixelRatio=i.pixelRatio,this.view.state.camera=re),this._updateViewState()}}_updateElevation(e){const t=this.view.basemapTerrain?.spatialReference,i=this.view.renderCoordsHelper?.getAltitude(e.eye)??0,r=t?S(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=K.ANIMATING:this.view.interacting?this.view.state.mode=K.INTERACTING:(this.view.state.mode===K.ANIMATING&&(this._cameraChangeTime=0),performance.now()-this._cameraChangeTime<this._idleTimeout?this.view.state.mode=K.INTERACTING:this.view.state.mode=K.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"]})],Y.prototype,"camera",null),e([m({type:t,dependsOn:["view.state.contentCamera","ready"]})],Y.prototype,"contentCamera",null),e([m({type:y})],Y.prototype,"center",null),e([m()],Y.prototype,"visibleArea",null),e([m({type:_})],Y.prototype,"extent",null),e([m({readOnly:!0})],Y.prototype,"frustum",null),e([m()],Y.prototype,"_constraintsManager",void 0),e([m({readOnly:!0})],Y.prototype,"constraintsManager",null),e([m()],Y.prototype,"_initialViewpoint",null),e([m({readOnly:!0})],Y.prototype,"hasInitialView",null),e([m({readOnly:!0,type:Boolean})],Y.prototype,"ready",void 0),e([m({type:Number})],Y.prototype,"scale",null),e([m({type:Number})],Y.prototype,"terrainScale",null),e([m()],Y.prototype,"padding",null),e([m({readOnly:!0})],Y.prototype,"screenCenter",null),e([m({constructOnly:!0})],Y.prototype,"view",void 0),e([m({type:i})],Y.prototype,"viewpoint",null),e([m({type:Number})],Y.prototype,"zoom",null),e([m({readOnly:!0})],Y.prototype,"_rasterPixelRatio",null),e([m({readOnly:!0})],Y.prototype,"_usePhysicalPixelRendering",null),e([m({readOnly:!0})],Y.prototype,"_usePhysicalPixelRenderingAny",null),e([m()],Y.prototype,"_windowDevicePixelRatio",void 0),e([m()],Y.prototype,"_devicePixelRatioOverride",void 0),Y=e([d("esri.views.3d.state.ViewStateManager")],Y);class Z{constructor(){this.width=0,this.height=0,this.pixelRatio=1}}const $=new Set(["camera","viewpoint","extent","scale","center","zoom"]),ee=[{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:[]}],te={heading:0,tilt:0},ie=new t,re=new k,ae=g(),se="pending-initial-view",ne="content-camera-reset",oe=300,he=100;export{Y as ViewStateManager,he as interactingTimeout};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import{neverReached as e}from"../../../../core/compilerUtils.js";import{clamp as i,acosClamped as a,deg2rad as r}from"../../../../core/mathUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{translate as n,rotate as c,identity as m}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{f as h,h as p,g as d,j as u,c as _,k as f,l as v,s as C,n as g,b as y,p as w,E as O,m as b}from"../../../../chunks/vec32.js";import{create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as x}from"../../../../geometry/ellipsoidUtils.js";import{wrap as j}from"../../../../geometry/support/ray.js";import{j as L,a as M,t as A}from"../../../../chunks/sphere.js";import{angle as T}from"../../../../geometry/support/vector.js";import{sv3d as E}from"../../../../geometry/support/vectorStacks.js";import{applyAll as z}from"../../camera/constraintUtils.js";import{ConstraintOptions as I}from"../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as D}from"../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as R}from"../../camera/constraintUtils/InteractionType.js";import{TiltMode as U}from"../../camera/constraintUtils/TiltMode.js";import{TiltRange as k}from"../Constraints.js";import{InteractiveController as H}from"./InteractiveController.js";import{panMotionToRotationMatrix as N,onSurfaceTiltToEyeTiltGlobal as P,offSurfaceTiltToEyeTiltGlobal as G}from"../utils/navigationUtils.js";import{viewAngle as F}from"../utils/viewUtils.js";import{headingTiltToDirectionUp as B}from"../../support/cameraUtils.js";import{createDirectionUp as V}from"../../support/cameraUtilsInternal.js";import K from"../../webgl/RenderCamera.js";import{extractTransformation as X,isZeroTransformation as Z,extractTransformationKeyboard as q}from"../../../navigation/gamepadAndKeyboardUtils.js";let J=class extends H{constructor(t){super(t),this._filteredSurfaceElevation=0,this._transformation={translation:[0,0,0],heading:0,tilt:0,zoom:0},this._keysButtonState=[0,0,0,0,0,0,0,0,0,0,0,0],this._tmpCamera=new K,this._headingStart=0,this._constraintOptions=new I(D.ALL,R.NONE,0,new K,null,U.LOOK_AROUND)}handleEventGamepad(t){const e=X(t,this.view.navigation.gamepad,this._transformation);("end"===t.action||Z(e))&&this.finishController()}activateDirection(t){this._keysButtonState[t]=1,q(this._keysButtonState,this._transformation)}directionActive(t){return 1===this._keysButtonState[t]}countActiveDirections(){return this._keysButtonState.reduce(((t,e)=>e>0?t+1:t),0)}deactivateDirection(t){this._keysButtonState[t]=0;const e=q(this._keysButtonState,this._transformation);Z(e)&&this.finishController()}onControllerStart(t){this._filteredSurfaceElevation=this.view.pointsOfInterest.cameraOnSurface.location.z,this._headingStart=this.view.camera.heading,super.onControllerStart(t)}_updateFilteredSurfaceElevation(t){const e=this.view.pointsOfInterest.cameraOnSurface.location.z,i=1;this._filteredSurfaceElevation+=i*(e-this._filteredSurfaceElevation)*t}stepController(t,e){this._updateStartHeading(),this._updateFilteredSurfaceElevation(t),this.currentCamera.copyViewFrom(e),this._updateCameraCenter(),this._constraintOptions.interactionStartCamera?.copyFrom(this.currentCamera),this._calculateControlTransformation(t,this.currentCamera,at),this._applyDisabledMovementTypes(at),this._applyPan(at.pan),this._applyRotate(at.rotate),this._applyZoom(at.zoom),this._applyAscend(at.ascend),this._constraintOptions.interactionType=R.NONE,this._constraintOptions.selection=D.COLLISION,z(this.view,this.currentCamera,this._constraintOptions),super.stepController(t,e)}_updateStartHeading(){0!==this._transformation.heading&&(this._headingStart=this.view.camera.heading)}_applyRotate(t){if(!t.enabled)return;const e=this.currentCamera;h(rt,e.center,e.eye),p(rt,rt,t.matrix),e.center=d(rt,rt,e.eye),e.up=p(rt,e.up,t.matrix),this._constraintOptions.interactionType=R.LOOK_AROUND,this._constraintOptions.selection=D.ALL_EXCEPT_COLLISION,z(this.view,e,this._constraintOptions)}_applyPan(t,e=this.currentCamera){if(!t.enabled)return;e.eye=p(rt,e.eye,t.matrix),e.center=p(rt,e.center,t.matrix);this.view.state.isGlobal&&(e.up=p(rt,e.up,t.matrix)),this._constraintOptions.interactionType=R.PAN,this._constraintOptions.selection=D.ALL,z(this.view,e,this._constraintOptions)}_applyZoom(t){if(!t)return;const e=this.currentCamera.viewForward;this.currentCamera.eye=d(rt,this.currentCamera.eye,u(E.get(),e,t)),_(ot,e),f(ot,ot),this._constraintOptions.interactionDirection=ot,this._constraintOptions.interactionType=R.ZOOM,this._constraintOptions.selection=D.ALL_EXCEPT_COLLISION,z(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_applyAscend(t){if(!t)return;const e=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,E.get());this._constraintOptions.interactionDirection=_(ot,e);if(this.view.state.isGlobal){const e=v(this.currentCamera.eye),i=(e+t)/e;this.currentCamera.eye=u(rt,this.currentCamera.eye,i),this.currentCamera.center=u(rt,this.currentCamera.center,i)}else{const i=u(E.get(),e,t);this.currentCamera.eye=d(rt,this.currentCamera.eye,i),this.currentCamera.center=d(rt,this.currentCamera.center,i)}this._updateCameraCenter(),this._constraintOptions.interactionType=R.ASCEND,this._constraintOptions.selection=D.COLLISION,z(this.view,this.currentCamera,this._constraintOptions)&&this._updateCameraCenter(),this._constraintOptions.selection=D.ALL_EXCEPT_COLLISION,z(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_calculateControlTransformation(t,e,i){nt(i);const a=this._computeVelocities(t);this.view.state.isLocal?this._calculateControlTransformationLocal(a,e,i):this._calculateControlTransformationGlobal(a,e,i)}_updateCameraCenter(){const t=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,e=this.view.renderCoordsHelper,i=this.currentCamera.ray;this.currentCamera.center=e.intersectManifoldClosestSilhouette(i,t,rt)}_calculateControlTransformationLocal(t,a,r){const{viewRight:o,viewForward:s}=a,m=this._transformation,l=this.view.navigation.gamepad,h=C(E.get(),s[0],s[1],0);g(h,h);const p=m.translation[0]*t.pan;if(0!==p){const t=u(E.get(),o,p);n(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}switch(l.mode){case"pan":{const e=-m.translation[1]*t.pan;if(0!==e){const t=u(E.get(),h,e);n(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}r.zoom=m.zoom*t.zoom;break}case"zoom":r.zoom=(-m.translation[1]+m.zoom)*t.zoom;break;default:e(l.mode)}const d=m.translation[2]*t.ascend;r.ascend=d;const _=-m.heading*t.rotate;0!==_&&(c(r.rotate.matrix,r.rotate.matrix,_,this.view.renderCoordsHelper.worldUpAtPosition(a.eye,E.get())),r.rotate.enabled=!0);const f=m.tilt*t.rotate,v=F(this.view.renderCoordsHelper,a.center,a.eye),y=i(v+f,k.min,k.max)-v;y&&(c(r.rotate.matrix,r.rotate.matrix,y,o),r.rotate.enabled=!0)}_calculateControlTransformationGlobal(t,e,i){const{eye:a,viewRight:r}=e,o=this._transformation,s=this.view.navigation.gamepad,n=y(E.get(),r,a);g(n,n),f(n,n),N(this.startCamera,e,o,t,this.view.camera.heading,this._headingStart,this.view.camera.tilt,i,s),this._tmpCamera.copyFrom(this.currentCamera),this._applyPan(at.pan,this._tmpCamera);const m=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,l=o.translation[2]*t.ascend;i.ascend=l;const h=-o.heading*t.rotate;0!==h&&(c(i.rotate.matrix,i.rotate.matrix,h,this._tmpCamera.eye),i.rotate.enabled=!0);const p=o.tilt*t.rotate,d=this._clampTiltDeltaGlobalToValidRange(p,e.ray,m);0!==d&&(c(i.rotate.matrix,i.rotate.matrix,d,this._tmpCamera.viewRight),i.rotate.enabled=!0),i.zoom+=o.zoom*t.zoom}_clampTiltDeltaGlobalToValidRange(t,e,a){const r=x(this.view.spatialReference),o=P(k.min,e.origin,a,r);let s=0,n=0;const c=E.get();if(this.view.renderCoordsHelper.intersectManifold(e,a,c)){const t=F(this.view.renderCoordsHelper,c,e.origin);s=P(t,e.origin,a,r),n=P(k.max,e.origin,a,r)}else{L(M(A,a+r.radius),e,c);const t=Math.PI+T(e.direction,c);s=G(t,e.origin,a,r),n=G(k.max,e.origin,a,r)}return i(s+t,o,n)-s}_getPointAbsoluteSurfaceElevation(t,e,i){const{renderCoordsHelper:a}=this.view,r=a.getAltitude(t),o=e+Math.abs(r-e);return a.setAltitude(i,o,t),o}_clampedDistanceToSurface(t,e){const{renderCoordsHelper:i}=this.view,{camera:a}=this.view.state,{direction:r}=B(this.view,e,0,W,st),o=i.intersectManifoldClosestSilhouette(j(e,r),t,E.get()),s=w(e,o),n=i.intersectManifoldClosestSilhouette(j(e,O(E.get(),e,a.center)),t,E.get()),c=w(e,n);return Math.min(s,c)}_computeHeadingRotateRadius(t){const{renderCoordsHelper:e,state:i}=this.view,{camera:r,isGlobal:o}=i,s=e.intersectManifoldClosestSilhouette(r.ray,this._filteredSurfaceElevation,E.get());if(o){const e=h(E.get(),t,s),i=v(e);u(e,e,1/i);const r=g(E.get(),t),o=a(b(r,e));return i*Math.sin(Math.min(Y,o))}{const i=_(E.get(),t);return e.setAltitude(i,this._filteredSurfaceElevation),w(s,i)}}_minimumAscendVelocity(){return this.view.state.constraints.collision.enabled?0:tt}_computeVelocities(t){const e=this._filteredSurfaceElevation,a=e+x(this.view.spatialReference).radius,{camera:r,isGlobal:o}=this.view.state,s=E.get(),n=this._getPointAbsoluteSurfaceElevation(r.eye,e,s),c=this._clampedDistanceToSurface(e,s),m=r.width/2,l=$*r.width,h=$*r.width,p=c*Math.tan(.5*r.fovX)/m,d=p/a,u=p/this._computeHeadingRotateRadius(s),_=n-e;return{pan:(o?d:p)*l*t,ascend:Math.max(this._minimumAscendVelocity()*t,2**(l*t/m)*_-_),zoom:2**(l*t/m)*c-c,rotate:i(u*h,et,it)*t}}_applyDisabledMovementTypes(t){null==this.disableMovements||void 0!==this.disableMovements.mode&&this.view.state.viewingMode!==this.disableMovements.mode||(t.zoom=this.disableMovements.zoom?0:t.zoom,t.ascend=this.disableMovements.ascend?0:t.ascend,t.pan.enabled=!this.disableMovements.pan,this.disableMovements.pan&&m(t.pan.matrix),t.rotate.enabled=!this.disableMovements.rotate,this.disableMovements.rotate&&m(t.rotate.matrix))}static activatesFor(t,e){const i=X(e,t.navigation.gamepad,Q);return!("end"===e.action||Z(i))}};t([o({constructOnly:!0})],J.prototype,"gamepadDevice",void 0),t([o({constructOnly:!0})],J.prototype,"disableMovements",void 0),J=t([s("esri.views.3d.state.controllers.GamepadKeyboardController")],J);const Q={translation:[0,0,0],heading:0,tilt:0,zoom:0},W=80,Y=r(W),$=.75,tt=5,et=r(30),it=r(80),at={zoom:0,ascend:0,pan:{enabled:!1,matrix:l()},rotate:{enabled:!1,matrix:l()}},rt=S(),ot=S(),st=V();function nt(t){t.zoom=0,t.ascend=0,t.pan.enabled=!1,m(t.pan.matrix),t.rotate.enabled=!1,m(t.rotate.matrix)}export{J as GamepadKeyboardController};
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import{neverReached as e}from"../../../../core/compilerUtils.js";import{clamp as i,acosClamped as a,deg2rad as r}from"../../../../core/mathUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{translate as n,rotate as c,identity as m}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{f as h,h as p,g as d,j as u,c as _,k as f,m as v,a as C,n as g,b as y,p as w,E as O,l as b}from"../../../../chunks/vec32.js";import{create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as x}from"../../../../geometry/ellipsoidUtils.js";import{wrap as j}from"../../../../geometry/support/ray.js";import{j as L,a as M,t as A}from"../../../../chunks/sphere.js";import{angle as T}from"../../../../geometry/support/vector.js";import{sv3d as E}from"../../../../geometry/support/vectorStacks.js";import{applyAll as z}from"../../camera/constraintUtils.js";import{ConstraintOptions as I}from"../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as D}from"../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as R}from"../../camera/constraintUtils/InteractionType.js";import{TiltMode as U}from"../../camera/constraintUtils/TiltMode.js";import{TiltRange as k}from"../Constraints.js";import{InteractiveController as H}from"./InteractiveController.js";import{panMotionToRotationMatrix as N,onSurfaceTiltToEyeTiltGlobal as P,offSurfaceTiltToEyeTiltGlobal as G}from"../utils/navigationUtils.js";import{viewAngle as F}from"../utils/viewUtils.js";import{headingTiltToDirectionUp as B}from"../../support/cameraUtils.js";import{createDirectionUp as V}from"../../support/cameraUtilsInternal.js";import K from"../../webgl/RenderCamera.js";import{extractTransformation as X,isZeroTransformation as Z,extractTransformationKeyboard as q}from"../../../navigation/gamepadAndKeyboardUtils.js";let J=class extends H{constructor(t){super(t),this._filteredSurfaceElevation=0,this._transformation={translation:[0,0,0],heading:0,tilt:0,zoom:0},this._keysButtonState=[0,0,0,0,0,0,0,0,0,0,0,0],this._tmpCamera=new K,this._headingStart=0,this._constraintOptions=new I(D.ALL,R.NONE,0,new K,null,U.LOOK_AROUND)}handleEventGamepad(t){const e=X(t,this.view.navigation.gamepad,this._transformation);("end"===t.action||Z(e))&&this.finishController()}activateDirection(t){this._keysButtonState[t]=1,q(this._keysButtonState,this._transformation)}directionActive(t){return 1===this._keysButtonState[t]}countActiveDirections(){return this._keysButtonState.reduce(((t,e)=>e>0?t+1:t),0)}deactivateDirection(t){this._keysButtonState[t]=0;const e=q(this._keysButtonState,this._transformation);Z(e)&&this.finishController()}onControllerStart(t){this._filteredSurfaceElevation=this.view.pointsOfInterest.cameraOnSurface.location.z,this._headingStart=this.view.camera.heading,super.onControllerStart(t)}_updateFilteredSurfaceElevation(t){const e=this.view.pointsOfInterest.cameraOnSurface.location.z,i=1;this._filteredSurfaceElevation+=i*(e-this._filteredSurfaceElevation)*t}stepController(t,e){this._updateStartHeading(),this._updateFilteredSurfaceElevation(t),this.currentCamera.copyViewFrom(e),this._updateCameraCenter(),this._constraintOptions.interactionStartCamera?.copyFrom(this.currentCamera),this._calculateControlTransformation(t,this.currentCamera,at),this._applyDisabledMovementTypes(at),this._applyPan(at.pan),this._applyRotate(at.rotate),this._applyZoom(at.zoom),this._applyAscend(at.ascend),this._constraintOptions.interactionType=R.NONE,this._constraintOptions.selection=D.COLLISION,z(this.view,this.currentCamera,this._constraintOptions),super.stepController(t,e)}_updateStartHeading(){0!==this._transformation.heading&&(this._headingStart=this.view.camera.heading)}_applyRotate(t){if(!t.enabled)return;const e=this.currentCamera;h(rt,e.center,e.eye),p(rt,rt,t.matrix),e.center=d(rt,rt,e.eye),e.up=p(rt,e.up,t.matrix),this._constraintOptions.interactionType=R.LOOK_AROUND,this._constraintOptions.selection=D.ALL_EXCEPT_COLLISION,z(this.view,e,this._constraintOptions)}_applyPan(t,e=this.currentCamera){if(!t.enabled)return;e.eye=p(rt,e.eye,t.matrix),e.center=p(rt,e.center,t.matrix);this.view.state.isGlobal&&(e.up=p(rt,e.up,t.matrix)),this._constraintOptions.interactionType=R.PAN,this._constraintOptions.selection=D.ALL,z(this.view,e,this._constraintOptions)}_applyZoom(t){if(!t)return;const e=this.currentCamera.viewForward;this.currentCamera.eye=d(rt,this.currentCamera.eye,u(E.get(),e,t)),_(ot,e),f(ot,ot),this._constraintOptions.interactionDirection=ot,this._constraintOptions.interactionType=R.ZOOM,this._constraintOptions.selection=D.ALL_EXCEPT_COLLISION,z(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_applyAscend(t){if(!t)return;const e=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,E.get());this._constraintOptions.interactionDirection=_(ot,e);if(this.view.state.isGlobal){const e=v(this.currentCamera.eye),i=(e+t)/e;this.currentCamera.eye=u(rt,this.currentCamera.eye,i),this.currentCamera.center=u(rt,this.currentCamera.center,i)}else{const i=u(E.get(),e,t);this.currentCamera.eye=d(rt,this.currentCamera.eye,i),this.currentCamera.center=d(rt,this.currentCamera.center,i)}this._updateCameraCenter(),this._constraintOptions.interactionType=R.ASCEND,this._constraintOptions.selection=D.COLLISION,z(this.view,this.currentCamera,this._constraintOptions)&&this._updateCameraCenter(),this._constraintOptions.selection=D.ALL_EXCEPT_COLLISION,z(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_calculateControlTransformation(t,e,i){nt(i);const a=this._computeVelocities(t);this.view.state.isLocal?this._calculateControlTransformationLocal(a,e,i):this._calculateControlTransformationGlobal(a,e,i)}_updateCameraCenter(){const t=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,e=this.view.renderCoordsHelper,i=this.currentCamera.ray;this.currentCamera.center=e.intersectManifoldClosestSilhouette(i,t,rt)}_calculateControlTransformationLocal(t,a,r){const{viewRight:o,viewForward:s}=a,m=this._transformation,l=this.view.navigation.gamepad,h=C(E.get(),s[0],s[1],0);g(h,h);const p=m.translation[0]*t.pan;if(0!==p){const t=u(E.get(),o,p);n(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}switch(l.mode){case"pan":{const e=-m.translation[1]*t.pan;if(0!==e){const t=u(E.get(),h,e);n(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}r.zoom=m.zoom*t.zoom;break}case"zoom":r.zoom=(-m.translation[1]+m.zoom)*t.zoom;break;default:e(l.mode)}const d=m.translation[2]*t.ascend;r.ascend=d;const _=-m.heading*t.rotate;0!==_&&(c(r.rotate.matrix,r.rotate.matrix,_,this.view.renderCoordsHelper.worldUpAtPosition(a.eye,E.get())),r.rotate.enabled=!0);const f=m.tilt*t.rotate,v=F(this.view.renderCoordsHelper,a.center,a.eye),y=i(v+f,k.min,k.max)-v;y&&(c(r.rotate.matrix,r.rotate.matrix,y,o),r.rotate.enabled=!0)}_calculateControlTransformationGlobal(t,e,i){const{eye:a,viewRight:r}=e,o=this._transformation,s=this.view.navigation.gamepad,n=y(E.get(),r,a);g(n,n),f(n,n),N(this.startCamera,e,o,t,this.view.camera.heading,this._headingStart,this.view.camera.tilt,i,s),this._tmpCamera.copyFrom(this.currentCamera),this._applyPan(at.pan,this._tmpCamera);const m=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,l=o.translation[2]*t.ascend;i.ascend=l;const h=-o.heading*t.rotate;0!==h&&(c(i.rotate.matrix,i.rotate.matrix,h,this._tmpCamera.eye),i.rotate.enabled=!0);const p=o.tilt*t.rotate,d=this._clampTiltDeltaGlobalToValidRange(p,e.ray,m);0!==d&&(c(i.rotate.matrix,i.rotate.matrix,d,this._tmpCamera.viewRight),i.rotate.enabled=!0),i.zoom+=o.zoom*t.zoom}_clampTiltDeltaGlobalToValidRange(t,e,a){const r=x(this.view.spatialReference),o=P(k.min,e.origin,a,r);let s=0,n=0;const c=E.get();if(this.view.renderCoordsHelper.intersectManifold(e,a,c)){const t=F(this.view.renderCoordsHelper,c,e.origin);s=P(t,e.origin,a,r),n=P(k.max,e.origin,a,r)}else{L(M(A,a+r.radius),e,c);const t=Math.PI+T(e.direction,c);s=G(t,e.origin,a,r),n=G(k.max,e.origin,a,r)}return i(s+t,o,n)-s}_getPointAbsoluteSurfaceElevation(t,e,i){const{renderCoordsHelper:a}=this.view,r=a.getAltitude(t),o=e+Math.abs(r-e);return a.setAltitude(i,o,t),o}_clampedDistanceToSurface(t,e){const{renderCoordsHelper:i}=this.view,{camera:a}=this.view.state,{direction:r}=B(this.view,e,0,W,st),o=i.intersectManifoldClosestSilhouette(j(e,r),t,E.get()),s=w(e,o),n=i.intersectManifoldClosestSilhouette(j(e,O(E.get(),e,a.center)),t,E.get()),c=w(e,n);return Math.min(s,c)}_computeHeadingRotateRadius(t){const{renderCoordsHelper:e,state:i}=this.view,{camera:r,isGlobal:o}=i,s=e.intersectManifoldClosestSilhouette(r.ray,this._filteredSurfaceElevation,E.get());if(o){const e=h(E.get(),t,s),i=v(e);u(e,e,1/i);const r=g(E.get(),t),o=a(b(r,e));return i*Math.sin(Math.min(Y,o))}{const i=_(E.get(),t);return e.setAltitude(i,this._filteredSurfaceElevation),w(s,i)}}_minimumAscendVelocity(){return this.view.state.constraints.collision.enabled?0:tt}_computeVelocities(t){const e=this._filteredSurfaceElevation,a=e+x(this.view.spatialReference).radius,{camera:r,isGlobal:o}=this.view.state,s=E.get(),n=this._getPointAbsoluteSurfaceElevation(r.eye,e,s),c=this._clampedDistanceToSurface(e,s),m=r.width/2,l=$*r.width,h=$*r.width,p=c*Math.tan(.5*r.fovX)/m,d=p/a,u=p/this._computeHeadingRotateRadius(s),_=n-e;return{pan:(o?d:p)*l*t,ascend:Math.max(this._minimumAscendVelocity()*t,2**(l*t/m)*_-_),zoom:2**(l*t/m)*c-c,rotate:i(u*h,et,it)*t}}_applyDisabledMovementTypes(t){null==this.disableMovements||void 0!==this.disableMovements.mode&&this.view.state.viewingMode!==this.disableMovements.mode||(t.zoom=this.disableMovements.zoom?0:t.zoom,t.ascend=this.disableMovements.ascend?0:t.ascend,t.pan.enabled=!this.disableMovements.pan,this.disableMovements.pan&&m(t.pan.matrix),t.rotate.enabled=!this.disableMovements.rotate,this.disableMovements.rotate&&m(t.rotate.matrix))}static activatesFor(t,e){const i=X(e,t.navigation.gamepad,Q);return!("end"===e.action||Z(i))}};t([o({constructOnly:!0})],J.prototype,"gamepadDevice",void 0),t([o({constructOnly:!0})],J.prototype,"disableMovements",void 0),J=t([s("esri.views.3d.state.controllers.GamepadKeyboardController")],J);const Q={translation:[0,0,0],heading:0,tilt:0,zoom:0},W=80,Y=r(W),$=.75,tt=5,et=r(30),it=r(80),at={zoom:0,ascend:0,pan:{enabled:!1,matrix:l()},rotate:{enabled:!1,matrix:l()}},rt=S(),ot=S(),st=V();function nt(t){t.zoom=0,t.ascend=0,t.pan.enabled=!1,m(t.pan.matrix),t.rotate.enabled=!1,m(t.rotate.matrix)}export{J as GamepadKeyboardController};
|