@arcgis/core 4.28.0-next.20230719 → 4.28.0-next.20230721

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 (334) hide show
  1. package/Color.js +1 -1
  2. package/analysis/AreaMeasurementAnalysis.js +1 -1
  3. package/arcade/arcadeCompiler.js +1 -1
  4. package/arcade/featureSetUtils.js +1 -1
  5. package/arcade/featureset/actions/Top.js +1 -1
  6. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  7. package/arcade/featureset/support/FeatureSet.js +1 -1
  8. package/arcade/featureset/support/FeatureSetIterator.js +1 -1
  9. package/arcade/functions/convertdirection.js +1 -1
  10. package/arcade/functions/featuresetbase.js +1 -1
  11. package/arcade/functions/geomasync.js +1 -1
  12. package/arcade/functions/geomsync.js +1 -1
  13. package/arcade/lib/comment-handler.js +1 -1
  14. package/arcade/lib/parser.js +1 -1
  15. package/arcade/lib/scanner.js +1 -1
  16. package/assets/esri/core/workers/RemoteClient.js +1 -1
  17. package/assets/esri/core/workers/chunks/{75c28da8d0b02d612d69.js → 040b3fc9c9c0736dd893.js} +1 -1
  18. package/assets/esri/core/workers/chunks/0652f6a8d5221e978033.js +1 -0
  19. package/assets/esri/core/workers/chunks/{e579ca7d4c1387e17305.js → 092fda62b6f62c2e4869.js} +2 -2
  20. package/assets/esri/core/workers/chunks/{57e0ad037188bd2997e7.js → 0af18a96cbd4e2d35436.js} +1 -1
  21. package/assets/esri/core/workers/chunks/0b5eeec0f66c87a46a0c.js +1 -0
  22. package/assets/esri/core/workers/chunks/{68e568b67b6fb34393db.js → 0cad2b991d0d0fd07846.js} +1 -1
  23. package/assets/esri/core/workers/chunks/0dccbc6c2559fdc0c2ad.js +1 -0
  24. package/assets/esri/core/workers/chunks/256a82f6f6e1405fbcc6.js +1 -0
  25. package/assets/esri/core/workers/chunks/{bb9213899049e1db90da.js → 2c57c9bd71637c5bed8a.js} +1 -1
  26. package/assets/esri/core/workers/chunks/2cdbabcbfe32286ec78d.js +1 -0
  27. package/assets/esri/core/workers/chunks/{2b1c83453a862e01954b.js → 2d9d80b2d0042a9c09fb.js} +1 -1
  28. package/assets/esri/core/workers/chunks/2f9aec2238ff6cb99e09.js +1 -0
  29. package/assets/esri/core/workers/chunks/{55705b1bbac91d7db0e7.js → 32d940b2c891bf6ff9a2.js} +1 -1
  30. package/assets/esri/core/workers/chunks/3a0349c79551a03c2d8e.js +1 -0
  31. package/assets/esri/core/workers/chunks/{7dbd3e6406fb3e3a1a8f.js → 3cf748c025f3936c1cb2.js} +1 -1
  32. package/assets/esri/core/workers/chunks/4481d1103363434f16da.js +1 -0
  33. package/assets/esri/core/workers/chunks/58e11ca7c6e27e0ece7e.js +1 -0
  34. package/assets/esri/core/workers/chunks/5ae325e6a795c72eac6c.js +1 -0
  35. package/assets/esri/core/workers/chunks/5e4dde2886a1027b4b96.js +1 -0
  36. package/assets/esri/core/workers/chunks/{357e0381b6d767585576.js → 675e16d99758e67e5f51.js} +1 -1
  37. package/assets/esri/core/workers/chunks/726bb661b9e6998572e7.js +1 -0
  38. package/assets/esri/core/workers/chunks/730eb7e5f617fdab4f10.js +1 -0
  39. package/assets/esri/core/workers/chunks/{5a2e6bed9431cf4f42b1.js → 740dc67038f554431f1b.js} +1 -1
  40. package/assets/esri/core/workers/chunks/7cab61c9e09580520990.js +1 -0
  41. package/assets/esri/core/workers/chunks/{09178454bda15bb7929a.js → 7fbdfd1527582c52f9b6.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{26546aa98a338051df66.js → 807742f38885fa90b4fe.js} +1 -1
  43. package/assets/esri/core/workers/chunks/82dfbc175b52c7a10475.js +1 -0
  44. package/assets/esri/core/workers/chunks/870a05451e074b58f19a.js +1 -0
  45. package/assets/esri/core/workers/chunks/88038ad401e5ec02f4d3.js +1 -0
  46. package/assets/esri/core/workers/chunks/88d63d1e56732d148f67.js +1 -0
  47. package/assets/esri/core/workers/chunks/8b72cd9340e8a44358ac.js +1 -0
  48. package/assets/esri/core/workers/chunks/8c5a8c1dfb086069bb06.js +1 -0
  49. package/assets/esri/core/workers/chunks/99a5a434e0bad48c7a5c.js +1 -0
  50. package/assets/esri/core/workers/chunks/9a5916c66dad91d01d5b.js +1 -0
  51. package/assets/esri/core/workers/chunks/9c133fd8c1fbd0295b86.js +1 -0
  52. package/assets/esri/core/workers/chunks/9cddb504079d396779ea.js +1 -0
  53. package/assets/esri/core/workers/chunks/a3a1d4f32e518e97d071.js +1 -0
  54. package/assets/esri/core/workers/chunks/{9548aa449fe3a300c015.js → a4fa40dc77e116c954ac.js} +1 -1
  55. package/assets/esri/core/workers/chunks/a54ec9929a7db879d5db.js +1 -0
  56. package/assets/esri/core/workers/chunks/afc5b84693757fda2bc8.js +1 -0
  57. package/assets/esri/core/workers/chunks/{591b5c277cfd3a4101a4.js → b08f2a4aa94087c6c367.js} +1 -1
  58. package/assets/esri/core/workers/chunks/c0e12f6a7bb2360e4c21.js +1 -0
  59. package/assets/esri/core/workers/chunks/c8e656cd470a17f538e9.js +1 -0
  60. package/assets/esri/core/workers/chunks/d0e203405f95e14b1399.js +1 -0
  61. package/assets/esri/core/workers/chunks/d61506497275bafba384.js +1 -0
  62. package/assets/esri/core/workers/chunks/{ec72f492f24e67e008ae.js → d8e58dc14d3495f0830c.js} +1 -1
  63. package/assets/esri/core/workers/chunks/db9a303ee0468d018def.js +1 -0
  64. package/assets/esri/core/workers/chunks/ddc393a012588f799f42.js +1 -0
  65. package/assets/esri/core/workers/chunks/de3baa85b1639c25458d.js +1 -0
  66. package/assets/esri/core/workers/chunks/e66cea26064ba8353af0.js +1 -0
  67. package/assets/esri/core/workers/chunks/ea478f2f4a19463e13fd.js +1 -0
  68. package/assets/esri/core/workers/chunks/eba197e45507f56f3ed0.js +1 -0
  69. package/assets/esri/core/workers/chunks/ebd006fcd568a7731115.js +1 -0
  70. package/assets/esri/core/workers/chunks/ef9a9a7d66d818720e20.js +1 -0
  71. package/assets/esri/core/workers/chunks/f3b458f55236566c940b.js +1 -0
  72. package/assets/esri/core/workers/chunks/fd0a91b9e0216cc269c3.js +1 -0
  73. package/assets/esri/core/workers/chunks/{a4fe220a912b1f428e49.js → fdd6403a8390d629392b.js} +1 -1
  74. package/assets/esri/themes/base/widgets/_Directions.scss +13 -7
  75. package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +108 -4
  76. package/assets/esri/themes/dark/main.css +1 -1
  77. package/assets/esri/themes/light/main.css +1 -1
  78. package/assets/esri/themes/light/view.css +1 -1
  79. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer.json +1 -1
  80. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_en.json +1 -1
  81. package/chunks/ComponentShader.glsl.js +1 -1
  82. package/chunks/LineSeries.js +1 -1
  83. package/chunks/Theme.js +1 -1
  84. package/chunks/array.js +1 -1
  85. package/chunks/chartUtilsAm5.js +1 -1
  86. package/core/Collection.js +1 -1
  87. package/core/accessorSupport/decorators/subclass.js +1 -1
  88. package/core/accessorSupport/ensureType.js +1 -1
  89. package/core/accessorSupport/get.js +1 -1
  90. package/core/accessorSupport/tracking.js +1 -1
  91. package/core/accessorSupport/utils.js +1 -1
  92. package/core/libs/rbush/PooledRBush.js +1 -1
  93. package/core/urlUtils.js +1 -1
  94. package/geometry/GeometryCursor.js +1 -1
  95. package/geometry/support/TileClipper.js +1 -1
  96. package/geometry/support/geodesicUtils.js +1 -1
  97. package/interfaces.d.ts +9 -3
  98. package/layers/BuildingSceneLayer.js +1 -1
  99. package/layers/IntegratedMeshLayer.js +1 -1
  100. package/layers/LinkChartLayer.js +1 -1
  101. package/layers/PointCloudLayer.js +1 -1
  102. package/layers/SceneLayer.js +1 -1
  103. package/layers/VectorTileLayer.js +1 -1
  104. package/layers/VoxelLayer.js +1 -1
  105. package/layers/VoxelWasmPerSceneView.js +1 -1
  106. package/layers/WCSLayer.js +1 -1
  107. package/layers/effects/EffectView.js +1 -1
  108. package/layers/graphics/sources/geojson/geojson.js +1 -1
  109. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  110. package/layers/mixins/ArcGISCachedService.js +1 -1
  111. package/layers/orientedImagery/core/ExposurePoint.js +1 -1
  112. package/layers/orientedImagery/core/bestImageUtils.js +1 -1
  113. package/layers/orientedImagery/queries.js +1 -1
  114. package/layers/save/featureLayerUtils.js +1 -1
  115. package/layers/support/ElevationQuery.js +1 -1
  116. package/layers/support/MultidimensionalSubset.js +1 -1
  117. package/layers/support/Sublayer.js +1 -1
  118. package/layers/support/TileInfo.js +1 -1
  119. package/layers/support/TileInfoTilemapCache.js +1 -1
  120. package/layers/support/TilemapCache.js +1 -1
  121. package/layers/support/rasterDatasets/multidimensionalUtils.js +1 -1
  122. package/layers/support/rasterDatasets/pamParser.js +1 -1
  123. package/layers/support/rasterDatasets/wcsCoverageParser.js +1 -1
  124. package/layers/support/rasterFormats/Raw.js +1 -1
  125. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  126. package/layers/support/rasterFunctions/ExtractBandFunction.js +1 -1
  127. package/layers/support/rasterFunctions/colormaps.js +1 -1
  128. package/layers/support/rasterFunctions/pixelUtils.js +1 -1
  129. package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
  130. package/layers/video/VideoController.js +1 -1
  131. package/layers/voxel/VoxelDimension.js +1 -1
  132. package/layers/voxel/VoxelTransferFunctionStyle.js +1 -1
  133. package/layers/voxel/VoxelVolume.js +1 -1
  134. package/package.json +1 -1
  135. package/renderers/support/RasterSymbolizer.js +1 -1
  136. package/renderers/support/colorRampUtils.js +1 -1
  137. package/renderers/visualVariables/support/visualVariableUtils.js +1 -1
  138. package/rest/query/operations/pbfDehydratedFeatureSet.js +1 -1
  139. package/rest/query/operations/pbfJSONFeatureSet.js +1 -1
  140. package/rest/support/generateRendererUtils.js +1 -1
  141. package/smartMapping/raster/renderers/classBreaks.js +1 -1
  142. package/smartMapping/renderers/color.js +1 -1
  143. package/smartMapping/renderers/support/utils.js +1 -1
  144. package/smartMapping/renderers/type.js +1 -1
  145. package/smartMapping/renderers/univariateColorSize.js +1 -1
  146. package/smartMapping/support/adapters/support/utils.js +1 -1
  147. package/statistics/utils.js +1 -1
  148. package/support/elevationInfoUtils.js +1 -1
  149. package/support/revision.js +1 -1
  150. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  151. package/symbols/cim/GeometryWalker.js +1 -1
  152. package/symbols/cim/cimAnalyzer.js +1 -1
  153. package/symbols/cim/effects/EffectArrow.js +1 -1
  154. package/symbols/cim/effects/EffectControlMeasureLine.js +1 -1
  155. package/symbols/support/symbolUtils.js +1 -1
  156. package/views/2d/constraints/ZoomConstraint.js +1 -1
  157. package/views/2d/engine/flow/dataUtils.js +1 -1
  158. package/views/2d/engine/flow/utils.js +1 -1
  159. package/views/2d/engine/vectorTiles/VectorTile.js +1 -1
  160. package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
  161. package/views/2d/engine/vectorTiles/expression/expression.js +1 -1
  162. package/views/2d/engine/vectorTiles/style/VectorTileSource.js +1 -1
  163. package/views/2d/engine/vectorTiles/tileInfoUtils.js +1 -1
  164. package/views/2d/engine/webgl/TurboLine.js +1 -1
  165. package/views/2d/engine/webgl/mesh/MeshData.js +1 -1
  166. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  167. package/views/2d/interactive/editingTools/ControlPointsTransformTool.js +1 -1
  168. package/views/2d/interactive/editingTools/draw/DrawGraphicTool2D.js +1 -1
  169. package/views/2d/layers/BaseLayerView2D.js +1 -1
  170. package/views/2d/layers/BaseLayerViewGL2D.js +1 -1
  171. package/views/2d/layers/BitmapTileLayerView2D.js +1 -1
  172. package/views/2d/layers/MediaLayerView2D.js +1 -1
  173. package/views/2d/layers/TileLayerView2D.js +1 -1
  174. package/views/2d/layers/VectorTileLayerView2D.js +1 -1
  175. package/views/2d/layers/WMTSLayerView2D.js +1 -1
  176. package/views/2d/layers/features/support/rendererUtils.js +1 -1
  177. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  178. package/views/2d/layers/support/vectorTileDebugUtils.js +5 -0
  179. package/views/2d/tiling/TileInfoView.js +1 -1
  180. package/views/2d/tiling/TileInfoViewPOT.js +1 -1
  181. package/views/2d/tiling/TileQueue.js +1 -1
  182. package/views/2d/tiling.js +1 -1
  183. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  184. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  185. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  186. package/views/3d/externalRenderers/ExternalRendererStore.js +1 -1
  187. package/views/3d/interactive/editingTools/moveGraphic/GraphicMoveTool.js +1 -1
  188. package/views/3d/interactive/visualElements/LaserlineVisualElement.js +1 -1
  189. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  190. package/views/3d/layers/TiledLayerView3D.js +1 -1
  191. package/views/3d/layers/VectorTileLayerView3D.js +1 -1
  192. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  193. package/views/3d/layers/graphics/Labeler.js +1 -1
  194. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  195. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  196. package/views/3d/layers/support/featureReference.js +1 -1
  197. package/views/3d/support/LaserLineRenderer.js +1 -1
  198. package/views/3d/terrain/Overlay.js +1 -1
  199. package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
  200. package/views/3d/terrain/OverlayManager.js +1 -1
  201. package/views/3d/terrain/OverlayRenderTarget.js +1 -1
  202. package/views/3d/terrain/OverlayRenderer.js +1 -1
  203. package/views/3d/terrain/TerrainRenderer.js +1 -1
  204. package/views/3d/terrain/TerrainSurface.js +1 -1
  205. package/views/3d/terrain/TileCompositor.js +1 -1
  206. package/views/3d/terrain/TileRenderer.js +1 -1
  207. package/views/3d/terrain/TilingScheme.js +1 -1
  208. package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
  209. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  210. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js +1 -1
  211. package/views/3d/webgl-engine/core/shaderModules/interfaces.js +1 -1
  212. package/views/3d/webgl-engine/effects/RenderPlugin.js +5 -0
  213. package/views/3d/webgl-engine/effects/RenderPluginManager.js +5 -0
  214. package/views/3d/webgl-engine/effects/ScreenSpaceGeometry.js +5 -0
  215. package/views/3d/webgl-engine/effects/SmaaRenderPass.js +5 -0
  216. package/views/3d/webgl-engine/lib/CompositingHelper.js +1 -1
  217. package/views/3d/webgl-engine/lib/GLMaterials.js +1 -1
  218. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  219. package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
  220. package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
  221. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  222. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  223. package/views/3d/webgl-engine/lib/SSAOHelper.js +1 -1
  224. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  225. package/views/3d/webgl-engine/lib/WebGLLayer.js +1 -1
  226. package/views/3d/webgl-engine/lib/lodRendering/LodComponentData.js +1 -1
  227. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  228. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  229. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  230. package/views/3d/webgl-engine/parts/requireUtils.js +1 -1
  231. package/views/3d/webgl-engine/statistics/RendererPerformanceInfo.js +1 -1
  232. package/views/LayerViewManager.js +1 -1
  233. package/views/MapView.js +1 -1
  234. package/views/SceneView.js +1 -1
  235. package/views/animation/pointToPoint/Path.js +1 -1
  236. package/views/draw/DrawOperation.js +1 -1
  237. package/views/draw/support/Reshape.js +1 -1
  238. package/views/draw/support/createUtils.js +1 -1
  239. package/views/interactive/SegmentLabels.js +1 -1
  240. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  241. package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
  242. package/views/interactive/editGeometry/operations/UndoGroup.js +1 -1
  243. package/views/layers/GroupLayerView.js +1 -1
  244. package/views/layers/ImageryTileLayerView.js +1 -1
  245. package/views/webgl/ProgramCache.js +1 -1
  246. package/webscene/spec-certification/api.js +1 -1
  247. package/webscene/spec-certification/spec.js +1 -1
  248. package/webscene/spec-certification/utils.js +1 -1
  249. package/widgets/BuildingExplorer/BuildingNumericFilterViewModel.js +1 -1
  250. package/widgets/BuildingExplorer/BuildingPhase.js +1 -1
  251. package/widgets/BuildingExplorer/support/validation.js +1 -1
  252. package/widgets/Directions/support/resources.js +1 -1
  253. package/widgets/Directions.js +1 -1
  254. package/widgets/Editor/EditorViewModel.js +1 -1
  255. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  256. package/widgets/Editor/Workflow.js +1 -1
  257. package/widgets/Editor.js +1 -1
  258. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  259. package/widgets/FeatureForm/FieldInput.js +1 -1
  260. package/widgets/FeatureForm/FormExpressionsManager.js +1 -1
  261. package/widgets/FeatureForm.js +1 -1
  262. package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
  263. package/widgets/FeatureTemplates.js +1 -1
  264. package/widgets/Features.js +1 -1
  265. package/widgets/Histogram/HistogramViewModel.js +1 -1
  266. package/widgets/HistogramRangeSlider/HistogramRangeSliderViewModel.js +1 -1
  267. package/widgets/Legend/styles/Card.js +1 -1
  268. package/widgets/Legend/styles/support/univariateUtils.js +1 -1
  269. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  270. package/widgets/Legend/support/colorRampUtils.js +1 -1
  271. package/widgets/Legend/support/sizeRampUtils.js +1 -1
  272. package/widgets/Legend/support/utils.js +1 -1
  273. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  274. package/widgets/OrientedImageryViewer/arcUtils.js +5 -0
  275. package/widgets/OrientedImageryViewer/constants.js +5 -0
  276. package/widgets/OrientedImageryViewer/utils.js +5 -0
  277. package/widgets/OrientedImageryViewer.js +1 -1
  278. package/widgets/Popup/PopupViewModel.js +1 -1
  279. package/widgets/Popup.js +1 -1
  280. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
  281. package/widgets/ScaleRangeSlider/ScaleRanges.js +1 -1
  282. package/widgets/ValuePicker/ValuePickerSlider.js +1 -1
  283. package/widgets/smartMapping/ClassedSizeSlider.js +1 -1
  284. package/widgets/smartMapping/ColorSizeSlider.js +1 -1
  285. package/widgets/smartMapping/HeatmapSlider/HeatmapSliderViewModel.js +1 -1
  286. package/widgets/smartMapping/SizeSlider.js +1 -1
  287. package/widgets/smartMapping/SmartMappingPrimaryHandleSliderViewModel.js +1 -1
  288. package/widgets/smartMapping/SmartMappingSliderViewModel.js +1 -1
  289. package/widgets/support/ColorPicker.js +1 -1
  290. package/assets/esri/core/workers/chunks/07bb40162d97d098bc19.js +0 -1
  291. package/assets/esri/core/workers/chunks/0a18317566c1fcb68422.js +0 -1
  292. package/assets/esri/core/workers/chunks/0de65e03db8c611af9fb.js +0 -1
  293. package/assets/esri/core/workers/chunks/1a60d23a92bcf91dbb22.js +0 -1
  294. package/assets/esri/core/workers/chunks/205a0b34b698d5329854.js +0 -1
  295. package/assets/esri/core/workers/chunks/2158a6ec165503ec4711.js +0 -1
  296. package/assets/esri/core/workers/chunks/25211d5904ee9d5f4a9d.js +0 -1
  297. package/assets/esri/core/workers/chunks/26b12d1ea713c1e07701.js +0 -1
  298. package/assets/esri/core/workers/chunks/2bfa7ee324c32a56b0d3.js +0 -1
  299. package/assets/esri/core/workers/chunks/370a992bd308bd806f48.js +0 -1
  300. package/assets/esri/core/workers/chunks/3892650ecc61322f6f7f.js +0 -1
  301. package/assets/esri/core/workers/chunks/38d168e9a29c40de179d.js +0 -1
  302. package/assets/esri/core/workers/chunks/4bf1c6c7e0a3051dc797.js +0 -1
  303. package/assets/esri/core/workers/chunks/524156c3f5383c2dd0e3.js +0 -1
  304. package/assets/esri/core/workers/chunks/59666ecb7c2c1f5a13b2.js +0 -1
  305. package/assets/esri/core/workers/chunks/5ae98195bdfd7dc0c44e.js +0 -1
  306. package/assets/esri/core/workers/chunks/5c005c9514354c77ec27.js +0 -1
  307. package/assets/esri/core/workers/chunks/5d46fd68878c973bcfab.js +0 -1
  308. package/assets/esri/core/workers/chunks/5dd23092c8a8a5ccd5d0.js +0 -1
  309. package/assets/esri/core/workers/chunks/620ec5c75561183d3d73.js +0 -1
  310. package/assets/esri/core/workers/chunks/68512670816f59c0e6a5.js +0 -1
  311. package/assets/esri/core/workers/chunks/6c7374ebc18b46b3480a.js +0 -1
  312. package/assets/esri/core/workers/chunks/75ba2af92da232067adb.js +0 -1
  313. package/assets/esri/core/workers/chunks/7c1f0598a016516dcec3.js +0 -1
  314. package/assets/esri/core/workers/chunks/8dcec8d1b670d2b7ea2b.js +0 -1
  315. package/assets/esri/core/workers/chunks/8e07dfb6fc2673b640cb.js +0 -1
  316. package/assets/esri/core/workers/chunks/9008dde941cb3973de20.js +0 -1
  317. package/assets/esri/core/workers/chunks/9050b167355588b7003d.js +0 -1
  318. package/assets/esri/core/workers/chunks/9230d68799f0b0b9ef36.js +0 -1
  319. package/assets/esri/core/workers/chunks/94d124453e90a5ab1706.js +0 -1
  320. package/assets/esri/core/workers/chunks/9ca312af9c056b1efe40.js +0 -1
  321. package/assets/esri/core/workers/chunks/b0a57718a0765d1c8df0.js +0 -1
  322. package/assets/esri/core/workers/chunks/b431b81a7bf45dd527da.js +0 -1
  323. package/assets/esri/core/workers/chunks/bda311ad48efdb265939.js +0 -1
  324. package/assets/esri/core/workers/chunks/da547c3cabe4a89c3ce6.js +0 -1
  325. package/assets/esri/core/workers/chunks/dd295fa57b45b7ec4ec5.js +0 -1
  326. package/assets/esri/core/workers/chunks/eb92aa372e706ce5a5eb.js +0 -1
  327. package/assets/esri/core/workers/chunks/f553b464e969d45bf451.js +0 -1
  328. package/assets/esri/core/workers/chunks/f5865294983eb160de8c.js +0 -1
  329. package/assets/esri/core/workers/chunks/fdb7b1fbdb6fe091ad83.js +0 -1
  330. package/assets/esri/core/workers/chunks/fe8544bf3bbbacd74b8b.js +0 -1
  331. package/views/2d/tiling/PagedTileQueue.js +0 -5
  332. package/views/3d/webgl-engine/lib/RenderPluginManager.js +0 -5
  333. package/views/3d/webgl-engine/lib/SmaaRenderPass.js +0 -5
  334. /package/views/3d/webgl-engine/{lib → effects}/SmaaRenderPassData.js +0 -0
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../Color.js";import"../../../../geometry.js";import e from"../../../../analysis/SlicePlane.js";import"../../../../core/has.js";import n from"../../../../core/Logger.js";import{rad2deg as o,deg2rad as i}from"../../../../core/mathUtils.js";import{castRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{o as s,b as a,k as c,m as l,r as u,i as d,w as m,F as p}from"../../../../chunks/mat4.js";import{c as f}from"../../../../chunks/mat4f64.js";import{r as g}from"../../../../chunks/quat.js";import{g as b,c as T,e as h,f as w,n as A,a as O,l as R,b as I,s as E,p as j,A as C}from"../../../../chunks/vec3.js";import{a as L,c as U,f as v}from"../../../../chunks/vec3f64.js";import{tryProjectWithZConversion as _}from"../../../../geometry/projection.js";import{Axis as M}from"../../../../geometry/support/Axis.js";import{r as P,f as N,i as V,a as y,n as S,u as G}from"../../../../chunks/boundedPlane.js";import{fromVectorsAndPoint as k,fromPositionAndNormal as D}from"../../../../geometry/support/plane.js";import{create as H}from"../../../../geometry/support/ray.js";import{angleAroundAxis as B}from"../../../../geometry/support/vector.js";import{sv3d as x,sm4d as F,sq4d as X}from"../../../../geometry/support/vectorStacks.js";import{CalloutStyle as Y,PlaneStyle as Z}from"./settings.js";import{VERTICAL_DOT_THRESHOLD as W,SMALL_ANGLE_DOT_THRESHOLD as q,PLANE_MIN_BASIS_SCREEN_LEN2 as z,INITIAL_PLANE_HALF_SIZE_VIEW_PROPORTION as $,SHIFT_RESTART_OFFSET_DISTANCE as J,RESIZE_HANDLE_EDGE_PADDING_FRAC as K,SHIFT_RESTART_TIP_RADIUS as Q,PLANE_OUTLINE_WIDTH as tt,RESIZE_HANDLE_CORNER_INPUT_RADIUS as et,RESIZE_HANDLE_EDGE_INPUT_RADIUS as nt,SHIFT_RESTART_TIP_LENGTH as ot,SHIFT_RESTART_ARROW_LENGTH as it,SHIFT_RESTART_ARROW_OUTLINE_WIDTH as rt,RESIZE_HANDLE_CORNER_WIDTH as st,RESIZE_HANDLE_EDGE_WIDTH as at,DISPLAY_FOCUS_MULTIPLIER as ct,SHIFT_RESTART_TUBE_RADIUS as lt,SHIFT_RESTART_TUBE_FOCUS_MULTIPLIER as ut,SHIFT_RESTART_TIP_FOCUS_MULTIPLIER as dt}from"./sliceToolConfig.js";import{applyProjectionAndElevationAlignment as mt}from"../support/projectionUtils.js";import{Manipulator3D as pt}from"../../interactive/Manipulator3D.js";import{calculateTranslateRotateFromBases as ft,createRotateManipulator as gt,worldScaledManipulatorSettings as bt}from"../../interactive/manipulatorUtils.js";import{RenderObject as Tt}from"../../interactive/RenderObject.js";import{LineVisualElement as ht}from"../../interactive/visualElements/LineVisualElement.js";import{SlicePlaneVisualElement as wt}from"../../interactive/visualElements/SlicePlaneVisualElement.js";import{RenderCoordsHelper as At}from"../../support/RenderCoordsHelper.js";import{fromRender as Ot}from"../../support/geometryUtils/ray.js";import{CullFaceOptions as Rt}from"../../webgl-engine/lib/basicInterfaces.js";import{createPolylineGeometry as It,createConeGeometry as Et,createPathExtrusionGeometry as jt}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as Ct}from"../../webgl-engine/lib/Material.js";import{ColorMaterial as Lt}from"../../webgl-engine/materials/ColorMaterial.js";import{NativeLineMaterial as Ut}from"../../webgl-engine/materials/NativeLineMaterial.js";import{RibbonLineMaterial as vt}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{ManipulatorStateCustomFlags as _t,ManipulatorStateFlags as Mt}from"../../../interactive/interfaces.js";import Pt from"../../../../geometry/Extent.js";function Nt(t,e,n,o,i,r,s,a){return Vt(e,s.worldUpAtPosition(t,x.get()),i,r,a.basis1,a.basis2),b(a.basis1,a.basis1,n),b(a.basis2,a.basis2,o),T(a.origin,t),k(a.basis2,a.basis1,a.origin,a.plane),a}function Vt(t,e,n,o,i,r){const s=h(t,e),a=x.get(),c=x.get();switch(o===ge.HORIZONTAL_OR_VERTICAL?Math.abs(s)>W?ge.HORIZONTAL:ge.VERTICAL:o){case ge.VERTICAL:{const o=Math.abs(s)<=q?t:n.viewUp;w(a,o,e),T(c,e);break}case ge.HORIZONTAL:w(a,n.viewUp,e),w(c,e,a);break;case ge.TILTED:{const o=Math.abs(s)<=q?e:n.viewUp;w(a,o,t),w(c,t,a);break}}const l=w(x.get(),a,c);h(l,n.viewForward)>0&&b(c,c,-1),A(i,a),A(r,c)}function yt(t,e,n){const o=e.worldUpAtPosition(t.origin,x.get()),i=t.basis1,r=ce(t,o),s=Math.round(r/he)*he;return P(t,s-r,i,n)}function St(t,e,n,o,i,r){const s=T(x.get(),i.origin);O(s,s,b(x.get(),i.basis1,t.direction[0]<0?1:-1)),O(s,s,b(x.get(),i.basis2,t.direction[1]<0?1:-1));const a=R(i.basis1),c=R(i.basis2),l=I(x.get(),n,s),u=I(x.get(),e,s);let d=0,m=0;if(Jt(t)){const e=$t(i),n=$t(r);d=a-.5*t.direction[0]*h(i.basis1,u)/a,m=c-.5*t.direction[1]*h(i.basis2,u)/c;const o=n/e;d*=o,m*=o}const p=d+.5*t.direction[0]*h(i.basis1,l)/a,f=m+.5*t.direction[1]*h(i.basis2,l)/c,g=b(x.get(),i.basis1,p/a),w=b(x.get(),i.basis2,f/c);(p<=0||qt(r.origin,g,o)<=z)&&T(g,r.basis1),(f<=0||qt(r.origin,w,o)<=z)&&T(w,r.basis2);const A=T(x.get(),s);return O(A,A,b(x.get(),g,t.direction[0]<0?-1:1)),O(A,A,b(x.get(),w,t.direction[1]<0?-1:1)),N(A,g,w,r)}function Gt(t,e){return $*Math.min(e.width,e.height)*e.computeRenderPixelSizeAt(t)}function kt(t,e,n,o){const i=w(x.get(),e,n);return w(i,i,e),D(t,i,o)}function Dt(t,e){return ft(t.basis1,t.basis2,t.origin,e)}function Ht(t,e,n,o){const i=e.worldUpAtPosition(t.origin,x.get()),r=x.get();switch(n){case fe.HEADING:T(r,i);break;case fe.TILT:T(r,t.basis1)}return D(t.origin,r,o)}function Bt(t,e,n,o){const i=Wt(n,Zt.NEGATIVE_X),a=F.get();s(a,e,i.edge*Math.PI/2);const c=A(x.get(),i.basis);let l=b(x.get(),c,i.direction*o.computeScreenPixelSizeAt(i.position)*J);O(l,l,i.position);const u=o.projectToRenderScreen(l,r(x.get())),d=xt(o,u);Ot(o,u,Te),A(Te.direction,Te.direction);const m=x.get();!d&&V(n,Te,m)&&(l=m),a[12]=0,a[13]=0,a[14]=0,t.modelTransform=a,t.renderLocation=L(l),d?t.state|=be:t.state&=~be}function xt(t,e){const[n,o,i,r]=t.viewport,s=Math.min(i,r)/16;let a=!0;return e[0]<n+s?(e[0]=n+s,a=!1):e[0]>n+i-s&&(e[0]=n+i-s,a=!1),e[1]<o+s?(e[1]=o+s,a=!1):e[1]>o+r-s&&(e[1]=o+r-s,a=!1),a}function Ft(t,e,n,o){const i=R(o.basis1),r=R(o.basis2),s=zt(o),u=$t(o),d=E(x.get(),0,0,0);O(d,b(x.get(),o.basis1,e.direction[0]),b(x.get(),o.basis2,e.direction[1])),O(d,o.origin,d);let m=0,p=1;if(Jt(e))1===e.direction[0]&&-1===e.direction[1]?m=he:1===e.direction[0]&&1===e.direction[1]?m=Math.PI:-1===e.direction[0]&&1===e.direction[1]&&(m=3*Math.PI/2),p=u;else{const t=0!==e.direction[0]?1:2;m=1===t?he:0,p=(1===t?r:i)-s}const f=a(F.get(),m);c(f,f,E(x.get(),p,p,p)),l(f,n,f),f[12]=0,f[13]=0,f[14]=0,t.modelTransform=f,t.renderLocation=d}function Xt(t,e,n,o){const i=o.worldUpAtPosition(n.origin,x.get()),r=Wt(n,Zt.POSITIVE_X),s=a(F.get(),r.edge*Math.PI/2);u(s,s,-ce(n,i)),l(s,e,s),s[12]=0,s[13]=0,s[14]=0,t.modelTransform=s,t.renderLocation=r.position}function Yt(t,e,n){const o=Wt(n,Zt.POSITIVE_Y),i=a(F.get(),o.edge*Math.PI/2);u(i,i,he),l(i,e,i),i[12]=0,i[13]=0,i[14]=0,t.modelTransform=i,t.renderLocation=o.position}var Zt;function Wt(t,e){switch(e){case Zt.POSITIVE_X:return{basis:t.basis1,direction:1,position:O(x.get(),t.origin,t.basis1),edge:e};case Zt.POSITIVE_Y:return{basis:t.basis2,direction:1,position:O(x.get(),t.origin,t.basis2),edge:e};case Zt.NEGATIVE_X:return{basis:t.basis1,direction:-1,position:I(x.get(),t.origin,t.basis1),edge:e};case Zt.NEGATIVE_Y:return{basis:t.basis2,direction:-1,position:I(x.get(),t.origin,t.basis2),edge:e}}}function qt(t,e,n){const o=n.projectToRenderScreen(O(x.get(),t,e),r(x.get())),i=n.projectToRenderScreen(I(x.get(),t,e),r(x.get()));return j(I(o,o,i))}function zt(t){const e=R(t.basis1),n=R(t.basis2);return K*Math.min(e,n)}function $t(t){return zt(t)}function Jt(t){return 0!==t.direction[0]&&0!==t.direction[1]}function Kt(e,n){const o=n.offsetMode===Oe.CENTER_ON_CALLOUT?J:0,i=[v(o,0,-it/2),v(o,0,it/2)],r=re(i,!0),s=(t,e)=>oe(i,t,e,n),a=s(0,!1),c=s(rt,!0),l=new Ut({color:t.toUnitRGBA(n.calloutColor),renderOccluded:Ct.OccludeAndTransparent,isDecoration:!0}),u=It(l,[[o,0,0],[o-J,0,0]]),d=It(l,[[o,0,0],[o-J,0,0]]);return new pt({view:e,renderObjects:[...a.normal.map((t=>new Tt(t,Mt.Unfocused|pe))),...c.normal.map((t=>new Tt(t,Mt.Unfocused|pe))),new Tt(u,Mt.Unfocused|pe|be),...a.focused.map((t=>new Tt(t,Mt.Focused|pe))),...c.focused.map((t=>new Tt(t,Mt.Focused|pe))),new Tt(d,Mt.Focused|pe|be)],autoScaleRenderObjects:!1,collisionType:{type:"line",paths:[r]},collisionPriority:1,radius:Q,state:pe})}function Qt(e,n){const o=new Y(e.effectiveTheme),i=gt(e,{calloutColor:t.toUnitRGBA(o.color),customStateMask:pe,texture:n});return i.state=pe,i}function te(e){const n=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0],[-1,-1,0]],o=new Z(e.effectiveTheme);return new ht({view:e,attached:!1,color:t.toUnitRGBA(o.outlineColor),width:tt,renderOccluded:Ct.OccludeAndTransparent,geometry:[n],isDecoration:!0})}function ee(e){const n=new Z(e.effectiveTheme);return new wt({view:e,attached:!1,backgroundColor:t.toUnitRGBA(n.color),gridColor:t.toUnitRGBA(n.gridColor),gridWidth:4,renderOccluded:Ct.OccludeAndTransparent,isDecoration:!0})}function ne(e,n,o){const i=Jt(n),r=i?[v(1,0,0),v(0,0,0),v(0,1,0)]:[v(1,0,0),v(-1,0,0)],s=t.toUnitRGBA(o.color),a=t=>new vt({color:s,width:t,renderOccluded:Ct.OccludeAndTransparent,isDecoration:!0}),c=()=>new Ut({color:s,renderOccluded:Ct.OccludeAndTransparent,isDecoration:!0}),l=i?st:at,u=l*ct,d=at,m=t=>t>1?a(t):c(),p=[new Tt(It(m(l),r),Mt.Unfocused|we),new Tt(It(m(u),r),Mt.Focused|we),new Tt(It(m(d),r),Ae)],f=new pt({view:e,renderObjects:p,collisionType:{type:"line",paths:[r]},radius:i?et:nt,...bt});return f.state=we,f}function oe(e,n,o,i){const r=t.blendColors(i.color,i.outlineColor,.4),s=t.blendColors(i.color,i.outlineColor,.14),a=new Lt({color:t.toUnitRGBA(i.color),cullFace:Rt.Back,renderOccluded:Ct.Opaque,isDecoration:!0}),u=new Lt({color:t.toUnitRGBA(r),cullFace:Rt.Back,renderOccluded:Ct.Opaque,isDecoration:!0}),T=new Lt({color:t.toUnitRGBA(s),cullFace:Rt.Back,renderOccluded:Ct.Opaque,isDecoration:!0}),h=new Lt({color:t.toUnitRGBA(i.outlineColor),transparent:!0,writeDepth:!1,cullFace:Rt.Front,renderOccluded:Ct.Transparent,isDecoration:!0}),w=t=>{const i=e.slice(0),r=I(x.get(),i[0],i[1]);A(r,r);const s=I(x.get(),i.at(-1),i.at(-2));if(A(s,s),n>0){const t=b(U(),s,-n);i[i.length-1]=O(t,t,i.at(-1));const e=b(U(),r,-n);i[0]=O(e,e,i[0])}const w=t?dt:1,R=ot*w,j=Q*w,C=d(F.get());if(n>0){const t=R/4,e=E(x.get(),0,t,0),o=1+n/t;m(C,C,e),c(C,C,E(x.get(),o,o,o)),m(C,C,b(e,e,-1/o))}const L=d(f()),_=v(0,1,0),M=p(f(),g(X.get(),_,s));M[12]=i.at(-1)[0],M[13]=i.at(-1)[1],M[14]=i.at(-1)[2],l(M,M,C);const P=ie(lt*(t?ut:1)+n,i,o?h:T);P.transformation=L;const N=[P],V=Et(o?h:a,R,j,24,!1,!1,!0);V.transformation=M,N.push(V);const y=Et(o?h:u,R,j,24,!1,!0,!1);y.transformation=M,N.push(y);const S=p(f(),g(X.get(),_,r));return S[12]=i[0][0],S[13]=i[0][1],S[14]=i[0][2],l(S,S,C),N.push(V.instantiate({transformation:S})),N.push(y.instantiate({transformation:S})),N};return{normal:w(!1),focused:w(!0)}}function ie(t,e,n){const o=[],i=12;for(let r=0;r<i;r++){const e=r/i*2*Math.PI;o.push([Math.cos(e)*t,Math.sin(e)*t])}return jt(n,o,e,[],[],!1)}function re(t,e){const n=I(U(),t.at(-1),t.at(-2));if(A(n,n),b(n,n,ot),O(n,n,t.at(-1)),e){const e=I(U(),t[0],t[1]);return A(e,e),b(e,e,ot),O(e,e,t[0]),[e,...t,n]}return[...t,n]}function se(t,n,i,r=new e){if(null==t)return null;const{renderCoordsHelper:s}=n,a=s.fromRenderCoords(t.origin,n.spatialReference);if(null==a)return null;const c=_(a,i);if(null==c)return null;r.position=c;const l=2*R(t.basis1),u=2*R(t.basis2),d=At.renderUnitScaleFactor(n.spatialReference,i);r.width=l*d,r.height=u*d;const m=s.worldUpAtPosition(t.origin,x.get());return r.tilt=o(ce(t,m)),r.heading=s.headingAtPosition(t.origin,t.basis1)-90,r}function ae(t,e,n){if(null==t)return null;const o=t.origin,i=x.get(),r=x.get(),s=x.get(),a=x.get();let c,l,u,d,m,p;O(i,o,t.basis1),O(i,i,t.basis2),O(r,o,t.basis1),C(r,r,t.basis2),C(s,o,t.basis1),C(s,s,t.basis2),C(a,o,t.basis1),O(a,a,t.basis2);for(const f of[i,r,s,a]){const t=e.fromRenderCoords(f,f,n);if(null==t)return null;c=null==c?t[0]:Math.min(c,t[0]),l=null==l?t[0]:Math.max(l,t[0]),u=null==u?t[1]:Math.min(u,t[1]),d=null==d?t[1]:Math.max(d,t[1]),m=null==m?t[2]:Math.min(m,t[2]),p=null==p?t[2]:Math.max(p,t[2])}return new Pt({xmin:c,xmax:l,ymin:u,ymax:d,zmin:m,zmax:p,spatialReference:n})}function ce(t,e){return B(e,t.basis2,t.basis1)+he}function le(t,e,o,r,s,a,c=y()){return a.toRenderCoords(t,c.origin)?(a.worldBasisAtPosition(c.origin,M.X,c.basis1),a.worldBasisAtPosition(c.origin,M.Y,c.basis2),k(c.basis2,c.basis1,c.origin,c.plane),P(c,-i(e),S(c),c),P(c,i(o),c.basis1,c),b(c.basis1,c.basis1,r/2),b(c.basis2,c.basis2,s/2),G(c),c):(n.getLogger("esri.views.3d.analysis.Slice.sliceToolUtils").error(`Failed to project slice plane position, projection from ${t.spatialReference.wkid} is not supported`),null)}function ue(t,e){if(null==t||null==t.position)return null;const n=mt(t.position,e.spatialReference,e.elevationProvider);if(null==n)return null;const o=At.renderUnitScaleFactor(t.position.spatialReference,e.spatialReference),i=t.width*o,r=t.height*o;return{position:n,heading:t.heading,tilt:t.tilt,renderWidth:i,renderHeight:r}}function de(t,e,n,o=y()){const i=ue(t,e);return null==i?null:me(i,e,n,o)}function me(t,e,n,o=y()){if(null==t)return null;const i=le(t.position,t.heading,t.tilt,t.renderWidth,t.renderHeight,e.renderCoordsHelper,o);return n.tiltEnabled||null==i||yt(i,e.renderCoordsHelper,i),i}!function(t){t[t.POSITIVE_X=0]="POSITIVE_X",t[t.POSITIVE_Y=1]="POSITIVE_Y",t[t.NEGATIVE_X=2]="NEGATIVE_X",t[t.NEGATIVE_Y=3]="NEGATIVE_Y"}(Zt||(Zt={}));const pe=_t.Custom1;var fe,ge;!function(t){t[t.HEADING=1]="HEADING",t[t.TILT=2]="TILT"}(fe||(fe={})),function(t){t[t.HORIZONTAL_OR_VERTICAL=0]="HORIZONTAL_OR_VERTICAL",t[t.HORIZONTAL=1]="HORIZONTAL",t[t.VERTICAL=2]="VERTICAL",t[t.TILTED=3]="TILTED"}(ge||(ge={}));const be=_t.Custom2,Te=H(),he=Math.PI/2,we=_t.Custom1,Ae=_t.Custom2;var Oe;function Re(t){return null!=("building-scene-3d"===t.type?t:null)}!function(t){t[t.CENTER_ON_CALLOUT=0]="CENTER_ON_CALLOUT",t[t.CENTER_ON_ARROW=1]="CENTER_ON_ARROW"}(Oe||(Oe={}));export{pe as DidPointerMoveRecentlyFlag,be as IsShiftEdgeOnScreenFlag,Oe as OffsetMode,fe as RotationAxis,ge as SliceOrientation,re as addArrowTips,Dt as calculateBoundedPlaneTranslateRotate,$t as calculateDiagonalResizeHandleScale,Gt as calculatePlaneHalfSize,zt as calculateResizeHandlePadding,qt as calculateScreenSpaceBasisLength2,ee as createGridVisualElement,te as createOutlineVisualElement,Nt as createPlane,ne as createResizeManipulator,Qt as createRotateManipulator,Ht as createRotatePlane,Kt as createShiftManipulator,kt as createShiftPlane,yt as forceHorizontalOrVertical,Jt as isDiagonalResizeHandle,Re as isIBuildingSceneLayerView3D,Vt as normalToBases,ae as planeToExtent,se as planeToShape,ue as projectAndElevationAlignShape,me as projectedShapeToPlane,we as resizeNormal,Ae as resizeOutlineOnly,St as resizePlane,de as shapeToPlane,Ft as updateResizeHandle,Xt as updateRotateHeadingHandle,Yt as updateRotateTiltHandle,Bt as updateShiftRestartHandle};
5
+ import e from"../../../../Color.js";import"../../../../geometry.js";import t from"../../../../analysis/SlicePlane.js";import"../../../../core/has.js";import n from"../../../../core/Logger.js";import{rad2deg as o,deg2rad as i}from"../../../../core/mathUtils.js";import{castRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{o as s,b as a,k as c,m as l,r as u,i as d,w as m,F as g}from"../../../../chunks/mat4.js";import{c as p}from"../../../../chunks/mat4f64.js";import{r as f}from"../../../../chunks/quat.js";import{g as b,c as h,e as T,f as w,n as A,a as O,l as R,b as I,s as E,p as j,A as C}from"../../../../chunks/vec3.js";import{a as L,c as U,f as v}from"../../../../chunks/vec3f64.js";import{tryProjectWithZConversion as _}from"../../../../geometry/projection.js";import{Axis as M}from"../../../../geometry/support/Axis.js";import{r as P,f as N,i as V,a as y,n as S,u as G}from"../../../../chunks/boundedPlane.js";import{fromVectorsAndPoint as k,fromPositionAndNormal as D}from"../../../../geometry/support/plane.js";import{create as H}from"../../../../geometry/support/ray.js";import{angleAroundAxis as B}from"../../../../geometry/support/vector.js";import{sv3d as x,sm4d as F,sq4d as X}from"../../../../geometry/support/vectorStacks.js";import{CalloutStyle as Y,PlaneStyle as Z}from"./settings.js";import{VERTICAL_DOT_THRESHOLD as W,SMALL_ANGLE_DOT_THRESHOLD as q,PLANE_MIN_BASIS_SCREEN_LEN2 as z,INITIAL_PLANE_HALF_SIZE_VIEW_PROPORTION as $,SHIFT_RESTART_OFFSET_DISTANCE as J,RESIZE_HANDLE_EDGE_PADDING_FRAC as K,SHIFT_RESTART_TIP_RADIUS as Q,PLANE_OUTLINE_WIDTH as ee,RESIZE_HANDLE_CORNER_INPUT_RADIUS as te,RESIZE_HANDLE_EDGE_INPUT_RADIUS as ne,SHIFT_RESTART_TIP_LENGTH as oe,SHIFT_RESTART_ARROW_LENGTH as ie,SHIFT_RESTART_ARROW_OUTLINE_WIDTH as re,RESIZE_HANDLE_CORNER_WIDTH as se,RESIZE_HANDLE_EDGE_WIDTH as ae,DISPLAY_FOCUS_MULTIPLIER as ce,SHIFT_RESTART_TUBE_RADIUS as le,SHIFT_RESTART_TUBE_FOCUS_MULTIPLIER as ue,SHIFT_RESTART_TIP_FOCUS_MULTIPLIER as de}from"./sliceToolConfig.js";import{applyProjectionAndElevationAlignment as me}from"../support/projectionUtils.js";import{Manipulator3D as ge}from"../../interactive/Manipulator3D.js";import{calculateTranslateRotateFromBases as pe,createRotateManipulator as fe,worldScaledManipulatorSettings as be}from"../../interactive/manipulatorUtils.js";import{RenderObject as he}from"../../interactive/RenderObject.js";import{LineVisualElement as Te}from"../../interactive/visualElements/LineVisualElement.js";import{SlicePlaneVisualElement as we}from"../../interactive/visualElements/SlicePlaneVisualElement.js";import{RenderCoordsHelper as Ae}from"../../support/RenderCoordsHelper.js";import{fromRender as Oe}from"../../support/geometryUtils/ray.js";import{CullFaceOptions as Re}from"../../webgl-engine/lib/basicInterfaces.js";import{createPolylineGeometry as Ie,createConeGeometry as Ee,createPathExtrusionGeometry as je}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as Ce}from"../../webgl-engine/lib/Material.js";import{ColorMaterial as Le}from"../../webgl-engine/materials/ColorMaterial.js";import{NativeLineMaterial as Ue}from"../../webgl-engine/materials/NativeLineMaterial.js";import{RibbonLineMaterial as ve}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{ManipulatorStateCustomFlags as _e,ManipulatorStateFlags as Me}from"../../../interactive/interfaces.js";import Pe from"../../../../geometry/Extent.js";function Ne(e,t,n,o,i,r,s,a){return Ve(t,s.worldUpAtPosition(e,x.get()),i,r,a.basis1,a.basis2),b(a.basis1,a.basis1,n),b(a.basis2,a.basis2,o),h(a.origin,e),k(a.basis2,a.basis1,a.origin,a.plane),a}function Ve(e,t,n,o,i,r){const s=T(e,t),a=x.get(),c=x.get();switch(o===ft.HORIZONTAL_OR_VERTICAL?Math.abs(s)>W?ft.HORIZONTAL:ft.VERTICAL:o){case ft.VERTICAL:{const o=Math.abs(s)<=q?e:n.viewUp;w(a,o,t),h(c,t);break}case ft.HORIZONTAL:w(a,n.viewUp,t),w(c,t,a);break;case ft.TILTED:{const o=Math.abs(s)<=q?t:n.viewUp;w(a,o,e),w(c,e,a);break}}const l=w(x.get(),a,c);T(l,n.viewForward)>0&&b(c,c,-1),A(i,a),A(r,c)}function ye(e,t,n){const o=t.worldUpAtPosition(e.origin,x.get()),i=e.basis1,r=ct(e,o),s=Math.round(r/Tt)*Tt;return P(e,s-r,i,n)}function Se(e,t,n,o,i,r){const s=h(x.get(),i.origin);O(s,s,b(x.get(),i.basis1,e.direction[0]<0?1:-1)),O(s,s,b(x.get(),i.basis2,e.direction[1]<0?1:-1));const a=R(i.basis1),c=R(i.basis2),l=I(x.get(),n,s),u=I(x.get(),t,s);let d=0,m=0;if(Je(e)){const t=$e(i),n=$e(r);d=a-.5*e.direction[0]*T(i.basis1,u)/a,m=c-.5*e.direction[1]*T(i.basis2,u)/c;const o=n/t;d*=o,m*=o}const g=d+.5*e.direction[0]*T(i.basis1,l)/a,p=m+.5*e.direction[1]*T(i.basis2,l)/c,f=b(x.get(),i.basis1,g/a),w=b(x.get(),i.basis2,p/c);(g<=0||qe(r.origin,f,o)<=z)&&h(f,r.basis1),(p<=0||qe(r.origin,w,o)<=z)&&h(w,r.basis2);const A=h(x.get(),s);return O(A,A,b(x.get(),f,e.direction[0]<0?-1:1)),O(A,A,b(x.get(),w,e.direction[1]<0?-1:1)),N(A,f,w,r)}function Ge(e,t){return $*Math.min(t.width,t.height)*t.computeRenderPixelSizeAt(e)}function ke(e,t,n,o){const i=w(x.get(),t,n);return w(i,i,t),D(e,i,o)}function De(e,t){return pe(e.basis1,e.basis2,e.origin,t)}function He(e,t,n,o){const i=t.worldUpAtPosition(e.origin,x.get()),r=x.get();switch(n){case pt.HEADING:h(r,i);break;case pt.TILT:h(r,e.basis1)}return D(e.origin,r,o)}function Be(e,t,n,o){const i=We(n,Ze.NEGATIVE_X),a=F.get();s(a,t,i.edge*Math.PI/2);const c=A(x.get(),i.basis);let l=b(x.get(),c,i.direction*o.computeScreenPixelSizeAt(i.position)*J);O(l,l,i.position);const u=o.projectToRenderScreen(l,r(x.get())),d=xe(o,u);Oe(o,u,ht),A(ht.direction,ht.direction);const m=x.get();!d&&V(n,ht,m)&&(l=m),a[12]=0,a[13]=0,a[14]=0,e.modelTransform=a,e.renderLocation=L(l),d?e.state|=bt:e.state&=~bt}function xe(e,t){const[n,o,i,r]=e.viewport,s=Math.min(i,r)/16;let a=!0;return t[0]<n+s?(t[0]=n+s,a=!1):t[0]>n+i-s&&(t[0]=n+i-s,a=!1),t[1]<o+s?(t[1]=o+s,a=!1):t[1]>o+r-s&&(t[1]=o+r-s,a=!1),a}function Fe(e,t,n,o){const i=R(o.basis1),r=R(o.basis2),s=ze(o),u=$e(o),d=E(x.get(),0,0,0);O(d,b(x.get(),o.basis1,t.direction[0]),b(x.get(),o.basis2,t.direction[1])),O(d,o.origin,d);let m=0,g=1;if(Je(t))1===t.direction[0]&&-1===t.direction[1]?m=Tt:1===t.direction[0]&&1===t.direction[1]?m=Math.PI:-1===t.direction[0]&&1===t.direction[1]&&(m=3*Math.PI/2),g=u;else{const e=0!==t.direction[0]?1:2;m=1===e?Tt:0,g=(1===e?r:i)-s}const p=a(F.get(),m);c(p,p,E(x.get(),g,g,g)),l(p,n,p),p[12]=0,p[13]=0,p[14]=0,e.modelTransform=p,e.renderLocation=d}function Xe(e,t,n,o){const i=o.worldUpAtPosition(n.origin,x.get()),r=We(n,Ze.POSITIVE_X),s=a(F.get(),r.edge*Math.PI/2);u(s,s,-ct(n,i)),l(s,t,s),s[12]=0,s[13]=0,s[14]=0,e.modelTransform=s,e.renderLocation=r.position}function Ye(e,t,n){const o=We(n,Ze.POSITIVE_Y),i=a(F.get(),o.edge*Math.PI/2);u(i,i,Tt),l(i,t,i),i[12]=0,i[13]=0,i[14]=0,e.modelTransform=i,e.renderLocation=o.position}var Ze;function We(e,t){switch(t){case Ze.POSITIVE_X:return{basis:e.basis1,direction:1,position:O(x.get(),e.origin,e.basis1),edge:t};case Ze.POSITIVE_Y:return{basis:e.basis2,direction:1,position:O(x.get(),e.origin,e.basis2),edge:t};case Ze.NEGATIVE_X:return{basis:e.basis1,direction:-1,position:I(x.get(),e.origin,e.basis1),edge:t};case Ze.NEGATIVE_Y:return{basis:e.basis2,direction:-1,position:I(x.get(),e.origin,e.basis2),edge:t}}}function qe(e,t,n){const o=n.projectToRenderScreen(O(x.get(),e,t),r(x.get())),i=n.projectToRenderScreen(I(x.get(),e,t),r(x.get()));return j(I(o,o,i))}function ze(e){const t=R(e.basis1),n=R(e.basis2);return K*Math.min(t,n)}function $e(e){return ze(e)}function Je(e){return 0!==e.direction[0]&&0!==e.direction[1]}function Ke(t,n){const o=n.offsetMode===Ot.CENTER_ON_CALLOUT?J:0,i=[v(o,0,-ie/2),v(o,0,ie/2)],r=rt(i,!0),s=(e,t)=>ot(i,e,t,n),a=s(0,!1),c=s(re,!0),l=new Ue({color:e.toUnitRGBA(n.calloutColor),renderOccluded:Ce.OccludeAndTransparent,isDecoration:!0}),u=Ie(l,[[o,0,0],[o-J,0,0]]),d=Ie(l,[[o,0,0],[o-J,0,0]]);return new ge({view:t,renderObjects:[...a.normal.map((e=>new he(e,Me.Unfocused|gt))),...c.normal.map((e=>new he(e,Me.Unfocused|gt))),new he(u,Me.Unfocused|gt|bt),...a.focused.map((e=>new he(e,Me.Focused|gt))),...c.focused.map((e=>new he(e,Me.Focused|gt))),new he(d,Me.Focused|gt|bt)],autoScaleRenderObjects:!1,collisionType:{type:"line",paths:[r]},collisionPriority:1,radius:Q,state:gt})}function Qe(t,n){const o=new Y(t.effectiveTheme),i=fe(t,{calloutColor:e.toUnitRGBA(o.color),customStateMask:gt,texture:n});return i.state=gt,i}function et(t){const n=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0],[-1,-1,0]],o=new Z(t.effectiveTheme);return new Te({view:t,attached:!1,color:e.toUnitRGBA(o.outlineColor),width:ee,renderOccluded:Ce.OccludeAndTransparent,geometry:[n],isDecoration:!0})}function tt(t){const n=new Z(t.effectiveTheme);return new we({view:t,attached:!1,backgroundColor:e.toUnitRGBA(n.color),gridColor:e.toUnitRGBA(n.gridColor),gridWidth:4,renderOccluded:Ce.OccludeAndTransparent,isDecoration:!0})}function nt(t,n,o){const i=Je(n),r=i?[v(1,0,0),v(0,0,0),v(0,1,0)]:[v(1,0,0),v(-1,0,0)],s=e.toUnitRGBA(o.color),a=e=>new ve({color:s,width:e,renderOccluded:Ce.OccludeAndTransparent,isDecoration:!0}),c=()=>new Ue({color:s,renderOccluded:Ce.OccludeAndTransparent,isDecoration:!0}),l=i?se:ae,u=l*ce,d=ae,m=e=>e>1?a(e):c(),g=[new he(Ie(m(l),r),Me.Unfocused|wt),new he(Ie(m(u),r),Me.Focused|wt),new he(Ie(m(d),r),At)],p=new ge({view:t,renderObjects:g,collisionType:{type:"line",paths:[r]},radius:i?te:ne,...be});return p.state=wt,p}function ot(t,n,o,i){const r=e.blendColors(i.color,i.outlineColor,.4),s=e.blendColors(i.color,i.outlineColor,.14),a=new Le({color:e.toUnitRGBA(i.color),cullFace:Re.Back,renderOccluded:Ce.Opaque,isDecoration:!0}),u=new Le({color:e.toUnitRGBA(r),cullFace:Re.Back,renderOccluded:Ce.Opaque,isDecoration:!0}),h=new Le({color:e.toUnitRGBA(s),cullFace:Re.Back,renderOccluded:Ce.Opaque,isDecoration:!0}),T=new Le({color:e.toUnitRGBA(i.outlineColor),transparent:!0,writeDepth:!1,cullFace:Re.Front,renderOccluded:Ce.Transparent,isDecoration:!0}),w=e=>{const i=t.slice(0),r=I(x.get(),i[0],i[1]);A(r,r);const s=I(x.get(),i[i.length-1],i[i.length-2]);if(A(s,s),n>0){const e=b(U(),s,-n);i[i.length-1]=O(e,e,i[i.length-1]);const t=b(U(),r,-n);i[0]=O(t,t,i[0])}const w=e?de:1,R=oe*w,j=Q*w,C=d(F.get());if(n>0){const e=R/4,t=E(x.get(),0,e,0),o=1+n/e;m(C,C,t),c(C,C,E(x.get(),o,o,o)),m(C,C,b(t,t,-1/o))}const L=d(p()),_=v(0,1,0),M=g(p(),f(X.get(),_,s));M[12]=i[i.length-1][0],M[13]=i[i.length-1][1],M[14]=i[i.length-1][2],l(M,M,C);const P=it(le*(e?ue:1)+n,i,o?T:h);P.transformation=L;const N=[P],V=Ee(o?T:a,R,j,24,!1,!1,!0);V.transformation=M,N.push(V);const y=Ee(o?T:u,R,j,24,!1,!0,!1);y.transformation=M,N.push(y);const S=g(p(),f(X.get(),_,r));return S[12]=i[0][0],S[13]=i[0][1],S[14]=i[0][2],l(S,S,C),N.push(V.instantiate({transformation:S})),N.push(y.instantiate({transformation:S})),N};return{normal:w(!1),focused:w(!0)}}function it(e,t,n){const o=[],i=12;for(let r=0;r<i;r++){const t=r/i*2*Math.PI;o.push([Math.cos(t)*e,Math.sin(t)*e])}return je(n,o,t,[],[],!1)}function rt(e,t){const n=I(U(),e[e.length-1],e[e.length-2]);if(A(n,n),b(n,n,oe),O(n,n,e[e.length-1]),t){const t=I(U(),e[0],e[1]);return A(t,t),b(t,t,oe),O(t,t,e[0]),[t,...e,n]}return[...e,n]}function st(e,n,i,r=new t){if(null==e)return null;const{renderCoordsHelper:s}=n,a=s.fromRenderCoords(e.origin,n.spatialReference);if(null==a)return null;const c=_(a,i);if(null==c)return null;r.position=c;const l=2*R(e.basis1),u=2*R(e.basis2),d=Ae.renderUnitScaleFactor(n.spatialReference,i);r.width=l*d,r.height=u*d;const m=s.worldUpAtPosition(e.origin,x.get());return r.tilt=o(ct(e,m)),r.heading=s.headingAtPosition(e.origin,e.basis1)-90,r}function at(e,t,n){if(null==e)return null;const o=e.origin,i=x.get(),r=x.get(),s=x.get(),a=x.get();let c,l,u,d,m,g;O(i,o,e.basis1),O(i,i,e.basis2),O(r,o,e.basis1),C(r,r,e.basis2),C(s,o,e.basis1),C(s,s,e.basis2),C(a,o,e.basis1),O(a,a,e.basis2);for(const p of[i,r,s,a]){const e=t.fromRenderCoords(p,p,n);if(null==e)return null;c=null==c?e[0]:Math.min(c,e[0]),l=null==l?e[0]:Math.max(l,e[0]),u=null==u?e[1]:Math.min(u,e[1]),d=null==d?e[1]:Math.max(d,e[1]),m=null==m?e[2]:Math.min(m,e[2]),g=null==g?e[2]:Math.max(g,e[2])}return new Pe({xmin:c,xmax:l,ymin:u,ymax:d,zmin:m,zmax:g,spatialReference:n})}function ct(e,t){return B(t,e.basis2,e.basis1)+Tt}function lt(e,t,o,r,s,a,c=y()){return a.toRenderCoords(e,c.origin)?(a.worldBasisAtPosition(c.origin,M.X,c.basis1),a.worldBasisAtPosition(c.origin,M.Y,c.basis2),k(c.basis2,c.basis1,c.origin,c.plane),P(c,-i(t),S(c),c),P(c,i(o),c.basis1,c),b(c.basis1,c.basis1,r/2),b(c.basis2,c.basis2,s/2),G(c),c):(n.getLogger("esri.views.3d.analysis.Slice.sliceToolUtils").error(`Failed to project slice plane position, projection from ${e.spatialReference.wkid} is not supported`),null)}function ut(e,t){if(null==e||null==e.position)return null;const n=me(e.position,t.spatialReference,t.elevationProvider);if(null==n)return null;const o=Ae.renderUnitScaleFactor(e.position.spatialReference,t.spatialReference),i=e.width*o,r=e.height*o;return{position:n,heading:e.heading,tilt:e.tilt,renderWidth:i,renderHeight:r}}function dt(e,t,n,o=y()){const i=ut(e,t);return null==i?null:mt(i,t,n,o)}function mt(e,t,n,o=y()){if(null==e)return null;const i=lt(e.position,e.heading,e.tilt,e.renderWidth,e.renderHeight,t.renderCoordsHelper,o);return n.tiltEnabled||null==i||ye(i,t.renderCoordsHelper,i),i}!function(e){e[e.POSITIVE_X=0]="POSITIVE_X",e[e.POSITIVE_Y=1]="POSITIVE_Y",e[e.NEGATIVE_X=2]="NEGATIVE_X",e[e.NEGATIVE_Y=3]="NEGATIVE_Y"}(Ze||(Ze={}));const gt=_e.Custom1;var pt,ft;!function(e){e[e.HEADING=1]="HEADING",e[e.TILT=2]="TILT"}(pt||(pt={})),function(e){e[e.HORIZONTAL_OR_VERTICAL=0]="HORIZONTAL_OR_VERTICAL",e[e.HORIZONTAL=1]="HORIZONTAL",e[e.VERTICAL=2]="VERTICAL",e[e.TILTED=3]="TILTED"}(ft||(ft={}));const bt=_e.Custom2,ht=H(),Tt=Math.PI/2,wt=_e.Custom1,At=_e.Custom2;var Ot;function Rt(e){return null!=("building-scene-3d"===e.type?e:null)}!function(e){e[e.CENTER_ON_CALLOUT=0]="CENTER_ON_CALLOUT",e[e.CENTER_ON_ARROW=1]="CENTER_ON_ARROW"}(Ot||(Ot={}));export{gt as DidPointerMoveRecentlyFlag,bt as IsShiftEdgeOnScreenFlag,Ot as OffsetMode,pt as RotationAxis,ft as SliceOrientation,rt as addArrowTips,De as calculateBoundedPlaneTranslateRotate,$e as calculateDiagonalResizeHandleScale,Ge as calculatePlaneHalfSize,ze as calculateResizeHandlePadding,qe as calculateScreenSpaceBasisLength2,tt as createGridVisualElement,et as createOutlineVisualElement,Ne as createPlane,nt as createResizeManipulator,Qe as createRotateManipulator,He as createRotatePlane,Ke as createShiftManipulator,ke as createShiftPlane,ye as forceHorizontalOrVertical,Je as isDiagonalResizeHandle,Rt as isIBuildingSceneLayerView3D,Ve as normalToBases,at as planeToExtent,st as planeToShape,ut as projectAndElevationAlignShape,mt as projectedShapeToPlane,wt as resizeNormal,At as resizeOutlineOnly,Se as resizePlane,dt as shapeToPlane,Fe as updateResizeHandle,Xe as updateRotateHeadingHandle,Ye as updateRotateTiltHandle,Be as updateShiftRestartHandle};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../core/Handles.js";import{clamp as t,lerp as s,smoothstep as i}from"../../../core/mathUtils.js";import{watch as r}from"../../../core/reactiveUtils.js";import{s as a}from"../../../chunks/vec2.js";import{s as o,l as n,p as h}from"../../../chunks/vec3.js";import{s as d}from"../../../chunks/vec4.js";import{earth as u}from"../../../geometry/support/Ellipsoid.js";import{AtmosphereType as m}from"./AtmosphereType.js";import{atmosphereHeight as p,innerAtmosphereDepth as l,computeInnerAltitudeFade as c}from"./atmosphereUtils.js";import{ChapmanAtmospherePassParameters as _,ChapmanAtmosphereTechnique as T}from"./ChapmanAtmosphereTechnique.js";import{ChapmanAtmosphereTechniqueConfiguration as b}from"./ChapmanAtmosphereTechniqueConfiguration.js";import{ColorFormat as f}from"../webgl-engine/core/FBOCache.js";import{Pos2Tex as v}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{createQuadVAO as R}from"../webgl-engine/lib/glUtil3D.js";import{applyTextureResizeModulo as w}from"../webgl-engine/lib/textureUtils.js";import{PrimitiveType as q}from"../../webgl/enums.js";class x{constructor(t,s){this._view=t,this.type=m.Realistic,this._handles=new e,this._passParameters=new _,this._rootTileElevationMin=NaN,this._lowerBoundEarthRadius=u.radius,this._fadeHaze=0,this._updateRadius(u.radius);const i=s.renderContext.rctx;this._updateRootTileElevationBounds(),this._handles.add([r((()=>this._view?.basemapTerrain?.rootTileElevationBounds),(()=>this._view?.basemapTerrain?this._updateRootTileElevationBounds():null)),r((()=>this._view?.basemapTerrain?.visibleElevationBounds),(()=>this._view?.basemapTerrain?this._updateVisibleElevationBounds():null))]);const a=new b;a.haze=!1,this._atmosphereTechnique=s.techniqueRepository.acquire(T,a),a.haze=!0,this._atmosphereHazeTechnique=s.techniqueRepository.acquire(T,a),a.reduced=!0,a.haze=!1,this._atmosphereReducedTechnique=s.techniqueRepository.acquire(T,a),a.haze=!0,this._atmosphereHazeReducedTechnique=s.techniqueRepository.acquire(T,a),this._vao=R(i,v)}destroy(){this._handles.destroy(),this._atmosphereTechnique.release(),this._atmosphereHazeTechnique.release(),this._atmosphereReducedTechnique.release(),this._atmosphereHazeReducedTechnique.release(),this._vao.dispose()}render(e,t){this._render(e,t?this._atmosphereTechnique:this._atmosphereReducedTechnique,e.offscreenRenderingHelper.depthTexture,t,!1)}renderHaze(e,t,s){this._fadeHaze=t,this._render(e,s?this._atmosphereHazeTechnique:this._atmosphereHazeReducedTechnique,e.bindParameters.linearDepth?.colorTexture,s,!0)}_render(e,t,i,r,a){if(null==i)return;const h=e.offscreenRenderingHelper;this._update(e.bindParameters.camera),this._passParameters.depthTexture=i;const d=h.backgroundColor;o(this._passParameters.backgroundColor,d[0]*d[3],d[1]*d[3],d[2]*d[3]);const m=e.rctx.bindTechnique(t,this._passParameters,e.bindParameters);if(r)h.renderDepthDetached((()=>this._renderCommon(m,e)));else{const t=e.rctx.getViewport(),r=n(e.bindParameters.camera.eye)-u.radius;let o;if(r<p){const e=Math.min(1,Math.max(0,r/p));o=a?s(.4,.5,e):s(.2,.3,e)}else{const e=Math.min(1,Math.max(0,(r-p)/(15*p)));o=a?s(.5,1,e):s(.3,.6,e)}const d=w(Math.round(o*e.bindParameters.camera.fullViewport[2])),l=w(Math.round(o*e.bindParameters.camera.fullViewport[3]));e.rctx.setViewport(0,0,d,l);const c=h.renderToCachedFBO(null,(()=>this._renderCommon(m,e)),[0,0,0,1],f.RGBA,null,d,l);e.rctx.setViewport(t.x,t.y,t.width,t.height),h.compositeAtmosphereToMain(e.bindParameters,a,c.colorTexture,i),c.release()}}_renderCommon(e,t){null!=this._vao&&(t.rctx.bindVAO(this._vao),e.assertCompatibleVertexAttributeLocations(this._vao),t.rctx.drawArrays(q.TRIANGLE_STRIP,0,4))}_adjustRadiusForTesselation(e){return e*Math.cos(Math.PI/16/16)}_updateRootTileElevationBounds(){const e=this._view.basemapTerrain.rootTileElevationBounds.min;e!==this._rootTileElevationMin&&(this._rootTileElevationMin=e,this._lowerBoundEarthRadius=u.radius,this._updateVisibleElevationBounds())}_updateVisibleElevationBounds(){const e=this._adjustRadiusForTesselation(u.radius+this._view.basemapTerrain.visibleElevationBounds.min);e<this._lowerBoundEarthRadius&&this._updateRadius(e)}_updateRadius(e){this._lowerBoundEarthRadius=e,a(this._passParameters.radii,e,e+p),this._passParameters.innerFadeDistance=2*Math.sqrt((2*e-l)*l)}_update(e){if(!e)return;const r=h(e.eye),a=Math.sqrt(r),o=r-this._passParameters.radii[1]*this._passParameters.radii[1],n=t((a-this._passParameters.radii[0])/p,0,1);d(this._passParameters.heightParameters,a,r,o,n),this._passParameters.altitudeFade=c(a-this._lowerBoundEarthRadius),this._passParameters.hazeStrength=s(s(.6,1,i(9500,10500,a-u.radius)),1,this._fadeHaze)}static isSupported(e){return e.renderContext.rctx.capabilities.depthTexture}}export{x as ChapmanAtmosphere};
5
+ import e from"../../../core/Handles.js";import{clamp as t,lerp as s,smoothstep as i}from"../../../core/mathUtils.js";import{watch as r}from"../../../core/reactiveUtils.js";import{s as a}from"../../../chunks/vec2.js";import{s as o,l as n,p as h}from"../../../chunks/vec3.js";import{s as d}from"../../../chunks/vec4.js";import{earth as m}from"../../../geometry/support/Ellipsoid.js";import{AtmosphereType as u}from"./AtmosphereType.js";import{atmosphereHeight as p,innerAtmosphereDepth as c,computeInnerAltitudeFade as l}from"./atmosphereUtils.js";import{ChapmanAtmospherePassParameters as _,ChapmanAtmosphereTechnique as T}from"./ChapmanAtmosphereTechnique.js";import{ChapmanAtmosphereTechniqueConfiguration as f}from"./ChapmanAtmosphereTechniqueConfiguration.js";import{ColorFormat as b}from"../webgl-engine/core/FBOCache.js";import{Pos2Tex as v}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{createQuadVAO as w}from"../webgl-engine/lib/glUtil3D.js";import{applyTextureResizeModulo as x}from"../webgl-engine/lib/textureUtils.js";import{A as R}from"../../../chunks/AtmosphereCompositing.glsl.js";import{AtmosphereCompositingTechnique as q}from"../webgl-engine/shaders/AtmosphereCompositingTechnique.js";import{PrimitiveType as g}from"../../webgl/enums.js";class P{constructor(t,s){this._view=t,this._context=s,this.type=u.Realistic,this._handles=new e,this._atmosphereCompositionParameters=new R,this._atmosphereConfiguration=new f,this._passParameters=new _,this._rootTileElevationMin=NaN,this._lowerBoundEarthRadius=m.radius,this._fadeHaze=0,this._updateRadius(m.radius);const i=this._context.renderContext.rctx;this._updateRootTileElevationBounds(),this._handles.add([r((()=>this._view?.basemapTerrain?.rootTileElevationBounds),(()=>this._view?.basemapTerrain?this._updateRootTileElevationBounds():null)),r((()=>this._view?.basemapTerrain?.visibleElevationBounds),(()=>this._view?.basemapTerrain?this._updateVisibleElevationBounds():null))]);const a=new f;a.haze=!1,this._atmosphereTechnique=this._context.techniqueRepository.acquire(T,a),a.haze=!0,this._atmosphereHazeTechnique=this._context.techniqueRepository.acquire(T,a),a.reduced=!0,a.haze=!1,this._atmosphereReducedTechnique=this._context.techniqueRepository.acquire(T,a),a.haze=!0,this._atmosphereHazeReducedTechnique=this._context.techniqueRepository.acquire(T,a),this._vao=w(i,v)}destroy(){this._handles.destroy(),this._atmosphereTechnique.release(),this._atmosphereHazeTechnique.release(),this._atmosphereReducedTechnique.release(),this._atmosphereHazeReducedTechnique.release(),this._vao.dispose()}render(e,t){this._render(e,t?this._atmosphereTechnique:this._atmosphereReducedTechnique,e.offscreenRenderingHelper.depthTexture,t,!1)}renderHaze(e,t,s){this._fadeHaze=t,this._render(e,s?this._atmosphereHazeTechnique:this._atmosphereHazeReducedTechnique,e.bindParameters.linearDepth?.colorTexture,s,!0)}_render(e,t,i,r,a){if(null==i)return;const h=e.offscreenRenderingHelper;this._update(e.bindParameters.camera),this._passParameters.depthTexture=i;const d=h.backgroundColor;o(this._passParameters.backgroundColor,d[0]*d[3],d[1]*d[3],d[2]*d[3]);const u=e.rctx.bindTechnique(t,this._passParameters,e.bindParameters);if(r)h.renderDepthDetached((()=>this._renderCommon(u,e)));else{const t=e.rctx.getViewport(),r=n(e.bindParameters.camera.eye)-m.radius;let o;if(r<p){const e=Math.min(1,Math.max(0,r/p));o=a?s(.4,.5,e):s(.2,.3,e)}else{const e=Math.min(1,Math.max(0,(r-p)/(15*p)));o=a?s(.5,1,e):s(.3,.6,e)}const d=x(Math.round(o*e.bindParameters.camera.fullViewport[2])),c=x(Math.round(o*e.bindParameters.camera.fullViewport[3]));e.rctx.setViewport(0,0,d,c);const l=h.renderToCachedFBO(null,(()=>this._renderCommon(u,e)),[0,0,0,1],b.RGBA,null,d,c);e.rctx.setViewport(t.x,t.y,t.width,t.height),this._atmosphereCompositionParameters.color=l.colorTexture,this._atmosphereCompositionParameters.depth=i,this._atmosphereConfiguration.haze=a;const _=this._context.techniqueRepository.acquire(q,this._atmosphereConfiguration);e.rctx.bindTechnique(_,this._atmosphereCompositionParameters,e.bindParameters),h.renderDepthDetached((()=>e.rctx.screen.draw())),_.release(),l.release()}}_renderCommon(e,t){null!=this._vao&&(t.rctx.bindVAO(this._vao),e.assertCompatibleVertexAttributeLocations(this._vao),t.rctx.drawArrays(g.TRIANGLE_STRIP,0,4))}_adjustRadiusForTesselation(e){return e*Math.cos(Math.PI/16/16)}_updateRootTileElevationBounds(){const e=this._view.basemapTerrain.rootTileElevationBounds.min;e!==this._rootTileElevationMin&&(this._rootTileElevationMin=e,this._lowerBoundEarthRadius=m.radius,this._updateVisibleElevationBounds())}_updateVisibleElevationBounds(){const e=this._adjustRadiusForTesselation(m.radius+this._view.basemapTerrain.visibleElevationBounds.min);e<this._lowerBoundEarthRadius&&this._updateRadius(e)}_updateRadius(e){this._lowerBoundEarthRadius=e,a(this._passParameters.radii,e,e+p),this._passParameters.innerFadeDistance=2*Math.sqrt((2*e-c)*c)}_update(e){if(!e)return;const r=h(e.eye),a=Math.sqrt(r),o=r-this._passParameters.radii[1]*this._passParameters.radii[1],n=t((a-this._passParameters.radii[0])/p,0,1);d(this._passParameters.heightParameters,a,r,o,n),this._passParameters.altitudeFade=l(a-this._lowerBoundEarthRadius),this._passParameters.hazeStrength=s(s(.6,1,i(9500,10500,a-m.radius)),1,this._fadeHaze)}static isSupported(e){return e.renderContext.rctx.capabilities.depthTexture}}export{P as ChapmanAtmosphere};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import{lerp as s}from"../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{watch as i,syncAndInitial as a,initial as o,sync as n}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{l as d,c as p,h as u}from"../../../chunks/vec3.js";import{f as m}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as c}from"../../../geometry/ellipsoidUtils.js";import{isMoon as _,isEarth as g,isMars as w}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as f}from"../../ViewingMode.js";import{AtmosphereType as y}from"./AtmosphereType.js";import{ChapmanAtmosphere as P}from"./ChapmanAtmosphere.js";import{CloudsComposition as v}from"./CloudsComposition.js";import{isReadyCloudsData as b,CloudsRenderingStages as R}from"./CloudsData.js";import{CloudsGenerator as A}from"./CloudsGenerator.js";import{FadeMode as x}from"./CloudsParameters.js";import{cloudPresets as F}from"./CloudsPresets.js";import{Fog as N,FogParameters as C}from"./Fog.js";import{LocalAtmosphere as E}from"./LocalAtmosphere.js";import j from"./MarsAtmosphere.js";import{Precipitation as W}from"./Precipitation.js";import{Stars as O}from"./Stars.js";import{weatherHeightLimit as S}from"./weather.js";import{ShaderOutput as M}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{RenderSlot as T}from"../webgl-engine/lib/RenderSlot.js";import{Update as z}from"../webgl-engine/lib/Update.js";var L;let U=L=class extends t{constructor(e){super(e),this.renderSlots=[T.POSTPROCESSING_ENVIRONMENT_OPAQUE,T.POSTPROCESSING_ENVIRONMENT_TRANSPARENT],this._context=null,this._atmosphere=null,this._oldWeatherParameters=new I,this._newWeatherParameters=new I,this._fadedWeatherParameters=new I,this._weatherParameters=this._newWeatherParameters}initialize(){this.view._stage.addRenderPlugin(this)}destroy(){this.removeHandles(),this.uninitializeRenderContext(),null!=this.view?._stage&&this.view._stage.removeRenderPlugin(this),this._set("view",null)}get atmosphere(){return this._atmosphere}get _atmosphereType(){return null!=this.atmosphere?this.atmosphere.type:y.None}canRender(){return!(null===this._atmosphere&&null===this._stars)}requiresOutput(e){return e===M.Depth&&this._atmosphereType===y.Realistic}updateAnimation(e){return null!=this._precipitation&&this._precipitation.update(e)}get updating(){return null!=this._stars&&this._stars.updating||null!=this._clouds&&this._clouds.running}get weatherVisible(){return d(this.view.state.camera.eye)-c(this.view.spatialReference).radius<=S}get usedMemory(){return this._clouds?.usedMemory??0}get _stars(){const e=this.view,t=e.environment?.starsEnabled??!1,s=this._get("_stars");return t&&null!=this._context?null!=s?s:new O({view:e,requestRender:()=>this._setNeedsRender()}):(r(s),null)}get _precipitation(){const e=this._get("_precipitation");if(!this._precipitationEnabled||null==this._context)return r(e),null;const t=this.view,s=this._context;return null!=e&&e.context===s?e:(r(e),new W({context:s,view:t}))}get _clouds(){const e=this._get("_clouds");if(!this.weatherEnabled||null==this._context)return r(e),null;if(null!=e)return e;const t=this.view,s=this._context;return r(e),new A({context:s,view:t,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const e=this._get("_cloudsComposition");if(!this.weatherEnabled||null==this._context)return r(e),null;const t=this.view.state.viewingMode,s=this._context.renderContext.rctx,i=c(this.view.spatialReference).radius;return null!=e&&e.viewingMode===t&&e.planetRadius===i?e:(r(e),new v({rctx:s,viewingMode:t,planetRadius:i,requestRender:()=>this._setNeedsRender()}))}get _fog(){const e=this._get("_fog");if(!this.weatherEnabled||null==this._context)return r(e),null;if(null!=e)return e;const t=this.view,s=this._context,i=this._context.renderContext.rctx,a=this.view.state.viewingMode;return new N({context:s,view:t,rctx:i,viewingMode:a})}get weatherEnabled(){return!!this.view?.environmentManager?.weatherEnabled}get _precipitationEnabled(){return this.weatherEnabled&&("rainy"===this.view.environment.weather.type||"snowy"===this.view.environment.weather.type)}initializeRenderContext(e=null){this._context=e;const t=()=>this._setNeedsRender();this.addHandles([i((()=>({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled})),(e=>this._updateAtmosphere(e)),a),i((()=>this._stars),t),i((()=>this._precipitation),t),i((()=>this._clouds),(()=>this._updateWeather()),o),i((()=>this._fog),(()=>this._updateFogHaze()),o),i((()=>this.view.state.mode),(()=>{this._setNeedsRender()}),n),i((()=>this._weatherUpdateParameters),(()=>{this._updateWeather(),this._updateFogHaze()}),a)])}uninitializeRenderContext(){this._context=null,this._atmosphere=r(this._atmosphere),this._set("_stars",r(this._stars)),this._set("_precipitation",r(this._precipitation)),this._set("_clouds",r(this._clouds)),this._set("_cloudsComposition",r(this._cloudsComposition)),this._set("_fog",r(this._fog))}prepareRender(e){e.bindParameters.cloudsFade.data=b(this._clouds)?this._clouds:null,"local"!==this.view.viewingMode&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&(this._updateWeatherFading(e.bindParameters,e.time),e.bindParameters.cloudsFade.renderingStage===R.FINISHED&&null!=this._clouds&&0===this._clouds.coverage&&!1===this._clouds.running&&(this._clouds.destroyFrameBufferCube(),e.bindParameters.cloudsFade.data=null))}render(e){if(e.output===M.Color)switch(e.bindParameters.slot){case T.POSTPROCESSING_ENVIRONMENT_OPAQUE:null!=this._stars&&this._stars.render(e),null!=this.atmosphere&&(this.atmosphere.render(e,this.view?._stage?.renderer?.fullResolutionAtmosphere),null!=this._cloudsComposition&&null!=e.bindParameters.cloudsFade.data&&(this.weatherVisible&&null!=this._clouds&&this._clouds.updateWeatherTile(),this._cloudsComposition.render(e)),e.bindParameters.cloudsFade.isFading&&null!=this._context&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&this._context.requestRender());break;case T.POSTPROCESSING_ENVIRONMENT_TRANSPARENT:if(null!=this.atmosphere&&(this.atmosphere.renderHaze(e,this._weatherParameters.hazeAmount,this.view?._stage?.renderer?.fullResolutionAtmosphere),this._weatherParameters.fog.amount>0&&null!=this._fog&&this._fog.render(e,this._weatherParameters.fog),null!=this._precipitation)){const t=this.view.environment.weather;"rainy"!==t.type&&"snowy"!==t.type||this._precipitation.render(e,t.precipitation,t.type)}}}updateLightSources(e,t,s,r){if(null!=this._context){const i=this._context.renderContext;i.bindParameters.oldLighting.copyFrom(i.bindParameters.lighting),i.bindParameters.newLighting.noonFactor=t,i.bindParameters.newLighting.globalFactor=s,i.bindParameters.newLighting.set(e);r===z.Faded||i.bindParameters.weatherFading?i.bindParameters.fadeLighting(0):i.bindParameters.fadeLighting(1),this._context.requestRender()}}get _weatherUpdateParameters(){const e=this.weatherEnabled?this.view.environment.weather:null;return null==e?null:"rainy"===e.type||"snowy"===e.type?{type:e.type,weatherAdjustment:e.cloudCover,effect:e.precipitation}:{type:e.type,weatherAdjustment:"foggy"===e.type?e.fogStrength:e.cloudCover}}_updateWeatherFading(e,t){e.cloudsFade.updateFading(e.camera,this.view.state.mode,t,this.view.qualitySettings.fadeDuration),e.cloudsFade.updateParallax(e.camera),e.weatherFading&&(this._updateLighting(e),this._updateFogAtmoshpere(e))}_updateLighting(e){e.cloudsFade.fadeMode!==x.CROSS_FADE&&e.cloudsFade.fadeMode!==x.FADE_IN?e.fadeLighting(0):e.fadeLighting(e.cloudsFade.fadeFactor)}_updateFogAtmoshpere(e){e.cloudsFade.fadeMode!==x.CROSS_FADE&&e.cloudsFade.fadeMode!==x.FADE_IN?this._fadeWeather(0):this._fadeWeather(e.cloudsFade.fadeFactor)}_fadeWeather(e){const{_newWeatherParameters:t,_oldWeatherParameters:s}=this;e>=1?this._weatherParameters=t:(this._fadedWeatherParameters.lerp(s,t,e),this._weatherParameters=this._fadedWeatherParameters)}_updateWeather(){const e=this._weatherUpdateParameters;null!=e&&null!=this._clouds&&(this._clouds.applyPreset(F[e.type],e.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){null!=this._context&&this._context.requestRender()}_updateFogHaze(){const e=this._weatherUpdateParameters;if(null==this._fog||null==e||null==this._context)return;const t=this._context.renderContext.bindParameters;switch(this._oldWeatherParameters.copyFrom(this._weatherParameters),e.type){case"foggy":this._newWeatherParameters.fog.strength=s(3e-5,.005,e.weatherAdjustment**3),p(this._newWeatherParameters.fog.color,D),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;case"rainy":this._newWeatherParameters.fog.strength=s(4e-6,2e-4,(e.effect??0)**3),p(this._newWeatherParameters.fog.color,q),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=0,this._setNeedsRender();break;case"snowy":this._newWeatherParameters.fog.strength=s(4e-6,2e-4,(e.effect??0)**3),p(this._newWeatherParameters.fog.color,D),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;default:this._newWeatherParameters.fog.strength=0,this._newWeatherParameters.fog.amount=0,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender()}t.weatherFading?this._fadeWeather(0):this._fadeWeather(1)}_updateAtmosphere(e){const t=this._selectAtmosphereType(e);if(t!==y.None&&this._context){if(!this._atmosphere||this._atmosphere.type!==t){this._atmosphere=r(this._atmosphere);const e=this._getAtmosphereClass(t);e&&(this._atmosphere=new e(this.view,this._context))}}else this._atmosphere=r(this._atmosphere);this._setNeedsRender()}_getAtmosphereClass(e){switch(e){case y.Realistic:return P;case y.Local:return E;case y.Mars:return j;default:case y.None:return null}}_selectAtmosphereType(e){const{enabled:t,viewingMode:s}=e;return!t||_(this.view.spatialReference)?y.None:s===f.Local?y.Local:null!=this._context&&P.isSupported(this._context)&&g(this.view.spatialReference)?y.Realistic:w(this.view.spatialReference)?y.Mars:y.None}get test(){return{atmosphere:this._atmosphere,clouds:this._clouds,selectAtmosphereType:()=>this._selectAtmosphereType({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled}),stubGetAtmosphereClass:e=>{V=L.prototype._getAtmosphereClass,L.prototype._getAtmosphereClass=e},restoreGetAtmosphereClass:()=>{L.prototype._getAtmosphereClass=V}}}};e([h({constructOnly:!0})],U.prototype,"view",void 0),e([h({readOnly:!0})],U.prototype,"atmosphere",null),e([h({readOnly:!0})],U.prototype,"_atmosphereType",null),e([h({type:Boolean,readOnly:!0})],U.prototype,"updating",null),e([h({readOnly:!0})],U.prototype,"weatherVisible",null),e([h()],U.prototype,"_context",void 0),e([h()],U.prototype,"_atmosphere",void 0),e([h({readOnly:!0})],U.prototype,"_stars",null),e([h({readOnly:!0})],U.prototype,"_precipitation",null),e([h({readOnly:!0})],U.prototype,"_clouds",null),e([h({readOnly:!0})],U.prototype,"_cloudsComposition",null),e([h({readOnly:!0})],U.prototype,"_fog",null),e([h({readOnly:!0})],U.prototype,"weatherEnabled",null),e([h({readOnly:!0})],U.prototype,"_precipitationEnabled",null),e([h({readOnly:!0})],U.prototype,"_weatherUpdateParameters",null),U=L=e([l("esri.views.3d.environment.EnvironmentRenderer")],U);class I{constructor(){this.fog=new C,this.hazeAmount=1}copyFrom(e){this.fog.amount=e.fog.amount,this.hazeAmount=e.hazeAmount,this.fog.strength=e.fog.strength,p(this.fog.color,e.fog.color)}lerp(e,t,r){this.fog.amount=s(e.fog.amount,t.fog.amount,r),this.hazeAmount=s(e.hazeAmount,t.hazeAmount,r),this.fog.strength=s(e.fog.strength,t.fog.strength,r),u(this.fog.color,e.fog.color,t.fog.color,r)}}const q=m(.5,.5,.5),D=m(1.5,1.5,1.5);let V;export{U as EnvironmentRenderer,I as WeatherParameters};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../core/has.js";import{lerp as t}from"../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{watch as r,syncAndInitial as i,initial as a,sync as o}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{l,c as d,h as p}from"../../../chunks/vec3.js";import{f as u}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as m}from"../../../geometry/ellipsoidUtils.js";import{isMoon as _,isEarth as c,isMars as g}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as w}from"../../ViewingMode.js";import{AtmosphereType as f}from"./AtmosphereType.js";import{ChapmanAtmosphere as y}from"./ChapmanAtmosphere.js";import{CloudsComposition as P}from"./CloudsComposition.js";import{isReadyCloudsData as v,CloudsRenderingStages as b}from"./CloudsData.js";import{CloudsGenerator as R}from"./CloudsGenerator.js";import{FadeMode as A}from"./CloudsParameters.js";import{cloudPresets as x}from"./CloudsPresets.js";import{Fog as F,FogParameters as N}from"./Fog.js";import{LocalAtmosphere as C}from"./LocalAtmosphere.js";import E from"./MarsAtmosphere.js";import{Precipitation as j}from"./Precipitation.js";import{Stars as W}from"./Stars.js";import{weatherHeightLimit as O}from"./weather.js";import{ShaderOutput as S}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as M}from"../webgl-engine/effects/RenderPlugin.js";import{RenderSlot as T}from"../webgl-engine/lib/RenderSlot.js";import{Update as z}from"../webgl-engine/lib/Update.js";var L;let U=L=class extends M{constructor(e){super(e),this.renderSlots=[T.POSTPROCESSING_ENVIRONMENT_OPAQUE,T.POSTPROCESSING_ENVIRONMENT_TRANSPARENT],this._context=null,this._atmosphere=null,this._oldWeatherParameters=new I,this._newWeatherParameters=new I,this._fadedWeatherParameters=new I,this._weatherParameters=this._newWeatherParameters}initialize(){this.view._stage.addRenderPlugin(this)}destroy(){this.removeHandles(),this.uninitializeRenderContext(),null!=this.view?._stage&&this.view._stage.removeRenderPlugin(this),this._set("view",null)}get atmosphere(){return this._atmosphere}get _atmosphereType(){return null!=this.atmosphere?this.atmosphere.type:f.None}canRender(){return!(null===this._atmosphere&&null===this._stars)}requiresOutput(e){return e===S.Depth&&this._atmosphereType===f.Realistic}updateAnimation(e){return null!=this._precipitation&&this._precipitation.update(e)}get updating(){return null!=this._stars&&this._stars.updating||null!=this._clouds&&this._clouds.running}get weatherVisible(){return l(this.view.state.camera.eye)-m(this.view.spatialReference).radius<=O}get usedMemory(){return this._clouds?.usedMemory??0}get _stars(){const e=this.view,t=e.environment?.starsEnabled??!1,r=this._get("_stars");return t&&null!=this._context?null!=r?r:new W({view:e,requestRender:()=>this._setNeedsRender()}):(s(r),null)}get _precipitation(){const e=this._get("_precipitation");if(!this._precipitationEnabled||null==this._context)return s(e),null;const t=this.view,r=this._context;return null!=e&&e.context===r?e:(s(e),new j({context:r,view:t}))}get _clouds(){const e=this._get("_clouds");if(!this.weatherEnabled||null==this._context)return s(e),null;if(null!=e)return e;const t=this.view,r=this._context;return s(e),new R({context:r,view:t,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const e=this._get("_cloudsComposition");if(!this.weatherEnabled||null==this._context)return s(e),null;const t=this.view.state.viewingMode,r=this._context.renderContext.rctx,i=m(this.view.spatialReference).radius;return null!=e&&e.viewingMode===t&&e.planetRadius===i?e:(s(e),new P({rctx:r,viewingMode:t,planetRadius:i,requestRender:()=>this._setNeedsRender()}))}get _fog(){const e=this._get("_fog");if(!this.weatherEnabled||null==this._context)return s(e),null;if(null!=e)return e;const t=this.view,r=this._context,i=this._context.renderContext.rctx,a=this.view.state.viewingMode;return new F({context:r,view:t,rctx:i,viewingMode:a})}get weatherEnabled(){return!!this.view?.environmentManager?.weatherEnabled}get _precipitationEnabled(){return this.weatherEnabled&&("rainy"===this.view.environment.weather.type||"snowy"===this.view.environment.weather.type)}initializeRenderContext(e=null){this._context=e;const t=()=>this._setNeedsRender();this.addHandles([r((()=>({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled})),(e=>this._updateAtmosphere(e)),i),r((()=>this._stars),t),r((()=>this._precipitation),t),r((()=>this._clouds),(()=>this._updateWeather()),a),r((()=>this._fog),(()=>this._updateFogHaze()),a),r((()=>this.view.state.mode),(()=>{this._setNeedsRender()}),o),r((()=>this._weatherUpdateParameters),(()=>{this._updateWeather(),this._updateFogHaze()}),i)])}uninitializeRenderContext(){this._context=null,this._atmosphere=s(this._atmosphere),this._set("_stars",s(this._stars)),this._set("_precipitation",s(this._precipitation)),this._set("_clouds",s(this._clouds)),this._set("_cloudsComposition",s(this._cloudsComposition)),this._set("_fog",s(this._fog))}prepareRender(e){e.bindParameters.cloudsFade.data=v(this._clouds)?this._clouds:null,"local"!==this.view.viewingMode&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&(this._updateWeatherFading(e.bindParameters,e.time),e.bindParameters.cloudsFade.renderingStage===b.FINISHED&&null!=this._clouds&&0===this._clouds.coverage&&!1===this._clouds.running&&(this._clouds.destroyFrameBufferCube(),e.bindParameters.cloudsFade.data=null))}render(e){if(e.output===S.Color)switch(e.bindParameters.slot){case T.POSTPROCESSING_ENVIRONMENT_OPAQUE:null!=this._stars&&this._stars.render(e),null!=this.atmosphere&&(this.atmosphere.render(e,this.view?._stage?.renderer?.fullResolutionAtmosphere),null!=this._cloudsComposition&&null!=e.bindParameters.cloudsFade.data&&(this.weatherVisible&&null!=this._clouds&&this._clouds.updateWeatherTile(),this._cloudsComposition.render(e)),e.bindParameters.cloudsFade.isFading&&null!=this._context&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&this._context.requestRender());break;case T.POSTPROCESSING_ENVIRONMENT_TRANSPARENT:if(null!=this.atmosphere&&(this.atmosphere.renderHaze(e,this._weatherParameters.hazeAmount,this.view?._stage?.renderer?.fullResolutionAtmosphere),this._weatherParameters.fog.amount>0&&null!=this._fog&&this._fog.render(e,this._weatherParameters.fog),null!=this._precipitation)){const t=this.view.environment.weather;"rainy"!==t.type&&"snowy"!==t.type||this._precipitation.render(e,t.precipitation,t.type)}}}updateLightSources(e,t,s,r){if(null!=this._context){const i=this._context.renderContext;i.bindParameters.oldLighting.copyFrom(i.bindParameters.lighting),i.bindParameters.newLighting.noonFactor=t,i.bindParameters.newLighting.globalFactor=s,i.bindParameters.newLighting.set(e);r===z.Faded||i.bindParameters.weatherFading?i.bindParameters.fadeLighting(0):i.bindParameters.fadeLighting(1),this._context.requestRender()}}get _weatherUpdateParameters(){const e=this.weatherEnabled?this.view.environment.weather:null;return null==e?null:"rainy"===e.type||"snowy"===e.type?{type:e.type,weatherAdjustment:e.cloudCover,effect:e.precipitation}:{type:e.type,weatherAdjustment:"foggy"===e.type?e.fogStrength:e.cloudCover}}_updateWeatherFading(e,t){e.cloudsFade.updateFading(e.camera,this.view.state.mode,t,this.view.qualitySettings.fadeDuration),e.cloudsFade.updateParallax(e.camera),e.weatherFading&&(this._updateLighting(e),this._updateFogAtmoshpere(e))}_updateLighting(e){e.cloudsFade.fadeMode!==A.CROSS_FADE&&e.cloudsFade.fadeMode!==A.FADE_IN?e.fadeLighting(0):e.fadeLighting(e.cloudsFade.fadeFactor)}_updateFogAtmoshpere(e){e.cloudsFade.fadeMode!==A.CROSS_FADE&&e.cloudsFade.fadeMode!==A.FADE_IN?this._fadeWeather(0):this._fadeWeather(e.cloudsFade.fadeFactor)}_fadeWeather(e){const{_newWeatherParameters:t,_oldWeatherParameters:s}=this;e>=1?this._weatherParameters=t:(this._fadedWeatherParameters.lerp(s,t,e),this._weatherParameters=this._fadedWeatherParameters)}_updateWeather(){const e=this._weatherUpdateParameters;null!=e&&null!=this._clouds&&(this._clouds.applyPreset(x[e.type],e.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){null!=this._context&&this._context.requestRender()}_updateFogHaze(){const e=this._weatherUpdateParameters;if(null==this._fog||null==e||null==this._context)return;const s=this._context.renderContext.bindParameters;switch(this._oldWeatherParameters.copyFrom(this._weatherParameters),e.type){case"foggy":this._newWeatherParameters.fog.strength=t(3e-5,.005,e.weatherAdjustment**3),d(this._newWeatherParameters.fog.color,D),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;case"rainy":this._newWeatherParameters.fog.strength=t(4e-6,2e-4,(e.effect??0)**3),d(this._newWeatherParameters.fog.color,q),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=0,this._setNeedsRender();break;case"snowy":this._newWeatherParameters.fog.strength=t(4e-6,2e-4,(e.effect??0)**3),d(this._newWeatherParameters.fog.color,D),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;default:this._newWeatherParameters.fog.strength=0,this._newWeatherParameters.fog.amount=0,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender()}s.weatherFading?this._fadeWeather(0):this._fadeWeather(1)}_updateAtmosphere(e){const t=this._selectAtmosphereType(e);if(t!==f.None&&this._context){if(!this._atmosphere||this._atmosphere.type!==t){this._atmosphere=s(this._atmosphere);const e=this._getAtmosphereClass(t);e&&(this._atmosphere=new e(this.view,this._context))}}else this._atmosphere=s(this._atmosphere);this._setNeedsRender()}_getAtmosphereClass(e){switch(e){case f.Realistic:return y;case f.Local:return C;case f.Mars:return E;default:case f.None:return null}}_selectAtmosphereType(e){const{enabled:t,viewingMode:s}=e;return!t||_(this.view.spatialReference)?f.None:s===w.Local?f.Local:null!=this._context&&y.isSupported(this._context)&&c(this.view.spatialReference)?f.Realistic:g(this.view.spatialReference)?f.Mars:f.None}get test(){return{atmosphere:this._atmosphere,clouds:this._clouds,selectAtmosphereType:()=>this._selectAtmosphereType({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled}),stubGetAtmosphereClass:e=>{V=L.prototype._getAtmosphereClass,L.prototype._getAtmosphereClass=e},restoreGetAtmosphereClass:()=>{L.prototype._getAtmosphereClass=V}}}};e([n({constructOnly:!0})],U.prototype,"view",void 0),e([n({readOnly:!0})],U.prototype,"atmosphere",null),e([n({readOnly:!0})],U.prototype,"_atmosphereType",null),e([n({type:Boolean,readOnly:!0})],U.prototype,"updating",null),e([n({readOnly:!0})],U.prototype,"weatherVisible",null),e([n()],U.prototype,"_context",void 0),e([n()],U.prototype,"_atmosphere",void 0),e([n({readOnly:!0})],U.prototype,"_stars",null),e([n({readOnly:!0})],U.prototype,"_precipitation",null),e([n({readOnly:!0})],U.prototype,"_clouds",null),e([n({readOnly:!0})],U.prototype,"_cloudsComposition",null),e([n({readOnly:!0})],U.prototype,"_fog",null),e([n({readOnly:!0})],U.prototype,"weatherEnabled",null),e([n({readOnly:!0})],U.prototype,"_precipitationEnabled",null),e([n({readOnly:!0})],U.prototype,"_weatherUpdateParameters",null),U=L=e([h("esri.views.3d.environment.EnvironmentRenderer")],U);class I{constructor(){this.fog=new N,this.hazeAmount=1}copyFrom(e){this.fog.amount=e.fog.amount,this.hazeAmount=e.hazeAmount,this.fog.strength=e.fog.strength,d(this.fog.color,e.fog.color)}lerp(e,s,r){this.fog.amount=t(e.fog.amount,s.fog.amount,r),this.hazeAmount=t(e.hazeAmount,s.hazeAmount,r),this.fog.strength=t(e.fog.strength,s.fog.strength,r),p(this.fog.color,e.fog.color,s.fog.color,r)}}const q=u(.5,.5,.5),D=u(1.5,1.5,1.5);let V;export{U as EnvironmentRenderer,I as WeatherParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../core/Collection.js";import t from"../../../core/Logger.js";import{removeMaybe as r}from"../../../core/maybe.js";import{watch as n,initial as s}from"../../../core/reactiveUtils.js";import i from"./RenderContext.js";import{ShaderOutput as d}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{RenderSlot as o}from"../webgl-engine/lib/RenderSlot.js";class a{constructor(){this._renderers=new e}add(e,t){this._findOrCreateStageRenderer(e).add(t)}remove(e,t){const r=this._findStageRenderer(e);r&&(r.remove(t),0===r.renderers.length&&(r.destroy(),this._renderers.remove(r)))}_findStageRenderer(e){return this._renderers.find((t=>t.view===e))}_findOrCreateStageRenderer(e){let t=this._findStageRenderer(e);return t||(t=new h(e),this._renderers.add(t)),t}}class h{canRender(e){return e!==o.TRANSPARENT_MATERIAL||this.renderers.some((e=>"function"==typeof e.renderTransparent))}requiresOutput(){return!1}constructor(t){this.view=t,this.renderers=new e,this.context=null,this.renderSlots=[o.OPAQUE_MATERIAL,o.TRANSPARENT_MATERIAL],this._readyWatchHandle=n((()=>t.ready),(e=>{e?(this.context=new i(this.view),this.view._stage.addRenderPlugin(this)):(this.renderers.forEach((e=>c(e,"dispose",this.context))),this.context=null)}),s)}destroy(){this.renderers.drain((e=>{this.context&&c(e,"dispose",this.context)})),this.view._stage?.removeRenderPlugin(this),this._readyWatchHandle=r(this._readyWatchHandle),this.context=null}add(e){this.renderers.includes(e)?t.getLogger("esri.views.3d.externalRenderers.ExternalRendererStore").warn("add(): Cannot add external renderer: renderer has already been added"):(this.renderers.add(e),this.context&&(this._webglStateReset(),c(e,"setup",this.context),this.view._stage.renderView.requestRender()))}remove(e){const t=this.renderers.indexOf(e);-1!==t&&(this.renderers.removeAt(t),this.context&&(c(e,"dispose",this.context),this.view._stage.renderView.requestRender()))}initializeRenderContext(e){this.context.rctx=e.renderContext.rctx,this.renderers.length>0&&this._webglStateReset(),this.renderers.forEach((e=>c(e,"setup",this.context)))}uninitializeRenderContext(){}render(e){0===this.renderers.length||e.output!==d.Color||e.bindParameters.slot!==o.OPAQUE_MATERIAL&&e.bindParameters.slot!==o.TRANSPARENT_MATERIAL||(this._updateContext(e),this._webglStateReset(),this.renderers.forEach((t=>{switch(e.bindParameters.slot){case o.OPAQUE_MATERIAL:c(t,"render",this.context);break;case o.TRANSPARENT_MATERIAL:c(t,"renderTransparent",this.context)}})))}_updateContext(e){this.context.camera.copyFrom(e.bindParameters.camera),this.context.sunLight=e.bindParameters.lighting.legacy,this.context._renderTargetHelper=e.offscreenRenderingHelper}_webglStateReset(){this.context.rctx.resetState(),this.context._renderTargetHelper?.bindFbo()}}function c(e,t,r){"function"==typeof e[t]&&null!=r&&e[t]?.(r)}export{a as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Collection.js";import t from"../../../core/Logger.js";import{watch as s,initial as n}from"../../../core/reactiveUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import d from"./RenderContext.js";import{ShaderOutput as a}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncRenderPlugin as c}from"../webgl-engine/effects/RenderPlugin.js";import{RenderSlot as h}from"../webgl-engine/lib/RenderSlot.js";class l{constructor(){this._renderers=new r}add(e,r){let t=this._findStageRenderer(e);t||(t=new p({view:e}),this._renderers.add(t)),t.add(r)}remove(e,r){const t=this._findStageRenderer(e);t&&(t.remove(r),0===t.renderers.length&&(t.destroy(),this._renderers.remove(t)))}_findStageRenderer(e){return this._renderers.find((r=>r.view===e))}}let p=class extends c{canRender(e){return e!==h.TRANSPARENT_MATERIAL||this.renderers.some((e=>"function"==typeof e.renderTransparent))}constructor(e){super(e),this.renderSlots=[h.OPAQUE_MATERIAL,h.TRANSPARENT_MATERIAL],this.renderers=new r,this.context=null}initialize(){this.addHandles([s((()=>this.view.ready),(e=>{e?(this.context=new d(this.view),this.view._stage.addRenderPlugin(this)):(this.renderers.forEach((e=>m(e,"dispose",this.context))),this.context=null)}),n)])}destroy(){this.renderers.drain((e=>{this.context&&m(e,"dispose",this.context)})),this.view._stage?.removeRenderPlugin(this),this.context=null}add(e){this.renderers.includes(e)?t.getLogger("esri.views.3d.externalRenderers.ExternalRendererStore").warn("add(): Cannot add external renderer: renderer has already been added"):(this.renderers.add(e),this.context&&(this._webglStateReset(),m(e,"setup",this.context),this.view._stage.renderView.requestRender()))}remove(e){const r=this.renderers.indexOf(e);-1!==r&&(this.renderers.removeAt(r),this.context&&(m(e,"dispose",this.context),this.view._stage.renderView.requestRender()))}initializeRenderContext(e){this.context.rctx=e.renderContext.rctx,this.renderers.length>0&&this._webglStateReset(),this.renderers.forEach((e=>m(e,"setup",this.context)))}uninitializeRenderContext(){}render(e){0===this.renderers.length||e.output!==a.Color||e.bindParameters.slot!==h.OPAQUE_MATERIAL&&e.bindParameters.slot!==h.TRANSPARENT_MATERIAL||(this._updateContext(e),this._webglStateReset(),this.renderers.forEach((r=>{switch(e.bindParameters.slot){case h.OPAQUE_MATERIAL:m(r,"render",this.context);break;case h.TRANSPARENT_MATERIAL:m(r,"renderTransparent",this.context)}})))}_updateContext(e){this.context.camera.copyFrom(e.bindParameters.camera),this.context.sunLight=e.bindParameters.lighting.legacy,this.context._renderTargetHelper=e.offscreenRenderingHelper}_webglStateReset(){this.context.rctx.resetState(),this.context._renderTargetHelper?.bindFbo()}};function m(e,r,t){"function"==typeof e[r]&&null!=t&&e[r]?.(t)}e([i({constructOnly:!0})],p.prototype,"view",void 0),p=e([o("esri.views.3d.externalRenderers.ExternalRendererStore")],p);export{l 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.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../../chunks/tslib.es6.js";import i from"../../../../../core/Collection.js";import e from"../../../../../core/Evented.js";import{makeHandle as o}from"../../../../../core/handleUtils.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{scale as n,zeroMeters as s}from"../../../../../core/quantityUtils.js";import{watch as r,syncAndInitial as p}from"../../../../../core/reactiveUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as h}from"../../../../../core/support/UpdatingHandles.js";import{makeDehydratedPoint as u}from"../../../../../layers/graphics/dehydratedFeatures.js";import{getGraphicEffectiveElevationInfo as m,getConvertedElevation as d}from"../../../../../support/elevationInfoUtils.js";import{getGraphicAttachmentOrigin as g}from"../../manipulatorUtils.js";import{SnappingVisualizer3D as f}from"../../SnappingVisualizer3D.js";import{SupportedGraphicResult as v}from"../isSupportedGraphicUtils.js";import{canMoveZ as M}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as _}from"../meshFastUpdateUtils.js";import{createVisualElements as y}from"../visualElementUtils.js";import{DISC_RADIUS as w}from"../manipulations/config.js";import{ManipulationType as j,MoveManipulation as b}from"../manipulations/MoveManipulation.js";import{shapeOrientation as x,axisConstrainedDragSign as S}from"../manipulations/moveUtils.js";import{MoveXYGraphicManipulation as E}from"../manipulations/MoveXYGraphicManipulation.js";import{isSupportedGraphic as T}from"./isSupportedGraphic.js";import{OutlineVisualElement as H}from"../../visualElements/OutlineVisualElement.js";import{GraphicState as O}from"../../../layers/graphics/GraphicState.js";import{dragGraphicMany as U,resetGraphicMany as D}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as X}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as G}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import Y from"../../../../interactive/sketch/SketchTooltipOptions.js";import{SnappingContext as z}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as A}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{Tooltip as P}from"../../../../interactive/tooltip/Tooltip.js";import{TranslateGraphicTooltipInfo as k,TranslateGraphicZTooltipInfo as I,TranslateGraphicXYTooltipInfo as R}from"../../../../interactive/tooltip/TranslateTooltipInfos.js";import{autoHorizontalDistanceByElevationModeBetweenPoints as F}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as Z}from"../../../../support/euclideanLengthMeasurementUtils.js";class C{constructor(t){this.allGraphics=t,this.type="graphic-move-start"}}class V{constructor(t,i,e){this.dx=t,this.dy=i,this.allGraphics=e,this.type="graphic-move"}}class L{constructor(t){this.allGraphics=t,this.type="graphic-move-stop"}}const N="manipulators";let q=class extends(e.EventedMixin(X)){constructor(t){super(t),this._infos=new Map,this.graphics=new i,this.enableZ=!0,this.tooltipOptions=new Y,this.type="move-3d",this._updatingHandles=new h,this._moveManipulation=null,this._tooltip=null}initialize(){const{view:t}=this;this.addHandles([this.graphics.on("change",(t=>{t.removed.forEach((t=>this.removeHandles(t))),this._updateGraphicInfos(t),this._setupFastTransformUpdates(t.added),this._refreshManipulators()})),r((()=>this.tooltipOptions.enabled),(i=>{this._tooltip=i?new P({view:t}):a(this._tooltip)}),p)]);const i=this.graphics.toArray();this._updateGraphicInfos({added:i,removed:[]}),this._setupFastTransformUpdates(i),this._refreshManipulators(),this.finishToolCreation()}destroy(){this._tooltip=a(this._tooltip),this._moveManipulation=a(this._moveManipulation),this._set("view",null),this._updatingHandles.destroy()}get updating(){return this._updatingHandles.updating}reset(){}_updateGraphicInfos({added:t,removed:i}){for(const e of t){if(T(e)!==v.SUPPORTED)continue;const t=new B(e),i=this.view.trackGraphicState(t.state);this._infos.set(t.graphic,{info:t,handle:i})}for(const e of i)this._infos.get(e)?.handle.remove(),this._infos.delete(e)}_setupFastTransformUpdates(t){for(const i of t){const{info:t}=this._infos.get(i);this.addHandles(_(t.state),i)}}_refreshManipulators(){if(this.removeHandles(N),this._moveManipulation=a(this._moveManipulation),this.manipulators.removeAll(),0===this._infos.size)return;const t=Array.from(this._infos.values(),(({info:t})=>t));this._createManipulators(t),this._createVisualElements(t),this._updateMoveManipulation(t)}_createManipulators(t){for(const i of t){const e=i.state;i.manipulationXY=new E({tool:this,view:this.view,graphicState:e}),i.manipulationXY.forEachManipulator((t=>this.addHandles([t.events.on("immediate-click",(t=>{this.emit("immediate-click",{...t,graphic:e.graphic}),t.stopPropagation()})),t.events.on("grab-changed",(({action:t})=>{const{tooltipOptions:i,_tooltip:e}=this;null!=e&&("start"===t?e.info=new k({tooltipOptions:i}):e.clear())}))],N))),this.addHandles(i.manipulationXY.createDragPipeline(((i,e,o,a)=>this._buildDragEventPipeline(t,j.XY,i,e,o,a))),N)}this._createMoveManipulation(t)}_createMoveManipulation(t){const i=new b({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:1===t.length?b.radiusForSymbol(t[0].graphic.symbol):w});this._moveManipulation=i,i.elevationInfo={mode:"absolute-height",offset:0},i.forEachManipulator((t=>{this.addHandles(t.events.on("immediate-click",(e=>{i.zManipulation.hasManipulator(t)||1!==this.graphics.length||this.emit("immediate-click",{...e,graphic:this.graphics.at(0)}),e.stopPropagation()})),N)}));const e=i=>e=>{this.addHandles(e.events.on("focus-changed",(({action:e})=>{const o=this._tooltip;null!=o&&("focus"===e?this._updateMoveTooltip(t,i):o.clear())})),N)};this._moveManipulation.xyManipulation.forEachManipulator(e(j.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(e(j.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(e(j.Z));const o=()=>this._updateMoveManipulation(t);for(const n of t)this.addHandles([n.state.on("changed",o),r((()=>n.state.displaying),o)],N);const a=t.at(-1);this.addHandles(a.state.on("changed",(()=>this._updateMoveManipulationAngle(a))),N),this.addHandles(i.createDragPipeline(((i,e,o,a,n)=>this._buildDragEventPipeline(t,i,e,o,a,n)),m(a.graphic),a.graphic.geometry.spatialReference,a.graphic),N),this._updateMoveManipulationAngle(a)}_createVisualElements(t){for(const i of t){const e=i.graphic,a=y({view:this.view,graphic:e,forEachManipulator:t=>{i.manipulationXY?.forEachManipulator(t),this._moveManipulation?.forEachManipulator(t)},onManipulatorsChanged:()=>o()});null!=a&&(i.geometryRepresentation=a.visualElement,i.geometryRepresentation instanceof H&&this.addHandles([i.geometryRepresentation.events.on("attachment-origin-changed",(()=>{i.state.isDraped||this._updateMoveManipulation(t)})),r((()=>i.state.isDraped),(()=>this._updateMoveManipulation(t)))],N),this.addHandles(a,N))}}_updateMoveManipulationAngle(t){this._moveManipulation&&(this._moveManipulation.angle=x(t.graphic.geometry))}_updateMoveManipulation(t){const i=u(0,0,0,this.view.spatialReference);let e=0,o=!1;const a=this._moveManipulation;if(a){for(const a of t){if(!a.state.displaying)continue;const t=a.state.graphic;this.enableZ&&M(t)&&(o=!0);const n=a.geometryRepresentation instanceof H&&!a.state.isDraped?a.geometryRepresentation.attachmentOrigin:g(this.view,t);if(null!=n){const{x:t,y:o,z:a}=n;i.x+=t,i.y+=o,a&&(i.z??=0,i.z+=a),e++}}e>0?(i.x/=e,i.y/=e,i.z??=0,i.z/=e,a.location=i,a.xyManipulation.available=!0,a.xyAxisManipulation.available=!0,a.zManipulation.available=o):a.available=!1}}_buildDragEventPipeline(t,i,e,o,a,n){const s=[],r=[];let p=null,l=null;const c=()=>{for(const t of s)t.dragging=!1;s.length=0,r.length=0,p=null,l=null,this._moveManipulation&&(this._moveManipulation.interactive=!0)};if(1===t.length&&i===j.XY){const i=t[0].graphic;({steps:o,cancel:a}=this._buildSnappingPipelineSteps(i,m(i),o,a,n))}return a=a.next((t=>l?.(t))).next((()=>(this.emit("graphic-move-stop",new L(r)),this.destroyed||c(),null))),{steps:o=o.next((i=>{if("start"===i.action){s.length=0,r.length=0;for(const i of t)i.dragging||!i.manipulationXY?.hasManipulator(e)&&i.manipulationXY?.grabbing||(s.push(i),r.push(i.graphic),i.dragging=!0);if(0!==r.length&&(this._moveManipulation&&(this._moveManipulation.interactive=!1),p=U(r,this.view.state.viewingMode),l=D(r),this.emit("graphic-move-start",new C(r)),this.destroyed))return null}return 0!==r.length?i:null})).next((t=>p?.(t))).next((e=>(this._updateMoveTooltip(t,i,e),e))).next((t=>{switch(t.action){case"start":case"update":if(t.translationX||t.translationY||t.translationZ){const i=this.view.toScreen(t.mapStart),e=this.view.toScreen(t.mapEnd),o=e.x-i.x,a=e.y-i.y;if(this.emit("graphic-move",new V(o,a,r)),this.destroyed)return null}break;case"end":if(this.emit("graphic-move-stop",new L(r)),this.destroyed)return null;c()}return null})),cancel:a}}_updateMoveTooltip(t,i,e){const{tooltipOptions:o,_tooltip:a}=this;if(null==a)return;a.clear();const s=0===t.length?"absolute-height":t[0].state.isDraped?"on-the-ground":"absolute-height";switch(i){case j.XY:a.info=new k({tooltipOptions:o}),this._updateMoveTooltipDistance(a.info,e,((t,i)=>F(t,i,s)));break;case j.XY_AXIS:a.info=new R({tooltipOptions:o}),this._updateMoveTooltipDistance(a.info,e,((t,i)=>{const o=F(t,i,s);return n(o,S(e))}));break;case j.Z:a.info=new I({tooltipOptions:o}),this._updateMoveTooltipDistance(a.info,e,Z)}}_updateMoveTooltipDistance(t,i,e){if(null!=i&&"end"!==i.action){const{mapStart:o,mapEnd:a}=i,n=e(o,a);t.distance=null!=n?n:s}}_buildSnappingPipelineSteps(t,i,e,o,a){const n=t.geometry;if(null==n||"point"!==n.type&&"mesh"!==n.type)return{steps:e,cancel:o};const s=("point"===n.type?n:n.anchor).clone(),r=new z({elevationInfo:i,pointer:a,editGeometryOperations:G.fromGeometry(s,this.view.state.viewingMode),visualizer:new f,excludeFeature:t}),p=this.snappingManager,{snappingStep:l,cancelSnapping:c}=A({snappingContext:r,snappingManager:p,updatingHandles:this._updatingHandles});return o=o.next(c),{steps:e=e.next((i=>{s.z=d(this.view,s,m(t),{mode:"absolute-height",offset:0});return{...i,snapOrigin:r.coordinateHelper.pointToVector(s)}})).next(...l),cancel:o}}get test(){return{tooltip:this._tooltip}}};t([l({constructOnly:!0,nonNullable:!0})],q.prototype,"view",void 0),t([l()],q.prototype,"graphics",void 0),t([l({constructOnly:!0,nonNullable:!0})],q.prototype,"enableZ",void 0),t([l({constructOnly:!0,type:Y})],q.prototype,"tooltipOptions",void 0),t([l({constructOnly:!0})],q.prototype,"snappingManager",void 0),t([l()],q.prototype,"type",void 0),t([l()],q.prototype,"updating",null),q=t([c("esri.views.3d.interactive.editingTools.graphicMove3D.GraphicMoveTool")],q);class B{constructor(t){this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1,this.state=new O({graphic:t})}get graphic(){return this.state.graphic}}export{V as GraphicMoveEvent,C as GraphicMoveStartEvent,L as GraphicMoveStopEvent,q as GraphicMoveTool};
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import i from"../../../../../core/Collection.js";import e from"../../../../../core/Evented.js";import{makeHandle as o}from"../../../../../core/handleUtils.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{scale as n,zeroMeters as s}from"../../../../../core/quantityUtils.js";import{watch as r,syncAndInitial as p}from"../../../../../core/reactiveUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as c}from"../../../../../core/support/UpdatingHandles.js";import{makeDehydratedPoint as u}from"../../../../../layers/graphics/dehydratedFeatures.js";import{getGraphicEffectiveElevationInfo as m,getConvertedElevation as d}from"../../../../../support/elevationInfoUtils.js";import{getGraphicAttachmentOrigin as g}from"../../manipulatorUtils.js";import{SnappingVisualizer3D as f}from"../../SnappingVisualizer3D.js";import{SupportedGraphicResult as v}from"../isSupportedGraphicUtils.js";import{canMoveZ as M}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as _}from"../meshFastUpdateUtils.js";import{createVisualElements as y}from"../visualElementUtils.js";import{DISC_RADIUS as w}from"../manipulations/config.js";import{ManipulationType as j,MoveManipulation as b}from"../manipulations/MoveManipulation.js";import{shapeOrientation as x,axisConstrainedDragSign as S}from"../manipulations/moveUtils.js";import{MoveXYGraphicManipulation as E}from"../manipulations/MoveXYGraphicManipulation.js";import{isSupportedGraphic as T}from"./isSupportedGraphic.js";import{OutlineVisualElement as H}from"../../visualElements/OutlineVisualElement.js";import{GraphicState as O}from"../../../layers/graphics/GraphicState.js";import{dragGraphicMany as U,resetGraphicMany as D}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as X}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as G}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import Y from"../../../../interactive/sketch/SketchTooltipOptions.js";import{SnappingContext as z}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as A}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{Tooltip as P}from"../../../../interactive/tooltip/Tooltip.js";import{TranslateGraphicTooltipInfo as k,TranslateGraphicZTooltipInfo as I,TranslateGraphicXYTooltipInfo as R}from"../../../../interactive/tooltip/TranslateTooltipInfos.js";import{autoHorizontalDistanceByElevationModeBetweenPoints as F}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as Z}from"../../../../support/euclideanLengthMeasurementUtils.js";class C{constructor(t){this.allGraphics=t,this.type="graphic-move-start"}}class V{constructor(t,i,e){this.dx=t,this.dy=i,this.allGraphics=e,this.type="graphic-move"}}class L{constructor(t){this.allGraphics=t,this.type="graphic-move-stop"}}const N="manipulators";let q=class extends(e.EventedMixin(X)){constructor(t){super(t),this._infos=new Map,this.graphics=new i,this.enableZ=!0,this.tooltipOptions=new Y,this.type="move-3d",this._updatingHandles=new c,this._moveManipulation=null,this._tooltip=null}initialize(){const{view:t}=this;this.addHandles([this.graphics.on("change",(t=>{t.removed.forEach((t=>this.removeHandles(t))),this._updateGraphicInfos(t),this._setupFastTransformUpdates(t.added),this._refreshManipulators()})),r((()=>this.tooltipOptions.enabled),(i=>{this._tooltip=i?new P({view:t}):a(this._tooltip)}),p)]);const i=this.graphics.toArray();this._updateGraphicInfos({added:i,removed:[]}),this._setupFastTransformUpdates(i),this._refreshManipulators(),this.finishToolCreation()}destroy(){this._tooltip=a(this._tooltip),this._moveManipulation=a(this._moveManipulation),this._set("view",null),this._updatingHandles.destroy()}get updating(){return this._updatingHandles.updating}reset(){}_updateGraphicInfos({added:t,removed:i}){for(const e of t){if(T(e)!==v.SUPPORTED)continue;const t=new B(e),i=this.view.trackGraphicState(t.state);this._infos.set(t.graphic,{info:t,handle:i})}for(const e of i)this._infos.get(e)?.handle.remove(),this._infos.delete(e)}_setupFastTransformUpdates(t){for(const i of t){const{info:t}=this._infos.get(i);this.addHandles(_(t.state),i)}}_refreshManipulators(){if(this.removeHandles(N),this._moveManipulation=a(this._moveManipulation),this.manipulators.removeAll(),0===this._infos.size)return;const t=Array.from(this._infos.values(),(({info:t})=>t));this._createManipulators(t),this._createVisualElements(t),this._updateMoveManipulation(t)}_createManipulators(t){for(const i of t){const e=i.state;i.manipulationXY=new E({tool:this,view:this.view,graphicState:e}),i.manipulationXY.forEachManipulator((t=>this.addHandles([t.events.on("immediate-click",(t=>{this.emit("immediate-click",{...t,graphic:e.graphic}),t.stopPropagation()})),t.events.on("grab-changed",(({action:t})=>{const{tooltipOptions:i,_tooltip:e}=this;null!=e&&("start"===t?e.info=new k({tooltipOptions:i}):e.clear())}))],N))),this.addHandles(i.manipulationXY.createDragPipeline(((i,e,o,a)=>this._buildDragEventPipeline(t,j.XY,i,e,o,a))),N)}this._createMoveManipulation(t)}_createMoveManipulation(t){const i=new b({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:1===t.length?b.radiusForSymbol(t[0].graphic.symbol):w});this._moveManipulation=i,i.elevationInfo={mode:"absolute-height",offset:0},i.forEachManipulator((t=>{this.addHandles(t.events.on("immediate-click",(e=>{i.zManipulation.hasManipulator(t)||1!==this.graphics.length||this.emit("immediate-click",{...e,graphic:this.graphics.at(0)}),e.stopPropagation()})),N)}));const e=i=>e=>{this.addHandles(e.events.on("focus-changed",(({action:e})=>{const o=this._tooltip;null!=o&&("focus"===e?this._updateMoveTooltip(t,i):o.clear())})),N)};this._moveManipulation.xyManipulation.forEachManipulator(e(j.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(e(j.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(e(j.Z));const o=()=>this._updateMoveManipulation(t);for(const n of t)this.addHandles([n.state.on("changed",o),r((()=>n.state.displaying),o)],N);const a=t[t.length-1];this.addHandles(a.state.on("changed",(()=>this._updateMoveManipulationAngle(a))),N),this.addHandles(i.createDragPipeline(((i,e,o,a,n)=>this._buildDragEventPipeline(t,i,e,o,a,n)),m(a.graphic),a.graphic.geometry.spatialReference,a.graphic),N),this._updateMoveManipulationAngle(a)}_createVisualElements(t){for(const i of t){const e=i.graphic,a=y({view:this.view,graphic:e,forEachManipulator:t=>{i.manipulationXY?.forEachManipulator(t),this._moveManipulation?.forEachManipulator(t)},onManipulatorsChanged:()=>o()});null!=a&&(i.geometryRepresentation=a.visualElement,i.geometryRepresentation instanceof H&&this.addHandles([i.geometryRepresentation.events.on("attachment-origin-changed",(()=>{i.state.isDraped||this._updateMoveManipulation(t)})),r((()=>i.state.isDraped),(()=>this._updateMoveManipulation(t)))],N),this.addHandles(a,N))}}_updateMoveManipulationAngle(t){this._moveManipulation&&(this._moveManipulation.angle=x(t.graphic.geometry))}_updateMoveManipulation(t){const i=u(0,0,0,this.view.spatialReference);let e=0,o=!1;const a=this._moveManipulation;if(a){for(const a of t){if(!a.state.displaying)continue;const t=a.state.graphic;this.enableZ&&M(t)&&(o=!0);const n=a.geometryRepresentation instanceof H&&!a.state.isDraped?a.geometryRepresentation.attachmentOrigin:g(this.view,t);if(null!=n){const{x:t,y:o,z:a}=n;i.x+=t,i.y+=o,a&&(i.z??=0,i.z+=a),e++}}e>0?(i.x/=e,i.y/=e,i.z??=0,i.z/=e,a.location=i,a.xyManipulation.available=!0,a.xyAxisManipulation.available=!0,a.zManipulation.available=o):a.available=!1}}_buildDragEventPipeline(t,i,e,o,a,n){const s=[],r=[];let p=null,l=null;const h=()=>{for(const t of s)t.dragging=!1;s.length=0,r.length=0,p=null,l=null,this._moveManipulation&&(this._moveManipulation.interactive=!0)};if(1===t.length&&i===j.XY){const i=t[0].graphic;({steps:o,cancel:a}=this._buildSnappingPipelineSteps(i,m(i),o,a,n))}return a=a.next((t=>l?.(t))).next((()=>(this.emit("graphic-move-stop",new L(r)),this.destroyed||h(),null))),{steps:o=o.next((i=>{if("start"===i.action){s.length=0,r.length=0;for(const i of t)i.dragging||!i.manipulationXY?.hasManipulator(e)&&i.manipulationXY?.grabbing||(s.push(i),r.push(i.graphic),i.dragging=!0);if(0!==r.length&&(this._moveManipulation&&(this._moveManipulation.interactive=!1),p=U(r,this.view.state.viewingMode),l=D(r),this.emit("graphic-move-start",new C(r)),this.destroyed))return null}return 0!==r.length?i:null})).next((t=>p?.(t))).next((e=>(this._updateMoveTooltip(t,i,e),e))).next((t=>{switch(t.action){case"start":case"update":if(t.translationX||t.translationY||t.translationZ){const i=this.view.toScreen(t.mapStart),e=this.view.toScreen(t.mapEnd),o=e.x-i.x,a=e.y-i.y;if(this.emit("graphic-move",new V(o,a,r)),this.destroyed)return null}break;case"end":if(this.emit("graphic-move-stop",new L(r)),this.destroyed)return null;h()}return null})),cancel:a}}_updateMoveTooltip(t,i,e){const{tooltipOptions:o,_tooltip:a}=this;if(null==a)return;a.clear();const s=0===t.length?"absolute-height":t[0].state.isDraped?"on-the-ground":"absolute-height";switch(i){case j.XY:a.info=new k({tooltipOptions:o}),this._updateMoveTooltipDistance(a.info,e,((t,i)=>F(t,i,s)));break;case j.XY_AXIS:a.info=new R({tooltipOptions:o}),this._updateMoveTooltipDistance(a.info,e,((t,i)=>{const o=F(t,i,s);return n(o,S(e))}));break;case j.Z:a.info=new I({tooltipOptions:o}),this._updateMoveTooltipDistance(a.info,e,Z)}}_updateMoveTooltipDistance(t,i,e){if(null!=i&&"end"!==i.action){const{mapStart:o,mapEnd:a}=i,n=e(o,a);t.distance=null!=n?n:s}}_buildSnappingPipelineSteps(t,i,e,o,a){const n=t.geometry;if(null==n||"point"!==n.type&&"mesh"!==n.type)return{steps:e,cancel:o};const s=("point"===n.type?n:n.anchor).clone(),r=new z({elevationInfo:i,pointer:a,editGeometryOperations:G.fromGeometry(s,this.view.state.viewingMode),visualizer:new f,excludeFeature:t}),p=this.snappingManager,{snappingStep:l,cancelSnapping:h}=A({snappingContext:r,snappingManager:p,updatingHandles:this._updatingHandles});return o=o.next(h),{steps:e=e.next((i=>{s.z=d(this.view,s,m(t),{mode:"absolute-height",offset:0});return{...i,snapOrigin:r.coordinateHelper.pointToVector(s)}})).next(...l),cancel:o}}get test(){return{tooltip:this._tooltip}}};t([l({constructOnly:!0,nonNullable:!0})],q.prototype,"view",void 0),t([l()],q.prototype,"graphics",void 0),t([l({constructOnly:!0,nonNullable:!0})],q.prototype,"enableZ",void 0),t([l({constructOnly:!0,type:Y})],q.prototype,"tooltipOptions",void 0),t([l({constructOnly:!0})],q.prototype,"snappingManager",void 0),t([l()],q.prototype,"type",void 0),t([l()],q.prototype,"updating",null),q=t([h("esri.views.3d.interactive.editingTools.graphicMove3D.GraphicMoveTool")],q);class B{constructor(t){this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1,this.state=new O({graphic:t})}get graphic(){return this.state.graphic}}export{V as GraphicMoveEvent,C as GraphicMoveStartEvent,L as GraphicMoveStopEvent,q as GraphicMoveTool};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{c as e}from"../../../../chunks/vec3.js";import{c as t,a as i}from"../../../../chunks/vec3f64.js";import{create as n,fromValues as s,copy as r}from"../../../../geometry/support/lineSegment.js";import{VisualElement as l}from"./VisualElement.js";import{LaserLineRenderer as h}from"../../support/LaserLineRenderer.js";import{d as a}from"../../../../chunks/Laserlines.glsl.js";class c extends l{constructor(e){super(e),this._angleCutoff=a,this._style={},this._heightManifoldTarget=t(),this._heightManifoldEnabled=!1,this._intersectsLine=n(),this._intersectsLineEnabled=!1,this._intersectsLineInfinite=!1,this._lineVerticalPlaneSegment=null,this._pathVerticalPlaneBuffers=null,this._pointDistanceLine=null,this.applyProperties(e)}get testData(){return this._renderer}createResources(){this._ensureRenderer()}destroyResources(){this._disposeRenderer()}updateVisibility(){this._syncRenderer(),this._syncHeightManifold(),this._syncIntersectsLine(),this._syncPathVerticalPlane(),this._syncLineVerticalPlane(),this._syncPointDistance()}get angleCutoff(){return this._angleCutoff}set angleCutoff(e){this._angleCutoff!==e&&(this._angleCutoff=e,this._syncAngleCutoff())}get style(){return this._style}set style(e){this._style=e,this._syncStyle()}get heightManifoldTarget(){return this._heightManifoldEnabled?this._heightManifoldTarget:null}set heightManifoldTarget(t){null!=t?(e(this._heightManifoldTarget,t),this._heightManifoldEnabled=!0):this._heightManifoldEnabled=!1,this._syncRenderer(),this._syncHeightManifold()}set intersectsWorldUpAtLocation(e){if(null==e)return void(this.intersectsLine=null);const t=this.view.renderCoordsHelper.worldUpAtPosition(e,_);this.intersectsLine=s(e,t),this.intersectsLineInfinite=!0}get intersectsLine(){return this._intersectsLineEnabled?this._intersectsLine:null}set intersectsLine(e){null!=e?(r(e,this._intersectsLine),this._intersectsLineEnabled=!0):this._intersectsLineEnabled=!1,this._syncIntersectsLine(),this._syncRenderer()}get intersectsLineInfinite(){return this._intersectsLineInfinite}set intersectsLineInfinite(e){this._intersectsLineInfinite=e,this._syncIntersectsLineInfinite()}get lineVerticalPlaneSegment(){return this._lineVerticalPlaneSegment}set lineVerticalPlaneSegment(e){this._lineVerticalPlaneSegment=null!=e?r(e):null,this._syncLineVerticalPlane(),this._syncRenderer()}get pathVerticalPlane(){return this._pathVerticalPlaneBuffers}set pathVerticalPlane(e){this._pathVerticalPlaneBuffers=e,this._syncPathVerticalPlane(),this._syncLineVerticalPlane(),this._syncPointDistance(),this._syncRenderer()}get pointDistanceLine(){return this._pointDistanceLine}set pointDistanceLine(e){this._pointDistanceLine=null!=e?{origin:i(e.origin),target:e.target?i(e.target):null}:null,this._syncPointDistance(),this._syncRenderer()}_syncRenderer(){this.attached&&this.visible&&(this._intersectsLineEnabled||this._heightManifoldEnabled||null!=this._pointDistanceLine||null!=this._pathVerticalPlaneBuffers)?this._ensureRenderer():this._disposeRenderer()}_ensureRenderer(){null==this._renderer&&(this._renderer=new h({renderCoordsHelper:this.view.renderCoordsHelper},{contrastControlEnabled:!0,isDecoration:this.isDecoration}),this._renderer.viewingMode=this.view.state.viewingMode,this._syncStyle(),this._syncHeightManifold(),this._syncIntersectsLine(),this._syncIntersectsLineInfinite(),this._syncPathVerticalPlane(),this._syncLineVerticalPlane(),this._syncPointDistance(),this._syncAngleCutoff(),this.view._stage&&this.view._stage.addRenderPlugin(this._renderer))}_syncStyle(){null!=this._renderer&&(this._renderer.setParameters(this._style),null!=this._style.intersectsLineRadius&&(this._renderer.intersectsLineRadius=this._style.intersectsLineRadius))}_syncAngleCutoff(){null!=this._renderer&&this._renderer.setParameters({angleCutoff:this._angleCutoff})}_syncHeightManifold(){null!=this._renderer&&(this._renderer.heightManifoldEnabled=this._heightManifoldEnabled&&this.visible,this._heightManifoldEnabled&&(this._renderer.heightManifoldTarget=this._heightManifoldTarget))}_syncIntersectsLine(){null!=this._renderer&&(this._renderer.intersectsLineEnabled=this._intersectsLineEnabled&&this.visible,this._intersectsLineEnabled&&(this._renderer.intersectsLineSegment=this._intersectsLine))}_syncIntersectsLineInfinite(){null!=this._renderer&&(this._renderer.intersectsLineInfinite=this._intersectsLineInfinite)}_syncPathVerticalPlane(){null!=this._renderer&&(this._renderer.pathVerticalPlaneEnabled=null!=this._pathVerticalPlaneBuffers&&this.visible,null!=this._pathVerticalPlaneBuffers&&(this._renderer.pathVerticalPlaneBuffers=this._pathVerticalPlaneBuffers))}_syncLineVerticalPlane(){null!=this._renderer&&(this._renderer.lineVerticalPlaneEnabled=null!=this._lineVerticalPlaneSegment&&this.visible,null!=this._lineVerticalPlaneSegment&&(this._renderer.lineVerticalPlaneSegment=this._lineVerticalPlaneSegment))}_syncPointDistance(){if(null==this._renderer)return;const e=this._pointDistanceLine,t=null!=e;this._renderer.pointDistanceEnabled=t&&null!=e.target&&this.visible,t&&(this._renderer.pointDistanceOrigin=e.origin,null!=e.target&&(this._renderer.pointDistanceTarget=e.target))}_disposeRenderer(){null!=this._renderer&&this.view._stage&&(this.view._stage.removeRenderPlugin(this._renderer),this._renderer=null)}}const _=t();export{c as LaserlineVisualElement};
5
+ import{c as e}from"../../../../chunks/vec3.js";import{c as t,a as i}from"../../../../chunks/vec3f64.js";import{create as n,fromValues as s,copy as r}from"../../../../geometry/support/lineSegment.js";import{VisualElement as l}from"./VisualElement.js";import{LaserLineRenderer as h}from"../../support/LaserLineRenderer.js";import{d as a}from"../../../../chunks/Laserlines.glsl.js";class c extends l{constructor(e){super(e),this._angleCutoff=a,this._style={},this._heightManifoldTarget=t(),this._heightManifoldEnabled=!1,this._intersectsLine=n(),this._intersectsLineEnabled=!1,this._intersectsLineInfinite=!1,this._lineVerticalPlaneSegment=null,this._pathVerticalPlaneBuffers=null,this._pointDistanceLine=null,this.applyProperties(e)}get testData(){return this._renderer}createResources(){this._ensureRenderer()}destroyResources(){this._disposeRenderer()}updateVisibility(){this._syncRenderer(),this._syncHeightManifold(),this._syncIntersectsLine(),this._syncPathVerticalPlane(),this._syncLineVerticalPlane(),this._syncPointDistance()}get angleCutoff(){return this._angleCutoff}set angleCutoff(e){this._angleCutoff!==e&&(this._angleCutoff=e,this._syncAngleCutoff())}get style(){return this._style}set style(e){this._style=e,this._syncStyle()}get heightManifoldTarget(){return this._heightManifoldEnabled?this._heightManifoldTarget:null}set heightManifoldTarget(t){null!=t?(e(this._heightManifoldTarget,t),this._heightManifoldEnabled=!0):this._heightManifoldEnabled=!1,this._syncRenderer(),this._syncHeightManifold()}set intersectsWorldUpAtLocation(e){if(null==e)return void(this.intersectsLine=null);const t=this.view.renderCoordsHelper.worldUpAtPosition(e,_);this.intersectsLine=s(e,t),this.intersectsLineInfinite=!0}get intersectsLine(){return this._intersectsLineEnabled?this._intersectsLine:null}set intersectsLine(e){null!=e?(r(e,this._intersectsLine),this._intersectsLineEnabled=!0):this._intersectsLineEnabled=!1,this._syncIntersectsLine(),this._syncRenderer()}get intersectsLineInfinite(){return this._intersectsLineInfinite}set intersectsLineInfinite(e){this._intersectsLineInfinite=e,this._syncIntersectsLineInfinite()}get lineVerticalPlaneSegment(){return this._lineVerticalPlaneSegment}set lineVerticalPlaneSegment(e){this._lineVerticalPlaneSegment=null!=e?r(e):null,this._syncLineVerticalPlane(),this._syncRenderer()}get pathVerticalPlane(){return this._pathVerticalPlaneBuffers}set pathVerticalPlane(e){this._pathVerticalPlaneBuffers=e,this._syncPathVerticalPlane(),this._syncLineVerticalPlane(),this._syncPointDistance(),this._syncRenderer()}get pointDistanceLine(){return this._pointDistanceLine}set pointDistanceLine(e){this._pointDistanceLine=null!=e?{origin:i(e.origin),target:e.target?i(e.target):null}:null,this._syncPointDistance(),this._syncRenderer()}_syncRenderer(){this.attached&&this.visible&&(this._intersectsLineEnabled||this._heightManifoldEnabled||null!=this._pointDistanceLine||null!=this._pathVerticalPlaneBuffers)?this._ensureRenderer():this._disposeRenderer()}_ensureRenderer(){null==this._renderer&&(this._renderer=new h({renderCoordsHelper:this.view.renderCoordsHelper,contrastControlEnabled:!0,_isDecoration:this.isDecoration}),this._renderer.viewingMode=this.view.state.viewingMode,this._syncStyle(),this._syncHeightManifold(),this._syncIntersectsLine(),this._syncIntersectsLineInfinite(),this._syncPathVerticalPlane(),this._syncLineVerticalPlane(),this._syncPointDistance(),this._syncAngleCutoff(),this.view._stage&&this.view._stage.addRenderPlugin(this._renderer))}_syncStyle(){null!=this._renderer&&(this._renderer.setParameters(this._style),null!=this._style.intersectsLineRadius&&(this._renderer.intersectsLineRadius=this._style.intersectsLineRadius))}_syncAngleCutoff(){null!=this._renderer&&this._renderer.setParameters({angleCutoff:this._angleCutoff})}_syncHeightManifold(){null!=this._renderer&&(this._renderer.heightManifoldEnabled=this._heightManifoldEnabled&&this.visible,this._heightManifoldEnabled&&(this._renderer.heightManifoldTarget=this._heightManifoldTarget))}_syncIntersectsLine(){null!=this._renderer&&(this._renderer.intersectsLineEnabled=this._intersectsLineEnabled&&this.visible,this._intersectsLineEnabled&&(this._renderer.intersectsLineSegment=this._intersectsLine))}_syncIntersectsLineInfinite(){null!=this._renderer&&(this._renderer.intersectsLineInfinite=this._intersectsLineInfinite)}_syncPathVerticalPlane(){null!=this._renderer&&(this._renderer.pathVerticalPlaneEnabled=null!=this._pathVerticalPlaneBuffers&&this.visible,null!=this._pathVerticalPlaneBuffers&&(this._renderer.pathVerticalPlaneBuffers=this._pathVerticalPlaneBuffers))}_syncLineVerticalPlane(){null!=this._renderer&&(this._renderer.lineVerticalPlaneEnabled=null!=this._lineVerticalPlaneSegment&&this.visible,null!=this._lineVerticalPlaneSegment&&(this._renderer.lineVerticalPlaneSegment=this._lineVerticalPlaneSegment))}_syncPointDistance(){if(null==this._renderer)return;const e=this._pointDistanceLine,t=null!=e;this._renderer.pointDistanceEnabled=t&&null!=e.target&&this.visible,t&&(this._renderer.pointDistanceOrigin=e.origin,null!=e.target&&(this._renderer.pointDistanceTarget=e.target))}_disposeRenderer(){null!=this._renderer&&this.view._stage&&(this.view._stage.removeRenderPlugin(this._renderer),this._renderer=null)}}const _=t();export{c as LaserlineVisualElement};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{whenOnce as r}from"../../../core/reactiveUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{LayerView3D as a}from"./LayerView3D.js";import{TiledLayerView3D as l}from"./TiledLayerView3D.js";import{RasterTile as n}from"../terrain/RasterTile.js";import o from"../../layers/ImageryTileLayerView.js";import m from"../../layers/LayerView.js";import p from"../../layers/RefreshableLayerView.js";import{createQueryGeometry as h}from"../../support/drapedUtils.js";import{getWebGLCapabilities as c}from"../../webgl/capabilities.js";let d=class extends(o(p(l(a(m))))){constructor(){super(...arguments),this.type="imagery-tile-3d",this.isAlignedMapTile=!0}initialize(){this.layer.increaseRasterJobHandlerUsage(),null==this.fullExtent&&this.addResolvingPromise(Promise.reject(new t("layerview:spatial-reference-incompatible","The layer extent cannot be projected to the view's spatial reference",{layer:this.layer})));const e=r((()=>this.view?.basemapTerrain?.tilingSchemeLocked)).then((()=>{const e=this.view.basemapTerrain.tilingScheme,t=this.layer.tileInfo,r=["png","png24","png32","jpg","mixed"].includes(t.format)&&e.compatibleWith(t);this.isAlignedMapTile=r;const i=r?t:e.toTileInfo();this.tileInfo=i,this._updatingHandles.add((()=>[this.layer.renderer,this.layer.interpolation,this.layer.bandIds,this.layer.multidimensionalDefinition,this.layer.multidimensionalSubset,this.layer.rasterFunction,this.timeExtent]),(()=>this.refresh()))}));this.addResolvingPromise(e)}destroy(){this.layer.decreaseRasterJobHandlerUsage(),this.view=null}get _blankTile(){const e=document.createElement("canvas"),t=e.getContext("2d"),[r,i]=this.tileInfo.size;return e.width=r,e.height=i,t.clearRect(0,0,r,i),t.getImageData(0,0,r,i)}get imageFormatIsOpaque(){return"jpg"===this.layer.tileInfo.format}get hasMixedImageFormats(){return"mixed"===this.layer.tileInfo.format}get dataLevelRange(){const e=this.tileInfo.lods,t=this.layer.tileInfo.lods,r=e[0].scale,i=t.at(-1).scale;return this.levelRangeFromScaleRange(r,i)}_getfullExtent(){return this.projectFullExtent(this.view.basemapTerrain&&null!=this.view.basemapTerrain.spatialReference?this.view.basemapTerrain.spatialReference:this.view.spatialReference)}async fetchTile(e,t,r,i){const s=this.tileInfo,a=this._canSymbolizeInWebGL(),l={tileInfo:s,requestRawData:a,signal:i.signal,timeExtent:this.timeExtent,requestAsImageElement:this.isAlignedMapTile},o=await this.layer.fetchTile(e,t,r,l);if(o instanceof HTMLImageElement)return o;let m=o&&o.pixelBlock;if(null==m)return this._blankTile;if(!a&&(m=await this.layer.applyRenderer(o),null==m))return this._blankTile;const p=new n([e,t,r],m,s.size[0],s.size[1]);return a?(p.symbolizerRenderer=this.layer.symbolizer.rendererJSON,p.symbolizerParameters=this.layer.symbolizer.generateWebGLParameters(this._getSymbolizerOptions(e)),p.transformGrid=o.transformGrid):p.isRendereredSource=!0,p.interpolation=this.layer.interpolation,p.bandIds=this.layer.bandIds,p}_getSymbolizerOptions(e){const t=this.tileInfo.lodAt(e).resolution;return{pixelBlock:null,isGCS:this.view.basemapTerrain&&null!=this.view.basemapTerrain.spatialReference?this.view.basemapTerrain.spatialReference.isGeographic:this.view.spatialReference.isGeographic,resolution:{x:t,y:t},bandIds:this.layer.bandIds}}ensureSymbolizerParameters(e){this._canSymbolizeInWebGL()&&JSON.stringify(e.symbolizerRenderer)!==JSON.stringify(this.layer.symbolizer.rendererJSON)&&(e.symbolizerParameters=this.layer.symbolizer.generateWebGLParameters(this._getSymbolizerOptions(e.lij[0])))}createFetchPopupFeaturesQueryGeometry(e,t){return h(e,t,this.view)}refresh(){this.emit("data-changed")}async doRefresh(){this.suspended||this.emit("data-changed")}_canSymbolizeInWebGL(){const e=c("3d"),{symbolizer:t}=this.layer,r=t.lookup?.colormapLut?.indexedColormap,i=r&&r.length>4*(e.maxTextureSize||4906);return e.supportsTextureFloat&&t.canRenderInWebGL&&!i}};e([i({readOnly:!0})],d.prototype,"_blankTile",null),e([i({readOnly:!0})],d.prototype,"imageFormatIsOpaque",null),e([i({readOnly:!0})],d.prototype,"hasMixedImageFormats",null),e([i({readOnly:!0})],d.prototype,"dataLevelRange",null),d=e([s("esri.views.3d.layers.ImageryTileLayerView3D")],d);const y=d;export{y as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Error.js";import{whenOnce as t}from"../../../core/reactiveUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{projectDatasetExtent as a}from"../../../layers/support/rasterFunctions/rasterProjectionHelper.js";import{LayerView3D as l}from"./LayerView3D.js";import{TiledLayerView3D as n}from"./TiledLayerView3D.js";import{RasterTile as o}from"../terrain/RasterTile.js";import m from"../../layers/ImageryTileLayerView.js";import p from"../../layers/LayerView.js";import h from"../../layers/RefreshableLayerView.js";import{createQueryGeometry as c}from"../../support/drapedUtils.js";import{getWebGLCapabilities as y}from"../../webgl/capabilities.js";let d=class extends(m(h(n(l(p))))){constructor(){super(...arguments),this.type="imagery-tile-3d",this.isAlignedMapTile=!0}initialize(){this.layer.increaseRasterJobHandlerUsage(),null==this.fullExtent&&this.addResolvingPromise(Promise.reject(new r("layerview:spatial-reference-incompatible","The layer extent cannot be projected to the view's spatial reference",{layer:this.layer})));const e=t((()=>this.view?.basemapTerrain?.tilingSchemeLocked)).then((()=>{const e=this.view.basemapTerrain.tilingScheme,r=this.layer.tileInfo,t=["png","png24","png32","jpg","mixed"].includes(r.format)&&e.compatibleWith(r);this.isAlignedMapTile=t;const i=t?r:e.toTileInfo();this.tileInfo=i,this._updatingHandles.add((()=>[this.layer.renderer,this.layer.interpolation,this.layer.bandIds,this.layer.multidimensionalDefinition,this.layer.multidimensionalSubset,this.layer.rasterFunction,this.timeExtent]),(()=>this.refresh()))}));this.addResolvingPromise(e)}destroy(){this.layer.decreaseRasterJobHandlerUsage(),this.view=null}get _blankTile(){const e=document.createElement("canvas"),r=e.getContext("2d"),[t,i]=this.tileInfo.size;return e.width=t,e.height=i,r.clearRect(0,0,t,i),r.getImageData(0,0,t,i)}get imageFormatIsOpaque(){return"jpg"===this.layer.tileInfo.format}get hasMixedImageFormats(){return"mixed"===this.layer.tileInfo.format}get dataLevelRange(){const e=this.tileInfo.lods,r=this.layer.tileInfo.lods,t=e[0].scale,i=r[r.length-1].scale;return this.levelRangeFromScaleRange(t,i)}_getfullExtent(){return a(this.layer.rasterInfo,this.view.basemapTerrain&&null!=this.view.basemapTerrain.spatialReference?this.view.basemapTerrain.spatialReference:this.view.spatialReference)}async fetchTile(e,r,t,i){const s=this.tileInfo,a=this._canSymbolizeInWebGL(),l={tileInfo:s,requestRawData:a,signal:i.signal,timeExtent:this.timeExtent,requestAsImageElement:this.isAlignedMapTile},n=await this.layer.fetchTile(e,r,t,l);if(n instanceof HTMLImageElement)return n;let m=n&&n.pixelBlock;if(null==m)return this._blankTile;if(!a&&(m=await this.layer.applyRenderer(n),null==m))return this._blankTile;const p=new o([e,r,t],m,s.size[0],s.size[1]);return a?(p.symbolizerRenderer=this.layer.symbolizer.rendererJSON,p.symbolizerParameters=this.layer.symbolizer.generateWebGLParameters(this._getSymbolizerOptions(e)),p.transformGrid=n.transformGrid):p.isRendereredSource=!0,p.interpolation=this.layer.interpolation,p.bandIds=this.layer.bandIds,p}_getSymbolizerOptions(e){const r=this.tileInfo.lodAt(e).resolution;return{pixelBlock:null,isGCS:this.view.basemapTerrain&&null!=this.view.basemapTerrain.spatialReference?this.view.basemapTerrain.spatialReference.isGeographic:this.view.spatialReference.isGeographic,resolution:{x:r,y:r},bandIds:this.layer.bandIds}}ensureSymbolizerParameters(e){this._canSymbolizeInWebGL()&&JSON.stringify(e.symbolizerRenderer)!==JSON.stringify(this.layer.symbolizer.rendererJSON)&&(e.symbolizerParameters=this.layer.symbolizer.generateWebGLParameters(this._getSymbolizerOptions(e.lij[0])))}createFetchPopupFeaturesQueryGeometry(e,r){return c(e,r,this.view)}refresh(){this.emit("data-changed")}async doRefresh(){this.suspended||this.emit("data-changed")}_canSymbolizeInWebGL(){const e=y("3d"),{symbolizer:r}=this.layer,t=r.lookup?.colormapLut?.indexedColormap,i=t&&t.length>4*(e.maxTextureSize||4906);return e.supportsTextureFloat&&r.canRenderInWebGL&&!i}};e([i({readOnly:!0})],d.prototype,"_blankTile",null),e([i({readOnly:!0})],d.prototype,"imageFormatIsOpaque",null),e([i({readOnly:!0})],d.prototype,"hasMixedImageFormats",null),e([i({readOnly:!0})],d.prototype,"dataLevelRange",null),d=e([s("esri.views.3d.layers.ImageryTileLayerView3D")],d);const u=d;export{u 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.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{whenOnce as i}from"../../../core/reactiveUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{updatingProgress as l,updatingProgressValue as s}from"../support/updatingProperties.js";import{checkIfTileInfoSupportedForView as n}from"../terrain/terrainUtils.js";const o=o=>{let c=class extends o{get imageFormatIsOpaque(){return!1}get fullExtent(){return this.layer.fullExtent}get isOpaque(){return this.fullOpacity>=1&&this.imageFormatIsOpaque}get dataScaleRange(){const e=this.tileInfo.lods;let t=e[0].scale,i=e.at(-1).scale;if("tilemapCache"in this.layer&&this.layer.tilemapCache){const{effectiveMinLOD:e,effectiveMaxLOD:r}=this.layer.tilemapCache;t=this.tileInfo.lodAt(e).scale,i=this.tileInfo.lodAt(r).scale}return{minScale:t,maxScale:i}}get dataLevelRange(){const{minScale:e,maxScale:t}=this.dataScaleRange;return this.levelRangeFromScaleRange(e,t)}get displayLevelRange(){const e=this.layer.minScale||this.dataScaleRange.minScale,t=this.layer.maxScale||this.dataScaleRange.maxScale,i=this.levelRangeFromScaleRange(e,t);return this.layer.maxScale&&i.maxLevel++,i}getTileUrl(e,t,i){return this.layer.getTileUrl(e,t,i)}_addTilingSchemeMatchPromise(){if(null==this.fullExtent)return this.addResolvingPromise(Promise.reject(new t("tilingscheme:extent-not-defined","This layer doesn't define a fullExtent.")));const e=this._getTileInfoSupportError(this.tileInfo,this.fullExtent);if(null!=e)return this.addResolvingPromise(Promise.reject(e));const r=i((()=>this.view?.basemapTerrain?.tilingSchemeLocked)).then((()=>{const e=this.view.basemapTerrain.tilingScheme,t=this._getTileInfoCompatibilityError(this.tileInfo,e);if(t)throw t}));this.addResolvingPromise(r)}_getTileInfoSupportError(e,i){const r=n(e,i,this.view.spatialReference,this.view.state.viewingMode);if(r){const e={layer:this.layer,error:r};let i;switch(r.name){case"tilingscheme:spatial-reference-mismatch":case"tilingscheme:global-unsupported-spatial-reference":case"tilingscheme:local-unsupported-spatial-reference":i=new t("layerview:spatial-reference-incompatible","The spatial reference of this layer does not meet the requirements of the view",e);break;default:i=new t("layerview:tiling-scheme-unsupported","The tiling scheme of this layer is not supported by SceneView",e)}return i}return null}_getTileInfoCompatibilityError(e,i){return null!=e&&i.compatibleWith(e)?null:new t("layerview:tiling-scheme-incompatible","The tiling scheme of this layer is incompatible with the tiling scheme of the surface")}levelRangeFromScaleRange(e,t){const i={minLevel:0,maxLevel:1/0},r=this.view&&this.view.basemapTerrain&&this.view.basemapTerrain.tilingScheme;if(!r)return i;const a=r.levels[0],l=e=>{const t=Math.log(a.scale/e)/Math.LN2;return.5-Math.abs(.5-t%1)<1e-9?Math.round(t):Math.ceil(t)};return null!=e&&e>0&&(i.minLevel=Math.max(0,l(e))),null!=t&&t>0&&(i.maxLevel=Math.max(0,l(t))),i}isUpdating(){return!!(this.view&&this.view.basemapTerrain&&this.view.basemapTerrain.updating)}};return e([r({readOnly:!0})],c.prototype,"imageFormatIsOpaque",null),e([r({readOnly:!0})],c.prototype,"updating",void 0),e([r(l)],c.prototype,"updatingProgress",void 0),e([r(s)],c.prototype,"updatingProgressValue",void 0),e([r()],c.prototype,"fullExtent",null),e([r({readOnly:!0})],c.prototype,"isOpaque",null),e([r()],c.prototype,"dataScaleRange",null),e([r({readOnly:!0})],c.prototype,"dataLevelRange",null),e([r({readOnly:!0})],c.prototype,"displayLevelRange",null),e([r()],c.prototype,"layer",void 0),e([r()],c.prototype,"tileInfo",void 0),c=e([a("esri.views.3d.layers.TiledLayerView3D")],c),c};export{o as TiledLayerView3D};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{whenOnce as i}from"../../../core/reactiveUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{updatingProgress as l,updatingProgressValue as s}from"../support/updatingProperties.js";import{checkIfTileInfoSupportedForView as n}from"../terrain/terrainUtils.js";const o=o=>{let c=class extends o{get imageFormatIsOpaque(){return!1}get fullExtent(){return this.layer.fullExtent}get isOpaque(){return this.fullOpacity>=1&&this.imageFormatIsOpaque}get dataScaleRange(){const e=this.tileInfo.lods;let t=e[0].scale,i=e[e.length-1].scale;if("tilemapCache"in this.layer&&this.layer.tilemapCache){const{effectiveMinLOD:e,effectiveMaxLOD:r}=this.layer.tilemapCache;t=this.tileInfo.lodAt(e).scale,i=this.tileInfo.lodAt(r).scale}return{minScale:t,maxScale:i}}get dataLevelRange(){const{minScale:e,maxScale:t}=this.dataScaleRange;return this.levelRangeFromScaleRange(e,t)}get displayLevelRange(){const e=this.layer.minScale||this.dataScaleRange.minScale,t=this.layer.maxScale||this.dataScaleRange.maxScale,i=this.levelRangeFromScaleRange(e,t);return this.layer.maxScale&&i.maxLevel++,i}getTileUrl(e,t,i){return this.layer.getTileUrl(e,t,i)}_addTilingSchemeMatchPromise(){if(null==this.fullExtent)return this.addResolvingPromise(Promise.reject(new t("tilingscheme:extent-not-defined","This layer doesn't define a fullExtent.")));const e=this._getTileInfoSupportError(this.tileInfo,this.fullExtent);if(null!=e)return this.addResolvingPromise(Promise.reject(e));const r=i((()=>this.view?.basemapTerrain?.tilingSchemeLocked)).then((()=>{const e=this.view.basemapTerrain.tilingScheme,t=this._getTileInfoCompatibilityError(this.tileInfo,e);if(t)throw t}));this.addResolvingPromise(r)}_getTileInfoSupportError(e,i){const r=n(e,i,this.view.spatialReference,this.view.state.viewingMode);if(r){const e={layer:this.layer,error:r};let i;switch(r.name){case"tilingscheme:spatial-reference-mismatch":case"tilingscheme:global-unsupported-spatial-reference":case"tilingscheme:local-unsupported-spatial-reference":i=new t("layerview:spatial-reference-incompatible","The spatial reference of this layer does not meet the requirements of the view",e);break;default:i=new t("layerview:tiling-scheme-unsupported","The tiling scheme of this layer is not supported by SceneView",e)}return i}return null}_getTileInfoCompatibilityError(e,i){return null!=e&&i.compatibleWith(e)?null:new t("layerview:tiling-scheme-incompatible","The tiling scheme of this layer is incompatible with the tiling scheme of the surface")}levelRangeFromScaleRange(e,t){const i={minLevel:0,maxLevel:1/0},r=this.view&&this.view.basemapTerrain&&this.view.basemapTerrain.tilingScheme;if(!r)return i;const a=r.levels[0],l=e=>{const t=Math.log(a.scale/e)/Math.LN2;return.5-Math.abs(.5-t%1)<1e-9?Math.round(t):Math.ceil(t)};return null!=e&&e>0&&(i.minLevel=Math.max(0,l(e))),null!=t&&t>0&&(i.maxLevel=Math.max(0,l(t))),i}isUpdating(){return!!(this.view&&this.view.basemapTerrain&&this.view.basemapTerrain.updating)}};return e([r({readOnly:!0})],c.prototype,"imageFormatIsOpaque",null),e([r({readOnly:!0})],c.prototype,"updating",void 0),e([r(l)],c.prototype,"updatingProgress",void 0),e([r(s)],c.prototype,"updatingProgressValue",void 0),e([r()],c.prototype,"fullExtent",null),e([r({readOnly:!0})],c.prototype,"isOpaque",null),e([r()],c.prototype,"dataScaleRange",null),e([r({readOnly:!0})],c.prototype,"dataLevelRange",null),e([r({readOnly:!0})],c.prototype,"displayLevelRange",null),e([r()],c.prototype,"layer",void 0),e([r()],c.prototype,"tileInfo",void 0),c=e([a("esri.views.3d.layers.TiledLayerView3D")],c),c};export{o as TiledLayerView3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import has from"../../../core/has.js";import{disposeMaybe as i,abortMaybe as l,destroyMaybe as r}from"../../../core/maybe.js";import{isAborted as s}from"../../../core/promiseUtils.js";import{whenOnce as o,watch as a,syncAndInitial as n}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{SchemaHelper as m}from"../../2d/engine/vectorTiles/SchemaHelper.js";import p from"../../2d/engine/vectorTiles/TileHandler3D.js";import d from"../../2d/engine/vectorTiles/VTLPainter3D.js";import f from"../../2d/engine/vectorTiles/style/StyleRepository.js";import{LayerView3D as y}from"./LayerView3D.js";import{TiledLayerView3D as g}from"./TiledLayerView3D.js";import{vtlAssumes256PixelSizeAsDefault as v,test as u}from"../terrain/terrainUtils.js";import _ from"../../layers/LayerView.js";let C=class extends(g(y(_))){constructor(){super(...arguments),this._tileHandlerController=null,this.type="vector-tile-3d",this.levelShift=has("disable-feature:vtl-level-shift")?0:1,this.contentZoom=has("disable-feature:vtl-level-shift")?1:1.5}initialize(){if(null==this.layer.fullExtent)return void this.addResolvingPromise(Promise.reject(new t("vectortilelayerview:full-extent-undefined","This layer view's layer does not define a fullExtent.")));const{basemapTerrain:e,spatialReference:i,state:l,viewingMode:r}=this.view,h="local"===r&&!v(i)||u.force512VTL,c=this.layer.tileInfo.spatialReference.isGeographic,y=h?this.layer.tileInfo:this.layer.tileInfo.getOrCreateCompatible(256,c?1:2),g=this._getTileInfoSupportError(y,this.layer.fullExtent);if(null!=g)return this.addResolvingPromise(Promise.reject(g));const _=o((()=>this.view?.basemapTerrain?.tilingSchemeLocked)).then((()=>{const t=e.tilingScheme,i=t.pixelSize,l=256===i?1:2,r=e.spatialReference?.isGeographic&&256===i?1:0,s=e.spatialReference?.isGeographic||256!==i?0:1;let o;if(this.schemaHelper=new m(l,r,this.levelShift+s),256===i){const e=this.layer.tileInfo.spatialReference.isGeographic;o=this.layer.tileInfo.getOrCreateCompatible(256,e?1:2)}else o=this.view.spatialReference?.isGeographic?this.layer.tileInfo.getOrCreateCompatible(512,.5):this.layer.tileInfo;const a=this._getTileInfoCompatibilityError(o,t);if(a)throw a;this.tileInfo=o}));this._tileHandlerController=new AbortController;const C=this.view.resourceController;this._memCache=C.memoryController.newCache(`vtl-${this.layer.uid}`,(e=>{e.release()})),this.addHandles(a((()=>this.view.qualitySettings.memoryLimit),(e=>this._memCache.maxSize=Math.ceil(e/10*1048576)),n));const S=new f(this.layer.currentStyleInfo.style);this._tileHandler=new p(this.layer,S,l.contentPixelRatio,this._memCache);const w=this._tileHandlerController.signal,R=H(C),j=this._tileHandler.start({signal:w,schedule:R}),x=this._tileHandler.spriteMosaic;x.then((e=>{!s(w)&&this._tileHandler&&(this.painter=new d(e,this._tileHandler.glyphMosaic))})),j.then((()=>this._tileHandlerController=null)),this._updatingHandles.add((()=>({style:this.layer.currentStyleInfo.style,pixelRatio:this.view.state?.contentPixelRatio})),(({style:e,pixelRatio:t})=>{this._tileHandlerController&&this._tileHandlerController.abort(),this._tileHandlerController=new AbortController,this._memCache.clear();const i=new f(e),l=new p(this.layer,i,t,this._memCache),r=l.start({signal:this._tileHandlerController.signal,schedule:R}),s=l.spriteMosaic;r.then((()=>this._tileHandlerController=null)),this._updatingHandles.addPromise(Promise.all([r,s]).then((([,e])=>{const t=this._tileHandler,i=this.painter;this.painter=new d(e,l.glyphMosaic),this._tileHandler=l,this.emit("data-changed"),t.destroy(),i&&i.dispose()})))}));const L=Promise.all([_,j,x]);this.addResolvingPromise(L)}destroy(){this.painter=i(this.painter),this._tileHandlerController=l(this._tileHandlerController),this._tileHandler=r(this._tileHandler),this._memCache=r(this._memCache)}get displayLevelRange(){const e=this.tileInfo.lods,t=this.layer.minScale||e[0].scale,i=this.layer.maxScale||e.at(-1).scale,l=this.levelRangeFromScaleRange(t,i);return this.layer.maxScale?l.maxLevel++:l.maxLevel+=this.levelShift,l}get dataScaleRange(){const e=this.tileInfo.lods;return{minScale:e[0].scale,maxScale:e.at(-1).scale}}get dataLevelRange(){const{minScale:e,maxScale:t}=this.dataScaleRange,i=this.levelRangeFromScaleRange(e,t);return 1===i.minLevel&&256===this.tileInfo.size[0]&&(i.minLevel=0),i.maxLevel+=this.levelShift,i}async fetchTile(e,t,i,l){return this._tileHandler.getVectorTile(e,t,i,l)}};e([h()],C.prototype,"layer",void 0),e([h()],C.prototype,"levelShift",void 0),e([h()],C.prototype,"contentZoom",void 0),e([h()],C.prototype,"displayLevelRange",null),e([h()],C.prototype,"tileInfo",void 0),e([h()],C.prototype,"dataScaleRange",null),e([h()],C.prototype,"dataLevelRange",null),e([h()],C.prototype,"updatingProgressValue",void 0),C=e([c("esri.views.3d.layers.VectorTileLayerView3D")],C);const S=C;function H(e){return t=>e.immediate.schedule(t)}export{S as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import has from"../../../core/has.js";import{disposeMaybe as i,abortMaybe as l,destroyMaybe as r}from"../../../core/maybe.js";import{isAborted as s}from"../../../core/promiseUtils.js";import{whenOnce as o,watch as a,syncAndInitial as n}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{SchemaHelper as m}from"../../2d/engine/vectorTiles/SchemaHelper.js";import p from"../../2d/engine/vectorTiles/TileHandler3D.js";import d from"../../2d/engine/vectorTiles/VTLPainter3D.js";import f from"../../2d/engine/vectorTiles/style/StyleRepository.js";import{LayerView3D as y}from"./LayerView3D.js";import{TiledLayerView3D as g}from"./TiledLayerView3D.js";import{vtlAssumes256PixelSizeAsDefault as v,test as u}from"../terrain/terrainUtils.js";import _ from"../../layers/LayerView.js";let C=class extends(g(y(_))){constructor(){super(...arguments),this._tileHandlerController=null,this.type="vector-tile-3d",this.levelShift=has("disable-feature:vtl-level-shift")?0:1,this.contentZoom=has("disable-feature:vtl-level-shift")?1:1.5}initialize(){if(null==this.layer.fullExtent)return void this.addResolvingPromise(Promise.reject(new t("vectortilelayerview:full-extent-undefined","This layer view's layer does not define a fullExtent.")));const{basemapTerrain:e,spatialReference:i,state:l,viewingMode:r}=this.view,h="local"===r&&!v(i)||u.force512VTL,c=this.layer.tileInfo.spatialReference.isGeographic,y=h?this.layer.tileInfo:this.layer.tileInfo.getOrCreateCompatible(256,c?1:2),g=this._getTileInfoSupportError(y,this.layer.fullExtent);if(null!=g)return this.addResolvingPromise(Promise.reject(g));const _=o((()=>this.view?.basemapTerrain?.tilingSchemeLocked)).then((()=>{const t=e.tilingScheme,i=t.pixelSize,l=256===i?1:2,r=e.spatialReference?.isGeographic&&256===i?1:0,s=e.spatialReference?.isGeographic||256!==i?0:1;let o;if(this.schemaHelper=new m(l,r,this.levelShift+s),256===i){const e=this.layer.tileInfo.spatialReference.isGeographic;o=this.layer.tileInfo.getOrCreateCompatible(256,e?1:2)}else o=this.view.spatialReference?.isGeographic?this.layer.tileInfo.getOrCreateCompatible(512,.5):this.layer.tileInfo;const a=this._getTileInfoCompatibilityError(o,t);if(a)throw a;this.tileInfo=o}));this._tileHandlerController=new AbortController;const C=this.view.resourceController;this._memCache=C.memoryController.newCache(`vtl-${this.layer.uid}`,(e=>{e.release()})),this.addHandles(a((()=>this.view.qualitySettings.memoryLimit),(e=>this._memCache.maxSize=Math.ceil(e/10*1048576)),n));const S=new f(this.layer.currentStyleInfo.style);this._tileHandler=new p(this.layer,S,l.contentPixelRatio,this._memCache);const w=this._tileHandlerController.signal,R=H(C),j=this._tileHandler.start({signal:w,schedule:R}),x=this._tileHandler.spriteMosaic;x.then((e=>{!s(w)&&this._tileHandler&&(this.painter=new d(e,this._tileHandler.glyphMosaic))})),j.then((()=>this._tileHandlerController=null)),this._updatingHandles.add((()=>({style:this.layer.currentStyleInfo.style,pixelRatio:this.view.state?.contentPixelRatio})),(({style:e,pixelRatio:t})=>{this._tileHandlerController&&this._tileHandlerController.abort(),this._tileHandlerController=new AbortController,this._memCache.clear();const i=new f(e),l=new p(this.layer,i,t,this._memCache),r=l.start({signal:this._tileHandlerController.signal,schedule:R}),s=l.spriteMosaic;r.then((()=>this._tileHandlerController=null)),this._updatingHandles.addPromise(Promise.all([r,s]).then((([,e])=>{const t=this._tileHandler,i=this.painter;this.painter=new d(e,l.glyphMosaic),this._tileHandler=l,this.emit("data-changed"),t.destroy(),i&&i.dispose()})))}));const L=Promise.all([_,j,x]);this.addResolvingPromise(L)}destroy(){this.painter=i(this.painter),this._tileHandlerController=l(this._tileHandlerController),this._tileHandler=r(this._tileHandler),this._memCache=r(this._memCache)}get displayLevelRange(){const e=this.tileInfo.lods,t=this.layer.minScale||e[0].scale,i=this.layer.maxScale||e[e.length-1].scale,l=this.levelRangeFromScaleRange(t,i);return this.layer.maxScale?l.maxLevel++:l.maxLevel+=this.levelShift,l}get dataScaleRange(){const e=this.tileInfo.lods;return{minScale:e[0].scale,maxScale:e[e.length-1].scale}}get dataLevelRange(){const{minScale:e,maxScale:t}=this.dataScaleRange,i=this.levelRangeFromScaleRange(e,t);return 1===i.minLevel&&256===this.tileInfo.size[0]&&(i.minLevel=0),i.maxLevel+=this.levelShift,i}async fetchTile(e,t,i,l){return this._tileHandler.getVectorTile(e,t,i,l)}};e([h()],C.prototype,"layer",void 0),e([h()],C.prototype,"levelShift",void 0),e([h()],C.prototype,"contentZoom",void 0),e([h()],C.prototype,"displayLevelRange",null),e([h()],C.prototype,"tileInfo",void 0),e([h()],C.prototype,"dataScaleRange",null),e([h()],C.prototype,"dataLevelRange",null),e([h()],C.prototype,"updatingProgressValue",void 0),C=e([c("esri.views.3d.layers.VectorTileLayerView3D")],C);const S=C;function H(e){return t=>e.immediate.schedule(t)}export{S 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.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as i}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{lerp as s}from"../../../../core/mathUtils.js";import e from"../../../../core/PooledArray.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{p as a}from"../../../../chunks/mat4.js";import{c}from"../../../../chunks/mat4f64.js";import{a as n}from"../../../../chunks/vec2f64.js";import{m as l,g as h,s as p,c as u}from"../../../../chunks/vec3.js";import{Z as d,c as f}from"../../../../chunks/vec3f64.js";import{s as _,t as m,b as g}from"../../../../chunks/vec4.js";import{c as b}from"../../../../chunks/vec4f64.js";import{getReferenceEllipsoid as v}from"../../../../geometry/ellipsoidUtils.js";import{create as y,empty as G,offset as S,width as B,height as D,expand as w,intersects as N}from"../../../../geometry/support/aaBoundingRect.js";import{a as j,c as I,e as V}from"../../../../chunks/boundedPlane.js";import{create as C}from"../../../../geometry/support/ray.js";import{d as P,g as A,i as O,c as M}from"../../../../chunks/sphere.js";import{drawAccelerationStruct as x,prepare as z,drawPoly as E}from"./deconflictorDebug.js";import{VisibilityGroup as T,VisibilityFlag as X}from"./enums.js";import{Camera as F}from"../../webgl-engine/lib/Camera.js";import{applyPrecomputedScaleFactor as L}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as Y}from"../../webgl-engine/lib/VertexAttribute.js";import{HUDMaterial as k}from"../../webgl-engine/materials/HUDMaterial.js";import{ScaleInfo as R}from"../../webgl-engine/materials/ScaleInfo.js";const U=f(),W=b(),H=b(),Z=f(),q=c(),J=M(),K=C(),Q=f(),$=y();class ii{constructor(){this.aabr=y(),this.distance=0,this.culled=!1,this.visible=!1}}class ti{constructor(i,t){this.graphics3DGraphic=i,this.slicePlaneEnabled=t,this.info={}}}var si;!function(i){i[i.Idle=0]="Idle",i[i.Process=1]="Process",i[i.Sort=2]="Sort",i[i.Deconflict=3]="Deconflict",i[i.NumStates=4]="NumStates"}(si||(si={}));class ei{constructor(){this.camera=new F,this.slicePlane=j(),this.slicePlaneEnabled=!1}copyFrom(i){this.camera.copyFrom(i.camera),I(i.slicePlane,this.slicePlane),this.slicePlaneEnabled=i.slicePlaneEnabled}}let ri=class extends t{get dirty(){return this._dirty}get state(){return this._state}constructor(i){super(i),this._dirty=!1,this._runningViewState=new ei,this._state=si.Idle,this._active=new Map,this._visible=new Map,this._iterators=new li,this._accBinsNumX=15,this._accBinsNumY=20,this._accBinsSizeX=0,this._accBinsSizeY=0,this._accBins=null,this.accNumTests=0}destroy(){this._active.clear(),this._visible.clear(),this._iterators=null}setDirty(){!this._dirty&&this._active.size>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._state!==si.Idle||this._dirty}get updatingProgress(){if(!this.updating)return 1;const i=this._state/si.NumStates;return this._dirty?.5*i:i}get running(){return this.view.ready&&null!=this.view.state&&this.updating}runTask(i){switch(this._state){case si.Idle:this._startUpdate(),i.madeProgress();case si.Process:if(this._state=si.Process,!this._processActiveGraphics(i))return;case si.Sort:if(this._state=si.Sort,!this._sortVisibleGraphics(i))return;case si.Deconflict:if(this._state=si.Deconflict,!this._deconflictVisibleGraphics(i))return;default:x(this,this._visible),this._state=si.Idle,this.notifyChange("updating")}}modifyGraphics(i,t){t?i.forEach((i=>this.addToActiveGraphics(i))):i.forEach((i=>this.removeFromActiveGraphics(i))),this.setDirty()}layerSupportsDeconfliction(i){if(null==i||"object3d"!==i.type)return!1;const t=i.stageObject;if(1!==(t?t.geometries.length:0))return!1;const s=t?.geometries[0],e=s?.material;return e instanceof k}_startUpdate(){z(this.view),this._dirty=!1,this._runningViewState.copyFrom(this.viewState);const{fullWidth:i,fullHeight:t}=this._runningViewState.camera;this._initBins(i,t),this._resetIterators()}addToActiveGraphics(i){i.info[this.visibilityGroup]=new ii,this._active.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromActiveGraphics(i){this._visible.delete(i.graphics3DGraphic.graphic.uid),oi(i,this.visibilityGroup),delete i.info[this.visibilityGroup],this._active.delete(i.graphics3DGraphic.graphic.uid),this.setDirty()}_processActiveGraphics(i){const t=this._ensureActiveGraphicsIterator(),s=a(q,this._runningViewState.camera.projectionMatrix),e="global"===this.view.viewingMode&&1===this.view.map.ground.opacity&&this._runningViewState.camera.relativeElevation>0?J:null;let r=0;for(null!=e&&(l(e,d,this._runningViewState.camera.viewMatrix),e[3]=v(this.view.spatialReference).radius,r=P(e,d));!i.done;){i.madeProgress();const o=t.next();if(!0===o.done)return this._resetActiveGraphicsIterator(),!0;const a=o.value,c=a&&a.info[this.visibilityGroup];c&&(this._collectGraphics3DGraphics(a,s,e,r),c.culled?this._visible.delete(a.graphics3DGraphic.graphic.uid):this._visible.set(a.graphics3DGraphic.graphic.uid,a))}return!1}_sortVisibleGraphics(i){const t=this._ensureSortGraphicsIterator();for(;!i.done;){const s=t.next();if(i.madeProgress(),!0===s.done)return this._resetSortGraphicsIterator(),!0}return!1}_deconflictVisibleGraphics(i){const t=this._ensureVisibleGraphicsIterator(),s=this.visibilityGroup===T.LABEL;for(;!i.done;){i.madeProgress();const e=t.next();if(!0===e.done)return this._resetVisibleGraphicsIterator(),!0;const r=e.value,o=r.info[this.visibilityGroup];if(!o||o.culled)continue;const a=r.graphics3DGraphic,c=!s||a.isVisible();o.visible=c&&!this._isConflicted(r),o.visible&&this._addToBins(r),this._setGraphicVisibility(r,o.visible),E(o,o.visible)}return!1}_resetIterators(){this._iterators.active=null,this._iterators.visible=null,this._iterators.sort=null}_ensureActiveGraphicsIterator(){return this._iterators.active||(this._iterators.active=ai(this._active)),this._iterators.active}_resetActiveGraphicsIterator(){this._iterators.active=null}_ensureVisibleGraphicsIterator(){return this._iterators.visible||(this._iterators.visible=ai(this._visible)),this._iterators.visible}_resetVisibleGraphicsIterator(){this._iterators.visible=null}_ensureSortGraphicsIterator(){return this._iterators.sort||(this._iterators.sort=ci(this._visible,this._iterators.sortArray,this.visibilityGroup)),this._iterators.sort}_resetSortGraphicsIterator(){this._iterators.sort=null}_collectGraphics3DGraphics(i,t,s,e){const r=i.graphics3DGraphic;if(r.destroyed)return;const o=i.info[this.visibilityGroup];if(!r.isVisible(T.GRAPHIC,X.DECONFLICTION))return void(o.culled=!0);const a=this.getGraphicsLayers(r);G(o.aabr);let c=null;for(const n of a){if(!this.layerSupportsDeconfliction(n))continue;const r=n.stageObject.geometries[0].material;if(null==c&&(c=ui,this._getProjectionInfo(n,t,c),c.isOutsideScreen||this._isCulledBySlice(i,U)||null!=s&&this._isCulledByHorizon(c,s,e)))return void(o.culled=!0);this._expandBoundingRect(o,n,r,c)}null==c?o.culled=!0:(o.distance=c.distance,o.culled=!1)}_getProjectionInfo(i,t,s){const e=this._runningViewState.camera,r=i.stageObject,o=r.geometries[0],a=o.material,c=A(r.boundingVolumeWorldSpace.bounds);l(U,c,e.viewMatrix);const n=o.vertexAttributes,u=n.get(Y.NORMAL).data,d=n.get(Y.AUXPOS1).data;a.applyShaderOffsetsView(U,u,r.transformation,d,e,s.scaleInfo,U),_(W,U[0],U[1],U[2],1),m(H,W,e.projectionMatrix),h(s.positionNDC,H,1/H[3]),a.applyShaderOffsetsNDC(s.positionNDC,d,e,s.positionNDC,Z),s.distanceWithoutPolygonOffset=e.depthNDCToWorld(Z[2]),s.distance=Z[2]===s.positionNDC[2]?s.distanceWithoutPolygonOffset:e.depthNDCToWorld(s.positionNDC[2]),_(H,s.positionNDC[0],s.positionNDC[1],s.positionNDC[2],1),m(W,H,t),g(W,W,1/W[3]),p(s.positionView,U[0],U[1],U[2])}_isCulledByHorizon(i,t,s){return u(K.direction,i.positionView),p(K.origin,0,0,0),!!O(t,K,Q)&&i.distanceWithoutPolygonOffset>s}_isCulledBySlice(i,t){return i.slicePlaneEnabled&&this._runningViewState.slicePlaneEnabled&&V(this._runningViewState.slicePlane,t)}_expandBoundingRect(i,t,e,{positionNDC:r,scaleInfo:o}){const a=this._runningViewState.camera,c=t.getScreenSize(hi);L(c,o.factor,c),c[0]*=a.pixelRatio,c[1]*=a.pixelRatio;const n=S(e.calculateRelativeScreenBounds(c,o.factorAlignment.scale,$),s(0,a.fullWidth,.5+.5*r[0]),s(0,a.fullHeight,.5+.5*r[1])),l=this.iconMarginFactor;if(0!==l){const i=l*Math.min(B(n),D(n));n[0]-=i,n[1]-=i,n[2]+=i,n[3]+=i}w(i.aabr,n,i.aabr)}_isConflicted(i){const t=i.graphics3DGraphic.graphic.uid,s=i.info[this.visibilityGroup];for(let e=Math.floor(s.aabr[0]/this._accBinsSizeX);e<=Math.floor(s.aabr[2]/this._accBinsSizeX);e++)if(!(e<0||e>=this._accBinsNumX))for(let i=Math.floor(s.aabr[1]/this._accBinsSizeY);i<=Math.floor(s.aabr[3]/this._accBinsSizeY);i++){if(i<0||i>=this._accBinsNumY)continue;const r=this._accBins[e][i];for(let i=0;i<r.length;i++){const e=r.data[i],o=e.info[this.visibilityGroup];if(o&&o.visible&&e.graphics3DGraphic.graphic.uid!==t&&(this.accNumTests++,N(o.aabr,s.aabr)))return!0}}return!1}_initBins(i,t){if(null==this._accBins){this._accBins=[];for(let i=0;i<this._accBinsNumX;i++){this._accBins.push([]);const i=this._accBins.at(-1);for(let t=0;t<this._accBinsNumY;t++)i.push(new e)}}else for(let s=0;s<this._accBinsNumX;s++)for(let i=0;i<this._accBinsNumY;i++)this._accBins[s][i].clear();this._accBinsSizeX=i/this._accBinsNumX,this._accBinsSizeY=t/this._accBinsNumY,this.accNumTests=0}_addToBins(i){const t=i.info[this.visibilityGroup],s=Math.floor(t.aabr[0]/this._accBinsSizeX),e=Math.floor(t.aabr[2]/this._accBinsSizeX),r=Math.floor(t.aabr[1]/this._accBinsSizeY),o=Math.floor(t.aabr[3]/this._accBinsSizeY);for(let a=s;a<=e;a++)if(!(a<0||a>=this._accBinsNumX))for(let t=r;t<=o;t++)t<0||t>=this._accBinsNumY||this._accBins[a][t].push(i)}_setGraphicVisibility(i,t){const s=i.graphics3DGraphic;s.destroyed||(s.setVisibilityFlag(this.visibilityGroup,X.DECONFLICTION,t),this.visibilityGroup===T.LABEL&&this.view.labeler.setLabelGraphicVisibility(s,t))}};function oi(i,t){const s=i.graphics3DGraphic;s.destroyed||s.setVisibilityFlag(t,X.DECONFLICTION,!0)}function*ai(i){if(Map.prototype.entries){const t=i.entries();for(let i=t.next();!i.done;i=t.next())yield i.value[1]}else yield*i.values()}function*ci(i,t,s){t.clear(),i.forEach(((i,e)=>{const r=t.pushNew();r.id=e,r.visible=i.graphics3DGraphic.getVisibilityFlag(s,X.DECONFLICTION);const o=i.info&&i.info[s];r.prio=i.graphics3DGraphic.deconflictionPriority,r.distance=o?o.distance:Number.MAX_VALUE})),yield;const e=t.iterableSort(((i,t)=>i.prio!==t.prio?t.prio-i.prio:i.distance!==t.distance?i.distance-t.distance:i.visible!==t.visible?i.visible?-1:1:i.id-t.id));for(let r=e.next();!r.done;r=e.next())yield;t.forAll((t=>{const s=i.get(t.id);s&&(i.delete(t.id),i.set(t.id,s))})),t.clear()}i([r({constructOnly:!0})],ri.prototype,"view",void 0),i([r({type:Boolean,readOnly:!0})],ri.prototype,"updating",null),ri=i([o("esri.views.3d.layers.graphics.Deconflictor")],ri);class ni{constructor(){this.id=0,this.visible=!1,this.prio=0,this.distance=0}}class li{constructor(i=null,t=null,s=null){this.active=i,this.visible=t,this.sort=s,this.sortArray=new e({allocator:i=>i||new ni})}}const hi=n();class pi{constructor(){this.positionView=f(),this.positionNDC=f(),this.distance=0,this.distanceWithoutPolygonOffset=0,this.scaleInfo=new R}get isOutsideScreen(){const i=this.positionNDC;return i[0]<-1||i[1]<-1||i[2]<-1||i[0]>=1||i[1]>=1}}const ui=new pi;export{ri as Deconflictor,ti as DeconflictorGraphic,ei as DeconflictorViewState,si as State};
5
+ import{_ as i}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{lerp as s}from"../../../../core/mathUtils.js";import e from"../../../../core/PooledArray.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{p as a}from"../../../../chunks/mat4.js";import{c}from"../../../../chunks/mat4f64.js";import{a as n}from"../../../../chunks/vec2f64.js";import{m as l,g as h,s as p,c as u}from"../../../../chunks/vec3.js";import{Z as d,c as f}from"../../../../chunks/vec3f64.js";import{s as _,t as m,b as g}from"../../../../chunks/vec4.js";import{c as b}from"../../../../chunks/vec4f64.js";import{getReferenceEllipsoid as v}from"../../../../geometry/ellipsoidUtils.js";import{create as y,empty as G,offset as S,width as B,height as D,expand as w,intersects as N}from"../../../../geometry/support/aaBoundingRect.js";import{a as j,c as I,e as V}from"../../../../chunks/boundedPlane.js";import{create as C}from"../../../../geometry/support/ray.js";import{d as P,g as A,i as O,c as M}from"../../../../chunks/sphere.js";import{drawAccelerationStruct as x,prepare as z,drawPoly as E}from"./deconflictorDebug.js";import{VisibilityGroup as T,VisibilityFlag as X}from"./enums.js";import{Camera as F}from"../../webgl-engine/lib/Camera.js";import{applyPrecomputedScaleFactor as L}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as Y}from"../../webgl-engine/lib/VertexAttribute.js";import{HUDMaterial as k}from"../../webgl-engine/materials/HUDMaterial.js";import{ScaleInfo as R}from"../../webgl-engine/materials/ScaleInfo.js";const U=f(),W=b(),H=b(),Z=f(),q=c(),J=M(),K=C(),Q=f(),$=y();class ii{constructor(){this.aabr=y(),this.distance=0,this.culled=!1,this.visible=!1}}class ti{constructor(i,t){this.graphics3DGraphic=i,this.slicePlaneEnabled=t,this.info={}}}var si;!function(i){i[i.Idle=0]="Idle",i[i.Process=1]="Process",i[i.Sort=2]="Sort",i[i.Deconflict=3]="Deconflict",i[i.NumStates=4]="NumStates"}(si||(si={}));class ei{constructor(){this.camera=new F,this.slicePlane=j(),this.slicePlaneEnabled=!1}copyFrom(i){this.camera.copyFrom(i.camera),I(i.slicePlane,this.slicePlane),this.slicePlaneEnabled=i.slicePlaneEnabled}}let ri=class extends t{get dirty(){return this._dirty}get state(){return this._state}constructor(i){super(i),this._dirty=!1,this._runningViewState=new ei,this._state=si.Idle,this._active=new Map,this._visible=new Map,this._iterators=new li,this._accBinsNumX=15,this._accBinsNumY=20,this._accBinsSizeX=0,this._accBinsSizeY=0,this._accBins=null,this.accNumTests=0}destroy(){this._active.clear(),this._visible.clear(),this._iterators=null}setDirty(){!this._dirty&&this._active.size>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._state!==si.Idle||this._dirty}get updatingProgress(){if(!this.updating)return 1;const i=this._state/si.NumStates;return this._dirty?.5*i:i}get running(){return this.view.ready&&null!=this.view.state&&this.updating}runTask(i){switch(this._state){case si.Idle:this._startUpdate(),i.madeProgress();case si.Process:if(this._state=si.Process,!this._processActiveGraphics(i))return;case si.Sort:if(this._state=si.Sort,!this._sortVisibleGraphics(i))return;case si.Deconflict:if(this._state=si.Deconflict,!this._deconflictVisibleGraphics(i))return;default:x(this,this._visible),this._state=si.Idle,this.notifyChange("updating")}}modifyGraphics(i,t){t?i.forEach((i=>this.addToActiveGraphics(i))):i.forEach((i=>this.removeFromActiveGraphics(i))),this.setDirty()}layerSupportsDeconfliction(i){if(null==i||"object3d"!==i.type)return!1;const t=i.stageObject;if(1!==(t?t.geometries.length:0))return!1;const s=t?.geometries[0],e=s?.material;return e instanceof k}_startUpdate(){z(this.view),this._dirty=!1,this._runningViewState.copyFrom(this.viewState);const{fullWidth:i,fullHeight:t}=this._runningViewState.camera;this._initBins(i,t),this._resetIterators()}addToActiveGraphics(i){i.info[this.visibilityGroup]=new ii,this._active.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromActiveGraphics(i){this._visible.delete(i.graphics3DGraphic.graphic.uid),oi(i,this.visibilityGroup),delete i.info[this.visibilityGroup],this._active.delete(i.graphics3DGraphic.graphic.uid),this.setDirty()}_processActiveGraphics(i){const t=this._ensureActiveGraphicsIterator(),s=a(q,this._runningViewState.camera.projectionMatrix),e="global"===this.view.viewingMode&&1===this.view.map.ground.opacity&&this._runningViewState.camera.relativeElevation>0?J:null;let r=0;for(null!=e&&(l(e,d,this._runningViewState.camera.viewMatrix),e[3]=v(this.view.spatialReference).radius,r=P(e,d));!i.done;){i.madeProgress();const o=t.next();if(!0===o.done)return this._resetActiveGraphicsIterator(),!0;const a=o.value,c=a&&a.info[this.visibilityGroup];c&&(this._collectGraphics3DGraphics(a,s,e,r),c.culled?this._visible.delete(a.graphics3DGraphic.graphic.uid):this._visible.set(a.graphics3DGraphic.graphic.uid,a))}return!1}_sortVisibleGraphics(i){const t=this._ensureSortGraphicsIterator();for(;!i.done;){const s=t.next();if(i.madeProgress(),!0===s.done)return this._resetSortGraphicsIterator(),!0}return!1}_deconflictVisibleGraphics(i){const t=this._ensureVisibleGraphicsIterator(),s=this.visibilityGroup===T.LABEL;for(;!i.done;){i.madeProgress();const e=t.next();if(!0===e.done)return this._resetVisibleGraphicsIterator(),!0;const r=e.value,o=r.info[this.visibilityGroup];if(!o||o.culled)continue;const a=r.graphics3DGraphic,c=!s||a.isVisible();o.visible=c&&!this._isConflicted(r),o.visible&&this._addToBins(r),this._setGraphicVisibility(r,o.visible),E(o,o.visible)}return!1}_resetIterators(){this._iterators.active=null,this._iterators.visible=null,this._iterators.sort=null}_ensureActiveGraphicsIterator(){return this._iterators.active||(this._iterators.active=ai(this._active)),this._iterators.active}_resetActiveGraphicsIterator(){this._iterators.active=null}_ensureVisibleGraphicsIterator(){return this._iterators.visible||(this._iterators.visible=ai(this._visible)),this._iterators.visible}_resetVisibleGraphicsIterator(){this._iterators.visible=null}_ensureSortGraphicsIterator(){return this._iterators.sort||(this._iterators.sort=ci(this._visible,this._iterators.sortArray,this.visibilityGroup)),this._iterators.sort}_resetSortGraphicsIterator(){this._iterators.sort=null}_collectGraphics3DGraphics(i,t,s,e){const r=i.graphics3DGraphic;if(r.destroyed)return;const o=i.info[this.visibilityGroup];if(!r.isVisible(T.GRAPHIC,X.DECONFLICTION))return void(o.culled=!0);const a=this.getGraphicsLayers(r);G(o.aabr);let c=null;for(const n of a){if(!this.layerSupportsDeconfliction(n))continue;const r=n.stageObject.geometries[0].material;if(null==c&&(c=ui,this._getProjectionInfo(n,t,c),c.isOutsideScreen||this._isCulledBySlice(i,U)||null!=s&&this._isCulledByHorizon(c,s,e)))return void(o.culled=!0);this._expandBoundingRect(o,n,r,c)}null==c?o.culled=!0:(o.distance=c.distance,o.culled=!1)}_getProjectionInfo(i,t,s){const e=this._runningViewState.camera,r=i.stageObject,o=r.geometries[0],a=o.material,c=A(r.boundingVolumeWorldSpace.bounds);l(U,c,e.viewMatrix);const n=o.vertexAttributes,u=n.get(Y.NORMAL).data,d=n.get(Y.AUXPOS1).data;a.applyShaderOffsetsView(U,u,r.transformation,d,e,s.scaleInfo,U),_(W,U[0],U[1],U[2],1),m(H,W,e.projectionMatrix),h(s.positionNDC,H,1/H[3]),a.applyShaderOffsetsNDC(s.positionNDC,d,e,s.positionNDC,Z),s.distanceWithoutPolygonOffset=e.depthNDCToWorld(Z[2]),s.distance=Z[2]===s.positionNDC[2]?s.distanceWithoutPolygonOffset:e.depthNDCToWorld(s.positionNDC[2]),_(H,s.positionNDC[0],s.positionNDC[1],s.positionNDC[2],1),m(W,H,t),g(W,W,1/W[3]),p(s.positionView,U[0],U[1],U[2])}_isCulledByHorizon(i,t,s){return u(K.direction,i.positionView),p(K.origin,0,0,0),!!O(t,K,Q)&&i.distanceWithoutPolygonOffset>s}_isCulledBySlice(i,t){return i.slicePlaneEnabled&&this._runningViewState.slicePlaneEnabled&&V(this._runningViewState.slicePlane,t)}_expandBoundingRect(i,t,e,{positionNDC:r,scaleInfo:o}){const a=this._runningViewState.camera,c=t.getScreenSize(hi);L(c,o.factor,c),c[0]*=a.pixelRatio,c[1]*=a.pixelRatio;const n=S(e.calculateRelativeScreenBounds(c,o.factorAlignment.scale,$),s(0,a.fullWidth,.5+.5*r[0]),s(0,a.fullHeight,.5+.5*r[1])),l=this.iconMarginFactor;if(0!==l){const i=l*Math.min(B(n),D(n));n[0]-=i,n[1]-=i,n[2]+=i,n[3]+=i}w(i.aabr,n,i.aabr)}_isConflicted(i){const t=i.graphics3DGraphic.graphic.uid,s=i.info[this.visibilityGroup];for(let e=Math.floor(s.aabr[0]/this._accBinsSizeX);e<=Math.floor(s.aabr[2]/this._accBinsSizeX);e++)if(!(e<0||e>=this._accBinsNumX))for(let i=Math.floor(s.aabr[1]/this._accBinsSizeY);i<=Math.floor(s.aabr[3]/this._accBinsSizeY);i++){if(i<0||i>=this._accBinsNumY)continue;const r=this._accBins[e][i];for(let i=0;i<r.length;i++){const e=r.data[i],o=e.info[this.visibilityGroup];if(o&&o.visible&&e.graphics3DGraphic.graphic.uid!==t&&(this.accNumTests++,N(o.aabr,s.aabr)))return!0}}return!1}_initBins(i,t){if(null==this._accBins){this._accBins=[];for(let i=0;i<this._accBinsNumX;i++){this._accBins.push([]);const i=this._accBins[this._accBins.length-1];for(let t=0;t<this._accBinsNumY;t++)i.push(new e)}}else for(let s=0;s<this._accBinsNumX;s++)for(let i=0;i<this._accBinsNumY;i++)this._accBins[s][i].clear();this._accBinsSizeX=i/this._accBinsNumX,this._accBinsSizeY=t/this._accBinsNumY,this.accNumTests=0}_addToBins(i){const t=i.info[this.visibilityGroup],s=Math.floor(t.aabr[0]/this._accBinsSizeX),e=Math.floor(t.aabr[2]/this._accBinsSizeX),r=Math.floor(t.aabr[1]/this._accBinsSizeY),o=Math.floor(t.aabr[3]/this._accBinsSizeY);for(let a=s;a<=e;a++)if(!(a<0||a>=this._accBinsNumX))for(let t=r;t<=o;t++)t<0||t>=this._accBinsNumY||this._accBins[a][t].push(i)}_setGraphicVisibility(i,t){const s=i.graphics3DGraphic;s.destroyed||(s.setVisibilityFlag(this.visibilityGroup,X.DECONFLICTION,t),this.visibilityGroup===T.LABEL&&this.view.labeler.setLabelGraphicVisibility(s,t))}};function oi(i,t){const s=i.graphics3DGraphic;s.destroyed||s.setVisibilityFlag(t,X.DECONFLICTION,!0)}function*ai(i){if(Map.prototype.entries){const t=i.entries();for(let i=t.next();!i.done;i=t.next())yield i.value[1]}else yield*i.values()}function*ci(i,t,s){t.clear(),i.forEach(((i,e)=>{const r=t.pushNew();r.id=e,r.visible=i.graphics3DGraphic.getVisibilityFlag(s,X.DECONFLICTION);const o=i.info&&i.info[s];r.prio=i.graphics3DGraphic.deconflictionPriority,r.distance=o?o.distance:Number.MAX_VALUE})),yield;const e=t.iterableSort(((i,t)=>i.prio!==t.prio?t.prio-i.prio:i.distance!==t.distance?i.distance-t.distance:i.visible!==t.visible?i.visible?-1:1:i.id-t.id));for(let r=e.next();!r.done;r=e.next())yield;t.forAll((t=>{const s=i.get(t.id);s&&(i.delete(t.id),i.set(t.id,s))})),t.clear()}i([r({constructOnly:!0})],ri.prototype,"view",void 0),i([r({type:Boolean,readOnly:!0})],ri.prototype,"updating",null),ri=i([o("esri.views.3d.layers.graphics.Deconflictor")],ri);class ni{constructor(){this.id=0,this.visible=!1,this.prio=0,this.distance=0}}class li{constructor(i=null,t=null,s=null){this.active=i,this.visible=t,this.sort=s,this.sortArray=new e({allocator:i=>i||new ni})}}const hi=n();class pi{constructor(){this.positionView=f(),this.positionNDC=f(),this.distance=0,this.distanceWithoutPolygonOffset=0,this.scaleInfo=new R}get isOutsideScreen(){const i=this.positionNDC;return i[0]<-1||i[1]<-1||i[2]<-1||i[0]>=1||i[1]>=1}}const ui=new pi;export{ri as Deconflictor,ti as DeconflictorGraphic,ei as DeconflictorViewState,si as State};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{forEach as s,result as l}from"../../../../core/asyncUtils.js";import i from"../../../../core/Logger.js";import{someMap as a}from"../../../../core/MapUtils.js";import{disposeMaybe as r,abortMaybe as o}from"../../../../core/maybe.js";import{throwIfAborted as n,isAbortError as c}from"../../../../core/promiseUtils.js";import{watch as h}from"../../../../core/reactiveUtils.js";import{property as b}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{f as p}from"../../../../chunks/vec2f64.js";import{hydrateGraphic as u}from"../../../../layers/graphics/hydratedFeatures.js";import{createLabelFunction as y}from"../../../../layers/support/labelFormatUtils.js";import{hasCalloutSupport as g}from"../../../../symbols/callouts/calloutUtils.js";import{VisibilityGroup as m,VisibilityFlag as f}from"./enums.js";import{make as _}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutSymbolLayerRenderingInfo as C,LineCalloutCreationContext as x}from"./Graphics3DLineCalloutSymbolLayer.js";import{getGraphics3DSymbol as L}from"./graphicSymbolUtils.js";import{LabelParameters as v}from"./LabelParameters.js";import{getLabelPlacement as T,LabelInfo as A}from"./labelPlacement.js";import{horizontalPlacementFromAnchor as w,verticalPlacementFromAnchor as D,textRenderAlignmentFromHorizontalPlacement as G}from"./placementUtils.js";import{MaterialCollection as I}from"../../webgl-engine/lib/MaterialCollection.js";import{TextRenderer as R}from"../../webgl-engine/lib/TextRenderer.js";import{TextRenderParameters as P}from"../../webgl-engine/lib/TextRenderParameters.js";import{TextTextureAtlas as S}from"../../webgl-engine/lib/TextTextureAtlas.js";import{WebGLLayer as j}from"../../webgl-engine/lib/WebGLLayer.js";import{TaskPriority as E,Task as O}from"../../../support/Scheduler.js";class z{constructor(e,t){this.labelingContext=e,this.graphics3DGraphic=t,this.hasGraphics3DResources=!1,this.visible=!1,this.rendered=!1,this.textInitialized=!1,this.textRenderers=new Array,this.textLabelPlacements=new Array}}class M{constructor(e,t,s,l,i){this.labelClass=e,this.graphics3DSymbol=t,this.graphics3DCalloutSymbolLayer=s,this.textRenderParameters=l,this.labelFunction=i,this.calloutSymbolLayerIndex=0}}class V{constructor(e,t,s,l,i,a,r,o){this.layer=t,this.graphics3DCore=s,this.scaleVisibility=l,this.emptySymbolLabelSupported=i,this.elevationInfoOverride=a,this.disablePlacement=r,this.active=o,this.labelClassAbortController=new AbortController,this.labelClassContexts=new Array,this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new j(e,{pickable:!0,disableOctree:!0},t.uid)}destroy(){this.stageLayer.destroy()}}let F=class extends t{constructor(e){super(e),this._dirty=!1,this._labels=new Map,this._labelsToAdd=new Map,this._labelsToRemove=new Map,this._labelingContexts=new Array}setup(){this.dispose(),this.addHandles([h((()=>this.view.state?.camera),(()=>this.setDirty())),h((()=>this.view.state?.rasterPixelRatio),(()=>this._resetAllLabels())),this.view.resourceController.scheduler.registerTask(E.LABELER,this)]),this._textTextureAtlas=new S({view:this.view}),this._hudMaterialCollection=new I(this.view._stage),this._calloutMaterialCollection=new I(this.view._stage)}dispose(){this.removeAllHandles(),this._textTextureAtlas=r(this._textTextureAtlas),this._hudMaterialCollection=r(this._hudMaterialCollection),this._calloutMaterialCollection=r(this._calloutMaterialCollection),this._labelingContexts.length=0,this._labels.clear(),this._labelsToAdd.clear(),this._labelsToRemove.clear()}destroy(){this.dispose(),H.graphic=null,H.renderingInfo=null,H.layer=null}_activateLabelingContext(e){e.graphics.forEach(((t,s)=>{const l=new z(e,t);this._labels.set(s,l),e.labelsToInitialize.set(s,l),t.setVisibilityFlag(m.LABEL,f.USER,!0)})),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach(((e,t)=>{e.setVisibilityFlag(m.LABEL,f.USER,!1),this.setLabelGraphicVisibility(e,!1),this._labels.delete(t)})),e.active=!1}_addLabelTextureToAtlas(e){for(const t of e.graphics3DGraphic.labelLayers){if(!t._labelClass)continue;const s=e.textRenderers[t._labelIndex];s&&this._textTextureAtlas.addTextTexture(s,t.stageObject)}e.rendered=!0}_removeLabelTextureFromAtlas(e){for(const t of e.graphics3DGraphic.labelLayers){if(!t._labelClass)continue;const s=e.textRenderers[t._labelIndex];null!=s&&this._textTextureAtlas.removeTextTexture(s,t.stageObject)}e.rendered=!1}get running(){return this.view.ready&&(this._dirty||this.deconflictor.running)}runTask(e){return this._updateLabels(e),!this._dirty&&this.deconflictor.running&&this.deconflictor.runTask(e),O.YIELD}_updateLabels(e){if(this._dirty){this._dirty=!1;for(const t of this._labelingContexts)if(t.active)if(U(t))this._dirty=!0;else if(k(t.labelClassContexts)){if(null===t.labelClassContexts){this._deactivateLabelingContext(t);continue}this._createLabelClassContext(t),this._dirty=!0}else a(t.labelsToInitialize,((s,l)=>(this._ensureGraphics3DResources(s)&&(this._labels.set(l,s),this.deconflictor.setDirty(),e.madeProgress()),(s.visible&&s.textInitialized||!s.visible&&s.hasGraphics3DResources)&&(t.labelsToInitialize.delete(l),e.madeProgress()),e.done)))&&(this._dirty=!0);this._labelsToRemove.forEach((e=>this._removeLabelTextureFromAtlas(e))),this._labelsToAdd.forEach((e=>this._addLabelTextureToAtlas(e))),this._labelsToRemove.clear(),this._labelsToAdd.clear(),this._dirty||this.notifyChange("updating")}}async _createLabelClassContextAsync(e){const t=e.labelClassAbortController?.signal;await(e.layer.when?.()),n(t),e.scaleVisibility&&e.scaleVisibility.updateScaleRangeActive();const a=e.graphics3DCore,r=a.layer,o=r.labelingInfo&&r.labelingInfo.filter((e=>!!e.symbol));if(!o||0===o.length)return;let c=!1;await s(o,(async(s,r)=>{const o=s.symbol,h=L(a.getOrCreateGraphics3DSymbol(o));if(null==h)return void i.getLogger(this).error("Failed to create Graphics3DSymbol for label");await h.load(),n(t);let b=null;g(o)&&o.hasVisibleCallout()&&(b=_(o,a.symbolCreationContext),await b.load(),n(t));const d=await l(y(s,e.layer.fieldsIndex,this.view.spatialReference));if(n(t),!0===d.ok){const l=await this._createTextRenderParameters(h.symbol);n(t),e.labelClassContexts[r]=new M(s,h,b,l,d.value)}else i.getLogger(this).error(`Label expression failed to evaluate: ${d.error}`),c=!0})),n(t)}async _createLabelClassContext(e){return null==e.labelClassPromise&&(e.labelClassPromise=this._createLabelClassContextAsync(e).catch((t=>{if(c(t))throw t;e.labelClassContexts.length=0})).then((()=>{e.labelClassAbortController=null,this.notifyChange("updating")})).catch((()=>{})),this.notifyChange("updating")),e.labelClassPromise}async _createTextRenderParameters(e){const t=e.symbolLayers.at(0);return"text"!==t?.type?null:P.fromSymbol(t,this.view.state.rasterPixelRatio)}_destroyLabelClassContext(e){for(const s of e.labelClassContexts)--s.graphics3DSymbol.referenced;const t=e.labelClassAbortController;e.labelClassAbortController=new AbortController,o(t),e.labelClassContexts.length=0,e.labelClassPromise=null,this.notifyChange("updating")}_createTextSymbolGraphic(e,t,s,l,i,a){const r=new v(s,w(s.anchor),D(s.anchor),e.text,p(e.displayWidth,e.displayHeight));return H.graphic=t,H.renderingInfo=null,H.layer=l,i.createLabel(H,r,this._hudMaterialCollection,this._textTextureAtlas,(()=>{const e=T(a);return e?e.elevationOffset:null}))}_createLineCalloutGraphic(e,t,s,l,i){return H.graphic=e,H.layer=i,H.renderingInfo=new C(null,t,l.translation,l.centerOffset,l.screenOffset,l.centerOffsetUnits,l.elevationOffset,this._calloutMaterialCollection),s.createGraphics3DGraphic(H)}_ensureGraphics3DResources(e){if(e.hasGraphics3DResources)return!1;const t=e.graphics3DGraphic;if(t.destroyed)return!1;this._ensureTextTextureResources(e);const s=e.labelingContext,l=s.labelClassContexts;if(k(l)||!s.emptySymbolLabelSupported&&0===t.layers.length)return!1;let i=!1;const a=t.graphic,r=s.layer,o=B(s.layer);for(let n=0;n<l.length;n++){const c=e.textRenderers[n],h=e.textLabelPlacements[n];if(null==c||null==h)continue;const b=l[n],d=b.graphics3DSymbol,p=d.symbol&&"label-3d"===d.symbol.type?d.symbol:null,u=d.symbolLayers[0];if(!u)continue;u.setElevationInfoOverride(s.elevationInfoOverride);const y=new A(t,p,b.labelClass),g=this._createTextSymbolGraphic(c,a,h,r,u,y);if(null==g)return!1;g._labelClass=b.labelClass,g._labelIndex=n,t.addLabelGraphic(g,s.stageLayer),t.deconflictionPriority=b.textRenderParameters?.definition.size??0,t.setVisibilityFlag(m.LABEL,f.USER,o),t.setVisibilityFlag(m.LABEL,f.SCALE_RANGE,!0),t.setVisibilityFlag(m.LABEL,f.DECONFLICTION,!1),i=!0;const _=b.graphics3DCalloutSymbolLayer;if(_&&h.hasLabelVerticalOffset){_.setElevationInfoOverride(s.elevationInfoOverride);const e=this._createLineCalloutGraphic(a,p,_,h,r);null!=e&&(b.calloutSymbolLayerIndex=t.labelLayers.length,t.addLabelGraphic(e,s.stageLayer))}break}return s.scaleVisibility&&i&&s.scaleVisibility.updateGraphicLabelScaleVisibility(t),e.hasGraphics3DResources=!0,!0}_destroyGraphics3DResources(e){const t=e.labelingContext.labelClassContexts;for(const s of e.graphics3DGraphic.labelLayers){if(null==s._labelClass)continue;const e=t[s._labelIndex].graphics3DSymbol.symbolLayers[0];null!=e&&e.onRemoveGraphic(s)}e.graphics3DGraphic.deconflictionPriority=0,e.graphics3DGraphic.clearLabelGraphics(),e.hasGraphics3DResources=!1}_ensureTextTextureResources(e){if(e.textInitialized)return;const t=e.labelingContext,s=t.labelClassContexts;if(k(s))return;const l=e.graphics3DGraphic.graphic;for(let a=0;a<s.length;a++){const r=s[a];if(e.textRenderers[a]=null,e.textLabelPlacements[a]=null,null==r?.textRenderParameters)continue;const o=r.labelFunction;let n;if("arcade"===o.type)try{const e=o.needsHydrationToEvaluate()?u(l,t.layer):l;n=o.evaluate(e)}catch(i){n=null}else n=o.evaluate(l);if(null==n||""===n||/^\s+$/.test(n))continue;const c=r.graphics3DSymbol,h="label-3d"===c.symbol?.type?c.symbol:null;if(!c.symbolLayers[0])continue;const b=e.graphics3DGraphic,d=r.labelClass,p=t.disablePlacement,y=T({graphics3DGraphic:b,labelSymbol:h,labelClass:d,disablePlacement:p});if(null==y)continue;const g=w(y.anchor),m=G(g);e.textRenderers[a]=new R(n,m,r.textRenderParameters),e.textLabelPlacements[a]=y}e.textInitialized=!0}_destroyTextTextureResources(e){e.textInitialized=!1,e.textRenderers.length=0,e.textLabelPlacements.length=0}_addGraphic(e,t){const s=t.graphic.uid;if(e.graphics.set(s,t),e.active){const l=new z(e,t);this._labels.set(s,l),e.labelsToInitialize.set(s,l)}this.setDirty(),this.deconflictor.setDirty()}_removeGraphic(e,t){const s=t.graphic.uid,l=this._labels.get(s);e.graphics.delete(s),l&&(this._destroyGraphic(l,s),e.labelsToInitialize.delete(s),this.setDirty(),this.deconflictor.setDirty())}_destroyGraphic(e,t){this._labels.has(t)&&(this._labels.delete(t),this._labelsToAdd.delete(t),this._labelsToRemove.delete(t)),e.textInitialized&&(this._removeLabelTextureFromAtlas(e),this._destroyTextTextureResources(e)),e.hasGraphics3DResources&&this._destroyGraphics3DResources(e)}async _labelingInfoChange(e,t){if(!t)return this._visibilityInfoChange(e),this._resetLabels(e),this._createLabelClassContext(e);for(const s of t){const t=e.graphics.get(s);t&&(this._removeGraphic(e,t),this._addGraphic(e,t))}}_globalPropertyChanged(e,t){for(const s of t.labelClassContexts){const l=new Map;t.graphics.forEach((e=>l.set(e.graphic.uid,e)));const i=e=>e.labelLayers[0];if(s.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,l,i),s.graphics3DCalloutSymbolLayer){const t=e=>e.labelLayers[s.calloutSymbolLayerIndex];s.graphics3DCalloutSymbolLayer.globalPropertyChanged(e,l,t)}}}_visibilityInfoChange(e){const t=B(e.layer);t&&!e.active&&this._activateLabelingContext(e),!t&&e.active&&this._deactivateLabelingContext(e),this.setDirty()}_resetAllLabels(){for(const e of this._labelingContexts)this._resetLabels(e)}_resetLabels(e){e.graphics.forEach(((t,s)=>{const l=this._labels.get(s);l&&(this._destroyGraphic(l,s),l.visible=!1,l.rendered=!1,e.labelsToInitialize.set(s,l))})),this._destroyLabelClassContext(e),this.setDirty(),this.deconflictor.setDirty()}_findLabelingContext(e){for(const t of this._labelingContexts)if(t.graphics3DCore===e)return t;return null}addGraphicsOwner(e,t,s){const l=s&&s.emptySymbolLabelSupported||!1,i=s&&s.elevationInfoOverride||null,a=s&&s.disablePlacement||null;if(this._findLabelingContext(e))return;const r=e.layer,o=new V(this.view._stage,r,e,t,l,i,a,B(r));return this._labelingContexts.push(o),this.setDirty(),{addGraphic:e=>this._addGraphic(o,e),removeGraphic:e=>this._removeGraphic(o,e),featureReductionChange:()=>{},layerLabelsEnabled:()=>B(o.layer),labelingInfoChange:e=>this._labelingInfoChange(o,e),elevationInfoChange:()=>this._globalPropertyChanged("elevationInfo",o),slicePlaneEnabledChange:()=>this._globalPropertyChanged("slicePlaneEnabled",o),visibilityInfoChange:()=>this._visibilityInfoChange(o),reset:()=>this._resetLabels(o),clear:()=>{}}}removeGraphicsOwner(e){const t=this._findLabelingContext(e);if(!t)return;const s=this._labelingContexts.indexOf(t);this._labelingContexts.splice(s,1),t.graphics.forEach((e=>this._removeGraphic(t,e))),t.destroy(),this.setDirty()}setLabelGraphicVisibility(e,t){const s=e.graphic.uid,l=this._labels.get(s);l&&l.visible!==t&&(t&&!l.rendered?(this._labelsToAdd.set(s,l),this._labelsToRemove.delete(s),l.textInitialized||l.labelingContext.labelsToInitialize.set(s,l)):!t&&l.rendered&&(this._labelsToRemove.set(s,l),this._labelsToAdd.delete(s)),l.visible=t,this.setDirty())}setDirty(){!this._dirty&&this._labelingContexts.length>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._dirty||this._textTextureAtlas?.updating||this.deconflictor.updating||this._labelingContexts.some((e=>U(e)))}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;const e=this._labelingContexts.length>0?this._labelingContexts.reduce(((e,t)=>e+(U(t)?0:1)),0)/this._labelingContexts.length:1;return(this._dirty?0:.3)+(this._textTextureAtlas.updating?0:.1)+.1*e+.5*this.deconflictor.updatingProgress}get test(){return{textTextureAtlas:this._textTextureAtlas,resetAllLabels:()=>this._resetAllLabels()}}};function U(e){return!!e.labelClassPromise&&!!e.labelClassAbortController}function k(e){return!e||0===e.length}function B(e){return!0===e.labelsVisible&&!!e.labelingInfo?.some((e=>!!e.symbol))}e([b({constructOnly:!0})],F.prototype,"view",void 0),e([b({constructOnly:!0})],F.prototype,"deconflictor",void 0),e([b()],F.prototype,"_textTextureAtlas",void 0),e([b({type:Boolean,readOnly:!0})],F.prototype,"updating",null),F=e([d("esri.views.3d.layers.graphics.Labeler")],F);const H=new x(null,null,null);export{F as Labeler,B as areLabelsVisible};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{forEach as s,result as l}from"../../../../core/asyncUtils.js";import i from"../../../../core/Logger.js";import{someMap as a}from"../../../../core/MapUtils.js";import{disposeMaybe as r,abortMaybe as o}from"../../../../core/maybe.js";import{throwIfAborted as n,isAbortError as c}from"../../../../core/promiseUtils.js";import{watch as h}from"../../../../core/reactiveUtils.js";import{property as b}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{f as p}from"../../../../chunks/vec2f64.js";import{hydrateGraphic as u}from"../../../../layers/graphics/hydratedFeatures.js";import{createLabelFunction as y}from"../../../../layers/support/labelFormatUtils.js";import{hasCalloutSupport as g}from"../../../../symbols/callouts/calloutUtils.js";import{VisibilityGroup as m,VisibilityFlag as f}from"./enums.js";import{make as _}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutSymbolLayerRenderingInfo as C,LineCalloutCreationContext as x}from"./Graphics3DLineCalloutSymbolLayer.js";import{getGraphics3DSymbol as L}from"./graphicSymbolUtils.js";import{LabelParameters as v}from"./LabelParameters.js";import{getLabelPlacement as T,LabelInfo as w}from"./labelPlacement.js";import{horizontalPlacementFromAnchor as A,verticalPlacementFromAnchor as D,textRenderAlignmentFromHorizontalPlacement as G}from"./placementUtils.js";import{MaterialCollection as I}from"../../webgl-engine/lib/MaterialCollection.js";import{TextRenderer as R}from"../../webgl-engine/lib/TextRenderer.js";import{TextRenderParameters as P}from"../../webgl-engine/lib/TextRenderParameters.js";import{TextTextureAtlas as S}from"../../webgl-engine/lib/TextTextureAtlas.js";import{WebGLLayer as j}from"../../webgl-engine/lib/WebGLLayer.js";import{TaskPriority as E,Task as O}from"../../../support/Scheduler.js";class z{constructor(e,t){this.labelingContext=e,this.graphics3DGraphic=t,this.hasGraphics3DResources=!1,this.visible=!1,this.rendered=!1,this.textInitialized=!1,this.textRenderers=new Array,this.textLabelPlacements=new Array}}class M{constructor(e,t,s,l,i){this.labelClass=e,this.graphics3DSymbol=t,this.graphics3DCalloutSymbolLayer=s,this.textRenderParameters=l,this.labelFunction=i,this.calloutSymbolLayerIndex=0}}class V{constructor(e,t,s,l,i,a,r,o){this.layer=t,this.graphics3DCore=s,this.scaleVisibility=l,this.emptySymbolLabelSupported=i,this.elevationInfoOverride=a,this.disablePlacement=r,this.active=o,this.labelClassAbortController=new AbortController,this.labelClassContexts=new Array,this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new j(e,{pickable:!0,disableOctree:!0},t.uid)}destroy(){this.stageLayer.destroy()}}let F=class extends t{constructor(e){super(e),this._dirty=!1,this._labels=new Map,this._labelsToAdd=new Map,this._labelsToRemove=new Map,this._labelingContexts=new Array}setup(){this.dispose(),this.addHandles([h((()=>this.view.state?.camera),(()=>this.setDirty())),h((()=>this.view.state?.rasterPixelRatio),(()=>this._resetAllLabels())),this.view.resourceController.scheduler.registerTask(E.LABELER,this)]),this._textTextureAtlas=new S({view:this.view}),this._hudMaterialCollection=new I(this.view._stage),this._calloutMaterialCollection=new I(this.view._stage)}dispose(){this.removeAllHandles(),this._textTextureAtlas=r(this._textTextureAtlas),this._hudMaterialCollection=r(this._hudMaterialCollection),this._calloutMaterialCollection=r(this._calloutMaterialCollection),this._labelingContexts.length=0,this._labels.clear(),this._labelsToAdd.clear(),this._labelsToRemove.clear()}destroy(){this.dispose(),H.graphic=null,H.renderingInfo=null,H.layer=null}_activateLabelingContext(e){e.graphics.forEach(((t,s)=>{const l=new z(e,t);this._labels.set(s,l),e.labelsToInitialize.set(s,l),t.setVisibilityFlag(m.LABEL,f.USER,!0)})),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach(((e,t)=>{e.setVisibilityFlag(m.LABEL,f.USER,!1),this.setLabelGraphicVisibility(e,!1),this._labels.delete(t)})),e.active=!1}_addLabelTextureToAtlas(e){for(const t of e.graphics3DGraphic.labelLayers){if(!t._labelClass)continue;const s=e.textRenderers[t._labelIndex];s&&this._textTextureAtlas.addTextTexture(s,t.stageObject)}e.rendered=!0}_removeLabelTextureFromAtlas(e){for(const t of e.graphics3DGraphic.labelLayers){if(!t._labelClass)continue;const s=e.textRenderers[t._labelIndex];null!=s&&this._textTextureAtlas.removeTextTexture(s,t.stageObject)}e.rendered=!1}get running(){return this.view.ready&&(this._dirty||this.deconflictor.running)}runTask(e){return this._updateLabels(e),!this._dirty&&this.deconflictor.running&&this.deconflictor.runTask(e),O.YIELD}_updateLabels(e){if(this._dirty){this._dirty=!1;for(const t of this._labelingContexts)if(t.active)if(U(t))this._dirty=!0;else if(k(t.labelClassContexts)){if(null===t.labelClassContexts){this._deactivateLabelingContext(t);continue}this._createLabelClassContext(t),this._dirty=!0}else a(t.labelsToInitialize,((s,l)=>(this._ensureGraphics3DResources(s)&&(this._labels.set(l,s),this.deconflictor.setDirty(),e.madeProgress()),(s.visible&&s.textInitialized||!s.visible&&s.hasGraphics3DResources)&&(t.labelsToInitialize.delete(l),e.madeProgress()),e.done)))&&(this._dirty=!0);this._labelsToRemove.forEach((e=>this._removeLabelTextureFromAtlas(e))),this._labelsToAdd.forEach((e=>this._addLabelTextureToAtlas(e))),this._labelsToRemove.clear(),this._labelsToAdd.clear(),this._dirty||this.notifyChange("updating")}}async _createLabelClassContextAsync(e){const t=e.labelClassAbortController?.signal;e.layer.when&&await e.layer.when(),n(t),e.scaleVisibility&&e.scaleVisibility.updateScaleRangeActive();const a=e.graphics3DCore,r=a.layer,o=r.labelingInfo&&r.labelingInfo.filter((e=>!!e.symbol));if(!o||0===o.length)return;let c=!1;await s(o,(async(s,r)=>{const o=s.symbol,h=L(a.getOrCreateGraphics3DSymbol(o));if(null==h)return void i.getLogger(this).error("Failed to create Graphics3DSymbol for label");await h.load(),n(t);let b=null;g(o)&&o.hasVisibleCallout()&&(b=_(o,a.symbolCreationContext),await b.load(),n(t));const d=await l(y(s,e.layer.fieldsIndex,this.view.spatialReference));if(n(t),!0===d.ok){const l=await this._createTextRenderParameters(h.symbol);n(t),e.labelClassContexts[r]=new M(s,h,b,l,d.value)}else i.getLogger(this).error(`Label expression failed to evaluate: ${d.error}`),c=!0})),n(t)}async _createLabelClassContext(e){return null==e.labelClassPromise&&(e.labelClassPromise=this._createLabelClassContextAsync(e).catch((t=>{if(c(t))throw t;e.labelClassContexts.length=0})).then((()=>{e.labelClassAbortController=null,this.notifyChange("updating")})).catch((()=>{})),this.notifyChange("updating")),e.labelClassPromise}async _createTextRenderParameters(e){const t=e.symbolLayers.at(0);return"text"!==t?.type?null:P.fromSymbol(t,this.view.state.rasterPixelRatio)}_destroyLabelClassContext(e){for(const s of e.labelClassContexts)--s.graphics3DSymbol.referenced;const t=e.labelClassAbortController;e.labelClassAbortController=new AbortController,o(t),e.labelClassContexts.length=0,e.labelClassPromise=null,this.notifyChange("updating")}_createTextSymbolGraphic(e,t,s,l,i,a){const r=new v(s,A(s.anchor),D(s.anchor),e.text,p(e.displayWidth,e.displayHeight));return H.graphic=t,H.renderingInfo=null,H.layer=l,i.createLabel(H,r,this._hudMaterialCollection,this._textTextureAtlas,(()=>{const e=T(a);return e?e.elevationOffset:null}))}_createLineCalloutGraphic(e,t,s,l,i){return H.graphic=e,H.layer=i,H.renderingInfo=new C(null,t,l.translation,l.centerOffset,l.screenOffset,l.centerOffsetUnits,l.elevationOffset,this._calloutMaterialCollection),s.createGraphics3DGraphic(H)}_ensureGraphics3DResources(e){if(e.hasGraphics3DResources)return!1;const t=e.graphics3DGraphic;if(t.destroyed)return!1;this._ensureTextTextureResources(e);const s=e.labelingContext,l=s.labelClassContexts;if(k(l)||!s.emptySymbolLabelSupported&&0===t.layers.length)return!1;let i=!1;const a=t.graphic,r=s.layer,o=B(s.layer);for(let n=0;n<l.length;n++){const c=e.textRenderers[n],h=e.textLabelPlacements[n];if(null==c||null==h)continue;const b=l[n],d=b.graphics3DSymbol,p=d.symbol&&"label-3d"===d.symbol.type?d.symbol:null,u=d.symbolLayers[0];if(!u)continue;u.setElevationInfoOverride(s.elevationInfoOverride);const y=new w(t,p,b.labelClass),g=this._createTextSymbolGraphic(c,a,h,r,u,y);if(null==g)return!1;g._labelClass=b.labelClass,g._labelIndex=n,t.addLabelGraphic(g,s.stageLayer),t.deconflictionPriority=b.textRenderParameters?.definition.size??0,t.setVisibilityFlag(m.LABEL,f.USER,o),t.setVisibilityFlag(m.LABEL,f.SCALE_RANGE,!0),t.setVisibilityFlag(m.LABEL,f.DECONFLICTION,!1),i=!0;const _=b.graphics3DCalloutSymbolLayer;if(_&&h.hasLabelVerticalOffset){_.setElevationInfoOverride(s.elevationInfoOverride);const e=this._createLineCalloutGraphic(a,p,_,h,r);null!=e&&(b.calloutSymbolLayerIndex=t.labelLayers.length,t.addLabelGraphic(e,s.stageLayer))}break}return s.scaleVisibility&&i&&s.scaleVisibility.updateGraphicLabelScaleVisibility(t),e.hasGraphics3DResources=!0,!0}_destroyGraphics3DResources(e){const t=e.labelingContext.labelClassContexts;for(const s of e.graphics3DGraphic.labelLayers){if(null==s._labelClass)continue;const e=t[s._labelIndex].graphics3DSymbol.symbolLayers[0];null!=e&&e.onRemoveGraphic(s)}e.graphics3DGraphic.deconflictionPriority=0,e.graphics3DGraphic.clearLabelGraphics(),e.hasGraphics3DResources=!1}_ensureTextTextureResources(e){if(e.textInitialized)return;const t=e.labelingContext,s=t.labelClassContexts;if(k(s))return;const l=e.graphics3DGraphic.graphic;for(let a=0;a<s.length;a++){const r=s[a];if(e.textRenderers[a]=null,e.textLabelPlacements[a]=null,null==r?.textRenderParameters)continue;const o=r.labelFunction;let n;if("arcade"===o.type)try{const e=o.needsHydrationToEvaluate()?u(l,t.layer):l;n=o.evaluate(e)}catch(i){n=null}else n=o.evaluate(l);if(null==n||""===n||/^\s+$/.test(n))continue;const c=r.graphics3DSymbol,h="label-3d"===c.symbol?.type?c.symbol:null;if(!c.symbolLayers[0])continue;const b=e.graphics3DGraphic,d=r.labelClass,p=t.disablePlacement,y=T({graphics3DGraphic:b,labelSymbol:h,labelClass:d,disablePlacement:p});if(null==y)continue;const g=A(y.anchor),m=G(g);e.textRenderers[a]=new R(n,m,r.textRenderParameters),e.textLabelPlacements[a]=y}e.textInitialized=!0}_destroyTextTextureResources(e){e.textInitialized=!1,e.textRenderers.length=0,e.textLabelPlacements.length=0}_addGraphic(e,t){const s=t.graphic.uid;if(e.graphics.set(s,t),e.active){const l=new z(e,t);this._labels.set(s,l),e.labelsToInitialize.set(s,l)}this.setDirty(),this.deconflictor.setDirty()}_removeGraphic(e,t){const s=t.graphic.uid,l=this._labels.get(s);e.graphics.delete(s),l&&(this._destroyGraphic(l,s),e.labelsToInitialize.delete(s),this.setDirty(),this.deconflictor.setDirty())}_destroyGraphic(e,t){this._labels.has(t)&&(this._labels.delete(t),this._labelsToAdd.delete(t),this._labelsToRemove.delete(t)),e.textInitialized&&(this._removeLabelTextureFromAtlas(e),this._destroyTextTextureResources(e)),e.hasGraphics3DResources&&this._destroyGraphics3DResources(e)}async _labelingInfoChange(e,t){if(!t)return this._visibilityInfoChange(e),this._resetLabels(e),this._createLabelClassContext(e);for(const s of t){const t=e.graphics.get(s);t&&(this._removeGraphic(e,t),this._addGraphic(e,t))}}_globalPropertyChanged(e,t){for(const s of t.labelClassContexts){const l=new Map;t.graphics.forEach((e=>l.set(e.graphic.uid,e)));const i=e=>e.labelLayers[0];if(s.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,l,i),s.graphics3DCalloutSymbolLayer){const t=e=>e.labelLayers[s.calloutSymbolLayerIndex];s.graphics3DCalloutSymbolLayer.globalPropertyChanged(e,l,t)}}}_visibilityInfoChange(e){const t=B(e.layer);t&&!e.active&&this._activateLabelingContext(e),!t&&e.active&&this._deactivateLabelingContext(e),this.setDirty()}_resetAllLabels(){for(const e of this._labelingContexts)this._resetLabels(e)}_resetLabels(e){e.graphics.forEach(((t,s)=>{const l=this._labels.get(s);l&&(this._destroyGraphic(l,s),l.visible=!1,l.rendered=!1,e.labelsToInitialize.set(s,l))})),this._destroyLabelClassContext(e),this.setDirty(),this.deconflictor.setDirty()}_findLabelingContext(e){for(const t of this._labelingContexts)if(t.graphics3DCore===e)return t;return null}addGraphicsOwner(e,t,s){const l=s&&s.emptySymbolLabelSupported||!1,i=s&&s.elevationInfoOverride||null,a=s&&s.disablePlacement||null;if(this._findLabelingContext(e))return;const r=e.layer,o=new V(this.view._stage,r,e,t,l,i,a,B(r));return this._labelingContexts.push(o),this.setDirty(),{addGraphic:e=>this._addGraphic(o,e),removeGraphic:e=>this._removeGraphic(o,e),featureReductionChange:()=>{},layerLabelsEnabled:()=>B(o.layer),labelingInfoChange:e=>this._labelingInfoChange(o,e),elevationInfoChange:()=>this._globalPropertyChanged("elevationInfo",o),slicePlaneEnabledChange:()=>this._globalPropertyChanged("slicePlaneEnabled",o),visibilityInfoChange:()=>this._visibilityInfoChange(o),reset:()=>this._resetLabels(o),clear:()=>{}}}removeGraphicsOwner(e){const t=this._findLabelingContext(e);if(!t)return;const s=this._labelingContexts.indexOf(t);this._labelingContexts.splice(s,1),t.graphics.forEach((e=>this._removeGraphic(t,e))),t.destroy(),this.setDirty()}setLabelGraphicVisibility(e,t){const s=e.graphic.uid,l=this._labels.get(s);l&&l.visible!==t&&(t&&!l.rendered?(this._labelsToAdd.set(s,l),this._labelsToRemove.delete(s),l.textInitialized||l.labelingContext.labelsToInitialize.set(s,l)):!t&&l.rendered&&(this._labelsToRemove.set(s,l),this._labelsToAdd.delete(s)),l.visible=t,this.setDirty())}setDirty(){!this._dirty&&this._labelingContexts.length>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._dirty||this._textTextureAtlas?.updating||this.deconflictor.updating||this._labelingContexts.some((e=>U(e)))}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;const e=this._labelingContexts.length>0?this._labelingContexts.reduce(((e,t)=>e+(U(t)?0:1)),0)/this._labelingContexts.length:1;return(this._dirty?0:.3)+(this._textTextureAtlas.updating?0:.1)+.1*e+.5*this.deconflictor.updatingProgress}get test(){return{textTextureAtlas:this._textTextureAtlas,resetAllLabels:()=>this._resetAllLabels()}}};function U(e){return!!e.labelClassPromise&&!!e.labelClassAbortController}function k(e){return!e||0===e.length}function B(e){return!0===e.labelsVisible&&!!e.labelingInfo?.some((e=>!!e.symbol))}e([b({constructOnly:!0})],F.prototype,"view",void 0),e([b({constructOnly:!0})],F.prototype,"deconflictor",void 0),e([b()],F.prototype,"_textTextureAtlas",void 0),e([b({type:Boolean,readOnly:!0})],F.prototype,"updating",null),F=e([d("esri.views.3d.layers.graphics.Labeler")],F);const H=new x(null,null,null);export{F as Labeler,B as areLabelsVisible};