@arcgis/core 5.0.0-next.4 → 5.0.0-next.5

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 (363) hide show
  1. package/Map.js +1 -1
  2. package/analysis/ElevationProfileAnalysis.js +1 -1
  3. package/analysis/VolumeMeasurement/volumeMeasurementConfiguration.js +1 -1
  4. package/applications/KnowledgeStudio/generalSdkInternalAccess.d.ts +4 -0
  5. package/applications/KnowledgeStudio/generalSdkInternalAccess.js +5 -0
  6. package/applications/KnowledgeStudio/generalSharedKgUtils.d.ts +1 -0
  7. package/applications/KnowledgeStudio/generalSharedKgUtils.js +1 -1
  8. package/applications/KnowledgeStudio/layerInternalAccessUtils.d.ts +2 -0
  9. package/applications/KnowledgeStudio/layerInternalAccessUtils.js +1 -1
  10. package/applications/KnowledgeStudio/resourceSerializationUtils.js +1 -1
  11. package/assets/components/assets/sort-handle/t9n/messages.uk.json +1 -1
  12. package/assets/esri/core/workers/RemoteClient.js +1 -1
  13. package/assets/esri/core/workers/chunks/0366b78b0ccf4ed5f6ac.js +1 -0
  14. package/assets/esri/core/workers/chunks/037b2548bf85e2d7c6ac.js +1 -0
  15. package/assets/esri/core/workers/chunks/{c0feec6e2f0e45900ae0.js → 0686243904381ef863dc.js} +1 -1
  16. package/assets/esri/core/workers/chunks/06ba43843e9c4988049b.js +1 -0
  17. package/assets/esri/core/workers/chunks/0f100e163e1847e04155.js +1 -0
  18. package/assets/esri/core/workers/chunks/{388482cea4b9fdeaf06e.js → 0f30a9514571c7be9978.js} +1 -1
  19. package/assets/esri/core/workers/chunks/0f8847f9ae3068833fa4.js +1 -0
  20. package/assets/esri/core/workers/chunks/{14ace5dc4b8984212a57.js → 17d5f8dba6ebb1184506.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{b2add7338258ca7c24dd.js → 1da74aa308ded5748ef5.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{651b9144abb1895cc510.js → 1e848d9da1c61a27cf18.js} +1 -1
  23. package/assets/esri/core/workers/chunks/1eedac33c9fcd7681427.js +1 -0
  24. package/assets/esri/core/workers/chunks/239377336a2009caea01.js +1 -0
  25. package/assets/esri/core/workers/chunks/285762ff92d5388b6024.js +1 -0
  26. package/assets/esri/core/workers/chunks/{40b81d1c2d53cf598b8e.js → 2f03d33f4ca8a48461fc.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{4f01be74dd26e639330f.js → 2f24017e72d41c259faa.js} +1 -1
  28. package/assets/esri/core/workers/chunks/3271614322ba4b44fb5a.js +1 -0
  29. package/assets/esri/core/workers/chunks/36b1f47d70b57d79df7b.js +1 -0
  30. package/assets/esri/core/workers/chunks/{3d65b8a2fbe1df050a25.js → 377a66034e7c1bad5599.js} +1 -1
  31. package/assets/esri/core/workers/chunks/37f2ef14399546e697e6.js +1 -0
  32. package/assets/esri/core/workers/chunks/{0f9bb3187306f89e3d63.js → 398f356b11fd33bd3831.js} +1 -1
  33. package/assets/esri/core/workers/chunks/3a457e718a901a45902e.js.LICENSE.txt +1 -1
  34. package/assets/esri/core/workers/chunks/4442817beb7a76c95770.js +1 -0
  35. package/assets/esri/core/workers/chunks/4c5a7249a311070d8f43.js +1 -0
  36. package/assets/esri/core/workers/chunks/551c6c89b51b99f4864b.js +1 -0
  37. package/assets/esri/core/workers/chunks/{9a723d739ac44b45432c.js → 557960763695abee4a83.js} +1 -1
  38. package/assets/esri/core/workers/chunks/655360995c1cbc78a5a3.js +1 -0
  39. package/assets/esri/core/workers/chunks/67d9cfe02613cb73ee37.js.LICENSE.txt +1 -1
  40. package/assets/esri/core/workers/chunks/6a69dafeb7c9ca8a3d84.js +1 -0
  41. package/assets/esri/core/workers/chunks/6c3b99209d542efa64d4.js +1 -0
  42. package/assets/esri/core/workers/chunks/{8215015f11221a354273.js → 6d049182bec34a22abcd.js} +1 -1
  43. package/assets/esri/core/workers/chunks/71762199aef5d3107da2.js +1 -0
  44. package/assets/esri/core/workers/chunks/72c851c400752094b162.js +1 -0
  45. package/assets/esri/core/workers/chunks/7558919912f7fdc4837b.js +1 -0
  46. package/assets/esri/core/workers/chunks/7596d005a4dc3964b140.js +1 -0
  47. package/assets/esri/core/workers/chunks/762fe93015b705546188.js +1 -0
  48. package/assets/esri/core/workers/chunks/79dbfa2b9b332ca0002f.js +1 -0
  49. package/assets/esri/core/workers/chunks/7a23ab84e1144f081c92.js +1 -0
  50. package/assets/esri/core/workers/chunks/{2a5f331c0f18d8574b4e.js → 811d4c46c75cf6a63e78.js} +1 -1
  51. package/assets/esri/core/workers/chunks/829bc5dbda2f51561446.js +1 -0
  52. package/assets/esri/core/workers/chunks/8372f142c4d7a65c7954.js +1 -0
  53. package/assets/esri/core/workers/chunks/8605ec4678eb4511c715.js +1 -0
  54. package/assets/esri/core/workers/chunks/883ffaa69b3e6eb158bf.js +1 -0
  55. package/assets/esri/core/workers/chunks/{3d22fe2f2c40abbc246e.js → 88d942cd25bef74fd50a.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{0086a09441627842d34a.js → 8f3503b2fb6cd38757b9.js} +1 -1
  57. package/assets/esri/core/workers/chunks/9786f91455350eaae493.js +1 -0
  58. package/assets/esri/core/workers/chunks/98311fec6c16a1b23586.js +1 -0
  59. package/assets/esri/core/workers/chunks/9c5cbf8810f37b1a4718.js +1 -0
  60. package/assets/esri/core/workers/chunks/a091623bbfb3d771c8d8.js +1 -0
  61. package/assets/esri/core/workers/chunks/a137c27ce078bea44f89.js +1 -0
  62. package/assets/esri/core/workers/chunks/a29d7205394cb8b2a847.js +1 -0
  63. package/assets/esri/core/workers/chunks/a2a284d4dd5caaecbc2e.js +1 -0
  64. package/assets/esri/core/workers/chunks/{135e270b4f03c4270870.js → a4db5c9a90107e097df8.js} +1 -1
  65. package/assets/esri/core/workers/chunks/a61cb4f1ca282bf8b75d.js +1 -0
  66. package/assets/esri/core/workers/chunks/a6ac1ff89c40f3a4797a.js +1 -0
  67. package/assets/esri/core/workers/chunks/{dc31865edea480f0ebba.js → a8c4fd779e454e4075c4.js} +1 -1
  68. package/assets/esri/core/workers/chunks/a8f998b8ec8c56150479.js.LICENSE.txt +1 -1
  69. package/assets/esri/core/workers/chunks/aa6eb55e4fb57c4e8eeb.js +1 -0
  70. package/assets/esri/core/workers/chunks/aa78b69219d9a0ef1c54.js.LICENSE.txt +1 -1
  71. package/assets/esri/core/workers/chunks/af3fc2562bb6d217adf6.js +1 -0
  72. package/assets/esri/core/workers/chunks/{46ef545d2b3b3f4e6d32.js → b017bac40dc8328013e3.js} +2 -2
  73. package/assets/esri/core/workers/chunks/{46ef545d2b3b3f4e6d32.js.LICENSE.txt → b017bac40dc8328013e3.js.LICENSE.txt} +1 -1
  74. package/assets/esri/core/workers/chunks/b59f9c3f7a149214256f.js +1 -0
  75. package/assets/esri/core/workers/chunks/b96eb0ea506379182d62.js +2 -0
  76. package/assets/esri/core/workers/chunks/{24921d31efa8d222ad2d.js.LICENSE.txt → b96eb0ea506379182d62.js.LICENSE.txt} +1 -1
  77. package/assets/esri/core/workers/chunks/{b5863afafd3a7d2d5c05.js → bb5484b5eeacc9ad2ceb.js} +3 -3
  78. package/assets/esri/core/workers/chunks/bb56717c4e36f28d4c08.js +1 -0
  79. package/assets/esri/core/workers/chunks/bb7976e2f883b544add6.js +1 -0
  80. package/assets/esri/core/workers/chunks/c0b7e86860838638537f.js +1 -0
  81. package/assets/esri/core/workers/chunks/c134ebbaeac514cbd657.js +1 -0
  82. package/assets/esri/core/workers/chunks/c2b47a7dc961863d283f.js +1 -0
  83. package/assets/esri/core/workers/chunks/{0eaa4dccba0d844b9da3.js → c3ddcf9148dd2640c402.js} +1 -1
  84. package/assets/esri/core/workers/chunks/c476643002387f60ea42.js +1 -0
  85. package/assets/esri/core/workers/chunks/ce16489cf7eb0d78c741.js.LICENSE.txt +1 -1
  86. package/assets/esri/core/workers/chunks/d048e4926e78458afa3e.js +1 -0
  87. package/assets/esri/core/workers/chunks/d39a10155317e6f7a21c.js +1 -0
  88. package/assets/esri/core/workers/chunks/d6e0528eacee7ea4c1ce.js.LICENSE.txt +1 -1
  89. package/assets/esri/core/workers/chunks/d886fb97bdb348a16f25.js +1 -0
  90. package/assets/esri/core/workers/chunks/{00aa85ae6419aad183ea.js → dc4982b0ac007bd70213.js} +1 -1
  91. package/assets/esri/core/workers/chunks/e1258b6a404e58878c7a.js +1 -0
  92. package/assets/esri/core/workers/chunks/e31192ae920e3e19b6aa.js +1 -0
  93. package/assets/esri/core/workers/chunks/e6a86cad44056735ed26.js +1 -0
  94. package/assets/esri/core/workers/chunks/e82f5437bd66779c6740.js +1 -0
  95. package/assets/esri/core/workers/chunks/{039ec0fbe3b4b398b8c6.js → f26dc1d83beed63b6045.js} +1 -1
  96. package/assets/esri/core/workers/chunks/{fa5c87889c2f0bef896b.js → f35aaa04cca676c2d3f8.js} +1 -1
  97. package/assets/esri/core/workers/chunks/f5b7e7f2860a825ed373.js +1 -0
  98. package/assets/esri/core/workers/chunks/f651c05604eab83aef5f.js.LICENSE.txt +1 -1
  99. package/assets/esri/core/workers/chunks/{18da83afbc324fef9fd8.js → f779034623980bf9a37c.js} +2 -2
  100. package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
  101. package/assets/esri/themes/base/widgets/_Directions.scss +17 -18
  102. package/assets/esri/themes/dark/main.css +1 -1
  103. package/assets/esri/themes/light/main.css +1 -1
  104. package/assets/esri/themes/light/view.css +1 -1
  105. package/chunks/ComponentShader.glsl.js +72 -39
  106. package/chunks/OITBlend.glsl.js +3 -3
  107. package/chunks/bundle.js +1 -1
  108. package/config.js +1 -1
  109. package/core/QueueProcessor.js +1 -1
  110. package/core/has.js +1 -1
  111. package/core/sanitizerUtils.js +1 -1
  112. package/core/workers/Connection.js +1 -1
  113. package/core/workers/WorkerHandle.js +1 -1
  114. package/core/workers/utils.js +1 -1
  115. package/geohash/GeohashCell.js +1 -1
  116. package/geohash/geohashUtils.js +1 -1
  117. package/geometry/GeometryCursor.js +1 -1
  118. package/geometry/geometryCursorCollectUtils.js +1 -1
  119. package/geometry/libtess.js +1 -1
  120. package/geometry/support/jsonUtils.js +1 -1
  121. package/geometry/support/normalizeUtilsSync.js +1 -1
  122. package/geometry/support/triangulationUtils.js +1 -1
  123. package/interfaces.d.ts +426 -347
  124. package/intl/date.js +1 -1
  125. package/intl.d.ts +2 -0
  126. package/intl.js +1 -1
  127. package/kernel.js +1 -1
  128. package/layers/FeatureLayer.js +1 -1
  129. package/layers/graphics/OptimizedFeature.js +1 -1
  130. package/layers/graphics/OptimizedGeometry.js +1 -1
  131. package/layers/graphics/centroid.js +1 -1
  132. package/layers/graphics/contains.js +1 -1
  133. package/layers/graphics/data/AttributesBuilder.js +1 -1
  134. package/layers/graphics/data/FeatureStore.js +1 -1
  135. package/layers/graphics/data/QueryEngine.js +1 -1
  136. package/layers/graphics/data/QueryEngineResult.js +1 -1
  137. package/layers/graphics/data/geometryUtils.js +1 -1
  138. package/layers/graphics/data/spatialQuerySupport.js +1 -1
  139. package/layers/graphics/featureConversionUtils.js +1 -1
  140. package/layers/graphics/sources/OGCFeatureSource.js +1 -1
  141. package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
  142. package/layers/graphics/sources/geojson/geojson.js +1 -1
  143. package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
  144. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  145. package/layers/graphics/sources/support/clientSideDefaults.js +1 -1
  146. package/layers/knowledgeGraph/layerUtils.js +1 -1
  147. package/layers/mixins/ArcGISImageService.js +1 -1
  148. package/layers/mixins/ImageryTileMixin.js +1 -1
  149. package/layers/support/PixelBlock.js +1 -1
  150. package/layers/support/RasterInfo.js +1 -1
  151. package/layers/support/RasterJobHandler.js +1 -1
  152. package/layers/support/RasterSensorInfo.js +1 -1
  153. package/layers/support/RasterStorageInfo.js +1 -1
  154. package/layers/support/RasterWorker.js +1 -1
  155. package/layers/support/TitleCreator.js +1 -1
  156. package/layers/support/arcgisLayerUrl.js +1 -1
  157. package/layers/support/capabilities.js +1 -1
  158. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  159. package/layers/support/rasterDatasets/pixelReader.js +1 -1
  160. package/layers/support/rasterFieldUtils.js +1 -1
  161. package/layers/support/rasterFunctions/pixelUtils.js +1 -1
  162. package/layers/support/serviceCapabilitiesUtils.js +1 -1
  163. package/package.json +5 -5
  164. package/request.js +1 -1
  165. package/rest/print.js +1 -1
  166. package/rest/query/operations/pbfDehydratedFeatureSet.js +1 -1
  167. package/rest/query/operations/pbfJSONFeatureSet.js +1 -1
  168. package/rest/query/operations/query.js +1 -1
  169. package/rest/query/operations/queryZScale.js +1 -1
  170. package/rest/versionManagement/getVersionInfos.js +1 -1
  171. package/smartMapping/statistics/histogram.js +1 -1
  172. package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
  173. package/smartMapping/support/utils.js +1 -1
  174. package/support/elevationInfoUtils.js +1 -1
  175. package/support/requestImageUtils.js +1 -1
  176. package/support/revision.js +1 -1
  177. package/views/2d/GoToManager.js +1 -1
  178. package/views/2d/analysis/ElevationProfile/ElevationProfileLineVisualization2D.js +1 -1
  179. package/views/2d/engine/vectorTiles/shaders/sources/shaderRepository.js +1 -1
  180. package/views/2d/engine/webgl/Mesh2D.js +1 -1
  181. package/views/2d/engine/webgl/brushes/WGLBrushVTLSymbol.js +1 -1
  182. package/views/2d/engine/webgl/mesh/templates/templateUtils.js +1 -1
  183. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
  184. package/views/2d/engine/webgl/shaderGraph/techniques/fill/AFillMeshWriter.js +1 -1
  185. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  186. package/views/2d/layers/features/aggregation/GridCell.js +1 -1
  187. package/views/2d/layers/features/processor/AAggregateStrategy.js +1 -1
  188. package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
  189. package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
  190. package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
  191. package/views/2d/layers/features/schema/SourceSchema.js +1 -1
  192. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  193. package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
  194. package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
  195. package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
  196. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  197. package/views/2d/layers/features/support/FeatureFilterEvaluator.js +1 -1
  198. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  199. package/views/2d/layers/features/support/FeatureSetReaderIndirect.js +1 -1
  200. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  201. package/views/2d/layers/features/support/FeatureSetReaderParquet.js +1 -1
  202. package/views/2d/layers/features/support/GraphicsReader.js +1 -1
  203. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  204. package/views/3d/FocusAreasView.js +1 -1
  205. package/views/3d/GroundView3D.js +1 -1
  206. package/views/3d/analysis/ElevationProfile/ElevationProfileLineSceneComputation.js +1 -1
  207. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  208. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  209. package/views/3d/glTF/DefaultLoadingContext.js +1 -1
  210. package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
  211. package/views/3d/layers/FlowSubView3D.js +1 -1
  212. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  213. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  214. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  215. package/views/3d/layers/graphics/Graphics3DFeatureStore.js +1 -1
  216. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  217. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  218. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  219. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  220. package/views/3d/layers/graphics/pipeline/featureSet/PBFPointFeatureSetView.js +1 -1
  221. package/views/3d/layers/graphics/pipeline/featureSet/TiledFeatureStore.js +1 -1
  222. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  223. package/views/3d/layers/i3s/I3SQueryFeatureAdapter.js +1 -1
  224. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  225. package/views/3d/layers/support/FeatureTileFetcher3DContext.js +1 -1
  226. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  227. package/views/3d/layers/support/featureTileQuery3D.js +1 -1
  228. package/views/3d/state/ViewStateManager.js +1 -1
  229. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  230. package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
  231. package/views/3d/state/controllers/RotateController.js +1 -1
  232. package/views/3d/state/controllers/ZoomControllerGlobal.js +1 -1
  233. package/views/3d/state/controllers/ZoomControllerLocal.js +1 -1
  234. package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
  235. package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
  236. package/views/3d/state/utils/navigationUtils.js +1 -1
  237. package/views/3d/support/DisplayQualityProfile.js +1 -1
  238. package/views/3d/support/QualitySettings.js +1 -1
  239. package/views/3d/support/StreamDataLoader.js +1 -1
  240. package/views/3d/support/engineContent/line.js +1 -1
  241. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  242. package/views/3d/support/flow/FlowWorker.js +1 -1
  243. package/views/3d/support/flow/StreamlineResources3D.js +1 -1
  244. package/views/3d/support/flow/constants.js +1 -1
  245. package/views/3d/support/hitTest.js +1 -1
  246. package/views/3d/support/renderInfoUtils/polygon.js +1 -1
  247. package/views/3d/terrain/Tile.js +1 -1
  248. package/views/3d/terrain/TileOverlayData.js +1 -1
  249. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  250. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  251. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  252. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  253. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
  254. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +7 -7
  255. package/views/3d/webgl-engine/core/shaderModules/BooleanDrawUniform.js +5 -0
  256. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueConstructionContext.js +1 -1
  257. package/views/3d/webgl-engine/lib/CutFillDepth.js +1 -1
  258. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  259. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  260. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  261. package/views/3d/webgl-engine/shaders/AnimatedLine.glsl.js +4 -4
  262. package/views/analysis/ElevationProfile/ElevationProfileController.js +1 -1
  263. package/views/analysis/ElevationProfile/ElevationProfileLineInputComputation.js +1 -1
  264. package/views/analysis/ElevationProfile/ElevationProfileResult.js +1 -1
  265. package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
  266. package/views/analysis/ElevationProfile/elevationProfileGenerationUtils.js +1 -1
  267. package/views/draw/support/Reshape.js +1 -1
  268. package/views/draw/support/reshapeUtils.js +1 -1
  269. package/views/interactive/dragEventPipeline.js +1 -1
  270. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileStore.js +1 -1
  271. package/views/webgl/ShaderBuilder.js +1 -1
  272. package/views/webgl/Texture.js +1 -1
  273. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  274. package/widgets/BatchAttributeForm.js +1 -1
  275. package/widgets/Directions/css.js +1 -1
  276. package/widgets/Directions.js +1 -1
  277. package/widgets/Editor/AddAssociationWorkflow.js +1 -1
  278. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  279. package/widgets/Editor/EditorViewModel.js +1 -1
  280. package/widgets/Editor/Edits.js +1 -1
  281. package/widgets/Editor/MergeFeaturesWorkflow.d.ts +4 -0
  282. package/widgets/Editor/MergeFeaturesWorkflow.js +5 -0
  283. package/widgets/Editor/MergeFeaturesWorkflowData.d.ts +4 -0
  284. package/widgets/Editor/MergeFeaturesWorkflowData.js +5 -0
  285. package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
  286. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  287. package/widgets/Editor/UpdateFeaturesWorkflowData.js +1 -1
  288. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  289. package/widgets/Editor/components/UploadDetails.js +1 -1
  290. package/widgets/Editor/support/EditorItem.js +1 -1
  291. package/widgets/Editor/support/mergeFeaturesUtils.js +5 -0
  292. package/widgets/Editor/workflowUtils.js +1 -1
  293. package/widgets/Editor.js +1 -1
  294. package/widgets/Feature/FeatureExpression.js +1 -1
  295. package/widgets/Feature/FeatureFields/FeatureFieldsViewModel.js +1 -1
  296. package/widgets/Feature/FeatureFields.js +1 -1
  297. package/widgets/Feature/FeatureMedia/FeatureMediaViewModel.js +1 -1
  298. package/widgets/Feature/FeatureMedia.js +1 -1
  299. package/widgets/Feature/FeatureViewModel.js +1 -1
  300. package/widgets/Feature/support/featureUtils.js +1 -1
  301. package/widgets/Feature.js +1 -1
  302. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  303. package/widgets/OrientedImageryViewer/components/SequentialNavigationUI.js +1 -1
  304. package/widgets/OrientedImageryViewer/components/SketchTools.js +1 -1
  305. package/widgets/Print.js +1 -1
  306. package/widgets/support/ColorPicker.js +1 -1
  307. package/widgets/support/SelectionList/LayerItem.js +1 -1
  308. package/widgets/support/jsxWidgetSupport.js +1 -1
  309. package/assets/esri/core/workers/chunks/065f2bbcaeef1f13fd48.js +0 -1
  310. package/assets/esri/core/workers/chunks/0731e588afd1f561ec3b.js +0 -1
  311. package/assets/esri/core/workers/chunks/188272af9a6470ccfe31.js +0 -1
  312. package/assets/esri/core/workers/chunks/1a9f544f20f643161a36.js +0 -1
  313. package/assets/esri/core/workers/chunks/1cfcadaa98ac528fea37.js +0 -1
  314. package/assets/esri/core/workers/chunks/1db0bf570a04687b3130.js +0 -1
  315. package/assets/esri/core/workers/chunks/24921d31efa8d222ad2d.js +0 -2
  316. package/assets/esri/core/workers/chunks/2a900a632a1231deb713.js +0 -1
  317. package/assets/esri/core/workers/chunks/31c6e951b99315e8e68a.js +0 -1
  318. package/assets/esri/core/workers/chunks/35491fbdd287470d40a4.js +0 -1
  319. package/assets/esri/core/workers/chunks/36247c6f6fc2891df2cf.js +0 -1
  320. package/assets/esri/core/workers/chunks/3d53307efbc3f07d7bf2.js +0 -1
  321. package/assets/esri/core/workers/chunks/42a72e1d963e4636323b.js +0 -1
  322. package/assets/esri/core/workers/chunks/456161a323be7d640c61.js +0 -1
  323. package/assets/esri/core/workers/chunks/500d09d2191127371081.js +0 -1
  324. package/assets/esri/core/workers/chunks/5707713c2f27588b9194.js +0 -1
  325. package/assets/esri/core/workers/chunks/5713f96bade5ebb54c81.js +0 -1
  326. package/assets/esri/core/workers/chunks/5718cf135e105e1e026b.js +0 -1
  327. package/assets/esri/core/workers/chunks/5c585b338a9e9aa0e205.js +0 -1
  328. package/assets/esri/core/workers/chunks/5d1d909354c90cb8eb60.js +0 -1
  329. package/assets/esri/core/workers/chunks/5ea03f53d4d64d9e7cae.js +0 -1
  330. package/assets/esri/core/workers/chunks/63019a7eb5222dc5e420.js +0 -1
  331. package/assets/esri/core/workers/chunks/64629ddcf008349eaf41.js +0 -1
  332. package/assets/esri/core/workers/chunks/64ee8d2acae2d6fce608.js +0 -1
  333. package/assets/esri/core/workers/chunks/6fcacfcb3d83515c37c9.js +0 -1
  334. package/assets/esri/core/workers/chunks/72ecf49d03bb24bf0998.js +0 -1
  335. package/assets/esri/core/workers/chunks/7421f9575487cdc9e28e.js +0 -1
  336. package/assets/esri/core/workers/chunks/77a11d7d53325d108ed8.js +0 -1
  337. package/assets/esri/core/workers/chunks/7a05b1f6163112bc9db2.js +0 -1
  338. package/assets/esri/core/workers/chunks/7d9882ddfa6495f72baa.js +0 -1
  339. package/assets/esri/core/workers/chunks/7fffad8ff6878fa1fd56.js +0 -1
  340. package/assets/esri/core/workers/chunks/81bbe5251ed13c0d91cc.js +0 -1
  341. package/assets/esri/core/workers/chunks/8b16aa50d879b92a5375.js +0 -1
  342. package/assets/esri/core/workers/chunks/8bc64fc7c4b9eb8fca4d.js +0 -1
  343. package/assets/esri/core/workers/chunks/8bfa19c24be0e3f3fd74.js +0 -1
  344. package/assets/esri/core/workers/chunks/8eefa133c36a004c054c.js +0 -1
  345. package/assets/esri/core/workers/chunks/9834bc11586a2d8d6f35.js +0 -1
  346. package/assets/esri/core/workers/chunks/9c6fc4fe2c46f40d63d9.js +0 -1
  347. package/assets/esri/core/workers/chunks/a5f25104938ab33e7a85.js +0 -1
  348. package/assets/esri/core/workers/chunks/a7bd294996e6c8b8354a.js +0 -1
  349. package/assets/esri/core/workers/chunks/abf4f018c692c18c3320.js +0 -1
  350. package/assets/esri/core/workers/chunks/b1f667006cba60ef4aa7.js +0 -1
  351. package/assets/esri/core/workers/chunks/b2d9f4e057af26a538fb.js +0 -1
  352. package/assets/esri/core/workers/chunks/b62807c6fcfb70a87cd4.js +0 -1
  353. package/assets/esri/core/workers/chunks/b8339c1d60847a9eed3e.js +0 -1
  354. package/assets/esri/core/workers/chunks/c362fbbafec91c44eeb2.js +0 -1
  355. package/assets/esri/core/workers/chunks/c941d15190fc08523d0d.js +0 -1
  356. package/assets/esri/core/workers/chunks/cc70a4a915b0b2ccb2a0.js +0 -1
  357. package/assets/esri/core/workers/chunks/d121045cddbe55c2ecb2.js +0 -1
  358. package/assets/esri/core/workers/chunks/d2120a623b1bd91b9ed9.js +0 -1
  359. package/assets/esri/core/workers/chunks/d78c2833cdc4730a88a3.js +0 -1
  360. package/assets/esri/core/workers/chunks/df438b62702007267798.js +0 -1
  361. package/assets/esri/core/workers/chunks/f4eb090bcc3eca64306a.js +0 -1
  362. package/assets/esri/core/workers/chunks/f7846523adacbfe5047e.js +0 -1
  363. package/assets/esri/core/workers/chunks/f839b86bee15deaf84e4.js +0 -1
@@ -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}from"../../../core/maybe.js";import{initial as s,watch as r,when as o}from"../../../core/reactiveUtils.js";import{schedule as n}from"../../../core/scheduling.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as c,invert as d}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as h,IDENTITY as m}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as u}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as p}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{o as f,g,a as b,f as y}from"../../../chunks/vec32.js";import{fromArray as _,clone as w,create as v}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}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as C}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as M}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as O}from"../../../geometry/projection/projectVectorToVector.js";import{create as T}from"../../../geometry/support/aaBoundingRect.js";import{BufferViewVec2f as P,BufferViewVec4f as U,BufferViewVec4u8 as H,BufferViewVec4u16 as S,BufferViewVec3f as E,BufferViewVec3u8 as R,BufferViewVec3u16 as F,BufferViewInt16 as V,BufferViewUint32 as A,BufferViewUint16 as k}from"../../../geometry/support/buffer/BufferView.js";import I from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as D}from"../../../support/elevationInfoUtils.js";import{toWasmModification as L}from"./I3SMeshWorkerHandle.js";import{LayerView3D as B}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as G}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as z,removeLayerViewFromWasm as N,getLyr3DWasm as W}from"./Lyr3DWasm.js";import{LayerElevationProvider as $}from"./i3s/LayerElevationProvider.js";import{primTypeConversion as q,wrapModeConversion as J,lyr3DTypeToByteSize as K,alphaModeConversion as Q,faceCullingConversion as X}from"./support/lyr3dTypeConversions.js";import{Tiles3DIntersectionHandler as Y}from"./support/Tiles3DIntersectionHandler.js";import{ElevationRange as Z}from"../support/ElevationRange.js";import{toBoundingRect as ee}from"../support/extentUtils.js";import{Obb as te,compute as ie}from"../support/orientedBoundingBox.js";import{ObjectParameters as se}from"../webgl-engine/collections/Component/ObjectParameters.js";import{GeometryParameters as re,createVertexBufferLayout as oe,SourceGeometry as ne}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as ae}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as le}from"../webgl-engine/core/material/RenderTexture.js";import{getEllipsoidMode as ce}from"../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{Attribute as de}from"../webgl-engine/lib/Attribute.js";import{compressAndTransformNormals as he}from"../webgl-engine/lib/Normals.js";import{Texture as me}from"../webgl-engine/lib/Texture.js";import{writeAttribute as ue,writeBufferVec2 as pe}from"../webgl-engine/materials/internal/bufferWriterUtils.js";import fe from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as ge,isInEffectiveScaleRange as be}from"../../support/layerViewUtils.js";import{TextureCompressionTracker as ye}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as _e}from"../../../webscene/support/AlphaCutoff.js";class we{constructor(e,t,i,s,r,o,n){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=s,this.vboMemoryUsage=r,this.textureMemoryUsage=o,this.obb=n,this.isVisible=!1,this.usedMemory=this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage;const a=v();n?.getCenter(a),this._obbCenter=a,this._obbRadiusSquared=n?n?.radius**2:0}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const i=b(ve,this._obbCenter,e),s=y(i,t);return y(i,i)-s*s<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}}const ve=v();function je(e){return Math.round(e/1048.576)/1e3}let xe=class extends(B(fe)){get hasModifications(){return this._modifications&&this._modifications.length>0}constructor(e){super(e),this.type="integrated-mesh-3dtiles",this._compressionTracker=new ye,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._initialCullFace=new Map,this._suspendedHandle=null,this._dbgFlags=new Set,this._memCache=e.view.resourceController.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e))}initialize(){this._dbgFlags.add(3),this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),s),!this._canProjectWithoutEngine())throw ge("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=z(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(),s),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),s),this._elevationProvider=new $({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),e.elevationProvider.register(1,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([r(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e))]),this._suspendedHandle=r(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),s)});this.addResolvingPromise(t),this._replacesTerrain&&this.addHandles(o(()=>this.view.map.ground.opacity,()=>{this._opacityChange()}))}get _replacesTerrain(){return this.layer.replacesTerrain&&!!this.view.map.basemap?.groundLayers.includes(this.layer)}get opacity(){return this.fullOpacity*(this._replacesTerrain?this.view.map.ground.opacity:1)}_opacityChange(){const{opacity:e}=this;this.forEachComponentObject(t=>{this._collection.getMaterial(t).objectOpacity=e})}intersect(e,t,i,s){this._intersectionHandler.intersect(e,t,i,s,null,!1)}get ready(){return!0}destroy(){this._dbg(2,"Tiles3DLayerView3D destroy() called"),N(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._initialCullFace.clear(),this._visibleObjects.clear(),this._usedMemory=0,this._cacheMemory=0,this._memCache.destroy(),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}_modificationsChanged(){const e=this.layer.spatialReference,t=L(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t,e.wkid)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=T();this._layerClippingArea=ee(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=n(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),this.forEachComponentObject(t=>{const i=this._collection.getMaterial(t);i.commonMaterialParameters.hasSlicePlane=e,i.commonMaterialParameters.cullFace=e?0:this._initialCullFace.get(t)})}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,D(e))}get _wasm(){return W(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get visibleAtCurrentScale(){return be(this.layer.effectiveScaleRange,this.view.scale)}get performanceInfo(){let e=0,t=0,i=0,s=0,r=0,o=0;return this._lyrHandleToObjects.forEach(n=>{n.isVisible?(e+=n.textureMemoryUsage,t+=n.vboMemoryUsage,r++):(i+=n.textureMemoryUsage,s+=n.vboMemoryUsage,o++)}),new G(this.usedMemory,r,o,je(t),je(e),je(s),je(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 Z(e.zmin,e.zmax):null}getElevationRange(e){return null}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){const t=e.meshData;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const i=_(t.desc.origin),s=new Array,r=this.view.basemapTerrain.spatialReference;let o,n;if("global"===this.view.viewingMode){const e=u();C(x,i,e,r),o=c(h(),e),n=d(h(),o)}else o=m,n=m;const a=w(i),l=v(),p=Te(t.desc.obb);let g=0,b=0;const y={textureMemoryUsage:0},T=new Array,U=new Map,H=t.desc.prims.length;for(let c=0;c<H;c++){const e=t.desc.prims[c];this._dbg(2,JSON.stringify(e));if(null==q[e.ptype]||null==t.data){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive.");continue}const d=t.desc?.materials&&null!=e.materialId?t.desc.materials[e.materialId]:null,h=null!=d?d.lightingModel:"Unlit",{positionView:u,positionAttr:_,normalsView:w,normalsAttr:x,colorAttr:C,texCoord0Attr:H,indicesView:S}=this.getBufferViews(e,t.data.buffer,o);if(null==_||null==u||null==S)continue;const E=new re(null!=C,H?1:0,null!=w,this._shadeNormals||this._replacesTerrain,this._applySSAO),R=_.data.length/_.size,F=(e,t)=>!e||e.data.length/e.size===R||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);if(!F(H,"numTexcoord")||!F(C,"numColors")||!F(x,"normals"))continue;const V=oe(E),A=p?.clone()??Oe(_,i);if(o!==m)for(let t=0;t<u.count;t++)u.getVec(t,l),f(l,l,o),u.setVec(t,l);const k=V.createBuffer(_.data.length);if(ue("position",_,null,null,k,0),null!=H){const e=k.getField("uv0",P);pe(H,e,0)}null!=C&&ue("color",C,null,null,k,0),null!=x&&ue("normalCompressed",x,null,null,k,0);const I=new Uint32Array([0,S.typedBuffer.length]),D=new ne({data:k.buffer,count:k.byteLength/V.stride,layoutParameters:E},{positions:u.typedBuffer,indices:S.typedBuffer},S.typedBuffer,I);g+=u.count+S.count;const L=this.view.renderSpatialReference,B=v(),G=[1,1,1];M(a,L,G,r)||this._dbg(3,"Unsupported coordinate system for IM overlay"),O(a,L,B,r);const z=this._collection.createObject(new se(j(B[0],B[1],G[0],G[1]),new ae(a,n),A,D,!1));if(d){const e=e=>{e.baseColor=d.baseColorFactor,e.usePBR="Pbr"===h,e.hasParametersFromSource=!1,e.baseColorTexture=this._getTexture(d.baseColorTex,t,U,y),e.usePBR&&(e.mrrFactors=[d.metallicFactor,d.roughnessFactor,0],e.emissiveBaseColor=d.emissiveFactor??[0,0,0],e.metallicRoughnessTexture=this._getTexture(d.metalTex,t,U,y),e.emissionTexture=this._getTexture(d.emissiveTex,t,U,y),e.occlusionTexture=this._getTexture(d.occlusionTex,t,U,y),e.normalTexture=this._getTexture(d.normalTex,t,U,y)),e.objectOpacity=0,e.alphaDiscardMode=2;const i=[];e.baseColorTexture&&i.push(e.baseColorTexture.loadPromise),e.usePBR&&(e.metallicRoughnessTexture&&i.push(e.metallicRoughnessTexture.loadPromise),e.emissionTexture&&i.push(e.emissionTexture.loadPromise),e.occlusionTexture&&i.push(e.occlusionTexture.loadPromise),e.normalTexture&&i.push(e.normalTexture.loadPromise));const r=Promise.all(i);s.push(r),r.then(()=>{e.alphaDiscardMode=Q[d.alphaMode],e.objectOpacity=this.opacity,y.textureMemoryUsage+=e.baseColorTexture?.glTexture?.usedMemory??0,e.usePBR&&(y.textureMemoryUsage+=(e.metallicRoughnessTexture?.glTexture?.usedMemory??0)+(e.emissionTexture?.glTexture?.usedMemory??0)+(e.occlusionTexture?.glTexture?.usedMemory??0)+(e.normalTexture?.glTexture?.usedMemory??0))}),e.commonMaterialParameters.doubleSided=d.isDoubleSided,e.commonMaterialParameters.cullFace=d.faceCulling?X[d.faceCulling]:2,this._initialCullFace.set(z,e.commonMaterialParameters.cullFace),e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.componentParameters.castShadows=0,e.textureAlphaCutoff=d.alphaCutoff??_e,e.alphaDiscardMode=Q[d.alphaMode],e.isIntegratedMesh=!0,e.sphereDepthInterpolate=this.layer.hasGoogleUrl,e.polygonOffsetEnabled=!1,e.hasOccludees=!1,e.ellipsoidMode=ce(this.view.spatialReference)};this._collection.updateMaterial(z,e)}T.push(z),b+=this._collection.getObjectGPUMemoryUsage(z)}await Promise.all(s);const S=new Array;U.forEach(e=>{S.push(e)});const E=new we(e.handle,T,S,g,b,y.textureMemoryUsage,p);return this._memCache.put(`${E.handle}`,E),this._lyrHandleToObjects.set(e.handle,E),this._cacheMemory+=E.usedMemory,{memUsageBytes:E.usedMemory}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t&&(t.isVisible?(this._visibleObjects.delete(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e))}freeObject(e){this._memCache.pop(`${e.handle}`),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>{this._collection.destroyObject(e),this._initialCullFace.delete(e)})}setRenderableVisibility(e,t,i){for(let s=0;s<i;++s){const i=t[s];if(!i)continue;const r=e[s],o=this._lyrHandleToObjects.get(r);if(o){if(o.isVisible)continue;this._visibleGeometryChanged(),o.isVisible=!0,this._visibleObjects.add(o),this._usedMemory+=o.usedMemory,this._cacheMemory-=o.usedMemory,o.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,i),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e))}),this._memCache.pop(`${r}`)}}for(let s=0;s<i;++s){const i=e[s],r=t[s];if(r)continue;const o=this._lyrHandleToObjects.get(i);if(o){if(!o.isVisible)continue;this._visibleGeometryChanged(),o.isVisible=!1,this._visibleObjects.delete(o),this._usedMemory-=o.usedMemory,this._cacheMemory+=o.usedMemory,o.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,r),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e))}),this._memCache.put(`${i}`,o)}}}_getTexture(e,t,i,s){let r=null;if(e&&t.desc?.images&&t.data?.buffer){const o=t.desc.images[e?.imageId];if(r=i.get(o),!r&&o){const n=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,a=!!o.mipCount||n>1,l=J[e.wrapMode??"None"];let c=o.alpha?6408:6407;const d=new Uint8Array(t.data.buffer,o.data.byteOffset,o.data.byteCount);let h=null,m=null,u=null;switch(o.format){case"Raw":"R8"===o.pixelFormat?(h=d,c=6403,m=""):"Rgb8"===o.pixelFormat?(h=d,c=6407,m=""):"Rgba8"===o.pixelFormat&&(h=d,c=6408,m="");break;case"Dxt1":h=d,c=6407,m="image/vnd-ms.dds";break;case"Dxt5":h=d,c=6408,m="image/vnd-ms.dds";break;case"Basis":h=d,c=6407,m="image/ktx2";break;case"Png":m="image/png",u=document.createElement("img");break;case"Jpeg":m="image/jpeg",u=document.createElement("img");break;case"Etc2":m="image/ktx",u=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(u&&m){const e=new Blob([d],{type:m});u.src=URL.createObjectURL(e),h=u}if(h&&null!=m){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker,compressionCallback:e=>{e&&e>0&&(s.textureMemoryUsage-=e)}}:void 0;r=new me(h,{mipmap:a,maxAnisotropy:n,encoding:m,wrap:l,pixelFormat:c,compressionOptions:e,noUnpackFlip:!0,width:o.mip0Width,height:o.mip0Height}),this._stage.addTexture(r),i.set(o,r)}}}return r?new le(this.view.stage.renderView.textures,r.id):null}getBufferViews(e,t,i){let s,r,o,n,a,l,c,d=null;for(let m=0;m<e.atrbs.length;m++){const c=e.atrbs[m],u=c.view,p=void 0,f=u.byteOffset+u.byteCount,g=u.byteCount/K[u.type],b=[...Array(g).keys()].map(e=>e);try{switch(c.sem){case"Position":3!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+u+")"):(s=new E(t,u.byteOffset,p,f),r=new de(s.typedBuffer,b,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 E(t,u.byteOffset,p,f),s=he(e.typedBuffer,i);a=new V(s.buffer),l=new de(a.typedBuffer,b,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 de(new P(t,u.byteOffset,p,f).typedBuffer,b,2));break;case"Color":4===u.ncomp?("F32"===u.type&&(d=new U(t,u.byteOffset,p,f)),"U8"===u.type&&(d=new H(t,u.byteOffset,p,f)),"U16"===u.type&&(d=new S(t,u.byteOffset,p,f))):3===u.ncomp&&("F32"===u.type&&(d=new E(t,u.byteOffset,p,f)),"U8"===u.type&&(d=new R(t,u.byteOffset,p,f)),"U16"===u.type&&(d=new F(t,u.byteOffset,p,f))),null==d?this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+u+")"):o=new de(d.typedBuffer,b,u.ncomp);break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+c.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":c=new k(t,i.byteOffset,s,r);break;case"U32":c=new A(t,i.byteOffset,s,r);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==c&&null!=s){const e=s.count;if(e<65535){const t=new Uint16Array(e);c=new k(t.buffer)}else{const t=new Uint32Array(e);c=new A(t.buffer)}for(let t=0;t<e;t++)c.set(t,t)}return{positionView:s,positionAttr:r,colorAttr:o,texCoord0Attr:n,indicesView:c,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.toArray(),s),"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([a({type:[I]})],xe.prototype,"_modifications",void 0),e([a()],xe.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([a()],xe.prototype,"layer",void 0),e([a({readOnly:!0})],xe.prototype,"visibleAtCurrentScale",null),e([a()],xe.prototype,"elevationOffset",null),xe=e([l("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],xe);const Ce=xe,Me=v();function Oe(e,t){const i=ie(e);return g(Me,i.center,t),i.center=Me,i}function Te(e){return e?new te(e.center,e.halfSize,p(...e.quaternion)):null}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{initial as r,watch as o,when as n}from"../../../core/reactiveUtils.js";import{schedule as a}from"../../../core/scheduling.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as d,invert as h}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as m,IDENTITY as u}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as p}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as f}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{o as g,g as b,a as y,f as _}from"../../../chunks/vec32.js";import{fromArray as w,clone as v,create as j}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as x}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{SphericalECEFSpatialReferenceLike as C}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as M}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as O}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as T}from"../../../geometry/projection/projectVectorToVector.js";import{create as U}from"../../../geometry/support/aaBoundingRect.js";import{BufferViewVec2f as P,BufferViewVec4f as H,BufferViewVec4u8 as E,BufferViewVec4u16 as R,BufferViewVec3f as S,BufferViewVec3u8 as V,BufferViewVec3u16 as A,BufferViewInt16 as k,BufferViewUint32 as F,BufferViewUint16 as I}from"../../../geometry/support/buffer/BufferView.js";import D from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as L}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,wrapModeConversion as K,lyr3DTypeToByteSize as Q,alphaModeConversion as X,faceCullingConversion as Y}from"./support/lyr3dTypeConversions.js";import{Tiles3DIntersectionHandler as Z}from"./support/Tiles3DIntersectionHandler.js";import{ElevationRange as ee}from"../support/ElevationRange.js";import{toBoundingRect as te}from"../support/extentUtils.js";import{Obb as ie,compute as se}from"../support/orientedBoundingBox.js";import{ObjectParameters as re}from"../webgl-engine/collections/Component/ObjectParameters.js";import{GeometryParameters as oe,createVertexBufferLayout as ne,SourceGeometry as ae}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as le}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as ce}from"../webgl-engine/core/material/RenderTexture.js";import{getEllipsoidMode as de}from"../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{Attribute as he}from"../webgl-engine/lib/Attribute.js";import{compressAndTransformNormals as me}from"../webgl-engine/lib/Normals.js";import{Texture as ue}from"../webgl-engine/lib/Texture.js";import{writeAttribute as pe,writeBufferVec2 as fe}from"../webgl-engine/materials/internal/bufferWriterUtils.js";import ge from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as be,isInEffectiveScaleRange as ye}from"../../support/layerViewUtils.js";import{TextureCompressionTracker as _e}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as we}from"../../../webscene/support/AlphaCutoff.js";class ve{constructor(e,t,i,s,r,o,n){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=s,this.vboMemoryUsage=r,this.textureMemoryUsage=o,this.obb=n,this.isVisible=!1,this.usedMemory=this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage;const a=j();n?.getCenter(a),this._obbCenter=a,this._obbRadiusSquared=n?n?.radius**2:0}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const i=y(je,this._obbCenter,e),s=_(i,t);return _(i,i)-s*s<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}}const je=j();function xe(e){return Math.round(e/1048.576)/1e3}let Ce=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 _e,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._suspendedHandle=null,this._dbgFlags=new Set,this._memCache=e.view.resourceController.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e))}initialize(){this._dbgFlags.add(3),this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),r),!this._canProjectWithoutEngine())throw be("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=N(this).then(t=>{this._wasmLayerId=t,this._intersectionHandler=new Z(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged(),r),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),r),this._elevationProvider=new q({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),e.elevationProvider.register(1,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([o(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e))]),this._suspendedHandle=o(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),r)});this.addResolvingPromise(t),this._replacesTerrain&&this.addHandles(n(()=>this.view.map.ground.opacity,()=>{this._opacityChange()}))}get _replacesTerrain(){return this.layer.replacesTerrain&&!!this.view.map.basemap?.groundLayers.includes(this.layer)}get opacity(){return this.fullOpacity*(this._replacesTerrain?this.view.map.ground.opacity:1)}_opacityChange(){const{opacity:e}=this;this.forEachComponentObject(t=>{this._collection.getMaterial(t).objectOpacity=e})}intersect(e,t,i,s){this._intersectionHandler.intersect(e,t,i,s,null,!1)}get ready(){return!0}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._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=U();this._layerClippingArea=te(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=a(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),this.forEachComponentObject(t=>this._collection.getMaterial(t).commonMaterialParameters.hasSlicePlane=e)}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,L(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 ye(this.layer.effectiveScaleRange,this.view.scale)}get performanceInfo(){let e=0,t=0,i=0,s=0,r=0,o=0;return this._lyrHandleToObjects.forEach(n=>{n.isVisible?(e+=n.textureMemoryUsage,t+=n.vboMemoryUsage,r++):(i+=n.textureMemoryUsage,s+=n.vboMemoryUsage,o++)}),new z(this.usedMemory,r,o,xe(t),xe(e),xe(s),xe(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 L(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new ee(e.zmin,e.zmax):null}getElevationRange(e){return null}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){const t=e.meshData;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const i=w(t.desc.origin),s=new Array,r=this.view.basemapTerrain.spatialReference;let o,n;if("global"===this.view.viewingMode){const e=p();M(C,i,e,r),o=d(m(),e),n=h(m(),o)}else o=u,n=u;const a=v(i),l=j(),c=Ue(t.desc.obb);let f=0,b=0;const y={textureMemoryUsage:0},_=new Array,U=new Map,H=t.desc.prims.length;for(let d=0;d<H;d++){const e=t.desc.prims[d];this._dbg(2,JSON.stringify(e));if(null==J[e.ptype]||null==t.data){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive.");continue}const h=t.desc?.materials&&null!=e.materialId?t.desc.materials[e.materialId]:null,m=null!=h?h.lightingModel:"Unlit",{positionView:p,positionAttr:w,normalsView:v,normalsAttr:C,colorAttr:M,texCoord0Attr:H,indicesView:E}=this.getBufferViews(e,t.data.buffer,o);if(null==w||null==p||null==E)continue;const R=new oe(null!=M,H?1:0,null!=v,this._shadeNormals||this._replacesTerrain,this._applySSAO),S=w.data.length/w.size,V=(e,t)=>!e||e.data.length/e.size===S||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);if(!V(H,"numTexcoord")||!V(M,"numColors")||!V(C,"normals"))continue;const A=ne(R),k=c?.clone()??Te(w,i);if(o!==u)for(let t=0;t<p.count;t++)p.getVec(t,l),g(l,l,o),p.setVec(t,l);const F=A.createBuffer(w.data.length);if(pe("position",w,null,null,F,0),null!=H){const e=F.getField("uv0",P);fe(H,e,0)}null!=M&&pe("color",M,null,null,F,0),null!=C&&pe("normalCompressed",C,null,null,F,0);const I=new Uint32Array([0,E.typedBuffer.length]),D=new ae({data:F.buffer,count:F.byteLength/A.stride,layoutParameters:R},{positions:p.typedBuffer,indices:E.typedBuffer},E.typedBuffer,I);f+=p.count+E.count;const L=this.view.renderSpatialReference,B=j(),G=[1,1,1];O(a,L,G,r)||this._dbg(3,"Unsupported coordinate system for IM overlay"),T(a,L,B,r);const z=this._collection.createObject(new re(x(B[0],B[1],G[0],G[1]),new le(a,n),k,D,!1));if(h){const e=e=>{e.baseColor=h.baseColorFactor,e.usePBR="Pbr"===m,e.hasParametersFromSource=!1,e.baseColorTexture=this._getTexture(h.baseColorTex,t,U,y),e.usePBR&&(e.mrrFactors=[h.metallicFactor,h.roughnessFactor,0],e.emissiveBaseColor=h.emissiveFactor??[0,0,0],e.metallicRoughnessTexture=this._getTexture(h.metalTex,t,U,y),e.emissionTexture=this._getTexture(h.emissiveTex,t,U,y),e.occlusionTexture=this._getTexture(h.occlusionTex,t,U,y),e.normalTexture=this._getTexture(h.normalTex,t,U,y)),e.objectOpacity=0,e.alphaDiscardMode=2;const i=[];e.baseColorTexture&&i.push(e.baseColorTexture.loadPromise),e.usePBR&&(e.metallicRoughnessTexture&&i.push(e.metallicRoughnessTexture.loadPromise),e.emissionTexture&&i.push(e.emissionTexture.loadPromise),e.occlusionTexture&&i.push(e.occlusionTexture.loadPromise),e.normalTexture&&i.push(e.normalTexture.loadPromise));const r=Promise.all(i);s.push(r),r.then(()=>{e.alphaDiscardMode=X[h.alphaMode],e.objectOpacity=this.opacity,y.textureMemoryUsage+=e.baseColorTexture?.glTexture?.usedMemory??0,e.usePBR&&(y.textureMemoryUsage+=(e.metallicRoughnessTexture?.glTexture?.usedMemory??0)+(e.emissionTexture?.glTexture?.usedMemory??0)+(e.occlusionTexture?.glTexture?.usedMemory??0)+(e.normalTexture?.glTexture?.usedMemory??0))}),e.commonMaterialParameters.doubleSided=h.isDoubleSided,e.commonMaterialParameters.cullFace=h.faceCulling?Y[h.faceCulling]:0,e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.componentParameters.castShadows=0,e.textureAlphaCutoff=h.alphaCutoff??we,e.alphaDiscardMode=X[h.alphaMode],e.isIntegratedMesh=!0,e.sphereDepthInterpolate=this.layer.hasGoogleUrl,e.polygonOffsetEnabled=!1,e.hasOccludees=!1,e.ellipsoidMode=de(this.view.spatialReference)};this._collection.updateMaterial(z,e)}_.push(z),b+=this._collection.getObjectGPUMemoryUsage(z)}await Promise.all(s);const E=new Array;U.forEach(e=>{E.push(e)});const R=new ve(e.handle,_,E,f,b,y.textureMemoryUsage,c);return this._memCache.put(`${R.handle}`,R),this._lyrHandleToObjects.set(e.handle,R),this._cacheMemory+=R.usedMemory,{memUsageBytes:R.usedMemory}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t&&(t.isVisible?(this._visibleObjects.delete(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e))}freeObject(e){this._memCache.pop(`${e.handle}`),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){for(let s=0;s<i;++s){const i=t[s];if(!i)continue;const r=e[s],o=this._lyrHandleToObjects.get(r);if(o){if(o.isVisible)continue;this._visibleGeometryChanged(),o.isVisible=!0,this._visibleObjects.add(o),this._usedMemory+=o.usedMemory,this._cacheMemory-=o.usedMemory,o.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,i),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e))}),this._memCache.pop(`${r}`)}}for(let s=0;s<i;++s){const i=e[s],r=t[s];if(r)continue;const o=this._lyrHandleToObjects.get(i);if(o){if(!o.isVisible)continue;this._visibleGeometryChanged(),o.isVisible=!1,this._visibleObjects.delete(o),this._usedMemory-=o.usedMemory,this._cacheMemory+=o.usedMemory,o.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,r),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e))}),this._memCache.put(`${i}`,o)}}}_getTexture(e,t,i,s){let r=null;if(e&&t.desc?.images&&t.data?.buffer){const o=t.desc.images[e?.imageId];if(r=i.get(o),!r&&o){const n=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,a=!!o.mipCount||n>1,l=K[e.wrapMode??"None"];let c=o.alpha?6408:6407;const d=new Uint8Array(t.data.buffer,o.data.byteOffset,o.data.byteCount);let h=null,m=null,u=null;switch(o.format){case"Raw":"R8"===o.pixelFormat?(h=d,c=6403,m=""):"Rgb8"===o.pixelFormat?(h=d,c=6407,m=""):"Rgba8"===o.pixelFormat&&(h=d,c=6408,m="");break;case"Dxt1":h=d,c=6407,m="image/vnd-ms.dds";break;case"Dxt5":h=d,c=6408,m="image/vnd-ms.dds";break;case"Basis":h=d,c=6407,m="image/ktx2";break;case"Png":m="image/png",u=document.createElement("img");break;case"Jpeg":m="image/jpeg",u=document.createElement("img");break;case"Etc2":m="image/ktx",u=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(u&&m){const e=new Blob([d],{type:m});u.src=URL.createObjectURL(e),h=u}if(h&&null!=m){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker,compressionCallback:e=>{e&&e>0&&(s.textureMemoryUsage-=e)}}:void 0;r=new ue(h,{mipmap:a,maxAnisotropy:n,encoding:m,wrap:l,pixelFormat:c,compressionOptions:e,noUnpackFlip:!0,width:o.mip0Width,height:o.mip0Height}),this._stage.addTexture(r),i.set(o,r)}}}return r?new ce(this.view.stage.renderView.textures,r.id):null}getBufferViews(e,t,i){let s,r,o,n,a,l,c,d=null;for(let m=0;m<e.atrbs.length;m++){const c=e.atrbs[m],u=c.view,p=void 0,f=u.byteOffset+u.byteCount,g=u.byteCount/Q[u.type],b=[...Array(g).keys()].map(e=>e);try{switch(c.sem){case"Position":3!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+u+")"):(s=new S(t,u.byteOffset,p,f),r=new he(s.typedBuffer,b,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 S(t,u.byteOffset,p,f),s=me(e.typedBuffer,i);a=new k(s.buffer),l=new he(a.typedBuffer,b,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 he(new P(t,u.byteOffset,p,f).typedBuffer,b,2));break;case"Color":4===u.ncomp?("F32"===u.type&&(d=new H(t,u.byteOffset,p,f)),"U8"===u.type&&(d=new E(t,u.byteOffset,p,f)),"U16"===u.type&&(d=new R(t,u.byteOffset,p,f))):3===u.ncomp&&("F32"===u.type&&(d=new S(t,u.byteOffset,p,f)),"U8"===u.type&&(d=new V(t,u.byteOffset,p,f)),"U16"===u.type&&(d=new A(t,u.byteOffset,p,f))),null==d?this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+u+")"):o=new he(d.typedBuffer,b,u.ncomp);break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+c.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":c=new I(t,i.byteOffset,s,r);break;case"U32":c=new F(t,i.byteOffset,s,r);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==c&&null!=s){const e=s.count;if(e<65535){const t=new Uint16Array(e);c=new I(t.buffer)}else{const t=new Uint32Array(e);c=new F(t.buffer)}for(let t=0;t<e;t++)c.set(t,t)}return{positionView:s,positionAttr:r,colorAttr:o,texCoord0Attr:n,indicesView:c,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.toArray(),r),"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([l({type:[D]})],Ce.prototype,"_modifications",void 0),e([l()],Ce.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([l()],Ce.prototype,"layer",void 0),e([l({readOnly:!0})],Ce.prototype,"visibleAtCurrentScale",null),e([l()],Ce.prototype,"elevationOffset",null),Ce=e([c("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Ce);const Me=Ce,Oe=j();function Te(e,t){const i=se(e);return b(Oe,i.center,t),i.center=Oe,i}function Ue(e){return e?new ie(e.center,e.halfSize,f(...e.quaternion)):null}export{Me 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{__decorate as e}from"tslib";import t from"../../../Graphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import{result as r,forEach as s}from"../../../core/asyncUtils.js";import"../../../core/has.js";import o from"../../../core/Logger.js";import{destroyMaybe as n,abortMaybe as a}from"../../../core/maybe.js";import{estimateNumberArrayMemory as d,baseObjectMemory as l,estimateNumberMemory as u,estimateFixedArrayMemory as h,baseArrayMemory as p}from"../../../core/memoryEstimations.js";import{isAbortError as c,allSettledValues as _,throwIfAborted as m}from"../../../core/promiseUtils.js";import{initial as g,watch as f,sync as y,syncAndInitial as b}from"../../../core/reactiveUtils.js";import{pt2px as w}from"../../../core/screenUtils.js";import{isArrayBuffer as P}from"../../../core/typedArrayUtil.js";import{property as N}from"../../../core/accessorSupport/decorators/property.js";import{subclass as v}from"../../../core/accessorSupport/decorators/subclass.js";import{b as x,g as C,f as S,d as I}from"../../../chunks/vec32.js";import{clone as A}from"../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{fromValues as R}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import j from"../../../geometry/Extent.js";import k from"../../../geometry/Point.js";import{projectBoundingSphere as V}from"../../../geometry/projection/projectBoundingSphere.js";import{projectVectorToVector as Q}from"../../../geometry/projection/projectVectorToVector.js";import{create as F,fromMinMax as L}from"../../../geometry/support/aaBoundingBox.js";import{fromNormalAndOffset as D,create as E}from"../../../geometry/support/plane.js";import{f as O}from"../../../chunks/sphere.js";import U from"../../../layers/graphics/OptimizedGeometry.js";import{QueryEngine as q}from"../../../layers/graphics/data/QueryEngine.js";import{CodedValue as M}from"../../../layers/support/CodedValue.js";import W from"../../../layers/support/CodedValueDomain.js";import"../../../layers/support/Domain.js";import"../../../layers/support/InheritedDomain.js";import"../../../layers/support/RangeDomain.js";import{unpackFieldNames as G}from"../../../layers/support/fieldUtils.js";import z from"../../../rest/support/FeatureSet.js";import H from"../../../rest/support/Query.js";import{getElevationOffset as B}from"../../../support/elevationInfoUtils.js";import{LayerView3D as T}from"./LayerView3D.js";import{PointCloudLayerViewPerformanceInfo as $,QueuePerformanceInfo as J}from"./PointCloudLayerViewPerformanceInfo.js";import{PointCloudWorkerHandle as K}from"./PointCloudWorkerHandle.js";import{I3SQueryFeatureStore as Z}from"./i3s/I3SQueryFeatureStore.js";import{checkPointCloudLayerValid as Y,checkPointCloudLayerCompatibleWithView as X}from"./i3s/I3SUtil.js";import{nodeDiff as ee,sortFrontToBack as te,splitWorkEntries as ie}from"./i3s/LoDUtil.js";import{PagedNodeIndex as re}from"./i3s/PagedNodeIndex.js";import{PointCloudGraphic as se}from"./i3s/PointCloudGraphic.js";import{PointCloudRenderer as oe}from"./i3s/PointCloudRenderer.js";import{isPointRendererNode as ne,PointCloudRendererNode as ae}from"./i3s/PointCloudRendererNode.js";import{getSplatSizeAlgorithm as de,getFixedSizeAlgorithm as le,getRendererInfo as ue,getFilterInfo as he,rendererUsesFixedSizes as pe,getAttributeInfo as ce}from"./i3s/PointCloudRendererUtil.js";import{getAttributeValues as _e,readGeometry as me,elevationFromPositions as ge}from"./i3s/PointCloudWorkerUtil.js";import{normalizeHighlightTarget as fe,emptyHighlightHandle as ye}from"./support/highlightUtils.js";import{PopupSceneLayerView as be}from"./support/PopupSceneLayerView.js";import{projectToBoundingBox as we}from"../support/extentUtils.js";import{computeMapPointFromVec3d as Pe}from"../support/hitTest.js";import{Obb as Ne}from"../support/orientedBoundingBox.js";import{updatingProgress as ve}from"../support/updatingProperties.js";import xe from"../../layers/LayerView.js";import{PointCloudLayerView as Ce}from"../../layers/PointCloudLayerView.js";import{getHighlightName as Se}from"../../support/highlightOptionsUtils.js";import{isInEffectiveScaleRange as Ie}from"../../support/layerViewUtils.js";import{PromiseQueue as Ae}from"../../support/PromiseQueue.js";import{TaskPriority as Re}from"../../support/Scheduler.js";const je=8,ke=E();let Ve=class extends(Ce(be(T(xe)))){constructor(){super(...arguments),this.type="point-cloud-3d",this.maximumPointCount=4e6,this.slicePlaneEnabled=!1,this._renderer=null,this._rendererAdded=!1,this._renderedNodes=new Set,this._updateViewNeeded=!0,this._lodFactor=1,this._maxLoggedBoxWarnings=5,this._pageMultiplier=1,this._nodeLoadEpoch=0,this._indexQueue=[],this._workQueue=new Array,this._idleQueue=new Ae,this._indexPagesLoading=new Map,this._loadingNodes=new Map,this._recalcWork=!0,this._layerIsVisible=!1,this._codedDomainPopulationPromise=null,this._codedDomainPopulationAbortController=null,this._totalWork=0,this._index=null,this._loadingInitNodePage=!1,this._nodeIdArray=[],this.ignoresMemoryFactor=!1}get baseUrl(){return this.layer.parsedUrl?.path??""}get pointScale(){const e=de(this.layer?.renderer),t=1;return null!=e?.scaleFactor?e.scaleFactor:t}get useRealWorldSymbolSizes(){const e=le(this.layer?.renderer),t=!1;return null!=e?.useRealWorldSymbolSizes?e.useRealWorldSymbolSizes:t}get pointSize(){const e=le(this.layer?.renderer),t=0;return null!=e?.size?e.size:t}get inverseDensity(){const e=96;return this.layer?.renderer?1*e/this.layer.renderer.pointsPerInch:5}get availableFields(){const e=ue(this.layer),t=new Set;e.primaryAttribute&&t.add(e.primaryAttribute.name),e.modulationAttribute&&t.add(e.modulationAttribute.name);const i=he(this.layer);if(i)for(const r of i)r.attributeInfo&&t.add(r.attributeInfo.name);if(this.layer.outFields)for(const r of G(this.layer.fieldsIndex,this.layer.outFields))t.add(r);return Array.from(t)}get _clippingBox(){if(!this.view||!this.view.clippingArea)return null;const e=F(),t=this.view.renderSpatialReference;return we(this.view.clippingArea,e,t)?e:null}get _elevationOffset(){const e=this.layer&&this.layer.elevationInfo;return e&&"absolute-height"===e.mode?B(e,this.layer.spatialReference):0}get _graphicOrigin(){return this.layer.graphicOrigin}initialize(){const e=this.view.resourceController,t=Ee(e);this._worker=new K(t),this.addResolvingPromise(this._worker.promise),Y(this.layer),X(this.layer,this.view),this._indexRequester=e.createStreamDataRequester(2),this._dataRequester=e.createStreamDataRequester(3),this._initRenderer();const i=this._initNodePages(),r=this.view.resourceController.memoryController;this._memCache=r.newCache(`pcl-${this.layer.uid}`),this._queryFeaturesCache=r.newCache(`pcl-query-features-${this.layer.uid};`),this._updatingHandles.add(()=>this._clippingBox,()=>this._setUpdateViewNeeded(),g),this._updatingHandles.add(()=>this._elevationOffset,()=>this._elevationOffsetChanged(),g),this._updatingHandles.add(()=>this.layer.renderer,()=>this._rendererChanged(),g),this._updatingHandles.add(()=>this.layer.filters,()=>this._reload(),g),this._updatingHandles.add(()=>this.layer.outFields,()=>this._reload(),g),this._updatingHandles.add(()=>this.layer.effectiveScaleRange,()=>this._setUpdateViewNeeded()),this._updatingHandles.add(()=>this.view.state.contentCamera,()=>this._setUpdateViewNeeded()),this.addHandles([f(()=>this.view.quality,()=>this._setUpdateViewNeeded(),y)]),this.addResolvingPromise(i),this.when(()=>{this.addHandles([e.scheduler.registerTask(Re.POINT_CLOUD_LAYER,this),f(()=>2===this.view.state.mode,()=>this._setUpdateViewNeeded(),b),this._updatingHandles.add(()=>this.suspended,e=>{e?this._clearNodeState():this._setUpdateViewNeeded()},g)])},()=>{this._updatingHandles.removeAll(),this.removeAllHandles()})}_setUpdateViewNeeded(){this._updateViewNeeded=!0,this._updateLoading()}destroy(){this.cancelLoading(),this._worker=n(this._worker),this._destroyRenderer(),this._memCache=n(this._memCache),this._queryFeaturesCache=n(this._queryFeaturesCache),this._queryEngine=n(this._queryEngine),this._codedDomainPopulationAbortController=a(this._codedDomainPopulationAbortController),this._codedDomainPopulationPromise=null}_initRenderer(){this._renderer=new oe({createGraphic:(e,t,i)=>this._createGraphic(e,t,i)}),this._renderer.layerViewUid=this.uid,this._updatingHandles.add(()=>this._clippingBox,e=>this._renderer.clippingBox=e,g),this._updatingHandles.add(()=>this.suspended,e=>this._setPointsVisible(!e),g),this._updatingHandles.add(()=>this.pointScale,e=>this._renderer.scaleFactor=e,g),this._renderer.minSizePx=Math.sqrt(2),this._updatingHandles.add(()=>this.useRealWorldSymbolSizes,e=>this._renderer.useRealWorldSymbolSizes=e,g),this._updatingHandles.add(()=>this.pointSize,e=>{const t=w(e);this._renderer.size=e,this._renderer.sizePx=t},g),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._renderer.slicePlaneEnabled=e,g),this._updatingHandles.add(()=>this.inverseDensity,()=>this._setUpdateViewNeeded(),g),this._updatingHandles.add(()=>this.maximumPointCount,()=>this._setUpdateViewNeeded(),g),this._updatingHandles.add(()=>this.view.qualitySettings.sceneService.pointCloud.lodFactor,e=>{this._lodFactor=e,this._setUpdateViewNeeded()},g)}_destroyRenderer(){this._renderer.removeAll(),this._setPointsVisible(!1)}_createGraphic(e,t,i,r){const s=null!=e.pointIdFilterMap?e.pointIdFilterMap[t]:t,o=i?"declaredClass"in i?i:Pe(this.view,i):null;return r??=this._createGraphicAttributes(e,s),new se({pointCloudMetadata:{nodeId:e.id,pointIndexInNode:t,attributePointIndexInNode:s,epoch:this._nodeLoadEpoch},geometry:o,attributes:r,layer:this.layer,sourceLayer:this.layer,origin:this._graphicOrigin})}_createGraphicAttributes(e,t){const i={};for(const r of e.attributes)this._encodeGraphicAttribute(r.attributeInfo,r.values,t,i);return i}_getGraphicAttribute(e,t,i){const r=e.storageInfo?.attributeValues,s=r?.valuesPerElement??1;if(1===s)return t[i];if("UInt8"===r?.valueType&&s<=4){let e=0;const r=i*s;for(let i=r;i<r+s;i++)e=(e<<8)+t[i];return e}}_encodeGraphicAttribute(e,t,i,r){r[e.name]=this._getGraphicAttribute(e,t,i)}_setPointsVisible(e){e&&!this._rendererAdded?(this.view.stage.addRenderPlugin(this._renderer),this._rendererAdded=!0):!e&&this._rendererAdded&&(this.view.stage.removeRenderPlugin(this._renderer),this._rendererAdded=!1)}_rendererChanged(){this._renderer.useFixedSizes=pe(this.layer.renderer),this._reload()}_reload(){this._clearNodeState(),this._memCache.clear(),this._setUpdateViewNeeded()}_elevationOffsetChanged(){this._clearNodeState(),this._memCache.clear(),this._initNodePages()}_displayNodes(e){this._workQueue=ee([...this._renderedNodes],e,this._index),te(this._workQueue,this.view.state.contentCamera.viewForward,this._index),ie(this._workQueue,je,this._index),this._updateQueues(),this._totalWork=this._computeWork(),this._updateLoading(),this._layerIsVisible=e.length>0||this._loadingInitNodePage,this.notifyChange("suspended")}cancelLoading(){this._cancelNodeLoading(),this._cancelIndexLoading()}_cancelNodeLoading(){const e=new Array;this._loadingNodes.forEach(({abortController:t})=>e.push(t)),this._loadingNodes.clear();for(const t of e)t.abort();this._workQueue=[],this._idleQueue.cancelAll(),this._totalWork=this._computeWork(),this._updateLoading()}_updateQueues(){const e=new Set;this._workQueue.forEach(t=>t.load.forEach(t=>e.add(t)));const t=new Array,i=new Map;this._loadingNodes.forEach((r,s)=>{e.has(s)?i.set(s,r):t.push(r)}),this._loadingNodes=i;for(const{abortController:r}of t)r.abort();this._workQueue=this._workQueue.filter(e=>{for(const t of e.load)if(this._loadingNodes.has(t))return this._recalcWork=!0,!1;return!0}),this._totalWork=this._computeWork(),this._updateLoading()}_cancelIndexLoading(){this._indexQueue=[],this._indexPagesLoading.forEach(({abortController:e})=>e.abort()),this._indexPagesLoading.clear(),this._totalWork=this._computeWork(),this._updateLoading()}_clearNodeState(){this._nodeLoadEpoch++,this._renderedNodes.forEach(e=>this._removeFromRenderer(e)),this._cancelNodeLoading()}get readyToRun(){return this.suspended?this._updateViewNeeded:this._updateViewNeeded||this._indexQueue.length>0||this._workQueue.length>0||this._idleQueue.readyToRun}runTask(e){if(this.suspended){if(this._updateViewNeeded){this._updateViewNeeded=!1;const e=this._isRootNodeVisible();e!==this._layerIsVisible&&(this._layerIsVisible=e,this.notifyChange("suspended")),this._updateLoading()}}else{for(e.run(()=>this._updateWorkQueues());this._indexQueue.length>0&&e.run(()=>this._processIndexQueue()););this._processWorkQueue(e),this._idleQueue.runTask(e)}}_processIndexQueue(){const e=this._indexQueue.shift(),t=this._loadNodePage(e);return this._indexPagesLoading.set(e,t),t.promise.then(t=>{this._index.addPage(e,t,this._elevationOffset),this._setUpdateViewNeeded()}).then(()=>{this._indexPagesLoading.delete(e)},()=>{this._indexPagesLoading.delete(e)}),!0}_processWorkQueue(e){for(;!e.done;){const t=this._scheduleWorkEntry();if(null==t)return void e.madeProgress();this._processWorkEntry(t),e.madeProgress()}}_scheduleWorkEntry(){let e=this._workQueue.length;for(;e--;){const e=this._workQueue.shift();if(!e.remove.find(e=>!this._renderedNodes.has(e)))return e;this._workQueue.push(e)}return null}_processWorkEntry(e){if(0!==e.load.length)Promise.all(e.load.map(e=>{const t=new AbortController,i=this._memCache.pop(e.toString());return null!=i?this._loadingNodes.set(e,{abortController:t,promise:Promise.resolve(i)}):this._loadingNodes.has(e)||this._loadingNodes.set(e,{abortController:t,promise:this._loadNode(e,t.signal)}),this._loadingNodes.get(e).promise})).then(t=>{for(let i=0;i<e.load.length;i++)if(t[i]){const r=this._setupRendererData(e.load[i],t[i]);this._addToRenderer(r)}for(const i of e.remove)this._removeFromRenderer(i)}).catch(()=>{}).then(()=>{for(const t of e.load)this._loadingNodes.delete(t);this._updateLoading(),this._recalcWork&&!this._idleQueue.updating&&0===this._indexQueue.length&&0===this._loadingNodes.size&&(this._recalcWork=!1,this._setUpdateViewNeeded())}),this._updateLoading();else for(const t of e.remove)this._removeFromRenderer(t)}async _populateClassCodeCodedDomain(e,t){const i="CLASS_CODE",s=this.layer.fieldsIndex.get(i);if(!s||s.domain)return;if(!e.includes(s.name))return;const o=await r(this.layer.queryCachedStatistics(i,{signal:t}));if(!1===o.ok)return;const n=o.value?.stats?.labels?.labels;n&&Array.isArray(n)&&(s.domain=new W({name:"CLASS_CODE",codedValues:n.map(e=>new M({code:e.value,name:e.label}))}))}async prepareFetchPopupFeatures(e){return this._codedDomainPopulationPromise||(this._codedDomainPopulationAbortController=new AbortController,this._codedDomainPopulationPromise=this._populateClassCodeCodedDomain(e,this._codedDomainPopulationAbortController.signal).then(()=>{this._codedDomainPopulationAbortController=null})),this._codedDomainPopulationPromise}async whenGraphicAttributes(e,t){const r=this._splitGraphicsPerNode(e),o=this.layer.attributeStorageInfo,n=t.map(e=>ce(o,e)).filter(i),a=async(e,t)=>{const i=this._index.getNode(t);await s(n,async t=>{const r=t.useElevation?await this._loadElevationAttributeFromGeometry(i.resourceId):await this._loadAndParseAttribute(i,t);if(r)for(const i of e)if(this._isValidPointGraphic(i)){const e=i.pointCloudMetadata.attributePointIndexInNode;this._encodeGraphicAttribute(t,r,e,i.attributes)}})},d=[];return r.forEach((e,t)=>{d.push(a(e,t))}),await Promise.allSettled(d),e}_isValidPointGraphic(e){return e instanceof se&&e.pointCloudMetadata?.epoch===this._nodeLoadEpoch}_splitGraphicsPerNode(e){const t=new Map;for(const i of e){if(!this._isValidPointGraphic(i))continue;const e=i.pointCloudMetadata,r=t.get(e.nodeId);r?r.push(i):t.set(e.nodeId,[i])}return t}async _loadAndParseAttribute(e,t){const i=await this._loadAttribute(e.resourceId,t,null);return i?_e({attributeInfo:t,buffer:i},null,e.vertexCount):null}async _loadElevationAttributeFromGeometry(e){const t=this.layer.store.defaultGeometrySchema,i=me(t,await this._loadGeometry(e,null));return ge(i,i.length/3)}highlight(e,i){const r=fe(e);if(0===r.length)return ye;if(!(r[0]instanceof t))return ye;const s=r;return this._renderer.highlight(s.map(e=>this._graphicToPointDefinition(e)),Se(i))}_graphicToPointDefinition(e){if(!this._isValidPointGraphic(e))return null;const{nodeId:t,pointIndexInNode:i}=e.pointCloudMetadata;return null!=t&&null!=i?{nodeId:t,pointId:i}:null}_computeWork(){let e=0;for(const t of this._workQueue)e+=t.load.length+t.remove.length;return e+=this._loadingNodes.size,e+=(this._indexQueue.length+this._indexPagesLoading.size)*this._index.pageSize,e+=this._loadingInitNodePage?100:0,e+=this._updateViewNeeded?100:0,e}get updatingProgressValue(){if(this.suspended)return this._updateViewNeeded?0:1;const e=this._computeWork();return 1-Math.min(this._totalWork,e)/this._totalWork}_updateLoading(){this.notifyChange("updating"),this.notifyChange("updatingProgressValue")}canResume(){return super.canResume()&&this._layerIsVisible}isUpdating(){return this.suspended?this._updateViewNeeded:this._computeWork()>0}get visibleAtCurrentScale(){return Ie(this.layer.effectiveScaleRange,this.view.scale)}async queryFeatures(e,i){const r=await this._ensureQueryEngine().executeQuery(this._ensureQueryJSON(e),i?.signal),s=r.features;r.features=[];const o=z.fromJSON(r),n=this.view.spatialReference;return o.features=s.map(e=>{const{attributes:i,metadata:r}=e;if(!r){const i=t.fromJSON(e);return i.geometry&&(i.geometry.spatialReference=o.spatialReference??n),i.layer=this.layer,i.sourceLayer=this.layer,i.origin=this._graphicOrigin,i}const s=e.geometry?k.fromJSON(e.geometry):void 0;return s&&(s.spatialReference=o.spatialReference??n),this._createGraphic(r.node,r.pointId,s,i)}),o}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference,returnZ:!0};return new H(e)}async queryFeatureCount(e,t){return await this._ensureQueryEngine().executeQueryForCount(this._ensureQueryJSON(e),t?.signal)}async queryExtent(e,t){const{count:i,extent:r}=await this._ensureQueryEngine().executeQueryForExtent(this._ensureQueryJSON(e),t?.signal);return{count:i,extent:j.fromJSON(r)}}_ensureQueryJSON(e){return null==e?new H({outSpatialReference:this.view.spatialReference}).toJSON():H.from(e).toJSON()}_ensureQueryEngine(){if(this._queryEngine)return this._queryEngine;const{spatialReference:e}=this.view;return this._queryEngine=new q({fieldsIndex:this.layer.fieldsIndex.toJSON(),geometryType:"esriGeometryPoint",spatialReference:e,featureIdInfo:{type:"object-id",fieldName:"objectId"},hasZ:!0,featureStore:new Z({sourceSpatialReference:e,viewSpatialReference:e,forAllFeatures:(e,t)=>{let i=!1;this._renderer.forEachNode(r=>{if(i)return;if(t){const e=r.obb,s=O(e.center[0],e.center[1],e.center[2],x(e.halfSize));V(s,this.view.renderSpatialReference,s,this.view.spatialReference);const o=t(s);if(2===o)return;if(i=0===o,i)return}let s=this._queryFeaturesCache.get(`${r.id}`);s||(s=this._createQueryPointFeatures(r),this._queryFeaturesCache.put(`${r.id}`,s)),s.features.forEach(e)})},getFeatureExtent:({point:e},t)=>L(e,e,t),featureAdapter:{cloneWithGeometry:(e,t)=>new Fe(e.node,e.pointId,t.coords),getAttribute:({node:e,attributePointId:t},i)=>{for(const r of e.attributes)if(r.attributeInfo.name===i)return this._getGraphicAttribute(r.attributeInfo,r.values,t)},getAttributes:({node:e,attributePointId:t})=>this._createGraphicAttributes(e,t),getCentroid:e=>e.getGeometry(),getGeometry:e=>e.getGeometry(),getObjectId:()=>{},getMetadata:e=>e}})}),this._queryEngine}_createQueryPointFeatures(e){const t=e.coordinates,i=new Array;for(let r=0;r<t.length/3;r++){const s=3*r,o=R(t[s+0],t[s+1],t[s+2]);C(o,o,e.origin),Q(o,this.view.renderSpatialReference,o,this.view.spatialReference);const n=new Fe(e,r,o);i.push(n)}return new Le(i)}_initNodePages(){const e=this.layer.store.index,t=e.nodesPerPage||e.nodePerIndexBlock;return this._index=new re(this.layer.spatialReference,this.view.renderCoordsHelper.spatialReference,t),this._cancelIndexLoading(),this._traverseVisible=this._index.createVisibilityTraverse(),this._loadingInitNodePage=!0,this._layerIsVisible=!0,this.notifyChange("suspended"),this._updateLoading(),this._pageMultiplier=null!=e.nodesPerPage?1:e.nodePerIndexBlock,this._loadNodePage(0).promise.then(e=>{this._index.addPage(0,e,this._elevationOffset),this._loadingInitNodePage=!1,this._setUpdateViewNeeded()})}_loadNodePage(e){const t=new AbortController,i=`${this.baseUrl}/nodepages/${e*this._pageMultiplier}`;return{promise:this._requestNodePage(i,t.signal).then(t=>t.nodes.map((t,i)=>({resourceId:null!=t.resourceId?t.resourceId:e*this._index.pageSize+i,obb:Ne.fromJSON(t.obb),obbInRenderSR:new Ne,firstChild:t.firstChild,childCount:t.childCount,vertexCount:t.vertexCount??t.pointCount,lodThreshold:t.lodThreshold??t.effectiveArea}))),abortController:t}}_updateWorkQueues(){if(!this._updateViewNeeded)return!1;const e=this.view.quality;let t=this.inverseDensity/this._lodFactor*e;const i=this.maximumPointCount*this._lodFactor*e;let r=this._computeNodesForMinimumDensity(t),s=this._computePointCount(r),o=Math.sqrt(s/(.75*i));for(;s>i;)t*=o,r=this._computeNodesForMinimumDensity(t),s=this._computePointCount(r),o=Math.sqrt(2);return this._displayNodes(r),this._updateViewNeeded=!1,this._updateLoading(),!0}_computePointCount(e){let t=0;for(let i=0;i<e.length;i++){const r=this._index.getNode(e[i]);r&&(t+=r.vertexCount)}return t}_isRootNodeVisible(){let e=!1;return this._traverseVisible({frustum:this.view.state.contentCamera.frustum,clippingBox:this._clippingBox},{predicate:(t,i,r)=>(e=r,!1),pageMiss:()=>{}}),e}_computeNodesForMinimumDensity(e){const t=this.view.state.contentCamera,i=t.frustum,r=this._clippingBox,s=t.viewForward,o=S(s,t.eye),n=D(s,-o,ke),a=t.perScreenPixelRatio/2,d=e*e,l=this._nodeIdArray;l.length=0;const u=e=>l.push(e);return this._traverseVisible({frustum:i,clippingBox:r},{predicate:(e,t,i)=>{if(!i)return!1;if(0===t.childCount)return u(e),!1;const r=this._index.getRenderObb(e);return!(this._computeAveragePixelArea(r,t.lodThreshold,t.vertexCount,n,a)<=d)||(u(e),!1)},pageMiss:(e,t)=>{u(e),this._indexQueue.includes(t)||this._indexQueue.push(t)}}),l}_computeAveragePixelArea(e,t,i,r,s){const o=1e-7,n=Math.max(o,e.minimumDistancePlane(r));return t/(n*n)/(4*s*s)/i}_loadNode(e,t){try{return this._loadNodeAsync(e,t)}catch(i){throw c(i)||o.getLogger(this).error(i),i}}async _loadAdditionalUserAttributes(e,t,r){const s=this.layer.outFields;if(!s)return[];const o=G(this.layer.fieldsIndex,s),n=new Set(e.map(e=>null!=e?e.name:null)),a=this.layer.attributeStorageInfo,d=[];for(const i of o){if(n.has(i))continue;const e=ce(a,i);e&&d.push(t(e))}const l=await _(d);return m(r),l.filter(i)}async _loadNodeAsync(e,t){const i=this._index.getNode(e),r=ue(this.layer),s=he(this.layer),o=i.resourceId,n=async e=>{if(!e)return null;if(e.useElevation)return{attributeInfo:e,buffer:null};const i=await this._loadAttribute(o,e,t);return null!=i?{attributeInfo:e,buffer:i}:null};return this._idleQueue.push(async()=>{const i=this._loadGeometry(o,t),{primaryAttribute:a,modulationAttribute:d}=r,l=n(a),u=n(d),h=s.map(e=>e.attributeInfo),p=h.map(e=>n(e)),c=this._loadAdditionalUserAttributes([a,d,...h],n,t),[_,g,f,y,b]=await Promise.all([i,l,u,Promise.all(p),c]);m(t);const w={geometryBuffer:_,primaryAttributeData:g,modulationAttributeData:f,filterAttributesData:y,userAttributesData:b,schema:this.layer.store.defaultGeometrySchema,rendererInfo:r,filterInfo:s,obbData:this._index.getRenderObb(e).data,elevationOffset:this._elevationOffset,inSR:this.layer.spatialReference.toJSON(),outSR:this.view.renderCoordsHelper.spatialReference.toJSON()};return this._worker.invoke(w,t)},t)}async _loadGeometry(e,t){return this._requestData(`${this.baseUrl}/nodes/${e}/geometries/0`,t)}async _loadAttribute(e,t,i){if(!t?.storageInfo)return null;const r=t.storageInfo.key;return this._requestData(`${this.baseUrl}/nodes/${e}/attributes/${r}`,i)}_requestNodePage(e,t){const i={f:"json",...this.layer.customParameters,token:this.layer.apiKey};return this._indexRequester.request(e,0,{query:i,signal:t})}_requestData(e,t){return this._dataRequester.request(e,1,{query:{...this.layer.customParameters,token:this.layer.apiKey},signal:t})}_removeFromRenderer(e){if(this._renderedNodes.has(e)){const t=this._renderer.removeNode(e);this._renderedNodes.delete(e),this._memCache.put(t.id.toString(),t)}}_addToRenderer(e){this._renderedNodes.has(e.id)||(this._renderedNodes.add(e.id),this._renderer.addNode(e))}_setupRendererData(e,t){const i=this._index.getNode(e),r=Math.sqrt(i.lodThreshold/i.vertexCount),s=this._index.getRenderObb(e);if(ne(t))return t.splatSize=r,t.obb=s,I(t.origin,t.obb.center),t;const n=Ne.fromData(t.obbData),a=n.halfSize,d=s.halfSize,l=.01*Math.max(d[0],d[1],d[2]);if(a[0]>d[0]+l||a[1]>d[1]+l||a[2]>d[2]+l){if(this._maxLoggedBoxWarnings>0){const t=e=>`[${e.halfSize[0]}, ${e.halfSize[1]}, ${e.halfSize[2]}]`;o.getLogger(this).warn(`Node ${e} reported bounding box too small. got ${t(s)} but points cover ${t(n)}`),0===--this._maxLoggedBoxWarnings&&o.getLogger(this).warn(" Too many bounding box errors, stopping reporting for this layer.")}this._index.setRenderObb(e,n)}return new ae(e,r,A(s.center),s,0===i.childCount,t.points,t.rgb,t.attributes,t.pointIdFilterMap)}get usedMemory(){let e=0;return this._renderer.forEachNode(t=>{e+=De,e+=d(t.coordinates);for(const i of t.attributes){const t=i.values;P(t.buffer)&&(e+=d(t))}}),e}get unloadedMemory(){const e=this._renderedNodes.size;if(e<4)return 0;const t=[...this._renderedNodes].reduce((e,t)=>e+this._index.getNode(t).vertexCount);let i=this._loadingNodes.size;for(let r=0;r<this._workQueue.length;r++)i+=this._workQueue[r].load.length,i-=this._workQueue[r].remove.length;if(i<0)return 0;return i*t/e*((this.usedMemory-e*De)/t)+i*De}get performanceInfo(){return new $(this.usedMemory,this._renderedNodes.size,[...this._renderedNodes].reduce((e,t)=>e+this._index.getNode(t).vertexCount,0),this.maximumPointCount,new J(this._loadingNodes.size,this._indexQueue.length,this._workQueue.length,this._idleQueue.length))}get test(){}};e([N()],Ve.prototype,"layer",void 0),e([N()],Ve.prototype,"baseUrl",null),e([N()],Ve.prototype,"pointScale",null),e([N()],Ve.prototype,"useRealWorldSymbolSizes",null),e([N()],Ve.prototype,"pointSize",null),e([N()],Ve.prototype,"inverseDensity",null),e([N()],Ve.prototype,"maximumPointCount",void 0),e([N({readOnly:!0})],Ve.prototype,"availableFields",null),e([N({readOnly:!0})],Ve.prototype,"_clippingBox",null),e([N({readOnly:!0})],Ve.prototype,"_elevationOffset",null),e([N({type:Boolean})],Ve.prototype,"slicePlaneEnabled",void 0),e([N()],Ve.prototype,"_graphicOrigin",null),e([N()],Ve.prototype,"updating",void 0),e([N(ve)],Ve.prototype,"updatingProgress",void 0),e([N({readOnly:!0})],Ve.prototype,"updatingProgressValue",null),e([N({readOnly:!0})],Ve.prototype,"visibleAtCurrentScale",null),Ve=e([v("esri.views.3d.layers.PointCloudLayerView3D")],Ve);const Qe=Ve;class Fe{constructor(e,t,i){this.node=e,this.pointId=t,this.point=i}getGeometry(){return new U([1],Array.from(this.point))}get attributePointId(){const{node:e,pointId:t}=this;return null!=e.pointIdFilterMap?e.pointIdFilterMap[t]:t}get usedMemory(){return l+l+u+h(this.point,u)}}class Le{constructor(e){this.features=e}get usedMemory(){return this.features.reduce((e,t)=>e+t.usedMemory,l+p)}}const De=160;function Ee(e){return t=>e.immediate.schedule(t)}export{Qe as default};
5
+ import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import{result as r,forEach as s}from"../../../core/asyncUtils.js";import"../../../core/has.js";import o from"../../../core/Logger.js";import{destroyMaybe as n,abortMaybe as a}from"../../../core/maybe.js";import{estimateNumberArrayMemory as d,baseObjectMemory as l,estimateNumberMemory as u,estimateFixedArrayMemory as h,baseArrayMemory as p}from"../../../core/memoryEstimations.js";import{isAbortError as c,allSettledValues as _,throwIfAborted as m}from"../../../core/promiseUtils.js";import{initial as g,watch as f,sync as y,syncAndInitial as b}from"../../../core/reactiveUtils.js";import{pt2px as w}from"../../../core/screenUtils.js";import{isArrayBuffer as P}from"../../../core/typedArrayUtil.js";import{property as N}from"../../../core/accessorSupport/decorators/property.js";import{subclass as v}from"../../../core/accessorSupport/decorators/subclass.js";import{b as x,g as C,f as S,d as I}from"../../../chunks/vec32.js";import{clone as A}from"../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{fromValues as R}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import j from"../../../geometry/Extent.js";import k from"../../../geometry/Point.js";import{projectBoundingSphere as V}from"../../../geometry/projection/projectBoundingSphere.js";import{projectVectorToVector as Q}from"../../../geometry/projection/projectVectorToVector.js";import{create as F,fromMinMax as L}from"../../../geometry/support/aaBoundingBox.js";import{fromNormalAndOffset as D,create as E}from"../../../geometry/support/plane.js";import{f as O}from"../../../chunks/sphere.js";import U from"../../../layers/graphics/OptimizedGeometry.js";import{QueryEngine as q}from"../../../layers/graphics/data/QueryEngine.js";import{CodedValue as M}from"../../../layers/support/CodedValue.js";import W from"../../../layers/support/CodedValueDomain.js";import"../../../layers/support/Domain.js";import"../../../layers/support/InheritedDomain.js";import"../../../layers/support/RangeDomain.js";import{unpackFieldNames as G}from"../../../layers/support/fieldUtils.js";import z from"../../../rest/support/FeatureSet.js";import H from"../../../rest/support/Query.js";import{getElevationOffset as B}from"../../../support/elevationInfoUtils.js";import{LayerView3D as T}from"./LayerView3D.js";import{PointCloudLayerViewPerformanceInfo as $,QueuePerformanceInfo as J}from"./PointCloudLayerViewPerformanceInfo.js";import{PointCloudWorkerHandle as K}from"./PointCloudWorkerHandle.js";import{I3SQueryFeatureStore as Z}from"./i3s/I3SQueryFeatureStore.js";import{checkPointCloudLayerValid as Y,checkPointCloudLayerCompatibleWithView as X}from"./i3s/I3SUtil.js";import{nodeDiff as ee,sortFrontToBack as te,splitWorkEntries as ie}from"./i3s/LoDUtil.js";import{PagedNodeIndex as re}from"./i3s/PagedNodeIndex.js";import{PointCloudGraphic as se}from"./i3s/PointCloudGraphic.js";import{PointCloudRenderer as oe}from"./i3s/PointCloudRenderer.js";import{isPointRendererNode as ne,PointCloudRendererNode as ae}from"./i3s/PointCloudRendererNode.js";import{getSplatSizeAlgorithm as de,getFixedSizeAlgorithm as le,getRendererInfo as ue,getFilterInfo as he,rendererUsesFixedSizes as pe,getAttributeInfo as ce}from"./i3s/PointCloudRendererUtil.js";import{getAttributeValues as _e,readGeometry as me,elevationFromPositions as ge}from"./i3s/PointCloudWorkerUtil.js";import{normalizeHighlightTarget as fe,emptyHighlightHandle as ye}from"./support/highlightUtils.js";import{PopupSceneLayerView as be}from"./support/PopupSceneLayerView.js";import{projectToBoundingBox as we}from"../support/extentUtils.js";import{computeMapPointFromVec3d as Pe}from"../support/hitTest.js";import{Obb as Ne}from"../support/orientedBoundingBox.js";import{updatingProgress as ve}from"../support/updatingProperties.js";import xe from"../../layers/LayerView.js";import{PointCloudLayerView as Ce}from"../../layers/PointCloudLayerView.js";import{getHighlightName as Se}from"../../support/highlightOptionsUtils.js";import{isInEffectiveScaleRange as Ie}from"../../support/layerViewUtils.js";import{PromiseQueue as Ae}from"../../support/PromiseQueue.js";import{TaskPriority as Re}from"../../support/Scheduler.js";const je=8,ke=E();let Ve=class extends(Ce(be(T(xe)))){constructor(){super(...arguments),this.type="point-cloud-3d",this.maximumPointCount=4e6,this.slicePlaneEnabled=!1,this._renderer=null,this._rendererAdded=!1,this._renderedNodes=new Set,this._updateViewNeeded=!0,this._lodFactor=1,this._maxLoggedBoxWarnings=5,this._pageMultiplier=1,this._nodeLoadEpoch=0,this._indexQueue=[],this._workQueue=new Array,this._idleQueue=new Ae,this._indexPagesLoading=new Map,this._loadingNodes=new Map,this._recalcWork=!0,this._layerIsVisible=!1,this._codedDomainPopulationPromise=null,this._codedDomainPopulationAbortController=null,this._totalWork=0,this._index=null,this._loadingInitNodePage=!1,this._nodeIdArray=[],this.ignoresMemoryFactor=!1}get baseUrl(){return this.layer.parsedUrl?.path??""}get pointScale(){const e=de(this.layer?.renderer),t=1;return null!=e?.scaleFactor?e.scaleFactor:t}get useRealWorldSymbolSizes(){const e=le(this.layer?.renderer),t=!1;return null!=e?.useRealWorldSymbolSizes?e.useRealWorldSymbolSizes:t}get pointSize(){const e=le(this.layer?.renderer),t=0;return null!=e?.size?e.size:t}get inverseDensity(){const e=96;return this.layer?.renderer?1*e/this.layer.renderer.pointsPerInch:5}get availableFields(){const e=ue(this.layer),t=new Set;e.primaryAttribute&&t.add(e.primaryAttribute.name),e.modulationAttribute&&t.add(e.modulationAttribute.name);const i=he(this.layer);if(i)for(const r of i)r.attributeInfo&&t.add(r.attributeInfo.name);if(this.layer.outFields)for(const r of G(this.layer.fieldsIndex,this.layer.outFields))t.add(r);return Array.from(t)}get _clippingBox(){if(!this.view||!this.view.clippingArea)return null;const e=F(),t=this.view.renderSpatialReference;return we(this.view.clippingArea,e,t)?e:null}get _elevationOffset(){const e=this.layer&&this.layer.elevationInfo;return e&&"absolute-height"===e.mode?B(e,this.layer.spatialReference):0}get _graphicOrigin(){return this.layer.graphicOrigin}initialize(){const e=this.view.resourceController,t=Ee(e);this._worker=new K(t),this.addResolvingPromise(this._worker.promise),Y(this.layer),X(this.layer,this.view),this._indexRequester=e.createStreamDataRequester(2),this._dataRequester=e.createStreamDataRequester(3),this._initRenderer();const i=this._initNodePages(),r=this.view.resourceController.memoryController;this._memCache=r.newCache(`pcl-${this.layer.uid}`),this._queryFeaturesCache=r.newCache(`pcl-query-features-${this.layer.uid};`),this._updatingHandles.add(()=>this._clippingBox,()=>this._setUpdateViewNeeded(),g),this._updatingHandles.add(()=>this._elevationOffset,()=>this._elevationOffsetChanged(),g),this._updatingHandles.add(()=>this.layer.renderer,()=>this._rendererChanged(),g),this._updatingHandles.add(()=>this.layer.filters,()=>this._reload(),g),this._updatingHandles.add(()=>this.layer.outFields,()=>this._reload(),g),this._updatingHandles.add(()=>this.layer.effectiveScaleRange,()=>this._setUpdateViewNeeded()),this._updatingHandles.add(()=>this.view.state.contentCamera,()=>this._setUpdateViewNeeded()),this.addHandles([f(()=>this.view.quality,()=>this._setUpdateViewNeeded(),y)]),this.addResolvingPromise(i),this.when(()=>{this.addHandles([e.scheduler.registerTask(Re.POINT_CLOUD_LAYER,this),f(()=>2===this.view.state.mode,()=>this._setUpdateViewNeeded(),b),this._updatingHandles.add(()=>this.suspended,e=>{e?this._clearNodeState():this._setUpdateViewNeeded()},g)])},()=>{this._updatingHandles.removeAll(),this.removeAllHandles()})}_setUpdateViewNeeded(){this._updateViewNeeded=!0,this._updateLoading()}destroy(){this.cancelLoading(),this._worker=n(this._worker),this._destroyRenderer(),this._memCache=n(this._memCache),this._queryFeaturesCache=n(this._queryFeaturesCache),this._queryEngine=n(this._queryEngine),this._codedDomainPopulationAbortController=a(this._codedDomainPopulationAbortController),this._codedDomainPopulationPromise=null}_initRenderer(){this._renderer=new oe({createGraphic:(e,t,i)=>this._createGraphic(e,t,i)}),this._renderer.layerViewUid=this.uid,this._updatingHandles.add(()=>this._clippingBox,e=>this._renderer.clippingBox=e,g),this._updatingHandles.add(()=>this.suspended,e=>this._setPointsVisible(!e),g),this._updatingHandles.add(()=>this.pointScale,e=>this._renderer.scaleFactor=e,g),this._renderer.minSizePx=Math.sqrt(2),this._updatingHandles.add(()=>this.useRealWorldSymbolSizes,e=>this._renderer.useRealWorldSymbolSizes=e,g),this._updatingHandles.add(()=>this.pointSize,e=>{const t=w(e);this._renderer.size=e,this._renderer.sizePx=t},g),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._renderer.slicePlaneEnabled=e,g),this._updatingHandles.add(()=>this.inverseDensity,()=>this._setUpdateViewNeeded(),g),this._updatingHandles.add(()=>this.maximumPointCount,()=>this._setUpdateViewNeeded(),g),this._updatingHandles.add(()=>this.view.qualitySettings.sceneService.pointCloud.lodFactor,e=>{this._lodFactor=e,this._setUpdateViewNeeded()},g)}_destroyRenderer(){this._renderer.removeAll(),this._setPointsVisible(!1)}_createGraphic(e,t,i,r){const s=null!=e.pointIdFilterMap?e.pointIdFilterMap[t]:t,o=i?"declaredClass"in i?i:Pe(this.view,i):null;return r??=this._createGraphicAttributes(e,s),new se({pointCloudMetadata:{nodeId:e.id,pointIndexInNode:t,attributePointIndexInNode:s,epoch:this._nodeLoadEpoch},geometry:o,attributes:r,layer:this.layer,sourceLayer:this.layer,origin:this._graphicOrigin})}_createGraphicAttributes(e,t){const i={};for(const r of e.attributes)this._encodeGraphicAttribute(r.attributeInfo,r.values,t,i);return i}_getGraphicAttribute(e,t,i){const r=e.storageInfo?.attributeValues,s=r?.valuesPerElement??1;if(1===s)return t[i];if("UInt8"===r?.valueType&&s<=4){let e=0;const r=i*s;for(let i=r;i<r+s;i++)e=(e<<8)+t[i];return e}}_encodeGraphicAttribute(e,t,i,r){r[e.name]=this._getGraphicAttribute(e,t,i)}_setPointsVisible(e){e&&!this._rendererAdded?(this.view.stage.addRenderPlugin(this._renderer),this._rendererAdded=!0):!e&&this._rendererAdded&&(this.view.stage.removeRenderPlugin(this._renderer),this._rendererAdded=!1)}_rendererChanged(){this._renderer.useFixedSizes=pe(this.layer.renderer),this._reload()}_reload(){this._clearNodeState(),this._memCache.clear(),this._setUpdateViewNeeded()}_elevationOffsetChanged(){this._clearNodeState(),this._memCache.clear(),this._initNodePages()}_displayNodes(e){this._workQueue=ee([...this._renderedNodes],e,this._index),te(this._workQueue,this.view.state.contentCamera.viewForward,this._index),ie(this._workQueue,je,this._index),this._updateQueues(),this._totalWork=this._computeWork(),this._updateLoading(),this._layerIsVisible=e.length>0||this._loadingInitNodePage,this.notifyChange("suspended")}cancelLoading(){this._cancelNodeLoading(),this._cancelIndexLoading()}_cancelNodeLoading(){const e=new Array;this._loadingNodes.forEach(({abortController:t})=>e.push(t)),this._loadingNodes.clear();for(const t of e)t.abort();this._workQueue=[],this._idleQueue.cancelAll(),this._totalWork=this._computeWork(),this._updateLoading()}_updateQueues(){const e=new Set;this._workQueue.forEach(t=>t.load.forEach(t=>e.add(t)));const t=new Array,i=new Map;this._loadingNodes.forEach((r,s)=>{e.has(s)?i.set(s,r):t.push(r)}),this._loadingNodes=i;for(const{abortController:r}of t)r.abort();this._workQueue=this._workQueue.filter(e=>{for(const t of e.load)if(this._loadingNodes.has(t))return this._recalcWork=!0,!1;return!0}),this._totalWork=this._computeWork(),this._updateLoading()}_cancelIndexLoading(){this._indexQueue=[],this._indexPagesLoading.forEach(({abortController:e})=>e.abort()),this._indexPagesLoading.clear(),this._totalWork=this._computeWork(),this._updateLoading()}_clearNodeState(){this._nodeLoadEpoch++,this._renderedNodes.forEach(e=>this._removeFromRenderer(e)),this._cancelNodeLoading()}get readyToRun(){return this.suspended?this._updateViewNeeded:this._updateViewNeeded||this._indexQueue.length>0||this._workQueue.length>0||this._idleQueue.readyToRun}runTask(e){if(this.suspended){if(this._updateViewNeeded){this._updateViewNeeded=!1;const e=this._isRootNodeVisible();e!==this._layerIsVisible&&(this._layerIsVisible=e,this.notifyChange("suspended")),this._updateLoading()}}else{for(e.run(()=>this._updateWorkQueues());this._indexQueue.length>0&&e.run(()=>this._processIndexQueue()););this._processWorkQueue(e),this._idleQueue.runTask(e)}}_processIndexQueue(){const e=this._indexQueue.shift(),t=this._loadNodePage(e);return this._indexPagesLoading.set(e,t),t.promise.then(t=>{this._index.addPage(e,t,this._elevationOffset),this._setUpdateViewNeeded()}).then(()=>{this._indexPagesLoading.delete(e)},()=>{this._indexPagesLoading.delete(e)}),!0}_processWorkQueue(e){for(;!e.done;){const t=this._scheduleWorkEntry();if(null==t)return void e.madeProgress();this._processWorkEntry(t),e.madeProgress()}}_scheduleWorkEntry(){let e=this._workQueue.length;for(;e--;){const e=this._workQueue.shift();if(!e.remove.find(e=>!this._renderedNodes.has(e)))return e;this._workQueue.push(e)}return null}_processWorkEntry(e){if(0!==e.load.length)Promise.all(e.load.map(e=>{const t=new AbortController,i=this._memCache.pop(e.toString());return null!=i?this._loadingNodes.set(e,{abortController:t,promise:Promise.resolve(i)}):this._loadingNodes.has(e)||this._loadingNodes.set(e,{abortController:t,promise:this._loadNode(e,t.signal)}),this._loadingNodes.get(e).promise})).then(t=>{for(let i=0;i<e.load.length;i++)if(t[i]){const r=this._setupRendererData(e.load[i],t[i]);this._addToRenderer(r)}for(const i of e.remove)this._removeFromRenderer(i)}).catch(()=>{}).then(()=>{for(const t of e.load)this._loadingNodes.delete(t);this._updateLoading(),this._recalcWork&&!this._idleQueue.updating&&0===this._indexQueue.length&&0===this._loadingNodes.size&&(this._recalcWork=!1,this._setUpdateViewNeeded())}),this._updateLoading();else for(const t of e.remove)this._removeFromRenderer(t)}async _populateClassCodeCodedDomain(e,t){const i="CLASS_CODE",s=this.layer.fieldsIndex.get(i);if(!s||s.domain)return;if(!e.includes(s.name))return;const o=await r(this.layer.queryCachedStatistics(i,{signal:t}));if(!1===o.ok)return;const n=o.value?.stats?.labels?.labels;n&&Array.isArray(n)&&(s.domain=new W({name:"CLASS_CODE",codedValues:n.map(e=>new M({code:e.value,name:e.label}))}))}async prepareFetchPopupFeatures(e){return this._codedDomainPopulationPromise||(this._codedDomainPopulationAbortController=new AbortController,this._codedDomainPopulationPromise=this._populateClassCodeCodedDomain(e,this._codedDomainPopulationAbortController.signal).then(()=>{this._codedDomainPopulationAbortController=null})),this._codedDomainPopulationPromise}async whenGraphicAttributes(e,t){const r=this._splitGraphicsPerNode(e),o=this.layer.attributeStorageInfo,n=t.map(e=>ce(o,e)).filter(i),a=async(e,t)=>{const i=this._index.getNode(t);await s(n,async t=>{const r=t.useElevation?await this._loadElevationAttributeFromGeometry(i.resourceId):await this._loadAndParseAttribute(i,t);if(r)for(const i of e)if(this._isValidPointGraphic(i)){const e=i.pointCloudMetadata.attributePointIndexInNode;this._encodeGraphicAttribute(t,r,e,i.attributes)}})},d=[];return r.forEach((e,t)=>{d.push(a(e,t))}),await Promise.allSettled(d),e}_isValidPointGraphic(e){return e instanceof se&&e.pointCloudMetadata?.epoch===this._nodeLoadEpoch}_splitGraphicsPerNode(e){const t=new Map;for(const i of e){if(!this._isValidPointGraphic(i))continue;const e=i.pointCloudMetadata,r=t.get(e.nodeId);r?r.push(i):t.set(e.nodeId,[i])}return t}async _loadAndParseAttribute(e,t){const i=await this._loadAttribute(e.resourceId,t,null);return i?_e({attributeInfo:t,buffer:i},null,e.vertexCount):null}async _loadElevationAttributeFromGeometry(e){const t=this.layer.store.defaultGeometrySchema,i=me(t,await this._loadGeometry(e,null));return ge(i,i.length/3)}highlight(e,i){const r=fe(e);if(0===r.length)return ye;if(!(r[0]instanceof t))return ye;const s=r;return this._renderer.highlight(s.map(e=>this._graphicToPointDefinition(e)),Se(i))}_graphicToPointDefinition(e){if(!this._isValidPointGraphic(e))return null;const{nodeId:t,pointIndexInNode:i}=e.pointCloudMetadata;return null!=t&&null!=i?{nodeId:t,pointId:i}:null}_computeWork(){let e=0;for(const t of this._workQueue)e+=t.load.length+t.remove.length;return e+=this._loadingNodes.size,e+=(this._indexQueue.length+this._indexPagesLoading.size)*this._index.pageSize,e+=this._loadingInitNodePage?100:0,e+=this._updateViewNeeded?100:0,e}get updatingProgressValue(){if(this.suspended)return this._updateViewNeeded?0:1;const e=this._computeWork();return 1-Math.min(this._totalWork,e)/this._totalWork}_updateLoading(){this.notifyChange("updating"),this.notifyChange("updatingProgressValue")}canResume(){return super.canResume()&&this._layerIsVisible}isUpdating(){return this.suspended?this._updateViewNeeded:this._computeWork()>0}get visibleAtCurrentScale(){return Ie(this.layer.effectiveScaleRange,this.view.scale)}async queryFeatures(e,i){const r=await this._ensureQueryEngine().executeQuery(this._ensureQueryJSON(e),i?.signal),s=r.features;r.features=[];const o=z.fromJSON(r),n=this.view.spatialReference;return o.features=s.map(e=>{const{attributes:i,metadata:r}=e;if(!r){const i=t.fromJSON(e);return i.geometry&&(i.geometry.spatialReference=o.spatialReference??n),i.layer=this.layer,i.sourceLayer=this.layer,i.origin=this._graphicOrigin,i}const s=e.geometry?k.fromJSON(e.geometry):void 0;return s&&(s.spatialReference=o.spatialReference??n),this._createGraphic(r.node,r.pointId,s,i)}),o}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference,returnZ:!0};return new H(e)}async queryFeatureCount(e,t){return await this._ensureQueryEngine().executeQueryForCount(this._ensureQueryJSON(e),t?.signal)}async queryExtent(e,t){const{count:i,extent:r}=await this._ensureQueryEngine().executeQueryForExtent(this._ensureQueryJSON(e),t?.signal);return{count:i,extent:j.fromJSON(r)}}_ensureQueryJSON(e){return null==e?new H({outSpatialReference:this.view.spatialReference}).toJSON():H.from(e).toJSON()}_ensureQueryEngine(){if(this._queryEngine)return this._queryEngine;const{spatialReference:e}=this.view;return this._queryEngine=new q({fieldsIndex:this.layer.fieldsIndex.toJSON(),geometryType:"esriGeometryPoint",spatialReference:e,featureIdInfo:{type:"object-id",fieldName:"objectId"},hasZ:!0,featureStore:new Z({sourceSpatialReference:e,viewSpatialReference:e,forAllFeatures:(e,t)=>{let i=!1;this._renderer.forEachNode(r=>{if(i)return;if(t){const e=r.obb,s=O(e.center[0],e.center[1],e.center[2],x(e.halfSize));V(s,this.view.renderSpatialReference,s,this.view.spatialReference);const o=t(s);if(2===o)return;if(i=0===o,i)return}let s=this._queryFeaturesCache.get(`${r.id}`);s||(s=this._createQueryPointFeatures(r),this._queryFeaturesCache.put(`${r.id}`,s)),s.features.forEach(e)})},getFeatureExtent:({point:e},t)=>L(e,e,t),featureAdapter:{cloneWithGeometry:(e,t)=>new Fe(e.node,e.pointId,t.coords),getAttribute:({node:e,attributePointId:t},i)=>{for(const r of e.attributes)if(r.attributeInfo.name===i)return this._getGraphicAttribute(r.attributeInfo,r.values,t)},getAttributes:({node:e,attributePointId:t})=>this._createGraphicAttributes(e,t),getCentroid:e=>e.getGeometry(),getGeometry:e=>e.getGeometry(),getObjectId:()=>{},getMetadata:e=>e}})}),this._queryEngine}_createQueryPointFeatures(e){const t=e.coordinates,i=new Array;for(let r=0;r<t.length/3;r++){const s=3*r,o=R(t[s+0],t[s+1],t[s+2]);C(o,o,e.origin),Q(o,this.view.renderSpatialReference,o,this.view.spatialReference);const n=new Fe(e,r,o);i.push(n)}return new Le(i)}_initNodePages(){const e=this.layer.store.index,t=e.nodesPerPage||e.nodePerIndexBlock;return this._index=new re(this.layer.spatialReference,this.view.renderCoordsHelper.spatialReference,t),this._cancelIndexLoading(),this._traverseVisible=this._index.createVisibilityTraverse(),this._loadingInitNodePage=!0,this._layerIsVisible=!0,this.notifyChange("suspended"),this._updateLoading(),this._pageMultiplier=null!=e.nodesPerPage?1:e.nodePerIndexBlock,this._loadNodePage(0).promise.then(e=>{this._index.addPage(0,e,this._elevationOffset),this._loadingInitNodePage=!1,this._setUpdateViewNeeded()})}_loadNodePage(e){const t=new AbortController,i=`${this.baseUrl}/nodepages/${e*this._pageMultiplier}`;return{promise:this._requestNodePage(i,t.signal).then(t=>t.nodes.map((t,i)=>({resourceId:null!=t.resourceId?t.resourceId:e*this._index.pageSize+i,obb:Ne.fromJSON(t.obb),obbInRenderSR:new Ne,firstChild:t.firstChild,childCount:t.childCount,vertexCount:t.vertexCount??t.pointCount,lodThreshold:t.lodThreshold??t.effectiveArea}))),abortController:t}}_updateWorkQueues(){if(!this._updateViewNeeded)return!1;const e=this.view.quality;let t=this.inverseDensity/this._lodFactor*e;const i=this.maximumPointCount*this._lodFactor*e;let r=this._computeNodesForMinimumDensity(t),s=this._computePointCount(r),o=Math.sqrt(s/(.75*i));for(;s>i;)t*=o,r=this._computeNodesForMinimumDensity(t),s=this._computePointCount(r),o=Math.sqrt(2);return this._displayNodes(r),this._updateViewNeeded=!1,this._updateLoading(),!0}_computePointCount(e){let t=0;for(let i=0;i<e.length;i++){const r=this._index.getNode(e[i]);r&&(t+=r.vertexCount)}return t}_isRootNodeVisible(){let e=!1;return this._traverseVisible({frustum:this.view.state.contentCamera.frustum,clippingBox:this._clippingBox},{predicate:(t,i,r)=>(e=r,!1),pageMiss:()=>{}}),e}_computeNodesForMinimumDensity(e){const t=this.view.state.contentCamera,i=t.frustum,r=this._clippingBox,s=t.viewForward,o=S(s,t.eye),n=D(s,-o,ke),a=t.perScreenPixelRatio/2,d=e*e,l=this._nodeIdArray;l.length=0;const u=e=>l.push(e);return this._traverseVisible({frustum:i,clippingBox:r},{predicate:(e,t,i)=>{if(!i)return!1;if(0===t.childCount)return u(e),!1;const r=this._index.getRenderObb(e);return!(this._computeAveragePixelArea(r,t.lodThreshold,t.vertexCount,n,a)<=d)||(u(e),!1)},pageMiss:(e,t)=>{u(e),this._indexQueue.includes(t)||this._indexQueue.push(t)}}),l}_computeAveragePixelArea(e,t,i,r,s){const o=1e-7,n=Math.max(o,e.minimumDistancePlane(r));return t/(n*n)/(4*s*s)/i}_loadNode(e,t){try{return this._loadNodeAsync(e,t)}catch(i){throw c(i)||o.getLogger(this).error(i),i}}async _loadAdditionalUserAttributes(e,t,r){const s=this.layer.outFields;if(!s)return[];const o=G(this.layer.fieldsIndex,s),n=new Set(e.map(e=>null!=e?e.name:null)),a=this.layer.attributeStorageInfo,d=[];for(const i of o){if(n.has(i))continue;const e=ce(a,i);e&&d.push(t(e))}const l=await _(d);return m(r),l.filter(i)}async _loadNodeAsync(e,t){const i=this._index.getNode(e),r=ue(this.layer),s=he(this.layer),o=i.resourceId,n=async e=>{if(!e)return null;if(e.useElevation)return{attributeInfo:e,buffer:null};const i=await this._loadAttribute(o,e,t);return null!=i?{attributeInfo:e,buffer:i}:null};return this._idleQueue.push(async()=>{const i=this._loadGeometry(o,t),{primaryAttribute:a,modulationAttribute:d}=r,l=n(a),u=n(d),h=s.map(e=>e.attributeInfo),p=h.map(e=>n(e)),c=this._loadAdditionalUserAttributes([a,d,...h],n,t),[_,g,f,y,b]=await Promise.all([i,l,u,Promise.all(p),c]);m(t);const w={geometryBuffer:_,primaryAttributeData:g,modulationAttributeData:f,filterAttributesData:y,userAttributesData:b,schema:this.layer.store.defaultGeometrySchema,rendererInfo:r,filterInfo:s,obbData:this._index.getRenderObb(e).data,elevationOffset:this._elevationOffset,inSR:this.layer.spatialReference.toJSON(),outSR:this.view.renderCoordsHelper.spatialReference.toJSON()};return this._worker.invoke(w,t)},t)}async _loadGeometry(e,t){return this._requestData(`${this.baseUrl}/nodes/${e}/geometries/0`,t)}async _loadAttribute(e,t,i){if(!t?.storageInfo)return null;const r=t.storageInfo.key;return this._requestData(`${this.baseUrl}/nodes/${e}/attributes/${r}`,i)}_requestNodePage(e,t){const i={f:"json",...this.layer.customParameters,token:this.layer.apiKey};return this._indexRequester.request(e,0,{query:i,signal:t})}_requestData(e,t){return this._dataRequester.request(e,1,{query:{...this.layer.customParameters,token:this.layer.apiKey},signal:t})}_removeFromRenderer(e){if(this._renderedNodes.has(e)){const t=this._renderer.removeNode(e);this._renderedNodes.delete(e),this._memCache.put(t.id.toString(),t)}}_addToRenderer(e){this._renderedNodes.has(e.id)||(this._renderedNodes.add(e.id),this._renderer.addNode(e))}_setupRendererData(e,t){const i=this._index.getNode(e),r=Math.sqrt(i.lodThreshold/i.vertexCount),s=this._index.getRenderObb(e);if(ne(t))return t.splatSize=r,t.obb=s,I(t.origin,t.obb.center),t;const n=Ne.fromData(t.obbData),a=n.halfSize,d=s.halfSize,l=.01*Math.max(d[0],d[1],d[2]);if(a[0]>d[0]+l||a[1]>d[1]+l||a[2]>d[2]+l){if(this._maxLoggedBoxWarnings>0){const t=e=>`[${e.halfSize[0]}, ${e.halfSize[1]}, ${e.halfSize[2]}]`;o.getLogger(this).warn(`Node ${e} reported bounding box too small. got ${t(s)} but points cover ${t(n)}`),0===--this._maxLoggedBoxWarnings&&o.getLogger(this).warn(" Too many bounding box errors, stopping reporting for this layer.")}this._index.setRenderObb(e,n)}return new ae(e,r,A(s.center),s,0===i.childCount,t.points,t.rgb,t.attributes,t.pointIdFilterMap)}get usedMemory(){let e=0;return this._renderer.forEachNode(t=>{e+=De,e+=d(t.coordinates);for(const i of t.attributes){const t=i.values;P(t.buffer)&&(e+=d(t))}}),e}get unloadedMemory(){const e=this._renderedNodes.size;if(e<4)return 0;const t=[...this._renderedNodes].reduce((e,t)=>e+this._index.getNode(t).vertexCount);let i=this._loadingNodes.size;for(let r=0;r<this._workQueue.length;r++)i+=this._workQueue[r].load.length,i-=this._workQueue[r].remove.length;if(i<0)return 0;return i*t/e*((this.usedMemory-e*De)/t)+i*De}get performanceInfo(){return new $(this.usedMemory,this._renderedNodes.size,[...this._renderedNodes].reduce((e,t)=>e+this._index.getNode(t).vertexCount,0),this.maximumPointCount,new J(this._loadingNodes.size,this._indexQueue.length,this._workQueue.length,this._idleQueue.length))}get test(){}};e([N()],Ve.prototype,"layer",void 0),e([N()],Ve.prototype,"baseUrl",null),e([N()],Ve.prototype,"pointScale",null),e([N()],Ve.prototype,"useRealWorldSymbolSizes",null),e([N()],Ve.prototype,"pointSize",null),e([N()],Ve.prototype,"inverseDensity",null),e([N()],Ve.prototype,"maximumPointCount",void 0),e([N({readOnly:!0})],Ve.prototype,"availableFields",null),e([N({readOnly:!0})],Ve.prototype,"_clippingBox",null),e([N({readOnly:!0})],Ve.prototype,"_elevationOffset",null),e([N({type:Boolean})],Ve.prototype,"slicePlaneEnabled",void 0),e([N()],Ve.prototype,"_graphicOrigin",null),e([N()],Ve.prototype,"updating",void 0),e([N(ve)],Ve.prototype,"updatingProgress",void 0),e([N({readOnly:!0})],Ve.prototype,"updatingProgressValue",null),e([N({readOnly:!0})],Ve.prototype,"visibleAtCurrentScale",null),Ve=e([v("esri.views.3d.layers.PointCloudLayerView3D")],Ve);const Qe=Ve;class Fe{constructor(e,t,i){this.node=e,this.pointId=t,this.point=i}getGeometry(){return new U([],Array.from(this.point),!0,!1)}get attributePointId(){const{node:e,pointId:t}=this;return null!=e.pointIdFilterMap?e.pointIdFilterMap[t]:t}get usedMemory(){return l+l+u+h(this.point,u)}}class Le{constructor(e){this.features=e}get usedMemory(){return this.features.reduce((e,t)=>e+t.usedMemory,l+p)}}const De=160;function Ee(e){return t=>e.immediate.schedule(t)}export{Qe 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"../../../../core/has.js";import{clone as t}from"../../../../core/lang.js";import{getMetersPerVerticalUnitForSR as e}from"../../../../core/unitUtils.js";import{e as r}from"../../../../chunks/earcut.js";import{normalFromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as n,invertOrIdentity as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{j as l,t as c,a as p,i as m,n as h,d as u,e as d}from"../../../../chunks/vec32.js";import{ONES as g,create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{computeTranslationToOriginAndRotation as y}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as b,fromBuffer as _,intersectsClippingArea as x}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as j}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as S,getZeroIndexArray as P}from"../../../../geometry/support/Indices.js";import{t as v}from"../../../../chunks/vec3.js";import{makeVertexCandidate as C,makeEdgeCandidate as w}from"../../../../layers/graphics/data/SnappingCandidate.js";import{getDriverAxisSizeValue as E}from"../../../../renderers/support/renderingInfoUtils.js";import{needsElevationUpdates3D as A,SampleElevationInfo as D}from"./elevationAlignmentUtils.js";import{Object3DEdgeState as I,Graphics3DObject3DGraphicLayer as U}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as L}from"./Graphics3DSymbolLayer.js";import{computeCentroid as z}from"./graphicUtils.js";import{geometryAsPolygon as M}from"./polygonUtils.js";import{createMaterial as O}from"../support/edgeUtils.js";import{encodeNaNUInt8 as G}from"../support/symbolColorUtils.js";import{debugFlags as V}from"../../support/debugFlags.js";import{SamplePosition as T}from"../../support/ElevationProvider.js";import{geometryToRenderInfo as B}from"../../support/renderInfoUtils/polygon.js";import{Attribute as R}from"../../webgl-engine/lib/Attribute.js";import{Geometry as F}from"../../webgl-engine/lib/Geometry.js";import{isGeometryWithMapPositions as H}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{compressNormals as k,compressNormal as N}from"../../webgl-engine/lib/Normals.js";import{Object3D as W}from"../../webgl-engine/lib/Object3D.js";import{DefaultMaterial as q}from"../../webgl-engine/materials/DefaultMaterial.js";const Z=["polygon","extent"];class J extends L{constructor(t,e,r,s){super(t,e,r,s,pt(e)),this.ensureDrapedStatus(!1)}async doLoad(){const t=this.symbolLayer,e=t?.material,r=this.symbolLayer.material?.color?.a,s=this.needsDrivenTransparentPass||null!=r&&1!==r,o=e?.emissive,n=!this._hasDrivenColorOrOpacity&&(null==r||0===r),i={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,ambient:g,diffuse:g,opacity:n?0:1,layerOpacity:this._getLayerOpacity(),drivenOpacity:s,hasSymbolColors:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:t.castShadows,emissiveStrength:o?.strength??0,emissiveSource:1,offsetTransparentBackfaces:!0,normalType:1},a=new q(i,this._context),l=new q({...i,cullFace:2},this._context);this._materials[0]=a,this._materials[1]=l,this._updateTransparentDepedentMaterialParameters()}destroy(){super.destroy(),this._materials.length=0}createGraphics3DGraphic(t){const e=t.graphic;if(!this._validateGeometry(e.geometry,Z,this.symbolLayer.type))return null;const r=this._getDrivenUInt8ColorWithNaNSupport(t.renderingInfo,this._materialColor,!1);G(r,r);const s=this.createElevationContextForGraphic(e);return this._createAs3DShape(e,t.renderingInfo,r,s,e.uid)}layerOpacityChanged(t,e){const r=this._getLayerOpacity();this._materials[0]?.setParameters({layerOpacity:r}),this._materials[1]?.setParameters({layerOpacity:r}),this._updateTransparentDepedentMaterialParameters(),t?.forEach(t=>e(t)?.layerOpacityChanged(r,this._context.isAsync))}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(t,e){return this.updateGraphics3DGraphicElevationInfo(t,e,A)}slicePlaneEnabledChanged(t,e){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),t?.forEach(t=>{const r=e(t);null!=r&&r.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)}),!0}physicalBasedRenderingChanged(){const t={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0};return this._materials[0]?.setParameters(t),this._materials[1]?.setParameters(t),!0}_getExtrusionSize(t){let e;return e=t.size&&this._drivenProperties.size?E(t.size,2)??0:this._getSymbolSize(),e/=this._context.renderCoordsHelper.unitInMeters,e}applyRendererDiff(t,e){return this._drivenPropertiesChanged(e)?0:1}async queryForSnapping(r,s,o,n){const i=this._getExtrusionSize(o)*this._context.renderCoordsHelper.unitInMeters/e(s),{objectId:a,target:l}=r,c=t(l);switch(c.z=(c.z??0)+i,r.type){case"edge":{const{start:e,end:s}=r,o=t(e),n=t(s);return o.z=(o.z??0)+i,n.z=(n.z??0)+i,[w(a,c,1/0,o,n)]}case"vertex":return[C(a,c,1/0),w(a,l,1/0,l,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(t,e,i,l,c){const p=M(t.geometry);if(null==p)return null;if(0===p.rings.length||!p.rings.some(t=>t.length>0))return this._logGeometryValidationWarnings(p.rings,"rings","ExtrudeSymbol3DLayer"),null;const m=B(p,this._context.elevationProvider,this._context.renderCoordsHelper,l);this._logGeometryCreationWarnings(m,p.rings,"rings","ExtrudeSymbol3DLayer");const h=z(p);if(null==h)return null;const u=new Array,d=new Array,g=b(),P=a(),C=f(),w=1===this._context.renderCoordsHelper.viewingMode;w||this._context.renderCoordsHelper.worldUpAtPosition(null,C),y(p.spatialReference,[h.x,h.y,0],P,this._context.renderCoordsHelper.spatialReference);const E=a();n(E,P);const D=o();s(D,E);const{polygons:L,mapPositions:G,position:V}=m,T=new Map,R=this._materials[0];for(const s of L){const t=s.count;if(this._context.clippingExtent&&(_(s.mapPositions,g),!x(g,this._context.clippingExtent)))continue;const o=r(s.mapPositions,s.holeIndices,3);if(0===o.length)continue;const n=o.length,a=6*t,l=S(a+n),p=S(n),m=j(3*a),h=j(3*a),f=j(3*a),y=j(a);Q(V,G,o,s,m,f,h,y,l,p,this._getExtrusionSize(e),C,w),v(m,m,E);const b=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:c,layerViewUid:this._context.layerViewUid}),A=new jt(m,f,k(h),y),D=K(R,l,l.length-p.length,A,i,b),I=t,U=t,L=2*s.count,z=new St(I,U,L,n/3);ct(D,z,P),T.set(D,z),u.push(D,K(this._materials[1],p,0,A,i,b)),d.push(A.heights)}if(0===u.length)return null;const F=new W({geometries:u,layerViewUid:this._context.layerViewUid,graphicUid:c,isElevationSource:!0});F.transformation=P;const H=O(this.symbolLayer,{opacity:this._getLayerOpacity()}),N=H?new I(this._materials[0],H,this._context.slicePlaneEnabled):null,q=new U(this,F,null,(t,e,r,s,o)=>lt(t,e,r,s,o,d,T),l,N);return q.alignedSampledElevation=m.sampledElevation,q.needsElevationUpdates=A(l.mode),q}get _materialColor(){return this.symbolLayer.material?.color}_updateTransparentDepedentMaterialParameters(){const t=this._materials[0];t&&t.setParameters({cullFace:t.transparent?0:2})}}function K(t,e,r,s,o,n){const i=P(e.length),a=[["position",new R(s.positions,e,3,!0)],["normalCompressed",new R(s.normals,e,2,!0)],["symbolColor",new R(o,i,4,!0)]];return new F(t,a,s.elevation,0,n,r)}function Q(t,e,r,s,o,n,i,a,l,c,p,m,h){const u=r.length/3;let d=2*s.count;X(t,e,s.index,s.count,r,0,u,o,n,i,a,l,c,d,p,m,h);let g=0,f=2*s.count;d=0;const y=s.pathLengths[0];tt(o,n,a,i,g,y,s.count,f,l,d,p),f+=4*y,d+=2*y,g+=y;for(let b=1;b<s.pathLengths.length;++b){const t=s.pathLengths[b];tt(o,n,a,i,g,t,s.count,f,l,d,p),f+=4*t,d+=2*t,g+=t}}function X(t,e,r,s,o,n,i,a,l,c,p,m,d,g,f,y,b){u(ht,y),l??=[],c??=[],p??=[];const _=f>0?1:-1;let x=3*r,j=0,S=3*j,P=s,v=3*P;for(let u=0;u<s;++u){const r=t[x],s=t[x+1],o=t[x+2];b&&(ht[0]=r,ht[1]=s,ht[2]=o,h(ht,ht)),a[S+0]=r,a[S+1]=s,a[S+2]=o;const n=e[x+0],i=e[x+1],m=e[x+2];l[S+0]=n,l[S+1]=i,l[S+2]=m,c[S+0]=-_*ht[0],c[S+1]=-_*ht[1],c[S+2]=-_*ht[2],p[j]=0,a[v+0]=r+f*ht[0],a[v+1]=s+f*ht[1],a[v+2]=o+f*ht[2],l[v+0]=n,l[v+1]=i,l[v+2]=m,p[P]=f,S+=3,v+=3,x+=3,j+=1,P+=1}x=3*n,S=0,v=3*g;const C=f<0?gt:dt,w=f<0?dt:gt;for(let h=0;h<i;++h)d[S]=o[x+C[0]],d[S+1]=o[x+C[1]],d[S+2]=o[x+C[2]],m[v]=o[x+w[0]]+s,m[v+1]=o[x+w[1]]+s,m[v+2]=o[x+w[2]]+s,S+=3,v+=3,x+=3}function Y(t,e,r,s,o,n,i){s[n]=s[i],i*=3,t[n*=3]=t[i],t[n+1]=t[i+1],t[n+2]=t[i+2],e[n]=e[i],e[n+1]=e[i+1],e[n+2]=e[i+2],r[n]=o[0],r[n+1]=o[1],r[n+2]=o[2]}const $=f();function tt(t,e,r,s,o,n,i,a,l,c,p){e??=[],r??=[],s??=[];let m=o,h=o+1,u=o+i,d=o+i+1,g=a,f=a+1,y=a+2*n,b=a+2*n+1;p<0&&(m=o+i+1,d=o);let _=3*c;for(let x=0;x<n;++x)x===n-1&&(h=o,p>0?d=o+i:m=o+i),it(t,m,h,u,$),Y(t,e,s,r,$,g,m),Y(t,e,s,r,$,f,h),Y(t,e,s,r,$,y,u),Y(t,e,s,r,$,b,d),l[_]=g,l[_+1]=y,l[_+2]=b,l[_+3]=g,l[_+4]=b,l[_+5]=f,_+=6,m++,h++,u++,d++,g+=2,f+=2,y+=2,b+=2}const et=f(),rt=f(),st=f(),ot=f(),nt=f();function it(t,e,r,s,o){e*=3,r*=3,s*=3,l(et,t[e++],t[e++],t[e++]),l(rt,t[r++],t[r++],t[r++]),l(st,t[s++],t[s++],t[s++]),d(ot,rt,et),d(nt,st,et),m(o,nt,ot),h(o,o)}const at=f();function lt(t,e,r,s,o,n,p){const m=t.stageObject,h=m.geometries,u=h.length,d="absolute-height"!==e.mode;let g=0;const f=m.transformation,y=i(a(),f);for(let i=0;i<u;i+=2){const t=h[i];if(!H(t))continue;const e=t.getMutableAttribute("position").data,a=n[i/2],u=new T(t.mapPositions),b=e.length/3;let _=!1,x=0;{let t=0;for(let n=0;n<b;n++){at[0]=e[t],at[1]=e[t+1],at[2]=e[t+2],s(u,ut),d&&(x+=ut.sampledElevation),V.TESTS_DISABLE_OPTIMIZATIONS?(l(mt,u.array[u.offset],u.array[u.offset+1],ut.z+a[t/3]),null!=r&&o.toRenderCoords(mt,r,mt),c(mt,mt,y)):(l(mt,e[t],e[t+1],e[t+2]),c(mt,mt,f),o.setAltitude(mt,ut.z+a[t/3]),c(mt,mt,y)),e[t]=mt[0],e[t+1]=mt[1],e[t+2]=mt[2];const n=ft/o.unitInMeters;(Math.abs(at[0]-e[t])>=n||Math.abs(at[1]-e[t+1])>=n||Math.abs(at[2]-e[t+2])>=n)&&(_=!0),u.offset+=3,t+=3}}if(_){const e=p.get(t);e&&ct(t,e,f),m.geometryVertexAttributeUpdated(h[i],"normalCompressed"),t.invalidateBoundingInfo(),m.geometryVertexAttributeUpdated(h[i],"position"),h[i+1].invalidateBoundingInfo(),m.geometryVertexAttributeUpdated(h[i+1],"position")}g+=x/b}return g/u}function ct(t,e,r){const s=t.getMutableAttribute("position"),o=t.getMutableAttribute("normalCompressed").data,{topVertexStart:n,topVertexCount:i,topFaceStart:a,topFaceCount:u}=e,d=s.data,g=i,f=t.attributes.get("position").indices,y=a+u,b=n+i,_=j(3*g);for(let l=0;l<g;++l){const t=3*l;_[t+0]=0,_[t+1]=0,_[t+2]=0}const x=yt,S=bt,P=_t,v=xt,C=ht;for(let j=a;j<y;++j){const t=3*j;for(let e=0;e<3;++e){const s=f[t+e];v[e]=s;const o=3*s;l(mt,d[o+0],d[o+1],d[o+2]),c(x[e],mt,r)}p(S,x[1],x[0]),p(P,x[2],x[0]),m(C,S,P),h(C,C);for(let e=0;e<3;++e){const t=3*(v[e]-n);_[t+0]+=C[0],_[t+1]+=C[1],_[t+2]+=C[2]}}for(let l=n;l<b;++l){const t=3*(l-n),e=_[t+0],r=_[t+1],s=_[t+2],i=Math.sqrt(e*e+r*r+s*s);N(o,l,e/i,r/i,s/i)}}function pt(t){return 1===(t.material?.color?.a??0)}const mt=f(),ht=f(),ut=new D,dt=[0,2,1],gt=[0,1,2],ft=.01,yt=[f(),f(),f()],bt=f(),_t=f(),xt=[0,0,0];class jt{constructor(t,e,r,s){this.positions=t,this.elevation=e,this.normals=r,this.heights=s}}class St{constructor(t,e,r,s){this.topVertexStart=t,this.topVertexCount=e,this.topFaceStart=r,this.topFaceCount=s}}export{J as Graphics3DExtrudeSymbolLayer,Q as extrudePolygon};
5
+ import"../../../../core/has.js";import{clone as t}from"../../../../core/lang.js";import{getMetersPerVerticalUnitForSR as e}from"../../../../core/unitUtils.js";import{e as r}from"../../../../chunks/earcut.js";import{normalFromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as n,invertOrIdentity as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{j as l,t as c,a as p,i as m,n as h,d as u,e as d}from"../../../../chunks/vec32.js";import{ONES as g,create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{computeTranslationToOriginAndRotation as y}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as b,fromBuffer as _,intersectsClippingArea as x}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as j}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as S,getZeroIndexArray as P}from"../../../../geometry/support/Indices.js";import{t as v}from"../../../../chunks/vec3.js";import{makeVertexCandidate as C,makeEdgeCandidate as w}from"../../../../layers/graphics/data/SnappingCandidate.js";import{getDriverAxisSizeValue as E}from"../../../../renderers/support/renderingInfoUtils.js";import{needsElevationUpdates3D as A,SampleElevationInfo as D}from"./elevationAlignmentUtils.js";import{Object3DEdgeState as I,Graphics3DObject3DGraphicLayer as U}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as L}from"./Graphics3DSymbolLayer.js";import{computeCentroid as z}from"./graphicUtils.js";import{geometryAsPolygon as M}from"./polygonUtils.js";import{createMaterial as O}from"../support/edgeUtils.js";import{encodeNaNUInt8 as G}from"../support/symbolColorUtils.js";import{debugFlags as V}from"../../support/debugFlags.js";import{SamplePosition as T}from"../../support/ElevationProvider.js";import{polygonToRenderInfo as B}from"../../support/renderInfoUtils/polygon.js";import{Attribute as R}from"../../webgl-engine/lib/Attribute.js";import{Geometry as F}from"../../webgl-engine/lib/Geometry.js";import{isGeometryWithMapPositions as H}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{compressNormals as k,compressNormal as N}from"../../webgl-engine/lib/Normals.js";import{Object3D as W}from"../../webgl-engine/lib/Object3D.js";import{DefaultMaterial as q}from"../../webgl-engine/materials/DefaultMaterial.js";const Z=["polygon","extent"];class J extends L{constructor(t,e,r,s){super(t,e,r,s,pt(e)),this.ensureDrapedStatus(!1)}async doLoad(){const t=this.symbolLayer,e=t?.material,r=this.symbolLayer.material?.color?.a,s=this.needsDrivenTransparentPass||null!=r&&1!==r,o=e?.emissive,n=!this._hasDrivenColorOrOpacity&&(null==r||0===r),i={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,ambient:g,diffuse:g,opacity:n?0:1,layerOpacity:this._getLayerOpacity(),drivenOpacity:s,hasSymbolColors:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:t.castShadows,emissiveStrength:o?.strength??0,emissiveSource:1,offsetTransparentBackfaces:!0,normalType:1},a=new q(i,this._context),l=new q({...i,cullFace:2},this._context);this._materials[0]=a,this._materials[1]=l,this._updateTransparentDepedentMaterialParameters()}destroy(){super.destroy(),this._materials.length=0}createGraphics3DGraphic(t){const e=t.graphic;if(!this._validateGeometry(e.geometry,Z,this.symbolLayer.type))return null;const r=this._getDrivenUInt8ColorWithNaNSupport(t.renderingInfo,this._materialColor,!1);G(r,r);const s=this.createElevationContextForGraphic(e);return this._createAs3DShape(e,t.renderingInfo,r,s,e.uid)}layerOpacityChanged(t,e){const r=this._getLayerOpacity();this._materials[0]?.setParameters({layerOpacity:r}),this._materials[1]?.setParameters({layerOpacity:r}),this._updateTransparentDepedentMaterialParameters(),t?.forEach(t=>e(t)?.layerOpacityChanged(r,this._context.isAsync))}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(t,e){return this.updateGraphics3DGraphicElevationInfo(t,e,A)}slicePlaneEnabledChanged(t,e){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),t?.forEach(t=>{const r=e(t);null!=r&&r.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)}),!0}physicalBasedRenderingChanged(){const t={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0};return this._materials[0]?.setParameters(t),this._materials[1]?.setParameters(t),!0}_getExtrusionSize(t){let e;return e=t.size&&this._drivenProperties.size?E(t.size,2)??0:this._getSymbolSize(),e/=this._context.renderCoordsHelper.unitInMeters,e}applyRendererDiff(t,e){return this._drivenPropertiesChanged(e)?0:1}async queryForSnapping(r,s,o,n){const i=this._getExtrusionSize(o)*this._context.renderCoordsHelper.unitInMeters/e(s),{objectId:a,target:l}=r,c=t(l);switch(c.z=(c.z??0)+i,r.type){case"edge":{const{start:e,end:s}=r,o=t(e),n=t(s);return o.z=(o.z??0)+i,n.z=(n.z??0)+i,[w(a,c,1/0,o,n)]}case"vertex":return[C(a,c,1/0),w(a,l,1/0,l,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(t,e,i,l,c){const p=M(t.geometry);if(null==p)return null;if(0===p.rings.length||!p.rings.some(t=>t.length>0))return this._logGeometryValidationWarnings(p.rings,"rings","ExtrudeSymbol3DLayer"),null;const m=B(p,this._context.elevationProvider,this._context.renderCoordsHelper,l);this._logGeometryCreationWarnings(m,p.rings,"rings","ExtrudeSymbol3DLayer");const h=z(p);if(null==h)return null;const u=new Array,d=new Array,g=b(),P=a(),C=f(),w=1===this._context.renderCoordsHelper.viewingMode;w||this._context.renderCoordsHelper.worldUpAtPosition(null,C),y(p.spatialReference,[h.x,h.y,0],P,this._context.renderCoordsHelper.spatialReference);const E=a();n(E,P);const D=o();s(D,E);const{polygons:L,mapPositions:G,position:V}=m,T=new Map,R=this._materials[0];for(const s of L){const t=s.count;if(this._context.clippingExtent&&(_(s.mapPositions,g),!x(g,this._context.clippingExtent)))continue;const o=r(s.mapPositions,s.holeIndices,3);if(0===o.length)continue;const n=o.length,a=6*t,l=S(a+n),p=S(n),m=j(3*a),h=j(3*a),f=j(3*a),y=j(a);Q(V,G,o,s,m,f,h,y,l,p,this._getExtrusionSize(e),C,w),v(m,m,E);const b=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:c,layerViewUid:this._context.layerViewUid}),A=new jt(m,f,k(h),y),D=K(R,l,l.length-p.length,A,i,b),I=t,U=t,L=2*s.count,z=new St(I,U,L,n/3);ct(D,z,P),T.set(D,z),u.push(D,K(this._materials[1],p,0,A,i,b)),d.push(A.heights)}if(0===u.length)return null;const F=new W({geometries:u,layerViewUid:this._context.layerViewUid,graphicUid:c,isElevationSource:!0});F.transformation=P;const H=O(this.symbolLayer,{opacity:this._getLayerOpacity()}),N=H?new I(this._materials[0],H,this._context.slicePlaneEnabled):null,q=new U(this,F,null,(t,e,r,s,o)=>lt(t,e,r,s,o,d,T),l,N);return q.alignedSampledElevation=m.sampledElevation,q.needsElevationUpdates=A(l.mode),q}get _materialColor(){return this.symbolLayer.material?.color}_updateTransparentDepedentMaterialParameters(){const t=this._materials[0];t&&t.setParameters({cullFace:t.transparent?0:2})}}function K(t,e,r,s,o,n){const i=P(e.length),a=[["position",new R(s.positions,e,3,!0)],["normalCompressed",new R(s.normals,e,2,!0)],["symbolColor",new R(o,i,4,!0)]];return new F(t,a,s.elevation,0,n,r)}function Q(t,e,r,s,o,n,i,a,l,c,p,m,h){const u=r.length/3;let d=2*s.count;X(t,e,s.index,s.count,r,0,u,o,n,i,a,l,c,d,p,m,h);let g=0,f=2*s.count;d=0;const y=s.pathLengths[0];tt(o,n,a,i,g,y,s.count,f,l,d,p),f+=4*y,d+=2*y,g+=y;for(let b=1;b<s.pathLengths.length;++b){const t=s.pathLengths[b];tt(o,n,a,i,g,t,s.count,f,l,d,p),f+=4*t,d+=2*t,g+=t}}function X(t,e,r,s,o,n,i,a,l,c,p,m,d,g,f,y,b){u(ht,y),l??=[],c??=[],p??=[];const _=f>0?1:-1;let x=3*r,j=0,S=3*j,P=s,v=3*P;for(let u=0;u<s;++u){const r=t[x],s=t[x+1],o=t[x+2];b&&(ht[0]=r,ht[1]=s,ht[2]=o,h(ht,ht)),a[S+0]=r,a[S+1]=s,a[S+2]=o;const n=e[x+0],i=e[x+1],m=e[x+2];l[S+0]=n,l[S+1]=i,l[S+2]=m,c[S+0]=-_*ht[0],c[S+1]=-_*ht[1],c[S+2]=-_*ht[2],p[j]=0,a[v+0]=r+f*ht[0],a[v+1]=s+f*ht[1],a[v+2]=o+f*ht[2],l[v+0]=n,l[v+1]=i,l[v+2]=m,p[P]=f,S+=3,v+=3,x+=3,j+=1,P+=1}x=3*n,S=0,v=3*g;const C=f<0?gt:dt,w=f<0?dt:gt;for(let h=0;h<i;++h)d[S]=o[x+C[0]],d[S+1]=o[x+C[1]],d[S+2]=o[x+C[2]],m[v]=o[x+w[0]]+s,m[v+1]=o[x+w[1]]+s,m[v+2]=o[x+w[2]]+s,S+=3,v+=3,x+=3}function Y(t,e,r,s,o,n,i){s[n]=s[i],i*=3,t[n*=3]=t[i],t[n+1]=t[i+1],t[n+2]=t[i+2],e[n]=e[i],e[n+1]=e[i+1],e[n+2]=e[i+2],r[n]=o[0],r[n+1]=o[1],r[n+2]=o[2]}const $=f();function tt(t,e,r,s,o,n,i,a,l,c,p){e??=[],r??=[],s??=[];let m=o,h=o+1,u=o+i,d=o+i+1,g=a,f=a+1,y=a+2*n,b=a+2*n+1;p<0&&(m=o+i+1,d=o);let _=3*c;for(let x=0;x<n;++x)x===n-1&&(h=o,p>0?d=o+i:m=o+i),it(t,m,h,u,$),Y(t,e,s,r,$,g,m),Y(t,e,s,r,$,f,h),Y(t,e,s,r,$,y,u),Y(t,e,s,r,$,b,d),l[_]=g,l[_+1]=y,l[_+2]=b,l[_+3]=g,l[_+4]=b,l[_+5]=f,_+=6,m++,h++,u++,d++,g+=2,f+=2,y+=2,b+=2}const et=f(),rt=f(),st=f(),ot=f(),nt=f();function it(t,e,r,s,o){e*=3,r*=3,s*=3,l(et,t[e++],t[e++],t[e++]),l(rt,t[r++],t[r++],t[r++]),l(st,t[s++],t[s++],t[s++]),d(ot,rt,et),d(nt,st,et),m(o,nt,ot),h(o,o)}const at=f();function lt(t,e,r,s,o,n,p){const m=t.stageObject,h=m.geometries,u=h.length,d="absolute-height"!==e.mode;let g=0;const f=m.transformation,y=i(a(),f);for(let i=0;i<u;i+=2){const t=h[i];if(!H(t))continue;const e=t.getMutableAttribute("position").data,a=n[i/2],u=new T(t.mapPositions),b=e.length/3;let _=!1,x=0;{let t=0;for(let n=0;n<b;n++){at[0]=e[t],at[1]=e[t+1],at[2]=e[t+2],s(u,ut),d&&(x+=ut.sampledElevation),V.TESTS_DISABLE_OPTIMIZATIONS?(l(mt,u.array[u.offset],u.array[u.offset+1],ut.z+a[t/3]),null!=r&&o.toRenderCoords(mt,r,mt),c(mt,mt,y)):(l(mt,e[t],e[t+1],e[t+2]),c(mt,mt,f),o.setAltitude(mt,ut.z+a[t/3]),c(mt,mt,y)),e[t]=mt[0],e[t+1]=mt[1],e[t+2]=mt[2];const n=ft/o.unitInMeters;(Math.abs(at[0]-e[t])>=n||Math.abs(at[1]-e[t+1])>=n||Math.abs(at[2]-e[t+2])>=n)&&(_=!0),u.offset+=3,t+=3}}if(_){const e=p.get(t);e&&ct(t,e,f),m.geometryVertexAttributeUpdated(h[i],"normalCompressed"),t.invalidateBoundingInfo(),m.geometryVertexAttributeUpdated(h[i],"position"),h[i+1].invalidateBoundingInfo(),m.geometryVertexAttributeUpdated(h[i+1],"position")}g+=x/b}return g/u}function ct(t,e,r){const s=t.getMutableAttribute("position"),o=t.getMutableAttribute("normalCompressed").data,{topVertexStart:n,topVertexCount:i,topFaceStart:a,topFaceCount:u}=e,d=s.data,g=i,f=t.attributes.get("position").indices,y=a+u,b=n+i,_=j(3*g);for(let l=0;l<g;++l){const t=3*l;_[t+0]=0,_[t+1]=0,_[t+2]=0}const x=yt,S=bt,P=_t,v=xt,C=ht;for(let j=a;j<y;++j){const t=3*j;for(let e=0;e<3;++e){const s=f[t+e];v[e]=s;const o=3*s;l(mt,d[o+0],d[o+1],d[o+2]),c(x[e],mt,r)}p(S,x[1],x[0]),p(P,x[2],x[0]),m(C,S,P),h(C,C);for(let e=0;e<3;++e){const t=3*(v[e]-n);_[t+0]+=C[0],_[t+1]+=C[1],_[t+2]+=C[2]}}for(let l=n;l<b;++l){const t=3*(l-n),e=_[t+0],r=_[t+1],s=_[t+2],i=Math.sqrt(e*e+r*r+s*s);N(o,l,e/i,r/i,s/i)}}function pt(t){return 1===(t.material?.color?.a??0)}const mt=f(),ht=f(),ut=new D,dt=[0,2,1],gt=[0,1,2],ft=.01,yt=[f(),f(),f()],bt=f(),_t=f(),xt=[0,0,0];class jt{constructor(t,e,r,s){this.positions=t,this.elevation=e,this.normals=r,this.heights=s}}class St{constructor(t,e,r,s){this.topVertexStart=t,this.topVertexCount=e,this.topFaceStart=r,this.topFaceCount=s}}export{J as Graphics3DExtrudeSymbolLayer,Q as extrudePolygon};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import e from"../../../../core/Accessor.js";import{EventEmitter as r}from"../../../../core/Evented.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{projectPoint as s}from"../../../../geometry/projectionUtils.js";import{create as a}from"../../../../geometry/support/aaBoundingBox.js";import{getObjectId as c}from"../../../../layers/graphics/dehydratedFeatures.js";import{OptimizedFeature as p}from"../../../../layers/graphics/OptimizedFeature.js";import n from"../../../../layers/graphics/OptimizedGeometry.js";import{optimizedFeatureQueryEngineAdapter as h}from"../../../../layers/graphics/data/optimizedFeatureQueryEngineAdapter.js";const d=a();let l=class extends e{constructor(t){super(t),this.events=new r,this.hasZ=null,this.hasM=null,this.objectIdField=null,this.featureAdapter={getAttribute:(t,e)=>"graphic"in t?t.graphic.attributes[e]:h.getAttribute(t,e),getAttributes:t=>"graphic"in t?t.graphic.attributes:h.getAttributes(t),getObjectId:t=>"graphic"in t?c(t.graphic,this.objectIdField)??void 0:h.getObjectId(t),getGeometry:t=>"graphic"in t?t.getAsOptimizedGeometry(this.hasZ,this.hasM):h.getGeometry(t),getCentroid:(t,e)=>{if("graphic"in t){let r=null;null!=t.centroid?r=t.centroid:"point"===t.graphic.geometry.type&&s(t.graphic.geometry,u,this.viewSpatialReference)&&(r=u);const o=new Array(2+(e.hasZ?1:0)+(e.hasM?1:0));return null==r?(o[0]=0,o[1]=0,o[2]=0,o[3]=0):(o[0]=r.x,o[1]=r.y,e.hasZ&&(o[2]=r.hasZ?r.z:0),e.hasM&&(o[e.hasZ?3:2]=r.hasM?r.m:0)),new n([],o)}return h.getCentroid(t,e)},cloneWithGeometry:(t,e)=>"graphic"in t?new p(e,this.featureAdapter.getAttributes(t),null,this.featureAdapter.getObjectId(t)):h.cloneWithGeometry(t,e)}}forEachInBounds(t,e){this.getSpatialIndex().forEachInBounds(t,e)}forEachBounds(t,e){const r=this.getSpatialIndex();for(const o of t){const t=this.featureAdapter.getObjectId(o);null!=r.getBounds(t,d)&&e(d)}}};t([o({constructOnly:!0})],l.prototype,"getSpatialIndex",void 0),t([o({constructOnly:!0})],l.prototype,"forEach",void 0),t([o({constructOnly:!0})],l.prototype,"hasZ",void 0),t([o({constructOnly:!0})],l.prototype,"hasM",void 0),t([o({constructOnly:!0})],l.prototype,"objectIdField",void 0),t([o({constructOnly:!0})],l.prototype,"viewSpatialReference",void 0),t([o({constructOnly:!0})],l.prototype,"featureSpatialReference",void 0),l=t([i("esri.views.3d.layers.graphics.Graphics3DFeatureStore")],l);const u={type:"point",x:0,y:0,hasZ:!1,hasM:!1,spatialReference:null};export{l as Graphics3DFeatureStore};
5
+ import{__decorate as t}from"tslib";import e from"../../../../core/Accessor.js";import{EventEmitter as r}from"../../../../core/Evented.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{projectPoint as i}from"../../../../geometry/projectionUtils.js";import{create as a}from"../../../../geometry/support/aaBoundingBox.js";import{getObjectId as c}from"../../../../layers/graphics/dehydratedFeatures.js";import{OptimizedFeature as p}from"../../../../layers/graphics/OptimizedFeature.js";import n from"../../../../layers/graphics/OptimizedGeometry.js";import{optimizedFeatureQueryEngineAdapter as h}from"../../../../layers/graphics/data/optimizedFeatureQueryEngineAdapter.js";const d=a();let l=class extends e{constructor(t){super(t),this.events=new r,this.hasZ=null,this.hasM=null,this.objectIdField=null,this.featureAdapter={getAttribute:(t,e)=>"graphic"in t?t.graphic.attributes[e]:h.getAttribute(t,e),getAttributes:t=>"graphic"in t?t.graphic.attributes:h.getAttributes(t),getObjectId:t=>"graphic"in t?c(t.graphic,this.objectIdField)??void 0:h.getObjectId(t),getGeometry:t=>"graphic"in t?t.getAsOptimizedGeometry(this.hasZ,this.hasM):h.getGeometry(t),getCentroid:(t,e)=>{if("graphic"in t){let r=null;null!=t.centroid?r=t.centroid:"point"===t.graphic.geometry.type&&i(t.graphic.geometry,u,this.viewSpatialReference)&&(r=u);const o=new Array(2+(e.hasZ?1:0)+(e.hasM?1:0));return null==r?(o[0]=0,o[1]=0,o[2]=0,o[3]=0):(o[0]=r.x,o[1]=r.y,e.hasZ&&(o[2]=r.hasZ?r.z:0),e.hasM&&(o[e.hasZ?3:2]=r.hasM?r.m:0)),new n([],o,e.hasZ,e.hasM)}return h.getCentroid(t,e)},cloneWithGeometry:(t,e)=>"graphic"in t?new p(e,this.featureAdapter.getAttributes(t),null,this.featureAdapter.getObjectId(t)):h.cloneWithGeometry(t,e)}}forEachInBounds(t,e){this.getSpatialIndex().forEachInBounds(t,e)}forEachBounds(t,e){const r=this.getSpatialIndex();for(const o of t){const t=this.featureAdapter.getObjectId(o);null!=r.getBounds(t,d)&&e(d)}}};t([o({constructOnly:!0})],l.prototype,"getSpatialIndex",void 0),t([o({constructOnly:!0})],l.prototype,"forEach",void 0),t([o({constructOnly:!0})],l.prototype,"hasZ",void 0),t([o({constructOnly:!0})],l.prototype,"hasM",void 0),t([o({constructOnly:!0})],l.prototype,"objectIdField",void 0),t([o({constructOnly:!0})],l.prototype,"viewSpatialReference",void 0),t([o({constructOnly:!0})],l.prototype,"featureSpatialReference",void 0),l=t([s("esri.views.3d.layers.graphics.Graphics3DFeatureStore")],l);const u={type:"point",x:0,y:0,hasZ:!1,hasM:!1,spatialReference:null};export{l as Graphics3DFeatureStore};
@@ -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 p,create as d}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 F,needsElevationUpdates2D as T}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{RenderGeometry as ie}from"../../webgl-engine/lib/RenderGeometry.js";import{Texture as se}from"../../webgl-engine/lib/Texture.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=pe(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=de("relative",s),a=new se(r,{width:r?.width??1,height:r?.height??1,reloadable:!0})}else a=new se(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;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.texture.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.texture;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||(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=p(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=F(he.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(!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!=pe(h))return;const m=this._getIconSize(),p=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,p,{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.texture;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 p=new D(this,m.object,null,j,a);return p.alignedSampledElevation=m.sampledElevation,p.needsElevationUpdates=T(a.mode)||"absolute-height"===a.mode,p.getScreenSize=this._createScreenSizeGetter(o,l),p.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(p.getScreenSize(),1,e),B(p,t,this._context.elevationProvider),p}_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}),p=new ie(m,{layerViewUid:h,graphicUid:c}),d=new U(this,[p],null,this._context.drapeSourceRenderer);return d.getScreenSize=this._createScreenSizeGetter(o,l),d.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(d.getScreenSize(),1,e),d}_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]=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=d())=>(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 pe(e){const t=m(e);return"application/json"===t?.mediaType?t.data:void 0}function de(e,t){return"relative"===e?p((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 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 p,create as d}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,forEachSymbolLayer as z}from"../../../../symbols/cim/CIMSymbolHelper.js";import{evaluateValueOrFunction as C}from"../../../../symbols/cim/utils.js";import{scaleCIMSymbol as R}from"../../../../symbols/support/cimSymbolUtils.js";import{defaultPrimitive as M}from"../../../../symbols/support/IconSymbol3DLayerResource.js";import{Symbol3DAnchorPosition2D as I}from"../../../../symbols/support/Symbol3DAnchorPosition2D.js";import{getIconHref as O}from"../../../../symbols/support/utils.js";import{transparentUnit as j}from"./constants.js";import{perObjectElevationAligner as F}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as T,needsElevationUpdates2D as E}from"./elevationAlignmentUtils.js";import{focusAreaHUDColor as U}from"./focusAreaStyle.js";import{Graphics3DDrapedGraphicLayer as D}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as V}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as G}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as L}from"./graphicUtils.js";import{namedAnchorToHUDMaterialAnchorPos as A}from"./placementUtils.js";import{placePointOnGeometry as H,updateStageObjectGeometry as k,getLocalOriginForPoint as B,extendPointGraphicElevationContext as $,createStageObject as N}from"./pointUtils.js";import{initFastSymbolUpdatesState as q,updateFastSymbolUpdatesState as J,evaluateModelTransformScale as Z,ConvertOptions as W}from"../support/FastSymbolUpdates.js";import{createTexture as K,requiresHalfTexelOffset as Q,defaultBoundingBox as X,defaultSymbolSizeRatio as Y,defaultTexSize as ee}from"../../support/engineContent/sdfPrimitives.js";import{drapedZ as te}from"../../terrain/OverlayRenderer.js";import{VerticalOffsetParameters as re}from"../../webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js";import{createPointGeometry as ie}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as se}from"../../webgl-engine/lib/RenderGeometry.js";import{Texture as oe}from"../../webgl-engine/lib/Texture.js";import{HUDMaterial as ae}from"../../webgl-engine/materials/HUDMaterial.js";const ne=_(0,0,1),le=16,ce=1.5,he=[ee*Y,ee*Y];class ue extends G{static{this.PRIMITIVE_SIZE=he}getCachedSize(){return{size:this._getIconSize()}}static{this.elevationModeChangeTypes={definedChanged:1,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,ge(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=O(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=L(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):le);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?C(this._cimScaleFactorOrFunction,e):1;1!==c&&i.symbol&&R(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 I({x:-h.x/h.width-.5,y:(h.height+h.y)/h.height-.5});this._cimMaterialParametersInfo.anchorPosition=_e("relative",s),a=new oe(r,{width:r?.width??1,height:r?.height??1,reloadable:!0})}else a=new oe(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:_e(this.symbolLayer.anchor,this.symbolLayer.anchorPosition),rotation:this.symbolLayer.angle},t=this.symbol;me(t)&&(e.verticalOffset=new re(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(pe(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`,()=>K(t));this._textureHandle=r,e.textureId=r.texture.id}e.textureIsSignedDistanceField=!0,e.sampleSignedDistanceFieldTexelCenter=Q(t),e.distanceFieldBoundingBox=X;const i=this._getIconSize();this._size=[i,i],this._symbolTextureRatio=1/Y,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.texture;this._size=fe(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 ye(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=pe(this._getPrimitive())?ce: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(pe(this._getPrimitive()))return j;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)):le)/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 ae(e,t),this._cimSymbolMaterials.set(e.textureId??0,r)),r}this._fastUpdates=q(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastUpdates&&(e={...e,...this._fastUpdates.materialParameters}),this._materials[0]=new ae(e,t),e.isFocused=!1;const r=this.view.map?.focusAreas.style;return e.color=U(e.color,r),e.outlineColor=U(e.outlineColor,r),this._materials[1]=new ae(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=H(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;let a=!1;if(this._cimData){if(!this._cimData.symbol)return null;z(this._cimData.symbol,e=>{e.colorLocked&&(a=!0)});const r=this._generateTextureCIM(t,e),n={textureId:r.id,isFocused:o,...this._cimMaterialParametersInfo};i=this._createMaterial(n);const l=this._context.graphicsCoreOwner.view.state.rasterPixelRatio;s=[r.parameters.width/l,r.parameters.height/l]}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 n=e.renderingInfo,l=a?x(255,255,255,255):this._getDrivenUInt8Color(n,this._materialColor,null==this._getPrimitive()),c=this._getDrivenRotation(n);let h=1;if(!this._fastUpdates?.visualVariables.size){const e=s[0]>s[1]?s[0]:s[1];h=this._getScaleFactor(n,e)}h*=this._symbolTextureRatio;const u=p(s[0]*h,s[1]*h),m=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===m.mode)&&this._setDrapingDependentMaterialParameters(),this.draped?this._createAsOverlay(t,r,i,l,c,u):this._createAs3DShape(t,r,i,l,c,u,m,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=H(r);if(!o)return!1;i.updateFeatureExpressionFeature(e,this._context.layer);const a=k(s,this._context,o,i);if(null==a)return!1;const n=B(this._context,o);return s.geometries[0].localOrigin===n&&(t.alignedSampledElevation=a,$(t,o,this._context.elevationProvider),!0)}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,s=T(ue.elevationModeChangeTypes,r,i);if(1!==s)return s;const o=E(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(!J(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(),p=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,p,{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.texture;this._size=fe(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 xe}_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=ie(r,{normal:ne,color:i,rotation:s,size:o,centerOffsetAndDistance:be,featureAttribute:l,olidColor:h}),m=N(this._context,t,u,a,n);if(null==m)return null;const p=new V(this,m.object,null,F,a);return p.alignedSampledElevation=m.sampledElevation,p.needsElevationUpdates=E(a.mode)||"absolute-height"===a.mode,p.getScreenSize=this._createScreenSizeGetter(o,l),p.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(p.getScreenSize(),1,e),$(p,t,this._context.elevationProvider),p}_createAsOverlay(e,t,r,i,s,o){r.renderPriority=this._renderPriority;const a=f();b(t,a,this._context.overlaySR),a[2]=te;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=ie(r,{normal:ne,position:a,color:i,rotation:s,size:o,featureAttribute:l,olidColor:u}),p=new se(m,{layerViewUid:h,graphicUid:c}),d=new D(this,[p],null,this._context.drapeSourceRenderer);return d.getScreenSize=this._createScreenSizeGetter(o,l),d.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(d.getScreenSize(),1,e),d}_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]=Z(ve,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=_(e,e,e),r=h(1),i=e*r,s=_(i,i,i),o=this._getFallbackSize();return new W({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 me(e){return e&&"point-3d"===e.type&&e.hasVisibleVerticalOffset()}function pe(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 _e(e,t){return"relative"===e?p((t.x||0)+.5,.5-(t.y||0)):e in A?A[e]:A.center}function fe({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 ye(e){return e.resource?.href?null:e.resource?.primitive??M}function ge(e){return 1===(e.material?.color?.a??0)&&null!=ye(e)}const xe={mode:"relative-to-ground",offset:0},be=x(0,0,0,1),ve=f();export{ue 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 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{d 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 u,expandWithAABB as _,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 E}from"../../support/renderInfoUtils/line.js";import{Object3D as A}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._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null,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))}layerScreenSizePerspectiveChanged(){const e=this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null;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 A({geometries:s,castShadow:!1,layerViewUid:c,graphicUid:r}),u=new P(this,h,null,g,t);return u.alignedSampledElevation=l.sampledElevation,u.needsElevationUpdates=v(t.mode),u}_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}),u={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:u},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=u(),h=E(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;_(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"../../../../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{d 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 d,expandWithBuffer as u}from"../../../../geometry/support/aaBoundingBox.js";import{getDriverAxisSizeValueAny as g}from"../../../../renderers/support/renderingInfoUtils.js";import{sharedGeometryElevationAligner as f}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(g(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,f,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),g="polygon"===r.type?"rings":"paths";this._logGeometryCreationWarnings(h,i,g,"LineSymbol3DLayer");for(const p of h.lines){if(m(p.position,n),!y(n,this._context.clippingExtent))continue;d(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||u(n,p.position,0,1),"end"!==r&&"begin-end"!==r||u(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};
@@ -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{pt2px as t}from"../../../../core/screenUtils.js";import{e as i}from"../../../../chunks/earcut.js";import{ZEROS as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromBuffer as s,create as o,intersectsClippingArea as n,empty as a,expandWithAABB as l}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as c,doubleSubArray as p}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as h,floatSubArray as u}from"../../../../geometry/support/FloatArray.js";import{elevationModeChangeUpdateType as d,needsElevationUpdates2D as m}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as _}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as g}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as y}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as f}from"./graphicUtils.js";import{parseCapType as v}from"./lineUtils.js";import{geometryAsPolygon as b,createIndices3D as x,createColorGeometry as C,PolygonCreationDataBase as S}from"./polygonUtils.js";import{initFastSymbolUpdatesState as P,updateFastSymbolUpdatesState as D,getAttributeValue as O,ConvertOptions as U}from"../support/FastSymbolUpdates.js";import{createMaterial as j,uvElevationAligner as w}from"../support/patternUtils.js";import{createMapSpaceUVCoords as G,createMapSpaceUVCoordsDraped as A}from"../support/uvUtils.js";import{createGeometry as E}from"../../support/engineContent/line.js";import{geometryToRenderInfo as M,geometryToRenderInfoDraped as V}from"../../support/renderInfoUtils/polygon.js";import{Object3D as L}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as R}from"../../webgl-engine/lib/RenderGeometry.js";import{isScreenSizePerspectiveEnabled as z}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{getStipplePatternForLinePattern as B}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as F}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as I}from"../../webgl-engine/materials/RibbonLineMaterial.js";const T=["polyline","polygon","extent"];class H extends y{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,i,r){super(e,t,i,r,K(t)),this._needsUV=!1,this._materials=[]}async doLoad(){this._fastUpdates=P(this._context.renderer,this._vvConvertOptions)}get _materialColor(){return this.symbolLayer.material?.color}_createMaterials(){if(this._materials.length>0)return;const e=this._materialColor,i=this._getCombinedOpacityAndColor(e);this._materials[0]=j(this.symbolLayer,{color:i,forceTransparentMode:this.needsDrivenTransparentPass,discardInvisibleFragments:!0,polygonOffset:!1,hasVertexColors:!0,draped:this.draped,hasSlicePlane:this._context.slicePlaneEnabled,...this._fastUpdates?.materialParameters}),this._needsUV=this._materials[0]instanceof F;const r=this.symbolLayer.outline;if(J(r)){const e=B(r.pattern);this._materials[1]=new I({width:t(r.size),color:this._getOutlineColor(),hasPolygonOffset:!0,hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:e,cap:v(r.patternCap||"butt"),screenSizePerspective:this._outlineScreenSizePerspective},this.view.state.isGlobal)}}get _outlineScreenSizePerspective(){return!this.draped&&z(this._context.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,T,this.symbolLayer.type))return null;const i=this._getDrivenUInt8Color(e.renderingInfo,this._materialColor,!1),r=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this._createMaterials(),this.draped?this._createAsOverlay(t,i):this._createAs3DShape(t,i,r)}applyRendererDiff(e,t){for(const i in e.diff){if("visualVariables"!==i)return 0;if(!D(this._fastUpdates,t,this._vvConvertOptions))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}layerOpacityChanged(){if(null!=this._materials[0]){const e=this._materials[0].parameters.color,t=this._materialColor,i=this._getCombinedOpacity(t);this._materials[0].setParameters({color:[e[0],e[1],e[2],i],forceTransparentMode:this.needsDrivenTransparentPass})}if(null!=this._materials[1]){const e=this._materials[1].parameters.color;this._materials[1].setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerScreenSizePerspectiveChanged(){this._materials[1]?.setParameters({screenSizePerspective:this._outlineScreenSizePerspective})}layerElevationInfoChanged(e,t,i){const r=this._elevationContext.mode,s=d(H.elevationModeChangeTypes,i,r);if(1!==s)return s;const o=m(r);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>o)}slicePlaneEnabledChanged(){if(this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]){const e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[1].setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,i){const r=b(e.geometry);if(!r)return null;const s=M(r,this._context.elevationProvider,this._context.renderCoordsHelper,i),o=new W(s,t,this._context.layerViewUid,e.uid),n=o.renderData.position.length/3;if(this._needsUV&&(o.uvMapSpace=h(4*n,!0),o.boundingRect=c(9*n),G(o.uvMapSpace,o.boundingRect,o.renderData.position,this._context.renderCoordsHelper)),o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAs3DShapeFill(e,o),this._materials[1]&&this._createAs3DShapeOutline(o),this._logGeometryCreationWarnings(o.renderData,r.rings,"rings","FillSymbol3DLayer"),0===o.outGeometries.length)return null;const a=new L({geometries:o.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:e.uid}),l=new g(this,a,null,w,i);return l.alignedSampledElevation=o.renderData.sampledElevation,l.needsElevationUpdates=m(i.mode),l}_createAs3DShapeFill(e,t){const i=t.renderData.polygons;for(const{position:r,mapPositions:o,holeIndices:a,index:l,count:c}of i){if(null!=this._context.clippingExtent&&(s(o,k),!n(k,this._context.clippingExtent)))continue;const i=x(o,a,this._context.elevationProvider.spatialReference);if(0===i.length)continue;const h=this._fastUpdates?.visualVariables.color,d=C({material:this._materials[0],indices:i,mapPositions:o,attributeData:{position:r,color:h?null:t.color,colorFeature:h?O(h.field,e):null,uvMapSpace:this._needsUV?u(t.uvMapSpace,4*l,4*c):null,boundingRect:this._needsUV?p(t.boundingRect,9*l,9*c):null,olidColor:t.olidColor}});t.outGeometries.push(d)}}_createAs3DShapeOutline(e){if(null==this._materials[1])return;const t=e.renderData.outlines;for(const{mapPositions:i,position:r}of t){if(null!=this._context.clippingExtent&&(s(i,k),!n(k,this._context.clippingExtent)))continue;const t=E(this._materials[1],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:i,attributeData:{position:r}},e.olidColor);e.outGeometries.push(t)}}_createAsOverlay(e,t){const i=b(e.geometry);if(null==i)return null;this._materials[0].renderPriority=this._renderPriority+this._renderPriorityStep/2,null!=this._materials[1]&&(this._materials[1].renderPriority=this._renderPriority);const r=V(i,this._context.overlaySR),s=new q(r,t,this._context.layerViewUid,e.uid),o=s.renderData.position.length/3;return this._needsUV&&(s.uvMapSpace=h(4*o,!0),A(s.uvMapSpace,s.renderData.position,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),s.outBoundingBox=a(),s.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(s),this._createAsOverlayFill(e,s),this._materials[1]&&this._createAsOverlayOutline(s),this._logGeometryCreationWarnings(s.renderData,i.rings,"rings","FillSymbol3DLayer"),0===s.outGeometries.length?null:new _(this,s.outGeometries,s.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,t){const r=t.renderData.polygons;for(const{position:o,holeIndices:a,index:c,count:p}of r){const r=s(o,k);if(!n(r,this._context.clippingExtent))continue;const h=i(o,a,3);if(0===h.length)continue;l(t.outBoundingBox,r);const d=this._fastUpdates?.visualVariables.color,m=C({material:this._materials[0],indices:h,attributeData:{position:o,color:d?null:t.color,colorFeature:d?O(d.field,e):null,uvMapSpace:this._needsUV?u(t.uvMapSpace,4*c,4*p):null,olidColor:t.olidColor}});t.outGeometries.push(new R(m,t))}}_createAsOverlayOutline(e){if(null==this._materials[1])return;const t=e.renderData.outlines;for(let i=0;i<t.length;++i){const{position:r}=t[i];if(s(r,k),!n(k,this._context.clippingExtent))continue;l(e.outBoundingBox,k);const o=E(this._materials[1],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:r}},e.olidColor);e.outGeometries.push(new R(o,e))}}_getOutlineOpacity(){const e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(null!=e?e.a:0)}_getOutlineColor(){const t=this.symbolLayer?.outline?.color,i=this._getOutlineOpacity();return f(null!=t?e.toUnitRGB(t):null,i)}test(){return{...super.test(),createAsOverlay:(e,t)=>this._createAsOverlay(e,t),createAs3DShape:(e,t,i)=>this._createAs3DShape(e,t,i)}}get _vvConvertOptions(){return new U({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:e.toUnitRGBA(this._materialColor)??r})}}const k=o();class W extends S{constructor(e,t,i,r){super(e,i,r),this.color=t}}class q extends S{constructor(e,t,i,r){super(e,i,r),this.color=t}}function J(e){return null!=e?.size&&e.size>0&&null!=e.color&&(null==e.pattern||"style"!==e.pattern.type||"none"!==e.pattern.style)}function K(e){return 1===(e.material?.color?.a??0)}export{H as Graphics3DPolygonFillSymbolLayer};
5
+ import e from"../../../../Color.js";import{pt2px as t}from"../../../../core/screenUtils.js";import{e as i}from"../../../../chunks/earcut.js";import{ZEROS as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromBuffer as s,create as o,intersectsClippingArea as n,empty as a,expandWithAABB as l}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as c,doubleSubArray as p}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as h,floatSubArray as u}from"../../../../geometry/support/FloatArray.js";import{elevationModeChangeUpdateType as d,needsElevationUpdates2D as m}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as _}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as g}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as y}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as f}from"./graphicUtils.js";import{parseCapType as v}from"./lineUtils.js";import{geometryAsPolygon as b,createIndices3D as x,createColorGeometry as C,PolygonCreationDataBase as S}from"./polygonUtils.js";import{initFastSymbolUpdatesState as P,updateFastSymbolUpdatesState as D,getAttributeValue as O,ConvertOptions as U}from"../support/FastSymbolUpdates.js";import{createMaterial as j,uvElevationAligner as w}from"../support/patternUtils.js";import{createMapSpaceUVCoords as G,createMapSpaceUVCoordsDraped as A}from"../support/uvUtils.js";import{createGeometry as E}from"../../support/engineContent/line.js";import{polygonToRenderInfo as M,polygonToRenderInfoDraped as V}from"../../support/renderInfoUtils/polygon.js";import{Object3D as L}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as R}from"../../webgl-engine/lib/RenderGeometry.js";import{isScreenSizePerspectiveEnabled as z}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{getStipplePatternForLinePattern as B}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as F}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as I}from"../../webgl-engine/materials/RibbonLineMaterial.js";const T=["polyline","polygon","extent"];class H extends y{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,i,r){super(e,t,i,r,K(t)),this._needsUV=!1,this._materials=[]}async doLoad(){this._fastUpdates=P(this._context.renderer,this._vvConvertOptions)}get _materialColor(){return this.symbolLayer.material?.color}_createMaterials(){if(this._materials.length>0)return;const e=this._materialColor,i=this._getCombinedOpacityAndColor(e);this._materials[0]=j(this.symbolLayer,{color:i,forceTransparentMode:this.needsDrivenTransparentPass,discardInvisibleFragments:!0,polygonOffset:!1,hasVertexColors:!0,draped:this.draped,hasSlicePlane:this._context.slicePlaneEnabled,...this._fastUpdates?.materialParameters}),this._needsUV=this._materials[0]instanceof F;const r=this.symbolLayer.outline;if(J(r)){const e=B(r.pattern);this._materials[1]=new I({width:t(r.size),color:this._getOutlineColor(),hasPolygonOffset:!0,hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:e,cap:v(r.patternCap||"butt"),screenSizePerspective:this._outlineScreenSizePerspective},this.view.state.isGlobal)}}get _outlineScreenSizePerspective(){return!this.draped&&z(this._context.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,T,this.symbolLayer.type))return null;const i=this._getDrivenUInt8Color(e.renderingInfo,this._materialColor,!1),r=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this._createMaterials(),this.draped?this._createAsOverlay(t,i):this._createAs3DShape(t,i,r)}applyRendererDiff(e,t){for(const i in e.diff){if("visualVariables"!==i)return 0;if(!D(this._fastUpdates,t,this._vvConvertOptions))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}layerOpacityChanged(){if(null!=this._materials[0]){const e=this._materials[0].parameters.color,t=this._materialColor,i=this._getCombinedOpacity(t);this._materials[0].setParameters({color:[e[0],e[1],e[2],i],forceTransparentMode:this.needsDrivenTransparentPass})}if(null!=this._materials[1]){const e=this._materials[1].parameters.color;this._materials[1].setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerScreenSizePerspectiveChanged(){this._materials[1]?.setParameters({screenSizePerspective:this._outlineScreenSizePerspective})}layerElevationInfoChanged(e,t,i){const r=this._elevationContext.mode,s=d(H.elevationModeChangeTypes,i,r);if(1!==s)return s;const o=m(r);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>o)}slicePlaneEnabledChanged(){if(this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]){const e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[1].setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,i){const r=b(e.geometry);if(!r)return null;const s=M(r,this._context.elevationProvider,this._context.renderCoordsHelper,i),o=new W(s,t,this._context.layerViewUid,e.uid),n=o.renderData.position.length/3;if(this._needsUV&&(o.uvMapSpace=h(4*n,!0),o.boundingRect=c(9*n),G(o.uvMapSpace,o.boundingRect,o.renderData.position,this._context.renderCoordsHelper)),o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAs3DShapeFill(e,o),this._materials[1]&&this._createAs3DShapeOutline(o),this._logGeometryCreationWarnings(o.renderData,r.rings,"rings","FillSymbol3DLayer"),0===o.outGeometries.length)return null;const a=new L({geometries:o.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:e.uid}),l=new g(this,a,null,w,i);return l.alignedSampledElevation=o.renderData.sampledElevation,l.needsElevationUpdates=m(i.mode),l}_createAs3DShapeFill(e,t){const i=t.renderData.polygons;for(const{position:r,mapPositions:o,holeIndices:a,index:l,count:c}of i){if(null!=this._context.clippingExtent&&(s(o,k),!n(k,this._context.clippingExtent)))continue;const i=x(o,a,this._context.elevationProvider.spatialReference);if(0===i.length)continue;const h=this._fastUpdates?.visualVariables.color,d=C({material:this._materials[0],indices:i,mapPositions:o,attributeData:{position:r,color:h?null:t.color,colorFeature:h?O(h.field,e):null,uvMapSpace:this._needsUV?u(t.uvMapSpace,4*l,4*c):null,boundingRect:this._needsUV?p(t.boundingRect,9*l,9*c):null,olidColor:t.olidColor}});t.outGeometries.push(d)}}_createAs3DShapeOutline(e){if(null==this._materials[1])return;const t=e.renderData.outlines;for(const{mapPositions:i,position:r}of t){if(null!=this._context.clippingExtent&&(s(i,k),!n(k,this._context.clippingExtent)))continue;const t=E(this._materials[1],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:i,attributeData:{position:r}},e.olidColor);e.outGeometries.push(t)}}_createAsOverlay(e,t){const i=b(e.geometry);if(null==i)return null;this._materials[0].renderPriority=this._renderPriority+this._renderPriorityStep/2,null!=this._materials[1]&&(this._materials[1].renderPriority=this._renderPriority);const r=V(i,this._context.overlaySR),s=new q(r,t,this._context.layerViewUid,e.uid),o=s.renderData.position.length/3;return this._needsUV&&(s.uvMapSpace=h(4*o,!0),A(s.uvMapSpace,s.renderData.position,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),s.outBoundingBox=a(),s.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(s),this._createAsOverlayFill(e,s),this._materials[1]&&this._createAsOverlayOutline(s),this._logGeometryCreationWarnings(s.renderData,i.rings,"rings","FillSymbol3DLayer"),0===s.outGeometries.length?null:new _(this,s.outGeometries,s.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,t){const r=t.renderData.polygons;for(const{position:o,holeIndices:a,index:c,count:p}of r){const r=s(o,k);if(!n(r,this._context.clippingExtent))continue;const h=i(o,a,3);if(0===h.length)continue;l(t.outBoundingBox,r);const d=this._fastUpdates?.visualVariables.color,m=C({material:this._materials[0],indices:h,attributeData:{position:o,color:d?null:t.color,colorFeature:d?O(d.field,e):null,uvMapSpace:this._needsUV?u(t.uvMapSpace,4*c,4*p):null,olidColor:t.olidColor}});t.outGeometries.push(new R(m,t))}}_createAsOverlayOutline(e){if(null==this._materials[1])return;const t=e.renderData.outlines;for(let i=0;i<t.length;++i){const{position:r}=t[i];if(s(r,k),!n(k,this._context.clippingExtent))continue;l(e.outBoundingBox,k);const o=E(this._materials[1],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:r}},e.olidColor);e.outGeometries.push(new R(o,e))}}_getOutlineOpacity(){const e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(null!=e?e.a:0)}_getOutlineColor(){const t=this.symbolLayer?.outline?.color,i=this._getOutlineOpacity();return f(null!=t?e.toUnitRGB(t):null,i)}test(){return{...super.test(),createAsOverlay:(e,t)=>this._createAsOverlay(e,t),createAs3DShape:(e,t,i)=>this._createAs3DShape(e,t,i)}}get _vvConvertOptions(){return new U({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:e.toUnitRGBA(this._materialColor)??r})}}const k=o();class W extends S{constructor(e,t,i,r){super(e,i,r),this.color=t}}class q extends S{constructor(e,t,i,r){super(e,i,r),this.color=t}}function J(e){return null!=e?.size&&e.size>0&&null!=e.color&&(null==e.pattern||"style"!==e.pattern.type||"none"!==e.pattern.style)}function K(e){return 1===(e.material?.color?.a??0)}export{H as Graphics3DPolygonFillSymbolLayer};