@arcgis/core 6.0.0-next.55 → 6.0.0-next.56

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 (205) hide show
  1. package/arcgisGlobal.d.ts +1 -0
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/033b9fcd9833db3b6e7d.js +1 -0
  4. package/assets/esri/core/workers/chunks/0978e12dd6a1cbc50b80.js +1 -0
  5. package/assets/esri/core/workers/chunks/{e956845255bce0910944.js → 1507297550c3cd1268e2.js} +1 -1
  6. package/assets/esri/core/workers/chunks/1c0f5c42331fb6fc26cb.js +1 -0
  7. package/assets/esri/core/workers/chunks/2cd2fcf4a37d180d5d5c.js +1 -0
  8. package/assets/esri/core/workers/chunks/2f9adf0b809ce8797ebf.js +1 -0
  9. package/assets/esri/core/workers/chunks/3982409149571a827390.js +1 -0
  10. package/assets/esri/core/workers/chunks/3d851710f7fcc27c5b60.js +2 -0
  11. package/assets/esri/core/workers/chunks/3e8d70039800f2395d66.js +1 -0
  12. package/assets/esri/core/workers/chunks/4d8539674fc2e4fea03c.js +1 -0
  13. package/assets/esri/core/workers/chunks/{e61082f56c08abe54b3a.js → 5954f02c3901b28d8e73.js} +1 -1
  14. package/assets/esri/core/workers/chunks/5ba6007c3c49a8153256.js +1 -0
  15. package/assets/esri/core/workers/chunks/5bdd95eeb8f34dbf26f2.js +2 -0
  16. package/assets/esri/core/workers/chunks/{ced5dfb2bf46fc5eac8c.js → 5e47026c681238038955.js} +2 -2
  17. package/assets/esri/core/workers/chunks/{2baf35b1b19482d603b5.js → 5f7505ada0991cfbdd84.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{976303f47c342b9d1cc0.js → 62ddd3a82864e26f009a.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{542a9c414c99d84d52ab.js → 6a202ef9ba9b89e09153.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{0826feebdca8a31eb630.js → 6ba6fece5c11fe2a6ace.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{5eb69e2895e5aec81051.js → 6fd10891506925560443.js} +1 -1
  22. package/assets/esri/core/workers/chunks/7b6fd287e7043ad50f4e.js +1 -0
  23. package/assets/esri/core/workers/chunks/7baa49055bc31618b56e.js +1 -0
  24. package/assets/esri/core/workers/chunks/8570e3df90fb76a8741a.js +1 -0
  25. package/assets/esri/core/workers/chunks/{c3c0f24a9e0047232ae1.js → 8679dfc0c53355b6feb0.js} +1 -1
  26. package/assets/esri/core/workers/chunks/8a636dc51372e14c98f5.js +1 -0
  27. package/assets/esri/core/workers/chunks/{14259910f44c08fd5bbd.js → 9117c9b720c9ba6e7a6e.js} +1 -1
  28. package/assets/esri/core/workers/chunks/a22458e5272332d86cb9.js +1 -0
  29. package/assets/esri/core/workers/chunks/{3ea480cebf8ee56228a5.js → a7dfca326883384d2751.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{723d8316f5d4b6ce2942.js → a9539393e2f1812a973a.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{be0b8bb4f09aae6ff5de.js → ab784764ddf9d7f693a1.js} +1 -1
  32. package/assets/esri/core/workers/chunks/b38b6fe08a367e9de4f5.js +1 -0
  33. package/assets/esri/core/workers/chunks/{4e651869e9a196494694.js → b6e628b5d2643af4c19b.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{b37ab6b1cb4cfc85cd9d.js → b7828d7e2c5b75644057.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{ec465abb0344ad719e9d.js → bd8e329ec74d921d311a.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{56e6e70aa40e51827290.js → c3f94024c6c9eed9f273.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{6d17b45022dfd2548098.js → c5ddf8b347c31fe772a3.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{ee9af58ae202b803bba7.js → c7a0c4ca37ebd1d98cf1.js} +1 -1
  39. package/assets/esri/core/workers/chunks/d7763c42754152510e13.js +2 -0
  40. package/assets/esri/core/workers/chunks/{9e508f930086d2ef5f22.js → dfa1b0308e5e82d1ddfe.js} +40 -41
  41. package/assets/esri/core/workers/chunks/e566102c7ed7a8ebf89e.js +1 -0
  42. package/assets/esri/core/workers/chunks/e74586b074d0fa6abb4b.js +1 -0
  43. package/assets/esri/core/workers/chunks/e7dff025780726d5feae.js +1 -0
  44. package/assets/esri/core/workers/chunks/e96fa029acba59c04e4e.js +2 -0
  45. package/assets/esri/core/workers/chunks/{4401b3f8ebb658abe789.js → efd6ea0966f60ab19520.js} +1 -1
  46. package/assets/esri/core/workers/chunks/fdfbd201be372d3796bf.js +2 -0
  47. package/assets/esri/core/workers/chunks/ff0a0819bba5e8264c47.js +1 -0
  48. package/chunks/BlendLayers.glsl.js +1 -1
  49. package/chunks/ColorMaterial.glsl.js +14 -14
  50. package/chunks/Component.glsl.js +37 -37
  51. package/chunks/DefaultMaterial.glsl.js +15 -15
  52. package/chunks/HUDMaterial.glsl.js +3 -3
  53. package/chunks/Path.glsl.js +15 -15
  54. package/chunks/Pattern.glsl.js +20 -20
  55. package/chunks/RasterColorizer.glsl.js +1 -1
  56. package/chunks/ShadowHighlight.glsl.js +1 -1
  57. package/chunks/Terrain.glsl.js +24 -24
  58. package/chunks/Water.glsl.js +29 -20
  59. package/chunks/pdf.js +57 -0
  60. package/config.js +1 -1
  61. package/core/accessorSupport/write.js +1 -1
  62. package/core/scheduling.js +1 -1
  63. package/kernel.js +1 -1
  64. package/layers/VoxelWasmPerSceneView.js +1 -1
  65. package/layers/geospatialPDF/GeospatialPDFFrame.js +1 -1
  66. package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +1 -56
  67. package/layers/geospatialPDF/GeospatialPDFWorkerClient.js +1 -1
  68. package/layers/geospatialPDF/parserUtils.js +2 -0
  69. package/layers/support/ControlPoint.js +1 -1
  70. package/layers/support/ControlPointsGeoreference.js +1 -1
  71. package/layers/support/commonProperties.js +1 -1
  72. package/layers/support/geospatialPDFUtils.d.ts +63 -0
  73. package/layers/support/geospatialPDFUtils.js +2 -0
  74. package/package.json +5 -5
  75. package/symbols/CIMSymbol.d.ts +9 -9
  76. package/symbols/PathSymbol3DLayer.d.ts +1 -1
  77. package/symbols/WaterSymbol3DLayer.d.ts +13 -1
  78. package/symbols/WaterSymbol3DLayer.js +1 -1
  79. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  80. package/views/3d/analysis/Viewshed/ViewshedObserverManipulatedObject3D.js +1 -1
  81. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  82. package/views/3d/camera/intersectionUtils.js +1 -1
  83. package/views/3d/environment/EnvironmentView.js +1 -1
  84. package/views/3d/input/handlers/ground/GroundNavigation.js +1 -1
  85. package/views/3d/interactive/Manipulator3D.js +1 -1
  86. package/views/3d/interactive/Manipulator3DBase.js +1 -1
  87. package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
  88. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DView.js +1 -1
  89. package/views/3d/interactive/visualElements/Object3DVisualElement.js +1 -1
  90. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  91. package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
  92. package/views/3d/layers/DrapedSubView3D.js +1 -1
  93. package/views/3d/layers/DynamicLayerView3D.js +1 -1
  94. package/views/3d/layers/FeatureLikeLayerViewBase3D.js +1 -1
  95. package/views/3d/layers/FlowSubView3D.js +1 -1
  96. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  97. package/views/3d/layers/I3SMeshView3D.js +1 -1
  98. package/views/3d/layers/RouteLayerView3D.js +1 -1
  99. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  100. package/views/3d/layers/VectorTileLayerView3D.js +1 -1
  101. package/views/3d/layers/VoxelLayerView3D.js +1 -1
  102. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  103. package/views/3d/layers/graphics/Graphics3DFrustumVisibility.js +1 -1
  104. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  105. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  106. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  107. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  108. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  109. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  110. package/views/3d/layers/support/Tiles3DBVH.js +1 -1
  111. package/views/3d/layers/support/createTileBVHForLayer.js +1 -1
  112. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  113. package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
  114. package/views/3d/state/controllers/RotateController.js +1 -1
  115. package/views/3d/state/controllers/ZoomControllerGlobal.js +1 -1
  116. package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
  117. package/views/3d/state/utils/groundNavigationUtils.js +1 -1
  118. package/views/3d/state/utils/navigationUtils.js +1 -1
  119. package/views/3d/support/QualityProfile.js +1 -1
  120. package/views/3d/support/QualitySettings.js +1 -1
  121. package/views/3d/support/flow/StreamlineResources3DShape.js +1 -1
  122. package/views/3d/terrain/BlendLayersTechniqueConfiguration.js +1 -1
  123. package/views/3d/terrain/OverlayManager.js +1 -1
  124. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  125. package/views/3d/terrain/RasterColorizerTechniqueConfiguration.js +1 -1
  126. package/views/3d/terrain/TerrainSurface.js +1 -1
  127. package/views/3d/webgl-engine/collections/Component/Material/Component.glsl.js +1 -1
  128. package/views/3d/webgl-engine/core/shaderLibrary/clampShadowPosition.glsl.js +2 -0
  129. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +14 -14
  130. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +1 -1
  131. package/views/3d/webgl-engine/core/shaderLibrary/terrain/TileComposite.glsl.js +2 -3
  132. package/views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js +1 -1
  133. package/views/3d/webgl-engine/lib/BufferGeometry.js +1 -1
  134. package/views/3d/webgl-engine/lib/BufferObject3D.js +1 -1
  135. package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
  136. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  137. package/views/3d/webgl-engine/lib/Program.js +1 -1
  138. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  139. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  140. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  141. package/views/3d/webgl-engine/materials/DefaultLayouts.js +1 -1
  142. package/views/3d/webgl-engine/materials/Path.glsl.js +1 -1
  143. package/views/3d/webgl-engine/materials/Water.glsl.js +1 -1
  144. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  145. package/views/3d/webgl-engine/parts/Model.js +1 -1
  146. package/views/3d/webgl-engine/shaders/ColorMaterial.glsl.js +1 -1
  147. package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
  148. package/views/3d/webgl-engine/shaders/Pattern.glsl.js +1 -1
  149. package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
  150. package/views/Attribution.js +5 -5
  151. package/views/DOMContainer.d.ts +2 -1
  152. package/views/SceneView.js +1 -1
  153. package/views/draw/DrawGraphicTool.js +1 -1
  154. package/views/draw/support/surfaceCoordinateSystems.js +1 -1
  155. package/views/webgl/Program.js +3 -3
  156. package/views/webgl/ShaderBuilder.js +23 -23
  157. package/webscene/Slide.js +1 -1
  158. package/webscene/VirtualLighting.d.ts +2 -4
  159. package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +17 -1
  160. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  161. package/widgets/BatchAttributeForm/inputs/support/inputUtils.d.ts +7 -0
  162. package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
  163. package/widgets/BatchAttributeForm.js +1 -1
  164. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  165. package/widgets/Sketch/SketchViewModel.js +1 -1
  166. package/widgets/Weather/WeatherViewModel.js +1 -1
  167. package/widgets/support/ContingentValuesManager.js +1 -1
  168. package/widgets/support/forms/types.d.ts +23 -1
  169. package/assets/esri/core/workers/chunks/144f18a3dd2c8cf07cf7.js +0 -1
  170. package/assets/esri/core/workers/chunks/23fc1c1ed483ed3b2298.js +0 -1
  171. package/assets/esri/core/workers/chunks/249a687ce1b6d0815242.js +0 -1
  172. package/assets/esri/core/workers/chunks/2634927d26cb1139c6d0.js +0 -1
  173. package/assets/esri/core/workers/chunks/2d1b8154ee40afc9d40b.js +0 -1
  174. package/assets/esri/core/workers/chunks/4a41bf3d1e2e9bb79771.js +0 -2
  175. package/assets/esri/core/workers/chunks/5f324d88785ffcb73ae0.js +0 -1
  176. package/assets/esri/core/workers/chunks/70695e0fb53018d48e7b.js +0 -2
  177. package/assets/esri/core/workers/chunks/723c9ad4c25be2b82476.js +0 -1
  178. package/assets/esri/core/workers/chunks/766a1357be2ed7f4e125.js +0 -1
  179. package/assets/esri/core/workers/chunks/844c593754b2692257f4.js +0 -1
  180. package/assets/esri/core/workers/chunks/846248697c398468d8e6.js +0 -1
  181. package/assets/esri/core/workers/chunks/89e55895683369b5277a.js +0 -1
  182. package/assets/esri/core/workers/chunks/8c94e987754b3919181e.js +0 -1
  183. package/assets/esri/core/workers/chunks/919115788da38049aea7.js +0 -2
  184. package/assets/esri/core/workers/chunks/a116dd204921e7464944.js +0 -1
  185. package/assets/esri/core/workers/chunks/b33e7e74cf8fa3926617.js +0 -1
  186. package/assets/esri/core/workers/chunks/bb2af16e55cb39163827.js +0 -1
  187. package/assets/esri/core/workers/chunks/d5bb9f9b7b341c671525.js +0 -1
  188. package/assets/esri/core/workers/chunks/d96e63d66f7b1f4ea54a.js +0 -2
  189. package/assets/esri/core/workers/chunks/e3bcd2e356f75afc316a.js +0 -1
  190. package/assets/esri/core/workers/chunks/e80526571f1a34de3278.js +0 -1
  191. package/assets/esri/core/workers/chunks/ea71850ba87ae6038000.js +0 -1
  192. package/assets/esri/core/workers/chunks/f537a5e808dc546813c7.js +0 -1
  193. package/assets/esri/core/workers/chunks/fe811d651d201f698b8f.js +0 -2
  194. package/chunks/NativeLine.glsl.js +0 -8
  195. package/layers/geospatialPDF/geospatialPDFParserUtils.js +0 -2
  196. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +0 -2
  197. package/views/3d/webgl-engine/shaders/NativeLine.glsl.js +0 -2
  198. package/views/3d/webgl-engine/shaders/NativeLineTechnique.js +0 -2
  199. package/views/3d/webgl-engine/shaders/NativeLineTechniqueConfiguration.js +0 -2
  200. /package/assets/esri/core/workers/chunks/{919115788da38049aea7.js.LICENSE.txt → 3d851710f7fcc27c5b60.js.LICENSE.txt} +0 -0
  201. /package/assets/esri/core/workers/chunks/{fe811d651d201f698b8f.js.LICENSE.txt → 5bdd95eeb8f34dbf26f2.js.LICENSE.txt} +0 -0
  202. /package/assets/esri/core/workers/chunks/{ced5dfb2bf46fc5eac8c.js.LICENSE.txt → 5e47026c681238038955.js.LICENSE.txt} +0 -0
  203. /package/assets/esri/core/workers/chunks/{4a41bf3d1e2e9bb79771.js.LICENSE.txt → d7763c42754152510e13.js.LICENSE.txt} +0 -0
  204. /package/assets/esri/core/workers/chunks/{d96e63d66f7b1f4ea54a.js.LICENSE.txt → e96fa029acba59c04e4e.js.LICENSE.txt} +0 -0
  205. /package/assets/esri/core/workers/chunks/{70695e0fb53018d48e7b.js.LICENSE.txt → fdfbd201be372d3796bf.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{binaryIndexOf as e}from"../../../../core/arrayUtils.js";import t from"../../../../core/Error.js";import has from"../../../../core/has.js";import{invert as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as i,copy as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectVectorToVector as s}from"../../../../geometry/projection/projectVectorToVector.js";import{canProjectWithoutEngine as c}from"../../../../geometry/projectionUtils.js";import l from"../../../../geometry/SpatialReference.js";import{create as u,empty as d,expandPointInPlace as f,intersects as p}from"../../../../geometry/support/aaBoundingRect.js";import{fetchFeaturePopupFeatures as m}from"../../../../layers/support/featurePopupQueryUtils.js";import h from"../../../../request.js";import g from"../../../../rest/support/Query.js";import{spatialReferenceIncompatibleError as _}from"../../../support/layerViewUtils.js";import{Obb as v,compute as ee}from"../../support/orientedBoundingBox.js";import{emissiveStrengthDefault as y}from"../../webgl-engine/core/shaderLibrary/output/getEmissions.glsl.js";import{createSolidEdgeMaterial as b,createMaterialFromEdges as te}from"../support/edgeUtils.js";import{parseColorMixMode as x}from"../support/symbolColorUtils.js";import{readBinaryAttribute as S,getCachedAttributeValue as C}from"./I3SBinaryReader.js";import{computeGlobalTransformation as w}from"./I3SProjectionUtil.js";function T(e){return e?parseInt(e.slice(e.lastIndexOf(`/`)+1),10):void 0}function E(e){if(has(`disable-feature:i3s-draco`)||!e)return!1;for(let t of e)for(let e of t.geometryBuffers)if(e.compressedAttributes?.encoding===`draco`)return!0;return!1}function ne(e,t,n,r,i){n.traverse(t,t=>i.intersectsElevationUpdate(e,t)?(r(t),!0):!1)}function re(e,t,n){let r=0,i=0;for(let a=0;a<t.length&&r<e.length;a++)e[r]===t[a]&&(n(a)&&(e[i]=e[r],i++),r++);e.length=i}function ie(t,n,r){let i=0,a=0;for(;i<r.length;)e(t,r[i])>=0===n&&(r[a]=r[i],a++),i++;r.length=a}function ae(e,t){if(t.rotationScale[1]===0&&t.rotationScale[2]===0&&t.rotationScale[3]===0&&t.rotationScale[5]===0&&t.rotationScale[6]===0&&t.rotationScale[7]===0)return D[0]=(e[0]-t.position[0])/t.rotationScale[0],D[1]=(e[1]-t.position[1])/t.rotationScale[4],D[2]=(e[2]-t.position[0])/t.rotationScale[0],D[3]=(e[3]-t.position[1])/t.rotationScale[4],D}const D=u();function oe(e,t){let n=t.center[0],r=t.center[1],i=t.radius,a=e[0]-n,o=n-e[2],s=e[1]-r,c=r-e[3],l=Math.max(a,o,0),u=Math.max(s,c,0),d=l*l+u*u;return d>i*i?0:d>0?1:-Math.max(a,o,s,c)>i?3:2}function O(e,t,n){let r=[],i=n?.missingFields,a=n?.originalFields,o=!1;for(let n of e){let e=t?.get(n);e?(a?.push(n),r.push(e.name),n!==e.name&&(o=!0)):i?.push(n)}return n&&`hasMismatchedCasing`in n&&(n.hasMismatchedCasing=o),r}async function se(e,n,r,i,a,o){if(n.length===0)return[];let s=e.attributeStorageInfo;if(e.associatedLayer!=null)try{return await j(e.associatedLayer,n,i,o)}catch(t){if(e.associatedLayer.loaded)throw t}if(s){let t=k(e,n,r,a),c=e.parsedUrl.path;return await Promise.allSettled(t.map(t=>M(c,s,t.node,t.indices,i,e.apiKey,e.customParameters,o).then(e=>{for(let n=0;n<t.graphics.length;n++){let r=t.graphics[n],i=e[n];if(r.attributes)for(let e in r.attributes)e in i||(i[e]=r.attributes[e]);r.attributes=i}}))),n}throw new t(`scenelayer:no-attribute-source`,`This scene layer does not have a source for attributes available`)}function k({globalIdField:e},t,n,r){let i=new Map,a=[],o=r();for(let r of t){let t=r.attributes?.[n],s=t==null?r.getGlobalId():void 0;for(let n=0;n<o.length;n++){let c=o[n],l=A(c,t,e,s);if(l<0)continue;let u=i.get(c.node);u||(u={node:c.node,indices:[],graphics:[]},a.push(u),i.set(c.node,u)),u.indices.push(l),u.graphics.push(r);for(let e=n;e>0;e--)o[e]=o[e-1];o[0]=c;break}}return a}function A(e,t,n,r){if(t!=null&&typeof t==`number`)return e.featureIds.indexOf(t);if(r==null||n==null)return-1;let i=e.attributeInfo?.attributeData?.[n];return i?i.indexOf(r):-1}async function j(e,t,n,r){let i=[],a={hasMismatchedCasing:!1,originalFields:i},o=O(n,e.fieldsIndex,a),s=new g({outFields:[...o]});if(await m(e,t,s,{updateSourceAttributes:!0,...r}),!a.hasMismatchedCasing)return t;for(let e=0;e<t.length;e++){let n=t[e];if(n.attributes)for(let e=0;e<i.length;e++){let t=i[e],r=o[e];r in n.attributes&&(n.attributes[t]=n.attributes[r],delete n.attributes[r])}}return t}function M(e,t,n,r,i,a,o,s){return N(e,t,n.resources.attributes,r,i,a,o,s)}async function N(e,t,n,r,i,a,o,s){let c=[];for(let r of t)if(r&&i.includes(r.name)){let t=`${e}/nodes/${n}/attributes/${r.key}/0`;c.push({url:t,storageInfo:r})}let l=await Promise.allSettled(c.map(e=>h(e.url,{responseType:`array-buffer`,query:{...o,token:a},signal:s?.signal}).then(t=>S(e.storageInfo,t.data)))),u=[];for(let e of r){let t={};for(let n=0;n<l.length;n++){let r=l[n];if(r.status===`fulfilled`){let i=r.value;t[c[n].storageInfo.name]=C(i,e)}}u.push(t)}return u}function P(e){let n=e.store,r=n.indexCRS||n.geographicCRS,i=r===void 0?n.indexWKT:void 0;if(i){if(e.spatialReference){if(i!==e.spatialReference.wkt)throw new t(`layerview:store-spatial-reference-wkt-index-incompatible`,`The indexWKT of the scene layer store does not match the WKT of the layer spatial reference`,{})}else throw new t(`layerview:no-store-spatial-reference-wkt-index-and-no-layer-spatial-reference`,`Found indexWKT in the scene layer store but no layer spatial reference`,{})}let a=r?new l(T(r)):e.spatialReference;return a.equals(e.spatialReference)?e.spatialReference:a}function F(e){let n=e.store,r=n.vertexCRS||n.projectedCRS,i=r===void 0?n.vertexWKT:void 0;if(i){if(e.spatialReference){if(i!==e.spatialReference.wkt)throw new t(`layerview:store-spatial-reference-wkt-vertex-incompatible`,`The vertexWKT of the scene layer store does not match the WKT of the layer spatial reference`,{})}else throw new t(`layerview:no-store-spatial-reference-wkt-vertex-and-no-layer-spatial-reference`,`Found vertexWKT in the scene layer store but no layer spatial reference`,{})}let a=r?new l(T(r)):e.spatialReference;return a.equals(e.spatialReference)?e.spatialReference:a}function I(e,t,n){if(!c(e,t)||n===`local`&&!R(e,t))throw _(`scene layer`,e?.wkid,t?.wkid)}function L(e,n,r){if(e.serviceUpdateTimeStamp?.lastUpdate!==n.serviceUpdateTimeStamp?.lastUpdate||!r.isEmpty||e.associatedLayer?.url!==n.associatedLayer?.url)throw new t(`layerview:recycle-failed`,`Could not recycle layerview`)}function R(e,t){return e.equals(t)||e.isWGS84&&t.isWebMercator||e.isWebMercator&&t.isWGS84}function z(e,t,n){let r=P(e),i=F(e);I(r,t,n),I(i,t,n)}function B(e){return!(e.geometryType!=null&&e.geometryType!==`triangles`||e.topology!=null&&e.topology!==`PerAttributeArray`||e.vertexAttributes?.position==null)}function V(e){if(e.store?.defaultGeometrySchema==null||!B(e.store.defaultGeometrySchema))throw new t(`scenelayer:unsupported-geometry-schema`,`The geometry schema of this scene layer is not supported.`,{url:e.parsedUrl.path})}function H(e,t){z(e,t.spatialReference,t.viewingMode)}function U(e){return!(e.geometryType==null||e.geometryType!==`points`||e.topology!=null&&e.topology!==`PerAttributeArray`||e.encoding!=null&&e.encoding!==``&&e.encoding!==`lepcc-xyz`||e.vertexAttributes?.position==null)}function W(e){if(e.store?.defaultGeometrySchema==null||!U(e.store.defaultGeometrySchema))throw new t(`pointcloud:unsupported-geometry-schema`,`The geometry schema of this point cloud scene layer is not supported.`,{})}function G(e,t){I(e.spatialReference,t.spatialReference,t.viewingMode)}function ce(e){return e.type===`simple`||e.type===`class-breaks`||e.type===`unique-value`}function le(e){return e.type===`mesh-3d`}function ue(e){if(e==null||!ce(e)||(e.type===`unique-value`||e.type===`class-breaks`)&&e.defaultSymbol==null)return!0;let t=e.symbols;if(t.length===0)return!0;for(let e of t){if(!le(e)||e.symbolLayers.length===0)return!0;for(let t of e.symbolLayers.items)if(t.type!==`fill`||t.material?.color==null||t.material.colorMixMode!==`replace`)return!0}return!1}const de=b({color:[0,0,0,0],opacity:0});class K{constructor(){this.edgeMaterial=null,this.material=null,this.castShadows=!0}}function fe(e){let t=new K,n=!1,r=!1;for(let i of e.symbolLayers.items)if(i.type===`fill`&&i.enabled){let e=i.material,a=i.edges;if(e!=null&&!n){let r=e.color,a=x(e.colorMixMode),o={strength:e.emissive?.strength??y,source:+(e.emissive?.source===`color`)};t.material=r==null?{color:[1,1,1],alpha:1,colorMixMode:1,emissive:o}:{color:[r.r/255,r.g/255,r.b/255],alpha:r.a,colorMixMode:a,emissive:o},t.castShadows=i.castShadows,n=!0}a!=null&&!r&&(t.edgeMaterial=te(a,{}),r=!0)}return t.material||={color:[1,1,1],alpha:1,colorMixMode:1,emissive:{strength:y,source:0}},t}function q(e,t){return(e|0)+(t|0)|0}function pe(e,t,r,o,c,l,u){if(!l||l.length===0||t==null||!e.serviceMbsInIndexSR)return null;let m=w(e.serviceMbsInIndexSR,c,`none`,r,t);n($,m);let h=null,g=()=>{if(!h){if(h=me,d(Y),e.serviceObbInIndexSR!=null){e.serviceObbInIndexSR.transform(X,r,t,c,u),X.getCorners(h);for(let e of h)i(e,e,$),f(Y,e)}else{let n=e.serviceMbsInIndexSR;if(!n)return;let o=n.radius;s(n.center,r,Z,t),i(Z,Z,$),Z[2]+=c;for(let e=0;e<8;++e){let t=e&1?o:-o,n=e&2?o:-o,r=e&4?o:-o,i=h[e];a(i,[Z[0]+t,Z[1]+n,Z[2]+r]),f(Y,i)}}}},_=1/0,v=-1/0,y=e=>{if(e.type!==`replace`)return;let n=e.geometry;if(!n?.hasZ)return;d(J);let r=n.spatialReference||o,a=n.rings.reduce((e,n)=>n.reduce((e,n)=>(s(n,r,Z,t),i(Z,Z,$),f(J,Z),Math.min(Z[2],e)),e),1/0);g(),p(Y,J)&&(_=Math.min(_,a),v=Math.max(v,a))};if(l.forEach(e=>y(e)),_===1/0)return null;let b=(e,t,n)=>{i(Z,n,m),e[t]=Z[0],e[t+1]=Z[1],e[t+2]=Z[2],t+=24,n[2]=_,i(Z,n,m),e[t]=Z[0],e[t+1]=Z[1],e[t+2]=Z[2],t+=24,n[2]=v,i(Z,n,m),e[t]=Z[0],e[t+1]=Z[1],e[t+2]=Z[2]};for(let e=0;e<8;++e)b(Q.data,e*3,h[e]);return ee(Q)}const me=[o(),o(),o(),o(),o(),o(),o(),o()],J=u(),Y=u(),X=new v,Z=o(),Q={data:Array(72),size:3,exclusive:!0,stride:3},$=r();export{K as SymbolInfo,q as addWraparound,G as checkPointCloudLayerCompatibleWithView,W as checkPointCloudLayerValid,L as checkRecyclable,H as checkSceneLayerCompatibleWithView,V as checkSceneLayerValid,I as checkSpatialReference,z as checkSpatialReferences,pe as computeVisibilityObb,E as containsDraco,T as extractWkid,re as filterInPlace,O as findFieldsCaseInsensitive,ne as findIntersectingNodes,ae as getClipRect,P as getIndexCrs,fe as getSymbolInfo,F as getVertexCrs,oe as intersectBoundingRectWithMbs,R as isSupportedLocalModeProjection,ie as objectIdFilter,N as queryAttributesFromCachedAttributesId,ue as rendererNeedsTextures,de as transparentEdgeMaterial,se as whenGraphicAttributes};
2
+ import{binaryIndexOf as e}from"../../../../core/arrayUtils.js";import t from"../../../../core/Error.js";import has from"../../../../core/has.js";import{invert as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as i,transformMat4 as a,copy as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectVectorToVector as c}from"../../../../geometry/projection/projectVectorToVector.js";import{canProjectWithoutEngine as l}from"../../../../geometry/projectionUtils.js";import u from"../../../../geometry/SpatialReference.js";import{fromBuffer as d}from"../../../../geometry/support/aaBoundingBox.js";import{create as f,intersects as p,empty as m,expandPointInPlace as h}from"../../../../geometry/support/aaBoundingRect.js";import{fetchFeaturePopupFeatures as g}from"../../../../layers/support/featurePopupQueryUtils.js";import _ from"../../../../request.js";import v from"../../../../rest/support/Query.js";import{spatialReferenceIncompatibleError as y}from"../../../support/layerViewUtils.js";import{Obb as b,compute as ee}from"../../support/orientedBoundingBox.js";import{emissiveStrengthDefault as x}from"../../webgl-engine/core/shaderLibrary/output/getEmissions.glsl.js";import{createSolidEdgeMaterial as te,createMaterialFromEdges as S}from"../support/edgeUtils.js";import{parseColorMixMode as C}from"../support/symbolColorUtils.js";import{readBinaryAttribute as w,getCachedAttributeValue as ne}from"./I3SBinaryReader.js";import{computeGlobalTransformation as re}from"./I3SProjectionUtil.js";function T(e){return e?parseInt(e.slice(e.lastIndexOf(`/`)+1),10):void 0}function E(e){if(has(`disable-feature:i3s-draco`)||!e)return!1;for(let t of e)for(let e of t.geometryBuffers)if(e.compressedAttributes?.encoding===`draco`)return!0;return!1}function D(e,t,n,r,i){n.traverse(t,t=>i.intersectsElevationUpdate(e,t)?(r(t),!0):!1)}function O(e,t,n){let r=0,i=0;for(let a=0;a<t.length&&r<e.length;a++)e[r]===t[a]&&(n(a)&&(e[i]=e[r],i++),r++);e.length=i}function k(t,n,r){let i=0,a=0;for(;i<r.length;)e(t,r[i])>=0===n&&(r[a]=r[i],a++),i++;r.length=a}function ie(e,t){if(t.rotationScale[1]===0&&t.rotationScale[2]===0&&t.rotationScale[3]===0&&t.rotationScale[5]===0&&t.rotationScale[6]===0&&t.rotationScale[7]===0)return A[0]=(e[0]-t.position[0])/t.rotationScale[0],A[1]=(e[1]-t.position[1])/t.rotationScale[4],A[2]=(e[2]-t.position[0])/t.rotationScale[0],A[3]=(e[3]-t.position[1])/t.rotationScale[4],A}const A=f();function ae(e,t){let n=t.center[0],r=t.center[1],i=t.radius,a=e[0]-n,o=n-e[2],s=e[1]-r,c=r-e[3],l=Math.max(a,o,0),u=Math.max(s,c,0),d=l*l+u*u;return d>i*i?0:d>0?1:-Math.max(a,o,s,c)>i?3:2}function j(e,t,n){let r=[],i=n?.missingFields,a=n?.originalFields,o=!1;for(let n of e){let e=t?.get(n);e?(a?.push(n),r.push(e.name),n!==e.name&&(o=!0)):i?.push(n)}return n&&`hasMismatchedCasing`in n&&(n.hasMismatchedCasing=o),r}async function oe(e,n,r,i,a,o){if(n.length===0)return[];let s=e.attributeStorageInfo;if(e.associatedLayer!=null)try{return await N(e.associatedLayer,n,i,o)}catch(t){if(e.associatedLayer.loaded)throw t}if(s){let t=se(e,n,r,a),c=e.parsedUrl.path;return await Promise.allSettled(t.map(t=>P(c,s,t.node,t.indices,i,e.apiKey,e.customParameters,o).then(e=>{for(let n=0;n<t.graphics.length;n++){let r=t.graphics[n],i=e[n];if(r.attributes)for(let e in r.attributes)e in i||(i[e]=r.attributes[e]);r.attributes=i}}))),n}throw new t(`scenelayer:no-attribute-source`,`This scene layer does not have a source for attributes available`)}function se({globalIdField:e},t,n,r){let i=new Map,a=[],o=r();for(let r of t){let t=r.attributes?.[n],s=t==null?r.getGlobalId():void 0;for(let n=0;n<o.length;n++){let c=o[n],l=M(c,t,e,s);if(l<0)continue;let u=i.get(c.node);u||(u={node:c.node,indices:[],graphics:[]},a.push(u),i.set(c.node,u)),u.indices.push(l),u.graphics.push(r);for(let e=n;e>0;e--)o[e]=o[e-1];o[0]=c;break}}return a}function M(e,t,n,r){if(t!=null&&typeof t==`number`)return e.featureIds.indexOf(t);if(r==null||n==null)return-1;let i=e.attributeInfo?.attributeData?.[n];return i?i.indexOf(r):-1}async function N(e,t,n,r){let i=[],a={hasMismatchedCasing:!1,originalFields:i},o=j(n,e.fieldsIndex,a),s=new v({outFields:[...o]});if(await g(e,t,s,{updateSourceAttributes:!0,...r}),!a.hasMismatchedCasing)return t;for(let e=0;e<t.length;e++){let n=t[e];if(n.attributes)for(let e=0;e<i.length;e++){let t=i[e],r=o[e];r in n.attributes&&(n.attributes[t]=n.attributes[r],delete n.attributes[r])}}return t}function P(e,t,n,r,i,a,o,s){return F(e,t,n.resources.attributes,r,i,a,o,s)}async function F(e,t,n,r,i,a,o,s){let c=[];for(let r of t)if(r&&i.includes(r.name)){let t=`${e}/nodes/${n}/attributes/${r.key}/0`;c.push({url:t,storageInfo:r})}let l=await Promise.allSettled(c.map(e=>_(e.url,{responseType:`array-buffer`,query:{...o,token:a},signal:s?.signal}).then(t=>w(e.storageInfo,t.data)))),u=[];for(let e of r){let t={};for(let n=0;n<l.length;n++){let r=l[n];if(r.status===`fulfilled`){let i=r.value;t[c[n].storageInfo.name]=ne(i,e)}}u.push(t)}return u}function I(e){let n=e.store,r=n.indexCRS||n.geographicCRS,i=r===void 0?n.indexWKT:void 0;if(i){if(e.spatialReference){if(i!==e.spatialReference.wkt)throw new t(`layerview:store-spatial-reference-wkt-index-incompatible`,`The indexWKT of the scene layer store does not match the WKT of the layer spatial reference`,{})}else throw new t(`layerview:no-store-spatial-reference-wkt-index-and-no-layer-spatial-reference`,`Found indexWKT in the scene layer store but no layer spatial reference`,{})}let a=r?new u(T(r)):e.spatialReference;return a.equals(e.spatialReference)?e.spatialReference:a}function L(e){let n=e.store,r=n.vertexCRS||n.projectedCRS,i=r===void 0?n.vertexWKT:void 0;if(i){if(e.spatialReference){if(i!==e.spatialReference.wkt)throw new t(`layerview:store-spatial-reference-wkt-vertex-incompatible`,`The vertexWKT of the scene layer store does not match the WKT of the layer spatial reference`,{})}else throw new t(`layerview:no-store-spatial-reference-wkt-vertex-and-no-layer-spatial-reference`,`Found vertexWKT in the scene layer store but no layer spatial reference`,{})}let a=r?new u(T(r)):e.spatialReference;return a.equals(e.spatialReference)?e.spatialReference:a}function R(e,t,n){if(!l(e,t)||!n&&!B(e,t))throw y(`scene layer`,e?.wkid,t?.wkid)}function z(e,n,r){if(e.serviceUpdateTimeStamp?.lastUpdate!==n.serviceUpdateTimeStamp?.lastUpdate||!r.isEmpty||e.associatedLayer?.url!==n.associatedLayer?.url)throw new t(`layerview:recycle-failed`,`Could not recycle layerview`)}function B(e,t){return e.equals(t)||e.isWGS84&&t.isWebMercator||e.isWebMercator&&t.isWGS84}function V(e,t,n){let r=I(e),i=L(e);R(r,t,n),R(i,t,n)}function H(e){return!(e.geometryType!=null&&e.geometryType!==`triangles`||e.topology!=null&&e.topology!==`PerAttributeArray`||e.vertexAttributes?.position==null)}function U(e){if(e.store?.defaultGeometrySchema==null||!H(e.store.defaultGeometrySchema))throw new t(`scenelayer:unsupported-geometry-schema`,`The geometry schema of this scene layer is not supported.`,{url:e.parsedUrl.path})}function W(e,t){V(e,t.spatialReference,t.state.isGlobal)}function G(e){return!(e.geometryType==null||e.geometryType!==`points`||e.topology!=null&&e.topology!==`PerAttributeArray`||e.encoding!=null&&e.encoding!==``&&e.encoding!==`lepcc-xyz`||e.vertexAttributes?.position==null)}function K(e){if(e.store?.defaultGeometrySchema==null||!G(e.store.defaultGeometrySchema))throw new t(`pointcloud:unsupported-geometry-schema`,`The geometry schema of this point cloud scene layer is not supported.`,{})}function ce(e,t){R(e.spatialReference,t.spatialReference,t.state.isGlobal)}function le(e){return e.type===`simple`||e.type===`class-breaks`||e.type===`unique-value`}function ue(e){return e.type===`mesh-3d`}function de(e){if(e==null||!le(e)||(e.type===`unique-value`||e.type===`class-breaks`)&&e.defaultSymbol==null)return!0;let t=e.symbols;if(t.length===0)return!0;for(let e of t){if(!ue(e)||e.symbolLayers.length===0)return!0;for(let t of e.symbolLayers.items)if(t.type!==`fill`||t.material?.color==null||t.material.colorMixMode!==`replace`)return!0}return!1}const fe=te({color:[0,0,0,0],opacity:0});class q{constructor(){this.edgeMaterial=null,this.material=null,this.castShadows=!0}}function pe(e){let t=new q,n=!1,r=!1;for(let i of e.symbolLayers.items)if(i.type===`fill`&&i.enabled){let e=i.material,a=i.edges;if(e!=null&&!n){let r=e.color,a=C(e.colorMixMode),o={strength:e.emissive?.strength??x,source:+(e.emissive?.source===`color`)};t.material=r==null?{color:[1,1,1],alpha:1,colorMixMode:1,emissive:o}:{color:[r.r/255,r.g/255,r.b/255],alpha:r.a,colorMixMode:a,emissive:o},t.castShadows=i.castShadows,n=!0}a!=null&&!r&&(t.edgeMaterial=S(a,{}),r=!0)}return t.material||={color:[1,1,1],alpha:1,colorMixMode:1,emissive:{strength:x,source:0}},t}function me(e,t){return(e|0)+(t|0)|0}function he(e,t,n){let r=[];if(n==null)return r;for(let i of e){let e=i.geometry;if(i.type!==`replace`||!e?.hasZ)continue;let a=e.rings,o=new Float64Array(a.reduce((e,t)=>e+t.length,0)*3),s=e.spatialReference||t,l=0;for(let e of a)for(let t of e)c(t,s,Z,n),o.set(Z,l),l+=3;o.length>0&&r.push({vertices:o,bounds:d(o)})}return r}function ge(e,t,r,s,l,u){if(!l||l.length===0||t==null||!e.serviceMbsInIndexSR)return null;let d=re(e.serviceMbsInIndexSR,s,`none`,r,t);n($,d);let f=null,g=()=>{if(!f){if(f=_e,m(Y),e.serviceObbInIndexSR!=null){e.serviceObbInIndexSR.transform(X,r,t,s,u),X.getCorners(f);for(let e of f)a(e,e,$),h(Y,e)}else{let n=e.serviceMbsInIndexSR;if(!n)return;let i=n.radius;c(n.center,r,Z,t),a(Z,Z,$),Z[2]+=s;for(let e=0;e<8;++e){let t=e&1?i:-i,n=e&2?i:-i,r=e&4?i:-i,a=f[e];o(a,[Z[0]+t,Z[1]+n,Z[2]+r]),h(Y,a)}}}},_=1/0,v=-1/0,y=({vertices:e,bounds:t})=>{for(let e=0;e<2;++e){let n=$[e],r=$[e+4],i=$[e+8],a=$[e+12];J[e]=n*t[n<0?3:0]+r*t[r<0?4:1]+i*t[i<0?5:2]+a,J[e+2]=n*t[n<0?0:3]+r*t[r<0?1:4]+i*t[i<0?2:5]+a}if(g(),!p(Y,J))return;m(J);let n=1/0;for(let t=0;t<e.length;t+=3)i(Z,e[t],e[t+1],e[t+2]),a(Z,Z,$),h(J,Z),n=Math.min(n,Z[2]);p(Y,J)&&(_=Math.min(_,n),v=Math.max(v,n))};if(l.forEach(e=>y(e)),_===1/0)return null;let b=(e,t,n)=>{a(Z,n,d),e[t]=Z[0],e[t+1]=Z[1],e[t+2]=Z[2],t+=24,n[2]=_,a(Z,n,d),e[t]=Z[0],e[t+1]=Z[1],e[t+2]=Z[2],t+=24,n[2]=v,a(Z,n,d),e[t]=Z[0],e[t+1]=Z[1],e[t+2]=Z[2]};for(let e=0;e<8;++e)b(Q.data,e*3,f[e]);return ee(Q)}const _e=[s(),s(),s(),s(),s(),s(),s(),s()],J=f(),Y=f(),X=new b,Z=s(),Q={data:Array(72),size:3,exclusive:!0,stride:3},$=r();export{q as SymbolInfo,me as addWraparound,ce as checkPointCloudLayerCompatibleWithView,K as checkPointCloudLayerValid,z as checkRecyclable,W as checkSceneLayerCompatibleWithView,U as checkSceneLayerValid,R as checkSpatialReference,V as checkSpatialReferences,ge as computeVisibilityObb,E as containsDraco,T as extractWkid,O as filterInPlace,j as findFieldsCaseInsensitive,D as findIntersectingNodes,ie as getClipRect,I as getIndexCrs,pe as getSymbolInfo,L as getVertexCrs,ae as intersectBoundingRectWithMbs,B as isSupportedLocalModeProjection,k as objectIdFilter,he as projectVisibilityModifications,F as queryAttributesFromCachedAttributesId,de as rendererNeedsTextures,fe as transparentEdgeMaterial,oe as whenGraphicAttributes};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{sub as e,normalize as t,len as n,dot as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as i,create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import o from"../../../../core/Logger.js";import{getOrCreateMapValue as s}from"../../../../core/MapUtils.js";import{fromValues as c,isEmpty as l,containedBySphere as u,setEmpty as d,intersectsSphere as f,intersectsRay as p,copy as m,exactEquals as h}from"../../../../geometry/support/aaBoundingBox.js";import{fromValues as g}from"../../../../geometry/support/aaBoundingRect.js";import{earth as _}from"../../../../geometry/support/Ellipsoid.js";import{ElevationRange as v}from"../../support/ElevationRange.js";function y(e,t){return e===`local`?new x(t):new S(t)}class b{constructor(e,t){this.viewingMode=e,this.layerExtent=t,this._rootNode=null,this._intersectionGeneration=0,this._tileMap=new Map}get elevationRange(){return this._rootNode?.subtreeElevationRange}destroy(){this._rootNode?.clear(),this._tileMap.clear()}_nextIntersectionGeneration(){return this._intersectionGeneration++,this._intersectionGeneration}addTile(e){let{obb:t}=e,n=[this._ensureRootNode()],r=[],i=s(this._tileMap,e,()=>new Set),a=t=>{if(i.has(t))return;let n=t.addOwnTile(e);T(r,t.parent,n),i.add(t)};for(;n.length>0;){let r=n.pop(),i=this._getSizeStopLength(r);if(r.treeDepth>=U||A(e.obb)>=.5*i){a(r);continue}let{hPlane:o,vPlane:s}=r,c=t.signedDistancePlane(o.normal,o.distance),l=t.signedDistancePlane(s.normal,s.distance);c===0&&l===0?a(r):w(r,c,l,(e,t)=>{n.push(this._ensureChild(e,t))})}this._propagateSummaryUpdates(r)}removeTile(e){if(!this._rootNode){o.getLogger(`Tiles3DBVH`).error(`Tiles3DBVH: Attempted to remove a tile that is not loaded (no root node)`);return}let t=this._tileMap.get(e);if(!t||t.size===0){o.getLogger(`Tiles3DBVH`).error(`Tiles3DBVH internal error: Attempted to remove a tile that is not loaded (not in tile map)`);return}let n=[];this._tileMap.delete(e);for(let r of t){r.removeOwnTile(e);let t=r.updateOwnSummaries();T(n,r.parent,t)}this._propagateSummaryUpdates(n)}_propagateSummaryUpdates(e){if(e.length===0)return;e.sort((e,t)=>e.node.treeDepth-t.node.treeDepth);let t=new Map,n=-1,r=()=>e.length>0?e[e.length-1].node.treeDepth:-1;for(;e.length>0||t.size>0;){let i=t.size>0?n:r(),a=t;for(t=new Map;e.length>0&&r()===i;){let{node:t,childrenUpdateKind:n}=e.pop();E(a,t,n)}for(let[e,n]of a){let r=0;for(let t=0;t<4;t++){let n=e.children[t];n&&n.isLeaf&&!n.hasTiles&&(n.clear(),e.children[t]=null,r=3)}r|=e.updateSubtreeSummaries(n|r),E(t,e.parent,r)}t.size>0&&(n=i-1)}}forEachTileIntersectingRay(e,t,n,r){r?this._forEachTileIntersectingVerticalRay(e,t,n):this._forEachTileIntersectingRayGeneral(e,t,n)}_forEachTileIntersectingRayGeneral(n,r,i){let a=this._rootNode;if(!a)return;e(B,r,n);let o=t(B,B);if(!a.subtreeIntersectsRay(n,o,{tMin:0,tMax:1/0}))return;let s=this._nextIntersectionGeneration(),c=[a],l=H;l.length=0,l.push(0,1/0);let u={tMin:0,tMax:1/0};for(;c.length>0;){let e=c.pop();u.tMax=l.pop(),u.tMin=l.pop(),e.forEachOwnTileIntersectingRay(n,o,u,s,i);let{hPlane:t,vPlane:r}=e;for(let i=0;i<4;i++){let a=e.children[i];if(a==null)continue;let s=i,d=s===0||s===2,f=s===0||s===1,p=N(n,o,N(n,o,u,r,!d),t,!f);p&&a.subtreeIntersectsRay(n,o,p)&&(c.push(a),l.push(p.tMin,p.tMax))}}}_forEachTileIntersectingVerticalRay(r,i,a){let o=this._rootNode;if(!o)return;e(B,i,r);let s=t(B,B),c={tMin:0,tMax:this.viewingMode===`global`?n(r):1/0};if(!o.subtreeIntersectsRay(r,s,c))return;let l=this._nextIntersectionGeneration(),u=[o];for(;u.length>0;){let e=u.pop();e.forEachOwnTileIntersectingRay(r,s,c,l,a),e.isLeaf||w(e,k(e.hPlane,r),k(e.vPlane,r),(e,t)=>{let n=e.children[t];n&&n.subtreeIntersectsRay(r,s,c)&&u.push(n)},1)}}getElevationRangeIntersectingSphere(e){let t=this._rootNode;if(!t||!t.subtreeIntersectsSphere(e))return null;let n=this._nextIntersectionGeneration(),r=new v,i=[t];for(;i.length>0;){let t=i.pop();if(!r.contains(t.subtreeElevationRange)){if(t.subtreeContainedBySphere(e))r.expandElevationRange(t.subtreeElevationRange);else{if(t.ownIntersectsSphere(e))for(let i of t.ownTiles){if(i.bvhIntersectionGeneration===n||(i.bvhIntersectionGeneration=n,!(i.boundingVolumeIntersectsSphere?.(e)??i.obb.intersectSphere(e))))continue;let t=i.elevationRange;r.contains(t)||r.expandElevationRange(t)}t.isLeaf||w(t,O(e.center,e.radius,t.hPlane),O(e.center,e.radius,t.vPlane),(t,n)=>{let a=t.children[n];if(a&&a.subtreeIntersectsSphere(e)){if(r.contains(a.subtreeElevationRange))return;i.push(a)}})}}}return r.isEmpty?null:r}}class x extends b{constructor(e){super(`local`,e)}_getSizeStopLength(e){return e.sideLength}_ensureRootNode(){if(!this._rootNode){let e=this.layerExtent,t=Math.max(Math.abs(e[0]),Math.abs(e[1]),Math.abs(e[2]),Math.abs(e[3])),n=2**Math.max(1,Math.ceil(Math.log2(t))),r=new C(null,0,g(-n,-n,n,n),new D(i(0,1,0),0),new D(i(1,0,0),0),n*2,c(-n,-n,-1/0,n,n,1/0));this._rootNode=r}return this._rootNode}_ensureChild(e,t){if(e.treeDepth>=U){let e=`Internal error: attempted to create a child node for a node that is already at max depth`;throw o.getLogger(`Tiles3DBVH`).error(e),Error(e)}let n=e.children[t];if(n===null){let{extent:r,hPlane:i,vPlane:a,treeDepth:o,sideLength:s}=e,l=.5*(r[0]+r[2]),u=.5*(r[1]+r[3]),d=t===0||t===1,f=t===2||t===0,p=g(f?r[0]:l,d?r[1]:u,f?l:r[2],d?u:r[3]),m=new D(i.normal,-.5*(p[1]+p[3])),h=new D(a.normal,-.5*(p[0]+p[2]));n=new C(e,o+1,p,m,h,s*.5,c(p[0],p[1],-1/0,p[2],p[3],1/0)),e.children[t]=n}return n}}class S extends b{constructor(e){super(`global`,e)}_getSizeStopLength(e){return M(e.extent)}_ensureRootNode(){if(!this._rootNode){let e=new C(null,0,g(-Math.PI,-Math.PI/2,Math.PI,Math.PI/2),new D(i(0,0,1),0),new D(i(0,1,0),0),Math.PI*_.radius);this._rootNode=e}return this._rootNode}_ensureChild(e,t){if(e.treeDepth>=U){let e=`Attempted to create a child node for a node that is already at max depth`;throw o.getLogger(`Tiles3DBVH`).error(e),Error(e)}let n=e.children[t];if(n===null){let{extent:r,treeDepth:a}=e,o=.5*(r[0]+r[2]),s=.5*(r[1]+r[3]),c=t===0||t===1,l=t===2||t===0,u=g(l?r[0]:o,c?r[1]:s,l?o:r[2],c?s:r[3]),d=.5*(u[0]+u[2]),f=.5*(u[1]+u[3]),p=Math.cos(d),m=Math.sin(d),h=Math.cos(f),_=Math.sin(f),v=i(-_*p,-_*m,h),y=new D(v,0),b=new D(i(-m,p,0),0),x=j(u);n=new C(e,a+1,u,y,b,x),e.children[t]=n}return n}}class C{constructor(e,t,n,r,i,a,o){this.parent=e,this._treeDepth=t,this.extent=n,this.hPlane=r,this.vPlane=i,this.sideLength=a,this.bounds=o,this._ownAABB=c(1/0,1/0,1/0,-1/0,-1/0,-1/0),this._subtreeAABB=c(1/0,1/0,1/0,-1/0,-1/0,-1/0),this._ownElevationRange=new v,this._subtreeElevationRange=new v,this._ownTiles=[],this.children=[null,null,null,null]}get subtreeAABB(){return this._subtreeAABB}get subtreeElevationRange(){return this._subtreeElevationRange}subtreeContainedBySphere(e){let t=this._subtreeAABB;return l(t)?!0:u(t,e)}clear(){for(let e=0;e<4;e++)this.children[e]?.clear(),this.children[e]=null;this._ownTiles.length=0,d(this._ownAABB),d(this._subtreeAABB),this._ownElevationRange.initializeEmpty(),this._subtreeElevationRange.initializeEmpty()}get isLeaf(){return this.children.every(e=>e==null)}get treeDepth(){return this._treeDepth}subtreeIntersectsSphere(e){return f(this.subtreeAABB,e)}ownIntersectsSphere(e){return this.hasTiles&&f(this._ownAABB,e)}subtreeIntersectsRay(e,t,n){return p(this._subtreeAABB,e,t,n)}ownIntersectsRay(e,t,n){return this.hasTiles?p(this._ownAABB,e,t,n):null}forEachOwnTileIntersectingRay(e,t,n,r,i){if(this.ownIntersectsRay(e,t,n))for(let n of this.ownTiles)n.bvhIntersectionGeneration!==r&&(n.bvhIntersectionGeneration=r,(n.boundingVolumeIntersectsRay?.(e,t)??n.obb.intersectRay(e,t))&&i(n))}addOwnTile(e){this._ownTiles.push(e);let t=P(this._ownAABB,e,this.bounds)&&F(this._subtreeAABB,this._ownAABB,this.bounds),n=this._ownElevationRange.expandElevationRange(e.elevationRange)&&this._subtreeElevationRange.expandElevationRange(e.elevationRange);return!!t|(n?2:0)}removeOwnTile(e){let t=this._ownTiles,n=t.indexOf(e);if(n===-1){o.getLogger(`Tiles3DBVH`).error(`BVNode: Attempted to remove a tile that is not in the node`);return}let r=t.length-1;n<r&&(t[n]=t[r]),t.length=r}updateOwnSummaries(){let e=I(this._ownAABB,this.ownTiles,this.bounds),t=L(this._ownElevationRange,this.ownTiles),n=!!e|(t?2:0);return this.updateSubtreeSummaries(n)}updateSubtreeSummaries(e){if(this.isLeaf&&!this.hasTiles)return d(this._subtreeAABB),this._subtreeElevationRange.initializeEmpty(),3;let t=0;if(e&1){m(R,this._subtreeAABB),d(this._subtreeAABB),F(this._subtreeAABB,this._ownAABB,this.bounds);for(let e of this.children)e&&F(this._subtreeAABB,e.subtreeAABB,this.bounds);h(this._subtreeAABB,R)||(t|=1)}if(e&2){z.setElevationRange(this._subtreeElevationRange),this._subtreeElevationRange.initializeEmpty(),this._subtreeElevationRange.expandElevationRange(this._ownElevationRange);for(let e of this.children)e&&this._subtreeElevationRange.expandElevationRange(e.subtreeElevationRange);this._subtreeElevationRange.equals(z)||(t|=2)}return t}get ownTiles(){return this._ownTiles}get hasTiles(){return this._ownTiles.length>0}}function w(e,t,n,r,i=1e-12){t<=i&&(n<=i&&r(e,0),n>=-i&&r(e,1)),t>=-i&&(n<=i&&r(e,2),n>=-i&&r(e,3))}function T(e,t,n){t!=null&&n!==0&&e.push({node:t,childrenUpdateKind:n})}function E(e,t,n){if(t==null||n===0)return;let r=e.get(t)??0;e.set(t,r|n)}class D{constructor(e=[0,0,0],t=0){this.normal=e,this.distance=t}}function O(e,t,n){let i=r(n.normal,e)+n.distance;return i<0?Math.min(i+t,0):Math.max(i-t,0)}function k(e,t){return r(e.normal,t)+e.distance}function A(e){return 2*Math.max(e.halfSizeX,e.halfSizeY,e.halfSizeZ)}function j(e){let t=Math.abs(e[2]-e[0]),n=Math.abs(e[3]-e[1]),r=.5*(e[1]+e[3]),i=_.radius*Math.abs(Math.cos(r))*t,a=_.radius*n;return Math.max(i,a)}function M(e){let t=Math.abs(e[2]-e[0]),n=Math.abs(e[3]-e[1]),r=.5*(e[1]+e[3]),i=_.radius*Math.abs(Math.cos(r))*t,a=_.radius*n;return Math.min(i,a)}function N(e,t,n,i,a){if(!n)return null;let o=1e-12,s=r(i.normal,t),c=k(i,e)+n.tMin*s;if(Math.abs(s)<o)return(a?c>=-1e-12:c<=o)?n:null;let l=n.tMin-c/s,u=a===s>0?{tMin:Math.max(n.tMin,l),tMax:n.tMax}:{tMin:n.tMin,tMax:Math.min(n.tMax,l)};return u.tMin<=u.tMax?u:null}function P(e,t,n){let{obb:r}=t,a=[i(1,0,0),i(0,1,0),i(0,0,1)],o=r.getCenter(V),s=!1;for(let t=0;t<3;t++){let i=r.projectedRadius(a[t]),c=Math.max(n?.[t]??-1/0,o[t]-i),l=Math.min(n?.[t+3]??1/0,o[t]+i);c<e[t]&&(e[t]=c,s=!0),l>e[t+3]&&(e[t+3]=l,s=!0)}return s}function F(e,t,n){if(l(t))return!1;let r=!1;for(let i=0;i<3;i++){let a=Math.max(n?.[i]??-1/0,t[i]),o=Math.min(n?.[i+3]??1/0,t[i+3]);a<e[i]&&(e[i]=a,r=!0),o>e[i+3]&&(e[i+3]=o,r=!0)}return r}function I(e,t,n){m(R,e),d(e);for(let r of t)P(e,r,n);return!h(e,R)}function L(e,t){z.setElevationRange(e),e.initializeEmpty();for(let n of t)e.expandElevationRange(n.elevationRange);return!e.equals(z)}const R=c(0,0,0,0,0,0),z=new v,B=a(),V=a(),H=[],U=30;export{y as createTileBVH};
2
+ import{sub as e,normalize as t,len as n,dot as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as i,create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import o from"../../../../core/Logger.js";import{getOrCreateMapValue as s}from"../../../../core/MapUtils.js";import{fromValues as c,isEmpty as l,containedBySphere as u,setEmpty as d,intersectsSphere as f,intersectsRay as p,copy as m,exactEquals as h}from"../../../../geometry/support/aaBoundingBox.js";import{fromValues as g}from"../../../../geometry/support/aaBoundingRect.js";import{earth as _}from"../../../../geometry/support/Ellipsoid.js";import{ElevationRange as v}from"../../support/ElevationRange.js";function y(e,t){return e?new S(t):new x(t)}class b{constructor(e,t){this.isGlobal=e,this.layerExtent=t,this._rootNode=null,this._intersectionGeneration=0,this._tileMap=new Map}get elevationRange(){return this._rootNode?.subtreeElevationRange}destroy(){this._rootNode?.clear(),this._tileMap.clear()}_nextIntersectionGeneration(){return this._intersectionGeneration++,this._intersectionGeneration}addTile(e){let{obb:t}=e,n=[this._ensureRootNode()],r=[],i=s(this._tileMap,e,()=>new Set),a=t=>{if(i.has(t))return;let n=t.addOwnTile(e);T(r,t.parent,n),i.add(t)};for(;n.length>0;){let r=n.pop(),i=this._getSizeStopLength(r);if(r.treeDepth>=U||A(e.obb)>=.5*i){a(r);continue}let{hPlane:o,vPlane:s}=r,c=t.signedDistancePlane(o.normal,o.distance),l=t.signedDistancePlane(s.normal,s.distance);c===0&&l===0?a(r):w(r,c,l,(e,t)=>{n.push(this._ensureChild(e,t))})}this._propagateSummaryUpdates(r)}removeTile(e){if(!this._rootNode){o.getLogger(`Tiles3DBVH`).error(`Tiles3DBVH: Attempted to remove a tile that is not loaded (no root node)`);return}let t=this._tileMap.get(e);if(!t||t.size===0){o.getLogger(`Tiles3DBVH`).error(`Tiles3DBVH internal error: Attempted to remove a tile that is not loaded (not in tile map)`);return}let n=[];this._tileMap.delete(e);for(let r of t){r.removeOwnTile(e);let t=r.updateOwnSummaries();T(n,r.parent,t)}this._propagateSummaryUpdates(n)}_propagateSummaryUpdates(e){if(e.length===0)return;e.sort((e,t)=>e.node.treeDepth-t.node.treeDepth);let t=new Map,n=-1,r=()=>e.length>0?e[e.length-1].node.treeDepth:-1;for(;e.length>0||t.size>0;){let i=t.size>0?n:r(),a=t;for(t=new Map;e.length>0&&r()===i;){let{node:t,childrenUpdateKind:n}=e.pop();E(a,t,n)}for(let[e,n]of a){let r=0;for(let t=0;t<4;t++){let n=e.children[t];n&&n.isLeaf&&!n.hasTiles&&(n.clear(),e.children[t]=null,r=3)}r|=e.updateSubtreeSummaries(n|r),E(t,e.parent,r)}t.size>0&&(n=i-1)}}forEachTileIntersectingRay(e,t,n,r){r?this._forEachTileIntersectingVerticalRay(e,t,n):this._forEachTileIntersectingRayGeneral(e,t,n)}_forEachTileIntersectingRayGeneral(n,r,i){let a=this._rootNode;if(!a)return;e(B,r,n);let o=t(B,B);if(!a.subtreeIntersectsRay(n,o,{tMin:0,tMax:1/0}))return;let s=this._nextIntersectionGeneration(),c=[a],l=H;l.length=0,l.push(0,1/0);let u={tMin:0,tMax:1/0};for(;c.length>0;){let e=c.pop();u.tMax=l.pop(),u.tMin=l.pop(),e.forEachOwnTileIntersectingRay(n,o,u,s,i);let{hPlane:t,vPlane:r}=e;for(let i=0;i<4;i++){let a=e.children[i];if(a==null)continue;let s=i,d=s===0||s===2,f=s===0||s===1,p=N(n,o,N(n,o,u,r,!d),t,!f);p&&a.subtreeIntersectsRay(n,o,p)&&(c.push(a),l.push(p.tMin,p.tMax))}}}_forEachTileIntersectingVerticalRay(r,i,a){let o=this._rootNode;if(!o)return;e(B,i,r);let s=t(B,B),c={tMin:0,tMax:this.isGlobal?n(r):1/0};if(!o.subtreeIntersectsRay(r,s,c))return;let l=this._nextIntersectionGeneration(),u=[o];for(;u.length>0;){let e=u.pop();e.forEachOwnTileIntersectingRay(r,s,c,l,a),e.isLeaf||w(e,k(e.hPlane,r),k(e.vPlane,r),(e,t)=>{let n=e.children[t];n&&n.subtreeIntersectsRay(r,s,c)&&u.push(n)},1)}}getElevationRangeIntersectingSphere(e){let t=this._rootNode;if(!t||!t.subtreeIntersectsSphere(e))return null;let n=this._nextIntersectionGeneration(),r=new v,i=[t];for(;i.length>0;){let t=i.pop();if(!r.contains(t.subtreeElevationRange)){if(t.subtreeContainedBySphere(e))r.expandElevationRange(t.subtreeElevationRange);else{if(t.ownIntersectsSphere(e))for(let i of t.ownTiles){if(i.bvhIntersectionGeneration===n||(i.bvhIntersectionGeneration=n,!(i.boundingVolumeIntersectsSphere?.(e)??i.obb.intersectSphere(e))))continue;let t=i.elevationRange;r.contains(t)||r.expandElevationRange(t)}t.isLeaf||w(t,O(e.center,e.radius,t.hPlane),O(e.center,e.radius,t.vPlane),(t,n)=>{let a=t.children[n];if(a&&a.subtreeIntersectsSphere(e)){if(r.contains(a.subtreeElevationRange))return;i.push(a)}})}}}return r.isEmpty?null:r}}class x extends b{constructor(e){super(!1,e)}_getSizeStopLength(e){return e.sideLength}_ensureRootNode(){if(!this._rootNode){let e=this.layerExtent,t=Math.max(Math.abs(e[0]),Math.abs(e[1]),Math.abs(e[2]),Math.abs(e[3])),n=2**Math.max(1,Math.ceil(Math.log2(t))),r=new C(null,0,g(-n,-n,n,n),new D(i(0,1,0),0),new D(i(1,0,0),0),n*2,c(-n,-n,-1/0,n,n,1/0));this._rootNode=r}return this._rootNode}_ensureChild(e,t){if(e.treeDepth>=U){let e=`Internal error: attempted to create a child node for a node that is already at max depth`;throw o.getLogger(`Tiles3DBVH`).error(e),Error(e)}let n=e.children[t];if(n===null){let{extent:r,hPlane:i,vPlane:a,treeDepth:o,sideLength:s}=e,l=.5*(r[0]+r[2]),u=.5*(r[1]+r[3]),d=t===0||t===1,f=t===2||t===0,p=g(f?r[0]:l,d?r[1]:u,f?l:r[2],d?u:r[3]),m=new D(i.normal,-.5*(p[1]+p[3])),h=new D(a.normal,-.5*(p[0]+p[2]));n=new C(e,o+1,p,m,h,s*.5,c(p[0],p[1],-1/0,p[2],p[3],1/0)),e.children[t]=n}return n}}class S extends b{constructor(e){super(!0,e)}_getSizeStopLength(e){return M(e.extent)}_ensureRootNode(){if(!this._rootNode){let e=new C(null,0,g(-Math.PI,-Math.PI/2,Math.PI,Math.PI/2),new D(i(0,0,1),0),new D(i(0,1,0),0),Math.PI*_.radius);this._rootNode=e}return this._rootNode}_ensureChild(e,t){if(e.treeDepth>=U){let e=`Attempted to create a child node for a node that is already at max depth`;throw o.getLogger(`Tiles3DBVH`).error(e),Error(e)}let n=e.children[t];if(n===null){let{extent:r,treeDepth:a}=e,o=.5*(r[0]+r[2]),s=.5*(r[1]+r[3]),c=t===0||t===1,l=t===2||t===0,u=g(l?r[0]:o,c?r[1]:s,l?o:r[2],c?s:r[3]),d=.5*(u[0]+u[2]),f=.5*(u[1]+u[3]),p=Math.cos(d),m=Math.sin(d),h=Math.cos(f),_=Math.sin(f),v=i(-_*p,-_*m,h),y=new D(v,0),b=new D(i(-m,p,0),0),x=j(u);n=new C(e,a+1,u,y,b,x),e.children[t]=n}return n}}class C{constructor(e,t,n,r,i,a,o){this.parent=e,this._treeDepth=t,this.extent=n,this.hPlane=r,this.vPlane=i,this.sideLength=a,this.bounds=o,this._ownAABB=c(1/0,1/0,1/0,-1/0,-1/0,-1/0),this._subtreeAABB=c(1/0,1/0,1/0,-1/0,-1/0,-1/0),this._ownElevationRange=new v,this._subtreeElevationRange=new v,this._ownTiles=[],this.children=[null,null,null,null]}get subtreeAABB(){return this._subtreeAABB}get subtreeElevationRange(){return this._subtreeElevationRange}subtreeContainedBySphere(e){let t=this._subtreeAABB;return l(t)?!0:u(t,e)}clear(){for(let e=0;e<4;e++)this.children[e]?.clear(),this.children[e]=null;this._ownTiles.length=0,d(this._ownAABB),d(this._subtreeAABB),this._ownElevationRange.initializeEmpty(),this._subtreeElevationRange.initializeEmpty()}get isLeaf(){return this.children.every(e=>e==null)}get treeDepth(){return this._treeDepth}subtreeIntersectsSphere(e){return f(this.subtreeAABB,e)}ownIntersectsSphere(e){return this.hasTiles&&f(this._ownAABB,e)}subtreeIntersectsRay(e,t,n){return p(this._subtreeAABB,e,t,n)}ownIntersectsRay(e,t,n){return this.hasTiles?p(this._ownAABB,e,t,n):null}forEachOwnTileIntersectingRay(e,t,n,r,i){if(this.ownIntersectsRay(e,t,n))for(let n of this.ownTiles)n.bvhIntersectionGeneration!==r&&(n.bvhIntersectionGeneration=r,(n.boundingVolumeIntersectsRay?.(e,t)??n.obb.intersectRay(e,t))&&i(n))}addOwnTile(e){this._ownTiles.push(e);let t=P(this._ownAABB,e,this.bounds)&&F(this._subtreeAABB,this._ownAABB,this.bounds),n=this._ownElevationRange.expandElevationRange(e.elevationRange)&&this._subtreeElevationRange.expandElevationRange(e.elevationRange);return!!t|(n?2:0)}removeOwnTile(e){let t=this._ownTiles,n=t.indexOf(e);if(n===-1){o.getLogger(`Tiles3DBVH`).error(`BVNode: Attempted to remove a tile that is not in the node`);return}let r=t.length-1;n<r&&(t[n]=t[r]),t.length=r}updateOwnSummaries(){let e=I(this._ownAABB,this.ownTiles,this.bounds),t=L(this._ownElevationRange,this.ownTiles),n=!!e|(t?2:0);return this.updateSubtreeSummaries(n)}updateSubtreeSummaries(e){if(this.isLeaf&&!this.hasTiles)return d(this._subtreeAABB),this._subtreeElevationRange.initializeEmpty(),3;let t=0;if(e&1){m(R,this._subtreeAABB),d(this._subtreeAABB),F(this._subtreeAABB,this._ownAABB,this.bounds);for(let e of this.children)e&&F(this._subtreeAABB,e.subtreeAABB,this.bounds);h(this._subtreeAABB,R)||(t|=1)}if(e&2){z.setElevationRange(this._subtreeElevationRange),this._subtreeElevationRange.initializeEmpty(),this._subtreeElevationRange.expandElevationRange(this._ownElevationRange);for(let e of this.children)e&&this._subtreeElevationRange.expandElevationRange(e.subtreeElevationRange);this._subtreeElevationRange.equals(z)||(t|=2)}return t}get ownTiles(){return this._ownTiles}get hasTiles(){return this._ownTiles.length>0}}function w(e,t,n,r,i=1e-12){t<=i&&(n<=i&&r(e,0),n>=-i&&r(e,1)),t>=-i&&(n<=i&&r(e,2),n>=-i&&r(e,3))}function T(e,t,n){t!=null&&n!==0&&e.push({node:t,childrenUpdateKind:n})}function E(e,t,n){if(t==null||n===0)return;let r=e.get(t)??0;e.set(t,r|n)}class D{constructor(e=[0,0,0],t=0){this.normal=e,this.distance=t}}function O(e,t,n){let i=r(n.normal,e)+n.distance;return i<0?Math.min(i+t,0):Math.max(i-t,0)}function k(e,t){return r(e.normal,t)+e.distance}function A(e){return 2*Math.max(e.halfSizeX,e.halfSizeY,e.halfSizeZ)}function j(e){let t=Math.abs(e[2]-e[0]),n=Math.abs(e[3]-e[1]),r=.5*(e[1]+e[3]),i=_.radius*Math.abs(Math.cos(r))*t,a=_.radius*n;return Math.max(i,a)}function M(e){let t=Math.abs(e[2]-e[0]),n=Math.abs(e[3]-e[1]),r=.5*(e[1]+e[3]),i=_.radius*Math.abs(Math.cos(r))*t,a=_.radius*n;return Math.min(i,a)}function N(e,t,n,i,a){if(!n)return null;let o=1e-12,s=r(i.normal,t),c=k(i,e)+n.tMin*s;if(Math.abs(s)<o)return(a?c>=-1e-12:c<=o)?n:null;let l=n.tMin-c/s,u=a===s>0?{tMin:Math.max(n.tMin,l),tMax:n.tMax}:{tMin:n.tMin,tMax:Math.min(n.tMax,l)};return u.tMin<=u.tMax?u:null}function P(e,t,n){let{obb:r}=t,a=[i(1,0,0),i(0,1,0),i(0,0,1)],o=r.getCenter(V),s=!1;for(let t=0;t<3;t++){let i=r.projectedRadius(a[t]),c=Math.max(n?.[t]??-1/0,o[t]-i),l=Math.min(n?.[t+3]??1/0,o[t]+i);c<e[t]&&(e[t]=c,s=!0),l>e[t+3]&&(e[t+3]=l,s=!0)}return s}function F(e,t,n){if(l(t))return!1;let r=!1;for(let i=0;i<3;i++){let a=Math.max(n?.[i]??-1/0,t[i]),o=Math.min(n?.[i+3]??1/0,t[i+3]);a<e[i]&&(e[i]=a,r=!0),o>e[i+3]&&(e[i+3]=o,r=!0)}return r}function I(e,t,n){m(R,e),d(e);for(let r of t)P(e,r,n);return!h(e,R)}function L(e,t){z.setElevationRange(e),e.initializeEmpty();for(let n of t)e.expandElevationRange(n.elevationRange);return!e.equals(z)}const R=c(0,0,0,0,0,0),z=new v,B=a(),V=a(),H=[],U=30;export{y as createTileBVH};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{project as e}from"../../../../geometry/projectionUtils.js";import{fromExtent as t}from"../../../../geometry/support/aaBoundingRect.js";import{createTileBVH as n}from"./Tiles3DBVH.js";function r(r){let{view:i}=r,a=r.useEsriCrs?r.fullExtentInLocalViewSpatialReference:r.layer.fullExtent?e(r.layer.fullExtent,i.renderSpatialReference):void 0;return n(i.viewingMode,t(a??i.extent))}export{r as createTileBVHForLayer};
2
+ import{project as e}from"../../../../geometry/projectionUtils.js";import{fromExtent as t}from"../../../../geometry/support/aaBoundingRect.js";import{createTileBVH as n}from"./Tiles3DBVH.js";function r(r){let{view:i}=r,a=r.useEsriCrs?r.fullExtentInLocalViewSpatialReference:r.layer.fullExtent?e(r.layer.fullExtent,i.renderSpatialReference):void 0;return n(i.state.isGlobal,t(a??i.extent))}export{r as createTileBVHForLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{subclass as t}from"../../../../core/accessorSupport/decorators.js";import{cyclicalPI as n}from"../../../../core/Cyclical.js";import{copy as r,distance as i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{copy as a,negate as o,length as s,subtract as c,normalize as l,add as u,scale as d,dot as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{deg2rad as m}from"../../../../core/mathUtils.js";import{createScreenPointArray as h,screenPointObjectToArray as g}from"../../../../core/screenUtils.js";import{getReferenceEllipsoid as _}from"../../../../geometry/ellipsoidUtils.js";import{wrapAxisAngle as v}from"../../../../geometry/support/axisAngle.js";import{create as y,fromPositionAndNormal as b,getNormal as ee}from"../../../../geometry/support/plane.js";import{Sphere as x}from"../../../../geometry/support/sphere.js";import{PanPlanarMomentumEstimator as S}from"../../../navigation/PanPlanarMomentumEstimator.js";import{PanSphericalMomentumEstimator as C}from"../../../navigation/PanSphericalMomentumEstimator.js";import{RotationMomentumEstimator as w}from"../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as T}from"../../../navigation/ZoomMomentumEstimator.js";import{pixelDistanceToInteractionFactor as E,applyAll as D}from"../../camera/constraintUtils.js";import{ConstraintOptions as O}from"../../camera/constraintUtils/ConstraintOptions.js";import{ExponentialFalloff as k}from"../../input/util.js";import A from"../../webgl/RenderCamera.js";import{pickPointAndInitSphere as j,excludeTerrain as M,inferNavigationMode as N,sphereOrPlanePointFromScreenPoint as P,maxPanDistanceModifier as F,minPinchAndPanCameraHeight as I,searchAreaSize as L,intersectPlaneFromScreenPointAtEye as R,applyZoomOnSphere as z,shouldPreserveHeading as B,applyPanSphericalPreserveHeading as V,applyPanSphericalDirectRotation as H,normalizeRotationDelta as U,applyRotation as W,applyPanPlanar as G,applyZoomToPoint as K}from"../utils/navigationUtils.js";import{InteractiveController as q}from"./InteractiveController.js";import{PanPlanarMomentumController as J}from"./momentum/PanPlanarMomentumController.js";import{PanSphericalMomentumController as Y}from"./momentum/PanSphericalMomentumController.js";import{RotationMomentumController as X}from"./momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as Z}from"./momentum/ZoomPlanarMomentumController.js";import{ZoomSphericalMomentumController as Q}from"./momentum/ZoomSphericalMomentumController.js";let $=class extends q{constructor(e){super(e),this._smoothRotation=new k(.05),this._rotationAxis=p(),this._beginAngle=0,this._beginHeading=0,this._panningPlane=y(),this._beginRadius=0,this._smoothScaling=new k(.05),this._zoomCenterScreen=h(),this._zoomMomentumEstimator=new T,this._rotationMomentumEstimator=new w,this._panSphericalMomentumEstimator=new C,this._panPlanarMomentumEstimator=new S,this._adjustedSphere=new x,this._tmp3d=p(),this._tmpScreenPointArray=h(),this._beginScreenPoint=h(),this._beginScenePoint=p(),this._screenPickPoint=h(),this._scenePickPoint=p(),this._navigationMode=1,this._sphere=new x,this._pointerCount=0,this._tmpInteractionDirection=p(),this._beginCamera=new A,this._constraintOptions=new O(15,0,0,this._beginCamera)}begin(e){if(!this.running)return;this._zoomMomentumEstimator.enabled=this._rotationMomentumEstimator.enabled=this._panPlanarMomentumEstimator.enabled=this._panSphericalMomentumEstimator.enabled=this.view.navigation.momentumEnabled,this._beginHeading=-n.normalize(m(this.view.camera.heading)),this._beginRadius=e.radius,this._beginAngle=e.angle,this._pointerCount=e.pointers.size,this._smoothRotation.reset(),g(e.center,this._screenPickPoint),r(this._beginScreenPoint,this._screenPickPoint);let t=j(this.view,this.startCamera,this._screenPickPoint,_(this.view.spatialReference).radius,1,this.view.groundView.invisible?M:{});t.scenePickPoint!=null&&(this._scenePickPoint=t.scenePickPoint,this._sphere=t.sphere,a(this._beginScenePoint,this._scenePickPoint),this._navigationMode=N(this.startCamera,this._screenPickPoint,this.view.renderCoordsHelper,this.view.viewingMode),this._navigationMode===0&&this._preparePlanarPanMode(e,t.hasGeometryIntersection),this._beginCamera.copyFrom(this.startCamera))}update(e){if(!this.running)return;this.currentCamera.copyFrom(this.startCamera);let t=e.pointers.size>1;this._navigationMode===1?(t&&this._zoomSpherical(e),this._panningSpherical(e),t&&this._rotateSpherical(e)):(t&&this._zoomPlanar(e),this._panningPlanar(e),t&&this._rotatePlanar(e)),this.commitCamera()}end(e){e.pointers.size===this._pointerCount&&this.update(e),this.finishController();let t=this.view.animationsEnabled&&this._zoomMomentumEstimator.evaluateMomentum();if(t)return this._navigationMode===1?new Q({view:this.view,momentum:t,screenCenter:this._zoomCenterScreen,sceneCenter:this._beginScenePoint,radius:this._sphere.radius}):new Z({view:this.view,momentum:t,zoomCenter:this._beginScenePoint});let n=this.view.animationsEnabled&&this._rotationMomentumEstimator.evaluateMomentum();if(n)return new X({view:this.view,momentum:n,center:this._sphere.center,axis:this._rotationAxis});if(this._navigationMode===1){let e=this.view.animationsEnabled&&this._panSphericalMomentumEstimator.evaluateMomentum();if(e)return new Y({view:this.view,momentum:e})}else{let e=this.view.animationsEnabled&&this._panPlanarMomentumEstimator.evaluateMomentum();if(e)return new J({view:this.view,momentum:e})}return null}_preparePlanarPanMode(e,t){let n=o(this._tmp3d,this.startCamera.viewForward);b(this._scenePickPoint,n,this._panningPlane);let r=h(this._screenPickPoint[0],0),i=p(),m=s(this.startCamera.eye);this._adjustedSphere.radius=m<this._sphere.radius?m-100:this._sphere.radius,P(this._adjustedSphere,this.startCamera,r,i);let _=p(),v=p(),y=p();c(_,this._scenePickPoint,this.currentCamera.eye);let x=s(_);l(_,_);let S=F*Math.max(Math.abs(this.view.camera.position.z),I),C=this.view.stage.renderView.getMinimalDepthForArea(null,this._screenPickPoint[0],this._screenPickPoint[1],this.view.state.camera,L)??S;t&&(C=Math.min(C,x)),a(y,u(v,this.currentCamera.eye,d(v,_,C))),this._panningPlane[3]=-f(ee(this._panningPlane),y),this.startCamera.center=u(v,this.startCamera.eye,d(v,this.startCamera.viewForward,C));let w=g(e.center,this._tmpScreenPointArray);R(this._panningPlane,this.startCamera,w,this._beginScenePoint)}_zoomSpherical(e){let t=this._beginRadius/e.radius,n=Math.min(Math.max(e.radius,40),120)*.001875;this._smoothScaling.gain=n,this._smoothScaling.update(t),z(this._sphere,this.currentCamera,this._smoothScaling.value),g(e.center,this._zoomCenterScreen),this._zoomMomentumEstimator.add(this._smoothScaling.value,e.timestamp*.001),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=E(e.radius-this._beginRadius),D(this.view,this.currentCamera,this._constraintOptions)}_panningSpherical(e){let t=g(e.center,this._tmpScreenPointArray);P(this._sphere,this.currentCamera,t,this._tmp3d),B(this._beginScenePoint,f(this.currentCamera.up,this._beginScenePoint),this._sphere.radius,this._beginHeading,this.view.camera.tilt,this.startCamera.aboveGround)?(V(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this._beginHeading,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumPreserveHeading(t,this._tmp3d,e.timestamp*.001,this.startCamera,this._sphere,this._beginHeading,this.view.camera.tilt)):(H(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumDirectRotation(t,this._tmp3d,e.timestamp*.001,this.startCamera,this._sphere.radius,this.view.camera.tilt)),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=E(i(this._screenPickPoint,t)),D(this.view,this.currentCamera,this._constraintOptions)}_rotateSpherical(e){l(this._rotationAxis,this._scenePickPoint),this.currentCamera.aboveGround||o(this._rotationAxis,this._rotationAxis);let t=this._smoothRotation.value,n=t+U(e.angle-t),r=Math.min(Math.max(e.radius,40),120)*.00125;this._smoothRotation.gain=r,this._smoothRotation.update(n);let i=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(i,e.timestamp*.001),W(this.currentCamera,this._sphere.center,v(this._rotationAxis,i)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=E(e.radius*n),D(this.view,this.currentCamera,this._constraintOptions)}_panningPlanar(e){let t=g(e.center,this._tmpScreenPointArray);R(this._panningPlane,this.currentCamera,t,this._tmp3d)&&(G(this.currentCamera,this._beginScenePoint,this._tmp3d),this._panPlanarMomentumEstimator.add(t,this._tmp3d,e.timestamp*.001),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=E(i(this._beginScreenPoint,t)),this._constraintOptions.interactionDirection=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,this._tmpInteractionDirection),D(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null)}_zoomPlanar(e){let t=this._beginRadius/e.radius,n=Math.min(Math.max(e.radius,40),120)*.001875;this._smoothScaling.gain=n,this._smoothScaling.update(t),this._zoomMomentumEstimator.add(this._smoothScaling.value,e.timestamp*.001),K(this.currentCamera,this._beginScenePoint,this._smoothScaling.value,this.view.state.constraints.minimumPoiDistance),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=E(e.radius-this._beginRadius),D(this.view,this.currentCamera,this._constraintOptions)}_rotatePlanar(e){a(this._rotationAxis,this._beginScenePoint),this.currentCamera.aboveGround||o(this._rotationAxis,this._rotationAxis);let t=this._smoothRotation.value,n=e.angle-t;n=U(n);let r=t+n,i=Math.min(Math.max(e.radius,40),120)*.00125;this._smoothRotation.gain=i,this._smoothRotation.update(r);let s=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(s,e.timestamp*.001),W(this.currentCamera,this._sphere.center,v(this._rotationAxis,s)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=E(e.radius*s),D(this.view,this.currentCamera,this._constraintOptions)}};$=e([t(`esri.views.3d.state.controllers.PinchAndPanControllerGlobal`)],$);export{$ as PinchAndPanControllerGlobal};
2
+ import{__decorate as e}from"tslib";import{subclass as t}from"../../../../core/accessorSupport/decorators.js";import{cyclicalPI as n}from"../../../../core/Cyclical.js";import{copy as r,distance as i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{copy as a,negate as o,length as s,subtract as c,normalize as l,add as u,scale as d,dot as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{deg2rad as m}from"../../../../core/mathUtils.js";import{createScreenPointArray as h,screenPointObjectToArray as g}from"../../../../core/screenUtils.js";import{getReferenceEllipsoid as _}from"../../../../geometry/ellipsoidUtils.js";import{wrapAxisAngle as v}from"../../../../geometry/support/axisAngle.js";import{create as y,fromPositionAndNormal as b,getNormal as ee}from"../../../../geometry/support/plane.js";import{Sphere as x}from"../../../../geometry/support/sphere.js";import{PanPlanarMomentumEstimator as S}from"../../../navigation/PanPlanarMomentumEstimator.js";import{PanSphericalMomentumEstimator as C}from"../../../navigation/PanSphericalMomentumEstimator.js";import{RotationMomentumEstimator as w}from"../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as T}from"../../../navigation/ZoomMomentumEstimator.js";import{pixelDistanceToInteractionFactor as E,applyAll as D}from"../../camera/constraintUtils.js";import{ConstraintOptions as O}from"../../camera/constraintUtils/ConstraintOptions.js";import{ExponentialFalloff as k}from"../../input/util.js";import A from"../../webgl/RenderCamera.js";import{pickPointAndInitSphere as j,excludeTerrain as M,inferNavigationMode as N,sphereOrPlanePointFromScreenPoint as P,maxPanDistanceModifier as F,minPinchAndPanCameraHeight as I,searchAreaSize as L,intersectPlaneFromScreenPointAtEye as R,applyZoomOnSphere as z,shouldPreserveHeading as B,applyPanSphericalPreserveHeading as V,applyPanSphericalDirectRotation as H,normalizeRotationDelta as U,applyRotation as W,applyPanPlanar as G,applyZoomToPoint as K}from"../utils/navigationUtils.js";import{InteractiveController as q}from"./InteractiveController.js";import{PanPlanarMomentumController as J}from"./momentum/PanPlanarMomentumController.js";import{PanSphericalMomentumController as Y}from"./momentum/PanSphericalMomentumController.js";import{RotationMomentumController as X}from"./momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as Z}from"./momentum/ZoomPlanarMomentumController.js";import{ZoomSphericalMomentumController as Q}from"./momentum/ZoomSphericalMomentumController.js";let $=class extends q{constructor(e){super(e),this._smoothRotation=new k(.05),this._rotationAxis=p(),this._beginAngle=0,this._beginHeading=0,this._panningPlane=y(),this._beginRadius=0,this._smoothScaling=new k(.05),this._zoomCenterScreen=h(),this._zoomMomentumEstimator=new T,this._rotationMomentumEstimator=new w,this._panSphericalMomentumEstimator=new C,this._panPlanarMomentumEstimator=new S,this._adjustedSphere=new x,this._tmp3d=p(),this._tmpScreenPointArray=h(),this._beginScreenPoint=h(),this._beginScenePoint=p(),this._screenPickPoint=h(),this._scenePickPoint=p(),this._navigationMode=1,this._sphere=new x,this._pointerCount=0,this._tmpInteractionDirection=p(),this._beginCamera=new A,this._constraintOptions=new O(15,0,0,this._beginCamera)}begin(e){if(!this.running)return;this._zoomMomentumEstimator.enabled=this._rotationMomentumEstimator.enabled=this._panPlanarMomentumEstimator.enabled=this._panSphericalMomentumEstimator.enabled=this.view.navigation.momentumEnabled,this._beginHeading=-n.normalize(m(this.view.camera.heading)),this._beginRadius=e.radius,this._beginAngle=e.angle,this._pointerCount=e.pointers.size,this._smoothRotation.reset(),g(e.center,this._screenPickPoint),r(this._beginScreenPoint,this._screenPickPoint);let t=j(this.view,this.startCamera,this._screenPickPoint,_(this.view.spatialReference).radius,1,this.view.groundView.invisible?M:{});t.scenePickPoint!=null&&(this._scenePickPoint=t.scenePickPoint,this._sphere=t.sphere,a(this._beginScenePoint,this._scenePickPoint),this._navigationMode=N(this.startCamera,this._screenPickPoint,this.view.renderCoordsHelper,this.view.state.isGlobal),this._navigationMode===0&&this._preparePlanarPanMode(e,t.hasGeometryIntersection),this._beginCamera.copyFrom(this.startCamera))}update(e){if(!this.running)return;this.currentCamera.copyFrom(this.startCamera);let t=e.pointers.size>1;this._navigationMode===1?(t&&this._zoomSpherical(e),this._panningSpherical(e),t&&this._rotateSpherical(e)):(t&&this._zoomPlanar(e),this._panningPlanar(e),t&&this._rotatePlanar(e)),this.commitCamera()}end(e){e.pointers.size===this._pointerCount&&this.update(e),this.finishController();let t=this.view.animationsEnabled&&this._zoomMomentumEstimator.evaluateMomentum();if(t)return this._navigationMode===1?new Q({view:this.view,momentum:t,screenCenter:this._zoomCenterScreen,sceneCenter:this._beginScenePoint,radius:this._sphere.radius}):new Z({view:this.view,momentum:t,zoomCenter:this._beginScenePoint});let n=this.view.animationsEnabled&&this._rotationMomentumEstimator.evaluateMomentum();if(n)return new X({view:this.view,momentum:n,center:this._sphere.center,axis:this._rotationAxis});if(this._navigationMode===1){let e=this.view.animationsEnabled&&this._panSphericalMomentumEstimator.evaluateMomentum();if(e)return new Y({view:this.view,momentum:e})}else{let e=this.view.animationsEnabled&&this._panPlanarMomentumEstimator.evaluateMomentum();if(e)return new J({view:this.view,momentum:e})}return null}_preparePlanarPanMode(e,t){let n=o(this._tmp3d,this.startCamera.viewForward);b(this._scenePickPoint,n,this._panningPlane);let r=h(this._screenPickPoint[0],0),i=p(),m=s(this.startCamera.eye);this._adjustedSphere.radius=m<this._sphere.radius?m-100:this._sphere.radius,P(this._adjustedSphere,this.startCamera,r,i);let _=p(),v=p(),y=p();c(_,this._scenePickPoint,this.currentCamera.eye);let x=s(_);l(_,_);let S=F*Math.max(Math.abs(this.view.camera.position.z),I),C=this.view.stage.renderView.getMinimalDepthForArea(null,this._screenPickPoint[0],this._screenPickPoint[1],this.view.state.camera,L)??S;t&&(C=Math.min(C,x)),a(y,u(v,this.currentCamera.eye,d(v,_,C))),this._panningPlane[3]=-f(ee(this._panningPlane),y),this.startCamera.center=u(v,this.startCamera.eye,d(v,this.startCamera.viewForward,C));let w=g(e.center,this._tmpScreenPointArray);R(this._panningPlane,this.startCamera,w,this._beginScenePoint)}_zoomSpherical(e){let t=this._beginRadius/e.radius,n=Math.min(Math.max(e.radius,40),120)*.001875;this._smoothScaling.gain=n,this._smoothScaling.update(t),z(this._sphere,this.currentCamera,this._smoothScaling.value),g(e.center,this._zoomCenterScreen),this._zoomMomentumEstimator.add(this._smoothScaling.value,e.timestamp*.001),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=E(e.radius-this._beginRadius),D(this.view,this.currentCamera,this._constraintOptions)}_panningSpherical(e){let t=g(e.center,this._tmpScreenPointArray);P(this._sphere,this.currentCamera,t,this._tmp3d),B(this._beginScenePoint,f(this.currentCamera.up,this._beginScenePoint),this._sphere.radius,this._beginHeading,this.view.camera.tilt,this.startCamera.aboveGround)?(V(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this._beginHeading,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumPreserveHeading(t,this._tmp3d,e.timestamp*.001,this.startCamera,this._sphere,this._beginHeading,this.view.camera.tilt)):(H(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumDirectRotation(t,this._tmp3d,e.timestamp*.001,this.startCamera,this._sphere.radius,this.view.camera.tilt)),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=E(i(this._screenPickPoint,t)),D(this.view,this.currentCamera,this._constraintOptions)}_rotateSpherical(e){l(this._rotationAxis,this._scenePickPoint),this.currentCamera.aboveGround||o(this._rotationAxis,this._rotationAxis);let t=this._smoothRotation.value,n=t+U(e.angle-t),r=Math.min(Math.max(e.radius,40),120)*.00125;this._smoothRotation.gain=r,this._smoothRotation.update(n);let i=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(i,e.timestamp*.001),W(this.currentCamera,this._sphere.center,v(this._rotationAxis,i)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=E(e.radius*n),D(this.view,this.currentCamera,this._constraintOptions)}_panningPlanar(e){let t=g(e.center,this._tmpScreenPointArray);R(this._panningPlane,this.currentCamera,t,this._tmp3d)&&(G(this.currentCamera,this._beginScenePoint,this._tmp3d),this._panPlanarMomentumEstimator.add(t,this._tmp3d,e.timestamp*.001),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=E(i(this._beginScreenPoint,t)),this._constraintOptions.interactionDirection=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,this._tmpInteractionDirection),D(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null)}_zoomPlanar(e){let t=this._beginRadius/e.radius,n=Math.min(Math.max(e.radius,40),120)*.001875;this._smoothScaling.gain=n,this._smoothScaling.update(t),this._zoomMomentumEstimator.add(this._smoothScaling.value,e.timestamp*.001),K(this.currentCamera,this._beginScenePoint,this._smoothScaling.value,this.view.state.constraints.minimumPoiDistance),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=E(e.radius-this._beginRadius),D(this.view,this.currentCamera,this._constraintOptions)}_rotatePlanar(e){a(this._rotationAxis,this._beginScenePoint),this.currentCamera.aboveGround||o(this._rotationAxis,this._rotationAxis);let t=this._smoothRotation.value,n=e.angle-t;n=U(n);let r=t+n,i=Math.min(Math.max(e.radius,40),120)*.00125;this._smoothRotation.gain=i,this._smoothRotation.update(r);let s=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(s,e.timestamp*.001),W(this.currentCamera,this._sphere.center,v(this._rotationAxis,s)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=E(e.radius*s),D(this.view,this.currentCamera,this._constraintOptions)}};$=e([t(`esri.views.3d.state.controllers.PinchAndPanControllerGlobal`)],$);export{$ as PinchAndPanControllerGlobal};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{subclass as t}from"../../../../core/accessorSupport/decorators.js";import{distance as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{negate as r,copy as i,dot as a,subtract as o,length as s,normalize as c,scale as l,add as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d,fromValues as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{createScreenPointArray as p,screenPointObjectToArray as m}from"../../../../core/screenUtils.js";import{wrapAxisAngle as h}from"../../../../geometry/support/axisAngle.js";import{create as g,fromNormalAndOffset as _,setOffsetFromPoint as v,negate as y,getNormal as b}from"../../../../geometry/support/plane.js";import{PanPlanarMomentumEstimator as x}from"../../../navigation/PanPlanarMomentumEstimator.js";import{RotationMomentumEstimator as S}from"../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as C}from"../../../navigation/ZoomMomentumEstimator.js";import{pixelDistanceToInteractionFactor as w,applyAll as T}from"../../camera/constraintUtils.js";import{ConstraintOptions as E}from"../../camera/constraintUtils/ConstraintOptions.js";import{ExponentialFalloff as D}from"../../input/util.js";import{getVoxelWasm as O}from"../../layers/VoxelWasm.js";import k from"../../webgl/RenderCamera.js";import{inferNavigationMode as A,excludeTerrain as j,getTiltScaleFactor as M,maxPanDistanceModifier as N,minPinchAndPanCameraHeight as P,searchAreaSize as F,centroid as I,applyZoomToPoint as L,applyPanPlanar as R,normalizeRotationDelta as z,applyRotation as B,intersectPlaneFromScreenPointAtEye as V}from"../utils/navigationUtils.js";import{InteractiveController as H}from"./InteractiveController.js";import{PanPlanarMomentumController as U}from"./momentum/PanPlanarMomentumController.js";import{RotationMomentumController as W}from"./momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as G}from"./momentum/ZoomPlanarMomentumController.js";const K=f(0,0,1);let q=class extends H{constructor(e){super(e),this._rotationValueSmooth=new D(.05),this._scalingValueSmooth=new D(.05),this._planeHorizontal=g(),this._planeVertical=g(),this._rotationMomentumEstimator=new S,this._panMomentumEstimator=new x(300,12,.9),this._zoomMomentumEstimator=new C,this._beginRadius=0,this._beginCenter=d(),this._beginAngle=0,this._tmpPoints=[],this._navigationMode=1,this._beginCenterScreen=p(),this._tmpCentroid3d=d(),this._tmpCentroid2d=p(),this._tmp2d=p(),this._pointerCount=0,this._beginCamera=new k,this._constraintOptions=new E(15,0,0,this._beginCamera)}begin(e){if(!this.running)return;let t=this.view.navigation.momentumEnabled;this._zoomMomentumEstimator.enabled=t,this._rotationMomentumEstimator.enabled=t,this._panMomentumEstimator.enabled=t,this._beginRadius=e.radius,this._pointerCount=e.pointers.size,this._beginAngle=e.angle,this._rotationValueSmooth.reset(),this._scalingValueSmooth.reset(),m(e.center,this._beginCenterScreen),_(K,0,this._planeHorizontal);let n=d();r(n,this.startCamera.viewForward);let f=d();i(f,K);let p=a(n,f);this._navigationMode=A(this.startCamera,this._beginCenterScreen,this.view.renderCoordsHelper,this.view.viewingMode);let h=d(),g=this._intersectionHelper.intersectScreenFreePointFallback(this._beginCenterScreen,h,this.view.groundView.invisible?j:{}),x=M(f,this.startCamera.viewForward,N)*Math.max(Math.abs(this.view.camera.position.z),P);v(this._planeHorizontal,this._planeHorizontal,h),this.startCamera.aboveGround||y(this._planeHorizontal,this._planeHorizontal);let S=d(),C=d(),w=d();o(S,h,this.currentCamera.eye);let T=s(S);if(c(S,S),this._navigationMode===0){l(f,f,p),o(b(this._planeVertical),n,f),c(b(this._planeVertical),b(this._planeVertical)),v(this._planeVertical,this._planeVertical,h);let t=this.view.stage.renderView.getMinimalDepthForArea(O(this.view),this._beginCenterScreen[0],this._beginCenterScreen[1],this.view.state.camera,F)??x;g&&(t=Math.min(t,T)),i(w,u(C,this.currentCamera.eye,l(C,S,t))),this._planeVertical[3]=-a(b(this._planeVertical),w),this._computePlanePoints(e.pointers,this._planeVertical,this.startCamera,this._tmpPoints),I(this._tmpPoints,this._beginCenter)}else{let t=g?T:x;i(w,u(C,this.currentCamera.eye,l(C,S,t))),this._planeHorizontal[3]=-a(b(this._planeHorizontal),w),this._computePlanePoints(e.pointers,this._planeHorizontal,this.startCamera,this._tmpPoints),I(this._tmpPoints,this._beginCenter)}this._beginCamera.copyFrom(this.startCamera)}update(e){if(!this.running)return;this.currentCamera.copyFrom(this.startCamera);let t=e.pointers.size>1,r=this._navigationMode===1?this._planeHorizontal:this._planeVertical,i=this._beginCenter;if(t){let t=this._beginRadius/e.radius,n=Math.min(Math.max(e.radius,40),120)*.001875;this._scalingValueSmooth.gain=n,this._scalingValueSmooth.update(t),L(this.currentCamera,i,this._scalingValueSmooth.value,this.view.state.constraints.minimumPoiDistance),this._zoomMomentumEstimator.add(this._scalingValueSmooth.value,e.timestamp*.001),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=w(Math.abs(e.radius-this._beginRadius)),T(this.view,this.currentCamera,this._constraintOptions)}if(this._computePlanePoints(e.pointers,r,this.currentCamera,this._tmpPoints),I(this._tmpPoints,this._tmpCentroid3d),m(e.center,this._tmpCentroid2d),R(this.currentCamera,i,this._tmpCentroid3d),this._panMomentumEstimator.add(this._tmpCentroid2d,this._tmpCentroid3d,e.timestamp*.001),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=w(n(this._beginCenterScreen,this._tmpCentroid2d)),T(this.view,this.currentCamera,this._constraintOptions),t){let t=i,n=this._rotationValueSmooth.value,r=n+z(e.angle-n),a=Math.min(Math.max(e.radius,40),120)*.00125;this._rotationValueSmooth.gain=a,this._rotationValueSmooth.update(r);let o=this._rotationValueSmooth.value-this._beginAngle;this._rotationMomentumEstimator.add(o,e.timestamp*.001);let s=b(this._planeHorizontal);B(this.currentCamera,t,h(s,o)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=w(Math.abs(e.radius*o)),T(this.view,this.currentCamera,this._constraintOptions)}this.commitCamera()}end(e){e.pointers.size===this._pointerCount&&this.update(e),this.finishController();let t=this.view.animationsEnabled&&this._zoomMomentumEstimator.evaluateMomentum();if(t)return new G({view:this.view,momentum:t,zoomCenter:this._beginCenter});let n=this.view.animationsEnabled&&this._rotationMomentumEstimator.evaluateMomentum();if(n)return new W({view:this.view,momentum:n,center:this._beginCenter,axis:b(this._planeHorizontal)});let r=this.view.animationsEnabled&&this._panMomentumEstimator.evaluateMomentum();return r?new U({view:this.view,momentum:r}):null}_computePlanePoints(e,t,n,r){r.length=e.size;let i=this._tmp2d,a=0;return e.forEach(e=>{i[0]=e.x,i[1]=e.y,r[a]===void 0&&(r[a]=d()),V(t,n,i,r[a]),a+=1}),r}get _intersectionHelper(){return this.view.sceneIntersectionHelper}};q=e([t(`esri.views.3d.state.controllers.PinchAndPanControllerLocal`)],q);export{q as PinchAndPanControllerLocal};
2
+ import{__decorate as e}from"tslib";import{subclass as t}from"../../../../core/accessorSupport/decorators.js";import{distance as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{negate as r,copy as i,dot as a,subtract as o,length as s,normalize as c,scale as l,add as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d,fromValues as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{createScreenPointArray as p,screenPointObjectToArray as m}from"../../../../core/screenUtils.js";import{wrapAxisAngle as h}from"../../../../geometry/support/axisAngle.js";import{create as g,fromNormalAndOffset as _,setOffsetFromPoint as v,negate as y,getNormal as b}from"../../../../geometry/support/plane.js";import{PanPlanarMomentumEstimator as x}from"../../../navigation/PanPlanarMomentumEstimator.js";import{RotationMomentumEstimator as S}from"../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as C}from"../../../navigation/ZoomMomentumEstimator.js";import{pixelDistanceToInteractionFactor as w,applyAll as T}from"../../camera/constraintUtils.js";import{ConstraintOptions as E}from"../../camera/constraintUtils/ConstraintOptions.js";import{ExponentialFalloff as D}from"../../input/util.js";import{getVoxelWasm as O}from"../../layers/VoxelWasm.js";import k from"../../webgl/RenderCamera.js";import{inferNavigationMode as A,excludeTerrain as j,getTiltScaleFactor as M,maxPanDistanceModifier as N,minPinchAndPanCameraHeight as P,searchAreaSize as F,centroid as I,applyZoomToPoint as L,applyPanPlanar as R,normalizeRotationDelta as z,applyRotation as B,intersectPlaneFromScreenPointAtEye as V}from"../utils/navigationUtils.js";import{InteractiveController as H}from"./InteractiveController.js";import{PanPlanarMomentumController as U}from"./momentum/PanPlanarMomentumController.js";import{RotationMomentumController as W}from"./momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as G}from"./momentum/ZoomPlanarMomentumController.js";const K=f(0,0,1);let q=class extends H{constructor(e){super(e),this._rotationValueSmooth=new D(.05),this._scalingValueSmooth=new D(.05),this._planeHorizontal=g(),this._planeVertical=g(),this._rotationMomentumEstimator=new S,this._panMomentumEstimator=new x(300,12,.9),this._zoomMomentumEstimator=new C,this._beginRadius=0,this._beginCenter=d(),this._beginAngle=0,this._tmpPoints=[],this._navigationMode=1,this._beginCenterScreen=p(),this._tmpCentroid3d=d(),this._tmpCentroid2d=p(),this._tmp2d=p(),this._pointerCount=0,this._beginCamera=new k,this._constraintOptions=new E(15,0,0,this._beginCamera)}begin(e){if(!this.running)return;let t=this.view.navigation.momentumEnabled;this._zoomMomentumEstimator.enabled=t,this._rotationMomentumEstimator.enabled=t,this._panMomentumEstimator.enabled=t,this._beginRadius=e.radius,this._pointerCount=e.pointers.size,this._beginAngle=e.angle,this._rotationValueSmooth.reset(),this._scalingValueSmooth.reset(),m(e.center,this._beginCenterScreen),_(K,0,this._planeHorizontal);let n=d();r(n,this.startCamera.viewForward);let f=d();i(f,K);let p=a(n,f);this._navigationMode=A(this.startCamera,this._beginCenterScreen,this.view.renderCoordsHelper,this.view.state.isGlobal);let h=d(),g=this._intersectionHelper.intersectScreenFreePointFallback(this._beginCenterScreen,h,this.view.groundView.invisible?j:{}),x=M(f,this.startCamera.viewForward,N)*Math.max(Math.abs(this.view.camera.position.z),P);v(this._planeHorizontal,this._planeHorizontal,h),this.startCamera.aboveGround||y(this._planeHorizontal,this._planeHorizontal);let S=d(),C=d(),w=d();o(S,h,this.currentCamera.eye);let T=s(S);if(c(S,S),this._navigationMode===0){l(f,f,p),o(b(this._planeVertical),n,f),c(b(this._planeVertical),b(this._planeVertical)),v(this._planeVertical,this._planeVertical,h);let t=this.view.stage.renderView.getMinimalDepthForArea(O(this.view),this._beginCenterScreen[0],this._beginCenterScreen[1],this.view.state.camera,F)??x;g&&(t=Math.min(t,T)),i(w,u(C,this.currentCamera.eye,l(C,S,t))),this._planeVertical[3]=-a(b(this._planeVertical),w),this._computePlanePoints(e.pointers,this._planeVertical,this.startCamera,this._tmpPoints),I(this._tmpPoints,this._beginCenter)}else{let t=g?T:x;i(w,u(C,this.currentCamera.eye,l(C,S,t))),this._planeHorizontal[3]=-a(b(this._planeHorizontal),w),this._computePlanePoints(e.pointers,this._planeHorizontal,this.startCamera,this._tmpPoints),I(this._tmpPoints,this._beginCenter)}this._beginCamera.copyFrom(this.startCamera)}update(e){if(!this.running)return;this.currentCamera.copyFrom(this.startCamera);let t=e.pointers.size>1,r=this._navigationMode===1?this._planeHorizontal:this._planeVertical,i=this._beginCenter;if(t){let t=this._beginRadius/e.radius,n=Math.min(Math.max(e.radius,40),120)*.001875;this._scalingValueSmooth.gain=n,this._scalingValueSmooth.update(t),L(this.currentCamera,i,this._scalingValueSmooth.value,this.view.state.constraints.minimumPoiDistance),this._zoomMomentumEstimator.add(this._scalingValueSmooth.value,e.timestamp*.001),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=w(Math.abs(e.radius-this._beginRadius)),T(this.view,this.currentCamera,this._constraintOptions)}if(this._computePlanePoints(e.pointers,r,this.currentCamera,this._tmpPoints),I(this._tmpPoints,this._tmpCentroid3d),m(e.center,this._tmpCentroid2d),R(this.currentCamera,i,this._tmpCentroid3d),this._panMomentumEstimator.add(this._tmpCentroid2d,this._tmpCentroid3d,e.timestamp*.001),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=w(n(this._beginCenterScreen,this._tmpCentroid2d)),T(this.view,this.currentCamera,this._constraintOptions),t){let t=i,n=this._rotationValueSmooth.value,r=n+z(e.angle-n),a=Math.min(Math.max(e.radius,40),120)*.00125;this._rotationValueSmooth.gain=a,this._rotationValueSmooth.update(r);let o=this._rotationValueSmooth.value-this._beginAngle;this._rotationMomentumEstimator.add(o,e.timestamp*.001);let s=b(this._planeHorizontal);B(this.currentCamera,t,h(s,o)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=w(Math.abs(e.radius*o)),T(this.view,this.currentCamera,this._constraintOptions)}this.commitCamera()}end(e){e.pointers.size===this._pointerCount&&this.update(e),this.finishController();let t=this.view.animationsEnabled&&this._zoomMomentumEstimator.evaluateMomentum();if(t)return new G({view:this.view,momentum:t,zoomCenter:this._beginCenter});let n=this.view.animationsEnabled&&this._rotationMomentumEstimator.evaluateMomentum();if(n)return new W({view:this.view,momentum:n,center:this._beginCenter,axis:b(this._planeHorizontal)});let r=this.view.animationsEnabled&&this._panMomentumEstimator.evaluateMomentum();return r?new U({view:this.view,momentum:r}):null}_computePlanePoints(e,t,n,r){r.length=e.size;let i=this._tmp2d,a=0;return e.forEach(e=>{i[0]=e.x,i[1]=e.y,r[a]===void 0&&(r[a]=d()),V(t,n,i,r[a]),a+=1}),r}get _intersectionHelper(){return this.view.sceneIntersectionHelper}};q=e([t(`esri.views.3d.state.controllers.PinchAndPanControllerLocal`)],q);export{q as PinchAndPanControllerLocal};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{fromRotation as r,rotate as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{exactEquals as c,copy as l,subtract as u,length as d,normalize as f,add as p,scale as m,dot as h,cross as g,transformMat4 as _}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{acosClamped as y,clamp as b}from"../../../../core/mathUtils.js";import{createScreenPointArray as x}from"../../../../core/screenUtils.js";import{applyAll as S}from"../../camera/constraintUtils.js";import{ConstraintOptions as C}from"../../camera/constraintUtils/ConstraintOptions.js";import{getVoxelWasm as w}from"../../layers/VoxelWasm.js";import{TiltRange as T}from"../Constraints.js";import{excludeTerrain as E,normalizeCoordinate as D,getTiltScaleFactor as O,maxRotatePivotDistanceModifier as k,minRotatePivotDistance as A,inferNavigationMode as j,searchAreaSize as M}from"../utils/navigationUtils.js";import{InteractiveController as N}from"./InteractiveController.js";let P=class extends N{get _intersectionHelper(){return this.view.sceneIntersectionHelper}constructor(e){super(e),this.pivot=0,this._rotateScale=3,this._lastPoint=s(),this._tmpWorldUp=v(),this._tmpViewDir=v(),this._tmpRotCurPoint=s(),this._tmpTransf=a(),this._tmpAxis=v(),this._tmpPivotPoint=v(),this._pivotPos=v(),this._constraintOptions=new C(15,2,0,this.startCamera)}begin(e){if(this.running){switch(this.pivot){case 1:l(this._pivotPos,this.startCamera.eye),this._constraintOptions.interactionType=3,this._constraintOptions.tiltMode=1,this._constraintOptions.selection=0;break;case 0:{let t=this._intersectionHelper.intersectRayFreePointFallback(this.startCamera.ray,this._pivotPos,this.view.groundView.invisible?E:{})&&!c(this.startCamera.eye,this._pivotPos);t||l(this._pivotPos,this.startCamera.center),this._constrainPivotPoint(e,t),this.startCamera.center=this._pivotPos,this._constraintOptions.interactionType=2,this._constraintOptions.tiltMode=0,this._constraintOptions.selection=11;break}}D(this.startCamera,e,this._lastPoint)}}_constrainPivotPoint(e,t){let n=this.startCamera,r=v();u(r,this._pivotPos,n.eye);let i=d(r),a=Math.abs(this.view.camera.position.z);this.view.renderCoordsHelper.worldUpAtPosition(n.eye,I);let o=Math.max(O(I,n.viewForward,k)*a,A);t&&(o=Math.min(i,o));let s=x(n.width/n.pixelRatio*.5,n.height/n.pixelRatio*.5),c=j(this.startCamera,s,this.view.renderCoordsHelper,this.view.viewingMode),h=this.view.stage.renderView.getMinimalDepthForArea(w(this.view),n.fullWidth/n.pixelRatio*.5,n.fullHeight/n.pixelRatio*.5,n,M*2.5,M),g=this.view.stage.renderView.getMinimalDepthForArea(w(this.view),e[0],e[1],n,M);(h!=null||g!=null)&&(h=h??g??0,g=g==null||c===1?h:g,o=h>g?g:h,o=t?Math.min(o,i):o),f(r,r),l(this._pivotPos,p(this._tmpPivotPoint,n.eye,m(this._tmpPivotPoint,r,o)))}update(e){if(this.running){switch(this.pivot){case 1:this.currentCamera.center=this._applyRotation(this.currentCamera,e,this.currentCamera.center,this._pivotPos);break;case 0:this.currentCamera.center=this._pivotPos,this.currentCamera.eye=this._applyRotation(this.currentCamera,e,this.currentCamera.eye,this._pivotPos)}S(this.view,this.currentCamera,this._constraintOptions),this.commitCamera()}}end(){this.running&&this.finishController()}_applyRotation(e,t,n,a){this.view.renderCoordsHelper.worldUpAtPosition(a,this._tmpWorldUp),D(e,t,this._tmpRotCurPoint);let s=(this._lastPoint[1]-this._tmpRotCurPoint[1])*this._rotateScale,c=(this._tmpRotCurPoint[0]-this._lastPoint[0])*this._rotateScale;u(this._tmpViewDir,n,a);let l=d(this._tmpViewDir),f=y(h(this._tmpViewDir,this._tmpWorldUp)/l);if(this.pivot===1){s*=-.5;let e=.5*Math.PI-f,t=.5*Math.PI*.99;s=e-Math.max(-t,Math.min(t,e+s))}return s=b(s+f,T.min,T.max)-f,g(this._tmpAxis,e.up,this._tmpViewDir),this.pivot===0&&(c=-c),r(this._tmpTransf,c,this._tmpWorldUp),i(this._tmpTransf,this._tmpTransf,s,this._tmpAxis),_(this._tmpViewDir,this._tmpViewDir,this._tmpTransf),e.up=_(F,e.up,this._tmpTransf),p(F,a,this._tmpViewDir),o(this._lastPoint,this._tmpRotCurPoint),F}};e([t()],P.prototype,`pivot`,void 0),P=e([n(`esri.views.3d.state.controllers.RotateController`)],P);const F=v(),I=v();export{P as RotateController};
2
+ import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{fromRotation as r,rotate as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{exactEquals as c,copy as l,subtract as u,length as d,normalize as f,add as p,scale as m,dot as h,cross as g,transformMat4 as _}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{acosClamped as y,clamp as b}from"../../../../core/mathUtils.js";import{createScreenPointArray as x}from"../../../../core/screenUtils.js";import{applyAll as S}from"../../camera/constraintUtils.js";import{ConstraintOptions as C}from"../../camera/constraintUtils/ConstraintOptions.js";import{getVoxelWasm as w}from"../../layers/VoxelWasm.js";import{TiltRange as T}from"../Constraints.js";import{excludeTerrain as E,normalizeCoordinate as D,getTiltScaleFactor as O,maxRotatePivotDistanceModifier as k,minRotatePivotDistance as A,inferNavigationMode as j,searchAreaSize as M}from"../utils/navigationUtils.js";import{InteractiveController as N}from"./InteractiveController.js";let P=class extends N{get _intersectionHelper(){return this.view.sceneIntersectionHelper}constructor(e){super(e),this.pivot=0,this._rotateScale=3,this._lastPoint=s(),this._tmpWorldUp=v(),this._tmpViewDir=v(),this._tmpRotCurPoint=s(),this._tmpTransf=a(),this._tmpAxis=v(),this._tmpPivotPoint=v(),this._pivotPos=v(),this._constraintOptions=new C(15,2,0,this.startCamera)}begin(e){if(this.running){switch(this.pivot){case 1:l(this._pivotPos,this.startCamera.eye),this._constraintOptions.interactionType=3,this._constraintOptions.tiltMode=1,this._constraintOptions.selection=0;break;case 0:{let t=this._intersectionHelper.intersectRayFreePointFallback(this.startCamera.ray,this._pivotPos,this.view.groundView.invisible?E:{})&&!c(this.startCamera.eye,this._pivotPos);t||l(this._pivotPos,this.startCamera.center),this._constrainPivotPoint(e,t),this.startCamera.center=this._pivotPos,this._constraintOptions.interactionType=2,this._constraintOptions.tiltMode=0,this._constraintOptions.selection=11;break}}D(this.startCamera,e,this._lastPoint)}}_constrainPivotPoint(e,t){let n=this.startCamera,r=v();u(r,this._pivotPos,n.eye);let i=d(r),a=Math.abs(this.view.camera.position.z);this.view.renderCoordsHelper.worldUpAtPosition(n.eye,I);let o=Math.max(O(I,n.viewForward,k)*a,A);t&&(o=Math.min(i,o));let s=x(n.width/n.pixelRatio*.5,n.height/n.pixelRatio*.5),c=j(this.startCamera,s,this.view.renderCoordsHelper,this.view.state.isGlobal),h=this.view.stage.renderView.getMinimalDepthForArea(w(this.view),n.fullWidth/n.pixelRatio*.5,n.fullHeight/n.pixelRatio*.5,n,M*2.5,M),g=this.view.stage.renderView.getMinimalDepthForArea(w(this.view),e[0],e[1],n,M);(h!=null||g!=null)&&(h=h??g??0,g=g==null||c===1?h:g,o=h>g?g:h,o=t?Math.min(o,i):o),f(r,r),l(this._pivotPos,p(this._tmpPivotPoint,n.eye,m(this._tmpPivotPoint,r,o)))}update(e){if(this.running){switch(this.pivot){case 1:this.currentCamera.center=this._applyRotation(this.currentCamera,e,this.currentCamera.center,this._pivotPos);break;case 0:this.currentCamera.center=this._pivotPos,this.currentCamera.eye=this._applyRotation(this.currentCamera,e,this.currentCamera.eye,this._pivotPos)}S(this.view,this.currentCamera,this._constraintOptions),this.commitCamera()}}end(){this.running&&this.finishController()}_applyRotation(e,t,n,a){this.view.renderCoordsHelper.worldUpAtPosition(a,this._tmpWorldUp),D(e,t,this._tmpRotCurPoint);let s=(this._lastPoint[1]-this._tmpRotCurPoint[1])*this._rotateScale,c=(this._tmpRotCurPoint[0]-this._lastPoint[0])*this._rotateScale;u(this._tmpViewDir,n,a);let l=d(this._tmpViewDir),f=y(h(this._tmpViewDir,this._tmpWorldUp)/l);if(this.pivot===1){s*=-.5;let e=.5*Math.PI-f,t=.5*Math.PI*.99;s=e-Math.max(-t,Math.min(t,e+s))}return s=b(s+f,T.min,T.max)-f,g(this._tmpAxis,e.up,this._tmpViewDir),this.pivot===0&&(c=-c),r(this._tmpTransf,c,this._tmpWorldUp),i(this._tmpTransf,this._tmpTransf,s,this._tmpAxis),_(this._tmpViewDir,this._tmpViewDir,this._tmpTransf),e.up=_(F,e.up,this._tmpTransf),p(F,a,this._tmpViewDir),o(this._lastPoint,this._tmpRotCurPoint),F}};e([t()],P.prototype,`pivot`,void 0),P=e([n(`esri.views.3d.state.controllers.RotateController`)],P);const F=v(),I=v();export{P as RotateController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{subclass as t}from"../../../../core/accessorSupport/decorators.js";import{copy as n,distance as r}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{normalize as a,subtract as o,length as s,scale as c,add as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{clamp as d}from"../../../../core/mathUtils.js";import{createScreenPointArray as f}from"../../../../core/screenUtils.js";import{getReferenceEllipsoid as p}from"../../../../geometry/ellipsoidUtils.js";import{create as m,fromPoints as h}from"../../../../geometry/support/axisAngle.js";import{Sphere as g}from"../../../../geometry/support/sphere.js";import{pixelDistanceToInteractionFactor as _,applyAll as v}from"../../camera/constraintUtils.js";import{ConstraintOptions as y}from"../../camera/constraintUtils/ConstraintOptions.js";import{applySurfaceCollisionConstraint as b}from"../../camera/constraintUtils/surfaceCollision.js";import{fromScreenAtEye as x}from"../../support/geometryUtils/ray.js";import{normalizeCoordinate as S,pickPointAndInitSphere as C,excludeTerrain as w,inferNavigationMode as T,zoomPivotDistanceClamp as E,getTiltScaleFactor as D,searchAreaSize as O,distanceComparisonTolerance as k,sphereOrPlanePointFromScreenPoint as A,applyRotation as j,maxZoomPivotDistanceModifier as M}from"../utils/navigationUtils.js";import{InteractiveController as N}from"./InteractiveController.js";let P=class extends N{constructor(){super(...arguments),this._pickPoint=u(),this._tmpP0=i(),this._panAxisAngle=m(),this._tmpRayDir=u(),this._tmpRayDirPick=u(),this._targetOnSphere=u(),this._navigationMode=1,this._tmpRay={origin:u(),direction:u()},this.dragBeginPoint=f(),this._normalizedAnchorPoint=i(),this._constraintOptions=new y(7,1,0,this.startCamera),this._sphere=new g,this._hasPickPoint=!1}begin(e){if(!this.running)return;n(this.dragBeginPoint,e),S(this.startCamera,e,this._normalizedAnchorPoint);let t=p(this.view.spatialReference),r=C(this.view,this.startCamera,e,t.radius,0,this.view.groundView.invisible?w:{});if(this._navigationMode=T(this.startCamera,e,this.view.renderCoordsHelper,this.view.viewingMode),this._navigationMode===1)this._hasPickPoint=!!r.scenePickPoint,this._pickPoint=r.scenePickPoint??this._pickPoint,this._sphere=r.sphere;else{x(this.startCamera,e,this._tmpRay),a(this._tmpRay.direction,this._tmpRay.direction);let t;r.scenePickPoint!=null&&(o(this._tmpRayDirPick,this.startCamera.eye,r.scenePickPoint),t=s(this._tmpRayDirPick));let n=Math.abs(this.view.camera.position.z);this.view.renderCoordsHelper.worldUpAtPosition(this.startCamera.eye,I);let i=d(D(I,this._tmpRay.direction,M)*n,E[0],E[1]),u=this.view.stage.renderView.getMinimalDepthForArea(null,e[0],e[1],this.view.state.camera,O)??i;t!=null&&(u=Math.min(u,t)),this._hasPickPoint=!0,c(this._tmpRay.direction,this._tmpRay.direction,u),l(this._pickPoint,this._tmpRay.origin,this._tmpRay.direction)}}update(e){if(this.running){if(this.currentCamera.eye=this.startCamera.eye,this.currentCamera.center=this.startCamera.center,this.currentCamera.up=this.startCamera.up,this._navigationMode===1){o(this._tmpRayDir,this.currentCamera.center,this.currentCamera.eye);let t=s(this._tmpRayDir);S(this.currentCamera,e,this._tmpP0);let n=(this._normalizedAnchorPoint[1]-this._tmpP0[1])*12,i=t*2**n,a=this.view.state.constraints.minimumPoiDistance;if(n<0&&i<a&&(i=a),Math.abs(t-i)<k)return;if(this._hasPickPoint&&i<t){let e=1-(1-i/t)*(1-this._sphere.radius/s(this.currentCamera.center));this.currentCamera.center=c(F,this.currentCamera.center,e)}c(this._tmpRayDir,this._tmpRayDir,-i/t),this.currentCamera.eye=l(F,this.currentCamera.center,this._tmpRayDir),this._constraintOptions.interactionFactor=_(r(this.dragBeginPoint,e)),v(this.view,this.currentCamera,this._constraintOptions),this._hasPickPoint&&(A(this._sphere,this.currentCamera,this.dragBeginPoint,this._targetOnSphere),h(this._pickPoint,this._targetOnSphere,this._panAxisAngle),j(this.currentCamera,this._sphere.center,this._panAxisAngle))}else{let t=s(this._tmpRay.direction);S(this.currentCamera,e,this._tmpP0);let n=(this._normalizedAnchorPoint[1]-this._tmpP0[1])*12,r=t*2**n,i=this.view.state.constraints.minimumPoiDistance;if(n<0&&r<i&&(r=i),Math.abs(t-r)<k)return;c(this._tmpRayDir,this._tmpRay.direction,1-r/t),this.currentCamera.eye=l(F,this.currentCamera.eye,this._tmpRayDir),this.currentCamera.center=l(F,this.currentCamera.center,this._tmpRayDir),a(this._tmpRayDir,this._tmpRayDir),this._constraintOptions.interactionDirection=this._tmpRayDir,v(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}b(this.view,null,this.currentCamera),this.commitCamera()}}finish(){this.running&&this.finishController()}};P=e([t(`esri.views.3d.state.controllers.ZoomControllerGlobal`)],P);const F=u(),I=u();export{P as ZoomControllerGlobal};
2
+ import{__decorate as e}from"tslib";import{subclass as t}from"../../../../core/accessorSupport/decorators.js";import{copy as n,distance as r}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{normalize as a,subtract as o,length as s,scale as c,add as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{clamp as d}from"../../../../core/mathUtils.js";import{createScreenPointArray as f}from"../../../../core/screenUtils.js";import{getReferenceEllipsoid as p}from"../../../../geometry/ellipsoidUtils.js";import{create as m,fromPoints as h}from"../../../../geometry/support/axisAngle.js";import{Sphere as g}from"../../../../geometry/support/sphere.js";import{pixelDistanceToInteractionFactor as _,applyAll as v}from"../../camera/constraintUtils.js";import{ConstraintOptions as y}from"../../camera/constraintUtils/ConstraintOptions.js";import{applySurfaceCollisionConstraint as b}from"../../camera/constraintUtils/surfaceCollision.js";import{fromScreenAtEye as x}from"../../support/geometryUtils/ray.js";import{normalizeCoordinate as S,pickPointAndInitSphere as C,excludeTerrain as w,inferNavigationMode as T,zoomPivotDistanceClamp as E,getTiltScaleFactor as D,searchAreaSize as O,distanceComparisonTolerance as k,sphereOrPlanePointFromScreenPoint as A,applyRotation as j,maxZoomPivotDistanceModifier as M}from"../utils/navigationUtils.js";import{InteractiveController as N}from"./InteractiveController.js";let P=class extends N{constructor(){super(...arguments),this._pickPoint=u(),this._tmpP0=i(),this._panAxisAngle=m(),this._tmpRayDir=u(),this._tmpRayDirPick=u(),this._targetOnSphere=u(),this._navigationMode=1,this._tmpRay={origin:u(),direction:u()},this.dragBeginPoint=f(),this._normalizedAnchorPoint=i(),this._constraintOptions=new y(7,1,0,this.startCamera),this._sphere=new g,this._hasPickPoint=!1}begin(e){if(!this.running)return;n(this.dragBeginPoint,e),S(this.startCamera,e,this._normalizedAnchorPoint);let t=p(this.view.spatialReference),r=C(this.view,this.startCamera,e,t.radius,0,this.view.groundView.invisible?w:{});if(this._navigationMode=T(this.startCamera,e,this.view.renderCoordsHelper,this.view.state.isGlobal),this._navigationMode===1)this._hasPickPoint=!!r.scenePickPoint,this._pickPoint=r.scenePickPoint??this._pickPoint,this._sphere=r.sphere;else{x(this.startCamera,e,this._tmpRay),a(this._tmpRay.direction,this._tmpRay.direction);let t;r.scenePickPoint!=null&&(o(this._tmpRayDirPick,this.startCamera.eye,r.scenePickPoint),t=s(this._tmpRayDirPick));let n=Math.abs(this.view.camera.position.z);this.view.renderCoordsHelper.worldUpAtPosition(this.startCamera.eye,I);let i=d(D(I,this._tmpRay.direction,M)*n,E[0],E[1]),u=this.view.stage.renderView.getMinimalDepthForArea(null,e[0],e[1],this.view.state.camera,O)??i;t!=null&&(u=Math.min(u,t)),this._hasPickPoint=!0,c(this._tmpRay.direction,this._tmpRay.direction,u),l(this._pickPoint,this._tmpRay.origin,this._tmpRay.direction)}}update(e){if(this.running){if(this.currentCamera.eye=this.startCamera.eye,this.currentCamera.center=this.startCamera.center,this.currentCamera.up=this.startCamera.up,this._navigationMode===1){o(this._tmpRayDir,this.currentCamera.center,this.currentCamera.eye);let t=s(this._tmpRayDir);S(this.currentCamera,e,this._tmpP0);let n=(this._normalizedAnchorPoint[1]-this._tmpP0[1])*12,i=t*2**n,a=this.view.state.constraints.minimumPoiDistance;if(n<0&&i<a&&(i=a),Math.abs(t-i)<k)return;if(this._hasPickPoint&&i<t){let e=1-(1-i/t)*(1-this._sphere.radius/s(this.currentCamera.center));this.currentCamera.center=c(F,this.currentCamera.center,e)}c(this._tmpRayDir,this._tmpRayDir,-i/t),this.currentCamera.eye=l(F,this.currentCamera.center,this._tmpRayDir),this._constraintOptions.interactionFactor=_(r(this.dragBeginPoint,e)),v(this.view,this.currentCamera,this._constraintOptions),this._hasPickPoint&&(A(this._sphere,this.currentCamera,this.dragBeginPoint,this._targetOnSphere),h(this._pickPoint,this._targetOnSphere,this._panAxisAngle),j(this.currentCamera,this._sphere.center,this._panAxisAngle))}else{let t=s(this._tmpRay.direction);S(this.currentCamera,e,this._tmpP0);let n=(this._normalizedAnchorPoint[1]-this._tmpP0[1])*12,r=t*2**n,i=this.view.state.constraints.minimumPoiDistance;if(n<0&&r<i&&(r=i),Math.abs(t-r)<k)return;c(this._tmpRayDir,this._tmpRay.direction,1-r/t),this.currentCamera.eye=l(F,this.currentCamera.eye,this._tmpRayDir),this.currentCamera.center=l(F,this.currentCamera.center,this._tmpRayDir),a(this._tmpRayDir,this._tmpRayDir),this._constraintOptions.interactionDirection=this._tmpRayDir,v(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}b(this.view,null,this.currentCamera),this.commitCamera()}}finish(){this.running&&this.finishController()}};P=e([t(`esri.views.3d.state.controllers.ZoomControllerGlobal`)],P);const F=u(),I=u();export{P as ZoomControllerGlobal};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{subclass as t}from"../../../../core/accessorSupport/decorators.js";import{copy as n,squaredDistance as r,normalize as i,scale as a,length as o,subtract as s,add as c}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{clamp as u}from"../../../../core/mathUtils.js";import{Milliseconds as d}from"../../../../core/time.js";import{getReferenceEllipsoid as f}from"../../../../geometry/ellipsoidUtils.js";import{create as p}from"../../../../geometry/support/ray.js";import{Sphere as m}from"../../../../geometry/support/sphere.js";import{outExpo as h}from"../../../animation/easing.js";import{applyAll as g}from"../../camera/constraintUtils.js";import{ConstraintOptions as _}from"../../camera/constraintUtils/ConstraintOptions.js";import{applySurfaceCollisionConstraint as v}from"../../camera/constraintUtils/surfaceCollision.js";import{fromScreenAtEye as y}from"../../support/geometryUtils/ray.js";import{intersectScreen as b}from"../../support/geometryUtils/sphere.js";import{Intersector as x}from"../../webgl-engine/lib/Intersector.js";import S from"../../webgl/RenderCamera.js";import{excludeTerrain as C,isHitOnSamePlanetSide as w,inferNavigationMode as T,zoomStepDistanceClamp as E,getTiltScaleFactor as D,maxZoomStepDistanceModifier as O,distanceComparisonTolerance as k,panToPosition as A}from"../utils/navigationUtils.js";import{PointToPointAnimationController as j}from"./PointToPointAnimationController.js";const M=.6;let N=class extends j{constructor(){super(...arguments),this._zoomLocation=l(),this._tmpCamera=new S,this._tmpViewDir=l(),this._tmpRayDir=p(),this._targetOnSphere=l(),this._tmpCenter=l(),this._beginCamera=new S,this._constraintOptions=new _(7,1,null,this._beginCamera),this._sphere=new m}initialize(){this._intersector=new x(this.view.state.isGlobal)}step(e,t){if(!this.running)return;let r=this.view.state;this.animation.finished?this._beginCamera.copyFrom(r.camera):this.animation.cameraAt(1,this._beginCamera);let i=!1,a=!1;this._intersectionHelper.intersectScreen(t,this._zoomLocation,this.view.map.ground.opacity===0?C:{})&&w(r.camera.eye,this._zoomLocation,f(this.view.spatialReference).radius)&&(i=e>0,a=!0),this._tmpCamera.copyFrom(r.camera),i?this._intersectsValidTarget(this._tmpCamera,this._tmpCenter)&&(this._tmpCamera.center=this._tmpCenter):this._intersectsValidTarget(this._tmpCamera,this._zoomLocation)?this._tmpCamera.center=this._zoomLocation:n(this._zoomLocation,this._tmpCamera.center),this._updateCamera(this._tmpCamera,e,t,a),this.begin(this._tmpCamera)}_intersectsValidTarget(e,t){return this._intersectionHelper.intersectRay(e.ray,this._intersector,t)?r(e.eye,t)>=16:!1}animationSettings(){return{duration:d(600),easing:h}}_updateCamera(e,t,n,l){let d=T(e,n,this.view.renderCoordsHelper,this.view.viewingMode),f=Math.abs(this.view.camera.position.z),p=this._zoomLocation;i(F,e.eye),a(F,F,-1),y(e,n,this._tmpRayDir),i(this._tmpRayDir.direction,this._tmpRayDir.direction);let m=u(D(F,this._tmpRayDir.direction,O)*f,E[0],E[1]);if(d===1){let i=M**t;this._sphere.radius=o(p),s(this._tmpViewDir,e.center,e.eye);let l=Math.min(o(this._tmpViewDir),m),u=l*i;if(i<=1&&u<4&&(u=4,i=u/l),Math.abs(l-u)<k)return;let d=o(e.center);if(this._sphere.radius!==d){let t=this._sphere.radius+i*(d-this._sphere.radius);e.center=a(P,e.center,t/d)}a(this._tmpViewDir,this._tmpViewDir,-i),e.eye=c(P,e.center,this._tmpViewDir),g(this.view,e,this._constraintOptions),r(p,e.center)>1e-12&&b(this._sphere,e,n,this._targetOnSphere)&&A(this._sphere,e,p,this._targetOnSphere,this.view.camera.heading,this.view.camera.tilt,!0)}else{let r=M**Math.abs(t),u=t>0?1:-1;s(this._tmpViewDir,p,e.eye);let d=o(this._tmpViewDir),f=this.view.stage.renderView.getMinimalDepthForArea(null,n[0],n[1],this.view.state.camera,60)??m;l&&t>0&&(f=Math.min(f,d)),a(this._tmpRayDir.direction,this._tmpRayDir.direction,f),c(p,this._tmpRayDir.origin,this._tmpRayDir.direction);let h=f*r,_=Math.max(4,e.nearFar[0]*1.01);if(t>0&&h<_&&(h=_,r=h/f),Math.abs(f-h)<k)return;a(this._tmpRayDir.direction,this._tmpRayDir.direction,u*(1-r)),e.eye=c(P,e.eye,this._tmpRayDir.direction),e.center=c(P,e.center,this._tmpRayDir.direction),i(this._tmpRayDir.direction,this._tmpRayDir.direction),this._constraintOptions.interactionDirection=this._tmpRayDir.direction,g(this.view,e,this._constraintOptions),this._constraintOptions.interactionDirection=null}v(this.view,null,e)}};N=e([t(`esri.views.3d.state.controllers.ZoomStepControllerGlobal`)],N);const P=l(),F=l();export{N as ZoomStepControllerGlobal};
2
+ import{__decorate as e}from"tslib";import{subclass as t}from"../../../../core/accessorSupport/decorators.js";import{copy as n,squaredDistance as r,normalize as i,scale as a,length as o,subtract as s,add as c}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{clamp as u}from"../../../../core/mathUtils.js";import{Milliseconds as d}from"../../../../core/time.js";import{getReferenceEllipsoid as f}from"../../../../geometry/ellipsoidUtils.js";import{create as p}from"../../../../geometry/support/ray.js";import{Sphere as m}from"../../../../geometry/support/sphere.js";import{outExpo as h}from"../../../animation/easing.js";import{applyAll as g}from"../../camera/constraintUtils.js";import{ConstraintOptions as _}from"../../camera/constraintUtils/ConstraintOptions.js";import{applySurfaceCollisionConstraint as v}from"../../camera/constraintUtils/surfaceCollision.js";import{fromScreenAtEye as y}from"../../support/geometryUtils/ray.js";import{intersectScreen as b}from"../../support/geometryUtils/sphere.js";import{Intersector as x}from"../../webgl-engine/lib/Intersector.js";import S from"../../webgl/RenderCamera.js";import{excludeTerrain as C,isHitOnSamePlanetSide as w,inferNavigationMode as T,zoomStepDistanceClamp as E,getTiltScaleFactor as D,maxZoomStepDistanceModifier as O,distanceComparisonTolerance as k,panToPosition as A}from"../utils/navigationUtils.js";import{PointToPointAnimationController as j}from"./PointToPointAnimationController.js";const M=.6;let N=class extends j{constructor(){super(...arguments),this._zoomLocation=l(),this._tmpCamera=new S,this._tmpViewDir=l(),this._tmpRayDir=p(),this._targetOnSphere=l(),this._tmpCenter=l(),this._beginCamera=new S,this._constraintOptions=new _(7,1,null,this._beginCamera),this._sphere=new m}initialize(){this._intersector=new x(this.view.state.isGlobal)}step(e,t){if(!this.running)return;let r=this.view.state;this.animation.finished?this._beginCamera.copyFrom(r.camera):this.animation.cameraAt(1,this._beginCamera);let i=!1,a=!1;this._intersectionHelper.intersectScreen(t,this._zoomLocation,this.view.map.ground.opacity===0?C:{})&&w(r.camera.eye,this._zoomLocation,f(this.view.spatialReference).radius)&&(i=e>0,a=!0),this._tmpCamera.copyFrom(r.camera),i?this._intersectsValidTarget(this._tmpCamera,this._tmpCenter)&&(this._tmpCamera.center=this._tmpCenter):this._intersectsValidTarget(this._tmpCamera,this._zoomLocation)?this._tmpCamera.center=this._zoomLocation:n(this._zoomLocation,this._tmpCamera.center),this._updateCamera(this._tmpCamera,e,t,a),this.begin(this._tmpCamera)}_intersectsValidTarget(e,t){return this._intersectionHelper.intersectRay(e.ray,this._intersector,t)?r(e.eye,t)>=16:!1}animationSettings(){return{duration:d(600),easing:h}}_updateCamera(e,t,n,l){let d=T(e,n,this.view.renderCoordsHelper,this.view.state.isGlobal),f=Math.abs(this.view.camera.position.z),p=this._zoomLocation;i(F,e.eye),a(F,F,-1),y(e,n,this._tmpRayDir),i(this._tmpRayDir.direction,this._tmpRayDir.direction);let m=u(D(F,this._tmpRayDir.direction,O)*f,E[0],E[1]);if(d===1){let i=M**t;this._sphere.radius=o(p),s(this._tmpViewDir,e.center,e.eye);let l=Math.min(o(this._tmpViewDir),m),u=l*i;if(i<=1&&u<4&&(u=4,i=u/l),Math.abs(l-u)<k)return;let d=o(e.center);if(this._sphere.radius!==d){let t=this._sphere.radius+i*(d-this._sphere.radius);e.center=a(P,e.center,t/d)}a(this._tmpViewDir,this._tmpViewDir,-i),e.eye=c(P,e.center,this._tmpViewDir),g(this.view,e,this._constraintOptions),r(p,e.center)>1e-12&&b(this._sphere,e,n,this._targetOnSphere)&&A(this._sphere,e,p,this._targetOnSphere,this.view.camera.heading,this.view.camera.tilt,!0)}else{let r=M**Math.abs(t),u=t>0?1:-1;s(this._tmpViewDir,p,e.eye);let d=o(this._tmpViewDir),f=this.view.stage.renderView.getMinimalDepthForArea(null,n[0],n[1],this.view.state.camera,60)??m;l&&t>0&&(f=Math.min(f,d)),a(this._tmpRayDir.direction,this._tmpRayDir.direction,f),c(p,this._tmpRayDir.origin,this._tmpRayDir.direction);let h=f*r,_=Math.max(4,e.nearFar[0]*1.01);if(t>0&&h<_&&(h=_,r=h/f),Math.abs(f-h)<k)return;a(this._tmpRayDir.direction,this._tmpRayDir.direction,u*(1-r)),e.eye=c(P,e.eye,this._tmpRayDir.direction),e.center=c(P,e.center,this._tmpRayDir.direction),i(this._tmpRayDir.direction,this._tmpRayDir.direction),this._constraintOptions.interactionDirection=this._tmpRayDir.direction,g(this.view,e,this._constraintOptions),this._constraintOptions.interactionDirection=null}v(this.view,null,e)}};N=e([t(`esri.views.3d.state.controllers.ZoomStepControllerGlobal`)],N);const P=l(),F=l();export{N as ZoomStepControllerGlobal};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{crossAndNormalize as e,copy as t,scale as n,subtract as r,add as i,distance as a,normalize as o,cross as s,dot as c,scaleAndAdd as l,length as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{createScreenPointArray as f}from"../../../../core/screenUtils.js";import{getReferenceEllipsoid as p}from"../../../../geometry/ellipsoidUtils.js";import{fromValues as m}from"../../../../geometry/support/lineSegment.js";import{create as h,fromPositionAndNormal as g,distance as _,projectPoint as v,projectVector as y,intersectLineSegment as b}from"../../../../geometry/support/plane.js";import{create as x}from"../../../../geometry/support/ray.js";import{Sphere as S}from"../../../../geometry/support/sphere.js";import{getVoxelWasm as ee}from"../../layers/VoxelWasm.js";import{fromScreenAtEye as te}from"../../support/geometryUtils/ray.js";import{fromRenderCamera as C}from"../../webgl.js";import{Intersector as w}from"../../webgl-engine/lib/Intersector.js";import T from"../../webgl/RenderCamera.js";import{pickPointAndInitSphere as E,sphereOrPlanePointFromScreenPoint as D,intersectPlaneFromScreenPoint as O,searchAreaSize as k}from"./navigationUtils.js";import{OffsetCorrectionController as ne}from"./OffsetCorrectionController.js";const A=1.5,j={xSpeedMultiplier:A,ySpeedMultiplier:A,maxElevation:1e4,relativeHorizonPadding:.1,minimumHorizonPadding:12,i3sNodeDownwardCheckDistanceInMeters:5},M=d(),N=d(),P=f(),F=d(),I=h(),L=d(),R=d(),z=d(),B=d(),V=d(),re=d(),H=d(),U=d(),W=d(),G=d(),K=f(),q=x(),J=new S,Y=d(),ie=h(),X=d(),ae=d();function oe(e,t){return y(t,e.viewForward,M),i(N,e.eye,M),e.projectToScreen(N,P),P[1]}function se(t,u,d){let f=t.eye;if(a(u.center,f)<u.radius)return o(V,f),s(re,V,t.viewRight),i(N,f,re),t.projectToScreen(N,K),K[1];let p=t.up;te(t,d,q);let m=u.radius;if(e(F,p,q.direction),g(f,F,I),_(I,u.center)>m)return null;v(I,u.center,L);let h=a(u.center,L),y=Math.sqrt(m**2-h**2);r(R,f,L),o(z,R),e(B,F,z);let b=c(R,z),x=c(R,B),S=Math.sqrt(b**2+x**2),ee=Math.sqrt(S**2-y**2),C=y**2/S**2,w=y/S**2*ee,T=C*b,E=w*-x,D=C*x,O=w*b,k=T+E,ne=T-E,A=D+O,j=D-O;return i(H,L,l(H,n(H,z,k),B,A)),i(U,L,l(U,n(U,z,ne),B,j)),r(W,H,f),o(W,W),r(G,U,f),o(G,G),c(t.viewForward,W)>=c(t.viewForward,G)?t.projectToScreen(H,K):t.projectToScreen(U,K),K[1]}function ce(e,t,n=!0){return n?e<t:e<=t}function Z(e,t,n=!0){return n?e>t:e>=t}function le(e,t,n){return t?e>n:e<n}function Q(e,t){let n=e.fullHeight/e.pixelRatio,r=Math.max(t,n-t);return Math.max(j.minimumHorizonPadding,j.relativeHorizonPadding*r)}function ue(e,t){return[de(e,t),fe(e,t)]}function de(e,t){let n=e.fullHeight/e.pixelRatio;return Math.min(n,t+Q(e,t))}function fe(e,t){return Math.max(0,t-Q(e,t))}function pe(e,t,n){let r={translation:e,location:t};return n&&(r.normal=n),r}function me(e){let{view:t}=e;return t.viewingMode===`global`?he(e):ge(e)}function he(e){let{view:n,originalScreenPoint:r,horizonY:i,horizonPadding:s,outTranslation:c,outGrabLocation:l,outGrabNormal:u,intersectionOptions:d,depthSearchSize:f}=e,m=n.state.camera,h=pe(c,l,u);J.radius=p(n.spatialReference).radius;let g=E(n,m,r,J.radius,1,d);if(g.scenePickPoint==null)return!1;let _=g.hasGeometryIntersection;t(Y,g.scenePickPoint),t(h.location,Y);let v=g.sphere;h.normal&&g.normal&&t(h.normal,g.normal);let y=ve(r,i,s,_),b=_?a(Y,m.eye):1/0;return y.wasAdjusted&&ye({view:n,screenAdjustment:y,intersector:$(n),fallbackCheck:(e,t,n)=>{let r=D(v,m,e,t);return r&&n&&o(n,t),r},output:h,intersectionOptions:d}),xe({view:n,screenPoint:y.adjustedScreenPoint,camera:m,initialDistance:b,depthSearchSize:f??k,output:h}),!0}function ge(e){let{view:n,originalScreenPoint:r,horizonY:i,horizonPadding:s,outTranslation:c,outGrabLocation:u,outGrabNormal:d,intersectionOptions:f,depthSearchSize:p}=e,m=n.sceneIntersectionHelper,h=n.state.camera,_=$(n),v=pe(c,u,d);m.intersectIntersectorScreen(r,_,f);let y=_.results.min.getIntersectionPoint(Y),b=y?a(Y,h.eye):1/0;y&&(t(v.location,Y),v.normal&&t(v.normal,_.results.min.normal)),n.renderCoordsHelper.worldUpAtPosition(h.eye,V),l(X,h.eye,V,-h.relativeElevation),g(X,V,ie);let x=ve(r,i,s,y);return x.wasAdjusted&&ye({view:n,screenAdjustment:x,intersector:_,fallbackCheck:(e,t,n)=>{let r=O(ie,h,e,t);return r&&n&&o(n,V),r},output:v,intersectionOptions:f}),xe({view:n,screenPoint:x.adjustedScreenPoint,camera:h,initialDistance:b,depthSearchSize:p??k,output:v}),!0}function _e(e,t,n,r){return!r&&ce(e,t)||r&&le(e,!1,n[0])?n[0]:!r&&Z(e,t,!1)?n[1]:null}function ve(e,t,n,r){let i=_e(e[1],t,n,r);return{originalScreenPoint:e,adjustedScreenPoint:f(e[0],i??e[1]),horizonY:t,horizonPadding:n,wasAdjusted:i!==null}}function $(e){let t=new w(e.state.isGlobal);return t.options.selectionMode=!0,t.options.store=0,t.options.hud=!1,t.options.normalRequired=!0,t}function ye(e){let{view:n,screenAdjustment:r,fallbackCheck:i,intersector:a,output:o,intersectionOptions:s}=e,c=n.sceneIntersectionHelper;c.intersectIntersectorScreen(r.adjustedScreenPoint,a,{...s,requiresGroundFeedback:!0});let l=a.results.min.getIntersectionPoint(o.location);if(l){o.normal&&t(o.normal,a.results.min.normal);return}let u=be(r);c.intersectIntersectorScreen(u,a,{...s,requiresGroundFeedback:!0}),l=a.results.min.getIntersectionPoint(o.location),l?o.normal&&t(o.normal,a.results.min.normal):(l=i(r.adjustedScreenPoint,o.location,o.normal),l||i(u,o.location,o.normal))}function be(e){let{originalScreenPoint:t,adjustedScreenPoint:n,horizonY:r,horizonPadding:i}=e,a=Z(n[1],r)?Math.min(i[1],t[1]):Math.max(i[0],t[1]);return f(n[0],a)}function xe(e){Se(e),Ce(e)}function Se(e){let{view:n,camera:i,output:a}=e,{offset:o}=n.navigation.mode;if(!o)return;let{translation:s,location:c}=a;n.renderCoordsHelper.worldUpAtPosition(i.eye,V),l(X,i.eye,V,-o),g(X,V,I),b(I,m(i.eye,r(M,c,i.eye)),X)&&(t(c,X),r(s,c,i.eye))}function Ce(e){let{view:t,screenPoint:a,camera:s,initialDistance:c,depthSearchSize:l,output:d}=e,f=l>0?t.stage.renderView.getMinimalDepthForArea(ee(t),a[0],a[1],s,l):null;r(d.translation,d.location,s.eye);let p=Math.min(u(d.translation),c);f&&f<=p&&(p=f),o(d.translation,d.translation),n(d.translation,d.translation,p),i(d.location,d.translation,s.eye)}async function we(e,t,n,r,i){let a=new T().copyFrom(e.state.camera);if(Te({view:e,camera:a,forwardDirection:t,forwardDistance:n,detectCollisions:!0}))return r?r.smoothlyCorrectGroundElevation({camera:a,deltaTime:i}):new ne(e).immediatelyCorrectGroundElevation({camera:a,correctionLimit:100}),e.goTo(C(e,a),{duration:500,liftOffDisabled:!0})}function Te(o){let{view:s,camera:c,forwardDirection:l,forwardDistance:d,detectCollisions:f}=o,p=s.navigation.mode;if(p.type!==`ground`)return!1;s.renderCoordsHelper.worldUpAtPosition(c.eye,V);let m=s.sceneIntersectionHelper,h=$(s),g=e(M,V,e(M,l,V));t(q.origin,c.eye),n(q.direction,g,d);let _=m.intersectRay(q,h,Y,{include:p.include,exclude:p.exclude}),v=r(ae,c.center,c.eye);return!f||!_||a(Y,c.eye)>Math.abs(d)?c.eye=i(M,q.origin,q.direction):(r(M,Y,c.eye),u(M)>2&&(Ee(M,M,.25,2),c.eye=i(M,c.eye,M))),c.center=i(M,c.eye,v),!0}function Ee(e,t,r,i){let a=u(e),o=Math.min(r,Math.max(a-i,0)/a);n(t,e,o)}export{Te as advanceGroundNavigationCamera,Q as computeHorizonPadding,ue as computeHorizonPaddingLimits,me as findGroundNavigationGrabLocation,oe as findPlaneHorizonY,se as findSphereHorizonY,we as groundNavigationAdvance,j as groundNavigationConstants,ce as isAboveHorizon,Z as isBelowHorizon,Ee as shortenTranslation,le as shouldClampScreenY};
2
+ import{crossAndNormalize as e,copy as t,scale as n,subtract as r,add as i,distance as a,normalize as o,cross as s,dot as c,scaleAndAdd as l,length as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{createScreenPointArray as f}from"../../../../core/screenUtils.js";import{getReferenceEllipsoid as p}from"../../../../geometry/ellipsoidUtils.js";import{fromValues as m}from"../../../../geometry/support/lineSegment.js";import{create as h,fromPositionAndNormal as g,distance as _,projectPoint as v,projectVector as y,intersectLineSegment as b}from"../../../../geometry/support/plane.js";import{create as x}from"../../../../geometry/support/ray.js";import{Sphere as S}from"../../../../geometry/support/sphere.js";import{getVoxelWasm as ee}from"../../layers/VoxelWasm.js";import{fromScreenAtEye as te}from"../../support/geometryUtils/ray.js";import{fromRenderCamera as C}from"../../webgl.js";import{Intersector as w}from"../../webgl-engine/lib/Intersector.js";import T from"../../webgl/RenderCamera.js";import{pickPointAndInitSphere as E,sphereOrPlanePointFromScreenPoint as D,intersectPlaneFromScreenPoint as O,searchAreaSize as k}from"./navigationUtils.js";import{OffsetCorrectionController as ne}from"./OffsetCorrectionController.js";const A=1.5,j={xSpeedMultiplier:A,ySpeedMultiplier:A,maxElevation:1e4,relativeHorizonPadding:.1,minimumHorizonPadding:12,i3sNodeDownwardCheckDistanceInMeters:5},M=d(),N=d(),P=f(),F=d(),I=h(),L=d(),R=d(),z=d(),B=d(),V=d(),re=d(),H=d(),U=d(),W=d(),G=d(),K=f(),q=x(),J=new S,Y=d(),ie=h(),X=d(),ae=d();function oe(e,t){return y(t,e.viewForward,M),i(N,e.eye,M),e.projectToScreen(N,P),P[1]}function se(t,u,d){let f=t.eye;if(a(u.center,f)<u.radius)return o(V,f),s(re,V,t.viewRight),i(N,f,re),t.projectToScreen(N,K),K[1];let p=t.up;te(t,d,q);let m=u.radius;if(e(F,p,q.direction),g(f,F,I),_(I,u.center)>m)return null;v(I,u.center,L);let h=a(u.center,L),y=Math.sqrt(m**2-h**2);r(R,f,L),o(z,R),e(B,F,z);let b=c(R,z),x=c(R,B),S=Math.sqrt(b**2+x**2),ee=Math.sqrt(S**2-y**2),C=y**2/S**2,w=y/S**2*ee,T=C*b,E=w*-x,D=C*x,O=w*b,k=T+E,ne=T-E,A=D+O,j=D-O;return i(H,L,l(H,n(H,z,k),B,A)),i(U,L,l(U,n(U,z,ne),B,j)),r(W,H,f),o(W,W),r(G,U,f),o(G,G),c(t.viewForward,W)>=c(t.viewForward,G)?t.projectToScreen(H,K):t.projectToScreen(U,K),K[1]}function ce(e,t,n=!0){return n?e<t:e<=t}function Z(e,t,n=!0){return n?e>t:e>=t}function le(e,t,n){return t?e>n:e<n}function Q(e,t){let n=e.fullHeight/e.pixelRatio,r=Math.max(t,n-t);return Math.max(j.minimumHorizonPadding,j.relativeHorizonPadding*r)}function ue(e,t){return[de(e,t),fe(e,t)]}function de(e,t){let n=e.fullHeight/e.pixelRatio;return Math.min(n,t+Q(e,t))}function fe(e,t){return Math.max(0,t-Q(e,t))}function pe(e,t,n){let r={translation:e,location:t};return n&&(r.normal=n),r}function me(e){let{view:t}=e;return t.state.isGlobal?he(e):ge(e)}function he(e){let{view:n,originalScreenPoint:r,horizonY:i,horizonPadding:s,outTranslation:c,outGrabLocation:l,outGrabNormal:u,intersectionOptions:d,depthSearchSize:f}=e,m=n.state.camera,h=pe(c,l,u);J.radius=p(n.spatialReference).radius;let g=E(n,m,r,J.radius,1,d);if(g.scenePickPoint==null)return!1;let _=g.hasGeometryIntersection;t(Y,g.scenePickPoint),t(h.location,Y);let v=g.sphere;h.normal&&g.normal&&t(h.normal,g.normal);let y=ve(r,i,s,_),b=_?a(Y,m.eye):1/0;return y.wasAdjusted&&ye({view:n,screenAdjustment:y,intersector:$(n),fallbackCheck:(e,t,n)=>{let r=D(v,m,e,t);return r&&n&&o(n,t),r},output:h,intersectionOptions:d}),xe({view:n,screenPoint:y.adjustedScreenPoint,camera:m,initialDistance:b,depthSearchSize:f??k,output:h}),!0}function ge(e){let{view:n,originalScreenPoint:r,horizonY:i,horizonPadding:s,outTranslation:c,outGrabLocation:u,outGrabNormal:d,intersectionOptions:f,depthSearchSize:p}=e,m=n.sceneIntersectionHelper,h=n.state.camera,_=$(n),v=pe(c,u,d);m.intersectIntersectorScreen(r,_,f);let y=_.results.min.getIntersectionPoint(Y),b=y?a(Y,h.eye):1/0;y&&(t(v.location,Y),v.normal&&t(v.normal,_.results.min.normal)),n.renderCoordsHelper.worldUpAtPosition(h.eye,V),l(X,h.eye,V,-h.relativeElevation),g(X,V,ie);let x=ve(r,i,s,y);return x.wasAdjusted&&ye({view:n,screenAdjustment:x,intersector:_,fallbackCheck:(e,t,n)=>{let r=O(ie,h,e,t);return r&&n&&o(n,V),r},output:v,intersectionOptions:f}),xe({view:n,screenPoint:x.adjustedScreenPoint,camera:h,initialDistance:b,depthSearchSize:p??k,output:v}),!0}function _e(e,t,n,r){return!r&&ce(e,t)||r&&le(e,!1,n[0])?n[0]:!r&&Z(e,t,!1)?n[1]:null}function ve(e,t,n,r){let i=_e(e[1],t,n,r);return{originalScreenPoint:e,adjustedScreenPoint:f(e[0],i??e[1]),horizonY:t,horizonPadding:n,wasAdjusted:i!==null}}function $(e){let t=new w(e.state.isGlobal);return t.options.selectionMode=!0,t.options.store=0,t.options.hud=!1,t.options.normalRequired=!0,t}function ye(e){let{view:n,screenAdjustment:r,fallbackCheck:i,intersector:a,output:o,intersectionOptions:s}=e,c=n.sceneIntersectionHelper;c.intersectIntersectorScreen(r.adjustedScreenPoint,a,{...s,requiresGroundFeedback:!0});let l=a.results.min.getIntersectionPoint(o.location);if(l){o.normal&&t(o.normal,a.results.min.normal);return}let u=be(r);c.intersectIntersectorScreen(u,a,{...s,requiresGroundFeedback:!0}),l=a.results.min.getIntersectionPoint(o.location),l?o.normal&&t(o.normal,a.results.min.normal):(l=i(r.adjustedScreenPoint,o.location,o.normal),l||i(u,o.location,o.normal))}function be(e){let{originalScreenPoint:t,adjustedScreenPoint:n,horizonY:r,horizonPadding:i}=e,a=Z(n[1],r)?Math.min(i[1],t[1]):Math.max(i[0],t[1]);return f(n[0],a)}function xe(e){Se(e),Ce(e)}function Se(e){let{view:n,camera:i,output:a}=e,{offset:o}=n.navigation.mode;if(!o)return;let{translation:s,location:c}=a;n.renderCoordsHelper.worldUpAtPosition(i.eye,V),l(X,i.eye,V,-o),g(X,V,I),b(I,m(i.eye,r(M,c,i.eye)),X)&&(t(c,X),r(s,c,i.eye))}function Ce(e){let{view:t,screenPoint:a,camera:s,initialDistance:c,depthSearchSize:l,output:d}=e,f=l>0?t.stage.renderView.getMinimalDepthForArea(ee(t),a[0],a[1],s,l):null;r(d.translation,d.location,s.eye);let p=Math.min(u(d.translation),c);f&&f<=p&&(p=f),o(d.translation,d.translation),n(d.translation,d.translation,p),i(d.location,d.translation,s.eye)}async function we(e,t,n,r,i){let a=new T().copyFrom(e.state.camera);if(Te({view:e,camera:a,forwardDirection:t,forwardDistance:n,detectCollisions:!0}))return r?r.smoothlyCorrectGroundElevation({camera:a,deltaTime:i}):new ne(e).immediatelyCorrectGroundElevation({camera:a,correctionLimit:100}),e.goTo(C(e,a),{duration:500,liftOffDisabled:!0})}function Te(o){let{view:s,camera:c,forwardDirection:l,forwardDistance:d,detectCollisions:f}=o,p=s.navigation.mode;if(p.type!==`ground`)return!1;s.renderCoordsHelper.worldUpAtPosition(c.eye,V);let m=s.sceneIntersectionHelper,h=$(s),g=e(M,V,e(M,l,V));t(q.origin,c.eye),n(q.direction,g,d);let _=m.intersectRay(q,h,Y,{include:p.include,exclude:p.exclude}),v=r(ae,c.center,c.eye);return!f||!_||a(Y,c.eye)>Math.abs(d)?c.eye=i(M,q.origin,q.direction):(r(M,Y,c.eye),u(M)>2&&(Ee(M,M,.25,2),c.eye=i(M,c.eye,M))),c.center=i(M,c.eye,v),!0}function Ee(e,t,r,i){let a=u(e),o=Math.min(r,Math.max(a-i,0)/a);n(t,e,o)}export{Te as advanceGroundNavigationCamera,Q as computeHorizonPadding,ue as computeHorizonPaddingLimits,me as findGroundNavigationGrabLocation,oe as findPlaneHorizonY,se as findSphereHorizonY,we as groundNavigationAdvance,j as groundNavigationConstants,ce as isAboveHorizon,Z as isBelowHorizon,Ee as shortenTranslation,le as shouldClampScreenY};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{cyclicalPI as e}from"../../../../core/Cyclical.js";import{IDENTITY as t,create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromRotation as r,exactEquals as i,multiply as a,rotate as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{set as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{exactEquals as l,length as u,dot as d,subtract as f,normalize as p,squaredDistance as m,copy as h,transformMat4 as g,add as _,distance as ee,cross as v,scale as y,lerp as te,set as ne}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as re,create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{deg2rad as x,clamp as ie,acosClamped as S,asinClamped as ae}from"../../../../core/mathUtils.js";import{createScreenPointArray as oe}from"../../../../core/screenUtils.js";import{create as se,axis as ce,fromPoints as le,wrapAxisAngle as ue}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as C,vectorCoordinates as de}from"../../../../geometry/support/coordinateSystem.js";import{create as fe,fromNormalAndOffset as pe,intersectRay as w}from"../../../../geometry/support/plane.js";import{Sphere as me}from"../../../../geometry/support/sphere.js";import{sm4d as he,sv3d as T}from"../../../../geometry/support/vectorStacks.js";import{fromScreenAtEye as E,fromScreen as ge}from"../../support/geometryUtils/ray.js";import{intersectScreen as _e}from"../../support/geometryUtils/sphere.js";import{Intersector as ve}from"../../webgl-engine/lib/Intersector.js";import{terrainId as ye}from"../../webgl-engine/lib/verticalOffsetUtils.js";import be from"../../webgl/RenderCamera.js";const xe=30,Se=[1,3e8],Ce=8,we=[200,1508e5],Te=5,Ee=50,De=5,Oe=10,ke=90,D=1e-6,Ae={exclude:new Set([ye])};function je(e,t,n){return n[0]=t[0]/(e.fullWidth/e.pixelRatio),n[1]=t[1]/(e.fullHeight/e.pixelRatio),n}function Me(e){for(;e>Math.PI;)e-=2*Math.PI;for(;e<-Math.PI;)e+=2*Math.PI;return e}function O(e,n,a){let o=r(he.get(),a[3],ce(a));o==null||i(o,t)||(f(J,e.eye,n),g(J,J,o),e.eye=_(J,J,n),f(J,e.center,n),g(J,J,o),e.center=_(J,J,n),e.up=g(J,e.up,o))}function Ne(e,t,n,r){return w(e,ge(t,n,Q),r)}function Pe(e,t,n,r){return w(e,E(t,n,Q),r)}function Fe(e,t,n,r){let i=T.get(),a=1-n;f(i,t,e.eye);let o=u(i),s=o*(1-a);a>=0&&s<r&&(s=r,a=-(s-o)/o),Math.abs(o-s)<D||(y(i,i,a),e.eye=_(J,e.eye,i),e.center=te(J,e.center,t,a))}function Ie(e,t,n){t.getScreenCenter(Le),_e(e,t,Le,J)&&(t.center=J);let r=t.distance,i=r*n;if(Math.abs(r-i)<D)return;let a=y(T.get(),t.viewForward,i);t.eye=f(J,t.center,a)}const Le=oe();function Re(e,t){ne(t,0,0,0);for(let n of e)_(t,t,n);y(t,t,1/e.length)}function ze(e,t,n,r){return Math.sin(e/u(t))*(n+r.radius)}function Be(e,t,n,r){return ze(Math.PI/2,t,n,r)+(e-Math.PI/2)}const k={Elevation:3e4,Angle:x(16)},A=x(80);function Ve(e,t,n,r,i,a){let o=e.sceneIntersectionHelper,s=new ve(e.state.isGlobal);s.options.selectionMode=!1,s.options.store=0,s.options.hud=!1,s.options.normalRequired=!0;let c=null,d=b(),f=new me,p=!0,m=!0,{eye:h}=t;o.intersectIntersectorScreen(n,s,a);let g=s.results.min;return g.getIntersectionPoint(d)&&!l(h,d)&&at(h,d,r)?(c=re(g.normal),f.radius=u(d)):(m=!1,f.radius=!t.aboveGround||i===0?u(t.eye)-t.relativeElevation:Math.max(u(t.center),.9*r),i===1?We(f,t,n,d):p=_e(f,t,n,d)),{sphere:f,scenePickPoint:p?d:null,hasGeometryIntersection:m,intersectorType:g.intersector,normal:c}}function He(e,t,n,r){let i=e.relativeElevation;if(i>k.Elevation&&r===`global`)return 1;E(e,t,$);let a=Math.sign(i),o=n.worldUpAtPosition(e.eye,J);return-a*d(o,$.direction)<Math.sin(k.Angle)*u($.direction)?0:1}function Ue(e,t,n){f(j,n,t),e.eye=f(J,e.eye,j),e.center=f(J,e.center,j)}const j=b();function We(e,t,n,r){let i=E(t,n,Q);return i!=null&&(e.closestPointOnSilhouette(i,M),e.intersectRay(i,r)?m(M,i.origin)<m(r,i.origin)?(h(r,M),!1):!0:(f(N,t.eye,t.center),p(N,N),pe(N,-d(p(N,N),M),Ge),w(Ge,i,r),!1))}const M=b(),N=b(),Ge=fe();function Ke(t,n,r,i,a,o){let s=0;if(v(Z,t,n),f(Y,t,n),u(t)<=a||!i.aboveGround){v(r,Y,i.eye);let c=d(t,n)/(u(t)*u(n));if(c<.9999)s=S(c);else{let e=u(v(b(),t,n))/(u(t)*u(n));s=ae(e)}let l=Math.cos(ie(e.normalize(x(o)),0,A));s=-s-Math.max(0,u(n)-a)/(l*a)}else f(qe,i.eye,i.center),v(r,Y,qe),s=-u(Y)/a;return p(r,r),y(r,r,u(Z)),s}const qe=b();function P(t,n,r,i){let a,o,s=Math.cos(ie(e.normalize(x(i)),0,A));return a=n>r?-(n-r)/(s*r):n<-r?Math.PI-(n+r)/(s*r):S(n/r),o=t>r?-(t-r)/(s*r):t<-r?Math.PI-(t+r)/(s*r):S(t/r),(o-a)*r}function Je(e,t,n,r,i,a,o,c,l,u){let f=P(e[2],t[2],a.radius,c),m=l?P(e[0],t[0],a.radius,180):t[0]-e[0],h=Math.sin(o)*m-Math.cos(o)*f,g=Math.cos(o)*m+Math.sin(o)*f;p(J,i);let _=l?h/Math.sqrt(Math.abs(a.radius**2-d(n,J)**2)):h/a.radius,ee=g/Math.sqrt(Math.abs(a.radius**2-d(n,r)**2));s(u,_,ee)}function Ye(e,t,n,r,i,a,o,s,c,l){v(Z,e,t),C(a.up,a.eye,B,V,H),C([0,0,1],a.eye,R,z,ot),h(n,z),h(r,R),p(n,n),y(n,n,u(Z)),de(e,p(V,V),p(H,H),p(B,B),st),de(t,V,H,B,ct),Je(st,ct,e,R,z,o,s,c,l,i)}function Xe(e,t,n,i,o,s,c){r(W,o,i),r(G,c,s),a(K,W,G),f(t,e,n),g(t,t,K),_(t,t,n)}function Ze(e,t,n,i,o,s){r(W,i,n),r(G,s,o),a(K,W,G),f(J,e.eye,t),g(J,J,K),e.eye=_(J,J,t),f(J,e.center,t),g(J,J,K),e.center=_(J,J,t),f(J,e.up,t),g(J,J,K),e.up=_(J,J,t)}const F={Pole:.95,Angle:x(18),Tilt:45,TiltHysteresisMargin:1e-7};let I=!1;function L(e,t,n,r,i,a){let o=Math.abs(r)>Math.PI-F.Angle||Math.abs(r)<F.Angle,s=(Math.abs(e[2])<n*F.Pole||Math.abs(t)>n)&&a;return o&&s?!I&&i<F.Tilt-F.TiltHysteresisMargin?I=!0:I&&i>F.Tilt+F.TiltHysteresisMargin&&(I=!1):I=!1,I}function Qe(e,t,n,r,i,a){if(a)le(n,r,lt),O(t,e.center,lt);else{let a=Ke(n,r,ut,t,e.radius,i);O(t,e.center,ue(ut,a))}}function $e(e,t,n,r,i,a,o){let s=o?20:1;h(q,r),X.copyFrom(t);let c,l;for(let r=0;r<s&&m(n,q)>1e-12&&(c=m(n,q),Ye(n,q,z,R,U,X,e,i,a,o),Ze(X,e.center,R,U[1],z,U[0]),Xe(q,q,e.center,R,U[1],z,U[0]),l=m(n,q),l<c||r===0);r++)t.copyFrom(X)}function et(t,n,r,i,a,o,s){L(r,d(n.up,r),t.radius,-e.normalize(x(a)),o,n.aboveGround)?$e(t,n,r,i,-e.normalize(x(a)),o,s):Qe(t,n,r,i,o,s)}function tt(e,t,n,r,i,a){let{eye:s}=e;C([0,0,1],s,R,z,ot);let c=t.translation[0]*n.pan,l=i.mode===`zoom`?0:t.translation[1]*n.pan,f=Math.max(Math.sqrt(Math.abs(1-d(e.center,R)**2/u(e.center)**2)),.5),p=(Math.sin(a)*l+Math.cos(a)*c)/f,m=-Math.cos(a)*l+Math.sin(a)*c;switch(o(r.pan.matrix,r.pan.matrix,p,R),r.pan.enabled=!0,i.mode){case`pan`:o(r.pan.matrix,r.pan.matrix,m,z),r.pan.enabled=!0;break;case`zoom`:r.zoom=-t.translation[1]*n.zoom}}function nt(e,t,n,r,i){let{eye:a,viewRight:s}=e,c=v(T.get(),s,a),l=t.translation[0]*n.pan;switch(l!==0&&(o(r.pan.matrix,r.pan.matrix,-l,c),r.pan.enabled=!0),i.mode){case`pan`:{let e=t.translation[1]*n.pan;e!==0&&(o(r.pan.matrix,r.pan.matrix,e,s),r.pan.enabled=!0);break}case`zoom`:r.zoom=-t.translation[1]*n.zoom}}function rt(t,n,r,i,a,o,s,c,l){L(t.center,d(t.up,t.center),u(t.center),-e.normalize(x(o)),s,n.aboveGround)?tt(n,r,i,c,l,-e.normalize(x(a))):nt(n,r,i,c,l)}function it(e,t,n=1/0){let r=Math.abs(d(e,t));return Math.min(n,1/r)}function at(e,t,n){let r=ee(e,t),i=u(e);return r<Math.max(i,n)}const R=b(),z=b(),ot=b(),B=b(),V=b(),H=b(),st=b(),ct=b(),U=c(),lt=se(),W=n(),G=n(),K=n(),q=b(),J=b(),Y=b();let X=new be;const Z=b(),ut=b();function dt(){X=new be}const Q={origin:b(),direction:b()},$={origin:b(),direction:b()};export{A as TiltThresholdPanningSpeed,k as VerticalPanTresholds,Ue as applyPanPlanar,Qe as applyPanSphericalDirectRotation,$e as applyPanSphericalPreserveHeading,O as applyRotation,Ze as applyRotationWithTwoAxes,Ie as applyZoomOnSphere,Fe as applyZoomToPoint,Re as centroid,dt as cleanupNavigationUtils,D as distanceComparisonTolerance,Ae as excludeTerrain,it as getTiltScaleFactor,He as inferNavigationMode,Ne as intersectPlaneFromScreenPoint,Pe as intersectPlaneFromScreenPointAtEye,at as isHitOnSamePlanetSide,P as lengthFromPoints,Te as maxPanDistanceModifier,De as maxRotatePivotDistanceModifier,xe as maxZoomPivotDistanceModifier,Ce as maxZoomStepDistanceModifier,Ee as minPinchAndPanCameraHeight,Oe as minRotatePivotDistance,je as normalizeCoordinate,Me as normalizeRotationDelta,Be as offSurfaceTiltToEyeTiltGlobal,ze as onSurfaceTiltToEyeTiltGlobal,rt as panMotionToRotationMatrix,et as panToPosition,Ve as pickPointAndInitSphere,F as preservingHeadingThresholds,Xe as rotatePointAroundTwoAxes,Ke as rotationAngleAndAxisDirectRotation,Ye as rotationAnglesAndAxesHeadingPreserving,Je as rotationAnglesHeadingPreserving,ke as searchAreaSize,L as shouldPreserveHeading,We as sphereOrPlanePointFromScreenPoint,Se as zoomPivotDistanceClamp,we as zoomStepDistanceClamp};
2
+ import{cyclicalPI as e}from"../../../../core/Cyclical.js";import{IDENTITY as t,create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromRotation as r,exactEquals as i,multiply as a,rotate as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{set as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{exactEquals as l,length as u,dot as d,subtract as f,normalize as p,squaredDistance as m,copy as h,transformMat4 as g,add as _,distance as ee,cross as v,scale as y,lerp as te,set as ne}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as re,create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{deg2rad as x,clamp as ie,acosClamped as S,asinClamped as ae}from"../../../../core/mathUtils.js";import{createScreenPointArray as oe}from"../../../../core/screenUtils.js";import{create as se,axis as ce,fromPoints as le,wrapAxisAngle as ue}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as C,vectorCoordinates as de}from"../../../../geometry/support/coordinateSystem.js";import{create as fe,fromNormalAndOffset as pe,intersectRay as w}from"../../../../geometry/support/plane.js";import{Sphere as me}from"../../../../geometry/support/sphere.js";import{sm4d as he,sv3d as T}from"../../../../geometry/support/vectorStacks.js";import{fromScreenAtEye as E,fromScreen as ge}from"../../support/geometryUtils/ray.js";import{intersectScreen as _e}from"../../support/geometryUtils/sphere.js";import{Intersector as ve}from"../../webgl-engine/lib/Intersector.js";import{terrainId as ye}from"../../webgl-engine/lib/verticalOffsetUtils.js";import be from"../../webgl/RenderCamera.js";const xe=30,Se=[1,3e8],Ce=8,we=[200,1508e5],Te=5,Ee=50,De=5,Oe=10,ke=90,D=1e-6,Ae={exclude:new Set([ye])};function je(e,t,n){return n[0]=t[0]/(e.fullWidth/e.pixelRatio),n[1]=t[1]/(e.fullHeight/e.pixelRatio),n}function Me(e){for(;e>Math.PI;)e-=2*Math.PI;for(;e<-Math.PI;)e+=2*Math.PI;return e}function O(e,n,a){let o=r(he.get(),a[3],ce(a));o==null||i(o,t)||(f(J,e.eye,n),g(J,J,o),e.eye=_(J,J,n),f(J,e.center,n),g(J,J,o),e.center=_(J,J,n),e.up=g(J,e.up,o))}function Ne(e,t,n,r){return w(e,ge(t,n,Q),r)}function Pe(e,t,n,r){return w(e,E(t,n,Q),r)}function Fe(e,t,n,r){let i=T.get(),a=1-n;f(i,t,e.eye);let o=u(i),s=o*(1-a);a>=0&&s<r&&(s=r,a=-(s-o)/o),Math.abs(o-s)<D||(y(i,i,a),e.eye=_(J,e.eye,i),e.center=te(J,e.center,t,a))}function Ie(e,t,n){t.getScreenCenter(Le),_e(e,t,Le,J)&&(t.center=J);let r=t.distance,i=r*n;if(Math.abs(r-i)<D)return;let a=y(T.get(),t.viewForward,i);t.eye=f(J,t.center,a)}const Le=oe();function Re(e,t){ne(t,0,0,0);for(let n of e)_(t,t,n);y(t,t,1/e.length)}function ze(e,t,n,r){return Math.sin(e/u(t))*(n+r.radius)}function Be(e,t,n,r){return ze(Math.PI/2,t,n,r)+(e-Math.PI/2)}const k={Elevation:3e4,Angle:x(16)},A=x(80);function Ve(e,t,n,r,i,a){let o=e.sceneIntersectionHelper,s=new ve(e.state.isGlobal);s.options.selectionMode=!1,s.options.store=0,s.options.hud=!1,s.options.normalRequired=!0;let c=null,d=b(),f=new me,p=!0,m=!0,{eye:h}=t;o.intersectIntersectorScreen(n,s,a);let g=s.results.min;return g.getIntersectionPoint(d)&&!l(h,d)&&at(h,d,r)?(c=re(g.normal),f.radius=u(d)):(m=!1,f.radius=!t.aboveGround||i===0?u(t.eye)-t.relativeElevation:Math.max(u(t.center),.9*r),i===1?We(f,t,n,d):p=_e(f,t,n,d)),{sphere:f,scenePickPoint:p?d:null,hasGeometryIntersection:m,intersectorType:g.intersector,normal:c}}function He(e,t,n,r){let i=e.relativeElevation;if(i>k.Elevation&&r)return 1;E(e,t,$);let a=Math.sign(i),o=n.worldUpAtPosition(e.eye,J);return-a*d(o,$.direction)<Math.sin(k.Angle)*u($.direction)?0:1}function Ue(e,t,n){f(j,n,t),e.eye=f(J,e.eye,j),e.center=f(J,e.center,j)}const j=b();function We(e,t,n,r){let i=E(t,n,Q);return i!=null&&(e.closestPointOnSilhouette(i,M),e.intersectRay(i,r)?m(M,i.origin)<m(r,i.origin)?(h(r,M),!1):!0:(f(N,t.eye,t.center),p(N,N),pe(N,-d(p(N,N),M),Ge),w(Ge,i,r),!1))}const M=b(),N=b(),Ge=fe();function Ke(t,n,r,i,a,o){let s=0;if(v(Z,t,n),f(Y,t,n),u(t)<=a||!i.aboveGround){v(r,Y,i.eye);let c=d(t,n)/(u(t)*u(n));if(c<.9999)s=S(c);else{let e=u(v(b(),t,n))/(u(t)*u(n));s=ae(e)}let l=Math.cos(ie(e.normalize(x(o)),0,A));s=-s-Math.max(0,u(n)-a)/(l*a)}else f(qe,i.eye,i.center),v(r,Y,qe),s=-u(Y)/a;return p(r,r),y(r,r,u(Z)),s}const qe=b();function P(t,n,r,i){let a,o,s=Math.cos(ie(e.normalize(x(i)),0,A));return a=n>r?-(n-r)/(s*r):n<-r?Math.PI-(n+r)/(s*r):S(n/r),o=t>r?-(t-r)/(s*r):t<-r?Math.PI-(t+r)/(s*r):S(t/r),(o-a)*r}function Je(e,t,n,r,i,a,o,c,l,u){let f=P(e[2],t[2],a.radius,c),m=l?P(e[0],t[0],a.radius,180):t[0]-e[0],h=Math.sin(o)*m-Math.cos(o)*f,g=Math.cos(o)*m+Math.sin(o)*f;p(J,i);let _=l?h/Math.sqrt(Math.abs(a.radius**2-d(n,J)**2)):h/a.radius,ee=g/Math.sqrt(Math.abs(a.radius**2-d(n,r)**2));s(u,_,ee)}function Ye(e,t,n,r,i,a,o,s,c,l){v(Z,e,t),C(a.up,a.eye,B,V,H),C([0,0,1],a.eye,R,z,ot),h(n,z),h(r,R),p(n,n),y(n,n,u(Z)),de(e,p(V,V),p(H,H),p(B,B),st),de(t,V,H,B,ct),Je(st,ct,e,R,z,o,s,c,l,i)}function Xe(e,t,n,i,o,s,c){r(W,o,i),r(G,c,s),a(K,W,G),f(t,e,n),g(t,t,K),_(t,t,n)}function Ze(e,t,n,i,o,s){r(W,i,n),r(G,s,o),a(K,W,G),f(J,e.eye,t),g(J,J,K),e.eye=_(J,J,t),f(J,e.center,t),g(J,J,K),e.center=_(J,J,t),f(J,e.up,t),g(J,J,K),e.up=_(J,J,t)}const F={Pole:.95,Angle:x(18),Tilt:45,TiltHysteresisMargin:1e-7};let I=!1;function L(e,t,n,r,i,a){let o=Math.abs(r)>Math.PI-F.Angle||Math.abs(r)<F.Angle,s=(Math.abs(e[2])<n*F.Pole||Math.abs(t)>n)&&a;return o&&s?!I&&i<F.Tilt-F.TiltHysteresisMargin?I=!0:I&&i>F.Tilt+F.TiltHysteresisMargin&&(I=!1):I=!1,I}function Qe(e,t,n,r,i,a){if(a)le(n,r,lt),O(t,e.center,lt);else{let a=Ke(n,r,ut,t,e.radius,i);O(t,e.center,ue(ut,a))}}function $e(e,t,n,r,i,a,o){let s=o?20:1;h(q,r),X.copyFrom(t);let c,l;for(let r=0;r<s&&m(n,q)>1e-12&&(c=m(n,q),Ye(n,q,z,R,U,X,e,i,a,o),Ze(X,e.center,R,U[1],z,U[0]),Xe(q,q,e.center,R,U[1],z,U[0]),l=m(n,q),l<c||r===0);r++)t.copyFrom(X)}function et(t,n,r,i,a,o,s){L(r,d(n.up,r),t.radius,-e.normalize(x(a)),o,n.aboveGround)?$e(t,n,r,i,-e.normalize(x(a)),o,s):Qe(t,n,r,i,o,s)}function tt(e,t,n,r,i,a){let{eye:s}=e;C([0,0,1],s,R,z,ot);let c=t.translation[0]*n.pan,l=i.mode===`zoom`?0:t.translation[1]*n.pan,f=Math.max(Math.sqrt(Math.abs(1-d(e.center,R)**2/u(e.center)**2)),.5),p=(Math.sin(a)*l+Math.cos(a)*c)/f,m=-Math.cos(a)*l+Math.sin(a)*c;switch(o(r.pan.matrix,r.pan.matrix,p,R),r.pan.enabled=!0,i.mode){case`pan`:o(r.pan.matrix,r.pan.matrix,m,z),r.pan.enabled=!0;break;case`zoom`:r.zoom=-t.translation[1]*n.zoom}}function nt(e,t,n,r,i){let{eye:a,viewRight:s}=e,c=v(T.get(),s,a),l=t.translation[0]*n.pan;switch(l!==0&&(o(r.pan.matrix,r.pan.matrix,-l,c),r.pan.enabled=!0),i.mode){case`pan`:{let e=t.translation[1]*n.pan;e!==0&&(o(r.pan.matrix,r.pan.matrix,e,s),r.pan.enabled=!0);break}case`zoom`:r.zoom=-t.translation[1]*n.zoom}}function rt(t,n,r,i,a,o,s,c,l){L(t.center,d(t.up,t.center),u(t.center),-e.normalize(x(o)),s,n.aboveGround)?tt(n,r,i,c,l,-e.normalize(x(a))):nt(n,r,i,c,l)}function it(e,t,n=1/0){let r=Math.abs(d(e,t));return Math.min(n,1/r)}function at(e,t,n){let r=ee(e,t),i=u(e);return r<Math.max(i,n)}const R=b(),z=b(),ot=b(),B=b(),V=b(),H=b(),st=b(),ct=b(),U=c(),lt=se(),W=n(),G=n(),K=n(),q=b(),J=b(),Y=b();let X=new be;const Z=b(),ut=b();function dt(){X=new be}const Q={origin:b(),direction:b()},$={origin:b(),direction:b()};export{A as TiltThresholdPanningSpeed,k as VerticalPanTresholds,Ue as applyPanPlanar,Qe as applyPanSphericalDirectRotation,$e as applyPanSphericalPreserveHeading,O as applyRotation,Ze as applyRotationWithTwoAxes,Ie as applyZoomOnSphere,Fe as applyZoomToPoint,Re as centroid,dt as cleanupNavigationUtils,D as distanceComparisonTolerance,Ae as excludeTerrain,it as getTiltScaleFactor,He as inferNavigationMode,Ne as intersectPlaneFromScreenPoint,Pe as intersectPlaneFromScreenPointAtEye,at as isHitOnSamePlanetSide,P as lengthFromPoints,Te as maxPanDistanceModifier,De as maxRotatePivotDistanceModifier,xe as maxZoomPivotDistanceModifier,Ce as maxZoomStepDistanceModifier,Ee as minPinchAndPanCameraHeight,Oe as minRotatePivotDistance,je as normalizeCoordinate,Me as normalizeRotationDelta,Be as offSurfaceTiltToEyeTiltGlobal,ze as onSurfaceTiltToEyeTiltGlobal,rt as panMotionToRotationMatrix,et as panToPosition,Ve as pickPointAndInitSphere,F as preservingHeadingThresholds,Xe as rotatePointAroundTwoAxes,Ke as rotationAngleAndAxisDirectRotation,Ye as rotationAnglesAndAxesHeadingPreserving,Je as rotationAnglesHeadingPreserving,ke as searchAreaSize,L as shouldPreserveHeading,We as sphereOrPlanePointFromScreenPoint,Se as zoomPivotDistanceClamp,we as zoomStepDistanceClamp};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import has from"../../../core/has.js";import{Milliseconds as e}from"../../../core/time.js";function t(e){return a[e]}function n(){return has(`esri-iPhone`)?`low`:`medium`}const r={reset(){a=o()}},i={IPhone12Pro:120,GalaxyS20:200,FullHD:240,SurfacePro7:300,FullHDRetina:430};let a=o();function o(){return{low:s(`low`),medium:s(`medium`),high:s(`high`)}}function s(t){let n=!!has(`esri-mobile`),r=!has(`ios`),a=e=>e[t];return{graphics3D:{maxTotalNumberOfFeatures:a({low:5e4,medium:15e4,high:3e5}),maxNumberOfDrawCalls:a({low:8e3,medium:17e3,high:17e3}),maxTotalNumberOfVertices:a({low:255e4,medium:625e4,high:125e5}),polygonLodFactor:a({low:.5,medium:n?.8:1,high:n?1.2:2}),polylineLodFactor:a({low:1,medium:n?1.2:1.5,high:n?1.2:2}),snapshotAvailable:a({low:!1,medium:r,high:r}),skipHighSymbolLods:a({low:!0,medium:!1,high:!1})},heatmap:{pixelRatio:a({low:.125,medium:.25,high:.5})},sceneService:{objectLoDFactor:a({low:.2,medium:1,high:1}),pointLoDFactor:a({low:1,medium:1,high:1}),meshLoDFactor:a({low:.6,medium:1,high:1}),pointCloudLoDFactor:a({low:.5,medium:1,high:1})},gaussianSplat:{minimumPixelRadius:a({low:2,medium:1,high:.5}),minimumOpacity:a({low:0,medium:1,high:2}),maximumNumberOfGaussians:a({low:1e6,medium:n?1e6:3e6,high:6e6})},flow:{maxTotalNumberOfStreamlines:a({low:5e3,medium:2e4,high:2e4}),maxTracingResolution:a({low:1024,medium:2048,high:2048}),transitionEnabled:a({low:!1,medium:!0,high:!0})},tiledSurface:{lodBias:a({low:-1,medium:0,high:0}),angledSplitBias:a({low:.5,medium:1,high:1}),vtlContentZoom:a({low:.75,medium:1.5,high:1.5}),elevationLevelDelta:a({low:3,medium:3,high:2}),reduceTileLevelDifferences:a({low:!0,medium:!0,high:!0})},fadeDuration:e(a({low:0,medium:400,high:400})),physicallyBasedRenderingEnabled:a({low:!1,medium:!0,high:!0}),maxTexturePixels:a({low:n?1024**2:2048**2,medium:n?2048**2:4096**2,high:n?4096**2:1/0}),memoryLimit:a({low:200+i.IPhone12Pro,medium:n?600+i.GalaxyS20:750+i.FullHD,high:n?900+i.SurfacePro7:1500+i.FullHDRetina})*1048576,additionalCacheMemory:a({low:0,medium:n?-100:150,high:n?-150:0})*1048576,frameRate:a({low:0,medium:0,high:0}),maximumPixelRatio:a({low:1,medium:1,high:n?1:1/0})}}export{r as QualityProfileTest,n as getDefaultQualityProfileName,t as getQualityProfileSettings};
2
+ import has from"../../../core/has.js";import{Milliseconds as e}from"../../../core/time.js";function t(e){return a[e]}function n(){return has(`esri-iPhone`)?`low`:`medium`}const r={reset(){a=o()}},i={IPhone12Pro:120,GalaxyS20:200,FullHD:240,SurfacePro7:300,FullHDRetina:430};let a=o();function o(){return{low:s(`low`),medium:s(`medium`),high:s(`high`)}}function s(t){let n=!!has(`esri-mobile`),r=!has(`ios`),a=e=>e[t];return{graphics3D:{maxTotalNumberOfFeatures:a({low:5e4,medium:15e4,high:3e5}),maxNumberOfDrawCalls:a({low:8e3,medium:17e3,high:17e3}),maxTotalNumberOfVertices:a({low:255e4,medium:625e4,high:125e5}),polygonLodFactor:a({low:.5,medium:n?.8:1,high:n?1.2:2}),polylineLodFactor:a({low:1,medium:n?1.2:1.5,high:n?1.2:2}),snapshotAvailable:a({low:!1,medium:r,high:r}),skipHighSymbolLods:a({low:!0,medium:!1,high:!1})},heatmap:{pixelRatio:a({low:.125,medium:.25,high:.5})},sceneService:{objectLoDFactor:a({low:.2,medium:1,high:1}),meshLoDFactor:a({low:.6,medium:1,high:1}),pointCloudLoDFactor:a({low:.5,medium:1,high:1})},gaussianSplat:{minimumPixelRadius:a({low:2,medium:1,high:.5}),minimumOpacity:a({low:0,medium:1,high:2}),maximumNumberOfGaussians:a({low:1e6,medium:n?1e6:3e6,high:6e6})},flow:{maxTotalNumberOfStreamlines:a({low:5e3,medium:2e4,high:2e4}),maxTracingResolution:a({low:1024,medium:2048,high:2048}),transitionEnabled:a({low:!1,medium:!0,high:!0})},tiledSurface:{lodBias:a({low:-1,medium:0,high:0}),angledSplitBias:a({low:.5,medium:1,high:1}),elevationLevelDelta:a({low:3,medium:3,high:2})},fadeDuration:e(a({low:0,medium:400,high:400})),physicallyBasedRenderingEnabled:a({low:!1,medium:!0,high:!0}),maxTexturePixels:a({low:n?1024**2:2048**2,medium:n?2048**2:4096**2,high:n?4096**2:1/0}),memoryLimit:a({low:200+i.IPhone12Pro,medium:n?600+i.GalaxyS20:750+i.FullHD,high:n?900+i.SurfacePro7:1500+i.FullHDRetina})*1048576,additionalCacheMemory:a({low:0,medium:n?-100:150,high:n?-150:0})*1048576,maximumPixelRatio:a({low:1,medium:1,high:n?1:1/0})}}export{r as QualityProfileTest,n as getDefaultQualityProfileName,t as getQualityProfileSettings};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{property as n,subclass as r}from"../../../core/accessorSupport/decorators.js";import{Milliseconds as i}from"../../../core/time.js";let a=class extends t{constructor(e={}){super(e),this.minTotalNumberOfFeatures=2e3,this.maxTotalNumberOfFeatures=5e4,this.maxNumberOfDrawCalls=17e3,this.maxTotalNumberOfVertices=17e5,this.snapshotAvailable=!0,this.polygonLodFactor=1,this.polylineLodFactor=1,this.skipHighSymbolLods=!1}};e([n()],a.prototype,`maxTotalNumberOfFeatures`,void 0),e([n()],a.prototype,`maxNumberOfDrawCalls`,void 0),e([n()],a.prototype,`maxTotalNumberOfVertices`,void 0),e([n()],a.prototype,`snapshotAvailable`,void 0),e([n()],a.prototype,`polygonLodFactor`,void 0),e([n()],a.prototype,`polylineLodFactor`,void 0),e([n()],a.prototype,`skipHighSymbolLods`,void 0),a=e([r(`esri.views.3d.support.QualitySettings.Graphics3DSettings`)],a);let o=class extends t{constructor(e={}){super(e),this.objectLoDFactor=1,this.pointLoDFactor=1,this.meshLoDFactor=1,this.pointCloudLoDFactor=1}};e([n()],o.prototype,`objectLoDFactor`,void 0),e([n()],o.prototype,`pointLoDFactor`,void 0),e([n()],o.prototype,`meshLoDFactor`,void 0),e([n()],o.prototype,`pointCloudLoDFactor`,void 0),o=e([r(`esri.views.3d.support.QualitySettings.SceneServiceSettings`)],o);let s=class extends t{constructor(e={}){super(e),this.lodBias=0,this.angledSplitBias=1,this.vtlContentZoom=1,this.elevationLevelDelta=3,this.reduceTileLevelDifferences=!0}};e([n()],s.prototype,`lodBias`,void 0),e([n()],s.prototype,`angledSplitBias`,void 0),e([n()],s.prototype,`vtlContentZoom`,void 0),e([n()],s.prototype,`elevationLevelDelta`,void 0),e([n()],s.prototype,`reduceTileLevelDifferences`,void 0),s=e([r(`esri.views.3d.support.QualitySettings.TiledSurfaceSettings`)],s);let c=class extends t{constructor(e={}){super(e),this.minimumPixelRadius=1,this.minimumOpacity=1,this.maximumNumberOfGaussians=2e6}};e([n()],c.prototype,`minimumPixelRadius`,void 0),e([n()],c.prototype,`minimumOpacity`,void 0),e([n()],c.prototype,`maximumNumberOfGaussians`,void 0),c=e([r(`esri.views.3d.support.QualitySettings.GaussianSplatSettings`)],c);let l=class extends t{constructor(e={}){super(e),this.pixelRatio=1}};e([n()],l.prototype,`pixelRatio`,void 0),l=e([r(`esri.views.3d.support.QualitySettings.HeatmapSettings`)],l);let u=class extends t{constructor(){super(...arguments),this.maxTotalNumberOfStreamlines=1e5,this.maxTracingResolution=2048,this.transitionEnabled=!0}};e([n()],u.prototype,`maxTotalNumberOfStreamlines`,void 0),e([n()],u.prototype,`maxTracingResolution`,void 0),e([n()],u.prototype,`transitionEnabled`,void 0),u=e([r(`esri.views.3d.support.QualitySettings.FlowSettings`)],u);let d=class extends t{constructor(e){super(e),this.graphics3D=new a,this.sceneService=new o,this.tiledSurface=new s,this.gaussianSplat=new c,this.heatmap=new l,this.flow=new u,this.fadeDuration=i(400),this.physicallyBasedRenderingEnabled=!1,this.maxTexturePixels=1/0,this.memoryLimit=786432e3,this.additionalCacheMemory=0,this.frameRate=0,this.maximumPixelRatio=1/0}};e([n({type:a})],d.prototype,`graphics3D`,void 0),e([n({type:o})],d.prototype,`sceneService`,void 0),e([n({type:s})],d.prototype,`tiledSurface`,void 0),e([n({type:c})],d.prototype,`gaussianSplat`,void 0),e([n({type:l})],d.prototype,`heatmap`,void 0),e([n({type:u})],d.prototype,`flow`,void 0),e([n()],d.prototype,`fadeDuration`,void 0),e([n()],d.prototype,`physicallyBasedRenderingEnabled`,void 0),e([n()],d.prototype,`maxTexturePixels`,void 0),e([n()],d.prototype,`memoryLimit`,void 0),e([n()],d.prototype,`additionalCacheMemory`,void 0),e([n()],d.prototype,`frameRate`,void 0),e([n()],d.prototype,`maximumPixelRatio`,void 0),d=e([r(`esri.views.3d.support.QualitySettings`)],d);const f=d;export{f as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{property as n,subclass as r}from"../../../core/accessorSupport/decorators.js";import{Milliseconds as i}from"../../../core/time.js";let a=class extends t{constructor(e={}){super(e),this.minTotalNumberOfFeatures=2e3,this.maxTotalNumberOfFeatures=5e4,this.maxNumberOfDrawCalls=17e3,this.maxTotalNumberOfVertices=17e5,this.snapshotAvailable=!0,this.polygonLodFactor=1,this.polylineLodFactor=1,this.skipHighSymbolLods=!1}};e([n()],a.prototype,`maxTotalNumberOfFeatures`,void 0),e([n()],a.prototype,`maxNumberOfDrawCalls`,void 0),e([n()],a.prototype,`maxTotalNumberOfVertices`,void 0),e([n()],a.prototype,`snapshotAvailable`,void 0),e([n()],a.prototype,`polygonLodFactor`,void 0),e([n()],a.prototype,`polylineLodFactor`,void 0),e([n()],a.prototype,`skipHighSymbolLods`,void 0),a=e([r(`esri.views.3d.support.QualitySettings.Graphics3DSettings`)],a);let o=class extends t{constructor(e={}){super(e),this.objectLoDFactor=1,this.meshLoDFactor=1,this.pointCloudLoDFactor=1}};e([n()],o.prototype,`objectLoDFactor`,void 0),e([n()],o.prototype,`meshLoDFactor`,void 0),e([n()],o.prototype,`pointCloudLoDFactor`,void 0),o=e([r(`esri.views.3d.support.QualitySettings.SceneServiceSettings`)],o);let s=class extends t{constructor(e={}){super(e),this.lodBias=0,this.angledSplitBias=1,this.elevationLevelDelta=3}};e([n()],s.prototype,`lodBias`,void 0),e([n()],s.prototype,`angledSplitBias`,void 0),e([n()],s.prototype,`elevationLevelDelta`,void 0),s=e([r(`esri.views.3d.support.QualitySettings.TiledSurfaceSettings`)],s);let c=class extends t{constructor(e={}){super(e),this.minimumPixelRadius=1,this.minimumOpacity=1,this.maximumNumberOfGaussians=2e6}};e([n()],c.prototype,`minimumPixelRadius`,void 0),e([n()],c.prototype,`minimumOpacity`,void 0),e([n()],c.prototype,`maximumNumberOfGaussians`,void 0),c=e([r(`esri.views.3d.support.QualitySettings.GaussianSplatSettings`)],c);let l=class extends t{constructor(e={}){super(e),this.pixelRatio=1}};e([n()],l.prototype,`pixelRatio`,void 0),l=e([r(`esri.views.3d.support.QualitySettings.HeatmapSettings`)],l);let u=class extends t{constructor(){super(...arguments),this.maxTotalNumberOfStreamlines=1e5,this.maxTracingResolution=2048,this.transitionEnabled=!0}};e([n()],u.prototype,`maxTotalNumberOfStreamlines`,void 0),e([n()],u.prototype,`maxTracingResolution`,void 0),e([n()],u.prototype,`transitionEnabled`,void 0),u=e([r(`esri.views.3d.support.QualitySettings.FlowSettings`)],u);let d=class extends t{constructor(e){super(e),this.graphics3D=new a,this.sceneService=new o,this.tiledSurface=new s,this.gaussianSplat=new c,this.heatmap=new l,this.flow=new u,this.fadeDuration=i(400),this.physicallyBasedRenderingEnabled=!1,this.maxTexturePixels=1/0,this.memoryLimit=786432e3,this.additionalCacheMemory=0,this.maximumPixelRatio=1/0}};e([n({type:a})],d.prototype,`graphics3D`,void 0),e([n({type:o})],d.prototype,`sceneService`,void 0),e([n({type:s})],d.prototype,`tiledSurface`,void 0),e([n({type:c})],d.prototype,`gaussianSplat`,void 0),e([n({type:l})],d.prototype,`heatmap`,void 0),e([n({type:u})],d.prototype,`flow`,void 0),e([n()],d.prototype,`fadeDuration`,void 0),e([n()],d.prototype,`physicallyBasedRenderingEnabled`,void 0),e([n()],d.prototype,`maxTexturePixels`,void 0),e([n()],d.prototype,`memoryLimit`,void 0),e([n()],d.prototype,`additionalCacheMemory`,void 0),e([n()],d.prototype,`maximumPixelRatio`,void 0),d=e([r(`esri.views.3d.support.QualitySettings`)],d);const f=d;export{f as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{removeMaybe as e}from"../../../../core/maybe.js";import{TaskPriority as t}from"../../../support/Scheduler.js";import{memoryEstimators as n}from"../../layers/graphics/defaultSymbolComplexity.js";import{BufferObject3D as r}from"../../webgl-engine/lib/BufferObject3D.js";import{WebGLLayer as i}from"../../webgl-engine/lib/WebGLLayer.js";import{streamlinGeometryBatchSize as a}from"./constants.js";import{StreamlineResources3D as o}from"./StreamlineResources3D.js";class s extends o{constructor(e,t,r,i,a){let o=n.LINE_ROUND.bytesPerFeature;super(e,t,r,i,o),this._view=a,this._objects3D=[],this._engineLayer=null,this._frameTask=null}get attached(){return this._engineLayer!=null}async attach(){let{geometries:e}=this;e!=null&&(this.detach(),this._frameTask=this._view.resourceController.scheduler.registerTask(t.FLOW_GENERATOR),await this._frameTask.scheduleGenerator(t=>this._addGeometryToLayer(e,t)))}detach(){this.attached&&(this._engineLayer?.removeMany(this._objects3D),this._objects3D.forEach(e=>e.dispose()),this._engineLayer?.commit(),this._objects3D=[],this._engineLayer=null,this._frameTask=e(this._frameTask))}async*_addGeometryToLayer(e,t){let{stage:n}=this._view,o=new i(n,{pickable:!1,updatePolicy:1});for(let n=0;n<e.length;n+=a){let i=new r({geometries:e.slice(n,n+a),castShadow:!1});o.add(i),this._objects3D.push(i),o.commit(),t.madeProgress(),t.done&&(t=yield)}this._engineLayer=o}}export{s as StreamlineResources3DShape};
2
+ import{removeMaybe as e}from"../../../../core/maybe.js";import{TaskPriority as t}from"../../../support/Scheduler.js";import{memoryEstimators as n}from"../../layers/graphics/defaultSymbolComplexity.js";import{BufferObject3D as r}from"../../webgl-engine/lib/BufferObject3D.js";import{WebGLLayer as i}from"../../webgl-engine/lib/WebGLLayer.js";import{streamlinGeometryBatchSize as a}from"./constants.js";import{StreamlineResources3D as o}from"./StreamlineResources3D.js";class s extends o{constructor(e,t,r,i,a){let o=n.LINE_ROUND.bytesPerFeature;super(e,t,r,i,o),this._view=a,this._objects3D=[],this._engineLayer=null,this._frameTask=null}get attached(){return this._engineLayer!=null}async attach(){let{geometries:e}=this;e!=null&&(this.detach(),this._frameTask=this._view.resourceController.scheduler.registerTask(t.FLOW_GENERATOR),await this._frameTask.scheduleGenerator(t=>this._addGeometryToLayer(e,t)))}detach(){this.attached&&(this._engineLayer?.removeMany(this._objects3D),this._objects3D.forEach(e=>e.dispose()),this._engineLayer?.commit(),this._objects3D=[],this._engineLayer=null,this._frameTask=e(this._frameTask))}async*_addGeometryToLayer(e,t){let{stage:n}=this._view,o=new i(n,{pickable:!1,updatePolicy:1});for(let n=0;n<e.length;n+=a){let i=new r({geometries:e.slice(n,n+a)});o.add(i),this._objects3D.push(i),o.commit(),t.madeProgress(),t.done&&(t=yield)}this._engineLayer=o}}export{s as StreamlineResources3DShape};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{parameter as t}from"../webgl-engine/core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TileBlendTechniqueConfiguration as n}from"./TileBlendTechniqueConfiguration.js";class r extends n{constructor(){super(...arguments),this.background=0}}e([t({count:2})],r.prototype,`background`,void 0);export{r as BlendLayersTechniqueConfiguration};
2
+ import{__decorate as e}from"tslib";import{parameter as t}from"../webgl-engine/core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TileBlendTechniqueConfiguration as n}from"./TileBlendTechniqueConfiguration.js";class r extends n{constructor(){super(...arguments),this.background=0}get needsUV(){return this.background!==1||this.output!==2}}e([t({count:2})],r.prototype,`background`,void 0);export{r as BlendLayersTechniqueConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{property as n,subclass as r}from"../../../core/accessorSupport/decorators.js";import{cyclicalPI as i}from"../../../core/Cyclical.js";import"../../../core/has.js";import{subtract as a}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{add as o,subtract as s,copy as c,distance as l}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transformMat4 as d,scale as f,add as p}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as m,create as h}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{clamp as g,deg2rad as ee}from"../../../core/mathUtils.js";import{destroyMaybe as _}from"../../../core/maybe.js";import{watch as v,sync as y,on as b}from"../../../core/reactiveUtils.js";import{getReferenceEllipsoid as x}from"../../../geometry/ellipsoidUtils.js";import{projectVectorToVector as S}from"../../../geometry/projection/projectVectorToVector.js";import{create as C,width as w,center as T,copy as E,intersection as D,contains as te,offset as O}from"../../../geometry/support/aaBoundingRect.js";import{createSpatialReferenceCyclical as k}from"../../../geometry/support/normalizeUtils.js";import{create as A,wrap as j}from"../../../geometry/support/ray.js";import{Sphere as M}from"../../../geometry/support/sphere.js";import{angleAroundAxis as N}from"../../../geometry/support/vector.js";import{y2lat as P}from"../../../geometry/support/webMercatorUtils.js";import{TaskPriority as F,noBudget as I}from"../../support/Scheduler.js";import{Yield as L}from"../../support/Yield.js";import{viewAngle as R}from"../state/utils/viewUtils.js";import{debugFlags as z}from"../support/debugFlags.js";import{DebugPoint as B}from"../support/debugUtils.js";import{getPlanarDistanceToGroundRatio as V}from"../support/planarDistanceToGroundRatio.js";import{Intersector as H}from"../webgl-engine/lib/Intersector.js";import{fromValues as U}from"../webgl-engine/lib/LocalOriginFactory.js";import{SortedRenderGeometryRenderer as W}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{applyTextureResizeModulo as G,ensureTextureSize as K}from"../webgl-engine/lib/textureUtils.js";import{removeLoadedShaderModules as ne}from"../webgl-engine/parts/renderUtils.js";import{OverlayRenderer as re}from"./OverlayRenderer.js";const q=1.3,ie=[[-.1,-2,3.9,2],[-.1,-3.9,3.9,.1],[-2,-3.9,2,.1],[-3.9,-3.9,.1,.1],[-3.9,-2,.1,2],[-3.9,-.1,.1,3.9],[-2,-.1,2,3.9],[-.1,-.1,3.9,3.9]];let J,Y=class extends t{constructor(e){super(e),this._renderSR=null,this._overlaySREqualsRenderSR=!0,this._drapeSources=new Set,this._drapeTargets=new Set,this._placementDirty=!1,this._contentUpdated=!1,this._drawTexturesDirty=!1,this._drawTexturesAnimateDirty=!1,this._latestOriginId=0,this.groundView=e.view.groundView}initialize(){let{view:e}=this;this.renderer=new re({parent:this}),e.stage.renderer.plugins.add(this.renderer);let t=()=>this.requestRender();this._groundIntersector=new H(e.state.isGlobal),this._groundIntersector.options.backfacesTerrain=!0,this._groundIntersector.options.invisibleTerrain=!0,this._groundIntersector.options.hud=!1,this.addHandles([v(()=>this.renderer.hasHighlights,t),this.renderer.events.on(`has-water`,()=>e.stage?.renderer.updateHasFlags()),this.renderer.events.on(`content-changed`,t),v(()=>e.state.camera.pixelRatio,t),v(()=>e.state.alignPixelEnabled,t),this.renderer.events.on(`textures-disposed`,()=>this.groundView.requestRender(1)),v(()=>[e.pointsOfInterest?.renderPointOfView,e.pointsOfInterest?.centerOnSurfaceFrequent?.location],()=>this.setPlacementDirty()),v(()=>[e.state?.pixelRatio,e.state?.contentPixelRatio],()=>this.setPlacementDirty(),y),b(()=>e.groundAndIMSurface,`elevation-change`,()=>this.setPlacementDirty()),e.on(`resize`,()=>this.setPlacementDirty()),e.resourceController.scheduler.registerTask(F.OVERLAY,this)]),e.stage.renderer.overlay=this}destroy(){this.view?.stage&&(this.view.stage.renderer.plugins.remove(this.renderer),this.view.stage.renderer.overlay=null,_(this.renderer)),J&&=(J.hide(),null),this.renderer=null}get spatialReference(){return this._spatialReference}set spatialReference(e){this._spatialReference=e,this.renderer.longitudeCyclical=null;let t=this.view.renderSpatialReference;e!=null&&t!=null?(this._renderSR=t,this._overlaySREqualsRenderSR=e.equals(this._renderSR),this._isSpherical&&(this.renderer.longitudeCyclical=k(e))):this.renderer.disposeOverlays()}get readyToRun(){return this._placementDirty&&(this._drapeSources.size>0||this.view.graphics.length>0||z.OVERLAY_DRAW_DEBUG_TEXTURE)&&!!this._spatialReference&&!(this.terrainSurface.enabled&&this.terrainSurface.freeze)&&this.groundView.ready}get _isSpherical(){return this.view.state.isGlobal}get mapUnitsToPlanarDistanceRatio(){return this._spatialReference!=null&&this._spatialReference.isGeographic&&this._isSpherical?x(this._spatialReference).metersPerDegree:1}getPlanarDistanceToGroundRatio(e){return this._spatialReference==null?1:V(this._spatialReference,this._isSpherical,e)}get _overlayStretch(){return q/this.view.resolutionScale}get longitudeCyclical(){return this.renderer.longitudeCyclical}get updating(){return this.readyToRun||!!this.renderer?.updating||this._contentUpdated}render(e){return this._contentUpdated=!1,this.renderer.time=e,this.renderer.processSyncDrapeSources(),this.renderer.precompileShaders(this.view.state)?this._drawOverlays():null}get hasOverlays(){return this.renderer.hasOverlays}registerDrapeSource(e,t){this._drapeSources.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources),this.renderer.registerDrapeSource(e,t),this._updateDrapeSourceExtent(e),this._setContentDirty(),this.notifyChange(`readyToRun`)}registerGeometryDrapeSource(e){let t=new W({stage:this.view.stage,drapeSource:e,rendererContext:this.renderer});return this.registerDrapeSource(e,t),t}_updateDrapeSourceExtent(e){this.renderer.overlays.length===2&&e.setDrapingExtent!=null&&this._spatialReference!=null&&e.setDrapingExtent(this.renderer.overlays,this._spatialReference)}unregisterDrapeSource(e){this._drapeSources.has(e)&&(this._drapeSources.delete(e),this.renderer.removeDrapeSourceRenderer(e),this.renderer.ensureDrapeSources(this._drapeSources),this._setContentDirty(),this.notifyChange(`readyToRun`))}registerDrapeTarget(e){this._drapeTargets.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources)}unregisterDrapeTarget(e){this._drapeTargets.delete(e),this.renderer.ensureDrapeTargets(this._drapeTargets)}_setContentDirty(){this.setPlacementDirty(),this.requestRender()}setPlacementDirty(){this._placementDirty=!0}runTask(e){return this.updateOverlays(e,this.view.state.contentCamera,1)}updateOverlays(e,t,n){if(!this._spatialReference||!this.view.pointsOfInterest?.centerOnSurfaceFrequent)return L;let r=this._computeOverlayHeight(t),i=this._computeOverlayExtents(t,r,Q,e);this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources),this.renderer.overlayStretch=Q.stretch;let a=this._updateOverlay(0,Q.inner,r,+Q.pixelRatioAdjustment,Q.mapUnitsPerPixel),o=w(Q.inner)/w(Q.outer),s=this._updateOverlay(1,Q.outer,r,o*Q.pixelRatioAdjustment,Q.mapUnitsPerPixel);if((a===1||s===1)&&(this._drapeSources.forEach(e=>this._updateDrapeSourceExtent(e)),this.groundView.updateOverlayParameters(),this.groundView.requestRender(n)),(a!==0||s!==0)&&this.requestRender(),this._placementDirty=!i,e.madeProgress(),this._placementDirty)return L}_computeOverlayHeight(e){let t=this.view.state.contentPixelRatio*this.view.resolutionScale,n=e.fullWidth/e.pixelRatio*t,r=e.fullHeight/e.pixelRatio*t,i=Math.ceil(Math.max(n,r)*1.5),{maxPreferredTexturePixels:a,maxTextureSize:o}=this.view.stage.renderView.renderingContext.parameters,s=o*.5;return G(K({width:i,height:i},{maxPreferredTexturePixels:a*2,maxTextureSize:s})[1],s)}get overlays(){return this.renderer.overlays}_updateOverlay(e,t,n,r,i){if(this.renderer.overlays.length===0)return 0;let a=this.renderer.overlays[e],o=a.mapUnitsPerPixel;if(a.mapUnitsPerPixel=i,a.pixelRatio=r,ae(t,a.extent)&&n===a.resolution)return o===i?0:2;a.setExtent(t),a.resolution=n;let s=T(a.extent);return a.renderLocalOrigin=U(s[0],s[1],0,`OV_${this._latestOriginId++}`),1}overlayPixelSizeInMapUnits(e,t){if(this.renderer.overlays.length===0)return t();let n=this.renderer.overlays[0],r=this.renderer.overlays[1],i=this._pointIsInExtent(e,n.extent)?n:r;return(i.extent[2]-i.extent[0])/i.resolution}reloadShaders(){ne(),this.requestRender(),this.runTask(I)}requestRender(e=1){this.renderer.hasOverlays?(e===1?(this._contentUpdated=!0,this._drawTexturesDirty=!0):this._drawTexturesAnimateDirty=!0,this.view.stage.renderView.requestRender(e)):this.setPlacementDirty()}_intersectGroundFromView(e,t,n,r,i,a=I){let s=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(e,le,t,n);if(s==null)return!1;let c=s.origin,l=o(Z,s.origin,s.direction);if(this._groundIntersector.reset(c,l,e),this._groundIntersector.intersect([]),!this.view.groundAndIMSurface.intersectBudgeted(this._groundIntersector,null,c,l,a))return L;let u=this._groundIntersector.results.min;return u.getIntersectionPoint(i)&&u.withinDistance(r)}_findHorizonBasedPointOfInterest(e,t,n=I){let r=.5,a=.55,o=this.view.renderCoordsHelper.getAltitude(e.eye),c=this.view.pointsOfInterest.centerOnSurfaceFrequent,l=1e-5,u=g(c.estimatedSurfaceAltitude,e.aboveGround?-1/0:o+l,e.aboveGround?o-l:1/0),f=e.aboveGround;if(this.view.viewingMode===`global`){let t=Z;$.radius=x(this.view.spatialReference).radius+u,$.closestPointOnSilhouette(j(e.eye,e.viewForward),t),s(t,t,e.eye);let n=i.normalize(N(e.viewForward,t,e.viewRight))/e.fovY+.5,o=n<=0||n>=1?.5:a;r=f?o*n:n+o*(1-n)}else{let t=Math.PI*.5-Math.acos(-e.viewForward[2]),n=m(0,Math.tan(t),1,0),i=d(n,n,e.projectionMatrix)[1],o=g(.5+.5*i,0,1);r=o===1||o===0?.5:f?o*a:1-(1-o)*a}return this._intersectGroundFromView(e,.5,r,c.distance,t,n)}_computeOverlayExtents(e,t,n,r=I){let{view:i}=this,o=i.pointsOfInterest.centerOnSurfaceFrequent.renderLocation,s=u(),d=this._findHorizonBasedPointOfInterest(e,s,r);d&&d!==L||c(s,o);let m=this._renderSR;z.OVERLAY_SHOW_CENTER?(J??=new B(i.graphics,`red`),J.show(s,m)):J?.hide();let h=Math.max(.1,l(e.eye,s)),g=R(i.renderCoordsHelper,o,e.eye),_=this._spatialReference;this._overlaySREqualsRenderSR||S(s,m,s,_);let v=this._isSpherical,y=this.groundView.groundExtent,b=!v&&_?.isGeographic,C=b&&_?1/x(_).metersPerDegree:1,T=i.state.contentPixelRatio,O=e.computeScreenPixelSizeAtDistance(h)/T*C;n.mapUnitsPerPixel=b?O:O/this.mapUnitsToPlanarDistanceRatio,n.stretch=this._overlayStretch;let k=t*O/2*n.stretch,A=!1,j=b?90:1/0;v&&y&&_&&(_.isWebMercator?(k/=Math.cos(P(s[1])),j=y[3]):(A=!0,k/=x(_).metersPerDegree,j=90),k>=j&&(k=j,s[1]=0,_.isWebMercator&&(s[0]=0)));let M=1;A&&(M=1/Math.max(.2,Math.cos(Math.abs(ee(s[1])))),k*M>180&&(M=180/k),n.mapUnitsPerPixel*=M);let N=Math.log(2)/12;k=Math.exp(Math.round(Math.log(k)/N)*N);let F=k*M,V=.5*t/(32*F),H=.5*t/(32*k);s[0]=Math.round(s[0]*V)/V,s[1]=Math.round(s[1]*H)/H;let U=n.inner;U[0]=s[0]-F,U[1]=s[1]-k,U[2]=s[0]+F,U[3]=s[1]+k,v&&this._shiftExtentToFitBounds(U,1/0,j);let W=n.outer;if(y&&6*F>w(y))E(W,y);else if(Math.PI/2-Math.abs(g-Math.PI/2)<=.25*Math.PI)W[0]=U[0]-F,W[1]=U[1]-k,W[2]=U[2]+F,W[3]=U[3]+k;else{S(e.eye,m,Z,_),a(X,s,Z);let t=-Math.atan2(X[1],X[0])+Math.PI*.125;t<0&&(t+=2*Math.PI);let n=Math.floor(t/(Math.PI*.25));f(X,ie[n],k*2),X[0]*=M,X[2]*=M,p(W,U,X)}if(v&&this.longitudeCyclical)W[0]=this.longitudeCyclical.clamp(W[0]),W[2]=this.longitudeCyclical.clamp(W[2]),W[1]=Math.max(W[1],-j),W[3]=Math.min(W[3],j);else{let e=D(U,y,se),t=D(W,y,ce);te(e,t)&&(W[2]=W[0],W[3]=W[1])}let G=Math.abs(U[2]-U[0])/t;return n.mapUnitsPerPixel=Math.max(n.mapUnitsPerPixel,G),n.pixelRatioAdjustment=n.mapUnitsPerPixel/G,d!==L}_drawOverlays(e=this.view.state){if(!this._drawTexturesDirty&&!this._drawTexturesAnimateDirty)return this.renderer;let t=!this._drawTexturesDirty&&this._drawTexturesAnimateDirty?0:1;this._drawTexturesDirty=this._drawTexturesAnimateDirty=!1;let n=this.renderer.computeValidity();return this.renderer.releaseRenderTargets(t),this.renderer.drawOverlays(e,t),n!==this.renderer.computeValidity()&&(this.groundView.updateOverlayParameters(),this.groundView.requestRender(1)),this.groundView.requestRender(t),t===1&&this.terrainSurface.requestUpdate(),this.renderer}_pointIsInExtent(e,t){if(this.longitudeCyclical)return this.longitudeCyclical.contains(t[0],t[2],e.x)&&e.y>=t[1]&&e.y<=t[3];let n=e.x,r=e.y;return n>t[0]&&n<t[2]&&r>t[1]&&r<t[3]}_shiftExtentToFitBounds(e,t,n){let r=0,i=0;e[0]<-t?r=e[0]+t:e[2]>t&&(r=t-e[2]),e[1]<-n?i=e[1]+n:e[3]>n&&(i=n-e[3]),O(e,r,i)}get test(){}};e([n()],Y.prototype,`_spatialReference`,void 0),e([n({readOnly:!0})],Y.prototype,`readyToRun`,null),e([n()],Y.prototype,`_placementDirty`,void 0),e([n()],Y.prototype,`_contentUpdated`,void 0),e([n()],Y.prototype,`_isSpherical`,null),e([n()],Y.prototype,`mapUnitsToPlanarDistanceRatio`,null),e([n()],Y.prototype,`renderer`,void 0),e([n({constructOnly:!0})],Y.prototype,`view`,void 0),e([n({constructOnly:!0})],Y.prototype,`groundView`,void 0),e([n({constructOnly:!0})],Y.prototype,`terrainSurface`,void 0),e([n()],Y.prototype,`updating`,null),Y=e([r(`esri.views.3d.terrain.OverlayManager`)],Y);function ae(e,t){let n=z.ENABLE_OPTIMIZATIONS?1e-5*Math.max(e[2]-e[0],e[3]-e[1],t[2]-t[0],t[3]-t[1]):0;return Math.abs(t[0]-e[0])<=n&&Math.abs(t[1]-e[1])<=n&&Math.abs(t[2]-e[2])<=n&&Math.abs(t[3]-e[3])<=n}class oe{constructor(){this.inner=C(),this.outer=C(),this.mapUnitsPerPixel=0,this.pixelRatioAdjustment=1,this.stretch=q}}const X=h(),Z=u(),Q=new oe,se=C(),ce=C(),le=A(),$=new M;export{Y as OverlayManager};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{property as n,subclass as r}from"../../../core/accessorSupport/decorators.js";import{cyclicalPI as i}from"../../../core/Cyclical.js";import"../../../core/has.js";import{subtract as a}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{add as o,subtract as s,copy as c,distance as l}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transformMat4 as d,scale as f,add as p}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as m,create as h}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{clamp as g,deg2rad as ee}from"../../../core/mathUtils.js";import{destroyMaybe as _}from"../../../core/maybe.js";import{watch as v,sync as y,on as b}from"../../../core/reactiveUtils.js";import{getReferenceEllipsoid as x}from"../../../geometry/ellipsoidUtils.js";import{projectVectorToVector as S}from"../../../geometry/projection/projectVectorToVector.js";import{create as C,width as w,center as T,copy as E,intersection as D,contains as te,offset as O}from"../../../geometry/support/aaBoundingRect.js";import{createSpatialReferenceCyclical as k}from"../../../geometry/support/normalizeUtils.js";import{create as A,wrap as j}from"../../../geometry/support/ray.js";import{Sphere as M}from"../../../geometry/support/sphere.js";import{angleAroundAxis as N}from"../../../geometry/support/vector.js";import{y2lat as P}from"../../../geometry/support/webMercatorUtils.js";import{TaskPriority as F,noBudget as I}from"../../support/Scheduler.js";import{Yield as L}from"../../support/Yield.js";import{viewAngle as R}from"../state/utils/viewUtils.js";import{debugFlags as z}from"../support/debugFlags.js";import{DebugPoint as B}from"../support/debugUtils.js";import{getPlanarDistanceToGroundRatio as V}from"../support/planarDistanceToGroundRatio.js";import{Intersector as H}from"../webgl-engine/lib/Intersector.js";import{fromValues as U}from"../webgl-engine/lib/LocalOriginFactory.js";import{SortedRenderGeometryRenderer as W}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{applyTextureResizeModulo as G,ensureTextureSize as K}from"../webgl-engine/lib/textureUtils.js";import{removeLoadedShaderModules as ne}from"../webgl-engine/parts/renderUtils.js";import{OverlayRenderer as re}from"./OverlayRenderer.js";const q=1.3,ie=[[-.1,-2,3.9,2],[-.1,-3.9,3.9,.1],[-2,-3.9,2,.1],[-3.9,-3.9,.1,.1],[-3.9,-2,.1,2],[-3.9,-.1,.1,3.9],[-2,-.1,2,3.9],[-.1,-.1,3.9,3.9]];let J,Y=class extends t{constructor(e){super(e),this._renderSR=null,this._overlaySREqualsRenderSR=!0,this._drapeSources=new Set,this._drapeTargets=new Set,this._placementDirty=!1,this._contentUpdated=!1,this._drawTexturesDirty=!1,this._drawTexturesAnimateDirty=!1,this._latestOriginId=0,this.groundView=e.view.groundView}initialize(){let{view:e}=this;this.renderer=new re({parent:this}),e.stage.renderer.plugins.add(this.renderer);let t=()=>this.requestRender();this._groundIntersector=new H(e.state.isGlobal),this._groundIntersector.options.backfacesTerrain=!0,this._groundIntersector.options.invisibleTerrain=!0,this._groundIntersector.options.hud=!1,this.addHandles([v(()=>this.renderer.hasHighlights,t),this.renderer.events.on(`has-water`,()=>e.stage?.renderer.updateHasFlags()),this.renderer.events.on(`content-changed`,t),v(()=>e.state.camera.pixelRatio,t),v(()=>e.state.alignPixelEnabled,t),this.renderer.events.on(`textures-disposed`,()=>this.groundView.requestRender(1)),v(()=>[e.pointsOfInterest?.renderPointOfView,e.pointsOfInterest?.centerOnSurfaceFrequent?.location],()=>this.setPlacementDirty()),v(()=>[e.state?.pixelRatio,e.state?.contentPixelRatio],()=>this.setPlacementDirty(),y),b(()=>e.groundAndIMSurface,`elevation-change`,()=>this.setPlacementDirty()),e.on(`resize`,()=>this.setPlacementDirty()),e.resourceController.scheduler.registerTask(F.OVERLAY,this)]),e.stage.renderer.overlay=this}destroy(){this.view?.stage&&(this.view.stage.renderer.plugins.remove(this.renderer),this.view.stage.renderer.overlay=null,_(this.renderer)),J&&=(J.hide(),null),this.renderer=null}get spatialReference(){return this._spatialReference}set spatialReference(e){this._spatialReference=e,this.renderer.longitudeCyclical=null;let t=this.view.renderSpatialReference;e!=null&&t!=null?(this._renderSR=t,this._overlaySREqualsRenderSR=e.equals(this._renderSR),this._isSpherical&&(this.renderer.longitudeCyclical=k(e))):this.renderer.disposeOverlays()}get readyToRun(){return this._placementDirty&&(this._drapeSources.size>0||this.view.graphics.length>0||z.OVERLAY_DRAW_DEBUG_TEXTURE)&&!!this._spatialReference&&!(this.terrainSurface.enabled&&this.terrainSurface.freeze)&&this.groundView.ready}get _isSpherical(){return this.view.state.isGlobal}get mapUnitsToPlanarDistanceRatio(){return this._spatialReference!=null&&this._spatialReference.isGeographic&&this._isSpherical?x(this._spatialReference).metersPerDegree:1}getPlanarDistanceToGroundRatio(e){return this._spatialReference==null?1:V(this._spatialReference,this._isSpherical,e)}get _overlayStretch(){return q/this.view.resolutionScale}get longitudeCyclical(){return this.renderer.longitudeCyclical}get updating(){return this.readyToRun||!!this.renderer?.updating||this._contentUpdated}render(e){return this._contentUpdated=!1,this.renderer.time=e,this.renderer.processSyncDrapeSources(),this.renderer.precompileShaders(this.view.state)?this._drawOverlays():null}get hasOverlays(){return this.renderer.hasOverlays}registerDrapeSource(e,t){this._drapeSources.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources),this.renderer.registerDrapeSource(e,t),this._updateDrapeSourceExtent(e),this._setContentDirty(),this.notifyChange(`readyToRun`)}registerGeometryDrapeSource(e){let t=new W({stage:this.view.stage,drapeSource:e,rendererContext:this.renderer});return this.registerDrapeSource(e,t),t}_updateDrapeSourceExtent(e){this.renderer.overlays.length===2&&e.setDrapingExtent!=null&&this._spatialReference!=null&&e.setDrapingExtent(this.renderer.overlays,this._spatialReference)}unregisterDrapeSource(e){this._drapeSources.has(e)&&(this._drapeSources.delete(e),this.renderer.removeDrapeSourceRenderer(e),this.renderer.ensureDrapeSources(this._drapeSources),this._setContentDirty(),this.notifyChange(`readyToRun`))}registerDrapeTarget(e){this._drapeTargets.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources)}unregisterDrapeTarget(e){this._drapeTargets.delete(e),this.renderer.ensureDrapeTargets(this._drapeTargets)}_setContentDirty(){this.setPlacementDirty(),this.requestRender()}setPlacementDirty(){this._placementDirty=!0}runTask(e){return this.updateOverlays(e,this.view.state.contentCamera,1)}updateOverlays(e,t,n){if(!this._spatialReference||!this.view.pointsOfInterest?.centerOnSurfaceFrequent)return L;let r=this._computeOverlayHeight(t),i=this._computeOverlayExtents(t,r,Q,e);this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources),this.renderer.overlayStretch=Q.stretch;let a=this._updateOverlay(0,Q.inner,r,+Q.pixelRatioAdjustment,Q.mapUnitsPerPixel),o=w(Q.inner)/w(Q.outer),s=this._updateOverlay(1,Q.outer,r,o*Q.pixelRatioAdjustment,Q.mapUnitsPerPixel);if((a===1||s===1)&&(this._drapeSources.forEach(e=>this._updateDrapeSourceExtent(e)),this.groundView.updateOverlayParameters(),this.groundView.requestRender(n)),(a!==0||s!==0)&&this.requestRender(),this._placementDirty=!i,e.madeProgress(),this._placementDirty)return L}_computeOverlayHeight(e){let t=this.view.state.contentPixelRatio*this.view.resolutionScale,n=e.fullWidth/e.pixelRatio*t,r=e.fullHeight/e.pixelRatio*t,i=Math.ceil(Math.max(n,r)*1.5),{maxPreferredTexturePixels:a,maxTextureSize:o}=this.view.stage.renderView.renderingContext.parameters,s=o*.5;return G(K({width:i,height:i},{maxPreferredTexturePixels:a*2,maxTextureSize:s})[1],s)}get overlays(){return this.renderer.overlays}_updateOverlay(e,t,n,r,i){if(this.renderer.overlays.length===0)return 0;let a=this.renderer.overlays[e],o=a.mapUnitsPerPixel;if(a.mapUnitsPerPixel=i,a.pixelRatio=r,ae(t,a.extent)&&n===a.resolution)return o===i?0:2;a.setExtent(t),a.resolution=n;let s=T(a.extent);return a.renderLocalOrigin=U(s[0],s[1],0,`OV_${this._latestOriginId++}`),1}overlayPixelSizeInMapUnits(e,t){if(this.renderer.overlays.length===0)return t();let n=this.renderer.overlays[0],r=this.renderer.overlays[1],i=this._pointIsInExtent(e,n.extent)?n:r;return(i.extent[2]-i.extent[0])/i.resolution}reloadShaders(){ne(),this.requestRender(),this.runTask(I)}requestRender(e=1){this.renderer.hasOverlays?(e===1?(this._contentUpdated=!0,this._drawTexturesDirty=!0):this._drawTexturesAnimateDirty=!0,this.view.stage.renderView.requestRender(e)):this.setPlacementDirty()}_intersectGroundFromView(e,t,n,r,i,a=I){let s=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(e,le,t,n);if(s==null)return!1;let c=s.origin,l=o(Z,s.origin,s.direction);if(this._groundIntersector.reset(c,l,e),this._groundIntersector.intersect([]),!this.view.groundAndIMSurface.intersectBudgeted(this._groundIntersector,null,c,l,a))return L;let u=this._groundIntersector.results.min;return u.getIntersectionPoint(i)&&u.withinDistance(r)}_findHorizonBasedPointOfInterest(e,t,n=I){let r=.5,a=.55,o=this.view.renderCoordsHelper.getAltitude(e.eye),c=this.view.pointsOfInterest.centerOnSurfaceFrequent,l=1e-5,u=g(c.estimatedSurfaceAltitude,e.aboveGround?-1/0:o+l,e.aboveGround?o-l:1/0),f=e.aboveGround;if(this.view.state.isGlobal){let t=Z;$.radius=x(this.view.spatialReference).radius+u,$.closestPointOnSilhouette(j(e.eye,e.viewForward),t),s(t,t,e.eye);let n=i.normalize(N(e.viewForward,t,e.viewRight))/e.fovY+.5,o=n<=0||n>=1?.5:a;r=f?o*n:n+o*(1-n)}else{let t=Math.PI*.5-Math.acos(-e.viewForward[2]),n=m(0,Math.tan(t),1,0),i=d(n,n,e.projectionMatrix)[1],o=g(.5+.5*i,0,1);r=o===1||o===0?.5:f?o*a:1-(1-o)*a}return this._intersectGroundFromView(e,.5,r,c.distance,t,n)}_computeOverlayExtents(e,t,n,r=I){let{view:i}=this,o=i.pointsOfInterest.centerOnSurfaceFrequent.renderLocation,s=u(),d=this._findHorizonBasedPointOfInterest(e,s,r);d&&d!==L||c(s,o);let m=this._renderSR;z.OVERLAY_SHOW_CENTER?(J??=new B(i.graphics,`red`),J.show(s,m)):J?.hide();let h=Math.max(.1,l(e.eye,s)),g=R(i.renderCoordsHelper,o,e.eye),_=this._spatialReference;this._overlaySREqualsRenderSR||S(s,m,s,_);let v=this._isSpherical,y=this.groundView.groundExtent,b=!v&&_?.isGeographic,C=b&&_?1/x(_).metersPerDegree:1,T=i.state.contentPixelRatio,O=e.computeScreenPixelSizeAtDistance(h)/T*C;n.mapUnitsPerPixel=b?O:O/this.mapUnitsToPlanarDistanceRatio,n.stretch=this._overlayStretch;let k=t*O/2*n.stretch,A=!1,j=b?90:1/0;v&&y&&_&&(_.isWebMercator?(k/=Math.cos(P(s[1])),j=y[3]):(A=!0,k/=x(_).metersPerDegree,j=90),k>=j&&(k=j,s[1]=0,_.isWebMercator&&(s[0]=0)));let M=1;A&&(M=1/Math.max(.2,Math.cos(Math.abs(ee(s[1])))),k*M>180&&(M=180/k),n.mapUnitsPerPixel*=M);let N=Math.log(2)/12;k=Math.exp(Math.round(Math.log(k)/N)*N);let F=k*M,V=.5*t/(32*F),H=.5*t/(32*k);s[0]=Math.round(s[0]*V)/V,s[1]=Math.round(s[1]*H)/H;let U=n.inner;U[0]=s[0]-F,U[1]=s[1]-k,U[2]=s[0]+F,U[3]=s[1]+k,v&&this._shiftExtentToFitBounds(U,1/0,j);let W=n.outer;if(y&&6*F>w(y))E(W,y);else if(Math.PI/2-Math.abs(g-Math.PI/2)<=.25*Math.PI)W[0]=U[0]-F,W[1]=U[1]-k,W[2]=U[2]+F,W[3]=U[3]+k;else{S(e.eye,m,Z,_),a(X,s,Z);let t=-Math.atan2(X[1],X[0])+Math.PI*.125;t<0&&(t+=2*Math.PI);let n=Math.floor(t/(Math.PI*.25));f(X,ie[n],k*2),X[0]*=M,X[2]*=M,p(W,U,X)}if(v&&this.longitudeCyclical)W[0]=this.longitudeCyclical.clamp(W[0]),W[2]=this.longitudeCyclical.clamp(W[2]),W[1]=Math.max(W[1],-j),W[3]=Math.min(W[3],j);else{let e=D(U,y,se),t=D(W,y,ce);te(e,t)&&(W[2]=W[0],W[3]=W[1])}let G=Math.abs(U[2]-U[0])/t;return n.mapUnitsPerPixel=Math.max(n.mapUnitsPerPixel,G),n.pixelRatioAdjustment=n.mapUnitsPerPixel/G,d!==L}_drawOverlays(e=this.view.state){if(!this._drawTexturesDirty&&!this._drawTexturesAnimateDirty)return this.renderer;let t=!this._drawTexturesDirty&&this._drawTexturesAnimateDirty?0:1;this._drawTexturesDirty=this._drawTexturesAnimateDirty=!1;let n=this.renderer.computeValidity();return this.renderer.releaseRenderTargets(t),this.renderer.drawOverlays(e,t),n!==this.renderer.computeValidity()&&(this.groundView.updateOverlayParameters(),this.groundView.requestRender(1)),this.groundView.requestRender(t),t===1&&this.terrainSurface.requestUpdate(),this.renderer}_pointIsInExtent(e,t){if(this.longitudeCyclical)return this.longitudeCyclical.contains(t[0],t[2],e.x)&&e.y>=t[1]&&e.y<=t[3];let n=e.x,r=e.y;return n>t[0]&&n<t[2]&&r>t[1]&&r<t[3]}_shiftExtentToFitBounds(e,t,n){let r=0,i=0;e[0]<-t?r=e[0]+t:e[2]>t&&(r=t-e[2]),e[1]<-n?i=e[1]+n:e[3]>n&&(i=n-e[3]),O(e,r,i)}get test(){}};e([n()],Y.prototype,`_spatialReference`,void 0),e([n({readOnly:!0})],Y.prototype,`readyToRun`,null),e([n()],Y.prototype,`_placementDirty`,void 0),e([n()],Y.prototype,`_contentUpdated`,void 0),e([n()],Y.prototype,`_isSpherical`,null),e([n()],Y.prototype,`mapUnitsToPlanarDistanceRatio`,null),e([n()],Y.prototype,`renderer`,void 0),e([n({constructOnly:!0})],Y.prototype,`view`,void 0),e([n({constructOnly:!0})],Y.prototype,`groundView`,void 0),e([n({constructOnly:!0})],Y.prototype,`terrainSurface`,void 0),e([n()],Y.prototype,`updating`,null),Y=e([r(`esri.views.3d.terrain.OverlayManager`)],Y);function ae(e,t){let n=z.ENABLE_OPTIMIZATIONS?1e-5*Math.max(e[2]-e[0],e[3]-e[1],t[2]-t[0],t[3]-t[1]):0;return Math.abs(t[0]-e[0])<=n&&Math.abs(t[1]-e[1])<=n&&Math.abs(t[2]-e[2])<=n&&Math.abs(t[3]-e[3])<=n}class oe{constructor(){this.inner=C(),this.outer=C(),this.mapUnitsPerPixel=0,this.pixelRatioAdjustment=1,this.stretch=q}}const X=h(),Z=u(),Q=new oe,se=C(),ce=C(),le=A(),$=new M;export{Y as OverlayManager};