@arcgis/core 5.0.0-next.53 → 5.0.0-next.55

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 (812) hide show
  1. package/Basemap.d.ts +1 -1
  2. package/Color.js +1 -1
  3. package/Ground.d.ts +4 -6
  4. package/Ground.js +1 -1
  5. package/PopupTemplate.d.ts +2 -2
  6. package/WebLinkChart.d.ts +1 -1
  7. package/WebScene.js +1 -1
  8. package/applications/Components/QuantityFormatter.d.ts +7 -7
  9. package/applications/Components/analysisUtils.d.ts +28 -53
  10. package/applications/Components/baUtils.d.ts +8 -0
  11. package/applications/Components/drawUtils.d.ts +8 -1
  12. package/applications/Components/featureUtils.d.ts +1 -1
  13. package/applications/Components/imageryUtils.d.ts +2 -2
  14. package/applications/Components/layerOriginUtils.d.ts +3 -3
  15. package/applications/Components/reactiveUtils.d.ts +24 -5
  16. package/applications/Excalibur/videoViewUtils.d.ts +2 -2
  17. package/applications/ExperienceBuilder/sketchUtils.d.ts +6 -6
  18. package/applications/KnowledgeStudio/generalSdkInternalAccess.d.ts +7 -13
  19. package/applications/KnowledgeStudio/generalSharedKgUtils.d.ts +7 -7
  20. package/applications/KnowledgeStudio/reshape.d.ts +6 -15
  21. package/applications/MapViewer/mediaUtils.d.ts +4 -4
  22. package/applications/MapViewer/templateUtils.d.ts +3 -3
  23. package/applications/PortalApp/layerUtils.d.ts +10 -0
  24. package/applications/PortalApp/layerUtils.js +5 -0
  25. package/applications/SceneViewer/sceneViewerUtils.d.ts +1 -2
  26. package/arcade/featureSetUtils.js +1 -1
  27. package/arcade/featureset/support/shared.js +1 -1
  28. package/arcade.d.ts +33 -17
  29. package/assets/esri/core/workers/RemoteClient.js +1 -1
  30. package/assets/esri/core/workers/chunks/{5aa354854219361f722b.js → 0099f4729c94c779ba35.js} +1 -1
  31. package/assets/esri/core/workers/chunks/00e407d262c49890afa8.js +1 -0
  32. package/assets/esri/core/workers/chunks/{15a0750c10b510564a42.js → 01d38a9ca9e88c38aab9.js} +1 -1
  33. package/assets/esri/core/workers/chunks/087cf25ca211836a084a.js +1 -0
  34. package/assets/esri/core/workers/chunks/{a3f23f08337e101e4e64.js → 097001462d93b78b64f4.js} +1 -1
  35. package/assets/esri/core/workers/chunks/0a39c6dc57bd60d5587e.js +1 -0
  36. package/assets/esri/core/workers/chunks/0d1e8d5d9abee38e275e.js +316 -0
  37. package/assets/esri/core/workers/chunks/{cef873da468668eb95cb.js → 14765f98b8ea447498a1.js} +6 -7
  38. package/assets/esri/core/workers/chunks/{da922e861d5845ae0979.js → 1ab98591d2f2bc604505.js} +1 -1
  39. package/assets/esri/core/workers/chunks/1b2e17c04c34cfa671a1.js +1 -0
  40. package/assets/esri/core/workers/chunks/211837df0edada4414c5.js +1 -0
  41. package/assets/esri/core/workers/chunks/22b07c54a5fcc27771b0.js +1 -0
  42. package/assets/esri/core/workers/chunks/{cd8fec3500e6503ae020.js → 23a9dd9454d5249bbd59.js} +1 -1
  43. package/assets/esri/core/workers/chunks/311c4914a4f69f3c1525.js +1 -0
  44. package/assets/esri/core/workers/chunks/{108675a17e432a02cf66.js → 35cbc61a006351620ead.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{1bf4b5e5402790ccb450.js → 369f37060608342a4262.js} +1 -1
  46. package/assets/esri/core/workers/chunks/3b5e71b156244789f624.js +1 -0
  47. package/assets/esri/core/workers/chunks/3f0959b1abafe516146e.js +1 -0
  48. package/assets/esri/core/workers/chunks/{308fb48d080e01499a26.js → 436f206898306df019ac.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{553ca1e55e9f1359839c.js → 44c228388a95fa958827.js} +1 -1
  50. package/assets/esri/core/workers/chunks/454c15367cccbf63af7a.js +1 -0
  51. package/assets/esri/core/workers/chunks/{11ab10668632648b2ba7.js → 492d575894c7905bb70c.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{f3d8d5fe15501220792d.js → 495b11fdecc3ba90d454.js} +1 -1
  53. package/assets/esri/core/workers/chunks/4f33a2ecb154a2c2449c.js +1 -0
  54. package/assets/esri/core/workers/chunks/{b1d3d2c93c189e215f67.js → 5047acfd66539eefe353.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{cddce67919e13e2f365e.js → 51fd6662245b920af652.js} +1 -1
  56. package/assets/esri/core/workers/chunks/52726458f590e726d52c.js +1 -0
  57. package/assets/esri/core/workers/chunks/5873c7b65d0fb04998fb.js +1 -0
  58. package/assets/esri/core/workers/chunks/{d677b378449257103ec4.js → 58cf5b9a6aa685fc3367.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{395a0773ccafd1f24c4d.js → 5d31fbabaa875f8627c0.js} +1 -1
  60. package/assets/esri/core/workers/chunks/67a45faa80316f43c51b.js +1 -0
  61. package/assets/esri/core/workers/chunks/6d09965ab2bff9da88b6.js +1 -0
  62. package/assets/esri/core/workers/chunks/{521aac8a665e98e4ca78.js → 700122f775b98a7ed353.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{a92c1171314a68504c1b.js → 7353d78feba7e6302b6e.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{13ce8e8d45779b11ee12.js → 7f4fa2f2e85863d3cfb9.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{a4f89568205d78d91cfe.js → 80c36f1786ae0be00962.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{549f4ab9e285deaf04fb.js → 81d89107ff82604a3ea0.js} +1 -1
  67. package/assets/esri/core/workers/chunks/8208c073e606973ea1ad.js +1 -0
  68. package/assets/esri/core/workers/chunks/{62ed6b45482e39d67785.js → 893a5ab0c2df9262efd8.js} +1 -1
  69. package/assets/esri/core/workers/chunks/{1f0c7ab33e466a37c7f9.js → 8c1f1eb36198ce40ef13.js} +1 -1
  70. package/assets/esri/core/workers/chunks/92928c56b312e1514600.js +1 -0
  71. package/assets/esri/core/workers/chunks/94929cf2b9fc66a93882.js +1 -0
  72. package/assets/esri/core/workers/chunks/94f02082a006003ef5a9.js +1 -0
  73. package/assets/esri/core/workers/chunks/951e3c911a3486b1e609.js +1 -0
  74. package/assets/esri/core/workers/chunks/{54666586754949bfa584.js → 983356eb4fd0a0dcf3fd.js} +1 -1
  75. package/assets/esri/core/workers/chunks/a16e75ff5cd9b22be197.js +1 -0
  76. package/assets/esri/core/workers/chunks/{36d9208895abd1ba4ff1.js → a623676c74745e040a2a.js} +1 -1
  77. package/assets/esri/core/workers/chunks/{1065fd655bb7cee243fd.js → a624dd283d264dce35a8.js} +1 -1
  78. package/assets/esri/core/workers/chunks/{2dfaead2ec6434513d45.js → a6742abe3ebe371e85f1.js} +1 -1
  79. package/assets/esri/core/workers/chunks/acc7ff44bfcb5c195114.js +1 -0
  80. package/assets/esri/core/workers/chunks/ad92427bf597a6e0a299.js +1 -0
  81. package/assets/esri/core/workers/chunks/{640085b5ade5c7f16228.js → b285de471ca90f38ec25.js} +1 -1
  82. package/assets/esri/core/workers/chunks/b8f83a272fc41765031d.js +1 -0
  83. package/assets/esri/core/workers/chunks/{19270a2de33f2662005b.js → b93f2bd6429879f92143.js} +1 -1
  84. package/assets/esri/core/workers/chunks/be6cc8a1485961f22372.js +1 -0
  85. package/assets/esri/core/workers/chunks/{bf5a120bc0c4851dbb69.js → bef2a70d382515b3c84e.js} +1 -1
  86. package/assets/esri/core/workers/chunks/{e2973e5626e5039209f9.js → c448540065690cac0744.js} +1 -1
  87. package/assets/esri/core/workers/chunks/{95057105f1b3bf805140.js → cd2ea924cb91cdb6dde9.js} +1 -1
  88. package/assets/esri/core/workers/chunks/d199deff988eaefe18b4.js +1 -0
  89. package/assets/esri/core/workers/chunks/{2ef4c0092c59a98a5532.js → d54988c21ea5667d00b7.js} +1 -1
  90. package/assets/esri/core/workers/chunks/d94a2ad5a91de7086fbe.js +1 -0
  91. package/assets/esri/core/workers/chunks/d9736c783513e9c9b22f.js +1 -0
  92. package/assets/esri/core/workers/chunks/{23396a6318edf9264c1f.js → dcf6f7001f470f76bd3e.js} +1 -1
  93. package/assets/esri/core/workers/chunks/dd99b77a7c0a052507bb.js +33 -0
  94. package/assets/esri/core/workers/chunks/{cd39a53ef74f47604977.js → e03c706e327f4989280a.js} +1 -1
  95. package/assets/esri/core/workers/chunks/e47535f795b15608a6cb.js +1 -0
  96. package/assets/esri/core/workers/chunks/e572ffc1d000e4e6325f.js +1 -0
  97. package/assets/esri/core/workers/chunks/ed38c1043e6a83f49f93.js +1 -0
  98. package/assets/esri/core/workers/chunks/f44f358db5c56d5bbc0c.js +1 -0
  99. package/assets/esri/core/workers/chunks/fa95c9248fbfab338f2e.js +1 -0
  100. package/chunks/ChapmanAtmosphere.glsl.js +12 -9
  101. package/chunks/ComponentShader.glsl.js +29 -29
  102. package/chunks/GlowComposition.glsl.js +1 -1
  103. package/chunks/Haze.glsl.js +15 -21
  104. package/chunks/RasterColorizer.glsl.js +10 -10
  105. package/chunks/Viewshed.glsl.js +1 -1
  106. package/config.d.ts +1 -1
  107. package/config.js +1 -1
  108. package/core/Collection.d.ts +1 -1
  109. package/core/Error.d.ts +1 -1
  110. package/core/Evented.d.ts +1 -1
  111. package/core/accessorSupport/decorators.d.ts +1 -1
  112. package/core/colorUtils.js +1 -1
  113. package/editing/sharedTemplates/SharedTemplate.d.ts +1 -1
  114. package/editing/sharedTemplates/SharedTemplateMetadata.d.ts +1 -1
  115. package/geometry/Mesh.d.ts +1 -2
  116. package/geometry/coordinateFormatter.d.ts +1 -1
  117. package/geometry/projection/projectPointToVector.js +1 -1
  118. package/geometry/projectionUtils.js +1 -1
  119. package/geometry/support/MeshMaterial.d.ts +1 -1
  120. package/geometry/support/MeshMaterialMetallicRoughness.d.ts +1 -1
  121. package/geometry/support/MeshTexture.d.ts +1 -1
  122. package/geometry/support/meshUtils/{interfaces.d.ts → types.d.ts} +10 -1
  123. package/geometry/support/meshUtils.d.ts +1 -1
  124. package/geometry/support/normalizeUtils.d.ts +1 -1
  125. package/geometry/support/typeUtils.d.ts +3 -1
  126. package/geometry/support/typeUtils.js +1 -1
  127. package/{views/3d/glTF/internal/resourceUtils.d.ts → geometry/types.d.ts} +5 -1
  128. package/interfaces.d.ts +779 -812
  129. package/intl/date.d.ts +1 -1
  130. package/kernel.js +1 -1
  131. package/layers/CSVLayer.d.ts +3 -3
  132. package/layers/CatalogLayer.d.ts +1 -1
  133. package/layers/FeatureLayer.d.ts +7 -4
  134. package/layers/GaussianSplatLayer.d.ts +22 -0
  135. package/layers/GeoJSONLayer.d.ts +3 -3
  136. package/layers/ImageryTileLayer.d.ts +9 -9
  137. package/layers/MapImageLayer.d.ts +2 -2
  138. package/layers/OrientedImageryLayer.d.ts +2 -2
  139. package/layers/ParquetLayer.d.ts +1 -1
  140. package/layers/RouteLayer.d.ts +3 -3
  141. package/layers/SceneLayer.d.ts +3 -3
  142. package/layers/SubtypeGroupLayer.d.ts +1 -1
  143. package/layers/VectorTileLayer.d.ts +3 -3
  144. package/layers/VideoLayer.d.ts +2 -2
  145. package/layers/WCSLayer.d.ts +1 -1
  146. package/layers/WFSLayer.d.ts +3 -3
  147. package/layers/catalog/CatalogFootprintLayer.d.ts +3 -3
  148. package/layers/graphics/sources/OGCFeatureSource.js +1 -1
  149. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  150. package/layers/graphics/sources/support/clientSideDefaults.js +1 -1
  151. package/layers/knowledgeGraph/KnowledgeGraphSublayer.d.ts +2 -2
  152. package/layers/knowledgeGraph/layerUtils.js +1 -1
  153. package/layers/mixins/ArcGISImageService.d.ts +7 -7
  154. package/layers/mixins/BlendLayer.d.ts +2 -2
  155. package/layers/mixins/EditBusLayer.d.ts +6 -0
  156. package/layers/mixins/FeatureLayerBase.d.ts +2 -2
  157. package/layers/mixins/ImageryTileMixin.d.ts +4 -4
  158. package/layers/mixins/properties/ILayerWithGetFeatureTitle.d.ts +1 -1
  159. package/layers/ogc/wcsUtils.d.ts +1 -1
  160. package/layers/orientedImagery/transformations/imageToWorld.d.ts +2 -2
  161. package/layers/orientedImagery/transformations/{interfaces.d.ts → types.d.ts} +1 -1
  162. package/layers/orientedImagery/transformations/worldToImage.d.ts +2 -2
  163. package/layers/raster/datasets/wcsCapabilitiesParser.d.ts +1 -1
  164. package/layers/raster/datasets/wcsCoverageParser.d.ts +1 -1
  165. package/layers/raster/functions/creators/createAppearenceFunctions.d.ts +2 -2
  166. package/layers/raster/functions/creators/createBandIndexFunctions.d.ts +1 -1
  167. package/layers/raster/functions/creators/createChangeFunctions.d.ts +1 -1
  168. package/layers/raster/functions/creators/createConversionFunctions.d.ts +1 -1
  169. package/layers/raster/functions/creators/createDataManagementFunctions.d.ts +2 -2
  170. package/layers/raster/functions/creators/createLocalFunctions.d.ts +1 -1
  171. package/layers/raster/functions/creators/createMultiRasterAnalysisFunctions.d.ts +1 -1
  172. package/layers/raster/functions/creators/createStatisticsFunctions.d.ts +1 -1
  173. package/layers/raster/functions/creators/createSurfaceFunctions.d.ts +1 -1
  174. package/layers/support/ControlPoint.d.ts +3 -3
  175. package/layers/support/ControlPointsGeoreference.d.ts +6 -6
  176. package/layers/support/EditingCapabilities.d.ts +2 -2
  177. package/layers/support/FeatureEffect.d.ts +3 -3
  178. package/layers/support/LabelClass.d.ts +1 -1
  179. package/layers/support/RasterInfo.d.ts +1 -1
  180. package/layers/support/SpriteSource.d.ts +1 -1
  181. package/layers/support/StreamConnection.d.ts +1 -1
  182. package/layers/support/Sublayer.d.ts +1 -1
  183. package/layers/support/SubtypeSublayer.d.ts +15 -2
  184. package/layers/support/TimeInfo.d.ts +1 -1
  185. package/layers/support/capabilities.js +1 -1
  186. package/layers/support/layerUtils.js +1 -1
  187. package/layers/support/rasterFunctionUtils.d.ts +1 -1
  188. package/layers/support/serviceCapabilitiesUtils.js +1 -1
  189. package/layers/support/{interfaces.d.ts → types.d.ts} +6 -6
  190. package/layers/{interfaces.d.ts → types.d.ts} +18 -1
  191. package/linkChart/ChronologicalLayoutSettings.d.ts +1 -1
  192. package/linkChart/OrganicLayoutSettings.d.ts +1 -1
  193. package/networks/Network.d.ts +4 -4
  194. package/networks/UtilityNetwork.d.ts +8 -8
  195. package/networks/support/TopologyValidationJobInfo.d.ts +1 -1
  196. package/networks/support/TraceJobInfo.d.ts +1 -1
  197. package/package.json +1 -1
  198. package/popup/content/CustomContent.d.ts +1 -1
  199. package/portal/PortalItem.d.ts +1 -1
  200. package/portal/PortalItemResource.d.ts +1 -1
  201. package/portal/PortalUser.d.ts +2 -2
  202. package/renderers/FlowRenderer.d.ts +1 -1
  203. package/renderers/RasterStretchRenderer.d.ts +2 -2
  204. package/renderers/Renderer.d.ts +1 -1
  205. package/renderers/VectorFieldRenderer.d.ts +1 -1
  206. package/renderers/mixins/VisualVariablesMixin.d.ts +3 -3
  207. package/renderers/support/AuthoringInfo.d.ts +1 -1
  208. package/renderers/support/rasterRendererHelper.d.ts +1 -1
  209. package/renderers/support/renderingInfoUtils.js +1 -1
  210. package/renderers/{interfaces.d.ts → types.d.ts} +3 -1
  211. package/renderers/visualVariables/SizeVariable.d.ts +1 -1
  212. package/renderers/visualVariables/VisualVariable.d.ts +1 -1
  213. package/request/{interfaces.d.ts → types.d.ts} +10 -10
  214. package/request.d.ts +4 -4
  215. package/rest/closestFacility.d.ts +1 -1
  216. package/rest/featureService/FeatureService.d.ts +1 -1
  217. package/rest/featureService/FeatureService.js +1 -1
  218. package/rest/featureService/{interfaces.d.ts → types.d.ts} +16 -3
  219. package/rest/featureService/utils.d.ts +1 -1
  220. package/rest/find.d.ts +1 -1
  221. package/rest/geometryService.d.ts +1 -1
  222. package/rest/geoprocessor.d.ts +1 -1
  223. package/rest/identify.d.ts +1 -1
  224. package/rest/imageService.d.ts +5 -5
  225. package/rest/knowledgeGraphService.d.ts +19 -19
  226. package/rest/lastMileDelivery.d.ts +1 -1
  227. package/rest/locator.d.ts +1 -1
  228. package/rest/networkService.d.ts +1 -1
  229. package/rest/networks/queryAssociations.d.ts +1 -1
  230. package/rest/networks/synthesizeAssociationGeometries.d.ts +1 -1
  231. package/rest/networks/trace.d.ts +1 -1
  232. package/rest/places.d.ts +1 -1
  233. package/rest/print.d.ts +2 -2
  234. package/rest/query.d.ts +2 -2
  235. package/rest/route.d.ts +1 -1
  236. package/rest/serviceArea.d.ts +1 -1
  237. package/rest/support/AddressToLocationsParameters.d.ts +1 -1
  238. package/rest/support/AddressesToLocationsParameters.d.ts +1 -1
  239. package/rest/support/AttributeBinsQuery.d.ts +3 -3
  240. package/rest/support/JobInfo.d.ts +2 -2
  241. package/rest/support/LastMileDeliveryParameters.d.ts +1 -1
  242. package/rest/support/LocationToAddressParameters.d.ts +1 -1
  243. package/rest/support/ParameterValue.d.ts +1 -1
  244. package/rest/support/ProjectParameters.d.ts +1 -1
  245. package/rest/symbolService.d.ts +3 -3
  246. package/smartMapping/heuristics/binLevel.d.ts +1 -1
  247. package/smartMapping/heuristics/scaleRange.d.ts +1 -1
  248. package/smartMapping/heuristics/sizeRange.d.ts +1 -1
  249. package/smartMapping/heuristics/{interfaces.d.ts → types.d.ts} +1 -1
  250. package/smartMapping/labels/clusters.d.ts +1 -1
  251. package/smartMapping/popup/clusters.d.ts +1 -1
  252. package/smartMapping/popup/templates.d.ts +1 -1
  253. package/smartMapping/raster/renderers/classBreaks.d.ts +2 -2
  254. package/smartMapping/raster/renderers/colormap.d.ts +1 -1
  255. package/smartMapping/raster/renderers/flow.d.ts +4 -4
  256. package/smartMapping/raster/renderers/rgb.d.ts +2 -2
  257. package/smartMapping/raster/renderers/shadedRelief.d.ts +1 -1
  258. package/smartMapping/raster/renderers/stretch.d.ts +2 -2
  259. package/smartMapping/raster/renderers/{interfaces.d.ts → types.d.ts} +1 -1
  260. package/smartMapping/raster/renderers/uniqueValue.d.ts +1 -1
  261. package/smartMapping/raster/renderers/vectorField.d.ts +1 -1
  262. package/smartMapping/raster/support/utils.d.ts +1 -1
  263. package/smartMapping/renderers/color.d.ts +4 -4
  264. package/smartMapping/renderers/dotDensity.d.ts +3 -3
  265. package/smartMapping/renderers/heatmap.d.ts +3 -3
  266. package/smartMapping/renderers/location.d.ts +2 -2
  267. package/smartMapping/renderers/opacity.d.ts +3 -3
  268. package/smartMapping/renderers/pieChart.d.ts +3 -3
  269. package/smartMapping/renderers/predominance.d.ts +2 -2
  270. package/smartMapping/renderers/relationship.d.ts +4 -4
  271. package/smartMapping/renderers/size.d.ts +4 -4
  272. package/smartMapping/renderers/support/rendererUtils.d.ts +1 -1
  273. package/smartMapping/renderers/type.d.ts +3 -3
  274. package/smartMapping/renderers/univariateColorSize.d.ts +4 -4
  275. package/smartMapping/statistics/classBreaks.d.ts +2 -2
  276. package/smartMapping/statistics/heatmapStatistics.d.ts +2 -2
  277. package/smartMapping/statistics/histogram.d.ts +1 -2
  278. package/smartMapping/statistics/predominantCategories.d.ts +2 -2
  279. package/smartMapping/statistics/summaryStatistics.d.ts +2 -2
  280. package/smartMapping/statistics/summaryStatisticsForAge.d.ts +1 -1
  281. package/smartMapping/statistics/support/ageUtils.d.ts +1 -1
  282. package/smartMapping/statistics/types.d.ts +571 -0
  283. package/smartMapping/statistics/uniqueValues.d.ts +2 -2
  284. package/smartMapping/symbology/color.d.ts +1 -1
  285. package/smartMapping/symbology/dotDensity.d.ts +1 -1
  286. package/smartMapping/symbology/flow.d.ts +1 -1
  287. package/smartMapping/symbology/heatmap.d.ts +1 -1
  288. package/smartMapping/symbology/location.d.ts +1 -1
  289. package/smartMapping/symbology/pieChart.d.ts +1 -1
  290. package/smartMapping/symbology/predominance.d.ts +1 -1
  291. package/smartMapping/symbology/relationship.d.ts +1 -1
  292. package/smartMapping/symbology/size.d.ts +1 -1
  293. package/smartMapping/symbology/support/colorRamps.d.ts +1 -1
  294. package/smartMapping/symbology/type.d.ts +1 -1
  295. package/smartMapping/types.d.ts +18 -0
  296. package/support/groundUtils.js +1 -1
  297. package/support/revision.js +1 -1
  298. package/support/tests/setupServiceMocksMesh.js +1 -1
  299. package/support/timeUtils.d.ts +1 -1
  300. package/symbols/LineStyleMarker3D.d.ts +1 -1
  301. package/symbols/LineSymbol3DLayer.d.ts +1 -1
  302. package/symbols/LineSymbolMarker.d.ts +1 -1
  303. package/symbols/PathSymbol3DLayer.d.ts +1 -1
  304. package/symbols/SimpleLineSymbol.d.ts +1 -1
  305. package/symbols/patterns/LineStylePattern3D.d.ts +1 -1
  306. package/symbols/patterns/StylePattern3D.d.ts +1 -1
  307. package/symbols/support/ElevationInfo.d.ts +1 -1
  308. package/symbols/support/Symbol3DOutline.d.ts +1 -1
  309. package/symbols/support/symbolUtils.d.ts +2 -2
  310. package/time/TimeExtent.d.ts +1 -1
  311. package/unionTypes.d.ts +3 -3
  312. package/versionManagement/VersionManagementService.d.ts +1 -1
  313. package/versionManagement/VersionManager.d.ts +3 -3
  314. package/versionManagement/VersioningState.d.ts +1 -1
  315. package/versionManagement/utils.d.ts +1 -1
  316. package/versionManagement/versionAdapters/utils.d.ts +7 -7
  317. package/views/2d/analysis/ElevationProfile/ElevationProfileLineVisualization2D.js +1 -1
  318. package/views/2d/analysis/ElevationProfile/ElevationProfileVisualization2D.js +1 -1
  319. package/views/2d/analysis/ElevationProfileAnalysisView2D.d.ts +1 -2
  320. package/views/2d/engine/vectorTiles/style/StyleProperty.js +1 -1
  321. package/views/2d/layers/BaseLayerView2D.d.ts +2 -2
  322. package/views/2d/layers/BaseLayerViewGL2D.d.ts +9 -9
  323. package/views/2d/layers/ImageryLayerView2D.js +1 -1
  324. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  325. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  326. package/views/2d/layers/types.d.ts +6 -0
  327. package/views/2d/{layers/support/interfaces.d.ts → types.d.ts} +71 -2
  328. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementVisualization.js +1 -1
  329. package/views/3d/analysis/Dimension/DimensionVisualization.js +1 -1
  330. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  331. package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
  332. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementVisualization.js +1 -1
  333. package/views/3d/analysis/ElevationProfile/ElevationProfileLineVisualization3D.js +1 -1
  334. package/views/3d/analysis/ElevationProfile/ElevationProfileVisualization3D.js +1 -1
  335. package/views/3d/analysis/ElevationProfileAnalysisView3D.d.ts +1 -2
  336. package/views/3d/analysis/LineOfSight/LineOfSightManipulators.js +1 -1
  337. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  338. package/views/3d/analysis/LineOfSight/LineOfSightVisualization.js +1 -1
  339. package/views/3d/analysis/ShadowCastAnalysisView3D.d.ts +2 -2
  340. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  341. package/views/3d/analysis/Slice/ResizeManipulator.js +1 -1
  342. package/views/3d/analysis/Slice/RotateManipulator.js +1 -1
  343. package/views/3d/analysis/Slice/ShiftManipulator.js +1 -1
  344. package/views/3d/analysis/Viewshed/ViewshedArrowManipulator.js +1 -1
  345. package/views/3d/analysis/Viewshed/ViewshedConfiguration.js +1 -1
  346. package/views/3d/analysis/Viewshed/ViewshedFieldOfViewManipulation.js +1 -1
  347. package/views/3d/analysis/Viewshed/ViewshedSubVisualization.js +1 -1
  348. package/views/3d/analysis/Viewshed/viewshedToolManipulatorUtils.js +1 -1
  349. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  350. package/views/3d/environment/ChapmanApproximation.glsl.js +9 -10
  351. package/views/3d/environment/ChapmanAtmosphere.glsl.js +1 -1
  352. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  353. package/views/3d/environment/ChapmanAtmosphereTechnique.js +1 -1
  354. package/views/3d/environment/ChapmanRaymarching.glsl.js +7 -9
  355. package/views/3d/environment/CloudsParameters.js +1 -1
  356. package/views/3d/environment/EnvironmentManager.js +1 -1
  357. package/views/3d/environment/PrecipitationTechnique.js +1 -1
  358. package/views/3d/environment/SceneViewEnvironment.d.ts +1 -1
  359. package/views/3d/environment/SimpleAtmosphereTechnique.js +1 -1
  360. package/views/3d/environment/types.d.ts +13 -0
  361. package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
  362. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  363. package/views/3d/interactive/editingTools/manipulations/MoveXYAxisManipulation.js +1 -1
  364. package/views/3d/interactive/editingTools/manipulations/MoveXYDiscManipulation.js +1 -1
  365. package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
  366. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  367. package/views/3d/interactive/editingTools/settings.js +1 -1
  368. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
  369. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DView.js +1 -1
  370. package/views/3d/layers/I3SMeshView3D.js +1 -1
  371. package/views/3d/layers/ImageryLayerView3D.js +1 -1
  372. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  373. package/views/3d/layers/SceneLayerWorker.js +1 -1
  374. package/views/3d/layers/{I3SMeshWorkerHandle.js → SceneLayerWorkerHandle.js} +1 -1
  375. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  376. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  377. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  378. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  379. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  380. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  381. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  382. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  383. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  384. package/views/3d/layers/graphics/pipeline/symbolization/IconSymbolLayerRenderer.js +1 -1
  385. package/views/3d/layers/i3s/I3SClientMaterialUtil.js +1 -1
  386. package/views/3d/layers/support/edgeUtils.js +1 -1
  387. package/views/3d/support/flow/geometryUtils.js +1 -1
  388. package/views/3d/support/viewpointUtils.js +1 -1
  389. package/views/3d/terrain/BlendLayersTechnique.js +1 -1
  390. package/views/3d/terrain/RasterColorizerTechnique.js +1 -1
  391. package/views/3d/terrain/TerrainRenderer.js +1 -1
  392. package/views/3d/webgl/ManagedFBO.d.ts +4 -5
  393. package/views/3d/webgl/RenderNode.d.ts +1 -1
  394. package/views/3d/{webgl-engine/lighting/SceneLighting.d.ts → webgl/types.d.ts} +4 -6
  395. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  396. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  397. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
  398. package/views/3d/webgl-engine/collections/Component/SourceGeometry.js +1 -1
  399. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +2 -2
  400. package/views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js +1 -1
  401. package/views/3d/webgl-engine/core/shaderLibrary/output/ReadDepth.glsl.js +1 -2
  402. package/views/3d/webgl-engine/core/shaderLibrary/raster/RasterColorizer.glsl.js +1 -1
  403. package/views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js +1 -1
  404. package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +18 -27
  405. package/views/3d/webgl-engine/core/shaderModules/Float4sPassUniform.js +1 -1
  406. package/views/3d/webgl-engine/core/shaderModules/FloatsPassUniform.js +1 -1
  407. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechnique.js +1 -1
  408. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueRepository.js +1 -1
  409. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskTechnique.js +1 -1
  410. package/views/3d/webgl-engine/effects/focusArea/FocusAreaOutlineItem.js +1 -1
  411. package/views/3d/webgl-engine/effects/haze/Haze.glsl.js +1 -1
  412. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  413. package/views/3d/webgl-engine/effects/haze/HazeTechnique.js +1 -1
  414. package/views/3d/webgl-engine/effects/highlight/HighlightApplyTechnique.js +1 -1
  415. package/views/3d/webgl-engine/effects/highlight/HighlightBlurTechnique.js +1 -1
  416. package/views/3d/webgl-engine/effects/highlight/HighlightToSingleTechnique.js +1 -1
  417. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  418. package/views/3d/webgl-engine/effects/laserlines/LaserlinePathData.js +1 -1
  419. package/views/3d/webgl-engine/effects/laserlines/LaserlinePathTechnique.js +1 -1
  420. package/views/3d/webgl-engine/effects/stars/StarsTechnique.js +1 -1
  421. package/views/3d/webgl-engine/lib/CutFillColor.js +1 -1
  422. package/views/3d/webgl-engine/lib/DefaultVertexBufferLayouts.js +1 -1
  423. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  424. package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
  425. package/views/3d/webgl-engine/lib/edgeRendering/EdgeShaderTechnique.js +1 -1
  426. package/views/3d/webgl-engine/lib/edgeRendering/bufferLayouts.js +1 -1
  427. package/views/3d/webgl-engine/materials/DefaultLayouts.js +1 -1
  428. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  429. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  430. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  431. package/views/3d/webgl-engine/shaders/CheckerBoardTechnique.js +1 -1
  432. package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
  433. package/views/3d/webgl-engine/shaders/CutFillMaskTechnique.js +1 -1
  434. package/views/3d/webgl-engine/shaders/CutFillTargetDepthTechnique.js +1 -1
  435. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  436. package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
  437. package/views/3d/webgl-engine/shaders/HeatmapDensityTechnique.js +1 -1
  438. package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
  439. package/views/3d/webgl-engine/shaders/LineCalloutTechnique.js +1 -1
  440. package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
  441. package/views/3d/webgl-engine/shaders/MeasurementArrowTechnique.js +1 -1
  442. package/views/3d/webgl-engine/shaders/NativeLineTechnique.js +1 -1
  443. package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
  444. package/views/3d/webgl-engine/shaders/PointRendererTechnique.js +1 -1
  445. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  446. package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechnique.js +1 -1
  447. package/views/3d/webgl-engine/shaders/SlicePlaneMaterialTechnique.js +1 -1
  448. package/views/3d/webgl-engine/shaders/SphereDepthInterpolate.glsl.js +5 -5
  449. package/views/3d/webgl-engine/shaders/TerrainTechnique.js +1 -1
  450. package/views/LinkChartView.d.ts +5 -5
  451. package/views/Magnifier.d.ts +1 -1
  452. package/views/MapView.d.ts +11 -12
  453. package/views/PopupView.d.ts +1 -1
  454. package/views/SceneView.d.ts +19 -23
  455. package/views/VideoView.d.ts +1 -2
  456. package/views/View.d.ts +2 -3
  457. package/views/View2D.d.ts +8 -9
  458. package/views/analysis/ElevationProfile/ElevationProfileHoveredPointVisualization.js +1 -1
  459. package/views/analysis/ElevationProfile/ElevationProfileResult.d.ts +1 -1
  460. package/views/analysis/ElevationProfile/types.d.ts +68 -0
  461. package/views/analysis/types.d.ts +2 -2
  462. package/views/draw/Draw.d.ts +1 -1
  463. package/views/draw/DrawAction.d.ts +1 -1
  464. package/views/draw/DrawOperation.js +1 -1
  465. package/views/draw/PolygonDrawAction.d.ts +1 -1
  466. package/views/draw/PolygonDrawAction.js +1 -1
  467. package/views/draw/PolylineDrawAction.d.ts +1 -1
  468. package/views/draw/PolylineDrawAction.js +1 -1
  469. package/views/draw/support/GraphicMover.js +1 -1
  470. package/views/draw/{interfaces.d.ts → types.d.ts} +3 -1
  471. package/views/input/IViewEvents.d.ts +1 -1
  472. package/views/interactive/Tooltip.d.ts +1 -1
  473. package/views/interactive/sketch/SketchValueOptions.d.ts +1 -1
  474. package/views/interactive/sketch/Units.d.ts +5 -1
  475. package/views/interactive/tooltip/types.d.ts +4 -0
  476. package/views/layers/BuildingComponentSublayerView.d.ts +1 -1
  477. package/views/layers/BuildingSceneLayerView.d.ts +1 -1
  478. package/views/layers/ImageryLayerViewMixin.d.ts +3 -4
  479. package/views/layers/PointCloudLayerView.d.ts +1 -1
  480. package/views/layers/support/highlightUtils.js +1 -1
  481. package/views/navigation/NavigationActionMap.d.ts +1 -1
  482. package/views/support/colorUtils.d.ts +1 -1
  483. package/views/{interfaces.d.ts → types.d.ts} +160 -6
  484. package/views/ui/DefaultUI.d.ts +1 -1
  485. package/views/ui/UI.d.ts +1 -1
  486. package/views/ui/{interfaces.d.ts → types.d.ts} +12 -1
  487. package/webdoc/widgets/FloorFilter.d.ts +2 -2
  488. package/webdoc/widgets/TimeSlider.d.ts +5 -5
  489. package/webmap/InitialViewProperties.d.ts +2 -2
  490. package/webscene/Environment.d.ts +5 -5
  491. package/webscene/InitialViewProperties.d.ts +0 -1
  492. package/webscene/Slide.d.ts +36 -4
  493. package/webscene/Slide.js +1 -1
  494. package/webscene/support/FeatureReference.d.ts +1 -1
  495. package/webscene/support/SlidePopupInfo.d.ts +2 -2
  496. package/webscene/types.d.ts +5 -1
  497. package/widgets/AreaMeasurement2D/AreaMeasurement2DViewModel.d.ts +1 -1
  498. package/widgets/AreaMeasurement3D/AreaMeasurement3DViewModel.d.ts +7 -1
  499. package/widgets/AreaMeasurement3D.d.ts +1 -0
  500. package/widgets/Attachments/AttachmentsViewModel.d.ts +1 -1
  501. package/widgets/Attachments.d.ts +1 -1
  502. package/widgets/Attribution/AttributionViewModel.d.ts +2 -2
  503. package/widgets/BasemapGallery/support/LocalBasemapsSource.d.ts +1 -1
  504. package/widgets/BasemapGallery/support/PortalBasemapsSource.d.ts +1 -1
  505. package/widgets/BasemapGallery.d.ts +1 -1
  506. package/widgets/BasemapLayerList/BasemapLayerListViewModel.d.ts +3 -3
  507. package/widgets/BasemapLayerList.d.ts +2 -2
  508. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.d.ts +4 -4
  509. package/widgets/BatchAttributeForm/inputs/BatchFormInputs.d.ts +1 -1
  510. package/widgets/BatchAttributeForm/inputs/EditableInput.d.ts +1 -1
  511. package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +1 -1
  512. package/widgets/BatchAttributeForm/inputs/GroupInput.d.ts +1 -1
  513. package/widgets/BatchAttributeForm/inputs/InputBase.d.ts +1 -1
  514. package/widgets/BatchAttributeForm/inputs/SingleFeatureInput.d.ts +1 -1
  515. package/widgets/BatchAttributeForm.d.ts +2 -2
  516. package/widgets/Bookmarks/BookmarksViewModel.d.ts +5 -5
  517. package/widgets/Bookmarks/{interfaces.d.ts → types.d.ts} +1 -1
  518. package/widgets/Bookmarks.d.ts +6 -7
  519. package/widgets/BuildingExplorer/BuildingExplorerViewModel.d.ts +1 -0
  520. package/widgets/BuildingExplorer/BuildingLevel.d.ts +1 -0
  521. package/widgets/BuildingExplorer/BuildingNumericFilterViewModel.d.ts +1 -0
  522. package/widgets/BuildingExplorer/BuildingPhase.d.ts +1 -0
  523. package/widgets/BuildingExplorer.d.ts +4 -1
  524. package/widgets/CatalogLayerList/CatalogLayerListViewModel.d.ts +3 -3
  525. package/widgets/CatalogLayerList.d.ts +2 -2
  526. package/widgets/Compass/CompassViewModel.d.ts +1 -1
  527. package/widgets/Compass.d.ts +1 -1
  528. package/widgets/CoordinateConversion/CoordinateConversionViewModel.d.ts +4 -4
  529. package/widgets/CoordinateConversion/support/Conversion.d.ts +1 -1
  530. package/widgets/CoordinateConversion/support/Format.d.ts +2 -2
  531. package/widgets/CoordinateConversion.d.ts +2 -3
  532. package/widgets/Daylight/DaylightViewModel.d.ts +3 -1
  533. package/widgets/Daylight/VisibleElements.d.ts +3 -0
  534. package/widgets/Daylight/types.d.ts +6 -0
  535. package/widgets/Daylight.d.ts +5 -3
  536. package/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.d.ts +7 -1
  537. package/widgets/DirectLineMeasurement3D.d.ts +1 -0
  538. package/widgets/DirectionalPad/DirectionalPadViewModel.d.ts +1 -2
  539. package/widgets/DirectionalPad/{utils.d.ts → types.d.ts} +3 -1
  540. package/widgets/Directions/DirectionsViewModel.d.ts +3 -3
  541. package/widgets/Directions.d.ts +4 -5
  542. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.d.ts +1 -1
  543. package/widgets/Editor/CreateFeaturesWorkflow.d.ts +1 -1
  544. package/widgets/Editor/CreateFeaturesWorkflowData.d.ts +2 -2
  545. package/widgets/Editor/EditorViewModel.d.ts +5 -6
  546. package/widgets/Editor/MergeFeaturesWorkflow.d.ts +1 -1
  547. package/widgets/Editor/SplitFeatureWorkflow.d.ts +1 -2
  548. package/widgets/Editor/SplitFeatureWorkflowData.d.ts +2 -2
  549. package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
  550. package/widgets/Editor/UpdateFeaturesWorkflow.d.ts +1 -1
  551. package/widgets/Editor/UpdateFeaturesWorkflowData.d.ts +1 -1
  552. package/widgets/Editor/UpdateWorkflow.d.ts +1 -1
  553. package/widgets/Editor/Workflow.d.ts +1 -1
  554. package/widgets/Editor/support/EditorEditingCapabilities.d.ts +9 -9
  555. package/widgets/Editor/support/EditorItem.d.ts +4 -4
  556. package/widgets/Editor/support/SketchController.js +1 -1
  557. package/widgets/Editor/{interfaces.d.ts → types.d.ts} +9 -2
  558. package/widgets/Editor/workflowUtils.js +1 -1
  559. package/widgets/Editor.d.ts +10 -11
  560. package/widgets/ElevationProfile/ElevationProfileLine.d.ts +2 -1
  561. package/widgets/ElevationProfile/ElevationProfileLineGround.d.ts +1 -0
  562. package/widgets/ElevationProfile/ElevationProfileLineInput.d.ts +1 -0
  563. package/widgets/ElevationProfile/ElevationProfileLineQuery.d.ts +2 -1
  564. package/widgets/ElevationProfile/ElevationProfileLineView.d.ts +2 -0
  565. package/widgets/ElevationProfile/ElevationProfileViewModel.d.ts +3 -5
  566. package/widgets/ElevationProfile/ElevationProfileVisibleElements.d.ts +3 -0
  567. package/widgets/ElevationProfile/support/ProfileLines3D.js +1 -1
  568. package/widgets/ElevationProfile/types.d.ts +149 -0
  569. package/widgets/ElevationProfile.d.ts +6 -5
  570. package/widgets/Expand/ExpandViewModel.d.ts +1 -1
  571. package/widgets/Expand.d.ts +2 -2
  572. package/widgets/Feature/FeatureViewModel.d.ts +5 -5
  573. package/widgets/Feature/{interfaces.d.ts → types.d.ts} +5 -1
  574. package/widgets/Feature.d.ts +3 -3
  575. package/widgets/FeatureForm/EditableInput.d.ts +1 -1
  576. package/widgets/FeatureForm/FeatureFormViewModel.d.ts +3 -3
  577. package/widgets/FeatureForm/FieldInput.d.ts +1 -1
  578. package/widgets/FeatureForm/GroupInput.d.ts +1 -1
  579. package/widgets/FeatureForm.d.ts +3 -3
  580. package/widgets/FeatureTable/AttachmentsColumn.d.ts +1 -1
  581. package/widgets/FeatureTable/FeatureTableViewModel.d.ts +3 -4
  582. package/widgets/FeatureTable/Grid/Column.d.ts +2 -3
  583. package/widgets/FeatureTable/Grid/{support/interfaces.d.ts → types.d.ts} +57 -0
  584. package/widgets/FeatureTable/RelationshipColumn.d.ts +1 -1
  585. package/widgets/FeatureTable/support/ColumnTemplateBase.d.ts +2 -3
  586. package/widgets/FeatureTable/support/interfaces.d.ts +2 -3
  587. package/widgets/FeatureTable.d.ts +3 -4
  588. package/widgets/FeatureTemplates/FeatureTemplatesViewModel.d.ts +4 -4
  589. package/widgets/FeatureTemplates/TemplateItem.d.ts +1 -1
  590. package/widgets/FeatureTemplates/{interfaces.d.ts → types.d.ts} +1 -1
  591. package/widgets/FeatureTemplates.d.ts +4 -4
  592. package/widgets/Features/FeaturesViewModel.d.ts +12 -12
  593. package/widgets/Features.d.ts +11 -12
  594. package/widgets/FloorFilter.d.ts +1 -1
  595. package/widgets/Histogram/HistogramViewModel.d.ts +3 -3
  596. package/widgets/Histogram.d.ts +3 -3
  597. package/widgets/HistogramRangeSlider/HistogramRangeSliderViewModel.d.ts +3 -3
  598. package/widgets/HistogramRangeSlider.d.ts +11 -11
  599. package/widgets/Home.d.ts +1 -1
  600. package/widgets/LayerList/LayerListViewModel.d.ts +1 -1
  601. package/widgets/LayerList/ListItem.d.ts +1 -1
  602. package/widgets/LayerList/ListItemPanel.d.ts +1 -1
  603. package/widgets/LayerList/{interfaces.d.ts → types.d.ts} +2 -2
  604. package/widgets/LayerList.d.ts +2 -2
  605. package/widgets/Legend/LegendViewModel.d.ts +1 -1
  606. package/widgets/Legend/support/ActiveLayerInfo.d.ts +1 -1
  607. package/widgets/Legend.d.ts +2 -2
  608. package/widgets/LineOfSight/LineOfSightTarget.d.ts +1 -0
  609. package/widgets/LineOfSight/LineOfSightViewModel.d.ts +1 -0
  610. package/widgets/LineOfSight.d.ts +1 -0
  611. package/widgets/Locate/LocateViewModel.d.ts +1 -1
  612. package/widgets/Locate.d.ts +2 -2
  613. package/widgets/Measurement/MeasurementViewModel.d.ts +2 -2
  614. package/widgets/Measurement.d.ts +1 -1
  615. package/widgets/Popup/{interfaces.d.ts → types.d.ts} +2 -0
  616. package/widgets/Popup.d.ts +8 -9
  617. package/widgets/Print/CustomTemplate.d.ts +1 -1
  618. package/widgets/Print/PrintViewModel.d.ts +2 -2
  619. package/widgets/Print.d.ts +2 -2
  620. package/widgets/ScaleRangeSlider.d.ts +2 -2
  621. package/widgets/Search/LocatorSearchSource.d.ts +2 -2
  622. package/widgets/Search/SearchSource.d.ts +3 -3
  623. package/widgets/Search/types.d.ts +64 -0
  624. package/widgets/Search.d.ts +2 -2
  625. package/widgets/ShadowCast/DurationOptions.d.ts +1 -1
  626. package/widgets/ShadowCast/ShadowCastViewModel.d.ts +2 -2
  627. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  628. package/widgets/ShadowCast/{ShadowVisualizationType.d.ts → types.d.ts} +4 -1
  629. package/widgets/ShadowCast.d.ts +1 -1
  630. package/widgets/Sketch/SketchViewModel.d.ts +5 -5
  631. package/widgets/Sketch/{support/interfaces.d.ts → types.d.ts} +17 -17
  632. package/widgets/Sketch.d.ts +1 -1
  633. package/widgets/Slice/SliceViewModel.d.ts +1 -0
  634. package/widgets/Slice.d.ts +2 -1
  635. package/widgets/Slider/SliderViewModel.d.ts +3 -3
  636. package/widgets/Slider/{interfaces.d.ts → types.d.ts} +2 -2
  637. package/widgets/Slider.d.ts +4 -4
  638. package/widgets/Swipe/SwipeViewModel.d.ts +1 -1
  639. package/widgets/Swipe.d.ts +1 -1
  640. package/widgets/TableList/ListItem.d.ts +1 -1
  641. package/widgets/TableList/TableListViewModel.d.ts +2 -2
  642. package/widgets/TableList.d.ts +2 -2
  643. package/widgets/TimeSlider/TimeSliderViewModel.d.ts +5 -5
  644. package/widgets/TimeSlider.d.ts +14 -15
  645. package/widgets/TimeZoneLabel.d.ts +1 -2
  646. package/widgets/Track/TrackViewModel.d.ts +1 -1
  647. package/widgets/Track.d.ts +1 -1
  648. package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
  649. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.d.ts +3 -3
  650. package/widgets/UtilityNetworkTrace/{support/ResultAreaHandler.d.ts → types.d.ts} +2 -2
  651. package/widgets/UtilityNetworkValidateTopology/UtilityNetworkValidateTopologyViewModel.js +1 -1
  652. package/widgets/ValuePicker/ValuePickerSlider.d.ts +1 -1
  653. package/widgets/ValuePicker.d.ts +2 -2
  654. package/widgets/VersionManagement/VersionManagementViewModel.d.ts +3 -3
  655. package/widgets/Weather/VisibleElements.d.ts +3 -0
  656. package/widgets/Weather/WeatherViewModel.d.ts +4 -3
  657. package/widgets/Weather/types.d.ts +9 -0
  658. package/widgets/Weather.d.ts +2 -1
  659. package/widgets/Widget.d.ts +2 -1
  660. package/widgets/smartMapping/BinaryColorSizeSlider.d.ts +0 -3
  661. package/widgets/smartMapping/ClassedColorSlider/ClassedColorSliderViewModel.d.ts +1 -3
  662. package/widgets/smartMapping/ClassedColorSlider.d.ts +2 -2
  663. package/widgets/smartMapping/ClassedSizeSlider/ClassedSizeSliderViewModel.d.ts +1 -2
  664. package/widgets/smartMapping/ClassedSizeSlider.d.ts +2 -2
  665. package/widgets/smartMapping/ColorSizeSlider/ColorSizeSliderViewModel.d.ts +5 -5
  666. package/widgets/smartMapping/ColorSizeSlider.d.ts +3 -2
  667. package/widgets/smartMapping/ColorSlider/ColorSliderViewModel.d.ts +1 -1
  668. package/widgets/smartMapping/ColorSlider.d.ts +1 -1
  669. package/widgets/smartMapping/HeatmapSlider/HeatmapSliderViewModel.d.ts +2 -4
  670. package/widgets/smartMapping/HeatmapSlider.d.ts +2 -4
  671. package/widgets/smartMapping/OpacitySlider/OpacitySliderViewModel.d.ts +1 -1
  672. package/widgets/smartMapping/OpacitySlider.d.ts +1 -1
  673. package/widgets/smartMapping/SizeSlider.d.ts +2 -2
  674. package/widgets/smartMapping/SmartMappingPrimaryHandleSliderViewModel.d.ts +2 -2
  675. package/widgets/smartMapping/SmartMappingSliderBase.d.ts +11 -14
  676. package/widgets/smartMapping/SmartMappingSliderViewModel.d.ts +5 -6
  677. package/widgets/smartMapping/{support/interfaces.d.ts → types.d.ts} +52 -5
  678. package/widgets/support/GeolocationPositioning.d.ts +1 -1
  679. package/widgets/support/GoTo.d.ts +1 -1
  680. package/widgets/support/GridControls/GridControlsViewModel.d.ts +1 -1
  681. package/widgets/support/forms/types.d.ts +4 -0
  682. package/widgets/support/{goToUtils.d.ts → types.d.ts} +9 -2
  683. package/widgets/{interfaces.d.ts → types.d.ts} +71 -15
  684. package/arcade/featureset/support/shared.d.ts +0 -16
  685. package/assets/esri/core/workers/chunks/0359ac6d938e0df936d0.js +0 -1
  686. package/assets/esri/core/workers/chunks/1db058f91a8e17b24db6.js +0 -1
  687. package/assets/esri/core/workers/chunks/1e286fb7bb833f00dd88.js +0 -1
  688. package/assets/esri/core/workers/chunks/262232437d37a7460b11.js +0 -1
  689. package/assets/esri/core/workers/chunks/2d6fa00273a73d44297d.js +0 -1
  690. package/assets/esri/core/workers/chunks/2fae37f34b28a46841e3.js +0 -1
  691. package/assets/esri/core/workers/chunks/3b1471f908fdecec2815.js +0 -1
  692. package/assets/esri/core/workers/chunks/48b3906ac3ec57253d90.js +0 -1
  693. package/assets/esri/core/workers/chunks/49b581782f63abb6dd9f.js +0 -1
  694. package/assets/esri/core/workers/chunks/4abe2c56aecc9e9b8e86.js +0 -1
  695. package/assets/esri/core/workers/chunks/51b78eca012eac92dd07.js +0 -1
  696. package/assets/esri/core/workers/chunks/5ce524e0060053f35592.js +0 -316
  697. package/assets/esri/core/workers/chunks/5d244fcf5c075afccdc6.js +0 -1
  698. package/assets/esri/core/workers/chunks/6b8c15f3970289e73a47.js +0 -1
  699. package/assets/esri/core/workers/chunks/6cfcfebe9a4c491e453a.js +0 -1
  700. package/assets/esri/core/workers/chunks/710b29729f252f11115d.js +0 -1
  701. package/assets/esri/core/workers/chunks/72a520802b8accfd4512.js +0 -1
  702. package/assets/esri/core/workers/chunks/73892ac79b24b05e6863.js +0 -33
  703. package/assets/esri/core/workers/chunks/75d8244b725a2aee2003.js +0 -1
  704. package/assets/esri/core/workers/chunks/93b139be6488a1b4ba19.js +0 -1
  705. package/assets/esri/core/workers/chunks/a5e7c9517939f762c518.js +0 -1
  706. package/assets/esri/core/workers/chunks/a63ff3e9a9f3853d12f3.js +0 -1
  707. package/assets/esri/core/workers/chunks/a81a7cba815adb575c36.js +0 -1
  708. package/assets/esri/core/workers/chunks/a8fd635d1165db8616ab.js +0 -1
  709. package/assets/esri/core/workers/chunks/b638ce18b93d3cfb9967.js +0 -1
  710. package/assets/esri/core/workers/chunks/ba7e97b1e324118b8156.js +0 -1
  711. package/assets/esri/core/workers/chunks/c0d6336c10b4081c4e32.js +0 -1
  712. package/assets/esri/core/workers/chunks/cc4ae105e727d9211d82.js +0 -1
  713. package/assets/esri/core/workers/chunks/d7a62504e00989202c45.js +0 -1
  714. package/assets/esri/core/workers/chunks/e25be3b6b67ce6b03011.js +0 -1
  715. package/assets/esri/core/workers/chunks/e5ac9b048b16fef9840c.js +0 -1
  716. package/assets/esri/core/workers/chunks/ec7e6427d99cf3148a61.js +0 -1
  717. package/assets/esri/core/workers/chunks/efa95c50d1ed8e74219f.js +0 -1
  718. package/assets/esri/core/workers/chunks/f379fd459a103f42d447.js +0 -1
  719. package/assets/esri/core/workers/chunks/ffcdc7ae03b0570e0db8.js +0 -1
  720. package/geometry/interfaces.d.ts +0 -2
  721. package/geometry/support/interfaces.d.ts +0 -3
  722. package/geometry/support/meshUtils/exporters/gltf/interfaces.d.ts +0 -11
  723. package/renderers/support/interfaces.d.ts +0 -2
  724. package/smartMapping/statistics/interfaces.d.ts +0 -571
  725. package/smartMapping/support/adapters/interfaces.d.ts +0 -18
  726. package/views/2d/ViewStateManager.d.ts +0 -2
  727. package/views/2d/interfaces.d.ts +0 -67
  728. package/views/2d/layers/support/clusterUtils.d.ts +0 -6
  729. package/views/3d/environment/lightingUtils.d.ts +0 -4
  730. package/views/3d/environment/weather.d.ts +0 -9
  731. package/views/3d/interactive/visualElements/DrapedVisualElementResources.d.ts +0 -2
  732. package/views/3d/support/QualityProfile.d.ts +0 -2
  733. package/views/SceneViewHitTestResult.d.ts +0 -64
  734. package/views/ViewingMode.d.ts +0 -2
  735. package/views/analysis/ElevationProfile/ElevationProfileHoveredPointsVisualization.js +0 -5
  736. package/views/analysis/ElevationProfile/interfaces.d.ts +0 -73
  737. package/views/draw/DrawingMode.d.ts +0 -2
  738. package/views/draw/support/drawUtils.d.ts +0 -7
  739. package/views/interactive/sketch/interfaces.d.ts +0 -2
  740. package/views/interactive/tooltip/interfaces.d.ts +0 -2
  741. package/views/support/interfaces.d.ts +0 -87
  742. package/views/ui/Padding.d.ts +0 -11
  743. package/views/viewType.d.ts +0 -2
  744. package/views/webgl/enums.d.ts +0 -38
  745. package/webscene/support/featureReferenceUtils.d.ts +0 -4
  746. package/widgets/Daylight/support/daylightUtils.d.ts +0 -4
  747. package/widgets/DirectionalPad/constants.d.ts +0 -2
  748. package/widgets/Editor/support/splitFeatureUtils.d.ts +0 -7
  749. package/widgets/ElevationProfile/ElevationProfileInteraction.d.ts +0 -13
  750. package/widgets/ElevationProfile/elevationProfileLineTypes.d.ts +0 -6
  751. package/widgets/ElevationProfile/interfaces.d.ts +0 -103
  752. package/widgets/ElevationProfile/support/constants.d.ts +0 -14
  753. package/widgets/Feature/support/arcadeFeatureUtils.d.ts +0 -4
  754. package/widgets/FeatureTable/Grid/interfaces.d.ts +0 -57
  755. package/widgets/Popup/actions.d.ts +0 -4
  756. package/widgets/Search/support/interfaces.d.ts +0 -67
  757. package/widgets/ShadowCast/DurationMode.d.ts +0 -3
  758. package/widgets/Weather/enums.d.ts +0 -9
  759. package/widgets/smartMapping/ClassedColorSlider/interfaces.d.ts +0 -19
  760. package/widgets/smartMapping/ClassedSizeSlider/interfaces.d.ts +0 -18
  761. package/widgets/smartMapping/interfaces.d.ts +0 -13
  762. package/widgets/support/Heading.d.ts +0 -7
  763. package/widgets/support/forms/formUtils.d.ts +0 -2
  764. package/widgets/support/forms/interfaces.d.ts +0 -2
  765. package/widgets/support/interfaces.d.ts +0 -56
  766. /package/analysis/{interfaces.d.ts → types.d.ts} +0 -0
  767. /package/core/accessorSupport/{interfaces.d.ts → types.d.ts} +0 -0
  768. /package/core/{interfaces.d.ts → types.d.ts} +0 -0
  769. /package/editing/sharedTemplates/{interfaces.d.ts → types.d.ts} +0 -0
  770. /package/editing/{interfaces.d.ts → types.d.ts} +0 -0
  771. /package/layers/effects/{interfaces.d.ts → types.d.ts} +0 -0
  772. /package/layers/orientedImagery/{interfaces.d.ts → types.d.ts} +0 -0
  773. /package/layers/raster/datasets/{interfaces.d.ts → types.d.ts} +0 -0
  774. /package/layers/raster/functions/{interfaces.d.ts → types.d.ts} +0 -0
  775. /package/linkChart/{interfaces.d.ts → types.d.ts} +0 -0
  776. /package/popup/{interfaces.d.ts → types.d.ts} +0 -0
  777. /package/rest/lastMileDelivery/{interfaces.d.ts → types.d.ts} +0 -0
  778. /package/rest/{interfaces.d.ts → types.d.ts} +0 -0
  779. /package/smartMapping/popup/{interfaces.d.ts → types.d.ts} +0 -0
  780. /package/smartMapping/raster/support/adapters/{interfaces.d.ts → types.d.ts} +0 -0
  781. /package/smartMapping/symbology/{interfaces.d.ts → types.d.ts} +0 -0
  782. /package/statistics/{interfaces.d.ts → types.d.ts} +0 -0
  783. /package/symbols/support/{interfaces.d.ts → types.d.ts} +0 -0
  784. /package/symbols/{interfaces.d.ts → types.d.ts} +0 -0
  785. /package/time/{interfaces.d.ts → types.d.ts} +0 -0
  786. /package/versionManagement/versionAdapters/{interfaces.d.ts → types.d.ts} +0 -0
  787. /package/views/2d/analysis/{interfaces.d.ts → types.d.ts} +0 -0
  788. /package/views/3d/analysis/{interfaces.d.ts → types.d.ts} +0 -0
  789. /package/views/3d/{interfaces.d.ts → types.d.ts} +0 -0
  790. /package/views/animation/{easing.d.ts → types.d.ts} +0 -0
  791. /package/views/draw/{DrawingMode.js → drawingModes.js} +0 -0
  792. /package/views/input/{interfaces.d.ts → types.d.ts} +0 -0
  793. /package/views/navigation/{interfaces.d.ts → types.d.ts} +0 -0
  794. /package/widgets/Attachments/{interfaces.d.ts → types.d.ts} +0 -0
  795. /package/widgets/BasemapGallery/{interfaces.d.ts → types.d.ts} +0 -0
  796. /package/widgets/BasemapLayerList/{interfaces.d.ts → types.d.ts} +0 -0
  797. /package/widgets/BatchAttributeForm/inputs/{interfaces.d.ts → types.d.ts} +0 -0
  798. /package/widgets/BatchAttributeForm/{interfaces.d.ts → types.d.ts} +0 -0
  799. /package/widgets/CatalogLayerList/{interfaces.d.ts → types.d.ts} +0 -0
  800. /package/widgets/FeatureForm/{interfaces.d.ts → types.d.ts} +0 -0
  801. /package/widgets/Histogram/{interfaces.d.ts → types.d.ts} +0 -0
  802. /package/widgets/HistogramRangeSlider/{interfaces.d.ts → types.d.ts} +0 -0
  803. /package/widgets/Measurement/{interfaces.d.ts → types.d.ts} +0 -0
  804. /package/widgets/OrientedImageryViewer/{interfaces.d.ts → types.d.ts} +0 -0
  805. /package/widgets/Print/{interfaces.d.ts → types.d.ts} +0 -0
  806. /package/widgets/ScaleRangeSlider/{interfaces.d.ts → types.d.ts} +0 -0
  807. /package/widgets/Swipe/{interfaces.d.ts → types.d.ts} +0 -0
  808. /package/widgets/TableList/{interfaces.d.ts → types.d.ts} +0 -0
  809. /package/widgets/TimeSlider/{interfaces.d.ts → types.d.ts} +0 -0
  810. /package/widgets/Track/{interfaces.d.ts → types.d.ts} +0 -0
  811. /package/widgets/ValuePicker/{interfaces.d.ts → types.d.ts} +0 -0
  812. /package/widgets/support/GridControls/{interfaces.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 has from"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as i,removeMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{initial as o,watch as n,when as a}from"../../../core/reactiveUtils.js";import{schedule as l}from"../../../core/scheduling.js";import{property as d,subclass as c}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as h,invert as m}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as u,IDENTITY as p}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as f}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as b}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{i as g,b as y,t as _}from"../../../chunks/vec32.js";import{freeze as v,create as w}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as j}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{SphericalECEFSpatialReferenceLike as x,getReferenceEllipsoid as M}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as O}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as C}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as T}from"../../../geometry/projection/projectVectorToVector.js";import{create as E}from"../../../geometry/support/aaBoundingRect.js";import{BufferViewVec2f as R,BufferViewVec4f as U,BufferViewVec4u8 as H,BufferViewVec4u16 as P,BufferViewVec3f as A,BufferViewVec3u8 as S,BufferViewVec3u16 as V,BufferViewInt16 as L,BufferViewUint32 as k,BufferViewUint16 as I}from"../../../geometry/support/buffer/BufferView.js";import F from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as D}from"../../../support/elevationInfoUtils.js";import{toWasmModification as B}from"./I3SMeshWorkerHandle.js";import{LayerView3D as G}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as z}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as N,removeLayerViewFromWasm as W,getLyr3DWasm as $}from"./Lyr3DWasm.js";import{LayerElevationProvider as q}from"./i3s/LayerElevationProvider.js";import{primTypeConversion as J,alphaModeConversion as Z,faceCullingConversion as K,wrapModeConversion as Q,lyr3DTypeToByteSize as X}from"./support/lyr3dTypeConversions.js";import{Tiles3DIntersectionHandler as Y}from"./support/Tiles3DIntersectionHandler.js";import{Frustum as ee}from"../state/Frustum.js";import{ElevationRange as te}from"../support/ElevationRange.js";import{toBoundingRect as ie}from"../support/extentUtils.js";import{compute as se,Obb as re}from"../support/orientedBoundingBox.js";import{ObjectParameters as oe}from"../webgl-engine/collections/Component/ObjectParameters.js";import{GeometryParameters as ne,createVertexBufferLayout as ae,SourceGeometry as le}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as de}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as ce}from"../webgl-engine/core/material/RenderTexture.js";import{getEllipsoidMode as he}from"../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{Attribute as me}from"../webgl-engine/lib/Attribute.js";import{ManagedTexture as ue}from"../webgl-engine/lib/ManagedTexture.js";import{compressAndTransformNormals as pe}from"../webgl-engine/lib/Normals.js";import{writeAttribute as fe,writeBufferVec2 as be}from"../webgl-engine/materials/internal/bufferWriterUtils.js";import ge from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as ye,isInEffectiveScaleRange as _e,validateScaleRange as ve}from"../../support/layerViewUtils.js";import{TextureCompressionTracker as we}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as je}from"../../../webscene/support/AlphaCutoff.js";class xe{constructor(e,t,i,s,r,o,n,a,l,d){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=s,this.vboMemoryUsage=r,this.textureMemoryUsage=o,this.obb=n,this.stableNodeId=a,this.nodeDepth=l,this.elevationRange=d,this.isLoaded=!1,this.isVisible=!1,this.usedMemory=this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage;const c=w();n?.getCenter(c),this._obbCenter=c,this._obbRadius=n?.radius??0,this._obbRadiusSquared=this._obbRadius**2;const h=n?.halfSize;this._obbShortestHalfsize=h?Math.min(h[0],h[1],h[2]):0}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const i=this._obbCenter,s=i[0]-e[0],r=i[1]-e[1],o=i[2]-e[2],n=s*t[0]+r*t[1]+o*t[2];return s*s+r*r+o*o-n*n<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){const{obb:t}=this;if(!t)return!0;const i=e.center,s=this._obbCenter,r=s[0]-i[0],o=s[1]-i[1],n=s[2]-i[2],a=r*r+o*o+n*n,l=this._obbRadius,d=e.radius;if(a>(l+d)**2)return!1;if(a<=(this._obbShortestHalfsize+d)**2)return!0;return Math.sqrt(a)+l<=d||t.intersectSphere(e)}}function Me(e){return Math.round(e/1048.576)/1e3}let Oe=class extends(G(ge)){get hasModifications(){return this._modifications&&this._modifications.length>0}constructor(e){super(e),this.type="integrated-mesh-3dtiles",this._compressionTracker=new we,this._replacesTerrain=!1,this._isUsedAsGroundLayer=!1,this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this.drapeTargetType=1,this._applySSAO=!has("disable-feature:im-ssao"),this._shadeNormals=!!has("enable-feature:im-shading"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._loadedObjects=new Set,this._suspendedHandle=null,this._dbgFlags=new Set,this._memCache=e.view.resourceController.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e)),this._frustum=new ee(e.view.renderCoordsHelper)}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{r(t),this.layer=e}):null}canRecycleWith(e){return e.url===this.layer.url&&"integrated-mesh-3dtiles"===e.type&&e.replacesTerrain===this._replacesTerrain&&e.isUsedAsGroundLayer===this._isUsedAsGroundLayer}initialize(){this._dbgFlags.add(3),this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._replacesTerrain=this.layer.replacesTerrain,this._isUsedAsGroundLayer=this.layer.isUsedAsGroundLayer,this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),o),!this._canProjectWithoutEngine())throw ye("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=N(this).then(t=>{this._wasmLayerId=t,this._intersectionHandler=new Y(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged(),o),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),o),this._updatingHandles.add(()=>e.state.contentCamera,()=>this._cameraChanged(),o),this._elevationProvider=new q({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),e.elevationProvider.register(1,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([n(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),a(()=>this.fullOpacity,()=>this._opacityChange())]),this._suspendedHandle=n(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),o)});this.addResolvingPromise(t)}get fullOpacity(){return this.layer.replacesTerrain&&has("enable-feature:oit-ground")?this.view.map.ground.opacity:1}_opacityChange(){const{fullOpacity:e}=this;this.forEachComponentObject(t=>this._collection.updateMaterial(t,t=>t.objectOpacity=e))}_cameraChanged(){const e=this._frustum;e.update(this.view.state.contentCamera);const t=this._visibleObjects;let i=!1;this._loadedObjects.forEach(s=>{const r=s.obb?.intersectsFrustum(e)??!1;r!==s.isVisible&&(s.isVisible=r,r?t.add(s):t.delete(s),s.componentObjects.forEach(e=>this._collection.setObjectVisibility(e,r)),i=!0)}),i&&this._setVisibleElevationRangeDirty()}intersect(e,t,i,s){this._intersectionHandler.intersect(e,t,i,s,null,!1)}get ready(){return!this.layer.replacesTerrain||!!this._wasm?.isTerrainReady}destroy(){this._dbg(2,"Tiles3DLayerView3D destroy() called"),W(this),this._suspendedHandle&&(this._suspendedHandle.remove(),this._suspendedHandle=null),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>this.forEachComponentObject(t=>e(t.obb))),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._loadedObjects.clear(),this._usedMemory=this._cacheMemory=0,this._memCache.destroy(),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=s(this._visibleGeometryChangedSchedulerHandle)}_modificationsChanged(){const e=this.layer.spatialReference,t=B(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t,e.wkid)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=E();this._layerClippingArea=ie(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=l(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this.layer.replacesTerrain),this.forEachComponentObject(t=>this._collection.updateMaterial(t,t=>t.commonMaterialParameters.hasSlicePlane=e))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,D(e))}get _wasm(){return $(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get visibleAtCurrentScale(){return this.layer.isUsedAsGroundLayer||_e(this.layer.effectiveScaleRange,this.view.scale)}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&(this.layer.isUsedAsGroundLayer||ve(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,i=0,s=0,r=0,o=0;return this._lyrHandleToObjects.forEach(n=>{n.isLoaded?(e+=n.textureMemoryUsage,t+=n.vboMemoryUsage,r++):(i+=n.textureMemoryUsage,s+=n.vboMemoryUsage,o++)}),new z(this.usedMemory,r,o,Me(t),Me(e),Me(s),Me(i))}_canProjectWithoutEngine(){if(2===this.view.state.viewingMode){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return D(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new te(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new te;return 0===this._visibleObjects.size?e.setElevationRangeValues(0,0):(e.setElevationRangeValues(1/0,-1/0),this.forEachVisibleTile(t=>e.expandElevationRange(t.elevationRange))),e}_setVisibleElevationRangeDirty(){this.notifyChange("visibleElevationRange")}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const i of e)for(const e of i.componentObjects)t(e)}isUpdating(){const e=this._wasm;return this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed){const e=`IntegratedMesh3DTilesLayerView3D[${this.layer?.title}]: createRenderable called on destroyed instance`;throw new Error(e)}let t=0;const{meshData:i}=e;if(null==i.data)throw new Error("meshData.data undefined");if(i.desc=JSON.parse(i.desc),null==i.desc)throw new Error("meshData.desc undefined");const s=v(...i.desc.origin),r=this.view.basemapTerrain.spatialReference;let o,n;if("global"===this.view.viewingMode){const e=f();O(x,s,e,r),o=h(u(),e),n=m(u(),o)}else o=p,n=p;const a=w(),l=Re(i.desc.obb);let d=0,c=0;const b={textureMemoryUsage:0},E=new Array,U=new Map,H=i.desc.prims.length,P=new Array,A=new te;try{const e="global"===this.view.viewingMode,t=e?M(this.view.spatialReference).radius:0;for(let h=0;h<H;h++){const m=i.desc.prims[h];this._dbg(2,JSON.stringify(m));if(null==J[m.ptype]||null==i.data){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+m.ptype+"). Skipping primitive.");continue}const u=i.desc?.materials&&null!=m.materialId?i.desc.materials[m.materialId]:null,f=null!=u?u.lightingModel:"Unlit",{positionView:v,positionAttr:x,normalsView:M,normalsAttr:O,colorAttr:H,texCoord0Attr:P,indicesView:S}=this.getBufferViews(m,i.data.buffer,o);if(null==x||null==v||null==S)continue;const V=x.data.length/x.size,L=(e,t)=>!e||e.data.length/e.size===V||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);if(!L(P,"numTexcoord")||!L(H,"numColors")||!L(O,"normals"))continue;const k=new ne(null!=H,P?1:0,null!=M,this._shadeNormals||this.layer.replacesTerrain,this._applySSAO),I=ae(k);for(let i=0;i<v.count;i++){v.getVec(i,a),g(a,a,s);const r=e?y(a)-t:a[2];A.expandElevationRangeValues(r,r)}const F=l?.clone()??Ee(x,s);if(o!==p)for(let e=0;e<v.count;e++)v.getVec(e,a),_(a,a,o),v.setVec(e,a);const D=I.createBuffer(x.data.length);if(fe("position",x,null,null,D,0),null!=P){const e=D.getField("uv0",R);be(P,e,0)}null!=H&&fe("color",H,null,null,D,0),null!=O&&fe("normalCompressed",O,null,null,D,0);const B=new Uint32Array([0,S.typedBuffer.length]),G=new le({data:D.buffer,count:D.byteLength/I.stride,layoutParameters:k},{positions:v.typedBuffer,indices:S.typedBuffer},S.typedBuffer,B);d+=v.count+S.count;const z=this.view.renderSpatialReference,N=w(),W=[1,1,1];C(s,z,W,r)||this._dbg(3,"Unsupported coordinate system for IM overlay"),T(s,z,N,r);let $=()=>{},q=Promise.resolve(He);if(u){const e=e=>this._getTexture(e,i,U,b),t=e(u.baseColorTex),s="Pbr"===f,r=s?e(u.metalTex):null,o=s?e(u.emissiveTex):null,n=s?e(u.occlusionTex):null,a=s?e(u.normalTex):null,l=[t,r,o,n,a].map(e=>e?.loadPromise??null);q=Promise.all(l),$=e=>{e.baseColor=u.baseColorFactor,e.usePBR="Pbr"===f,e.hasParametersFromSource=!1,e.baseColorTexture=t,e.usePBR&&(e.mrrFactors=[u.metallicFactor,u.roughnessFactor,0],e.emissiveBaseColor=u.emissiveFactor??[0,0,0],e.metallicRoughnessTexture=r,e.emissionTexture=o,e.occlusionTexture=n,e.normalTexture=a),e.alphaDiscardMode=Z[u.alphaMode],e.objectOpacity=this.fullOpacity,b.textureMemoryUsage+=e.baseColorTexture?.texture?.usedMemory??0,e.usePBR&&(b.textureMemoryUsage+=(e.metallicRoughnessTexture?.texture?.usedMemory??0)+(e.emissionTexture?.texture?.usedMemory??0)+(e.occlusionTexture?.texture?.usedMemory??0)+(e.normalTexture?.texture?.usedMemory??0)),e.commonMaterialParameters.doubleSided=u.isDoubleSided,e.commonMaterialParameters.cullFace=K[u.faceCulling??"NotSet"],e.commonMaterialParameters.isGround=this.layer.replacesTerrain,e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.componentParameters.castShadows=0,e.textureAlphaCutoff=u.alphaCutoff??je,e.alphaDiscardMode=Z[u.alphaMode],e.isIntegratedMesh=!0,e.sphereDepthInterpolate=this.layer.hasGoogleUrl,e.polygonOffsetEnabled=!1,e.hasOccludees=!1,e.ellipsoidMode=he(this.view.spatialReference)}}const Q=q.then(()=>()=>{if(this.destroyed){const e="Trying to add object to destroyed layer view";throw this._dbg(3,`${e} !== numPos. Skipping primitive.`),new Error(e)}const e=this._collection.createObject(new oe(j(N[0],N[1],W[0],W[1]),new de(s,n),F,G,!1));return this._collection.updateMaterial(e,$),c+=this._collection.getObjectGPUMemoryUsage(e),e});E.push(Q)}if(P.push(...await Promise.all(E)),this.destroyed){throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable object destroyed during call")}}catch(I){throw U.forEach(e=>this._stage.removeTexture(e)),I}const S=P.map(e=>e()),V=new Array;U.forEach(e=>V.push(e));const{fullExtent:L}=this.layer;L?.hasZ&&L.zmax&&L.zmin&&(A.minElevation=Math.max(A.minElevation,L.zmin),A.maxElevation=Math.min(A.maxElevation,L.zmax));const k=new xe(e.handle,S,V,d,c,b.textureMemoryUsage,l,e.stableNodeId,e.nodeDepth,A);return this._lyrHandleToObjects.set(e.handle,k),this._memCache.put(Ue(k.handle),k),t=k.usedMemory,this._cacheMemory+=t,{memUsageBytes:k.usedMemory}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t?(t.isLoaded?(this._loadedObjects.delete(t),this._visibleObjects.delete(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e)):this._dbg(3,`freeRendedrable on non-existent renderable ${e}`)}freeObject(e){const t=Ue(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){if(this.destroyed||this.destroying)return;const s=this._frustum,r=new Array;let o=!1;for(let n=0;n<i;++n){if(!t[n])continue;const i=e[n],a=this._lyrHandleToObjects.get(i);if(a){if(a.isLoaded){this._dbg(3,`Already loaded object marked loaded again ${a.stableNodeId}`);continue}o=!0,a.isLoaded=!0,this._loadedObjects.add(a),this._usedMemory+=a.usedMemory,this._cacheMemory-=a.usedMemory;const e=a.obb?.intersectsFrustum(s)??!0;if(a.isVisible=e,e){this._visibleObjects.add(a);const{minElevation:e,maxElevation:t}=a.elevationRange;(e<this.visibleElevationRange.minElevation||t>this.visibleElevationRange.maxElevation)&&this._setVisibleElevationRangeDirty()}e&&a.obb&&r.push(a.obb),a.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(Ue(i))}else this._dbg(3,`Tried to mark Non existent object ${i} as loaded`)}for(let n=0;n<i;++n){const i=e[n];if(t[n])continue;const s=this._lyrHandleToObjects.get(i);if(s){if(!s.isLoaded){this._dbg(3,`Tried to unload not-loaded object ${s.stableNodeId}`);continue}const e=this._visibleObjects.delete(s);if(s.isVisible=!1,s.isLoaded=!1,this._loadedObjects.delete(s),e){this._visibleGeometryChanged();const{minElevation:e,maxElevation:t}=s.elevationRange;e!==this.visibleElevationRange.minElevation&&t!==this.visibleElevationRange.maxElevation||this._setVisibleElevationRangeDirty()}this._usedMemory-=s.usedMemory,this._cacheMemory+=s.usedMemory,e&&s.obb&&r.push(s.obb),s.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,!1)}),this._memCache.put(Ue(i),s)}else this._dbg(3,`Tried to mark Non existent object ${i} as not loaded`)}o&&this._visibleGeometryChanged(),this._elevationProvider.notifyObjectsChanged(r),this._setVisibleElevationRangeDirty()}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_getTexture(e,t,i,s){const r=e&&t.desc?.images?.[e.imageId];if(!r||!t.data?.buffer)return null;const o=i.get(r)??this._createTexture(e,t,i,s);return o?new ce(this._stage.renderView.textures,o.id):null}_createTexture(e,t,i,s){const r=e&&t.desc?.images?.[e.imageId];if(!r||!t.data?.buffer)return null;const o=this._stage,{renderView:n}=o,a=n.renderingContext.parameters.maxMaxAnisotropy,l=!!r.mipCount||a>1,d=Q[e.wrapMode??"None"];let c=r.alpha?6408:6407;const h=new Uint8Array(t.data.buffer,r.data.byteOffset,r.data.byteCount);let m=null,u=null,p=null;switch(r.format){case"Raw":"R8"===r.pixelFormat?(m=h,c=6403,u=""):"Rgb8"===r.pixelFormat?(m=h,c=6407,u=""):"Rgba8"===r.pixelFormat&&(m=h,c=6408,u="");break;case"Dxt1":m=h,c=6407,u="image/vnd-ms.dds";break;case"Dxt5":m=h,c=6408,u="image/vnd-ms.dds";break;case"Basis":m=h,c=6407,u="image/ktx2";break;case"Png":u="image/png",p=document.createElement("img");break;case"Jpeg":u="image/jpeg",p=document.createElement("img");break;case"Etc2":u="image/ktx",p=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(p&&u){const e=new Blob([h],{type:u});p.src=URL.createObjectURL(e),m=p}if(m&&null!=u){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker,compressionCallback:e=>{e&&e>0&&(s.textureMemoryUsage-=e)}}:void 0,t=new ue(m,{mipmap:l,maxAnisotropy:a,encoding:u,wrap:d,pixelFormat:c,compressionOptions:e,noUnpackFlip:!0,width:r.mip0Width,height:r.mip0Height});return this._stage.addTexture(t),i.set(r,t),t}return null}getBufferViews(e,t,i){let s,r,o,n,a,l,d,c=null;for(let m=0;m<e.atrbs.length;m++){const d=e.atrbs[m],{view:u}=d,p=void 0,f=u.byteOffset+u.byteCount,b=u.byteCount/X[u.type],g=new(Pe(b))(b);for(let e=0;e<b;++e)g[e]=e;try{switch(d.sem){case"Position":3!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+u+")"):(s=new A(t,u.byteOffset,p,f),r=new me(s.typedBuffer,g,3));break;case"Normal":if(3!==u.ncomp||"F32"!==u.type)this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+u+")");else{const e=new A(t,u.byteOffset,p,f),s=pe(e.typedBuffer,i);a=new L(s.buffer),l=new me(a.typedBuffer,g,2)}break;case"TexCoord":2!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+u+")"):void 0===n&&(n=new me(new R(t,u.byteOffset,p,f).typedBuffer,g,2));break;case"Color":4===u.ncomp?("F32"===u.type&&(c=new U(t,u.byteOffset,p,f)),"U8"===u.type&&(c=new H(t,u.byteOffset,p,f)),"U16"===u.type&&(c=new P(t,u.byteOffset,p,f))):3===u.ncomp&&("F32"===u.type&&(c=new A(t,u.byteOffset,p,f)),"U8"===u.type&&(c=new S(t,u.byteOffset,p,f)),"U16"===u.type&&(c=new V(t,u.byteOffset,p,f))),null==c?this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+u+")"):o=new me(c.typedBuffer,g,u.ncomp);break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+d.sem+"). Skipping vertex attribute.")}}catch(h){this._dbg(2,"Error Creating buffer ("+h+"). Skipping vertex attribute.")}}if(e.index){const i=e.index.view,s=void 0,r=i.byteOffset+i.byteCount;switch(e.index.view.type){case"U16":d=new I(t,i.byteOffset,s,r);break;case"U32":d=new k(t,i.byteOffset,s,r);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==d&&null!=s){const e=s.count;d=d=e<65535?new I(new Uint16Array(e).buffer):new k(new Uint32Array(e).buffer);for(let t=0;t<e;t++)d.set(t,t)}return{positionView:s,positionAttr:r,colorAttr:o,texCoord0Attr:n,indicesView:d,normalsView:a,normalsAttr:l}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>{this._modifications=e.filter(e=>!(this.layer.isUsedAsGroundLayer&&"replace"!==e.type)).toArray(),this._modifications.length<e.length&&t.getLogger(this).info("Ground layers only support replace modifications. Other modification types have been ignored.")},o),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([d()],Oe.prototype,"fullOpacity",null),e([d({readOnly:!0})],Oe.prototype,"ready",null),e([d({type:[F]})],Oe.prototype,"_modifications",void 0),e([d()],Oe.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([d()],Oe.prototype,"layer",void 0),e([d({readOnly:!0})],Oe.prototype,"visibleAtCurrentScale",null),e([d({readOnly:!0})],Oe.prototype,"_collection",null),e([d()],Oe.prototype,"elevationOffset",null),e([d({readOnly:!0})],Oe.prototype,"visibleElevationRange",null),Oe=e([c("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Oe);const Ce=Oe,Te=w();function Ee(e,t){const i=se(e);return g(Te,i.center,t),i.center=Te,i}function Re(e){return e?new re(e.center,e.halfSize,b(...e.quaternion)):null}function Ue(e){return`${e}`}const He=new Array;function Pe(e){return e<256?Uint8Array:e<65536?Uint16Array:Uint32Array}export{Ce as default};
5
+ import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as i,removeMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{initial as o,watch as n,when as a}from"../../../core/reactiveUtils.js";import{schedule as l}from"../../../core/scheduling.js";import{property as d,subclass as c}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as h,invert as m}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as u,IDENTITY as p}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as f}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as b}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{i as g,b as y,t as _}from"../../../chunks/vec32.js";import{freeze as v,create as w}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as j}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{SphericalECEFSpatialReferenceLike as x,getReferenceEllipsoid as O}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as M}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as C}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as T}from"../../../geometry/projection/projectVectorToVector.js";import{create as E}from"../../../geometry/support/aaBoundingRect.js";import{getContinuousIndexArray as R}from"../../../geometry/support/Indices.js";import{BufferViewVec2f as U,BufferViewVec4f as H,BufferViewVec4u8 as S,BufferViewVec4u16 as P,BufferViewVec3f as A,BufferViewVec3u8 as V,BufferViewVec3u16 as L,BufferViewInt16 as k,BufferViewUint32 as I,BufferViewUint16 as F}from"../../../geometry/support/buffer/BufferView.js";import D from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as B}from"../../../support/elevationInfoUtils.js";import{LayerView3D as G}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as z}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as N,removeLayerViewFromWasm as W,getLyr3DWasm as $}from"./Lyr3DWasm.js";import{toWasmModification as q}from"./SceneLayerWorkerHandle.js";import{LayerElevationProvider as J}from"./i3s/LayerElevationProvider.js";import{primTypeConversion as Z,alphaModeConversion as K,faceCullingConversion as Q,wrapModeConversion as X,lyr3DTypeToByteSize as Y}from"./support/lyr3dTypeConversions.js";import{Tiles3DIntersectionHandler as ee}from"./support/Tiles3DIntersectionHandler.js";import{Frustum as te}from"../state/Frustum.js";import{ElevationRange as ie}from"../support/ElevationRange.js";import{toBoundingRect as se}from"../support/extentUtils.js";import{compute as re,Obb as oe}from"../support/orientedBoundingBox.js";import{glLayout as ne}from"../support/buffer/glUtil.js";import{ObjectParameters as ae}from"../webgl-engine/collections/Component/ObjectParameters.js";import{GeometryParameters as le,createVertexBufferLayout as de,SourceParameters as ce,SourceGeometry as he}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as me}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as ue}from"../webgl-engine/core/material/RenderTexture.js";import{getEllipsoidMode as pe}from"../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{Attribute as fe}from"../webgl-engine/lib/Attribute.js";import{ManagedTexture as be}from"../webgl-engine/lib/ManagedTexture.js";import{compressAndTransformNormals as ge}from"../webgl-engine/lib/Normals.js";import{writeAttribute as ye,writeBufferVec2 as _e}from"../webgl-engine/materials/internal/bufferWriterUtils.js";import ve from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as we,isInEffectiveScaleRange as je,validateScaleRange as xe}from"../../support/layerViewUtils.js";import{TextureCompressionTracker as Oe}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as Me}from"../../../webscene/support/AlphaCutoff.js";class Ce{constructor(e,t,i,s,r,o,n,a,l,d){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=s,this.vboMemoryUsage=r,this.textureMemoryUsage=o,this.obb=n,this.stableNodeId=a,this.nodeDepth=l,this.elevationRange=d,this.isLoaded=!1,this.isVisible=!1,this.usedMemory=this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage;const c=w();n?.getCenter(c),this._obbCenter=c,this._obbRadius=n?.radius??0,this._obbRadiusSquared=this._obbRadius**2;const h=n?.halfSize;this._obbShortestHalfsize=h?Math.min(h[0],h[1],h[2]):0}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const i=this._obbCenter,s=i[0]-e[0],r=i[1]-e[1],o=i[2]-e[2],n=s*t[0]+r*t[1]+o*t[2];return s*s+r*r+o*o-n*n<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){const{obb:t}=this;if(!t)return!0;const i=e.center,s=this._obbCenter,r=s[0]-i[0],o=s[1]-i[1],n=s[2]-i[2],a=r*r+o*o+n*n,l=this._obbRadius,d=e.radius;if(a>(l+d)**2)return!1;if(a<=(this._obbShortestHalfsize+d)**2)return!0;return Math.sqrt(a)+l<=d||t.intersectSphere(e)}}function Te(e){return Math.round(e/1048.576)/1e3}let Ee=class extends(G(ve)){get hasModifications(){return this._modifications&&this._modifications.length>0}constructor(e){super(e),this.type="integrated-mesh-3dtiles",this._compressionTracker=new Oe,this._replacesTerrain=!1,this._isUsedAsGroundLayer=!1,this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this.drapeTargetType=1,this._applySSAO=!has("disable-feature:im-ssao"),this._shadeNormals=!!has("enable-feature:im-shading"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._loadedObjects=new Set,this._suspendedHandle=null,this._dbgFlags=new Set,this._memCache=e.view.resourceController.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e)),this._frustum=new te(e.view.renderCoordsHelper)}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{r(t),this.layer=e}):null}canRecycleWith(e){return e.url===this.layer.url&&"integrated-mesh-3dtiles"===e.type&&e.replacesTerrain===this._replacesTerrain&&e.isUsedAsGroundLayer===this._isUsedAsGroundLayer}initialize(){this._dbgFlags.add(3),this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._replacesTerrain=this.layer.replacesTerrain,this._isUsedAsGroundLayer=this.layer.isUsedAsGroundLayer,this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),o),!this._canProjectWithoutEngine())throw we("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=N(this).then(t=>{this._wasmLayerId=t,this._intersectionHandler=new ee(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged(),o),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),o),this._updatingHandles.add(()=>e.state.contentCamera,()=>this._cameraChanged(),o),this._elevationProvider=new J({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),e.elevationProvider.register(1,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([n(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),a(()=>this.fullOpacity,()=>this._opacityChange())]),this._suspendedHandle=n(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),o)});this.addResolvingPromise(t)}get fullOpacity(){return this.layer.replacesTerrain&&has("enable-feature:oit-ground")?this.view.map.ground.opacity:1}_opacityChange(){const{fullOpacity:e}=this;this.forEachComponentObject(t=>this._collection.updateMaterial(t,t=>t.objectOpacity=e))}_cameraChanged(){const e=this._frustum;e.update(this.view.state.contentCamera);const t=this._visibleObjects;let i=!1;this._loadedObjects.forEach(s=>{const r=s.obb?.intersectsFrustum(e)??!1;r!==s.isVisible&&(s.isVisible=r,r?t.add(s):t.delete(s),s.componentObjects.forEach(e=>this._collection.setObjectVisibility(e,r)),i=!0)}),i&&this._setVisibleElevationRangeDirty()}intersect(e,t,i,s){this._intersectionHandler.intersect(e,t,i,s,null,!1)}get ready(){return!this.layer.replacesTerrain||!!this._wasm?.isTerrainReady}destroy(){this._dbg(2,"Tiles3DLayerView3D destroy() called"),W(this),this._suspendedHandle&&(this._suspendedHandle.remove(),this._suspendedHandle=null),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>this.forEachComponentObject(t=>e(t.obb))),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._loadedObjects.clear(),this._usedMemory=this._cacheMemory=0,this._memCache.destroy(),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=s(this._visibleGeometryChangedSchedulerHandle)}_modificationsChanged(){const e=this.layer.spatialReference,t=q(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t,e.wkid)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=E();this._layerClippingArea=se(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=l(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this.layer.replacesTerrain),this.forEachComponentObject(t=>this._collection.updateMaterial(t,t=>t.commonMaterialParameters.hasSlicePlane=e))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,B(e))}get _wasm(){return $(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get visibleAtCurrentScale(){return this.layer.isUsedAsGroundLayer||je(this.layer.effectiveScaleRange,this.view.scale)}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&(this.layer.isUsedAsGroundLayer||xe(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,i=0,s=0,r=0,o=0;return this._lyrHandleToObjects.forEach(n=>{n.isLoaded?(e+=n.textureMemoryUsage,t+=n.vboMemoryUsage,r++):(i+=n.textureMemoryUsage,s+=n.vboMemoryUsage,o++)}),new z(this.usedMemory,r,o,Te(t),Te(e),Te(s),Te(i))}_canProjectWithoutEngine(){if(2===this.view.state.viewingMode){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return B(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new ie(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new ie;return 0===this._visibleObjects.size?e.setElevationRangeValues(0,0):(e.setElevationRangeValues(1/0,-1/0),this.forEachVisibleTile(t=>e.expandElevationRange(t.elevationRange))),e}_setVisibleElevationRangeDirty(){this.notifyChange("visibleElevationRange")}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const i of e)for(const e of i.componentObjects)t(e)}isUpdating(){const e=this._wasm;return this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed){const e=`IntegratedMesh3DTilesLayerView3D[${this.layer?.title}]: createRenderable called on destroyed instance`;throw new Error(e)}let t=0;const{meshData:i}=e;if(null==i.data)throw new Error("meshData.data undefined");if(i.desc=JSON.parse(i.desc),null==i.desc)throw new Error("meshData.desc undefined");const s=v(...i.desc.origin),r=this.view.basemapTerrain.spatialReference;let o,n;if("global"===this.view.viewingMode){const e=f();M(x,s,e,r),o=h(u(),e),n=m(u(),o)}else o=p,n=p;const a=w(),l=Se(i.desc.obb);let d=0,c=0;const b={textureMemoryUsage:0},E=new Array,R=new Map,H=i.desc.prims.length,S=new Array,P=new ie;try{const e="global"===this.view.viewingMode,t=e?O(this.view.spatialReference).radius:0;for(let h=0;h<H;h++){const m=i.desc.prims[h];this._dbg(2,JSON.stringify(m));if(null==Z[m.ptype]||null==i.data){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+m.ptype+"). Skipping primitive.");continue}const u=i.desc?.materials&&null!=m.materialId?i.desc.materials[m.materialId]:null,f=null!=u?u.lightingModel:"Unlit",{positionView:v,positionAttr:x,normalsView:O,normalsAttr:M,colorAttr:H,texCoord0Attr:S,indicesView:A}=this.getBufferViews(m,i.data.buffer,o);if(null==x||null==v||null==A)continue;const V=x.data.length/x.size,L=(e,t)=>!e||e.data.length/e.size===V||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);if(!L(S,"numTexcoord")||!L(H,"numColors")||!L(M,"normals"))continue;const k=new le(null!=H,S?1:0,null!=O,this._shadeNormals||this.layer.replacesTerrain,this._applySSAO),I=de(k);for(let i=0;i<v.count;i++){v.getVec(i,a),g(a,a,s);const r=e?y(a)-t:a[2];P.expandElevationRangeValues(r,r)}const F=l?.clone()??He(x,s);if(o!==p)for(let e=0;e<v.count;e++)v.getVec(e,a),_(a,a,o),v.setVec(e,a);const D=I.createBuffer(x.data.length);if(ye("position",x,null,null,D,0),null!=S){const e=D.getField("uv0",U);_e(S,e,0)}null!=H&&ye("color",H,null,null,D,0),null!=M&&ye("normalCompressed",M,null,null,D,0);const B=new Uint32Array([0,A.typedBuffer.length]),G=new ce(ne(I),k.shadeNormals,k.applySSAO,k.textureCoordinateType),z=new he({data:D.buffer,count:D.byteLength/I.stride},{positions:v.typedBuffer,indices:A.typedBuffer},A.typedBuffer,B,G);d+=v.count+A.count;const N=this.view.renderSpatialReference,W=w(),$=[1,1,1];C(s,N,$,r)||this._dbg(3,"Unsupported coordinate system for IM overlay"),T(s,N,W,r);let q=()=>{},J=Promise.resolve(Ae);if(u){const e=e=>this._getTexture(e,i,R,b),t=e(u.baseColorTex),s="Pbr"===f,r=s?e(u.metalTex):null,o=s?e(u.emissiveTex):null,n=s?e(u.occlusionTex):null,a=s?e(u.normalTex):null,l=[t,r,o,n,a].map(e=>e?.loadPromise??null);J=Promise.all(l),q=e=>{e.baseColor=u.baseColorFactor,e.usePBR="Pbr"===f,e.hasParametersFromSource=!1,e.baseColorTexture=t,e.usePBR&&(e.mrrFactors=[u.metallicFactor,u.roughnessFactor,0],e.emissiveBaseColor=u.emissiveFactor??[0,0,0],e.metallicRoughnessTexture=r,e.emissionTexture=o,e.occlusionTexture=n,e.normalTexture=a),e.alphaDiscardMode=K[u.alphaMode],e.objectOpacity=this.fullOpacity,b.textureMemoryUsage+=e.baseColorTexture?.texture?.usedMemory??0,e.usePBR&&(b.textureMemoryUsage+=(e.metallicRoughnessTexture?.texture?.usedMemory??0)+(e.emissionTexture?.texture?.usedMemory??0)+(e.occlusionTexture?.texture?.usedMemory??0)+(e.normalTexture?.texture?.usedMemory??0)),e.commonMaterialParameters.doubleSided=u.isDoubleSided,e.commonMaterialParameters.cullFace=Q[u.faceCulling??"NotSet"],e.commonMaterialParameters.isGround=this.layer.replacesTerrain,e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.componentParameters.castShadows=0,e.textureAlphaCutoff=u.alphaCutoff??Me,e.alphaDiscardMode=K[u.alphaMode],e.isIntegratedMesh=!0,e.sphereDepthInterpolate=this.layer.hasGoogleUrl,e.polygonOffsetEnabled=!1,e.hasOccludees=!1,e.ellipsoidMode=pe(this.view.spatialReference)}}const X=J.then(()=>()=>{if(this.destroyed){const e="Trying to add object to destroyed layer view";throw this._dbg(3,`${e} !== numPos. Skipping primitive.`),new Error(e)}const e=this._collection.createObject(new ae(j(W[0],W[1],$[0],$[1]),new me(s,n),F,z,!1));return this._collection.updateMaterial(e,q),c+=this._collection.getObjectGPUMemoryUsage(e),e});E.push(X)}if(S.push(...await Promise.all(E)),this.destroyed){throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable object destroyed during call")}}catch(I){throw R.forEach(e=>this._stage.removeTexture(e)),I}const A=S.map(e=>e()),V=new Array;R.forEach(e=>V.push(e));const{fullExtent:L}=this.layer;L?.hasZ&&L.zmax&&L.zmin&&(P.minElevation=Math.max(P.minElevation,L.zmin),P.maxElevation=Math.min(P.maxElevation,L.zmax));const k=new Ce(e.handle,A,V,d,c,b.textureMemoryUsage,l,e.stableNodeId,e.nodeDepth,P);return this._lyrHandleToObjects.set(e.handle,k),this._memCache.put(Pe(k.handle),k),t=k.usedMemory,this._cacheMemory+=t,{memUsageBytes:k.usedMemory}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t?(t.isLoaded?(this._loadedObjects.delete(t),this._visibleObjects.delete(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e)):this._dbg(3,`freeRendedrable on non-existent renderable ${e}`)}freeObject(e){const t=Pe(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){if(this.destroyed||this.destroying)return;const s=this._frustum,r=new Array;let o=!1;for(let n=0;n<i;++n){if(!t[n])continue;const i=e[n],a=this._lyrHandleToObjects.get(i);if(a){if(a.isLoaded){this._dbg(3,`Already loaded object marked loaded again ${a.stableNodeId}`);continue}o=!0,a.isLoaded=!0,this._loadedObjects.add(a),this._usedMemory+=a.usedMemory,this._cacheMemory-=a.usedMemory;const e=a.obb?.intersectsFrustum(s)??!0;if(a.isVisible=e,e){this._visibleObjects.add(a);const{minElevation:e,maxElevation:t}=a.elevationRange;(e<this.visibleElevationRange.minElevation||t>this.visibleElevationRange.maxElevation)&&this._setVisibleElevationRangeDirty()}e&&a.obb&&r.push(a.obb),a.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(Pe(i))}else this._dbg(3,`Tried to mark Non existent object ${i} as loaded`)}for(let n=0;n<i;++n){const i=e[n];if(t[n])continue;const s=this._lyrHandleToObjects.get(i);if(s){if(!s.isLoaded){this._dbg(3,`Tried to unload not-loaded object ${s.stableNodeId}`);continue}const e=this._visibleObjects.delete(s);if(s.isVisible=!1,s.isLoaded=!1,this._loadedObjects.delete(s),e){this._visibleGeometryChanged();const{minElevation:e,maxElevation:t}=s.elevationRange;e!==this.visibleElevationRange.minElevation&&t!==this.visibleElevationRange.maxElevation||this._setVisibleElevationRangeDirty()}this._usedMemory-=s.usedMemory,this._cacheMemory+=s.usedMemory,e&&s.obb&&r.push(s.obb),s.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,!1)}),this._memCache.put(Pe(i),s)}else this._dbg(3,`Tried to mark Non existent object ${i} as not loaded`)}o&&this._visibleGeometryChanged(),this._elevationProvider.notifyObjectsChanged(r),this._setVisibleElevationRangeDirty()}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_getTexture(e,t,i,s){const r=e&&t.desc?.images?.[e.imageId];if(!r||!t.data?.buffer)return null;const o=i.get(r)??this._createTexture(e,t,i,s);return o?new ue(this._stage.renderView.textures,o.id):null}_createTexture(e,t,i,s){const r=e&&t.desc?.images?.[e.imageId];if(!r||!t.data?.buffer)return null;const o=this._stage,{renderView:n}=o,a=n.renderingContext.parameters.maxMaxAnisotropy,l=!!r.mipCount||a>1,d=X[e.wrapMode??"None"];let c=r.alpha?6408:6407;const h=new Uint8Array(t.data.buffer,r.data.byteOffset,r.data.byteCount);let m=null,u=null,p=null;switch(r.format){case"Raw":"R8"===r.pixelFormat?(m=h,c=6403,u=""):"Rgb8"===r.pixelFormat?(m=h,c=6407,u=""):"Rgba8"===r.pixelFormat&&(m=h,c=6408,u="");break;case"Dxt1":m=h,c=6407,u="image/vnd-ms.dds";break;case"Dxt5":m=h,c=6408,u="image/vnd-ms.dds";break;case"Basis":m=h,c=6407,u="image/ktx2";break;case"Png":u="image/png",p=document.createElement("img");break;case"Jpeg":u="image/jpeg",p=document.createElement("img");break;case"Etc2":u="image/ktx",p=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(p&&u){const e=new Blob([h],{type:u});p.src=URL.createObjectURL(e),m=p}if(m&&null!=u){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker,compressionCallback:e=>{e&&e>0&&(s.textureMemoryUsage-=e)}}:void 0,t=new be(m,{mipmap:l,maxAnisotropy:a,encoding:u,wrap:d,pixelFormat:c,compressionOptions:e,noUnpackFlip:!0,width:r.mip0Width,height:r.mip0Height});return this._stage.addTexture(t),i.set(r,t),t}return null}getBufferViews(e,t,i){let s,r,o,n,a,l,d,c=null;for(let m=0;m<e.atrbs.length;m++){const d=e.atrbs[m],{view:u}=d,p=void 0,f=u.byteOffset+u.byteCount,b=u.byteCount/Y[u.type],g=R(b);try{switch(d.sem){case"Position":3!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+u+")"):(s=new A(t,u.byteOffset,p,f),r=new fe(s.typedBuffer,g,3));break;case"Normal":if(3!==u.ncomp||"F32"!==u.type)this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+u+")");else{const e=new A(t,u.byteOffset,p,f),s=ge(e.typedBuffer,i);a=new k(s.buffer),l=new fe(a.typedBuffer,g,2)}break;case"TexCoord":2!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+u+")"):void 0===n&&(n=new fe(new U(t,u.byteOffset,p,f).typedBuffer,g,2));break;case"Color":4===u.ncomp?("F32"===u.type&&(c=new H(t,u.byteOffset,p,f)),"U8"===u.type&&(c=new S(t,u.byteOffset,p,f)),"U16"===u.type&&(c=new P(t,u.byteOffset,p,f))):3===u.ncomp&&("F32"===u.type&&(c=new A(t,u.byteOffset,p,f)),"U8"===u.type&&(c=new V(t,u.byteOffset,p,f)),"U16"===u.type&&(c=new L(t,u.byteOffset,p,f))),null==c?this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+u+")"):o=new fe(c.typedBuffer,g,u.ncomp);break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+d.sem+"). Skipping vertex attribute.")}}catch(h){this._dbg(2,"Error Creating buffer ("+h+"). Skipping vertex attribute.")}}if(e.index){const i=e.index.view,s=void 0,r=i.byteOffset+i.byteCount;switch(e.index.view.type){case"U16":d=new F(t,i.byteOffset,s,r);break;case"U32":d=new I(t,i.byteOffset,s,r);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==d&&null!=s){const e=s.count;d=d=e<65535?new F(new Uint16Array(e).buffer):new I(new Uint32Array(e).buffer);for(let t=0;t<e;t++)d.set(t,t)}return{positionView:s,positionAttr:r,colorAttr:o,texCoord0Attr:n,indicesView:d,normalsView:a,normalsAttr:l}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>{this._modifications=e.filter(e=>!(this.layer.isUsedAsGroundLayer&&"replace"!==e.type)).toArray(),this._modifications.length<e.length&&t.getLogger(this).info("Ground layers only support replace modifications. Other modification types have been ignored.")},o),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([d()],Ee.prototype,"fullOpacity",null),e([d({readOnly:!0})],Ee.prototype,"ready",null),e([d({type:[D]})],Ee.prototype,"_modifications",void 0),e([d()],Ee.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([d()],Ee.prototype,"layer",void 0),e([d({readOnly:!0})],Ee.prototype,"visibleAtCurrentScale",null),e([d({readOnly:!0})],Ee.prototype,"_collection",null),e([d()],Ee.prototype,"elevationOffset",null),e([d({readOnly:!0})],Ee.prototype,"visibleElevationRange",null),Ee=e([c("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Ee);const Re=Ee,Ue=w();function He(e,t){const i=re(e);return g(Ue,i.center,t),i.center=Ue,i}function Se(e){return e?new oe(e.center,e.halfSize,b(...e.quaternion)):null}function Pe(e){return`${e}`}const Ae=new Array;export{Re as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{hasScaling as e}from"../../../core/mathUtils.js";import r from"../../../geometry/SpatialReference.js";import{ensurePackedMat4f64 as t,ensurePackedArray as o}from"../../../geometry/support/DoubleArray.js";import n from"../../../geometry/support/MeshGeoreferencedVertexSpace.js";import s from"../../../geometry/support/MeshLocalVertexSpace.js";import{b as i,n as a}from"../../../chunks/vec3.js";import{get as f,cleanup as c}from"../../../libs/i3s/I3SModule.js";import{TransformedGeometry as l,TransformedData as u}from"./I3SMeshWorkerHandle.js";async function m(e){A=await v();const r=[e.geometryBuffer];return{result:E(A,e,r),transferList:r}}async function y(e){A=await v();const r=[e.geometryBuffer],{geometryBuffer:t}=e,o=t.byteLength,n=A._malloc(o),s=new Uint8Array(A.HEAPU8.buffer,n,o);s.set(new Uint8Array(t));const i=A.dracoDecompressPointCloudData(n,s.byteLength);if(A._free(n),i.error.length>0)throw new Error(`i3s.wasm: ${i.error}`);const a=i.featureIds?.length>0?i.featureIds.slice():null,f=i.positions.slice();return a&&r.push(a.buffer),r.push(f.buffer),{result:{positions:f,featureIds:a},transferList:r}}async function p(e){await v(),S(e);const r={buffer:e.buffer};return{result:r,transferList:[r.buffer]}}async function h(e){await v(),x(e)}async function d(e){A=await v(),A.setLegacySchema(e.context,e.jsonSchema)}async function g(e){const{localMatrix:i,origin:a,positions:f,vertexSpace:c}=e,l=r.fromJSON(e.inSpatialReference),u=r.fromJSON(e.outSpatialReference),m=i?t(i):void 0,y=o(a);let p;const[{projectBuffer:h},{initializeProjection:d}]=await Promise.all([import("../../../geometry/projection/projectBuffer.js"),import("../../../geometry/projectionUtils.js")]);await d(l,u);const g=[0,0,0];if(!h(y,l,0,g,u,0))throw new Error("Failed to project");if("georeferenced"===c.type&&null==c.origin){if(p=new Float64Array(f.length),!h(f,l,0,p,u,0,p.length/3))throw new Error("Failed to project")}else{const e="georeferenced"===c.type?n.fromJSON(c):s.fromJSON(c),{projectMeshVertexPositions:r}=await import("../../../geometry/support/meshUtils/projectMeshVertexPositions.js"),t=r({vertexAttributes:{position:f},transform:m?{localMatrix:m}:void 0,vertexSpace:e,spatialReference:l},u);if(!t)throw new Error("Failed to project");p=t}const b=p.length,[w,j,A]=g;for(let r=0;r<b;r+=3)p[r]-=w,p[r+1]-=j,p[r+2]-=A;return{result:{projected:p,original:f,projectedOrigin:g},transferList:[p.buffer,f.buffer]}}async function b({normalMatrix:r,normals:t}){const o=new Float32Array(t.length);return i(o,t,r),e(r)&&a(o,o),{result:{transformed:o,original:t},transferList:[o.buffer,t.buffer]}}function w(e){U(e)}let j,A;function x(e){if(!A)return;const r=e.modifications,t=A._malloc(8*r.length),o=new Float64Array(A.HEAPU8.buffer,t,r.length);for(let n=0;n<r.length;++n)o[n]=r[n];A.setModifications(e.context,t,r.length,e.isGeodetic),A._free(t)}function E(e,r,t){const{context:o,globalTrafo:n,mbs:s,obbData:i,elevationOffset:a,geometryBuffer:f,geometryDescriptor:c,indexToVertexProjector:m,vertexToRenderProjector:y}=r,p=e._malloc(f.byteLength),h=33,d=e._malloc(h*Float64Array.BYTES_PER_ELEMENT),g=new Uint8Array(e.HEAPU8.buffer,p,f.byteLength);g.set(new Uint8Array(f));const b=new Float64Array(e.HEAPU8.buffer,d,h);P(b,[NaN,NaN,NaN],0);let w=3;P(b,n,w),w+=16,P(b,s.center,w),w+=3,b[w++]=s.radius,i&&P(b,i,w++);const j=c,A={isDraco:!1,isLegacy:!1,color:r.layouts.some(e=>e.some(e=>"color"===e.name)),normal:r.needNormals&&r.layouts.some(e=>e.some(e=>"normalCompressed"===e.name)),uv0:r.layouts.some(e=>e.some(e=>"uv0"===e.name)),uvRegion:r.layouts.some(e=>e.some(e=>"uvRegion"===e.name)),featureIndex:j.featureIndex},x=e.process(o,!!r.obbData,p,g.byteLength,j,A,d,a,m,y,r.normalReferenceFrame);if(e._free(d),e._free(p),x.error.length>0)throw new Error(`i3s.wasm: ${x.error}`);if(x.discarded)return null;const E=x.componentOffsets.length>0?x.componentOffsets.slice():null,L=x.featureIds.length>0?x.featureIds.slice():null,S=x.anchorIds.length>0?Array.from(x.anchorIds):null,U=x.anchors.length>0?Array.from(x.anchors):null,_=x.interleavedVertedData.slice().buffer,v=1===x.indicesType?new Uint16Array(x.indices.buffer,x.indices.byteOffset,x.indices.byteLength/2).slice():new Uint32Array(x.indices.buffer,x.indices.byteOffset,x.indices.byteLength/4).slice(),I=x.positions.slice(),{buffer:M,byteOffset:N,byteLength:F}=x.positionIndices,O=1===x.positionIndicesType?new Uint16Array(M,N,F/2).slice():new Uint32Array(M,N,F/4).slice(),B=new l(r.layouts[0],_,v,x.hasColors,x.hasModifications,{data:I,indices:O});return L&&t.push(L.buffer),E&&t.push(E.buffer),t.push(_),t.push(v.buffer),t.push(I.buffer),t.push(O.buffer),new u(E,L,S,U,B,n,x.obb)}function L(e){return 0===e?0:1===e?1:2===e?2:3}function S(e){if(!A)return;const{context:r,buffer:t}=e,o=A._malloc(t.byteLength),n=t.byteLength/Float64Array.BYTES_PER_ELEMENT,s=new Float64Array(A.HEAPU8.buffer,o,n),i=new Float64Array(t);s.set(i),A.filterOBBs(r,o,n),i.set(s),A._free(o)}function U(e){A&&0===A.destroy(e)&&(A=null,j=null,c())}function P(e,r,t){for(let o=0;o<r.length;++o)e[o+t]=r[o]}async function _(){A||await v()}async function v(){return A||(A=await(j??=f())),A}const I={transform:(e,r)=>A&&E(A,e,r),destroy:U};export{w as destroyContext,y as dracoDecompressPointCloudData,p as filterObbsForModifications,S as filterObbsForModificationsSync,_ as initialize,L as interpretObbModificationResults,m as process,g as project,d as setLegacySchema,h as setModifications,x as setModificationsSync,I as test,b as transformNormals};
5
+ import{hasScaling as e}from"../../../core/mathUtils.js";import r from"../../../geometry/SpatialReference.js";import{ensurePackedMat4f64 as t,ensurePackedArray as o}from"../../../geometry/support/DoubleArray.js";import n from"../../../geometry/support/MeshGeoreferencedVertexSpace.js";import s from"../../../geometry/support/MeshLocalVertexSpace.js";import{b as i,n as a}from"../../../chunks/vec3.js";import{get as f,cleanup as c}from"../../../libs/i3s/I3SModule.js";import{TransformedGeometry as l,TransformedData as u}from"./SceneLayerWorkerHandle.js";async function m(e){A=await v();const r=[e.geometryBuffer];return{result:x(A,e,r),transferList:r}}async function p(e){A=await v();const r=[e.geometryBuffer],{geometryBuffer:t}=e,o=t.byteLength,n=A._malloc(o),s=new Uint8Array(A.HEAPU8.buffer,n,o);s.set(new Uint8Array(t));const i=A.dracoDecompressPointCloudData(n,s.byteLength);if(A._free(n),i.error.length>0)throw new Error(`i3s.wasm: ${i.error}`);const a=i.featureIds?.length>0?i.featureIds.slice():null,f=i.positions.slice();return a&&r.push(a.buffer),r.push(f.buffer),{result:{positions:f,featureIds:a},transferList:r}}async function y(e){await v(),S(e);const r={buffer:e.buffer};return{result:r,transferList:[r.buffer]}}async function h(e){await v(),L(e)}async function d(e){A=await v(),A.setLegacySchema(e.context,e.jsonSchema)}async function g(e){const{localMatrix:i,origin:a,positions:f,vertexSpace:c}=e,l=r.fromJSON(e.inSpatialReference),u=r.fromJSON(e.outSpatialReference),m=i?t(i):void 0,p=o(a);let y;const[{projectBuffer:h},{initializeProjection:d}]=await Promise.all([import("../../../geometry/projection/projectBuffer.js"),import("../../../geometry/projectionUtils.js")]);await d(l,u);const g=[0,0,0];if(!h(p,l,0,g,u,0))throw new Error("Failed to project");if("georeferenced"===c.type&&null==c.origin){if(y=new Float64Array(f.length),!h(f,l,0,y,u,0,y.length/3))throw new Error("Failed to project")}else{const e="georeferenced"===c.type?n.fromJSON(c):s.fromJSON(c),{projectMeshVertexPositions:r}=await import("../../../geometry/support/meshUtils/projectMeshVertexPositions.js"),t=r({vertexAttributes:{position:f},transform:m?{localMatrix:m}:void 0,vertexSpace:e,spatialReference:l},u);if(!t)throw new Error("Failed to project");y=t}const b=y.length,[w,j,A]=g;for(let r=0;r<b;r+=3)y[r]-=w,y[r+1]-=j,y[r+2]-=A;return{result:{projected:y,original:f,projectedOrigin:g},transferList:[y.buffer,f.buffer]}}async function b({normalMatrix:r,normals:t}){const o=new Float32Array(t.length);return i(o,t,r),e(r)&&a(o,o),{result:{transformed:o,original:t},transferList:[o.buffer,t.buffer]}}function w(e){U(e)}let j,A;function L(e){if(!A)return;const r=e.modifications,t=A._malloc(8*r.length),o=new Float64Array(A.HEAPU8.buffer,t,r.length);for(let n=0;n<r.length;++n)o[n]=r[n];A.setModifications(e.context,t,r.length,e.isGeodetic),A._free(t)}function x(e,r,t){const{context:o,globalTrafo:n,mbs:s,obbData:i,layouts:a,needNormals:f,elevationOffset:c,geometryBuffer:m,geometryDescriptor:p,indexToVertexProjector:y,vertexToRenderProjector:h,normalReferenceFrame:d}=r,g=e._malloc(m.byteLength),b=33,w=e._malloc(b*Float64Array.BYTES_PER_ELEMENT),j=new Uint8Array(e.HEAPU8.buffer,g,m.byteLength);j.set(new Uint8Array(m));const A=new Float64Array(e.HEAPU8.buffer,w,b);P(A,[NaN,NaN,NaN],0);let L=3;P(A,n,L),L+=16,P(A,s.center,L),L+=3,A[L++]=s.radius,i&&P(A,i,L++);const x={isDraco:!1,isLegacy:!1,color:a.some(e=>e.some(e=>"color"===e.name)),normal:f&&a.some(e=>e.some(e=>"normalCompressed"===e.name)),uv0:a.some(e=>e.some(e=>"uv0"===e.name)),uvRegion:a.some(e=>e.some(e=>"uvRegion"===e.name)),featureIndex:p.featureIndex},E=e.process(o,!!i,g,j.byteLength,p,x,w,c,y,h,d);if(e._free(w),e._free(g),E.error.length>0)throw new Error(`i3s.wasm: ${E.error}`);if(E.discarded)return null;const S=E.componentOffsets.length>0?E.componentOffsets.slice():null,U=E.featureIds.length>0?E.featureIds.slice():null,_=E.anchorIds.length>0?Array.from(E.anchorIds):null,v=E.anchors.length>0?Array.from(E.anchors):null,N=E.interleavedVertedData.slice().buffer,F=1===E.indicesType?new Uint16Array(E.indices.buffer,E.indices.byteOffset,E.indices.byteLength/2).slice():new Uint32Array(E.indices.buffer,E.indices.byteOffset,E.indices.byteLength/4).slice(),I=E.positions.slice(),{buffer:M,byteOffset:O,byteLength:B}=E.positionIndices,R=1===E.positionIndicesType?new Uint16Array(M,O,B/2).slice():new Uint32Array(M,O,B/4).slice(),T=new l(r.layouts[0],N,F,E.hasColors,E.hasModifications,{data:I,indices:R});return U&&t.push(U.buffer),S&&t.push(S.buffer),t.push(N),t.push(F.buffer),t.push(I.buffer),t.push(R.buffer),new u(S,U,_,v,T,n,E.obb)}function E(e){return 0===e?0:1===e?1:2===e?2:3}function S(e){if(!A)return;const{context:r,buffer:t}=e,o=A._malloc(t.byteLength),n=t.byteLength/Float64Array.BYTES_PER_ELEMENT,s=new Float64Array(A.HEAPU8.buffer,o,n),i=new Float64Array(t);s.set(i),A.filterOBBs(r,o,n),i.set(s),A._free(o)}function U(e){A&&0===A.destroy(e)&&(A=null,j=null,c())}function P(e,r,t){for(let o=0;o<r.length;++o)e[o+t]=r[o]}async function _(){A||await v()}async function v(){return A||(A=await(j??=f())),A}const N={transform:(e,r)=>A&&x(A,e,r),destroy:U};export{w as destroyContext,p as dracoDecompressPointCloudData,y as filterObbsForModifications,S as filterObbsForModificationsSync,_ as initialize,E as interpretObbModificationResults,m as process,g as project,d as setLegacySchema,h as setModifications,L as setModificationsSync,N as test,b as transformNormals};
@@ -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 s from"../../../core/Logger.js";import o from"../../../core/PooledArray.js";import{create as t}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{WorkerHandle as e}from"../../../core/workers/WorkerHandle.js";import{canProjectWithoutEngine as r}from"../../../geometry/projectionUtils.js";import{projectVectorToVector as i}from"../../../geometry/projection/projectVectorToVector.js";class n{constructor(s,o,t,e,r,i){this.layout=s,this.interleavedVertexData=o,this.indices=t,this.hasColors=e,this.hasModifications=r,this.positionData=i}}class h{constructor(s,o,t,e,r,i,n){this.componentOffsets=s,this.featureIds=o,this.anchorIds=t,this.anchors=e,this.transformedGeometry=r,this.globalTrafo=i,this.obb=n}}class a extends e{constructor(s){super("SceneLayerWorker","process",{process:s=>[s.geometryBuffer],project:s=>[s.positions.buffer],transformNormals:s=>[s.normals.buffer]},s,{hasInitialize:!0})}setModifications(s,o,t){const e={context:s,modifications:o,isGeodetic:t};return this.broadcast(e,"setModifications")}setLegacySchema(s,o){const t=JSON.stringify(o);return this.broadcast({context:s,jsonSchema:t},"setLegacySchema")}destroyContext(s){return this.broadcast(s,"destroyContext")}async destroyContextAndSelf(s){await this.destroyContext(s),this.destroy()}project(s,o){return this.invokeMethod("project",s,o)}transformNormals(s,o){return this.invokeMethod("transformNormals",s,o)}}const p=new o({deallocator:null}),c=t();function u(o,t,e){p.clear();let n=1/0,h=1/0,a=-1/0,u=-1/0,l=!1;for(const m of t){const o="clip"===m.type?2:"mask"===m.type?1:0,t=m.geometry;let f=s=>s;if(t.spatialReference){if(!r(t.spatialReference,e)){s.getLogger("esri.views.3d.layers.I3SMeshWorkerHandle").warn("im-modification-projection-failed","Can't project modification polygon into layer spatial reference, ignoring modification",{polygon:t});continue}f=s=>(i(s,t.spatialReference,c,e),c)}l=l||1===o;const d=t.rings.length,g=t.rings.some(s=>s.length<3);if(0===d||g)s.getLogger("esri.views.3d.layers.I3SMeshWorkerHandle").warn("im-modification-invalid-polygon","Ignoring invalid modification polygon (no rings or rings with less than 3 vertices).",{polygon:t});else{p.push(o),p.push(d);for(const s of t.rings){p.push(s.length);for(const o of s){const s=f(o);p.push(s[0]),p.push(s[1]),p.push(s[2]??0),n=Math.min(n,s[0]),h=Math.min(h,s[1]),a=Math.max(a,s[0]),u=Math.max(u,s[1])}}}}if(null!=o)if(l){const s=1e-4;p.push(2),p.push(2),p.push(4),p.push(n-s),p.push(h-s),p.push(0),p.push(a+s),p.push(h-s),p.push(0),p.push(a+s),p.push(u+s),p.push(0),p.push(n-s),p.push(u+s),p.push(0),p.push(4),p.push(o[0]),p.push(o[1]),p.push(0),p.push(o[2]),p.push(o[1]),p.push(0),p.push(o[2]),p.push(o[3]),p.push(0),p.push(o[0]),p.push(o[3]),p.push(0)}else p.push(1),p.push(1),p.push(4),p.push(o[0]),p.push(o[1]),p.push(0),p.push(o[2]),p.push(o[1]),p.push(0),p.push(o[2]),p.push(o[3]),p.push(0),p.push(o[0]),p.push(o[3]),p.push(0);p.push(3);const f=new Float64Array(p.length);for(let s=0;s<p.length;++s)f[s]=p.at(s);return f}export{a as I3SMeshWorkerHandle,h as TransformedData,n as TransformedGeometry,u as toWasmModification};
5
+ import s from"../../../core/Logger.js";import o from"../../../core/PooledArray.js";import{create as t}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{WorkerHandle as e}from"../../../core/workers/WorkerHandle.js";import{canProjectWithoutEngine as r}from"../../../geometry/projectionUtils.js";import{projectVectorToVector as i}from"../../../geometry/projection/projectVectorToVector.js";class n{constructor(s,o,t,e,r,i){this.layout=s,this.interleavedVertexData=o,this.indices=t,this.hasColors=e,this.hasModifications=r,this.positionData=i}}class h{constructor(s,o,t,e,r,i,n){this.componentOffsets=s,this.featureIds=o,this.anchorIds=t,this.anchors=e,this.transformedGeometry=r,this.globalTrafo=i,this.obb=n}}class a extends e{constructor(s){super("SceneLayerWorker","process",{process:s=>[s.geometryBuffer],project:s=>[s.positions.buffer],transformNormals:s=>[s.normals.buffer]},s,{hasInitialize:!0})}setModifications(s,o,t){const e={context:s,modifications:o,isGeodetic:t};return this.broadcast(e,"setModifications")}setLegacySchema(s,o){const t=JSON.stringify(o);return this.broadcast({context:s,jsonSchema:t},"setLegacySchema")}destroyContext(s){return this.broadcast(s,"destroyContext")}async destroyContextAndSelf(s){await this.destroyContext(s),this.destroy()}project(s,o){return this.invokeMethod("project",s,o)}transformNormals(s,o){return this.invokeMethod("transformNormals",s,o)}}const p=new o({deallocator:null}),c=t();function u(o,t,e){p.clear();let n=1/0,h=1/0,a=-1/0,u=-1/0,l=!1;for(const m of t){const o="clip"===m.type?2:"mask"===m.type?1:0,t=m.geometry;let f=s=>s;if(t.spatialReference){if(!r(t.spatialReference,e)){s.getLogger("esri.views.3d.layers.SceneLayerWorkerHandle").warn("im-modification-projection-failed","Can't project modification polygon into layer spatial reference, ignoring modification",{polygon:t});continue}f=s=>(i(s,t.spatialReference,c,e),c)}l=l||1===o;const d=t.rings.length,g=t.rings.some(s=>s.length<3);if(0===d||g)s.getLogger("esri.views.3d.layers.SceneLayerWorkerHandle").warn("im-modification-invalid-polygon","Ignoring invalid modification polygon (no rings or rings with less than 3 vertices).",{polygon:t});else{p.push(o),p.push(d);for(const s of t.rings){p.push(s.length);for(const o of s){const s=f(o);p.push(s[0]),p.push(s[1]),p.push(s[2]??0),n=Math.min(n,s[0]),h=Math.min(h,s[1]),a=Math.max(a,s[0]),u=Math.max(u,s[1])}}}}if(null!=o)if(l){const s=1e-4;p.push(2),p.push(2),p.push(4),p.push(n-s),p.push(h-s),p.push(0),p.push(a+s),p.push(h-s),p.push(0),p.push(a+s),p.push(u+s),p.push(0),p.push(n-s),p.push(u+s),p.push(0),p.push(4),p.push(o[0]),p.push(o[1]),p.push(0),p.push(o[2]),p.push(o[1]),p.push(0),p.push(o[2]),p.push(o[3]),p.push(0),p.push(o[0]),p.push(o[3]),p.push(0)}else p.push(1),p.push(1),p.push(4),p.push(o[0]),p.push(o[1]),p.push(0),p.push(o[2]),p.push(o[1]),p.push(0),p.push(o[2]),p.push(o[3]),p.push(0),p.push(o[0]),p.push(o[3]),p.push(0);p.push(3);const f=new Float64Array(p.length);for(let s=0;s<p.length;++s)f[s]=p.at(s);return f}export{a as SceneLayerWorkerHandle,h as TransformedData,n as TransformedGeometry,u as toWasmModification};
@@ -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{result as t,createTask as r}from"../../../../core/asyncUtils.js";import i from"../../../../core/Error.js";import has from"../../../../core/has.js";import{clone as s}from"../../../../core/lang.js";import{abortMaybe as o,releaseMaybe as a}from"../../../../core/maybe.js";import{throwIfAbortError as n,throwIfAborted as l}from"../../../../core/promiseUtils.js";import{pt2px as c,px2pt as h}from"../../../../core/screenUtils.js";import{numericHash as u}from"../../../../core/string.js";import{dataComponents as m}from"../../../../core/urlUtils.js";import{fromValues as d,create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as _,create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as y,ZEROS as g,fromValues as x}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectPointToVector as b}from"../../../../geometry/projection/projectPointToVector.js";import{containsPoint as v}from"../../../../geometry/support/aaBoundingBox.js";import S from"../../../../layers/support/FieldsIndex.js";import{createRendererExpression as P}from"../../../../support/ArcadeExpression.js";import{CIMSymbolHelper as w}from"../../../../symbols/cim/CIMSymbolHelper.js";import{evaluateValueOrFunction as z}from"../../../../symbols/cim/utils.js";import{scaleCIMSymbol as C}from"../../../../symbols/support/cimSymbolUtils.js";import{defaultPrimitive as R}from"../../../../symbols/support/IconSymbol3DLayerResource.js";import{Symbol3DAnchorPosition2D as M}from"../../../../symbols/support/Symbol3DAnchorPosition2D.js";import{getIconHref as I}from"../../../../symbols/support/utils.js";import{transparentUnit as O}from"./constants.js";import{perObjectElevationAligner as j}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as T,needsElevationUpdates2D as F}from"./elevationAlignmentUtils.js";import{focusAreaHUDColor as E}from"./focusAreaStyle.js";import{Graphics3DDrapedGraphicLayer as U}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as D}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as V}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as G}from"./graphicUtils.js";import{namedAnchorToHUDMaterialAnchorPos as L}from"./placementUtils.js";import{placePointOnGeometry as A,updateStageObjectGeometry as H,getLocalOriginForPoint as k,extendPointGraphicElevationContext as B,createStageObject as $}from"./pointUtils.js";import{initFastSymbolUpdatesState as N,updateFastSymbolUpdatesState as q,evaluateModelTransformScale as J,ConvertOptions as Z}from"../support/FastSymbolUpdates.js";import{createTexture as W,requiresHalfTexelOffset as K,defaultBoundingBox as Q,defaultSymbolSizeRatio as X,defaultTexSize as Y}from"../../support/engineContent/sdfPrimitives.js";import{drapedZ as ee}from"../../terrain/OverlayRenderer.js";import{VerticalOffsetParameters as te}from"../../webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js";import{createPointGeometry as re}from"../../webgl-engine/lib/GeometryUtil.js";import{ManagedTexture as ie}from"../../webgl-engine/lib/ManagedTexture.js";import{RenderGeometry as se}from"../../webgl-engine/lib/RenderGeometry.js";import{HUDMaterial as oe}from"../../webgl-engine/materials/HUDMaterial.js";const ae=_(0,0,1),ne=16,le=1.5,ce=[Y*X,Y*X];class he extends V{static{this.PRIMITIVE_SIZE=ce}getCachedSize(){return{size:this._getIconSize()}}static{this.elevationModeChangeTypes={definedChanged:1,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,ye(t)),this._cimData=null,this._overrideHelperClass=null,this._arcadeInfo=null,this._cimSymbolMaterials=new Map,this._cimSymbolTextures=new Map,this._cimMaterialParametersInfo=null,this._cimScaleFactorOrFunction=null,this._size=null,this._symbolTextureRatio=1,this._outlineSize=0,this._textureHandle=null,this._patchTask=null,this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!0}}async doLoad(e){this._validateOrThrow();const t=this._prepareMaterialParameters(),r=this._getPrimitive();if(null!=r)this._prepareResourcesPrimitive(t,r);else{const r=I(this.symbolLayer),i=de(r);null!=i?await this._prepareResourcesCIM(t,JSON.parse(i),e):await this._prepareResourcesHref(t,r,e)}}_validateOrThrow(){if(this._drivenProperties.size)return;const e=G(this._getIconSize());if(e)throw new i("graphics3diconsymbollayer:invalid-size",e)}_getIconSize(){const e=this.symbolLayer,t=Math.round(null!=e.size?c(e.size):ne);return this._drivenProperties.size?Math.max(t,64):t}_generateTextureCIM(e,t){const r=this._overrideHelperClass;let i=this._cimData;if(r&&i&&i.symbol||this.logger.error("Can't create texture, CIM data is undefined"),i.primitiveOverrides){i=s(i);const o=i.primitiveOverrides;r.evaluateOverrides(o,e,this._arcadeInfo.geometryType,null,null,t.layer.fieldsIndex),r.applyOverrides(i.symbol,o)}const o=u(JSON.stringify(i));let a=this._cimSymbolTextures.get(o);if(a)return a;const n=this._context.sharedResources.cimSymbolRasterizer,l=this._context.renderer&&"dictionary"===this._context.renderer.type?this._context.renderer.fieldMap:null;l&&r.applyDictionaryTextOverrides(i.symbol,e,l,null);const c=null!=this._cimScaleFactorOrFunction?z(this._cimScaleFactorOrFunction,e):1;1!==c&&i.symbol&&C(i.symbol,c,!0);const h=w.getEnvelope(i,null,n.resourceManager);if(h?.width&&h.height){const e=h.x+h.width/2,t=h.y+h.height/2,r=n.rasterize({type:"cim",data:i},h.width,h.height,e,t,1,"esriGeometryPoint",0,null,this._context.graphicsCoreOwner.view.state.rasterPixelRatio),s=new M({x:-h.x/h.width-.5,y:(h.height+h.y)/h.height-.5});this._cimMaterialParametersInfo.anchorPosition=pe("relative",s),a=new ie(r,{width:r?.width??1,height:r?.height??1,reloadable:!0})}else a=new ie(new ImageData(1,1),{width:1,height:1,reloadable:!0});return this._cimSymbolTextures.set(o,a),this._context.stage.addTexture(a),a}_prepareMaterialParameters(){const e={anchorPosition:pe(this.symbolLayer.anchor,this.symbolLayer.anchorPosition),rotation:this.symbolLayer.angle},t=this.symbol;ue(t)&&(e.verticalOffset=new te(t.verticalOffset)),this._context.screenSizePerspectiveEnabled&&(e.screenSizePerspective=this.view.screenSizePerspective.parameters),(0!==e.rotation||this._drivenProperties.rotation)&&(e.hasRotation=!0);const r=!!has("enable-feature:non-occluded-hud");return e.occlusionTest=!r,e.occludedFragmentFade=r,e.horizonCullingEnabled=r&&this._context.spherical,e.hasSlicePlane=this._context.slicePlaneEnabled,e}_prepareResourcesPrimitive(e,t){const r=this._getOutlineSize();if(me(t)&&0===r)throw new Error("Nothing to render");if(this._outlineSize=r,e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,null!=this._context.sharedResources.textures){const r=this._context.sharedResources.textures.fromData(`${t}-icon`,()=>W(t));this._textureHandle=r,e.textureId=r.managedTexture.id}e.textureIsSignedDistanceField=!0,e.sampleSignedDistanceFieldTexelCenter=K(t),e.distanceFieldBoundingBox=Q;const i=this._getIconSize();this._size=[i,i],this._symbolTextureRatio=1/X,this._createMaterial(e)}async _prepareResourcesHref(e,r,s){this._outlineSize=this._getOutlineSize(),e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,e.textureIsSignedDistanceField=!1;const o=this._getIconSize(),a=o*this._context.graphicsCoreOwner.view.state.rasterPixelRatio;if(null!=this._context.sharedResources.textures){const l=await t(this._context.sharedResources.textures.fromUrl(r,a,{signal:s}));if(!1===l.ok){n(l.error);throw new i("graphics3diconsymbollayer:request-failed",`Failed to load (Request for icon resource failed: ${r})`)}this._textureHandle=l.value;const c=l.value.managedTexture;this._size=_e(c,o),e.textureId=c.id}this._createMaterial(e)}async _prepareResourcesCIM(e,t,r){const{OverrideHelper:i}=await import("../../../../symbols/cim/OverrideHelper.js");if(this._overrideHelperClass=i,this._cimData=t,!this._context.sharedResources.cimSymbolRasterizer){const e=(await import("../../../../symbols/cim/CIMSymbolRasterizer.js")).CIMSymbolRasterizer;l(r),this._context.sharedResources.cimSymbolRasterizer??=new e(this._context.renderCoordsHelper.spatialReference)}const s=this._context.sharedResources.cimSymbolRasterizer,o=[],a=t,n=a?.symbol;w.fetchResources(n,s.resourceManager,o,r),w.fetchFonts(n,s.resourceManager,o);const c=this._context.layer.fields?this._context.layer.fields.map(e=>e.toJSON()):[],h=this._context.renderCoordsHelper.spatialReference;if(this._arcadeInfo={spatialReference:h,fields:c,geometryType:"esriGeometryPoint"},a?.primitiveOverrides&&o.push(i.createRenderExpressions(a.primitiveOverrides,this._arcadeInfo)),o.length>0&&(await Promise.all(o),l(r)),this._context.renderer&&"dictionary"===this._context.renderer.type&&this._context.renderer.scaleExpression){const e=this._context.renderer;if(e.scaleExpression){const t=e.scaleExpression,r=await P(t,this._context.layer.spatialReference),{default:i}=await import("../../../2d/arcade/callExpressionWithFeature.js"),s=new S(c);this._cimScaleFactorOrFunction=(e,t,o)=>{const a=i(r,e,{$view:o},"esriGeometryPoint",s,t);return null!==a?a:1}}}l(r),this._cimMaterialParametersInfo=e,this._cimMaterialParametersInfo.color=this._getFillColor(),this._cimMaterialParametersInfo.outlineColor=[0,0,0,0],this._cimMaterialParametersInfo.outlineSize=0,this._cimMaterialParametersInfo.textureIsSignedDistanceField=!1}_getPrimitive(){return fe(this.symbolLayer)}_getOutlineSize(){let e=0;const t=this.symbolLayer;if(null!=t.outline?.size)return Math.max(c(t.outline.size),0);return e=me(this._getPrimitive())?le:0,Math.max(e,0)}_getOutlineColor(){const t=this._getLayerOpacity(),r=this.symbolLayer,i=r?.outline?.color;if(null!=i){const r=e.toUnitRGB(i),s=i.a*t;return[r[0],r[1],r[2],s]}return[0,0,0,0]}_getFillColor(){if(me(this._getPrimitive()))return O;const e=null==this._getPrimitive(),t=this._materialColor;return this._getCombinedOpacityAndColor(t,{hasIntrinsicColor:e})}get _materialColor(){return this.symbolLayer.material?.color}get _fastVisualVariableFallbackColor(){const t=this._materialColor;if(null==t){return null==this._getPrimitive()?y:g}return e.toUnitRGBA(t)}_getFallbackSize(){const e=this._getIconSize(),{symbolLayer:{size:t}}=this;return(null!=t?Math.round(c(t)):ne)/e}_createMaterial(e){const t=this._context.spherical;if(this._cimData){this._fastUpdates=null;let r=e.textureId?this._cimSymbolMaterials.get(e.textureId):null;return r||(r=new oe(e,t),this._cimSymbolMaterials.set(e.textureId??0,r)),r}this._fastUpdates=N(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastUpdates&&(e={...e,...this._fastUpdates.materialParameters}),this._materials[0]=new oe(e,t),e.isFocused=!1;const r=this.view.map?.focusAreas.style;return e.color=E(e.color,r),e.outlineColor=E(e.outlineColor,r),this._materials[1]=new oe(e,t),this._materials[0]}_setDrapingDependentMaterialParameters(){this.draped&&(this._forEachMaterial(e=>{e.setParameters({verticalOffset:null,screenSizePerspective:null,occlusionTest:!1,hasSlicePlane:!1,shaderPolygonOffset:0,draped:this.draped})}),this.layerOpacityChanged())}destroy(){super.destroy(),this._patchTask=o(this._patchTask),this._materials.length=0,this._cimSymbolMaterials.clear(),this._cimSymbolTextures.forEach(e=>this._context.stage.removeTexture(e)),this._cimSymbolTextures.clear(),this._textureHandle=a(this._textureHandle)}_getScaleFactor({size:e},t){if(!this._drivenProperties.size)return 1;if(null==e)return this._getFallbackSize();const[r,i,s]=e;return"symbol-value"===r?1:"number"==typeof r&&isFinite(r)?c(r)/t:"number"==typeof s&&isFinite(s)?c(s)/t:1}_getDrivenRotation(e){return this._drivenProperties.rotation?e.heading??0:0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;const r=A(t.geometry);if(null==r)return this.logger.warn(`unsupported geometry type for text symbol: ${t.geometry.type}`),null;let i,s=[0,0];const o=this.view.focusAreasView?.containsGeometry(r)??!0;if(this._cimData){if(!this._cimData.symbol)return null;const r=this._generateTextureCIM(t,e),a={textureId:r.id,isFocused:o,...this._cimMaterialParametersInfo};i=this._createMaterial(a);const n=this._context.graphicsCoreOwner.view.state.rasterPixelRatio;s=[r.parameters.width/n,r.parameters.height/n]}else s=this._size,i=o?this._materials[0]:this._materials[1];if(null==r)return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;const a=e.renderingInfo,n=this._getDrivenUInt8Color(a,this._materialColor,null==this._getPrimitive()),l=this._getDrivenRotation(a);let c=1;if(!this._fastUpdates?.visualVariables.size){const e=s[0]>s[1]?s[0]:s[1];c=this._getScaleFactor(a,e)}c*=this._symbolTextureRatio;const h=d(s[0]*c,s[1]*c),u=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===u.mode)&&this._setDrapingDependentMaterialParameters(),this.draped?this._createAsOverlay(t,r,i,n,l,h):this._createAs3DShape(t,r,i,n,l,h,u,t.uid)}layerOpacityChanged(){const e=this._getFillColor(),t=this._getOutlineColor();this._forEachMaterial(r=>{r.setParameters({color:e}),r.setParameters({outlineColor:t})})}layerScreenSizePerspectiveChanged(){const e=this._context.screenSizePerspectiveEnabled&&!this.draped?this.view.screenSizePerspective.parameters:null;this._forEachMaterial(t=>{t.setParameters({screenSizePerspective:e})})}updateGeometry(e,t){const r=e.geometry;if(this.draped||!r||!this._validateGeometry(r))return!1;const{elevationContext:i,stageObject:s}=t;if(i.mode!==this.getGeometryElevationMode(r))return!1;const o=A(r);if(!o)return!1;i.updateFeatureExpressionFeature(e,this._context.layer);const a=H(s,this._context,o,i);if(null==a)return!1;const n=k(this._context,o);return s.geometries[0].localOrigin===n&&(t.alignedSampledElevation=a,B(t,o,this._context.elevationProvider),!0)}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,s=T(he.elevationModeChangeTypes,r,i);if(1!==s)return s;const o=F(i)||"absolute-height"===i;return this.updateGraphics3DGraphicElevationInfo(e,t,()=>o)}slicePlaneEnabledChanged(){return this.draped||this._forEachMaterial(e=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),!0}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return null!=this._getPrimitive()}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!q(this._fastUpdates,t,this._fastVisualVariableConvertOptions()))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}get needsUpdateFocus(){return!0}prepareSymbolLayerPatch(e){if(this._patchTask?.abort(),"partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchResource(e,t),this._preparePatchRotation(e,t)}_preparePatchResource(e,s){if(!s.resource||"partial"!==s.resource.type)return;const c=s.resource.diff;if("complete"!==c?.href?.type)return;const h=c.href.newValue,{textures:u}=this._context.sharedResources;if(null==h||null==u||null!=de(h))return;const m=this._getIconSize(),d=m*this._context.graphicsCoreOwner.view.state.pixelRatio;e.symbolLayerStatePatches.push(()=>{this._patchTask=o(this._patchTask),this._patchTask=r(e=>this._context.schedule(async(e,r)=>{const s=await t(u.fromUrl(h,d,{signal:r}));l(r);const o=!s.ok;if(o&&n(s.error),this._textureHandle=a(this._textureHandle),this._patchTask=null,o){this._forEachMaterial(e=>{e.visible=!1,e.setParameters({textureId:null})});const e=`Failed to load (Request for icon resource failed: ${h})`;return void this.logger.error(new i("graphics3diconsymbollayer:request-failed",e))}this._textureHandle=s.value;const c=s.value.managedTexture;this._size=_e(c,m),this._forEachMaterial(e=>{e.setParameters({textureId:c.id}),e.visible=!0})},e))}),delete c.href}_preparePatchRotation(e,t){if(!t.angle||"complete"!==t.angle.type)return;const r=t.angle.newValue??0,i=0!==r||this._drivenProperties.rotation;e.symbolLayerStatePatches.push(()=>{this._forEachMaterial(e=>e.setParameters({rotation:r,hasRotation:i}))}),delete t.angle}_defaultElevationInfoNoZ(){return ge}_createAs3DShape(e,t,r,i,s,o,a,n){const l=this.getFastUpdateAttrValues(e),c=this._context.layerViewUid,h=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:n,layerViewUid:c}),u=re(r,{normal:ae,color:i,rotation:s,size:o,centerOffsetAndDistance:xe,featureAttribute:l,olidColor:h}),m=$(this._context,t,u,a,n);if(null==m)return null;const d=new D(this,m.object,null,j,a);return d.hiddenIfDeconflicted=!0,d.alignedSampledElevation=m.sampledElevation,d.needsElevationUpdates=F(a.mode)||"absolute-height"===a.mode,d.getScreenSize=this._createScreenSizeGetter(o,l),d.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(d.getScreenSize(),1,e),B(d,t,this._context.elevationProvider),d}_createAsOverlay(e,t,r,i,s,o){r.renderPriority=this._renderPriority;const a=f();b(t,a,this._context.overlaySR),a[2]=ee;const n=this._context.clippingExtent;if(null!=n&&!v(n,a))return null;const l=this.getFastUpdateAttrValues(e),c=e.uid,h=this._context.layerViewUid,u=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:c,layerViewUid:h}),m=re(r,{normal:ae,position:a,color:i,rotation:s,size:o,featureAttribute:l,olidColor:u}),d=new se(m,{layerViewUid:h,graphicUid:c}),p=new U(this,[d],null,this._context.drapeSourceRenderer);return p.getScreenSize=this._createScreenSizeGetter(o,l),p.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(p.getScreenSize(),1,e),p}_createScreenSizeGetter(e,t){const r=this._outlineSize+2;if(this._fastUpdates&&t){const i=e[0]/this._symbolTextureRatio,s=e[1]/this._symbolTextureRatio;return(e=p())=>{const[o,a]=J(be,this._fastUpdates.materialParameters,t);return e[0]=o*i+r,e[1]=a*s+r,e}}const i=e[0]/this._symbolTextureRatio+r,s=e[1]/this._symbolTextureRatio+r;return(e=p())=>(e[0]=i,e[1]=s,e)}_fastVisualVariableConvertOptions(){const e=Math.max(this._size[0],this._size[1]),t=_(e,e,e),r=h(1),i=e*r,s=_(i,i,i),o=this._getFallbackSize();return new Z({supports:{size:!0,color:!0,rotation:!0,opacity:!1},modelSize:t,symbolSize:s,unitInMeters:r,fallbackColor:this._fastVisualVariableFallbackColor,fallbackSize:_(o,o,o)})}_forEachMaterial(e){this._materials.forEach(e),this._cimSymbolMaterials.forEach(e)}test(){return{...super.test(),material:this._materials[0]}}}function ue(e){return e&&"point-3d"===e.type&&e.hasVisibleVerticalOffset()}function me(e){return null!=e&&("cross"===e||"x"===e)}function de(e){const t=m(e);return"application/json"===t?.mediaType?t.data:void 0}function pe(e,t){return"relative"===e?d((t.x||0)+.5,.5-(t.y||0)):e in L?L[e]:L.center}function _e({parameters:e},t){const r=(e.width??1)/(e.height??1);return r>1?[t,Math.round(t/r)]:[Math.round(t*r),t]}function fe(e){return e.resource?.href?null:e.resource?.primitive??R}function ye(e){return 1===(e.material?.color?.a??0)&&null!=fe(e)}const ge={mode:"relative-to-ground",offset:0},xe=x(0,0,0,1),be=f();export{he as Graphics3DIconSymbolLayer};
5
+ import{result as e,createTask as t}from"../../../../core/asyncUtils.js";import r from"../../../../core/Error.js";import has from"../../../../core/has.js";import{clone as i}from"../../../../core/lang.js";import{abortMaybe as s,releaseMaybe as o}from"../../../../core/maybe.js";import{throwIfAbortError as a,throwIfAborted as n}from"../../../../core/promiseUtils.js";import{pt2px as l,px2pt as c}from"../../../../core/screenUtils.js";import{numericHash as h}from"../../../../core/string.js";import{dataComponents as u}from"../../../../core/urlUtils.js";import{fromValues as m,create as d}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as p,create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as f,ZEROS as y,fromValues as g}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectPointToVector as x}from"../../../../geometry/projection/projectPointToVector.js";import{containsPoint as b}from"../../../../geometry/support/aaBoundingBox.js";import v from"../../../../layers/support/FieldsIndex.js";import{createRendererExpression as S}from"../../../../support/ArcadeExpression.js";import{CIMSymbolHelper as P}from"../../../../symbols/cim/CIMSymbolHelper.js";import{evaluateValueOrFunction as w}from"../../../../symbols/cim/utils.js";import{scaleCIMSymbol as z}from"../../../../symbols/support/cimSymbolUtils.js";import{defaultPrimitive as C}from"../../../../symbols/support/IconSymbol3DLayerResource.js";import{Symbol3DAnchorPosition2D as R}from"../../../../symbols/support/Symbol3DAnchorPosition2D.js";import{getIconHref as M}from"../../../../symbols/support/utils.js";import{transparentUnit as I}from"./constants.js";import{perObjectElevationAligner as O}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as j,needsElevationUpdates2D as T}from"./elevationAlignmentUtils.js";import{focusAreaHUDColor as F}from"./focusAreaStyle.js";import{Graphics3DDrapedGraphicLayer as E}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as U}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as D}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as V}from"./graphicUtils.js";import{namedAnchorToHUDMaterialAnchorPos as G}from"./placementUtils.js";import{placePointOnGeometry as L,updateStageObjectGeometry as A,getLocalOriginForPoint as H,extendPointGraphicElevationContext as k,createStageObject as B}from"./pointUtils.js";import{initFastSymbolUpdatesState as $,updateFastSymbolUpdatesState as N,evaluateModelTransformScale as q,ConvertOptions as J}from"../support/FastSymbolUpdates.js";import{createTexture as Z,requiresHalfTexelOffset as W,defaultBoundingBox as K,defaultSymbolSizeRatio as Q,defaultTexSize as X}from"../../support/engineContent/sdfPrimitives.js";import{drapedZ as Y}from"../../terrain/OverlayRenderer.js";import{VerticalOffsetParameters as ee}from"../../webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js";import{createPointGeometry as te}from"../../webgl-engine/lib/GeometryUtil.js";import{ManagedTexture as re}from"../../webgl-engine/lib/ManagedTexture.js";import{RenderGeometry as ie}from"../../webgl-engine/lib/RenderGeometry.js";import{HUDMaterial as se}from"../../webgl-engine/materials/HUDMaterial.js";const oe=p(0,0,1),ae=16,ne=1.5,le=[X*Q,X*Q];class ce extends D{static{this.PRIMITIVE_SIZE=le}getCachedSize(){return{size:this._getIconSize()}}static{this.elevationModeChangeTypes={definedChanged:1,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,fe(t)),this._cimData=null,this._overrideHelperClass=null,this._arcadeInfo=null,this._cimSymbolMaterials=new Map,this._cimSymbolTextures=new Map,this._cimMaterialParametersInfo=null,this._cimScaleFactorOrFunction=null,this._size=null,this._symbolTextureRatio=1,this._outlineSize=0,this._textureHandle=null,this._patchTask=null,this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!0}}async doLoad(e){this._validateOrThrow();const t=this._prepareMaterialParameters(),r=this._getPrimitive();if(null!=r)this._prepareResourcesPrimitive(t,r);else{const r=M(this.symbolLayer),i=me(r);null!=i?await this._prepareResourcesCIM(t,JSON.parse(i),e):await this._prepareResourcesHref(t,r,e)}}_validateOrThrow(){if(this._drivenProperties.size)return;const e=V(this._getIconSize());if(e)throw new r("graphics3diconsymbollayer:invalid-size",e)}_getIconSize(){const e=this.symbolLayer,t=Math.round(null!=e.size?l(e.size):ae);return this._drivenProperties.size?Math.max(t,64):t}_generateTextureCIM(e,t){const r=this._overrideHelperClass;let s=this._cimData;if(r&&s&&s.symbol||this.logger.error("Can't create texture, CIM data is undefined"),s.primitiveOverrides){s=i(s);const o=s.primitiveOverrides;r.evaluateOverrides(o,e,this._arcadeInfo.geometryType,null,null,t.layer.fieldsIndex),r.applyOverrides(s.symbol,o)}const o=h(JSON.stringify(s));let a=this._cimSymbolTextures.get(o);if(a)return a;const n=this._context.sharedResources.cimSymbolRasterizer,l=this._context.renderer&&"dictionary"===this._context.renderer.type?this._context.renderer.fieldMap:null;l&&r.applyDictionaryTextOverrides(s.symbol,e,l,null);const c=null!=this._cimScaleFactorOrFunction?w(this._cimScaleFactorOrFunction,e):1;1!==c&&s.symbol&&z(s.symbol,c,!0);const u=P.getEnvelope(s,null,n.resourceManager);if(u?.width&&u.height){const e=u.x+u.width/2,t=u.y+u.height/2,r=n.rasterize({type:"cim",data:s},u.width,u.height,e,t,1,"esriGeometryPoint",0,null,this._context.graphicsCoreOwner.view.state.rasterPixelRatio),i=new R({x:-u.x/u.width-.5,y:(u.height+u.y)/u.height-.5});this._cimMaterialParametersInfo.anchorPosition=de("relative",i),a=new re(r,{width:r?.width??1,height:r?.height??1,reloadable:!0})}else a=new re(new ImageData(1,1),{width:1,height:1,reloadable:!0});return this._cimSymbolTextures.set(o,a),this._context.stage.addTexture(a),a}_prepareMaterialParameters(){const e={anchorPosition:de(this.symbolLayer.anchor,this.symbolLayer.anchorPosition),rotation:this.symbolLayer.angle},t=this.symbol;he(t)&&(e.verticalOffset=new ee(t.verticalOffset)),this._context.screenSizePerspectiveEnabled&&(e.screenSizePerspective=this.view.screenSizePerspective.parameters),(0!==e.rotation||this._drivenProperties.rotation)&&(e.hasRotation=!0);const r=!!has("enable-feature:non-occluded-hud");return e.occlusionTest=!r,e.occludedFragmentFade=r,e.horizonCullingEnabled=r&&this._context.spherical,e.hasSlicePlane=this._context.slicePlaneEnabled,e}_prepareResourcesPrimitive(e,t){const r=this._getOutlineSize();if(ue(t)&&0===r)throw new Error("Nothing to render");if(this._outlineSize=r,e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,null!=this._context.sharedResources.textures){const r=this._context.sharedResources.textures.fromData(`${t}-icon`,()=>Z(t));this._textureHandle=r,e.textureId=r.managedTexture.id}e.textureIsSignedDistanceField=!0,e.sampleSignedDistanceFieldTexelCenter=W(t),e.distanceFieldBoundingBox=K;const i=this._getIconSize();this._size=[i,i],this._symbolTextureRatio=1/Q,this._createMaterial(e)}async _prepareResourcesHref(t,i,s){this._outlineSize=this._getOutlineSize(),t.color=this._getFillColor(),t.outlineColor=this._getOutlineColor(),t.outlineSize=this._outlineSize,t.textureIsSignedDistanceField=!1;const o=this._getIconSize(),n=o*this._context.graphicsCoreOwner.view.state.rasterPixelRatio;if(null!=this._context.sharedResources.textures){const l=await e(this._context.sharedResources.textures.fromUrl(i,n,{signal:s}));if(!1===l.ok){a(l.error);throw new r("graphics3diconsymbollayer:request-failed",`Failed to load (Request for icon resource failed: ${i})`)}this._textureHandle=l.value;const c=l.value.managedTexture;this._size=pe(c,o),t.textureId=c.id}this._createMaterial(t)}async _prepareResourcesCIM(e,t,r){const{OverrideHelper:i}=await import("../../../../symbols/cim/OverrideHelper.js");if(this._overrideHelperClass=i,this._cimData=t,!this._context.sharedResources.cimSymbolRasterizer){const e=(await import("../../../../symbols/cim/CIMSymbolRasterizer.js")).CIMSymbolRasterizer;n(r),this._context.sharedResources.cimSymbolRasterizer??=new e(this._context.renderCoordsHelper.spatialReference)}const s=this._context.sharedResources.cimSymbolRasterizer,o=[],a=t,l=a?.symbol;P.fetchResources(l,s.resourceManager,o,r),P.fetchFonts(l,s.resourceManager,o);const c=this._context.layer.fields?this._context.layer.fields.map(e=>e.toJSON()):[],h=this._context.renderCoordsHelper.spatialReference;if(this._arcadeInfo={spatialReference:h,fields:c,geometryType:"esriGeometryPoint"},a?.primitiveOverrides&&o.push(i.createRenderExpressions(a.primitiveOverrides,this._arcadeInfo)),o.length>0&&(await Promise.all(o),n(r)),this._context.renderer&&"dictionary"===this._context.renderer.type&&this._context.renderer.scaleExpression){const e=this._context.renderer;if(e.scaleExpression){const t=e.scaleExpression,r=await S(t,this._context.layer.spatialReference),{default:i}=await import("../../../2d/arcade/callExpressionWithFeature.js"),s=new v(c);this._cimScaleFactorOrFunction=(e,t,o)=>{const a=i(r,e,{$view:o},"esriGeometryPoint",s,t);return null!==a?a:1}}}n(r),this._cimMaterialParametersInfo=e,this._cimMaterialParametersInfo.color=this._getFillColor(),this._cimMaterialParametersInfo.outlineColor=[0,0,0,0],this._cimMaterialParametersInfo.outlineSize=0,this._cimMaterialParametersInfo.textureIsSignedDistanceField=!1}_getPrimitive(){return _e(this.symbolLayer)}_getOutlineSize(){let e=0;const t=this.symbolLayer;if(null!=t.outline?.size)return Math.max(l(t.outline.size),0);return e=ue(this._getPrimitive())?ne:0,Math.max(e,0)}_getOutlineColor(){const e=this._getLayerOpacity(),t=this.symbolLayer,r=t?.outline?.color;if(null!=r){const t=r.toUnitRGB(),i=r.a*e;return[t[0],t[1],t[2],i]}return[0,0,0,0]}_getFillColor(){if(ue(this._getPrimitive()))return I;const e=null==this._getPrimitive(),t=this._materialColor;return this._getCombinedOpacityAndColor(t,{hasIntrinsicColor:e})}get _materialColor(){return this.symbolLayer.material?.color}get _fastVisualVariableFallbackColor(){const e=this._materialColor;if(null==e){return null==this._getPrimitive()?f:y}return e.toUnitRGBA()}_getFallbackSize(){const e=this._getIconSize(),{symbolLayer:{size:t}}=this;return(null!=t?Math.round(l(t)):ae)/e}_createMaterial(e){const t=this._context.spherical;if(this._cimData){this._fastUpdates=null;let r=e.textureId?this._cimSymbolMaterials.get(e.textureId):null;return r||(r=new se(e,t),this._cimSymbolMaterials.set(e.textureId??0,r)),r}this._fastUpdates=$(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastUpdates&&(e={...e,...this._fastUpdates.materialParameters}),this._materials[0]=new se(e,t),e.isFocused=!1;const r=this.view.map?.focusAreas.style;return e.color=F(e.color,r),e.outlineColor=F(e.outlineColor,r),this._materials[1]=new se(e,t),this._materials[0]}_setDrapingDependentMaterialParameters(){this.draped&&(this._forEachMaterial(e=>{e.setParameters({verticalOffset:null,screenSizePerspective:null,occlusionTest:!1,hasSlicePlane:!1,shaderPolygonOffset:0,draped:this.draped})}),this.layerOpacityChanged())}destroy(){super.destroy(),this._patchTask=s(this._patchTask),this._materials.length=0,this._cimSymbolMaterials.clear(),this._cimSymbolTextures.forEach(e=>this._context.stage.removeTexture(e)),this._cimSymbolTextures.clear(),this._textureHandle=o(this._textureHandle)}_getScaleFactor({size:e},t){if(!this._drivenProperties.size)return 1;if(null==e)return this._getFallbackSize();const[r,i,s]=e;return"symbol-value"===r?1:"number"==typeof r&&isFinite(r)?l(r)/t:"number"==typeof s&&isFinite(s)?l(s)/t:1}_getDrivenRotation(e){return this._drivenProperties.rotation?e.heading??0:0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;const r=L(t.geometry);if(null==r)return this.logger.warn(`unsupported geometry type for text symbol: ${t.geometry.type}`),null;let i,s=[0,0];const o=this.view.focusAreasView?.containsGeometry(r)??!0;if(this._cimData){if(!this._cimData.symbol)return null;const r=this._generateTextureCIM(t,e),a={textureId:r.id,isFocused:o,...this._cimMaterialParametersInfo};i=this._createMaterial(a);const n=this._context.graphicsCoreOwner.view.state.rasterPixelRatio;s=[r.parameters.width/n,r.parameters.height/n]}else s=this._size,i=o?this._materials[0]:this._materials[1];if(null==r)return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;const a=e.renderingInfo,n=this._getDrivenUInt8Color(a,this._materialColor,null==this._getPrimitive()),l=this._getDrivenRotation(a);let c=1;if(!this._fastUpdates?.visualVariables.size){const e=s[0]>s[1]?s[0]:s[1];c=this._getScaleFactor(a,e)}c*=this._symbolTextureRatio;const h=m(s[0]*c,s[1]*c),u=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===u.mode)&&this._setDrapingDependentMaterialParameters(),this.draped?this._createAsOverlay(t,r,i,n,l,h):this._createAs3DShape(t,r,i,n,l,h,u,t.uid)}layerOpacityChanged(){const e=this._getFillColor(),t=this._getOutlineColor();this._forEachMaterial(r=>{r.setParameters({color:e}),r.setParameters({outlineColor:t})})}layerScreenSizePerspectiveChanged(){const e=this._context.screenSizePerspectiveEnabled&&!this.draped?this.view.screenSizePerspective.parameters:null;this._forEachMaterial(t=>{t.setParameters({screenSizePerspective:e})})}updateGeometry(e,t){const r=e.geometry;if(this.draped||!r||!this._validateGeometry(r))return!1;const{elevationContext:i,stageObject:s}=t;if(i.mode!==this.getGeometryElevationMode(r))return!1;const o=L(r);if(!o)return!1;i.updateFeatureExpressionFeature(e,this._context.layer);const a=A(s,this._context,o,i);if(null==a)return!1;const n=H(this._context,o);return s.geometries[0].localOrigin===n&&(t.alignedSampledElevation=a,k(t,o,this._context.elevationProvider),!0)}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,s=j(ce.elevationModeChangeTypes,r,i);if(1!==s)return s;const o=T(i)||"absolute-height"===i;return this.updateGraphics3DGraphicElevationInfo(e,t,()=>o)}slicePlaneEnabledChanged(){return this.draped||this._forEachMaterial(e=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),!0}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return null!=this._getPrimitive()}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!N(this._fastUpdates,t,this._fastVisualVariableConvertOptions()))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}get needsUpdateFocus(){return!0}prepareSymbolLayerPatch(e){if(this._patchTask?.abort(),"partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchResource(e,t),this._preparePatchRotation(e,t)}_preparePatchResource(i,l){if(!l.resource||"partial"!==l.resource.type)return;const c=l.resource.diff;if("complete"!==c?.href?.type)return;const h=c.href.newValue,{textures:u}=this._context.sharedResources;if(null==h||null==u||null!=me(h))return;const m=this._getIconSize(),d=m*this._context.graphicsCoreOwner.view.state.pixelRatio;i.symbolLayerStatePatches.push(()=>{this._patchTask=s(this._patchTask),this._patchTask=t(t=>this._context.schedule(async(t,i)=>{const s=await e(u.fromUrl(h,d,{signal:i}));n(i);const l=!s.ok;if(l&&a(s.error),this._textureHandle=o(this._textureHandle),this._patchTask=null,l){this._forEachMaterial(e=>{e.visible=!1,e.setParameters({textureId:null})});const e=`Failed to load (Request for icon resource failed: ${h})`;return void this.logger.error(new r("graphics3diconsymbollayer:request-failed",e))}this._textureHandle=s.value;const c=s.value.managedTexture;this._size=pe(c,m),this._forEachMaterial(e=>{e.setParameters({textureId:c.id}),e.visible=!0})},t))}),delete c.href}_preparePatchRotation(e,t){if(!t.angle||"complete"!==t.angle.type)return;const r=t.angle.newValue??0,i=0!==r||this._drivenProperties.rotation;e.symbolLayerStatePatches.push(()=>{this._forEachMaterial(e=>e.setParameters({rotation:r,hasRotation:i}))}),delete t.angle}_defaultElevationInfoNoZ(){return ye}_createAs3DShape(e,t,r,i,s,o,a,n){const l=this.getFastUpdateAttrValues(e),c=this._context.layerViewUid,h=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:n,layerViewUid:c}),u=te(r,{normal:oe,color:i,rotation:s,size:o,centerOffsetAndDistance:ge,featureAttribute:l,olidColor:h}),m=B(this._context,t,u,a,n);if(null==m)return null;const d=new U(this,m.object,null,O,a);return d.hiddenIfDeconflicted=!0,d.alignedSampledElevation=m.sampledElevation,d.needsElevationUpdates=T(a.mode)||"absolute-height"===a.mode,d.getScreenSize=this._createScreenSizeGetter(o,l),d.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(d.getScreenSize(),1,e),k(d,t,this._context.elevationProvider),d}_createAsOverlay(e,t,r,i,s,o){r.renderPriority=this._renderPriority;const a=_();x(t,a,this._context.overlaySR),a[2]=Y;const n=this._context.clippingExtent;if(null!=n&&!b(n,a))return null;const l=this.getFastUpdateAttrValues(e),c=e.uid,h=this._context.layerViewUid,u=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:c,layerViewUid:h}),m=te(r,{normal:oe,position:a,color:i,rotation:s,size:o,featureAttribute:l,olidColor:u}),d=new ie(m,{layerViewUid:h,graphicUid:c}),p=new E(this,[d],null,this._context.drapeSourceRenderer);return p.getScreenSize=this._createScreenSizeGetter(o,l),p.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(p.getScreenSize(),1,e),p}_createScreenSizeGetter(e,t){const r=this._outlineSize+2;if(this._fastUpdates&&t){const i=e[0]/this._symbolTextureRatio,s=e[1]/this._symbolTextureRatio;return(e=d())=>{const[o,a]=q(xe,this._fastUpdates.materialParameters,t);return e[0]=o*i+r,e[1]=a*s+r,e}}const i=e[0]/this._symbolTextureRatio+r,s=e[1]/this._symbolTextureRatio+r;return(e=d())=>(e[0]=i,e[1]=s,e)}_fastVisualVariableConvertOptions(){const e=Math.max(this._size[0],this._size[1]),t=p(e,e,e),r=c(1),i=e*r,s=p(i,i,i),o=this._getFallbackSize();return new J({supports:{size:!0,color:!0,rotation:!0,opacity:!1},modelSize:t,symbolSize:s,unitInMeters:r,fallbackColor:this._fastVisualVariableFallbackColor,fallbackSize:p(o,o,o)})}_forEachMaterial(e){this._materials.forEach(e),this._cimSymbolMaterials.forEach(e)}test(){return{...super.test(),material:this._materials[0]}}}function he(e){return e&&"point-3d"===e.type&&e.hasVisibleVerticalOffset()}function ue(e){return null!=e&&("cross"===e||"x"===e)}function me(e){const t=u(e);return"application/json"===t?.mediaType?t.data:void 0}function de(e,t){return"relative"===e?m((t.x||0)+.5,.5-(t.y||0)):e in G?G[e]:G.center}function pe({parameters:e},t){const r=(e.width??1)/(e.height??1);return r>1?[t,Math.round(t/r)]:[Math.round(t*r),t]}function _e(e){return e.resource?.href?null:e.resource?.primitive??C}function fe(e){return 1===(e.material?.color?.a??0)&&null!=_e(e)}const ye={mode:"relative-to-ground",offset:0},ge=g(0,0,0,1),xe=_();export{ce as Graphics3DIconSymbolLayer};
@@ -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 has from"../../../../core/has.js";import{pt2px as t}from"../../../../core/screenUtils.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as n,ZEROS as i}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderingInfo as s}from"../../../../renderers/support/RenderingInfo.js";import{textSymbolLayerSupportsVerticalOffset as a}from"../../../../symbols/callouts/calloutUtils.js";import{perObjectElevationAligner as o}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as l,needsElevationUpdates2D as c}from"./elevationAlignmentUtils.js";import{Graphics3DGraphicCreationContext as h}from"./Graphics3DGraphicCreationContext.js";import{Graphics3DObject3DGraphicLayer as p}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DObjectMetadata as m}from"./Graphics3DObjectMetadata.js";import{Graphics3DSymbolLayer as d}from"./Graphics3DSymbolLayer.js";import{computeCentroid as f}from"./graphicUtils.js";import{createStageObject as u,extendPointGraphicElevationContext as g}from"./pointUtils.js";import{SymbolComplexity as v}from"./SymbolComplexity.js";import{Attribute as y}from"../../webgl-engine/lib/Attribute.js";import{Geometry as b}from"../../webgl-engine/lib/Geometry.js";import{LineCalloutMaterial as x,Parameters as _,uniqueMaterialIdentifier as C}from"../../webgl-engine/materials/LineCalloutMaterial.js";class O extends d{static{this.elevationModeChangeTypes={definedChanged:1,staysOnTheGround:1,onTheGroundChanged:2}}constructor(e,t){super(e,null,t,w),this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!1},this.ensureDrapedStatus(!1)}async doLoad(){this._materials[0]=new x(this._materialParameters,this._context.spherical)}_perInstanceMaterialParameters(e){const t=this._materialParameters;return t.horizontalScreenOffset=e.horizontalScreenOffset??0,t.centerOffsetUnits=e.centerOffsetUnits||"world",t}get _materialParameters(){const r=new _,n=this.symbol,s=n.callout;if(s.color){const t=e.toUnitRGBA(s.color);t[3]*=this._getLayerOpacity(),r.color=t}else r.color=i;if(r.size=t(s.size||0),n.verticalOffset){const{screenLength:e,minWorldLength:i,maxWorldLength:s}=n.verticalOffset;r.verticalOffset={screenLength:t(e),minWorldLength:i||0,maxWorldLength:null!=s?s:1/0}}r.borderColor=null!=s.border?.color?e.toUnitRGBA(s.border.color):null;const a="object"===n.symbolLayers.at(0).type,o="label-3d"===n.type;return r.occlusionTest=!a&&!has("enable-feature:non-occluded-hud"),a&&(r.shaderPolygonOffset=0),r.hudDepthAlignStart=o,r.hasSlicePlane=this._context.slicePlaneEnabled,r.screenSizePerspective=this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null,r}_defaultElevationInfoNoZ(){return G}createGraphics3DGraphic(e,t){const r=e.renderingInfo,n=e.graphic,i=this.createElevationContextForGraphic(n,r.elevationOffset||0),s=r.symbol,o="on-the-ground"===this._elevationContext.mode&&("cim"===s.type||!s.symbolLayers.some(e=>"object"===e.type||"text"===e.type));if("label-3d"!==s.type&&o)return null;if("point-3d"===s.type&&s.symbolLayers.every(e=>"text"===e.type&&!a(e)))return null;const l=f(n.geometry);return null==l?null:this._createAs3DShape(l,i,r,n.uid,t)}layerOpacityChanged(){this._materials[0]?.setParameters(this._materialParameters)}layerScreenSizePerspectiveChanged(){const e=this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null;this._materials[0]?.setParameters({screenSizePerspective:e})}layerElevationInfoChanged(e,t,r){const n=this._elevationContext.mode,i=l(O.elevationModeChangeTypes,r,n);return 1!==i||e?.forEach(e=>{const r=t(e);null!=r&&this.graphics3DGraphicLayerElevationInfoChanged(e.graphic,r)}),i}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}createElevationContextForGraphic(e,t=0){const r=super.createElevationContextForGraphic(e);return r.addOffsetRenderUnits(t),r}updateElevationContextForGraphic(e,t,r=0){super.updateElevationContextForGraphic(e,t),e.addOffsetRenderUnits(r)}graphics3DGraphicLayerElevationInfoChanged(e,t){const{elevationContext:r,metadata:n}=t;this.updateElevationContextForGraphic(r,e,n?.elevationOffset??0),t.needsElevationUpdates=c(r.mode)}computeComplexity(){return new v({verticesPerFeature:6})}_getOrCreateMaterial(e,t){const r=this._perInstanceMaterialParameters(e),n=C(r);if(n===this._materials[0]?.uniqueMaterialIdentifier)return this._materials[0];if(t){let e=t.get(n);return null==e&&(e=new x(r,this._context.spherical),t.set(n,e)),e}return new x(r,this._context.spherical)}_createAs3DShape(e,t,r,n,i){const s=this._context.layerViewUid,a=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:n,layerViewUid:s}),l=this._getOrCreateMaterial(r,i),h=new b(l,j(r),null,1,a),d=u(this._context,e,h,t,n);if(null==d)return null;const f=new p(this,d.object,null,o,t);return f.hiddenIfDeconflicted=!0,f.metadata=new m(r.elevationOffset),f.alignedSampledElevation=d.sampledElevation,f.needsElevationUpdates=c(t.mode),g(f,e,this._context.elevationProvider),f}}function j(e){const{translation:t,centerOffset:r}=e,n=new y(t?[t[0],t[1],t[2]]:[0,0,0],P,3,!0),i=new y(r?[r[0],r[1],r[2],r[3]]:[0,0,0,1],P,4,!0);return[["position",n],["normal",new y([0,0,1],P,3,!0)],["centerOffsetAndDistance",i]]}const P=[0],G={mode:"relative-to-ground",offset:0},w={ignoreDrivers:!0,renderPriority:0,renderPriorityStep:1};class E extends s{constructor(e,t,i=r(),s=n(),a=0,o="world",l=0){super(e,t),this.translation=i,this.centerOffset=s,this.horizontalScreenOffset=a,this.centerOffsetUnits=o,this.elevationOffset=l}}class S extends h{}export{O as Graphics3DLineCalloutSymbolLayer,S as LineCalloutCreationContext,E as LineCalloutSymbolLayerRenderingInfo};
5
+ import has from"../../../../core/has.js";import{pt2px as e}from"../../../../core/screenUtils.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as r,ZEROS as n}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderingInfo as i}from"../../../../renderers/support/RenderingInfo.js";import{textSymbolLayerSupportsVerticalOffset as s}from"../../../../symbols/callouts/calloutUtils.js";import{perObjectElevationAligner as a}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as o,needsElevationUpdates2D as l}from"./elevationAlignmentUtils.js";import{Graphics3DGraphicCreationContext as c}from"./Graphics3DGraphicCreationContext.js";import{Graphics3DObject3DGraphicLayer as h}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DObjectMetadata as p}from"./Graphics3DObjectMetadata.js";import{Graphics3DSymbolLayer as d}from"./Graphics3DSymbolLayer.js";import{computeCentroid as m}from"./graphicUtils.js";import{createStageObject as f,extendPointGraphicElevationContext as u}from"./pointUtils.js";import{SymbolComplexity as g}from"./SymbolComplexity.js";import{Attribute as v}from"../../webgl-engine/lib/Attribute.js";import{Geometry as y}from"../../webgl-engine/lib/Geometry.js";import{LineCalloutMaterial as b,Parameters as x,uniqueMaterialIdentifier as _}from"../../webgl-engine/materials/LineCalloutMaterial.js";class O extends d{static{this.elevationModeChangeTypes={definedChanged:1,staysOnTheGround:1,onTheGroundChanged:2}}constructor(e,t){super(e,null,t,G),this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!1},this.ensureDrapedStatus(!1)}async doLoad(){this._materials[0]=new b(this._materialParameters,this._context.spherical)}_perInstanceMaterialParameters(e){const t=this._materialParameters;return t.horizontalScreenOffset=e.horizontalScreenOffset??0,t.centerOffsetUnits=e.centerOffsetUnits||"world",t}get _materialParameters(){const t=new x,r=this.symbol,i=r.callout;if(i.color){const e=i.color.toUnitRGBA();e[3]*=this._getLayerOpacity(),t.color=e}else t.color=n;if(t.size=e(i.size||0),r.verticalOffset){const{screenLength:n,minWorldLength:i,maxWorldLength:s}=r.verticalOffset;t.verticalOffset={screenLength:e(n),minWorldLength:i||0,maxWorldLength:null!=s?s:1/0}}t.borderColor=null!=i.border?.color?i.border.color.toUnitRGBA():null;const s="object"===r.symbolLayers.at(0).type,a="label-3d"===r.type;return t.occlusionTest=!s&&!has("enable-feature:non-occluded-hud"),s&&(t.shaderPolygonOffset=0),t.hudDepthAlignStart=a,t.hasSlicePlane=this._context.slicePlaneEnabled,t.screenSizePerspective=this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null,t}_defaultElevationInfoNoZ(){return j}createGraphics3DGraphic(e,t){const r=e.renderingInfo,n=e.graphic,i=this.createElevationContextForGraphic(n,r.elevationOffset||0),a=r.symbol,o="on-the-ground"===this._elevationContext.mode&&("cim"===a.type||!a.symbolLayers.some(e=>"object"===e.type||"text"===e.type));if("label-3d"!==a.type&&o)return null;if("point-3d"===a.type&&a.symbolLayers.every(e=>"text"===e.type&&!s(e)))return null;const l=m(n.geometry);return null==l?null:this._createAs3DShape(l,i,r,n.uid,t)}layerOpacityChanged(){this._materials[0]?.setParameters(this._materialParameters)}layerScreenSizePerspectiveChanged(){const e=this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null;this._materials[0]?.setParameters({screenSizePerspective:e})}layerElevationInfoChanged(e,t,r){const n=this._elevationContext.mode,i=o(O.elevationModeChangeTypes,r,n);return 1!==i||e?.forEach(e=>{const r=t(e);null!=r&&this.graphics3DGraphicLayerElevationInfoChanged(e.graphic,r)}),i}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}createElevationContextForGraphic(e,t=0){const r=super.createElevationContextForGraphic(e);return r.addOffsetRenderUnits(t),r}updateElevationContextForGraphic(e,t,r=0){super.updateElevationContextForGraphic(e,t),e.addOffsetRenderUnits(r)}graphics3DGraphicLayerElevationInfoChanged(e,t){const{elevationContext:r,metadata:n}=t;this.updateElevationContextForGraphic(r,e,n?.elevationOffset??0),t.needsElevationUpdates=l(r.mode)}computeComplexity(){return new g({verticesPerFeature:6})}_getOrCreateMaterial(e,t){const r=this._perInstanceMaterialParameters(e),n=_(r);if(n===this._materials[0]?.uniqueMaterialIdentifier)return this._materials[0];if(t){let e=t.get(n);return null==e&&(e=new b(r,this._context.spherical),t.set(n,e)),e}return new b(r,this._context.spherical)}_createAs3DShape(e,t,r,n,i){const s=this._context.layerViewUid,o=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:n,layerViewUid:s}),c=this._getOrCreateMaterial(r,i),d=new y(c,C(r),null,1,o),m=f(this._context,e,d,t,n);if(null==m)return null;const g=new h(this,m.object,null,a,t);return g.hiddenIfDeconflicted=!0,g.metadata=new p(r.elevationOffset),g.alignedSampledElevation=m.sampledElevation,g.needsElevationUpdates=l(t.mode),u(g,e,this._context.elevationProvider),g}}function C(e){const{translation:t,centerOffset:r}=e,n=new v(t?[t[0],t[1],t[2]]:[0,0,0],P,3,!0),i=new v(r?[r[0],r[1],r[2],r[3]]:[0,0,0,1],P,4,!0);return[["position",n],["normal",new v([0,0,1],P,3,!0)],["centerOffsetAndDistance",i]]}const P=[0],j={mode:"relative-to-ground",offset:0},G={ignoreDrivers:!0,renderPriority:0,renderPriorityStep:1};class w extends i{constructor(e,n,i=t(),s=r(),a=0,o="world",l=0){super(e,n),this.translation=i,this.centerOffset=s,this.horizontalScreenOffset=a,this.centerOffsetUnits=o,this.elevationOffset=l}}class E extends c{}export{O as Graphics3DLineCalloutSymbolLayer,E as LineCalloutCreationContext,w as LineCalloutSymbolLayerRenderingInfo};
@@ -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 t from"../../../../core/Error.js";import{px2pt as r,pt2px as i}from"../../../../core/screenUtils.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{f as s}from"../../../../chunks/vec42.js";import{ZEROS as o,ones as l,clone as n}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import c from"../../../../geometry/Extent.js";import h from"../../../../geometry/Polygon.js";import{create as p,fromBuffer as m,intersectsClippingArea as y,empty as _,expandWithAABB as u,expandWithBuffer as d}from"../../../../geometry/support/aaBoundingBox.js";import{getDriverAxisSizeValueAny as f}from"../../../../renderers/support/renderingInfoUtils.js";import{sharedGeometryElevationAligner as g}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as b,needsElevationUpdates2D as v}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as C}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as P}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as M,nanFallbackColor as k}from"./Graphics3DSymbolLayer.js";import{parseCapType as w,parseLineMarkerStyle as L}from"./lineUtils.js";import{initFastSymbolUpdatesState as S,updateFastSymbolUpdatesState as x,getAttributeValue as z,ConvertOptions as U}from"../support/FastSymbolUpdates.js";import{debugFlags as j}from"../../support/debugFlags.js";import{createGeometry as V}from"../../support/engineContent/line.js";import{geometryToRenderInfo as O,geometryToRenderInfoDraped as A}from"../../support/renderInfoUtils/line.js";import{Object3D as E}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as G}from"../../webgl-engine/lib/RenderGeometry.js";import{LineMarkerMaterial as D}from"../../webgl-engine/materials/LineMarkerMaterial.js";import{getStipplePatternForLinePattern as F}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as R}from"../../webgl-engine/materials/RibbonLineMaterial.js";const I=["polyline","polygon","extent"];class W extends M{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,T(t))}async doLoad(){this._fastUpdates=S(this._context.renderer,this._fastVisualVariableConvertOptions());const e=!0;if(this._fastMarkerUpdates=S(this._context.renderer,this._fastVisualVariableConvertOptions(e)),!this._drivenProperties.size){if((null!=this.symbolLayer.size?this.symbolLayer.size:r(1))<0)throw new t("graphics3dlinesymbollayer:invalid-size","Symbol sizes may not be negative values")}}_getMaterialParameters(e,t){const r=this._screenSizePerspective,i={...this._getMaterialColorParameters(t),width:this._computeMaterialWidth(this.symbolLayer?.size),hasPolygonOffset:!0,join:this.symbolLayer.join||"miter",cap:w(this.symbolLayer.cap||"butt"),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:e,stipplePattern:F(this.symbolLayer.pattern),emissiveStrength:this._emissiveStrength??0,screenSizePerspective:r};return 4===t&&this._fastMarkerUpdates?.visualVariables?{...i,...this._fastMarkerUpdates.materialParameters}:this._fastUpdates?.visualVariables?{...i,...this._fastUpdates.materialParameters}:i}_getMaterialColorParameters(e){const t=4===e,r=this._getCombinedOpacityAndColor(t&&this._markerColor||this._materialColor);return this._patternHidesLine&&!t&&(r[3]=0),{color:r}}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){return this.symbolLayer.material?.emissive?.strength}get _markerColor(){return this.symbolLayer.marker?.color}get _lineMaterial(){return null==this._materials[0]&&(this._materials[0]=new R(this._getMaterialParameters(!1,0),this.view.state.isGlobal)),this._materials[0]}get _ringMaterial(){return null==this._materials[1]&&(this._materials[1]=new R(this._getMaterialParameters(!0,1),this.view.state.isGlobal)),this._materials[1]}get _wireframeLineMaterial(){return null==this._materials[2]&&(this._materials[2]=new R({...this._getMaterialParameters(!1,2),wireframe:!0},this.view.state.isGlobal)),this._materials[2]}get _wireframeRingMaterial(){return null==this._materials[3]&&(this._materials[3]=new R({...this._getMaterialParameters(!0,3),wireframe:!0},this.view.state.isGlobal)),this._materials[3]}get _markerMaterial(){return null==this._materials[4]&&null!=this.symbolLayer.marker&&(this._materials[4]=new D({...this._getMaterialParameters(!1,4),placement:this.symbolLayer.marker.placement,markerPrimitive:L(this.symbolLayer.marker.style)},this.view.state.isGlobal)),this._materials[4]}_getDrivenSize(e){if(this._drivenProperties.size){const t=e.size;return null!=t?i(f(t)):this._getFallbackSize()}return 1}_getDrivenColor({color:e,opacity:t}){const r=l();return this._drivenProperties.color&&(s(r,e??this._getFallbackOpacityAndColor(o)),null==t)||this._drivenProperties.opacity&&(e||this._materialColor)&&(r[3]=t??this._getFallbackOpacity()),r}_getDrivenMarkerColor({color:e,opacity:t}){const r=l();return this._drivenProperties.color&&(s(r,e??this._getFallbackMarkerOpacityAndColor(o)),null==t)||this._drivenProperties.opacity&&(e||this._markerColor||this._materialColor)&&(r[3]=t??this._getFallbackMarkerOpacity()),r}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,I,this.symbolLayer.type))return null;const r=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.draped?this._createAsOverlay(e):this._createAs3DShape(e,r,t.uid)}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;{const e=this._fastUpdates;if(!x(e,t,this._fastVisualVariableConvertOptions()))return 0;for(const t of this._materials)t instanceof R&&t.setParameters(e.materialParameters);const r=this._fastMarkerUpdates,i=!0;if(!x(r,t,this._fastVisualVariableConvertOptions(i)))return 0;for(const t of this._materials)t instanceof D&&t.setParameters(r.materialParameters)}}return 2}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff,r={};"complete"===t.size?.type&&(r.width=this._computeMaterialWidth(t.size.newValue),delete t.size),"complete"===t.cap?.type&&(r.cap=w(t.cap.newValue??"butt"),delete t.cap);const i=this._prepareMarkerPatch(e,t);this._prepareMaterialPatch(e,t,i),e.symbolLayerStatePatches.push(()=>{for(const e of this._materials)e?.setParameters(r)})}layerOpacityChanged(){for(let e=0;e<5;e++)this._materials[e]?.setParameters(this._getMaterialColorParameters(e))}get _screenSizePerspective(){return!this.draped&&this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null}layerScreenSizePerspectiveChanged(){const e=this._screenSizePerspective;for(const t of this._materials)t?.setParameters({screenSizePerspective:e})}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,a=b(W.elevationModeChangeTypes,r,i);if(1!==a)return a;const s=v(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>s)}slicePlaneEnabledChanged(){const e={hasSlicePlane:this._context.slicePlaneEnabled};for(const t of this._materials)t?.setParameters(e);return!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,r){const i=H(e.graphic.geometry),a="polygon"===i.type?i.rings:i.paths,s=new Array,o=p(),l=O(i,this._context.elevationProvider,this._context.renderCoordsHelper,t),n="polygon"===i.type?"rings":"paths";this._logGeometryCreationWarnings(l,a,n,"LineSymbol3DLayer");for(let p=0;p<l.lines.length;p++){const t=l.lines[p],a=t.position,n=t.mapPositions;if(null!=this._context.clippingExtent&&(m(n,o),!y(o,this._context.clippingExtent)))continue;const c=this._createGeometry("polygon"===i.type?this._ringMaterial:this._lineMaterial,e,a,n,i.type,1,r);if(s.push(c),j.LINE_WIREFRAMES&&s.push(c.instantiate({material:"polygon"===i.type?this._wireframeRingMaterial:this._wireframeLineMaterial})),null!=this._markerMaterial){const t=c.instantiate({material:this._markerMaterial});t.attributes.has("color")&&t.setAttributeData("color",this._getDrivenMarkerColor(e.renderingInfo)),s.push(t)}}if(0===s.length)return null;const c=this._context.layerViewUid,h=new E({geometries:s,castShadow:!1,layerViewUid:c,graphicUid:r}),_=new P(this,h,null,g,t);return _.alignedSampledElevation=l.sampledElevation,_.needsElevationUpdates=v(t.mode),_}_createGeometry(e,t,r,i,a,s,o){const l=0===s?{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper}:null,n="polygon"===a,c=this._fastUpdates?.visualVariables.color,h=this._fastUpdates?.visualVariables.size,p=this._fastUpdates?.visualVariables.opacity,m=this._context.layerViewUid,y=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:o,layerViewUid:m}),_={position:r,size:h?null:this._getDrivenSize(t.renderingInfo),color:c?null:this._getDrivenColor(t.renderingInfo),sizeFeature:h?z(h.field,t.graphic):null,colorFeature:c?z(c.field,t.graphic):null,opacityFeature:p?z(p.field,t.graphic):null};return V(e,{overlayInfo:l,removeDuplicateStartEnd:n,mapPositions:i,attributeData:_},y)}_createAsOverlay(e){const t=e.graphic,r=H(t.geometry),i="polygon"===r.type?r.rings:r.paths,a="polygon"===r.type?this._ringMaterial:this._lineMaterial;a.renderPriority=this._renderPriority;const s=j.LINE_WIREFRAMES?"polygon"===r.type?this._wireframeRingMaterial:this._wireframeLineMaterial:null,o=this._markerMaterial;null!=s&&(s.renderPriority=this._renderPriority-.001),null!=o&&(o.renderPriority=this._renderPriority-.002);const l=new Array,n=p(),c=_(),h=A(r,this._context.overlaySR),f="polygon"===r.type?"rings":"paths";this._logGeometryCreationWarnings(h,i,f,"LineSymbol3DLayer");for(const p of h.lines){if(m(p.position,n),!y(n,this._context.clippingExtent))continue;u(c,n);const i=this._createGeometry(a,e,p.position,void 0,r.type,0,t.uid),h=e=>{const r=this._context.layerViewUid,i=new G(e,{layerViewUid:r,graphicUid:t.uid});l.push(i)};if(null!=o){const t=i.instantiate({material:o});t.attributes.has("color")&&t.setAttributeData("color",this._getDrivenMarkerColor(e.renderingInfo)),h(t);const r=this.symbolLayer.marker.placement;"begin"!==r&&"begin-end"!==r||d(n,p.position,0,1),"end"!==r&&"begin-end"!==r||d(n,p.position,p.position.length-3,1)}h(i),j.LINE_WIREFRAMES&&h(i.instantiate({material:s}))}return new C(this,l,c,this._context.drapeSourceRenderer)}get _patternHidesLine(){const e=this.symbolLayer.pattern;return null!=e&&"style"===e.type&&"none"===e.style}_computeMaterialWidth(e){return e=e??r(1),this._drivenProperties.size?this._fastUpdates?.visualVariables.size?i(1):1:i(e)}_prepareMaterialPatch(e,t,r){const i=t.material;if(null==i)return void(r.changed&&r.useMaterialColor&&B(this._getCombinedOpacityAndColor(this._materialColor),this._materials[4],e));if("collection"===i.type)return;const a="complete"===i.type?i.newValue?.color:"complete"===i.diff.color?.type?i.diff.color.newValue:null,s=this._getCombinedOpacityAndColor(a);r.useMaterialColor&&B(n(s),this._materials[4],e),this._patternHidesLine&&(s[3]=0),B(s,this._materials[0],e),delete t.material}_prepareMarkerPatch(e,t){const r=t.marker,i=this._markerMaterial;if(null==r||"partial"!==r.type||null==r.diff||null!=r.diff.placement||null!=r.diff.style&&"complete"!==r.diff.style.type||null!=r.diff.color&&"complete"!==r.diff.color.type||null==i)return{changed:!1,useMaterialColor:null==this._markerColor};const a=r.diff.color,s=null!=a,o=s?a.newValue:null,l=null==o&&null==this._markerColor;o&&B(this._getCombinedOpacityAndColor(o),i,e);const n=r.diff.style?.newValue;return n&&e.symbolLayerStatePatches.push(()=>i.setParameters({markerPrimitive:L(n)})),delete t.marker,{changed:s,useMaterialColor:l}}_fastVisualVariableConvertOptions(e=!1){const t=this._getFallbackSize();return new U({supports:{size:!0,color:!0,rotation:!1,opacity:!0},fallbackColor:e?this._getFallbackMarkerOpacityAndColor(k):this._getFallbackOpacityAndColor(k),fallbackSize:a(t,t,t)})}_getFallbackOpacityAndColor(t){return e.toUnitRGBA(this._materialColor)??t}_getFallbackOpacity(){return this._materialColor?.a??0}_getFallbackMarkerOpacityAndColor(t){const r=this.symbolLayer?.marker?.color;return e.toUnitRGBA(r)??this._getFallbackOpacityAndColor(t)}_getFallbackMarkerOpacity(){return this.symbolLayer?.marker?.color?.a??this._getFallbackOpacity()}_getFallbackSize(){const e=this.symbolLayer?.size;return null!=e?i(e):1}}function H(e){switch(e.type){case"extent":if(e instanceof c)return h.fromExtent(e);break;case"polygon":case"polyline":return e}return null}function B(e,t,r){null!=t&&r.symbolLayerStatePatches.push(()=>t.setParameters({color:e}))}function T(e){const t=e.material?.color,r=e.marker?.color??t;return 1===(t?.a??0)&&1===(r?.a??0)}export{W as Graphics3DLineSymbolLayer};
5
+ import e from"../../../../core/Error.js";import{px2pt as t,pt2px as r}from"../../../../core/screenUtils.js";import{fromValues as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{f as a}from"../../../../chunks/vec42.js";import{ZEROS as s,ones as o,clone as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import n from"../../../../geometry/Extent.js";import c from"../../../../geometry/Polygon.js";import{create as h,fromBuffer as p,intersectsClippingArea as m,empty as y,expandWithAABB as _,expandWithBuffer as u}from"../../../../geometry/support/aaBoundingBox.js";import{getDriverAxisSizeValueAny as d}from"../../../../renderers/support/renderingInfoUtils.js";import{sharedGeometryElevationAligner as g}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as f,needsElevationUpdates2D as b}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as v}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as C}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as P,nanFallbackColor as M}from"./Graphics3DSymbolLayer.js";import{parseCapType as k,parseLineMarkerStyle as w}from"./lineUtils.js";import{initFastSymbolUpdatesState as L,updateFastSymbolUpdatesState as S,getAttributeValue as x,ConvertOptions as z}from"../support/FastSymbolUpdates.js";import{debugFlags as U}from"../../support/debugFlags.js";import{createGeometry as V}from"../../support/engineContent/line.js";import{geometryToRenderInfo as j,geometryToRenderInfoDraped as O}from"../../support/renderInfoUtils/line.js";import{Object3D as A}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as E}from"../../webgl-engine/lib/RenderGeometry.js";import{LineMarkerMaterial as G}from"../../webgl-engine/materials/LineMarkerMaterial.js";import{getStipplePatternForLinePattern as D}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as F}from"../../webgl-engine/materials/RibbonLineMaterial.js";const R=["polyline","polygon","extent"];class I extends P{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,B(t))}async doLoad(){this._fastUpdates=L(this._context.renderer,this._fastVisualVariableConvertOptions());const r=!0;if(this._fastMarkerUpdates=L(this._context.renderer,this._fastVisualVariableConvertOptions(r)),!this._drivenProperties.size){if((null!=this.symbolLayer.size?this.symbolLayer.size:t(1))<0)throw new e("graphics3dlinesymbollayer:invalid-size","Symbol sizes may not be negative values")}}_getMaterialParameters(e,t){const r=this._screenSizePerspective,i={...this._getMaterialColorParameters(t),width:this._computeMaterialWidth(this.symbolLayer?.size),hasPolygonOffset:!0,join:this.symbolLayer.join||"miter",cap:k(this.symbolLayer.cap||"butt"),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:e,stipplePattern:D(this.symbolLayer.pattern),emissiveStrength:this._emissiveStrength??0,screenSizePerspective:r};return 4===t&&this._fastMarkerUpdates?.visualVariables?{...i,...this._fastMarkerUpdates.materialParameters}:this._fastUpdates?.visualVariables?{...i,...this._fastUpdates.materialParameters}:i}_getMaterialColorParameters(e){const t=4===e,r=this._getCombinedOpacityAndColor(t&&this._markerColor||this._materialColor);return this._patternHidesLine&&!t&&(r[3]=0),{color:r}}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){return this.symbolLayer.material?.emissive?.strength}get _markerColor(){return this.symbolLayer.marker?.color}get _lineMaterial(){return null==this._materials[0]&&(this._materials[0]=new F(this._getMaterialParameters(!1,0),this.view.state.isGlobal)),this._materials[0]}get _ringMaterial(){return null==this._materials[1]&&(this._materials[1]=new F(this._getMaterialParameters(!0,1),this.view.state.isGlobal)),this._materials[1]}get _wireframeLineMaterial(){return null==this._materials[2]&&(this._materials[2]=new F({...this._getMaterialParameters(!1,2),wireframe:!0},this.view.state.isGlobal)),this._materials[2]}get _wireframeRingMaterial(){return null==this._materials[3]&&(this._materials[3]=new F({...this._getMaterialParameters(!0,3),wireframe:!0},this.view.state.isGlobal)),this._materials[3]}get _markerMaterial(){return null==this._materials[4]&&null!=this.symbolLayer.marker&&(this._materials[4]=new G({...this._getMaterialParameters(!1,4),placement:this.symbolLayer.marker.placement,markerPrimitive:w(this.symbolLayer.marker.style)},this.view.state.isGlobal)),this._materials[4]}_getDrivenSize(e){if(this._drivenProperties.size){const t=e.size;return null!=t?r(d(t)):this._getFallbackSize()}return 1}_getDrivenColor({color:e,opacity:t}){const r=o();return this._drivenProperties.color&&(a(r,e??this._getFallbackOpacityAndColor(s)),null==t)||this._drivenProperties.opacity&&(e||this._materialColor)&&(r[3]=t??this._getFallbackOpacity()),r}_getDrivenMarkerColor({color:e,opacity:t}){const r=o();return this._drivenProperties.color&&(a(r,e??this._getFallbackMarkerOpacityAndColor(s)),null==t)||this._drivenProperties.opacity&&(e||this._markerColor||this._materialColor)&&(r[3]=t??this._getFallbackMarkerOpacity()),r}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,R,this.symbolLayer.type))return null;const r=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.draped?this._createAsOverlay(e):this._createAs3DShape(e,r,t.uid)}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;{const e=this._fastUpdates;if(!S(e,t,this._fastVisualVariableConvertOptions()))return 0;for(const t of this._materials)t instanceof F&&t.setParameters(e.materialParameters);const r=this._fastMarkerUpdates,i=!0;if(!S(r,t,this._fastVisualVariableConvertOptions(i)))return 0;for(const t of this._materials)t instanceof G&&t.setParameters(r.materialParameters)}}return 2}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff,r={};"complete"===t.size?.type&&(r.width=this._computeMaterialWidth(t.size.newValue),delete t.size),"complete"===t.cap?.type&&(r.cap=k(t.cap.newValue??"butt"),delete t.cap);const i=this._prepareMarkerPatch(e,t);this._prepareMaterialPatch(e,t,i),e.symbolLayerStatePatches.push(()=>{for(const e of this._materials)e?.setParameters(r)})}layerOpacityChanged(){for(let e=0;e<5;e++)this._materials[e]?.setParameters(this._getMaterialColorParameters(e))}get _screenSizePerspective(){return!this.draped&&this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null}layerScreenSizePerspectiveChanged(){const e=this._screenSizePerspective;for(const t of this._materials)t?.setParameters({screenSizePerspective:e})}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,a=f(I.elevationModeChangeTypes,r,i);if(1!==a)return a;const s=b(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>s)}slicePlaneEnabledChanged(){const e={hasSlicePlane:this._context.slicePlaneEnabled};for(const t of this._materials)t?.setParameters(e);return!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,r){const i=W(e.graphic.geometry),a="polygon"===i.type?i.rings:i.paths,s=new Array,o=h(),l=j(i,this._context.elevationProvider,this._context.renderCoordsHelper,t),n="polygon"===i.type?"rings":"paths";this._logGeometryCreationWarnings(l,a,n,"LineSymbol3DLayer");for(let h=0;h<l.lines.length;h++){const t=l.lines[h],a=t.position,n=t.mapPositions;if(null!=this._context.clippingExtent&&(p(n,o),!m(o,this._context.clippingExtent)))continue;const c=this._createGeometry("polygon"===i.type?this._ringMaterial:this._lineMaterial,e,a,n,i.type,1,r);if(s.push(c),U.LINE_WIREFRAMES&&s.push(c.instantiate({material:"polygon"===i.type?this._wireframeRingMaterial:this._wireframeLineMaterial})),null!=this._markerMaterial){const t=c.instantiate({material:this._markerMaterial});t.attributes.has("color")&&t.setAttributeData("color",this._getDrivenMarkerColor(e.renderingInfo)),s.push(t)}}if(0===s.length)return null;const c=this._context.layerViewUid,y=new A({geometries:s,castShadow:!1,layerViewUid:c,graphicUid:r}),_=new C(this,y,null,g,t);return _.alignedSampledElevation=l.sampledElevation,_.needsElevationUpdates=b(t.mode),_}_createGeometry(e,t,r,i,a,s,o){const l=0===s?{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper}:null,n="polygon"===a,c=this._fastUpdates?.visualVariables.color,h=this._fastUpdates?.visualVariables.size,p=this._fastUpdates?.visualVariables.opacity,m=this._context.layerViewUid,y=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:o,layerViewUid:m}),_={position:r,size:h?null:this._getDrivenSize(t.renderingInfo),color:c?null:this._getDrivenColor(t.renderingInfo),sizeFeature:h?x(h.field,t.graphic):null,colorFeature:c?x(c.field,t.graphic):null,opacityFeature:p?x(p.field,t.graphic):null};return V(e,{overlayInfo:l,removeDuplicateStartEnd:n,mapPositions:i,attributeData:_},y)}_createAsOverlay(e){const t=e.graphic,r=W(t.geometry),i="polygon"===r.type?r.rings:r.paths,a="polygon"===r.type?this._ringMaterial:this._lineMaterial;a.renderPriority=this._renderPriority;const s=U.LINE_WIREFRAMES?"polygon"===r.type?this._wireframeRingMaterial:this._wireframeLineMaterial:null,o=this._markerMaterial;null!=s&&(s.renderPriority=this._renderPriority-.001),null!=o&&(o.renderPriority=this._renderPriority-.002);const l=new Array,n=h(),c=y(),d=O(r,this._context.overlaySR),g="polygon"===r.type?"rings":"paths";this._logGeometryCreationWarnings(d,i,g,"LineSymbol3DLayer");for(const h of d.lines){if(p(h.position,n),!m(n,this._context.clippingExtent))continue;_(c,n);const i=this._createGeometry(a,e,h.position,void 0,r.type,0,t.uid),y=e=>{const r=this._context.layerViewUid,i=new E(e,{layerViewUid:r,graphicUid:t.uid});l.push(i)};if(null!=o){const t=i.instantiate({material:o});t.attributes.has("color")&&t.setAttributeData("color",this._getDrivenMarkerColor(e.renderingInfo)),y(t);const r=this.symbolLayer.marker.placement;"begin"!==r&&"begin-end"!==r||u(n,h.position,0,1),"end"!==r&&"begin-end"!==r||u(n,h.position,h.position.length-3,1)}y(i),U.LINE_WIREFRAMES&&y(i.instantiate({material:s}))}return new v(this,l,c,this._context.drapeSourceRenderer)}get _patternHidesLine(){const e=this.symbolLayer.pattern;return null!=e&&"style"===e.type&&"none"===e.style}_computeMaterialWidth(e){return e=e??t(1),this._drivenProperties.size?this._fastUpdates?.visualVariables.size?r(1):1:r(e)}_prepareMaterialPatch(e,t,r){const i=t.material;if(null==i)return void(r.changed&&r.useMaterialColor&&H(this._getCombinedOpacityAndColor(this._materialColor),this._materials[4],e));if("collection"===i.type)return;const a="complete"===i.type?i.newValue?.color:"complete"===i.diff.color?.type?i.diff.color.newValue:null,s=this._getCombinedOpacityAndColor(a);r.useMaterialColor&&H(l(s),this._materials[4],e),this._patternHidesLine&&(s[3]=0),H(s,this._materials[0],e),delete t.material}_prepareMarkerPatch(e,t){const r=t.marker,i=this._markerMaterial;if(null==r||"partial"!==r.type||null==r.diff||null!=r.diff.placement||null!=r.diff.style&&"complete"!==r.diff.style.type||null!=r.diff.color&&"complete"!==r.diff.color.type||null==i)return{changed:!1,useMaterialColor:null==this._markerColor};const a=r.diff.color,s=null!=a,o=s?a.newValue:null,l=null==o&&null==this._markerColor;o&&H(this._getCombinedOpacityAndColor(o),i,e);const n=r.diff.style?.newValue;return n&&e.symbolLayerStatePatches.push(()=>i.setParameters({markerPrimitive:w(n)})),delete t.marker,{changed:s,useMaterialColor:l}}_fastVisualVariableConvertOptions(e=!1){const t=this._getFallbackSize();return new z({supports:{size:!0,color:!0,rotation:!1,opacity:!0},fallbackColor:e?this._getFallbackMarkerOpacityAndColor(M):this._getFallbackOpacityAndColor(M),fallbackSize:i(t,t,t)})}_getFallbackOpacityAndColor(e){return this._materialColor?.toUnitRGBA()??e}_getFallbackOpacity(){return this._materialColor?.a??0}_getFallbackMarkerOpacityAndColor(e){return this.symbolLayer?.marker?.color?.toUnitRGBA()??this._getFallbackOpacityAndColor(e)}_getFallbackMarkerOpacity(){return this.symbolLayer?.marker?.color?.a??this._getFallbackOpacity()}_getFallbackSize(){const e=this.symbolLayer?.size;return null!=e?r(e):1}}function W(e){switch(e.type){case"extent":if(e instanceof n)return c.fromExtent(e);break;case"polygon":case"polyline":return e}return null}function H(e,t,r){null!=t&&r.symbolLayerStatePatches.push(()=>t.setParameters({color:e}))}function B(e){const t=e.material?.color,r=e.marker?.color??t;return 1===(t?.a??0)&&1===(r?.a??0)}export{I as Graphics3DLineSymbolLayer};
@@ -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(r,o){if(null!=r.colorTexture){const e=1!==o.textureAlphaMode,t=this._getInternalTexture(r.colorTexture,e,o.textureAlphaMode);t?(o.textureId=t.id,o.textureAlphaPremultiplied=!!t.parameters.preMultiplyAlpha):o.textureId=void 0}if(r.normalTexture&&(o.normalTextureId=this._getInternalTexture(r.normalTexture)?.id),r.emissiveColor){const n=e.toUnitRGB(r.emissiveColor);o.emissiveBaseColor=R(t(n[0]),t(n[1]),t(n[2]))}r.emissiveStrength&&(o.emissiveStrengthKHR=r.emissiveStrength),r.emissiveTexture&&(o.emissiveTextureId=this._getInternalTexture(r.emissiveTexture)?.id),r.occlusionTexture&&(o.occlusionTextureId=this._getInternalTexture(r.occlusionTexture,!0)?.id),r.metallicRoughnessTexture&&(o.metallicRoughnessTextureId=this._getInternalTexture(r.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(t,r=this._materialColor){const o=this._drivenProperties.color,n=this._drivenProperties.opacity;if(o)t.externalColor=S;else{const o=r??null;if(o){const r=e.toUnitRGBA(o);n&&(r[3]=1),t.externalColor=r}else t.externalColor=fe}t.colorMixMode=this.symbolLayer.material?.colorMixMode??"multiply",t.castShadows=!!this.symbolLayer.castShadows,t.emissiveStrengthFromSymbol=this.symbolLayer?.material?.emissive?.strength??1,t.emissiveSource=re(this.symbolLayer?.material?.emissive?.source??"emissive")}_getOrCreateMaterial(t,r){const o=r.material?.color,n=r.material?.colorTexture,a=r.material?.alphaMode,s="blend"===a,i=!("opaque"===a)&&(Le(t)||null!=o&&o.a<1||n?.transparent||s),l=this._materialProperties(t,r,i),c=this._materialInfoCache.byUid(l.uid);if(c)return this._setInternalMaterialTextureParameters(l,c.material.parameters),c.material;const u={uid:l.uid,material:null,isComponentTransparent:i,alphaMode:r.material?r.material.alphaMode:"opaque"},m=je({normalTexture:l.normalTexture,metallicRoughnessTexture:l.metallicRoughnessTexture,metallicFactor:l.metallic,roughnessFactor:l.roughness,emissiveTexture:l.emissiveTexture,emissiveFactor:e.toUnitRGB(l.emissiveColor),occlusionTexture:l.occlusionTexture}),f={usePBR:this._usePBR(),isSchematic:m,hasVertexColors:l.hasVertexColors,hasSymbolColors:l.hasSymbolVertexColors,hasVertexTangents:l.hasVertexTangents,ambient:P,diffuse:A,opacity:1,doubleSided:!0,doubleSidedType:"winding-order",cullFace:0,layerOpacity:this._getLayerOpacity(),hasSlicePlane:this._context.slicePlaneEnabled,drivenOpacity:this.needsDrivenTransparentPass||u.isComponentTransparent};f.mrrFactors=m?Re:[l.metallic,l.roughness,Me[2]],r.material&&(f.doubleSided=r.material.doubleSided,f.cullFace=r.material.doubleSided?0:2,f.textureAlphaCutoff=r.material.alphaCutoff),this._setExternalMaterialParameters(f),this._setMaterialTextureAlphaMode(f,u),this._setInternalMaterialParameters(l,f,u);const p=new we(f,this._context);return u.material=p,this._materialInfoCache.set(l.uid,u),p}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(t,r,o){r.diffuse=e.toUnitRGB(t),r.opacity="opaque"===o.alphaMode?1:t.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"../../../../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};