@arcgis/core 4.32.0-next.20250105 → 4.32.0-next.20250107

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 (167) hide show
  1. package/AttributeBinsGraphic.js +5 -0
  2. package/README.md +1 -1
  3. package/applications/MapViewer/templateUtils.js +1 -1
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/000771f8eefcd6af0fda.js +1 -0
  6. package/assets/esri/core/workers/chunks/{9372d08ba8bf3342c48f.js → 011ccfd3acee83e7dc68.js} +1 -1
  7. package/assets/esri/core/workers/chunks/03af4a51043677ffcd0f.js +1 -0
  8. package/assets/esri/core/workers/chunks/{d07da8b63d83af179a2c.js → 05943caacfd28c383810.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{9f495ad57cdbfa90c5b8.js → 095aeb19e2207c8361ca.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{67c7bdc0c91a8f803ea8.js → 11cb25dfab7c8467897a.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{42aa697b4718b75b8cb2.js → 1abeba63bf623a746d5c.js} +2 -2
  12. package/assets/esri/core/workers/chunks/{42aa697b4718b75b8cb2.js.LICENSE.txt → 1abeba63bf623a746d5c.js.LICENSE.txt} +1 -1
  13. package/assets/esri/core/workers/chunks/{a57cead317eb2fc9afd8.js → 206194cf069ad4bcc3ad.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{0673d811c496143fc3d4.js → 2779cf112299b612a73a.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{bd37c9cc720587665fd3.js → 304b88ade7551130ad3a.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{aedff36d3fec86abb9fb.js → 30a84ddf0384bb52fdbe.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{367af4aa7e170c8553e3.js → 33a13544b9e5f4f20bce.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{dce55e7f76adecc055c3.js → 35d9457109d0631a1ca8.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{00c0fbe19c12691cf2c3.js → 368a36be515e60e35154.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{3a90163b76b0bc7f21d2.js → 3767defbd9c4b2e86886.js} +1 -1
  21. package/assets/esri/core/workers/chunks/3a3e9701e5d7b05f41b7.js +1 -0
  22. package/assets/esri/core/workers/chunks/{9a498f2c007f4d78d4dd.js → 4234539a9721104acafb.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{76fa5c7c87831ad25cde.js → 435c037ccba71f1e22d3.js} +1 -1
  24. package/assets/esri/core/workers/chunks/4387c47ae1b36d770f1d.js +1 -0
  25. package/assets/esri/core/workers/chunks/{88c68881cbdf4e911832.js → 4423aac6e44c3dbf184e.js} +1 -1
  26. package/assets/esri/core/workers/chunks/44ec3c77339b9765aaa4.js +1 -0
  27. package/assets/esri/core/workers/chunks/4b77c8d994498899631a.js +1 -0
  28. package/assets/esri/core/workers/chunks/62f8949a2d9076f3c1ea.js +2 -0
  29. package/assets/esri/core/workers/chunks/{c8cd6ba5600d8ff8db0b.js.LICENSE.txt → 62f8949a2d9076f3c1ea.js.LICENSE.txt} +1 -1
  30. package/assets/esri/core/workers/chunks/{664aa401887b59abd7b7.js → 6400f39a965900f66ce7.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{ddce265c46e4dfeb6c6d.js → 66d40a486aa3caa76106.js} +1 -1
  32. package/assets/esri/core/workers/chunks/6b3ee691646fbc39445c.js +1 -0
  33. package/assets/esri/core/workers/chunks/{533a7fd64b17bb294545.js → 6c58f792e2ae3736f662.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{370b230fd2d7703d0698.js → 6efb36bc2205203ff44d.js} +2 -2
  35. package/assets/esri/core/workers/chunks/{370b230fd2d7703d0698.js.LICENSE.txt → 6efb36bc2205203ff44d.js.LICENSE.txt} +1 -1
  36. package/assets/esri/core/workers/chunks/{a90611cdc86190799560.js → 7a43fda8984549a084b8.js} +1 -1
  37. package/assets/esri/core/workers/chunks/7b753da3b8a6d75abf20.js +1 -0
  38. package/assets/esri/core/workers/chunks/{9b020c47ca9ff5de9bb8.js → 7db356976198c4df76c1.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{4c56698cf1c669371865.js → 81816410cb1453938593.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{4ffaa2c5ab47a599ee9f.js → 82266ca8002554198208.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{f19d3c855f6e93544918.js → 8be0151a24c9af76a976.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{d9e396adf3354ee68339.js → 8f2b2d2dc9935b0d2039.js} +1 -1
  43. package/assets/esri/core/workers/chunks/907a91266e25cc4b9d42.js +1 -0
  44. package/assets/esri/core/workers/chunks/{a77aa86896bbb0e088df.js → 9857491cafa0278d9ae6.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{993db7646a8fc60179eb.js → 98da074899c82f0ded0b.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{3bb94da29dac3367ecc6.js → a1edd3f68e691ea39594.js} +1 -1
  47. package/assets/esri/core/workers/chunks/b07710e01494a6cda097.js +1 -0
  48. package/assets/esri/core/workers/chunks/{6a4305eb1e52b80ecb5c.js → b8ea84adff5619040494.js} +3 -3
  49. package/assets/esri/core/workers/chunks/{005727711cca0614c2ab.js → c05e0bd145a1c27d6857.js} +2 -2
  50. package/assets/esri/core/workers/chunks/{005727711cca0614c2ab.js.LICENSE.txt → c05e0bd145a1c27d6857.js.LICENSE.txt} +1 -1
  51. package/assets/esri/core/workers/chunks/c4374b6bc5c8dc6435c7.js +1 -0
  52. package/assets/esri/core/workers/chunks/c49707b577f3805f0142.js +1 -0
  53. package/assets/esri/core/workers/chunks/c5a928dcff7dc8a8cc9f.js +2 -0
  54. package/assets/esri/core/workers/chunks/{f4e3db71d1adae717535.js.LICENSE.txt → c5a928dcff7dc8a8cc9f.js.LICENSE.txt} +1 -1
  55. package/assets/esri/core/workers/chunks/cac79b64a7dade8bf486.js +2 -0
  56. package/assets/esri/core/workers/chunks/{bf0a0ca7fdac98f06a89.js.LICENSE.txt → cac79b64a7dade8bf486.js.LICENSE.txt} +1 -1
  57. package/assets/esri/core/workers/chunks/{2cccaf50134c65944e0a.js → d0876eed5249b029f9f0.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{178f606c8896ae5f39de.js → d1dbbab4a4c6072c182f.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{8e42fb623f56942958d8.js → d74b5dc60f02892d03e7.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{9ad7d095e614e7e8d7f5.js → dca0eb66116e4b5403fc.js} +1 -1
  61. package/assets/esri/core/workers/chunks/e27b8674a3492db51f2e.js +1 -0
  62. package/assets/esri/core/workers/chunks/{756c2f7c8659deab6c96.js → e2d987c39a6ef318511c.js} +2 -2
  63. package/assets/esri/core/workers/chunks/{756c2f7c8659deab6c96.js.LICENSE.txt → e2d987c39a6ef318511c.js.LICENSE.txt} +1 -1
  64. package/assets/esri/core/workers/chunks/{943428cf643e87ccfaad.js → e7e26b71f9eb28421936.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{f0adabf6d71a27f3183b.js → e80b0646a7e0e466ea65.js} +1 -1
  66. package/assets/esri/core/workers/chunks/e9c21907fabcedbd32ae.js +1 -0
  67. package/assets/esri/core/workers/chunks/{f9af0473878d960a02f2.js → f6d6bc43ac1c13892d44.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{3ed7c8138231de3a3b96.js → f8c960df1dabab120c70.js} +1 -1
  69. package/assets/esri/core/workers/chunks/{fdd8a5eb07466541f1f9.js → fd95b19f02d8dfef2baf.js} +1 -1
  70. package/assets/esri/widgets/support/GridControls/t9n/GridControls_ja.json +1 -1
  71. package/chunks/bufferOperator.js +1 -1
  72. package/chunks/geodesicBufferOperator.js +1 -1
  73. package/chunks/terrainUtilsPlanar.js +1 -1
  74. package/chunks/terrainUtilsSpherical.js +1 -1
  75. package/core/MemCachePool.js +1 -1
  76. package/geometry/operators/graphicBufferOperator.js +1 -1
  77. package/geometry/support/meshVertexSpaceUtils.js +1 -1
  78. package/interfaces.d.ts +101 -5
  79. package/layers/graphics/data/QueryEngineResult.js +1 -1
  80. package/layers/graphics/data/queryUtils.js +1 -1
  81. package/layers/graphics/data/queryValidationUtils.js +1 -1
  82. package/layers/graphics/sources/WFSSource.js +1 -1
  83. package/layers/support/capabilities.js +1 -1
  84. package/layers/support/featureLayerUtils.js +1 -1
  85. package/layers/support/serviceCapabilitiesUtils.js +1 -1
  86. package/package.json +2 -2
  87. package/renderers/RasterStretchRenderer.js +1 -1
  88. package/rest/query/executeAttributeBinsQuery.js +1 -1
  89. package/rest/support/AttributeBinsFeatureSet.js +5 -0
  90. package/rest/support/AttributeBinsQuery.js +1 -1
  91. package/rest/support/BinParametersAttributes.js +1 -1
  92. package/rest/support/BinParametersBase.js +1 -1
  93. package/rest/support/DateBinParameters.js +1 -1
  94. package/rest/support/FeatureSet.js +1 -1
  95. package/rest/support/NormalizationBinParametersMixin.js +1 -1
  96. package/rest/support/Query.js +1 -1
  97. package/rest/support/TopFeaturesQuery.js +1 -1
  98. package/smartMapping/renderers/dotDensity.js +1 -1
  99. package/smartMapping/renderers/pieChart.js +1 -1
  100. package/smartMapping/statistics/summaryStatisticsForAttributes.js +1 -1
  101. package/support/revision.js +1 -1
  102. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  103. package/symbols/cim/cimAnalyzer.js +1 -1
  104. package/views/2d/engine/Bitmap.js +1 -1
  105. package/views/2d/engine/BitmapContainer.js +1 -1
  106. package/views/2d/engine/BitmapTileContainer.js +1 -1
  107. package/views/2d/engine/webgl/shaderGraph/techniques/bitmap/BitmapTechnique.js +1 -1
  108. package/views/2d/input/MapViewInputManager.js +1 -1
  109. package/views/2d/input/handlers/DragPan.js +1 -1
  110. package/views/2d/input/handlers/DragRotate.js +1 -1
  111. package/views/2d/input/handlers/MouseWheelZoom.js +1 -1
  112. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  113. package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
  114. package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
  115. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  116. package/views/3d/input/SceneInputManager.js +1 -1
  117. package/views/3d/input/handlers/DragRotate.js +1 -1
  118. package/views/3d/input/handlers/DragZoom.js +1 -1
  119. package/views/3d/input/handlers/MouseWheelZoom.js +1 -1
  120. package/views/3d/input/handlers/PinchAndPanNavigation.js +1 -1
  121. package/views/3d/layerViewModuleImportUtils.js +1 -1
  122. package/views/3d/layers/GroupLayerView3D.js +5 -0
  123. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  124. package/views/3d/state/NearFarHeuristic.js +1 -1
  125. package/views/3d/terrain/OverlayManager.js +1 -1
  126. package/views/3d/terrain/TerrainRenderer.js +1 -1
  127. package/views/3d/terrain/TerrainSurface.js +1 -1
  128. package/views/3d/terrain/terrainUtilsPlanar.js +1 -1
  129. package/views/3d/terrain/terrainUtilsSpherical.js +1 -1
  130. package/views/3d/webgl-engine/collections/Component/SourceGeometry.js +1 -1
  131. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  132. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  133. package/views/3d/webgl-engine/shaders/OutputColorHighlightOID.glsl.js +4 -4
  134. package/views/View2D.js +1 -1
  135. package/views/draw/support/HighlightHelper.js +1 -1
  136. package/views/input/handlers/support.js +1 -1
  137. package/views/layers/DimensionLayerView.js +1 -1
  138. package/views/navigation/Navigation.js +1 -1
  139. package/views/navigation/NavigationActionMap.d.ts +4 -0
  140. package/views/navigation/NavigationActionMap.js +5 -0
  141. package/views/webgl/Texture.js +1 -1
  142. package/views/webgl/textureUtils.js +5 -0
  143. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  144. package/widgets/Editor/UpdateWorkflow.js +1 -1
  145. package/widgets/ElevationProfile/ElevationProfileLineView.js +1 -1
  146. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  147. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  148. package/widgets/FeatureTable/support/tableUtils.js +1 -1
  149. package/widgets/NavigationToggle/NavigationToggleViewModel.js +1 -1
  150. package/widgets/support/ColorPicker.js +1 -1
  151. package/assets/esri/core/workers/chunks/0a3bf1b74cce1b6b7ed8.js +0 -1
  152. package/assets/esri/core/workers/chunks/0d2411a941c42acb8cc2.js +0 -1
  153. package/assets/esri/core/workers/chunks/13720b1d97fb7d80e972.js +0 -1
  154. package/assets/esri/core/workers/chunks/14b87f3dd9942e6b19d0.js +0 -1
  155. package/assets/esri/core/workers/chunks/16530347bd78dc6c2fcd.js +0 -1
  156. package/assets/esri/core/workers/chunks/1a713cc601c6fcd97d2f.js +0 -1
  157. package/assets/esri/core/workers/chunks/3029354194f1a3030c5c.js +0 -1
  158. package/assets/esri/core/workers/chunks/318a39b56851e707edad.js +0 -1
  159. package/assets/esri/core/workers/chunks/53cd990b2c988518de6d.js +0 -1
  160. package/assets/esri/core/workers/chunks/5a0eb9dfe668cf290462.js +0 -1
  161. package/assets/esri/core/workers/chunks/9f0ebeae8a3ba360284b.js +0 -1
  162. package/assets/esri/core/workers/chunks/a3cef3837f4df9ab022e.js +0 -1
  163. package/assets/esri/core/workers/chunks/bf0a0ca7fdac98f06a89.js +0 -2
  164. package/assets/esri/core/workers/chunks/c8cd6ba5600d8ff8db0b.js +0 -2
  165. package/assets/esri/core/workers/chunks/ea250d66089967976c05.js +0 -1
  166. package/assets/esri/core/workers/chunks/ecf317c6c790b3cc83bf.js +0 -1
  167. package/assets/esri/core/workers/chunks/f4e3db71d1adae717535.js +0 -2
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{LengthDimensionMeasureType as e}from"../../../../analysis/dimensionUtils.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{toUnit as n}from"../../../../core/quantityUtils.js";import{adaptiveVerticalLengthUnit as r,adaptiveLengthUnit as i}from"../../../../core/unitUtils.js";import{fromRotation as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{c as s,b as d,a as l,I as c,f as u,y as m,t as p,e as S,n as g,k as f}from"../../../../chunks/vec32.js";import{create as v,ZEROS as R}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Axis as A}from"../../../../geometry/support/Axis.js";import{sv3d as P}from"../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as y}from"../../../../layers/graphics/dehydratedPoint.js";import{clonePoint as E}from"../../../../layers/graphics/hydratedFeatures.js";import{EuclideanSegment as j}from"../../interactive/visualElements/support/Segment.js";import{autoDistanceBetweenPoints2D as x}from"../../../support/automaticLengthMeasurementUtils.js";import{euclideanDirectDistance as h,euclideanDirectDistanceBetweenPoints as H}from"../../../support/euclideanLengthMeasurementUtils.js";import{geodesicDistanceThreshold as T}from"../../../support/geodesicMeasurementUtils.js";function C(t,o,a){if(null==t)return null;let s;if(o===e.Horizontal)s=x(t.elevationAlignedStartPoint,t.elevationAlignedEndPoint);else{const{startRenderSpace:e,endRenderSpace:n}=t.dimensionSegment;s=h(e,n,t.spatialReference)}if(null==s)return null;const d=o===e.Vertical?r(s.value,s.unit,a):i(s.value,s.unit,a);return n(s,d)}function U(e){const{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,dimension:{offset:r,measureType:i,orientation:o}}=e;return{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,offset:r,measureType:i,orientation:o}}function w({elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,offset:r,measureType:i,orientation:o},a,d=null){if(null==t||null==n)return null;const l=V(d?.directSegment??new j,{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n},a),c=d?.primaryOffsetAxis??v();B(c,{measureType:i,elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,directSegment:l,orientation:o,renderCoordsHelper:a});const u=d?.dimensionSegment??new j;return Y({elevationAlignedStartPoint:t,elevationAlignedEndPoint:n})&&i===e.Vertical?(s(u.startRenderSpace,l.startRenderSpace),s(u.endRenderSpace,l.endRenderSpace)):G(u,{offsetAxis:c,offset:r,relativeToSegment:l,renderCoordsHelper:a}),{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,directSegment:l,dimensionSegment:u,primaryOffsetAxis:c,spatialReference:a.spatialReference}}function z(e,t,n,r){return t===b.Start?(s(e.startRenderSpace,n.startRenderSpace),s(e.endRenderSpace,r.startRenderSpace)):(s(e.startRenderSpace,n.endRenderSpace),s(e.endRenderSpace,r.endRenderSpace)),e}var b;function k(e,t,n,r){d(e.startRenderSpace,t.startRenderSpace,n,r),d(e.endRenderSpace,t.endRenderSpace,n,r)}function M(t,n,r,i){switch(n){case e.Direct:return V(t,r,i);case e.Horizontal:case e.Vertical:{const{elevationAlignedStartPoint:o,elevationAlignedEndPoint:a,dimension:s,geometry:d}=r;let l;if(s.measureType===e.Direct){l=D(d,i)===o.z>a.z,n===e.Horizontal&&(l=!l)}else l=!I(d);const[c,u]=l?[o,a]:[a,o],m=E(u,O);return n===e.Horizontal?m.z=c.z:(m.x=c.x,m.y=c.y),i.toRenderCoords(c,t.startRenderSpace),i.toRenderCoords(m,t.endRenderSpace),t}}}function V(e,t,n){return n.toRenderCoords(t.elevationAlignedStartPoint,e.startRenderSpace),n.toRenderCoords(t.elevationAlignedEndPoint,e.endRenderSpace),e}function D(e,t){const n=e.directSegment.eval(.5,P.get()),r=t.worldUpAtPosition(n,P.get()),i=e.dimensionSegment.eval(.5,P.get()),o=l(P.get(),i,n);return!c(o,R)&&u(o,r)>0}function I(e){const{startRenderSpace:t,endRenderSpace:n}=e.dimensionSegment,{startRenderSpace:r,endRenderSpace:i}=e.directSegment;return m(r,t)<m(i,n)}!function(e){e[e.Start=0]="Start",e[e.End=1]="End"}(b||(b={}));const O=y(0,0,0,null);function L(e,t,n,r){const{directSegment:i}=n,o=B(P.get(),{measureType:t,directSegment:i,renderCoordsHelper:r}),a=G(q,{offsetAxis:o,offset:0,relativeToSegment:i,renderCoordsHelper:r}).eval(.5,P.get()),s=l(P.get(),e,a);return u(s,o)*r.unitInMeters}const q=new j;function B(n,r){const{measureType:i,elevationAlignedStartPoint:a,elevationAlignedEndPoint:d,directSegment:{startRenderSpace:m,endRenderSpace:f},directSegment:v,renderCoordsHelper:y}=r,E=v.eval(.5,P.get()),j=y.worldUpAtPosition(E,P.get()),x=y.worldBasisAtPosition(E,A.Y,P.get());switch(i){case e.Horizontal:s(n,j);break;case e.Vertical:u(m,j)<u(f,j)?l(n,f,m):l(n,m,f),S(n,n,j),S(n,n,j);break;case e.Direct:{const e=r.orientation??0;if(Y({elevationAlignedStartPoint:a,elevationAlignedEndPoint:d}))o(F,-t(e),j),p(n,x,F);else{const r=l(P.get(),f,m),i=S(P.get(),r,j);S(i,i,r),o(F,t(e),r),p(n,i,F)}break}}return c(n,R)?s(n,x):g(n,n)}const F=a();function Y({elevationAlignedStartPoint:e,elevationAlignedEndPoint:t}){return null!=e&&null!=t&&e.x===t.x&&e.y===t.y}function G(e,t){const{offsetAxis:n,offset:r,relativeToSegment:{startRenderSpace:i,endRenderSpace:o},relativeToSegment:a,renderCoordsHelper:s}=t,l=r/s.unitInMeters,[c,u]=J(i,o,n,l);return d(e.startRenderSpace,a.startRenderSpace,n,c),d(e.endRenderSpace,a.endRenderSpace,n,u),e}function J(e,t,n,r=0){const i=u(t,n),o=u(e,n),a=Math.abs(i-o)+r;return i>o?[a,r]:[r,a]}function K(e,t,n){const r=t.directSegment.eval(.5,P.get());return n.worldUpAtPosition(r,e)}function N(e,t){const{startRenderSpace:n,endRenderSpace:r}=t.directSegment;return l(e,r,n)}function Q(e,t,n={invert:!1}){const{startRenderSpace:r,endRenderSpace:i}=t.dimensionSegment;return n.invert?l(e,r,i):l(e,i,r)}function W(e,t){const n=e.directSegment.eval(.5,P.get());return t.headingAtPosition(n,e.primaryOffsetAxis)}function X(e,t){return f(Q(Z,e))/t**2}const Z=v();function $(e){const{elevationAlignedStartPoint:t,elevationAlignedEndPoint:r}=e;if(null==t||null==r)return!1;const i=H(t,r);return null!=i&&n(i,"meters").value>T}function _(e){return null!=e.geometry}export{b as OffsetSegmentLocation,Y as arePointsVerticallyAligned,U as computationToGeometryDependencies,w as computeGeometryFromDimension,C as computeLength,B as computeOffsetAxis,L as computeOffsetForPoint,M as computeSegmentForMeasureType,z as computeSpanningSegment,Q as dimensionStartToEnd,N as directStartToEnd,K as directUp,W as headingFromGeometry,$ as isGeodesicDimension,_ as isValidComputation,X as maxScreenLengthSquaredFromGeometry,k as offsetSegment};
5
+ import{LengthDimensionMeasureType as e}from"../../../../analysis/dimensionUtils.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{toUnit as n}from"../../../../core/quantityUtils.js";import{adaptiveVerticalLengthUnit as r,adaptiveLengthUnit as i}from"../../../../core/unitUtils.js";import{fromRotation as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{c as s,b as d,a as c,I as l,f as u,y as p,t as m,e as S,n as g,k as f}from"../../../../chunks/vec32.js";import{create as v,ZEROS as R}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Axis as A}from"../../../../geometry/support/Axis.js";import{sv3d as P}from"../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as y}from"../../../../layers/graphics/dehydratedPoint.js";import{clonePoint as h}from"../../../../layers/graphics/hydratedFeatures.js";import{EuclideanSegment as E}from"../../interactive/visualElements/support/Segment.js";import{autoDistanceBetweenPoints2D as j}from"../../../support/automaticLengthMeasurementUtils.js";import{euclideanDirectDistance as x,euclideanDirectDistanceBetweenPoints as w}from"../../../support/euclideanLengthMeasurementUtils.js";import{geodesicDistanceThreshold as U}from"../../../support/geodesicMeasurementUtils.js";class z{constructor(e,t,n,r,i,o){this.elevationAlignedStartPoint=e,this.elevationAlignedEndPoint=t,this.directSegment=n,this.dimensionSegment=r,this.primaryOffsetAxis=i,this.spatialReference=o}}function b(t,o,a){if(null==t)return null;let s;if(o===e.Horizontal)s=j(t.elevationAlignedStartPoint,t.elevationAlignedEndPoint);else{const{startRenderSpace:e,endRenderSpace:n}=t.dimensionSegment;s=x(e,n,t.spatialReference)}if(null==s)return null;const d=o===e.Vertical?r(s.value,s.unit,a):i(s.value,s.unit,a);return n(s,d)}function H(e){const{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,dimension:{offset:r,measureType:i,orientation:o}}=e;return{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,offset:r,measureType:i,orientation:o}}function C({elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,offset:r,measureType:i,orientation:o},a,d=null){if(null==t||null==n)return null;const c=D(d?.directSegment??new E,{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n},a),l=d?.primaryOffsetAxis??v();F(l,{measureType:i,elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,directSegment:c,orientation:o,renderCoordsHelper:a});const u=d?.dimensionSegment??new E;return G({elevationAlignedStartPoint:t,elevationAlignedEndPoint:n})&&i===e.Vertical?(s(u.startRenderSpace,c.startRenderSpace),s(u.endRenderSpace,c.endRenderSpace)):J(u,l,r,c,a),new z(t,n,c,u,l,a.spatialReference)}function T(e,t,n,r){return t===k.Start?(s(e.startRenderSpace,n.startRenderSpace),s(e.endRenderSpace,r.startRenderSpace)):(s(e.startRenderSpace,n.endRenderSpace),s(e.endRenderSpace,r.endRenderSpace)),e}var k;function M(e,t,n,r){d(e.startRenderSpace,t.startRenderSpace,n,r),d(e.endRenderSpace,t.endRenderSpace,n,r)}function V(t,n,r,i){switch(n){case e.Direct:return D(t,r,i);case e.Horizontal:case e.Vertical:{const{elevationAlignedStartPoint:o,elevationAlignedEndPoint:a,dimension:s,geometry:d}=r;let c;if(s.measureType===e.Direct){c=I(d,i)===o.z>a.z,n===e.Horizontal&&(c=!c)}else c=!O(d);const[l,u]=c?[o,a]:[a,o],p=h(u,L);return n===e.Horizontal?p.z=l.z:(p.x=l.x,p.y=l.y),i.toRenderCoords(l,t.startRenderSpace),i.toRenderCoords(p,t.endRenderSpace),t}}}function D(e,t,n){return n.toRenderCoords(t.elevationAlignedStartPoint,e.startRenderSpace),n.toRenderCoords(t.elevationAlignedEndPoint,e.endRenderSpace),e}function I(e,t){const n=e.directSegment.eval(.5,P.get()),r=t.worldUpAtPosition(n,P.get()),i=e.dimensionSegment.eval(.5,P.get()),o=c(P.get(),i,n);return!l(o,R)&&u(o,r)>0}function O(e){const{startRenderSpace:t,endRenderSpace:n}=e.dimensionSegment,{startRenderSpace:r,endRenderSpace:i}=e.directSegment;return p(r,t)<p(i,n)}!function(e){e[e.Start=0]="Start",e[e.End=1]="End"}(k||(k={}));const L=y(0,0,0,null);function q(e,t,n,r){const{directSegment:i}=n,o=F(P.get(),{measureType:t,directSegment:i,renderCoordsHelper:r}),a=J(B,o,0,i,r).eval(.5,P.get()),s=c(P.get(),e,a);return u(s,o)*r.unitInMeters}const B=new E;function F(n,r){const{measureType:i,elevationAlignedStartPoint:a,elevationAlignedEndPoint:d,directSegment:{startRenderSpace:p,endRenderSpace:f},directSegment:v,renderCoordsHelper:y}=r,h=v.eval(.5,P.get()),E=y.worldUpAtPosition(h,P.get()),j=y.worldBasisAtPosition(h,A.Y,P.get());switch(i){case e.Horizontal:s(n,E);break;case e.Vertical:u(p,E)<u(f,E)?c(n,f,p):c(n,p,f),S(n,n,E),S(n,n,E);break;case e.Direct:{const e=r.orientation??0;if(G({elevationAlignedStartPoint:a,elevationAlignedEndPoint:d}))o(Y,-t(e),E),m(n,j,Y);else{const r=c(P.get(),f,p),i=S(P.get(),r,E);S(i,i,r),o(Y,t(e),r),m(n,i,Y)}break}}return l(n,R)?s(n,j):g(n,n)}const Y=a();function G({elevationAlignedStartPoint:e,elevationAlignedEndPoint:t}){return null!=e&&null!=t&&e.x===t.x&&e.y===t.y}function J(e,t,n,r,i){const{startRenderSpace:o,endRenderSpace:a}=r,s=n/i.unitInMeters,[c,l]=K(o,a,t,s);return d(e.startRenderSpace,r.startRenderSpace,t,c),d(e.endRenderSpace,r.endRenderSpace,t,l),e}function K(e,t,n,r=0){const i=u(t,n),o=u(e,n),a=Math.abs(i-o)+r;return i>o?[a,r]:[r,a]}function N(e,t,n){const r=t.directSegment.eval(.5,P.get());return n.worldUpAtPosition(r,e)}function Q(e,t){const{startRenderSpace:n,endRenderSpace:r}=t.directSegment;return c(e,r,n)}function W(e,t,n={invert:!1}){const{startRenderSpace:r,endRenderSpace:i}=t.dimensionSegment;return n.invert?c(e,r,i):c(e,i,r)}function X(e,t){const n=e.directSegment.eval(.5,P.get());return t.headingAtPosition(n,e.primaryOffsetAxis)}function Z(e,t){return f(W($,e))/t**2}const $=v();function _(e){const{elevationAlignedStartPoint:t,elevationAlignedEndPoint:r}=e;if(null==t||null==r)return!1;const i=w(t,r);return null!=i&&n(i,"meters").value>U}function ee(e){return null!=e.geometry}export{z as LengthDimensionGeometry,k as OffsetSegmentLocation,G as arePointsVerticallyAligned,H as computationToGeometryDependencies,C as computeGeometryFromDimension,b as computeLength,F as computeOffsetAxis,q as computeOffsetForPoint,V as computeSegmentForMeasureType,T as computeSpanningSegment,W as dimensionStartToEnd,Q as directStartToEnd,N as directUp,X as headingFromGeometry,_ as isGeodesicDimension,ee as isValidComputation,Z as maxScreenLengthSquaredFromGeometry,M as offsetSegment};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import r from"../../../../core/Accessor.js";import{screenPointObjectToArray as t}from"../../../../core/screenUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{s as i,c as n,n as c,h as a,g as l}from"../../../../chunks/vec32.js";import{clone as m,create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as u,copy as d,fromPoints as f}from"../../../../geometry/support/ray.js";import{sv2d as g}from"../../../../geometry/support/vectorStacks.js";import{getObjectId as y}from"../../../../layers/graphics/dehydratedFeatures.js";import{LineOfSightIntersectionResult as h}from"./LineOfSightIntersectionResult.js";import{fromScreen as j}from"../../support/geometryUtils/ray.js";import{isTerrainIntersectorResult as I}from"../../terrain/Intersector.js";import{newIntersector as v}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as w,IntersectorType as b}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{toGraphic as R}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import P from"../../../../geometry/Point.js";let L=class extends r{constructor(e){super(e),this._terrainIntersectionOptionsLayerUids=new Set(["terrain"])}initialize(){this.intersector=v(this.view.state.viewingMode),this.intersector.options.hud=!1,this.intersector.options.store=w.MIN}getScreenPointIntersection(e){const r=t(e,g.get()),o=j(this.view.state.camera,r,U);return this._getRayIntersection(o)}_getRayIntersection(e,r){const{view:t,intersector:o}=this;if(null==e||null==t.sceneIntersectionHelper)return null;o.options.store=w.MIN,t.sceneIntersectionHelper.intersectToolIntersectorRay(e,o,r);const s=o.results.min;if(null==s.target)return null;const n=p();if(!s.getIntersectionPoint(n))return null;if(null!=r?.maxDistance&&i(n,e.origin)>r.maxDistance**2)return null;const c=t.renderCoordsHelper.fromRenderCoords(n,new P({spatialReference:t.spatialReference})),a=m(s.normal);if(I(s))return new h({type:b.TERRAIN,id:s.target.lij.slice(),mapPoint:c,renderPoint:n,normal:a,ray:d(e),graphic:null});const l=R(s,t);if(null==l)return null;const{layer:u,sourceLayer:f}=l,g="scene"===f?.type?y(l,f.objectIdField):l.uid;return new h({type:b.OBJECT,id:`${u?.uid}/${g}`,mapPoint:c,renderPoint:n,normal:a,ray:d(e),graphic:l})}updateFromGroundIntersection(e,r,t){const o=S,s=x,i=C,p=O;n(s,e),this.view.renderCoordsHelper.worldUpAtPosition(s,i),c(i,i);const u=this.view.basemapTerrain.visibleElevationBounds,d=(r>=0?1:-1)*((u?Math.abs(u.max-u.min):100)+Math.abs(r));a(p,i,d),l(o,s,p),f(o,s,U);const g=this._getRayIntersection(U,{include:this._terrainIntersectionOptionsLayerUids,maxDistance:d});if(null!=g){const e=O;return a(e,i,r),l(t,g.renderPoint,e),m(g.normal)}return n(t,e),null}};e([o()],L.prototype,"view",void 0),e([o()],L.prototype,"intersector",void 0),L=e([s("esri.views.3d.analysis.LineOfSight.LineOfSightRayIntersector")],L);const S=p(),x=p(),C=p(),O=p(),U=u();export{L as LineOfSightRayIntersector};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import r from"../../../../core/Accessor.js";import{screenPointObjectToArray as t}from"../../../../core/screenUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as i,n,h as c,g as a}from"../../../../chunks/vec32.js";import{clone as l,create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as p,copy as u,fromPoints as d}from"../../../../geometry/support/ray.js";import{sv2d as f}from"../../../../geometry/support/vectorStacks.js";import{getObjectId as g}from"../../../../layers/graphics/dehydratedFeatures.js";import{LineOfSightIntersectionResult as h}from"./LineOfSightIntersectionResult.js";import{fromScreen as y}from"../../support/geometryUtils/ray.js";import{isTerrainIntersectorResult as j}from"../../terrain/Intersector.js";import{newIntersector as I}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as w,IntersectorType as v}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{toGraphic as b}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import R from"../../../../geometry/Point.js";let P=class extends r{constructor(e){super(e),this._terrainIntersectionOptionsLayerUids=new Set(["terrain"])}initialize(){this.intersector=I(this.view.state.viewingMode),this.intersector.options.hud=!1,this.intersector.options.store=w.MIN}getScreenPointIntersection(e){const r=t(e,f.get()),o=y(this.view.state.camera,r,O);return this._getRayIntersection(o)}_getRayIntersection(e,r){const{view:t,intersector:o}=this;if(null==e||null==t.sceneIntersectionHelper)return null;o.options.store=w.MIN,t.sceneIntersectionHelper.intersectToolIntersectorRay(e,o,r);const s=o.results.min;if(null==s.target)return null;const i=m();if(!s.getIntersectionPoint(i))return null;if(null!=r?.maxDistance&&!s.withinDistance(r.maxDistance))return null;const n=t.renderCoordsHelper.fromRenderCoords(i,new R({spatialReference:t.spatialReference})),c=l(s.normal);if(j(s))return new h({type:v.TERRAIN,id:s.target.lij.slice(),mapPoint:n,renderPoint:i,normal:c,ray:u(e),graphic:null});const a=b(s,t);if(null==a)return null;const{layer:p,sourceLayer:d}=a,f="scene"===d?.type?g(a,d.objectIdField):a.uid;return new h({type:v.OBJECT,id:`${p?.uid}/${f}`,mapPoint:n,renderPoint:i,normal:c,ray:u(e),graphic:a})}updateFromGroundIntersection(e,r,t){const o=L,s=S,m=x,p=C;i(s,e),this.view.renderCoordsHelper.worldUpAtPosition(s,m),n(m,m);const u=this.view.basemapTerrain.visibleElevationBounds,f=(r>=0?1:-1)*((u?Math.abs(u.max-u.min):100)+Math.abs(r));c(p,m,f),a(o,s,p),d(o,s,O);const g=this._getRayIntersection(O,{include:this._terrainIntersectionOptionsLayerUids,maxDistance:f});if(null!=g){const e=C;return c(e,m,r),a(t,g.renderPoint,e),l(g.normal)}return i(t,e),null}};e([o()],P.prototype,"view",void 0),e([o()],P.prototype,"intersector",void 0),P=e([s("esri.views.3d.analysis.LineOfSight.LineOfSightRayIntersector")],P);const L=m(),S=m(),x=m(),C=m(),O=p();export{P as LineOfSightRayIntersector};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as i}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/Accessor.js";import{isSome as t}from"../../../../core/arrayUtils.js";import{createTask as a}from"../../../../core/asyncUtils.js";import{cyclicalDegrees as o,Cyclical as n}from"../../../../core/Cyclical.js";import{handlesGroup as s}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{deg2rad as r}from"../../../../core/mathUtils.js";import{abortMaybe as l,destroyMaybe as p}from"../../../../core/maybe.js";import{after as h,throwIfAborted as u}from"../../../../core/promiseUtils.js";import{watch as c,syncAndInitial as d,initial as v}from"../../../../core/reactiveUtils.js";import{property as m}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as f}from"../../../../core/accessorSupport/decorators/subclass.js";import{a as g,H as M,f as _}from"../../../../chunks/vec32.js";import{create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{tryProjectWithZConversion as w}from"../../../../geometry/projection.js";import{viewingModeFromString as O}from"../../../ViewingMode.js";import{FieldOfViewManipulation as V,isSideHorizontal as y,flipSide as D}from"./FieldOfViewManipulation.js";import{ScaleOrientManipulation as T}from"./ScaleOrientManipulation.js";import{viewshedToolManipulatorConfiguration as H}from"./ViewshedConfiguration.js";import{ViewshedObserverManipulator as j}from"./viewshedToolManipulatorUtils.js";import{discRadiusSmall as C}from"../../interactive/editingTools/manipulations/config.js";import{MoveManipulation as F}from"../../interactive/editingTools/manipulations/MoveManipulation.js";import{resetProperties as S,dragManipulatedObject as P}from"../../../interactive/dragEventPipeline.js";import{EditGeometryOperations as k}from"../../../interactive/editGeometry/EditGeometryOperations.js";const E=Symbol("dragHandles"),x=Symbol("hideManipulators"),A=Symbol("hideFoVManipulators"),z=Symbol("hideObserverManipulator");let U=class extends e{constructor(i){super(i),this._moveManipulation=null,this._observerManipulator=null,this._fieldOfViewManipulation=null,this._scaleOrientManipulation=null,this._forceHoveringTask=null,this._forceHoveringTestPromise=null,this._grabbing=!1,this.viewshedComputedData=null}initialize(){this._moveManipulation=this._createMoveManipulation(),this._fieldOfViewManipulation=new V({view:this.view,tool:this.parentTool}),this._scaleOrientManipulation=new T({view:this.view,tool:this.parentTool}),this._observerManipulator=new j(this.view,this.parentTool),this.addHandles([c((()=>this.viewshedComputedData?.observerRenderSpace),(i=>{null!=i&&(this._moveManipulation.renderLocation=i,this._observerManipulator.renderLocation=i)}),d),c((()=>this.viewshedComputedData?.heading),(i=>{i&&(this._moveManipulation.angle=r(90-i))}),v),c((()=>{const{viewshedComputedData:i}=this;return{viewshedComputedData:i,observer:i?.observer}}),(({viewshedComputedData:i,observer:e},a)=>{this._grabbing&&e!==a?.observer||(this.removeHandles(E),i?.isValid()&&this.addHandles([this._buildObserverDragPipeline(i),this._buildFOVDragPipeline(i),this._buildScaleOrientDragPipeline(i)].filter(t),E))}),v),c((()=>{const i=this.viewshedComputedData;return i?.isValid()?{viewshedCompData:i,target:i.targetRenderSpace,hFOV:i.horizontalFieldOfView,vFOV:i.verticalFieldOfView}:null}),(i=>{null!=i&&this._fieldOfViewManipulation.updateManipulatorsTransform(i.viewshedCompData)}),v),c((()=>{const i=this.viewshedComputedData;return i?.isValid()?{viewshedCompData:i,hFOV:i.horizontalFieldOfView,vFOV:i.verticalFieldOfView,tilt:i.tilt}:null}),(i=>{null!=i&&this._fieldOfViewManipulation.updateManipulatorVisuals(i.viewshedCompData)}),v),c((()=>{const i=this.analysisViewData.visible&&(this.viewshedComputedData?.isValid()??!1),e=this.parentTool.selectedViewshedComputedData===this.viewshedComputedData;return{fovManipulationAvailable:i&&!this.parentTool.isPlacingTarget,nonFOVManipulationAvailable:i&&(!this.parentTool.creating||e)}}),(({fovManipulationAvailable:i,nonFOVManipulationAvailable:e})=>{this._moveManipulation.available=e,this._scaleOrientManipulation.available=e,this._observerManipulator.available=e,this._fieldOfViewManipulation.available=i}),v),c((()=>{const i=this.viewshedComputedData;if(!i?.isValid())return null;const{observer:e,target:t,verticalFieldOfView:a,horizontalFieldOfView:o}=i;return{viewshedCompData:i,observer:e,target:t,verticalFieldOfView:a,horizontalFieldOfView:o}}),(i=>{null!=i&&this._scaleOrientManipulation.updateManipulators(i.viewshedCompData)}),v)]);const i=i=>{const e=this.analysisViewData;this.addHandles([i.events.on("focus-changed",(()=>{const i=this._someManipulatorHovering();i&&this.parentTool.subToolHandles.forEach((({subTool:i})=>{i._resetHoveringTask()})),this._someManipulatorSelected()||i||(this._forceHoveringTask=a((async i=>{await(this._forceHoveringTestPromise??h(H.hoverTimeoutMilliseconds,i)),u(i),this._forceHoveringTask=null,this._updateManipulatorVisibility()})))})),i.events.on("grab-changed",(t=>{this._grabbing="start"===t.action,"end"===t.action&&e.tool?.updateInteractionVisualsVisibility(),this.parentTool.subToolHandles.forEach((({subTool:i})=>{i!==this&&i._setInteractive(!this._grabbing)})),this._setInteractive((e=>e.hasManipulator(i)||!this._grabbing))})),i.events.on("drag",(i=>{"start"===i.action&&e.tool?.updateInteractionVisualsVisibility()}))])};this._forEachManipulator(i)}destroy(){this._forceHoveringTask=l(this._forceHoveringTask),this._moveManipulation=p(this._moveManipulation),this._fieldOfViewManipulation=p(this._fieldOfViewManipulation),this._scaleOrientManipulation=p(this._scaleOrientManipulation),this.parentTool.manipulators.remove(this._observerManipulator),this._observerManipulator=p(this._observerManipulator)}get viewshed(){return this.viewshedComputedData?.viewshed}get grabbing(){return this._grabbing}get observer(){return this.viewshed?.observer}set observer(i){const e=this.viewshed;null!=e&&(e.observer=i)}get discManipulator(){return this._moveManipulation.xyManipulation.discManipulator}get moveInteractionState(){const{dragging:i,grabbing:e}=this._moveManipulation;return{dragging:i,grabbing:e}}get scaleOrientInteractionState(){const{dragging:i,grabbing:e}=this._scaleOrientManipulation;return{dragging:i,grabbing:e}}_setInteractive(i){const e="boolean"==typeof i;this._forEachManipulation((t=>t.interactive=e?i:i(t)))}onManipulatorSelectionChanged(){if(this._updateManipulatorVisibility(),!this._someManipulatorSelected()){this.analysisViewData.selectedViewshed===this.viewshed&&(this.analysisViewData.selectedViewshed=null),this._resetHoveringTask()}}hasManipulator(i){let e=!1;return this._forEachManipulator((t=>{e=e||t===i})),e}_someManipulatorSelected(){return this._moveManipulation.selected||this._fieldOfViewManipulation.selected||this._scaleOrientManipulation.selected}_someManipulatorHovering(){return this._moveManipulation.hovering||this._fieldOfViewManipulation.hovering||this._scaleOrientManipulation.hovering}_createMoveManipulation(){return new F({view:this.view,tool:this.parentTool,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:C})}_buildObserverDragPipeline(i){const e={mode:"absolute-height",offset:0},t=i.observer;if(null==t)return null;const a=this.view.spatialReference;return this._moveManipulation.createDragPipeline(((i,e,o,n,s)=>{n=n.next(S(this,["observer"]));const r=w(t,a);if(null==r)return{steps:o,cancel:n};const l=k.fromGeometry(r,O(this.view.viewingMode));return{steps:o.next(P({operations:l})).next((i=>(this.observer=l.data.geometry,i))),cancel:n}}),e,a,void 0)}_buildFOVDragPipeline(i){let e=0,t=0;return this._fieldOfViewManipulation.createDragPipeline(((a,n,s)=>{if(null==i)return{steps:n,cancel:s};const r=i.viewshed;let l=null;s=s.next(S(i,["horizontalFieldOfView","verticalFieldOfView"]));return{steps:n.next((a=>{if("start"===a.action)return l=null,e=i.horizontalFieldOfView,t=i.verticalFieldOfView,a;const n=a.deltaAngle;if(null==l&&0!==n){const i="bottom"===a.side||"left"===a.side?n>0:n<0;l=y(a.side)?0===e&&i||360===e&&!i:0===t&&i}const s=l?D(a.side):a.side;let p=0;switch(s){case"left":p=e/2-n;break;case"right":p=e/2+n;break;case"top":p=t+2*n;break;case"bottom":p=t-2*n}return y(s)?(p=o.normalize(p),p=p>270?0:p>180?180:p,r.horizontalFieldOfView=2*p):r.verticalFieldOfView=p,a})),cancel:s}}),i)}_buildScaleOrientDragPipeline(i){let e=0,t=0;const a=(e,t)=>(a,o,n)=>{if(null==i)return{steps:o,cancel:n};const s=i.viewshed;return n=n.next(S(s,[e])),{steps:o=o.next(t(s,i)),cancel:n}};return s([this._scaleOrientManipulation.createHeadingDragPipeline(a("heading",((e,a)=>a=>("start"===a.action&&(t=i.heading),e.heading=o.normalize(t+a.deltaAngle),a))),i),this._scaleOrientManipulation.createTiltDragPipeline(a("tilt",((t,a)=>a=>{"start"===a.action&&(e=i.tilt);let o=e+a.deltaAngle;return o<-90?o=180:o>270&&(o=0),t.tilt=R.clamp(o),a})),i),this._scaleOrientManipulation.createDistanceDragPipeline(a("farDistance",((i,e)=>t=>{const a=g(I,t.renderEnd,e.observerRenderSpace),o=M(a)*e.metersPerUnit,n=_(a,e.targetDirection)<0?H.scaleOrientMinDistance:o;return i.farDistance=n,t})),i)])}_updateManipulatorVisibility(){const i=this._someManipulatorSelected(),e=null!=this._forceHoveringTask||this._someManipulatorHovering(),t=this._fieldOfViewManipulation.hovering,a=this.parentTool.creating;let o=[];const n=i=>{o.push(i.disableDisplay())};i||!a&&e?this.removeHandles(x):(this._scaleOrientManipulation.forEachManipulator(n),this._moveManipulation.forEachManipulator(n),this.addHandles(o,x),o=[]),i||!a&&e||a&&t?this.removeHandles(A):(this._fieldOfViewManipulation.forEachManipulator(n),this.addHandles(o,A)),i||!a?this.removeHandles(z):this.addHandles(this._observerManipulator.disableDisplay(),z)}_resetHoveringTask(){this._forceHoveringTask=l(this._forceHoveringTask),this._updateManipulatorVisibility()}_forEachManipulator(i){this._forEachManipulation((e=>{e.forEachManipulator(i)})),i(this._observerManipulator)}_forEachManipulation(i){i(this._moveManipulation),i(this._fieldOfViewManipulation),i(this._scaleOrientManipulation)}get test(){return{moveManipulation:this._moveManipulation,fieldOfViewManipulation:this._fieldOfViewManipulation,scaleOrientManipulation:this._scaleOrientManipulation,viewshedComputedData:this.viewshedComputedData,setHoveringTimeoutPromise:i=>{this._forceHoveringTestPromise=i}}}};i([m({constructOnly:!0})],U.prototype,"analysis",void 0),i([m({constructOnly:!0})],U.prototype,"analysisViewData",void 0),i([m({constructOnly:!0})],U.prototype,"parentTool",void 0),i([m({constructOnly:!0,nonNullable:!0})],U.prototype,"view",void 0),i([m()],U.prototype,"viewshed",null),i([m()],U.prototype,"_grabbing",void 0),i([m()],U.prototype,"grabbing",null),i([m()],U.prototype,"viewshedComputedData",void 0),i([m()],U.prototype,"observer",null),U=i([f("esri.views.3d.analysis.Viewshed.ViewshedSubTool")],U);const I=b(),R=new n(0,180);export{U as ViewshedSubTool};
5
+ import{_ as i}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/Accessor.js";import{isSome as t}from"../../../../core/arrayUtils.js";import{createTask as a}from"../../../../core/asyncUtils.js";import{cyclicalDegrees as o,Cyclical as n}from"../../../../core/Cyclical.js";import{handlesGroup as s}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{deg2rad as r}from"../../../../core/mathUtils.js";import{abortMaybe as l,destroyMaybe as p}from"../../../../core/maybe.js";import{after as h,throwIfAborted as u}from"../../../../core/promiseUtils.js";import{watch as c,syncAndInitial as d,initial as v}from"../../../../core/reactiveUtils.js";import{property as m}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as f}from"../../../../core/accessorSupport/decorators/subclass.js";import{a as g,H as M,f as b}from"../../../../chunks/vec32.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{tryProjectWithZConversion as w}from"../../../../geometry/projection.js";import{viewingModeFromString as O}from"../../../ViewingMode.js";import{FieldOfViewManipulation as V,isSideHorizontal as y,flipSide as D}from"./FieldOfViewManipulation.js";import{ScaleOrientManipulation as T}from"./ScaleOrientManipulation.js";import{viewshedToolManipulatorConfiguration as H}from"./ViewshedConfiguration.js";import{ViewshedObserverManipulator as j}from"./viewshedToolManipulatorUtils.js";import{discRadiusSmall as C}from"../../interactive/editingTools/manipulations/config.js";import{MoveManipulation as F}from"../../interactive/editingTools/manipulations/MoveManipulation.js";import{resetProperties as S,dragManipulatedObject as P}from"../../../interactive/dragEventPipeline.js";import{EditGeometryOperations as k}from"../../../interactive/editGeometry/EditGeometryOperations.js";const E=Symbol("dragHandles"),x=Symbol("hideManipulators"),A=Symbol("hideFoVManipulators"),z=Symbol("hideObserverManipulator");let U=class extends e{constructor(i){super(i),this._moveManipulation=null,this._observerManipulator=null,this._fieldOfViewManipulation=null,this._scaleOrientManipulation=null,this._forceHoveringTask=null,this._forceHoveringTestPromise=null,this._grabbing=!1,this.viewshedComputedData=null}initialize(){this._moveManipulation=this._createMoveManipulation(),this._fieldOfViewManipulation=new V({view:this.view,tool:this.parentTool}),this._scaleOrientManipulation=new T({view:this.view,tool:this.parentTool}),this._observerManipulator=new j(this.view,this.parentTool),this.addHandles([c((()=>this.viewshedComputedData?.observerRenderSpace),(i=>{null!=i&&(this._moveManipulation.renderLocation=i,this._observerManipulator.renderLocation=i)}),d),c((()=>this.viewshedComputedData?.heading),(i=>{i&&(this._moveManipulation.angle=r(90-i))}),v),c((()=>{const{viewshedComputedData:i}=this;return{viewshedComputedData:i,observer:i?.observer}}),(({viewshedComputedData:i,observer:e},a)=>{this._grabbing&&e!==a?.observer||(this.removeHandles(E),i?.isValid()&&this.addHandles([this._buildObserverDragPipeline(i),this._buildFOVDragPipeline(i),this._buildScaleOrientDragPipeline(i)].filter(t),E))}),v),c((()=>{const i=this.viewshedComputedData;return i?.isValid()?{viewshedCompData:i,target:i.targetRenderSpace,hFOV:i.horizontalFieldOfView,vFOV:i.verticalFieldOfView}:null}),(i=>{null!=i&&this._fieldOfViewManipulation.updateManipulatorsTransform(i.viewshedCompData)}),v),c((()=>{const i=this.viewshedComputedData;return i?.isValid()?{viewshedCompData:i,hFOV:i.horizontalFieldOfView,vFOV:i.verticalFieldOfView,tilt:i.tilt}:null}),(i=>{null!=i&&this._fieldOfViewManipulation.updateManipulatorVisuals(i.viewshedCompData)}),v),c((()=>{const i=this.analysisViewData.visible&&(this.viewshedComputedData?.isValid()??!1),e=this.parentTool.selectedViewshedComputedData===this.viewshedComputedData;return{fovManipulationAvailable:i&&!this.parentTool.isPlacingTarget,nonFOVManipulationAvailable:i&&(!this.parentTool.creating||e)}}),(({fovManipulationAvailable:i,nonFOVManipulationAvailable:e})=>{this._moveManipulation.available=e,this._scaleOrientManipulation.available=e,this._observerManipulator.available=e,this._fieldOfViewManipulation.available=i}),v),c((()=>{const i=this.viewshedComputedData;if(!i?.isValid())return null;const{observer:e,target:t,verticalFieldOfView:a,horizontalFieldOfView:o}=i;return{viewshedCompData:i,observer:e,target:t,verticalFieldOfView:a,horizontalFieldOfView:o}}),(i=>{null!=i&&this._scaleOrientManipulation.updateManipulators(i.viewshedCompData)}),v)]);const i=i=>{const e=this.analysisViewData;this.addHandles([i.events.on("focus-changed",(()=>{const i=this._someManipulatorHovering();i&&this.parentTool.subToolHandles.forEach((({subTool:i})=>{i._resetHoveringTask()})),this._someManipulatorSelected()||i||(this._forceHoveringTask=a((async i=>{await(this._forceHoveringTestPromise??h(H.hoverTimeoutMilliseconds,i)),u(i),this._forceHoveringTask=null,this._updateManipulatorVisibility()})))})),i.events.on("grab-changed",(t=>{this._grabbing="start"===t.action,"end"===t.action&&e.tool?.updateInteractionVisualsVisibility(),this.parentTool.subToolHandles.forEach((({subTool:i})=>{i!==this&&i._setInteractive(!this._grabbing)})),this._setInteractive((e=>e.hasManipulator(i)||!this._grabbing))})),i.events.on("drag",(i=>{"start"===i.action&&e.tool?.updateInteractionVisualsVisibility()}))])};this._forEachManipulator(i)}destroy(){this._forceHoveringTask=l(this._forceHoveringTask),this._moveManipulation=p(this._moveManipulation),this._fieldOfViewManipulation=p(this._fieldOfViewManipulation),this._scaleOrientManipulation=p(this._scaleOrientManipulation),this.parentTool.manipulators.remove(this._observerManipulator),this._observerManipulator=p(this._observerManipulator)}get viewshed(){return this.viewshedComputedData?.viewshed}get grabbing(){return this._grabbing}get observer(){return this.viewshed?.observer}set observer(i){const e=this.viewshed;null!=e&&(e.observer=i)}get discManipulator(){return this._moveManipulation.xyManipulation.discManipulator}get moveInteractionState(){const{dragging:i,grabbing:e}=this._moveManipulation;return{dragging:i,grabbing:e}}get scaleOrientInteractionState(){const{dragging:i,grabbing:e}=this._scaleOrientManipulation;return{dragging:i,grabbing:e}}_setInteractive(i){const e="boolean"==typeof i;this._forEachManipulation((t=>t.interactive=e?i:i(t)))}onManipulatorSelectionChanged(){if(this._updateManipulatorVisibility(),!this._someManipulatorSelected()){this.analysisViewData.selectedViewshed===this.viewshed&&(this.analysisViewData.selectedViewshed=null),this._resetHoveringTask()}}hasManipulator(i){let e=!1;return this._forEachManipulator((t=>{e=e||t===i})),e}_someManipulatorSelected(){return this._moveManipulation.selected||this._fieldOfViewManipulation.selected||this._scaleOrientManipulation.selected}_someManipulatorHovering(){return this._moveManipulation.hovering||this._fieldOfViewManipulation.hovering||this._scaleOrientManipulation.hovering}_createMoveManipulation(){return new F({view:this.view,tool:this.parentTool,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:C})}_buildObserverDragPipeline(i){const e={mode:"absolute-height",offset:0},t=i.observer;if(null==t)return null;const a=this.view.spatialReference;return this._moveManipulation.createDragPipeline(((i,e,o,n,s)=>{n=n.next(S(this,["observer"]));const r=w(t,a);if(null==r)return{steps:o,cancel:n};const l=k.fromGeometry(r,O(this.view.viewingMode));return{steps:o.next(P({operations:l})).next((i=>(this.observer=l.data.geometry,i))),cancel:n}}),e,a,void 0)}_buildFOVDragPipeline(i){let e=0,t=0;return this._fieldOfViewManipulation.createDragPipeline(((a,n,s)=>{if(null==i)return{steps:n,cancel:s};const r=i.viewshed;let l=null;s=s.next(S(r,["horizontalFieldOfView","verticalFieldOfView"]));return{steps:n.next((a=>{"start"===a.action&&(l=null,e=i.horizontalFieldOfView,t=i.verticalFieldOfView);const n=a.deltaAngle;if(Math.abs(n)<1)return a;if(null==l){const i="bottom"===a.side||"left"===a.side?n>0:n<0;l=y(a.side)?0===e&&i||360===e&&!i:0===t&&i}const s=l?D(a.side):a.side;let p=0;switch(s){case"left":p=e/2-n;break;case"right":p=e/2+n;break;case"top":p=t+2*n;break;case"bottom":p=t-2*n}return y(s)?(p=o.normalize(p),p=p>270?0:p>180?180:p,r.horizontalFieldOfView=2*p):r.verticalFieldOfView=p,a})),cancel:s}}),i)}_buildScaleOrientDragPipeline(i){let e=0,t=0;const a=(e,t)=>(a,o,n)=>{if(null==i)return{steps:o,cancel:n};const s=i.viewshed;return n=n.next(S(s,[e])),{steps:o=o.next(t(s,i)),cancel:n}};return s([this._scaleOrientManipulation.createHeadingDragPipeline(a("heading",((e,a)=>a=>("start"===a.action&&(t=i.heading),e.heading=o.normalize(t+a.deltaAngle),a))),i),this._scaleOrientManipulation.createTiltDragPipeline(a("tilt",((t,a)=>a=>{"start"===a.action&&(e=i.tilt);let o=e+a.deltaAngle;return o<-90?o=180:o>270&&(o=0),t.tilt=R.clamp(o),a})),i),this._scaleOrientManipulation.createDistanceDragPipeline(a("farDistance",((i,e)=>t=>{const a=g(I,t.renderEnd,e.observerRenderSpace),o=M(a)*e.metersPerUnit,n=b(a,e.targetDirection)<0?H.scaleOrientMinDistance:o;return i.farDistance=n,t})),i)])}_updateManipulatorVisibility(){const i=this._someManipulatorSelected(),e=null!=this._forceHoveringTask||this._someManipulatorHovering(),t=this._fieldOfViewManipulation.hovering,a=this.parentTool.creating;let o=[];const n=i=>{o.push(i.disableDisplay())};i||!a&&e?this.removeHandles(x):(this._scaleOrientManipulation.forEachManipulator(n),this._moveManipulation.forEachManipulator(n),this.addHandles(o,x),o=[]),i||!a&&e||a&&t?this.removeHandles(A):(this._fieldOfViewManipulation.forEachManipulator(n),this.addHandles(o,A)),i||!a?this.removeHandles(z):this.addHandles(this._observerManipulator.disableDisplay(),z)}_resetHoveringTask(){this._forceHoveringTask=l(this._forceHoveringTask),this._updateManipulatorVisibility()}_forEachManipulator(i){this._forEachManipulation((e=>{e.forEachManipulator(i)})),i(this._observerManipulator)}_forEachManipulation(i){i(this._moveManipulation),i(this._fieldOfViewManipulation),i(this._scaleOrientManipulation)}get test(){return{moveManipulation:this._moveManipulation,fieldOfViewManipulation:this._fieldOfViewManipulation,scaleOrientManipulation:this._scaleOrientManipulation,viewshedComputedData:this.viewshedComputedData,setHoveringTimeoutPromise:i=>{this._forceHoveringTestPromise=i}}}};i([m({constructOnly:!0})],U.prototype,"analysis",void 0),i([m({constructOnly:!0})],U.prototype,"analysisViewData",void 0),i([m({constructOnly:!0})],U.prototype,"parentTool",void 0),i([m({constructOnly:!0,nonNullable:!0})],U.prototype,"view",void 0),i([m()],U.prototype,"viewshed",null),i([m()],U.prototype,"_grabbing",void 0),i([m()],U.prototype,"grabbing",null),i([m()],U.prototype,"viewshedComputedData",void 0),i([m()],U.prototype,"observer",null),U=i([f("esri.views.3d.analysis.Viewshed.ViewshedSubTool")],U);const I=_(),R=new n(0,180);export{U as ViewshedSubTool};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Accessor.js";import"../../../core/has.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{watch as r,initial as i}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{DoubleClickZoom as s}from"./handlers/DoubleClickZoom.js";import{DragRotate as m}from"./handlers/DragRotate.js";import{DragZoom as p}from"./handlers/DragZoom.js";import{GamepadNavigation as d}from"./handlers/GamepadNavigation.js";import{KeyboardNavigation as c}from"./handlers/KeyboardNavigation.js";import{MouseWheelZoom as l}from"./handlers/MouseWheelZoom.js";import{PinchAndPanNavigation as u}from"./handlers/PinchAndPanNavigation.js";import{PointerDownCancelAnimation as g}from"./handlers/PointerDownCancelAnimation.js";import{TwoFingerTilt as h}from"./handlers/TwoFingerTilt.js";import{BrowserEventSource as w}from"../../input/BrowserEventSource.js";import{InputManager as y,ViewEventPriorities as _}from"../../input/InputManager.js";import{PreventContextMenu as f}from"../../input/handlers/PreventContextMenu.js";import{Drag as v}from"../../input/recognizers/Drag.js";import{ImmediateDoubleClick as D}from"../../input/recognizers/ImmediateDoubleClick.js";import{PointerClickHoldAndDrag as A}from"../../input/recognizers/PointerClickHoldAndDrag.js";import{SingleAndDoubleClick as j}from"../../input/recognizers/SingleAndDoubleClick.js";import{VerticalTwoFingerDrag as M}from"../../input/recognizers/VerticalTwoFingerDrag.js";import{PivotPoint as P}from"../state/controllers/RotateController.js";let b=class extends e{destroy(){this.disconnect()}get primaryDragAction(){return this._get("primaryDragAction")}set primaryDragAction(t){"pan"!==t&&"rotate"!==t||t===this._get("primaryDragAction")||(this._set("primaryDragAction",t),this._updateMode())}get mode(){return this._get("mode")}set mode(t){"default"!==t&&"pro"!==t||t===this._get("mode")||(this._set("mode",t),this._updateMode())}get updating(){return!!this._inputManager?.updating}get latestPointerType(){return this._inputManager?.latestPointerType}get latestPointerLocation(){return this._inputManager?.latestPointerLocation}get multiTouchActive(){return this._inputManager?.multiTouchActive??!1}disconnect(){this.removeAllHandles(),this.view.viewEvents.disconnect(),this._modeDragPan=null,this._modeDragRotate=null,this._modeDragZoom=null,this._modeKeyboardNavigation=null,this._inputManager=o(this._inputManager),this._source=o(this._source)}connect(){const t=this.view;this._source=new w(this.view.surface,t.input);const e=[new D,new A,new j,new v(this.view.navigation),new M],o=new y({eventSource:this._source,recognizers:e});this._inputManager=o,o.installHandlers("prevent-context-menu",[new f],_.INTERNAL);const n={fov:"Shift",pan:{left:"ArrowLeft",right:"ArrowRight",forward:"ArrowUp",backward:"ArrowDown",up:["u","U"],down:["j","J"]},lookAround:{headingLeft:["a","A"],headingRight:["d","D"],tiltUp:["w","W"],tiltDown:["s","S"],modifier:"b"},zoom:{zoomIn:["+","="],zoomOut:["-","_"]},reset:{heading:["n","N"],tilt:["p","P"]}};this._modeDragPan=new u(t,"primary"),this._modeDragRotate=new m(t,"secondary",P.CENTER),this._modeDragZoom=new p(t,"tertiary",n.fov),this._modeKeyboardNavigation=new c(t,n),o.installHandlers("navigation",[new g(t),new s(t),new d(t),new l(t,n.fov),new m(t,"primary",P.EYE,[n.lookAround.modifier]),new m(t,"secondary",P.CENTER,[n.lookAround.modifier]),new u(t,"tertiary",[n.lookAround.modifier]),this._modeDragRotate,this._modeDragZoom,this._modeDragPan,this._modeKeyboardNavigation,new h(t)],_.INTERNAL),this.view.viewEvents.connect(o),this._updateMode(),this.addHandles(r((()=>this.view.navigation?.browserTouchPanEnabled),(t=>{this._source.browserTouchPanningEnabled=!t}),i))}isModifierKeyDown(t){return this._inputManager?.isModifierKeyDown(t)??!1}_updateMode(){const t=this.mode,e=this.primaryDragAction,o=T.get(t)?.get(e);o&&(this._modeDragPan&&(this._modeDragPan.pointerAction=o.pan),this._modeDragRotate&&(this._modeDragRotate.pointerAction=o.rotate),this._modeDragZoom&&(this._modeDragZoom.pointerAction=o.zoom))}get test(){}};t([n()],b.prototype,"view",void 0),t([n({value:"pan"})],b.prototype,"primaryDragAction",null),t([n({value:"default"})],b.prototype,"mode",null),t([n({readOnly:!0})],b.prototype,"updating",null),t([n()],b.prototype,"latestPointerType",null),t([n()],b.prototype,"latestPointerLocation",null),t([n()],b.prototype,"multiTouchActive",null),t([n()],b.prototype,"_inputManager",void 0),b=t([a("esri.views.3d.input.SceneInputManager")],b);const T=new Map,z=new Map,R=new Map;z.set("pan",{pan:"primary",rotate:"secondary",zoom:"tertiary"}),z.set("rotate",{pan:"secondary",rotate:"primary",zoom:"tertiary"}),R.set("pan",{pan:"primary",rotate:"tertiary",zoom:"secondary"}),R.set("rotate",{pan:"tertiary",rotate:"primary",zoom:"secondary"}),T.set("default",z),T.set("pro",R);const E=b;export{E as default};
5
+ import{_ as o}from"../../../chunks/tslib.es6.js";import r from"../../../core/Accessor.js";import"../../../core/has.js";import{destroyMaybe as t}from"../../../core/maybe.js";import{watch as e,initial as i,syncAndInitial as n}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{DoubleClickZoom as d}from"./handlers/DoubleClickZoom.js";import{DragRotate as m}from"./handlers/DragRotate.js";import{DragZoom as p}from"./handlers/DragZoom.js";import{GamepadNavigation as c}from"./handlers/GamepadNavigation.js";import{KeyboardNavigation as g}from"./handlers/KeyboardNavigation.js";import{MouseWheelZoom as l}from"./handlers/MouseWheelZoom.js";import{PinchAndPanNavigation as u}from"./handlers/PinchAndPanNavigation.js";import{PointerDownCancelAnimation as h}from"./handlers/PointerDownCancelAnimation.js";import{TwoFingerTilt as w}from"./handlers/TwoFingerTilt.js";import{BrowserEventSource as y}from"../../input/BrowserEventSource.js";import{InputManager as f,ViewEventPriorities as v}from"../../input/InputManager.js";import{PreventContextMenu as _}from"../../input/handlers/PreventContextMenu.js";import{getPointerActions as D}from"../../input/handlers/support.js";import{Drag as j}from"../../input/recognizers/Drag.js";import{ImmediateDoubleClick as A}from"../../input/recognizers/ImmediateDoubleClick.js";import{PointerClickHoldAndDrag as P}from"../../input/recognizers/PointerClickHoldAndDrag.js";import{SingleAndDoubleClick as M}from"../../input/recognizers/SingleAndDoubleClick.js";import{VerticalTwoFingerDrag as T}from"../../input/recognizers/VerticalTwoFingerDrag.js";import{PivotPoint as b}from"../state/controllers/RotateController.js";let R=class extends r{constructor(){super(...arguments),this.mode="default",this._updateMode=({mode:o,dragPrimary:r,dragSecondary:t,dragTertiary:e})=>{"pro"===o&&(t="zoom",e="pan"===r?"rotate":"pan");const i={dragPrimary:r,dragSecondary:t,dragTertiary:e};this._modeDragPan&&(this._modeDragPan.pointerActions=D("pan",i)),this._modeDragRotate&&(this._modeDragRotate.pointerActions=D("rotate",i)),this._modeDragZoom&&(this._modeDragZoom.pointerActions=D("zoom",i))}}destroy(){this.disconnect()}get primaryDragAction(){return this.view.navigation.actionMap.dragPrimary}set primaryDragAction(o){const{actionMap:r}=this.view.navigation;r.dragPrimary=o,r.dragSecondary="pan"===o?"rotate":"pan"}get updating(){return!!this._inputManager?.updating}get latestPointerType(){return this._inputManager?.latestPointerType}get latestPointerLocation(){return this._inputManager?.latestPointerLocation}get multiTouchActive(){return this._inputManager?.multiTouchActive??!1}disconnect(){this.removeAllHandles(),this.view.viewEvents.disconnect(),this._modeDragPan=null,this._modeDragRotate=null,this._modeDragZoom=null,this._modeKeyboardNavigation=null,this._inputManager=t(this._inputManager),this._source=t(this._source)}connect(){const o=this.view;this._source=new y(this.view.surface,o.input);const r=[new A,new P,new M,new j(this.view.navigation),new T],t=new f({eventSource:this._source,recognizers:r});this._inputManager=t,t.installHandlers("prevent-context-menu",[new _],v.INTERNAL);const a={fov:"Shift",pan:{left:"ArrowLeft",right:"ArrowRight",forward:"ArrowUp",backward:"ArrowDown",up:["u","U"],down:["j","J"]},lookAround:{headingLeft:["a","A"],headingRight:["d","D"],tiltUp:["w","W"],tiltDown:["s","S"],modifier:"b"},zoom:{zoomIn:["+","="],zoomOut:["-","_"]},reset:{heading:["n","N"],tilt:["p","P"]}};this._modeDragPan=new u(o,["primary"]),this._modeDragRotate=new m(o,["secondary"],b.CENTER),this._modeDragZoom=new p(o,["tertiary"],a.fov),this._modeKeyboardNavigation=new g(o,a),t.installHandlers("navigation",[new h(o),new d(o),new c(o),new l(o,a.fov),new m(o,["primary"],b.EYE,[a.lookAround.modifier]),new m(o,["secondary"],b.CENTER,[a.lookAround.modifier]),new u(o,["tertiary"],[a.lookAround.modifier]),this._modeDragRotate,this._modeDragZoom,this._modeDragPan,this._modeKeyboardNavigation,new w(o)],v.INTERNAL),this.view.viewEvents.connect(t),this.addHandles([e((()=>this.view.navigation?.browserTouchPanEnabled),(o=>{this._source.browserTouchPanningEnabled=!o}),i),e((()=>{const{actionMap:o}=this.view.navigation,{dragPrimary:r,dragSecondary:t,dragTertiary:e}=o;return{mode:this.mode,dragPrimary:r,dragSecondary:t,dragTertiary:e}}),this._updateMode,n)])}isModifierKeyDown(o){return this._inputManager?.isModifierKeyDown(o)??!1}get test(){}};o([a()],R.prototype,"view",void 0),o([a({type:["default","pro"]})],R.prototype,"mode",void 0),o([a({readOnly:!0})],R.prototype,"updating",null),o([a()],R.prototype,"latestPointerType",null),o([a()],R.prototype,"latestPointerLocation",null),o([a()],R.prototype,"multiTouchActive",null),o([a()],R.prototype,"_inputManager",void 0),R=o([s("esri.views.3d.input.SceneInputManager")],R);const E=R;export{E as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{createScreenPointArray as t}from"../../../../core/screenUtils.js";import{RotateController as r}from"../../state/controllers/RotateController.js";export{PivotPoint}from"../../state/controllers/RotateController.js";import{InputHandler as e}from"../../../input/InputHandler.js";import{eventMatchesMousePointerAction as o}from"../../../input/handlers/support.js";class a extends e{constructor(t,r,e,o){super(!0),this._view=t,this.pointerAction=r,this._pivot=e,this.registerIncoming("drag",o,(t=>this._handleDrag(t)))}_handleDrag(e){const a=e.data;if(a.pointers.size>1)return;if(!o(e.data,this.pointerAction))return;const i=t(a.center.x,a.center.y);switch(a.action){case"start":this._cameraController&&(this._cameraController.end(),this._cameraController=null),this._cameraController=new r({view:this._view,pivot:this._pivot}),this._view.state.switchCameraController(this._cameraController),this._cameraController.begin(i);break;case"update":this._cameraController&&this._cameraController.update(i);break;case"end":this._cameraController&&(this._cameraController.end(),this._cameraController=null)}e.stopPropagation()}}export{a as DragRotate};
5
+ import{createScreenPointArray as t}from"../../../../core/screenUtils.js";import{RotateController as r}from"../../state/controllers/RotateController.js";export{PivotPoint}from"../../state/controllers/RotateController.js";import{InputHandler as e}from"../../../input/InputHandler.js";import{eventMatchesMousePointerActions as o}from"../../../input/handlers/support.js";class s extends e{constructor(t,r,e,o){super(!0),this._view=t,this.pointerActions=r,this._pivot=e,this.registerIncoming("drag",o,(t=>this._handleDrag(t)))}_handleDrag(e){const s=e.data;if(s.pointers.size>1)return;if(!o(e.data,this.pointerActions))return;const a=t(s.center.x,s.center.y);switch(s.action){case"start":this._cameraController&&(this._cameraController.end(),this._cameraController=null),this._cameraController=new r({view:this._view,pivot:this._pivot}),this._view.state.switchCameraController(this._cameraController),this._cameraController.begin(a);break;case"update":this._cameraController&&this._cameraController.update(a);break;case"end":this._cameraController&&(this._cameraController.end(),this._cameraController=null)}e.stopPropagation()}}export{s as DragRotate};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{createScreenPointArray as t}from"../../../../core/screenUtils.js";import{FovController as o}from"../../state/controllers/FovController.js";import{ZoomControllerGlobal as r}from"../../state/controllers/ZoomControllerGlobal.js";import{ZoomControllerLocal as e}from"../../state/controllers/ZoomControllerLocal.js";import{InputHandler as s}from"../../../input/InputHandler.js";import{eventMatchesMousePointerAction as i}from"../../../input/handlers/support.js";class n extends s{constructor(t,o,r){super(!0),this._view=t,this.pointerAction=o,this._fovModifier=r,this.registerIncoming("drag",[r],(t=>this._handleZoom(t))),this.registerIncoming("drag",(t=>this._handleZoom(t)))}_handleZoom(s){const n=s.data;if(n.pointers.size>1)return;if(!i(s.data,this.pointerAction))return;const a=t(n.center.x,n.center.y);switch(n.action){case"start":{this._cameraController?.finish();const t=this._view,i=s.modifiers.has(this._fovModifier);this._cameraController=i?new o({view:t,onStop:()=>this._stopController()}):t.state.isGlobal?new r({view:t}):new e({view:t}),this._view.state.switchCameraController(this._cameraController),this._cameraController.begin(a);break}case"update":this._cameraController?.update(a);break;case"end":this._cameraController instanceof o?this._cameraController.updateTimeout():this._stopController()}s.stopPropagation()}_stopController(){this._cameraController?.finish(),this._cameraController=null}}export{n as DragZoom};
5
+ import{createScreenPointArray as t}from"../../../../core/screenUtils.js";import{FovController as o}from"../../state/controllers/FovController.js";import{ZoomControllerGlobal as r}from"../../state/controllers/ZoomControllerGlobal.js";import{ZoomControllerLocal as e}from"../../state/controllers/ZoomControllerLocal.js";import{InputHandler as s}from"../../../input/InputHandler.js";import{eventMatchesMousePointerActions as i}from"../../../input/handlers/support.js";class n extends s{constructor(t,o,r){super(!0),this._view=t,this.pointerActions=o,this._fovModifier=r,this.registerIncoming("drag",[r],(t=>this._handleZoom(t))),this.registerIncoming("drag",(t=>this._handleZoom(t)))}_handleZoom(s){const n=s.data;if(n.pointers.size>1)return;if(!i(s.data,this.pointerActions))return;const a=t(n.center.x,n.center.y);switch(n.action){case"start":{this._cameraController?.finish();const t=this._view,i=s.modifiers.has(this._fovModifier);this._cameraController=i?new o({view:t,onStop:()=>this._stopController()}):t.state.isGlobal?new r({view:t}):new e({view:t}),this._view.state.switchCameraController(this._cameraController),this._cameraController.begin(a);break}case"update":this._cameraController?.update(a);break;case"end":this._cameraController instanceof o?this._cameraController.updateTimeout():this._stopController()}s.stopPropagation()}_stopController(){this._cameraController?.finish(),this._cameraController=null}}export{n as DragZoom};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{createScreenPointArray as o}from"../../../../core/screenUtils.js";import{State as t}from"../../state/controllers/CameraController.js";import{FovController as e}from"../../state/controllers/FovController.js";import{ZoomStepControllerGlobal as r}from"../../state/controllers/ZoomStepControllerGlobal.js";import{ZoomStepControllerLocal as l}from"../../state/controllers/ZoomStepControllerLocal.js";import{InputHandler as i}from"../../../input/InputHandler.js";class s extends i{constructor(o,t){super(!0),this._view=o,this.registerIncoming("mouse-wheel",[t],(o=>this._handleFov(o))),this.registerIncoming("mouse-wheel",(o=>this._handleZoom(o)))}_handleZoom(t){if(!this._view.navigation.mouseWheelZoomEnabled)return;const e=t.data;this._zoomController?.running||(this._stopFovController(),this._zoomController=this._view.state.isGlobal?new r({view:this._view,mode:"interaction"}):new l({view:this._view,mode:"interaction"}),this._view.state.switchCameraController(this._zoomController)),this._zoomController.step(-e.deltaY/60,o(e.x,e.y)),t.preventDefault(),t.stopPropagation()}_handleFov(o){this._view.navigation.mouseWheelZoomEnabled&&(this._fovController?.running||(this._zoomController?.finish(),this._fovController?.hideOverlay(),this._fovController=new e({view:this._view,onStop:()=>this._stopFovController()}),this._view.state.switchCameraController(this._fovController),this._fovController.state!==t.Rejected)?(this._fovController.updateTimeout(),this._fovController.step(o.data.deltaY/20),o.preventDefault(),o.stopPropagation()):this._stopFovController())}_stopFovController(){this._fovController?.finish(),this._fovController=null}}export{s as MouseWheelZoom};
5
+ import{createScreenPointArray as o}from"../../../../core/screenUtils.js";import{State as t}from"../../state/controllers/CameraController.js";import{FovController as e}from"../../state/controllers/FovController.js";import{ZoomStepControllerGlobal as r}from"../../state/controllers/ZoomStepControllerGlobal.js";import{ZoomStepControllerLocal as l}from"../../state/controllers/ZoomStepControllerLocal.js";import{InputHandler as s}from"../../../input/InputHandler.js";class i extends s{constructor(o,t){super(!0),this._view=o,this.registerIncoming("mouse-wheel",[t],(o=>this._handleFov(o))),this.registerIncoming("mouse-wheel",(o=>this._handleZoom(o)))}_handleZoom(t){if(!this._mouseWheelZoomEnabled)return;const e=t.data;this._zoomController?.running||(this._stopFovController(),this._zoomController=this._view.state.isGlobal?new r({view:this._view,mode:"interaction"}):new l({view:this._view,mode:"interaction"}),this._view.state.switchCameraController(this._zoomController)),this._zoomController.step(-e.deltaY/60,o(e.x,e.y)),t.preventDefault(),t.stopPropagation()}_handleFov(o){this._mouseWheelZoomEnabled&&(this._fovController?.running||(this._zoomController?.finish(),this._fovController?.hideOverlay(),this._fovController=new e({view:this._view,onStop:()=>this._stopFovController()}),this._view.state.switchCameraController(this._fovController),this._fovController.state!==t.Rejected)?(this._fovController.updateTimeout(),this._fovController.step(o.data.deltaY/20),o.preventDefault(),o.stopPropagation()):this._stopFovController())}get _mouseWheelZoomEnabled(){return"zoom"===this._view.navigation.actionMap.mouseWheel}_stopFovController(){this._fovController?.finish(),this._fovController=null}}export{i as MouseWheelZoom};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{PinchAndPanControllerGlobal as t}from"../../state/controllers/PinchAndPanControllerGlobal.js";import{PinchAndPanControllerLocal as e}from"../../state/controllers/PinchAndPanControllerLocal.js";import{InputHandler as s}from"../../../input/InputHandler.js";import{eventMatchesMousePointerAction as r}from"../../../input/handlers/support.js";class i extends s{constructor(t,e,s){super(!0),this._view=t,this.pointerAction=e,this._lastEndTimestamp=0,this._lastTimestamp=0,this.registerIncoming("drag",s,(t=>this._handleDrag(t)))}_handleDrag(t){if("mouse"===t.data.pointerType&&!r(t.data,this.pointerAction))return;const e=t.timestamp-this._lastEndTimestamp,s=40,i=this._momentum&&this._momentum.running&&e<s;switch(t.data.action){case"start":case"update":if(i)break;this._controller&&this._controller.running?t.data.timestamp-this._lastTimestamp>2&&(this._controller.update(t.data),this._lastTimestamp=t.timestamp):this._startController(t);break;case"end":case"removed":this._endController(t,!0);break;case"added":this._endController(t,!1),this._startController(t)}t.stopPropagation()}_endController(t,e){if(this._controller?.running){this._lastEndTimestamp=t.timestamp;const s=this._controller.end(t.data);e&&s&&(this._momentum=s,this._view.state.switchCameraController(this._momentum))}this._controller=null}_startController(t){this._controller=this._createController(),this._view.state.switchCameraController(this._controller),this._controller.begin(t.data),this._lastTimestamp=t.timestamp}_createController(){return this._view.state.isGlobal?new t({view:this._view}):new e({view:this._view})}}export{i as PinchAndPanNavigation};
5
+ import{PinchAndPanControllerGlobal as t}from"../../state/controllers/PinchAndPanControllerGlobal.js";import{PinchAndPanControllerLocal as e}from"../../state/controllers/PinchAndPanControllerLocal.js";import{InputHandler as s}from"../../../input/InputHandler.js";import{eventMatchesMousePointerActions as r}from"../../../input/handlers/support.js";class i extends s{constructor(t,e,s){super(!0),this._view=t,this.pointerActions=e,this._lastEndTimestamp=0,this._lastTimestamp=0,this.registerIncoming("drag",s,(t=>this._handleDrag(t)))}_handleDrag(t){if("mouse"===t.data.pointerType&&!r(t.data,this.pointerActions))return;const e=t.timestamp-this._lastEndTimestamp,s=40,i=this._momentum&&this._momentum.running&&e<s;switch(t.data.action){case"start":case"update":if(i)break;this._controller&&this._controller.running?t.data.timestamp-this._lastTimestamp>2&&(this._controller.update(t.data),this._lastTimestamp=t.timestamp):this._startController(t);break;case"end":case"removed":this._endController(t,!0);break;case"added":this._endController(t,!1),this._startController(t)}t.stopPropagation()}_endController(t,e){if(this._controller?.running){this._lastEndTimestamp=t.timestamp;const s=this._controller.end(t.data);e&&s&&(this._momentum=s,this._view.state.switchCameraController(this._momentum))}this._controller=null}_startController(t){this._controller=this._createController(),this._view.state.switchCameraController(this._controller),this._controller.begin(t.data),this._lastTimestamp=t.timestamp}_createController(){return this._view.state.isGlobal?new t({view:this._view}):new e({view:this._view})}}export{i as PinchAndPanNavigation};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../core/Error.js";const r=()=>import("./layers/TileLayerView3D.js"),a=()=>import("./layers/ElevationLayerView3D.js"),i={"base-dynamic":()=>import("./layers/BaseDynamicLayerView3D.js"),"base-elevation":a,"base-tile":r,"bing-maps":r,"building-scene":()=>import("./layers/BuildingSceneLayerView3D.js"),catalog:()=>import("./layers/CatalogLayerView3D.js"),"catalog-dynamic-group":()=>import("./layers/CatalogDynamicGroupLayerView3D.js"),"catalog-footprint":()=>import("./layers/CatalogFootprintLayerView3D.js"),csv:()=>import("./layers/CSVLayerView3D.js"),dimension:()=>import("./layers/DimensionLayerView3D.js"),elevation:a,feature:()=>import("./layers/FeatureLayerView3D.js"),focusArea:()=>import("./layers/FocusAreaLayerView3D.js"),geojson:()=>import("./layers/GeoJSONLayerView3D.js"),graphics:()=>import("./layers/GraphicsLayerView3D.js"),group:()=>import("../layers/GroupLayerView.js"),imagery:()=>import("./layers/ImageryLayerView3D.js"),"integrated-mesh":()=>import("./layers/IntegratedMeshLayerView3D.js"),"integrated-mesh-3dtiles":()=>import("./layers/IntegratedMesh3DTilesLayerView3D.js"),"line-of-sight":()=>import("./layers/LineOfSightLayerView3D.js"),"map-image":()=>import("./layers/MapImageLayerView3D.js"),media:()=>import("./layers/MediaLayerView3D.js"),"ogc-feature":()=>import("./layers/OGCFeatureLayerView3D.js"),"open-street-map":r,"oriented-imagery":()=>import("./layers/FeatureLayerView3D.js"),"point-cloud":()=>import("./layers/PointCloudLayerView3D.js"),viewshed:()=>import("./layers/ViewshedLayerView3D.js"),voxel:()=>import("./layers/VoxelLayerView3D.js"),route:()=>import("./layers/RouteLayerView3D.js"),scene:e=>null==e.profile||"mesh-pyramids"===e.profile?import("./layers/SceneLayerView3D.js"):import("./layers/SceneLayerGraphicsView3D.js"),stream:()=>import("./layers/StreamLayerView3D.js"),tile:r,"imagery-tile":()=>import("./layers/ImageryTileLayerView3D.js"),"vector-tile":()=>import("./layers/VectorTileLayerView3D.js"),wcs:()=>import("./layers/ImageryTileLayerView3D.js"),"web-tile":r,wfs:()=>import("./layers/WFSLayerView3D.js"),wms:()=>import("./layers/WMSLayerView3D.js"),wmts:()=>import("./layers/WMTSLayerView3D.js"),parquet:null,"geo-rss":null,kml:null,"knowledge-graph":null,"link-chart":null,"knowledge-graph-sublayer":null,"map-notes":null,"subtype-group":null,unknown:null,unsupported:null,video:null};function s(r){const a=r.declaredClass?r.declaredClass.slice(r.declaredClass.lastIndexOf(".")+1):"Unknown",i=a.replaceAll(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();return new e(`${i}:view-not-supported`,`${a} is not supported in 3D`)}const l={hasLayerViewModule:e=>null!=i[e.type],importLayerView:e=>{const r=i[e.type];if(null==r)throw s(e);return r(e)}};export{l as layerView3DImporter};
5
+ import e from"../../core/Error.js";const r=()=>import("./layers/TileLayerView3D.js"),a=()=>import("./layers/ElevationLayerView3D.js"),i={"base-dynamic":()=>import("./layers/BaseDynamicLayerView3D.js"),"base-elevation":a,"base-tile":r,"bing-maps":r,"building-scene":()=>import("./layers/BuildingSceneLayerView3D.js"),catalog:()=>import("./layers/CatalogLayerView3D.js"),"catalog-dynamic-group":()=>import("./layers/CatalogDynamicGroupLayerView3D.js"),"catalog-footprint":()=>import("./layers/CatalogFootprintLayerView3D.js"),csv:()=>import("./layers/CSVLayerView3D.js"),dimension:()=>import("./layers/DimensionLayerView3D.js"),elevation:a,feature:()=>import("./layers/FeatureLayerView3D.js"),focusArea:()=>import("./layers/FocusAreaLayerView3D.js"),geojson:()=>import("./layers/GeoJSONLayerView3D.js"),graphics:()=>import("./layers/GraphicsLayerView3D.js"),group:()=>import("./layers/GroupLayerView3D.js"),imagery:()=>import("./layers/ImageryLayerView3D.js"),"integrated-mesh":()=>import("./layers/IntegratedMeshLayerView3D.js"),"integrated-mesh-3dtiles":()=>import("./layers/IntegratedMesh3DTilesLayerView3D.js"),"line-of-sight":()=>import("./layers/LineOfSightLayerView3D.js"),"map-image":()=>import("./layers/MapImageLayerView3D.js"),media:()=>import("./layers/MediaLayerView3D.js"),"ogc-feature":()=>import("./layers/OGCFeatureLayerView3D.js"),"open-street-map":r,"oriented-imagery":()=>import("./layers/FeatureLayerView3D.js"),"point-cloud":()=>import("./layers/PointCloudLayerView3D.js"),viewshed:()=>import("./layers/ViewshedLayerView3D.js"),voxel:()=>import("./layers/VoxelLayerView3D.js"),route:()=>import("./layers/RouteLayerView3D.js"),scene:e=>null==e.profile||"mesh-pyramids"===e.profile?import("./layers/SceneLayerView3D.js"):import("./layers/SceneLayerGraphicsView3D.js"),stream:()=>import("./layers/StreamLayerView3D.js"),tile:r,"imagery-tile":()=>import("./layers/ImageryTileLayerView3D.js"),"vector-tile":()=>import("./layers/VectorTileLayerView3D.js"),wcs:()=>import("./layers/ImageryTileLayerView3D.js"),"web-tile":r,wfs:()=>import("./layers/WFSLayerView3D.js"),wms:()=>import("./layers/WMSLayerView3D.js"),wmts:()=>import("./layers/WMTSLayerView3D.js"),parquet:null,"geo-rss":null,kml:null,"knowledge-graph":null,"link-chart":null,"knowledge-graph-sublayer":null,"map-notes":null,"subtype-group":null,unknown:null,unsupported:null,video:null};function s(r){const a=r.declaredClass?r.declaredClass.slice(r.declaredClass.lastIndexOf(".")+1):"Unknown",i=a.replaceAll(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();return new e(`${i}:view-not-supported`,`${a} is not supported in 3D`)}const l={hasLayerViewModule:e=>null!=i[e.type],importLayerView:e=>{const r=i[e.type];if(null==r)throw s(e);return r(e)}};export{l as layerView3DImporter};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
+ */
5
+ import{_ as r}from"../../../chunks/tslib.es6.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import e from"../../layers/GroupLayerView.js";let t=class extends e{constructor(){super(...arguments),this.type="group"}};r([o()],t.prototype,"view",void 0),t=r([s("esri.views.3d.layers.GroupLayerView3D")],t);const p=t;export{p as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import"../../../../core/has.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{normalFromMat4 as r,fromMat4 as o}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromTranslation as a,multiply as s,invert as i,getTranslation as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c,IDENTITY as u,clone as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as f}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{i as p,g as h,h as d,t as g,q as x,n as _,b as T,f as b,d as y,e as v}from"../../../../chunks/vec32.js";import{ZEROS as w,ONES as R,create as M}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as j}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{canProjectWithoutEngine as A}from"../../../../geometry/projection.js";import{computeTranslationToOriginAndRotation as C}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as P}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToPoint as E}from"../../../../geometry/projection/projectVectorToPoint.js";import{create as O,fromBuffer as I,intersectsClippingArea as N}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as S}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as U,getContinuousIndexArray as B}from"../../../../geometry/support/Indices.js";import F from"../../../../geometry/support/MeshComponent.js";import D from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import G from"../../../../geometry/support/MeshTextureTransform.js";import{isRelativeVertexSpace as L,isAbsoluteVertexSpace as V}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{equals as $,isPlateCarree as H}from"../../../../geometry/support/spatialReferenceUtils.js";import{t as k}from"../../../../chunks/vec3.js";import{transformNormal as q,transformVectorENUPlateCarree as z,VectorType as W,transformVectorWMPlateCarree as Y,projectNormalToPCPF as J,transformTangent as K,projectTangentToPCPF as Q}from"../../../../geometry/support/meshUtils/projection.js";import{projectMeshVertexPositions as X}from"../../../../geometry/support/meshUtils/projectMeshVertexPositions.js";import{makeDehydratedPoint as Z}from"../../../../layers/graphics/dehydratedPoint.js";import{MeshTransformUpdateAction as ee}from"../../../../layers/graphics/sources/interfaces.js";import{ViewingMode as te}from"../../../ViewingMode.js";import{isEncodedMeshTexture as re}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as oe}from"../../glTF/internal/TextureTransformUtils.js";import{perObjectElevationAligner as ne}from"./ElevationAligners.js";import{needsElevationUpdates3D as ae,evaluateElevationInfoAtPoint as se}from"./elevationAlignmentUtils.js";import{Graphics3DMeshObject3DGraphicLayer as ie}from"./Graphics3DMeshObject3DGraphicLayer.js";import{Object3DEdgeState as le}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as ce}from"./Graphics3DSymbolLayer.js";import{MaterialInfoCache as ue,MeshFastUpdateProcessor as me}from"./MeshFastUpdateProcessor.js";import{createMaterial as fe}from"../support/edgeUtils.js";import{parseColorMixMode as pe,encodeSymbolColor as he}from"../support/symbolColorUtils.js";import{debugFlags as de}from"../../support/debugFlags.js";import{Attribute as ge}from"../../webgl-engine/lib/Attribute.js";import{AlphaDiscardMode as xe,CullFaceOptions as _e}from"../../webgl-engine/lib/basicInterfaces.js";import{ContentObjectType as Te}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as be}from"../../webgl-engine/lib/Geometry.js";import{Object3D as ye}from"../../webgl-engine/lib/Object3D.js";import{Texture as ve}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as we}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as Re}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as Me}from"../../webgl-engine/materials/NativeLineMaterial.js";import{useSchematicPBR as je,advancedMRRFactors as Ae,schematicMRRFactors as Ce}from"../../webgl-engine/materials/pbrUtils.js";import{TextureWrapMode as Pe}from"../../../webgl/enums.js";const Ee=["mesh"];class Oe extends ce{constructor(e,t,r,o){super(e,t,r,o),this._materialInfoCache=new ue,this._fastUpdateProcessor=new me,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){de.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new Me({color:[1,0,1,1]}),this._debugTangentNormalMaterial=new Me({color:[1,.5,0,1]}),this._debugFaceNormalMaterial=new Me({color:[0,1,1,1]}))}destroy(){super.destroy(),this._textures.forEach((e=>e.unload())),this._context.stage.removeMany(this._materialInfoCache.materials),this._context.stage.removeMany(Array.from(this._textures.values())),this._materialInfoCache.clear(),this._textures.clear(),this._fastUpdateProcessor.destroy(this._context.stage)}get materials(){return this._materialInfoCache.materials}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,Ee,"fill on mesh-3d"))return null;const r=this.setGraphicElevationContext(t),o=e.renderingInfo;return this._createAs3DShape(t,o,r,t.uid)}onRemoveGraphic(e){this._fastUpdateProcessor.onRemoveGraphic(e,this._materialInfoCache,this._context)}layerOpacityChanged(e,t){const r=this._getLayerOpacity();this._updateMaterialParameters((e=>{e.material.setParameters({layerOpacity:r});const t=e.material.parameters;this._setMaterialTransparentParameter(t,e),e.material.setParameters({transparent:t.transparent})})),e.forEach((e=>t(e)?.layerOpacityChanged(r,this._context.isAsync)))}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,ae)}slicePlaneEnabledChanged(e,t){return this._updateMaterialParameters((({material:e})=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})})),e.forEach((e=>t(e)?.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync))),!0}physicalBasedRenderingChanged(){const e=this._usePBR();return this._updateMaterialParameters((({material:t})=>t.setParameters({usePBR:e}))),!0}updateTransform(e,t,r,o){if(!e.fastTransformUpdatesAllowed)return!1;const n=e.fastTransformUpdatesEnabled;switch(o){case ee.EnableFastUpdates:if(n)return!0;break;case ee.DisableFastUpdates:if(!n)return!0;break;default:if(!n)return!!this.updateTransform(e,t,r,ee.EnableFastUpdates)&&(e.autoDisableFastTransformUpdates((()=>this.updateTransform(e,t,r,ee.DisableFastUpdates))),!0)}const a=this._context.renderCoordsHelper.spatialReference,s=ot,{origin:i,transform:l}=r;if(!C(t,p(Xe,i.x,i.y,i.z??0),s,a))return!1;switch(o){case ee.EnableFastUpdates:this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context);break;case ee.DisableFastUpdates:this._fastUpdateProcessor.disable(e,this._materialInfoCache,this._context);break;case ee.UpdateFastLocalOrigin:e.updateFastLocalOrigin(s,l,this._context.localOriginFactory)}const{elevationContext:c}=e;c.centerPointInElevationSR=this._getCenterPointInElevationSR(s);const{elevationProvider:u,renderCoordsHelper:m}=this._context,f=(e,t)=>se(e,u,c,m,t);return e.alignedSampledElevation=ne(e,c,u.spatialReference,f,m,s),e.updateTransform(s,l,this._context.isAsync),e.updateAutoDisableFastTransformUpdates((()=>this.updateTransform(e,t,r,ee.DisableFastUpdates))),!0}_requiresSymbolVertexColors(){return this._drivenProperties.color||this._drivenProperties.opacity}_materialPropertiesDefault(e,t){const r=this._requiresSymbolVertexColors(),o=!!e.vertexAttributes.color,n=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:r,hasVertexColors:o,hasVertexTangents:n,uid:`vc:${o},vt:${n},vct${t},svc:${r}`}}_materialProperties(e,t,r){const o=this._materialPropertiesDefault(e,r);if(!t.material)return o;const{color:n,colorTexture:a,colorTextureTransform:s,normalTexture:i,normalTextureTransform:l,doubleSided:c,alphaCutoff:u,alphaMode:m}=t.material,f=We(n),p=We(a),h=Ye(s),d=We(i),g=Ye(l);if(o.color=n,o.colorTexture=a,o.normalTexture=i,o.uid=`${o.uid},cmuid:${f},ctmuid:${p},cttuid:${h},ntmuid:${d},nttuid:${g},ds:${c},ac:${u},am:${m}`,t.material instanceof D){const{metallic:e,roughness:r,metallicRoughnessTexture:n,metallicRoughnessTextureTransform:a,emissiveColor:i,emissiveTexture:c,emissiveTextureTransform:u,occlusionTexture:m,occlusionTextureTransform:f}=t.material,p=We(n),h=Ye(a),d=We(i),g=We(c),x=Ye(u),_=We(m),T=Ye(f);o.metallic=e,o.roughness=r,o.metallicRoughnessTexture=n,o.emissiveColor=i,o.emissiveTexture=c,o.occlusionTexture=m,o.colorTextureTransform=Ve(s),o.normalTextureTransform=Ve(l),o.emissiveTextureTransform=Ve(u),o.occlusionTextureTransform=Ve(f),o.metallicRoughnessTextureTransform=Ve(a),o.uid=`${o.uid},mrm:${e},mrr:${r},mrt:${p},mrtt:${h},emuid:${d},etmuid:${g},ett:${x},otmuid:${_},ott:${T}`}return o}_getInternalTextureId(e){const t=this._getInternalTexture(e,xe.Opaque);return t?.id}_getInternalTexture(e,t){const r=ze(e);if(!r)return null;const o=`${e.contentHash}/${t}`;let n=this._textures.get(o);if(!n){let a=null;const s=this._context.stage.renderView.renderingContext.parameters.maxMaxAnisotropy,i={wrap:$e(e.wrap),noUnpackFlip:!0,maxAnisotropy:s,mipmap:s>1};re(r)?(a=r.data,i.preMultiplyAlpha=!1,i.encoding=r.encoding):(a=r,i.preMultiplyAlpha=t!==xe.Opaque,i.downsampleUncompressed=this._context.graphicsCoreOwner.view.qualitySettings.graphics3D.uncompressedTextureDownsamplingEnabled),n=new ve(a,i),this._textures.set(o,n),n.load(this._context.stage.renderView.renderingContext),this._context.stage.add(n),n.events.on("unloaded",(()=>{this._textures.delete(o)}))}return n}_setInternalMaterialTextureParameters(t,r){if(null!=t.colorTexture){const e=this._getInternalTexture(t.colorTexture,r.textureAlphaMode);e?(r.textureId=e.id,r.textureAlphaPremultiplied=!!e.parameters.preMultiplyAlpha):r.textureId=void 0}t.normalTexture&&(r.normalTextureId=this._getInternalTextureId(t.normalTexture)),t.emissiveColor&&(r.emissiveFactor=e.toUnitRGB(t.emissiveColor)),t.emissiveTexture&&(r.emissiveTextureId=this._getInternalTextureId(t.emissiveTexture)),t.occlusionTexture&&(r.occlusionTextureId=this._getInternalTextureId(t.occlusionTexture)),t.metallicRoughnessTexture&&(r.metallicRoughnessTextureId=this._getInternalTextureId(t.metallicRoughnessTexture))}_setInternalMaterialParameters(e,t){null!=e.color&&qe(e.color,t),this._setInternalMaterialTextureParameters(e,t),t.colorTextureTransformMatrix=oe(e.colorTextureTransform),t.normalTextureTransformMatrix=oe(e.normalTextureTransform);const r=null!=e.normalTextureTransform?.scale?e.normalTextureTransform?.scale:f;t.scale=[r[0],r[1]],t.occlusionTextureTransformMatrix=oe(e.occlusionTextureTransform),t.emissiveTextureTransformMatrix=oe(e.emissiveTextureTransform),t.metallicRoughnessTextureTransformMatrix=oe(e.metallicRoughnessTextureTransform)}_setExternalMaterialParameters(t){const r=this._drivenProperties.color;let o=this.symbolLayer.material?.colorMixMode??null;if(r)t.externalColor=j;else{const r=this.symbolLayer.material?.color??null;r?t.externalColor=e.toUnitRGBA(r):(o=null,t.externalColor=j)}o&&(t.colorMixMode=o),t.castShadows=!!this.symbolLayer.castShadows}_getOrCreateMaterial(t,r){const o=r.material?.color,n=r.material?.colorTexture,a=r.material?.alphaMode,s="blend"===a,i=!("opaque"===a)&&(ke(t)||null!=o&&o.a<1||n?.transparent||s),l=this._materialProperties(t,r,i),c=this._materialInfoCache.byUid(l.uid);if(c)return this._setInternalMaterialTextureParameters(l,c.material.parameters),c.material;const u={uid:l.uid,material:null,isComponentTransparent:i,alphaMode:r.material?r.material.alphaMode:"opaque"},m=je({normalTexture:l.normalTexture,metallicRoughnessTexture:l.metallicRoughnessTexture,metallicFactor:l.metallic,roughnessFactor:l.roughness,emissiveTexture:l.emissiveTexture,emissiveFactor:e.toUnitRGB(l.emissiveColor),occlusionTexture:l.occlusionTexture}),f={usePBR:this._usePBR(),isSchematic:m,hasVertexColors:l.hasVertexColors,hasSymbolColors:l.hasSymbolVertexColors,hasVertexTangents:l.hasVertexTangents,ambient:w,diffuse:R,opacity:1,doubleSided:!0,doubleSidedType:"winding-order",cullFace:_e.None,layerOpacity:this._getLayerOpacity(),hasSlicePlane:this._context.slicePlaneEnabled,initTextureTransparent:!0};f.mrrFactors=m?Ce:[l.metallic,l.roughness,Ae[2]],r.material&&(f.doubleSided=r.material.doubleSided,f.cullFace=r.material.doubleSided?_e.None:_e.Back,f.textureAlphaCutoff=r.material.alphaCutoff),this._setExternalMaterialParameters(f),this._setMaterialTransparentParameter(f,u),this._setInternalMaterialParameters(l,f);const p=new Re(f,this._context);return u.material=p,this._materialInfoCache.set(l.uid,u),this._context.stage.add(p),p}_usePBR(){return this._context.physicalBasedRenderingEnabled}_setMaterialTransparentParameter(e,t){e.transparent=this.needsDrivenTransparentPass||t.isComponentTransparent||e.layerOpacity<1||e.opacity<1||e.externalColor&&e.externalColor[3]<1,"auto"===t.alphaMode?e.textureAlphaMode=e.transparent?xe.MaskBlend:xe.Opaque:e.textureAlphaMode="opaque"===t.alphaMode?xe.Opaque:"mask"===t.alphaMode?xe.Mask:xe.Blend}_createFaceDebugNormals(e,t){const o=t.length,a=e.spatialReference.isGeographic?20015077/180:1,s=.1*Math.max(e.extent.width*a,e.extent.height*a,e.extent.zmax-e.extent.zmin),i=[],l=[],c=t[0].transformation,u=r(n(),c);for(let r=0;r<o;r++){const e=t[r].attributes.get(we.POSITION);if(!e)continue;const o=e.data,n=e.indices;for(let t=0;t<n.length;t+=3)Ge(o,n,t,tt),De(o,n,t,Xe,Ze,et),h(Xe,Xe,Ze),h(Xe,Xe,et),d(Xe,Xe,1/3),g(Xe,Xe,c),i.push(...Xe),x(tt,tt,u),_(tt,tt),T(Xe,Xe,tt,s),i.push(...Xe),l.push(l.length),l.push(l.length)}return i.length?new be(this._debugFaceNormalMaterial,[[we.POSITION,new ge(i,l,3,!0)]],null,Te.Line):null}_createPerVertexDebugVectors(e,t,a,s,i){const l=t.length,c=e.spatialReference.isGeographic?20015077/180:1,u=.1*i*Math.max(e.extent.width*c,e.extent.height*c,e.extent.zmax-e.extent.zmin),m=[],f=[],h=t[0].transformation,d=r(n(),h);a===we.TANGENT&&o(d,h);for(let r=0;r<l;r++){const e=t[r],o=e.attributes.get(we.POSITION),n=e.attributes.get(a);if(!o||!n)continue;const s=o.data,i=o.indices,l=n.data,c=n.indices;for(let t=0;t<i.length;t++){const e=3*i[t],r=c[t]*n.stride;p(Xe,s[e+0],s[e+1],s[e+2]),g(Xe,Xe,h),m.push(...Xe),p(Ze,l[r+0],l[r+1],l[r+2]),x(Ze,Ze,d),_(Ze,Ze),T(Xe,Xe,Ze,u),m.push(...Xe),f.push(f.length),f.push(f.length)}}return m.length?new be(s,[[we.POSITION,new ge(m,f,3,!0)]],null,Te.Line):null}_createAs3DShape(e,t,r,o){const n=e.geometry;if("mesh"!==n.type)return null;const a=this._createGeometryInfo(n,t,o);if(null==a)return null;const{geometries:s,objectTransformation:i}=a;if(de.DRAW_MESH_GEOMETRY_NORMALS){const e=this._createPerVertexDebugVectors(n,s,we.NORMAL,this._debugVertexNormalMaterial,1),t=this._createPerVertexDebugVectors(n,s,we.TANGENT,this._debugTangentNormalMaterial,.5),r=this._createFaceDebugNormals(n,s);e&&s.push(e),t&&s.push(t),r&&s.push(r)}const l=new ye({geometries:s,layerUid:this._context.layer.uid,graphicUid:o,isElevationSource:!0});l.transformation=i;const c=fe(this.symbolLayer,{opacity:this._getLayerOpacity()}),u=c?new le(s[0].material,c,this._context.slicePlaneEnabled):null,m=new ie(this,l,s,null,null,ne,r,u);this._fastUpdateProcessor.onAddGraphic(),m.needsElevationUpdates=ae(r.mode),m.useObjectOriginAsAttachmentOrigin=!0,m.fastTransformUpdatesAllowed=this._fastTransformUpdatesAllowed(n),r.centerPointInElevationSR=this._getCenterPointInElevationSR(l.transformation);const{elevationProvider:f,renderCoordsHelper:p}=this._context,h=(e,t)=>se(e,f,r,p,t);return m.alignedSampledElevation=ne(m,r,f.spatialReference,h,p),m}_fastTransformUpdatesAllowed(e){const{vertexSpace:t,spatialReference:r}=e;if(!L(t))return!1;const{type:o}=t,{view:n}=this._context.graphicsCoreOwner,{viewingMode:a}=n.state,s=n.spatialReference;return a===te.Global&&"local"===o||a===te.Local&&$(s,r)&&"georeferenced"===o&&!r.isGeographic}_getCenterPointInElevationSR(e){const t=Z(0,0,0,null!=this._context.elevationProvider.spatialReference?this._context.elevationProvider.spatialReference:null);return E([e[12],e[13],e[14]],this._context.renderCoordsHelper.spatialReference,t),t}_passthroughReprojectionInfo(e){return e.reprojection===st.NONE&&!!e.objectTransformation}_createPositionBuffer(e,t){const r=e.vertexAttributes.position;let o=r,n=null;if(t.reprojection===st.NONE)return{position:o,georeferencedPositionBuffer:n};const a=t.reprojection===st.RENDER?t.transformBeforeProject:null;a&&(o=k(new Float64Array(o.length),o,a));const{normal:s,tangent:i}=e.vertexAttributes;this._passthroughReprojectionInfo(t)||!s&&!i||(n=o);const l=o===r||o===n?new Float64Array(o.length):o;return P(o,e.spatialReference,0,l,this._context.renderCoordsHelper.spatialReference,0),{position:l,georeferencedPositionBuffer:n}}_createNormalBuffer(e,t,r,o){const n=e.vertexAttributes.normal;if(null==n)return null;let a=n;const s=o.reprojection===st.RENDER?o.transformBeforeProject:null;s&&(a=q(a,new Float32Array(a.length),s));const i=this._context.graphicsCoreOwner.view.viewingMode;if(o.reprojection===st.NONE)return a;if("local"===i){if(!H(this._context.renderCoordsHelper.spatialReference))return a;if(null==r)return null;if(e.spatialReference.isGeographic){const e=a===n?new Float32Array(a.length):a;return z(a,W.NORMAL,r,e)}if(e.spatialReference.isWebMercator){const e=a===n?new Float32Array(a.length):a;return Y(a,W.NORMAL,r,e)}return a}if(null==r)return null;const l=a===n?new Float32Array(a.length):a,c=this._context.renderCoordsHelper.spatialReference;return J(a,r,e.spatialReference,t,c,l)}_createTangentBuffer(e,t,r,o){const n=e.vertexAttributes.tangent;if(null==n)return null;let a=n;const s=o.reprojection===st.RENDER?o.transformBeforeProject:null;s&&(a=K(a,new Float32Array(a.length),s));const i=this._context.graphicsCoreOwner.view.viewingMode;if(o.reprojection===st.NONE)return a;if("local"===i){if(!H(this._context.renderCoordsHelper.spatialReference))return a;if(null==r)return null;if(e.spatialReference.isGeographic){const e=a===n?new Float32Array(a.length):a;return z(a,W.TANGENT,r,e)}if(e.spatialReference.isWebMercator){const e=a===n?new Float32Array(a.length):a;return Y(a,W.TANGENT,r,e)}return a}if(null==r)return null;const l=a===n?new Float32Array(a.length):a,c=this._context.renderCoordsHelper.spatialReference;return Q(a,r,e.spatialReference,t,c,l)}_createSymbolColorBuffer(e){if(this._requiresSymbolVertexColors()){const t=this._getVertexOpacityAndColor(e),r=pe(this.symbolLayer?.material?.colorMixMode),o=new Uint8Array(4);return he(t,r,o),o}return null}_createBuffers(e,t){const r=e.vertexAttributes&&e.vertexAttributes.position;if(!r)return this.logger.warn("Mesh geometry must contain position vertex attributes"),null;const o=e.vertexAttributes.normal,n=e.vertexAttributes.uv,a=e.vertexAttributes.tangent;if(o&&o.length!==r.length)return this.logger.warn("Mesh normal vertex buffer must contain the same number of elements as the position buffer"),null;if(a&&a.length/4!=r.length/3)return this.logger.warn("Mesh tangent vertex buffer must contain the same number of elements as the position buffer"),null;if(n&&n.length/2!=r.length/3)return this.logger.warn("Mesh uv vertex buffer must contain the same number of elements as the position buffer"),null;const s=this._computeReprojectionInfo(e),{position:i,georeferencedPositionBuffer:l}=this._createPositionBuffer(e,s),u=Je(e),m=this._createSymbolColorBuffer(t),f=this._createNormalBuffer(e,i,l,s),p=this._createTangentBuffer(e,i,l,s),h=n,{transformation:d,position:g,normal:x,tangent:_}=this._passthroughReprojectionInfo(s)?{transformation:s.objectTransformation,position:i,normal:f,tangent:p}:this._transformOriginLocal(e,i,f,p);return{positionBuffer:g,normalBuffer:x,tangentBuffer:_,uvBuffer:h,colorBuffer:u,symbolColorBuffer:m,objectTransformation:d,geometryTransformation:s.reprojection===st.NONE&&s.geometryTransformation?s.geometryTransformation:c()}}_computeReprojectionInfo(e){const{vertexSpace:t}=e,r="georeferenced"===t.type?$(this._context.renderCoordsHelper.spatialReference,e.spatialReference)?st.NONE:st.RENDER:st.NONE;if(V(t))return{reprojection:r};const o=t.origin,n=c(),i=e.transform?.localMatrix??u;if(r===st.NONE){C(e.spatialReference,o,n,this._context.renderCoordsHelper.spatialReference);return{reprojection:r,objectTransformation:n,geometryTransformation:m(i)}}const l=a(c(),o);return s(l,l,i),{reprojection:r,transformBeforeProject:l}}_transformOriginLocal(e,t,r,o){const n=this._context.renderCoordsHelper.spatialReference,a=e.origin;Qe[0]=a.x,Qe[1]=a.y,Qe[2]=a.z??0;const s=c();C(e.spatialReference,Qe,s,n),i(rt,s);const{position:l,normal:u,tangent:m}=e.vertexAttributes,f=t===l?new Float64Array(t.length):t;k(f,t,rt);const p=r?r===u?new Float32Array(r.length):r:null,h=o?o===m?new Float32Array(o.length):o:null;return r&&p&&q(r,p,rt),o&&h&&K(o,h,rt),{transformation:s,position:f,normal:p,tangent:h}}_validateFaces(e,t){const r=e.vertexAttributes.position.length/3,o=t.faces;if(o){let e=-1;for(let t=0;t<o.length;t++){const r=o[t];r>e&&(e=r)}if(r<=e)return this.logger.warn(`Vertex index ${e} is out of bounds of the mesh position buffer`),!1}else if(r%3!=0)return this.logger.warn("Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)"),!1;return!0}_isOutsideClippingArea(e){if(!this._context.clippingExtent)return!1;const t=e.vertexAttributes?.position;if(!t)return!1;const r=this._context.elevationProvider.spatialReference,o=X(e,r??e.spatialReference);return!!o&&(I(o,nt),!N(nt,this._context.clippingExtent))}_createGeometryInfo(e,t,r){if(!A(e.spatialReference,this._context.renderCoordsHelper.spatialReference))return this.logger.warn("Geometry spatial reference is not compatible with the view"),null;if(!this._validateVertexSpace(e))return null;if(this._isOutsideClippingArea(e))return null;const o=this._createBuffers(e,t);if(null==o)return null;const{positionBuffer:n,uvBuffer:a,colorBuffer:s,symbolColorBuffer:i,normalBuffer:c,tangentBuffer:u,objectTransformation:m,geometryTransformation:f}=o,p=Le(e),h=new Array;let d=!1;const g=l(Xe,m),x=this._context.localOriginFactory.getOrigin(g);for(const l of p){if(!this._validateFaces(e,l))return null;const t=Ne(e,l);if(0===t.length)continue;const o=Se(n,c,l,t);o.didFlipNormals&&(d=!0);const m=[[we.POSITION,new ge(n,t,3,!0)],[we.NORMAL,new ge(o.normals,o.indices,3,!0)]];s&&m.push([we.COLOR,new ge(s,t,4,!0)]),i&&m.push([we.SYMBOLCOLOR,new ge(i,U(t.length),4,!0)]),a&&m.push([we.UV0,new ge(a,t,2,!0)]),u&&m.push([we.TANGENT,new ge(u,t,4,!0)]);const p=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:r,layerUid:this._context.layer.uid}),g=this._getOrCreateMaterial(e,l),_=new be(g,m,null,Te.Mesh,p);_.transformation=f,_.localOrigin=x,h.push(_)}return d&&this.logger.warn("Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals."),{geometries:h,objectTransformation:m}}_updateMaterialParameters(e){this._materialInfoCache.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachClonedMaterial(((e,t)=>{t.setParameters(e.parameters)}))}_validateVertexSpace(e){const{_context:{graphicsCoreOwner:{view:{state:{viewingMode:t}}}}}=this,{vertexSpace:r}=e;return t!==te.Local||"local"!==r.type||(this.logger.warn("Displaying a mesh with a local vertex space in a view in local viewing mode is not supported."),!1)}test(){return{...super.test(),materials:this._materialInfoCache.materials}}}class Ie{constructor(e,t,r){this.normals=e,this.indices=t,this.didFlipNormals=r}}function Ne(e,t){return t.faces??B(e.vertexAttributes.position.length/3)}function Se(e,t,r,o){switch(r.shading||"flat"){default:case"source":return Be(e,t,r,o);case"flat":return Ue(e,o);case"smooth":return Fe(e,o)}}function Ue(e,t){const r=S(t.length),o=new Array(3*t.length);for(let n=0;n<t.length;n+=3){const a=Ge(e,t,n,tt);for(let e=0;e<3;e++)r[n+e]=a[e],o[n+e]=n/3}return new Ie(r,o,!1)}function Be(e,t,r,o){if(null==t)return Ue(e,o);let n=!1;if(!r.trustSourceNormals)for(let a=0;a<o.length;a+=3){Ge(e,o,a,tt);for(let e=0;e<3;e++){const r=3*o[a+e];Xe[0]=t[r],Xe[1]=t[r+1],Xe[2]=t[r+2],b(tt,Xe)<0&&(t[r]=-t[r],t[r+1]=-t[r+1],t[r+2]=-t[r+2],n=!0)}}return new Ie(t,o,n)}function Fe(e,t){const r={};for(let a=0;a<t.length;a+=3){const o=Ge(e,t,a,tt);for(let e=0;e<3;e++){const n=t[a+e];let s=r[n];s||(s={normal:M(),count:0},r[n]=s),h(s.normal,s.normal,o),s.count++}}const o=S(3*t.length),n=new Array(3*t.length);for(let a=0;a<t.length;a++){const e=r[t[a]];1!==e.count&&(_(e.normal,e.normal),e.count=1);for(let t=0;t<3;t++)o[3*a+t]=e.normal[t];n[a]=a}return new Ie(o,n,!1)}function De(e,t,r,o,n,a){const s=3*t[r],i=3*t[r+1],l=3*t[r+2];o[0]=e[s],o[1]=e[s+1],o[2]=e[s+2],n[0]=e[i],n[1]=e[i+1],n[2]=e[i+2],a[0]=e[l],a[1]=e[l+1],a[2]=e[l+2]}function Ge(e,t,r,o){return De(e,t,r,Xe,Ze,et),y(Ze,Ze,Xe),y(et,et,Xe),v(Xe,Ze,et),_(o,Xe),o}function Le(e){return e.components??at}function Ve(e){if(!e)return null;const{scale:r,offset:o,rotation:n}=e;return{scale:r,offset:o,rotation:t(n)}}function $e(e="repeat"){if("string"==typeof e){const t=He(e);return{s:t,t}}return{s:He(e.horizontal),t:He(e.vertical)}}function He(e){switch(e){case"clamp":return Pe.CLAMP_TO_EDGE;case"mirror":return Pe.MIRRORED_REPEAT;default:return Pe.REPEAT}}function ke(e){const t=e.vertexAttributes.color;if(null==t)return!1;for(let r=3;r<t.length;r+=4)if(255!==t[r])return!0;return!1}function qe(t,r){r.diffuse=e.toUnitRGB(t),r.opacity=t.a}function ze(e){return e.data??e.url}function We(t){return null==t?"-":t instanceof e?t.toHex():t.contentHash}function Ye(e){const{offset:t,scale:r,rotation:o}=e??Ke;return`${t[0]},${t[1]},${o},${r[0]},${r[1]}`}function Je(e){return e.vertexAttributes.color}const Ke=new G,Qe=M(),Xe=M(),Ze=M(),et=M(),tt=M(),rt=c(),ot=c(),nt=O(),at=[new F];var st;!function(e){e[e.NONE=0]="NONE",e[e.RENDER=1]="RENDER"}(st||(st={}));export{Oe as Graphics3DMeshFillSymbolLayer};
5
+ import e from"../../../../Color.js";import"../../../../core/has.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{normalFromMat4 as r,fromMat4 as o}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromTranslation as a,multiply as s,invert as i,getTranslation as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c,IDENTITY as u,clone as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as f}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{i as p,g as h,h as d,t as g,q as x,n as _,b as T,f as b,d as y,e as v}from"../../../../chunks/vec32.js";import{ZEROS as w,ONES as R,create as M}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as j}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{canProjectWithoutEngine as A}from"../../../../geometry/projection.js";import{computeTranslationToOriginAndRotation as C}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as P}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToPoint as E}from"../../../../geometry/projection/projectVectorToPoint.js";import{create as O,fromBuffer as I,intersectsClippingArea as N}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as S}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as U,getContinuousIndexArray as B}from"../../../../geometry/support/Indices.js";import F from"../../../../geometry/support/MeshComponent.js";import D from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import G from"../../../../geometry/support/MeshTextureTransform.js";import{isRelativeVertexSpace as L,isAbsoluteVertexSpace as V}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{equals as $,isPlateCarree as H}from"../../../../geometry/support/spatialReferenceUtils.js";import{t as k}from"../../../../chunks/vec3.js";import{transformNormal as q,transformVectorENUPlateCarree as z,VectorType as W,transformVectorWMPlateCarree as Y,projectNormalToPCPF as J,transformTangent as K,projectTangentToPCPF as Q}from"../../../../geometry/support/meshUtils/projection.js";import{projectMeshVertexPositions as X}from"../../../../geometry/support/meshUtils/projectMeshVertexPositions.js";import{makeDehydratedPoint as Z}from"../../../../layers/graphics/dehydratedPoint.js";import{MeshTransformUpdateAction as ee}from"../../../../layers/graphics/sources/interfaces.js";import{ViewingMode as te}from"../../../ViewingMode.js";import{isEncodedMeshTexture as re}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as oe}from"../../glTF/internal/TextureTransformUtils.js";import{perObjectElevationAligner as ne}from"./ElevationAligners.js";import{needsElevationUpdates3D as ae,evaluateElevationInfoAtPoint as se}from"./elevationAlignmentUtils.js";import{Graphics3DMeshObject3DGraphicLayer as ie}from"./Graphics3DMeshObject3DGraphicLayer.js";import{Object3DEdgeState as le}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as ce}from"./Graphics3DSymbolLayer.js";import{MaterialInfoCache as ue,MeshFastUpdateProcessor as me}from"./MeshFastUpdateProcessor.js";import{createMaterial as fe}from"../support/edgeUtils.js";import{parseColorMixMode as pe,encodeSymbolColor as he}from"../support/symbolColorUtils.js";import{debugFlags as de}from"../../support/debugFlags.js";import{Attribute as ge}from"../../webgl-engine/lib/Attribute.js";import{AlphaDiscardMode as xe,CullFaceOptions as _e}from"../../webgl-engine/lib/basicInterfaces.js";import{ContentObjectType as Te}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as be}from"../../webgl-engine/lib/Geometry.js";import{Object3D as ye}from"../../webgl-engine/lib/Object3D.js";import{Texture as ve}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as we}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as Re}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as Me}from"../../webgl-engine/materials/NativeLineMaterial.js";import{useSchematicPBR as je,advancedMRRFactors as Ae,schematicMRRFactors as Ce}from"../../webgl-engine/materials/pbrUtils.js";import{TextureWrapMode as Pe}from"../../../webgl/enums.js";const Ee=["mesh"];class Oe extends ce{constructor(e,t,r,o){super(e,t,r,o),this._materialInfoCache=new ue,this._fastUpdateProcessor=new me,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){de.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new Me({color:[1,0,1,1]}),this._debugTangentNormalMaterial=new Me({color:[1,.5,0,1]}),this._debugFaceNormalMaterial=new Me({color:[0,1,1,1]}))}destroy(){super.destroy(),this._textures.forEach((e=>e.unload())),this._context.stage.removeMany(this._materialInfoCache.materials),this._context.stage.removeMany(Array.from(this._textures.values())),this._materialInfoCache.clear(),this._textures.clear(),this._fastUpdateProcessor.destroy(this._context.stage)}get materials(){return this._materialInfoCache.materials}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,Ee,"fill on mesh-3d"))return null;const r=this.setGraphicElevationContext(t),o=e.renderingInfo;return this._createAs3DShape(t,o,r,t.uid)}onRemoveGraphic(e){this._fastUpdateProcessor.onRemoveGraphic(e,this._materialInfoCache,this._context)}layerOpacityChanged(e,t){const r=this._getLayerOpacity();this._updateMaterialParameters((e=>{e.material.setParameters({layerOpacity:r});const t=e.material.parameters;this._setMaterialTransparentParameter(t,e),e.material.setParameters({transparent:t.transparent})})),e.forEach((e=>t(e)?.layerOpacityChanged(r,this._context.isAsync)))}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,ae)}slicePlaneEnabledChanged(e,t){return this._updateMaterialParameters((({material:e})=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})})),e.forEach((e=>t(e)?.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync))),!0}physicalBasedRenderingChanged(){const e=this._usePBR();return this._updateMaterialParameters((({material:t})=>t.setParameters({usePBR:e}))),!0}updateTransform(e,t,r,o){if(!e.fastTransformUpdatesAllowed)return!1;const n=e.fastTransformUpdatesEnabled;switch(o){case ee.EnableFastUpdates:if(n)return!0;break;case ee.DisableFastUpdates:if(!n)return!0;break;default:if(!n)return!!this.updateTransform(e,t,r,ee.EnableFastUpdates)&&(e.autoDisableFastTransformUpdates((()=>this.updateTransform(e,t,r,ee.DisableFastUpdates))),!0)}const a=this._context.renderCoordsHelper.spatialReference,s=ot,{origin:i,transform:l}=r;if(!C(t,p(Xe,i.x,i.y,i.z??0),s,a))return!1;switch(o){case ee.EnableFastUpdates:this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context);break;case ee.DisableFastUpdates:this._fastUpdateProcessor.disable(e,this._materialInfoCache,this._context);break;case ee.UpdateFastLocalOrigin:e.updateFastLocalOrigin(s,l,this._context.localOriginFactory)}const{elevationContext:c}=e;c.centerPointInElevationSR=this._getCenterPointInElevationSR(s);const{elevationProvider:u,renderCoordsHelper:m}=this._context,f=(e,t)=>se(e,u,c,m,t);return e.alignedSampledElevation=ne(e,c,u.spatialReference,f,m,s),e.updateTransform(s,l,this._context.isAsync),e.updateAutoDisableFastTransformUpdates((()=>this.updateTransform(e,t,r,ee.DisableFastUpdates))),!0}_requiresSymbolVertexColors(){return this._drivenProperties.color||this._drivenProperties.opacity}_materialPropertiesDefault(e,t){const r=this._requiresSymbolVertexColors(),o=!!e.vertexAttributes.color,n=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:r,hasVertexColors:o,hasVertexTangents:n,uid:`vc:${o},vt:${n},vct${t},svc:${r}`}}_materialProperties(e,t,r){const o=this._materialPropertiesDefault(e,r);if(!t.material)return o;const{color:n,colorTexture:a,colorTextureTransform:s,normalTexture:i,normalTextureTransform:l,doubleSided:c,alphaCutoff:u,alphaMode:m}=t.material,f=We(n),p=We(a),h=Ye(s),d=We(i),g=Ye(l);if(o.color=n,o.colorTexture=a,o.normalTexture=i,o.uid=`${o.uid},cmuid:${f},ctmuid:${p},cttuid:${h},ntmuid:${d},nttuid:${g},ds:${c},ac:${u},am:${m}`,t.material instanceof D){const{metallic:e,roughness:r,metallicRoughnessTexture:n,metallicRoughnessTextureTransform:a,emissiveColor:i,emissiveTexture:c,emissiveTextureTransform:u,occlusionTexture:m,occlusionTextureTransform:f}=t.material,p=We(n),h=Ye(a),d=We(i),g=We(c),x=Ye(u),_=We(m),T=Ye(f);o.metallic=e,o.roughness=r,o.metallicRoughnessTexture=n,o.emissiveColor=i,o.emissiveTexture=c,o.occlusionTexture=m,o.colorTextureTransform=Ve(s),o.normalTextureTransform=Ve(l),o.emissiveTextureTransform=Ve(u),o.occlusionTextureTransform=Ve(f),o.metallicRoughnessTextureTransform=Ve(a),o.uid=`${o.uid},mrm:${e},mrr:${r},mrt:${p},mrtt:${h},emuid:${d},etmuid:${g},ett:${x},otmuid:${_},ott:${T}`}return o}_getInternalTextureId(e){const t=this._getInternalTexture(e,xe.Opaque);return t?.id}_getInternalTexture(e,t){const r=ze(e);if(!r)return null;const o=`${e.contentHash}/${t}`;let n=this._textures.get(o);if(!n){let a=null;const s=this._context.stage.renderView.renderingContext.parameters.maxMaxAnisotropy,i={wrap:$e(e.wrap),noUnpackFlip:!0,maxAnisotropy:s,mipmap:s>1};re(r)?(a=r.data,i.preMultiplyAlpha=!1,i.encoding=r.encoding):(a=r,i.preMultiplyAlpha=t!==xe.Opaque,i.downsampleUncompressed=this._context.graphicsCoreOwner.view.qualitySettings.graphics3D.uncompressedTextureDownsamplingEnabled),n=new ve(a,i),this._textures.set(o,n),n.load(this._context.stage.renderView.renderingContext),this._context.stage.add(n),n.events.on("unloaded",(()=>{this._textures.delete(o)}))}return n}_setInternalMaterialTextureParameters(t,r){if(null!=t.colorTexture){const e=this._getInternalTexture(t.colorTexture,r.textureAlphaMode);e?(r.textureId=e.id,r.textureAlphaPremultiplied=!!e.parameters.preMultiplyAlpha):r.textureId=void 0}t.normalTexture&&(r.normalTextureId=this._getInternalTextureId(t.normalTexture)),t.emissiveColor&&(r.emissiveFactor=e.toUnitRGB(t.emissiveColor)),t.emissiveTexture&&(r.emissiveTextureId=this._getInternalTextureId(t.emissiveTexture)),t.occlusionTexture&&(r.occlusionTextureId=this._getInternalTextureId(t.occlusionTexture)),t.metallicRoughnessTexture&&(r.metallicRoughnessTextureId=this._getInternalTextureId(t.metallicRoughnessTexture))}_setInternalMaterialParameters(e,t){null!=e.color&&qe(e.color,t),this._setInternalMaterialTextureParameters(e,t),t.colorTextureTransformMatrix=oe(e.colorTextureTransform),t.normalTextureTransformMatrix=oe(e.normalTextureTransform);const r=null!=e.normalTextureTransform?.scale?e.normalTextureTransform?.scale:f;t.scale=[r[0],r[1]],t.occlusionTextureTransformMatrix=oe(e.occlusionTextureTransform),t.emissiveTextureTransformMatrix=oe(e.emissiveTextureTransform),t.metallicRoughnessTextureTransformMatrix=oe(e.metallicRoughnessTextureTransform)}_setExternalMaterialParameters(t){const r=this._drivenProperties.color;let o=this.symbolLayer.material?.colorMixMode??null;if(r)t.externalColor=j;else{const r=this.symbolLayer.material?.color??null;r?t.externalColor=e.toUnitRGBA(r):(o=null,t.externalColor=j)}o&&(t.colorMixMode=o),t.castShadows=!!this.symbolLayer.castShadows}_getOrCreateMaterial(t,r){const o=r.material?.color,n=r.material?.colorTexture,a=r.material?.alphaMode,s="blend"===a,i=!("opaque"===a)&&(ke(t)||null!=o&&o.a<1||n?.transparent||s),l=this._materialProperties(t,r,i),c=this._materialInfoCache.byUid(l.uid);if(c)return this._setInternalMaterialTextureParameters(l,c.material.parameters),c.material;const u={uid:l.uid,material:null,isComponentTransparent:i,alphaMode:r.material?r.material.alphaMode:"opaque"},m=je({normalTexture:l.normalTexture,metallicRoughnessTexture:l.metallicRoughnessTexture,metallicFactor:l.metallic,roughnessFactor:l.roughness,emissiveTexture:l.emissiveTexture,emissiveFactor:e.toUnitRGB(l.emissiveColor),occlusionTexture:l.occlusionTexture}),f={usePBR:this._usePBR(),isSchematic:m,hasVertexColors:l.hasVertexColors,hasSymbolColors:l.hasSymbolVertexColors,hasVertexTangents:l.hasVertexTangents,ambient:w,diffuse:R,opacity:1,doubleSided:!0,doubleSidedType:"winding-order",cullFace:_e.None,layerOpacity:this._getLayerOpacity(),hasSlicePlane:this._context.slicePlaneEnabled,initTextureTransparent:!0};f.mrrFactors=m?Ce:[l.metallic,l.roughness,Ae[2]],r.material&&(f.doubleSided=r.material.doubleSided,f.cullFace=r.material.doubleSided?_e.None:_e.Back,f.textureAlphaCutoff=r.material.alphaCutoff),this._setExternalMaterialParameters(f),this._setMaterialTransparentParameter(f,u),this._setInternalMaterialParameters(l,f);const p=new Re(f,this._context);return u.material=p,this._materialInfoCache.set(l.uid,u),this._context.stage.add(p),p}_usePBR(){return this._context.physicalBasedRenderingEnabled}_setMaterialTransparentParameter(e,t){e.transparent=this.needsDrivenTransparentPass||t.isComponentTransparent||e.layerOpacity<1||e.opacity<1||e.externalColor&&e.externalColor[3]<1,"auto"===t.alphaMode?e.textureAlphaMode=e.transparent?xe.MaskBlend:xe.Opaque:e.textureAlphaMode="opaque"===t.alphaMode?xe.Opaque:"mask"===t.alphaMode?xe.Mask:xe.Blend}_createFaceDebugNormals(e,t){const o=t.length,a=e.spatialReference.isGeographic?20015077/180:1,s=.1*Math.max(e.extent.width*a,e.extent.height*a,e.extent.zmax-e.extent.zmin),i=[],l=[],c=t[0].transformation,u=r(n(),c);for(let r=0;r<o;r++){const e=t[r].attributes.get(we.POSITION);if(!e)continue;const o=e.data,n=e.indices;for(let t=0;t<n.length;t+=3)Ge(o,n,t,tt),De(o,n,t,Xe,Ze,et),h(Xe,Xe,Ze),h(Xe,Xe,et),d(Xe,Xe,1/3),g(Xe,Xe,c),i.push(...Xe),x(tt,tt,u),_(tt,tt),T(Xe,Xe,tt,s),i.push(...Xe),l.push(l.length),l.push(l.length)}return i.length?new be(this._debugFaceNormalMaterial,[[we.POSITION,new ge(i,l,3,!0)]],null,Te.Line):null}_createPerVertexDebugVectors(e,t,a,s,i){const l=t.length,c=e.spatialReference.isGeographic?20015077/180:1,u=.1*i*Math.max(e.extent.width*c,e.extent.height*c,e.extent.zmax-e.extent.zmin),m=[],f=[],h=t[0].transformation,d=r(n(),h);a===we.TANGENT&&o(d,h);for(let r=0;r<l;r++){const e=t[r],o=e.attributes.get(we.POSITION),n=e.attributes.get(a);if(!o||!n)continue;const s=o.data,i=o.indices,l=n.data,c=n.indices;for(let t=0;t<i.length;t++){const e=3*i[t],r=c[t]*n.stride;p(Xe,s[e+0],s[e+1],s[e+2]),g(Xe,Xe,h),m.push(...Xe),p(Ze,l[r+0],l[r+1],l[r+2]),x(Ze,Ze,d),_(Ze,Ze),T(Xe,Xe,Ze,u),m.push(...Xe),f.push(f.length),f.push(f.length)}}return m.length?new be(s,[[we.POSITION,new ge(m,f,3,!0)]],null,Te.Line):null}_createAs3DShape(e,t,r,o){const n=e.geometry;if("mesh"!==n.type)return null;const a=this._createGeometryInfo(n,t,o);if(null==a)return null;const{geometries:s,objectTransformation:i}=a;if(de.DRAW_MESH_GEOMETRY_NORMALS){const e=this._createPerVertexDebugVectors(n,s,we.NORMAL,this._debugVertexNormalMaterial,1),t=this._createPerVertexDebugVectors(n,s,we.TANGENT,this._debugTangentNormalMaterial,.5),r=this._createFaceDebugNormals(n,s);e&&s.push(e),t&&s.push(t),r&&s.push(r)}const l=new ye({geometries:s,layerUid:this._context.layer.uid,graphicUid:o,isElevationSource:!0});l.transformation=i;const c=fe(this.symbolLayer,{opacity:this._getLayerOpacity()}),u=c?new le(s[0].material,c,this._context.slicePlaneEnabled):null,m=new ie(this,l,s,null,null,ne,r,u);this._fastUpdateProcessor.onAddGraphic(),m.needsElevationUpdates=ae(r.mode),m.useObjectOriginAsAttachmentOrigin=!0,m.fastTransformUpdatesAllowed=this._fastTransformUpdatesAllowed(n),r.centerPointInElevationSR=this._getCenterPointInElevationSR(l.transformation);const{elevationProvider:f,renderCoordsHelper:p}=this._context,h=(e,t)=>se(e,f,r,p,t);return m.alignedSampledElevation=ne(m,r,f.spatialReference,h,p),m}_fastTransformUpdatesAllowed(e){const{vertexSpace:t,spatialReference:r}=e;if(!L(t))return!1;const{type:o}=t,{view:n}=this._context.graphicsCoreOwner,{viewingMode:a}=n.state,s=n.spatialReference;return a===te.Global&&"local"===o||a===te.Local&&$(s,r)&&"georeferenced"===o&&!r.isGeographic}_getCenterPointInElevationSR(e){const t=Z(0,0,0,this._context.elevationProvider.spatialReference??null);return E([e[12],e[13],e[14]],this._context.renderCoordsHelper.spatialReference,t),t}_passthroughReprojectionInfo(e){return e.reprojection===st.NONE&&!!e.objectTransformation}_createPositionBuffer(e,t){const r=e.vertexAttributes.position;let o,n=r;if(t.reprojection===st.NONE)return{position:n,georeferencedPositionBuffer:o};const a=t.reprojection===st.RENDER?t.transformBeforeProject:null;a&&(n=k(new Float64Array(n.length),n,a));const{normal:s,tangent:i}=e.vertexAttributes;this._passthroughReprojectionInfo(t)||!s&&!i||(o=n);const l=n===r||n===o?new Float64Array(n.length):n;return P(n,e.spatialReference,0,l,this._context.renderCoordsHelper.spatialReference,0),{position:l,georeferencedPositionBuffer:o}}_createNormalBuffer(e,t,r,o){const n=e.vertexAttributes.normal;if(null==n)return null;let a=n;const s=o.reprojection===st.RENDER?o.transformBeforeProject:null;s&&(a=q(a,new Float32Array(a.length),s));const i=this._context.graphicsCoreOwner.view.viewingMode;if(o.reprojection===st.NONE)return a;if("local"===i){if(!H(this._context.renderCoordsHelper.spatialReference))return a;if(null==r)return null;if(e.spatialReference.isGeographic){const e=a===n?new Float32Array(a.length):a;return z(a,W.NORMAL,r,e)}if(e.spatialReference.isWebMercator){const e=a===n?new Float32Array(a.length):a;return Y(a,W.NORMAL,r,e)}return a}if(null==r)return null;const l=a===n?new Float32Array(a.length):a,c=this._context.renderCoordsHelper.spatialReference;return J(a,r,e.spatialReference,t,c,l)}_createTangentBuffer(e,t,r,o){const n=e.vertexAttributes.tangent;if(null==n)return null;let a=n;const s=o.reprojection===st.RENDER?o.transformBeforeProject:null;s&&(a=K(a,new Float32Array(a.length),s));const i=this._context.graphicsCoreOwner.view.viewingMode;if(o.reprojection===st.NONE)return a;if("local"===i){if(!H(this._context.renderCoordsHelper.spatialReference))return a;if(null==r)return null;if(e.spatialReference.isGeographic){const e=a===n?new Float32Array(a.length):a;return z(a,W.TANGENT,r,e)}if(e.spatialReference.isWebMercator){const e=a===n?new Float32Array(a.length):a;return Y(a,W.TANGENT,r,e)}return a}if(null==r)return null;const l=a===n?new Float32Array(a.length):a,c=this._context.renderCoordsHelper.spatialReference;return Q(a,r,e.spatialReference,t,c,l)}_createSymbolColorBuffer(e){if(this._requiresSymbolVertexColors()){const t=this._getVertexOpacityAndColor(e),r=pe(this.symbolLayer?.material?.colorMixMode),o=new Uint8Array(4);return he(t,r,o),o}return null}_createBuffers(e,t){const r=e.vertexAttributes&&e.vertexAttributes.position;if(!r)return this.logger.warn("Mesh geometry must contain position vertex attributes"),null;const o=e.vertexAttributes.normal,n=e.vertexAttributes.uv,a=e.vertexAttributes.tangent;if(o&&o.length!==r.length)return this.logger.warn("Mesh normal vertex buffer must contain the same number of elements as the position buffer"),null;if(a&&a.length/4!=r.length/3)return this.logger.warn("Mesh tangent vertex buffer must contain the same number of elements as the position buffer"),null;if(n&&n.length/2!=r.length/3)return this.logger.warn("Mesh uv vertex buffer must contain the same number of elements as the position buffer"),null;const s=this._computeReprojectionInfo(e),{position:i,georeferencedPositionBuffer:l}=this._createPositionBuffer(e,s),u=Je(e),m=this._createSymbolColorBuffer(t),f=this._createNormalBuffer(e,i,l,s),p=this._createTangentBuffer(e,i,l,s),h=n,{transformation:d,position:g,normal:x,tangent:_}=this._passthroughReprojectionInfo(s)?{transformation:s.objectTransformation,position:i,normal:f,tangent:p}:this._transformOriginLocal(e,i,f,p);return{positionBuffer:g,normalBuffer:x,tangentBuffer:_,uvBuffer:h,colorBuffer:u,symbolColorBuffer:m,objectTransformation:d,geometryTransformation:s.reprojection===st.NONE&&s.geometryTransformation?s.geometryTransformation:c()}}_computeReprojectionInfo(e){const{vertexSpace:t}=e,r="georeferenced"===t.type?$(this._context.renderCoordsHelper.spatialReference,e.spatialReference)?st.NONE:st.RENDER:st.NONE;if(V(t))return{reprojection:r};const o=t.origin,n=c(),i=e.transform?.localMatrix??u;if(r===st.NONE){C(e.spatialReference,o,n,this._context.renderCoordsHelper.spatialReference);return{reprojection:r,objectTransformation:n,geometryTransformation:m(i)}}const l=a(c(),o);return s(l,l,i),{reprojection:r,transformBeforeProject:l}}_transformOriginLocal(e,t,r,o){const n=this._context.renderCoordsHelper.spatialReference,a=e.origin;Qe[0]=a.x,Qe[1]=a.y,Qe[2]=a.z??0;const s=c();C(e.spatialReference,Qe,s,n),i(rt,s);const{position:l,normal:u,tangent:m}=e.vertexAttributes,f=t===l?new Float64Array(t.length):t;k(f,t,rt);const p=r?r===u?new Float32Array(r.length):r:null,h=o?o===m?new Float32Array(o.length):o:null;return r&&p&&q(r,p,rt),o&&h&&K(o,h,rt),{transformation:s,position:f,normal:p,tangent:h}}_validateFaces(e,t){const r=e.vertexAttributes.position.length/3,o=t.faces;if(o){let e=-1;for(let t=0;t<o.length;t++){const r=o[t];r>e&&(e=r)}if(r<=e)return this.logger.warn(`Vertex index ${e} is out of bounds of the mesh position buffer`),!1}else if(r%3!=0)return this.logger.warn("Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)"),!1;return!0}_isOutsideClippingArea(e){if(!this._context.clippingExtent)return!1;const t=e.vertexAttributes?.position;if(!t)return!1;const r=this._context.elevationProvider.spatialReference,o=X(e,r??e.spatialReference);return!!o&&(I(o,nt),!N(nt,this._context.clippingExtent))}_createGeometryInfo(e,t,r){if(!A(e.spatialReference,this._context.renderCoordsHelper.spatialReference))return this.logger.warn("Geometry spatial reference is not compatible with the view"),null;if(!this._validateVertexSpace(e))return null;if(this._isOutsideClippingArea(e))return null;const o=this._createBuffers(e,t);if(null==o)return null;const{positionBuffer:n,uvBuffer:a,colorBuffer:s,symbolColorBuffer:i,normalBuffer:c,tangentBuffer:u,objectTransformation:m,geometryTransformation:f}=o,p=Le(e),h=new Array;let d=!1;const g=l(Xe,m),x=this._context.localOriginFactory.getOrigin(g);for(const l of p){if(!this._validateFaces(e,l))return null;const t=Ne(e,l);if(0===t.length)continue;const o=Se(n,c,l,t);o.didFlipNormals&&(d=!0);const m=[[we.POSITION,new ge(n,t,3,!0)],[we.NORMAL,new ge(o.normals,o.indices,3,!0)]];s&&m.push([we.COLOR,new ge(s,t,4,!0)]),i&&m.push([we.SYMBOLCOLOR,new ge(i,U(t.length),4,!0)]),a&&m.push([we.UV0,new ge(a,t,2,!0)]),u&&m.push([we.TANGENT,new ge(u,t,4,!0)]);const p=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:r,layerUid:this._context.layer.uid}),g=this._getOrCreateMaterial(e,l),_=new be(g,m,null,Te.Mesh,p);_.transformation=f,_.localOrigin=x,h.push(_)}return d&&this.logger.warn("Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals."),{geometries:h,objectTransformation:m}}_updateMaterialParameters(e){this._materialInfoCache.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachClonedMaterial(((e,t)=>{t.setParameters(e.parameters)}))}_validateVertexSpace(e){const{_context:{graphicsCoreOwner:{view:{state:{viewingMode:t}}}}}=this,{vertexSpace:r}=e;return t!==te.Local||"local"!==r.type||(this.logger.warn("Displaying a mesh with a local vertex space in a view in local viewing mode is not supported."),!1)}test(){return{...super.test(),materials:this._materialInfoCache.materials}}}class Ie{constructor(e,t,r){this.normals=e,this.indices=t,this.didFlipNormals=r}}function Ne(e,t){return t.faces??B(e.vertexAttributes.position.length/3)}function Se(e,t,r,o){switch(r.shading||"flat"){default:case"source":return Be(e,t,r,o);case"flat":return Ue(e,o);case"smooth":return Fe(e,o)}}function Ue(e,t){const r=S(t.length),o=new Array(3*t.length);for(let n=0;n<t.length;n+=3){const a=Ge(e,t,n,tt);for(let e=0;e<3;e++)r[n+e]=a[e],o[n+e]=n/3}return new Ie(r,o,!1)}function Be(e,t,r,o){if(null==t)return Ue(e,o);let n=!1;if(!r.trustSourceNormals)for(let a=0;a<o.length;a+=3){Ge(e,o,a,tt);for(let e=0;e<3;e++){const r=3*o[a+e];Xe[0]=t[r],Xe[1]=t[r+1],Xe[2]=t[r+2],b(tt,Xe)<0&&(t[r]=-t[r],t[r+1]=-t[r+1],t[r+2]=-t[r+2],n=!0)}}return new Ie(t,o,n)}function Fe(e,t){const r={};for(let a=0;a<t.length;a+=3){const o=Ge(e,t,a,tt);for(let e=0;e<3;e++){const n=t[a+e];let s=r[n];s||(s={normal:M(),count:0},r[n]=s),h(s.normal,s.normal,o),s.count++}}const o=S(3*t.length),n=new Array(3*t.length);for(let a=0;a<t.length;a++){const e=r[t[a]];1!==e.count&&(_(e.normal,e.normal),e.count=1);for(let t=0;t<3;t++)o[3*a+t]=e.normal[t];n[a]=a}return new Ie(o,n,!1)}function De(e,t,r,o,n,a){const s=3*t[r],i=3*t[r+1],l=3*t[r+2];o[0]=e[s],o[1]=e[s+1],o[2]=e[s+2],n[0]=e[i],n[1]=e[i+1],n[2]=e[i+2],a[0]=e[l],a[1]=e[l+1],a[2]=e[l+2]}function Ge(e,t,r,o){return De(e,t,r,Xe,Ze,et),y(Ze,Ze,Xe),y(et,et,Xe),v(Xe,Ze,et),_(o,Xe),o}function Le(e){return e.components??at}function Ve(e){if(!e)return null;const{scale:r,offset:o,rotation:n}=e;return{scale:r,offset:o,rotation:t(n)}}function $e(e="repeat"){if("string"==typeof e){const t=He(e);return{s:t,t}}return{s:He(e.horizontal),t:He(e.vertical)}}function He(e){switch(e){case"clamp":return Pe.CLAMP_TO_EDGE;case"mirror":return Pe.MIRRORED_REPEAT;default:return Pe.REPEAT}}function ke(e){const t=e.vertexAttributes.color;if(null==t)return!1;for(let r=3;r<t.length;r+=4)if(255!==t[r])return!0;return!1}function qe(t,r){r.diffuse=e.toUnitRGB(t),r.opacity=t.a}function ze(e){return e.data??e.url}function We(t){return null==t?"-":t instanceof e?t.toHex():t.contentHash}function Ye(e){const{offset:t,scale:r,rotation:o}=e??Ke;return`${t[0]},${t[1]},${o},${r[0]},${r[1]}`}function Je(e){return e.vertexAttributes.color}const Ke=new G,Qe=M(),Xe=M(),Ze=M(),et=M(),tt=M(),rt=c(),ot=c(),nt=O(),at=[new F];var st;!function(e){e[e.NONE=0]="NONE",e[e.RENDER=1]="RENDER"}(st||(st={}));export{Oe as Graphics3DMeshFillSymbolLayer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{lerp as t,clamp as e}from"../../../core/mathUtils.js";import{getMetersPerUnitForSR as i}from"../../../core/unitUtils.js";import{d as r,n as s,f as n,l as a}from"../../../chunks/vec32.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as o}from"../../../geometry/ellipsoidUtils.js";import h from"../../../geometry/Extent.js";import{ViewingMode as l}from"../../ViewingMode.js";import{computeInnerAltitudeFade as x}from"../environment/atmosphereUtils.js";function c(t,e,i){return t===l.Global?new M(i):new u(e,i)}class u{constructor(t,e){this._elevationProvider=t,this._referenceEllipsoid=o(e),this._unitInMeters=i(e,this._referenceEllipsoid.metersPerDegree)}compute(i,a,m,o,l){l||(l={near:0,far:0});let x=i[2]*this._unitInMeters;const c=x,u=x-o,M=this._elevationProvider?.visibleElevationBounds;M&&(x=u>=0?c-this._unitInMeters*M.min:this._unitInMeters*M.max-c);const _={x:(m=null!=m?m:new h({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0})).xmax-m.xmin,y:m.ymax-m.ymin,z:4*Math.max(m.xmax-m.xmin,m.ymax-m.ymin)},I=Math.max(_.x,_.y,_.z);r(E,a,i),v[0]=E[0]>0?m.xmax:m.xmin,v[1]=E[1]>0?m.ymax:m.ymin,v[2]=E[2]>0?I/2:-I/2,r(v,v,i),s(E,E);const j=1.1*n(v,E)*this._unitInMeters,g=Math.sqrt(x*(x+2*this._referenceEllipsoid.radius)),b=Math.max(m.xmax-m.xmin,m.ymax-m.ymin),w=b*d*this._unitInMeters,z=b*y*this._unitInMeters,U=e((x-z)/(w-z),0,1)**3,P=Math.min(t(g,j,U),g)*Math.max(Math.log(Math.abs(u)),1);return f(Math.min(P,Math.max(34064e4,I))/this._unitInMeters,p,this._unitInMeters,l)}}class M{constructor(t){this._referenceEllipsoid=o(t)}compute(i,r,s,n,m){m||(m={near:0,far:0});const o=a(i),h=o-this._referenceEllipsoid.radius,l=this._referenceEllipsoid.radius+Math.min(0,n),c=Math.abs(h-n),u=Math.max(c,Math.abs(h)),M=Math.sqrt(u*(u+2*l)),p=o+this._referenceEllipsoid.radius;return f(1.2*t(M,p,x(u)),e(2e4-(Math.log(u)-7.983)/9.011*19900,100,2e4),1,m)}}function f(t,e,i,r){const s=_/i;return t/e>s?(r.far=t,r.near=r.far/e):(r.near=s,r.far=r.near*e),r}const p=2e4,_=2,d=.001,y=1e-4,v=m(),E=m();export{c as createNearFarHeuristic};
5
+ import{lerp as t,clamp as e}from"../../../core/mathUtils.js";import{getMetersPerUnitForSR as i}from"../../../core/unitUtils.js";import{d as r,n as s,f as n,l as a}from"../../../chunks/vec32.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as o}from"../../../geometry/ellipsoidUtils.js";import h from"../../../geometry/Extent.js";import{ViewingMode as l}from"../../ViewingMode.js";import{computeInnerAltitudeFade as x}from"../environment/atmosphereUtils.js";function c(t,e,i){return t===l.Global?new M(i):new u(e,i)}class u{constructor(t,e){this._elevationProvider=t,this._referenceEllipsoid=o(e),this._unitInMeters=i(e,this._referenceEllipsoid.metersPerDegree)}compute(i,a,m,o,l){l||(l={near:0,far:0});let x=i[2]*this._unitInMeters;const c=x,u=x-o,M=this._elevationProvider?.visibleElevationBounds;M&&(x=u>=0?c-this._unitInMeters*M.min:this._unitInMeters*M.max-c);const p={x:(m=null!=m?m:new h({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0})).xmax-m.xmin,y:m.ymax-m.ymin,z:4*Math.max(m.xmax-m.xmin,m.ymax-m.ymin)},_=Math.max(p.x,p.y,p.z);r(g,a,i),j[0]=g[0]>0?m.xmax:m.xmin,j[1]=g[1]>0?m.ymax:m.ymin,j[2]=g[2]>0?_/2:-_/2,r(j,j,i),s(g,g);const y=1.1*n(j,g)*this._unitInMeters,v=Math.sqrt(x*(x+2*this._referenceEllipsoid.radius)),b=Math.max(m.xmax-m.xmin,m.ymax-m.ymin),w=b*E*this._unitInMeters,z=b*I*this._unitInMeters,U=e((x-z)/(w-z),0,1)**3,P=Math.min(t(v,y,U),v)*Math.max(Math.log(Math.abs(u)),1);return f(Math.min(P,Math.max(34064e4,_))/this._unitInMeters,d,this._unitInMeters,l)}}class M{constructor(t){this._referenceEllipsoid=o(t)}compute(i,r,s,n,m){m||(m={near:0,far:0});const o=a(i),h=o-this._referenceEllipsoid.radius,l=this._referenceEllipsoid.radius+Math.min(0,n),c=Math.abs(h-n),u=Math.max(c,Math.abs(h)),M=Math.sqrt(u*(u+2*l)),v=o+this._referenceEllipsoid.radius,E=1.2*t(M,v,x(u)),I=(Math.log(u)-p)/(_-p);return f(E,e(d-I*(d-y),y,d),1,m)}}function f(t,e,i,r){const s=v/i,n=t/e;return n>s?(r.far=t,r.near=n):(r.near=s,r.far=r.near*e),r}const p=7.983,_=16.994,d=2e4,y=100,v=2,E=.001,I=1e-4,j=m(),g=m();export{c as createNearFarHeuristic};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{Cyclical as r,cyclicalPI as s}from"../../../core/Cyclical.js";import has from"../../../core/has.js";import{clamp as i,deg2rad as a}from"../../../core/mathUtils.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{watch as o,sync as l}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{subtract as d}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{g as u,d as p,y as _,c as m,j as y}from"../../../chunks/vec32.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{t as f,b as v,g as R}from"../../../chunks/vec42.js";import{create as O,fromValues as w}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as x}from"../../../geometry/ellipsoidUtils.js";import{projectVectorToVector as T}from"../../../geometry/projection/projectVectorToVector.js";import{create as D,width as S,copy as E,center as P,height as M,intersection as b,contains as j,intersects as I,offset as C}from"../../../geometry/support/aaBoundingRect.js";import{create as N,wrap as U}from"../../../geometry/support/ray.js";import{k as A,b as G,t as V}from"../../../chunks/sphere.js";import{angleAroundAxis as F}from"../../../geometry/support/vector.js";import{y2lat as L}from"../../../geometry/support/webMercatorUtils.js";import{viewAngle as q}from"../state/utils/viewUtils.js";import{debugFlags as B}from"../support/debugFlags.js";import{PointGraphics as H}from"../support/debugUtils.js";import{OverlayIndex as k}from"./interfaces.js";import{OverlayRenderer as Y}from"./OverlayRenderer.js";import{RenderRequestType as z}from"../webgl-engine/lib/basicInterfaces.js";import{newIntersector as W}from"../webgl-engine/lib/Intersector.js";import{fromValues as X}from"../webgl-engine/lib/LocalOriginFactory.js";import{SortedRenderGeometryRenderer as K}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{applyTextureResizeModulo as Z}from"../webgl-engine/lib/textureUtils.js";import{removeLoadedShaderModules as J}from"../webgl-engine/parts/renderUtils.js";import{TaskPriority as Q,noBudget as $}from"../../support/Scheduler.js";import{Yield as ee}from"../../support/Yield.js";const te=1.3,re=[[-.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 se,ie=class extends t{constructor(e){super(e),this._spatialReference=null,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._longitudeCyclical=null,this._latestOriginId=0,this._maxResolution=has("esri-mobile")?2048:4096}initialize(){const e=this.view;this.renderer=new Y({view:e,worldToPCSRatio:this._worldToPCSRatio,spatialReference:this._spatialReference}),e._stage.renderer.plugins.add(this.renderer);const t=()=>this.setDrawTexturesDirty();this._groundIntersector=W(this.view.state.viewingMode),this._groundIntersector.options.backfacesTerrain=!0,this._groundIntersector.options.invisibleTerrain=!0,this._groundIntersector.options.hud=!1,this.addHandles([o((()=>this.renderer.hasHighlights),t),this.renderer.events.on("has-water",(()=>e._stage?.renderer.updateHasFlags())),this.renderer.events.on("content-changed",t),o((()=>e.state.camera.pixelRatio),t),o((()=>e.state.alignPixelEnabled),t),this.renderer.events.on("textures-disposed",(()=>this.surface.requestRender())),o((()=>[e.pointsOfInterest?.renderPointOfView,e.pointsOfInterest?.centerOnSurfaceFrequent?.location]),(()=>this.setPlacementDirty())),o((()=>[e.state?.pixelRatio,e.state?.contentPixelRatio]),(()=>this.setPlacementDirty()),l),this.surface.on("elevation-change",(()=>this.setPlacementDirty())),e.on("resize",(()=>this.setPlacementDirty())),e.resourceController.scheduler.registerTask(Q.OVERLAY,this),e._stage.renderView.events.on("force-camera-for-screenshot",(e=>{this._updateOverlays($,e.camera,z.BACKGROUND),this.renderer.hasOverlays&&this._drawOverlays(z.BACKGROUND,e)}))]),e._stage.renderer.overlay=this}destroy(){this.view?._stage&&(this.view._stage.renderer.plugins.remove(this.renderer),this.view._stage.renderer.overlay=null),se&&(se.hide(),se=null),this.renderer=n(this.renderer)}get running(){return this._placementDirty&&(this._drapeSources.size>0||this.view.graphics.length>0||B.OVERLAY_DRAW_DEBUG_TEXTURE)&&!!this._spatialReference&&!this.suspended&&this.surface.ready}get _isSpherical(){return this.view.state.isGlobal}get _worldToPCSRatio(){return null!=this._spatialReference&&this._spatialReference.isGeographic&&!this.view.state.isLocal?x(this._spatialReference).metersPerDegree:1}get _overlayStretch(){return te/this.view.resolutionScale}get suspended(){return this.surface.suspended}get updating(){return this.running||this.renderer.updating||this._contentUpdated}get rendersOccludedDraped(){return this.renderer.rendersOccludedDraped}render(){if(this._contentUpdated=!1,this.renderer.processSyncDrapeSources(),this.renderer.hasOverlays)return this._precompileShaders()?this._drawOverlays(z.UPDATE):null}get hasOverlays(){return this.renderer.hasOverlays}setSpatialReference(e){this._spatialReference=e,this.renderer.spatialReference=e,this._longitudeCyclical=null;const t=this.view.renderSpatialReference;null!=e&&null!=t?(this._renderSR=t,this._overlaySREqualsRenderSR=e.equals(this._renderSR),this._isSpherical&&(this._longitudeCyclical=e.isWebMercator?new r(-20037508.342787,20037508.342787):new r(-180,180),this.renderer.longitudeCyclical=this._longitudeCyclical),this.renderer&&(this.renderer.worldToPCSRatio=this._worldToPCSRatio)):this.renderer.disposeOverlays()}registerDrapeSource(e,t,r){this._drapeSources.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources);const s=this.renderer.createDrapeSourceRenderer(e,t,r);return this._updateDrapeSourceExtent(e),this._setContentDirty(),this.notifyChange("running"),s}registerGeometryDrapeSource(e){return this.registerDrapeSource(e,K)}_updateDrapeSourceExtent(e){2===this.renderer.overlays.length&&null!=e.setDrapingExtent&&null!=this._spatialReference&&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("running"))}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.setDrawTexturesDirty()}setPlacementDirty(){this._placementDirty=!0}runTask(e){return this._updateOverlays(e,this.view.state.contentCamera,z.UPDATE)}_updateOverlays(e,t,r){if(!this._spatialReference)return ee;const s=this._computeOverlayResolution(t);this._computeOverlayExtents(t,s,he),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources,he.stretch);const i=this._updateOverlay(k.INNER,he.inner,s,1*he.pixelRatioAdjustment,he.mapUnitsPerPixel),a=S(he.inner)/S(he.outer),n=this._updateOverlay(k.OUTER,he.outer,s,a*he.pixelRatioAdjustment,he.mapUnitsPerPixel);i!==pe.EXTENT&&n!==pe.EXTENT||(this._drapeSources.forEach((e=>this._updateDrapeSourceExtent(e))),this.surface.updateTileOverlayParams(r)),i===pe.NONE&&n===pe.NONE||this.setDrawTexturesDirty(),this._placementDirty=!1,e.madeProgress()}_computeOverlayResolution(e){const t=this.view.state.contentPixelRatio*this.view.resolutionScale,r=e.fullWidth/e.pixelRatio*t,s=e.fullHeight/e.pixelRatio*t,i=Math.ceil(1.5*Math.max(r,s));return Math.min(Z(i),this._maxResolution)}_updateOverlay(e,t,r,s,i){if(0===this.renderer.overlays.length)return pe.NONE;const a=this.renderer.overlays[e],n=a.mapUnitsPerPixel;if(a.mapUnitsPerPixel=i,a.pixelRatio=s,ae(t,a.extent)&&r===a.resolution)return n===i?pe.NONE:pe.RERENDER_ONLY;E(a.extent,t),a.resolution=r;const o=P(a.extent);return a.renderLocalOrigin=X(o[0],o[1],0,"OV_"+this._latestOriginId++),pe.EXTENT}setTileParameters(e){const t=e.renderData.overlay;if(this.renderer.overlays.length>0){const r=this.renderer.overlays[k.INNER],s=this.renderer.overlays[k.OUTER],i=e.extent;this._rectInsideRect(r.extent,i)||this._rectanglesOverlap(i,r.extent)||this._rectanglesOverlap(i,s.extent)?(this._setTileOverlayData(i,k.INNER,t),this._setTileOverlayData(i,k.OUTER,t)):(this._clearTileOverlayData(k.INNER,t),this._clearTileOverlayData(k.OUTER,t))}else this._clearTileOverlayData(k.INNER,t),this._clearTileOverlayData(k.OUTER,t)}overlayPixelSizeInMapUnits(e,t){if(0===this.renderer.overlays.length)return t();const r=this.renderer.overlays[k.INNER],s=this.renderer.overlays[k.OUTER],i=this._pointIsInExtent(e,r.extent)?r:s;return(i.extent[2]-i.extent[0])/i.resolution}_setTileOverlayData(e,t,r){if(0===this.renderer.overlays.length)return;const s=this.renderer.overlays[t].extent,i=S(s),a=M(s);let n=e[0];if(this._longitudeCyclical){n=this._longitudeCyclical.minimalMonotonic(s[0],n);const t=this._longitudeCyclical.minimalMonotonic(s[0],e[2]);n>t&&(n=t-(e[2]-e[0]))}r.setScale(t,S(e)/i,M(e)/a),r.setOffset(t,(n-s[0])/i,(e[1]-s[1])/a)}_clearTileOverlayData(e,t){t.setScale(e,-1,-1),t.setOffset(e,-1,-1)}reloadShaders(){J(),this.setDrawTexturesDirty(),this.runTask($)}updateAnimation(e){return this.renderer.updateAnimation(e)&&(this._drawTexturesAnimateDirty=!0),this._drawTexturesAnimateDirty}setDrawTexturesDirty(){this.renderer.hasOverlays?(this._contentUpdated=!0,this._drawTexturesDirty=!0,this.view._stage.renderView.requestRender()):this.setPlacementDirty()}_intersectGroundFromView(e,t,r,s){const i=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(e,ue,t,r);if(null==i)return!1;const a=i.origin,n=u(le,i.origin,i.direction);return this._groundIntersector.reset(a,n,e),this._groundIntersector.intersect([]),this.view.basemapTerrain.intersect(this._groundIntersector,null,a,n),this._groundIntersector.results.min.getIntersectionPoint(s)}_findHorizonBasedPointOfInterest(e,t){let r=.5;const a=.55,n=this.view.renderCoordsHelper.getAltitude(e.eye),o=this.view.pointsOfInterest.centerOnSurfaceFrequent,l=1e-5,h=i(o.estimatedSurfaceAltitude,e.aboveGround?-1/0:n+l,e.aboveGround?n-l:1/0),c=e.aboveGround;if("global"===this.view.viewingMode){const t=le;A(G(V,x(this.view.spatialReference).radius+h),U(e.eye,e.viewForward),t),p(t,t,e.eye);const i=s.normalize(F(e.viewForward,t,e.viewRight))/e.fovY+.5,n=i<=0||i>=1?.5:a;r=c?n*i:i+n*(1-i)}else{const t=.5*Math.PI-Math.acos(-e.viewForward[2]),s=Math.tan(t),n=w(0,s,1,0),o=f(n,n,e.projectionMatrix)[1],l=i(.5+.5*o,0,1);r=1===l||0===l?.5:c?l*a:1-(1-l)*a}return!!this._intersectGroundFromView(e,.5,r,t)&&_(t,e.eye)<o.distance*o.distance}_computeOverlayExtents(e,t,r){const s=this.view.pointsOfInterest.centerOnSurfaceFrequent.renderLocation,i=g();this._findHorizonBasedPointOfInterest(e,i)||m(i,s),B.OVERLAY_SHOW_CENTER?(null==se&&(se=new H(this.view.graphics,"red")),se.show(i,this._renderSR)):null!=se&&se.hide();const n=Math.max(.1,y(e.eye,i)),o=q(this.view.renderCoordsHelper,s,e.eye);this._overlaySREqualsRenderSR||T(i,this._renderSR,i,this._spatialReference);const l=this.surface.extent,h=!this._isSpherical&&this._spatialReference?.isGeographic,c=h&&this._spatialReference?1/x(this._spatialReference).metersPerDegree:1,u=this.view.state.contentPixelRatio,p=e.perScreenPixelRatio/u*n*c;r.mapUnitsPerPixel=p/this._worldToPCSRatio,r.stretch=this._overlayStretch;let _=t*p/2*r.stretch,f=!1,O=h?90:1/0;this._isSpherical&&l&&this._spatialReference&&(this._spatialReference.isWebMercator?(_/=Math.cos(L(i[1])),O=l[3]):(f=!0,_/=x(this._spatialReference).metersPerDegree,O=90),_>=O&&(_=O,i[1]=0,this._spatialReference.isWebMercator&&(i[0]=0)));let w=1;f&&(w=1/Math.max(.2,Math.cos(Math.abs(a(i[1])))),_*w>180&&(w=180/_),r.mapUnitsPerPixel*=w);const D=Math.log(2)/12;_=Math.exp(Math.round(Math.log(_)/D)*D);const P=_*w,M=32,I=.5*t/(M*P),C=.5*t/(M*_);i[0]=Math.round(i[0]*I)/I,i[1]=Math.round(i[1]*C)/C;const N=r.inner;N[0]=i[0]-P,N[1]=i[1]-_,N[2]=i[0]+P,N[3]=i[1]+_,this._isSpherical&&this._shiftExtentToFitBounds(N,1/0,O);const U=r.outer;if(6*P>S(l))E(U,l);else{if(Math.PI/2-Math.abs(o-Math.PI/2)<=.25*Math.PI)U[0]=N[0]-P,U[1]=N[1]-_,U[2]=N[2]+P,U[3]=N[3]+_;else{T(e.eye,this._renderSR,le,this._spatialReference),d(oe,i,le);let t=-Math.atan2(oe[1],oe[0])+.125*Math.PI;t<0&&(t+=2*Math.PI);const r=Math.floor(t/(.25*Math.PI));v(oe,re[r],2*_),oe[0]*=w,oe[2]*=w,R(U,N,oe)}}if(this._isSpherical)U[0]=this._longitudeCyclical.clamp(U[0]),U[2]=this._longitudeCyclical.clamp(U[2]),U[1]=Math.max(U[1],-O),U[3]=Math.min(U[3],O);else{const e=b(N,l,ce),t=b(U,l,de);j(e,t)&&(U[2]=U[0],U[3]=U[1])}const A=Math.abs(N[2]-N[0])/t;r.mapUnitsPerPixel=Math.max(r.mapUnitsPerPixel,A),r.pixelRatioAdjustment=r.mapUnitsPerPixel/A}_precompileShaders(){return!!this.renderer.hasOverlays&&(this.renderer.precompileShaders(this.view.state),!0)}_drawOverlays(e,t=this.view.state){if(!this._drawTexturesDirty&&!this._drawTexturesAnimateDirty)return this.renderer;const r=this._drawTexturesDirty;this._drawTexturesDirty=this._drawTexturesAnimateDirty=!1;const s=this.renderer.computeValidity();this.renderer.releaseRenderTargets(),this.renderer.drawOverlays(t);return s!==this.renderer.computeValidity()&&this.surface.updateTileOverlayParams(z.UPDATE),r?(this.surface.requestRender(e),e===z.UPDATE&&this.surface.requestUpdate()):this.surface.requestRender(z.BACKGROUND),this.renderer}_rectanglesOverlap(e,t){return null!=e&&(this._longitudeCyclical?(this._longitudeCyclical.contains(t[0],t[2],e[0])||this._longitudeCyclical.contains(t[0],t[2],e[2])||this._longitudeCyclical.contains(e[0],e[2],t[0]))&&!(e[1]>t[3]||e[3]<t[1]):I(e,t))}_rectInsideRect(e,t){return null!=t&&(this._longitudeCyclical?this._longitudeCyclical.contains(e[0],e[2],t[0])&&this._longitudeCyclical.contains(e[0],e[2],t[2])&&t[1]>e[1]&&t[3]<e[3]:j(e,t))}_pointIsInExtent(e,t){if(this._longitudeCyclical)return this._longitudeCyclical.contains(t[0],t[2],e.x)&&e.y>=t[1]&&e.y<=t[3];const r=e.x,s=e.y;return r>t[0]&&r<t[2]&&s>t[1]&&s<t[3]}_shiftExtentToFitBounds(e,t,r){let s=0,i=0;e[0]<-t?s=e[0]+t:e[2]>t&&(s=t-e[2]),e[1]<-r?i=e[1]+r:e[3]>r&&(i=r-e[3]),C(e,s,i)}get test(){}};function ae(e,t){const r=1e-5,s=B.TESTS_DISABLE_OPTIMIZATIONS?0:r*Math.max(e[2]-e[0],e[3]-e[1],t[2]-t[0],t[3]-t[1]);return Math.abs(t[0]-e[0])<=s&&Math.abs(t[1]-e[1])<=s&&Math.abs(t[2]-e[2])<=s&&Math.abs(t[3]-e[3])<=s}e([h()],ie.prototype,"_spatialReference",void 0),e([h({readOnly:!0})],ie.prototype,"running",null),e([h()],ie.prototype,"_placementDirty",void 0),e([h()],ie.prototype,"_contentUpdated",void 0),e([h()],ie.prototype,"_isSpherical",null),e([h()],ie.prototype,"_worldToPCSRatio",null),e([h()],ie.prototype,"renderer",void 0),e([h({constructOnly:!0})],ie.prototype,"view",void 0),e([h({constructOnly:!0})],ie.prototype,"surface",void 0),e([h()],ie.prototype,"suspended",null),e([h()],ie.prototype,"updating",null),e([h({type:Boolean})],ie.prototype,"rendersOccludedDraped",null),ie=e([c("esri.views.3d.terrain.OverlayManager")],ie);class ne{constructor(){this.inner=D(),this.outer=D(),this.mapUnitsPerPixel=0,this.pixelRatioAdjustment=1,this.stretch=te}}const oe=O(),le=g(),he=new ne,ce=D(),de=D(),ue=N();var pe;!function(e){e[e.NONE=0]="NONE",e[e.EXTENT=1]="EXTENT",e[e.RERENDER_ONLY=2]="RERENDER_ONLY"}(pe||(pe={}));export{ie as OverlayManager};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{Cyclical as r,cyclicalPI as s}from"../../../core/Cyclical.js";import has from"../../../core/has.js";import{clamp as i,deg2rad as a}from"../../../core/mathUtils.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{watch as o,sync as l}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{subtract as d}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{g as u,d as p,c as _,j as m}from"../../../chunks/vec32.js";import{create as y}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{t as g,b as f,g as v}from"../../../chunks/vec42.js";import{create as R,fromValues as w}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as O}from"../../../geometry/ellipsoidUtils.js";import{projectVectorToVector as x}from"../../../geometry/projection/projectVectorToVector.js";import{create as D,width as T,copy as S,center as E,height as P,intersection as M,contains as b,intersects as j,offset as I}from"../../../geometry/support/aaBoundingRect.js";import{create as C,wrap as N}from"../../../geometry/support/ray.js";import{k as U,b as A,t as G}from"../../../chunks/sphere.js";import{angleAroundAxis as V}from"../../../geometry/support/vector.js";import{y2lat as F}from"../../../geometry/support/webMercatorUtils.js";import{viewAngle as L}from"../state/utils/viewUtils.js";import{debugFlags as q}from"../support/debugFlags.js";import{PointGraphics as B}from"../support/debugUtils.js";import{OverlayIndex as H}from"./interfaces.js";import{OverlayRenderer as k}from"./OverlayRenderer.js";import{RenderRequestType as Y}from"../webgl-engine/lib/basicInterfaces.js";import{newIntersector as z}from"../webgl-engine/lib/Intersector.js";import{fromValues as W}from"../webgl-engine/lib/LocalOriginFactory.js";import{SortedRenderGeometryRenderer as X}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{applyTextureResizeModulo as K}from"../webgl-engine/lib/textureUtils.js";import{removeLoadedShaderModules as Z}from"../webgl-engine/parts/renderUtils.js";import{TaskPriority as J,noBudget as Q}from"../../support/Scheduler.js";import{Yield as $}from"../../support/Yield.js";const ee=1.3,te=[[-.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 re,se=class extends t{constructor(e){super(e),this._spatialReference=null,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._longitudeCyclical=null,this._latestOriginId=0,this._maxResolution=has("esri-mobile")?2048:4096}initialize(){const e=this.view;this.renderer=new k({view:e,worldToPCSRatio:this._worldToPCSRatio,spatialReference:this._spatialReference}),e._stage.renderer.plugins.add(this.renderer);const t=()=>this.setDrawTexturesDirty();this._groundIntersector=z(this.view.state.viewingMode),this._groundIntersector.options.backfacesTerrain=!0,this._groundIntersector.options.invisibleTerrain=!0,this._groundIntersector.options.hud=!1,this.addHandles([o((()=>this.renderer.hasHighlights),t),this.renderer.events.on("has-water",(()=>e._stage?.renderer.updateHasFlags())),this.renderer.events.on("content-changed",t),o((()=>e.state.camera.pixelRatio),t),o((()=>e.state.alignPixelEnabled),t),this.renderer.events.on("textures-disposed",(()=>this.surface.requestRender())),o((()=>[e.pointsOfInterest?.renderPointOfView,e.pointsOfInterest?.centerOnSurfaceFrequent?.location]),(()=>this.setPlacementDirty())),o((()=>[e.state?.pixelRatio,e.state?.contentPixelRatio]),(()=>this.setPlacementDirty()),l),this.surface.on("elevation-change",(()=>this.setPlacementDirty())),e.on("resize",(()=>this.setPlacementDirty())),e.resourceController.scheduler.registerTask(J.OVERLAY,this),e._stage.renderView.events.on("force-camera-for-screenshot",(e=>{this._updateOverlays(Q,e.camera,Y.BACKGROUND),this.renderer.hasOverlays&&this._drawOverlays(Y.BACKGROUND,e)}))]),e._stage.renderer.overlay=this}destroy(){this.view?._stage&&(this.view._stage.renderer.plugins.remove(this.renderer),this.view._stage.renderer.overlay=null),re&&(re.hide(),re=null),this.renderer=n(this.renderer)}get running(){return this._placementDirty&&(this._drapeSources.size>0||this.view.graphics.length>0||q.OVERLAY_DRAW_DEBUG_TEXTURE)&&!!this._spatialReference&&!this.suspended&&this.surface.ready}get _isSpherical(){return this.view.state.isGlobal}get _worldToPCSRatio(){return null!=this._spatialReference&&this._spatialReference.isGeographic&&!this.view.state.isLocal?O(this._spatialReference).metersPerDegree:1}get _overlayStretch(){return ee/this.view.resolutionScale}get suspended(){return this.surface.suspended}get updating(){return this.running||this.renderer.updating||this._contentUpdated}get rendersOccludedDraped(){return this.renderer.rendersOccludedDraped}render(){if(this._contentUpdated=!1,this.renderer.processSyncDrapeSources(),this.renderer.hasOverlays)return this._precompileShaders()?this._drawOverlays(Y.UPDATE):null}get hasOverlays(){return this.renderer.hasOverlays}setSpatialReference(e){this._spatialReference=e,this.renderer.spatialReference=e,this._longitudeCyclical=null;const t=this.view.renderSpatialReference;null!=e&&null!=t?(this._renderSR=t,this._overlaySREqualsRenderSR=e.equals(this._renderSR),this._isSpherical&&(this._longitudeCyclical=e.isWebMercator?new r(-20037508.342787,20037508.342787):new r(-180,180),this.renderer.longitudeCyclical=this._longitudeCyclical),this.renderer&&(this.renderer.worldToPCSRatio=this._worldToPCSRatio)):this.renderer.disposeOverlays()}registerDrapeSource(e,t,r){this._drapeSources.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources);const s=this.renderer.createDrapeSourceRenderer(e,t,r);return this._updateDrapeSourceExtent(e),this._setContentDirty(),this.notifyChange("running"),s}registerGeometryDrapeSource(e){return this.registerDrapeSource(e,X)}_updateDrapeSourceExtent(e){2===this.renderer.overlays.length&&null!=e.setDrapingExtent&&null!=this._spatialReference&&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("running"))}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.setDrawTexturesDirty()}setPlacementDirty(){this._placementDirty=!0}runTask(e){return this._updateOverlays(e,this.view.state.contentCamera,Y.UPDATE)}_updateOverlays(e,t,r){if(!this._spatialReference)return $;const s=this._computeOverlayResolution(t);this._computeOverlayExtents(t,s,le),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources,le.stretch);const i=this._updateOverlay(H.INNER,le.inner,s,1*le.pixelRatioAdjustment,le.mapUnitsPerPixel),a=T(le.inner)/T(le.outer),n=this._updateOverlay(H.OUTER,le.outer,s,a*le.pixelRatioAdjustment,le.mapUnitsPerPixel);i!==ue.EXTENT&&n!==ue.EXTENT||(this._drapeSources.forEach((e=>this._updateDrapeSourceExtent(e))),this.surface.updateTileOverlayParams(r)),i===ue.NONE&&n===ue.NONE||this.setDrawTexturesDirty(),this._placementDirty=!1,e.madeProgress()}_computeOverlayResolution(e){const t=this.view.state.contentPixelRatio*this.view.resolutionScale,r=e.fullWidth/e.pixelRatio*t,s=e.fullHeight/e.pixelRatio*t,i=Math.ceil(1.5*Math.max(r,s));return Math.min(K(i),this._maxResolution)}_updateOverlay(e,t,r,s,i){if(0===this.renderer.overlays.length)return ue.NONE;const a=this.renderer.overlays[e],n=a.mapUnitsPerPixel;if(a.mapUnitsPerPixel=i,a.pixelRatio=s,ie(t,a.extent)&&r===a.resolution)return n===i?ue.NONE:ue.RERENDER_ONLY;S(a.extent,t),a.resolution=r;const o=E(a.extent);return a.renderLocalOrigin=W(o[0],o[1],0,"OV_"+this._latestOriginId++),ue.EXTENT}setTileParameters(e){const t=e.renderData.overlay;if(this.renderer.overlays.length>0){const r=this.renderer.overlays[H.INNER],s=this.renderer.overlays[H.OUTER],i=e.extent;this._rectInsideRect(r.extent,i)||this._rectanglesOverlap(i,r.extent)||this._rectanglesOverlap(i,s.extent)?(this._setTileOverlayData(i,H.INNER,t),this._setTileOverlayData(i,H.OUTER,t)):(this._clearTileOverlayData(H.INNER,t),this._clearTileOverlayData(H.OUTER,t))}else this._clearTileOverlayData(H.INNER,t),this._clearTileOverlayData(H.OUTER,t)}overlayPixelSizeInMapUnits(e,t){if(0===this.renderer.overlays.length)return t();const r=this.renderer.overlays[H.INNER],s=this.renderer.overlays[H.OUTER],i=this._pointIsInExtent(e,r.extent)?r:s;return(i.extent[2]-i.extent[0])/i.resolution}_setTileOverlayData(e,t,r){if(0===this.renderer.overlays.length)return;const s=this.renderer.overlays[t].extent,i=T(s),a=P(s);let n=e[0];if(this._longitudeCyclical){n=this._longitudeCyclical.minimalMonotonic(s[0],n);const t=this._longitudeCyclical.minimalMonotonic(s[0],e[2]);n>t&&(n=t-(e[2]-e[0]))}r.setScale(t,T(e)/i,P(e)/a),r.setOffset(t,(n-s[0])/i,(e[1]-s[1])/a)}_clearTileOverlayData(e,t){t.setScale(e,-1,-1),t.setOffset(e,-1,-1)}reloadShaders(){Z(),this.setDrawTexturesDirty(),this.runTask(Q)}updateAnimation(e){return this.renderer.updateAnimation(e)&&(this._drawTexturesAnimateDirty=!0),this._drawTexturesAnimateDirty}setDrawTexturesDirty(){this.renderer.hasOverlays?(this._contentUpdated=!0,this._drawTexturesDirty=!0,this.view._stage.renderView.requestRender()):this.setPlacementDirty()}_intersectGroundFromView(e,t,r,s,i){const a=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(e,de,t,r);if(null==a)return!1;const n=a.origin,o=u(oe,a.origin,a.direction);this._groundIntersector.reset(n,o,e),this._groundIntersector.intersect([]),this.view.basemapTerrain.intersect(this._groundIntersector,null,n,o);const l=this._groundIntersector.results.min;return l.getIntersectionPoint(i)&&l.withinDistance(s)}_findHorizonBasedPointOfInterest(e,t){let r=.5;const a=.55,n=this.view.renderCoordsHelper.getAltitude(e.eye),o=this.view.pointsOfInterest.centerOnSurfaceFrequent,l=1e-5,h=i(o.estimatedSurfaceAltitude,e.aboveGround?-1/0:n+l,e.aboveGround?n-l:1/0),c=e.aboveGround;if("global"===this.view.viewingMode){const t=oe;U(A(G,O(this.view.spatialReference).radius+h),N(e.eye,e.viewForward),t),p(t,t,e.eye);const i=s.normalize(V(e.viewForward,t,e.viewRight))/e.fovY+.5,n=i<=0||i>=1?.5:a;r=c?n*i:i+n*(1-i)}else{const t=.5*Math.PI-Math.acos(-e.viewForward[2]),s=Math.tan(t),n=w(0,s,1,0),o=g(n,n,e.projectionMatrix)[1],l=i(.5+.5*o,0,1);r=1===l||0===l?.5:c?l*a:1-(1-l)*a}return this._intersectGroundFromView(e,.5,r,o.distance,t)}_computeOverlayExtents(e,t,r){const s=this.view.pointsOfInterest.centerOnSurfaceFrequent.renderLocation,i=y();this._findHorizonBasedPointOfInterest(e,i)||_(i,s),q.OVERLAY_SHOW_CENTER?(null==re&&(re=new B(this.view.graphics,"red")),re.show(i,this._renderSR)):null!=re&&re.hide();const n=Math.max(.1,m(e.eye,i)),o=L(this.view.renderCoordsHelper,s,e.eye);this._overlaySREqualsRenderSR||x(i,this._renderSR,i,this._spatialReference);const l=this.surface.extent,h=!this._isSpherical&&this._spatialReference?.isGeographic,c=h&&this._spatialReference?1/O(this._spatialReference).metersPerDegree:1,u=this.view.state.contentPixelRatio,p=e.perScreenPixelRatio/u*n*c;r.mapUnitsPerPixel=p/this._worldToPCSRatio,r.stretch=this._overlayStretch;let g=t*p/2*r.stretch,R=!1,w=h?90:1/0;this._isSpherical&&l&&this._spatialReference&&(this._spatialReference.isWebMercator?(g/=Math.cos(F(i[1])),w=l[3]):(R=!0,g/=O(this._spatialReference).metersPerDegree,w=90),g>=w&&(g=w,i[1]=0,this._spatialReference.isWebMercator&&(i[0]=0)));let D=1;R&&(D=1/Math.max(.2,Math.cos(Math.abs(a(i[1])))),g*D>180&&(D=180/g),r.mapUnitsPerPixel*=D);const E=Math.log(2)/12;g=Math.exp(Math.round(Math.log(g)/E)*E);const P=g*D,j=32,I=.5*t/(j*P),C=.5*t/(j*g);i[0]=Math.round(i[0]*I)/I,i[1]=Math.round(i[1]*C)/C;const N=r.inner;N[0]=i[0]-P,N[1]=i[1]-g,N[2]=i[0]+P,N[3]=i[1]+g,this._isSpherical&&this._shiftExtentToFitBounds(N,1/0,w);const U=r.outer;if(6*P>T(l))S(U,l);else{if(Math.PI/2-Math.abs(o-Math.PI/2)<=.25*Math.PI)U[0]=N[0]-P,U[1]=N[1]-g,U[2]=N[2]+P,U[3]=N[3]+g;else{x(e.eye,this._renderSR,oe,this._spatialReference),d(ne,i,oe);let t=-Math.atan2(ne[1],ne[0])+.125*Math.PI;t<0&&(t+=2*Math.PI);const r=Math.floor(t/(.25*Math.PI));f(ne,te[r],2*g),ne[0]*=D,ne[2]*=D,v(U,N,ne)}}if(this._isSpherical)U[0]=this._longitudeCyclical.clamp(U[0]),U[2]=this._longitudeCyclical.clamp(U[2]),U[1]=Math.max(U[1],-w),U[3]=Math.min(U[3],w);else{const e=M(N,l,he),t=M(U,l,ce);b(e,t)&&(U[2]=U[0],U[3]=U[1])}const A=Math.abs(N[2]-N[0])/t;r.mapUnitsPerPixel=Math.max(r.mapUnitsPerPixel,A),r.pixelRatioAdjustment=r.mapUnitsPerPixel/A}_precompileShaders(){return!!this.renderer.hasOverlays&&(this.renderer.precompileShaders(this.view.state),!0)}_drawOverlays(e,t=this.view.state){if(!this._drawTexturesDirty&&!this._drawTexturesAnimateDirty)return this.renderer;const r=this._drawTexturesDirty;this._drawTexturesDirty=this._drawTexturesAnimateDirty=!1;const s=this.renderer.computeValidity();this.renderer.releaseRenderTargets(),this.renderer.drawOverlays(t);return s!==this.renderer.computeValidity()&&this.surface.updateTileOverlayParams(Y.UPDATE),r?(this.surface.requestRender(e),e===Y.UPDATE&&this.surface.requestUpdate()):this.surface.requestRender(Y.BACKGROUND),this.renderer}_rectanglesOverlap(e,t){return null!=e&&(this._longitudeCyclical?(this._longitudeCyclical.contains(t[0],t[2],e[0])||this._longitudeCyclical.contains(t[0],t[2],e[2])||this._longitudeCyclical.contains(e[0],e[2],t[0]))&&!(e[1]>t[3]||e[3]<t[1]):j(e,t))}_rectInsideRect(e,t){return null!=t&&(this._longitudeCyclical?this._longitudeCyclical.contains(e[0],e[2],t[0])&&this._longitudeCyclical.contains(e[0],e[2],t[2])&&t[1]>e[1]&&t[3]<e[3]:b(e,t))}_pointIsInExtent(e,t){if(this._longitudeCyclical)return this._longitudeCyclical.contains(t[0],t[2],e.x)&&e.y>=t[1]&&e.y<=t[3];const r=e.x,s=e.y;return r>t[0]&&r<t[2]&&s>t[1]&&s<t[3]}_shiftExtentToFitBounds(e,t,r){let s=0,i=0;e[0]<-t?s=e[0]+t:e[2]>t&&(s=t-e[2]),e[1]<-r?i=e[1]+r:e[3]>r&&(i=r-e[3]),I(e,s,i)}get test(){}};function ie(e,t){const r=1e-5,s=q.TESTS_DISABLE_OPTIMIZATIONS?0:r*Math.max(e[2]-e[0],e[3]-e[1],t[2]-t[0],t[3]-t[1]);return Math.abs(t[0]-e[0])<=s&&Math.abs(t[1]-e[1])<=s&&Math.abs(t[2]-e[2])<=s&&Math.abs(t[3]-e[3])<=s}e([h()],se.prototype,"_spatialReference",void 0),e([h({readOnly:!0})],se.prototype,"running",null),e([h()],se.prototype,"_placementDirty",void 0),e([h()],se.prototype,"_contentUpdated",void 0),e([h()],se.prototype,"_isSpherical",null),e([h()],se.prototype,"_worldToPCSRatio",null),e([h()],se.prototype,"renderer",void 0),e([h({constructOnly:!0})],se.prototype,"view",void 0),e([h({constructOnly:!0})],se.prototype,"surface",void 0),e([h()],se.prototype,"suspended",null),e([h()],se.prototype,"updating",null),e([h({type:Boolean})],se.prototype,"rendersOccludedDraped",null),se=e([c("esri.views.3d.terrain.OverlayManager")],se);class ae{constructor(){this.inner=D(),this.outer=D(),this.mapUnitsPerPixel=0,this.pixelRatioAdjustment=1,this.stretch=ee}}const ne=R(),oe=y(),le=new ae,he=D(),ce=D(),de=C();var ue;!function(e){e[e.NONE=0]="NONE",e[e.EXTENT=1]="EXTENT",e[e.RERENDER_ONLY=2]="RERENDER_ONLY"}(ue||(ue={}));export{se as OverlayManager};