@arcgis/core 5.0.0-next.67 → 5.0.0-next.69

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 (619) hide show
  1. package/Ground.d.ts +3 -4
  2. package/WebDocument2D.d.ts +1 -1
  3. package/WebLinkChart.d.ts +2 -0
  4. package/analysis/ElevationProfile/ElevationProfileLineQuery.d.ts +3 -4
  5. package/analysis/ElevationProfile/ElevationProfileLineViewOptions.d.ts +9 -6
  6. package/analysis/ElevationProfile/ElevationProfileLineViewOptions.js +1 -1
  7. package/analysis/types.d.ts +1 -0
  8. package/applications/Components/analysisUtils.d.ts +1 -3
  9. package/applications/Components/arcadeFeatureUtils.d.ts +1 -1
  10. package/applications/ExperienceBuilder/sketchUtils.d.ts +2 -2
  11. package/applications/KnowledgeStudio/reshape.d.ts +2 -2
  12. package/applications/SceneViewer/sceneViewerUtils.d.ts +11 -0
  13. package/applications/SceneViewer/sceneViewerUtils.js +1 -1
  14. package/arcade/arcadeAsyncRuntime.js +1 -1
  15. package/arcade/arcadeCompiler.js +1 -1
  16. package/arcade/arcadeRuntime.js +1 -1
  17. package/arcade/batchExec.js +1 -1
  18. package/arcade/compilerUtils.js +1 -1
  19. package/arcade/featureset/actions/SpatialFilter.js +1 -1
  20. package/arcade/geometry/unitConversion.js +1 -1
  21. package/arcade/treeAnalysis.js +1 -1
  22. package/arcade.js +1 -1
  23. package/assets/esri/core/libs/libtess/libtess-f32.wasm +0 -0
  24. package/assets/esri/core/libs/libtess/libtess-f64.wasm +0 -0
  25. package/assets/esri/core/workers/RemoteClient.js +1 -1
  26. package/assets/esri/core/workers/chunks/01d7542d85a453384cf1.js +1 -0
  27. package/assets/esri/core/workers/chunks/{251eb6e00f99a816d55c.js → 0326314947734b8e640a.js} +1 -1
  28. package/assets/esri/core/workers/chunks/04176244b0a3539c9681.js +1 -0
  29. package/assets/esri/core/workers/chunks/{168ec8fca2702617a543.js → 09dfec3e097ebbef6a89.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{942fad4ec96295672ce8.js → 10e474d664b20adcd917.js} +1 -1
  31. package/assets/esri/core/workers/chunks/12f9a55253084a910b2e.js +1 -0
  32. package/assets/esri/core/workers/chunks/{0629087bd5bb8048493e.js → 14dedd80fb797303f91f.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{81d89107ff82604a3ea0.js → 1b445981fbc8373f4dd8.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{794960ec36e11f4416c2.js → 1d1e25bb61eeeee8ee94.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{6ba3c2b9f699d94d62b8.js → 1ec1a1997b5577619040.js} +1 -1
  36. package/assets/esri/core/workers/chunks/2085084324cd5a81783f.js +1 -0
  37. package/assets/esri/core/workers/chunks/2c2c0f66cffc521df736.js +1 -0
  38. package/assets/esri/core/workers/chunks/2dd347aa2a061d536e69.js +1 -0
  39. package/assets/esri/core/workers/chunks/2dfa7abf2d39fa5a3874.js +1 -0
  40. package/assets/esri/core/workers/chunks/{6cb44cd319cb6c2539c8.js → 2e2c47f8a80ee9234350.js} +1 -1
  41. package/assets/esri/core/workers/chunks/322085d63719da6e443c.js +1 -0
  42. package/assets/esri/core/workers/chunks/{76086517591d0eb35156.js → 34a2e0462eb05986cdd1.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{a6dcd13c792b6538ac50.js → 35593a9790818b689455.js} +1 -1
  44. package/assets/esri/core/workers/chunks/3a04153ca9d8e4f01185.js +1 -0
  45. package/assets/esri/core/workers/chunks/{4e9a8fce55cad841c731.js → 3b25f5d9c8f78bb6e011.js} +1 -1
  46. package/assets/esri/core/workers/chunks/3e7ea06b342e33bc48a5.js +1 -0
  47. package/assets/esri/core/workers/chunks/3ed317900f0edf635508.js +1 -0
  48. package/assets/esri/core/workers/chunks/401ce5cb98fa14c1a725.js +1 -0
  49. package/assets/esri/core/workers/chunks/4319b89cfa02894a8cae.js +1 -0
  50. package/assets/esri/core/workers/chunks/{7bed14d9bcd7fc5e2eec.js → 4bcd74951477e8977ba1.js} +1 -1
  51. package/assets/esri/core/workers/chunks/4c04c54330b693892cfc.js +314 -0
  52. package/assets/esri/core/workers/chunks/{687d2b761dc5b5cf0c31.js → 4d4d71d24c1a9cb342b8.js} +1 -1
  53. package/assets/esri/core/workers/chunks/4fa230dc6e5e87b0dec1.js +1 -0
  54. package/assets/esri/core/workers/chunks/50f03813fba4b752ca9f.js +1 -0
  55. package/assets/esri/core/workers/chunks/{abc236e99b52be1c83b9.js → 52a14266fe239b95c5ce.js} +1 -1
  56. package/assets/esri/core/workers/chunks/53b5c77832df7df4d4e3.js +1 -0
  57. package/assets/esri/core/workers/chunks/{34178ace79e8dea3567d.js → 562cddaf63985e53ee6e.js} +1 -1
  58. package/assets/esri/core/workers/chunks/563933a84fc9b0e021f6.js +1 -0
  59. package/assets/esri/core/workers/chunks/58b3a776ef129f7f86dc.js +1 -0
  60. package/assets/esri/core/workers/chunks/58e8d41dcc450e6427c9.js +1 -0
  61. package/assets/esri/core/workers/chunks/{6599cc702a46f81a5634.js → 5dd5be91038df8902dc4.js} +1 -1
  62. package/assets/esri/core/workers/chunks/{49a1b7f700b8a42de817.js → 60c7f896f2246a8aa6d7.js} +19 -19
  63. package/assets/esri/core/workers/chunks/60f363ee2add089e8f0b.js +1 -0
  64. package/assets/esri/core/workers/chunks/68074a484d7f9bc713c0.js +1 -0
  65. package/assets/esri/core/workers/chunks/6acfa51b81e6f4255118.js +1 -0
  66. package/assets/esri/core/workers/chunks/{3fe7be535affae31de7e.js → 6b85a8776ec2beff63cb.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{0dc3a04ce717b7ddd957.js → 6c9dac4a869742cc2718.js} +1 -1
  68. package/assets/esri/core/workers/chunks/6df484faf54e90a6cc77.js +1 -0
  69. package/assets/esri/core/workers/chunks/6ea6ad894ac634aa4391.js +1 -0
  70. package/assets/esri/core/workers/chunks/6f8098f9fe233833245a.js +1 -0
  71. package/assets/esri/core/workers/chunks/75fd2ef1236a9364ca7f.js +1 -0
  72. package/assets/esri/core/workers/chunks/7be9bbae23895d1cfa92.js +1 -0
  73. package/assets/esri/core/workers/chunks/7ea48661f1087d06aa41.js +1 -0
  74. package/assets/esri/core/workers/chunks/{47e5149765beee46f208.js → 7ee68f67f9cc48a328f0.js} +1 -1
  75. package/assets/esri/core/workers/chunks/{e5aac523c37d906eece6.js → 827277e5da652bcecaf2.js} +1 -1
  76. package/assets/esri/core/workers/chunks/866477acdf03b8a40bc9.js +1 -0
  77. package/assets/esri/core/workers/chunks/8e83c133b201b9b61e70.js +1 -0
  78. package/assets/esri/core/workers/chunks/9086a4933d3d3d9ffa72.js +1 -0
  79. package/assets/esri/core/workers/chunks/94174d40de39dbe7d0bf.js +1 -0
  80. package/assets/esri/core/workers/chunks/{dd99b77a7c0a052507bb.js → 9d88b4ba8e511da64583.js} +3 -3
  81. package/assets/esri/core/workers/chunks/9f34cf024231f574009c.js +1 -0
  82. package/assets/esri/core/workers/chunks/{e705d041f6c1632bfbcc.js → a10c6dd3bb8b3602de68.js} +1 -1
  83. package/assets/esri/core/workers/chunks/a64cd02ca959d511101c.js +1 -0
  84. package/assets/esri/core/workers/chunks/a808be466812db51813d.js +1 -0
  85. package/assets/esri/core/workers/chunks/{6b4a24248182245167ca.js → a931515a2569713e743b.js} +1 -1
  86. package/assets/esri/core/workers/chunks/a95e28ade258b144cbb5.js +1 -0
  87. package/assets/esri/core/workers/chunks/adc68e2c6d2698a52bfe.js +1 -0
  88. package/assets/esri/core/workers/chunks/{0f8149fdcf0adeca268e.js → b28e0b89603d8b03f9e1.js} +1 -1
  89. package/assets/esri/core/workers/chunks/b5e4a36784d598ae6679.js +1 -0
  90. package/assets/esri/core/workers/chunks/{204d738c8b651314ae64.js → b899b4e7979c13b99526.js} +1 -1
  91. package/assets/esri/core/workers/chunks/bb4574a87ca21e719f0d.js +1 -0
  92. package/assets/esri/core/workers/chunks/{07639f406b71bb49ffd6.js → bdbb5b33f0f49661bf6d.js} +1 -1
  93. package/assets/esri/core/workers/chunks/bf05164b7a3e4f31e9db.js +1 -0
  94. package/assets/esri/core/workers/chunks/c042269586921e337be9.js +1 -0
  95. package/assets/esri/core/workers/chunks/c7391b0b5a9c916a53f7.js +1 -0
  96. package/assets/esri/core/workers/chunks/{43d28c6509c21b8917a8.js → ca7523c14d81c470e92e.js} +1 -1
  97. package/assets/esri/core/workers/chunks/d0ae8752419d5b761190.js +1 -0
  98. package/assets/esri/core/workers/chunks/d445e9399fe4ca3d2a50.js +1 -0
  99. package/assets/esri/core/workers/chunks/d7683a95775c9f401a7e.js +1 -0
  100. package/assets/esri/core/workers/chunks/{9d6945cda99d14af83ac.js → d7d9656b990ce8be2152.js} +1 -1
  101. package/assets/esri/core/workers/chunks/dbfb00fb28b8b9f687a1.js +1 -0
  102. package/assets/esri/core/workers/chunks/df4a0af329ce94a47a7b.js +1 -0
  103. package/assets/esri/core/workers/chunks/e071b912539304564b69.js +1 -0
  104. package/assets/esri/core/workers/chunks/e10d6e511921394474ca.js +1 -0
  105. package/assets/esri/core/workers/chunks/e4b6aa8f67c2bd285020.js +1 -0
  106. package/assets/esri/core/workers/chunks/e6ca02f98f855024f74b.js +1 -0
  107. package/assets/esri/core/workers/chunks/{892157696e8f9e38c472.js → e6e837e43b9348050832.js} +1 -1
  108. package/assets/esri/core/workers/chunks/{d3325ed8d224e2350db7.js → e8a3ad00936f2ccaf362.js} +1 -1
  109. package/assets/esri/core/workers/chunks/ef7063ee790d2d64d4b2.js +1 -0
  110. package/assets/esri/core/workers/chunks/{b65fcfde62d49de1fa54.js → ef977be20a647aeded0a.js} +1 -1
  111. package/assets/esri/core/workers/chunks/efb631371b6bb3f043bb.js +1 -0
  112. package/assets/esri/core/workers/chunks/{0f5693541111fcae0c2f.js → f0914715e90e43466f8c.js} +1 -1
  113. package/assets/esri/core/workers/chunks/{ab71865b94022e78035c.js → f92845eb7df1804fcd6d.js} +1 -1
  114. package/assets/esri/core/workers/chunks/{bfc063d4431bfa162160.js → fd09f38fb4d99bf34988.js} +1 -1
  115. package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +108 -0
  116. package/assets/esri/themes/dark/main.css +1 -1
  117. package/assets/esri/themes/light/main.css +1 -1
  118. package/assets/esri/themes/light/view.css +1 -1
  119. package/chunks/GaussianSplat.glsl.js +2 -2
  120. package/chunks/GaussianSplatDepthComposition.glsl.js +4 -5
  121. package/chunks/HUDMaterial.glsl.js +45 -47
  122. package/chunks/LineMarker.glsl.js +33 -34
  123. package/chunks/PointRenderer.glsl.js +6 -6
  124. package/chunks/RibbonLine.glsl.js +62 -54
  125. package/chunks/boundedPlane.js +1 -1
  126. package/chunks/libtess-f32.js +1 -1
  127. package/chunks/libtess-f64.js +1 -1
  128. package/config.js +1 -1
  129. package/core/Collection.d.ts +3 -2
  130. package/core/Identifiable.d.ts +1 -3
  131. package/core/accessorSupport/ensureType.js +1 -1
  132. package/core/accessorSupport/types.d.ts +0 -8
  133. package/core/compilerUtils.js +1 -1
  134. package/core/promiseUtils.d.ts +1 -1
  135. package/core/reactiveUtils.d.ts +2 -2
  136. package/core/typedArrayUtil.js +1 -1
  137. package/core/units.d.ts +8 -2
  138. package/core/units.js +1 -1
  139. package/core/workers/loaderConfig.js +1 -1
  140. package/editing/sharedTemplates/SharedTemplate.js +1 -1
  141. package/geometry/HeightModelInfo.d.ts +3 -3
  142. package/geometry/SpatialReference.d.ts +2 -2
  143. package/geometry/libtess.js +1 -1
  144. package/geometry/support/MeshTexture.js +1 -1
  145. package/geometry/support/aaBoundingRect.js +1 -1
  146. package/geometry/support/boundedPlane.js +1 -1
  147. package/geometry/support/heightModelInfoUtils.js +1 -1
  148. package/geometry/support/meshUtils/External.js +1 -1
  149. package/geometry/support/meshUtils/exporters/gltf/imageutils.js +1 -1
  150. package/geometry/support/meshUtils/loadExternal.js +1 -1
  151. package/geometry/support/meshUtils/types.d.ts +2 -2
  152. package/geometry/support/rotate.js +1 -1
  153. package/geometry/types.d.ts +2 -0
  154. package/identity/IdentityManagerBase.d.ts +4 -4
  155. package/interfaces.d.ts +2937 -2955
  156. package/kernel.js +1 -1
  157. package/layers/BaseElevationLayer.d.ts +3 -4
  158. package/layers/BuildingSceneLayer.d.ts +1 -1
  159. package/layers/ElevationLayer.d.ts +3 -4
  160. package/layers/FeatureLayer.d.ts +12 -11
  161. package/layers/FeatureLayer.js +1 -1
  162. package/layers/GroupLayer.d.ts +3 -3
  163. package/layers/ImageryLayer.d.ts +3 -3
  164. package/layers/ImageryTileLayer.d.ts +3 -4
  165. package/layers/Layer.d.ts +4 -4
  166. package/layers/LineOfSightLayer.d.ts +1 -1
  167. package/layers/LinkChartLayer.js +1 -1
  168. package/layers/MapImageLayer.d.ts +7 -8
  169. package/layers/MediaLayer.d.ts +3 -3
  170. package/layers/OrientedImageryLayer.d.ts +3 -3
  171. package/layers/ParquetLayer.d.ts +1 -1
  172. package/layers/ParquetLayer.js +1 -1
  173. package/layers/RouteLayer.d.ts +2 -3
  174. package/layers/SceneLayer.d.ts +167 -3
  175. package/layers/SceneLayer.js +1 -1
  176. package/layers/StreamLayer.d.ts +3 -3
  177. package/layers/SubtypeGroupLayer.d.ts +3 -3
  178. package/layers/WCSLayer.d.ts +3 -3
  179. package/layers/buildingSublayers/BuildingGroupSublayer.d.ts +1 -1
  180. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  181. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  182. package/layers/graphics/dehydratedFeatureComparison.js +1 -1
  183. package/layers/graphics/dehydratedFeatures.js +1 -1
  184. package/layers/graphics/hydratedFeatures.js +1 -1
  185. package/layers/graphics/sources/ParquetSource.d.ts +1 -1
  186. package/layers/graphics/sources/support/QueryTask.js +1 -1
  187. package/layers/mixins/SceneService.d.ts +2 -2
  188. package/layers/orientedImagery/queries.js +1 -1
  189. package/layers/orientedImagery/transformations/imageToWorld.d.ts +2 -2
  190. package/layers/orientedImagery/transformations/rectifyMapPoint.js +1 -1
  191. package/layers/orientedImagery/transformations/types.d.ts +1 -1
  192. package/layers/raster/datasets/pixelReader.d.ts +1 -7
  193. package/layers/raster/functions/changeDetectionUtils.js +1 -1
  194. package/layers/raster/functions/creators/createBandIndexFunctions.d.ts +29 -29
  195. package/layers/raster/functions/customBandIndexUtils.js +1 -1
  196. package/layers/raster/functions/focalStatUtils.js +1 -1
  197. package/layers/raster/functions/pixelTransformUtils.js +1 -1
  198. package/layers/save/featureLayerUtils.js +1 -1
  199. package/layers/support/BuildingFilterMode.d.ts +3 -1
  200. package/layers/support/BuildingFilterMode.js +1 -1
  201. package/layers/support/BuildingFilterModeSolid.js +1 -1
  202. package/layers/support/BuildingFilterModeWireFrame.js +1 -1
  203. package/layers/support/BuildingFilterModeXRay.js +1 -1
  204. package/layers/support/CodedValue.d.ts +1 -1
  205. package/layers/support/ControlPoint.d.ts +6 -20
  206. package/layers/support/ControlPointsGeoreference.d.ts +2 -1
  207. package/layers/support/ElevationSampler.d.ts +2 -2
  208. package/layers/support/ElevationSampler.js +1 -1
  209. package/layers/support/FeatureReductionBinning.d.ts +4 -4
  210. package/layers/support/FeatureReductionBinning.js +1 -1
  211. package/layers/support/FeatureReductionSelection.d.ts +3 -3
  212. package/layers/support/FeatureReductionSelection.js +1 -1
  213. package/layers/support/Field.d.ts +1 -2
  214. package/layers/support/ParquetGeometryEncodingLocation.d.ts +6 -4
  215. package/layers/support/ParquetGeometryEncodingLocation.js +1 -1
  216. package/layers/support/ParquetGeometryEncodingWkb.d.ts +6 -4
  217. package/layers/support/ParquetGeometryEncodingWkb.js +1 -1
  218. package/layers/support/PixelBlock.d.ts +11 -3
  219. package/layers/support/RangeDomain.d.ts +2 -1
  220. package/layers/support/SceneServiceTimeInfo.js +5 -0
  221. package/layers/support/SpriteSource.d.ts +1 -0
  222. package/layers/support/Sublayer.d.ts +17 -16
  223. package/layers/support/Sublayer.js +1 -1
  224. package/layers/support/SubtypeSublayer.js +1 -1
  225. package/layers/support/domains.js +1 -1
  226. package/layers/support/featureReductionUtils.js +1 -1
  227. package/layers/support/rasterFunctionUtils.d.ts +30 -30
  228. package/layers/support/types.d.ts +101 -1
  229. package/layers/types.d.ts +12 -1
  230. package/layers/wms/types.d.ts +0 -4
  231. package/networks/CircuitManager.d.ts +5 -5
  232. package/networks/Network.d.ts +5 -5
  233. package/networks/UtilityNetwork.d.ts +2 -2
  234. package/networks/support/TopologyValidationJobInfo.js +1 -1
  235. package/networks/support/TraceJobInfo.js +1 -1
  236. package/package.json +2 -2
  237. package/popup/content/types.d.ts +1 -3
  238. package/portal/PortalItem.d.ts +8 -8
  239. package/portal/PortalItemResource.d.ts +2 -2
  240. package/portal/PortalUser.d.ts +3 -3
  241. package/portal/support/resourceUtils.d.ts +3 -3
  242. package/portal/types.d.ts +6 -6
  243. package/renderers/support/RasterSymbolizer.js +1 -1
  244. package/renderers/support/pointCloud/types.d.ts +1 -0
  245. package/renderers/support/raster/types.d.ts +1 -0
  246. package/renderers/support/rendererConversion.js +1 -1
  247. package/renderers/types.d.ts +2 -0
  248. package/renderers/visualVariables/support/visualVariableUtils.js +1 -1
  249. package/rest/knowledgeGraph/wasmInterface/WasmDataModelWrapperInterfaces.d.ts +0 -2
  250. package/rest/layerSources/DynamicDataLayer.d.ts +102 -0
  251. package/rest/layerSources/DynamicDataLayer.js +5 -0
  252. package/{layers/support/source/MapLayerSource.d.ts → rest/layerSources/DynamicMapLayer.d.ts} +4 -4
  253. package/rest/layerSources/DynamicMapLayer.js +5 -0
  254. package/rest/layerSources/JoinTableDataSource.d.ts +75 -0
  255. package/rest/layerSources/JoinTableDataSource.js +5 -0
  256. package/{layers/support/source → rest/layerSources}/QueryTableDataSource.d.ts +8 -7
  257. package/rest/layerSources/QueryTableDataSource.js +5 -0
  258. package/{layers/support/source → rest/layerSources}/RasterDataSource.d.ts +2 -2
  259. package/rest/layerSources/RasterDataSource.js +5 -0
  260. package/{layers/support/source → rest/layerSources}/TableDataSource.d.ts +2 -2
  261. package/rest/layerSources/TableDataSource.js +5 -0
  262. package/rest/layerSources/utils.js +5 -0
  263. package/rest/print.js +1 -1
  264. package/rest/query/executeQuery.js +1 -1
  265. package/rest/query/operations/pbfDehydratedFeatureSet.js +1 -1
  266. package/rest/support/JobInfo.js +1 -1
  267. package/rest/support/Query.js +1 -1
  268. package/rest/support/RelationshipQuery.js +1 -1
  269. package/rest/support/ServiceAreaParameters.js +1 -1
  270. package/rest/support/types.d.ts +0 -4
  271. package/smartMapping/heuristics/binLevel.d.ts +2 -2
  272. package/smartMapping/heuristics/scaleRange.d.ts +2 -2
  273. package/smartMapping/heuristics/sizeRange.d.ts +2 -2
  274. package/smartMapping/heuristics/sizeRange.js +1 -1
  275. package/smartMapping/heuristics/types.d.ts +3 -3
  276. package/smartMapping/labels/bins.d.ts +2 -2
  277. package/smartMapping/labels/clusters.d.ts +2 -2
  278. package/smartMapping/renderers/color.d.ts +14 -14
  279. package/smartMapping/renderers/dotDensity.d.ts +2 -2
  280. package/smartMapping/renderers/heatmap.d.ts +4 -4
  281. package/smartMapping/renderers/location.d.ts +2 -2
  282. package/smartMapping/renderers/opacity.d.ts +2 -2
  283. package/smartMapping/renderers/pieChart.d.ts +4 -4
  284. package/smartMapping/renderers/predominance.d.ts +2 -2
  285. package/smartMapping/renderers/relationship.d.ts +4 -4
  286. package/smartMapping/renderers/size.d.ts +15 -15
  287. package/smartMapping/renderers/support/rendererUtils.d.ts +2 -2
  288. package/smartMapping/renderers/support/utils.js +1 -1
  289. package/smartMapping/renderers/type.d.ts +4 -4
  290. package/smartMapping/renderers/univariateColorSize.d.ts +4 -4
  291. package/smartMapping/statistics/classBreaks.d.ts +2 -2
  292. package/smartMapping/statistics/heatmapStatistics.d.ts +2 -2
  293. package/smartMapping/statistics/histogram.d.ts +2 -2
  294. package/smartMapping/statistics/predominantCategories.d.ts +2 -2
  295. package/smartMapping/statistics/summaryStatistics.d.ts +2 -2
  296. package/smartMapping/statistics/summaryStatisticsForAge.d.ts +2 -2
  297. package/smartMapping/statistics/support/ageUtils.d.ts +2 -2
  298. package/smartMapping/statistics/support/statsWorker.js +1 -1
  299. package/smartMapping/statistics/support/utils.js +1 -1
  300. package/smartMapping/statistics/types.d.ts +7 -7
  301. package/smartMapping/statistics/uniqueValues.d.ts +2 -2
  302. package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
  303. package/smartMapping/support/adapters/InMemoryLayerAdapter.js +1 -1
  304. package/smartMapping/support/adapters/support/histogramUtils.js +1 -1
  305. package/smartMapping/support/utils.js +1 -1
  306. package/smartMapping/symbology/color.d.ts +8 -8
  307. package/smartMapping/symbology/dotDensity.d.ts +6 -6
  308. package/smartMapping/symbology/flow.d.ts +6 -6
  309. package/smartMapping/symbology/heatmap.d.ts +6 -6
  310. package/smartMapping/symbology/location.d.ts +2 -2
  311. package/smartMapping/symbology/pieChart.d.ts +6 -6
  312. package/smartMapping/symbology/predominance.d.ts +6 -6
  313. package/smartMapping/symbology/relationship.d.ts +6 -6
  314. package/smartMapping/symbology/size.d.ts +2 -2
  315. package/smartMapping/symbology/support/colorRamps.d.ts +2 -2
  316. package/smartMapping/symbology/type.d.ts +6 -6
  317. package/support/popupUtils.d.ts +2 -2
  318. package/support/revision.js +1 -1
  319. package/symbols/LineSymbol3D.d.ts +2 -2
  320. package/symbols/PointSymbol3D.d.ts +2 -2
  321. package/symbols/PolygonSymbol3D.d.ts +2 -2
  322. package/symbols/patterns/LinePattern3D.d.ts +8 -0
  323. package/symbols/patterns/LineStylePattern3D.d.ts +1 -2
  324. package/symbols/patterns/Pattern3D.d.ts +9 -0
  325. package/symbols/patterns/StylePattern3D.d.ts +1 -2
  326. package/symbols/support/ElevationInfo.d.ts +2 -2
  327. package/symbols/support/IconSymbol3DLayerResource.d.ts +1 -1
  328. package/symbols/support/defaults.js +1 -1
  329. package/symbols/support/defaults3D.js +1 -1
  330. package/symbols/support/previewSymbol3D.js +1 -1
  331. package/symbols/support/symbolLayerUtils3D.js +1 -1
  332. package/symbols/support/symbolUtils.js +1 -1
  333. package/symbols/support/utils.js +1 -1
  334. package/symbols/types.d.ts +7 -0
  335. package/unionTypes.d.ts +13 -13
  336. package/views/2d/analysis/ElevationProfile/ElevationProfileLineVisualization2D.js +1 -1
  337. package/views/2d/analysis/ElevationProfileAnalysisView2D.d.ts +16 -11
  338. package/views/2d/analysis/ElevationProfileAnalysisView2D.js +1 -1
  339. package/views/2d/analysis/types.d.ts +1 -0
  340. package/views/2d/engine/imagery/RasterVFDisplayObject.js +1 -1
  341. package/views/2d/engine/vectorTiles/VectorTile.js +1 -1
  342. package/views/2d/engine/webgl/TextureUploadManager.js +1 -1
  343. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  344. package/views/2d/input/handlers/DoubleTapDragZoom.js +1 -1
  345. package/views/2d/input/handlers/KeyZoom.js +1 -1
  346. package/views/2d/layers/BaseLayerView2D.d.ts +0 -5
  347. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  348. package/views/2d/layers/StreamLayerView2D.js +1 -1
  349. package/views/2d/layers/TileLayerView2D.js +1 -1
  350. package/views/2d/layers/features/Processor.js +1 -1
  351. package/views/2d/layers/support/MediaLayerInteractionOptions.js +1 -1
  352. package/views/3d/analysis/AreaMeasurement/support/utils.js +1 -1
  353. package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
  354. package/views/3d/analysis/ElevationProfile/ElevationProfileLineVisualization3D.js +1 -1
  355. package/views/3d/analysis/ElevationProfileAnalysisView3D.d.ts +16 -11
  356. package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
  357. package/views/3d/analysis/LineOfSightAnalysisView3D.d.ts +0 -2
  358. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  359. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  360. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementTool.js +1 -1
  361. package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
  362. package/views/3d/analysis/types.d.ts +1 -0
  363. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  364. package/views/3d/environment/CloudsParameters.js +1 -1
  365. package/views/3d/environment/CloudsRenderer.js +1 -1
  366. package/views/3d/environment/SceneViewEnvironment.js +1 -1
  367. package/views/3d/environment/SunLighting.d.ts +1 -3
  368. package/views/3d/glTF/internal/Resource.js +1 -1
  369. package/views/3d/glTF/internal/fillDefaults.js +1 -1
  370. package/views/3d/interactive/Manipulator3D.js +1 -1
  371. package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
  372. package/views/3d/interactive/editingTools/isSupportedObjectUtils.js +1 -1
  373. package/views/3d/interactive/editingTools/move/isSupportedObject.js +1 -1
  374. package/views/3d/interactive/editingTools/transform/isSupportedGraphic.js +1 -1
  375. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  376. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  377. package/views/3d/layers/I3SMeshView3D.js +1 -1
  378. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  379. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  380. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  381. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  382. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  383. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  384. package/views/3d/layers/graphics/LabelInfo.js +1 -1
  385. package/views/3d/layers/graphics/defaultSymbolComplexity.js +1 -1
  386. package/views/3d/layers/graphics/lineUtils.js +1 -1
  387. package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
  388. package/views/3d/layers/graphics/pipeline/symbolization/primitiveObjectUtils.js +1 -1
  389. package/views/3d/layers/graphics/primitiveObjectSymbolUtils.js +1 -1
  390. package/views/3d/layers/i3s/BuildingFilterUtil.js +1 -1
  391. package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
  392. package/views/3d/layers/i3s/I3SNode.js +1 -1
  393. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  394. package/views/3d/layers/i3s/PointCloudWorkerUtil.js +1 -1
  395. package/views/3d/layers/i3s/SphereCone.js +5 -0
  396. package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
  397. package/views/3d/layers/support/MediaLayerInteractionOptions.d.ts +4 -0
  398. package/views/3d/layers/support/edgeUtils.js +1 -1
  399. package/views/3d/layers/support/featureReference.js +1 -1
  400. package/views/3d/layers/support/featureTileQuery3D.js +1 -1
  401. package/views/3d/layers/support/patternUtils.js +1 -1
  402. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  403. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  404. package/views/3d/support/FrustumExtentIntersection.js +1 -1
  405. package/views/3d/support/QualityProfile.js +1 -1
  406. package/views/3d/support/QualitySettings.js +1 -1
  407. package/views/3d/support/buffer/glUtil.js +1 -1
  408. package/views/3d/support/engineContent/sdfPrimitives.js +1 -1
  409. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  410. package/views/3d/support/gaussianSplatting/GaussianSplatFadeTexture.js +1 -1
  411. package/views/3d/support/viewpointUtils.js +1 -1
  412. package/views/3d/terrain/isTerrainSurfaceLayer.js +1 -1
  413. package/views/3d/webgl/RenderNode.js +1 -1
  414. package/views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js +8 -8
  415. package/views/3d/webgl-engine/collections/Component/Transform.js +1 -1
  416. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +3 -3
  417. package/views/3d/webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js +4 -4
  418. package/views/3d/webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js +2 -2
  419. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexNormal.glsl.js +2 -2
  420. package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeFragmentNormals.glsl.js +6 -6
  421. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +1 -1
  422. package/views/3d/webgl-engine/core/shaderLibrary/shading/Normals.glsl.js +5 -5
  423. package/views/3d/webgl-engine/core/shaderLibrary/shading/PositionOutsideClipSpace.js +5 -0
  424. package/views/3d/webgl-engine/core/shaderLibrary/terrain/TileBackground.glsl.js +3 -3
  425. package/views/3d/webgl-engine/core/shaderLibrary/util/BlendModes.glsl.js +1 -1
  426. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  427. package/views/3d/webgl-engine/lib/LocalOriginManager.js +1 -1
  428. package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
  429. package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
  430. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  431. package/views/3d/webgl-engine/lib/edgeRendering/LegacyTransform.js +5 -0
  432. package/views/3d/webgl-engine/materials/lineStippleUtils.js +1 -1
  433. package/views/3d/webgl-engine/shaders/CompositingTechnique.js +1 -1
  434. package/views/3d/webgl-engine/shaders/GaussianSplat.glsl.js +1 -1
  435. package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
  436. package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
  437. package/views/3d/webgl-engine/shaders/LineMarker.glsl.js +1 -1
  438. package/views/3d/webgl-engine/shaders/PointRenderer.glsl.js +1 -1
  439. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  440. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  441. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/LineAmplitude.glsl.js +4 -4
  442. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/LineOffset.glsl.js +8 -8
  443. package/views/SceneView.js +1 -1
  444. package/views/VideoView.js +1 -1
  445. package/views/View.js +1 -1
  446. package/views/View2D.js +1 -1
  447. package/views/analysis/ElevationProfile/ElevationProfileController.js +1 -1
  448. package/views/analysis/ElevationProfile/ElevationProfileIndicatorPointVisualization.js +5 -0
  449. package/views/analysis/ElevationProfile/ElevationProfileLineComputation.js +1 -1
  450. package/views/analysis/ElevationProfile/ElevationProfileResult.js +1 -1
  451. package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
  452. package/views/analysis/ElevationProfile/constants.js +1 -1
  453. package/views/analysis/types.d.ts +4 -0
  454. package/views/draw/Draw.js +1 -1
  455. package/views/input/ViewEvents.js +1 -1
  456. package/views/input/types.d.ts +2 -4
  457. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  458. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
  459. package/views/interactive/snapping/featureSources/snappingCandidateElevationAlignment.js +1 -1
  460. package/views/interactive/snapping/featureSources/snappingCandidateElevationFilter.js +1 -1
  461. package/views/interactive/snapping/featureSources/symbologySnappingCandidates.js +1 -1
  462. package/views/layers/CatalogLayerView.d.ts +1 -4
  463. package/views/layers/DimensionLayerView.d.ts +4 -6
  464. package/views/layers/DimensionLayerViewMixin.d.ts +0 -97
  465. package/views/layers/LineOfSightLayerView.d.ts +4 -6
  466. package/views/layers/LineOfSightLayerViewMixin.d.ts +0 -77
  467. package/views/layers/StreamLayerView.d.ts +31 -2
  468. package/views/support/PromiseQueue.js +1 -1
  469. package/views/support/WebAssemblyRequirements.js +5 -0
  470. package/views/support/WebGLRequirements.js +1 -1
  471. package/views/support/screenUtils.js +1 -1
  472. package/views/support/screenshotUtils.js +1 -1
  473. package/views/webgl/FramebufferObject.js +1 -1
  474. package/views/webgl/Uniform.js +1 -1
  475. package/views/webgl/Util.js +1 -1
  476. package/webdoc/support/SlideThumbnail.d.ts +6 -3
  477. package/webdoc/support/SlideThumbnail.js +1 -1
  478. package/webscene/Slide.d.ts +2 -2
  479. package/webscene/spec-certification/api.js +1 -1
  480. package/widgets/AreaMeasurement2D/AreaMeasurement2DViewModel.d.ts +2 -2
  481. package/widgets/AreaMeasurement2D/AreaMeasurement2DViewModel.js +1 -1
  482. package/widgets/AreaMeasurement3D/AreaMeasurement3DViewModel.d.ts +2 -2
  483. package/widgets/AreaMeasurement3D/AreaMeasurement3DViewModel.js +1 -1
  484. package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
  485. package/widgets/BatchAttributeForm/inputs/InputBase.js +1 -1
  486. package/widgets/BatchAttributeForm/inputs/TextElementInput.d.ts +7 -0
  487. package/widgets/BatchAttributeForm/inputs/TextElementInput.js +1 -1
  488. package/widgets/BatchAttributeForm/inputs/support/textInputElementUtils.js +5 -0
  489. package/widgets/BatchAttributeForm/templates/TextElementTemplate.js +1 -1
  490. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  491. package/widgets/BatchAttributeForm/templates/support/hashElementTemplate.js +1 -1
  492. package/widgets/BatchAttributeForm.js +1 -1
  493. package/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.d.ts +2 -2
  494. package/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js +1 -1
  495. package/widgets/Directions/DirectionsViewModel.d.ts +20 -4
  496. package/widgets/Directions/DirectionsViewModel.js +1 -1
  497. package/widgets/Directions.d.ts +2 -3
  498. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.d.ts +2 -2
  499. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.js +1 -1
  500. package/widgets/Editor/EditorViewModel.d.ts +2 -2
  501. package/widgets/Editor/workflowUtils.js +1 -1
  502. package/widgets/Editor.d.ts +2 -2
  503. package/widgets/ElevationProfile/support/HoveredPoints.js +1 -1
  504. package/widgets/ElevationProfile/types.d.ts +3 -4
  505. package/widgets/Feature/support/arcadeFeatureUtils.js +1 -1
  506. package/widgets/Feature/types.d.ts +1 -5
  507. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  508. package/widgets/FeatureForm/featureFormUtils.js +1 -1
  509. package/widgets/FeatureForm.js +1 -1
  510. package/widgets/FeatureTable/Grid/types.d.ts +0 -2
  511. package/widgets/FeatureTable/support/types.d.ts +8 -8
  512. package/widgets/Features/FeaturesViewModel.d.ts +3 -3
  513. package/widgets/Features/FeaturesViewModel.js +1 -1
  514. package/widgets/LineOfSight/LineOfSightViewModel.d.ts +2 -2
  515. package/widgets/LineOfSight/LineOfSightViewModel.js +1 -1
  516. package/widgets/OrientedImageryViewer/navigation/queries.js +1 -1
  517. package/widgets/Popup/types.d.ts +0 -2
  518. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  519. package/widgets/ShadowCast/ShadowCastVisibleElements.d.ts +2 -0
  520. package/widgets/Sketch/SketchViewModel.js +1 -1
  521. package/widgets/Sketch/support/OperationHandle.js +1 -1
  522. package/widgets/Sketch/types.d.ts +2 -2
  523. package/widgets/Slice/SliceViewModel.d.ts +2 -2
  524. package/widgets/Slice/SliceViewModel.js +1 -1
  525. package/widgets/Spinner/SpinnerViewModel.js +1 -1
  526. package/widgets/TimeSlider.js +1 -1
  527. package/widgets/support/AnalysisViewModelMixin.js +5 -0
  528. package/widgets/support/AnchorElementViewModel.js +1 -1
  529. package/widgets/support/InteractiveToolViewModelMixin.js +5 -0
  530. package/widgets/support/SelectionList/GroupLayerItem.js +1 -1
  531. package/widgets/support/dateUtils.js +1 -1
  532. package/assets/esri/core/workers/chunks/055fdc5134d54174444d.js +0 -316
  533. package/assets/esri/core/workers/chunks/058fb2cd6387acfd458c.js +0 -1
  534. package/assets/esri/core/workers/chunks/08359ae020238a565955.js +0 -1
  535. package/assets/esri/core/workers/chunks/0ae018098906d6a88904.js +0 -1
  536. package/assets/esri/core/workers/chunks/0cd3acfbf9ee991bdab4.js +0 -1
  537. package/assets/esri/core/workers/chunks/0e5cd0cf6ab7cb37d723.js +0 -1
  538. package/assets/esri/core/workers/chunks/0ee407b8db5c07a00d82.js +0 -1
  539. package/assets/esri/core/workers/chunks/10373885604655f673df.js +0 -1
  540. package/assets/esri/core/workers/chunks/119822a646834c1cebc0.js +0 -1
  541. package/assets/esri/core/workers/chunks/13d61d34e55c80e4ecdf.js +0 -1
  542. package/assets/esri/core/workers/chunks/17dea03fc4eb414f0022.js +0 -1
  543. package/assets/esri/core/workers/chunks/1967239713b58dccfd81.js +0 -1
  544. package/assets/esri/core/workers/chunks/1c350a2c4014146dbcd9.js +0 -1
  545. package/assets/esri/core/workers/chunks/2266a8f2c2ec37c19bb4.js +0 -1
  546. package/assets/esri/core/workers/chunks/226acd251ad7d7ee3b57.js +0 -1
  547. package/assets/esri/core/workers/chunks/22b07c54a5fcc27771b0.js +0 -1
  548. package/assets/esri/core/workers/chunks/22ca80f491e070b2a5e7.js +0 -1
  549. package/assets/esri/core/workers/chunks/2402d305a77fef4694a0.js +0 -1
  550. package/assets/esri/core/workers/chunks/27f096c434f049b8df01.js +0 -1
  551. package/assets/esri/core/workers/chunks/3371935a4fd6346d3a17.js +0 -1
  552. package/assets/esri/core/workers/chunks/3c3d311b88f5400951ef.js +0 -1
  553. package/assets/esri/core/workers/chunks/3c4f8597f602779174f1.js +0 -1
  554. package/assets/esri/core/workers/chunks/3da53c017f9c5d2d778a.js +0 -1
  555. package/assets/esri/core/workers/chunks/4773a358832f87963766.js +0 -1
  556. package/assets/esri/core/workers/chunks/492515860198f38dd698.js +0 -1
  557. package/assets/esri/core/workers/chunks/4f33a2ecb154a2c2449c.js +0 -1
  558. package/assets/esri/core/workers/chunks/4f6f181ee83b4d484518.js +0 -1
  559. package/assets/esri/core/workers/chunks/52726458f590e726d52c.js +0 -1
  560. package/assets/esri/core/workers/chunks/536c492fdda30f2f1288.js +0 -1
  561. package/assets/esri/core/workers/chunks/600e2e6b51e2fb9c598c.js +0 -1
  562. package/assets/esri/core/workers/chunks/62b28f73f814413c10fc.js +0 -1
  563. package/assets/esri/core/workers/chunks/63b8cd7d5cafbaeed894.js +0 -1
  564. package/assets/esri/core/workers/chunks/6925f09d44cc38480d53.js +0 -1
  565. package/assets/esri/core/workers/chunks/7f4fa2f2e85863d3cfb9.js +0 -1
  566. package/assets/esri/core/workers/chunks/8f4c480c418eba299c2b.js +0 -1
  567. package/assets/esri/core/workers/chunks/990341f7c47bd656c782.js +0 -1
  568. package/assets/esri/core/workers/chunks/a3836f6a93924ee4816e.js +0 -1
  569. package/assets/esri/core/workers/chunks/ab520fd1ae917daf07d8.js +0 -1
  570. package/assets/esri/core/workers/chunks/acc7ff44bfcb5c195114.js +0 -1
  571. package/assets/esri/core/workers/chunks/b25a131c04092c3ab75d.js +0 -1
  572. package/assets/esri/core/workers/chunks/b7960ab9a9da7f88184c.js +0 -1
  573. package/assets/esri/core/workers/chunks/b9909264cfea68d5f2a1.js +0 -1
  574. package/assets/esri/core/workers/chunks/ba7f57788847cc0f68df.js +0 -1
  575. package/assets/esri/core/workers/chunks/bb08359610a41e304b55.js +0 -1
  576. package/assets/esri/core/workers/chunks/bf06250be7a7a36306b1.js +0 -1
  577. package/assets/esri/core/workers/chunks/bfbbcaa1fb04f17fc869.js +0 -1
  578. package/assets/esri/core/workers/chunks/d30cfc5fa302cc08d862.js +0 -1
  579. package/assets/esri/core/workers/chunks/d75adfd4acb3c92accc9.js +0 -1
  580. package/assets/esri/core/workers/chunks/da99fd0d3106dd357743.js +0 -1
  581. package/assets/esri/core/workers/chunks/de71db3b0fb947b13c97.js +0 -1
  582. package/assets/esri/core/workers/chunks/dfbbead4c24d13682891.js +0 -1
  583. package/assets/esri/core/workers/chunks/e4ba850e8344ac2c5fc0.js +0 -1
  584. package/assets/esri/core/workers/chunks/f7d93aae350796b88562.js +0 -1
  585. package/assets/esri/core/workers/chunks/f9370830051865a3435b.js +0 -1
  586. package/layers/mixins/TemporalSceneLayer.d.ts +0 -177
  587. package/layers/mixins/TemporalSceneLayer.js +0 -5
  588. package/layers/mixins/properties/ILayerWithSave.d.ts +0 -11
  589. package/layers/support/ContingencyConstraintViolation.d.ts +0 -2
  590. package/layers/support/ContingentValue.d.ts +0 -2
  591. package/layers/support/ContingentValuesResult.d.ts +0 -2
  592. package/layers/support/ElevationQuery.d.ts +0 -35
  593. package/layers/support/ElevationQueryContext.d.ts +0 -37
  594. package/layers/support/FeatureReduction.d.ts +0 -3
  595. package/layers/support/FeatureReduction.js +0 -5
  596. package/layers/support/FieldGroup.d.ts +0 -2
  597. package/layers/support/FieldValueType.d.ts +0 -2
  598. package/layers/support/I3SLayer.d.ts +0 -9
  599. package/layers/support/ParquetGeometryEncodingBase.d.ts +0 -9
  600. package/layers/support/ParquetGeometryEncodingBase.js +0 -5
  601. package/layers/support/SimpleBandStatistics.d.ts +0 -10
  602. package/layers/support/source/DataLayerSource.d.ts +0 -171
  603. package/layers/support/source/DataLayerSource.js +0 -5
  604. package/layers/support/source/MapLayerSource.js +0 -5
  605. package/layers/support/source/QueryTableDataSource.js +0 -5
  606. package/layers/support/source/RasterDataSource.js +0 -5
  607. package/layers/support/source/TableDataSource.js +0 -5
  608. package/layers/support/source/types.d.ts +0 -4
  609. package/views/2d/layers/features/FeaturePipelineWorkerProxy.d.ts +0 -32
  610. package/views/3d/webgl-engine/shaders/GaussianSplatColorTechnique.js +0 -5
  611. package/views/3d/webgl-engine/shaders/GaussianSplatCompositionTechniqueConfiguration.js +0 -5
  612. package/views/3d/webgl-engine/shaders/GaussianSplatDepthTechnique.js +0 -5
  613. package/views/analysis/ElevationProfile/ElevationProfileHoveredPointVisualization.js +0 -5
  614. package/widgets/support/AnalysisViewModel.d.ts +0 -5
  615. package/widgets/support/AnalysisViewModel.js +0 -5
  616. package/widgets/support/AnchorElementViewModel.d.ts +0 -3
  617. package/widgets/support/InteractiveToolViewModel.d.ts +0 -4
  618. package/widgets/support/InteractiveToolViewModel.js +0 -5
  619. /package/webdoc/support/{thumbnailUtils.d.ts → types.d.ts} +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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{isSome as i}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import r from"../../../../core/Error.js";import s from"../../../../core/Logger.js";import{findInMap as a}from"../../../../core/MapUtils.js";import{abortMaybe as n,removeMaybe as o,destroyMaybe as l}from"../../../../core/maybe.js";import{MinPriority as h}from"../../../../core/MemCache.js";import d from"../../../../core/PooledArray.js";import{throwIfAborted as p,ignoreAbortErrors as c,createResolver as y,isAbortError as u}from"../../../../core/promiseUtils.js";import g from"../../../../core/Queue.js";import{when as m,watch as b,on as _,syncAndInitial as f,whenOnce as v}from"../../../../core/reactiveUtils.js";import{schedule as C}from"../../../../core/scheduling.js";import{property as S,subclass as G}from"../../../../core/accessorSupport/decorators.js";import{diff as w,isEmpty as x}from"../../../../core/accessorSupport/diffUtils.js";import{h as P,i as R,j as U}from"../../../../chunks/vec32.js";import{create as D}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import I from"../../../../geometry/Extent.js";import E from"../../../../geometry/Point.js";import{canProjectWithoutEngine as L}from"../../../../geometry/projectionUtils.js";import{projectBuffer as j}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as V}from"../../../../geometry/projection/projectVectorToVector.js";import{projectXYZToVector as A}from"../../../../geometry/projection/projectXYZToVector.js";import{center as O,create as F,fromRect as T,equals as M}from"../../../../geometry/support/aaBoundingBox.js";import{create as k}from"../../../../geometry/support/aaBoundingRect.js";import{equals as z}from"../../../../geometry/support/spatialReferenceUtils.js";import{isPopupProvider as W}from"../../../../graphic/getPopupProvider.js";import H from"../../../../layers/Layer.js";import{getObjectId as B,computeAABB as q,hasGeometry as Q}from"../../../../layers/graphics/dehydratedFeatures.js";import{hydrateGraphic as N}from"../../../../layers/graphics/hydratedFeatures.js";import $ from"../../../../renderers/UniqueValueRenderer.js";import{isSupportedRenderer3D as Z,validateTo3D as Y}from"../../../../renderers/support/rendererConversion.js";import{RenderingInfo as X}from"../../../../renderers/support/RenderingInfo.js";import{isBasemapLayerView as J}from"../../../../support/basemapUtils.js";import{loadArcade as K}from"../../../../support/loadArcade.js";import ee from"../../../../symbols/LabelSymbol3D.js";import te from"../../../../symbols/TextSymbol.js";import ie from"../../../../symbols/WebStyleSymbol.js";import{getDefaultSymbol3D as re}from"../../../../symbols/support/defaults3D.js";import{to3D as se}from"../../../../symbols/support/symbolConversion.js";import{averageSymbolComplexities as ae,defaultSymbolComplexity as ne}from"./defaultSymbolComplexity.js";import{DisplayFeatureLimit as oe}from"./DisplayFeatureLimit.js";import{ViewElevationProvider as le}from"./ElevationQuery.js";import{extractExpressionInfo as he,createContext as de}from"./featureExpressionInfoUtils.js";import{Graphics3DFeatureStore as pe}from"./Graphics3DFeatureStore.js";import{Graphics3DGraphicCreationContext as ce}from"./Graphics3DGraphicCreationContext.js";import{Graphics3DSymbolCreationContext as ye}from"./Graphics3DSymbolCreationContext.js";import{make as ue}from"./Graphics3DSymbolFactory.js";import{Graphics3DWebStyleSymbol as ge}from"./Graphics3DWebStyleSymbol.js";import{GraphicsCorePerformanceInfo as me}from"./GraphicsCorePerformanceInfo.js";import{GraphicStateTracking as be}from"./GraphicStateTracking.js";import{computeCentroid as _e}from"./graphicUtils.js";import{placePointOnGeometry as fe}from"./pointUtils.js";import{SpatialIndex2D as ve}from"./SpatialIndex2D.js";import{StageLayerElevationProvider as Ce}from"../support/StageLayerElevationProvider.js";import{toBoundingRect as Se}from"../../support/extentUtils.js";import{GridLocalOriginFactory as Ge}from"../../webgl-engine/lib/GridLocalOriginFactory.js";import{isScreenSizePerspectiveEnabled as we}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{affectsGeometry as xe}from"../../webgl-engine/lib/VertexAttribute.js";import{WebGLLayer as Pe}from"../../webgl-engine/lib/WebGLLayer.js";import{HUDMaterial as Re}from"../../webgl-engine/materials/HUDMaterial.js";import{hasPopupTemplate as Ue}from"../../../layers/support/popupUtils.js";import{PromiseQueue as De}from"../../../support/PromiseQueue.js";import{PropertiesPool as Ie}from"../../../support/PropertiesPool.js";import{ImmediateTask as Ee,noBudget as Le,TaskPriority as je}from"../../../support/Scheduler.js";import{TextureCompressionTracker as Ve}from"../../../support/TextureCompressionTracker.js";import{Yield as Ae}from"../../../support/Yield.js";import{alphaCutoff as Oe}from"../../../../webscene/support/AlphaCutoff.js";var Fe;const Te=D(),Me=F();let ke=class extends t{static{Fe=this}static{this.tmpVec=D()}get _viewSpatialReference(){return this.owner.view.spatialReference}get spatialIndex(){return this._spatialIndex||(this._spatialIndex=new ve({objectIdField:this.owner.layer?.objectIdField,spatialReference:this._viewSpatialReference,hasZ:!!this.hasZ,hasM:!!this.hasM}),this._spatialIndex.setup(Array.from(this.graphics3DGraphics.values()))),this._spatialIndex.update(),this._spatialIndex}get deconflictor(){return this._deconflictor}get labeler(){return this._labeler}get numberOfGraphics(){return this._numberOfGraphics}get effectiveUpdatePolicy(){return null!=this.currentRenderer&&"dictionary"===this.currentRenderer.type?0:this._forcedUpdatePolicy??this.preferredUpdatePolicy}get featureStore(){return this._featureStore}get initializePromise(){return this._initializePromise}get scaleVisibility(){return this._scaleVisibility}get elevationAlignment(){return this._elevationAlignment}get objectStates(){return this._objectStates}get filterVisibility(){return this._filterVisibility}get updating(){return!!(this.dataUpdating||this._elevationAlignment?.updating||this._scaleVisibility?.updating||this._filterVisibility?.updating||this._rendererChangeAbortController||this._elevationInfoChangeAbortController||this._frameTaskHandle.updating||this._updateQueue.updating||this.readyToRun)}get dataUpdating(){return!!(this._graphicsWaitingForSymbol.size>0||this._pendingUpdates.size>0||this._spatialIndex?.updating||this._updatingPendingLoadedGraphicsChange||this._dataUpdateQueue.updating||this._loadingSymbols>0||this.compressionTracker.compressing)}get readyToRun(){return this._pendingUpdates.size>0||!!this._spatialIndex?.updating||this._dataUpdateQueue.readyToRun||this._updateQueue.readyToRun||this._focusAreasGraphicsQueue.length>0}get suspendedOrOutsideOfView(){return this.owner.suspended||!!this.owner.suspendInfo?.outsideOfView}get updatingRemaining(){return this.updating?this._pendingUpdates.size+.1*(this._spatialIndex?.updatingRemaining||0)+.1*(this._elevationAlignment?.updatingRemaining||0):0}get displayFeatureLimit(){const e=this.owner&&this.owner.view&&this.owner.view.qualitySettings,t=e?.graphics3D.minTotalNumberOfFeatures??0,i=e?.graphics3D.maxTotalNumberOfFeatures??0,r=e?.graphics3D.maxNumberOfDrawCalls??0,s=e?.graphics3D.maxTotalNumberOfVertices??0,a=this.averageSymbolComplexity,n=Math.max(1,a?.verticesPerFeature??1),o=a&&a.drawCallsPerFeature>0&&r>0?r/a.drawCallsPerFeature:i,l=Math.ceil(s/n),h=Math.max(t,Math.min(i,l,o)),d=this._get("displayFeatureLimit");return d&&d.maximumTotalNumberOfVertices===s&&d.averageSymbolComplexity===a&&d.maximumNumberOfFeatures===h?d:new oe(s,h,a)}get averageSymbolComplexity(){const e=ae(this._symbolComplexities),t=this._get("averageSymbolComplexity");return 0===e.numComplexities||null!=t&&(e.estimated&&(t.verticesPerFeature>=e.verticesPerFeature||t.verticesPerCoordinate>=e.verticesPerCoordinate||t.drawCallsPerFeature>=e.drawCallsPerFeature)||t.verticesPerFeature===e.verticesPerFeature&&t.verticesPerCoordinate===e.verticesPerCoordinate&&t.drawCallsPerFeature===e.drawCallsPerFeature)?t:e}get usedMemory(){const e=this.labelsEnabled?(this.averageSymbolComplexity?.memory.bytesPerFeatureLabel??0)*this._numberOfGraphics:0,t=this._getSymbolComplexitiesUsed().reduce((e,t)=>e+t.memory.resourceBytes,0);if(null==this._symbolMaterials){this._symbolMaterials=[];for(const e of this._symbols.values())if(null!=e)for(const t of e.symbolLayers)if(t)for(const e of t.materials)e&&this._symbolMaterials.push(e)}const i=this.owner.view.stage.renderer,r=this.owner.view.overlayManager.renderer,s=this._symbolMaterials.reduce((e,t)=>e+((i.getMaterialRenderer(t)||r.getMaterialRenderer(t))?.usedMemory??0),0);return this._usedMemory+e+t+s}get usedMemoryPerGraphic(){if(this._usedMemory&&this._numberOfGraphics){const e=this._numberOfGraphics/(this._numberOfGraphics+Math.max(this._pendingAdds,this._pendingRemoves));return this._usedMemory/this._numberOfGraphics*e}if(null!=this.averageSymbolComplexity){const e=this.labelsEnabled?this.averageSymbolComplexity.memory.bytesPerFeatureLabel:0;return this.averageSymbolComplexity.memory.bytesPerFeature+e}return 0}get unprocessedMemoryEstimate(){return(this._pendingAdds-this._pendingRemoves)*this.usedMemoryPerGraphic}get _symbolComplexities(){return this.currentRenderer?this._getSymbolComplexitiesUsedOrRenderer(this.currentRenderer):this._getSymbolComplexitiesUsed()}get visible(){return this._visible}_getConvertedSymbol(e){const t=e;if("web-style"===t.type)return t.clone();const i=this._symbolConversionCache.get(t.id);if(null!=i)return i;const r=se(t,{geometryType:this.layer?.geometryType??void 0,retainId:!0,hasLabelingContext:this._hasLabelingContext(t),cimFallbackEnabled:!0}),a=r.symbol||null;return null==a&&r.error&&s.getLogger(this).error(r.error.message),this._symbolConversionCache.set(t.id,a),a}_getSymbolComplexitiesUsedOrRenderer(e){if(null==e)return[];const t=e.symbols,i="backgroundFillSymbol"in e?e.backgroundFillSymbol:null;if(!i&&!t.length)return[];const r=[],s=this._getSymbolComplexityUsedOrRenderer(i);null!=s&&r.push(s);for(const a of t){const e=this._getSymbolComplexityUsedOrRenderer(a);null!=e&&r.push(e)}return r}_getSymbolComplexityUsedOrRenderer(e){if(null==e)return null;const t=this._symbols.get(e.id);if(null!=t)return t.complexity;const i=this._getConvertedSymbol(e);return null!=i?ne(i):null}_getSymbolComplexitiesUsed(){const e=[];return this._symbols.forEach(t=>{null!=t&&e.push(t.complexity)}),e}get _objectIdField(){return this.layer.objectIdField}constructor(e){super(e),this._propertiesPool=new Ie({computedExtent:()=>new I},this),this.computedExtent=null,this.currentRenderer=null,this.rendererHasGeometryOperations=!1,this._graphicStateTracking=null,this.graphics3DGraphics=new Map,this.stageLayer=null,this.stage=null,this._graphicsDrapedUids=new Set,this._graphicsBySymbol=new Map,this._symbolConversionCache=new Map,this._symbols=new Map,this._graphicsWithoutSymbol=new Map,this._graphicsWaitingForSymbol=new Map,this._graphicsUpdateId=0,this._frameTaskHandle=Ee,this._dataUpdateQueue=new De,this._updateQueue=new De,this._focusAreasGraphicsQueue=new g,this._suspendSymbolCleanup=!1,this._arcadeOnDemand=null,this._rendererChangeAbortController=null,this._elevationInfoChangeAbortController=null,this._initializeAbortController=null,this._elevationAlignment=null,this._scaleVisibility=null,this._filterVisibility=null,this._spatialIndex=null,this.extentPadding=0,this._updatingPendingLoadedGraphicsChange=null,this._featureStore=null,this._deconflictor=null,this._labeler=null,this._objectStates=null,this._viewElevationProvider=null,this._stageLayerElevationProvider=null,this._whenGraphics3DGraphicRequests={},this._pendingUpdates=new Map,this._numberOfGraphics=0,this._numberOfGraphicsProvidingElevation=0,this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1,this._loadingSymbols=0,this.compressionTracker=new Ve,this._symbolWarningLogged=!1,this._geometryWarningLogged=!1,this._objectIdInvisibleSet=new Set,this._whenSymbolRemoved=new d,this.preferredUpdatePolicy=1,this._forcedUpdatePolicy=null,this.elevationFeatureExpressionEnabled=!0,this.owner=null,this.layer=null,this.graphicSymbolSupported=!0,this.getRenderingInfoWithoutRenderer=!1,this.setUidToIdOnAdd=!0,this.hasZ=null,this.hasM=null,this._usedMemory=0,this._visible=!1,this._startCreateGraphics=!1,this._unusedSymbolsCache=e.owner.view.resourceController.memoryController.newCache("graphics-3d-unused-symbols",e=>e.destroy()),this.symbolCreationContext=new ye(e.owner.view.resourceController.scheduler,(e,t)=>this._updateQueue.push(e,t),e.owner.layerViewUid,this.compressionTracker)}initialize(){this._featureStore=new pe({objectIdField:this.owner.layer?.objectIdField,hasZ:!!this.hasZ,hasM:!!this.hasM,viewSpatialReference:this._viewSpatialReference,featureSpatialReference:this.owner.featureSpatialReference,getSpatialIndex:()=>this.spatialIndex,forEach:e=>this.graphics3DGraphics.forEach(e)});const e=(e,t,i)=>this.spatialIndex.queryGraphicUIDsInExtent(e,t,i),{componentFactories:t}=this;this._elevationAlignment=t.elevationAlignment?.(this,e),this._scaleVisibility=t.scaleVisibility?.(this,e),this._filterVisibility=t.filterVisibility?.({featureStore:this._featureStore,getFeatureCount:()=>this.graphics3DGraphics.size,updateFeatureVisibilities:e=>this.modifyGraphics3DGraphicVisibilities(t=>t.setVisibilityFlag(1,4,e(B(t.graphic,this._objectIdField)))),setAllFeaturesVisibility:e=>this.modifyGraphics3DGraphicVisibilities(t=>t.setVisibilityFlag(1,4,e)),clearFeaturesVisibility:()=>this.modifyGraphics3DGraphicVisibilities(e=>e.setVisibilityFlag(1,4,!0))}),this._deconflictor=t.deconflictor?.(this),this._labeler=t.labeler?.(this,this._scaleVisibility),this._objectStates=t.objectStates?.(this),this._initializeAbortController=new AbortController,this.addHandles(m(()=>this.owner.view.state.highlights,()=>{const{highlightOrderMap:e}=this.owner.view.state;this.graphics3DGraphics.forEach(t=>t.updateHighlights(e))})),this._initializePromise=this._initializeAsync()}async _initializeAsync(){const e=this._initializeAbortController?.signal,t=this.owner.view;this._viewElevationProvider=new le(this._viewSpatialReference,t),this._initializeStage(t,this.owner.layerViewUid);const i=t.sharedSymbolResources;this.symbolCreationContext.sharedResources=i,null!=this.currentRenderer&&(this.symbolCreationContext.renderer=this.currentRenderer),this.symbolCreationContext.stage=this.stage,this.symbolCreationContext.renderCoordsHelper=t.renderCoordsHelper,this.symbolCreationContext.layer=this.layer,this.symbolCreationContext.graphicsCoreOwner=this.owner,this.symbolCreationContext.localOriginFactory=new Ge(t.renderSpatialReference),this.symbolCreationContext.elevationProvider=t.elevationProvider,this.symbolCreationContext.notifyGraphicGeometryChanged=e=>this.notifyGraphicGeometryChanged(e),this.symbolCreationContext.notifyGraphicVisibilityChanged=e=>this.notifyGraphicVisibilityChanged(e);const r=he(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);if(this.symbolCreationContext.featureExpressionInfoContext=await de(r,this._viewSpatialReference,e,s.getLogger(this)),p(e),this.symbolCreationContext.screenSizePerspectiveEnabled=we(this.layer.screenSizePerspectiveEnabled),this.symbolCreationContext.slicePlaneEnabled=!!this.owner.slicePlaneEnabled,this.symbolCreationContext.physicalBasedRenderingEnabled=!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled,this.symbolCreationContext.skipHighSymbolLods=!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods,"drapeSourceType"in this.owner){const{owner:e}=this;this.symbolCreationContext.drapeSourceRenderer=t.overlayManager.registerGeometryDrapeSource(e)}this.addHandles([b(()=>this.suspendedOrOutsideOfView,()=>this._updateQueue.unshift(()=>this._updateLayerVisibility(),null).catch(c)),b(()=>we(this.layer?.screenSizePerspectiveEnabled),e=>{e!==this.symbolCreationContext.screenSizePerspectiveEnabled&&(this.symbolCreationContext.screenSizePerspectiveEnabled=e,this._screenSizePerspectiveEnabledChange())}),b(()=>this.owner.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(!!e)),b(()=>this.owner.view.state?.rasterPixelRatio,()=>this._pixelRatioChange()),b(()=>!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled,e=>this._physicalBasedRenderingChange(e)),b(()=>!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods,e=>this._skipHighSymbolLoDsChange(e)),b(()=>this.owner.view.focusAreasView?.polygons,()=>this._updateFocusedLabels()),b(()=>this.owner.view.map?.focusAreas.style,()=>this.recreateAllGraphicsAndSymbols()),b(()=>!!t.basemapTerrain&&!t.basemapTerrain.opaque&&!t.basemapTerrain.invisible,()=>this.terrainTransparencyChange()),m(()=>t.basemapTerrain?.tilingScheme,e=>{if(e.spatialReference.equals(this.symbolCreationContext.overlaySR)||null==t.basemapTerrain.spatialReference||(this.symbolCreationContext.overlaySR=t.basemapTerrain.spatialReference),this.hasHandles("loaded-graphics"))this.recreateAllGraphics();else{const e=()=>this.owner?.loadedGraphics;this.addHandles([_(e,"change",e=>{this._graphicsCollectionChanged(e),this._signalUpdatingDuringAsyncLoadedGraphicsChange()},{onListenerAdd:()=>{this.recreateAllGraphics(),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}})],"loaded-graphics")}},{initial:!0}),b(()=>this.effectiveUpdatePolicy,e=>{null!=this.stageLayer&&(this.stageLayer.updatePolicy=e),this.symbolCreationContext.isAsync=0===this.effectiveUpdatePolicy,1===e&&this.runTask(Le)},f)]),this._frameTaskHandle=t.resourceController.scheduler.registerTask(je.GRAPHICS_CORE,this),this.layer&&"featureReduction"in this.layer&&this.addHandles(b(()=>this.layer.featureReduction,()=>this._deconflictor?.featureReductionChange())),this.notifyChange("averageSymbolComplexity"),this.rendererChange(this.owner.renderer).catch(()=>{}),this._initializeAbortController=null}_abortInitialize(){this._initializeAbortController=n(this._initializeAbortController)}_updateFocusedLabels(){this._focusAreasGraphicsQueue.clear(),this.forEachGraphics3DSymbol((e,t)=>{t&&e.needsUpdateFocus&&t.forEach(e=>{this._focusAreasGraphicsQueue.push(e)})})}destroy(){if(this._unusedSymbolsCache.destroy(),this._abortInitialize(),this._rendererChangeAbortController=n(this._rendererChangeAbortController),this._abortElevationInfoChange(),this._frameTaskHandle.remove(),this._frameTaskHandle=Ee,this._dataUpdateQueue.cancelAll(),this._updateQueue.cancelAll(),this._deconflictor=o(this._deconflictor),this._labeler=o(this._labeler),this._elevationAlignment=l(this._elevationAlignment),this._scaleVisibility=l(this._scaleVisibility),this._filterVisibility=l(this._filterVisibility),this._objectStates=l(this._objectStates),this.clear(),"drapeSourceType"in this.owner){const{owner:e}=this;this.stage.view.overlayManager.unregisterDrapeSource(e)}this._featureStore=l(this._featureStore),this._updatingPendingLoadedGraphicsChange=o(this._updatingPendingLoadedGraphicsChange),this._graphicStateTracking=l(this._graphicStateTracking),this.stage&&(this.stageLayer=l(this.stageLayer),this.stage=null),this._set("owner",null);for(const e in this._whenGraphics3DGraphicRequests)this._whenGraphics3DGraphicRequests[e].reject(new r("graphic:layer-destroyed","Layer has been destroyed"));this._whenGraphics3DGraphicRequests=null,this._propertiesPool=l(this._propertiesPool),this._whenSymbolRemoved.prune(),this._symbolConversionCache.clear(),this._objectIdInvisibleSet.clear(),this._spatialIndex=l(this._spatialIndex),this._symbolMaterials=null}clear(){this._objectStates?.allGraphicsDeleted(),null!=this._graphicStateTracking&&this._graphicStateTracking.allGraphicsDeleted(),this.graphics3DGraphics.forEach(e=>e.destroy()),this._spatialIndex?.clear(),this.graphics3DGraphics.clear(),this._numberOfGraphics=0,this._usedMemory=0,this._updateLayerVisibility(),this._symbols.forEach(l),this._symbols.clear(),this._symbolMaterials&&(this._symbolMaterials.length=0,this._symbolMaterials=null),this._graphicsBySymbol.clear(),this._graphicsWithoutSymbol.clear(),this._graphicsWaitingForSymbol.clear(),this._pendingUpdates.clear(),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1,this.notifyChange("dataUpdating"),this.notifyChange("readyToRun"),this.notifyChange("updatingRemaining"),this._featureStore.events.emit("changed"),this.owner.notifyContentGeometryUpdate?.()}_initializeStage(e,t){this.stage=e.stage,this.stageLayer=new Pe(this.stage,{visible:!this.suspendedOrOutsideOfView,updatePolicy:this.effectiveUpdatePolicy},t);const i=this.stageLayer.events;i.on("transformationChanged",e=>this.notifyGraphicGeometryChanged(e.graphicUid)),i.on("shaderTransformationChanged",e=>this.notifyGraphicGeometryChanged(e.graphicUid)),i.on("visibilityChanged",e=>this.notifyGraphicVisibilityChanged(e.graphicUid)),i.on("geometryAdded",e=>this.notifyGraphicGeometryChanged(e.object.graphicUid)),i.on("geometryRemoved",e=>this.notifyGraphicGeometryChanged(e.object.graphicUid)),i.on("attributesChanged",e=>xe(e.attribute)&&this.notifyGraphicGeometryChanged(e.object.graphicUid))}notifyGraphicGeometryChanged(e){if(this.owner.notifyContentGeometryUpdate?.(),null==this._graphicStateTracking||null==e)return;const t=this.graphics3DGraphics.get(e);t&&this._graphicStateTracking.updateGraphicGeometry(t)}notifyGraphicVisibilityChanged(e){if(this.owner.notifyContentGeometryUpdate?.(),null==this._graphicStateTracking||null==e)return;const t=this.graphics3DGraphics.get(e);t&&this._graphicStateTracking.updateGraphicVisibility(t)}_updateLayerVisibility(){const e=this.displayFeatureLimit.maximumNumberOfFeatures,t=this._numberOfGraphics>e*We,i=!this.suspendedOrOutsideOfView&&!t;i!==this._visible&&(this._visible=i,this._updateStageLayerVisibility())}_updateStageLayerVisibility(){const e=this._visible&&(null==this.layer.opacity||this.layer.opacity>=Oe);this.stageLayer.visible!==e&&(this.stageLayer.visible=e,e?this.updateGraphicsVisibilities():this._hideAllGraphics(),this.owner.notifyContentGeometryUpdate?.())}getGraphics3DGraphicById(e){return null!=e?this.graphics3DGraphics.get(e):void 0}getGraphics3DGraphicByObjectId(e){return this.owner.layer?.objectIdField?this._findGraphics3DGraphicByObjectId(e):null}_getGraphicObjectID(e,t=this.owner.layer?.objectIdField){return B(e,t)}get graphics3DGraphicsByObjectID(){const e=this.owner.layer?.objectIdField;if(!e)return;const t=new Map;return this.graphics3DGraphics.forEach(i=>{if(!i)return;const r=i.graphic,s=this._getGraphicObjectID(r,e);null!=s&&t.set(s,i)}),t}get labelsEnabled(){return!!this._labeler?.layerLabelsEnabled()}async updateLabelingInfo(e){const t=this._deconflictor?.labelingInfoChange(e),i=this._labeler?.labelingInfoChange(e);await Promise.allSettled([t,i])}updateVisibilityInfo(){this._deconflictor?.labelingInfoChange(),this._labeler?.visibilityInfoChange()}get symbolUpdateType(){if(this._pendingUpdates.size>0)return"unknown";let e=!1,t=!1;for(const[i,r]of this._symbols)if(null!=r){switch(r.getFastUpdateStatus()){case 3:return"unknown";case 1:this._graphicsBySymbol.has(i)&&(t=!0);break;case 0:this._graphicsBySymbol.has(i)&&(e=!0);break;case 2:this._graphicsBySymbol.has(i)&&(t=e=!0)}}return t?e?"mixed":"fast":e?"slow":"mixed"}runTask(e){if(this._dataUpdateQueue.runTask(e),this._updateQueue.runTask(e),this._applyPendingUpdates(e),this._applyFocusAreasUpdates(e),this.notifyChange("readyToRun"),this.readyToRun||this.notifyChange("dataUpdating"),this.notifyChange("updatingRemaining"),!e.hasProgressed)return Ae}setObjectIdVisibility(e,t){t?this._objectIdInvisibleSet.delete(e):this._objectIdInvisibleSet.add(e);const i=this._findGraphics3DGraphicByObjectId(e);null!=i&&this._updateUserVisibility(i)}_findGraphics3DGraphicByObjectId(e){return a(this.graphics3DGraphics,t=>this._getGraphicObjectID(t.graphic)===e)}_updateUserVisibility(e){if(null==e)return!1;const t=e.graphic,i=this._getGraphicObjectID(t),r=t.visible&&!this.owner.suspended&&this.stageLayer.visible&&(null==i||!this._objectIdInvisibleSet.has(i));return e.setVisibilityFlag(1,1,r)}_whenGraphics3DGraphic(e){const t=this.graphics3DGraphics.get(e.uid);if(t)return Promise.resolve(t);const i=this._whenGraphics3DGraphicRequests[e.uid];if(i)return i.promise;const r=y();return this._whenGraphics3DGraphicRequests[e.uid]=r,r.promise}async _boundsForGraphics3DGraphic(e,t){const i=this._viewSpatialReference,r=this.owner.view.renderSpatialReference,s=this.owner.view.basemapTerrain.spatialReference,a=(e,t,s)=>j(e,r,t,e,i,t,s),n=(e,t,r)=>j(e,s,t,e,i,t,r),o=this._viewElevationProvider?{service:this._viewElevationProvider,useViewElevation:null!=t&&!!t.useViewElevation,minDemResolution:null!=t?t.minDemResolution:null,minDemResolutionForPoints:this.owner.view.resolution}:null,l=await e.getProjectedBoundingBox(a,n,o,t?.signal);if(!l)return null;const h=l.boundingBox;if(l.requiresDrapedElevation){const e=this.symbolCreationContext.elevationProvider;if(e){O(h,Te);const t=e.getElevation(Te[0],Te[1],0,i,"ground")??0;h[2]=Math.min(h[2],t),h[5]=Math.max(h[5],t)}}return{boundingBox:h,screenSpaceObjects:l.screenSpaceObjects}}async whenGraphicBounds(e,t){await v(()=>this.owner?.loadedGraphics);const i=this.owner.layer?.objectIdField,s=this.owner.loadedGraphics.find(t=>t===e||null!=i&&null!=t.attributes&&e.attributes&&t.attributes[i]===e.attributes[i]);if(!s)throw new r("internal:graphic-not-part-of-view","Graphic is not part of this view");const a=await this._whenGraphics3DGraphic(s);return this._boundsForGraphics3DGraphic(a,t)}computeAttachmentOrigin(e,t){const i=this.graphics3DGraphics.get(e.uid);if(!i)return null;const r=i.computeAttachmentOrigin();if(0===r.render.num&&0===r.draped.num)return null;P(He,0,0,0);let s=0;if(r.render.num>0){if(!V(r.render.origin,this.symbolCreationContext.renderCoordsHelper.spatialReference,Be,t))return null;R(He,He,Be),s++}if(r.draped.num>0){const[e,i]=r.draped.origin,a=this._viewElevationProvider.getElevation(e,i,"ground")??0;if(P(Be,e,i,a),!V(Be,this._viewElevationProvider.spatialReference,Be,t))return null;R(He,He,Be),s++}return s>1&&U(He,He,1/s),new E({x:He[0],y:He[1],z:He[2],spatialReference:t})}getSymbolLayerSize(e,t){const i=this._symbols.get(e.id);if(null==i)throw new r("internal:symbol-not-part-of-view","Symbol is not part of this view");const s=e.symbolLayers.indexOf(t);if(-1===s)throw new r("internal:missing-symbol-layer","Symbol layer is not in symbol");const a=i.getSymbolLayerSize(s);if(null==a)throw new r("internal:missing-size","Symbol layer has no valid size");return a}_graphicsCollectionChanged(e){this._startCreateGraphics&&(this.add(e.added),this.remove(e.removed))}graphicUpdateHandler(e){const t=e.graphic.uid,i=this.graphics3DGraphics.get(t);if(null!=i||null!=this._graphicsWithoutSymbol.get(t)){switch(e.property){case"visible":this._graphicUpdateVisibleHandler(i);break;case"geometry":this._graphicUpdateGeometryHandler(i,e.graphic);break;case"symbol":this._graphicUpdateSymbolHandler(i,e);break;case"attributes":{const t=this.symbolCreationContext.featureExpressionInfoContext;t?.arcade&&this._graphicUpdateGeometryHandler(i,e.graphic)}break;case"popupTemplate":break;case"origin-transform":this._graphicUpdateTransformHandler(i,e)}this.owner.notifyContentGeometryUpdate?.()}}_graphicUpdateGeometryHandler(e,t){this._graphicUpdateGeometryOrTransformHandler(e,t,()=>!(null==e||!e.graphics3DSymbol.updateGeometry(e)||!(this._labeler?.updateGraphicGeometry(e)??1))&&(this._labeler?.setDirty(),this._deconflictor?.setDirty(),!0));const i=t.geometry;null!=i&&this._expandComputedExtent(i)}_graphicUpdateTransformHandler(e,t){const i=t.graphic.geometry;this._graphicUpdateGeometryOrTransformHandler(e,t.graphic,()=>null!=t.newValue&&null!=e&&null!=i&&e.graphics3DSymbol.updateTransform(e,i.spatialReference,t.newValue,t.action))}_graphicUpdateGeometryOrTransformHandler(e,t,i){if(null!=t.geometry){if(null==e){const e=t.symbol?.id;if(e){const t=this._symbols.get(e);if(null!=t&&0===t.loadStatus)return}return void this._recreateGraphic(t)}i()||this._recreateGraphic(e.graphic)}else this._recreateGraphic(t)}_graphicUpdateSymbolHandler(e,t){const i=t.graphic,r=null!=e?e.graphics3DSymbol:null!=t.oldValue?this._symbols.get(t.oldValue.id):null;if(null==r||null==t.newValue)return void this._recreateGraphic(i);const s=r.symbol,a=this._getConvertedSymbol(t.newValue);if(null!=a&&(a.type!==s.type||"web-style"===a.type)||"web-style"===s.type)return void this._recreateGraphic(i);const n=this._graphicsBySymbol.get(s.id);if(n&&1!==n.size)return void this._recreateGraphic(i);const o=w(s,a);if(null==o)return void this._updateSymbolMapping(s.id,a);const l={diff:o,graphics3DGraphicPatches:[],symbolStatePatches:[]};if(r.prepareSymbolPatch(l),!x(l.diff))return void this._recreateGraphic(i);const h=this._getRenderingInfo(i,!1);if(null==h)return void this._recreateGraphic(i);const d=r.extentPadding;for(const p of l.symbolStatePatches)p();if(d!==r.extentPadding&&this._recomputeExtentPadding(),null!=e)for(const p of l.graphics3DGraphicPatches)p(e,h);this._updateSymbolMapping(s.id,a)}_graphicUpdateVisibleHandler(e){this._updateUserVisibility(e)&&(this._labeler?.setDirty(),this._deconflictor?.setDirty())}recreateGraphics(e){this._suspendSymbolCleanup=!0,this.remove(e),this.add(e),this._suspendSymbolCleanup=!1,1===this.effectiveUpdatePolicy&&this._cleanupSymbols()}_recreateGraphic(e){this.recreateGraphics([e])}_beginGraphicUpdate(e){const t=this._graphicsUpdateId;return this._graphicsUpdateId++,this._graphicsWaitingForSymbol.set(e.uid,t),1===this._graphicsWaitingForSymbol.size&&this.notifyChange("dataUpdating"),t}_endGraphicUpdate(e,t){e&&(t&&this._graphicStateTracking?.updateGraphicError(e,t),this._graphicsWaitingForSymbol.delete(e.uid),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("dataUpdating")))}_recomputeExtentPadding(){let e=0;this._symbols.forEach(t=>{null!=t&&(e=Math.max(e,t.extentPadding))}),this._set("extentPadding",e)}_expandComputedExtent(e){const t=Me,i=e.spatialReference;q(e,t);const r=this._viewSpatialReference,s=Fe.tmpVec;if(z(i,r)||A(t[0],t[1],0,i,s,r)&&(t[0]=s[0],t[1]=s[1],A(t[3],t[4],0,i,s,r),t[3]=s[0],t[4]=s[1]),!(isFinite(t[0])&&isFinite(t[3])&&isFinite(t[1])&&isFinite(t[4])))return;const a=this.computedExtent;let n=null;const o=isFinite(t[2])&&isFinite(t[5]),l=o&&(null==a?.zmin||t[2]<a.zmin),h=o&&(null==a?.zmax||t[5]>a.zmax);if(a){(t[0]<a.xmin||t[1]<a.ymin||t[3]>a.xmax||t[4]>a.ymax||l||h)&&(n=this._propertiesPool.get("computedExtent"),n.xmin=Math.min(t[0],a.xmin),n.ymin=Math.min(t[1],a.ymin),n.xmax=Math.max(t[3],a.xmax),n.ymax=Math.max(t[4],a.ymax),n.spatialReference=r)}else n=this._propertiesPool.get("computedExtent"),n.xmin=t[0],n.ymin=t[1],n.xmax=t[3],n.ymax=t[4],n.spatialReference=r;n&&(l&&(n.zmin=t[2]),h&&(n.zmax=t[5]),this._set("computedExtent",n))}_abortElevationInfoChange(){this._elevationInfoChangeAbortController&&(this._elevationInfoChangeAbortController.abort(),this._elevationInfoChangeAbortController=null)}async elevationInfoChange(){this._abortElevationInfoChange();const e=new AbortController;this._elevationInfoChangeAbortController=e;const t=he(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);this.symbolCreationContext.featureExpressionInfoContext=await de(t,this._viewSpatialReference,e.signal,s.getLogger(this)),p(e.signal),this._elevationInfoChangeAbortController=null,this._labeler?.elevationInfoChange(),this.forEachGraphics3DSymbol((e,t,i)=>{e.globalPropertyChanged("elevationInfo",t)?t?.forEach(e=>{const t=e.graphic,i=e.labelLayers;for(const r of i){r.graphics3DSymbolLayer.graphics3DGraphicLayerElevationInfoChanged(t,r)}}):this._recreateSymbol(i)}),this.updateStageLayerElevationProvider(),this._elevationAlignment?.elevationInfoChange()}updateStageLayerElevationProvider(){this._stageLayerElevationProvider?"relative-to-scene"!==this.layer.elevationInfo?.mode&&0!==this._numberOfGraphicsProvidingElevation||(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),this._stageLayerElevationProvider=l(this._stageLayerElevationProvider)):(!this.layer.elevationInfo||this.layer.elevationInfo&&"relative-to-scene"!==this.layer.elevationInfo.mode)&&this._numberOfGraphicsProvidingElevation>0&&(this._stageLayerElevationProvider=new Ce({layer:this.layer,stageLayer:this.stageLayer,view:this.owner.view}),this.owner.view.elevationProvider.register(2,this._stageLayerElevationProvider))}_clearSymbolsAndGraphics(){this.clear(),null!=this._filterVisibility&&this._filterVisibility.clear(),this._labeler?.reset(),this._deconflictor?.clear(),this._elevationAlignment?.clear(),this.stageLayer?.invalidateSpatialQueryAccelerator(),this._stageLayerElevationProvider&&(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),this._stageLayerElevationProvider=l(this._stageLayerElevationProvider))}startCreateGraphics(){this._startCreateGraphics=!0,this.recreateAllGraphics()}recreateAllGraphics(){this._recreateAllGraphics(!1)}recreateAllGraphicsAndSymbols(){this._recreateAllGraphics(!0)}_recreateAllGraphics(e=!1){if(!this._startCreateGraphics)return;const{loadedGraphics:t,view:i}=this.owner,r=i.basemapTerrain?.tilingScheme&&t?.length?t.toArray():null;!e&&r||this._clearSymbolsAndGraphics(),this.symbolCreationContext.screenSizePerspectiveEnabled=we(this.layer.screenSizePerspectiveEnabled),this.symbolCreationContext.slicePlaneEnabled=!!this.owner.slicePlaneEnabled,this._set("computedExtent",null),r&&(e?this.add(r):this.recreateGraphics(r))}_recreateSymbol(e){const t=this._graphicsBySymbol.get(e),i=[];t&&(t.forEach((e,t)=>{const r=e.usedMemory;this._conditionalRemove(e,t),this._spatialIndex?.remove(e),i.push(e.graphic),e.destroy(),this._removeGraphics3DGraphic(t,r),this._updateLayerVisibility(),this._featureStore.events.emit("changed"),this.owner.notifyContentGeometryUpdate?.()}),this._graphicsBySymbol.set(e,new Map));const r=this._symbols.get(e);l(r),this._symbols.delete(e),this._symbolMaterials=null,l(this._unusedSymbolsCache.pop(e)),this.add(i)}_recreateGraphicsForSymbol(e){const t=this._graphicsBySymbol.get(e);if(t){const e=[];t.forEach(t=>e.push(t.graphic)),this.recreateGraphics(e)}}_conditionalRemove(e,t){this._graphicsDrapedUids.delete(t),this._objectStates?.removeGraphic(e),this._labeler?.removeGraphic(e),this._deconflictor?.removeGraphic(e),null!=this._graphicStateTracking&&this._graphicStateTracking.removeGraphic(e)}add(e){e&&0!==e.length&&(this.owner.view.basemapTerrain?.tilingScheme?(0===this._updatePolicyForGraphics(e)?this._addDelayed(e):this._addImmediate(e),this.notifyChange("dataUpdating")):s.getLogger(this).error("#add()","Cannot add graphics before terrain surface has been initialized"))}_updatePolicyForGraphics(e){if(1===this.effectiveUpdatePolicy&&("mesh"===this.layer.geometryType||null==this.layer.geometryType))for(const t of e)if(null!=t.geometry&&"mesh"===t.geometry.type&&!t.geometry.loaded)return 0;return this.effectiveUpdatePolicy}_addImmediate(e){this._geometryWarningLogged=!1,this._symbolWarningLogged=!1;for(const t of e)this._addGraphic(t,this._getRenderingInfo(t),1);this._cleanupSymbols(),this._labeler?.setDirty(),this._deconflictor?.setDirty()}_addDelayed(e){for(const t of e){const e=t.uid;let i=this._pendingUpdates.get(e);i?i.add?0!==i.state&&i.abortController?.abort():this._pendingAdds++:(i=new ze,this._pendingAdds++,this._pendingUpdates.set(e,i)),i.add=t}this.notifyChange("readyToRun"),this.notifyChange("updatingRemaining"),this.notifyChange("dataUpdating")}remove(e){0===this.effectiveUpdatePolicy?this._removeDelayed(e):this._removeImmediate(e),this.notifyChange("dataUpdating")}_removeImmediate(e){for(const t of e)this._removeGraphic(t);this._cleanupSymbols(),this._labeler?.setDirty(),this._deconflictor?.setDirty()}_removeDelayed(e){for(const t of e){const e=t.uid,i=this._pendingUpdates.get(e);if(i)i.add&&(i.remove?i.add=null:this._pendingUpdates.delete(e),1===i.state&&i.abortController?.abort(),this._pendingAdds--);else{const i=new ze;i.remove=t,this._pendingUpdates.set(e,i),this._pendingRemoves++,this._applyPendingRemovesFirst=!0}}0===this._pendingUpdates.size&&this._finishPendingUpdates(),this.notifyChange("readyToRun"),this.notifyChange("updatingRemaining"),this.notifyChange("dataUpdating")}_finishPendingUpdates(){this._cleanupSymbols(),(this._pendingAdds||this._pendingRemoves)&&s.getLogger(this).warn("pendingAdds/Removes in inconsistent state!"),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1}_applyFocusAreasUpdates(e){for(;this._focusAreasGraphicsQueue.length>0&&!e.done;){e.madeProgress();const t=this._focusAreasGraphicsQueue.pop(),i=fe(t.graphic.geometry);if(null==i)continue;const r=this.stage.view.focusAreasView?.containsGeometry(i)??!0;t.layers.forEach(e=>{if(e.stageObject){e.stageObject.geometries.some(e=>e.material instanceof Re&&e.material.parameters.isFocused!==r)&&this.recreateGraphics([t.graphic])}})}0===this._focusAreasGraphicsQueue.length&&this.notifyChange("readyToRun")}_applyPendingUpdates(e){if(this._geometryWarningLogged=!1,this._symbolWarningLogged=!1,0===this._pendingUpdates.size&&this._spatialIndex?.updating)return this._spatialIndex.update(),void e.madeProgress();if(this._applyPendingRemovesFirst){this._applyPendingRemovesFirst=!1;for(const[t,i]of this._pendingUpdates){if(e.done){this._applyPendingRemovesFirst=!0;break}if(i.remove&&!i.add&&(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(i.remove),i.remove=null,this._pendingUpdates.delete(t),0===this._pendingRemoves))break}}for(const[t,i]of this._pendingUpdates){if(e.done)break;i.add&&0===i.state&&this._processPendingUpdateNew(i);let r=this.effectiveUpdatePolicy;if(!i.remove||i.add&&2!==i.state||(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(i.remove),i.remove=null,r=1),i.add)switch(i.state){case 2:this._addGraphic(i.add,i.renderingInfo,r),i.add=null,this._pendingAdds--,e.madeProgress();break;case 3:i.add=null,this._pendingAdds--}null==i.remove&&null==i.add&&this._pendingUpdates.delete(t)}0===this._pendingUpdates.size&&(this._finishPendingUpdates(),this.notifyChange("readyToRun"),this.notifyChange("dataUpdating"))}_processPendingUpdateNew(e){if(!e.add)return void(e.state=2);const t=e.add.geometry;null==t||"mesh"!==t.type||t.loaded?this._processPendingUpdateNewRenderingInfo(e):this._processPendingUpdateNewMesh(e,t)}async _processPendingUpdateNewMesh(e,t){e.state=1,e.abortController=new AbortController;const i=e.abortController.signal;try{await t.load({signal:i})}catch(r){return this._processPendingUpdateNewError(e,r)}e.abortController=null,this._processPendingUpdateNewRenderingInfo(e)}_processPendingUpdateNewError(e,t){e.abortController=null,u(t)?e.state=0:e.state=3}async _processPendingUpdateNewRenderingInfo(e){if(null==this.layer.renderer||"dictionary"!==this.layer.renderer.type)return e.renderingInfo=this._getRenderingInfo(e.add),void(e.state=2);e.state=1,e.abortController=new AbortController;let t=null;try{t=await this._getRenderingInfoAsync(e.add,{signal:e.abortController.signal})}catch(i){return e.abortController=null,void(u(i)?e.state=0:e.state=3)}null==t?.symbol?(this._symbolWarningLogged||(this._symbolWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),e.renderingInfo=null):e.renderingInfo=t,e.state=2}_addGraphic(e,t,i){if(this._graphicsWithoutSymbol.set(e.uid,e),null==t?.symbol||!Q(e))return;const r=this.stage.renderView.olidRenderHelper;if(r&&this.setUidToIdOnAdd){const t=J(this.owner.view,this.owner.layerViewUid);r.setUidToObjectAndLayerId(e.objectId,e.uid,this.layer.id,this.owner.layerViewUid,W(this.layer)&&!!this.layer.popupEnabled&&!t&&Ue(this.layer,this.owner.view.popup?.defaultPopupTemplateEnabled))}const s=t.symbol,a=this.getOrCreateGraphics3DSymbol(s,t.renderer);if(null==a)return;this._expandComputedExtent(e.geometry);const n=this._beginGraphicUpdate(e),o=new ce(e,t,this.layer);let l=!1;const h=e=>{e===a.symbol.id&&(l=!0)};this._whenSymbolRemoved.push(h);const d=()=>{if(--this._loadingSymbols,this.destroyed)return;this._whenSymbolRemoved.removeUnordered(h);if(this._graphicsWaitingForSymbol.get(e.uid)!==n||l||a.destroyed||this.graphicSymbolSupported&&e.symbol&&e.symbol.id!==a.symbol.id)--a.referenced,this._cleanupSymbols();else{const t=this._createGraphics3DGraphic(a,o);this._spatialIndex&&null!=t&&this._spatialIndex.add(t),--a.referenced,this._endGraphicUpdate(e)}this._featureStore.events.emit("changed"),this.owner.notifyContentGeometryUpdate?.(),this._labeler?.setDirty()},p=t=>{--this._loadingSymbols,this.destroyed||(this._whenSymbolRemoved.removeUnordered(h),l||(u(t)?this.add([e]):a.destroyed||this._endGraphicUpdate(e,t)))};++this._loadingSymbols,0===i?a.load(()=>this._dataUpdateQueue.push(d,null).catch(c),e=>this._dataUpdateQueue.push(()=>p(e),null).catch(c)):a.load(d,p)}_removeGraphic(e){const t=e.uid,i=this.graphics3DGraphics.get(t);if(i){i.graphics3DSymbol.onRemoveGraphic(i);const e=i.usedMemory,r=i.isElevationSource;this._conditionalRemove(i,t),this._spatialIndex?.remove(i);const s=i.graphics3DSymbol.symbol.id;this._graphicsBySymbol.get(s)?.delete(t),this._graphicsWithoutSymbol.delete(t),this._removeGraphics3DGraphic(t,e,r),i.destroy(),this._featureStore.events.emit("changed"),this.owner.notifyContentGeometryUpdate?.()}else this._graphicsWithoutSymbol.delete(t),this._graphicsWaitingForSymbol.delete(t),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("dataUpdating"))}_hasLabelingContext(e){if(e instanceof ee||e instanceof te){const t=this.symbolCreationContext.layer;return!!t.labelingInfo&&t.labelingInfo.some(t=>t.symbol===e)}return!1}_hasValidSymbolCreationContext(e){return!(e instanceof ee&&!this._hasLabelingContext(e))||(s.getLogger(this).error("LabelSymbol3D is only valid as part of a LabelClass. Using LabelSymbol3D as a renderer symbol is not supported."),!1)}_getRenderingInfo(e,t=!0){const i=e.geometry;if(null==i)return t&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!L(i.spatialReference,this._viewSpatialReference))return t&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} has incompatible spatial reference and will not render`)),null;if(!this.graphicSymbolSupported&&null!=e.symbol)return t&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const r=this.rendererHasGeometryOperations?N(e,this.layer,null):e;let a;if(this.owner.getRenderingInfo&&(this.getRenderingInfoWithoutRenderer||null!=this.currentRenderer))a=this.owner.getRenderingInfo(r,this.currentRenderer,this._arcadeOnDemand);else{const e=r.symbol||re(r.geometry);a=new X(null,e)}return null==a?.symbol?(t&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),null):a}_getRenderingInfoAsync(e,t){if(null==e.geometry)return this._geometryWarningLogged||(this._geometryWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!this.graphicSymbolSupported&&null!=e.symbol)return this._symbolWarningLogged||(this._symbolWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const i=this.rendererHasGeometryOperations?N(e,this.layer,null):e;return this.owner.getRenderingInfoAsync(i,this.currentRenderer,this._arcadeOnDemand,t)}_createGraphics3DSymbol(e,t){if(!this._hasValidSymbolCreationContext(e))return null;const i=this._getConvertedSymbol(e);if(!i)return null;let r;if(null!=t&&"backgroundFillSymbol"in t&&t.backgroundFillSymbol){const e=se(t.backgroundFillSymbol,{ignoreDrivers:!0});null!=e.symbol&&(r=e.symbol.symbolLayers)}const s=ue(i,this.symbolCreationContext,r);return s.load(()=>{const e=s.extentPadding;e>this.extentPadding&&this._set("extentPadding",e),this.notifyChange("averageSymbolComplexity")},()=>{}),s}getOrCreateGraphics3DSymbol(e,t){let i=this._symbols.get(e.id);if(void 0===i){const r=this._unusedSymbolsCache.pop(e.id);i=null!=r?r:e instanceof ie?new ge(e,e=>this._dataUpdateQueue.push(e,null),e=>this._createGraphics3DSymbol(e,t)):this._createGraphics3DSymbol(e,t),this._symbols.set(e.id,i),this._symbolMaterials=null}return null!=i&&++i.referenced,i}trackGraphicState(e){return null==this._graphicStateTracking&&(this._graphicStateTracking=new be(this)),this._graphicStateTracking.add(e)}_addGraphics3DGraphic(e){this._usedMemory+=e.usedMemory,this.graphics3DGraphics.set(e.graphic.uid,e),this._numberOfGraphics++,e.isElevationSource&&(this._numberOfGraphicsProvidingElevation++,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_removeGraphics3DGraphic(e,t,i=!1){this._usedMemory-=t,this.graphics3DGraphics.delete(e),this._numberOfGraphics--,i&&(this._numberOfGraphicsProvidingElevation--,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_createGraphics3DGraphic(e,t){const{graphic:i}=t;if(this._graphicsWithoutSymbol.delete(i.uid),!this._symbols.has(e.symbol.id))return this.add([i]),null;if(this.graphics3DGraphics.has(i.uid))return null;const r=e.createGraphics3DGraphic(t);if(null==r)return null;this._addGraphics3DGraphic(r);const s=e.symbol.id;this._graphicsBySymbol.has(s)||this._graphicsBySymbol.set(s,new Map),this._graphicsBySymbol.get(s).set(i.uid,r);if(r.isDraped&&this._graphicsDrapedUids.add(i.uid),r.centroid=null,null!=i.geometry&&"point"!==i.geometry.type&&(r.centroid=_e(i.geometry,this._viewSpatialReference)),this._updateUserVisibility(r),null!=this._scaleVisibility&&this._scaleVisibility.updateVisibility(r),null!=this._filterVisibility){const{defaultVisibility:e}=this._filterVisibility;r.setVisibilityFlag(1,4,e),e||this._filterVisibility.reapply()}this._deconflictor?.addGraphic(r),this._labeler?.addGraphic(r),this._objectStates?.addGraphic(r),r.initialize(this.stageLayer),null!=this._graphicStateTracking&&this._graphicStateTracking.addGraphic(r);const a=this._whenGraphics3DGraphicRequests[i.uid];return a&&(delete this._whenGraphics3DGraphicRequests[i.uid],a.resolve(r)),this._symbolMaterials=null,r}async rendererChange(e){if(this._rendererChangeAbortController=n(this._rendererChangeAbortController),e!==this.currentRenderer)if(this._validateRenderer(e),null==e&&this._currentRendererChange(null,!1),Z(e))if(e?.arcadeRequired){const t=new AbortController;this._rendererChangeAbortController=t;const{arcadeUtils:i}=await this._ensureArcade();p(t);const r=i.hasGeometryOperations(e);r&&(await i.enableGeometryOperations(),p(t)),0===this.effectiveUpdatePolicy?await this._updateQueue.push(()=>this._currentRendererChange(e,r),t.signal):this._currentRendererChange(e,r),this._rendererChangeAbortController=null}else if(0===this.effectiveUpdatePolicy){const t=new AbortController;this._rendererChangeAbortController=t,await this._updateQueue.push(()=>this._currentRendererChange(e,!1),t.signal),this._rendererChangeAbortController=null}else this._currentRendererChange(e,!1);else this._currentRendererChange(e,!1)}async _ensureArcade(){return null==this._arcadeOnDemand?(this._arcadeOnDemand=await K(),this._arcadeOnDemand):this._arcadeOnDemand}_currentRendererChange(e,t){this.currentRenderer=e,this.rendererHasGeometryOperations=t,this.symbolCreationContext.arcade=this._arcadeOnDemand;const i=this.symbolCreationContext.renderer;if(e===i)return;if(this._symbolConversionCache.clear(),this._unusedSymbolsCache.clear(),null==e)return this.symbolCreationContext.renderer=null,void this.recreateAllGraphicsAndSymbols();const r=w(i,e);this._updateUnchangedSymbolMappings(r,e,i),this.symbolCreationContext.renderer=e,null!=r&&("complete"===r.type?this.recreateAllGraphicsAndSymbols():"partial"===r.type&&(this._applyRendererDiff(r,e,i)?this._labeler?.reset():this.recreateAllGraphicsAndSymbols()),this.notifyChange("averageSymbolComplexity"))}_diffHasSymbolChange(e){for(const t in e.diff)switch(t){case"visualVariables":case"defaultSymbol":case"uniqueValueInfos":break;case"uniqueValueGroups":case"authoringInfo":case"fieldDelimiter":delete e.diff[t];break;default:return!0}return!1}_applySymbolSetDiff(e,t,i){e=e||[],t=t||[];const r=[];for(const s of t){const t=this._graphicsBySymbol.get(s.id);t&&t.forEach((a,n)=>{const o=a.graphic,l=this.layer instanceof H?this.layer:null,h=this._arcadeOnDemand;if(s===i.defaultSymbol&&i.getSymbol(N(o,l,null),{arcade:h})===i.defaultSymbol)return;const d=a.usedMemory;e.length||i.defaultSymbol?r.push(o):this._graphicsWithoutSymbol.set(n,o);const p=this.graphics3DGraphics.get(n);this._conditionalRemove(p,n),a.destroy(),t.delete(n),this._removeGraphics3DGraphic(n,d),this._updateLayerVisibility()}),this._whenSymbolRemoved.forAll(e=>e(s.id))}(e.length||r.length)&&(this._graphicsWithoutSymbol.forEach(e=>r.push(e)),this._graphicsWithoutSymbol.clear(),this.add(r)),this._cleanupSymbols(),this._labeler?.setDirty(),this._deconflictor?.setDirty()}_applyUniqueValueRendererDiff(e,t,r){const s=e.diff.defaultSymbol,a=e.diff.uniqueValueInfos;if(s||a){const n=a?.changed,o=a?.unchanged;if(n&&o&&n.some(e=>o.some(t=>t.oldValue.symbol?.id===e.oldValue.symbol?.id)))return!1;const l=a?a.added.map(e=>e.symbol).filter(i):[],h=a?a.removed.map(e=>e.symbol).filter(i):[];if(n)for(let e=0;e<n.length;e++)l.push(n[e].newValue.symbol),h.push(n[e].oldValue.symbol);return s?(r.defaultSymbol&&h.push(r.defaultSymbol),t.defaultSymbol&&l.push(t.defaultSymbol)):r.defaultSymbol&&l.length&&h.push(t.defaultSymbol),this._applySymbolSetDiff(l,h,t),delete e.diff.defaultSymbol,delete e.diff.uniqueValueInfos,!0}return!1}_calculateUnchangedSymbolMapping(e,t,i){if("unique-value"!==t?.type||"unique-value"!==i?.type||null!=e&&"partial"!==e.type)return[];const r=e=>null!=e?e.id:null,s=e&&e.diff,a=s?.defaultSymbol,n=s&&s.uniqueValueInfos;let o;if(n)o=n.unchanged.map(e=>({oldId:r(e.oldValue.symbol),newId:r(e.newValue.symbol)}));else{o=[];for(const e of i.uniqueValueInfos??[]){const i=r(e.symbol),s=t.uniqueValueInfos?.find(t=>t.value===e.value);s&&i!==r(s.symbol)&&o.push({oldId:i,newId:r(s.symbol)})}}return!a&&i.defaultSymbol&&o.push({oldId:r(i.defaultSymbol),newId:r(t.defaultSymbol)}),o}_updateSymbolMapping(e,t){const i=null!=t&&t?"string"==typeof t?t:t.id:null;if(null==e||e===i)return;const r=this._graphicsBySymbol.get(e);this._graphicsBySymbol.delete(e),void 0!==r&&this._graphicsBySymbol.set(i,r);const s=this._symbols.get(e);if(void 0!==s&&(this._symbols.delete(e),this._symbols.set(i,s),this._symbolMaterials=null,null!=s)){const e="string"==typeof t?null:t;null!=e?s.symbol=e:s.symbol.id=i}}_updateUnchangedSymbolMappings(e,t,i){const r=this._calculateUnchangedSymbolMapping(e,t,i);for(const{oldId:s,newId:a}of r)this._updateSymbolMapping(s,a)}_applyRendererDiff(e,t,i){if(this._diffHasSymbolChange(e))return!1;if(t instanceof $&&i instanceof $&&this._applyUniqueValueRendererDiff(e,t,i)&&0===Object.keys(e.diff).length)return!0;for(const r of this._graphicsBySymbol.keys()){const i=this._symbols.get(r);if(null!=i)switch(i.applyRendererDiff(e,t)){case 0:this._recreateSymbol(r);break;case 1:this._recreateGraphicsForSymbol(r)}}return!0}terrainTransparencyChange(){this.forEachGraphics3DSymbol((e,t,i)=>{e.globalPropertyChanged("terrainTransparency",t)||this._recreateSymbol(i)}),this.labeler?.reset()}opacityChange(){this._updateStageLayerVisibility(),this.forEachGraphics3DSymbol((e,t)=>e.globalPropertyChanged("opacity",t))}_screenSizePerspectiveEnabledChange(){this.forEachGraphics3DSymbol((e,t)=>e.globalPropertyChanged("screenSizePerspectiveEnabled",t)),this._labeler?.screenSizePerspectiveEnabledChanged(),this._deconflictor?.screenSizePerspectiveEnabledChanged()}_slicePlaneEnabledChange(e){e!==this.symbolCreationContext.slicePlaneEnabled&&(this.symbolCreationContext.slicePlaneEnabled=e,this.stageLayer.sliceable=e,this.forEachGraphics3DSymbol((e,t)=>e.globalPropertyChanged("slicePlaneEnabled",t)),this._deconflictor?.slicePlaneEnabledChange(),this._labeler?.slicePlaneEnabledChange())}_physicalBasedRenderingChange(e){this.symbolCreationContext.physicalBasedRenderingEnabled=e,this.forEachGraphics3DSymbol((e,t,i)=>{e.globalPropertyChanged("physicalBasedRenderingEnabled",t)||this._recreateSymbol(i)})}_skipHighSymbolLoDsChange(e){this.symbolCreationContext.skipHighSymbolLods=e,this.forEachGraphics3DSymbol((e,t,i)=>{e.globalPropertyChanged("skipHighSymbolLods",t)||this._recreateSymbol(i)})}_pixelRatioChange(){this.forEachGraphics3DSymbol((e,t,i)=>{e.globalPropertyChanged("pixelRatio",t)||this._recreateSymbol(i)})}_signalUpdatingDuringAsyncLoadedGraphicsChange(){this._updatingPendingLoadedGraphicsChange&&this._updatingPendingLoadedGraphicsChange.remove(),this._updatingPendingLoadedGraphicsChange=C(()=>{this._updatingPendingLoadedGraphicsChange=null})}setClippingExtent(e,t){const i=this.symbolCreationContext.clippingExtent,r=k();return Se(e,r,t)?this.symbolCreationContext.clippingExtent=T(F(),r):this.symbolCreationContext.clippingExtent=null,!M(this.symbolCreationContext.clippingExtent,i)}modifyGraphics3DGraphicVisibilities(e){if(this.destroyed)return;let t=!1;this.graphics3DGraphics.forEach(i=>{e(i)&&(t=!0)}),t&&(this._labeler?.setDirty(),this._deconflictor?.setDirty())}forEachGraphics3DSymbol(e,t){for(const[i,r]of this._symbols){if(null==r)return;e(r,this._graphicsBySymbol.get(i)||qe,i)}if(!t?.excludeUnused)for(const i of this._unusedSymbolsCache)e(i,void 0,i.symbol.id)}updateGraphicsVisibilities(){null!=this._filterVisibility&&this._filterVisibility.reapply(),this.modifyGraphics3DGraphicVisibilities(e=>{const t=this._updateUserVisibility(e),i=!!this._scaleVisibility?.updateVisibility(e);return t||i})}_hideAllGraphics(){this.modifyGraphics3DGraphicVisibilities(e=>e.setVisibilityFlag(1,1,!1))}_validateRenderer(e){const t=()=>`'${this.layer.title?`${this.layer.title}, `:""}id:${this.layer.id}'`,i=Y(e,{geometryType:this.layer?.geometryType,logWarning:(e,i)=>s.getLogger(this).warn(e,`Symbology conversion for layer ${t()}: ${i}`)});if(i){const e=`Renderer for layer ${t} is not supported in a SceneView`;s.getLogger(this).warn(e,i.message)}}_cleanupSymbols(){if(this._graphicsWaitingForSymbol.size>0||this._suspendSymbolCleanup)return;let e=!1;this._symbols.forEach((t,i)=>{if(null==t||t.referenced>0)return;const r=this._graphicsBySymbol.get(i);r&&0!==r.size||(this._graphicsBySymbol.delete(i),this._symbols.delete(i),this._symbolMaterials=null,this._unusedSymbolsCache.put(i,t,h),e=!0)}),e&&(this._recomputeExtentPadding(),this.notifyChange("averageSymbolComplexity"))}get test(){}get performanceInfo(){return new me(this.graphics3DGraphics.size,Array.from(this.graphics3DGraphics.values()).reduce((e,t)=>e+(t.isVisible()?1:0),0),this._graphicsWithoutSymbol.size,this._pendingUpdates.size)}};e([S({readOnly:!0})],ke.prototype,"computedExtent",void 0),e([S()],ke.prototype,"currentRenderer",void 0),e([S()],ke.prototype,"rendererHasGeometryOperations",void 0),e([S()],ke.prototype,"_frameTaskHandle",void 0),e([S()],ke.prototype,"_dataUpdateQueue",void 0),e([S()],ke.prototype,"_updateQueue",void 0),e([S({readOnly:!0})],ke.prototype,"_viewSpatialReference",null),e([S()],ke.prototype,"_rendererChangeAbortController",void 0),e([S()],ke.prototype,"_elevationInfoChangeAbortController",void 0),e([S()],ke.prototype,"_initializeAbortController",void 0),e([S()],ke.prototype,"_elevationAlignment",void 0),e([S()],ke.prototype,"_scaleVisibility",void 0),e([S()],ke.prototype,"_filterVisibility",void 0),e([S()],ke.prototype,"_initializePromise",void 0),e([S()],ke.prototype,"_spatialIndex",void 0),e([S({readOnly:!0})],ke.prototype,"extentPadding",void 0),e([S()],ke.prototype,"_updatingPendingLoadedGraphicsChange",void 0),e([S()],ke.prototype,"_featureStore",void 0),e([S()],ke.prototype,"_objectStates",void 0),e([S()],ke.prototype,"_loadingSymbols",void 0),e([S({constructOnly:!0})],ke.prototype,"compressionTracker",void 0),e([S()],ke.prototype,"preferredUpdatePolicy",void 0),e([S()],ke.prototype,"_forcedUpdatePolicy",void 0),e([S({readOnly:!0})],ke.prototype,"effectiveUpdatePolicy",null),e([S({constructOnly:!0})],ke.prototype,"elevationFeatureExpressionEnabled",void 0),e([S({constructOnly:!0})],ke.prototype,"owner",void 0),e([S({constructOnly:!0})],ke.prototype,"layer",void 0),e([S({constructOnly:!0})],ke.prototype,"graphicSymbolSupported",void 0),e([S({constructOnly:!0})],ke.prototype,"getRenderingInfoWithoutRenderer",void 0),e([S({constructOnly:!0})],ke.prototype,"componentFactories",void 0),e([S({constructOnly:!0})],ke.prototype,"setUidToIdOnAdd",void 0),e([S()],ke.prototype,"featureStore",null),e([S()],ke.prototype,"initializePromise",null),e([S()],ke.prototype,"scaleVisibility",null),e([S()],ke.prototype,"elevationAlignment",null),e([S()],ke.prototype,"objectStates",null),e([S()],ke.prototype,"filterVisibility",null),e([S({readOnly:!0})],ke.prototype,"updating",null),e([S({readOnly:!0})],ke.prototype,"dataUpdating",null),e([S({readOnly:!0})],ke.prototype,"readyToRun",null),e([S({readOnly:!0})],ke.prototype,"suspendedOrOutsideOfView",null),e([S({readOnly:!0,dependsOn:[]})],ke.prototype,"updatingRemaining",null),e([S({readOnly:!0})],ke.prototype,"displayFeatureLimit",null),e([S({readOnly:!0,dependsOn:[]})],ke.prototype,"averageSymbolComplexity",null),e([S({constructOnly:!0})],ke.prototype,"hasZ",void 0),e([S({constructOnly:!0})],ke.prototype,"hasM",void 0),e([S()],ke.prototype,"_objectIdField",null),ke=Fe=e([G("esri.views.3d.layers.graphics.Graphics3DCore")],ke);class ze{constructor(){this.add=null,this.renderingInfo=null,this.state=0,this.abortController=null,this.remove=null}clear(){this.add=null,this.renderingInfo=null,this.state=0,this.abortController=null,this.remove=null}}const We=10,He=D(),Be=D(),qe=new Map;export{ke as Graphics3DCore};
5
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{isSome as i}from"../../../../core/arrayUtils.js";import r from"../../../../core/Error.js";import"../../../../core/has.js";import s from"../../../../core/Logger.js";import{findInMap as a}from"../../../../core/MapUtils.js";import{abortMaybe as n,removeMaybe as o,destroyMaybe as l}from"../../../../core/maybe.js";import{MinPriority as h}from"../../../../core/MemCache.js";import d from"../../../../core/PooledArray.js";import{throwIfAborted as p,ignoreAbortErrors as c,createResolver as y,isAbortError as u}from"../../../../core/promiseUtils.js";import g from"../../../../core/Queue.js";import{when as m,watch as b,on as _,syncAndInitial as f,whenOnce as v}from"../../../../core/reactiveUtils.js";import{schedule as C}from"../../../../core/scheduling.js";import{property as S,subclass as G}from"../../../../core/accessorSupport/decorators.js";import{diff as w,isEmpty as x}from"../../../../core/accessorSupport/diffUtils.js";import{h as P,i as R,j as U}from"../../../../chunks/vec32.js";import{create as D}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import I from"../../../../geometry/Extent.js";import E from"../../../../geometry/Point.js";import{canProjectWithoutEngine as L}from"../../../../geometry/projectionUtils.js";import{projectBuffer as j}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as V}from"../../../../geometry/projection/projectVectorToVector.js";import{projectXYZToVector as A}from"../../../../geometry/projection/projectXYZToVector.js";import{center as O,create as F,fromRect as T,equals as M}from"../../../../geometry/support/aaBoundingBox.js";import{create as k}from"../../../../geometry/support/aaBoundingRect.js";import{equals as z}from"../../../../geometry/support/spatialReferenceUtils.js";import{isPopupProvider as W}from"../../../../graphic/getPopupProvider.js";import H from"../../../../layers/Layer.js";import{getObjectId as B,computeAABB as q,hasGeometry as Q}from"../../../../layers/graphics/dehydratedFeatures.js";import{hydrateGraphic as N}from"../../../../layers/graphics/hydratedFeatures.js";import $ from"../../../../renderers/UniqueValueRenderer.js";import{isSupportedRenderer3D as Z,validateTo3D as Y}from"../../../../renderers/support/rendererConversion.js";import{RenderingInfo as X}from"../../../../renderers/support/RenderingInfo.js";import{isBasemapLayerView as J}from"../../../../support/basemapUtils.js";import{loadArcade as K}from"../../../../support/loadArcade.js";import ee from"../../../../symbols/LabelSymbol3D.js";import te from"../../../../symbols/TextSymbol.js";import ie from"../../../../symbols/WebStyleSymbol.js";import{getDefaultSymbol3D as re}from"../../../../symbols/support/defaults3D.js";import{to3D as se}from"../../../../symbols/support/symbolConversion.js";import{averageSymbolComplexities as ae,defaultSymbolComplexity as ne}from"./defaultSymbolComplexity.js";import{DisplayFeatureLimit as oe}from"./DisplayFeatureLimit.js";import{ViewElevationProvider as le}from"./ElevationQuery.js";import{extractExpressionInfo as he,createContext as de}from"./featureExpressionInfoUtils.js";import{Graphics3DFeatureStore as pe}from"./Graphics3DFeatureStore.js";import{Graphics3DGraphicCreationContext as ce}from"./Graphics3DGraphicCreationContext.js";import{Graphics3DSymbolCreationContext as ye}from"./Graphics3DSymbolCreationContext.js";import{make as ue}from"./Graphics3DSymbolFactory.js";import{Graphics3DWebStyleSymbol as ge}from"./Graphics3DWebStyleSymbol.js";import{GraphicsCorePerformanceInfo as me}from"./GraphicsCorePerformanceInfo.js";import{GraphicStateTracking as be}from"./GraphicStateTracking.js";import{computeCentroid as _e}from"./graphicUtils.js";import{placePointOnGeometry as fe}from"./pointUtils.js";import{SpatialIndex2D as ve}from"./SpatialIndex2D.js";import{StageLayerElevationProvider as Ce}from"../support/StageLayerElevationProvider.js";import{toBoundingRect as Se}from"../../support/extentUtils.js";import{GridLocalOriginFactory as Ge}from"../../webgl-engine/lib/GridLocalOriginFactory.js";import{isScreenSizePerspectiveEnabled as we}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{affectsGeometry as xe}from"../../webgl-engine/lib/VertexAttribute.js";import{WebGLLayer as Pe}from"../../webgl-engine/lib/WebGLLayer.js";import{HUDMaterial as Re}from"../../webgl-engine/materials/HUDMaterial.js";import{hasPopupTemplate as Ue}from"../../../layers/support/popupUtils.js";import{PromiseQueue as De}from"../../../support/PromiseQueue.js";import{PropertiesPool as Ie}from"../../../support/PropertiesPool.js";import{ImmediateTask as Ee,noBudget as Le,TaskPriority as je}from"../../../support/Scheduler.js";import{TextureCompressionTracker as Ve}from"../../../support/TextureCompressionTracker.js";import{Yield as Ae}from"../../../support/Yield.js";import{alphaCutoff as Oe}from"../../../../webscene/support/AlphaCutoff.js";var Fe;const Te=D(),Me=F();let ke=class extends t{static{Fe=this}static{this.tmpVec=D()}get _viewSpatialReference(){return this.owner.view.spatialReference}get spatialIndex(){return this._spatialIndex||(this._spatialIndex=new ve({objectIdField:this.owner.layer?.objectIdField,spatialReference:this._viewSpatialReference,hasZ:!!this.hasZ,hasM:!!this.hasM}),this._spatialIndex.setup(Array.from(this.graphics3DGraphics.values()))),this._spatialIndex.update(),this._spatialIndex}get deconflictor(){return this._deconflictor}get labeler(){return this._labeler}get numberOfGraphics(){return this._numberOfGraphics}get effectiveUpdatePolicy(){return null!=this.currentRenderer&&"dictionary"===this.currentRenderer.type?0:this._forcedUpdatePolicy??this.preferredUpdatePolicy}get featureStore(){return this._featureStore}get initializePromise(){return this._initializePromise}get scaleVisibility(){return this._scaleVisibility}get elevationAlignment(){return this._elevationAlignment}get objectStates(){return this._objectStates}get filterVisibility(){return this._filterVisibility}get updating(){return!!(this.dataUpdating||this._elevationAlignment?.updating||this._scaleVisibility?.updating||this._filterVisibility?.updating||this._rendererChangeAbortController||this._elevationInfoChangeAbortController||this._frameTaskHandle.updating||this._updateQueue.updating||this.readyToRun)}get dataUpdating(){return!!(this._graphicsWaitingForSymbol.size>0||this._pendingUpdates.size>0||this._spatialIndex?.updating||this._updatingPendingLoadedGraphicsChange||this._dataUpdateQueue.updating||this._loadingSymbols>0||this.compressionTracker.compressing)}get readyToRun(){return this._pendingUpdates.size>0||!!this._spatialIndex?.updating||this._dataUpdateQueue.readyToRun||this._updateQueue.readyToRun||this._focusAreasGraphicsQueue.length>0}get suspendedOrOutsideOfView(){return this.owner.suspended||!!this.owner.suspendInfo?.outsideOfView}get updatingRemaining(){return this.updating?this._pendingUpdates.size+.1*(this._spatialIndex?.updatingRemaining||0)+.1*(this._elevationAlignment?.updatingRemaining||0):0}get displayFeatureLimit(){const e=this.owner&&this.owner.view&&this.owner.view.qualitySettings,t=e?.graphics3D.minTotalNumberOfFeatures??0,i=e?.graphics3D.maxTotalNumberOfFeatures??0,r=e?.graphics3D.maxNumberOfDrawCalls??0,s=e?.graphics3D.maxTotalNumberOfVertices??0,a=this.averageSymbolComplexity,n=Math.max(1,a?.verticesPerFeature??1),o=a&&a.drawCallsPerFeature>0&&r>0?r/a.drawCallsPerFeature:i,l=Math.ceil(s/n),h=Math.max(t,Math.min(i,l,o)),d=this._get("displayFeatureLimit");return d&&d.maximumTotalNumberOfVertices===s&&d.averageSymbolComplexity===a&&d.maximumNumberOfFeatures===h?d:new oe(s,h,a)}get averageSymbolComplexity(){const e=ae(this._symbolComplexities),t=this._get("averageSymbolComplexity");return 0===e.numComplexities||null!=t&&(e.estimated&&(t.verticesPerFeature>=e.verticesPerFeature||t.verticesPerCoordinate>=e.verticesPerCoordinate||t.drawCallsPerFeature>=e.drawCallsPerFeature)||t.verticesPerFeature===e.verticesPerFeature&&t.verticesPerCoordinate===e.verticesPerCoordinate&&t.drawCallsPerFeature===e.drawCallsPerFeature)?t:e}get usedMemory(){const e=this.labelsEnabled?(this.averageSymbolComplexity?.memory.bytesPerFeatureLabel??0)*this._numberOfGraphics:0,t=this._getSymbolComplexitiesUsed().reduce((e,t)=>e+t.memory.resourceBytes,0);if(null==this._symbolMaterials){this._symbolMaterials=[];for(const e of this._symbols.values())if(null!=e)for(const t of e.symbolLayers)if(t)for(const e of t.materials)e&&this._symbolMaterials.push(e)}const i=this.owner.view.stage.renderer,r=this.owner.view.overlayManager.renderer,s=this._symbolMaterials.reduce((e,t)=>e+((i.getMaterialRenderer(t)||r.getMaterialRenderer(t))?.usedMemory??0),0);return this._usedMemory+e+t+s}get usedMemoryPerGraphic(){if(this._usedMemory&&this._numberOfGraphics){const e=this._numberOfGraphics/(this._numberOfGraphics+Math.max(this._pendingAdds,this._pendingRemoves));return this._usedMemory/this._numberOfGraphics*e}if(null!=this.averageSymbolComplexity){const e=this.labelsEnabled?this.averageSymbolComplexity.memory.bytesPerFeatureLabel:0;return this.averageSymbolComplexity.memory.bytesPerFeature+e}return 0}get unprocessedMemoryEstimate(){return(this._pendingAdds-this._pendingRemoves)*this.usedMemoryPerGraphic}get _symbolComplexities(){return this.currentRenderer?this._getSymbolComplexitiesUsedOrRenderer(this.currentRenderer):this._getSymbolComplexitiesUsed()}get visible(){return this._visible}_getConvertedSymbol(e){const t=e;if("web-style"===t.type)return t.clone();const i=this._symbolConversionCache.get(t.id);if(null!=i)return i;const r=se(t,{geometryType:this.layer?.geometryType??void 0,retainId:!0,hasLabelingContext:this._hasLabelingContext(t),cimFallbackEnabled:!0}),a=r.symbol||null;return null==a&&r.error&&s.getLogger(this).error(r.error.message),this._symbolConversionCache.set(t.id,a),a}_getSymbolComplexitiesUsedOrRenderer(e){if(null==e)return[];const t=e.symbols,i="backgroundFillSymbol"in e?e.backgroundFillSymbol:null;if(!i&&!t.length)return[];const r=[],s=this._getSymbolComplexityUsedOrRenderer(i);null!=s&&r.push(s);for(const a of t){const e=this._getSymbolComplexityUsedOrRenderer(a);null!=e&&r.push(e)}return r}_getSymbolComplexityUsedOrRenderer(e){if(null==e)return null;const t=this._symbols.get(e.id);if(null!=t)return t.complexity;const i=this._getConvertedSymbol(e);return null!=i?ne(i):null}_getSymbolComplexitiesUsed(){const e=[];return this._symbols.forEach(t=>{null!=t&&e.push(t.complexity)}),e}get _objectIdField(){return this.layer.objectIdField}constructor(e){super(e),this._propertiesPool=new Ie({computedExtent:()=>new I},this),this.computedExtent=null,this.currentRenderer=null,this.rendererHasGeometryOperations=!1,this._graphicStateTracking=null,this.graphics3DGraphics=new Map,this.stageLayer=null,this.stage=null,this._graphicsDrapedUids=new Set,this._graphicsBySymbol=new Map,this._symbolConversionCache=new Map,this._symbols=new Map,this._graphicsWithoutSymbol=new Map,this._graphicsWaitingForSymbol=new Map,this._graphicsUpdateId=0,this._frameTaskHandle=Ee,this._dataUpdateQueue=new De,this._updateQueue=new De,this._focusAreasGraphicsQueue=new g,this._suspendSymbolCleanup=!1,this._arcadeOnDemand=null,this._rendererChangeAbortController=null,this._elevationInfoChangeAbortController=null,this._initializeAbortController=null,this._elevationAlignment=null,this._scaleVisibility=null,this._filterVisibility=null,this._spatialIndex=null,this.extentPadding=0,this._updatingPendingLoadedGraphicsChange=null,this._featureStore=null,this._deconflictor=null,this._labeler=null,this._objectStates=null,this._viewElevationProvider=null,this._stageLayerElevationProvider=null,this._whenGraphics3DGraphicRequests={},this._pendingUpdates=new Map,this._numberOfGraphics=0,this._numberOfGraphicsProvidingElevation=0,this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1,this._loadingSymbols=0,this.compressionTracker=new Ve,this._symbolWarningLogged=!1,this._geometryWarningLogged=!1,this._objectIdInvisibleSet=new Set,this._whenSymbolRemoved=new d,this.preferredUpdatePolicy=1,this._forcedUpdatePolicy=null,this.elevationFeatureExpressionEnabled=!0,this.owner=null,this.layer=null,this.graphicSymbolSupported=!0,this.getRenderingInfoWithoutRenderer=!1,this.setUidToIdOnAdd=!0,this.hasZ=null,this.hasM=null,this._usedMemory=0,this._visible=!1,this._startCreateGraphics=!1,this._unusedSymbolsCache=e.owner.view.resourceController.memoryController.newCache("graphics-3d-unused-symbols",e=>e.destroy()),this.symbolCreationContext=new ye(e.owner.view.resourceController.scheduler,(e,t)=>this._updateQueue.push(e,t),e.owner.layerViewUid,this.compressionTracker)}initialize(){this._featureStore=new pe({objectIdField:this.owner.layer?.objectIdField,hasZ:!!this.hasZ,hasM:!!this.hasM,viewSpatialReference:this._viewSpatialReference,featureSpatialReference:this.owner.featureSpatialReference,getSpatialIndex:()=>this.spatialIndex,forEach:e=>this.graphics3DGraphics.forEach(e)});const e=(e,t,i)=>this.spatialIndex.queryGraphicUIDsInExtent(e,t,i),{componentFactories:t}=this;this._elevationAlignment=t.elevationAlignment?.(this,e),this._scaleVisibility=t.scaleVisibility?.(this,e),this._filterVisibility=t.filterVisibility?.({featureStore:this._featureStore,getFeatureCount:()=>this.graphics3DGraphics.size,updateFeatureVisibilities:e=>this.modifyGraphics3DGraphicVisibilities(t=>t.setVisibilityFlag(1,4,e(B(t.graphic,this._objectIdField)))),setAllFeaturesVisibility:e=>this.modifyGraphics3DGraphicVisibilities(t=>t.setVisibilityFlag(1,4,e)),clearFeaturesVisibility:()=>this.modifyGraphics3DGraphicVisibilities(e=>e.setVisibilityFlag(1,4,!0))}),this._deconflictor=t.deconflictor?.(this),this._labeler=t.labeler?.(this,this._scaleVisibility),this._objectStates=t.objectStates?.(this),this._initializeAbortController=new AbortController,this.addHandles(m(()=>this.owner.view.state.highlights,()=>{const{highlightOrderMap:e}=this.owner.view.state;this.graphics3DGraphics.forEach(t=>t.updateHighlights(e))})),this._initializePromise=this._initializeAsync()}async _initializeAsync(){const e=this._initializeAbortController?.signal,t=this.owner.view;this._viewElevationProvider=new le(this._viewSpatialReference,t),this._initializeStage(t,this.owner.layerViewUid);const i=t.sharedSymbolResources;this.symbolCreationContext.sharedResources=i,null!=this.currentRenderer&&(this.symbolCreationContext.renderer=this.currentRenderer),this.symbolCreationContext.stage=this.stage,this.symbolCreationContext.renderCoordsHelper=t.renderCoordsHelper,this.symbolCreationContext.layer=this.layer,this.symbolCreationContext.graphicsCoreOwner=this.owner,this.symbolCreationContext.localOriginFactory=new Ge(t.renderSpatialReference),this.symbolCreationContext.elevationProvider=t.elevationProvider,this.symbolCreationContext.notifyGraphicGeometryChanged=e=>this.notifyGraphicGeometryChanged(e),this.symbolCreationContext.notifyGraphicVisibilityChanged=e=>this.notifyGraphicVisibilityChanged(e);const r=he(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);if(this.symbolCreationContext.featureExpressionInfoContext=await de(r,this._viewSpatialReference,e,s.getLogger(this)),p(e),this.symbolCreationContext.screenSizePerspectiveEnabled=we(this.layer.screenSizePerspectiveEnabled),this.symbolCreationContext.slicePlaneEnabled=!!this.owner.slicePlaneEnabled,this.symbolCreationContext.physicalBasedRenderingEnabled=!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled,this.symbolCreationContext.skipHighSymbolLods=!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods,"drapeSourceType"in this.owner){const{owner:e}=this;this.symbolCreationContext.drapeSourceRenderer=t.overlayManager.registerGeometryDrapeSource(e)}this.addHandles([b(()=>this.suspendedOrOutsideOfView,()=>this._updateQueue.unshift(()=>this._updateLayerVisibility(),null).catch(c)),b(()=>we(this.layer?.screenSizePerspectiveEnabled),e=>{e!==this.symbolCreationContext.screenSizePerspectiveEnabled&&(this.symbolCreationContext.screenSizePerspectiveEnabled=e,this._screenSizePerspectiveEnabledChange())}),b(()=>this.owner.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(!!e)),b(()=>this.owner.view.state?.rasterPixelRatio,()=>this._pixelRatioChange()),b(()=>!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled,e=>this._physicalBasedRenderingChange(e)),b(()=>!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods,e=>this._skipHighSymbolLoDsChange(e)),b(()=>this.owner.view.focusAreasView?.polygons,()=>this._updateFocusedLabels()),b(()=>this.owner.view.map?.focusAreas.style,()=>this.recreateAllGraphicsAndSymbols()),b(()=>!!t.basemapTerrain&&!t.basemapTerrain.opaque&&!t.basemapTerrain.invisible,()=>this.terrainTransparencyChange()),m(()=>t.basemapTerrain?.tilingScheme,e=>{if(e.spatialReference.equals(this.symbolCreationContext.overlaySR)||null==t.basemapTerrain.spatialReference||(this.symbolCreationContext.overlaySR=t.basemapTerrain.spatialReference),this.hasHandles("loaded-graphics"))this.recreateAllGraphics();else{const e=()=>this.owner?.loadedGraphics;this.addHandles([_(e,"change",e=>{this._graphicsCollectionChanged(e),this._signalUpdatingDuringAsyncLoadedGraphicsChange()},{onListenerAdd:()=>{this.recreateAllGraphics(),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}})],"loaded-graphics")}},{initial:!0}),b(()=>this.effectiveUpdatePolicy,e=>{null!=this.stageLayer&&(this.stageLayer.updatePolicy=e),this.symbolCreationContext.isAsync=0===this.effectiveUpdatePolicy,1===e&&this.runTask(Le)},f)]),this._frameTaskHandle=t.resourceController.scheduler.registerTask(je.GRAPHICS_CORE,this),this.layer&&"featureReduction"in this.layer&&this.addHandles(b(()=>this.layer.featureReduction,()=>this._deconflictor?.featureReductionChange())),this.notifyChange("averageSymbolComplexity"),this.rendererChange(this.owner.renderer).catch(()=>{}),this._initializeAbortController=null}_abortInitialize(){this._initializeAbortController=n(this._initializeAbortController)}_updateFocusedLabels(){this._focusAreasGraphicsQueue.clear(),this.forEachGraphics3DSymbol((e,t)=>{t&&e.needsUpdateFocus&&t.forEach(e=>{this._focusAreasGraphicsQueue.push(e)})})}destroy(){if(this._unusedSymbolsCache.destroy(),this._abortInitialize(),this._rendererChangeAbortController=n(this._rendererChangeAbortController),this._abortElevationInfoChange(),this._frameTaskHandle.remove(),this._frameTaskHandle=Ee,this._dataUpdateQueue.cancelAll(),this._updateQueue.cancelAll(),this._deconflictor=o(this._deconflictor),this._labeler=o(this._labeler),this._elevationAlignment=l(this._elevationAlignment),this._scaleVisibility=l(this._scaleVisibility),this._filterVisibility=l(this._filterVisibility),this._objectStates=l(this._objectStates),this.clear(),"drapeSourceType"in this.owner){const{owner:e}=this;this.stage.view.overlayManager.unregisterDrapeSource(e)}this._featureStore=l(this._featureStore),this._updatingPendingLoadedGraphicsChange=o(this._updatingPendingLoadedGraphicsChange),this._graphicStateTracking=l(this._graphicStateTracking),this.stage&&(this.stageLayer=l(this.stageLayer),this.stage=null),this._set("owner",null);for(const e in this._whenGraphics3DGraphicRequests)this._whenGraphics3DGraphicRequests[e].reject(new r("graphic:layer-destroyed","Layer has been destroyed"));this._whenGraphics3DGraphicRequests=null,this._propertiesPool=l(this._propertiesPool),this._whenSymbolRemoved.prune(),this._symbolConversionCache.clear(),this._objectIdInvisibleSet.clear(),this._spatialIndex=l(this._spatialIndex),this._symbolMaterials=null}clear(){this._objectStates?.allGraphicsDeleted(),null!=this._graphicStateTracking&&this._graphicStateTracking.allGraphicsDeleted(),this.graphics3DGraphics.forEach(e=>e.destroy()),this._spatialIndex?.clear(),this.graphics3DGraphics.clear(),this._numberOfGraphics=0,this._usedMemory=0,this._updateLayerVisibility(),this._symbols.forEach(l),this._symbols.clear(),this._symbolMaterials&&(this._symbolMaterials.length=0,this._symbolMaterials=null),this._graphicsBySymbol.clear(),this._graphicsWithoutSymbol.clear(),this._graphicsWaitingForSymbol.clear(),this._pendingUpdates.clear(),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1,this.notifyChange("dataUpdating"),this.notifyChange("readyToRun"),this.notifyChange("updatingRemaining"),this._featureStore.events.emit("changed"),this.owner.notifyContentGeometryUpdate?.()}_initializeStage(e,t){this.stage=e.stage,this.stageLayer=new Pe(this.stage,{visible:!this.suspendedOrOutsideOfView,updatePolicy:this.effectiveUpdatePolicy},t);const i=this.stageLayer.events;i.on("transformationChanged",e=>this.notifyGraphicGeometryChanged(e.graphicUid)),i.on("shaderTransformationChanged",e=>this.notifyGraphicGeometryChanged(e.graphicUid)),i.on("visibilityChanged",e=>this.notifyGraphicVisibilityChanged(e.graphicUid)),i.on("geometryAdded",e=>this.notifyGraphicGeometryChanged(e.object.graphicUid)),i.on("geometryRemoved",e=>this.notifyGraphicGeometryChanged(e.object.graphicUid)),i.on("attributesChanged",e=>xe(e.attribute)&&this.notifyGraphicGeometryChanged(e.object.graphicUid))}notifyGraphicGeometryChanged(e){if(this.owner.notifyContentGeometryUpdate?.(),null==this._graphicStateTracking||null==e)return;const t=this.graphics3DGraphics.get(e);t&&this._graphicStateTracking.updateGraphicGeometry(t)}notifyGraphicVisibilityChanged(e){if(this.owner.notifyContentGeometryUpdate?.(),null==this._graphicStateTracking||null==e)return;const t=this.graphics3DGraphics.get(e);t&&this._graphicStateTracking.updateGraphicVisibility(t)}_updateLayerVisibility(){const e=this.displayFeatureLimit.maximumNumberOfFeatures,t=this._numberOfGraphics>e*We,i=!this.suspendedOrOutsideOfView&&!t;i!==this._visible&&(this._visible=i,this._updateStageLayerVisibility())}_updateStageLayerVisibility(){const e=this._visible&&(null==this.layer.opacity||this.layer.opacity>=Oe);this.stageLayer.visible!==e&&(this.stageLayer.visible=e,e?this.updateGraphicsVisibilities():this._hideAllGraphics(),this.owner.notifyContentGeometryUpdate?.())}getGraphics3DGraphicById(e){return null!=e?this.graphics3DGraphics.get(e):void 0}getGraphics3DGraphicByObjectId(e){return this.owner.layer?.objectIdField?this._findGraphics3DGraphicByObjectId(e):null}_getGraphicObjectID(e,t=this.owner.layer?.objectIdField){return B(e,t)}get graphics3DGraphicsByObjectID(){const e=this.owner.layer?.objectIdField;if(!e)return;const t=new Map;return this.graphics3DGraphics.forEach(i=>{if(!i)return;const r=i.graphic,s=this._getGraphicObjectID(r,e);null!=s&&t.set(s,i)}),t}get labelsEnabled(){return!!this._labeler?.layerLabelsEnabled()}async updateLabelingInfo(e){const t=this._deconflictor?.labelingInfoChange(e),i=this._labeler?.labelingInfoChange(e);await Promise.allSettled([t,i])}updateVisibilityInfo(){this._deconflictor?.labelingInfoChange(),this._labeler?.visibilityInfoChange()}get symbolUpdateType(){if(this._pendingUpdates.size>0)return"unknown";let e=!1,t=!1;for(const[i,r]of this._symbols)if(null!=r){switch(r.getFastUpdateStatus()){case 3:return"unknown";case 1:this._graphicsBySymbol.has(i)&&(t=!0);break;case 0:this._graphicsBySymbol.has(i)&&(e=!0);break;case 2:this._graphicsBySymbol.has(i)&&(t=e=!0)}}return t?e?"mixed":"fast":e?"slow":"mixed"}runTask(e){if(this._dataUpdateQueue.runTask(e),this._updateQueue.runTask(e),this._applyPendingUpdates(e),this._applyFocusAreasUpdates(e),this.notifyChange("readyToRun"),this.readyToRun||this.notifyChange("dataUpdating"),this.notifyChange("updatingRemaining"),!e.hasProgressed)return Ae}setObjectIdVisibility(e,t){t?this._objectIdInvisibleSet.delete(e):this._objectIdInvisibleSet.add(e);const i=this._findGraphics3DGraphicByObjectId(e);null!=i&&this._updateUserVisibility(i)}_findGraphics3DGraphicByObjectId(e){return a(this.graphics3DGraphics,t=>this._getGraphicObjectID(t.graphic)===e)}_updateUserVisibility(e){if(null==e)return!1;const t=e.graphic,i=this._getGraphicObjectID(t),r=t.visible&&!this.owner.suspended&&this.stageLayer.visible&&(null==i||!this._objectIdInvisibleSet.has(i));return e.setVisibilityFlag(1,1,r)}_whenGraphics3DGraphic(e){const t=this.graphics3DGraphics.get(e.uid);if(t)return Promise.resolve(t);const i=this._whenGraphics3DGraphicRequests[e.uid];if(i)return i.promise;const r=y();return this._whenGraphics3DGraphicRequests[e.uid]=r,r.promise}async _boundsForGraphics3DGraphic(e,t){const i=this._viewSpatialReference,r=this.owner.view.renderSpatialReference,s=this.owner.view.basemapTerrain.spatialReference,a=(e,t,s)=>j(e,r,t,e,i,t,s),n=(e,t,r)=>j(e,s,t,e,i,t,r),o=this._viewElevationProvider?{service:this._viewElevationProvider,useViewElevation:null!=t&&!!t.useViewElevation,minDemResolution:null!=t?t.minDemResolution:null,minDemResolutionForPoints:this.owner.view.resolution}:null,l=await e.getProjectedBoundingBox(a,n,o,t?.signal);if(!l)return null;const h=l.boundingBox;if(l.requiresDrapedElevation){const e=this.symbolCreationContext.elevationProvider;if(e){O(h,Te);const t=e.getElevation(Te[0],Te[1],0,i,"ground")??0;h[2]=Math.min(h[2],t),h[5]=Math.max(h[5],t)}}return{boundingBox:h,screenSpaceObjects:l.screenSpaceObjects}}async whenGraphicBounds(e,t){await v(()=>this.owner?.loadedGraphics);const i=this.owner.layer?.objectIdField,s=this.owner.loadedGraphics.find(t=>t===e||null!=i&&null!=t.attributes&&e.attributes&&t.attributes[i]===e.attributes[i]);if(!s)throw new r("internal:graphic-not-part-of-view","Graphic is not part of this view");const a=await this._whenGraphics3DGraphic(s);return this._boundsForGraphics3DGraphic(a,t)}computeAttachmentOrigin(e,t){const i=this.graphics3DGraphics.get(e.uid);if(!i)return null;const r=i.computeAttachmentOrigin();if(0===r.render.num&&0===r.draped.num)return null;P(He,0,0,0);let s=0;if(r.render.num>0){if(!V(r.render.origin,this.symbolCreationContext.renderCoordsHelper.spatialReference,Be,t))return null;R(He,He,Be),s++}if(r.draped.num>0){const[e,i]=r.draped.origin,a=this._viewElevationProvider.getElevation(e,i,"ground")??0;if(P(Be,e,i,a),!V(Be,this._viewElevationProvider.spatialReference,Be,t))return null;R(He,He,Be),s++}return s>1&&U(He,He,1/s),new E({x:He[0],y:He[1],z:He[2],spatialReference:t})}getSymbolLayerSize(e,t){const i=this._symbols.get(e.id);if(null==i)throw new r("internal:symbol-not-part-of-view","Symbol is not part of this view");const s=e.symbolLayers.indexOf(t);if(-1===s)throw new r("internal:missing-symbol-layer","Symbol layer is not in symbol");const a=i.getSymbolLayerSize(s);if(null==a)throw new r("internal:missing-size","Symbol layer has no valid size");return a}_graphicsCollectionChanged(e){this._startCreateGraphics&&(this.add(e.added),this.remove(e.removed))}graphicUpdateHandler(e){const t=e.graphic.uid,i=this.graphics3DGraphics.get(t);if(null!=i||null!=this._graphicsWithoutSymbol.get(t)){switch(e.property){case"visible":this._graphicUpdateVisibleHandler(i);break;case"geometry":this._graphicUpdateGeometryHandler(i,e.graphic);break;case"symbol":this._graphicUpdateSymbolHandler(i,e);break;case"attributes":{const t=this.symbolCreationContext.featureExpressionInfoContext;t?.arcade&&this._graphicUpdateGeometryHandler(i,e.graphic)}break;case"popupTemplate":break;case"origin-transform":this._graphicUpdateTransformHandler(i,e)}this.owner.notifyContentGeometryUpdate?.()}}_graphicUpdateGeometryHandler(e,t){this._graphicUpdateGeometryOrTransformHandler(e,t,()=>!(null==e||!e.graphics3DSymbol.updateGeometry(e)||!(this._labeler?.updateGraphicGeometry(e)??1))&&(this._labeler?.setDirty(),this._deconflictor?.setDirty(),!0));const i=t.geometry;null!=i&&this._expandComputedExtent(i)}_graphicUpdateTransformHandler(e,t){const i=t.graphic.geometry;this._graphicUpdateGeometryOrTransformHandler(e,t.graphic,()=>null!=t.newValue&&null!=e&&null!=i&&e.graphics3DSymbol.updateTransform(e,i.spatialReference,t.newValue,t.action))}_graphicUpdateGeometryOrTransformHandler(e,t,i){if(null!=t.geometry){if(null==e){const e=t.symbol?.id;if(e){const t=this._symbols.get(e);if(null!=t&&0===t.loadStatus)return}return void this._recreateGraphic(t)}i()||this._recreateGraphic(e.graphic)}else this._recreateGraphic(t)}_graphicUpdateSymbolHandler(e,t){const i=t.graphic,r=null!=e?e.graphics3DSymbol:null!=t.oldValue?this._symbols.get(t.oldValue.id):null;if(null==r||null==t.newValue)return void this._recreateGraphic(i);const s=r.symbol,a=this._getConvertedSymbol(t.newValue);if(null!=a&&(a.type!==s.type||"web-style"===a.type)||"web-style"===s.type)return void this._recreateGraphic(i);const n=this._graphicsBySymbol.get(s.id);if(n&&1!==n.size)return void this._recreateGraphic(i);const o=w(s,a);if(null==o)return void this._updateSymbolMapping(s.id,a);const l={diff:o,graphics3DGraphicPatches:[],symbolStatePatches:[]};if(r.prepareSymbolPatch(l),!x(l.diff))return void this._recreateGraphic(i);const h=this._getRenderingInfo(i,!1);if(null==h)return void this._recreateGraphic(i);const d=r.extentPadding;for(const p of l.symbolStatePatches)p();if(d!==r.extentPadding&&this._recomputeExtentPadding(),null!=e)for(const p of l.graphics3DGraphicPatches)p(e,h);this._updateSymbolMapping(s.id,a)}_graphicUpdateVisibleHandler(e){this._updateUserVisibility(e)&&(this._labeler?.setDirty(),this._deconflictor?.setDirty())}recreateGraphics(e){this._suspendSymbolCleanup=!0,this.remove(e),this.add(e),this._suspendSymbolCleanup=!1,1===this.effectiveUpdatePolicy&&this._cleanupSymbols()}_recreateGraphic(e){this.recreateGraphics([e])}_beginGraphicUpdate(e){const t=this._graphicsUpdateId;return this._graphicsUpdateId++,this._graphicsWaitingForSymbol.set(e.uid,t),1===this._graphicsWaitingForSymbol.size&&this.notifyChange("dataUpdating"),t}_endGraphicUpdate(e,t){e&&(t&&this._graphicStateTracking?.updateGraphicError(e,t),this._graphicsWaitingForSymbol.delete(e.uid),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("dataUpdating")))}_recomputeExtentPadding(){let e=0;this._symbols.forEach(t=>{null!=t&&(e=Math.max(e,t.extentPadding))}),this._set("extentPadding",e)}_expandComputedExtent(e){const t=Me,i=e.spatialReference;q(e,t);const r=this._viewSpatialReference,s=Fe.tmpVec;if(z(i,r)||A(t[0],t[1],0,i,s,r)&&(t[0]=s[0],t[1]=s[1],A(t[3],t[4],0,i,s,r),t[3]=s[0],t[4]=s[1]),!(isFinite(t[0])&&isFinite(t[3])&&isFinite(t[1])&&isFinite(t[4])))return;const a=this.computedExtent;let n=null;const o=isFinite(t[2])&&isFinite(t[5]),l=o&&(null==a?.zmin||t[2]<a.zmin),h=o&&(null==a?.zmax||t[5]>a.zmax);if(a){(t[0]<a.xmin||t[1]<a.ymin||t[3]>a.xmax||t[4]>a.ymax||l||h)&&(n=this._propertiesPool.get("computedExtent"),n.xmin=Math.min(t[0],a.xmin),n.ymin=Math.min(t[1],a.ymin),n.xmax=Math.max(t[3],a.xmax),n.ymax=Math.max(t[4],a.ymax),n.spatialReference=r)}else n=this._propertiesPool.get("computedExtent"),n.xmin=t[0],n.ymin=t[1],n.xmax=t[3],n.ymax=t[4],n.spatialReference=r;n&&(l&&(n.zmin=t[2]),h&&(n.zmax=t[5]),this._set("computedExtent",n))}_abortElevationInfoChange(){this._elevationInfoChangeAbortController&&(this._elevationInfoChangeAbortController.abort(),this._elevationInfoChangeAbortController=null)}async elevationInfoChange(){this._abortElevationInfoChange();const e=new AbortController;this._elevationInfoChangeAbortController=e;const t=he(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);this.symbolCreationContext.featureExpressionInfoContext=await de(t,this._viewSpatialReference,e.signal,s.getLogger(this)),p(e.signal),this._elevationInfoChangeAbortController=null,this._labeler?.elevationInfoChange(),this.forEachGraphics3DSymbol((e,t,i)=>{e.globalPropertyChanged("elevationInfo",t)?t?.forEach(e=>{const t=e.graphic,i=e.labelLayers;for(const r of i){r.graphics3DSymbolLayer.graphics3DGraphicLayerElevationInfoChanged(t,r)}}):this._recreateSymbol(i)}),this.updateStageLayerElevationProvider(),this._elevationAlignment?.elevationInfoChange()}updateStageLayerElevationProvider(){this._stageLayerElevationProvider?"relative-to-scene"!==this.layer.elevationInfo?.mode&&0!==this._numberOfGraphicsProvidingElevation||(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),this._stageLayerElevationProvider=l(this._stageLayerElevationProvider)):(!this.layer.elevationInfo||this.layer.elevationInfo&&"relative-to-scene"!==this.layer.elevationInfo.mode)&&this._numberOfGraphicsProvidingElevation>0&&(this._stageLayerElevationProvider=new Ce({layer:this.layer,stageLayer:this.stageLayer,view:this.owner.view}),this.owner.view.elevationProvider.register(2,this._stageLayerElevationProvider))}_clearSymbolsAndGraphics(){this.clear(),null!=this._filterVisibility&&this._filterVisibility.clear(),this._labeler?.reset(),this._deconflictor?.clear(),this._elevationAlignment?.clear(),this.stageLayer?.invalidateSpatialQueryAccelerator(),this._stageLayerElevationProvider&&(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),this._stageLayerElevationProvider=l(this._stageLayerElevationProvider))}startCreateGraphics(){this._startCreateGraphics=!0,this.recreateAllGraphics()}recreateAllGraphics(){this._recreateAllGraphics(!1)}recreateAllGraphicsAndSymbols(){this._recreateAllGraphics(!0)}_recreateAllGraphics(e=!1){if(!this._startCreateGraphics)return;const{loadedGraphics:t,view:i}=this.owner,r=i.basemapTerrain?.tilingScheme&&t?.length?t.toArray():null;!e&&r||this._clearSymbolsAndGraphics(),this.symbolCreationContext.screenSizePerspectiveEnabled=we(this.layer.screenSizePerspectiveEnabled),this.symbolCreationContext.slicePlaneEnabled=!!this.owner.slicePlaneEnabled,this._set("computedExtent",null),r&&(e?this.add(r):this.recreateGraphics(r))}_recreateSymbol(e){const t=this._graphicsBySymbol.get(e),i=[];t&&(t.forEach((e,t)=>{const r=e.usedMemory;this._conditionalRemove(e,t),this._spatialIndex?.remove(e),i.push(e.graphic),e.destroy(),this._removeGraphics3DGraphic(t,r),this._updateLayerVisibility(),this._featureStore.events.emit("changed"),this.owner.notifyContentGeometryUpdate?.()}),this._graphicsBySymbol.set(e,new Map));const r=this._symbols.get(e);l(r),this._symbols.delete(e),this._symbolMaterials=null,l(this._unusedSymbolsCache.pop(e)),this.add(i)}_recreateGraphicsForSymbol(e){const t=this._graphicsBySymbol.get(e);if(t){const e=[];t.forEach(t=>e.push(t.graphic)),this.recreateGraphics(e)}}_conditionalRemove(e,t){this._graphicsDrapedUids.delete(t),this._objectStates?.removeGraphic(e),this._labeler?.removeGraphic(e),this._deconflictor?.removeGraphic(e),null!=this._graphicStateTracking&&this._graphicStateTracking.removeGraphic(e)}add(e){e&&0!==e.length&&(this.owner.view.basemapTerrain?.tilingScheme?(0===this._updatePolicyForGraphics(e)?this._addDelayed(e):this._addImmediate(e),this.notifyChange("dataUpdating")):s.getLogger(this).error("#add()","Cannot add graphics before terrain surface has been initialized"))}_updatePolicyForGraphics(e){if(1===this.effectiveUpdatePolicy&&("mesh"===this.layer.geometryType||null==this.layer.geometryType))for(const t of e)if(null!=t.geometry&&"mesh"===t.geometry.type&&!t.geometry.loaded)return 0;return this.effectiveUpdatePolicy}_addImmediate(e){this._geometryWarningLogged=!1,this._symbolWarningLogged=!1;for(const t of e)this._addGraphic(t,this._getRenderingInfo(t),1);this._cleanupSymbols(),this._labeler?.setDirty(),this._deconflictor?.setDirty()}_addDelayed(e){for(const t of e){const e=t.uid;let i=this._pendingUpdates.get(e);i?i.add?0!==i.state&&i.abortController?.abort():this._pendingAdds++:(i=new ze,this._pendingAdds++,this._pendingUpdates.set(e,i)),i.add=t}this.notifyChange("readyToRun"),this.notifyChange("updatingRemaining"),this.notifyChange("dataUpdating")}remove(e){0===this.effectiveUpdatePolicy?this._removeDelayed(e):this._removeImmediate(e),this.notifyChange("dataUpdating")}_removeImmediate(e){for(const t of e)this._removeGraphic(t);this._cleanupSymbols(),this._labeler?.setDirty(),this._deconflictor?.setDirty()}_removeDelayed(e){for(const t of e){const e=t.uid,i=this._pendingUpdates.get(e);if(i)i.add&&(i.remove?i.add=null:this._pendingUpdates.delete(e),1===i.state&&i.abortController?.abort(),this._pendingAdds--);else{const i=new ze;i.remove=t,this._pendingUpdates.set(e,i),this._pendingRemoves++,this._applyPendingRemovesFirst=!0}}0===this._pendingUpdates.size&&this._finishPendingUpdates(),this.notifyChange("readyToRun"),this.notifyChange("updatingRemaining"),this.notifyChange("dataUpdating")}_finishPendingUpdates(){this._cleanupSymbols(),(this._pendingAdds||this._pendingRemoves)&&s.getLogger(this).warn("pendingAdds/Removes in inconsistent state!"),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1}_applyFocusAreasUpdates(e){for(;this._focusAreasGraphicsQueue.length>0&&!e.done;){e.madeProgress();const t=this._focusAreasGraphicsQueue.pop(),i=fe(t.graphic.geometry);if(null==i)continue;const r=this.stage.view.focusAreasView?.containsGeometry(i)??!0;t.layers.forEach(e=>{if(e.stageObject){e.stageObject.geometries.some(e=>e.material instanceof Re&&e.material.parameters.isFocused!==r)&&this.recreateGraphics([t.graphic])}})}0===this._focusAreasGraphicsQueue.length&&this.notifyChange("readyToRun")}_applyPendingUpdates(e){if(this._geometryWarningLogged=!1,this._symbolWarningLogged=!1,0===this._pendingUpdates.size&&this._spatialIndex?.updating)return this._spatialIndex.update(),void e.madeProgress();if(this._applyPendingRemovesFirst){this._applyPendingRemovesFirst=!1;for(const[t,i]of this._pendingUpdates){if(e.done){this._applyPendingRemovesFirst=!0;break}if(i.remove&&!i.add&&(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(i.remove),i.remove=null,this._pendingUpdates.delete(t),0===this._pendingRemoves))break}}for(const[t,i]of this._pendingUpdates){if(e.done)break;i.add&&0===i.state&&this._processPendingUpdateNew(i);let r=this.effectiveUpdatePolicy;if(!i.remove||i.add&&2!==i.state||(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(i.remove),i.remove=null,r=1),i.add)switch(i.state){case 2:this._addGraphic(i.add,i.renderingInfo,r),i.add=null,this._pendingAdds--,e.madeProgress();break;case 3:i.add=null,this._pendingAdds--}null==i.remove&&null==i.add&&this._pendingUpdates.delete(t)}0===this._pendingUpdates.size&&(this._finishPendingUpdates(),this.notifyChange("readyToRun"),this.notifyChange("dataUpdating"))}_processPendingUpdateNew(e){if(!e.add)return void(e.state=2);const t=e.add.geometry;null==t||"mesh"!==t.type||t.loaded?this._processPendingUpdateNewRenderingInfo(e):this._processPendingUpdateNewMesh(e,t)}async _processPendingUpdateNewMesh(e,t){e.state=1,e.abortController=new AbortController;const i=e.abortController.signal;try{await t.load({signal:i})}catch(r){return this._processPendingUpdateNewError(e,r)}e.abortController=null,this._processPendingUpdateNewRenderingInfo(e)}_processPendingUpdateNewError(e,t){e.abortController=null,u(t)?e.state=0:e.state=3}async _processPendingUpdateNewRenderingInfo(e){if(null==this.layer.renderer||"dictionary"!==this.layer.renderer.type)return e.renderingInfo=this._getRenderingInfo(e.add),void(e.state=2);e.state=1,e.abortController=new AbortController;let t=null;try{t=await this._getRenderingInfoAsync(e.add,{signal:e.abortController.signal})}catch(i){return e.abortController=null,void(u(i)?e.state=0:e.state=3)}null==t?.symbol?(this._symbolWarningLogged||(this._symbolWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),e.renderingInfo=null):e.renderingInfo=t,e.state=2}_addGraphic(e,t,i){if(this._graphicsWithoutSymbol.set(e.uid,e),null==t?.symbol||!Q(e))return;const r=this.stage.renderView.olidRenderHelper;if(r&&this.setUidToIdOnAdd){const t=J(this.owner.view,this.owner.layerViewUid);r.setUidToObjectAndLayerId(e.objectId,e.uid,this.layer.id,this.owner.layerViewUid,W(this.layer)&&!!this.layer.popupEnabled&&!t&&Ue(this.layer,this.owner.view.popup?.defaultPopupTemplateEnabled))}const s=t.symbol,a=this.getOrCreateGraphics3DSymbol(s,t.renderer);if(null==a)return;this._expandComputedExtent(e.geometry);const n=this._beginGraphicUpdate(e),o=new ce(e,t,this.layer);let l=!1;const h=e=>{e===a.symbol.id&&(l=!0)};this._whenSymbolRemoved.push(h);const d=()=>{if(--this._loadingSymbols,this.destroyed)return;this._whenSymbolRemoved.removeUnordered(h);if(this._graphicsWaitingForSymbol.get(e.uid)!==n||l||a.destroyed||this.graphicSymbolSupported&&e.symbol&&e.symbol.id!==a.symbol.id)--a.referenced,this._cleanupSymbols();else{const t=this._createGraphics3DGraphic(a,o);this._spatialIndex&&null!=t&&this._spatialIndex.add(t),--a.referenced,this._endGraphicUpdate(e)}this._featureStore.events.emit("changed"),this.owner.notifyContentGeometryUpdate?.(),this._labeler?.setDirty()},p=t=>{--this._loadingSymbols,this.destroyed||(this._whenSymbolRemoved.removeUnordered(h),l||(u(t)?this.add([e]):a.destroyed||this._endGraphicUpdate(e,t)))};++this._loadingSymbols,0===i?a.load(()=>this._dataUpdateQueue.push(d,null).catch(c),e=>this._dataUpdateQueue.push(()=>p(e),null).catch(c)):a.load(d,p)}_removeGraphic(e){const t=e.uid,i=this.graphics3DGraphics.get(t);if(i){i.graphics3DSymbol.onRemoveGraphic(i);const e=i.usedMemory,r=i.isElevationSource;this._conditionalRemove(i,t),this._spatialIndex?.remove(i);const s=i.graphics3DSymbol.symbol.id;this._graphicsBySymbol.get(s)?.delete(t),this._graphicsWithoutSymbol.delete(t),this._removeGraphics3DGraphic(t,e,r),i.destroy(),this._featureStore.events.emit("changed"),this.owner.notifyContentGeometryUpdate?.()}else this._graphicsWithoutSymbol.delete(t),this._graphicsWaitingForSymbol.delete(t),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("dataUpdating"))}_hasLabelingContext(e){if(e instanceof ee||e instanceof te){const t=this.symbolCreationContext.layer;return!!t.labelingInfo&&t.labelingInfo.some(t=>t.symbol===e)}return!1}_hasValidSymbolCreationContext(e){return!(e instanceof ee&&!this._hasLabelingContext(e))||(s.getLogger(this).error("LabelSymbol3D is only valid as part of a LabelClass. Using LabelSymbol3D as a renderer symbol is not supported."),!1)}_getRenderingInfo(e,t=!0){const i=e.geometry;if(null==i)return t&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!L(i.spatialReference,this._viewSpatialReference))return t&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} has incompatible spatial reference and will not render`)),null;if(!this.graphicSymbolSupported&&null!=e.symbol)return t&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const r=this.rendererHasGeometryOperations?N(e,this.layer,null):e;let a;if(this.owner.getRenderingInfo&&(this.getRenderingInfoWithoutRenderer||null!=this.currentRenderer))a=this.owner.getRenderingInfo(r,this.currentRenderer,this._arcadeOnDemand);else{const e=r.symbol||re(r.geometry);a=new X(null,e)}return null==a?.symbol?(t&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),null):a}_getRenderingInfoAsync(e,t){if(null==e.geometry)return this._geometryWarningLogged||(this._geometryWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!this.graphicSymbolSupported&&null!=e.symbol)return this._symbolWarningLogged||(this._symbolWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const i=this.rendererHasGeometryOperations?N(e,this.layer,null):e;return this.owner.getRenderingInfoAsync(i,this.currentRenderer,this._arcadeOnDemand,t)}_createGraphics3DSymbol(e,t){if(!this._hasValidSymbolCreationContext(e))return null;const i=this._getConvertedSymbol(e);if(!i)return null;let r;if(null!=t&&"backgroundFillSymbol"in t&&t.backgroundFillSymbol){const e=se(t.backgroundFillSymbol,{ignoreDrivers:!0});null!=e.symbol&&(r=e.symbol.symbolLayers)}const s=ue(i,this.symbolCreationContext,r);return s.load(()=>{const e=s.extentPadding;e>this.extentPadding&&this._set("extentPadding",e),this.notifyChange("averageSymbolComplexity")},()=>{}),s}getOrCreateGraphics3DSymbol(e,t){let i=this._symbols.get(e.id);if(void 0===i){const r=this._unusedSymbolsCache.pop(e.id);i=null!=r?r:e instanceof ie?new ge(e,e=>this._dataUpdateQueue.push(e,null),e=>this._createGraphics3DSymbol(e,t)):this._createGraphics3DSymbol(e,t),this._symbols.set(e.id,i),this._symbolMaterials=null}return null!=i&&++i.referenced,i}trackGraphicState(e){return null==this._graphicStateTracking&&(this._graphicStateTracking=new be(this)),this._graphicStateTracking.add(e)}_addGraphics3DGraphic(e){this._usedMemory+=e.usedMemory,this.graphics3DGraphics.set(e.graphic.uid,e),this._numberOfGraphics++,e.isElevationSource&&(this._numberOfGraphicsProvidingElevation++,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_removeGraphics3DGraphic(e,t,i=!1){this._usedMemory-=t,this.graphics3DGraphics.delete(e),this._numberOfGraphics--,i&&(this._numberOfGraphicsProvidingElevation--,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_createGraphics3DGraphic(e,t){const{graphic:i}=t;if(this._graphicsWithoutSymbol.delete(i.uid),!this._symbols.has(e.symbol.id))return this.add([i]),null;if(this.graphics3DGraphics.has(i.uid))return null;const r=e.createGraphics3DGraphic(t);if(null==r)return null;this._addGraphics3DGraphic(r);const s=e.symbol.id;this._graphicsBySymbol.has(s)||this._graphicsBySymbol.set(s,new Map),this._graphicsBySymbol.get(s).set(i.uid,r);if(r.isDraped&&this._graphicsDrapedUids.add(i.uid),r.centroid=null,null!=i.geometry&&"point"!==i.geometry.type&&(r.centroid=_e(i.geometry,this._viewSpatialReference)),this._updateUserVisibility(r),null!=this._scaleVisibility&&this._scaleVisibility.updateVisibility(r),null!=this._filterVisibility){const{defaultVisibility:e}=this._filterVisibility;r.setVisibilityFlag(1,4,e),e||this._filterVisibility.reapply()}this._deconflictor?.addGraphic(r),this._labeler?.addGraphic(r),this._objectStates?.addGraphic(r),r.initialize(this.stageLayer),null!=this._graphicStateTracking&&this._graphicStateTracking.addGraphic(r);const a=this._whenGraphics3DGraphicRequests[i.uid];return a&&(delete this._whenGraphics3DGraphicRequests[i.uid],a.resolve(r)),this._symbolMaterials=null,r}async rendererChange(e){if(this._rendererChangeAbortController=n(this._rendererChangeAbortController),e!==this.currentRenderer)if(this._validateRenderer(e),null==e&&this._currentRendererChange(null,!1),Z(e))if(e?.arcadeRequired){const t=new AbortController;this._rendererChangeAbortController=t;const{arcadeUtils:i}=await this._ensureArcade();p(t);const r=i.hasGeometryOperations(e);r&&(await i.enableGeometryOperations(),p(t)),0===this.effectiveUpdatePolicy?await this._updateQueue.push(()=>this._currentRendererChange(e,r),t.signal):this._currentRendererChange(e,r),this._rendererChangeAbortController=null}else if(0===this.effectiveUpdatePolicy){const t=new AbortController;this._rendererChangeAbortController=t,await this._updateQueue.push(()=>this._currentRendererChange(e,!1),t.signal),this._rendererChangeAbortController=null}else this._currentRendererChange(e,!1);else this._currentRendererChange(e,!1)}async _ensureArcade(){return null==this._arcadeOnDemand?(this._arcadeOnDemand=await K(),this._arcadeOnDemand):this._arcadeOnDemand}_currentRendererChange(e,t){this.currentRenderer=e,this.rendererHasGeometryOperations=t,this.symbolCreationContext.arcade=this._arcadeOnDemand;const i=this.symbolCreationContext.renderer;if(e===i)return;if(this._symbolConversionCache.clear(),this._unusedSymbolsCache.clear(),null==e)return this.symbolCreationContext.renderer=null,void this.recreateAllGraphicsAndSymbols();const r=w(i,e);this._updateUnchangedSymbolMappings(r,e,i),this.symbolCreationContext.renderer=e,null!=r&&("complete"===r.type?this.recreateAllGraphicsAndSymbols():"partial"===r.type&&(this._applyRendererDiff(r,e,i)?this._labeler?.reset():this.recreateAllGraphicsAndSymbols()),this.notifyChange("averageSymbolComplexity"))}_diffHasSymbolChange(e){for(const t in e.diff)switch(t){case"visualVariables":case"defaultSymbol":case"uniqueValueInfos":break;case"uniqueValueGroups":case"authoringInfo":case"fieldDelimiter":delete e.diff[t];break;default:return!0}return!1}_applySymbolSetDiff(e,t,i){e=e||[],t=t||[];const r=[];for(const s of t){const t=this._graphicsBySymbol.get(s.id);t&&t.forEach((a,n)=>{const o=a.graphic,l=this.layer instanceof H?this.layer:null,h=this._arcadeOnDemand;if(s===i.defaultSymbol&&i.getSymbol(N(o,l,null),{arcade:h})===i.defaultSymbol)return;const d=a.usedMemory;e.length||i.defaultSymbol?r.push(o):this._graphicsWithoutSymbol.set(n,o);const p=this.graphics3DGraphics.get(n);this._conditionalRemove(p,n),a.destroy(),t.delete(n),this._removeGraphics3DGraphic(n,d),this._updateLayerVisibility()}),this._whenSymbolRemoved.forAll(e=>e(s.id))}(e.length||r.length)&&(this._graphicsWithoutSymbol.forEach(e=>r.push(e)),this._graphicsWithoutSymbol.clear(),this.add(r)),this._cleanupSymbols(),this._labeler?.setDirty(),this._deconflictor?.setDirty()}_applyUniqueValueRendererDiff(e,t,r){const s=e.diff.defaultSymbol,a=e.diff.uniqueValueInfos;if(s||a){const n=a?.changed,o=a?.unchanged;if(n&&o&&n.some(e=>o.some(t=>t.oldValue.symbol?.id===e.oldValue.symbol?.id)))return!1;const l=a?a.added.map(e=>e.symbol).filter(i):[],h=a?a.removed.map(e=>e.symbol).filter(i):[];if(n)for(let e=0;e<n.length;e++)l.push(n[e].newValue.symbol),h.push(n[e].oldValue.symbol);return s?(r.defaultSymbol&&h.push(r.defaultSymbol),t.defaultSymbol&&l.push(t.defaultSymbol)):r.defaultSymbol&&l.length&&h.push(t.defaultSymbol),this._applySymbolSetDiff(l,h,t),delete e.diff.defaultSymbol,delete e.diff.uniqueValueInfos,!0}return!1}_calculateUnchangedSymbolMapping(e,t,i){if("unique-value"!==t?.type||"unique-value"!==i?.type||null!=e&&"partial"!==e.type)return[];const r=e=>null!=e?e.id:null,s=e&&e.diff,a=s?.defaultSymbol,n=s&&s.uniqueValueInfos;let o;if(n)o=n.unchanged.map(e=>({oldId:r(e.oldValue.symbol),newId:r(e.newValue.symbol)}));else{o=[];for(const e of i.uniqueValueInfos??[]){const i=r(e.symbol),s=t.uniqueValueInfos?.find(t=>t.value===e.value);s&&i!==r(s.symbol)&&o.push({oldId:i,newId:r(s.symbol)})}}return!a&&i.defaultSymbol&&o.push({oldId:r(i.defaultSymbol),newId:r(t.defaultSymbol)}),o}_updateSymbolMapping(e,t){const i=null!=t&&t?"string"==typeof t?t:t.id:null;if(null==e||e===i)return;const r=this._graphicsBySymbol.get(e);this._graphicsBySymbol.delete(e),void 0!==r&&this._graphicsBySymbol.set(i,r);const s=this._symbols.get(e);if(void 0!==s&&(this._symbols.delete(e),this._symbols.set(i,s),this._symbolMaterials=null,null!=s)){const e="string"==typeof t?null:t;null!=e?s.symbol=e:s.symbol.id=i}}_updateUnchangedSymbolMappings(e,t,i){const r=this._calculateUnchangedSymbolMapping(e,t,i);for(const{oldId:s,newId:a}of r)this._updateSymbolMapping(s,a)}_applyRendererDiff(e,t,i){if(this._diffHasSymbolChange(e))return!1;if(t instanceof $&&i instanceof $&&this._applyUniqueValueRendererDiff(e,t,i)&&0===Object.keys(e.diff).length)return!0;for(const r of this._graphicsBySymbol.keys()){const i=this._symbols.get(r);if(null!=i)switch(i.applyRendererDiff(e,t)){case 0:this._recreateSymbol(r);break;case 1:this._recreateGraphicsForSymbol(r)}}return!0}terrainTransparencyChange(){this.forEachGraphics3DSymbol((e,t,i)=>{e.globalPropertyChanged("terrainTransparency",t)||this._recreateSymbol(i)}),this.labeler?.reset()}opacityChange(){this._updateStageLayerVisibility(),this.forEachGraphics3DSymbol((e,t)=>e.globalPropertyChanged("opacity",t))}_screenSizePerspectiveEnabledChange(){this.forEachGraphics3DSymbol((e,t)=>e.globalPropertyChanged("screenSizePerspectiveEnabled",t)),this._labeler?.screenSizePerspectiveEnabledChanged(),this._deconflictor?.screenSizePerspectiveEnabledChanged()}_slicePlaneEnabledChange(e){e!==this.symbolCreationContext.slicePlaneEnabled&&(this.symbolCreationContext.slicePlaneEnabled=e,this.stageLayer.sliceable=e,this.forEachGraphics3DSymbol((e,t)=>e.globalPropertyChanged("slicePlaneEnabled",t)),this._deconflictor?.slicePlaneEnabledChange(),this._labeler?.slicePlaneEnabledChange())}_physicalBasedRenderingChange(e){this.symbolCreationContext.physicalBasedRenderingEnabled=e,this.forEachGraphics3DSymbol((e,t,i)=>{e.globalPropertyChanged("physicalBasedRenderingEnabled",t)||this._recreateSymbol(i)})}_skipHighSymbolLoDsChange(e){this.symbolCreationContext.skipHighSymbolLods=e,this.forEachGraphics3DSymbol((e,t,i)=>{e.globalPropertyChanged("skipHighSymbolLods",t)||this._recreateSymbol(i)})}_pixelRatioChange(){this.forEachGraphics3DSymbol((e,t,i)=>{e.globalPropertyChanged("pixelRatio",t)||this._recreateSymbol(i)})}_signalUpdatingDuringAsyncLoadedGraphicsChange(){this._updatingPendingLoadedGraphicsChange&&this._updatingPendingLoadedGraphicsChange.remove(),this._updatingPendingLoadedGraphicsChange=C(()=>{this._updatingPendingLoadedGraphicsChange=null})}setClippingExtent(e,t){const i=this.symbolCreationContext.clippingExtent,r=k();return Se(e,r,t)?this.symbolCreationContext.clippingExtent=T(F(),r):this.symbolCreationContext.clippingExtent=null,!M(this.symbolCreationContext.clippingExtent,i)}modifyGraphics3DGraphicVisibilities(e){if(this.destroyed)return;let t=!1;this.graphics3DGraphics.forEach(i=>{e(i)&&(t=!0)}),t&&(this._labeler?.setDirty(),this._deconflictor?.setDirty())}forEachGraphics3DSymbol(e,t){for(const[i,r]of this._symbols){if(null==r)return;e(r,this._graphicsBySymbol.get(i)||qe,i)}if(!t?.excludeUnused)for(const i of this._unusedSymbolsCache)e(i,void 0,i.symbol.id)}updateGraphicsVisibilities(){null!=this._filterVisibility&&this._filterVisibility.reapply(),this.modifyGraphics3DGraphicVisibilities(e=>{const t=this._updateUserVisibility(e),i=!!this._scaleVisibility?.updateVisibility(e);return t||i})}_hideAllGraphics(){this.modifyGraphics3DGraphicVisibilities(e=>e.setVisibilityFlag(1,1,!1))}_validateRenderer(e){const t=()=>`'${this.layer.title?`${this.layer.title}, `:""}id:${this.layer.id}'`,i=Y(e,{geometryType:this.layer?.geometryType,logWarning:(e,i)=>s.getLogger(this).warn(e,`Symbology conversion for layer ${t()}: ${i}`)});if(i){const e=`Renderer for layer ${t} is not supported in a SceneView`;s.getLogger(this).warn(e,i.message)}}_cleanupSymbols(){if(this._graphicsWaitingForSymbol.size>0||this._suspendSymbolCleanup)return;let e=!1;this._symbols.forEach((t,i)=>{if(null==t||t.referenced>0)return;const r=this._graphicsBySymbol.get(i);r&&0!==r.size||(this._graphicsBySymbol.delete(i),this._symbols.delete(i),this._symbolMaterials=null,this._unusedSymbolsCache.put(i,t,h),e=!0)}),e&&(this._recomputeExtentPadding(),this.notifyChange("averageSymbolComplexity"))}get test(){}get performanceInfo(){return new me(this.graphics3DGraphics.size,Array.from(this.graphics3DGraphics.values()).reduce((e,t)=>e+(t.isVisible()?1:0),0),this._graphicsWithoutSymbol.size,this._pendingUpdates.size)}};e([S({readOnly:!0})],ke.prototype,"computedExtent",void 0),e([S()],ke.prototype,"currentRenderer",void 0),e([S()],ke.prototype,"rendererHasGeometryOperations",void 0),e([S()],ke.prototype,"_frameTaskHandle",void 0),e([S()],ke.prototype,"_dataUpdateQueue",void 0),e([S()],ke.prototype,"_updateQueue",void 0),e([S({readOnly:!0})],ke.prototype,"_viewSpatialReference",null),e([S()],ke.prototype,"_rendererChangeAbortController",void 0),e([S()],ke.prototype,"_elevationInfoChangeAbortController",void 0),e([S()],ke.prototype,"_initializeAbortController",void 0),e([S()],ke.prototype,"_elevationAlignment",void 0),e([S()],ke.prototype,"_scaleVisibility",void 0),e([S()],ke.prototype,"_filterVisibility",void 0),e([S()],ke.prototype,"_initializePromise",void 0),e([S()],ke.prototype,"_spatialIndex",void 0),e([S({readOnly:!0})],ke.prototype,"extentPadding",void 0),e([S()],ke.prototype,"_updatingPendingLoadedGraphicsChange",void 0),e([S()],ke.prototype,"_featureStore",void 0),e([S()],ke.prototype,"_objectStates",void 0),e([S()],ke.prototype,"_loadingSymbols",void 0),e([S({constructOnly:!0})],ke.prototype,"compressionTracker",void 0),e([S()],ke.prototype,"preferredUpdatePolicy",void 0),e([S()],ke.prototype,"_forcedUpdatePolicy",void 0),e([S({readOnly:!0})],ke.prototype,"effectiveUpdatePolicy",null),e([S({constructOnly:!0})],ke.prototype,"elevationFeatureExpressionEnabled",void 0),e([S({constructOnly:!0})],ke.prototype,"owner",void 0),e([S({constructOnly:!0})],ke.prototype,"layer",void 0),e([S({constructOnly:!0})],ke.prototype,"graphicSymbolSupported",void 0),e([S({constructOnly:!0})],ke.prototype,"getRenderingInfoWithoutRenderer",void 0),e([S({constructOnly:!0})],ke.prototype,"componentFactories",void 0),e([S({constructOnly:!0})],ke.prototype,"setUidToIdOnAdd",void 0),e([S()],ke.prototype,"featureStore",null),e([S()],ke.prototype,"initializePromise",null),e([S()],ke.prototype,"scaleVisibility",null),e([S()],ke.prototype,"elevationAlignment",null),e([S()],ke.prototype,"objectStates",null),e([S()],ke.prototype,"filterVisibility",null),e([S({readOnly:!0})],ke.prototype,"updating",null),e([S({readOnly:!0})],ke.prototype,"dataUpdating",null),e([S({readOnly:!0})],ke.prototype,"readyToRun",null),e([S({readOnly:!0})],ke.prototype,"suspendedOrOutsideOfView",null),e([S({readOnly:!0,dependsOn:[]})],ke.prototype,"updatingRemaining",null),e([S({readOnly:!0})],ke.prototype,"displayFeatureLimit",null),e([S({readOnly:!0,dependsOn:[]})],ke.prototype,"averageSymbolComplexity",null),e([S({constructOnly:!0})],ke.prototype,"hasZ",void 0),e([S({constructOnly:!0})],ke.prototype,"hasM",void 0),e([S()],ke.prototype,"_objectIdField",null),ke=Fe=e([G("esri.views.3d.layers.graphics.Graphics3DCore")],ke);class ze{constructor(){this.add=null,this.renderingInfo=null,this.state=0,this.abortController=null,this.remove=null}clear(){this.add=null,this.renderingInfo=null,this.state=0,this.abortController=null,this.remove=null}}const We=10,He=D(),Be=D(),qe=new Map;export{ke as Graphics3DCore};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../core/has.js";import{clone as t}from"../../../../core/lang.js";import{getMetersPerVerticalUnitForSR as e}from"../../../../core/units.js";import{e as r}from"../../../../chunks/earcut.js";import{normalFromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as n,invertOrIdentity as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{h as l,a as c,f as p,i as m,n as h,p as u,d,e as g}from"../../../../chunks/vec32.js";import{ONES as f,create as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{computeTranslationToOriginAndRotation as b}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as _,fromBuffer as x,intersectsClippingArea as j}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as S}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as w,getZeroIndexArray as P}from"../../../../geometry/support/Indices.js";import{t as v}from"../../../../chunks/vec3.js";import{SnappingCandidateVertex as C,SnappingCandidateEdge as E}from"../../../../layers/graphics/data/SnappingCandidate.js";import{getDriverAxisSizeValue as A}from"../../../../renderers/support/renderingInfoUtils.js";import{needsElevationUpdates3D as D,SampleElevationInfo as I}from"./elevationAlignmentUtils.js";import{Object3DEdgeState as L,Graphics3DObject3DGraphicLayer as U}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as z}from"./Graphics3DSymbolLayer.js";import{computeCentroid as O}from"./graphicUtils.js";import{geometryAsPolygon as M}from"./polygonUtils.js";import{createMaterial as G}from"../support/edgeUtils.js";import{encodeNaNUInt8 as V}from"../support/symbolColorUtils.js";import{debugFlags as T}from"../../support/debugFlags.js";import{SamplePosition as B}from"../../support/ElevationProvider.js";import{polygonToRenderInfo as F}from"../../support/renderInfoUtils/polygon.js";import{Attribute as R}from"../../webgl-engine/lib/Attribute.js";import{Geometry as H}from"../../webgl-engine/lib/Geometry.js";import{isGeometryWithMapPositions as k}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{compressNormals as N,compressNormal as W}from"../../webgl-engine/lib/Normals.js";import{Object3D as q}from"../../webgl-engine/lib/Object3D.js";import{DefaultMaterial as Z}from"../../webgl-engine/materials/DefaultMaterial.js";const J=["polygon","extent"];class K extends z{constructor(t,e,r,s){super(t,e,r,s,mt(e)),this.ensureDrapedStatus(!1)}async doLoad(){const t=this.symbolLayer,e=t?.material,r=this.symbolLayer.material?.color?.a,s=this.needsDrivenTransparentPass||null!=r&&1!==r,o=e?.emissive,n=!this._hasDrivenColorOrOpacity&&(null==r||0===r),i={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,ambient:f,diffuse:f,opacity:n?0:1,layerOpacity:this._getLayerOpacity(),drivenOpacity:s,hasSymbolColors:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:t.castShadows,emissiveStrengthFromSymbol:o?.strength??0,emissiveSource:1,offsetTransparentBackfaces:!0,normalType:1},a=new Z(i,this._context),l=new Z({...i,cullFace:2},this._context);this._materials[0]=a,this._materials[1]=l,this._updateTransparentDepedentMaterialParameters()}destroy(){super.destroy(),this._materials.length=0}createGraphics3DGraphic(t){const e=t.graphic;if(!this._validateGeometry(e.geometry,J,this.symbolLayer.type))return null;const r=this._getDrivenUInt8ColorWithNaNSupport(t.renderingInfo,this._materialColor,!1);V(r,r);const s=this.createElevationContextForGraphic(e);return this._createAs3DShape(e,t.renderingInfo,r,s,e.uid)}layerOpacityChanged(t,e){const r=this._getLayerOpacity();this._materials[0]?.setParameters({layerOpacity:r}),this._materials[1]?.setParameters({layerOpacity:r}),this._updateTransparentDepedentMaterialParameters(),t?.forEach(t=>e(t)?.layerOpacityChanged(r,this._context.isAsync))}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(t,e){return this.updateGraphics3DGraphicElevationInfo(t,e,D)}slicePlaneEnabledChanged(t,e){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),t?.forEach(t=>{const r=e(t);null!=r&&r.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)}),!0}physicalBasedRenderingChanged(){const t={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0};return this._materials[0]?.setParameters(t),this._materials[1]?.setParameters(t),!0}_getExtrusionSize(t){let e;return e=t.size&&this._drivenProperties.size?A(t.size,2)??0:this._getSymbolSize(),e/=this._context.renderCoordsHelper.unitInMeters,e}applyRendererDiff(t,e){return this._drivenPropertiesChanged(e)?0:1}async queryForSnapping(r,s,o,n){const i=this._getExtrusionSize(o)*this._context.renderCoordsHelper.unitInMeters/e(s),{objectId:a,target:l}=r,c=t(l);switch(c.z=(c.z??0)+i,r.type){case"edge":{const{start:e,end:s}=r,o=t(e),n=t(s);return o.z=(o.z??0)+i,n.z=(n.z??0)+i,[new E(a,c,1/0,o,n)]}case"vertex":return[new C(a,c,1/0),new E(a,l,1/0,l,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(t,e,i,l,c){const p=M(t.geometry);if(null==p)return null;if(0===p.rings.length||!p.rings.some(t=>t.length>0))return this._logGeometryValidationWarnings(p.rings,"rings","ExtrudeSymbol3DLayer"),null;const m=F(p,this._context.elevationProvider,this._context.renderCoordsHelper,l);this._logGeometryCreationWarnings(m,p.rings,"rings","ExtrudeSymbol3DLayer");const h=O(p);if(null==h)return null;const u=new Array,d=new Array,g=_(),f=a(),P=y(),C=1===this._context.renderCoordsHelper.viewingMode;C||this._context.renderCoordsHelper.worldUpAtPosition(null,P),b(p.spatialReference,[h.x,h.y,0],f,this._context.renderCoordsHelper.spatialReference);const E=a();n(E,f);const A=o();s(A,E);const{polygons:I,mapPositions:z,position:V}=m,T=new Map,B=this._materials[0];for(const s of I){const t=s.count;if(this._context.clippingExtent&&(x(s.mapPositions,g),!j(g,this._context.clippingExtent)))continue;const o=r(s.mapPositions,s.holeIndices,3);if(0===o.length)continue;const n=o.length,a=6*t,l=w(a+n),p=w(n),m=S(3*a),h=S(3*a),y=S(3*a),b=S(a);X(V,z,o,s,m,y,h,b,l,p,this._getExtrusionSize(e),P,C),v(m,m,E);const _=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:c,layerViewUid:this._context.layerViewUid}),A=new jt(m,y,N(h),b),D=Q(B,l,l.length-p.length,A,i,_),I=t,L=t,U=2*s.count,O=new St(I,L,U,n/3);pt(D,O,f),T.set(D,O),u.push(D,Q(this._materials[1],p,0,A,i,_)),d.push(A.heights)}if(0===u.length)return null;const R=new q({geometries:u,layerViewUid:this._context.layerViewUid,graphicUid:c,isElevationSource:!0});R.transformation=f;const H=G(this.symbolLayer,{opacity:this._getLayerOpacity()}),k=H?new L(this._materials[0],H,this._context.slicePlaneEnabled):null,W=new U(this,R,null,(t,e,r,s,o)=>ct(t,e,r,s,o,d,T),l,k);return W.alignedSampledElevation=m.sampledElevation,W.needsElevationUpdates=D(l.mode),W}get _materialColor(){return this.symbolLayer.material?.color}_updateTransparentDepedentMaterialParameters(){const t=this._materials[0];t&&t.setParameters({cullFace:t.transparent?0:2})}}function Q(t,e,r,s,o,n){const i=P(e.length),a=[["position",new R(s.positions,e,3,!0)],["normalCompressed",new R(s.normals,e,2,!0)],["symbolColor",new R(o,i,4,!0)]];return new H(t,a,s.elevation,0,n,r)}function X(t,e,r,s,o,n,i,a,l,c,p,m,h){const u=r.length/3;let d=2*s.count;Y(t,e,s.index,s.count,r,0,u,o,n,i,a,l,c,d,p,m,h);let g=0,f=2*s.count;d=0;const y=s.pathLengths[0];et(o,n,a,i,g,y,s.count,f,l,d,p),f+=4*y,d+=2*y,g+=y;for(let b=1;b<s.pathLengths.length;++b){const t=s.pathLengths[b];et(o,n,a,i,g,t,s.count,f,l,d,p),f+=4*t,d+=2*t,g+=t}}function Y(t,e,r,s,o,n,i,a,l,c,p,m,u,g,f,y,b){d(ut,y),l??=[],c??=[],p??=[];const _=f>0?1:-1;let x=3*r,j=0,S=3*j,w=s,P=3*w;for(let d=0;d<s;++d){const r=t[x],s=t[x+1],o=t[x+2];b&&(ut[0]=r,ut[1]=s,ut[2]=o,h(ut,ut)),a[S+0]=r,a[S+1]=s,a[S+2]=o;const n=e[x+0],i=e[x+1],m=e[x+2];l[S+0]=n,l[S+1]=i,l[S+2]=m,c[S+0]=-_*ut[0],c[S+1]=-_*ut[1],c[S+2]=-_*ut[2],p[j]=0,a[P+0]=r+f*ut[0],a[P+1]=s+f*ut[1],a[P+2]=o+f*ut[2],l[P+0]=n,l[P+1]=i,l[P+2]=m,p[w]=f,S+=3,P+=3,x+=3,j+=1,w+=1}x=3*n,S=0,P=3*g;const v=f<0?ft:gt,C=f<0?gt:ft;for(let h=0;h<i;++h)u[S]=o[x+v[0]],u[S+1]=o[x+v[1]],u[S+2]=o[x+v[2]],m[P]=o[x+C[0]]+s,m[P+1]=o[x+C[1]]+s,m[P+2]=o[x+C[2]]+s,S+=3,P+=3,x+=3}function $(t,e,r,s,o,n,i){s[n]=s[i],i*=3,t[n*=3]=t[i],t[n+1]=t[i+1],t[n+2]=t[i+2],e[n]=e[i],e[n+1]=e[i+1],e[n+2]=e[i+2],r[n]=o[0],r[n+1]=o[1],r[n+2]=o[2]}const tt=y();function et(t,e,r,s,o,n,i,a,l,c,p){e??=[],r??=[],s??=[];let m=o,h=o+1,u=o+i,d=o+i+1,g=a,f=a+1,y=a+2*n,b=a+2*n+1;p<0&&(m=o+i+1,d=o);let _=3*c;for(let x=0;x<n;++x)x===n-1&&(h=o,p>0?d=o+i:m=o+i),at(t,m,h,u,tt),$(t,e,s,r,tt,g,m),$(t,e,s,r,tt,f,h),$(t,e,s,r,tt,y,u),$(t,e,s,r,tt,b,d),l[_]=g,l[_+1]=y,l[_+2]=b,l[_+3]=g,l[_+4]=b,l[_+5]=f,_+=6,m++,h++,u++,d++,g+=2,f+=2,y+=2,b+=2}const rt=y(),st=y(),ot=y(),nt=y(),it=y();function at(t,e,r,s,o){e*=3,r*=3,s*=3,l(rt,t[e++],t[e++],t[e++]),l(st,t[r++],t[r++],t[r++]),l(ot,t[s++],t[s++],t[s++]),g(nt,st,rt),g(it,ot,rt),p(o,it,nt),h(o,o)}const lt=y();function ct(t,e,r,s,o,n,c){const p=t.stageObject,m=p.geometries,h=m.length,d="absolute-height"!==e.mode;let g=0;const f=p.transformation,y=i(a(),f);for(let i=0;i<h;i+=2){const t=m[i];if(!k(t))continue;const e=t.getMutableAttribute("position").data,a=n[i/2],h=new B(t.mapPositions),b=e.length/3;let _=!1,x=0;{let t=0;for(let n=0;n<b;n++){lt[0]=e[t],lt[1]=e[t+1],lt[2]=e[t+2],s(h,dt),d&&(x+=dt.sampledElevation),T.TESTS_DISABLE_OPTIMIZATIONS?(l(ht,h.array[h.offset],h.array[h.offset+1],dt.z+a[t/3]),null!=r&&o.toRenderCoords(ht,r,ht),u(ht,ht,y)):(l(ht,e[t],e[t+1],e[t+2]),u(ht,ht,f),o.setAltitude(ht,dt.z+a[t/3]),u(ht,ht,y)),e[t]=ht[0],e[t+1]=ht[1],e[t+2]=ht[2];const n=yt/o.unitInMeters;(Math.abs(lt[0]-e[t])>=n||Math.abs(lt[1]-e[t+1])>=n||Math.abs(lt[2]-e[t+2])>=n)&&(_=!0),h.offset+=3,t+=3}}if(_){const e=c.get(t);e&&pt(t,e,f),p.geometryVertexAttributeUpdated(m[i],"normalCompressed"),t.invalidateBoundingInfo(),p.geometryVertexAttributeUpdated(m[i],"position"),m[i+1].invalidateBoundingInfo(),p.geometryVertexAttributeUpdated(m[i+1],"position")}g+=x/b}return g/h}function pt(t,e,r){const s=t.getMutableAttribute("position"),o=t.getMutableAttribute("normalCompressed").data,n=s.data,i=t.attributes.get("position").indices,{topVertexStart:a,topVertexCount:d,topFaceStart:g,topFaceCount:f}=e,y=g+f,b=a+d,_=bt,x=_t,j=xt,S=ut,w=ht;l(w,0,0,0);const P=(t,e)=>{const s=3*t;l(e,n[s+0],n[s+1],n[s+2]),u(e,e,r)};for(let l=g;l<y;++l){const t=3*l;P(i[t+0],_[0]),P(i[t+1],_[1]),P(i[t+2],_[2]),c(x,_[1],_[0]),c(j,_[2],_[0]),p(S,x,j),m(w,w,S)}h(w,w);for(let l=a;l<b;++l){const t=w[0],e=w[1],r=w[2];W(o,l,t,e,r)}}function mt(t){return 1===(t.material?.color?.a??0)}const ht=y(),ut=y(),dt=new I,gt=[0,2,1],ft=[0,1,2],yt=.01,bt=[y(),y(),y()],_t=y(),xt=y();class jt{constructor(t,e,r,s){this.positions=t,this.elevation=e,this.normals=r,this.heights=s}}class St{constructor(t,e,r,s){this.topVertexStart=t,this.topVertexCount=e,this.topFaceStart=r,this.topFaceCount=s}}export{K as Graphics3DExtrudeSymbolLayer,X as extrudePolygon};
5
+ import{clone as t}from"../../../../core/lang.js";import{getMetersPerVerticalUnitForSR as e}from"../../../../core/units.js";import{e as r}from"../../../../chunks/earcut.js";import{normalFromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as n,invertOrIdentity as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{h as l,a as c,f as p,i as m,n as h,p as u,d,e as g}from"../../../../chunks/vec32.js";import{ONES as f,create as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{computeTranslationToOriginAndRotation as b}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as _,fromBuffer as x,intersectsClippingArea as S}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as j}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as w,getZeroIndexArray as P}from"../../../../geometry/support/Indices.js";import{t as v}from"../../../../chunks/vec3.js";import{SnappingCandidateVertex as C,SnappingCandidateEdge as E}from"../../../../layers/graphics/data/SnappingCandidate.js";import{getDriverAxisSizeValue as A}from"../../../../renderers/support/renderingInfoUtils.js";import{needsElevationUpdates3D as D,SampleElevationInfo as I}from"./elevationAlignmentUtils.js";import{Object3DEdgeState as L,Graphics3DObject3DGraphicLayer as U}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as z}from"./Graphics3DSymbolLayer.js";import{computeCentroid as O}from"./graphicUtils.js";import{geometryAsPolygon as M}from"./polygonUtils.js";import{createMaterial as G}from"../support/edgeUtils.js";import{encodeNaNUInt8 as V}from"../support/symbolColorUtils.js";import{debugFlags as T}from"../../support/debugFlags.js";import{SamplePosition as B}from"../../support/ElevationProvider.js";import{polygonToRenderInfo as F}from"../../support/renderInfoUtils/polygon.js";import{Attribute as R}from"../../webgl-engine/lib/Attribute.js";import{Geometry as H}from"../../webgl-engine/lib/Geometry.js";import{isGeometryWithMapPositions as k}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{compressNormals as N,compressNormal as W}from"../../webgl-engine/lib/Normals.js";import{Object3D as q}from"../../webgl-engine/lib/Object3D.js";import{DefaultMaterial as Z}from"../../webgl-engine/materials/DefaultMaterial.js";const J=["polygon","extent"];class K extends z{constructor(t,e,r,s){super(t,e,r,s,mt(e)),this.ensureDrapedStatus(!1)}async doLoad(){const t=this.symbolLayer,e=t?.material,r=this.symbolLayer.material?.color?.a,s=this.needsDrivenTransparentPass||null!=r&&1!==r,o=e?.emissive,n=!this._hasDrivenColorOrOpacity&&(null==r||0===r),i={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,ambient:f,diffuse:f,opacity:n?0:1,layerOpacity:this._getLayerOpacity(),drivenOpacity:s,hasSymbolColors:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:t.castShadows,emissiveStrengthFromSymbol:o?.strength??0,emissiveSource:1,offsetTransparentBackfaces:!0,normalType:1},a=new Z(i,this._context),l=new Z({...i,cullFace:2},this._context);this._materials[0]=a,this._materials[1]=l,this._updateTransparentDepedentMaterialParameters()}destroy(){super.destroy(),this._materials.length=0}createGraphics3DGraphic(t){const e=t.graphic;if(!this._validateGeometry(e.geometry,J,this.symbolLayer.type))return null;const r=this._getDrivenUInt8ColorWithNaNSupport(t.renderingInfo,this._materialColor,!1);V(r,r);const s=this.createElevationContextForGraphic(e);return this._createAs3DShape(e,t.renderingInfo,r,s,e.uid)}layerOpacityChanged(t,e){const r=this._getLayerOpacity();this._materials[0]?.setParameters({layerOpacity:r}),this._materials[1]?.setParameters({layerOpacity:r}),this._updateTransparentDepedentMaterialParameters(),t?.forEach(t=>e(t)?.layerOpacityChanged(r,this._context.isAsync))}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(t,e){return this.updateGraphics3DGraphicElevationInfo(t,e,D)}slicePlaneEnabledChanged(t,e){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),t?.forEach(t=>{const r=e(t);null!=r&&r.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)}),!0}physicalBasedRenderingChanged(){const t={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0};return this._materials[0]?.setParameters(t),this._materials[1]?.setParameters(t),!0}_getExtrusionSize(t){let e;return e=t.size&&this._drivenProperties.size?A(t.size,2)??0:this._getSymbolSize(),e/=this._context.renderCoordsHelper.unitInMeters,e}applyRendererDiff(t,e){return this._drivenPropertiesChanged(e)?0:1}async queryForSnapping(r,s,o,n){const i=this._getExtrusionSize(o)*this._context.renderCoordsHelper.unitInMeters/e(s),{objectId:a,target:l}=r,c=t(l);switch(c.z=(c.z??0)+i,r.type){case"edge":{const{start:e,end:s}=r,o=t(e),n=t(s);return o.z=(o.z??0)+i,n.z=(n.z??0)+i,[new E(a,c,1/0,o,n)]}case"vertex":return[new C(a,c,1/0),new E(a,l,1/0,l,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(t,e,i,l,c){const p=M(t.geometry);if(null==p)return null;if(0===p.rings.length||!p.rings.some(t=>t.length>0))return this._logGeometryValidationWarnings(p.rings,"rings","ExtrudeSymbol3DLayer"),null;const m=F(p,this._context.elevationProvider,this._context.renderCoordsHelper,l);this._logGeometryCreationWarnings(m,p.rings,"rings","ExtrudeSymbol3DLayer");const h=O(p);if(null==h)return null;const u=new Array,d=new Array,g=_(),f=a(),P=y(),C=1===this._context.renderCoordsHelper.viewingMode;C||this._context.renderCoordsHelper.worldUpAtPosition(null,P),b(p.spatialReference,[h.x,h.y,0],f,this._context.renderCoordsHelper.spatialReference);const E=a();n(E,f);const A=o();s(A,E);const{polygons:I,mapPositions:z,position:V}=m,T=new Map,B=this._materials[0];for(const s of I){const t=s.count;if(this._context.clippingExtent&&(x(s.mapPositions,g),!S(g,this._context.clippingExtent)))continue;const o=r(s.mapPositions,s.holeIndices,3);if(0===o.length)continue;const n=o.length,a=6*t,l=w(a+n),p=w(n),m=j(3*a),h=j(3*a),y=j(3*a),b=j(a);X(V,z,o,s,m,y,h,b,l,p,this._getExtrusionSize(e),P,C),v(m,m,E);const _=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:c,layerViewUid:this._context.layerViewUid}),A=new St(m,y,N(h),b),D=Q(B,l,l.length-p.length,A,i,_),I=t,L=t,U=2*s.count,O=new jt(I,L,U,n/3);pt(D,O,f),T.set(D,O),u.push(D,Q(this._materials[1],p,0,A,i,_)),d.push(A.heights)}if(0===u.length)return null;const R=new q({geometries:u,layerViewUid:this._context.layerViewUid,graphicUid:c,isElevationSource:!0});R.transformation=f;const H=G(this.symbolLayer,{opacity:this._getLayerOpacity()}),k=H?new L(this._materials[0],H,this._context.slicePlaneEnabled):null,W=new U(this,R,null,(t,e,r,s,o)=>ct(t,e,r,s,o,d,T),l,k);return W.alignedSampledElevation=m.sampledElevation,W.needsElevationUpdates=D(l.mode),W}get _materialColor(){return this.symbolLayer.material?.color}_updateTransparentDepedentMaterialParameters(){const t=this._materials[0];t&&t.setParameters({cullFace:t.transparent?0:2})}}function Q(t,e,r,s,o,n){const i=P(e.length),a=[["position",new R(s.positions,e,3,!0)],["normalCompressed",new R(s.normals,e,2,!0)],["symbolColor",new R(o,i,4,!0)]];return new H(t,a,s.elevation,0,n,r)}function X(t,e,r,s,o,n,i,a,l,c,p,m,h){const u=r.length/3;let d=2*s.count;Y(t,e,s.index,s.count,r,0,u,o,n,i,a,l,c,d,p,m,h);let g=0,f=2*s.count;d=0;const y=s.pathLengths[0];et(o,n,a,i,g,y,s.count,f,l,d,p),f+=4*y,d+=2*y,g+=y;for(let b=1;b<s.pathLengths.length;++b){const t=s.pathLengths[b];et(o,n,a,i,g,t,s.count,f,l,d,p),f+=4*t,d+=2*t,g+=t}}function Y(t,e,r,s,o,n,i,a,l,c,p,m,u,g,f,y,b){d(ut,y),l??=[],c??=[],p??=[];const _=f>0?1:-1;let x=3*r,S=0,j=3*S,w=s,P=3*w;for(let d=0;d<s;++d){const r=t[x],s=t[x+1],o=t[x+2];b&&(ut[0]=r,ut[1]=s,ut[2]=o,h(ut,ut)),a[j+0]=r,a[j+1]=s,a[j+2]=o;const n=e[x+0],i=e[x+1],m=e[x+2];l[j+0]=n,l[j+1]=i,l[j+2]=m,c[j+0]=-_*ut[0],c[j+1]=-_*ut[1],c[j+2]=-_*ut[2],p[S]=0,a[P+0]=r+f*ut[0],a[P+1]=s+f*ut[1],a[P+2]=o+f*ut[2],l[P+0]=n,l[P+1]=i,l[P+2]=m,p[w]=f,j+=3,P+=3,x+=3,S+=1,w+=1}x=3*n,j=0,P=3*g;const v=f<0?ft:gt,C=f<0?gt:ft;for(let h=0;h<i;++h)u[j]=o[x+v[0]],u[j+1]=o[x+v[1]],u[j+2]=o[x+v[2]],m[P]=o[x+C[0]]+s,m[P+1]=o[x+C[1]]+s,m[P+2]=o[x+C[2]]+s,j+=3,P+=3,x+=3}function $(t,e,r,s,o,n,i){s[n]=s[i],i*=3,t[n*=3]=t[i],t[n+1]=t[i+1],t[n+2]=t[i+2],e[n]=e[i],e[n+1]=e[i+1],e[n+2]=e[i+2],r[n]=o[0],r[n+1]=o[1],r[n+2]=o[2]}const tt=y();function et(t,e,r,s,o,n,i,a,l,c,p){e??=[],r??=[],s??=[];let m=o,h=o+1,u=o+i,d=o+i+1,g=a,f=a+1,y=a+2*n,b=a+2*n+1;p<0&&(m=o+i+1,d=o);let _=3*c;for(let x=0;x<n;++x)x===n-1&&(h=o,p>0?d=o+i:m=o+i),at(t,m,h,u,tt),$(t,e,s,r,tt,g,m),$(t,e,s,r,tt,f,h),$(t,e,s,r,tt,y,u),$(t,e,s,r,tt,b,d),l[_]=g,l[_+1]=y,l[_+2]=b,l[_+3]=g,l[_+4]=b,l[_+5]=f,_+=6,m++,h++,u++,d++,g+=2,f+=2,y+=2,b+=2}const rt=y(),st=y(),ot=y(),nt=y(),it=y();function at(t,e,r,s,o){e*=3,r*=3,s*=3,l(rt,t[e++],t[e++],t[e++]),l(st,t[r++],t[r++],t[r++]),l(ot,t[s++],t[s++],t[s++]),g(nt,st,rt),g(it,ot,rt),p(o,it,nt),h(o,o)}const lt=y();function ct(t,e,r,s,o,n,c){const p=t.stageObject,m=p.geometries,h=m.length,d="absolute-height"!==e.mode;let g=0;const f=p.transformation,y=i(a(),f);for(let i=0;i<h;i+=2){const t=m[i];if(!k(t))continue;const e=t.getMutableAttribute("position").data,a=n[i/2],h=new B(t.mapPositions),b=e.length/3;let _=!1,x=0;{let t=0;for(let n=0;n<b;n++){lt[0]=e[t],lt[1]=e[t+1],lt[2]=e[t+2],s(h,dt),d&&(x+=dt.sampledElevation),T.TESTS_DISABLE_OPTIMIZATIONS?(l(ht,h.array[h.offset],h.array[h.offset+1],dt.z+a[t/3]),null!=r&&o.toRenderCoords(ht,r,ht),u(ht,ht,y)):(l(ht,e[t],e[t+1],e[t+2]),u(ht,ht,f),o.setAltitude(ht,dt.z+a[t/3]),u(ht,ht,y)),e[t]=ht[0],e[t+1]=ht[1],e[t+2]=ht[2];const n=yt/o.unitInMeters;(Math.abs(lt[0]-e[t])>=n||Math.abs(lt[1]-e[t+1])>=n||Math.abs(lt[2]-e[t+2])>=n)&&(_=!0),h.offset+=3,t+=3}}if(_){const e=c.get(t);e&&pt(t,e,f),p.geometryVertexAttributeUpdated(m[i],"normalCompressed"),t.invalidateBoundingInfo(),p.geometryVertexAttributeUpdated(m[i],"position"),m[i+1].invalidateBoundingInfo(),p.geometryVertexAttributeUpdated(m[i+1],"position")}g+=x/b}return g/h}function pt(t,e,r){const s=t.getMutableAttribute("position"),o=t.getMutableAttribute("normalCompressed").data,n=s.data,i=t.attributes.get("position").indices,{topVertexStart:a,topVertexCount:d,topFaceStart:g,topFaceCount:f}=e,y=g+f,b=a+d,_=bt,x=_t,S=xt,j=ut,w=ht;l(w,0,0,0);const P=(t,e)=>{const s=3*t;l(e,n[s+0],n[s+1],n[s+2]),u(e,e,r)};for(let l=g;l<y;++l){const t=3*l;P(i[t+0],_[0]),P(i[t+1],_[1]),P(i[t+2],_[2]),c(x,_[1],_[0]),c(S,_[2],_[0]),p(j,x,S),m(w,w,j)}h(w,w);for(let l=a;l<b;++l){const t=w[0],e=w[1],r=w[2];W(o,l,t,e,r)}}function mt(t){return 1===(t.material?.color?.a??0)}const ht=y(),ut=y(),dt=new I,gt=[0,2,1],ft=[0,1,2],yt=.01,bt=[y(),y(),y()],_t=y(),xt=y();class St{constructor(t,e,r,s){this.positions=t,this.elevation=e,this.normals=r,this.heights=s}}class jt{constructor(t,e,r,s){this.topVertexStart=t,this.topVertexCount=e,this.topFaceStart=r,this.topFaceCount=s}}export{K as Graphics3DExtrudeSymbolLayer,X as extrudePolygon};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{XXH as t}from"../../../../arcade/functions/hash.js";import{createTask as i}from"../../../../core/asyncUtils.js";import{neverReached as r}from"../../../../core/compilerUtils.js";import{makeHandle as s}from"../../../../core/handleUtils.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{EsriPromise as a}from"../../../../core/Promise.js";import{logOnError as o,throwIfAborted as l}from"../../../../core/promiseUtils.js";import{watch as p,initial as d,when as u}from"../../../../core/reactiveUtils.js";import{property as h,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{diff as g}from"../../../../core/accessorSupport/diffUtils.js";import{UpdatingHandles as y}from"../../../../core/support/UpdatingHandles.js";import{canProject as m,project as f}from"../../../../geometry/support/webMercatorUtils.js";import{getRenderingInfo as b,getRenderingInfoAsync as C}from"../../../../renderers/support/renderingInfoUtils.js";import{matchRandomRotationExpression as E}from"../../../../support/arcadeExpressionUtils.js";import{suspendResumeExtentOptimism as w}from"./constants.js";import{DisplayFeatureLimit as x}from"./DisplayFeatureLimit.js";import{Graphics3DCore as v}from"./Graphics3DCore.js";import{Graphics3DElevationAlignment as V}from"./Graphics3DElevationAlignment.js";import{Graphics3DFrustumVisibility as R}from"./Graphics3DFrustumVisibility.js";import{Graphics3DObjectStates as O}from"./Graphics3DObjectStates.js";import{Graphics3DScaleVisibility as S}from"./Graphics3DScaleVisibility.js";import{enlargeExtent as j}from"./graphicUtils.js";import{FeatureVisibilityFilter as _}from"../support/FeatureVisibilityFilter.js";import{emptyHighlightHandle as U}from"../support/highlightUtils.js";let G=class extends a{constructor(e){super(e),this.type="graphics-3d",this._updatingHandles=new y,this.elevationFeatureExpressionEnabled=!1,this.scaleVisibilityEnabled=!1,this.filterVisibilityEnabled=!1,this.frustumVisibilityEnabled=!1,this.elevationAlignmentEnabled=!1,this.timeExtentEnabled=!1,this.setUidToIdOnAdd=!0,this.dataExtent=null,this.drapeSourceType=1,this.preferredUpdatePolicy=0,this._suspendResumeExtent=null}initialize(){const e=this.owner,t=(this.filterVisibilityEnabled||this.timeExtentEnabled)&&"multipatch"!==e.layer.geometryType,r=new v({owner:this,layer:this.layer,preferredUpdatePolicy:this.preferredUpdatePolicy,elevationFeatureExpressionEnabled:this.elevationFeatureExpressionEnabled,graphicSymbolSupported:!1,hasZ:e.hasZ,hasM:e.hasM,setUidToIdOnAdd:this.setUidToIdOnAdd,componentFactories:{deconflictor:t=>e.view.deconflictor.addGraphicsOwner(t),labeler:(t,i)=>e.view.labeler.addGraphicsOwner(t,i),elevationAlignment:this.elevationAlignmentEnabled?(t,i)=>new V({graphicsCoreOwner:this,graphicsCore:t,queryGraphicUIDsInExtent:i,elevationProvider:e.view.elevationProvider}):null,scaleVisibility:this.scaleVisibilityEnabled?(t,i)=>new S({graphicsCoreOwner:this,layer:this.layer,queryGraphicUIDsInExtent:i,graphicsCore:t,basemapTerrain:e.view.basemapTerrain}):null,filterVisibility:t?t=>new _({context:{...t,configuration:e}}):null,objectStates:e=>new O(e)}});this._set("graphicsCore",r),this.frustumVisibilityEnabled&&this._set("frustumVisibility",new R({graphicsCoreOwner:this})),this.elevationAlignment&&this._updatingHandles.add(()=>this.layer.elevationInfo,(e,t)=>{g(e,t)&&this._updatingHandles.addPromise(this.graphicsCore.elevationInfoChange())}),this._updatingHandles.add(()=>this.layer.labelsVisible,()=>this.graphicsCore.updateVisibilityInfo()),this._updatingHandles.add(()=>this.layer.labelingInfo,(e,t)=>{g(e,t)&&this.graphicsCore.updateLabelingInfo()}),this._updatingHandles.add(()=>this.preferredUpdatePolicy,e=>this.graphicsCore.preferredUpdatePolicy=e),this.addResolvingTask(i(e=>this._initializeAsync(e)))}async _initializeAsync(e){await o(this.graphicsCore.initializePromise),l(e);const t=this.owner;this._updatingHandles.add(()=>this.renderer,e=>this._updatingHandles.addPromise(this.graphicsCore.rendererChange(e))),this._updatingHandles.add(()=>t.fullOpacity,()=>this.graphicsCore.opacityChange()),this._setupSuspendResumeExtent(),this.updateClippingExtent&&(this._updatingHandles.add(()=>t.view.clippingArea,()=>this._updateClippingExtent()),this._updateClippingExtent()),this.graphicsCore.startCreateGraphics(),this.graphicsCore.labelsEnabled&&(await o(this.graphicsCore.updateLabelingInfo()),l(e))}destroy(){this._updatingHandles.destroy(),this._set("frustumVisibility",n(this.frustumVisibility)),this._set("graphicsCore",n(this.graphicsCore)),this._set("owner",null)}get layer(){return this.owner.layer}get layerViewUid(){return this.owner.layerViewUid}get dataUpdating(){return this.graphicsCore?.dataUpdating??!1}get renderer(){const{renderer:e,objectIdField:t}=this.layer;if(!e||!t||"heatmap"===e.type||!e.visualVariables)return e;const i=e.visualVariables.findIndex(e=>"rotation"===e.type&&null!=e.valueExpression&&E(e.valueExpression)===t&&(null==e.axis||"heading"===e.axis)&&"geographic"===e.rotationType);if(i<0)return e;const r=e.clone();return r.visualVariables?(r.visualVariables.splice(i,1),this._randomRotationRenderers??=new WeakMap,this._randomRotationRenderers.set(r,t),r):e}get scaleVisibility(){return this.graphicsCore?.scaleVisibility}get filterVisibility(){return this.graphicsCore?.filterVisibility}get elevationAlignment(){return this.graphicsCore?.elevationAlignment}get suspendResumeExtentMode(){return this.owner.suspendResumeExtentMode??"computed"}get scaleVisibilitySuspended(){return null!=this.scaleVisibility&&this.scaleVisibility.suspended}get suspended(){return this.owner.suspended}get legendEnabled(){return null==this.frustumVisibility||!this.frustumVisibility.suspended}get suspendInfo(){const e={};return this.scaleVisibilitySuspended&&(e.outsideScaleRange=!0),null!=this.frustumVisibility&&this.frustumVisibility.suspended&&(e.outsideOfView=!0),e}get updating(){return!!(this.graphicsCore?.updating||this.frustumVisibility?.updating||this._updatingHandles.updating)}get updatingRemaining(){return this.graphicsCore?.updatingRemaining??0}get featureStore(){return this.graphicsCore?.featureStore}get view(){return this.owner.view}get loadedGraphics(){return this.owner.loadedGraphics}get fullOpacity(){return this.owner?.fullOpacity}get filter(){return"filter"in this.owner?this.owner.filter:null}get slicePlaneEnabled(){return this.owner.slicePlaneEnabled}get updatePolicy(){return this.owner.updatePolicy}get featureSpatialReference(){return"featureSpatialReference"in this.owner?this.owner.featureSpatialReference:this.owner.view.spatialReference}get graphics3DGraphics(){return this.graphicsCore?.graphics3DGraphics}get graphics3DGraphicsByObjectID(){return this.graphicsCore?.graphics3DGraphicsByObjectID}get symbolUpdateType(){return this.graphicsCore?.symbolUpdateType}get displayFeatureLimit(){const e=this.view.quality,t=this.graphicsCore?.displayFeatureLimit;if(1===e)return t;const i=Math.ceil(t.maximumNumberOfFeatures*e);return new x(t.maximumTotalNumberOfVertices,i,t.averageSymbolComplexity)}get usedMemory(){return this.graphicsCore?.usedMemory??0}get loadedFeatures(){return this.graphicsCore?.numberOfGraphics??0}get usedMemoryPerFeature(){return this.graphicsCore?.usedMemoryPerGraphic??0}get unprocessedMemoryEstimate(){return this.graphicsCore?.unprocessedMemoryEstimate??0}get performanceInfo(){return this.graphicsCore.performanceInfo}maskOccludee(e){const t=this.graphicsCore?.objectStates;if(!t)return s();const{set:i,handle:r}=t.acquireOccludeeSet(null);return t.setUid(i,e.uid),r}highlightByGraphics(e,t){const i=this.graphicsCore?.objectStates;if(!i)return U;const r=e.map(e=>e.uid),{set:s,handle:n}=i.acquireHighlightSet(t,null);return i.setUids(s,r),n}highlightByObjectIds(e,t=null,i){const r=this.graphicsCore?.objectStates;if(!r)return U;const{set:s,handle:n}=r.acquireHighlightSet(i,t);return r.setObjectIds(s,e),n}resetObjectStates(){this.graphicsCore?.objectStates?.reset()}whenGraphicBounds(e,t){return this.graphicsCore?.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.graphicsCore?.computeAttachmentOrigin(e,t)}notifyGraphicGeometryChanged(e){this.graphicsCore.notifyGraphicGeometryChanged(e)}notifyGraphicVisibilityChanged(e){this.graphicsCore.notifyGraphicVisibilityChanged(e)}notifyContentGeometryUpdate(){this.owner.notifyContentGeometryUpdate?.()}getRenderingInfo(e,i,r){const s=b(e,{renderer:i,arcade:r});if(s?.color){const e=s.color;e[0]=e[0]/255,e[1]=e[1]/255,e[2]=e[2]/255}if(null!=s&&null!=i&&this._randomRotationRenderers?.has(i)){const r=this._randomRotationRenderers.get(i),n=e.attributes[r],a=new t(0);a.updateFloatArray([n]),a.updateUint8Array([173]),s.heading=8.381e-8*a.digest()}return s}getRenderingInfoAsync(e,t,i,r){return C(e,{renderer:t,arcade:i,...r})}getSymbolLayerSize(e,t){return this.graphicsCore?.getSymbolLayerSize(e,t)}setObjectIdVisibility(e,t){this.graphicsCore?.setObjectIdVisibility(e,t)}refreshFilter(){null!=this.filterVisibility&&this.filterVisibility.reapply()}getGraphics3DGraphicByObjectId(e){return this.graphicsCore?.getGraphics3DGraphicByObjectId(e)}_updateClippingExtent(){const e=this.owner.view.clippingArea;this.graphicsCore.setClippingExtent(e,this.owner.view.spatialReference)&&(this.updateClippingExtent(e)||this.graphicsCore.recreateAllGraphics())}_setupSuspendResumeExtent(){(this.frustumVisibility||this.scaleVisibility)&&this.addHandles(p(()=>this.suspendResumeExtentMode,()=>{switch(this.removeHandles(I),this.suspendResumeExtentMode){case"computed":this.addHandles([p(()=>this.graphicsCore.computedExtent,e=>this._updateSuspendResumeExtent(e),d),p(()=>this.graphicsCore.extentPadding,()=>this._updateSuspendResumeExtent(this.graphicsCore.computedExtent))],I);break;case"data":this.addHandles([u(()=>this.dataExtent,e=>this._updateSuspendResumeExtent(e),d),p(()=>this.graphicsCore.extentPadding,()=>this._updateSuspendResumeExtent(this.dataExtent))],I);break;default:r(this.suspendResumeExtentMode)}},d))}_updateSuspendResumeExtent(e){e?this._suspendResumeExtentChanged(this._extentToSuspendResumeRect(e,this._suspendResumeExtent)):this._suspendResumeExtentChanged(null)}_extentToSuspendResumeRect(e,t){const i=this.owner.view.spatialReference;if(!e.spatialReference.equals(i)){if(!m(e,i))return;e=f(e,i)}return j(e,t,w,this.graphicsCore.extentPadding)}_suspendResumeExtentChanged(e){null!=this.frustumVisibility&&this.frustumVisibility.setExtent(e),null!=this.scaleVisibility&&this.scaleVisibility.setExtent(e)}};e([h()],G.prototype,"type",void 0),e([h({constructOnly:!0})],G.prototype,"owner",void 0),e([h()],G.prototype,"layer",null),e([h()],G.prototype,"layerViewUid",null),e([h({readOnly:!0})],G.prototype,"dataUpdating",null),e([h()],G.prototype,"renderer",null),e([h({constructOnly:!0})],G.prototype,"updateClippingExtent",void 0),e([h({constructOnly:!0})],G.prototype,"elevationFeatureExpressionEnabled",void 0),e([h({constructOnly:!0})],G.prototype,"graphicsCore",void 0),e([h({constructOnly:!0})],G.prototype,"scaleVisibilityEnabled",void 0),e([h({constructOnly:!0})],G.prototype,"filterVisibilityEnabled",void 0),e([h({constructOnly:!0})],G.prototype,"frustumVisibilityEnabled",void 0),e([h({constructOnly:!0})],G.prototype,"elevationAlignmentEnabled",void 0),e([h({constructOnly:!0})],G.prototype,"timeExtentEnabled",void 0),e([h({constructOnly:!0})],G.prototype,"setUidToIdOnAdd",void 0),e([h()],G.prototype,"scaleVisibility",null),e([h()],G.prototype,"filterVisibility",null),e([h()],G.prototype,"elevationAlignment",null),e([h({constructOnly:!0})],G.prototype,"frustumVisibility",void 0),e([h()],G.prototype,"suspendResumeExtentMode",null),e([h()],G.prototype,"dataExtent",void 0),e([h()],G.prototype,"scaleVisibilitySuspended",null),e([h()],G.prototype,"suspended",null),e([h()],G.prototype,"legendEnabled",null),e([h()],G.prototype,"suspendInfo",null),e([h()],G.prototype,"updating",null),e([h()],G.prototype,"updatingRemaining",null),e([h()],G.prototype,"featureStore",null),e([h()],G.prototype,"view",null),e([h()],G.prototype,"loadedGraphics",null),e([h()],G.prototype,"fullOpacity",null),e([h()],G.prototype,"filter",null),e([h()],G.prototype,"slicePlaneEnabled",null),e([h()],G.prototype,"drapeSourceType",void 0),e([h()],G.prototype,"updatePolicy",null),e([h()],G.prototype,"preferredUpdatePolicy",void 0),e([h({readOnly:!0})],G.prototype,"displayFeatureLimit",null),G=e([c("esri.views.3d.layers.graphics.Graphics3DFeatureProcessor")],G);const I="suspendResumeExtentMode";export{G as Graphics3DFeatureProcessor};
5
+ import{__decorate as e}from"tslib";import{XXH as t}from"../../../../arcade/functions/hash.js";import{createTask as i}from"../../../../core/asyncUtils.js";import{makeHandle as r}from"../../../../core/handleUtils.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{EsriPromise as n}from"../../../../core/Promise.js";import{logOnError as a,throwIfAborted as o}from"../../../../core/promiseUtils.js";import{watch as l,initial as p,when as d}from"../../../../core/reactiveUtils.js";import{property as u,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{diff as c}from"../../../../core/accessorSupport/diffUtils.js";import{UpdatingHandles as g}from"../../../../core/support/UpdatingHandles.js";import{canProject as y,project as m}from"../../../../geometry/support/webMercatorUtils.js";import{getRenderingInfo as f,getRenderingInfoAsync as b}from"../../../../renderers/support/renderingInfoUtils.js";import{matchRandomRotationExpression as C}from"../../../../support/arcadeExpressionUtils.js";import{suspendResumeExtentOptimism as E}from"./constants.js";import{DisplayFeatureLimit as w}from"./DisplayFeatureLimit.js";import{Graphics3DCore as x}from"./Graphics3DCore.js";import{Graphics3DElevationAlignment as v}from"./Graphics3DElevationAlignment.js";import{Graphics3DFrustumVisibility as V}from"./Graphics3DFrustumVisibility.js";import{Graphics3DObjectStates as R}from"./Graphics3DObjectStates.js";import{Graphics3DScaleVisibility as O}from"./Graphics3DScaleVisibility.js";import{enlargeExtent as S}from"./graphicUtils.js";import{FeatureVisibilityFilter as _}from"../support/FeatureVisibilityFilter.js";import{emptyHighlightHandle as j}from"../support/highlightUtils.js";let G=class extends n{constructor(e){super(e),this.type="graphics-3d",this._updatingHandles=new g,this.elevationFeatureExpressionEnabled=!1,this.scaleVisibilityEnabled=!1,this.filterVisibilityEnabled=!1,this.frustumVisibilityEnabled=!1,this.elevationAlignmentEnabled=!1,this.timeExtentEnabled=!1,this.setUidToIdOnAdd=!0,this.dataExtent=null,this.drapeSourceType=1,this.preferredUpdatePolicy=0,this._suspendResumeExtent=null}initialize(){const e=this.owner,t=(this.filterVisibilityEnabled||this.timeExtentEnabled)&&"multipatch"!==e.layer.geometryType,r=new x({owner:this,layer:this.layer,preferredUpdatePolicy:this.preferredUpdatePolicy,elevationFeatureExpressionEnabled:this.elevationFeatureExpressionEnabled,graphicSymbolSupported:!1,hasZ:e.hasZ,hasM:e.hasM,setUidToIdOnAdd:this.setUidToIdOnAdd,componentFactories:{deconflictor:t=>e.view.deconflictor.addGraphicsOwner(t),labeler:(t,i)=>e.view.labeler.addGraphicsOwner(t,i),elevationAlignment:this.elevationAlignmentEnabled?(t,i)=>new v({graphicsCoreOwner:this,graphicsCore:t,queryGraphicUIDsInExtent:i,elevationProvider:e.view.elevationProvider}):null,scaleVisibility:this.scaleVisibilityEnabled?(t,i)=>new O({graphicsCoreOwner:this,layer:this.layer,queryGraphicUIDsInExtent:i,graphicsCore:t,basemapTerrain:e.view.basemapTerrain}):null,filterVisibility:t?t=>new _({context:{...t,configuration:e}}):null,objectStates:e=>new R(e)}});this._set("graphicsCore",r),this.frustumVisibilityEnabled&&this._set("frustumVisibility",new V({graphicsCoreOwner:this})),this.elevationAlignment&&this._updatingHandles.add(()=>this.layer.elevationInfo,(e,t)=>{c(e,t)&&this._updatingHandles.addPromise(this.graphicsCore.elevationInfoChange())}),this._updatingHandles.add(()=>this.layer.labelsVisible,()=>this.graphicsCore.updateVisibilityInfo()),this._updatingHandles.add(()=>this.layer.labelingInfo,(e,t)=>{c(e,t)&&this.graphicsCore.updateLabelingInfo()}),this._updatingHandles.add(()=>this.preferredUpdatePolicy,e=>this.graphicsCore.preferredUpdatePolicy=e),this.addResolvingTask(i(e=>this._initializeAsync(e)))}async _initializeAsync(e){await a(this.graphicsCore.initializePromise),o(e);const t=this.owner;this._updatingHandles.add(()=>this.renderer,e=>this._updatingHandles.addPromise(this.graphicsCore.rendererChange(e))),this._updatingHandles.add(()=>t.fullOpacity,()=>this.graphicsCore.opacityChange()),this._setupSuspendResumeExtent(),this.updateClippingExtent&&(this._updatingHandles.add(()=>t.view.clippingArea,()=>this._updateClippingExtent()),this._updateClippingExtent()),this.graphicsCore.startCreateGraphics(),this.graphicsCore.labelsEnabled&&(await a(this.graphicsCore.updateLabelingInfo()),o(e))}destroy(){this._updatingHandles.destroy(),this._set("frustumVisibility",s(this.frustumVisibility)),this._set("graphicsCore",s(this.graphicsCore)),this._set("owner",null)}get layer(){return this.owner.layer}get layerViewUid(){return this.owner.layerViewUid}get dataUpdating(){return this.graphicsCore?.dataUpdating??!1}get renderer(){const{renderer:e,objectIdField:t}=this.layer;if(!e||!t||"heatmap"===e.type||!e.visualVariables)return e;const i=e.visualVariables.findIndex(e=>"rotation"===e.type&&null!=e.valueExpression&&C(e.valueExpression)===t&&(null==e.axis||"heading"===e.axis)&&"geographic"===e.rotationType);if(i<0)return e;const r=e.clone();return r.visualVariables?(r.visualVariables.splice(i,1),this._randomRotationRenderers??=new WeakMap,this._randomRotationRenderers.set(r,t),r):e}get scaleVisibility(){return this.graphicsCore?.scaleVisibility}get filterVisibility(){return this.graphicsCore?.filterVisibility}get elevationAlignment(){return this.graphicsCore?.elevationAlignment}get suspendResumeExtentMode(){return this.owner.suspendResumeExtentMode??"computed"}get scaleVisibilitySuspended(){return null!=this.scaleVisibility&&this.scaleVisibility.suspended}get suspended(){return this.owner.suspended}get legendEnabled(){return null==this.frustumVisibility||!this.frustumVisibility.suspended}get suspendInfo(){const e={};return this.scaleVisibilitySuspended&&(e.outsideScaleRange=!0),null!=this.frustumVisibility&&this.frustumVisibility.suspended&&(e.outsideOfView=!0),e}get updating(){return!!(this.graphicsCore?.updating||this.frustumVisibility?.updating||this._updatingHandles.updating)}get updatingRemaining(){return this.graphicsCore?.updatingRemaining??0}get featureStore(){return this.graphicsCore?.featureStore}get view(){return this.owner.view}get loadedGraphics(){return this.owner.loadedGraphics}get fullOpacity(){return this.owner?.fullOpacity}get filter(){return"filter"in this.owner?this.owner.filter:null}get slicePlaneEnabled(){return this.owner.slicePlaneEnabled}get updatePolicy(){return this.owner.updatePolicy}get featureSpatialReference(){return"featureSpatialReference"in this.owner?this.owner.featureSpatialReference:this.owner.view.spatialReference}get graphics3DGraphics(){return this.graphicsCore?.graphics3DGraphics}get graphics3DGraphicsByObjectID(){return this.graphicsCore?.graphics3DGraphicsByObjectID}get symbolUpdateType(){return this.graphicsCore?.symbolUpdateType}get displayFeatureLimit(){const e=this.view.quality,t=this.graphicsCore?.displayFeatureLimit;if(1===e)return t;const i=Math.ceil(t.maximumNumberOfFeatures*e);return new w(t.maximumTotalNumberOfVertices,i,t.averageSymbolComplexity)}get usedMemory(){return this.graphicsCore?.usedMemory??0}get loadedFeatures(){return this.graphicsCore?.numberOfGraphics??0}get usedMemoryPerFeature(){return this.graphicsCore?.usedMemoryPerGraphic??0}get unprocessedMemoryEstimate(){return this.graphicsCore?.unprocessedMemoryEstimate??0}get performanceInfo(){return this.graphicsCore.performanceInfo}maskOccludee(e){const t=this.graphicsCore?.objectStates;if(!t)return r();const{set:i,handle:s}=t.acquireOccludeeSet(null);return t.setUid(i,e.uid),s}highlightByGraphics(e,t){const i=this.graphicsCore?.objectStates;if(!i)return j;const r=e.map(e=>e.uid),{set:s,handle:n}=i.acquireHighlightSet(t,null);return i.setUids(s,r),n}highlightByObjectIds(e,t=null,i){const r=this.graphicsCore?.objectStates;if(!r)return j;const{set:s,handle:n}=r.acquireHighlightSet(i,t);return r.setObjectIds(s,e),n}resetObjectStates(){this.graphicsCore?.objectStates?.reset()}whenGraphicBounds(e,t){return this.graphicsCore?.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.graphicsCore?.computeAttachmentOrigin(e,t)}notifyGraphicGeometryChanged(e){this.graphicsCore.notifyGraphicGeometryChanged(e)}notifyGraphicVisibilityChanged(e){this.graphicsCore.notifyGraphicVisibilityChanged(e)}notifyContentGeometryUpdate(){this.owner.notifyContentGeometryUpdate?.()}getRenderingInfo(e,i,r){const s=f(e,{renderer:i,arcade:r});if(s?.color){const e=s.color;e[0]=e[0]/255,e[1]=e[1]/255,e[2]=e[2]/255}if(null!=s&&null!=i&&this._randomRotationRenderers?.has(i)){const r=this._randomRotationRenderers.get(i),n=e.attributes[r],a=new t(0);a.updateFloatArray([n]),a.updateUint8Array([173]),s.heading=8.381e-8*a.digest()}return s}getRenderingInfoAsync(e,t,i,r){return b(e,{renderer:t,arcade:i,...r})}getSymbolLayerSize(e,t){return this.graphicsCore?.getSymbolLayerSize(e,t)}setObjectIdVisibility(e,t){this.graphicsCore?.setObjectIdVisibility(e,t)}refreshFilter(){null!=this.filterVisibility&&this.filterVisibility.reapply()}getGraphics3DGraphicByObjectId(e){return this.graphicsCore?.getGraphics3DGraphicByObjectId(e)}_updateClippingExtent(){const e=this.owner.view.clippingArea;this.graphicsCore.setClippingExtent(e,this.owner.view.spatialReference)&&(this.updateClippingExtent(e)||this.graphicsCore.recreateAllGraphics())}_setupSuspendResumeExtent(){(this.frustumVisibility||this.scaleVisibility)&&this.addHandles(l(()=>this.suspendResumeExtentMode,()=>{switch(this.removeHandles(U),this.suspendResumeExtentMode){case"computed":this.addHandles([l(()=>this.graphicsCore.computedExtent,e=>this._updateSuspendResumeExtent(e),p),l(()=>this.graphicsCore.extentPadding,()=>this._updateSuspendResumeExtent(this.graphicsCore.computedExtent))],U);break;case"data":this.addHandles([d(()=>this.dataExtent,e=>this._updateSuspendResumeExtent(e),p),l(()=>this.graphicsCore.extentPadding,()=>this._updateSuspendResumeExtent(this.dataExtent))],U);break;default:this.suspendResumeExtentMode}},p))}_updateSuspendResumeExtent(e){e?this._suspendResumeExtentChanged(this._extentToSuspendResumeRect(e,this._suspendResumeExtent)):this._suspendResumeExtentChanged(null)}_extentToSuspendResumeRect(e,t){const i=this.owner.view.spatialReference;if(!e.spatialReference.equals(i)){if(!y(e,i))return;e=m(e,i)}return S(e,t,E,this.graphicsCore.extentPadding)}_suspendResumeExtentChanged(e){null!=this.frustumVisibility&&this.frustumVisibility.setExtent(e),null!=this.scaleVisibility&&this.scaleVisibility.setExtent(e)}};e([u()],G.prototype,"type",void 0),e([u({constructOnly:!0})],G.prototype,"owner",void 0),e([u()],G.prototype,"layer",null),e([u()],G.prototype,"layerViewUid",null),e([u({readOnly:!0})],G.prototype,"dataUpdating",null),e([u()],G.prototype,"renderer",null),e([u({constructOnly:!0})],G.prototype,"updateClippingExtent",void 0),e([u({constructOnly:!0})],G.prototype,"elevationFeatureExpressionEnabled",void 0),e([u({constructOnly:!0})],G.prototype,"graphicsCore",void 0),e([u({constructOnly:!0})],G.prototype,"scaleVisibilityEnabled",void 0),e([u({constructOnly:!0})],G.prototype,"filterVisibilityEnabled",void 0),e([u({constructOnly:!0})],G.prototype,"frustumVisibilityEnabled",void 0),e([u({constructOnly:!0})],G.prototype,"elevationAlignmentEnabled",void 0),e([u({constructOnly:!0})],G.prototype,"timeExtentEnabled",void 0),e([u({constructOnly:!0})],G.prototype,"setUidToIdOnAdd",void 0),e([u()],G.prototype,"scaleVisibility",null),e([u()],G.prototype,"filterVisibility",null),e([u()],G.prototype,"elevationAlignment",null),e([u({constructOnly:!0})],G.prototype,"frustumVisibility",void 0),e([u()],G.prototype,"suspendResumeExtentMode",null),e([u()],G.prototype,"dataExtent",void 0),e([u()],G.prototype,"scaleVisibilitySuspended",null),e([u()],G.prototype,"suspended",null),e([u()],G.prototype,"legendEnabled",null),e([u()],G.prototype,"suspendInfo",null),e([u()],G.prototype,"updating",null),e([u()],G.prototype,"updatingRemaining",null),e([u()],G.prototype,"featureStore",null),e([u()],G.prototype,"view",null),e([u()],G.prototype,"loadedGraphics",null),e([u()],G.prototype,"fullOpacity",null),e([u()],G.prototype,"filter",null),e([u()],G.prototype,"slicePlaneEnabled",null),e([u()],G.prototype,"drapeSourceType",void 0),e([u()],G.prototype,"updatePolicy",null),e([u()],G.prototype,"preferredUpdatePolicy",void 0),e([u({readOnly:!0})],G.prototype,"displayFeatureLimit",null),G=e([h("esri.views.3d.layers.graphics.Graphics3DFeatureProcessor")],G);const U="suspendResumeExtentMode";export{G as Graphics3DFeatureProcessor};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import{linearize as t}from"../../../../colorUtils.js";import"../../../../core/has.js";import{deg2rad as r}from"../../../../core/mathUtils.js";import{releaseMaybe as o}from"../../../../core/maybe.js";import{isPromiseLike as n}from"../../../../core/promiseUtils.js";import{normalFromMat4 as a,fromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromTranslation as l,multiply as c,invert as u,getTranslation as m}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as f,IDENTITY as p,clone as h}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as d}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{h as g,i as x,j as _,p as y,t as T,n as b,c as v,e as w,f as C,g as j}from"../../../../chunks/vec32.js";import{create as M,fromValues as R,ONES as A,ZEROS as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as S}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{canProjectWithoutEngine as I}from"../../../../geometry/projectionUtils.js";import{computeTranslationToOriginAndRotation as B}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as U}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as E}from"../../../../geometry/projection/projectVectorToVector.js";import{fromBuffer as F,create as O,intersectsClippingArea as V}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as $}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as G,getContinuousIndexArray as D}from"../../../../geometry/support/Indices.js";import L from"../../../../geometry/support/MeshComponent.js";import N from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import H from"../../../../geometry/support/MeshTextureTransform.js";import{isRelativeVertexSpace as k,isAbsoluteVertexSpace as z}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{equals as q,isPlateCarree as W}from"../../../../geometry/support/spatialReferenceUtils.js";import{t as Y}from"../../../../chunks/vec3.js";import{transformNormal as K,transformVectorENUPlateCarree as J,transformVectorWMPlateCarree as Q,projectNormalToPCPF as X,transformTangent as Z,projectTangentToPCPF as ee}from"../../../../geometry/support/meshUtils/projection.js";import{projectMeshVertexPositions as te}from"../../../../geometry/support/meshUtils/projectMeshVertexPositions.js";import{getEmissiveMode as re}from"../../../../symbols/support/materialUtils.js";import{isEncodedMeshTexture as oe}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as ne}from"../../glTF/internal/TextureTransformUtils.js";import{defaultSymbolLayerMemoryComplexity as ae}from"./defaultSymbolComplexity.js";import{perObjectElevationAligner as se}from"./ElevationAligners.js";import{needsElevationUpdates3D as ie,evaluateElevationInfoAtPoint as le}from"./elevationAlignmentUtils.js";import{Graphics3DMeshObject3DGraphicLayer as ce}from"./Graphics3DMeshObject3DGraphicLayer.js";import{Object3DEdgeState as ue}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as me,nanFallbackColor as fe}from"./Graphics3DSymbolLayer.js";import{MaterialInfoCache as pe,MeshFastUpdateProcessor as he}from"./MeshFastUpdateProcessor.js";import{SymbolComplexity as de}from"./SymbolComplexity.js";import{hasEdges as ge,createMaterial as xe}from"../support/edgeUtils.js";import{debugFlags as _e}from"../../support/debugFlags.js";import{Attribute as ye}from"../../webgl-engine/lib/Attribute.js";import{Geometry as Te}from"../../webgl-engine/lib/Geometry.js";import{ManagedTexture as be}from"../../webgl-engine/lib/ManagedTexture.js";import{Object3D as ve}from"../../webgl-engine/lib/Object3D.js";import{DefaultMaterial as we}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as Ce}from"../../webgl-engine/materials/NativeLineMaterial.js";import{useSchematicPBR as je,advancedMRRFactors as Me,schematicMRRFactors as Re}from"../../webgl-engine/materials/pbrUtils.js";const Ae=["mesh"];class Pe extends me{constructor(e,t,r,o){super(e,t,r,o,We(t)),this._materialInfoCache=new pe,this._fastUpdateProcessor=new he,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){_e.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new Ce({color:[1,0,1,1]}),this._debugTangentNormalMaterial=new Ce({color:[1,.5,0,1]}),this._debugFaceNormalMaterial=new Ce({color:[0,1,1,1]})),this.updateComplexity()}destroy(){super.destroy(),this._textures.forEach(e=>e.unload()),this._context.stage.removeTextures(Array.from(this._textures.values())),this._materialInfoCache.clear(),this._textures.clear(),this._fastUpdateProcessor.destroy()}get materials(){return this._materialInfoCache.materials}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,Ae,"fill on mesh-3d"))return null;const r=this.createElevationContextForGraphic(t),o=e.renderingInfo;return this._createAs3DShape(t,o,r,t.uid)}onRemoveGraphic(e){this._fastUpdateProcessor.onRemoveGraphic(e,this._materialInfoCache)}layerOpacityChanged(e,t){const r=this._getLayerOpacity();this._updateMaterialParameters(e=>{e.material.setParameters({layerOpacity:r});const t=e.material.parameters;this._setMaterialTextureAlphaMode(t,e)}),e?.forEach(e=>t(e)?.layerOpacityChanged(r,this._context.isAsync))}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,ie)}slicePlaneEnabledChanged(e,t){return this._updateMaterialParameters(({material:e})=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),e?.forEach(e=>t(e)?.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)),!0}physicalBasedRenderingChanged(){const e=this._usePBR();return this._updateMaterialParameters(({material:t})=>t.setParameters({usePBR:e})),!0}updateTransform(e,t,r,o){if(!e.fastTransformUpdatesAllowed)return!1;const n=e.fastTransformUpdatesEnabled;switch(o){case 0:if(n)return!0;break;case 1:if(!n)return!0;break;default:if(!n)return!!this.updateTransform(e,t,r,0)&&(e.autoDisableFastTransformUpdates(()=>this.updateTransform(e,t,r,1)),!0)}const a=this._context.renderCoordsHelper.spatialReference,s=tt,{origin:i,transform:l}=r;if(!B(t,g(Je,i.x,i.y,i.z??0),s,a))return!1;switch(o){case 0:this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context);break;case 1:this._fastUpdateProcessor.disable(e,this._materialInfoCache);break;case 2:e.updateFastLocalOrigin(s,l,this._context.localOriginFactory)}const{elevationContext:c}=e;c.centerInElevationSR=this._getCenterInElevationSR(s);const{elevationProvider:u,renderCoordsHelper:m}=this._context,f=(e,t)=>le(e,u,c,m,t);return e.alignedSampledElevation=se(e,c,u.spatialReference,f,m,s),e.updateTransform(s,l,this._context.isAsync),e.updateAutoDisableFastTransformUpdates(()=>this.updateTransform(e,t,r,1)),!0}computeComplexity(){if(!this._textures||0===this._textures.size)return super.computeComplexity();let e=0;for(const o of this._textures.values())e+=o.usedMemory;const t={...ae(this.symbol,this.symbolLayer),resourceBytes:e},r=ge(this.symbolLayer)?2:0;return new de({drawCallsPerFeature:r,memory:t})}_requiresSymbolVertexColors(){return this._hasDrivenColorOrOpacity}_materialPropertiesDefault(e,t){const r=this._requiresSymbolVertexColors(),o=!!e.vertexAttributes.color,n=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:r,hasVertexColors:o,hasVertexTangents:n,uid:`vc:${o},vt:${n},vct${t},svc:${r}`}}_materialProperties(e,t,r){const o=this._materialPropertiesDefault(e,r);if(!t.material)return o;const{color:n,colorTexture:a,colorTextureTransform:s,normalTexture:i,normalTextureTransform:l,doubleSided:c,alphaCutoff:u,alphaMode:m}=t.material,f=ke(n),p=ke(a),h=ze(s),d=ke(i),g=ze(l);if(o.color=n,o.colorTexture=a,o.normalTexture=i,o.uid=`${o.uid},cmuid:${f},ctmuid:${p},cttuid:${h},ntmuid:${d},nttuid:${g},ds:${c},ac:${u},am:${m}`,t.material instanceof N){const{metallic:e,roughness:r,metallicRoughnessTexture:n,metallicRoughnessTextureTransform:a,emissiveColor:i,emissiveStrength:c,emissiveTexture:u,emissiveTextureTransform:m,occlusionTexture:f,occlusionTextureTransform:p}=t.material,h=ke(n),d=ze(a),g=ke(i),x=ke(u),_=ze(m),y=ke(f),T=ze(p);o.uid=[o.uid,`mrm:${e}`,`mrr:${r}`,`mrt:${h}`,`mrtt:${d}`,`emuid:${g}`,`ems:${c}`,`etmuid:${x}`,`ett:${_}`,`otmuid:${y}`,`ott:${T}`].join(","),o.metallic=e,o.roughness=r,o.metallicRoughnessTexture=n,o.emissiveColor=i,o.emissiveStrength=c,o.emissiveTexture=u,o.occlusionTexture=f,o.colorTextureTransform=$e(s),o.normalTextureTransform=$e(l),o.emissiveTextureTransform=$e(m),o.occlusionTextureTransform=$e(p),o.metallicRoughnessTextureTransform=$e(a)}return o}_getInternalTexture(e,t=!1,r=1){const a=He(e);if(!a)return null;const s=`${e.contentHash}/${r}`;let i=this._textures.get(s);if(i){const e=this._context.stage.renderView.textures;let t=null;const r=e.acquire(i.id);return null==r||n(r)||(i.events.on("unloaded",()=>t=o(t)),t=r),i}let l=null;const c=this._context.stage.renderView.renderingContext.parameters.maxMaxAnisotropy,u={wrap:Ge(e.wrap),noUnpackFlip:!0,maxAnisotropy:c,mipmap:c>1};return oe(a)?(l=a.data,u.preMultiplyAlpha=!1,u.encoding=a.encoding):(l=a,u.preMultiplyAlpha=1!==r,u.compressionOptions=t?{compressionTracker:this._context.compressionTracker,compressionCallback:()=>this.updateComplexity()}:void 0),i=new be(l,u),this._textures.set(s,i),i.events.on("loaded",()=>this.updateComplexity()),i.load(this._context.stage.renderView.renderingContext),this._context.stage.addTexture(i),i.events.on("unloaded",()=>{this._textures.delete(s)}),i}_setInternalMaterialTextureParameters(e,r){if(null!=e.colorTexture){const t=1!==r.textureAlphaMode,o=this._getInternalTexture(e.colorTexture,t,r.textureAlphaMode);o?(r.textureId=o.id,r.textureAlphaPremultiplied=!!o.parameters.preMultiplyAlpha):r.textureId=void 0}if(e.normalTexture&&(r.normalTextureId=this._getInternalTexture(e.normalTexture)?.id),e.emissiveColor){const o=e.emissiveColor?.toUnitRGB();r.emissiveBaseColor=R(t(o[0]),t(o[1]),t(o[2]))}e.emissiveStrength&&(r.emissiveStrengthKHR=e.emissiveStrength),e.emissiveTexture&&(r.emissiveTextureId=this._getInternalTexture(e.emissiveTexture)?.id),e.occlusionTexture&&(r.occlusionTextureId=this._getInternalTexture(e.occlusionTexture,!0)?.id),e.metallicRoughnessTexture&&(r.metallicRoughnessTextureId=this._getInternalTexture(e.metallicRoughnessTexture,!0)?.id)}_setInternalMaterialParameters(e,t,r){null!=e.color&&Ne(e.color,t,r),this._setInternalMaterialTextureParameters(e,t),t.colorTextureTransformMatrix=ne(e.colorTextureTransform),t.normalTextureTransformMatrix=ne(e.normalTextureTransform);const o=null!=e.normalTextureTransform?.scale?e.normalTextureTransform?.scale:d;t.scale=[o[0],o[1]],t.occlusionTextureTransformMatrix=ne(e.occlusionTextureTransform),t.emissiveTextureTransformMatrix=ne(e.emissiveTextureTransform),t.metallicRoughnessTextureTransformMatrix=ne(e.metallicRoughnessTextureTransform)}_setExternalMaterialParameters(e,t=this._materialColor){const r=this._drivenProperties.color,o=this._drivenProperties.opacity;if(r)e.externalColor=S;else{const r=t??null;if(r){const t=r.toUnitRGBA();o&&(t[3]=1),e.externalColor=t}else e.externalColor=fe}e.colorMixMode=this.symbolLayer.material?.colorMixMode??"multiply",e.castShadows=!!this.symbolLayer.castShadows,e.emissiveStrengthFromSymbol=this.symbolLayer?.material?.emissive?.strength??1,e.emissiveSource=re(this.symbolLayer?.material?.emissive?.source??"emissive")}_getOrCreateMaterial(e,t){const r=t.material?.color,o=t.material?.colorTexture,n=t.material?.alphaMode,a="blend"===n,s=!("opaque"===n)&&(Le(e)||null!=r&&r.a<1||o?.transparent||a),i=this._materialProperties(e,t,s),l=this._materialInfoCache.byUid(i.uid);if(l)return this._setInternalMaterialTextureParameters(i,l.material.parameters),l.material;const c={uid:i.uid,material:null,isComponentTransparent:s,alphaMode:t.material?t.material.alphaMode:"opaque"},u=je({normalTexture:i.normalTexture,metallicRoughnessTexture:i.metallicRoughnessTexture,metallicFactor:i.metallic,roughnessFactor:i.roughness,emissiveTexture:i.emissiveTexture,emissiveFactor:i.emissiveColor?.toUnitRGB(),occlusionTexture:i.occlusionTexture}),m={usePBR:this._usePBR(),isSchematic:u,hasVertexColors:i.hasVertexColors,hasSymbolColors:i.hasSymbolVertexColors,hasVertexTangents:i.hasVertexTangents,ambient:P,diffuse:A,opacity:1,doubleSided:!0,doubleSidedType:"winding-order",cullFace:0,layerOpacity:this._getLayerOpacity(),hasSlicePlane:this._context.slicePlaneEnabled,drivenOpacity:this.needsDrivenTransparentPass||c.isComponentTransparent};m.mrrFactors=u?Re:[i.metallic,i.roughness,Me[2]],t.material&&(m.doubleSided=t.material.doubleSided,m.cullFace=t.material.doubleSided?0:2,m.textureAlphaCutoff=t.material.alphaCutoff),this._setExternalMaterialParameters(m),this._setMaterialTextureAlphaMode(m,c),this._setInternalMaterialParameters(i,m,c);const f=new we(m,this._context);return c.material=f,this._materialInfoCache.set(i.uid,c),f}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchColor(e,t)}_preparePatchColor(e,t){if(!t.material||"partial"!==t.material.type)return;const r=t.material.diff;if(!r.color||"complete"!==r.color.type||null==r.color.newValue||null==r.color.oldValue)return;const o=r.color.newValue;delete r.color,e.symbolLayerStatePatches.push(()=>{this._updateMaterialParameters(e=>{const t=e.material.parameters;this._setExternalMaterialParameters(t,o),this._setMaterialTextureAlphaMode(t,e),e.material.setParameters({externalColor:t.externalColor})})})}_usePBR(){return this._context.physicalBasedRenderingEnabled}_setMaterialTextureAlphaMode(e,t){if("auto"===t.alphaMode){const r=this.needsDrivenTransparentPass||t.isComponentTransparent||(e.layerOpacity??1)<1||(e.opacity??1)<1||(e.externalColor?.[3]??1)<1;e.textureAlphaMode=r?3:1}else e.textureAlphaMode="opaque"===t.alphaMode?1:"mask"===t.alphaMode?2:0}_createFaceDebugNormals(e,t){const r=t.length,o=e.spatialReference.isGeographic?20015077/180:1,n=.1*Math.max(e.extent.width*o,e.extent.height*o,e.extent.zmax-e.extent.zmin),s=[],l=[],c=t[0].transformation,u=a(i(),c);for(let a=0;a<r;a++){const e=t[a].attributes.get("position");if(!e)continue;const r=e.data,o=e.indices;for(let t=0;t<o.length;t+=3)Ve(r,o,t,Ze),Oe(r,o,t,Je,Qe,Xe),x(Je,Je,Qe),x(Je,Je,Xe),_(Je,Je,1/3),y(Je,Je,c),s.push(...Je),T(Ze,Ze,u),b(Ze,Ze),v(Je,Je,Ze,n),s.push(...Je),l.push(l.length),l.push(l.length)}return s.length?new Te(this._debugFaceNormalMaterial,[["position",new ye(s,l,3,!0)]],null,2):null}_createPerVertexDebugVectors(e,t,r,o,n){const l=t.length,c=e.spatialReference.isGeographic?20015077/180:1,u=.1*n*Math.max(e.extent.width*c,e.extent.height*c,e.extent.zmax-e.extent.zmin),m=[],f=[],p=t[0].transformation,h=a(i(),p);"tangent"===r&&s(h,p);for(let a=0;a<l;a++){const e=t[a],o=e.attributes.get("position"),n=e.attributes.get(r);if(!o||!n)continue;const s=o.data,i=o.indices,l=n.data,c=n.indices;for(let t=0;t<i.length;t++){const e=3*i[t],r=c[t]*n.stride;g(Je,s[e+0],s[e+1],s[e+2]),y(Je,Je,p),m.push(...Je),g(Qe,l[r+0],l[r+1],l[r+2]),T(Qe,Qe,h),b(Qe,Qe),v(Je,Je,Qe,u),m.push(...Je),f.push(f.length),f.push(f.length)}}return m.length?new Te(o,[["position",new ye(m,f,3,!0)]],null,2):null}_createAs3DShape(e,t,r,o){const n=e.geometry;if("mesh"!==n.type)return null;const a=this._createGeometryInfo(n,t,o);if(null==a)return null;const{geometries:s,objectTransformation:i}=a;if(_e.DRAW_MESH_GEOMETRY_NORMALS){const e=this._createPerVertexDebugVectors(n,s,"normal",this._debugVertexNormalMaterial,1),t=this._createPerVertexDebugVectors(n,s,"tangent",this._debugTangentNormalMaterial,.5),r=this._createFaceDebugNormals(n,s);e&&s.push(e),t&&s.push(t),r&&s.push(r)}const l=this._context.layerViewUid,c=new ve({geometries:s,layerViewUid:l,graphicUid:o,isElevationSource:!0});c.transformation=i;const u=xe(this.symbolLayer,{opacity:this._getLayerOpacity()}),m=u?new ue(s[0].material,u,this._context.slicePlaneEnabled):null,f=new ce(this,c,null,se,r,m);this._fastUpdateProcessor.onAddGraphic(),f.needsElevationUpdates=ie(r.mode),f.useObjectOriginAsAttachmentOrigin=!0,f.fastTransformUpdatesAllowed=this._fastTransformUpdatesAllowed(n),r.centerInElevationSR=this._getCenterInElevationSR(c.transformation);const{elevationProvider:p,renderCoordsHelper:h}=this._context,d=(e,t)=>le(e,p,r,h,t);return f.alignedSampledElevation=se(f,r,p.spatialReference,d,h),f}_fastTransformUpdatesAllowed(e){const{vertexSpace:t,spatialReference:r}=e;if(!k(t))return!1;const{type:o}=t,{view:n}=this._context.graphicsCoreOwner,{viewingMode:a}=n.state,s=n.spatialReference;return 1===a&&"local"===o||2===a&&q(s,r)&&"georeferenced"===o&&!r.isGeographic}_getElevationSR(){return this._context.elevationProvider.spatialReference??null}_getCenterInElevationSR(e){const t=M(),r=g(nt,e[12],e[13],e[14]);return E(r,this._context.renderCoordsHelper.spatialReference,t,this._getElevationSR()),t}_passthroughReprojectionInfo(e){return 0===e.reprojection&&!!e.objectTransformation}_createPositionBuffer(e,t){const r=e.vertexAttributes.position;let o,n=r;if(0===t.reprojection)return{position:n,georeferencedPositionBuffer:o};const a=1===t.reprojection?t.transformBeforeProject:null;a&&(n=Y(new Float64Array(n.length),n,a));const{normal:s,tangent:i}=e.vertexAttributes;this._passthroughReprojectionInfo(t)||!s&&!i||(o=n);const l=n===r||n===o?new Float64Array(n.length):n;return U(n,e.spatialReference,0,l,this._context.renderCoordsHelper.spatialReference,0),{position:l,georeferencedPositionBuffer:o}}_createNormalBuffer(e,t,r,o){const n=e.vertexAttributes.normal;if(null==n)return null;let a=n;const s=1===o.reprojection?o.transformBeforeProject:null;s&&(a=K(a,new Float32Array(a.length),s));const i=this._context.graphicsCoreOwner.view.viewingMode;if(0===o.reprojection)return a;if("local"===i){if(!W(this._context.renderCoordsHelper.spatialReference))return a;if(null==r)return null;if(e.spatialReference.isGeographic){const e=a===n?new Float32Array(a.length):a;return J(a,0,r,e)}if(e.spatialReference.isWebMercator){const e=a===n?new Float32Array(a.length):a;return Q(a,0,r,e)}return a}if(null==r)return null;const l=a===n?new Float32Array(a.length):a,c=this._context.renderCoordsHelper.spatialReference;return X(a,r,e.spatialReference,t,c,l)}_createTangentBuffer(e,t,r,o){const n=e.vertexAttributes.tangent;if(null==n)return null;let a=n;const s=1===o.reprojection?o.transformBeforeProject:null;s&&(a=Z(a,new Float32Array(a.length),s));const i=this._context.graphicsCoreOwner.view.viewingMode;if(0===o.reprojection)return a;if("local"===i){if(!W(this._context.renderCoordsHelper.spatialReference))return a;if(null==r)return null;if(e.spatialReference.isGeographic){const e=a===n?new Float32Array(a.length):a;return J(a,1,r,e)}if(e.spatialReference.isWebMercator){const e=a===n?new Float32Array(a.length):a;return Q(a,1,r,e)}return a}if(null==r)return null;const l=a===n?new Float32Array(a.length):a,c=this._context.renderCoordsHelper.spatialReference;return ee(a,r,e.spatialReference,t,c,l)}_createSymbolColorBuffer(e){return this._requiresSymbolVertexColors()?new Uint8Array(this._getDrivenUInt8ColorWithNaNSupport(e,this._materialColor,!0)):null}_createBuffers(e,t){const r=e.vertexAttributes&&e.vertexAttributes.position;if(!r)return this.logger.warn("Mesh geometry must contain position vertex attributes"),null;const o=e.vertexAttributes.normal,n=e.vertexAttributes.uv,a=e.vertexAttributes.tangent;if(o&&o.length!==r.length)return this.logger.warn("Mesh normal vertex buffer must contain the same number of elements as the position buffer"),null;if(a&&a.length/4!=r.length/3)return this.logger.warn("Mesh tangent vertex buffer must contain the same number of elements as the position buffer"),null;if(n&&n.length/2!=r.length/3)return this.logger.warn("Mesh uv vertex buffer must contain the same number of elements as the position buffer"),null;const s=this._computeReprojectionInfo(e),{position:i,georeferencedPositionBuffer:l}=this._createPositionBuffer(e,s),c=qe(e),u=this._createSymbolColorBuffer(t),m=this._createNormalBuffer(e,i,l,s),p=this._createTangentBuffer(e,i,l,s),h=n,{transformation:d,position:g,normal:x,tangent:_}=this._passthroughReprojectionInfo(s)?{transformation:s.objectTransformation,position:i,normal:m,tangent:p}:this._transformOriginLocal(e,i,m,p);return{positionBuffer:g,normalBuffer:x,tangentBuffer:_,uvBuffer:h,colorBuffer:c,symbolColorBuffer:u,objectTransformation:d,geometryTransformation:0===s.reprojection&&s.geometryTransformation?s.geometryTransformation:f()}}_computeReprojectionInfo(e){const{vertexSpace:t}=e,r="georeferenced"===t.type?q(this._context.renderCoordsHelper.spatialReference,e.spatialReference)?0:1:0;if(z(t))return{reprojection:r};const o=t.origin,n=f(),a=e.transform?.localMatrix??p;if(0===r){B(e.spatialReference,o,n,this._context.renderCoordsHelper.spatialReference);return{reprojection:r,objectTransformation:n,geometryTransformation:h(a)}}const s=l(f(),o);return c(s,s,a),{reprojection:r,transformBeforeProject:s}}_transformOriginLocal(e,t,r,o){const n=this._context.renderCoordsHelper.spatialReference,a=e.origin;Ke[0]=a.x,Ke[1]=a.y,Ke[2]=a.z??0;const s=f();B(e.spatialReference,Ke,s,n),u(et,s);const{position:i,normal:l,tangent:c}=e.vertexAttributes,m=t===i?new Float64Array(t.length):t;Y(m,t,et);const p=r?r===l?new Float32Array(r.length):r:null,h=o?o===c?new Float32Array(o.length):o:null;return r&&p&&K(r,p,et),o&&h&&Z(o,h,et),{transformation:s,position:m,normal:p,tangent:h}}_validateFaces(e,t){const r=e.vertexAttributes.position.length/3,o=t.faces;if(o){let e=-1;for(let t=0;t<o.length;t++){const r=o[t];r>e&&(e=r)}if(r<=e)return this.logger.warn(`Vertex index ${e} is out of bounds of the mesh position buffer`),!1}else if(r%3!=0)return this.logger.warn("Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)"),!1;return!0}_isOutsideClippingArea(e){if(!this._context.clippingExtent)return!1;const t=e.vertexAttributes?.position;if(!t)return!1;const r=this._context.elevationProvider.spatialReference,o=te(e,r??e.spatialReference);return!!o&&(F(o,rt),!V(rt,this._context.clippingExtent))}_createGeometryInfo(e,t,r){if(!I(e.spatialReference,this._context.renderCoordsHelper.spatialReference))return this.logger.warn("Geometry spatial reference is not compatible with the view"),null;if(!this._validateVertexSpace(e))return null;if(this._isOutsideClippingArea(e))return null;const o=this._createBuffers(e,t);if(null==o)return null;const{positionBuffer:n,uvBuffer:a,colorBuffer:s,symbolColorBuffer:i,normalBuffer:l,tangentBuffer:c,objectTransformation:u,geometryTransformation:f}=o,p=e.components??ot,h=new Array;let d=!1;const g=m(Je,u),x=this._context.localOriginFactory.getOrigin(g);for(const m of p){if(!this._validateFaces(e,m))return null;const t=Ie(e,m);if(0===t.length)continue;const o=Be(n,l,m,t);o.didFlipNormals&&(d=!0);const u=[["position",new ye(n,t,3,!0)],["normal",new ye(o.normals,o.indices,3,!0)]];s&&u.push(["color",new ye(s,t,4,!0)]),i&&u.push(["symbolColor",new ye(i,G(t.length),4,!0)]),a&&u.push(["uv0",new ye(a,t,2,!0)]),c&&u.push(["tangent",new ye(c,t,4,!0)]);const p=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:r,layerViewUid:this._context.layerViewUid}),g=this._getOrCreateMaterial(e,m),_=new Te(g,u,null,0,p);_.transformation=f,_.localOrigin=x,h.push(_)}return d&&this.logger.warn("Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals."),{geometries:h,objectTransformation:u}}_updateMaterialParameters(e){this._materialInfoCache.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachClonedMaterial((e,t)=>{t.setParameters(e.parameters)})}_validateVertexSpace(e){const{_context:{graphicsCoreOwner:{view:{state:{viewingMode:t}}}}}=this,{vertexSpace:r}=e;return 2!==t||"local"!==r.type||(this.logger.warn("Displaying a mesh with a local vertex space in a view in local viewing mode is not supported."),!1)}test(){return{...super.test(),materials:this._materialInfoCache.materials}}get _materialColor(){return this.symbolLayer.material?.color}}class Se{constructor(e,t,r){this.normals=e,this.indices=t,this.didFlipNormals=r}}function Ie(e,t){return t.faces??D(e.vertexAttributes.position.length/3)}function Be(e,t,r,o){switch(r.shading||"flat"){default:case"source":return Ee(e,t,r,o);case"flat":return Ue(e,o);case"smooth":return Fe(e,o)}}function Ue(e,t){const r=$(t.length),o=new Array(3*t.length);for(let n=0;n<t.length;n+=3){const a=Ve(e,t,n,Ze);for(let e=0;e<3;e++)r[n+e]=a[e],o[n+e]=n/3}return new Se(r,o,!1)}function Ee(e,t,r,o){if(null==t)return Ue(e,o);let n=!1;if(!r.trustSourceNormals)for(let a=0;a<o.length;a+=3){Ve(e,o,a,Ze);for(let e=0;e<3;e++){const r=3*o[a+e];Je[0]=t[r],Je[1]=t[r+1],Je[2]=t[r+2],j(Ze,Je)<0&&(t[r]=-t[r],t[r+1]=-t[r+1],t[r+2]=-t[r+2],n=!0)}}return new Se(t,o,n)}function Fe(e,t){const r={};for(let a=0;a<t.length;a+=3){const o=Ve(e,t,a,Ze);for(let e=0;e<3;e++){const n=t[a+e];let s=r[n];s||(s={normal:M(),count:0},r[n]=s),x(s.normal,s.normal,o),s.count++}}const o=$(3*t.length),n=new Array(3*t.length);for(let a=0;a<t.length;a++){const e=r[t[a]];1!==e.count&&(b(e.normal,e.normal),e.count=1);for(let t=0;t<3;t++)o[3*a+t]=e.normal[t];n[a]=a}return new Se(o,n,!1)}function Oe(e,t,r,o,n,a){const s=3*t[r],i=3*t[r+1],l=3*t[r+2];o[0]=e[s],o[1]=e[s+1],o[2]=e[s+2],n[0]=e[i],n[1]=e[i+1],n[2]=e[i+2],a[0]=e[l],a[1]=e[l+1],a[2]=e[l+2]}function Ve(e,t,r,o){return Oe(e,t,r,Je,Qe,Xe),w(Qe,Qe,Je),w(Xe,Xe,Je),C(Je,Qe,Xe),b(o,Je),o}function $e(e){if(!e)return null;const{scale:t,offset:o,rotation:n}=e;return{scale:t,offset:o,rotation:r(n)}}function Ge(e="repeat"){if("string"==typeof e){const t=De(e);return{s:t,t}}return{s:De(e.horizontal),t:De(e.vertical)}}function De(e){switch(e){case"clamp":return 33071;case"mirror":return 33648;default:return 10497}}function Le(e){const t=e.vertexAttributes.color;if(null==t)return!1;for(let r=3;r<t.length;r+=4)if(255!==t[r])return!0;return!1}function Ne(e,t,r){t.diffuse=e.toUnitRGB(),t.opacity="opaque"===r.alphaMode?1:e.a}function He(e){return e.data??e.url}function ke(t){return null==t?"-":t instanceof e?t.toHex():t.contentHash}function ze(e){const{offset:t,scale:r,rotation:o}=e??Ye;return`${t[0]},${t[1]},${o},${r[0]},${r[1]}`}function qe(e){return e.vertexAttributes.color}function We(e){return 1===(e.material?.color?.a??0)}const Ye=new H,Ke=M(),Je=M(),Qe=M(),Xe=M(),Ze=M(),et=f(),tt=f(),rt=O(),ot=[new L],nt=M();export{Pe as Graphics3DMeshFillSymbolLayer};
5
+ import e from"../../../../Color.js";import{linearize as t}from"../../../../colorUtils.js";import{deg2rad as r}from"../../../../core/mathUtils.js";import{releaseMaybe as o}from"../../../../core/maybe.js";import{isPromiseLike as n}from"../../../../core/promiseUtils.js";import{normalFromMat4 as a,fromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromTranslation as l,multiply as c,invert as u,getTranslation as m}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as f,IDENTITY as p,clone as h}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as d}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{h as g,i as x,j as _,p as y,t as T,n as b,c as v,e as w,f as C,g as j}from"../../../../chunks/vec32.js";import{create as M,fromValues as R,ONES as A,ZEROS as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as S}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{canProjectWithoutEngine as I}from"../../../../geometry/projectionUtils.js";import{computeTranslationToOriginAndRotation as B}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as U}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as E}from"../../../../geometry/projection/projectVectorToVector.js";import{fromBuffer as F,create as O,intersectsClippingArea as V}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as $}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as G,getContinuousIndexArray as D}from"../../../../geometry/support/Indices.js";import L from"../../../../geometry/support/MeshComponent.js";import N from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import H from"../../../../geometry/support/MeshTextureTransform.js";import{isRelativeVertexSpace as k,isAbsoluteVertexSpace as z}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{equals as q,isPlateCarree as W}from"../../../../geometry/support/spatialReferenceUtils.js";import{t as Y}from"../../../../chunks/vec3.js";import{transformNormal as K,transformVectorENUPlateCarree as J,transformVectorWMPlateCarree as Q,projectNormalToPCPF as X,transformTangent as Z,projectTangentToPCPF as ee}from"../../../../geometry/support/meshUtils/projection.js";import{projectMeshVertexPositions as te}from"../../../../geometry/support/meshUtils/projectMeshVertexPositions.js";import{getEmissiveMode as re}from"../../../../symbols/support/materialUtils.js";import{isEncodedMeshTexture as oe}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as ne}from"../../glTF/internal/TextureTransformUtils.js";import{defaultSymbolLayerMemoryComplexity as ae}from"./defaultSymbolComplexity.js";import{perObjectElevationAligner as se}from"./ElevationAligners.js";import{needsElevationUpdates3D as ie,evaluateElevationInfoAtPoint as le}from"./elevationAlignmentUtils.js";import{Graphics3DMeshObject3DGraphicLayer as ce}from"./Graphics3DMeshObject3DGraphicLayer.js";import{Object3DEdgeState as ue}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as me,nanFallbackColor as fe}from"./Graphics3DSymbolLayer.js";import{MaterialInfoCache as pe,MeshFastUpdateProcessor as he}from"./MeshFastUpdateProcessor.js";import{SymbolComplexity as de}from"./SymbolComplexity.js";import{hasEdges as ge,createMaterial as xe}from"../support/edgeUtils.js";import{debugFlags as _e}from"../../support/debugFlags.js";import{Attribute as ye}from"../../webgl-engine/lib/Attribute.js";import{Geometry as Te}from"../../webgl-engine/lib/Geometry.js";import{ManagedTexture as be}from"../../webgl-engine/lib/ManagedTexture.js";import{Object3D as ve}from"../../webgl-engine/lib/Object3D.js";import{DefaultMaterial as we}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as Ce}from"../../webgl-engine/materials/NativeLineMaterial.js";import{useSchematicPBR as je,advancedMRRFactors as Me,schematicMRRFactors as Re}from"../../webgl-engine/materials/pbrUtils.js";const Ae=["mesh"];class Pe extends me{constructor(e,t,r,o){super(e,t,r,o,We(t)),this._materialInfoCache=new pe,this._fastUpdateProcessor=new he,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){_e.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new Ce({color:[1,0,1,1]}),this._debugTangentNormalMaterial=new Ce({color:[1,.5,0,1]}),this._debugFaceNormalMaterial=new Ce({color:[0,1,1,1]})),this.updateComplexity()}destroy(){super.destroy(),this._textures.forEach(e=>e.unload()),this._context.stage.removeTextures(Array.from(this._textures.values())),this._materialInfoCache.clear(),this._textures.clear(),this._fastUpdateProcessor.destroy()}get materials(){return this._materialInfoCache.materials}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,Ae,"fill on mesh-3d"))return null;const r=this.createElevationContextForGraphic(t),o=e.renderingInfo;return this._createAs3DShape(t,o,r,t.uid)}onRemoveGraphic(e){this._fastUpdateProcessor.onRemoveGraphic(e,this._materialInfoCache)}layerOpacityChanged(e,t){const r=this._getLayerOpacity();this._updateMaterialParameters(e=>{e.material.setParameters({layerOpacity:r});const t=e.material.parameters;this._setMaterialTextureAlphaMode(t,e)}),e?.forEach(e=>t(e)?.layerOpacityChanged(r,this._context.isAsync))}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,ie)}slicePlaneEnabledChanged(e,t){return this._updateMaterialParameters(({material:e})=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),e?.forEach(e=>t(e)?.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)),!0}physicalBasedRenderingChanged(){const e=this._usePBR();return this._updateMaterialParameters(({material:t})=>t.setParameters({usePBR:e})),!0}updateTransform(e,t,r,o){if(!e.fastTransformUpdatesAllowed)return!1;const n=e.fastTransformUpdatesEnabled;switch(o){case 0:if(n)return!0;break;case 1:if(!n)return!0;break;default:if(!n)return!!this.updateTransform(e,t,r,0)&&(e.autoDisableFastTransformUpdates(()=>this.updateTransform(e,t,r,1)),!0)}const a=this._context.renderCoordsHelper.spatialReference,s=tt,{origin:i,transform:l}=r;if(!B(t,g(Je,i.x,i.y,i.z??0),s,a))return!1;switch(o){case 0:this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context);break;case 1:this._fastUpdateProcessor.disable(e,this._materialInfoCache);break;case 2:e.updateFastLocalOrigin(s,l,this._context.localOriginFactory)}const{elevationContext:c}=e;c.centerInElevationSR=this._getCenterInElevationSR(s);const{elevationProvider:u,renderCoordsHelper:m}=this._context,f=(e,t)=>le(e,u,c,m,t);return e.alignedSampledElevation=se(e,c,u.spatialReference,f,m,s),e.updateTransform(s,l,this._context.isAsync),e.updateAutoDisableFastTransformUpdates(()=>this.updateTransform(e,t,r,1)),!0}computeComplexity(){if(!this._textures||0===this._textures.size)return super.computeComplexity();let e=0;for(const o of this._textures.values())e+=o.usedMemory;const t={...ae(this.symbol,this.symbolLayer),resourceBytes:e},r=ge(this.symbolLayer)?2:0;return new de({drawCallsPerFeature:r,memory:t})}_requiresSymbolVertexColors(){return this._hasDrivenColorOrOpacity}_materialPropertiesDefault(e,t){const r=this._requiresSymbolVertexColors(),o=!!e.vertexAttributes.color,n=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:r,hasVertexColors:o,hasVertexTangents:n,uid:`vc:${o},vt:${n},vct${t},svc:${r}`}}_materialProperties(e,t,r){const o=this._materialPropertiesDefault(e,r);if(!t.material)return o;const{color:n,colorTexture:a,colorTextureTransform:s,normalTexture:i,normalTextureTransform:l,doubleSided:c,alphaCutoff:u,alphaMode:m}=t.material,f=ke(n),p=ke(a),h=ze(s),d=ke(i),g=ze(l);if(o.color=n,o.colorTexture=a,o.normalTexture=i,o.uid=`${o.uid},cmuid:${f},ctmuid:${p},cttuid:${h},ntmuid:${d},nttuid:${g},ds:${c},ac:${u},am:${m}`,t.material instanceof N){const{metallic:e,roughness:r,metallicRoughnessTexture:n,metallicRoughnessTextureTransform:a,emissiveColor:i,emissiveStrength:c,emissiveTexture:u,emissiveTextureTransform:m,occlusionTexture:f,occlusionTextureTransform:p}=t.material,h=ke(n),d=ze(a),g=ke(i),x=ke(u),_=ze(m),y=ke(f),T=ze(p);o.uid=[o.uid,`mrm:${e}`,`mrr:${r}`,`mrt:${h}`,`mrtt:${d}`,`emuid:${g}`,`ems:${c}`,`etmuid:${x}`,`ett:${_}`,`otmuid:${y}`,`ott:${T}`].join(","),o.metallic=e,o.roughness=r,o.metallicRoughnessTexture=n,o.emissiveColor=i,o.emissiveStrength=c,o.emissiveTexture=u,o.occlusionTexture=f,o.colorTextureTransform=$e(s),o.normalTextureTransform=$e(l),o.emissiveTextureTransform=$e(m),o.occlusionTextureTransform=$e(p),o.metallicRoughnessTextureTransform=$e(a)}return o}_getInternalTexture(e,t=!1,r=1){const a=He(e);if(!a)return null;const s=`${e.contentHash}/${r}`;let i=this._textures.get(s);if(i){const e=this._context.stage.renderView.textures;let t=null;const r=e.acquire(i.id);return null==r||n(r)||(i.events.on("unloaded",()=>t=o(t)),t=r),i}let l=null;const c=this._context.stage.renderView.renderingContext.parameters.maxMaxAnisotropy,u={wrap:Ge(e.wrap),noUnpackFlip:!0,maxAnisotropy:c,mipmap:c>1};return oe(a)?(l=a.data,u.preMultiplyAlpha=!1,u.encoding=a.encoding):(l=a,u.preMultiplyAlpha=1!==r,u.compressionOptions=t?{compressionTracker:this._context.compressionTracker,compressionCallback:()=>this.updateComplexity()}:void 0),i=new be(l,u),this._textures.set(s,i),i.events.on("loaded",()=>this.updateComplexity()),i.load(this._context.stage.renderView.renderingContext),this._context.stage.addTexture(i),i.events.on("unloaded",()=>{this._textures.delete(s)}),i}_setInternalMaterialTextureParameters(e,r){if(null!=e.colorTexture){const t=1!==r.textureAlphaMode,o=this._getInternalTexture(e.colorTexture,t,r.textureAlphaMode);o?(r.textureId=o.id,r.textureAlphaPremultiplied=!!o.parameters.preMultiplyAlpha):r.textureId=void 0}if(e.normalTexture&&(r.normalTextureId=this._getInternalTexture(e.normalTexture)?.id),e.emissiveColor){const o=e.emissiveColor?.toUnitRGB();r.emissiveBaseColor=R(t(o[0]),t(o[1]),t(o[2]))}e.emissiveStrength&&(r.emissiveStrengthKHR=e.emissiveStrength),e.emissiveTexture&&(r.emissiveTextureId=this._getInternalTexture(e.emissiveTexture)?.id),e.occlusionTexture&&(r.occlusionTextureId=this._getInternalTexture(e.occlusionTexture,!0)?.id),e.metallicRoughnessTexture&&(r.metallicRoughnessTextureId=this._getInternalTexture(e.metallicRoughnessTexture,!0)?.id)}_setInternalMaterialParameters(e,t,r){null!=e.color&&Ne(e.color,t,r),this._setInternalMaterialTextureParameters(e,t),t.colorTextureTransformMatrix=ne(e.colorTextureTransform),t.normalTextureTransformMatrix=ne(e.normalTextureTransform);const o=null!=e.normalTextureTransform?.scale?e.normalTextureTransform?.scale:d;t.scale=[o[0],o[1]],t.occlusionTextureTransformMatrix=ne(e.occlusionTextureTransform),t.emissiveTextureTransformMatrix=ne(e.emissiveTextureTransform),t.metallicRoughnessTextureTransformMatrix=ne(e.metallicRoughnessTextureTransform)}_setExternalMaterialParameters(e,t=this._materialColor){const r=this._drivenProperties.color,o=this._drivenProperties.opacity;if(r)e.externalColor=S;else{const r=t??null;if(r){const t=r.toUnitRGBA();o&&(t[3]=1),e.externalColor=t}else e.externalColor=fe}e.colorMixMode=this.symbolLayer.material?.colorMixMode??"multiply",e.castShadows=!!this.symbolLayer.castShadows,e.emissiveStrengthFromSymbol=this.symbolLayer?.material?.emissive?.strength??1,e.emissiveSource=re(this.symbolLayer?.material?.emissive?.source??"emissive")}_getOrCreateMaterial(e,t){const r=t.material?.color,o=t.material?.colorTexture,n=t.material?.alphaMode,a="blend"===n,s=!("opaque"===n)&&(Le(e)||null!=r&&r.a<1||o?.transparent||a),i=this._materialProperties(e,t,s),l=this._materialInfoCache.byUid(i.uid);if(l)return this._setInternalMaterialTextureParameters(i,l.material.parameters),l.material;const c={uid:i.uid,material:null,isComponentTransparent:s,alphaMode:t.material?t.material.alphaMode:"opaque"},u=je({normalTexture:i.normalTexture,metallicRoughnessTexture:i.metallicRoughnessTexture,metallicFactor:i.metallic,roughnessFactor:i.roughness,emissiveTexture:i.emissiveTexture,emissiveFactor:i.emissiveColor?.toUnitRGB(),occlusionTexture:i.occlusionTexture}),m={usePBR:this._usePBR(),isSchematic:u,hasVertexColors:i.hasVertexColors,hasSymbolColors:i.hasSymbolVertexColors,hasVertexTangents:i.hasVertexTangents,ambient:P,diffuse:A,opacity:1,doubleSided:!0,doubleSidedType:"winding-order",cullFace:0,layerOpacity:this._getLayerOpacity(),hasSlicePlane:this._context.slicePlaneEnabled,drivenOpacity:this.needsDrivenTransparentPass||c.isComponentTransparent};m.mrrFactors=u?Re:[i.metallic,i.roughness,Me[2]],t.material&&(m.doubleSided=t.material.doubleSided,m.cullFace=t.material.doubleSided?0:2,m.textureAlphaCutoff=t.material.alphaCutoff),this._setExternalMaterialParameters(m),this._setMaterialTextureAlphaMode(m,c),this._setInternalMaterialParameters(i,m,c);const f=new we(m,this._context);return c.material=f,this._materialInfoCache.set(i.uid,c),f}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchColor(e,t)}_preparePatchColor(e,t){if(!t.material||"partial"!==t.material.type)return;const r=t.material.diff;if(!r.color||"complete"!==r.color.type||null==r.color.newValue||null==r.color.oldValue)return;const o=r.color.newValue;delete r.color,e.symbolLayerStatePatches.push(()=>{this._updateMaterialParameters(e=>{const t=e.material.parameters;this._setExternalMaterialParameters(t,o),this._setMaterialTextureAlphaMode(t,e),e.material.setParameters({externalColor:t.externalColor})})})}_usePBR(){return this._context.physicalBasedRenderingEnabled}_setMaterialTextureAlphaMode(e,t){if("auto"===t.alphaMode){const r=this.needsDrivenTransparentPass||t.isComponentTransparent||(e.layerOpacity??1)<1||(e.opacity??1)<1||(e.externalColor?.[3]??1)<1;e.textureAlphaMode=r?3:1}else e.textureAlphaMode="opaque"===t.alphaMode?1:"mask"===t.alphaMode?2:0}_createFaceDebugNormals(e,t){const r=t.length,o=e.spatialReference.isGeographic?20015077/180:1,n=.1*Math.max(e.extent.width*o,e.extent.height*o,e.extent.zmax-e.extent.zmin),s=[],l=[],c=t[0].transformation,u=a(i(),c);for(let a=0;a<r;a++){const e=t[a].attributes.get("position");if(!e)continue;const r=e.data,o=e.indices;for(let t=0;t<o.length;t+=3)Ve(r,o,t,Ze),Oe(r,o,t,Je,Qe,Xe),x(Je,Je,Qe),x(Je,Je,Xe),_(Je,Je,1/3),y(Je,Je,c),s.push(...Je),T(Ze,Ze,u),b(Ze,Ze),v(Je,Je,Ze,n),s.push(...Je),l.push(l.length),l.push(l.length)}return s.length?new Te(this._debugFaceNormalMaterial,[["position",new ye(s,l,3,!0)]],null,2):null}_createPerVertexDebugVectors(e,t,r,o,n){const l=t.length,c=e.spatialReference.isGeographic?20015077/180:1,u=.1*n*Math.max(e.extent.width*c,e.extent.height*c,e.extent.zmax-e.extent.zmin),m=[],f=[],p=t[0].transformation,h=a(i(),p);"tangent"===r&&s(h,p);for(let a=0;a<l;a++){const e=t[a],o=e.attributes.get("position"),n=e.attributes.get(r);if(!o||!n)continue;const s=o.data,i=o.indices,l=n.data,c=n.indices;for(let t=0;t<i.length;t++){const e=3*i[t],r=c[t]*n.stride;g(Je,s[e+0],s[e+1],s[e+2]),y(Je,Je,p),m.push(...Je),g(Qe,l[r+0],l[r+1],l[r+2]),T(Qe,Qe,h),b(Qe,Qe),v(Je,Je,Qe,u),m.push(...Je),f.push(f.length),f.push(f.length)}}return m.length?new Te(o,[["position",new ye(m,f,3,!0)]],null,2):null}_createAs3DShape(e,t,r,o){const n=e.geometry;if("mesh"!==n.type)return null;const a=this._createGeometryInfo(n,t,o);if(null==a)return null;const{geometries:s,objectTransformation:i}=a;if(_e.DRAW_MESH_GEOMETRY_NORMALS){const e=this._createPerVertexDebugVectors(n,s,"normal",this._debugVertexNormalMaterial,1),t=this._createPerVertexDebugVectors(n,s,"tangent",this._debugTangentNormalMaterial,.5),r=this._createFaceDebugNormals(n,s);e&&s.push(e),t&&s.push(t),r&&s.push(r)}const l=this._context.layerViewUid,c=new ve({geometries:s,layerViewUid:l,graphicUid:o,isElevationSource:!0});c.transformation=i;const u=xe(this.symbolLayer,{opacity:this._getLayerOpacity()}),m=u?new ue(s[0].material,u,this._context.slicePlaneEnabled):null,f=new ce(this,c,null,se,r,m);this._fastUpdateProcessor.onAddGraphic(),f.needsElevationUpdates=ie(r.mode),f.useObjectOriginAsAttachmentOrigin=!0,f.fastTransformUpdatesAllowed=this._fastTransformUpdatesAllowed(n),r.centerInElevationSR=this._getCenterInElevationSR(c.transformation);const{elevationProvider:p,renderCoordsHelper:h}=this._context,d=(e,t)=>le(e,p,r,h,t);return f.alignedSampledElevation=se(f,r,p.spatialReference,d,h),f}_fastTransformUpdatesAllowed(e){const{vertexSpace:t,spatialReference:r}=e;if(!k(t))return!1;const{type:o}=t,{view:n}=this._context.graphicsCoreOwner,{viewingMode:a}=n.state,s=n.spatialReference;return 1===a&&"local"===o||2===a&&q(s,r)&&"georeferenced"===o&&!r.isGeographic}_getElevationSR(){return this._context.elevationProvider.spatialReference??null}_getCenterInElevationSR(e){const t=M(),r=g(nt,e[12],e[13],e[14]);return E(r,this._context.renderCoordsHelper.spatialReference,t,this._getElevationSR()),t}_passthroughReprojectionInfo(e){return 0===e.reprojection&&!!e.objectTransformation}_createPositionBuffer(e,t){const r=e.vertexAttributes.position;let o,n=r;if(0===t.reprojection)return{position:n,georeferencedPositionBuffer:o};const a=1===t.reprojection?t.transformBeforeProject:null;a&&(n=Y(new Float64Array(n.length),n,a));const{normal:s,tangent:i}=e.vertexAttributes;this._passthroughReprojectionInfo(t)||!s&&!i||(o=n);const l=n===r||n===o?new Float64Array(n.length):n;return U(n,e.spatialReference,0,l,this._context.renderCoordsHelper.spatialReference,0),{position:l,georeferencedPositionBuffer:o}}_createNormalBuffer(e,t,r,o){const n=e.vertexAttributes.normal;if(null==n)return null;let a=n;const s=1===o.reprojection?o.transformBeforeProject:null;s&&(a=K(a,new Float32Array(a.length),s));const i=this._context.graphicsCoreOwner.view.viewingMode;if(0===o.reprojection)return a;if("local"===i){if(!W(this._context.renderCoordsHelper.spatialReference))return a;if(null==r)return null;if(e.spatialReference.isGeographic){const e=a===n?new Float32Array(a.length):a;return J(a,0,r,e)}if(e.spatialReference.isWebMercator){const e=a===n?new Float32Array(a.length):a;return Q(a,0,r,e)}return a}if(null==r)return null;const l=a===n?new Float32Array(a.length):a,c=this._context.renderCoordsHelper.spatialReference;return X(a,r,e.spatialReference,t,c,l)}_createTangentBuffer(e,t,r,o){const n=e.vertexAttributes.tangent;if(null==n)return null;let a=n;const s=1===o.reprojection?o.transformBeforeProject:null;s&&(a=Z(a,new Float32Array(a.length),s));const i=this._context.graphicsCoreOwner.view.viewingMode;if(0===o.reprojection)return a;if("local"===i){if(!W(this._context.renderCoordsHelper.spatialReference))return a;if(null==r)return null;if(e.spatialReference.isGeographic){const e=a===n?new Float32Array(a.length):a;return J(a,1,r,e)}if(e.spatialReference.isWebMercator){const e=a===n?new Float32Array(a.length):a;return Q(a,1,r,e)}return a}if(null==r)return null;const l=a===n?new Float32Array(a.length):a,c=this._context.renderCoordsHelper.spatialReference;return ee(a,r,e.spatialReference,t,c,l)}_createSymbolColorBuffer(e){return this._requiresSymbolVertexColors()?new Uint8Array(this._getDrivenUInt8ColorWithNaNSupport(e,this._materialColor,!0)):null}_createBuffers(e,t){const r=e.vertexAttributes&&e.vertexAttributes.position;if(!r)return this.logger.warn("Mesh geometry must contain position vertex attributes"),null;const o=e.vertexAttributes.normal,n=e.vertexAttributes.uv,a=e.vertexAttributes.tangent;if(o&&o.length!==r.length)return this.logger.warn("Mesh normal vertex buffer must contain the same number of elements as the position buffer"),null;if(a&&a.length/4!=r.length/3)return this.logger.warn("Mesh tangent vertex buffer must contain the same number of elements as the position buffer"),null;if(n&&n.length/2!=r.length/3)return this.logger.warn("Mesh uv vertex buffer must contain the same number of elements as the position buffer"),null;const s=this._computeReprojectionInfo(e),{position:i,georeferencedPositionBuffer:l}=this._createPositionBuffer(e,s),c=qe(e),u=this._createSymbolColorBuffer(t),m=this._createNormalBuffer(e,i,l,s),p=this._createTangentBuffer(e,i,l,s),h=n,{transformation:d,position:g,normal:x,tangent:_}=this._passthroughReprojectionInfo(s)?{transformation:s.objectTransformation,position:i,normal:m,tangent:p}:this._transformOriginLocal(e,i,m,p);return{positionBuffer:g,normalBuffer:x,tangentBuffer:_,uvBuffer:h,colorBuffer:c,symbolColorBuffer:u,objectTransformation:d,geometryTransformation:0===s.reprojection&&s.geometryTransformation?s.geometryTransformation:f()}}_computeReprojectionInfo(e){const{vertexSpace:t}=e,r="georeferenced"===t.type?q(this._context.renderCoordsHelper.spatialReference,e.spatialReference)?0:1:0;if(z(t))return{reprojection:r};const o=t.origin,n=f(),a=e.transform?.localMatrix??p;if(0===r){B(e.spatialReference,o,n,this._context.renderCoordsHelper.spatialReference);return{reprojection:r,objectTransformation:n,geometryTransformation:h(a)}}const s=l(f(),o);return c(s,s,a),{reprojection:r,transformBeforeProject:s}}_transformOriginLocal(e,t,r,o){const n=this._context.renderCoordsHelper.spatialReference,a=e.origin;Ke[0]=a.x,Ke[1]=a.y,Ke[2]=a.z??0;const s=f();B(e.spatialReference,Ke,s,n),u(et,s);const{position:i,normal:l,tangent:c}=e.vertexAttributes,m=t===i?new Float64Array(t.length):t;Y(m,t,et);const p=r?r===l?new Float32Array(r.length):r:null,h=o?o===c?new Float32Array(o.length):o:null;return r&&p&&K(r,p,et),o&&h&&Z(o,h,et),{transformation:s,position:m,normal:p,tangent:h}}_validateFaces(e,t){const r=e.vertexAttributes.position.length/3,o=t.faces;if(o){let e=-1;for(let t=0;t<o.length;t++){const r=o[t];r>e&&(e=r)}if(r<=e)return this.logger.warn(`Vertex index ${e} is out of bounds of the mesh position buffer`),!1}else if(r%3!=0)return this.logger.warn("Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)"),!1;return!0}_isOutsideClippingArea(e){if(!this._context.clippingExtent)return!1;const t=e.vertexAttributes?.position;if(!t)return!1;const r=this._context.elevationProvider.spatialReference,o=te(e,r??e.spatialReference);return!!o&&(F(o,rt),!V(rt,this._context.clippingExtent))}_createGeometryInfo(e,t,r){if(!I(e.spatialReference,this._context.renderCoordsHelper.spatialReference))return this.logger.warn("Geometry spatial reference is not compatible with the view"),null;if(!this._validateVertexSpace(e))return null;if(this._isOutsideClippingArea(e))return null;const o=this._createBuffers(e,t);if(null==o)return null;const{positionBuffer:n,uvBuffer:a,colorBuffer:s,symbolColorBuffer:i,normalBuffer:l,tangentBuffer:c,objectTransformation:u,geometryTransformation:f}=o,p=e.components??ot,h=new Array;let d=!1;const g=m(Je,u),x=this._context.localOriginFactory.getOrigin(g);for(const m of p){if(!this._validateFaces(e,m))return null;const t=Ie(e,m);if(0===t.length)continue;const o=Be(n,l,m,t);o.didFlipNormals&&(d=!0);const u=[["position",new ye(n,t,3,!0)],["normal",new ye(o.normals,o.indices,3,!0)]];s&&u.push(["color",new ye(s,t,4,!0)]),i&&u.push(["symbolColor",new ye(i,G(t.length),4,!0)]),a&&u.push(["uv0",new ye(a,t,2,!0)]),c&&u.push(["tangent",new ye(c,t,4,!0)]);const p=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:r,layerViewUid:this._context.layerViewUid}),g=this._getOrCreateMaterial(e,m),_=new Te(g,u,null,0,p);_.transformation=f,_.localOrigin=x,h.push(_)}return d&&this.logger.warn("Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals."),{geometries:h,objectTransformation:u}}_updateMaterialParameters(e){this._materialInfoCache.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachClonedMaterial((e,t)=>{t.setParameters(e.parameters)})}_validateVertexSpace(e){const{_context:{graphicsCoreOwner:{view:{state:{viewingMode:t}}}}}=this,{vertexSpace:r}=e;return 2!==t||"local"!==r.type||(this.logger.warn("Displaying a mesh with a local vertex space in a view in local viewing mode is not supported."),!1)}test(){return{...super.test(),materials:this._materialInfoCache.materials}}get _materialColor(){return this.symbolLayer.material?.color}}class Se{constructor(e,t,r){this.normals=e,this.indices=t,this.didFlipNormals=r}}function Ie(e,t){return t.faces??D(e.vertexAttributes.position.length/3)}function Be(e,t,r,o){switch(r.shading||"flat"){default:case"source":return Ee(e,t,r,o);case"flat":return Ue(e,o);case"smooth":return Fe(e,o)}}function Ue(e,t){const r=$(t.length),o=new Array(3*t.length);for(let n=0;n<t.length;n+=3){const a=Ve(e,t,n,Ze);for(let e=0;e<3;e++)r[n+e]=a[e],o[n+e]=n/3}return new Se(r,o,!1)}function Ee(e,t,r,o){if(null==t)return Ue(e,o);let n=!1;if(!r.trustSourceNormals)for(let a=0;a<o.length;a+=3){Ve(e,o,a,Ze);for(let e=0;e<3;e++){const r=3*o[a+e];Je[0]=t[r],Je[1]=t[r+1],Je[2]=t[r+2],j(Ze,Je)<0&&(t[r]=-t[r],t[r+1]=-t[r+1],t[r+2]=-t[r+2],n=!0)}}return new Se(t,o,n)}function Fe(e,t){const r={};for(let a=0;a<t.length;a+=3){const o=Ve(e,t,a,Ze);for(let e=0;e<3;e++){const n=t[a+e];let s=r[n];s||(s={normal:M(),count:0},r[n]=s),x(s.normal,s.normal,o),s.count++}}const o=$(3*t.length),n=new Array(3*t.length);for(let a=0;a<t.length;a++){const e=r[t[a]];1!==e.count&&(b(e.normal,e.normal),e.count=1);for(let t=0;t<3;t++)o[3*a+t]=e.normal[t];n[a]=a}return new Se(o,n,!1)}function Oe(e,t,r,o,n,a){const s=3*t[r],i=3*t[r+1],l=3*t[r+2];o[0]=e[s],o[1]=e[s+1],o[2]=e[s+2],n[0]=e[i],n[1]=e[i+1],n[2]=e[i+2],a[0]=e[l],a[1]=e[l+1],a[2]=e[l+2]}function Ve(e,t,r,o){return Oe(e,t,r,Je,Qe,Xe),w(Qe,Qe,Je),w(Xe,Xe,Je),C(Je,Qe,Xe),b(o,Je),o}function $e(e){if(!e)return null;const{scale:t,offset:o,rotation:n}=e;return{scale:t,offset:o,rotation:r(n)}}function Ge(e="repeat"){if("string"==typeof e){const t=De(e);return{s:t,t}}return{s:De(e.horizontal),t:De(e.vertical)}}function De(e){switch(e){case"clamp":return 33071;case"mirror":return 33648;default:return 10497}}function Le(e){const t=e.vertexAttributes.color;if(null==t)return!1;for(let r=3;r<t.length;r+=4)if(255!==t[r])return!0;return!1}function Ne(e,t,r){t.diffuse=e.toUnitRGB(),t.opacity="opaque"===r.alphaMode?1:e.a}function He(e){return e.data??e.url}function ke(t){return null==t?"-":t instanceof e?t.toHex():t.contentHash}function ze(e){const{offset:t,scale:r,rotation:o}=e??Ye;return`${t[0]},${t[1]},${o},${r[0]},${r[1]}`}function qe(e){return e.vertexAttributes.color}function We(e){return 1===(e.material?.color?.a??0)}const Ye=new H,Ke=M(),Je=M(),Qe=M(),Xe=M(),Ze=M(),et=f(),tt=f(),rt=O(),ot=[new L],nt=M();export{Pe as Graphics3DMeshFillSymbolLayer};