@arcgis/core 4.29.0 → 4.29.1
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/arcade/treeAnalysis.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{b43fde3e25d0c3b020b5.js → 039a872509872ce67ba4.js} +1 -1
- package/assets/esri/core/workers/chunks/{5243f9ff21e768c620c2.js → 23a5d750d93a7829174f.js} +1 -1
- package/assets/esri/core/workers/chunks/{47e6119be4a4a5ed640d.js → 2447a4d5886aeb0ff72a.js} +1 -1
- package/assets/esri/core/workers/chunks/{7f45a9e9bdbcffc2d6e0.js → 348bcc57b99a975902a8.js} +1 -1
- package/assets/esri/core/workers/chunks/{8c9fb2601488998013ba.js → 3523789a2948a4ab8cc8.js} +1 -1
- package/assets/esri/core/workers/chunks/{24649b410b757599a549.js → 48db6e0bbb1a9c043193.js} +1 -1
- package/assets/esri/core/workers/chunks/{752082be991f1cc8558f.js → 4984e2b79d862114d6a6.js} +1 -1
- package/assets/esri/core/workers/chunks/{8d9736fd15cdb54d9855.js → 5227f9eea6988aadad7f.js} +1 -1
- package/assets/esri/core/workers/chunks/58723274ef657fe212eb.js +1 -0
- package/assets/esri/core/workers/chunks/60ab18c6a04d4b2f1d4c.js +1 -0
- package/assets/esri/core/workers/chunks/647515801d94180b8402.js +1 -0
- package/assets/esri/core/workers/chunks/6c3ae96ec90e9ed7dd50.js +1 -0
- package/assets/esri/core/workers/chunks/7a8bba91769ee18cc39f.js +1 -0
- package/assets/esri/core/workers/chunks/7a98d2e026f63a581b1e.js +1 -0
- package/assets/esri/core/workers/chunks/8c360923cd1850767d3e.js +1 -0
- package/assets/esri/core/workers/chunks/{1a25ba411b89e050fbb7.js → a61f337802ae963d7f65.js} +1 -1
- package/assets/esri/core/workers/chunks/{d0c5318d7ef2e923aad0.js → a8ac511280f873960d46.js} +1 -1
- package/assets/esri/core/workers/chunks/b125ab84b7761e761734.js +1 -0
- package/assets/esri/core/workers/chunks/{b34d6e58b125fe111f91.js → b42a83db83851cb57d44.js} +1 -1
- package/assets/esri/core/workers/chunks/{1497dd943df7eede0704.js → b9c55ff1f21db198ce03.js} +1 -1
- package/assets/esri/core/workers/chunks/bb3322ddb89c0bd444f0.js +1 -0
- package/assets/esri/core/workers/chunks/becfdaeeb07f089d8be7.js +1 -0
- package/assets/esri/core/workers/chunks/{b26e39a399963c176d33.js → c527692694688a5b3b07.js} +2 -2
- package/assets/esri/core/workers/chunks/{210a93e0b96c5bff44a3.js → c556644bb0cf88770939.js} +1 -1
- package/assets/esri/core/workers/chunks/{a5e7b4acae17f88e2208.js → ce93027b6b81428ce9b0.js} +1 -1
- package/assets/esri/core/workers/chunks/{b8ece275abac93f3dccf.js → d14f16bfa6c12909929c.js} +1 -1
- package/assets/esri/core/workers/chunks/{1594f06a2d7d9439c62e.js → e2147c99cc5839654be1.js} +1 -1
- package/assets/esri/core/workers/chunks/{d33ed3a2a0d4b640bd4a.js → e4c7d8c69e4957c9d27c.js} +1 -1
- package/assets/esri/core/workers/chunks/{7709248f59520aee6f51.js → eceaa46f622f6fa31128.js} +1 -1
- package/assets/esri/core/workers/chunks/{2286db4c83ff1b6fb088.js → ef3e6209e6ac6a56960b.js} +1 -1
- package/assets/esri/core/workers/chunks/f59b5ea05caca8a1a398.js +1 -0
- package/chunks/Laserlines.glsl.js +3 -3
- package/chunks/Precipitation.glsl.js +1 -1
- package/chunks/SSAOBlur.glsl.js +2 -2
- package/chunks/boundedPlane.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/core/libs/gl-matrix-2/math/quat.js +1 -1
- package/core/libs/gl-matrix-2/math/vec3.js +1 -1
- package/core/libs/gl-matrix-2/vec3.js +1 -1
- package/geometry/support/axisAngleDegrees.js +1 -1
- package/geometry/support/coordinateSystem.js +1 -1
- package/geometry/support/lineSegment.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
- package/geometry/support/meshUtils/georeference.js +1 -1
- package/geometry/support/meshUtils/merge.js +1 -1
- package/geometry/support/meshUtils/rotate.js +1 -1
- package/geometry/support/meshUtils/scale.js +1 -1
- package/geometry/support/meshUtils/vertexSpaceConversion.js +5 -0
- package/geometry/support/meshVertexSpaceUtils.js +1 -1
- package/geometry/support/plane.js +1 -1
- package/geometry/support/ray.js +1 -1
- package/geometry/support/triangle.js +1 -1
- package/geometry/support/vector.js +1 -1
- package/interfaces.d.ts +6 -6
- package/kernel.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/LinkChartLayer.js +1 -1
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
- package/layers/mixins/FeatureReductionLayer.js +1 -1
- package/layers/orientedImagery/core/coverageUtils.js +1 -1
- package/layers/orientedImagery/transformations/imageToGroundUtils.js +1 -1
- package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
- package/layers/support/layerUtils.js +1 -1
- package/layers/video/VideoCameraSensorModel.js +1 -1
- package/layers/voxel/VoxelVolume.js +1 -1
- package/layers/voxel/voxelPlaneUtils.js +1 -1
- package/libs/linkchartlayout/LinkChartLayout.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/views/2d/arcade/callExpressionWithCursor.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/createTestMeshData.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriterInputEvaluator.js +1 -1
- package/views/2d/interactive/editingTools/TransformTool.js +1 -1
- package/views/2d/interactive/editingTools/manipulations/ScaleManipulation.js +1 -1
- package/views/2d/layers/features/Processor.js +1 -1
- package/views/2d/layers/features/aggregation/GeohashSpatialIndex.js +1 -1
- package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
- package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
- package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
- package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
- package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/DrillDownTileSourceChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/OverrideChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/PagedTileSourceChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/StreamSourceChunk.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/features/support/FeatureMetadata.js +1 -1
- package/views/2d/layers/features/support/GraphicsReader.js +1 -1
- package/views/2d/layers/features/support/Tile.js +1 -1
- package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
- package/views/2d/tiling/TileKey.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/DirectLineMeasurement/DirectLineMeasurementController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/analysis/support/measurementUtils.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/distance.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/EnvironmentRenderer.js +1 -1
- package/views/3d/environment/Fog.js +1 -1
- package/views/3d/environment/MarsAtmosphere.js +1 -1
- package/views/3d/environment/SceneViewEnvironmentManager.js +1 -1
- package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
- package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
- package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
- package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/reshapeGraphic/edgeOffsetUtils.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/ExtentScale.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/extentUtils.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/support/Segment.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/PointCloudWorker.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/objectResourceUtils.js +1 -1
- package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.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/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/Frustum.js +1 -1
- package/views/3d/state/NearFarHeuristic.js +1 -1
- package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
- package/views/3d/state/controllers/RotateController.js +1 -1
- package/views/3d/state/controllers/global/PinchAndPanController.js +1 -1
- package/views/3d/state/controllers/global/ZoomController.js +1 -1
- package/views/3d/state/controllers/global/ZoomStepController.js +1 -1
- package/views/3d/state/controllers/local/PinchAndPanController.js +1 -1
- package/views/3d/state/controllers/local/ZoomController.js +1 -1
- package/views/3d/state/controllers/local/ZoomStepController.js +1 -1
- package/views/3d/state/controllers/momentum/ZoomPlanarMomentumController.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/cameraUtils.js +1 -1
- package/views/3d/support/cameraUtilsInternal.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/CameraOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/Focus.js +1 -1
- package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
- package/views/3d/support/sunUtils.js +1 -1
- package/views/3d/support/viewpointUtils.js +1 -1
- package/views/3d/terrain/OverlayManager.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/Tile.js +1 -1
- package/views/3d/webgl-engine/collections/Component/DepthRange.js +1 -1
- package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/core/util/TwoVectorPosition.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
- package/views/3d/webgl-engine/lib/Camera.js +1 -1
- package/views/3d/webgl-engine/lib/GeometryUtil.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/PathVertex.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.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/intersectorUtils.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
- package/views/3d/webgl-engine/lighting/SceneLighting.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/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/pbrUtils.js +1 -1
- package/views/SelectionManager.js +1 -1
- package/views/draw/support/createUtils.js +1 -1
- package/views/draw/support/surfaceCoordinateSystems.js +1 -1
- package/views/interactive/GraphicManipulator.js +1 -1
- package/views/interactive/SegmentLabels.js +1 -1
- package/views/interactive/coordinateHelper.js +1 -1
- package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
- package/views/interactive/editGeometry/support/editPlaneUtils.js +1 -1
- package/views/interactive/sketch/constraints.js +1 -1
- package/views/interactive/snapping/RightAngleSnapper.js +1 -1
- package/views/interactive/snapping/candidates/ParallelLineSnappingCandidate.js +1 -1
- package/views/interactive/snapping/candidates/RightAngleTriangleSnappingCandidate.js +1 -1
- package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
- package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
- package/views/interactive/snapping/hints/IntersectionSnappingHint.js +1 -1
- package/views/interactive/snapping/hints/LineSnappingHint.js +1 -1
- package/views/interactive/snapping/hints/ParallelSnappingHint.js +1 -1
- package/views/interactive/snapping/hints/PointSnappingHint.js +1 -1
- package/views/interactive/snapping/hints/RightAngleSnappingHint.js +1 -1
- package/views/layers/FeatureLayerView.js +1 -1
- package/views/navigation/PanSphericalMomentumEstimator.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/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/FeatureTable/support/ColumnTemplateBase.js +1 -1
- package/widgets/Features/FeaturesViewModel.js +1 -1
- package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
- package/widgets/PanoramicViewer/utils.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
- package/widgets/support/Selector2D/SelectionOperation.js +1 -1
- package/widgets/support/Selector2D/selectorUtils.js +1 -1
- package/assets/esri/core/workers/chunks/0e83f3718a0b45652b5e.js +0 -1
- package/assets/esri/core/workers/chunks/1fa5c8af69a09a3730b3.js +0 -1
- package/assets/esri/core/workers/chunks/4736f79b5c94ce103d43.js +0 -1
- package/assets/esri/core/workers/chunks/65f7adaaf1f535310c11.js +0 -1
- package/assets/esri/core/workers/chunks/79c041b292648c5eaecc.js +0 -1
- package/assets/esri/core/workers/chunks/7c4c2c0beddabac672b6.js +0 -1
- package/assets/esri/core/workers/chunks/9307d485a9e5f9fa77d1.js +0 -1
- package/assets/esri/core/workers/chunks/9a758de08dfa57735879.js +0 -1
- package/assets/esri/core/workers/chunks/a4c3da057ec2a07bbbe8.js +0 -1
- package/assets/esri/core/workers/chunks/b252270b100351779f1f.js +0 -1
- package/assets/esri/core/workers/chunks/dc57aa9f2fc69e654559.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../analysis/SlicePlane.js";import{clock as i}from"../../../../core/clock.js";import{destroyMaybe as a,removeMaybe as s}from"../../../../core/maybe.js";import{watch as n,sync as r,syncAndInitial as l}from"../../../../core/reactiveUtils.js";import{addFrameTask as o}from"../../../../core/scheduling.js";import{createScreenPoint as h,screenPointObjectToArray as p}from"../../../../core/screenUtils.js";import{property as u}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromRotation as d,fromScaling as _,multiply as v}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{j as P,l as y,c as m,h as w,g,e as f,n as M,s as D}from"../../../../chunks/vec32.js";import{clone as V,create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{clone as T,ZEROS as E}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{a as k,c as S,n as x,f as j}from"../../../../chunks/boundedPlane.js";import{signedDistance as H,create as C,intersectRay as R,getNormal as O}from"../../../../geometry/support/plane.js";import{create as I}from"../../../../geometry/support/ray.js";import{sv3d as z,sm4d as G,sv2d as L}from"../../../../geometry/support/vectorStacks.js";import{getRotateHeadingTexture as U,getTiltRotateTexture as A}from"../images/Factory.js";import{ResizeManipulator as K}from"./ResizeManipulator.js";import{RotateManipulator as B}from"./RotateManipulator.js";import{getOutlineColor as F,planeColor as N}from"./settings.js";import{ShiftManipulator as q,OffsetMode as Z}from"./ShiftManipulator.js";import{pointerMoveTimerMs as W,planePreviewOutlineWidth as J,forceVerticalModifier as Q,forceHorizontalModifier as X,previewFadeDotThreshold as Y,previewFadeDurationSeconds as $,initialDepthOffsetFrac as tt}from"./sliceToolConfig.js";import{createGridVisualElement as et,createOutlineVisualElement as it,planeToShape as at,createRotatePlane as st,RotationAxis as nt,resizePlane as rt,calculatePlaneHalfSize as lt,SliceOrientation as ot,createPlane as ht,DidPointerMoveRecentlyFlag as pt,calculateBoundedPlaneTranslateRotate as ut,updateShiftRestartHandle as ct,updateRotateHeadingHandle as dt,updateRotateTiltHandle as _t,updateResizeHandle as vt,createShiftPlane as Pt}from"./sliceToolUtils.js";import{calculateInputRotationTransform as yt}from"../../interactive/manipulatorUtils.js";import{screenToRenderPlane as mt}from"../../interactive/editingTools/dragEventPipeline3D.js";import{fromScreenNormalized as wt}from"../../support/geometryUtils/ray.js";import{AnalysisToolBase as gt}from"../../../interactive/AnalysisToolBase.js";import{createManipulatorDragEventPipeline as ft}from"../../../interactive/dragEventPipeline.js";import{newToolIntersector as Mt}from"../../../interactive/ToolIntersector.js";import{createScreenPointFromEvent as Dt}from"../../../support/screenUtils.js";var Vt;let bt=Vt=class extends gt{constructor(t){super(t),this._clock=i,this._previewPlaneOpacity=1,this.removeIncompleteOnCancel=!1,this._layersMode="none",this.shiftManipulator=null,this.rotateHeadingManipulator=null,this.rotateTiltManipulator=null,this.resizeManipulators=null,this._frameTask=null,this._pointerMoveTimerMs=W,this._prevPointerMoveTimeout=null,this._previewPlaneGridVisualElement=null,this._previewPlaneOutlineVisualElement=null,this._startPlane=k(),this._previewPlane=null,this._activeKeyModifiers={},this._lastCursorPosition=h(),this._resizeHandles=[{direction:[1,0]},{direction:[1,1]},{direction:[0,1]},{direction:[-1,1]},{direction:[-1,0]},{direction:[-1,-1]},{direction:[0,-1]},{direction:[1,-1]}],this._intersector=Mt(t.view.state.viewingMode)}initialize(){if(null==this.analysis)throw new Error("SliceTool requires valid analysis, but null was provided.");const t=t=>{this._updateManipulatorsInteractive(t),t.grabbing||(null!=this.analysisViewData.plane&&S(this.analysisViewData.plane,this._startPlane),this.inputState=null)},e=new q(this.view,Z.CENTER_ON_ARROW);this.shiftManipulator=e,this.manipulators.add(e),this.addHandles([this._createShiftDragPipeline(e),e.events.on("grab-changed",(i=>{this._onShiftGrab(i),t(e)}))]);const i=!this.view._stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result,a=new B(this.view,((t,e)=>U(this.view.textures,{accentColor:t,contrastColor:e,preMultiplyAlpha:i})));this.rotateHeadingManipulator=a,this.manipulators.add(a),this.addHandles([this._createRotateHeadingDragPipeline(a),a.events.on("grab-changed",(e=>{this._onRotateHeadingGrab(e),t(a)}))]);const s=new B(this.view,((t,e)=>A(this.view.textures,{accentColor:t,contrastColor:e,preMultiplyAlpha:i})));this.rotateTiltManipulator=s,this.manipulators.add(s),this.addHandles([this._createRotateTiltDragPipeline(s),s.events.on("grab-changed",(e=>{this._onRotateTiltGrab(e),t(s)}))]),this.resizeManipulators=this._resizeHandles.map(((e,i)=>{const a=new K(this.view,e);return this.addHandles([this._createResizeDragPipeline(a),a.events.on("grab-changed",(e=>{this._onResizeGrab(e,i),t(a)}))]),a})),this.manipulators.addMany(this.resizeManipulators),this._previewPlaneGridVisualElement=et(this.view),this._previewPlaneOutlineVisualElement=it(this.view),this._previewPlaneOutlineVisualElement.width=J,this.addHandles(n((()=>[this.analysisViewData.plane,this.analysis.tiltEnabled]),(()=>this._updateManipulators()),r));const o=n((()=>this.state),(t=>{"sliced"===t&&this.finishToolCreation()}),l);this.addHandles([o,n((()=>this.view.state.camera),(()=>this._onCameraChange()))])}destroy(){this._removeFrameTask(),this._clearPointerMoveTimeout(),this._previewPlaneOutlineVisualElement=a(this._previewPlaneOutlineVisualElement),this._previewPlaneGridVisualElement=a(this._previewPlaneGridVisualElement)}get state(){const t=!!this.analysisViewData.plane,e=!!this.inputState;return t?t&&e?"slicing":t&&!e?"sliced":"ready":"ready"}get cursor(){return this._isPlacingSlicePlane||"exclude"===this.layersMode?"crosshair":null!=this._creatingPointerId?"grabbing":null}set analysis(t){if(null==t)throw new Error("SliceTool requires valid analysis, but null was provided.");this.removeHandles("analysis"),this._set("analysis",t)}get layersMode(){return this._layersMode}get inputState(){return this._get("inputState")}set inputState(t){this._set("inputState",t),this.analysisViewData.showGrid=null!=t&&"resize"===t.type,this._updateMaterials()}get _isPlacingSlicePlane(){return!this.inputState&&!this.analysisViewData.plane&&this.active}get _creatingPointerId(){return null!=this.inputState&&"shift"===this.inputState.type?this.inputState.creatingPointerId:null}enterExcludeLayerMode(){null!=this.analysisViewData.plane&&(this._layersMode="exclude",this.active||(this.view.activeTool=this))}exitExcludeLayerMode(){null!=this.analysisViewData.plane&&(this._layersMode="none",this.active&&(this.view.activeTool=null))}onDeactivate(){this._updatePreviewPlane(null)}onShow(){this._updateVisibility(!0)}onHide(){this._updateVisibility(!1)}_updateVisibility(t){this._updateManipulators(),t||this._clearPointerMoveTimeout()}onInputEvent(t){switch(t.type){case"pointer-drag":if(!Et(t))return;this._isPlacingSlicePlane?this._onClickPlacePlane(t)&&t.stopPropagation():this._onPointerDrag(t)&&t.stopPropagation();break;case"pointer-move":this._onPointerMove(t);break;case"pointer-up":this._onPointerUp(t)&&t.stopPropagation();break;case"immediate-click":if(!Et(t))return;this._onClickPlacePlane(t)&&t.stopPropagation();break;case"click":if(!Et(t))return;this._onClickExcludeLayer(t)&&t.stopPropagation();break;case"drag":this.inputState&&t.stopPropagation();break;case"key-down":this._onKeyDown(t)&&t.stopPropagation();break;case"key-up":this._onKeyUp(t)&&t.stopPropagation()}}onEditableChange(){this.analysisViewData.editable=this.internallyEditable}_onPointerDrag(t){const e=this.inputState;if(t.pointerId===this._creatingPointerId&&null!=e&&"shift"===e.type){const i=Dt(t);return this.shiftManipulator.events.emit("drag",{action:e.hasBeenDragged?"update":"start",pointerType:t.pointerType,start:i,screenPoint:i}),e.hasBeenDragged=!0,!0}return!1}_onPointerMove(t){this._lastCursorPosition.x=t.x,this._lastCursorPosition.y=t.y,this._resetPointerMoveTimeout(),"touch"!==t.pointerType&&this._updatePreviewPlane(Dt(t),this._activeKeyModifiers)}_onCameraChange(){this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),this._updateManipulators()}_onPointerUp(t){if(t.pointerId===this._creatingPointerId&&null!=this.analysisViewData.plane){const e=Dt(t);return this.shiftManipulator.events.emit("drag",{action:"end",start:e,screenPoint:e}),S(this.analysisViewData.plane,this._startPlane),this.inputState=null,!0}return!1}_onClickPlacePlane(t){if("exclude"===this.layersMode)return!1;if(this._isPlacingSlicePlane){const i=Dt(t),a=k();if(this._pickPlane(i,!1,this._activeKeyModifiers,a)){if("pointer-drag"===t.type){const e=wt(this.view.state.camera,i,St);this.inputState=Tt(e,t.pointerId,a.origin,a)}return S(a,this._startPlane),this.analysis.shape=at(a,this.view,this.view.spatialReference,new e),!0}}return!1}_onClickExcludeLayer(t){return!("exclude"!==this.layersMode||!this.created)&&(this.view.hitTest(Dt(t)).then((t=>{if(t.results.length){const e=t.results[0],i="graphic"===e?.type&&e.graphic;if(i){const t=i.sourceLayer||i.layer;t&&this.analysis.excludedLayers.push(t)}}else t.ground.layer?this.analysis.excludedLayers.push(t.ground.layer):this.analysis.excludeGroundSurface=!0})),this.exitExcludeLayerMode(),!0)}_onKeyDown(t){return(t.key===Q||t.key===X)&&(this._activeKeyModifiers[t.key]=!0,null!=this._previewPlane&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onKeyUp(t){return!(t.key!==Q&&t.key!==X||!this._activeKeyModifiers[t.key])&&(delete this._activeKeyModifiers[t.key],null!=this._previewPlane&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onShiftGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=wt(this.view.state.camera,t.screenPoint,St);S(this.analysisViewData.plane,this._startPlane),this.inputState=Tt(e,null,this.shiftManipulator.renderLocation,this.analysisViewData.plane)}_createShiftDragPipeline(t){return ft(t,((t,e,i)=>{const a=this.inputState;if(null==a||"shift"!==a.type)return;const s=null!=this.analysisViewData.plane?S(this.analysisViewData.plane,k()):null;e.next(mt(this.view,a.shiftPlane)).next(this._shiftDragAdjustSensitivity(a)).next(this._shiftDragUpdatePlane(a)),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_shiftDragAdjustSensitivity(t){return e=>{if(null==this.analysisViewData.plane)return null;const i=.001,a=Math.min((1-Math.abs(P(x(this.analysisViewData.plane),e.ray.direction)/y(e.ray.direction)))/i,1),s=-H(this._startPlane.plane,e.renderEnd),n=-H(this._startPlane.plane,t.startPoint);return t.depth=t.depth*(1-a)+s*a-n,e}}_shiftDragUpdatePlane(t){return()=>{if(null==this.analysisViewData.plane)return;const e=m(z.get(),this._startPlane.origin),i=m(z.get(),x(this._startPlane));w(i,i,-t.depth),g(i,i,e);const a=j(i,this.analysisViewData.plane.basis1,this.analysisViewData.plane.basis2,k());this._updateBoundedPlane(a)}}_onRotateHeadingGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=st(this.analysisViewData.plane,this.view.renderCoordsHelper,nt.HEADING,C()),i=wt(this.view.state.camera,t.screenPoint,St),a=b();R(e,i,a)&&(S(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateHeadingDragPipeline(t){return ft(t,((t,e,i)=>{const a=this.inputState;if(null==a||"rotate"!==a.type)return;const s=null!=this.analysisViewData.plane?S(this.analysisViewData.plane,k()):null;e.next(mt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_onRotateTiltGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=st(this.analysisViewData.plane,this.view.renderCoordsHelper,nt.TILT,C()),i=wt(this.view.state.camera,t.screenPoint,St),a=b();R(e,i,a)&&(S(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateTiltDragPipeline(t){return ft(t,((t,e,i)=>{const a=this.inputState;if(null==a||"rotate"!==a.type)return;const s=null!=this.analysisViewData.plane?S(this.analysisViewData.plane,k()):null;e.next(mt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_rotateDragRenderPlaneToRotate(t){return e=>{if(null==this.analysisViewData.plane)return null;const i=O(t.rotatePlane),a=yt(t.startPoint,e.renderEnd,this.analysisViewData.plane.origin,i);return{...e,rotateAxis:i,rotateAngle:a}}}_rotateDragUpdatePlaneFromRotate(){return t=>{if(null==this.analysisViewData.plane)return;const e=d(G.get(),t.rotateAngle,t.rotateAxis);if(null==e)return;const i=f(z.get(),this._startPlane.basis1,e),a=f(z.get(),this._startPlane.basis2,e),s=j(this.analysisViewData.plane.origin,i,a,k());this._updateBoundedPlane(s)}}_onResizeGrab(t,e){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const i=wt(this.view.state.camera,t.screenPoint,St),a=z.get();R(this.analysisViewData.plane.plane,i,a)&&(S(this.analysisViewData.plane,this._startPlane),this.inputState={type:"resize",activeHandleIdx:e,startPoint:V(a)})}_createResizeDragPipeline(t){return ft(t,((t,e,i)=>{const a=this.inputState;if(null==a||"resize"!==a.type||null==this.analysisViewData.plane)return;const s=S(this.analysisViewData.plane,k());e.next(mt(this.view,this.analysisViewData.plane.plane)).next(this._resizeDragUpdatePlane(a)),i.next((()=>{this._updateBoundedPlane(s)}))}))}_resizeDragUpdatePlane(t){return e=>{if(null==this.analysisViewData.plane)return;const i=this._resizeHandles[t.activeHandleIdx],a=rt(i,t.startPoint,e.renderEnd,this.view.state.camera,this._startPlane,S(this.analysisViewData.plane));this._updateBoundedPlane(a)}}_updateBoundedPlane(t){const e=this.analysisViewData;if(null==e)throw new Error("valid internal object expected");e.plane=t}_updatePreviewPlane(t,e={}){let i=this._previewPlane;if(this._previewPlane=null,null==t)return this._removeFrameTask(),void this._updateManipulators();if(!this.analysisViewData.plane&&this.active){const a=null!=i?i:k();if(i=null!=i?S(i,kt):null,this._pickPlane(t,!0,e,a)){const t=Y;let e=!1;null!=i&&(e=P(O(i.plane),O(a.plane))<t||P(M(z.get(),i.basis1),M(z.get(),a.basis1))<t),e&&(this._previewPlaneOpacity=0),this._previewPlane=a}}null!=this._previewPlane&&null==this._frameTask&&0===this._previewPlaneOpacity?this._frameTask=o({update:({deltaTime:t})=>{this._previewPlaneOpacity=Math.min(this._previewPlaneOpacity+t/(1e3*$),1),this._updateManipulators(),1===this._previewPlaneOpacity&&this._removeFrameTask()}}):null==this._previewPlane&&null!=this._frameTask?this._removeFrameTask():null!=this._previewPlane&&this._updateManipulators()}_removeFrameTask(){this._frameTask=s(this._frameTask)}_pickMinResult(t){const e=p(t,L.get());return this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(e,this._intersector),this._intersector.results.min}_pickPlane(t,e,i,a){const s=this._pickMinResult(t),n=z.get();if(!s.getIntersectionPoint(n))return!1;const r=s.getTransformedNormal(z.get()),l=this.view.state.camera;P(r,l.viewForward)>0&&w(r,r,-1);const o=lt(n,l),h=(e?1:-1)*o*tt,p=w(z.get(),r,h);g(p,p,n);const u=this.analysis.tiltEnabled?ot.TILTED:ot.HORIZONTAL_OR_VERTICAL,c=i[Q]?ot.VERTICAL:i[X]?ot.HORIZONTAL:u;return ht(p,r,o,o,l,c,this.view.renderCoordsHelper,a),!0}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=s(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.shiftManipulator.state|=pt,this.rotateHeadingManipulator.state|=pt,this.rotateTiltManipulator.state|=pt,this._prevPointerMoveTimeout=this._clock.setTimeout((()=>{this.shiftManipulator.state&=~pt,this.rotateHeadingManipulator.state&=~pt,this.rotateTiltManipulator.state&=~pt}),this._pointerMoveTimerMs)}_updateManipulators(){if(Vt.disableEngineLayers)return;let t,e=!1;if(null!=this.analysisViewData.plane)t=this.analysisViewData.plane,e=!1;else{if(null==this._previewPlane)return this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.visible=!1,void(this._previewPlaneGridVisualElement.visible=!1);t=this._previewPlane,e=!0}const i=ut(t,G.get());e?(this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.attached=!0,this._previewPlaneGridVisualElement.attached=!0,this._previewPlaneOutlineVisualElement.visible=!0,this._previewPlaneGridVisualElement.visible=!0):(this.shiftManipulator.available=!0,this.rotateHeadingManipulator.available=!0,this.rotateTiltManipulator.available=this.analysis.tiltEnabled,this.resizeManipulators.forEach((t=>t.available=!0)),ct(this.shiftManipulator,i,t,this.view.state.camera),dt(this.rotateHeadingManipulator,i,t,this.view.renderCoordsHelper),_t(this.rotateTiltManipulator,i,t),this.resizeManipulators.forEach(((e,a)=>vt(e,this._resizeHandles[a],i,t))),this._previewPlaneOutlineVisualElement.visible=!1,this._previewPlaneGridVisualElement.visible=!1);const a=D(z.get(),y(t.basis1),y(t.basis2),1),s=_(G.get(),a),n=v(s,i,s);this._previewPlaneOutlineVisualElement.transform=n,this._previewPlaneGridVisualElement.transform=n,this._updateMaterials()}_updateMaterials(){const t=F(this.view.effectiveTheme);t[3]*=this._previewPlaneOpacity;const e=T(N);e[3]*=this._previewPlaneOpacity,this._previewPlaneOutlineVisualElement.color=t,this._previewPlaneGridVisualElement.backgroundColor=e,this._previewPlaneGridVisualElement.gridColor=E}_updateManipulatorsInteractive(t){if(!t.grabbing)return this.shiftManipulator.interactive=!0,this.rotateHeadingManipulator.interactive=!0,this.rotateTiltManipulator.interactive=!0,void this.resizeManipulators.forEach((t=>{t.interactive=!0}));this.shiftManipulator.interactive=this.shiftManipulator===t,this.rotateHeadingManipulator.interactive=this.rotateHeadingManipulator===t,this.rotateTiltManipulator.interactive=this.rotateTiltManipulator===t,this.resizeManipulators.forEach((e=>{e.interactive=e===t}))}testData(){return{plane:this.analysisViewData.plane,setPointerMoveTimerMs:t=>{this._pointerMoveTimerMs=t}}}};function Tt(t,e,i,a){const s=Pt(i,x(a),t.direction,C()),n=b();return R(s,t,n)?{type:"shift",creatingPointerId:e,hasBeenDragged:!1,shiftPlane:s,depth:0,startPoint:n}:null}function Et(t){return"mouse"!==t.pointerType||0===t.button}bt.disableEngineLayers=!1,t([u()],bt.prototype,"_clock",void 0),t([u({constructOnly:!0})],bt.prototype,"view",void 0),t([u()],bt.prototype,"analysisViewData",void 0),t([u({readOnly:!0})],bt.prototype,"state",null),t([u({readOnly:!0})],bt.prototype,"cursor",null),t([u()],bt.prototype,"analysis",null),t([u()],bt.prototype,"removeIncompleteOnCancel",void 0),t([u()],bt.prototype,"_layersMode",void 0),t([u()],bt.prototype,"layersMode",null),t([u({value:null})],bt.prototype,"inputState",null),t([u()],bt.prototype,"_isPlacingSlicePlane",null),t([u()],bt.prototype,"_creatingPointerId",null),bt=Vt=t([c("esri.views.3d.analysis.Slice.SliceTool")],bt);const kt=k(),St=I(),xt=bt;export{xt as default};
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../analysis/SlicePlane.js";import{clock as i}from"../../../../core/clock.js";import{destroyMaybe as a,removeMaybe as s}from"../../../../core/maybe.js";import{watch as n,sync as r,syncAndInitial as l}from"../../../../core/reactiveUtils.js";import{addFrameTask as o}from"../../../../core/scheduling.js";import{createScreenPoint as h,screenPointObjectToArray as p}from"../../../../core/screenUtils.js";import{property as u}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromRotation as d,fromScaling as _,multiply as v}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{k as P,l as y,c as m,h as w,g,e as f,n as M,s as D}from"../../../../chunks/vec32.js";import{clone as V,create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{clone as T,ZEROS as E}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{a as k,c as S,n as x,f as j}from"../../../../chunks/boundedPlane.js";import{signedDistance as H,create as C,intersectRay as R,getNormal as O}from"../../../../geometry/support/plane.js";import{create as I}from"../../../../geometry/support/ray.js";import{sv3d as z,sm4d as G,sv2d as L}from"../../../../geometry/support/vectorStacks.js";import{getRotateHeadingTexture as U,getTiltRotateTexture as A}from"../images/Factory.js";import{ResizeManipulator as K}from"./ResizeManipulator.js";import{RotateManipulator as B}from"./RotateManipulator.js";import{getOutlineColor as F,planeColor as N}from"./settings.js";import{ShiftManipulator as q,OffsetMode as Z}from"./ShiftManipulator.js";import{pointerMoveTimerMs as W,planePreviewOutlineWidth as J,forceVerticalModifier as Q,forceHorizontalModifier as X,previewFadeDotThreshold as Y,previewFadeDurationSeconds as $,initialDepthOffsetFrac as tt}from"./sliceToolConfig.js";import{createGridVisualElement as et,createOutlineVisualElement as it,planeToShape as at,createRotatePlane as st,RotationAxis as nt,resizePlane as rt,calculatePlaneHalfSize as lt,SliceOrientation as ot,createPlane as ht,DidPointerMoveRecentlyFlag as pt,calculateBoundedPlaneTranslateRotate as ut,updateShiftRestartHandle as ct,updateRotateHeadingHandle as dt,updateRotateTiltHandle as _t,updateResizeHandle as vt,createShiftPlane as Pt}from"./sliceToolUtils.js";import{calculateInputRotationTransform as yt}from"../../interactive/manipulatorUtils.js";import{screenToRenderPlane as mt}from"../../interactive/editingTools/dragEventPipeline3D.js";import{fromScreenNormalized as wt}from"../../support/geometryUtils/ray.js";import{AnalysisToolBase as gt}from"../../../interactive/AnalysisToolBase.js";import{createManipulatorDragEventPipeline as ft}from"../../../interactive/dragEventPipeline.js";import{newToolIntersector as Mt}from"../../../interactive/ToolIntersector.js";import{createScreenPointFromEvent as Dt}from"../../../support/screenUtils.js";var Vt;let bt=Vt=class extends gt{constructor(t){super(t),this._clock=i,this._previewPlaneOpacity=1,this.removeIncompleteOnCancel=!1,this._layersMode="none",this.shiftManipulator=null,this.rotateHeadingManipulator=null,this.rotateTiltManipulator=null,this.resizeManipulators=null,this._frameTask=null,this._pointerMoveTimerMs=W,this._prevPointerMoveTimeout=null,this._previewPlaneGridVisualElement=null,this._previewPlaneOutlineVisualElement=null,this._startPlane=k(),this._previewPlane=null,this._activeKeyModifiers={},this._lastCursorPosition=h(),this._resizeHandles=[{direction:[1,0]},{direction:[1,1]},{direction:[0,1]},{direction:[-1,1]},{direction:[-1,0]},{direction:[-1,-1]},{direction:[0,-1]},{direction:[1,-1]}],this._intersector=Mt(t.view.state.viewingMode)}initialize(){if(null==this.analysis)throw new Error("SliceTool requires valid analysis, but null was provided.");const t=t=>{this._updateManipulatorsInteractive(t),t.grabbing||(null!=this.analysisViewData.plane&&S(this.analysisViewData.plane,this._startPlane),this.inputState=null)},e=new q(this.view,Z.CENTER_ON_ARROW);this.shiftManipulator=e,this.manipulators.add(e),this.addHandles([this._createShiftDragPipeline(e),e.events.on("grab-changed",(i=>{this._onShiftGrab(i),t(e)}))]);const i=!this.view._stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result,a=new B(this.view,((t,e)=>U(this.view.textures,{accentColor:t,contrastColor:e,preMultiplyAlpha:i})));this.rotateHeadingManipulator=a,this.manipulators.add(a),this.addHandles([this._createRotateHeadingDragPipeline(a),a.events.on("grab-changed",(e=>{this._onRotateHeadingGrab(e),t(a)}))]);const s=new B(this.view,((t,e)=>A(this.view.textures,{accentColor:t,contrastColor:e,preMultiplyAlpha:i})));this.rotateTiltManipulator=s,this.manipulators.add(s),this.addHandles([this._createRotateTiltDragPipeline(s),s.events.on("grab-changed",(e=>{this._onRotateTiltGrab(e),t(s)}))]),this.resizeManipulators=this._resizeHandles.map(((e,i)=>{const a=new K(this.view,e);return this.addHandles([this._createResizeDragPipeline(a),a.events.on("grab-changed",(e=>{this._onResizeGrab(e,i),t(a)}))]),a})),this.manipulators.addMany(this.resizeManipulators),this._previewPlaneGridVisualElement=et(this.view),this._previewPlaneOutlineVisualElement=it(this.view),this._previewPlaneOutlineVisualElement.width=J,this.addHandles(n((()=>[this.analysisViewData.plane,this.analysis.tiltEnabled]),(()=>this._updateManipulators()),r));const o=n((()=>this.state),(t=>{"sliced"===t&&this.finishToolCreation()}),l);this.addHandles([o,n((()=>this.view.state.camera),(()=>this._onCameraChange()))])}destroy(){this._removeFrameTask(),this._clearPointerMoveTimeout(),this._previewPlaneOutlineVisualElement=a(this._previewPlaneOutlineVisualElement),this._previewPlaneGridVisualElement=a(this._previewPlaneGridVisualElement)}get state(){const t=!!this.analysisViewData.plane,e=!!this.inputState;return t?t&&e?"slicing":t&&!e?"sliced":"ready":"ready"}get cursor(){return this._isPlacingSlicePlane||"exclude"===this.layersMode?"crosshair":null!=this._creatingPointerId?"grabbing":null}set analysis(t){if(null==t)throw new Error("SliceTool requires valid analysis, but null was provided.");this.removeHandles("analysis"),this._set("analysis",t)}get layersMode(){return this._layersMode}get inputState(){return this._get("inputState")}set inputState(t){this._set("inputState",t),this.analysisViewData.showGrid=null!=t&&"resize"===t.type,this._updateMaterials()}get _isPlacingSlicePlane(){return!this.inputState&&!this.analysisViewData.plane&&this.active}get _creatingPointerId(){return null!=this.inputState&&"shift"===this.inputState.type?this.inputState.creatingPointerId:null}enterExcludeLayerMode(){null!=this.analysisViewData.plane&&(this._layersMode="exclude",this.active||(this.view.activeTool=this))}exitExcludeLayerMode(){null!=this.analysisViewData.plane&&(this._layersMode="none",this.active&&(this.view.activeTool=null))}onDeactivate(){this._updatePreviewPlane(null)}onShow(){this._updateVisibility(!0)}onHide(){this._updateVisibility(!1)}_updateVisibility(t){this._updateManipulators(),t||this._clearPointerMoveTimeout()}onInputEvent(t){switch(t.type){case"pointer-drag":if(!Et(t))return;this._isPlacingSlicePlane?this._onClickPlacePlane(t)&&t.stopPropagation():this._onPointerDrag(t)&&t.stopPropagation();break;case"pointer-move":this._onPointerMove(t);break;case"pointer-up":this._onPointerUp(t)&&t.stopPropagation();break;case"immediate-click":if(!Et(t))return;this._onClickPlacePlane(t)&&t.stopPropagation();break;case"click":if(!Et(t))return;this._onClickExcludeLayer(t)&&t.stopPropagation();break;case"drag":this.inputState&&t.stopPropagation();break;case"key-down":this._onKeyDown(t)&&t.stopPropagation();break;case"key-up":this._onKeyUp(t)&&t.stopPropagation()}}onEditableChange(){this.analysisViewData.editable=this.internallyEditable}_onPointerDrag(t){const e=this.inputState;if(t.pointerId===this._creatingPointerId&&null!=e&&"shift"===e.type){const i=Dt(t);return this.shiftManipulator.events.emit("drag",{action:e.hasBeenDragged?"update":"start",pointerType:t.pointerType,start:i,screenPoint:i}),e.hasBeenDragged=!0,!0}return!1}_onPointerMove(t){this._lastCursorPosition.x=t.x,this._lastCursorPosition.y=t.y,this._resetPointerMoveTimeout(),"touch"!==t.pointerType&&this._updatePreviewPlane(Dt(t),this._activeKeyModifiers)}_onCameraChange(){this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),this._updateManipulators()}_onPointerUp(t){if(t.pointerId===this._creatingPointerId&&null!=this.analysisViewData.plane){const e=Dt(t);return this.shiftManipulator.events.emit("drag",{action:"end",start:e,screenPoint:e}),S(this.analysisViewData.plane,this._startPlane),this.inputState=null,!0}return!1}_onClickPlacePlane(t){if("exclude"===this.layersMode)return!1;if(this._isPlacingSlicePlane){const i=Dt(t),a=k();if(this._pickPlane(i,!1,this._activeKeyModifiers,a)){if("pointer-drag"===t.type){const e=wt(this.view.state.camera,i,St);this.inputState=Tt(e,t.pointerId,a.origin,a)}return S(a,this._startPlane),this.analysis.shape=at(a,this.view,this.view.spatialReference,new e),!0}}return!1}_onClickExcludeLayer(t){return!("exclude"!==this.layersMode||!this.created)&&(this.view.hitTest(Dt(t)).then((t=>{if(t.results.length){const e=t.results[0],i="graphic"===e?.type&&e.graphic;if(i){const t=i.sourceLayer||i.layer;t&&this.analysis.excludedLayers.push(t)}}else t.ground.layer?this.analysis.excludedLayers.push(t.ground.layer):this.analysis.excludeGroundSurface=!0})),this.exitExcludeLayerMode(),!0)}_onKeyDown(t){return(t.key===Q||t.key===X)&&(this._activeKeyModifiers[t.key]=!0,null!=this._previewPlane&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onKeyUp(t){return!(t.key!==Q&&t.key!==X||!this._activeKeyModifiers[t.key])&&(delete this._activeKeyModifiers[t.key],null!=this._previewPlane&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onShiftGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=wt(this.view.state.camera,t.screenPoint,St);S(this.analysisViewData.plane,this._startPlane),this.inputState=Tt(e,null,this.shiftManipulator.renderLocation,this.analysisViewData.plane)}_createShiftDragPipeline(t){return ft(t,((t,e,i)=>{const a=this.inputState;if(null==a||"shift"!==a.type)return;const s=null!=this.analysisViewData.plane?S(this.analysisViewData.plane,k()):null;e.next(mt(this.view,a.shiftPlane)).next(this._shiftDragAdjustSensitivity(a)).next(this._shiftDragUpdatePlane(a)),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_shiftDragAdjustSensitivity(t){return e=>{if(null==this.analysisViewData.plane)return null;const i=.001,a=Math.min((1-Math.abs(P(x(this.analysisViewData.plane),e.ray.direction)/y(e.ray.direction)))/i,1),s=-H(this._startPlane.plane,e.renderEnd),n=-H(this._startPlane.plane,t.startPoint);return t.depth=t.depth*(1-a)+s*a-n,e}}_shiftDragUpdatePlane(t){return()=>{if(null==this.analysisViewData.plane)return;const e=m(z.get(),this._startPlane.origin),i=m(z.get(),x(this._startPlane));w(i,i,-t.depth),g(i,i,e);const a=j(i,this.analysisViewData.plane.basis1,this.analysisViewData.plane.basis2,k());this._updateBoundedPlane(a)}}_onRotateHeadingGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=st(this.analysisViewData.plane,this.view.renderCoordsHelper,nt.HEADING,C()),i=wt(this.view.state.camera,t.screenPoint,St),a=b();R(e,i,a)&&(S(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateHeadingDragPipeline(t){return ft(t,((t,e,i)=>{const a=this.inputState;if(null==a||"rotate"!==a.type)return;const s=null!=this.analysisViewData.plane?S(this.analysisViewData.plane,k()):null;e.next(mt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_onRotateTiltGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=st(this.analysisViewData.plane,this.view.renderCoordsHelper,nt.TILT,C()),i=wt(this.view.state.camera,t.screenPoint,St),a=b();R(e,i,a)&&(S(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateTiltDragPipeline(t){return ft(t,((t,e,i)=>{const a=this.inputState;if(null==a||"rotate"!==a.type)return;const s=null!=this.analysisViewData.plane?S(this.analysisViewData.plane,k()):null;e.next(mt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_rotateDragRenderPlaneToRotate(t){return e=>{if(null==this.analysisViewData.plane)return null;const i=O(t.rotatePlane),a=yt(t.startPoint,e.renderEnd,this.analysisViewData.plane.origin,i);return{...e,rotateAxis:i,rotateAngle:a}}}_rotateDragUpdatePlaneFromRotate(){return t=>{if(null==this.analysisViewData.plane)return;const e=d(G.get(),t.rotateAngle,t.rotateAxis);if(null==e)return;const i=f(z.get(),this._startPlane.basis1,e),a=f(z.get(),this._startPlane.basis2,e),s=j(this.analysisViewData.plane.origin,i,a,k());this._updateBoundedPlane(s)}}_onResizeGrab(t,e){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const i=wt(this.view.state.camera,t.screenPoint,St),a=z.get();R(this.analysisViewData.plane.plane,i,a)&&(S(this.analysisViewData.plane,this._startPlane),this.inputState={type:"resize",activeHandleIdx:e,startPoint:V(a)})}_createResizeDragPipeline(t){return ft(t,((t,e,i)=>{const a=this.inputState;if(null==a||"resize"!==a.type||null==this.analysisViewData.plane)return;const s=S(this.analysisViewData.plane,k());e.next(mt(this.view,this.analysisViewData.plane.plane)).next(this._resizeDragUpdatePlane(a)),i.next((()=>{this._updateBoundedPlane(s)}))}))}_resizeDragUpdatePlane(t){return e=>{if(null==this.analysisViewData.plane)return;const i=this._resizeHandles[t.activeHandleIdx],a=rt(i,t.startPoint,e.renderEnd,this.view.state.camera,this._startPlane,S(this.analysisViewData.plane));this._updateBoundedPlane(a)}}_updateBoundedPlane(t){const e=this.analysisViewData;if(null==e)throw new Error("valid internal object expected");e.plane=t}_updatePreviewPlane(t,e={}){let i=this._previewPlane;if(this._previewPlane=null,null==t)return this._removeFrameTask(),void this._updateManipulators();if(!this.analysisViewData.plane&&this.active){const a=null!=i?i:k();if(i=null!=i?S(i,kt):null,this._pickPlane(t,!0,e,a)){const t=Y;let e=!1;null!=i&&(e=P(O(i.plane),O(a.plane))<t||P(M(z.get(),i.basis1),M(z.get(),a.basis1))<t),e&&(this._previewPlaneOpacity=0),this._previewPlane=a}}null!=this._previewPlane&&null==this._frameTask&&0===this._previewPlaneOpacity?this._frameTask=o({update:({deltaTime:t})=>{this._previewPlaneOpacity=Math.min(this._previewPlaneOpacity+t/(1e3*$),1),this._updateManipulators(),1===this._previewPlaneOpacity&&this._removeFrameTask()}}):null==this._previewPlane&&null!=this._frameTask?this._removeFrameTask():null!=this._previewPlane&&this._updateManipulators()}_removeFrameTask(){this._frameTask=s(this._frameTask)}_pickMinResult(t){const e=p(t,L.get());return this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(e,this._intersector),this._intersector.results.min}_pickPlane(t,e,i,a){const s=this._pickMinResult(t),n=z.get();if(!s.getIntersectionPoint(n))return!1;const r=s.getTransformedNormal(z.get()),l=this.view.state.camera;P(r,l.viewForward)>0&&w(r,r,-1);const o=lt(n,l),h=(e?1:-1)*o*tt,p=w(z.get(),r,h);g(p,p,n);const u=this.analysis.tiltEnabled?ot.TILTED:ot.HORIZONTAL_OR_VERTICAL,c=i[Q]?ot.VERTICAL:i[X]?ot.HORIZONTAL:u;return ht(p,r,o,o,l,c,this.view.renderCoordsHelper,a),!0}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=s(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.shiftManipulator.state|=pt,this.rotateHeadingManipulator.state|=pt,this.rotateTiltManipulator.state|=pt,this._prevPointerMoveTimeout=this._clock.setTimeout((()=>{this.shiftManipulator.state&=~pt,this.rotateHeadingManipulator.state&=~pt,this.rotateTiltManipulator.state&=~pt}),this._pointerMoveTimerMs)}_updateManipulators(){if(Vt.disableEngineLayers)return;let t,e=!1;if(null!=this.analysisViewData.plane)t=this.analysisViewData.plane,e=!1;else{if(null==this._previewPlane)return this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.visible=!1,void(this._previewPlaneGridVisualElement.visible=!1);t=this._previewPlane,e=!0}const i=ut(t,G.get());e?(this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.attached=!0,this._previewPlaneGridVisualElement.attached=!0,this._previewPlaneOutlineVisualElement.visible=!0,this._previewPlaneGridVisualElement.visible=!0):(this.shiftManipulator.available=!0,this.rotateHeadingManipulator.available=!0,this.rotateTiltManipulator.available=this.analysis.tiltEnabled,this.resizeManipulators.forEach((t=>t.available=!0)),ct(this.shiftManipulator,i,t,this.view.state.camera),dt(this.rotateHeadingManipulator,i,t,this.view.renderCoordsHelper),_t(this.rotateTiltManipulator,i,t),this.resizeManipulators.forEach(((e,a)=>vt(e,this._resizeHandles[a],i,t))),this._previewPlaneOutlineVisualElement.visible=!1,this._previewPlaneGridVisualElement.visible=!1);const a=D(z.get(),y(t.basis1),y(t.basis2),1),s=_(G.get(),a),n=v(s,i,s);this._previewPlaneOutlineVisualElement.transform=n,this._previewPlaneGridVisualElement.transform=n,this._updateMaterials()}_updateMaterials(){const t=F(this.view.effectiveTheme);t[3]*=this._previewPlaneOpacity;const e=T(N);e[3]*=this._previewPlaneOpacity,this._previewPlaneOutlineVisualElement.color=t,this._previewPlaneGridVisualElement.backgroundColor=e,this._previewPlaneGridVisualElement.gridColor=E}_updateManipulatorsInteractive(t){if(!t.grabbing)return this.shiftManipulator.interactive=!0,this.rotateHeadingManipulator.interactive=!0,this.rotateTiltManipulator.interactive=!0,void this.resizeManipulators.forEach((t=>{t.interactive=!0}));this.shiftManipulator.interactive=this.shiftManipulator===t,this.rotateHeadingManipulator.interactive=this.rotateHeadingManipulator===t,this.rotateTiltManipulator.interactive=this.rotateTiltManipulator===t,this.resizeManipulators.forEach((e=>{e.interactive=e===t}))}testData(){return{plane:this.analysisViewData.plane,setPointerMoveTimerMs:t=>{this._pointerMoveTimerMs=t}}}};function Tt(t,e,i,a){const s=Pt(i,x(a),t.direction,C()),n=b();return R(s,t,n)?{type:"shift",creatingPointerId:e,hasBeenDragged:!1,shiftPlane:s,depth:0,startPoint:n}:null}function Et(t){return"mouse"!==t.pointerType||0===t.button}bt.disableEngineLayers=!1,t([u()],bt.prototype,"_clock",void 0),t([u({constructOnly:!0})],bt.prototype,"view",void 0),t([u()],bt.prototype,"analysisViewData",void 0),t([u({readOnly:!0})],bt.prototype,"state",null),t([u({readOnly:!0})],bt.prototype,"cursor",null),t([u()],bt.prototype,"analysis",null),t([u()],bt.prototype,"removeIncompleteOnCancel",void 0),t([u()],bt.prototype,"_layersMode",void 0),t([u()],bt.prototype,"layersMode",null),t([u({value:null})],bt.prototype,"inputState",null),t([u()],bt.prototype,"_isPlacingSlicePlane",null),t([u()],bt.prototype,"_creatingPointerId",null),bt=Vt=t([c("esri.views.3d.analysis.Slice.SliceTool")],bt);const kt=k(),St=I(),xt=bt;export{xt 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.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../geometry.js";import i from"../../../../analysis/SlicePlane.js";import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{rad2deg as e,deg2rad as n}from"../../../../core/mathUtils.js";import{castRenderScreenPointArray3 as o}from"../../../../core/screenUtils.js";import{rotateZ as r,fromZRotation as s,scale as a,multiply as c,rotateX as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{h as u,c as d,j as g,b as m,n as p,g as f,l as b,f as T,s as h,o as I,y as E}from"../../../../chunks/vec32.js";import{clone as A}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{tryProjectWithZConversion as j}from"../../../../geometry/projection.js";import{Axis as R}from"../../../../geometry/support/Axis.js";import{r as w,f as O,i as P,a as L,n as v,u as V}from"../../../../chunks/boundedPlane.js";import{fromVectorsAndPoint as C,fromPositionAndNormal as _}from"../../../../geometry/support/plane.js";import{create as M}from"../../../../geometry/support/ray.js";import{angleAroundAxis as S}from"../../../../geometry/support/vector.js";import{sv3d as y,sm4d as N}from"../../../../geometry/support/vectorStacks.js";import{getOutlineColor as H,planeColor as U,getGridColor as x}from"./settings.js";import{verticalDotThreshold as G,smallAngleDotThreshold as k,planeMinBasisScreenLen2 as X,initialPlaneHalfSizeViewProportion as D,shiftRestartOffsetDistance as Y,resizeHandleEdgePaddingFrac as Z,planeOutlineWidth as z}from"./sliceToolConfig.js";import{applyProjectionAndElevationAlignment as F}from"../support/projectionUtils.js";import{calculateTranslateRotateFromBases as W}from"../../interactive/manipulatorUtils.js";import{LineVisualElement as B}from"../../interactive/visualElements/LineVisualElement.js";import{SlicePlaneVisualElement as $}from"../../interactive/visualElements/SlicePlaneVisualElement.js";import{RenderCoordsHelper as q}from"../../support/RenderCoordsHelper.js";import{fromRender as J}from"../../support/geometryUtils/ray.js";import{RenderOccludedFlag as K}from"../../webgl-engine/lib/Material.js";import{ManipulatorStateCustomFlags as Q}from"../../../interactive/interfaces.js";import ii from"../../../../geometry/Point.js";import ti from"../../../../geometry/Extent.js";function ei(i,t,e,n,o,r,s,a){return ni(t,s.worldUpAtPosition(i,y.get()),o,r,a.basis1,a.basis2),u(a.basis1,a.basis1,e),u(a.basis2,a.basis2,n),d(a.origin,i),C(a.basis2,a.basis1,a.origin,a.plane),a}function ni(i,t,e,n,o,r){const s=g(i,t),a=y.get(),c=y.get();switch(n===Mi.HORIZONTAL_OR_VERTICAL?Math.abs(s)>G?Mi.HORIZONTAL:Mi.VERTICAL:n){case Mi.VERTICAL:{const n=Math.abs(s)<=k?i:e.viewUp;m(a,n,t),d(c,t);break}case Mi.HORIZONTAL:m(a,e.viewUp,t),m(c,t,a);break;case Mi.TILTED:{const n=Math.abs(s)<=k?t:e.viewUp;m(a,n,i),m(c,i,a);break}}const l=m(y.get(),a,c);g(l,e.viewForward)>0&&u(c,c,-1),p(o,a),p(r,c)}function oi(i,t,e){const n=t.worldUpAtPosition(i.origin,y.get()),o=i.basis1,r=Oi(i,n),s=Math.round(r/Ni)*Ni;return w(i,s-r,o,e)}function ri(i,t,e,n,o,r){const s=d(y.get(),o.origin);f(s,s,u(y.get(),o.basis1,i.direction[0]<0?1:-1)),f(s,s,u(y.get(),o.basis2,i.direction[1]<0?1:-1));const a=b(o.basis1),c=b(o.basis2),l=T(y.get(),e,s),m=T(y.get(),t,s);let p=0,h=0;if(Ei(i)){const t=Ii(o),e=Ii(r);p=a-.5*i.direction[0]*g(o.basis1,m)/a,h=c-.5*i.direction[1]*g(o.basis2,m)/c;const n=e/t;p*=n,h*=n}const I=p+.5*i.direction[0]*g(o.basis1,l)/a,E=h+.5*i.direction[1]*g(o.basis2,l)/c,A=u(y.get(),o.basis1,I/a),j=u(y.get(),o.basis2,E/c);(I<=0||Ti(r.origin,A,n)<=X)&&d(A,r.basis1),(E<=0||Ti(r.origin,j,n)<=X)&&d(j,r.basis2);const R=d(y.get(),s);return f(R,R,u(y.get(),A,i.direction[0]<0?-1:1)),f(R,R,u(y.get(),j,i.direction[1]<0?-1:1)),O(R,A,j,r)}function si(i,t){return D*Math.min(t.width,t.height)*t.computeRenderPixelSizeAt(i)}function ai(i,t,e,n){const o=m(y.get(),t,e);return m(o,o,t),_(i,o,n)}function ci(i,t){return W(i.basis1,i.basis2,i.origin,t)}function li(i,t,e,n){const o=t.worldUpAtPosition(i.origin,y.get()),r=y.get();switch(e){case _i.HEADING:d(r,o);break;case _i.TILT:d(r,i.basis1)}return _(i.origin,r,n)}function ui(i,t,e,n){const s=bi(e,fi.NEGATIVE_X),a=N.get();r(a,t,s.edge*Math.PI/2);const c=p(y.get(),s.basis);let l=u(y.get(),c,s.direction*n.computeScreenPixelSizeAt(s.position)*Y);f(l,l,s.position);const d=n.projectToRenderScreen(l,o(y.get())),g=di(n,d);J(n,d,yi),p(yi.direction,yi.direction);const m=y.get();!g&&P(e,yi,m)&&(l=m),a[12]=0,a[13]=0,a[14]=0,i.modelTransform=a,i.renderLocation=A(l),g?i.state|=Si:i.state&=~Si}function di(i,t){const[e,n,o,r]=i.viewport,s=Math.min(o,r)/16;let a=!0;return t[0]<e+s?(t[0]=e+s,a=!1):t[0]>e+o-s&&(t[0]=e+o-s,a=!1),t[1]<n+s?(t[1]=n+s,a=!1):t[1]>n+r-s&&(t[1]=n+r-s,a=!1),a}function gi(i,t,e,n){const o=b(n.basis1),r=b(n.basis2),l=hi(n),d=Ii(n),g=h(y.get(),0,0,0);f(g,u(y.get(),n.basis1,t.direction[0]),u(y.get(),n.basis2,t.direction[1])),f(g,n.origin,g);let m=0,p=1;if(Ei(t))1===t.direction[0]&&-1===t.direction[1]?m=Ni:1===t.direction[0]&&1===t.direction[1]?m=Math.PI:-1===t.direction[0]&&1===t.direction[1]&&(m=3*Math.PI/2),p=d;else{const i=0!==t.direction[0]?1:2;m=1===i?Ni:0,p=(1===i?r:o)-l}const T=s(N.get(),m);a(T,T,h(y.get(),p,p,p)),c(T,e,T),T[12]=0,T[13]=0,T[14]=0,i.modelTransform=T,i.renderLocation=g}function mi(i,t,e,n){const o=n.worldUpAtPosition(e.origin,y.get()),r=bi(e,fi.POSITIVE_X),a=s(N.get(),r.edge*Math.PI/2);l(a,a,-Oi(e,o)),c(a,t,a),a[12]=0,a[13]=0,a[14]=0,i.modelTransform=a,i.renderLocation=r.position}function pi(i,t,e){const n=bi(e,fi.POSITIVE_Y),o=s(N.get(),n.edge*Math.PI/2);l(o,o,Ni),c(o,t,o),o[12]=0,o[13]=0,o[14]=0,i.modelTransform=o,i.renderLocation=n.position}var fi;function bi(i,t){switch(t){case fi.POSITIVE_X:return{basis:i.basis1,direction:1,position:f(y.get(),i.origin,i.basis1),edge:t};case fi.POSITIVE_Y:return{basis:i.basis2,direction:1,position:f(y.get(),i.origin,i.basis2),edge:t};case fi.NEGATIVE_X:return{basis:i.basis1,direction:-1,position:T(y.get(),i.origin,i.basis1),edge:t};case fi.NEGATIVE_Y:return{basis:i.basis2,direction:-1,position:T(y.get(),i.origin,i.basis2),edge:t}}}function Ti(i,t,e){const n=e.projectToRenderScreen(f(y.get(),i,t),o(y.get())),r=e.projectToRenderScreen(T(y.get(),i,t),o(y.get()));return I(T(n,n,r))}function hi(i){const t=b(i.basis1),e=b(i.basis2);return Z*Math.min(t,e)}function Ii(i){return hi(i)}function Ei(i){return 0!==i.direction[0]&&0!==i.direction[1]}function Ai(i){const t=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0],[-1,-1,0]];return new B({view:i,attached:!1,color:H(i.effectiveTheme),width:z,renderOccluded:K.OccludeAndTransparent,geometry:[t],isDecoration:!0})}function ji(i){return new $({view:i,attached:!1,backgroundColor:U,gridColor:x(i.effectiveTheme),gridWidth:4,renderOccluded:K.OccludeAndTransparent,isDecoration:!0})}function Ri(t,n,o,r=new i){if(null==t)return null;const{renderCoordsHelper:s}=n,a=s.fromRenderCoords(t.origin,new ii({spatialReference:n.spatialReference}));if(null==a)return null;const c=j(a,o);if(null==c)return null;r.position=c;const l=2*b(t.basis1),u=2*b(t.basis2),d=q.renderUnitScaleFactor(n.spatialReference,o);r.width=l*d,r.height=u*d;const g=s.worldUpAtPosition(t.origin,y.get());return r.tilt=e(Oi(t,g)),r.heading=s.headingAtPosition(t.origin,t.basis1)-90,r}function wi(i,t,e){if(null==i)return null;const n=i.origin,o=y.get(),r=y.get(),s=y.get(),a=y.get();let c,l,u,d,g,m;f(o,n,i.basis1),f(o,o,i.basis2),f(r,n,i.basis1),E(r,r,i.basis2),E(s,n,i.basis1),E(s,s,i.basis2),E(a,n,i.basis1),f(a,a,i.basis2);for(const p of[o,r,s,a]){const i=t.fromRenderCoords(p,p,e);if(null==i)return null;c=null==c?i[0]:Math.min(c,i[0]),l=null==l?i[0]:Math.max(l,i[0]),u=null==u?i[1]:Math.min(u,i[1]),d=null==d?i[1]:Math.max(d,i[1]),g=null==g?i[2]:Math.min(g,i[2]),m=null==m?i[2]:Math.max(m,i[2])}return new ti({xmin:c,xmax:l,ymin:u,ymax:d,zmin:g,zmax:m,spatialReference:e})}function Oi(i,t){return S(t,i.basis2,i.basis1)+Ni}function Pi(i,e,o,r,s,a,c=L()){return a.toRenderCoords(i,c.origin)?(a.worldBasisAtPosition(c.origin,R.X,c.basis1),a.worldBasisAtPosition(c.origin,R.Y,c.basis2),C(c.basis2,c.basis1,c.origin,c.plane),w(c,-n(e),v(c),c),w(c,n(o),c.basis1,c),u(c.basis1,c.basis1,r/2),u(c.basis2,c.basis2,s/2),V(c),c):(t.getLogger("esri.views.3d.analysis.Slice.sliceToolUtils").error(`Failed to project slice plane position, projection from ${i.spatialReference.wkid} is not supported`),null)}function Li(i,t){if(null==i?.position)return null;const e=F(i.position,t.spatialReference,t.elevationProvider);if(null==e)return null;const n=q.renderUnitScaleFactor(i.position.spatialReference,t.spatialReference),o=i.width*n,r=i.height*n;return{position:e,heading:i.heading,tilt:i.tilt,renderWidth:o,renderHeight:r}}function vi(i,t,e,n=L()){const o=Li(i,t);return null==o?null:Vi(o,t,e,n)}function Vi(i,t,e,n=L()){if(null==i)return null;const o=Pi(i.position,i.heading,i.tilt,i.renderWidth,i.renderHeight,t.renderCoordsHelper,n);return e.tiltEnabled||null==o||oi(o,t.renderCoordsHelper,o),o}!function(i){i[i.POSITIVE_X=0]="POSITIVE_X",i[i.POSITIVE_Y=1]="POSITIVE_Y",i[i.NEGATIVE_X=2]="NEGATIVE_X",i[i.NEGATIVE_Y=3]="NEGATIVE_Y"}(fi||(fi={}));const Ci=Q.Custom1;var _i,Mi;!function(i){i[i.HEADING=1]="HEADING",i[i.TILT=2]="TILT"}(_i||(_i={})),function(i){i[i.HORIZONTAL_OR_VERTICAL=0]="HORIZONTAL_OR_VERTICAL",i[i.HORIZONTAL=1]="HORIZONTAL",i[i.VERTICAL=2]="VERTICAL",i[i.TILTED=3]="TILTED"}(Mi||(Mi={}));const Si=Q.Custom2,yi=M(),Ni=Math.PI/2,Hi=Q.Custom1,Ui=Q.Custom2;function xi(i){return null!=("building-scene-3d"===i.type?i:null)}export{Ci as DidPointerMoveRecentlyFlag,Si as IsShiftEdgeOnScreenFlag,_i as RotationAxis,Mi as SliceOrientation,ci as calculateBoundedPlaneTranslateRotate,Ii as calculateDiagonalResizeHandleScale,si as calculatePlaneHalfSize,ji as createGridVisualElement,Ai as createOutlineVisualElement,ei as createPlane,li as createRotatePlane,ai as createShiftPlane,oi as forceHorizontalOrVertical,Ei as isDiagonalResizeHandle,xi as isIBuildingSceneLayerView3D,ni as normalToBases,wi as planeToExtent,Ri as planeToShape,Li as projectAndElevationAlignShape,Vi as projectedShapeToPlane,Hi as resizeNormal,Ui as resizeOutlineOnly,ri as resizePlane,vi as shapeToPlane,gi as updateResizeHandle,mi as updateRotateHeadingHandle,pi as updateRotateTiltHandle,ui as updateShiftRestartHandle};
|
|
5
|
+
import"../../../../geometry.js";import i from"../../../../analysis/SlicePlane.js";import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{rad2deg as e,deg2rad as n}from"../../../../core/mathUtils.js";import{castRenderScreenPointArray3 as o}from"../../../../core/screenUtils.js";import{rotateZ as r,fromZRotation as s,scale as a,multiply as c,rotateX as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{h as u,c as d,k as g,b as m,n as p,g as f,l as b,f as T,s as h,p as I,z as E}from"../../../../chunks/vec32.js";import{clone as A}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{tryProjectWithZConversion as j}from"../../../../geometry/projection.js";import{Axis as R}from"../../../../geometry/support/Axis.js";import{r as w,f as O,i as P,a as L,n as v,u as V}from"../../../../chunks/boundedPlane.js";import{fromVectorsAndPoint as C,fromPositionAndNormal as _}from"../../../../geometry/support/plane.js";import{create as M}from"../../../../geometry/support/ray.js";import{angleAroundAxis as S}from"../../../../geometry/support/vector.js";import{sv3d as y,sm4d as N}from"../../../../geometry/support/vectorStacks.js";import{getOutlineColor as H,planeColor as U,getGridColor as x}from"./settings.js";import{verticalDotThreshold as k,smallAngleDotThreshold as G,planeMinBasisScreenLen2 as X,initialPlaneHalfSizeViewProportion as D,shiftRestartOffsetDistance as Y,resizeHandleEdgePaddingFrac as Z,planeOutlineWidth as z}from"./sliceToolConfig.js";import{applyProjectionAndElevationAlignment as F}from"../support/projectionUtils.js";import{calculateTranslateRotateFromBases as W}from"../../interactive/manipulatorUtils.js";import{LineVisualElement as B}from"../../interactive/visualElements/LineVisualElement.js";import{SlicePlaneVisualElement as $}from"../../interactive/visualElements/SlicePlaneVisualElement.js";import{RenderCoordsHelper as q}from"../../support/RenderCoordsHelper.js";import{fromRender as J}from"../../support/geometryUtils/ray.js";import{RenderOccludedFlag as K}from"../../webgl-engine/lib/Material.js";import{ManipulatorStateCustomFlags as Q}from"../../../interactive/interfaces.js";import ii from"../../../../geometry/Point.js";import ti from"../../../../geometry/Extent.js";function ei(i,t,e,n,o,r,s,a){return ni(t,s.worldUpAtPosition(i,y.get()),o,r,a.basis1,a.basis2),u(a.basis1,a.basis1,e),u(a.basis2,a.basis2,n),d(a.origin,i),C(a.basis2,a.basis1,a.origin,a.plane),a}function ni(i,t,e,n,o,r){const s=g(i,t),a=y.get(),c=y.get();switch(n===Mi.HORIZONTAL_OR_VERTICAL?Math.abs(s)>k?Mi.HORIZONTAL:Mi.VERTICAL:n){case Mi.VERTICAL:{const n=Math.abs(s)<=G?i:e.viewUp;m(a,n,t),d(c,t);break}case Mi.HORIZONTAL:m(a,e.viewUp,t),m(c,t,a);break;case Mi.TILTED:{const n=Math.abs(s)<=G?t:e.viewUp;m(a,n,i),m(c,i,a);break}}const l=m(y.get(),a,c);g(l,e.viewForward)>0&&u(c,c,-1),p(o,a),p(r,c)}function oi(i,t,e){const n=t.worldUpAtPosition(i.origin,y.get()),o=i.basis1,r=Oi(i,n),s=Math.round(r/Ni)*Ni;return w(i,s-r,o,e)}function ri(i,t,e,n,o,r){const s=d(y.get(),o.origin);f(s,s,u(y.get(),o.basis1,i.direction[0]<0?1:-1)),f(s,s,u(y.get(),o.basis2,i.direction[1]<0?1:-1));const a=b(o.basis1),c=b(o.basis2),l=T(y.get(),e,s),m=T(y.get(),t,s);let p=0,h=0;if(Ei(i)){const t=Ii(o),e=Ii(r);p=a-.5*i.direction[0]*g(o.basis1,m)/a,h=c-.5*i.direction[1]*g(o.basis2,m)/c;const n=e/t;p*=n,h*=n}const I=p+.5*i.direction[0]*g(o.basis1,l)/a,E=h+.5*i.direction[1]*g(o.basis2,l)/c,A=u(y.get(),o.basis1,I/a),j=u(y.get(),o.basis2,E/c);(I<=0||Ti(r.origin,A,n)<=X)&&d(A,r.basis1),(E<=0||Ti(r.origin,j,n)<=X)&&d(j,r.basis2);const R=d(y.get(),s);return f(R,R,u(y.get(),A,i.direction[0]<0?-1:1)),f(R,R,u(y.get(),j,i.direction[1]<0?-1:1)),O(R,A,j,r)}function si(i,t){return D*Math.min(t.width,t.height)*t.computeRenderPixelSizeAt(i)}function ai(i,t,e,n){const o=m(y.get(),t,e);return m(o,o,t),_(i,o,n)}function ci(i,t){return W(i.basis1,i.basis2,i.origin,t)}function li(i,t,e,n){const o=t.worldUpAtPosition(i.origin,y.get()),r=y.get();switch(e){case _i.HEADING:d(r,o);break;case _i.TILT:d(r,i.basis1)}return _(i.origin,r,n)}function ui(i,t,e,n){const s=bi(e,fi.NEGATIVE_X),a=N.get();r(a,t,s.edge*Math.PI/2);const c=p(y.get(),s.basis);let l=u(y.get(),c,s.direction*n.computeScreenPixelSizeAt(s.position)*Y);f(l,l,s.position);const d=n.projectToRenderScreen(l,o(y.get())),g=di(n,d);J(n,d,yi),p(yi.direction,yi.direction);const m=y.get();!g&&P(e,yi,m)&&(l=m),a[12]=0,a[13]=0,a[14]=0,i.modelTransform=a,i.renderLocation=A(l),g?i.state|=Si:i.state&=~Si}function di(i,t){const[e,n,o,r]=i.viewport,s=Math.min(o,r)/16;let a=!0;return t[0]<e+s?(t[0]=e+s,a=!1):t[0]>e+o-s&&(t[0]=e+o-s,a=!1),t[1]<n+s?(t[1]=n+s,a=!1):t[1]>n+r-s&&(t[1]=n+r-s,a=!1),a}function gi(i,t,e,n){const o=b(n.basis1),r=b(n.basis2),l=hi(n),d=Ii(n),g=h(y.get(),0,0,0);f(g,u(y.get(),n.basis1,t.direction[0]),u(y.get(),n.basis2,t.direction[1])),f(g,n.origin,g);let m=0,p=1;if(Ei(t))1===t.direction[0]&&-1===t.direction[1]?m=Ni:1===t.direction[0]&&1===t.direction[1]?m=Math.PI:-1===t.direction[0]&&1===t.direction[1]&&(m=3*Math.PI/2),p=d;else{const i=0!==t.direction[0]?1:2;m=1===i?Ni:0,p=(1===i?r:o)-l}const T=s(N.get(),m);a(T,T,h(y.get(),p,p,p)),c(T,e,T),T[12]=0,T[13]=0,T[14]=0,i.modelTransform=T,i.renderLocation=g}function mi(i,t,e,n){const o=n.worldUpAtPosition(e.origin,y.get()),r=bi(e,fi.POSITIVE_X),a=s(N.get(),r.edge*Math.PI/2);l(a,a,-Oi(e,o)),c(a,t,a),a[12]=0,a[13]=0,a[14]=0,i.modelTransform=a,i.renderLocation=r.position}function pi(i,t,e){const n=bi(e,fi.POSITIVE_Y),o=s(N.get(),n.edge*Math.PI/2);l(o,o,Ni),c(o,t,o),o[12]=0,o[13]=0,o[14]=0,i.modelTransform=o,i.renderLocation=n.position}var fi;function bi(i,t){switch(t){case fi.POSITIVE_X:return{basis:i.basis1,direction:1,position:f(y.get(),i.origin,i.basis1),edge:t};case fi.POSITIVE_Y:return{basis:i.basis2,direction:1,position:f(y.get(),i.origin,i.basis2),edge:t};case fi.NEGATIVE_X:return{basis:i.basis1,direction:-1,position:T(y.get(),i.origin,i.basis1),edge:t};case fi.NEGATIVE_Y:return{basis:i.basis2,direction:-1,position:T(y.get(),i.origin,i.basis2),edge:t}}}function Ti(i,t,e){const n=e.projectToRenderScreen(f(y.get(),i,t),o(y.get())),r=e.projectToRenderScreen(T(y.get(),i,t),o(y.get()));return I(T(n,n,r))}function hi(i){const t=b(i.basis1),e=b(i.basis2);return Z*Math.min(t,e)}function Ii(i){return hi(i)}function Ei(i){return 0!==i.direction[0]&&0!==i.direction[1]}function Ai(i){const t=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0],[-1,-1,0]];return new B({view:i,attached:!1,color:H(i.effectiveTheme),width:z,renderOccluded:K.OccludeAndTransparent,geometry:[t],isDecoration:!0})}function ji(i){return new $({view:i,attached:!1,backgroundColor:U,gridColor:x(i.effectiveTheme),gridWidth:4,renderOccluded:K.OccludeAndTransparent,isDecoration:!0})}function Ri(t,n,o,r=new i){if(null==t)return null;const{renderCoordsHelper:s}=n,a=s.fromRenderCoords(t.origin,new ii({spatialReference:n.spatialReference}));if(null==a)return null;const c=j(a,o);if(null==c)return null;r.position=c;const l=2*b(t.basis1),u=2*b(t.basis2),d=q.renderUnitScaleFactor(n.spatialReference,o);r.width=l*d,r.height=u*d;const g=s.worldUpAtPosition(t.origin,y.get());return r.tilt=e(Oi(t,g)),r.heading=s.headingAtPosition(t.origin,t.basis1)-90,r}function wi(i,t,e){if(null==i)return null;const n=i.origin,o=y.get(),r=y.get(),s=y.get(),a=y.get();let c,l,u,d,g,m;f(o,n,i.basis1),f(o,o,i.basis2),f(r,n,i.basis1),E(r,r,i.basis2),E(s,n,i.basis1),E(s,s,i.basis2),E(a,n,i.basis1),f(a,a,i.basis2);for(const p of[o,r,s,a]){const i=t.fromRenderCoords(p,p,e);if(null==i)return null;c=null==c?i[0]:Math.min(c,i[0]),l=null==l?i[0]:Math.max(l,i[0]),u=null==u?i[1]:Math.min(u,i[1]),d=null==d?i[1]:Math.max(d,i[1]),g=null==g?i[2]:Math.min(g,i[2]),m=null==m?i[2]:Math.max(m,i[2])}return new ti({xmin:c,xmax:l,ymin:u,ymax:d,zmin:g,zmax:m,spatialReference:e})}function Oi(i,t){return S(t,i.basis2,i.basis1)+Ni}function Pi(i,e,o,r,s,a,c=L()){return a.toRenderCoords(i,c.origin)?(a.worldBasisAtPosition(c.origin,R.X,c.basis1),a.worldBasisAtPosition(c.origin,R.Y,c.basis2),C(c.basis2,c.basis1,c.origin,c.plane),w(c,-n(e),v(c),c),w(c,n(o),c.basis1,c),u(c.basis1,c.basis1,r/2),u(c.basis2,c.basis2,s/2),V(c),c):(t.getLogger("esri.views.3d.analysis.Slice.sliceToolUtils").error(`Failed to project slice plane position, projection from ${i.spatialReference.wkid} is not supported`),null)}function Li(i,t){if(null==i?.position)return null;const e=F(i.position,t.spatialReference,t.elevationProvider);if(null==e)return null;const n=q.renderUnitScaleFactor(i.position.spatialReference,t.spatialReference),o=i.width*n,r=i.height*n;return{position:e,heading:i.heading,tilt:i.tilt,renderWidth:o,renderHeight:r}}function vi(i,t,e,n=L()){const o=Li(i,t);return null==o?null:Vi(o,t,e,n)}function Vi(i,t,e,n=L()){if(null==i)return null;const o=Pi(i.position,i.heading,i.tilt,i.renderWidth,i.renderHeight,t.renderCoordsHelper,n);return e.tiltEnabled||null==o||oi(o,t.renderCoordsHelper,o),o}!function(i){i[i.POSITIVE_X=0]="POSITIVE_X",i[i.POSITIVE_Y=1]="POSITIVE_Y",i[i.NEGATIVE_X=2]="NEGATIVE_X",i[i.NEGATIVE_Y=3]="NEGATIVE_Y"}(fi||(fi={}));const Ci=Q.Custom1;var _i,Mi;!function(i){i[i.HEADING=1]="HEADING",i[i.TILT=2]="TILT"}(_i||(_i={})),function(i){i[i.HORIZONTAL_OR_VERTICAL=0]="HORIZONTAL_OR_VERTICAL",i[i.HORIZONTAL=1]="HORIZONTAL",i[i.VERTICAL=2]="VERTICAL",i[i.TILTED=3]="TILTED"}(Mi||(Mi={}));const Si=Q.Custom2,yi=M(),Ni=Math.PI/2,Hi=Q.Custom1,Ui=Q.Custom2;function xi(i){return null!=("building-scene-3d"===i.type?i:null)}export{Ci as DidPointerMoveRecentlyFlag,Si as IsShiftEdgeOnScreenFlag,_i as RotationAxis,Mi as SliceOrientation,ci as calculateBoundedPlaneTranslateRotate,Ii as calculateDiagonalResizeHandleScale,si as calculatePlaneHalfSize,ji as createGridVisualElement,Ai as createOutlineVisualElement,ei as createPlane,li as createRotatePlane,ai as createShiftPlane,oi as forceHorizontalOrVertical,Ei as isDiagonalResizeHandle,xi as isIBuildingSceneLayerView3D,ni as normalToBases,wi as planeToExtent,Ri as planeToShape,Li as projectAndElevationAlignShape,Vi as projectedShapeToPlane,Hi as resizeNormal,Ui as resizeOutlineOnly,ri as resizePlane,vi as shapeToPlane,gi as updateResizeHandle,mi as updateRotateHeadingHandle,pi as updateRotateTiltHandle,ui as updateShiftRestartHandle};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{s as t,g as e,h as r,a as o,
|
|
5
|
+
import{s as t,g as e,h as r,a as o,k as n,q as i,c as s,n as f,b as m}from"../../../../chunks/vec32.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{geodesicArea as c}from"../../../../geometry/geometryEngine.js";import u from"../../../../geometry/Polygon.js";import p from"../../../../geometry/SpatialReference.js";import{projectPointToVector as l}from"../../../../geometry/projection/projectPointToVector.js";import{projectPointToWGS84ComparableLonLat as g}from"../../../../geometry/projection/projectPointToWGS84ComparableLonLat.js";import{projectVectorToWGS84ComparableLonLat as h}from"../../../../geometry/projection/projectVectorToWGS84ComparableLonLat.js";import{inverseGeodeticSolver as j,InverseGeodeticSolverResult as y}from"../../../../geometry/support/geodesicUtils.js";import{g as b}from"../../../../chunks/sphere.js";import{planeFromPoints as P}from"../../support/mathUtils.js";function S(n,i){const s=b(i);t(s,0,0,0);for(let t=0;t<n.length;++t)e(s,s,n[t]);r(s,s,1/n.length);let f=0;for(let t=0;t<n.length;++t)f=Math.max(f,o(s,n[t]));i[3]=Math.sqrt(f)}function w(t,e){if(t.length<3)throw new Error("need at least 3 points to fit a plane");P(t[0],t[1],t[2],e)}function G(t,e){return n(t,e)+t[3]}function W(t,e,r){return l(t,x,r)&&l(e,M,r)?i(x,M):0}function d(t,e){if(!g(t,x)||!g(e,M))return 0;const r=new y;return j(r,[x[0],x[1]],[M[0],M[1]],p.WGS84),r.distance}function L(t,e,r){const o=new y;return j(o,[t[0],t[1]],[e[0],e[1]],r??p.WGS84),o.distance}function T(t,e,r,o){const n=C;return h(t,o,x)&&h(e,o,M)&&h(r,o,v)?(n.setPoint(0,0,x),n.setPoint(0,1,M),n.setPoint(0,2,v),Math.abs(c(n,"square-meters"))):0}function k(r,o=null,i=!0){const a=1e-6,c=(t,e)=>{if(0===e[0]&&0===e[1]&&0===e[2])return!1;for(let r=0;r<t.length;++r)if(n(e,t[r])<-a)return!1;return!0};if(0===r.length)return!1;if(1===r.length)return o&&s(o,r[0]),!0;t(E,0,0,0);for(let t=0;t<r.length;++t)e(E,E,r[t]);if(f(E,E),c(r,E))return o&&s(o,E),!0;if(!i)return!1;for(let t=0;t<r.length;++t)for(let e=0;e<r.length;++e)if(t!==e&&(m(E,r[t],r[e]),f(E,E),c(r,E)))return o&&s(o,E),!0;return!1}function q(t){return"mouse"!==t.pointerType||0===t.button}const x=a(),M=a(),v=a(),C=new u({rings:[[x,M,v]],spatialReference:p.WGS84}),E=a();export{w as bestFitPlane,S as boundingSphere,k as fitHemisphere,q as isPrimaryPointerAction,G as planePointDistance,W as segmentLengthEuclidean,d as segmentLengthGeodesic,L as segmentLengthGeodesicVector,T as triangleAreaGeodesic};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{lerp as t}from"../../../../core/mathUtils.js";import{transpose as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{l as s,
|
|
5
|
+
import{lerp as t}from"../../../../core/mathUtils.js";import{transpose as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{l as s,q as o,m as a,c as h,f as n,t as c,h as r,b as m,k as p,g as l,n as d}from"../../../../chunks/vec32.js";import{create as M,clone as y,UNIT_Z as g,UNIT_Y as w,UNIT_X as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as f}from"../../../ViewingMode.js";import{angle as P,slerp as A}from"../../support/mathUtils.js";class _{constructor(t){this.viewingMode=t,this.center=M(),this.pitch=0,this.yaw=0,this.distance=0,this.direction=y(F),this.fov=55,this.size=1}pixelsPerPanAtZoom(t){return this.size/2/(this._zoomToPanScale*t)}zoomAtPixelsPerPan(t){return this.size/2/(this._zoomToPanScale*t)}pixelsPerRotateAtZoom(){const t=Math.max(Math.cos(Math.abs(this.pitch)),.5);return this.size/2/t}compareTo(t,i){if(i||(i={pan:0,rotate:0,sourceZoom:0,targetZoom:0}),this.viewingMode===f.Global){const e=(s(this.center)+s(t.center))/2;i.pan=P(this.center,t.center)*e}else i.pan=o(this.center,t.center);let e=Math.abs(t.yaw-this.yaw);e>=Math.PI&&(e=2*Math.PI-e);const a=Math.abs(t.pitch-this.pitch);return i.rotate=Math.max(e,a),i.sourceZoom=this.distance,i.targetZoom=t.distance,i}interpolate(i,e,s){this.viewingMode===f.Global?A(i.center,e.center,s.pan,this.center):a(this.center,i.center,e.center,s.pan),this.distance=isFinite(e.distance)?t(i.distance,e.distance,s.zoom):i.distance,this.pitch=t(i.pitch,e.pitch,s.rotate);let o=i.yaw;const h=e.yaw;Math.abs(h-o)>=Math.PI&&(o+=2*(o<h?1:-1)*Math.PI),this.yaw=t(o,h,s.rotate)}copyFrom(t){h(this.center,t.center),this.pitch=t.pitch,this.yaw=t.yaw,this.distance=t.distance,h(this.direction,t.direction),this.size=t.size,this.copyFromCommon(t),this.viewingMode=t.viewingMode}copyFromRenderCamera(t){const i=this._lookAtOrientation(t.center,Z);h(this.center,t.center),n(j,t.center,t.eye),c(j,j,i),c(k,t.up,i),this.distance=s(j),0!==this.distance&&(j[0]/=this.distance,j[1]/=this.distance,j[2]/=this.distance),this.pitch=this._eyeUpToPitch(j),this.yaw=x(j,k),this.size=Math.sqrt(t.width*t.width+t.height*t.height),this.copyFromCommon(t)}copyFromCommon(t){this.fov=t.fov,this._zoomToPanScale=Math.atan(.5*this.fov)}copyToRenderCamera(t){const e=this._lookAtOrientation(this.center,Z);i(e,e),this._axisAngleVec3(V,this.pitch-Math.PI/2,F,j),this._axisAngleVec3(T,this.yaw,j,j),this._axisAngleVec3(V,this.pitch-Math.PI/2,T,k),this._axisAngleVec3(T,this.yaw,k,k),r(j,j,this.distance),c(j,j,e),c(k,k,e),t.center=this.center,t.eye=n(j,this.center,j),t.up=k}_axisAngleVec3(t,i,e,s){const o=Math.cos(i),a=Math.sin(i);return r(v,e,o),m(z,t,e),r(z,z,a),r(b,t,(1-o)*p(t,e)),l(s,l(s,v,z),b)}_lookAtOrientation(t,i=e()){return this._upAtLookAt(t,b),m(v,this.direction,b),d(v,v),0===v[0]&&0===v[1]&&0===v[2]&&h(v,V),m(z,b,v),d(z,z),i[0]=v[0],i[1]=z[0],i[2]=b[0],i[3]=v[1],i[4]=z[1],i[5]=b[1],i[6]=v[2],i[7]=z[2],i[8]=b[2],i}_upAtLookAt(t,i){return this.viewingMode===f.Local?h(i,T):d(i,t)}_eyeUpToPitch(t){return Math.PI-P(T,t)}}function x(t,i){const e=I;return Math.abs(i[2])<.5?(h(e,i),t[2]>0&&r(e,e,-1)):h(e,t),m(z,e,T),d(z,z),P(V,z,T)}const v=M(),z=M(),b=M(),j=M(),k=M(),I=M(),T=g,F=w,V=u,Z=e();export{_ as Camera};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{c as n,h as a,
|
|
5
|
+
import{c as n,h as a,k as m}from"../../../../chunks/vec32.js";import{ConstraintOptions as t}from"./ConstraintOptions.js";import{ConstraintTypes as i}from"./ConstraintTypes.js";function o(n,a){return 0!=(n&a)}function r(n,a,m,t,i,o){0!==n&&(m?(o.min=Math.min(o.min,a),o.max=Math.max(o.max,a)):null!=t?(o.min-=Math.max(0,(a-o.min)*(1-t)),o.max+=Math.max(0,(a-o.max)*(1-t))):i&&(o.min-=Math.max(0,a-o.min-i),o.max+=Math.max(0,a-o.max-i)))}const s=new t(i.NONE);function x(t,i,o,r){return i=i||t.viewForward,n(r,i),a(r,r,Math.sign(m(i,o))),r}export{r as adjustRangeForInteraction,s as defaultConstraintOptions,o as hasConstraintType,x as interactionDirectionTowardsConstraintMinimization};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{c as e,f as r,g as n,
|
|
5
|
+
import{c as e,f as r,g as n,q as t,E as o}from"../../../../chunks/vec32.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{wrap as c}from"../../../../geometry/support/ray.js";import{h as s,b as a}from"../../../../chunks/sphere.js";import{defaultConstraintOptions as f,interactionDirectionTowardsConstraintMinimization as m,adjustRangeForInteraction as u}from"./common.js";import{InteractionType as p}from"./InteractionType.js";function d(e,r,n=f){if(!e.state.isLocal)return 0;const t=e.state.constraints.distance;if(!e.pointsOfInterest.surfaceOrigin.renderLocation||t===1/0)return 0;x.min=0,x.max=t,l(e,n,x);const o=O(e,r),i=x.max-o;return i>=-1e-6?0:i}function y(t,o,i=f){const u=d(t,o,i);if(0===u)return!1;const p=t.pointsOfInterest.surfaceOrigin;if(!p.renderLocation)return!1;const y=O(t,o)+u,l=e(L,o.eye),x=m(o,i.interactionDirection,g(o,p.renderLocation,h),I);if(!s(a(p.renderLocation,y),c(o.eye,x),C))return!1;o.eye=C;const N=r(j,o.eye,l);o.center=n(C,o.center,N);const b=t.renderCoordsHelper.getAltitude(o.center),k=t.renderCoordsHelper.intersectInfiniteManifold(o.ray,b,C);return null!=k&&(o.center=k),!0}function l(e,r,n){const t=r.interactionType;if(t===p.NONE)return;const{min:o,max:i}=n,{interactionStartCamera:c,interactionFactor:s}=r;if(!c)return;const a=t===p.ZOOM||t===p.PAN,f=d(e,c),m=0===f?0:O(e,c);n.min=o,n.max=i;u(f,m,a,s,.05*m,n)}function O(e,r){const n=e.pointsOfInterest.surfaceOrigin;return n.renderLocation?t(r.eye,n.renderLocation):0}function g(e,r,n){return o(n,e.eye,r)}const x={min:0,max:0},L=i(),j=i(),I=i(),h=i(),C=i();export{y as applyDistanceConstraint,d as getDistanceConstraintError};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{neverReached as e}from"../../../../core/compilerUtils.js";import{clamp as t,acosClamped as r,asinClamped as n,deg2rad as i}from"../../../../core/mathUtils.js";import{fromRotation 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{f as o,e as c,h as u,g as l,
|
|
5
|
+
import{neverReached as e}from"../../../../core/compilerUtils.js";import{clamp as t,acosClamped as r,asinClamped as n,deg2rad as i}from"../../../../core/mathUtils.js";import{fromRotation 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{f as o,e as c,h as u,g as l,q as m,k as f,n as d,l as p,p as y}from"../../../../chunks/vec32.js";import{create as M}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as h}from"../../../../geometry/ellipsoidUtils.js";import{j as C,k as T,t as I}from"../../../../chunks/sphere.js";import{hasConstraintType as O,defaultConstraintOptions as A,adjustRangeForInteraction as D}from"./common.js";import{ConstraintTypes as S}from"./ConstraintTypes.js";import{InteractionType as x}from"./InteractionType.js";import{TiltMode as R}from"./TiltMode.js";import{viewAngle as j}from"../../state/utils/viewUtils.js";function w(t,r,n,i=!0){V.eyeCenterDistance=0,V.requiresTwoSteps=!1;const a=U(t,r,n,A,V);if(0===a)return!1;switch(s(_,-a,r.viewRight),n.tiltMode){case R.LOOK_AROUND:c(K,r.viewForward,_),u(K,K,V.eyeCenterDistance),r.center=l(z,r.eye,K);break;case R.TUMBLE:o(K,r.center,r.eye),c(K,K,_),r.eye=o(z,r.center,K);break;default:e(n.tiltMode)}return r.up=c(z,r.up,_),!V.requiresTwoSteps||!i||w(t,r,n,!1)}function U(e,t,r,n=A,i){if(!e.state.constraints.tilt)return 0;const s=t.distance,a=e.state.constraints.tilt(s,J);return N(e,r,a),n.interactionType===x.TUMBLE&&O(n.selection,S.ALTITUDE)&&B(e,n.interactionStartCamera,a),r.tiltMode===R.LOOK_AROUND||n.tiltMode===R.LOOK_AROUND?L(e,t,a,i):P(e,t,a)}function P(e,r,n){const i=j(e.renderCoordsHelper,r.center,r.eye),s=i-t(i,n.min,n.max);return v(s)?s:0}function L(e,t,r,n){switch(n&&(n.requiresTwoSteps=!1),e.viewingMode){case"global":return q(e,t,r,n);case"local":return g(e,t,r,n)}}function g(e,r,n,i){const s=j(e.renderCoordsHelper,r.center,r.eye),a=t(s,n.min,n.max),o=s-a;if(!v(o))return 0;if(i){const t=e.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,n=e.renderCoordsHelper.getAltitude(r.eye)-t,s=Math.cos(a);Math.abs(s)>1e-4?i.eyeCenterDistance=n/s:i.eyeCenterDistance=r.distance}return o}function q(e,r,n,i){const s=b(e,r,Q),a=t(s.tiltAtCenter,n.min,n.max);if(!v(s.tiltAtCenter-a))return 0;let o,c;return s.centerIsOnSurface?(o=H(s),c=E(s,o)):(o=s.constraints.clampTilt(s.eyeCenterDistance,s.tiltAtCenter),i&&o<Math.PI/2&&(i.requiresTwoSteps=!0,o=Math.PI/2-1e-5),c=F(s,o)),i&&(i.eyeCenterDistance=k(s,o)),c}function b(e,t,n){const i=e.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,s=i+h(e.spatialReference).radius,a=e.renderCoordsHelper.intersectManifold(t.ray,i,z);return n.eyeCenterDistance=t.distance,n.centerIsOnSurface=!1,null!=a?(n.eyeCenterDistance=m(t.eye,a),n.tiltAtCenter=j(e.renderCoordsHelper,a,t.eye),n.centerIsOnSurface=!0):e.state.isLocal?n.tiltAtCenter=j(e.renderCoordsHelper,t.center,t.eye):(C(T(I,s),t.ray,z),n.eyeCenterDistance=m(t.eye,z),n.tiltAtCenter=r(-f(t.viewForward,d(z,z)))),n.radius=s,n.eyeRadius=p(t.eye),n.constraints=e.state.constraints,n}function v(e){return Math.abs(e)>1e-9}function H(e){const{constraints:t,eyeCenterDistance:r,tiltAtCenter:n}=e;let i=n,s=t.clampTilt(r,n);const a=k(e,s);if(t.clampTilt(a,n)===s)return s;let o=0;for(;o<10&&v(s-i);){const r=(i+s)/2,n=k(e,r);v(t.clampTilt(n,r)-r)?i=r:s=r,o++}return s}function k(e,r){if(!e.centerIsOnSurface)return e.eyeCenterDistance;const i=Math.PI-t(r,0,Math.PI),s=n(e.radius/e.eyeRadius*Math.sin(i)),a=Math.PI-i-s,o=Math.sin(a)/Math.sin(i);if(e.eyeRadius<e.radius&&o>1){const t=Math.PI-s,r=Math.PI-i-t;return Math.sin(r)/Math.sin(i)*e.eyeRadius}return o*e.eyeRadius}function E(e,t){const r=n(e.radius/e.eyeRadius*Math.sin(e.tiltAtCenter)),i=n(e.radius/e.eyeRadius*Math.sin(t));return e.eyeRadius>e.radius?r-i:i-r}function F(e,t){return e.tiltAtCenter-Math.PI/2-(t-Math.PI/2)}function N(e,t,r){if(t.interactionType===x.NONE)return;const{interactionStartCamera:n,interactionFactor:i}=t;if(!n)return;const{min:s,max:a}=r,o=U(e,n,A,t),c=0===o?0:j(e.renderCoordsHelper,n.center,n.eye);r.min=s,r.max=a,t.interactionType===x.TUMBLE?(O(t.selection,S.ALTITUDE)&&B(e,n,r),D(o,c,!0,i,G,r)):D(o,c,!1,i,G,r)}function B(e,t,n){const i=e.state.constraints;if(e.state.isLocal||!i.altitude||!t)return;const s=y(t.center),a=Math.sqrt(s),o=t.distance,c=h(e.spatialReference).radius,u=i.altitude.min+c,l=i.altitude.max+c,m=(u*u-o*o-s)/(-2*a*o),f=(l*l-o*o-s)/(-2*a*o);n.min=Math.max(n.min,Math.min(Math.PI-r(f),n.max)),n.max=Math.min(n.max,Math.PI-r(m))}const K=M(),_=a(),z=M(),G=i(5),J={min:0,max:0},Q={constraints:null,radius:0,eyeRadius:0,centerIsOnSurface:!0,eyeCenterDistance:0,tiltAtCenter:0},V={eyeCenterDistance:0,requiresTwoSteps:!1};export{w as applyTiltConstraint,U as getTiltConstraintError};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{c as e,a as r,h as t,f as n,g as i,
|
|
5
|
+
import{c as e,a as r,h as t,f as n,g as i,k as o,l as s}from"../../../chunks/vec32.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as c}from"../../../geometry/ellipsoidUtils.js";import{containsPoint as l}from"../../../geometry/support/aaBoundingRect.js";import{newIntersector as d}from"../webgl-engine/lib/Intersector.js";function u(e,r,t,n){return null!=e.renderCoordsHelper.fromRenderCoords(r.eye,M,n)&&l(t,M)}function f(e,r){return e.elevationProvider?e.elevationProvider.getElevation(r[0],r[1],r[2],e.renderCoordsHelper.spatialReference,"ground")??0:0}function g(o,s,a,c){const l=o.state.camera.clone();s&&a&&c&&(l.eye=s,l.center=a,l.up=c),m(o,l.ray,b)||e(b,l.center);const d=o.state.constraints,u=d.minimumPoiDistance;if(r(l.eye,b)<u){const r=d.collision.enabled;e(w,l.viewForward),t(w,w,u),r?l.eye=n(M,b,w):i(b,l.eye,w);const s=o.renderCoordsHelper,a=s.getAltitude(l.eye),c=d.collision.elevationMargin;r&&a<c&&(n(w,b,l.eye),l.eye=s.setAltitude(M,c,l.eye),i(b,l.eye,w))}return l.center=b,l}function p(e,t,n){if(!e.state.isGlobal||!e.stateManager.constraintsManager)return!1;const i=f(e,t),o=e.stateManager.constraintsManager.nearFarHeuristic,{far:s}=o.compute(t,n,e.renderDataExtent,i,H),a=s*s;return r(t,n)>a}function m(e,r,t){let n=v[e.viewingMode];n||(n=d(e.state.viewingMode),n.options.backfacesTerrain=!e.state.isGlobal,n.options.invisibleTerrain=!0,v[e.viewingMode]=n);const{isGlobal:i}=e.state;return!(!e.sceneIntersectionHelper.intersectRay(r,n,t)||p(e,r.origin,t))||(!(!e.renderCoordsHelper.intersectManifold(r,0,t)||p(e,r.origin,t))||!!i&&y(r,t,c(e.spatialReference).radius))}function y(e,r,n){const a=o(e.origin,e.origin)-n*n,c=a>0?Math.sqrt(a)/3:1;return t(r,e.direction,c/s(e.direction)),i(r,r,e.origin),!0}const v={},M=a(),b=a(),w=a(),H={near:0,far:0};export{g as cameraOnContentAlongViewDirection,u as eyeWithinExtent,f as surfaceElevationBelowRenderLocation};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{unitRGBAFromColor as e}from"../../../core/colorUtils.js";import t from"../../../core/Handles.js";import{clamp as s,lerp as i,smoothstep as r}from"../../../core/mathUtils.js";import{watch as a,syncAndInitial as o}from"../../../core/reactiveUtils.js";import{set as n}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{s as h,l as m,
|
|
5
|
+
import{unitRGBAFromColor as e}from"../../../core/colorUtils.js";import t from"../../../core/Handles.js";import{clamp as s,lerp as i,smoothstep as r}from"../../../core/mathUtils.js";import{watch as a,syncAndInitial as o}from"../../../core/reactiveUtils.js";import{set as n}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{s as h,l as m,p as d}from"../../../chunks/vec32.js";import{s as u}from"../../../chunks/vec42.js";import{ZEROS as c}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{earth as p}from"../../../geometry/support/Ellipsoid.js";import{AtmosphereType as l}from"./AtmosphereType.js";import{atmosphereHeight as _,innerAtmosphereDepth as f,computeInnerAltitudeFade as T}from"./atmosphereUtils.js";import{ChapmanAtmospherePassParameters as b,ChapmanAtmosphereTechnique as g}from"./ChapmanAtmosphereTechnique.js";import{ChapmanAtmosphereTechniqueConfiguration as v}from"./ChapmanAtmosphereTechniqueConfiguration.js";import{ColorFormat as w}from"../webgl/formats.js";import{Pos2Tex as x}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{createQuadVAO as P}from"../webgl-engine/lib/glUtil3D.js";import{applyTextureResizeModulo as R}from"../webgl-engine/lib/textureUtils.js";import{A as q}from"../../../chunks/AtmosphereCompositing.glsl.js";import{AtmosphereCompositingTechnique as j}from"../webgl-engine/shaders/AtmosphereCompositingTechnique.js";import{PrimitiveType as E}from"../../webgl/enums.js";import B from"../../../webscene/background/ColorBackground.js";class C{constructor(s,i){this._view=s,this._context=i,this.type=l.Realistic,this._handles=new t,this._compositingPassParameters=new q,this._atmosphereConfiguration=new v,this._passParameters=new b,this._rootTileElevationMin=NaN,this._lowerBoundEarthRadius=p.radius,this._fadeHaze=0,this._updateRadius(p.radius);const r=this._context.renderContext.rctx;this._updateRootTileElevationBounds(),this._handles.add([a((()=>this._view?.basemapTerrain?.rootTileElevationBounds),(()=>this._view?.basemapTerrain?this._updateRootTileElevationBounds():null)),a((()=>this._view?.basemapTerrain?.visibleElevationBounds),(()=>this._view?.basemapTerrain?this._updateVisibleElevationBounds():null)),a((()=>this._view?.environment.background),(t=>{const s=t instanceof B?e(t.color):c;h(this._passParameters.backgroundColor,s[0]*s[3],s[1]*s[3],s[2]*s[3])}),o)]);const n=new v;n.haze=!1,this._atmosphereTechnique=this._context.techniqueRepository.acquire(g,n),n.haze=!0,this._atmosphereHazeTechnique=this._context.techniqueRepository.acquire(g,n),n.reduced=!0,n.haze=!1,this._atmosphereReducedTechnique=this._context.techniqueRepository.acquire(g,n),n.haze=!0,this._atmosphereHazeReducedTechnique=this._context.techniqueRepository.acquire(g,n),this._vao=P(r,x)}destroy(){this._handles.destroy(),this._atmosphereTechnique.release(),this._atmosphereHazeTechnique.release(),this._atmosphereReducedTechnique.release(),this._atmosphereHazeReducedTechnique.release(),this._vao.dispose()}render(e,t){this._render(e,t?this._atmosphereTechnique:this._atmosphereReducedTechnique,e.offscreenRenderingHelper.depthTexture,t,!1)}renderHaze(e,t,s){this._fadeHaze=t,this._render(e,s?this._atmosphereHazeTechnique:this._atmosphereHazeReducedTechnique,e.bindParameters.linearDepth?.getTexture(),s,!0)}_render(e,t,s,r,a){if(null==s)return;const o=e.offscreenRenderingHelper;this._update(e.bindParameters.camera),this._passParameters.depthTexture=s;const n=e.rctx.bindTechnique(t,e.bindParameters,this._passParameters);if(r)o.renderDepthDetached((()=>this._renderCommon(n,e)));else{const t=e.rctx.getViewport(),r=m(e.bindParameters.camera.eye)-p.radius;let h;if(r<_){const e=Math.min(1,Math.max(0,r/_));h=a?i(.4,.5,e):i(.2,.3,e)}else{const e=Math.min(1,Math.max(0,(r-_)/(15*_)));h=a?i(.5,1,e):i(.3,.6,e)}const d=R(Math.round(h*e.bindParameters.camera.fullViewport[2])),u=R(Math.round(h*e.bindParameters.camera.fullViewport[3]));e.rctx.setViewport(0,0,d,u);const c=o.renderToCachedFBO(null,"chapman",(()=>this._renderCommon(n,e)),[0,0,0,1],w.RGBA,null,d,u);e.rctx.setViewport(t.x,t.y,t.width,t.height),this._compositingPassParameters.color=c.getTexture(),this._compositingPassParameters.depth=s,this._atmosphereConfiguration.haze=a;const l=this._context.techniqueRepository.acquire(j,this._atmosphereConfiguration);e.rctx.bindTechnique(l,e.bindParameters,this._compositingPassParameters),o.renderDepthDetached((()=>e.rctx.screen.draw())),l.release(),c.release()}}_renderCommon(e,t){null!=this._vao&&(t.rctx.bindVAO(this._vao),e.assertCompatibleVertexAttributeLocations(this._vao),t.rctx.drawArrays(E.TRIANGLE_STRIP,0,4))}_adjustRadiusForTesselation(e){return e*Math.cos(Math.PI/16/16)}_updateRootTileElevationBounds(){const e=this._view.basemapTerrain.rootTileElevationBounds.min;e!==this._rootTileElevationMin&&(this._rootTileElevationMin=e,this._lowerBoundEarthRadius=p.radius,this._updateVisibleElevationBounds())}_updateVisibleElevationBounds(){const e=this._adjustRadiusForTesselation(p.radius+this._view.basemapTerrain.visibleElevationBounds.min);e<this._lowerBoundEarthRadius&&this._updateRadius(e)}_updateRadius(e){this._lowerBoundEarthRadius=e,n(this._passParameters.radii,e,e+_),this._passParameters.innerFadeDistance=2*Math.sqrt((2*e-f)*f)}_update(e){if(!e)return;const t=d(e.eye),a=Math.sqrt(t),o=t-this._passParameters.radii[1]*this._passParameters.radii[1],n=s((a-this._passParameters.radii[0])/_,0,1);u(this._passParameters.heightParameters,a,t,o,n),this._passParameters.altitudeFade=T(a-this._lowerBoundEarthRadius),this._passParameters.hazeStrength=i(i(.6,1,r(9500,10500,a-p.radius)),1,this._fadeHaze)}static isSupported(e){return e.renderContext.rctx.capabilities.depthTexture}}export{C as ChapmanAtmosphere};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../core/has.js";import{lerp as t}from"../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{watch as r,syncAndInitial as i,initial as a,sync as o}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{l,c as d,k as p}from"../../../chunks/vec32.js";import{fromValues as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as m}from"../../../geometry/ellipsoidUtils.js";import{isMoon as c,isEarth as _,isMars as g}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as w}from"../../ViewingMode.js";import{AtmosphereType as f}from"./AtmosphereType.js";import{ChapmanAtmosphere as y}from"./ChapmanAtmosphere.js";import{CloudsComposition as v}from"./CloudsComposition.js";import{isReadyCloudsData as P,CloudsRenderingStages as b}from"./CloudsData.js";import{CloudsGenerator as R}from"./CloudsGenerator.js";import{FadeMode as A}from"./CloudsParameters.js";import{cloudPresets as x}from"./CloudsPresets.js";import{Fog as F,FogParameters as N}from"./Fog.js";import{LocalAtmosphere as W}from"./LocalAtmosphere.js";import j from"./MarsAtmosphere.js";import{Precipitation as C}from"./Precipitation.js";import{Stars as E}from"./Stars.js";import{weatherHeightLimit as M}from"./weather.js";import{SyncRenderPlugin as O,ConsumesDepth as z,ConsumesNone as L}from"../webgl-engine/effects/RenderPlugin.js";import{RenderSlot as T}from"../webgl-engine/lib/RenderSlot.js";import{Update as S}from"../webgl-engine/lib/Update.js";var U;let I=U=class extends O{constructor(e){super(e),this.produces=new Map([[T.ENVIRONMENT_OPAQUE,()=>!(null===this._atmosphere&&null===this._stars)],[T.ENVIRONMENT_TRANSPARENT,()=>!(null===this._atmosphere)]]),this._context=null,this._atmosphere=null,this._oldWeatherParameters=new V,this._newWeatherParameters=new V,this._fadedWeatherParameters=new V,this._weatherParameters=this._newWeatherParameters}initialize(){this.view._stage.addRenderPlugin(this)}destroy(){this.removeHandles(),this.uninitializeRenderContext(),null!=this.view?._stage&&this.view._stage.removeRenderPlugin(this),this._set("view",null)}get atmosphere(){return this._atmosphere}get _atmosphereType(){return null!=this.atmosphere?this.atmosphere.type:f.None}consumes(){return this._atmosphereType===f.Realistic?z:L}updateAnimation(e){return null!=this._precipitation&&this._precipitation.update(e)}get updating(){return null!=this._stars&&this._stars.updating||null!=this._clouds&&this._clouds.running}get weatherVisible(){return l(this.view.state.camera.eye)-m(this.view.spatialReference).radius<=M}get usedMemory(){return this._clouds?.usedMemory??0}get _stars(){const e=this.view,t=e.environment?.starsEnabled??!1,r=this._get("_stars");return t&&null!=this._context?null!=r?r:new E({view:e,requestRender:()=>this._setNeedsRender()}):(s(r),null)}get _precipitation(){const e=this._get("_precipitation");if(!this._precipitationEnabled||null==this._context)return s(e),null;const t=this.view,r=this._context;return null!=e&&e.context===r?e:(s(e),new C({context:r,view:t}))}get _clouds(){const e=this._get("_clouds");if(!this.weatherEnabled||null==this._context)return s(e),null;if(null!=e)return e;const t=this.view,r=this._context;return s(e),new R({context:r,view:t,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const e=this._get("_cloudsComposition");if(!this.weatherEnabled||null==this._context)return s(e),null;const t=this.view.state.viewingMode,r=this._context.renderContext.rctx,i=m(this.view.spatialReference).radius;return null!=e&&e.viewingMode===t&&e.planetRadius===i?e:(s(e),new v({rctx:r,viewingMode:t,planetRadius:i,requestRender:()=>this._setNeedsRender()}))}get _fog(){const e=this._get("_fog");if(!this.weatherEnabled||null==this._context)return s(e),null;if(null!=e)return e;const t=this.view,r=this._context,i=this._context.renderContext.rctx,a=this.view.state.viewingMode;return new F({context:r,view:t,rctx:i,viewingMode:a})}get weatherEnabled(){return!!this.view?.environmentManager?.weatherEnabled}get _precipitationEnabled(){return this.weatherEnabled&&("rainy"===this.view.environment.weather.type||"snowy"===this.view.environment.weather.type)}initializeRenderContext(e=null){this._context=e;const t=()=>this._setNeedsRender();this.addHandles([r((()=>({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled})),(e=>this._updateAtmosphere(e)),i),r((()=>this._stars),t),r((()=>this._precipitation),t),r((()=>this._clouds),(()=>this._updateWeather()),a),r((()=>this._fog),(()=>this._updateFogHaze()),a),r((()=>this.view.state.mode),(()=>{this._setNeedsRender()}),o),r((()=>this._weatherUpdateParameters),(()=>{this._updateWeather(),this._updateFogHaze()}),i)])}uninitializeRenderContext(){this._context=null,this._atmosphere=s(this._atmosphere),this._set("_stars",s(this._stars)),this._set("_precipitation",s(this._precipitation)),this._set("_clouds",s(this._clouds)),this._set("_cloudsComposition",s(this._cloudsComposition)),this._set("_fog",s(this._fog))}prepareRender(e){e.bindParameters.cloudsFade.data=P(this._clouds)?this._clouds:null,"local"!==this.view.viewingMode&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&(this._updateWeatherFading(e.bindParameters,e.time),e.bindParameters.cloudsFade.renderingStage===b.FINISHED&&null!=this._clouds&&0===this._clouds.coverage&&!1===this._clouds.running&&(this._clouds.destroyFrameBufferCube(),e.bindParameters.cloudsFade.data=null))}renderNode(e){switch(e.bindParameters.slot){case T.ENVIRONMENT_OPAQUE:null!=this._stars&&this._stars.render(e),null!=this.atmosphere&&(this.atmosphere.render(e,this.view?._stage?.renderer?.fullResolutionAtmosphere),null!=this._cloudsComposition&&null!=e.bindParameters.cloudsFade.data&&(this.weatherVisible&&null!=this._clouds&&this._clouds.updateWeatherTile(),this._cloudsComposition.render(e)),e.bindParameters.cloudsFade.isFading&&null!=this._context&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&this._context.requestRender());break;case T.ENVIRONMENT_TRANSPARENT:if(null!=this.atmosphere&&(this.atmosphere.renderHaze(e,this._weatherParameters.hazeAmount,this.view?._stage?.renderer?.fullResolutionAtmosphere),this._weatherParameters.fog.amount>0&&null!=this._fog&&this._fog.render(e,this._weatherParameters.fog),this._precipitation)){const t=this.view.environment.weather;"rainy"!==t.type&&"snowy"!==t.type||this._precipitation.render(e,t.precipitation,t.type)}}}updateLightSources(e,t,s,r){if(null!=this._context){const i=this._context.renderContext;i.bindParameters.oldLighting.copyFrom(i.bindParameters.lighting),i.bindParameters.newLighting.noonFactor=t,i.bindParameters.newLighting.globalFactor=s,i.bindParameters.newLighting.set(e);r===S.Faded||i.bindParameters.weatherFading?i.bindParameters.fadeLighting(0):i.bindParameters.fadeLighting(1),this._context.requestRender()}}get _weatherUpdateParameters(){const e=this.weatherEnabled?this.view.environment.weather:null;return null==e?null:"rainy"===e.type||"snowy"===e.type?{type:e.type,weatherAdjustment:e.cloudCover,effect:e.precipitation}:{type:e.type,weatherAdjustment:"foggy"===e.type?e.fogStrength:e.cloudCover}}_updateWeatherFading(e,t){e.cloudsFade.updateFading(e.camera,this.view.state.mode,t,this.view.qualitySettings.fadeDuration),e.cloudsFade.updateParallax(e.camera),e.weatherFading&&(this._updateLighting(e),this._updateFogAtmoshpere(e))}_updateLighting(e){e.cloudsFade.fadeMode!==A.CROSS_FADE&&e.cloudsFade.fadeMode!==A.FADE_IN?e.fadeLighting(0):e.fadeLighting(e.cloudsFade.fadeFactor)}_updateFogAtmoshpere(e){e.cloudsFade.fadeMode!==A.CROSS_FADE&&e.cloudsFade.fadeMode!==A.FADE_IN?this._fadeWeather(0):this._fadeWeather(e.cloudsFade.fadeFactor)}_fadeWeather(e){const{_newWeatherParameters:t,_oldWeatherParameters:s}=this;e>=1?this._weatherParameters=t:(this._fadedWeatherParameters.lerp(s,t,e),this._weatherParameters=this._fadedWeatherParameters)}_updateWeather(){const e=this._weatherUpdateParameters;null!=e&&null!=this._clouds&&(this._clouds.applyPreset(x[e.type],e.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){null!=this._context&&this._context.requestRender()}_updateFogHaze(){const e=this._weatherUpdateParameters;if(null==this._fog||null==e||null==this._context)return;const s=this._context.renderContext.bindParameters;switch(this._oldWeatherParameters.copyFrom(this._weatherParameters),e.type){case"foggy":this._newWeatherParameters.fog.strength=t(3e-5,.005,e.weatherAdjustment**3),d(this._newWeatherParameters.fog.color,q),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;case"rainy":this._newWeatherParameters.fog.strength=t(4e-6,2e-4,(e.effect??0)**3),d(this._newWeatherParameters.fog.color,k),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=0,this._setNeedsRender();break;case"snowy":this._newWeatherParameters.fog.strength=t(4e-6,2e-4,(e.effect??0)**3),d(this._newWeatherParameters.fog.color,q),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;default:this._newWeatherParameters.fog.strength=0,this._newWeatherParameters.fog.amount=0,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender()}s.weatherFading?this._fadeWeather(0):this._fadeWeather(1)}_updateAtmosphere(e){const t=this._selectAtmosphereType(e);if(t!==f.None&&this._context){if(!this._atmosphere||this._atmosphere.type!==t){this._atmosphere=s(this._atmosphere);const e=this._getAtmosphereClass(t);e&&(this._atmosphere=new e(this.view,this._context))}}else this._atmosphere=s(this._atmosphere);this._setNeedsRender()}_getAtmosphereClass(e){switch(e){case f.Realistic:return y;case f.Local:return W;case f.Mars:return j;default:case f.None:return null}}_selectAtmosphereType(e){const{enabled:t,viewingMode:s}=e;return!t||c(this.view.spatialReference)?f.None:s===w.Local?f.Local:null!=this._context&&y.isSupported(this._context)&&_(this.view.spatialReference)?f.Realistic:g(this.view.spatialReference)?f.Mars:f.None}get test(){return{atmosphere:this._atmosphere,clouds:this._clouds,selectAtmosphereType:()=>this._selectAtmosphereType({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled}),stubGetAtmosphereClass:e=>{D=U.prototype._getAtmosphereClass,U.prototype._getAtmosphereClass=e},restoreGetAtmosphereClass:()=>{U.prototype._getAtmosphereClass=D}}}};e([n({constructOnly:!0})],I.prototype,"view",void 0),e([n({readOnly:!0})],I.prototype,"atmosphere",null),e([n({readOnly:!0})],I.prototype,"_atmosphereType",null),e([n({type:Boolean,readOnly:!0})],I.prototype,"updating",null),e([n({readOnly:!0})],I.prototype,"weatherVisible",null),e([n()],I.prototype,"_context",void 0),e([n()],I.prototype,"_atmosphere",void 0),e([n({readOnly:!0})],I.prototype,"_stars",null),e([n({readOnly:!0})],I.prototype,"_precipitation",null),e([n({readOnly:!0})],I.prototype,"_clouds",null),e([n({readOnly:!0})],I.prototype,"_cloudsComposition",null),e([n({readOnly:!0})],I.prototype,"_fog",null),e([n({readOnly:!0})],I.prototype,"weatherEnabled",null),e([n({readOnly:!0})],I.prototype,"_precipitationEnabled",null),e([n({readOnly:!0})],I.prototype,"_weatherUpdateParameters",null),I=U=e([h("esri.views.3d.environment.EnvironmentRenderer")],I);class V{constructor(){this.fog=new N,this.hazeAmount=1}copyFrom(e){this.fog.amount=e.fog.amount,this.hazeAmount=e.hazeAmount,this.fog.strength=e.fog.strength,d(this.fog.color,e.fog.color)}lerp(e,s,r){this.fog.amount=t(e.fog.amount,s.fog.amount,r),this.hazeAmount=t(e.hazeAmount,s.hazeAmount,r),this.fog.strength=t(e.fog.strength,s.fog.strength,r),p(this.fog.color,e.fog.color,s.fog.color,r)}}const k=u(.5,.5,.5),q=u(1.5,1.5,1.5);let D;export{I as EnvironmentRenderer,V as WeatherParameters};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../core/has.js";import{lerp as t}from"../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{watch as r,syncAndInitial as i,initial as a,sync as o}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{l,c as d,m as p}from"../../../chunks/vec32.js";import{fromValues as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as m}from"../../../geometry/ellipsoidUtils.js";import{isMoon as c,isEarth as _,isMars as g}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as w}from"../../ViewingMode.js";import{AtmosphereType as f}from"./AtmosphereType.js";import{ChapmanAtmosphere as y}from"./ChapmanAtmosphere.js";import{CloudsComposition as v}from"./CloudsComposition.js";import{isReadyCloudsData as P,CloudsRenderingStages as b}from"./CloudsData.js";import{CloudsGenerator as R}from"./CloudsGenerator.js";import{FadeMode as A}from"./CloudsParameters.js";import{cloudPresets as x}from"./CloudsPresets.js";import{Fog as F,FogParameters as N}from"./Fog.js";import{LocalAtmosphere as W}from"./LocalAtmosphere.js";import j from"./MarsAtmosphere.js";import{Precipitation as C}from"./Precipitation.js";import{Stars as E}from"./Stars.js";import{weatherHeightLimit as M}from"./weather.js";import{SyncRenderPlugin as O,ConsumesDepth as z,ConsumesNone as L}from"../webgl-engine/effects/RenderPlugin.js";import{RenderSlot as T}from"../webgl-engine/lib/RenderSlot.js";import{Update as S}from"../webgl-engine/lib/Update.js";var U;let I=U=class extends O{constructor(e){super(e),this.produces=new Map([[T.ENVIRONMENT_OPAQUE,()=>!(null===this._atmosphere&&null===this._stars)],[T.ENVIRONMENT_TRANSPARENT,()=>!(null===this._atmosphere)]]),this._context=null,this._atmosphere=null,this._oldWeatherParameters=new V,this._newWeatherParameters=new V,this._fadedWeatherParameters=new V,this._weatherParameters=this._newWeatherParameters}initialize(){this.view._stage.addRenderPlugin(this)}destroy(){this.removeHandles(),this.uninitializeRenderContext(),null!=this.view?._stage&&this.view._stage.removeRenderPlugin(this),this._set("view",null)}get atmosphere(){return this._atmosphere}get _atmosphereType(){return null!=this.atmosphere?this.atmosphere.type:f.None}consumes(){return this._atmosphereType===f.Realistic?z:L}updateAnimation(e){return null!=this._precipitation&&this._precipitation.update(e)}get updating(){return null!=this._stars&&this._stars.updating||null!=this._clouds&&this._clouds.running}get weatherVisible(){return l(this.view.state.camera.eye)-m(this.view.spatialReference).radius<=M}get usedMemory(){return this._clouds?.usedMemory??0}get _stars(){const e=this.view,t=e.environment?.starsEnabled??!1,r=this._get("_stars");return t&&null!=this._context?null!=r?r:new E({view:e,requestRender:()=>this._setNeedsRender()}):(s(r),null)}get _precipitation(){const e=this._get("_precipitation");if(!this._precipitationEnabled||null==this._context)return s(e),null;const t=this.view,r=this._context;return null!=e&&e.context===r?e:(s(e),new C({context:r,view:t}))}get _clouds(){const e=this._get("_clouds");if(!this.weatherEnabled||null==this._context)return s(e),null;if(null!=e)return e;const t=this.view,r=this._context;return s(e),new R({context:r,view:t,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const e=this._get("_cloudsComposition");if(!this.weatherEnabled||null==this._context)return s(e),null;const t=this.view.state.viewingMode,r=this._context.renderContext.rctx,i=m(this.view.spatialReference).radius;return null!=e&&e.viewingMode===t&&e.planetRadius===i?e:(s(e),new v({rctx:r,viewingMode:t,planetRadius:i,requestRender:()=>this._setNeedsRender()}))}get _fog(){const e=this._get("_fog");if(!this.weatherEnabled||null==this._context)return s(e),null;if(null!=e)return e;const t=this.view,r=this._context,i=this._context.renderContext.rctx,a=this.view.state.viewingMode;return new F({context:r,view:t,rctx:i,viewingMode:a})}get weatherEnabled(){return!!this.view?.environmentManager?.weatherEnabled}get _precipitationEnabled(){return this.weatherEnabled&&("rainy"===this.view.environment.weather.type||"snowy"===this.view.environment.weather.type)}initializeRenderContext(e=null){this._context=e;const t=()=>this._setNeedsRender();this.addHandles([r((()=>({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled})),(e=>this._updateAtmosphere(e)),i),r((()=>this._stars),t),r((()=>this._precipitation),t),r((()=>this._clouds),(()=>this._updateWeather()),a),r((()=>this._fog),(()=>this._updateFogHaze()),a),r((()=>this.view.state.mode),(()=>{this._setNeedsRender()}),o),r((()=>this._weatherUpdateParameters),(()=>{this._updateWeather(),this._updateFogHaze()}),i)])}uninitializeRenderContext(){this._context=null,this._atmosphere=s(this._atmosphere),this._set("_stars",s(this._stars)),this._set("_precipitation",s(this._precipitation)),this._set("_clouds",s(this._clouds)),this._set("_cloudsComposition",s(this._cloudsComposition)),this._set("_fog",s(this._fog))}prepareRender(e){e.bindParameters.cloudsFade.data=P(this._clouds)?this._clouds:null,"local"!==this.view.viewingMode&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&(this._updateWeatherFading(e.bindParameters,e.time),e.bindParameters.cloudsFade.renderingStage===b.FINISHED&&null!=this._clouds&&0===this._clouds.coverage&&!1===this._clouds.running&&(this._clouds.destroyFrameBufferCube(),e.bindParameters.cloudsFade.data=null))}renderNode(e){switch(e.bindParameters.slot){case T.ENVIRONMENT_OPAQUE:null!=this._stars&&this._stars.render(e),null!=this.atmosphere&&(this.atmosphere.render(e,this.view?._stage?.renderer?.fullResolutionAtmosphere),null!=this._cloudsComposition&&null!=e.bindParameters.cloudsFade.data&&(this.weatherVisible&&null!=this._clouds&&this._clouds.updateWeatherTile(),this._cloudsComposition.render(e)),e.bindParameters.cloudsFade.isFading&&null!=this._context&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&this._context.requestRender());break;case T.ENVIRONMENT_TRANSPARENT:if(null!=this.atmosphere&&(this.atmosphere.renderHaze(e,this._weatherParameters.hazeAmount,this.view?._stage?.renderer?.fullResolutionAtmosphere),this._weatherParameters.fog.amount>0&&null!=this._fog&&this._fog.render(e,this._weatherParameters.fog),this._precipitation)){const t=this.view.environment.weather;"rainy"!==t.type&&"snowy"!==t.type||this._precipitation.render(e,t.precipitation,t.type)}}}updateLightSources(e,t,s,r){if(null!=this._context){const i=this._context.renderContext;i.bindParameters.oldLighting.copyFrom(i.bindParameters.lighting),i.bindParameters.newLighting.noonFactor=t,i.bindParameters.newLighting.globalFactor=s,i.bindParameters.newLighting.set(e);r===S.Faded||i.bindParameters.weatherFading?i.bindParameters.fadeLighting(0):i.bindParameters.fadeLighting(1),this._context.requestRender()}}get _weatherUpdateParameters(){const e=this.weatherEnabled?this.view.environment.weather:null;return null==e?null:"rainy"===e.type||"snowy"===e.type?{type:e.type,weatherAdjustment:e.cloudCover,effect:e.precipitation}:{type:e.type,weatherAdjustment:"foggy"===e.type?e.fogStrength:e.cloudCover}}_updateWeatherFading(e,t){e.cloudsFade.updateFading(e.camera,this.view.state.mode,t,this.view.qualitySettings.fadeDuration),e.cloudsFade.updateParallax(e.camera),e.weatherFading&&(this._updateLighting(e),this._updateFogAtmoshpere(e))}_updateLighting(e){e.cloudsFade.fadeMode!==A.CROSS_FADE&&e.cloudsFade.fadeMode!==A.FADE_IN?e.fadeLighting(0):e.fadeLighting(e.cloudsFade.fadeFactor)}_updateFogAtmoshpere(e){e.cloudsFade.fadeMode!==A.CROSS_FADE&&e.cloudsFade.fadeMode!==A.FADE_IN?this._fadeWeather(0):this._fadeWeather(e.cloudsFade.fadeFactor)}_fadeWeather(e){const{_newWeatherParameters:t,_oldWeatherParameters:s}=this;e>=1?this._weatherParameters=t:(this._fadedWeatherParameters.lerp(s,t,e),this._weatherParameters=this._fadedWeatherParameters)}_updateWeather(){const e=this._weatherUpdateParameters;null!=e&&null!=this._clouds&&(this._clouds.applyPreset(x[e.type],e.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){null!=this._context&&this._context.requestRender()}_updateFogHaze(){const e=this._weatherUpdateParameters;if(null==this._fog||null==e||null==this._context)return;const s=this._context.renderContext.bindParameters;switch(this._oldWeatherParameters.copyFrom(this._weatherParameters),e.type){case"foggy":this._newWeatherParameters.fog.strength=t(3e-5,.005,e.weatherAdjustment**3),d(this._newWeatherParameters.fog.color,D),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;case"rainy":this._newWeatherParameters.fog.strength=t(4e-6,2e-4,(e.effect??0)**3),d(this._newWeatherParameters.fog.color,q),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=0,this._setNeedsRender();break;case"snowy":this._newWeatherParameters.fog.strength=t(4e-6,2e-4,(e.effect??0)**3),d(this._newWeatherParameters.fog.color,D),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;default:this._newWeatherParameters.fog.strength=0,this._newWeatherParameters.fog.amount=0,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender()}s.weatherFading?this._fadeWeather(0):this._fadeWeather(1)}_updateAtmosphere(e){const t=this._selectAtmosphereType(e);if(t!==f.None&&this._context){if(!this._atmosphere||this._atmosphere.type!==t){this._atmosphere=s(this._atmosphere);const e=this._getAtmosphereClass(t);e&&(this._atmosphere=new e(this.view,this._context))}}else this._atmosphere=s(this._atmosphere);this._setNeedsRender()}_getAtmosphereClass(e){switch(e){case f.Realistic:return y;case f.Local:return W;case f.Mars:return j;default:case f.None:return null}}_selectAtmosphereType(e){const{enabled:t,viewingMode:s}=e;return!t||c(this.view.spatialReference)?f.None:s===w.Local?f.Local:null!=this._context&&y.isSupported(this._context)&&_(this.view.spatialReference)?f.Realistic:g(this.view.spatialReference)?f.Mars:f.None}get test(){return{atmosphere:this._atmosphere,clouds:this._clouds,selectAtmosphereType:()=>this._selectAtmosphereType({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled}),stubGetAtmosphereClass:e=>{H=U.prototype._getAtmosphereClass,U.prototype._getAtmosphereClass=e},restoreGetAtmosphereClass:()=>{U.prototype._getAtmosphereClass=H}}}};e([n({constructOnly:!0})],I.prototype,"view",void 0),e([n({readOnly:!0})],I.prototype,"atmosphere",null),e([n({readOnly:!0})],I.prototype,"_atmosphereType",null),e([n({type:Boolean,readOnly:!0})],I.prototype,"updating",null),e([n({readOnly:!0})],I.prototype,"weatherVisible",null),e([n()],I.prototype,"_context",void 0),e([n()],I.prototype,"_atmosphere",void 0),e([n({readOnly:!0})],I.prototype,"_stars",null),e([n({readOnly:!0})],I.prototype,"_precipitation",null),e([n({readOnly:!0})],I.prototype,"_clouds",null),e([n({readOnly:!0})],I.prototype,"_cloudsComposition",null),e([n({readOnly:!0})],I.prototype,"_fog",null),e([n({readOnly:!0})],I.prototype,"weatherEnabled",null),e([n({readOnly:!0})],I.prototype,"_precipitationEnabled",null),e([n({readOnly:!0})],I.prototype,"_weatherUpdateParameters",null),I=U=e([h("esri.views.3d.environment.EnvironmentRenderer")],I);class V{constructor(){this.fog=new N,this.hazeAmount=1}copyFrom(e){this.fog.amount=e.fog.amount,this.hazeAmount=e.hazeAmount,this.fog.strength=e.fog.strength,d(this.fog.color,e.fog.color)}lerp(e,s,r){this.fog.amount=t(e.fog.amount,s.fog.amount,r),this.hazeAmount=t(e.hazeAmount,s.hazeAmount,r),this.fog.strength=t(e.fog.strength,s.fog.strength,r),p(this.fog.color,e.fog.color,s.fog.color,r)}}const q=u(.5,.5,.5),D=u(1.5,1.5,1.5);let H;export{I as EnvironmentRenderer,V as WeatherParameters};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Accessor.js";import{smoothstep as s}from"../../../core/mathUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{n as i,
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Accessor.js";import{smoothstep as s}from"../../../core/mathUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{n as i,k as a,h as n,m as c,l as m}from"../../../chunks/vec32.js";import{create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as h}from"../../../geometry/ellipsoidUtils.js";import{atmosphereHeight as u}from"./atmosphereUtils.js";import{F as d}from"../../../chunks/Fog.glsl.js";import{FogTechnique as l}from"./FogTechnique.js";import{weatherHeightLimit as g}from"./weather.js";import{Pos2Tex as f}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{createQuadVAO as _}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as j}from"../../webgl/enums.js";const b=.95,x=1;let v=class extends e{constructor(t){super(t),this._passParameters=new d;const e=t.context.renderContext.rctx;this._vao=_(e,f),this._technique=new l(t);const s=h(t.view.spatialReference);this._planetRadius=s.radius,this._atmosphereRadius=s.radius+u}destroy(){this._technique.release(),this._vao.dispose()}set strength(t){this._passParameters.fogStrength=t}get strength(){return this._passParameters.fogStrength}render(t,e){if(this._update(t,e),this._passParameters.fogAmount<=0)return;const s=this._technique;if(!s.compiled)return void this.context.requestRender();const r=t.offscreenRenderingHelper;r.renderDepthDetached((()=>{this._passParameters.depthTexture=r.depthTexture;const e=t.rctx.bindTechnique(s,t.bindParameters,this._passParameters);this._renderFog(e,t)}))}_renderFog(t,e){const s=e.rctx;s.bindVAO(this._vao),t.assertCompatibleVertexAttributeLocations(this._vao),s.drawArrays(j.TRIANGLE_STRIP,0,4)}_update(t,e){const r=t.bindParameters.camera;i(P,r.eye);const o=Math.max(0,a(P,t.bindParameters.lighting.mainLight.direction)),p=e.color;n(w,p,.1),c(this._passParameters.fogColor,w,p,o);const h=m(r.eye),u=h*h;this._passParameters.atmosphereC=u-this._atmosphereRadius*this._atmosphereRadius,this._passParameters.fogAmount=(1-s(b*g,x*g,Math.abs(h-this._planetRadius)))*e.amount,this._passParameters.fogStrength=e.strength}static isSupported(t){return t.capabilities.depthTexture}};t([r({constructOnly:!0})],v.prototype,"context",void 0),t([r({constructOnly:!0})],v.prototype,"view",void 0),t([r({constructOnly:!0})],v.prototype,"rctx",void 0),t([r({constructOnly:!0})],v.prototype,"viewingMode",void 0),v=t([o("esri.views.3d.environment.Fog")],v);class y{constructor(){this.color=p(),this.strength=0,this.amount=0}}const P=p(),w=p();export{v as Fog,y as FogParameters};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{lerp as e,clamp as t}from"../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../core/maybe.js";import{watch as r,syncAndInitial as i}from"../../../core/reactiveUtils.js";import{lookAt as o}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as h}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{l as n,h as m,g as p,
|
|
5
|
+
import{lerp as e,clamp as t}from"../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../core/maybe.js";import{watch as r,syncAndInitial as i}from"../../../core/reactiveUtils.js";import{lookAt as o}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as h}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{l as n,h as m,g as p,q as c,b as u,p as l}from"../../../chunks/vec32.js";import{create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as d}from"../../../geometry/ellipsoidUtils.js";import{newFloatArray as f}from"../../../geometry/support/FloatArray.js";import{AtmosphereType as g}from"./AtmosphereType.js";import{computeInnerAltitudeFade as b,innerAtmosphereDepth as x}from"./atmosphereUtils.js";import{S as R}from"../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as j}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as V,SimpleAtmosphereGeometry as y}from"./SimpleAtmosphereTechniqueConfiguration.js";import{marsAtmosphereTextureSimple as w}from"./resources/MarsAtmosphereTexture.js";import{makePiecewiseLinearFunction as A}from"../support/mathUtils.js";import{glLayout as P}from"../support/buffer/glUtil.js";import{newLayout as q}from"../support/buffer/InterleavedLayout.js";import{Default3D as T}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{createQuadVAO as v}from"../webgl-engine/lib/glUtil3D.js";import{project as S}from"../webgl-engine/lib/Util.js";import{VertexArrayObject as F}from"../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as C}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as M}from"../../webgl/BufferObject.js";import{TextureWrapMode as U,PrimitiveType as W,Usage as I}from"../../webgl/enums.js";import{Texture as O}from"../../webgl/Texture.js";import{TextureDescriptor as D}from"../../webgl/TextureDescriptor.js";import{vertexCount as L}from"../../webgl/Util.js";const E=128,G=-x,H=0,N=50,k=()=>1-511/512,B=A([[50,.1015625],[500,.21875],[5e3,1-250/512],[5e4,.4140625]]);class z{constructor(e,t){this.view=e,this.type=g.Mars,this._passParameters=new R,this._vaoCount=0,this._texV1=1;const s=d(e.spatialReference);this._planetRadius=s.radius,this._outerRimWidth=s.outerAtmosphereRimWidth,this._innerRimFactor=(this._planetRadius+G)/this._planetRadius,this._middleRimFactor=(this._planetRadius+H)/this._planetRadius,this._outerRimFactor=(this._planetRadius+this._outerRimWidth)/this._planetRadius,this._texV0=H/this._outerRimWidth,this._texVScale=this._texV1-this._texV0,this._techniqueRepository=t.techniqueRepository;const o=t.renderContext.rctx;this._cameraChangeHandle=r((()=>this.view.state?.camera),(()=>t.requestRender()),i),this._vao=this._createRibbon(o),this._vaoCount=L(this._vao,"geometry"),this._fadeVao=v(o),this._fadeVaoCount=L(this._fadeVao,"geometry");const a=new D;a.wrapMode=U.CLAMP_TO_EDGE,a.flipped=!0,a.width=1,a.height=512,this._passParameters.texture=new O(o,a,w);const h=new V;h.geometry=y.Cone,this._coneTechnique=this._techniqueRepository.acquire(j,h),h.geometry=y.Underground,this._undergroundTechnique=this._techniqueRepository.acquire(j,h)}destroy(){this._coneTechnique.release(),this._undergroundTechnique.release(),this._cameraChangeHandle.remove(),this._passParameters.texture=s(this._passParameters.texture),this._fadeVao.dispose(),this._vao.dispose()}render(e){const t=e.bindParameters.camera;this._update(t);const s=e.rctx;this._passParameters.undergroundFadeAlpha<1&&(s.bindTechnique(this._coneTechnique,e.bindParameters,this._passParameters),s.bindVAO(this._vao),s.drawArrays(W.TRIANGLES,0,this._vaoCount)),this._passParameters.undergroundFadeAlpha>0&&(s.bindTechnique(this._undergroundTechnique,e.bindParameters,this._passParameters),s.bindVAO(this._fadeVao),s.drawArrays(W.TRIANGLE_STRIP,0,this._fadeVaoCount))}renderHaze(){}_update(s){const r=_(),i=this._planetRadius,o=n(s.eye),a=o-i;if(a<0){const e=Math.min(-a/5e3,1);this._passParameters.undergroundFadeAlpha=e}else this._passParameters.undergroundFadeAlpha=0;const p=Math.max(N,a),c=i+G;this._passParameters.innerScale=Y(i+p,i,c)-1,this._passParameters.altitudeFade=b(a),m(r,s.eye,(i+N)/o),J(r,s.center,s.up,i,this._passParameters.silhouette);const u=this._computeScreenRimWidth(s,r,s.up,this._passParameters.silhouette),l=k(),d=B(a);let f=this._texV0+l*this._texVScale,g=this._texV0+u*d*this._texVScale;if(a>N){J(s.eye,s.center,s.up,i,this._passParameters.silhouette);const r=this._computeScreenRimWidth(s,s.eye,s.up,this._passParameters.silhouette),o=t((r-1.5)/(u-1.5),0,1);f=this._texV0+o*l*this._texVScale,g=this._texV0+e(this._texV1,u*d,o)*this._texVScale}h(this._passParameters.texV,f,g)}_createRibbon(e){const t=f(3+3*E*3),s=new Uint32Array(3*E*5);t[0]=0,t[1]=0,t[2]=-1;for(let o=0;o<E;o++){const e=9*o+3;t[e]=o,t[e+1]=this._innerRimFactor,t[e+2]=-1,t[e+3]=o,t[e+4]=this._middleRimFactor,t[e+5]=0,t[e+6]=o,t[e+7]=this._outerRimFactor,t[e+8]=1;const r=3*o+1,i=o===E-1?1:r+3,a=15*o;s[a]=r,s[a+1]=r+1,s[a+2]=i+1,s[a+3]=i+1,s[a+4]=i,s[a+5]=r,s[a+6]=r+1,s[a+7]=r+2,s[a+8]=i+2,s[a+9]=i+2,s[a+10]=i+1,s[a+11]=r+1,s[a+12]=r,s[a+13]=i,s[a+14]=0}const r=Z.createBuffer(s.length),i=r.position;for(let o=0;o<s.length;++o){const e=3*s[o];i.set(o,0,t[e]),i.set(o,1,t[e+1]),i.set(o,2,t[e+2])}return new F(e,T,{geometry:P(Z)},{geometry:M.createVertex(e,I.STATIC_DRAW,r.buffer)})}_computeScreenRimWidth(e,t,s,r){return p(Q,r.center,r.v2),m(X,Q,this._outerRimFactor),o(K,t,Q,s),S(Q,K,e.projectionMatrix,e.viewport,Q),S(X,K,e.projectionMatrix,e.viewport,X),c(Q,X)/e.height}}function J(e,t,s,r,i){const o=n(e),a=r*Math.sqrt(o*o-r*r)/o,h=Math.sqrt(r*r-a*a),p=i.v1,c=i.v2;return m(i.center,e,h/o),u(p,e,t),l(p)<1&&u(p,e,s),m(p,p,a/n(p)),u(c,p,e),m(c,c,a/n(c)),a}const K=a(),Q=_(),X=_();function Y(e,t,s){return e*e/(Math.sqrt(e*e-t*t)*Math.sqrt(e*e-s*s)+t*s)}const Z=q().vec3f(C.POSITION);export{z 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.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Evented.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{after as i}from"../../../core/promiseUtils.js";import{watch as s,sync as n,syncAndInitial as o}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{s as d,h as l,c,k as p}from"../../../chunks/vec32.js";import{create as _,fromValues as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectToWGS84ComparableLonLat as m}from"../../../geometry/projection.js";import{projectPointToWGS84ComparableLonLat as f}from"../../../geometry/projection/projectPointToWGS84ComparableLonLat.js";import{isEarth as g}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as P}from"../../ViewingMode.js";import{EnvironmentRenderer as v}from"./EnvironmentRenderer.js";import{positionToTimezoneInfo as b}from"../support/earthUtils.js";import{computeColorAndIntensity as C,computeVirtualLightDirection as w,computeShadowsEnabled as y,ColorAndIntensity as U}from"../support/sunUtils.js";import{Update as S}from"../webgl-engine/lib/Update.js";import{MainLight as T,AmbientLight as R,FillLight as M}from"../webgl-engine/lighting/Lightsources.js";let W=class extends t.EventedAccessor{constructor(){super(),this._referencePointUpdateDelay=200,this._referencePointUpdateInterval=3e3,this._referencePointUpdateDistThreshold=1e6,this._referencePosUpdateQuery=null,this._referencePosMapCoordsRequested=null,this._viewHandlesKey="viewHandles",this._preserveAbsoluteDateTime=!1,this._trackingEnabled=!1,this._referencePosResetPreserveAbsoluteTime=!1,this._referencePosUpdateTimer=null,this._referencePosMapCoords=null,this._mainLight=new T,this._ambientLight=new R,this._moonLight=new M,this.disableQueries=!1,this._disableWeather=!1,this._renderer=null,this._referencePosWGS84Comparable=null,this._resetReferencePosition()}destroy(){this.disconnectView()}get _view(){return this._renderer?.view}get updating(){return!((this.disableQueries||!this._referencePosUpdateQuery&&!this._referencePosMapCoordsRequested)&&!this._renderer?.updating)}get weatherEnabled(){return this._view?.environment.atmosphereEnabled&&!this._disableWeather&&this._view?.state?.viewingMode===P.Global&&g(this._view.spatialReference)}get weatherVisible(){return this.weatherEnabled&&this._renderer?.weatherVisible}get referencePositionWGS84Comparable(){return this._referencePosWGS84Comparable}connectView(e){if(this._renderer)return;this._renderer=new v({view:e});const t=()=>this._updateRenderParameters(),r=()=>this._cameraHandler();this.addHandles([s((()=>e.environment.lighting),(e=>this._updateLightingHandler(e)),n),s((()=>"virtual"!==e.environment.lighting.type?e.environment.lighting.date:null),(e=>this._lightingDateHandler(e)),n),s((()=>e.stationary),(()=>this._interactingStationaryHandler())),s((()=>e.environment.lighting.directShadowsEnabled),t,n),s((()=>e.qualitySettings.ambientOcclusion),t,n),s((()=>e.qualitySettings.reflections),t,n),s((()=>e.spatialReference),(()=>this._resetReferencePosition(!0)),n),s((()=>e.environment.weather.type),(()=>this._updateLighting(null,S.Faded)),n),s((()=>this.weatherEnabled),(()=>this._updateLighting(null,S.Faded)),n),s((()=>e.viewingMode),(()=>this._resetReferencePosition(!0)),o),s((()=>"virtual"!==e.environment.lighting.type&&e.environment.lighting.cameraTrackingEnabled),(e=>this._updateCameraTracking(e)),o),s((()=>e.state.camera),r,o),s((()=>this.disableQueries),r)],this._viewHandlesKey),this._updateRenderParameters(),this._updateLighting(),this._cameraHandler(),this.notifyChange("updating")}disconnectView(){this.removeHandles(this._viewHandlesKey),this._resetReferencePosition(),this._renderer=r(this._renderer)}_updateLightingHandler(e){this._updateCameraTracking("virtual"!==e.type&&e.cameraTrackingEnabled),this._lightingDateHandler("virtual"!==e.type?e.date:null),this._updateRenderParameters()}_updateCameraTracking(e){if(this._trackingEnabled=e,e)this._cameraHandler();else{const e=this._view.environment.lighting;"virtual"!==e?.type&&(e.positionTimezoneInfo.autoUpdated=!1)}}_lightingDateHandler(e){const t=this._view.environment.lighting;if("virtual"!==t?.type){if(e){if(!t.positionTimezoneInfo.autoUpdated){this._preserveAbsoluteDateTime=!0;const r=this._view.spatialReference;if(!m(r)){const e=this._view.camera.position;if(!this._referencePosMapCoords||!this._referencePosMapCoords.equals(e))return void this._requestReferencePositionUpdate(e)}if(this._preupdateTracking(e),null!=this._referencePosWGS84Comparable){const e=b(this._referencePosWGS84Comparable,j);null!=e&&(t.autoUpdate(null,e),this._trackingEnabled&&(t.positionTimezoneInfo.autoUpdated=!0))}}this._updateLighting(e)}}else this._updateLighting()}_preupdateTracking(e){!this._trackingEnabled&&"virtual"!==this._view.environment.lighting.type&&this._view.environment.lighting.cameraTrackingEnabled&&this._cameraHandler(e)}_cameraHandler(e=null){const t=this._view;if(!t.ready)return;const r=t.stateManager.camera;r&&(this._cameraHandlerClientSide(r,e)||this._cameraHandlerServerSide(r))}_cameraHandlerClientSide(e,t){const r=g(this._view.spatialReference);if(r&&!m(this._view.spatialReference))return"virtual"===this._view.environment.lighting.type&&this._updateLighting(),!1;const i=e.position;return null==this._referencePosWGS84Comparable&&(this._referencePosWGS84Comparable=_()),r?f(i,this._referencePosWGS84Comparable):d(this._referencePosWGS84Comparable,i.longitude??0,i.latitude??0,i.z??0),this.notifyChange("referencePositionWGS84Comparable"),this._autoUpdateTimezone(this._referencePosWGS84Comparable,t)||this._updateLighting(t),!0}_cameraHandlerServerSide(e){const t=e.position;(!this._referencePosMapCoords||this._referencePosMapCoordsRequested||this._exceedsReferencePosDistThreshold(t))&&this._requestReferencePositionUpdate(t,!0),this._view.mapCoordsHelper&&this._referencePosWGS84Comparable&&(this._referencePosWGS84Comparable[2]=(t.z??0)*this._view.mapCoordsHelper.unitInMeters,this._referencePosChanged())}_interactingStationaryHandler(){this._view.stationary&&this._executePendingReferencePositionUpdate()}_updateLighting(e,t=S.Immediate){const r=this._view;e=e||("virtual"===r.environment.lighting.type?null:r.environment.lighting.date);const i=this._referencePosWGS84Comparable,s=i?H:G,n=this.weatherVisible?r.environment.weather.type:"disabled";null!=i?C(e,i,r.state.viewingMode,n,r.state.camera,s):"virtual"===r.environment.lighting.type&&w(r.state.camera,r.state.viewingMode,s.direct.directionToLightSource);const o=this._mainLight,a=s.direct;l(o.intensity,a.color,a.intensity*Math.PI),c(o.direction,a.directionToLightSource),o.specularStrength=s.specularStrength,o.environmentStrength=s.environmentStrength;const h=this._ambientLight;l(h.intensity,s.ambient.color,s.ambient.intensity);const d=this._moonLight;p(d.intensity,q,E,s.globalFactor);const _=(1-.5*s.globalFactor)*(1-.4*s.noonFactor*(1-s.globalFactor));l(d.intensity,d.intensity,_),c(d.direction,a.directionToLightSource),this._renderer.updateLightSources([o,h,d],s.noonFactor,s.globalFactor,t),this._updateRenderParameters()}_autoUpdateTimezone(e,t=null){if("virtual"===this._view.environment.lighting.type||!this._view.environment.lighting.cameraTrackingEnabled||null==e)return!1;const r=L;r.setTime((t||this._view.environment.lighting.date).getTime());const i=b(e,j);if(null==i)return!1;let s=this._view.environment.lighting.positionTimezoneInfo;if(s.autoUpdated){if(s.hours===i.hours&&s.minutes===i.minutes&&s.seconds===i.seconds)return!1}else s=i;const n=r.getUTCHours()-(i.hours-s.hours),o=r.getUTCMinutes()-(i.minutes-s.minutes),a=r.getUTCSeconds()-(i.seconds-s.seconds);return r.setUTCHours(n),r.setUTCMinutes(o),r.setUTCSeconds(a),!t&&this._view.environment.lighting.autoUpdate(r,i)}_updateRenderParameters(){const e=this._view._stage;if(!e)return;const t=null==this._referencePosWGS84Comparable||y(this._referencePosWGS84Comparable[2],this._view.state.viewingMode);e.renderer.setParameters({shadowMap:this._view.environment.lighting.directShadowsEnabled&&t,environment:this._view.environment,weatherVisible:this._view.environmentManager.weatherVisible,qualitySettings:this._view.qualitySettings})}_resetReferencePosition(e=!1){this._cancelReferencePosUpdates(),this._referencePosMapCoords=null,this._referencePosMapCoordsRequested=null,this._referencePosResetPreserveAbsoluteTime=null,this._referencePosWGS84Comparable=null,this.notifyChange("updating"),e&&this._cameraHandler()}_requestReferencePositionUpdate(e,t=!1){if(!this.disableQueries&&(this._referencePosMapCoordsRequested?this._referencePosMapCoordsRequested.copy(e):this._referencePosMapCoordsRequested=e.clone(),this._referencePosResetPreserveAbsoluteTime=!!t,!this._referencePosUpdateQuery&&!this._referencePosUpdateTimer&&this._view.stationary)){const e=this._referencePosUpdateQuery=i(this._referencePointUpdateDelay).then((()=>{if(this._referencePosUpdateQuery===e){const t=()=>this._referencePosUpdateQuery!==e;return this._doReferencePositionUpdateQuery(t)}})).catch((e=>{"mapcoordshelper:missing-geometry-service"===e.name&&(this.disableQueries=!0)})).then((()=>{this._referencePosUpdateQuery===e&&(this._referencePosUpdateQuery=null,this._referencePosUpdateTimer||this._executePendingReferencePositionUpdate(),this.notifyChange("updating"))})),t=this._referencePosUpdateTimer=i(this._referencePointUpdateInterval).then((()=>{this._referencePosUpdateTimer===t&&(this._referencePosUpdateTimer=null,this._referencePosUpdateQuery||this._executePendingReferencePositionUpdate())}));this.notifyChange("updating")}}async _doReferencePositionUpdateQuery(e){this._referencePosResetPreserveAbsoluteTime&&(this._preserveAbsoluteDateTime=!1),this._referencePosMapCoords?this._referencePosMapCoords.copy(this._referencePosMapCoordsRequested):this._referencePosMapCoords=this._referencePosMapCoordsRequested.clone(),this._referencePosResetPreserveAbsoluteTime=null,this._referencePosMapCoordsRequested=null;const t=await this._view.mapCoordsHelper.toGeographic(this._referencePosMapCoords);if(!e()&&!isNaN(t[0])&&!isNaN(t[1])){const e=(this._referencePosMapCoords.z??0)*this._view.mapCoordsHelper.unitInMeters;this._referencePosWGS84Comparable?(this._referencePosWGS84Comparable[0]=t[0],this._referencePosWGS84Comparable[1]=t[1],this._referencePosWGS84Comparable[2]=e):this._referencePosWGS84Comparable=[t[0],t[1],e],this._referencePosChanged()}}_executePendingReferencePositionUpdate(){const e=this._referencePosMapCoordsRequested;e&&this._requestReferencePositionUpdate(e,this._referencePosResetPreserveAbsoluteTime)}_referencePosChanged(){this._preserveAbsoluteDateTime?this._updateLighting():this._autoUpdateTimezone(this._referencePosWGS84Comparable)||this._updateLighting(),this.notifyChange("referencePositionWGS84Comparable")}_exceedsReferencePosDistThreshold(e){if(this._referencePosMapCoords){let t=this._referencePosMapCoords.distance(e);return this._view.mapCoordsHelper&&(t*=this._view.mapCoordsHelper.unitInMeters),t>this._referencePointUpdateDistThreshold}return!0}_cancelReferencePosUpdates(){const e=!!this._referencePosUpdateQuery;return this._referencePosUpdateQuery=null,this._referencePosUpdateTimer=null,e}get test(){const e=this;return{get renderer(){return e._renderer},set referencePointUpdateInterval(t){e._referencePointUpdateInterval=t},set referencePointUpdateDistThreshold(t){e._referencePointUpdateDistThreshold=t},set referencePosUpdateTimer(t){e._referencePosUpdateTimer=t},set referencePointUpdateDelay(t){e._referencePointUpdateDelay=t},set disableWeather(t){e._disableWeather=t}}}};e([a({type:Boolean,readOnly:!0})],W.prototype,"updating",null),e([a()],W.prototype,"disableQueries",void 0),e([a()],W.prototype,"_disableWeather",void 0),e([a()],W.prototype,"weatherEnabled",null),e([a()],W.prototype,"weatherVisible",null),e([a()],W.prototype,"referencePositionWGS84Comparable",null),e([a()],W.prototype,"_renderer",void 0),e([a()],W.prototype,"_referencePosWGS84Comparable",void 0),W=e([h("esri.views.3d.environment.SceneViewEnvironmentManager")],W);const H=new U,G=new U,L=new Date,j={hours:0,minutes:0,seconds:0},q=u(.22,.22,.33),E=u(.22,.22,.22);export{W as SceneViewEnvironmentManager};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Evented.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{after as i}from"../../../core/promiseUtils.js";import{watch as s,sync as n,syncAndInitial as o}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{s as d,h as l,c,m as p}from"../../../chunks/vec32.js";import{create as _,fromValues as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectToWGS84ComparableLonLat as m}from"../../../geometry/projection.js";import{projectPointToWGS84ComparableLonLat as f}from"../../../geometry/projection/projectPointToWGS84ComparableLonLat.js";import{isEarth as g}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as P}from"../../ViewingMode.js";import{EnvironmentRenderer as v}from"./EnvironmentRenderer.js";import{positionToTimezoneInfo as b}from"../support/earthUtils.js";import{computeColorAndIntensity as C,computeVirtualLightDirection as w,computeShadowsEnabled as y,ColorAndIntensity as U}from"../support/sunUtils.js";import{Update as S}from"../webgl-engine/lib/Update.js";import{MainLight as T,AmbientLight as R,FillLight as M}from"../webgl-engine/lighting/Lightsources.js";let W=class extends t.EventedAccessor{constructor(){super(),this._referencePointUpdateDelay=200,this._referencePointUpdateInterval=3e3,this._referencePointUpdateDistThreshold=1e6,this._referencePosUpdateQuery=null,this._referencePosMapCoordsRequested=null,this._viewHandlesKey="viewHandles",this._preserveAbsoluteDateTime=!1,this._trackingEnabled=!1,this._referencePosResetPreserveAbsoluteTime=!1,this._referencePosUpdateTimer=null,this._referencePosMapCoords=null,this._mainLight=new T,this._ambientLight=new R,this._moonLight=new M,this.disableQueries=!1,this._disableWeather=!1,this._renderer=null,this._referencePosWGS84Comparable=null,this._resetReferencePosition()}destroy(){this.disconnectView()}get _view(){return this._renderer?.view}get updating(){return!((this.disableQueries||!this._referencePosUpdateQuery&&!this._referencePosMapCoordsRequested)&&!this._renderer?.updating)}get weatherEnabled(){return this._view?.environment.atmosphereEnabled&&!this._disableWeather&&this._view?.state?.viewingMode===P.Global&&g(this._view.spatialReference)}get weatherVisible(){return this.weatherEnabled&&this._renderer?.weatherVisible}get referencePositionWGS84Comparable(){return this._referencePosWGS84Comparable}connectView(e){if(this._renderer)return;this._renderer=new v({view:e});const t=()=>this._updateRenderParameters(),r=()=>this._cameraHandler();this.addHandles([s((()=>e.environment.lighting),(e=>this._updateLightingHandler(e)),n),s((()=>"virtual"!==e.environment.lighting.type?e.environment.lighting.date:null),(e=>this._lightingDateHandler(e)),n),s((()=>e.stationary),(()=>this._interactingStationaryHandler())),s((()=>e.environment.lighting.directShadowsEnabled),t,n),s((()=>e.qualitySettings.ambientOcclusion),t,n),s((()=>e.qualitySettings.reflections),t,n),s((()=>e.spatialReference),(()=>this._resetReferencePosition(!0)),n),s((()=>e.environment.weather.type),(()=>this._updateLighting(null,S.Faded)),n),s((()=>this.weatherEnabled),(()=>this._updateLighting(null,S.Faded)),n),s((()=>e.viewingMode),(()=>this._resetReferencePosition(!0)),o),s((()=>"virtual"!==e.environment.lighting.type&&e.environment.lighting.cameraTrackingEnabled),(e=>this._updateCameraTracking(e)),o),s((()=>e.state.camera),r,o),s((()=>this.disableQueries),r)],this._viewHandlesKey),this._updateRenderParameters(),this._updateLighting(),this._cameraHandler(),this.notifyChange("updating")}disconnectView(){this.removeHandles(this._viewHandlesKey),this._resetReferencePosition(),this._renderer=r(this._renderer)}_updateLightingHandler(e){this._updateCameraTracking("virtual"!==e.type&&e.cameraTrackingEnabled),this._lightingDateHandler("virtual"!==e.type?e.date:null),this._updateRenderParameters()}_updateCameraTracking(e){if(this._trackingEnabled=e,e)this._cameraHandler();else{const e=this._view.environment.lighting;"virtual"!==e?.type&&(e.positionTimezoneInfo.autoUpdated=!1)}}_lightingDateHandler(e){const t=this._view.environment.lighting;if("virtual"!==t?.type){if(e){if(!t.positionTimezoneInfo.autoUpdated){this._preserveAbsoluteDateTime=!0;const r=this._view.spatialReference;if(!m(r)){const e=this._view.camera.position;if(!this._referencePosMapCoords||!this._referencePosMapCoords.equals(e))return void this._requestReferencePositionUpdate(e)}if(this._preupdateTracking(e),null!=this._referencePosWGS84Comparable){const e=b(this._referencePosWGS84Comparable,j);null!=e&&(t.autoUpdate(null,e),this._trackingEnabled&&(t.positionTimezoneInfo.autoUpdated=!0))}}this._updateLighting(e)}}else this._updateLighting()}_preupdateTracking(e){!this._trackingEnabled&&"virtual"!==this._view.environment.lighting.type&&this._view.environment.lighting.cameraTrackingEnabled&&this._cameraHandler(e)}_cameraHandler(e=null){const t=this._view;if(!t.ready)return;const r=t.stateManager.camera;r&&(this._cameraHandlerClientSide(r,e)||this._cameraHandlerServerSide(r))}_cameraHandlerClientSide(e,t){const r=g(this._view.spatialReference);if(r&&!m(this._view.spatialReference))return"virtual"===this._view.environment.lighting.type&&this._updateLighting(),!1;const i=e.position;return null==this._referencePosWGS84Comparable&&(this._referencePosWGS84Comparable=_()),r?f(i,this._referencePosWGS84Comparable):d(this._referencePosWGS84Comparable,i.longitude??0,i.latitude??0,i.z??0),this.notifyChange("referencePositionWGS84Comparable"),this._autoUpdateTimezone(this._referencePosWGS84Comparable,t)||this._updateLighting(t),!0}_cameraHandlerServerSide(e){const t=e.position;(!this._referencePosMapCoords||this._referencePosMapCoordsRequested||this._exceedsReferencePosDistThreshold(t))&&this._requestReferencePositionUpdate(t,!0),this._view.mapCoordsHelper&&this._referencePosWGS84Comparable&&(this._referencePosWGS84Comparable[2]=(t.z??0)*this._view.mapCoordsHelper.unitInMeters,this._referencePosChanged())}_interactingStationaryHandler(){this._view.stationary&&this._executePendingReferencePositionUpdate()}_updateLighting(e,t=S.Immediate){const r=this._view;e=e||("virtual"===r.environment.lighting.type?null:r.environment.lighting.date);const i=this._referencePosWGS84Comparable,s=i?H:G,n=this.weatherVisible?r.environment.weather.type:"disabled";null!=i?C(e,i,r.state.viewingMode,n,r.state.camera,s):"virtual"===r.environment.lighting.type&&w(r.state.camera,r.state.viewingMode,s.direct.directionToLightSource);const o=this._mainLight,a=s.direct;l(o.intensity,a.color,a.intensity*Math.PI),c(o.direction,a.directionToLightSource),o.specularStrength=s.specularStrength,o.environmentStrength=s.environmentStrength;const h=this._ambientLight;l(h.intensity,s.ambient.color,s.ambient.intensity);const d=this._moonLight;p(d.intensity,q,E,s.globalFactor);const _=(1-.5*s.globalFactor)*(1-.4*s.noonFactor*(1-s.globalFactor));l(d.intensity,d.intensity,_),c(d.direction,a.directionToLightSource),this._renderer.updateLightSources([o,h,d],s.noonFactor,s.globalFactor,t),this._updateRenderParameters()}_autoUpdateTimezone(e,t=null){if("virtual"===this._view.environment.lighting.type||!this._view.environment.lighting.cameraTrackingEnabled||null==e)return!1;const r=L;r.setTime((t||this._view.environment.lighting.date).getTime());const i=b(e,j);if(null==i)return!1;let s=this._view.environment.lighting.positionTimezoneInfo;if(s.autoUpdated){if(s.hours===i.hours&&s.minutes===i.minutes&&s.seconds===i.seconds)return!1}else s=i;const n=r.getUTCHours()-(i.hours-s.hours),o=r.getUTCMinutes()-(i.minutes-s.minutes),a=r.getUTCSeconds()-(i.seconds-s.seconds);return r.setUTCHours(n),r.setUTCMinutes(o),r.setUTCSeconds(a),!t&&this._view.environment.lighting.autoUpdate(r,i)}_updateRenderParameters(){const e=this._view._stage;if(!e)return;const t=null==this._referencePosWGS84Comparable||y(this._referencePosWGS84Comparable[2],this._view.state.viewingMode);e.renderer.setParameters({shadowMap:this._view.environment.lighting.directShadowsEnabled&&t,environment:this._view.environment,weatherVisible:this._view.environmentManager.weatherVisible,qualitySettings:this._view.qualitySettings})}_resetReferencePosition(e=!1){this._cancelReferencePosUpdates(),this._referencePosMapCoords=null,this._referencePosMapCoordsRequested=null,this._referencePosResetPreserveAbsoluteTime=null,this._referencePosWGS84Comparable=null,this.notifyChange("updating"),e&&this._cameraHandler()}_requestReferencePositionUpdate(e,t=!1){if(!this.disableQueries&&(this._referencePosMapCoordsRequested?this._referencePosMapCoordsRequested.copy(e):this._referencePosMapCoordsRequested=e.clone(),this._referencePosResetPreserveAbsoluteTime=!!t,!this._referencePosUpdateQuery&&!this._referencePosUpdateTimer&&this._view.stationary)){const e=this._referencePosUpdateQuery=i(this._referencePointUpdateDelay).then((()=>{if(this._referencePosUpdateQuery===e){const t=()=>this._referencePosUpdateQuery!==e;return this._doReferencePositionUpdateQuery(t)}})).catch((e=>{"mapcoordshelper:missing-geometry-service"===e.name&&(this.disableQueries=!0)})).then((()=>{this._referencePosUpdateQuery===e&&(this._referencePosUpdateQuery=null,this._referencePosUpdateTimer||this._executePendingReferencePositionUpdate(),this.notifyChange("updating"))})),t=this._referencePosUpdateTimer=i(this._referencePointUpdateInterval).then((()=>{this._referencePosUpdateTimer===t&&(this._referencePosUpdateTimer=null,this._referencePosUpdateQuery||this._executePendingReferencePositionUpdate())}));this.notifyChange("updating")}}async _doReferencePositionUpdateQuery(e){this._referencePosResetPreserveAbsoluteTime&&(this._preserveAbsoluteDateTime=!1),this._referencePosMapCoords?this._referencePosMapCoords.copy(this._referencePosMapCoordsRequested):this._referencePosMapCoords=this._referencePosMapCoordsRequested.clone(),this._referencePosResetPreserveAbsoluteTime=null,this._referencePosMapCoordsRequested=null;const t=await this._view.mapCoordsHelper.toGeographic(this._referencePosMapCoords);if(!e()&&!isNaN(t[0])&&!isNaN(t[1])){const e=(this._referencePosMapCoords.z??0)*this._view.mapCoordsHelper.unitInMeters;this._referencePosWGS84Comparable?(this._referencePosWGS84Comparable[0]=t[0],this._referencePosWGS84Comparable[1]=t[1],this._referencePosWGS84Comparable[2]=e):this._referencePosWGS84Comparable=[t[0],t[1],e],this._referencePosChanged()}}_executePendingReferencePositionUpdate(){const e=this._referencePosMapCoordsRequested;e&&this._requestReferencePositionUpdate(e,this._referencePosResetPreserveAbsoluteTime)}_referencePosChanged(){this._preserveAbsoluteDateTime?this._updateLighting():this._autoUpdateTimezone(this._referencePosWGS84Comparable)||this._updateLighting(),this.notifyChange("referencePositionWGS84Comparable")}_exceedsReferencePosDistThreshold(e){if(this._referencePosMapCoords){let t=this._referencePosMapCoords.distance(e);return this._view.mapCoordsHelper&&(t*=this._view.mapCoordsHelper.unitInMeters),t>this._referencePointUpdateDistThreshold}return!0}_cancelReferencePosUpdates(){const e=!!this._referencePosUpdateQuery;return this._referencePosUpdateQuery=null,this._referencePosUpdateTimer=null,e}get test(){const e=this;return{get renderer(){return e._renderer},set referencePointUpdateInterval(t){e._referencePointUpdateInterval=t},set referencePointUpdateDistThreshold(t){e._referencePointUpdateDistThreshold=t},set referencePosUpdateTimer(t){e._referencePosUpdateTimer=t},set referencePointUpdateDelay(t){e._referencePointUpdateDelay=t},set disableWeather(t){e._disableWeather=t}}}};e([a({type:Boolean,readOnly:!0})],W.prototype,"updating",null),e([a()],W.prototype,"disableQueries",void 0),e([a()],W.prototype,"_disableWeather",void 0),e([a()],W.prototype,"weatherEnabled",null),e([a()],W.prototype,"weatherVisible",null),e([a()],W.prototype,"referencePositionWGS84Comparable",null),e([a()],W.prototype,"_renderer",void 0),e([a()],W.prototype,"_referencePosWGS84Comparable",void 0),W=e([h("esri.views.3d.environment.SceneViewEnvironmentManager")],W);const H=new U,G=new U,L=new Date,j={hours:0,minutes:0,seconds:0},q=u(.22,.22,.33),E=u(.22,.22,.22);export{W as SceneViewEnvironmentManager};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../Color.js";import{multiplyOpacity as n}from"../../../core/colorUtils.js";import"../../../core/has.js";import{destroyHandle as i}from"../../../core/handleUtils.js";import{
|
|
5
|
+
import e from"../../../Color.js";import{multiplyOpacity as n}from"../../../core/colorUtils.js";import"../../../core/has.js";import{destroyHandle as i}from"../../../core/handleUtils.js";import{m as t}from"../../../chunks/vec32.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectVectorToVector as o}from"../../../geometry/projection/projectVectorToVector.js";import{onTheGroundElevationInfo as a,absoluteHeightElevationInfo as l}from"../../../support/elevationInfoUtils.js";import{ExtendedLineVisualElement as s,ExtensionType as c}from"./visualElements/ExtendedLineVisualElement.js";import{ParallelLineVisualElement as p}from"./visualElements/ParallelLineVisualElement.js";import{PointVisualElement as d}from"./visualElements/PointVisualElement.js";import{RightAngleQuadVisualElement as m}from"./visualElements/RightAngleQuadVisualElement.js";import{DrapedRenderGroup as u}from"../layers/interfaces.js";import{RenderOccludedFlag as f}from"../webgl-engine/lib/Material.js";import{toDehydratedPoint as g,create as v}from"../../interactive/sketch/normalizedPoint.js";import{defaults as h}from"../../interactive/snapping/Settings.js";import{SnappingDomain as E}from"../../interactive/snapping/SnappingDomain.js";import{LineSegmentHintType as C}from"../../interactive/snapping/snappingUtils.js";import{SnappingVisualizer as S}from"../../interactive/snapping/SnappingVisualizer.js";import{LineSnappingHint as j}from"../../interactive/snapping/hints/LineSnappingHint.js";import{vectorToRender as w}from"../../interactive/support/viewUtils.js";class O extends S{sortUniqueHints(e){return e.sort(((e,n)=>(n instanceof j?n.length:0)-(e instanceof j?e.length:0)))}visualizeIntersectionPoint(e,n){const{spatialReference:t,view:r}=n,o=D(n);return i(new d({view:r,primitive:"circle",geometry:g(e.intersectionPoint,t),elevationInfo:e.isDraped?a:l,size:20,outlineSize:2,color:o.intersectionPointColor,outlineColor:o.intersectionPointOutlineColor,pixelSnappingEnabled:!1,isDecoration:!0,attached:!0}))}visualizePoint(e,n){const{view:t,spatialReference:r}=n,o=D(n),a=R(e.point,e.domain,n);return i(new d({view:t,primitive:"circle",geometry:g(a,r),elevationInfo:x(e,n),size:20,outlineSize:2,color:o.pointColor,outlineColor:o.pointOutlineColor,pixelSnappingEnabled:!1,isDecoration:!0,attached:!0}))}visualizeLine(e,n){const{view:t,spatialReference:r}=n,o=D(n),a=R(e.lineStart,e.domain,n),l=R(e.lineEnd,e.domain,n);return i(this._createLineSegmentHint(e.type,a,l,r,x(e,n),t,o,e.isDraped,e.fadeLeft,e.fadeRight))}visualizeParallelSign(e,n){const{view:r,spatialReference:o}=n,a=D(n),{isDraped:l}=e,s=x(e,n),c=R(e.lineStart,e.domain,n),d=R(e.lineEnd,e.domain,n),m=H(c,o,s,r,l),g=H(d,o,s,r,l),v=t(g,m,g,.5),E=new p({view:r,attached:!1,offset:h.parallelLineHintOffset,length:h.parallelLineHintLength,width:h.parallelLineHintWidth,color:a.parallelSignColor,location:v,renderOccluded:l?f.OccludeAndTransparent:f.Opaque,isDraped:l,renderGroup:u.SnappingHint,isDecoration:!0});return E.setDirectionFromPoints(m,v),E.attached=!0,i(E)}visualizeRightAngleQuad(e,n){const{view:t,spatialReference:r}=n,o=D(n),a=x(e,n),{isDraped:l}=e,s=R(e.previousVertex,e.domain,n),c=R(e.centerVertex,e.domain,n),p=R(e.nextVertex,e.domain,n),d=H(s,r,a,t,l),g=H(c,r,a,t,l),v=H(p,r,a,t,l);return i(new m({view:t,attached:!0,color:l?o.rightAngleColorDraped:o.rightAngleColor,renderOccluded:l?f.OccludeAndTransparent:f.Transparent,outlineRenderOccluded:l?f.OccludeAndTransparent:f.Opaque,outlineColor:o.rightAngleOutlineColor,outlineSize:h.rightAngleHintOutlineSize,size:h.rightAngleHintSize,isDraped:l,geometry:{previous:d,center:g,next:v},renderGroup:u.SnappingHint,isDecoration:!0}))}_createLineSegmentHint(e,n,i,t,r,o,a,l=!1,p=!0,d=!0){const m=H(n,t,r,o,l),g=H(i,t,r,o,l),v=new s({view:o,extensionType:c.FADED,start:m,end:g,isDraped:l,color:a.lineColor,renderOccluded:l?f.OccludeAndTransparent:f.Opaque,renderGroup:u.SnappingHint,isDecoration:!0});switch(e){case C.TARGET:v.width=h.lineHintWidthTarget,v.fadedExtensions={start:0,end:h.lineHintFadedExtensions};break;case C.REFERENCE_EXTENSION:v.width=h.lineHintWidthReference,v.fadedExtensions={start:0,end:0};break;case C.REFERENCE:v.width=h.lineHintWidthReference,v.fadedExtensions={start:p?h.lineHintFadedExtensions:0,end:d?h.lineHintFadedExtensions:0}}return v.attached=!0,v}}function D(i){const{effectiveTheme:t}=i.view,r=e.toUnitRGBA(t.accentColor),o=[0,0,0,0];return{intersectionPointColor:o,intersectionPointOutlineColor:r,pointColor:o,pointOutlineColor:r,lineColor:r,lineOutlineColor:void 0,parallelSignColor:r,rightAngleColor:r,rightAngleColorDraped:e.toUnitRGBA(n(t.accentColor,.5)),rightAngleOutlineColor:r}}function R(e,n,i){const t=A(n,i);return null==t?e:v(e[0],e[1],t)}function x(e,n){return null!=A(e.domain,n)?n.selfSnappingZ.elevationInfo:e.isDraped?a:l}function A(e,{selfSnappingZ:n}){return e===E.SELF&&null!=n?n.value:null}function H(e,n,i,t,a){const l=r();if(a){const i=t.basemapTerrain.overlayManager.renderer.spatialReference;o(e,n,l,i)}else w(e,n,i,t,l);return l}export{O as SnappingVisualizer3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../geometry.js";import{screenPointObjectToArray as e,castScreenPointArray as n,createScreenPointArray as r}from"../../../../core/screenUtils.js";import{l as t,c as o,b as l,f as s,
|
|
5
|
+
import"../../../../geometry.js";import{screenPointObjectToArray as e,castScreenPointArray as n,createScreenPointArray as r}from"../../../../core/screenUtils.js";import{l as t,c as o,b as l,f as s,k as c,h as i,g as a}from"../../../../chunks/vec32.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectPoint as p}from"../../../../geometry/projection.js";import{intersectRay as m,create as d,getNormal as f,fromPositionAndNormal as g}from"../../../../geometry/support/plane.js";import{create as y}from"../../../../geometry/support/ray.js";import{projectPoint as E}from"../../../../geometry/support/vector.js";import{sv2d as S}from"../../../../geometry/support/vectorStacks.js";import{getZForElevationMode as j,getGraphicEffectiveElevationInfo as R}from"../../../../support/elevationInfoUtils.js";import{fromScreen as v}from"../../support/geometryUtils/ray.js";import{newIntersector as x}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as b,IntersectorType as w}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{terrainId as I}from"../../webgl-engine/lib/verticalOffsetUtils.js";import{EventPipeline as H}from"../../../interactive/dragEventPipeline.js";import U from"../../../../geometry/Point.js";function O(e,n){return P(e,(()=>n))}function C(e){return P(e,(e=>e.plane))}function P(r,t){const o=u(),l=u();let s=!1;return c=>{const i=t(c);if("start"===c.action){const t=e(c.screenStart,n(S.get())),l=v(r.state.camera,t,K);null!=l&&(s=m(i,l,o))}if(!s)return null;const a=e(c.screenEnd,n(S.get())),u=v(r.state.camera,a,K);return null==u?null:m(i,u,l)?{...c,renderStart:o,renderEnd:l,plane:i,ray:u}:null}}function T(e,n,t=0,o=null,l=null){let s=null;return c=>{if("start"===c.action&&(s=e.sceneIntersectionHelper.intersectElevationFromScreen(r(c.screenStart.x,c.screenStart.y),n,t,l),null!=s&&null!=o&&!p(s,s,o)))return null;if(null==s)return null;const i=e.sceneIntersectionHelper.intersectElevationFromScreen(r(c.screenEnd.x,c.screenEnd.y),n,t,l);return null!=i&&(null==o||p(i,i,o))?{...c,mapStart:s,mapEnd:i}:null}}function D(e,n,r,t=null,o=null){return T(e,r,j(n,e,r),t,o)}function M(e,n,r,t=null,o=null){return D(e,r,R(n),t,o)}function N(e,n,r,t){const o=n.toMap(e.screenStart,{include:[r]});return null!=o?M(n,r,o,t):null}function h(e,n){const r=B,t=J,o=d();e.renderCoordsHelper.worldUpAtPosition(n,r);const c=l(f(o),r,s(t,n,e.state.camera.eye));return l(c,c,r),g(n,c,o)}function k(e,n,r){let t=null;const o=new H;return o.next(O(e,h(e,n))).next(G(e,n)).next(A(e,r)).next((e=>{e.mapEnd.x=e.mapStart.x,e.mapEnd.y=e.mapStart.y,t=e})),e=>(t=null,o.execute(e),t)}function G(e,n){const r=u(),l=t(n);e.renderCoordsHelper.worldUpAtPosition(n,r);const p=u(),m=u(),d=o=>{if(s(o,o,n),E(r,o,o),"global"===e.viewingMode){t(o)*Math.sign(c(r,o))<.001-l&&s(o,i(o,r,.001),n)}return a(o,o,n),o};return e=>(e.renderStart=d(o(p,e.renderStart)),e.renderEnd=d(o(m,e.renderEnd)),e)}function A(e,n){const r=e.renderCoordsHelper;return e=>{const t=r.fromRenderCoords(e.renderStart,new U({spatialReference:n})),o=r.fromRenderCoords(e.renderEnd,new U({spatialReference:n}));return null!=t&&null!=o?{...e,mapStart:t,mapEnd:o}:null}}var F;function q(e){let n=null;return r=>{switch(r.action){case"start":n=e.disableDisplay();break;case"end":case"cancel":null!=n&&(n.remove(),n=null)}return r}}function z(n,t=null){const o=x(n.state.viewingMode);o.options.selectionMode=!0,o.options.store=b.MIN,o.options.hud=!1;const l=r(),s={requiresGroundFeedback:!0,enableDraped:!0,exclude:new Set},c=u(),i=t??n.spatialReference,a=r=>{n.map.ground&&n.map.ground.opacity<1?s.exclude.add(I):s.exclude.delete(I),n.sceneIntersectionHelper.intersectIntersectorScreen(e(r,l),o,s);const t=o.results.min;let a;if(t.getIntersectionPoint(c))a=t.intersector===w.TERRAIN?F.GROUND:F.OTHER;else{if(!o.results.ground.getIntersectionPoint(c))return null;a=F.GROUND}return{location:n.renderCoordsHelper.fromRenderCoords(c,new U({spatialReference:i})),surfaceType:a}};let p;return e=>{if("start"===e.action){const n=a(e.screenStart);p=null!=n?n.location:null}if(null==p)return null;const n=a(e.screenEnd);return null!=n?.location?{...e,mapStart:p,mapEnd:n.location,surfaceType:n.surfaceType}:null}}!function(e){e[e.GROUND=0]="GROUND",e[e.OTHER=1]="OTHER"}(F||(F={}));const B=u(),J=u(),K=y();export{F as SurfaceType,A as convertToMapCoordinates,q as hideManipulatorWhileDragging,G as projectToWorldUp,z as screenToMap3D,D as screenToMapXYAtLocation,N as screenToMapXYForGraphic,M as screenToMapXYForGraphicAtLocation,O as screenToRenderPlane,C as screenToRenderPlaneFromEvent,k as screenToZConstrained};
|