@arcgis/core 4.32.0-next.20250106 → 4.32.0-next.20250108

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 (228) hide show
  1. package/AttributeBinsGraphic.js +5 -0
  2. package/README.md +1 -1
  3. package/WebLinkChart.js +1 -1
  4. package/applications/MapViewer/templateUtils.js +1 -1
  5. package/assets/esri/core/workers/RemoteClient.js +1 -1
  6. package/assets/esri/core/workers/chunks/000771f8eefcd6af0fda.js +1 -0
  7. package/assets/esri/core/workers/chunks/{9372d08ba8bf3342c48f.js → 011ccfd3acee83e7dc68.js} +1 -1
  8. package/assets/esri/core/workers/chunks/03af4a51043677ffcd0f.js +1 -0
  9. package/assets/esri/core/workers/chunks/{d07da8b63d83af179a2c.js → 05943caacfd28c383810.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{9f495ad57cdbfa90c5b8.js → 095aeb19e2207c8361ca.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{67c7bdc0c91a8f803ea8.js → 11cb25dfab7c8467897a.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{07304287ed5244fa4e12.js → 12b2c8251ec2d0e2ca46.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{42aa697b4718b75b8cb2.js → 1abeba63bf623a746d5c.js} +2 -2
  14. package/assets/esri/core/workers/chunks/{42aa697b4718b75b8cb2.js.LICENSE.txt → 1abeba63bf623a746d5c.js.LICENSE.txt} +1 -1
  15. package/assets/esri/core/workers/chunks/{a57cead317eb2fc9afd8.js → 206194cf069ad4bcc3ad.js} +1 -1
  16. package/assets/esri/core/workers/chunks/24a597ae32a2083a50a5.js +1 -0
  17. package/assets/esri/core/workers/chunks/{0673d811c496143fc3d4.js → 2779cf112299b612a73a.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{bd37c9cc720587665fd3.js → 304b88ade7551130ad3a.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{aedff36d3fec86abb9fb.js → 30a84ddf0384bb52fdbe.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{367af4aa7e170c8553e3.js → 33a13544b9e5f4f20bce.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{dce55e7f76adecc055c3.js → 35d9457109d0631a1ca8.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{3a90163b76b0bc7f21d2.js → 3767defbd9c4b2e86886.js} +1 -1
  23. package/assets/esri/core/workers/chunks/3a3e9701e5d7b05f41b7.js +1 -0
  24. package/assets/esri/core/workers/chunks/{9a498f2c007f4d78d4dd.js → 4234539a9721104acafb.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{76fa5c7c87831ad25cde.js → 435c037ccba71f1e22d3.js} +1 -1
  26. package/assets/esri/core/workers/chunks/4387c47ae1b36d770f1d.js +1 -0
  27. package/assets/esri/core/workers/chunks/44ec3c77339b9765aaa4.js +1 -0
  28. package/assets/esri/core/workers/chunks/4b77c8d994498899631a.js +1 -0
  29. package/assets/esri/core/workers/chunks/510cb8647841fec436c8.js +1 -0
  30. package/assets/esri/core/workers/chunks/{f9af0473878d960a02f2.js → 58485909e1cfeb52c01e.js} +1 -1
  31. package/assets/esri/core/workers/chunks/5b61a1e7ac60a02a906d.js +1 -0
  32. package/assets/esri/core/workers/chunks/62f8949a2d9076f3c1ea.js +2 -0
  33. package/assets/esri/core/workers/chunks/{c8cd6ba5600d8ff8db0b.js.LICENSE.txt → 62f8949a2d9076f3c1ea.js.LICENSE.txt} +1 -1
  34. package/assets/esri/core/workers/chunks/{664aa401887b59abd7b7.js → 6400f39a965900f66ce7.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{ddce265c46e4dfeb6c6d.js → 66d40a486aa3caa76106.js} +1 -1
  36. package/assets/esri/core/workers/chunks/6b3ee691646fbc39445c.js +1 -0
  37. package/assets/esri/core/workers/chunks/{533a7fd64b17bb294545.js → 6c58f792e2ae3736f662.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{370b230fd2d7703d0698.js → 6efb36bc2205203ff44d.js} +2 -2
  39. package/assets/esri/core/workers/chunks/{370b230fd2d7703d0698.js.LICENSE.txt → 6efb36bc2205203ff44d.js.LICENSE.txt} +1 -1
  40. package/assets/esri/core/workers/chunks/76a7114a69264f5c07b0.js +2 -0
  41. package/assets/esri/core/workers/chunks/{005727711cca0614c2ab.js.LICENSE.txt → 76a7114a69264f5c07b0.js.LICENSE.txt} +1 -1
  42. package/assets/esri/core/workers/chunks/{a90611cdc86190799560.js → 7a43fda8984549a084b8.js} +1 -1
  43. package/assets/esri/core/workers/chunks/7b753da3b8a6d75abf20.js +1 -0
  44. package/assets/esri/core/workers/chunks/{ca1e186f136abb23ae4b.js → 7d0fc25ce1f74adcfeb6.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{9b020c47ca9ff5de9bb8.js → 7db356976198c4df76c1.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{9ad7d095e614e7e8d7f5.js → 7df076d15b7b7a66dcee.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{955421ee2247965244f0.js → 7fe92f072d3641ec4662.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{4c56698cf1c669371865.js → 81816410cb1453938593.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{4ffaa2c5ab47a599ee9f.js → 82266ca8002554198208.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{88c68881cbdf4e911832.js → 89286d8f59844724cd16.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{f19d3c855f6e93544918.js → 8be0151a24c9af76a976.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{d9e396adf3354ee68339.js → 8f2b2d2dc9935b0d2039.js} +1 -1
  53. package/assets/esri/core/workers/chunks/907a91266e25cc4b9d42.js +1 -0
  54. package/assets/esri/core/workers/chunks/{a77aa86896bbb0e088df.js → 9857491cafa0278d9ae6.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{993db7646a8fc60179eb.js → 98da074899c82f0ded0b.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{3bb94da29dac3367ecc6.js → a1edd3f68e691ea39594.js} +1 -1
  57. package/assets/esri/core/workers/chunks/a8ec4189ec3b37d5ff74.js +1 -0
  58. package/assets/esri/core/workers/chunks/{6a4305eb1e52b80ecb5c.js → b8ea84adff5619040494.js} +3 -3
  59. package/assets/esri/core/workers/chunks/c4374b6bc5c8dc6435c7.js +1 -0
  60. package/assets/esri/core/workers/chunks/c5a928dcff7dc8a8cc9f.js +2 -0
  61. package/assets/esri/core/workers/chunks/{f4e3db71d1adae717535.js.LICENSE.txt → c5a928dcff7dc8a8cc9f.js.LICENSE.txt} +1 -1
  62. package/assets/esri/core/workers/chunks/cac79b64a7dade8bf486.js +2 -0
  63. package/assets/esri/core/workers/chunks/{bf0a0ca7fdac98f06a89.js.LICENSE.txt → cac79b64a7dade8bf486.js.LICENSE.txt} +1 -1
  64. package/assets/esri/core/workers/chunks/cd92b80de7e9f982f9a9.js +1 -0
  65. package/assets/esri/core/workers/chunks/{2cccaf50134c65944e0a.js → d0876eed5249b029f9f0.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{178f606c8896ae5f39de.js → d1dbbab4a4c6072c182f.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{8e42fb623f56942958d8.js → d74b5dc60f02892d03e7.js} +1 -1
  68. package/assets/esri/core/workers/chunks/e27b8674a3492db51f2e.js +1 -0
  69. package/assets/esri/core/workers/chunks/{756c2f7c8659deab6c96.js → e2d987c39a6ef318511c.js} +2 -2
  70. package/assets/esri/core/workers/chunks/{756c2f7c8659deab6c96.js.LICENSE.txt → e2d987c39a6ef318511c.js.LICENSE.txt} +1 -1
  71. package/assets/esri/core/workers/chunks/{943428cf643e87ccfaad.js → e7e26b71f9eb28421936.js} +1 -1
  72. package/assets/esri/core/workers/chunks/{f0adabf6d71a27f3183b.js → e80b0646a7e0e466ea65.js} +1 -1
  73. package/assets/esri/core/workers/chunks/e9c21907fabcedbd32ae.js +1 -0
  74. package/assets/esri/core/workers/chunks/{3ed7c8138231de3a3b96.js → f8c960df1dabab120c70.js} +1 -1
  75. package/assets/esri/core/workers/chunks/{fdd8a5eb07466541f1f9.js → fd95b19f02d8dfef2baf.js} +1 -1
  76. package/assets/esri/widgets/support/GridControls/t9n/GridControls_ja.json +1 -1
  77. package/chunks/CrackAndCluster-CfzXpEle.js +1 -1
  78. package/chunks/LineSeries.js +1 -1
  79. package/chunks/OperatorProject.js +1 -1
  80. package/chunks/Pattern.glsl.js +1 -1
  81. package/chunks/QuadraticBezier.js +1 -1
  82. package/chunks/Transformation2D.js +1 -1
  83. package/chunks/bufferOperator.js +1 -1
  84. package/chunks/chartUtilsAm5.js +1 -1
  85. package/chunks/geodesicBufferOperator.js +1 -1
  86. package/chunks/lyr3DWorker.js +1 -1
  87. package/chunks/terrainUtilsPlanar.js +1 -1
  88. package/chunks/terrainUtilsSpherical.js +1 -1
  89. package/chunks/vxlLayer.js +1 -1
  90. package/geometry/operators/graphicBufferOperator.js +1 -1
  91. package/geometry/support/meshUtils/primitives.js +1 -1
  92. package/geometry/support/meshVertexSpaceUtils.js +1 -1
  93. package/geometry/support/triangle.js +1 -1
  94. package/interfaces.d.ts +186 -96
  95. package/layers/LinkChartLayer.js +1 -1
  96. package/layers/MapNotesLayer.js +1 -1
  97. package/layers/MediaLayer.js +1 -1
  98. package/layers/graphics/data/QueryEngineResult.js +1 -1
  99. package/layers/graphics/data/queryUtils.js +1 -1
  100. package/layers/graphics/data/queryValidationUtils.js +1 -1
  101. package/layers/graphics/sources/WFSSource.js +1 -1
  102. package/layers/support/ImageElement.js +1 -1
  103. package/layers/support/VideoElement.js +1 -1
  104. package/layers/support/capabilities.js +1 -1
  105. package/layers/support/featureLayerUtils.js +1 -1
  106. package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
  107. package/layers/support/serviceCapabilitiesUtils.js +1 -1
  108. package/layers/video/VideoController.js +1 -1
  109. package/linkChart/OrganicLayoutSettings.js +1 -1
  110. package/package.json +4 -4
  111. package/renderers/RasterStretchRenderer.js +1 -1
  112. package/rest/query/executeAttributeBinsQuery.js +1 -1
  113. package/rest/support/AttributeBinsFeatureSet.js +5 -0
  114. package/rest/support/AttributeBinsQuery.js +1 -1
  115. package/rest/support/BinParametersAttributes.js +1 -1
  116. package/rest/support/BinParametersBase.js +1 -1
  117. package/rest/support/DateBinParameters.js +1 -1
  118. package/rest/support/FeatureSet.js +1 -1
  119. package/rest/support/NormalizationBinParametersMixin.js +1 -1
  120. package/rest/support/Query.js +1 -1
  121. package/rest/support/TopFeaturesQuery.js +1 -1
  122. package/smartMapping/renderers/color.js +1 -1
  123. package/smartMapping/renderers/dotDensity.js +1 -1
  124. package/smartMapping/renderers/pieChart.js +1 -1
  125. package/smartMapping/renderers/size.js +1 -1
  126. package/smartMapping/renderers/univariateColorSize.js +1 -1
  127. package/smartMapping/statistics/summaryStatisticsForAttributes.js +1 -1
  128. package/support/mediaLayerUtils.js +5 -0
  129. package/support/revision.js +1 -1
  130. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  131. package/symbols/cim/cimAnalyzer.js +1 -1
  132. package/symbols/cim/placements/PlacementInsidePolygon.js +1 -1
  133. package/views/2d/AnimationManager.js +1 -1
  134. package/views/2d/engine/Bitmap.js +1 -1
  135. package/views/2d/engine/BitmapContainer.js +1 -1
  136. package/views/2d/engine/BitmapTileContainer.js +1 -1
  137. package/views/2d/engine/vectorTiles/buckets/FillBucket.js +1 -1
  138. package/views/2d/engine/webgl/Overlay.js +1 -1
  139. package/views/2d/engine/webgl/SDFConverter.js +1 -1
  140. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  141. package/views/2d/engine/webgl/shaderGraph/techniques/bitmap/BitmapTechnique.js +1 -1
  142. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/hittestUtils.js +1 -1
  143. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  144. package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
  145. package/views/2d/layers/features/support/GraphicsReader.js +1 -1
  146. package/views/2d/navigation/MapViewNavigation.js +1 -1
  147. package/views/2d/support/HighlightGroup.js +1 -1
  148. package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
  149. package/views/3d/analysis/Slice/ShiftManipulator.js +1 -1
  150. package/views/3d/analysis/Viewshed/FieldOfViewManipulation.js +1 -1
  151. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  152. package/views/3d/analysis/support/measurementUtils.js +1 -1
  153. package/views/3d/environment/CloudsParameters.js +1 -1
  154. package/views/3d/environment/MarsAtmosphere.js +1 -1
  155. package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
  156. package/views/3d/layers/MediaLayerView3D.js +1 -1
  157. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  158. package/views/3d/layers/graphics/placementUtils.js +1 -1
  159. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  160. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  161. package/views/3d/state/NearFarHeuristic.js +1 -1
  162. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  163. package/views/3d/support/HighlightGroup.js +1 -1
  164. package/views/3d/terrain/SphericalPatch.js +1 -1
  165. package/views/3d/terrain/TerrainRenderer.js +1 -1
  166. package/views/3d/terrain/TerrainSurface.js +1 -1
  167. package/views/3d/terrain/TilePerLayerInfo.js +1 -1
  168. package/views/3d/terrain/TileRenderer.js +1 -1
  169. package/views/3d/terrain/TileTexture.js +1 -1
  170. package/views/3d/terrain/terrainUtilsPlanar.js +1 -1
  171. package/views/3d/terrain/terrainUtilsSpherical.js +1 -1
  172. package/views/3d/webgl-engine/collections/Component/ComponentIntersectionData.js +1 -1
  173. package/views/3d/webgl-engine/collections/Component/SourceGeometry.js +1 -1
  174. package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
  175. package/views/3d/webgl-engine/lib/PathProfile.js +1 -1
  176. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  177. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  178. package/views/3d/webgl-engine/shaders/OutputColorHighlightOID.glsl.js +4 -4
  179. package/views/SceneView.js +1 -1
  180. package/views/View.js +1 -1
  181. package/views/draw/support/HighlightHelper.js +1 -1
  182. package/views/input/BrowserEventSource.js +1 -1
  183. package/views/layers/DimensionLayerView.js +1 -1
  184. package/views/layers/MediaLayerView.js +1 -1
  185. package/views/support/HighlightGroup.d.ts +4 -0
  186. package/views/support/HighlightGroup.js +5 -0
  187. package/views/webgl/Texture.js +1 -1
  188. package/views/webgl/textureUtils.js +5 -0
  189. package/webscene/Slide.js +1 -1
  190. package/widgets/BasemapLayerList.js +1 -1
  191. package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
  192. package/widgets/CatalogLayerList.js +1 -1
  193. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  194. package/widgets/Editor/UpdateWorkflow.js +1 -1
  195. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  196. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  197. package/widgets/FeatureTable/support/exportUtils.js +1 -1
  198. package/widgets/FeatureTable/support/tableUtils.js +1 -1
  199. package/widgets/LayerList/support/layerListUtils.js +1 -1
  200. package/widgets/LayerList.js +1 -1
  201. package/widgets/Legend/styles/support/relationshipUtils.js +1 -1
  202. package/widgets/PanoramicViewer/utils.js +1 -1
  203. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
  204. package/widgets/Sketch/SketchViewModel.js +1 -1
  205. package/widgets/TableList.js +1 -1
  206. package/widgets/support/ColorPicker.js +1 -1
  207. package/assets/esri/core/workers/chunks/005727711cca0614c2ab.js +0 -2
  208. package/assets/esri/core/workers/chunks/0a3bf1b74cce1b6b7ed8.js +0 -1
  209. package/assets/esri/core/workers/chunks/0d2411a941c42acb8cc2.js +0 -1
  210. package/assets/esri/core/workers/chunks/127c82cdb229434883b6.js +0 -1
  211. package/assets/esri/core/workers/chunks/13720b1d97fb7d80e972.js +0 -1
  212. package/assets/esri/core/workers/chunks/14b87f3dd9942e6b19d0.js +0 -1
  213. package/assets/esri/core/workers/chunks/16530347bd78dc6c2fcd.js +0 -1
  214. package/assets/esri/core/workers/chunks/1a713cc601c6fcd97d2f.js +0 -1
  215. package/assets/esri/core/workers/chunks/3029354194f1a3030c5c.js +0 -1
  216. package/assets/esri/core/workers/chunks/318a39b56851e707edad.js +0 -1
  217. package/assets/esri/core/workers/chunks/53cd990b2c988518de6d.js +0 -1
  218. package/assets/esri/core/workers/chunks/5a0eb9dfe668cf290462.js +0 -1
  219. package/assets/esri/core/workers/chunks/66b411119b8ffb99b9dc.js +0 -1
  220. package/assets/esri/core/workers/chunks/8cd2c9ec1e541836b81c.js +0 -1
  221. package/assets/esri/core/workers/chunks/9f0ebeae8a3ba360284b.js +0 -1
  222. package/assets/esri/core/workers/chunks/a3cef3837f4df9ab022e.js +0 -1
  223. package/assets/esri/core/workers/chunks/bf0a0ca7fdac98f06a89.js +0 -2
  224. package/assets/esri/core/workers/chunks/c8cd6ba5600d8ff8db0b.js +0 -2
  225. package/assets/esri/core/workers/chunks/ea250d66089967976c05.js +0 -1
  226. package/assets/esri/core/workers/chunks/ecf317c6c790b3cc83bf.js +0 -1
  227. package/assets/esri/core/workers/chunks/f4e3db71d1adae717535.js +0 -2
  228. package/views/2d/support/HighlightGroup.d.ts +0 -4
@@ -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{getContrast as t}from"../../../../core/colorUtils.js";import{watch as r,initial as o}from"../../../../core/reactiveUtils.js";import{identity as a,translate as n,scale as i,fromQuat as s,multiply as c}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{rotationTo as m}from"../../../../core/libs/gl-matrix-2/math/quat.js";import{d as p,n as u,h as f,g as d,i as g}from"../../../../chunks/vec32.js";import{create as h,fromValues as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{sv3d as j,sm4d as O,sq4d as w}from"../../../../geometry/support/vectorStacks.js";import{shiftRestartOffsetDistance as M,shiftRestartTipRadius as R,shiftRestartTipLength as v,shiftRestartArrowOutlineWidth as C,shiftRestartArrowLength as T,shiftRestartTubeRadius as U,shiftRestartTubeFocusMultiplier as _,shiftRestartTipFocusMultiplier as A}from"./sliceToolConfig.js";import{DidPointerMoveRecentlyFlag as E,IsShiftEdgeOnScreenFlag as N}from"./sliceToolUtils.js";import{Manipulator3D as F}from"../../interactive/Manipulator3D.js";import{RenderObject as y}from"../../interactive/RenderObject.js";import{CullFaceOptions as B}from"../../webgl-engine/lib/basicInterfaces.js";import{createPolylineGeometry as D,createConeGeometry as L,createPathExtrusionGeometry as P}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as x}from"../../webgl-engine/lib/Material.js";import{ColorMaterial as k}from"../../webgl-engine/materials/ColorMaterial.js";import{RibbonLineMaterial as G}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{ManipulatorStateFlags as q}from"../../../interactive/interfaces.js";var H;!function(e){e[e.CENTER_ON_CALLOUT=0]="CENTER_ON_CALLOUT",e[e.CENTER_ON_ARROW=1]="CENTER_ON_ARROW"}(H||(H={}));class I extends F{constructor(a,n){const i=new G({width:1,renderOccluded:x.OccludeAndTransparent,isDecoration:!0}),s=new k({cullFace:B.Back,renderOccluded:x.Opaque,isDecoration:!0}),c=new k({cullFace:B.Back,renderOccluded:x.Opaque,isDecoration:!0}),l=new k({cullFace:B.Back,renderOccluded:x.Opaque,isDecoration:!0}),m=new k({writeDepth:!1,cullFace:B.Front,renderOccluded:x.Transparent,isDecoration:!0});super({view:a,...S({offsetMode:n,tubeMaterial:s,tipMaterial:c,capMaterial:l,outlineMaterial:m,calloutMaterial:i})}),this._themeHandle=r((()=>a.effectiveTheme.accentColor),(r=>{const o=t(r),a=e.toUnitRGBA(r),n=e.toUnitRGBA(o),p=e.toUnitRGBA(e.blendColors(o,r,.4)),u=e.toUnitRGBA(e.blendColors(o,r,.14));i.setParameters({color:a}),s.setParameters({color:u}),c.setParameters({color:n}),l.setParameters({color:p}),m.setParameters({color:a})}),o)}destroy(){this._themeHandle.remove(),super.destroy()}}function S({offsetMode:e,tubeMaterial:t,tipMaterial:r,capMaterial:o,outlineMaterial:a,calloutMaterial:n}){const i=e===H.CENTER_ON_CALLOUT?M:0,s=[b(i,0,-T/2),b(i,0,T/2)],c=J(s),l=W({vertices:s,padding:0,materials:{tube:t,tip:r,cap:o}}),m=W({vertices:s,padding:C,materials:{tube:a,tip:a,cap:a}}),p=D(n,[[i,0,0],[i-M,0,0]]),u=D(n,[[i,0,0],[i-M,0,0]]);return{renderObjects:[...l.normal.map((e=>new y(e,q.Unfocused|E))),...m.normal.map((e=>new y(e,q.Unfocused|E))),new y(p,q.Unfocused|E|N),...l.focused.map((e=>new y(e,q.Focused|E))),...m.focused.map((e=>new y(e,q.Focused|E))),new y(u,q.Focused|E|N)],autoScaleRenderObjects:!1,collisionType:{type:"line",paths:[c]},collisionPriority:1,radius:R,state:E}}function W({vertices:e,padding:t,materials:r}){const o=o=>{const M=e.slice(),C=p(j.get(),M[0],M[1]);u(C,C);const T=p(j.get(),M[M.length-1],M[M.length-2]);if(u(T,T),t>0){const e=f(h(),T,-t);M[M.length-1]=d(e,e,M[M.length-1]);const r=f(h(),C,-t);M[0]=d(r,r,M[0])}const E=o?A:1,N=v*E,F=R*E,y=a(O.get());if(t>0){const e=N/4,r=g(j.get(),0,e,0),o=1+t/e;n(y,y,r),i(y,y,g(j.get(),o,o,o)),n(y,y,f(r,r,-1/o))}const B=a(l()),D=b(0,1,0),P=s(l(),m(w.get(),D,T));P[12]=M[M.length-1][0],P[13]=M[M.length-1][1],P[14]=M[M.length-1][2],c(P,P,y);const x=r.tube,k=z(U*(o?_:1)+t,M,x);k.transformation=B;const G=[k],q=r.tip,H=L(q,N,F,24,!1,!1,!0);H.transformation=P,G.push(H);const I=r.cap,S=L(I,N,F,24,!1,!0,!1);S.transformation=P,G.push(S);const W=s(l(),m(w.get(),D,C));return W[12]=M[0][0],W[13]=M[0][1],W[14]=M[0][2],c(W,W,y),G.push(H.instantiate({transformation:W})),G.push(S.instantiate({transformation:W})),G};return{normal:o(!1),focused:o(!0)}}function z(e,t,r){const o=[],a=12;for(let n=0;n<a;n++){const t=n/a*2*Math.PI;o.push([Math.cos(t)*e,Math.sin(t)*e])}return P(r,o,t,[],[],!1)}function J(e,t){const r=p(h(),e[e.length-1],e[e.length-2]);u(r,r),f(r,r,v),d(r,r,e[e.length-1]);{const t=p(h(),e[0],e[1]);return u(t,t),f(t,t,v),d(t,t,e[0]),[t,...e,r]}}export{H as OffsetMode,I as ShiftManipulator};
5
+ import e from"../../../../Color.js";import{getContrast as t}from"../../../../core/colorUtils.js";import{watch as r,initial as o}from"../../../../core/reactiveUtils.js";import{identity as a,translate as n,scale as i,fromQuat as s,multiply as c}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{rotationTo as m}from"../../../../core/libs/gl-matrix-2/math/quat.js";import{d as p,n as u,h as f,g as d,i as g}from"../../../../chunks/vec32.js";import{create as h,fromValues as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{sv3d as j,sm4d as O,sq4d as w}from"../../../../geometry/support/vectorStacks.js";import{shiftRestartOffsetDistance as M,shiftRestartTipRadius as R,shiftRestartTipLength as v,shiftRestartArrowOutlineWidth as C,shiftRestartArrowLength as T,shiftRestartTubeRadius as U,shiftRestartTubeFocusMultiplier as _,shiftRestartTipFocusMultiplier as A}from"./sliceToolConfig.js";import{DidPointerMoveRecentlyFlag as E,IsShiftEdgeOnScreenFlag as N}from"./sliceToolUtils.js";import{Manipulator3D as F}from"../../interactive/Manipulator3D.js";import{RenderObject as y}from"../../interactive/RenderObject.js";import{CullFaceOptions as B}from"../../webgl-engine/lib/basicInterfaces.js";import{createPolylineGeometry as D,createConeGeometry as L,createPathExtrusionGeometry as P}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as x}from"../../webgl-engine/lib/Material.js";import{ColorMaterial as k}from"../../webgl-engine/materials/ColorMaterial.js";import{RibbonLineMaterial as G}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{ManipulatorStateFlags as q}from"../../../interactive/interfaces.js";var H;!function(e){e[e.CENTER_ON_CALLOUT=0]="CENTER_ON_CALLOUT",e[e.CENTER_ON_ARROW=1]="CENTER_ON_ARROW"}(H||(H={}));class I extends F{constructor(a,n){const i=new G({width:1,renderOccluded:x.OccludeAndTransparent,isDecoration:!0}),s=new k({cullFace:B.Back,renderOccluded:x.Opaque,isDecoration:!0}),c=new k({cullFace:B.Back,renderOccluded:x.Opaque,isDecoration:!0}),l=new k({cullFace:B.Back,renderOccluded:x.Opaque,isDecoration:!0}),m=new k({writeDepth:!1,cullFace:B.Front,renderOccluded:x.Transparent,isDecoration:!0});super({view:a,...S({offsetMode:n,tubeMaterial:s,tipMaterial:c,capMaterial:l,outlineMaterial:m,calloutMaterial:i})}),this._themeHandle=r((()=>a.effectiveTheme.accentColor),(r=>{const o=t(r),a=e.toUnitRGBA(r),n=e.toUnitRGBA(o),p=e.toUnitRGBA(e.blendColors(o,r,.4)),u=e.toUnitRGBA(e.blendColors(o,r,.14));i.setParameters({color:a}),s.setParameters({color:u}),c.setParameters({color:n}),l.setParameters({color:p}),m.setParameters({color:a})}),o)}destroy(){this._themeHandle.remove(),super.destroy()}}function S({offsetMode:e,tubeMaterial:t,tipMaterial:r,capMaterial:o,outlineMaterial:a,calloutMaterial:n}){const i=e===H.CENTER_ON_CALLOUT?M:0,s=[b(i,0,-24),b(i,0,T/2)],c=J(s),l=W({vertices:s,padding:0,materials:{tube:t,tip:r,cap:o}}),m=W({vertices:s,padding:C,materials:{tube:a,tip:a,cap:a}}),p=D(n,[[i,0,0],[i-M,0,0]]),u=D(n,[[i,0,0],[i-M,0,0]]);return{renderObjects:[...l.normal.map((e=>new y(e,q.Unfocused|E))),...m.normal.map((e=>new y(e,q.Unfocused|E))),new y(p,q.Unfocused|E|N),...l.focused.map((e=>new y(e,q.Focused|E))),...m.focused.map((e=>new y(e,q.Focused|E))),new y(u,q.Focused|E|N)],autoScaleRenderObjects:!1,collisionType:{type:"line",paths:[c]},collisionPriority:1,radius:R,state:E}}function W({vertices:e,padding:t,materials:r}){const o=o=>{const M=e.slice(),C=p(j.get(),M[0],M[1]);u(C,C);const T=p(j.get(),M[M.length-1],M[M.length-2]);if(u(T,T),t>0){const e=f(h(),T,-t);M[M.length-1]=d(e,e,M[M.length-1]);const r=f(h(),C,-t);M[0]=d(r,r,M[0])}const E=o?A:1,N=v*E,F=R*E,y=a(O.get());if(t>0){const e=N/4,r=g(j.get(),0,e,0),o=1+t/e;n(y,y,r),i(y,y,g(j.get(),o,o,o)),n(y,y,f(r,r,-1/o))}const B=a(l()),D=b(0,1,0),P=s(l(),m(w.get(),D,T));P[12]=M[M.length-1][0],P[13]=M[M.length-1][1],P[14]=M[M.length-1][2],c(P,P,y);const x=r.tube,k=z(U*(o?_:1)+t,M,x);k.transformation=B;const G=[k],q=r.tip,H=L(q,N,F,24,!1,!1,!0);H.transformation=P,G.push(H);const I=r.cap,S=L(I,N,F,24,!1,!0,!1);S.transformation=P,G.push(S);const W=s(l(),m(w.get(),D,C));return W[12]=M[0][0],W[13]=M[0][1],W[14]=M[0][2],c(W,W,y),G.push(H.instantiate({transformation:W})),G.push(S.instantiate({transformation:W})),G};return{normal:o(!1),focused:o(!0)}}function z(e,t,r){const o=[],a=12;for(let n=0;n<a;n++){const t=n/a*2*Math.PI;o.push([Math.cos(t)*e,Math.sin(t)*e])}return P(r,o,t,[],[],!1)}function J(e,t){const r=p(h(),e[e.length-1],e[e.length-2]);u(r,r),f(r,r,v),d(r,r,e[e.length-1]);{const t=p(h(),e[0],e[1]);return u(t,t),f(t,t,v),d(t,t,e[0]),[t,...e,r]}}export{H as OffsetMode,I as ShiftManipulator};
@@ -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 t from"../../../../Color.js";import r from"../../../../core/Handles.js";import{handlesGroup as e}from"../../../../core/handleUtils.js";import{deg2rad as i,clamp as a}from"../../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{watch as n,initial as s}from"../../../../core/reactiveUtils.js";import{fromYRotation as l,fromXRotation as c,fromScaling as u,fromZRotation as p,fromRotation as m,multiply as h}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as d,a as g,h as _}from"../../../../chunks/vec32.js";import{fromValues as M,create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{f as v}from"../../../../chunks/boundedPlane.js";import{viewshedToolManipulatorConfiguration as j}from"./ViewshedConfiguration.js";import{screenToCircleAngle as w,getViewshedRotationMatrix as A}from"./viewshedToolUtils.js";import{Manipulator3D as V}from"../../interactive/Manipulator3D.js";import{RenderObject as E}from"../../interactive/RenderObject.js";import{ManipulatorType as O}from"../../interactive/editingTools/ManipulatorType.js";import{InteractiveManipulation as T}from"../../interactive/editingTools/manipulations/InteractiveManipulation.js";import{createPolylineGeometry as y}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as U}from"../../webgl-engine/lib/Material.js";import{assert as R}from"../../webgl-engine/lib/Util.js";import{RibbonLineMaterial as S}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createManipulatorDragEventPipeline as x}from"../../../interactive/dragEventPipeline.js";import{ManipulatorStateFlags as P}from"../../../interactive/interfaces.js";class C extends T{constructor(t){super(),this._handles=new r,this._tool=t.tool,this._view=t.view,this._focusedArcMaterial=this._createArcMaterial(!0),this._unfocusedArcMaterial=this._createArcMaterial(!1),this._createManipulators(),this.forEachManipulator((t=>this._tool.manipulators.add(t)))}destroy(){this._handles=o(this._handles),this.forEachManipulator((t=>{this._tool.manipulators.remove(t),t.destroy()})),this._tool=null,this._view=null,this._manipulators=null}createDragPipeline(t,r){const i=Object.values(this._manipulators);return e(i.map((({manipulator:e,side:i})=>x(e,((e,a,o,n,s)=>{const l=k(i,r),c=a.next((t=>({...t,manipulatorType:O.SCALE,side:i}))),u=w(c,this._view,l,r);t(e,u,o)})))))}updateManipulatorsTransform(t){t.arcCentersPoints(J),this._forEachManipulatorInfo((r=>this._updateArcManipulatorTransform(r,t,J[r.side])))}updateManipulatorVisuals(t){this._forEachManipulatorInfo((r=>this._updateArcManipulatorVisuals(r,t)))}_updateArcManipulatorVisuals({manipulator:t,side:r},e){const i=[];if(null!=e){const[a,o]=F(r,e,this._unfocusedArcMaterial);i.push(new E(a,P.Unfocused),new E(a.instantiate({material:this._focusedArcMaterial}),P.Focused)),t.collisionType={type:"line",paths:[o]}}t.renderObjects=i,t.radius=j.collisionRadius}_updateArcManipulatorTransform({manipulator:t,side:r},e,a){const o=e.horizontalFieldOfView,n=i(e.verticalFieldOfView/2),s=i(o/2),g=z(r);t.renderLocation=a;const _=f(),M=t=>{h(_,t,_)};M(l(H,i(-90))),g||M(c(H,n));const b=e.farDistanceRenderSpace;let v,j;M(u(H,d(W,b,b,b))),M(p(H,L(r))),M(A(e,H)),g?(v=s,j=e.tiltedUpVector):(j=e.rightVector,v=n),v*="right"===r||"bottom"===r?-1:1;const w=m(H,v,j);null!=w&&M(w),t.modelTransform=_}_createManipulators(){const t=this._createArcManipulator("left"),r=this._createArcManipulator("right"),e=this._createArcManipulator("top"),i=this._createArcManipulator("bottom");this._manipulators={left:t,right:r,top:e,bottom:i};[[i.manipulator,e.manipulator],[t.manipulator,r.manipulator]].forEach((([t,r])=>{t.metadata={pairedManipulator:r},r.metadata={pairedManipulator:t}}))}_createArcManipulator(t){const r=new V({view:this._view,autoScaleRenderObjects:!1,worldSized:!0}),e={manipulator:r,side:t};return this._updateArcManipulatorVisuals(e),this._handles.add(r.events.on("focus-changed",(t=>{const e=r.metadata?.pairedManipulator;null!=e&&(e.hovering!==r.hovering&&(e.hovering=r.hovering),e.grabbing!==r.grabbing&&(e.grabbing=r.grabbing))}))),e}_createArcMaterial(r){const e=j.getFovArcWidth(r),i=new S({renderOccluded:U.OccludeAndTransparent,isDecoration:!0,width:e});return this._handles.add(n((()=>t.toUnitRGBA(this._view.effectiveTheme.accentColor)),(t=>i.setParameters({color:t})),s)),i}forEachManipulator(t){Object.values(this._manipulators).forEach((({manipulator:r})=>t(r,O.SCALE)))}_forEachManipulatorInfo(t){Object.values(this._manipulators).forEach((r=>t(r)))}get test(){return{manipulators:this._manipulators}}}function F(t,r,e){const{horizontalFieldOfView:o,verticalFieldOfView:n}=r,s=z(t),l=i(a((s?n:o)/2,0,15)),c=D(-l/2,l/2,s?1:Math.max(Math.sin(i(90-n/2)),.1));return[y(e,c),c]}function D(t,r,e,i=10){R(i>1,"createArcPolylineGeometry() needs at least 2 for numVertices");const a=r-t;if(a<=0||e<=0){const t=.01;return[M(0,0,t),M(0,0,-t)]}const o=[],n=a/i;for(let s=0;s<i;s++){let a=t+s*n;s===i-1&&(a=r);const l=Math.cos(a)*e,c=Math.sin(a)*e,u=M(l-e,0,c);o.push(u)}return o}function I(t){switch(t){case"left":return 0;case"bottom":return 1;case"right":return 2;case"top":return 3}}function L(t){return I(t)*B}function z(t){return"left"===t||"right"===t}function G(t){return"left"===t?"right":"right"===t?"left":"top"===t?"bottom":"top"}function k(t,{observerRenderSpace:r,targetRenderSpace:e,tiltedUpVector:i,rightVector:a,farDistanceRenderSpace:o}){const n=g(W,e,r),s=z(t)?a:i,l=_(q,s,o);return v(r,n,l)}const B=Math.PI/2,H=f(),W=b(),q=b(),J={top:b(),bottom:b(),left:b(),right:b()};export{C as FieldOfViewManipulation,D as createArcPolylineVertices,G as flipSide,z as isSideHorizontal,L as sideToRad};
5
+ import t from"../../../../Color.js";import r from"../../../../core/Handles.js";import{handlesGroup as e}from"../../../../core/handleUtils.js";import{deg2rad as i,clamp as a}from"../../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{watch as n,initial as s}from"../../../../core/reactiveUtils.js";import{fromYRotation as l,fromXRotation as c,fromScaling as u,fromZRotation as p,fromRotation as m,multiply as h}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as d,a as g,h as _}from"../../../../chunks/vec32.js";import{fromValues as M,create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{f as v}from"../../../../chunks/boundedPlane.js";import{viewshedToolManipulatorConfiguration as j}from"./ViewshedConfiguration.js";import{screenToCircleAngle as w,getViewshedRotationMatrix as A}from"./viewshedToolUtils.js";import{Manipulator3D as V}from"../../interactive/Manipulator3D.js";import{RenderObject as E}from"../../interactive/RenderObject.js";import{ManipulatorType as O}from"../../interactive/editingTools/ManipulatorType.js";import{InteractiveManipulation as T}from"../../interactive/editingTools/manipulations/InteractiveManipulation.js";import{createPolylineGeometry as y}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as U}from"../../webgl-engine/lib/Material.js";import{assert as R}from"../../webgl-engine/lib/Util.js";import{RibbonLineMaterial as S}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createManipulatorDragEventPipeline as x}from"../../../interactive/dragEventPipeline.js";import{ManipulatorStateFlags as P}from"../../../interactive/interfaces.js";class C extends T{constructor(t){super(),this._handles=new r,this._tool=t.tool,this._view=t.view,this._focusedArcMaterial=this._createArcMaterial(!0),this._unfocusedArcMaterial=this._createArcMaterial(!1),this._createManipulators(),this.forEachManipulator((t=>this._tool.manipulators.add(t)))}destroy(){this._handles=o(this._handles),this.forEachManipulator((t=>{this._tool.manipulators.remove(t),t.destroy()})),this._tool=null,this._view=null,this._manipulators=null}createDragPipeline(t,r){const i=Object.values(this._manipulators);return e(i.map((({manipulator:e,side:i})=>x(e,((e,a,o,n,s)=>{const l=k(i,r),c=a.next((t=>({...t,manipulatorType:O.SCALE,side:i}))),u=w(c,this._view,l,r);t(e,u,o)})))))}updateManipulatorsTransform(t){t.arcCentersPoints(J),this._forEachManipulatorInfo((r=>this._updateArcManipulatorTransform(r,t,J[r.side])))}updateManipulatorVisuals(t){this._forEachManipulatorInfo((r=>this._updateArcManipulatorVisuals(r,t)))}_updateArcManipulatorVisuals({manipulator:t,side:r},e){const i=[];if(null!=e){const[a,o]=F(r,e,this._unfocusedArcMaterial);i.push(new E(a,P.Unfocused),new E(a.instantiate({material:this._focusedArcMaterial}),P.Focused)),t.collisionType={type:"line",paths:[o]}}t.renderObjects=i,t.radius=j.collisionRadius}_updateArcManipulatorTransform({manipulator:t,side:r},e,a){const o=e.horizontalFieldOfView,n=i(e.verticalFieldOfView/2),s=i(o/2),g=z(r);t.renderLocation=a;const _=f(),M=t=>{h(_,t,_)};M(l(H,i(-90))),g||M(c(H,n));const b=e.farDistanceRenderSpace;let v,j;M(u(H,d(W,b,b,b))),M(p(H,L(r))),M(A(e,H)),g?(v=s,j=e.tiltedUpVector):(j=e.rightVector,v=n),v*="right"===r||"bottom"===r?-1:1;const w=m(H,v,j);null!=w&&M(w),t.modelTransform=_}_createManipulators(){const t=this._createArcManipulator("left"),r=this._createArcManipulator("right"),e=this._createArcManipulator("top"),i=this._createArcManipulator("bottom");this._manipulators={left:t,right:r,top:e,bottom:i};[[i.manipulator,e.manipulator],[t.manipulator,r.manipulator]].forEach((([t,r])=>{t.metadata={pairedManipulator:r},r.metadata={pairedManipulator:t}}))}_createArcManipulator(t){const r=new V({view:this._view,autoScaleRenderObjects:!1,worldSized:!0}),e={manipulator:r,side:t};return this._updateArcManipulatorVisuals(e),this._handles.add(r.events.on("focus-changed",(t=>{const e=r.metadata?.pairedManipulator;null!=e&&(e.hovering!==r.hovering&&(e.hovering=r.hovering),e.grabbing!==r.grabbing&&(e.grabbing=r.grabbing))}))),e}_createArcMaterial(r){const e=j.getFovArcWidth(r),i=new S({renderOccluded:U.OccludeAndTransparent,isDecoration:!0,width:e});return this._handles.add(n((()=>t.toUnitRGBA(this._view.effectiveTheme.accentColor)),(t=>i.setParameters({color:t})),s)),i}forEachManipulator(t){Object.values(this._manipulators).forEach((({manipulator:r})=>t(r,O.SCALE)))}_forEachManipulatorInfo(t){Object.values(this._manipulators).forEach((r=>t(r)))}get test(){return{manipulators:this._manipulators}}}function F(t,r,e){const{horizontalFieldOfView:o,verticalFieldOfView:n}=r,s=z(t),l=i(a((s?n:o)/2,0,15)),c=D(-l/2,l/2,s?1:Math.max(Math.sin(i(90-n/2)),.1));return[y(e,c),c]}function D(t,r,e,i=10){R(i>1,"createArcPolylineGeometry() needs at least 2 for numVertices");const a=r-t;if(a<=0||e<=0){return[M(0,0,.01),M(0,0,-.01)]}const o=[],n=a/i;for(let s=0;s<i;s++){let a=t+s*n;s===i-1&&(a=r);const l=Math.cos(a)*e,c=Math.sin(a)*e,u=M(l-e,0,c);o.push(u)}return o}function I(t){switch(t){case"left":return 0;case"bottom":return 1;case"right":return 2;case"top":return 3}}function L(t){return I(t)*B}function z(t){return"left"===t||"right"===t}function G(t){return"left"===t?"right":"right"===t?"left":"top"===t?"bottom":"top"}function k(t,{observerRenderSpace:r,targetRenderSpace:e,tiltedUpVector:i,rightVector:a,farDistanceRenderSpace:o}){const n=g(W,e,r),s=z(t)?a:i,l=_(q,s,o);return v(r,n,l)}const B=Math.PI/2,H=f(),W=b(),q=b(),J={top:b(),bottom:b(),left:b(),right:b()};export{C as FieldOfViewManipulation,D as createArcPolylineVertices,G as flipSide,z as isSideHorizontal,L as sideToRad};
@@ -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{i as t,g as r,h as e,s as n,f as s,c as o,n as i,e as f}from"../../../../chunks/vec32.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a}from"../../../../chunks/sphere.js";import{planeFromPoints as u}from"../../support/mathUtils.js";import{geodesicArea as c}from"../../../support/geodesicAreaMeasurementUtils.js";function h(s,o){const i=a(o);t(i,0,0,0);for(let t=0;t<s.length;++t)r(i,i,s[t]);e(i,i,1/s.length);let f=0;for(let t=0;t<s.length;++t)f=Math.max(f,n(i,s[t]));o[3]=Math.sqrt(f)}function g(t,r){if(t.length<3)throw new Error("need at least 3 points to fit a plane");u(t[0],t[1],t[2],r)}function p(t,r){return s(t,r)+t[3]}function m(t,r,e,n){const s=x;return o(s.rings[0][0],t),o(s.rings[0][1],r),o(s.rings[0][2],e),o(s.rings[0][3],t),s.spatialReference=n,c(s)}function j(e,n=null,l=!0){const a=1e-6,u=(t,r)=>{if(0===r[0]&&0===r[1]&&0===r[2])return!1;for(let e=0;e<t.length;++e)if(s(r,t[e])<-a)return!1;return!0};if(0===e.length)return!1;if(1===e.length)return n&&o(n,e[0]),!0;t(y,0,0,0);for(let t=0;t<e.length;++t)r(y,y,e[t]);if(i(y,y),u(e,y))return n&&o(n,y),!0;if(!l)return!1;for(let t=0;t<e.length;++t)for(let r=0;r<e.length;++r)if(t!==r&&(f(y,e[t],e[r]),i(y,y),u(e,y)))return n&&o(n,y),!0;return!1}function M(t){return"mouse"!==t.pointerType||0===t.button}const x={hasM:!1,hasZ:!0,rings:[[l(),l(),l(),l()]],spatialReference:null,type:"polygon"},y=l();export{g as bestFitPlane,h as boundingSphere,j as fitHemisphere,M as isPrimaryPointerAction,p as planePointDistance,m as triangleAreaGeodesic};
5
+ import{i as t,g as r,h as e,s as n,f as s,c as o,n as i,e as f}from"../../../../chunks/vec32.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a}from"../../../../chunks/sphere.js";import{planeFromPoints as u}from"../../support/mathUtils.js";import{geodesicArea as c}from"../../../support/geodesicAreaMeasurementUtils.js";function h(s,o){const i=a(o);t(i,0,0,0);for(let t=0;t<s.length;++t)r(i,i,s[t]);e(i,i,1/s.length);let f=0;for(let t=0;t<s.length;++t)f=Math.max(f,n(i,s[t]));o[3]=Math.sqrt(f)}function g(t,r){if(t.length<3)throw new Error("need at least 3 points to fit a plane");u(t[0],t[1],t[2],r)}function p(t,r){return s(t,r)+t[3]}function m(t,r,e,n){const s=x;return o(s.rings[0][0],t),o(s.rings[0][1],r),o(s.rings[0][2],e),o(s.rings[0][3],t),s.spatialReference=n,c(s)}function j(e,n=null,l=!0){const a=(t,r)=>{if(0===r[0]&&0===r[1]&&0===r[2])return!1;for(let e=0;e<t.length;++e)if(s(r,t[e])<-1e-6)return!1;return!0};if(0===e.length)return!1;if(1===e.length)return n&&o(n,e[0]),!0;t(y,0,0,0);for(let t=0;t<e.length;++t)r(y,y,e[t]);if(i(y,y),a(e,y))return n&&o(n,y),!0;if(!l)return!1;for(let t=0;t<e.length;++t)for(let r=0;r<e.length;++r)if(t!==r&&(f(y,e[t],e[r]),i(y,y),a(e,y)))return n&&o(n,y),!0;return!1}function M(t){return"mouse"!==t.pointerType||0===t.button}const x={hasM:!1,hasZ:!0,rings:[[l(),l(),l(),l()]],spatialReference:null,type:"polygon"},y=l();export{g as bestFitPlane,h as boundingSphere,j as fitHemisphere,M as isPrimaryPointerAction,p as planePointDistance,m as triangleAreaGeodesic};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{neverReached as a}from"../../../core/compilerUtils.js";import{clamp as t}from"../../../core/mathUtils.js";import{signal as e}from"../../../core/signal.js";import{rotate as s}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as i,create as r}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{k as h,n as o,h as n,c,l as d,d as l}from"../../../chunks/vec32.js";import{create as _,fromValues as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as F,fromPoints as f,axis as p}from"../../../geometry/support/axisAngleDegrees.js";import{earth as S}from"../../../geometry/support/Ellipsoid.js";import{CloudsTextureChannels as m,ensureClouds as E,CubeMapState as D}from"./Clouds.js";import{heightLimit as P}from"./weather.js";class x{constructor(){this.startTime=0,this._data=e(null),this._readChannels=m.RG,this.parallax=new O,this.parallaxNew=new O,this._anchorPoint=_(),this._fadeState=e(A.HIDE),this._fadeFactor=e(1)}get data(){return this._data.value}set data(a){this._data.value=a}get readChannels(){return this._readChannels}get fadeState(){return this._fadeState.value}get fadeFactor(){return this._fadeFactor.value}get opacity(){switch(this.fadeState){case A.HIDE:return 0;case A.FADE_OUT:return 1-this.fadeFactor;case A.FADE_IN:return this.fadeFactor;case A.SHOW:case A.CROSS_FADE:return 1}}fade(a,e,s){this.isFading&&this.fadeFactor<1&&(this._fadeFactor.value=s?t((e-this.startTime)/(H*s),0,1):1,1===this.fadeFactor&&this._endFade()),this._evaluateState(a,e),this._updateParallax(a)}_evaluateState(a,t){const e=a.relativeElevation,s=this._updateAnchorPoint(a);(e>1.7*P||e<-P||s>I)&&this.opacity>0?this._startFade(A.HIDE,t):this.isFading||(e>P||e<-.35*P||s>w*I?this.opacity>0&&this._startFade(A.FADE_OUT,t):E(this.data)&&(0===this.opacity?this._startFade(A.FADE_IN,t):this.data.state===D.Ready&&(this.fadeState===A.SHOW?this._startFade(A.CROSS_FADE,t):this._startFade(A.SHOW,t))))}_updateParallax(a){const t=h(a.eye);this.parallax.radiusCurvatureCorrection=.84*Math.sqrt(Math.max(t-S.radius*S.radius,0))/Math.sqrt(t),f(C,this.parallax.anchorPoint,v),s(this.parallax.transform,i,v[3],p(v)),f(C,this.parallaxNew.anchorPoint,v),s(this.parallaxNew.transform,i,v[3],p(v))}_updateAnchorPoint(a){return o(this._anchorPoint,a.eye),n(this._anchorPoint,this._anchorPoint,S.radius),this.fadeState===A.HIDE&&this.data?.state===D.Ready?(c(this.parallax.anchorPoint,this._anchorPoint),0):d(l(g,this.parallax.anchorPoint,this._anchorPoint))}requestFade(){this._fadeFactor.value=0}_startFade(a,t){switch(this._fadeState.value=a,this.startTime=t,a){case A.CROSS_FADE:this.requestFade(),this._switchReadChannels(),c(this.parallaxNew.anchorPoint,this._anchorPoint);break;case A.FADE_IN:this.requestFade(),this._switchReadChannels(),c(this.parallax.anchorPoint,this._anchorPoint),c(this.parallaxNew.anchorPoint,this._anchorPoint);break;case A.FADE_OUT:this.requestFade();break;case A.SHOW:this._switchReadChannels(),c(this.parallax.anchorPoint,this._anchorPoint),c(this.parallaxNew.anchorPoint,this._anchorPoint),this._endFade();break;case A.HIDE:this._endFade()}}_endFade(){switch(this._fadeFactor.value=1,this.data&&this.data.state!==D.Ready&&(this.data.state=D.Idle),this.fadeState){case A.CROSS_FADE:c(this.parallax.anchorPoint,this.parallaxNew.anchorPoint),this._fadeState.value=A.SHOW;break;case A.FADE_IN:this._fadeState.value=A.SHOW;break;case A.FADE_OUT:this._fadeState.value=A.HIDE;break;case A.SHOW:case A.HIDE:break;default:a(this.fadeState)}}_switchReadChannels(){this.data?.state===D.Ready&&(this._readChannels=1-this._readChannels,this.data.state=D.Fading)}get isFading(){return this.fadeState===A.FADE_OUT||this.fadeState===A.FADE_IN||this.fadeState===A.CROSS_FADE}}var A;!function(a){a[a.HIDE=0]="HIDE",a[a.FADE_IN=1]="FADE_IN",a[a.SHOW=2]="SHOW",a[a.CROSS_FADE=3]="CROSS_FADE",a[a.FADE_OUT=4]="FADE_OUT"}(A||(A={}));class O{constructor(){this.anchorPoint=_(),this.radiusCurvatureCorrection=0,this.transform=r()}}const C=u(0,0,1),v=F(),g=_(),H=1.25,w=.5,I=2e5;export{x as CloudsParameters,A as FadeState};
5
+ import{neverReached as a}from"../../../core/compilerUtils.js";import{clamp as t}from"../../../core/mathUtils.js";import{signal as e}from"../../../core/signal.js";import{rotate as s}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as i,create as r}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{k as h,n as o,h as n,c,l as d,d as l}from"../../../chunks/vec32.js";import{create as _,fromValues as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as F,fromPoints as f,axis as p}from"../../../geometry/support/axisAngleDegrees.js";import{earth as S}from"../../../geometry/support/Ellipsoid.js";import{CloudsTextureChannels as m,ensureClouds as E,CubeMapState as D}from"./Clouds.js";import{heightLimit as P}from"./weather.js";class x{constructor(){this.startTime=0,this._data=e(null),this._readChannels=m.RG,this.parallax=new O,this.parallaxNew=new O,this._anchorPoint=_(),this._fadeState=e(A.HIDE),this._fadeFactor=e(1)}get data(){return this._data.value}set data(a){this._data.value=a}get readChannels(){return this._readChannels}get fadeState(){return this._fadeState.value}get fadeFactor(){return this._fadeFactor.value}get opacity(){switch(this.fadeState){case A.HIDE:return 0;case A.FADE_OUT:return 1-this.fadeFactor;case A.FADE_IN:return this.fadeFactor;case A.SHOW:case A.CROSS_FADE:return 1}}fade(a,e,s){this.isFading&&this.fadeFactor<1&&(this._fadeFactor.value=s?t((e-this.startTime)/(H*s),0,1):1,1===this.fadeFactor&&this._endFade()),this._evaluateState(a,e),this._updateParallax(a)}_evaluateState(a,t){const e=a.relativeElevation,s=this._updateAnchorPoint(a);(e>1.7*P||e<-1e4||s>I)&&this.opacity>0?this._startFade(A.HIDE,t):this.isFading||(e>P||e<-.35*P||s>w*I?this.opacity>0&&this._startFade(A.FADE_OUT,t):E(this.data)&&(0===this.opacity?this._startFade(A.FADE_IN,t):this.data.state===D.Ready&&(this.fadeState===A.SHOW?this._startFade(A.CROSS_FADE,t):this._startFade(A.SHOW,t))))}_updateParallax(a){const t=h(a.eye);this.parallax.radiusCurvatureCorrection=.84*Math.sqrt(Math.max(t-S.radius*S.radius,0))/Math.sqrt(t),f(C,this.parallax.anchorPoint,v),s(this.parallax.transform,i,v[3],p(v)),f(C,this.parallaxNew.anchorPoint,v),s(this.parallaxNew.transform,i,v[3],p(v))}_updateAnchorPoint(a){return o(this._anchorPoint,a.eye),n(this._anchorPoint,this._anchorPoint,S.radius),this.fadeState===A.HIDE&&this.data?.state===D.Ready?(c(this.parallax.anchorPoint,this._anchorPoint),0):d(l(g,this.parallax.anchorPoint,this._anchorPoint))}requestFade(){this._fadeFactor.value=0}_startFade(a,t){switch(this._fadeState.value=a,this.startTime=t,a){case A.CROSS_FADE:this.requestFade(),this._switchReadChannels(),c(this.parallaxNew.anchorPoint,this._anchorPoint);break;case A.FADE_IN:this.requestFade(),this._switchReadChannels(),c(this.parallax.anchorPoint,this._anchorPoint),c(this.parallaxNew.anchorPoint,this._anchorPoint);break;case A.FADE_OUT:this.requestFade();break;case A.SHOW:this._switchReadChannels(),c(this.parallax.anchorPoint,this._anchorPoint),c(this.parallaxNew.anchorPoint,this._anchorPoint),this._endFade();break;case A.HIDE:this._endFade()}}_endFade(){switch(this._fadeFactor.value=1,this.data&&this.data.state!==D.Ready&&(this.data.state=D.Idle),this.fadeState){case A.CROSS_FADE:c(this.parallax.anchorPoint,this.parallaxNew.anchorPoint),this._fadeState.value=A.SHOW;break;case A.FADE_IN:this._fadeState.value=A.SHOW;break;case A.FADE_OUT:this._fadeState.value=A.HIDE;break;case A.SHOW:case A.HIDE:break;default:a(this.fadeState)}}_switchReadChannels(){this.data?.state===D.Ready&&(this._readChannels=1-this._readChannels,this.data.state=D.Fading)}get isFading(){return this.fadeState===A.FADE_OUT||this.fadeState===A.FADE_IN||this.fadeState===A.CROSS_FADE}}var A;!function(a){a[a.HIDE=0]="HIDE",a[a.FADE_IN=1]="FADE_IN",a[a.SHOW=2]="SHOW",a[a.CROSS_FADE=3]="CROSS_FADE",a[a.FADE_OUT=4]="FADE_OUT"}(A||(A={}));class O{constructor(){this.anchorPoint=_(),this.radiusCurvatureCorrection=0,this.transform=r()}}const C=u(0,0,1),v=F(),g=_(),H=1.25,w=.5,I=2e5;export{x as CloudsParameters,A as FadeState};
@@ -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{lerp as t,clamp as r}from"../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../core/maybe.js";import{watch as i,initial as o}from"../../../core/reactiveUtils.js";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import"../../../core/Error.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{lookAt as n}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as h}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{l as p,h as c,g as u,j as l,e as f,k as _}from"../../../chunks/vec32.js";import{create as d}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as g}from"../../../geometry/ellipsoidUtils.js";import{newFloatArray as b}from"../../../geometry/support/FloatArray.js";import{InternalRenderCategory as j}from"../webgl.js";import{computeInnerAltitudeFade as x,innerAtmosphereDepth as V}from"./atmosphereUtils.js";import{S as w}from"../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as v}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as A,SimpleAtmosphereGeometry as P}from"./SimpleAtmosphereTechniqueConfiguration.js";import{marsAtmosphereTextureSimple as R}from"./resources/MarsAtmosphereTexture.js";import{makePiecewiseLinearFunction as y}from"../support/mathUtils.js";import{glLayout as S}from"../support/buffer/glUtil.js";import{newLayout as T}from"../support/buffer/InterleavedLayout.js";import{OpaqueEnvironment as q}from"../webgl-engine/effects/OpaqueEnvironment.js";import{RenderRequestType as M}from"../webgl-engine/lib/basicInterfaces.js";import{Default3D as U}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{createQuadVAO as F}from"../webgl-engine/lib/glUtil3D.js";import{project as C}from"../webgl-engine/lib/Util.js";import{VertexArrayObject as E}from"../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as O}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as I}from"../../webgl/BufferObject.js";import{TextureWrapMode as D,PrimitiveType as L,Usage as N}from"../../webgl/enums.js";import{Texture as W}from"../../webgl/Texture.js";import{TextureDescriptor as k}from"../../webgl/TextureDescriptor.js";import{vertexCount as G}from"../../webgl/Util.js";const B=128,z=-V,H=0,Q=50,J=()=>1-511/512,K=y([[50,.1015625],[500,.21875],[5e3,1-250/512],[5e4,.4140625]]);let X=class extends q{constructor(e){super(e),this._passParameters=new w,this._configuration=new A,this._vao=null,this._vaoCount=0,this._fadeVao=null,this._fadeVaoCount=0,this._texV1=1;const{view:t,techniques:r}=e,s=g(t.spatialReference),{outerAtmosphereRimWidth:i,radius:o}=s;this._planetRadius=o,this._innerRimFactor=1+z/o,this._middleRimFactor=1+H/o,this._outerRimFactor=1+i/o,this._texV0=H/i,this._texVScale=this._texV1-this._texV0,r.precompile(v,this._configuration),this._configuration.geometry=P.Underground,r.precompile(v,this._configuration)}initialize(){this.addHandles(i((()=>this.view.environment.atmosphereEnabled),(e=>e?this._enable():this._disable()),o))}destroy(){this._passParameters.texture=s(this._passParameters.texture),this._fadeVao=s(this._fadeVao),this._vao=s(this._vao)}render(e){const t=e.find((({name:e})=>e===j.OPAQUE_ENVIRONMENT));this._update();const r=this.renderingContext;if(!this._passParameters.texture){const e=new k;e.wrapMode=D.CLAMP_TO_EDGE,e.flipped=!0,e.width=1,e.height=512,this._passParameters.texture=new W(r,e,R)}if(this._passParameters.undergroundFadeAlpha<1){this._vao||(this._vao=this._createRibbon(r),this._vaoCount=G(this._vao,"geometry")),this._configuration.geometry=P.Cone;const e=this.techniques.acquire(v,this._configuration);if(!e.compiled)return e.release(),this.requestRender(M.UPDATE),t;r.bindTechnique(e,this.bindParameters,this._passParameters),r.bindVAO(this._vao),r.drawArrays(L.TRIANGLES,0,this._vaoCount),e.release()}if(this._passParameters.undergroundFadeAlpha>0){this._fadeVao||(this._fadeVao=F(r),this._fadeVaoCount=G(this._fadeVao,"geometry")),this._configuration.geometry=P.Underground;const e=this.techniques.acquire(v,this._configuration);if(!e.compiled)return e.release(),this.requestRender(M.UPDATE),t;r.bindTechnique(e,this.bindParameters,this._passParameters),r.bindVAO(this._fadeVao),r.drawArrays(L.TRIANGLE_STRIP,0,this._fadeVaoCount),e.release()}return t}_update(){const e=this.bindParameters.camera,s=d(),i=this._planetRadius,o=p(e.eye),a=o-i;if(a<0){const e=Math.min(-a/5e3,1);this._passParameters.undergroundFadeAlpha=e}else this._passParameters.undergroundFadeAlpha=0;const n=Math.max(Q,a),m=i+z;this._passParameters.innerScale=te(i+n,i,m)-1,this._passParameters.altitudeFade=x(a),c(s,e.eye,(i+Q)/o),Y(s,e.center,e.up,i,this._passParameters.silhouette);const u=this._computeScreenRimWidth(e,s,e.up,this._passParameters.silhouette),l=J(),f=K(a);let _=this._texV0+l*this._texVScale,g=this._texV0+u*f*this._texVScale;if(a>Q){Y(e.eye,e.center,e.up,i,this._passParameters.silhouette);const s=this._computeScreenRimWidth(e,e.eye,e.up,this._passParameters.silhouette),o=r((s-1.5)/(u-1.5),0,1);_=this._texV0+o*l*this._texVScale,g=this._texV0+t(this._texV1,u*f,o)*this._texVScale}h(this._passParameters.texV,_,g)}_createRibbon(e){const t=b(3+3*B*3),r=new Uint32Array(3*B*5);t[0]=0,t[1]=0,t[2]=-1;for(let o=0;o<B;o++){const e=9*o+3;t[e]=o,t[e+1]=this._innerRimFactor,t[e+2]=-1,t[e+3]=o,t[e+4]=this._middleRimFactor,t[e+5]=0,t[e+6]=o,t[e+7]=this._outerRimFactor,t[e+8]=1;const s=3*o+1,i=o===B-1?1:s+3,a=15*o;r[a]=s,r[a+1]=s+1,r[a+2]=i+1,r[a+3]=i+1,r[a+4]=i,r[a+5]=s,r[a+6]=s+1,r[a+7]=s+2,r[a+8]=i+2,r[a+9]=i+2,r[a+10]=i+1,r[a+11]=s+1,r[a+12]=s,r[a+13]=i,r[a+14]=0}const s=re.createBuffer(r.length),i=s.position;for(let o=0;o<r.length;++o){const e=3*r[o];i.set(o,0,t[e]),i.set(o,1,t[e+1]),i.set(o,2,t[e+2])}return new E(e,U,new Map([["geometry",S(re)]]),new Map([["geometry",I.createVertex(e,N.STATIC_DRAW,s.buffer)]]))}_computeScreenRimWidth(e,t,r,s){return u($,s.center,s.v2),c(ee,$,this._outerRimFactor),n(Z,t,$,r),C($,Z,e.projectionMatrix,e.viewport,$),C(ee,Z,e.projectionMatrix,e.viewport,ee),l($,ee)/e.height}};function Y(e,t,r,s,i){const o=p(e),a=s*Math.sqrt(o*o-s*s)/o,n=Math.sqrt(s*s-a*a),m=i.v1,h=i.v2;return c(i.center,e,n/o),f(m,e,t),_(m)<1&&f(m,e,r),c(m,m,a/p(m)),f(h,m,e),c(h,h,a/p(h)),a}X=e([a("esri.views.3d.environment.MarsAtmosphere")],X);const Z=m(),$=d(),ee=d();function te(e,t,r){return e*e/(Math.sqrt(e*e-t*t)*Math.sqrt(e*e-r*r)+t*r)}const re=T().vec3f(O.POSITION),se=X;export{se as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import{lerp as t,clamp as r}from"../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../core/maybe.js";import{watch as i,initial as o}from"../../../core/reactiveUtils.js";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import"../../../core/Error.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{lookAt as n}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as h}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{l as p,h as c,g as u,j as l,e as f,k as _}from"../../../chunks/vec32.js";import{create as d}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as g}from"../../../geometry/ellipsoidUtils.js";import{newFloatArray as b}from"../../../geometry/support/FloatArray.js";import{InternalRenderCategory as j}from"../webgl.js";import{computeInnerAltitudeFade as x}from"./atmosphereUtils.js";import{S as V}from"../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as w}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as v,SimpleAtmosphereGeometry as A}from"./SimpleAtmosphereTechniqueConfiguration.js";import{marsAtmosphereTextureSimple as P}from"./resources/MarsAtmosphereTexture.js";import{makePiecewiseLinearFunction as R}from"../support/mathUtils.js";import{glLayout as y}from"../support/buffer/glUtil.js";import{newLayout as S}from"../support/buffer/InterleavedLayout.js";import{OpaqueEnvironment as T}from"../webgl-engine/effects/OpaqueEnvironment.js";import{RenderRequestType as q}from"../webgl-engine/lib/basicInterfaces.js";import{Default3D as M}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{createQuadVAO as U}from"../webgl-engine/lib/glUtil3D.js";import{project as F}from"../webgl-engine/lib/Util.js";import{VertexArrayObject as C}from"../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as E}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as O}from"../../webgl/BufferObject.js";import{TextureWrapMode as I,PrimitiveType as D,Usage as L}from"../../webgl/enums.js";import{Texture as N}from"../../webgl/Texture.js";import{TextureDescriptor as W}from"../../webgl/TextureDescriptor.js";import{vertexCount as k}from"../../webgl/Util.js";const G=128,B=-1e4,z=0,H=50,Q=()=>1-511/512,J=R([[50,.1015625],[500,.21875],[5e3,1-250/512],[5e4,.4140625]]);let K=class extends T{constructor(e){super(e),this._passParameters=new V,this._configuration=new v,this._vao=null,this._vaoCount=0,this._fadeVao=null,this._fadeVaoCount=0,this._texV1=1;const{view:t,techniques:r}=e,s=g(t.spatialReference),{outerAtmosphereRimWidth:i,radius:o}=s;this._planetRadius=o,this._innerRimFactor=1+B/o,this._middleRimFactor=1+z/o,this._outerRimFactor=1+i/o,this._texV0=z/i,this._texVScale=this._texV1-this._texV0,r.precompile(w,this._configuration),this._configuration.geometry=A.Underground,r.precompile(w,this._configuration)}initialize(){this.addHandles(i((()=>this.view.environment.atmosphereEnabled),(e=>e?this._enable():this._disable()),o))}destroy(){this._passParameters.texture=s(this._passParameters.texture),this._fadeVao=s(this._fadeVao),this._vao=s(this._vao)}render(e){const t=e.find((({name:e})=>e===j.OPAQUE_ENVIRONMENT));this._update();const r=this.renderingContext;if(!this._passParameters.texture){const e=new W;e.wrapMode=I.CLAMP_TO_EDGE,e.flipped=!0,e.width=1,e.height=512,this._passParameters.texture=new N(r,e,P)}if(this._passParameters.undergroundFadeAlpha<1){this._vao||(this._vao=this._createRibbon(r),this._vaoCount=k(this._vao,"geometry")),this._configuration.geometry=A.Cone;const e=this.techniques.acquire(w,this._configuration);if(!e.compiled)return e.release(),this.requestRender(q.UPDATE),t;r.bindTechnique(e,this.bindParameters,this._passParameters),r.bindVAO(this._vao),r.drawArrays(D.TRIANGLES,0,this._vaoCount),e.release()}if(this._passParameters.undergroundFadeAlpha>0){this._fadeVao||(this._fadeVao=U(r),this._fadeVaoCount=k(this._fadeVao,"geometry")),this._configuration.geometry=A.Underground;const e=this.techniques.acquire(w,this._configuration);if(!e.compiled)return e.release(),this.requestRender(q.UPDATE),t;r.bindTechnique(e,this.bindParameters,this._passParameters),r.bindVAO(this._fadeVao),r.drawArrays(D.TRIANGLE_STRIP,0,this._fadeVaoCount),e.release()}return t}_update(){const e=this.bindParameters.camera,s=d(),i=this._planetRadius,o=p(e.eye),a=o-i;if(a<0){const e=Math.min(-a/5e3,1);this._passParameters.undergroundFadeAlpha=e}else this._passParameters.undergroundFadeAlpha=0;const n=Math.max(H,a),m=i+B;this._passParameters.innerScale=ee(i+n,i,m)-1,this._passParameters.altitudeFade=x(a),c(s,e.eye,(i+H)/o),X(s,e.center,e.up,i,this._passParameters.silhouette);const u=this._computeScreenRimWidth(e,s,e.up,this._passParameters.silhouette),l=Q(),f=J(a);let _=this._texV0+l*this._texVScale,g=this._texV0+u*f*this._texVScale;if(a>H){X(e.eye,e.center,e.up,i,this._passParameters.silhouette);const s=this._computeScreenRimWidth(e,e.eye,e.up,this._passParameters.silhouette),o=r((s-1.5)/(u-1.5),0,1);_=this._texV0+o*l*this._texVScale,g=this._texV0+t(this._texV1,u*f,o)*this._texVScale}h(this._passParameters.texV,_,g)}_createRibbon(e){const t=b(3+3*G*3),r=new Uint32Array(3*G*5);t[0]=0,t[1]=0,t[2]=-1;for(let o=0;o<G;o++){const e=9*o+3;t[e]=o,t[e+1]=this._innerRimFactor,t[e+2]=-1,t[e+3]=o,t[e+4]=this._middleRimFactor,t[e+5]=0,t[e+6]=o,t[e+7]=this._outerRimFactor,t[e+8]=1;const s=3*o+1,i=o===G-1?1:s+3,a=15*o;r[a]=s,r[a+1]=s+1,r[a+2]=i+1,r[a+3]=i+1,r[a+4]=i,r[a+5]=s,r[a+6]=s+1,r[a+7]=s+2,r[a+8]=i+2,r[a+9]=i+2,r[a+10]=i+1,r[a+11]=s+1,r[a+12]=s,r[a+13]=i,r[a+14]=0}const s=te.createBuffer(r.length),i=s.position;for(let o=0;o<r.length;++o){const e=3*r[o];i.set(o,0,t[e]),i.set(o,1,t[e+1]),i.set(o,2,t[e+2])}return new C(e,M,new Map([["geometry",y(te)]]),new Map([["geometry",O.createVertex(e,L.STATIC_DRAW,s.buffer)]]))}_computeScreenRimWidth(e,t,r,s){return u(Z,s.center,s.v2),c($,Z,this._outerRimFactor),n(Y,t,Z,r),F(Z,Y,e.projectionMatrix,e.viewport,Z),F($,Y,e.projectionMatrix,e.viewport,$),l(Z,$)/e.height}};function X(e,t,r,s,i){const o=p(e),a=s*Math.sqrt(o*o-s*s)/o,n=Math.sqrt(s*s-a*a),m=i.v1,h=i.v2;return c(i.center,e,n/o),f(m,e,t),_(m)<1&&f(m,e,r),c(m,m,a/p(m)),f(h,m,e),c(h,h,a/p(h)),a}K=e([a("esri.views.3d.environment.MarsAtmosphere")],K);const Y=m(),Z=d(),$=d();function ee(e,t,r){return e*e/(Math.sqrt(e*e-t*t)*Math.sqrt(e*e-r*r)+t*r)}const te=S().vec3f(E.POSITION),re=K;export{re 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{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import{multiplyOpacityToUnitRGBA as a}from"../../../../../core/colorUtils.js";import{cyclicalPI as o}from"../../../../../core/Cyclical.js";import i from"../../../../../core/Evented.js";import"../../../../../core/has.js";import{clamp as r,rad2deg as s}from"../../../../../core/mathUtils.js";import{destroyMaybe as n}from"../../../../../core/maybe.js";import{watch as l,initial as c}from"../../../../../core/reactiveUtils.js";import{addFrameTask as d}from"../../../../../core/scheduling.js";import{createScreenPointArray as h}from"../../../../../core/screenUtils.js";import{property as u}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as p}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromRotation as m,fromScaling as g,multiply as f,scale as _,rotate as D}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as S}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as v,d as M,l as b,s as j,e as y,g as R}from"../../../../../chunks/vec32.js";import{clone as w,fromValues as A}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromPositionAndNormal as T,create as I,getNormal as O}from"../../../../../geometry/support/plane.js";import{wrap as C,distance2 as E}from"../../../../../geometry/support/ray.js";import{sv3d as k,sm4d as F}from"../../../../../geometry/support/vectorStacks.js";import{Manipulator3D as P}from"../../Manipulator3D.js";import{calculateInputRotationTransform as U}from"../../manipulatorUtils.js";import{RenderObject as L}from"../../RenderObject.js";import{screenToRenderPlane as x}from"../dragEventPipeline3D.js";import{ManipulatorType as N}from"../ManipulatorType.js";import{ringIndicatorDelayMs as H,rotateIndicatorDirectionBuffer as G,scaleIndicatorDirectionBuffer as z,rotateIndicatorArrowPlacementPercentage as B,ringThickness as q,dragThresholdPx as J,ringRadius as K,innerIndicatorRadius as Q,outerIndicatorRadius as V,ringHeight as W,rotateIndicatorArrowTipRadius as X,rotateIndicatorArrowTipLength as Y,scaleIndicatorOffset1 as Z,scaleIndicatorOffset2 as $,indicatorThickness as tt,geometrySegments as et,rotateIndicatorArcLength as at,ringResetAnimationSpeedFactor as ot,scaleIndicatorArcLength as it}from"../manipulations/config.js";import{CullFaceOptions as rt}from"../../../webgl-engine/lib/basicInterfaces.js";import{createExtrudedTriangle as st,transformInPlace as nt,createPathExtrusionGeometry as lt}from"../../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as ct}from"../../../webgl-engine/lib/Material.js";import{ColorMaterial as dt}from"../../../webgl-engine/materials/ColorMaterial.js";import{createManipulatorDragEventPipeline as ht}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateCustomFlags as ut,ManipulatorStateFlags as pt}from"../../../../interactive/interfaces.js";var mt;!function(t){t.ScaleIn=ut.Custom2,t.ScaleOut=ut.Custom3,t.RotateLeft=ut.Custom4,t.RotateRight=ut.Custom5,t.Unlocked=ut.Custom7,t.DelayedFocused=ut.Custom8,t.TouchInput=ut.Custom12}(mt||(mt={}));let gt=class extends e{get angle(){return this.adapter.angle}get scale(){return this.adapter.scale}set location(t){this._ringManipulator.location=t}set elevationAlignedLocation(t){this._ringManipulator.elevationAlignedLocation=t}get grabbing(){return this._ringManipulator.grabbing}set interactive(t){this._ringManipulator.interactive=t}get updating(){return!!this._activeAnimation}constructor(t){super(t),this.mode=null,this._scaleRotateDragData=null,this._activeAnimation=null,this._ringIndicatorDelayMs=H,this.events=new i,this.getFocused=()=>this._ringManipulator.focused,this.getScale=()=>"scale"===this._scaleRotateDragData?.mode?this.adapter.scale:1}initialize(){this._createManipulator(),this._updateDragState(),this._updateManipulatorTransform(),this.addHandles([l((()=>{const{adapter:t}=this;return[t.angle,t.scale]}),(()=>this._updateManipulatorTransform()))])}destroy(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=null,this.tool.manipulators.remove(this._ringManipulator),this._ringManipulator=null}startAnimation(t){this.cancelActiveAnimation(),t.start();const e=d({update:({deltaTime:e})=>{t.update(e)&&this.cancelActiveAnimation()}});this._activeAnimation={...t,frameTask:e}}cancelActiveAnimation(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=n(this._activeAnimation)}forEachManipulator(t){t(this._ringManipulator,N.SCALE_ROTATE)}_createManipulator(){const t=this._createRingManipulator();this._ringManipulator=t,this.tool.manipulators.add(t);const e=this.tool.object,a=ht(t,((t,a,i)=>{this._scaleRotateDragData=null;const n=this.adapter.startInteraction(),l={mode:"none",origin:w(t.renderLocation),initialAngle:this.adapter.angle,angle:0,angleDir:0,scaleDir:0};this._scaleRotateDragData=l,this._updateDragState();const c=k.get();this.tool.view.renderCoordsHelper.worldUpAtPosition(t.renderLocation,c),a.next(x(this.tool.view,T(t.renderLocation,c,I()))).next((t=>{const a=O(t.plane),i=U(t.renderStart,t.renderEnd,l.origin,a),c=o.shortestSignedDiff(l.angle,i);l.angleDir=r(l.angleDir+c,-G,G),l.angle=i;const d=ft(l,t),h=d-this.adapter.scale;if(l.scaleDir=r(l.scaleDir+h,-z,z),this._onScaleChanged(),"none"===l.mode){const a=this.mode||_t(t,t.plane,l.origin,this.tool.view.state.camera);if(null!=a){switch(a){case"rotate":this.tool.events.emit("rotate-start",{object:e,angle:0}),this.tool.events.emit("record-undo",{updates:[this.adapter.createUndoRecord()]});break;case"scale":this.tool.events.emit("scale-start",{object:e,xScale:1,yScale:1}),this.tool.events.emit("record-undo",{updates:[this.adapter.createUndoRecord()]})}l.mode=a}}switch(l.mode){case"rotate":n.state.angle=l.initialAngle+i;break;case"scale":n.state.scale=d,this._onScaleChanged()}switch(this._updateDragState(),this._updateManipulatorTransform(),t.action){case"start":case"update":switch(l.mode){case"rotate":this.tool.events.emit("rotate",{object:e,angle:s(l.angle)});break;case"scale":this.tool.events.emit("scale",{object:e,xScale:d,yScale:d})}break;case"end":switch(l.mode){case"rotate":this.tool.events.emit("rotate-stop",{object:e,angle:s(l.angle)});break;case"scale":this.tool.events.emit("scale-stop",{object:e,xScale:d,yScale:d})}}return"end"===t.action&&(this.startAnimation(vt(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState(),n.done()),t})),i.next((()=>{if(n.cancel(),null!=this._scaleRotateDragData){switch(this._scaleRotateDragData.mode){case"none":break;case"rotate":this.tool.events.emit("rotate-stop",{object:e,angle:0});break;case"scale":this.tool.events.emit("scale-stop",{object:e,xScale:1,yScale:1})}this.startAnimation(vt(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState()}}))}));this.addHandles([a,t.events.on("focus-changed",(t=>{"focus"===t.action?this.startAnimation(Mt(this,(()=>this._updateDelayedFocusedState()),{delayMs:this._ringIndicatorDelayMs})):this._updateDelayedFocusedState()})),t.events.on("immediate-click",(t=>{t.stopPropagation()})),l((()=>this.tool.object.visible),(t=>this._ringManipulator.available=t),c)])}_onScaleChanged(){this.events.emit("scale-changed"),this._updateManipulatorTransform()}_updateDelayedFocusedState(){this._ringManipulator.updateStateEnabled(mt.DelayedFocused,this.getFocused())}_updateDragState(){if(this._ringManipulator.updateStateEnabled(mt.Unlocked,!(null!=this._scaleRotateDragData&&"none"!==this._scaleRotateDragData?.mode)),null!=this._scaleRotateDragData)switch(this._scaleRotateDragData.mode){case"rotate":this._ringManipulator.updateStateEnabled(mt.ScaleIn|mt.ScaleOut,!1),this._ringManipulator.updateStateEnabled(mt.RotateLeft,this._scaleRotateDragData.angleDir<0),this._ringManipulator.updateStateEnabled(mt.RotateRight,this._scaleRotateDragData.angleDir>=0);break;case"scale":this._ringManipulator.updateStateEnabled(mt.RotateLeft|mt.RotateRight,!1),this._ringManipulator.updateStateEnabled(mt.ScaleIn,this._scaleRotateDragData.scaleDir<0),this._ringManipulator.updateStateEnabled(mt.ScaleOut,this._scaleRotateDragData.scaleDir>=0)}else this._ringManipulator.updateStateEnabled(mt.ScaleIn|mt.ScaleOut|mt.RotateLeft|mt.RotateRight,!1)}_updateManipulatorTransform(){const t=m(F.get(),this.adapter.angle,A(0,0,1));if(null==t)return;const e=this.getScale(),a=g(F.get(),v(k.get(),e,e,e));this._ringManipulator.modelTransform=f(F.get(),a,t)}_createRingManipulator(){const t=(t,e,a)=>{const o=[],i=Math.ceil(et*(e-t)/(2*Math.PI));for(let r=0;r<i+1;r++){const s=t+r*(e-t)/i;o.push(A(a*Math.cos(s),a*Math.sin(s),0))}return o},e=e=>t(0,2*Math.PI,e),a=t=>[[-t/2,0],[t/2,0],[t/2,W/2],[-t/2,W/2]],o=this._createMaterial(1),i=(t,e,i=o)=>lt(i,a(e),t,[],[],!1),r=e(K),s=i(r,q),n={left:new Array,right:new Array},l=[];for(let w=0;w<2;w++){const e=w*Math.PI-Math.PI/4,a=Math.PI/2-at,r=e+a,s=e+Math.PI/2-a,c=t(r,s,Q),d=i(c,tt);l.push(c),l.push(t(r,s,V-q/2)),n.left.push(d),n.right.push(d.instantiate());for(let t=0;t<2;t++){const e=0===t,a=S();if(e){_(a,a,[1,-1,1]),D(a,a,-r,[0,0,1]);const t=Math.round(B*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}else{D(a,a,s,[0,0,1]);const t=Math.round((1-B)*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}const i=st(o,Y,0,X,W);nt(i,a),(e?n.left:n.right).push(i)}}const c=[];for(let _=0;_<2;_++){const e=_*Math.PI-Math.PI/4,a=Math.PI/2-it,o=e+a,r=e+Math.PI/2-a,s=t(o,r,V);c.push(i(s,tt))}const d=this._createMaterial(.66),h=this._createMaterial(.5),u=this._createMaterial(.33),p=e(K+Z),m=e(K+$),g=i(p,tt,d),f=i(m,tt,u),v=e(K-Z),M=e(K-$),b=i(v,tt,d),j=i(M,tt,u);let y=[new L(s,mt.DelayedFocused),new L(s.instantiate({material:h}),pt.None)];this.mode&&"scale"!==this.mode||(y=y.concat([...c.map((t=>new L(t,mt.DelayedFocused|mt.Unlocked))),new L(g,mt.DelayedFocused|mt.ScaleIn),new L(f,mt.DelayedFocused|mt.ScaleIn),new L(b,mt.DelayedFocused|mt.ScaleOut),new L(j,mt.DelayedFocused|mt.ScaleOut)])),this.mode&&"rotate"!==this.mode||(y=y.concat([...n.right.map((t=>new L(t.instantiate(),mt.DelayedFocused|mt.Unlocked))),...n.left.map((t=>new L(t,mt.DelayedFocused|mt.RotateLeft))),...n.right.map((t=>new L(t,mt.DelayedFocused|mt.RotateRight)))]));const R=[r,...l];return new P({view:this.tool.view,renderObjects:y,autoScaleRenderObjects:!1,worldOriented:!0,radius:q,focusMultiplier:1,touchMultiplier:1.5,elevationInfo:this.tool.object.elevationInfo,collisionType:{type:"ribbon",paths:R,direction:A(0,0,1)}})}_createMaterial(t){const e=new dt({cullFace:rt.Back,renderOccluded:ct.Transparent,isDecoration:!0});return this.addHandles(l((()=>a(this.tool.view.effectiveTheme.accentColor,t)),(t=>e.setParameters({color:t})),c)),e}get test(){}};function ft(t,e){const a=M(k.get(),e.renderStart,t.origin),o=M(k.get(),e.renderEnd,t.origin),i=b(a),r=b(o);return 0===i?0:r/i}function _t(t,e,a,o){const{renderStart:i,renderEnd:r}=t,s=Dt(i,o,k.get()),n=Dt(r,o,k.get());if(j(s,n)<J*J)return null;const l=M(k.get(),i,a),c=y(k.get(),l,O(e)),d=i,h=R(k.get(),d,c),u=Dt(a,o,k.get()),p=s,m=Dt(h,o,k.get()),g=M(k.get(),m,p),f=M(k.get(),s,u),_=C(p,g),D=C(u,f);return E(_,n)<E(D,n)?"rotate":"scale"}function Dt(t,e,a){return e.projectToScreen(t,bt),v(a,bt[0],bt[1],0)}var St;function vt(t,e){let a=null,o=1;const i=()=>o;return{start:()=>{o=t.getScale(),a=t.getScale,t.getScale=i,e()},update:t=>(o+=((o+1)/2-o)*Math.min(t*ot,1),e(),Math.abs(o-1)<.01?St.STOP:St.CONTINUE),destroy:()=>{a&&(t.getScale=a),e()}}}function Mt(t,e,a){let o=0,i=null;const r=()=>!1;return{start:()=>{i=t.getFocused,t.getFocused=r,o=0,e()},update:t=>(o+=t,!i?.()||o>=a.delayMs?St.STOP:St.CONTINUE),destroy:()=>{i&&(t.getFocused=i),e()}}}t([u({constructOnly:!0})],gt.prototype,"tool",void 0),t([u({constructOnly:!0})],gt.prototype,"adapter",void 0),t([u({constructOnly:!0})],gt.prototype,"sketchOptions",void 0),t([u()],gt.prototype,"mode",void 0),t([u()],gt.prototype,"_activeAnimation",void 0),t([u()],gt.prototype,"updating",null),gt=t([p("esri.views.3d.interactive.editingTools.transform.ScaleRotateTransform")],gt),function(t){t[t.CONTINUE=0]="CONTINUE",t[t.STOP=1]="STOP"}(St||(St={}));const bt=h();export{gt as ScaleRotateTransform};
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import{multiplyOpacityToUnitRGBA as a}from"../../../../../core/colorUtils.js";import{cyclicalPI as o}from"../../../../../core/Cyclical.js";import i from"../../../../../core/Evented.js";import"../../../../../core/has.js";import{clamp as r,rad2deg as s}from"../../../../../core/mathUtils.js";import{destroyMaybe as n}from"../../../../../core/maybe.js";import{watch as l,initial as c}from"../../../../../core/reactiveUtils.js";import{addFrameTask as d}from"../../../../../core/scheduling.js";import{createScreenPointArray as h}from"../../../../../core/screenUtils.js";import{property as u}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as p}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromRotation as m,fromScaling as g,multiply as f,scale as _,rotate as D}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as S}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as v,d as M,l as b,s as j,e as y,g as R}from"../../../../../chunks/vec32.js";import{clone as w,fromValues as A}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromPositionAndNormal as T,create as I,getNormal as O}from"../../../../../geometry/support/plane.js";import{wrap as C,distance2 as E}from"../../../../../geometry/support/ray.js";import{sv3d as k,sm4d as F}from"../../../../../geometry/support/vectorStacks.js";import{Manipulator3D as P}from"../../Manipulator3D.js";import{calculateInputRotationTransform as U}from"../../manipulatorUtils.js";import{RenderObject as L}from"../../RenderObject.js";import{screenToRenderPlane as x}from"../dragEventPipeline3D.js";import{ManipulatorType as N}from"../ManipulatorType.js";import{ringIndicatorDelayMs as H,rotateIndicatorDirectionBuffer as G,scaleIndicatorDirectionBuffer as z,rotateIndicatorArrowPlacementPercentage as B,ringThickness as q,dragThresholdPx as J,ringRadius as K,innerIndicatorRadius as Q,outerIndicatorRadius as V,ringHeight as W,rotateIndicatorArrowTipRadius as X,rotateIndicatorArrowTipLength as Y,scaleIndicatorOffset1 as Z,scaleIndicatorOffset2 as $,indicatorThickness as tt,geometrySegments as et,rotateIndicatorArcLength as at,ringResetAnimationSpeedFactor as ot,scaleIndicatorArcLength as it}from"../manipulations/config.js";import{CullFaceOptions as rt}from"../../../webgl-engine/lib/basicInterfaces.js";import{createExtrudedTriangle as st,transformInPlace as nt,createPathExtrusionGeometry as lt}from"../../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as ct}from"../../../webgl-engine/lib/Material.js";import{ColorMaterial as dt}from"../../../webgl-engine/materials/ColorMaterial.js";import{createManipulatorDragEventPipeline as ht}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateCustomFlags as ut,ManipulatorStateFlags as pt}from"../../../../interactive/interfaces.js";var mt;!function(t){t.ScaleIn=ut.Custom2,t.ScaleOut=ut.Custom3,t.RotateLeft=ut.Custom4,t.RotateRight=ut.Custom5,t.Unlocked=ut.Custom7,t.DelayedFocused=ut.Custom8,t.TouchInput=ut.Custom12}(mt||(mt={}));let gt=class extends e{get angle(){return this.adapter.angle}get scale(){return this.adapter.scale}set location(t){this._ringManipulator.location=t}set elevationAlignedLocation(t){this._ringManipulator.elevationAlignedLocation=t}get grabbing(){return this._ringManipulator.grabbing}set interactive(t){this._ringManipulator.interactive=t}get updating(){return!!this._activeAnimation}constructor(t){super(t),this.mode=null,this._scaleRotateDragData=null,this._activeAnimation=null,this._ringIndicatorDelayMs=H,this.events=new i,this.getFocused=()=>this._ringManipulator.focused,this.getScale=()=>"scale"===this._scaleRotateDragData?.mode?this.adapter.scale:1}initialize(){this._createManipulator(),this._updateDragState(),this._updateManipulatorTransform(),this.addHandles([l((()=>{const{adapter:t}=this;return[t.angle,t.scale]}),(()=>this._updateManipulatorTransform()))])}destroy(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=null,this.tool.manipulators.remove(this._ringManipulator),this._ringManipulator=null}startAnimation(t){this.cancelActiveAnimation(),t.start();const e=d({update:({deltaTime:e})=>{t.update(e)&&this.cancelActiveAnimation()}});this._activeAnimation={...t,frameTask:e}}cancelActiveAnimation(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=n(this._activeAnimation)}forEachManipulator(t){t(this._ringManipulator,N.SCALE_ROTATE)}_createManipulator(){const t=this._createRingManipulator();this._ringManipulator=t,this.tool.manipulators.add(t);const e=this.tool.object,a=ht(t,((t,a,i)=>{this._scaleRotateDragData=null;const n=this.adapter.startInteraction(),l={mode:"none",origin:w(t.renderLocation),initialAngle:this.adapter.angle,angle:0,angleDir:0,scaleDir:0};this._scaleRotateDragData=l,this._updateDragState();const c=k.get();this.tool.view.renderCoordsHelper.worldUpAtPosition(t.renderLocation,c),a.next(x(this.tool.view,T(t.renderLocation,c,I()))).next((t=>{const a=O(t.plane),i=U(t.renderStart,t.renderEnd,l.origin,a),c=o.shortestSignedDiff(l.angle,i);l.angleDir=r(l.angleDir+c,-.3,G),l.angle=i;const d=ft(l,t),h=d-this.adapter.scale;if(l.scaleDir=r(l.scaleDir+h,-.2,z),this._onScaleChanged(),"none"===l.mode){const a=this.mode||_t(t,t.plane,l.origin,this.tool.view.state.camera);if(null!=a){switch(a){case"rotate":this.tool.events.emit("rotate-start",{object:e,angle:0}),this.tool.events.emit("record-undo",{updates:[this.adapter.createUndoRecord()]});break;case"scale":this.tool.events.emit("scale-start",{object:e,xScale:1,yScale:1}),this.tool.events.emit("record-undo",{updates:[this.adapter.createUndoRecord()]})}l.mode=a}}switch(l.mode){case"rotate":n.state.angle=l.initialAngle+i;break;case"scale":n.state.scale=d,this._onScaleChanged()}switch(this._updateDragState(),this._updateManipulatorTransform(),t.action){case"start":case"update":switch(l.mode){case"rotate":this.tool.events.emit("rotate",{object:e,angle:s(l.angle)});break;case"scale":this.tool.events.emit("scale",{object:e,xScale:d,yScale:d})}break;case"end":switch(l.mode){case"rotate":this.tool.events.emit("rotate-stop",{object:e,angle:s(l.angle)});break;case"scale":this.tool.events.emit("scale-stop",{object:e,xScale:d,yScale:d})}}return"end"===t.action&&(this.startAnimation(vt(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState(),n.done()),t})),i.next((()=>{if(n.cancel(),null!=this._scaleRotateDragData){switch(this._scaleRotateDragData.mode){case"none":break;case"rotate":this.tool.events.emit("rotate-stop",{object:e,angle:0});break;case"scale":this.tool.events.emit("scale-stop",{object:e,xScale:1,yScale:1})}this.startAnimation(vt(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState()}}))}));this.addHandles([a,t.events.on("focus-changed",(t=>{"focus"===t.action?this.startAnimation(Mt(this,(()=>this._updateDelayedFocusedState()),{delayMs:this._ringIndicatorDelayMs})):this._updateDelayedFocusedState()})),t.events.on("immediate-click",(t=>{t.stopPropagation()})),l((()=>this.tool.object.visible),(t=>this._ringManipulator.available=t),c)])}_onScaleChanged(){this.events.emit("scale-changed"),this._updateManipulatorTransform()}_updateDelayedFocusedState(){this._ringManipulator.updateStateEnabled(mt.DelayedFocused,this.getFocused())}_updateDragState(){if(this._ringManipulator.updateStateEnabled(mt.Unlocked,!(null!=this._scaleRotateDragData&&"none"!==this._scaleRotateDragData?.mode)),null!=this._scaleRotateDragData)switch(this._scaleRotateDragData.mode){case"rotate":this._ringManipulator.updateStateEnabled(mt.ScaleIn|mt.ScaleOut,!1),this._ringManipulator.updateStateEnabled(mt.RotateLeft,this._scaleRotateDragData.angleDir<0),this._ringManipulator.updateStateEnabled(mt.RotateRight,this._scaleRotateDragData.angleDir>=0);break;case"scale":this._ringManipulator.updateStateEnabled(mt.RotateLeft|mt.RotateRight,!1),this._ringManipulator.updateStateEnabled(mt.ScaleIn,this._scaleRotateDragData.scaleDir<0),this._ringManipulator.updateStateEnabled(mt.ScaleOut,this._scaleRotateDragData.scaleDir>=0)}else this._ringManipulator.updateStateEnabled(mt.ScaleIn|mt.ScaleOut|mt.RotateLeft|mt.RotateRight,!1)}_updateManipulatorTransform(){const t=m(F.get(),this.adapter.angle,A(0,0,1));if(null==t)return;const e=this.getScale(),a=g(F.get(),v(k.get(),e,e,e));this._ringManipulator.modelTransform=f(F.get(),a,t)}_createRingManipulator(){const t=(t,e,a)=>{const o=[],i=Math.ceil(et*(e-t)/(2*Math.PI));for(let r=0;r<i+1;r++){const s=t+r*(e-t)/i;o.push(A(a*Math.cos(s),a*Math.sin(s),0))}return o},e=e=>t(0,2*Math.PI,e),a=t=>[[-t/2,0],[t/2,0],[t/2,W/2],[-t/2,W/2]],o=this._createMaterial(1),i=(t,e,i=o)=>lt(i,a(e),t,[],[],!1),r=e(K),s=i(r,q),n={left:new Array,right:new Array},l=[];for(let w=0;w<2;w++){const e=w*Math.PI-Math.PI/4,a=Math.PI/2-at,r=e+a,s=e+Math.PI/2-a,c=t(r,s,Q),d=i(c,tt);l.push(c),l.push(t(r,s,V-q/2)),n.left.push(d),n.right.push(d.instantiate());for(let t=0;t<2;t++){const e=0===t,a=S();if(e){_(a,a,[1,-1,1]),D(a,a,-r,[0,0,1]);const t=Math.round(B*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}else{D(a,a,s,[0,0,1]);const t=Math.round((1-B)*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}const i=st(o,Y,0,X,W);nt(i,a),(e?n.left:n.right).push(i)}}const c=[];for(let _=0;_<2;_++){const e=_*Math.PI-Math.PI/4,a=Math.PI/2-it,o=e+a,r=e+Math.PI/2-a,s=t(o,r,V);c.push(i(s,tt))}const d=this._createMaterial(.66),h=this._createMaterial(.5),u=this._createMaterial(.33),p=e(K+Z),m=e(K+$),g=i(p,tt,d),f=i(m,tt,u),v=e(K-Z),M=e(K-$),b=i(v,tt,d),j=i(M,tt,u);let y=[new L(s,mt.DelayedFocused),new L(s.instantiate({material:h}),pt.None)];this.mode&&"scale"!==this.mode||(y=y.concat([...c.map((t=>new L(t,mt.DelayedFocused|mt.Unlocked))),new L(g,mt.DelayedFocused|mt.ScaleIn),new L(f,mt.DelayedFocused|mt.ScaleIn),new L(b,mt.DelayedFocused|mt.ScaleOut),new L(j,mt.DelayedFocused|mt.ScaleOut)])),this.mode&&"rotate"!==this.mode||(y=y.concat([...n.right.map((t=>new L(t.instantiate(),mt.DelayedFocused|mt.Unlocked))),...n.left.map((t=>new L(t,mt.DelayedFocused|mt.RotateLeft))),...n.right.map((t=>new L(t,mt.DelayedFocused|mt.RotateRight)))]));const R=[r,...l];return new P({view:this.tool.view,renderObjects:y,autoScaleRenderObjects:!1,worldOriented:!0,radius:q,focusMultiplier:1,touchMultiplier:1.5,elevationInfo:this.tool.object.elevationInfo,collisionType:{type:"ribbon",paths:R,direction:A(0,0,1)}})}_createMaterial(t){const e=new dt({cullFace:rt.Back,renderOccluded:ct.Transparent,isDecoration:!0});return this.addHandles(l((()=>a(this.tool.view.effectiveTheme.accentColor,t)),(t=>e.setParameters({color:t})),c)),e}get test(){}};function ft(t,e){const a=M(k.get(),e.renderStart,t.origin),o=M(k.get(),e.renderEnd,t.origin),i=b(a),r=b(o);return 0===i?0:r/i}function _t(t,e,a,o){const{renderStart:i,renderEnd:r}=t,s=Dt(i,o,k.get()),n=Dt(r,o,k.get());if(j(s,n)<J*J)return null;const l=M(k.get(),i,a),c=y(k.get(),l,O(e)),d=i,h=R(k.get(),d,c),u=Dt(a,o,k.get()),p=s,m=Dt(h,o,k.get()),g=M(k.get(),m,p),f=M(k.get(),s,u),_=C(p,g),D=C(u,f);return E(_,n)<E(D,n)?"rotate":"scale"}function Dt(t,e,a){return e.projectToScreen(t,bt),v(a,bt[0],bt[1],0)}var St;function vt(t,e){let a=null,o=1;const i=()=>o;return{start:()=>{o=t.getScale(),a=t.getScale,t.getScale=i,e()},update:t=>(o+=((o+1)/2-o)*Math.min(t*ot,1),e(),Math.abs(o-1)<.01?St.STOP:St.CONTINUE),destroy:()=>{a&&(t.getScale=a),e()}}}function Mt(t,e,a){let o=0,i=null;const r=()=>!1;return{start:()=>{i=t.getFocused,t.getFocused=r,o=0,e()},update:t=>(o+=t,!i?.()||o>=a.delayMs?St.STOP:St.CONTINUE),destroy:()=>{i&&(t.getFocused=i),e()}}}t([u({constructOnly:!0})],gt.prototype,"tool",void 0),t([u({constructOnly:!0})],gt.prototype,"adapter",void 0),t([u({constructOnly:!0})],gt.prototype,"sketchOptions",void 0),t([u()],gt.prototype,"mode",void 0),t([u()],gt.prototype,"_activeAnimation",void 0),t([u()],gt.prototype,"updating",null),gt=t([p("esri.views.3d.interactive.editingTools.transform.ScaleRotateTransform")],gt),function(t){t[t.CONTINUE=0]="CONTINUE",t[t.STOP=1]="STOP"}(St||(St={}));const bt=h();export{gt as ScaleRotateTransform};
@@ -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/Error.js";import{makeHandle as r,handlesGroup as i,destroyHandle as n}from"../../../core/handleUtils.js";import"../../../core/has.js";import{getProjectiveTransform as s}from"../../../core/perspectiveUtils.js";import{debounce as a,isPromiseLike as o}from"../../../core/promiseUtils.js";import{watch as l,on as d,syncAndInitial as m}from"../../../core/reactiveUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import{create as h}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{toExtent as u}from"../../../geometry/support/aaBoundingRect.js";import{MediaElementView as y}from"../../../layers/support/MediaElementView.js";import{DrapeSourceType as g}from"./interfaces.js";import{LayerView3D as _}from"./LayerView3D.js";import{MediaLayerInteraction as f}from"./support/MediaLayerInteraction.js";import{drapedZ as E}from"../terrain/OverlayRenderer.js";import{Attribute as w}from"../webgl-engine/lib/Attribute.js";import{Geometry as v}from"../webgl-engine/lib/Geometry.js";import{DirtyOperation as D,DirtyState as b}from"../webgl-engine/lib/ModelDirtyTypes.js";import{RenderGeometry as R}from"../webgl-engine/lib/RenderGeometry.js";import{Texture as j}from"../webgl-engine/lib/Texture.js";import{UpdatePolicy as A}from"../webgl-engine/lib/UpdatePolicy.js";import{VertexAttribute as T}from"../webgl-engine/lib/VertexAttribute.js";import{ImageMaterial as x}from"../webgl-engine/materials/ImageMaterial.js";import P from"../../layers/LayerView.js";import M from"../../layers/MediaLayerView.js";import{isInEffectiveScaleRange as S}from"../../support/layerViewUtils.js";import{TextureWrapMode as G}from"../../webgl/enums.js";let I=class extends(_(M(P))){get interactive(){return this._interaction.enabled}set interactive(e){this._interaction&&(this._interaction.enabled=e)}get selectedElement(){return this._interaction.selectedElement}set selectedElement(e){this._interaction&&(this._interaction.selectedElement=e)}get visibleAtCurrentScale(){return S(this.layer.effectiveScaleRange,this.view.scale)}constructor(e){super(e),this.type="media-3d",this.drapeSourceType=g.Features,this.updatePolicy=A.ASYNC,this._uidToElement=new Map,this._renderedElements=new Map,this._lastDrapingExtent=null,this._update=a((async(e,t,r)=>{const i=await this._collectMediaElements(e,t,r);this._synchronizeRenderElements(i)}),0);const{view:t,layer:r}=e;this._interaction=new f({view:t,layer:r}),this.addHandles(l((()=>this.interactionOptions),(e=>this._interaction.options=e),m))}initialize(){const{view:e,layer:t}=this;this._renderer=e.basemapTerrain.overlayManager.registerGeometryDrapeSource(this);const i=()=>this._updateWithLastDrapingExtent();this.addHandles([r((()=>e.basemapTerrain.overlayManager.unregisterDrapeSource(this))),d((()=>t.effectiveSource),"change",i),d((()=>t.effectiveSource),"refresh",i)]),this._updatingHandles.add((()=>this.suspended),i)}setDrapingExtent(e,t){this._lastDrapingExtent={overlays:e,spatialReference:t},this._updateWithLastDrapingExtent()}getHit(e){const t=this._uidToElement.get(e);return t?{type:"media",element:t,layer:this.layer}:null}isUpdating(){return super.isUpdating()||this._interaction.updating}_updateWithLastDrapingExtent(){if(null==this._lastDrapingExtent||this.suspended)return void(this._renderer&&this._synchronizeRenderElements(new Set));const{overlays:e,spatialReference:t}=this._lastDrapingExtent;this._updatingHandles.addPromise(this._update(e,t).catch((()=>{})))}async _collectMediaElements(e,t,r){const i=this.layer.effectiveSource;return null==i?new Set:new Set((await Promise.all(e.map((e=>i.queryElements(u(e.extent,t),{signal:r}))))).flat())}_synchronizeRenderElements(e){this._synchronizeRenderElementsRemove(e),this._synchronizeRenderElementsAdd(e)}_synchronizeRenderElementsRemove(e){this._renderedElements.forEach(((t,r)=>{e.has(r)||(this._removeElement(r,t),this.emit("element-render-changed",{element:r}))}))}_synchronizeRenderElementsAdd(e){for(const t of e)this._renderedElements.has(t)||this._createRenderElement(t)}_removeElement(e,{renderData:t,handle:r}){this._destroyRenderData(e,t),this._renderedElements.delete(e),this._uidToElement.delete(e.uid),r.remove()}async _createRenderElement(e){const t=new y({spatialReference:this.view.spatialReference,element:e}),r={renderData:null,handle:i([this._updatingHandles.add((()=>e.opacity),(e=>{null!=r.renderData&&r.renderData.material.setParameters({opacity:e})})),this._updatingHandles.add((()=>t.coords),(()=>{null!=r.renderData?this._updateGeometry(t,r,r.renderData):this._initializeRenderData(t,r)})),this._updatingHandles.add((()=>e.content),(()=>this._initializeRenderData(t,r))),n(t)])};this._renderedElements.set(e,r),this._uidToElement.set(e.uid,e),this._updatingHandles.addPromise(e.load().catch((()=>{}))),this._initializeRenderData(t,r)}_initializeRenderData(e,t){const{coords:r,element:i}=e,{contentWidth:n,contentHeight:s}=i;if(null==r||null==i.content)return void(t.renderData=this._destroyRenderData(i,t.renderData));if(null!=t.renderData)return;const a=this._createTexture(i.content),l=a.load(this.view._stage.renderView.renderingContext);this.view._stage.add(a),o(l)&&this._updatingHandles.addPromise(l);const d=new x({initTextureTransparent:!0,textureId:a.id,opacity:i.opacity,perspectiveInterpolation:!0}),m=this._getPositionAttributeArray(r),c=[0,0,1,0,1,1,0,1],p=this._getPerspectiveDivideAttributeArray(m,n,s),h=[0,1,2,0,2,3],u=new v(d,[[T.POSITION,new w(m,h,3,!0)],[T.UV0,new w(c,h,2,!0)],[T.PERSPECTIVEDIVIDE,new w(p,h,1,!0)]]),y=new R(u,{layerUid:this.layer.uid,graphicUid:i.uid});this._renderer.addGeometries([y],D.ADD),t.renderData={renderGeometry:y,texture:a,material:d},this.emit("element-render-changed",{element:i})}_updateGeometry(e,t,r){const{coords:i,element:n}=e;if(null==i||null==n.content)return void(t.renderData=this._destroyRenderData(n,t.renderData));const s=this._getPositionAttributeArray(i);r.renderGeometry.geometry.setAttributeData(T.POSITION,s);const a=this._getPerspectiveDivideAttributeArray(s,n.contentWidth,n.contentHeight);r.renderGeometry.geometry.setAttributeData(T.PERSPECTIVEDIVIDE,a),r.renderGeometry.geometry.invalidateBoundingInfo(),this._renderer.modifyGeometries([r.renderGeometry],b.GEOMETRY),this.emit("element-render-changed",{element:n})}_getPositionAttributeArray(e){const[t,r,i,n]=e.rings[0];return[t[0],t[1],E,n[0],n[1],E,i[0],i[1],E,r[0],r[1],E]}_getPerspectiveDivideAttributeArray(e,t,r){s(H,[0,0,t,0,t,r,0,r],[e[0],e[1],e[3],e[4],e[6],e[7],e[9],e[10]]);const i=H[6]/H[8]*t,n=H[7]/H[8]*r;return[1,1+i,1+i+n,1+n]}_destroyRenderData(e,t){if(null==t)return null;const r=t.texture;return r.unload(),this.view._stage.remove(r),this._renderer.removeGeometries([t.renderGeometry],D.REMOVE),this.emit("element-render-changed",{element:e}),null}_createTexture(e){const r=e instanceof HTMLImageElement?e.naturalWidth:e.width,i=e instanceof HTMLImageElement?e.naturalHeight:e.height;if("getFrame"in e)throw new t("media-layer-view-3d","animation is not supported");return new j(e,{wrap:{s:G.CLAMP_TO_EDGE,t:G.CLAMP_TO_EDGE},preMultiplyAlpha:!0,width:r,height:i,mipmap:!0,updateCallback:()=>this.view.basemapTerrain.overlayManager.setDrawTexturesDirty()})}get test(){}};e([c({readOnly:!0})],I.prototype,"type",void 0),e([c()],I.prototype,"layer",void 0),e([c()],I.prototype,"interactive",null),e([c()],I.prototype,"selectedElement",null),e([c({readOnly:!0})],I.prototype,"visibleAtCurrentScale",null),I=e([p("esri.views.3d.layers.MediaLayerView3D")],I);const H=h(),L=I;export{L as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{makeHandle as r,handlesGroup as i,destroyHandle as n}from"../../../core/handleUtils.js";import"../../../core/has.js";import{isIterable as s}from"../../../core/iteratorUtils.js";import{getProjectiveTransform as a}from"../../../core/perspectiveUtils.js";import{debounce as o,isPromiseLike as d}from"../../../core/promiseUtils.js";import{watch as l,on as m,syncAndInitial as h}from"../../../core/reactiveUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{toExtent as u}from"../../../geometry/support/aaBoundingRect.js";import{MediaElementView as y}from"../../../layers/support/MediaElementView.js";import{DrapeSourceType as _}from"./interfaces.js";import{LayerView3D as f}from"./LayerView3D.js";import{MediaLayerInteraction as E}from"./support/MediaLayerInteraction.js";import{drapedZ as D}from"../terrain/OverlayRenderer.js";import{Attribute as w}from"../webgl-engine/lib/Attribute.js";import{Geometry as v}from"../webgl-engine/lib/Geometry.js";import{DirtyState as b,DirtyOperation as j}from"../webgl-engine/lib/ModelDirtyTypes.js";import{Object3DHighlightStateID as R}from"../webgl-engine/lib/Object3DStateID.js";import{RenderGeometry as I}from"../webgl-engine/lib/RenderGeometry.js";import{Texture as H}from"../webgl-engine/lib/Texture.js";import{UpdatePolicy as G}from"../webgl-engine/lib/UpdatePolicy.js";import{VertexAttribute as A}from"../webgl-engine/lib/VertexAttribute.js";import{ImageMaterial as T}from"../webgl-engine/materials/ImageMaterial.js";import x from"../../layers/LayerView.js";import M from"../../layers/MediaLayerView.js";import{defaultHighlightName as P}from"../../support/HighlightDefaults.js";import{isInEffectiveScaleRange as S}from"../../support/layerViewUtils.js";import{TextureWrapMode as L}from"../../webgl/enums.js";let V=class extends(f(M(x))){get interactive(){return this._interaction.enabled}set interactive(e){this._interaction&&(this._interaction.enabled=e)}get selectedElement(){return this._interaction.selectedElement}set selectedElement(e){this._interaction&&(this._interaction.selectedElement=e)}get visibleAtCurrentScale(){return S(this.layer.effectiveScaleRange,this.view.scale)}constructor(e){super(e),this.type="media-3d",this.drapeSourceType=_.Features,this.updatePolicy=G.ASYNC,this._uidToElement=new Map,this._highlightedElements=new Map,this._elementsInHighlightedId=new Map,this._renderedElements=new Map,this._lastDrapingExtent=null,this._update=o((async(e,t,r)=>{const i=await this._collectMediaElements(e,t,r);this._synchronizeRenderElements(i)}),0);const{view:t,layer:r}=e;this._interaction=new E({view:t,layer:r}),this.addHandles(l((()=>this.interactionOptions),(e=>this._interaction.options=e),h))}initialize(){const{view:e,layer:t}=this;this._renderer=e.basemapTerrain.overlayManager.registerGeometryDrapeSource(this);const i=()=>this._updateWithLastDrapingExtent();this.addHandles([r((()=>e.basemapTerrain.overlayManager.unregisterDrapeSource(this))),m((()=>t.effectiveSource),"change",i),m((()=>t.effectiveSource),"refresh",i)]),this._updatingHandles.add((()=>this.suspended),i)}setDrapingExtent(e,t){this._lastDrapingExtent={overlays:e,spatialReference:t},this._updateWithLastDrapingExtent()}getHit(e){const t=this._uidToElement.get(e);return t?{type:"media",element:t,layer:this.layer}:null}highlight(e,t){const i=new R(t??P),n=s(e)?Array.from(e):[e];this._elementsInHighlightedId.set(i,n);for(const r of n){const e=this._highlightedElements.get(r);e?e.add(i):this._highlightedElements.set(r,new Set([i]));const t=this._renderedElements.get(r);t?.renderData&&(t.renderData.renderGeometry.geometry.addHighlight(i),this._renderer.modifyGeometries([t.renderData.renderGeometry],b.HIGHLIGHT))}return r((()=>{const e=this._elementsInHighlightedId.get(i);if(e){for(const t of e){const e=this._highlightedElements.get(t);if(!e)continue;e.delete(i);const r=this._renderedElements.get(t);r?.renderData&&(r.renderData.renderGeometry.geometry.removeHighlight(i),this._renderer.modifyGeometries([r.renderData.renderGeometry],b.HIGHLIGHT)),0===e.size&&this._highlightedElements.delete(t)}this._elementsInHighlightedId.delete(i)}}))}isUpdating(){return super.isUpdating()||this._interaction.updating}_updateWithLastDrapingExtent(){if(null==this._lastDrapingExtent||this.suspended)return void(this._renderer&&this._synchronizeRenderElements(new Set));const{overlays:e,spatialReference:t}=this._lastDrapingExtent;this._updatingHandles.addPromise(this._update(e,t).catch((()=>{})))}async _collectMediaElements(e,t,r){const i=this.layer.effectiveSource;return null==i?new Set:new Set((await Promise.all(e.map((e=>i.queryElements(u(e.extent,t),{signal:r}))))).flat())}_synchronizeRenderElements(e){this._synchronizeRenderElementsRemove(e),this._synchronizeRenderElementsAdd(e)}_synchronizeRenderElementsRemove(e){this._renderedElements.forEach(((t,r)=>{e.has(r)||(this._removeElement(r,t),this.emit("element-render-changed",{element:r}))}))}_synchronizeRenderElementsAdd(e){for(const t of e)this._renderedElements.has(t)||this._createRenderElement(t)}_removeElement(e,{renderData:t,handle:r}){this._destroyRenderData(e,t),this._renderedElements.delete(e),this._uidToElement.delete(e.uid),r.remove()}async _createRenderElement(e){const t=new y({spatialReference:this.view.spatialReference,element:e}),r={renderData:null,handle:i([this._updatingHandles.add((()=>e.opacity),(e=>{null!=r.renderData&&r.renderData.material.setParameters({opacity:e})})),this._updatingHandles.add((()=>t.coords),(()=>{null!=r.renderData?this._updateGeometry(t,r,r.renderData):this._initializeRenderData(t,r)})),this._updatingHandles.add((()=>e.content),(()=>this._initializeRenderData(t,r))),n(t)])};this._renderedElements.set(e,r),this._uidToElement.set(e.uid,e),this._updatingHandles.addPromise(e.load().catch((()=>{}))),this._initializeRenderData(t,r)}_initializeRenderData(e,t){const{coords:r,element:i}=e,{contentWidth:n,contentHeight:s}=i;if(null==r||null==i.content)return void(t.renderData=this._destroyRenderData(i,t.renderData));if(null!=t.renderData)return;const a=this._createTexture(i.content),o=a.load(this.view._stage.renderView.renderingContext);this.view._stage.add(a),d(o)&&this._updatingHandles.addPromise(o);const l=new T({initTextureTransparent:!0,textureId:a.id,opacity:i.opacity,perspectiveInterpolation:!0}),m=this._getPositionAttributeArray(r),h=[0,0,1,0,1,1,0,1],c=this._getPerspectiveDivideAttributeArray(m,n,s),p=[0,1,2,0,2,3],g=new v(l,[[A.POSITION,new w(m,p,3,!0)],[A.UV0,new w(h,p,2,!0)],[A.PERSPECTIVEDIVIDE,new w(c,p,1,!0)]]),u=new I(g,{layerUid:this.layer.uid,graphicUid:i.uid}),y=this._highlightedElements.get(i);y?.forEach((e=>{u.geometry.addHighlight(e)})),this._renderer.addGeometries([u],j.ADD),t.renderData={renderGeometry:u,texture:a,material:l},this.emit("element-render-changed",{element:i})}_updateGeometry(e,t,r){const{coords:i,element:n}=e;if(null==i||null==n.content)return void(t.renderData=this._destroyRenderData(n,t.renderData));const s=this._getPositionAttributeArray(i);r.renderGeometry.geometry.setAttributeData(A.POSITION,s);const a=this._getPerspectiveDivideAttributeArray(s,n.contentWidth,n.contentHeight);r.renderGeometry.geometry.setAttributeData(A.PERSPECTIVEDIVIDE,a),r.renderGeometry.geometry.invalidateBoundingInfo(),this._renderer.modifyGeometries([r.renderGeometry],b.GEOMETRY),this.emit("element-render-changed",{element:n})}_getPositionAttributeArray(e){const[t,r,i,n]=e.rings[0];return[t[0],t[1],D,n[0],n[1],D,i[0],i[1],D,r[0],r[1],D]}_getPerspectiveDivideAttributeArray(e,t,r){a(z,[0,0,t,0,t,r,0,r],[e[0],e[1],e[3],e[4],e[6],e[7],e[9],e[10]]);const i=z[6]/z[8]*t,n=z[7]/z[8]*r;return[1,1+i,1+i+n,1+n]}_destroyRenderData(e,t){if(null==t)return null;const r=t.texture;return r.unload(),this.view._stage.remove(r),this._renderer.removeGeometries([t.renderGeometry],j.REMOVE),this.emit("element-render-changed",{element:e}),null}_createTexture(e){const r=e instanceof HTMLImageElement?e.naturalWidth:e.width,i=e instanceof HTMLImageElement?e.naturalHeight:e.height;if("getFrame"in e)throw new t("media-layer-view-3d","animation is not supported");return new H(e,{wrap:{s:L.CLAMP_TO_EDGE,t:L.CLAMP_TO_EDGE},preMultiplyAlpha:!0,width:r,height:i,mipmap:!0,updateCallback:()=>this.view.basemapTerrain.overlayManager.setDrawTexturesDirty()})}get test(){}};e([c({readOnly:!0})],V.prototype,"type",void 0),e([c()],V.prototype,"layer",void 0),e([c()],V.prototype,"interactive",null),e([c()],V.prototype,"selectedElement",null),e([c({readOnly:!0})],V.prototype,"visibleAtCurrentScale",null),V=e([p("esri.views.3d.layers.MediaLayerView3D")],V);const z=g(),O=V;export{O 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{copy as t,set as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as r,ZEROS as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{TextRenderAlignment as c,textVerticalPaddingPx as n}from"../../webgl-engine/lib/TextRenderer.js";const i=Object.freeze({left:0,center:.5,right:1}),s=Object.freeze({"bottom-left":r(0,0),bottom:r(.5,0),"bottom-right":r(1,0),left:r(0,.5),center:r(.5,.5),right:r(1,.5),"top-left":r(0,1),top:r(.5,1),"top-right":r(1,1)});function f(t){switch(t){case"left":return c.Left;case"right":return c.Right;default:return c.Center}}function a(t){switch(t){case"bottom-left":case"left":case"top-left":return"left";case"bottom":case"center":case"top":return"center";case"bottom-right":case"right":case"top-right":return"right"}}function l(t){switch(t){case"bottom-left":case"bottom":case"bottom-right":return"bottom";case"left":case"center":case"right":return"center";case"top-left":case"top":case"top-right":return"top"}}function m(t,e){switch(e){case"bottom":return"left"===t?"bottom-left":"right"===t?"bottom-right":"bottom";case"center":return t;case"top":return"left"===t?"top-left":"right"===t?"top-right":"top"}}function u(t){return"middle"===t?"center":t}function h(r,c){switch(r){case"top":return e(c,0,n);case"bottom":return e(c,0,-n);default:return t(c,o)}}export{m as anchorFromPlacements,a as horizontalPlacementFromAnchor,i as horizontalPlacementToAnchorX,s as namedAnchorToHUDMaterialAnchorPos,f as textRenderAlignmentFromHorizontalPlacement,u as verticalPlacementFromAlignment,l as verticalPlacementFromAnchor,h as verticalScreenOffsetFromAlignment};
5
+ import{copy as t,set as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as r,ZEROS as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{TextRenderAlignment as c,textVerticalPaddingPx as n}from"../../webgl-engine/lib/TextRenderer.js";const i=Object.freeze({left:0,center:.5,right:1}),s=Object.freeze({"bottom-left":r(0,0),bottom:r(.5,0),"bottom-right":r(1,0),left:r(0,.5),center:r(.5,.5),right:r(1,.5),"top-left":r(0,1),top:r(.5,1),"top-right":r(1,1)});function f(t){switch(t){case"left":return c.Left;case"right":return c.Right;default:return c.Center}}function a(t){switch(t){case"bottom-left":case"left":case"top-left":return"left";case"bottom":case"center":case"top":return"center";case"bottom-right":case"right":case"top-right":return"right"}}function l(t){switch(t){case"bottom-left":case"bottom":case"bottom-right":return"bottom";case"left":case"center":case"right":return"center";case"top-left":case"top":case"top-right":return"top"}}function m(t,e){switch(e){case"bottom":return"left"===t?"bottom-left":"right"===t?"bottom-right":"bottom";case"center":return t;case"top":return"left"===t?"top-left":"right"===t?"top-right":"top"}}function u(t){return"middle"===t?"center":t}function h(r,c){switch(r){case"top":return e(c,0,n);case"bottom":return e(c,0,-1);default:return t(c,o)}}export{m as anchorFromPlacements,a as horizontalPlacementFromAnchor,i as horizontalPlacementToAnchorX,s as namedAnchorToHUDMaterialAnchorPos,f as textRenderAlignmentFromHorizontalPlacement,u as verticalPlacementFromAlignment,l as verticalPlacementFromAnchor,h as verticalScreenOffsetFromAlignment};
@@ -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"../../../../geometry.js";import e from"../../../../request.js";import{binaryIndexOf as t,splitIntoChunks as r}from"../../../../core/arrayUtils.js";import o from"../../../../core/Error.js";import has from"../../../../core/has.js";import{isInt16Array as n,isInt32Array as s}from"../../../../core/typedArrayUtil.js";import{invert as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as l,t as c,c as u}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as p}from"../../../../geometry/projection.js";import{projectVectorToVector as m}from"../../../../geometry/projection/projectVectorToVector.js";import{create as d,empty as y,expandPointInPlace as h,intersects as g}from"../../../../geometry/support/aaBoundingRect.js";import{a as S}from"../../../../chunks/sphere.js";import b from"../../../../rest/support/Query.js";import{readBinaryAttribute as w}from"./I3SBinaryReader.js";import{computeGlobalTransformation as I}from"./I3SProjectionUtil.js";import{createSolidEdgeMaterial as T,createMaterialFromEdges as E}from"../support/edgeUtils.js";import{parseColorMixMode as R,ColorMixModeEnum as x}from"../support/symbolColorUtils.js";import{Obb as v,compute as j}from"../../support/orientedBoundingBox.js";import{spatialReferenceIncompatibleError as M}from"../../../support/layerViewUtils.js";import C from"../../../../geometry/SpatialReference.js";function U(e){return e?parseInt(e.slice(e.lastIndexOf("/")+1),10):void 0}function k(e){if(has("disable-feature:i3s-draco")||!e)return!1;for(const t of e)for(const e of t.geometryBuffers)if("draco"===e.compressedAttributes?.encoding)return!0;return!1}function N(e,t,r,o){r.traverse(t,(t=>{const r=t.serviceMbsInIndexSR;return(null!=r&&F(e,r))!==q.OUTSIDE&&(o(t),!0)}))}function D(e,t,r){let o=0,n=0;for(let s=0;s<t.length&&o<e.length;s++)e[o]===t[s]&&(r(s)&&(e[n]=e[o],n++),o++);e.length=n}function W(e,r,o){let n=0,s=0;for(;n<o.length;){t(e,o[n])>=0===r&&(o[s]=o[n],s++),n++}o.length=s}function _(e,t){if(0===t.rotationScale[1]&&0===t.rotationScale[2]&&0===t.rotationScale[3]&&0===t.rotationScale[5]&&0===t.rotationScale[6]&&0===t.rotationScale[7])return O[0]=(e[0]-t.position[0])/t.rotationScale[0],O[1]=(e[1]-t.position[1])/t.rotationScale[4],O[2]=(e[2]-t.position[0])/t.rotationScale[0],O[3]=(e[3]-t.position[1])/t.rotationScale[4],O}const O=d();var q;function F(e,t){const r=t[0],o=t[1],n=t[3],s=e[0]-r,i=r-e[2],a=e[1]-o,l=o-e[3],c=Math.max(s,i,0),u=Math.max(a,l,0),f=c*c+u*u;if(f>n*n)return q.OUTSIDE;if(f>0)return q.INTERSECTS_CENTER_OUTSIDE;return-Math.max(s,i,a,l)>n?q.INSIDE:q.INTERSECTS_CENTER_INSIDE}function L(e,t,r){const o=[],n=r?.missingFields,s=r?.originalFields;for(const i of e){const e=i.toLowerCase();let r=!1;for(const n of t)if(e===n.name.toLowerCase()){o.push(n.name),r=!0,s&&s.push(i);break}!r&&n&&n.push(i)}return o}async function A(e,t,r,n,s,i){if(0===t.length)return[];const a=e.attributeStorageInfo;if(null!=e.associatedLayer)try{return await P(e.associatedLayer,t,r,n,i)}catch(l){if(e.associatedLayer.loaded)throw l}if(a){const l=K(t,r,s);if(null==l)throw new o("scenelayer:features-not-loaded","Tried to query attributes for unloaded features");const c=e.parsedUrl.path;return(await Promise.all(l.map((t=>G(c,a,t.node,t.indices,n,e.apiKey,e.customParameters,i).then((e=>{for(let r=0;r<t.graphics.length;r++){const o=t.graphics[r],n=e[r];if(o.attributes)for(const e in o.attributes)e in n||(n[e]=o.attributes[e]);o.attributes=n}return t.graphics})))))).flat()}throw new o("scenelayer:no-attribute-source","This scene layer does not have a source for attributes available")}function K(e,t,r){const o=new Map,n=[],s=r();for(const i of e){const e=i.attributes[t];for(let t=0;t<s.length;t++){const r=s[t],a=r.featureIds.indexOf(e);if(a>=0){let e=o.get(r.node);e||(e={node:r.node,indices:[],graphics:[]},n.push(e),o.set(r.node,e)),e.indices.push(a),e.graphics.push(i);for(let r=t;r>0;r--)s[r]=s[r-1];s[0]=r;break}}}return n}async function P(e,t,r,o,n){t.sort(((e,t)=>e.attributes[r]-t.attributes[r]));const s=t.map((e=>e.attributes[r])),i=[],a=L(o,e.fields,{originalFields:i}),l=await B(e,s,a,n);for(let c=0;c<t.length;c++){const e=t[c],r=l[c],o={};if(e.attributes)for(const t in e.attributes)o[t]=e.attributes[t];for(let t=0;t<i.length;t++)o[i[t]]=r[a[t]];e.attributes=o}return t}function B(e,t,n,s){const i=e.capabilities.query.maxRecordCount;if(null!=i&&t.length>i){const o=r(t,i);return Promise.all(o.map((t=>B(e,t,n,s)))).then((e=>e.flat()))}const a=new b({objectIds:t,outFields:n,orderByFields:[e.objectIdField]});return e.queryFeatures(a,s).then((e=>{if(e&&e.features&&e.features.length===t.length)return e.features.map((e=>e.attributes));throw new o("scenelayer:feature-not-in-associated-layer","Feature not found in associated feature layer")}))}function G(e,t,r,o,n,s,i,a){return V(e,t,r.resources.attributes,o,n,s,i,a)}async function V(t,r,o,n,s,i,a,l){const c=[];for(const e of r)if(e&&s.includes(e.name)){const r=`${t}/nodes/${o}/attributes/${e.key}/0`;c.push({url:r,storageInfo:e})}const u=await Promise.allSettled(c.map((t=>e(t.url,{responseType:"array-buffer",query:{...a,token:i},signal:l?.signal}).then((e=>w(t.storageInfo,e.data)))))),f=[];for(const e of n){const t={};for(let r=0;r<u.length;r++){const o=u[r];if("fulfilled"===o.status){const n=o.value;t[c[r].storageInfo.name]=Q(n,e)}}f.push(t)}return f}!function(e){e[e.OUTSIDE=0]="OUTSIDE",e[e.INTERSECTS_CENTER_OUTSIDE=1]="INTERSECTS_CENTER_OUTSIDE",e[e.INTERSECTS_CENTER_INSIDE=2]="INTERSECTS_CENTER_INSIDE",e[e.INSIDE=3]="INSIDE"}(q||(q={}));const $=-32768,z=-(2**31);function Q(e,t){if(!e)return null;const r=e[t];if(n(e))return r===$?null:r;if(s(e))return r===z?null:r;return r!=r?null:r}function Z(e){const t=e.store,r=t.indexCRS||t.geographicCRS,n=void 0===r?t.indexWKT:void 0;if(n){if(!e.spatialReference)throw new o("layerview:no-store-spatial-reference-wkt-index-and-no-layer-spatial-reference","Found indexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new o("layerview:store-spatial-reference-wkt-index-incompatible","The indexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const s=r?new C(U(r)):e.spatialReference;return s.equals(e.spatialReference)?e.spatialReference:s}function H(e){const t=e.store,r=t.vertexCRS||t.projectedCRS,n=void 0===r?t.vertexWKT:void 0;if(n){if(!e.spatialReference)throw new o("layerview:no-store-spatial-reference-wkt-vertex-and-no-layer-spatial-reference","Found vertexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new o("layerview:store-spatial-reference-wkt-vertex-incompatible","The vertexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const s=r?new C(U(r)):e.spatialReference;return s.equals(e.spatialReference)?e.spatialReference:s}function J(e,t,r){if(!p(e,t))throw M("scene layer",e?.wkid,t?.wkid);if("local"===r&&!Y(e,t))throw M("scene layer",e?.wkid,t?.wkid)}function X(e,t,r){if(e.serviceUpdateTimeStamp?.lastUpdate!==t.serviceUpdateTimeStamp?.lastUpdate||!r.isEmpty||e.associatedLayer?.url!==t.associatedLayer?.url)throw new o("layerview:recycle-failed")}function Y(e,t){return e.equals(t)||e.isWGS84&&t.isWebMercator||e.isWebMercator&&t.isWGS84}function ee(e,t,r){const o=Z(e),n=H(e);J(o,t,r),J(n,t,r)}function te(e){return(null==e.geometryType||"triangles"===e.geometryType)&&((null==e.topology||"PerAttributeArray"===e.topology)&&null!=e.vertexAttributes?.position)}function re(e){if(null==e.store?.defaultGeometrySchema||!te(e.store.defaultGeometrySchema))throw new o("scenelayer:unsupported-geometry-schema","The geometry schema of this scene layer is not supported.",{url:e.parsedUrl.path})}function oe(e,t){ee(e,t.spatialReference,t.viewingMode)}function ne(e){return null!=e.geometryType&&"points"===e.geometryType&&((null==e.topology||"PerAttributeArray"===e.topology)&&((null==e.encoding||""===e.encoding||"lepcc-xyz"===e.encoding)&&null!=e.vertexAttributes?.position))}function se(e){if(null==e.store?.defaultGeometrySchema||!ne(e.store.defaultGeometrySchema))throw new o("pointcloud:unsupported-geometry-schema","The geometry schema of this point cloud scene layer is not supported.",{})}function ie(e,t){J(e.spatialReference,t.spatialReference,t.viewingMode)}function ae(e){return"simple"===e.type||"class-breaks"===e.type||"unique-value"===e.type}function le(e){return"mesh-3d"===e.type}function ce(e){if(null==e||!ae(e))return!0;if(("unique-value"===e.type||"class-breaks"===e.type)&&null==e.defaultSymbol)return!0;const t=e.symbols;if(0===t.length)return!0;for(const r of t){if(!le(r)||0===r.symbolLayers.length)return!0;for(const e of r.symbolLayers.items)if("fill"!==e.type||null==e.material?.color||"replace"!==e.material.colorMixMode)return!0}return!1}const ue=T({color:[0,0,0,0],opacity:0});class fe{constructor(){this.edgeMaterial=null,this.material=null,this.castShadows=!0}}function pe(e){const t=new fe;let r=!1,o=!1;for(const n of e.symbolLayers.items)if("fill"===n.type&&n.enabled){const e=n.material,s=n.edges;if(null!=e&&!r){const o=e.color,s=R(e.colorMixMode);t.material=null!=o?{color:[o.r/255,o.g/255,o.b/255],alpha:o.a,colorMixMode:s}:{color:[1,1,1],alpha:1,colorMixMode:x.Multiply},t.castShadows=n.castShadows,r=!0}null==s||o||(t.edgeMaterial=E(s,{}),o=!0)}return t.material||(t.material={color:[1,1,1],alpha:1,colorMixMode:x.Multiply}),t}function me(e,t){return(0|e)+(0|t)|0}function de(e,t,r,o,n,s,a){if(!s||0===s.length||null==t||!e.serviceMbsInIndexSR)return null;const f=I(e.serviceMbsInIndexSR,n,"none",r,t);i(Ee,f);let p=null;const d=()=>{if(!p)if(p=ge,y(be),null!=e.serviceObbInIndexSR){e.serviceObbInIndexSR.transform(we,r,t,n,a),we.getCorners(p);for(const e of p)c(e,e,Ee),h(be,e)}else{const o=e.serviceMbsInIndexSR;if(!o)return;const s=o[3];m(S(o),r,Ie,t),c(Ie,Ie,Ee),Ie[2]+=n;for(let e=0;e<8;++e){const t=1&e?s:-s,r=2&e?s:-s,o=4&e?s:-s,n=p[e];u(n,[Ie[0]+t,Ie[1]+r,Ie[2]+o]),h(be,n)}}};let b=1/0,w=-1/0;const T=e=>{if("replace"!==e.type)return;const r=e.geometry;if(!r?.hasZ)return;y(Se);const n=r.spatialReference||o,s=r.rings.reduce(((e,r)=>r.reduce(((e,r)=>(l(Ie,r[0],r[1],r[2]),m(Ie,n,Ie,t),c(Ie,Ie,Ee),h(Se,Ie),Math.min(Ie[2],e))),e)),1/0);d(),g(be,Se)&&(b=Math.min(b,s),w=Math.max(w,s))};if(s.forEach((e=>T(e))),b===1/0)return null;const E=(e,t,r)=>{c(Ie,r,f),e[t]=Ie[0],e[t+1]=Ie[1],e[t+2]=Ie[2],t+=24,r[2]=b,c(Ie,r,f),e[t]=Ie[0],e[t+1]=Ie[1],e[t+2]=Ie[2],t+=24,r[2]=w,c(Ie,r,f),e[t]=Ie[0],e[t+1]=Ie[1],e[t+2]=Ie[2]};for(let i=0;i<8;++i)E(Te.data,3*i,p[i]);return j(Te)}function ye(e){return e[3]>=0}function he(e){null!=e&&(e[3]=-1)}const ge=[f(),f(),f(),f(),f(),f(),f(),f()],Se=d(),be=d(),we=new v,Ie=f(),Te={data:new Array(72),size:3,exclusive:!0,stride:3},Ee=a();export{q as MbsIntersectResult,fe as SymbolInfo,me as addWraparound,ie as checkPointCloudLayerCompatibleWithView,se as checkPointCloudLayerValid,X as checkRecyclable,oe as checkSceneLayerCompatibleWithView,re as checkSceneLayerValid,J as checkSpatialReference,ee as checkSpatialReferences,de as computeVisibilityObb,k as containsDraco,U as extractWkid,D as filterInPlace,L as findFieldsCaseInsensitive,N as findIntersectingNodes,Q as getCachedAttributeValue,_ as getClipRect,Z as getIndexCrs,pe as getSymbolInfo,H as getVertexCrs,F as intersectBoundingRectWithMbs,he as invalidateMbs,Y as isSupportedLocalModeProjection,ye as isValidMbs,W as objectIdFilter,V as queryAttributesFromCachedAttributesId,ce as rendererNeedsTextures,ue as transparentEdgeMaterial,A as whenGraphicAttributes};
5
+ import"../../../../geometry.js";import e from"../../../../request.js";import{binaryIndexOf as t,splitIntoChunks as r}from"../../../../core/arrayUtils.js";import o from"../../../../core/Error.js";import has from"../../../../core/has.js";import{isInt16Array as n,isInt32Array as s}from"../../../../core/typedArrayUtil.js";import{invert as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as l,t as c,c as u}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as p}from"../../../../geometry/projection.js";import{projectVectorToVector as m}from"../../../../geometry/projection/projectVectorToVector.js";import{create as d,empty as y,expandPointInPlace as h,intersects as g}from"../../../../geometry/support/aaBoundingRect.js";import{a as S}from"../../../../chunks/sphere.js";import b from"../../../../rest/support/Query.js";import{readBinaryAttribute as w}from"./I3SBinaryReader.js";import{computeGlobalTransformation as I}from"./I3SProjectionUtil.js";import{createSolidEdgeMaterial as T,createMaterialFromEdges as E}from"../support/edgeUtils.js";import{parseColorMixMode as R,ColorMixModeEnum as x}from"../support/symbolColorUtils.js";import{Obb as v,compute as j}from"../../support/orientedBoundingBox.js";import{spatialReferenceIncompatibleError as M}from"../../../support/layerViewUtils.js";import C from"../../../../geometry/SpatialReference.js";function U(e){return e?parseInt(e.slice(e.lastIndexOf("/")+1),10):void 0}function k(e){if(has("disable-feature:i3s-draco")||!e)return!1;for(const t of e)for(const e of t.geometryBuffers)if("draco"===e.compressedAttributes?.encoding)return!0;return!1}function N(e,t,r,o){r.traverse(t,(t=>{const r=t.serviceMbsInIndexSR;return(null!=r&&F(e,r))!==q.OUTSIDE&&(o(t),!0)}))}function D(e,t,r){let o=0,n=0;for(let s=0;s<t.length&&o<e.length;s++)e[o]===t[s]&&(r(s)&&(e[n]=e[o],n++),o++);e.length=n}function W(e,r,o){let n=0,s=0;for(;n<o.length;){t(e,o[n])>=0===r&&(o[s]=o[n],s++),n++}o.length=s}function _(e,t){if(0===t.rotationScale[1]&&0===t.rotationScale[2]&&0===t.rotationScale[3]&&0===t.rotationScale[5]&&0===t.rotationScale[6]&&0===t.rotationScale[7])return O[0]=(e[0]-t.position[0])/t.rotationScale[0],O[1]=(e[1]-t.position[1])/t.rotationScale[4],O[2]=(e[2]-t.position[0])/t.rotationScale[0],O[3]=(e[3]-t.position[1])/t.rotationScale[4],O}const O=d();var q;function F(e,t){const r=t[0],o=t[1],n=t[3],s=e[0]-r,i=r-e[2],a=e[1]-o,l=o-e[3],c=Math.max(s,i,0),u=Math.max(a,l,0),f=c*c+u*u;if(f>n*n)return q.OUTSIDE;if(f>0)return q.INTERSECTS_CENTER_OUTSIDE;return-Math.max(s,i,a,l)>n?q.INSIDE:q.INTERSECTS_CENTER_INSIDE}function L(e,t,r){const o=[],n=r?.missingFields,s=r?.originalFields;for(const i of e){const e=i.toLowerCase();let r=!1;for(const n of t)if(e===n.name.toLowerCase()){o.push(n.name),r=!0,s&&s.push(i);break}!r&&n&&n.push(i)}return o}async function A(e,t,r,n,s,i){if(0===t.length)return[];const a=e.attributeStorageInfo;if(null!=e.associatedLayer)try{return await P(e.associatedLayer,t,r,n,i)}catch(l){if(e.associatedLayer.loaded)throw l}if(a){const l=K(t,r,s);if(null==l)throw new o("scenelayer:features-not-loaded","Tried to query attributes for unloaded features");const c=e.parsedUrl.path;return(await Promise.all(l.map((t=>G(c,a,t.node,t.indices,n,e.apiKey,e.customParameters,i).then((e=>{for(let r=0;r<t.graphics.length;r++){const o=t.graphics[r],n=e[r];if(o.attributes)for(const e in o.attributes)e in n||(n[e]=o.attributes[e]);o.attributes=n}return t.graphics})))))).flat()}throw new o("scenelayer:no-attribute-source","This scene layer does not have a source for attributes available")}function K(e,t,r){const o=new Map,n=[],s=r();for(const i of e){const e=i.attributes[t];for(let t=0;t<s.length;t++){const r=s[t],a=r.featureIds.indexOf(e);if(a>=0){let e=o.get(r.node);e||(e={node:r.node,indices:[],graphics:[]},n.push(e),o.set(r.node,e)),e.indices.push(a),e.graphics.push(i);for(let r=t;r>0;r--)s[r]=s[r-1];s[0]=r;break}}}return n}async function P(e,t,r,o,n){t.sort(((e,t)=>e.attributes[r]-t.attributes[r]));const s=t.map((e=>e.attributes[r])),i=[],a=L(o,e.fields,{originalFields:i}),l=await B(e,s,a,n);for(let c=0;c<t.length;c++){const e=t[c],r=l[c],o={};if(e.attributes)for(const t in e.attributes)o[t]=e.attributes[t];for(let t=0;t<i.length;t++)o[i[t]]=r[a[t]];e.attributes=o}return t}function B(e,t,n,s){const i=e.capabilities.query.maxRecordCount;if(null!=i&&t.length>i){const o=r(t,i);return Promise.all(o.map((t=>B(e,t,n,s)))).then((e=>e.flat()))}const a=new b({objectIds:t,outFields:n,orderByFields:[e.objectIdField]});return e.queryFeatures(a,s).then((e=>{if(e&&e.features&&e.features.length===t.length)return e.features.map((e=>e.attributes));throw new o("scenelayer:feature-not-in-associated-layer","Feature not found in associated feature layer")}))}function G(e,t,r,o,n,s,i,a){return V(e,t,r.resources.attributes,o,n,s,i,a)}async function V(t,r,o,n,s,i,a,l){const c=[];for(const e of r)if(e&&s.includes(e.name)){const r=`${t}/nodes/${o}/attributes/${e.key}/0`;c.push({url:r,storageInfo:e})}const u=await Promise.allSettled(c.map((t=>e(t.url,{responseType:"array-buffer",query:{...a,token:i},signal:l?.signal}).then((e=>w(t.storageInfo,e.data)))))),f=[];for(const e of n){const t={};for(let r=0;r<u.length;r++){const o=u[r];if("fulfilled"===o.status){const n=o.value;t[c[r].storageInfo.name]=Q(n,e)}}f.push(t)}return f}!function(e){e[e.OUTSIDE=0]="OUTSIDE",e[e.INTERSECTS_CENTER_OUTSIDE=1]="INTERSECTS_CENTER_OUTSIDE",e[e.INTERSECTS_CENTER_INSIDE=2]="INTERSECTS_CENTER_INSIDE",e[e.INSIDE=3]="INSIDE"}(q||(q={}));const $=-32768,z=-2147483648;function Q(e,t){if(!e)return null;const r=e[t];if(n(e))return r===$?null:r;if(s(e))return r===z?null:r;return r!=r?null:r}function Z(e){const t=e.store,r=t.indexCRS||t.geographicCRS,n=void 0===r?t.indexWKT:void 0;if(n){if(!e.spatialReference)throw new o("layerview:no-store-spatial-reference-wkt-index-and-no-layer-spatial-reference","Found indexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new o("layerview:store-spatial-reference-wkt-index-incompatible","The indexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const s=r?new C(U(r)):e.spatialReference;return s.equals(e.spatialReference)?e.spatialReference:s}function H(e){const t=e.store,r=t.vertexCRS||t.projectedCRS,n=void 0===r?t.vertexWKT:void 0;if(n){if(!e.spatialReference)throw new o("layerview:no-store-spatial-reference-wkt-vertex-and-no-layer-spatial-reference","Found vertexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new o("layerview:store-spatial-reference-wkt-vertex-incompatible","The vertexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const s=r?new C(U(r)):e.spatialReference;return s.equals(e.spatialReference)?e.spatialReference:s}function J(e,t,r){if(!p(e,t))throw M("scene layer",e?.wkid,t?.wkid);if("local"===r&&!Y(e,t))throw M("scene layer",e?.wkid,t?.wkid)}function X(e,t,r){if(e.serviceUpdateTimeStamp?.lastUpdate!==t.serviceUpdateTimeStamp?.lastUpdate||!r.isEmpty||e.associatedLayer?.url!==t.associatedLayer?.url)throw new o("layerview:recycle-failed")}function Y(e,t){return e.equals(t)||e.isWGS84&&t.isWebMercator||e.isWebMercator&&t.isWGS84}function ee(e,t,r){const o=Z(e),n=H(e);J(o,t,r),J(n,t,r)}function te(e){return(null==e.geometryType||"triangles"===e.geometryType)&&((null==e.topology||"PerAttributeArray"===e.topology)&&null!=e.vertexAttributes?.position)}function re(e){if(null==e.store?.defaultGeometrySchema||!te(e.store.defaultGeometrySchema))throw new o("scenelayer:unsupported-geometry-schema","The geometry schema of this scene layer is not supported.",{url:e.parsedUrl.path})}function oe(e,t){ee(e,t.spatialReference,t.viewingMode)}function ne(e){return null!=e.geometryType&&"points"===e.geometryType&&((null==e.topology||"PerAttributeArray"===e.topology)&&((null==e.encoding||""===e.encoding||"lepcc-xyz"===e.encoding)&&null!=e.vertexAttributes?.position))}function se(e){if(null==e.store?.defaultGeometrySchema||!ne(e.store.defaultGeometrySchema))throw new o("pointcloud:unsupported-geometry-schema","The geometry schema of this point cloud scene layer is not supported.",{})}function ie(e,t){J(e.spatialReference,t.spatialReference,t.viewingMode)}function ae(e){return"simple"===e.type||"class-breaks"===e.type||"unique-value"===e.type}function le(e){return"mesh-3d"===e.type}function ce(e){if(null==e||!ae(e))return!0;if(("unique-value"===e.type||"class-breaks"===e.type)&&null==e.defaultSymbol)return!0;const t=e.symbols;if(0===t.length)return!0;for(const r of t){if(!le(r)||0===r.symbolLayers.length)return!0;for(const e of r.symbolLayers.items)if("fill"!==e.type||null==e.material?.color||"replace"!==e.material.colorMixMode)return!0}return!1}const ue=T({color:[0,0,0,0],opacity:0});class fe{constructor(){this.edgeMaterial=null,this.material=null,this.castShadows=!0}}function pe(e){const t=new fe;let r=!1,o=!1;for(const n of e.symbolLayers.items)if("fill"===n.type&&n.enabled){const e=n.material,s=n.edges;if(null!=e&&!r){const o=e.color,s=R(e.colorMixMode);t.material=null!=o?{color:[o.r/255,o.g/255,o.b/255],alpha:o.a,colorMixMode:s}:{color:[1,1,1],alpha:1,colorMixMode:x.Multiply},t.castShadows=n.castShadows,r=!0}null==s||o||(t.edgeMaterial=E(s,{}),o=!0)}return t.material||(t.material={color:[1,1,1],alpha:1,colorMixMode:x.Multiply}),t}function me(e,t){return(0|e)+(0|t)|0}function de(e,t,r,o,n,s,a){if(!s||0===s.length||null==t||!e.serviceMbsInIndexSR)return null;const f=I(e.serviceMbsInIndexSR,n,"none",r,t);i(Ee,f);let p=null;const d=()=>{if(!p)if(p=ge,y(be),null!=e.serviceObbInIndexSR){e.serviceObbInIndexSR.transform(we,r,t,n,a),we.getCorners(p);for(const e of p)c(e,e,Ee),h(be,e)}else{const o=e.serviceMbsInIndexSR;if(!o)return;const s=o[3];m(S(o),r,Ie,t),c(Ie,Ie,Ee),Ie[2]+=n;for(let e=0;e<8;++e){const t=1&e?s:-s,r=2&e?s:-s,o=4&e?s:-s,n=p[e];u(n,[Ie[0]+t,Ie[1]+r,Ie[2]+o]),h(be,n)}}};let b=1/0,w=-1/0;const T=e=>{if("replace"!==e.type)return;const r=e.geometry;if(!r?.hasZ)return;y(Se);const n=r.spatialReference||o,s=r.rings.reduce(((e,r)=>r.reduce(((e,r)=>(l(Ie,r[0],r[1],r[2]),m(Ie,n,Ie,t),c(Ie,Ie,Ee),h(Se,Ie),Math.min(Ie[2],e))),e)),1/0);d(),g(be,Se)&&(b=Math.min(b,s),w=Math.max(w,s))};if(s.forEach((e=>T(e))),b===1/0)return null;const E=(e,t,r)=>{c(Ie,r,f),e[t]=Ie[0],e[t+1]=Ie[1],e[t+2]=Ie[2],t+=24,r[2]=b,c(Ie,r,f),e[t]=Ie[0],e[t+1]=Ie[1],e[t+2]=Ie[2],t+=24,r[2]=w,c(Ie,r,f),e[t]=Ie[0],e[t+1]=Ie[1],e[t+2]=Ie[2]};for(let i=0;i<8;++i)E(Te.data,3*i,p[i]);return j(Te)}function ye(e){return e[3]>=0}function he(e){null!=e&&(e[3]=-1)}const ge=[f(),f(),f(),f(),f(),f(),f(),f()],Se=d(),be=d(),we=new v,Ie=f(),Te={data:new Array(72),size:3,exclusive:!0,stride:3},Ee=a();export{q as MbsIntersectResult,fe as SymbolInfo,me as addWraparound,ie as checkPointCloudLayerCompatibleWithView,se as checkPointCloudLayerValid,X as checkRecyclable,oe as checkSceneLayerCompatibleWithView,re as checkSceneLayerValid,J as checkSpatialReference,ee as checkSpatialReferences,de as computeVisibilityObb,k as containsDraco,U as extractWkid,D as filterInPlace,L as findFieldsCaseInsensitive,N as findIntersectingNodes,Q as getCachedAttributeValue,_ as getClipRect,Z as getIndexCrs,pe as getSymbolInfo,H as getVertexCrs,F as intersectBoundingRectWithMbs,he as invalidateMbs,Y as isSupportedLocalModeProjection,ye as isValidMbs,W as objectIdFilter,V as queryAttributesFromCachedAttributesId,ce as rendererNeedsTextures,ue as transparentEdgeMaterial,A as whenGraphicAttributes};