@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{n as e,y as t,j as i,q as s,c as n,C as r,v as o,h as a,m as c,a as l,p as h,l as d,o as u,f as m,g as p}from"../../../../chunks/vec32.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{c as v,b as g}from"../../../../chunks/vec42.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as S}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as R}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingSphere as b}from"../../../../geometry/projection/projectBoundingSphere.js";import{getProjector as x}from"../../../../geometry/projection/projectors.js";import{create as M,fromMatrix as I,intersectsSphere as C,createPoints as P}from"../../../../geometry/support/frustum.js";import{isPlateCarree as E}from"../../../../geometry/support/spatialReferenceUtils.js";import{g as D,w as F}from"../../../../chunks/sphere.js";import{makeDehydratedPoint as O}from"../../../../layers/graphics/dehydratedPoint.js";import{ViewingMode as B}from"../../../ViewingMode.js";import{evaluateElevationAlignmentAtPoint as j}from"../graphics/elevationAlignmentUtils.js";import{ElevationContext as V}from"../graphics/ElevationContext.js";import{createContextWithoutExpressionSupport as L,extractExpressionInfo as y}from"../graphics/featureExpressionInfoUtils.js";import{LodMetric as A}from"./I3SNode.js";import{isValidMbs as w,intersectBoundingRectWithMbs as G,MbsIntersectResult as N}from"./I3SUtil.js";import{Obb as U,computeOffsetObb as T}from"../../support/orientedBoundingBox.js";const q=1e5;class z{constructor(e,t,i,s,n,r,o,a,c={}){this._indexSR=e,this._renderCoordsHelper=t,this._clippingArea=n,this._elevationProvider=r,this._viewingMode=o,this._options=c,this._frustum=M(),this._frustumMbs=f(),this._useFrustumCulling=!1,this._poi=_(),this._elevationContext=null,this.minDistance=1/0,this.maxDistance=0,this.maxLodLevel=2,this._tmpObb=new U,this._tmp1=_(),this._tmp2=_(),this._tmp3=_(),this._tmp0=_(),this._screenspaceErrorBias=c.screenspaceErrorBias||1,this._progressiveLoadFactor=c.progressiveLoadFactor||1,this.updateCamera(i,s);const l=this._renderCoordsHelper.spatialReference;this._renderSR=l,this._renderSRSphericalPCPF=R(l),this._isGlobalMode=l===this._renderSRSphericalPCPF,this.updateElevationInfo(a),this._tmpPoint=O(0,0,0,e),this._isECEFOBBInLocalMode=this._indexSR.isWGS84&&(l.isWebMercator||E(l)),this._indexSREllipsoidRadius=S(this._indexSR).radius,this._indexSRSphericalPCPF=R(e),this._projectorIndexSRToIndexSRSphericalPCPF=x(this._indexSR,this._indexSRSphericalPCPF)}updateElevationInfo(e){null!=e?(this._elevationContext=V.fromElevationInfo(e),this._elevationContext.updateFeatureExpressionInfoContext(L(y(e,!1)))):this._elevationContext=null}updateCamera(n,r){if(this._useFrustumCulling=r,r){I(n.viewMatrix,n.projectionMatrix,this._frustum,H);{const r=n.eye,o=k;e(o,n.viewForward);const a=W;t(a,H[4],r);const c=.5*i(a,a)/i(o,a),l=this._frustumMbs;s(l,r,o,c);const h=1+c;l[3]=h}}this._screenSizeFactor=1/(n.perScreenPixelRatio/2),this._camPos=n.eye,this.minDistance=1/0,this.maxDistance=0}setPointOfInterest(e){this._poi=e}updateScreenSpaceErrorBias(e){const t=this._screenspaceErrorBias;return this._screenspaceErrorBias=e,t}updateClippingArea(e){this._clippingArea=e}expandElevationRange(e,t,i){if(null==this._elevationContext)return;const s=e.serviceMbsInIndexSR;if(!s)return;const n="relative-to-scene"===this._elevationContext.mode?"scene":"ground";if(this._elevationProvider.getSphereElevationBounds){const e=this._elevationProvider.getSphereElevationBounds(s,this._indexSR,n);return void(e&&i.expandElevationRange(e))}const r=s[0],o=s[1],a=s[2],c=this._elevationProvider.getElevation(r,o,a,this._indexSR,n);c&&i.expandElevationRangeValues(c,c);const l=t?null:this._elevationProvider.getRootElevationBounds?.();l&&i.expandElevationRange(l)}getServiceMbsInRenderSR(e){const t=e.serviceMbsInRenderSR;if(w(t))return t;e.serviceMbsInIndexSR&&v(t,e.serviceMbsInIndexSR);const i=e.elevationRangeMin;if(this._elevationContext&&Number.isFinite(i)){let s=0,n=0;const r=e.elevationRangeMax;switch(this._elevationContext.mode){case"relative-to-ground":s=this._elevationContext.geometryZWithOffset(t[2],this._renderCoordsHelper)+i-t[2],n=r-i;break;case"on-the-ground":s=i-t[2],n=r-i}t[2]+=s+.5*n,t[3]+=.5*n}else this._elevationContext&&t[3]<q&&(this._tmpPoint.x=t[0],this._tmpPoint.y=t[1],this._tmpPoint.z=t[2],t[2]=j(this._tmpPoint,this._elevationProvider,this._elevationContext,this._renderCoordsHelper));return b(t,this._indexSR,t,this._renderSR),t}getAndUpdateVisibilityObbInRenderSR(e){{const t=e.visibilityObbInRenderSR;if(t)return t}const t=.01*this._indexSREllipsoidRadius,{serviceMbsInIndexSR:i,serviceObbInIndexSR:s}=e;if(null==s||!i||!s.isValid||this._isECEFOBBInLocalMode&&(s.halfSizeX>t||s.halfSizeY>t||s.halfSizeZ>t))return null;{let t=e.serviceObbInRenderSR;if(null==t)t=new U,e.serviceObbInRenderSR=t;else if(t.isValid)return t;const n=i[3];let r=0,o=0;const a=s.centerZ,c=this._renderCoordsHelper,l=this._elevationContext;if(l&&e.elevationRangeValid){const t=e.elevationRangeMin,i=e.elevationRangeMax;switch(l.mode){case"relative-to-ground":r=l.geometryZWithOffset(a,c)+t-a,o=i-t;break;case"on-the-ground":r=t-a,o=i-t}}else if(l&&n<q){const e=this._tmpPoint;e.x=s.centerX,e.y=s.centerY,e.z=a,r=j(e,this._elevationProvider,l,c)-a}const h=o>0,d=h?this._tmpObb:t;return s.transform(d,this._indexSR,this._renderSR,r,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),h&&T(d,0,o,this._viewingMode,t),t}}getNodeObbInRenderSRIndependentOfElevationOffset(e){{const t=e.visibilityObbInRenderSR??e.serviceObbInRenderSR??null;if(t?.isValid)return t}const t=e.serviceObbInIndexSR;return t?(t.transform(X,this._indexSR,this._renderSR,void 0,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),X):null}ensureElevationAgnosticBoundingVolume(e,t){-1===e.elevationAgnosticBoundingVolume[3]&&(t===B.Global?this._updateElevationAgnosticBoundingVolumeGlobal(e):this._updateElevationAgnosticBoundingVolumeLocal(e))}_updateElevationAgnosticBoundingVolumeGlobal(t){const s=this.getNodeObbInRenderSRIndependentOfElevationOffset(t),o=t.elevationAgnosticBoundingVolume,a=Y;let c=-1;if(s){s.getCenter(a),e(a,a),s.getCorners(J);for(const t of J){e(t,t);const s=i(t,a);if(s<=0)return void(o[3]=-1);const n=Math.sqrt(1-s*s);c=Math.max(c,n)}}else{const i=t.serviceMbsInRenderSR;if(!w(i))return void(o[3]=-1);{const t=n(Y,D(i)),s=i[3],o=r(t);c=0===s?0:o<s?-1:s/o,e(t,t)}}g(o,a);const l=.001;o[3]=c+l}_updateElevationAgnosticBoundingVolumeLocal(e){const t=e.elevationAgnosticBoundingVolume,i=this.getNodeObbInRenderSRIndependentOfElevationOffset(e);if(i){const e=i.getCenter(Y);e[2]=0,g(t,e);let s=0;const n=K;i.getCorners(J);for(const t of J){t[2]=0;const e=o(n,t);s=Math.max(s,e)}t[3]=Math.sqrt(s)}else{const i=e.serviceMbsInRenderSR;if(w(i)){const e=n(Y,D(i));e[2]=0,g(t,e),t[3]=i[3]}}}isNodeVisible(e){const t=this.getServiceMbsInRenderSR(e);if(!this._isMBSinClippingArea(t))return!1;if(!this._useFrustumCulling)return!0;const i=this.getAndUpdateVisibilityObbInRenderSR(e);return i?i.isVisible(this._frustum):C(this._frustum,F(t))}isElevationAgnosticBoundingVolumeVisible(e,t){return!this._useFrustumCulling||(-1===t[3]||(e===B.Global?this._isConeVisibleInFrustum(t):this._isCylinderVisibleInFrustum(t)))}_isConeVisibleInFrustum(e){const t=this._frustumMbs,s=t,n=r(s),o=t[3],l=e,h=i(l,s),d=e[3];if(d>.9)return!0;if(n<=o)return!0;{const e=a(Z,l,h);if(c(e,s)<o)return!0}const u=h/n;if(h<=0){return-u<o}const m=Math.sqrt(1-u*u);if(m<d)return!0;const p=o/n;return m*Math.sqrt(1-p*p)-p*u<d}_isCylinderVisibleInFrustum(e){const t=this._frustumMbs,i=t,s=t[3],r=n(Z,i);r[2]=0;const o=e[3];return c(r,e)<=o+s}isGeometryVisible(e){if(!this._useFrustumCulling)return!0;const t=e.geometryObbInRenderSR;return t?.isVisible(this._frustum)??this.isNodeVisible(e)}_isMBSinClippingArea(e){return null==this._clippingArea||G(this._clippingArea,e)!==N.OUTSIDE}_screenSpaceDiameterMbs(e,t){const i=this.getServiceMbsInRenderSR(e),s=Math.sqrt(l(D(i),this._camPos)),n=s-i[3];return this._updateMinMaxDistance(s),n<0?.5*Number.MAX_VALUE:t/n*this._screenSizeFactor}calcCameraDistance(e){return this.calcCameraDistanceToCenter(e)-this.getServiceMbsInRenderSR(e)[3]}calcCameraDistanceToCenter(e){const t=this.getServiceMbsInRenderSR(e),i=h(D(t),this._camPos);return this._updateMinMaxDistance(i),i}calcAngleDependentLoD(e){const t=this.getServiceMbsInRenderSR(e),i=t[3],s=(Math.abs(t[0]*(t[0]-this._camPos[0])+t[1]*(t[1]-this._camPos[1])+t[2]*(t[2]-this._camPos[2]))/d(D(t))+i)/h(D(t),this._camPos);return Math.min(1,s)}hasLOD(e){return e.lodMetric!==A.None}_getDistancePlanarMode(e,t){const i=e[0]-t[0],s=e[1]-t[1],n=e[2]-t[2],r=i*i+s*s,o=t[3];if(r<=o*o)return Math.abs(n);const a=Math.sqrt(r)-o;return Math.sqrt(n*n+a*a)}_getDistanceGlobeMode(e,t){const s=d(D(t)),n=d(e)-s;a(this._tmp0,e,i(e,D(t))/u(e));const r=l(D(t),this._tmp0),o=t[3];if(r<=o*o)return Math.abs(n);{const r=a(this._tmp0,D(t),1/s),c=s,l=o*o/2/c,u=a(this._tmp1,r,c-l),_=e,v=m(this._tmp2,_,u),g=m(this._tmp2,v,a(this._tmp3,r,i(r,v))),f=p(this._tmp2,u,a(this._tmp2,g,o/d(g)));let S=h(_,f);if(n>=2e5){const e=m(this._tmp1,_,f);let t=i(e,r)/d(e);t<.08&&(t=1e-4),S/=t}return S}}_getDistance(e,t){return this._isGlobalMode?this._getDistanceGlobeMode(e,t):this._getDistancePlanarMode(e,t)}_updateMinMaxDistance(e){e>0?(this.minDistance=Math.min(this.minDistance,e),this.maxDistance=Math.max(this.maxDistance,e)):(this.minDistance=0,this.maxDistance=Math.max(this.maxDistance,-e))}getLodLevel(e){if(e.lodMetric===A.None)return 0;if(0===e.childCount)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){const t=this._progressiveLoadFactor*this._screenspaceErrorBias,i=this._screenspaceErrorBias;return this.evaluateLODmetric(e,t)?this.evaluateLODmetric(e,i)?2:1:0}return this.evaluateLODmetric(e,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(e,t){switch(e.lodMetric){case A.ScreenSpaceRelative:{const i=this.getServiceMbsInRenderSR(e),s=this._getDistance(this._camPos,i),n=2*s/this._screenSizeFactor,r=s+i[3];return this._updateMinMaxDistance(r),e.maxError*t<=n}case A.MaxScreenThreshold:{let i=this._screenSpaceDiameterMbs(e,e.serviceMbsInIndexSR[3]*t);return this._options.angleDependentLoD&&(i*=this.calcAngleDependentLoD(e)),i<e.maxError}case A.RemovedFeatureDiameter:return this._screenSpaceDiameterMbs(e,e.maxError)*t<10;case A.DistanceRangeFromDefaultCamera:return this.calcCameraDistance(e)>e.maxError*t}return!1}distToPOI(e){const t=this.getServiceMbsInRenderSR(e);return h(D(t),this._poi)-t[3]}distCameraToPOI(){return h(this._camPos,this._poi)}}const k=_(),H=P(),W=_(),Z=_(),X=new U,Y=_(),J=[_(),_(),_(),_(),_(),_(),_(),_()],K=_();export{z as default};
5
+ import{n as e,z as t,k as i,r as s,c as n,D as r,w as o,h as a,o as c,a as l,q as h,l as d,p as u,f as m,g as p}from"../../../../chunks/vec32.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{c as v,b as g}from"../../../../chunks/vec42.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as S}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as R}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingSphere as b}from"../../../../geometry/projection/projectBoundingSphere.js";import{getProjector as x}from"../../../../geometry/projection/projectors.js";import{create as M,fromMatrix as I,intersectsSphere as C,createPoints as P}from"../../../../geometry/support/frustum.js";import{isPlateCarree as D}from"../../../../geometry/support/spatialReferenceUtils.js";import{g as E,w as F}from"../../../../chunks/sphere.js";import{makeDehydratedPoint as O}from"../../../../layers/graphics/dehydratedPoint.js";import{ViewingMode as B}from"../../../ViewingMode.js";import{evaluateElevationAlignmentAtPoint as V}from"../graphics/elevationAlignmentUtils.js";import{ElevationContext as j}from"../graphics/ElevationContext.js";import{createContextWithoutExpressionSupport as L,extractExpressionInfo as A}from"../graphics/featureExpressionInfoUtils.js";import{LodMetric as y}from"./I3SNode.js";import{isValidMbs as w,intersectBoundingRectWithMbs as G,MbsIntersectResult as N}from"./I3SUtil.js";import{Obb as U,computeOffsetObb as z}from"../../support/orientedBoundingBox.js";const T=1e5;class q{constructor(e,t,i,s,n,r,o,a,c={}){this._indexSR=e,this._renderCoordsHelper=t,this._clippingArea=n,this._elevationProvider=r,this._viewingMode=o,this._options=c,this._frustum=M(),this._frustumMbs=f(),this._useFrustumCulling=!1,this._poi=_(),this._elevationContext=null,this.minDistance=1/0,this.maxDistance=0,this.maxLodLevel=2,this._tmpObb=new U,this._tmp1=_(),this._tmp2=_(),this._tmp3=_(),this._tmp0=_(),this._screenspaceErrorBias=c.screenspaceErrorBias||1,this._progressiveLoadFactor=c.progressiveLoadFactor||1,this.updateCamera(i,s);const l=this._renderCoordsHelper.spatialReference;this._renderSR=l,this._renderSRSphericalPCPF=R(l),this._isGlobalMode=l===this._renderSRSphericalPCPF,this.updateElevationInfo(a),this._tmpPoint=O(0,0,0,e),this._isECEFOBBInLocalMode=this._indexSR.isWGS84&&(l.isWebMercator||D(l)),this._indexSREllipsoidRadius=S(this._indexSR).radius,this._indexSRSphericalPCPF=R(e),this._projectorIndexSRToIndexSRSphericalPCPF=x(this._indexSR,this._indexSRSphericalPCPF)}updateElevationInfo(e){null!=e?(this._elevationContext=j.fromElevationInfo(e),this._elevationContext.updateFeatureExpressionInfoContext(L(A(e,!1)))):this._elevationContext=null}updateCamera(n,r){if(this._useFrustumCulling=r,r){I(n.viewMatrix,n.projectionMatrix,this._frustum,H);{const r=n.eye,o=k;e(o,n.viewForward);const a=W;t(a,H[4],r);const c=.5*i(a,a)/i(o,a),l=this._frustumMbs;s(l,r,o,c);const h=1+c;l[3]=h}}this._screenSizeFactor=1/(n.perScreenPixelRatio/2),this._camPos=n.eye,this.minDistance=1/0,this.maxDistance=0}setPointOfInterest(e){this._poi=e}updateScreenSpaceErrorBias(e){const t=this._screenspaceErrorBias;return this._screenspaceErrorBias=e,t}updateClippingArea(e){this._clippingArea=e}expandElevationRange(e,t,i){if(null==this._elevationContext)return;const s=e.serviceMbsInIndexSR;if(!s)return;const n="relative-to-scene"===this._elevationContext.mode?"scene":"ground";if(this._elevationProvider.getSphereElevationBounds){const e=this._elevationProvider.getSphereElevationBounds(s,this._indexSR,n);return void(e&&i.expandElevationRange(e))}const r=s[0],o=s[1],a=s[2],c=this._elevationProvider.getElevation(r,o,a,this._indexSR,n);c&&i.expandElevationRangeValues(c,c);const l=t?null:this._elevationProvider.getRootElevationBounds?.();l&&i.expandElevationRange(l)}getServiceMbsInRenderSR(e){const t=e.serviceMbsInRenderSR;if(w(t))return t;e.serviceMbsInIndexSR&&v(t,e.serviceMbsInIndexSR);const i=e.elevationRangeMin;if(this._elevationContext&&Number.isFinite(i)){let s=0,n=0;const r=e.elevationRangeMax;switch(this._elevationContext.mode){case"relative-to-ground":s=this._elevationContext.geometryZWithOffset(t[2],this._renderCoordsHelper)+i-t[2],n=r-i;break;case"on-the-ground":s=i-t[2],n=r-i}t[2]+=s+.5*n,t[3]+=.5*n}else this._elevationContext&&t[3]<T&&(this._tmpPoint.x=t[0],this._tmpPoint.y=t[1],this._tmpPoint.z=t[2],t[2]=V(this._tmpPoint,this._elevationProvider,this._elevationContext,this._renderCoordsHelper));return b(t,this._indexSR,t,this._renderSR),t}getAndUpdateVisibilityObbInRenderSR(e){{const t=e.visibilityObbInRenderSR;if(t)return t}const t=.01*this._indexSREllipsoidRadius,{serviceMbsInIndexSR:i,serviceObbInIndexSR:s}=e;if(null==s||!i||!s.isValid||this._isECEFOBBInLocalMode&&(s.halfSizeX>t||s.halfSizeY>t||s.halfSizeZ>t))return null;{let t=e.serviceObbInRenderSR;if(null==t)t=new U,e.serviceObbInRenderSR=t;else if(t.isValid)return t;const n=i[3];let r=0,o=0;const a=s.centerZ,c=this._renderCoordsHelper,l=this._elevationContext;if(l&&e.elevationRangeValid){const t=e.elevationRangeMin,i=e.elevationRangeMax;switch(l.mode){case"relative-to-ground":r=l.geometryZWithOffset(a,c)+t-a,o=i-t;break;case"on-the-ground":r=t-a,o=i-t}}else if(l&&n<T){const e=this._tmpPoint;e.x=s.centerX,e.y=s.centerY,e.z=a,r=V(e,this._elevationProvider,l,c)-a}const h=o>0,d=h?this._tmpObb:t;return s.transform(d,this._indexSR,this._renderSR,r,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),h&&z(d,0,o,this._viewingMode,t),t}}getNodeObbInRenderSRIndependentOfElevationOffset(e){{const t=e.visibilityObbInRenderSR??e.serviceObbInRenderSR??null;if(t?.isValid)return t}const t=e.serviceObbInIndexSR;return t?(t.transform(X,this._indexSR,this._renderSR,void 0,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),X):null}ensureElevationAgnosticBoundingVolume(e,t){-1===e.elevationAgnosticBoundingVolume[3]&&(t===B.Global?this._updateElevationAgnosticBoundingVolumeGlobal(e):this._updateElevationAgnosticBoundingVolumeLocal(e))}_updateElevationAgnosticBoundingVolumeGlobal(t){const s=this.getNodeObbInRenderSRIndependentOfElevationOffset(t),o=t.elevationAgnosticBoundingVolume,a=Y;let c=-1;if(s){s.getCenter(a),e(a,a),s.getCorners(J);for(const t of J){e(t,t);const s=i(t,a);if(s<=0)return void(o[3]=-1);const n=Math.sqrt(1-s*s);c=Math.max(c,n)}}else{const i=t.serviceMbsInRenderSR;if(!w(i))return void(o[3]=-1);{const t=n(Y,E(i)),s=i[3],o=r(t);c=0===s?0:o<s?-1:s/o,e(t,t)}}g(o,a);const l=.001;o[3]=c+l}_updateElevationAgnosticBoundingVolumeLocal(e){const t=e.elevationAgnosticBoundingVolume,i=this.getNodeObbInRenderSRIndependentOfElevationOffset(e);if(i){const e=i.getCenter(Y);e[2]=0,g(t,e);let s=0;const n=K;i.getCorners(J);for(const t of J){t[2]=0;const e=o(n,t);s=Math.max(s,e)}t[3]=Math.sqrt(s)}else{const i=e.serviceMbsInRenderSR;if(w(i)){const e=n(Y,E(i));e[2]=0,g(t,e),t[3]=i[3]}}}isNodeVisible(e){const t=this.getServiceMbsInRenderSR(e);if(!this._isMBSinClippingArea(t))return!1;if(!this._useFrustumCulling)return!0;const i=this.getAndUpdateVisibilityObbInRenderSR(e);return i?i.isVisible(this._frustum):C(this._frustum,F(t))}isElevationAgnosticBoundingVolumeVisible(e,t){return!this._useFrustumCulling||(-1===t[3]||(e===B.Global?this._isConeVisibleInFrustum(t):this._isCylinderVisibleInFrustum(t)))}_isConeVisibleInFrustum(e){const t=this._frustumMbs,s=t,n=r(s),o=t[3],l=e,h=i(l,s),d=e[3];if(d>.9)return!0;if(n<=o)return!0;{const e=a(Z,l,h);if(c(e,s)<o)return!0}const u=h/n;if(h<=0){return-u<o}const m=Math.sqrt(1-u*u);if(m<d)return!0;const p=o/n;return m*Math.sqrt(1-p*p)-p*u<d}_isCylinderVisibleInFrustum(e){const t=this._frustumMbs,i=t,s=t[3],r=n(Z,i);r[2]=0;const o=e[3];return c(r,e)<=o+s}isGeometryVisible(e){if(!this._useFrustumCulling)return!0;const t=e.geometryObbInRenderSR;return t?.isVisible(this._frustum)??this.isNodeVisible(e)}_isMBSinClippingArea(e){return null==this._clippingArea||G(this._clippingArea,e)!==N.OUTSIDE}_screenSpaceDiameterMbs(e,t){const i=this.getServiceMbsInRenderSR(e),s=Math.sqrt(l(E(i),this._camPos)),n=s-i[3];return this._updateMinMaxDistance(s),n<0?.5*Number.MAX_VALUE:t/n*this._screenSizeFactor}calcCameraDistance(e){return this.calcCameraDistanceToCenter(e)-this.getServiceMbsInRenderSR(e)[3]}calcCameraDistanceToCenter(e){const t=this.getServiceMbsInRenderSR(e),i=h(E(t),this._camPos);return this._updateMinMaxDistance(i),i}calcAngleDependentLoD(e){const t=this.getServiceMbsInRenderSR(e),i=t[3],s=(Math.abs(t[0]*(t[0]-this._camPos[0])+t[1]*(t[1]-this._camPos[1])+t[2]*(t[2]-this._camPos[2]))/d(E(t))+i)/h(E(t),this._camPos);return Math.min(1,s)}hasLOD(e){return e.lodMetric!==y.None}_getDistancePlanarMode(e,t){const i=e[0]-t[0],s=e[1]-t[1],n=e[2]-t[2],r=i*i+s*s,o=t[3];if(r<=o*o)return Math.abs(n);const a=Math.sqrt(r)-o;return Math.sqrt(n*n+a*a)}_getDistanceGlobeMode(e,t){const s=d(E(t)),n=d(e)-s;a(this._tmp0,e,i(e,E(t))/u(e));const r=l(E(t),this._tmp0),o=t[3];if(r<=o*o)return Math.abs(n);{const r=a(this._tmp0,E(t),1/s),c=s,l=o*o/2/c,u=a(this._tmp1,r,c-l),_=e,v=m(this._tmp2,_,u),g=m(this._tmp2,v,a(this._tmp3,r,i(r,v))),f=p(this._tmp2,u,a(this._tmp2,g,o/d(g)));let S=h(_,f);if(n>=2e5){const e=m(this._tmp1,_,f);let t=i(e,r)/d(e);t<.08&&(t=1e-4),S/=t}return S}}_getDistance(e,t){return this._isGlobalMode?this._getDistanceGlobeMode(e,t):this._getDistancePlanarMode(e,t)}_updateMinMaxDistance(e){e>0?(this.minDistance=Math.min(this.minDistance,e),this.maxDistance=Math.max(this.maxDistance,e)):(this.minDistance=0,this.maxDistance=Math.max(this.maxDistance,-e))}getLodLevel(e){if(e.lodMetric===y.None)return 0;if(0===e.childCount)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){const t=this._progressiveLoadFactor*this._screenspaceErrorBias,i=this._screenspaceErrorBias;return this.evaluateLODmetric(e,t)?this.evaluateLODmetric(e,i)?2:1:0}return this.evaluateLODmetric(e,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(e,t){switch(e.lodMetric){case y.ScreenSpaceRelative:{const i=this.getServiceMbsInRenderSR(e),s=this._getDistance(this._camPos,i),n=2*s/this._screenSizeFactor,r=s+i[3];return this._updateMinMaxDistance(r),e.maxError*t<=n}case y.MaxScreenThreshold:{let i=this._screenSpaceDiameterMbs(e,e.serviceMbsInIndexSR[3]*t);return this._options.angleDependentLoD&&(i*=this.calcAngleDependentLoD(e)),i<e.maxError}case y.RemovedFeatureDiameter:return this._screenSpaceDiameterMbs(e,e.maxError)*t<10;case y.DistanceRangeFromDefaultCamera:return this.calcCameraDistance(e)>e.maxError*t}return!1}distToPOI(e){const t=this.getServiceMbsInRenderSR(e);return h(E(t),this._poi)-t[3]}distCameraToPOI(){return h(this._camPos,this._poi)}}const k=_(),H=P(),W=_(),Z=_(),X=new U,Y=_(),J=[_(),_(),_(),_(),_(),_(),_(),_()],K=_();export{q as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{j as e}from"../../../../chunks/vec32.js";function t(e,t,g){for(let n=0;n<t.length;n++)r[n]=!1,o[n]=null;for(let r=0;r<e.length;r++)n[r]=!1,l[r]=null;for(let n=0;n<t.length;n++){const o=h(t[n],e,g);o>=0&&(r[n]=!0,null!=l[o]?l[o].push(t[n]):l[o]=[t[n]])}for(let l=0;l<e.length;l++){const r=h(e[l],t,g);r>=0&&(n[l]=!0,null!=o[r]?o[r].push(e[l]):o[r]=[e[l]])}const u=[];for(let r=0;r<e.length;r++)null!=l[r]||n[r]||u.push({load:[],remove:[e[r]]});for(let n=0;n<t.length;n++)null!=o[n]||r[n]||u.push({load:[t[n]],remove:[]});for(let n=0;n<t.length;n++)null!=o[n]&&(o[n].length>1||o[n][0]!==t[n])&&u.push({load:[t[n]],remove:o[n]});for(let n=0;n<e.length;n++)null!=l[n]&&(l[n].length>1||l[n][0]!==e[n])&&u.push({load:l[n],remove:[e[n]]});return u}const n=[!1],l=[null],r=[!1],o=[null];function h(e,t,n){let l=e;for(;l>0;){const e=t.indexOf(l);if(e>=0)return e;l=n.getParentId(l)}return t.indexOf(l)}function g(t,n,l){return t.sort(((t,r)=>{if(0===t.load.length&&0===r.load.length)return 0;if(0===t.load.length)return-1;if(0===r.load.length)return 1;if(0===t.remove.length&&0===r.remove.length){const o=l.getRenderObb(t.load[0]).center,h=l.getRenderObb(r.load[0]).center;return e(o,n)-e(h,n)}if(0===t.remove.length)return-1;if(0===r.remove.length)return 1;if(1===t.load.length&&1===r.load.length){const o=l.getRenderObb(t.load[0]).center,h=l.getRenderObb(r.load[0]).center;return e(o,n)-e(h,n)}if(1===t.load.length)return-1;if(1===r.load.length)return 1;{const o=l.getRenderObb(t.remove[0]).center,h=l.getRenderObb(r.remove[0]).center;return e(o,n)-e(h,n)}}))}function u(e,t,n){for(let l=0;l<e.length;++l){const r=e[l];r.load.length>t&&1===r.remove.length&&d(e,r,n)}}function d(e,t,n){const l=[t.remove[0]],r=[];for(;1===l.length;){const e=l.pop();r.length=0;for(let o=0;o<t.load.length;o++){let h=t.load[o],g=n.getParentId(h);for(;g!==e;)h=g,g=n.getParentId(h);let u=l.indexOf(h);u<0&&(u=l.length,l.push(h),r.push([])),r[u].push(t.load[o])}}t.load=l;for(let o=0;o<l.length;o++)r[o].length>1?e.push({remove:[l[o]],load:r[o]}):l[o]=r[o][0]}export{t as nodeDiff,g as sortFrontToBack,u as splitWorkEntries,d as splitWorkEntry};
5
+ import{k as e}from"../../../../chunks/vec32.js";function t(e,t,g){for(let n=0;n<t.length;n++)r[n]=!1,o[n]=null;for(let r=0;r<e.length;r++)n[r]=!1,l[r]=null;for(let n=0;n<t.length;n++){const o=h(t[n],e,g);o>=0&&(r[n]=!0,null!=l[o]?l[o].push(t[n]):l[o]=[t[n]])}for(let l=0;l<e.length;l++){const r=h(e[l],t,g);r>=0&&(n[l]=!0,null!=o[r]?o[r].push(e[l]):o[r]=[e[l]])}const u=[];for(let r=0;r<e.length;r++)null!=l[r]||n[r]||u.push({load:[],remove:[e[r]]});for(let n=0;n<t.length;n++)null!=o[n]||r[n]||u.push({load:[t[n]],remove:[]});for(let n=0;n<t.length;n++)null!=o[n]&&(o[n].length>1||o[n][0]!==t[n])&&u.push({load:[t[n]],remove:o[n]});for(let n=0;n<e.length;n++)null!=l[n]&&(l[n].length>1||l[n][0]!==e[n])&&u.push({load:l[n],remove:[e[n]]});return u}const n=[!1],l=[null],r=[!1],o=[null];function h(e,t,n){let l=e;for(;l>0;){const e=t.indexOf(l);if(e>=0)return e;l=n.getParentId(l)}return t.indexOf(l)}function g(t,n,l){return t.sort(((t,r)=>{if(0===t.load.length&&0===r.load.length)return 0;if(0===t.load.length)return-1;if(0===r.load.length)return 1;if(0===t.remove.length&&0===r.remove.length){const o=l.getRenderObb(t.load[0]).center,h=l.getRenderObb(r.load[0]).center;return e(o,n)-e(h,n)}if(0===t.remove.length)return-1;if(0===r.remove.length)return 1;if(1===t.load.length&&1===r.load.length){const o=l.getRenderObb(t.load[0]).center,h=l.getRenderObb(r.load[0]).center;return e(o,n)-e(h,n)}if(1===t.load.length)return-1;if(1===r.load.length)return 1;{const o=l.getRenderObb(t.remove[0]).center,h=l.getRenderObb(r.remove[0]).center;return e(o,n)-e(h,n)}}))}function u(e,t,n){for(let l=0;l<e.length;++l){const r=e[l];r.load.length>t&&1===r.remove.length&&d(e,r,n)}}function d(e,t,n){const l=[t.remove[0]],r=[];for(;1===l.length;){const e=l.pop();r.length=0;for(let o=0;o<t.load.length;o++){let h=t.load[o],g=n.getParentId(h);for(;g!==e;)h=g,g=n.getParentId(h);let u=l.indexOf(h);u<0&&(u=l.length,l.push(h),r.push([])),r[u].push(t.load[o])}}t.load=l;for(let o=0;o<l.length;o++)r[o].length>1?e.push({remove:[l[o]],load:r[o]}):l[o]=r[o][0]}export{t as nodeDiff,g as sortFrontToBack,u as splitWorkEntries,d as splitWorkEntry};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import{disposeMaybe as t}from"../../../../core/maybe.js";import s from"../../../../core/PooledArray.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{f as n,l as o,h as a,E as l,j as h,o as c}from"../../../../chunks/vec32.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as u}from"../../../../chunks/vec42.js";import{create as p,offset as m,contains as g,containsPoint as _,set as f,positiveInfinity as P,equals as b}from"../../../../geometry/support/aaBoundingBox.js";import{create as S}from"../../../../geometry/support/plane.js";import{fromPoints as x}from"../../../../geometry/support/ray.js";import{PclTarget as z}from"./Intersector.js";import{PointHighlights as R}from"./PointHighlights.js";import{ShaderOutput as w}from"../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncPrepareRenderPlugin as A}from"../../webgl-engine/effects/RenderPlugin.js";import{Default3D as j}from"../../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{newIntersectorResult as y}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as q,StoreResults as E}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{RenderSlot as O}from"../../webgl-engine/lib/RenderSlot.js";import{VertexArrayObject as I}from"../../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as L}from"../../webgl-engine/lib/VertexAttribute.js";import{P as v,a as F,g as N}from"../../../../chunks/PointRenderer.glsl.js";import{PointRendererTechnique as C}from"../../webgl-engine/shaders/PointRendererTechnique.js";import{PointRendererTechniqueConfiguration as T}from"../../webgl-engine/shaders/PointRendererTechniqueConfiguration.js";import{BufferObject as H}from"../../../webgl/BufferObject.js";import{DataType as D,PrimitiveType as M,Usage as B}from"../../../webgl/enums.js";import{VertexElementDescriptor as U}from"../../../webgl/VertexElementDescriptor.js";const V={positions:[new U(L.POSITION,3,D.FLOAT,0,12)],colors:[new U(L.COLOR,3,D.UNSIGNED_BYTE,0,3,!0)]};let W=class extends A{constructor(e){super(e),this.type=q.PCL,this.isGround=!1,this._passParameters=new v,this._highlights=new R({forEachNode:e=>this.forEachNode(e),addHighlight:(e,t,s)=>this._addHighlight(e,t,s),removeHighlight:(e,t)=>this._removeHighlight(e,t)}),this.produces=new Map([[O.OPAQUE_MATERIAL,e=>e!==w.LinearDepth&&(e!==w.Highlight||!this._highlights.empty)],[O.OPAQUE_NO_SSAO_DEPTH,e=>e===w.LinearDepth]]),this.layerUid="",this._slicePlaneEnabled=!1,this._techniqueConfig=new T,this._nodes=new s}initializeRenderContext(e){this._context=e,e.requestRender()}uninitializeRenderContext(){}intersect(e,t,s,i){const r=d(),f=d(),P=d(),b=d(),R=S(),w=e.camera.perScreenPixelRatio/2,A=e.camera.near;n(f,i,s);const j=1/o(f);a(f,f,j),l(P,f),u(R,f[0],f[1],f[2],-h(f,s));const q=new $,O=new $,I=new Array,L=p(),v=p(this._passParameters.clipBox);m(v,-s[0],-s[1],-s[2],v),this._nodes.forAll((o=>{const a=o.splatSize*this._passParameters.scaleFactor;let l=o.obb.minimumDistancePlane(R),d=o.obb.maximumDistancePlane(R);l-=Y(a,l+A,this._passParameters,w,o.isLeaf),d-=Y(a,d+A,this._passParameters,w,o.isLeaf);const u=d<0,p=null!=q.dist&&null!=O.dist&&q.dist<l*j&&O.dist>d*j;if(u||p)return;const S=Q(a,d+A,this._passParameters,w,o.isLeaf);if(!o.obb.intersectRay(s,f,S))return;const x=S*S;o.obb.toAaBoundingBox(L),m(L,-s[0],-s[1],-s[2],L);const z=!g(v,L);n(b,o.origin,s);const y=o.coordinates.length/3;for(let n=0;n<y;n++){if(r[0]=b[0]+o.coordinates[3*n],r[1]=b[1]+o.coordinates[3*n+1],r[2]=b[2]+o.coordinates[3*n+2],z&&!_(v,r))continue;const l=h(r,f),d=c(r)-l*l;if(d>x)continue;let u=l+A;const p=Y(a,u,this._passParameters,w,o.isLeaf);if(l-p<0)continue;u-=p;const m=Q(a,u,this._passParameters,w,o.isLeaf);if(d>m*m)continue;const g=(l-p)*j,S=e=>(e.point=J(o,n,e.point),e.dist=g,e.normal=P,e.node=o,e.pointId=n,e.layerUid=this.layerUid,e);if((null==q.dist||g<q.dist)&&(null==t||t(s,i,g))&&S(q),e.options.store!==E.MIN&&(null==O.dist||g>O.dist)&&(null==t||t(s,i,g))&&S(O),e.options.store===E.ALL&&(null==t||t(s,i,g))){const e=new $;I.push(S(e))}}}));const F=e=>{const{layerUid:t,node:s,pointId:i}=e;return new z(e.point,t,i,(()=>this.createGraphic(s,i,e.point)))},N=(e,t)=>{const s=F(t);e.set(this.type,s,t.dist,t.normal)};if(ee(q)){const t=e.results.min;(null==t.dist||q.dist<t.dist)&&N(t,q)}if(ee(O)&&e.options.store!==E.MIN){const t=e.results.max;(null==t.dist||O.dist>t.dist)&&N(t,O)}if(e.options.store===E.ALL){const t=x(s,i);for(const s of I){const i=y(t);N(i,s),e.results.all.push(i)}}}prepareTechnique(e){return 0===this._nodes.length||e.output!==w.Color&&(e.output!==w.LinearDepth||e.bindParameters.slot!==O.OPAQUE_NO_SSAO_DEPTH)&&e.output!==w.Highlight?null:(this._nodes.forAll((t=>{null==t.vao&&this._initNode(e,t)})),this._techniqueConfig.drawScreenSize=this._passParameters.drawScreenSpace,this._techniqueConfig.useFixedSizes=this._passParameters.useFixedSizes,this._techniqueConfig.hasSlicePlane=this._slicePlaneEnabled,this._techniqueConfig.hasOccludees=e.bindParameters.hasOccludees,this._techniqueConfig.clippingEnabled=this._clippingEnabled,this._techniqueConfig.output=e.output,this._context.techniqueRepository.releaseAndAcquire(C,this._techniqueConfig,this._technique))}renderNode(e,t){const s=e.rctx,i=s.bindTechnique(t,e.bindParameters,this._passParameters),r=e.output===w.Highlight;this._nodes.forAll((t=>{0===t.coordinates.length||r&&!t.highlights||(i.bindDraw(t,e.bindParameters,this._passParameters),s.bindVAO(t.vao),r?this._renderHighlightFragments(s,t):s.drawArrays(M.POINTS,0,t.coordinates.length/3))}))}_renderHighlightFragments(e,t){const s=t.highlights;if(null==s)return;let i=s[0].component,r=i+1;for(let o=1;o<s.length;o++){const t=s[o].component;if(t!==r){const s=r-i;s>0&&e.drawArrays(M.POINTS,i,s),i=t}r=t+1}const n=r-i;n>0&&e.drawArrays(M.POINTS,i,n)}set useFixedSizes(e){this._passParameters.useFixedSizes!==e&&(this._passParameters.useFixedSizes=e,this._requestRender())}get useFixedSizes(){return this._passParameters.useFixedSizes}set scaleFactor(e){this._passParameters.scaleFactor!==e&&(this._passParameters.scaleFactor=e,this._requestRender())}get scaleFactor(){return this._passParameters.scaleFactor}set minSizePx(e){this._passParameters.minSizePx!==e&&(this._passParameters.minSizePx=e,this._requestRender())}get minSizePx(){return this._passParameters.minSizePx}set useRealWorldSymbolSizes(e){this._passParameters.useRealWorldSymbolSizes!==e&&(this._passParameters.useRealWorldSymbolSizes=e,this._requestRender())}get useRealWorldSymbolSizes(){return this._passParameters.useRealWorldSymbolSizes}set size(e){this._passParameters.size!==e&&(this._passParameters.size=e,this._requestRender())}get size(){return this._passParameters.size}set sizePx(e){this._passParameters.sizePx!==e&&(this._passParameters.sizePx=e,this._requestRender())}get sizePx(){return this._passParameters.sizePx}set clippingBox(e){f(this._passParameters.clipBox,e||P)}get _clippingEnabled(){return!b(this._passParameters.clipBox,P,((e,t)=>e===t))}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this._requestRender())}addNode(e){this._nodes.push(e),this._highlights.nodeAdded(e),this._requestRender()}removeNode(e){let s=null;return this._nodes.filterInPlace((i=>i.id!==e||(s=i,i.vao=t(i.vao),this._highlights.nodeRemoved(i),!1))),this._requestRender(),s}forEachNode(e){this._nodes.forAll(e)}removeAll(){this._nodes.forAll((e=>e.vao=t(e.vao))),this._highlights.removeAll(),this._nodes.clear(),this._requestRender()}highlight(e){return this._highlights.add(e)}_addHighlight(e,t,s){e.highlights=X(e.highlights,t,s),this._requestRender()}_removeHighlight(e,t){e.highlights=Z(e.highlights,t),this._requestRender()}_initNode(e,t){const s=e.rctx;t.vao=new I(s,j,V,{positions:H.createVertex(s,B.STATIC_DRAW,t.coordinates),colors:H.createVertex(s,B.STATIC_DRAW,t.rgb)})}_requestRender(){this._context&&this._context.requestRender()}};e([i({constructOnly:!0})],W.prototype,"createGraphic",void 0),W=e([r("esri.views.3d.layers.i3s.PointRenderer")],W);class G extends F{constructor(e,t,s,i,r,n,o,a,l=null,h=null){super(s,r,t),this.id=e,this.obb=i,this.coordinates=n,this.rgb=o,this.attributes=a,this.pointIdFilterMap=l,this.highlights=h}}function k(e){return e.hasOwnProperty("splatSize")}function Q(e,t,s,i,r){if(s.drawScreenSpace)return s.fixedSize*t*i;const n=N(r)*t*i;return s.useFixedSizes?Math.min(s.fixedSize/2,n):s.screenMinSize>0?Math.min(Math.max(s.screenMinSize*t*i,e/2),n):Math.min(e/2,n)}function Y(e,t,s,i,r){return s.drawScreenSpace?0:Q(e,t,s,i,r)}function J(e,t,s){return null==s&&(s=d()),s[0]=e.origin[0]+e.coordinates[3*t],s[1]=e.origin[1]+e.coordinates[3*t+1],s[2]=e.origin[2]+e.coordinates[3*t+2],s}function K(e){return null!=e.component?e.component:-1}function X(e,t,s){null==e&&(e=[]);const i={component:t,id:s};e.push(i);const r=K(i);let n=e.length-1;for(;n>0&&r<K(e[n-1]);)[e[n-1],e[n]]=[e[n],e[n-1]],--n;return e}function Z(e,t){if(null==e)return e;const s=e.filter((e=>e.id!==t));return 0===s.length?null:s}class ${constructor(){this.node=null,this.pointId=null,this.point=null,this.dist=null,this.normal=null,this.layerUid=""}}function ee(e){return null!=e.dist&&null!=e.point&&null!=e.pointId&&null!=e.node}export{W as PointRenderer,G as PointRendererNode,k as isPointRendererNode};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import{disposeMaybe as t}from"../../../../core/maybe.js";import s from"../../../../core/PooledArray.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{f as n,l as o,h as a,F as l,k as h,p as c}from"../../../../chunks/vec32.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as u}from"../../../../chunks/vec42.js";import{create as p,offset as m,contains as g,containsPoint as _,set as f,positiveInfinity as P,equals as b}from"../../../../geometry/support/aaBoundingBox.js";import{create as S}from"../../../../geometry/support/plane.js";import{fromPoints as x}from"../../../../geometry/support/ray.js";import{PclTarget as z}from"./Intersector.js";import{PointHighlights as R}from"./PointHighlights.js";import{ShaderOutput as w}from"../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncPrepareRenderPlugin as A}from"../../webgl-engine/effects/RenderPlugin.js";import{Default3D as j}from"../../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{newIntersectorResult as y}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as q,StoreResults as O}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{RenderSlot as E}from"../../webgl-engine/lib/RenderSlot.js";import{VertexArrayObject as I}from"../../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as L}from"../../webgl-engine/lib/VertexAttribute.js";import{P as v,a as F,g as N}from"../../../../chunks/PointRenderer.glsl.js";import{PointRendererTechnique as C}from"../../webgl-engine/shaders/PointRendererTechnique.js";import{PointRendererTechniqueConfiguration as T}from"../../webgl-engine/shaders/PointRendererTechniqueConfiguration.js";import{BufferObject as H}from"../../../webgl/BufferObject.js";import{DataType as D,PrimitiveType as M,Usage as B}from"../../../webgl/enums.js";import{VertexElementDescriptor as U}from"../../../webgl/VertexElementDescriptor.js";const V={positions:[new U(L.POSITION,3,D.FLOAT,0,12)],colors:[new U(L.COLOR,3,D.UNSIGNED_BYTE,0,3,!0)]};let W=class extends A{constructor(e){super(e),this.type=q.PCL,this.isGround=!1,this._passParameters=new v,this._highlights=new R({forEachNode:e=>this.forEachNode(e),addHighlight:(e,t,s)=>this._addHighlight(e,t,s),removeHighlight:(e,t)=>this._removeHighlight(e,t)}),this.produces=new Map([[E.OPAQUE_MATERIAL,e=>e!==w.LinearDepth&&(e!==w.Highlight||!this._highlights.empty)],[E.OPAQUE_NO_SSAO_DEPTH,e=>e===w.LinearDepth]]),this.layerUid="",this._slicePlaneEnabled=!1,this._techniqueConfig=new T,this._nodes=new s}initializeRenderContext(e){this._context=e,e.requestRender()}uninitializeRenderContext(){}intersect(e,t,s,i){const r=d(),f=d(),P=d(),b=d(),R=S(),w=e.camera.perScreenPixelRatio/2,A=e.camera.near;n(f,i,s);const j=1/o(f);a(f,f,j),l(P,f),u(R,f[0],f[1],f[2],-h(f,s));const q=new $,E=new $,I=new Array,L=p(),v=p(this._passParameters.clipBox);m(v,-s[0],-s[1],-s[2],v),this._nodes.forAll((o=>{const a=o.splatSize*this._passParameters.scaleFactor;let l=o.obb.minimumDistancePlane(R),d=o.obb.maximumDistancePlane(R);l-=Y(a,l+A,this._passParameters,w,o.isLeaf),d-=Y(a,d+A,this._passParameters,w,o.isLeaf);const u=d<0,p=null!=q.dist&&null!=E.dist&&q.dist<l*j&&E.dist>d*j;if(u||p)return;const S=Q(a,d+A,this._passParameters,w,o.isLeaf);if(!o.obb.intersectRay(s,f,S))return;const x=S*S;o.obb.toAaBoundingBox(L),m(L,-s[0],-s[1],-s[2],L);const z=!g(v,L);n(b,o.origin,s);const y=o.coordinates.length/3;for(let n=0;n<y;n++){if(r[0]=b[0]+o.coordinates[3*n],r[1]=b[1]+o.coordinates[3*n+1],r[2]=b[2]+o.coordinates[3*n+2],z&&!_(v,r))continue;const l=h(r,f),d=c(r)-l*l;if(d>x)continue;let u=l+A;const p=Y(a,u,this._passParameters,w,o.isLeaf);if(l-p<0)continue;u-=p;const m=Q(a,u,this._passParameters,w,o.isLeaf);if(d>m*m)continue;const g=(l-p)*j,S=e=>(e.point=J(o,n,e.point),e.dist=g,e.normal=P,e.node=o,e.pointId=n,e.layerUid=this.layerUid,e);if((null==q.dist||g<q.dist)&&(null==t||t(s,i,g))&&S(q),e.options.store!==O.MIN&&(null==E.dist||g>E.dist)&&(null==t||t(s,i,g))&&S(E),e.options.store===O.ALL&&(null==t||t(s,i,g))){const e=new $;I.push(S(e))}}}));const F=e=>{const{layerUid:t,node:s,pointId:i}=e;return new z(e.point,t,i,(()=>this.createGraphic(s,i,e.point)))},N=(e,t)=>{const s=F(t);e.set(this.type,s,t.dist,t.normal)};if(ee(q)){const t=e.results.min;(null==t.dist||q.dist<t.dist)&&N(t,q)}if(ee(E)&&e.options.store!==O.MIN){const t=e.results.max;(null==t.dist||E.dist>t.dist)&&N(t,E)}if(e.options.store===O.ALL){const t=x(s,i);for(const s of I){const i=y(t);N(i,s),e.results.all.push(i)}}}prepareTechnique(e){return 0===this._nodes.length||e.output!==w.Color&&(e.output!==w.LinearDepth||e.bindParameters.slot!==E.OPAQUE_NO_SSAO_DEPTH)&&e.output!==w.Highlight?null:(this._nodes.forAll((t=>{null==t.vao&&this._initNode(e,t)})),this._techniqueConfig.drawScreenSize=this._passParameters.drawScreenSpace,this._techniqueConfig.useFixedSizes=this._passParameters.useFixedSizes,this._techniqueConfig.hasSlicePlane=this._slicePlaneEnabled,this._techniqueConfig.hasOccludees=e.bindParameters.hasOccludees,this._techniqueConfig.clippingEnabled=this._clippingEnabled,this._techniqueConfig.output=e.output,this._context.techniqueRepository.releaseAndAcquire(C,this._techniqueConfig,this._technique))}renderNode(e,t){const s=e.rctx,i=s.bindTechnique(t,e.bindParameters,this._passParameters),r=e.output===w.Highlight;this._nodes.forAll((t=>{0===t.coordinates.length||r&&!t.highlights||(i.bindDraw(t,e.bindParameters,this._passParameters),s.bindVAO(t.vao),r?this._renderHighlightFragments(s,t):s.drawArrays(M.POINTS,0,t.coordinates.length/3))}))}_renderHighlightFragments(e,t){const s=t.highlights;if(null==s)return;let i=s[0].component,r=i+1;for(let o=1;o<s.length;o++){const t=s[o].component;if(t!==r){const s=r-i;s>0&&e.drawArrays(M.POINTS,i,s),i=t}r=t+1}const n=r-i;n>0&&e.drawArrays(M.POINTS,i,n)}set useFixedSizes(e){this._passParameters.useFixedSizes!==e&&(this._passParameters.useFixedSizes=e,this._requestRender())}get useFixedSizes(){return this._passParameters.useFixedSizes}set scaleFactor(e){this._passParameters.scaleFactor!==e&&(this._passParameters.scaleFactor=e,this._requestRender())}get scaleFactor(){return this._passParameters.scaleFactor}set minSizePx(e){this._passParameters.minSizePx!==e&&(this._passParameters.minSizePx=e,this._requestRender())}get minSizePx(){return this._passParameters.minSizePx}set useRealWorldSymbolSizes(e){this._passParameters.useRealWorldSymbolSizes!==e&&(this._passParameters.useRealWorldSymbolSizes=e,this._requestRender())}get useRealWorldSymbolSizes(){return this._passParameters.useRealWorldSymbolSizes}set size(e){this._passParameters.size!==e&&(this._passParameters.size=e,this._requestRender())}get size(){return this._passParameters.size}set sizePx(e){this._passParameters.sizePx!==e&&(this._passParameters.sizePx=e,this._requestRender())}get sizePx(){return this._passParameters.sizePx}set clippingBox(e){f(this._passParameters.clipBox,e||P)}get _clippingEnabled(){return!b(this._passParameters.clipBox,P,((e,t)=>e===t))}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this._requestRender())}addNode(e){this._nodes.push(e),this._highlights.nodeAdded(e),this._requestRender()}removeNode(e){let s=null;return this._nodes.filterInPlace((i=>i.id!==e||(s=i,i.vao=t(i.vao),this._highlights.nodeRemoved(i),!1))),this._requestRender(),s}forEachNode(e){this._nodes.forAll(e)}removeAll(){this._nodes.forAll((e=>e.vao=t(e.vao))),this._highlights.removeAll(),this._nodes.clear(),this._requestRender()}highlight(e){return this._highlights.add(e)}_addHighlight(e,t,s){e.highlights=X(e.highlights,t,s),this._requestRender()}_removeHighlight(e,t){e.highlights=Z(e.highlights,t),this._requestRender()}_initNode(e,t){const s=e.rctx;t.vao=new I(s,j,V,{positions:H.createVertex(s,B.STATIC_DRAW,t.coordinates),colors:H.createVertex(s,B.STATIC_DRAW,t.rgb)})}_requestRender(){this._context&&this._context.requestRender()}};e([i({constructOnly:!0})],W.prototype,"createGraphic",void 0),W=e([r("esri.views.3d.layers.i3s.PointRenderer")],W);class k extends F{constructor(e,t,s,i,r,n,o,a,l=null,h=null){super(s,r,t),this.id=e,this.obb=i,this.coordinates=n,this.rgb=o,this.attributes=a,this.pointIdFilterMap=l,this.highlights=h}}function G(e){return e.hasOwnProperty("splatSize")}function Q(e,t,s,i,r){if(s.drawScreenSpace)return s.fixedSize*t*i;const n=N(r)*t*i;return s.useFixedSizes?Math.min(s.fixedSize/2,n):s.screenMinSize>0?Math.min(Math.max(s.screenMinSize*t*i,e/2),n):Math.min(e/2,n)}function Y(e,t,s,i,r){return s.drawScreenSpace?0:Q(e,t,s,i,r)}function J(e,t,s){return null==s&&(s=d()),s[0]=e.origin[0]+e.coordinates[3*t],s[1]=e.origin[1]+e.coordinates[3*t+1],s[2]=e.origin[2]+e.coordinates[3*t+2],s}function K(e){return null!=e.component?e.component:-1}function X(e,t,s){null==e&&(e=[]);const i={component:t,id:s};e.push(i);const r=K(i);let n=e.length-1;for(;n>0&&r<K(e[n-1]);)[e[n-1],e[n]]=[e[n],e[n-1]],--n;return e}function Z(e,t){if(null==e)return e;const s=e.filter((e=>e.id!==t));return 0===s.length?null:s}class ${constructor(){this.node=null,this.pointId=null,this.point=null,this.dist=null,this.normal=null,this.layerUid=""}}function ee(e){return null!=e.dist&&null!=e.point&&null!=e.pointId&&null!=e.node}export{W as PointRenderer,k as PointRendererNode,G as isPointRendererNode};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{createScreenPointArray as e,createRenderScreenPointArray3 as t}from"../../../../core/screenUtils.js";import{c as r,h as i,q as s}from"../../../../chunks/vec32.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as n,fromValues as c,distance as a,empty as l,expandPointInPlace as m,expand as h}from"../../../../geometry/support/aaBoundingRect.js";import{PlaneIndex as u}from"../../../../geometry/support/frustum.js";import{signedDistance as p}from"../../../../geometry/support/plane.js";import{areaPoints2d as _}from"../../../../geometry/support/triangle.js";import{ViewingMode as d}from"../../../ViewingMode.js";import{Visibility as f}from"./FeatureTileDescriptor3D.js";import{FeatureTileVisibility3D as S,globalTileLevelThreshold as g,isConvexHullOutsideOfFrustum as b}from"./FeatureTileVisibility3D.js";import{Camera as v}from"../../webgl-engine/lib/Camera.js";class T{constructor(e){this._camera=new v,this._focusOnMap=[0,0],this._screenRect=n(),this._tileSize=e.tileSize,this._renderCoordsHelper=e.renderCoordsHelper,this._tilingScheme=e.tilingScheme,this._visibility=new S(e.renderCoordsHelper)}begin(e,t,r){this._camera.copyFrom(e),this._surfaceElevation=r,this._focusOnMap[0]=t.x,this._focusOnMap[1]=t.y,c(0,0,e.fullWidth,e.fullHeight,this._screenRect),this._visibility.begin(this._camera,r)}end(){this._visibility.end()}updateTile(e){e.measures.visibility=this._visibility.calculate(e),e.measures.distance=a(e.extent,this._focusOnMap),e.measures.visibility!==f.INVISIBLE&&this._updateScreenMeasure(e)}_updateScreenMeasure(e){const t=j,r=1<<t,i=e.measures.screenRect;l(i);let s=0;const o=e.lij,n=o[0],c=n+t,a=o[1]<<t,h=o[2]<<t,u=this._tileSizeWithBias(e),p=u*u,_=this._camera,{frustum:f,viewport:S}=_;if(this._renderCoordsHelper.viewingMode===d.Local||n>g){const t=C;this._tilingScheme.getExtent(o[0],o[1],o[2],t);const r=R,i=H,s=l();for(let e=0;e<4;++e)this._toRenderCoords(t,w[e][0],w[e][1],i[e]),_.projectToScreen(i[e],r[e]),m(s,r[e]);const n=b(f,i,4),c=s[0]>S[2]||s[1]>S[3]||s[2]<S[0]||s[3]<S[1];if(n||c)return void(e.measures.shouldSplit=!1)}for(let l=0;l<r;l++)for(let t=0;t<r;t++)if(s+=this._computeScreenArea(c,a+l,h+t,i),s>p)return void(e.measures.shouldSplit=!0);e.measures.shouldSplit=!1}_tileSizeWithBias(e){return e.measures.visibility===f.VISIBLE_WHEN_EXTENDED?this._tileSize*y:this._tileSize}_computeScreenArea(e,t,r,i){this._tilingScheme.ensureMaxLod(e);const s=C;this._tilingScheme.getExtent(e,t,r,s);const o=A;this._toRenderCoords(s,0,3,o[0]),this._toRenderCoords(s,2,3,o[1]),this._toRenderCoords(s,2,1,o[2]),this._toRenderCoords(s,0,1,o[3]);return this._computeTriangleScreenArea([o[0],o[1],o[2]],i)+this._computeTriangleScreenArea([o[2],o[1],o[3]],i)}_computeTriangleScreenArea(e,t){const i=this._camera.frustum[u.NEAR];let s=0,o=-1,n=-1;for(let r=0;r<3;++r){p(i,e[r])>0?(s++,-1===o&&(o=r)):-1===n&&(n=r)}if(0===s)return this._computeTriangleScreenAreaInside(e,t);if(1===s){const s=I,n=(o+1)%3,c=(o+2)%3,a=o;r(s[0],e[n]),r(s[1],e[c]),x(s[2],e[c],e[a],i);const l=this._computeTriangleScreenAreaInside(s,t);x(s[1],e[n],e[a],i);return l+this._computeTriangleScreenAreaInside(s,t)}if(2===s){const s=I,o=n;r(s[0],e[o]);const c=(n+1)%3,a=(n+2)%3;return x(s[1],e[o],e[c],i),x(s[2],e[o],e[a],i),this._computeTriangleScreenAreaInside(s,t)}return 0}_computeTriangleScreenAreaInside(e,t){for(let r=0;r<3;r++)this._camera.projectToRenderScreen(e[r],E),this._camera.renderToScreen(E,R[r]),h(t,R[r],t);return _(R[0],R[1],R[2])}_toRenderCoords(e,t,r,i){return M[0]=e[t],M[1]=e[r],M[2]=this._surfaceElevation,this._renderCoordsHelper.toRenderCoords(M,this._tilingScheme.spatialReference,i),i}}const j=2,y=5,R=[e(),e(),e(),e()],C=n(),M=o(),A=[o(),o(),o(),o()],E=t(),I=[o(),o(),o()];function x(e,t,r,o){const n=p(o,t),c=p(o,r),a=Math.abs(c-n);i(e,t,Math.abs(c)/a),s(e,e,r,Math.abs(n)/a)}const H=[o(),o(),o(),o()],w=[[0,3],[2,3],[2,1],[0,1]];export{T as FeatureTileMeasurements3D};
5
+ import{createScreenPointArray as e,createRenderScreenPointArray3 as t}from"../../../../core/screenUtils.js";import{c as r,h as i,r as s}from"../../../../chunks/vec32.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as n,fromValues as c,distance as a,empty as l,expandPointInPlace as m,expand as h}from"../../../../geometry/support/aaBoundingRect.js";import{PlaneIndex as u}from"../../../../geometry/support/frustum.js";import{signedDistance as p}from"../../../../geometry/support/plane.js";import{areaPoints2d as _}from"../../../../geometry/support/triangle.js";import{ViewingMode as d}from"../../../ViewingMode.js";import{Visibility as f}from"./FeatureTileDescriptor3D.js";import{FeatureTileVisibility3D as S,globalTileLevelThreshold as g,isConvexHullOutsideOfFrustum as b}from"./FeatureTileVisibility3D.js";import{Camera as v}from"../../webgl-engine/lib/Camera.js";class T{constructor(e){this._camera=new v,this._focusOnMap=[0,0],this._screenRect=n(),this._tileSize=e.tileSize,this._renderCoordsHelper=e.renderCoordsHelper,this._tilingScheme=e.tilingScheme,this._visibility=new S(e.renderCoordsHelper)}begin(e,t,r){this._camera.copyFrom(e),this._surfaceElevation=r,this._focusOnMap[0]=t.x,this._focusOnMap[1]=t.y,c(0,0,e.fullWidth,e.fullHeight,this._screenRect),this._visibility.begin(this._camera,r)}end(){this._visibility.end()}updateTile(e){e.measures.visibility=this._visibility.calculate(e),e.measures.distance=a(e.extent,this._focusOnMap),e.measures.visibility!==f.INVISIBLE&&this._updateScreenMeasure(e)}_updateScreenMeasure(e){const t=j,r=1<<t,i=e.measures.screenRect;l(i);let s=0;const o=e.lij,n=o[0],c=n+t,a=o[1]<<t,h=o[2]<<t,u=this._tileSizeWithBias(e),p=u*u,_=this._camera,{frustum:f,viewport:S}=_;if(this._renderCoordsHelper.viewingMode===d.Local||n>g){const t=C;this._tilingScheme.getExtent(o[0],o[1],o[2],t);const r=R,i=H,s=l();for(let e=0;e<4;++e)this._toRenderCoords(t,w[e][0],w[e][1],i[e]),_.projectToScreen(i[e],r[e]),m(s,r[e]);const n=b(f,i,4),c=s[0]>S[2]||s[1]>S[3]||s[2]<S[0]||s[3]<S[1];if(n||c)return void(e.measures.shouldSplit=!1)}for(let l=0;l<r;l++)for(let t=0;t<r;t++)if(s+=this._computeScreenArea(c,a+l,h+t,i),s>p)return void(e.measures.shouldSplit=!0);e.measures.shouldSplit=!1}_tileSizeWithBias(e){return e.measures.visibility===f.VISIBLE_WHEN_EXTENDED?this._tileSize*y:this._tileSize}_computeScreenArea(e,t,r,i){this._tilingScheme.ensureMaxLod(e);const s=C;this._tilingScheme.getExtent(e,t,r,s);const o=A;this._toRenderCoords(s,0,3,o[0]),this._toRenderCoords(s,2,3,o[1]),this._toRenderCoords(s,2,1,o[2]),this._toRenderCoords(s,0,1,o[3]);return this._computeTriangleScreenArea([o[0],o[1],o[2]],i)+this._computeTriangleScreenArea([o[2],o[1],o[3]],i)}_computeTriangleScreenArea(e,t){const i=this._camera.frustum[u.NEAR];let s=0,o=-1,n=-1;for(let r=0;r<3;++r){p(i,e[r])>0?(s++,-1===o&&(o=r)):-1===n&&(n=r)}if(0===s)return this._computeTriangleScreenAreaInside(e,t);if(1===s){const s=I,n=(o+1)%3,c=(o+2)%3,a=o;r(s[0],e[n]),r(s[1],e[c]),x(s[2],e[c],e[a],i);const l=this._computeTriangleScreenAreaInside(s,t);x(s[1],e[n],e[a],i);return l+this._computeTriangleScreenAreaInside(s,t)}if(2===s){const s=I,o=n;r(s[0],e[o]);const c=(n+1)%3,a=(n+2)%3;return x(s[1],e[o],e[c],i),x(s[2],e[o],e[a],i),this._computeTriangleScreenAreaInside(s,t)}return 0}_computeTriangleScreenAreaInside(e,t){for(let r=0;r<3;r++)this._camera.projectToRenderScreen(e[r],E),this._camera.renderToScreen(E,R[r]),h(t,R[r],t);return _(R[0],R[1],R[2])}_toRenderCoords(e,t,r,i){return M[0]=e[t],M[1]=e[r],M[2]=this._surfaceElevation,this._renderCoordsHelper.toRenderCoords(M,this._tilingScheme.spatialReference,i),i}}const j=2,y=5,R=[e(),e(),e(),e()],C=n(),M=o(),A=[o(),o(),o(),o()],E=t(),I=[o(),o(),o()];function x(e,t,r,o){const n=p(o,t),c=p(o,r),a=Math.abs(c-n);i(e,t,Math.abs(c)/a),s(e,e,r,Math.abs(n)/a)}const H=[o(),o(),o(),o()],w=[[0,3],[2,3],[2,1],[0,1]];export{T as FeatureTileMeasurements3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{acosClamped as e}from"../../../../core/mathUtils.js";import t from"../../../../core/ObjectPool.js";import{f as s,h as r,g as i,n,y as o,j as u,q as c,s as a,m as l,b as d,E as _,C as h}from"../../../../chunks/vec32.js";import{create as f,fromValues as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as p}from"../../../../geometry/ellipsoidUtils.js";import{projectBuffer as T}from"../../../../geometry/projection/projectBuffer.js";import{projectVec3Array as F}from"../../../../geometry/projection/projectVec3Array.js";import{PlaneIndex as E,PointIndex as g}from"../../../../geometry/support/frustum.js";import{create as I,projectVector as R,fromPoints as A,getNormal as O,signedDistance as S}from"../../../../geometry/support/plane.js";import{wrap as b}from"../../../../geometry/support/ray.js";import{ViewingMode as P}from"../../../ViewingMode.js";import{FeatureTileDescriptor3D as B,Visibility as j}from"./FeatureTileDescriptor3D.js";import{Frustum as H}from"../../state/Frustum.js";import{FrustumExtentIntersection as x}from"../../support/FrustumExtentIntersection.js";class N{constructor(e){this._renderCoordsHelper=e,this._surfaceElevation=0,this._cache=new Map,this._frustumBoundingSphereCenter=f(),this._frustumBoundingSphereRadius=0,this._frustum=new H(e),this._extendedFrustum=new H(e),this._intersector=new x({renderCoordsHelper:e}),this._renderCoordsHelper=e}begin(e,t){this._surfaceElevation=t,this._aboveGround=this._renderCoordsHelper.getAltitude(e.eye)>t,this._frustum.update(e),this._shortenFrustumFarPlane(this._frustum),this._updateExtendedFrustum(e),this._updateFrustumBoundingSphere()}end(){this._cache.clear()}calculate(e){const t=this._renderCoordsHelper.viewingMode===P.Global&&e.lij[0]>=V&&e.lij[0]<C,s=this._getOrCalculateSingleTileVisibility(e,!t);return s!==j.INVISIBLE&&t?this._calculateAggregatedChildrenVisibility(e):s}_shortenFrustumFarPlane(e){const t=H.nearFarLineIndices,n=e.mutablePoints;for(const o of t){const[e,t]=o,u=n[e],c=n[t];s(y,c,u),r(y,y,M),i(n[t],u,y)}e.updatePoints(n)}_calculateAggregatedChildrenVisibility(e){let t=j.INVISIBLE;const s=this._cache.get(e.id);if(null!=s)return s;const r=U.acquire();e.getChildren(r);for(const i of r){const e=this.calculate(i);if(e!==j.INVISIBLE&&(t=e,e===j.VISIBLE_ON_SURFACE))break}return U.release(r),this._cache.set(e.id,t),t}_getOrCalculateSingleTileVisibility(e,t){const s=this._cache.get(e.id);if(null!=s)return s;const r=this._calculateSingleTileVisibility(e);return t&&this._cache.set(e.id,r),r}_calculateSingleTileVisibility(e){if(!this._aboveGround&&this._renderCoordsHelper.viewingMode===P.Global&&e.lij[0]<G){return this._calculateSingleTileVisibilitySided(e,!1)===j.INVISIBLE?this._calculateSingleTileVisibilitySided(e,!0):void 0}return this._calculateSingleTileVisibilitySided(e,this._aboveGround)}_isTileVisibleInFrustum(e){return this._renderCoordsHelper.viewingMode===P.Local?this._isTileVisibleInFrustumLocal(e):this._isTileVisibleInFrustumGlobal(e)}_updateFrustumBoundingSphere(){const e=this._frustum,t=e.origin,s=ce;n(s,e.direction);const r=e.points,i=ae;o(i,r[4],t);const a=.5*u(i,i)/u(s,i),l=this._frustumBoundingSphereCenter;c(l,t,s,a);const d=1+a;this._frustumBoundingSphereRadius=d}_isTileVisibleInFrustumLocal(e){const t=e.tilingScheme.spatialReference,s=e.extent,r=this._renderCoordsHelper.spatialReference,i=Q;if(i[0]=s[0],i[1]=s[1],i[2]=0,i[3]=s[2],i[4]=s[3],i[5]=0,!T(i,t,0,i,r,0,2))return!1;const n=Z;a(n[0],i[0],i[1],0),a(n[1],i[3],i[1],0),a(n[2],i[3],i[4],0),a(n[3],i[0],i[4],0);const d=$;a(d,.5*(i[0]+i[3]),.5*(i[1]+i[4]),.5*(i[2]+i[5]));const _=ee;a(_,0,0,1);const h=.5*l(n[0],n[2]),f=this._frustum,m=this._frustumBoundingSphereRadius,p=this._frustumBoundingSphereCenter,F=de;o(F,p,d);const E=u(_,F),g=le;c(g,d,_,E);if(l(g,p)>h+m)return!1;const I=K,R=E+m,A=E-m;for(let o=0;o<4;++o)c(I[o],n[o],_,R),c(I[o+4],n[o],_,A);return!X(f.planes,I,8)}_isTileVisibleInFrustumGlobal(e){const t=e.tilingScheme.spatialReference,s=e.extent,_=this._renderCoordsHelper.spatialReference;if(e.lij[0]<Y)return!0;const h=Z,f=.5*(s[0]+s[2]);if(a(h[0],s[0],s[1],0),a(h[1],s[2],s[1],0),a(h[2],s[2],s[3],0),a(h[3],s[0],s[3],0),a(h[4],f,s[1],0),a(h[5],f,s[3],0),!F(h,t,0,h,_,0,6))return!1;const T=h[0][2]>0,E=h[3][2]<0,g=T||E,I=p(_).radius;if(g){const e=m(0,0,1),t=se;W(t,e,h[0]);const s=re;if(W(s,e,h[1]),T){const r=te,i=h[4],n=ie;W(n,i,e),W(r,n,i);const o=h[0];d(o,t,r),k(o,I);const u=h[1];d(u,s,r),k(u,I)}else if(E){const r=te,i=h[5],n=ie;W(n,i,e),W(r,i,n);const o=h[3];d(o,r,t),k(o,I);const u=h[2];d(u,r,s),k(u,I)}}const R=$;{const e=pe;o(e,h[3],h[0]),n(e,e);const t=Te;i(t,h[0],h[3]),r(t,t,.5);const s=-u(t,e),a=Fe,l=Ee;i(a,h[0],h[1]),r(a,a,.5),i(l,h[2],h[3]),r(l,l,.5);const d=ge;o(d,l,a),n(d,d);const _=-(s+u(e,a))/u(e,d);c(R,a,d,_),k(R,I)}const A=this._frustumBoundingSphereRadius,O=this._frustumBoundingSphereCenter,S=this._frustum,b=S.planes;if(h.some((e=>S.intersectsPoint(e))))return!0;if(S.intersectsPoint(R))return!0;const P=ne;n(P,R);const B=he;o(B,O,_e);const j=u(B,P);if(j<-A)return!1;const H=ue;n(H,h[0]);const x=u(H,P);if(x<=0)return!0;const N=oe;r(N,P,j);const V=l(N,O),C=t.isWGS84,G=e.lij,M=C&&G[2]===2**G[0]-1,L=C&&0===G[2],y=L?He:M?Be:be,v=L?xe:M?je:Pe,w=S.points;{const e=h,t=Ne,s=Ie,r=Re,i=_e;for(const n of y){const o=e[n];if(D(s,e[(n+1)%4],o),D(r,i,o),W(t,r,s),J(t,w,1))return!1}}let U=null;if(j<2*A){const e=2.5*A;if(V>x*e+A)return!1;const t=me,s=e/x;for(let i=0;i<4;++i)r(t[i],h[i],s/I);a(t[4],0,0,0),U=t}else{const e=(j+A)/x,t=(j-A)/x,s=fe;for(let i=0;i<4;++i){const n=h[i];r(s[i+4],n,t/I),r(s[i],n,e/I)}U=s}if(X(b,U,U.length))return!1;const z=S.lines,q=Ae,K=Oe;for(const r of v){n(q,h[r]);for(const e of z)if(n(K,e.direction),Me(K,q,U,w))return!1}return!0}_calculateSingleTileVisibilitySided(e,t){if(this._isTileVisibleInFrustum(e)){this._intersector.update(e.extent,e.tilingScheme.spatialReference,this._surfaceElevation,t);const s=p(e.tilingScheme.spatialReference).radius;return this._intersector.isVisibleInFrustum(this._frustum,s,!0)?j.VISIBLE_ON_SURFACE:j.VISIBLE_WHEN_EXTENDED}return j.INVISIBLE}_updateExtendedFrustum(t){this._extendedFrustum.update(t),this._shortenFrustumFarPlane(this._extendedFrustum);const s=this._renderCoordsHelper.worldUpAtPosition(t.eye,y);this._aboveGround||_(s,s);const i=e(-u(s,t.viewForward));if(this._hasExtendedFrustum=i>t.fovY/2,!this._hasExtendedFrustum)return;const n=this._extendedFrustumParameters(),o=this._extendedFrustum.mutablePoints;for(let e=0;e<4;e++){const t=n.pointIndices[e],s=o[t],i=this._renderCoordsHelper.getAltitude(s);if(n.needsAltitudeAdjustment(i)){switch(this._renderCoordsHelper.worldUpAtPosition(s,y),t){case g.FAR_BOTTOM_LEFT:case g.FAR_TOP_LEFT:case g.NEAR_BOTTOM_LEFT:case g.NEAR_TOP_LEFT:R(this._extendedFrustum.planes[E.LEFT],y,y);break;case g.FAR_BOTTOM_RIGHT:case g.FAR_TOP_RIGHT:case g.NEAR_BOTTOM_RIGHT:case g.NEAR_TOP_RIGHT:R(this._extendedFrustum.planes[E.RIGHT],y,y)}r(y,y,n.direction),this._renderCoordsHelper.intersectInfiniteManifold(b(s,y),n.zWithMargin,s)}}if(this._extendedFrustum.updatePoints(o),A(o[g.NEAR_BOTTOM_LEFT],o[g.NEAR_BOTTOM_RIGHT],o[g.NEAR_TOP_RIGHT],v),A(o[g.NEAR_BOTTOM_RIGHT],o[g.NEAR_TOP_RIGHT],o[g.NEAR_TOP_LEFT],w),u(O(v),O(w))<0){const e=this._extendedFrustum.mutablePoints;this._aboveGround?[e[g.NEAR_BOTTOM_LEFT],e[g.NEAR_BOTTOM_RIGHT]]=[e[g.NEAR_BOTTOM_RIGHT],e[g.NEAR_BOTTOM_LEFT]]:[e[g.NEAR_TOP_LEFT],e[g.NEAR_TOP_RIGHT]]=[e[g.NEAR_TOP_RIGHT],e[g.NEAR_TOP_LEFT]],this._extendedFrustum.updatePoints(e)}}_extendedFrustumParameters(){return this._aboveGround?this._extendedFrustumParametersAboveSurface():this._extendedFrustumParametersBelowSurface()}_extendedFrustumParametersAboveSurface(){const e=this._surfaceElevation-L;return{zWithMargin:e,pointIndices:H.planePointIndices.bottom,direction:-1,needsAltitudeAdjustment:t=>t>e}}_extendedFrustumParametersBelowSurface(){const e=this._surfaceElevation+L;return{zWithMargin:e,pointIndices:H.planePointIndices.top,direction:1,needsAltitudeAdjustment:t=>t<e}}}const V=2,C=6,G=12,M=.95,L=1,y=f(),v=I(),w=I(),U=new t(Array,(e=>{4!==e.length&&(e[0]=new B,e[1]=new B,e[2]=new B,e[3]=new B)}),(e=>{e[0].release(),e[1].release(),e[2].release(),e[3].release()}));function W(e,t,s){return d(e,t,s),n(e,e),e}function D(e,t,s){return o(e,t,s),n(e,e),e}function k(e,t){return r(e,e,t/h(e)),e}const z=[E.LEFT,E.RIGHT,E.BOTTOM,E.TOP,E.FAR];function q(e,t,s){for(let r=0;r<s;++r)if(S(e,t[r])<0)return!1;return!0}function X(e,t,s){for(const r of z)if(q(e[r],t,s))return!0;return!1}const Y=3;function J(e,t,s){for(const r of t)if(u(r,e)<s)return!1;return!0}const K=[f(),f(),f(),f(),f(),f(),f(),f()],Q=[0,0,0,0,0,0],Z=[f(),f(),f(),f(),f(),f()],$=f(),ee=f(),te=f(),se=f(),re=f(),ie=f(),ne=f(),oe=f(),ue=f(),ce=f(),ae=f(),le=f(),de=f(),_e=m(0,0,0),he=f(),fe=[f(),f(),f(),f(),f(),f(),f(),f()],me=[f(),f(),f(),f(),f()],pe=f(),Te=f(),Fe=f(),Ee=f(),ge=f(),Ie=f(),Re=f(),Ae=f(),Oe=f(),Se=f(),be=[0,1,2,3],Pe=[0,1,2,3],Be=[0,1,3],je=[0,1,3],He=[1,2,3],xe=[1,2,3],Ne=f();function Ve(e,t,s){let r=1/0,i=-1/0;for(const n of s){const e=u(t,n);r=Math.min(r,e),i=Math.max(i,e)}e[0]=r,e[1]=i}function Ce(e,t,s,r){let i=1/0,n=-1/0;for(const o of r){const r=u(s,o);if(i=Math.min(i,r),n=Math.max(n,r),i<=t&&n>=e)return!1}return!0}const Ge=[0,0];function Me(e,t,s,r){const i=Se;W(i,e,t);const n=Ge;return Ve(n,i,s),Ce(n[0],n[1],i,r)}export{N as FeatureTileVisibility3D,Y as globalTileLevelThreshold,X as isConvexHullOutsideOfFrustum};
5
+ import{acosClamped as e}from"../../../../core/mathUtils.js";import t from"../../../../core/ObjectPool.js";import{f as s,h as r,g as i,n,z as o,k as u,r as c,s as a,o as l,b as d,F as _,D as h}from"../../../../chunks/vec32.js";import{create as f,fromValues as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as p}from"../../../../geometry/ellipsoidUtils.js";import{projectBuffer as T}from"../../../../geometry/projection/projectBuffer.js";import{projectVec3Array as F}from"../../../../geometry/projection/projectVec3Array.js";import{PlaneIndex as g,PointIndex as E}from"../../../../geometry/support/frustum.js";import{create as I,projectVector as R,fromPoints as A,getNormal as O,signedDistance as S}from"../../../../geometry/support/plane.js";import{wrap as b}from"../../../../geometry/support/ray.js";import{ViewingMode as P}from"../../../ViewingMode.js";import{FeatureTileDescriptor3D as B,Visibility as H}from"./FeatureTileDescriptor3D.js";import{Frustum as j}from"../../state/Frustum.js";import{FrustumExtentIntersection as x}from"../../support/FrustumExtentIntersection.js";class N{constructor(e){this._renderCoordsHelper=e,this._surfaceElevation=0,this._cache=new Map,this._frustumBoundingSphereCenter=f(),this._frustumBoundingSphereRadius=0,this._frustum=new j(e),this._extendedFrustum=new j(e),this._intersector=new x({renderCoordsHelper:e}),this._renderCoordsHelper=e}begin(e,t){this._surfaceElevation=t,this._aboveGround=this._renderCoordsHelper.getAltitude(e.eye)>t,this._frustum.update(e),this._shortenFrustumFarPlane(this._frustum),this._updateExtendedFrustum(e),this._updateFrustumBoundingSphere()}end(){this._cache.clear()}calculate(e){const t=this._renderCoordsHelper.viewingMode===P.Global&&e.lij[0]>=V&&e.lij[0]<G,s=this._getOrCalculateSingleTileVisibility(e,!t);return s!==H.INVISIBLE&&t?this._calculateAggregatedChildrenVisibility(e):s}_shortenFrustumFarPlane(e){const t=j.nearFarLineIndices,n=e.mutablePoints;for(const o of t){const[e,t]=o,u=n[e],c=n[t];s(v,c,u),r(v,v,C),i(n[t],u,v)}e.updatePoints(n)}_calculateAggregatedChildrenVisibility(e){let t=H.INVISIBLE;const s=this._cache.get(e.id);if(null!=s)return s;const r=U.acquire();e.getChildren(r);for(const i of r){const e=this.calculate(i);if(e!==H.INVISIBLE&&(t=e,e===H.VISIBLE_ON_SURFACE))break}return U.release(r),this._cache.set(e.id,t),t}_getOrCalculateSingleTileVisibility(e,t){const s=this._cache.get(e.id);if(null!=s)return s;const r=this._calculateSingleTileVisibility(e);return t&&this._cache.set(e.id,r),r}_calculateSingleTileVisibility(e){if(!this._aboveGround&&this._renderCoordsHelper.viewingMode===P.Global&&e.lij[0]<M){return this._calculateSingleTileVisibilitySided(e,!1)===H.INVISIBLE?this._calculateSingleTileVisibilitySided(e,!0):void 0}return this._calculateSingleTileVisibilitySided(e,this._aboveGround)}_isTileVisibleInFrustum(e){return this._renderCoordsHelper.viewingMode===P.Local?this._isTileVisibleInFrustumLocal(e):this._isTileVisibleInFrustumGlobal(e)}_updateFrustumBoundingSphere(){const e=this._frustum,t=e.origin,s=ce;n(s,e.direction);const r=e.points,i=ae;o(i,r[4],t);const a=.5*u(i,i)/u(s,i),l=this._frustumBoundingSphereCenter;c(l,t,s,a);const d=1+a;this._frustumBoundingSphereRadius=d}_isTileVisibleInFrustumLocal(e){const t=e.tilingScheme.spatialReference,s=e.extent,r=this._renderCoordsHelper.spatialReference,i=Q;if(i[0]=s[0],i[1]=s[1],i[2]=0,i[3]=s[2],i[4]=s[3],i[5]=0,!T(i,t,0,i,r,0,2))return!1;const n=Z;a(n[0],i[0],i[1],0),a(n[1],i[3],i[1],0),a(n[2],i[3],i[4],0),a(n[3],i[0],i[4],0);const d=$;a(d,.5*(i[0]+i[3]),.5*(i[1]+i[4]),.5*(i[2]+i[5]));const _=ee;a(_,0,0,1);const h=.5*l(n[0],n[2]),f=this._frustum,m=this._frustumBoundingSphereRadius,p=this._frustumBoundingSphereCenter,F=de;o(F,p,d);const g=u(_,F),E=le;c(E,d,_,g);if(l(E,p)>h+m)return!1;const I=K,R=g+m,A=g-m;for(let o=0;o<4;++o)c(I[o],n[o],_,R),c(I[o+4],n[o],_,A);return!X(f.planes,I,8)}_isTileVisibleInFrustumGlobal(e){const t=e.tilingScheme.spatialReference,s=e.extent,_=this._renderCoordsHelper.spatialReference;if(e.lij[0]<Y)return!0;const h=Z,f=.5*(s[0]+s[2]);if(a(h[0],s[0],s[1],0),a(h[1],s[2],s[1],0),a(h[2],s[2],s[3],0),a(h[3],s[0],s[3],0),a(h[4],f,s[1],0),a(h[5],f,s[3],0),!F(h,t,0,h,_,0,6))return!1;const T=h[0][2]>0,g=h[3][2]<0,E=T||g,I=p(_).radius;if(E){const e=m(0,0,1),t=se;D(t,e,h[0]);const s=re;if(D(s,e,h[1]),T){const r=te,i=h[4],n=ie;D(n,i,e),D(r,n,i);const o=h[0];d(o,t,r),k(o,I);const u=h[1];d(u,s,r),k(u,I)}else if(g){const r=te,i=h[5],n=ie;D(n,i,e),D(r,i,n);const o=h[3];d(o,r,t),k(o,I);const u=h[2];d(u,r,s),k(u,I)}}const R=$;{const e=pe;o(e,h[3],h[0]),n(e,e);const t=Te;i(t,h[0],h[3]),r(t,t,.5);const s=-u(t,e),a=Fe,l=ge;i(a,h[0],h[1]),r(a,a,.5),i(l,h[2],h[3]),r(l,l,.5);const d=Ee;o(d,l,a),n(d,d);const _=-(s+u(e,a))/u(e,d);c(R,a,d,_),k(R,I)}const A=this._frustumBoundingSphereRadius,O=this._frustumBoundingSphereCenter,S=this._frustum,b=S.planes;if(h.some((e=>S.intersectsPoint(e))))return!0;if(S.intersectsPoint(R))return!0;const P=ne;n(P,R);const B=he;o(B,O,_e);const H=u(B,P);if(H<-A)return!1;const j=ue;n(j,h[0]);const x=u(j,P);if(x<=0)return!0;const N=oe;r(N,P,H);const V=l(N,O),G=t.isWGS84,M=e.lij,C=G&&M[2]===2**M[0]-1,L=G&&0===M[2],v=L?je:C?Be:be,y=L?xe:C?He:Pe,w=S.points;{const e=h,t=Ne,s=Ie,r=Re,i=_e;for(const n of v){const o=e[n];if(W(s,e[(n+1)%4],o),W(r,i,o),D(t,r,s),J(t,w,1))return!1}}let U=null;if(H<2*A){const e=2.5*A;if(V>x*e+A)return!1;const t=me,s=e/x;for(let i=0;i<4;++i)r(t[i],h[i],s/I);a(t[4],0,0,0),U=t}else{const e=(H+A)/x,t=(H-A)/x,s=fe;for(let i=0;i<4;++i){const n=h[i];r(s[i+4],n,t/I),r(s[i],n,e/I)}U=s}if(X(b,U,U.length))return!1;const z=S.lines,q=Ae,K=Oe;for(const r of y){n(q,h[r]);for(const e of z)if(n(K,e.direction),Ce(K,q,U,w))return!1}return!0}_calculateSingleTileVisibilitySided(e,t){if(this._isTileVisibleInFrustum(e)){this._intersector.update(e.extent,e.tilingScheme.spatialReference,this._surfaceElevation,t);const s=p(e.tilingScheme.spatialReference).radius;return this._intersector.isVisibleInFrustum(this._frustum,s,!0)?H.VISIBLE_ON_SURFACE:H.VISIBLE_WHEN_EXTENDED}return H.INVISIBLE}_updateExtendedFrustum(t){this._extendedFrustum.update(t),this._shortenFrustumFarPlane(this._extendedFrustum);const s=this._renderCoordsHelper.worldUpAtPosition(t.eye,v);this._aboveGround||_(s,s);const i=e(-u(s,t.viewForward));if(this._hasExtendedFrustum=i>t.fovY/2,!this._hasExtendedFrustum)return;const n=this._extendedFrustumParameters(),o=this._extendedFrustum.mutablePoints;for(let e=0;e<4;e++){const t=n.pointIndices[e],s=o[t],i=this._renderCoordsHelper.getAltitude(s);if(n.needsAltitudeAdjustment(i)){switch(this._renderCoordsHelper.worldUpAtPosition(s,v),t){case E.FAR_BOTTOM_LEFT:case E.FAR_TOP_LEFT:case E.NEAR_BOTTOM_LEFT:case E.NEAR_TOP_LEFT:R(this._extendedFrustum.planes[g.LEFT],v,v);break;case E.FAR_BOTTOM_RIGHT:case E.FAR_TOP_RIGHT:case E.NEAR_BOTTOM_RIGHT:case E.NEAR_TOP_RIGHT:R(this._extendedFrustum.planes[g.RIGHT],v,v)}r(v,v,n.direction),this._renderCoordsHelper.intersectInfiniteManifold(b(s,v),n.zWithMargin,s)}}if(this._extendedFrustum.updatePoints(o),A(o[E.NEAR_BOTTOM_LEFT],o[E.NEAR_BOTTOM_RIGHT],o[E.NEAR_TOP_RIGHT],y),A(o[E.NEAR_BOTTOM_RIGHT],o[E.NEAR_TOP_RIGHT],o[E.NEAR_TOP_LEFT],w),u(O(y),O(w))<0){const e=this._extendedFrustum.mutablePoints;this._aboveGround?[e[E.NEAR_BOTTOM_LEFT],e[E.NEAR_BOTTOM_RIGHT]]=[e[E.NEAR_BOTTOM_RIGHT],e[E.NEAR_BOTTOM_LEFT]]:[e[E.NEAR_TOP_LEFT],e[E.NEAR_TOP_RIGHT]]=[e[E.NEAR_TOP_RIGHT],e[E.NEAR_TOP_LEFT]],this._extendedFrustum.updatePoints(e)}}_extendedFrustumParameters(){return this._aboveGround?this._extendedFrustumParametersAboveSurface():this._extendedFrustumParametersBelowSurface()}_extendedFrustumParametersAboveSurface(){const e=this._surfaceElevation-L;return{zWithMargin:e,pointIndices:j.planePointIndices.bottom,direction:-1,needsAltitudeAdjustment:t=>t>e}}_extendedFrustumParametersBelowSurface(){const e=this._surfaceElevation+L;return{zWithMargin:e,pointIndices:j.planePointIndices.top,direction:1,needsAltitudeAdjustment:t=>t<e}}}const V=2,G=6,M=12,C=.95,L=1,v=f(),y=I(),w=I(),U=new t(Array,(e=>{4!==e.length&&(e[0]=new B,e[1]=new B,e[2]=new B,e[3]=new B)}),(e=>{e[0].release(),e[1].release(),e[2].release(),e[3].release()}));function D(e,t,s){return d(e,t,s),n(e,e),e}function W(e,t,s){return o(e,t,s),n(e,e),e}function k(e,t){return r(e,e,t/h(e)),e}const z=[g.LEFT,g.RIGHT,g.BOTTOM,g.TOP,g.FAR];function q(e,t,s){for(let r=0;r<s;++r)if(S(e,t[r])<0)return!1;return!0}function X(e,t,s){for(const r of z)if(q(e[r],t,s))return!0;return!1}const Y=3;function J(e,t,s){for(const r of t)if(u(r,e)<s)return!1;return!0}const K=[f(),f(),f(),f(),f(),f(),f(),f()],Q=[0,0,0,0,0,0],Z=[f(),f(),f(),f(),f(),f()],$=f(),ee=f(),te=f(),se=f(),re=f(),ie=f(),ne=f(),oe=f(),ue=f(),ce=f(),ae=f(),le=f(),de=f(),_e=m(0,0,0),he=f(),fe=[f(),f(),f(),f(),f(),f(),f(),f()],me=[f(),f(),f(),f(),f()],pe=f(),Te=f(),Fe=f(),ge=f(),Ee=f(),Ie=f(),Re=f(),Ae=f(),Oe=f(),Se=f(),be=[0,1,2,3],Pe=[0,1,2,3],Be=[0,1,3],He=[0,1,3],je=[1,2,3],xe=[1,2,3],Ne=f();function Ve(e,t,s){let r=1/0,i=-1/0;for(const n of s){const e=u(t,n);r=Math.min(r,e),i=Math.max(i,e)}e[0]=r,e[1]=i}function Ge(e,t,s,r){let i=1/0,n=-1/0;for(const o of r){const r=u(s,o);if(i=Math.min(i,r),n=Math.max(n,r),i<=t&&n>=e)return!1}return!0}const Me=[0,0];function Ce(e,t,s,r){const i=Se;D(i,e,t);const n=Me;return Ve(n,i,s),Ge(n[0],n[1],i,r)}export{N as FeatureTileVisibility3D,Y as globalTileLevelThreshold,X as isConvexHullOutsideOfFrustum};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{s as e,j as s,f as i,h as a,g as m,c as n,q as c,n as l,b as f}from"../../../../chunks/vec32.js";import{create as I}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as h}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as p}from"../../../../geometry/projection/projectors.js";import{newDoubleArray as N}from"../../../../geometry/support/DoubleArray.js";import{create as g,fromArray as b,getNormal as u}from"../../../../geometry/support/plane.js";import{ViewingMode as j}from"../../../ViewingMode.js";function T(t,r,e,s,i=1){if(e.isGeographic&&s===j.Global){const t=N(r.length),o=r.length,s=h(e);for(let e=0;e<o;e+=3)p(r,e,t,e,s);r=t}o(y,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY);for(let o=0;o<r.length;o+=3)y[0]=Math.min(y[0],r[o]),y[1]=Math.min(y[1],r[o+1]);const a=y[0]%i,m=y[1]%i,n=y[0]-a,c=y[1]-m;for(let o=0;o<r.length;o+=3){const e=o/3*4;t[e]=(r[o]-n)/i,t[e+1]=(r[o+1]-c)/i,t[e+2]=n/i,t[e+3]=c/i}}function M(t,r,n,c,l=1){e(F,1,0,0),e(Y,0,1,0),e(_,0,0,1),w(x,n),b(V,n)&&O(V,F,Y,_,c,x),o(y,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),o(P,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(let o=0;o<n.length;o+=3){e(E,n[o],n[o+1],n[o+2]);const t=s(F,E),r=s(Y,E);y[0]=Math.min(y[0],t),y[1]=Math.min(y[1],r),P[0]=Math.max(P[0],t),P[1]=Math.max(P[1],r)}const f=s(_,x);U(v,y[0],y[1],f,F,Y,_),U(A,P[0],y[1],f,F,Y,_),U(G,y[0],P[1],f,F,Y,_),i(A,A,v),a(A,A,.5),i(G,G,v),a(G,G,.5),m(v,v,A),m(v,v,G);const I=y[0]%l,h=y[1]%l,p=y[0]-I,N=y[1]-h;for(let o=0;o<n.length;o+=3){e(E,n[o],n[o+1],n[o+2]);const i=o/3,a=4*i;t[a]=(s(F,E)-p)/l,t[a+1]=(s(Y,E)-N)/l,t[a+2]=p/l,t[a+3]=N/l;const m=9*i;for(let t=0;t<3;t++)r[m+t]=v[t],r[m+t+3]=A[t],r[m+t+6]=G[t]}}const x=I(),E=I(),V=g(),F=I(),Y=I(),_=I(),y=r(),P=r(),v=I(),A=I(),G=I();function O(t,o,r,i,m,I){null!=m?(m.basisMatrixAtPosition(I,S),e(d,S[0],S[1],S[2]),e(k,S[4],S[5],S[6]),e(q,S[8],S[9],S[10])):(e(d,1,0,0),e(k,0,1,0),e(q,0,0,1));const h=u(t);s(h,q)<0&&a(h,h,-1),n(i,h);const p=s(h,k),N=s(h,d);Math.abs(p)>Math.abs(N)?(c(o,d,h,-N),l(o,o),f(r,o,h),l(r,r),a(r,r,-1)):(c(r,k,h,-p),l(r,r),f(o,r,h),l(o,o))}const S=t(),d=I(),k=I(),q=I();function w(t,o){e(D,0,0,0);for(let r=0;r<o.length-3;r+=3)D[0]+=o[r],D[1]+=o[r+1],D[2]+=o[r+2];a(t,D,1/(o.length/3-1))}const D=I();function U(t,o,r,s,i,a,m){e(t,o*i[0]+r*a[0]+s*m[0],o*i[1]+r*a[1]+s*m[1],o*i[2]+r*a[2]+s*m[2])}export{M as createMapSpaceUVCoords,T as createMapSpaceUVCoordsDraped};
5
+ import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{s as e,k as s,f as i,h as a,g as m,c as n,r as c,n as l,b as f}from"../../../../chunks/vec32.js";import{create as I}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as h}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as p}from"../../../../geometry/projection/projectors.js";import{newDoubleArray as N}from"../../../../geometry/support/DoubleArray.js";import{create as g,fromArray as b,getNormal as u}from"../../../../geometry/support/plane.js";import{ViewingMode as j}from"../../../ViewingMode.js";function T(t,r,e,s,i=1){if(e.isGeographic&&s===j.Global){const t=N(r.length),o=r.length,s=h(e);for(let e=0;e<o;e+=3)p(r,e,t,e,s);r=t}o(y,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY);for(let o=0;o<r.length;o+=3)y[0]=Math.min(y[0],r[o]),y[1]=Math.min(y[1],r[o+1]);const a=y[0]%i,m=y[1]%i,n=y[0]-a,c=y[1]-m;for(let o=0;o<r.length;o+=3){const e=o/3*4;t[e]=(r[o]-n)/i,t[e+1]=(r[o+1]-c)/i,t[e+2]=n/i,t[e+3]=c/i}}function M(t,r,n,c,l=1){e(F,1,0,0),e(Y,0,1,0),e(_,0,0,1),D(x,n),b(V,n)&&O(V,F,Y,_,c,x),o(y,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),o(P,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(let o=0;o<n.length;o+=3){e(E,n[o],n[o+1],n[o+2]);const t=s(F,E),r=s(Y,E);y[0]=Math.min(y[0],t),y[1]=Math.min(y[1],r),P[0]=Math.max(P[0],t),P[1]=Math.max(P[1],r)}const f=s(_,x);q(v,y[0],y[1],f,F,Y,_),q(A,P[0],y[1],f,F,Y,_),q(G,y[0],P[1],f,F,Y,_),i(A,A,v),a(A,A,.5),i(G,G,v),a(G,G,.5),m(v,v,A),m(v,v,G);const I=y[0]%l,h=y[1]%l,p=y[0]-I,N=y[1]-h;for(let o=0;o<n.length;o+=3){e(E,n[o],n[o+1],n[o+2]);const i=o/3,a=4*i;t[a]=(s(F,E)-p)/l,t[a+1]=(s(Y,E)-N)/l,t[a+2]=p/l,t[a+3]=N/l;const m=9*i;for(let t=0;t<3;t++)r[m+t]=v[t],r[m+t+3]=A[t],r[m+t+6]=G[t]}}const x=I(),E=I(),V=g(),F=I(),Y=I(),_=I(),y=r(),P=r(),v=I(),A=I(),G=I();function O(t,o,r,i,m,I){null!=m?(m.basisMatrixAtPosition(I,S),e(d,S[0],S[1],S[2]),e(k,S[4],S[5],S[6]),e(w,S[8],S[9],S[10])):(e(d,1,0,0),e(k,0,1,0),e(w,0,0,1));const h=u(t);s(h,w)<0&&a(h,h,-1),n(i,h);const p=s(h,k),N=s(h,d);Math.abs(p)>Math.abs(N)?(c(o,d,h,-N),l(o,o),f(r,o,h),l(r,r),a(r,r,-1)):(c(r,k,h,-p),l(r,r),f(o,r,h),l(o,o))}const S=t(),d=I(),k=I(),w=I();function D(t,o){e(U,0,0,0);for(let r=0;r<o.length-3;r+=3)U[0]+=o[r],U[1]+=o[r+1],U[2]+=o[r+2];a(t,U,1/(o.length/3-1))}const U=I();function q(t,o,r,s,i,a,m){e(t,o*i[0]+r*a[0]+s*m[0],o*i[1]+r*a[1]+s*m[1],o*i[2]+r*a[2]+s*m[2])}export{M as createMapSpaceUVCoords,T as createMapSpaceUVCoordsDraped};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{c as t,D as i}from"../../../chunks/vec32.js";import{create as s}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{PointIndex as e,create as r,createPoints as n,fromMatrix as o,computePlanes as u,intersectsSphere as h,intersectsRay as _,intersectsLineSegment as l,intersectsPoint as p,planePointIndices as a}from"../../../geometry/support/frustum.js";class c{get planes(){return this.frustum}get points(){return this._points}get mutablePoints(){return this._points}get direction(){return this._direction}get origin(){return this._origin}constructor(t){this.renderCoordsHelper=t,this.frustum=r(),this._points=n(),this.lines=new Array(12),this._origin=s(),this._direction=s(),this._altitude=null;for(let i=0;i<12;i++)this.lines[i]={origin:null,direction:s(),endpoint:null}}update(i){o(i.viewMatrix,i.projectionMatrix,this.frustum,this._points),t(this._origin,i.eye),t(this._direction,i.viewForward),this._altitude=this.renderCoordsHelper.getAltitude(this._origin),this._updateLines()}updatePoints(i){for(let s=0;s<this._points.length;s++)t(this._points[s],i[s]);u(this.frustum,this._points),this._updateLines()}get altitude(){return this._altitude}intersectsSphere(t){return h(this.frustum,t)}intersectsRay(t){return _(this.frustum,t)}intersectsLineSegment(t,i){return l(this.frustum,t,i)}intersectsPoint(t){return p(this.frustum,t)}_updateLines(){const t=this._points;for(let i=0;i<4;i++){const s=i+4;d(this.lines[i],t[i],t[s]),d(this.lines[i+4],t[i],3===i?t[0]:t[i+1]),d(this.lines[i+8],t[s],3===i?t[4]:t[s+1])}}}function d(t,s,e){t.origin=s,t.endpoint=e,i(t.direction,s,e)}c.planePointIndices=a,c.nearFarLineIndices=[[e.NEAR_BOTTOM_LEFT,e.FAR_BOTTOM_LEFT],[e.NEAR_BOTTOM_RIGHT,e.FAR_BOTTOM_RIGHT],[e.NEAR_TOP_RIGHT,e.FAR_TOP_RIGHT],[e.NEAR_TOP_LEFT,e.FAR_TOP_LEFT]];export{c as Frustum};
5
+ import{c as t,E as i}from"../../../chunks/vec32.js";import{create as s}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{PointIndex as e,create as r,createPoints as n,fromMatrix as o,computePlanes as u,intersectsSphere as h,intersectsRay as _,intersectsLineSegment as l,intersectsPoint as p,planePointIndices as a}from"../../../geometry/support/frustum.js";class c{get planes(){return this.frustum}get points(){return this._points}get mutablePoints(){return this._points}get direction(){return this._direction}get origin(){return this._origin}constructor(t){this.renderCoordsHelper=t,this.frustum=r(),this._points=n(),this.lines=new Array(12),this._origin=s(),this._direction=s(),this._altitude=null;for(let i=0;i<12;i++)this.lines[i]={origin:null,direction:s(),endpoint:null}}update(i){o(i.viewMatrix,i.projectionMatrix,this.frustum,this._points),t(this._origin,i.eye),t(this._direction,i.viewForward),this._altitude=this.renderCoordsHelper.getAltitude(this._origin),this._updateLines()}updatePoints(i){for(let s=0;s<this._points.length;s++)t(this._points[s],i[s]);u(this.frustum,this._points),this._updateLines()}get altitude(){return this._altitude}intersectsSphere(t){return h(this.frustum,t)}intersectsRay(t){return _(this.frustum,t)}intersectsLineSegment(t,i){return l(this.frustum,t,i)}intersectsPoint(t){return p(this.frustum,t)}_updateLines(){const t=this._points;for(let i=0;i<4;i++){const s=i+4;d(this.lines[i],t[i],t[s]),d(this.lines[i+4],t[i],3===i?t[0]:t[i+1]),d(this.lines[i+8],t[s],3===i?t[4]:t[s+1])}}}function d(t,s,e){t.origin=s,t.endpoint=e,i(t.direction,s,e)}c.planePointIndices=a,c.nearFarLineIndices=[[e.NEAR_BOTTOM_LEFT,e.FAR_BOTTOM_LEFT],[e.NEAR_BOTTOM_RIGHT,e.FAR_BOTTOM_RIGHT],[e.NEAR_TOP_RIGHT,e.FAR_TOP_RIGHT],[e.NEAR_TOP_LEFT,e.FAR_TOP_LEFT]];export{c as Frustum};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{lerp as e,clamp as t}from"../../../core/mathUtils.js";import{getMetersPerUnitForSR as i}from"../../../core/unitUtils.js";import{f as r,n as s,j as n,l as a}from"../../../chunks/vec32.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as o}from"../../../geometry/ellipsoidUtils.js";import h from"../../../geometry/Extent.js";import{ViewingMode as l}from"../../ViewingMode.js";import{computeInnerAltitudeFade as x}from"../environment/atmosphereUtils.js";function c(e,t,i){return e===l.Global?new M(i):new u(t,i)}class u{constructor(e,t){this._elevationProvider=e,this._referenceEllipsoid=o(t),this._unitInMeters=i(t,this._referenceEllipsoid.metersPerDegree)}compute(i,a,m,o,l){l||(l={near:0,far:0});let x=i[2]*this._unitInMeters;const c=x,u=x-o,M=this._elevationProvider?.visibleElevationBounds;M&&(x=u>=0?c-this._unitInMeters*M.min:this._unitInMeters*M.max-c);const _={x:(m=null!=m?m:new h({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0})).xmax-m.xmin,y:m.ymax-m.ymin,z:4*Math.max(m.xmax-m.xmin,m.ymax-m.ymin)},E=Math.max(_.x,_.y,_.z);r(v,a,i),j[0]=v[0]>0?m.xmax:m.xmin,j[1]=v[1]>0?m.ymax:m.ymin,j[2]=v[2]>0?E/2:-E/2,r(j,j,i),s(v,v);const I=1.1*n(j,v)*this._unitInMeters,g=Math.sqrt(x*(x+2*this._referenceEllipsoid.radius)),b=Math.max(m.xmax-m.xmin,m.ymax-m.ymin),w=b*d*this._unitInMeters,z=b*y*this._unitInMeters,U=t((x-z)/(w-z),0,1)**3,P=Math.min(e(g,I,U),g)*Math.max(Math.log(Math.abs(u)),1);return f(Math.min(P,Math.max(34064e4,E))/this._unitInMeters,p,this._unitInMeters,l)}}class M{constructor(e){this._referenceEllipsoid=o(e)}compute(i,r,s,n,m){m||(m={near:0,far:0});const o=a(i),h=o-this._referenceEllipsoid.radius,l=this._referenceEllipsoid.radius+Math.min(0,n),c=Math.abs(h-n),u=Math.max(c,Math.abs(h)),M=Math.sqrt(u*(u+2*l)),p=o+this._referenceEllipsoid.radius;return f(1.2*e(M,p,x(u)),t(2e4-(Math.log(u)-7.983)/9.011*19e3,1e3,2e4),1,m)}}function f(e,t,i,r){const s=_/i;return e/t>s?(r.far=e,r.near=r.far/t):(r.near=s,r.far=r.near*t),r}const p=2e4,_=2,d=.001,y=1e-4,j=m(),v=m();export{c as createNearFarHeuristic};
5
+ import{lerp as e,clamp as t}from"../../../core/mathUtils.js";import{getMetersPerUnitForSR as i}from"../../../core/unitUtils.js";import{f as r,n as s,k as n,l as a}from"../../../chunks/vec32.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as o}from"../../../geometry/ellipsoidUtils.js";import h from"../../../geometry/Extent.js";import{ViewingMode as l}from"../../ViewingMode.js";import{computeInnerAltitudeFade as x}from"../environment/atmosphereUtils.js";function c(e,t,i){return e===l.Global?new M(i):new u(t,i)}class u{constructor(e,t){this._elevationProvider=e,this._referenceEllipsoid=o(t),this._unitInMeters=i(t,this._referenceEllipsoid.metersPerDegree)}compute(i,a,m,o,l){l||(l={near:0,far:0});let x=i[2]*this._unitInMeters;const c=x,u=x-o,M=this._elevationProvider?.visibleElevationBounds;M&&(x=u>=0?c-this._unitInMeters*M.min:this._unitInMeters*M.max-c);const _={x:(m=null!=m?m:new h({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0})).xmax-m.xmin,y:m.ymax-m.ymin,z:4*Math.max(m.xmax-m.xmin,m.ymax-m.ymin)},I=Math.max(_.x,_.y,_.z);r(E,a,i),v[0]=E[0]>0?m.xmax:m.xmin,v[1]=E[1]>0?m.ymax:m.ymin,v[2]=E[2]>0?I/2:-I/2,r(v,v,i),s(E,E);const j=1.1*n(v,E)*this._unitInMeters,g=Math.sqrt(x*(x+2*this._referenceEllipsoid.radius)),b=Math.max(m.xmax-m.xmin,m.ymax-m.ymin),w=b*d*this._unitInMeters,z=b*y*this._unitInMeters,U=t((x-z)/(w-z),0,1)**3,P=Math.min(e(g,j,U),g)*Math.max(Math.log(Math.abs(u)),1);return f(Math.min(P,Math.max(34064e4,I))/this._unitInMeters,p,this._unitInMeters,l)}}class M{constructor(e){this._referenceEllipsoid=o(e)}compute(i,r,s,n,m){m||(m={near:0,far:0});const o=a(i),h=o-this._referenceEllipsoid.radius,l=this._referenceEllipsoid.radius+Math.min(0,n),c=Math.abs(h-n),u=Math.max(c,Math.abs(h)),M=Math.sqrt(u*(u+2*l)),p=o+this._referenceEllipsoid.radius;return f(1.2*e(M,p,x(u)),t(2e4-(Math.log(u)-7.983)/9.011*19e3,1e3,2e4),1,m)}}function f(e,t,i,r){const s=_/i;return e/t>s?(r.far=e,r.near=r.far/t):(r.near=s,r.far=r.near*t),r}const p=2e4,_=2,d=.001,y=1e-4,v=m(),E=m();export{c as createNearFarHeuristic};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../chunks/tslib.es6.js";import{neverReached as e}from"../../../../core/compilerUtils.js";import{clamp as i,acosClamped as a,deg2rad as r}from"../../../../core/mathUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{translate as n,rotate as c,identity as m}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{f as p,e as h,g as d,h as u,c as _,E as f,l as v,s as C,n as g,b as y,p as w,D as O,j as b}from"../../../../chunks/vec32.js";import{create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as x}from"../../../../geometry/ellipsoidUtils.js";import{wrap as j}from"../../../../geometry/support/ray.js";import{j as L,k as M,t as T}from"../../../../chunks/sphere.js";import{angle as A}from"../../../../geometry/support/vector.js";import{sv3d as E}from"../../../../geometry/support/vectorStacks.js";import{applyAll as z}from"../../camera/constraintUtils.js";import{ConstraintOptions as I}from"../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as D}from"../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as U}from"../../camera/constraintUtils/InteractionType.js";import{TiltMode as R}from"../../camera/constraintUtils/TiltMode.js";import{TiltRange as H}from"../Constraints.js";import{InteractiveController as N}from"./InteractiveController.js";import{panMotionToRotationMatrix as k,onSurfaceTiltToEyeTiltGlobal as P,offSurfaceTiltToEyeTiltGlobal as G}from"../utils/navigationUtils.js";import{viewAngle as F}from"../utils/viewUtils.js";import{headingTiltToDirectionUp as V}from"../../support/cameraUtils.js";import{createDirectionUp as B}from"../../support/cameraUtilsInternal.js";import{Camera as K}from"../../webgl-engine/lib/Camera.js";import{extractTransformation as X,isZeroTransformation as Z,extractTransformationKeyboard as q}from"../../../navigation/gamepadAndKeyboardUtils.js";let J=class extends N{constructor(t){super(t),this._filteredSurfaceElevation=0,this._transformation={translation:[0,0,0],heading:0,tilt:0,zoom:0},this._keysButtonState=[0,0,0,0,0,0,0,0,0,0,0,0],this._tmpCamera=new K,this._headingStart=0,this._constraintOptions=new I(D.ALL,U.NONE,0,new K,null,R.LOOK_AROUND)}handleEventGamepad(t){const e=X(t,this.view.navigation.gamepad,this._transformation);("end"===t.action||Z(e))&&this.finishController()}activateDirection(t){this._keysButtonState[t]=1,q(this._keysButtonState,this._transformation)}deactivateDirection(t){this._keysButtonState[t]=0;const e=q(this._keysButtonState,this._transformation);Z(e)&&this.finishController()}onControllerStart(t){this._filteredSurfaceElevation=this.view.pointsOfInterest.cameraOnSurface.location.z,this._headingStart=this.view.camera.heading,super.onControllerStart(t)}_updateFilteredSurfaceElevation(t){const e=this.view.pointsOfInterest.cameraOnSurface.location.z,i=1;this._filteredSurfaceElevation+=i*(e-this._filteredSurfaceElevation)*t}stepController(t,e){this._updateStartHeading(),this._updateFilteredSurfaceElevation(t),this.currentCamera.copyViewFrom(e),this._updateCameraCenter(),this._constraintOptions.interactionStartCamera?.copyFrom(this.currentCamera),this._calculateControlTransformation(t,this.currentCamera,at),this._applyDisabledMovementTypes(at),this._applyPan(at.pan),this._applyRotate(at.rotate),this._applyZoom(at.zoom),this._applyAscend(at.ascend),this._constraintOptions.interactionType=U.NONE,this._constraintOptions.selection=D.COLLISION,z(this.view,this.currentCamera,this._constraintOptions),super.stepController(t,e)}_updateStartHeading(){0!==this._transformation.heading&&(this._headingStart=this.view.camera.heading)}_applyRotate(t){if(!t.enabled)return;const e=this.currentCamera;p(rt,e.center,e.eye),h(rt,rt,t.matrix),e.center=d(rt,rt,e.eye),e.up=h(rt,e.up,t.matrix),this._constraintOptions.interactionType=U.LOOK_AROUND,this._constraintOptions.selection=D.ALL_EXCEPT_COLLISION,z(this.view,e,this._constraintOptions)}_applyPan(t,e=this.currentCamera){if(!t.enabled)return;e.eye=h(rt,e.eye,t.matrix),e.center=h(rt,e.center,t.matrix);this.view.state.isGlobal&&(e.up=h(rt,e.up,t.matrix)),this._constraintOptions.interactionType=U.PAN,this._constraintOptions.selection=D.ALL,z(this.view,e,this._constraintOptions)}_applyZoom(t){if(!t)return;const e=this.currentCamera.viewForward;this.currentCamera.eye=d(rt,this.currentCamera.eye,u(E.get(),e,t)),_(ot,e),f(ot,ot),this._constraintOptions.interactionDirection=ot,this._constraintOptions.interactionType=U.ZOOM,this._constraintOptions.selection=D.ALL_EXCEPT_COLLISION,z(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_applyAscend(t){if(!t)return;const e=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,E.get());this._constraintOptions.interactionDirection=_(ot,e);if(this.view.state.isGlobal){const e=v(this.currentCamera.eye),i=(e+t)/e;this.currentCamera.eye=u(rt,this.currentCamera.eye,i),this.currentCamera.center=u(rt,this.currentCamera.center,i)}else{const i=u(E.get(),e,t);this.currentCamera.eye=d(rt,this.currentCamera.eye,i),this.currentCamera.center=d(rt,this.currentCamera.center,i)}this._updateCameraCenter(),this._constraintOptions.interactionType=U.ASCEND,this._constraintOptions.selection=D.COLLISION,z(this.view,this.currentCamera,this._constraintOptions)&&this._updateCameraCenter(),this._constraintOptions.selection=D.ALL_EXCEPT_COLLISION,z(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_calculateControlTransformation(t,e,i){nt(i);const a=this._computeVelocities(t);this.view.state.isLocal?this._calculateControlTransformationLocal(a,e,i):this._calculateControlTransformationGlobal(a,e,i)}_updateCameraCenter(){const t=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,e=this.view.renderCoordsHelper,i=this.currentCamera.ray;this.currentCamera.center=e.intersectManifoldClosestSilhouette(i,t,rt)}_calculateControlTransformationLocal(t,a,r){const{viewRight:o,viewForward:s}=a,m=this._transformation,l=this.view.navigation.gamepad,p=C(E.get(),s[0],s[1],0);g(p,p);const h=m.translation[0]*t.pan;if(0!==h){const t=u(E.get(),o,h);n(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}switch(l.mode){case"pan":{const e=-m.translation[1]*t.pan;if(0!==e){const t=u(E.get(),p,e);n(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}r.zoom=m.zoom*t.zoom;break}case"zoom":r.zoom=(-m.translation[1]+m.zoom)*t.zoom;break;default:e(l.mode)}const d=m.translation[2]*t.ascend;r.ascend=d;const _=-m.heading*t.rotate;0!==_&&(c(r.rotate.matrix,r.rotate.matrix,_,this.view.renderCoordsHelper.worldUpAtPosition(a.eye,E.get())),r.rotate.enabled=!0);const f=m.tilt*t.rotate,v=F(this.view.renderCoordsHelper,a.center,a.eye),y=i(v+f,H.min,H.max)-v;y&&(c(r.rotate.matrix,r.rotate.matrix,y,o),r.rotate.enabled=!0)}_calculateControlTransformationGlobal(t,e,i){const{eye:a,viewRight:r}=e,o=this._transformation,s=this.view.navigation.gamepad,n=y(E.get(),r,a);g(n,n),f(n,n),k(this.startCamera,e,o,t,this.view.camera.heading,this._headingStart,this.view.camera.tilt,i,s),this._tmpCamera.copyFrom(this.currentCamera),this._applyPan(at.pan,this._tmpCamera);const m=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,l=o.translation[2]*t.ascend;i.ascend=l;const p=-o.heading*t.rotate;0!==p&&(c(i.rotate.matrix,i.rotate.matrix,p,this._tmpCamera.eye),i.rotate.enabled=!0);const h=o.tilt*t.rotate,d=this._clampTiltDeltaGlobalToValidRange(h,e.ray,m);0!==d&&(c(i.rotate.matrix,i.rotate.matrix,d,this._tmpCamera.viewRight),i.rotate.enabled=!0),i.zoom+=o.zoom*t.zoom}_clampTiltDeltaGlobalToValidRange(t,e,a){const r=x(this.view.spatialReference),o=P(H.min,e.origin,a,r);let s=0,n=0;const c=E.get();if(this.view.renderCoordsHelper.intersectManifold(e,a,c)){const t=F(this.view.renderCoordsHelper,c,e.origin);s=P(t,e.origin,a,r),n=P(H.max,e.origin,a,r)}else{L(M(T,a+r.radius),e,c);const t=Math.PI+A(e.direction,c);s=G(t,e.origin,a,r),n=G(H.max,e.origin,a,r)}return i(s+t,o,n)-s}_getPointAbsoluteSurfaceElevation(t,e,i){const{renderCoordsHelper:a}=this.view,r=a.getAltitude(t),o=e+Math.abs(r-e);return a.setAltitude(i,o,t),o}_clampedDistanceToSurface(t,e){const{renderCoordsHelper:i}=this.view,{camera:a}=this.view.state,{direction:r}=V(this.view,e,0,W,st),o=i.intersectManifoldClosestSilhouette(j(e,r),t,E.get()),s=w(e,o),n=i.intersectManifoldClosestSilhouette(j(e,O(E.get(),e,a.center)),t,E.get()),c=w(e,n);return Math.min(s,c)}_computeHeadingRotateRadius(t){const{renderCoordsHelper:e,state:i}=this.view,{camera:r,isGlobal:o}=i,s=e.intersectManifoldClosestSilhouette(r.ray,this._filteredSurfaceElevation,E.get());if(o){const e=p(E.get(),t,s),i=v(e);u(e,e,1/i);const r=g(E.get(),t),o=a(b(r,e));return i*Math.sin(Math.min(Y,o))}{const i=_(E.get(),t);return e.setAltitude(i,this._filteredSurfaceElevation),w(s,i)}}_minimumAscendVelocity(){return this.view.state.constraints.collision.enabled?0:tt}_computeVelocities(t){const e=this._filteredSurfaceElevation,a=e+x(this.view.spatialReference).radius,{camera:r,isGlobal:o}=this.view.state,s=E.get(),n=this._getPointAbsoluteSurfaceElevation(r.eye,e,s),c=this._clampedDistanceToSurface(e,s),m=r.width/2,l=$*r.width,p=$*r.width,h=c*Math.tan(.5*r.fovX)/m,d=h/a,u=h/this._computeHeadingRotateRadius(s),_=n-e;return{pan:(o?d:h)*l*t,ascend:Math.max(this._minimumAscendVelocity()*t,2**(l*t/m)*_-_),zoom:2**(l*t/m)*c-c,rotate:i(u*p,et,it)*t}}_applyDisabledMovementTypes(t){null==this.disableMovements||void 0!==this.disableMovements.mode&&this.view.state.viewingMode!==this.disableMovements.mode||(t.zoom=this.disableMovements.zoom?0:t.zoom,t.ascend=this.disableMovements.ascend?0:t.ascend,t.pan.enabled=!this.disableMovements.pan,this.disableMovements.pan&&m(t.pan.matrix),t.rotate.enabled=!this.disableMovements.rotate,this.disableMovements.rotate&&m(t.rotate.matrix))}static activatesFor(t,e){const i=X(e,t.navigation.gamepad,Q);return!("end"===e.action||Z(i))}};t([o({constructOnly:!0})],J.prototype,"gamepadDevice",void 0),t([o({constructOnly:!0})],J.prototype,"disableMovements",void 0),J=t([s("esri.views.3d.state.controllers.GamepadKeyboardController")],J);const Q={translation:[0,0,0],heading:0,tilt:0,zoom:0},W=80,Y=r(W),$=.75,tt=5,et=r(30),it=r(80),at={zoom:0,ascend:0,pan:{enabled:!1,matrix:l()},rotate:{enabled:!1,matrix:l()}},rt=S(),ot=S(),st=B();function nt(t){t.zoom=0,t.ascend=0,t.pan.enabled=!1,m(t.pan.matrix),t.rotate.enabled=!1,m(t.rotate.matrix)}export{J as GamepadKeyboardController};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import{neverReached as e}from"../../../../core/compilerUtils.js";import{clamp as i,acosClamped as a,deg2rad as r}from"../../../../core/mathUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{translate as n,rotate as c,identity as m}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{f as p,e as h,g as d,h as u,c as _,F as f,l as v,s as C,n as g,b as y,q as w,E as O,k as b}from"../../../../chunks/vec32.js";import{create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as x}from"../../../../geometry/ellipsoidUtils.js";import{wrap as j}from"../../../../geometry/support/ray.js";import{j as L,k as M,t as T}from"../../../../chunks/sphere.js";import{angle as A}from"../../../../geometry/support/vector.js";import{sv3d as E}from"../../../../geometry/support/vectorStacks.js";import{applyAll as z}from"../../camera/constraintUtils.js";import{ConstraintOptions as I}from"../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as U}from"../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as D}from"../../camera/constraintUtils/InteractionType.js";import{TiltMode as R}from"../../camera/constraintUtils/TiltMode.js";import{TiltRange as k}from"../Constraints.js";import{InteractiveController as H}from"./InteractiveController.js";import{panMotionToRotationMatrix as N,onSurfaceTiltToEyeTiltGlobal as P,offSurfaceTiltToEyeTiltGlobal as F}from"../utils/navigationUtils.js";import{viewAngle as G}from"../utils/viewUtils.js";import{headingTiltToDirectionUp as V}from"../../support/cameraUtils.js";import{createDirectionUp as B}from"../../support/cameraUtilsInternal.js";import{Camera as K}from"../../webgl-engine/lib/Camera.js";import{extractTransformation as X,isZeroTransformation as q,extractTransformationKeyboard as Z}from"../../../navigation/gamepadAndKeyboardUtils.js";let J=class extends H{constructor(t){super(t),this._filteredSurfaceElevation=0,this._transformation={translation:[0,0,0],heading:0,tilt:0,zoom:0},this._keysButtonState=[0,0,0,0,0,0,0,0,0,0,0,0],this._tmpCamera=new K,this._headingStart=0,this._constraintOptions=new I(U.ALL,D.NONE,0,new K,null,R.LOOK_AROUND)}handleEventGamepad(t){const e=X(t,this.view.navigation.gamepad,this._transformation);("end"===t.action||q(e))&&this.finishController()}activateDirection(t){this._keysButtonState[t]=1,Z(this._keysButtonState,this._transformation)}deactivateDirection(t){this._keysButtonState[t]=0;const e=Z(this._keysButtonState,this._transformation);q(e)&&this.finishController()}onControllerStart(t){this._filteredSurfaceElevation=this.view.pointsOfInterest.cameraOnSurface.location.z,this._headingStart=this.view.camera.heading,super.onControllerStart(t)}_updateFilteredSurfaceElevation(t){const e=this.view.pointsOfInterest.cameraOnSurface.location.z,i=1;this._filteredSurfaceElevation+=i*(e-this._filteredSurfaceElevation)*t}stepController(t,e){this._updateStartHeading(),this._updateFilteredSurfaceElevation(t),this.currentCamera.copyViewFrom(e),this._updateCameraCenter(),this._constraintOptions.interactionStartCamera?.copyFrom(this.currentCamera),this._calculateControlTransformation(t,this.currentCamera,at),this._applyDisabledMovementTypes(at),this._applyPan(at.pan),this._applyRotate(at.rotate),this._applyZoom(at.zoom),this._applyAscend(at.ascend),this._constraintOptions.interactionType=D.NONE,this._constraintOptions.selection=U.COLLISION,z(this.view,this.currentCamera,this._constraintOptions),super.stepController(t,e)}_updateStartHeading(){0!==this._transformation.heading&&(this._headingStart=this.view.camera.heading)}_applyRotate(t){if(!t.enabled)return;const e=this.currentCamera;p(rt,e.center,e.eye),h(rt,rt,t.matrix),e.center=d(rt,rt,e.eye),e.up=h(rt,e.up,t.matrix),this._constraintOptions.interactionType=D.LOOK_AROUND,this._constraintOptions.selection=U.ALL_EXCEPT_COLLISION,z(this.view,e,this._constraintOptions)}_applyPan(t,e=this.currentCamera){if(!t.enabled)return;e.eye=h(rt,e.eye,t.matrix),e.center=h(rt,e.center,t.matrix);this.view.state.isGlobal&&(e.up=h(rt,e.up,t.matrix)),this._constraintOptions.interactionType=D.PAN,this._constraintOptions.selection=U.ALL,z(this.view,e,this._constraintOptions)}_applyZoom(t){if(!t)return;const e=this.currentCamera.viewForward;this.currentCamera.eye=d(rt,this.currentCamera.eye,u(E.get(),e,t)),_(ot,e),f(ot,ot),this._constraintOptions.interactionDirection=ot,this._constraintOptions.interactionType=D.ZOOM,this._constraintOptions.selection=U.ALL_EXCEPT_COLLISION,z(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_applyAscend(t){if(!t)return;const e=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,E.get());this._constraintOptions.interactionDirection=_(ot,e);if(this.view.state.isGlobal){const e=v(this.currentCamera.eye),i=(e+t)/e;this.currentCamera.eye=u(rt,this.currentCamera.eye,i),this.currentCamera.center=u(rt,this.currentCamera.center,i)}else{const i=u(E.get(),e,t);this.currentCamera.eye=d(rt,this.currentCamera.eye,i),this.currentCamera.center=d(rt,this.currentCamera.center,i)}this._updateCameraCenter(),this._constraintOptions.interactionType=D.ASCEND,this._constraintOptions.selection=U.COLLISION,z(this.view,this.currentCamera,this._constraintOptions)&&this._updateCameraCenter(),this._constraintOptions.selection=U.ALL_EXCEPT_COLLISION,z(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_calculateControlTransformation(t,e,i){nt(i);const a=this._computeVelocities(t);this.view.state.isLocal?this._calculateControlTransformationLocal(a,e,i):this._calculateControlTransformationGlobal(a,e,i)}_updateCameraCenter(){const t=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,e=this.view.renderCoordsHelper,i=this.currentCamera.ray;this.currentCamera.center=e.intersectManifoldClosestSilhouette(i,t,rt)}_calculateControlTransformationLocal(t,a,r){const{viewRight:o,viewForward:s}=a,m=this._transformation,l=this.view.navigation.gamepad,p=C(E.get(),s[0],s[1],0);g(p,p);const h=m.translation[0]*t.pan;if(0!==h){const t=u(E.get(),o,h);n(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}switch(l.mode){case"pan":{const e=-m.translation[1]*t.pan;if(0!==e){const t=u(E.get(),p,e);n(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}r.zoom=m.zoom*t.zoom;break}case"zoom":r.zoom=(-m.translation[1]+m.zoom)*t.zoom;break;default:e(l.mode)}const d=m.translation[2]*t.ascend;r.ascend=d;const _=-m.heading*t.rotate;0!==_&&(c(r.rotate.matrix,r.rotate.matrix,_,this.view.renderCoordsHelper.worldUpAtPosition(a.eye,E.get())),r.rotate.enabled=!0);const f=m.tilt*t.rotate,v=G(this.view.renderCoordsHelper,a.center,a.eye),y=i(v+f,k.min,k.max)-v;y&&(c(r.rotate.matrix,r.rotate.matrix,y,o),r.rotate.enabled=!0)}_calculateControlTransformationGlobal(t,e,i){const{eye:a,viewRight:r}=e,o=this._transformation,s=this.view.navigation.gamepad,n=y(E.get(),r,a);g(n,n),f(n,n),N(this.startCamera,e,o,t,this.view.camera.heading,this._headingStart,this.view.camera.tilt,i,s),this._tmpCamera.copyFrom(this.currentCamera),this._applyPan(at.pan,this._tmpCamera);const m=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,l=o.translation[2]*t.ascend;i.ascend=l;const p=-o.heading*t.rotate;0!==p&&(c(i.rotate.matrix,i.rotate.matrix,p,this._tmpCamera.eye),i.rotate.enabled=!0);const h=o.tilt*t.rotate,d=this._clampTiltDeltaGlobalToValidRange(h,e.ray,m);0!==d&&(c(i.rotate.matrix,i.rotate.matrix,d,this._tmpCamera.viewRight),i.rotate.enabled=!0),i.zoom+=o.zoom*t.zoom}_clampTiltDeltaGlobalToValidRange(t,e,a){const r=x(this.view.spatialReference),o=P(k.min,e.origin,a,r);let s=0,n=0;const c=E.get();if(this.view.renderCoordsHelper.intersectManifold(e,a,c)){const t=G(this.view.renderCoordsHelper,c,e.origin);s=P(t,e.origin,a,r),n=P(k.max,e.origin,a,r)}else{L(M(T,a+r.radius),e,c);const t=Math.PI+A(e.direction,c);s=F(t,e.origin,a,r),n=F(k.max,e.origin,a,r)}return i(s+t,o,n)-s}_getPointAbsoluteSurfaceElevation(t,e,i){const{renderCoordsHelper:a}=this.view,r=a.getAltitude(t),o=e+Math.abs(r-e);return a.setAltitude(i,o,t),o}_clampedDistanceToSurface(t,e){const{renderCoordsHelper:i}=this.view,{camera:a}=this.view.state,{direction:r}=V(this.view,e,0,W,st),o=i.intersectManifoldClosestSilhouette(j(e,r),t,E.get()),s=w(e,o),n=i.intersectManifoldClosestSilhouette(j(e,O(E.get(),e,a.center)),t,E.get()),c=w(e,n);return Math.min(s,c)}_computeHeadingRotateRadius(t){const{renderCoordsHelper:e,state:i}=this.view,{camera:r,isGlobal:o}=i,s=e.intersectManifoldClosestSilhouette(r.ray,this._filteredSurfaceElevation,E.get());if(o){const e=p(E.get(),t,s),i=v(e);u(e,e,1/i);const r=g(E.get(),t),o=a(b(r,e));return i*Math.sin(Math.min(Y,o))}{const i=_(E.get(),t);return e.setAltitude(i,this._filteredSurfaceElevation),w(s,i)}}_minimumAscendVelocity(){return this.view.state.constraints.collision.enabled?0:tt}_computeVelocities(t){const e=this._filteredSurfaceElevation,a=e+x(this.view.spatialReference).radius,{camera:r,isGlobal:o}=this.view.state,s=E.get(),n=this._getPointAbsoluteSurfaceElevation(r.eye,e,s),c=this._clampedDistanceToSurface(e,s),m=r.width/2,l=$*r.width,p=$*r.width,h=c*Math.tan(.5*r.fovX)/m,d=h/a,u=h/this._computeHeadingRotateRadius(s),_=n-e;return{pan:(o?d:h)*l*t,ascend:Math.max(this._minimumAscendVelocity()*t,2**(l*t/m)*_-_),zoom:2**(l*t/m)*c-c,rotate:i(u*p,et,it)*t}}_applyDisabledMovementTypes(t){null==this.disableMovements||void 0!==this.disableMovements.mode&&this.view.state.viewingMode!==this.disableMovements.mode||(t.zoom=this.disableMovements.zoom?0:t.zoom,t.ascend=this.disableMovements.ascend?0:t.ascend,t.pan.enabled=!this.disableMovements.pan,this.disableMovements.pan&&m(t.pan.matrix),t.rotate.enabled=!this.disableMovements.rotate,this.disableMovements.rotate&&m(t.rotate.matrix))}static activatesFor(t,e){const i=X(e,t.navigation.gamepad,Q);return!("end"===e.action||q(i))}};t([o({constructOnly:!0})],J.prototype,"gamepadDevice",void 0),t([o({constructOnly:!0})],J.prototype,"disableMovements",void 0),J=t([s("esri.views.3d.state.controllers.GamepadKeyboardController")],J);const Q={translation:[0,0,0],heading:0,tilt:0,zoom:0},W=80,Y=r(W),$=.75,tt=5,et=r(30),it=r(80),at={zoom:0,ascend:0,pan:{enabled:!1,matrix:l()},rotate:{enabled:!1,matrix:l()}},rt=S(),ot=S(),st=B();function nt(t){t.zoom=0,t.ascend=0,t.pan.enabled=!1,m(t.pan.matrix),t.rotate.enabled=!1,m(t.rotate.matrix)}export{J as GamepadKeyboardController};
@@ -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{acosClamped as i,clamp as s}from"../../../../core/mathUtils.js";import{createScreenPointArray as r}from"../../../../core/screenUtils.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 e}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromRotation as a,rotate as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as h}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{c,f as l,l as _,j as v,n as f,g as C,h as P,b as u,e as w}from"../../../../chunks/vec32.js";import{create as E}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as d}from"../../../../geometry/ellipsoidUtils.js";import{applyAll as j}from"../../camera/constraintUtils.js";import{ConstraintOptions as R}from"../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as T}from"../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as y}from"../../camera/constraintUtils/InteractionType.js";import{TiltMode as U}from"../../camera/constraintUtils/TiltMode.js";import{getVoxelWasm as g}from"../../layers/VoxelWasm.js";import{TiltRange as x}from"../Constraints.js";import{InteractiveController as M}from"./InteractiveController.js";import{contentIntersectorOptions as O,normalizeCoordinate as b,rotatePivotDistanceModifier as D,rotatePivotMinDistanceModifier as A,decideNavigationMode as N,rotateScreenPixelArea as L,NavigationMode as V}from"../utils/navigationUtils.js";var H;!function(t){t[t.CENTER=0]="CENTER",t[t.EYE=1]="EYE"}(H||(H={}));let S=class extends M{get _intersectionHelper(){return this.view.sceneIntersectionHelper}constructor(t){super(t),this.pivot=H.CENTER,this._rotScale=0,this._lastPoint=m(),this._tmpWorldUp=E(),this._tmpViewDir=E(),this._tmpRotCurPoint=m(),this._tmpTransf=p(),this._tmpAxis=E(),this._tmpPivotPoint=E(),this._pivotPos=E(),this._constraintOptions=new R(T.ALL,y.TUMBLE,0,this.startCamera)}initialize(){this._rotScale=this.pivot===H.CENTER?3:1.5}begin(t){if(this.active){switch(this.pivot){case H.EYE:c(this._pivotPos,this.startCamera.eye),this._constraintOptions.interactionType=y.LOOK_AROUND,this._constraintOptions.tiltMode=U.LOOK_AROUND,this._constraintOptions.selection=T.NONE;break;case H.CENTER:{const i=this._intersectionHelper.intersectRayFreePointFallback(this.startCamera.ray,this._pivotPos,0===this.view.map.ground.opacity?O:{});i||c(this._pivotPos,this.startCamera.center),this._constrainPivotPoint(t,i),this.startCamera.center=this._pivotPos,this._constraintOptions.interactionType=y.TUMBLE,this._constraintOptions.tiltMode=U.TUMBLE,this._constraintOptions.selection=T.ALL&~T.DISTANCE;break}}b(this.startCamera,t,this._lastPoint)}}_constrainPivotPoint(t,i){const s=this.startCamera,o=E();l(o,this._pivotPos,s.eye);const e=_(o),a=Math.abs(this.view.camera.position.z);this.view.renderCoordsHelper.worldUpAtPosition(s.eye,I);let n=Math.max(Math.min(D,1/Math.abs(v(I,s.viewForward)))*a,A);i&&(n=Math.min(e,n));const p=d(this.view.spatialReference),h=r(s.width/s.pixelRatio*.5,s.height/s.pixelRatio*.5),m=N(this.startCamera,h,p);let u=this.view._stage.renderView.getMinimalDepthForArea(g(this.view),s.fullWidth/s.pixelRatio*.5,s.fullHeight/s.pixelRatio*.5,s,2.5*L,L),w=this.view._stage.renderView.getMinimalDepthForArea(g(this.view),t[0],t[1],s,L);null==u&&null==w||(u=u??w??0,w=null==w||m===V.Horizontal?u:w,n=u>w?w:u,n=i?Math.min(n,e):n),f(o,o),c(this._pivotPos,C(this._tmpPivotPoint,s.eye,P(this._tmpPivotPoint,o,n)))}update(t){if(this.active){switch(this.pivot){case H.EYE:this.currentCamera.center=this._applyRotation(this.currentCamera,t,this.currentCamera.center,this._pivotPos);break;case H.CENTER:this.currentCamera.center=this._pivotPos,this.currentCamera.eye=this._applyRotation(this.currentCamera,t,this.currentCamera.eye,this._pivotPos)}j(this.view,this.currentCamera,this._constraintOptions),this.commitCamera()}}end(){this.active&&this.finishController()}_applyRotation(t,r,o,e){this.view.renderCoordsHelper.worldUpAtPosition(e,this._tmpWorldUp),b(t,r,this._tmpRotCurPoint);let p=(this._lastPoint[1]-this._tmpRotCurPoint[1])*this._rotScale,m=(this._tmpRotCurPoint[0]-this._lastPoint[0])*this._rotScale;l(this._tmpViewDir,o,e);const c=_(this._tmpViewDir),f=i(v(this._tmpViewDir,this._tmpWorldUp)/c);if(this.pivot===H.EYE){p*=-.5;const t=.5*Math.PI-f,i=.5*Math.PI*.99;p=t-Math.max(-i,Math.min(i,t+p))}return p=s(p+f,x.min,x.max)-f,u(this._tmpAxis,t.up,this._tmpViewDir),this.pivot===H.CENTER&&(m=-m),a(this._tmpTransf,m,this._tmpWorldUp),n(this._tmpTransf,this._tmpTransf,p,this._tmpAxis),w(this._tmpViewDir,this._tmpViewDir,this._tmpTransf),t.up=w(k,t.up,this._tmpTransf),C(k,e,this._tmpViewDir),h(this._lastPoint,this._tmpRotCurPoint),k}};t([o()],S.prototype,"pivot",void 0),S=t([e("esri.views.3d.state.controllers.RotateController")],S);const k=E(),I=E();export{H as PivotPoint,S as RotateController};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import{acosClamped as i,clamp as s}from"../../../../core/mathUtils.js";import{createScreenPointArray as r}from"../../../../core/screenUtils.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 e}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromRotation as a,rotate as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as h}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{c,f as l,l as _,k as v,n as f,g as C,h as P,b as u,e as w}from"../../../../chunks/vec32.js";import{create as E}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as d}from"../../../../geometry/ellipsoidUtils.js";import{applyAll as R}from"../../camera/constraintUtils.js";import{ConstraintOptions as j}from"../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as T}from"../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as y}from"../../camera/constraintUtils/InteractionType.js";import{TiltMode as U}from"../../camera/constraintUtils/TiltMode.js";import{getVoxelWasm as g}from"../../layers/VoxelWasm.js";import{TiltRange as x}from"../Constraints.js";import{InteractiveController as M}from"./InteractiveController.js";import{contentIntersectorOptions as O,normalizeCoordinate as b,rotatePivotDistanceModifier as D,rotatePivotMinDistanceModifier as A,decideNavigationMode as N,rotateScreenPixelArea as L,NavigationMode as V}from"../utils/navigationUtils.js";var k;!function(t){t[t.CENTER=0]="CENTER",t[t.EYE=1]="EYE"}(k||(k={}));let H=class extends M{get _intersectionHelper(){return this.view.sceneIntersectionHelper}constructor(t){super(t),this.pivot=k.CENTER,this._rotScale=0,this._lastPoint=m(),this._tmpWorldUp=E(),this._tmpViewDir=E(),this._tmpRotCurPoint=m(),this._tmpTransf=p(),this._tmpAxis=E(),this._tmpPivotPoint=E(),this._pivotPos=E(),this._constraintOptions=new j(T.ALL,y.TUMBLE,0,this.startCamera)}initialize(){this._rotScale=this.pivot===k.CENTER?3:1.5}begin(t){if(this.active){switch(this.pivot){case k.EYE:c(this._pivotPos,this.startCamera.eye),this._constraintOptions.interactionType=y.LOOK_AROUND,this._constraintOptions.tiltMode=U.LOOK_AROUND,this._constraintOptions.selection=T.NONE;break;case k.CENTER:{const i=this._intersectionHelper.intersectRayFreePointFallback(this.startCamera.ray,this._pivotPos,0===this.view.map.ground.opacity?O:{});i||c(this._pivotPos,this.startCamera.center),this._constrainPivotPoint(t,i),this.startCamera.center=this._pivotPos,this._constraintOptions.interactionType=y.TUMBLE,this._constraintOptions.tiltMode=U.TUMBLE,this._constraintOptions.selection=T.ALL&~T.DISTANCE;break}}b(this.startCamera,t,this._lastPoint)}}_constrainPivotPoint(t,i){const s=this.startCamera,o=E();l(o,this._pivotPos,s.eye);const e=_(o),a=Math.abs(this.view.camera.position.z);this.view.renderCoordsHelper.worldUpAtPosition(s.eye,I);let n=Math.max(Math.min(D,1/Math.abs(v(I,s.viewForward)))*a,A);i&&(n=Math.min(e,n));const p=d(this.view.spatialReference),h=r(s.width/s.pixelRatio*.5,s.height/s.pixelRatio*.5),m=N(this.startCamera,h,p);let u=this.view._stage.renderView.getMinimalDepthForArea(g(this.view),s.fullWidth/s.pixelRatio*.5,s.fullHeight/s.pixelRatio*.5,s,2.5*L,L),w=this.view._stage.renderView.getMinimalDepthForArea(g(this.view),t[0],t[1],s,L);null==u&&null==w||(u=u??w??0,w=null==w||m===V.Horizontal?u:w,n=u>w?w:u,n=i?Math.min(n,e):n),f(o,o),c(this._pivotPos,C(this._tmpPivotPoint,s.eye,P(this._tmpPivotPoint,o,n)))}update(t){if(this.active){switch(this.pivot){case k.EYE:this.currentCamera.center=this._applyRotation(this.currentCamera,t,this.currentCamera.center,this._pivotPos);break;case k.CENTER:this.currentCamera.center=this._pivotPos,this.currentCamera.eye=this._applyRotation(this.currentCamera,t,this.currentCamera.eye,this._pivotPos)}R(this.view,this.currentCamera,this._constraintOptions),this.commitCamera()}}end(){this.active&&this.finishController()}_applyRotation(t,r,o,e){this.view.renderCoordsHelper.worldUpAtPosition(e,this._tmpWorldUp),b(t,r,this._tmpRotCurPoint);let p=(this._lastPoint[1]-this._tmpRotCurPoint[1])*this._rotScale,m=(this._tmpRotCurPoint[0]-this._lastPoint[0])*this._rotScale;l(this._tmpViewDir,o,e);const c=_(this._tmpViewDir),f=i(v(this._tmpViewDir,this._tmpWorldUp)/c);if(this.pivot===k.EYE){p*=-.5;const t=.5*Math.PI-f,i=.5*Math.PI*.99;p=t-Math.max(-i,Math.min(i,t+p))}return p=s(p+f,x.min,x.max)-f,u(this._tmpAxis,t.up,this._tmpViewDir),this.pivot===k.CENTER&&(m=-m),a(this._tmpTransf,m,this._tmpWorldUp),n(this._tmpTransf,this._tmpTransf,p,this._tmpAxis),w(this._tmpViewDir,this._tmpViewDir,this._tmpTransf),t.up=w(S,t.up,this._tmpTransf),C(S,e,this._tmpViewDir),h(this._lastPoint,this._tmpRotCurPoint),S}};t([o()],H.prototype,"pivot",void 0),H=t([e("esri.views.3d.state.controllers.RotateController")],H);const S=E(),I=E();export{k as PivotPoint,H as RotateController};
@@ -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{cyclicalPI as i}from"../../../../../core/Cyclical.js";import{deg2rad as e}from"../../../../../core/mathUtils.js";import{createScreenPointArray as n,screenPointObjectToArray as s,createRenderScreenPointArray3 as o}from"../../../../../core/screenUtils.js";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import{copy as a,distance as m}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{c as h,E as c,l as _,f as p,n as l,g as u,h as g,j as d}from"../../../../../chunks/vec32.js";import{create as P}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as C}from"../../../../../geometry/ellipsoidUtils.js";import{wrapAxisAngle as v}from"../../../../../geometry/support/axisAngle.js";import{create as w,fromPositionAndNormal as M,getNormal as S}from"../../../../../geometry/support/plane.js";import{d as b,g as f}from"../../../../../chunks/sphere.js";import{pixelDistanceToInteractionFactor as j,applyAll as E}from"../../../camera/constraintUtils.js";import{ConstraintOptions as O}from"../../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as y}from"../../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as A}from"../../../camera/constraintUtils/InteractionType.js";import{ExponentialFalloff as z}from"../../../input/util.js";import{InteractiveController as R}from"../InteractiveController.js";import{PanPlanarMomentumController as x}from"../momentum/PanPlanarMomentumController.js";import{PanSphericalMomentumController as k}from"../momentum/PanSphericalMomentumController.js";import{RotationMomentumController as H}from"../momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as F}from"../momentum/ZoomPlanarMomentumController.js";import{ZoomSphericalMomentumController as T}from"../momentum/ZoomSphericalMomentumController.js";import{NavigationMode as U,pickPointAndInitSphere as D,contentIntersectorOptions as I,SpherePickPointFallback as L,decideNavigationMode as Z,sphereOrPlanePointFromScreenPoint as G,panDistanceModifier as N,minHeightLimit as B,screenPixelArea as V,intersectPlaneFromScreenPointAtEye as q,applyZoomOnSphere as J,preserveHeadingThreshold as K,applyPanSphericalPreserveHeading as Q,applyPanSphericalDirectRotation as W,normalizeRotationDelta as X,applyRotation as Y,applyPanPlanar as $,applyZoomToPoint as tt}from"../../utils/navigationUtils.js";import{Camera as it}from"../../../webgl-engine/lib/Camera.js";import{PanPlanarMomentumEstimator as et}from"../../../../navigation/PanPlanarMomentumEstimator.js";import{PanSphericalMomentumEstimator as nt}from"../../../../navigation/PanSphericalMomentumEstimator.js";import{RotationMomentumEstimator as st}from"../../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as ot}from"../../../../navigation/ZoomMomentumEstimator.js";let rt=class extends R{constructor(){super(...arguments),this._smoothRotation=new z(.05),this._rotationAxis=P(),this._beginAngle=0,this._beginHeading=0,this._panningPlane=w(),this._beginRadius=0,this._smoothScaling=new z(.05),this._zoomCenterScreen=n(),this._zoomMomentumEstimator=new ot,this._rotationMomentumEstimator=new st,this._panSphericalMomentumEstimator=new nt,this._panPlanarMomentumEstimator=new et,this._adjustedSphere=b(),this._tmp3d=P(),this._tmpScreenPointArray=n(),this._beginScreenPoint=n(),this._beginScenePoint=P(),this._screenPickPoint=n(),this._scenePickPoint=P(),this._mode=U.Horizontal,this._sphere=b(),this._pointerCount=0,this._tmpInteractionDirection=P(),this._beginCamera=new it,this._constraintOptions=new O(y.ALL,A.NONE,0,this._beginCamera)}get _intersectionHelper(){return this.view.sceneIntersectionHelper}begin(t){if(!this.active)return;this._zoomMomentumEstimator.enabled=this._rotationMomentumEstimator.enabled=this._panPlanarMomentumEstimator.enabled=this._panSphericalMomentumEstimator.enabled=this.view.navigation.momentumEnabled,this._beginHeading=-i.normalize(e(this.view.camera.heading)),this._beginRadius=t.radius,this._pointerCount=t.pointers.size,this._beginAngle=t.angle,this._smoothRotation.reset(),s(t.center,this._screenPickPoint),a(this._beginScreenPoint,this._screenPickPoint);const n=C(this.view.spatialReference),o=D(this._intersectionHelper,this.startCamera,this._screenPickPoint,n,L.Silhouette,0===this.view.map.ground.opacity?I:{});null!=o.scenePickPoint&&(this._scenePickPoint=o.scenePickPoint,this._sphere=o.sphere,h(this._beginScenePoint,this._scenePickPoint),this._mode=Z(this.startCamera,this._screenPickPoint,n),this._mode===U.Vertical&&this._preparePlanarPanMode(t,o.hasGeometryIntersection),this._beginCamera.copyFrom(this.startCamera))}update(t){if(!this.active)return;this.currentCamera.copyFrom(this.startCamera);const i=t.pointers.size>1;this._mode===U.Horizontal?(i&&this._zoomSpherical(t),this._panningSpherical(t),i&&this._rotateSpherical(t)):(i&&this._zoomPlanar(t),this._panningPlanar(t),i&&this._rotatePlanar(t)),this.commitCamera()}end(t){t.pointers.size===this._pointerCount&&this.update(t),this.finishController();const i=this._zoomMomentumEstimator.evaluateMomentum();if(i)return this._mode===U.Horizontal?new T({view:this.view,momentum:i,screenCenter:this._zoomCenterScreen,sceneCenter:this._beginScenePoint,radius:this._sphere[3]}):new F({view:this.view,momentum:i,zoomCenter:this._beginScenePoint});const e=this._rotationMomentumEstimator.evaluateMomentum();if(e)return new H({view:this.view,momentum:e,center:f(this._sphere),axis:this._rotationAxis});if(this._mode===U.Horizontal){const t=this._panSphericalMomentumEstimator.evaluateMomentum();if(t)return new k({view:this.view,momentum:t})}else{const t=this._panPlanarMomentumEstimator.evaluateMomentum();if(t)return new x({view:this.view,momentum:t})}return null}_preparePlanarPanMode(t,i){const e=c(this._tmp3d,this.startCamera.viewForward);M(this._scenePickPoint,e,this._panningPlane);const r=n(this._screenPickPoint[0],0),a=P(),m=_(this.startCamera.eye);this._adjustedSphere[3]=m<this._sphere[3]?m-100:this._sphere[3],G(this._adjustedSphere,this.startCamera,r,a);const C=o();this.startCamera.projectToRenderScreen(a,C);const v=P(),w=P(),b=P();p(v,this._scenePickPoint,this.currentCamera.eye);const f=_(v);l(v,v);const j=N*Math.max(Math.abs(this.view.camera.position.z),B),E=this.view._stage.renderView.getMinimalDepthForArea(null,this._screenPickPoint[0],this._screenPickPoint[1],this.view.state.camera,V);let O=null!=E?E:j;O=i?Math.min(O,f):O,h(b,u(w,this.currentCamera.eye,g(w,v,O))),this._panningPlane[3]=-d(S(this._panningPlane),b),this.startCamera.center=u(w,this.startCamera.eye,g(w,this.startCamera.viewForward,O));const y=s(t.center,this._tmpScreenPointArray);q(this._panningPlane,this.startCamera,y,this._beginScenePoint)}_zoomSpherical(t){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._smoothScaling.gain=e,this._smoothScaling.update(i),J(this._sphere,this.currentCamera,this._smoothScaling.value),s(t.center,this._zoomCenterScreen),this._zoomMomentumEstimator.add(this._smoothScaling.value,.001*t.timestamp),this._constraintOptions.interactionType=A.ZOOM,this._constraintOptions.interactionFactor=j(t.radius-this._beginRadius),E(this.view,this.currentCamera,this._constraintOptions)}_panningSpherical(t){const i=s(t.center,this._tmpScreenPointArray);G(this._sphere,this.currentCamera,i,this._tmp3d),K(this._beginScenePoint,d(this.currentCamera.up,this._beginScenePoint),this._sphere[3],this._beginHeading,this.view.camera.tilt,this.startCamera)?(Q(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this._beginHeading,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumPreserveHeading(i,this._tmp3d,.001*t.timestamp,this.startCamera,this._sphere,this._beginHeading,this.view.camera.tilt)):(W(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumDirectRotation(i,this._tmp3d,.001*t.timestamp,this.startCamera,this._sphere[3],this.view.camera.tilt)),this._constraintOptions.interactionType=A.PAN,this._constraintOptions.interactionFactor=j(m(this._screenPickPoint,i)),E(this.view,this.currentCamera,this._constraintOptions)}_rotateSpherical(t){l(this._rotationAxis,this._scenePickPoint),this.currentCamera.aboveGround||c(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value,e=i+X(t.angle-i),n=.00125*Math.min(Math.max(t.radius,40),120);this._smoothRotation.gain=n,this._smoothRotation.update(e);const s=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(s,.001*t.timestamp),Y(this.currentCamera,f(this._sphere),v(this._rotationAxis,s)),this._constraintOptions.interactionType=A.TUMBLE,this._constraintOptions.interactionFactor=j(t.radius*e),E(this.view,this.currentCamera,this._constraintOptions)}_panningPlanar(t){const i=s(t.center,this._tmpScreenPointArray);q(this._panningPlane,this.currentCamera,i,this._tmp3d)&&($(this.currentCamera,this._beginScenePoint,this._tmp3d),this._panPlanarMomentumEstimator.add(i,this._tmp3d,.001*t.timestamp),this._constraintOptions.interactionType=A.PAN,this._constraintOptions.interactionFactor=j(m(this._beginScreenPoint,i)),this._constraintOptions.interactionDirection=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,this._tmpInteractionDirection),E(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null)}_zoomPlanar(t){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._smoothScaling.gain=e,this._smoothScaling.update(i),this._zoomMomentumEstimator.add(this._smoothScaling.value,.001*t.timestamp),tt(this.currentCamera,this._beginScenePoint,this._smoothScaling.value,this.view.state.constraints.minimumPoiDistance),this._constraintOptions.interactionType=A.ZOOM,this._constraintOptions.interactionFactor=j(t.radius-this._beginRadius),E(this.view,this.currentCamera,this._constraintOptions)}_rotatePlanar(t){h(this._rotationAxis,this._beginScenePoint),this.currentCamera.aboveGround||c(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value;let e=t.angle-i;e=X(e);const n=i+e,s=.00125*Math.min(Math.max(t.radius,40),120);this._smoothRotation.gain=s,this._smoothRotation.update(n);const o=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(o,.001*t.timestamp),Y(this.currentCamera,f(this._sphere),v(this._rotationAxis,o)),this._constraintOptions.interactionType=A.TUMBLE,this._constraintOptions.interactionFactor=j(t.radius*o),E(this.view,this.currentCamera,this._constraintOptions)}};rt=t([r("esri.views.3d.state.controllers.global.PinchAndPanController")],rt);export{rt as PinchAndPanController};
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import{cyclicalPI as i}from"../../../../../core/Cyclical.js";import{deg2rad as e}from"../../../../../core/mathUtils.js";import{createScreenPointArray as n,screenPointObjectToArray as s,createRenderScreenPointArray3 as o}from"../../../../../core/screenUtils.js";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import{copy as a,distance as m}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{c as h,F as c,l as _,f as p,n as l,g as u,h as g,k as d}from"../../../../../chunks/vec32.js";import{create as P}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as C}from"../../../../../geometry/ellipsoidUtils.js";import{wrapAxisAngle as v}from"../../../../../geometry/support/axisAngle.js";import{create as w,fromPositionAndNormal as M,getNormal as S}from"../../../../../geometry/support/plane.js";import{d as b,g as f}from"../../../../../chunks/sphere.js";import{pixelDistanceToInteractionFactor as j,applyAll as E}from"../../../camera/constraintUtils.js";import{ConstraintOptions as O}from"../../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as y}from"../../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as A}from"../../../camera/constraintUtils/InteractionType.js";import{ExponentialFalloff as z}from"../../../input/util.js";import{InteractiveController as R}from"../InteractiveController.js";import{PanPlanarMomentumController as k}from"../momentum/PanPlanarMomentumController.js";import{PanSphericalMomentumController as x}from"../momentum/PanSphericalMomentumController.js";import{RotationMomentumController as H}from"../momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as F}from"../momentum/ZoomPlanarMomentumController.js";import{ZoomSphericalMomentumController as T}from"../momentum/ZoomSphericalMomentumController.js";import{NavigationMode as U,pickPointAndInitSphere as D,contentIntersectorOptions as I,SpherePickPointFallback as L,decideNavigationMode as Z,sphereOrPlanePointFromScreenPoint as G,panDistanceModifier as N,minHeightLimit as B,screenPixelArea as V,intersectPlaneFromScreenPointAtEye as q,applyZoomOnSphere as J,preserveHeadingThreshold as K,applyPanSphericalPreserveHeading as Q,applyPanSphericalDirectRotation as W,normalizeRotationDelta as X,applyRotation as Y,applyPanPlanar as $,applyZoomToPoint as tt}from"../../utils/navigationUtils.js";import{Camera as it}from"../../../webgl-engine/lib/Camera.js";import{PanPlanarMomentumEstimator as et}from"../../../../navigation/PanPlanarMomentumEstimator.js";import{PanSphericalMomentumEstimator as nt}from"../../../../navigation/PanSphericalMomentumEstimator.js";import{RotationMomentumEstimator as st}from"../../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as ot}from"../../../../navigation/ZoomMomentumEstimator.js";let rt=class extends R{constructor(){super(...arguments),this._smoothRotation=new z(.05),this._rotationAxis=P(),this._beginAngle=0,this._beginHeading=0,this._panningPlane=w(),this._beginRadius=0,this._smoothScaling=new z(.05),this._zoomCenterScreen=n(),this._zoomMomentumEstimator=new ot,this._rotationMomentumEstimator=new st,this._panSphericalMomentumEstimator=new nt,this._panPlanarMomentumEstimator=new et,this._adjustedSphere=b(),this._tmp3d=P(),this._tmpScreenPointArray=n(),this._beginScreenPoint=n(),this._beginScenePoint=P(),this._screenPickPoint=n(),this._scenePickPoint=P(),this._mode=U.Horizontal,this._sphere=b(),this._pointerCount=0,this._tmpInteractionDirection=P(),this._beginCamera=new it,this._constraintOptions=new O(y.ALL,A.NONE,0,this._beginCamera)}get _intersectionHelper(){return this.view.sceneIntersectionHelper}begin(t){if(!this.active)return;this._zoomMomentumEstimator.enabled=this._rotationMomentumEstimator.enabled=this._panPlanarMomentumEstimator.enabled=this._panSphericalMomentumEstimator.enabled=this.view.navigation.momentumEnabled,this._beginHeading=-i.normalize(e(this.view.camera.heading)),this._beginRadius=t.radius,this._pointerCount=t.pointers.size,this._beginAngle=t.angle,this._smoothRotation.reset(),s(t.center,this._screenPickPoint),a(this._beginScreenPoint,this._screenPickPoint);const n=C(this.view.spatialReference),o=D(this._intersectionHelper,this.startCamera,this._screenPickPoint,n,L.Silhouette,0===this.view.map.ground.opacity?I:{});null!=o.scenePickPoint&&(this._scenePickPoint=o.scenePickPoint,this._sphere=o.sphere,h(this._beginScenePoint,this._scenePickPoint),this._mode=Z(this.startCamera,this._screenPickPoint,n),this._mode===U.Vertical&&this._preparePlanarPanMode(t,o.hasGeometryIntersection),this._beginCamera.copyFrom(this.startCamera))}update(t){if(!this.active)return;this.currentCamera.copyFrom(this.startCamera);const i=t.pointers.size>1;this._mode===U.Horizontal?(i&&this._zoomSpherical(t),this._panningSpherical(t),i&&this._rotateSpherical(t)):(i&&this._zoomPlanar(t),this._panningPlanar(t),i&&this._rotatePlanar(t)),this.commitCamera()}end(t){t.pointers.size===this._pointerCount&&this.update(t),this.finishController();const i=this._zoomMomentumEstimator.evaluateMomentum();if(i)return this._mode===U.Horizontal?new T({view:this.view,momentum:i,screenCenter:this._zoomCenterScreen,sceneCenter:this._beginScenePoint,radius:this._sphere[3]}):new F({view:this.view,momentum:i,zoomCenter:this._beginScenePoint});const e=this._rotationMomentumEstimator.evaluateMomentum();if(e)return new H({view:this.view,momentum:e,center:f(this._sphere),axis:this._rotationAxis});if(this._mode===U.Horizontal){const t=this._panSphericalMomentumEstimator.evaluateMomentum();if(t)return new x({view:this.view,momentum:t})}else{const t=this._panPlanarMomentumEstimator.evaluateMomentum();if(t)return new k({view:this.view,momentum:t})}return null}_preparePlanarPanMode(t,i){const e=c(this._tmp3d,this.startCamera.viewForward);M(this._scenePickPoint,e,this._panningPlane);const r=n(this._screenPickPoint[0],0),a=P(),m=_(this.startCamera.eye);this._adjustedSphere[3]=m<this._sphere[3]?m-100:this._sphere[3],G(this._adjustedSphere,this.startCamera,r,a);const C=o();this.startCamera.projectToRenderScreen(a,C);const v=P(),w=P(),b=P();p(v,this._scenePickPoint,this.currentCamera.eye);const f=_(v);l(v,v);const j=N*Math.max(Math.abs(this.view.camera.position.z),B),E=this.view._stage.renderView.getMinimalDepthForArea(null,this._screenPickPoint[0],this._screenPickPoint[1],this.view.state.camera,V);let O=null!=E?E:j;O=i?Math.min(O,f):O,h(b,u(w,this.currentCamera.eye,g(w,v,O))),this._panningPlane[3]=-d(S(this._panningPlane),b),this.startCamera.center=u(w,this.startCamera.eye,g(w,this.startCamera.viewForward,O));const y=s(t.center,this._tmpScreenPointArray);q(this._panningPlane,this.startCamera,y,this._beginScenePoint)}_zoomSpherical(t){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._smoothScaling.gain=e,this._smoothScaling.update(i),J(this._sphere,this.currentCamera,this._smoothScaling.value),s(t.center,this._zoomCenterScreen),this._zoomMomentumEstimator.add(this._smoothScaling.value,.001*t.timestamp),this._constraintOptions.interactionType=A.ZOOM,this._constraintOptions.interactionFactor=j(t.radius-this._beginRadius),E(this.view,this.currentCamera,this._constraintOptions)}_panningSpherical(t){const i=s(t.center,this._tmpScreenPointArray);G(this._sphere,this.currentCamera,i,this._tmp3d),K(this._beginScenePoint,d(this.currentCamera.up,this._beginScenePoint),this._sphere[3],this._beginHeading,this.view.camera.tilt,this.startCamera)?(Q(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this._beginHeading,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumPreserveHeading(i,this._tmp3d,.001*t.timestamp,this.startCamera,this._sphere,this._beginHeading,this.view.camera.tilt)):(W(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumDirectRotation(i,this._tmp3d,.001*t.timestamp,this.startCamera,this._sphere[3],this.view.camera.tilt)),this._constraintOptions.interactionType=A.PAN,this._constraintOptions.interactionFactor=j(m(this._screenPickPoint,i)),E(this.view,this.currentCamera,this._constraintOptions)}_rotateSpherical(t){l(this._rotationAxis,this._scenePickPoint),this.currentCamera.aboveGround||c(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value,e=i+X(t.angle-i),n=.00125*Math.min(Math.max(t.radius,40),120);this._smoothRotation.gain=n,this._smoothRotation.update(e);const s=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(s,.001*t.timestamp),Y(this.currentCamera,f(this._sphere),v(this._rotationAxis,s)),this._constraintOptions.interactionType=A.TUMBLE,this._constraintOptions.interactionFactor=j(t.radius*e),E(this.view,this.currentCamera,this._constraintOptions)}_panningPlanar(t){const i=s(t.center,this._tmpScreenPointArray);q(this._panningPlane,this.currentCamera,i,this._tmp3d)&&($(this.currentCamera,this._beginScenePoint,this._tmp3d),this._panPlanarMomentumEstimator.add(i,this._tmp3d,.001*t.timestamp),this._constraintOptions.interactionType=A.PAN,this._constraintOptions.interactionFactor=j(m(this._beginScreenPoint,i)),this._constraintOptions.interactionDirection=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,this._tmpInteractionDirection),E(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null)}_zoomPlanar(t){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._smoothScaling.gain=e,this._smoothScaling.update(i),this._zoomMomentumEstimator.add(this._smoothScaling.value,.001*t.timestamp),tt(this.currentCamera,this._beginScenePoint,this._smoothScaling.value,this.view.state.constraints.minimumPoiDistance),this._constraintOptions.interactionType=A.ZOOM,this._constraintOptions.interactionFactor=j(t.radius-this._beginRadius),E(this.view,this.currentCamera,this._constraintOptions)}_rotatePlanar(t){h(this._rotationAxis,this._beginScenePoint),this.currentCamera.aboveGround||c(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value;let e=t.angle-i;e=X(e);const n=i+e,s=.00125*Math.min(Math.max(t.radius,40),120);this._smoothRotation.gain=s,this._smoothRotation.update(n);const o=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(o,.001*t.timestamp),Y(this.currentCamera,f(this._sphere),v(this._rotationAxis,o)),this._constraintOptions.interactionType=A.TUMBLE,this._constraintOptions.interactionFactor=j(t.radius*o),E(this.view,this.currentCamera,this._constraintOptions)}};rt=t([r("esri.views.3d.state.controllers.global.PinchAndPanController")],rt);export{rt as PinchAndPanController};
@@ -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{createScreenPointArray as r}from"../../../../../core/screenUtils.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{copy as e,distance as a}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{n as o,f as h,l as c,j as m,h as p,g as l}from"../../../../../chunks/vec32.js";import{create as _}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as u}from"../../../../../geometry/ellipsoidUtils.js";import{create as P,fromPoints as C}from"../../../../../geometry/support/axisAngle.js";import{d as y,g as d}from"../../../../../chunks/sphere.js";import{pixelDistanceToInteractionFactor as f,applyAll as g}from"../../../camera/constraintUtils.js";import{ConstraintOptions as v}from"../../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as R}from"../../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as j}from"../../../camera/constraintUtils/InteractionType.js";import{applySurfaceCollisionConstraint as k}from"../../../camera/constraintUtils/surfaceCollision.js";import{InteractiveController as w}from"../InteractiveController.js";import{NavigationMode as D,normalizeCoordinate as A,pickPointAndInitSphere as M,contentIntersectorOptions as b,SpherePickPointFallback as O,decideNavigationMode as U,distanceClampValues as x,pivotDistanceModifier as z,screenPixelArea as H,sphereOrPlanePointFromScreenPoint as L,applyRotation as I}from"../../utils/navigationUtils.js";import{fromScreenAtEye as S}from"../../../support/geometryUtils/ray.js";let B=class extends w{constructor(){super(...arguments),this._pickPoint=_(),this._tmpP0=n(),this._panAxisAngle=P(),this._tmpRayDir=_(),this._tmpRayDirPick=_(),this._targetOnSphere=_(),this._navMode=D.Horizontal,this._tmpRay={origin:_(),direction:_()},this.dragBeginPoint=r(),this._normalizedAnchorPoint=n(),this._constraintOptions=new v(R.ALL_EXCEPT_COLLISION,j.ZOOM,0,this.startCamera),this._sphere=y(),this._hasPickPoint=!1}get _intersectionHelper(){return this.view.sceneIntersectionHelper}begin(t){if(!this.active)return;e(this.dragBeginPoint,t),A(this.startCamera,t,this._normalizedAnchorPoint);const r=u(this.view.spatialReference),s=M(this._intersectionHelper,this.startCamera,t,r,O.Ellipsoid,0===this.view.map.ground.opacity?b:{});if(this._navMode=U(this.startCamera,t,r),this._navMode===D.Horizontal)this._hasPickPoint=!!s.scenePickPoint,this._pickPoint=s.scenePickPoint??this._pickPoint,this._sphere=s.sphere;else{let r;S(this.startCamera,t,this._tmpRay),o(this._tmpRay.direction,this._tmpRay.direction),null!=s.scenePickPoint&&(h(this._tmpRayDirPick,this.startCamera.eye,s.scenePickPoint),r=c(this._tmpRayDirPick));const e=Math.abs(this.view.camera.position.z);this.view.renderCoordsHelper.worldUpAtPosition(this.startCamera.eye,T);let a=i(Math.min(z,1/Math.abs(m(T,this._tmpRay.direction)))*e,x[0],x[1]);const n=this.view._stage.renderView.getMinimalDepthForArea(null,t[0],t[1],this.view.state.camera,H);a=null!=n?n:a,a=null!=r?Math.min(a,r):a,this._hasPickPoint=!0,p(this._tmpRay.direction,this._tmpRay.direction,a),l(this._pickPoint,this._tmpRay.origin,this._tmpRay.direction)}}update(t){if(this.active){if(this.currentCamera.eye=this.startCamera.eye,this.currentCamera.center=this.startCamera.center,this.currentCamera.up=this.startCamera.up,this._navMode===D.Horizontal){h(this._tmpRayDir,this.currentCamera.center,this.currentCamera.eye);const i=c(this._tmpRayDir);A(this.currentCamera,t,this._tmpP0);const r=12*(this._normalizedAnchorPoint[1]-this._tmpP0[1]);let s=i*2**r;const e=this.view.state.constraints.minimumPoiDistance;if(r<0&&s<e&&(s=e),Math.abs(i-s)<1e-6)return;if(this._hasPickPoint&&s<i){const t=1-(1-s/i)*(1-this._sphere[3]/c(this.currentCamera.center));this.currentCamera.center=p(E,this.currentCamera.center,t)}p(this._tmpRayDir,this._tmpRayDir,-s/i),this.currentCamera.eye=l(E,this.currentCamera.center,this._tmpRayDir),this._constraintOptions.interactionFactor=f(a(this.dragBeginPoint,t)),g(this.view,this.currentCamera,this._constraintOptions),this._hasPickPoint&&(L(this._sphere,this.currentCamera,this.dragBeginPoint,this._targetOnSphere),C(this._pickPoint,this._targetOnSphere,this._panAxisAngle),I(this.currentCamera,d(this._sphere),this._panAxisAngle))}else{const i=c(this._tmpRay.direction);A(this.currentCamera,t,this._tmpP0);const r=12*(this._normalizedAnchorPoint[1]-this._tmpP0[1]);let s=i*2**r;const e=this.view.state.constraints.minimumPoiDistance;if(r<0&&s<e&&(s=e),Math.abs(i-s)<1e-6)return;p(this._tmpRayDir,this._tmpRay.direction,1-s/i),this.currentCamera.eye=l(E,this.currentCamera.eye,this._tmpRayDir),this.currentCamera.center=l(E,this.currentCamera.center,this._tmpRayDir)}k(this.view,this.currentCamera),this.commitCamera()}}end(){this.active&&this.finishController()}};B=t([s("esri.views.3d.state.controllers.global.ZoomController")],B);const E=_(),T=_();export{B as ZoomController};
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import{clamp as i}from"../../../../../core/mathUtils.js";import{createScreenPointArray as r}from"../../../../../core/screenUtils.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{copy as e,distance as a}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{n as o,f as h,l as c,k as m,h as p,g as l}from"../../../../../chunks/vec32.js";import{create as _}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as u}from"../../../../../geometry/ellipsoidUtils.js";import{create as P,fromPoints as C}from"../../../../../geometry/support/axisAngle.js";import{d as y,g as d}from"../../../../../chunks/sphere.js";import{pixelDistanceToInteractionFactor as f,applyAll as g}from"../../../camera/constraintUtils.js";import{ConstraintOptions as v}from"../../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as R}from"../../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as j}from"../../../camera/constraintUtils/InteractionType.js";import{applySurfaceCollisionConstraint as k}from"../../../camera/constraintUtils/surfaceCollision.js";import{InteractiveController as w}from"../InteractiveController.js";import{NavigationMode as D,normalizeCoordinate as A,pickPointAndInitSphere as M,contentIntersectorOptions as b,SpherePickPointFallback as O,decideNavigationMode as U,distanceClampValues as x,pivotDistanceModifier as z,screenPixelArea as H,sphereOrPlanePointFromScreenPoint as L,applyRotation as I}from"../../utils/navigationUtils.js";import{fromScreenAtEye as S}from"../../../support/geometryUtils/ray.js";let B=class extends w{constructor(){super(...arguments),this._pickPoint=_(),this._tmpP0=n(),this._panAxisAngle=P(),this._tmpRayDir=_(),this._tmpRayDirPick=_(),this._targetOnSphere=_(),this._navMode=D.Horizontal,this._tmpRay={origin:_(),direction:_()},this.dragBeginPoint=r(),this._normalizedAnchorPoint=n(),this._constraintOptions=new v(R.ALL_EXCEPT_COLLISION,j.ZOOM,0,this.startCamera),this._sphere=y(),this._hasPickPoint=!1}get _intersectionHelper(){return this.view.sceneIntersectionHelper}begin(t){if(!this.active)return;e(this.dragBeginPoint,t),A(this.startCamera,t,this._normalizedAnchorPoint);const r=u(this.view.spatialReference),s=M(this._intersectionHelper,this.startCamera,t,r,O.Ellipsoid,0===this.view.map.ground.opacity?b:{});if(this._navMode=U(this.startCamera,t,r),this._navMode===D.Horizontal)this._hasPickPoint=!!s.scenePickPoint,this._pickPoint=s.scenePickPoint??this._pickPoint,this._sphere=s.sphere;else{let r;S(this.startCamera,t,this._tmpRay),o(this._tmpRay.direction,this._tmpRay.direction),null!=s.scenePickPoint&&(h(this._tmpRayDirPick,this.startCamera.eye,s.scenePickPoint),r=c(this._tmpRayDirPick));const e=Math.abs(this.view.camera.position.z);this.view.renderCoordsHelper.worldUpAtPosition(this.startCamera.eye,T);let a=i(Math.min(z,1/Math.abs(m(T,this._tmpRay.direction)))*e,x[0],x[1]);const n=this.view._stage.renderView.getMinimalDepthForArea(null,t[0],t[1],this.view.state.camera,H);a=null!=n?n:a,a=null!=r?Math.min(a,r):a,this._hasPickPoint=!0,p(this._tmpRay.direction,this._tmpRay.direction,a),l(this._pickPoint,this._tmpRay.origin,this._tmpRay.direction)}}update(t){if(this.active){if(this.currentCamera.eye=this.startCamera.eye,this.currentCamera.center=this.startCamera.center,this.currentCamera.up=this.startCamera.up,this._navMode===D.Horizontal){h(this._tmpRayDir,this.currentCamera.center,this.currentCamera.eye);const i=c(this._tmpRayDir);A(this.currentCamera,t,this._tmpP0);const r=12*(this._normalizedAnchorPoint[1]-this._tmpP0[1]);let s=i*2**r;const e=this.view.state.constraints.minimumPoiDistance;if(r<0&&s<e&&(s=e),Math.abs(i-s)<1e-6)return;if(this._hasPickPoint&&s<i){const t=1-(1-s/i)*(1-this._sphere[3]/c(this.currentCamera.center));this.currentCamera.center=p(E,this.currentCamera.center,t)}p(this._tmpRayDir,this._tmpRayDir,-s/i),this.currentCamera.eye=l(E,this.currentCamera.center,this._tmpRayDir),this._constraintOptions.interactionFactor=f(a(this.dragBeginPoint,t)),g(this.view,this.currentCamera,this._constraintOptions),this._hasPickPoint&&(L(this._sphere,this.currentCamera,this.dragBeginPoint,this._targetOnSphere),C(this._pickPoint,this._targetOnSphere,this._panAxisAngle),I(this.currentCamera,d(this._sphere),this._panAxisAngle))}else{const i=c(this._tmpRay.direction);A(this.currentCamera,t,this._tmpP0);const r=12*(this._normalizedAnchorPoint[1]-this._tmpP0[1]);let s=i*2**r;const e=this.view.state.constraints.minimumPoiDistance;if(r<0&&s<e&&(s=e),Math.abs(i-s)<1e-6)return;p(this._tmpRayDir,this._tmpRay.direction,1-s/i),this.currentCamera.eye=l(E,this.currentCamera.eye,this._tmpRayDir),this.currentCamera.center=l(E,this.currentCamera.center,this._tmpRayDir)}k(this.view,this.currentCamera),this.commitCamera()}}end(){this.active&&this.finishController()}};B=t([s("esri.views.3d.state.controllers.global.ZoomController")],B);const E=_(),T=_();export{B as ZoomController};
@@ -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 r}from"../../../../../core/accessorSupport/decorators/subclass.js";import{c as s,n as o,h as a,j as n,l as m,f as h,g as c,a as p}from"../../../../../chunks/vec32.js";import{create as _}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as l}from"../../../../../geometry/ellipsoidUtils.js";import{d as y}from"../../../../../chunks/sphere.js";import{applyAll as f}from"../../../camera/constraintUtils.js";import{ConstraintOptions as g}from"../../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as w}from"../../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as C}from"../../../camera/constraintUtils/InteractionType.js";import{applySurfaceCollisionConstraint as d}from"../../../camera/constraintUtils/surfaceCollision.js";import{PointToPointAnimationController as j}from"../PointToPointAnimationController.js";import{contentIntersectorOptions as u,decideNavigationMode as D,zoomMaxDistanceModifier as b,zoomMinDistanceModifier as v,zoomDistanceModifier as R,NavigationMode as L,panToPosition as M}from"../../utils/navigationUtils.js";import{fromScreenAtEye as z}from"../../../support/geometryUtils/ray.js";import{intersectScreen as O}from"../../../support/geometryUtils/sphere.js";import{Camera as U}from"../../../webgl-engine/lib/Camera.js";import{newIntersector as S}from"../../../webgl-engine/lib/Intersector.js";import{outExpo as V}from"../../../../animation/easing.js";const x=.6,A=4,F=60;let H=class extends j{constructor(){super(...arguments),this._zoomLocation=_(),this._tmpCamera=new U,this._tmpViewDir=_(),this._tmpRayDir={origin:_(),direction:_()},this._targetOnSphere=_(),this._tmpCenter=_(),this._beginCamera=new U,this._constraintOptions=new g(w.ALL_EXCEPT_COLLISION,C.ZOOM,null,this._beginCamera),this._sphere=y()}initialize(){this._intersector=S(this.view.state.viewingMode)}zoomStep(t,i){if(!this.active)return;const e=this.view.state;this.animation.finished?this._beginCamera.copyFrom(e.camera):this.animation.cameraAt(1,this._beginCamera);let r=!1,o=!1;this.intersectionHelper.intersectScreen(i,this._zoomLocation,0===this.view.map.ground.opacity?u:{})&&(r=t>0,o=!0),this._tmpCamera.copyFrom(e.camera),r?this.intersectionHelper.intersectRay(this._tmpCamera.ray,this._intersector,this._tmpCenter)&&(this._tmpCamera.center=this._tmpCenter):this.intersectionHelper.intersectRay(this._tmpCamera.ray,this._intersector,this._zoomLocation)?this._tmpCamera.center=this._zoomLocation:s(this._zoomLocation,this._tmpCamera.center),this._updateCamera(this._tmpCamera,t,this._zoomLocation,i,o),this.begin(this._tmpCamera)}animationSettings(){return{duration:e(600),easing:V}}_updateCamera(t,e,r,s,_){const y=l(this.view.spatialReference),g=D(t,s,y),w=Math.abs(this.view.camera.position.z);o(T,t.eye),a(T,T,-1),z(t,s,this._tmpRayDir),o(this._tmpRayDir.direction,this._tmpRayDir.direction);const C=i(Math.min(R,1/Math.abs(n(T,this._tmpRayDir.direction)))*w,v,b);if(g===L.Horizontal){let i=x**e;this._sphere[3]=m(r),h(this._tmpViewDir,t.center,t.eye);const o=Math.min(m(this._tmpViewDir),C);let n=o*i;if(i<=1&&n<A&&(n=A,i=n/o),Math.abs(o-n)<1e-6)return;const _=m(t.center);if(this._sphere[3]!==_){const e=this._sphere[3]+i*(_-this._sphere[3]);t.center=a(I,t.center,e/_)}a(this._tmpViewDir,this._tmpViewDir,-i),t.eye=c(I,t.center,this._tmpViewDir),f(this.view,t,this._constraintOptions),p(r,t.center)>1e-12&&O(this._sphere,t,s,this._targetOnSphere)&&M(this._sphere,t,r,this._targetOnSphere,this.view.camera.heading,this.view.camera.tilt,!0)}else{let i=x**Math.abs(e);const o=e>0?1:-1;h(this._tmpViewDir,r,t.eye);const n=m(this._tmpViewDir),p=this.view._stage.renderView.getMinimalDepthForArea(null,s[0],s[1],this.view.state.camera,F);let l=null!=p?p:C;l=_&&e>0?Math.min(l,n):l,a(this._tmpRayDir.direction,this._tmpRayDir.direction,l),c(r,this._tmpRayDir.origin,this._tmpRayDir.direction);let y=l*i;const f=Math.max(A,1.01*t.nearFar[0]);if(e>0&&y<f&&(y=f,i=y/l),Math.abs(l-y)<1e-6)return;a(this._tmpRayDir.direction,this._tmpRayDir.direction,o*(1-i)),t.eye=c(I,t.eye,this._tmpRayDir.direction),t.center=c(I,t.center,this._tmpRayDir.direction)}d(this.view,t)}};H=t([r("esri.views.3d.state.controllers.global.ZoomStepController")],H);const I=_(),T=_();export{H 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 r}from"../../../../../core/accessorSupport/decorators/subclass.js";import{c as s,n as o,h as a,k as n,l as m,f as h,g as c,a as p}from"../../../../../chunks/vec32.js";import{create as _}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as l}from"../../../../../geometry/ellipsoidUtils.js";import{d as y}from"../../../../../chunks/sphere.js";import{applyAll as f}from"../../../camera/constraintUtils.js";import{ConstraintOptions as g}from"../../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as w}from"../../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as C}from"../../../camera/constraintUtils/InteractionType.js";import{applySurfaceCollisionConstraint as d}from"../../../camera/constraintUtils/surfaceCollision.js";import{PointToPointAnimationController as j}from"../PointToPointAnimationController.js";import{contentIntersectorOptions as u,decideNavigationMode as D,zoomMaxDistanceModifier as b,zoomMinDistanceModifier as v,zoomDistanceModifier as R,NavigationMode as L,panToPosition as M}from"../../utils/navigationUtils.js";import{fromScreenAtEye as z}from"../../../support/geometryUtils/ray.js";import{intersectScreen as O}from"../../../support/geometryUtils/sphere.js";import{Camera as U}from"../../../webgl-engine/lib/Camera.js";import{newIntersector as S}from"../../../webgl-engine/lib/Intersector.js";import{outExpo as V}from"../../../../animation/easing.js";const k=.6,x=4,A=60;let F=class extends j{constructor(){super(...arguments),this._zoomLocation=_(),this._tmpCamera=new U,this._tmpViewDir=_(),this._tmpRayDir={origin:_(),direction:_()},this._targetOnSphere=_(),this._tmpCenter=_(),this._beginCamera=new U,this._constraintOptions=new g(w.ALL_EXCEPT_COLLISION,C.ZOOM,null,this._beginCamera),this._sphere=y()}initialize(){this._intersector=S(this.view.state.viewingMode)}zoomStep(t,i){if(!this.active)return;const e=this.view.state;this.animation.finished?this._beginCamera.copyFrom(e.camera):this.animation.cameraAt(1,this._beginCamera);let r=!1,o=!1;this.intersectionHelper.intersectScreen(i,this._zoomLocation,0===this.view.map.ground.opacity?u:{})&&(r=t>0,o=!0),this._tmpCamera.copyFrom(e.camera),r?this.intersectionHelper.intersectRay(this._tmpCamera.ray,this._intersector,this._tmpCenter)&&(this._tmpCamera.center=this._tmpCenter):this.intersectionHelper.intersectRay(this._tmpCamera.ray,this._intersector,this._zoomLocation)?this._tmpCamera.center=this._zoomLocation:s(this._zoomLocation,this._tmpCamera.center),this._updateCamera(this._tmpCamera,t,this._zoomLocation,i,o),this.begin(this._tmpCamera)}animationSettings(){return{duration:e(600),easing:V}}_updateCamera(t,e,r,s,_){const y=l(this.view.spatialReference),g=D(t,s,y),w=Math.abs(this.view.camera.position.z);o(I,t.eye),a(I,I,-1),z(t,s,this._tmpRayDir),o(this._tmpRayDir.direction,this._tmpRayDir.direction);const C=i(Math.min(R,1/Math.abs(n(I,this._tmpRayDir.direction)))*w,v,b);if(g===L.Horizontal){let i=k**e;this._sphere[3]=m(r),h(this._tmpViewDir,t.center,t.eye);const o=Math.min(m(this._tmpViewDir),C);let n=o*i;if(i<=1&&n<x&&(n=x,i=n/o),Math.abs(o-n)<1e-6)return;const _=m(t.center);if(this._sphere[3]!==_){const e=this._sphere[3]+i*(_-this._sphere[3]);t.center=a(H,t.center,e/_)}a(this._tmpViewDir,this._tmpViewDir,-i),t.eye=c(H,t.center,this._tmpViewDir),f(this.view,t,this._constraintOptions),p(r,t.center)>1e-12&&O(this._sphere,t,s,this._targetOnSphere)&&M(this._sphere,t,r,this._targetOnSphere,this.view.camera.heading,this.view.camera.tilt,!0)}else{let i=k**Math.abs(e);const o=e>0?1:-1;h(this._tmpViewDir,r,t.eye);const n=m(this._tmpViewDir),p=this.view._stage.renderView.getMinimalDepthForArea(null,s[0],s[1],this.view.state.camera,A);let l=null!=p?p:C;l=_&&e>0?Math.min(l,n):l,a(this._tmpRayDir.direction,this._tmpRayDir.direction,l),c(r,this._tmpRayDir.origin,this._tmpRayDir.direction);let y=l*i;const f=Math.max(x,1.01*t.nearFar[0]);if(e>0&&y<f&&(y=f,i=y/l),Math.abs(l-y)<1e-6)return;a(this._tmpRayDir.direction,this._tmpRayDir.direction,o*(1-i)),t.eye=c(H,t.eye,this._tmpRayDir.direction),t.center=c(H,t.center,this._tmpRayDir.direction)}d(this.view,t)}};F=t([r("esri.views.3d.state.controllers.global.ZoomStepController")],F);const H=_(),I=_();export{F 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{asinClamped as i}from"../../../../../core/mathUtils.js";import{createScreenPointArray as e,screenPointObjectToArray as n}from"../../../../../core/screenUtils.js";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{distance as s}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{E as a,c as r,j as m,f as h,l,n as c,h as p,g as _}from"../../../../../chunks/vec32.js";import{create as u,fromValues as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{wrapAxisAngle as g}from"../../../../../geometry/support/axisAngle.js";import{create as C,fromNormalAndOffset as v,setOffsetFromPoint as M,negate as b,getNormal as f}from"../../../../../geometry/support/plane.js";import{pixelDistanceToInteractionFactor as w,applyAll as j}from"../../../camera/constraintUtils.js";import{ConstraintOptions as E}from"../../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as V}from"../../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as P}from"../../../camera/constraintUtils/InteractionType.js";import{ExponentialFalloff as z}from"../../../input/util.js";import{getVoxelWasm as H}from"../../../layers/VoxelWasm.js";import{InteractiveController as S}from"../InteractiveController.js";import{PanPlanarMomentumController as O}from"../momentum/PanPlanarMomentumController.js";import{RotationMomentumController as y}from"../momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as x}from"../momentum/ZoomPlanarMomentumController.js";import{NavigationMode as A,contentIntersectorOptions as L,panDistanceModifier as F,minHeightLimit as R,screenPixelArea as T,centroid as U,applyZoomToPoint as N,applyPanPlanar as D,normalizeRotationDelta as I,applyRotation as G,intersectPlaneFromScreenPointAtEye as k}from"../../utils/navigationUtils.js";import{Camera as Z}from"../../../webgl-engine/lib/Camera.js";import{PanPlanarMomentumEstimator as B}from"../../../../navigation/PanPlanarMomentumEstimator.js";import{RotationMomentumEstimator as W}from"../../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as q}from"../../../../navigation/ZoomMomentumEstimator.js";const J=d(0,0,1),K={ELEVATION_THRESHOLD:3e4,ANGLE_THRESHOLD:16/180*Math.PI};let Q=class extends S{constructor(){super(...arguments),this._rotationValueSmooth=new z(.05),this._scalingValueSmooth=new z(.05),this._planeHorizontal=C(),this._planeVertical=C(),this._rotationMomentumEstimator=new W,this._panMomentumEstimator=new B(300,12,.9),this._zoomMomentumEstimator=new q,this._beginRadius=0,this._beginCenter=u(),this._beginAngle=0,this._tmpPoints=[],this._panMode=A.Horizontal,this._beginCenterScreen=e(),this._tmpCentroid3d=u(),this._tmpCentroid2d=e(),this._tmp2d=e(),this._pointerCount=0,this._beginCamera=new Z,this._constraintOptions=new E(V.ALL,P.NONE,0,this._beginCamera)}begin(t){if(!this.active)return;const e=this.view.navigation.momentumEnabled;this._zoomMomentumEstimator.enabled=e,this._rotationMomentumEstimator.enabled=e,this._panMomentumEstimator.enabled=e,this._beginRadius=t.radius,this._pointerCount=t.pointers.size,this._beginAngle=t.angle,this._rotationValueSmooth.reset(),this._scalingValueSmooth.reset(),n(t.center,this._beginCenterScreen),v(J,0,this._planeHorizontal);const o=u(),s=this._intersectionHelper.intersectScreenFreePointFallback(this._beginCenterScreen,o,0===this.view.map.ground.opacity?L:{}),d=u();a(d,this.startCamera.viewForward);const g=u();r(g,J);const C=m(d,g),w=i(C<0?-C:C);this._panMode=w>=K.ANGLE_THRESHOLD?A.Horizontal:A.Vertical;const j=Math.min(F,1/Math.abs(m(g,this.startCamera.viewForward)))*Math.max(Math.abs(this.view.camera.position.z),R);M(this._planeHorizontal,this._planeHorizontal,o),this.startCamera.aboveGround||b(this._planeHorizontal,this._planeHorizontal);const E=u(),V=u(),P=u();h(E,o,this.currentCamera.eye);const z=l(E);if(c(E,E),this._panMode===A.Vertical){p(g,g,C),h(f(this._planeVertical),d,g),c(f(this._planeVertical),f(this._planeVertical)),M(this._planeVertical,this._planeVertical,o);const i=this.view._stage.renderView.getMinimalDepthForArea(H(this.view),this._beginCenterScreen[0],this._beginCenterScreen[1],this.view.state.camera,T);let e=null!=i?i:j;e=s?Math.min(e,z):e,r(P,_(V,this.currentCamera.eye,p(V,E,e))),this._planeVertical[3]=-m(f(this._planeVertical),P),this._computePlanePoints(t.pointers,this._planeVertical,this.startCamera,this._tmpPoints),U(this._tmpPoints,this._beginCenter)}else{const i=s?z:j;r(P,_(V,this.currentCamera.eye,p(V,E,i))),this._planeHorizontal[3]=-m(f(this._planeHorizontal),P),this._computePlanePoints(t.pointers,this._planeHorizontal,this.startCamera,this._tmpPoints),U(this._tmpPoints,this._beginCenter)}this._beginCamera.copyFrom(this.startCamera)}update(t){if(!this.active)return;this.currentCamera.copyFrom(this.startCamera);const i=t.pointers.size>1,e=this._panMode===A.Horizontal?this._planeHorizontal:this._planeVertical,o=this._beginCenter;if(i){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._scalingValueSmooth.gain=e,this._scalingValueSmooth.update(i),N(this.currentCamera,o,this._scalingValueSmooth.value,this.view.state.constraints.minimumPoiDistance),this._zoomMomentumEstimator.add(this._scalingValueSmooth.value,.001*t.timestamp),this._constraintOptions.interactionType=P.ZOOM,this._constraintOptions.interactionFactor=w(Math.abs(t.radius-this._beginRadius)),j(this.view,this.currentCamera,this._constraintOptions)}if(this._computePlanePoints(t.pointers,e,this.currentCamera,this._tmpPoints),U(this._tmpPoints,this._tmpCentroid3d),n(t.center,this._tmpCentroid2d),D(this.currentCamera,o,this._tmpCentroid3d),this._panMomentumEstimator.add(this._tmpCentroid2d,this._tmpCentroid3d,.001*t.timestamp),this._constraintOptions.interactionType=P.PAN,this._constraintOptions.interactionFactor=w(s(this._beginCenterScreen,this._tmpCentroid2d)),j(this.view,this.currentCamera,this._constraintOptions),i){const i=o,e=this._rotationValueSmooth.value,n=e+I(t.angle-e),s=.00125*Math.min(Math.max(t.radius,40),120);this._rotationValueSmooth.gain=s,this._rotationValueSmooth.update(n);const a=this._rotationValueSmooth.value-this._beginAngle;this._rotationMomentumEstimator.add(a,.001*t.timestamp);const r=f(this._planeHorizontal);G(this.currentCamera,i,g(r,a)),this._constraintOptions.interactionType=P.TUMBLE,this._constraintOptions.interactionFactor=w(Math.abs(t.radius*a)),j(this.view,this.currentCamera,this._constraintOptions)}this.commitCamera()}end(t){t.pointers.size===this._pointerCount&&this.update(t),this.finishController();const i=this._zoomMomentumEstimator.evaluateMomentum();if(i)return new x({view:this.view,momentum:i,zoomCenter:this._beginCenter});const e=this._rotationMomentumEstimator.evaluateMomentum();if(e)return new y({view:this.view,momentum:e,center:this._beginCenter,axis:f(this._planeHorizontal)});const n=this._panMomentumEstimator.evaluateMomentum();return n?new O({view:this.view,momentum:n}):null}_computePlanePoints(t,i,e,n){n.length=t.size;const o=this._tmp2d;let s=0;return t.forEach((t=>{o[0]=t.x,o[1]=t.y,void 0===n[s]&&(n[s]=u()),k(i,e,o,n[s]),s+=1})),n}get _intersectionHelper(){return this.view.sceneIntersectionHelper}};Q=t([o("esri.views.3d.state.controllers.local.PinchAndPanController")],Q);export{Q as PinchAndPanController};
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import{asinClamped as i}from"../../../../../core/mathUtils.js";import{createScreenPointArray as e,screenPointObjectToArray as n}from"../../../../../core/screenUtils.js";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{distance as s}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{F as a,c as r,k as m,f as h,l,n as c,h as p,g as _}from"../../../../../chunks/vec32.js";import{create as u,fromValues as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{wrapAxisAngle as g}from"../../../../../geometry/support/axisAngle.js";import{create as C,fromNormalAndOffset as v,setOffsetFromPoint as M,negate as b,getNormal as f}from"../../../../../geometry/support/plane.js";import{pixelDistanceToInteractionFactor as w,applyAll as j}from"../../../camera/constraintUtils.js";import{ConstraintOptions as E}from"../../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as V}from"../../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as P}from"../../../camera/constraintUtils/InteractionType.js";import{ExponentialFalloff as z}from"../../../input/util.js";import{getVoxelWasm as H}from"../../../layers/VoxelWasm.js";import{InteractiveController as S}from"../InteractiveController.js";import{PanPlanarMomentumController as O}from"../momentum/PanPlanarMomentumController.js";import{RotationMomentumController as y}from"../momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as x}from"../momentum/ZoomPlanarMomentumController.js";import{NavigationMode as A,contentIntersectorOptions as F,panDistanceModifier as L,minHeightLimit as R,screenPixelArea as T,centroid as U,applyZoomToPoint as N,applyPanPlanar as D,normalizeRotationDelta as I,applyRotation as k,intersectPlaneFromScreenPointAtEye as G}from"../../utils/navigationUtils.js";import{Camera as Z}from"../../../webgl-engine/lib/Camera.js";import{PanPlanarMomentumEstimator as B}from"../../../../navigation/PanPlanarMomentumEstimator.js";import{RotationMomentumEstimator as W}from"../../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as q}from"../../../../navigation/ZoomMomentumEstimator.js";const J=d(0,0,1),K={ELEVATION_THRESHOLD:3e4,ANGLE_THRESHOLD:16/180*Math.PI};let Q=class extends S{constructor(){super(...arguments),this._rotationValueSmooth=new z(.05),this._scalingValueSmooth=new z(.05),this._planeHorizontal=C(),this._planeVertical=C(),this._rotationMomentumEstimator=new W,this._panMomentumEstimator=new B(300,12,.9),this._zoomMomentumEstimator=new q,this._beginRadius=0,this._beginCenter=u(),this._beginAngle=0,this._tmpPoints=[],this._panMode=A.Horizontal,this._beginCenterScreen=e(),this._tmpCentroid3d=u(),this._tmpCentroid2d=e(),this._tmp2d=e(),this._pointerCount=0,this._beginCamera=new Z,this._constraintOptions=new E(V.ALL,P.NONE,0,this._beginCamera)}begin(t){if(!this.active)return;const e=this.view.navigation.momentumEnabled;this._zoomMomentumEstimator.enabled=e,this._rotationMomentumEstimator.enabled=e,this._panMomentumEstimator.enabled=e,this._beginRadius=t.radius,this._pointerCount=t.pointers.size,this._beginAngle=t.angle,this._rotationValueSmooth.reset(),this._scalingValueSmooth.reset(),n(t.center,this._beginCenterScreen),v(J,0,this._planeHorizontal);const o=u(),s=this._intersectionHelper.intersectScreenFreePointFallback(this._beginCenterScreen,o,0===this.view.map.ground.opacity?F:{}),d=u();a(d,this.startCamera.viewForward);const g=u();r(g,J);const C=m(d,g),w=i(C<0?-C:C);this._panMode=w>=K.ANGLE_THRESHOLD?A.Horizontal:A.Vertical;const j=Math.min(L,1/Math.abs(m(g,this.startCamera.viewForward)))*Math.max(Math.abs(this.view.camera.position.z),R);M(this._planeHorizontal,this._planeHorizontal,o),this.startCamera.aboveGround||b(this._planeHorizontal,this._planeHorizontal);const E=u(),V=u(),P=u();h(E,o,this.currentCamera.eye);const z=l(E);if(c(E,E),this._panMode===A.Vertical){p(g,g,C),h(f(this._planeVertical),d,g),c(f(this._planeVertical),f(this._planeVertical)),M(this._planeVertical,this._planeVertical,o);const i=this.view._stage.renderView.getMinimalDepthForArea(H(this.view),this._beginCenterScreen[0],this._beginCenterScreen[1],this.view.state.camera,T);let e=null!=i?i:j;e=s?Math.min(e,z):e,r(P,_(V,this.currentCamera.eye,p(V,E,e))),this._planeVertical[3]=-m(f(this._planeVertical),P),this._computePlanePoints(t.pointers,this._planeVertical,this.startCamera,this._tmpPoints),U(this._tmpPoints,this._beginCenter)}else{const i=s?z:j;r(P,_(V,this.currentCamera.eye,p(V,E,i))),this._planeHorizontal[3]=-m(f(this._planeHorizontal),P),this._computePlanePoints(t.pointers,this._planeHorizontal,this.startCamera,this._tmpPoints),U(this._tmpPoints,this._beginCenter)}this._beginCamera.copyFrom(this.startCamera)}update(t){if(!this.active)return;this.currentCamera.copyFrom(this.startCamera);const i=t.pointers.size>1,e=this._panMode===A.Horizontal?this._planeHorizontal:this._planeVertical,o=this._beginCenter;if(i){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._scalingValueSmooth.gain=e,this._scalingValueSmooth.update(i),N(this.currentCamera,o,this._scalingValueSmooth.value,this.view.state.constraints.minimumPoiDistance),this._zoomMomentumEstimator.add(this._scalingValueSmooth.value,.001*t.timestamp),this._constraintOptions.interactionType=P.ZOOM,this._constraintOptions.interactionFactor=w(Math.abs(t.radius-this._beginRadius)),j(this.view,this.currentCamera,this._constraintOptions)}if(this._computePlanePoints(t.pointers,e,this.currentCamera,this._tmpPoints),U(this._tmpPoints,this._tmpCentroid3d),n(t.center,this._tmpCentroid2d),D(this.currentCamera,o,this._tmpCentroid3d),this._panMomentumEstimator.add(this._tmpCentroid2d,this._tmpCentroid3d,.001*t.timestamp),this._constraintOptions.interactionType=P.PAN,this._constraintOptions.interactionFactor=w(s(this._beginCenterScreen,this._tmpCentroid2d)),j(this.view,this.currentCamera,this._constraintOptions),i){const i=o,e=this._rotationValueSmooth.value,n=e+I(t.angle-e),s=.00125*Math.min(Math.max(t.radius,40),120);this._rotationValueSmooth.gain=s,this._rotationValueSmooth.update(n);const a=this._rotationValueSmooth.value-this._beginAngle;this._rotationMomentumEstimator.add(a,.001*t.timestamp);const r=f(this._planeHorizontal);k(this.currentCamera,i,g(r,a)),this._constraintOptions.interactionType=P.TUMBLE,this._constraintOptions.interactionFactor=w(Math.abs(t.radius*a)),j(this.view,this.currentCamera,this._constraintOptions)}this.commitCamera()}end(t){t.pointers.size===this._pointerCount&&this.update(t),this.finishController();const i=this._zoomMomentumEstimator.evaluateMomentum();if(i)return new x({view:this.view,momentum:i,zoomCenter:this._beginCenter});const e=this._rotationMomentumEstimator.evaluateMomentum();if(e)return new y({view:this.view,momentum:e,center:this._beginCenter,axis:f(this._planeHorizontal)});const n=this._panMomentumEstimator.evaluateMomentum();return n?new O({view:this.view,momentum:n}):null}_computePlanePoints(t,i,e,n){n.length=t.size;const o=this._tmp2d;let s=0;return t.forEach((t=>{o[0]=t.x,o[1]=t.y,void 0===n[s]&&(n[s]=u()),G(i,e,o,n[s]),s+=1})),n}get _intersectionHelper(){return this.view.sceneIntersectionHelper}};Q=t([o("esri.views.3d.state.controllers.local.PinchAndPanController")],Q);export{Q as PinchAndPanController};
@@ -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{createScreenPointArray as s}from"../../../../../core/screenUtils.js";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import{copy as e,distance as a}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{f as n,l as m,n as h,j as c,h as p,g as _,E as l,c as C,k as P}from"../../../../../chunks/vec32.js";import{create as f,fromValues as u}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as g,fromPositionAndNormal as D}from"../../../../../geometry/support/plane.js";import{pixelDistanceToInteractionFactor as j,applyAll as v}from"../../../camera/constraintUtils.js";import{ConstraintOptions as y}from"../../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as d}from"../../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as w}from"../../../camera/constraintUtils/InteractionType.js";import{getVoxelWasm as b}from"../../../layers/VoxelWasm.js";import{InteractiveController as M}from"../InteractiveController.js";import{normalizeCoordinate as O,contentIntersectorOptions as N,distanceClampValues as R,pivotDistanceModifier as x,screenPixelArea as U,intersectPlaneFromScreenPoint as A}from"../../utils/navigationUtils.js";let z=class extends M{constructor(){super(...arguments),this._tmpP=f(),this._tmpDir=f(),this._tmpN=f(),this._tmpP0=o(),this._tmpPoi=f(),this._tmpRayDir=f(),this.dragBeginPoint=s(),this._normalizedAnchorPoint=o(),this._constraintOptions=new y(d.ALL,w.ZOOM,0,this.startCamera,f()),this._plane=g()}get _intersectionHelper(){return this.view.sceneIntersectionHelper}begin(t){if(!this.active)return;e(this.dragBeginPoint,t),O(this.startCamera,t,this._normalizedAnchorPoint);const s=this._intersectionHelper.intersectScreenFreePointFallback(t,this._tmpP,0===this.view.map.ground.opacity?N:{});n(this._tmpDir,this._tmpP,this.startCamera.eye);const r=m(this._tmpDir);h(this._tmpDir,this._tmpDir);const a=Math.abs(this.view.camera.position.z);let o=i(Math.min(x,1/Math.abs(c(B,this._tmpDir)))*a,R[0],R[1]);const C=this.view._stage.renderView.getMinimalDepthForArea(b(this.view),t[0],t[1],this.view.state.camera,U);o=null!=C?C:o,o=s?Math.min(o,r):o,p(this._tmpDir,this._tmpDir,o),_(this._tmpP,this.startCamera.eye,this._tmpDir),n(this._tmpN,this.startCamera.eye,this.startCamera.center),h(this._tmpN,this._tmpN),this._tmpN[1]<0&&l(this._tmpN,this._tmpN),D(this._tmpP,this._tmpN,this._plane)}update(t){if(!this.active)return;A(this._plane,this.currentCamera,this.dragBeginPoint,this._tmpPoi)||C(this._tmpPoi,this.currentCamera.center),O(this.currentCamera,t,this._tmpP0);let i=4*(this._tmpP0[1]-this._normalizedAnchorPoint[1]);e(this._normalizedAnchorPoint,this._tmpP0),n(this._tmpRayDir,this._tmpPoi,this.currentCamera.eye);const s=m(this._tmpRayDir);let r=s*(1-i);this._constraintOptions.interactionDirection&&(C(this._constraintOptions.interactionDirection,this._tmpRayDir),p(this._constraintOptions.interactionDirection,this._constraintOptions.interactionDirection,Math.sign(i)/s));const o=this.view.state.constraints.minimumPoiDistance;i>=0&&r<o&&(r=o,i=-(r-s)/s),Math.abs(s-r)<1e-6||(p(this._tmpRayDir,this._tmpRayDir,i),this.currentCamera.eye=_(k,this.currentCamera.eye,this._tmpRayDir),P(k,this.currentCamera.center,this._tmpPoi,i),this._tmpPoi[2]>this.startCamera.center[2]?k[2]=Math.max(this.startCamera.center[2],k[2]):k[2]=Math.min(this.startCamera.center[2],k[2]),this.currentCamera.center=k,this._constraintOptions.interactionFactor=j(a(this.dragBeginPoint,t)),v(this.view,this.currentCamera,this._constraintOptions),this.commitCamera())}end(){this.active&&this.finishController()}};z=t([r("esri.views.3d.state.controllers.local.ZoomController")],z);const k=f(),B=u(0,0,1);export{z as ZoomController};
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import{clamp as i}from"../../../../../core/mathUtils.js";import{createScreenPointArray as s}from"../../../../../core/screenUtils.js";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import{copy as e,distance as a}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{f as n,l as m,n as h,k as c,h as p,g as _,F as l,c as C,m as P}from"../../../../../chunks/vec32.js";import{create as f,fromValues as u}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as g,fromPositionAndNormal as D}from"../../../../../geometry/support/plane.js";import{pixelDistanceToInteractionFactor as j,applyAll as v}from"../../../camera/constraintUtils.js";import{ConstraintOptions as y}from"../../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as d}from"../../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as w}from"../../../camera/constraintUtils/InteractionType.js";import{getVoxelWasm as b}from"../../../layers/VoxelWasm.js";import{InteractiveController as M}from"../InteractiveController.js";import{normalizeCoordinate as O,contentIntersectorOptions as N,distanceClampValues as R,pivotDistanceModifier as x,screenPixelArea as U,intersectPlaneFromScreenPoint as A}from"../../utils/navigationUtils.js";let z=class extends M{constructor(){super(...arguments),this._tmpP=f(),this._tmpDir=f(),this._tmpN=f(),this._tmpP0=o(),this._tmpPoi=f(),this._tmpRayDir=f(),this.dragBeginPoint=s(),this._normalizedAnchorPoint=o(),this._constraintOptions=new y(d.ALL,w.ZOOM,0,this.startCamera,f()),this._plane=g()}get _intersectionHelper(){return this.view.sceneIntersectionHelper}begin(t){if(!this.active)return;e(this.dragBeginPoint,t),O(this.startCamera,t,this._normalizedAnchorPoint);const s=this._intersectionHelper.intersectScreenFreePointFallback(t,this._tmpP,0===this.view.map.ground.opacity?N:{});n(this._tmpDir,this._tmpP,this.startCamera.eye);const r=m(this._tmpDir);h(this._tmpDir,this._tmpDir);const a=Math.abs(this.view.camera.position.z);let o=i(Math.min(x,1/Math.abs(c(k,this._tmpDir)))*a,R[0],R[1]);const C=this.view._stage.renderView.getMinimalDepthForArea(b(this.view),t[0],t[1],this.view.state.camera,U);o=null!=C?C:o,o=s?Math.min(o,r):o,p(this._tmpDir,this._tmpDir,o),_(this._tmpP,this.startCamera.eye,this._tmpDir),n(this._tmpN,this.startCamera.eye,this.startCamera.center),h(this._tmpN,this._tmpN),this._tmpN[1]<0&&l(this._tmpN,this._tmpN),D(this._tmpP,this._tmpN,this._plane)}update(t){if(!this.active)return;A(this._plane,this.currentCamera,this.dragBeginPoint,this._tmpPoi)||C(this._tmpPoi,this.currentCamera.center),O(this.currentCamera,t,this._tmpP0);let i=4*(this._tmpP0[1]-this._normalizedAnchorPoint[1]);e(this._normalizedAnchorPoint,this._tmpP0),n(this._tmpRayDir,this._tmpPoi,this.currentCamera.eye);const s=m(this._tmpRayDir);let r=s*(1-i);this._constraintOptions.interactionDirection&&(C(this._constraintOptions.interactionDirection,this._tmpRayDir),p(this._constraintOptions.interactionDirection,this._constraintOptions.interactionDirection,Math.sign(i)/s));const o=this.view.state.constraints.minimumPoiDistance;i>=0&&r<o&&(r=o,i=-(r-s)/s),Math.abs(s-r)<1e-6||(p(this._tmpRayDir,this._tmpRayDir,i),this.currentCamera.eye=_(F,this.currentCamera.eye,this._tmpRayDir),P(F,this.currentCamera.center,this._tmpPoi,i),this._tmpPoi[2]>this.startCamera.center[2]?F[2]=Math.max(this.startCamera.center[2],F[2]):F[2]=Math.min(this.startCamera.center[2],F[2]),this.currentCamera.center=F,this._constraintOptions.interactionFactor=j(a(this.dragBeginPoint,t)),v(this.view,this.currentCamera,this._constraintOptions),this.commitCamera())}end(){this.active&&this.finishController()}};z=t([r("esri.views.3d.state.controllers.local.ZoomController")],z);const F=f(),k=u(0,0,1);export{z as ZoomController};