@arcgis/core 4.29.0-next.20240222 → 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.
Files changed (279) hide show
  1. package/arcade/treeAnalysis.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{b43fde3e25d0c3b020b5.js → 039a872509872ce67ba4.js} +1 -1
  4. package/assets/esri/core/workers/chunks/0bc21d2a0b65bd4e9d76.js +1 -0
  5. package/assets/esri/core/workers/chunks/{5243f9ff21e768c620c2.js → 23a5d750d93a7829174f.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{47e6119be4a4a5ed640d.js → 2447a4d5886aeb0ff72a.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{7f45a9e9bdbcffc2d6e0.js → 348bcc57b99a975902a8.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{8c9fb2601488998013ba.js → 3523789a2948a4ab8cc8.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{24649b410b757599a549.js → 48db6e0bbb1a9c043193.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{752082be991f1cc8558f.js → 4984e2b79d862114d6a6.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{8d9736fd15cdb54d9855.js → 5227f9eea6988aadad7f.js} +1 -1
  12. package/assets/esri/core/workers/chunks/58723274ef657fe212eb.js +1 -0
  13. package/assets/esri/core/workers/chunks/60ab18c6a04d4b2f1d4c.js +1 -0
  14. package/assets/esri/core/workers/chunks/647515801d94180b8402.js +1 -0
  15. package/assets/esri/core/workers/chunks/6c3ae96ec90e9ed7dd50.js +1 -0
  16. package/assets/esri/core/workers/chunks/7a8bba91769ee18cc39f.js +1 -0
  17. package/assets/esri/core/workers/chunks/7a98d2e026f63a581b1e.js +1 -0
  18. package/assets/esri/core/workers/chunks/8c360923cd1850767d3e.js +1 -0
  19. package/assets/esri/core/workers/chunks/{1a25ba411b89e050fbb7.js → a61f337802ae963d7f65.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{d0c5318d7ef2e923aad0.js → a8ac511280f873960d46.js} +1 -1
  21. package/assets/esri/core/workers/chunks/b125ab84b7761e761734.js +1 -0
  22. package/assets/esri/core/workers/chunks/{b34d6e58b125fe111f91.js → b42a83db83851cb57d44.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{1497dd943df7eede0704.js → b9c55ff1f21db198ce03.js} +1 -1
  24. package/assets/esri/core/workers/chunks/bb3322ddb89c0bd444f0.js +1 -0
  25. package/assets/esri/core/workers/chunks/becfdaeeb07f089d8be7.js +1 -0
  26. package/assets/esri/core/workers/chunks/{b26e39a399963c176d33.js → c527692694688a5b3b07.js} +2 -2
  27. package/assets/esri/core/workers/chunks/{210a93e0b96c5bff44a3.js → c556644bb0cf88770939.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{e7b26c7e9e24dc6255be.js → cacf97b0a7a1057b9f79.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{a5e7b4acae17f88e2208.js → ce93027b6b81428ce9b0.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{b8ece275abac93f3dccf.js → d14f16bfa6c12909929c.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{1594f06a2d7d9439c62e.js → e2147c99cc5839654be1.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{d33ed3a2a0d4b640bd4a.js → e4c7d8c69e4957c9d27c.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{7709248f59520aee6f51.js → eceaa46f622f6fa31128.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{2286db4c83ff1b6fb088.js → ef3e6209e6ac6a56960b.js} +1 -1
  35. package/assets/esri/core/workers/chunks/f59b5ea05caca8a1a398.js +1 -0
  36. package/chunks/Laserlines.glsl.js +3 -3
  37. package/chunks/Precipitation.glsl.js +1 -1
  38. package/chunks/SSAOBlur.glsl.js +2 -2
  39. package/chunks/boundedPlane.js +1 -1
  40. package/chunks/cameraUtilsSpherical.js +1 -1
  41. package/chunks/sphere.js +1 -1
  42. package/chunks/terrainUtilsPlanar.js +1 -1
  43. package/chunks/vec32.js +1 -1
  44. package/config.js +1 -1
  45. package/copyright.txt +56 -28
  46. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  47. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  48. package/core/libs/gl-matrix-2/vec3.js +1 -1
  49. package/geometry/support/axisAngleDegrees.js +1 -1
  50. package/geometry/support/coordinateSystem.js +1 -1
  51. package/geometry/support/lineSegment.js +1 -1
  52. package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
  53. package/geometry/support/meshUtils/georeference.js +1 -1
  54. package/geometry/support/meshUtils/merge.js +1 -1
  55. package/geometry/support/meshUtils/rotate.js +1 -1
  56. package/geometry/support/meshUtils/scale.js +1 -1
  57. package/geometry/support/meshUtils/vertexSpaceConversion.js +5 -0
  58. package/geometry/support/meshVertexSpaceUtils.js +1 -1
  59. package/geometry/support/plane.js +1 -1
  60. package/geometry/support/ray.js +1 -1
  61. package/geometry/support/triangle.js +1 -1
  62. package/geometry/support/vector.js +1 -1
  63. package/interfaces.d.ts +12 -12
  64. package/kernel.js +1 -1
  65. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  66. package/layers/LinkChartLayer.js +1 -1
  67. package/layers/VoxelWasmPerSceneView.js +1 -1
  68. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  69. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  70. package/layers/mixins/FeatureReductionLayer.js +1 -1
  71. package/layers/orientedImagery/core/CameraOrientation.js +1 -1
  72. package/layers/orientedImagery/core/ElevationSourceDefinitions.js +1 -1
  73. package/layers/orientedImagery/core/coverageUtils.js +1 -1
  74. package/layers/orientedImagery/transformations/imageToGroundUtils.js +1 -1
  75. package/layers/orientedImagery/transformations/imageToWorld.js +5 -0
  76. package/layers/orientedImagery/transformations/updateElevation.js +5 -0
  77. package/layers/orientedImagery/transformations/updateElevationUtils.js +5 -0
  78. package/layers/orientedImagery/transformations/utils.js +1 -1
  79. package/layers/orientedImagery/transformations/worldToImage.js +5 -0
  80. package/layers/support/EditingCapabilities.js +1 -1
  81. package/layers/support/editableLayers.js +1 -1
  82. package/layers/support/layerUtils.js +1 -1
  83. package/layers/video/VideoCameraSensorModel.js +1 -1
  84. package/layers/voxel/VoxelVolume.js +1 -1
  85. package/layers/voxel/voxelPlaneUtils.js +1 -1
  86. package/libs/linkchartlayout/LinkChartLayout.js +1 -1
  87. package/package.json +1 -1
  88. package/smartMapping/renderers/pieChart.js +1 -1
  89. package/support/revision.js +1 -1
  90. package/symbols/cim/cimAnalyzer.js +1 -1
  91. package/views/2d/arcade/callExpressionWithCursor.js +1 -1
  92. package/views/2d/engine/webgl/shaderGraph/techniques/createTestMeshData.js +1 -1
  93. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriterInputEvaluator.js +1 -1
  94. package/views/2d/interactive/editingTools/TransformTool.js +1 -1
  95. package/views/2d/interactive/editingTools/manipulations/ScaleManipulation.js +1 -1
  96. package/views/2d/layers/features/Processor.js +1 -1
  97. package/views/2d/layers/features/aggregation/GeohashSpatialIndex.js +1 -1
  98. package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
  99. package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
  100. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
  101. package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
  102. package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
  103. package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
  104. package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
  105. package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
  106. package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
  107. package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
  108. package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
  109. package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
  110. package/views/2d/layers/features/sources/strategies/chunks/DrillDownTileSourceChunk.js +1 -1
  111. package/views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js +1 -1
  112. package/views/2d/layers/features/sources/strategies/chunks/OverrideChunk.js +1 -1
  113. package/views/2d/layers/features/sources/strategies/chunks/PagedTileSourceChunk.js +1 -1
  114. package/views/2d/layers/features/sources/strategies/chunks/StreamSourceChunk.js +1 -1
  115. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  116. package/views/2d/layers/features/support/FeatureMetadata.js +1 -1
  117. package/views/2d/layers/features/support/GraphicsReader.js +1 -1
  118. package/views/2d/layers/features/support/Tile.js +1 -1
  119. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  120. package/views/2d/tiling/TileKey.js +1 -1
  121. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  122. package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
  123. package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
  124. package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
  125. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementController.js +1 -1
  126. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  127. package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
  128. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  129. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  130. package/views/3d/analysis/support/measurementUtils.js +1 -1
  131. package/views/3d/animation/pointToPoint/Camera.js +1 -1
  132. package/views/3d/camera/constraintUtils/common.js +1 -1
  133. package/views/3d/camera/constraintUtils/distance.js +1 -1
  134. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  135. package/views/3d/camera/intersectionUtils.js +1 -1
  136. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  137. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  138. package/views/3d/environment/Fog.js +1 -1
  139. package/views/3d/environment/MarsAtmosphere.js +1 -1
  140. package/views/3d/environment/SceneViewEnvironmentManager.js +1 -1
  141. package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
  142. package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
  143. package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
  144. package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
  145. package/views/3d/interactive/editingTools/reshapeGraphic/edgeOffsetUtils.js +1 -1
  146. package/views/3d/interactive/editingTools/transformGraphic/ExtentScale.js +1 -1
  147. package/views/3d/interactive/editingTools/transformGraphic/extentUtils.js +1 -1
  148. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  149. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  150. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  151. package/views/3d/interactive/visualElements/support/Segment.js +1 -1
  152. package/views/3d/layers/I3SMeshView3D.js +1 -1
  153. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  154. package/views/3d/layers/PointCloudWorker.js +1 -1
  155. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  156. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  157. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  158. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  159. package/views/3d/layers/i3s/I3SOverrides.js +1 -1
  160. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  161. package/views/3d/layers/i3s/LoDUtil.js +1 -1
  162. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  163. package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
  164. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  165. package/views/3d/layers/support/uvUtils.js +1 -1
  166. package/views/3d/state/Frustum.js +1 -1
  167. package/views/3d/state/NearFarHeuristic.js +1 -1
  168. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  169. package/views/3d/state/controllers/RotateController.js +1 -1
  170. package/views/3d/state/controllers/global/PinchAndPanController.js +1 -1
  171. package/views/3d/state/controllers/global/ZoomController.js +1 -1
  172. package/views/3d/state/controllers/global/ZoomStepController.js +1 -1
  173. package/views/3d/state/controllers/local/PinchAndPanController.js +1 -1
  174. package/views/3d/state/controllers/local/ZoomController.js +1 -1
  175. package/views/3d/state/controllers/local/ZoomStepController.js +1 -1
  176. package/views/3d/state/controllers/momentum/ZoomPlanarMomentumController.js +1 -1
  177. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  178. package/views/3d/state/utils/navigationUtils.js +1 -1
  179. package/views/3d/state/utils/viewUtils.js +1 -1
  180. package/views/3d/support/FrustumExtentIntersection.js +1 -1
  181. package/views/3d/support/cameraUtils.js +1 -1
  182. package/views/3d/support/cameraUtilsInternal.js +1 -1
  183. package/views/3d/support/intersectionUtils.js +1 -1
  184. package/views/3d/support/mathUtils.js +1 -1
  185. package/views/3d/support/orientedBoundingBox.js +1 -1
  186. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  187. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  188. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  189. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  190. package/views/3d/support/sunUtils.js +1 -1
  191. package/views/3d/support/viewpointUtils.js +1 -1
  192. package/views/3d/terrain/OverlayManager.js +1 -1
  193. package/views/3d/terrain/PatchRenderData.js +1 -1
  194. package/views/3d/terrain/SphericalPatch.js +1 -1
  195. package/views/3d/terrain/TerrainRenderer.js +1 -1
  196. package/views/3d/terrain/Tile.js +1 -1
  197. package/views/3d/webgl-engine/collections/Component/DepthRange.js +1 -1
  198. package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
  199. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  200. package/views/3d/webgl-engine/core/util/TwoVectorPosition.js +1 -1
  201. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  202. package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
  203. package/views/3d/webgl-engine/lib/Camera.js +1 -1
  204. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  205. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  206. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  207. package/views/3d/webgl-engine/lib/PathVertex.js +1 -1
  208. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  209. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  210. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  211. package/views/3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js +1 -1
  212. package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
  213. package/views/3d/webgl-engine/lib/intersectorUtils.js +1 -1
  214. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  215. package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
  216. package/views/3d/webgl-engine/lighting/SceneLighting.js +1 -1
  217. package/views/3d/webgl-engine/lighting/SphericalHarmonics.js +1 -1
  218. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  219. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  220. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  221. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  222. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  223. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  224. package/views/3d/webgl-engine/materials/pbrUtils.js +1 -1
  225. package/views/SelectionManager.js +1 -1
  226. package/views/draw/support/createUtils.js +1 -1
  227. package/views/draw/support/surfaceCoordinateSystems.js +1 -1
  228. package/views/interactive/GraphicManipulator.js +1 -1
  229. package/views/interactive/SegmentLabels.js +1 -1
  230. package/views/interactive/coordinateHelper.js +1 -1
  231. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  232. package/views/interactive/editGeometry/support/editPlaneUtils.js +1 -1
  233. package/views/interactive/sketch/constraints.js +1 -1
  234. package/views/interactive/snapping/RightAngleSnapper.js +1 -1
  235. package/views/interactive/snapping/candidates/ParallelLineSnappingCandidate.js +1 -1
  236. package/views/interactive/snapping/candidates/RightAngleTriangleSnappingCandidate.js +1 -1
  237. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
  238. package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
  239. package/views/interactive/snapping/hints/IntersectionSnappingHint.js +1 -1
  240. package/views/interactive/snapping/hints/LineSnappingHint.js +1 -1
  241. package/views/interactive/snapping/hints/ParallelSnappingHint.js +1 -1
  242. package/views/interactive/snapping/hints/PointSnappingHint.js +1 -1
  243. package/views/interactive/snapping/hints/RightAngleSnappingHint.js +1 -1
  244. package/views/layers/FeatureLayerView.js +1 -1
  245. package/views/layers/support/editableLayerViews.js +5 -0
  246. package/views/navigation/PanSphericalMomentumEstimator.js +1 -1
  247. package/views/support/angularMeasurementUtils.js +1 -1
  248. package/views/support/euclideanAreaMeasurementUtils.js +1 -1
  249. package/views/support/euclideanLengthMeasurementUtils.js +1 -1
  250. package/views/support/geometry3dUtils.js +1 -1
  251. package/widgets/Editor/EditorViewModel.js +1 -1
  252. package/widgets/Editor/support/EditorEditingCapabilities.js +1 -1
  253. package/widgets/Editor/support/EditorItem.js +1 -1
  254. package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
  255. package/widgets/FeatureForm.js +1 -1
  256. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  257. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  258. package/widgets/FeatureTable/support/ColumnTemplateBase.js +1 -1
  259. package/widgets/Features/FeaturesViewModel.js +1 -1
  260. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  261. package/widgets/OrientedImageryViewer.js +1 -1
  262. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  263. package/widgets/PanoramicViewer/utils.js +1 -1
  264. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  265. package/widgets/UtilityNetworkTrace.js +1 -1
  266. package/widgets/support/Selector2D/SelectionOperation.js +1 -1
  267. package/widgets/support/Selector2D/selectorUtils.js +1 -1
  268. package/assets/esri/core/workers/chunks/0e83f3718a0b45652b5e.js +0 -1
  269. package/assets/esri/core/workers/chunks/1fa5c8af69a09a3730b3.js +0 -1
  270. package/assets/esri/core/workers/chunks/25f73748df0ee82d06cb.js +0 -1
  271. package/assets/esri/core/workers/chunks/2d7a18f8c540269ecee9.js +0 -1
  272. package/assets/esri/core/workers/chunks/4736f79b5c94ce103d43.js +0 -1
  273. package/assets/esri/core/workers/chunks/65f7adaaf1f535310c11.js +0 -1
  274. package/assets/esri/core/workers/chunks/79c041b292648c5eaecc.js +0 -1
  275. package/assets/esri/core/workers/chunks/7c4c2c0beddabac672b6.js +0 -1
  276. package/assets/esri/core/workers/chunks/9a758de08dfa57735879.js +0 -1
  277. package/assets/esri/core/workers/chunks/a4c3da057ec2a07bbbe8.js +0 -1
  278. package/assets/esri/core/workers/chunks/b252270b100351779f1f.js +0 -1
  279. 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{clamp as i}from"../../../../../core/mathUtils.js";import{Milliseconds as e}from"../../../../../core/time.js";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{c as o,f as r,n as a,j as m,l as n,g as c,h,k as p}from"../../../../../chunks/vec32.js";import{create as l,fromValues as _}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{applyAll as C}from"../../../camera/constraintUtils.js";import{ConstraintOptions as f}from"../../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as g}from"../../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as j}from"../../../camera/constraintUtils/InteractionType.js";import{getVoxelWasm as y}from"../../../layers/VoxelWasm.js";import{PointToPointAnimationController as b}from"../PointToPointAnimationController.js";import{contentIntersectorOptions as w,zoomMaxDistanceModifier as u,zoomMinDistanceModifier as v,zoomDistanceModifier as L}from"../../utils/navigationUtils.js";import{Camera as d}from"../../../webgl-engine/lib/Camera.js";import{newIntersector as z}from"../../../webgl-engine/lib/Intersector.js";import{outExpo as R}from"../../../../animation/easing.js";const M=.6,D=4,F=60;let U=class extends b{constructor(){super(...arguments),this._zoomLocation=l(),this._tmpCamera=new d,this._tmpRayDir=l(),this._tmpCenter=l(),this._beginCamera=new d,this._constraintOptions=new f(g.ALL,j.ZOOM,null,this._beginCamera)}zoomStep(t,e){if(!this.active)return;const s=this.view.state;this.animation.finished?this._beginCamera.copyFrom(s.camera):this.animation.cameraAt(1,this._beginCamera),this._tmpCamera.copyFrom(s.camera);const p=z(this.view.state.viewingMode);let _=!1;t>0?(_=this.intersectionHelper.intersectScreenFreePointFallback(e,this._zoomLocation,0===this.view.map.ground.opacity?w:{}),this.intersectionHelper.intersectRay(this._tmpCamera.ray,p,this._tmpCenter)&&(this._tmpCamera.center=this._tmpCenter)):this.intersectionHelper.intersectRay(this._tmpCamera.ray,p,this._zoomLocation)?this._tmpCamera.center=this._zoomLocation:o(this._zoomLocation,this._tmpCamera.center);const C=M**t;let f=this.view._stage.renderView.getMinimalDepthForArea(y(this.view),e[0],e[1],this.view.state.camera,F);r(S,this._tmpCamera.eye,this._zoomLocation),a(S,S);const g=i(Math.min(L,1/Math.abs(m(O,S)))*Math.abs(this.view.camera.position.z),v,u);if(f=null!=f?f:g,f){const t=l();r(t,this._zoomLocation,this._tmpCamera.eye),(f<n(t)||!_)&&(a(t,t),c(this._zoomLocation,this._tmpCamera.eye,h(t,t,f)))}this._updateCamera(this._tmpCamera,C,this._zoomLocation),this.begin(this._tmpCamera)}animationSettings(){return{duration:e(600),easing:R}}_updateCamera(t,i,e){r(this._tmpRayDir,e,t.eye);const s=n(this._tmpRayDir);let o=s*i;const a=i<=1,m=Math.max(D,1.01*t.nearFar[0]);0!==o&&(a&&o<m&&(o=m,i=o/s),Math.abs(s-o)<1e-6||(h(this._tmpRayDir,this._tmpRayDir,i),t.eye=r(x,e,this._tmpRayDir),t.center=p(x,t.center,e,1-i),C(this.view,t,this._constraintOptions)))}};U=t([s("esri.views.3d.state.controllers.local.ZoomStepController")],U);const x=l(),O=_(0,0,1),S=l();export{U as ZoomStepController};
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import{clamp as i}from"../../../../../core/mathUtils.js";import{Milliseconds as e}from"../../../../../core/time.js";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{c as o,f as r,n as a,k as m,l as n,g as c,h,m as p}from"../../../../../chunks/vec32.js";import{create as l,fromValues as _}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{applyAll as C}from"../../../camera/constraintUtils.js";import{ConstraintOptions as f}from"../../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as g}from"../../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as y}from"../../../camera/constraintUtils/InteractionType.js";import{getVoxelWasm as j}from"../../../layers/VoxelWasm.js";import{PointToPointAnimationController as b}from"../PointToPointAnimationController.js";import{contentIntersectorOptions as w,zoomMaxDistanceModifier as u,zoomMinDistanceModifier as v,zoomDistanceModifier as L}from"../../utils/navigationUtils.js";import{Camera as d}from"../../../webgl-engine/lib/Camera.js";import{newIntersector as z}from"../../../webgl-engine/lib/Intersector.js";import{outExpo as R}from"../../../../animation/easing.js";const M=.6,D=4,F=60;let U=class extends b{constructor(){super(...arguments),this._zoomLocation=l(),this._tmpCamera=new d,this._tmpRayDir=l(),this._tmpCenter=l(),this._beginCamera=new d,this._constraintOptions=new f(g.ALL,y.ZOOM,null,this._beginCamera)}zoomStep(t,e){if(!this.active)return;const s=this.view.state;this.animation.finished?this._beginCamera.copyFrom(s.camera):this.animation.cameraAt(1,this._beginCamera),this._tmpCamera.copyFrom(s.camera);const p=z(this.view.state.viewingMode);let _=!1;t>0?(_=this.intersectionHelper.intersectScreenFreePointFallback(e,this._zoomLocation,0===this.view.map.ground.opacity?w:{}),this.intersectionHelper.intersectRay(this._tmpCamera.ray,p,this._tmpCenter)&&(this._tmpCamera.center=this._tmpCenter)):this.intersectionHelper.intersectRay(this._tmpCamera.ray,p,this._zoomLocation)?this._tmpCamera.center=this._zoomLocation:o(this._zoomLocation,this._tmpCamera.center);const C=M**t;let f=this.view._stage.renderView.getMinimalDepthForArea(j(this.view),e[0],e[1],this.view.state.camera,F);r(S,this._tmpCamera.eye,this._zoomLocation),a(S,S);const g=i(Math.min(L,1/Math.abs(m(O,S)))*Math.abs(this.view.camera.position.z),v,u);if(f=null!=f?f:g,f){const t=l();r(t,this._zoomLocation,this._tmpCamera.eye),(f<n(t)||!_)&&(a(t,t),c(this._zoomLocation,this._tmpCamera.eye,h(t,t,f)))}this._updateCamera(this._tmpCamera,C,this._zoomLocation),this.begin(this._tmpCamera)}animationSettings(){return{duration:e(600),easing:R}}_updateCamera(t,i,e){r(this._tmpRayDir,e,t.eye);const s=n(this._tmpRayDir);let o=s*i;const a=i<=1,m=Math.max(D,1.01*t.nearFar[0]);0!==o&&(a&&o<m&&(o=m,i=o/s),Math.abs(s-o)<1e-6||(h(this._tmpRayDir,this._tmpRayDir,i),t.eye=r(x,e,this._tmpRayDir),t.center=p(x,t.center,e,1-i),C(this.view,t,this._constraintOptions)))}};U=t([s("esri.views.3d.state.controllers.local.ZoomStepController")],U);const x=l(),O=_(0,0,1),S=l();export{U as ZoomStepController};
@@ -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{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import{c as e,D as s}from"../../../../../chunks/vec32.js";import{clone as i,create as n}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{InteractionType as m}from"../../../camera/constraintUtils/InteractionType.js";import{MomentumController as c}from"./MomentumController.js";import{applyZoomToPoint as a}from"../../utils/navigationUtils.js";let p=class extends c{set zoomCenter(t){this._set("zoomCenter",i(t))}constructor(t){super(t),this.interactionType=m.ZOOM,this.constraintOptions.interactionDirection=n()}momentumStep(t,o){const{interactionDirection:r}=this.constraintOptions;if(!r)return;e(r,o.eye);const i=this.momentum.valueDelta(0,t);a(o,this.zoomCenter,i,this.view.state.constraints.minimumPoiDistance),s(r,o.eye,r)}};t([o({constructOnly:!0})],p.prototype,"momentum",void 0),t([o({constructOnly:!0})],p.prototype,"zoomCenter",null),p=t([r("esri.views.3d.state.controllers.momentum.ZoomPlanarMomentumController")],p);export{p as ZoomPlanarMomentumController};
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import{c as e,E as s}from"../../../../../chunks/vec32.js";import{clone as i,create as n}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{InteractionType as m}from"../../../camera/constraintUtils/InteractionType.js";import{MomentumController as c}from"./MomentumController.js";import{applyZoomToPoint as a}from"../../utils/navigationUtils.js";let p=class extends c{set zoomCenter(t){this._set("zoomCenter",i(t))}constructor(t){super(t),this.interactionType=m.ZOOM,this.constraintOptions.interactionDirection=n()}momentumStep(t,o){const{interactionDirection:r}=this.constraintOptions;if(!r)return;e(r,o.eye);const i=this.momentum.valueDelta(0,t);a(o,this.zoomCenter,i,this.view.state.constraints.minimumPoiDistance),s(r,o.eye,r)}};t([o({constructOnly:!0})],p.prototype,"momentum",void 0),t([o({constructOnly:!0})],p.prototype,"zoomCenter",null),p=t([r("esri.views.3d.state.controllers.momentum.ZoomPlanarMomentumController")],p);export{p as ZoomPlanarMomentumController};
@@ -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"../../../../core/PooledArray.js";import{castRenderScreenPointArray3 as t,createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{getMetersPerVerticalUnitForSR as n}from"../../../../core/unitUtils.js";import{g as i,n as s,j as o}from"../../../../chunks/vec32.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as c,copy as a,negativeInfinity as u,width as h,height as d,expandPointInPlace as p}from"../../../../geometry/support/aaBoundingRect.js";import{create as m}from"../../../../geometry/support/ray.js";import{sv3d as y}from"../../../../geometry/support/vectorStacks.js";import{getElevationOffsetInMeters as f}from"../../../../support/elevationInfoUtils.js";import{ViewingMode as g}from"../../../ViewingMode.js";import{computeMapPointFromVec3d as R}from"../../support/hitTest.js";import{fromRenderAtEye as _,fromScreen as I}from"../../support/geometryUtils/ray.js";import{defaultTolerance as v,newIntersector as b}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as w,IntersectorType as P}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as j,sliceFilterPredicate as M}from"../../webgl-engine/lib/intersectorUtils.js";class U{constructor(t,r,n){this.viewingMode=t,this._forEachLayer=r,this._view=n,this._externalIntersectionHandlers=new e,this._tolerance=v,this._tmpRay=m(),this._tmpRegion=c(),this._validateHUDIntersector=b(this.viewingMode),this._validateHUDIntersector.options.hud=!1}intersectScreen(e,t,r){return this.intersectRay(this._getPickRay(e,this._tmpRay),T(this.viewingMode),t,r)}intersectScreenFreePointFallback(e,t,r){return this.intersectRayFreePointFallback(this._getPickRay(e,this._tmpRay),t,r)}intersectRayFreePointFallback(e,t,r){return this.intersectRay(e,T(this.viewingMode),t,r)||this._intersectRayFreePointLocal(e,t)}intersectRay(e,t,r,n){return t.options.selectionMode=!1,t.options.store=w.MIN,this.computeIntersection(e,t,n),!!t.results.min&&t.results.min.getIntersectionPoint(r)}getCenterRayWithSubpixelOffset(e,t,r=.5,n=.5){return e.getRenderCenter(D,r,n),D[0]+=.0466,D[1]-=.0123,_(e,D,t)}intersectIntersectorScreen(e,t,r){this.computeIntersection(this._getPickRay(e,this._tmpRay),t,r)}intersectToolIntersectorScreen(e,t,r){const n=this._getPickRay(e,this._tmpRay);this.intersectToolIntersectorRay(n,t,r)}intersectToolIntersectorRay(e,t,r){t.options.selectionMode=!0,this.computeIntersection(e,t,r);const n=t.results.min;!!this._view.basemapTerrain&&this._view.basemapTerrain.opaque||j(n)&&n.intersector!==P.TERRAIN||(t.options.selectionMode=!1,this.computeIntersection(e,t,r))}setTolerance(e=v){this._tolerance=e}addIntersectionHandler(e){this._externalIntersectionHandlers.push(e),this._externalIntersectionHandlers.sort(((e,t)=>e.type===P.TERRAIN?1:t.type===P.TERRAIN?-1:0))}removeIntersectionHandler(e){null!=this._externalIntersectionHandlers.removeUnordered(e)&&this._externalIntersectionHandlers.sort(((e,t)=>e.type===P.TERRAIN?1:t.type===P.TERRAIN?-1:0))}_getPickRay(e,t){const r=this._view.state.camera;return I(r,e,t)}_intersectRayFreePointLocal(e,t){return this.viewingMode!==g.Local||null==e||i(t,e.origin,s(y.get(),e.direction)),!1}intersectElevationFromScreen(e,t,r=0,n=null){return this._intersectElevation(this._getPickRay(e,this._tmpRay),t,r,n)}_intersectElevation(e,r,l=0,c=null){if(null==e)return null;const a=this._view,{renderCoordsHelper:u}=a,h=n(a.spatialReference),d=null!=r?r.mode:"absolute-height",p=f(r)/h,m=("on-the-ground"!==d?p+l:0)*h/u.unitInMeters,{camera:g}=a.state;if("absolute-height"===d){const t=u?.getAltitude(g.eye),r=o(s(F,e.direction),u.worldUpAtPosition(g.eye,S));if(t<m&&r<0||t>=m&&r>0)return null;if(u.intersectInfiniteManifold(e,m,F)){const e=R(a,F);return e.z??=0,e.z-=p,e}return null}const _=t(y.get());g.projectToRenderScreen(e.origin,_);const I=new A(null,this._forEachLayer),{slicePlane:v}=a,j=null!=v?M(v):null,U=b(this.viewingMode);U.options.store=w.MIN,U.options.verticalOffset=m;const x=e.origin,E=i(y.get(),x,e.direction);U.reset(x,E,g),U.point=_;const H=c?"type"in c&&"graphics"===c.type?e=>e.layerUid!==c.uid:e=>e.graphicUid!==c.uid:null;switch(d){case"relative-to-scene":{const e=e=>(!H||H(e))&&!!e.lastValidElevationBB;U.intersect(I.layers,_,this._tolerance,null,e),this._externalIntersectionHandlers.forAll((e=>{if(e.type===P.I3S||e.type===P.TERRAIN||e.type===P.TILES3D){const t=e.slicePlaneEnabled?j:null;e.intersect(U,t,U.rayBegin,U.rayEnd,_)}}));break}case"on-the-ground":case"relative-to-ground":this._externalIntersectionHandlers.forAll((e=>{if(e.isGround){const t=e.slicePlaneEnabled?j:null;e.intersect(U,t,U.rayBegin,U.rayEnd,_)}}))}if(U.results.min.getIntersectionPoint(F)){const e=R(a,F);return e.z=l,e}return null}computeIntersection(e,r,n,s){if(null==e)return;const o=this._view.state.camera,l=t(y.get());o.projectToRenderScreen(e.origin,l);const c=new A(n,this._forEachLayer);r.options.selectOpaqueTerrainOnly=!n||!("include"in n||"exclude"in n);const a=e.origin,u=i(y.get(),e.origin,e.direction);r.reset(a,u,o),r.intersect(c.layers,l,this._tolerance);const h=this._view.slicePlane,d=null!=h?M(h):null;r.intersect(c.sliceableLayers,l,this._tolerance,d);const p=n&&(n.requiresGroundFeedback||n.enableDraped);this._externalIntersectionHandlers.forAll((e=>{const t=e.layerUid,n=Array.isArray(t),i=n?t:[t];n&&(r.options.filteredLayerUids=[]);let o=!1;for(const s of i){!c.filterLayerUid(s)?n&&r.options.filteredLayerUids.push(s):o=!0}if(r.options.isFiltered=!o,e.isGround&&p||!r.options.isFiltered){const t=e.slicePlaneEnabled?d:null;e.intersect(r,t,a,u,l,s)}}));const m=y.get(),f=this._view.basemapTerrain;if(n&&n.enableDraped&&null!=f.spatialReference&&r.results.ground.getIntersectionPoint(m)){const e=f.overlayManager.renderer,t=this._view.renderCoordsHelper.spatialReference,n=y.get();this._view.renderCoordsHelper.fromRenderCoords(m,n,f.spatialReference),n[2]=this._view.elevationProvider?.getElevation(m[0],m[1],m[2],t,"ground")??0,e.intersect(r,n,r.results.ground,(e=>c.filterRenderGeometry(e)))}r.sortResults(),this._processHUDResults(r)}_processHUDResults(e){const t=e.results.hud;a(this._tmpRegion,u);const r=this._view.state.camera,n=[],i=this._tmpRegion,s=e=>{const t=new H(e);r.projectToRenderScreen(e.target.center,t.screenPoint),t.screenPoint[0]=Math.floor(t.screenPoint[0]),t.screenPoint[1]=Math.floor(t.screenPoint[1]),n.push(t),p(i,t.screenPoint)};e.sortResults(t.all),null!=t.min.dist&&s(t.min);for(const a of t.all)t.min.target.object!==a.target.object&&t.max.target.object!==a.target.object&&s(a);if(null!=t.max.dist&&t.max.target.object!==t.min.target.object&&s(t.max),!n.length)return;i[0]===i[2]&&(i[2]+=1),i[1]===i[3]&&(i[3]+=1);const o=r.fullWidth,l=r.fullHeight,c=Math.max(0,i[0]-x),m=Math.max(0,i[1]-x),y=Math.min(h(i)+2*x,o-c),f=Math.min(d(i)+2*x,l-m);if(y<=0||f<=0)return;const g=new Uint8Array(y*f*4);this._view._stage.renderer.readHUDVisibility(c,m,y,f,g);let R=!0;const _=null==e.results.max.dist;let I=0;for(const a of n)for(const t of E){const r=4*(Math.min(a.screenPoint[0]+t[0],o)-i[0]+(Math.min(a.screenPoint[1]+t[1],l)-i[1])*y);if(!(r<0||r>=g.length)&&g[r]){R&&(e.results.min.copy(a.result),R=!1),_&&e.results.max.copy(a.result),e.options.store===w.ALL&&e.results.all.splice(I++,0,a.result);break}}}}const x=1,E=(()=>{const e=[],t=x;for(let r=-t;r<=t;r++)for(let n=-t;n<=t;n++)e.push([n+t,r+t]);return e})();class H{constructor(e){this.result=e,this.screenPoint=r()}}let L;function T(e){return L&&L.viewingMode===e||(L=b(e)),L}class A{constructor(e,t){this.layers=new Array,this.sliceableLayers=new Array,this.include=e?.include,this.exclude=e?.exclude,t((e=>{e.pickable&&this.filterLayerUid(e.apiLayerUid)&&(e.sliceable?this.sliceableLayers:this.layers).push(e)}))}filterLayerUid(e){const{include:t,exclude:r}=this;return null==e?null==t&&null==r:(null==t||t.has(e))&&(null==r||!r.has(e))}filterRenderGeometry(e){return this.filterLayerUid(e.layerUid)}}function k(e){return"object"==typeof e&&"intersect"in e}const F=l(),S=l(),D=r();export{U as SceneIntersectionHelper,k as isIntersectionHandler};
5
+ import e from"../../../../core/PooledArray.js";import{castRenderScreenPointArray3 as t,createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{getMetersPerVerticalUnitForSR as n}from"../../../../core/unitUtils.js";import{g as i,n as s,k as o}from"../../../../chunks/vec32.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as c,copy as a,negativeInfinity as u,width as h,height as d,expandPointInPlace as p}from"../../../../geometry/support/aaBoundingRect.js";import{create as m}from"../../../../geometry/support/ray.js";import{sv3d as y}from"../../../../geometry/support/vectorStacks.js";import{getElevationOffsetInMeters as f}from"../../../../support/elevationInfoUtils.js";import{ViewingMode as g}from"../../../ViewingMode.js";import{computeMapPointFromVec3d as R}from"../../support/hitTest.js";import{fromRenderAtEye as _,fromScreen as I}from"../../support/geometryUtils/ray.js";import{defaultTolerance as v,newIntersector as b}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as w,IntersectorType as P}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as j,sliceFilterPredicate as M}from"../../webgl-engine/lib/intersectorUtils.js";class U{constructor(t,r,n){this.viewingMode=t,this._forEachLayer=r,this._view=n,this._externalIntersectionHandlers=new e,this._tolerance=v,this._tmpRay=m(),this._tmpRegion=c(),this._validateHUDIntersector=b(this.viewingMode),this._validateHUDIntersector.options.hud=!1}intersectScreen(e,t,r){return this.intersectRay(this._getPickRay(e,this._tmpRay),T(this.viewingMode),t,r)}intersectScreenFreePointFallback(e,t,r){return this.intersectRayFreePointFallback(this._getPickRay(e,this._tmpRay),t,r)}intersectRayFreePointFallback(e,t,r){return this.intersectRay(e,T(this.viewingMode),t,r)||this._intersectRayFreePointLocal(e,t)}intersectRay(e,t,r,n){return t.options.selectionMode=!1,t.options.store=w.MIN,this.computeIntersection(e,t,n),!!t.results.min&&t.results.min.getIntersectionPoint(r)}getCenterRayWithSubpixelOffset(e,t,r=.5,n=.5){return e.getRenderCenter(D,r,n),D[0]+=.0466,D[1]-=.0123,_(e,D,t)}intersectIntersectorScreen(e,t,r){this.computeIntersection(this._getPickRay(e,this._tmpRay),t,r)}intersectToolIntersectorScreen(e,t,r){const n=this._getPickRay(e,this._tmpRay);this.intersectToolIntersectorRay(n,t,r)}intersectToolIntersectorRay(e,t,r){t.options.selectionMode=!0,this.computeIntersection(e,t,r);const n=t.results.min;!!this._view.basemapTerrain&&this._view.basemapTerrain.opaque||j(n)&&n.intersector!==P.TERRAIN||(t.options.selectionMode=!1,this.computeIntersection(e,t,r))}setTolerance(e=v){this._tolerance=e}addIntersectionHandler(e){this._externalIntersectionHandlers.push(e),this._externalIntersectionHandlers.sort(((e,t)=>e.type===P.TERRAIN?1:t.type===P.TERRAIN?-1:0))}removeIntersectionHandler(e){null!=this._externalIntersectionHandlers.removeUnordered(e)&&this._externalIntersectionHandlers.sort(((e,t)=>e.type===P.TERRAIN?1:t.type===P.TERRAIN?-1:0))}_getPickRay(e,t){const r=this._view.state.camera;return I(r,e,t)}_intersectRayFreePointLocal(e,t){return this.viewingMode!==g.Local||null==e||i(t,e.origin,s(y.get(),e.direction)),!1}intersectElevationFromScreen(e,t,r=0,n=null){return this._intersectElevation(this._getPickRay(e,this._tmpRay),t,r,n)}_intersectElevation(e,r,l=0,c=null){if(null==e)return null;const a=this._view,{renderCoordsHelper:u}=a,h=n(a.spatialReference),d=null!=r?r.mode:"absolute-height",p=f(r)/h,m=("on-the-ground"!==d?p+l:0)*h/u.unitInMeters,{camera:g}=a.state;if("absolute-height"===d){const t=u?.getAltitude(g.eye),r=o(s(F,e.direction),u.worldUpAtPosition(g.eye,S));if(t<m&&r<0||t>=m&&r>0)return null;if(u.intersectInfiniteManifold(e,m,F)){const e=R(a,F);return e.z??=0,e.z-=p,e}return null}const _=t(y.get());g.projectToRenderScreen(e.origin,_);const I=new A(null,this._forEachLayer),{slicePlane:v}=a,j=null!=v?M(v):null,U=b(this.viewingMode);U.options.store=w.MIN,U.options.verticalOffset=m;const x=e.origin,E=i(y.get(),x,e.direction);U.reset(x,E,g),U.point=_;const H=c?"type"in c&&"graphics"===c.type?e=>e.layerUid!==c.uid:e=>e.graphicUid!==c.uid:null;switch(d){case"relative-to-scene":{const e=e=>(!H||H(e))&&!!e.lastValidElevationBB;U.intersect(I.layers,_,this._tolerance,null,e),this._externalIntersectionHandlers.forAll((e=>{if(e.type===P.I3S||e.type===P.TERRAIN||e.type===P.TILES3D){const t=e.slicePlaneEnabled?j:null;e.intersect(U,t,U.rayBegin,U.rayEnd,_)}}));break}case"on-the-ground":case"relative-to-ground":this._externalIntersectionHandlers.forAll((e=>{if(e.isGround){const t=e.slicePlaneEnabled?j:null;e.intersect(U,t,U.rayBegin,U.rayEnd,_)}}))}if(U.results.min.getIntersectionPoint(F)){const e=R(a,F);return e.z=l,e}return null}computeIntersection(e,r,n,s){if(null==e)return;const o=this._view.state.camera,l=t(y.get());o.projectToRenderScreen(e.origin,l);const c=new A(n,this._forEachLayer);r.options.selectOpaqueTerrainOnly=!n||!("include"in n||"exclude"in n);const a=e.origin,u=i(y.get(),e.origin,e.direction);r.reset(a,u,o),r.intersect(c.layers,l,this._tolerance);const h=this._view.slicePlane,d=null!=h?M(h):null;r.intersect(c.sliceableLayers,l,this._tolerance,d);const p=n&&(n.requiresGroundFeedback||n.enableDraped);this._externalIntersectionHandlers.forAll((e=>{const t=e.layerUid,n=Array.isArray(t),i=n?t:[t];n&&(r.options.filteredLayerUids=[]);let o=!1;for(const s of i){!c.filterLayerUid(s)?n&&r.options.filteredLayerUids.push(s):o=!0}if(r.options.isFiltered=!o,e.isGround&&p||!r.options.isFiltered){const t=e.slicePlaneEnabled?d:null;e.intersect(r,t,a,u,l,s)}}));const m=y.get(),f=this._view.basemapTerrain;if(n&&n.enableDraped&&null!=f.spatialReference&&r.results.ground.getIntersectionPoint(m)){const e=f.overlayManager.renderer,t=this._view.renderCoordsHelper.spatialReference,n=y.get();this._view.renderCoordsHelper.fromRenderCoords(m,n,f.spatialReference),n[2]=this._view.elevationProvider?.getElevation(m[0],m[1],m[2],t,"ground")??0,e.intersect(r,n,r.results.ground,(e=>c.filterRenderGeometry(e)))}r.sortResults(),this._processHUDResults(r)}_processHUDResults(e){const t=e.results.hud;a(this._tmpRegion,u);const r=this._view.state.camera,n=[],i=this._tmpRegion,s=e=>{const t=new H(e);r.projectToRenderScreen(e.target.center,t.screenPoint),t.screenPoint[0]=Math.floor(t.screenPoint[0]),t.screenPoint[1]=Math.floor(t.screenPoint[1]),n.push(t),p(i,t.screenPoint)};e.sortResults(t.all),null!=t.min.dist&&s(t.min);for(const a of t.all)t.min.target.object!==a.target.object&&t.max.target.object!==a.target.object&&s(a);if(null!=t.max.dist&&t.max.target.object!==t.min.target.object&&s(t.max),!n.length)return;i[0]===i[2]&&(i[2]+=1),i[1]===i[3]&&(i[3]+=1);const o=r.fullWidth,l=r.fullHeight,c=Math.max(0,i[0]-x),m=Math.max(0,i[1]-x),y=Math.min(h(i)+2*x,o-c),f=Math.min(d(i)+2*x,l-m);if(y<=0||f<=0)return;const g=new Uint8Array(y*f*4);this._view._stage.renderer.readHUDVisibility(c,m,y,f,g);let R=!0;const _=null==e.results.max.dist;let I=0;for(const a of n)for(const t of E){const r=4*(Math.min(a.screenPoint[0]+t[0],o)-i[0]+(Math.min(a.screenPoint[1]+t[1],l)-i[1])*y);if(!(r<0||r>=g.length)&&g[r]){R&&(e.results.min.copy(a.result),R=!1),_&&e.results.max.copy(a.result),e.options.store===w.ALL&&e.results.all.splice(I++,0,a.result);break}}}}const x=1,E=(()=>{const e=[],t=x;for(let r=-t;r<=t;r++)for(let n=-t;n<=t;n++)e.push([n+t,r+t]);return e})();class H{constructor(e){this.result=e,this.screenPoint=r()}}let L;function T(e){return L&&L.viewingMode===e||(L=b(e)),L}class A{constructor(e,t){this.layers=new Array,this.sliceableLayers=new Array,this.include=e?.include,this.exclude=e?.exclude,t((e=>{e.pickable&&this.filterLayerUid(e.apiLayerUid)&&(e.sliceable?this.sliceableLayers:this.layers).push(e)}))}filterLayerUid(e){const{include:t,exclude:r}=this;return null==e?null==t&&null==r:(null==t||t.has(e))&&(null==r||!r.has(e))}filterRenderGeometry(e){return this.filterLayerUid(e.layerUid)}}function k(e){return"object"==typeof e&&"intersect"in e}const F=l(),S=l(),D=r();export{U as SceneIntersectionHelper,k as isIntersectionHandler};
@@ -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{cyclicalPI as t}from"../../../../core/Cyclical.js";import{deg2rad as e,clamp as n,acosClamped as o,asinClamped as r}from"../../../../core/mathUtils.js";import{createScreenPointArray as a}from"../../../../core/screenUtils.js";import{fromRotation as i,exactEquals as s,multiply as c,rotate as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as m,create as u}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as p}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{f as h,e as g,g as M,l as y,h as b,k as d,s as j,n as x,j as v,a as z,c as P,b as I}from"../../../../chunks/vec32.js";import{create as w}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as S,axis as k,fromPoints as E,wrapAxisAngle as A}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as H,vectorCoordinates as U}from"../../../../geometry/support/coordinateSystem.js";import{create as G,intersectRay as q,fromNormalAndOffset as C}from"../../../../geometry/support/plane.js";import{j as F,h as R,g as V,d as T}from"../../../../chunks/sphere.js";import{angle as O}from"../../../../geometry/support/vector.js";import{sm4d as W,sv3d as B}from"../../../../geometry/support/vectorStacks.js";import{fromScreen as D,fromScreenAtEye as J}from"../../support/geometryUtils/ray.js";import{intersectScreen as K}from"../../support/geometryUtils/sphere.js";import{Camera as L}from"../../webgl-engine/lib/Camera.js";import{terrainId as N}from"../../webgl-engine/lib/verticalOffsetUtils.js";var Q;!function(t){t[t.Ellipsoid=0]="Ellipsoid",t[t.Silhouette=1]="Silhouette"}(Q||(Q={}));const X=30,Y=[1,3e8],Z=80,$=8,_=200,tt=1508e5,et=5,nt=50,ot=5,rt=10,at=90,it={exclude:new Set([N])};function st(t,e,n){return n[0]=e[0]/(t.fullWidth/t.pixelRatio),n[1]=e[1]/(t.fullHeight/t.pixelRatio),n}function ct(t){for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function lt(t,e,n){const o=i(W.get(),n[3],k(n));null==o||s(o,m)||(h(re,t.eye,e),g(re,re,o),t.eye=M(re,re,e),h(re,t.center,e),g(re,re,o),t.center=M(re,re,e),t.up=g(re,t.up,o))}function mt(t,e,n,o){return q(t,D(e,n,le),o)}function ut(t,e,n,o){return q(t,J(e,n,le),o)}function pt(t,e,n,o){const r=B.get();let a=1-n;h(r,e,t.eye);const i=y(r);let s=i*(1-a);a>=0&&s<o&&(s=o,a=-(s-i)/i),Math.abs(i-s)<1e-6||(b(r,r,a),t.eye=M(re,t.eye,r),t.center=d(re,t.center,e,a))}function ft(t,e,n){e.getScreenCenter(ht),K(t,e,ht,re)&&(e.center=re);const o=e.distance,r=o*n;if(Math.abs(o-r)<1e-6)return;const a=b(B.get(),e.viewForward,r);e.eye=h(re,e.center,a)}const ht=a();function gt(t,e){j(e,0,0,0);for(const n of t)M(e,e,n);b(e,e,1/t.length)}function Mt(t,e,n,o){return Math.sin(t/y(e))*(n+o.radius)}function yt(t,e,n,o){return Mt(Math.PI/2,e,n,o)+(t-Math.PI/2)}var bt;!function(t){t[t.Vertical=0]="Vertical",t[t.Horizontal=1]="Horizontal"}(bt||(bt={}));const dt={Elevation:3e4,Angle:e(16)},jt={Pole:.95,Angle:e(18),Tilt:45},xt=e(80);function vt(t,e,n,o,r,a){const i=w(),s=T();let c=!0,l=!0;return t.intersectScreen(n,i,a)?s[3]=y(i):(l=!1,e.aboveGround&&r!==Q.Ellipsoid?s[3]=Math.max(y(e.center),.9*o.radius):s[3]=y(e.eye)-e.relativeElevation,r===Q.Silhouette?wt(s,e,n,i):c=K(s,e,n,i)),{sphere:s,scenePickPoint:c?i:null,hasGeometryIntersection:l}}function zt(t,e,n){if(y(t.eye)-n.radius>dt.Elevation)return bt.Horizontal;J(t,e,me);return-Math.sign(t.relativeElevation)*(.5*Math.PI+O(t.eye,me.direction))<dt.Angle?bt.Vertical:bt.Horizontal}function Pt(t,e,n){h(It,n,e),t.eye=h(re,t.eye,It),t.center=h(re,t.center,It)}const It=w();function wt(t,e,n,o){const r=J(e,n,le);return null!=r&&(F(t,r,St),R(t,r,o)?!(z(St,r.origin)<z(o,r.origin))||(P(o,St),!1):(h(kt,e.eye,e.center),x(kt,kt),C(kt,-v(x(kt,kt),St),Et),q(Et,r,o),!1))}const St=w(),kt=w(),Et=G();function At(a,i,s,c,l,m){let u=0;if(I(se,a,i),h(ae,a,i),y(a)<=l||!c.aboveGround){I(s,ae,c.eye);const p=v(a,i)/(y(a)*y(i));if(p<.9999)u=o(p);else{const t=y(I(w(),a,i))/(y(a)*y(i));u=r(t)}const f=Math.cos(n(t.normalize(e(m)),0,xt));u=-u-Math.max(0,y(i)-l)/(f*l)}else h(Ht,c.eye,c.center),I(s,ae,Ht),u=-y(ae)/l;return x(s,s),b(s,s,y(se)),u}const Ht=w();function Ut(r,a,i,s){let c,l;const m=Math.cos(n(t.normalize(e(s)),0,xt));return c=a>i?-(a-i)/(m*i):a<-i?Math.PI-(a+i)/(m*i):o(a/i),l=r>i?-(r-i)/(m*i):r<-i?Math.PI-(r+i)/(m*i):o(r/i),(l-c)*i}function Gt(t,e,n,o,r,a,i,s,c,l){const m=Ut(t[2],e[2],a[3],s),u=c?Ut(t[0],e[0],a[3],180):e[0]-t[0],f=Math.sin(i)*u-Math.cos(i)*m,h=Math.cos(i)*u+Math.sin(i)*m;x(re,r);const g=c?f/Math.sqrt(Math.abs(a[3]**2-v(n,re)**2)):f/a[3],M=h/Math.sqrt(Math.abs(a[3]**2-v(n,o)**2));p(l,g,M)}function qt(t,e,n,o,r,a,i,s,c,l){I(se,t,e),H(a.up,a.eye,Nt,Qt,Xt),H([0,0,1],a.eye,Jt,Kt,Lt),P(n,Kt),P(o,Jt),x(n,n),b(n,n,y(se)),U(t,x(Qt,Qt),x(Xt,Xt),x(Nt,Nt),Yt),U(e,Qt,Xt,Nt,Zt),Gt(Yt,Zt,t,Jt,Kt,i,s,c,l,r)}function Ct(t,e,n,o,r,a,s){i(te,r,o),i(ee,s,a),c(ne,te,ee),h(e,t,n),g(e,e,ne),M(e,e,n)}function Ft(t,e,n,o,r,a){i(te,o,n),i(ee,a,r),c(ne,te,ee),h(re,t.eye,e),g(re,re,ne),t.eye=M(re,re,e),h(re,t.center,e),g(re,re,ne),t.center=M(re,re,e),h(re,t.up,e),g(re,re,ne),t.up=M(re,re,e)}function Rt(t,e,n,o,r,a){return(Math.abs(o)>Math.PI-jt.Angle||Math.abs(o)<jt.Angle)&&(Math.abs(t[2])<n*jt.Pole||Math.abs(e)>n)&&a.aboveGround&&r<jt.Tilt}function Vt(t,e,n,o,r,a){if(a)E(n,o,_t),lt(e,V(t),_t);else{const a=At(n,o,ce,e,t[3],r);lt(e,V(t),A(ce,a))}}function Tt(t,e,n,o,r,a,i){const s=i?20:1,c=1e-12;let l,m;P(oe,o),ie.copyFrom(e);for(let u=0;u<s&&z(n,oe)>c&&(l=z(n,oe),qt(n,oe,Kt,Jt,$t,ie,t,r,a,i),Ft(ie,V(t),Jt,$t[1],Kt,$t[0]),Ct(oe,oe,V(t),Jt,$t[1],Kt,$t[0]),m=z(n,oe),m<l||0===u);u++)e.copyFrom(ie)}function Ot(n,o,r,a,i,s,c){Rt(r,v(o.up,r),n[3],-t.normalize(e(i)),s,o)?Tt(n,o,r,a,-t.normalize(e(i)),s,c):Vt(n,o,r,a,s,c)}function Wt(t,e,n,o,r,a){const{eye:i}=t;H([0,0,1],i,Jt,Kt,Lt);const s=e.translation[0]*n.pan,c="zoom"===r.mode?0:e.translation[1]*n.pan,m=Math.max(Math.sqrt(Math.abs(1-v(t.center,Jt)**2/y(t.center)**2)),.5),u=(Math.sin(a)*c+Math.cos(a)*s)/m,p=-Math.cos(a)*c+Math.sin(a)*s;switch(l(o.pan.matrix,o.pan.matrix,u,Jt),o.pan.enabled=!0,r.mode){case"pan":l(o.pan.matrix,o.pan.matrix,p,Kt),o.pan.enabled=!0;break;case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Bt(t,e,n,o,r){const{eye:a,viewRight:i}=t,s=I(B.get(),i,a),c=e.translation[0]*n.pan;switch(0!==c&&(l(o.pan.matrix,o.pan.matrix,-c,s),o.pan.enabled=!0),r.mode){case"pan":{const t=e.translation[1]*n.pan;0!==t&&(l(o.pan.matrix,o.pan.matrix,t,i),o.pan.enabled=!0);break}case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Dt(n,o,r,a,i,s,c,l,m){Rt(n.center,v(n.up,n.center),y(n.center),-t.normalize(e(s)),c,o)?Wt(o,r,a,l,m,-t.normalize(e(i))):Bt(o,r,a,l,m)}const Jt=w(),Kt=w(),Lt=w(),Nt=w(),Qt=w(),Xt=w(),Yt=w(),Zt=w(),$t=f(),_t=S(),te=u(),ee=u(),ne=u(),oe=w(),re=w(),ae=w(),ie=new L,se=w(),ce=w(),le={origin:w(),direction:w()},me={origin:w(),direction:w()};export{bt as NavigationMode,jt as PreservingHeadingThreshold,Q as SpherePickPointFallback,xt as TiltThresholdPanningSpeed,dt as VerticalPanTresholds,Pt as applyPanPlanar,Vt as applyPanSphericalDirectRotation,Tt as applyPanSphericalPreserveHeading,lt as applyRotation,Ft as applyRotationWithTwoAxes,ft as applyZoomOnSphere,pt as applyZoomToPoint,gt as centroid,it as contentIntersectorOptions,zt as decideNavigationMode,Y as distanceClampValues,mt as intersectPlaneFromScreenPoint,ut as intersectPlaneFromScreenPointAtEye,Ut as lengthFromPoints,nt as minHeightLimit,st as normalizeCoordinate,ct as normalizeRotationDelta,yt as offSurfaceTiltToEyeTiltGlobal,Mt as onSurfaceTiltToEyeTiltGlobal,et as panDistanceModifier,Dt as panMotionToRotationMatrix,Ot as panToPosition,vt as pickPointAndInitSphere,X as pivotDistanceModifier,Rt as preserveHeadingThreshold,ot as rotatePivotDistanceModifier,rt as rotatePivotMinDistanceModifier,Ct as rotatePointAroundTwoAxes,at as rotateScreenPixelArea,At as rotationAngleAndAxisDirectRotation,qt as rotationAnglesAndAxesHeadingPreserving,Gt as rotationAnglesHeadingPreserving,Z as screenPixelArea,wt as sphereOrPlanePointFromScreenPoint,$ as zoomDistanceModifier,tt as zoomMaxDistanceModifier,_ as zoomMinDistanceModifier};
5
+ import{cyclicalPI as t}from"../../../../core/Cyclical.js";import{deg2rad as e,clamp as n,acosClamped as o,asinClamped as r}from"../../../../core/mathUtils.js";import{createScreenPointArray as a}from"../../../../core/screenUtils.js";import{fromRotation as i,exactEquals as s,multiply as c,rotate as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as m,create as u}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as p}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{f as h,e as g,g as M,l as y,h as b,m as d,s as x,n as j,k as v,a as z,c as P,b as I}from"../../../../chunks/vec32.js";import{create as w}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as S,axis as k,fromPoints as E,wrapAxisAngle as A}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as H,vectorCoordinates as U}from"../../../../geometry/support/coordinateSystem.js";import{create as G,intersectRay as q,fromNormalAndOffset as C}from"../../../../geometry/support/plane.js";import{j as F,h as R,g as V,d as T}from"../../../../chunks/sphere.js";import{angle as O}from"../../../../geometry/support/vector.js";import{sm4d as W,sv3d as B}from"../../../../geometry/support/vectorStacks.js";import{fromScreen as D,fromScreenAtEye as J}from"../../support/geometryUtils/ray.js";import{intersectScreen as K}from"../../support/geometryUtils/sphere.js";import{Camera as L}from"../../webgl-engine/lib/Camera.js";import{terrainId as N}from"../../webgl-engine/lib/verticalOffsetUtils.js";var Q;!function(t){t[t.Ellipsoid=0]="Ellipsoid",t[t.Silhouette=1]="Silhouette"}(Q||(Q={}));const X=30,Y=[1,3e8],Z=80,$=8,_=200,tt=1508e5,et=5,nt=50,ot=5,rt=10,at=90,it={exclude:new Set([N])};function st(t,e,n){return n[0]=e[0]/(t.fullWidth/t.pixelRatio),n[1]=e[1]/(t.fullHeight/t.pixelRatio),n}function ct(t){for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function lt(t,e,n){const o=i(W.get(),n[3],k(n));null==o||s(o,m)||(h(re,t.eye,e),g(re,re,o),t.eye=M(re,re,e),h(re,t.center,e),g(re,re,o),t.center=M(re,re,e),t.up=g(re,t.up,o))}function mt(t,e,n,o){return q(t,D(e,n,le),o)}function ut(t,e,n,o){return q(t,J(e,n,le),o)}function pt(t,e,n,o){const r=B.get();let a=1-n;h(r,e,t.eye);const i=y(r);let s=i*(1-a);a>=0&&s<o&&(s=o,a=-(s-i)/i),Math.abs(i-s)<1e-6||(b(r,r,a),t.eye=M(re,t.eye,r),t.center=d(re,t.center,e,a))}function ft(t,e,n){e.getScreenCenter(ht),K(t,e,ht,re)&&(e.center=re);const o=e.distance,r=o*n;if(Math.abs(o-r)<1e-6)return;const a=b(B.get(),e.viewForward,r);e.eye=h(re,e.center,a)}const ht=a();function gt(t,e){x(e,0,0,0);for(const n of t)M(e,e,n);b(e,e,1/t.length)}function Mt(t,e,n,o){return Math.sin(t/y(e))*(n+o.radius)}function yt(t,e,n,o){return Mt(Math.PI/2,e,n,o)+(t-Math.PI/2)}var bt;!function(t){t[t.Vertical=0]="Vertical",t[t.Horizontal=1]="Horizontal"}(bt||(bt={}));const dt={Elevation:3e4,Angle:e(16)},xt={Pole:.95,Angle:e(18),Tilt:45},jt=e(80);function vt(t,e,n,o,r,a){const i=w(),s=T();let c=!0,l=!0;return t.intersectScreen(n,i,a)?s[3]=y(i):(l=!1,e.aboveGround&&r!==Q.Ellipsoid?s[3]=Math.max(y(e.center),.9*o.radius):s[3]=y(e.eye)-e.relativeElevation,r===Q.Silhouette?wt(s,e,n,i):c=K(s,e,n,i)),{sphere:s,scenePickPoint:c?i:null,hasGeometryIntersection:l}}function zt(t,e,n){if(y(t.eye)-n.radius>dt.Elevation)return bt.Horizontal;J(t,e,me);return-Math.sign(t.relativeElevation)*(.5*Math.PI+O(t.eye,me.direction))<dt.Angle?bt.Vertical:bt.Horizontal}function Pt(t,e,n){h(It,n,e),t.eye=h(re,t.eye,It),t.center=h(re,t.center,It)}const It=w();function wt(t,e,n,o){const r=J(e,n,le);return null!=r&&(F(t,r,St),R(t,r,o)?!(z(St,r.origin)<z(o,r.origin))||(P(o,St),!1):(h(kt,e.eye,e.center),j(kt,kt),C(kt,-v(j(kt,kt),St),Et),q(Et,r,o),!1))}const St=w(),kt=w(),Et=G();function At(a,i,s,c,l,m){let u=0;if(I(se,a,i),h(ae,a,i),y(a)<=l||!c.aboveGround){I(s,ae,c.eye);const p=v(a,i)/(y(a)*y(i));if(p<.9999)u=o(p);else{const t=y(I(w(),a,i))/(y(a)*y(i));u=r(t)}const f=Math.cos(n(t.normalize(e(m)),0,jt));u=-u-Math.max(0,y(i)-l)/(f*l)}else h(Ht,c.eye,c.center),I(s,ae,Ht),u=-y(ae)/l;return j(s,s),b(s,s,y(se)),u}const Ht=w();function Ut(r,a,i,s){let c,l;const m=Math.cos(n(t.normalize(e(s)),0,jt));return c=a>i?-(a-i)/(m*i):a<-i?Math.PI-(a+i)/(m*i):o(a/i),l=r>i?-(r-i)/(m*i):r<-i?Math.PI-(r+i)/(m*i):o(r/i),(l-c)*i}function Gt(t,e,n,o,r,a,i,s,c,l){const m=Ut(t[2],e[2],a[3],s),u=c?Ut(t[0],e[0],a[3],180):e[0]-t[0],f=Math.sin(i)*u-Math.cos(i)*m,h=Math.cos(i)*u+Math.sin(i)*m;j(re,r);const g=c?f/Math.sqrt(Math.abs(a[3]**2-v(n,re)**2)):f/a[3],M=h/Math.sqrt(Math.abs(a[3]**2-v(n,o)**2));p(l,g,M)}function qt(t,e,n,o,r,a,i,s,c,l){I(se,t,e),H(a.up,a.eye,Nt,Qt,Xt),H([0,0,1],a.eye,Jt,Kt,Lt),P(n,Kt),P(o,Jt),j(n,n),b(n,n,y(se)),U(t,j(Qt,Qt),j(Xt,Xt),j(Nt,Nt),Yt),U(e,Qt,Xt,Nt,Zt),Gt(Yt,Zt,t,Jt,Kt,i,s,c,l,r)}function Ct(t,e,n,o,r,a,s){i(te,r,o),i(ee,s,a),c(ne,te,ee),h(e,t,n),g(e,e,ne),M(e,e,n)}function Ft(t,e,n,o,r,a){i(te,o,n),i(ee,a,r),c(ne,te,ee),h(re,t.eye,e),g(re,re,ne),t.eye=M(re,re,e),h(re,t.center,e),g(re,re,ne),t.center=M(re,re,e),h(re,t.up,e),g(re,re,ne),t.up=M(re,re,e)}function Rt(t,e,n,o,r,a){return(Math.abs(o)>Math.PI-xt.Angle||Math.abs(o)<xt.Angle)&&(Math.abs(t[2])<n*xt.Pole||Math.abs(e)>n)&&a.aboveGround&&r<xt.Tilt}function Vt(t,e,n,o,r,a){if(a)E(n,o,_t),lt(e,V(t),_t);else{const a=At(n,o,ce,e,t[3],r);lt(e,V(t),A(ce,a))}}function Tt(t,e,n,o,r,a,i){const s=i?20:1,c=1e-12;let l,m;P(oe,o),ie.copyFrom(e);for(let u=0;u<s&&z(n,oe)>c&&(l=z(n,oe),qt(n,oe,Kt,Jt,$t,ie,t,r,a,i),Ft(ie,V(t),Jt,$t[1],Kt,$t[0]),Ct(oe,oe,V(t),Jt,$t[1],Kt,$t[0]),m=z(n,oe),m<l||0===u);u++)e.copyFrom(ie)}function Ot(n,o,r,a,i,s,c){Rt(r,v(o.up,r),n[3],-t.normalize(e(i)),s,o)?Tt(n,o,r,a,-t.normalize(e(i)),s,c):Vt(n,o,r,a,s,c)}function Wt(t,e,n,o,r,a){const{eye:i}=t;H([0,0,1],i,Jt,Kt,Lt);const s=e.translation[0]*n.pan,c="zoom"===r.mode?0:e.translation[1]*n.pan,m=Math.max(Math.sqrt(Math.abs(1-v(t.center,Jt)**2/y(t.center)**2)),.5),u=(Math.sin(a)*c+Math.cos(a)*s)/m,p=-Math.cos(a)*c+Math.sin(a)*s;switch(l(o.pan.matrix,o.pan.matrix,u,Jt),o.pan.enabled=!0,r.mode){case"pan":l(o.pan.matrix,o.pan.matrix,p,Kt),o.pan.enabled=!0;break;case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Bt(t,e,n,o,r){const{eye:a,viewRight:i}=t,s=I(B.get(),i,a),c=e.translation[0]*n.pan;switch(0!==c&&(l(o.pan.matrix,o.pan.matrix,-c,s),o.pan.enabled=!0),r.mode){case"pan":{const t=e.translation[1]*n.pan;0!==t&&(l(o.pan.matrix,o.pan.matrix,t,i),o.pan.enabled=!0);break}case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Dt(n,o,r,a,i,s,c,l,m){Rt(n.center,v(n.up,n.center),y(n.center),-t.normalize(e(s)),c,o)?Wt(o,r,a,l,m,-t.normalize(e(i))):Bt(o,r,a,l,m)}const Jt=w(),Kt=w(),Lt=w(),Nt=w(),Qt=w(),Xt=w(),Yt=w(),Zt=w(),$t=f(),_t=S(),te=u(),ee=u(),ne=u(),oe=w(),re=w(),ae=w(),ie=new L,se=w(),ce=w(),le={origin:w(),direction:w()},me={origin:w(),direction:w()};export{bt as NavigationMode,xt as PreservingHeadingThreshold,Q as SpherePickPointFallback,jt as TiltThresholdPanningSpeed,dt as VerticalPanTresholds,Pt as applyPanPlanar,Vt as applyPanSphericalDirectRotation,Tt as applyPanSphericalPreserveHeading,lt as applyRotation,Ft as applyRotationWithTwoAxes,ft as applyZoomOnSphere,pt as applyZoomToPoint,gt as centroid,it as contentIntersectorOptions,zt as decideNavigationMode,Y as distanceClampValues,mt as intersectPlaneFromScreenPoint,ut as intersectPlaneFromScreenPointAtEye,Ut as lengthFromPoints,nt as minHeightLimit,st as normalizeCoordinate,ct as normalizeRotationDelta,yt as offSurfaceTiltToEyeTiltGlobal,Mt as onSurfaceTiltToEyeTiltGlobal,et as panDistanceModifier,Dt as panMotionToRotationMatrix,Ot as panToPosition,vt as pickPointAndInitSphere,X as pivotDistanceModifier,Rt as preserveHeadingThreshold,ot as rotatePivotDistanceModifier,rt as rotatePivotMinDistanceModifier,Ct as rotatePointAroundTwoAxes,at as rotateScreenPixelArea,At as rotationAngleAndAxisDirectRotation,qt as rotationAnglesAndAxesHeadingPreserving,Gt as rotationAnglesHeadingPreserving,Z as screenPixelArea,wt as sphereOrPlanePointFromScreenPoint,$ as zoomDistanceModifier,tt as zoomMaxDistanceModifier,_ as zoomMinDistanceModifier};
@@ -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{acosClamped as o}from"../../../../core/mathUtils.js";import{f as r,l as t,j as s}from"../../../../chunks/vec32.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";function c(i,c,f){i.worldUpAtPosition(c,m),r(e,f,c);const n=t(e);return 0===n?0:o(s(e,m)/n)}const m=i(),e=i();export{c as viewAngle};
5
+ import{acosClamped as o}from"../../../../core/mathUtils.js";import{f as r,l as t,k as s}from"../../../../chunks/vec32.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";function c(i,c,f){i.worldUpAtPosition(c,m),r(e,f,c);const n=t(e);return 0===n?0:o(s(e,m)/n)}const m=i(),e=i();export{c as viewAngle};
@@ -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 t}from"../../../core/compilerUtils.js";import{lerp as e}from"../../../core/mathUtils.js";import{invert as i}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{g as n,h as o,D as s,e as a,s as c,j as l}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{computeTranslationToOriginAndRotation as d}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBoundingRect as m}from"../../../geometry/projection/projectBoundingRect.js";import{projectVectorToVector as _}from"../../../geometry/projection/projectVectorToVector.js";import{create as g,empty as f,expandWithVec3 as u}from"../../../geometry/support/aaBoundingBox.js";import{create as x,center as R}from"../../../geometry/support/aaBoundingRect.js";import{PlaneIndex as y}from"../../../geometry/support/frustum.js";import{create as j,fromPoints as b}from"../../../geometry/support/lineSegment.js";import{create as A,fromVectorsAndPoint as E,copy as S,negate as B,signedDistance as C}from"../../../geometry/support/plane.js";import{wrap as H}from"../../../geometry/support/ray.js";import{ViewingMode as w}from"../../ViewingMode.js";import{frustumLineSegment as G}from"./intersectionUtils.js";const M=.5*Math.PI,F=M/Math.PI*180;class N{constructor(t){this._renderCoordsHelper=t.renderCoordsHelper,this._extent=new Array(4),this._planes=new Array(6),this._maxSpan=0,this._center={origin:p(),direction:p()};for(let e=0;e<4;e++)this._extent[e]={origin:p(),direction:p(),cap:{next:null,direction:p()}},this._planes[e]=A();this._planes[y.NEAR]=A(),this._planes[y.FAR]=A(),this._planesWithoutFar=this._planes.slice(0,5)}update(t,e,i,r=!0){const a=this._extent;this._toRenderBoundingExtent(t,e,i),n(this._center.origin,a[0].origin,a[2].origin),o(this._center.origin,this._center.origin,.5),this._renderCoordsHelper.worldUpAtPosition(this._center.origin,this._center.direction),r||o(this._center.direction,this._center.direction,-1);for(let n=0;n<4;n++){const t=a[n];this._renderCoordsHelper.worldUpAtPosition(t.origin,t.direction);const e=a[3===n?0:n+1];t.cap.next=e.origin,s(t.cap.direction,t.origin,e.origin),E(t.direction,t.cap.direction,t.origin,this._planes[n]),r||o(t.direction,t.direction,-1)}E(a[0].cap.direction,a[1].cap.direction,a[0].origin,this._planes[y.NEAR]),r?B(this._planes[y.NEAR],this._planes[y.FAR]):(S(this._planes[y.FAR],this._planes[y.NEAR]),B(this._planes[y.NEAR],this._planes[y.NEAR])),this._maxSpan=Math.max(Math.abs(t[0]-t[2]),Math.abs(t[1]-t[3])),this._maxSpanSpatialReference=e,this._minGlobalAltitude=.9*h(this._maxSpanSpatialReference).radius}isVisibleInFrustum(t,e,i=!1){if(null==t)return!1;if(this._renderCoordsHelper.viewingMode===w.Global){const i=this._maxSpanSpatialReference.isGeographic?F:M*e;if(this._maxSpan>i)return!0;if(null!=t.altitude&&t.altitude>=this._minGlobalAltitude)return this._isVisibleInFrustumGlobal(t)}if(0===this._maxSpan){const e=this._extent[0];return!(i||!t.intersectsRay(H(e.origin,e.direction)))}for(let n=0;n<this._extent.length;n++){const e=this._extent[n];if(!i&&t.intersectsRay(H(e.origin,e.direction)))return!0;if(t.intersectsLineSegment(b(e.origin,e.cap.next,k),e.cap.direction))return!0}const r=i?this._planes:this._planesWithoutFar;for(let n=0;n<t.lines.length;n++){const e=t.lines[n];if(G(r,e.origin,e.endpoint,e.direction))return!0}return!1}_toRenderBoundingExtentGlobal(t,r,n){const o=5;R(t,V),V[2]=n,d(r,V,v,this._renderCoordsHelper.spatialReference),i(I,v),f(L);for(const{x0:i,x1:s,y0:c,y1:l}of U)for(let p=0;p<o;p++){const h=p/(o-1);V[0]=e(t[i],t[s],h),V[1]=e(t[c],t[l],h),V[2]=n,_(V,r,V,this._renderCoordsHelper.spatialReference),a(V,V,I),u(L,V)}c(this._extent[0].origin,L[0],L[1],L[2]),c(this._extent[1].origin,L[3],L[1],L[2]),c(this._extent[2].origin,L[3],L[4],L[2]),c(this._extent[3].origin,L[0],L[4],L[2]);for(let e=0;e<4;++e)a(this._extent[e].origin,this._extent[e].origin,v)}_toRenderBoundingExtentLocal(t,e,i){m(t,e,P,this._renderCoordsHelper.spatialReference),c(this._extent[0].origin,P[0],P[1],i),c(this._extent[1].origin,P[2],P[1],i),c(this._extent[2].origin,P[2],P[3],i),c(this._extent[3].origin,P[0],P[3],i)}_toRenderBoundingExtent(e,i,r){switch(this._renderCoordsHelper.viewingMode){case w.Global:this._toRenderBoundingExtentGlobal(e,i,r);break;case w.Local:this._toRenderBoundingExtentLocal(e,i,r);break;default:t(this._renderCoordsHelper.viewingMode)}}_isVisibleInFrustumGlobal(t){if(C(t.planes[y.NEAR],this._center.origin)<0&&l(this._center.direction,t.direction)<0)return!0;for(let e=0;e<4;e++){const i=this._extent[e];if(C(t.planes[y.NEAR],i.origin)<0&&l(i.direction,t.direction)<0)return!0}return!1}}const U=[{x0:0,y0:1,x1:2,y1:1},{x0:0,y0:3,x1:2,y1:3},{x0:0,y0:1,x1:0,y1:3},{x0:2,y0:1,x1:2,y1:3}],V=p(),v=r(),I=r(),L=g(),P=x(),k=j();export{N as FrustumExtentIntersection};
5
+ import{neverReached as t}from"../../../core/compilerUtils.js";import{lerp as e}from"../../../core/mathUtils.js";import{invert as i}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{g as n,h as o,E as s,e as a,s as c,k as l}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{computeTranslationToOriginAndRotation as d}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBoundingRect as m}from"../../../geometry/projection/projectBoundingRect.js";import{projectVectorToVector as _}from"../../../geometry/projection/projectVectorToVector.js";import{create as g,empty as f,expandWithVec3 as u}from"../../../geometry/support/aaBoundingBox.js";import{create as x,center as R}from"../../../geometry/support/aaBoundingRect.js";import{PlaneIndex as y}from"../../../geometry/support/frustum.js";import{create as j,fromPoints as b}from"../../../geometry/support/lineSegment.js";import{create as A,fromVectorsAndPoint as E,copy as S,negate as B,signedDistance as C}from"../../../geometry/support/plane.js";import{wrap as H}from"../../../geometry/support/ray.js";import{ViewingMode as w}from"../../ViewingMode.js";import{frustumLineSegment as G}from"./intersectionUtils.js";const M=.5*Math.PI,F=M/Math.PI*180;class N{constructor(t){this._renderCoordsHelper=t.renderCoordsHelper,this._extent=new Array(4),this._planes=new Array(6),this._maxSpan=0,this._center={origin:p(),direction:p()};for(let e=0;e<4;e++)this._extent[e]={origin:p(),direction:p(),cap:{next:null,direction:p()}},this._planes[e]=A();this._planes[y.NEAR]=A(),this._planes[y.FAR]=A(),this._planesWithoutFar=this._planes.slice(0,5)}update(t,e,i,r=!0){const a=this._extent;this._toRenderBoundingExtent(t,e,i),n(this._center.origin,a[0].origin,a[2].origin),o(this._center.origin,this._center.origin,.5),this._renderCoordsHelper.worldUpAtPosition(this._center.origin,this._center.direction),r||o(this._center.direction,this._center.direction,-1);for(let n=0;n<4;n++){const t=a[n];this._renderCoordsHelper.worldUpAtPosition(t.origin,t.direction);const e=a[3===n?0:n+1];t.cap.next=e.origin,s(t.cap.direction,t.origin,e.origin),E(t.direction,t.cap.direction,t.origin,this._planes[n]),r||o(t.direction,t.direction,-1)}E(a[0].cap.direction,a[1].cap.direction,a[0].origin,this._planes[y.NEAR]),r?B(this._planes[y.NEAR],this._planes[y.FAR]):(S(this._planes[y.FAR],this._planes[y.NEAR]),B(this._planes[y.NEAR],this._planes[y.NEAR])),this._maxSpan=Math.max(Math.abs(t[0]-t[2]),Math.abs(t[1]-t[3])),this._maxSpanSpatialReference=e,this._minGlobalAltitude=.9*h(this._maxSpanSpatialReference).radius}isVisibleInFrustum(t,e,i=!1){if(null==t)return!1;if(this._renderCoordsHelper.viewingMode===w.Global){const i=this._maxSpanSpatialReference.isGeographic?F:M*e;if(this._maxSpan>i)return!0;if(null!=t.altitude&&t.altitude>=this._minGlobalAltitude)return this._isVisibleInFrustumGlobal(t)}if(0===this._maxSpan){const e=this._extent[0];return!(i||!t.intersectsRay(H(e.origin,e.direction)))}for(let n=0;n<this._extent.length;n++){const e=this._extent[n];if(!i&&t.intersectsRay(H(e.origin,e.direction)))return!0;if(t.intersectsLineSegment(b(e.origin,e.cap.next,P),e.cap.direction))return!0}const r=i?this._planes:this._planesWithoutFar;for(let n=0;n<t.lines.length;n++){const e=t.lines[n];if(G(r,e.origin,e.endpoint,e.direction))return!0}return!1}_toRenderBoundingExtentGlobal(t,r,n){const o=5;R(t,V),V[2]=n,d(r,V,v,this._renderCoordsHelper.spatialReference),i(I,v),f(k);for(const{x0:i,x1:s,y0:c,y1:l}of U)for(let p=0;p<o;p++){const h=p/(o-1);V[0]=e(t[i],t[s],h),V[1]=e(t[c],t[l],h),V[2]=n,_(V,r,V,this._renderCoordsHelper.spatialReference),a(V,V,I),u(k,V)}c(this._extent[0].origin,k[0],k[1],k[2]),c(this._extent[1].origin,k[3],k[1],k[2]),c(this._extent[2].origin,k[3],k[4],k[2]),c(this._extent[3].origin,k[0],k[4],k[2]);for(let e=0;e<4;++e)a(this._extent[e].origin,this._extent[e].origin,v)}_toRenderBoundingExtentLocal(t,e,i){m(t,e,L,this._renderCoordsHelper.spatialReference),c(this._extent[0].origin,L[0],L[1],i),c(this._extent[1].origin,L[2],L[1],i),c(this._extent[2].origin,L[2],L[3],i),c(this._extent[3].origin,L[0],L[3],i)}_toRenderBoundingExtent(e,i,r){switch(this._renderCoordsHelper.viewingMode){case w.Global:this._toRenderBoundingExtentGlobal(e,i,r);break;case w.Local:this._toRenderBoundingExtentLocal(e,i,r);break;default:t(this._renderCoordsHelper.viewingMode)}}_isVisibleInFrustumGlobal(t){if(C(t.planes[y.NEAR],this._center.origin)<0&&l(this._center.direction,t.direction)<0)return!0;for(let e=0;e<4;e++){const i=this._extent[e];if(C(t.planes[y.NEAR],i.origin)<0&&l(i.direction,t.direction)<0)return!0}return!1}}const U=[{x0:0,y0:1,x1:2,y1:1},{x0:0,y0:3,x1:2,y1:3},{x0:0,y0:1,x1:0,y1:3},{x0:2,y0:1,x1:2,y1:3}],V=p(),v=r(),I=r(),k=g(),L=x(),P=j();export{N as FrustumExtentIntersection};
@@ -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"../../../Camera.js";import{Cyclical as n}from"../../../core/Cyclical.js";import t from"../../../core/Logger.js";import{deg2rad as r,rad2deg as o}from"../../../core/mathUtils.js";import{throwIfAborted as i}from"../../../core/promiseUtils.js";import{h as a,g as c,m as l,c as s}from"../../../chunks/vec32.js";import{clone as u,create as f}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as m}from"../../../geometry/ellipsoidUtils.js";import p from"../../../geometry/Point.js";import{projectWithZConversion as d,project as h}from"../../../geometry/projection.js";import g from"../../../geometry/SpatialReference.js";import{projectPointToVector as y,projectPointToVectorAsync as v}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToPoint as w,projectVectorToPointAsync as R}from"../../../geometry/projection/projectVectorToPoint.js";import{projectVectorToVector as x}from"../../../geometry/projection/projectVectorToVector.js";import{ViewingMode as M}from"../../ViewingMode.js";import{cameraOnContentAlongViewDirection as S}from"../camera/intersectionUtils.js";import{t as T,c as j}from"../../../chunks/cameraUtilsPlanar.js";import{t as C,c as z}from"../../../chunks/cameraUtilsSpherical.js";import{getGreatCircleSpanAt as b}from"./earthUtils.js";import{getElevationAtPoint as U}from"./ElevationProvider.js";import{isSpatialReferenceSupported as P}from"../../support/spatialReferenceSupport.js";const A=()=>t.getLogger("esri.views.3d.support.cameraUtils"),D=39.37,H=96,L=1,G=8,E=5,O=1,q=f(),I={heading:0,tilt:0},k=f(),J=new n(-20037508.342788905,20037508.342788905),V=new n(-180,180);var F;function W(e){return e.spatialReference??g.WGS84}function X(e){return"global"===e.viewingMode?z:j}function K(e,n,t,r,o){return X(e).headingTiltToDirectionUp(n,t,r,o)}function Y(e,n){if(null==n)return null;const t=e.renderSpatialReference,o=X(e).headingTiltToDirectionUp,i=f();if(!y(n.position,i,t))return null;const l=o(i,n.heading,n.tilt);a(l.direction,l.direction,e.state.camera.distance),c(l.direction,l.direction,i);const s=S(e,i,l.direction,l.up);return s.fov=r(n.fov),s.row=n.layout.row,s.rows=n.layout.rows,s.column=n.layout.column,s.columns=n.layout.columns,s}!function(e){e[e.LOCKED=0]="LOCKED",e[e.ADJUST=1]="ADJUST"}(F||(F={}));const N=f();function Z(n,t,r){const i=n.renderSpatialReference,a=ne(n,t.eye,t.viewForward,t.up,I);let c=W(n);return x(t.eye,i,N,c)||(c=g.WGS84,x(t.eye,i,N,c)),null==r?r=new e(new p(N,c),a.heading,a.tilt,o(t.fov)):(r.position.x=N[0],r.position.y=N[1],r.position.z=N[2],r.position.spatialReference=c,r.heading=a.heading,r.tilt=a.tilt,r.fov=o(t.fov)),r.layout.row=t.row,r.layout.rows=t.rows,r.layout.column=t.column,r.layout.columns=t.columns,r}function B(e,n,t){const o=e.state.camera,i=o.width/2/o.pixelRatio;e.renderCoordsHelper.viewingMode===M.Global&&null!=t&&(n*=Math.cos(r(t))),n/=e.renderCoordsHelper.unitInMeters;return i/(H*D/n)/Math.tan(o.fovX/2)}function Q(e,n,t){const o=e.state.camera,i=n*Math.tan(o.fovX/2),a=o.width/2/o.pixelRatio;let c=H*D/(a/i);return e.renderCoordsHelper.viewingMode===M.Global&&null!=t&&(c/=Math.cos(r(t))),c*e.renderCoordsHelper.unitInMeters}async function $(e,n,t,r,o,i){return ee(e,n,B(e,t,n.latitude),r,o,i)}function _(e,n,t,r,o,i){return Ce(e,ae(e,r.heading,r.tilt,n,t,o),r.fov,i)}async function ee(e,n,t,r,o,a){const c=await ce(e,r.heading,r.tilt,n,t,o,a);return i(a),ze(e,c,r.fov,a)}function ne(e,n,t,r,o){return X(e).directionToHeadingTilt(n,t,r,o)}function te(e,n){return!!(e.basemapTerrain&&e.renderCoordsHelper.fromRenderCoords(n,k,e.spatialReference)&&e.elevationProvider&&(U(e.elevationProvider,k)??0)>k[2]-O)}async function re(e,n,t){if(te(e,n))return!0;const{elevationProvider:r,spatialReference:o,renderCoordsHelper:a}=e;if(null==r||!a.fromRenderCoords(n,k,o))return!1;const[c,l,s]=k,u=await r.queryElevation(c,l,s,o,"ground",t)??0;return i(t),u>s-O}async function oe(e,n,t){const r=f();if(null==n)return s(r,e.state.camera.center);if(n instanceof p){const{renderSpatialReference:o,basemapTerrain:a,elevationProvider:c}=e,l=n.spatialReference;if(await v(n,r,o,0,{signal:t}),i(t),null==n.z&&null!=a&&null!=c){const o=await c.queryElevation(n.x,n.y,n.z??0,l,"ground",t);i(t),null!=o&&e.renderCoordsHelper.setAltitude(r,o)}return r}return s(r,n)}function ie(e,n){const t=f();if(null==n)return s(t,e.state.camera.center);if(n instanceof p){if(!y(n,t,e.renderSpatialReference))return null;const{basemapTerrain:r,elevationProvider:o}=e;if(null==n.z&&null!=r&&null!=o){const r=U(o,n);null!=r&&e.renderCoordsHelper.setAltitude(t,r)}return t}return s(t,n)}function ae(e,n,t,r,o,i){return le(e,n,t,r instanceof p?r:null,ie(e,r),o,i)}async function ce(e,n,t,r,o,a,c){const l=r instanceof p?r:null,s=await oe(e,r,c);return i(c),se(e,n,t,l,s,o,a,c)}function le(e,n,t,r,o,i,a){if(null==o)return null;if(!r&&(r=new p({spatialReference:W(e)}),!w(o,e.renderSpatialReference,r)))return null;const c=ue(e,n,t,o,i,a);if(fe(e,t,a)&&te(e,c.eye)){const{tilt:a,mode:c}=me(e,t,o,i);return le(e,n,a,r,o,i,c)}return pe(c,o)}async function se(e,n,t,r,o,a,c,l){r||(r=new p({spatialReference:W(e)}),await R(o,e.renderSpatialReference,r,{signal:l})||(r=null)),i(l);const s=ue(e,n,t,o,a,c);if(fe(e,t,c)&&await re(e,s.eye,l)){i(l);const{tilt:c,mode:s}=me(e,t,o,a);return se(e,n,c,r,o,a,s,l)}return pe(s,o)}function ue(e,n,t,r,o,i){const a=Re(e,n,t,r,o=Math.max(o,e.state.constraints.minimumPoiDistance),i);return(0,X(e).eyeForCenterWithHeadingTilt)(r,o,a.heading,a.tilt)}function fe(e,n,t){const r=e.map.ground.navigationConstraint;return t===F.ADJUST&&"global"===e.viewingMode&&n>0&&(null==r||"stay-above"===r.type)}function me(e,n,t,r){const o=Te(e,t,r,Se(e,r,n,t));return{tilt:o,mode:n-o<1?F.LOCKED:F.ADJUST}}function pe(e,n){return{...e,center:u(n)}}function de(e,n){const{state:t,spatialReference:r}=e,o=n.spatialReference;return t.isGlobal&&P(o,M.Global)||t.isLocal&&r.equals(o)}function he(e,n){let t,r,o;if(e.state.isGlobal){const e=new p(n.xmin,n.ymin,n.spatialReference),i=new p(n.xmax,n.ymax,n.spatialReference),a=n.spatialReference.isGeographic?V:J;t=new p({x:a.center(e.x,i.x),y:(i.y+e.y)/2,z:null!=n.zmax&&null!=n.zmin?(n.zmax+n.zmin)/2:void 0,spatialReference:n.spatialReference});const c=m(n.spatialReference),l=b(t,e,i);r=l.lon,o=l.lat,a.diff(e.x,i.x)>a.range/2&&(r+=c.halfCircumference),r=Math.min(r,c.halfCircumference),o=Math.min(o,c.halfCircumference)}else{const i=e.renderSpatialReference??n.spatialReference;i.equals(n.spatialReference)||(n=h(n,i)),r=n.xmax-n.xmin,o=n.ymax-n.ymin;const a=null!=n.zmax&&null!=n.zmin?(n.zmax+n.zmin)/2:void 0;t=new p({x:n.xmin+.5*r,y:n.ymin+.5*o,z:a,spatialReference:i})}const i=null!=n.zmax&&null!=n.zmin?n.zmax-n.zmin:0,a=e.state.camera,c=1/Math.tan(a.fovX/2),l=1/Math.tan(a.fovY/2),s=1/Math.tan(a.fov/2);return{center:t,distance:Math.max(.5*r*c,.5*o*l,.5*i*s)/L}}async function ge(e,n,t,r,o,a){const c=de(e,n)?n:await d(n,e.spatialReference,{signal:a});i(a);const{center:l,distance:s}=he(e,c),u=await ce(e,t,r,l,s,o,a);return i(a),ze(e,u,e.camera.fov,a)}function ye(e,n,t,r,o,i){let a;try{a=de(e,n)?n:h(n,e.spatialReference)}catch(u){return null}const{center:c,distance:l}=he(e,a),s=ae(e,t,r,c,l,o);return null==s?null:Ce(e,s,e.camera.fov,i)}function ve(e,n,t){const r=e.renderSpatialReference,o=new p({spatialReference:W(e)});if(!w(t,r,o))return null;const i=Math.tan(n.fovX/2),a=Math.tan(n.fovY/2),c=l(n.eye,t),s=2*c*i*L,u=2*c*a*L;return"global"===e.viewingMode?C(e,o,s,u):T(e,o,s,u)}function we(e,n,t){const r=e.pointsOfInterest.centerOnSurfaceFrequent.distance;if(Math.log(t/r)/Math.LN2>G)return!0;const o=e.renderSpatialReference,i=W(e),a=new p({spatialReference:i});if(!w(n,o,a))return!1;const c=new p({spatialReference:i});if(!w(e.pointsOfInterest.centerOnSurfaceFrequent.renderLocation,o,c))return!1;const l=Math.tan(.5*e.state.camera.fov)*r;return c.distance(a)/l>E}function Re(e,n,t,r,o,i){let a=0;return i===F.ADJUST&&we(e,r,o)?(n=0,a=Me(e,o,t,r)):a=je(e,r,o,t),a=e.state.constraints.clampTilt(o,a),{heading:n,tilt:t=Te(e,r,o,a)}}const xe=.7;function Me(e,n,t,r){const o=je(e,r,n,t);if(!e.state.constraints.tilt)return o;const i=e.state.constraints.tilt(n);i.max=Math.min(i.max,.5*Math.PI);const a=i.min*(1-xe)+i.max*xe;return Math.min(o,a)}function Se(e,n,t,r){let o=je(e,r,n,t);if(!e.state.constraints.tilt)return o;const i=e.state.constraints.tilt(n);return o=Math.min(o,.5*Math.PI),i.min*(1-xe)+o*xe}function Te(e,n,t,r){return X(e).lookAtTiltToEyeTilt(r,n,t)}function je(e,n,t,r){return X(e).eyeTiltToLookAtTilt(r,n,t)}function Ce(n,t,r,o){if(null==t)return null;const i=n.renderSpatialReference,a=new p({spatialReference:W(n)});return w(t.eye,i,a)?(o??=new e,o.position=a,o.heading=t.heading,o.tilt=t.tilt,o.fov=r,o):null}async function ze(n,t,r,o){const a=n.renderSpatialReference,c=new p({spatialReference:W(n)});return await R(t.eye,a,c,{signal:o}),i(o),new e(c,t.heading,t.tilt,r)}function be(e,n){const t=e.basemapTerrain?.tilingScheme;if(t)return t.levelAtScale(n);A().error("#scaleToZoom()","Cannot compute zoom from scale without a tiling scheme")}function Ue(e,n){const t=e.basemapTerrain?.tilingScheme;if(t)return t.scaleAtLevel(n);A().error("#zoomToScale()","Cannot compute scale from zoom without a tiling scheme")}function Pe(e,n){return x(n.center,e.renderSpatialReference,q,g.WGS84),Q(e,n.distance,q[1])}export{F as OrientationMode,Pe as computeScale,ne as directionToHeadingTilt,Q as distanceToScale,Y as externalToInternal,ee as fromCenterDistanceAsync,_ as fromCenterDistanceSync,$ as fromCenterScale,ge as fromExtentAsync,ye as fromExtentSync,ce as getObserverForPointAtDistanceAsync,ae as getObserverForPointAtDistanceSync,W as getViewSR,K as headingTiltToDirectionUp,Z as internalToExternal,B as scaleToDistance,be as scaleToZoom,ve as toExtent,Ue as zoomToScale};
5
+ import e from"../../../Camera.js";import{Cyclical as n}from"../../../core/Cyclical.js";import t from"../../../core/Logger.js";import{deg2rad as r,rad2deg as o}from"../../../core/mathUtils.js";import{throwIfAborted as i}from"../../../core/promiseUtils.js";import{h as a,g as c,o as l,c as s}from"../../../chunks/vec32.js";import{clone as u,create as f}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as m}from"../../../geometry/ellipsoidUtils.js";import p from"../../../geometry/Point.js";import{projectWithZConversion as d,project as h}from"../../../geometry/projection.js";import g from"../../../geometry/SpatialReference.js";import{projectPointToVector as y,projectPointToVectorAsync as v}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToPoint as w,projectVectorToPointAsync as R}from"../../../geometry/projection/projectVectorToPoint.js";import{projectVectorToVector as x}from"../../../geometry/projection/projectVectorToVector.js";import{ViewingMode as M}from"../../ViewingMode.js";import{cameraOnContentAlongViewDirection as S}from"../camera/intersectionUtils.js";import{t as T,c as j}from"../../../chunks/cameraUtilsPlanar.js";import{t as C,c as z}from"../../../chunks/cameraUtilsSpherical.js";import{getGreatCircleSpanAt as b}from"./earthUtils.js";import{getElevationAtPoint as U}from"./ElevationProvider.js";import{isSpatialReferenceSupported as P}from"../../support/spatialReferenceSupport.js";const A=()=>t.getLogger("esri.views.3d.support.cameraUtils"),D=39.37,H=96,L=1,G=8,E=5,O=1,q=f(),I={heading:0,tilt:0},k=f(),J=new n(-20037508.342788905,20037508.342788905),V=new n(-180,180);var F;function W(e){return e.spatialReference??g.WGS84}function X(e){return"global"===e.viewingMode?z:j}function K(e,n,t,r,o){return X(e).headingTiltToDirectionUp(n,t,r,o)}function Y(e,n){if(null==n)return null;const t=e.renderSpatialReference,o=X(e).headingTiltToDirectionUp,i=f();if(!y(n.position,i,t))return null;const l=o(i,n.heading,n.tilt);a(l.direction,l.direction,e.state.camera.distance),c(l.direction,l.direction,i);const s=S(e,i,l.direction,l.up);return s.fov=r(n.fov),s.row=n.layout.row,s.rows=n.layout.rows,s.column=n.layout.column,s.columns=n.layout.columns,s}!function(e){e[e.LOCKED=0]="LOCKED",e[e.ADJUST=1]="ADJUST"}(F||(F={}));const N=f();function Z(n,t,r){const i=n.renderSpatialReference,a=ne(n,t.eye,t.viewForward,t.up,I);let c=W(n);return x(t.eye,i,N,c)||(c=g.WGS84,x(t.eye,i,N,c)),null==r?r=new e(new p(N,c),a.heading,a.tilt,o(t.fov)):(r.position.x=N[0],r.position.y=N[1],r.position.z=N[2],r.position.spatialReference=c,r.heading=a.heading,r.tilt=a.tilt,r.fov=o(t.fov)),r.layout.row=t.row,r.layout.rows=t.rows,r.layout.column=t.column,r.layout.columns=t.columns,r}function B(e,n,t){const o=e.state.camera,i=o.width/2/o.pixelRatio;e.renderCoordsHelper.viewingMode===M.Global&&null!=t&&(n*=Math.cos(r(t))),n/=e.renderCoordsHelper.unitInMeters;return i/(H*D/n)/Math.tan(o.fovX/2)}function Q(e,n,t){const o=e.state.camera,i=n*Math.tan(o.fovX/2),a=o.width/2/o.pixelRatio;let c=H*D/(a/i);return e.renderCoordsHelper.viewingMode===M.Global&&null!=t&&(c/=Math.cos(r(t))),c*e.renderCoordsHelper.unitInMeters}async function $(e,n,t,r,o,i){return ee(e,n,B(e,t,n.latitude),r,o,i)}function _(e,n,t,r,o,i){return Ce(e,ae(e,r.heading,r.tilt,n,t,o),r.fov,i)}async function ee(e,n,t,r,o,a){const c=await ce(e,r.heading,r.tilt,n,t,o,a);return i(a),ze(e,c,r.fov,a)}function ne(e,n,t,r,o){return X(e).directionToHeadingTilt(n,t,r,o)}function te(e,n){return!!(e.basemapTerrain&&e.renderCoordsHelper.fromRenderCoords(n,k,e.spatialReference)&&e.elevationProvider&&(U(e.elevationProvider,k)??0)>k[2]-O)}async function re(e,n,t){if(te(e,n))return!0;const{elevationProvider:r,spatialReference:o,renderCoordsHelper:a}=e;if(null==r||!a.fromRenderCoords(n,k,o))return!1;const[c,l,s]=k,u=await r.queryElevation(c,l,s,o,"ground",t)??0;return i(t),u>s-O}async function oe(e,n,t){const r=f();if(null==n)return s(r,e.state.camera.center);if(n instanceof p){const{renderSpatialReference:o,basemapTerrain:a,elevationProvider:c}=e,l=n.spatialReference;if(await v(n,r,o,0,{signal:t}),i(t),null==n.z&&null!=a&&null!=c){const o=await c.queryElevation(n.x,n.y,n.z??0,l,"ground",t);i(t),null!=o&&e.renderCoordsHelper.setAltitude(r,o)}return r}return s(r,n)}function ie(e,n){const t=f();if(null==n)return s(t,e.state.camera.center);if(n instanceof p){if(!y(n,t,e.renderSpatialReference))return null;const{basemapTerrain:r,elevationProvider:o}=e;if(null==n.z&&null!=r&&null!=o){const r=U(o,n);null!=r&&e.renderCoordsHelper.setAltitude(t,r)}return t}return s(t,n)}function ae(e,n,t,r,o,i){return le(e,n,t,r instanceof p?r:null,ie(e,r),o,i)}async function ce(e,n,t,r,o,a,c){const l=r instanceof p?r:null,s=await oe(e,r,c);return i(c),se(e,n,t,l,s,o,a,c)}function le(e,n,t,r,o,i,a){if(null==o)return null;if(!r&&(r=new p({spatialReference:W(e)}),!w(o,e.renderSpatialReference,r)))return null;const c=ue(e,n,t,o,i,a);if(fe(e,t,a)&&te(e,c.eye)){const{tilt:a,mode:c}=me(e,t,o,i);return le(e,n,a,r,o,i,c)}return pe(c,o)}async function se(e,n,t,r,o,a,c,l){r||(r=new p({spatialReference:W(e)}),await R(o,e.renderSpatialReference,r,{signal:l})||(r=null)),i(l);const s=ue(e,n,t,o,a,c);if(fe(e,t,c)&&await re(e,s.eye,l)){i(l);const{tilt:c,mode:s}=me(e,t,o,a);return se(e,n,c,r,o,a,s,l)}return pe(s,o)}function ue(e,n,t,r,o,i){const a=Re(e,n,t,r,o=Math.max(o,e.state.constraints.minimumPoiDistance),i);return(0,X(e).eyeForCenterWithHeadingTilt)(r,o,a.heading,a.tilt)}function fe(e,n,t){const r=e.map.ground.navigationConstraint;return t===F.ADJUST&&"global"===e.viewingMode&&n>0&&(null==r||"stay-above"===r.type)}function me(e,n,t,r){const o=Te(e,t,r,Se(e,r,n,t));return{tilt:o,mode:n-o<1?F.LOCKED:F.ADJUST}}function pe(e,n){return{...e,center:u(n)}}function de(e,n){const{state:t,spatialReference:r}=e,o=n.spatialReference;return t.isGlobal&&P(o,M.Global)||t.isLocal&&r.equals(o)}function he(e,n){let t,r,o;if(e.state.isGlobal){const e=new p(n.xmin,n.ymin,n.spatialReference),i=new p(n.xmax,n.ymax,n.spatialReference),a=n.spatialReference.isGeographic?V:J;t=new p({x:a.center(e.x,i.x),y:(i.y+e.y)/2,z:null!=n.zmax&&null!=n.zmin?(n.zmax+n.zmin)/2:void 0,spatialReference:n.spatialReference});const c=m(n.spatialReference),l=b(t,e,i);r=l.lon,o=l.lat,a.diff(e.x,i.x)>a.range/2&&(r+=c.halfCircumference),r=Math.min(r,c.halfCircumference),o=Math.min(o,c.halfCircumference)}else{const i=e.renderSpatialReference??n.spatialReference;i.equals(n.spatialReference)||(n=h(n,i)),r=n.xmax-n.xmin,o=n.ymax-n.ymin;const a=null!=n.zmax&&null!=n.zmin?(n.zmax+n.zmin)/2:void 0;t=new p({x:n.xmin+.5*r,y:n.ymin+.5*o,z:a,spatialReference:i})}const i=null!=n.zmax&&null!=n.zmin?n.zmax-n.zmin:0,a=e.state.camera,c=1/Math.tan(a.fovX/2),l=1/Math.tan(a.fovY/2),s=1/Math.tan(a.fov/2);return{center:t,distance:Math.max(.5*r*c,.5*o*l,.5*i*s)/L}}async function ge(e,n,t,r,o,a){const c=de(e,n)?n:await d(n,e.spatialReference,{signal:a});i(a);const{center:l,distance:s}=he(e,c),u=await ce(e,t,r,l,s,o,a);return i(a),ze(e,u,e.camera.fov,a)}function ye(e,n,t,r,o,i){let a;try{a=de(e,n)?n:h(n,e.spatialReference)}catch(u){return null}const{center:c,distance:l}=he(e,a),s=ae(e,t,r,c,l,o);return null==s?null:Ce(e,s,e.camera.fov,i)}function ve(e,n,t){const r=e.renderSpatialReference,o=new p({spatialReference:W(e)});if(!w(t,r,o))return null;const i=Math.tan(n.fovX/2),a=Math.tan(n.fovY/2),c=l(n.eye,t),s=2*c*i*L,u=2*c*a*L;return"global"===e.viewingMode?C(e,o,s,u):T(e,o,s,u)}function we(e,n,t){const r=e.pointsOfInterest.centerOnSurfaceFrequent.distance;if(Math.log(t/r)/Math.LN2>G)return!0;const o=e.renderSpatialReference,i=W(e),a=new p({spatialReference:i});if(!w(n,o,a))return!1;const c=new p({spatialReference:i});if(!w(e.pointsOfInterest.centerOnSurfaceFrequent.renderLocation,o,c))return!1;const l=Math.tan(.5*e.state.camera.fov)*r;return c.distance(a)/l>E}function Re(e,n,t,r,o,i){let a=0;return i===F.ADJUST&&we(e,r,o)?(n=0,a=Me(e,o,t,r)):a=je(e,r,o,t),a=e.state.constraints.clampTilt(o,a),{heading:n,tilt:t=Te(e,r,o,a)}}const xe=.7;function Me(e,n,t,r){const o=je(e,r,n,t);if(!e.state.constraints.tilt)return o;const i=e.state.constraints.tilt(n);i.max=Math.min(i.max,.5*Math.PI);const a=i.min*(1-xe)+i.max*xe;return Math.min(o,a)}function Se(e,n,t,r){let o=je(e,r,n,t);if(!e.state.constraints.tilt)return o;const i=e.state.constraints.tilt(n);return o=Math.min(o,.5*Math.PI),i.min*(1-xe)+o*xe}function Te(e,n,t,r){return X(e).lookAtTiltToEyeTilt(r,n,t)}function je(e,n,t,r){return X(e).eyeTiltToLookAtTilt(r,n,t)}function Ce(n,t,r,o){if(null==t)return null;const i=n.renderSpatialReference,a=new p({spatialReference:W(n)});return w(t.eye,i,a)?(o??=new e,o.position=a,o.heading=t.heading,o.tilt=t.tilt,o.fov=r,o):null}async function ze(n,t,r,o){const a=n.renderSpatialReference,c=new p({spatialReference:W(n)});return await R(t.eye,a,c,{signal:o}),i(o),new e(c,t.heading,t.tilt,r)}function be(e,n){const t=e.basemapTerrain?.tilingScheme;if(t)return t.levelAtScale(n);A().error("#scaleToZoom()","Cannot compute zoom from scale without a tiling scheme")}function Ue(e,n){const t=e.basemapTerrain?.tilingScheme;if(t)return t.scaleAtLevel(n);A().error("#zoomToScale()","Cannot compute scale from zoom without a tiling scheme")}function Pe(e,n){return x(n.center,e.renderSpatialReference,q,g.WGS84),Q(e,n.distance,q[1])}export{F as OrientationMode,Pe as computeScale,ne as directionToHeadingTilt,Q as distanceToScale,Y as externalToInternal,ee as fromCenterDistanceAsync,_ as fromCenterDistanceSync,$ as fromCenterScale,ge as fromExtentAsync,ye as fromExtentSync,ce as getObserverForPointAtDistanceAsync,ae as getObserverForPointAtDistanceSync,W as getViewSR,K as headingTiltToDirectionUp,Z as internalToExternal,B as scaleToDistance,be as scaleToZoom,ve as toExtent,Ue as zoomToScale};
@@ -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{rad2deg as t,acosClamped as s}from"../../../core/mathUtils.js";import{n as o,j as a,c as i,h as n,f as r,l as c,b as e}from"../../../chunks/vec32.js";import{create as l}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";const f=l(),m=l();function h(){return{direction:l(),up:l()}}function u(l,h,u,p,b){let j=o(f,l),d=a(j,p);const g=d>0;d=Math.abs(d),d>.99&&(d=Math.abs(a(h,p)),d<.99?(i(j,h),g&&n(j,j,-1)):j=null);let v=0;if(j){n(m,p,a(p,j)),r(j,j,m);const o=a(j,b)/(c(j)*c(b));e(m,j,b);v=(a(m,p)>0?1:-1)*t(s(o))}const x=t(s(-a(p,l)/c(l)));return u?(u.heading=v,u.tilt=x,u):{heading:v,tilt:x}}export{h as createDirectionUp,u as directionToHeadingTilt};
5
+ import{rad2deg as t,acosClamped as s}from"../../../core/mathUtils.js";import{n as o,k as a,c as i,h as n,f as r,l as c,b as e}from"../../../chunks/vec32.js";import{create as l}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";const f=l(),m=l();function h(){return{direction:l(),up:l()}}function u(l,h,u,p,b){let d=o(f,l),g=a(d,p);const j=g>0;g=Math.abs(g),g>.99&&(g=Math.abs(a(h,p)),g<.99?(i(d,h),j&&n(d,d,-1)):d=null);let k=0;if(d){n(m,p,a(p,d)),r(d,d,m);const o=a(d,b)/(c(d)*c(b));e(m,d,b);k=(a(m,p)>0?1:-1)*t(s(o))}const v=t(s(-a(p,l)/c(l)));return u?(u.heading=k,u.tilt=v,u):{heading:k,tilt:v}}export{h as createDirectionUp,u as directionToHeadingTilt};
@@ -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{create as r}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{j as n,f as t,g as i,h as e,p as c,c as o,n as u}from"../../../chunks/vec32.js";import{create as f}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{signedDistance as l,getNormal as s}from"../../../geometry/support/plane.js";function p(r,n,t){return r[0]*n[0]+r[1]*n[1]+r[2]*n[2]+r[3]<t}function a(r,n,t){const i=n[0],e=n[1],c=n[2];return!(r[0][0]*i+r[0][1]*e+r[0][2]*c+r[0][3]>t)&&(!(r[1][0]*i+r[1][1]*e+r[1][2]*c+r[1][3]>t)&&(!(r[2][0]*i+r[2][1]*e+r[2][2]*c+r[2][3]>t)&&(!(r[3][0]*i+r[3][1]*e+r[3][2]*c+r[3][3]>t)&&(!(r[4][0]*i+r[4][1]*e+r[4][2]*c+r[4][3]>t)&&!(r[5][0]*i+r[5][1]*e+r[5][2]*c+r[5][3]>t)))))}function m(r,n,t,i){return x(r,n,null,h(i,n,t,!1))}function d(r,n){for(let t=0;t<6;t++){if(l(r[t],n)>0)return!1}return!0}function g(r,n,t,i){return x(r,n,t,h(i,n,t,!0))}function j(r,c,o,u){const f=n(o,t(r,u,c));return i(r,c,e(r,o,f))}const b={dir:f(),len:0,clip:r()};function h(r,n,i,f){const l=b;return r?(i&&f&&(l.len=c(n,i)),o(l.dir,r)):f?(l.len=c(n,i),t(l.dir,i,n),e(l.dir,l.dir,1/l.len)):(t(l.dir,i,n),u(l.dir,l.dir)),l}function v(r,t,i){const e=n(s(r),i.dir),c=-l(r,t);if(c<0&&e>=0)return!1;if(e>-1e-6&&e<1e-6)return c>0;if((c<0||e<0)&&!(c<0&&e<0))return!0;const o=c/e;return e>0?o<i.clip[1]&&(i.clip[1]=o):o>i.clip[0]&&(i.clip[0]=o),i.clip[0]<=i.clip[1]}function x(r,n,t,i){i.clip[0]=0,i.clip[1]=t?i.len:Number.MAX_VALUE;for(let e=0;e<r.length;e++)if(!v(r[e],n,i))return!1;return!0}export{j as closestPointOnRay,g as frustumLineSegment,d as frustumPoint,m as frustumRay,a as frustumSphere,p as planeSphere};
5
+ import{create as r}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{k as n,f as t,g as i,h as e,q as c,c as o,n as u}from"../../../chunks/vec32.js";import{create as f}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{signedDistance as l,getNormal as s}from"../../../geometry/support/plane.js";function p(r,n,t){return r[0]*n[0]+r[1]*n[1]+r[2]*n[2]+r[3]<t}function a(r,n,t){const i=n[0],e=n[1],c=n[2];return!(r[0][0]*i+r[0][1]*e+r[0][2]*c+r[0][3]>t)&&(!(r[1][0]*i+r[1][1]*e+r[1][2]*c+r[1][3]>t)&&(!(r[2][0]*i+r[2][1]*e+r[2][2]*c+r[2][3]>t)&&(!(r[3][0]*i+r[3][1]*e+r[3][2]*c+r[3][3]>t)&&(!(r[4][0]*i+r[4][1]*e+r[4][2]*c+r[4][3]>t)&&!(r[5][0]*i+r[5][1]*e+r[5][2]*c+r[5][3]>t)))))}function m(r,n,t,i){return x(r,n,null,h(i,n,t,!1))}function d(r,n){for(let t=0;t<6;t++){if(l(r[t],n)>0)return!1}return!0}function g(r,n,t,i){return x(r,n,t,h(i,n,t,!0))}function j(r,c,o,u){const f=n(o,t(r,u,c));return i(r,c,e(r,o,f))}const b={dir:f(),len:0,clip:r()};function h(r,n,i,f){const l=b;return r?(i&&f&&(l.len=c(n,i)),o(l.dir,r)):f?(l.len=c(n,i),t(l.dir,i,n),e(l.dir,l.dir,1/l.len)):(t(l.dir,i,n),u(l.dir,l.dir)),l}function v(r,t,i){const e=n(s(r),i.dir),c=-l(r,t);if(c<0&&e>=0)return!1;if(e>-1e-6&&e<1e-6)return c>0;if((c<0||e<0)&&!(c<0&&e<0))return!0;const o=c/e;return e>0?o<i.clip[1]&&(i.clip[1]=o):o>i.clip[0]&&(i.clip[0]=o),i.clip[0]<=i.clip[1]}function x(r,n,t,i){i.clip[0]=0,i.clip[1]=t?i.len:Number.MAX_VALUE;for(let e=0;e<r.length;e++)if(!v(r[e],n,i))return!1;return!0}export{j as closestPointOnRay,g as frustumLineSegment,d as frustumPoint,m as frustumRay,a as frustumSphere,p as planeSphere};
@@ -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{acosClamped as t}from"../../../core/mathUtils.js";import{s as n,j as s,n as r,b as o,l as a,h as c,g as i,k as u,f as h}from"../../../chunks/vec32.js";import{create as f}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";function e(t,n){return t>n?Math.cos(n):Math.cos(t)}function M(t,n,s){return 2*Math.atan(s*Math.tan(.5*t)/n)}function l(t,n,s){return 2*Math.atan(n*Math.tan(.5*t)/s)}function m(t){const n=t[0]*t[0]+t[4]*t[4]+t[8]*t[8],s=t[1]*t[1]+t[5]*t[5]+t[9]*t[9],r=t[2]*t[2]+t[6]*t[6]+t[10]*t[10];return Math.sqrt(Math.max(n,s,r))}function g(t,s){const r=Math.sqrt(s[0]*s[0]+s[4]*s[4]+s[8]*s[8]),o=Math.sqrt(s[1]*s[1]+s[5]*s[5]+s[9]*s[9]),a=Math.sqrt(s[2]*s[2]+s[6]*s[6]+s[10]*s[10]);return n(t,r,o,a),t}function b(t,o,a){a=a||t;const c=s(t,o);n(a,t[0]-c*o[0],t[1]-c*o[1],t[2]-c*o[2]),r(a,a)}function j(t,s,a){Math.abs(t[0])>Math.abs(t[1])?n(s,0,1,0):n(s,1,0,0),o(a,t,s),o(s,a,t),r(a,a),r(s,s)}function p(t,n,s,r,o,a){const c=t+(n-t)*o;return c+(s+(r-s)*o-c)*a}function q(t,n,r,o=f()){const h=a(t),e=a(n),M=s(t,n)/(h*e);if(M<.9999999999999999){const s=Math.acos(M),a=((1-r)*h+r*e)/Math.sin(s),u=a/h*Math.sin((1-r)*s),f=a/e*Math.sin(r*s);return c(A,t,u),c(B,n,f),i(o,A,B)}return u(o,t,n,r)}function x(t,n,o,e=f(),M=f()){const l=a(t),m=a(n),g=s(t,n)/(l*m);if(g<.9999999999999999){const s=Math.acos(g),r=Math.sin(s),a=Math.sin(o*s),u=Math.sin((1-o)*s),h=(1-o)*l+o*m;{const s=h/r,o=s/m*a;c(A,t,s/l*u),c(B,n,o),i(e,A,B)}{const f=1/l*(-Math.cos((1-o)*s)*s*h+u*(-l+m));c(A,t,f);const e=1/m*(Math.cos(o*s)*s*h+a*(-l+m));c(B,n,e),i(M,A,B),c(M,M,1/r)}return M}return u(e,t,n,o),h(M,n,t),r(M,M),M}function k(n,a,c){n=r(A,n),a=r(B,a);const i=t(s(n,a));if(c){const t=o(z,n,a);if(s(t,c)<0)return-i}return i}function v(t){const n=t.length;return s=>{if(s<=t[0][0])return t[0][1];if(s>=t[n-1][0])return t[n-1][1];let r=1;for(;s>t[r][0];)r++;const o=t[r-1][0],a=t[r][0],c=(a-s)/(a-o);return c*t[r-1][1]+(1-c)*t[r][1]}}function U(t,n,a,c){h(w,n,t),h(y,a,t),o(c,w,y),r(c,c),c[3]=-s(t,c)}function d(t,s){if(n(s,0,0,0),t.length>0){for(let n=0;n<t.length;++n)i(s,s,t[n]);c(s,s,1/t.length)}}const w=f(),y=f(),z=f(),A=f(),B=f();export{k as angle,p as bilerp,e as cosCapped,M as fovx2fovy,l as fovy2fovx,b as makeOrthonormal,v as makePiecewiseLinearFunction,m as maxScale,d as midpoint3d,U as planeFromPoints,g as scaleFromMatrix,q as slerp,x as slerpTangent,j as tangentFrame};
5
+ import{acosClamped as t}from"../../../core/mathUtils.js";import{s as n,k as s,n as r,b as o,l as a,h as c,g as i,m as u,f as h}from"../../../chunks/vec32.js";import{create as f}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";function e(t,n){return t>n?Math.cos(n):Math.cos(t)}function M(t,n,s){return 2*Math.atan(s*Math.tan(.5*t)/n)}function l(t,n,s){return 2*Math.atan(n*Math.tan(.5*t)/s)}function m(t){const n=t[0]*t[0]+t[4]*t[4]+t[8]*t[8],s=t[1]*t[1]+t[5]*t[5]+t[9]*t[9],r=t[2]*t[2]+t[6]*t[6]+t[10]*t[10];return Math.sqrt(Math.max(n,s,r))}function g(t,s){const r=Math.sqrt(s[0]*s[0]+s[4]*s[4]+s[8]*s[8]),o=Math.sqrt(s[1]*s[1]+s[5]*s[5]+s[9]*s[9]),a=Math.sqrt(s[2]*s[2]+s[6]*s[6]+s[10]*s[10]);return n(t,r,o,a),t}function b(t,o,a){a=a||t;const c=s(t,o);n(a,t[0]-c*o[0],t[1]-c*o[1],t[2]-c*o[2]),r(a,a)}function p(t,s,a){Math.abs(t[0])>Math.abs(t[1])?n(s,0,1,0):n(s,1,0,0),o(a,t,s),o(s,a,t),r(a,a),r(s,s)}function q(t,n,s,r,o,a){const c=t+(n-t)*o;return c+(s+(r-s)*o-c)*a}function j(t,n,r,o=f()){const h=a(t),e=a(n),M=s(t,n)/(h*e);if(M<.9999999999999999){const s=Math.acos(M),a=((1-r)*h+r*e)/Math.sin(s),u=a/h*Math.sin((1-r)*s),f=a/e*Math.sin(r*s);return c(A,t,u),c(B,n,f),i(o,A,B)}return u(o,t,n,r)}function x(t,n,o,e=f(),M=f()){const l=a(t),m=a(n),g=s(t,n)/(l*m);if(g<.9999999999999999){const s=Math.acos(g),r=Math.sin(s),a=Math.sin(o*s),u=Math.sin((1-o)*s),h=(1-o)*l+o*m;{const s=h/r,o=s/m*a;c(A,t,s/l*u),c(B,n,o),i(e,A,B)}{const f=1/l*(-Math.cos((1-o)*s)*s*h+u*(-l+m));c(A,t,f);const e=1/m*(Math.cos(o*s)*s*h+a*(-l+m));c(B,n,e),i(M,A,B),c(M,M,1/r)}return M}return u(e,t,n,o),h(M,n,t),r(M,M),M}function k(n,a,c){n=r(A,n),a=r(B,a);const i=t(s(n,a));if(c){const t=o(z,n,a);if(s(t,c)<0)return-i}return i}function v(t){const n=t.length;return s=>{if(s<=t[0][0])return t[0][1];if(s>=t[n-1][0])return t[n-1][1];let r=1;for(;s>t[r][0];)r++;const o=t[r-1][0],a=t[r][0],c=(a-s)/(a-o);return c*t[r-1][1]+(1-c)*t[r][1]}}function U(t,n,a,c){h(w,n,t),h(y,a,t),o(c,w,y),r(c,c),c[3]=-s(t,c)}function d(t,s){if(n(s,0,0,0),t.length>0){for(let n=0;n<t.length;++n)i(s,s,t[n]);c(s,s,1/t.length)}}const w=f(),y=f(),z=f(),A=f(),B=f();export{k as angle,q as bilerp,e as cosCapped,M as fovx2fovy,l as fovy2fovx,b as makeOrthonormal,v as makePiecewiseLinearFunction,m as maxScale,d as midpoint3d,U as planeFromPoints,g as scaleFromMatrix,j as slerp,x as slerpTangent,p as tangentFrame};
@@ -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{fromQuat as t,scale as a}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as e}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as s}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as i,conjugate as r,multiply as n}from"../../../core/libs/gl-matrix-2/math/quat.js";import{IDENTITY as o,create as h}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{s as c,r as d,u as l,v as _,w as m,t as f,g as u,x as g,y as p,l as M,h as b,q as j,z as S,A as z,B as x}from"../../../chunks/vec32.js";import{ZEROS as y,create as C,UNIT_Z as q,fromValues as Q}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{t as w}from"../../../chunks/vec42.js";import{create as P}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as v}from"../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as R}from"../../../geometry/spatialReferenceEllipsoidUtils.js";import{computeTranslationToOriginAndRotation as A}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as H}from"../../../geometry/projection/projectBuffer.js";import{getProjector as B}from"../../../geometry/projection/projectors.js";import{getNormal as W}from"../../../geometry/support/plane.js";import{isPlateCarree as k}from"../../../geometry/support/spatialReferenceUtils.js";import{sv3d as D,sq4d as G}from"../../../geometry/support/vectorStacks.js";import{ViewingMode as U}from"../../ViewingMode.js";import{computeOBB as V}from"./dito.js";import{Vertices as Z}from"../webgl-engine/lib/Attribute.js";class O{constructor(t=y,a=gt,e=o){this._data=[t[0],t[1],t[2],a[0],a[1],a[2],e[0],e[1],e[2],e[3]]}clone(){const t=new O;return t._data=this._data.slice(),t}invalidate(){this._data[3]=-1}get isValid(){return this._data[3]>=0}static fromData(t){const a=new O;return a._data=t.slice(),a}static fromJSON(t){return new O(t.center,t.halfSize,t.quaternion)}copy(t){this._data=t.data.slice()}get center(){return c(D.get(),this._data[0],this._data[1],this._data[2])}get centerX(){return this._data[0]}get centerY(){return this._data[1]}get centerZ(){return this._data[2]}getCenter(t){return t[0]=this._data[0],t[1]=this._data[1],t[2]=this._data[2],t}set center(t){this._data[0]=t[0],this._data[1]=t[1],this._data[2]=t[2]}setCenter(t,a,e){this._data[0]=t,this._data[1]=a,this._data[2]=e}get halfSize(){return c(D.get(),this._data[3],this._data[4],this._data[5])}get halfSizeX(){return this._data[3]}get halfSizeY(){return this._data[4]}get halfSizeZ(){return this._data[5]}getHalfSize(t){return t[0]=this._data[3],t[1]=this._data[4],t[2]=this._data[5],t}set halfSize(t){this._data[3]=t[0],this._data[4]=t[1],this._data[5]=t[2]}get quaternion(){return i(G.get(),this._data[6],this._data[7],this._data[8],this._data[9])}getQuaternion(t){return t[0]=this._data[6],t[1]=this._data[7],t[2]=this._data[8],t[3]=this._data[9],t}set quaternion(t){this._data[6]=t[0],this._data[7]=t[1],this._data[8]=t[2],this._data[9]=t[3]}get data(){return this._data}getCorners(t){const a=T,e=this._data;a[0]=e[6],a[1]=e[7],a[2]=e[8],a[3]=e[9];for(let s=0;s<8;++s){const i=t[s];i[0]=(1&s?-1:1)*e[3],i[1]=(2&s?-1:1)*e[4],i[2]=(4&s?-1:1)*e[5],d(i,i,a),i[0]+=e[0],i[1]+=e[1],i[2]+=e[2]}}isVisible(t){return this.intersectPlane(t[0])<=0&&this.intersectPlane(t[1])<=0&&this.intersectPlane(t[2])<=0&&this.intersectPlane(t[3])<=0&&this.intersectPlane(t[4])<=0&&this.intersectPlane(t[5])<=0}get radius(){const t=this._data[3],a=this._data[4],e=this._data[5];return Math.sqrt(t*t+a*a+e*e)}intersectSphere(t){E[0]=this._data[0]-t[0],E[1]=this._data[1]-t[1],E[2]=this._data[2]-t[2];const a=this.getQuaternion(X);return r(T,a),d(E,E,T),l(E,E),F[0]=Math.min(E[0],this._data[3]),F[1]=Math.min(E[1],this._data[4]),F[2]=Math.min(E[2],this._data[5]),_(F,E)<t[3]*t[3]}intersectSphereWithMBS(t,a=this.radius){const e=this._data;E[0]=e[0]-t[0],E[1]=e[1]-t[1],E[2]=e[2]-t[2];const s=t[3],i=s+a;return!(m(E)>i*i)&&(T[0]=-e[6],T[1]=-e[7],T[2]=-e[8],T[3]=e[9],d(E,E,T),l(E,E),F[0]=Math.min(E[0],e[3]),F[1]=Math.min(E[1],e[4]),F[2]=Math.min(E[2],e[5]),_(F,E)<s*s)}intersectPlane(t){const a=t[0]*this._data[0]+t[1]*this._data[1]+t[2]*this._data[2]+t[3],e=this.projectedRadius(W(t));return a>e?1:a<-e?-1:0}intersectRay(t,a,e=0){const s=this._data,i=T;i[0]=-s[6],i[1]=-s[7],i[2]=-s[8],i[3]=s[9],E[0]=t[0]-s[0],E[1]=t[1]-s[1],E[2]=t[2]-s[2];const r=d(E,E,T),n=d(F,a,T);let o=-1/0,h=1/0;const c=this.getHalfSize(ct);for(let d=0;d<3;d++){const t=r[d],a=n[d],s=c[d]+e;if(Math.abs(a)>1e-6){const e=(s-t)/a,i=(-s-t)/a;o=Math.max(o,Math.min(e,i)),h=Math.min(h,Math.max(e,i))}else if(t>s||t<-s)return!1}return o<=h}projectedArea(e,s,i,n){const o=this.getQuaternion(X);r(T,o),E[0]=e[0]-this._data[0],E[1]=e[1]-this._data[1],E[2]=e[2]-this._data[2],d(E,E,T);const h=this.getHalfSize(ct),l=E[0]<-h[0]?-1:E[0]>h[0]?1:0,_=E[1]<-h[1]?-1:E[1]>h[1]?1:0,m=E[2]<-h[2]?-1:E[2]>h[2]?1:0,g=Math.abs(l)+Math.abs(_)+Math.abs(m);if(0===g)return 1/0;const p=1===g?4:6,M=6*(l+3*_+9*m+13);t(dt,o),a(dt,dt,h);const b=this.getCenter(ot);for(let t=0;t<p;t++){const a=K[M+t];c(E,((1&a)<<1)-1,(2&a)-1,((4&a)>>1)-1),f(E,E,dt),u(I,b,E),I[3]=1,w(I,I,s);const e=1/Math.max(1e-6,I[3]);N[2*t]=I[0]*e,N[2*t+1]=I[1]*e}const j=2*p-2;let S=N[0]*(N[3]-N[j+1])+N[j]*(N[1]-N[j-1]);for(let t=2;t<j;t+=2)S+=N[t]*(N[t+3]-N[t-1]);return Math.abs(S)*i*n*.125}projectedRadius(t){const a=this.getQuaternion(X);return r(T,a),d(E,t,T),Math.abs(E[0]*this._data[3])+Math.abs(E[1]*this._data[4])+Math.abs(E[2]*this._data[5])}minimumDistancePlane(t){return t[0]*this._data[0]+t[1]*this._data[1]+t[2]*this._data[2]+t[3]-this.projectedRadius(W(t))}maximumDistancePlane(t){return t[0]*this._data[0]+t[1]*this._data[1]+t[2]*this._data[2]+t[3]+this.projectedRadius(W(t))}toAaBoundingBox(a){const e=this.getQuaternion(X),s=t(dt,e),i=this._data[3]*Math.abs(s[0])+this._data[4]*Math.abs(s[3])+this._data[5]*Math.abs(s[6]),r=this._data[3]*Math.abs(s[1])+this._data[4]*Math.abs(s[4])+this._data[5]*Math.abs(s[7]),n=this._data[3]*Math.abs(s[2])+this._data[4]*Math.abs(s[5])+this._data[5]*Math.abs(s[8]);a[0]=this._data[0]-i,a[1]=this._data[1]-r,a[2]=this._data[2]-n,a[3]=this._data[0]+i,a[4]=this._data[1]+r,a[5]=this._data[2]+n}transform(t,a,e,s=0,i=R(e),r=R(a),n=B(a,r)){if(e===i)a.isGeographic?st(this,t,a,s,r):et(this,t,a,s,r,n);else if(a.isWGS84&&(e.isWebMercator||k(e)))$(a,this,e,t,s);else if(a.isWebMercator&&k(e))tt(a,this,e,t,s);else{const i=this.getCenter(ot);i[2]+=s,H(i,a,0,i,e,0,1),t.center=i,this!==t&&(t.quaternion=this.getQuaternion(X),t.halfSize=this.getHalfSize(ct))}}}const T=h(),X=h(),Y=h(),E=C(),F=C(),I=P();function J(t,a=new O){return V(t,a),a}const N=[.1,.2,.3,.4,.5,.6,.7,.8,.9,1,1.1,1.2],K=(()=>{const t=new Int8Array(162);let a=0;const e=e=>{for(let s=0;s<e.length;s++)t[a+s]=e[s];a+=6};return e([6,2,3,1,5,4]),e([0,2,3,1,5,4]),e([0,2,3,7,5,4]),e([0,1,3,2,6,4]),e([0,1,3,2,0,0]),e([0,1,5,7,3,2]),e([0,1,3,7,6,4]),e([0,1,3,7,6,2]),e([0,1,5,7,6,2]),e([0,1,5,4,6,2]),e([0,1,5,4,0,0]),e([0,1,3,7,5,4]),e([0,2,6,4,0,0]),e([0,0,0,0,0,0]),e([1,3,7,5,0,0]),e([2,3,7,6,4,0]),e([2,3,7,6,0,0]),e([2,3,1,5,7,6]),e([0,1,5,7,6,2]),e([0,1,5,7,6,4]),e([0,1,3,7,6,4]),e([4,5,7,6,2,0]),e([4,5,7,6,0,0]),e([4,5,1,3,7,6]),e([0,2,3,7,5,4]),e([6,2,3,7,5,4]),e([6,2,3,1,5,4]),t})();function L(t,a,e,s,i){const n=t.getQuaternion(X);i.quaternion=n,r(T,n);const o=t.getCenter(ot),h=t.getHalfSize(ct);if(s===U.Global){d(mt,o,T),l(ft,mt),g(ut,ft,h),p(ut,ft,ut);const s=M(ut);u(ut,ft,h);const r=M(ut);if(s<e)i.center=o,c(mt,e,e,e),i.halfSize=u(mt,h,mt);else{const n=r>0?1+a/r:1,o=s>0?1+e/s:1,c=(o+n)/2,l=(o-n)/2;b(ut,ft,l),i.halfSize=j(ut,ut,h,c),b(ut,ft,c),j(ut,ut,h,l),S(mt,mt),z(mt,ut,mt);const _=t.getQuaternion(Y);i.center=d(mt,mt,_)}}else{i.center=j(mt,o,q,(e+a)/2);const t=d(mt,q,T);l(t,t),i.halfSize=j(ft,h,t,(e-a)/2)}return i}function $(t,a,e,s,i){a.getCenter(ot),ot[2]+=i;const r=R(e);H(ot,t,0,ot,r,0,1),at(r,a,ot,e,s)}function tt(t,a,e,s,i){a.getCenter(ot),ot[2]+=i,at(t,a,ot,e,s)}function at(a,e,s,i,r){const n=e.getQuaternion(X),o=t(dt,n),h=e.getHalfSize(ct);for(let t=0;t<8;++t){for(let a=0;a<3;++a)nt[a]=h[a]*(0!=(t&1<<a)?-1:1);for(let a=0;a<3;++a){let e=s[a];for(let t=0;t<3;++t)e+=nt[t]*o[3*t+a];it[3*t+a]=e}}H(it,a,0,it,i,0,8),J(rt,r)}function et(t,a,e,s,i=R(e),o=B(e,i)){t.getCorners(_t),t.getCenter(nt),nt[2]+=s,A(e,nt,lt,i),a.setCenter(lt[12],lt[13],lt[14]);const h=2*Math.sqrt(1+lt[0]+lt[5]+lt[10]);T[0]=(lt[6]-lt[9])/h,T[1]=(lt[8]-lt[2])/h,T[2]=(lt[1]-lt[4])/h,T[3]=.25*h;const _=t.getQuaternion(X);a.quaternion=n(T,T,_),r(T,T),c(ft,0,0,0);const m=a.getCenter(ht);for(const r of _t)r[2]+=s,o(r,0,r,0),p(mt,r,m),d(mt,mt,T),l(mt,mt),x(ft,ft,mt);a.halfSize=ft}function st(t,a,e,s,i=R(e)){const n=v(e),o=1+Math.max(0,s)/(n.radius+t.centerZ);t.getCenter(nt),nt[2]+=s,H(nt,e,0,nt,i,0,1),a.center=nt;const h=t.getQuaternion(X);a.quaternion=h,r(T,h),c(mt,0,0,1),d(mt,mt,T);const l=t.getHalfSize(ct);c(mt,l[0]*Math.abs(mt[0]),l[1]*Math.abs(mt[1]),l[2]*Math.abs(mt[2])),b(mt,mt,n.inverseFlattening),u(mt,l,mt),a.halfSize=b(mt,mt,o)}const it=new Array(24),rt=new Z(it,3),nt=C(),ot=C(),ht=C(),ct=C(),dt=e(),lt=s(),_t=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],mt=C(),ft=C(),ut=C(),gt=Q(-1,-1,-1);export{O as Obb,J as compute,L as computeOffsetObb};
5
+ import{fromQuat as t,scale as a}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as e}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as s}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as i,conjugate as r,multiply as n}from"../../../core/libs/gl-matrix-2/math/quat.js";import{IDENTITY as o,create as h}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{s as c,u as d,v as l,w as _,x as m,t as f,g as u,y as g,z as p,l as M,h as b,r as j,A as S,B as z,C as x}from"../../../chunks/vec32.js";import{ZEROS as y,create as C,UNIT_Z as q,fromValues as Q}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{t as w}from"../../../chunks/vec42.js";import{create as P}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as v}from"../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as R}from"../../../geometry/spatialReferenceEllipsoidUtils.js";import{computeTranslationToOriginAndRotation as A}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as H}from"../../../geometry/projection/projectBuffer.js";import{getProjector as B}from"../../../geometry/projection/projectors.js";import{getNormal as W}from"../../../geometry/support/plane.js";import{isPlateCarree as k}from"../../../geometry/support/spatialReferenceUtils.js";import{sv3d as D,sq4d as G}from"../../../geometry/support/vectorStacks.js";import{ViewingMode as U}from"../../ViewingMode.js";import{computeOBB as V}from"./dito.js";import{Vertices as Z}from"../webgl-engine/lib/Attribute.js";class O{constructor(t=y,a=gt,e=o){this._data=[t[0],t[1],t[2],a[0],a[1],a[2],e[0],e[1],e[2],e[3]]}clone(){const t=new O;return t._data=this._data.slice(),t}invalidate(){this._data[3]=-1}get isValid(){return this._data[3]>=0}static fromData(t){const a=new O;return a._data=t.slice(),a}static fromJSON(t){return new O(t.center,t.halfSize,t.quaternion)}copy(t){this._data=t.data.slice()}get center(){return c(D.get(),this._data[0],this._data[1],this._data[2])}get centerX(){return this._data[0]}get centerY(){return this._data[1]}get centerZ(){return this._data[2]}getCenter(t){return t[0]=this._data[0],t[1]=this._data[1],t[2]=this._data[2],t}set center(t){this._data[0]=t[0],this._data[1]=t[1],this._data[2]=t[2]}setCenter(t,a,e){this._data[0]=t,this._data[1]=a,this._data[2]=e}get halfSize(){return c(D.get(),this._data[3],this._data[4],this._data[5])}get halfSizeX(){return this._data[3]}get halfSizeY(){return this._data[4]}get halfSizeZ(){return this._data[5]}getHalfSize(t){return t[0]=this._data[3],t[1]=this._data[4],t[2]=this._data[5],t}set halfSize(t){this._data[3]=t[0],this._data[4]=t[1],this._data[5]=t[2]}get quaternion(){return i(G.get(),this._data[6],this._data[7],this._data[8],this._data[9])}getQuaternion(t){return t[0]=this._data[6],t[1]=this._data[7],t[2]=this._data[8],t[3]=this._data[9],t}set quaternion(t){this._data[6]=t[0],this._data[7]=t[1],this._data[8]=t[2],this._data[9]=t[3]}get data(){return this._data}getCorners(t){const a=T,e=this._data;a[0]=e[6],a[1]=e[7],a[2]=e[8],a[3]=e[9];for(let s=0;s<8;++s){const i=t[s];i[0]=(1&s?-1:1)*e[3],i[1]=(2&s?-1:1)*e[4],i[2]=(4&s?-1:1)*e[5],d(i,i,a),i[0]+=e[0],i[1]+=e[1],i[2]+=e[2]}}isVisible(t){return this.intersectPlane(t[0])<=0&&this.intersectPlane(t[1])<=0&&this.intersectPlane(t[2])<=0&&this.intersectPlane(t[3])<=0&&this.intersectPlane(t[4])<=0&&this.intersectPlane(t[5])<=0}get radius(){const t=this._data[3],a=this._data[4],e=this._data[5];return Math.sqrt(t*t+a*a+e*e)}intersectSphere(t){E[0]=this._data[0]-t[0],E[1]=this._data[1]-t[1],E[2]=this._data[2]-t[2];const a=this.getQuaternion(X);return r(T,a),d(E,E,T),l(E,E),F[0]=Math.min(E[0],this._data[3]),F[1]=Math.min(E[1],this._data[4]),F[2]=Math.min(E[2],this._data[5]),_(F,E)<t[3]*t[3]}intersectSphereWithMBS(t,a=this.radius){const e=this._data;E[0]=e[0]-t[0],E[1]=e[1]-t[1],E[2]=e[2]-t[2];const s=t[3],i=s+a;return!(m(E)>i*i)&&(T[0]=-e[6],T[1]=-e[7],T[2]=-e[8],T[3]=e[9],d(E,E,T),l(E,E),F[0]=Math.min(E[0],e[3]),F[1]=Math.min(E[1],e[4]),F[2]=Math.min(E[2],e[5]),_(F,E)<s*s)}intersectPlane(t){const a=t[0]*this._data[0]+t[1]*this._data[1]+t[2]*this._data[2]+t[3],e=this.projectedRadius(W(t));return a>e?1:a<-e?-1:0}intersectRay(t,a,e=0){const s=this._data,i=T;i[0]=-s[6],i[1]=-s[7],i[2]=-s[8],i[3]=s[9],E[0]=t[0]-s[0],E[1]=t[1]-s[1],E[2]=t[2]-s[2];const r=d(E,E,T),n=d(F,a,T);let o=-1/0,h=1/0;const c=this.getHalfSize(ct);for(let d=0;d<3;d++){const t=r[d],a=n[d],s=c[d]+e;if(Math.abs(a)>1e-6){const e=(s-t)/a,i=(-s-t)/a;o=Math.max(o,Math.min(e,i)),h=Math.min(h,Math.max(e,i))}else if(t>s||t<-s)return!1}return o<=h}projectedArea(e,s,i,n){const o=this.getQuaternion(X);r(T,o),E[0]=e[0]-this._data[0],E[1]=e[1]-this._data[1],E[2]=e[2]-this._data[2],d(E,E,T);const h=this.getHalfSize(ct),l=E[0]<-h[0]?-1:E[0]>h[0]?1:0,_=E[1]<-h[1]?-1:E[1]>h[1]?1:0,m=E[2]<-h[2]?-1:E[2]>h[2]?1:0,g=Math.abs(l)+Math.abs(_)+Math.abs(m);if(0===g)return 1/0;const p=1===g?4:6,M=6*(l+3*_+9*m+13);t(dt,o),a(dt,dt,h);const b=this.getCenter(ot);for(let t=0;t<p;t++){const a=K[M+t];c(E,((1&a)<<1)-1,(2&a)-1,((4&a)>>1)-1),f(E,E,dt),u(I,b,E),I[3]=1,w(I,I,s);const e=1/Math.max(1e-6,I[3]);N[2*t]=I[0]*e,N[2*t+1]=I[1]*e}const j=2*p-2;let S=N[0]*(N[3]-N[j+1])+N[j]*(N[1]-N[j-1]);for(let t=2;t<j;t+=2)S+=N[t]*(N[t+3]-N[t-1]);return Math.abs(S)*i*n*.125}projectedRadius(t){const a=this.getQuaternion(X);return r(T,a),d(E,t,T),Math.abs(E[0]*this._data[3])+Math.abs(E[1]*this._data[4])+Math.abs(E[2]*this._data[5])}minimumDistancePlane(t){return t[0]*this._data[0]+t[1]*this._data[1]+t[2]*this._data[2]+t[3]-this.projectedRadius(W(t))}maximumDistancePlane(t){return t[0]*this._data[0]+t[1]*this._data[1]+t[2]*this._data[2]+t[3]+this.projectedRadius(W(t))}toAaBoundingBox(a){const e=this.getQuaternion(X),s=t(dt,e),i=this._data[3]*Math.abs(s[0])+this._data[4]*Math.abs(s[3])+this._data[5]*Math.abs(s[6]),r=this._data[3]*Math.abs(s[1])+this._data[4]*Math.abs(s[4])+this._data[5]*Math.abs(s[7]),n=this._data[3]*Math.abs(s[2])+this._data[4]*Math.abs(s[5])+this._data[5]*Math.abs(s[8]);a[0]=this._data[0]-i,a[1]=this._data[1]-r,a[2]=this._data[2]-n,a[3]=this._data[0]+i,a[4]=this._data[1]+r,a[5]=this._data[2]+n}transform(t,a,e,s=0,i=R(e),r=R(a),n=B(a,r)){if(e===i)a.isGeographic?st(this,t,a,s,r):et(this,t,a,s,r,n);else if(a.isWGS84&&(e.isWebMercator||k(e)))$(a,this,e,t,s);else if(a.isWebMercator&&k(e))tt(a,this,e,t,s);else{const i=this.getCenter(ot);i[2]+=s,H(i,a,0,i,e,0,1),t.center=i,this!==t&&(t.quaternion=this.getQuaternion(X),t.halfSize=this.getHalfSize(ct))}}}const T=h(),X=h(),Y=h(),E=C(),F=C(),I=P();function J(t,a=new O){return V(t,a),a}const N=[.1,.2,.3,.4,.5,.6,.7,.8,.9,1,1.1,1.2],K=(()=>{const t=new Int8Array(162);let a=0;const e=e=>{for(let s=0;s<e.length;s++)t[a+s]=e[s];a+=6};return e([6,2,3,1,5,4]),e([0,2,3,1,5,4]),e([0,2,3,7,5,4]),e([0,1,3,2,6,4]),e([0,1,3,2,0,0]),e([0,1,5,7,3,2]),e([0,1,3,7,6,4]),e([0,1,3,7,6,2]),e([0,1,5,7,6,2]),e([0,1,5,4,6,2]),e([0,1,5,4,0,0]),e([0,1,3,7,5,4]),e([0,2,6,4,0,0]),e([0,0,0,0,0,0]),e([1,3,7,5,0,0]),e([2,3,7,6,4,0]),e([2,3,7,6,0,0]),e([2,3,1,5,7,6]),e([0,1,5,7,6,2]),e([0,1,5,7,6,4]),e([0,1,3,7,6,4]),e([4,5,7,6,2,0]),e([4,5,7,6,0,0]),e([4,5,1,3,7,6]),e([0,2,3,7,5,4]),e([6,2,3,7,5,4]),e([6,2,3,1,5,4]),t})();function L(t,a,e,s,i){const n=t.getQuaternion(X);i.quaternion=n,r(T,n);const o=t.getCenter(ot),h=t.getHalfSize(ct);if(s===U.Global){d(mt,o,T),l(ft,mt),g(ut,ft,h),p(ut,ft,ut);const s=M(ut);u(ut,ft,h);const r=M(ut);if(s<e)i.center=o,c(mt,e,e,e),i.halfSize=u(mt,h,mt);else{const n=r>0?1+a/r:1,o=s>0?1+e/s:1,c=(o+n)/2,l=(o-n)/2;b(ut,ft,l),i.halfSize=j(ut,ut,h,c),b(ut,ft,c),j(ut,ut,h,l),S(mt,mt),z(mt,ut,mt);const _=t.getQuaternion(Y);i.center=d(mt,mt,_)}}else{i.center=j(mt,o,q,(e+a)/2);const t=d(mt,q,T);l(t,t),i.halfSize=j(ft,h,t,(e-a)/2)}return i}function $(t,a,e,s,i){a.getCenter(ot),ot[2]+=i;const r=R(e);H(ot,t,0,ot,r,0,1),at(r,a,ot,e,s)}function tt(t,a,e,s,i){a.getCenter(ot),ot[2]+=i,at(t,a,ot,e,s)}function at(a,e,s,i,r){const n=e.getQuaternion(X),o=t(dt,n),h=e.getHalfSize(ct);for(let t=0;t<8;++t){for(let a=0;a<3;++a)nt[a]=h[a]*(0!=(t&1<<a)?-1:1);for(let a=0;a<3;++a){let e=s[a];for(let t=0;t<3;++t)e+=nt[t]*o[3*t+a];it[3*t+a]=e}}H(it,a,0,it,i,0,8),J(rt,r)}function et(t,a,e,s,i=R(e),o=B(e,i)){t.getCorners(_t),t.getCenter(nt),nt[2]+=s,A(e,nt,lt,i),a.setCenter(lt[12],lt[13],lt[14]);const h=2*Math.sqrt(1+lt[0]+lt[5]+lt[10]);T[0]=(lt[6]-lt[9])/h,T[1]=(lt[8]-lt[2])/h,T[2]=(lt[1]-lt[4])/h,T[3]=.25*h;const _=t.getQuaternion(X);a.quaternion=n(T,T,_),r(T,T),c(ft,0,0,0);const m=a.getCenter(ht);for(const r of _t)r[2]+=s,o(r,0,r,0),p(mt,r,m),d(mt,mt,T),l(mt,mt),x(ft,ft,mt);a.halfSize=ft}function st(t,a,e,s,i=R(e)){const n=v(e),o=1+Math.max(0,s)/(n.radius+t.centerZ);t.getCenter(nt),nt[2]+=s,H(nt,e,0,nt,i,0,1),a.center=nt;const h=t.getQuaternion(X);a.quaternion=h,r(T,h),c(mt,0,0,1),d(mt,mt,T);const l=t.getHalfSize(ct);c(mt,l[0]*Math.abs(mt[0]),l[1]*Math.abs(mt[1]),l[2]*Math.abs(mt[2])),b(mt,mt,n.inverseFlattening),u(mt,l,mt),a.halfSize=b(mt,mt,o)}const it=new Array(24),rt=new Z(it,3),nt=C(),ot=C(),ht=C(),ct=C(),dt=e(),lt=s(),_t=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],mt=C(),ft=C(),ut=C(),gt=Q(-1,-1,-1);export{O as Obb,J as compute,L as computeOffsetObb};
@@ -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{destroyMaybe as e}from"../../../../core/maybe.js";import{isAbortError as r}from"../../../../core/promiseUtils.js";import{on as o}from"../../../../core/reactiveUtils.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{p as n,i as a,c as l}from"../../../../chunks/vec32.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import d from"../../../../geometry/Point.js";import{ViewingMode as p}from"../../../ViewingMode.js";import{distanceToScale as h}from"../cameraUtils.js";import{PropertiesPool as u}from"../PropertiesPool.js";import{PointOfInterest as m}from"./PointOfInterest.js";import{Yield as _}from"../../../support/Yield.js";const g=Array;let y=class extends m{constructor(t){super(t),this._dirty=!1,this._propertiesPool=new u({location:d,renderLocation:g},this),this._estimatedSurfaceAltitude=0,this._pendingElevationQueryController=null,this.renderLocation=c(),this._tmpPoint=new d}initialize(){if(this.scheduler&&this.addHandles(this.scheduler.registerTask(this.task,this)),this.runTask(),this.map){const t=()=>this._setDirty();this.addHandles(o((()=>this.map?.ground?.layers),"change",t,{onListenerAdd:t,onListenerRemove:t}))}this._updateRenderLocation()}destroy(){this._cancelPendingRequest(),this._propertiesPool=e(this._propertiesPool)}get _camera(){return this.state.contentCamera}get location(){const t=this._propertiesPool.get("location");return t.spatialReference=this.state.spatialReference,this.renderCoordsHelper.fromRenderCoords(this.renderLocation,t),t}get scale(){const t=this._camera,e=n(t.eye,this.renderLocation),r={renderCoordsHelper:this.renderCoordsHelper,state:{camera:t}};return h(r,e,0)}get updating(){return this._dirty||null!=this._pendingElevationQueryController}updateRenderLocation(){this._setDirty(),this._updateRenderLocation()}_setDirty(){this._dirty||(this._dirty=!0,this.notifyChange("updating"))}_cancelPendingRequest(){const t=this._pendingElevationQueryController;t&&(this._pendingElevationQueryController=null,t.abort(),this.notifyChange("updating"))}get running(){return!this._pendingElevationQueryController&&this._dirty}runTask(){if(this._cancelPendingRequest(),this._dirty=!1,this.notifyChange("updating"),!this.map?.ground)return this._updateSurfaceAltitude(0),_;const t=this.state.spatialReference;this._tmpPoint.spatialReference=t,this.renderCoordsHelper.fromRenderCoords(this._camera.eye,this._tmpPoint);const e=(this._tmpPoint.z??0)>C&&this.renderCoordsHelper.viewingMode===p.Global&&(t.isWGS84||t.isWebMercator);let o=new AbortController;return this.map.ground.queryElevation(this._tmpPoint,{signal:o.signal,cache:this.cache,minDemResolution:e?v:0}).then((t=>this._updateSurfaceAltitude(t.geometry.z??0))).catch((t=>{r(t)||this._updateSurfaceAltitude(0)})).catch((()=>{})).then((()=>{this._pendingElevationQueryController===o&&(this._pendingElevationQueryController=null,this.notifyChange("updating")),o=null})),this._pendingElevationQueryController=o,_}_updateSurfaceAltitude(t){this._estimatedSurfaceAltitude!==t&&(this._estimatedSurfaceAltitude=t,this._updateRenderLocation())}_updateRenderLocation(){this.renderCoordsHelper.setAltitude(f,this._estimatedSurfaceAltitude,this._camera.eye),a(this._get("renderLocation"),f)||(this._set("renderLocation",l(this._propertiesPool.get("renderLocation"),f)),this.notifyChange("renderLocation"))}};t([i({constructOnly:!0})],y.prototype,"scheduler",void 0),t([i({constructOnly:!0})],y.prototype,"cache",void 0),t([i({constructOnly:!0})],y.prototype,"task",void 0),t([i()],y.prototype,"location",null),t([i({constructOnly:!0})],y.prototype,"map",void 0),t([i()],y.prototype,"renderLocation",void 0),t([i()],y.prototype,"scale",null),t([i()],y.prototype,"updating",null),y=t([s("esri.views.3d.support.CameraOnSurface")],y);const f=c(),C=1e5,v=1e6;export{y as CameraOnSurface};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import{destroyMaybe as e}from"../../../../core/maybe.js";import{isAbortError as r}from"../../../../core/promiseUtils.js";import{on as o}from"../../../../core/reactiveUtils.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{q as n,j as a,c as l}from"../../../../chunks/vec32.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import d from"../../../../geometry/Point.js";import{ViewingMode as p}from"../../../ViewingMode.js";import{distanceToScale as h}from"../cameraUtils.js";import{PropertiesPool as u}from"../PropertiesPool.js";import{PointOfInterest as m}from"./PointOfInterest.js";import{Yield as _}from"../../../support/Yield.js";const g=Array;let y=class extends m{constructor(t){super(t),this._dirty=!1,this._propertiesPool=new u({location:d,renderLocation:g},this),this._estimatedSurfaceAltitude=0,this._pendingElevationQueryController=null,this.renderLocation=c(),this._tmpPoint=new d}initialize(){if(this.scheduler&&this.addHandles(this.scheduler.registerTask(this.task,this)),this.runTask(),this.map){const t=()=>this._setDirty();this.addHandles(o((()=>this.map?.ground?.layers),"change",t,{onListenerAdd:t,onListenerRemove:t}))}this._updateRenderLocation()}destroy(){this._cancelPendingRequest(),this._propertiesPool=e(this._propertiesPool)}get _camera(){return this.state.contentCamera}get location(){const t=this._propertiesPool.get("location");return t.spatialReference=this.state.spatialReference,this.renderCoordsHelper.fromRenderCoords(this.renderLocation,t),t}get scale(){const t=this._camera,e=n(t.eye,this.renderLocation),r={renderCoordsHelper:this.renderCoordsHelper,state:{camera:t}};return h(r,e,0)}get updating(){return this._dirty||null!=this._pendingElevationQueryController}updateRenderLocation(){this._setDirty(),this._updateRenderLocation()}_setDirty(){this._dirty||(this._dirty=!0,this.notifyChange("updating"))}_cancelPendingRequest(){const t=this._pendingElevationQueryController;t&&(this._pendingElevationQueryController=null,t.abort(),this.notifyChange("updating"))}get running(){return!this._pendingElevationQueryController&&this._dirty}runTask(){if(this._cancelPendingRequest(),this._dirty=!1,this.notifyChange("updating"),!this.map?.ground)return this._updateSurfaceAltitude(0),_;const t=this.state.spatialReference;this._tmpPoint.spatialReference=t,this.renderCoordsHelper.fromRenderCoords(this._camera.eye,this._tmpPoint);const e=(this._tmpPoint.z??0)>C&&this.renderCoordsHelper.viewingMode===p.Global&&(t.isWGS84||t.isWebMercator);let o=new AbortController;return this.map.ground.queryElevation(this._tmpPoint,{signal:o.signal,cache:this.cache,minDemResolution:e?v:0}).then((t=>this._updateSurfaceAltitude(t.geometry.z??0))).catch((t=>{r(t)||this._updateSurfaceAltitude(0)})).catch((()=>{})).then((()=>{this._pendingElevationQueryController===o&&(this._pendingElevationQueryController=null,this.notifyChange("updating")),o=null})),this._pendingElevationQueryController=o,_}_updateSurfaceAltitude(t){this._estimatedSurfaceAltitude!==t&&(this._estimatedSurfaceAltitude=t,this._updateRenderLocation())}_updateRenderLocation(){this.renderCoordsHelper.setAltitude(f,this._estimatedSurfaceAltitude,this._camera.eye),a(this._get("renderLocation"),f)||(this._set("renderLocation",l(this._propertiesPool.get("renderLocation"),f)),this.notifyChange("renderLocation"))}};t([i({constructOnly:!0})],y.prototype,"scheduler",void 0),t([i({constructOnly:!0})],y.prototype,"cache",void 0),t([i({constructOnly:!0})],y.prototype,"task",void 0),t([i()],y.prototype,"location",null),t([i({constructOnly:!0})],y.prototype,"map",void 0),t([i()],y.prototype,"renderLocation",void 0),t([i()],y.prototype,"scale",null),t([i()],y.prototype,"updating",null),y=t([s("esri.views.3d.support.CameraOnSurface")],y);const f=c(),C=1e5,v=1e6;export{y as CameraOnSurface};
@@ -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{clamp as e}from"../../../../core/mathUtils.js";import{removeMaybe as r,destroyMaybe as s}from"../../../../core/maybe.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as a,p as n,h as c,g as u,i as l,o as d}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 f from"../../../../geometry/Point.js";import{projectBoundingRect as m}from"../../../../geometry/projection/projectBoundingRect.js";import{create as _}from"../../../../geometry/support/aaBoundingRect.js";import{debugFlags as S}from"../debugFlags.js";import{PropertiesPool as g}from"../PropertiesPool.js";import{PointOfInterest as y}from"./PointOfInterest.js";import{Yield as A}from"../../../support/Yield.js";const j=Array;let L=class extends y{constructor(t){super(t),this._propertiesPool=new g({location:f,renderLocation:j},this),this._currentSurfaceAltitude=0,this._latestSurfaceAltitude=0,this.distance=0,this.renderLocation=p(),this.updating=!1}initialize(){this._frameWorker=this.scheduler.registerTask(this.task,this),this.runTask()}destroy(){this._frameWorker=r(this._frameWorker),this._propertiesPool=s(this._propertiesPool)}get _camera(){return this.state.contentCamera}get location(){const t=this._propertiesPool.get("location");return t.spatialReference=this.state.spatialReference,this.renderCoordsHelper.fromRenderCoords(this.renderLocation,t),t}updateRenderLocation(){this.updating=!0,this._updateRenderLocation()}get estimatedSurfaceAltitude(){return this._latestSurfaceAltitude}get running(){return this.updating}runTask(){return this._latestSurfaceAltitude=this.estimateSurfaceAltitudeAtCenter(),this._updateRenderLocation(),this.updating=!1,A}_updateRenderLocation(){const t=C;let e=this._calculateSurfaceIntersection(this._currentSurfaceAltitude,t);const r=this._currentSurfaceAltitude!==this._latestSurfaceAltitude;!e&&r&&(e=this._calculateSurfaceIntersection(this._latestSurfaceAltitude,t),e&&(this._currentSurfaceAltitude=this._latestSurfaceAltitude));const s=v;e&&this._latestSurfaceAltitudeChangesDistanceSignificantly(t,s)&&(a(t,s),this._currentSurfaceAltitude=this._latestSurfaceAltitude),e?this.distance=n(this._camera.eye,t):(c(t,this._camera.viewForward,this._get("distance")),u(t,t,this._camera.eye)),l(this._get("renderLocation"),t)||this._set("renderLocation",a(this._propertiesPool.get("renderLocation"),t))}_calculateSurfaceIntersection(t,r){const s=this._camera;if(!this.renderCoordsHelper.intersectInfiniteManifold(s.ray,t,r))return!1;if(this.state.isGlobal){const e=h(this.renderCoordsHelper.spatialReference).radius,i=e+t,o=d(s.eye),a=o<i*i,l=n(s.eye,r);if(a&&l>e/4){const t=i-Math.sqrt(o);return c(r,s.viewForward,t),u(r,r,s.eye),!0}}else{const t=this.surface?.ready?this.surface.extent:null;null!=t&&m(t,this.surface?.spatialReference,k,this.renderCoordsHelper.spatialReference)&&(r[0]=e(r[0],k[0],k[2]),r[1]=e(r[1],k[1],k[3]))}return!0}_latestSurfaceAltitudeChangesDistanceSignificantly(t,e){if(this._latestSurfaceAltitude===this._currentSurfaceAltitude||null==t)return!1;if(this._calculateSurfaceIntersection(this._latestSurfaceAltitude,e)){if(S.TESTS_DISABLE_OPTIMIZATIONS)return!0;const r=this._camera.eye,s=n(r,t),i=n(r,e);if(Math.abs(i-s)/s>R)return!0}return!1}};t([i({constructOnly:!0})],L.prototype,"scheduler",void 0),t([i({constructOnly:!0})],L.prototype,"task",void 0),t([i()],L.prototype,"distance",void 0),t([i({constructOnly:!0})],L.prototype,"estimateSurfaceAltitudeAtCenter",void 0),t([i({readOnly:!0})],L.prototype,"location",null),t([i({readOnly:!0})],L.prototype,"renderLocation",void 0),t([i()],L.prototype,"updating",void 0),L=t([o("esri.views.3d.support.CenterOnSurface")],L);const R=.05,C=p(),v=p(),k=_();export{L as CenterOnSurface};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import{clamp as e}from"../../../../core/mathUtils.js";import{removeMaybe as r,destroyMaybe as s}from"../../../../core/maybe.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as a,q as n,h as c,g as u,j as l,p as d}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 f from"../../../../geometry/Point.js";import{projectBoundingRect as m}from"../../../../geometry/projection/projectBoundingRect.js";import{create as _}from"../../../../geometry/support/aaBoundingRect.js";import{debugFlags as S}from"../debugFlags.js";import{PropertiesPool as g}from"../PropertiesPool.js";import{PointOfInterest as y}from"./PointOfInterest.js";import{Yield as A}from"../../../support/Yield.js";const j=Array;let L=class extends y{constructor(t){super(t),this._propertiesPool=new g({location:f,renderLocation:j},this),this._currentSurfaceAltitude=0,this._latestSurfaceAltitude=0,this.distance=0,this.renderLocation=p(),this.updating=!1}initialize(){this._frameWorker=this.scheduler.registerTask(this.task,this),this.runTask()}destroy(){this._frameWorker=r(this._frameWorker),this._propertiesPool=s(this._propertiesPool)}get _camera(){return this.state.contentCamera}get location(){const t=this._propertiesPool.get("location");return t.spatialReference=this.state.spatialReference,this.renderCoordsHelper.fromRenderCoords(this.renderLocation,t),t}updateRenderLocation(){this.updating=!0,this._updateRenderLocation()}get estimatedSurfaceAltitude(){return this._latestSurfaceAltitude}get running(){return this.updating}runTask(){return this._latestSurfaceAltitude=this.estimateSurfaceAltitudeAtCenter(),this._updateRenderLocation(),this.updating=!1,A}_updateRenderLocation(){const t=C;let e=this._calculateSurfaceIntersection(this._currentSurfaceAltitude,t);const r=this._currentSurfaceAltitude!==this._latestSurfaceAltitude;!e&&r&&(e=this._calculateSurfaceIntersection(this._latestSurfaceAltitude,t),e&&(this._currentSurfaceAltitude=this._latestSurfaceAltitude));const s=v;e&&this._latestSurfaceAltitudeChangesDistanceSignificantly(t,s)&&(a(t,s),this._currentSurfaceAltitude=this._latestSurfaceAltitude),e?this.distance=n(this._camera.eye,t):(c(t,this._camera.viewForward,this._get("distance")),u(t,t,this._camera.eye)),l(this._get("renderLocation"),t)||this._set("renderLocation",a(this._propertiesPool.get("renderLocation"),t))}_calculateSurfaceIntersection(t,r){const s=this._camera;if(!this.renderCoordsHelper.intersectInfiniteManifold(s.ray,t,r))return!1;if(this.state.isGlobal){const e=h(this.renderCoordsHelper.spatialReference).radius,i=e+t,o=d(s.eye),a=o<i*i,l=n(s.eye,r);if(a&&l>e/4){const t=i-Math.sqrt(o);return c(r,s.viewForward,t),u(r,r,s.eye),!0}}else{const t=this.surface?.ready?this.surface.extent:null;null!=t&&m(t,this.surface?.spatialReference,k,this.renderCoordsHelper.spatialReference)&&(r[0]=e(r[0],k[0],k[2]),r[1]=e(r[1],k[1],k[3]))}return!0}_latestSurfaceAltitudeChangesDistanceSignificantly(t,e){if(this._latestSurfaceAltitude===this._currentSurfaceAltitude||null==t)return!1;if(this._calculateSurfaceIntersection(this._latestSurfaceAltitude,e)){if(S.TESTS_DISABLE_OPTIMIZATIONS)return!0;const r=this._camera.eye,s=n(r,t),i=n(r,e);if(Math.abs(i-s)/s>R)return!0}return!1}};t([i({constructOnly:!0})],L.prototype,"scheduler",void 0),t([i({constructOnly:!0})],L.prototype,"task",void 0),t([i()],L.prototype,"distance",void 0),t([i({constructOnly:!0})],L.prototype,"estimateSurfaceAltitudeAtCenter",void 0),t([i({readOnly:!0})],L.prototype,"location",null),t([i({readOnly:!0})],L.prototype,"renderLocation",void 0),t([i()],L.prototype,"updating",void 0),L=t([o("esri.views.3d.support.CenterOnSurface")],L);const R=.05,C=p(),v=p(),k=_();export{L as CenterOnSurface};
@@ -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{clamp as t}from"../../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{watch as o}from"../../../../core/reactiveUtils.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{j as a,F as c,c as p,k as d,f as l,n as u}from"../../../../chunks/vec32.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import m from"../../../../geometry/Point.js";import{wrap as f}from"../../../../geometry/support/ray.js";import{PropertiesPool as g}from"../PropertiesPool.js";import{PointOfInterest as y}from"./PointOfInterest.js";import{PaddingSide as P}from"../../webgl-engine/lib/Camera.js";import{TaskPriority as _}from"../../../support/Scheduler.js";import{Yield as j}from"../../../support/Yield.js";const L=Array;let O=class extends y{constructor(e){super(e),this._propertiesPool=new g({location:m,renderLocation:L},this),this._dirty=!0,this.renderLocation=this._propertiesPool.get("renderLocation")}initialize(){this.addHandles([o((()=>this.centerOnSurface.renderLocation),(()=>this.updateRenderLocation())),o((()=>this.state.contentCamera),(()=>this.updateRenderLocation()))]),this.scheduler&&this.addHandles(this.scheduler.registerTask(_.POINT_OF_INTEREST_FREQUENT,this))}destroy(){this._propertiesPool=r(this._propertiesPool)}get updating(){return this._dirty||this.centerOnSurface.updating}get location(){const e=this._propertiesPool.get("location");return e.spatialReference=this.state.spatialReference,this.renderCoordsHelper.fromRenderCoords(this.renderLocation,e),e}get worldUnitsPerContentPixel(){const{camera:e,contentPixelRatio:t}=this.state;return e.computeRenderPixelSizeAt(this.renderLocation)*(e.pixelRatio/t)}get running(){return this._dirty}runTask(){const e=this._get("renderLocation"),r=this.centerOnSurface.renderLocation,o=this.renderCoordsHelper,i=this.state.contentCamera;this._dirty=!1,o.worldUpAtPosition(r,S);const s=Math.max(0,(Math.acos(a(S,i.viewForward))-.5*Math.PI)*(i.aboveGround?1:-1));if(Number.isNaN(s)){if(!e||!c(e,r)){const e=this._propertiesPool.get("renderLocation");p(e,r),this._set("renderLocation",e)}return j}const n=1-t(s/(.5*Math.PI),0,1),l=n*n*n;this._calculateScreenHorizontalEdgeOnSurface(C);const u=this._propertiesPool.get("renderLocation");return d(u,r,C,l),e&&c(e,u)||this._set("renderLocation",u),j}_calculateScreenHorizontalEdgeOnSurface(e){const t=this.state.contentCamera,r=t.getRenderCenter(i());if(r[1]=t.aboveGround?t.padding[P.BOTTOM]:t.fullHeight-t.padding[P.TOP],this.estimateSurfaceIntersectionAtRenderPoint(r,e))return e;const o=this.renderCoordsHelper.getAltitude(this.centerOnSurface.renderLocation);if(t.unprojectFromRenderScreen(r,R)){l(R,R,t.eye);const r=u(R,R);if(this.renderCoordsHelper.intersectInfiniteManifold(f(t.eye,r),o,e))return e}return this.renderCoordsHelper.setAltitude(e,o,t.eye)}updateRenderLocation(){this._dirty=!0}};e([s()],O.prototype,"_dirty",void 0),e([s({constructOnly:!0})],O.prototype,"scheduler",void 0),e([s({constructOnly:!0})],O.prototype,"centerOnSurface",void 0),e([s({constructOnly:!0})],O.prototype,"estimateSurfaceIntersectionAtRenderPoint",void 0),e([s()],O.prototype,"updating",null),e([s()],O.prototype,"location",null),e([s()],O.prototype,"renderLocation",void 0),e([s()],O.prototype,"worldUnitsPerContentPixel",null),O=e([n("esri.views.3d.support.pointsOfInterest.Focus")],O);const S=h(),R=h(),C=h();export{O as Focus};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import{clamp as t}from"../../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{watch as o}from"../../../../core/reactiveUtils.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{k as a,G as c,c as p,m as d,f as l,n as u}from"../../../../chunks/vec32.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import m from"../../../../geometry/Point.js";import{wrap as f}from"../../../../geometry/support/ray.js";import{PropertiesPool as g}from"../PropertiesPool.js";import{PointOfInterest as y}from"./PointOfInterest.js";import{PaddingSide as P}from"../../webgl-engine/lib/Camera.js";import{TaskPriority as _}from"../../../support/Scheduler.js";import{Yield as j}from"../../../support/Yield.js";const L=Array;let O=class extends y{constructor(e){super(e),this._propertiesPool=new g({location:m,renderLocation:L},this),this._dirty=!0,this.renderLocation=this._propertiesPool.get("renderLocation")}initialize(){this.addHandles([o((()=>this.centerOnSurface.renderLocation),(()=>this.updateRenderLocation())),o((()=>this.state.contentCamera),(()=>this.updateRenderLocation()))]),this.scheduler&&this.addHandles(this.scheduler.registerTask(_.POINT_OF_INTEREST_FREQUENT,this))}destroy(){this._propertiesPool=r(this._propertiesPool)}get updating(){return this._dirty||this.centerOnSurface.updating}get location(){const e=this._propertiesPool.get("location");return e.spatialReference=this.state.spatialReference,this.renderCoordsHelper.fromRenderCoords(this.renderLocation,e),e}get worldUnitsPerContentPixel(){const{camera:e,contentPixelRatio:t}=this.state;return e.computeRenderPixelSizeAt(this.renderLocation)*(e.pixelRatio/t)}get running(){return this._dirty}runTask(){const e=this._get("renderLocation"),r=this.centerOnSurface.renderLocation,o=this.renderCoordsHelper,i=this.state.contentCamera;this._dirty=!1,o.worldUpAtPosition(r,S);const s=Math.max(0,(Math.acos(a(S,i.viewForward))-.5*Math.PI)*(i.aboveGround?1:-1));if(Number.isNaN(s)){if(!e||!c(e,r)){const e=this._propertiesPool.get("renderLocation");p(e,r),this._set("renderLocation",e)}return j}const n=1-t(s/(.5*Math.PI),0,1),l=n*n*n;this._calculateScreenHorizontalEdgeOnSurface(C);const u=this._propertiesPool.get("renderLocation");return d(u,r,C,l),e&&c(e,u)||this._set("renderLocation",u),j}_calculateScreenHorizontalEdgeOnSurface(e){const t=this.state.contentCamera,r=t.getRenderCenter(i());if(r[1]=t.aboveGround?t.padding[P.BOTTOM]:t.fullHeight-t.padding[P.TOP],this.estimateSurfaceIntersectionAtRenderPoint(r,e))return e;const o=this.renderCoordsHelper.getAltitude(this.centerOnSurface.renderLocation);if(t.unprojectFromRenderScreen(r,R)){l(R,R,t.eye);const r=u(R,R);if(this.renderCoordsHelper.intersectInfiniteManifold(f(t.eye,r),o,e))return e}return this.renderCoordsHelper.setAltitude(e,o,t.eye)}updateRenderLocation(){this._dirty=!0}};e([s()],O.prototype,"_dirty",void 0),e([s({constructOnly:!0})],O.prototype,"scheduler",void 0),e([s({constructOnly:!0})],O.prototype,"centerOnSurface",void 0),e([s({constructOnly:!0})],O.prototype,"estimateSurfaceIntersectionAtRenderPoint",void 0),e([s()],O.prototype,"updating",null),e([s()],O.prototype,"location",null),e([s()],O.prototype,"renderLocation",void 0),e([s()],O.prototype,"worldUnitsPerContentPixel",null),O=e([n("esri.views.3d.support.pointsOfInterest.Focus")],O);const S=h(),R=h(),C=h();export{O as Focus};
@@ -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/Accessor.js";import{watch as r,sync as s,when as n,on as i,initial 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 c}from"../../../../core/accessorSupport/decorators/subclass.js";import{g as u,i as h,c as d}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as p}from"../../../../geometry/support/ray.js";import{debugFlags as _}from"../debugFlags.js";import{PointGraphics as m}from"../debugUtils.js";import{PropertiesPool as l}from"../PropertiesPool.js";import{fromRenderAtEye as C}from"../geometryUtils/ray.js";import{CameraOnSurface as y}from"./CameraOnSurface.js";import{CenterOnSurface as A}from"./CenterOnSurface.js";import{ContentGeometryUpdates as O}from"./ContentGeometryUpdates.js";import{Focus as g}from"./Focus.js";import{StableSurfaceCenter as w}from"./StableSurfaceCenter.js";import{SurfaceGeometryUpdates as I}from"./SurfaceGeometryUpdates.js";import{newIntersector as S}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as v}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{terrainId as b}from"../../webgl-engine/lib/verticalOffsetUtils.js";import{TaskPriority as R}from"../../../support/Scheduler.js";let P=class extends t{constructor(e){super(e),this.renderPointOfView=f(),this._pois=new Array,this._debugCenters=new Map,this._tmpRay=p(),this._centerRayDirty=!0,this._surfaceAltitudeAtCenter=0,this._surfaceAltitudeAtCenterDirty=!0,this._contentAltitudeAtCenter=0,this._contentAltitudeAtCenterDirty=!0,this._propertiesPool=new l({renderPointOfView:T},this)}initialize(){const{state:e,basemapTerrain:t,renderCoordsHelper:a,map:c}=this.view;this._surfaceIntersector=S(e.viewingMode),e.isGlobal?this._surfaceIntersector.options.backfacesTerrain=!1:this._surfaceIntersector.options.backfacesTerrain=!0,this._surfaceIntersector.options.invisibleTerrain=!1,this._surfaceIntersector.options.store=v.MIN,this._contentIntersector=S(e.viewingMode);const u=()=>this._estimateSurfaceAltitudeAtCenter(),h=this.view.resourceController.scheduler,d=this.view.basemapTerrain?.elevationQueryCache,f={state:e,scheduler:h,surface:t,renderCoordsHelper:a};this._set("centerOnSurfaceInfrequent",new A({...f,task:R.POINT_OF_INTEREST_INFREQUENT,estimateSurfaceAltitudeAtCenter:u})),this._set("centerOnSurfaceFrequent",new A({...f,task:R.POINT_OF_INTEREST_FREQUENT,estimateSurfaceAltitudeAtCenter:u})),this._set("centerOnContent",new A({...f,task:R.POINT_OF_INTEREST_FREQUENT,estimateSurfaceAltitudeAtCenter:()=>this._estimateContentAltitudeAtCenter()})),this._set("cameraOnSurface",new y({...f,cache:d,task:R.POINT_OF_INTEREST_INFREQUENT,map:c})),this._set("surfaceGeometryUpdates",new I({...f,centerOnSurfaces:[this.centerOnSurfaceFrequent,this.centerOnContent,this.centerOnSurfaceInfrequent]})),this._set("contentGeometryUpdates",new O({contentLayerViews:this.view.allLayerViews,renderCoordsHelper:a})),this._set("surfaceOrigin",new w({cache:d,view:this.view})),this._set("focus",new g({state:e,scheduler:h,surface:t,renderCoordsHelper:a,centerOnSurface:this.centerOnSurfaceFrequent,estimateSurfaceIntersectionAtRenderPoint:(e,t)=>this._estimateSurfaceIntersectionAtRenderPoint(e,this.view.state.contentCamera,t)})),this._pois.push(this.centerOnContent,this.centerOnSurfaceFrequent,this.centerOnSurfaceInfrequent,this.cameraOnSurface,this.focus);const p=this.view.graphics;this._debugCenters.set(this.centerOnContent,new m(p,"red","CenterOnContent")),this._debugCenters.set(this.centerOnSurfaceFrequent,new m(p,"red","CenterOnSurface")),this._debugCenters.set(this.centerOnSurfaceInfrequent,new m(p,"red","CenterOnSurface")),this._debugCenters.set(this.cameraOnSurface,new m(p,"blue","CameraOnSurface")),this._debugCenters.set(this.focus,new m(p,"green","Focus")),this.addHandles([r((()=>e.contentCamera),(e=>this._cameraChanged(e)),s),r((()=>t.extent),(()=>this._updateCenterPointsOfInterest())),n((()=>!t.updating),(()=>this._updateCenterPointsOfInterest()),s),i((()=>this.surfaceGeometryUpdates.events),"request-update",(()=>this._updateCenterPointsOfInterest())),i((()=>this.contentGeometryUpdates.events),"request-update",(()=>this._updateCenterOnContent())),n((()=>_.SHOW_POI),(e=>this._setDebug(e)),o)]),this._cameraChanged(this.view.state.contentCamera);for(const r of this._pois)r.runTask()}destroy(){this._setDebug(!1),this._propertiesPool.destroy();for(const e of this._pois)e.destroy();this.surfaceOrigin.destroy()}get updating(){return!(!this.surfaceGeometryUpdates?.updating&&!this._pois.some((e=>e.updating)))}get _centerRay(){return this._centerRayDirty&&(this._centerRayCached=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(this.view.state.contentCamera,this._tmpRay),this._centerRayDirty=!1),this._centerRayCached}_estimateContentAltitudeAtCenter(){if(!this._contentAltitudeAtCenterDirty)return this._contentAltitudeAtCenter;this._contentAltitudeAtCenterDirty=!1;const e=this._centerRay;return null==e||(this.view.sceneIntersectionHelper.intersectRay(e,this._contentIntersector,j,E)?this._contentAltitudeAtCenter=this.view.renderCoordsHelper.getAltitude(j):this._contentAltitudeAtCenter=this._estimateSurfaceAltitudeAtCenter()),this._contentAltitudeAtCenter}_estimateSurfaceAltitudeAtCenter(){if(!this.view.basemapTerrain)return 0;if(!this._surfaceAltitudeAtCenterDirty)return this._surfaceAltitudeAtCenter;this._surfaceAltitudeAtCenterDirty=!1;const e=this._centerRay;if(null==e)return this._surfaceAltitudeAtCenter;const t=e.origin,r=u(j,e.origin,e.direction);return this._surfaceIntersector.resetWithRay(e,this.view.state.contentCamera),this.view.basemapTerrain.intersect(this._surfaceIntersector,null,t,r),this._surfaceIntersector.results.min.getIntersectionPoint(j)&&(this._surfaceAltitudeAtCenter=this.view.renderCoordsHelper.getAltitude(j)),this._surfaceAltitudeAtCenter}_estimateSurfaceIntersectionAtRenderPoint(e,t,r){const s=C(t,e,U);if(null==s)return null;const n=s.origin,i=u(j,s.origin,s.direction);return this._surfaceIntersector.resetWithRay(s,t),this.view.basemapTerrain.intersect(this._surfaceIntersector,null,n,i),this._surfaceIntersector.results.min.getIntersectionPoint(r)?r:null}_cameraChanged(e){this._updateCenterPointsOfInterest();const t=e.eye;h(this.renderPointOfView,t)||this._set("renderPointOfView",d(this._propertiesPool.get("renderPointOfView"),t))}_updateCenterPointsOfInterest(){this._centerRayDirty=!0,this._surfaceAltitudeAtCenterDirty=!0,this._contentAltitudeAtCenterDirty=!0;for(const e of this._pois)e.updateRenderLocation()}_updateCenterOnContent(){this._contentAltitudeAtCenterDirty=!0,this.centerOnContent.updateRenderLocation()}_setDebug(e){if(!e)return this._debugCenters.forEach((e=>e.hide())),void this.removeHandles("debug");for(const t of this._pois)this.addHandles(r((()=>t.renderLocation),(e=>this._debugCenters.get(t)?.show(e,t.renderCoordsHelper.spatialReference)),o),"debug")}get test(){return{update:()=>{this.surfaceGeometryUpdates.runTask();for(const e of this._pois)e.runTask()},surfaceGeometryUpdates:this.surfaceGeometryUpdates}}};e([a()],P.prototype,"centerOnContent",void 0),e([a()],P.prototype,"centerOnSurfaceFrequent",void 0),e([a()],P.prototype,"centerOnSurfaceInfrequent",void 0),e([a()],P.prototype,"cameraOnSurface",void 0),e([a()],P.prototype,"focus",void 0),e([a()],P.prototype,"renderPointOfView",void 0),e([a()],P.prototype,"surfaceOrigin",void 0),e([a()],P.prototype,"contentGeometryUpdates",void 0),e([a()],P.prototype,"surfaceGeometryUpdates",void 0),e([a({constructOnly:!0})],P.prototype,"view",void 0),e([a()],P.prototype,"updating",null),P=e([c("esri.views.3d.support.PointsOfInterest")],P);const T=Array,j=f(),U=p(),E={exclude:new Set([b])};export{P as PointsOfInterest};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{watch as r,sync as s,when as n,on as i,initial 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 c}from"../../../../core/accessorSupport/decorators/subclass.js";import{g as u,j as h,c as d}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as p}from"../../../../geometry/support/ray.js";import{debugFlags as _}from"../debugFlags.js";import{PointGraphics as m}from"../debugUtils.js";import{PropertiesPool as l}from"../PropertiesPool.js";import{fromRenderAtEye as C}from"../geometryUtils/ray.js";import{CameraOnSurface as y}from"./CameraOnSurface.js";import{CenterOnSurface as A}from"./CenterOnSurface.js";import{ContentGeometryUpdates as O}from"./ContentGeometryUpdates.js";import{Focus as g}from"./Focus.js";import{StableSurfaceCenter as w}from"./StableSurfaceCenter.js";import{SurfaceGeometryUpdates as I}from"./SurfaceGeometryUpdates.js";import{newIntersector as S}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as v}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{terrainId as b}from"../../webgl-engine/lib/verticalOffsetUtils.js";import{TaskPriority as R}from"../../../support/Scheduler.js";let P=class extends t{constructor(e){super(e),this.renderPointOfView=f(),this._pois=new Array,this._debugCenters=new Map,this._tmpRay=p(),this._centerRayDirty=!0,this._surfaceAltitudeAtCenter=0,this._surfaceAltitudeAtCenterDirty=!0,this._contentAltitudeAtCenter=0,this._contentAltitudeAtCenterDirty=!0,this._propertiesPool=new l({renderPointOfView:T},this)}initialize(){const{state:e,basemapTerrain:t,renderCoordsHelper:a,map:c}=this.view;this._surfaceIntersector=S(e.viewingMode),e.isGlobal?this._surfaceIntersector.options.backfacesTerrain=!1:this._surfaceIntersector.options.backfacesTerrain=!0,this._surfaceIntersector.options.invisibleTerrain=!1,this._surfaceIntersector.options.store=v.MIN,this._contentIntersector=S(e.viewingMode);const u=()=>this._estimateSurfaceAltitudeAtCenter(),h=this.view.resourceController.scheduler,d=this.view.basemapTerrain?.elevationQueryCache,f={state:e,scheduler:h,surface:t,renderCoordsHelper:a};this._set("centerOnSurfaceInfrequent",new A({...f,task:R.POINT_OF_INTEREST_INFREQUENT,estimateSurfaceAltitudeAtCenter:u})),this._set("centerOnSurfaceFrequent",new A({...f,task:R.POINT_OF_INTEREST_FREQUENT,estimateSurfaceAltitudeAtCenter:u})),this._set("centerOnContent",new A({...f,task:R.POINT_OF_INTEREST_FREQUENT,estimateSurfaceAltitudeAtCenter:()=>this._estimateContentAltitudeAtCenter()})),this._set("cameraOnSurface",new y({...f,cache:d,task:R.POINT_OF_INTEREST_INFREQUENT,map:c})),this._set("surfaceGeometryUpdates",new I({...f,centerOnSurfaces:[this.centerOnSurfaceFrequent,this.centerOnContent,this.centerOnSurfaceInfrequent]})),this._set("contentGeometryUpdates",new O({contentLayerViews:this.view.allLayerViews,renderCoordsHelper:a})),this._set("surfaceOrigin",new w({cache:d,view:this.view})),this._set("focus",new g({state:e,scheduler:h,surface:t,renderCoordsHelper:a,centerOnSurface:this.centerOnSurfaceFrequent,estimateSurfaceIntersectionAtRenderPoint:(e,t)=>this._estimateSurfaceIntersectionAtRenderPoint(e,this.view.state.contentCamera,t)})),this._pois.push(this.centerOnContent,this.centerOnSurfaceFrequent,this.centerOnSurfaceInfrequent,this.cameraOnSurface,this.focus);const p=this.view.graphics;this._debugCenters.set(this.centerOnContent,new m(p,"red","CenterOnContent")),this._debugCenters.set(this.centerOnSurfaceFrequent,new m(p,"red","CenterOnSurface")),this._debugCenters.set(this.centerOnSurfaceInfrequent,new m(p,"red","CenterOnSurface")),this._debugCenters.set(this.cameraOnSurface,new m(p,"blue","CameraOnSurface")),this._debugCenters.set(this.focus,new m(p,"green","Focus")),this.addHandles([r((()=>e.contentCamera),(e=>this._cameraChanged(e)),s),r((()=>t.extent),(()=>this._updateCenterPointsOfInterest())),n((()=>!t.updating),(()=>this._updateCenterPointsOfInterest()),s),i((()=>this.surfaceGeometryUpdates.events),"request-update",(()=>this._updateCenterPointsOfInterest())),i((()=>this.contentGeometryUpdates.events),"request-update",(()=>this._updateCenterOnContent())),n((()=>_.SHOW_POI),(e=>this._setDebug(e)),o)]),this._cameraChanged(this.view.state.contentCamera);for(const r of this._pois)r.runTask()}destroy(){this._setDebug(!1),this._propertiesPool.destroy();for(const e of this._pois)e.destroy();this.surfaceOrigin.destroy()}get updating(){return!(!this.surfaceGeometryUpdates?.updating&&!this._pois.some((e=>e.updating)))}get _centerRay(){return this._centerRayDirty&&(this._centerRayCached=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(this.view.state.contentCamera,this._tmpRay),this._centerRayDirty=!1),this._centerRayCached}_estimateContentAltitudeAtCenter(){if(!this._contentAltitudeAtCenterDirty)return this._contentAltitudeAtCenter;this._contentAltitudeAtCenterDirty=!1;const e=this._centerRay;return null==e||(this.view.sceneIntersectionHelper.intersectRay(e,this._contentIntersector,j,E)?this._contentAltitudeAtCenter=this.view.renderCoordsHelper.getAltitude(j):this._contentAltitudeAtCenter=this._estimateSurfaceAltitudeAtCenter()),this._contentAltitudeAtCenter}_estimateSurfaceAltitudeAtCenter(){if(!this.view.basemapTerrain)return 0;if(!this._surfaceAltitudeAtCenterDirty)return this._surfaceAltitudeAtCenter;this._surfaceAltitudeAtCenterDirty=!1;const e=this._centerRay;if(null==e)return this._surfaceAltitudeAtCenter;const t=e.origin,r=u(j,e.origin,e.direction);return this._surfaceIntersector.resetWithRay(e,this.view.state.contentCamera),this.view.basemapTerrain.intersect(this._surfaceIntersector,null,t,r),this._surfaceIntersector.results.min.getIntersectionPoint(j)&&(this._surfaceAltitudeAtCenter=this.view.renderCoordsHelper.getAltitude(j)),this._surfaceAltitudeAtCenter}_estimateSurfaceIntersectionAtRenderPoint(e,t,r){const s=C(t,e,U);if(null==s)return null;const n=s.origin,i=u(j,s.origin,s.direction);return this._surfaceIntersector.resetWithRay(s,t),this.view.basemapTerrain.intersect(this._surfaceIntersector,null,n,i),this._surfaceIntersector.results.min.getIntersectionPoint(r)?r:null}_cameraChanged(e){this._updateCenterPointsOfInterest();const t=e.eye;h(this.renderPointOfView,t)||this._set("renderPointOfView",d(this._propertiesPool.get("renderPointOfView"),t))}_updateCenterPointsOfInterest(){this._centerRayDirty=!0,this._surfaceAltitudeAtCenterDirty=!0,this._contentAltitudeAtCenterDirty=!0;for(const e of this._pois)e.updateRenderLocation()}_updateCenterOnContent(){this._contentAltitudeAtCenterDirty=!0,this.centerOnContent.updateRenderLocation()}_setDebug(e){if(!e)return this._debugCenters.forEach((e=>e.hide())),void this.removeHandles("debug");for(const t of this._pois)this.addHandles(r((()=>t.renderLocation),(e=>this._debugCenters.get(t)?.show(e,t.renderCoordsHelper.spatialReference)),o),"debug")}get test(){return{update:()=>{this.surfaceGeometryUpdates.runTask();for(const e of this._pois)e.runTask()},surfaceGeometryUpdates:this.surfaceGeometryUpdates}}};e([a()],P.prototype,"centerOnContent",void 0),e([a()],P.prototype,"centerOnSurfaceFrequent",void 0),e([a()],P.prototype,"centerOnSurfaceInfrequent",void 0),e([a()],P.prototype,"cameraOnSurface",void 0),e([a()],P.prototype,"focus",void 0),e([a()],P.prototype,"renderPointOfView",void 0),e([a()],P.prototype,"surfaceOrigin",void 0),e([a()],P.prototype,"contentGeometryUpdates",void 0),e([a()],P.prototype,"surfaceGeometryUpdates",void 0),e([a({constructOnly:!0})],P.prototype,"view",void 0),e([a()],P.prototype,"updating",null),P=e([c("esri.views.3d.support.PointsOfInterest")],P);const T=Array,j=f(),U=p(),E={exclude:new Set([b])};export{P as PointsOfInterest};
@@ -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,clamp as e}from"../../../core/mathUtils.js";import{fromRotation as i,identity as o,rotateX as n,rotateY as a,rotateZ as l}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as c,lerp as s}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as u,create as m}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{s as g,k as f,n as d,h,e as b,g as y,c as p}from"../../../chunks/vec32.js";import{fromValues as A,create as w,clone as x}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as N}from"../../ViewingMode.js";import{S as v}from"../../../chunks/SunCalc.js";import{angle as T}from"./mathUtils.js";const M={local:{altitude:1500,ambientAtNight:.1,ambientAtNoon:.45,ambientAtTwilight:.2,directAtNoon:.65,directAtTwilight:.7},global:{altitude:8e5,ambient:.015,direct:.75},planarDirection:{localAltitude:1e4,globalAltitude:1e6,globalAngles:{azimuth:1.3*Math.PI,altitude:.6*Math.PI}}};class S{constructor(t,e){this.direct=t,this.ambient=e}}function j(i,o,n,a,l,r){g(r.ambient.color,1,1,1),r.ambient.intensity=M.global.ambient,g(r.direct.color,1,1,1),r.direct.intensity=M.global.direct;const c=o[2],s=e((Math.abs(c)-M.local.altitude)/(M.global.altitude-M.local.altitude),0,1);let u;if(r.globalFactor=s,null!=i&&(u=v.getTimes(i,o[1],o[0])),s<1){let e;if(null!=i)e=ot(i,u,a);else{const t=L(a);e={direct:{intensity:M.local.directAtNoon*t.direct,color:A(1,1,1)},ambient:{intensity:M.local.ambientAtNoon*t.ambient,color:A(1,1,1)},timeOfDay:"early afternoon"}}f(r.ambient.color,e.ambient.color,r.ambient.color,s),r.ambient.intensity=t(e.ambient.intensity,r.ambient.intensity,s),f(r.direct.color,e.direct.color,r.direct.color,s),r.direct.intensity=t(e.direct.intensity,r.direct.intensity,s),r.specularStrength="rainy"===a||"snowy"===a||"foggy"===a?0:1,r.environmentStrength="rainy"===a?.7:"snowy"===a||"foggy"===a?.75:1}r.noonFactor=null!=i?F(i,u):1,null!=i?P(i,o,n,r.direct.directionToLightSource):O(l,n,r.direct.directionToLightSource)}function O(t,e,o){e===N.Global?d(lt,t.eye):g(lt,0,0,1),h(rt,t.viewForward,-1);const n=T(rt,lt),a=Math.max(n-2*st,0),l=.85*a/(a+1),r=Math.max(st,n-st-l);i(at,-r,t.viewRight),b(o,rt,at),y(o,o,h(ct,t.viewRight,ut)),d(o,o)}function P(t,i,r,c){const s=H,u=o(G);if(r===N.Global)v.getPosition(t,0,0,s),g(c,0,0,-1),n(u,u,-s.azimuth),a(u,u,-s.altitude),b(c,c,u);else{const o=M.planarDirection,a=o.globalAngles,r=i[2];let m=(Math.abs(r)-o.localAltitude)/(o.globalAltitude-o.localAltitude);m=e(m,0,1),m<1?(v.getPosition(t,i[1],i[0],s),s.azimuth=(1-m)*s.azimuth+m*a.azimuth,s.altitude=(1-m)*s.altitude+m*a.altitude):(s.azimuth=a.azimuth,s.altitude=a.altitude),g(c,0,-1,0),l(u,u,-s.azimuth),n(u,u,-s.altitude),b(c,c,u)}}function z(t,e){if(e===N.Global)return!0;const i=M.planarDirection;return Math.abs(t)<i.localAltitude}function D(t,e,i,o,n){const a=t.getTime(),l=e.getTime()-a,r=Math.floor(l/i)+1,c=new Array(r);for(let s=0;s<r;++s)nt.setTime(a+i*s),c[s]=w(),P(nt,o,n,c[s]);return c}const E=A(.5773502691896258,-.5773502691896258,.5773502691896258);class I{constructor(){this.ambient={color:A(1,1,1),intensity:.55},this.direct={color:A(1,1,1),intensity:.55,directionToLightSource:x(E)},this.noonFactor=.5,this.globalFactor=0,this.specularStrength=1,this.environmentStrength=1}}const G=r(),H={azimuth:0,altitude:0};function F(t,i){const o=t.valueOf();let n,a;i.polarException===v.PolarException.MIDNIGHT_SUN?(n=o-60*(t.getHours()+48)*60*1e3-60*t.getMinutes()*1e3,a=n+432e6):i.polarException===v.PolarException.POLAR_NIGHT?(n=o-2,a=o-1):(n=i.sunrise.valueOf(),a=i.sunset.valueOf());const l=n+(a-n)/2;return 1-e(Math.abs(o-l)/432e5,0,1)}function L(t){switch(t){case"disabled":case"sunny":case"cloudy":return new S(1,1);case"rainy":return new S(.4,1.2);case"snowy":return new S(.5,1.3);case"foggy":return new S(.2,1.6)}}function k(t,e){const i=(t[0]+t[1]+t[2])/3;t[0]+=(i-t[0])*e,t[1]+=(i-t[1])*e,t[2]+=(i-t[2])*e}const R=A(.01,.01,.01),U=A(1,.6,.5),_=A(1,.98,.98),V=A(1,1,1),C=A(.8,.8,1),q=A(.8,.8,1),B=A(.98,.98,1),J=A(1,1,1),K=u(.01,M.local.ambientAtNight),Q=u(M.local.directAtTwilight,M.local.ambientAtTwilight),W=u(.9*M.local.directAtNoon,M.local.ambientAtNoon),X=u(M.local.directAtNoon,M.local.ambientAtNoon),Y=W,Z=_,$=B,tt=Q,et=U,it=q;function ot(t,e,i){const o=t.valueOf();let n,a;e.polarException===v.PolarException.MIDNIGHT_SUN?(n=o-60*(t.getHours()+48)*60*1e3-60*t.getMinutes()*1e3,a=n+432e6):e.polarException===v.PolarException.POLAR_NIGHT?(n=o-2,a=o-1):(n=e.sunrise.valueOf(),a=e.sunset.valueOf());const l=a-n,r=n+l/2,u=l/4,g=r-u,d=r+u,h=.06*l,b=n-h/2,y=n+h/2,A=a-h/2,x=a+h/2,N=m(),T=w(),M=w();let S="";if(o<b||o>x)c(N,K),p(T,R),p(M,C),S="night";else if(o<y){const t=(o-b)/(y-b);s(N,K,Q,t),f(T,R,U,t),f(M,C,q,t),S="sun rising"}else if(o<g){const t=(o-y)/(g-y);s(N,Q,W,t),f(T,U,_,t),f(M,q,B,t),S="early morning"}else if(o<r){const t=(o-g)/(r-g);s(N,W,X,t),f(T,_,V,t),f(M,B,J,t),S="late morning"}else if(o<d){const t=(o-r)/(d-r);s(N,X,Y,t),f(T,V,Z,t),f(M,J,$,t),S="early afternoon"}else if(o<A){const t=(o-d)/(A-d);s(N,Y,tt,t),f(T,Z,et,t),f(M,$,it,t),S="late afternoon"}else if(o<x){const t=(o-A)/(x-A);s(N,tt,K,t),f(T,et,R,t),f(M,it,C,t),S="sun setting"}let j=0;switch(i){case"rainy":case"foggy":j=.8;break;case"snowy":j=.5}j>0&&(k(T,j),k(M,j));const O=L(i);return{direct:{intensity:N[0]*O.direct,color:T},ambient:{intensity:N[1]*O.ambient,color:M},timeOfDay:S}}const nt=new Date(0),at=r(),lt=w(),rt=w(),ct=w(),st=.25,ut=.2;export{I as ColorAndIntensity,j as computeColorAndIntensity,D as computeDirectionsOverTime,z as computeShadowsEnabled,O as computeVirtualLightDirection};
5
+ import{lerp as t,clamp as e}from"../../../core/mathUtils.js";import{fromRotation as i,identity as o,rotateX as n,rotateY as a,rotateZ as l}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as c,lerp as s}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as u,create as m}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{s as g,m as f,n as d,h,e as b,g as y,c as p}from"../../../chunks/vec32.js";import{fromValues as A,create as w,clone as x}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as N}from"../../ViewingMode.js";import{S as v}from"../../../chunks/SunCalc.js";import{angle as T}from"./mathUtils.js";const M={local:{altitude:1500,ambientAtNight:.1,ambientAtNoon:.45,ambientAtTwilight:.2,directAtNoon:.65,directAtTwilight:.7},global:{altitude:8e5,ambient:.015,direct:.75},planarDirection:{localAltitude:1e4,globalAltitude:1e6,globalAngles:{azimuth:1.3*Math.PI,altitude:.6*Math.PI}}};class S{constructor(t,e){this.direct=t,this.ambient=e}}function j(i,o,n,a,l,r){g(r.ambient.color,1,1,1),r.ambient.intensity=M.global.ambient,g(r.direct.color,1,1,1),r.direct.intensity=M.global.direct;const c=o[2],s=e((Math.abs(c)-M.local.altitude)/(M.global.altitude-M.local.altitude),0,1);let u;if(r.globalFactor=s,null!=i&&(u=v.getTimes(i,o[1],o[0])),s<1){let e;if(null!=i)e=ot(i,u,a);else{const t=L(a);e={direct:{intensity:M.local.directAtNoon*t.direct,color:A(1,1,1)},ambient:{intensity:M.local.ambientAtNoon*t.ambient,color:A(1,1,1)},timeOfDay:"early afternoon"}}f(r.ambient.color,e.ambient.color,r.ambient.color,s),r.ambient.intensity=t(e.ambient.intensity,r.ambient.intensity,s),f(r.direct.color,e.direct.color,r.direct.color,s),r.direct.intensity=t(e.direct.intensity,r.direct.intensity,s),r.specularStrength="rainy"===a||"snowy"===a||"foggy"===a?0:1,r.environmentStrength="rainy"===a?.7:"snowy"===a||"foggy"===a?.75:1}r.noonFactor=null!=i?F(i,u):1,null!=i?P(i,o,n,r.direct.directionToLightSource):O(l,n,r.direct.directionToLightSource)}function O(t,e,o){e===N.Global?d(lt,t.eye):g(lt,0,0,1),h(rt,t.viewForward,-1);const n=T(rt,lt),a=Math.max(n-2*st,0),l=.85*a/(a+1),r=Math.max(st,n-st-l);i(at,-r,t.viewRight),b(o,rt,at),y(o,o,h(ct,t.viewRight,ut)),d(o,o)}function P(t,i,r,c){const s=H,u=o(G);if(r===N.Global)v.getPosition(t,0,0,s),g(c,0,0,-1),n(u,u,-s.azimuth),a(u,u,-s.altitude),b(c,c,u);else{const o=M.planarDirection,a=o.globalAngles,r=i[2];let m=(Math.abs(r)-o.localAltitude)/(o.globalAltitude-o.localAltitude);m=e(m,0,1),m<1?(v.getPosition(t,i[1],i[0],s),s.azimuth=(1-m)*s.azimuth+m*a.azimuth,s.altitude=(1-m)*s.altitude+m*a.altitude):(s.azimuth=a.azimuth,s.altitude=a.altitude),g(c,0,-1,0),l(u,u,-s.azimuth),n(u,u,-s.altitude),b(c,c,u)}}function z(t,e){if(e===N.Global)return!0;const i=M.planarDirection;return Math.abs(t)<i.localAltitude}function D(t,e,i,o,n){const a=t.getTime(),l=e.getTime()-a,r=Math.floor(l/i)+1,c=new Array(r);for(let s=0;s<r;++s)nt.setTime(a+i*s),c[s]=w(),P(nt,o,n,c[s]);return c}const E=A(.5773502691896258,-.5773502691896258,.5773502691896258);class I{constructor(){this.ambient={color:A(1,1,1),intensity:.55},this.direct={color:A(1,1,1),intensity:.55,directionToLightSource:x(E)},this.noonFactor=.5,this.globalFactor=0,this.specularStrength=1,this.environmentStrength=1}}const G=r(),H={azimuth:0,altitude:0};function F(t,i){const o=t.valueOf();let n,a;i.polarException===v.PolarException.MIDNIGHT_SUN?(n=o-60*(t.getHours()+48)*60*1e3-60*t.getMinutes()*1e3,a=n+432e6):i.polarException===v.PolarException.POLAR_NIGHT?(n=o-2,a=o-1):(n=i.sunrise.valueOf(),a=i.sunset.valueOf());const l=n+(a-n)/2;return 1-e(Math.abs(o-l)/432e5,0,1)}function L(t){switch(t){case"disabled":case"sunny":case"cloudy":return new S(1,1);case"rainy":return new S(.4,1.2);case"snowy":return new S(.5,1.3);case"foggy":return new S(.2,1.6)}}function R(t,e){const i=(t[0]+t[1]+t[2])/3;t[0]+=(i-t[0])*e,t[1]+=(i-t[1])*e,t[2]+=(i-t[2])*e}const U=A(.01,.01,.01),_=A(1,.6,.5),k=A(1,.98,.98),V=A(1,1,1),C=A(.8,.8,1),q=A(.8,.8,1),B=A(.98,.98,1),J=A(1,1,1),K=u(.01,M.local.ambientAtNight),Q=u(M.local.directAtTwilight,M.local.ambientAtTwilight),W=u(.9*M.local.directAtNoon,M.local.ambientAtNoon),X=u(M.local.directAtNoon,M.local.ambientAtNoon),Y=W,Z=k,$=B,tt=Q,et=_,it=q;function ot(t,e,i){const o=t.valueOf();let n,a;e.polarException===v.PolarException.MIDNIGHT_SUN?(n=o-60*(t.getHours()+48)*60*1e3-60*t.getMinutes()*1e3,a=n+432e6):e.polarException===v.PolarException.POLAR_NIGHT?(n=o-2,a=o-1):(n=e.sunrise.valueOf(),a=e.sunset.valueOf());const l=a-n,r=n+l/2,u=l/4,g=r-u,d=r+u,h=.06*l,b=n-h/2,y=n+h/2,A=a-h/2,x=a+h/2,N=m(),T=w(),M=w();let S="";if(o<b||o>x)c(N,K),p(T,U),p(M,C),S="night";else if(o<y){const t=(o-b)/(y-b);s(N,K,Q,t),f(T,U,_,t),f(M,C,q,t),S="sun rising"}else if(o<g){const t=(o-y)/(g-y);s(N,Q,W,t),f(T,_,k,t),f(M,q,B,t),S="early morning"}else if(o<r){const t=(o-g)/(r-g);s(N,W,X,t),f(T,k,V,t),f(M,B,J,t),S="late morning"}else if(o<d){const t=(o-r)/(d-r);s(N,X,Y,t),f(T,V,Z,t),f(M,J,$,t),S="early afternoon"}else if(o<A){const t=(o-d)/(A-d);s(N,Y,tt,t),f(T,Z,et,t),f(M,$,it,t),S="late afternoon"}else if(o<x){const t=(o-A)/(x-A);s(N,tt,K,t),f(T,et,U,t),f(M,it,C,t),S="sun setting"}let j=0;switch(i){case"rainy":case"foggy":j=.8;break;case"snowy":j=.5}j>0&&(R(T,j),R(M,j));const O=L(i);return{direct:{intensity:N[0]*O.direct,color:T},ambient:{intensity:N[1]*O.ambient,color:M},timeOfDay:S}}const nt=new Date(0),at=r(),lt=w(),rt=w(),ct=w(),st=.25,ut=.2;export{I as ColorAndIntensity,j as computeColorAndIntensity,D as computeDirectionsOverTime,z as computeShadowsEnabled,O as computeVirtualLightDirection};
@@ -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 t from"../../../Camera.js";import"../../../geometry.js";import e from"../../../Graphic.js";import n from"../../../Viewpoint.js";import{result as a}from"../../../core/asyncUtils.js";import"../../../core/has.js";import{cyclicalDegrees as r}from"../../../core/Cyclical.js";import o from"../../../core/Error.js";import{throwIfAborted as i}from"../../../core/promiseUtils.js";import{fromMat4 as s,transpose as c}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as l}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{h as u,g as f,p,c as g,f as y,s as h,t as d}from"../../../chunks/vec32.js";import{create as w}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{tryProjectWithZConversion as x,projectWithZConversion as j}from"../../../geometry/projection.js";import{computeTranslationToOriginAndRotation as v}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectPointToVectorAsync as b}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToPoint as R}from"../../../geometry/projection/projectVectorToPoint.js";import{projectVectorToVector as z}from"../../../geometry/projection/projectVectorToVector.js";import{create as G,empty as S,center as B,toRect as T,isPoint as M,expandWithVec3 as Z,expandWithAABB as E,width as A,height as F,depth as O}from"../../../geometry/support/aaBoundingBox.js";import{create as P,isPoint as D}from"../../../geometry/support/aaBoundingRect.js";import{intersectsPoint as U}from"../../../geometry/support/frustum.js";import{getResolutionInMetersForScale as V}from"../../../geometry/support/scaleUtils.js";import{cameraOnContentAlongViewDirection as C}from"../camera/intersectionUtils.js";import{getViewSR as k,fromExtentSync as I,fromExtentAsync as J,internalToExternal as K,OrientationMode as L,scaleToDistance as N,fromCenterDistanceSync as W,fromCenterDistanceAsync as Y,externalToInternal as q,computeScale as X,distanceToScale as _,fromCenterScale as H,directionToHeadingTilt as Q,zoomToScale as $}from"./cameraUtils.js";import{getElevationAtPoint as tt}from"./ElevationProvider.js";import et from"../../../geometry/Point.js";import nt from"../../../geometry/Extent.js";import at from"../../../geometry/SpatialReference.js";import rt from"../../../geometry/Geometry.js";import ot from"../../../geometry/Multipoint.js";const it=.66;function st(t){return 360-r.normalize(t)}function ct(t){return r.normalize(360-t)}function lt(t,e,n){const a=e.camera;if(null!=a)return ut(a,k(t));const{targetGeometry:r}=e;if(null==r)return null;const{camera:o,mode:i}=pt(t,e.rotation,n);if("point"===r.type)return gt(t,e,r,o,i);const s=r.extent;return null==s?null:I(t,s,o.heading,o.tilt,i)}async function mt(t,e,n,a){const r=e.camera;if(null!=r)return ft(r,k(t),a);const{targetGeometry:o}=e;if(null==o)throw new Error("Viewpoint has no targetGeometry!");const{camera:i,mode:s}=pt(t,e.rotation,n);if("point"===o.type)return yt(t,e,o,i,s,a);const c=o.extent;if(null==c)throw new Error("Target geometry has no extent!");return J(t,c,i.heading,i.tilt,s,a)}function ut(t,e){const n=t.position;let a;try{a=x(n,e)}catch(o){return null}if(!a)return null;const r=t.clone();return r.position=a.clone(),r}async function ft(t,e,n){const a=t.position,r=await j(a,e,{signal:n});i(n);const o=t.clone();return o.position=r.clone(),o}function pt(t,e,n){const a=K(t,t.state.camera);let r=L.ADJUST;return null!=e&&(a.heading=st(e),r=L.LOCKED),null!=n&&(a.tilt=n),{camera:a,mode:r}}function gt(t,e,n,a,r){const o=t.spatialReference;let i;try{i=x(n.clone(),o)}catch(c){return null}if(!i)return null;const s=null!=e.scale?N(t,e.scale,i.latitude):t.state.camera.distance;return W(t,i,s,a,r)}async function yt(t,e,n,a,r,o){const s=t.spatialReference,c=await j(n.clone(),s,{signal:o});i(o);const l=null!=e.scale?N(t,e.scale,c.latitude):t.state.camera.distance;return Y(t,c,l,a,r,o)}function ht(t,e,a=null){return null==a&&(a=new n),vt(t,null,e.clone(),a)}async function dt(e,a,r){const i=Ot(e,a);if(!i)throw new o("viewpointutils-create:no-target","Missing target for creating viewpoint");const s=new t({fov:e.camera.fov}),c=new n({camera:s});if(i.target instanceof n){return Pt(await Gt(e,i.target,i,r,c))}if(i.target instanceof t)return Pt(await St(e,i.target,r,c));const l=null!=i.scale||null!=i.zoom;if(i.target instanceof nt){const t=i.target.xmin===i.target.xmax||i.target.ymin===i.target.ymax;return Pt(l||t?await Tt(e,i,i.target.center,s,r,c):await Et(e,i,i.target,s,r,c))}const m={boundingBox:S(),hasZ:!1,screenSpaceObjects:[]},u=l?xt(e,i):void 0;if(await zt(e,i.target,u,m,r),isFinite(m.boundingBox[0])){let t;if(B(m.boundingBox,Ut),Wt.x=Ut[0],Wt.y=Ut[1],Wt.z=Ut[2],Wt.spatialReference=e.spatialReference,isFinite(Wt.z)&&m.hasZ?t=M(m.boundingBox):(Wt.z=void 0,t=D(T(m.boundingBox,It))),l||t)return Pt(await Tt(e,i,Wt,s,r,c));const n=Dt(e,m.screenSpaceObjects);return Pt(await Ft(e,i,Wt,m.boundingBox,n,s,r,c))}return i.position?Pt(await Mt(e,i,s,c,r)):Pt(await Zt(e,i,s,r,c))}function wt(t,e){return null==e.scale&&null!=e.zoom?$(t,e.zoom):e.scale}function xt(t,e){const n=wt(t,e);return n?V(n):void 0}function jt(t,e){let n=!1;return null!=e.heading?(t.heading=e.heading,n=!0):null!=e.rotation&&(t.heading=st(e.rotation),n=!0),null!=e.tilt&&(t.tilt=e.tilt,n=!0),null!=e.fov&&(t.fov=e.fov),n}function vt(t,e,n,a){const r=t.spatialReference||at.WGS84;if(null==(e=null!=e?e:q(t,n)))return a;const o=new et({spatialReference:r});return R(e.center,t.renderSpatialReference,o)?(a.targetGeometry=o,a.scale=X(t,e),a.rotation=ct(n.heading),a.camera=n,a):a}async function bt(t,e,n,a){const r=()=>new o("viewpointutils:invalid-geometry","The target is missing a valid geometry");if(!e)throw r();"mesh"===e.type&&(e=e.extent);const i=e.spatialReference,s=t.spatialReference,c=t.basemapTerrain.spatialReference;if(!e.hasZ&&t.basemapTerrain){let n;switch(e.type){case"point":n=e;break;case"multipoint":case"polyline":n=e.extent?.center;break;case"extent":n=e.center;break;case"polygon":n=e.centroid}null!=n&&null!=c&&null!=t.elevationProvider?(n=await j(n,c,{signal:a}),Ut[2]=tt(t.elevationProvider,n)??0):Ut[2]=0}const l=Yt[e.type],m=new Array;if(l(e,e.hasZ?t=>{m.push([t[0],t[1],t[2]])}:t=>{m.push([t[0],t[1]])},Ut),0===m.length)throw r();const u=await j(new ot({spatialReference:i,hasZ:e.hasZ,hasM:!1,points:m}),s,{signal:a});if(e.hasZ&&(n.hasZ=!0),e.hasZ)for(const[o,f,p]of u.points)Ut[0]=o,Ut[1]=f,Ut[2]=p,Z(n.boundingBox,Ut);else for(const[o,f]of u.points)Ut[0]=o,Ut[1]=f,Z(n.boundingBox,Ut)}async function Rt(t,e,n,r,o){const i=await a(t.whenViewForGraphic(e));if(!1===i.ok||null==i.value||!("whenGraphicBounds"in i.value))return void await bt(t,e.geometry,r,o);const s=i.value,c=await a(s.whenGraphicBounds(e,{minDemResolution:n}));if(!1===c.ok||!c.value)return void await bt(t,e.geometry,r,o);const{screenSpaceObjects:l,boundingBox:m}=c.value;E(r.boundingBox,m),l&&l.forEach((t=>{r.screenSpaceObjects.push(t)})),isFinite(m[2])&&(r.hasZ=!0)}async function zt(t,n,a,r,o){if(Array.isArray(n)&&2===n.length){const e=n[0],a=n[1];if("number"==typeof e&&"number"==typeof a)return Wt.x=e,Wt.y=a,Wt.z=void 0,Wt.spatialReference=t.spatialReference?.isGeographic?t.spatialReference:at.WGS84,void await bt(t,Wt,r,o)}n&&"map"in n&&"function"==typeof n.map?await Promise.allSettled(n.map((e=>zt(t,e,a,r,o)))):n instanceof rt?await bt(t,n,r,o):n instanceof e&&await Rt(t,n,a,r,o)}async function Gt(t,e,n,a,r){if(null!=e.camera)return St(t,e.camera,a,r);r.scale=e.scale,r.rotation=e.rotation,r.targetGeometry=null!=e.targetGeometry?e.targetGeometry.clone():null,r.camera=null,null!=n.heading?r.rotation=ct(n.heading):null!=n.rotation&&(r.rotation=n.rotation);const o=wt(t,n);return null!=o&&(r.scale=o),r.camera=await mt(t,r,n.tilt,a),r}async function St(t,e,n,a){const r=t.spatialReference,o=await j(e.position,r,{signal:n});return(e=e.clone()).fov=t.camera.fov,e.position=o,vt(t,null,e,a)}async function Bt(t,e,n,a,r,o,i){const s=t.renderSpatialReference;return await b(e,Lt,s,0,{signal:i}),await b(n,Kt,s,0,{signal:i}),o.targetGeometry=new et(e),r.position=new et(n),y(Jt,Lt,Kt),Q(t,Kt,Jt,a.up,r),o.scale=_(t,p(Kt,Lt),o.targetGeometry.latitude),o.rotation=ct(r.heading),o.camera=r,o}async function Tt(t,e,n,a,r,i){if(null==n)throw new o("createfromcenter","invalid point");i.targetGeometry=n.clone();const s=C(t);if(e.position)return Bt(t,i.targetGeometry,e.position,s,a,i,r);if(e.zoomFactor){const a=s.distance/e.zoomFactor,r=u(Ut,s.viewForward,-a);s.eye=f(Ut,s.center,r),i.scale=_(t,a,n.latitude)}K(t,s,a);const c=jt(a,e)?L.LOCKED:L.ADJUST;if(!e.zoomFactor){const o=wt(t,e);if(null==o){const{renderSpatialReference:e}=t;await b(n,Ut,e,0,{signal:r}),U(s.frustum,Ut)?i.scale=_(t,p(s.eye,Ut),n.latitude):i.scale=X(t,s)}else i.scale=o;i.camera=await H(t,i.targetGeometry,i.scale,a,c,r)}return i}async function Mt(t,e,n,a,r){const o=C(t);g(Jt,o.viewForward),Q(t,o.eye,Jt,o.up,Nt);const i=t.spatialReference,{position:s}=e;if(s){const t=await j(s,i,{signal:r});n.position=t}else n.position=new et;return n.heading=null!=e.heading?e.heading:Nt.heading,n.tilt=null!=e.tilt?e.tilt:Nt.tilt,vt(t,null,n,a)}async function Zt(t,e,n,a,r){const o=C(t),{spatialReference:i,renderSpatialReference:s}=t,c=new et({spatialReference:i});return R(o.center,s,c)?Tt(t,e,c,n,a,r):Tt(t,e,null,n,a,r)}async function Et(t,e,n,a,r,o){o.targetGeometry=n.clone();const i=C(t);K(t,i,a);const s=jt(a,e)?L.LOCKED:L.ADJUST;return o.camera=await J(t,n,a.heading,a.tilt,s,r),o}function At(t,e,n,a,r){let o=0;null!=n.z?o=n.z:t.basemapTerrain&&t.elevationProvider&&(o=tt(t.elevationProvider,n)),h(Ut,n.x,n.y,o),v(t.spatialReference,Ut,Vt,t.renderSpatialReference),s(Ct,Vt),c(Ct,Ct),S(kt);const i=[[0,1,2],[3,1,2],[0,4,2],[3,4,2],[0,1,5],[3,1,5],[0,4,5],[3,4,5]];for(let s=0;s<i.length;s++){const e=i[s];let n=a[e[2]];isFinite(n)||(n=o),h(Ut,a[e[0]],a[e[1]],n),z(Ut,t.spatialReference,Ut,t.renderSpatialReference),Z(kt,d(Ut,Ut,Ct))}const l=A(kt),m=F(kt),u=O(kt),f=1/Math.tan(e.fovX/2),p=1/Math.tan(e.fovY/2),g=.5*Math.sqrt(l*l+u*u)*Math.max(p,f)+.5*m,y=.5*m*p+.5*Math.max(l,u);return Math.max(g,y)/r}async function Ft(t,e,n,a,r,o,i,s){s.targetGeometry=n.clone();const c=C(t),l=At(t,c,n,a,r);K(t,c,o);const m=jt(o,e)?L.LOCKED:L.ADJUST;return s.scale=_(t,l,s.targetGeometry.latitude),s.camera=await H(t,s.targetGeometry,s.scale,o,m,i),s}function Ot(t,e){if(!e||!t.spatialReference)return null;const n={target:void 0};return"declaredClass"in e||Array.isArray(e)?n.target=e:(Object.assign(n,e),e.center&&!n.target&&(n.target=e.center)),n}function Pt(t){return null!=t?.camera&&(t.rotation=ct(t.camera.heading)),t}function Dt(t,e){const n=it;if(!e.length)return n;let a=Number.NEGATIVE_INFINITY;for(let r=0;r<e.length;r++){const t=e[r].screenSpaceBoundingRect;a=Math.max(a,Math.abs(t[0]),Math.abs(t[1]),Math.abs(t[2]),Math.abs(t[3]))}return n-a/Math.min(t.width,t.height)*2}const Ut=w(),Vt=m(),Ct=l(),kt=G(),It=P(),Jt=w(),Kt=w(),Lt=w(),Nt={heading:0,tilt:0},Wt=new et,Yt={point(t,e,n){n[0]=t.x,n[1]=t.y,null!=t.z&&(n[2]=t.z),e(n)},polygon(t,e,n){const a=t.hasZ;for(let r=0;r<t.rings.length;r++){const o=t.rings[r];for(let t=0;t<o.length;t++)n[0]=o[t][0],n[1]=o[t][1],a&&(n[2]=o[t][2]),e(n)}},polyline(t,e,n){const a=t.hasZ;for(let r=0;r<t.paths.length;r++){const o=t.paths[r];for(let t=0;t<o.length;t++)n[0]=o[t][0],n[1]=o[t][1],a&&(n[2]=o[t][2]),e(n)}},multipoint(t,e,n){const a=t.points,r=t.hasZ;for(let o=0;o<a.length;o++)n[0]=a[o][0],n[1]=a[o][1],r&&(n[2]=a[o][2]),e(n)},extent(t,e,n){null!=t.zmin&&null!=t.zmax?(e(h(n,t.xmin,t.ymin,t.zmin)),e(h(n,t.xmax,t.ymin,t.zmin)),e(h(n,t.xmin,t.ymax,t.zmin)),e(h(n,t.xmax,t.ymax,t.zmin)),e(h(n,t.xmin,t.ymin,t.zmax)),e(h(n,t.xmax,t.ymin,t.zmax)),e(h(n,t.xmin,t.ymax,t.zmax)),e(h(n,t.xmax,t.ymax,t.zmax))):(e(h(n,t.xmin,t.ymin,n[2])),e(h(n,t.xmax,t.ymin,n[2])),e(h(n,t.xmin,t.ymax,n[2])),e(h(n,t.xmax,t.ymax,n[2])))}};export{dt as create,ht as fromCamera,mt as toCameraAsync,lt as toCameraSync};
5
+ import t from"../../../Camera.js";import"../../../geometry.js";import e from"../../../Graphic.js";import n from"../../../Viewpoint.js";import{result as a}from"../../../core/asyncUtils.js";import"../../../core/has.js";import{cyclicalDegrees as r}from"../../../core/Cyclical.js";import o from"../../../core/Error.js";import{throwIfAborted as i}from"../../../core/promiseUtils.js";import{fromMat4 as s,transpose as c}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as l}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{h as u,g as f,q as p,c as g,f as y,s as h,t as d}from"../../../chunks/vec32.js";import{create as w}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{tryProjectWithZConversion as x,projectWithZConversion as j}from"../../../geometry/projection.js";import{computeTranslationToOriginAndRotation as v}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectPointToVectorAsync as b}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToPoint as R}from"../../../geometry/projection/projectVectorToPoint.js";import{projectVectorToVector as z}from"../../../geometry/projection/projectVectorToVector.js";import{create as G,empty as S,center as B,toRect as T,isPoint as M,expandWithVec3 as Z,expandWithAABB as E,width as A,height as F,depth as O}from"../../../geometry/support/aaBoundingBox.js";import{create as P,isPoint as D}from"../../../geometry/support/aaBoundingRect.js";import{intersectsPoint as U}from"../../../geometry/support/frustum.js";import{getResolutionInMetersForScale as V}from"../../../geometry/support/scaleUtils.js";import{cameraOnContentAlongViewDirection as C}from"../camera/intersectionUtils.js";import{getViewSR as k,fromExtentSync as I,fromExtentAsync as J,internalToExternal as K,OrientationMode as L,scaleToDistance as N,fromCenterDistanceSync as q,fromCenterDistanceAsync as W,externalToInternal as Y,computeScale as X,distanceToScale as _,fromCenterScale as H,directionToHeadingTilt as Q,zoomToScale as $}from"./cameraUtils.js";import{getElevationAtPoint as tt}from"./ElevationProvider.js";import et from"../../../geometry/Point.js";import nt from"../../../geometry/Extent.js";import at from"../../../geometry/SpatialReference.js";import rt from"../../../geometry/Geometry.js";import ot from"../../../geometry/Multipoint.js";const it=.66;function st(t){return 360-r.normalize(t)}function ct(t){return r.normalize(360-t)}function lt(t,e,n){const a=e.camera;if(null!=a)return ut(a,k(t));const{targetGeometry:r}=e;if(null==r)return null;const{camera:o,mode:i}=pt(t,e.rotation,n);if("point"===r.type)return gt(t,e,r,o,i);const s=r.extent;return null==s?null:I(t,s,o.heading,o.tilt,i)}async function mt(t,e,n,a){const r=e.camera;if(null!=r)return ft(r,k(t),a);const{targetGeometry:o}=e;if(null==o)throw new Error("Viewpoint has no targetGeometry!");const{camera:i,mode:s}=pt(t,e.rotation,n);if("point"===o.type)return yt(t,e,o,i,s,a);const c=o.extent;if(null==c)throw new Error("Target geometry has no extent!");return J(t,c,i.heading,i.tilt,s,a)}function ut(t,e){const n=t.position;let a;try{a=x(n,e)}catch(o){return null}if(!a)return null;const r=t.clone();return r.position=a.clone(),r}async function ft(t,e,n){const a=t.position,r=await j(a,e,{signal:n});i(n);const o=t.clone();return o.position=r.clone(),o}function pt(t,e,n){const a=K(t,t.state.camera);let r=L.ADJUST;return null!=e&&(a.heading=st(e),r=L.LOCKED),null!=n&&(a.tilt=n),{camera:a,mode:r}}function gt(t,e,n,a,r){const o=t.spatialReference;let i;try{i=x(n.clone(),o)}catch(c){return null}if(!i)return null;const s=null!=e.scale?N(t,e.scale,i.latitude):t.state.camera.distance;return q(t,i,s,a,r)}async function yt(t,e,n,a,r,o){const s=t.spatialReference,c=await j(n.clone(),s,{signal:o});i(o);const l=null!=e.scale?N(t,e.scale,c.latitude):t.state.camera.distance;return W(t,c,l,a,r,o)}function ht(t,e,a=null){return null==a&&(a=new n),vt(t,null,e.clone(),a)}async function dt(e,a,r){const i=Ot(e,a);if(!i)throw new o("viewpointutils-create:no-target","Missing target for creating viewpoint");const s=new t({fov:e.camera.fov}),c=new n({camera:s});if(i.target instanceof n){return Pt(await Gt(e,i.target,i,r,c))}if(i.target instanceof t)return Pt(await St(e,i.target,r,c));const l=null!=i.scale||null!=i.zoom;if(i.target instanceof nt){const t=i.target.xmin===i.target.xmax||i.target.ymin===i.target.ymax;return Pt(l||t?await Tt(e,i,i.target.center,s,r,c):await Et(e,i,i.target,s,r,c))}const m={boundingBox:S(),hasZ:!1,screenSpaceObjects:[]},u=l?xt(e,i):void 0;if(await zt(e,i.target,u,m,r),isFinite(m.boundingBox[0])){let t;if(B(m.boundingBox,Ut),qt.x=Ut[0],qt.y=Ut[1],qt.z=Ut[2],qt.spatialReference=e.spatialReference,isFinite(qt.z)&&m.hasZ?t=M(m.boundingBox):(qt.z=void 0,t=D(T(m.boundingBox,It))),l||t)return Pt(await Tt(e,i,qt,s,r,c));const n=Dt(e,m.screenSpaceObjects);return Pt(await Ft(e,i,qt,m.boundingBox,n,s,r,c))}return i.position?Pt(await Mt(e,i,s,c,r)):Pt(await Zt(e,i,s,r,c))}function wt(t,e){return null==e.scale&&null!=e.zoom?$(t,e.zoom):e.scale}function xt(t,e){const n=wt(t,e);return n?V(n):void 0}function jt(t,e){let n=!1;return null!=e.heading?(t.heading=e.heading,n=!0):null!=e.rotation&&(t.heading=st(e.rotation),n=!0),null!=e.tilt&&(t.tilt=e.tilt,n=!0),null!=e.fov&&(t.fov=e.fov),n}function vt(t,e,n,a){const r=t.spatialReference||at.WGS84;if(null==(e=null!=e?e:Y(t,n)))return a;const o=new et({spatialReference:r});return R(e.center,t.renderSpatialReference,o)?(a.targetGeometry=o,a.scale=X(t,e),a.rotation=ct(n.heading),a.camera=n,a):a}async function bt(t,e,n,a){const r=()=>new o("viewpointutils:invalid-geometry","The target is missing a valid geometry");if(!e)throw r();"mesh"===e.type&&(e=e.extent);const i=e.spatialReference,s=t.spatialReference,c=t.basemapTerrain.spatialReference;if(!e.hasZ&&t.basemapTerrain){let n;switch(e.type){case"point":n=e;break;case"multipoint":case"polyline":n=e.extent?.center;break;case"extent":n=e.center;break;case"polygon":n=e.centroid}null!=n&&null!=c&&null!=t.elevationProvider?(n=await j(n,c,{signal:a}),Ut[2]=tt(t.elevationProvider,n)??0):Ut[2]=0}const l=Wt[e.type],m=new Array;if(l(e,e.hasZ?t=>{m.push([t[0],t[1],t[2]])}:t=>{m.push([t[0],t[1]])},Ut),0===m.length)throw r();const u=await j(new ot({spatialReference:i,hasZ:e.hasZ,hasM:!1,points:m}),s,{signal:a});if(e.hasZ&&(n.hasZ=!0),e.hasZ)for(const[o,f,p]of u.points)Ut[0]=o,Ut[1]=f,Ut[2]=p,Z(n.boundingBox,Ut);else for(const[o,f]of u.points)Ut[0]=o,Ut[1]=f,Z(n.boundingBox,Ut)}async function Rt(t,e,n,r,o){const i=await a(t.whenViewForGraphic(e));if(!1===i.ok||null==i.value||!("whenGraphicBounds"in i.value))return void await bt(t,e.geometry,r,o);const s=i.value,c=await a(s.whenGraphicBounds(e,{minDemResolution:n}));if(!1===c.ok||!c.value)return void await bt(t,e.geometry,r,o);const{screenSpaceObjects:l,boundingBox:m}=c.value;E(r.boundingBox,m),l&&l.forEach((t=>{r.screenSpaceObjects.push(t)})),isFinite(m[2])&&(r.hasZ=!0)}async function zt(t,n,a,r,o){if(Array.isArray(n)&&2===n.length){const e=n[0],a=n[1];if("number"==typeof e&&"number"==typeof a)return qt.x=e,qt.y=a,qt.z=void 0,qt.spatialReference=t.spatialReference?.isGeographic?t.spatialReference:at.WGS84,void await bt(t,qt,r,o)}n&&"map"in n&&"function"==typeof n.map?await Promise.allSettled(n.map((e=>zt(t,e,a,r,o)))):n instanceof rt?await bt(t,n,r,o):n instanceof e&&await Rt(t,n,a,r,o)}async function Gt(t,e,n,a,r){if(null!=e.camera)return St(t,e.camera,a,r);r.scale=e.scale,r.rotation=e.rotation,r.targetGeometry=null!=e.targetGeometry?e.targetGeometry.clone():null,r.camera=null,null!=n.heading?r.rotation=ct(n.heading):null!=n.rotation&&(r.rotation=n.rotation);const o=wt(t,n);return null!=o&&(r.scale=o),r.camera=await mt(t,r,n.tilt,a),r}async function St(t,e,n,a){const r=t.spatialReference,o=await j(e.position,r,{signal:n});return(e=e.clone()).fov=t.camera.fov,e.position=o,vt(t,null,e,a)}async function Bt(t,e,n,a,r,o,i){const s=t.renderSpatialReference;return await b(e,Lt,s,0,{signal:i}),await b(n,Kt,s,0,{signal:i}),o.targetGeometry=new et(e),r.position=new et(n),y(Jt,Lt,Kt),Q(t,Kt,Jt,a.up,r),o.scale=_(t,p(Kt,Lt),o.targetGeometry.latitude),o.rotation=ct(r.heading),o.camera=r,o}async function Tt(t,e,n,a,r,i){if(null==n)throw new o("createfromcenter","invalid point");i.targetGeometry=n.clone();const s=C(t);if(e.position)return Bt(t,i.targetGeometry,e.position,s,a,i,r);if(e.zoomFactor){const a=s.distance/e.zoomFactor,r=u(Ut,s.viewForward,-a);s.eye=f(Ut,s.center,r),i.scale=_(t,a,n.latitude)}K(t,s,a);const c=jt(a,e)?L.LOCKED:L.ADJUST;if(!e.zoomFactor){const o=wt(t,e);if(null==o){const{renderSpatialReference:e}=t;await b(n,Ut,e,0,{signal:r}),U(s.frustum,Ut)?i.scale=_(t,p(s.eye,Ut),n.latitude):i.scale=X(t,s)}else i.scale=o;i.camera=await H(t,i.targetGeometry,i.scale,a,c,r)}return i}async function Mt(t,e,n,a,r){const o=C(t);g(Jt,o.viewForward),Q(t,o.eye,Jt,o.up,Nt);const i=t.spatialReference,{position:s}=e;if(s){const t=await j(s,i,{signal:r});n.position=t}else n.position=new et;return n.heading=null!=e.heading?e.heading:Nt.heading,n.tilt=null!=e.tilt?e.tilt:Nt.tilt,vt(t,null,n,a)}async function Zt(t,e,n,a,r){const o=C(t),{spatialReference:i,renderSpatialReference:s}=t,c=new et({spatialReference:i});return R(o.center,s,c)?Tt(t,e,c,n,a,r):Tt(t,e,null,n,a,r)}async function Et(t,e,n,a,r,o){o.targetGeometry=n.clone();const i=C(t);K(t,i,a);const s=jt(a,e)?L.LOCKED:L.ADJUST;return o.camera=await J(t,n,a.heading,a.tilt,s,r),o}function At(t,e,n,a,r){let o=0;null!=n.z?o=n.z:t.basemapTerrain&&t.elevationProvider&&(o=tt(t.elevationProvider,n)),h(Ut,n.x,n.y,o),v(t.spatialReference,Ut,Vt,t.renderSpatialReference),s(Ct,Vt),c(Ct,Ct),S(kt);const i=[[0,1,2],[3,1,2],[0,4,2],[3,4,2],[0,1,5],[3,1,5],[0,4,5],[3,4,5]];for(let s=0;s<i.length;s++){const e=i[s];let n=a[e[2]];isFinite(n)||(n=o),h(Ut,a[e[0]],a[e[1]],n),z(Ut,t.spatialReference,Ut,t.renderSpatialReference),Z(kt,d(Ut,Ut,Ct))}const l=A(kt),m=F(kt),u=O(kt),f=1/Math.tan(e.fovX/2),p=1/Math.tan(e.fovY/2),g=.5*Math.sqrt(l*l+u*u)*Math.max(p,f)+.5*m,y=.5*m*p+.5*Math.max(l,u);return Math.max(g,y)/r}async function Ft(t,e,n,a,r,o,i,s){s.targetGeometry=n.clone();const c=C(t),l=At(t,c,n,a,r);K(t,c,o);const m=jt(o,e)?L.LOCKED:L.ADJUST;return s.scale=_(t,l,s.targetGeometry.latitude),s.camera=await H(t,s.targetGeometry,s.scale,o,m,i),s}function Ot(t,e){if(!e||!t.spatialReference)return null;const n={target:void 0};return"declaredClass"in e||Array.isArray(e)?n.target=e:(Object.assign(n,e),e.center&&!n.target&&(n.target=e.center)),n}function Pt(t){return null!=t?.camera&&(t.rotation=ct(t.camera.heading)),t}function Dt(t,e){const n=it;if(!e.length)return n;let a=Number.NEGATIVE_INFINITY;for(let r=0;r<e.length;r++){const t=e[r].screenSpaceBoundingRect;a=Math.max(a,Math.abs(t[0]),Math.abs(t[1]),Math.abs(t[2]),Math.abs(t[3]))}return n-a/Math.min(t.width,t.height)*2}const Ut=w(),Vt=m(),Ct=l(),kt=G(),It=P(),Jt=w(),Kt=w(),Lt=w(),Nt={heading:0,tilt:0},qt=new et,Wt={point(t,e,n){n[0]=t.x,n[1]=t.y,null!=t.z&&(n[2]=t.z),e(n)},polygon(t,e,n){const a=t.hasZ;for(let r=0;r<t.rings.length;r++){const o=t.rings[r];for(let t=0;t<o.length;t++)n[0]=o[t][0],n[1]=o[t][1],a&&(n[2]=o[t][2]),e(n)}},polyline(t,e,n){const a=t.hasZ;for(let r=0;r<t.paths.length;r++){const o=t.paths[r];for(let t=0;t<o.length;t++)n[0]=o[t][0],n[1]=o[t][1],a&&(n[2]=o[t][2]),e(n)}},multipoint(t,e,n){const a=t.points,r=t.hasZ;for(let o=0;o<a.length;o++)n[0]=a[o][0],n[1]=a[o][1],r&&(n[2]=a[o][2]),e(n)},extent(t,e,n){null!=t.zmin&&null!=t.zmax?(e(h(n,t.xmin,t.ymin,t.zmin)),e(h(n,t.xmax,t.ymin,t.zmin)),e(h(n,t.xmin,t.ymax,t.zmin)),e(h(n,t.xmax,t.ymax,t.zmin)),e(h(n,t.xmin,t.ymin,t.zmax)),e(h(n,t.xmax,t.ymin,t.zmax)),e(h(n,t.xmin,t.ymax,t.zmax)),e(h(n,t.xmax,t.ymax,t.zmax))):(e(h(n,t.xmin,t.ymin,n[2])),e(h(n,t.xmax,t.ymin,n[2])),e(h(n,t.xmin,t.ymax,n[2])),e(h(n,t.xmax,t.ymax,n[2])))}};export{dt as create,ht as fromCamera,mt as toCameraAsync,lt as toCameraSync};