@arcgis/core 4.23.0-next.20220118 → 4.23.0-next.20220126

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 (359) hide show
  1. package/Graphic.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/00c5bb5eecb0e89266df.js +1 -0
  4. package/assets/esri/core/workers/chunks/021a37e2b191298e80b7.js +1 -0
  5. package/assets/esri/core/workers/chunks/1370c92c40fd6271553c.js +1 -0
  6. package/assets/esri/core/workers/chunks/199670a3a564ebe3bd79.js +1 -0
  7. package/assets/esri/core/workers/chunks/1e4d37c2b9dc83d20a11.js +1 -0
  8. package/assets/esri/core/workers/chunks/1fbcc8424452d0256bd6.js +1 -0
  9. package/assets/esri/core/workers/chunks/{7c9d2638693d5f798b23.js → 23b15e7c2f96d260e16c.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{b2ae5fc4f787ea568b88.js → 2460f3b6ada6ae900dec.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{99f0d896c17dd09cd285.js → 2629adf79e7fd9f25f07.js} +1 -1
  12. package/assets/esri/core/workers/chunks/2792ca40f1e92849247c.js +1 -0
  13. package/assets/esri/core/workers/chunks/2a96f1bba9ce6883e5e0.js +1 -0
  14. package/assets/esri/core/workers/chunks/2e899ef5881b4ec6fa55.js +1 -0
  15. package/assets/esri/core/workers/chunks/3231ee3e090bb4cac3fc.js +1 -0
  16. package/assets/esri/core/workers/chunks/{0c3e3a5baf54bd5e210c.js → 36e250278b5622ccf068.js} +1 -1
  17. package/assets/esri/core/workers/chunks/395ba088d4864588ff66.js +1 -0
  18. package/assets/esri/core/workers/chunks/3cc77692b2eee27b9c9e.js +1 -0
  19. package/assets/esri/core/workers/chunks/3f343f792fd9f44d6f25.js +1 -0
  20. package/assets/esri/core/workers/chunks/{8a250ec51097f16feb66.js → 40a1e713f63ec77110c0.js} +1 -1
  21. package/assets/esri/core/workers/chunks/422537fc3df707bb62c9.js +1 -0
  22. package/assets/esri/core/workers/chunks/{ba6fdaed6c315dc13981.js → 434b16731c6a81f868ef.js} +1 -1
  23. package/assets/esri/core/workers/chunks/4385a268c2a64281d1c1.js +1 -0
  24. package/assets/esri/core/workers/chunks/{44b01d42d4ec72913229.js → 438f0b5ae5c53ae4f06a.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{4d539878bfbd7c549e60.js → 46b4bb66a54bbd8e2e57.js} +1 -1
  26. package/assets/esri/core/workers/chunks/4c76146014dc15143ba3.js +1 -0
  27. package/assets/esri/core/workers/chunks/5a4a5585ec8027079f32.js +1 -0
  28. package/assets/esri/core/workers/chunks/5d991b74d958005c26c4.js +1 -0
  29. package/assets/esri/core/workers/chunks/5dfe1f8d520025e2118b.js +1 -0
  30. package/assets/esri/core/workers/chunks/601e697dc7414bda128a.js +1 -0
  31. package/assets/esri/core/workers/chunks/663ad15b86936eb06b69.js +1 -0
  32. package/assets/esri/core/workers/chunks/68a59ce98177d8513337.js +1 -0
  33. package/assets/esri/core/workers/chunks/{9cdaba126ac7fa5f33f0.js → 6cd5e4380d29b9a3c344.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{a7b1b75643ed31489495.js → 6f50a9647f026a8d4729.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{47395d225229d237f0ac.js → 7bc5cc5dbf1b7b70ddac.js} +1 -1
  36. package/assets/esri/core/workers/chunks/7d661129a0d8c466eeec.js +1 -0
  37. package/assets/esri/core/workers/chunks/{64276aacaafa4c8a15bd.js → 7dcf52d3db3903c8eb9f.js} +1 -1
  38. package/assets/esri/core/workers/chunks/8070972c0efb78523b68.js +1 -0
  39. package/assets/esri/core/workers/chunks/8fa0a14165d43ffe87a5.js +1 -0
  40. package/assets/esri/core/workers/chunks/94515fb3ef38067eeadd.js +1 -0
  41. package/assets/esri/core/workers/chunks/94b8dbf859df71858d1c.js +1 -0
  42. package/assets/esri/core/workers/chunks/97a28641b3b2fd31bea2.js +1 -0
  43. package/assets/esri/core/workers/chunks/{d1454155ee1b8a421cbb.js → 97ec9eef0048760fa260.js} +1 -1
  44. package/assets/esri/core/workers/chunks/98986e6601b0366376b4.js +1 -0
  45. package/assets/esri/core/workers/chunks/9cdcf9309d6feda70185.js +1 -0
  46. package/assets/esri/core/workers/chunks/a78757b9c7e8cbea08fa.js +1 -0
  47. package/assets/esri/core/workers/chunks/aa04b90b82bf70caaae4.js +1 -0
  48. package/assets/esri/core/workers/chunks/{b10fcbe1393c812fc219.js → aa861b8eae6c85f3dad4.js} +1 -1
  49. package/assets/esri/core/workers/chunks/aace7e1fef256bb961c9.js +1 -0
  50. package/assets/esri/core/workers/chunks/{ed0297fc61014e848c18.js → af5694b4d278cf1db2d9.js} +1 -1
  51. package/assets/esri/core/workers/chunks/afbb4f802ca5774f0326.js +1 -0
  52. package/assets/esri/core/workers/chunks/b0b036ad3ad3cd956747.js +1 -0
  53. package/assets/esri/core/workers/chunks/b2c5f92e3d7606297ca9.js +1 -0
  54. package/assets/esri/core/workers/chunks/b2d2de935487257c568b.js +1 -0
  55. package/assets/esri/core/workers/chunks/b2ebe4f6d100e15b512d.js +1 -0
  56. package/assets/esri/core/workers/chunks/b8316c6469a543029bc6.js +1 -0
  57. package/assets/esri/core/workers/chunks/{4b69129c0557852d9b3d.js → ba5eb394f098968c22d2.js} +1 -1
  58. package/assets/esri/core/workers/chunks/bf0a65b4be31959f921d.js +1 -0
  59. package/assets/esri/core/workers/chunks/bf6dda4a2af14c4b7716.js +1 -0
  60. package/assets/esri/core/workers/chunks/c890c7fca27170e3341f.js +1 -0
  61. package/assets/esri/core/workers/chunks/{573dc3064e84ca86844d.js → c959e0d1cf7dce0421b9.js} +1 -1
  62. package/assets/esri/core/workers/chunks/c976785f2391c77d8a30.js +1 -0
  63. package/assets/esri/core/workers/chunks/{1fd48459afb58a6cf14f.js → ca2f5faa01d99c21ec14.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{7aa543a97f055cddea99.js → cc146c57bbdac8029fd8.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{d39b7983b68d6e5b404d.js → cdbc005eebec1503b99d.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{7e596478507466953e65.js → cef4af64860ebbfc1c47.js} +1 -1
  67. package/assets/esri/core/workers/chunks/d72488db62fcf39447b6.js +1 -0
  68. package/assets/esri/core/workers/chunks/de6cff7b6cbbf99b20d1.js +981 -0
  69. package/assets/esri/core/workers/chunks/e4b84ca8ddfd48dd79b1.js +1 -0
  70. package/assets/esri/core/workers/chunks/e4e2036373166c1d5cf5.js +1 -0
  71. package/assets/esri/core/workers/chunks/e4f93c55eaefab4192b5.js +1 -0
  72. package/assets/esri/core/workers/chunks/e6165e17fbb07bfc40a1.js +1 -0
  73. package/assets/esri/core/workers/chunks/e9e5196b44b6923be1a3.js +1 -0
  74. package/assets/esri/core/workers/chunks/{f678293de9a6d8f5b5db.js → ec89466f76d0ba22525e.js} +1 -1
  75. package/assets/esri/core/workers/chunks/ee45618c45806ab654cb.js +1 -0
  76. package/assets/esri/core/workers/chunks/f4baa5ea2e42b1317941.js +1 -0
  77. package/assets/esri/core/workers/chunks/f760a3e030b0f358a92a.js +1 -0
  78. package/assets/esri/core/workers/chunks/face43cf5abcd2f5bd9d.js +1 -0
  79. package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
  80. package/assets/esri/themes/base/_mixins.scss +4 -1
  81. package/assets/esri/themes/base/icons/style.scss +11 -2
  82. package/assets/esri/themes/base/widgets/_BasemapLayerList.scss +13 -10
  83. package/assets/esri/themes/base/widgets/_CoordinateConversion.scss +4 -2
  84. package/assets/esri/themes/base/widgets/_Directions.scss +5 -3
  85. package/assets/esri/themes/base/widgets/_Editor.scss +5 -2
  86. package/assets/esri/themes/base/widgets/_ElevationProfile.scss +6 -4
  87. package/assets/esri/themes/base/widgets/_FeatureTable.scss +6 -0
  88. package/assets/esri/themes/base/widgets/_ItemList.scss +1 -1
  89. package/assets/esri/themes/base/widgets/_LayerList.scss +13 -9
  90. package/assets/esri/themes/base/widgets/_Popup.scss +4 -2
  91. package/assets/esri/themes/base/widgets/_Print.scss +24 -11
  92. package/assets/esri/themes/base/widgets/_Search.scss +4 -2
  93. package/assets/esri/themes/base/widgets/_TableList.scss +9 -7
  94. package/assets/esri/themes/base/widgets/_Weather.scss +12 -0
  95. package/assets/esri/themes/base/widgets/_Widget.scss +18 -9
  96. package/assets/esri/themes/dark/main.css +1 -1
  97. package/assets/esri/themes/dark-blue/main.css +1 -1
  98. package/assets/esri/themes/dark-green/main.css +1 -1
  99. package/assets/esri/themes/dark-purple/main.css +1 -1
  100. package/assets/esri/themes/dark-red/main.css +1 -1
  101. package/assets/esri/themes/light/main.css +1 -1
  102. package/assets/esri/themes/light/view.css +1 -1
  103. package/assets/esri/themes/light-blue/main.css +1 -1
  104. package/assets/esri/themes/light-green/main.css +1 -1
  105. package/assets/esri/themes/light-purple/main.css +1 -1
  106. package/assets/esri/themes/light-red/main.css +1 -1
  107. package/assets/esri/widgets/Weather/t9n/Weather.json +1 -1
  108. package/assets/esri/widgets/Weather/t9n/Weather_en.json +1 -1
  109. package/chunks/CloudsComposition.glsl.js +4 -4
  110. package/chunks/ComponentShader.glsl.js +19 -19
  111. package/chunks/DefaultMaterial.glsl.js +2 -2
  112. package/chunks/Terrain.glsl.js +11 -11
  113. package/chunks/WaterSurface.glsl.js +21 -21
  114. package/chunks/pe.js +1 -1
  115. package/chunks/vec3.js +1 -1
  116. package/chunks/vxlLayer.js +1 -1
  117. package/core/accessorSupport/ensureType.js +1 -1
  118. package/core/accessorSupport/get.js +1 -1
  119. package/core/accessorSupport/read.js +1 -1
  120. package/core/accessorSupport/set.js +1 -1
  121. package/core/accessorSupport/write.js +1 -1
  122. package/core/has.js +1 -1
  123. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  124. package/core/typedArrayUtil.js +1 -1
  125. package/core/workers/workerFactory.js +1 -1
  126. package/geometry/pe.js +1 -1
  127. package/geometry/support/axisAngleDegrees.js +1 -1
  128. package/geometry/support/heightModelInfoUtils.js +1 -1
  129. package/interfaces.d.ts +315 -78
  130. package/layers/RouteLayer.js +1 -1
  131. package/layers/VoxelLayer.js +1 -1
  132. package/layers/VoxelWasmPerScene.js +1 -1
  133. package/layers/mixins/OperationalLayer.js +1 -1
  134. package/layers/support/RasterWorker.js +1 -1
  135. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  136. package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
  137. package/libs/vxl/enums.js +1 -1
  138. package/package.json +2 -2
  139. package/popup/content/AttachmentsContent.js +1 -1
  140. package/popup/content/support/mediaInfoTypes.js +1 -1
  141. package/portal/schemas/buildingSceneLayerItem.js +1 -1
  142. package/portal/schemas/definitions.js +1 -1
  143. package/portal/schemas/integratedMeshLayerItem.js +1 -1
  144. package/portal/schemas/pointCloudLayerItem.js +1 -1
  145. package/portal/schemas/sceneLayerItem.js +1 -1
  146. package/portal/schemas/webScene.js +1 -1
  147. package/rasterRenderers.js +1 -1
  148. package/rest/find.js +1 -1
  149. package/rest/geometryService/generalize.js +1 -1
  150. package/rest/geometryService/lengths.js +1 -1
  151. package/rest/geometryService/offset.js +1 -1
  152. package/rest/geometryService/relation.js +1 -1
  153. package/rest/geometryService/trimExtend.js +1 -1
  154. package/rest/identify.js +1 -1
  155. package/{tasks → rest}/operations/find.js +0 -0
  156. package/{tasks → rest}/operations/generalize.js +0 -0
  157. package/rest/operations/identify.js +5 -0
  158. package/{tasks → rest}/operations/lengths.js +0 -0
  159. package/{tasks → rest}/operations/offset.js +0 -0
  160. package/{tasks → rest}/operations/relation.js +0 -0
  161. package/{tasks → rest}/operations/trimExtend.js +0 -0
  162. package/{tasks → rest}/operations/urlUtils.js +0 -0
  163. package/rest/print.js +1 -1
  164. package/rest/query/operations/query.js +1 -1
  165. package/rest/query/operations/queryAttachments.js +1 -1
  166. package/rest/query/operations/queryRelatedRecords.js +1 -1
  167. package/rest/query/operations/queryTopFeatures.js +1 -1
  168. package/rest/route/utils.js +1 -1
  169. package/rest/support/NetworkServiceDescription.js +1 -1
  170. package/rest/support/RouteInfo.js +1 -1
  171. package/rest/support/RouteParameters.js +1 -1
  172. package/rest/support/RouteSettings.js +5 -0
  173. package/rest/support/Stop.js +1 -1
  174. package/rest/support/networkEnums.js +1 -1
  175. package/support/revision.js +1 -1
  176. package/symbols/Font.js +1 -1
  177. package/symbols/LabelSymbol3D.js +1 -1
  178. package/symbols/PointSymbol3D.js +1 -1
  179. package/symbols/TextSymbol.js +1 -1
  180. package/symbols/TextSymbol3DLayer.js +1 -1
  181. package/symbols/cim/CIMSymbolHelper.js +1 -1
  182. package/symbols/cim/CIMSymbolRasterizer.js +1 -1
  183. package/symbols/cim/cimAnalyzer.js +1 -1
  184. package/symbols/cim/placements/PlacementAlongLineSameSize.js +1 -1
  185. package/symbols/support/Symbol3DVerticalOffset.js +1 -1
  186. package/symbols/support/cimSymbolUtils.js +1 -1
  187. package/symbols/support/previewCIMSymbol.js +1 -1
  188. package/symbols/support/previewSymbol2D.js +1 -1
  189. package/symbols/support/previewSymbol3D.js +1 -1
  190. package/symbols/support/previewWebStyleSymbol.js +1 -1
  191. package/symbols/support/svgUtils.js +1 -1
  192. package/symbols/support/textUtils.js +5 -0
  193. package/symbols.js +1 -1
  194. package/views/2d/engine/vectorTiles/style/VectorTilesRequestManager.js +1 -1
  195. package/views/2d/engine/webgl/brushes/raster/BrushRasterBitmap.js +1 -1
  196. package/views/2d/engine/webgl/mesh/templates/WGLFillTemplate.js +1 -1
  197. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  198. package/views/2d/layers/features/sources/BaseFeatureSource.js +1 -1
  199. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  200. package/views/2d/support/engineHelpers.js +1 -1
  201. package/views/3d/environment/CloudsComposition.glsl.js +1 -1
  202. package/views/3d/environment/CloudsComposition.js +1 -1
  203. package/views/3d/environment/CloudsGenerator.js +1 -1
  204. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  205. package/views/3d/environment/Fog.js +1 -1
  206. package/views/3d/environment/SceneViewEnvironmentManager.js +1 -1
  207. package/views/3d/environment/weather.js +1 -1
  208. package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateMeshAdapter.js +1 -1
  209. package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
  210. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  211. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  212. package/views/3d/layers/GraphicsView3D.js +1 -1
  213. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  214. package/views/3d/layers/VoxelLayerView3D.js +1 -1
  215. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  216. package/views/3d/layers/graphics/Graphics3DDrapedGraphicLayer.js +1 -1
  217. package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
  218. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +5 -0
  219. package/views/3d/layers/graphics/Graphics3DFrustumVisibility.js +1 -1
  220. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  221. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  222. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  223. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  224. package/views/3d/layers/graphics/Graphics3DScaleVisibility.js +1 -1
  225. package/views/3d/layers/graphics/Graphics3DSymbolCreationContext.js +1 -1
  226. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  227. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  228. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  229. package/views/3d/layers/graphics/{Graphics3DGraphicLikeLayerView.js → GraphicsProcessor.js} +1 -1
  230. package/views/3d/layers/graphics/QueryEngine.js +1 -1
  231. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  232. package/views/3d/terrain/OverlayRenderer.js +1 -1
  233. package/views/3d/webgl-engine/core/shaderLibrary/Transform.glsl.js +7 -1
  234. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +28 -24
  235. package/views/3d/webgl-engine/core/shaderLibrary/shading/Water.glsl.js +21 -13
  236. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +2 -2
  237. package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +12 -14
  238. package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
  239. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  240. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  241. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  242. package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
  243. package/views/3d/webgl-engine/lib/TextRenderer.js +1 -1
  244. package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
  245. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  246. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  247. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  248. package/views/3d/webgl-engine/parts/Model.js +1 -1
  249. package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
  250. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  251. package/views/3d/webgl-engine/shaders/RealisticTreeTechnique.js +1 -1
  252. package/views/3d/webgl-engine/shaders/WaterSurface.glsl.js +1 -1
  253. package/views/SceneView.js +1 -1
  254. package/views/interactive/dragEventPipeline.js +1 -1
  255. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  256. package/views/support/DefaultsFromMap.js +1 -1
  257. package/views/webgl/ContextState.js +1 -1
  258. package/views/webgl/FramebufferObject.js +1 -1
  259. package/views/webgl/Renderbuffer.js +1 -1
  260. package/views/webgl/RenderingContext.js +1 -1
  261. package/views/webgl/Texture.js +1 -1
  262. package/views/webgl/Util.js +1 -1
  263. package/views/webgl/enums.js +1 -1
  264. package/views/webgl/rasterUtils.js +1 -1
  265. package/views/webgl/testFloatBufferBlend.js +1 -1
  266. package/widgets/Attachments.js +1 -1
  267. package/widgets/Editor/workflowUtils.js +1 -1
  268. package/widgets/Feature/FeatureExpression.js +1 -1
  269. package/widgets/Feature/FeatureMedia/FeatureMediaViewModel.js +1 -1
  270. package/widgets/Feature/FeatureMedia.js +1 -1
  271. package/widgets/Feature/FeatureViewModel.js +1 -1
  272. package/widgets/FeatureForm/InputField.js +1 -1
  273. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  274. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  275. package/widgets/FeatureTable.js +1 -1
  276. package/widgets/LayerList/LayerListViewModel.js +1 -1
  277. package/widgets/Popup/PopupViewModel.js +1 -1
  278. package/widgets/Popup/actionUtils.js +1 -1
  279. package/widgets/Slice/SliceViewModel.js +1 -1
  280. package/widgets/Slider/SliderViewModel.js +1 -1
  281. package/widgets/Slider.js +1 -1
  282. package/widgets/Weather/WeatherViewModel.js +1 -1
  283. package/widgets/Weather/css.js +1 -1
  284. package/widgets/Weather.js +1 -1
  285. package/widgets/support/InteractiveAnalysisViewModel.js +1 -1
  286. package/widgets/support/InteractiveToolViewModel.js +1 -1
  287. package/widgets/support/geolocationUtils.js +1 -1
  288. package/assets/components/assets/calcite-icon/checkSquareF16.json +0 -1
  289. package/assets/components/assets/calcite-icon/checkSquareF24.json +0 -1
  290. package/assets/components/assets/calcite-icon/checkSquareF32.json +0 -1
  291. package/assets/components/assets/calcite-icon/lineSolid4.json +0 -1
  292. package/assets/components/assets/calcite-icon/squareF16.json +0 -1
  293. package/assets/components/assets/calcite-icon/squareF24.json +0 -1
  294. package/assets/components/assets/calcite-icon/squareF32.json +0 -1
  295. package/assets/components/assets/calcite-icon/xHexagon16.json +0 -1
  296. package/assets/components/assets/calcite-icon/xHexagon24.json +0 -1
  297. package/assets/components/assets/calcite-icon/xHexagon32.json +0 -1
  298. package/assets/components/assets/calcite-icon/xHexagonF16.json +0 -1
  299. package/assets/components/assets/calcite-icon/xHexagonF24.json +0 -1
  300. package/assets/components/assets/calcite-icon/xHexagonF32.json +0 -1
  301. package/assets/components/assets/calcite-icon/xOctagonF16.json +0 -1
  302. package/assets/components/assets/calcite-icon/xOctagonF24.json +0 -1
  303. package/assets/components/assets/calcite-icon/xOctagonF32.json +0 -1
  304. package/assets/esri/core/workers/chunks/01ef8de7f76a8c61b464.js +0 -1
  305. package/assets/esri/core/workers/chunks/09da224052976e290828.js +0 -1
  306. package/assets/esri/core/workers/chunks/0f254c3e91e8fee55f28.js +0 -1
  307. package/assets/esri/core/workers/chunks/20411bb8e04703962ce6.js +0 -1
  308. package/assets/esri/core/workers/chunks/21a77eed1a4ef5b0ff08.js +0 -1
  309. package/assets/esri/core/workers/chunks/23745a5ab47c840dc452.js +0 -1
  310. package/assets/esri/core/workers/chunks/2416f8bf8bbd2ec786ab.js +0 -1
  311. package/assets/esri/core/workers/chunks/2d947080a27db6ce0d75.js +0 -1
  312. package/assets/esri/core/workers/chunks/2e445a8735ea2adb641a.js +0 -1
  313. package/assets/esri/core/workers/chunks/32f8c4af7e70ebdcb19e.js +0 -1
  314. package/assets/esri/core/workers/chunks/3564e14010953def6df9.js +0 -1
  315. package/assets/esri/core/workers/chunks/390d9021169e65c10eb8.js +0 -1
  316. package/assets/esri/core/workers/chunks/3a9740dccda6a733313c.js +0 -1
  317. package/assets/esri/core/workers/chunks/403c7d64f12f00330d88.js +0 -1
  318. package/assets/esri/core/workers/chunks/4409d77c9734de4e82a7.js +0 -1
  319. package/assets/esri/core/workers/chunks/4c301ca9c493b96df746.js +0 -1
  320. package/assets/esri/core/workers/chunks/60371c0f750cde87656d.js +0 -1
  321. package/assets/esri/core/workers/chunks/615aa2d3ecafe30c80c0.js +0 -1
  322. package/assets/esri/core/workers/chunks/631c5b514bb73782c570.js +0 -1
  323. package/assets/esri/core/workers/chunks/6c1e92ff4c732dfda756.js +0 -1
  324. package/assets/esri/core/workers/chunks/722a10c65456844d72b9.js +0 -1
  325. package/assets/esri/core/workers/chunks/75d53b28afe732c459b2.js +0 -1
  326. package/assets/esri/core/workers/chunks/85b34d91cf07567d6873.js +0 -1
  327. package/assets/esri/core/workers/chunks/8967288145f8fbd20e7d.js +0 -1
  328. package/assets/esri/core/workers/chunks/89de05207744149fb58b.js +0 -1
  329. package/assets/esri/core/workers/chunks/8fdd5bca3716816d359b.js +0 -1
  330. package/assets/esri/core/workers/chunks/987182b3a578fc7de251.js +0 -1
  331. package/assets/esri/core/workers/chunks/99a777693e4539f0b03b.js +0 -1
  332. package/assets/esri/core/workers/chunks/9d9dffc8884d66a258e4.js +0 -1
  333. package/assets/esri/core/workers/chunks/a28b53c61bddefb6616e.js +0 -1
  334. package/assets/esri/core/workers/chunks/a6ff3db3493543df81bc.js +0 -1
  335. package/assets/esri/core/workers/chunks/a8c13529367c037cdd94.js +0 -1
  336. package/assets/esri/core/workers/chunks/a960074644c3722be71e.js +0 -1
  337. package/assets/esri/core/workers/chunks/ac8dca61ade28c542ae2.js +0 -1
  338. package/assets/esri/core/workers/chunks/b99e69302ea701fff0ea.js +0 -971
  339. package/assets/esri/core/workers/chunks/b9de831ac379cf1d2969.js +0 -1
  340. package/assets/esri/core/workers/chunks/bc790b2f964144d10abe.js +0 -1
  341. package/assets/esri/core/workers/chunks/be2b7cce79fd41627931.js +0 -1
  342. package/assets/esri/core/workers/chunks/c13dfdd548dcb1bdb294.js +0 -1
  343. package/assets/esri/core/workers/chunks/c3eca92d02958732e141.js +0 -1
  344. package/assets/esri/core/workers/chunks/c6bd943fe8fd13bb4806.js +0 -1
  345. package/assets/esri/core/workers/chunks/c6f94b92e866b881d9b9.js +0 -1
  346. package/assets/esri/core/workers/chunks/cb68db7169b9dfd1c3ff.js +0 -1
  347. package/assets/esri/core/workers/chunks/cc96608b2802fbfe7a08.js +0 -1
  348. package/assets/esri/core/workers/chunks/cd02fe27eb07681cb366.js +0 -1
  349. package/assets/esri/core/workers/chunks/d52108864136c5a8a618.js +0 -1
  350. package/assets/esri/core/workers/chunks/da1c2873bdbc0956dca0.js +0 -1
  351. package/assets/esri/core/workers/chunks/dd433c160f7a0c120b82.js +0 -1
  352. package/assets/esri/core/workers/chunks/de03439ca2c9782bf325.js +0 -1
  353. package/assets/esri/core/workers/chunks/e2d68bcd2f99a65387bf.js +0 -1
  354. package/assets/esri/core/workers/chunks/ef8b75b92cf549e0507e.js +0 -1
  355. package/assets/esri/core/workers/chunks/f7fc4c993536e62f7f3e.js +0 -1
  356. package/assets/esri/core/workers/chunks/fd3e5d823dc7917f4b8f.js +0 -1
  357. package/symbols/support/constants.js +0 -5
  358. package/tasks/operations/identify.js +0 -5
  359. package/views/3d/layers/graphics/Graphics3DFeatureLikeLayerView.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import"../../../../core/has.js";import{isSome as t,isNone as r,unwrapOr as a,get as o}from"../../../../core/maybe.js";import{f as s,t as n}from"../../../../chunks/mat3.js";import{c as i}from"../../../../chunks/mat3f64.js";import{f as l,m as c,a as u}from"../../../../chunks/mat4.js";import{b as m,c as h}from"../../../../chunks/mat4f64.js";import{b as f,a as p,d,n as g,f as x,c as _}from"../../../../chunks/vec3.js";import{Z as y,O as b,c as v}from"../../../../chunks/vec3f64.js";import{O as T}from"../../../../chunks/vec4f64.js";import{projectVectorToDehydratedPoint as C,projectBuffer as O,computeTranslationToOriginAndRotation as A,canProjectWithoutEngine as M}from"../../../../geometry/projection.js";import{create as E,empty as w,expandWithBuffer as N,intersectsClippingArea as j}from"../../../../geometry/support/aaBoundingBox.js";import R from"../../../../geometry/support/MeshComponent.js";import P from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import{BufferViewVec3f64 as I,BufferViewVec3f as B}from"../../../../geometry/support/buffer/BufferView.js";import{t as F,a as S}from"../../../../chunks/vec32.js";import{transformPosition as L,transformNormal as U,projectNormalToPCPF as V,transformTangent as G,projectTangentToPCPF as $}from"../../../../geometry/support/meshUtils/projection.js";import{makeDehydratedPoint as D}from"../../../../layers/graphics/dehydratedFeatures.js";import{ViewingMode as k}from"../../../ViewingMode.js";import{perObjectElevationAligner as z}from"./ElevationAligners.js";import{needsElevationUpdates3D as q}from"./elevationAlignmentUtils.js";import{ElevationContext as H}from"./ElevationContext.js";import{Graphics3DObject3DGraphicLayer as W}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as Y}from"./Graphics3DSymbolLayer.js";import{createMaterial as Z}from"../support/edgeUtils.js";import{parseColorMixMode as J,encodeSymbolColor as K}from"../support/symbolColorUtils.js";import Q from"../../support/debugFlags.js";import{AlphaDiscardMode as X,CullFaceOptions as ee,VertexAttribute as te,PrimitiveType as re}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as ae}from"../../webgl-engine/lib/Geometry.js";import{generateDefaultIndexArray as oe}from"../../webgl-engine/lib/geometryDataUtils.js";import{Object3D as se}from"../../webgl-engine/lib/Object3D.js";import{Texture as ne}from"../../webgl-engine/lib/Texture.js";import{DefaultMaterial as ie}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as le}from"../../webgl-engine/materials/NativeLineMaterial.js";import{TextureWrapMode as ce}from"../../../webgl/enums.js";const ue=["mesh"];class me extends Y{constructor(e,t,r,a){super(e,t,r,a),this._materials=new Map,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){Q.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new le({color:[1,0,1,1]}),this._debugFaceNormalMaterial=new le({color:[0,1,1,1]}))}destroy(){super.destroy(),this._context.stage.removeMany(Array.from(this._materials.values(),(e=>e.material))),this._context.stage.removeMany(Array.from(this._textures.values())),this._materials.clear(),this._textures.clear()}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,ue,"fill on mesh-3d"))return null;const r=this.setGraphicElevationContext(t,new H),a=e.renderingInfo;return this._createAs3DShape(t,a,r,t.uid)}layerOpacityChanged(e,r){const a=this._getLayerOpacity();return this._materials.forEach((e=>{e.material.setParameters({layerOpacity:a});const t=e.material.parameters;this._setMaterialTransparentParameter(t,e),e.material.setParameters({transparent:t.transparent})})),e.forEach((e=>{const o=r(e);t(o)&&o.layerOpacityChanged(a,this._context.isAsync)})),!0}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,q)}slicePlaneEnabledChanged(e,r){return this._materials.forEach((e=>{e.material.setParameters({slicePlaneEnabled:this._context.slicePlaneEnabled})})),e.forEach((e=>{const a=r(e);t(a)&&a.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)})),!0}physicalBasedRenderingChanged(){const e=this._usePBR();return this._materials.forEach((t=>t.material.setParameters({usePBR:e}))),!0}pixelRatioChanged(){return!0}_requiresSymbolVertexColors(){return this._drivenProperties.color||this._drivenProperties.opacity}_colorOrTextureUid(t){return r(t)?"-":t instanceof e?t.toHex():t.contentHash}_materialPropertiesDefault(e,t){const r=this._requiresSymbolVertexColors(),a=!!e.vertexAttributes.color,o=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:r,hasVertexColors:a,hasVertexTangents:o,uid:`vc:${a},vt:${o},vct${t},svc:${r}`}}_materialProperties(e,t,r){const a=this._materialPropertiesDefault(e,r);if(!t.material)return a;const{color:o,colorTexture:s,normalTexture:n,doubleSided:i,alphaCutoff:l,alphaMode:c}=t.material,u=this._colorOrTextureUid(o),m=this._colorOrTextureUid(s),h=this._colorOrTextureUid(n);if(a.color=o,a.colorTexture=s,a.normalTexture=n,a.uid=`${a.uid},cmuid:${u},ctmuid:${m},ntmuid:${h},ds:${i},ac:${l},am:${c}`,t.material instanceof P){const{metallic:e,roughness:r,metallicRoughnessTexture:o,emissiveColor:s,emissiveTexture:n,occlusionTexture:i}=t.material,l=this._colorOrTextureUid(o),c=this._colorOrTextureUid(s),u=this._colorOrTextureUid(n),m=this._colorOrTextureUid(i);a.metallic=e,a.roughness=r,a.metallicRoughnessTexture=o,a.emissiveColor=s,a.emissiveTexture=n,a.occlusionTexture=i,a.uid=`${a.uid},mrm:${e},mrr:${r},mrt:${l},emuid:${c},etmuid:${u},otmuid:${m}`}return a}_setInternalColorValueParameters(t,r){r.diffuse=e.toUnitRGB(t),r.opacity=t.a}_getLoadableTextureResource(e){return e.data?e.data:e.url}_getInternalTextureId(e){const r=this._getInternalTexture(e,X.Opaque);return t(r)?r.id:null}_getInternalTexture(e,t){const r=this._getLoadableTextureResource(e);if(!r)return null;const a=`${e.contentHash}/${t}`;let o=this._textures.get(a);return o||(o=new ne(r,{mipmap:!0,wrap:this._castTextureWrap(e.wrap),noUnpackFlip:!0,preMultiplyAlpha:t!==X.Opaque}),this._textures.set(a,o),this._context.stage.add(o),this._context.stage.loadImmediate(o)),o}_castTextureWrap(e="repeat"){if("string"==typeof e){const t=this._castTextureWrapIndividual(e);return{s:t,t}}return{s:this._castTextureWrapIndividual(e.horizontal),t:this._castTextureWrapIndividual(e.vertical)}}_castTextureWrapIndividual(e){switch(e){case"clamp":return ce.CLAMP_TO_EDGE;case"mirror":return ce.MIRRORED_REPEAT;default:return ce.REPEAT}}_setInternalMaterialParameters(r,a){if(t(r.color)&&this._setInternalColorValueParameters(r.color,a),t(r.colorTexture)){const e=this._getInternalTexture(r.colorTexture,a.textureAlphaMode);t(e)?(a.textureId=e.id,a.textureAlphaPremultiplied=!!e.params.preMultiplyAlpha):a.textureId=void 0}t(r.normalTexture)&&(a.normalTextureId=this._getInternalTextureId(r.normalTexture)),t(r.emissiveColor)&&(a.emissiveFactor=e.toUnitRGB(r.emissiveColor)),t(r.emissiveTexture)&&(a.emissiveTextureId=this._getInternalTextureId(r.emissiveTexture)),t(r.occlusionTexture)&&(a.occlusionTextureId=this._getInternalTextureId(r.occlusionTexture)),t(r.metallicRoughnessTexture)&&(a.metallicRoughnessTextureId=this._getInternalTextureId(r.metallicRoughnessTexture))}_setExternalMaterialParameters(r){const a=this._drivenProperties.color;let o=t(this.symbolLayer.material)?this.symbolLayer.material.colorMixMode:null;if(a)r.externalColor=T;else{const a=t(this.symbolLayer.material)?this.symbolLayer.material.color:null;t(a)?r.externalColor=e.toUnitRGBA(a):(o=null,r.externalColor=T)}o&&(r.colorMixMode=o),r.castShadows=!!this.symbolLayer.castShadows}_hasTransparentVertexColors(e){const t=e.vertexAttributes.color;if(r(t))return!1;for(let r=3;r<t.length;r+=4)if(255!==t[r])return!0;return!1}_getOrCreateMaterial(e,r){var a,o,s;const n=null==(a=r.material)?void 0:a.color,i=null==(o=r.material)?void 0:o.colorTexture,l=null==(s=r.material)?void 0:s.alphaMode,c="blend"===l,u=!("opaque"===l)&&(this._hasTransparentVertexColors(e)||t(n)&&n.a<1||t(i)&&i.transparent||c),m=this._materialProperties(e,r,u),h=this._materials.get(m.uid);if(h)return h.material;const f={material:null,isComponentTransparent:u,alphaMode:r.material?r.material.alphaMode:"opaque"},p=null==m.metallicRoughnessTexture&&null==m.metallic&&null==m.roughness,d={usePBR:this._usePBR(),isSchematic:p,vertexColors:m.hasVertexColors,symbolColors:m.hasSymbolVertexColors,vertexTangents:m.hasVertexTangents,ambient:y,diffuse:b,opacity:1,doubleSided:!0,doubleSidedType:"winding-order",cullFace:ee.None,layerOpacity:this._getLayerOpacity(),slicePlaneEnabled:this._context.slicePlaneEnabled,initTextureTransparent:!0};p||(d.mrrFactors=[null!=m.metallic?m.metallic:1,null!=m.roughness?m.roughness:1,.5]),r.material&&(d.doubleSided=r.material.doubleSided,d.cullFace=r.material.doubleSided?ee.None:ee.Back,d.textureAlphaCutoff=r.material.alphaCutoff),this._setExternalMaterialParameters(d),this._setMaterialTransparentParameter(d,f),this._setInternalMaterialParameters(m,d);const g=new ie(d);return f.material=g,this._materials.set(m.uid,f),this._context.stage.add(g),g}_usePBR(){return this._context.physicalBasedRenderingEnabled}_setMaterialTransparentParameter(e,t){e.transparent=this.needsDrivenTransparentPass||t.isComponentTransparent||e.layerOpacity<1||e.opacity<1||e.externalColor&&e.externalColor[3]<1,"auto"===t.alphaMode?e.textureAlphaMode=e.transparent?X.MaskBlend:X.Opaque:e.textureAlphaMode="opaque"===t.alphaMode?X.Opaque:"mask"===t.alphaMode?X.Mask:X.Blend}_addDebugNormals(e,t,r,a){const o=t.length,s=e.spatialReference.isGeographic?20015077/180:1,n=.1*Math.max(e.extent.width*s,e.extent.height*s,e.extent.zmax-e.extent.zmin),i=[],l=[],c=[],u=[];for(let m=0;m<o;m++){const e=t[m],r=e.vertexAttributes.get(te.POSITION),a=e.vertexAttributes.get(te.NORMAL),o=e.indices.get(te.POSITION),s=e.indices.get(te.NORMAL),h=r.data,d=a.data;for(let t=0;t<o.length;t++){const e=3*o[t],r=3*s[t];for(let t=0;t<3;t++)i.push(h[e+t]);for(let t=0;t<3;t++)i.push(h[e+t]+d[r+t]*n);if(l.push(l.length),l.push(l.length),t%3==0){this._calculateFaceNormal(h,o,t,ge),this._getFaceVertices(h,o,t,fe,pe,de),f(fe,fe,pe),f(fe,fe,de),p(fe,fe,1/3);for(let e=0;e<3;e++)c.push(fe[e]);for(let e=0;e<3;e++)c.push(fe[e]+ge[e]*n);u.push(u.length),u.push(u.length)}}}const h=new ae([[te.POSITION,{data:i,size:3,exclusive:!0}]],[[te.POSITION,new Uint32Array(l)]],re.Line);t.push(h),r.push(this._debugVertexNormalMaterial),a.push(m(a[0]));const d=new ae([[te.POSITION,{data:c,size:3,exclusive:!0}]],[[te.POSITION,new Uint32Array(u)]],re.Line);t.push(d),r.push(this._debugFaceNormalMaterial),a.push(m(a[0]))}_createAs3DShape(e,r,a,o){const s=e.geometry;if("mesh"!==s.type)return null;const n=this._createGeometryInfo(s,r);if(!n)return null;const{geometries:i,materials:l,transformations:c,objectTransformation:u}=n;Q.DRAW_MESH_GEOMETRY_NORMALS&&this._addDebugNormals(s,i,l,c);const m=new se({geometries:i,materials:l,transformations:c,metadata:{layerUid:this._context.layer.uid,graphicUid:o}});m.transformation=u;const h=this._createEdgeMaterial(),f=t(h)?{baseMaterial:l[0],edgeMaterials:[h],properties:{mergeGeometries:!0,slicePlaneEnabled:this._context.slicePlaneEnabled}}:null,p=new W(this,m,i,null,null,z,a,f);return p.needsElevationUpdates=q(a.mode),p.useObjectOriginAsAttachmentOrigin=!0,p.elevationContext.centerPointInElevationSR=this._getCenterPointInElevationSR(m),p.alignedSampledElevation=z(p,p.elevationContext,this._context.elevationProvider,this._context.renderCoordsHelper),p}_getCenterPointInElevationSR(e){const t=D(0,0,0,this._context.elevationProvider.spatialReference);return C([e.transformation[12],e.transformation[13],e.transformation[14]],this._context.renderCoordsHelper.spatialReference,t),t}_createComponentNormals(e,t,r,a){switch(r.shading||"flat"){case"source":return this._createComponentNormalsSource(e,t,r,a);case"flat":return this._createComponentNormalsFlat(e,a);case"smooth":return this._createComponentNormalsSmooth(e,a);default:return}}_createComponentNormalsSource(e,t,a,o){if(r(t))return this._createComponentNormalsFlat(e,o);let s=!1;if(!a.trustSourceNormals)for(let r=0;r<o.length;r+=3){this._calculateFaceNormal(e,o,r,ge);for(let e=0;e<3;e++){const a=3*o[r+e];fe[0]=t[a+0],fe[1]=t[a+1],fe[2]=t[a+2],d(ge,fe)<0&&(t[a+0]=-t[a+0],t[a+1]=-t[a+1],t[a+2]=-t[a+2],s=!0)}}return{normals:t,indices:o,didFlipNormals:s}}_createComponentNormalsFlat(e,t){const r=new Float32Array(t.length),a=new Uint32Array(3*t.length);for(let o=0;o<t.length;o+=3){const s=this._calculateFaceNormal(e,t,o,ge);for(let e=0;e<3;e++)r[o+e]=s[e],a[o+e]=o/3}return{normals:r,indices:a,didFlipNormals:!1}}_createComponentNormalsSmooth(e,t){const r={};for(let s=0;s<t.length;s+=3){const a=this._calculateFaceNormal(e,t,s,ge);for(let e=0;e<3;e++){const o=t[s+e];let n=r[o];n||(n={normal:v(),count:0},r[o]=n),f(n.normal,n.normal,a),n.count++}}const a=new Float32Array(3*t.length),o=new Uint32Array(3*t.length);for(let s=0;s<t.length;s++){const e=r[t[s]];1!==e.count&&(g(e.normal,e.normal),e.count=1);for(let t=0;t<3;t++)a[3*s+t]=e.normal[t];o[s]=s}return{normals:a,indices:o,didFlipNormals:!1}}_getFaceVertices(e,t,r,a,o,s){const n=3*t[r+0],i=3*t[r+1],l=3*t[r+2];a[0]=e[n+0],a[1]=e[n+1],a[2]=e[n+2],o[0]=e[i+0],o[1]=e[i+1],o[2]=e[i+2],s[0]=e[l+0],s[1]=e[l+1],s[2]=e[l+2]}_calculateFaceNormal(e,t,r,a){return this._getFaceVertices(e,t,r,fe,pe,de),x(pe,pe,fe),x(de,de,fe),_(fe,pe,de),g(a,fe),a}_getOrCreateComponents(e){return a(e.components,be)}_createPositionBuffer(e,r){let a=e.vertexAttributes.position;const o=r.reprojection===ve.ECEF?r.transformBeforeProject:null;if(t(o)&&(a=L(a,new Float64Array(a.length),o)),r.reprojection===ve.NONE)return r.needsBufferCopy?new Float64Array(a):a;const s=t(o)?a:new Float64Array(a.length);return O(a,e.spatialReference,0,s,this._context.renderCoordsHelper.spatialReference,0,a.length/3),s}_createNormalBuffer(e,a,o){let s=e.vertexAttributes.normal;if(r(s))return null;const n=o.reprojection===ve.ECEF?o.transformBeforeProject:null;t(n)&&(s=U(s,new Float32Array(s.length),n));if("local"===this._context.layerView.view.viewingMode||o.reprojection===ve.NONE)return o.needsBufferCopy&&e.vertexAttributes.normal===s?new Float32Array(s):s;const i=e.vertexAttributes.position,l=t(n)?s:new Float32Array(s.length);return V(s,i,a,e.spatialReference,l)}_createTangentBuffer(e,a,o){let s=e.vertexAttributes.tangent;if(r(s))return null;const n=o.reprojection===ve.ECEF?o.transformBeforeProject:null;t(n)&&(s=G(s,new Float32Array(s.length),n));if("local"===this._context.layerView.view.viewingMode||o.reprojection===ve.NONE)return o.needsBufferCopy&&e.vertexAttributes.normal===s?new Float32Array(s):s;const i=e.vertexAttributes.position,l=t(n)?s:new Float32Array(s.length);return $(s,i,a,e.spatialReference,l)}_createColorBuffer(e){return e.vertexAttributes.color}_createSymbolColorBuffer(e){if(this._requiresSymbolVertexColors()){const t=this._getVertexOpacityAndColor(e),r=J(o(this.symbolLayer,"material","colorMixMode")),a=new Uint8Array(4);return K(t,r,a),a}return null}_createBuffers(e,r){const a=e.vertexAttributes&&e.vertexAttributes.position;if(!a)return this.logger.warn("Mesh geometry must contain position vertex attributes"),null;const o=e.vertexAttributes.normal,s=e.vertexAttributes.uv,n=e.vertexAttributes.tangent;if(t(o)&&o.length!==a.length)return this.logger.warn("Mesh normal vertex buffer must contain the same number of elements as the position buffer"),null;if(t(n)&&n.length/4!=a.length/3)return this.logger.warn("Mesh tangent vertex buffer must contain the same number of elements as the position buffer"),null;if(t(s)&&s.length/2!=a.length/3)return this.logger.warn("Mesh uv vertex buffer must contain the same number of elements as the position buffer"),null;const i=this._computeReprojectionInfo(e),l=this._createPositionBuffer(e,i),c=this._createColorBuffer(e),u=this._createSymbolColorBuffer(r),m=this._createNormalBuffer(e,l,i),f=this._createTangentBuffer(e,l,i);return{positionBuffer:l,normalBuffer:m,tangentBuffer:f,uvBuffer:s,colorBuffer:c,symbolColorBuffer:u,objectTransformation:i.reprojection===ve.NONE&&t(i.objectTransformation)?i.objectTransformation:this._transformOriginLocal(e,l,m,f),geometryTransformation:i.reprojection===ve.NONE&&t(i.geometryTransformation)?i.geometryTransformation:h()}}_computeReprojectionInfo(e){const r=t(e.transform),a=r&&e.transform.geographic||this._context.renderCoordsHelper.viewingMode===k.Local?ve.NONE:ve.ECEF;if(r){if(a===ve.NONE){const t=h();A(e.spatialReference,e.transform.origin,t,this._context.renderCoordsHelper.spatialReference);return{reprojection:a,objectTransformation:t,geometryTransformation:m(e.transform.localMatrix),needsBufferCopy:!1}}const t=l(h(),e.transform.origin);return c(t,t,e.transform.localMatrix),{reprojection:a,transformBeforeProject:t,needsBufferCopy:!0}}return{reprojection:a,needsBufferCopy:!0}}_transformOriginLocal(e,r,a,o){const i=this._context.renderCoordsHelper.spatialReference,l=e.anchor;he[0]=l.x,he[1]=l.y,he[2]=l.z;const c=h();A(e.spatialReference,he,c,i);const m=I.fromTypedArray(r);if(u(xe,c),F(m,m,xe),t(a)||t(o)){if(s(_e,c),n(_e,_e),t(a)){const e=B.fromTypedArray(a);S(e,e,_e)}if(t(o)){const e=B.fromTypedArray(o,4*o.BYTES_PER_ELEMENT);S(e,e,_e)}}return c}_validateFaces(e,t){const r=e.vertexAttributes.position.length/3,a=t.faces;if(a){let e=-1;for(let t=0;t<a.length;t++){const r=a[t];r>e&&(e=r)}if(r<=e)return this.logger.warn(`Vertex index ${e} is out of bounds of the mesh position buffer`),!1}else if(r%3!=0)return this.logger.warn("Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)"),!1;return!0}_getOrCreateFaces(e,t){return t.faces?t.faces:oe(e.vertexAttributes.position.length/3)}_isOutsideClippingArea(e){if(!this._context.clippingExtent)return!1;const t=e.vertexAttributes&&e.vertexAttributes.position;if(!t)return!1;const r=this._context.elevationProvider.spatialReference;let a;const o=t.length/3;return e.spatialReference.equals(r)?a=t:(a=new Float64Array(t.length),O(e.vertexAttributes.position,e.spatialReference,0,a,r,0,o)),w(ye),N(ye,a,0,o),!j(ye,this._context.clippingExtent)}_createGeometryInfo(e,a){if(!M(e.spatialReference,this._context.layerView.view.spatialReference))return this.logger.warn("Geometry spatial reference is not compatible with the view"),null;if(this._isOutsideClippingArea(e))return null;const o=this._createBuffers(e,a);if(r(o))return null;const{positionBuffer:s,uvBuffer:n,colorBuffer:i,symbolColorBuffer:l,normalBuffer:c,tangentBuffer:u,objectTransformation:m,geometryTransformation:h}=o,f=this._getOrCreateComponents(e),p=[],d=[],g=[];let x=!1;for(const r of f){if(!this._validateFaces(e,r))return null;const a=this._getOrCreateFaces(e,r);if(0===a.length)continue;const o=this._createComponentNormals(s,c,r,a);o.didFlipNormals&&(x=!0);const m=[[te.POSITION,{size:3,data:s,exclusive:!0}],[te.NORMAL,{size:3,data:o.normals,exclusive:!0}]],f=[[te.POSITION,a],[te.NORMAL,o.indices]];t(i)&&(m.push([te.COLOR,{size:4,data:i,exclusive:!0}]),f.push([te.COLOR,a])),t(l)&&(m.push([te.SYMBOLCOLOR,{size:4,data:l,exclusive:!0}]),f.push([te.SYMBOLCOLOR,new Uint16Array(a.length)])),t(n)&&(m.push([te.UV0,{size:2,data:n,exclusive:!0}]),f.push([te.UV0,a])),t(u)&&(m.push([te.TANGENT,{size:4,data:u,exclusive:!0}]),f.push([te.TANGENT,a]));const _=new ae(m,f);p.push(_),d.push(h),g.push(this._getOrCreateMaterial(e,r))}return x&&this.logger.warn("Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals."),{geometries:p,transformations:d,materials:g,objectTransformation:m}}_createEdgeMaterial(){const e={opacity:this._getLayerOpacity()};return Z(this.symbolLayer,e)}}const he=v(),fe=v(),pe=v(),de=v(),ge=v(),xe=h(),_e=i(),ye=E(),be=[new R];var ve;!function(e){e[e.NONE=0]="NONE",e[e.ECEF=1]="ECEF"}(ve||(ve={}));export{me as Graphics3DMeshFillSymbolLayer,me as default};
5
+ import e from"../../../../Color.js";import"../../../../core/has.js";import{isSome as t,isNone as r,unwrapOr as a,get as o}from"../../../../core/maybe.js";import{f as s,t as n}from"../../../../chunks/mat3.js";import{c as i}from"../../../../chunks/mat3f64.js";import{f as l,m as c,a as u}from"../../../../chunks/mat4.js";import{b as m,c as h}from"../../../../chunks/mat4f64.js";import{b as p,a as f,d,n as g,f as x,c as _}from"../../../../chunks/vec3.js";import{Z as y,O as b,c as v}from"../../../../chunks/vec3f64.js";import{O as T}from"../../../../chunks/vec4f64.js";import{projectVectorToDehydratedPoint as C,projectBuffer as O,computeTranslationToOriginAndRotation as A,canProjectWithoutEngine as M}from"../../../../geometry/projection.js";import{create as E,empty as w,expandWithBuffer as N,intersectsClippingArea as j}from"../../../../geometry/support/aaBoundingBox.js";import R from"../../../../geometry/support/MeshComponent.js";import P from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import{BufferViewVec3f64 as I,BufferViewVec3f as B}from"../../../../geometry/support/buffer/BufferView.js";import{t as F,a as S}from"../../../../chunks/vec32.js";import{transformPosition as L,transformNormal as U,projectNormalToPCPF as V,transformTangent as G,projectTangentToPCPF as $}from"../../../../geometry/support/meshUtils/projection.js";import{makeDehydratedPoint as D}from"../../../../layers/graphics/dehydratedFeatures.js";import{ViewingMode as k}from"../../../ViewingMode.js";import{perObjectElevationAligner as z}from"./ElevationAligners.js";import{needsElevationUpdates3D as q}from"./elevationAlignmentUtils.js";import{ElevationContext as H}from"./ElevationContext.js";import{Graphics3DObject3DGraphicLayer as W}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as Y}from"./Graphics3DSymbolLayer.js";import{createMaterial as Z}from"../support/edgeUtils.js";import{parseColorMixMode as J,encodeSymbolColor as K}from"../support/symbolColorUtils.js";import Q from"../../support/debugFlags.js";import{AlphaDiscardMode as X,CullFaceOptions as ee,VertexAttribute as te,PrimitiveType as re}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as ae}from"../../webgl-engine/lib/Geometry.js";import{generateDefaultIndexArray as oe}from"../../webgl-engine/lib/geometryDataUtils.js";import{Object3D as se}from"../../webgl-engine/lib/Object3D.js";import{Texture as ne}from"../../webgl-engine/lib/Texture.js";import{DefaultMaterial as ie}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as le}from"../../webgl-engine/materials/NativeLineMaterial.js";import{TextureWrapMode as ce}from"../../../webgl/enums.js";const ue=["mesh"];class me extends Y{constructor(e,t,r,a){super(e,t,r,a),this._materials=new Map,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){Q.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new le({color:[1,0,1,1]}),this._debugFaceNormalMaterial=new le({color:[0,1,1,1]}))}destroy(){super.destroy(),this._context.stage.removeMany(Array.from(this._materials.values(),(e=>e.material))),this._context.stage.removeMany(Array.from(this._textures.values())),this._materials.clear(),this._textures.clear()}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,ue,"fill on mesh-3d"))return null;const r=this.setGraphicElevationContext(t,new H),a=e.renderingInfo;return this._createAs3DShape(t,a,r,t.uid)}layerOpacityChanged(e,r){const a=this._getLayerOpacity();return this._materials.forEach((e=>{e.material.setParameters({layerOpacity:a});const t=e.material.parameters;this._setMaterialTransparentParameter(t,e),e.material.setParameters({transparent:t.transparent})})),e.forEach((e=>{const o=r(e);t(o)&&o.layerOpacityChanged(a,this._context.isAsync)})),!0}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,q)}slicePlaneEnabledChanged(e,r){return this._materials.forEach((e=>{e.material.setParameters({slicePlaneEnabled:this._context.slicePlaneEnabled})})),e.forEach((e=>{const a=r(e);t(a)&&a.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)})),!0}physicalBasedRenderingChanged(){const e=this._usePBR();return this._materials.forEach((t=>t.material.setParameters({usePBR:e}))),!0}pixelRatioChanged(){return!0}_requiresSymbolVertexColors(){return this._drivenProperties.color||this._drivenProperties.opacity}_colorOrTextureUid(t){return r(t)?"-":t instanceof e?t.toHex():t.contentHash}_materialPropertiesDefault(e,t){const r=this._requiresSymbolVertexColors(),a=!!e.vertexAttributes.color,o=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:r,hasVertexColors:a,hasVertexTangents:o,uid:`vc:${a},vt:${o},vct${t},svc:${r}`}}_materialProperties(e,t,r){const a=this._materialPropertiesDefault(e,r);if(!t.material)return a;const{color:o,colorTexture:s,normalTexture:n,doubleSided:i,alphaCutoff:l,alphaMode:c}=t.material,u=this._colorOrTextureUid(o),m=this._colorOrTextureUid(s),h=this._colorOrTextureUid(n);if(a.color=o,a.colorTexture=s,a.normalTexture=n,a.uid=`${a.uid},cmuid:${u},ctmuid:${m},ntmuid:${h},ds:${i},ac:${l},am:${c}`,t.material instanceof P){const{metallic:e,roughness:r,metallicRoughnessTexture:o,emissiveColor:s,emissiveTexture:n,occlusionTexture:i}=t.material,l=this._colorOrTextureUid(o),c=this._colorOrTextureUid(s),u=this._colorOrTextureUid(n),m=this._colorOrTextureUid(i);a.metallic=e,a.roughness=r,a.metallicRoughnessTexture=o,a.emissiveColor=s,a.emissiveTexture=n,a.occlusionTexture=i,a.uid=`${a.uid},mrm:${e},mrr:${r},mrt:${l},emuid:${c},etmuid:${u},otmuid:${m}`}return a}_setInternalColorValueParameters(t,r){r.diffuse=e.toUnitRGB(t),r.opacity=t.a}_getLoadableTextureResource(e){return e.data?e.data:e.url}_getInternalTextureId(e){const r=this._getInternalTexture(e,X.Opaque);return t(r)?r.id:null}_getInternalTexture(e,t){const r=this._getLoadableTextureResource(e);if(!r)return null;const a=`${e.contentHash}/${t}`;let o=this._textures.get(a);return o||(o=new ne(r,{mipmap:!0,wrap:this._castTextureWrap(e.wrap),noUnpackFlip:!0,preMultiplyAlpha:t!==X.Opaque}),this._textures.set(a,o),this._context.stage.add(o),this._context.stage.loadImmediate(o)),o}_castTextureWrap(e="repeat"){if("string"==typeof e){const t=this._castTextureWrapIndividual(e);return{s:t,t}}return{s:this._castTextureWrapIndividual(e.horizontal),t:this._castTextureWrapIndividual(e.vertical)}}_castTextureWrapIndividual(e){switch(e){case"clamp":return ce.CLAMP_TO_EDGE;case"mirror":return ce.MIRRORED_REPEAT;default:return ce.REPEAT}}_setInternalMaterialParameters(r,a){if(t(r.color)&&this._setInternalColorValueParameters(r.color,a),t(r.colorTexture)){const e=this._getInternalTexture(r.colorTexture,a.textureAlphaMode);t(e)?(a.textureId=e.id,a.textureAlphaPremultiplied=!!e.params.preMultiplyAlpha):a.textureId=void 0}t(r.normalTexture)&&(a.normalTextureId=this._getInternalTextureId(r.normalTexture)),t(r.emissiveColor)&&(a.emissiveFactor=e.toUnitRGB(r.emissiveColor)),t(r.emissiveTexture)&&(a.emissiveTextureId=this._getInternalTextureId(r.emissiveTexture)),t(r.occlusionTexture)&&(a.occlusionTextureId=this._getInternalTextureId(r.occlusionTexture)),t(r.metallicRoughnessTexture)&&(a.metallicRoughnessTextureId=this._getInternalTextureId(r.metallicRoughnessTexture))}_setExternalMaterialParameters(r){const a=this._drivenProperties.color;let o=t(this.symbolLayer.material)?this.symbolLayer.material.colorMixMode:null;if(a)r.externalColor=T;else{const a=t(this.symbolLayer.material)?this.symbolLayer.material.color:null;t(a)?r.externalColor=e.toUnitRGBA(a):(o=null,r.externalColor=T)}o&&(r.colorMixMode=o),r.castShadows=!!this.symbolLayer.castShadows}_hasTransparentVertexColors(e){const t=e.vertexAttributes.color;if(r(t))return!1;for(let r=3;r<t.length;r+=4)if(255!==t[r])return!0;return!1}_getOrCreateMaterial(e,r){var a,o,s;const n=null==(a=r.material)?void 0:a.color,i=null==(o=r.material)?void 0:o.colorTexture,l=null==(s=r.material)?void 0:s.alphaMode,c="blend"===l,u=!("opaque"===l)&&(this._hasTransparentVertexColors(e)||t(n)&&n.a<1||t(i)&&i.transparent||c),m=this._materialProperties(e,r,u),h=this._materials.get(m.uid);if(h)return h.material;const p={material:null,isComponentTransparent:u,alphaMode:r.material?r.material.alphaMode:"opaque"},f=null==m.metallicRoughnessTexture&&null==m.metallic&&null==m.roughness,d={usePBR:this._usePBR(),isSchematic:f,vertexColors:m.hasVertexColors,symbolColors:m.hasSymbolVertexColors,vertexTangents:m.hasVertexTangents,ambient:y,diffuse:b,opacity:1,doubleSided:!0,doubleSidedType:"winding-order",cullFace:ee.None,layerOpacity:this._getLayerOpacity(),slicePlaneEnabled:this._context.slicePlaneEnabled,initTextureTransparent:!0};f||(d.mrrFactors=[null!=m.metallic?m.metallic:1,null!=m.roughness?m.roughness:1,.5]),r.material&&(d.doubleSided=r.material.doubleSided,d.cullFace=r.material.doubleSided?ee.None:ee.Back,d.textureAlphaCutoff=r.material.alphaCutoff),this._setExternalMaterialParameters(d),this._setMaterialTransparentParameter(d,p),this._setInternalMaterialParameters(m,d);const g=new ie(d);return p.material=g,this._materials.set(m.uid,p),this._context.stage.add(g),g}_usePBR(){return this._context.physicalBasedRenderingEnabled}_setMaterialTransparentParameter(e,t){e.transparent=this.needsDrivenTransparentPass||t.isComponentTransparent||e.layerOpacity<1||e.opacity<1||e.externalColor&&e.externalColor[3]<1,"auto"===t.alphaMode?e.textureAlphaMode=e.transparent?X.MaskBlend:X.Opaque:e.textureAlphaMode="opaque"===t.alphaMode?X.Opaque:"mask"===t.alphaMode?X.Mask:X.Blend}_addDebugNormals(e,t,r,a){const o=t.length,s=e.spatialReference.isGeographic?20015077/180:1,n=.1*Math.max(e.extent.width*s,e.extent.height*s,e.extent.zmax-e.extent.zmin),i=[],l=[],c=[],u=[];for(let m=0;m<o;m++){const e=t[m],r=e.vertexAttributes.get(te.POSITION),a=e.vertexAttributes.get(te.NORMAL),o=e.indices.get(te.POSITION),s=e.indices.get(te.NORMAL),h=r.data,d=a.data;for(let t=0;t<o.length;t++){const e=3*o[t],r=3*s[t];for(let t=0;t<3;t++)i.push(h[e+t]);for(let t=0;t<3;t++)i.push(h[e+t]+d[r+t]*n);if(l.push(l.length),l.push(l.length),t%3==0){this._calculateFaceNormal(h,o,t,ge),this._getFaceVertices(h,o,t,pe,fe,de),p(pe,pe,fe),p(pe,pe,de),f(pe,pe,1/3);for(let e=0;e<3;e++)c.push(pe[e]);for(let e=0;e<3;e++)c.push(pe[e]+ge[e]*n);u.push(u.length),u.push(u.length)}}}const h=new ae([[te.POSITION,{data:i,size:3,exclusive:!0}]],[[te.POSITION,new Uint32Array(l)]],re.Line);t.push(h),r.push(this._debugVertexNormalMaterial),a.push(m(a[0]));const d=new ae([[te.POSITION,{data:c,size:3,exclusive:!0}]],[[te.POSITION,new Uint32Array(u)]],re.Line);t.push(d),r.push(this._debugFaceNormalMaterial),a.push(m(a[0]))}_createAs3DShape(e,r,a,o){const s=e.geometry;if("mesh"!==s.type)return null;const n=this._createGeometryInfo(s,r);if(!n)return null;const{geometries:i,materials:l,transformations:c,objectTransformation:u}=n;Q.DRAW_MESH_GEOMETRY_NORMALS&&this._addDebugNormals(s,i,l,c);const m=new se({geometries:i,materials:l,transformations:c,metadata:{layerUid:this._context.layer.uid,graphicUid:o}});m.transformation=u;const h=this._createEdgeMaterial(),p=t(h)?{baseMaterial:l[0],edgeMaterials:[h],properties:{mergeGeometries:!0,slicePlaneEnabled:this._context.slicePlaneEnabled}}:null,f=new W(this,m,i,null,null,z,a,p);return f.needsElevationUpdates=q(a.mode),f.useObjectOriginAsAttachmentOrigin=!0,f.elevationContext.centerPointInElevationSR=this._getCenterPointInElevationSR(m),f.alignedSampledElevation=z(f,f.elevationContext,this._context.elevationProvider,this._context.renderCoordsHelper),f}_getCenterPointInElevationSR(e){const t=D(0,0,0,this._context.elevationProvider.spatialReference);return C([e.transformation[12],e.transformation[13],e.transformation[14]],this._context.renderCoordsHelper.spatialReference,t),t}_createComponentNormals(e,t,r,a){switch(r.shading||"flat"){case"source":return this._createComponentNormalsSource(e,t,r,a);case"flat":return this._createComponentNormalsFlat(e,a);case"smooth":return this._createComponentNormalsSmooth(e,a);default:return}}_createComponentNormalsSource(e,t,a,o){if(r(t))return this._createComponentNormalsFlat(e,o);let s=!1;if(!a.trustSourceNormals)for(let r=0;r<o.length;r+=3){this._calculateFaceNormal(e,o,r,ge);for(let e=0;e<3;e++){const a=3*o[r+e];pe[0]=t[a+0],pe[1]=t[a+1],pe[2]=t[a+2],d(ge,pe)<0&&(t[a+0]=-t[a+0],t[a+1]=-t[a+1],t[a+2]=-t[a+2],s=!0)}}return{normals:t,indices:o,didFlipNormals:s}}_createComponentNormalsFlat(e,t){const r=new Float32Array(t.length),a=new Uint32Array(3*t.length);for(let o=0;o<t.length;o+=3){const s=this._calculateFaceNormal(e,t,o,ge);for(let e=0;e<3;e++)r[o+e]=s[e],a[o+e]=o/3}return{normals:r,indices:a,didFlipNormals:!1}}_createComponentNormalsSmooth(e,t){const r={};for(let s=0;s<t.length;s+=3){const a=this._calculateFaceNormal(e,t,s,ge);for(let e=0;e<3;e++){const o=t[s+e];let n=r[o];n||(n={normal:v(),count:0},r[o]=n),p(n.normal,n.normal,a),n.count++}}const a=new Float32Array(3*t.length),o=new Uint32Array(3*t.length);for(let s=0;s<t.length;s++){const e=r[t[s]];1!==e.count&&(g(e.normal,e.normal),e.count=1);for(let t=0;t<3;t++)a[3*s+t]=e.normal[t];o[s]=s}return{normals:a,indices:o,didFlipNormals:!1}}_getFaceVertices(e,t,r,a,o,s){const n=3*t[r+0],i=3*t[r+1],l=3*t[r+2];a[0]=e[n+0],a[1]=e[n+1],a[2]=e[n+2],o[0]=e[i+0],o[1]=e[i+1],o[2]=e[i+2],s[0]=e[l+0],s[1]=e[l+1],s[2]=e[l+2]}_calculateFaceNormal(e,t,r,a){return this._getFaceVertices(e,t,r,pe,fe,de),x(fe,fe,pe),x(de,de,pe),_(pe,fe,de),g(a,pe),a}_getOrCreateComponents(e){return a(e.components,be)}_createPositionBuffer(e,r){let a=e.vertexAttributes.position;const o=r.reprojection===ve.ECEF?r.transformBeforeProject:null;if(t(o)&&(a=L(a,new Float64Array(a.length),o)),r.reprojection===ve.NONE)return r.needsBufferCopy?new Float64Array(a):a;const s=t(o)?a:new Float64Array(a.length);return O(a,e.spatialReference,0,s,this._context.renderCoordsHelper.spatialReference,0,a.length/3),s}_createNormalBuffer(e,a,o){let s=e.vertexAttributes.normal;if(r(s))return null;const n=o.reprojection===ve.ECEF?o.transformBeforeProject:null;t(n)&&(s=U(s,new Float32Array(s.length),n));if("local"===this._context.graphicsCoreOwner.view.viewingMode||o.reprojection===ve.NONE)return o.needsBufferCopy&&e.vertexAttributes.normal===s?new Float32Array(s):s;const i=e.vertexAttributes.position,l=t(n)?s:new Float32Array(s.length);return V(s,i,a,e.spatialReference,l)}_createTangentBuffer(e,a,o){let s=e.vertexAttributes.tangent;if(r(s))return null;const n=o.reprojection===ve.ECEF?o.transformBeforeProject:null;t(n)&&(s=G(s,new Float32Array(s.length),n));if("local"===this._context.graphicsCoreOwner.view.viewingMode||o.reprojection===ve.NONE)return o.needsBufferCopy&&e.vertexAttributes.normal===s?new Float32Array(s):s;const i=e.vertexAttributes.position,l=t(n)?s:new Float32Array(s.length);return $(s,i,a,e.spatialReference,l)}_createColorBuffer(e){return e.vertexAttributes.color}_createSymbolColorBuffer(e){if(this._requiresSymbolVertexColors()){const t=this._getVertexOpacityAndColor(e),r=J(o(this.symbolLayer,"material","colorMixMode")),a=new Uint8Array(4);return K(t,r,a),a}return null}_createBuffers(e,r){const a=e.vertexAttributes&&e.vertexAttributes.position;if(!a)return this.logger.warn("Mesh geometry must contain position vertex attributes"),null;const o=e.vertexAttributes.normal,s=e.vertexAttributes.uv,n=e.vertexAttributes.tangent;if(t(o)&&o.length!==a.length)return this.logger.warn("Mesh normal vertex buffer must contain the same number of elements as the position buffer"),null;if(t(n)&&n.length/4!=a.length/3)return this.logger.warn("Mesh tangent vertex buffer must contain the same number of elements as the position buffer"),null;if(t(s)&&s.length/2!=a.length/3)return this.logger.warn("Mesh uv vertex buffer must contain the same number of elements as the position buffer"),null;const i=this._computeReprojectionInfo(e),l=this._createPositionBuffer(e,i),c=this._createColorBuffer(e),u=this._createSymbolColorBuffer(r),m=this._createNormalBuffer(e,l,i),p=this._createTangentBuffer(e,l,i);return{positionBuffer:l,normalBuffer:m,tangentBuffer:p,uvBuffer:s,colorBuffer:c,symbolColorBuffer:u,objectTransformation:i.reprojection===ve.NONE&&t(i.objectTransformation)?i.objectTransformation:this._transformOriginLocal(e,l,m,p),geometryTransformation:i.reprojection===ve.NONE&&t(i.geometryTransformation)?i.geometryTransformation:h()}}_computeReprojectionInfo(e){const r=t(e.transform),a=r&&e.transform.geographic||this._context.renderCoordsHelper.viewingMode===k.Local?ve.NONE:ve.ECEF;if(r){if(a===ve.NONE){const t=h();A(e.spatialReference,e.transform.origin,t,this._context.renderCoordsHelper.spatialReference);return{reprojection:a,objectTransformation:t,geometryTransformation:m(e.transform.localMatrix),needsBufferCopy:!1}}const t=l(h(),e.transform.origin);return c(t,t,e.transform.localMatrix),{reprojection:a,transformBeforeProject:t,needsBufferCopy:!0}}return{reprojection:a,needsBufferCopy:!0}}_transformOriginLocal(e,r,a,o){const i=this._context.renderCoordsHelper.spatialReference,l=e.anchor;he[0]=l.x,he[1]=l.y,he[2]=l.z;const c=h();A(e.spatialReference,he,c,i);const m=I.fromTypedArray(r);if(u(xe,c),F(m,m,xe),t(a)||t(o)){if(s(_e,c),n(_e,_e),t(a)){const e=B.fromTypedArray(a);S(e,e,_e)}if(t(o)){const e=B.fromTypedArray(o,4*o.BYTES_PER_ELEMENT);S(e,e,_e)}}return c}_validateFaces(e,t){const r=e.vertexAttributes.position.length/3,a=t.faces;if(a){let e=-1;for(let t=0;t<a.length;t++){const r=a[t];r>e&&(e=r)}if(r<=e)return this.logger.warn(`Vertex index ${e} is out of bounds of the mesh position buffer`),!1}else if(r%3!=0)return this.logger.warn("Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)"),!1;return!0}_getOrCreateFaces(e,t){return t.faces?t.faces:oe(e.vertexAttributes.position.length/3)}_isOutsideClippingArea(e){if(!this._context.clippingExtent)return!1;const t=e.vertexAttributes&&e.vertexAttributes.position;if(!t)return!1;const r=this._context.elevationProvider.spatialReference;let a;const o=t.length/3;return e.spatialReference.equals(r)?a=t:(a=new Float64Array(t.length),O(e.vertexAttributes.position,e.spatialReference,0,a,r,0,o)),w(ye),N(ye,a,0,o),!j(ye,this._context.clippingExtent)}_createGeometryInfo(e,a){if(!M(e.spatialReference,this._context.graphicsCoreOwner.view.spatialReference))return this.logger.warn("Geometry spatial reference is not compatible with the view"),null;if(this._isOutsideClippingArea(e))return null;const o=this._createBuffers(e,a);if(r(o))return null;const{positionBuffer:s,uvBuffer:n,colorBuffer:i,symbolColorBuffer:l,normalBuffer:c,tangentBuffer:u,objectTransformation:m,geometryTransformation:h}=o,p=this._getOrCreateComponents(e),f=[],d=[],g=[];let x=!1;for(const r of p){if(!this._validateFaces(e,r))return null;const a=this._getOrCreateFaces(e,r);if(0===a.length)continue;const o=this._createComponentNormals(s,c,r,a);o.didFlipNormals&&(x=!0);const m=[[te.POSITION,{size:3,data:s,exclusive:!0}],[te.NORMAL,{size:3,data:o.normals,exclusive:!0}]],p=[[te.POSITION,a],[te.NORMAL,o.indices]];t(i)&&(m.push([te.COLOR,{size:4,data:i,exclusive:!0}]),p.push([te.COLOR,a])),t(l)&&(m.push([te.SYMBOLCOLOR,{size:4,data:l,exclusive:!0}]),p.push([te.SYMBOLCOLOR,new Uint16Array(a.length)])),t(n)&&(m.push([te.UV0,{size:2,data:n,exclusive:!0}]),p.push([te.UV0,a])),t(u)&&(m.push([te.TANGENT,{size:4,data:u,exclusive:!0}]),p.push([te.TANGENT,a]));const _=new ae(m,p);f.push(_),d.push(h),g.push(this._getOrCreateMaterial(e,r))}return x&&this.logger.warn("Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals."),{geometries:f,transformations:d,materials:g,objectTransformation:m}}_createEdgeMaterial(){const e={opacity:this._getLayerOpacity()};return Z(this.symbolLayer,e)}}const he=v(),pe=v(),fe=v(),de=v(),ge=v(),xe=h(),_e=i(),ye=E(),be=[new R];var ve;!function(e){e[e.NONE=0]="NONE",e[e.ECEF=1]="ECEF"}(ve||(ve={}));export{me as Graphics3DMeshFillSymbolLayer,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/4.23/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import{isSome as t,get as i,isNone as r,unwrap as n}from"../../../../core/maybe.js";import{pt2px as o}from"../../../../core/screenUtils.js";import{e as a}from"../../../../chunks/earcut.js";import{I as s}from"../../../../chunks/mat4f64.js";import{s as l}from"../../../../chunks/vec4.js";import{create as u,empty as c,expandWithBuffer as p,intersectsClippingArea as h,expandWithAABB as d}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewMat3f64 as m,BufferViewVec3f64 as _,BufferViewVec4f as y}from"../../../../geometry/support/buffer/BufferView.js";import{SymbolUpdateType as g,elevationModeChangeUpdateType as f,needsElevationUpdates2D as b}from"./elevationAlignmentUtils.js";import{ElevationContext as v}from"./ElevationContext.js";import E from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as M}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as x}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as D}from"./graphicUtils.js";import{parseCapType as O,createGeometry as S,RemoveDuplicateStartEnd as A}from"./lineUtils.js";import{geometryAsPolygon as P,geometryToRenderInfo as C,createColorGeometry as U,geometryToRenderInfoDraped as w}from"./polygonUtils.js";import{createMaterial as G,uvElevationAligner as T}from"../support/patternUtils.js";import{createMapSpaceUVCoords as j,createMapSpaceUVCoordsDraped as R}from"../support/uvUtils.js";import{VertexAttribute as B}from"../../webgl-engine/lib/basicInterfaces.js";import{Object3D as L}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as N}from"../../webgl-engine/lib/RenderGeometry.js";import{getStipplePatternForLinePattern as V}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 H=["polyline","polygon","extent"];class W extends x{constructor(e,t,i,r){super(e,t,i,r),this._needsUV=!1,this._hasOutline=!1}async doLoad(){}_ensureMaterials(){this._ensureFillMaterial(),this._ensureOutlineMaterial()}_ensureFillMaterial(){if(t(this._material))return;const e=i(this.symbolLayer,"material","color"),r=this._getCombinedOpacityAndColor(e);this._material=G(this.symbolLayer,{color:r,transparent:r[3]<1||this.needsDrivenTransparentPass,polygonOffset:!1,vertexColors:!0,writeLinearDepth:!0,slicePlaneEnabled:this._context.slicePlaneEnabled},{isDraped:this.draped}),this._needsUV=this._material instanceof F,this._context.stage.add(this._material)}_ensureOutlineMaterial(){const e=this.symbolLayer.outline;if(t(this._outlineMaterial)||!this._isValidOutline(e))return;this._hasOutline=!0;const i=t=>{const i=V(e.pattern);return new I({width:t,color:this._getOutlineColor(),polygonOffset:!0,slicePlaneEnabled:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:i,stippleScaleWithLineWidth:!0,cap:O(e.patternCap||"butt")})};this._outlineMaterial=i(o(e.size)),this._context.stage.add(this._outlineMaterial)}_isValidOutline(e){return t(e)&&e.size&&e.size>0&&t(e.color)&&(r(e.pattern)||"style"!==e.pattern.type||"none"!==e.pattern.style)}destroy(){super.destroy(),this._context.stage.remove(this._material),this._material=null,this._context.stage.remove(this._outlineMaterial),this._outlineMaterial=null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,H,this.symbolLayer.type))return null;const i=this._getVertexOpacityAndColor(e.renderingInfo,255),r=this.setGraphicElevationContext(t,new v);return this.ensureDrapedStatus("on-the-ground"===r.mode),this._ensureMaterials(),this.draped?this._createAsOverlay(t,i):this._createAs3DShape(t,i,r)}layerOpacityChanged(){if(t(this._material)){const e=this._material.parameters.color,t=i(this.symbolLayer,"material","color"),r=this._getCombinedOpacity(t);this._material.setParameters({color:[e[0],e[1],e[2],r],transparent:r<1||this.needsDrivenTransparentPass})}if(t(this._outlineMaterial)){const e=this._outlineMaterial.parameters.color;this._outlineMaterial.setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}return!0}layerElevationInfoChanged(e,t,i){const r=this._elevationContext.mode,n=f(W.elevationModeChangeTypes,i,r);if(n!==g.UPDATE)return n;const o=b(r);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>o))}slicePlaneEnabledChanged(){if(t(this._material)&&this._material.setParameters({slicePlaneEnabled:this._context.slicePlaneEnabled}),t(this._outlineMaterial)){const e={slicePlaneEnabled:this._context.slicePlaneEnabled};this._outlineMaterial.setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}pixelRatioChanged(){return!0}_createAs3DShape(e,t,i){const n=P(e.geometry);if(r(n))return null;z.renderData=C(n,this._context.elevationProvider,this._context.renderCoordsHelper,i),z.color=t;const o=z.renderData.position.length/3;if(this._needsUV&&(z.uvMapSpace=new Float32Array(4*o),z.boundingRect=new Float64Array(9*o)),z.outNum=0,z.outGeometries=[],z.outTransforms=[],z.outMaterials=[],this._createAs3DShapeFill(z),this._hasOutline&&this._createAs3DShapeOutline(z),this._logGeometryCreationWarnings(z.renderData,n.rings,"rings","FillSymbol3DLayer"),0===z.outNum)return null;this._needsUV&&j(y.fromTypedArray(z.uvMapSpace),_.fromTypedArray(z.renderData.position),this._context.renderCoordsHelper,m.fromTypedArray(z.boundingRect));const a=new L({geometries:z.outGeometries,materials:z.outMaterials,transformations:z.outTransforms,castShadow:!1,metadata:{layerUid:this._context.layer.uid,graphicUid:e.uid}}),s=new M(this,a,z.outGeometries,null,null,T,i);return s.alignedSampledElevation=z.renderData.sampledElevation,s.needsElevationUpdates=b(i.mode),s}_createAs3DShapeFill(e){const i=e.renderData.polygons;for(const{position:r,mapPosition:o,holeIndices:l,index:u,count:d}of i){if(t(this._context.clippingExtent)&&(c(k),p(k,o),!h(k,this._context.clippingExtent)))continue;const i=a(o,l,3);if(0===i.length)continue;const m=new Uint32Array(i),_=U({indices:m,attributeData:{position:r,color:e.color,mapPosition:o,uvMapSpace:this._needsUV?new Float32Array(e.uvMapSpace.buffer,4*u*e.uvMapSpace.BYTES_PER_ELEMENT,4*d):null,boundingRect:this._needsUV?new Float64Array(e.boundingRect.buffer,9*u*e.boundingRect.BYTES_PER_ELEMENT,9*d):null}});e.outGeometries.push(_),e.outMaterials.push(n(this._material)),e.outTransforms.push(s),e.outNum++}}_createAs3DShapeOutline(e){if(!this._hasOutline)return;const i=e.renderData.outlines;for(let r=0;r<i.length;++r){const{mapPosition:o,position:a}=i[r];if(t(this._context.clippingExtent)&&(c(k),p(k,o),!h(k,this._context.clippingExtent)))continue;const l=S({overlayInfo:null,removeDuplicateStartEnd:A.REMOVE,attributeData:{position:a,mapPosition:o}}),u=l.vertexAttributes.get(B.POSITION);u.data===a&&(u.data=new Float64Array(a)),e.outGeometries.push(l),e.outMaterials.push(n(this._outlineMaterial)),e.outTransforms.push(s),e.outNum++}}_createAsOverlay(e,i){const o=P(e.geometry);if(r(o))return null;n(this._material).renderPriority=this._renderPriority+this._renderPriorityStep/2,t(this._outlineMaterial)&&(this._outlineMaterial.renderPriority=this._renderPriority),Y.renderData=w(o,this._context.overlaySR),Y.color=i;const a=Y.renderData.position.length/3;return this._needsUV&&(Y.uvMapSpace=new Float32Array(4*a)),Y.outNum=0,Y.outGeometries=[],Y.outBoundingBox=c(),Y.layerUid=this._context.layer.uid,Y.graphicsUid=e.uid,this._createAsOverlayFill(Y),this._hasOutline&&this._createAsOverlayOutline(Y),this._logGeometryCreationWarnings(Y.renderData,o.rings,"rings","FillSymbol3DLayer"),0===Y.outNum?null:(this._needsUV&&R(y.fromTypedArray(Y.uvMapSpace),_.fromTypedArray(Y.renderData.position),this._context.overlaySR,this._context.layerView.view.state.viewingMode),Y.outNum>0?new E(this,Y.outGeometries,Y.outBoundingBox):null)}_createAsOverlayFill(e){const t=e.renderData.polygons;for(const{position:i,holeIndices:r,index:o,count:s}of t){if(c(k),p(k,i),!h(k,this._context.clippingExtent))continue;const t=a(i,r,3);if(0===t.length)continue;d(e.outBoundingBox,k);const u=new Uint32Array(t),m=U({indices:u,attributeData:{position:i,color:e.color,uvMapSpace:this._needsUV?new Float32Array(e.uvMapSpace.buffer,4*o*e.uvMapSpace.BYTES_PER_ELEMENT,4*s):null}}),_=new N(m,n(this._material),e.layerUid,e.graphicsUid),y=k;l(_.boundingSphere,.5*(y[0]+y[3]),.5*(y[1]+y[4]),0,.5*Math.sqrt((y[3]-y[0])*(y[3]-y[0])+(y[4]-y[1])*(y[4]-y[1]))),e.outGeometries.push(_),e.outNum++}}_createAsOverlayOutline(e){if(!this._hasOutline)return;const t=e.renderData.outlines;for(let i=0;i<t.length;++i){const{position:r}=t[i];if(c(k),p(k,r),!h(k,this._context.clippingExtent))continue;d(e.outBoundingBox,k);const o=S({overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:A.REMOVE,attributeData:{position:r}}),a=new N(o,n(this._outlineMaterial),e.layerUid,e.graphicsUid),s=k;l(a.boundingSphere,.5*(s[0]+s[3]),.5*(s[1]+s[4]),0,.5*Math.sqrt((s[3]-s[0])*(s[3]-s[0])+(s[4]-s[1])*(s[4]-s[1]))),e.outGeometries.push(a),e.outNum++}}_getOutlineOpacity(){const e=i(this.symbolLayer,"outline","color");return(this.draped?1:this._getLayerOpacity())*(t(e)?e.a:0)}_getOutlineColor(){const r=i(this.symbolLayer,"outline","color"),n=this._getOutlineOpacity();return D(t(r)?e.toUnitRGB(r):null,n)}get test(){return{createAsOverlay:(e,t)=>this._createAsOverlay(e,t),createAs3DShape:(e,t,i)=>this._createAs3DShape(e,t,i)}}}W.elevationModeChangeTypes={definedChanged:g.RECREATE,staysOnTheGround:g.NONE,onTheGroundChanged:g.RECREATE};const k=u(),z={renderData:null,color:null,uvMapSpace:null,boundingRect:null,outNum:0,outBoundingBox:null,outGeometries:null,outMaterials:null,outTransforms:null},Y={renderData:null,color:null,uvMapSpace:null,outNum:0,outBoundingBox:null,outGeometries:null,outMaterials:null,outTransforms:null};export{W as Graphics3DPolygonFillSymbolLayer,W as default};
5
+ import e from"../../../../Color.js";import{isSome as t,get as i,isNone as r,unwrap as n}from"../../../../core/maybe.js";import{pt2px as o}from"../../../../core/screenUtils.js";import{e as a}from"../../../../chunks/earcut.js";import{I as s}from"../../../../chunks/mat4f64.js";import{s as l}from"../../../../chunks/vec4.js";import{create as u,empty as c,expandWithBuffer as p,intersectsClippingArea as h,expandWithAABB as d}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewMat3f64 as m,BufferViewVec3f64 as _,BufferViewVec4f as y}from"../../../../geometry/support/buffer/BufferView.js";import{SymbolUpdateType as g,elevationModeChangeUpdateType as f,needsElevationUpdates2D as b}from"./elevationAlignmentUtils.js";import{ElevationContext as v}from"./ElevationContext.js";import E from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as M}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as x}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as O}from"./graphicUtils.js";import{parseCapType as D,createGeometry as S,RemoveDuplicateStartEnd as A}from"./lineUtils.js";import{geometryAsPolygon as U,geometryToRenderInfo as P,createColorGeometry as C,geometryToRenderInfoDraped as w}from"./polygonUtils.js";import{createMaterial as G,uvElevationAligner as T}from"../support/patternUtils.js";import{createMapSpaceUVCoords as j,createMapSpaceUVCoordsDraped as R}from"../support/uvUtils.js";import{VertexAttribute as B}from"../../webgl-engine/lib/basicInterfaces.js";import{Object3D as L}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as N}from"../../webgl-engine/lib/RenderGeometry.js";import{getStipplePatternForLinePattern as F}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as V}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as I}from"../../webgl-engine/materials/RibbonLineMaterial.js";const H=["polyline","polygon","extent"];class W extends x{constructor(e,t,i,r){super(e,t,i,r),this._needsUV=!1,this._hasOutline=!1}async doLoad(){}_ensureMaterials(){this._ensureFillMaterial(),this._ensureOutlineMaterial()}_ensureFillMaterial(){if(t(this._material))return;const e=i(this.symbolLayer,"material","color"),r=this._getCombinedOpacityAndColor(e);this._material=G(this.symbolLayer,{color:r,transparent:r[3]<1||this.needsDrivenTransparentPass,polygonOffset:!1,vertexColors:!0,writeLinearDepth:!0,slicePlaneEnabled:this._context.slicePlaneEnabled},{isDraped:this.draped}),this._needsUV=this._material instanceof V,this._context.stage.add(this._material)}_ensureOutlineMaterial(){const e=this.symbolLayer.outline;if(t(this._outlineMaterial)||!this._isValidOutline(e))return;this._hasOutline=!0;const i=t=>{const i=F(e.pattern);return new I({width:t,color:this._getOutlineColor(),polygonOffset:!0,slicePlaneEnabled:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:i,stippleScaleWithLineWidth:!0,cap:D(e.patternCap||"butt")})};this._outlineMaterial=i(o(e.size)),this._context.stage.add(this._outlineMaterial)}_isValidOutline(e){return t(e)&&e.size&&e.size>0&&t(e.color)&&(r(e.pattern)||"style"!==e.pattern.type||"none"!==e.pattern.style)}destroy(){super.destroy(),this._context.stage.remove(this._material),this._material=null,this._context.stage.remove(this._outlineMaterial),this._outlineMaterial=null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,H,this.symbolLayer.type))return null;const i=this._getVertexOpacityAndColor(e.renderingInfo,255),r=this.setGraphicElevationContext(t,new v);return this.ensureDrapedStatus("on-the-ground"===r.mode),this._ensureMaterials(),this.draped?this._createAsOverlay(t,i):this._createAs3DShape(t,i,r)}layerOpacityChanged(){if(t(this._material)){const e=this._material.parameters.color,t=i(this.symbolLayer,"material","color"),r=this._getCombinedOpacity(t);this._material.setParameters({color:[e[0],e[1],e[2],r],transparent:r<1||this.needsDrivenTransparentPass})}if(t(this._outlineMaterial)){const e=this._outlineMaterial.parameters.color;this._outlineMaterial.setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}return!0}layerElevationInfoChanged(e,t,i){const r=this._elevationContext.mode,n=f(W.elevationModeChangeTypes,i,r);if(n!==g.UPDATE)return n;const o=b(r);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>o))}slicePlaneEnabledChanged(){if(t(this._material)&&this._material.setParameters({slicePlaneEnabled:this._context.slicePlaneEnabled}),t(this._outlineMaterial)){const e={slicePlaneEnabled:this._context.slicePlaneEnabled};this._outlineMaterial.setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}pixelRatioChanged(){return!0}_createAs3DShape(e,t,i){const n=U(e.geometry);if(r(n))return null;z.renderData=P(n,this._context.elevationProvider,this._context.renderCoordsHelper,i),z.color=t;const o=z.renderData.position.length/3;if(this._needsUV&&(z.uvMapSpace=new Float32Array(4*o),z.boundingRect=new Float64Array(9*o)),z.outNum=0,z.outGeometries=[],z.outTransforms=[],z.outMaterials=[],this._createAs3DShapeFill(z),this._hasOutline&&this._createAs3DShapeOutline(z),this._logGeometryCreationWarnings(z.renderData,n.rings,"rings","FillSymbol3DLayer"),0===z.outNum)return null;this._needsUV&&j(y.fromTypedArray(z.uvMapSpace),_.fromTypedArray(z.renderData.position),this._context.renderCoordsHelper,m.fromTypedArray(z.boundingRect));const a=new L({geometries:z.outGeometries,materials:z.outMaterials,transformations:z.outTransforms,castShadow:!1,metadata:{layerUid:this._context.layer.uid,graphicUid:e.uid}}),s=new M(this,a,z.outGeometries,null,null,T,i);return s.alignedSampledElevation=z.renderData.sampledElevation,s.needsElevationUpdates=b(i.mode),s}_createAs3DShapeFill(e){const i=e.renderData.polygons;for(const{position:r,mapPosition:o,holeIndices:l,index:u,count:d}of i){if(t(this._context.clippingExtent)&&(c(k),p(k,o),!h(k,this._context.clippingExtent)))continue;const i=a(o,l,3);if(0===i.length)continue;const m=new Uint32Array(i),_=C({indices:m,attributeData:{position:r,color:e.color,mapPosition:o,uvMapSpace:this._needsUV?new Float32Array(e.uvMapSpace.buffer,4*u*e.uvMapSpace.BYTES_PER_ELEMENT,4*d):null,boundingRect:this._needsUV?new Float64Array(e.boundingRect.buffer,9*u*e.boundingRect.BYTES_PER_ELEMENT,9*d):null}});e.outGeometries.push(_),e.outMaterials.push(n(this._material)),e.outTransforms.push(s),e.outNum++}}_createAs3DShapeOutline(e){if(!this._hasOutline)return;const i=e.renderData.outlines;for(let r=0;r<i.length;++r){const{mapPosition:o,position:a}=i[r];if(t(this._context.clippingExtent)&&(c(k),p(k,o),!h(k,this._context.clippingExtent)))continue;const l=S({overlayInfo:null,removeDuplicateStartEnd:A.REMOVE,attributeData:{position:a,mapPosition:o}}),u=l.vertexAttributes.get(B.POSITION);u.data===a&&(u.data=new Float64Array(a)),e.outGeometries.push(l),e.outMaterials.push(n(this._outlineMaterial)),e.outTransforms.push(s),e.outNum++}}_createAsOverlay(e,i){const o=U(e.geometry);if(r(o))return null;n(this._material).renderPriority=this._renderPriority+this._renderPriorityStep/2,t(this._outlineMaterial)&&(this._outlineMaterial.renderPriority=this._renderPriority),Y.renderData=w(o,this._context.overlaySR),Y.color=i;const a=Y.renderData.position.length/3;return this._needsUV&&(Y.uvMapSpace=new Float32Array(4*a)),Y.outNum=0,Y.outGeometries=[],Y.outBoundingBox=c(),Y.layerUid=this._context.layer.uid,Y.graphicsUid=e.uid,this._createAsOverlayFill(Y),this._hasOutline&&this._createAsOverlayOutline(Y),this._logGeometryCreationWarnings(Y.renderData,o.rings,"rings","FillSymbol3DLayer"),0===Y.outNum?null:(this._needsUV&&R(y.fromTypedArray(Y.uvMapSpace),_.fromTypedArray(Y.renderData.position),this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode),Y.outNum>0?new E(this,Y.outGeometries,Y.outBoundingBox):null)}_createAsOverlayFill(e){const t=e.renderData.polygons;for(const{position:i,holeIndices:r,index:o,count:s}of t){if(c(k),p(k,i),!h(k,this._context.clippingExtent))continue;const t=a(i,r,3);if(0===t.length)continue;d(e.outBoundingBox,k);const u=new Uint32Array(t),m=C({indices:u,attributeData:{position:i,color:e.color,uvMapSpace:this._needsUV?new Float32Array(e.uvMapSpace.buffer,4*o*e.uvMapSpace.BYTES_PER_ELEMENT,4*s):null}}),_=new N(m,n(this._material),{layerUid:e.layerUid,graphicUid:e.graphicsUid}),y=k;l(_.boundingSphere,.5*(y[0]+y[3]),.5*(y[1]+y[4]),0,.5*Math.sqrt((y[3]-y[0])*(y[3]-y[0])+(y[4]-y[1])*(y[4]-y[1]))),e.outGeometries.push(_),e.outNum++}}_createAsOverlayOutline(e){if(!this._hasOutline)return;const t=e.renderData.outlines;for(let i=0;i<t.length;++i){const{position:r}=t[i];if(c(k),p(k,r),!h(k,this._context.clippingExtent))continue;d(e.outBoundingBox,k);const o=S({overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:A.REMOVE,attributeData:{position:r}}),a=new N(o,n(this._outlineMaterial),{layerUid:e.layerUid,graphicUid:e.graphicsUid}),s=k;l(a.boundingSphere,.5*(s[0]+s[3]),.5*(s[1]+s[4]),0,.5*Math.sqrt((s[3]-s[0])*(s[3]-s[0])+(s[4]-s[1])*(s[4]-s[1]))),e.outGeometries.push(a),e.outNum++}}_getOutlineOpacity(){const e=i(this.symbolLayer,"outline","color");return(this.draped?1:this._getLayerOpacity())*(t(e)?e.a:0)}_getOutlineColor(){const r=i(this.symbolLayer,"outline","color"),n=this._getOutlineOpacity();return O(t(r)?e.toUnitRGB(r):null,n)}get test(){return{createAsOverlay:(e,t)=>this._createAsOverlay(e,t),createAs3DShape:(e,t,i)=>this._createAs3DShape(e,t,i)}}}W.elevationModeChangeTypes={definedChanged:g.RECREATE,staysOnTheGround:g.NONE,onTheGroundChanged:g.RECREATE};const k=u(),z={renderData:null,color:null,uvMapSpace:null,boundingRect:null,outNum:0,outBoundingBox:null,outGeometries:null,outMaterials:null,outTransforms:null},Y={renderData:null,color:null,uvMapSpace:null,outNum:0,outBoundingBox:null,outGeometries:null,outMaterials:null,outTransforms:null};export{W as Graphics3DPolygonFillSymbolLayer,W as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import i from"../../../../core/Accessor.js";import t from"../../../../core/Handles.js";import{isSome as s,isNone as a}from"../../../../core/maybe.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{VisibilityFlag as n,VisibilityGroup as c}from"./enums.js";import{scaleBoundsPredicate as h}from"../../../support/layerViewUtils.js";import{TaskPriority as o}from"../../../support/Scheduler.js";let p=class extends i{constructor(){super(...arguments),this._scaleRangeActive=!1,this.layerScaleRangeVisibilityQuery=!1,this.handles=new t,this.layerView=null,this.layer=null,this.queryGraphicUIDsInExtent=null,this.extent=null,this.graphicsCore=null,this.basemapTerrain=null,this.layerScaleEnabled=!0,this.suspended=!1,this.updating=!0}setup(e,i,t,s,a){this.layerView=e,this.layer=i,this.queryGraphicUIDsInExtent=t,this.graphicsCore=s,this.basemapTerrain=a,this.updateScaleRangeActive();const r=this.layerView.view.resourceController.scheduler;this.handles.add(r.registerTask(o.SCALE_VISIBILITY,this))}destroy(){this.handles.destroy(),this.handles=null,this.layerView=null,this.extent=null,this.queryGraphicUIDsInExtent=null,this.graphicsCore=null}_setDirty(){this.updating||this._set("updating",!0)}setExtent(e){this.extent=e,this._setDirty()}scaleRangeActive(){return this._scaleRangeActive}updateScaleRangeActive(){const e=this.layer,i=e.effectiveScaleRange;let t=this.layerScaleEnabled&&y(i.minScale,i.maxScale);e.labelingInfo&&!t&&(t=e.labelingInfo.some((e=>e&&y(e.minScale,e.maxScale))));const s=this._scaleRangeActive!==t;return this._scaleRangeActive=t,t&&!this.handles.has(u)&&this.basemapTerrain?(this.handles.add(this.basemapTerrain.on("scale-change",(e=>this._scaleUpdateHandler(e))),u),this.layerScaleEnabled&&this.handles.add(this.basemapTerrain.on("tiles-visibility-changed",(()=>this._setDirty())),u)):!t&&this.handles.has(u)&&this.handles.remove(u),s}get running(){return!(!this.layerView.view.basemapTerrain||!this.updating)}runTask(){const e=this.layerView.view.basemapTerrain;if(this.extent&&e&&e.ready&&this._scaleRangeActive&&this.layerScaleEnabled){if(!this.layerScaleRangeVisibilityQuery){this.layerScaleRangeVisibilityQuery=!0;const i=this.layer.effectiveScaleRange;e.queryVisibleScaleRange(this.extent,i.minScale,i.maxScale,(e=>this._finishUpdate(e)))}}else this._finishUpdate(!0)}_finishUpdate(e){this.layerScaleRangeVisibilityQuery=!1,this._set("suspended",!e),this._set("updating",!1)}_visibleAtLayerScale(e){const i=this.layer.effectiveScaleRange;return!this.layerScaleEnabled||h(e,i.minScale||0,i.maxScale||0)}_visibleAtLabelScale(e,i){return h(e,i.minScale||0,i.maxScale||0)}_graphicScale(e){let i;if(s(e.centroid)?i=e.centroid:s(e.graphic.geometry)&&"point"===e.graphic.geometry.type&&(i=e.graphic.geometry),i){return this.layerView.view.basemapTerrain?this.layerView.view.basemapTerrain.getScale(i):1}return null}_graphicVisible(e){if(!this.layerScaleEnabled)return!0;const i=this._graphicScale(e);return this._visibleAtLayerScale(i)}updateVisibility(e){if(this._scaleRangeActive){const i=this._graphicVisible(e);return e.setVisibilityFlag(n.SCALE_RANGE,i,c.GRAPHIC)}return!1}updateGraphicLabelScaleVisibility(e){if(!this._scaleRangeActive)return!1;if(!e.labelGraphics||0===e.labelGraphics.length)return!1;const i=this._graphicScale(e),t=this._updateLabelScaleVisibility(e,i);return t&&(this.layerView.view.deconflictor.setDirty(),this.layerView.view.labeler.setDirty()),t}_updateLabelScaleVisibility(e,i){if(!e.labelGraphics||0===e.labelGraphics.length)return!1;const t=e.labelGraphics[0]._labelClass;if(t&&null!=t.minScale&&null!=t.maxScale){const s=this._visibleAtLabelScale(i,t);if(e.setVisibilityFlag(n.SCALE_RANGE,s,c.LABEL))return!0}return!1}_scaleUpdateHandler(e){if(this._setDirty(),this.layerView.suspended)return;const i=e.extent,t=e.scale,r=this._visibleAtLayerScale(t);let l=!1;this.queryGraphicUIDsInExtent(i,e.spatialReference,(e=>{const h=this.graphicsCore.getGraphics3DGraphicById(e);if(a(h))return;const o=h.centroid;s(o)&&(i[0]>o.x||i[1]>o.y||i[2]<o.x||i[3]<o.y)||(h.setVisibilityFlag(n.SCALE_RANGE,r,c.GRAPHIC)&&(l=!0),this._updateLabelScaleVisibility(h,t)&&(l=!0))})),l&&(this.layerView.view.deconflictor.setDirty(),this.layerView.view.labeler.setDirty())}layerMinMaxScaleChangeHandler(){this.updateScaleRangeActive()&&!this._scaleRangeActive?this.graphicsCore.modifyGraphics3DGraphicVisibilities((e=>e.clearVisibilityFlag(n.SCALE_RANGE))):this._scaleRangeActive&&this.graphicsCore.updateAllGraphicsVisibility(),this._setDirty()}};function y(e,i){return e>0||i>0}e([r({constructOnly:!0})],p.prototype,"layerScaleEnabled",void 0),e([r({readOnly:!0})],p.prototype,"suspended",void 0),e([r({readOnly:!0})],p.prototype,"updating",void 0),p=e([l("esri.views.3d.layers.graphics.Graphics3DScaleVisibility")],p);const u="terrain-events",d=p;export{d as default};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import i from"../../../../core/Accessor.js";import t from"../../../../core/Handles.js";import{isSome as s,isNone as a}from"../../../../core/maybe.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{VisibilityFlag as n,VisibilityGroup as c}from"./enums.js";import{scaleBoundsPredicate as h}from"../../../support/layerViewUtils.js";import{TaskPriority as o}from"../../../support/Scheduler.js";let p=class extends i{constructor(){super(...arguments),this._scaleRangeActive=!1,this.layerScaleRangeVisibilityQuery=!1,this.handles=new t,this.graphicsCoreOwner=null,this.layer=null,this.queryGraphicUIDsInExtent=null,this.extent=null,this.graphicsCore=null,this.basemapTerrain=null,this.layerScaleEnabled=!0,this.suspended=!1,this.updating=!0}setup(e,i,t,s,a){this.graphicsCoreOwner=e,this.layer=i,this.queryGraphicUIDsInExtent=t,this.graphicsCore=s,this.basemapTerrain=a,this.updateScaleRangeActive();const r=this.graphicsCoreOwner.view.resourceController.scheduler;this.handles.add(r.registerTask(o.SCALE_VISIBILITY,this))}destroy(){this.handles.destroy(),this.handles=null,this.graphicsCoreOwner=null,this.extent=null,this.queryGraphicUIDsInExtent=null,this.graphicsCore=null}_setDirty(){this.updating||this._set("updating",!0)}setExtent(e){this.extent=e,this._setDirty()}scaleRangeActive(){return this._scaleRangeActive}updateScaleRangeActive(){const e=this.layer,i=e.effectiveScaleRange;let t=this.layerScaleEnabled&&u(i.minScale,i.maxScale);e.labelingInfo&&!t&&(t=e.labelingInfo.some((e=>e&&u(e.minScale,e.maxScale))));const s=this._scaleRangeActive!==t;return this._scaleRangeActive=t,t&&!this.handles.has(d)&&this.basemapTerrain?(this.handles.add(this.basemapTerrain.on("scale-change",(e=>this._scaleUpdateHandler(e))),d),this.layerScaleEnabled&&this.handles.add(this.basemapTerrain.on("tiles-visibility-changed",(()=>this._setDirty())),d)):!t&&this.handles.has(d)&&this.handles.remove(d),s}get running(){return!(!this.graphicsCoreOwner.view.basemapTerrain||!this.updating)}runTask(){const e=this.graphicsCoreOwner.view.basemapTerrain;if(this.extent&&e&&e.ready&&this._scaleRangeActive&&this.layerScaleEnabled){if(!this.layerScaleRangeVisibilityQuery){this.layerScaleRangeVisibilityQuery=!0;const i=this.layer.effectiveScaleRange;e.queryVisibleScaleRange(this.extent,i.minScale,i.maxScale,(e=>this._finishUpdate(e)))}}else this._finishUpdate(!0)}_finishUpdate(e){this.layerScaleRangeVisibilityQuery=!1,this._set("suspended",!e),this._set("updating",!1)}_visibleAtLayerScale(e){const i=this.layer.effectiveScaleRange;return!this.layerScaleEnabled||h(e,i.minScale||0,i.maxScale||0)}_visibleAtLabelScale(e,i){return h(e,i.minScale||0,i.maxScale||0)}_graphicScale(e){let i;if(s(e.centroid)?i=e.centroid:s(e.graphic.geometry)&&"point"===e.graphic.geometry.type&&(i=e.graphic.geometry),i){return this.graphicsCoreOwner.view.basemapTerrain?this.graphicsCoreOwner.view.basemapTerrain.getScale(i):1}return null}_graphicVisible(e){if(!this.layerScaleEnabled)return!0;const i=this._graphicScale(e);return this._visibleAtLayerScale(i)}updateVisibility(e){if(this._scaleRangeActive){const i=this._graphicVisible(e);return e.setVisibilityFlag(n.SCALE_RANGE,i,c.GRAPHIC)}return!1}updateGraphicLabelScaleVisibility(e){if(!this._scaleRangeActive)return!1;if(!e.labelGraphics||0===e.labelGraphics.length)return!1;const i=this._graphicScale(e),t=this._updateLabelScaleVisibility(e,i);return t&&(this.graphicsCoreOwner.view.deconflictor.setDirty(),this.graphicsCoreOwner.view.labeler.setDirty()),t}_updateLabelScaleVisibility(e,i){if(!e.labelGraphics||0===e.labelGraphics.length)return!1;const t=e.labelGraphics[0]._labelClass;if(t&&null!=t.minScale&&null!=t.maxScale){const s=this._visibleAtLabelScale(i,t);if(e.setVisibilityFlag(n.SCALE_RANGE,s,c.LABEL))return!0}return!1}_scaleUpdateHandler(e){if(this._setDirty(),this.graphicsCoreOwner.suspended)return;const i=e.extent,t=e.scale,r=this._visibleAtLayerScale(t);let l=!1;this.queryGraphicUIDsInExtent(i,e.spatialReference,(e=>{const h=this.graphicsCore.getGraphics3DGraphicById(e);if(a(h))return;const o=h.centroid;s(o)&&(i[0]>o.x||i[1]>o.y||i[2]<o.x||i[3]<o.y)||(h.setVisibilityFlag(n.SCALE_RANGE,r,c.GRAPHIC)&&(l=!0),this._updateLabelScaleVisibility(h,t)&&(l=!0))})),l&&(this.graphicsCoreOwner.view.deconflictor.setDirty(),this.graphicsCoreOwner.view.labeler.setDirty())}layerMinMaxScaleChangeHandler(){this.updateScaleRangeActive()&&!this._scaleRangeActive?this.graphicsCore.modifyGraphics3DGraphicVisibilities((e=>e.clearVisibilityFlag(n.SCALE_RANGE))):this._scaleRangeActive&&this.graphicsCore.updateAllGraphicsVisibility(),this._setDirty()}};function u(e,i){return e>0||i>0}e([r({constructOnly:!0})],p.prototype,"layerScaleEnabled",void 0),e([r({readOnly:!0})],p.prototype,"suspended",void 0),e([r({readOnly:!0})],p.prototype,"updating",void 0),p=e([l("esri.views.3d.layers.graphics.Graphics3DScaleVisibility")],p);const d="terrain-events",y=p;export{y as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- class e{constructor(e){this.schedule=e,this.sharedResources=null,this.streamDataRequester=null,this.elevationProvider=null,this.renderer=null,this.stage=null,this.clippingExtent=null,this.renderCoordsHelper=null,this.overlaySR=null,this.layer=null,this.layerView=null,this.localOriginFactory=null,this.featureExpressionInfoContext=null,this.screenSizePerspectiveEnabled=!0,this.slicePlaneEnabled=!1,this.physicalBasedRenderingEnabled=!1,this.isAsync=!1}}class l{}export{e as Graphics3DSymbolCreationContext,l as Graphics3DSymbolLayerCreationContext};
5
+ class e{constructor(e){this.schedule=e,this.sharedResources=null,this.streamDataRequester=null,this.elevationProvider=null,this.renderer=null,this.stage=null,this.clippingExtent=null,this.renderCoordsHelper=null,this.overlaySR=null,this.layer=null,this.graphicsCoreOwner=null,this.localOriginFactory=null,this.featureExpressionInfoContext=null,this.screenSizePerspectiveEnabled=!0,this.slicePlaneEnabled=!1,this.physicalBasedRenderingEnabled=!1,this.isAsync=!1}}class l{}export{e as Graphics3DSymbolCreationContext,l as Graphics3DSymbolLayerCreationContext};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{isSome as o,unwrap as i,unwrapOr as r}from"../../../../core/maybe.js";import{O as n}from"../../../../chunks/vec3f64.js";import{f as s}from"../../../../chunks/vec4f64.js";import{SymbolUpdateType as a}from"./elevationAlignmentUtils.js";import{ElevationContext as l}from"./ElevationContext.js";import{zeroContext as p}from"./featureExpressionInfoUtils.js";import{mixinColorAndOpacity as d}from"./graphicUtils.js";import{ApplyRendererDiffResult as c}from"./interfaces.js";import{Loadable as u}from"./Loadable.js";import{defaultSymbolLayerComplexity as h}from"./symbolComplexity.js";const f=t.getLogger("esri.views.3d.layers.graphics.Graphics3DSymbolLayer");class y extends u{constructor(e,t,o,i){super(o.schedule),this._context=o,this._elevationInfoOverride=null,this.complexity=null,this.logger=f,this._elevationOptions={supportsOffsetAdjustment:!1,supportsOnTheGround:!0},this.symbol=e,this.symbolLayer=t,this._renderPriority=i.renderPriority,this._renderPriorityStep=i.renderPriorityStep,this._elevationContext=new l,this.complexity=this.computeComplexity(),this._updateDrivenProperties(i.ignoreDrivers),this._updateElevationContext()}getCachedSize(){return null}get extentPadding(){return 0}get needsDrivenTransparentPass(){return this._drivenProperties.opacity&&!this._drivenProperties.opacityAlwaysOpaque}_logGeometryCreationWarnings(e,t,o,i){const r=e.projectionSuccess,n="polygons"in e?e.polygons:null,s=`${i} geometry failed to be created`;let a=null;r?!t.length||1===t.length&&!t[0].length?a=`${s} (no ${o} were defined)`:Array.isArray(t)&&Array.isArray(t[0])?n&&0===n.length&&"rings"===o&&t.length>0&&t[0].length>2&&(a=`${s} (filled rings should use clockwise winding - try reversing the order of vertices)`):a=`${s} (${o} should be defined as a 2D array)`:a=`${s} (failed to project geometry to view spatial reference)`,a&&f.warnOncePerTick(a)}_validateGeometry(e,t=null,i=null){if(o(t)&&!t.includes(e.type))return this.logger.warn("unsupported geometry type for "+i+` symbol: ${e.type}`),!1;if("point"===e.type){const t=e;if(!isFinite(t.x)||!isFinite(t.y))return f.warn("point coordinate is not a valid number, graphic skipped"),!1}return!0}_defaultElevationInfoNoZ(){return m}_defaultElevationInfoZ(){return g}_updateElevationContext(){o(this._elevationInfoOverride)?(this._elevationContext.setFromElevationInfo(this._elevationInfoOverride),this._elevationContext.updateFeatureExpressionInfoContext(null)):this._context.layer.elevationInfo?(this._elevationContext.setFromElevationInfo(this._context.layer.elevationInfo),this._elevationContext.updateFeatureExpressionInfoContext(this._context.featureExpressionInfoContext)):this._elevationContext.reset()}getDefaultElevationInfo(e){return e.hasZ?this._defaultElevationInfoZ():this._defaultElevationInfoNoZ()}getGeometryElevationMode(e,t=this.getDefaultElevationInfo(e)){return this._elevationContext.mode||t.mode}setElevationInfoOverride(e){this._elevationInfoOverride=e,this._updateElevationContext()}setGraphicElevationContext(e,t){const o=i(e.geometry),n=this.getDefaultElevationInfo(o);t.unit=null!=this._elevationContext.unit?this._elevationContext.unit:n.unit,t.mode=this.getGeometryElevationMode(o,n),t.offsetMeters=r(this._elevationContext.meterUnitOffset,r(n.offset,0));const s=!this._elevationOptions.supportsOnTheGround&&"on-the-ground"===t.mode;s&&(t.mode="relative-to-ground",t.offsetMeters=0);const a=s?p:this._elevationContext.featureExpressionInfoContext;return t.updateFeatureExpressionInfoContext(a,e,this._context.layer),t}prepareSymbolLayerPatch(e){}updateGeometry(e,t){return!1}onRemoveGraphic(e){}_updateDrivenProperties(e){const t={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1};if(e)return void(this._drivenProperties=t);const o=this._context.renderer;o&&"visualVariables"in o&&o.visualVariables&&o.visualVariables.forEach((e=>{switch(e.type){case"color":if(t.color=!0,e.stops)for(let o=0;o<e.stops.length;o++){const i=e.stops[o].color;i&&(t.opacity=!0,i.a<1&&(t.opacityAlwaysOpaque=!1))}break;case"opacity":t.opacity=!0,t.opacityAlwaysOpaque=!1;break;case"size":t.size=!0}})),this._drivenProperties=t}_getLayerOpacity(){if(this._context.layerView&&"fullOpacity"in this._context.layerView)return this._context.layerView.fullOpacity;const e=this._context.layer.opacity;return null==e?1:e}_getCombinedOpacity(e,t=_){let i=1;return this.draped||(i*=this._getLayerOpacity()),this._drivenProperties.opacity||(o(e)?i*=e.a:t.hasIntrinsicColor||(i=0)),i}_getCombinedOpacityAndColor(t,i=_){const r=this._getCombinedOpacity(t,i);if(this._drivenProperties.color)return d(null,r);const s=o(t)?e.toUnitRGB(t):n;return d(s,r)}_getVertexOpacityAndColor(e,t=null){const i=this._drivenProperties.color?e.color:null,r=this._drivenProperties.opacity?e.opacity:null,n=d(i,r);return o(t)&&(n[0]*=t,n[1]*=t,n[2]*=t,n[3]*=t),n}isFastUpdatesEnabled(){return this._fastUpdates&&this._fastUpdates.enabled}computeComplexity(){return h(this.symbol,this.symbolLayer)}globalPropertyChanged(e,t,o){switch(e){case"opacity":return this.layerOpacityChanged(t,o);case"elevationInfo":{const e=this._elevationContext.mode;this._updateElevationContext();return this.layerElevationInfoChanged(t,o,e)!==a.RECREATE}case"slicePlaneEnabled":return this.slicePlaneEnabledChanged(t,o);case"physicalBasedRenderingEnabled":return this.physicalBasedRenderingChanged();case"pixelRatio":return this.pixelRatioChanged();default:return!1}}updateGraphics3DGraphicElevationInfo(e,t,i){let r=a.UPDATE;return e.forEach((e=>{const n=t(e);if(o(n)){const t=e.graphic;this.setGraphicElevationContext(t,n.elevationContext),n.needsElevationUpdates=i(n.elevationContext.mode)}else r=a.RECREATE})),r}applyRendererDiff(e,t){return c.Recreate_Symbol}getFastUpdateAttrValues(e){if(!this._fastUpdates.enabled)return null;const t=this._fastUpdates.visualVariables,o=t.size?v(t.size.field,e):0,i=t.color?v(t.color.field,e):0,r=t.opacity?v(t.opacity.field,e):0;return s(o,i,r,0)}get draped(){return this._draped}ensureDrapedStatus(e){return null==this._draped?(this._draped=e,!0):(e!==this.draped&&f.warnOnce("A symbol can only produce either draped or non-draped visualizations. Use two separate symbol instances for draped and non-draped graphics if necessary."),!1)}}function v(e,t){const o=null!=e?t.attributes[e]:0;return null!=o&&isFinite(o)?o:0}const m={mode:"on-the-ground",offset:0,unit:"meters"},g={mode:"absolute-height",offset:0,unit:"meters"},_={hasIntrinsicColor:!1};export{y as Graphics3DSymbolLayer,y as default,v as getAttributeValue};
5
+ import e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{isSome as o,unwrap as i,unwrapOr as r}from"../../../../core/maybe.js";import{O as n}from"../../../../chunks/vec3f64.js";import{f as s}from"../../../../chunks/vec4f64.js";import{SymbolUpdateType as a}from"./elevationAlignmentUtils.js";import{ElevationContext as l}from"./ElevationContext.js";import{zeroContext as p}from"./featureExpressionInfoUtils.js";import{mixinColorAndOpacity as d}from"./graphicUtils.js";import{ApplyRendererDiffResult as c}from"./interfaces.js";import{Loadable as u}from"./Loadable.js";import{defaultSymbolLayerComplexity as h}from"./symbolComplexity.js";const f=t.getLogger("esri.views.3d.layers.graphics.Graphics3DSymbolLayer");class y extends u{constructor(e,t,o,i){super(o.schedule),this._context=o,this._elevationInfoOverride=null,this.complexity=null,this.logger=f,this._elevationOptions={supportsOffsetAdjustment:!1,supportsOnTheGround:!0},this.symbol=e,this.symbolLayer=t,this._renderPriority=i.renderPriority,this._renderPriorityStep=i.renderPriorityStep,this._elevationContext=new l,this.complexity=this.computeComplexity(),this._updateDrivenProperties(i.ignoreDrivers),this._updateElevationContext()}getCachedSize(){return null}get extentPadding(){return 0}get needsDrivenTransparentPass(){return this._drivenProperties.opacity&&!this._drivenProperties.opacityAlwaysOpaque}_logGeometryCreationWarnings(e,t,o,i){const r=e.projectionSuccess,n="polygons"in e?e.polygons:null,s=`${i} geometry failed to be created`;let a=null;r?!t.length||1===t.length&&!t[0].length?a=`${s} (no ${o} were defined)`:Array.isArray(t)&&Array.isArray(t[0])?n&&0===n.length&&"rings"===o&&t.length>0&&t[0].length>2&&(a=`${s} (filled rings should use clockwise winding - try reversing the order of vertices)`):a=`${s} (${o} should be defined as a 2D array)`:a=`${s} (failed to project geometry to view spatial reference)`,a&&f.warnOncePerTick(a)}_validateGeometry(e,t=null,i=null){if(o(t)&&!t.includes(e.type))return this.logger.warn("unsupported geometry type for "+i+` symbol: ${e.type}`),!1;if("point"===e.type){const t=e;if(!isFinite(t.x)||!isFinite(t.y))return f.warn("point coordinate is not a valid number, graphic skipped"),!1}return!0}_defaultElevationInfoNoZ(){return m}_defaultElevationInfoZ(){return g}_updateElevationContext(){o(this._elevationInfoOverride)?(this._elevationContext.setFromElevationInfo(this._elevationInfoOverride),this._elevationContext.updateFeatureExpressionInfoContext(null)):this._context.layer.elevationInfo?(this._elevationContext.setFromElevationInfo(this._context.layer.elevationInfo),this._elevationContext.updateFeatureExpressionInfoContext(this._context.featureExpressionInfoContext)):this._elevationContext.reset()}getDefaultElevationInfo(e){return e.hasZ?this._defaultElevationInfoZ():this._defaultElevationInfoNoZ()}getGeometryElevationMode(e,t=this.getDefaultElevationInfo(e)){return this._elevationContext.mode||t.mode}setElevationInfoOverride(e){this._elevationInfoOverride=e,this._updateElevationContext()}setGraphicElevationContext(e,t){const o=i(e.geometry),n=this.getDefaultElevationInfo(o);t.unit=null!=this._elevationContext.unit?this._elevationContext.unit:n.unit,t.mode=this.getGeometryElevationMode(o,n),t.offsetMeters=r(this._elevationContext.meterUnitOffset,r(n.offset,0));const s=!this._elevationOptions.supportsOnTheGround&&"on-the-ground"===t.mode;s&&(t.mode="relative-to-ground",t.offsetMeters=0);const a=s?p:this._elevationContext.featureExpressionInfoContext;return t.updateFeatureExpressionInfoContext(a,e,this._context.layer),t}prepareSymbolLayerPatch(e){}updateGeometry(e,t){return!1}onRemoveGraphic(e){}_updateDrivenProperties(e){const t={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1};if(e)return void(this._drivenProperties=t);const o=this._context.renderer;o&&"visualVariables"in o&&o.visualVariables&&o.visualVariables.forEach((e=>{switch(e.type){case"color":if(t.color=!0,e.stops)for(let o=0;o<e.stops.length;o++){const i=e.stops[o].color;i&&(t.opacity=!0,i.a<1&&(t.opacityAlwaysOpaque=!1))}break;case"opacity":t.opacity=!0,t.opacityAlwaysOpaque=!1;break;case"size":t.size=!0}})),this._drivenProperties=t}_getLayerOpacity(){if(this._context.graphicsCoreOwner&&"fullOpacity"in this._context.graphicsCoreOwner)return this._context.graphicsCoreOwner.fullOpacity;const e=this._context.layer.opacity;return null==e?1:e}_getCombinedOpacity(e,t=_){let i=1;return this.draped||(i*=this._getLayerOpacity()),this._drivenProperties.opacity||(o(e)?i*=e.a:t.hasIntrinsicColor||(i=0)),i}_getCombinedOpacityAndColor(t,i=_){const r=this._getCombinedOpacity(t,i);if(this._drivenProperties.color)return d(null,r);const s=o(t)?e.toUnitRGB(t):n;return d(s,r)}_getVertexOpacityAndColor(e,t=null){const i=this._drivenProperties.color?e.color:null,r=this._drivenProperties.opacity?e.opacity:null,n=d(i,r);return o(t)&&(n[0]*=t,n[1]*=t,n[2]*=t,n[3]*=t),n}isFastUpdatesEnabled(){return this._fastUpdates&&this._fastUpdates.enabled}computeComplexity(){return h(this.symbol,this.symbolLayer)}globalPropertyChanged(e,t,o){switch(e){case"opacity":return this.layerOpacityChanged(t,o);case"elevationInfo":{const e=this._elevationContext.mode;this._updateElevationContext();return this.layerElevationInfoChanged(t,o,e)!==a.RECREATE}case"slicePlaneEnabled":return this.slicePlaneEnabledChanged(t,o);case"physicalBasedRenderingEnabled":return this.physicalBasedRenderingChanged();case"pixelRatio":return this.pixelRatioChanged();default:return!1}}updateGraphics3DGraphicElevationInfo(e,t,i){let r=a.UPDATE;return e.forEach((e=>{const n=t(e);if(o(n)){const t=e.graphic;this.setGraphicElevationContext(t,n.elevationContext),n.needsElevationUpdates=i(n.elevationContext.mode)}else r=a.RECREATE})),r}applyRendererDiff(e,t){return c.Recreate_Symbol}getFastUpdateAttrValues(e){if(!this._fastUpdates.enabled)return null;const t=this._fastUpdates.visualVariables,o=t.size?v(t.size.field,e):0,i=t.color?v(t.color.field,e):0,r=t.opacity?v(t.opacity.field,e):0;return s(o,i,r,0)}get draped(){return this._draped}ensureDrapedStatus(e){return null==this._draped?(this._draped=e,!0):(e!==this.draped&&f.warnOnce("A symbol can only produce either draped or non-draped visualizations. Use two separate symbol instances for draped and non-draped graphics if necessary."),!1)}}function v(e,t){const o=null!=e?t.attributes[e]:0;return null!=o&&isFinite(o)?o:0}const m={mode:"on-the-ground",offset:0,unit:"meters"},g={mode:"absolute-height",offset:0,unit:"meters"},_={hasIntrinsicColor:!1};export{y as Graphics3DSymbolLayer,y as default,v as getAttributeValue};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Error.js";import{isNone as t,get as r,isSome as n}from"../../../../core/maybe.js";import{pt2px as s}from"../../../../core/screenUtils.js";import{a as o}from"../../../../chunks/vec2f64.js";import{isCalloutSupport as i}from"../../../../symbols/callouts/calloutUtils.js";import{perObjectElevationAligner as a}from"./ElevationAligners.js";import{SymbolUpdateType as l,needsElevationUpdates2D as c}from"./elevationAlignmentUtils.js";import{ElevationContext as h}from"./ElevationContext.js";import{Graphics3DObject3DGraphicLayer as d}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as m}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as f,namedAnchorToHUDMaterialAnchorPos as p}from"./graphicUtils.js";import{placePointOnGeometry as g,createStageObjectForHUD as u,extendPointGraphicElevationContext as y}from"./pointUtils.js";import b from"../../webgl-engine/lib/GeometryUtil.js";import{TextRenderParameters as x}from"../../webgl-engine/lib/TextRenderParameters.js";import v from"../../webgl-engine/lib/TextTexture.js";import{HUDMaterial as O}from"../../webgl-engine/materials/HUDMaterial.js";const w=[0,0,1];class P extends m{constructor(e,t,r,n){super(e,t,r,n),this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!1},this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const t=f(this.symbolLayer.size);if(t)throw new e("graphics3dtextsymbollayer:invalid-size",t)}await this._createTextRenderParameters()}async _createTextRenderParameters(){const e=this._context.layerView.view.pixelRatio;this._textRenderParameters=await x.fromSymbol(this.symbolLayer,e)}destroy(){super.destroy()}createGraphics3DGraphic(e){const r=e.graphic,n=g(r.geometry);if(t(n))return this.logger.warn(`unsupported geometry type for text symbol: ${r.geometry.type}`),null;const s=this.symbolLayer.text;if(t(s)||""===s)return null;const o=i(this.symbol)&&this.symbol.hasVisibleVerticalOffset()?this.symbol:null,a={..._,anchor:this._anchorFromAlignment(this.symbolLayer.horizontalAlignment,this.symbolLayer.verticalAlignment)};return this._createAs3DShape(r,n,s,o,a)}createLabel(e,r,n,s){const o=e.graphic,i=g(o.geometry);if(t(i))return this.logger.warn(`unsupported geometry type for label: ${o.geometry.type}`),null;const a=r.text;return!a||/^\s+$/.test(a)?null:this._createAs3DShape(o,i,a,r,r,n,s)}setGraphicElevationContext(e,t,r=0){const n=super.setGraphicElevationContext(e,t);return n.addOffsetRenderUnits(r),n}layerOpacityChanged(){return this.logger.warn("layer opacity change not yet implemented in Graphics3DTextSymbolLayer"),!1}layerElevationInfoChanged(e,t){return E(e,t,((e,t)=>{this.updateGraphicElevationContext(t,e)})),l.UPDATE}slicePlaneEnabledChanged(e,t){return E(e,t,(e=>{for(const t of e.stageObject.geometryRecords)t.material.setParameters({slicePlaneEnabled:this._context.slicePlaneEnabled})})),!0}physicalBasedRenderingChanged(){return!0}pixelRatioChanged(){return!1}updateGraphicElevationContext(e,t){this.setGraphicElevationContext(e,t.elevationContext,t.metadata.elevationOffset),t.needsElevationUpdates=c(t.elevationContext.mode)||"absolute-height"===t.elevationContext.mode}_defaultElevationInfoNoZ(){return S}_createAs3DShape(e,i,l,m,f=_,g,x){const P=this.setGraphicElevationContext(e,new h,f.elevationOffset),E="polyline"===r(e.geometry,"type"),S=e.uid,j=this._context.stage.renderView.renderingContext,L=f.anchor in p?f.anchor:"center",C=p[L],G=t(x)?new v(j,l,this._textRenderParameters):null,D={occlusionTest:!0,screenOffset:f.screenOffset,anchorPos:C,polygonOffset:!0,color:[1,1,1,1],centerOffsetUnits:f.centerOffsetUnits,debugDrawLabelBorder:f.debugDrawLabelBorder,drawInSecondSlot:!0};if(n(G)&&(D.textureId=G.id,D.texCoordScale=G.texcoordScale),n(x)&&(D.textureId=x.id),n(m)&&n(m.verticalOffset)){const{screenLength:e,minWorldLength:t,maxWorldLength:r}=m.verticalOffset;D.verticalOffset={screenLength:s(e),minWorldLength:t||0,maxWorldLength:null!=r?r:1/0}}if(this._context.screenSizePerspectiveEnabled){const{screenSizePerspectiveSettings:e,screenSizePerspectiveSettingsLabels:t}=this._context.sharedResources;D.screenSizePerspective=t.overridePadding(this._textRenderParameters.haloSize),D.screenSizePerspectiveAlignment=e}let U;if(E&&(D.shaderPolygonOffset=1e-4),D.slicePlaneEnabled=this._context.slicePlaneEnabled,n(g)){const e=JSON.stringify(D);U=g.get(e),t(U)&&(U=new O(D),g.add(e,U))}else U=new O(D);const A=[U],R=f.translation,z=n(G)?[G.displayWidth,G.displayHeight]:[0,0],T=f.centerOffset,W=w,I=[0,0],B=[b.createPointGeometry(W,R,null,z,T,I,null)],H=this._context.layer.uid,V=u(this._context,i,B,A,P,H,S);if(null===V)return null;const $=new d(this,V.object,B,t(g)?A:null,n(G)?[G]:null,a,P);$.alignedSampledElevation=V.sampledElevation,$.needsElevationUpdates=c(P.mode)||"absolute-height"===P.mode;const{displayWidth:F,displayHeight:N}=n(G)?G:f;$.getScreenSize=(e=o())=>(e[0]=F,e[1]=N,e);const k={labelText:l,elevationOffset:f.elevationOffset};return $.metadata=k,y($,i,this._context.elevationProvider),$}_anchorFromAlignment(e,t){switch(t){case"bottom":return"left"===e?"bottom-left":"right"===e?"bottom-right":"bottom";case"baseline":case"middle":return"justify"===e?"center":e;case"top":return"left"===e?"top-left":"right"===e?"top-right":"top"}}}function E(e,t,r){e&&e.forEach((e=>{const s=t(e);n(s)&&r(s,e.graphic)}))}const S={mode:"relative-to-ground",offset:0},_={text:null,translation:[0,0,0],elevationOffset:0,centerOffset:[0,0,0,1],screenOffset:[0,0],anchor:"center",verticalOffset:null,centerOffsetUnits:null,debugDrawLabelBorder:!1,displayWidth:0,displayHeight:0};export{P as Graphics3DTextSymbolLayer,P as default};
5
+ import e from"../../../../core/Error.js";import{isNone as t,get as r,isSome as n}from"../../../../core/maybe.js";import{pt2px as s}from"../../../../core/screenUtils.js";import{a as o}from"../../../../chunks/vec2f64.js";import{isCalloutSupport as i}from"../../../../symbols/callouts/calloutUtils.js";import{perObjectElevationAligner as a}from"./ElevationAligners.js";import{SymbolUpdateType as l,needsElevationUpdates2D as c}from"./elevationAlignmentUtils.js";import{ElevationContext as h}from"./ElevationContext.js";import{Graphics3DObject3DGraphicLayer as d}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as m}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as f,namedAnchorToHUDMaterialAnchorPos as p}from"./graphicUtils.js";import{placePointOnGeometry as g,createStageObjectForHUD as u,extendPointGraphicElevationContext as y}from"./pointUtils.js";import b from"../../webgl-engine/lib/GeometryUtil.js";import{TextRenderParameters as x}from"../../webgl-engine/lib/TextRenderParameters.js";import v from"../../webgl-engine/lib/TextTexture.js";import{HUDMaterial as O}from"../../webgl-engine/materials/HUDMaterial.js";const w=[0,0,1];class P extends m{constructor(e,t,r,n){super(e,t,r,n),this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!1},this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const t=f(this.symbolLayer.size);if(t)throw new e("graphics3dtextsymbollayer:invalid-size",t)}await this._createTextRenderParameters()}async _createTextRenderParameters(){const e=this._context.graphicsCoreOwner.view.pixelRatio;this._textRenderParameters=await x.fromSymbol(this.symbolLayer,e)}destroy(){super.destroy()}createGraphics3DGraphic(e){const r=e.graphic,n=g(r.geometry);if(t(n))return this.logger.warn(`unsupported geometry type for text symbol: ${r.geometry.type}`),null;const s=this.symbolLayer.text;if(t(s)||""===s)return null;const o=i(this.symbol)&&this.symbol.hasVisibleVerticalOffset()?this.symbol:null,a={..._,anchor:this._anchorFromAlignment(this.symbolLayer.horizontalAlignment,this.symbolLayer.verticalAlignment)};return this._createAs3DShape(r,n,s,o,a)}createLabel(e,r,n,s){const o=e.graphic,i=g(o.geometry);if(t(i))return this.logger.warn(`unsupported geometry type for label: ${o.geometry.type}`),null;const a=r.text;return!a||/^\s+$/.test(a)?null:this._createAs3DShape(o,i,a,r,r,n,s)}setGraphicElevationContext(e,t,r=0){const n=super.setGraphicElevationContext(e,t);return n.addOffsetRenderUnits(r),n}layerOpacityChanged(){return this.logger.warn("layer opacity change not yet implemented in Graphics3DTextSymbolLayer"),!1}layerElevationInfoChanged(e,t){return E(e,t,((e,t)=>{this.updateGraphicElevationContext(t,e)})),l.UPDATE}slicePlaneEnabledChanged(e,t){return E(e,t,(e=>{for(const t of e.stageObject.geometryRecords)t.material.setParameters({slicePlaneEnabled:this._context.slicePlaneEnabled})})),!0}physicalBasedRenderingChanged(){return!0}pixelRatioChanged(){return!1}updateGraphicElevationContext(e,t){this.setGraphicElevationContext(e,t.elevationContext,t.metadata.elevationOffset),t.needsElevationUpdates=c(t.elevationContext.mode)||"absolute-height"===t.elevationContext.mode}_defaultElevationInfoNoZ(){return S}_createAs3DShape(e,i,l,m,f=_,g,x){const P=this.setGraphicElevationContext(e,new h,f.elevationOffset),E="polyline"===r(e.geometry,"type"),S=e.uid,j=this._context.stage.renderView.renderingContext,L=f.anchor in p?f.anchor:"center",C=p[L],G=t(x)?new v(j,l,this._textRenderParameters):null,D={occlusionTest:!0,screenOffset:f.screenOffset,anchorPos:C,polygonOffset:!0,color:[1,1,1,1],centerOffsetUnits:f.centerOffsetUnits,debugDrawLabelBorder:f.debugDrawLabelBorder,drawInSecondSlot:!0};if(n(G)&&(D.textureId=G.id,D.texCoordScale=G.texcoordScale),n(x)&&(D.textureId=x.id),n(m)&&n(m.verticalOffset)){const{screenLength:e,minWorldLength:t,maxWorldLength:r}=m.verticalOffset;D.verticalOffset={screenLength:s(e),minWorldLength:t||0,maxWorldLength:null!=r?r:1/0}}if(this._context.screenSizePerspectiveEnabled){const{screenSizePerspectiveSettings:e,screenSizePerspectiveSettingsLabels:t}=this._context.sharedResources;D.screenSizePerspective=t.overridePadding(this._textRenderParameters.haloSize),D.screenSizePerspectiveAlignment=e}let U;if(E&&(D.shaderPolygonOffset=1e-4),D.slicePlaneEnabled=this._context.slicePlaneEnabled,n(g)){const e=JSON.stringify(D);U=g.get(e),t(U)&&(U=new O(D),g.add(e,U))}else U=new O(D);const A=[U],R=f.translation,z=n(G)?[G.displayWidth,G.displayHeight]:[0,0],T=f.centerOffset,W=w,I=[0,0],B=[b.createPointGeometry(W,R,null,z,T,I,null)],H=this._context.layer.uid,V=u(this._context,i,B,A,P,H,S);if(null===V)return null;const $=new d(this,V.object,B,t(g)?A:null,n(G)?[G]:null,a,P);$.alignedSampledElevation=V.sampledElevation,$.needsElevationUpdates=c(P.mode)||"absolute-height"===P.mode;const{displayWidth:F,displayHeight:N}=n(G)?G:f;$.getScreenSize=(e=o())=>(e[0]=F,e[1]=N,e);const k={labelText:l,elevationOffset:f.elevationOffset};return $.metadata=k,y($,i,this._context.elevationProvider),$}_anchorFromAlignment(e,t){switch(t){case"bottom":return"left"===e?"bottom-left":"right"===e?"bottom-right":"bottom";case"baseline":case"middle":return"justify"===e?"center":e;case"top":return"left"===e?"top-left":"right"===e?"top-right":"top"}}}function E(e,t,r){e&&e.forEach((e=>{const s=t(e);n(s)&&r(s,e.graphic)}))}const S={mode:"relative-to-ground",offset:0},_={text:null,translation:[0,0,0],elevationOffset:0,centerOffset:[0,0,0,1],screenOffset:[0,0],anchor:"center",verticalOffset:null,centerOffsetUnits:null,debugDrawLabelBorder:!1,displayWidth:0,displayHeight:0};export{P as Graphics3DTextSymbolLayer,P as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import{isSome as t,isNone as r,unwrap as o}from"../../../../core/maybe.js";import{getMetersPerUnitForSR as i}from"../../../../core/unitUtils.js";import{e as a}from"../../../../chunks/earcut.js";import{I as n}from"../../../../chunks/mat4f64.js";import{s}from"../../../../chunks/vec2.js";import{f as l,a as u}from"../../../../chunks/vec2f64.js";import{b as c,s as m}from"../../../../chunks/vec4.js";import{t as h}from"../../../../chunks/common.js";import{create as d,empty as p,expandWithBuffer as g,intersectsClippingArea as y,expandWithAABB as f}from"../../../../geometry/support/aaBoundingBox.js";import{create as _,empty as v,expandPointInPlace as x}from"../../../../geometry/support/aaBoundingRect.js";import{perVertexElevationAligner as D}from"./ElevationAligners.js";import{SymbolUpdateType as b,elevationModeChangeUpdateType as C,needsElevationUpdates2D as E}from"./elevationAlignmentUtils.js";import{ElevationContext as w}from"./ElevationContext.js";import G from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as S}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as j}from"./Graphics3DSymbolLayer.js";import{geometryAsPolygon as T,geometryToRenderInfo as A,createWaterGeometry as P,geometryToRenderInfoDraped as U}from"./polygonUtils.js";import{Object3D as M}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as B}from"../../webgl-engine/lib/RenderGeometry.js";import{WaterMaterial as O}from"../../webgl-engine/materials/WaterMaterial.js";import{defaultWaterMaterialParameters as R,wavePresets as L}from"../../webgl-engine/materials/internal/waterMaterialUtils.js";const N=["polyline","polygon","extent"];class V extends j{constructor(e,t,r,o){super(e,t,r,o)}async doLoad(){}destroy(){super.destroy(),this._context.stage.remove(this._material),this._material=null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,N,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(t,new w);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.ensureMaterial(),this.draped?this._createAsOverlay(t):this._createAs3DShape(t,r,t.uid)}ensureMaterial(){if(t(this._material))return;const r={...R},o=this.symbolLayer.color;t(o)&&(r.color=e.toUnitRGBA(o));const i=this._getCombinedOpacity(o,{hasIntrinsicColor:!0});r.color=[r.color[0],r.color[1],r.color[2],i],r.transparent=i<1||this.needsDrivenTransparentPass,r.waveDirection=t(this.symbolLayer.waveDirection)?V.headingVectorFromAngle(this.symbolLayer.waveDirection):l(0,0);const a=this.symbolLayer.waveStrength+"-"+this.symbolLayer.waterbodySize,n=L[a];r.waveStrength=n.waveStrength,r.waveTextureRepeat=n.textureRepeat,r.waveVelocity=n.waveVelocity,r.flowStrength=n.perturbationStrength,r.slicePlaneEnabled=this._context.slicePlaneEnabled,r.isDraped=this.draped,this._material=new O(r),this._context.stage.add(this._material)}layerOpacityChanged(){if(r(this._material))return!0;const e=this._material.parameters.color,t=this._getCombinedOpacity(this.symbolLayer.color,{hasIntrinsicColor:!0}),o=t<1||this.needsDrivenTransparentPass;return this._material.setParameters({color:[e[0],e[1],e[2],t],transparent:o}),!0}layerElevationInfoChanged(e,t,r){const o=this._elevationContext.mode,i=C(V.elevationModeChangeTypes,r,o);if(i!==b.UPDATE)return i;const a=E(o);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>a))}slicePlaneEnabledChanged(){return t(this._material)&&this._material.setParameters({slicePlaneEnabled:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}pixelRatioChanged(){return!0}_createAs3DShape(e,t,o){const i=T(e.geometry);if(r(i))return null;z.renderData=A(i,this._context.elevationProvider,this._context.renderCoordsHelper,t);const a=z.renderData.position.length/3;if(z.uvCoords=new Float64Array(2*a),z.outNum=0,z.outGeometries=[],z.outTransforms=[],z.outMaterials=[],this._create3DShapeGeometries(z),this._logGeometryCreationWarnings(z.renderData,i.rings,"rings","WaterSymbol3DLayer"),0===z.outNum)return null;this._createUVCoordsFromVertices(z.uvCoords,z.renderData.mapPosition,a,this._context.elevationProvider.spatialReference);const n=new M({geometries:z.outGeometries,materials:z.outMaterials,transformations:z.outTransforms,castShadow:!1,metadata:{layerUid:this._context.layer.uid,graphicUid:o}}),s=new S(this,n,z.outGeometries,null,null,D,t);return s.alignedSampledElevation=z.renderData.sampledElevation,s.needsElevationUpdates=E(t.mode),s}_createUVCoordsFromVertices(e,t,r,o){const a=i(o);v(I);for(let i=0;i<r;i++)s(W,t[3*i+0],t[3*i+1]),x(I,W);c(I,I,a);const n=I[0]%V.unitSizeOfTexture,l=I[1]%V.unitSizeOfTexture;F[0]=I[0]-n,F[1]=I[1]-l;for(let i=0;i<r;i++)e[2*i+0]=(t[3*i+0]*a-F[0])/V.unitSizeOfTexture,e[2*i+1]=(t[3*i+1]*a-F[1])/V.unitSizeOfTexture}_create3DShapeGeometries(e){const r=e.renderData.polygons,i=e.uvCoords;for(const{count:s,index:l,position:u,mapPosition:c,holeIndices:m}of r){if(t(this._context.clippingExtent)&&(p(k),g(k,c),!y(k,this._context.clippingExtent)))continue;const r=a(c,m,3);if(0===r.length)continue;const h=new Uint32Array(r),d=new Float64Array(i.buffer,2*l*i.BYTES_PER_ELEMENT,2*s),f=P({indices:h,attributeData:{position:u,uv0:d,mapPosition:c}});e.outGeometries.push(f),e.outMaterials.push(o(this._material)),e.outTransforms.push(n),e.outNum++}}_createAsOverlay(e){const t=T(e.geometry);if(r(t))return null;o(this._material).renderPriority=this._renderPriority,Y.renderData=U(t,this._context.overlaySR);const i=Y.renderData.position.length/3;return Y.uvCoords=new Float64Array(2*i),Y.outNum=0,Y.outGeometries=[],Y.outBoundingBox=p(),Y.layerUid=this._context.layer.uid,Y.graphicsUid=e.uid,this._createAsOverlayWater(Y),this._logGeometryCreationWarnings(Y.renderData,t.rings,"rings","WaterSymbol3DLayer"),0===Y.outNum?null:(this._createUVCoordsFromVertices(Y.uvCoords,Y.renderData.position,i,this._context.overlaySR),Y.outNum>0?new G(this,Y.outGeometries,Y.outBoundingBox):null)}_createAsOverlayWater(e){const t=e.uvCoords,r=e.renderData.polygons;for(const{position:i,holeIndices:n,index:s,count:l}of r){if(p(k),g(k,i),!y(k,this._context.clippingExtent))continue;f(e.outBoundingBox,k);const r=a(i,n,3);if(0===r.length)continue;const u=new Uint32Array(r),c=new Float64Array(t.buffer,2*s*t.BYTES_PER_ELEMENT,2*l),h=P({indices:u,attributeData:{position:i,uv0:c}}),d=new B(h,o(this._material),e.layerUid,e.graphicsUid),_=k;m(d.boundingSphere,.5*(_[0]+_[3]),.5*(_[1]+_[4]),0,.5*Math.sqrt((_[3]-_[0])*(_[3]-_[0])+(_[4]-_[1])*(_[4]-_[1]))),e.outGeometries.push(d),e.outNum++}}static headingVectorFromAngle(e){const t=u(),r=h(e);return t[0]=Math.sin(r),t[1]=Math.cos(r),t}get test(){return{create3DShape:e=>this._createAs3DShape(e.graphic,e.elevationContext,e.graphicUid),ensureMaterial:()=>this.ensureMaterial()}}}V.unitSizeOfTexture=100,V.elevationModeChangeTypes={definedChanged:b.RECREATE,staysOnTheGround:b.NONE,onTheGroundChanged:b.RECREATE};const F=u(),I=_(),W=u(),k=d(),z={renderData:null,uvCoords:null,outNum:0,outBoundingBox:null,outGeometries:null,outMaterials:null,outTransforms:null},Y={renderData:null,uvCoords:null,outNum:0,outBoundingBox:null,outGeometries:null,outMaterials:null,outTransforms:null};export{V as Graphics3DWaterSymbolLayer,V as default};
5
+ import e from"../../../../Color.js";import{isSome as t,isNone as r,unwrap as o}from"../../../../core/maybe.js";import{getMetersPerUnitForSR as i}from"../../../../core/unitUtils.js";import{e as a}from"../../../../chunks/earcut.js";import{I as n}from"../../../../chunks/mat4f64.js";import{s}from"../../../../chunks/vec2.js";import{f as l,a as u}from"../../../../chunks/vec2f64.js";import{b as c,s as m}from"../../../../chunks/vec4.js";import{t as h}from"../../../../chunks/common.js";import{create as d,empty as p,expandWithBuffer as g,intersectsClippingArea as y,expandWithAABB as f}from"../../../../geometry/support/aaBoundingBox.js";import{create as _,empty as v,expandPointInPlace as x}from"../../../../geometry/support/aaBoundingRect.js";import{perVertexElevationAligner as D}from"./ElevationAligners.js";import{SymbolUpdateType as b,elevationModeChangeUpdateType as C,needsElevationUpdates2D as E}from"./elevationAlignmentUtils.js";import{ElevationContext as w}from"./ElevationContext.js";import G from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as S}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as j}from"./Graphics3DSymbolLayer.js";import{geometryAsPolygon as T,geometryToRenderInfo as A,createWaterGeometry as U,geometryToRenderInfoDraped as P}from"./polygonUtils.js";import{Object3D as M}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as B}from"../../webgl-engine/lib/RenderGeometry.js";import{WaterMaterial as O}from"../../webgl-engine/materials/WaterMaterial.js";import{defaultWaterMaterialParameters as R,wavePresets as L}from"../../webgl-engine/materials/internal/waterMaterialUtils.js";const N=["polyline","polygon","extent"];class V extends j{constructor(e,t,r,o){super(e,t,r,o)}async doLoad(){}destroy(){super.destroy(),this._context.stage.remove(this._material),this._material=null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,N,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(t,new w);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.ensureMaterial(),this.draped?this._createAsOverlay(t):this._createAs3DShape(t,r,t.uid)}ensureMaterial(){if(t(this._material))return;const r={...R},o=this.symbolLayer.color;t(o)&&(r.color=e.toUnitRGBA(o));const i=this._getCombinedOpacity(o,{hasIntrinsicColor:!0});r.color=[r.color[0],r.color[1],r.color[2],i],r.transparent=i<1||this.needsDrivenTransparentPass,r.waveDirection=t(this.symbolLayer.waveDirection)?V.headingVectorFromAngle(this.symbolLayer.waveDirection):l(0,0);const a=this.symbolLayer.waveStrength+"-"+this.symbolLayer.waterbodySize,n=L[a];r.waveStrength=n.waveStrength,r.waveTextureRepeat=n.textureRepeat,r.waveVelocity=n.waveVelocity,r.flowStrength=n.perturbationStrength,r.slicePlaneEnabled=this._context.slicePlaneEnabled,r.isDraped=this.draped,this._material=new O(r),this._context.stage.add(this._material)}layerOpacityChanged(){if(r(this._material))return!0;const e=this._material.parameters.color,t=this._getCombinedOpacity(this.symbolLayer.color,{hasIntrinsicColor:!0}),o=t<1||this.needsDrivenTransparentPass;return this._material.setParameters({color:[e[0],e[1],e[2],t],transparent:o}),!0}layerElevationInfoChanged(e,t,r){const o=this._elevationContext.mode,i=C(V.elevationModeChangeTypes,r,o);if(i!==b.UPDATE)return i;const a=E(o);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>a))}slicePlaneEnabledChanged(){return t(this._material)&&this._material.setParameters({slicePlaneEnabled:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}pixelRatioChanged(){return!0}_createAs3DShape(e,t,o){const i=T(e.geometry);if(r(i))return null;z.renderData=A(i,this._context.elevationProvider,this._context.renderCoordsHelper,t);const a=z.renderData.position.length/3;if(z.uvCoords=new Float64Array(2*a),z.outNum=0,z.outGeometries=[],z.outTransforms=[],z.outMaterials=[],this._create3DShapeGeometries(z),this._logGeometryCreationWarnings(z.renderData,i.rings,"rings","WaterSymbol3DLayer"),0===z.outNum)return null;this._createUVCoordsFromVertices(z.uvCoords,z.renderData.mapPosition,a,this._context.elevationProvider.spatialReference);const n=new M({geometries:z.outGeometries,materials:z.outMaterials,transformations:z.outTransforms,castShadow:!1,metadata:{layerUid:this._context.layer.uid,graphicUid:o}}),s=new S(this,n,z.outGeometries,null,null,D,t);return s.alignedSampledElevation=z.renderData.sampledElevation,s.needsElevationUpdates=E(t.mode),s}_createUVCoordsFromVertices(e,t,r,o){const a=i(o);v(I);for(let i=0;i<r;i++)s(W,t[3*i+0],t[3*i+1]),x(I,W);c(I,I,a);const n=I[0]%V.unitSizeOfTexture,l=I[1]%V.unitSizeOfTexture;F[0]=I[0]-n,F[1]=I[1]-l;for(let i=0;i<r;i++)e[2*i+0]=(t[3*i+0]*a-F[0])/V.unitSizeOfTexture,e[2*i+1]=(t[3*i+1]*a-F[1])/V.unitSizeOfTexture}_create3DShapeGeometries(e){const r=e.renderData.polygons,i=e.uvCoords;for(const{count:s,index:l,position:u,mapPosition:c,holeIndices:m}of r){if(t(this._context.clippingExtent)&&(p(k),g(k,c),!y(k,this._context.clippingExtent)))continue;const r=a(c,m,3);if(0===r.length)continue;const h=new Uint32Array(r),d=new Float64Array(i.buffer,2*l*i.BYTES_PER_ELEMENT,2*s),f=U({indices:h,attributeData:{position:u,uv0:d,mapPosition:c}});e.outGeometries.push(f),e.outMaterials.push(o(this._material)),e.outTransforms.push(n),e.outNum++}}_createAsOverlay(e){const t=T(e.geometry);if(r(t))return null;o(this._material).renderPriority=this._renderPriority,Y.renderData=P(t,this._context.overlaySR);const i=Y.renderData.position.length/3;return Y.uvCoords=new Float64Array(2*i),Y.outNum=0,Y.outGeometries=[],Y.outBoundingBox=p(),Y.layerUid=this._context.layer.uid,Y.graphicsUid=e.uid,this._createAsOverlayWater(Y),this._logGeometryCreationWarnings(Y.renderData,t.rings,"rings","WaterSymbol3DLayer"),0===Y.outNum?null:(this._createUVCoordsFromVertices(Y.uvCoords,Y.renderData.position,i,this._context.overlaySR),Y.outNum>0?new G(this,Y.outGeometries,Y.outBoundingBox):null)}_createAsOverlayWater(e){const t=e.uvCoords,r=e.renderData.polygons;for(const{position:i,holeIndices:n,index:s,count:l}of r){if(p(k),g(k,i),!y(k,this._context.clippingExtent))continue;f(e.outBoundingBox,k);const r=a(i,n,3);if(0===r.length)continue;const u=new Uint32Array(r),c=new Float64Array(t.buffer,2*s*t.BYTES_PER_ELEMENT,2*l),h=U({indices:u,attributeData:{position:i,uv0:c}}),d=new B(h,o(this._material),{layerUid:e.layerUid,graphicUid:e.graphicsUid}),_=k;m(d.boundingSphere,.5*(_[0]+_[3]),.5*(_[1]+_[4]),0,.5*Math.sqrt((_[3]-_[0])*(_[3]-_[0])+(_[4]-_[1])*(_[4]-_[1]))),e.outGeometries.push(d),e.outNum++}}static headingVectorFromAngle(e){const t=u(),r=h(e);return t[0]=Math.sin(r),t[1]=Math.cos(r),t}get test(){return{create3DShape:e=>this._createAs3DShape(e.graphic,e.elevationContext,e.graphicUid),ensureMaterial:()=>this.ensureMaterial()}}}V.unitSizeOfTexture=100,V.elevationModeChangeTypes={definedChanged:b.RECREATE,staysOnTheGround:b.NONE,onTheGroundChanged:b.RECREATE};const F=u(),I=_(),W=u(),k=d(),z={renderData:null,uvCoords:null,outNum:0,outBoundingBox:null,outGeometries:null,outMaterials:null,outTransforms:null},Y={renderData:null,uvCoords:null,outNum:0,outBoundingBox:null,outGeometries:null,outMaterials:null,outTransforms:null};export{V as Graphics3DWaterSymbolLayer,V as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../Graphic.js";import i from"../../../../core/Accessor.js";import s from"../../../../core/Collection.js";import r from"../../../../core/Handles.js";import{isSome as a,destroyMaybe as o,isNone as n}from"../../../../core/maybe.js";import{isAbortError as c}from"../../../../core/promiseUtils.js";import{init as p}from"../../../../core/watchUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{diff as d}from"../../../../core/accessorSupport/diffUtils.js";import u from"../../../../layers/Layer.js";import{hydrateGraphic as g}from"../../../../layers/graphics/hydratedFeatures.js";import m from"../../../../rest/support/Query.js";import{SUSPEND_RESUME_EXTENT_OPTIMISM as y}from"./constants.js";import{Graphics3DCore as f}from"./Graphics3DCore.js";import b from"./Graphics3DElevationAlignment.js";import{Graphics3DObjectStates as j}from"./Graphics3DObjectStates.js";import w from"./Graphics3DScaleVisibility.js";import{enlargeExtent as C}from"./graphicUtils.js";import{UpdatePolicy as S,Object3DState as v}from"../../webgl-engine/lib/basicInterfaces.js";import{WatchUpdatingTracking as x}from"../../../support/WatchUpdatingTracking.js";let E=class extends i{constructor(t){super(t),this.type="graphics-3d",this.graphicsCore=null,this.elevationAlignment=new b,this.watchUpdatingTracking=new x,this.handles=new r,this.suspendResumeExtent=null}normalizeCtorArgs(t){let e=null;t.scaleVisibilityEnabled&&(delete(t={...t}).scaleVisibilityEnabled,e=new w);const i=new f({owner:t.owner,layer:t.layer,preferredUpdatePolicy:S.SYNC,graphicSymbolSupported:!0});return{...t,graphicsCore:i,scaleVisibility:e}}initialize(){const{layer:t,scaleVisibility:e}=this;a(e)&&"graphics"===t.type&&this.watchUpdatingTracking.add((()=>t.effectiveScaleRange),(()=>e.layerMinMaxScaleChangeHandler())),"graphics"===t.type&&this.watchUpdatingTracking.add((()=>t.elevationInfo),((t,e)=>{d(t,e)&&this.watchUpdatingTracking.addPromise(this.graphicsCore.elevationInfoChange())}))}async setup(){const t=(t,e,i)=>this.graphicsCore.spatialIndex.queryGraphicUIDsInExtent(t,e,i);if(this.elevationAlignment.setup(this.owner,t,this.graphicsCore,this.view.elevationProvider),a(this.scaleVisibility)&&"effectiveScaleRange"in this.layer){const e=this.owner.view.basemapTerrain;this.scaleVisibility.setup(this.owner,this.layer,t,this.graphicsCore,e)}this._set("objectStates",new j(this.graphicsCore));try{await this.graphicsCore.setup({elevationAlignment:this.elevationAlignment,scaleVisibility:this.scaleVisibility,objectStates:this.objectStates})}catch(e){if(c(e))return;throw e}this.destroyed||(this.handles.add(this.view.watch("clippingArea",(()=>this._updateClippingExtent()),!0)),this._updateClippingExtent(),this._setupSuspendResumeExtent(),this.graphicsCore.startCreateGraphics())}destroy(){this.handles=o(this.handles),this.watchUpdatingTracking.destroy(),this._set("elevationAlignment",o(this.elevationAlignment)),this._set("scaleVisibility",o(this.scaleVisibility)),this._set("objectStates",o(this.objectStates)),this._set("graphicsCore",o(this.graphicsCore))}get suspended(){return!(!a(this.scaleVisibility)||!this.scaleVisibility.suspended)}get updating(){var t,e;return!!(null!=(t=this.graphicsCore)&&t.updating||a(this.scaleVisibility)&&this.scaleVisibility.updating||null!=(e=this.watchUpdatingTracking)&&e.updating)}getGraphicFromGraphicUid(t){if(this.owner.loadedGraphics){const e=this.owner.loadedGraphics.find((e=>e.uid===t));if(e){const t=this.layer instanceof u?this.layer:null;return g(e,t)}}}whenGraphicBounds(t,e){return this.graphicsCore?this.graphicsCore.whenGraphicBounds(t,e):Promise.reject()}computeAttachmentOrigin(t,e){return this.graphicsCore?this.graphicsCore.computeAttachmentOrigin(t,e):null}getSymbolLayerSize(t,e){return this.graphicsCore?this.graphicsCore.getSymbolLayerSize(t,e):null}maskOccludee(t){const{set:e,handle:i}=this.objectStates.acquireSet(v.MaskOccludee,null);return this.objectStates.setUid(e,t.uid),i}highlight(t){if(t instanceof m)return V;if("number"==typeof t)return this.highlight([t]);if(t instanceof e)return this.highlight([t]);if(t instanceof s&&(t=t.toArray()),Array.isArray(t)&&t.length>0){if(t[0]instanceof e){const e=t.map((t=>t.uid)),{set:i,handle:s}=this.objectStates.acquireSet(v.Highlight,null);return this.objectStates.setUids(i,e),s}if("number"==typeof t[0]){const e=t,{set:i,handle:s}=this.objectStates.acquireSet(v.Highlight,null);return this.objectStates.setObjectIds(i,e),s}}return V}_updateClippingExtent(){const t=this.view.clippingArea;this.graphicsCore.setClippingExtent(t,this.view.spatialReference)&&this.graphicsCore.recreateAllGraphics()}_updateSuspendResumeExtent(){n(this.scaleVisibility)||(this.suspendResumeExtent=C(this.graphicsCore.computedExtent,this.suspendResumeExtent,y,this.graphicsCore.extentPadding),this.scaleVisibility.setExtent(this.suspendResumeExtent))}_setupSuspendResumeExtent(){n(this.scaleVisibility)||(p(this.graphicsCore,"computedExtent",(t=>this._updateSuspendResumeExtent()),!0),this.graphicsCore.watch("extentPadding",(t=>this._updateSuspendResumeExtent())))}};t([h()],E.prototype,"type",void 0),t([h({constructOnly:!0})],E.prototype,"owner",void 0),t([h({constructOnly:!0})],E.prototype,"layer",void 0),t([h({readOnly:!0,aliasOf:"owner.view"})],E.prototype,"view",void 0),t([h({constructOnly:!0})],E.prototype,"graphicsCore",void 0),t([h({constructOnly:!0})],E.prototype,"scaleVisibility",void 0),t([h({readOnly:!0})],E.prototype,"elevationAlignment",void 0),t([h({readOnly:!0})],E.prototype,"objectStates",void 0),t([h({readOnly:!0})],E.prototype,"watchUpdatingTracking",void 0),t([h({readOnly:!0})],E.prototype,"suspended",null),t([h({readOnly:!0})],E.prototype,"updating",null),E=t([l("esri.views.3d.layers.graphics.Graphics3DGraphicLikeLayerView")],E);const V={remove(){},pause(){},resume(){}},A=E;export{A as default};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../Graphic.js";import i from"../../../../core/Accessor.js";import s from"../../../../core/Collection.js";import r from"../../../../core/Handles.js";import{isSome as a,destroyMaybe as o,isNone as n}from"../../../../core/maybe.js";import{isAbortError as c}from"../../../../core/promiseUtils.js";import{init as p}from"../../../../core/watchUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{diff as d}from"../../../../core/accessorSupport/diffUtils.js";import u from"../../../../layers/Layer.js";import{hydrateGraphic as g}from"../../../../layers/graphics/hydratedFeatures.js";import m from"../../../../rest/support/Query.js";import{SUSPEND_RESUME_EXTENT_OPTIMISM as y}from"./constants.js";import{Graphics3DCore as f}from"./Graphics3DCore.js";import b from"./Graphics3DElevationAlignment.js";import{Graphics3DObjectStates as j}from"./Graphics3DObjectStates.js";import w from"./Graphics3DScaleVisibility.js";import{enlargeExtent as C}from"./graphicUtils.js";import{UpdatePolicy as v,Object3DState as S}from"../../webgl-engine/lib/basicInterfaces.js";import{WatchUpdatingTracking as x}from"../../../support/WatchUpdatingTracking.js";let G=class extends i{constructor(t){super(t),this.type="graphics-3d",this.graphicsCore=null,this.elevationAlignment=new b,this.watchUpdatingTracking=new x,this.handles=new r,this.suspendResumeExtent=null}normalizeCtorArgs(t){let e=null;t.scaleVisibilityEnabled&&(delete(t={...t}).scaleVisibilityEnabled,e=new w);const i=new f({owner:t.owner,layer:t.layer,preferredUpdatePolicy:v.SYNC,graphicSymbolSupported:!0});return{...t,graphicsCore:i,scaleVisibility:e}}initialize(){const{layer:t,scaleVisibility:e}=this;a(e)&&"graphics"===t.type&&this.watchUpdatingTracking.add((()=>t.effectiveScaleRange),(()=>e.layerMinMaxScaleChangeHandler())),"graphics"===t.type&&this.watchUpdatingTracking.add((()=>t.elevationInfo),((t,e)=>{d(t,e)&&this.watchUpdatingTracking.addPromise(this.graphicsCore.elevationInfoChange())}))}async setup(){const t=(t,e,i)=>this.graphicsCore.spatialIndex.queryGraphicUIDsInExtent(t,e,i);if(this.elevationAlignment.setup(this.owner,t,this.graphicsCore,this.view.elevationProvider),a(this.scaleVisibility)&&"effectiveScaleRange"in this.layer){const e=this.owner.view.basemapTerrain;this.scaleVisibility.setup(this.owner,this.layer,t,this.graphicsCore,e)}this._set("objectStates",new j(this.graphicsCore));try{await this.graphicsCore.setup({elevationAlignment:this.elevationAlignment,scaleVisibility:this.scaleVisibility,objectStates:this.objectStates})}catch(e){if(c(e))return;throw e}this.destroyed||(this.handles.add(this.view.watch("clippingArea",(()=>this._updateClippingExtent()),!0)),this._updateClippingExtent(),this._setupSuspendResumeExtent(),this.graphicsCore.startCreateGraphics())}destroy(){this.handles=o(this.handles),this.watchUpdatingTracking.destroy(),this._set("elevationAlignment",o(this.elevationAlignment)),this._set("scaleVisibility",o(this.scaleVisibility)),this._set("objectStates",o(this.objectStates)),this._set("graphicsCore",o(this.graphicsCore))}get suspended(){return!(!a(this.scaleVisibility)||!this.scaleVisibility.suspended)}get updating(){var t,e;return!!(null!=(t=this.graphicsCore)&&t.updating||a(this.scaleVisibility)&&this.scaleVisibility.updating||null!=(e=this.watchUpdatingTracking)&&e.updating)}get graphics3DGraphics(){var t;return null==(t=this.graphicsCore)?void 0:t.graphics3DGraphics}get graphics3DGraphicsByObjectID(){var t;return null==(t=this.graphicsCore)?void 0:t.graphics3DGraphicsByObjectID}getGraphicFromGraphicUid(t){if(this.owner.loadedGraphics){const e=this.owner.loadedGraphics.find((e=>e.uid===t));if(e){const t=this.layer instanceof u?this.layer:null;return g(e,t)}}}whenGraphicBounds(t,e){return this.graphicsCore?this.graphicsCore.whenGraphicBounds(t,e):Promise.reject()}computeAttachmentOrigin(t,e){return this.graphicsCore?this.graphicsCore.computeAttachmentOrigin(t,e):null}getSymbolLayerSize(t,e){return this.graphicsCore?this.graphicsCore.getSymbolLayerSize(t,e):null}maskOccludee(t){const{set:e,handle:i}=this.objectStates.acquireSet(S.MaskOccludee,null);return this.objectStates.setUid(e,t.uid),i}highlight(t){if(t instanceof m)return E;if("number"==typeof t)return this.highlight([t]);if(t instanceof e)return this.highlight([t]);if(t instanceof s&&(t=t.toArray()),Array.isArray(t)&&t.length>0){if(t[0]instanceof e){const e=t.map((t=>t.uid)),{set:i,handle:s}=this.objectStates.acquireSet(S.Highlight,null);return this.objectStates.setUids(i,e),s}if("number"==typeof t[0]){const e=t,{set:i,handle:s}=this.objectStates.acquireSet(S.Highlight,null);return this.objectStates.setObjectIds(i,e),s}}return E}_updateClippingExtent(){const t=this.view.clippingArea;this.graphicsCore.setClippingExtent(t,this.view.spatialReference)&&this.graphicsCore.recreateAllGraphics()}_updateSuspendResumeExtent(){n(this.scaleVisibility)||(this.suspendResumeExtent=C(this.graphicsCore.computedExtent,this.suspendResumeExtent,y,this.graphicsCore.extentPadding),this.scaleVisibility.setExtent(this.suspendResumeExtent))}_setupSuspendResumeExtent(){n(this.scaleVisibility)||(p(this.graphicsCore,"computedExtent",(t=>this._updateSuspendResumeExtent()),!0),this.graphicsCore.watch("extentPadding",(t=>this._updateSuspendResumeExtent())))}};t([h()],G.prototype,"type",void 0),t([h({constructOnly:!0})],G.prototype,"owner",void 0),t([h({constructOnly:!0})],G.prototype,"layer",void 0),t([h({readOnly:!0,aliasOf:"owner.view"})],G.prototype,"view",void 0),t([h({constructOnly:!0})],G.prototype,"graphicsCore",void 0),t([h({constructOnly:!0})],G.prototype,"scaleVisibility",void 0),t([h({readOnly:!0})],G.prototype,"elevationAlignment",void 0),t([h({readOnly:!0})],G.prototype,"objectStates",void 0),t([h({readOnly:!0})],G.prototype,"watchUpdatingTracking",void 0),t([h({readOnly:!0})],G.prototype,"suspended",null),t([h({readOnly:!0})],G.prototype,"updating",null),t([h()],G.prototype,"graphics3DGraphics",null),t([h()],G.prototype,"graphics3DGraphicsByObjectID",null),G=t([l("esri.views.3d.layers.graphics.GraphicsProcessor")],G);const E={remove(){},pause(){},resume(){}},O=G;export{O as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import r from"../../../../core/Accessor.js";import{isNone as t}from"../../../../core/maybe.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import n from"../../../../geometry/Extent.js";import o from"../../../../layers/graphics/data/QueryEngine.js";import i from"../../../../rest/support/FeatureSet.js";import u from"../../../../rest/support/Query.js";import{featureGeometryTypeKebabDictionary as y}from"../../../../geometry/support/typeUtils.js";const c=o;let l=class extends r{constructor(e){super(e),this._dataQueryEngineInstance=null}get queryGeometryType(){switch(this.layer.geometryType){case"multipoint":case"point":case"polygon":case"polyline":return this.layer.geometryType;case"mesh":return"polygon";default:return}}get defaultQueryJSON(){return new u({outSpatialReference:this.spatialReference}).toJSON()}get dataQueryEngine(){return this._ensureDataQueryEngine()}destroy(){this.clear()}clear(){return!!this._dataQueryEngineInstance&&(this._dataQueryEngineInstance.destroy(),this._dataQueryEngineInstance=null,!0)}async executeQueryForIdSet(e,r){return this.dataQueryEngine.executeQueryForIdSet(this._ensureQueryJSON(e),r)}async executeQueryForCount(e,r){return this.dataQueryEngine.executeQueryForCount(this._ensureQueryJSON(e),r)}async executeQueryForExtent(e,r){const{count:t,extent:s}=await this.dataQueryEngine.executeQueryForExtent(this._ensureQueryJSON(e),r);return{count:t,extent:n.fromJSON(s)}}async executeQueryForIds(e,r){return this.dataQueryEngine.executeQueryForIds(this._ensureQueryJSON(e),r)}async executeQueryForLatestObservations(e,r){const t=await this.dataQueryEngine.executeQueryForLatestObservations(this._ensureQueryJSON(e),r),s=i.fromJSON(t);return s.features.forEach((e=>{e.layer=this.layer,e.sourceLayer=this.layer})),s}async executeQuery(e,r){const t=await this.dataQueryEngine.executeQuery(this._ensureQueryJSON(e),r),s=i.fromJSON(t);return s.features.forEach((e=>{e.layer=this.layer,e.sourceLayer=this.layer})),s}_ensureQueryJSON(e){return t(e)?this.defaultQueryJSON:("outSpatialReference"in e&&!e.outSpatialReference&&(e.outSpatialReference=this.spatialReference),e.toJSON())}_ensureDataQueryEngine(){if(this._dataQueryEngineInstance)return this._dataQueryEngineInstance;const e="timeInfo"in this.layer&&this.layer.timeInfo&&this.layer.timeInfo.toJSON()||null,r=this.layer.objectIdField,t=y.toJSON(this.queryGeometryType),s=this.layer.fields.map((e=>e.toJSON())),a=this.layerView.view.resourceController.scheduler,n=this.priority,o=this.spatialReference.toJSON(),i=this.layerView.graphics3d.featureStore,{hasZ:u,hasM:l}=this.layerView;return this._dataQueryEngineInstance=new c({hasZ:u,hasM:l,geometryType:t,fields:s,timeInfo:e,spatialReference:o,objectIdField:r,featureStore:i,scheduler:a,priority:n}),this._dataQueryEngineInstance}};e([s({constructOnly:!0})],l.prototype,"layerView",void 0),e([s({constructOnly:!0})],l.prototype,"priority",void 0),e([s({readOnly:!0,aliasOf:"layerView.view.spatialReference"})],l.prototype,"spatialReference",void 0),e([s({readOnly:!0,aliasOf:"layerView.layer"})],l.prototype,"layer",void 0),e([s({readOnly:!0})],l.prototype,"queryGeometryType",null),e([s({readOnly:!0})],l.prototype,"defaultQueryJSON",null),l=e([a("esri.views.3d.layers.graphics.QueryEngine")],l);const p=l;export{l as QueryEngine,p as default};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import r from"../../../../core/Accessor.js";import{isNone as t}from"../../../../core/maybe.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import n from"../../../../geometry/Extent.js";import o from"../../../../layers/graphics/data/QueryEngine.js";import i from"../../../../rest/support/FeatureSet.js";import u from"../../../../rest/support/Query.js";import{featureGeometryTypeKebabDictionary as y}from"../../../../geometry/support/typeUtils.js";const c=o;let l=class extends r{constructor(e){super(e),this._dataQueryEngineInstance=null}get queryGeometryType(){switch(this.layer.geometryType){case"multipoint":case"point":case"polygon":case"polyline":return this.layer.geometryType;case"mesh":return"polygon";default:return}}get defaultQueryJSON(){return new u({outSpatialReference:this.spatialReference}).toJSON()}get dataQueryEngine(){return this._ensureDataQueryEngine()}destroy(){this.clear()}clear(){return!!this._dataQueryEngineInstance&&(this._dataQueryEngineInstance.destroy(),this._dataQueryEngineInstance=null,!0)}async executeQueryForIdSet(e,r){return this.dataQueryEngine.executeQueryForIdSet(this._ensureQueryJSON(e),r)}async executeQueryForCount(e,r){return this.dataQueryEngine.executeQueryForCount(this._ensureQueryJSON(e),r)}async executeQueryForExtent(e,r){const{count:t,extent:s}=await this.dataQueryEngine.executeQueryForExtent(this._ensureQueryJSON(e),r);return{count:t,extent:n.fromJSON(s)}}async executeQueryForIds(e,r){return this.dataQueryEngine.executeQueryForIds(this._ensureQueryJSON(e),r)}async executeQueryForLatestObservations(e,r){const t=await this.dataQueryEngine.executeQueryForLatestObservations(this._ensureQueryJSON(e),r),s=i.fromJSON(t);return s.features.forEach((e=>{e.layer=this.layer,e.sourceLayer=this.layer})),s}async executeQuery(e,r){const t=await this.dataQueryEngine.executeQuery(this._ensureQueryJSON(e),r),s=i.fromJSON(t);return s.features.forEach((e=>{e.layer=this.layer,e.sourceLayer=this.layer})),s}_ensureQueryJSON(e){return t(e)?this.defaultQueryJSON:("outSpatialReference"in e&&!e.outSpatialReference&&(e.outSpatialReference=this.spatialReference),e.toJSON())}_ensureDataQueryEngine(){if(this._dataQueryEngineInstance)return this._dataQueryEngineInstance;const e="timeInfo"in this.layer&&this.layer.timeInfo&&this.layer.timeInfo.toJSON()||null,r=this.layer.objectIdField,t=y.toJSON(this.queryGeometryType),s=this.layer.fields.map((e=>e.toJSON())),a=this.layerView.view.resourceController.scheduler,n=this.priority,o=this.spatialReference.toJSON(),i=this.layerView.processor.featureStore,{hasZ:u,hasM:l}=this.layerView;return this._dataQueryEngineInstance=new c({hasZ:u,hasM:l,geometryType:t,fields:s,timeInfo:e,spatialReference:o,objectIdField:r,featureStore:i,scheduler:a,priority:n}),this._dataQueryEngineInstance}};e([s({constructOnly:!0})],l.prototype,"layerView",void 0),e([s({constructOnly:!0})],l.prototype,"priority",void 0),e([s({readOnly:!0,aliasOf:"layerView.view.spatialReference"})],l.prototype,"spatialReference",void 0),e([s({readOnly:!0,aliasOf:"layerView.layer"})],l.prototype,"layer",void 0),e([s({readOnly:!0})],l.prototype,"queryGeometryType",null),e([s({readOnly:!0})],l.prototype,"defaultQueryJSON",null),l=e([a("esri.views.3d.layers.graphics.QueryEngine")],l);const p=l;export{l as QueryEngine,p as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{d as n,z as i,g as a,e as c,f as d,n as p}from"../../../../chunks/vec3.js";import{c as l}from"../../../../chunks/vec3f64.js";import h from"../../../../geometry/Point.js";import{wrap as u}from"../../../../geometry/support/ray.js";import{PropertiesPool as m}from"../PropertiesPool.js";import{PointOfInterest as f}from"./PointOfInterest.js";import{PaddingSide as y}from"../../webgl-engine/lib/Camera.js";import{TaskPriority as g}from"../../../support/Scheduler.js";const _=Array;let O=class extends f{constructor(e){super(e),this._propertiesPool=new m({location:h,renderLocation:_},this),this._dirty=!0,this.renderLocation=this._propertiesPool.get("renderLocation")}initialize(){this.handles.add([this.centerOnSurface.watch("renderLocation",(()=>this.updateRenderLocation())),this.state.watch("contentCamera",(()=>this.updateRenderLocation()))]),this.scheduler&&this.handles.add(this.scheduler.registerTask(g.POINT_OF_INTEREST_FREQUENT,this))}destroy(){this._propertiesPool.destroy(),this._propertiesPool=null}get updating(){return this._dirty||this.centerOnSurface.updating}get location(){const e=this._propertiesPool.get("location");return this.renderCoordsHelper.fromRenderCoords(this.renderLocation,e,this.state.spatialReference),e}get running(){return this._dirty}runTask(){const e=this._get("renderLocation"),r=this.centerOnSurface.renderLocation,o=this.renderCoordsHelper,s=this.state.contentCamera;this._dirty=!1,o.worldUpAtPosition(r,P);const d=Math.max(0,(Math.acos(n(P,s.viewForward))-.5*Math.PI)*(s.aboveGround?1:-1));if(Number.isNaN(d)){if(!e||!i(e,r)){const e=this._propertiesPool.get("renderLocation");a(e,r),this._set("renderLocation",e)}return}const p=1-t(d/(.5*Math.PI),0,1),l=p*p*p;this._calculateScreenHorizontalEdgeOnSurface(j);const h=this._propertiesPool.get("renderLocation");c(h,r,j,l),e&&i(e,h)||this._set("renderLocation",h)}_calculateScreenHorizontalEdgeOnSurface(e){const t=this.state.contentCamera,o=t.getRenderCenter(r());if(o[1]=t.aboveGround?t.padding[y.BOTTOM]:t.fullHeight-t.padding[y.TOP],this.estimateSurfaceIntersectionAtRenderPoint(o,e))return e;const s=this.renderCoordsHelper.getAltitude(this.centerOnSurface.renderLocation);if(t.unprojectFromRenderScreen(o,S)){d(S,S,t.eye);const r=p(S,S);if(this.renderCoordsHelper.intersectManifold(u(t.eye,r),s,e))return e}return this.renderCoordsHelper.setAltitude(e,s,t.eye)}updateRenderLocation(){this._dirty=!0}};e([o()],O.prototype,"_dirty",void 0),e([o({constructOnly:!0})],O.prototype,"scheduler",void 0),e([o({constructOnly:!0})],O.prototype,"centerOnSurface",void 0),e([o({constructOnly:!0})],O.prototype,"estimateSurfaceIntersectionAtRenderPoint",void 0),e([o({readOnly:!0})],O.prototype,"updating",null),e([o({readOnly:!0})],O.prototype,"location",null),e([o({readOnly:!0})],O.prototype,"renderLocation",void 0),O=e([s("esri.views.3d.support.CenterOnSurface")],O);const P=l(),S=l(),j=l(),L=O;export{O as Focus,L as default};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{d as n,y as i,g as a,e as c,f as d,n as p}from"../../../../chunks/vec3.js";import{c as l}from"../../../../chunks/vec3f64.js";import h from"../../../../geometry/Point.js";import{wrap as u}from"../../../../geometry/support/ray.js";import{PropertiesPool as m}from"../PropertiesPool.js";import{PointOfInterest as f}from"./PointOfInterest.js";import{PaddingSide as y}from"../../webgl-engine/lib/Camera.js";import{TaskPriority as g}from"../../../support/Scheduler.js";const _=Array;let O=class extends f{constructor(e){super(e),this._propertiesPool=new m({location:h,renderLocation:_},this),this._dirty=!0,this.renderLocation=this._propertiesPool.get("renderLocation")}initialize(){this.handles.add([this.centerOnSurface.watch("renderLocation",(()=>this.updateRenderLocation())),this.state.watch("contentCamera",(()=>this.updateRenderLocation()))]),this.scheduler&&this.handles.add(this.scheduler.registerTask(g.POINT_OF_INTEREST_FREQUENT,this))}destroy(){this._propertiesPool.destroy(),this._propertiesPool=null}get updating(){return this._dirty||this.centerOnSurface.updating}get location(){const e=this._propertiesPool.get("location");return this.renderCoordsHelper.fromRenderCoords(this.renderLocation,e,this.state.spatialReference),e}get running(){return this._dirty}runTask(){const e=this._get("renderLocation"),r=this.centerOnSurface.renderLocation,o=this.renderCoordsHelper,s=this.state.contentCamera;this._dirty=!1,o.worldUpAtPosition(r,P);const d=Math.max(0,(Math.acos(n(P,s.viewForward))-.5*Math.PI)*(s.aboveGround?1:-1));if(Number.isNaN(d)){if(!e||!i(e,r)){const e=this._propertiesPool.get("renderLocation");a(e,r),this._set("renderLocation",e)}return}const p=1-t(d/(.5*Math.PI),0,1),l=p*p*p;this._calculateScreenHorizontalEdgeOnSurface(j);const h=this._propertiesPool.get("renderLocation");c(h,r,j,l),e&&i(e,h)||this._set("renderLocation",h)}_calculateScreenHorizontalEdgeOnSurface(e){const t=this.state.contentCamera,o=t.getRenderCenter(r());if(o[1]=t.aboveGround?t.padding[y.BOTTOM]:t.fullHeight-t.padding[y.TOP],this.estimateSurfaceIntersectionAtRenderPoint(o,e))return e;const s=this.renderCoordsHelper.getAltitude(this.centerOnSurface.renderLocation);if(t.unprojectFromRenderScreen(o,S)){d(S,S,t.eye);const r=p(S,S);if(this.renderCoordsHelper.intersectManifold(u(t.eye,r),s,e))return e}return this.renderCoordsHelper.setAltitude(e,s,t.eye)}updateRenderLocation(){this._dirty=!0}};e([o()],O.prototype,"_dirty",void 0),e([o({constructOnly:!0})],O.prototype,"scheduler",void 0),e([o({constructOnly:!0})],O.prototype,"centerOnSurface",void 0),e([o({constructOnly:!0})],O.prototype,"estimateSurfaceIntersectionAtRenderPoint",void 0),e([o({readOnly:!0})],O.prototype,"updating",null),e([o({readOnly:!0})],O.prototype,"location",null),e([o({readOnly:!0})],O.prototype,"renderLocation",void 0),O=e([s("esri.views.3d.support.CenterOnSurface")],O);const P=l(),S=l(),j=l(),L=O;export{O as Focus,L as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Accessor.js";import t from"../../../core/Evented.js";import s from"../../../core/Handles.js";import i from"../../../core/Logger.js";import{someMap as a}from"../../../core/MapUtils.js";import{releaseMaybe as o,disposeMaybe as n,isSome as l,unwrapOr as h,isNone as d,unwrap as c}from"../../../core/maybe.js";import u from"../../../core/PooledArray.js";import{someSet as p}from"../../../core/SetUtils.js";import{init as g}from"../../../core/watchUtils.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as y}from"../../../core/accessorSupport/decorators/subclass.js";import{q as _,f}from"../../../chunks/mat4.js";import{a as R}from"../../../chunks/vec2f64.js";import{f as T,c as b}from"../../../chunks/vec3f64.js";import{I as w}from"../../../chunks/mat4f64.js";import{ViewingMode as v}from"../../ViewingMode.js";import{DrapeTargetType as x,DrapeSourceType as O}from"../layers/interfaces.js";import E from"../support/debugFlags.js";import{OverlayIndex as L,RenderTargetType as j}from"./interfaces.js";import{Overlay as A}from"./Overlay.js";import{OverlayFramebufferObject as S}from"./OverlayFramebufferObject.js";import{OverlayRenderTarget as P}from"./OverlayRenderTarget.js";import{ShaderTechniqueRepository as C}from"../webgl-engine/core/shaderTechnique/ShaderTechniqueRepository.js";import{autoDispose as D,AutoDisposableMixin as G}from"../webgl-engine/lib/AutoDisposable.js";import{TransparencyPassType as I,UpdatePolicy as V}from"../webgl-engine/lib/basicInterfaces.js";import M from"../webgl-engine/lib/Camera.js";import{GLMaterialRepository as U}from"../webgl-engine/lib/GLMaterialRepository.js";import{createEmptyDepthTexture as F,createQuadVAO as q}from"../webgl-engine/lib/glUtil3D.js";import{GridLocalOriginFactory as H}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{newIntersectorResult as W}from"../webgl-engine/lib/Intersector.js";import{StoreResults as N,IntersectorType as B}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as k}from"../webgl-engine/lib/Material.js";import{ModelDirty as z}from"../webgl-engine/lib/ModelDirtyTypes.js";import{OverlayRenderContext as Y}from"../webgl-engine/lib/RenderContext.js";import{RenderPass as X}from"../webgl-engine/lib/RenderPass.js";import{RenderSlot as Q}from"../webgl-engine/lib/RenderSlot.js";import{SortedRenderGeometryRenderer as J}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{TextureTechniqueConfiguration as K,TextureTechnique as Z}from"../webgl-engine/lib/TextureTechnique.js";import{AmbientLight as $}from"../webgl-engine/lighting/Lightsources.js";import{SceneLighting as ee}from"../webgl-engine/lighting/SceneLighting.js";import{StippleTextureRepository as re}from"../webgl-engine/materials/StippleTextureRepository.js";import{C as te}from"../../../chunks/Compositing.glsl.js";import{AlphaMode as se}from"../webgl-engine/shaders/CompositingTechnique.js";import{ImmediateTask as ie,TaskPriority as ae,noBudget as oe}from"../../support/Scheduler.js";import{ClearBufferBit as ne,PrimitiveType as le,TextureType as he,PixelFormat as de,PixelType as ce,TextureSamplingMode as ue}from"../../webgl/enums.js";import{Texture as pe}from"../../webgl/Texture.js";import{vertexCount as ge}from"../../webgl/Util.js";const me=i.getLogger("esri.views.3d.webgl-engine.lib.OverlayRenderer");let ye=class extends(G(r)){constructor(e){super(e),this._overlays=null,this._overlayRenderTarget=null,this._hasHighlights=!1,this._rendersOccluded=!1,this._hasWater=!1,this._lighting=new ee,this._handles=new s,this._frameTask=ie,this._layerRenderers=new Map,this._sortedLayerRenderersDirty=!1,this._sortedLayerRenderers=new u,this._geometries=new Map,this.worldToPCSRatio=1,this.events=new t,this.longitudeCyclical=null}initialize(){const e=this.view._stage.renderView;this._rctx=e.renderingContext,this._renderContext=new Y(this._rctx);const r=e.waterTextureRepository;this._stippleTextureRepository=new re(e.renderingContext),this._shaderTechniqueRepository=new C({rctx:this._rctx,viewingMode:v.Local,stippleTextureRepository:this._stippleTextureRepository,waterTextureRepository:r}),this._handles.add([g(r,"loadingState",(()=>this.events.emit("content-changed"))),g(this,"spatialReference",(e=>this._localOrigins=new H(e)))]),this._materialRepository=new U(e.textureRepository,this._shaderTechniqueRepository,(e=>{(e.renderOccluded&Oe)>0!==this._rendersOccluded&&this._updateRendersOccluded(),this.events.emit("content-changed"),this.notifyChange("updating")}),(()=>this.events.emit("content-changed"))),this._lighting.groundLightingFactor=1,this._lighting.globalFactor=0,this._lighting.set([new $(T(1,1,1))]),this._bindParameters={slot:Q.DRAPED_MATERIAL,highlightDepthTexture:F(this._rctx),camera:be,inverseViewport:R(),origin:null,screenToWorldRatio:null,screenToPCSRatio:null,shadowMappingEnabled:!1,slicePlane:null,ssaoEnabled:!1,hasOccludees:!1,linearDepthTexture:null,lastFrameColorTexture:null,reprojectionMatrix:w,ssrEnabled:!1,lighting:this._lighting,transparencyPassType:I.NONE,terrainLinearDepthTexture:null,geometryLinearDepthTexture:null,multipassTerrainEnabled:!1,cullAboveGround:!1,multipassGeometryEnabled:!1,highlightColorTexture:null},this._frameTask=this.view.resourceController.scheduler.registerTask(ae.STAGE,this),this._handles.add(this._frameTask)}dispose(){this._handles.destroy(),this._layerRenderers.forEach((e=>e.dispose())),this._layerRenderers.clear(),this._debugTextureTechnique=o(this._debugTextureTechnique),this._debugPatternTexture=n(this._debugPatternTexture),this._bindParameters.highlightDepthTexture=n(this._bindParameters.highlightDepthTexture),this._shaderTechniqueRepository=n(this._shaderTechniqueRepository),this._temporaryFBO=n(this._temporaryFBO),this._quadVAO=n(this._quadVAO),this.disposeOverlays()}get updating(){return this._sortedLayerRenderersDirty||this._frameTask.updating||a(this._layerRenderers,(e=>e.updating))}get hasOverlays(){return l(this._overlays)&&l(this._overlayRenderTarget)}get gpuMemoryUsage(){return l(this._overlayRenderTarget)?this._overlayRenderTarget.gpuMemoryUsage:0}collectUnusedRenderTargetMemory(e){let r=!1;if(l(this._overlayRenderTarget))for(const t of this._overlayRenderTarget.renderTargets){const s=this.overlays[0].validTargets[t.type]||!this.overlays[1].validTargets[t.type];r=this._overlayRenderTarget.validateUsageForTarget(s,t,e)||r}return r}get overlays(){return h(this._overlays,[])}ensureDrapeTargets(e){l(this._overlays)&&this._overlays.forEach((r=>{r.hasTargetWithoutRasterImage=p(e,(e=>e.drapeTargetType===x.WithoutRasterImage))}))}ensureDrapeSources(e){l(this._overlays)&&this._overlays.forEach((r=>{r.hasDrapedFeatureSource=a(e,((e,r)=>r.drapeSourceType===O.Features)),r.hasDrapedRasterSource=a(e,((e,r)=>r.drapeSourceType===O.RasterImage))}))}ensureOverlays(e,r){d(this._overlays)&&(this._overlayRenderTarget=new P(this._rctx),this._overlays=[new A(L.INNER,this._overlayRenderTarget),new A(L.OUTER,this._overlayRenderTarget)]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r)}disposeOverlays(){this._overlays=null,this._overlayRenderTarget=n(this._overlayRenderTarget),this.events.emit("textures-disposed")}get running(){return this.updating}runTask(e,r=(()=>!0)){this._frameTask.processQueue(e),e.done||this._processLayers(e,r)}_processLayers(e,r){let t=!1;for(const[s,i]of this._layerRenderers){if(e.done)break;(s.destroyed||r(s))&&(i.commitChanges()&&(t=!0,e.madeProgress()),i.isEmpty&&(t=!0,this._sortedLayerRenderersDirty=!0,this._layerRenderers.delete(s),this._handles.remove(s)))}this._updateSortedLayerRenderers(),t&&(l(this._overlays)&&0===this._layerRenderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.events.emit("content-changed"),this._updateHasHighlights(),this._updateRendersOccluded(),this._updateHasWater())}processSyncLayers(){this._processLayers(oe,(e=>e.updatePolicy===V.SYNC))}addGeometries(e,r,t){for(const s of e)d(s.origin)&&(s.origin=this._localOrigins.getOrigin(s.boundingSphere)),this._geometries.set(s.id,s);this._ensureLayerRenderer(r).add(e),t===z.Geometry.UPDATE&&this._notifyGraphicGeometryChanged(e,r)}removeGeometries(e,r,t){for(const i of e)this._geometries.delete(c(i.id));const s=this._layerRenderers.get(r);s&&(s.remove(e),t===z.Geometry.UPDATE&&this._notifyGraphicGeometryChanged(e,r))}updateGeometries(e,r,t){const s=this._layerRenderers.get(r);if(s)switch(s.modify(e,t),t){case z.State.TRANSFORMATION:case z.State.VERTEXATTRS:return this._notifyGraphicGeometryChanged(e,r);case z.State.VISIBILITIES:return this._notifyGraphicVisibilityChanged(e,r)}else me.warn("Attempted to update geometry for nonexistent layer")}_notifyGraphicGeometryChanged(e,r){if(d(r.notifyGraphicGeometryChanged))return;let t;for(const s of e){const e=s.graphicUid;l(e)&&e!==t&&(r.notifyGraphicGeometryChanged(e),t=e)}}_notifyGraphicVisibilityChanged(e,r){if(d(r.notifyGraphicVisibilityChanged))return;let t;for(const s of e){const e=s.graphicUid;l(e)&&e!==t&&(r.notifyGraphicVisibilityChanged(e),t=e)}}updateHighlights(e,r){const t=this._layerRenderers.get(r);t?t.modify(e,z.State.HIGHLIGHTS):me.warn("Attempted to update highlights for nonexistent layer")}isEmpty(){return 0===this._geometries.size&&!E.OVERLAY_DRAW_DEBUG_TEXTURE}get hasHighlights(){return this._hasHighlights}get hasWater(){return this._hasWater}get rendersOccluded(){return this._rendersOccluded}updateAnimation(e){let r=!1;return this._layerRenderers.forEach((t=>r=t.updateAnimation(e)||r)),r}updateLayerOrder(){this._sortedLayerRenderersDirty=!0}drawTarget(e,r,t){const s=e.canvasGeometries;if(0===s.numViews)return!1;this._screenToWorldRatio=t*e.mapUnitsPerPixel;const i=r.renderPass;if(this.isEmpty()||i===X.MATERIAL_HIGHLIGHT&&!this.hasHighlights||i===X.MATERIAL_NORMAL&&!this.hasWater||!e.hasSomeSizedView())return!1;const a=r.fbo;if(!a.isValid())return!1;const o=2*e.resolution,n=e.resolution;a.resize(o,n);const h=this._rctx;be.pixelRatio=e.pixelRatio*t,this._renderContext.pass=i,this._bindParameters.screenToWorldRatio=this._screenToWorldRatio,this._bindParameters.screenToPCSRatio=this._screenToWorldRatio*this.worldToPCSRatio,this._bindParameters.slot=i===X.MATERIAL_NORMAL?Q.DRAPED_WATER:Q.DRAPED_MATERIAL,e.applyViewport(this._rctx),a.bind(h),e.index===L.INNER&&(h.setClearColor(0,0,0,0),h.clearSafe(ne.COLOR_BUFFER_BIT));const d=r.type===j.ColorNoRasterImage?_e.ExcludeRasterImage:r.type===j.Occluded?_e.OccludedOnly:_e.Normal;if(d===_e.OccludedOnly&&(this._renderContext.renderOccludedMask=Oe),E.OVERLAY_DRAW_DEBUG_TEXTURE&&d!==_e.OccludedOnly)for(let l=0;l<s.numViews;l++)this._setViewParameters(s.extents[l],e,be),this._drawDebugTexture(e.resolution,Re[e.index]);return this._layerRenderers.size>0&&this._sortedLayerRenderers.forAll((({layerView:r,renderer:t})=>{if(d===_e.ExcludeRasterImage&&l(r)&&r.drapeSourceType===O.RasterImage)return;const u=l(r)&&l(r.fullOpacity)&&r.fullOpacity<1&&i===X.MATERIAL;u&&(this.bindTemporaryFramebuffer(this._rctx,o,n),h.clearSafe(ne.COLOR_BUFFER_BIT));for(let i=0;i<s.numViews;i++)this._setViewParameters(s.extents[i],e,be),t.render(this._renderContext,this._bindParameters);u&&l(this._temporaryFBO)&&(a.bind(h),this.view._stage.renderView.compositingHelper.composite(this._temporaryFBO.getTexture(),se.PremultipliedAlpha,c(c(r).fullOpacity),te.OverlayWithTransparency,e.index))})),h.bindFramebuffer(null),a.generateMipMap(),this._renderContext.resetRenderOccludedMask(),!0}bindTemporaryFramebuffer(e,r,t){d(this._temporaryFBO)&&(this._temporaryFBO=new S(e,!1)),this._temporaryFBO.resize(r,t),this._temporaryFBO.bind(e)}async reloadShaders(){await this._shaderTechniqueRepository.reloadAll()}intersect(e,r,t,s){let i=0;this._geometries.forEach((a=>{if(s&&!s(a))return;this._intersectRenderGeometry(a,t,r,0,e,i);const o=this.longitudeCyclical;o&&(a.boundingSphere[0]-a.boundingSphere[3]<o.min&&this._intersectRenderGeometry(a,t,r,o.range,e,i),a.boundingSphere[0]+a.boundingSphere[3]>o.max&&this._intersectRenderGeometry(a,t,r,-o.range,e,i)),i++}))}_intersectRenderGeometry(e,r,t,s,i,a){if(!e.instanceParameters.visible)return;let o=0;l(e.transformation)&&(s+=e.transformation[12],o=e.transformation[13]),we[0]=t[0]-s,we[1]=t[1]-o,we[2]=1,ve[0]=t[0]-s,ve[1]=t[1]-o,ve[2]=0,e.screenToWorldRatio=this._screenToWorldRatio,e.material.intersect(e,null,e.getShaderTransformation(),i,we,ve,((t,s,o)=>{Te(r,o,e.material.renderPriority,a,i,e.layerUid,e.graphicUid)}),e.calculateShaderTransformation,r)}_ensureLayerRenderer(e){let r=this._layerRenderers.get(e);return r||(r=new J({rctx:this._rctx,materialRepository:this._materialRepository}),this._layerRenderers.set(e,r),this._sortedLayerRenderersDirty=!0,"fullOpacity"in e&&this._handles.add(e.watch("fullOpacity",(()=>this.events.emit("content-changed"))),e),this._handles.add(g(r,"updating",(()=>this.notifyChange("updating"))),e)),r}_updateSortedLayerRenderers(){if(!this._sortedLayerRenderersDirty)return;if(this._sortedLayerRenderersDirty=!1,this._sortedLayerRenderers.clear(),0===this._layerRenderers.size)return;const e=new Set(this._layerRenderers.values());this.view.allLayerViews.forEach((r=>{const t=r,s=this._layerRenderers.get(t);s&&(this._sortedLayerRenderers.push(new fe(t,s)),e.delete(s))})),e.forEach((e=>this._sortedLayerRenderers.push(new fe(null,e))))}_setViewParameters(e,r,t){t.viewport[0]=t.viewport[1]=0,t.viewport[2]=t.viewport[3]=r.resolution,_(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),f(t.viewMatrix,[-e[0],-e[1],0]),this._renderContext.camera=t,this._bindParameters.camera=t,this._bindParameters.inverseViewport[0]=1/t.fullViewport[2],this._bindParameters.inverseViewport[1]=1/t.fullViewport[3]}_updateHasWater(){const e=a(this._layerRenderers,(e=>e.hasWater));e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water",e))}_updateHasHighlights(){const e=a(this._layerRenderers,(e=>e.hasHighlights));e!==this._hasHighlights&&(this._hasHighlights=e,this.events.emit("has-highlights",e))}_updateRendersOccluded(){const e=a(this._layerRenderers,(e=>e.rendersOccluded));e!==this._rendersOccluded&&(this._rendersOccluded=e,this.events.emit("renders-occluded",e))}_drawDebugTexture(e,r){const t=this._rctx;this._ensureDebugPatternResources(e,e);const s=this._debugTextureTechnique.program;t.useProgram(s),this._debugTextureTechnique.bindPipelineState(t),s.setUniform4f("color",r[0],r[1],r[2],1),s.bindTexture(this._debugPatternTexture,"tex"),t.bindVAO(this._quadVAO),t.drawArrays(le.TRIANGLE_STRIP,0,ge(this._quadVAO,"geometry"))}_ensureDebugPatternResources(e,r){if(this._debugPatternTexture)return;const t=new Uint8Array(e*r*4);let s=0;for(let a=0;a<r;a++)for(let i=0;i<e;i++){const o=Math.floor(i/10),n=Math.floor(a/10);o<2||n<2||10*o>e-20||10*n>r-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&o&&1&n?1&i^1&a?0:255:1&o^1&n?0:128)}this._debugPatternTexture=new pe(this._rctx,{target:he.TEXTURE_2D,pixelFormat:de.RGBA,dataType:ce.UNSIGNED_BYTE,samplingMode:ue.NEAREST,width:e,height:r},t);const i=new K;i.hasAlpha=!0,this._debugTextureTechnique=this._shaderTechniqueRepository.acquire(Z,i),this._quadVAO=q(this._rctx)}get test(){return{layerRenderers:this._layerRenderers}}};var _e;e([m()],ye.prototype,"_frameTask",void 0),e([m()],ye.prototype,"_sortedLayerRenderersDirty",void 0),e([D()],ye.prototype,"_shaderTechniqueRepository",void 0),e([D()],ye.prototype,"_stippleTextureRepository",void 0),e([m({constructOnly:!0})],ye.prototype,"view",void 0),e([m()],ye.prototype,"worldToPCSRatio",void 0),e([m()],ye.prototype,"spatialReference",void 0),e([m({type:Boolean,readOnly:!0})],ye.prototype,"updating",null),ye=e([y("esri.views.3d.terrain.OverlayRenderer")],ye),function(e){e[e.Normal=0]="Normal",e[e.OccludedOnly=1]="OccludedOnly",e[e.ExcludeRasterImage=2]="ExcludeRasterImage"}(_e||(_e={}));class fe{constructor(e,r){this.layerView=e,this.renderer=r}}const Re=[[1,.5,.5],[.5,.5,1]];function Te(e,r,t,s,i,a,o){const n={layerUid:a,graphicUid:o,triangleNr:r},l=r=>{r.set(B.OVERLAY,n,e.dist,e.normal,e.transformation,t,s)};if((null==i.results.min.drapedLayerOrder||t>=i.results.min.drapedLayerOrder)&&(null==i.results.min.dist||i.results.ground.dist<=i.results.min.dist)&&l(i.results.min),i.options.store!==N.MIN&&(null==i.results.max.drapedLayerOrder||t<i.results.max.drapedLayerOrder)&&(null==i.results.max.dist||i.results.ground.dist>i.results.max.dist)&&l(i.results.max),i.options.store===N.ALL){const e=W(i.ray);l(e),i.results.all.push(e)}}const be=new M;be.near=1,be.far=1e4,be.relativeElevation=null;const we=b(),ve=b(),xe=-2,Oe=k.OccludeAndTransparent;export{xe as DRAPED_Z,_e as DrawPassOption,ye as OverlayRenderer,Oe as overlayRenderOccludedFlag};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Accessor.js";import t from"../../../core/Evented.js";import s from"../../../core/Handles.js";import i from"../../../core/Logger.js";import{someMap as a}from"../../../core/MapUtils.js";import{releaseMaybe as o,disposeMaybe as n,isSome as h,unwrapOr as l,isNone as d,unwrap as c}from"../../../core/maybe.js";import u from"../../../core/PooledArray.js";import{someSet as p}from"../../../core/SetUtils.js";import{init as g}from"../../../core/watchUtils.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as y}from"../../../core/accessorSupport/decorators/subclass.js";import{q as _,f}from"../../../chunks/mat4.js";import{a as R}from"../../../chunks/vec2f64.js";import{f as T,c as b}from"../../../chunks/vec3f64.js";import{I as w}from"../../../chunks/mat4f64.js";import{ViewingMode as v}from"../../ViewingMode.js";import{DrapeTargetType as x,DrapeSourceType as O}from"../layers/interfaces.js";import E from"../support/debugFlags.js";import{OverlayIndex as L,RenderTargetType as j}from"./interfaces.js";import{Overlay as A}from"./Overlay.js";import{OverlayFramebufferObject as S}from"./OverlayFramebufferObject.js";import{OverlayRenderTarget as P}from"./OverlayRenderTarget.js";import{ShaderTechniqueRepository as C}from"../webgl-engine/core/shaderTechnique/ShaderTechniqueRepository.js";import{autoDispose as D,AutoDisposableMixin as G}from"../webgl-engine/lib/AutoDisposable.js";import{TransparencyPassType as I,UpdatePolicy as M}from"../webgl-engine/lib/basicInterfaces.js";import V from"../webgl-engine/lib/Camera.js";import{GLMaterialRepository as U}from"../webgl-engine/lib/GLMaterialRepository.js";import{createEmptyDepthTexture as F,createQuadVAO as q}from"../webgl-engine/lib/glUtil3D.js";import{GridLocalOriginFactory as H}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{newIntersectorResult as W}from"../webgl-engine/lib/Intersector.js";import{StoreResults as N,IntersectorType as B}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as k}from"../webgl-engine/lib/Material.js";import{ModelDirty as z}from"../webgl-engine/lib/ModelDirtyTypes.js";import{OverlayRenderContext as Y}from"../webgl-engine/lib/RenderContext.js";import{RenderPass as X}from"../webgl-engine/lib/RenderPass.js";import{RenderSlot as Q}from"../webgl-engine/lib/RenderSlot.js";import{SortedRenderGeometryRenderer as J}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{TextureTechniqueConfiguration as K,TextureTechnique as Z}from"../webgl-engine/lib/TextureTechnique.js";import{AmbientLight as $}from"../webgl-engine/lighting/Lightsources.js";import{SceneLighting as ee}from"../webgl-engine/lighting/SceneLighting.js";import{StippleTextureRepository as re}from"../webgl-engine/materials/StippleTextureRepository.js";import{C as te}from"../../../chunks/Compositing.glsl.js";import{AlphaMode as se}from"../webgl-engine/shaders/CompositingTechnique.js";import{ImmediateTask as ie,TaskPriority as ae,noBudget as oe}from"../../support/Scheduler.js";import{ClearBufferBit as ne,PrimitiveType as he,TextureType as le,PixelFormat as de,PixelType as ce,TextureSamplingMode as ue}from"../../webgl/enums.js";import{Texture as pe}from"../../webgl/Texture.js";import{vertexCount as ge}from"../../webgl/Util.js";const me=i.getLogger("esri.views.3d.webgl-engine.lib.OverlayRenderer");let ye=class extends(G(r)){constructor(e){super(e),this._overlays=null,this._overlayRenderTarget=null,this._hasHighlights=!1,this._rendersOccluded=!1,this._hasWater=!1,this._lighting=new ee,this._handles=new s,this._frameTask=ie,this._layerRenderers=new Map,this._sortedLayerRenderersDirty=!1,this._sortedLayerRenderers=new u,this._geometries=new Map,this.worldToPCSRatio=1,this.events=new t,this.longitudeCyclical=null}initialize(){const e=this.view._stage.renderView;this._rctx=e.renderingContext,this._renderContext=new Y(this._rctx);const r=e.waterTextureRepository;this._stippleTextureRepository=new re(e.renderingContext),this._shaderTechniqueRepository=new C({rctx:this._rctx,viewingMode:v.Local,stippleTextureRepository:this._stippleTextureRepository,waterTextureRepository:r}),this._handles.add([g(r,"loadingState",(()=>this.events.emit("content-changed"))),g(this,"spatialReference",(e=>this._localOrigins=new H(e)))]),this._materialRepository=new U(e.textureRepository,this._shaderTechniqueRepository,(e=>{(e.renderOccluded&Oe)>0!==this._rendersOccluded&&this._updateRendersOccluded(),this.events.emit("content-changed"),this.notifyChange("updating")}),(()=>this.events.emit("content-changed"))),this._lighting.groundLightingFactor=1,this._lighting.globalFactor=0,this._lighting.set([new $(T(1,1,1))]),this._bindParameters={slot:Q.DRAPED_MATERIAL,highlightDepthTexture:F(this._rctx),camera:be,inverseViewport:R(),origin:null,screenToWorldRatio:null,screenToPCSRatio:null,shadowMappingEnabled:!1,slicePlane:null,ssaoEnabled:!1,hasOccludees:!1,linearDepthTexture:null,lastFrameColorTexture:null,reprojectionMatrix:w,ssrEnabled:!1,lighting:this._lighting,transparencyPassType:I.NONE,terrainLinearDepthTexture:null,geometryLinearDepthTexture:null,multipassTerrainEnabled:!1,cullAboveGround:!1,multipassGeometryEnabled:!1,highlightColorTexture:null,cloudsCompositionParams:null},this._frameTask=this.view.resourceController.scheduler.registerTask(ae.STAGE,this),this._handles.add(this._frameTask)}dispose(){this._handles.destroy(),this._layerRenderers.forEach((e=>e.dispose())),this._layerRenderers.clear(),this._debugTextureTechnique=o(this._debugTextureTechnique),this._debugPatternTexture=n(this._debugPatternTexture),this._bindParameters.highlightDepthTexture=n(this._bindParameters.highlightDepthTexture),this._shaderTechniqueRepository=n(this._shaderTechniqueRepository),this._temporaryFBO=n(this._temporaryFBO),this._quadVAO=n(this._quadVAO),this.disposeOverlays()}get updating(){return this._sortedLayerRenderersDirty||this._frameTask.updating||a(this._layerRenderers,(e=>e.updating))}get hasOverlays(){return h(this._overlays)&&h(this._overlayRenderTarget)}get gpuMemoryUsage(){return h(this._overlayRenderTarget)?this._overlayRenderTarget.gpuMemoryUsage:0}collectUnusedRenderTargetMemory(e){let r=!1;if(h(this._overlayRenderTarget))for(const t of this._overlayRenderTarget.renderTargets){const s=this.overlays[0].validTargets[t.type]||!this.overlays[1].validTargets[t.type];r=this._overlayRenderTarget.validateUsageForTarget(s,t,e)||r}return r}get overlays(){return l(this._overlays,[])}ensureDrapeTargets(e){h(this._overlays)&&this._overlays.forEach((r=>{r.hasTargetWithoutRasterImage=p(e,(e=>e.drapeTargetType===x.WithoutRasterImage))}))}ensureDrapeSources(e){h(this._overlays)&&this._overlays.forEach((r=>{r.hasDrapedFeatureSource=a(e,((e,r)=>r.drapeSourceType===O.Features)),r.hasDrapedRasterSource=a(e,((e,r)=>r.drapeSourceType===O.RasterImage))}))}ensureOverlays(e,r){d(this._overlays)&&(this._overlayRenderTarget=new P(this._rctx),this._overlays=[new A(L.INNER,this._overlayRenderTarget),new A(L.OUTER,this._overlayRenderTarget)]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r)}disposeOverlays(){this._overlays=null,this._overlayRenderTarget=n(this._overlayRenderTarget),this.events.emit("textures-disposed")}get running(){return this.updating}runTask(e,r=(()=>!0)){this._frameTask.processQueue(e),e.done||this._processLayers(e,r)}_processLayers(e,r){let t=!1;for(const[s,i]of this._layerRenderers){if(e.done)break;(s.destroyed||r(s))&&(i.commitChanges()&&(t=!0,e.madeProgress()),i.isEmpty&&(t=!0,this._sortedLayerRenderersDirty=!0,this._layerRenderers.delete(s),this._handles.remove(s)))}this._updateSortedLayerRenderers(),t&&(h(this._overlays)&&0===this._layerRenderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.events.emit("content-changed"),this._updateHasHighlights(),this._updateRendersOccluded(),this._updateHasWater())}processSyncLayers(){this._processLayers(oe,(e=>e.updatePolicy===M.SYNC))}addGeometries(e,r,t){for(const s of e)d(s.origin)&&(s.origin=this._localOrigins.getOrigin(s.boundingSphere)),this._geometries.set(s.id,s);this._ensureLayerRenderer(r).add(e),t===z.Geometry.UPDATE&&this._notifyGraphicGeometryChanged(e,r)}removeGeometries(e,r,t){for(const i of e)this._geometries.delete(c(i.id));const s=this._layerRenderers.get(r);s&&(s.remove(e),t===z.Geometry.UPDATE&&this._notifyGraphicGeometryChanged(e,r))}updateGeometries(e,r,t){const s=this._layerRenderers.get(r);if(s)switch(s.modify(e,t),t){case z.State.TRANSFORMATION:case z.State.VERTEXATTRS:return this._notifyGraphicGeometryChanged(e,r);case z.State.VISIBILITIES:return this._notifyGraphicVisibilityChanged(e,r)}else me.warn("Attempted to update geometry for nonexistent layer")}_notifyGraphicGeometryChanged(e,r){if(d(r.notifyGraphicGeometryChanged))return;let t;for(const s of e){const e=s.graphicUid;h(e)&&e!==t&&(r.notifyGraphicGeometryChanged(e),t=e)}}_notifyGraphicVisibilityChanged(e,r){if(d(r.notifyGraphicVisibilityChanged))return;let t;for(const s of e){const e=s.graphicUid;h(e)&&e!==t&&(r.notifyGraphicVisibilityChanged(e),t=e)}}updateHighlights(e,r){const t=this._layerRenderers.get(r);t?t.modify(e,z.State.HIGHLIGHTS):me.warn("Attempted to update highlights for nonexistent layer")}isEmpty(){return 0===this._geometries.size&&!E.OVERLAY_DRAW_DEBUG_TEXTURE}get hasHighlights(){return this._hasHighlights}get hasWater(){return this._hasWater}get rendersOccluded(){return this._rendersOccluded}updateAnimation(e){let r=!1;return this._layerRenderers.forEach((t=>r=t.updateAnimation(e)||r)),r}updateLayerOrder(){this._sortedLayerRenderersDirty=!0}drawTarget(e,r,t){const s=e.canvasGeometries;if(0===s.numViews)return!1;this._screenToWorldRatio=t*e.mapUnitsPerPixel;const i=r.renderPass;if(this.isEmpty()||i===X.MATERIAL_HIGHLIGHT&&!this.hasHighlights||i===X.MATERIAL_NORMAL&&!this.hasWater||!e.hasSomeSizedView())return!1;const a=r.fbo;if(!a.isValid())return!1;const o=2*e.resolution,n=e.resolution;a.resize(o,n);const l=this._rctx;be.pixelRatio=e.pixelRatio*t,this._renderContext.pass=i,this._bindParameters.screenToWorldRatio=this._screenToWorldRatio,this._bindParameters.screenToPCSRatio=this._screenToWorldRatio*this.worldToPCSRatio,this._bindParameters.slot=i===X.MATERIAL_NORMAL?Q.DRAPED_WATER:Q.DRAPED_MATERIAL,e.applyViewport(this._rctx),a.bind(l),e.index===L.INNER&&(l.setClearColor(0,0,0,0),l.clearSafe(ne.COLOR_BUFFER_BIT));const d=r.type===j.ColorNoRasterImage?_e.ExcludeRasterImage:r.type===j.Occluded?_e.OccludedOnly:_e.Normal;if(d===_e.OccludedOnly&&(this._renderContext.renderOccludedMask=Oe),E.OVERLAY_DRAW_DEBUG_TEXTURE&&d!==_e.OccludedOnly)for(let h=0;h<s.numViews;h++)this._setViewParameters(s.extents[h],e,be),this._drawDebugTexture(e.resolution,Re[e.index]);return this._layerRenderers.size>0&&this._sortedLayerRenderers.forAll((({overlayLayer:r,renderer:t})=>{if(d===_e.ExcludeRasterImage&&r.drapeSourceType===O.RasterImage)return;const{fullOpacity:c}=r,u=h(c)&&c<1&&i===X.MATERIAL;u&&(this.bindTemporaryFramebuffer(this._rctx,o,n),l.clearSafe(ne.COLOR_BUFFER_BIT));for(let i=0;i<s.numViews;i++)this._setViewParameters(s.extents[i],e,be),t.render(this._renderContext,this._bindParameters);u&&h(this._temporaryFBO)&&(a.bind(l),this.view._stage.renderView.compositingHelper.composite(this._temporaryFBO.getTexture(),se.PremultipliedAlpha,c,te.OverlayWithTransparency,e.index))})),l.bindFramebuffer(null),a.generateMipMap(),this._renderContext.resetRenderOccludedMask(),!0}bindTemporaryFramebuffer(e,r,t){d(this._temporaryFBO)&&(this._temporaryFBO=new S(e,!1)),this._temporaryFBO.resize(r,t),this._temporaryFBO.bind(e)}async reloadShaders(){await this._shaderTechniqueRepository.reloadAll()}intersect(e,r,t,s){let i=0;this._geometries.forEach((a=>{if(s&&!s(a))return;this._intersectRenderGeometry(a,t,r,0,e,i);const o=this.longitudeCyclical;o&&(a.boundingSphere[0]-a.boundingSphere[3]<o.min&&this._intersectRenderGeometry(a,t,r,o.range,e,i),a.boundingSphere[0]+a.boundingSphere[3]>o.max&&this._intersectRenderGeometry(a,t,r,-o.range,e,i)),i++}))}_intersectRenderGeometry(e,r,t,s,i,a){if(!e.instanceParameters.visible)return;let o=0;h(e.transformation)&&(s+=e.transformation[12],o=e.transformation[13]),we[0]=t[0]-s,we[1]=t[1]-o,we[2]=1,ve[0]=t[0]-s,ve[1]=t[1]-o,ve[2]=0,e.screenToWorldRatio=this._screenToWorldRatio,e.material.intersect(e,null,e.getShaderTransformation(),i,we,ve,((t,s,o)=>{Te(r,o,e.material.renderPriority,a,i,e.layerUid,e.graphicUid)}),e.calculateShaderTransformation,r)}_ensureLayerRenderer(e){let r=this._layerRenderers.get(e);return r||(r=new J({rctx:this._rctx,materialRepository:this._materialRepository}),this._layerRenderers.set(e,r),this._sortedLayerRenderersDirty=!0,"fullOpacity"in e&&this._handles.add(e.watch("fullOpacity",(()=>this.events.emit("content-changed"))),e),this._handles.add(g(r,"updating",(()=>this.notifyChange("updating"))),e)),r}_updateSortedLayerRenderers(){if(!this._sortedLayerRenderersDirty)return;if(this._sortedLayerRenderersDirty=!1,this._sortedLayerRenderers.clear(),0===this._layerRenderers.size)return;const e=this.view.map.allLayers;this._layerRenderers.forEach(((r,t)=>{const s=e.indexOf(t.layer);this._sortedLayerRenderers.push(new fe(t,r,s<0?1/0:s))})),this._sortedLayerRenderers.sort(((e,r)=>e.index-r.index))}_setViewParameters(e,r,t){t.viewport[0]=t.viewport[1]=0,t.viewport[2]=t.viewport[3]=r.resolution,_(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),f(t.viewMatrix,[-e[0],-e[1],0]),this._renderContext.camera=t,this._bindParameters.camera=t,this._bindParameters.inverseViewport[0]=1/t.fullViewport[2],this._bindParameters.inverseViewport[1]=1/t.fullViewport[3]}_updateHasWater(){const e=a(this._layerRenderers,(e=>e.hasWater));e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water",e))}_updateHasHighlights(){const e=a(this._layerRenderers,(e=>e.hasHighlights));e!==this._hasHighlights&&(this._hasHighlights=e,this.events.emit("has-highlights",e))}_updateRendersOccluded(){const e=a(this._layerRenderers,(e=>e.rendersOccluded));e!==this._rendersOccluded&&(this._rendersOccluded=e,this.events.emit("renders-occluded",e))}_drawDebugTexture(e,r){const t=this._rctx;this._ensureDebugPatternResources(e,e);const s=this._debugTextureTechnique.program;t.useProgram(s),this._debugTextureTechnique.bindPipelineState(t),s.setUniform4f("color",r[0],r[1],r[2],1),s.bindTexture(this._debugPatternTexture,"tex"),t.bindVAO(this._quadVAO),t.drawArrays(he.TRIANGLE_STRIP,0,ge(this._quadVAO,"geometry"))}_ensureDebugPatternResources(e,r){if(this._debugPatternTexture)return;const t=new Uint8Array(e*r*4);let s=0;for(let a=0;a<r;a++)for(let i=0;i<e;i++){const o=Math.floor(i/10),n=Math.floor(a/10);o<2||n<2||10*o>e-20||10*n>r-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&o&&1&n?1&i^1&a?0:255:1&o^1&n?0:128)}this._debugPatternTexture=new pe(this._rctx,{target:le.TEXTURE_2D,pixelFormat:de.RGBA,dataType:ce.UNSIGNED_BYTE,samplingMode:ue.NEAREST,width:e,height:r},t);const i=new K;i.hasAlpha=!0,this._debugTextureTechnique=this._shaderTechniqueRepository.acquire(Z,i),this._quadVAO=q(this._rctx)}get test(){return{layerRenderers:this._layerRenderers}}};var _e;e([m()],ye.prototype,"_frameTask",void 0),e([m()],ye.prototype,"_sortedLayerRenderersDirty",void 0),e([D()],ye.prototype,"_shaderTechniqueRepository",void 0),e([D()],ye.prototype,"_stippleTextureRepository",void 0),e([m({constructOnly:!0})],ye.prototype,"view",void 0),e([m()],ye.prototype,"worldToPCSRatio",void 0),e([m()],ye.prototype,"spatialReference",void 0),e([m({type:Boolean,readOnly:!0})],ye.prototype,"updating",null),ye=e([y("esri.views.3d.terrain.OverlayRenderer")],ye),function(e){e[e.Normal=0]="Normal",e[e.OccludedOnly=1]="OccludedOnly",e[e.ExcludeRasterImage=2]="ExcludeRasterImage"}(_e||(_e={}));class fe{constructor(e,r,t){this.overlayLayer=e,this.renderer=r,this.index=t}}const Re=[[1,.5,.5],[.5,.5,1]];function Te(e,r,t,s,i,a,o){const n={layerUid:a,graphicUid:o,triangleNr:r},h=r=>{r.set(B.OVERLAY,n,e.dist,e.normal,e.transformation,t,s)};if((null==i.results.min.drapedLayerOrder||t>=i.results.min.drapedLayerOrder)&&(null==i.results.min.dist||i.results.ground.dist<=i.results.min.dist)&&h(i.results.min),i.options.store!==N.MIN&&(null==i.results.max.drapedLayerOrder||t<i.results.max.drapedLayerOrder)&&(null==i.results.max.dist||i.results.ground.dist>i.results.max.dist)&&h(i.results.max),i.options.store===N.ALL){const e=W(i.ray);h(e),i.results.all.push(e)}}const be=new V;be.near=1,be.far=1e4,be.relativeElevation=null;const we=b(),ve=b(),xe=-2,Oe=k.OccludeAndTransparent;export{xe as DRAPED_Z,_e as DrawPassOption,ye as OverlayRenderer,Oe as overlayRenderOccludedFlag};
@@ -2,7 +2,13 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{glsl as e}from"../shaderModules/interfaces.js";function r(r,o){o.linearDepth?r.vertex.code.add(e`vec4 transformPositionWithDepth(mat4 proj, mat4 view, vec3 pos, vec2 nearFar, out float depth) {
5
+ import{glsl as e}from"../shaderModules/interfaces.js";function r(r,o){const t={hasModelTransformation:!1,...o};if(t.hasModelTransformation)return t.linearDepth?void r.vertex.code.add(e`vec4 transformPositionWithDepth(mat4 proj, mat4 view, mat4 model, vec3 pos, vec2 nearFar, out float depth) {
6
+ vec4 eye = view * (model * vec4(pos, 1.0));
7
+ depth = (-eye.z - nearFar[0]) / (nearFar[1] - nearFar[0]) ;
8
+ return proj * eye;
9
+ }`):void r.vertex.code.add(e`vec4 transformPosition(mat4 proj, mat4 view, mat4 model, vec3 pos) {
10
+ return proj * (view * (model * vec4(pos, 1.0)));
11
+ }`);t.linearDepth?r.vertex.code.add(e`vec4 transformPositionWithDepth(mat4 proj, mat4 view, vec3 pos, vec2 nearFar, out float depth) {
6
12
  vec4 eye = view * vec4(pos, 1.0);
7
13
  depth = (-eye.z - nearFar[0]) / (nearFar[1] - nearFar[0]) ;
8
14
  return proj * eye;